AT32F413 Firmwary Library: Introduction

AT32F413 Firmwary Library 2.1.7
AT32F413 Peripherals Driver Library
  • Main Page
  • Topics
  • Data Structures
  • Files
Introduction

The AT32F413 Firmware Library is a firmware package which contains the device drivers for all of the peripherals for AT32F413.

This library provides a set of examples for each peripheral and some application such as the IAP and sLib utilities.

The mamual is structured as follows:

  • AT32F413_periph_driver : device drivers
  • AT32F413_periph_examples : examples for AT32F413
  • AT32F413_periph_template : AT32F413 project template for Keil and IAR IDE tools
  • AT32F413_board : AT-START-F413 board setting functions
  • AT32F413_middlewares_i2c_application_library : middlewares for I2C application
  • AT32F413_middlewares_usbd_class : middlewares for different USB device class
  • AT32F413_middlewares_usbd_drivers : middlewares for USB device core driver
  • UTILITIES_examples : some applications such as FreeRTOS, sLib and IAP.
Generated by doxygen 1.12.0


AT32F413 Firmwary Library: Topics

  • Topics
  • Data Structures
  • Files
Topics
Here is a list of all topics with brief descriptions:
[detail level 1234]
► CMSIS |
► AT32F413 |
Library_configuration_section |
Configuration_section_for_CMSIS |
Exported_types |
Exported_macro |
Peripheral_memory_map |
► AT32F413_system |
AT32F413_system_clock_stable_definition |
AT32F413_system_exported_variables |
AT32F413_system_exported_functions |
AT32F413_system_private_defines |
AT32F413_system_private_variables |
AT32F413_system_private_functions |
► AT32F413_periph_driver |
► ACC | ACC driver modules
ACC_exported_constants |
ACC_exported_types |
ACC_exported_functions |
ACC_private_functions |
► ADC | ADC driver modules
ADC_interrupts_definition | Adc interrupt
ADC_flags_definition | Adc flag
ADC_exported_types |
ADC_exported_functions |
ADC_private_functions |
► BPR | BPR driver modules
BPR_flags_definition | Bpr flag
BPR_exported_types |
BPR_exported_functions |
BPR_private_functions |
► CAN | CAN driver modules
CAN_timeout_count |
CAN_flags_definition | Can flag
CAN_interrupts_definition | Can interrupt
CAN_exported_types |
CAN_exported_functions |
CAN_private_functions |
► CRC | CRC driver modules
CRC_exported_types |
CRC_exported_functions |
CRC_private_functions |
► CRM | CRM driver modules
CRM_flags_definition | Crm flag
CRM_interrupts_definition | Crm interrupt
CRM_exported_types |
CRM_exported_functions |
CRM_private_functions |
► DEBUG | DEBUG driver modules
DEBUG_mode_definition |
DEBUG_exported_types |
DEBUG_exported_functions |
DEBUG_private_functions |
► DMA | DMA driver modules
DMA_interrupts_definition | Dma interrupt
DMA_flexible_channel |
DMA_flags_definition | Dma flag
DMA_exported_types |
DMA_exported_functions |
DMA_private_functions |
► EXINT | EXINT driver modules
EXINT_lines |
EXINT_exported_types |
EXINT_exported_functions |
EXINT_private_functions |
► FLASH | FLASH driver modules
FLASH_unlock_keys | Flash unlock keys
FLASH_spim_address | Flash spim address
FLASH_flags | Flash flag
FLASH_interrupts | Flash interrupts
FLASH_slib_mask | Flash slib mask
FLASH_user_system_data | Flash user system data
FLASH_timeout_definition | Flash timeout definition
FLASH_exported_types |
FLASH_exported_functions |
FLASH_private_functions |
► GPIO | GPIO driver modules
GPIO_pins_number_definition |
IOMUX_map_definition | Iomux map definitions
IOMUX_map2_definition | Iomux map2 definitions
IOMUX_map3_definition | Iomux map3 definitions
IOMUX_map4_definition | Iomux map4 definitions
IOMUX_map5_definition | Iomux map5 definitions
IOMUX_map6_definition | Iomux map6 definitions
IOMUX_map7_definition | Iomux map7 definitions
GPIO_exported_types |
GPIO_exported_functions |
GPIO_private_functions |
► I2C | I2C driver modules
I2C_sts1_flags_definition | I2c sts1 flag
I2C_sts2_flags_definition | I2c sts2 flag
I2C_interrupts_definition | I2c interrupt
I2C_exported_types |
I2C_exported_functions |
I2C_private_functions |
► MISC | MISC driver modules
MISC_vector_table_base_address |
MISC_exported_types |
MISC_exported_functions |
MISC_private_functions |
► PWC | PWC driver modules
PWC_flags_definition | Pwc flag
PWC_exported_types |
PWC_exported_functions |
PWC_private_functions |
► RTC | RTC driver modules
RTC_interrupts_definition | Rtc interrupt
RTC_flags_definition | Rtc flag
RTC_exported_types |
RTC_exported_functions |
RTC_private_functions |
► SDIO | SDIO driver modules
SDIO_interrupts_definition | Sdio interrupt
SDIO_flags_definition | Sdio flag
SDIO_exported_types |
SDIO_exported_functions |
SDIO_private_functions |
► SPI | SPI driver modules
SPI_I2S_flags_definition | Spi i2s flag
SPI_I2S_interrupts_definition | Spi i2s interrupt
SPI_exported_types |
SPI_exported_functions |
SPI_private_functions |
► TMR | TMR driver modules
TMR_flags_definition | Tmr flag
TMR_interrupt_select_type_definition | Tmr interrupt select type
TMR_exported_types |
TMR_exported_functions |
TMR_private_functions |
► USART | USART driver modules
USART_flags_definition | Usart flag
USART_interrupts_definition | Usart interrupt
USART_exported_types |
USART_exported_functions |
USART_private_functions |
► USB | USB driver modules
USB_interrupts_definition | Usb interrupt mask
USB_interrupt_flags_definition | Usb interrupt flag
USB_endpoint_register_bit_definition | Usb endpoint register bit define
USB_endpoint_tx_and_rx_status_definition | Usb endpoint tx and rx status
USB_device_endpoint_register_type_definition | Usb device endpoint register type define
USB_buffer_table_default_offset_address_definition | Usb buffer table default offset address
USB_packet_buffer_start_address_definition | Usb packet buffer start address
USB_exported_enum_types |
USB_macro_definition |
USB_exported_types |
USB_exported_functions |
USB_private_functions |
► WDT | WDT driver modules
WDT_flags_definition | Wdt flag
WDT_exported_types |
WDT_exported_functions |
WDT_private_functions |
► WWDT | WWDT driver modules
WWDT_enable_bit_definition | Wwdt enable bit
WWDT_exported_types |
WWDT_exported_functions |
WWDT_private_functions |
► AT32F413_periph_examples |
ACC_calibration |
ADC_combine_mode_ordinary_simult |
ADC_current_vref_value_check |
ADC_exint_trigger_partitioned |
ADC_internal_temperature_sensor |
ADC_repeat_conversion_loop_transfer |
ADC_tmr_trigger_automatic_preempted |
ADC_voltage_monitoring |
BPR_data |
BPR_tamper |
CAN_communication_mode |
CAN_filter |
CAN_loopback_mode |
CORTEX_m4_bit_band |
CORTEX_m4_cmsis_dsp |
► CORTEX_m4_fpu |
JULIA_fpu_functions |
CORTEX_m4_systick_interrupt |
CRC_calculation |
CRM_clock_failure_detection |
CRM_sysclk_switch |
DEBUG_tmr |
DMA_data_to_gpio_flexible |
DMA_flash_to_sram |
EXINT_config |
EXINT_software_trigger |
► FLASH_write_read |
FLASH_write_read_functions |
► FLASH_operate_spim |
FLASH_operate_spim_functions |
FLASH_run_in_spim |
GPIO_io_toggle |
GPIO_led_toggle |
GPIO_swjtag_remap |
I2C_communication_dma |
I2C_communication_int |
I2C_communication_poll |
I2C_eeprom |
I2C_memory_write |
I2S_halfduplex_dma |
I2S_halfduplex_interrupt |
I2S_spii2s_switch_halfduplex_polling |
PWC_deepsleep_rtc |
PWC_power_voltage_monitor |
PWC_sleep_tmr2 |
PWC_sleep_usart1 |
PWC_standby_rtc |
PWC_standby_wakeup_pin |
► RTC_calendar |
RTC_calendar_type |
RTC_calendar_exported_functions |
RTC_lick_calibration |
► SDIO_emmc_card |
SDIO_instance_definition |
SDIO_exported_types |
SDIO_command_index_definition |
SDIO_paremeters_definition |
SDIO_response_definition |
SDIO_command_class_definition |
SDIO_cmd8_definition |
SDIO_mmc_extend_definition |
SDIO_interrupt_flags_definition |
SDIO_exported_functions |
SDIO_emmc_card |
► SDIO_sd_mmc_card |
SDIO_instance_definition |
SDIO_exported_types |
SDIO_command_index_definition |
SDIO_paremeters_definition |
SDIO_response_definition |
SDIO_command_class_definition |
SDIO_cmd8_definition |
SDIO_mmc_extend_definition |
SDIO_interrupt_flags_definition |
SDIO_exported_functions |
SDIO_sd_mmc_card |
► SDIO_sdio_fatfs |
SDIO_instance_definition |
SDIO_exported_types |
SDIO_command_index_definition |
SDIO_paremeters_definition |
SDIO_response_definition |
SDIO_command_class_definition |
SDIO_cmd8_definition |
SDIO_mmc_extend_definition |
SDIO_interrupt_flags_definition |
SDIO_exported_functions |
SDIO_sdio_fatfs |
SPI_crc_transfer_polling |
SPI_fullduplex_dma_jtagpin |
SPI_fullduplex_polling |
SPI_halfduplex_dma_jtagpin |
SPI_halfduplex_interrupt |
SPI_halfduplex_transceiver_switch |
SPI_only_receive_mode_polling |
► SPI_w25q_flash |
SPI_flash_cs_pin_definition |
SPI_flash_id_definition |
SPI_flash_operation_definition |
SPI_flash_exported_functions |
TMR_6_steps |
TMR_7_pwm_output |
TMR_cascade_synchro |
TMR_complementary_signals |
TMR_dma |
TMR_dma_burst |
TMR_encoder_tmr2 |
TMR_external_clock |
TMR_hall_xor_tmr2 |
TMR_hang_mode |
TMR_input_capture |
TMR_oc_high |
TMR_oc_low |
TMR_oc_toggle_tmr3 |
TMR_oc_toggle_tmr9 |
TMR_one_cycle |
TMR_parallel_synchro |
TMR_pwm_input |
TMR_pwm_input_dma |
TMR_pwm_output_simulate |
TMR_pwm_output_tmr10 |
TMR_pwm_output_tmr3 |
TMR_timer_base |
TMR_tmr1_synchro |
TMR_tmr2_32bit |
USART_half_duplex |
USART_hw_flow_control |
USART_idle_detection |
USART_interrupt |
USART_irda |
USART_polling |
USART_printf |
USART_receiver_mute |
F413_USART_rs485 |
USART_smartcard |
USART_synchronous |
USART_transfer_by_dma_interrupt |
USART_transfer_by_dma_polling |
► USB_device_audio |
USB_device_audio_codec_reg_definition |
USB_device_audio_codec_pin_definition |
USB_device_audio_codec_exported_functions |
► USB_device_audio_hid |
USB_device_audio_hid_codec_reg_definition |
USB_device_audio_hid_codec_pin_definition |
USB_device_audio_hid_codec_exported_functions |
USB_device_composite_vcp_keyboard |
USB_device_msc |
USB_device_composite_vcp_msc |
USB_device_custom_hid |
USB_device_keyboard |
USB_device_mouse |
USB_device_printer |
USB_device_vcp_loopback |
► USB_device_virtual_msc_iap |
USB_device_virtual_msc_iap_definition |
USB_device_winusb |
WDT_reset |
WDT_standby |
WWDT_reset |
► AT32F413_periph_template |
System_clock_configuration |
LED_toggle |
Library_configuration |
► AT32F413_board |
► BOARD | Onboard periph driver
BOARD_pins_definition |
BOARD_exported_functions |
► AT32F413_middlewares_i2c_application_library |
I2C_library_event_check_flag |
I2C_library_memory_address_width_mode |
I2C_library_transmission_mode |
I2C_library_status_code |
I2C_library_handler |
I2C_library_exported_functions |
► AT32F413_middlewares_usbd_class |
► USB_audio_class | Usb device class audio demo
USB_audio_class_private_functions |
USB_audio_class_definition |
USB_device_audio_config_definition |
► USB_audio_desc | Usb device audio descriptor
USB_audio_desc_private_functions |
USB_audio_desc_definition |
► USB_audio_hid_class | Usb device class audio hid demo
USB_device_audio_hid_config_definition |
USB_audio_hid_class_private_functions |
USB_audio_hid_class_definition |
► USB_audio_hid_desc | Usb device audio hid descriptor
USB_audio_hid_desc_private_functions |
USB_audio_hid_desc_definition |
► USB_cdc_class | Usb device class cdc demo
USB_cdc_class_private_functions |
USB_cdc_class_definition |
► USB_cdc_class_exported_types |
USB_msc_bot_scsi_definition |
USB_cdc_msc_class_exported_functions |
USB_cdc_class_exported_functions |
► USB_cdc_desc | Usb device cdc descriptor
USB_cdc_desc_private_functions |
USB_cdc_desc_definition |
► USB_cdc_keyboard_class | Usb device class composite cdc and keyboard
USB_cdc_keyboard_class_private_functions |
USB_cdc_keyboard_class_definition |
► USB_cdc_class_exported_types |
USB_msc_bot_scsi_definition |
USB_cdc_msc_class_exported_functions |
USB_cdc_keyboar_class_exported_functions |
► USB_cdc_keyboard_desc | Usb device cdc keyboard descriptor
USB_cdc_keyboard_desc_private_functions |
USB_cdc_keyboard_desc_definition |
► USB_cdc_msc_class | Usb device class cdc msc demo
USB_cdc_msc_class_private_functions |
USB_cdc_class_definition |
► USB_cdc_class_exported_types |
USB_msc_bot_scsi_definition |
USB_cdc_msc_class_exported_functions |
► USB_cdc_msc_desc | Usb device cdc msc descriptor
USB_cdc_msc_desc_private_functions |
USB_cdc_desc_definition |
► USB_msc_bot_scsi | Usb device class mass storage demo
USB_msc_bot_functions |
USB_msc_bot_scsi_definition |
► USB_custom_hid_class | Usb device custom hid demo
USB_custom_hid_class_private_functions |
USB_custom_hid_class_endpoint_definition |
USB_custom_hid_class_request_code_definition |
USB_custom_hid_class_exported_functions |
► USB_custom_hid_desc | Usb device custom_hid descriptor
USB_custom_hid_desc_private_functions |
USB_custom_hid_desc_definition |
► USB_hid_iap_class | Usb device class hid iap demo
USB_hid_iap_class_private_functions |
USB_hid_iap_class_definition |
► USB_hid_iap_desc | Usb device hid_iap descriptor
USB_hid_iap_desc_private_functions |
USB_hid_iap_desc_definition |
► USB_keyboard_class | Usb device keyboard demo
USB_keyboard_class_private_functions |
USB_keyboard_class_endpoint_definition |
USB_hid_class_exported_functions |
► USB_keyboard_desc | Usb device keyboard descriptor
USB_keyboard_desc_private_functions |
USB_keyboard_desc_definition |
► USB_mouse_class | Usb device mouse demo
USB_mouse_class_private_functions |
USB_mouse_class_endpoint_definition |
USB_mouse_class_request_code_definition |
USB_hid_class_exported_functions |
► USB_mouse_desc | Usb device mouse descriptor
USB_mouse_desc_private_functions |
USB_mouse_desc_definition |
► USB_msc_class | Usb device class msc demo
USB_msc_class_private_functions |
USB_msc_class_definition |
► USB_msc_desc | Usb device msc descriptor
USB_msc_desc_private_functions |
USB_msc_desc_definition |
► USB_printer_class | Usb device class printer demo
USB_printer_class_private_functions |
USB_printer_class_definition |
► USB_printer_desc | Usb device printer descriptor
USB_printer_desc_private_functions |
USB_printer_desc_definition |
► USB_winusb_class | Usb device class win usb
USB_winusb_class_private_functions |
USB_winusb_class_definition |
USB_winusb_class_exported_types |
USB_cdc_class_exported_functions |
► USB_winusb_desc | Usb device winusb descriptor
USB_winusb_desc_private_functions |
USB_winusb_desc_definition |
► AT32F413_middlewares_usbd_drivers |
► USBD_drivers_core | Usb device drivers core
USBD_core_exported_types |
USBD_core_exported_functions |
USBD_core_private_functions |
► USBD_drivers_interrupt | Usb device interrupt
USBD_int_exported_functions |
USBD_int_private_functions |
► USBD_drivers_standard_request | Usb device standard_request
USBD_sdr_exported_functions |
USBD_sdr_private_functions |
► USB_standard |
USB_standard_define |
USB_standard_exported_types |
► UTILITIES_examples |
FreeRTOS_demo |
► GEN_random_number_demo |
RTC_asseed_definition |
GEN_random_number_demo_exported_functions |
SLIB_project_l0 |
SLIB_project_l1 |
► USART_iap_app_led3_toggle |
App_led3_definition |
App_led3_exported_functions |
► USART_iap_app_led4_toggle |
App_led4_definition |
App_led4_exported_functions |
► USART_iap_bootloader |
Bootloader_definition |
Bootloader_exported_functions |
Bootloader_exported_types |
► USB_iap_app_led3_toggle |
App_led3_toggle_definition |
App_led3_toggle_exported_functions |
► USB_iap_app_led4_toggle |
App_led4_toggle_definition |
App_led4_toggle_exported_functions |
► USB_iap_bootloader |
Bootloader_definition |
Bootloader_exported_functions |


AT32F413 Firmwary Library: CMSIS

Topics
CMSIS

Topics

AT32F413
AT32F413_system

Detailed Description

Generated by doxygen 1.12.0


AT32F413 Firmwary Library: AT32F413

Topics
AT32F413
CMSIS

Topics

Library_configuration_section
Configuration_section_for_CMSIS
Exported_types
Exported_macro
Peripheral_memory_map

Detailed Description

Generated by doxygen 1.12.0


AT32F413 Firmwary Library: Library_configuration_section

Macros
Library_configuration_section
CMSIS » AT32F413

Macros

#define | __AT32F413_LIBRARY_VERSION_MAJOR (0x02)
at32f413 standard peripheral library version number
#define | __AT32F413_LIBRARY_VERSION_MIDDLE (0x01)
#define | __AT32F413_LIBRARY_VERSION_MINOR (0x07)
#define | __AT32F413_LIBRARY_VERSION_RC (0x00)
#define | __AT32F413_LIBRARY_VERSION

Detailed Description

Macro Definition Documentation

◆ __AT32F413_LIBRARY_VERSION

#define __AT32F413_LIBRARY_VERSION
Value:
((__AT32F413_LIBRARY_VERSION_MAJOR << 24) | \
(__AT32F413_LIBRARY_VERSION_MIDDLE << 16) | \
(__AT32F413_LIBRARY_VERSION_MINOR << 8) | \
(__AT32F413_LIBRARY_VERSION_RC))
__AT32F413_LIBRARY_VERSION_MIDDLE
#define __AT32F413_LIBRARY_VERSION_MIDDLE
Definition at32f413.h:127
__AT32F413_LIBRARY_VERSION_RC
#define __AT32F413_LIBRARY_VERSION_RC
Definition at32f413.h:129
__AT32F413_LIBRARY_VERSION_MAJOR
#define __AT32F413_LIBRARY_VERSION_MAJOR
at32f413 standard peripheral library version number
Definition at32f413.h:126
__AT32F413_LIBRARY_VERSION_MINOR
#define __AT32F413_LIBRARY_VERSION_MINOR
Definition at32f413.h:128

Definition at line 130 of file at32f413.h.

◆ __AT32F413_LIBRARY_VERSION_MAJOR

#define __AT32F413_LIBRARY_VERSION_MAJOR (0x02)

at32f413 standard peripheral library version number

tip: to avoid modifying this file each time you need to switch between these devices, you can define the device in your toolchain compiler preprocessor. define with package define with memory density [31:24] major version

Definition at line 126 of file at32f413.h.

◆ __AT32F413_LIBRARY_VERSION_MIDDLE

#define __AT32F413_LIBRARY_VERSION_MIDDLE (0x01)

[23:16] middle version

Definition at line 127 of file at32f413.h.

◆ __AT32F413_LIBRARY_VERSION_MINOR

#define __AT32F413_LIBRARY_VERSION_MINOR (0x07)

[15:8] minor version

Definition at line 128 of file at32f413.h.

◆ __AT32F413_LIBRARY_VERSION_RC

#define __AT32F413_LIBRARY_VERSION_RC (0x00)

[7:0] release candidate

Definition at line 129 of file at32f413.h.


AT32F413 Firmwary Library: Configuration_section_for_CMSIS

Macros | Typedefs | Enumerations
Configuration_section_for_CMSIS
CMSIS » AT32F413

Macros

#define | __CM4_REV 0x0001U
configuration of the cortex-m4 processor and core peripherals
#define | __MPU_PRESENT 1
#define | __NVIC_PRIO_BITS 4
#define | __Vendor_SysTickConfig 0
#define | __FPU_PRESENT 1U

Typedefs

typedef enum IRQn IRQn_Type
at32f413 interrupt number definition, according to the selected device in Library_configuration_section

Enumerations

enum IRQn {
Reset_IRQn = -15 , NonMaskableInt_IRQn = -14 , HardFault_IRQn = -13 , MemoryManagement_IRQn = -12 ,
BusFault_IRQn = -11 , UsageFault_IRQn = -10 , SVCall_IRQn = -5 , DebugMonitor_IRQn = -4 ,
PendSV_IRQn = -2 , SysTick_IRQn = -1 , WWDT_IRQn = 0 , PVM_IRQn = 1 ,
TAMPER_IRQn = 2 , RTC_IRQn = 3 , FLASH_IRQn = 4 , CRM_IRQn = 5 ,
EXINT0_IRQn = 6 , EXINT1_IRQn = 7 , EXINT2_IRQn = 8 , EXINT3_IRQn = 9 ,
EXINT4_IRQn = 10 , DMA1_Channel1_IRQn = 11 , DMA1_Channel2_IRQn = 12 , DMA1_Channel3_IRQn = 13 ,
DMA1_Channel4_IRQn = 14 , DMA1_Channel5_IRQn = 15 , DMA1_Channel6_IRQn = 16 , DMA1_Channel7_IRQn = 17 ,
ADC1_2_IRQn = 18 , USBFS_H_CAN1_TX_IRQn = 19 , USBFS_L_CAN1_RX0_IRQn = 20 , CAN1_RX1_IRQn = 21 ,
CAN1_SE_IRQn = 22 , EXINT9_5_IRQn = 23 , TMR1_BRK_TMR9_IRQn = 24 , TMR1_OVF_TMR10_IRQn = 25 ,
TMR1_TRG_HALL_TMR11_IRQn = 26 , TMR1_CH_IRQn = 27 , TMR2_GLOBAL_IRQn = 28 , TMR3_GLOBAL_IRQn = 29 ,
TMR4_GLOBAL_IRQn = 30 , I2C1_EVT_IRQn = 31 , I2C1_ERR_IRQn = 32 , I2C2_EVT_IRQn = 33 ,
I2C2_ERR_IRQn = 34 , SPI1_IRQn = 35 , SPI2_IRQn = 36 , USART1_IRQn = 37 ,
USART2_IRQn = 38 , USART3_IRQn = 39 , EXINT15_10_IRQn = 40 , RTCAlarm_IRQn = 41 ,
USBFSWakeUp_IRQn = 42 , TMR8_BRK_IRQn = 43 , TMR8_OVF_IRQn = 44 , TMR8_TRG_HALL_IRQn = 45 ,
TMR8_CH_IRQn = 46 , SDIO1_IRQn = 49 , TMR5_GLOBAL_IRQn = 50 , UART4_IRQn = 52 ,
UART5_IRQn = 53 , DMA2_Channel1_IRQn = 56 , DMA2_Channel2_IRQn = 57 , DMA2_Channel3_IRQn = 58 ,
DMA2_Channel4_5_IRQn = 59 , CAN2_TX_IRQn = 68 , CAN2_RX0_IRQn = 69 , CAN2_RX1_IRQn = 70 ,
CAN2_SE_IRQn = 71 , ACC_IRQn = 72 , USBFS_MAPH_IRQn = 73 , USBFS_MAPL_IRQn = 74 ,
DMA2_Channel6_7_IRQn = 75
}
at32f413 interrupt number definition, according to the selected device in Library_configuration_section More...

Detailed Description

Macro Definition Documentation

◆ __CM4_REV

#define __CM4_REV 0x0001U

configuration of the cortex-m4 processor and core peripherals

core revision r0p1

Definition at line 146 of file at32f413.h.

◆ __FPU_PRESENT

#define __FPU_PRESENT 1U

fpu present

Definition at line 150 of file at32f413.h.

◆ __MPU_PRESENT

#define __MPU_PRESENT 1

mpu present

Definition at line 147 of file at32f413.h.

◆ __NVIC_PRIO_BITS

#define __NVIC_PRIO_BITS 4

at32 uses 4 bits for the priority levels

Definition at line 148 of file at32f413.h.

Referenced by systick_interrupt_config().

◆ __Vendor_SysTickConfig

#define __Vendor_SysTickConfig 0

set to 1 if different systick config is used

Definition at line 149 of file at32f413.h.

Typedef Documentation

◆ IRQn_Type

typedef enum IRQn IRQn_Type

at32f413 interrupt number definition, according to the selected device in Library_configuration_section

Enumeration Type Documentation

◆ IRQn

enum IRQn

at32f413 interrupt number definition, according to the selected device in Library_configuration_section

Enumerator
Reset_IRQn | 1 reset vector, invoked on power up and warm reset
NonMaskableInt_IRQn | 2 non maskable interrupt
HardFault_IRQn | 3 hard fault, all classes of fault
MemoryManagement_IRQn | 4 cortex-m4 memory management interrupt
BusFault_IRQn | 5 cortex-m4 bus fault interrupt
UsageFault_IRQn | 6 cortex-m4 usage fault interrupt
SVCall_IRQn | 11 cortex-m4 sv call interrupt
DebugMonitor_IRQn | 12 cortex-m4 debug monitor interrupt
PendSV_IRQn | 14 cortex-m4 pend sv interrupt
SysTick_IRQn | 15 cortex-m4 system tick interrupt
WWDT_IRQn | window watchdog timer interrupt
PVM_IRQn | pvm through exint line detection interrupt
TAMPER_IRQn | tamper interrupt
RTC_IRQn | rtc global interrupt
FLASH_IRQn | flash global interrupt
CRM_IRQn | crm global interrupt
EXINT0_IRQn | external line0 interrupt
EXINT1_IRQn | external line1 interrupt
EXINT2_IRQn | external line2 interrupt
EXINT3_IRQn | external line3 interrupt
EXINT4_IRQn | external line4 interrupt
DMA1_Channel1_IRQn | dma1 channel 1 global interrupt
DMA1_Channel2_IRQn | dma1 channel 2 global interrupt
DMA1_Channel3_IRQn | dma1 channel 3 global interrupt
DMA1_Channel4_IRQn | dma1 channel 4 global interrupt
DMA1_Channel5_IRQn | dma1 channel 5 global interrupt
DMA1_Channel6_IRQn | dma1 channel 6 global interrupt
DMA1_Channel7_IRQn | dma1 channel 7 global interrupt
ADC1_2_IRQn | adc1 and adc2 global interrupt
USBFS_H_CAN1_TX_IRQn | usb device high priority or can1 tx interrupts
USBFS_L_CAN1_RX0_IRQn | usb device low priority or can1 rx0 interrupts
CAN1_RX1_IRQn | can1 rx1 interrupt
CAN1_SE_IRQn | can1 se interrupt
EXINT9_5_IRQn | external line[9:5] interrupts
TMR1_BRK_TMR9_IRQn | tmr1 brake interrupt
TMR1_OVF_TMR10_IRQn | tmr1 overflow interrupt
TMR1_TRG_HALL_TMR11_IRQn | tmr1 trigger and hall interrupt
TMR1_CH_IRQn | tmr1 channel interrupt
TMR2_GLOBAL_IRQn | tmr2 global interrupt
TMR3_GLOBAL_IRQn | tmr3 global interrupt
TMR4_GLOBAL_IRQn | tmr4 global interrupt
I2C1_EVT_IRQn | i2c1 event interrupt
I2C1_ERR_IRQn | i2c1 error interrupt
I2C2_EVT_IRQn | i2c2 event interrupt
I2C2_ERR_IRQn | i2c2 error interrupt
SPI1_IRQn | spi1 global interrupt
SPI2_IRQn | spi2 global interrupt
USART1_IRQn | usart1 global interrupt
USART2_IRQn | usart2 global interrupt
USART3_IRQn | usart3 global interrupt
EXINT15_10_IRQn | external line[15:10] interrupts
RTCAlarm_IRQn | rtc alarm through exint line interrupt
USBFSWakeUp_IRQn | usb device wakeup from suspend through exint line interrupt
TMR8_BRK_IRQn | tmr8 brake interrupt
TMR8_OVF_IRQn | tmr8 overflow interrupt
TMR8_TRG_HALL_IRQn | tmr8 trigger and hall interrupt
TMR8_CH_IRQn | tmr8 channel interrupt
SDIO1_IRQn | sdio1 global interrupt
TMR5_GLOBAL_IRQn | tmr5 global interrupt
UART4_IRQn | uart4 global interrupt
UART5_IRQn | uart5 global interrupt
DMA2_Channel1_IRQn | dma2 channel 1 global interrupt
DMA2_Channel2_IRQn | dma2 channel 2 global interrupt
DMA2_Channel3_IRQn | dma2 channel 3 global interrupt
DMA2_Channel4_5_IRQn | dma2 channel 4 and channel 5 global interrupt
CAN2_TX_IRQn | can2 tx interrupt
CAN2_RX0_IRQn | can2 rx0 interrupt
CAN2_RX1_IRQn | can2 rx1 interrupt
CAN2_SE_IRQn | can2 se interrupt
ACC_IRQn | acc interrupt
USBFS_MAPH_IRQn | usb map hp interrupt
USBFS_MAPL_IRQn | usb map lp interrupt
DMA2_Channel6_7_IRQn | dma2 channel 6 and channel 7 global interrupt

Definition at line 156 of file at32f413.h.


AT32F413 Firmwary Library: Exported_types

Typedefs | Enumerations
Exported_types
CMSIS » AT32F413

Typedefs

typedef int32_t | INT32
typedef int16_t | INT16
typedef int8_t | INT8
typedef uint32_t | UINT32
typedef uint16_t | UINT16
typedef uint8_t | UINT8
typedef int32_t | s32
typedef int16_t | s16
typedef int8_t | s8
typedef const int32_t | sc32
typedef const int16_t | sc16
typedef const int8_t | sc8
typedef __IO int32_t | vs32
typedef __IO int16_t | vs16
typedef __IO int8_t | vs8
typedef __I int32_t | vsc32
typedef __I int16_t | vsc16
typedef __I int8_t | vsc8
typedef uint32_t | u32
typedef uint16_t | u16
typedef uint8_t | u8
typedef const uint32_t | uc32
typedef const uint16_t | uc16
typedef const uint8_t | uc8
typedef __IO uint32_t | vu32
typedef __IO uint16_t | vu16
typedef __IO uint8_t | vu8
typedef __I uint32_t | vuc32
typedef __I uint16_t | vuc16
typedef __I uint8_t | vuc8

Enumerations

enum | flag_status { RESET = 0 , SET = !RESET }
flag status More...
enum | confirm_state { FALSE = 0 , TRUE = !FALSE }
confirm state More...
enum | error_status { ERROR = 0 , SUCCESS = !ERROR }
error status More...

Detailed Description

Typedef Documentation

◆ INT16

typedef int16_t INT16

Definition at line 251 of file at32f413.h.

◆ INT32

typedef int32_t INT32

Definition at line 250 of file at32f413.h.

◆ INT8

typedef int8_t INT8

Definition at line 252 of file at32f413.h.

◆ s16

typedef int16_t s16

Definition at line 258 of file at32f413.h.

◆ s32

typedef int32_t s32

Definition at line 257 of file at32f413.h.

◆ s8

typedef int8_t s8

Definition at line 259 of file at32f413.h.

◆ sc16

typedef const int16_t sc16

read only

Definition at line 262 of file at32f413.h.

◆ sc32

typedef const int32_t sc32

read only

Definition at line 261 of file at32f413.h.

◆ sc8

typedef const int8_t sc8

read only

Definition at line 263 of file at32f413.h.

◆ u16

typedef uint16_t u16

Definition at line 274 of file at32f413.h.

◆ u32

typedef uint32_t u32

Definition at line 273 of file at32f413.h.

◆ u8

typedef uint8_t u8

Definition at line 275 of file at32f413.h.

◆ uc16

typedef const uint16_t uc16

read only

Definition at line 278 of file at32f413.h.

◆ uc32

typedef const uint32_t uc32

read only

Definition at line 277 of file at32f413.h.

◆ uc8

typedef const uint8_t uc8

read only

Definition at line 279 of file at32f413.h.

◆ UINT16

typedef uint16_t UINT16

Definition at line 254 of file at32f413.h.

◆ UINT32

typedef uint32_t UINT32

Definition at line 253 of file at32f413.h.

◆ UINT8

typedef uint8_t UINT8

Definition at line 255 of file at32f413.h.

◆ vs16

typedef __IO int16_t vs16

Definition at line 266 of file at32f413.h.

◆ vs32

typedef __IO int32_t vs32

Definition at line 265 of file at32f413.h.

◆ vs8

typedef __IO int8_t vs8

Definition at line 267 of file at32f413.h.

◆ vsc16

typedef __I int16_t vsc16

read only

Definition at line 270 of file at32f413.h.

◆ vsc32

typedef __I int32_t vsc32

read only

Definition at line 269 of file at32f413.h.

◆ vsc8

typedef __I int8_t vsc8

read only

Definition at line 271 of file at32f413.h.

◆ vu16

typedef __IO uint16_t vu16

Definition at line 282 of file at32f413.h.

◆ vu32

typedef __IO uint32_t vu32

Definition at line 281 of file at32f413.h.

◆ vu8

typedef __IO uint8_t vu8

Definition at line 283 of file at32f413.h.

◆ vuc16

typedef __I uint16_t vuc16

read only

Definition at line 286 of file at32f413.h.

◆ vuc32

typedef __I uint32_t vuc32

read only

Definition at line 285 of file at32f413.h.

◆ vuc8

typedef __I uint8_t vuc8

read only

Definition at line 287 of file at32f413.h.

Enumeration Type Documentation

◆ confirm_state

enum confirm_state

confirm state

Enumerator
FALSE
TRUE

Definition at line 297 of file at32f413.h.

◆ error_status

enum error_status

error status

Enumerator
ERROR
SUCCESS

Definition at line 302 of file at32f413.h.

◆ flag_status

enum flag_status

flag status

Enumerator
RESET
SET

Definition at line 292 of file at32f413.h.


AT32F413 Firmwary Library: Exported_macro

Macros
Exported_macro
CMSIS » AT32F413

Macros

#define | REG8(addr)
#define | REG16(addr)
#define | REG32(addr)
#define | MAKE_VALUE(reg_offset, bit_num)
#define | PERIPH_REG(periph_base, value)
#define | PERIPH_REG_BIT(value)

Detailed Description

Macro Definition Documentation

◆ MAKE_VALUE

#define MAKE_VALUE | ( | reg_offset,
 |  | bit_num )
Value:
(uint32_t)(((reg_offset) << 16) | (bit_num & 0x1F))

Definition at line 316 of file at32f413.h.

◆ PERIPH_REG

#define PERIPH_REG | ( | periph_base,
 |  | value )
Value:
REG32((periph_base + (value >> 16)))
REG32
#define REG32(addr)
Definition at32f413.h:314

Definition at line 318 of file at32f413.h.

Referenced by usart_interrupt_enable().

◆ PERIPH_REG_BIT

#define PERIPH_REG_BIT ( value )
Value:
(0x1U << (value & 0x1F))

Definition at line 319 of file at32f413.h.

Referenced by usart_interrupt_enable().

◆ REG16

#define REG16 ( addr )
Value:
*(volatile uint16_t *)(addr)

Definition at line 313 of file at32f413.h.

◆ REG32

#define REG32 ( addr )
Value:
*(volatile uint32_t *)(addr)

Definition at line 314 of file at32f413.h.

◆ REG8

#define REG8 ( addr )
Value:
*(volatile uint8_t *)(addr)

Definition at line 312 of file at32f413.h.


AT32F413 Firmwary Library: Peripheral_memory_map

Macros
Peripheral_memory_map
CMSIS » AT32F413

Macros

#define | FLASH_BASE ((uint32_t)0x08000000)
#define | SPIM_FLASH_BASE ((uint32_t)0x08400000)
#define | USD_BASE ((uint32_t)0x1FFFF800)
#define | SRAM_BASE ((uint32_t)0x20000000)
#define | PERIPH_BASE ((uint32_t)0x40000000)
#define | XMC_REG_BASE ((uint32_t)0xA0000000)
#define | DEBUG_BASE ((uint32_t)0xE0042000)
#define | APB1PERIPH_BASE (PERIPH_BASE + 0x00000)
#define | APB2PERIPH_BASE (PERIPH_BASE + 0x10000)
#define | AHBPERIPH_BASE (PERIPH_BASE + 0x20000)
#define | TMR2_BASE (APB1PERIPH_BASE + 0x0000)
#define | TMR3_BASE (APB1PERIPH_BASE + 0x0400)
#define | TMR4_BASE (APB1PERIPH_BASE + 0x0800)
#define | TMR5_BASE (APB1PERIPH_BASE + 0x0C00)
#define | RTC_BASE (APB1PERIPH_BASE + 0x2800)
#define | WWDT_BASE (APB1PERIPH_BASE + 0x2C00)
#define | WDT_BASE (APB1PERIPH_BASE + 0x3000)
#define | SPI2_BASE (APB1PERIPH_BASE + 0x3800)
#define | USART2_BASE (APB1PERIPH_BASE + 0x4400)
#define | USART3_BASE (APB1PERIPH_BASE + 0x4800)
#define | UART4_BASE (APB1PERIPH_BASE + 0x4C00)
#define | UART5_BASE (APB1PERIPH_BASE + 0x5000)
#define | I2C1_BASE (APB1PERIPH_BASE + 0x5400)
#define | I2C2_BASE (APB1PERIPH_BASE + 0x5800)
#define | USBFS_BASE (APB1PERIPH_BASE + 0x5C00)
#define | CAN1_BASE (APB1PERIPH_BASE + 0x6400)
#define | CAN2_BASE (APB1PERIPH_BASE + 0x6800)
#define | BPR_BASE (APB1PERIPH_BASE + 0x6C00)
#define | PWC_BASE (APB1PERIPH_BASE + 0x7000)
#define | IOMUX_BASE (APB2PERIPH_BASE + 0x0000)
#define | EXINT_BASE (APB2PERIPH_BASE + 0x0400)
#define | GPIOA_BASE (APB2PERIPH_BASE + 0x0800)
#define | GPIOB_BASE (APB2PERIPH_BASE + 0x0C00)
#define | GPIOC_BASE (APB2PERIPH_BASE + 0x1000)
#define | GPIOD_BASE (APB2PERIPH_BASE + 0x1400)
#define | GPIOF_BASE (APB2PERIPH_BASE + 0x1C00)
#define | ADC1_BASE (APB2PERIPH_BASE + 0x2400)
#define | ADC2_BASE (APB2PERIPH_BASE + 0x2800)
#define | TMR1_BASE (APB2PERIPH_BASE + 0x2C00)
#define | SPI1_BASE (APB2PERIPH_BASE + 0x3000)
#define | TMR8_BASE (APB2PERIPH_BASE + 0x3400)
#define | USART1_BASE (APB2PERIPH_BASE + 0x3800)
#define | TMR9_BASE (APB2PERIPH_BASE + 0x4C00)
#define | TMR10_BASE (APB2PERIPH_BASE + 0x5000)
#define | TMR11_BASE (APB2PERIPH_BASE + 0x5400)
#define | ACC_BASE (APB2PERIPH_BASE + 0x5800)
#define | SDIO1_BASE (APB2PERIPH_BASE + 0x8000)
#define | DMA1_BASE (AHBPERIPH_BASE + 0x0000)
#define | DMA1_CHANNEL1_BASE (AHBPERIPH_BASE + 0x0008)
#define | DMA1_CHANNEL2_BASE (AHBPERIPH_BASE + 0x001C)
#define | DMA1_CHANNEL3_BASE (AHBPERIPH_BASE + 0x0030)
#define | DMA1_CHANNEL4_BASE (AHBPERIPH_BASE + 0x0044)
#define | DMA1_CHANNEL5_BASE (AHBPERIPH_BASE + 0x0058)
#define | DMA1_CHANNEL6_BASE (AHBPERIPH_BASE + 0x006C)
#define | DMA1_CHANNEL7_BASE (AHBPERIPH_BASE + 0x0080)
#define | DMA2_BASE (AHBPERIPH_BASE + 0x0400)
#define | DMA2_CHANNEL1_BASE (AHBPERIPH_BASE + 0x0408)
#define | DMA2_CHANNEL2_BASE (AHBPERIPH_BASE + 0x041C)
#define | DMA2_CHANNEL3_BASE (AHBPERIPH_BASE + 0x0430)
#define | DMA2_CHANNEL4_BASE (AHBPERIPH_BASE + 0x0444)
#define | DMA2_CHANNEL5_BASE (AHBPERIPH_BASE + 0x0458)
#define | DMA2_CHANNEL6_BASE (AHBPERIPH_BASE + 0x046C)
#define | DMA2_CHANNEL7_BASE (AHBPERIPH_BASE + 0x0480)
#define | CRM_BASE (AHBPERIPH_BASE + 0x1000)
#define | FLASH_REG_BASE (AHBPERIPH_BASE + 0x2000)
#define | CRC_BASE (AHBPERIPH_BASE + 0x3000)

Detailed Description

Macro Definition Documentation

◆ ACC_BASE

#define ACC_BASE (APB2PERIPH_BASE + 0x5800)

Definition at line 378 of file at32f413.h.

◆ ADC1_BASE

#define ADC1_BASE (APB2PERIPH_BASE + 0x2400)

Definition at line 369 of file at32f413.h.

◆ ADC2_BASE

#define ADC2_BASE (APB2PERIPH_BASE + 0x2800)

Definition at line 370 of file at32f413.h.

◆ AHBPERIPH_BASE

#define AHBPERIPH_BASE (PERIPH_BASE + 0x20000)

Definition at line 339 of file at32f413.h.

◆ APB1PERIPH_BASE

#define APB1PERIPH_BASE (PERIPH_BASE + 0x00000)

Definition at line 337 of file at32f413.h.

◆ APB2PERIPH_BASE

#define APB2PERIPH_BASE (PERIPH_BASE + 0x10000)

Definition at line 338 of file at32f413.h.

◆ BPR_BASE

#define BPR_BASE (APB1PERIPH_BASE + 0x6C00)

Definition at line 359 of file at32f413.h.

Referenced by bpr_data_read(), and bpr_data_write().

◆ CAN1_BASE

#define CAN1_BASE (APB1PERIPH_BASE + 0x6400)

Definition at line 357 of file at32f413.h.

◆ CAN2_BASE

#define CAN2_BASE (APB1PERIPH_BASE + 0x6800)

Definition at line 358 of file at32f413.h.

◆ CRC_BASE

#define CRC_BASE (AHBPERIPH_BASE + 0x3000)

Definition at line 399 of file at32f413.h.

◆ CRM_BASE

#define CRM_BASE (AHBPERIPH_BASE + 0x1000)

Definition at line 397 of file at32f413.h.

◆ DEBUG_BASE

#define DEBUG_BASE ((uint32_t)0xE0042000)

Definition at line 335 of file at32f413.h.

◆ DMA1_BASE

#define DMA1_BASE (AHBPERIPH_BASE + 0x0000)

Definition at line 381 of file at32f413.h.

◆ DMA1_CHANNEL1_BASE

#define DMA1_CHANNEL1_BASE (AHBPERIPH_BASE + 0x0008)

Definition at line 382 of file at32f413.h.

◆ DMA1_CHANNEL2_BASE

#define DMA1_CHANNEL2_BASE (AHBPERIPH_BASE + 0x001C)

Definition at line 383 of file at32f413.h.

◆ DMA1_CHANNEL3_BASE

#define DMA1_CHANNEL3_BASE (AHBPERIPH_BASE + 0x0030)

Definition at line 384 of file at32f413.h.

◆ DMA1_CHANNEL4_BASE

#define DMA1_CHANNEL4_BASE (AHBPERIPH_BASE + 0x0044)

Definition at line 385 of file at32f413.h.

◆ DMA1_CHANNEL5_BASE

#define DMA1_CHANNEL5_BASE (AHBPERIPH_BASE + 0x0058)

Definition at line 386 of file at32f413.h.

◆ DMA1_CHANNEL6_BASE

#define DMA1_CHANNEL6_BASE (AHBPERIPH_BASE + 0x006C)

Definition at line 387 of file at32f413.h.

◆ DMA1_CHANNEL7_BASE

#define DMA1_CHANNEL7_BASE (AHBPERIPH_BASE + 0x0080)

Definition at line 388 of file at32f413.h.

◆ DMA2_BASE

#define DMA2_BASE (AHBPERIPH_BASE + 0x0400)

Definition at line 389 of file at32f413.h.

◆ DMA2_CHANNEL1_BASE

#define DMA2_CHANNEL1_BASE (AHBPERIPH_BASE + 0x0408)

Definition at line 390 of file at32f413.h.

◆ DMA2_CHANNEL2_BASE

#define DMA2_CHANNEL2_BASE (AHBPERIPH_BASE + 0x041C)

Definition at line 391 of file at32f413.h.

◆ DMA2_CHANNEL3_BASE

#define DMA2_CHANNEL3_BASE (AHBPERIPH_BASE + 0x0430)

Definition at line 392 of file at32f413.h.

◆ DMA2_CHANNEL4_BASE

#define DMA2_CHANNEL4_BASE (AHBPERIPH_BASE + 0x0444)

Definition at line 393 of file at32f413.h.

◆ DMA2_CHANNEL5_BASE

#define DMA2_CHANNEL5_BASE (AHBPERIPH_BASE + 0x0458)

Definition at line 394 of file at32f413.h.

◆ DMA2_CHANNEL6_BASE

#define DMA2_CHANNEL6_BASE (AHBPERIPH_BASE + 0x046C)

Definition at line 395 of file at32f413.h.

◆ DMA2_CHANNEL7_BASE

#define DMA2_CHANNEL7_BASE (AHBPERIPH_BASE + 0x0480)

Definition at line 396 of file at32f413.h.

◆ EXINT_BASE

#define EXINT_BASE (APB2PERIPH_BASE + 0x0400)

Definition at line 363 of file at32f413.h.

◆ FLASH_BASE

#define FLASH_BASE ((uint32_t)0x08000000)

Definition at line 329 of file at32f413.h.

Referenced by app_update_handle(), flash_fat16_init(), flash_write(), iap_init(), msc_disk_capacity(), and SystemInit().

◆ FLASH_REG_BASE

#define FLASH_REG_BASE (AHBPERIPH_BASE + 0x2000)

Definition at line 398 of file at32f413.h.

◆ GPIOA_BASE

#define GPIOA_BASE (APB2PERIPH_BASE + 0x0800)

Definition at line 364 of file at32f413.h.

◆ GPIOB_BASE

#define GPIOB_BASE (APB2PERIPH_BASE + 0x0C00)

Definition at line 365 of file at32f413.h.

◆ GPIOC_BASE

#define GPIOC_BASE (APB2PERIPH_BASE + 0x1000)

Definition at line 366 of file at32f413.h.

◆ GPIOD_BASE

#define GPIOD_BASE (APB2PERIPH_BASE + 0x1400)

Definition at line 367 of file at32f413.h.

◆ GPIOF_BASE

#define GPIOF_BASE (APB2PERIPH_BASE + 0x1C00)

Definition at line 368 of file at32f413.h.

◆ I2C1_BASE

#define I2C1_BASE (APB1PERIPH_BASE + 0x5400)

Definition at line 354 of file at32f413.h.

◆ I2C2_BASE

#define I2C2_BASE (APB1PERIPH_BASE + 0x5800)

Definition at line 355 of file at32f413.h.

◆ IOMUX_BASE

#define IOMUX_BASE (APB2PERIPH_BASE + 0x0000)

Definition at line 362 of file at32f413.h.

Referenced by gpio_pin_remap_config().

◆ PERIPH_BASE

#define PERIPH_BASE ((uint32_t)0x40000000)

Definition at line 333 of file at32f413.h.

◆ PWC_BASE

#define PWC_BASE (APB1PERIPH_BASE + 0x7000)

Definition at line 360 of file at32f413.h.

◆ RTC_BASE

#define RTC_BASE (APB1PERIPH_BASE + 0x2800)

Definition at line 346 of file at32f413.h.

◆ SDIO1_BASE

#define SDIO1_BASE (APB2PERIPH_BASE + 0x8000)

Definition at line 379 of file at32f413.h.

◆ SPI1_BASE

#define SPI1_BASE (APB2PERIPH_BASE + 0x3000)

Definition at line 372 of file at32f413.h.

◆ SPI2_BASE

#define SPI2_BASE (APB1PERIPH_BASE + 0x3800)

Definition at line 349 of file at32f413.h.

◆ SPIM_FLASH_BASE

#define SPIM_FLASH_BASE ((uint32_t)0x08400000)

Definition at line 330 of file at32f413.h.

◆ SRAM_BASE

#define SRAM_BASE ((uint32_t)0x20000000)

Definition at line 332 of file at32f413.h.

Referenced by SystemInit().

◆ TMR10_BASE

#define TMR10_BASE (APB2PERIPH_BASE + 0x5000)

Definition at line 376 of file at32f413.h.

◆ TMR11_BASE

#define TMR11_BASE (APB2PERIPH_BASE + 0x5400)

Definition at line 377 of file at32f413.h.

◆ TMR1_BASE

#define TMR1_BASE (APB2PERIPH_BASE + 0x2C00)

Definition at line 371 of file at32f413.h.

◆ TMR2_BASE

#define TMR2_BASE (APB1PERIPH_BASE + 0x0000)

Definition at line 342 of file at32f413.h.

◆ TMR3_BASE

#define TMR3_BASE (APB1PERIPH_BASE + 0x0400)

Definition at line 343 of file at32f413.h.

◆ TMR4_BASE

#define TMR4_BASE (APB1PERIPH_BASE + 0x0800)

Definition at line 344 of file at32f413.h.

◆ TMR5_BASE

#define TMR5_BASE (APB1PERIPH_BASE + 0x0C00)

Definition at line 345 of file at32f413.h.

◆ TMR8_BASE

#define TMR8_BASE (APB2PERIPH_BASE + 0x3400)

Definition at line 373 of file at32f413.h.

◆ TMR9_BASE

#define TMR9_BASE (APB2PERIPH_BASE + 0x4C00)

Definition at line 375 of file at32f413.h.

◆ UART4_BASE

#define UART4_BASE (APB1PERIPH_BASE + 0x4C00)

Definition at line 352 of file at32f413.h.

◆ UART5_BASE

#define UART5_BASE (APB1PERIPH_BASE + 0x5000)

Definition at line 353 of file at32f413.h.

◆ USART1_BASE

#define USART1_BASE (APB2PERIPH_BASE + 0x3800)

Definition at line 374 of file at32f413.h.

◆ USART2_BASE

#define USART2_BASE (APB1PERIPH_BASE + 0x4400)

Definition at line 350 of file at32f413.h.

◆ USART3_BASE

#define USART3_BASE (APB1PERIPH_BASE + 0x4800)

Definition at line 351 of file at32f413.h.

◆ USBFS_BASE

#define USBFS_BASE (APB1PERIPH_BASE + 0x5C00)

Definition at line 356 of file at32f413.h.

◆ USD_BASE

#define USD_BASE ((uint32_t)0x1FFFF800)

Definition at line 331 of file at32f413.h.

Referenced by flash_spim_model_select(), flash_spim_unlock(), and flash_user_system_data_program().

◆ WDT_BASE

#define WDT_BASE (APB1PERIPH_BASE + 0x3000)

Definition at line 348 of file at32f413.h.

◆ WWDT_BASE

#define WWDT_BASE (APB1PERIPH_BASE + 0x2C00)

Definition at line 347 of file at32f413.h.

◆ XMC_REG_BASE

#define XMC_REG_BASE ((uint32_t)0xA0000000)

Definition at line 334 of file at32f413.h.


AT32F413 Firmwary Library: AT32F413_system

Topics
AT32F413_system
CMSIS

Topics

AT32F413_system_clock_stable_definition
AT32F413_system_exported_variables
AT32F413_system_exported_functions
AT32F413_system_private_defines
AT32F413_system_private_variables
AT32F413_system_private_functions

Detailed Description

Generated by doxygen 1.12.0


AT32F413 Firmwary Library: AT32F413_system_clock_stable_definition

Macros
AT32F413_system_clock_stable_definition
CMSIS » AT32F413_system

Macros

#define | HEXT_STABLE_DELAY (5000u)
#define | PLL_STABLE_DELAY (500u)
#define | SystemCoreClock system_core_clock
#define | DUMMY_NOP()

Detailed Description

Macro Definition Documentation

◆ DUMMY_NOP

#define DUMMY_NOP ( )
Value:
{__NOP();__NOP();__NOP();__NOP();__NOP(); \
__NOP();__NOP();__NOP();__NOP();__NOP(); \
__NOP();__NOP();__NOP();__NOP();__NOP(); \
__NOP();__NOP();__NOP();__NOP();__NOP();}

Definition at line 48 of file system_at32f413.h.

Referenced by crm_sysclk_switch().

◆ HEXT_STABLE_DELAY

#define HEXT_STABLE_DELAY (5000u)

Definition at line 45 of file system_at32f413.h.

◆ PLL_STABLE_DELAY

#define PLL_STABLE_DELAY (500u)

Definition at line 46 of file system_at32f413.h.

◆ SystemCoreClock

#define SystemCoreClock system_core_clock

Definition at line 47 of file system_at32f413.h.


AT32F413 Firmwary Library: AT32F413_system_exported_variables

Variables
AT32F413_system_exported_variables
CMSIS » AT32F413_system

Variables

unsigned int system_core_clock

Detailed Description

Variable Documentation

◆ system_core_clock

unsigned int system_core_clock
extern

system clock frequency (core clock)

value of the high speed internal clock in hz system clock frequency (core clock)

Definition at line 47 of file system_at32f413.c.

Referenced by delay_init(), DMA1_Channel2_IRQHandler(), main(), mclk_tmr1_init(), sd_init(), sd_power_on(), system_core_clock_update(), tmr1_config(), TMR3_GLOBAL_IRQHandler(), and usb_clock48m_select().


AT32F413 Firmwary Library: AT32F413_system_exported_functions

Functions
AT32F413_system_exported_functions
CMSIS » AT32F413_system

Functions

void | SystemInit (void)
setup the microcontroller system initialize the flash interface.
void | system_core_clock_update (void)
update system_core_clock variable according to clock register values. the system_core_clock variable contains the core clock (hclk), it can be used by the user application to setup the systick timer or configure other parameters.

Detailed Description

Function Documentation

◆ system_core_clock_update()

void system_core_clock_update ( void )
extern

update system_core_clock variable according to clock register values. the system_core_clock variable contains the core clock (hclk), it can be used by the user application to setup the systick timer or configure other parameters.

Parameters
none
Return values
none

< value of the high speed internal clock in hz

< value of the high speed internal clock in hz

< value of the high speed external crystal in hz

< value of the high speed internal clock in hz

< value of the high speed external crystal in hz

< value of the high speed external crystal in hz

< value of the high speed internal clock in hz

Definition at line 111 of file system_at32f413.c.

Referenced by sclk_192m_hick_config(), sclk_64m_hick_config(), sclk_96m_hext_config(), system_clock_config(), and system_clock_config_for_acc().

◆ SystemInit()

void SystemInit ( void )
extern

setup the microcontroller system initialize the flash interface.

Note
this function should be used only after reset.
Parameters
none
Return values
none

< vector table base offset field. this value must be a multiple of 0x200.

Definition at line 63 of file system_at32f413.c.


AT32F413 Firmwary Library: AT32F413_system_private_defines

Macros
AT32F413_system_private_defines
CMSIS » AT32F413_system

Macros

#define VECT_TAB_OFFSET 0x0

Detailed Description

Macro Definition Documentation

◆ VECT_TAB_OFFSET

#define VECT_TAB_OFFSET 0x0

vector table base offset field. this value must be a multiple of 0x200.

Definition at line 39 of file system_at32f413.c.

Referenced by SystemInit().


AT32F413 Firmwary Library: AT32F413_system_private_variables

Variables
AT32F413_system_private_variables
CMSIS » AT32F413_system

Variables

unsigned int system_core_clock = ((uint32_t)8000000)

Detailed Description

Variable Documentation

◆ system_core_clock

unsigned int system_core_clock = ((uint32_t)8000000)

value of the high speed internal clock in hz system clock frequency (core clock)

Definition at line 47 of file system_at32f413.c.

Referenced by delay_init(), DMA1_Channel2_IRQHandler(), main(), mclk_tmr1_init(), sd_init(), sd_power_on(), system_core_clock_update(), tmr1_config(), TMR3_GLOBAL_IRQHandler(), and usb_clock48m_select().


AT32F413 Firmwary Library: AT32F413_system_private_functions

Functions
AT32F413_system_private_functions
CMSIS » AT32F413_system

Functions

void | SystemInit (void)
setup the microcontroller system initialize the flash interface.
void | system_core_clock_update (void)
update system_core_clock variable according to clock register values. the system_core_clock variable contains the core clock (hclk), it can be used by the user application to setup the systick timer or configure other parameters.

Detailed Description

Function Documentation

◆ system_core_clock_update()

void system_core_clock_update ( void )

update system_core_clock variable according to clock register values. the system_core_clock variable contains the core clock (hclk), it can be used by the user application to setup the systick timer or configure other parameters.

Parameters
none
Return values
none

< value of the high speed internal clock in hz

< value of the high speed internal clock in hz

< value of the high speed external crystal in hz

< value of the high speed internal clock in hz

< value of the high speed external crystal in hz

< value of the high speed external crystal in hz

< value of the high speed internal clock in hz

Definition at line 111 of file system_at32f413.c.

Referenced by sclk_192m_hick_config(), sclk_64m_hick_config(), sclk_96m_hext_config(), system_clock_config(), and system_clock_config_for_acc().

◆ SystemInit()

void SystemInit ( void )

setup the microcontroller system initialize the flash interface.

Note
this function should be used only after reset.
Parameters
none
Return values
none

< vector table base offset field. this value must be a multiple of 0x200.

Definition at line 63 of file system_at32f413.c.


AT32F413 Firmwary Library: AT32F413_periph_driver

Topics
AT32F413_periph_driver

Topics

ACC
ACC driver modules.
ADC
ADC driver modules.
BPR
BPR driver modules.
CAN
CAN driver modules.
CRC
CRC driver modules.
CRM
CRM driver modules.
DEBUG
DEBUG driver modules.
DMA
DMA driver modules.
EXINT
EXINT driver modules.
FLASH
FLASH driver modules.
GPIO
GPIO driver modules.
I2C
I2C driver modules.
MISC
MISC driver modules.
PWC
PWC driver modules.
RTC
RTC driver modules.
SDIO
SDIO driver modules.
SPI
SPI driver modules.
TMR
TMR driver modules.
USART
USART driver modules.
USB
USB driver modules.
WDT
WDT driver modules.
WWDT
WWDT driver modules.

Detailed Description

Generated by doxygen 1.12.0


AT32F413 Firmwary Library: ACC

Topics | Macros
ACC
AT32F413_periph_driver

ACC driver modules. More...

Topics

ACC_exported_constants
ACC_exported_types
ACC_exported_functions
ACC_private_functions

Macros

#define ACC ((acc_type *) ACC_BASE)

Detailed Description

ACC driver modules.

Macro Definition Documentation

◆ ACC

#define ACC ((acc_type *) ACC_BASE)

Definition at line 165 of file at32f413_acc.h.

Referenced by acc_calibration_mode_enable(), acc_flag_clear(), acc_flag_get(), acc_hickcal_get(), acc_hicktrim_get(), acc_interrupt_enable(), acc_interrupt_flag_get(), acc_read_c1(), acc_read_c2(), acc_read_c3(), acc_step_set(), acc_write_c1(), acc_write_c2(), and acc_write_c3().


AT32F413 Firmwary Library: ACC_exported_constants

Macros
ACC_exported_constants
AT32F413_periph_driver » ACC

Macros

#define | ACC_CAL_HICKCAL ((uint16_t)0x0000)
#define | ACC_CAL_HICKTRIM ((uint16_t)0x0002)
#define | ACC_RSLOST_FLAG ((uint16_t)0x0002)
#define | ACC_CALRDY_FLAG ((uint16_t)0x0001)
#define | ACC_CALRDYIEN_INT ((uint16_t)0x0020)
#define | ACC_EIEN_INT ((uint16_t)0x0010)

Detailed Description

Macro Definition Documentation

◆ ACC_CAL_HICKCAL

#define ACC_CAL_HICKCAL ((uint16_t)0x0000)

acc hick calibration

Definition at line 51 of file at32f413_acc.h.

Referenced by acc_calibration_mode_enable(), and main().

◆ ACC_CAL_HICKTRIM

#define ACC_CAL_HICKTRIM ((uint16_t)0x0002)

acc hick trim

Definition at line 52 of file at32f413_acc.h.

Referenced by main(), and usb_clock48m_select().

◆ ACC_CALRDY_FLAG

#define ACC_CALRDY_FLAG ((uint16_t)0x0001)

acc internal high-speed clock calibration ready error flag

Definition at line 55 of file at32f413_acc.h.

Referenced by acc_flag_get(), acc_interrupt_flag_get(), and ACC_IRQHandler().

◆ ACC_CALRDYIEN_INT

#define ACC_CALRDYIEN_INT ((uint16_t)0x0020)

acc internal high-speed clock calibration ready interrupt enable

Definition at line 57 of file at32f413_acc.h.

Referenced by acc_interrupt_enable(), and main().

◆ ACC_EIEN_INT

#define ACC_EIEN_INT ((uint16_t)0x0010)

acc reference signal lost interrupt enable

Definition at line 58 of file at32f413_acc.h.

Referenced by main().

◆ ACC_RSLOST_FLAG

#define ACC_RSLOST_FLAG ((uint16_t)0x0002)

acc reference signal lost error flag

Definition at line 54 of file at32f413_acc.h.

Referenced by ACC_IRQHandler().


AT32F413 Firmwary Library: ACC_exported_types

Data Structures
ACC_exported_types
AT32F413_periph_driver » ACC

Data Structures

struct acc_type
type define acc register all More...

Detailed Description

Generated by doxygen 1.12.0


AT32F413 Firmwary Library: acc_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
acc_type Struct Reference
AT32F413_periph_driver » ACC » ACC_exported_types

type define acc register all More...

#include <at32f413_acc.h>

Data Fields

union {
__IO uint32_t sts
struct {
__IO uint32_t calrdy: 1
__IO uint32_t rslost: 1
__IO uint32_t reserved1: 30
} sts_bit
};
acc sts register, offset:0x00
union {
__IO uint32_t ctrl1
struct {
__IO uint32_t calon: 1
__IO uint32_t entrim: 1
__IO uint32_t reserved1: 2
__IO uint32_t eien: 1
__IO uint32_t calrdyien: 1
__IO uint32_t reserved2: 2
__IO uint32_t step: 4
__IO uint32_t reserved3: 20
} ctrl1_bit
};
acc ctrl1 register, offset:0x04
union {
__IO uint32_t ctrl2
struct {
__IO uint32_t hickcal: 8
__IO uint32_t hicktrim: 6
__IO uint32_t reserved1: 18
} ctrl2_bit
};
acc ctrl2 register, offset:0x08
union {
__IO uint32_t c1
struct {
__IO uint32_t c1: 16
__IO uint32_t reserved1: 16
} c1_bit
};
acc acc_c1 register, offset:0x0C
union {
__IO uint32_t c2
struct {
__IO uint32_t c2: 16
__IO uint32_t reserved1: 16
} c2_bit
};
acc acc_c2 register, offset:0x10
union {
__IO uint32_t c3
struct {
__IO uint32_t c3: 16
__IO uint32_t reserved1: 16
} c3_bit
};
acc acc_c3 register, offset:0x14

Detailed Description

type define acc register all

Definition at line 71 of file at32f413_acc.h.

Field Documentation

◆ [union]

union { ... } acc_type

acc sts register, offset:0x00

◆ [union]

union { ... } acc_type

acc acc_c3 register, offset:0x14

◆ [union]

union { ... } acc_type

acc ctrl1 register, offset:0x04

◆ [union]

union { ... } acc_type

acc ctrl2 register, offset:0x08

◆ [union]

union { ... } acc_type

acc acc_c1 register, offset:0x0C

◆ [union]

union { ... } acc_type

acc acc_c2 register, offset:0x10

◆ c1

__IO uint32_t acc_type::c1

Definition at line 126 of file at32f413_acc.h.

◆ [struct]

struct { ... } acc_type::c1_bit

◆ c2

__IO uint32_t acc_type::c2

Definition at line 139 of file at32f413_acc.h.

◆ [struct]

struct { ... } acc_type::c2_bit

◆ c3

__IO uint32_t acc_type::c3

Definition at line 152 of file at32f413_acc.h.

◆ [struct]

struct { ... } acc_type::c3_bit

◆ calon

__IO uint32_t acc_type::calon

Definition at line 96 of file at32f413_acc.h.

◆ calrdy

__IO uint32_t acc_type::calrdy

Definition at line 82 of file at32f413_acc.h.

◆ calrdyien

__IO uint32_t acc_type::calrdyien

Definition at line 100 of file at32f413_acc.h.

◆ ctrl1

__IO uint32_t acc_type::ctrl1

Definition at line 93 of file at32f413_acc.h.

◆ [struct]

struct { ... } acc_type::ctrl1_bit

◆ ctrl2

__IO uint32_t acc_type::ctrl2

Definition at line 112 of file at32f413_acc.h.

◆ [struct]

struct { ... } acc_type::ctrl2_bit

◆ eien

__IO uint32_t acc_type::eien

Definition at line 99 of file at32f413_acc.h.

◆ entrim

__IO uint32_t acc_type::entrim

Definition at line 97 of file at32f413_acc.h.

◆ hickcal

__IO uint32_t acc_type::hickcal

Definition at line 115 of file at32f413_acc.h.

◆ hicktrim

__IO uint32_t acc_type::hicktrim

Definition at line 116 of file at32f413_acc.h.

◆ reserved1

__IO uint32_t acc_type::reserved1

Definition at line 84 of file at32f413_acc.h.

◆ reserved2

__IO uint32_t acc_type::reserved2

Definition at line 101 of file at32f413_acc.h.

◆ reserved3

__IO uint32_t acc_type::reserved3

Definition at line 103 of file at32f413_acc.h.

◆ rslost

__IO uint32_t acc_type::rslost

Definition at line 83 of file at32f413_acc.h.

◆ step

__IO uint32_t acc_type::step

Definition at line 102 of file at32f413_acc.h.

◆ sts

__IO uint32_t acc_type::sts

Definition at line 79 of file at32f413_acc.h.

◆ [struct]

struct { ... } acc_type::sts_bit
The documentation for this struct was generated from the following file:
  • at32f413_acc.h


AT32F413 Firmwary Library: ACC_exported_functions

Functions
ACC_exported_functions
AT32F413_periph_driver » ACC

Functions

void | acc_calibration_mode_enable (uint16_t acc_trim, confirm_state new_state)
enable or disable the acc calibration mode.
void | acc_step_set (uint8_t step_value)
store calibration step data in acc's ctrl1 register.
void | acc_interrupt_enable (uint16_t acc_int, confirm_state new_state)
enable or disable the specified acc interrupts.
uint8_t | acc_hicktrim_get (void)
return the current acc hicktrim value.
uint8_t | acc_hickcal_get (void)
return the current acc hickcal value.
void | acc_write_c1 (uint16_t acc_c1_value)
wtire the value to acc c1 register.
void | acc_write_c2 (uint16_t acc_c2_value)
wtire the value to acc c2 register.
void | acc_write_c3 (uint16_t acc_c3_value)
wtire the value to acc c3 register.
uint16_t | acc_read_c1 (void)
return the current acc c1 value.
uint16_t | acc_read_c2 (void)
return the current acc c2 value.
uint16_t | acc_read_c3 (void)
return the current acc c3 value.
flag_status | acc_flag_get (uint16_t acc_flag)
check whether the specified acc flag is set or not.
flag_status | acc_interrupt_flag_get (uint16_t acc_flag)
check whether the specified acc interrupt flag is set or not.
void | acc_flag_clear (uint16_t acc_flag)
clear the specified acc flag is set or not.

Detailed Description

Function Documentation

◆ acc_calibration_mode_enable()

void acc_calibration_mode_enable | ( | uint16_t | acc_trim,
 |  | confirm_state | new_state )

enable or disable the acc calibration mode.

Parameters
acc_trim specifies the acc calibration type. this parameter can be one of the following values:
  • ACC_CAL_HICKCAL
  • ACC_CAL_HICKTRIM
new_state specifies the acc calibration to be enabled or disabled.(TRUE or FALSE)
Return values
none

< acc hick calibration

Definition at line 52 of file at32f413_acc.c.

Referenced by main(), and usb_clock48m_select().

◆ acc_flag_clear()

void acc_flag_clear ( uint16_t acc_flag )

clear the specified acc flag is set or not.

Parameters
acc_flag specifies the flag to check. this parameter can be any combination of the following values:
  • ACC_RSLOST_FLAG
  • ACC_CALRDY_FLAG
Return values
none

Definition at line 216 of file at32f413_acc.c.

Referenced by ACC_IRQHandler().

◆ acc_flag_get()

flag_status acc_flag_get ( uint16_t acc_flag )

check whether the specified acc flag is set or not.

Parameters
acc_flag specifies the flag to check. this parameter can be one of the following values:
  • ACC_RSLOST_FLAG
  • ACC_CALRDY_FLAG
Return values
flag_status (SET or RESET)

< acc internal high-speed clock calibration ready error flag

Definition at line 184 of file at32f413_acc.c.

◆ acc_hickcal_get()

uint8_t acc_hickcal_get ( void )

return the current acc hickcal value.

Parameters
none
Return values
8-bit hicktrim value.

Definition at line 111 of file at32f413_acc.c.

◆ acc_hicktrim_get()

uint8_t acc_hicktrim_get ( void )

return the current acc hicktrim value.

Parameters
none
Return values
8-bit hicktrim value.

Definition at line 101 of file at32f413_acc.c.

◆ acc_interrupt_enable()

void acc_interrupt_enable | ( | uint16_t | acc_int,
 |  | confirm_state | new_state )

enable or disable the specified acc interrupts.

Parameters
acc_int specifies the acc interrupt sources to be enabled or disabled. this parameter can be one of the following values:
  • ACC_CALRDYIEN_INT
  • ACC_EIEN_INT
new_state (TRUE or FALSE)
Return values
none

< acc internal high-speed clock calibration ready interrupt enable

Definition at line 84 of file at32f413_acc.c.

Referenced by main().

◆ acc_interrupt_flag_get()

flag_status acc_interrupt_flag_get ( uint16_t acc_flag )

check whether the specified acc interrupt flag is set or not.

Parameters
acc_flag specifies the flag to check. this parameter can be one of the following values:
  • ACC_RSLOST_FLAG
  • ACC_CALRDY_FLAG
Return values
flag_status (SET or RESET)

< acc internal high-speed clock calibration ready error flag

Definition at line 200 of file at32f413_acc.c.

Referenced by ACC_IRQHandler().

◆ acc_read_c1()

uint16_t acc_read_c1 ( void )

return the current acc c1 value.

Parameters
none
Return values
16-bit c1 value.

Definition at line 151 of file at32f413_acc.c.

◆ acc_read_c2()

uint16_t acc_read_c2 ( void )

return the current acc c2 value.

Parameters
none
Return values
16-bit c2 value.

Definition at line 161 of file at32f413_acc.c.

◆ acc_read_c3()

uint16_t acc_read_c3 ( void )

return the current acc c3 value.

Parameters
none
Return values
16-bit c3 value.

Definition at line 171 of file at32f413_acc.c.

◆ acc_step_set()

void acc_step_set ( uint8_t step_value )

store calibration step data in acc's ctrl1 register.

Parameters
step_value value to be stored in the acc's ctrl1 register
Return values
none

Definition at line 70 of file at32f413_acc.c.

◆ acc_write_c1()

void acc_write_c1 ( uint16_t acc_c1_value )

wtire the value to acc c1 register.

Parameters
acc_c1_value
Return values
none.

Definition at line 121 of file at32f413_acc.c.

Referenced by main(), and usb_clock48m_select().

◆ acc_write_c2()

void acc_write_c2 ( uint16_t acc_c2_value )

wtire the value to acc c2 register.

Parameters
acc_c2_value
Return values
none.

Definition at line 131 of file at32f413_acc.c.

Referenced by main(), and usb_clock48m_select().

◆ acc_write_c3()

void acc_write_c3 ( uint16_t acc_c3_value )

wtire the value to acc c3 register.

Parameters
acc_c3_value
Return values
none.

Definition at line 141 of file at32f413_acc.c.

Referenced by main(), and usb_clock48m_select().


AT32F413 Firmwary Library: ACC_private_functions

Functions
ACC_private_functions
AT32F413_periph_driver » ACC

Functions

void | acc_calibration_mode_enable (uint16_t acc_trim, confirm_state new_state)
enable or disable the acc calibration mode.
void | acc_step_set (uint8_t step_value)
store calibration step data in acc's ctrl1 register.
void | acc_interrupt_enable (uint16_t acc_int, confirm_state new_state)
enable or disable the specified acc interrupts.
uint8_t | acc_hicktrim_get (void)
return the current acc hicktrim value.
uint8_t | acc_hickcal_get (void)
return the current acc hickcal value.
void | acc_write_c1 (uint16_t acc_c1_value)
wtire the value to acc c1 register.
void | acc_write_c2 (uint16_t acc_c2_value)
wtire the value to acc c2 register.
void | acc_write_c3 (uint16_t acc_c3_value)
wtire the value to acc c3 register.
uint16_t | acc_read_c1 (void)
return the current acc c1 value.
uint16_t | acc_read_c2 (void)
return the current acc c2 value.
uint16_t | acc_read_c3 (void)
return the current acc c3 value.
flag_status | acc_flag_get (uint16_t acc_flag)
check whether the specified acc flag is set or not.
flag_status | acc_interrupt_flag_get (uint16_t acc_flag)
check whether the specified acc interrupt flag is set or not.
void | acc_flag_clear (uint16_t acc_flag)
clear the specified acc flag is set or not.

Detailed Description

Function Documentation

◆ acc_calibration_mode_enable()

void acc_calibration_mode_enable | ( | uint16_t | acc_trim,
 |  | confirm_state | new_state )

enable or disable the acc calibration mode.

Parameters
acc_trim specifies the acc calibration type. this parameter can be one of the following values:
  • ACC_CAL_HICKCAL
  • ACC_CAL_HICKTRIM
new_state specifies the acc calibration to be enabled or disabled.(TRUE or FALSE)
Return values
none

< acc hick calibration

Definition at line 52 of file at32f413_acc.c.

Referenced by main(), and usb_clock48m_select().

◆ acc_flag_clear()

void acc_flag_clear ( uint16_t acc_flag )

clear the specified acc flag is set or not.

Parameters
acc_flag specifies the flag to check. this parameter can be any combination of the following values:
  • ACC_RSLOST_FLAG
  • ACC_CALRDY_FLAG
Return values
none

Definition at line 216 of file at32f413_acc.c.

Referenced by ACC_IRQHandler().

◆ acc_flag_get()

flag_status acc_flag_get ( uint16_t acc_flag )

check whether the specified acc flag is set or not.

Parameters
acc_flag specifies the flag to check. this parameter can be one of the following values:
  • ACC_RSLOST_FLAG
  • ACC_CALRDY_FLAG
Return values
flag_status (SET or RESET)

< acc internal high-speed clock calibration ready error flag

Definition at line 184 of file at32f413_acc.c.

◆ acc_hickcal_get()

uint8_t acc_hickcal_get ( void )

return the current acc hickcal value.

Parameters
none
Return values
8-bit hicktrim value.

Definition at line 111 of file at32f413_acc.c.

◆ acc_hicktrim_get()

uint8_t acc_hicktrim_get ( void )

return the current acc hicktrim value.

Parameters
none
Return values
8-bit hicktrim value.

Definition at line 101 of file at32f413_acc.c.

◆ acc_interrupt_enable()

void acc_interrupt_enable | ( | uint16_t | acc_int,
 |  | confirm_state | new_state )

enable or disable the specified acc interrupts.

Parameters
acc_int specifies the acc interrupt sources to be enabled or disabled. this parameter can be one of the following values:
  • ACC_CALRDYIEN_INT
  • ACC_EIEN_INT
new_state (TRUE or FALSE)
Return values
none

< acc internal high-speed clock calibration ready interrupt enable

Definition at line 84 of file at32f413_acc.c.

Referenced by main().

◆ acc_interrupt_flag_get()

flag_status acc_interrupt_flag_get ( uint16_t acc_flag )

check whether the specified acc interrupt flag is set or not.

Parameters
acc_flag specifies the flag to check. this parameter can be one of the following values:
  • ACC_RSLOST_FLAG
  • ACC_CALRDY_FLAG
Return values
flag_status (SET or RESET)

< acc internal high-speed clock calibration ready error flag

Definition at line 200 of file at32f413_acc.c.

Referenced by ACC_IRQHandler().

◆ acc_read_c1()

uint16_t acc_read_c1 ( void )

return the current acc c1 value.

Parameters
none
Return values
16-bit c1 value.

Definition at line 151 of file at32f413_acc.c.

◆ acc_read_c2()

uint16_t acc_read_c2 ( void )

return the current acc c2 value.

Parameters
none
Return values
16-bit c2 value.

Definition at line 161 of file at32f413_acc.c.

◆ acc_read_c3()

uint16_t acc_read_c3 ( void )

return the current acc c3 value.

Parameters
none
Return values
16-bit c3 value.

Definition at line 171 of file at32f413_acc.c.

◆ acc_step_set()

void acc_step_set ( uint8_t step_value )

store calibration step data in acc's ctrl1 register.

Parameters
step_value value to be stored in the acc's ctrl1 register
Return values
none

Definition at line 70 of file at32f413_acc.c.

◆ acc_write_c1()

void acc_write_c1 ( uint16_t acc_c1_value )

wtire the value to acc c1 register.

Parameters
acc_c1_value
Return values
none.

Definition at line 121 of file at32f413_acc.c.

Referenced by main(), and usb_clock48m_select().

◆ acc_write_c2()

void acc_write_c2 ( uint16_t acc_c2_value )

wtire the value to acc c2 register.

Parameters
acc_c2_value
Return values
none.

Definition at line 131 of file at32f413_acc.c.

Referenced by main(), and usb_clock48m_select().

◆ acc_write_c3()

void acc_write_c3 ( uint16_t acc_c3_value )

wtire the value to acc c3 register.

Parameters
acc_c3_value
Return values
none.

Definition at line 141 of file at32f413_acc.c.

Referenced by main(), and usb_clock48m_select().


AT32F413 Firmwary Library: ADC

Topics | Macros
ADC
AT32F413_periph_driver

ADC driver modules. More...

Topics

ADC_interrupts_definition
adc interrupt
ADC_flags_definition
adc flag
ADC_exported_types
ADC_exported_functions
ADC_private_functions

Macros

#define | ADC1 ((adc_type *) ADC1_BASE)
#define | ADC2 ((adc_type *) ADC2_BASE)

Detailed Description

ADC driver modules.

Macro Definition Documentation

◆ ADC1

#define ADC1 ((adc_type *) ADC1_BASE)

Definition at line 558 of file at32f413_adc.h.

Referenced by ADC1_2_IRQHandler(), adc_combine_mode_select(), adc_combine_ordinary_conversion_data_get(), adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), adc_reset(), adc_tempersensor_vintrv_enable(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), and main().

◆ ADC2

#define ADC2 ((adc_type *) ADC2_BASE)

Definition at line 559 of file at32f413_adc.h.

Referenced by adc_config(), and adc_reset().


AT32F413 Firmwary Library: ADC_interrupts_definition

Macros
ADC_interrupts_definition
AT32F413_periph_driver » ADC

adc interrupt More...

Macros

#define | ADC_CCE_INT ((uint32_t)0x00000020)
#define | ADC_VMOR_INT ((uint32_t)0x00000040)
#define | ADC_PCCE_INT ((uint32_t)0x00000080)

Detailed Description

adc interrupt

Macro Definition Documentation

◆ ADC_CCE_INT

#define ADC_CCE_INT ((uint32_t)0x00000020)

channels conversion end interrupt

Definition at line 51 of file at32f413_adc.h.

◆ ADC_PCCE_INT

#define ADC_PCCE_INT ((uint32_t)0x00000080)

preempt channels conversion end interrupt

Definition at line 53 of file at32f413_adc.h.

Referenced by adc_config(), and adc_config().

◆ ADC_VMOR_INT

#define ADC_VMOR_INT ((uint32_t)0x00000040)

voltage monitoring out of range interrupt

Definition at line 52 of file at32f413_adc.h.

Referenced by adc_config().


AT32F413 Firmwary Library: ADC_flags_definition

Macros
ADC_flags_definition
AT32F413_periph_driver » ADC

adc flag More...

Macros

#define | ADC_VMOR_FLAG ((uint8_t)0x01)
#define | ADC_CCE_FLAG ((uint8_t)0x02)
#define | ADC_PCCE_FLAG ((uint8_t)0x04)
#define | ADC_PCCS_FLAG ((uint8_t)0x08)
#define | ADC_OCCS_FLAG ((uint8_t)0x10)

Detailed Description

adc flag

Macro Definition Documentation

◆ ADC_CCE_FLAG

#define ADC_CCE_FLAG ((uint8_t)0x02)

channels conversion end flag

Definition at line 65 of file at32f413_adc.h.

Referenced by adc_interrupt_flag_get().

◆ ADC_OCCS_FLAG

#define ADC_OCCS_FLAG ((uint8_t)0x10)

ordinary channel conversion start flag

Definition at line 68 of file at32f413_adc.h.

◆ ADC_PCCE_FLAG

#define ADC_PCCE_FLAG ((uint8_t)0x04)

preempt channels conversion end flag

Definition at line 66 of file at32f413_adc.h.

Referenced by ADC1_2_IRQHandler(), and adc_interrupt_flag_get().

◆ ADC_PCCS_FLAG

#define ADC_PCCS_FLAG ((uint8_t)0x08)

preempt channel conversion start flag

Definition at line 67 of file at32f413_adc.h.

◆ ADC_VMOR_FLAG

#define ADC_VMOR_FLAG ((uint8_t)0x01)

voltage monitoring out of range flag

Definition at line 64 of file at32f413_adc.h.

Referenced by ADC1_2_IRQHandler(), and adc_interrupt_flag_get().


AT32F413 Firmwary Library: ADC_exported_types

Data Structures | Enumerations
ADC_exported_types
AT32F413_periph_driver » ADC

Data Structures

struct | adc_base_config_type
adc base config type More...
struct | adc_type
type define adc register all More...

Enumerations

enum adc_combine_mode_type {
ADC_INDEPENDENT_MODE = 0x00 , ADC_ORDINARY_SMLT_PREEMPT_SMLT_MODE = 0x01 , ADC_ORDINARY_SMLT_PREEMPT_INTERLTRIG_MODE = 0x02 , ADC_ORDINARY_SHORTSHIFT_PREEMPT_SMLT_MODE = 0x03 ,
ADC_ORDINARY_LONGSHIFT_PREEMPT_SMLT_MODE = 0x04 , ADC_PREEMPT_SMLT_ONLY_MODE = 0x05 , ADC_ORDINARY_SMLT_ONLY_MODE = 0x06 , ADC_ORDINARY_SHORTSHIFT_ONLY_MODE = 0x07 ,
ADC_ORDINARY_LONGSHIFT_ONLY_MODE = 0x08 , ADC_PREEMPT_INTERLTRIG_ONLY_MODE = 0x09
}
adc combine mode type(these options are reserved in adc2) More...
enum | adc_data_align_type { ADC_RIGHT_ALIGNMENT = 0x00 , ADC_LEFT_ALIGNMENT = 0x01 }
adc data align type More...
enum adc_channel_select_type {
ADC_CHANNEL_0 = 0x00 , ADC_CHANNEL_1 = 0x01 , ADC_CHANNEL_2 = 0x02 , ADC_CHANNEL_3 = 0x03 ,
ADC_CHANNEL_4 = 0x04 , ADC_CHANNEL_5 = 0x05 , ADC_CHANNEL_6 = 0x06 , ADC_CHANNEL_7 = 0x07 ,
ADC_CHANNEL_8 = 0x08 , ADC_CHANNEL_9 = 0x09 , ADC_CHANNEL_10 = 0x0A , ADC_CHANNEL_11 = 0x0B ,
ADC_CHANNEL_12 = 0x0C , ADC_CHANNEL_13 = 0x0D , ADC_CHANNEL_14 = 0x0E , ADC_CHANNEL_15 = 0x0F ,
ADC_CHANNEL_16 = 0x10 , ADC_CHANNEL_17 = 0x11
}
adc channel select type More...
enum adc_sampletime_select_type {
ADC_SAMPLETIME_1_5 = 0x00 , ADC_SAMPLETIME_7_5 = 0x01 , ADC_SAMPLETIME_13_5 = 0x02 , ADC_SAMPLETIME_28_5 = 0x03 ,
ADC_SAMPLETIME_41_5 = 0x04 , ADC_SAMPLETIME_55_5 = 0x05 , ADC_SAMPLETIME_71_5 = 0x06 , ADC_SAMPLETIME_239_5 = 0x07
}
adc sampletime select type More...
enum adc_ordinary_trig_select_type {
ADC12_ORDINARY_TRIG_TMR1CH1 = 0x00 , ADC12_ORDINARY_TRIG_TMR1CH2 = 0x01 , ADC12_ORDINARY_TRIG_TMR1CH3 = 0x02 , ADC12_ORDINARY_TRIG_TMR2CH2 = 0x03 ,
ADC12_ORDINARY_TRIG_TMR3TRGOUT = 0x04 , ADC12_ORDINARY_TRIG_TMR4CH4 = 0x05 , ADC12_ORDINARY_TRIG_EXINT11_TMR8TRGOUT = 0x06 , ADC12_ORDINARY_TRIG_SOFTWARE = 0x07 ,
ADC12_ORDINARY_TRIG_TMR1TRGOUT = 0x0D , ADC12_ORDINARY_TRIG_TMR8CH1 = 0x0E , ADC12_ORDINARY_TRIG_TMR8CH2 = 0x0F
}
adc ordinary group trigger event select type More...
enum adc_preempt_trig_select_type {
ADC12_PREEMPT_TRIG_TMR1TRGOUT = 0x00 , ADC12_PREEMPT_TRIG_TMR1CH4 = 0x01 , ADC12_PREEMPT_TRIG_TMR2TRGOUT = 0x02 , ADC12_PREEMPT_TRIG_TMR2CH1 = 0x03 ,
ADC12_PREEMPT_TRIG_TMR3CH4 = 0x04 , ADC12_PREEMPT_TRIG_TMR4TRGOUT = 0x05 , ADC12_PREEMPT_TRIG_EXINT15_TMR8CH4 = 0x06 , ADC12_PREEMPT_TRIG_SOFTWARE = 0x07 ,
ADC12_PREEMPT_TRIG_TMR1CH1 = 0x0D , ADC12_PREEMPT_TRIG_TMR8CH1 = 0x0E , ADC12_PREEMPT_TRIG_TMR8TRGOUT = 0x0F
}
adc preempt group trigger event select type More...
enum | adc_preempt_channel_type { ADC_PREEMPT_CHANNEL_1 = 0x00 , ADC_PREEMPT_CHANNEL_2 = 0x01 , ADC_PREEMPT_CHANNEL_3 = 0x02 , ADC_PREEMPT_CHANNEL_4 = 0x03 }
adc preempt channel type More...
enum adc_voltage_monitoring_type {
ADC_VMONITOR_SINGLE_ORDINARY = 0x00800200 , ADC_VMONITOR_SINGLE_PREEMPT = 0x00400200 , ADC_VMONITOR_SINGLE_ORDINARY_PREEMPT = 0x00C00200 , ADC_VMONITOR_ALL_ORDINARY = 0x00800000 ,
ADC_VMONITOR_ALL_PREEMPT = 0x00400000 , ADC_VMONITOR_ALL_ORDINARY_PREEMPT = 0x00C00000 , ADC_VMONITOR_NONE = 0x00000000
}
adc voltage_monitoring type More...

Detailed Description

Enumeration Type Documentation

◆ adc_channel_select_type

enum adc_channel_select_type

adc channel select type

Enumerator
ADC_CHANNEL_0 | adc channel 0
ADC_CHANNEL_1 | adc channel 1
ADC_CHANNEL_2 | adc channel 2
ADC_CHANNEL_3 | adc channel 3
ADC_CHANNEL_4 | adc channel 4
ADC_CHANNEL_5 | adc channel 5
ADC_CHANNEL_6 | adc channel 6
ADC_CHANNEL_7 | adc channel 7
ADC_CHANNEL_8 | adc channel 8
ADC_CHANNEL_9 | adc channel 9
ADC_CHANNEL_10 | adc channel 10
ADC_CHANNEL_11 | adc channel 11
ADC_CHANNEL_12 | adc channel 12
ADC_CHANNEL_13 | adc channel 13
ADC_CHANNEL_14 | adc channel 14
ADC_CHANNEL_15 | adc channel 15
ADC_CHANNEL_16 | adc channel 16
ADC_CHANNEL_17 | adc channel 17

Definition at line 107 of file at32f413_adc.h.

◆ adc_combine_mode_type

enum adc_combine_mode_type

adc combine mode type(these options are reserved in adc2)

Enumerator
ADC_INDEPENDENT_MODE | independent mode
ADC_ORDINARY_SMLT_PREEMPT_SMLT_MODE | combined ordinary simultaneous + preempt simultaneous mode
ADC_ORDINARY_SMLT_PREEMPT_INTERLTRIG_MODE | combined ordinary simultaneous + preempt interleaved trigger mode
ADC_ORDINARY_SHORTSHIFT_PREEMPT_SMLT_MODE | combined ordinary short shifting + preempt simultaneous mode
ADC_ORDINARY_LONGSHIFT_PREEMPT_SMLT_MODE | combined ordinary long shifting + preempt simultaneous mode
ADC_PREEMPT_SMLT_ONLY_MODE | preempt simultaneous mode only
ADC_ORDINARY_SMLT_ONLY_MODE | ordinary simultaneous mode only
ADC_ORDINARY_SHORTSHIFT_ONLY_MODE | ordinary short shifting mode only
ADC_ORDINARY_LONGSHIFT_ONLY_MODE | slow interleaved mode only
ADC_PREEMPT_INTERLTRIG_ONLY_MODE | alternate trigger mode only

Definition at line 81 of file at32f413_adc.h.

◆ adc_data_align_type

enum adc_data_align_type

adc data align type

Enumerator
ADC_RIGHT_ALIGNMENT | data right alignment
ADC_LEFT_ALIGNMENT | data left alignment

Definition at line 98 of file at32f413_adc.h.

◆ adc_ordinary_trig_select_type

enum adc_ordinary_trig_select_type

adc ordinary group trigger event select type

Enumerator
ADC12_ORDINARY_TRIG_TMR1CH1 | timer1 ch1 event as trigger source of adc1/adc2 ordinary sequence
ADC12_ORDINARY_TRIG_TMR1CH2 | timer1 ch2 event as trigger source of adc1/adc2 ordinary sequence
ADC12_ORDINARY_TRIG_TMR1CH3 | timer1 ch3 event as trigger source of adc1/adc2 ordinary sequence
ADC12_ORDINARY_TRIG_TMR2CH2 | timer2 ch2 event as trigger source of adc1/adc2 ordinary sequence
ADC12_ORDINARY_TRIG_TMR3TRGOUT | timer3 trgout event as trigger source of adc1/adc2 ordinary sequence
ADC12_ORDINARY_TRIG_TMR4CH4 | timer4 ch4 event as trigger source of adc1/adc2 ordinary sequence
ADC12_ORDINARY_TRIG_EXINT11_TMR8TRGOUT | exint line11/timer8 trgout event as trigger source of adc1/adc2 ordinary sequence
ADC12_ORDINARY_TRIG_SOFTWARE | software(OCSWTRG) control bit as trigger source of adc1/adc2 ordinary sequence
ADC12_ORDINARY_TRIG_TMR1TRGOUT | timer1 trgout event as trigger source of adc1/adc2 ordinary sequence
ADC12_ORDINARY_TRIG_TMR8CH1 | timer8 ch1 event as trigger source of adc1/adc2 ordinary sequence
ADC12_ORDINARY_TRIG_TMR8CH2 | timer8 ch2 event as trigger source of adc1/adc2 ordinary sequence

Definition at line 147 of file at32f413_adc.h.

◆ adc_preempt_channel_type

enum adc_preempt_channel_type

adc preempt channel type

Enumerator
ADC_PREEMPT_CHANNEL_1 | adc preempt channel 1
ADC_PREEMPT_CHANNEL_2 | adc preempt channel 2
ADC_PREEMPT_CHANNEL_3 | adc preempt channel 3
ADC_PREEMPT_CHANNEL_4 | adc preempt channel 4

Definition at line 185 of file at32f413_adc.h.

◆ adc_preempt_trig_select_type

enum adc_preempt_trig_select_type

adc preempt group trigger event select type

Enumerator
ADC12_PREEMPT_TRIG_TMR1TRGOUT | timer1 trgout event as trigger source of adc1/adc2 preempt sequence
ADC12_PREEMPT_TRIG_TMR1CH4 | timer1 ch4 event as trigger source of adc1/adc2 preempt sequence
ADC12_PREEMPT_TRIG_TMR2TRGOUT | timer2 trgout event as trigger source of adc1/adc2 preempt sequence
ADC12_PREEMPT_TRIG_TMR2CH1 | timer2 ch1 event as trigger source of adc1/adc2 preempt sequence
ADC12_PREEMPT_TRIG_TMR3CH4 | timer3 ch4 event as trigger source of adc1/adc2 preempt sequence
ADC12_PREEMPT_TRIG_TMR4TRGOUT | timer4 trgout event as trigger source of adc1/adc2 preempt sequence
ADC12_PREEMPT_TRIG_EXINT15_TMR8CH4 | exint line15/timer8 ch4 event as trigger source of adc1/adc2 preempt sequence
ADC12_PREEMPT_TRIG_SOFTWARE | software(PCSWTRG) control bit as trigger source of adc1/adc2 preempt sequence
ADC12_PREEMPT_TRIG_TMR1CH1 | timer1 ch1 event as trigger source of adc1/adc2 preempt sequence
ADC12_PREEMPT_TRIG_TMR8CH1 | timer8 ch1 event as trigger source of adc1/adc2 preempt sequence
ADC12_PREEMPT_TRIG_TMR8TRGOUT | timer8 trgout event as trigger source of adc1/adc2 preempt sequence

Definition at line 166 of file at32f413_adc.h.

◆ adc_sampletime_select_type

enum adc_sampletime_select_type

adc sampletime select type

Enumerator
ADC_SAMPLETIME_1_5 | adc sample time 1.5 cycle
ADC_SAMPLETIME_7_5 | adc sample time 7.5 cycle
ADC_SAMPLETIME_13_5 | adc sample time 13.5 cycle
ADC_SAMPLETIME_28_5 | adc sample time 28.5 cycle
ADC_SAMPLETIME_41_5 | adc sample time 41.5 cycle
ADC_SAMPLETIME_55_5 | adc sample time 55.5 cycle
ADC_SAMPLETIME_71_5 | adc sample time 71.5 cycle
ADC_SAMPLETIME_239_5 | adc sample time 239.5 cycle

Definition at line 132 of file at32f413_adc.h.

◆ adc_voltage_monitoring_type

enum adc_voltage_monitoring_type

adc voltage_monitoring type

Enumerator
ADC_VMONITOR_SINGLE_ORDINARY | voltage_monitoring on a single ordinary channel
ADC_VMONITOR_SINGLE_PREEMPT | voltage_monitoring on a single preempt channel
ADC_VMONITOR_SINGLE_ORDINARY_PREEMPT | voltage_monitoring on a single ordinary or preempt channel
ADC_VMONITOR_ALL_ORDINARY | voltage_monitoring on all ordinary channel
ADC_VMONITOR_ALL_PREEMPT | voltage_monitoring on all preempt channel
ADC_VMONITOR_ALL_ORDINARY_PREEMPT | voltage_monitoring on all ordinary and preempt channel
ADC_VMONITOR_NONE | no channel guarded by the voltage_monitoring

Definition at line 196 of file at32f413_adc.h.


AT32F413 Firmwary Library: adc_base_config_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
adc_base_config_type Struct Reference
AT32F413_periph_driver » ADC » ADC_exported_types

adc base config type More...

#include <at32f413_adc.h>

Data Fields

confirm_state sequence_mode
confirm_state repeat_mode
adc_data_align_type data_align
uint8_t ordinary_channel_length

Detailed Description

adc base config type

Definition at line 210 of file at32f413_adc.h.

Field Documentation

◆ data_align

adc_data_align_type adc_base_config_type::data_align

adc data alignment

Definition at line 214 of file at32f413_adc.h.

Referenced by adc_base_config(), adc_base_default_para_init(), adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), and adc_config().

◆ ordinary_channel_length

uint8_t adc_base_config_type::ordinary_channel_length

adc ordinary channel sequence length

Definition at line 215 of file at32f413_adc.h.

Referenced by adc_base_config(), adc_base_default_para_init(), adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), and adc_config().

◆ repeat_mode

confirm_state adc_base_config_type::repeat_mode

adc repeat mode

Definition at line 213 of file at32f413_adc.h.

Referenced by adc_base_config(), adc_base_default_para_init(), adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), and adc_config().

◆ sequence_mode

confirm_state adc_base_config_type::sequence_mode

adc sequence mode

Definition at line 212 of file at32f413_adc.h.

Referenced by adc_base_config(), adc_base_default_para_init(), adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), and adc_config().

The documentation for this struct was generated from the following file:
  • at32f413_adc.h


AT32F413 Firmwary Library: adc_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
adc_type Struct Reference
AT32F413_periph_driver » ADC » ADC_exported_types

type define adc register all More...

#include <at32f413_adc.h>

Data Fields

union {
__IO uint32_t sts
struct {
__IO uint32_t vmor: 1
__IO uint32_t cce: 1
__IO uint32_t pcce: 1
__IO uint32_t pccs: 1
__IO uint32_t occs: 1
__IO uint32_t reserved1: 27
} sts_bit
};
adc sts register, offset:0x00
union {
__IO uint32_t ctrl1
struct {
__IO uint32_t vmcsel: 5
__IO uint32_t cceien: 1
__IO uint32_t vmorien: 1
__IO uint32_t pcceien: 1
__IO uint32_t sqen: 1
__IO uint32_t vmsgen: 1
__IO uint32_t pcautoen: 1
__IO uint32_t ocpen: 1
__IO uint32_t pcpen: 1
__IO uint32_t ocpcnt: 3
__IO uint32_t mssel: 4
__IO uint32_t reserved1: 2
__IO uint32_t pcvmen: 1
__IO uint32_t ocvmen: 1
__IO uint32_t reserved2: 8
} ctrl1_bit
};
adc ctrl1 register, offset:0x04
union {
__IO uint32_t ctrl2
struct {
__IO uint32_t adcen: 1
__IO uint32_t rpen: 1
__IO uint32_t adcal: 1
__IO uint32_t adcalinit: 1
__IO uint32_t reserved1: 4
__IO uint32_t ocdmaen: 1
__IO uint32_t reserved2: 2
__IO uint32_t dtalign: 1
__IO uint32_t pctesel_l: 3
__IO uint32_t pcten: 1
__IO uint32_t reserved3: 1
__IO uint32_t octesel_l: 3
__IO uint32_t octen: 1
__IO uint32_t pcswtrg: 1
__IO uint32_t ocswtrg: 1
__IO uint32_t itsrven: 1
__IO uint32_t pctesel_h: 1
__IO uint32_t octesel_h: 1
__IO uint32_t reserved4: 6
} ctrl2_bit
};
adc ctrl2 register, offset:0x08
union {
__IO uint32_t spt1
struct {
__IO uint32_t cspt10: 3
__IO uint32_t cspt11: 3
__IO uint32_t cspt12: 3
__IO uint32_t cspt13: 3
__IO uint32_t cspt14: 3
__IO uint32_t cspt15: 3
__IO uint32_t cspt16: 3
__IO uint32_t cspt17: 3
__IO uint32_t reserved1: 8
} spt1_bit
};
adc spt1 register, offset:0x0C
union {
__IO uint32_t spt2
struct {
__IO uint32_t cspt0: 3
__IO uint32_t cspt1: 3
__IO uint32_t cspt2: 3
__IO uint32_t cspt3: 3
__IO uint32_t cspt4: 3
__IO uint32_t cspt5: 3
__IO uint32_t cspt6: 3
__IO uint32_t cspt7: 3
__IO uint32_t cspt8: 3
__IO uint32_t cspt9: 3
__IO uint32_t reserved1: 2
} spt2_bit
};
adc spt2 register, offset:0x10
union {
__IO uint32_t pcdto1
struct {
__IO uint32_t pcdto1: 12
__IO uint32_t reserved1: 20
} pcdto1_bit
};
adc pcdto1 register, offset:0x14
union {
__IO uint32_t pcdto2
struct {
__IO uint32_t pcdto2: 12
__IO uint32_t reserved1: 20
} pcdto2_bit
};
adc pcdto2 register, offset:0x18
union {
__IO uint32_t pcdto3
struct {
__IO uint32_t pcdto3: 12
__IO uint32_t reserved1: 20
} pcdto3_bit
};
adc pcdto3 register, offset:0x1C
union {
__IO uint32_t pcdto4
struct {
__IO uint32_t pcdto4: 12
__IO uint32_t reserved1: 20
} pcdto4_bit
};
adc pcdto4 register, offset:0x20
union {
__IO uint32_t vmhb
struct {
__IO uint32_t vmhb: 12
__IO uint32_t reserved1: 20
} vmhb_bit
};
adc vmhb register, offset:0x24
union {
__IO uint32_t vmlb
struct {
__IO uint32_t vmlb: 12
__IO uint32_t reserved1: 20
} vmlb_bit
};
adc vmlb register, offset:0x28
union {
__IO uint32_t osq1
struct {
__IO uint32_t osn13: 5
__IO uint32_t osn14: 5
__IO uint32_t osn15: 5
__IO uint32_t osn16: 5
__IO uint32_t oclen: 4
__IO uint32_t reserved1: 8
} osq1_bit
};
adc osq1 register, offset:0x2C
union {
__IO uint32_t osq2
struct {
__IO uint32_t osn7: 5
__IO uint32_t osn8: 5
__IO uint32_t osn9: 5
__IO uint32_t osn10: 5
__IO uint32_t osn11: 5
__IO uint32_t osn12: 5
__IO uint32_t reserved1: 2
} osq2_bit
};
adc osq2 register, offset:0x30
union {
__IO uint32_t osq3
struct {
__IO uint32_t osn1: 5
__IO uint32_t osn2: 5
__IO uint32_t osn3: 5
__IO uint32_t osn4: 5
__IO uint32_t osn5: 5
__IO uint32_t osn6: 5
__IO uint32_t reserved1: 2
} osq3_bit
};
adc osq3 register, offset:0x34
union {
__IO uint32_t psq
struct {
__IO uint32_t psn1: 5
__IO uint32_t psn2: 5
__IO uint32_t psn3: 5
__IO uint32_t psn4: 5
__IO uint32_t pclen: 2
__IO uint32_t reserved1: 10
} psq_bit
};
adc psq register, offset:0x38
union {
__IO uint32_t pdt1
struct {
__IO uint32_t pdt1: 16
__IO uint32_t reserved1: 16
} pdt1_bit
};
adc pdt1 register, offset:0x3C
union {
__IO uint32_t pdt2
struct {
__IO uint32_t pdt2: 16
__IO uint32_t reserved1: 16
} pdt2_bit
};
adc pdt2 register, offset:0x40
union {
__IO uint32_t pdt3
struct {
__IO uint32_t pdt3: 16
__IO uint32_t reserved1: 16
} pdt3_bit
};
adc pdt3 register, offset:0x44
union {
__IO uint32_t pdt4
struct {
__IO uint32_t pdt4: 16
__IO uint32_t reserved1: 16
} pdt4_bit
};
adc pdt4 register, offset:0x48
union {
__IO uint32_t odt
struct {
__IO uint32_t odt: 16
__IO uint32_t adc2odt: 16
} odt_bit
};
adc odt register, offset:0x4C

Detailed Description

type define adc register all

Definition at line 221 of file at32f413_adc.h.

Field Documentation

◆ [union]

union { ... } adc_type

adc sts register, offset:0x00

◆ [union]

union { ... } adc_type

adc ctrl1 register, offset:0x04

◆ [union]

union { ... } adc_type

adc ctrl2 register, offset:0x08

◆ [union]

union { ... } adc_type

adc spt1 register, offset:0x0C

◆ [union]

union { ... } adc_type

adc spt2 register, offset:0x10

◆ [union]

union { ... } adc_type

adc pcdto1 register, offset:0x14

◆ [union]

union { ... } adc_type

adc pcdto2 register, offset:0x18

◆ [union]

union { ... } adc_type

adc pcdto3 register, offset:0x1C

◆ [union]

union { ... } adc_type

adc pcdto4 register, offset:0x20

◆ [union]

union { ... } adc_type

adc vmhb register, offset:0x24

◆ [union]

union { ... } adc_type

adc vmlb register, offset:0x28

◆ [union]

union { ... } adc_type

adc osq1 register, offset:0x2C

◆ [union]

union { ... } adc_type

adc osq2 register, offset:0x30

◆ [union]

union { ... } adc_type

adc osq3 register, offset:0x34

◆ [union]

union { ... } adc_type

adc psq register, offset:0x38

◆ [union]

union { ... } adc_type

adc pdt1 register, offset:0x3C

◆ [union]

union { ... } adc_type

adc pdt2 register, offset:0x40

◆ [union]

union { ... } adc_type

adc pdt3 register, offset:0x44

◆ [union]

union { ... } adc_type

adc pdt4 register, offset:0x48

◆ [union]

union { ... } adc_type

adc odt register, offset:0x4C

◆ adc2odt

__IO uint32_t adc_type::adc2odt

Definition at line 548 of file at32f413_adc.h.

◆ adcal

__IO uint32_t adc_type::adcal

Definition at line 277 of file at32f413_adc.h.

Referenced by adc_calibration_start(), and adc_calibration_status_get().

◆ adcalinit

__IO uint32_t adc_type::adcalinit

Definition at line 278 of file at32f413_adc.h.

Referenced by adc_calibration_init(), and adc_calibration_init_status_get().

◆ adcen

__IO uint32_t adc_type::adcen

Definition at line 275 of file at32f413_adc.h.

Referenced by adc_enable().

◆ cce

__IO uint32_t adc_type::cce

Definition at line 233 of file at32f413_adc.h.

Referenced by adc_interrupt_flag_get().

◆ cceien

__IO uint32_t adc_type::cceien

Definition at line 250 of file at32f413_adc.h.

Referenced by adc_interrupt_flag_get().

◆ cspt0

__IO uint32_t adc_type::cspt0

Definition at line 325 of file at32f413_adc.h.

◆ cspt1

__IO uint32_t adc_type::cspt1

Definition at line 326 of file at32f413_adc.h.

◆ cspt10

__IO uint32_t adc_type::cspt10

Definition at line 305 of file at32f413_adc.h.

◆ cspt11

__IO uint32_t adc_type::cspt11

Definition at line 306 of file at32f413_adc.h.

◆ cspt12

__IO uint32_t adc_type::cspt12

Definition at line 307 of file at32f413_adc.h.

◆ cspt13

__IO uint32_t adc_type::cspt13

Definition at line 308 of file at32f413_adc.h.

◆ cspt14

__IO uint32_t adc_type::cspt14

Definition at line 309 of file at32f413_adc.h.

◆ cspt15

__IO uint32_t adc_type::cspt15

Definition at line 310 of file at32f413_adc.h.

◆ cspt16

__IO uint32_t adc_type::cspt16

Definition at line 311 of file at32f413_adc.h.

◆ cspt17

__IO uint32_t adc_type::cspt17

Definition at line 312 of file at32f413_adc.h.

◆ cspt2

__IO uint32_t adc_type::cspt2

Definition at line 327 of file at32f413_adc.h.

◆ cspt3

__IO uint32_t adc_type::cspt3

Definition at line 328 of file at32f413_adc.h.

◆ cspt4

__IO uint32_t adc_type::cspt4

Definition at line 329 of file at32f413_adc.h.

◆ cspt5

__IO uint32_t adc_type::cspt5

Definition at line 330 of file at32f413_adc.h.

◆ cspt6

__IO uint32_t adc_type::cspt6

Definition at line 331 of file at32f413_adc.h.

◆ cspt7

__IO uint32_t adc_type::cspt7

Definition at line 332 of file at32f413_adc.h.

◆ cspt8

__IO uint32_t adc_type::cspt8

Definition at line 333 of file at32f413_adc.h.

◆ cspt9

__IO uint32_t adc_type::cspt9

Definition at line 334 of file at32f413_adc.h.

◆ ctrl1

__IO uint32_t adc_type::ctrl1

Definition at line 246 of file at32f413_adc.h.

Referenced by adc_interrupt_enable(), and adc_voltage_monitor_enable().

◆ [struct]

struct { ... } adc_type::ctrl1_bit

Referenced by adc_base_config(), adc_interrupt_flag_get(), adc_ordinary_part_count_set(), adc_ordinary_part_mode_enable(), adc_preempt_auto_mode_enable(), adc_preempt_part_mode_enable(), adc_voltage_monitor_enable(), and adc_voltage_monitor_single_channel_select().

◆ ctrl2

__IO uint32_t adc_type::ctrl2

Definition at line 272 of file at32f413_adc.h.

◆ [struct]

struct { ... } adc_type::ctrl2_bit

Referenced by adc_base_config(), adc_calibration_init(), adc_calibration_init_status_get(), adc_calibration_start(), adc_calibration_status_get(), adc_dma_mode_enable(), adc_enable(), adc_ordinary_conversion_trigger_set(), adc_ordinary_software_trigger_enable(), adc_ordinary_software_trigger_status_get(), adc_preempt_conversion_trigger_set(), adc_preempt_software_trigger_enable(), and adc_preempt_software_trigger_status_get().

◆ dtalign

__IO uint32_t adc_type::dtalign

Definition at line 282 of file at32f413_adc.h.

Referenced by adc_base_config().

◆ itsrven

__IO uint32_t adc_type::itsrven

Definition at line 290 of file at32f413_adc.h.

◆ mssel

__IO uint32_t adc_type::mssel

Definition at line 259 of file at32f413_adc.h.

◆ occs

__IO uint32_t adc_type::occs

Definition at line 236 of file at32f413_adc.h.

◆ ocdmaen

__IO uint32_t adc_type::ocdmaen

Definition at line 280 of file at32f413_adc.h.

Referenced by adc_dma_mode_enable().

◆ oclen

__IO uint32_t adc_type::oclen

Definition at line 429 of file at32f413_adc.h.

Referenced by adc_base_config().

◆ ocpcnt

__IO uint32_t adc_type::ocpcnt

Definition at line 258 of file at32f413_adc.h.

Referenced by adc_ordinary_part_count_set().

◆ ocpen

__IO uint32_t adc_type::ocpen

Definition at line 256 of file at32f413_adc.h.

Referenced by adc_ordinary_part_mode_enable().

◆ ocswtrg

__IO uint32_t adc_type::ocswtrg

Definition at line 289 of file at32f413_adc.h.

Referenced by adc_ordinary_software_trigger_enable(), and adc_ordinary_software_trigger_status_get().

◆ octen

__IO uint32_t adc_type::octen

Definition at line 287 of file at32f413_adc.h.

Referenced by adc_ordinary_conversion_trigger_set().

◆ octesel_h

__IO uint32_t adc_type::octesel_h

Definition at line 292 of file at32f413_adc.h.

Referenced by adc_ordinary_conversion_trigger_set().

◆ octesel_l

__IO uint32_t adc_type::octesel_l

Definition at line 286 of file at32f413_adc.h.

Referenced by adc_ordinary_conversion_trigger_set().

◆ ocvmen

__IO uint32_t adc_type::ocvmen

Definition at line 262 of file at32f413_adc.h.

Referenced by adc_voltage_monitor_enable().

◆ odt

__IO uint32_t adc_type::odt

Definition at line 544 of file at32f413_adc.h.

Referenced by adc_ordinary_conversion_data_get().

◆ [struct]

struct { ... } adc_type::odt_bit

Referenced by adc_ordinary_conversion_data_get().

◆ osn1

__IO uint32_t adc_type::osn1

Definition at line 460 of file at32f413_adc.h.

◆ osn10

__IO uint32_t adc_type::osn10

Definition at line 445 of file at32f413_adc.h.

◆ osn11

__IO uint32_t adc_type::osn11

Definition at line 446 of file at32f413_adc.h.

◆ osn12

__IO uint32_t adc_type::osn12

Definition at line 447 of file at32f413_adc.h.

◆ osn13

__IO uint32_t adc_type::osn13

Definition at line 425 of file at32f413_adc.h.

◆ osn14

__IO uint32_t adc_type::osn14

Definition at line 426 of file at32f413_adc.h.

◆ osn15

__IO uint32_t adc_type::osn15

Definition at line 427 of file at32f413_adc.h.

◆ osn16

__IO uint32_t adc_type::osn16

Definition at line 428 of file at32f413_adc.h.

◆ osn2

__IO uint32_t adc_type::osn2

Definition at line 461 of file at32f413_adc.h.

◆ osn3

__IO uint32_t adc_type::osn3

Definition at line 462 of file at32f413_adc.h.

◆ osn4

__IO uint32_t adc_type::osn4

Definition at line 463 of file at32f413_adc.h.

◆ osn5

__IO uint32_t adc_type::osn5

Definition at line 464 of file at32f413_adc.h.

◆ osn6

__IO uint32_t adc_type::osn6

Definition at line 465 of file at32f413_adc.h.

◆ osn7

__IO uint32_t adc_type::osn7

Definition at line 442 of file at32f413_adc.h.

◆ osn8

__IO uint32_t adc_type::osn8

Definition at line 443 of file at32f413_adc.h.

◆ osn9

__IO uint32_t adc_type::osn9

Definition at line 444 of file at32f413_adc.h.

◆ osq1

__IO uint32_t adc_type::osq1

Definition at line 422 of file at32f413_adc.h.

Referenced by adc_ordinary_channel_set().

◆ [struct]

struct { ... } adc_type::osq1_bit

Referenced by adc_base_config().

◆ osq2

__IO uint32_t adc_type::osq2

Definition at line 439 of file at32f413_adc.h.

Referenced by adc_ordinary_channel_set().

◆ [struct]

struct { ... } adc_type::osq2_bit

◆ osq3

__IO uint32_t adc_type::osq3

Definition at line 457 of file at32f413_adc.h.

Referenced by adc_ordinary_channel_set().

◆ [struct]

struct { ... } adc_type::osq3_bit

◆ pcautoen

__IO uint32_t adc_type::pcautoen

Definition at line 255 of file at32f413_adc.h.

Referenced by adc_preempt_auto_mode_enable().

◆ pcce

__IO uint32_t adc_type::pcce

Definition at line 234 of file at32f413_adc.h.

Referenced by adc_interrupt_flag_get().

◆ pcceien

__IO uint32_t adc_type::pcceien

Definition at line 252 of file at32f413_adc.h.

Referenced by adc_interrupt_flag_get().

◆ pccs

__IO uint32_t adc_type::pccs

Definition at line 235 of file at32f413_adc.h.

◆ pcdto1

__IO uint32_t adc_type::pcdto1

Definition at line 344 of file at32f413_adc.h.

Referenced by adc_preempt_offset_value_set().

◆ [struct]

struct { ... } adc_type::pcdto1_bit

Referenced by adc_preempt_offset_value_set().

◆ pcdto2

__IO uint32_t adc_type::pcdto2

Definition at line 357 of file at32f413_adc.h.

Referenced by adc_preempt_offset_value_set().

◆ [struct]

struct { ... } adc_type::pcdto2_bit

Referenced by adc_preempt_offset_value_set().

◆ pcdto3

__IO uint32_t adc_type::pcdto3

Definition at line 370 of file at32f413_adc.h.

Referenced by adc_preempt_offset_value_set().

◆ [struct]

struct { ... } adc_type::pcdto3_bit

Referenced by adc_preempt_offset_value_set().

◆ pcdto4

__IO uint32_t adc_type::pcdto4

Definition at line 383 of file at32f413_adc.h.

Referenced by adc_preempt_offset_value_set().

◆ [struct]

struct { ... } adc_type::pcdto4_bit

Referenced by adc_preempt_offset_value_set().

◆ pclen

__IO uint32_t adc_type::pclen

Definition at line 482 of file at32f413_adc.h.

Referenced by adc_preempt_channel_length_set(), and adc_preempt_channel_set().

◆ pcpen

__IO uint32_t adc_type::pcpen

Definition at line 257 of file at32f413_adc.h.

Referenced by adc_preempt_part_mode_enable().

◆ pcswtrg

__IO uint32_t adc_type::pcswtrg

Definition at line 288 of file at32f413_adc.h.

Referenced by adc_preempt_software_trigger_enable(), and adc_preempt_software_trigger_status_get().

◆ pcten

__IO uint32_t adc_type::pcten

Definition at line 284 of file at32f413_adc.h.

Referenced by adc_preempt_conversion_trigger_set().

◆ pctesel_h

__IO uint32_t adc_type::pctesel_h

Definition at line 291 of file at32f413_adc.h.

Referenced by adc_preempt_conversion_trigger_set().

◆ pctesel_l

__IO uint32_t adc_type::pctesel_l

Definition at line 283 of file at32f413_adc.h.

Referenced by adc_preempt_conversion_trigger_set().

◆ pcvmen

__IO uint32_t adc_type::pcvmen

Definition at line 261 of file at32f413_adc.h.

Referenced by adc_voltage_monitor_enable().

◆ pdt1

__IO uint32_t adc_type::pdt1

Definition at line 492 of file at32f413_adc.h.

Referenced by adc_preempt_conversion_data_get().

◆ [struct]

struct { ... } adc_type::pdt1_bit

Referenced by adc_preempt_conversion_data_get().

◆ pdt2

__IO uint32_t adc_type::pdt2

Definition at line 505 of file at32f413_adc.h.

Referenced by adc_preempt_conversion_data_get().

◆ [struct]

struct { ... } adc_type::pdt2_bit

Referenced by adc_preempt_conversion_data_get().

◆ pdt3

__IO uint32_t adc_type::pdt3

Definition at line 518 of file at32f413_adc.h.

Referenced by adc_preempt_conversion_data_get().

◆ [struct]

struct { ... } adc_type::pdt3_bit

Referenced by adc_preempt_conversion_data_get().

◆ pdt4

__IO uint32_t adc_type::pdt4

Definition at line 531 of file at32f413_adc.h.

Referenced by adc_preempt_conversion_data_get().

◆ [struct]

struct { ... } adc_type::pdt4_bit

Referenced by adc_preempt_conversion_data_get().

◆ psn1

__IO uint32_t adc_type::psn1

Definition at line 478 of file at32f413_adc.h.

Referenced by adc_preempt_channel_set().

◆ psn2

__IO uint32_t adc_type::psn2

Definition at line 479 of file at32f413_adc.h.

Referenced by adc_preempt_channel_set().

◆ psn3

__IO uint32_t adc_type::psn3

Definition at line 480 of file at32f413_adc.h.

Referenced by adc_preempt_channel_set().

◆ psn4

__IO uint32_t adc_type::psn4

Definition at line 481 of file at32f413_adc.h.

Referenced by adc_preempt_channel_set().

◆ psq

__IO uint32_t adc_type::psq

Definition at line 475 of file at32f413_adc.h.

◆ [struct]

struct { ... } adc_type::psq_bit

Referenced by adc_preempt_channel_length_set(), and adc_preempt_channel_set().

◆ reserved1

__IO uint32_t adc_type::reserved1

Definition at line 237 of file at32f413_adc.h.

◆ reserved2

__IO uint32_t adc_type::reserved2

Definition at line 263 of file at32f413_adc.h.

◆ reserved3

__IO uint32_t adc_type::reserved3

Definition at line 285 of file at32f413_adc.h.

◆ reserved4

__IO uint32_t adc_type::reserved4

Definition at line 293 of file at32f413_adc.h.

◆ rpen

__IO uint32_t adc_type::rpen

Definition at line 276 of file at32f413_adc.h.

Referenced by adc_base_config().

◆ spt1

__IO uint32_t adc_type::spt1

Definition at line 302 of file at32f413_adc.h.

Referenced by adc_ordinary_channel_set(), and adc_preempt_channel_set().

◆ [struct]

struct { ... } adc_type::spt1_bit

◆ spt2

__IO uint32_t adc_type::spt2

Definition at line 322 of file at32f413_adc.h.

Referenced by adc_ordinary_channel_set(), and adc_preempt_channel_set().

◆ [struct]

struct { ... } adc_type::spt2_bit

◆ sqen

__IO uint32_t adc_type::sqen

Definition at line 253 of file at32f413_adc.h.

Referenced by adc_base_config().

◆ sts

__IO uint32_t adc_type::sts

Definition at line 229 of file at32f413_adc.h.

Referenced by adc_flag_clear(), and adc_flag_get().

◆ [struct]

struct { ... } adc_type::sts_bit

Referenced by adc_interrupt_flag_get().

◆ vmcsel

__IO uint32_t adc_type::vmcsel

Definition at line 249 of file at32f413_adc.h.

Referenced by adc_voltage_monitor_single_channel_select().

◆ vmhb

__IO uint32_t adc_type::vmhb

Definition at line 396 of file at32f413_adc.h.

Referenced by adc_voltage_monitor_threshold_value_set().

◆ [struct]

struct { ... } adc_type::vmhb_bit

Referenced by adc_voltage_monitor_threshold_value_set().

◆ vmlb

__IO uint32_t adc_type::vmlb

Definition at line 409 of file at32f413_adc.h.

Referenced by adc_voltage_monitor_threshold_value_set().

◆ [struct]

struct { ... } adc_type::vmlb_bit

Referenced by adc_voltage_monitor_threshold_value_set().

◆ vmor

__IO uint32_t adc_type::vmor

Definition at line 232 of file at32f413_adc.h.

Referenced by adc_interrupt_flag_get().

◆ vmorien

__IO uint32_t adc_type::vmorien

Definition at line 251 of file at32f413_adc.h.

Referenced by adc_interrupt_flag_get().

◆ vmsgen

__IO uint32_t adc_type::vmsgen

Definition at line 254 of file at32f413_adc.h.

Referenced by adc_voltage_monitor_enable().

The documentation for this struct was generated from the following file:
  • at32f413_adc.h


AT32F413 Firmwary Library: ADC_exported_functions

Functions
ADC_exported_functions
AT32F413_periph_driver » ADC

Functions

void | adc_reset (adc_type *adc_x)
deinitialize the adc peripheral registers to their default reset values.
void | adc_enable (adc_type *adc_x, confirm_state new_state)
enable or disable the specified adc peripheral.
void | adc_combine_mode_select (adc_combine_mode_type combine_mode)
select combine mode of the specified adc peripheral.
void | adc_base_default_para_init (adc_base_config_type *adc_base_struct)
adc base default para init.
void | adc_base_config (adc_type *adc_x, adc_base_config_type *adc_base_struct)
initialize the adc peripheral according to the specified parameters.
void | adc_dma_mode_enable (adc_type *adc_x, confirm_state new_state)
enable or disable the adc dma transfer.
void | adc_interrupt_enable (adc_type *adc_x, uint32_t adc_int, confirm_state new_state)
enable or disable the specified adc interrupts.
void | adc_calibration_init (adc_type *adc_x)
initialize calibration register of the specified adc peripheral.
flag_status | adc_calibration_init_status_get (adc_type *adc_x)
get calibration register's initialize status of the specified adc peripheral.
void | adc_calibration_start (adc_type *adc_x)
start calibration process of the specified adc peripheral.
flag_status | adc_calibration_status_get (adc_type *adc_x)
get calibration status of the specified adc peripheral.
void | adc_voltage_monitor_enable (adc_type *adc_x, adc_voltage_monitoring_type adc_voltage_monitoring)
enable or disable the voltage monitoring on single/all ordinary or preempt channels of the specified adc peripheral.
void | adc_voltage_monitor_threshold_value_set (adc_type *adc_x, uint16_t adc_high_threshold, uint16_t adc_low_threshold)
set voltage monitoring's high and low thresholds value of the specified adc peripheral.
void | adc_voltage_monitor_single_channel_select (adc_type *adc_x, adc_channel_select_type adc_channel)
select the voltage monitoring's channel of the specified adc peripheral.
void | adc_ordinary_channel_set (adc_type *adc_x, adc_channel_select_type adc_channel, uint8_t adc_sequence, adc_sampletime_select_type adc_sampletime)
set ordinary channel's corresponding rank in the sequencer and sample time of the specified adc peripheral.
void | adc_preempt_channel_length_set (adc_type *adc_x, uint8_t adc_channel_lenght)
set preempt channel lenghth of the specified adc peripheral.
void | adc_preempt_channel_set (adc_type *adc_x, adc_channel_select_type adc_channel, uint8_t adc_sequence, adc_sampletime_select_type adc_sampletime)
configure preempt channel's corresponding rank in the sequencer and sample time of the specified adc peripheral.
void | adc_ordinary_conversion_trigger_set (adc_type *adc_x, adc_ordinary_trig_select_type adc_ordinary_trig, confirm_state new_state)
enable or disable the ordinary channel's external trigger and set external trigger event of the specified adc peripheral.
void | adc_preempt_conversion_trigger_set (adc_type *adc_x, adc_preempt_trig_select_type adc_preempt_trig, confirm_state new_state)
enable or disable the preempt channel's external trigger and set external trigger event of the specified adc peripheral.
void | adc_preempt_offset_value_set (adc_type *adc_x, adc_preempt_channel_type adc_preempt_channel, uint16_t adc_offset_value)
set preempt channel's conversion value offset of the specified adc peripheral.
void | adc_ordinary_part_count_set (adc_type *adc_x, uint8_t adc_channel_count)
set partitioned mode channel count of the specified adc peripheral.
void | adc_ordinary_part_mode_enable (adc_type *adc_x, confirm_state new_state)
enable or disable the partitioned mode on ordinary channel of the specified adc peripheral.
void | adc_preempt_part_mode_enable (adc_type *adc_x, confirm_state new_state)
enable or disable the partitioned mode on preempt channel of the specified adc peripheral.
void | adc_preempt_auto_mode_enable (adc_type *adc_x, confirm_state new_state)
enable or disable automatic preempt group conversion of the specified adc peripheral.
void | adc_tempersensor_vintrv_enable (confirm_state new_state)
enable or disable the temperature sensor and vintrv channel.
void | adc_ordinary_software_trigger_enable (adc_type *adc_x, confirm_state new_state)
enable or disable ordinary software start conversion of the specified adc peripheral.
flag_status | adc_ordinary_software_trigger_status_get (adc_type *adc_x)
get ordinary software start conversion status of the specified adc peripheral.
void | adc_preempt_software_trigger_enable (adc_type *adc_x, confirm_state new_state)
enable or disable preempt software start conversion of the specified adc peripheral.
flag_status | adc_preempt_software_trigger_status_get (adc_type *adc_x)
get preempt software start conversion status of the specified adc peripheral.
uint16_t | adc_ordinary_conversion_data_get (adc_type *adc_x)
return the last conversion data for ordinary channel of the specified adc peripheral.
uint32_t | adc_combine_ordinary_conversion_data_get (void)
return the last conversion data for ordinary channel of combine adc(adc1 and adc2).
uint16_t | adc_preempt_conversion_data_get (adc_type *adc_x, adc_preempt_channel_type adc_preempt_channel)
return the conversion data for selection preempt channel of the specified adc peripheral.
flag_status | adc_flag_get (adc_type *adc_x, uint8_t adc_flag)
get flag of the specified adc peripheral.
flag_status | adc_interrupt_flag_get (adc_type *adc_x, uint8_t adc_flag)
get interrupt flag of the specified adc peripheral.
void | adc_flag_clear (adc_type *adc_x, uint32_t adc_flag)
clear flag of the specified adc peripheral.

Detailed Description

Function Documentation

◆ adc_base_config()

void adc_base_config | ( | adc_type * | adc_x,
 |  | adc_base_config_type * | adc_base_struct )

initialize the adc peripheral according to the specified parameters.

Parameters
adc_x | select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
sequence_mode | set the state of adc sequence mode. this parameter can be:TRUE or FALSE
repeat_mode | set the state of adc repeat conversion mode. this parameter can be:TRUE or FALSE
data_align set the state of adc data alignment. this parameter can be one of the following values:
  • ADC_RIGHT_ALIGNMENT
  • ADC_LEFT_ALIGNMENT
ordinary_channel_length configure the adc ordinary channel sequence length. this parameter can be:
  • (0x1~0x10)
Return values
none

Definition at line 142 of file at32f413_adc.c.

Referenced by adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), and adc_config().

◆ adc_base_default_para_init()

void adc_base_default_para_init ( adc_base_config_type * adc_base_struct )

adc base default para init.

Parameters
sequence_mode | set the state of adc sequence mode. this parameter can be:TRUE or FALSE
repeat_mode | set the state of adc repeat conversion mode. this parameter can be:TRUE or FALSE
data_align set the state of adc data alignment. this parameter can be one of the following values:
  • ADC_RIGHT_ALIGNMENT
  • ADC_LEFT_ALIGNMENT
ordinary_channel_length configure the adc ordinary channel sequence length. this parameter can be:
  • (0x1~0x10)
Return values
none

Definition at line 116 of file at32f413_adc.c.

Referenced by adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), and adc_config().

◆ adc_calibration_init()

void adc_calibration_init ( adc_type * adc_x )

initialize calibration register of the specified adc peripheral.

Parameters
adc_x select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
Return values
none

Definition at line 198 of file at32f413_adc.c.

Referenced by adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), and adc_config().

◆ adc_calibration_init_status_get()

flag_status adc_calibration_init_status_get ( adc_type * adc_x )

get calibration register's initialize status of the specified adc peripheral.

Parameters
adc_x select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
Return values
the new state of reset calibration register status(SET or RESET).

Definition at line 210 of file at32f413_adc.c.

Referenced by adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), and adc_config().

◆ adc_calibration_start()

void adc_calibration_start ( adc_type * adc_x )

start calibration process of the specified adc peripheral.

Parameters
adc_x select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
Return values
none

Definition at line 229 of file at32f413_adc.c.

Referenced by adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), and adc_config().

◆ adc_calibration_status_get()

flag_status adc_calibration_status_get ( adc_type * adc_x )

get calibration status of the specified adc peripheral.

Parameters
adc_x select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
Return values
the new state of calibration status(SET or RESET).

Definition at line 241 of file at32f413_adc.c.

Referenced by adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), and adc_config().

◆ adc_combine_mode_select()

void adc_combine_mode_select ( adc_combine_mode_type combine_mode )

select combine mode of the specified adc peripheral.

Parameters
combine_mode select the adc combine mode. this parameter can be one of the following values:
  • ADC_INDEPENDENT_MODE
  • ADC_ORDINARY_SMLT_PREEMPT_SMLT_MODE
  • ADC_ORDINARY_SMLT_PREEMPT_INTERLTRIG_MODE
  • ADC_ORDINARY_SHORTSHIFT_PREEMPT_SMLT_MODE
  • ADC_ORDINARY_LONGSHIFT_PREEMPT_SMLT_MODE
  • ADC_PREEMPT_SMLT_ONLY_MODE
  • ADC_ORDINARY_SMLT_ONLY_MODE
  • ADC_ORDINARY_SHORTSHIFT_ONLY_MODE
  • ADC_ORDINARY_LONGSHIFT_ONLY_MODE
  • ADC_PREEMPT_INTERLTRIG_ONLY_MODE note:these bits are reserved in adc2
Return values
none

Definition at line 96 of file at32f413_adc.c.

Referenced by adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), and adc_config().

◆ adc_combine_ordinary_conversion_data_get()

uint32_t adc_combine_ordinary_conversion_data_get ( void )

return the last conversion data for ordinary channel of combine adc(adc1 and adc2).

Return values
the last conversion data for ordinary channel.

Definition at line 716 of file at32f413_adc.c.

◆ adc_dma_mode_enable()

void adc_dma_mode_enable | ( | adc_type * | adc_x,
 |  | confirm_state | new_state )

enable or disable the adc dma transfer.

Parameters
adc_x | select the adc peripheral. this parameter can be one of the following values: ADC1. note:this bit is reserved in adc2
new_state | new state of the adc dma transfer. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 160 of file at32f413_adc.c.

Referenced by adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), and adc_config().

◆ adc_enable()

void adc_enable | ( | adc_type * | adc_x,
 |  | confirm_state | new_state )

enable or disable the specified adc peripheral.

Parameters
adc_x | select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
new_state | new state of a/d converter. this parameter can be: TRUE or FALSE. note:after adc ready,user set adcen bit will cause ordinary conversion
Return values
none

Definition at line 74 of file at32f413_adc.c.

Referenced by adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), and adc_config().

◆ adc_flag_clear()

void adc_flag_clear | ( | adc_type * | adc_x,
 |  | uint32_t | adc_flag )

clear flag of the specified adc peripheral.

Parameters
adc_x select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
adc_flag select the adc flag. this parameter can be any combination of the following values:
  • ADC_VMOR_FLAG
  • ADC_CCE_FLAG(also can clear by reading the adc_x->odt)
  • ADC_PCCE_FLAG
  • ADC_PCCS_FLAG
  • ADC_OCCS_FLAG
Return values
none

Definition at line 841 of file at32f413_adc.c.

Referenced by ADC1_2_IRQHandler().

◆ adc_flag_get()

flag_status adc_flag_get | ( | adc_type * | adc_x,
 |  | uint8_t | adc_flag )

get flag of the specified adc peripheral.

Parameters
adc_x select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
adc_flag select the adc flag. this parameter can be one of the following values:
  • ADC_VMOR_FLAG
  • ADC_CCE_FLAG
  • ADC_PCCE_FLAG
  • ADC_PCCS_FLAG(no interrupt associated)
  • ADC_OCCS_FLAG(no interrupt associated)
Return values
the new state of adc flag status(SET or RESET).

Definition at line 771 of file at32f413_adc.c.

◆ adc_interrupt_enable()

void adc_interrupt_enable | ( | adc_type * | adc_x,
 |  | uint32_t | adc_int,
 |  | confirm_state | new_state )

enable or disable the specified adc interrupts.

Parameters
adc_x | select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
adc_int specifies the adc interrupt sources to be enabled or disabled. this parameter can be one of the following values:
  • ADC_VMOR_INT
  • ADC_CCE_INT
  • ADC_PCCE_INT
new_state | new state of the specified adc interrupts. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 179 of file at32f413_adc.c.

Referenced by adc_config(), adc_config(), and adc_config().

◆ adc_interrupt_flag_get()

flag_status adc_interrupt_flag_get | ( | adc_type * | adc_x,
 |  | uint8_t | adc_flag )

get interrupt flag of the specified adc peripheral.

Parameters
adc_x select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
adc_flag select the adc flag. this parameter can be one of the following values:
  • ADC_VMOR_FLAG
  • ADC_CCE_FLAG
  • ADC_PCCE_FLAG
Return values
the new state of adc flag status(SET or RESET).

< voltage monitoring out of range flag

< channels conversion end flag

< preempt channels conversion end flag

Definition at line 798 of file at32f413_adc.c.

Referenced by ADC1_2_IRQHandler().

◆ adc_ordinary_channel_set()

void adc_ordinary_channel_set | ( | adc_type * | adc_x,
 |  | adc_channel_select_type | adc_channel,
 |  | uint8_t | adc_sequence,
 |  | adc_sampletime_select_type | adc_sampletime )

set ordinary channel's corresponding rank in the sequencer and sample time of the specified adc peripheral.

Parameters
adc_x select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
adc_channel select the channel. this parameter can be one of the following values:
  • ADC_CHANNEL_0 - ADC_CHANNEL_1 - ADC_CHANNEL_2 - ADC_CHANNEL_3
  • ADC_CHANNEL_4 - ADC_CHANNEL_5 - ADC_CHANNEL_6 - ADC_CHANNEL_7
  • ADC_CHANNEL_8 - ADC_CHANNEL_9 - ADC_CHANNEL_10 - ADC_CHANNEL_11
  • ADC_CHANNEL_12 - ADC_CHANNEL_13 - ADC_CHANNEL_14 - ADC_CHANNEL_15
  • ADC_CHANNEL_16 - ADC_CHANNEL_17
adc_sequence set rank in the ordinary group sequencer. this parameter must be:
  • between 1 to 16
adc_sampletime set the sampletime of adc channel. this parameter can be one of the following values:
  • ADC_SAMPLETIME_1_5
  • ADC_SAMPLETIME_7_5
  • ADC_SAMPLETIME_13_5
  • ADC_SAMPLETIME_28_5
  • ADC_SAMPLETIME_41_5
  • ADC_SAMPLETIME_55_5
  • ADC_SAMPLETIME_71_5
  • ADC_SAMPLETIME_239_5
Return values
none

Definition at line 342 of file at32f413_adc.c.

Referenced by adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), and adc_config().

◆ adc_ordinary_conversion_data_get()

uint16_t adc_ordinary_conversion_data_get ( adc_type * adc_x )

return the last conversion data for ordinary channel of the specified adc peripheral.

Parameters
adc_x select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
Return values
the last conversion data for ordinary channel.

Definition at line 707 of file at32f413_adc.c.

◆ adc_ordinary_conversion_trigger_set()

void adc_ordinary_conversion_trigger_set | ( | adc_type * | adc_x,
 |  | adc_ordinary_trig_select_type | adc_ordinary_trig,
 |  | confirm_state | new_state )

enable or disable the ordinary channel's external trigger and set external trigger event of the specified adc peripheral.

Parameters
adc_x | select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
adc_ordinary_trig select the external trigger event. this parameter can be one of the following values: adc1 & adc2
  • ADC12_ORDINARY_TRIG_TMR1CH1 - ADC12_ORDINARY_TRIG_TMR1CH2 - ADC12_ORDINARY_TRIG_TMR1CH3 - ADC12_ORDINARY_TRIG_TMR2CH2
  • ADC12_ORDINARY_TRIG_TMR3TRGOUT - ADC12_ORDINARY_TRIG_TMR4CH4 - ADC12_ORDINARY_TRIG_EXINT11_TMR8TRGOUT - ADC12_ORDINARY_TRIG_SOFTWARE
  • ADC12_ORDINARY_TRIG_TMR1TRGOUT - ADC12_ORDINARY_TRIG_TMR8CH1 - ADC12_ORDINARY_TRIG_TMR8CH2
new_state | new state of ordinary channel's external trigger. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 480 of file at32f413_adc.c.

Referenced by adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), and adc_config().

◆ adc_ordinary_part_count_set()

void adc_ordinary_part_count_set | ( | adc_type * | adc_x,
 |  | uint8_t | adc_channel_count )

set partitioned mode channel count of the specified adc peripheral.

Parameters
adc_x select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
adc_channel_count configure the adc partitioned mode channel count. this parameter can be:
  • (0x1~0x8)
Return values
none

Definition at line 574 of file at32f413_adc.c.

Referenced by adc_config().

◆ adc_ordinary_part_mode_enable()

void adc_ordinary_part_mode_enable | ( | adc_type * | adc_x,
 |  | confirm_state | new_state )

enable or disable the partitioned mode on ordinary channel of the specified adc peripheral.

Parameters
adc_x | select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
new_state | new state of ordinary channel's partitioned mode. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 589 of file at32f413_adc.c.

Referenced by adc_config().

◆ adc_ordinary_software_trigger_enable()

void adc_ordinary_software_trigger_enable | ( | adc_type * | adc_x,
 |  | confirm_state | new_state )

enable or disable ordinary software start conversion of the specified adc peripheral.

Parameters
adc_x | select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
new_state | new state of ordinary software start conversion. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 643 of file at32f413_adc.c.

Referenced by main().

◆ adc_ordinary_software_trigger_status_get()

flag_status adc_ordinary_software_trigger_status_get ( adc_type * adc_x )

get ordinary software start conversion status of the specified adc peripheral.

Parameters
adc_x select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
Return values
the new state of ordinary software start conversion status(SET or RESET).

Definition at line 655 of file at32f413_adc.c.

◆ adc_preempt_auto_mode_enable()

void adc_preempt_auto_mode_enable | ( | adc_type * | adc_x,
 |  | confirm_state | new_state )

enable or disable automatic preempt group conversion of the specified adc peripheral.

Parameters
adc_x | select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
new_state | new state of automatic preempt group conversion. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 617 of file at32f413_adc.c.

Referenced by adc_config().

◆ adc_preempt_channel_length_set()

void adc_preempt_channel_length_set | ( | adc_type * | adc_x,
 |  | uint8_t | adc_channel_lenght )

set preempt channel lenghth of the specified adc peripheral.

Parameters
adc_x select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
adc_channel_lenght set the adc preempt channel lenghth. this parameter can be:
  • (0x1~0x4)
Return values
none

Definition at line 393 of file at32f413_adc.c.

Referenced by adc_config(), and adc_config().

◆ adc_preempt_channel_set()

void adc_preempt_channel_set | ( | adc_type * | adc_x,
 |  | adc_channel_select_type | adc_channel,
 |  | uint8_t | adc_sequence,
 |  | adc_sampletime_select_type | adc_sampletime )

configure preempt channel's corresponding rank in the sequencer and sample time of the specified adc peripheral.

Parameters
adc_x select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
adc_channel select the channel. this parameter can be one of the following values:
  • ADC_CHANNEL_0 - ADC_CHANNEL_1 - ADC_CHANNEL_2 - ADC_CHANNEL_3
  • ADC_CHANNEL_4 - ADC_CHANNEL_5 - ADC_CHANNEL_6 - ADC_CHANNEL_7
  • ADC_CHANNEL_8 - ADC_CHANNEL_9 - ADC_CHANNEL_10 - ADC_CHANNEL_11
  • ADC_CHANNEL_12 - ADC_CHANNEL_13 - ADC_CHANNEL_14 - ADC_CHANNEL_15
  • ADC_CHANNEL_16 - ADC_CHANNEL_17
adc_sequence set rank in the preempt group sequencer. this parameter must be:
  • between 1 to 4
adc_sampletime config the sampletime of adc channel. this parameter can be one of the following values:
  • ADC_SAMPLETIME_1_5
  • ADC_SAMPLETIME_7_5
  • ADC_SAMPLETIME_13_5
  • ADC_SAMPLETIME_28_5
  • ADC_SAMPLETIME_41_5
  • ADC_SAMPLETIME_55_5
  • ADC_SAMPLETIME_71_5
  • ADC_SAMPLETIME_239_5
Return values
none

Definition at line 425 of file at32f413_adc.c.

Referenced by adc_config(), and adc_config().

◆ adc_preempt_conversion_data_get()

uint16_t adc_preempt_conversion_data_get | ( | adc_type * | adc_x,
 |  | adc_preempt_channel_type | adc_preempt_channel )

return the conversion data for selection preempt channel of the specified adc peripheral.

Parameters
adc_x select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
adc_preempt_channel select the preempt channel. this parameter can be one of the following values:
  • ADC_PREEMPT_CHANNEL_1
  • ADC_PREEMPT_CHANNEL_2
  • ADC_PREEMPT_CHANNEL_3
  • ADC_PREEMPT_CHANNEL_4
Return values
the conversion data for selection preempt channel.

Definition at line 734 of file at32f413_adc.c.

Referenced by ADC1_2_IRQHandler().

◆ adc_preempt_conversion_trigger_set()

void adc_preempt_conversion_trigger_set | ( | adc_type * | adc_x,
 |  | adc_preempt_trig_select_type | adc_preempt_trig,
 |  | confirm_state | new_state )

enable or disable the preempt channel's external trigger and set external trigger event of the specified adc peripheral.

Parameters
adc_x | select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
adc_preempt_trig select the external trigger event. this parameter can be one of the following values: adc1 & adc2
  • ADC12_PREEMPT_TRIG_TMR1TRGOUT - ADC12_PREEMPT_TRIG_TMR1CH4 - ADC12_PREEMPT_TRIG_TMR2TRGOUT - ADC12_PREEMPT_TRIG_TMR2CH1
  • ADC12_PREEMPT_TRIG_TMR3CH4 - ADC12_PREEMPT_TRIG_TMR4TRGOUT - ADC12_PREEMPT_TRIG_EXINT15_TMR8CH4 - ADC12_PREEMPT_TRIG_SOFTWARE
  • ADC12_PREEMPT_TRIG_TMR1CH1 - ADC12_PREEMPT_TRIG_TMR8CH1 - ADC12_PREEMPT_TRIG_TMR8TRGOUT
new_state | new state of preempt channel's external trigger. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 511 of file at32f413_adc.c.

Referenced by adc_config(), and adc_config().

◆ adc_preempt_offset_value_set()

void adc_preempt_offset_value_set | ( | adc_type * | adc_x,
 |  | adc_preempt_channel_type | adc_preempt_channel,
 |  | uint16_t | adc_offset_value )

set preempt channel's conversion value offset of the specified adc peripheral.

Parameters
adc_x select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
adc_preempt_channel select the preempt channel. this parameter can be one of the following values:
  • ADC_PREEMPT_CHANNEL_1
  • ADC_PREEMPT_CHANNEL_2
  • ADC_PREEMPT_CHANNEL_3
  • ADC_PREEMPT_CHANNEL_4
adc_offset_value set the adc preempt channel's conversion value offset. this parameter can be:
  • (0x000~0xFFF)
Return values
none

Definition at line 543 of file at32f413_adc.c.

◆ adc_preempt_part_mode_enable()

void adc_preempt_part_mode_enable | ( | adc_type * | adc_x,
 |  | confirm_state | new_state )

enable or disable the partitioned mode on preempt channel of the specified adc peripheral.

Parameters
adc_x | select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
new_state | new state of preempt channel's partitioned mode. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 603 of file at32f413_adc.c.

◆ adc_preempt_software_trigger_enable()

void adc_preempt_software_trigger_enable | ( | adc_type * | adc_x,
 |  | confirm_state | new_state )

enable or disable preempt software start conversion of the specified adc peripheral.

Parameters
adc_x | select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
new_state | new state of preempt software start conversion. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 676 of file at32f413_adc.c.

◆ adc_preempt_software_trigger_status_get()

flag_status adc_preempt_software_trigger_status_get ( adc_type * adc_x )

get preempt software start conversion status of the specified adc peripheral.

Parameters
adc_x select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
Return values
the new state of preempt software start conversion status(SET or RESET).

Definition at line 688 of file at32f413_adc.c.

◆ adc_reset()

void adc_reset ( adc_type * adc_x )

deinitialize the adc peripheral registers to their default reset values.

Parameters
adc_x select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
Return values
none

Definition at line 50 of file at32f413_adc.c.

Referenced by adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), and adc_config().

◆ adc_tempersensor_vintrv_enable()

void adc_tempersensor_vintrv_enable ( confirm_state new_state )

enable or disable the temperature sensor and vintrv channel.

Parameters
new_state new state of Internal temperature sensor and vintrv. this parameter can be: TRUE or FALSE. note:this bit is present only in adc1
Return values
none

Definition at line 629 of file at32f413_adc.c.

Referenced by adc_config(), and adc_config().

◆ adc_voltage_monitor_enable()

void adc_voltage_monitor_enable | ( | adc_type * | adc_x,
 |  | adc_voltage_monitoring_type | adc_voltage_monitoring )

enable or disable the voltage monitoring on single/all ordinary or preempt channels of the specified adc peripheral.

Parameters
adc_x select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
adc_voltage_monitoring choose the adc_voltage_monitoring config. this parameter can be one of the following values:
  • ADC_VMONITOR_SINGLE_ORDINARY
  • ADC_VMONITOR_SINGLE_PREEMPT
  • ADC_VMONITOR_SINGLE_ORDINARY_PREEMPT
  • ADC_VMONITOR_ALL_ORDINARY
  • ADC_VMONITOR_ALL_PREEMPT
  • ADC_VMONITOR_ALL_ORDINARY_PREEMPT
  • ADC_VMONITOR_NONE
Return values
none

Definition at line 269 of file at32f413_adc.c.

Referenced by adc_config().

◆ adc_voltage_monitor_single_channel_select()

void adc_voltage_monitor_single_channel_select | ( | adc_type * | adc_x,
 |  | adc_channel_select_type | adc_channel )

select the voltage monitoring's channel of the specified adc peripheral.

Parameters
adc_x select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
adc_channel select the channel. this parameter can be one of the following values:
  • ADC_CHANNEL_0 - ADC_CHANNEL_1 - ADC_CHANNEL_2 - ADC_CHANNEL_3
  • ADC_CHANNEL_4 - ADC_CHANNEL_5 - ADC_CHANNEL_6 - ADC_CHANNEL_7
  • ADC_CHANNEL_8 - ADC_CHANNEL_9 - ADC_CHANNEL_10 - ADC_CHANNEL_11
  • ADC_CHANNEL_12 - ADC_CHANNEL_13 - ADC_CHANNEL_14 - ADC_CHANNEL_15
  • ADC_CHANNEL_16 - ADC_CHANNEL_17
Return values
none

Definition at line 310 of file at32f413_adc.c.

Referenced by adc_config().

◆ adc_voltage_monitor_threshold_value_set()

void adc_voltage_monitor_threshold_value_set | ( | adc_type * | adc_x,
 |  | uint16_t | adc_high_threshold,
 |  | uint16_t | adc_low_threshold )

set voltage monitoring's high and low thresholds value of the specified adc peripheral.

Parameters
adc_x select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
adc_high_threshold voltage monitoring's high thresholds value. this parameter can be:
  • (0x000~0xFFF)
adc_low_threshold voltage monitoring's low thresholds value. this parameter can be:
  • (0x000~0xFFF)
Return values
none

Definition at line 290 of file at32f413_adc.c.

Referenced by adc_config().


AT32F413 Firmwary Library: ADC_private_functions

Functions
ADC_private_functions
AT32F413_periph_driver » ADC

Functions

void | adc_reset (adc_type *adc_x)
deinitialize the adc peripheral registers to their default reset values.
void | adc_enable (adc_type *adc_x, confirm_state new_state)
enable or disable the specified adc peripheral.
void | adc_combine_mode_select (adc_combine_mode_type combine_mode)
select combine mode of the specified adc peripheral.
void | adc_base_default_para_init (adc_base_config_type *adc_base_struct)
adc base default para init.
void | adc_base_config (adc_type *adc_x, adc_base_config_type *adc_base_struct)
initialize the adc peripheral according to the specified parameters.
void | adc_dma_mode_enable (adc_type *adc_x, confirm_state new_state)
enable or disable the adc dma transfer.
void | adc_interrupt_enable (adc_type *adc_x, uint32_t adc_int, confirm_state new_state)
enable or disable the specified adc interrupts.
void | adc_calibration_init (adc_type *adc_x)
initialize calibration register of the specified adc peripheral.
flag_status | adc_calibration_init_status_get (adc_type *adc_x)
get calibration register's initialize status of the specified adc peripheral.
void | adc_calibration_start (adc_type *adc_x)
start calibration process of the specified adc peripheral.
flag_status | adc_calibration_status_get (adc_type *adc_x)
get calibration status of the specified adc peripheral.
void | adc_voltage_monitor_enable (adc_type *adc_x, adc_voltage_monitoring_type adc_voltage_monitoring)
enable or disable the voltage monitoring on single/all ordinary or preempt channels of the specified adc peripheral.
void | adc_voltage_monitor_threshold_value_set (adc_type *adc_x, uint16_t adc_high_threshold, uint16_t adc_low_threshold)
set voltage monitoring's high and low thresholds value of the specified adc peripheral.
void | adc_voltage_monitor_single_channel_select (adc_type *adc_x, adc_channel_select_type adc_channel)
select the voltage monitoring's channel of the specified adc peripheral.
void | adc_ordinary_channel_set (adc_type *adc_x, adc_channel_select_type adc_channel, uint8_t adc_sequence, adc_sampletime_select_type adc_sampletime)
set ordinary channel's corresponding rank in the sequencer and sample time of the specified adc peripheral.
void | adc_preempt_channel_length_set (adc_type *adc_x, uint8_t adc_channel_lenght)
set preempt channel lenghth of the specified adc peripheral.
void | adc_preempt_channel_set (adc_type *adc_x, adc_channel_select_type adc_channel, uint8_t adc_sequence, adc_sampletime_select_type adc_sampletime)
configure preempt channel's corresponding rank in the sequencer and sample time of the specified adc peripheral.
void | adc_ordinary_conversion_trigger_set (adc_type *adc_x, adc_ordinary_trig_select_type adc_ordinary_trig, confirm_state new_state)
enable or disable the ordinary channel's external trigger and set external trigger event of the specified adc peripheral.
void | adc_preempt_conversion_trigger_set (adc_type *adc_x, adc_preempt_trig_select_type adc_preempt_trig, confirm_state new_state)
enable or disable the preempt channel's external trigger and set external trigger event of the specified adc peripheral.
void | adc_preempt_offset_value_set (adc_type *adc_x, adc_preempt_channel_type adc_preempt_channel, uint16_t adc_offset_value)
set preempt channel's conversion value offset of the specified adc peripheral.
void | adc_ordinary_part_count_set (adc_type *adc_x, uint8_t adc_channel_count)
set partitioned mode channel count of the specified adc peripheral.
void | adc_ordinary_part_mode_enable (adc_type *adc_x, confirm_state new_state)
enable or disable the partitioned mode on ordinary channel of the specified adc peripheral.
void | adc_preempt_part_mode_enable (adc_type *adc_x, confirm_state new_state)
enable or disable the partitioned mode on preempt channel of the specified adc peripheral.
void | adc_preempt_auto_mode_enable (adc_type *adc_x, confirm_state new_state)
enable or disable automatic preempt group conversion of the specified adc peripheral.
void | adc_tempersensor_vintrv_enable (confirm_state new_state)
enable or disable the temperature sensor and vintrv channel.
void | adc_ordinary_software_trigger_enable (adc_type *adc_x, confirm_state new_state)
enable or disable ordinary software start conversion of the specified adc peripheral.
flag_status | adc_ordinary_software_trigger_status_get (adc_type *adc_x)
get ordinary software start conversion status of the specified adc peripheral.
void | adc_preempt_software_trigger_enable (adc_type *adc_x, confirm_state new_state)
enable or disable preempt software start conversion of the specified adc peripheral.
flag_status | adc_preempt_software_trigger_status_get (adc_type *adc_x)
get preempt software start conversion status of the specified adc peripheral.
uint16_t | adc_ordinary_conversion_data_get (adc_type *adc_x)
return the last conversion data for ordinary channel of the specified adc peripheral.
uint32_t | adc_combine_ordinary_conversion_data_get (void)
return the last conversion data for ordinary channel of combine adc(adc1 and adc2).
uint16_t | adc_preempt_conversion_data_get (adc_type *adc_x, adc_preempt_channel_type adc_preempt_channel)
return the conversion data for selection preempt channel of the specified adc peripheral.
flag_status | adc_flag_get (adc_type *adc_x, uint8_t adc_flag)
get flag of the specified adc peripheral.
flag_status | adc_interrupt_flag_get (adc_type *adc_x, uint8_t adc_flag)
get interrupt flag of the specified adc peripheral.
void | adc_flag_clear (adc_type *adc_x, uint32_t adc_flag)
clear flag of the specified adc peripheral.

Detailed Description

Function Documentation

◆ adc_base_config()

void adc_base_config | ( | adc_type * | adc_x,
 |  | adc_base_config_type * | adc_base_struct )

initialize the adc peripheral according to the specified parameters.

Parameters
adc_x | select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
sequence_mode | set the state of adc sequence mode. this parameter can be:TRUE or FALSE
repeat_mode | set the state of adc repeat conversion mode. this parameter can be:TRUE or FALSE
data_align set the state of adc data alignment. this parameter can be one of the following values:
  • ADC_RIGHT_ALIGNMENT
  • ADC_LEFT_ALIGNMENT
ordinary_channel_length configure the adc ordinary channel sequence length. this parameter can be:
  • (0x1~0x10)
Return values
none

Definition at line 142 of file at32f413_adc.c.

Referenced by adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), and adc_config().

◆ adc_base_default_para_init()

void adc_base_default_para_init ( adc_base_config_type * adc_base_struct )

adc base default para init.

Parameters
sequence_mode | set the state of adc sequence mode. this parameter can be:TRUE or FALSE
repeat_mode | set the state of adc repeat conversion mode. this parameter can be:TRUE or FALSE
data_align set the state of adc data alignment. this parameter can be one of the following values:
  • ADC_RIGHT_ALIGNMENT
  • ADC_LEFT_ALIGNMENT
ordinary_channel_length configure the adc ordinary channel sequence length. this parameter can be:
  • (0x1~0x10)
Return values
none

Definition at line 116 of file at32f413_adc.c.

Referenced by adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), and adc_config().

◆ adc_calibration_init()

void adc_calibration_init ( adc_type * adc_x )

initialize calibration register of the specified adc peripheral.

Parameters
adc_x select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
Return values
none

Definition at line 198 of file at32f413_adc.c.

Referenced by adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), and adc_config().

◆ adc_calibration_init_status_get()

flag_status adc_calibration_init_status_get ( adc_type * adc_x )

get calibration register's initialize status of the specified adc peripheral.

Parameters
adc_x select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
Return values
the new state of reset calibration register status(SET or RESET).

Definition at line 210 of file at32f413_adc.c.

Referenced by adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), and adc_config().

◆ adc_calibration_start()

void adc_calibration_start ( adc_type * adc_x )

start calibration process of the specified adc peripheral.

Parameters
adc_x select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
Return values
none

Definition at line 229 of file at32f413_adc.c.

Referenced by adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), and adc_config().

◆ adc_calibration_status_get()

flag_status adc_calibration_status_get ( adc_type * adc_x )

get calibration status of the specified adc peripheral.

Parameters
adc_x select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
Return values
the new state of calibration status(SET or RESET).

Definition at line 241 of file at32f413_adc.c.

Referenced by adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), and adc_config().

◆ adc_combine_mode_select()

void adc_combine_mode_select ( adc_combine_mode_type combine_mode )

select combine mode of the specified adc peripheral.

Parameters
combine_mode select the adc combine mode. this parameter can be one of the following values:
  • ADC_INDEPENDENT_MODE
  • ADC_ORDINARY_SMLT_PREEMPT_SMLT_MODE
  • ADC_ORDINARY_SMLT_PREEMPT_INTERLTRIG_MODE
  • ADC_ORDINARY_SHORTSHIFT_PREEMPT_SMLT_MODE
  • ADC_ORDINARY_LONGSHIFT_PREEMPT_SMLT_MODE
  • ADC_PREEMPT_SMLT_ONLY_MODE
  • ADC_ORDINARY_SMLT_ONLY_MODE
  • ADC_ORDINARY_SHORTSHIFT_ONLY_MODE
  • ADC_ORDINARY_LONGSHIFT_ONLY_MODE
  • ADC_PREEMPT_INTERLTRIG_ONLY_MODE note:these bits are reserved in adc2
Return values
none

Definition at line 96 of file at32f413_adc.c.

Referenced by adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), and adc_config().

◆ adc_combine_ordinary_conversion_data_get()

uint32_t adc_combine_ordinary_conversion_data_get ( void )

return the last conversion data for ordinary channel of combine adc(adc1 and adc2).

Return values
the last conversion data for ordinary channel.

Definition at line 716 of file at32f413_adc.c.

◆ adc_dma_mode_enable()

void adc_dma_mode_enable | ( | adc_type * | adc_x,
 |  | confirm_state | new_state )

enable or disable the adc dma transfer.

Parameters
adc_x | select the adc peripheral. this parameter can be one of the following values: ADC1. note:this bit is reserved in adc2
new_state | new state of the adc dma transfer. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 160 of file at32f413_adc.c.

Referenced by adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), and adc_config().

◆ adc_enable()

void adc_enable | ( | adc_type * | adc_x,
 |  | confirm_state | new_state )

enable or disable the specified adc peripheral.

Parameters
adc_x | select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
new_state | new state of a/d converter. this parameter can be: TRUE or FALSE. note:after adc ready,user set adcen bit will cause ordinary conversion
Return values
none

Definition at line 74 of file at32f413_adc.c.

Referenced by adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), and adc_config().

◆ adc_flag_clear()

void adc_flag_clear | ( | adc_type * | adc_x,
 |  | uint32_t | adc_flag )

clear flag of the specified adc peripheral.

Parameters
adc_x select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
adc_flag select the adc flag. this parameter can be any combination of the following values:
  • ADC_VMOR_FLAG
  • ADC_CCE_FLAG(also can clear by reading the adc_x->odt)
  • ADC_PCCE_FLAG
  • ADC_PCCS_FLAG
  • ADC_OCCS_FLAG
Return values
none

Definition at line 841 of file at32f413_adc.c.

Referenced by ADC1_2_IRQHandler().

◆ adc_flag_get()

flag_status adc_flag_get | ( | adc_type * | adc_x,
 |  | uint8_t | adc_flag )

get flag of the specified adc peripheral.

Parameters
adc_x select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
adc_flag select the adc flag. this parameter can be one of the following values:
  • ADC_VMOR_FLAG
  • ADC_CCE_FLAG
  • ADC_PCCE_FLAG
  • ADC_PCCS_FLAG(no interrupt associated)
  • ADC_OCCS_FLAG(no interrupt associated)
Return values
the new state of adc flag status(SET or RESET).

Definition at line 771 of file at32f413_adc.c.

◆ adc_interrupt_enable()

void adc_interrupt_enable | ( | adc_type * | adc_x,
 |  | uint32_t | adc_int,
 |  | confirm_state | new_state )

enable or disable the specified adc interrupts.

Parameters
adc_x | select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
adc_int specifies the adc interrupt sources to be enabled or disabled. this parameter can be one of the following values:
  • ADC_VMOR_INT
  • ADC_CCE_INT
  • ADC_PCCE_INT
new_state | new state of the specified adc interrupts. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 179 of file at32f413_adc.c.

Referenced by adc_config(), adc_config(), and adc_config().

◆ adc_interrupt_flag_get()

flag_status adc_interrupt_flag_get | ( | adc_type * | adc_x,
 |  | uint8_t | adc_flag )

get interrupt flag of the specified adc peripheral.

Parameters
adc_x select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
adc_flag select the adc flag. this parameter can be one of the following values:
  • ADC_VMOR_FLAG
  • ADC_CCE_FLAG
  • ADC_PCCE_FLAG
Return values
the new state of adc flag status(SET or RESET).

< voltage monitoring out of range flag

< channels conversion end flag

< preempt channels conversion end flag

Definition at line 798 of file at32f413_adc.c.

Referenced by ADC1_2_IRQHandler().

◆ adc_ordinary_channel_set()

void adc_ordinary_channel_set | ( | adc_type * | adc_x,
 |  | adc_channel_select_type | adc_channel,
 |  | uint8_t | adc_sequence,
 |  | adc_sampletime_select_type | adc_sampletime )

set ordinary channel's corresponding rank in the sequencer and sample time of the specified adc peripheral.

Parameters
adc_x select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
adc_channel select the channel. this parameter can be one of the following values:
  • ADC_CHANNEL_0 - ADC_CHANNEL_1 - ADC_CHANNEL_2 - ADC_CHANNEL_3
  • ADC_CHANNEL_4 - ADC_CHANNEL_5 - ADC_CHANNEL_6 - ADC_CHANNEL_7
  • ADC_CHANNEL_8 - ADC_CHANNEL_9 - ADC_CHANNEL_10 - ADC_CHANNEL_11
  • ADC_CHANNEL_12 - ADC_CHANNEL_13 - ADC_CHANNEL_14 - ADC_CHANNEL_15
  • ADC_CHANNEL_16 - ADC_CHANNEL_17
adc_sequence set rank in the ordinary group sequencer. this parameter must be:
  • between 1 to 16
adc_sampletime set the sampletime of adc channel. this parameter can be one of the following values:
  • ADC_SAMPLETIME_1_5
  • ADC_SAMPLETIME_7_5
  • ADC_SAMPLETIME_13_5
  • ADC_SAMPLETIME_28_5
  • ADC_SAMPLETIME_41_5
  • ADC_SAMPLETIME_55_5
  • ADC_SAMPLETIME_71_5
  • ADC_SAMPLETIME_239_5
Return values
none

Definition at line 342 of file at32f413_adc.c.

Referenced by adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), and adc_config().

◆ adc_ordinary_conversion_data_get()

uint16_t adc_ordinary_conversion_data_get ( adc_type * adc_x )

return the last conversion data for ordinary channel of the specified adc peripheral.

Parameters
adc_x select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
Return values
the last conversion data for ordinary channel.

Definition at line 707 of file at32f413_adc.c.

◆ adc_ordinary_conversion_trigger_set()

void adc_ordinary_conversion_trigger_set | ( | adc_type * | adc_x,
 |  | adc_ordinary_trig_select_type | adc_ordinary_trig,
 |  | confirm_state | new_state )

enable or disable the ordinary channel's external trigger and set external trigger event of the specified adc peripheral.

Parameters
adc_x | select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
adc_ordinary_trig select the external trigger event. this parameter can be one of the following values: adc1 & adc2
  • ADC12_ORDINARY_TRIG_TMR1CH1 - ADC12_ORDINARY_TRIG_TMR1CH2 - ADC12_ORDINARY_TRIG_TMR1CH3 - ADC12_ORDINARY_TRIG_TMR2CH2
  • ADC12_ORDINARY_TRIG_TMR3TRGOUT - ADC12_ORDINARY_TRIG_TMR4CH4 - ADC12_ORDINARY_TRIG_EXINT11_TMR8TRGOUT - ADC12_ORDINARY_TRIG_SOFTWARE
  • ADC12_ORDINARY_TRIG_TMR1TRGOUT - ADC12_ORDINARY_TRIG_TMR8CH1 - ADC12_ORDINARY_TRIG_TMR8CH2
new_state | new state of ordinary channel's external trigger. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 480 of file at32f413_adc.c.

Referenced by adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), and adc_config().

◆ adc_ordinary_part_count_set()

void adc_ordinary_part_count_set | ( | adc_type * | adc_x,
 |  | uint8_t | adc_channel_count )

set partitioned mode channel count of the specified adc peripheral.

Parameters
adc_x select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
adc_channel_count configure the adc partitioned mode channel count. this parameter can be:
  • (0x1~0x8)
Return values
none

Definition at line 574 of file at32f413_adc.c.

Referenced by adc_config().

◆ adc_ordinary_part_mode_enable()

void adc_ordinary_part_mode_enable | ( | adc_type * | adc_x,
 |  | confirm_state | new_state )

enable or disable the partitioned mode on ordinary channel of the specified adc peripheral.

Parameters
adc_x | select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
new_state | new state of ordinary channel's partitioned mode. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 589 of file at32f413_adc.c.

Referenced by adc_config().

◆ adc_ordinary_software_trigger_enable()

void adc_ordinary_software_trigger_enable | ( | adc_type * | adc_x,
 |  | confirm_state | new_state )

enable or disable ordinary software start conversion of the specified adc peripheral.

Parameters
adc_x | select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
new_state | new state of ordinary software start conversion. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 643 of file at32f413_adc.c.

Referenced by main().

◆ adc_ordinary_software_trigger_status_get()

flag_status adc_ordinary_software_trigger_status_get ( adc_type * adc_x )

get ordinary software start conversion status of the specified adc peripheral.

Parameters
adc_x select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
Return values
the new state of ordinary software start conversion status(SET or RESET).

Definition at line 655 of file at32f413_adc.c.

◆ adc_preempt_auto_mode_enable()

void adc_preempt_auto_mode_enable | ( | adc_type * | adc_x,
 |  | confirm_state | new_state )

enable or disable automatic preempt group conversion of the specified adc peripheral.

Parameters
adc_x | select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
new_state | new state of automatic preempt group conversion. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 617 of file at32f413_adc.c.

Referenced by adc_config().

◆ adc_preempt_channel_length_set()

void adc_preempt_channel_length_set | ( | adc_type * | adc_x,
 |  | uint8_t | adc_channel_lenght )

set preempt channel lenghth of the specified adc peripheral.

Parameters
adc_x select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
adc_channel_lenght set the adc preempt channel lenghth. this parameter can be:
  • (0x1~0x4)
Return values
none

Definition at line 393 of file at32f413_adc.c.

Referenced by adc_config(), and adc_config().

◆ adc_preempt_channel_set()

void adc_preempt_channel_set | ( | adc_type * | adc_x,
 |  | adc_channel_select_type | adc_channel,
 |  | uint8_t | adc_sequence,
 |  | adc_sampletime_select_type | adc_sampletime )

configure preempt channel's corresponding rank in the sequencer and sample time of the specified adc peripheral.

Parameters
adc_x select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
adc_channel select the channel. this parameter can be one of the following values:
  • ADC_CHANNEL_0 - ADC_CHANNEL_1 - ADC_CHANNEL_2 - ADC_CHANNEL_3
  • ADC_CHANNEL_4 - ADC_CHANNEL_5 - ADC_CHANNEL_6 - ADC_CHANNEL_7
  • ADC_CHANNEL_8 - ADC_CHANNEL_9 - ADC_CHANNEL_10 - ADC_CHANNEL_11
  • ADC_CHANNEL_12 - ADC_CHANNEL_13 - ADC_CHANNEL_14 - ADC_CHANNEL_15
  • ADC_CHANNEL_16 - ADC_CHANNEL_17
adc_sequence set rank in the preempt group sequencer. this parameter must be:
  • between 1 to 4
adc_sampletime config the sampletime of adc channel. this parameter can be one of the following values:
  • ADC_SAMPLETIME_1_5
  • ADC_SAMPLETIME_7_5
  • ADC_SAMPLETIME_13_5
  • ADC_SAMPLETIME_28_5
  • ADC_SAMPLETIME_41_5
  • ADC_SAMPLETIME_55_5
  • ADC_SAMPLETIME_71_5
  • ADC_SAMPLETIME_239_5
Return values
none

Definition at line 425 of file at32f413_adc.c.

Referenced by adc_config(), and adc_config().

◆ adc_preempt_conversion_data_get()

uint16_t adc_preempt_conversion_data_get | ( | adc_type * | adc_x,
 |  | adc_preempt_channel_type | adc_preempt_channel )

return the conversion data for selection preempt channel of the specified adc peripheral.

Parameters
adc_x select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
adc_preempt_channel select the preempt channel. this parameter can be one of the following values:
  • ADC_PREEMPT_CHANNEL_1
  • ADC_PREEMPT_CHANNEL_2
  • ADC_PREEMPT_CHANNEL_3
  • ADC_PREEMPT_CHANNEL_4
Return values
the conversion data for selection preempt channel.

Definition at line 734 of file at32f413_adc.c.

Referenced by ADC1_2_IRQHandler().

◆ adc_preempt_conversion_trigger_set()

void adc_preempt_conversion_trigger_set | ( | adc_type * | adc_x,
 |  | adc_preempt_trig_select_type | adc_preempt_trig,
 |  | confirm_state | new_state )

enable or disable the preempt channel's external trigger and set external trigger event of the specified adc peripheral.

Parameters
adc_x | select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
adc_preempt_trig select the external trigger event. this parameter can be one of the following values: adc1 & adc2
  • ADC12_PREEMPT_TRIG_TMR1TRGOUT - ADC12_PREEMPT_TRIG_TMR1CH4 - ADC12_PREEMPT_TRIG_TMR2TRGOUT - ADC12_PREEMPT_TRIG_TMR2CH1
  • ADC12_PREEMPT_TRIG_TMR3CH4 - ADC12_PREEMPT_TRIG_TMR4TRGOUT - ADC12_PREEMPT_TRIG_EXINT15_TMR8CH4 - ADC12_PREEMPT_TRIG_SOFTWARE
  • ADC12_PREEMPT_TRIG_TMR1CH1 - ADC12_PREEMPT_TRIG_TMR8CH1 - ADC12_PREEMPT_TRIG_TMR8TRGOUT
new_state | new state of preempt channel's external trigger. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 511 of file at32f413_adc.c.

Referenced by adc_config(), and adc_config().

◆ adc_preempt_offset_value_set()

void adc_preempt_offset_value_set | ( | adc_type * | adc_x,
 |  | adc_preempt_channel_type | adc_preempt_channel,
 |  | uint16_t | adc_offset_value )

set preempt channel's conversion value offset of the specified adc peripheral.

Parameters
adc_x select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
adc_preempt_channel select the preempt channel. this parameter can be one of the following values:
  • ADC_PREEMPT_CHANNEL_1
  • ADC_PREEMPT_CHANNEL_2
  • ADC_PREEMPT_CHANNEL_3
  • ADC_PREEMPT_CHANNEL_4
adc_offset_value set the adc preempt channel's conversion value offset. this parameter can be:
  • (0x000~0xFFF)
Return values
none

Definition at line 543 of file at32f413_adc.c.

◆ adc_preempt_part_mode_enable()

void adc_preempt_part_mode_enable | ( | adc_type * | adc_x,
 |  | confirm_state | new_state )

enable or disable the partitioned mode on preempt channel of the specified adc peripheral.

Parameters
adc_x | select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
new_state | new state of preempt channel's partitioned mode. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 603 of file at32f413_adc.c.

◆ adc_preempt_software_trigger_enable()

void adc_preempt_software_trigger_enable | ( | adc_type * | adc_x,
 |  | confirm_state | new_state )

enable or disable preempt software start conversion of the specified adc peripheral.

Parameters
adc_x | select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
new_state | new state of preempt software start conversion. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 676 of file at32f413_adc.c.

◆ adc_preempt_software_trigger_status_get()

flag_status adc_preempt_software_trigger_status_get ( adc_type * adc_x )

get preempt software start conversion status of the specified adc peripheral.

Parameters
adc_x select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
Return values
the new state of preempt software start conversion status(SET or RESET).

Definition at line 688 of file at32f413_adc.c.

◆ adc_reset()

void adc_reset ( adc_type * adc_x )

deinitialize the adc peripheral registers to their default reset values.

Parameters
adc_x select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
Return values
none

Definition at line 50 of file at32f413_adc.c.

Referenced by adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), and adc_config().

◆ adc_tempersensor_vintrv_enable()

void adc_tempersensor_vintrv_enable ( confirm_state new_state )

enable or disable the temperature sensor and vintrv channel.

Parameters
new_state new state of Internal temperature sensor and vintrv. this parameter can be: TRUE or FALSE. note:this bit is present only in adc1
Return values
none

Definition at line 629 of file at32f413_adc.c.

Referenced by adc_config(), and adc_config().

◆ adc_voltage_monitor_enable()

void adc_voltage_monitor_enable | ( | adc_type * | adc_x,
 |  | adc_voltage_monitoring_type | adc_voltage_monitoring )

enable or disable the voltage monitoring on single/all ordinary or preempt channels of the specified adc peripheral.

Parameters
adc_x select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
adc_voltage_monitoring choose the adc_voltage_monitoring config. this parameter can be one of the following values:
  • ADC_VMONITOR_SINGLE_ORDINARY
  • ADC_VMONITOR_SINGLE_PREEMPT
  • ADC_VMONITOR_SINGLE_ORDINARY_PREEMPT
  • ADC_VMONITOR_ALL_ORDINARY
  • ADC_VMONITOR_ALL_PREEMPT
  • ADC_VMONITOR_ALL_ORDINARY_PREEMPT
  • ADC_VMONITOR_NONE
Return values
none

Definition at line 269 of file at32f413_adc.c.

Referenced by adc_config().

◆ adc_voltage_monitor_single_channel_select()

void adc_voltage_monitor_single_channel_select | ( | adc_type * | adc_x,
 |  | adc_channel_select_type | adc_channel )

select the voltage monitoring's channel of the specified adc peripheral.

Parameters
adc_x select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
adc_channel select the channel. this parameter can be one of the following values:
  • ADC_CHANNEL_0 - ADC_CHANNEL_1 - ADC_CHANNEL_2 - ADC_CHANNEL_3
  • ADC_CHANNEL_4 - ADC_CHANNEL_5 - ADC_CHANNEL_6 - ADC_CHANNEL_7
  • ADC_CHANNEL_8 - ADC_CHANNEL_9 - ADC_CHANNEL_10 - ADC_CHANNEL_11
  • ADC_CHANNEL_12 - ADC_CHANNEL_13 - ADC_CHANNEL_14 - ADC_CHANNEL_15
  • ADC_CHANNEL_16 - ADC_CHANNEL_17
Return values
none

Definition at line 310 of file at32f413_adc.c.

Referenced by adc_config().

◆ adc_voltage_monitor_threshold_value_set()

void adc_voltage_monitor_threshold_value_set | ( | adc_type * | adc_x,
 |  | uint16_t | adc_high_threshold,
 |  | uint16_t | adc_low_threshold )

set voltage monitoring's high and low thresholds value of the specified adc peripheral.

Parameters
adc_x select the adc peripheral. this parameter can be one of the following values: ADC1, ADC2.
adc_high_threshold voltage monitoring's high thresholds value. this parameter can be:
  • (0x000~0xFFF)
adc_low_threshold voltage monitoring's low thresholds value. this parameter can be:
  • (0x000~0xFFF)
Return values
none

Definition at line 290 of file at32f413_adc.c.

Referenced by adc_config().


AT32F413 Firmwary Library: BPR

Topics | Macros
BPR
AT32F413_periph_driver

BPR driver modules. More...

Topics

BPR_flags_definition
bpr flag
BPR_exported_types
BPR_exported_functions
BPR_private_functions

Macros

#define BPR ((bpr_type *) BPR_BASE)

Detailed Description

BPR driver modules.

Macro Definition Documentation

◆ BPR

#define BPR ((bpr_type *) BPR_BASE)

Definition at line 753 of file at32f413_bpr.h.

Referenced by bpr_flag_clear(), bpr_flag_get(), bpr_interrupt_enable(), bpr_interrupt_flag_get(), bpr_rtc_clock_calibration_value_set(), bpr_rtc_output_select(), bpr_tamper_pin_active_level_set(), and bpr_tamper_pin_enable().


AT32F413 Firmwary Library: BPR_flags_definition

Macros
BPR_flags_definition
AT32F413_periph_driver » BPR

bpr flag More...

Macros

#define | BPR_TAMPER_INTERRUPT_FLAG ((uint32_t)0x00000001)
#define | BPR_TAMPER_EVENT_FLAG ((uint32_t)0x00000002)

Detailed Description

bpr flag

Macro Definition Documentation

◆ BPR_TAMPER_EVENT_FLAG

#define BPR_TAMPER_EVENT_FLAG ((uint32_t)0x00000002)

bpr tamper event flag

Definition at line 52 of file at32f413_bpr.h.

Referenced by main(), and TAMPER_IRQHandler().

◆ BPR_TAMPER_INTERRUPT_FLAG

#define BPR_TAMPER_INTERRUPT_FLAG ((uint32_t)0x00000001)

bpr tamper interrupt flag

Definition at line 51 of file at32f413_bpr.h.

Referenced by bpr_flag_clear(), bpr_flag_get(), bpr_interrupt_flag_get(), and TAMPER_IRQHandler().


AT32F413 Firmwary Library: BPR_exported_types

Data Structures | Enumerations
BPR_exported_types
AT32F413_periph_driver » BPR

Data Structures

struct bpr_type
type define bpr register all More...

Enumerations

enum bpr_data_type {
BPR_DATA1 = 0x04 , BPR_DATA2 = 0x08 , BPR_DATA3 = 0x0C , BPR_DATA4 = 0x10 ,
BPR_DATA5 = 0x14 , BPR_DATA6 = 0x18 , BPR_DATA7 = 0x1C , BPR_DATA8 = 0x20 ,
BPR_DATA9 = 0x24 , BPR_DATA10 = 0x28 , BPR_DATA11 = 0x40 , BPR_DATA12 = 0x44 ,
BPR_DATA13 = 0x48 , BPR_DATA14 = 0x4C , BPR_DATA15 = 0x50 , BPR_DATA16 = 0x54 ,
BPR_DATA17 = 0x58 , BPR_DATA18 = 0x5C , BPR_DATA19 = 0x60 , BPR_DATA20 = 0x64 ,
BPR_DATA21 = 0x68 , BPR_DATA22 = 0x6C , BPR_DATA23 = 0x70 , BPR_DATA24 = 0x74 ,
BPR_DATA25 = 0x78 , BPR_DATA26 = 0x7C , BPR_DATA27 = 0x80 , BPR_DATA28 = 0x84 ,
BPR_DATA29 = 0x88 , BPR_DATA30 = 0x8C , BPR_DATA31 = 0x90 , BPR_DATA32 = 0x94 ,
BPR_DATA33 = 0x98 , BPR_DATA34 = 0x9C , BPR_DATA35 = 0xA0 , BPR_DATA36 = 0xA4 ,
BPR_DATA37 = 0xA8 , BPR_DATA38 = 0xAC , BPR_DATA39 = 0xB0 , BPR_DATA40 = 0xB4 ,
BPR_DATA41 = 0xB8 , BPR_DATA42 = 0xBC
}
battery powered register data type More...
enum bpr_rtc_output_type {
BPR_RTC_OUTPUT_NONE = 0x000 , BPR_RTC_OUTPUT_CLOCK_CAL_BEFORE = 0x080 , BPR_RTC_OUTPUT_ALARM = 0x100 , BPR_RTC_OUTPUT_SECOND = 0x300 ,
BPR_RTC_OUTPUT_CLOCK_CAL_AFTER = 0x480
}
bpr rtc output type More...
enum bpr_tamper_pin_active_level_type { BPR_TAMPER_PIN_ACTIVE_HIGH = 0x00 , BPR_TAMPER_PIN_ACTIVE_LOW = 0x01 }
tamper pin active level type More...

Detailed Description

Enumeration Type Documentation

◆ bpr_data_type

enum bpr_data_type

battery powered register data type

Enumerator
BPR_DATA1 | bpr data register 1
BPR_DATA2 | bpr data register 2
BPR_DATA3 | bpr data register 3
BPR_DATA4 | bpr data register 4
BPR_DATA5 | bpr data register 5
BPR_DATA6 | bpr data register 6
BPR_DATA7 | bpr data register 7
BPR_DATA8 | bpr data register 8
BPR_DATA9 | bpr data register 9
BPR_DATA10 | bpr data register 10
BPR_DATA11 | bpr data register 11
BPR_DATA12 | bpr data register 12
BPR_DATA13 | bpr data register 13
BPR_DATA14 | bpr data register 14
BPR_DATA15 | bpr data register 15
BPR_DATA16 | bpr data register 16
BPR_DATA17 | bpr data register 17
BPR_DATA18 | bpr data register 18
BPR_DATA19 | bpr data register 19
BPR_DATA20 | bpr data register 20
BPR_DATA21 | bpr data register 21
BPR_DATA22 | bpr data register 22
BPR_DATA23 | bpr data register 23
BPR_DATA24 | bpr data register 24
BPR_DATA25 | bpr data register 25
BPR_DATA26 | bpr data register 26
BPR_DATA27 | bpr data register 27
BPR_DATA28 | bpr data register 28
BPR_DATA29 | bpr data register 29
BPR_DATA30 | bpr data register 30
BPR_DATA31 | bpr data register 31
BPR_DATA32 | bpr data register 32
BPR_DATA33 | bpr data register 33
BPR_DATA34 | bpr data register 34
BPR_DATA35 | bpr data register 35
BPR_DATA36 | bpr data register 36
BPR_DATA37 | bpr data register 37
BPR_DATA38 | bpr data register 38
BPR_DATA39 | bpr data register 39
BPR_DATA40 | bpr data register 40
BPR_DATA41 | bpr data register 41
BPR_DATA42 | bpr data register 42

Definition at line 65 of file at32f413_bpr.h.

◆ bpr_rtc_output_type

enum bpr_rtc_output_type

bpr rtc output type

Enumerator
BPR_RTC_OUTPUT_NONE | output disable
BPR_RTC_OUTPUT_CLOCK_CAL_BEFORE | output clock before calibration
BPR_RTC_OUTPUT_ALARM | output alarm event with pluse mode
BPR_RTC_OUTPUT_SECOND | output second event with pluse mode
BPR_RTC_OUTPUT_CLOCK_CAL_AFTER | output clock after calibration

Definition at line 114 of file at32f413_bpr.h.

◆ bpr_tamper_pin_active_level_type

enum bpr_tamper_pin_active_level_type

tamper pin active level type

Enumerator
BPR_TAMPER_PIN_ACTIVE_HIGH | tamper pin input active level is high
BPR_TAMPER_PIN_ACTIVE_LOW | tamper pin input active level is low

Definition at line 126 of file at32f413_bpr.h.


AT32F413 Firmwary Library: bpr_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
bpr_type Struct Reference
AT32F413_periph_driver » BPR » BPR_exported_types

type define bpr register all More...

#include <at32f413_bpr.h>

Data Fields

__IO uint32_t | reserved1
reserved, offset:0x00
union {
__IO uint32_t dt1
struct {
__IO uint32_t dt: 16
__IO uint32_t reserved1: 16
} dt1_bit
};
bpr dt1 register, offset:0x04
union {
__IO uint32_t dt2
struct {
__IO uint32_t dt: 16
__IO uint32_t reserved1: 16
} dt2_bit
};
bpr dt2 register, offset:0x08
union {
__IO uint32_t dt3
struct {
__IO uint32_t dt: 16
__IO uint32_t reserved1: 16
} dt3_bit
};
bpr dt3 register, offset:0x0C
union {
__IO uint32_t dt4
struct {
__IO uint32_t dt: 16
__IO uint32_t reserved1: 16
} dt4_bit
};
bpr dt4 register, offset:0x10
union {
__IO uint32_t dt5
struct {
__IO uint32_t dt: 16
__IO uint32_t reserved1: 16
} dt5_bit
};
bpr dt5 register, offset:0x14
union {
__IO uint32_t dt6
struct {
__IO uint32_t dt: 16
__IO uint32_t reserved1: 16
} dt6_bit
};
bpr dt6 register, offset:0x18
union {
__IO uint32_t dt7
struct {
__IO uint32_t dt: 16
__IO uint32_t reserved1: 16
} dt7_bit
};
bpr dt7 register, offset:0x1C
union {
__IO uint32_t dt8
struct {
__IO uint32_t dt: 16
__IO uint32_t reserved1: 16
} dt8_bit
};
bpr dt8 register, offset:0x20
union {
__IO uint32_t dt9
struct {
__IO uint32_t dt: 16
__IO uint32_t reserved1: 16
} dt9_bit
};
bpr dt9 register, offset:0x24
union {
__IO uint32_t dt10
struct {
__IO uint32_t dt: 16
__IO uint32_t reserved1: 16
} dt10_bit
};
bpr dt10 register, offset:0x28
union {
__IO uint32_t rtccal
struct {
__IO uint32_t calval: 7
__IO uint32_t calout: 1
__IO uint32_t outen: 1
__IO uint32_t outsel: 1
__IO uint32_t ccos: 1
__IO uint32_t outm: 1
__IO uint32_t reserved1: 20
} rtccal_bit
};
bpr rtccal register, offset:0x2C
union {
__IO uint32_t ctrl
struct {
__IO uint32_t tpen: 1
__IO uint32_t tpp: 1
__IO uint32_t reserved1: 30
} ctrl_bit
};
bpr ctrl register, offset:0x30
union {
__IO uint32_t ctrlsts
struct {
__IO uint32_t tpefclr: 1
__IO uint32_t tpifclr: 1
__IO uint32_t tpien: 1
__IO uint32_t reserved1: 5
__IO uint32_t tpef: 1
__IO uint32_t tpif: 1
__IO uint32_t reserved2: 22
} ctrlsts_bit
};
bpr ctrlsts register, offset:0x34
__IO uint32_t | reserved3
reserved, offset:0x3C
union {
__IO uint32_t dt11
struct {
__IO uint32_t dt: 16
__IO uint32_t reserved1: 16
} dt11_bit
};
bpr dt11 register, offset:0x40
union {
__IO uint32_t dt12
struct {
__IO uint32_t dt: 16
__IO uint32_t reserved1: 16
} dt12_bit
};
bpr dt12 register, offset:0x44
union {
__IO uint32_t dt13
struct {
__IO uint32_t dt: 16
__IO uint32_t reserved1: 16
} dt13_bit
};
bpr dt13 register, offset:0x48
union {
__IO uint32_t dt14
struct {
__IO uint32_t dt: 16
__IO uint32_t reserved1: 16
} dt14_bit
};
bpr dt14 register, offset:0x4C
union {
__IO uint32_t dt15
struct {
__IO uint32_t dt: 16
__IO uint32_t reserved1: 16
} dt15_bit
};
bpr dt15 register, offset:0x50
union {
__IO uint32_t dt16
struct {
__IO uint32_t dt: 16
__IO uint32_t reserved1: 16
} dt16_bit
};
bpr dt16 register, offset:0x54
union {
__IO uint32_t dt17
struct {
__IO uint32_t dt: 16
__IO uint32_t reserved1: 16
} dt17_bit
};
bpr dt17 register, offset:0x58
union {
__IO uint32_t dt18
struct {
__IO uint32_t dt: 16
__IO uint32_t reserved1: 16
} dt18_bit
};
bpr dt18 register, offset:0x5C
union {
__IO uint32_t dt19
struct {
__IO uint32_t dt: 16
__IO uint32_t reserved1: 16
} dt19_bit
};
bpr dt19 register, offset:0x60
union {
__IO uint32_t dt20
struct {
__IO uint32_t dt: 16
__IO uint32_t reserved1: 16
} dt20_bit
};
bpr dt20 register, offset:0x64
union {
__IO uint32_t dt21
struct {
__IO uint32_t dt: 16
__IO uint32_t reserved1: 16
} dt21_bit
};
bpr dt21 register, offset:0x68
union {
__IO uint32_t dt22
struct {
__IO uint32_t dt: 16
__IO uint32_t reserved1: 16
} dt22_bit
};
bpr dt22 register, offset:6C
union {
__IO uint32_t dt23
struct {
__IO uint32_t dt: 16
__IO uint32_t reserved1: 16
} dt23_bit
};
bpr dt23 register, offset:0x70
union {
__IO uint32_t dt24
struct {
__IO uint32_t dt: 16
__IO uint32_t reserved1: 16
} dt24_bit
};
bpr dt24 register, offset:0x74
union {
__IO uint32_t dt25
struct {
__IO uint32_t dt: 16
__IO uint32_t reserved1: 16
} dt25_bit
};
bpr dt25 register, offset:0x78
union {
__IO uint32_t dt26
struct {
__IO uint32_t dt: 16
__IO uint32_t reserved1: 16
} dt26_bit
};
bpr dt26 register, offset:0x7C
union {
__IO uint32_t dt27
struct {
__IO uint32_t dt: 16
__IO uint32_t reserved1: 16
} dt27_bit
};
bpr dt27 register, offset:0x80
union {
__IO uint32_t dt28
struct {
__IO uint32_t dt: 16
__IO uint32_t reserved1: 16
} dt28_bit
};
bpr dt28 register, offset:0x84
union {
__IO uint32_t dt29
struct {
__IO uint32_t dt: 16
__IO uint32_t reserved1: 16
} dt29_bit
};
bpr dt29 register, offset:0x88
union {
__IO uint32_t dt30
struct {
__IO uint32_t dt: 16
__IO uint32_t reserved1: 16
} dt30_bit
};
bpr dt30 register, offset:0x8C
union {
__IO uint32_t dt31
struct {
__IO uint32_t dt: 16
__IO uint32_t reserved1: 16
} dt31_bit
};
bpr dt31 register, offset:0x90
union {
__IO uint32_t dt32
struct {
__IO uint32_t dt: 16
__IO uint32_t reserved1: 16
} dt32_bit
};
bpr dt32 register, offset:0x94
union {
__IO uint32_t dt33
struct {
__IO uint32_t dt: 16
__IO uint32_t reserved1: 16
} dt33_bit
};
bpr dt33 register, offset:0x98
union {
__IO uint32_t dt34
struct {
__IO uint32_t dt: 16
__IO uint32_t reserved1: 16
} dt34_bit
};
bpr dt34 register, offset:0x9C
union {
__IO uint32_t dt35
struct {
__IO uint32_t dt: 16
__IO uint32_t reserved1: 16
} dt35_bit
};
bpr dt35 register, offset:0xA0
union {
__IO uint32_t dt36
struct {
__IO uint32_t dt: 16
__IO uint32_t reserved1: 16
} dt36_bit
};
bpr dt36 register, offset:0xA4
union {
__IO uint32_t dt37
struct {
__IO uint32_t dt: 16
__IO uint32_t reserved1: 16
} dt37_bit
};
bpr dt37 register, offset:0xA8
union {
__IO uint32_t dt38
struct {
__IO uint32_t dt: 16
__IO uint32_t reserved1: 16
} dt38_bit
};
bpr dt38 register, offset:0xAC
union {
__IO uint32_t dt39
struct {
__IO uint32_t dt: 16
__IO uint32_t reserved1: 16
} dt39_bit
};
bpr dt39 register, offset:0xB0
union {
__IO uint32_t dt40
struct {
__IO uint32_t dt: 16
__IO uint32_t reserved1: 16
} dt40_bit
};
bpr dt40 register, offset:0xB4
union {
__IO uint32_t dt41
struct {
__IO uint32_t dt: 16
__IO uint32_t reserved1: 16
} dt41_bit
};
bpr dt41 register, offset:0xB8
union {
__IO uint32_t dt42
struct {
__IO uint32_t dt: 16
__IO uint32_t reserved1: 16
} dt42_bit
};
bpr dt42 register, offset:0xBC

Detailed Description

type define bpr register all

Definition at line 135 of file at32f413_bpr.h.

Field Documentation

◆ [union]

union { ... } bpr_type

bpr ctrl register, offset:0x30

◆ [union]

union { ... } bpr_type

bpr ctrlsts register, offset:0x34

◆ [union]

union { ... } bpr_type

bpr dt11 register, offset:0x40

◆ [union]

union { ... } bpr_type

bpr dt12 register, offset:0x44

◆ [union]

union { ... } bpr_type

bpr dt13 register, offset:0x48

◆ [union]

union { ... } bpr_type

bpr dt14 register, offset:0x4C

◆ [union]

union { ... } bpr_type

bpr dt15 register, offset:0x50

◆ [union]

union { ... } bpr_type

bpr dt16 register, offset:0x54

◆ [union]

union { ... } bpr_type

bpr dt17 register, offset:0x58

◆ [union]

union { ... } bpr_type

bpr dt18 register, offset:0x5C

◆ [union]

union { ... } bpr_type

bpr dt19 register, offset:0x60

◆ [union]

union { ... } bpr_type

bpr dt20 register, offset:0x64

◆ [union]

union { ... } bpr_type

bpr dt21 register, offset:0x68

◆ [union]

union { ... } bpr_type

bpr dt22 register, offset:6C

◆ [union]

union { ... } bpr_type

bpr dt23 register, offset:0x70

◆ [union]

union { ... } bpr_type

bpr dt24 register, offset:0x74

◆ [union]

union { ... } bpr_type

bpr dt25 register, offset:0x78

◆ [union]

union { ... } bpr_type

bpr dt26 register, offset:0x7C

◆ [union]

union { ... } bpr_type

bpr dt27 register, offset:0x80

◆ [union]

union { ... } bpr_type

bpr dt28 register, offset:0x84

◆ [union]

union { ... } bpr_type

bpr dt29 register, offset:0x88

◆ [union]

union { ... } bpr_type

bpr dt30 register, offset:0x8C

◆ [union]

union { ... } bpr_type

bpr dt31 register, offset:0x90

◆ [union]

union { ... } bpr_type

bpr dt32 register, offset:0x94

◆ [union]

union { ... } bpr_type

bpr dt33 register, offset:0x98

◆ [union]

union { ... } bpr_type

bpr dt34 register, offset:0x9C

◆ [union]

union { ... } bpr_type

bpr dt35 register, offset:0xA0

◆ [union]

union { ... } bpr_type

bpr dt36 register, offset:0xA4

◆ [union]

union { ... } bpr_type

bpr dt37 register, offset:0xA8

◆ [union]

union { ... } bpr_type

bpr dt38 register, offset:0xAC

◆ [union]

union { ... } bpr_type

bpr dt39 register, offset:0xB0

◆ [union]

union { ... } bpr_type

bpr dt40 register, offset:0xB4

◆ [union]

union { ... } bpr_type

bpr dt41 register, offset:0xB8

◆ [union]

union { ... } bpr_type

bpr dt42 register, offset:0xBC

◆ [union]

union { ... } bpr_type

bpr dt1 register, offset:0x04

◆ [union]

union { ... } bpr_type

bpr dt2 register, offset:0x08

◆ [union]

union { ... } bpr_type

bpr dt3 register, offset:0x0C

◆ [union]

union { ... } bpr_type

bpr dt4 register, offset:0x10

◆ [union]

union { ... } bpr_type

bpr dt5 register, offset:0x14

◆ [union]

union { ... } bpr_type

bpr dt6 register, offset:0x18

◆ [union]

union { ... } bpr_type

bpr dt7 register, offset:0x1C

◆ [union]

union { ... } bpr_type

bpr dt8 register, offset:0x20

◆ [union]

union { ... } bpr_type

bpr dt9 register, offset:0x24

◆ [union]

union { ... } bpr_type

bpr dt10 register, offset:0x28

◆ [union]

union { ... } bpr_type

bpr rtccal register, offset:0x2C

◆ calout

__IO uint32_t bpr_type::calout

Definition at line 281 of file at32f413_bpr.h.

◆ calval

__IO uint32_t bpr_type::calval

Definition at line 280 of file at32f413_bpr.h.

◆ ccos

__IO uint32_t bpr_type::ccos

Definition at line 284 of file at32f413_bpr.h.

◆ ctrl

__IO uint32_t bpr_type::ctrl

Definition at line 295 of file at32f413_bpr.h.

◆ [struct]

struct { ... } bpr_type::ctrl_bit

◆ ctrlsts

__IO uint32_t bpr_type::ctrlsts

Definition at line 309 of file at32f413_bpr.h.

◆ [struct]

struct { ... } bpr_type::ctrlsts_bit

◆ dt

__IO uint32_t bpr_type::dt

Definition at line 150 of file at32f413_bpr.h.

◆ dt1

__IO uint32_t bpr_type::dt1

Definition at line 147 of file at32f413_bpr.h.

◆ dt10

__IO uint32_t bpr_type::dt10

Definition at line 264 of file at32f413_bpr.h.

◆ [struct]

struct { ... } bpr_type::dt10_bit

◆ dt11

__IO uint32_t bpr_type::dt11

Definition at line 337 of file at32f413_bpr.h.

◆ [struct]

struct { ... } bpr_type::dt11_bit

◆ dt12

__IO uint32_t bpr_type::dt12

Definition at line 350 of file at32f413_bpr.h.

◆ [struct]

struct { ... } bpr_type::dt12_bit

◆ dt13

__IO uint32_t bpr_type::dt13

Definition at line 363 of file at32f413_bpr.h.

◆ [struct]

struct { ... } bpr_type::dt13_bit

◆ dt14

__IO uint32_t bpr_type::dt14

Definition at line 376 of file at32f413_bpr.h.

◆ [struct]

struct { ... } bpr_type::dt14_bit

◆ dt15

__IO uint32_t bpr_type::dt15

Definition at line 389 of file at32f413_bpr.h.

◆ [struct]

struct { ... } bpr_type::dt15_bit

◆ dt16

__IO uint32_t bpr_type::dt16

Definition at line 402 of file at32f413_bpr.h.

◆ [struct]

struct { ... } bpr_type::dt16_bit

◆ dt17

__IO uint32_t bpr_type::dt17

Definition at line 415 of file at32f413_bpr.h.

◆ [struct]

struct { ... } bpr_type::dt17_bit

◆ dt18

__IO uint32_t bpr_type::dt18

Definition at line 428 of file at32f413_bpr.h.

◆ [struct]

struct { ... } bpr_type::dt18_bit

◆ dt19

__IO uint32_t bpr_type::dt19

Definition at line 441 of file at32f413_bpr.h.

◆ [struct]

struct { ... } bpr_type::dt19_bit

◆ [struct]

struct { ... } bpr_type::dt1_bit

◆ dt2

__IO uint32_t bpr_type::dt2

Definition at line 160 of file at32f413_bpr.h.

◆ dt20

__IO uint32_t bpr_type::dt20

Definition at line 454 of file at32f413_bpr.h.

◆ [struct]

struct { ... } bpr_type::dt20_bit

◆ dt21

__IO uint32_t bpr_type::dt21

Definition at line 467 of file at32f413_bpr.h.

◆ [struct]

struct { ... } bpr_type::dt21_bit

◆ dt22

__IO uint32_t bpr_type::dt22

Definition at line 480 of file at32f413_bpr.h.

◆ [struct]

struct { ... } bpr_type::dt22_bit

◆ dt23

__IO uint32_t bpr_type::dt23

Definition at line 493 of file at32f413_bpr.h.

◆ [struct]

struct { ... } bpr_type::dt23_bit

◆ dt24

__IO uint32_t bpr_type::dt24

Definition at line 506 of file at32f413_bpr.h.

◆ [struct]

struct { ... } bpr_type::dt24_bit

◆ dt25

__IO uint32_t bpr_type::dt25

Definition at line 519 of file at32f413_bpr.h.

◆ [struct]

struct { ... } bpr_type::dt25_bit

◆ dt26

__IO uint32_t bpr_type::dt26

Definition at line 532 of file at32f413_bpr.h.

◆ [struct]

struct { ... } bpr_type::dt26_bit

◆ dt27

__IO uint32_t bpr_type::dt27

Definition at line 545 of file at32f413_bpr.h.

◆ [struct]

struct { ... } bpr_type::dt27_bit

◆ dt28

__IO uint32_t bpr_type::dt28

Definition at line 558 of file at32f413_bpr.h.

◆ [struct]

struct { ... } bpr_type::dt28_bit

◆ dt29

__IO uint32_t bpr_type::dt29

Definition at line 571 of file at32f413_bpr.h.

◆ [struct]

struct { ... } bpr_type::dt29_bit

◆ [struct]

struct { ... } bpr_type::dt2_bit

◆ dt3

__IO uint32_t bpr_type::dt3

Definition at line 173 of file at32f413_bpr.h.

◆ dt30

__IO uint32_t bpr_type::dt30

Definition at line 584 of file at32f413_bpr.h.

◆ [struct]

struct { ... } bpr_type::dt30_bit

◆ dt31

__IO uint32_t bpr_type::dt31

Definition at line 597 of file at32f413_bpr.h.

◆ [struct]

struct { ... } bpr_type::dt31_bit

◆ dt32

__IO uint32_t bpr_type::dt32

Definition at line 610 of file at32f413_bpr.h.

◆ [struct]

struct { ... } bpr_type::dt32_bit

◆ dt33

__IO uint32_t bpr_type::dt33

Definition at line 623 of file at32f413_bpr.h.

◆ [struct]

struct { ... } bpr_type::dt33_bit

◆ dt34

__IO uint32_t bpr_type::dt34

Definition at line 636 of file at32f413_bpr.h.

◆ [struct]

struct { ... } bpr_type::dt34_bit

◆ dt35

__IO uint32_t bpr_type::dt35

Definition at line 649 of file at32f413_bpr.h.

◆ [struct]

struct { ... } bpr_type::dt35_bit

◆ dt36

__IO uint32_t bpr_type::dt36

Definition at line 662 of file at32f413_bpr.h.

◆ [struct]

struct { ... } bpr_type::dt36_bit

◆ dt37

__IO uint32_t bpr_type::dt37

Definition at line 675 of file at32f413_bpr.h.

◆ [struct]

struct { ... } bpr_type::dt37_bit

◆ dt38

__IO uint32_t bpr_type::dt38

Definition at line 688 of file at32f413_bpr.h.

◆ [struct]

struct { ... } bpr_type::dt38_bit

◆ dt39

__IO uint32_t bpr_type::dt39

Definition at line 701 of file at32f413_bpr.h.

◆ [struct]

struct { ... } bpr_type::dt39_bit

◆ [struct]

struct { ... } bpr_type::dt3_bit

◆ dt4

__IO uint32_t bpr_type::dt4

Definition at line 186 of file at32f413_bpr.h.

◆ dt40

__IO uint32_t bpr_type::dt40

Definition at line 714 of file at32f413_bpr.h.

◆ [struct]

struct { ... } bpr_type::dt40_bit

◆ dt41

__IO uint32_t bpr_type::dt41

Definition at line 727 of file at32f413_bpr.h.

◆ [struct]

struct { ... } bpr_type::dt41_bit

◆ dt42

__IO uint32_t bpr_type::dt42

Definition at line 740 of file at32f413_bpr.h.

◆ [struct]

struct { ... } bpr_type::dt42_bit

◆ [struct]

struct { ... } bpr_type::dt4_bit

◆ dt5

__IO uint32_t bpr_type::dt5

Definition at line 199 of file at32f413_bpr.h.

◆ [struct]

struct { ... } bpr_type::dt5_bit

◆ dt6

__IO uint32_t bpr_type::dt6

Definition at line 212 of file at32f413_bpr.h.

◆ [struct]

struct { ... } bpr_type::dt6_bit

◆ dt7

__IO uint32_t bpr_type::dt7

Definition at line 225 of file at32f413_bpr.h.

◆ [struct]

struct { ... } bpr_type::dt7_bit

◆ dt8

__IO uint32_t bpr_type::dt8

Definition at line 238 of file at32f413_bpr.h.

◆ [struct]

struct { ... } bpr_type::dt8_bit

◆ dt9

__IO uint32_t bpr_type::dt9

Definition at line 251 of file at32f413_bpr.h.

◆ [struct]

struct { ... } bpr_type::dt9_bit

◆ outen

__IO uint32_t bpr_type::outen

Definition at line 282 of file at32f413_bpr.h.

◆ outm

__IO uint32_t bpr_type::outm

Definition at line 285 of file at32f413_bpr.h.

◆ outsel

__IO uint32_t bpr_type::outsel

Definition at line 283 of file at32f413_bpr.h.

◆ reserved1

__IO uint32_t bpr_type::reserved1

reserved, offset:0x00

Definition at line 140 of file at32f413_bpr.h.

◆ reserved2

__IO uint32_t bpr_type::reserved2

reserved, offset:0x38

Definition at line 318 of file at32f413_bpr.h.

◆ reserved3

__IO uint32_t bpr_type::reserved3

reserved, offset:0x3C

Definition at line 330 of file at32f413_bpr.h.

◆ rtccal

__IO uint32_t bpr_type::rtccal

Definition at line 277 of file at32f413_bpr.h.

◆ [struct]

struct { ... } bpr_type::rtccal_bit

◆ tpef

__IO uint32_t bpr_type::tpef

Definition at line 316 of file at32f413_bpr.h.

◆ tpefclr

__IO uint32_t bpr_type::tpefclr

Definition at line 312 of file at32f413_bpr.h.

◆ tpen

__IO uint32_t bpr_type::tpen

Definition at line 298 of file at32f413_bpr.h.

◆ tpien

__IO uint32_t bpr_type::tpien

Definition at line 314 of file at32f413_bpr.h.

◆ tpif

__IO uint32_t bpr_type::tpif

Definition at line 317 of file at32f413_bpr.h.

◆ tpifclr

__IO uint32_t bpr_type::tpifclr

Definition at line 313 of file at32f413_bpr.h.

◆ tpp

__IO uint32_t bpr_type::tpp

Definition at line 299 of file at32f413_bpr.h.

The documentation for this struct was generated from the following file:
  • at32f413_bpr.h


AT32F413 Firmwary Library: BPR_exported_functions

Functions
BPR_exported_functions
AT32F413_periph_driver » BPR

Functions

void | bpr_reset (void)
bpr reset by crm reset register
flag_status | bpr_flag_get (uint32_t flag)
bpr event flag get, for tamper event flag
flag_status | bpr_interrupt_flag_get (uint32_t flag)
bpr interrupt flag get
void | bpr_flag_clear (uint32_t flag)
clear bpr tamper flag
void | bpr_interrupt_enable (confirm_state new_state)
enable or disable bpr tamper interrupt
uint16_t | bpr_data_read (bpr_data_type bpr_data)
read bpr bpr data
void | bpr_data_write (bpr_data_type bpr_data, uint16_t data_value)
write bpr data
void | bpr_rtc_output_select (bpr_rtc_output_type output_source)
select bpr rtc output
void | bpr_rtc_clock_calibration_value_set (uint8_t calibration_value)
set rtc clock calibration value
void | bpr_tamper_pin_enable (confirm_state new_state)
enable or disable bpr tamper pin
void | bpr_tamper_pin_active_level_set (bpr_tamper_pin_active_level_type active_level)
set bpr tamper pin active level

Detailed Description

Function Documentation

◆ bpr_data_read()

uint16_t bpr_data_read ( bpr_data_type bpr_data )

read bpr bpr data

Parameters
bpr_data this parameter can be one of the following values:
  • BPR_DATA1
  • BPR_DATA2 ...
  • BPR_DATA41
  • BPR_DATA42
Return values
none

Definition at line 135 of file at32f413_bpr.c.

Referenced by bpr_reg_check(), bpr_reg_judge(), and rtc_init().

◆ bpr_data_write()

void bpr_data_write | ( | bpr_data_type | bpr_data,
 |  | uint16_t | data_value )

write bpr data

Parameters
bpr_data this parameter can be one of the following values:
  • BPR_DATA1
  • BPR_DATA2 ...
  • BPR_DATA41
  • BPR_DATA42
data_value (0x0000~0xFFFF)
Return values
none

Definition at line 152 of file at32f413_bpr.c.

Referenced by bpr_reg_write(), and rtc_init().

◆ bpr_flag_clear()

void bpr_flag_clear ( uint32_t flag )

clear bpr tamper flag

Parameters
flag specifies the flag to clear. this parameter can be one of the following values:
  • BPR_TAMPER_INTERRUPT_FLAG: tamper interrupt flag
  • BPR_TAMPER_EVENT_FLAG: tamper event flag
Return values
none

< bpr tamper interrupt flag

Definition at line 102 of file at32f413_bpr.c.

Referenced by main(), and TAMPER_IRQHandler().

◆ bpr_flag_get()

flag_status bpr_flag_get ( uint32_t flag )

bpr event flag get, for tamper event flag

Parameters
flag specifies the flag to check. this parameter can be one of the following values:
  • BPR_TAMPER_INTERRUPT_FLAG: tamper interrupt flag
  • BPR_TAMPER_EVENT_FLAG: tamper event flag
Return values
state of tamper event flag

< bpr tamper interrupt flag

Definition at line 62 of file at32f413_bpr.c.

◆ bpr_interrupt_enable()

void bpr_interrupt_enable ( confirm_state new_state )

enable or disable bpr tamper interrupt

Parameters
new_state (TRUE or FALSE)
Return values
none

Definition at line 119 of file at32f413_bpr.c.

Referenced by main().

◆ bpr_interrupt_flag_get()

flag_status bpr_interrupt_flag_get ( uint32_t flag )

bpr interrupt flag get

Parameters
flag specifies the flag to check. this parameter can be one of the following values:
  • BPR_TAMPER_INTERRUPT_FLAG: tamper interrupt flag
  • BPR_TAMPER_EVENT_FLAG: tamper event flag
Return values
state of tamper event flag

< bpr tamper interrupt flag

Definition at line 82 of file at32f413_bpr.c.

Referenced by TAMPER_IRQHandler().

◆ bpr_reset()

void bpr_reset ( void )

bpr reset by crm reset register

Parameters
none
Return values
none

Definition at line 48 of file at32f413_bpr.c.

Referenced by main(), rtc_config(), rtc_configuration(), and rtc_init().

◆ bpr_rtc_clock_calibration_value_set()

void bpr_rtc_clock_calibration_value_set ( uint8_t calibration_value )

set rtc clock calibration value

Parameters
calibration_value (0x00~0x7f)
Return values
none

Definition at line 182 of file at32f413_bpr.c.

◆ bpr_rtc_output_select()

void bpr_rtc_output_select ( bpr_rtc_output_type output_source )

select bpr rtc output

Parameters
output_source this parameter can be one of the following values:
  • BPR_RTC_OUTPUT_NONE: output disable.
  • BPR_RTC_OUTPUT_CLOCK_CAL_BEFORE: output clock before calibration.
  • BPR_RTC_OUTPUT_ALARM: output alarm event with pluse mode.
  • BPR_RTC_OUTPUT_SECOND: output second event with pluse mode.
  • BPR_RTC_OUTPUT_CLOCK_CAL_AFTER: output clock after calibration.
Return values
none

Definition at line 168 of file at32f413_bpr.c.

Referenced by rtc_configuration().

◆ bpr_tamper_pin_active_level_set()

void bpr_tamper_pin_active_level_set ( bpr_tamper_pin_active_level_type active_level )

set bpr tamper pin active level

Parameters
active_level this parameter can be one of the following values:
  • BPR_TAMPER_PIN_ACTIVE_HIGH: tamper pin input active level is high.
  • BPR_TAMPER_PIN_ACTIVE_LOW: tamper pin input active level is low.
Return values
none

Definition at line 206 of file at32f413_bpr.c.

Referenced by main().

◆ bpr_tamper_pin_enable()

void bpr_tamper_pin_enable ( confirm_state new_state )

enable or disable bpr tamper pin

Parameters
new_state (TRUE or FALSE)
Return values
none

Definition at line 193 of file at32f413_bpr.c.

Referenced by main(), rtc_configuration(), and TAMPER_IRQHandler().


AT32F413 Firmwary Library: BPR_private_functions

Functions
BPR_private_functions
AT32F413_periph_driver » BPR

Functions

void | bpr_reset (void)
bpr reset by crm reset register
flag_status | bpr_flag_get (uint32_t flag)
bpr event flag get, for tamper event flag
flag_status | bpr_interrupt_flag_get (uint32_t flag)
bpr interrupt flag get
void | bpr_flag_clear (uint32_t flag)
clear bpr tamper flag
void | bpr_interrupt_enable (confirm_state new_state)
enable or disable bpr tamper interrupt
uint16_t | bpr_data_read (bpr_data_type bpr_data)
read bpr bpr data
void | bpr_data_write (bpr_data_type bpr_data, uint16_t data_value)
write bpr data
void | bpr_rtc_output_select (bpr_rtc_output_type output_source)
select bpr rtc output
void | bpr_rtc_clock_calibration_value_set (uint8_t calibration_value)
set rtc clock calibration value
void | bpr_tamper_pin_enable (confirm_state new_state)
enable or disable bpr tamper pin
void | bpr_tamper_pin_active_level_set (bpr_tamper_pin_active_level_type active_level)
set bpr tamper pin active level

Detailed Description

Function Documentation

◆ bpr_data_read()

uint16_t bpr_data_read ( bpr_data_type bpr_data )

read bpr bpr data

Parameters
bpr_data this parameter can be one of the following values:
  • BPR_DATA1
  • BPR_DATA2 ...
  • BPR_DATA41
  • BPR_DATA42
Return values
none

Definition at line 135 of file at32f413_bpr.c.

Referenced by bpr_reg_check(), bpr_reg_judge(), and rtc_init().

◆ bpr_data_write()

void bpr_data_write | ( | bpr_data_type | bpr_data,
 |  | uint16_t | data_value )

write bpr data

Parameters
bpr_data this parameter can be one of the following values:
  • BPR_DATA1
  • BPR_DATA2 ...
  • BPR_DATA41
  • BPR_DATA42
data_value (0x0000~0xFFFF)
Return values
none

Definition at line 152 of file at32f413_bpr.c.

Referenced by bpr_reg_write(), and rtc_init().

◆ bpr_flag_clear()

void bpr_flag_clear ( uint32_t flag )

clear bpr tamper flag

Parameters
flag specifies the flag to clear. this parameter can be one of the following values:
  • BPR_TAMPER_INTERRUPT_FLAG: tamper interrupt flag
  • BPR_TAMPER_EVENT_FLAG: tamper event flag
Return values
none

< bpr tamper interrupt flag

Definition at line 102 of file at32f413_bpr.c.

Referenced by main(), and TAMPER_IRQHandler().

◆ bpr_flag_get()

flag_status bpr_flag_get ( uint32_t flag )

bpr event flag get, for tamper event flag

Parameters
flag specifies the flag to check. this parameter can be one of the following values:
  • BPR_TAMPER_INTERRUPT_FLAG: tamper interrupt flag
  • BPR_TAMPER_EVENT_FLAG: tamper event flag
Return values
state of tamper event flag

< bpr tamper interrupt flag

Definition at line 62 of file at32f413_bpr.c.

◆ bpr_interrupt_enable()

void bpr_interrupt_enable ( confirm_state new_state )

enable or disable bpr tamper interrupt

Parameters
new_state (TRUE or FALSE)
Return values
none

Definition at line 119 of file at32f413_bpr.c.

Referenced by main().

◆ bpr_interrupt_flag_get()

flag_status bpr_interrupt_flag_get ( uint32_t flag )

bpr interrupt flag get

Parameters
flag specifies the flag to check. this parameter can be one of the following values:
  • BPR_TAMPER_INTERRUPT_FLAG: tamper interrupt flag
  • BPR_TAMPER_EVENT_FLAG: tamper event flag
Return values
state of tamper event flag

< bpr tamper interrupt flag

Definition at line 82 of file at32f413_bpr.c.

Referenced by TAMPER_IRQHandler().

◆ bpr_reset()

void bpr_reset ( void )

bpr reset by crm reset register

Parameters
none
Return values
none

Definition at line 48 of file at32f413_bpr.c.

Referenced by main(), rtc_config(), rtc_configuration(), and rtc_init().

◆ bpr_rtc_clock_calibration_value_set()

void bpr_rtc_clock_calibration_value_set ( uint8_t calibration_value )

set rtc clock calibration value

Parameters
calibration_value (0x00~0x7f)
Return values
none

Definition at line 182 of file at32f413_bpr.c.

◆ bpr_rtc_output_select()

void bpr_rtc_output_select ( bpr_rtc_output_type output_source )

select bpr rtc output

Parameters
output_source this parameter can be one of the following values:
  • BPR_RTC_OUTPUT_NONE: output disable.
  • BPR_RTC_OUTPUT_CLOCK_CAL_BEFORE: output clock before calibration.
  • BPR_RTC_OUTPUT_ALARM: output alarm event with pluse mode.
  • BPR_RTC_OUTPUT_SECOND: output second event with pluse mode.
  • BPR_RTC_OUTPUT_CLOCK_CAL_AFTER: output clock after calibration.
Return values
none

Definition at line 168 of file at32f413_bpr.c.

Referenced by rtc_configuration().

◆ bpr_tamper_pin_active_level_set()

void bpr_tamper_pin_active_level_set ( bpr_tamper_pin_active_level_type active_level )

set bpr tamper pin active level

Parameters
active_level this parameter can be one of the following values:
  • BPR_TAMPER_PIN_ACTIVE_HIGH: tamper pin input active level is high.
  • BPR_TAMPER_PIN_ACTIVE_LOW: tamper pin input active level is low.
Return values
none

Definition at line 206 of file at32f413_bpr.c.

Referenced by main().

◆ bpr_tamper_pin_enable()

void bpr_tamper_pin_enable ( confirm_state new_state )

enable or disable bpr tamper pin

Parameters
new_state (TRUE or FALSE)
Return values
none

Definition at line 193 of file at32f413_bpr.c.

Referenced by main(), rtc_configuration(), and TAMPER_IRQHandler().


AT32F413 Firmwary Library: CAN

Topics | Macros
CAN
AT32F413_periph_driver

CAN driver modules. More...

Topics

CAN_timeout_count
CAN_flags_definition
can flag
CAN_interrupts_definition
can interrupt
CAN_exported_types
CAN_exported_functions
CAN_private_functions

Macros

#define | CAN_MSTS_EOIF_VAL ((uint32_t)0x00000004)
can flag clear operation macro definition val
#define | CAN_MSTS_QDZIF_VAL ((uint32_t)0x00000008)
#define | CAN_MSTS_EDZIF_VAL ((uint32_t)0x00000010)
#define | CAN_TSTS_TM0TCF_VAL ((uint32_t)0x00000001)
#define | CAN_TSTS_TM1TCF_VAL ((uint32_t)0x00000100)
#define | CAN_TSTS_TM2TCF_VAL ((uint32_t)0x00010000)
#define | CAN_TSTS_TM0CT_VAL ((uint32_t)0x00000080)
#define | CAN_TSTS_TM1CT_VAL ((uint32_t)0x00008000)
#define | CAN_TSTS_TM2CT_VAL ((uint32_t)0x00800000)
#define | CAN_RF0_RF0FF_VAL ((uint32_t)0x00000008)
#define | CAN_RF0_RF0OF_VAL ((uint32_t)0x00000010)
#define | CAN_RF0_RF0R_VAL ((uint32_t)0x00000020)
#define | CAN_RF1_RF1FF_VAL ((uint32_t)0x00000008)
#define | CAN_RF1_RF1OF_VAL ((uint32_t)0x00000010)
#define | CAN_RF1_RF1R_VAL ((uint32_t)0x00000020)
#define | CAN1 ((can_type *) CAN1_BASE)

Detailed Description

CAN driver modules.

Macro Definition Documentation

◆ CAN1

#define CAN1 ((can_type *) CAN1_BASE)

Definition at line 937 of file at32f413_can.h.

Referenced by CAN1_SE_IRQHandler(), can_configuration(), can_reset(), can_transmit_data(), can_transmit_data(), can_transmit_data(), and USBFS_L_CAN1_RX0_IRQHandler().

◆ CAN_MSTS_EDZIF_VAL

#define CAN_MSTS_EDZIF_VAL ((uint32_t)0x00000010)

edzif bit value, it clear by writing 1

Definition at line 114 of file at32f413_can.h.

Referenced by can_flag_clear().

◆ CAN_MSTS_EOIF_VAL

#define CAN_MSTS_EOIF_VAL ((uint32_t)0x00000004)

can flag clear operation macro definition val

eoif bit value, it clear by writing 1

Definition at line 112 of file at32f413_can.h.

Referenced by can_flag_clear().

◆ CAN_MSTS_QDZIF_VAL

#define CAN_MSTS_QDZIF_VAL ((uint32_t)0x00000008)

qdzif bit value, it clear by writing 1

Definition at line 113 of file at32f413_can.h.

Referenced by can_flag_clear().

◆ CAN_RF0_RF0FF_VAL

#define CAN_RF0_RF0FF_VAL ((uint32_t)0x00000008)

rf0ff bit value, it clear by writing 1

Definition at line 121 of file at32f413_can.h.

Referenced by can_flag_clear().

◆ CAN_RF0_RF0OF_VAL

#define CAN_RF0_RF0OF_VAL ((uint32_t)0x00000010)

rf0of bit value, it clear by writing 1

Definition at line 122 of file at32f413_can.h.

Referenced by can_flag_clear().

◆ CAN_RF0_RF0R_VAL

#define CAN_RF0_RF0R_VAL ((uint32_t)0x00000020)

rf0r bit value, it clear by writing 1

Definition at line 123 of file at32f413_can.h.

Referenced by can_receive_fifo_release().

◆ CAN_RF1_RF1FF_VAL

#define CAN_RF1_RF1FF_VAL ((uint32_t)0x00000008)

rf1ff bit value, it clear by writing 1

Definition at line 124 of file at32f413_can.h.

Referenced by can_flag_clear().

◆ CAN_RF1_RF1OF_VAL

#define CAN_RF1_RF1OF_VAL ((uint32_t)0x00000010)

rf1of bit value, it clear by writing 1

Definition at line 125 of file at32f413_can.h.

Referenced by can_flag_clear().

◆ CAN_RF1_RF1R_VAL

#define CAN_RF1_RF1R_VAL ((uint32_t)0x00000020)

rf1r bit value, it clear by writing 1

Definition at line 126 of file at32f413_can.h.

Referenced by can_receive_fifo_release().

◆ CAN_TSTS_TM0CT_VAL

#define CAN_TSTS_TM0CT_VAL ((uint32_t)0x00000080)

tm0ct bit value, it clear by writing 1

Definition at line 118 of file at32f413_can.h.

Referenced by can_transmit_cancel().

◆ CAN_TSTS_TM0TCF_VAL

#define CAN_TSTS_TM0TCF_VAL ((uint32_t)0x00000001)

tm0tcf bit value, it clear by writing 1

Definition at line 115 of file at32f413_can.h.

Referenced by can_flag_clear().

◆ CAN_TSTS_TM1CT_VAL

#define CAN_TSTS_TM1CT_VAL ((uint32_t)0x00008000)

tm1ct bit value, it clear by writing 1

Definition at line 119 of file at32f413_can.h.

Referenced by can_transmit_cancel().

◆ CAN_TSTS_TM1TCF_VAL

#define CAN_TSTS_TM1TCF_VAL ((uint32_t)0x00000100)

tm1tcf bit value, it clear by writing 1

Definition at line 116 of file at32f413_can.h.

Referenced by can_flag_clear().

◆ CAN_TSTS_TM2CT_VAL

#define CAN_TSTS_TM2CT_VAL ((uint32_t)0x00800000)

tm2ct bit value, it clear by writing 1

Definition at line 120 of file at32f413_can.h.

Referenced by can_transmit_cancel().

◆ CAN_TSTS_TM2TCF_VAL

#define CAN_TSTS_TM2TCF_VAL ((uint32_t)0x00010000)

tm2tcf bit value, it clear by writing 1

Definition at line 117 of file at32f413_can.h.

Referenced by can_flag_clear().


AT32F413 Firmwary Library: CAN_timeout_count

Macros
CAN_timeout_count
AT32F413_periph_driver » CAN

Macros

#define | FZC_TIMEOUT ((uint32_t)0x0000FFFF)
#define | DZC_TIMEOUT ((uint32_t)0x0000FFFF)

Detailed Description

Macro Definition Documentation

◆ DZC_TIMEOUT

#define DZC_TIMEOUT ((uint32_t)0x0000FFFF)

time out for dzc bit

Definition at line 52 of file at32f413_can.h.

Referenced by can_doze_mode_exit().

◆ FZC_TIMEOUT

#define FZC_TIMEOUT ((uint32_t)0x0000FFFF)

time out for fzc bit

Definition at line 51 of file at32f413_can.h.

Referenced by can_base_init(), can_baudrate_set(), can_doze_mode_enter(), and can_operating_mode_set().


AT32F413 Firmwary Library: CAN_flags_definition

Macros
CAN_flags_definition
AT32F413_periph_driver » CAN

can flag More...

Macros

#define | CAN_EAF_FLAG ((uint32_t)0x01)
#define | CAN_EPF_FLAG ((uint32_t)0x02)
#define | CAN_BOF_FLAG ((uint32_t)0x03)
#define | CAN_ETR_FLAG ((uint32_t)0x04)
#define | CAN_EOIF_FLAG ((uint32_t)0x05)
#define | CAN_TM0TCF_FLAG ((uint32_t)0x06)
#define | CAN_TM1TCF_FLAG ((uint32_t)0x07)
#define | CAN_TM2TCF_FLAG ((uint32_t)0x08)
#define | CAN_RF0MN_FLAG ((uint32_t)0x09)
#define | CAN_RF0FF_FLAG ((uint32_t)0x0A)
#define | CAN_RF0OF_FLAG ((uint32_t)0x0B)
#define | CAN_RF1MN_FLAG ((uint32_t)0x0C)
#define | CAN_RF1FF_FLAG ((uint32_t)0x0D)
#define | CAN_RF1OF_FLAG ((uint32_t)0x0E)
#define | CAN_QDZIF_FLAG ((uint32_t)0x0F)
#define | CAN_EDZC_FLAG ((uint32_t)0x10)
#define | CAN_TMEF_FLAG ((uint32_t)0x11)

Detailed Description

can flag

Macro Definition Documentation

◆ CAN_BOF_FLAG

#define CAN_BOF_FLAG ((uint32_t)0x03)

bus-off flag

Definition at line 65 of file at32f413_can.h.

Referenced by can_flag_clear(), can_flag_get(), and can_interrupt_flag_get().

◆ CAN_EAF_FLAG

#define CAN_EAF_FLAG ((uint32_t)0x01)

error active flag

Definition at line 63 of file at32f413_can.h.

Referenced by can_flag_clear(), can_flag_get(), and can_interrupt_flag_get().

◆ CAN_EDZC_FLAG

#define CAN_EDZC_FLAG ((uint32_t)0x10)

enter doze mode confirm flag

Definition at line 78 of file at32f413_can.h.

Referenced by can_flag_clear(), can_flag_get(), and can_interrupt_flag_get().

◆ CAN_EOIF_FLAG

#define CAN_EOIF_FLAG ((uint32_t)0x05)

error occur interrupt flag

Definition at line 67 of file at32f413_can.h.

Referenced by can_flag_clear(), can_flag_get(), and can_interrupt_flag_get().

◆ CAN_EPF_FLAG

#define CAN_EPF_FLAG ((uint32_t)0x02)

error passive flag

Definition at line 64 of file at32f413_can.h.

Referenced by can_flag_clear(), can_flag_get(), and can_interrupt_flag_get().

◆ CAN_ETR_FLAG

#define CAN_ETR_FLAG ((uint32_t)0x04)

error type record flag

Definition at line 66 of file at32f413_can.h.

Referenced by CAN1_SE_IRQHandler(), can_flag_clear(), can_flag_get(), and can_interrupt_flag_get().

◆ CAN_QDZIF_FLAG

#define CAN_QDZIF_FLAG ((uint32_t)0x0F)

quit doze mode interrupt flag

Definition at line 77 of file at32f413_can.h.

Referenced by can_flag_clear(), can_flag_get(), and can_interrupt_flag_get().

◆ CAN_RF0FF_FLAG

#define CAN_RF0FF_FLAG ((uint32_t)0x0A)

receive fifo 0 full flag

Definition at line 72 of file at32f413_can.h.

Referenced by can_flag_clear(), can_flag_get(), and can_interrupt_flag_get().

◆ CAN_RF0MN_FLAG

#define CAN_RF0MN_FLAG ((uint32_t)0x09)

receive fifo 0 message num flag

Definition at line 71 of file at32f413_can.h.

Referenced by can_flag_get(), can_interrupt_flag_get(), and USBFS_L_CAN1_RX0_IRQHandler().

◆ CAN_RF0OF_FLAG

#define CAN_RF0OF_FLAG ((uint32_t)0x0B)

receive fifo 0 overflow flag

Definition at line 73 of file at32f413_can.h.

Referenced by can_flag_clear(), can_flag_get(), and can_interrupt_flag_get().

◆ CAN_RF1FF_FLAG

#define CAN_RF1FF_FLAG ((uint32_t)0x0D)

receive fifo 1 full flag

Definition at line 75 of file at32f413_can.h.

Referenced by can_flag_clear(), can_flag_get(), and can_interrupt_flag_get().

◆ CAN_RF1MN_FLAG

#define CAN_RF1MN_FLAG ((uint32_t)0x0C)

receive fifo 1 message num flag

Definition at line 74 of file at32f413_can.h.

Referenced by can_flag_get(), and can_interrupt_flag_get().

◆ CAN_RF1OF_FLAG

#define CAN_RF1OF_FLAG ((uint32_t)0x0E)

receive fifo 1 overflow flag

Definition at line 76 of file at32f413_can.h.

Referenced by can_flag_clear(), can_flag_get(), and can_interrupt_flag_get().

◆ CAN_TM0TCF_FLAG

#define CAN_TM0TCF_FLAG ((uint32_t)0x06)

transmit mailbox 0 transmission completed flag

Definition at line 68 of file at32f413_can.h.

Referenced by can_flag_clear(), can_flag_get(), and can_interrupt_flag_get().

◆ CAN_TM1TCF_FLAG

#define CAN_TM1TCF_FLAG ((uint32_t)0x07)

transmit mailbox 1 transmission completed flag

Definition at line 69 of file at32f413_can.h.

Referenced by can_flag_clear(), can_flag_get(), and can_interrupt_flag_get().

◆ CAN_TM2TCF_FLAG

#define CAN_TM2TCF_FLAG ((uint32_t)0x08)

transmit mailbox 2 transmission completed flag

Definition at line 70 of file at32f413_can.h.

Referenced by can_flag_clear(), can_flag_get(), and can_interrupt_flag_get().

◆ CAN_TMEF_FLAG

#define CAN_TMEF_FLAG ((uint32_t)0x11)

transmit mailbox empty flag

Definition at line 79 of file at32f413_can.h.

Referenced by can_flag_clear(), can_flag_get(), and can_interrupt_flag_get().


AT32F413 Firmwary Library: CAN_interrupts_definition

Macros
CAN_interrupts_definition
AT32F413_periph_driver » CAN

can interrupt More...

Macros

#define | CAN_TCIEN_INT ((uint32_t)0x00000001)
#define | CAN_RF0MIEN_INT ((uint32_t)0x00000002)
#define | CAN_RF0FIEN_INT ((uint32_t)0x00000004)
#define | CAN_RF0OIEN_INT ((uint32_t)0x00000008)
#define | CAN_RF1MIEN_INT ((uint32_t)0x00000010)
#define | CAN_RF1FIEN_INT ((uint32_t)0x00000020)
#define | CAN_RF1OIEN_INT ((uint32_t)0x00000040)
#define | CAN_EAIEN_INT ((uint32_t)0x00000100)
#define | CAN_EPIEN_INT ((uint32_t)0x00000200)
#define | CAN_BOIEN_INT ((uint32_t)0x00000400)
#define | CAN_ETRIEN_INT ((uint32_t)0x00000800)
#define | CAN_EOIEN_INT ((uint32_t)0x00008000)
#define | CAN_QDZIEN_INT ((uint32_t)0x00010000)
#define | CAN_EDZIEN_INT ((uint32_t)0x00020000)

Detailed Description

can interrupt

Macro Definition Documentation

◆ CAN_BOIEN_INT

#define CAN_BOIEN_INT ((uint32_t)0x00000400)

bus-off interrupt

Definition at line 99 of file at32f413_can.h.

◆ CAN_EAIEN_INT

#define CAN_EAIEN_INT ((uint32_t)0x00000100)

error active interrupt

Definition at line 97 of file at32f413_can.h.

◆ CAN_EDZIEN_INT

#define CAN_EDZIEN_INT ((uint32_t)0x00020000)

enter doze mode confirm interrupt

Definition at line 103 of file at32f413_can.h.

◆ CAN_EOIEN_INT

#define CAN_EOIEN_INT ((uint32_t)0x00008000)

error occur interrupt

Definition at line 101 of file at32f413_can.h.

Referenced by can_configuration().

◆ CAN_EPIEN_INT

#define CAN_EPIEN_INT ((uint32_t)0x00000200)

error passive interrupt

Definition at line 98 of file at32f413_can.h.

◆ CAN_ETRIEN_INT

#define CAN_ETRIEN_INT ((uint32_t)0x00000800)

error type record interrupt

Definition at line 100 of file at32f413_can.h.

Referenced by can_configuration().

◆ CAN_QDZIEN_INT

#define CAN_QDZIEN_INT ((uint32_t)0x00010000)

quit doze mode interrupt

Definition at line 102 of file at32f413_can.h.

◆ CAN_RF0FIEN_INT

#define CAN_RF0FIEN_INT ((uint32_t)0x00000004)

receive fifo 0 full interrupt

Definition at line 92 of file at32f413_can.h.

◆ CAN_RF0MIEN_INT

#define CAN_RF0MIEN_INT ((uint32_t)0x00000002)

receive fifo 0 message interrupt

Definition at line 91 of file at32f413_can.h.

Referenced by can_configuration().

◆ CAN_RF0OIEN_INT

#define CAN_RF0OIEN_INT ((uint32_t)0x00000008)

receive fifo 0 overflow interrupt

Definition at line 93 of file at32f413_can.h.

◆ CAN_RF1FIEN_INT

#define CAN_RF1FIEN_INT ((uint32_t)0x00000020)

receive fifo 1 full interrupt

Definition at line 95 of file at32f413_can.h.

◆ CAN_RF1MIEN_INT

#define CAN_RF1MIEN_INT ((uint32_t)0x00000010)

receive fifo 1 message interrupt

Definition at line 94 of file at32f413_can.h.

◆ CAN_RF1OIEN_INT

#define CAN_RF1OIEN_INT ((uint32_t)0x00000040)

receive fifo 1 overflow interrupt

Definition at line 96 of file at32f413_can.h.

◆ CAN_TCIEN_INT

#define CAN_TCIEN_INT ((uint32_t)0x00000001)

transmission complete interrupt

Definition at line 90 of file at32f413_can.h.


AT32F413 Firmwary Library: CAN_exported_types

Data Structures | Enumerations
CAN_exported_types
AT32F413_periph_driver » CAN

Data Structures

struct | can_base_type
can init structure definition More...
struct | can_baudrate_type
can baudrate structure definition More...
struct | can_filter_init_type
can filter init structure definition More...
struct | can_tx_message_type
can tx message structure definition More...
struct | can_rx_message_type
can rx message structure definition More...
struct | can_tx_mailbox_type
can controller area network tx mailbox More...
struct | can_fifo_mailbox_type
can controller area network fifo mailbox More...
struct | can_filter_register_type
can controller area network filter bit register More...
struct | can_type
type define can register all More...

Enumerations

enum | can_filter_fifo_type { CAN_FILTER_FIFO0 = 0x00 , CAN_FILTER_FIFO1 = 0x01 }
can filter fifo More...
enum | can_filter_mode_type { CAN_FILTER_MODE_ID_MASK = 0x00 , CAN_FILTER_MODE_ID_LIST = 0x01 }
can filter mode More...
enum | can_filter_bit_width_type { CAN_FILTER_16BIT = 0x00 , CAN_FILTER_32BIT = 0x01 }
can filter bit width select More...
enum | can_mode_type { CAN_MODE_COMMUNICATE = 0x00 , CAN_MODE_LOOPBACK = 0x01 , CAN_MODE_LISTENONLY = 0x02 , CAN_MODE_LISTENONLY_LOOPBACK = 0x03 }
can mode More...
enum | can_operating_mode_type { CAN_OPERATINGMODE_FREEZE = 0x00 , CAN_OPERATINGMODE_DOZE = 0x01 , CAN_OPERATINGMODE_COMMUNICATE = 0x02 }
can operating mode More...
enum | can_rsaw_type { CAN_RSAW_1TQ = 0x00 , CAN_RSAW_2TQ = 0x01 , CAN_RSAW_3TQ = 0x02 , CAN_RSAW_4TQ = 0x03 }
can resynchronization adjust width More...
enum can_bts1_type {
CAN_BTS1_1TQ = 0x00 , CAN_BTS1_2TQ = 0x01 , CAN_BTS1_3TQ = 0x02 , CAN_BTS1_4TQ = 0x03 ,
CAN_BTS1_5TQ = 0x04 , CAN_BTS1_6TQ = 0x05 , CAN_BTS1_7TQ = 0x06 , CAN_BTS1_8TQ = 0x07 ,
CAN_BTS1_9TQ = 0x08 , CAN_BTS1_10TQ = 0x09 , CAN_BTS1_11TQ = 0x0A , CAN_BTS1_12TQ = 0x0B ,
CAN_BTS1_13TQ = 0x0C , CAN_BTS1_14TQ = 0x0D , CAN_BTS1_15TQ = 0x0E , CAN_BTS1_16TQ = 0x0F
}
can bit time segment 1 More...
enum can_bts2_type {
CAN_BTS2_1TQ = 0x00 , CAN_BTS2_2TQ = 0x01 , CAN_BTS2_3TQ = 0x02 , CAN_BTS2_4TQ = 0x03 ,
CAN_BTS2_5TQ = 0x04 , CAN_BTS2_6TQ = 0x05 , CAN_BTS2_7TQ = 0x06 , CAN_BTS2_8TQ = 0x07
}
can bit time segment 2 More...
enum | can_identifier_type { CAN_ID_STANDARD = 0x00 , CAN_ID_EXTENDED = 0x01 }
can identifier type More...
enum | can_trans_frame_type { CAN_TFT_DATA = 0x00 , CAN_TFT_REMOTE = 0x01 }
can transmission frame type More...
enum | can_tx_mailbox_num_type { CAN_TX_MAILBOX0 = 0x00 , CAN_TX_MAILBOX1 = 0x01 , CAN_TX_MAILBOX2 = 0x02 }
can tx mailboxes More...
enum | can_rx_fifo_num_type { CAN_RX_FIFO0 = 0x00 , CAN_RX_FIFO1 = 0x01 }
can receive fifo More...
enum | can_transmit_status_type { CAN_TX_STATUS_FAILED = 0x00 , CAN_TX_STATUS_SUCCESSFUL = 0x01 , CAN_TX_STATUS_PENDING = 0x02 , CAN_TX_STATUS_NO_EMPTY = 0x04 }
can transmit status More...
enum | can_enter_doze_status_type { CAN_ENTER_DOZE_FAILED = 0x00 , CAN_ENTER_DOZE_SUCCESSFUL = 0x01 }
can enter doze mode status More...
enum | can_quit_doze_status_type { CAN_QUIT_DOZE_FAILED = 0x00 , CAN_QUIT_DOZE_SUCCESSFUL = 0x01 }
can quit doze mode status More...
enum | can_msg_discarding_rule_type { CAN_DISCARDING_FIRST_RECEIVED = 0x00 , CAN_DISCARDING_LAST_RECEIVED = 0x01 }
can message discarding rule select when overflow More...
enum | can_msg_sending_rule_type { CAN_SENDING_BY_ID = 0x00 , CAN_SENDING_BY_REQUEST = 0x01 }
can multiple message sending sequence rule More...
enum can_error_record_type {
CAN_ERRORRECORD_NOERR = 0x00 , CAN_ERRORRECORD_STUFFERR = 0x01 , CAN_ERRORRECORD_FORMERR = 0x02 , CAN_ERRORRECORD_ACKERR = 0x03 ,
CAN_ERRORRECORD_BITRECESSIVEERR = 0x04 , CAN_ERRORRECORD_BITDOMINANTERR = 0x05 , CAN_ERRORRECORD_CRCERR = 0x06 , CAN_ERRORRECORD_SOFTWARESETERR = 0x07
}
can error type record More...

Detailed Description

Enumeration Type Documentation

◆ can_bts1_type

enum can_bts1_type

can bit time segment 1

Enumerator
CAN_BTS1_1TQ | 1 time quantum
CAN_BTS1_2TQ | 2 time quantum
CAN_BTS1_3TQ | 3 time quantum
CAN_BTS1_4TQ | 4 time quantum
CAN_BTS1_5TQ | 5 time quantum
CAN_BTS1_6TQ | 6 time quantum
CAN_BTS1_7TQ | 7 time quantum
CAN_BTS1_8TQ | 8 time quantum
CAN_BTS1_9TQ | 9 time quantum
CAN_BTS1_10TQ | 10 time quantum
CAN_BTS1_11TQ | 11 time quantum
CAN_BTS1_12TQ | 12 time quantum
CAN_BTS1_13TQ | 13 time quantum
CAN_BTS1_14TQ | 14 time quantum
CAN_BTS1_15TQ | 15 time quantum
CAN_BTS1_16TQ | 16 time quantum

Definition at line 194 of file at32f413_can.h.

◆ can_bts2_type

enum can_bts2_type

can bit time segment 2

Enumerator
CAN_BTS2_1TQ | 1 time quantum
CAN_BTS2_2TQ | 2 time quantum
CAN_BTS2_3TQ | 3 time quantum
CAN_BTS2_4TQ | 4 time quantum
CAN_BTS2_5TQ | 5 time quantum
CAN_BTS2_6TQ | 6 time quantum
CAN_BTS2_7TQ | 7 time quantum
CAN_BTS2_8TQ | 8 time quantum

Definition at line 217 of file at32f413_can.h.

◆ can_enter_doze_status_type

enum can_enter_doze_status_type

can enter doze mode status

Enumerator
CAN_ENTER_DOZE_FAILED | can enter the doze mode failed
CAN_ENTER_DOZE_SUCCESSFUL | can enter the doze mode successful

Definition at line 280 of file at32f413_can.h.

◆ can_error_record_type

enum can_error_record_type

can error type record

Enumerator
CAN_ERRORRECORD_NOERR | no error
CAN_ERRORRECORD_STUFFERR | stuff error
CAN_ERRORRECORD_FORMERR | form error
CAN_ERRORRECORD_ACKERR | acknowledgment error
CAN_ERRORRECORD_BITRECESSIVEERR | bit recessive error
CAN_ERRORRECORD_BITDOMINANTERR | bit dominant error
CAN_ERRORRECORD_CRCERR | crc error
CAN_ERRORRECORD_SOFTWARESETERR | software set error

Definition at line 316 of file at32f413_can.h.

◆ can_filter_bit_width_type

enum can_filter_bit_width_type

can filter bit width select

Enumerator
CAN_FILTER_16BIT | two 16-bit filters
CAN_FILTER_32BIT | one 32-bit filter

Definition at line 153 of file at32f413_can.h.

◆ can_filter_fifo_type

enum can_filter_fifo_type

can filter fifo

Enumerator
CAN_FILTER_FIFO0 | filter fifo 0 assignment for filter x
CAN_FILTER_FIFO1 | filter fifo 1 assignment for filter x

Definition at line 135 of file at32f413_can.h.

◆ can_filter_mode_type

enum can_filter_mode_type

can filter mode

Enumerator
CAN_FILTER_MODE_ID_MASK | identifier mask mode
CAN_FILTER_MODE_ID_LIST | identifier list mode

Definition at line 144 of file at32f413_can.h.

◆ can_identifier_type

enum can_identifier_type

can identifier type

Enumerator
CAN_ID_STANDARD | standard Id
CAN_ID_EXTENDED | extended Id

Definition at line 232 of file at32f413_can.h.

◆ can_mode_type

enum can_mode_type

can mode

Enumerator
CAN_MODE_COMMUNICATE | communication mode
CAN_MODE_LOOPBACK | loopback mode
CAN_MODE_LISTENONLY | listen-only mode
CAN_MODE_LISTENONLY_LOOPBACK | loopback combined with listen-only mode

Definition at line 162 of file at32f413_can.h.

◆ can_msg_discarding_rule_type

enum can_msg_discarding_rule_type

can message discarding rule select when overflow

Enumerator
CAN_DISCARDING_FIRST_RECEIVED | can discarding the first received message
CAN_DISCARDING_LAST_RECEIVED | can discarding the last received message

Definition at line 298 of file at32f413_can.h.

◆ can_msg_sending_rule_type

enum can_msg_sending_rule_type

can multiple message sending sequence rule

Enumerator
CAN_SENDING_BY_ID | can sending the minimum id message first
CAN_SENDING_BY_REQUEST | can sending the first request message first

Definition at line 307 of file at32f413_can.h.

◆ can_operating_mode_type

enum can_operating_mode_type

can operating mode

Enumerator
CAN_OPERATINGMODE_FREEZE | freeze mode
CAN_OPERATINGMODE_DOZE | doze mode
CAN_OPERATINGMODE_COMMUNICATE | communication mode

Definition at line 173 of file at32f413_can.h.

◆ can_quit_doze_status_type

enum can_quit_doze_status_type

can quit doze mode status

Enumerator
CAN_QUIT_DOZE_FAILED | can quit doze mode failed
CAN_QUIT_DOZE_SUCCESSFUL | can quit doze mode successful

Definition at line 289 of file at32f413_can.h.

◆ can_rsaw_type

enum can_rsaw_type

can resynchronization adjust width

Enumerator
CAN_RSAW_1TQ | 1 time quantum
CAN_RSAW_2TQ | 2 time quantum
CAN_RSAW_3TQ | 3 time quantum
CAN_RSAW_4TQ | 4 time quantum

Definition at line 183 of file at32f413_can.h.

◆ can_rx_fifo_num_type

enum can_rx_fifo_num_type

can receive fifo

Enumerator
CAN_RX_FIFO0 | can fifo 0 used to receive
CAN_RX_FIFO1 | can fifo 1 used to receive

Definition at line 260 of file at32f413_can.h.

◆ can_trans_frame_type

enum can_trans_frame_type

can transmission frame type

Enumerator
CAN_TFT_DATA | data frame
CAN_TFT_REMOTE | remote frame

Definition at line 241 of file at32f413_can.h.

◆ can_transmit_status_type

enum can_transmit_status_type

can transmit status

Enumerator
CAN_TX_STATUS_FAILED | can transmission failed
CAN_TX_STATUS_SUCCESSFUL | can transmission successful
CAN_TX_STATUS_PENDING | can transmission pending
CAN_TX_STATUS_NO_EMPTY | can transmission no empty mailbox

Definition at line 269 of file at32f413_can.h.

◆ can_tx_mailbox_num_type

enum can_tx_mailbox_num_type

can tx mailboxes

Enumerator
CAN_TX_MAILBOX0 | can tx mailbox 0
CAN_TX_MAILBOX1 | can tx mailbox 1
CAN_TX_MAILBOX2 | can tx mailbox 2

Definition at line 250 of file at32f413_can.h.


AT32F413 Firmwary Library: can_base_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
can_base_type Struct Reference
AT32F413_periph_driver » CAN » CAN_exported_types

can init structure definition More...

#include <at32f413_can.h>

Data Fields

can_mode_type mode_selection
confirm_state ttc_enable
confirm_state aebo_enable
confirm_state aed_enable
confirm_state prsf_enable
can_msg_discarding_rule_type mdrsel_selection
can_msg_sending_rule_type mmssr_selection

Detailed Description

can init structure definition

Definition at line 331 of file at32f413_can.h.

Field Documentation

◆ aebo_enable

confirm_state can_base_type::aebo_enable

automatic exit bus-off enable

Definition at line 337 of file at32f413_can.h.

Referenced by can_base_init(), can_configuration(), and can_default_para_init().

◆ aed_enable

confirm_state can_base_type::aed_enable

automatic exit doze mode enable

Definition at line 339 of file at32f413_can.h.

Referenced by can_base_init(), can_configuration(), and can_default_para_init().

◆ mdrsel_selection

can_msg_discarding_rule_type can_base_type::mdrsel_selection

message discarding rule select when overflow

Definition at line 343 of file at32f413_can.h.

Referenced by can_base_init(), can_configuration(), and can_default_para_init().

◆ mmssr_selection

can_msg_sending_rule_type can_base_type::mmssr_selection

multiple message sending sequence rule

Definition at line 345 of file at32f413_can.h.

Referenced by can_base_init(), can_configuration(), and can_default_para_init().

◆ mode_selection

can_mode_type can_base_type::mode_selection

specifies the can mode.

Definition at line 333 of file at32f413_can.h.

Referenced by can_base_init(), can_configuration(), and can_default_para_init().

◆ prsf_enable

confirm_state can_base_type::prsf_enable

prohibit retransmission when sending fails enable

Definition at line 341 of file at32f413_can.h.

Referenced by can_base_init(), can_configuration(), and can_default_para_init().

◆ ttc_enable

confirm_state can_base_type::ttc_enable

time triggered communication mode enable

Definition at line 335 of file at32f413_can.h.

Referenced by can_base_init(), can_configuration(), and can_default_para_init().

The documentation for this struct was generated from the following file:
  • at32f413_can.h


AT32F413 Firmwary Library: can_baudrate_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
can_baudrate_type Struct Reference
AT32F413_periph_driver » CAN » CAN_exported_types

can baudrate structure definition More...

#include <at32f413_can.h>

Data Fields

uint16_t baudrate_div
can_rsaw_type rsaw_size
can_bts1_type bts1_size
can_bts2_type bts2_size

Detailed Description

can baudrate structure definition

Definition at line 352 of file at32f413_can.h.

Field Documentation

◆ baudrate_div

uint16_t can_baudrate_type::baudrate_div

baudrate division,this parameter can be 0x001~0x1000.

Definition at line 354 of file at32f413_can.h.

Referenced by can_baudrate_default_para_init(), can_baudrate_set(), and can_configuration().

◆ bts1_size

can_bts1_type can_baudrate_type::bts1_size

bit time segment 1

Definition at line 358 of file at32f413_can.h.

Referenced by can_baudrate_default_para_init(), can_baudrate_set(), and can_configuration().

◆ bts2_size

can_bts2_type can_baudrate_type::bts2_size

bit time segment 2

Definition at line 360 of file at32f413_can.h.

Referenced by can_baudrate_default_para_init(), can_baudrate_set(), and can_configuration().

◆ rsaw_size

can_rsaw_type can_baudrate_type::rsaw_size

resynchronization adjust width

Definition at line 356 of file at32f413_can.h.

Referenced by can_baudrate_default_para_init(), can_baudrate_set(), and can_configuration().

The documentation for this struct was generated from the following file:
  • at32f413_can.h


AT32F413 Firmwary Library: can_filter_init_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
can_filter_init_type Struct Reference
AT32F413_periph_driver » CAN » CAN_exported_types

can filter init structure definition More...

#include <at32f413_can.h>

Data Fields

confirm_state filter_activate_enable
can_filter_mode_type filter_mode
can_filter_fifo_type filter_fifo
uint8_t | filter_number
can_filter_bit_width_type filter_bit
uint16_t | filter_id_high
uint16_t | filter_id_low
uint16_t | filter_mask_high
uint16_t | filter_mask_low

Detailed Description

can filter init structure definition

Definition at line 367 of file at32f413_can.h.

Field Documentation

◆ filter_activate_enable

confirm_state can_filter_init_type::filter_activate_enable

enable or disable the filter activate.

Definition at line 369 of file at32f413_can.h.

Referenced by can_configuration(), can_filter_default_para_init(), and can_filter_init().

◆ filter_bit

can_filter_bit_width_type can_filter_init_type::filter_bit

config the filter bit width 16bit or 32bit.

Definition at line 377 of file at32f413_can.h.

Referenced by can_configuration(), can_filter_default_para_init(), and can_filter_init().

◆ filter_fifo

can_filter_fifo_type can_filter_init_type::filter_fifo

config the fifo which will be assigned to the filter.

Definition at line 373 of file at32f413_can.h.

Referenced by can_configuration(), can_filter_default_para_init(), and can_filter_init().

◆ filter_id_high

uint16_t can_filter_init_type::filter_id_high

config the filter identification, for 32-bit configuration it's high 16 bits, for 16-bit configuration it's first.

Definition at line 379 of file at32f413_can.h.

Referenced by can_configuration(), can_filter_default_para_init(), and can_filter_init().

◆ filter_id_low

uint16_t can_filter_init_type::filter_id_low

config the filter identification, for 32-bit configuration it's low 16 bits, for 16-bit configuration it's second.

Definition at line 382 of file at32f413_can.h.

Referenced by can_configuration(), can_filter_default_para_init(), and can_filter_init().

◆ filter_mask_high

uint16_t can_filter_init_type::filter_mask_high

config the filter mask or identification, according to the filtering mode, for 32-bit configuration it's high 16 bits, for 16-bit configuration it's first.

Definition at line 385 of file at32f413_can.h.

Referenced by can_configuration(), can_filter_default_para_init(), and can_filter_init().

◆ filter_mask_low

uint16_t can_filter_init_type::filter_mask_low

config the filter mask or identification, according to the filtering mode, for 32-bit configuration it's low 16 bits, for 16-bit configuration it's second.

Definition at line 388 of file at32f413_can.h.

Referenced by can_configuration(), can_filter_default_para_init(), and can_filter_init().

◆ filter_mode

can_filter_mode_type can_filter_init_type::filter_mode

config the filter mode mask or list.

Definition at line 371 of file at32f413_can.h.

Referenced by can_configuration(), can_filter_default_para_init(), and can_filter_init().

◆ filter_number

uint8_t can_filter_init_type::filter_number

config the filter number, parameter ranges from 0 to 13.

Definition at line 375 of file at32f413_can.h.

Referenced by can_configuration(), can_filter_default_para_init(), and can_filter_init().

The documentation for this struct was generated from the following file:
  • at32f413_can.h


AT32F413 Firmwary Library: can_tx_message_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
can_tx_message_type Struct Reference
AT32F413_periph_driver » CAN » CAN_exported_types

can tx message structure definition More...

#include <at32f413_can.h>

Data Fields

uint32_t | standard_id
uint32_t | extended_id
can_identifier_type id_type
can_trans_frame_type frame_type
uint8_t | dlc
uint8_t | data [8]

Detailed Description

can tx message structure definition

Definition at line 395 of file at32f413_can.h.

Field Documentation

◆ data

uint8_t can_tx_message_type::data[8]

contains the transmit data. it ranges from 0 to 0xFF.

Definition at line 410 of file at32f413_can.h.

Referenced by can_message_transmit(), can_transmit_data(), can_transmit_data(), and can_transmit_data().

◆ dlc

uint8_t can_tx_message_type::dlc

specifies frame data length that will be transmitted. this parameter can be a value between 0 to 8

Definition at line 407 of file at32f413_can.h.

Referenced by can_message_transmit(), can_transmit_data(), can_transmit_data(), and can_transmit_data().

◆ extended_id

uint32_t can_tx_message_type::extended_id

specifies the 29 bits extended identifier. this parameter can be a value between 0 to 0x1FFFFFFF.

Definition at line 400 of file at32f413_can.h.

Referenced by can_message_transmit(), can_transmit_data(), can_transmit_data(), and can_transmit_data().

◆ frame_type

can_trans_frame_type can_tx_message_type::frame_type

specifies frame type for the transmit message.

Definition at line 405 of file at32f413_can.h.

Referenced by can_message_transmit(), can_transmit_data(), can_transmit_data(), and can_transmit_data().

◆ id_type

can_identifier_type can_tx_message_type::id_type

specifies identifier type for the transmit message.

Definition at line 403 of file at32f413_can.h.

Referenced by can_message_transmit(), can_transmit_data(), can_transmit_data(), and can_transmit_data().

◆ standard_id

uint32_t can_tx_message_type::standard_id

specifies the 11 bits standard identifier. this parameter can be a value between 0 to 0x7FF.

Definition at line 397 of file at32f413_can.h.

Referenced by can_message_transmit(), can_transmit_data(), can_transmit_data(), and can_transmit_data().

The documentation for this struct was generated from the following file:
  • at32f413_can.h


AT32F413 Firmwary Library: can_rx_message_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
can_rx_message_type Struct Reference
AT32F413_periph_driver » CAN » CAN_exported_types

can rx message structure definition More...

#include <at32f413_can.h>

Data Fields

uint32_t | standard_id
uint32_t | extended_id
can_identifier_type id_type
can_trans_frame_type frame_type
uint8_t | dlc
uint8_t | data [8]
uint8_t | filter_index

Detailed Description

can rx message structure definition

Definition at line 417 of file at32f413_can.h.

Field Documentation

◆ data

uint8_t can_rx_message_type::data[8]

contains the receive data. it ranges from 0 to 0xFF.

Definition at line 432 of file at32f413_can.h.

Referenced by can_message_receive().

◆ dlc

uint8_t can_rx_message_type::dlc

specifies the frame data length that will be received. this parameter can be a value between 0 to 8

Definition at line 429 of file at32f413_can.h.

Referenced by can_message_receive().

◆ extended_id

uint32_t can_rx_message_type::extended_id

specifies the 29 bits extended identifier. this parameter can be a value between 0 to 0x1FFFFFFF.

Definition at line 422 of file at32f413_can.h.

Referenced by can_message_receive(), and USBFS_L_CAN1_RX0_IRQHandler().

◆ filter_index

uint8_t can_rx_message_type::filter_index

specifies the message stored in which filter this parameter can be a value between 0 to 0xFF

Definition at line 434 of file at32f413_can.h.

Referenced by can_message_receive().

◆ frame_type

can_trans_frame_type can_rx_message_type::frame_type

specifies frame type for the receive message.

Definition at line 427 of file at32f413_can.h.

Referenced by can_message_receive().

◆ id_type

can_identifier_type can_rx_message_type::id_type

specifies identifier type for the receive message.

Definition at line 425 of file at32f413_can.h.

Referenced by can_message_receive(), and USBFS_L_CAN1_RX0_IRQHandler().

◆ standard_id

uint32_t can_rx_message_type::standard_id

specifies the 11 bits standard identifier this parameter can be a value between 0 to 0x7FF.

Definition at line 419 of file at32f413_can.h.

Referenced by can_message_receive(), and USBFS_L_CAN1_RX0_IRQHandler().

The documentation for this struct was generated from the following file:
  • at32f413_can.h


AT32F413 Firmwary Library: can_tx_mailbox_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
can_tx_mailbox_type Struct Reference
AT32F413_periph_driver » CAN » CAN_exported_types

can controller area network tx mailbox More...

#include <at32f413_can.h>

Data Fields

union {
__IO uint32_t tmi
struct {
__IO uint32_t tmsr: 1
__IO uint32_t tmfrsel: 1
__IO uint32_t tmidsel: 1
__IO uint32_t tmeid: 18
__IO uint32_t tmsid: 11
} tmi_bit
};
can tmi register
union {
__IO uint32_t tmc
struct {
__IO uint32_t tmdtbl: 4
__IO uint32_t reserved1: 4
__IO uint32_t tmtsten: 1
__IO uint32_t reserved2: 7
__IO uint32_t tmts: 16
} tmc_bit
};
can tmc register
union {
__IO uint32_t tmdtl
struct {
__IO uint32_t tmdt0: 8
__IO uint32_t tmdt1: 8
__IO uint32_t tmdt2: 8
__IO uint32_t tmdt3: 8
} tmdtl_bit
};
can tmdtl register
union {
__IO uint32_t tmdth
struct {
__IO uint32_t tmdt4: 8
__IO uint32_t tmdt5: 8
__IO uint32_t tmdt6: 8
__IO uint32_t tmdt7: 8
} tmdth_bit
};
can tmdth register

Detailed Description

can controller area network tx mailbox

Definition at line 441 of file at32f413_can.h.

Field Documentation

◆ [union]

union { ... } can_tx_mailbox_type

can tmi register

◆ [union]

union { ... } can_tx_mailbox_type

can tmc register

◆ [union]

union { ... } can_tx_mailbox_type

can tmdtl register

◆ [union]

union { ... } can_tx_mailbox_type

can tmdth register

◆ reserved1

__IO uint32_t can_tx_mailbox_type::reserved1

Definition at line 468 of file at32f413_can.h.

◆ reserved2

__IO uint32_t can_tx_mailbox_type::reserved2

Definition at line 470 of file at32f413_can.h.

◆ tmc

__IO uint32_t can_tx_mailbox_type::tmc

Definition at line 464 of file at32f413_can.h.

◆ [struct]

struct { ... } can_tx_mailbox_type::tmc_bit

Referenced by can_message_transmit(), and can_ttc_mode_enable().

◆ tmdt0

__IO uint32_t can_tx_mailbox_type::tmdt0

Definition at line 483 of file at32f413_can.h.

◆ tmdt1

__IO uint32_t can_tx_mailbox_type::tmdt1

Definition at line 484 of file at32f413_can.h.

◆ tmdt2

__IO uint32_t can_tx_mailbox_type::tmdt2

Definition at line 485 of file at32f413_can.h.

◆ tmdt3

__IO uint32_t can_tx_mailbox_type::tmdt3

Definition at line 486 of file at32f413_can.h.

◆ tmdt4

__IO uint32_t can_tx_mailbox_type::tmdt4

Definition at line 498 of file at32f413_can.h.

◆ tmdt5

__IO uint32_t can_tx_mailbox_type::tmdt5

Definition at line 499 of file at32f413_can.h.

◆ tmdt6

__IO uint32_t can_tx_mailbox_type::tmdt6

Definition at line 500 of file at32f413_can.h.

◆ tmdt7

__IO uint32_t can_tx_mailbox_type::tmdt7

Definition at line 501 of file at32f413_can.h.

◆ tmdtbl

__IO uint32_t can_tx_mailbox_type::tmdtbl

Definition at line 467 of file at32f413_can.h.

Referenced by can_message_transmit().

◆ tmdth

__IO uint32_t can_tx_mailbox_type::tmdth

Definition at line 495 of file at32f413_can.h.

Referenced by can_message_transmit().

◆ [struct]

struct { ... } can_tx_mailbox_type::tmdth_bit

◆ tmdtl

__IO uint32_t can_tx_mailbox_type::tmdtl

Definition at line 480 of file at32f413_can.h.

Referenced by can_message_transmit().

◆ [struct]

struct { ... } can_tx_mailbox_type::tmdtl_bit

◆ tmeid

__IO uint32_t can_tx_mailbox_type::tmeid

Definition at line 454 of file at32f413_can.h.

◆ tmfrsel

__IO uint32_t can_tx_mailbox_type::tmfrsel

Definition at line 452 of file at32f413_can.h.

Referenced by can_message_transmit().

◆ tmi

__IO uint32_t can_tx_mailbox_type::tmi

Definition at line 448 of file at32f413_can.h.

Referenced by can_message_transmit().

◆ [struct]

struct { ... } can_tx_mailbox_type::tmi_bit

Referenced by can_message_transmit().

◆ tmidsel

__IO uint32_t can_tx_mailbox_type::tmidsel

Definition at line 453 of file at32f413_can.h.

Referenced by can_message_transmit().

◆ tmsid

__IO uint32_t can_tx_mailbox_type::tmsid

Definition at line 455 of file at32f413_can.h.

Referenced by can_message_transmit().

◆ tmsr

__IO uint32_t can_tx_mailbox_type::tmsr

Definition at line 451 of file at32f413_can.h.

Referenced by can_message_transmit().

◆ tmts

__IO uint32_t can_tx_mailbox_type::tmts

Definition at line 471 of file at32f413_can.h.

◆ tmtsten

__IO uint32_t can_tx_mailbox_type::tmtsten

Definition at line 469 of file at32f413_can.h.

Referenced by can_ttc_mode_enable().

The documentation for this struct was generated from the following file:
  • at32f413_can.h


AT32F413 Firmwary Library: can_fifo_mailbox_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
can_fifo_mailbox_type Struct Reference
AT32F413_periph_driver » CAN » CAN_exported_types

can controller area network fifo mailbox More...

#include <at32f413_can.h>

Data Fields

union {
__IO uint32_t rfi
struct {
__IO uint32_t reserved1: 1
__IO uint32_t rffri: 1
__IO uint32_t rfidi: 1
__IO uint32_t rfeid: 18
__IO uint32_t rfsid: 11
} rfi_bit
};
can rfi register
union {
__IO uint32_t rfc
struct {
__IO uint32_t rfdtl: 4
__IO uint32_t reserved1: 4
__IO uint32_t rffmn: 8
__IO uint32_t rfts: 16
} rfc_bit
};
can rfc register
union {
__IO uint32_t rfdtl
struct {
__IO uint32_t rfdt0: 8
__IO uint32_t rfdt1: 8
__IO uint32_t rfdt2: 8
__IO uint32_t rfdt3: 8
} rfdtl_bit
};
can rfdtl register
union {
__IO uint32_t rfdth
struct {
__IO uint32_t rfdt4: 8
__IO uint32_t rfdt5: 8
__IO uint32_t rfdt6: 8
__IO uint32_t rfdt7: 8
} rfdth_bit
};
can rfdth register

Detailed Description

can controller area network fifo mailbox

Definition at line 509 of file at32f413_can.h.

Field Documentation

◆ [union]

union { ... } can_fifo_mailbox_type

can rfi register

◆ [union]

union { ... } can_fifo_mailbox_type

can rfc register

◆ [union]

union { ... } can_fifo_mailbox_type

can rfdtl register

◆ [union]

union { ... } can_fifo_mailbox_type

can rfdth register

◆ reserved1

__IO uint32_t can_fifo_mailbox_type::reserved1

Definition at line 519 of file at32f413_can.h.

◆ rfc

__IO uint32_t can_fifo_mailbox_type::rfc

Definition at line 532 of file at32f413_can.h.

◆ [struct]

struct { ... } can_fifo_mailbox_type::rfc_bit

Referenced by can_message_receive().

◆ rfdt0

__IO uint32_t can_fifo_mailbox_type::rfdt0

Definition at line 550 of file at32f413_can.h.

Referenced by can_message_receive().

◆ rfdt1

__IO uint32_t can_fifo_mailbox_type::rfdt1

Definition at line 551 of file at32f413_can.h.

Referenced by can_message_receive().

◆ rfdt2

__IO uint32_t can_fifo_mailbox_type::rfdt2

Definition at line 552 of file at32f413_can.h.

Referenced by can_message_receive().

◆ rfdt3

__IO uint32_t can_fifo_mailbox_type::rfdt3

Definition at line 553 of file at32f413_can.h.

Referenced by can_message_receive().

◆ rfdt4

__IO uint32_t can_fifo_mailbox_type::rfdt4

Definition at line 565 of file at32f413_can.h.

Referenced by can_message_receive().

◆ rfdt5

__IO uint32_t can_fifo_mailbox_type::rfdt5

Definition at line 566 of file at32f413_can.h.

Referenced by can_message_receive().

◆ rfdt6

__IO uint32_t can_fifo_mailbox_type::rfdt6

Definition at line 567 of file at32f413_can.h.

Referenced by can_message_receive().

◆ rfdt7

__IO uint32_t can_fifo_mailbox_type::rfdt7

Definition at line 568 of file at32f413_can.h.

Referenced by can_message_receive().

◆ rfdth

__IO uint32_t can_fifo_mailbox_type::rfdth

Definition at line 562 of file at32f413_can.h.

◆ [struct]

struct { ... } can_fifo_mailbox_type::rfdth_bit

Referenced by can_message_receive().

◆ rfdtl

__IO uint32_t can_fifo_mailbox_type::rfdtl

Definition at line 535 of file at32f413_can.h.

Referenced by can_message_receive().

◆ [struct]

struct { ... } can_fifo_mailbox_type::rfdtl_bit

Referenced by can_message_receive().

◆ rfeid

__IO uint32_t can_fifo_mailbox_type::rfeid

Definition at line 522 of file at32f413_can.h.

◆ rffmn

__IO uint32_t can_fifo_mailbox_type::rffmn

Definition at line 537 of file at32f413_can.h.

Referenced by can_message_receive().

◆ rffri

__IO uint32_t can_fifo_mailbox_type::rffri

Definition at line 520 of file at32f413_can.h.

Referenced by can_message_receive().

◆ rfi

__IO uint32_t can_fifo_mailbox_type::rfi

Definition at line 516 of file at32f413_can.h.

Referenced by can_message_receive().

◆ [struct]

struct { ... } can_fifo_mailbox_type::rfi_bit

Referenced by can_message_receive().

◆ rfidi

__IO uint32_t can_fifo_mailbox_type::rfidi

Definition at line 521 of file at32f413_can.h.

Referenced by can_message_receive().

◆ rfsid

__IO uint32_t can_fifo_mailbox_type::rfsid

Definition at line 523 of file at32f413_can.h.

Referenced by can_message_receive().

◆ rfts

__IO uint32_t can_fifo_mailbox_type::rfts

Definition at line 538 of file at32f413_can.h.

The documentation for this struct was generated from the following file:
  • at32f413_can.h


AT32F413 Firmwary Library: can_filter_register_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
can_filter_register_type Struct Reference
AT32F413_periph_driver » CAN » CAN_exported_types

can controller area network filter bit register More...

#include <at32f413_can.h>

Data Fields

__IO uint32_t | ffdb1
__IO uint32_t | ffdb2

Detailed Description

can controller area network filter bit register

Definition at line 576 of file at32f413_can.h.

Field Documentation

◆ ffdb1

__IO uint32_t can_filter_register_type::ffdb1

Definition at line 578 of file at32f413_can.h.

Referenced by can_filter_init().

◆ ffdb2

__IO uint32_t can_filter_register_type::ffdb2

Definition at line 579 of file at32f413_can.h.

Referenced by can_filter_init().

The documentation for this struct was generated from the following file:
  • at32f413_can.h


AT32F413 Firmwary Library: can_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
can_type Struct Reference
AT32F413_periph_driver » CAN » CAN_exported_types

type define can register all More...

#include <at32f413_can.h>

Data Fields

union {
__IO uint32_t mctrl
struct {
__IO uint32_t fzen: 1
__IO uint32_t dzen: 1
__IO uint32_t mmssr: 1
__IO uint32_t mdrsel: 1
__IO uint32_t prsfen: 1
__IO uint32_t aeden: 1
__IO uint32_t aeboen: 1
__IO uint32_t ttcen: 1
__IO uint32_t reserved1: 7
__IO uint32_t sprst: 1
__IO uint32_t ptd: 1
__IO uint32_t reserved2: 15
} mctrl_bit
};
can mctrl register, offset:0x00
union {
__IO uint32_t msts
struct {
__IO uint32_t fzc: 1
__IO uint32_t dzc: 1
__IO uint32_t eoif: 1
__IO uint32_t qdzif: 1
__IO uint32_t edzif: 1
__IO uint32_t reserved1: 3
__IO uint32_t cuss: 1
__IO uint32_t curs: 1
__IO uint32_t lsamprx: 1
__IO uint32_t realrx: 1
__IO uint32_t reserved2: 20
} msts_bit
};
can msts register, offset:0x04
union {
__IO uint32_t tsts
struct {
__IO uint32_t tm0tcf: 1
__IO uint32_t tm0tsf: 1
__IO uint32_t tm0alf: 1
__IO uint32_t tm0tef: 1
__IO uint32_t reserved1: 3
__IO uint32_t tm0ct: 1
__IO uint32_t tm1tcf: 1
__IO uint32_t tm1tsf: 1
__IO uint32_t tm1alf: 1
__IO uint32_t tm1tef: 1
__IO uint32_t reserved2: 3
__IO uint32_t tm1ct: 1
__IO uint32_t tm2tcf: 1
__IO uint32_t tm2tsf: 1
__IO uint32_t tm2alf: 1
__IO uint32_t tm2tef: 1
__IO uint32_t reserved3: 3
__IO uint32_t tm2ct: 1
__IO uint32_t tmnr: 2
__IO uint32_t tm0ef: 1
__IO uint32_t tm1ef: 1
__IO uint32_t tm2ef: 1
__IO uint32_t tm0lpf: 1
__IO uint32_t tm1lpf: 1
__IO uint32_t tm2lpf: 1
} tsts_bit
};
can tsts register, offset:0x08
union {
__IO uint32_t rf0
struct {
__IO uint32_t rf0mn: 2
__IO uint32_t reserved1: 1
__IO uint32_t rf0ff: 1
__IO uint32_t rf0of: 1
__IO uint32_t rf0r: 1
__IO uint32_t reserved2: 26
} rf0_bit
};
can rf0 register, offset:0x0C
union {
__IO uint32_t rf1
struct {
__IO uint32_t rf1mn: 2
__IO uint32_t reserved1: 1
__IO uint32_t rf1ff: 1
__IO uint32_t rf1of: 1
__IO uint32_t rf1r: 1
__IO uint32_t reserved2: 26
} rf1_bit
};
can rf1 register, offset:0x10
union {
__IO uint32_t inten
struct {
__IO uint32_t tcien: 1
__IO uint32_t rf0mien: 1
__IO uint32_t rf0fien: 1
__IO uint32_t rf0oien: 1
__IO uint32_t rf1mien: 1
__IO uint32_t rf1fien: 1
__IO uint32_t rf1oien: 1
__IO uint32_t reserved1: 1
__IO uint32_t eaien: 1
__IO uint32_t epien: 1
__IO uint32_t boien: 1
__IO uint32_t etrien: 1
__IO uint32_t reserved2: 3
__IO uint32_t eoien: 1
__IO uint32_t qdzien: 1
__IO uint32_t edzien: 1
__IO uint32_t reserved3: 14
} inten_bit
};
can inten register, offset:0x14
union {
__IO uint32_t ests
struct {
__IO uint32_t eaf: 1
__IO uint32_t epf: 1
__IO uint32_t bof: 1
__IO uint32_t reserved1: 1
__IO uint32_t etr: 3
__IO uint32_t reserved2: 9
__IO uint32_t tec: 8
__IO uint32_t rec: 8
} ests_bit
};
can ests register, offset:0x18
union {
__IO uint32_t btmg
struct {
__IO uint32_t brdiv: 12
__IO uint32_t reserved1: 4
__IO uint32_t bts1: 4
__IO uint32_t bts2: 3
__IO uint32_t reserved2: 1
__IO uint32_t rsaw: 2
__IO uint32_t reserved3: 4
__IO uint32_t lben: 1
__IO uint32_t loen: 1
} btmg_bit
};
can btmg register, offset:0x1C
can_tx_mailbox_type | tx_mailbox [3]
can controller area network tx mailbox register, offset:0x180~0x1AC
can_fifo_mailbox_type | fifo_mailbox [2]
can controller area network fifo mailbox register, offset:0x1B0~0x1CC
union {
__IO uint32_t fctrl
struct {
__IO uint32_t fcs: 1
__IO uint32_t reserved1: 31
} fctrl_bit
};
can fctrl register, offset:0x200
union {
__IO uint32_t fmcfg
struct {
__IO uint32_t fmsel0: 1
__IO uint32_t fmsel1: 1
__IO uint32_t fmsel2: 1
__IO uint32_t fmsel3: 1
__IO uint32_t fmsel4: 1
__IO uint32_t fmsel5: 1
__IO uint32_t fmsel6: 1
__IO uint32_t fmsel7: 1
__IO uint32_t fmsel8: 1
__IO uint32_t fmsel9: 1
__IO uint32_t fmsel10: 1
__IO uint32_t fmsel11: 1
__IO uint32_t fmsel12: 1
__IO uint32_t fmsel13: 1
__IO uint32_t reserved1: 18
} fmcfg_bit
};
can fmcfg register, offset:0x204
union {
__IO uint32_t fbwcfg
struct {
__IO uint32_t fbwsel0: 1
__IO uint32_t fbwsel1: 1
__IO uint32_t fbwsel2: 1
__IO uint32_t fbwsel3: 1
__IO uint32_t fbwsel4: 1
__IO uint32_t fbwsel5: 1
__IO uint32_t fbwsel6: 1
__IO uint32_t fbwsel7: 1
__IO uint32_t fbwsel8: 1
__IO uint32_t fbwsel9: 1
__IO uint32_t fbwsel10: 1
__IO uint32_t fbwsel11: 1
__IO uint32_t fbwsel12: 1
__IO uint32_t fbwsel13: 1
__IO uint32_t reserved1: 18
} fbwcfg_bit
};
can fbwcfg register, offset:0x20C
__IO uint32_t | reserved4
can reserved register, offset:0x210
union {
__IO uint32_t frf
struct {
__IO uint32_t frfsel0: 1
__IO uint32_t frfsel1: 1
__IO uint32_t frfsel2: 1
__IO uint32_t frfsel3: 1
__IO uint32_t frfsel4: 1
__IO uint32_t frfsel5: 1
__IO uint32_t frfsel6: 1
__IO uint32_t frfsel7: 1
__IO uint32_t frfsel8: 1
__IO uint32_t frfsel9: 1
__IO uint32_t frfsel10: 1
__IO uint32_t frfsel11: 1
__IO uint32_t frfsel12: 1
__IO uint32_t frfsel13: 1
__IO uint32_t reserved1: 18
} frf_bit
};
can frf register, offset:0x214
__IO uint32_t | reserved5
can reserved register, offset:0x218
union {
__IO uint32_t facfg
struct {
__IO uint32_t faen0: 1
__IO uint32_t faen1: 1
__IO uint32_t faen2: 1
__IO uint32_t faen3: 1
__IO uint32_t faen4: 1
__IO uint32_t faen5: 1
__IO uint32_t faen6: 1
__IO uint32_t faen7: 1
__IO uint32_t faen8: 1
__IO uint32_t faen9: 1
__IO uint32_t faen10: 1
__IO uint32_t faen11: 1
__IO uint32_t faen12: 1
__IO uint32_t faen13: 1
__IO uint32_t reserved1: 18
} facfg_bit
};
can facfg register, offset:0x21C
__IO uint32_t | reserved6 [8]
can reserved register, offset:0x220~0x23C
can_filter_register_type | ffb [14]
can ffb register, offset:0x240~0x2AC

Detailed Description

type define can register all

Definition at line 585 of file at32f413_can.h.

Field Documentation

◆ [union]

union { ... } can_type

can mctrl register, offset:0x00

◆ [union]

union { ... } can_type

can msts register, offset:0x04

◆ [union]

union { ... } can_type

can tsts register, offset:0x08

◆ [union]

union { ... } can_type

can rf0 register, offset:0x0C

◆ [union]

union { ... } can_type

can rf1 register, offset:0x10

◆ [union]

union { ... } can_type

can inten register, offset:0x14

◆ [union]

union { ... } can_type

can ests register, offset:0x18

◆ [union]

union { ... } can_type

can btmg register, offset:0x1C

◆ [union]

union { ... } can_type

can fctrl register, offset:0x200

◆ [union]

union { ... } can_type

can fmcfg register, offset:0x204

◆ [union]

union { ... } can_type

can fbwcfg register, offset:0x20C

◆ [union]

union { ... } can_type

can frf register, offset:0x214

◆ [union]

union { ... } can_type

can facfg register, offset:0x21C

◆ aeboen

__IO uint32_t can_type::aeboen

Definition at line 602 of file at32f413_can.h.

Referenced by can_base_init().

◆ aeden

__IO uint32_t can_type::aeden

Definition at line 601 of file at32f413_can.h.

Referenced by can_base_init().

◆ bof

__IO uint32_t can_type::bof

Definition at line 741 of file at32f413_can.h.

Referenced by can_flag_get().

◆ boien

__IO uint32_t can_type::boien

Definition at line 721 of file at32f413_can.h.

Referenced by can_interrupt_flag_get().

◆ brdiv

__IO uint32_t can_type::brdiv

Definition at line 758 of file at32f413_can.h.

Referenced by can_baudrate_set().

◆ btmg

__IO uint32_t can_type::btmg

Definition at line 755 of file at32f413_can.h.

◆ [struct]

struct { ... } can_type::btmg_bit

Referenced by can_base_init(), and can_baudrate_set().

◆ bts1

__IO uint32_t can_type::bts1

Definition at line 760 of file at32f413_can.h.

Referenced by can_baudrate_set().

◆ bts2

__IO uint32_t can_type::bts2

Definition at line 761 of file at32f413_can.h.

Referenced by can_baudrate_set().

◆ curs

__IO uint32_t can_type::curs

Definition at line 626 of file at32f413_can.h.

◆ cuss

__IO uint32_t can_type::cuss

Definition at line 625 of file at32f413_can.h.

◆ dzc

__IO uint32_t can_type::dzc

Definition at line 620 of file at32f413_can.h.

Referenced by can_doze_mode_enter(), can_doze_mode_exit(), can_flag_get(), and can_operating_mode_set().

◆ dzen

__IO uint32_t can_type::dzen

Definition at line 597 of file at32f413_can.h.

Referenced by can_base_init(), can_baudrate_set(), can_doze_mode_enter(), can_doze_mode_exit(), and can_operating_mode_set().

◆ eaf

__IO uint32_t can_type::eaf

Definition at line 739 of file at32f413_can.h.

Referenced by can_flag_get().

◆ eaien

__IO uint32_t can_type::eaien

Definition at line 719 of file at32f413_can.h.

Referenced by can_interrupt_flag_get().

◆ edzien

__IO uint32_t can_type::edzien

Definition at line 726 of file at32f413_can.h.

Referenced by can_interrupt_flag_get().

◆ edzif

__IO uint32_t can_type::edzif

Definition at line 623 of file at32f413_can.h.

Referenced by can_flag_get().

◆ eoien

__IO uint32_t can_type::eoien

Definition at line 724 of file at32f413_can.h.

Referenced by can_interrupt_flag_get().

◆ eoif

__IO uint32_t can_type::eoif

Definition at line 621 of file at32f413_can.h.

Referenced by can_flag_get().

◆ epf

__IO uint32_t can_type::epf

Definition at line 740 of file at32f413_can.h.

Referenced by can_flag_get().

◆ epien

__IO uint32_t can_type::epien

Definition at line 720 of file at32f413_can.h.

Referenced by can_interrupt_flag_get().

◆ ests

__IO uint32_t can_type::ests

Definition at line 736 of file at32f413_can.h.

Referenced by can_flag_clear().

◆ [struct]

struct { ... } can_type::ests_bit

Referenced by can_error_type_record_get(), can_flag_get(), can_receive_error_counter_get(), and can_transmit_error_counter_get().

◆ etr

__IO uint32_t can_type::etr

Definition at line 743 of file at32f413_can.h.

Referenced by can_error_type_record_get(), and can_flag_get().

◆ etrien

__IO uint32_t can_type::etrien

Definition at line 722 of file at32f413_can.h.

Referenced by can_interrupt_flag_get().

◆ facfg

__IO uint32_t can_type::facfg

Definition at line 901 of file at32f413_can.h.

Referenced by can_filter_init().

◆ [struct]

struct { ... } can_type::facfg_bit

◆ faen0

__IO uint32_t can_type::faen0

Definition at line 904 of file at32f413_can.h.

◆ faen1

__IO uint32_t can_type::faen1

Definition at line 905 of file at32f413_can.h.

◆ faen10

__IO uint32_t can_type::faen10

Definition at line 914 of file at32f413_can.h.

◆ faen11

__IO uint32_t can_type::faen11

Definition at line 915 of file at32f413_can.h.

◆ faen12

__IO uint32_t can_type::faen12

Definition at line 916 of file at32f413_can.h.

◆ faen13

__IO uint32_t can_type::faen13

Definition at line 917 of file at32f413_can.h.

◆ faen2

__IO uint32_t can_type::faen2

Definition at line 906 of file at32f413_can.h.

◆ faen3

__IO uint32_t can_type::faen3

Definition at line 907 of file at32f413_can.h.

◆ faen4

__IO uint32_t can_type::faen4

Definition at line 908 of file at32f413_can.h.

◆ faen5

__IO uint32_t can_type::faen5

Definition at line 909 of file at32f413_can.h.

◆ faen6

__IO uint32_t can_type::faen6

Definition at line 910 of file at32f413_can.h.

◆ faen7

__IO uint32_t can_type::faen7

Definition at line 911 of file at32f413_can.h.

◆ faen8

__IO uint32_t can_type::faen8

Definition at line 912 of file at32f413_can.h.

◆ faen9

__IO uint32_t can_type::faen9

Definition at line 913 of file at32f413_can.h.

◆ fbwcfg

__IO uint32_t can_type::fbwcfg

Definition at line 839 of file at32f413_can.h.

Referenced by can_filter_init().

◆ [struct]

struct { ... } can_type::fbwcfg_bit

◆ fbwsel0

__IO uint32_t can_type::fbwsel0

Definition at line 842 of file at32f413_can.h.

◆ fbwsel1

__IO uint32_t can_type::fbwsel1

Definition at line 843 of file at32f413_can.h.

◆ fbwsel10

__IO uint32_t can_type::fbwsel10

Definition at line 852 of file at32f413_can.h.

◆ fbwsel11

__IO uint32_t can_type::fbwsel11

Definition at line 853 of file at32f413_can.h.

◆ fbwsel12

__IO uint32_t can_type::fbwsel12

Definition at line 854 of file at32f413_can.h.

◆ fbwsel13

__IO uint32_t can_type::fbwsel13

Definition at line 855 of file at32f413_can.h.

◆ fbwsel2

__IO uint32_t can_type::fbwsel2

Definition at line 844 of file at32f413_can.h.

◆ fbwsel3

__IO uint32_t can_type::fbwsel3

Definition at line 845 of file at32f413_can.h.

◆ fbwsel4

__IO uint32_t can_type::fbwsel4

Definition at line 846 of file at32f413_can.h.

◆ fbwsel5

__IO uint32_t can_type::fbwsel5

Definition at line 847 of file at32f413_can.h.

◆ fbwsel6

__IO uint32_t can_type::fbwsel6

Definition at line 848 of file at32f413_can.h.

◆ fbwsel7

__IO uint32_t can_type::fbwsel7

Definition at line 849 of file at32f413_can.h.

◆ fbwsel8

__IO uint32_t can_type::fbwsel8

Definition at line 850 of file at32f413_can.h.

◆ fbwsel9

__IO uint32_t can_type::fbwsel9

Definition at line 851 of file at32f413_can.h.

◆ fcs

__IO uint32_t can_type::fcs

Definition at line 798 of file at32f413_can.h.

Referenced by can_filter_init().

◆ fctrl

__IO uint32_t can_type::fctrl

Definition at line 795 of file at32f413_can.h.

◆ [struct]

struct { ... } can_type::fctrl_bit

Referenced by can_filter_init().

◆ ffb

can_filter_register_type can_type::ffb[14]

can ffb register, offset:0x240~0x2AC

Definition at line 930 of file at32f413_can.h.

Referenced by can_filter_init().

◆ fifo_mailbox

can_fifo_mailbox_type can_type::fifo_mailbox[2]

can controller area network fifo mailbox register, offset:0x1B0~0x1CC

Definition at line 783 of file at32f413_can.h.

Referenced by can_message_receive().

◆ fmcfg

__IO uint32_t can_type::fmcfg

Definition at line 808 of file at32f413_can.h.

Referenced by can_filter_init().

◆ [struct]

struct { ... } can_type::fmcfg_bit

◆ fmsel0

__IO uint32_t can_type::fmsel0

Definition at line 811 of file at32f413_can.h.

◆ fmsel1

__IO uint32_t can_type::fmsel1

Definition at line 812 of file at32f413_can.h.

◆ fmsel10

__IO uint32_t can_type::fmsel10

Definition at line 821 of file at32f413_can.h.

◆ fmsel11

__IO uint32_t can_type::fmsel11

Definition at line 822 of file at32f413_can.h.

◆ fmsel12

__IO uint32_t can_type::fmsel12

Definition at line 823 of file at32f413_can.h.

◆ fmsel13

__IO uint32_t can_type::fmsel13

Definition at line 824 of file at32f413_can.h.

◆ fmsel2

__IO uint32_t can_type::fmsel2

Definition at line 813 of file at32f413_can.h.

◆ fmsel3

__IO uint32_t can_type::fmsel3

Definition at line 814 of file at32f413_can.h.

◆ fmsel4

__IO uint32_t can_type::fmsel4

Definition at line 815 of file at32f413_can.h.

◆ fmsel5

__IO uint32_t can_type::fmsel5

Definition at line 816 of file at32f413_can.h.

◆ fmsel6

__IO uint32_t can_type::fmsel6

Definition at line 817 of file at32f413_can.h.

◆ fmsel7

__IO uint32_t can_type::fmsel7

Definition at line 818 of file at32f413_can.h.

◆ fmsel8

__IO uint32_t can_type::fmsel8

Definition at line 819 of file at32f413_can.h.

◆ fmsel9

__IO uint32_t can_type::fmsel9

Definition at line 820 of file at32f413_can.h.

◆ frf

__IO uint32_t can_type::frf

Definition at line 870 of file at32f413_can.h.

Referenced by can_filter_init().

◆ [struct]

struct { ... } can_type::frf_bit

◆ frfsel0

__IO uint32_t can_type::frfsel0

Definition at line 873 of file at32f413_can.h.

◆ frfsel1

__IO uint32_t can_type::frfsel1

Definition at line 874 of file at32f413_can.h.

◆ frfsel10

__IO uint32_t can_type::frfsel10

Definition at line 883 of file at32f413_can.h.

◆ frfsel11

__IO uint32_t can_type::frfsel11

Definition at line 884 of file at32f413_can.h.

◆ frfsel12

__IO uint32_t can_type::frfsel12

Definition at line 885 of file at32f413_can.h.

◆ frfsel13

__IO uint32_t can_type::frfsel13

Definition at line 886 of file at32f413_can.h.

◆ frfsel2

__IO uint32_t can_type::frfsel2

Definition at line 875 of file at32f413_can.h.

◆ frfsel3

__IO uint32_t can_type::frfsel3

Definition at line 876 of file at32f413_can.h.

◆ frfsel4

__IO uint32_t can_type::frfsel4

Definition at line 877 of file at32f413_can.h.

◆ frfsel5

__IO uint32_t can_type::frfsel5

Definition at line 878 of file at32f413_can.h.

◆ frfsel6

__IO uint32_t can_type::frfsel6

Definition at line 879 of file at32f413_can.h.

◆ frfsel7

__IO uint32_t can_type::frfsel7

Definition at line 880 of file at32f413_can.h.

◆ frfsel8

__IO uint32_t can_type::frfsel8

Definition at line 881 of file at32f413_can.h.

◆ frfsel9

__IO uint32_t can_type::frfsel9

Definition at line 882 of file at32f413_can.h.

◆ fzc

__IO uint32_t can_type::fzc

Definition at line 619 of file at32f413_can.h.

Referenced by can_base_init(), can_baudrate_set(), can_doze_mode_enter(), and can_operating_mode_set().

◆ fzen

__IO uint32_t can_type::fzen

Definition at line 596 of file at32f413_can.h.

Referenced by can_base_init(), can_baudrate_set(), can_doze_mode_enter(), and can_operating_mode_set().

◆ inten

__IO uint32_t can_type::inten

Definition at line 708 of file at32f413_can.h.

Referenced by can_interrupt_enable().

◆ [struct]

struct { ... } can_type::inten_bit

Referenced by can_interrupt_flag_get().

◆ lben

__IO uint32_t can_type::lben

Definition at line 765 of file at32f413_can.h.

Referenced by can_base_init().

◆ loen

__IO uint32_t can_type::loen

Definition at line 766 of file at32f413_can.h.

Referenced by can_base_init().

◆ lsamprx

__IO uint32_t can_type::lsamprx

Definition at line 627 of file at32f413_can.h.

◆ mctrl

__IO uint32_t can_type::mctrl

Definition at line 593 of file at32f413_can.h.

◆ [struct]

struct { ... } can_type::mctrl_bit

Referenced by can_base_init(), can_baudrate_set(), can_debug_transmission_prohibit(), can_doze_mode_enter(), can_doze_mode_exit(), can_operating_mode_set(), and can_ttc_mode_enable().

◆ mdrsel

__IO uint32_t can_type::mdrsel

Definition at line 599 of file at32f413_can.h.

Referenced by can_base_init().

◆ mmssr

__IO uint32_t can_type::mmssr

Definition at line 598 of file at32f413_can.h.

Referenced by can_base_init().

◆ msts

__IO uint32_t can_type::msts

Definition at line 616 of file at32f413_can.h.

Referenced by can_flag_clear().

◆ [struct]

struct { ... } can_type::msts_bit

Referenced by can_base_init(), can_baudrate_set(), can_doze_mode_enter(), can_doze_mode_exit(), can_flag_get(), and can_operating_mode_set().

◆ prsfen

__IO uint32_t can_type::prsfen

Definition at line 600 of file at32f413_can.h.

Referenced by can_base_init().

◆ ptd

__IO uint32_t can_type::ptd

Definition at line 606 of file at32f413_can.h.

Referenced by can_debug_transmission_prohibit().

◆ qdzien

__IO uint32_t can_type::qdzien

Definition at line 725 of file at32f413_can.h.

Referenced by can_interrupt_flag_get().

◆ qdzif

__IO uint32_t can_type::qdzif

Definition at line 622 of file at32f413_can.h.

Referenced by can_flag_get().

◆ realrx

__IO uint32_t can_type::realrx

Definition at line 628 of file at32f413_can.h.

◆ rec

__IO uint32_t can_type::rec

Definition at line 746 of file at32f413_can.h.

Referenced by can_receive_error_counter_get().

◆ reserved1

__IO uint32_t can_type::reserved1

can reserved register, offset:0x20~0x17C

Definition at line 604 of file at32f413_can.h.

◆ reserved2

__IO uint32_t can_type::reserved2

can reserved register, offset:0x1D0~0x1FC

Definition at line 607 of file at32f413_can.h.

◆ reserved3

__IO uint32_t can_type::reserved3

can reserved register, offset:0x208

Definition at line 657 of file at32f413_can.h.

◆ reserved4

__IO uint32_t can_type::reserved4

can reserved register, offset:0x210

Definition at line 863 of file at32f413_can.h.

◆ reserved5

__IO uint32_t can_type::reserved5

can reserved register, offset:0x218

Definition at line 894 of file at32f413_can.h.

◆ reserved6

__IO uint32_t can_type::reserved6[8]

can reserved register, offset:0x220~0x23C

Definition at line 925 of file at32f413_can.h.

◆ rf0

__IO uint32_t can_type::rf0

Definition at line 674 of file at32f413_can.h.

Referenced by can_flag_clear(), and can_receive_fifo_release().

◆ [struct]

struct { ... } can_type::rf0_bit

Referenced by can_flag_get(), and can_receive_message_pending_get().

◆ rf0ff

__IO uint32_t can_type::rf0ff

Definition at line 679 of file at32f413_can.h.

Referenced by can_flag_get().

◆ rf0fien

__IO uint32_t can_type::rf0fien

Definition at line 713 of file at32f413_can.h.

Referenced by can_interrupt_flag_get().

◆ rf0mien

__IO uint32_t can_type::rf0mien

Definition at line 712 of file at32f413_can.h.

Referenced by can_interrupt_flag_get().

◆ rf0mn

__IO uint32_t can_type::rf0mn

Definition at line 677 of file at32f413_can.h.

Referenced by can_flag_get(), and can_receive_message_pending_get().

◆ rf0of

__IO uint32_t can_type::rf0of

Definition at line 680 of file at32f413_can.h.

Referenced by can_flag_get().

◆ rf0oien

__IO uint32_t can_type::rf0oien

Definition at line 714 of file at32f413_can.h.

Referenced by can_interrupt_flag_get().

◆ rf0r

__IO uint32_t can_type::rf0r

Definition at line 681 of file at32f413_can.h.

◆ rf1

__IO uint32_t can_type::rf1

Definition at line 691 of file at32f413_can.h.

Referenced by can_flag_clear(), and can_receive_fifo_release().

◆ [struct]

struct { ... } can_type::rf1_bit

Referenced by can_flag_get(), and can_receive_message_pending_get().

◆ rf1ff

__IO uint32_t can_type::rf1ff

Definition at line 696 of file at32f413_can.h.

Referenced by can_flag_get().

◆ rf1fien

__IO uint32_t can_type::rf1fien

Definition at line 716 of file at32f413_can.h.

Referenced by can_interrupt_flag_get().

◆ rf1mien

__IO uint32_t can_type::rf1mien

Definition at line 715 of file at32f413_can.h.

Referenced by can_interrupt_flag_get().

◆ rf1mn

__IO uint32_t can_type::rf1mn

Definition at line 694 of file at32f413_can.h.

Referenced by can_flag_get(), and can_receive_message_pending_get().

◆ rf1of

__IO uint32_t can_type::rf1of

Definition at line 697 of file at32f413_can.h.

Referenced by can_flag_get().

◆ rf1oien

__IO uint32_t can_type::rf1oien

Definition at line 717 of file at32f413_can.h.

Referenced by can_interrupt_flag_get().

◆ rf1r

__IO uint32_t can_type::rf1r

Definition at line 698 of file at32f413_can.h.

◆ rsaw

__IO uint32_t can_type::rsaw

Definition at line 763 of file at32f413_can.h.

Referenced by can_baudrate_set().

◆ sprst

__IO uint32_t can_type::sprst

Definition at line 605 of file at32f413_can.h.

◆ tcien

__IO uint32_t can_type::tcien

Definition at line 711 of file at32f413_can.h.

Referenced by can_interrupt_flag_get().

◆ tec

__IO uint32_t can_type::tec

Definition at line 745 of file at32f413_can.h.

Referenced by can_transmit_error_counter_get().

◆ tm0alf

__IO uint32_t can_type::tm0alf

Definition at line 643 of file at32f413_can.h.

◆ tm0ct

__IO uint32_t can_type::tm0ct

Definition at line 646 of file at32f413_can.h.

◆ tm0ef

__IO uint32_t can_type::tm0ef

Definition at line 660 of file at32f413_can.h.

Referenced by can_flag_get(), and can_message_transmit().

◆ tm0lpf

__IO uint32_t can_type::tm0lpf

Definition at line 663 of file at32f413_can.h.

◆ tm0tcf

__IO uint32_t can_type::tm0tcf

Definition at line 641 of file at32f413_can.h.

Referenced by can_flag_get(), and can_transmit_status_get().

◆ tm0tef

__IO uint32_t can_type::tm0tef

Definition at line 644 of file at32f413_can.h.

◆ tm0tsf

__IO uint32_t can_type::tm0tsf

Definition at line 642 of file at32f413_can.h.

Referenced by can_transmit_status_get().

◆ tm1alf

__IO uint32_t can_type::tm1alf

Definition at line 649 of file at32f413_can.h.

◆ tm1ct

__IO uint32_t can_type::tm1ct

Definition at line 652 of file at32f413_can.h.

◆ tm1ef

__IO uint32_t can_type::tm1ef

Definition at line 661 of file at32f413_can.h.

Referenced by can_flag_get(), and can_message_transmit().

◆ tm1lpf

__IO uint32_t can_type::tm1lpf

Definition at line 664 of file at32f413_can.h.

◆ tm1tcf

__IO uint32_t can_type::tm1tcf

Definition at line 647 of file at32f413_can.h.

Referenced by can_flag_get(), and can_transmit_status_get().

◆ tm1tef

__IO uint32_t can_type::tm1tef

Definition at line 650 of file at32f413_can.h.

◆ tm1tsf

__IO uint32_t can_type::tm1tsf

Definition at line 648 of file at32f413_can.h.

Referenced by can_transmit_status_get().

◆ tm2alf

__IO uint32_t can_type::tm2alf

Definition at line 655 of file at32f413_can.h.

◆ tm2ct

__IO uint32_t can_type::tm2ct

Definition at line 658 of file at32f413_can.h.

◆ tm2ef

__IO uint32_t can_type::tm2ef

Definition at line 662 of file at32f413_can.h.

Referenced by can_flag_get(), and can_message_transmit().

◆ tm2lpf

__IO uint32_t can_type::tm2lpf

Definition at line 665 of file at32f413_can.h.

◆ tm2tcf

__IO uint32_t can_type::tm2tcf

Definition at line 653 of file at32f413_can.h.

Referenced by can_flag_get(), and can_transmit_status_get().

◆ tm2tef

__IO uint32_t can_type::tm2tef

Definition at line 656 of file at32f413_can.h.

◆ tm2tsf

__IO uint32_t can_type::tm2tsf

Definition at line 654 of file at32f413_can.h.

Referenced by can_transmit_status_get().

◆ tmnr

__IO uint32_t can_type::tmnr

Definition at line 659 of file at32f413_can.h.

◆ tsts

__IO uint32_t can_type::tsts

Definition at line 638 of file at32f413_can.h.

Referenced by can_flag_clear(), and can_transmit_cancel().

◆ [struct]

struct { ... } can_type::tsts_bit

Referenced by can_flag_get(), can_message_transmit(), and can_transmit_status_get().

◆ ttcen

__IO uint32_t can_type::ttcen

Definition at line 603 of file at32f413_can.h.

Referenced by can_base_init(), and can_ttc_mode_enable().

◆ tx_mailbox

can_tx_mailbox_type can_type::tx_mailbox[3]

can controller area network tx mailbox register, offset:0x180~0x1AC

Definition at line 778 of file at32f413_can.h.

Referenced by can_message_transmit(), and can_ttc_mode_enable().

The documentation for this struct was generated from the following file:
  • at32f413_can.h


AT32F413 Firmwary Library: CAN_exported_functions

Functions
CAN_exported_functions
AT32F413_periph_driver » CAN

Functions

void | can_reset (can_type *can_x)
deinitialize the can peripheral registers to their default reset values.
void | can_baudrate_default_para_init (can_baudrate_type *can_baudrate_struct)
fill each can_baudrate_struct member with its default value.
error_status | can_baudrate_set (can_type *can_x, can_baudrate_type *can_baudrate_struct)
set the baudrate of the can peripheral
void | can_default_para_init (can_base_type *can_base_struct)
fill each can_init_struct member with its default value.
error_status | can_base_init (can_type *can_x, can_base_type *can_base_struct)
initialize the can peripheral according to the specified parameters in the can_init_struct.
void | can_filter_default_para_init (can_filter_init_type *can_filter_init_struct)
fill each can_filter_init_struct member with its default value.
void | can_filter_init (can_type *can_x, can_filter_init_type *can_filter_init_struct)
initialize the can peripheral according to the specified parameters in the can_filter_init_struct.
void | can_debug_transmission_prohibit (can_type *can_x, confirm_state new_state)
enable or disable the debug transmission prohibit of the specified can peripheral.
void | can_ttc_mode_enable (can_type *can_x, confirm_state new_state)
enable or disable time trigger operation communication mode of the specified can peripheral.
uint8_t | can_message_transmit (can_type *can_x, can_tx_message_type *tx_message_struct)
fill the transmission message and transmit of the specified can peripheral.
can_transmit_status_type | can_transmit_status_get (can_type *can_x, can_tx_mailbox_num_type transmit_mailbox)
check the transmission state of the specified can peripheral.
void | can_transmit_cancel (can_type *can_x, can_tx_mailbox_num_type transmit_mailbox)
cancel a transmit request of the specified can peripheral.
void | can_message_receive (can_type *can_x, can_rx_fifo_num_type fifo_number, can_rx_message_type *rx_message_struct)
receive message of the specified can peripheral.
void | can_receive_fifo_release (can_type *can_x, can_rx_fifo_num_type fifo_number)
release the specified fifo of the specified can peripheral.
uint8_t | can_receive_message_pending_get (can_type *can_x, can_rx_fifo_num_type fifo_number)
return the number of pending messages of the specified can peripheral.
error_status | can_operating_mode_set (can_type *can_x, can_operating_mode_type can_operating_mode)
set the operation mode of the specified can peripheral.
can_enter_doze_status_type | can_doze_mode_enter (can_type *can_x)
enter the low power mode of the specified can peripheral.
can_quit_doze_status_type | can_doze_mode_exit (can_type *can_x)
exit the doze mode of the specified can peripheral.
can_error_record_type | can_error_type_record_get (can_type *can_x)
return the error type record (etr) of the specified can peripheral.
uint8_t | can_receive_error_counter_get (can_type *can_x)
return the receive error counter (rec) of the specified can peripheral.
uint8_t | can_transmit_error_counter_get (can_type *can_x)
return the transmit error counter of the specified can peripheral.
void | can_interrupt_enable (can_type *can_x, uint32_t can_int, confirm_state new_state)
enable or disable the interrupt of the specified can peripheral.
flag_status | can_interrupt_flag_get (can_type *can_x, uint32_t can_flag)
get interrupt flag of the specified can peripheral.
flag_status | can_flag_get (can_type *can_x, uint32_t can_flag)
get flag of the specified can peripheral.
void | can_flag_clear (can_type *can_x, uint32_t can_flag)
clear flag of the specified can peripheral.

Detailed Description

Function Documentation

◆ can_base_init()

error_status can_base_init | ( | can_type * | can_x,
 |  | can_base_type * | can_base_struct )

initialize the can peripheral according to the specified parameters in the can_init_struct.

Parameters
can_x | select the can peripheral. this parameter can be one of the following values: CAN1,CAN2.
can_base_struct | pointer to a can_base_struct structure that contains the configuration information for the can peripheral.
Return values
the status of initialization this parameter can be one of the following values: SUCCESS or ERROR

< time out for fzc bit

< time out for fzc bit

Definition at line 196 of file at32f413_can.c.

Referenced by can_configuration().

◆ can_baudrate_default_para_init()

void can_baudrate_default_para_init ( can_baudrate_type * can_baudrate_struct )

fill each can_baudrate_struct member with its default value.

Parameters
can_baudrate_struct pointer to a can_baudrate_type structure which will be initialized.
Return values
none.

Definition at line 72 of file at32f413_can.c.

◆ can_baudrate_set()

error_status can_baudrate_set | ( | can_type * | can_x,
 |  | can_baudrate_type * | can_baudrate_struct )

set the baudrate of the can peripheral

Parameters
can_x | select the can peripheral. this parameter can be one of the following values: CAN1,CAN2.
can_baudrate_struct | pointer to a can_baudrate_type structure which will be set.
Note
baudrate calculate method is: baudrate = fpclk/(baudrate_div *(3 + bts1_size + bts2_size))
Return values
the result of baudrate set this parameter can be one of the following values: SUCCESS or ERROR

< time out for fzc bit

< time out for fzc bit

Definition at line 101 of file at32f413_can.c.

Referenced by can_configuration().

◆ can_debug_transmission_prohibit()

void can_debug_transmission_prohibit | ( | can_type * | can_x,
 |  | confirm_state | new_state )

enable or disable the debug transmission prohibit of the specified can peripheral.

Parameters
can_x | select the can peripheral. this parameter can be one of the following values: CAN1,CAN2.
new_state | new state of debug transmission prohibit. this parameter can be: TRUE or FALSE.
Return values
none.

Definition at line 397 of file at32f413_can.c.

◆ can_default_para_init()

void can_default_para_init ( can_base_type * can_base_struct )

fill each can_init_struct member with its default value.

Parameters
can_base_struct pointer to a can_base_type structure which will be initialized.
Return values
none.

Definition at line 159 of file at32f413_can.c.

Referenced by can_configuration().

◆ can_doze_mode_enter()

can_enter_doze_status_type can_doze_mode_enter ( can_type * can_x )

enter the low power mode of the specified can peripheral.

Parameters
can_x select the can peripheral. this parameter can be one of the following values: CAN1,CAN2.
Return values
status of doze mode enter, the returned value can be:
  • CAN_ENTER_DOZE_SUCCESSFUL <it meaning enter the doze mode succeed>
  • CAN_ENTER_DOZE_FAILED <it meaning enter the doze mode failed>

< time out for fzc bit

Definition at line 805 of file at32f413_can.c.

◆ can_doze_mode_exit()

can_quit_doze_status_type can_doze_mode_exit ( can_type * can_x )

exit the doze mode of the specified can peripheral.

Parameters
can_x select the can peripheral. this parameter can be one of the following values: CAN1,CAN2.
Return values
status of doze mode enter, the returned value can be:
  • CAN_QUIT_DOZE_SUCCESSFUL <it meaning exit the doze mode succeed>
  • CAN_QUIT_DOZE_FAILED <it meaning exit the doze mode failed>

< time out for dzc bit

Definition at line 835 of file at32f413_can.c.

◆ can_error_type_record_get()

can_error_record_type can_error_type_record_get ( can_type * can_x )

return the error type record (etr) of the specified can peripheral.

Parameters
can_x select the can peripheral. this parameter can be one of the following values: CAN1,CAN2.
Return values
the value of the error code the return can be one of the follow values:
  • CAN_ERRORRECORD_NOERR
  • CAN_ERRORRECORD_STUFFERR,
  • CAN_ERRORRECORD_FORMERR,
  • CAN_ERRORRECORD_ACKERR,
  • CAN_ERRORRECORD_BITRECESSIVEERR,
  • CAN_ERRORRECORD_BITDOMINANTERR,
  • CAN_ERRORRECORD_CRCERR,
  • CAN_ERRORRECORD_SOFTWARESETERR

Definition at line 867 of file at32f413_can.c.

◆ can_filter_default_para_init()

void can_filter_default_para_init ( can_filter_init_type * can_filter_init_struct )

fill each can_filter_init_struct member with its default value.

Parameters
can_filter_init_struct pointer to a can_filter_init_type structure which will be initialized.
Return values
none.

Definition at line 271 of file at32f413_can.c.

◆ can_filter_init()

void can_filter_init | ( | can_type * | can_x,
 |  | can_filter_init_type * | can_filter_init_struct )

initialize the can peripheral according to the specified parameters in the can_filter_init_struct.

Parameters
can_x | select the can peripheral. this parameter can be one of the following values: CAN1,CAN2.
can_filter_init_struct | pointer to a can_filter_init_type structure that contains the configuration information.
Return values
none.

Definition at line 306 of file at32f413_can.c.

Referenced by can_configuration().

◆ can_flag_clear()

void can_flag_clear | ( | can_type * | can_x,
 |  | uint32_t | can_flag )

clear flag of the specified can peripheral.

Parameters
can_x select the can peripheral. this parameter can be one of the following values: CAN1,CAN2.
can_flag select the flag. this parameter can be one of the following flags:
  • CAN_EAF_FLAG
  • CAN_EPF_FLAG
  • CAN_BOF_FLAG
  • CAN_ETR_FLAG
  • CAN_EOIF_FLAG
  • CAN_TM0TCF_FLAG
  • CAN_TM1TCF_FLAG
  • CAN_TM2TCF_FLAG
  • CAN_RF0FF_FLAG
  • CAN_RF0OF_FLAG
  • CAN_RF1FF_FLAG
  • CAN_RF1OF_FLAG
  • CAN_QDZIF_FLAG
  • CAN_EDZC_FLAG
  • CAN_TMEF_FLAG
  • CAN_ETR_SOFTWARE_FLAG note:CAN_RF0MN_FLAG and CAN_RF1MN_FLAG can not clear by this function
Return values
none.

< error active flag

< error passive flag

< bus-off flag

< error occur interrupt flag

< eoif bit value, it clear by writing 1

< error type record flag

< eoif bit value, it clear by writing 1

< transmit mailbox 0 transmission completed flag

< tm0tcf bit value, it clear by writing 1

< transmit mailbox 1 transmission completed flag

< tm1tcf bit value, it clear by writing 1

< transmit mailbox 2 transmission completed flag

< tm2tcf bit value, it clear by writing 1

< receive fifo 0 full flag

< rf0ff bit value, it clear by writing 1

< receive fifo 0 overflow flag

< rf0of bit value, it clear by writing 1

< receive fifo 1 full flag

< rf1ff bit value, it clear by writing 1

< receive fifo 1 overflow flag

< rf1of bit value, it clear by writing 1

< quit doze mode interrupt flag

< qdzif bit value, it clear by writing 1

< enter doze mode confirm flag

< edzif bit value, it clear by writing 1

< transmit mailbox empty flag

< tm0tcf bit value, it clear by writing 1

< tm1tcf bit value, it clear by writing 1

< tm2tcf bit value, it clear by writing 1

Definition at line 1188 of file at32f413_can.c.

Referenced by CAN1_SE_IRQHandler().

◆ can_flag_get()

flag_status can_flag_get | ( | can_type * | can_x,
 |  | uint32_t | can_flag )

get flag of the specified can peripheral.

Parameters
can_x select the can peripheral. this parameter can be one of the following values: CAN1,CAN2.
can_flag select the flag. this parameter can be one of the following flags:
  • CAN_EAF_FLAG
  • CAN_EPF_FLAG
  • CAN_BOF_FLAG
  • CAN_ETR_FLAG
  • CAN_EOIF_FLAG
  • CAN_TM0TCF_FLAG
  • CAN_TM1TCF_FLAG
  • CAN_TM2TCF_FLAG
  • CAN_RF0MN_FLAG
  • CAN_RF0FF_FLAG
  • CAN_RF0OF_FLAG
  • CAN_RF1MN_FLAG
  • CAN_RF1FF_FLAG
  • CAN_RF1OF_FLAG
  • CAN_QDZIF_FLAG
  • CAN_EDZC_FLAG
  • CAN_TMEF_FLAG note:the state of CAN_EDZC_FLAG need to check dzc and edzif bit note:the state of CAN_TMEF_FLAG need to check rqc0,rqc1 and rqc2 bit
Return values
status of can_flag, the returned value can be:SET or RESET.

< error active flag

< error passive flag

< bus-off flag

< error type record flag

< error occur interrupt flag

< transmit mailbox 0 transmission completed flag

< transmit mailbox 1 transmission completed flag

< transmit mailbox 2 transmission completed flag

< receive fifo 0 message num flag

< receive fifo 0 full flag

< receive fifo 0 overflow flag

< receive fifo 1 message num flag

< receive fifo 1 full flag

< receive fifo 1 overflow flag

< quit doze mode interrupt flag

< enter doze mode confirm flag

< transmit mailbox empty flag

Definition at line 1064 of file at32f413_can.c.

Referenced by can_interrupt_flag_get().

◆ can_interrupt_enable()

void can_interrupt_enable | ( | can_type * | can_x,
 |  | uint32_t | can_int,
 |  | confirm_state | new_state )

enable or disable the interrupt of the specified can peripheral.

Parameters
can_x | select the can peripheral. this parameter can be one of the following values: CAN1,CAN2.
can_int specifies the can interrupt sources to be enabled or disabled. this parameter can be one of the following values:
  • CAN_TCIEN_INT
  • CAN_RF0MIEN_INT
  • CAN_RF0FIEN_INT
  • CAN_RF0OIEN_INT
  • CAN_RF1MIEN_INT
  • CAN_RF1FIEN_INT
  • CAN_RF1OIEN_INT
  • CAN_EAIEN_INT
  • CAN_EPIEN_INT
  • CAN_BOIEN_INT
  • CAN_ETRIEN_INT
  • CAN_EOIEN_INT
  • CAN_QDZIEN_INT
  • CAN_EDZIEN_INT
new_state | new state of the can interrupts. this parameter can be: TRUE or FALSE.
Return values
none.

Definition at line 928 of file at32f413_can.c.

Referenced by can_configuration().

◆ can_interrupt_flag_get()

flag_status can_interrupt_flag_get | ( | can_type * | can_x,
 |  | uint32_t | can_flag )

get interrupt flag of the specified can peripheral.

Parameters
can_x select the can peripheral. this parameter can be one of the following values: CAN1,CAN2.
can_flag select the flag. this parameter can be one of the following flags:
  • CAN_EAF_FLAG
  • CAN_EPF_FLAG
  • CAN_BOF_FLAG
  • CAN_ETR_FLAG
  • CAN_EOIF_FLAG
  • CAN_TM0TCF_FLAG
  • CAN_TM1TCF_FLAG
  • CAN_TM2TCF_FLAG
  • CAN_RF0MN_FLAG
  • CAN_RF0FF_FLAG
  • CAN_RF0OF_FLAG
  • CAN_RF1MN_FLAG
  • CAN_RF1FF_FLAG
  • CAN_RF1OF_FLAG
  • CAN_QDZIF_FLAG
  • CAN_EDZC_FLAG
  • CAN_TMEF_FLAG note:the state of CAN_EDZC_FLAG need to check dzc and edzif bit note:the state of CAN_TMEF_FLAG need to check rqc0,rqc1 and rqc2 bit
Return values
status of can_flag, the returned value can be:SET or RESET.

< error active flag

< error passive flag

< bus-off flag

< error type record flag

< error occur interrupt flag

< transmit mailbox 0 transmission completed flag

< transmit mailbox 1 transmission completed flag

< transmit mailbox 2 transmission completed flag

< receive fifo 0 message num flag

< receive fifo 0 full flag

< receive fifo 0 overflow flag

< receive fifo 1 message num flag

< receive fifo 1 full flag

< receive fifo 1 overflow flag

< quit doze mode interrupt flag

< enter doze mode confirm flag

< transmit mailbox empty flag

Definition at line 968 of file at32f413_can.c.

Referenced by CAN1_SE_IRQHandler(), and USBFS_L_CAN1_RX0_IRQHandler().

◆ can_message_receive()

void can_message_receive | ( | can_type * | can_x,
 |  | can_rx_fifo_num_type | fifo_number,
 |  | can_rx_message_type * | rx_message_struct )

receive message of the specified can peripheral.

Parameters
can_x | select the can peripheral. this parameter can be one of the following values: CAN1,CAN2.
fifo_number receive fifo number. this parameter can be one of the following values:
  • CAN_RX_FIFO0
  • CAN_RX_FIFO1
rx_message_struct | pointer to a structure which store the receive message.
Return values
none.

Definition at line 623 of file at32f413_can.c.

Referenced by USBFS_L_CAN1_RX0_IRQHandler().

◆ can_message_transmit()

uint8_t can_message_transmit | ( | can_type * | can_x,
 |  | can_tx_message_type * | tx_message_struct )

fill the transmission message and transmit of the specified can peripheral.

Parameters
can_x | select the can peripheral. this parameter can be one of the following values: CAN1,CAN2.
tx_message_struct | pointer to a structure which contains the message to be trans.
Return values
the number of the mailbox that is used for transmission: this parameter can be one of the following values:
  • CAN_TX_MAILBOX0
  • CAN_TX_MAILBOX1
  • CAN_TX_MAILBOX2
  • CAN_TX_STATUS_NO_EMPTY <meanings there is no empty mailbox, message cannot be filled>

Definition at line 442 of file at32f413_can.c.

Referenced by can_transmit_data(), can_transmit_data(), and can_transmit_data().

◆ can_operating_mode_set()

error_status can_operating_mode_set | ( | can_type * | can_x,
 |  | can_operating_mode_type | can_operating_mode )

set the operation mode of the specified can peripheral.

Parameters
can_x select the can peripheral. this parameter can be one of the following values: CAN1,CAN2.
can_operating_mode can operating mode. this parameter can be one of the following values:
  • CAN_OPERATINGMODE_FREEZE
  • CAN_OPERATINGMODE_DOZE
  • CAN_OPERATINGMODE_COMMUNICATE
Return values
status of operation mode set this parameter can be one of the following values: SUCCESS or ERROR

< time out for fzc bit

Definition at line 727 of file at32f413_can.c.

◆ can_receive_error_counter_get()

uint8_t can_receive_error_counter_get ( can_type * can_x )

return the receive error counter (rec) of the specified can peripheral.

Parameters
can_x select the can peripheral. this parameter can be one of the following values: CAN1,CAN2.
Return values
the value of receive error counter.

Definition at line 882 of file at32f413_can.c.

◆ can_receive_fifo_release()

void can_receive_fifo_release | ( | can_type * | can_x,
 |  | can_rx_fifo_num_type | fifo_number )

release the specified fifo of the specified can peripheral.

Parameters
can_x select the can peripheral. this parameter can be one of the following values: CAN1,CAN2.
fifo_number fifo to be release. this parameter can be one of the following values:
  • CAN_RX_FIFO0
  • CAN_RX_FIFO1
Return values
none.

< rf0r bit value, it clear by writing 1

< rf1r bit value, it clear by writing 1

Definition at line 670 of file at32f413_can.c.

Referenced by can_message_receive().

◆ can_receive_message_pending_get()

uint8_t can_receive_message_pending_get | ( | can_type * | can_x,
 |  | can_rx_fifo_num_type | fifo_number )

return the number of pending messages of the specified can peripheral.

Parameters
can_x select the can peripheral. this parameter can be one of the following values: CAN1,CAN2.
fifo_number receive fifo number. this parameter can be one of the following values:
  • CAN_RX_FIFO0
  • CAN_RX_FIFO1
Return values
the number of message pending in the receive fifo.

Definition at line 696 of file at32f413_can.c.

◆ can_reset()

void can_reset ( can_type * can_x )

deinitialize the can peripheral registers to their default reset values.

Parameters
can_x select the can peripheral. this parameter can be one of the following values: CAN1,CAN2.
Return values
none.

Definition at line 50 of file at32f413_can.c.

◆ can_transmit_cancel()

void can_transmit_cancel | ( | can_type * | can_x,
 |  | can_tx_mailbox_num_type | transmit_mailbox )

cancel a transmit request of the specified can peripheral.

Parameters
can_x select the can peripheral. this parameter can be one of the following values: CAN1 or CAN2.
mailbox mailbox number. this parameter can be one of the following values:
  • CAN_TX_MAILBOX0
  • CAN_TX_MAILBOX1
  • CAN_TX_MAILBOX2
Return values
none.

< tm0ct bit value, it clear by writing 1

< tm1ct bit value, it clear by writing 1

< tm2ct bit value, it clear by writing 1

< tm0ct bit value, it clear by writing 1

< tm1ct bit value, it clear by writing 1

< tm2ct bit value, it clear by writing 1

Definition at line 591 of file at32f413_can.c.

◆ can_transmit_error_counter_get()

uint8_t can_transmit_error_counter_get ( can_type * can_x )

return the transmit error counter of the specified can peripheral.

Parameters
can_x select the can peripheral. this parameter can be one of the following values: CAN1,CAN2.
Return values
the value of transmit error counter.

Definition at line 896 of file at32f413_can.c.

◆ can_transmit_status_get()

can_transmit_status_type can_transmit_status_get | ( | can_type * | can_x,
 |  | can_tx_mailbox_num_type | transmit_mailbox )

check the transmission state of the specified can peripheral.

Parameters
can_x select the can peripheral. this parameter can be one of the following values: CAN1 or CAN2.
transmit_mailbox the number of the mailbox that is used for transmission. this parameter can be one of the following values:
  • CAN_TX_MAILBOX0
  • CAN_TX_MAILBOX1
  • CAN_TX_MAILBOX2
Return values
can transmit status this parameter can be one of the following values:
  • CAN_TX_STATUS_SUCCESSFUL
  • CAN_TX_STATUS_FAILED
  • CAN_TX_STATUS_PENDING

Definition at line 516 of file at32f413_can.c.

Referenced by can_transmit_data(), can_transmit_data(), and can_transmit_data().

◆ can_ttc_mode_enable()

void can_ttc_mode_enable | ( | can_type * | can_x,
 |  | confirm_state | new_state )

enable or disable time trigger operation communication mode of the specified can peripheral.

Parameters
can_x | select the can peripheral. this parameter can be one of the following values: CAN1 or CAN2.
new_state | : new state of time trigger operation communication mode. this parameter can be: TRUE or FALSE.
Note
note1: when enabled, transmit mailbox time stamp(tmts[15:0]) value is sent in the last two data bytes of the 8-byte message: tmts[7:0] in data byte 6 and tmts[15:8] in data byte 7
note2: tmdtbl must be programmed as 8 in order time stamp (2 bytes) to be sent over the can bus.
Return values
none

Definition at line 418 of file at32f413_can.c.


AT32F413 Firmwary Library: CAN_private_functions

Functions
CAN_private_functions
AT32F413_periph_driver » CAN

Functions

void | can_reset (can_type *can_x)
deinitialize the can peripheral registers to their default reset values.
void | can_baudrate_default_para_init (can_baudrate_type *can_baudrate_struct)
fill each can_baudrate_struct member with its default value.
error_status | can_baudrate_set (can_type *can_x, can_baudrate_type *can_baudrate_struct)
set the baudrate of the can peripheral
void | can_default_para_init (can_base_type *can_base_struct)
fill each can_init_struct member with its default value.
error_status | can_base_init (can_type *can_x, can_base_type *can_base_struct)
initialize the can peripheral according to the specified parameters in the can_init_struct.
void | can_filter_default_para_init (can_filter_init_type *can_filter_init_struct)
fill each can_filter_init_struct member with its default value.
void | can_filter_init (can_type *can_x, can_filter_init_type *can_filter_init_struct)
initialize the can peripheral according to the specified parameters in the can_filter_init_struct.
void | can_debug_transmission_prohibit (can_type *can_x, confirm_state new_state)
enable or disable the debug transmission prohibit of the specified can peripheral.
void | can_ttc_mode_enable (can_type *can_x, confirm_state new_state)
enable or disable time trigger operation communication mode of the specified can peripheral.
uint8_t | can_message_transmit (can_type *can_x, can_tx_message_type *tx_message_struct)
fill the transmission message and transmit of the specified can peripheral.
can_transmit_status_type | can_transmit_status_get (can_type *can_x, can_tx_mailbox_num_type transmit_mailbox)
check the transmission state of the specified can peripheral.
void | can_transmit_cancel (can_type *can_x, can_tx_mailbox_num_type transmit_mailbox)
cancel a transmit request of the specified can peripheral.
void | can_message_receive (can_type *can_x, can_rx_fifo_num_type fifo_number, can_rx_message_type *rx_message_struct)
receive message of the specified can peripheral.
void | can_receive_fifo_release (can_type *can_x, can_rx_fifo_num_type fifo_number)
release the specified fifo of the specified can peripheral.
uint8_t | can_receive_message_pending_get (can_type *can_x, can_rx_fifo_num_type fifo_number)
return the number of pending messages of the specified can peripheral.
error_status | can_operating_mode_set (can_type *can_x, can_operating_mode_type can_operating_mode)
set the operation mode of the specified can peripheral.
can_enter_doze_status_type | can_doze_mode_enter (can_type *can_x)
enter the low power mode of the specified can peripheral.
can_quit_doze_status_type | can_doze_mode_exit (can_type *can_x)
exit the doze mode of the specified can peripheral.
can_error_record_type | can_error_type_record_get (can_type *can_x)
return the error type record (etr) of the specified can peripheral.
uint8_t | can_receive_error_counter_get (can_type *can_x)
return the receive error counter (rec) of the specified can peripheral.
uint8_t | can_transmit_error_counter_get (can_type *can_x)
return the transmit error counter of the specified can peripheral.
void | can_interrupt_enable (can_type *can_x, uint32_t can_int, confirm_state new_state)
enable or disable the interrupt of the specified can peripheral.
flag_status | can_interrupt_flag_get (can_type *can_x, uint32_t can_flag)
get interrupt flag of the specified can peripheral.
flag_status | can_flag_get (can_type *can_x, uint32_t can_flag)
get flag of the specified can peripheral.
void | can_flag_clear (can_type *can_x, uint32_t can_flag)
clear flag of the specified can peripheral.

Detailed Description

Function Documentation

◆ can_base_init()

error_status can_base_init | ( | can_type * | can_x,
 |  | can_base_type * | can_base_struct )

initialize the can peripheral according to the specified parameters in the can_init_struct.

Parameters
can_x | select the can peripheral. this parameter can be one of the following values: CAN1,CAN2.
can_base_struct | pointer to a can_base_struct structure that contains the configuration information for the can peripheral.
Return values
the status of initialization this parameter can be one of the following values: SUCCESS or ERROR

< time out for fzc bit

< time out for fzc bit

Definition at line 196 of file at32f413_can.c.

Referenced by can_configuration().

◆ can_baudrate_default_para_init()

void can_baudrate_default_para_init ( can_baudrate_type * can_baudrate_struct )

fill each can_baudrate_struct member with its default value.

Parameters
can_baudrate_struct pointer to a can_baudrate_type structure which will be initialized.
Return values
none.

Definition at line 72 of file at32f413_can.c.

◆ can_baudrate_set()

error_status can_baudrate_set | ( | can_type * | can_x,
 |  | can_baudrate_type * | can_baudrate_struct )

set the baudrate of the can peripheral

Parameters
can_x | select the can peripheral. this parameter can be one of the following values: CAN1,CAN2.
can_baudrate_struct | pointer to a can_baudrate_type structure which will be set.
Note
baudrate calculate method is: baudrate = fpclk/(baudrate_div *(3 + bts1_size + bts2_size))
Return values
the result of baudrate set this parameter can be one of the following values: SUCCESS or ERROR

< time out for fzc bit

< time out for fzc bit

Definition at line 101 of file at32f413_can.c.

Referenced by can_configuration().

◆ can_debug_transmission_prohibit()

void can_debug_transmission_prohibit | ( | can_type * | can_x,
 |  | confirm_state | new_state )

enable or disable the debug transmission prohibit of the specified can peripheral.

Parameters
can_x | select the can peripheral. this parameter can be one of the following values: CAN1,CAN2.
new_state | new state of debug transmission prohibit. this parameter can be: TRUE or FALSE.
Return values
none.

Definition at line 397 of file at32f413_can.c.

◆ can_default_para_init()

void can_default_para_init ( can_base_type * can_base_struct )

fill each can_init_struct member with its default value.

Parameters
can_base_struct pointer to a can_base_type structure which will be initialized.
Return values
none.

Definition at line 159 of file at32f413_can.c.

Referenced by can_configuration().

◆ can_doze_mode_enter()

can_enter_doze_status_type can_doze_mode_enter ( can_type * can_x )

enter the low power mode of the specified can peripheral.

Parameters
can_x select the can peripheral. this parameter can be one of the following values: CAN1,CAN2.
Return values
status of doze mode enter, the returned value can be:
  • CAN_ENTER_DOZE_SUCCESSFUL <it meaning enter the doze mode succeed>
  • CAN_ENTER_DOZE_FAILED <it meaning enter the doze mode failed>

< time out for fzc bit

Definition at line 805 of file at32f413_can.c.

◆ can_doze_mode_exit()

can_quit_doze_status_type can_doze_mode_exit ( can_type * can_x )

exit the doze mode of the specified can peripheral.

Parameters
can_x select the can peripheral. this parameter can be one of the following values: CAN1,CAN2.
Return values
status of doze mode enter, the returned value can be:
  • CAN_QUIT_DOZE_SUCCESSFUL <it meaning exit the doze mode succeed>
  • CAN_QUIT_DOZE_FAILED <it meaning exit the doze mode failed>

< time out for dzc bit

Definition at line 835 of file at32f413_can.c.

◆ can_error_type_record_get()

can_error_record_type can_error_type_record_get ( can_type * can_x )

return the error type record (etr) of the specified can peripheral.

Parameters
can_x select the can peripheral. this parameter can be one of the following values: CAN1,CAN2.
Return values
the value of the error code the return can be one of the follow values:
  • CAN_ERRORRECORD_NOERR
  • CAN_ERRORRECORD_STUFFERR,
  • CAN_ERRORRECORD_FORMERR,
  • CAN_ERRORRECORD_ACKERR,
  • CAN_ERRORRECORD_BITRECESSIVEERR,
  • CAN_ERRORRECORD_BITDOMINANTERR,
  • CAN_ERRORRECORD_CRCERR,
  • CAN_ERRORRECORD_SOFTWARESETERR

Definition at line 867 of file at32f413_can.c.

◆ can_filter_default_para_init()

void can_filter_default_para_init ( can_filter_init_type * can_filter_init_struct )

fill each can_filter_init_struct member with its default value.

Parameters
can_filter_init_struct pointer to a can_filter_init_type structure which will be initialized.
Return values
none.

Definition at line 271 of file at32f413_can.c.

◆ can_filter_init()

void can_filter_init | ( | can_type * | can_x,
 |  | can_filter_init_type * | can_filter_init_struct )

initialize the can peripheral according to the specified parameters in the can_filter_init_struct.

Parameters
can_x | select the can peripheral. this parameter can be one of the following values: CAN1,CAN2.
can_filter_init_struct | pointer to a can_filter_init_type structure that contains the configuration information.
Return values
none.

Definition at line 306 of file at32f413_can.c.

Referenced by can_configuration().

◆ can_flag_clear()

void can_flag_clear | ( | can_type * | can_x,
 |  | uint32_t | can_flag )

clear flag of the specified can peripheral.

Parameters
can_x select the can peripheral. this parameter can be one of the following values: CAN1,CAN2.
can_flag select the flag. this parameter can be one of the following flags:
  • CAN_EAF_FLAG
  • CAN_EPF_FLAG
  • CAN_BOF_FLAG
  • CAN_ETR_FLAG
  • CAN_EOIF_FLAG
  • CAN_TM0TCF_FLAG
  • CAN_TM1TCF_FLAG
  • CAN_TM2TCF_FLAG
  • CAN_RF0FF_FLAG
  • CAN_RF0OF_FLAG
  • CAN_RF1FF_FLAG
  • CAN_RF1OF_FLAG
  • CAN_QDZIF_FLAG
  • CAN_EDZC_FLAG
  • CAN_TMEF_FLAG
  • CAN_ETR_SOFTWARE_FLAG note:CAN_RF0MN_FLAG and CAN_RF1MN_FLAG can not clear by this function
Return values
none.

< error active flag

< error passive flag

< bus-off flag

< error occur interrupt flag

< eoif bit value, it clear by writing 1

< error type record flag

< eoif bit value, it clear by writing 1

< transmit mailbox 0 transmission completed flag

< tm0tcf bit value, it clear by writing 1

< transmit mailbox 1 transmission completed flag

< tm1tcf bit value, it clear by writing 1

< transmit mailbox 2 transmission completed flag

< tm2tcf bit value, it clear by writing 1

< receive fifo 0 full flag

< rf0ff bit value, it clear by writing 1

< receive fifo 0 overflow flag

< rf0of bit value, it clear by writing 1

< receive fifo 1 full flag

< rf1ff bit value, it clear by writing 1

< receive fifo 1 overflow flag

< rf1of bit value, it clear by writing 1

< quit doze mode interrupt flag

< qdzif bit value, it clear by writing 1

< enter doze mode confirm flag

< edzif bit value, it clear by writing 1

< transmit mailbox empty flag

< tm0tcf bit value, it clear by writing 1

< tm1tcf bit value, it clear by writing 1

< tm2tcf bit value, it clear by writing 1

Definition at line 1188 of file at32f413_can.c.

Referenced by CAN1_SE_IRQHandler().

◆ can_flag_get()

flag_status can_flag_get | ( | can_type * | can_x,
 |  | uint32_t | can_flag )

get flag of the specified can peripheral.

Parameters
can_x select the can peripheral. this parameter can be one of the following values: CAN1,CAN2.
can_flag select the flag. this parameter can be one of the following flags:
  • CAN_EAF_FLAG
  • CAN_EPF_FLAG
  • CAN_BOF_FLAG
  • CAN_ETR_FLAG
  • CAN_EOIF_FLAG
  • CAN_TM0TCF_FLAG
  • CAN_TM1TCF_FLAG
  • CAN_TM2TCF_FLAG
  • CAN_RF0MN_FLAG
  • CAN_RF0FF_FLAG
  • CAN_RF0OF_FLAG
  • CAN_RF1MN_FLAG
  • CAN_RF1FF_FLAG
  • CAN_RF1OF_FLAG
  • CAN_QDZIF_FLAG
  • CAN_EDZC_FLAG
  • CAN_TMEF_FLAG note:the state of CAN_EDZC_FLAG need to check dzc and edzif bit note:the state of CAN_TMEF_FLAG need to check rqc0,rqc1 and rqc2 bit
Return values
status of can_flag, the returned value can be:SET or RESET.

< error active flag

< error passive flag

< bus-off flag

< error type record flag

< error occur interrupt flag

< transmit mailbox 0 transmission completed flag

< transmit mailbox 1 transmission completed flag

< transmit mailbox 2 transmission completed flag

< receive fifo 0 message num flag

< receive fifo 0 full flag

< receive fifo 0 overflow flag

< receive fifo 1 message num flag

< receive fifo 1 full flag

< receive fifo 1 overflow flag

< quit doze mode interrupt flag

< enter doze mode confirm flag

< transmit mailbox empty flag

Definition at line 1064 of file at32f413_can.c.

Referenced by can_interrupt_flag_get().

◆ can_interrupt_enable()

void can_interrupt_enable | ( | can_type * | can_x,
 |  | uint32_t | can_int,
 |  | confirm_state | new_state )

enable or disable the interrupt of the specified can peripheral.

Parameters
can_x | select the can peripheral. this parameter can be one of the following values: CAN1,CAN2.
can_int specifies the can interrupt sources to be enabled or disabled. this parameter can be one of the following values:
  • CAN_TCIEN_INT
  • CAN_RF0MIEN_INT
  • CAN_RF0FIEN_INT
  • CAN_RF0OIEN_INT
  • CAN_RF1MIEN_INT
  • CAN_RF1FIEN_INT
  • CAN_RF1OIEN_INT
  • CAN_EAIEN_INT
  • CAN_EPIEN_INT
  • CAN_BOIEN_INT
  • CAN_ETRIEN_INT
  • CAN_EOIEN_INT
  • CAN_QDZIEN_INT
  • CAN_EDZIEN_INT
new_state | new state of the can interrupts. this parameter can be: TRUE or FALSE.
Return values
none.

Definition at line 928 of file at32f413_can.c.

Referenced by can_configuration().

◆ can_interrupt_flag_get()

flag_status can_interrupt_flag_get | ( | can_type * | can_x,
 |  | uint32_t | can_flag )

get interrupt flag of the specified can peripheral.

Parameters
can_x select the can peripheral. this parameter can be one of the following values: CAN1,CAN2.
can_flag select the flag. this parameter can be one of the following flags:
  • CAN_EAF_FLAG
  • CAN_EPF_FLAG
  • CAN_BOF_FLAG
  • CAN_ETR_FLAG
  • CAN_EOIF_FLAG
  • CAN_TM0TCF_FLAG
  • CAN_TM1TCF_FLAG
  • CAN_TM2TCF_FLAG
  • CAN_RF0MN_FLAG
  • CAN_RF0FF_FLAG
  • CAN_RF0OF_FLAG
  • CAN_RF1MN_FLAG
  • CAN_RF1FF_FLAG
  • CAN_RF1OF_FLAG
  • CAN_QDZIF_FLAG
  • CAN_EDZC_FLAG
  • CAN_TMEF_FLAG note:the state of CAN_EDZC_FLAG need to check dzc and edzif bit note:the state of CAN_TMEF_FLAG need to check rqc0,rqc1 and rqc2 bit
Return values
status of can_flag, the returned value can be:SET or RESET.

< error active flag

< error passive flag

< bus-off flag

< error type record flag

< error occur interrupt flag

< transmit mailbox 0 transmission completed flag

< transmit mailbox 1 transmission completed flag

< transmit mailbox 2 transmission completed flag

< receive fifo 0 message num flag

< receive fifo 0 full flag

< receive fifo 0 overflow flag

< receive fifo 1 message num flag

< receive fifo 1 full flag

< receive fifo 1 overflow flag

< quit doze mode interrupt flag

< enter doze mode confirm flag

< transmit mailbox empty flag

Definition at line 968 of file at32f413_can.c.

Referenced by CAN1_SE_IRQHandler(), and USBFS_L_CAN1_RX0_IRQHandler().

◆ can_message_receive()

void can_message_receive | ( | can_type * | can_x,
 |  | can_rx_fifo_num_type | fifo_number,
 |  | can_rx_message_type * | rx_message_struct )

receive message of the specified can peripheral.

Parameters
can_x | select the can peripheral. this parameter can be one of the following values: CAN1,CAN2.
fifo_number receive fifo number. this parameter can be one of the following values:
  • CAN_RX_FIFO0
  • CAN_RX_FIFO1
rx_message_struct | pointer to a structure which store the receive message.
Return values
none.

Definition at line 623 of file at32f413_can.c.

Referenced by USBFS_L_CAN1_RX0_IRQHandler().

◆ can_message_transmit()

uint8_t can_message_transmit | ( | can_type * | can_x,
 |  | can_tx_message_type * | tx_message_struct )

fill the transmission message and transmit of the specified can peripheral.

Parameters
can_x | select the can peripheral. this parameter can be one of the following values: CAN1,CAN2.
tx_message_struct | pointer to a structure which contains the message to be trans.
Return values
the number of the mailbox that is used for transmission: this parameter can be one of the following values:
  • CAN_TX_MAILBOX0
  • CAN_TX_MAILBOX1
  • CAN_TX_MAILBOX2
  • CAN_TX_STATUS_NO_EMPTY <meanings there is no empty mailbox, message cannot be filled>

Definition at line 442 of file at32f413_can.c.

Referenced by can_transmit_data(), can_transmit_data(), and can_transmit_data().

◆ can_operating_mode_set()

error_status can_operating_mode_set | ( | can_type * | can_x,
 |  | can_operating_mode_type | can_operating_mode )

set the operation mode of the specified can peripheral.

Parameters
can_x select the can peripheral. this parameter can be one of the following values: CAN1,CAN2.
can_operating_mode can operating mode. this parameter can be one of the following values:
  • CAN_OPERATINGMODE_FREEZE
  • CAN_OPERATINGMODE_DOZE
  • CAN_OPERATINGMODE_COMMUNICATE
Return values
status of operation mode set this parameter can be one of the following values: SUCCESS or ERROR

< time out for fzc bit

Definition at line 727 of file at32f413_can.c.

◆ can_receive_error_counter_get()

uint8_t can_receive_error_counter_get ( can_type * can_x )

return the receive error counter (rec) of the specified can peripheral.

Parameters
can_x select the can peripheral. this parameter can be one of the following values: CAN1,CAN2.
Return values
the value of receive error counter.

Definition at line 882 of file at32f413_can.c.

◆ can_receive_fifo_release()

void can_receive_fifo_release | ( | can_type * | can_x,
 |  | can_rx_fifo_num_type | fifo_number )

release the specified fifo of the specified can peripheral.

Parameters
can_x select the can peripheral. this parameter can be one of the following values: CAN1,CAN2.
fifo_number fifo to be release. this parameter can be one of the following values:
  • CAN_RX_FIFO0
  • CAN_RX_FIFO1
Return values
none.

< rf0r bit value, it clear by writing 1

< rf1r bit value, it clear by writing 1

Definition at line 670 of file at32f413_can.c.

Referenced by can_message_receive().

◆ can_receive_message_pending_get()

uint8_t can_receive_message_pending_get | ( | can_type * | can_x,
 |  | can_rx_fifo_num_type | fifo_number )

return the number of pending messages of the specified can peripheral.

Parameters
can_x select the can peripheral. this parameter can be one of the following values: CAN1,CAN2.
fifo_number receive fifo number. this parameter can be one of the following values:
  • CAN_RX_FIFO0
  • CAN_RX_FIFO1
Return values
the number of message pending in the receive fifo.

Definition at line 696 of file at32f413_can.c.

◆ can_reset()

void can_reset ( can_type * can_x )

deinitialize the can peripheral registers to their default reset values.

Parameters
can_x select the can peripheral. this parameter can be one of the following values: CAN1,CAN2.
Return values
none.

Definition at line 50 of file at32f413_can.c.

◆ can_transmit_cancel()

void can_transmit_cancel | ( | can_type * | can_x,
 |  | can_tx_mailbox_num_type | transmit_mailbox )

cancel a transmit request of the specified can peripheral.

Parameters
can_x select the can peripheral. this parameter can be one of the following values: CAN1 or CAN2.
mailbox mailbox number. this parameter can be one of the following values:
  • CAN_TX_MAILBOX0
  • CAN_TX_MAILBOX1
  • CAN_TX_MAILBOX2
Return values
none.

< tm0ct bit value, it clear by writing 1

< tm1ct bit value, it clear by writing 1

< tm2ct bit value, it clear by writing 1

< tm0ct bit value, it clear by writing 1

< tm1ct bit value, it clear by writing 1

< tm2ct bit value, it clear by writing 1

Definition at line 591 of file at32f413_can.c.

◆ can_transmit_error_counter_get()

uint8_t can_transmit_error_counter_get ( can_type * can_x )

return the transmit error counter of the specified can peripheral.

Parameters
can_x select the can peripheral. this parameter can be one of the following values: CAN1,CAN2.
Return values
the value of transmit error counter.

Definition at line 896 of file at32f413_can.c.

◆ can_transmit_status_get()

can_transmit_status_type can_transmit_status_get | ( | can_type * | can_x,
 |  | can_tx_mailbox_num_type | transmit_mailbox )

check the transmission state of the specified can peripheral.

Parameters
can_x select the can peripheral. this parameter can be one of the following values: CAN1 or CAN2.
transmit_mailbox the number of the mailbox that is used for transmission. this parameter can be one of the following values:
  • CAN_TX_MAILBOX0
  • CAN_TX_MAILBOX1
  • CAN_TX_MAILBOX2
Return values
can transmit status this parameter can be one of the following values:
  • CAN_TX_STATUS_SUCCESSFUL
  • CAN_TX_STATUS_FAILED
  • CAN_TX_STATUS_PENDING

Definition at line 516 of file at32f413_can.c.

Referenced by can_transmit_data(), can_transmit_data(), and can_transmit_data().

◆ can_ttc_mode_enable()

void can_ttc_mode_enable | ( | can_type * | can_x,
 |  | confirm_state | new_state )

enable or disable time trigger operation communication mode of the specified can peripheral.

Parameters
can_x | select the can peripheral. this parameter can be one of the following values: CAN1 or CAN2.
new_state | : new state of time trigger operation communication mode. this parameter can be: TRUE or FALSE.
Note
note1: when enabled, transmit mailbox time stamp(tmts[15:0]) value is sent in the last two data bytes of the 8-byte message: tmts[7:0] in data byte 6 and tmts[15:8] in data byte 7
note2: tmdtbl must be programmed as 8 in order time stamp (2 bytes) to be sent over the can bus.
Return values
none

Definition at line 418 of file at32f413_can.c.


AT32F413 Firmwary Library: CRC

Topics | Macros
CRC
AT32F413_periph_driver

CRC driver modules. More...

Topics

CRC_exported_types
CRC_exported_functions
CRC_private_functions

Macros

#define CRC ((crc_type *) CRC_BASE)

Detailed Description

CRC driver modules.

Macro Definition Documentation

◆ CRC

#define CRC ((crc_type *) CRC_BASE)

Definition at line 163 of file at32f413_crc.h.

Referenced by crc_block_calculate(), crc_common_data_get(), crc_common_data_set(), crc_data_get(), crc_data_reset(), crc_init_data_set(), crc_one_word_calculate(), crc_poly_size_get(), crc_poly_size_set(), crc_poly_value_get(), crc_poly_value_set(), crc_reverse_input_data_set(), and crc_reverse_output_data_set().


AT32F413 Firmwary Library: CRC_exported_types

Data Structures | Enumerations
CRC_exported_types
AT32F413_periph_driver » CRC

Data Structures

struct crc_type
type define crc register all More...

Enumerations

enum | crc_reverse_input_type { CRC_REVERSE_INPUT_NO_AFFECTE = 0x00 , CRC_REVERSE_INPUT_BY_BYTE = 0x01 , CRC_REVERSE_INPUT_BY_HALFWORD = 0x02 , CRC_REVERSE_INPUT_BY_WORD = 0x03 }
crc reverse input data More...
enum | crc_reverse_output_type { CRC_REVERSE_OUTPUT_NO_AFFECTE = 0x00 , CRC_REVERSE_OUTPUT_DATA = 0x01 }
crc reverse output data More...
enum | crc_poly_size_type { CRC_POLY_SIZE_32B = 0x00 , CRC_POLY_SIZE_16B = 0x01 , CRC_POLY_SIZE_8B = 0x02 , CRC_POLY_SIZE_7B = 0x03 }
crc polynomial size More...

Detailed Description

Enumeration Type Documentation

◆ crc_poly_size_type

enum crc_poly_size_type

crc polynomial size

Enumerator
CRC_POLY_SIZE_32B | polynomial size 32 bits
CRC_POLY_SIZE_16B | polynomial size 16 bits
CRC_POLY_SIZE_8B | polynomial size 8 bits
CRC_POLY_SIZE_7B | polynomial size 7 bits

Definition at line 73 of file at32f413_crc.h.

◆ crc_reverse_input_type

enum crc_reverse_input_type

crc reverse input data

Enumerator
CRC_REVERSE_INPUT_NO_AFFECTE | input data no reverse
CRC_REVERSE_INPUT_BY_BYTE | input data reverse by byte
CRC_REVERSE_INPUT_BY_HALFWORD | input data reverse by half word
CRC_REVERSE_INPUT_BY_WORD | input data reverse by word

Definition at line 53 of file at32f413_crc.h.

◆ crc_reverse_output_type

enum crc_reverse_output_type

crc reverse output data

Enumerator
CRC_REVERSE_OUTPUT_NO_AFFECTE | output data no reverse
CRC_REVERSE_OUTPUT_DATA | output data reverse by word

Definition at line 64 of file at32f413_crc.h.


AT32F413 Firmwary Library: crc_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
crc_type Struct Reference
AT32F413_periph_driver » CRC » CRC_exported_types

type define crc register all More...

#include <at32f413_crc.h>

Data Fields

union {
__IO uint32_t dt
struct {
__IO uint32_t dt: 32
} dt_bit
};
crc dt register, offset:0x00
union {
__IO uint32_t cdt
struct {
__IO uint32_t cdt: 8
__IO uint32_t reserved1: 24
} cdt_bit
};
crc cdt register, offset:0x04
union {
__IO uint32_t ctrl
struct {
__IO uint32_t rst: 1
__IO uint32_t reserved1: 2
__IO uint32_t poly_size: 2
__IO uint32_t revid: 2
__IO uint32_t revod: 1
__IO uint32_t reserved2: 24
} ctrl_bit
};
crc ctrl register, offset:0x08
union {
__IO uint32_t idt
struct {
__IO uint32_t idt: 32
} idt_bit
};
crc idt register, offset:0x10
union {
__IO uint32_t poly
struct {
__IO uint32_t poly: 32
} poly_bit
};
crc polynomial register, offset:0x14

Detailed Description

type define crc register all

Definition at line 84 of file at32f413_crc.h.

Field Documentation

◆ [union]

union { ... } crc_type

crc dt register, offset:0x00

◆ [union]

union { ... } crc_type

crc cdt register, offset:0x04

◆ [union]

union { ... } crc_type

crc ctrl register, offset:0x08

◆ [union]

union { ... } crc_type

crc idt register, offset:0x10

◆ [union]

union { ... } crc_type

crc polynomial register, offset:0x14

◆ cdt

__IO uint32_t crc_type::cdt

Definition at line 103 of file at32f413_crc.h.

◆ [struct]

struct { ... } crc_type::cdt_bit

◆ ctrl

__IO uint32_t crc_type::ctrl

Definition at line 116 of file at32f413_crc.h.

◆ [struct]

struct { ... } crc_type::ctrl_bit

◆ dt

__IO uint32_t crc_type::dt

Definition at line 91 of file at32f413_crc.h.

◆ [struct]

struct { ... } crc_type::dt_bit

◆ idt

__IO uint32_t crc_type::idt

Definition at line 138 of file at32f413_crc.h.

◆ [struct]

struct { ... } crc_type::idt_bit

◆ poly

__IO uint32_t crc_type::poly

Definition at line 150 of file at32f413_crc.h.

◆ [struct]

struct { ... } crc_type::poly_bit

◆ poly_size

__IO uint32_t crc_type::poly_size

Definition at line 121 of file at32f413_crc.h.

◆ reserved1

__IO uint32_t crc_type::reserved1

crm reserved1 register, offset:0x0C

Definition at line 107 of file at32f413_crc.h.

◆ reserved2

__IO uint32_t crc_type::reserved2

Definition at line 124 of file at32f413_crc.h.

◆ revid

__IO uint32_t crc_type::revid

Definition at line 122 of file at32f413_crc.h.

◆ revod

__IO uint32_t crc_type::revod

Definition at line 123 of file at32f413_crc.h.

◆ rst

__IO uint32_t crc_type::rst

Definition at line 119 of file at32f413_crc.h.

The documentation for this struct was generated from the following file:
  • at32f413_crc.h


AT32F413 Firmwary Library: CRC_exported_functions

Functions
CRC_exported_functions
AT32F413_periph_driver » CRC

Functions

void | crc_data_reset (void)
reset the crc data register.
uint32_t | crc_one_word_calculate (uint32_t data)
compute the 32-bit crc of a given data word(32-bit).
uint32_t | crc_block_calculate (uint32_t *pbuffer, uint32_t length)
compute the 32-bit crc of a given buffer of data word(32-bit).
uint32_t | crc_data_get (void)
return the current crc value.
void | crc_common_data_set (uint8_t cdt_value)
store a 8-bit data in the common data register.
uint8_t | crc_common_data_get (void)
return the 8-bit data stored in the common data register
void | crc_init_data_set (uint32_t value)
set the 32-bit initial data of crc
void | crc_reverse_input_data_set (crc_reverse_input_type value)
control the reversal of the bit order in the input data
void | crc_reverse_output_data_set (crc_reverse_output_type value)
control the reversal of the bit order in the output data
void | crc_poly_value_set (uint32_t value)
config crc polynomial value
uint32_t | crc_poly_value_get (void)
return crc polynomial value
void | crc_poly_size_set (crc_poly_size_type size)
config crc polynomial data size
crc_poly_size_type | crc_poly_size_get (void)
return crc polynomial data size

Detailed Description

Function Documentation

◆ crc_block_calculate()

uint32_t crc_block_calculate | ( | uint32_t * | pbuffer,
 |  | uint32_t | length )

compute the 32-bit crc of a given buffer of data word(32-bit).

Parameters
pbuffer | pointer to the buffer containing the data to be computed
length | length of the buffer to be computed
Return values
32-bit crc

Definition at line 71 of file at32f413_crc.c.

Referenced by main().

◆ crc_common_data_get()

uint8_t crc_common_data_get ( void )

return the 8-bit data stored in the common data register

Parameters
none
Return values
8-bit value of the common data register

Definition at line 108 of file at32f413_crc.c.

◆ crc_common_data_set()

void crc_common_data_set ( uint8_t cdt_value )

store a 8-bit data in the common data register.

Parameters
cdt_value 8-bit value to be stored in the common data register
Return values
none

Definition at line 98 of file at32f413_crc.c.

◆ crc_data_get()

uint32_t crc_data_get ( void )

return the current crc value.

Parameters
none
Return values
32-bit crc

Definition at line 88 of file at32f413_crc.c.

Referenced by crc_cal().

◆ crc_data_reset()

void crc_data_reset ( void )

reset the crc data register.

Parameters
none
Return values
none

Definition at line 48 of file at32f413_crc.c.

Referenced by crc_cal(), flash_crc_check(), and main().

◆ crc_init_data_set()

void crc_init_data_set ( uint32_t value )

set the 32-bit initial data of crc

Parameters
value initial data
Return values
none

Definition at line 118 of file at32f413_crc.c.

◆ crc_one_word_calculate()

uint32_t crc_one_word_calculate ( uint32_t data )

compute the 32-bit crc of a given data word(32-bit).

Parameters
data data word(32-bit) to compute its crc
Return values
32-bit crc

Definition at line 59 of file at32f413_crc.c.

Referenced by crc_cal(), and flash_crc_check().

◆ crc_poly_size_get()

crc_poly_size_type crc_poly_size_get ( void )

return crc polynomial data size

Parameters
none
Return values
polynomial data size.

Definition at line 192 of file at32f413_crc.c.

◆ crc_poly_size_set()

void crc_poly_size_set ( crc_poly_size_type size )

config crc polynomial data size

Parameters
size this parameter can be one of the following values:
  • CRC_POLY_SIZE_32B
  • CRC_POLY_SIZE_16B
  • CRC_POLY_SIZE_8B
  • CRC_POLY_SIZE_7B
Return values
none.

Definition at line 182 of file at32f413_crc.c.

◆ crc_poly_value_get()

uint32_t crc_poly_value_get ( void )

return crc polynomial value

Parameters
none
Return values
32-bit value of the polynomial value.

Definition at line 167 of file at32f413_crc.c.

◆ crc_poly_value_set()

void crc_poly_value_set ( uint32_t value )

config crc polynomial value

Parameters
value 32-bit new data of crc poly value
Return values
none.

Definition at line 157 of file at32f413_crc.c.

◆ crc_reverse_input_data_set()

void crc_reverse_input_data_set ( crc_reverse_input_type value )

control the reversal of the bit order in the input data

Parameters
value this parameter can be one of the following values:
  • CRC_REVERSE_INPUT_NO_AFFECTE
  • CRC_REVERSE_INPUT_BY_BYTE
  • CRC_REVERSE_INPUT_BY_HALFWORD
  • CRC_REVERSE_INPUT_BY_WORD
Return values
none.

Definition at line 133 of file at32f413_crc.c.

◆ crc_reverse_output_data_set()

void crc_reverse_output_data_set ( crc_reverse_output_type value )

control the reversal of the bit order in the output data

Parameters
value this parameter can be one of the following values:
  • CRC_REVERSE_OUTPUT_NO_AFFECTE
  • CRC_REVERSE_OUTPUT_DATA
Return values
none.

Definition at line 146 of file at32f413_crc.c.


AT32F413 Firmwary Library: CRC_private_functions

Functions
CRC_private_functions
AT32F413_periph_driver » CRC

Functions

void | crc_data_reset (void)
reset the crc data register.
uint32_t | crc_one_word_calculate (uint32_t data)
compute the 32-bit crc of a given data word(32-bit).
uint32_t | crc_block_calculate (uint32_t *pbuffer, uint32_t length)
compute the 32-bit crc of a given buffer of data word(32-bit).
uint32_t | crc_data_get (void)
return the current crc value.
void | crc_common_data_set (uint8_t cdt_value)
store a 8-bit data in the common data register.
uint8_t | crc_common_data_get (void)
return the 8-bit data stored in the common data register
void | crc_init_data_set (uint32_t value)
set the 32-bit initial data of crc
void | crc_reverse_input_data_set (crc_reverse_input_type value)
control the reversal of the bit order in the input data
void | crc_reverse_output_data_set (crc_reverse_output_type value)
control the reversal of the bit order in the output data
void | crc_poly_value_set (uint32_t value)
config crc polynomial value
uint32_t | crc_poly_value_get (void)
return crc polynomial value
void | crc_poly_size_set (crc_poly_size_type size)
config crc polynomial data size
crc_poly_size_type | crc_poly_size_get (void)
return crc polynomial data size

Detailed Description

Function Documentation

◆ crc_block_calculate()

uint32_t crc_block_calculate | ( | uint32_t * | pbuffer,
 |  | uint32_t | length )

compute the 32-bit crc of a given buffer of data word(32-bit).

Parameters
pbuffer | pointer to the buffer containing the data to be computed
length | length of the buffer to be computed
Return values
32-bit crc

Definition at line 71 of file at32f413_crc.c.

Referenced by main().

◆ crc_common_data_get()

uint8_t crc_common_data_get ( void )

return the 8-bit data stored in the common data register

Parameters
none
Return values
8-bit value of the common data register

Definition at line 108 of file at32f413_crc.c.

◆ crc_common_data_set()

void crc_common_data_set ( uint8_t cdt_value )

store a 8-bit data in the common data register.

Parameters
cdt_value 8-bit value to be stored in the common data register
Return values
none

Definition at line 98 of file at32f413_crc.c.

◆ crc_data_get()

uint32_t crc_data_get ( void )

return the current crc value.

Parameters
none
Return values
32-bit crc

Definition at line 88 of file at32f413_crc.c.

Referenced by crc_cal().

◆ crc_data_reset()

void crc_data_reset ( void )

reset the crc data register.

Parameters
none
Return values
none

Definition at line 48 of file at32f413_crc.c.

Referenced by crc_cal(), flash_crc_check(), and main().

◆ crc_init_data_set()

void crc_init_data_set ( uint32_t value )

set the 32-bit initial data of crc

Parameters
value initial data
Return values
none

Definition at line 118 of file at32f413_crc.c.

◆ crc_one_word_calculate()

uint32_t crc_one_word_calculate ( uint32_t data )

compute the 32-bit crc of a given data word(32-bit).

Parameters
data data word(32-bit) to compute its crc
Return values
32-bit crc

Definition at line 59 of file at32f413_crc.c.

Referenced by crc_cal(), and flash_crc_check().

◆ crc_poly_size_get()

crc_poly_size_type crc_poly_size_get ( void )

return crc polynomial data size

Parameters
none
Return values
polynomial data size.

Definition at line 192 of file at32f413_crc.c.

◆ crc_poly_size_set()

void crc_poly_size_set ( crc_poly_size_type size )

config crc polynomial data size

Parameters
size this parameter can be one of the following values:
  • CRC_POLY_SIZE_32B
  • CRC_POLY_SIZE_16B
  • CRC_POLY_SIZE_8B
  • CRC_POLY_SIZE_7B
Return values
none.

Definition at line 182 of file at32f413_crc.c.

◆ crc_poly_value_get()

uint32_t crc_poly_value_get ( void )

return crc polynomial value

Parameters
none
Return values
32-bit value of the polynomial value.

Definition at line 167 of file at32f413_crc.c.

◆ crc_poly_value_set()

void crc_poly_value_set ( uint32_t value )

config crc polynomial value

Parameters
value 32-bit new data of crc poly value
Return values
none.

Definition at line 157 of file at32f413_crc.c.

◆ crc_reverse_input_data_set()

void crc_reverse_input_data_set ( crc_reverse_input_type value )

control the reversal of the bit order in the input data

Parameters
value this parameter can be one of the following values:
  • CRC_REVERSE_INPUT_NO_AFFECTE
  • CRC_REVERSE_INPUT_BY_BYTE
  • CRC_REVERSE_INPUT_BY_HALFWORD
  • CRC_REVERSE_INPUT_BY_WORD
Return values
none.

Definition at line 133 of file at32f413_crc.c.

◆ crc_reverse_output_data_set()

void crc_reverse_output_data_set ( crc_reverse_output_type value )

control the reversal of the bit order in the output data

Parameters
value this parameter can be one of the following values:
  • CRC_REVERSE_OUTPUT_NO_AFFECTE
  • CRC_REVERSE_OUTPUT_DATA
Return values
none.

Definition at line 146 of file at32f413_crc.c.


AT32F413 Firmwary Library: CRM

Topics | Macros
CRM
AT32F413_periph_driver

CRM driver modules. More...

Topics

CRM_flags_definition
crm flag
CRM_interrupts_definition
crm interrupt
CRM_exported_types
CRM_exported_functions
CRM_private_functions

Macros

#define | CRM_REG(value)
#define | CRM_REG_BIT(value)
#define | CRM ((crm_type *) CRM_BASE)

Detailed Description

CRM driver modules.

Macro Definition Documentation

◆ CRM

#define CRM ((crm_type *) CRM_BASE)

Definition at line 843 of file at32f413_crm.h.

Referenced by crm_adc_clock_div_set(), crm_ahb_div_set(), crm_apb1_div_set(), crm_apb2_div_set(), crm_auto_step_mode_enable(), crm_battery_powered_domain_reset(), crm_clkout_div_set(), crm_clkout_to_tmr10_enable(), crm_clock_failure_detection_enable(), crm_clock_out_set(), crm_clock_source_enable(), crm_clocks_freq_get(), crm_flag_clear(), crm_hext_bypass(), crm_hick_clock_calibration_set(), crm_hick_clock_trimming_set(), crm_hick_divider_select(), crm_hick_sclk_frequency_select(), crm_interrupt_enable(), crm_interrupt_flag_get(), crm_lext_bypass(), crm_pll_config(), crm_reset(), crm_rtc_clock_enable(), crm_rtc_clock_select(), crm_sysclk_switch(), crm_sysclk_switch_status_get(), crm_usb_clock_div_set(), crm_usb_clock_source_select(), crm_usb_interrupt_remapping_set(), main(), switch_system_clock(), system_core_clock_update(), SystemInit(), and usb_usbbufs_enable().

◆ CRM_REG

#define CRM_REG ( value )
Value:
PERIPH_REG(CRM_BASE, value)
PERIPH_REG
#define PERIPH_REG(periph_base, value)
Definition at32f413.h:318
CRM_BASE
#define CRM_BASE
Definition at32f413.h:397

Definition at line 46 of file at32f413_crm.h.

Referenced by crm_flag_get(), crm_periph_clock_enable(), crm_periph_reset(), and crm_periph_sleep_mode_clock_enable().

◆ CRM_REG_BIT

#define CRM_REG_BIT ( value )
Value:
PERIPH_REG_BIT(value)
PERIPH_REG_BIT
#define PERIPH_REG_BIT(value)
Definition at32f413.h:319

Definition at line 47 of file at32f413_crm.h.

Referenced by crm_flag_get(), crm_periph_clock_enable(), crm_periph_reset(), and crm_periph_sleep_mode_clock_enable().


AT32F413 Firmwary Library: CRM_flags_definition

Macros
CRM_flags_definition
AT32F413_periph_driver » CRM

crm flag More...

Macros

#define | CRM_HICK_STABLE_FLAG MAKE_VALUE(0x00, 1)
#define | CRM_HEXT_STABLE_FLAG MAKE_VALUE(0x00, 17)
#define | CRM_PLL_STABLE_FLAG MAKE_VALUE(0x00, 25)
#define | CRM_LEXT_STABLE_FLAG MAKE_VALUE(0x20, 1)
#define | CRM_LICK_STABLE_FLAG MAKE_VALUE(0x24, 1)
#define | CRM_ALL_RESET_FLAG MAKE_VALUE(0x24, 24)
#define | CRM_NRST_RESET_FLAG MAKE_VALUE(0x24, 26)
#define | CRM_POR_RESET_FLAG MAKE_VALUE(0x24, 27)
#define | CRM_SW_RESET_FLAG MAKE_VALUE(0x24, 28)
#define | CRM_WDT_RESET_FLAG MAKE_VALUE(0x24, 29)
#define | CRM_WWDT_RESET_FLAG MAKE_VALUE(0x24, 30)
#define | CRM_LOWPOWER_RESET_FLAG MAKE_VALUE(0x24, 31)
#define | CRM_LICK_READY_INT_FLAG MAKE_VALUE(0x08, 0)
#define | CRM_LEXT_READY_INT_FLAG MAKE_VALUE(0x08, 1)
#define | CRM_HICK_READY_INT_FLAG MAKE_VALUE(0x08, 2)
#define | CRM_HEXT_READY_INT_FLAG MAKE_VALUE(0x08, 3)
#define | CRM_PLL_READY_INT_FLAG MAKE_VALUE(0x08, 4)
#define | CRM_CLOCK_FAILURE_INT_FLAG MAKE_VALUE(0x08, 7)

Detailed Description

crm flag

Macro Definition Documentation

◆ CRM_ALL_RESET_FLAG

#define CRM_ALL_RESET_FLAG MAKE_VALUE(0x24, 24)

all reset flag

Definition at line 59 of file at32f413_crm.h.

Referenced by crm_flag_clear().

◆ CRM_CLOCK_FAILURE_INT_FLAG

#define CRM_CLOCK_FAILURE_INT_FLAG MAKE_VALUE(0x08, 7)

clock failure interrupt ready flag

Definition at line 71 of file at32f413_crm.h.

Referenced by clock_failure_detection_handler(), crm_flag_clear(), and crm_interrupt_flag_get().

◆ CRM_HEXT_READY_INT_FLAG

#define CRM_HEXT_READY_INT_FLAG MAKE_VALUE(0x08, 3)

high speed external crystal stable interrupt ready flag

Definition at line 69 of file at32f413_crm.h.

Referenced by crm_flag_clear(), and crm_interrupt_flag_get().

◆ CRM_HEXT_STABLE_FLAG

#define CRM_HEXT_STABLE_FLAG MAKE_VALUE(0x00, 17)

high speed external crystal stable flag

Definition at line 55 of file at32f413_crm.h.

Referenced by can_configuration(), and crm_hext_stable_wait().

◆ CRM_HICK_READY_INT_FLAG

#define CRM_HICK_READY_INT_FLAG MAKE_VALUE(0x08, 2)

high speed internal clock stable interrupt ready flag

Definition at line 68 of file at32f413_crm.h.

Referenced by crm_flag_clear(), and crm_interrupt_flag_get().

◆ CRM_HICK_STABLE_FLAG

#define CRM_HICK_STABLE_FLAG MAKE_VALUE(0x00, 1)

high speed internal clock stable flag

Definition at line 54 of file at32f413_crm.h.

Referenced by sclk_192m_hick_config(), sclk_64m_hick_config(), and system_clock_config_for_acc().

◆ CRM_LEXT_READY_INT_FLAG

#define CRM_LEXT_READY_INT_FLAG MAKE_VALUE(0x08, 1)

low speed external crystal stable interrupt ready flag

Definition at line 67 of file at32f413_crm.h.

Referenced by crm_flag_clear(), and crm_interrupt_flag_get().

◆ CRM_LEXT_STABLE_FLAG

#define CRM_LEXT_STABLE_FLAG MAKE_VALUE(0x20, 1)

low speed external crystal stable flag

Definition at line 57 of file at32f413_crm.h.

Referenced by rtc_init().

◆ CRM_LICK_READY_INT_FLAG

#define CRM_LICK_READY_INT_FLAG MAKE_VALUE(0x08, 0)

low speed internal clock stable interrupt ready flag

Definition at line 66 of file at32f413_crm.h.

Referenced by crm_flag_clear(), and crm_interrupt_flag_get().

◆ CRM_LICK_STABLE_FLAG

#define CRM_LICK_STABLE_FLAG MAKE_VALUE(0x24, 1)

low speed internal clock stable flag

Definition at line 58 of file at32f413_crm.h.

Referenced by rtc_config(), and rtc_configuration().

◆ CRM_LOWPOWER_RESET_FLAG

#define CRM_LOWPOWER_RESET_FLAG MAKE_VALUE(0x24, 31)

low-power reset flag

Definition at line 65 of file at32f413_crm.h.

Referenced by crm_flag_clear().

◆ CRM_NRST_RESET_FLAG

#define CRM_NRST_RESET_FLAG MAKE_VALUE(0x24, 26)

nrst pin reset flag

Definition at line 60 of file at32f413_crm.h.

Referenced by crm_flag_clear().

◆ CRM_PLL_READY_INT_FLAG

#define CRM_PLL_READY_INT_FLAG MAKE_VALUE(0x08, 4)

phase locking loop stable interrupt ready flag

Definition at line 70 of file at32f413_crm.h.

Referenced by crm_flag_clear(), and crm_interrupt_flag_get().

◆ CRM_PLL_STABLE_FLAG

#define CRM_PLL_STABLE_FLAG MAKE_VALUE(0x00, 25)

phase locking loop stable flag

Definition at line 56 of file at32f413_crm.h.

Referenced by sclk_192m_hick_config(), sclk_64m_hick_config(), sclk_96m_hext_config(), system_clock_config(), system_clock_config_for_acc(), and system_clock_recover().

◆ CRM_POR_RESET_FLAG

#define CRM_POR_RESET_FLAG MAKE_VALUE(0x24, 27)

power on reset flag

Definition at line 61 of file at32f413_crm.h.

Referenced by crm_flag_clear().

◆ CRM_SW_RESET_FLAG

#define CRM_SW_RESET_FLAG MAKE_VALUE(0x24, 28)

software reset flag

Definition at line 62 of file at32f413_crm.h.

Referenced by crm_flag_clear().

◆ CRM_WDT_RESET_FLAG

#define CRM_WDT_RESET_FLAG MAKE_VALUE(0x24, 29)

watchdog timer reset flag

Definition at line 63 of file at32f413_crm.h.

Referenced by crm_flag_clear(), and main().

◆ CRM_WWDT_RESET_FLAG

#define CRM_WWDT_RESET_FLAG MAKE_VALUE(0x24, 30)

window watchdog timer reset flag

Definition at line 64 of file at32f413_crm.h.

Referenced by crm_flag_clear(), and main().


AT32F413 Firmwary Library: CRM_interrupts_definition

Macros
CRM_interrupts_definition
AT32F413_periph_driver » CRM

crm interrupt More...

Macros

#define | CRM_LICK_STABLE_INT ((uint32_t)0x00000100)
#define | CRM_LEXT_STABLE_INT ((uint32_t)0x00000200)
#define | CRM_HICK_STABLE_INT ((uint32_t)0x00000400)
#define | CRM_HEXT_STABLE_INT ((uint32_t)0x00000800)
#define | CRM_PLL_STABLE_INT ((uint32_t)0x00001000)
#define | CRM_CLOCK_FAILURE_INT ((uint32_t)0x00800000)

Detailed Description

crm interrupt

Macro Definition Documentation

◆ CRM_CLOCK_FAILURE_INT

#define CRM_CLOCK_FAILURE_INT ((uint32_t)0x00800000)

clock failure interrupt

Definition at line 87 of file at32f413_crm.h.

◆ CRM_HEXT_STABLE_INT

#define CRM_HEXT_STABLE_INT ((uint32_t)0x00000800)

high speed external crystal stable interrupt

Definition at line 85 of file at32f413_crm.h.

◆ CRM_HICK_STABLE_INT

#define CRM_HICK_STABLE_INT ((uint32_t)0x00000400)

high speed internal clock stable interrupt

Definition at line 84 of file at32f413_crm.h.

◆ CRM_LEXT_STABLE_INT

#define CRM_LEXT_STABLE_INT ((uint32_t)0x00000200)

low speed external crystal stable interrupt

Definition at line 83 of file at32f413_crm.h.

◆ CRM_LICK_STABLE_INT

#define CRM_LICK_STABLE_INT ((uint32_t)0x00000100)

low speed internal clock stable interrupt

Definition at line 82 of file at32f413_crm.h.

◆ CRM_PLL_STABLE_INT

#define CRM_PLL_STABLE_INT ((uint32_t)0x00001000)

phase locking loop stable interrupt

Definition at line 86 of file at32f413_crm.h.


AT32F413 Firmwary Library: CRM_exported_types

Data Structures | Enumerations
CRM_exported_types
AT32F413_periph_driver » CRM

Data Structures

struct | crm_clocks_freq_type
crm clocks freqency structure More...
struct | crm_type
type define crm register all More...

Enumerations

enum crm_periph_clock_type {
CRM_DMA1_PERIPH_CLOCK = (uint32_t)(((0x14) << 16) | (0 & 0x1F)) , CRM_DMA2_PERIPH_CLOCK = (uint32_t)(((0x14) << 16) | (1 & 0x1F)) , CRM_CRC_PERIPH_CLOCK = (uint32_t)(((0x14) << 16) | (6 & 0x1F)) , CRM_SDIO1_PERIPH_CLOCK = (uint32_t)(((0x14) << 16) | (10 & 0x1F)) ,
CRM_IOMUX_PERIPH_CLOCK = (uint32_t)(((0x18) << 16) | (0 & 0x1F)) , CRM_GPIOA_PERIPH_CLOCK = (uint32_t)(((0x18) << 16) | (2 & 0x1F)) , CRM_GPIOB_PERIPH_CLOCK = (uint32_t)(((0x18) << 16) | (3 & 0x1F)) , CRM_GPIOC_PERIPH_CLOCK = (uint32_t)(((0x18) << 16) | (4 & 0x1F)) ,
CRM_GPIOD_PERIPH_CLOCK = (uint32_t)(((0x18) << 16) | (5 & 0x1F)) , CRM_GPIOF_PERIPH_CLOCK = (uint32_t)(((0x18) << 16) | (7 & 0x1F)) , CRM_ADC1_PERIPH_CLOCK = (uint32_t)(((0x18) << 16) | (9 & 0x1F)) , CRM_ADC2_PERIPH_CLOCK = (uint32_t)(((0x18) << 16) | (10 & 0x1F)) ,
CRM_TMR1_PERIPH_CLOCK = (uint32_t)(((0x18) << 16) | (11 & 0x1F)) , CRM_SPI1_PERIPH_CLOCK = (uint32_t)(((0x18) << 16) | (12 & 0x1F)) , CRM_TMR8_PERIPH_CLOCK = (uint32_t)(((0x18) << 16) | (13 & 0x1F)) , CRM_USART1_PERIPH_CLOCK = (uint32_t)(((0x18) << 16) | (14 & 0x1F)) ,
CRM_TMR9_PERIPH_CLOCK = (uint32_t)(((0x18) << 16) | (19 & 0x1F)) , CRM_TMR10_PERIPH_CLOCK = (uint32_t)(((0x18) << 16) | (20 & 0x1F)) , CRM_TMR11_PERIPH_CLOCK = (uint32_t)(((0x18) << 16) | (21 & 0x1F)) , CRM_ACC_PERIPH_CLOCK = (uint32_t)(((0x18) << 16) | (22 & 0x1F)) ,
CRM_TMR2_PERIPH_CLOCK = (uint32_t)(((0x1C) << 16) | (0 & 0x1F)) , CRM_TMR3_PERIPH_CLOCK = (uint32_t)(((0x1C) << 16) | (1 & 0x1F)) , CRM_TMR4_PERIPH_CLOCK = (uint32_t)(((0x1C) << 16) | (2 & 0x1F)) , CRM_TMR5_PERIPH_CLOCK = (uint32_t)(((0x1C) << 16) | (3 & 0x1F)) ,
CRM_WWDT_PERIPH_CLOCK = (uint32_t)(((0x1C) << 16) | (11 & 0x1F)) , CRM_SPI2_PERIPH_CLOCK = (uint32_t)(((0x1C) << 16) | (14 & 0x1F)) , CRM_USART2_PERIPH_CLOCK = (uint32_t)(((0x1C) << 16) | (17 & 0x1F)) , CRM_USART3_PERIPH_CLOCK = (uint32_t)(((0x1C) << 16) | (18 & 0x1F)) ,
CRM_UART4_PERIPH_CLOCK = (uint32_t)(((0x1C) << 16) | (19 & 0x1F)) , CRM_UART5_PERIPH_CLOCK = (uint32_t)(((0x1C) << 16) | (20 & 0x1F)) , CRM_I2C1_PERIPH_CLOCK = (uint32_t)(((0x1C) << 16) | (21 & 0x1F)) , CRM_I2C2_PERIPH_CLOCK = (uint32_t)(((0x1C) << 16) | (22 & 0x1F)) ,
CRM_USB_PERIPH_CLOCK = (uint32_t)(((0x1C) << 16) | (23 & 0x1F)) , CRM_CAN1_PERIPH_CLOCK = (uint32_t)(((0x1C) << 16) | (25 & 0x1F)) , CRM_BPR_PERIPH_CLOCK = (uint32_t)(((0x1C) << 16) | (27 & 0x1F)) , CRM_PWC_PERIPH_CLOCK = (uint32_t)(((0x1C) << 16) | (28 & 0x1F)) ,
CRM_CAN2_PERIPH_CLOCK = (uint32_t)(((0x1C) << 16) | (31 & 0x1F))
}
crm periph clock More...
enum crm_periph_reset_type {
CRM_IOMUX_PERIPH_RESET = (uint32_t)(((0x0C) << 16) | (0 & 0x1F)) , CRM_EXINT_PERIPH_RESET = (uint32_t)(((0x0C) << 16) | (1 & 0x1F)) , CRM_GPIOA_PERIPH_RESET = (uint32_t)(((0x0C) << 16) | (2 & 0x1F)) , CRM_GPIOB_PERIPH_RESET = (uint32_t)(((0x0C) << 16) | (3 & 0x1F)) ,
CRM_GPIOC_PERIPH_RESET = (uint32_t)(((0x0C) << 16) | (4 & 0x1F)) , CRM_GPIOD_PERIPH_RESET = (uint32_t)(((0x0C) << 16) | (5 & 0x1F)) , CRM_GPIOF_PERIPH_RESET = (uint32_t)(((0x0C) << 16) | (7 & 0x1F)) , CRM_ADC1_PERIPH_RESET = (uint32_t)(((0x0C) << 16) | (9 & 0x1F)) ,
CRM_ADC2_PERIPH_RESET = (uint32_t)(((0x0C) << 16) | (10 & 0x1F)) , CRM_TMR1_PERIPH_RESET = (uint32_t)(((0x0C) << 16) | (11 & 0x1F)) , CRM_SPI1_PERIPH_RESET = (uint32_t)(((0x0C) << 16) | (12 & 0x1F)) , CRM_TMR8_PERIPH_RESET = (uint32_t)(((0x0C) << 16) | (13 & 0x1F)) ,
CRM_USART1_PERIPH_RESET = (uint32_t)(((0x0C) << 16) | (14 & 0x1F)) , CRM_TMR9_PERIPH_RESET = (uint32_t)(((0x0C) << 16) | (19 & 0x1F)) , CRM_TMR10_PERIPH_RESET = (uint32_t)(((0x0C) << 16) | (20 & 0x1F)) , CRM_TMR11_PERIPH_RESET = (uint32_t)(((0x0C) << 16) | (21 & 0x1F)) ,
CRM_ACC_PERIPH_RESET = (uint32_t)(((0x0C) << 16) | (22 & 0x1F)) , CRM_TMR2_PERIPH_RESET = (uint32_t)(((0x10) << 16) | (0 & 0x1F)) , CRM_TMR3_PERIPH_RESET = (uint32_t)(((0x10) << 16) | (1 & 0x1F)) , CRM_TMR4_PERIPH_RESET = (uint32_t)(((0x10) << 16) | (2 & 0x1F)) ,
CRM_TMR5_PERIPH_RESET = (uint32_t)(((0x10) << 16) | (3 & 0x1F)) , CRM_WWDT_PERIPH_RESET = (uint32_t)(((0x10) << 16) | (11 & 0x1F)) , CRM_SPI2_PERIPH_RESET = (uint32_t)(((0x10) << 16) | (14 & 0x1F)) , CRM_USART2_PERIPH_RESET = (uint32_t)(((0x10) << 16) | (17 & 0x1F)) ,
CRM_USART3_PERIPH_RESET = (uint32_t)(((0x10) << 16) | (18 & 0x1F)) , CRM_UART4_PERIPH_RESET = (uint32_t)(((0x10) << 16) | (19 & 0x1F)) , CRM_UART5_PERIPH_RESET = (uint32_t)(((0x10) << 16) | (20 & 0x1F)) , CRM_I2C1_PERIPH_RESET = (uint32_t)(((0x10) << 16) | (21 & 0x1F)) ,
CRM_I2C2_PERIPH_RESET = (uint32_t)(((0x10) << 16) | (22 & 0x1F)) , CRM_USB_PERIPH_RESET = (uint32_t)(((0x10) << 16) | (23 & 0x1F)) , CRM_CAN1_PERIPH_RESET = (uint32_t)(((0x10) << 16) | (25 & 0x1F)) , CRM_BPR_PERIPH_RESET = (uint32_t)(((0x10) << 16) | (27 & 0x1F)) ,
CRM_PWC_PERIPH_RESET = (uint32_t)(((0x10) << 16) | (28 & 0x1F)) , CRM_CAN2_PERIPH_RESET = (uint32_t)(((0x10) << 16) | (31 & 0x1F))
}
crm periph reset More...
enum | crm_periph_clock_sleepmd_type { CRM_SRAM_PERIPH_CLOCK_SLEEP_MODE = (uint32_t)(((0x14) << 16) | (2 & 0x1F)) , CRM_FLASH_PERIPH_CLOCK_SLEEP_MODE = (uint32_t)(((0x14) << 16) | (4 & 0x1F)) }
crm periph clock in sleep mode More...
enum crm_pll_mult_type {
CRM_PLL_MULT_2 = 0 , CRM_PLL_MULT_3 = 1 , CRM_PLL_MULT_4 = 2 , CRM_PLL_MULT_5 = 3 ,
CRM_PLL_MULT_6 = 4 , CRM_PLL_MULT_7 = 5 , CRM_PLL_MULT_8 = 6 , CRM_PLL_MULT_9 = 7 ,
CRM_PLL_MULT_10 = 8 , CRM_PLL_MULT_11 = 9 , CRM_PLL_MULT_12 = 10 , CRM_PLL_MULT_13 = 11 ,
CRM_PLL_MULT_14 = 12 , CRM_PLL_MULT_15 = 13 , CRM_PLL_MULT_16 = 15 , CRM_PLL_MULT_17 = 16 ,
CRM_PLL_MULT_18 = 17 , CRM_PLL_MULT_19 = 18 , CRM_PLL_MULT_20 = 19 , CRM_PLL_MULT_21 = 20 ,
CRM_PLL_MULT_22 = 21 , CRM_PLL_MULT_23 = 22 , CRM_PLL_MULT_24 = 23 , CRM_PLL_MULT_25 = 24 ,
CRM_PLL_MULT_26 = 25 , CRM_PLL_MULT_27 = 26 , CRM_PLL_MULT_28 = 27 , CRM_PLL_MULT_29 = 28 ,
CRM_PLL_MULT_30 = 29 , CRM_PLL_MULT_31 = 30 , CRM_PLL_MULT_32 = 31 , CRM_PLL_MULT_33 = 32 ,
CRM_PLL_MULT_34 = 33 , CRM_PLL_MULT_35 = 34 , CRM_PLL_MULT_36 = 35 , CRM_PLL_MULT_37 = 36 ,
CRM_PLL_MULT_38 = 37 , CRM_PLL_MULT_39 = 38 , CRM_PLL_MULT_40 = 39 , CRM_PLL_MULT_41 = 40 ,
CRM_PLL_MULT_42 = 41 , CRM_PLL_MULT_43 = 42 , CRM_PLL_MULT_44 = 43 , CRM_PLL_MULT_45 = 44 ,
CRM_PLL_MULT_46 = 45 , CRM_PLL_MULT_47 = 46 , CRM_PLL_MULT_48 = 47 , CRM_PLL_MULT_49 = 48 ,
CRM_PLL_MULT_50 = 49 , CRM_PLL_MULT_51 = 50 , CRM_PLL_MULT_52 = 51 , CRM_PLL_MULT_53 = 52 ,
CRM_PLL_MULT_54 = 53 , CRM_PLL_MULT_55 = 54 , CRM_PLL_MULT_56 = 55 , CRM_PLL_MULT_57 = 56 ,
CRM_PLL_MULT_58 = 57 , CRM_PLL_MULT_59 = 58 , CRM_PLL_MULT_60 = 59 , CRM_PLL_MULT_61 = 60 ,
CRM_PLL_MULT_62 = 61 , CRM_PLL_MULT_63 = 62 , CRM_PLL_MULT_64 = 63
}
crm pll mult_x More...
enum | crm_pll_clock_source_type { CRM_PLL_SOURCE_HICK = 0x00 , CRM_PLL_SOURCE_HEXT = 0x01 , CRM_PLL_SOURCE_HEXT_DIV = 0x02 }
crm pll clock source More...
enum | crm_pll_output_range_type { CRM_PLL_OUTPUT_RANGE_LE72MHZ = 0x00 , CRM_PLL_OUTPUT_RANGE_GT72MHZ = 0x01 }
crm pll clock output range More...
enum crm_clock_source_type {
CRM_CLOCK_SOURCE_HICK = 0x00 , CRM_CLOCK_SOURCE_HEXT = 0x01 , CRM_CLOCK_SOURCE_PLL = 0x02 , CRM_CLOCK_SOURCE_LEXT = 0x03 ,
CRM_CLOCK_SOURCE_LICK = 0x04
}
crm clock source More...
enum crm_ahb_div_type {
CRM_AHB_DIV_1 = 0x00 , CRM_AHB_DIV_2 = 0x08 , CRM_AHB_DIV_4 = 0x09 , CRM_AHB_DIV_8 = 0x0A ,
CRM_AHB_DIV_16 = 0x0B , CRM_AHB_DIV_64 = 0x0C , CRM_AHB_DIV_128 = 0x0D , CRM_AHB_DIV_256 = 0x0E ,
CRM_AHB_DIV_512 = 0x0F
}
crm ahb division More...
enum crm_apb1_div_type {
CRM_APB1_DIV_1 = 0x00 , CRM_APB1_DIV_2 = 0x04 , CRM_APB1_DIV_4 = 0x05 , CRM_APB1_DIV_8 = 0x06 ,
CRM_APB1_DIV_16 = 0x07
}
crm apb1 division More...
enum crm_apb2_div_type {
CRM_APB2_DIV_1 = 0x00 , CRM_APB2_DIV_2 = 0x04 , CRM_APB2_DIV_4 = 0x05 , CRM_APB2_DIV_8 = 0x06 ,
CRM_APB2_DIV_16 = 0x07
}
crm apb2 division More...
enum crm_adc_div_type {
CRM_ADC_DIV_2 = 0x00 , CRM_ADC_DIV_4 = 0x01 , CRM_ADC_DIV_6 = 0x02 , CRM_ADC_DIV_8 = 0x03 ,
CRM_ADC_DIV_12 = 0x05 , CRM_ADC_DIV_16 = 0x07
}
crm adc division More...
enum crm_usb_div_type {
CRM_USB_DIV_1_5 = 0x00 , CRM_USB_DIV_1 = 0x01 , CRM_USB_DIV_2_5 = 0x02 , CRM_USB_DIV_2 = 0x03 ,
CRM_USB_DIV_3_5 = 0x04 , CRM_USB_DIV_3 = 0x05 , CRM_USB_DIV_4 = 0x06
}
crm usb division More...
enum | crm_rtc_clock_type { CRM_RTC_CLOCK_NOCLK = 0x00 , CRM_RTC_CLOCK_LEXT = 0x01 , CRM_RTC_CLOCK_LICK = 0x02 , CRM_RTC_CLOCK_HEXT_DIV = 0x03 }
crm rtc clock More...
enum | crm_hick_div_6_type { CRM_HICK48_DIV6 = 0x00 , CRM_HICK48_NODIV = 0x01 }
crm hick 48mhz division More...
enum | crm_sclk_type { CRM_SCLK_HICK = 0x00 , CRM_SCLK_HEXT = 0x01 , CRM_SCLK_PLL = 0x02 }
crm sclk select More...
enum crm_clkout_select_type {
CRM_CLKOUT_NOCLK = 0x00 , CRM_CLKOUT_LICK = 0x02 , CRM_CLKOUT_LEXT = 0x03 , CRM_CLKOUT_SCLK = 0x04 ,
CRM_CLKOUT_HICK = 0x05 , CRM_CLKOUT_HEXT = 0x06 , CRM_CLKOUT_PLL_DIV_2 = 0x07 , CRM_CLKOUT_PLL_DIV_4 = 0x0C ,
CRM_CLKOUT_USB = 0x0D , CRM_CLKOUT_ADC = 0x0E
}
crm clkout select More...
enum crm_clkout_div_type {
CRM_CLKOUT_DIV_1 = 0x00 , CRM_CLKOUT_DIV_2 = 0x08 , CRM_CLKOUT_DIV_4 = 0x09 , CRM_CLKOUT_DIV_8 = 0x0A ,
CRM_CLKOUT_DIV_16 = 0x0B , CRM_CLKOUT_DIV_64 = 0x0C , CRM_CLKOUT_DIV_128 = 0x0D , CRM_CLKOUT_DIV_256 = 0x0E ,
CRM_CLKOUT_DIV_512 = 0x0F
}
crm clkout division More...
enum | crm_auto_step_mode_type { CRM_AUTO_STEP_MODE_DISABLE = 0x00 , CRM_AUTO_STEP_MODE_ENABLE = 0x03 }
crm auto step mode More...
enum | crm_usb_int_map_type { CRM_USB_INT19_INT20 = 0x00 , CRM_USB_INT73_INT74 = 0x01 }
crm usbdev interrupt remap More...
enum | crm_usb_clock_source_type { CRM_USB_CLOCK_SOURCE_PLL = 0x00 , CRM_USB_CLOCK_SOURCE_HICK = 0x01 }
crm usb 48 mhz clock source select More...
enum | crm_hick_sclk_frequency_type { CRM_HICK_SCLK_8MHZ = 0x00 , CRM_HICK_SCLK_48MHZ = 0x01 }
crm hick as system clock frequency select More...

Detailed Description

Enumeration Type Documentation

◆ crm_adc_div_type

enum crm_adc_div_type

crm adc division

Enumerator
CRM_ADC_DIV_2 | apb2clk div2 to adcclk
CRM_ADC_DIV_4 | apb2clk div4 to adcclk
CRM_ADC_DIV_6 | apb2clk div6 to adcclk
CRM_ADC_DIV_8 | apb2clk div8 to adcclk
CRM_ADC_DIV_12 | apb2clk div12 to adcclk
CRM_ADC_DIV_16 | apb2clk div16 to adcclk

Definition at line 343 of file at32f413_crm.h.

◆ crm_ahb_div_type

enum crm_ahb_div_type

crm ahb division

Enumerator
CRM_AHB_DIV_1 | sclk div1 to ahbclk
CRM_AHB_DIV_2 | sclk div2 to ahbclk
CRM_AHB_DIV_4 | sclk div4 to ahbclk
CRM_AHB_DIV_8 | sclk div8 to ahbclk
CRM_AHB_DIV_16 | sclk div16 to ahbclk
CRM_AHB_DIV_64 | sclk div64 to ahbclk
CRM_AHB_DIV_128 | sclk div128 to ahbclk
CRM_AHB_DIV_256 | sclk div256 to ahbclk
CRM_AHB_DIV_512 | sclk div512 to ahbclk

Definition at line 303 of file at32f413_crm.h.

◆ crm_apb1_div_type

enum crm_apb1_div_type

crm apb1 division

Enumerator
CRM_APB1_DIV_1 | ahbclk div1 to apb1clk
CRM_APB1_DIV_2 | ahbclk div2 to apb1clk
CRM_APB1_DIV_4 | ahbclk div4 to apb1clk
CRM_APB1_DIV_8 | ahbclk div8 to apb1clk
CRM_APB1_DIV_16 | ahbclk div16 to apb1clk

Definition at line 319 of file at32f413_crm.h.

◆ crm_apb2_div_type

enum crm_apb2_div_type

crm apb2 division

Enumerator
CRM_APB2_DIV_1 | ahbclk div1 to apb2clk
CRM_APB2_DIV_2 | ahbclk div2 to apb2clk
CRM_APB2_DIV_4 | ahbclk div4 to apb2clk
CRM_APB2_DIV_8 | ahbclk div8 to apb2clk
CRM_APB2_DIV_16 | ahbclk div16 to apb2clk

Definition at line 331 of file at32f413_crm.h.

◆ crm_auto_step_mode_type

enum crm_auto_step_mode_type

crm auto step mode

Enumerator
CRM_AUTO_STEP_MODE_DISABLE | disable auto step mode
CRM_AUTO_STEP_MODE_ENABLE | enable auto step mode

Definition at line 433 of file at32f413_crm.h.

◆ crm_clkout_div_type

enum crm_clkout_div_type

crm clkout division

Enumerator
CRM_CLKOUT_DIV_1 | clkout div1
CRM_CLKOUT_DIV_2 | clkout div2
CRM_CLKOUT_DIV_4 | clkout div4
CRM_CLKOUT_DIV_8 | clkout div8
CRM_CLKOUT_DIV_16 | clkout div16
CRM_CLKOUT_DIV_64 | clkout div64
CRM_CLKOUT_DIV_128 | clkout div128
CRM_CLKOUT_DIV_256 | clkout div256
CRM_CLKOUT_DIV_512 | clkout div512

Definition at line 417 of file at32f413_crm.h.

◆ crm_clkout_select_type

enum crm_clkout_select_type

crm clkout select

Enumerator
CRM_CLKOUT_NOCLK | output no clock to clkout pin
CRM_CLKOUT_LICK | output low speed internal clock to clkout pin
CRM_CLKOUT_LEXT | output low speed external crystal to clkout pin
CRM_CLKOUT_SCLK | output system clock to clkout pin
CRM_CLKOUT_HICK | output high speed internal clock to clkout pin
CRM_CLKOUT_HEXT | output high speed external crystal to clkout pin
CRM_CLKOUT_PLL_DIV_2 | output phase locking loop clock div2 to clkout pin
CRM_CLKOUT_PLL_DIV_4 | output phase locking loop clock div4 to clkout pin
CRM_CLKOUT_USB | output usbclk to clkout pin
CRM_CLKOUT_ADC | output adcclk to clkout pin

Definition at line 400 of file at32f413_crm.h.

◆ crm_clock_source_type

enum crm_clock_source_type

crm clock source

Enumerator
CRM_CLOCK_SOURCE_HICK | high speed internal clock
CRM_CLOCK_SOURCE_HEXT | high speed external crystal
CRM_CLOCK_SOURCE_PLL | phase locking loop
CRM_CLOCK_SOURCE_LEXT | low speed external crystal
CRM_CLOCK_SOURCE_LICK | low speed internal clock

Definition at line 291 of file at32f413_crm.h.

◆ crm_hick_div_6_type

enum crm_hick_div_6_type

crm hick 48mhz division

Enumerator
CRM_HICK48_DIV6 | high speed internal clock (48 mhz) div6
CRM_HICK48_NODIV | high speed internal clock (48 mhz) no div

Definition at line 381 of file at32f413_crm.h.

◆ crm_hick_sclk_frequency_type

enum crm_hick_sclk_frequency_type

crm hick as system clock frequency select

Enumerator
CRM_HICK_SCLK_8MHZ | fixed 8 mhz when hick is selected as sclk
CRM_HICK_SCLK_48MHZ | 8 mhz or 48 mhz depend on hickdiv when hick is selected as sclk

Definition at line 460 of file at32f413_crm.h.

◆ crm_periph_clock_sleepmd_type

enum crm_periph_clock_sleepmd_type

crm periph clock in sleep mode

Enumerator
CRM_SRAM_PERIPH_CLOCK_SLEEP_MODE | sram sleep mode periph clock
CRM_FLASH_PERIPH_CLOCK_SLEEP_MODE | flash sleep mode periph clock

Definition at line 192 of file at32f413_crm.h.

◆ crm_periph_clock_type

enum crm_periph_clock_type

crm periph clock

Enumerator
CRM_DMA1_PERIPH_CLOCK | dma1 periph clock
CRM_DMA2_PERIPH_CLOCK | dma2 periph clock
CRM_CRC_PERIPH_CLOCK | crc periph clock
CRM_SDIO1_PERIPH_CLOCK | sdio1 periph clock
CRM_IOMUX_PERIPH_CLOCK | iomux periph clock
CRM_GPIOA_PERIPH_CLOCK | gpioa periph clock
CRM_GPIOB_PERIPH_CLOCK | gpiob periph clock
CRM_GPIOC_PERIPH_CLOCK | gpioc periph clock
CRM_GPIOD_PERIPH_CLOCK | gpiod periph clock
CRM_GPIOF_PERIPH_CLOCK | gpiof periph clock
CRM_ADC1_PERIPH_CLOCK | adc1 periph clock
CRM_ADC2_PERIPH_CLOCK | adc2 periph clock
CRM_TMR1_PERIPH_CLOCK | tmr1 periph clock
CRM_SPI1_PERIPH_CLOCK | spi1 periph clock
CRM_TMR8_PERIPH_CLOCK | tmr8 periph clock
CRM_USART1_PERIPH_CLOCK | usart1 periph clock
CRM_TMR9_PERIPH_CLOCK | tmr9 periph clock
CRM_TMR10_PERIPH_CLOCK | tmr10 periph clock
CRM_TMR11_PERIPH_CLOCK | tmr11 periph clock
CRM_ACC_PERIPH_CLOCK | acc periph clock
CRM_TMR2_PERIPH_CLOCK | tmr2 periph clock
CRM_TMR3_PERIPH_CLOCK | tmr3 periph clock
CRM_TMR4_PERIPH_CLOCK | tmr4 periph clock
CRM_TMR5_PERIPH_CLOCK | tmr5 periph clock
CRM_WWDT_PERIPH_CLOCK | wwdt periph clock
CRM_SPI2_PERIPH_CLOCK | spi2 periph clock
CRM_USART2_PERIPH_CLOCK | usart2 periph clock
CRM_USART3_PERIPH_CLOCK | usart3 periph clock
CRM_UART4_PERIPH_CLOCK | uart4 periph clock
CRM_UART5_PERIPH_CLOCK | uart5 periph clock
CRM_I2C1_PERIPH_CLOCK | i2c1 periph clock
CRM_I2C2_PERIPH_CLOCK | i2c2 periph clock
CRM_USB_PERIPH_CLOCK | usb periph clock
CRM_CAN1_PERIPH_CLOCK | can1 periph clock
CRM_BPR_PERIPH_CLOCK | bpr periph clock
CRM_PWC_PERIPH_CLOCK | pwc periph clock
CRM_CAN2_PERIPH_CLOCK | can2 periph clock

Definition at line 100 of file at32f413_crm.h.

◆ crm_periph_reset_type

enum crm_periph_reset_type

crm periph reset

Enumerator
CRM_IOMUX_PERIPH_RESET | iomux periph reset
CRM_EXINT_PERIPH_RESET | exint periph reset
CRM_GPIOA_PERIPH_RESET | gpioa periph reset
CRM_GPIOB_PERIPH_RESET | gpiob periph reset
CRM_GPIOC_PERIPH_RESET | gpioc periph reset
CRM_GPIOD_PERIPH_RESET | gpiod periph reset
CRM_GPIOF_PERIPH_RESET | gpiof periph reset
CRM_ADC1_PERIPH_RESET | adc1 periph reset
CRM_ADC2_PERIPH_RESET | adc2 periph reset
CRM_TMR1_PERIPH_RESET | tmr1 periph reset
CRM_SPI1_PERIPH_RESET | spi2 periph reset
CRM_TMR8_PERIPH_RESET | tmr8 periph reset
CRM_USART1_PERIPH_RESET | usart1 periph reset
CRM_TMR9_PERIPH_RESET | tmr9 periph reset
CRM_TMR10_PERIPH_RESET | tmr10 periph reset
CRM_TMR11_PERIPH_RESET | tmr11 periph reset
CRM_ACC_PERIPH_RESET | acc periph reset
CRM_TMR2_PERIPH_RESET | tmr2 periph reset
CRM_TMR3_PERIPH_RESET | tmr3 periph reset
CRM_TMR4_PERIPH_RESET | tmr4 periph reset
CRM_TMR5_PERIPH_RESET | tmr5 periph reset
CRM_WWDT_PERIPH_RESET | wwdt periph reset
CRM_SPI2_PERIPH_RESET | spi2 periph reset
CRM_USART2_PERIPH_RESET | usart2 periph reset
CRM_USART3_PERIPH_RESET | usart3 periph reset
CRM_UART4_PERIPH_RESET | uart4 periph reset
CRM_UART5_PERIPH_RESET | uart5 periph reset
CRM_I2C1_PERIPH_RESET | i2c1 periph reset
CRM_I2C2_PERIPH_RESET | i2c2 periph reset
CRM_USB_PERIPH_RESET | usb periph reset
CRM_CAN1_PERIPH_RESET | can1 periph reset
CRM_BPR_PERIPH_RESET | bpr periph reset
CRM_PWC_PERIPH_RESET | pwc periph reset
CRM_CAN2_PERIPH_RESET | can2 periph reset

Definition at line 148 of file at32f413_crm.h.

◆ crm_pll_clock_source_type

enum crm_pll_clock_source_type

crm pll clock source

Enumerator
CRM_PLL_SOURCE_HICK | high speed internal clock as pll reference clock source
CRM_PLL_SOURCE_HEXT | high speed external crystal as pll reference clock source
CRM_PLL_SOURCE_HEXT_DIV | high speed external crystal div as pll reference clock source

Definition at line 272 of file at32f413_crm.h.

◆ crm_pll_mult_type

enum crm_pll_mult_type

crm pll mult_x

Enumerator
CRM_PLL_MULT_2 | pll multiplication factor 2
CRM_PLL_MULT_3 | pll multiplication factor 3
CRM_PLL_MULT_4 | pll multiplication factor 4
CRM_PLL_MULT_5 | pll multiplication factor 5
CRM_PLL_MULT_6 | pll multiplication factor 6
CRM_PLL_MULT_7 | pll multiplication factor 7
CRM_PLL_MULT_8 | pll multiplication factor 8
CRM_PLL_MULT_9 | pll multiplication factor 9
CRM_PLL_MULT_10 | pll multiplication factor 10
CRM_PLL_MULT_11 | pll multiplication factor 11
CRM_PLL_MULT_12 | pll multiplication factor 12
CRM_PLL_MULT_13 | pll multiplication factor 13
CRM_PLL_MULT_14 | pll multiplication factor 14
CRM_PLL_MULT_15 | pll multiplication factor 15
CRM_PLL_MULT_16 | pll multiplication factor 16
CRM_PLL_MULT_17 | pll multiplication factor 17
CRM_PLL_MULT_18 | pll multiplication factor 18
CRM_PLL_MULT_19 | pll multiplication factor 19
CRM_PLL_MULT_20 | pll multiplication factor 20
CRM_PLL_MULT_21 | pll multiplication factor 21
CRM_PLL_MULT_22 | pll multiplication factor 22
CRM_PLL_MULT_23 | pll multiplication factor 23
CRM_PLL_MULT_24 | pll multiplication factor 24
CRM_PLL_MULT_25 | pll multiplication factor 25
CRM_PLL_MULT_26 | pll multiplication factor 26
CRM_PLL_MULT_27 | pll multiplication factor 27
CRM_PLL_MULT_28 | pll multiplication factor 28
CRM_PLL_MULT_29 | pll multiplication factor 29
CRM_PLL_MULT_30 | pll multiplication factor 30
CRM_PLL_MULT_31 | pll multiplication factor 31
CRM_PLL_MULT_32 | pll multiplication factor 32
CRM_PLL_MULT_33 | pll multiplication factor 33
CRM_PLL_MULT_34 | pll multiplication factor 34
CRM_PLL_MULT_35 | pll multiplication factor 35
CRM_PLL_MULT_36 | pll multiplication factor 36
CRM_PLL_MULT_37 | pll multiplication factor 37
CRM_PLL_MULT_38 | pll multiplication factor 38
CRM_PLL_MULT_39 | pll multiplication factor 39
CRM_PLL_MULT_40 | pll multiplication factor 40
CRM_PLL_MULT_41 | pll multiplication factor 41
CRM_PLL_MULT_42 | pll multiplication factor 42
CRM_PLL_MULT_43 | pll multiplication factor 43
CRM_PLL_MULT_44 | pll multiplication factor 44
CRM_PLL_MULT_45 | pll multiplication factor 45
CRM_PLL_MULT_46 | pll multiplication factor 46
CRM_PLL_MULT_47 | pll multiplication factor 47
CRM_PLL_MULT_48 | pll multiplication factor 48
CRM_PLL_MULT_49 | pll multiplication factor 49
CRM_PLL_MULT_50 | pll multiplication factor 50
CRM_PLL_MULT_51 | pll multiplication factor 51
CRM_PLL_MULT_52 | pll multiplication factor 52
CRM_PLL_MULT_53 | pll multiplication factor 53
CRM_PLL_MULT_54 | pll multiplication factor 54
CRM_PLL_MULT_55 | pll multiplication factor 55
CRM_PLL_MULT_56 | pll multiplication factor 56
CRM_PLL_MULT_57 | pll multiplication factor 57
CRM_PLL_MULT_58 | pll multiplication factor 58
CRM_PLL_MULT_59 | pll multiplication factor 59
CRM_PLL_MULT_60 | pll multiplication factor 60
CRM_PLL_MULT_61 | pll multiplication factor 61
CRM_PLL_MULT_62 | pll multiplication factor 62
CRM_PLL_MULT_63 | pll multiplication factor 63
CRM_PLL_MULT_64 | pll multiplication factor 64

Definition at line 202 of file at32f413_crm.h.

◆ crm_pll_output_range_type

enum crm_pll_output_range_type

crm pll clock output range

Enumerator
CRM_PLL_OUTPUT_RANGE_LE72MHZ | pll clock output range less than or equal to 72mhz
CRM_PLL_OUTPUT_RANGE_GT72MHZ | pll clock output range greater than 72mhz

Definition at line 282 of file at32f413_crm.h.

◆ crm_rtc_clock_type

enum crm_rtc_clock_type

crm rtc clock

Enumerator
CRM_RTC_CLOCK_NOCLK | no clock as rtc clock source
CRM_RTC_CLOCK_LEXT | low speed external crystal as rtc clock source
CRM_RTC_CLOCK_LICK | low speed internal clock as rtc clock source
CRM_RTC_CLOCK_HEXT_DIV | high speed external crystal div as rtc clock source

Definition at line 370 of file at32f413_crm.h.

◆ crm_sclk_type

enum crm_sclk_type

crm sclk select

Enumerator
CRM_SCLK_HICK | select high speed internal clock as sclk
CRM_SCLK_HEXT | select high speed external crystal as sclk
CRM_SCLK_PLL | select phase locking loop clock as sclk

Definition at line 390 of file at32f413_crm.h.

◆ crm_usb_clock_source_type

enum crm_usb_clock_source_type

crm usb 48 mhz clock source select

Enumerator
CRM_USB_CLOCK_SOURCE_PLL | select phase locking loop clock as usb clock source
CRM_USB_CLOCK_SOURCE_HICK | select high speed internal clock as usb clock source

Definition at line 451 of file at32f413_crm.h.

◆ crm_usb_div_type

enum crm_usb_div_type

crm usb division

Enumerator
CRM_USB_DIV_1_5 | pllclk div1.5 to usbclk
CRM_USB_DIV_1 | pllclk div1 to usbclk
CRM_USB_DIV_2_5 | pllclk div2.5 to usbclk
CRM_USB_DIV_2 | pllclk div2 to usbclk
CRM_USB_DIV_3_5 | pllclk div3.5 to usbclk
CRM_USB_DIV_3 | pllclk div3 to usbclk
CRM_USB_DIV_4 | pllclk div4 to usbclk

Definition at line 356 of file at32f413_crm.h.

◆ crm_usb_int_map_type

enum crm_usb_int_map_type

crm usbdev interrupt remap

Enumerator
CRM_USB_INT19_INT20 | usb high and low priority irq numer use 19 and 20
CRM_USB_INT73_INT74 | usb high and low priority irq numer use 73 and 74

Definition at line 442 of file at32f413_crm.h.


AT32F413 Firmwary Library: crm_clocks_freq_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
crm_clocks_freq_type Struct Reference
AT32F413_periph_driver » CRM » CRM_exported_types

crm clocks freqency structure More...

#include <at32f413_crm.h>

Data Fields

uint32_t | sclk_freq
uint32_t | ahb_freq
uint32_t | apb2_freq
uint32_t | apb1_freq
uint32_t | adc_freq

Detailed Description

crm clocks freqency structure

Definition at line 469 of file at32f413_crm.h.

Field Documentation

◆ adc_freq

uint32_t crm_clocks_freq_type::adc_freq

adc clock frequency

Definition at line 475 of file at32f413_crm.h.

Referenced by crm_clocks_freq_get().

◆ ahb_freq

uint32_t crm_clocks_freq_type::ahb_freq

ahb bus clock frequency

Definition at line 472 of file at32f413_crm.h.

Referenced by crm_clocks_freq_get(), main(), and tmr_init().

◆ apb1_freq

uint32_t crm_clocks_freq_type::apb1_freq

apb1 bus clock frequency

Definition at line 474 of file at32f413_crm.h.

Referenced by crm_clocks_freq_get(), i2c_init(), main(), usart_configuration(), and usart_init().

◆ apb2_freq

uint32_t crm_clocks_freq_type::apb2_freq

apb2 bus clock frequency

Definition at line 473 of file at32f413_crm.h.

Referenced by crm_clocks_freq_get(), and usart_init().

◆ sclk_freq

uint32_t crm_clocks_freq_type::sclk_freq

system clock frequency

Definition at line 471 of file at32f413_crm.h.

Referenced by crm_clocks_freq_get(), i2s_init(), main(), systick_configuration(), tmr1_config(), tmr2_config(), TMR3_GLOBAL_IRQHandler(), and usb_clock48m_select().

The documentation for this struct was generated from the following file:
  • at32f413_crm.h


AT32F413 Firmwary Library: crm_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
crm_type Struct Reference
AT32F413_periph_driver » CRM » CRM_exported_types

type define crm register all More...

#include <at32f413_crm.h>

Data Fields

union {
__IO uint32_t ctrl
struct {
__IO uint32_t hicken: 1
__IO uint32_t hickstbl: 1
__IO uint32_t hicktrim: 6
__IO uint32_t hickcal: 8
__IO uint32_t hexten: 1
__IO uint32_t hextstbl: 1
__IO uint32_t hextbyps: 1
__IO uint32_t cfden: 1
__IO uint32_t reserved1: 4
__IO uint32_t pllen: 1
__IO uint32_t pllstbl: 1
__IO uint32_t reserved2: 6
} ctrl_bit
};
crm ctrl register, offset:0x00
union {
__IO uint32_t cfg
struct {
__IO uint32_t sclksel: 2
__IO uint32_t sclksts: 2
__IO uint32_t ahbdiv: 4
__IO uint32_t apb1div: 3
__IO uint32_t apb2div: 3
__IO uint32_t adcdiv_l: 2
__IO uint32_t pllrcs: 1
__IO uint32_t pllhextdiv: 1
__IO uint32_t pllmult_l: 4
__IO uint32_t usbdiv_l: 2
__IO uint32_t clkout_sel: 3
__IO uint32_t usbdiv_h: 1
__IO uint32_t adcdiv_h: 1
__IO uint32_t pllmult_h: 2
__IO uint32_t pllrange: 1
} cfg_bit
};
crm cfg register, offset:0x04
union {
__IO uint32_t clkint
struct {
__IO uint32_t lickstblf: 1
__IO uint32_t lextstblf: 1
__IO uint32_t hickstblf: 1
__IO uint32_t hextstblf: 1
__IO uint32_t pllstblf: 1
__IO uint32_t reserved1: 2
__IO uint32_t cfdf: 1
__IO uint32_t lickstblien: 1
__IO uint32_t lextstblien: 1
__IO uint32_t hickstblien: 1
__IO uint32_t hextstblien: 1
__IO uint32_t pllstblien: 1
__IO uint32_t reserved2: 3
__IO uint32_t lickstblfc: 1
__IO uint32_t lextstblfc: 1
__IO uint32_t hickstblfc: 1
__IO uint32_t hextstblfc: 1
__IO uint32_t pllstblfc: 1
__IO uint32_t reserved3: 2
__IO uint32_t cfdfc: 1
__IO uint32_t reserved4: 8
} clkint_bit
};
crm clkint register, offset:0x08
union {
__IO uint32_t apb2rst
struct {
__IO uint32_t iomuxrst: 1
__IO uint32_t exintrst: 1
__IO uint32_t gpioarst: 1
__IO uint32_t gpiobrst: 1
__IO uint32_t gpiocrst: 1
__IO uint32_t gpiodrst: 1
__IO uint32_t reserved1: 1
__IO uint32_t gpioerst: 1
__IO uint32_t reserved2: 1
__IO uint32_t adc1rst: 1
__IO uint32_t adc2rst: 1
__IO uint32_t tmr1rst: 1
__IO uint32_t spi1rst: 1
__IO uint32_t tmr8rst: 1
__IO uint32_t usart1rst: 1
__IO uint32_t reserved3: 4
__IO uint32_t tmr9rst: 1
__IO uint32_t tmr10rst: 1
__IO uint32_t tmr11rst: 1
__IO uint32_t accrst: 1
__IO uint32_t reserved4: 9
} apb2rst_bit
};
crm apb2rst register, offset:0x0C
union {
__IO uint32_t apb1rst
struct {
__IO uint32_t tmr2rst: 1
__IO uint32_t tmr3rst: 1
__IO uint32_t tmr4rst: 1
__IO uint32_t tmr5rst: 1
__IO uint32_t reserved1: 7
__IO uint32_t wwdtrst: 1
__IO uint32_t reserved2: 2
__IO uint32_t spi2rst: 1
__IO uint32_t reserved3: 2
__IO uint32_t usart2rst: 1
__IO uint32_t usart3rst: 1
__IO uint32_t uart4rst: 1
__IO uint32_t uart5rst: 1
__IO uint32_t i2c1rst: 1
__IO uint32_t i2c2rst: 1
__IO uint32_t usbrst: 1
__IO uint32_t reserved4: 1
__IO uint32_t can1rst: 1
__IO uint32_t reserved5: 1
__IO uint32_t bprrst: 1
__IO uint32_t pwcrst: 1
__IO uint32_t reserved6: 2
__IO uint32_t can2rst: 1
} apb1rst_bit
};
crm apb1rst register, offset:0x10
union {
__IO uint32_t ahben
struct {
__IO uint32_t dma1en: 1
__IO uint32_t dma2en: 1
__IO uint32_t sramen: 1
__IO uint32_t reserved1: 1
__IO uint32_t flashen: 1
__IO uint32_t reserved2: 1
__IO uint32_t crcen: 1
__IO uint32_t reserved3: 3
__IO uint32_t sdio1en: 1
__IO uint32_t reserved5: 21
} ahben_bit
};
crm ahben register, offset:0x14
union {
__IO uint32_t apb2en
struct {
__IO uint32_t iomuxen: 1
__IO uint32_t reserved1: 1
__IO uint32_t gpioaen: 1
__IO uint32_t gpioben: 1
__IO uint32_t gpiocen: 1
__IO uint32_t gpioden: 1
__IO uint32_t reserved2: 1
__IO uint32_t gpiofen: 1
__IO uint32_t reserved3: 1
__IO uint32_t adc1en: 1
__IO uint32_t adc2en: 1
__IO uint32_t tmr1en: 1
__IO uint32_t spi1en: 1
__IO uint32_t tmr8en: 1
__IO uint32_t usart1en: 1
__IO uint32_t reserved4: 4
__IO uint32_t tmr9en: 1
__IO uint32_t tmr10en: 1
__IO uint32_t tmr11en: 1
__IO uint32_t accen: 1
__IO uint32_t reserved5: 9
} apb2en_bit
};
crm apb2en register, offset:0x18
union {
__IO uint32_t apb1en
struct {
__IO uint32_t tmr2en: 1
__IO uint32_t tmr3en: 1
__IO uint32_t tmr4en: 1
__IO uint32_t tmr5en: 1
__IO uint32_t reserved1: 7
__IO uint32_t wwdten: 1
__IO uint32_t reserved2: 2
__IO uint32_t spi2en: 1
__IO uint32_t reserved3: 2
__IO uint32_t usart2en: 1
__IO uint32_t usart3en: 1
__IO uint32_t uart4en: 1
__IO uint32_t uart5en: 1
__IO uint32_t i2c1en: 1
__IO uint32_t i2c2en: 1
__IO uint32_t usben: 1
__IO uint32_t reserved4: 1
__IO uint32_t can1en: 1
__IO uint32_t reserved5: 1
__IO uint32_t bpren: 1
__IO uint32_t pwcen: 1
__IO uint32_t reserved6: 2
__IO uint32_t can2en: 1
} apb1en_bit
};
crm apb1en register, offset:0x1C
union {
__IO uint32_t bpdc
struct {
__IO uint32_t lexten: 1
__IO uint32_t lextstbl: 1
__IO uint32_t lextbyps: 1
__IO uint32_t reserved1: 5
__IO uint32_t rtcsel: 2
__IO uint32_t reserved2: 5
__IO uint32_t rtcen: 1
__IO uint32_t bpdrst: 1
__IO uint32_t reserved3: 15
} bpdc_bit
};
crm bpdc register, offset:0x20
union {
__IO uint32_t ctrlsts
struct {
__IO uint32_t licken: 1
__IO uint32_t lickstbl: 1
__IO uint32_t reserved1: 22
__IO uint32_t rstfc: 1
__IO uint32_t reserved2: 1
__IO uint32_t nrstf: 1
__IO uint32_t porrstf: 1
__IO uint32_t swrstf: 1
__IO uint32_t wdtrstf: 1
__IO uint32_t wwdtrstf: 1
__IO uint32_t lprstf: 1
} ctrlsts_bit
};
crm ctrlsts register, offset:0x24
union {
__IO uint32_t misc1
struct {
__IO uint32_t hickcal_key: 8
__IO uint32_t reserved1: 8
__IO uint32_t clkout_sel: 1
__IO uint32_t reserved2: 7
__IO uint32_t usbbufs: 1
__IO uint32_t hickdiv: 1
__IO uint32_t reserved3: 2
__IO uint32_t clkoutdiv: 4
} misc1_bit
};
crm misc1 register, offset:0x30
union {
__IO uint32_t misc2
struct {
__IO uint32_t reserved1: 16
__IO uint32_t clk_to_tmr: 1
__IO uint32_t reserved2: 15
} misc2_bit
};
crm misc2 register, offset:0x50
union {
__IO uint32_t misc3
struct {
__IO uint32_t reserved1: 4
__IO uint32_t auto_step_en: 2
__IO uint32_t reserved2: 2
__IO uint32_t hick_to_usb: 1
__IO uint32_t hick_to_sclk: 1
__IO uint32_t reserved3: 22
} misc3_bit
};
crm misc3 register, offset:0x54
union {
__IO uint32_t intmap
struct {
__IO uint32_t usbintmap: 1
__IO uint32_t reserved1: 31
} intmap_bit
};
crm intmap register, offset:0x5C

Detailed Description

type define crm register all

Definition at line 481 of file at32f413_crm.h.

Field Documentation

◆ [union]

union { ... } crm_type

crm ctrl register, offset:0x00

◆ [union]

union { ... } crm_type

crm cfg register, offset:0x04

◆ [union]

union { ... } crm_type

crm clkint register, offset:0x08

◆ [union]

union { ... } crm_type

crm apb2rst register, offset:0x0C

◆ [union]

union { ... } crm_type

crm apb1rst register, offset:0x10

◆ [union]

union { ... } crm_type

crm ahben register, offset:0x14

◆ [union]

union { ... } crm_type

crm apb2en register, offset:0x18

◆ [union]

union { ... } crm_type

crm apb1en register, offset:0x1C

◆ [union]

union { ... } crm_type

crm bpdc register, offset:0x20

◆ [union]

union { ... } crm_type

crm ctrlsts register, offset:0x24

◆ [union]

union { ... } crm_type

crm misc1 register, offset:0x30

◆ [union]

union { ... } crm_type

crm misc2 register, offset:0x50

◆ [union]

union { ... } crm_type

crm misc3 register, offset:0x54

◆ [union]

union { ... } crm_type

crm intmap register, offset:0x5C

◆ accen

__IO uint32_t crm_type::accen

Definition at line 678 of file at32f413_crm.h.

◆ accrst

__IO uint32_t crm_type::accrst

Definition at line 591 of file at32f413_crm.h.

◆ adc1en

__IO uint32_t crm_type::adc1en

Definition at line 668 of file at32f413_crm.h.

◆ adc1rst

__IO uint32_t crm_type::adc1rst

Definition at line 581 of file at32f413_crm.h.

◆ adc2en

__IO uint32_t crm_type::adc2en

Definition at line 669 of file at32f413_crm.h.

◆ adc2rst

__IO uint32_t crm_type::adc2rst

Definition at line 582 of file at32f413_crm.h.

◆ adcdiv_h

__IO uint32_t crm_type::adcdiv_h

Definition at line 526 of file at32f413_crm.h.

◆ adcdiv_l

__IO uint32_t crm_type::adcdiv_l

Definition at line 519 of file at32f413_crm.h.

◆ ahbdiv

__IO uint32_t crm_type::ahbdiv

Definition at line 516 of file at32f413_crm.h.

◆ ahben

__IO uint32_t crm_type::ahben

Definition at line 635 of file at32f413_crm.h.

◆ [struct]

struct { ... } crm_type::ahben_bit

◆ apb1div

__IO uint32_t crm_type::apb1div

Definition at line 517 of file at32f413_crm.h.

◆ apb1en

__IO uint32_t crm_type::apb1en

Definition at line 688 of file at32f413_crm.h.

◆ [struct]

struct { ... } crm_type::apb1en_bit

◆ apb1rst

__IO uint32_t crm_type::apb1rst

Definition at line 601 of file at32f413_crm.h.

◆ [struct]

struct { ... } crm_type::apb1rst_bit

◆ apb2div

__IO uint32_t crm_type::apb2div

Definition at line 518 of file at32f413_crm.h.

◆ apb2en

__IO uint32_t crm_type::apb2en

Definition at line 656 of file at32f413_crm.h.

◆ [struct]

struct { ... } crm_type::apb2en_bit

◆ apb2rst

__IO uint32_t crm_type::apb2rst

Definition at line 569 of file at32f413_crm.h.

◆ [struct]

struct { ... } crm_type::apb2rst_bit

◆ auto_step_en

__IO uint32_t crm_type::auto_step_en

Definition at line 811 of file at32f413_crm.h.

◆ bpdc

__IO uint32_t crm_type::bpdc

Definition at line 722 of file at32f413_crm.h.

◆ [struct]

struct { ... } crm_type::bpdc_bit

◆ bpdrst

__IO uint32_t crm_type::bpdrst

Definition at line 732 of file at32f413_crm.h.

◆ bpren

__IO uint32_t crm_type::bpren

Definition at line 710 of file at32f413_crm.h.

◆ bprrst

__IO uint32_t crm_type::bprrst

Definition at line 623 of file at32f413_crm.h.

◆ can1en

__IO uint32_t crm_type::can1en

Definition at line 708 of file at32f413_crm.h.

◆ can1rst

__IO uint32_t crm_type::can1rst

Definition at line 621 of file at32f413_crm.h.

◆ can2en

__IO uint32_t crm_type::can2en

Definition at line 713 of file at32f413_crm.h.

◆ can2rst

__IO uint32_t crm_type::can2rst

Definition at line 626 of file at32f413_crm.h.

◆ cfden

__IO uint32_t crm_type::cfden

Definition at line 498 of file at32f413_crm.h.

◆ cfdf

__IO uint32_t crm_type::cfdf

Definition at line 546 of file at32f413_crm.h.

◆ cfdfc

__IO uint32_t crm_type::cfdfc

Definition at line 559 of file at32f413_crm.h.

◆ cfg

__IO uint32_t crm_type::cfg

Definition at line 511 of file at32f413_crm.h.

◆ [struct]

struct { ... } crm_type::cfg_bit

◆ clk_to_tmr

__IO uint32_t crm_type::clk_to_tmr

Definition at line 797 of file at32f413_crm.h.

◆ clkint

__IO uint32_t crm_type::clkint

Definition at line 537 of file at32f413_crm.h.

◆ [struct]

struct { ... } crm_type::clkint_bit

◆ clkout_sel

__IO uint32_t crm_type::clkout_sel

Definition at line 524 of file at32f413_crm.h.

◆ clkoutdiv

__IO uint32_t crm_type::clkoutdiv

Definition at line 779 of file at32f413_crm.h.

◆ crcen

__IO uint32_t crm_type::crcen

Definition at line 644 of file at32f413_crm.h.

◆ ctrl

__IO uint32_t crm_type::ctrl

Definition at line 488 of file at32f413_crm.h.

◆ [struct]

struct { ... } crm_type::ctrl_bit

◆ ctrlsts

__IO uint32_t crm_type::ctrlsts

Definition at line 742 of file at32f413_crm.h.

◆ [struct]

struct { ... } crm_type::ctrlsts_bit

◆ dma1en

__IO uint32_t crm_type::dma1en

Definition at line 638 of file at32f413_crm.h.

◆ dma2en

__IO uint32_t crm_type::dma2en

Definition at line 639 of file at32f413_crm.h.

◆ exintrst

__IO uint32_t crm_type::exintrst

Definition at line 573 of file at32f413_crm.h.

◆ flashen

__IO uint32_t crm_type::flashen

Definition at line 642 of file at32f413_crm.h.

◆ gpioaen

__IO uint32_t crm_type::gpioaen

Definition at line 661 of file at32f413_crm.h.

◆ gpioarst

__IO uint32_t crm_type::gpioarst

Definition at line 574 of file at32f413_crm.h.

◆ gpioben

__IO uint32_t crm_type::gpioben

Definition at line 662 of file at32f413_crm.h.

◆ gpiobrst

__IO uint32_t crm_type::gpiobrst

Definition at line 575 of file at32f413_crm.h.

◆ gpiocen

__IO uint32_t crm_type::gpiocen

Definition at line 663 of file at32f413_crm.h.

◆ gpiocrst

__IO uint32_t crm_type::gpiocrst

Definition at line 576 of file at32f413_crm.h.

◆ gpioden

__IO uint32_t crm_type::gpioden

Definition at line 664 of file at32f413_crm.h.

◆ gpiodrst

__IO uint32_t crm_type::gpiodrst

Definition at line 577 of file at32f413_crm.h.

◆ gpioerst

__IO uint32_t crm_type::gpioerst

Definition at line 579 of file at32f413_crm.h.

◆ gpiofen

__IO uint32_t crm_type::gpiofen

Definition at line 666 of file at32f413_crm.h.

◆ hextbyps

__IO uint32_t crm_type::hextbyps

Definition at line 497 of file at32f413_crm.h.

◆ hexten

__IO uint32_t crm_type::hexten

Definition at line 495 of file at32f413_crm.h.

◆ hextstbl

__IO uint32_t crm_type::hextstbl

Definition at line 496 of file at32f413_crm.h.

◆ hextstblf

__IO uint32_t crm_type::hextstblf

Definition at line 543 of file at32f413_crm.h.

◆ hextstblfc

__IO uint32_t crm_type::hextstblfc

Definition at line 556 of file at32f413_crm.h.

◆ hextstblien

__IO uint32_t crm_type::hextstblien

Definition at line 550 of file at32f413_crm.h.

◆ hick_to_sclk

__IO uint32_t crm_type::hick_to_sclk

Definition at line 814 of file at32f413_crm.h.

◆ hick_to_usb

__IO uint32_t crm_type::hick_to_usb

Definition at line 813 of file at32f413_crm.h.

◆ hickcal

__IO uint32_t crm_type::hickcal

Definition at line 494 of file at32f413_crm.h.

◆ hickcal_key

__IO uint32_t crm_type::hickcal_key

Definition at line 772 of file at32f413_crm.h.

◆ hickdiv

__IO uint32_t crm_type::hickdiv

Definition at line 777 of file at32f413_crm.h.

◆ hicken

__IO uint32_t crm_type::hicken

Definition at line 491 of file at32f413_crm.h.

◆ hickstbl

__IO uint32_t crm_type::hickstbl

Definition at line 492 of file at32f413_crm.h.

◆ hickstblf

__IO uint32_t crm_type::hickstblf

Definition at line 542 of file at32f413_crm.h.

◆ hickstblfc

__IO uint32_t crm_type::hickstblfc

Definition at line 555 of file at32f413_crm.h.

◆ hickstblien

__IO uint32_t crm_type::hickstblien

Definition at line 549 of file at32f413_crm.h.

◆ hicktrim

__IO uint32_t crm_type::hicktrim

Definition at line 493 of file at32f413_crm.h.

◆ i2c1en

__IO uint32_t crm_type::i2c1en

Definition at line 704 of file at32f413_crm.h.

◆ i2c1rst

__IO uint32_t crm_type::i2c1rst

Definition at line 617 of file at32f413_crm.h.

◆ i2c2en

__IO uint32_t crm_type::i2c2en

Definition at line 705 of file at32f413_crm.h.

◆ i2c2rst

__IO uint32_t crm_type::i2c2rst

Definition at line 618 of file at32f413_crm.h.

◆ intmap

__IO uint32_t crm_type::intmap

Definition at line 829 of file at32f413_crm.h.

◆ [struct]

struct { ... } crm_type::intmap_bit

◆ iomuxen

__IO uint32_t crm_type::iomuxen

Definition at line 659 of file at32f413_crm.h.

◆ iomuxrst

__IO uint32_t crm_type::iomuxrst

Definition at line 572 of file at32f413_crm.h.

◆ lextbyps

__IO uint32_t crm_type::lextbyps

Definition at line 727 of file at32f413_crm.h.

◆ lexten

__IO uint32_t crm_type::lexten

Definition at line 725 of file at32f413_crm.h.

◆ lextstbl

__IO uint32_t crm_type::lextstbl

Definition at line 726 of file at32f413_crm.h.

◆ lextstblf

__IO uint32_t crm_type::lextstblf

Definition at line 541 of file at32f413_crm.h.

◆ lextstblfc

__IO uint32_t crm_type::lextstblfc

Definition at line 554 of file at32f413_crm.h.

◆ lextstblien

__IO uint32_t crm_type::lextstblien

Definition at line 548 of file at32f413_crm.h.

◆ licken

__IO uint32_t crm_type::licken

Definition at line 745 of file at32f413_crm.h.

◆ lickstbl

__IO uint32_t crm_type::lickstbl

Definition at line 746 of file at32f413_crm.h.

◆ lickstblf

__IO uint32_t crm_type::lickstblf

Definition at line 540 of file at32f413_crm.h.

◆ lickstblfc

__IO uint32_t crm_type::lickstblfc

Definition at line 553 of file at32f413_crm.h.

◆ lickstblien

__IO uint32_t crm_type::lickstblien

Definition at line 547 of file at32f413_crm.h.

◆ lprstf

__IO uint32_t crm_type::lprstf

Definition at line 755 of file at32f413_crm.h.

◆ misc1

__IO uint32_t crm_type::misc1

Definition at line 769 of file at32f413_crm.h.

◆ [struct]

struct { ... } crm_type::misc1_bit

◆ misc2

__IO uint32_t crm_type::misc2

Definition at line 793 of file at32f413_crm.h.

◆ [struct]

struct { ... } crm_type::misc2_bit

◆ misc3

__IO uint32_t crm_type::misc3

Definition at line 807 of file at32f413_crm.h.

◆ [struct]

struct { ... } crm_type::misc3_bit

◆ nrstf

__IO uint32_t crm_type::nrstf

Definition at line 750 of file at32f413_crm.h.

◆ pllen

__IO uint32_t crm_type::pllen

Definition at line 500 of file at32f413_crm.h.

◆ pllhextdiv

__IO uint32_t crm_type::pllhextdiv

Definition at line 521 of file at32f413_crm.h.

◆ pllmult_h

__IO uint32_t crm_type::pllmult_h

Definition at line 527 of file at32f413_crm.h.

◆ pllmult_l

__IO uint32_t crm_type::pllmult_l

Definition at line 522 of file at32f413_crm.h.

◆ pllrange

__IO uint32_t crm_type::pllrange

Definition at line 528 of file at32f413_crm.h.

◆ pllrcs

__IO uint32_t crm_type::pllrcs

Definition at line 520 of file at32f413_crm.h.

◆ pllstbl

__IO uint32_t crm_type::pllstbl

Definition at line 501 of file at32f413_crm.h.

◆ pllstblf

__IO uint32_t crm_type::pllstblf

Definition at line 544 of file at32f413_crm.h.

◆ pllstblfc

__IO uint32_t crm_type::pllstblfc

Definition at line 557 of file at32f413_crm.h.

◆ pllstblien

__IO uint32_t crm_type::pllstblien

Definition at line 551 of file at32f413_crm.h.

◆ porrstf

__IO uint32_t crm_type::porrstf

Definition at line 751 of file at32f413_crm.h.

◆ pwcen

__IO uint32_t crm_type::pwcen

Definition at line 711 of file at32f413_crm.h.

◆ pwcrst

__IO uint32_t crm_type::pwcrst

Definition at line 624 of file at32f413_crm.h.

◆ reserved1

__IO uint32_t crm_type::reserved1

crm reserved1 register, offset:0x28~0x2C

Definition at line 499 of file at32f413_crm.h.

◆ reserved2

__IO uint32_t crm_type::reserved2

crm reserved2 register, offset:0x4C~0x34

Definition at line 502 of file at32f413_crm.h.

◆ reserved3

__IO uint32_t crm_type::reserved3

crm reserved3 register, offset:0x58

Definition at line 558 of file at32f413_crm.h.

◆ reserved4

__IO uint32_t crm_type::reserved4

Definition at line 560 of file at32f413_crm.h.

◆ reserved5

__IO uint32_t crm_type::reserved5

Definition at line 622 of file at32f413_crm.h.

◆ reserved6

__IO uint32_t crm_type::reserved6

Definition at line 625 of file at32f413_crm.h.

◆ rstfc

__IO uint32_t crm_type::rstfc

Definition at line 748 of file at32f413_crm.h.

◆ rtcen

__IO uint32_t crm_type::rtcen

Definition at line 731 of file at32f413_crm.h.

◆ rtcsel

__IO uint32_t crm_type::rtcsel

Definition at line 729 of file at32f413_crm.h.

◆ sclksel

__IO uint32_t crm_type::sclksel

Definition at line 514 of file at32f413_crm.h.

◆ sclksts

__IO uint32_t crm_type::sclksts

Definition at line 515 of file at32f413_crm.h.

◆ sdio1en

__IO uint32_t crm_type::sdio1en

Definition at line 646 of file at32f413_crm.h.

◆ spi1en

__IO uint32_t crm_type::spi1en

Definition at line 671 of file at32f413_crm.h.

◆ spi1rst

__IO uint32_t crm_type::spi1rst

Definition at line 584 of file at32f413_crm.h.

◆ spi2en

__IO uint32_t crm_type::spi2en

Definition at line 698 of file at32f413_crm.h.

◆ spi2rst

__IO uint32_t crm_type::spi2rst

Definition at line 611 of file at32f413_crm.h.

◆ sramen

__IO uint32_t crm_type::sramen

Definition at line 640 of file at32f413_crm.h.

◆ swrstf

__IO uint32_t crm_type::swrstf

Definition at line 752 of file at32f413_crm.h.

◆ tmr10en

__IO uint32_t crm_type::tmr10en

Definition at line 676 of file at32f413_crm.h.

◆ tmr10rst

__IO uint32_t crm_type::tmr10rst

Definition at line 589 of file at32f413_crm.h.

◆ tmr11en

__IO uint32_t crm_type::tmr11en

Definition at line 677 of file at32f413_crm.h.

◆ tmr11rst

__IO uint32_t crm_type::tmr11rst

Definition at line 590 of file at32f413_crm.h.

◆ tmr1en

__IO uint32_t crm_type::tmr1en

Definition at line 670 of file at32f413_crm.h.

◆ tmr1rst

__IO uint32_t crm_type::tmr1rst

Definition at line 583 of file at32f413_crm.h.

◆ tmr2en

__IO uint32_t crm_type::tmr2en

Definition at line 691 of file at32f413_crm.h.

◆ tmr2rst

__IO uint32_t crm_type::tmr2rst

Definition at line 604 of file at32f413_crm.h.

◆ tmr3en

__IO uint32_t crm_type::tmr3en

Definition at line 692 of file at32f413_crm.h.

◆ tmr3rst

__IO uint32_t crm_type::tmr3rst

Definition at line 605 of file at32f413_crm.h.

◆ tmr4en

__IO uint32_t crm_type::tmr4en

Definition at line 693 of file at32f413_crm.h.

◆ tmr4rst

__IO uint32_t crm_type::tmr4rst

Definition at line 606 of file at32f413_crm.h.

◆ tmr5en

__IO uint32_t crm_type::tmr5en

Definition at line 694 of file at32f413_crm.h.

◆ tmr5rst

__IO uint32_t crm_type::tmr5rst

Definition at line 607 of file at32f413_crm.h.

◆ tmr8en

__IO uint32_t crm_type::tmr8en

Definition at line 672 of file at32f413_crm.h.

◆ tmr8rst

__IO uint32_t crm_type::tmr8rst

Definition at line 585 of file at32f413_crm.h.

◆ tmr9en

__IO uint32_t crm_type::tmr9en

Definition at line 675 of file at32f413_crm.h.

◆ tmr9rst

__IO uint32_t crm_type::tmr9rst

Definition at line 588 of file at32f413_crm.h.

◆ uart4en

__IO uint32_t crm_type::uart4en

Definition at line 702 of file at32f413_crm.h.

◆ uart4rst

__IO uint32_t crm_type::uart4rst

Definition at line 615 of file at32f413_crm.h.

◆ uart5en

__IO uint32_t crm_type::uart5en

Definition at line 703 of file at32f413_crm.h.

◆ uart5rst

__IO uint32_t crm_type::uart5rst

Definition at line 616 of file at32f413_crm.h.

◆ usart1en

__IO uint32_t crm_type::usart1en

Definition at line 673 of file at32f413_crm.h.

◆ usart1rst

__IO uint32_t crm_type::usart1rst

Definition at line 586 of file at32f413_crm.h.

◆ usart2en

__IO uint32_t crm_type::usart2en

Definition at line 700 of file at32f413_crm.h.

◆ usart2rst

__IO uint32_t crm_type::usart2rst

Definition at line 613 of file at32f413_crm.h.

◆ usart3en

__IO uint32_t crm_type::usart3en

Definition at line 701 of file at32f413_crm.h.

◆ usart3rst

__IO uint32_t crm_type::usart3rst

Definition at line 614 of file at32f413_crm.h.

◆ usbbufs

__IO uint32_t crm_type::usbbufs

Definition at line 776 of file at32f413_crm.h.

◆ usbdiv_h

__IO uint32_t crm_type::usbdiv_h

Definition at line 525 of file at32f413_crm.h.

◆ usbdiv_l

__IO uint32_t crm_type::usbdiv_l

Definition at line 523 of file at32f413_crm.h.

◆ usben

__IO uint32_t crm_type::usben

Definition at line 706 of file at32f413_crm.h.

◆ usbintmap

__IO uint32_t crm_type::usbintmap

Definition at line 832 of file at32f413_crm.h.

◆ usbrst

__IO uint32_t crm_type::usbrst

Definition at line 619 of file at32f413_crm.h.

◆ wdtrstf

__IO uint32_t crm_type::wdtrstf

Definition at line 753 of file at32f413_crm.h.

◆ wwdten

__IO uint32_t crm_type::wwdten

Definition at line 696 of file at32f413_crm.h.

◆ wwdtrst

__IO uint32_t crm_type::wwdtrst

Definition at line 609 of file at32f413_crm.h.

◆ wwdtrstf

__IO uint32_t crm_type::wwdtrstf

Definition at line 754 of file at32f413_crm.h.

The documentation for this struct was generated from the following file:
  • at32f413_crm.h


AT32F413 Firmwary Library: CRM_exported_functions

Functions
CRM_exported_functions
AT32F413_periph_driver » CRM

Functions

void | crm_reset (void)
reset the crm register
void | crm_lext_bypass (confirm_state new_state)
enable or disable crm low speed external crystal bypass
void | crm_hext_bypass (confirm_state new_state)
enable or disable crm high speed external crystal bypass
flag_status | crm_flag_get (uint32_t flag)
get crm flag status
flag_status | crm_interrupt_flag_get (uint32_t flag)
get crm interrupt flag status
error_status | crm_hext_stable_wait (void)
wait for hext stable
void | crm_hick_clock_trimming_set (uint8_t trim_value)
set the hick trimming value
void | crm_hick_clock_calibration_set (uint8_t cali_value)
set the crm calibration value
void | crm_periph_clock_enable (crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
void | crm_periph_reset (crm_periph_reset_type value, confirm_state new_state)
enable or disable the peripheral reset
void | crm_periph_sleep_mode_clock_enable (crm_periph_clock_sleepmd_type value, confirm_state new_state)
enable or disable the peripheral clock in sleep mode
void | crm_clock_source_enable (crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
void | crm_flag_clear (uint32_t flag)
clear the crm reset flags
void | crm_rtc_clock_select (crm_rtc_clock_type value)
select rtc clock
void | crm_rtc_clock_enable (confirm_state new_state)
enable or disable rtc
void | crm_ahb_div_set (crm_ahb_div_type value)
set crm ahb division
void | crm_apb1_div_set (crm_apb1_div_type value)
set crm apb1 division
void | crm_apb2_div_set (crm_apb2_div_type value)
set crm apb2 division
void | crm_adc_clock_div_set (crm_adc_div_type div_value)
set crm adc division
void | crm_usb_clock_div_set (crm_usb_div_type div_value)
set crm usb division
void | crm_clock_failure_detection_enable (confirm_state new_state)
enable or disable clock failure detection
void | crm_battery_powered_domain_reset (confirm_state new_state)
battery powered domain software reset
void | crm_pll_config (crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
void | crm_sysclk_switch (crm_sclk_type value)
select system clock source
crm_sclk_type | crm_sysclk_switch_status_get (void)
indicate which clock source is used as system clock
void | crm_clocks_freq_get (crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
void | crm_clock_out_set (crm_clkout_select_type clkout)
set crm clkout
void | crm_interrupt_enable (uint32_t crm_int, confirm_state new_state)
config crm interrupt
void | crm_auto_step_mode_enable (confirm_state new_state)
auto step clock switch enable
void | crm_usb_interrupt_remapping_set (crm_usb_int_map_type int_remap)
usbdev interrupt remapping control
void | crm_hick_divider_select (crm_hick_div_6_type value)
config hick divider select
void | crm_hick_sclk_frequency_select (crm_hick_sclk_frequency_type value)
hick as system clock frequency select
void | crm_usb_clock_source_select (crm_usb_clock_source_type value)
usb 48 mhz clock source select
void | crm_clkout_to_tmr10_enable (confirm_state new_state)
enable or disable clkout direct to tmr10 channel 1
void | crm_clkout_div_set (crm_clkout_div_type clkout_div)
set crm clkout division

Detailed Description

Function Documentation

◆ crm_adc_clock_div_set()

void crm_adc_clock_div_set ( crm_adc_div_type div_value )

set crm adc division

Parameters
value this parameter can be one of the following values:
  • CRM_ADC_DIV_2
  • CRM_ADC_DIV_4
  • CRM_ADC_DIV_6
  • CRM_ADC_DIV_8
  • CRM_ADC_DIV_12
  • CRM_ADC_DIV_16
Return values
none

Definition at line 514 of file at32f413_crm.c.

Referenced by adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), and adc_config().

◆ crm_ahb_div_set()

void crm_ahb_div_set ( crm_ahb_div_type value )

set crm ahb division

Parameters
value this parameter can be one of the following values:
  • CRM_AHB_DIV_1
  • CRM_AHB_DIV_2
  • CRM_AHB_DIV_4
  • CRM_AHB_DIV_8
  • CRM_AHB_DIV_16
  • CRM_AHB_DIV_64
  • CRM_AHB_DIV_128
  • CRM_AHB_DIV_256
  • CRM_AHB_DIV_512
Return values
none

Definition at line 463 of file at32f413_crm.c.

Referenced by sclk_192m_hick_config(), sclk_64m_hick_config(), sclk_96m_hext_config(), system_clock_config(), and system_clock_config_for_acc().

◆ crm_apb1_div_set()

void crm_apb1_div_set ( crm_apb1_div_type value )

set crm apb1 division

Note
the maximum frequency of APB1/APB2 clock is 100 MHz
Parameters
value this parameter can be one of the following values:
  • CRM_APB1_DIV_1
  • CRM_APB1_DIV_2
  • CRM_APB1_DIV_4
  • CRM_APB1_DIV_8
  • CRM_APB1_DIV_16
Return values
none

Definition at line 480 of file at32f413_crm.c.

Referenced by main(), sclk_192m_hick_config(), sclk_64m_hick_config(), sclk_96m_hext_config(), system_clock_config(), and system_clock_config_for_acc().

◆ crm_apb2_div_set()

void crm_apb2_div_set ( crm_apb2_div_type value )

set crm apb2 division

Note
the maximum frequency of APB1/APB2 clock is 100 MHz
Parameters
value this parameter can be one of the following values:
  • CRM_APB2_DIV_1
  • CRM_APB2_DIV_2
  • CRM_APB2_DIV_4
  • CRM_APB2_DIV_8
  • CRM_APB2_DIV_16
Return values
none

Definition at line 497 of file at32f413_crm.c.

Referenced by sclk_192m_hick_config(), sclk_64m_hick_config(), sclk_96m_hext_config(), system_clock_config(), and system_clock_config_for_acc().

◆ crm_auto_step_mode_enable()

void crm_auto_step_mode_enable ( confirm_state new_state )

auto step clock switch enable

Parameters
new_state (TRUE or FALSE)
Return values
none

Definition at line 798 of file at32f413_crm.c.

Referenced by sclk_192m_hick_config(), sclk_64m_hick_config(), sclk_96m_hext_config(), system_clock_config(), system_clock_config_for_acc(), and system_clock_recover().

◆ crm_battery_powered_domain_reset()

void crm_battery_powered_domain_reset ( confirm_state new_state )

battery powered domain software reset

Parameters
new_state (TRUE or FALSE)
Return values
none

Definition at line 554 of file at32f413_crm.c.

Referenced by bpr_reset().

◆ crm_clkout_div_set()

void crm_clkout_div_set ( crm_clkout_div_type clkout_div )

set crm clkout division

Parameters
clkout_div this parameter can be one of the following values:
  • CRM_CLKOUT_DIV_1
  • CRM_CLKOUT_DIV_2
  • CRM_CLKOUT_DIV_4
  • CRM_CLKOUT_DIV_8
  • CRM_CLKOUT_DIV_16
  • CRM_CLKOUT_DIV_64
  • CRM_CLKOUT_DIV_128
  • CRM_CLKOUT_DIV_256
  • CRM_CLKOUT_DIV_512
Return values
none

Definition at line 888 of file at32f413_crm.c.

Referenced by clkout_config(), clkout_config(), and clkout_config().

◆ crm_clkout_to_tmr10_enable()

void crm_clkout_to_tmr10_enable ( confirm_state new_state )

enable or disable clkout direct to tmr10 channel 1

Parameters
new_state (TRUE or FALSE)
Return values
none

Definition at line 868 of file at32f413_crm.c.

◆ crm_clock_failure_detection_enable()

void crm_clock_failure_detection_enable ( confirm_state new_state )

enable or disable clock failure detection

Parameters
new_state (TRUE or FALSE)
Return values
none

Definition at line 544 of file at32f413_crm.c.

Referenced by clock_failure_detection_handler(), and main().

◆ crm_clock_out_set()

void crm_clock_out_set ( crm_clkout_select_type clkout )

set crm clkout

Parameters
clkout this parameter can be one of the following values:
  • CRM_CLKOUT_NOCLK
  • CRM_CLKOUT_LICK
  • CRM_CLKOUT_LEXT
  • CRM_CLKOUT_SCLK
  • CRM_CLKOUT_HICK
  • CRM_CLKOUT_HEXT
  • CRM_CLKOUT_PLL_DIV_2
  • CRM_CLKOUT_PLL_DIV_4
  • CRM_CLKOUT_USB
  • CRM_CLKOUT_ADC
Return values
none

Definition at line 767 of file at32f413_crm.c.

Referenced by clkout_config(), clkout_config(), and clkout_config().

◆ crm_clock_source_enable()

void crm_clock_source_enable | ( | crm_clock_source_type | source,
 |  | confirm_state | new_state )

enable or disable the crm clock source

Parameters
source this parameter can be one of the following values:
  • CRM_CLOCK_SOURCE_HICK
  • CRM_CLOCK_SOURCE_HEXT
  • CRM_CLOCK_SOURCE_PLL
  • CRM_CLOCK_SOURCE_LEXT
  • CRM_CLOCK_SOURCE_LICK
new_state (TRUE or FALSE)
Return values
none

Definition at line 342 of file at32f413_crm.c.

Referenced by rtc_config(), rtc_configuration(), rtc_init(), sclk_192m_hick_config(), sclk_64m_hick_config(), sclk_96m_hext_config(), system_clock_config(), system_clock_config_for_acc(), and system_clock_recover().

◆ crm_clocks_freq_get()

void crm_clocks_freq_get ( crm_clocks_freq_type * clocks_struct )

get crm clocks freqency

Parameters
clocks
  • pointer to the crm_clocks_freq structure
Return values
none

< value of the high speed internal clock in hz

< value of the high speed internal clock in hz

< value of the high speed external crystal in hz

< value of the high speed internal clock in hz

< value of the high speed external crystal in hz

< value of the high speed external crystal in hz

< value of the high speed internal clock in hz

Definition at line 660 of file at32f413_crm.c.

Referenced by i2c_init(), i2s_init(), main(), tmr1_config(), tmr1_config(), tmr2_config(), tmr_init(), usart_configuration(), usart_init(), and usb_clock48m_select().

◆ crm_flag_clear()

void crm_flag_clear ( uint32_t flag )

clear the crm reset flags

Parameters
flag this parameter can be one of the following values: reset flag:
  • CRM_NRST_RESET_FLAG
  • CRM_POR_RESET_FLAG
  • CRM_SW_RESET_FLAG
  • CRM_WDT_RESET_FLAG
  • CRM_WWDT_RESET_FLAG
  • CRM_LOWPOWER_RESET_FLAG
  • CRM_ALL_RESET_FLAG interrupt flag:
  • CRM_LICK_READY_INT_FLAG
  • CRM_LEXT_READY_INT_FLAG
  • CRM_HICK_READY_INT_FLAG
  • CRM_HEXT_READY_INT_FLAG
  • CRM_PLL_READY_INT_FLAG
  • CRM_CLOCK_FAILURE_INT_FLAG
Return values
none

< nrst pin reset flag

< power on reset flag

< software reset flag

< watchdog timer reset flag

< window watchdog timer reset flag

< low-power reset flag

< all reset flag

< low speed internal clock stable interrupt ready flag

< low speed external crystal stable interrupt ready flag

< high speed internal clock stable interrupt ready flag

< high speed external crystal stable interrupt ready flag

< phase locking loop stable interrupt ready flag

< clock failure interrupt ready flag

Definition at line 387 of file at32f413_crm.c.

Referenced by clock_failure_detection_handler(), and main().

◆ crm_flag_get()

flag_status crm_flag_get ( uint32_t flag )

get crm flag status

Parameters
flag this parameter can be one of the following values:
  • CRM_HICK_STABLE_FLAG
  • CRM_HEXT_STABLE_FLAG
  • CRM_PLL_STABLE_FLAG
  • CRM_LEXT_STABLE_FLAG
  • CRM_LICK_STABLE_FLAG
  • CRM_NRST_RESET_FLAG
  • CRM_POR_RESET_FLAG
  • CRM_SW_RESET_FLAG
  • CRM_WDT_RESET_FLAG
  • CRM_WWDT_RESET_FLAG
  • CRM_LOWPOWER_RESET_FLAG interrupt flag:
  • CRM_LICK_READY_INT_FLAG
  • CRM_LEXT_READY_INT_FLAG
  • CRM_HICK_READY_INT_FLAG
  • CRM_HEXT_READY_INT_FLAG
  • CRM_PLL_READY_INT_FLAG
  • CRM_CLOCK_FAILURE_INT_FLAG
Return values
flag_status (SET or RESET)

Definition at line 121 of file at32f413_crm.c.

Referenced by can_configuration(), clock_failure_detection_handler(), crm_hext_stable_wait(), main(), rtc_config(), rtc_configuration(), rtc_init(), sclk_192m_hick_config(), sclk_64m_hick_config(), sclk_96m_hext_config(), system_clock_config(), system_clock_config_for_acc(), and system_clock_recover().

◆ crm_hext_bypass()

void crm_hext_bypass ( confirm_state new_state )

enable or disable crm high speed external crystal bypass

Parameters
new_state (TRUE or FALSE)
Return values
none

Definition at line 92 of file at32f413_crm.c.

◆ crm_hext_stable_wait()

error_status crm_hext_stable_wait ( void )

wait for hext stable

Parameters
none
Return values
error_status (ERROR or SUCCESS)

< high speed external crystal stable flag

< time out for hext start up

< high speed external crystal stable flag

Definition at line 198 of file at32f413_crm.c.

Referenced by sclk_96m_hext_config(), system_clock_config(), and system_clock_recover().

◆ crm_hick_clock_calibration_set()

void crm_hick_clock_calibration_set ( uint8_t cali_value )

set the crm calibration value

Parameters
cali_value (0x00~0xFF)
Return values
none

Definition at line 235 of file at32f413_crm.c.

◆ crm_hick_clock_trimming_set()

void crm_hick_clock_trimming_set ( uint8_t trim_value )

set the hick trimming value

Parameters
trim_value (0x00~0x3F)
Return values
none

Definition at line 225 of file at32f413_crm.c.

◆ crm_hick_divider_select()

void crm_hick_divider_select ( crm_hick_div_6_type value )

config hick divider select

Parameters
value this parameter can be one of the following values:
  • CRM_HICK48_DIV6
  • CRM_HICK48_NODIV
Return values
none

Definition at line 827 of file at32f413_crm.c.

Referenced by crm_hick_sclk_frequency_select().

◆ crm_hick_sclk_frequency_select()

void crm_hick_sclk_frequency_select ( crm_hick_sclk_frequency_type value )

hick as system clock frequency select

Parameters
value this parameter can be one of the following values:
  • CRM_HICK_SCLK_8MHZ
  • CRM_HICK_SCLK_48MHZ
Return values
none

Definition at line 840 of file at32f413_crm.c.

Referenced by crm_usb_clock_source_select().

◆ crm_interrupt_enable()

void crm_interrupt_enable | ( | uint32_t | crm_int,
 |  | confirm_state | new_state )

config crm interrupt

Parameters
int this parameter can be any combination of the following values:
  • CRM_LICK_STABLE_INT
  • CRM_LEXT_STABLE_INT
  • CRM_HICK_STABLE_INT
  • CRM_HEXT_STABLE_INT
  • CRM_PLL_STABLE_INT
new_state (TRUE or FALSE)
Return values
none

Definition at line 785 of file at32f413_crm.c.

◆ crm_interrupt_flag_get()

flag_status crm_interrupt_flag_get ( uint32_t flag )

get crm interrupt flag status

Parameters
flag this parameter can be one of the following values:
  • CRM_LICK_READY_INT_FLAG
  • CRM_LEXT_READY_INT_FLAG
  • CRM_HICK_READY_INT_FLAG
  • CRM_HEXT_READY_INT_FLAG
  • CRM_PLL_READY_INT_FLAG
  • CRM_CLOCK_FAILURE_INT_FLAG
Return values
flag_status (SET or RESET)

< low speed internal clock stable interrupt ready flag

< low speed external crystal stable interrupt ready flag

< high speed internal clock stable interrupt ready flag

< high speed external crystal stable interrupt ready flag

< phase locking loop stable interrupt ready flag

< clock failure interrupt ready flag

Definition at line 147 of file at32f413_crm.c.

◆ crm_lext_bypass()

void crm_lext_bypass ( confirm_state new_state )

enable or disable crm low speed external crystal bypass

Parameters
new_state (TRUE or FALSE)
Return values
none

Definition at line 82 of file at32f413_crm.c.

◆ crm_periph_clock_enable()

void crm_periph_clock_enable | ( | crm_periph_clock_type | value,
 |  | confirm_state | new_state )

enable or disable the peripheral clock

Parameters
value this parameter can be one of the following values:
  • CRM_DMA1_PERIPH_CLOCK - CRM_DMA2_PERIPH_CLOCK - CRM_CRC_PERIPH_CLOCK - CRM_SDIO1_PERIPH_CLOCK
  • CRM_IOMUX_PERIPH_CLOCK - CRM_GPIOA_PERIPH_CLOCK - CRM_GPIOB_PERIPH_CLOCK - CRM_GPIOC_PERIPH_CLOCK
  • CRM_GPIOD_PERIPH_CLOCK - CRM_GPIOF_PERIPH_CLOCK - CRM_ADC1_PERIPH_CLOCK - CRM_ADC2_PERIPH_CLOCK
  • CRM_TMR1_PERIPH_CLOCK - CRM_SPI1_PERIPH_CLOCK - CRM_TMR8_PERIPH_CLOCK - CRM_USART1_PERIPH_CLOCK
  • CRM_TMR9_PERIPH_CLOCK - CRM_TMR10_PERIPH_CLOCK - CRM_TMR11_PERIPH_CLOCK - CRM_ACC_PERIPH_CLOCK
  • CRM_TMR3_PERIPH_CLOCK - CRM_TMR4_PERIPH_CLOCK - CRM_TMR5_PERIPH_CLOCK - CRM_WWDT_PERIPH_CLOCK
  • CRM_SPI2_PERIPH_CLOCK - CRM_USART2_PERIPH_CLOCK - CRM_USART3_PERIPH_CLOCK - CRM_UART4_PERIPH_CLOCK
  • CRM_UART5_PERIPH_CLOCK - CRM_I2C1_PERIPH_CLOCK - CRM_I2C2_PERIPH_CLOCK - CRM_USB_PERIPH_CLOCK
  • CRM_CAN1_PERIPH_CLOCK - CRM_BPR_PERIPH_CLOCK - CRM_PWC_PERIPH_CLOCK - CRM_CAN2_PERIPH_CLOCK
new_state (TRUE or FALSE)
Return values
none

Definition at line 263 of file at32f413_crm.c.

Referenced by adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), app_load(), at32_button_init(), at32_led_init(), button_exint_init(), can_configuration(), can_gpio_config(), can_gpio_config(), can_gpio_config(), clkout_config(), clkout_config(), clkout_config(), codec_i2s_init(), crc_cal(), crm_configuration(), crm_sysclk_switch(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_configuration(), exint_config(), exint_line0_config(), exint_line4_config(), flash_crc_check(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), i2c_lowlevel_init(), i2s_config(), i2s_config(), i2s_config(), jump_to_app(), main(), mclk_tmr1_init(), rs485_config(), rtc_alarm_clock_set(), rtc_configuration(), rtc_init(), rtc_time_set(), sd_dma_config(), sd_init(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spiflash_init(), spim_init(), tmr1_config(), tmr1_config(), tmr2_config(), TMR3_GLOBAL_IRQHandler(), tmr_init(), uart_init(), uart_print_init(), usart1_config(), usart_configuration(), usart_gpio_config(), usart_spi_configuration(), usb_clock48m_select(), and usb_usart_config().

◆ crm_periph_reset()

void crm_periph_reset | ( | crm_periph_reset_type | value,
 |  | confirm_state | new_state )

enable or disable the peripheral reset

Parameters
value this parameter can be one of the following values:
  • CRM_IOMUX_PERIPH_RESET - CRM_EXINT_PERIPH_RESET - CRM_GPIOA_PERIPH_RESET - CRM_GPIOB_PERIPH_RESET
  • CRM_GPIOC_PERIPH_RESET - CRM_GPIOD_PERIPH_RESET - CRM_GPIOF_PERIPH_RESET - CRM_ADC1_PERIPH_RESET
  • CRM_ADC2_PERIPH_RESET - CRM_TMR1_PERIPH_RESET - CRM_SPI1_PERIPH_RESET - CRM_TMR8_PERIPH_RESET
  • CRM_USART1_PERIPH_RESET - CRM_TMR9_PERIPH_RESET - CRM_TMR10_PERIPH_RESET - CRM_TMR11_PERIPH_RESET
  • CRM_ACC_PERIPH_RESET - CRM_TMR2_PERIPH_RESET - CRM_TMR3_PERIPH_RESET - CRM_TMR4_PERIPH_RESET
  • CRM_TMR5_PERIPH_RESET - CRM_WWDT_PERIPH_RESET - CRM_SPI2_PERIPH_RESET - CRM_USART2_PERIPH_RESET
  • CRM_USART3_PERIPH_RESET - CRM_UART4_PERIPH_RESET - CRM_UART5_PERIPH_RESET - CRM_I2C1_PERIPH_RESET
  • CRM_I2C2_PERIPH_RESET - CRM_USB_PERIPH_RESET - CRM_CAN1_PERIPH_RESET - CRM_BPR_PERIPH_RESET
  • CRM_PWC_PERIPH_RESET - CRM_CAN2_PERIPH_RESET
new_state (TRUE or FALSE)
Return values
none

Definition at line 293 of file at32f413_crm.c.

Referenced by adc_reset(), can_reset(), gpio_iomux_reset(), gpio_reset(), i2c_reset(), jump_to_app(), pwc_reset(), spi_i2s_reset(), tmr_reset(), usart_reset(), and wwdt_reset().

◆ crm_periph_sleep_mode_clock_enable()

void crm_periph_sleep_mode_clock_enable | ( | crm_periph_clock_sleepmd_type | value,
 |  | confirm_state | new_state )

enable or disable the peripheral clock in sleep mode

Parameters
value this parameter can be one of the following values:
  • CRM_SRAM_PERIPH_CLOCK_SLEEP_MODE
  • CRM_FLASH_PERIPH_CLOCK_SLEEP_MODE
new_state (TRUE or FALSE)
Return values
none

Definition at line 316 of file at32f413_crm.c.

◆ crm_pll_config()

void crm_pll_config | ( | crm_pll_clock_source_type | clock_source,
 |  | crm_pll_mult_type | mult_value,
 |  | crm_pll_output_range_type | pll_range )

config crm pll

Parameters
clock_source this parameter can be one of the following values:
  • CRM_PLL_SOURCE_HICK
  • CRM_PLL_SOURCE_HEXT
  • CRM_PLL_SOURCE_HEXT_DIV
mult_value (CRM_PLL_MULT_2~64)
pll_range this parameter can be one of the following values:
  • CRM_PLL_OUTPUT_RANGE_LE72MHZ
  • CRM_PLL_OUTPUT_RANGE_GT72MHZ
Return values
none

Definition at line 573 of file at32f413_crm.c.

Referenced by sclk_192m_hick_config(), sclk_64m_hick_config(), sclk_96m_hext_config(), system_clock_config(), and system_clock_config_for_acc().

◆ crm_reset()

void crm_reset ( void )

reset the crm register

Parameters
none
Return values
none

Definition at line 48 of file at32f413_crm.c.

Referenced by app_update_handle(), sclk_192m_hick_config(), sclk_64m_hick_config(), sclk_96m_hext_config(), system_clock_config(), and system_clock_config_for_acc().

◆ crm_rtc_clock_enable()

void crm_rtc_clock_enable ( confirm_state new_state )

enable or disable rtc

Parameters
new_state (TRUE or FALSE)
Return values
none

Definition at line 443 of file at32f413_crm.c.

Referenced by rtc_config(), rtc_configuration(), and rtc_init().

◆ crm_rtc_clock_select()

void crm_rtc_clock_select ( crm_rtc_clock_type value )

select rtc clock

Parameters
value this parameter can be one of the following values:
  • CRM_RTC_CLOCK_LEXT
  • CRM_RTC_CLOCK_LICK
  • CRM_RTC_CLOCK_HEXT_DIV
Return values
none

Definition at line 433 of file at32f413_crm.c.

Referenced by rtc_config(), rtc_configuration(), and rtc_init().

◆ crm_sysclk_switch()

void crm_sysclk_switch ( crm_sclk_type value )

select system clock source

Parameters
value this parameter can be one of the following values:
  • CRM_SCLK_HICK
  • CRM_SCLK_HEXT
  • CRM_SCLK_PLL
Return values
none

Definition at line 611 of file at32f413_crm.c.

Referenced by sclk_192m_hick_config(), sclk_64m_hick_config(), sclk_96m_hext_config(), system_clock_config(), system_clock_config_for_acc(), and system_clock_recover().

◆ crm_sysclk_switch_status_get()

crm_sclk_type crm_sysclk_switch_status_get ( void )

indicate which clock source is used as system clock

Parameters
none
Return values
crm_sclk this return can be one of the following values:
  • CRM_SCLK_HICK
  • CRM_SCLK_HEXT
  • CRM_SCLK_PLL

Definition at line 649 of file at32f413_crm.c.

Referenced by crm_clocks_freq_get(), sclk_192m_hick_config(), sclk_64m_hick_config(), sclk_96m_hext_config(), system_clock_config(), system_clock_config_for_acc(), system_clock_recover(), and system_core_clock_update().

◆ crm_usb_clock_div_set()

void crm_usb_clock_div_set ( crm_usb_div_type div_value )

set crm usb division

Parameters
value this parameter can be one of the following values:
  • CRM_USB_DIV_1_5
  • CRM_USB_DIV_1
  • CRM_USB_DIV_2_5
  • CRM_USB_DIV_2
  • CRM_USB_DIV_3_5
  • CRM_USB_DIV_3
  • CRM_USB_DIV_4
Return values
none

Definition at line 533 of file at32f413_crm.c.

Referenced by usb_clock48m_select().

◆ crm_usb_clock_source_select()

void crm_usb_clock_source_select ( crm_usb_clock_source_type value )

usb 48 mhz clock source select

Parameters
value this parameter can be one of the following values:
  • CRM_USB_CLOCK_SOURCE_PLL
  • CRM_USB_CLOCK_SOURCE_HICK
Return values
none

Definition at line 854 of file at32f413_crm.c.

Referenced by usb_clock48m_select().

◆ crm_usb_interrupt_remapping_set()

void crm_usb_interrupt_remapping_set ( crm_usb_int_map_type int_remap )

usbdev interrupt remapping control

Parameters
int_remap this parameter can be one of the following values:
  • CRM_USB_INT19_INT20
  • CRM_USB_INT73_INT74
Return values
none

Definition at line 814 of file at32f413_crm.c.


AT32F413 Firmwary Library: CRM_private_functions

Functions
CRM_private_functions
AT32F413_periph_driver » CRM

Functions

void | crm_reset (void)
reset the crm register
void | crm_lext_bypass (confirm_state new_state)
enable or disable crm low speed external crystal bypass
void | crm_hext_bypass (confirm_state new_state)
enable or disable crm high speed external crystal bypass
flag_status | crm_flag_get (uint32_t flag)
get crm flag status
flag_status | crm_interrupt_flag_get (uint32_t flag)
get crm interrupt flag status
error_status | crm_hext_stable_wait (void)
wait for hext stable
void | crm_hick_clock_trimming_set (uint8_t trim_value)
set the hick trimming value
void | crm_hick_clock_calibration_set (uint8_t cali_value)
set the crm calibration value
void | crm_periph_clock_enable (crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
void | crm_periph_reset (crm_periph_reset_type value, confirm_state new_state)
enable or disable the peripheral reset
void | crm_periph_sleep_mode_clock_enable (crm_periph_clock_sleepmd_type value, confirm_state new_state)
enable or disable the peripheral clock in sleep mode
void | crm_clock_source_enable (crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
void | crm_flag_clear (uint32_t flag)
clear the crm reset flags
void | crm_rtc_clock_select (crm_rtc_clock_type value)
select rtc clock
void | crm_rtc_clock_enable (confirm_state new_state)
enable or disable rtc
void | crm_ahb_div_set (crm_ahb_div_type value)
set crm ahb division
void | crm_apb1_div_set (crm_apb1_div_type value)
set crm apb1 division
void | crm_apb2_div_set (crm_apb2_div_type value)
set crm apb2 division
void | crm_adc_clock_div_set (crm_adc_div_type div_value)
set crm adc division
void | crm_usb_clock_div_set (crm_usb_div_type div_value)
set crm usb division
void | crm_clock_failure_detection_enable (confirm_state new_state)
enable or disable clock failure detection
void | crm_battery_powered_domain_reset (confirm_state new_state)
battery powered domain software reset
void | crm_pll_config (crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
void | crm_sysclk_switch (crm_sclk_type value)
select system clock source
crm_sclk_type | crm_sysclk_switch_status_get (void)
indicate which clock source is used as system clock
void | crm_clocks_freq_get (crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
void | crm_clock_out_set (crm_clkout_select_type clkout)
set crm clkout
void | crm_interrupt_enable (uint32_t crm_int, confirm_state new_state)
config crm interrupt
void | crm_auto_step_mode_enable (confirm_state new_state)
auto step clock switch enable
void | crm_usb_interrupt_remapping_set (crm_usb_int_map_type int_remap)
usbdev interrupt remapping control
void | crm_hick_divider_select (crm_hick_div_6_type value)
config hick divider select
void | crm_hick_sclk_frequency_select (crm_hick_sclk_frequency_type value)
hick as system clock frequency select
void | crm_usb_clock_source_select (crm_usb_clock_source_type value)
usb 48 mhz clock source select
void | crm_clkout_to_tmr10_enable (confirm_state new_state)
enable or disable clkout direct to tmr10 channel 1
void | crm_clkout_div_set (crm_clkout_div_type clkout_div)
set crm clkout division

Detailed Description

Function Documentation

◆ crm_adc_clock_div_set()

void crm_adc_clock_div_set ( crm_adc_div_type div_value )

set crm adc division

Parameters
value this parameter can be one of the following values:
  • CRM_ADC_DIV_2
  • CRM_ADC_DIV_4
  • CRM_ADC_DIV_6
  • CRM_ADC_DIV_8
  • CRM_ADC_DIV_12
  • CRM_ADC_DIV_16
Return values
none

Definition at line 514 of file at32f413_crm.c.

Referenced by adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), and adc_config().

◆ crm_ahb_div_set()

void crm_ahb_div_set ( crm_ahb_div_type value )

set crm ahb division

Parameters
value this parameter can be one of the following values:
  • CRM_AHB_DIV_1
  • CRM_AHB_DIV_2
  • CRM_AHB_DIV_4
  • CRM_AHB_DIV_8
  • CRM_AHB_DIV_16
  • CRM_AHB_DIV_64
  • CRM_AHB_DIV_128
  • CRM_AHB_DIV_256
  • CRM_AHB_DIV_512
Return values
none

Definition at line 463 of file at32f413_crm.c.

Referenced by sclk_192m_hick_config(), sclk_64m_hick_config(), sclk_96m_hext_config(), system_clock_config(), and system_clock_config_for_acc().

◆ crm_apb1_div_set()

void crm_apb1_div_set ( crm_apb1_div_type value )

set crm apb1 division

Note
the maximum frequency of APB1/APB2 clock is 100 MHz
Parameters
value this parameter can be one of the following values:
  • CRM_APB1_DIV_1
  • CRM_APB1_DIV_2
  • CRM_APB1_DIV_4
  • CRM_APB1_DIV_8
  • CRM_APB1_DIV_16
Return values
none

Definition at line 480 of file at32f413_crm.c.

Referenced by main(), sclk_192m_hick_config(), sclk_64m_hick_config(), sclk_96m_hext_config(), system_clock_config(), and system_clock_config_for_acc().

◆ crm_apb2_div_set()

void crm_apb2_div_set ( crm_apb2_div_type value )

set crm apb2 division

Note
the maximum frequency of APB1/APB2 clock is 100 MHz
Parameters
value this parameter can be one of the following values:
  • CRM_APB2_DIV_1
  • CRM_APB2_DIV_2
  • CRM_APB2_DIV_4
  • CRM_APB2_DIV_8
  • CRM_APB2_DIV_16
Return values
none

Definition at line 497 of file at32f413_crm.c.

Referenced by sclk_192m_hick_config(), sclk_64m_hick_config(), sclk_96m_hext_config(), system_clock_config(), and system_clock_config_for_acc().

◆ crm_auto_step_mode_enable()

void crm_auto_step_mode_enable ( confirm_state new_state )

auto step clock switch enable

Parameters
new_state (TRUE or FALSE)
Return values
none

Definition at line 798 of file at32f413_crm.c.

Referenced by sclk_192m_hick_config(), sclk_64m_hick_config(), sclk_96m_hext_config(), system_clock_config(), system_clock_config_for_acc(), and system_clock_recover().

◆ crm_battery_powered_domain_reset()

void crm_battery_powered_domain_reset ( confirm_state new_state )

battery powered domain software reset

Parameters
new_state (TRUE or FALSE)
Return values
none

Definition at line 554 of file at32f413_crm.c.

Referenced by bpr_reset().

◆ crm_clkout_div_set()

void crm_clkout_div_set ( crm_clkout_div_type clkout_div )

set crm clkout division

Parameters
clkout_div this parameter can be one of the following values:
  • CRM_CLKOUT_DIV_1
  • CRM_CLKOUT_DIV_2
  • CRM_CLKOUT_DIV_4
  • CRM_CLKOUT_DIV_8
  • CRM_CLKOUT_DIV_16
  • CRM_CLKOUT_DIV_64
  • CRM_CLKOUT_DIV_128
  • CRM_CLKOUT_DIV_256
  • CRM_CLKOUT_DIV_512
Return values
none

Definition at line 888 of file at32f413_crm.c.

Referenced by clkout_config(), clkout_config(), and clkout_config().

◆ crm_clkout_to_tmr10_enable()

void crm_clkout_to_tmr10_enable ( confirm_state new_state )

enable or disable clkout direct to tmr10 channel 1

Parameters
new_state (TRUE or FALSE)
Return values
none

Definition at line 868 of file at32f413_crm.c.

◆ crm_clock_failure_detection_enable()

void crm_clock_failure_detection_enable ( confirm_state new_state )

enable or disable clock failure detection

Parameters
new_state (TRUE or FALSE)
Return values
none

Definition at line 544 of file at32f413_crm.c.

Referenced by clock_failure_detection_handler(), and main().

◆ crm_clock_out_set()

void crm_clock_out_set ( crm_clkout_select_type clkout )

set crm clkout

Parameters
clkout this parameter can be one of the following values:
  • CRM_CLKOUT_NOCLK
  • CRM_CLKOUT_LICK
  • CRM_CLKOUT_LEXT
  • CRM_CLKOUT_SCLK
  • CRM_CLKOUT_HICK
  • CRM_CLKOUT_HEXT
  • CRM_CLKOUT_PLL_DIV_2
  • CRM_CLKOUT_PLL_DIV_4
  • CRM_CLKOUT_USB
  • CRM_CLKOUT_ADC
Return values
none

Definition at line 767 of file at32f413_crm.c.

Referenced by clkout_config(), clkout_config(), and clkout_config().

◆ crm_clock_source_enable()

void crm_clock_source_enable | ( | crm_clock_source_type | source,
 |  | confirm_state | new_state )

enable or disable the crm clock source

Parameters
source this parameter can be one of the following values:
  • CRM_CLOCK_SOURCE_HICK
  • CRM_CLOCK_SOURCE_HEXT
  • CRM_CLOCK_SOURCE_PLL
  • CRM_CLOCK_SOURCE_LEXT
  • CRM_CLOCK_SOURCE_LICK
new_state (TRUE or FALSE)
Return values
none

Definition at line 342 of file at32f413_crm.c.

Referenced by rtc_config(), rtc_configuration(), rtc_init(), sclk_192m_hick_config(), sclk_64m_hick_config(), sclk_96m_hext_config(), system_clock_config(), system_clock_config_for_acc(), and system_clock_recover().

◆ crm_clocks_freq_get()

void crm_clocks_freq_get ( crm_clocks_freq_type * clocks_struct )

get crm clocks freqency

Parameters
clocks
  • pointer to the crm_clocks_freq structure
Return values
none

< value of the high speed internal clock in hz

< value of the high speed internal clock in hz

< value of the high speed external crystal in hz

< value of the high speed internal clock in hz

< value of the high speed external crystal in hz

< value of the high speed external crystal in hz

< value of the high speed internal clock in hz

Definition at line 660 of file at32f413_crm.c.

Referenced by i2c_init(), i2s_init(), main(), tmr1_config(), tmr1_config(), tmr2_config(), tmr_init(), usart_configuration(), usart_init(), and usb_clock48m_select().

◆ crm_flag_clear()

void crm_flag_clear ( uint32_t flag )

clear the crm reset flags

Parameters
flag this parameter can be one of the following values: reset flag:
  • CRM_NRST_RESET_FLAG
  • CRM_POR_RESET_FLAG
  • CRM_SW_RESET_FLAG
  • CRM_WDT_RESET_FLAG
  • CRM_WWDT_RESET_FLAG
  • CRM_LOWPOWER_RESET_FLAG
  • CRM_ALL_RESET_FLAG interrupt flag:
  • CRM_LICK_READY_INT_FLAG
  • CRM_LEXT_READY_INT_FLAG
  • CRM_HICK_READY_INT_FLAG
  • CRM_HEXT_READY_INT_FLAG
  • CRM_PLL_READY_INT_FLAG
  • CRM_CLOCK_FAILURE_INT_FLAG
Return values
none

< nrst pin reset flag

< power on reset flag

< software reset flag

< watchdog timer reset flag

< window watchdog timer reset flag

< low-power reset flag

< all reset flag

< low speed internal clock stable interrupt ready flag

< low speed external crystal stable interrupt ready flag

< high speed internal clock stable interrupt ready flag

< high speed external crystal stable interrupt ready flag

< phase locking loop stable interrupt ready flag

< clock failure interrupt ready flag

Definition at line 387 of file at32f413_crm.c.

Referenced by clock_failure_detection_handler(), and main().

◆ crm_flag_get()

flag_status crm_flag_get ( uint32_t flag )

get crm flag status

Parameters
flag this parameter can be one of the following values:
  • CRM_HICK_STABLE_FLAG
  • CRM_HEXT_STABLE_FLAG
  • CRM_PLL_STABLE_FLAG
  • CRM_LEXT_STABLE_FLAG
  • CRM_LICK_STABLE_FLAG
  • CRM_NRST_RESET_FLAG
  • CRM_POR_RESET_FLAG
  • CRM_SW_RESET_FLAG
  • CRM_WDT_RESET_FLAG
  • CRM_WWDT_RESET_FLAG
  • CRM_LOWPOWER_RESET_FLAG interrupt flag:
  • CRM_LICK_READY_INT_FLAG
  • CRM_LEXT_READY_INT_FLAG
  • CRM_HICK_READY_INT_FLAG
  • CRM_HEXT_READY_INT_FLAG
  • CRM_PLL_READY_INT_FLAG
  • CRM_CLOCK_FAILURE_INT_FLAG
Return values
flag_status (SET or RESET)

Definition at line 121 of file at32f413_crm.c.

Referenced by can_configuration(), clock_failure_detection_handler(), crm_hext_stable_wait(), main(), rtc_config(), rtc_configuration(), rtc_init(), sclk_192m_hick_config(), sclk_64m_hick_config(), sclk_96m_hext_config(), system_clock_config(), system_clock_config_for_acc(), and system_clock_recover().

◆ crm_hext_bypass()

void crm_hext_bypass ( confirm_state new_state )

enable or disable crm high speed external crystal bypass

Parameters
new_state (TRUE or FALSE)
Return values
none

Definition at line 92 of file at32f413_crm.c.

◆ crm_hext_stable_wait()

error_status crm_hext_stable_wait ( void )

wait for hext stable

Parameters
none
Return values
error_status (ERROR or SUCCESS)

< high speed external crystal stable flag

< time out for hext start up

< high speed external crystal stable flag

Definition at line 198 of file at32f413_crm.c.

Referenced by sclk_96m_hext_config(), system_clock_config(), and system_clock_recover().

◆ crm_hick_clock_calibration_set()

void crm_hick_clock_calibration_set ( uint8_t cali_value )

set the crm calibration value

Parameters
cali_value (0x00~0xFF)
Return values
none

Definition at line 235 of file at32f413_crm.c.

◆ crm_hick_clock_trimming_set()

void crm_hick_clock_trimming_set ( uint8_t trim_value )

set the hick trimming value

Parameters
trim_value (0x00~0x3F)
Return values
none

Definition at line 225 of file at32f413_crm.c.

◆ crm_hick_divider_select()

void crm_hick_divider_select ( crm_hick_div_6_type value )

config hick divider select

Parameters
value this parameter can be one of the following values:
  • CRM_HICK48_DIV6
  • CRM_HICK48_NODIV
Return values
none

Definition at line 827 of file at32f413_crm.c.

Referenced by crm_hick_sclk_frequency_select().

◆ crm_hick_sclk_frequency_select()

void crm_hick_sclk_frequency_select ( crm_hick_sclk_frequency_type value )

hick as system clock frequency select

Parameters
value this parameter can be one of the following values:
  • CRM_HICK_SCLK_8MHZ
  • CRM_HICK_SCLK_48MHZ
Return values
none

Definition at line 840 of file at32f413_crm.c.

Referenced by crm_usb_clock_source_select().

◆ crm_interrupt_enable()

void crm_interrupt_enable | ( | uint32_t | crm_int,
 |  | confirm_state | new_state )

config crm interrupt

Parameters
int this parameter can be any combination of the following values:
  • CRM_LICK_STABLE_INT
  • CRM_LEXT_STABLE_INT
  • CRM_HICK_STABLE_INT
  • CRM_HEXT_STABLE_INT
  • CRM_PLL_STABLE_INT
new_state (TRUE or FALSE)
Return values
none

Definition at line 785 of file at32f413_crm.c.

◆ crm_interrupt_flag_get()

flag_status crm_interrupt_flag_get ( uint32_t flag )

get crm interrupt flag status

Parameters
flag this parameter can be one of the following values:
  • CRM_LICK_READY_INT_FLAG
  • CRM_LEXT_READY_INT_FLAG
  • CRM_HICK_READY_INT_FLAG
  • CRM_HEXT_READY_INT_FLAG
  • CRM_PLL_READY_INT_FLAG
  • CRM_CLOCK_FAILURE_INT_FLAG
Return values
flag_status (SET or RESET)

< low speed internal clock stable interrupt ready flag

< low speed external crystal stable interrupt ready flag

< high speed internal clock stable interrupt ready flag

< high speed external crystal stable interrupt ready flag

< phase locking loop stable interrupt ready flag

< clock failure interrupt ready flag

Definition at line 147 of file at32f413_crm.c.

◆ crm_lext_bypass()

void crm_lext_bypass ( confirm_state new_state )

enable or disable crm low speed external crystal bypass

Parameters
new_state (TRUE or FALSE)
Return values
none

Definition at line 82 of file at32f413_crm.c.

◆ crm_periph_clock_enable()

void crm_periph_clock_enable | ( | crm_periph_clock_type | value,
 |  | confirm_state | new_state )

enable or disable the peripheral clock

Parameters
value this parameter can be one of the following values:
  • CRM_DMA1_PERIPH_CLOCK - CRM_DMA2_PERIPH_CLOCK - CRM_CRC_PERIPH_CLOCK - CRM_SDIO1_PERIPH_CLOCK
  • CRM_IOMUX_PERIPH_CLOCK - CRM_GPIOA_PERIPH_CLOCK - CRM_GPIOB_PERIPH_CLOCK - CRM_GPIOC_PERIPH_CLOCK
  • CRM_GPIOD_PERIPH_CLOCK - CRM_GPIOF_PERIPH_CLOCK - CRM_ADC1_PERIPH_CLOCK - CRM_ADC2_PERIPH_CLOCK
  • CRM_TMR1_PERIPH_CLOCK - CRM_SPI1_PERIPH_CLOCK - CRM_TMR8_PERIPH_CLOCK - CRM_USART1_PERIPH_CLOCK
  • CRM_TMR9_PERIPH_CLOCK - CRM_TMR10_PERIPH_CLOCK - CRM_TMR11_PERIPH_CLOCK - CRM_ACC_PERIPH_CLOCK
  • CRM_TMR3_PERIPH_CLOCK - CRM_TMR4_PERIPH_CLOCK - CRM_TMR5_PERIPH_CLOCK - CRM_WWDT_PERIPH_CLOCK
  • CRM_SPI2_PERIPH_CLOCK - CRM_USART2_PERIPH_CLOCK - CRM_USART3_PERIPH_CLOCK - CRM_UART4_PERIPH_CLOCK
  • CRM_UART5_PERIPH_CLOCK - CRM_I2C1_PERIPH_CLOCK - CRM_I2C2_PERIPH_CLOCK - CRM_USB_PERIPH_CLOCK
  • CRM_CAN1_PERIPH_CLOCK - CRM_BPR_PERIPH_CLOCK - CRM_PWC_PERIPH_CLOCK - CRM_CAN2_PERIPH_CLOCK
new_state (TRUE or FALSE)
Return values
none

Definition at line 263 of file at32f413_crm.c.

Referenced by adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), adc_config(), app_load(), at32_button_init(), at32_led_init(), button_exint_init(), can_configuration(), can_gpio_config(), can_gpio_config(), can_gpio_config(), clkout_config(), clkout_config(), clkout_config(), codec_i2s_init(), crc_cal(), crm_configuration(), crm_sysclk_switch(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_configuration(), exint_config(), exint_line0_config(), exint_line4_config(), flash_crc_check(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), i2c_lowlevel_init(), i2s_config(), i2s_config(), i2s_config(), jump_to_app(), main(), mclk_tmr1_init(), rs485_config(), rtc_alarm_clock_set(), rtc_configuration(), rtc_init(), rtc_time_set(), sd_dma_config(), sd_init(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spiflash_init(), spim_init(), tmr1_config(), tmr1_config(), tmr2_config(), TMR3_GLOBAL_IRQHandler(), tmr_init(), uart_init(), uart_print_init(), usart1_config(), usart_configuration(), usart_gpio_config(), usart_spi_configuration(), usb_clock48m_select(), and usb_usart_config().

◆ crm_periph_reset()

void crm_periph_reset | ( | crm_periph_reset_type | value,
 |  | confirm_state | new_state )

enable or disable the peripheral reset

Parameters
value this parameter can be one of the following values:
  • CRM_IOMUX_PERIPH_RESET - CRM_EXINT_PERIPH_RESET - CRM_GPIOA_PERIPH_RESET - CRM_GPIOB_PERIPH_RESET
  • CRM_GPIOC_PERIPH_RESET - CRM_GPIOD_PERIPH_RESET - CRM_GPIOF_PERIPH_RESET - CRM_ADC1_PERIPH_RESET
  • CRM_ADC2_PERIPH_RESET - CRM_TMR1_PERIPH_RESET - CRM_SPI1_PERIPH_RESET - CRM_TMR8_PERIPH_RESET
  • CRM_USART1_PERIPH_RESET - CRM_TMR9_PERIPH_RESET - CRM_TMR10_PERIPH_RESET - CRM_TMR11_PERIPH_RESET
  • CRM_ACC_PERIPH_RESET - CRM_TMR2_PERIPH_RESET - CRM_TMR3_PERIPH_RESET - CRM_TMR4_PERIPH_RESET
  • CRM_TMR5_PERIPH_RESET - CRM_WWDT_PERIPH_RESET - CRM_SPI2_PERIPH_RESET - CRM_USART2_PERIPH_RESET
  • CRM_USART3_PERIPH_RESET - CRM_UART4_PERIPH_RESET - CRM_UART5_PERIPH_RESET - CRM_I2C1_PERIPH_RESET
  • CRM_I2C2_PERIPH_RESET - CRM_USB_PERIPH_RESET - CRM_CAN1_PERIPH_RESET - CRM_BPR_PERIPH_RESET
  • CRM_PWC_PERIPH_RESET - CRM_CAN2_PERIPH_RESET
new_state (TRUE or FALSE)
Return values
none

Definition at line 293 of file at32f413_crm.c.

Referenced by adc_reset(), can_reset(), gpio_iomux_reset(), gpio_reset(), i2c_reset(), jump_to_app(), pwc_reset(), spi_i2s_reset(), tmr_reset(), usart_reset(), and wwdt_reset().

◆ crm_periph_sleep_mode_clock_enable()

void crm_periph_sleep_mode_clock_enable | ( | crm_periph_clock_sleepmd_type | value,
 |  | confirm_state | new_state )

enable or disable the peripheral clock in sleep mode

Parameters
value this parameter can be one of the following values:
  • CRM_SRAM_PERIPH_CLOCK_SLEEP_MODE
  • CRM_FLASH_PERIPH_CLOCK_SLEEP_MODE
new_state (TRUE or FALSE)
Return values
none

Definition at line 316 of file at32f413_crm.c.

◆ crm_pll_config()

void crm_pll_config | ( | crm_pll_clock_source_type | clock_source,
 |  | crm_pll_mult_type | mult_value,
 |  | crm_pll_output_range_type | pll_range )

config crm pll

Parameters
clock_source this parameter can be one of the following values:
  • CRM_PLL_SOURCE_HICK
  • CRM_PLL_SOURCE_HEXT
  • CRM_PLL_SOURCE_HEXT_DIV
mult_value (CRM_PLL_MULT_2~64)
pll_range this parameter can be one of the following values:
  • CRM_PLL_OUTPUT_RANGE_LE72MHZ
  • CRM_PLL_OUTPUT_RANGE_GT72MHZ
Return values
none

Definition at line 573 of file at32f413_crm.c.

Referenced by sclk_192m_hick_config(), sclk_64m_hick_config(), sclk_96m_hext_config(), system_clock_config(), and system_clock_config_for_acc().

◆ crm_reset()

void crm_reset ( void )

reset the crm register

Parameters
none
Return values
none

Definition at line 48 of file at32f413_crm.c.

Referenced by app_update_handle(), sclk_192m_hick_config(), sclk_64m_hick_config(), sclk_96m_hext_config(), system_clock_config(), and system_clock_config_for_acc().

◆ crm_rtc_clock_enable()

void crm_rtc_clock_enable ( confirm_state new_state )

enable or disable rtc

Parameters
new_state (TRUE or FALSE)
Return values
none

Definition at line 443 of file at32f413_crm.c.

Referenced by rtc_config(), rtc_configuration(), and rtc_init().

◆ crm_rtc_clock_select()

void crm_rtc_clock_select ( crm_rtc_clock_type value )

select rtc clock

Parameters
value this parameter can be one of the following values:
  • CRM_RTC_CLOCK_LEXT
  • CRM_RTC_CLOCK_LICK
  • CRM_RTC_CLOCK_HEXT_DIV
Return values
none

Definition at line 433 of file at32f413_crm.c.

Referenced by rtc_config(), rtc_configuration(), and rtc_init().

◆ crm_sysclk_switch()

void crm_sysclk_switch ( crm_sclk_type value )

select system clock source

Parameters
value this parameter can be one of the following values:
  • CRM_SCLK_HICK
  • CRM_SCLK_HEXT
  • CRM_SCLK_PLL
Return values
none

Definition at line 611 of file at32f413_crm.c.

Referenced by sclk_192m_hick_config(), sclk_64m_hick_config(), sclk_96m_hext_config(), system_clock_config(), system_clock_config_for_acc(), and system_clock_recover().

◆ crm_sysclk_switch_status_get()

crm_sclk_type crm_sysclk_switch_status_get ( void )

indicate which clock source is used as system clock

Parameters
none
Return values
crm_sclk this return can be one of the following values:
  • CRM_SCLK_HICK
  • CRM_SCLK_HEXT
  • CRM_SCLK_PLL

Definition at line 649 of file at32f413_crm.c.

Referenced by crm_clocks_freq_get(), sclk_192m_hick_config(), sclk_64m_hick_config(), sclk_96m_hext_config(), system_clock_config(), system_clock_config_for_acc(), system_clock_recover(), and system_core_clock_update().

◆ crm_usb_clock_div_set()

void crm_usb_clock_div_set ( crm_usb_div_type div_value )

set crm usb division

Parameters
value this parameter can be one of the following values:
  • CRM_USB_DIV_1_5
  • CRM_USB_DIV_1
  • CRM_USB_DIV_2_5
  • CRM_USB_DIV_2
  • CRM_USB_DIV_3_5
  • CRM_USB_DIV_3
  • CRM_USB_DIV_4
Return values
none

Definition at line 533 of file at32f413_crm.c.

Referenced by usb_clock48m_select().

◆ crm_usb_clock_source_select()

void crm_usb_clock_source_select ( crm_usb_clock_source_type value )

usb 48 mhz clock source select

Parameters
value this parameter can be one of the following values:
  • CRM_USB_CLOCK_SOURCE_PLL
  • CRM_USB_CLOCK_SOURCE_HICK
Return values
none

Definition at line 854 of file at32f413_crm.c.

Referenced by usb_clock48m_select().

◆ crm_usb_interrupt_remapping_set()

void crm_usb_interrupt_remapping_set ( crm_usb_int_map_type int_remap )

usbdev interrupt remapping control

Parameters
int_remap this parameter can be one of the following values:
  • CRM_USB_INT19_INT20
  • CRM_USB_INT73_INT74
Return values
none

Definition at line 814 of file at32f413_crm.c.


AT32F413 Firmwary Library: DEBUG

Topics | Macros
DEBUG
AT32F413_periph_driver

DEBUG driver modules. More...

Topics

DEBUG_mode_definition
DEBUG_exported_types
DEBUG_exported_functions
DEBUG_private_functions

Macros

#define DEBUGMCU ((debug_type *) DEBUG_BASE)

Detailed Description

DEBUG driver modules.

Macro Definition Documentation

◆ DEBUGMCU

#define DEBUGMCU ((debug_type *) DEBUG_BASE)

Definition at line 135 of file at32f413_debug.h.

Referenced by debug_device_id_get(), and debug_periph_mode_set().


AT32F413 Firmwary Library: DEBUG_mode_definition

Macros
DEBUG_mode_definition
AT32F413_periph_driver » DEBUG

Macros

#define | DEBUG_SLEEP 0x00000001
#define | DEBUG_DEEPSLEEP 0x00000002
#define | DEBUG_STANDBY 0x00000004
#define | DEBUG_WDT_PAUSE 0x00000100
#define | DEBUG_WWDT_PAUSE 0x00000200
#define | DEBUG_TMR1_PAUSE 0x00000400
#define | DEBUG_TMR2_PAUSE 0x00000800
#define | DEBUG_TMR3_PAUSE 0x00001000
#define | DEBUG_TMR4_PAUSE 0x00002000
#define | DEBUG_CAN1_PAUSE 0x00004000
#define | DEBUG_I2C1_SMBUS_TIMEOUT 0x00008000
#define | DEBUG_I2C2_SMBUS_TIMEOUT 0x00010000
#define | DEBUG_TMR8_PAUSE 0x00020000
#define | DEBUG_TMR5_PAUSE 0x00040000
#define | DEBUG_CAN2_PAUSE 0x00200000
#define | DEBUG_TMR9_PAUSE 0x10000000
#define | DEBUG_TMR10_PAUSE 0x20000000
#define | DEBUG_TMR11_PAUSE 0x40000000

Detailed Description

Macro Definition Documentation

◆ DEBUG_CAN1_PAUSE

#define DEBUG_CAN1_PAUSE 0x00004000

debug can1 pause

Definition at line 59 of file at32f413_debug.h.

◆ DEBUG_CAN2_PAUSE

#define DEBUG_CAN2_PAUSE 0x00200000

debug can2 pause

Definition at line 64 of file at32f413_debug.h.

◆ DEBUG_DEEPSLEEP

#define DEBUG_DEEPSLEEP 0x00000002

debug deepsleep mode

Definition at line 51 of file at32f413_debug.h.

◆ DEBUG_I2C1_SMBUS_TIMEOUT

#define DEBUG_I2C1_SMBUS_TIMEOUT 0x00008000

debug i2c1 smbus timeout

Definition at line 60 of file at32f413_debug.h.

◆ DEBUG_I2C2_SMBUS_TIMEOUT

#define DEBUG_I2C2_SMBUS_TIMEOUT 0x00010000

debug i2c2 smbus timeout

Definition at line 61 of file at32f413_debug.h.

◆ DEBUG_SLEEP

#define DEBUG_SLEEP 0x00000001

debug sleep mode

Definition at line 50 of file at32f413_debug.h.

◆ DEBUG_STANDBY

#define DEBUG_STANDBY 0x00000004

debug standby mode

Definition at line 52 of file at32f413_debug.h.

◆ DEBUG_TMR10_PAUSE

#define DEBUG_TMR10_PAUSE 0x20000000

debug timer10 pause

Definition at line 66 of file at32f413_debug.h.

◆ DEBUG_TMR11_PAUSE

#define DEBUG_TMR11_PAUSE 0x40000000

debug timer11 pause

Definition at line 67 of file at32f413_debug.h.

◆ DEBUG_TMR1_PAUSE

#define DEBUG_TMR1_PAUSE 0x00000400

debug timer1 pause

Definition at line 55 of file at32f413_debug.h.

Referenced by main().

◆ DEBUG_TMR2_PAUSE

#define DEBUG_TMR2_PAUSE 0x00000800

debug timer2 pause

Definition at line 56 of file at32f413_debug.h.

◆ DEBUG_TMR3_PAUSE

#define DEBUG_TMR3_PAUSE 0x00001000

debug timer3 pause

Definition at line 57 of file at32f413_debug.h.

◆ DEBUG_TMR4_PAUSE

#define DEBUG_TMR4_PAUSE 0x00002000

debug timer4 pause

Definition at line 58 of file at32f413_debug.h.

◆ DEBUG_TMR5_PAUSE

#define DEBUG_TMR5_PAUSE 0x00040000

debug timer5 pause

Definition at line 63 of file at32f413_debug.h.

◆ DEBUG_TMR8_PAUSE

#define DEBUG_TMR8_PAUSE 0x00020000

debug timer8 pause

Definition at line 62 of file at32f413_debug.h.

◆ DEBUG_TMR9_PAUSE

#define DEBUG_TMR9_PAUSE 0x10000000

debug timer9 pause

Definition at line 65 of file at32f413_debug.h.

◆ DEBUG_WDT_PAUSE

#define DEBUG_WDT_PAUSE 0x00000100

debug watchdog timer pause

Definition at line 53 of file at32f413_debug.h.

◆ DEBUG_WWDT_PAUSE

#define DEBUG_WWDT_PAUSE 0x00000200

debug window watchdog timer pause

Definition at line 54 of file at32f413_debug.h.


AT32F413 Firmwary Library: DEBUG_exported_types

Data Structures
DEBUG_exported_types
AT32F413_periph_driver » DEBUG

Data Structures

struct debug_type
type define debug register all More...

Detailed Description

Generated by doxygen 1.12.0


AT32F413 Firmwary Library: debug_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
debug_type Struct Reference
AT32F413_periph_driver » DEBUG » DEBUG_exported_types

type define debug register all More...

#include <at32f413_debug.h>

Data Fields

union {
__IO uint32_t pid
struct {
__IO uint32_t pid: 32
} idcode_bit
};
debug idcode register, offset:0x00
union {
__IO uint32_t ctrl
struct {
__IO uint32_t sleep_debug: 1
__IO uint32_t deepsleep_debug: 1
__IO uint32_t standby_debug: 1
__IO uint32_t reserved1: 2
__IO uint32_t trace_ioen: 1
__IO uint32_t trace_mode: 2
__IO uint32_t wdt_pause: 1
__IO uint32_t wwdt_pause: 1
__IO uint32_t tmr1_pause: 1
__IO uint32_t tmr2_pause: 1
__IO uint32_t tmr3_pause: 1
__IO uint32_t tmr4_pause: 1
__IO uint32_t can1_pause: 1
__IO uint32_t i2c1_smbus_timeout: 1
__IO uint32_t i2c2_smbus_timeout: 1
__IO uint32_t tmr8_pause: 1
__IO uint32_t tmr5_pause: 1
__IO uint32_t reserved2: 2
__IO uint32_t can2_pause: 1
__IO uint32_t reserved3: 6
__IO uint32_t tmr9_pause: 1
__IO uint32_t tmr10_pause: 1
__IO uint32_t tmr11_pause: 1
__IO uint32_t reserved4: 1
} ctrl_bit
};
debug ctrl register, offset:0x04

Detailed Description

type define debug register all

Definition at line 80 of file at32f413_debug.h.

Field Documentation

◆ [union]

union { ... } debug_type

debug idcode register, offset:0x00

◆ [union]

union { ... } debug_type

debug ctrl register, offset:0x04

◆ can1_pause

__IO uint32_t debug_type::can1_pause

Definition at line 114 of file at32f413_debug.h.

◆ can2_pause

__IO uint32_t debug_type::can2_pause

Definition at line 120 of file at32f413_debug.h.

◆ ctrl

__IO uint32_t debug_type::ctrl

Definition at line 99 of file at32f413_debug.h.

◆ [struct]

struct { ... } debug_type::ctrl_bit

◆ deepsleep_debug

__IO uint32_t debug_type::deepsleep_debug

Definition at line 103 of file at32f413_debug.h.

◆ i2c1_smbus_timeout

__IO uint32_t debug_type::i2c1_smbus_timeout

Definition at line 115 of file at32f413_debug.h.

◆ i2c2_smbus_timeout

__IO uint32_t debug_type::i2c2_smbus_timeout

Definition at line 116 of file at32f413_debug.h.

◆ [struct]

struct { ... } debug_type::idcode_bit

◆ pid

__IO uint32_t debug_type::pid

Definition at line 87 of file at32f413_debug.h.

◆ reserved1

__IO uint32_t debug_type::reserved1

Definition at line 105 of file at32f413_debug.h.

◆ reserved2

__IO uint32_t debug_type::reserved2

Definition at line 119 of file at32f413_debug.h.

◆ reserved3

__IO uint32_t debug_type::reserved3

Definition at line 121 of file at32f413_debug.h.

◆ reserved4

__IO uint32_t debug_type::reserved4

Definition at line 125 of file at32f413_debug.h.

◆ sleep_debug

__IO uint32_t debug_type::sleep_debug

Definition at line 102 of file at32f413_debug.h.

◆ standby_debug

__IO uint32_t debug_type::standby_debug

Definition at line 104 of file at32f413_debug.h.

◆ tmr10_pause

__IO uint32_t debug_type::tmr10_pause

Definition at line 123 of file at32f413_debug.h.

◆ tmr11_pause

__IO uint32_t debug_type::tmr11_pause

Definition at line 124 of file at32f413_debug.h.

◆ tmr1_pause

__IO uint32_t debug_type::tmr1_pause

Definition at line 110 of file at32f413_debug.h.

◆ tmr2_pause

__IO uint32_t debug_type::tmr2_pause

Definition at line 111 of file at32f413_debug.h.

◆ tmr3_pause

__IO uint32_t debug_type::tmr3_pause

Definition at line 112 of file at32f413_debug.h.

◆ tmr4_pause

__IO uint32_t debug_type::tmr4_pause

Definition at line 113 of file at32f413_debug.h.

◆ tmr5_pause

__IO uint32_t debug_type::tmr5_pause

Definition at line 118 of file at32f413_debug.h.

◆ tmr8_pause

__IO uint32_t debug_type::tmr8_pause

Definition at line 117 of file at32f413_debug.h.

◆ tmr9_pause

__IO uint32_t debug_type::tmr9_pause

Definition at line 122 of file at32f413_debug.h.

◆ trace_ioen

__IO uint32_t debug_type::trace_ioen

Definition at line 106 of file at32f413_debug.h.

◆ trace_mode

__IO uint32_t debug_type::trace_mode

Definition at line 107 of file at32f413_debug.h.

◆ wdt_pause

__IO uint32_t debug_type::wdt_pause

Definition at line 108 of file at32f413_debug.h.

◆ wwdt_pause

__IO uint32_t debug_type::wwdt_pause

Definition at line 109 of file at32f413_debug.h.

The documentation for this struct was generated from the following file:
  • at32f413_debug.h


AT32F413 Firmwary Library: DEBUG_exported_functions

Functions
DEBUG_exported_functions
AT32F413_periph_driver » DEBUG

Functions

uint32_t | debug_device_id_get (void)
get debug device id
void | debug_periph_mode_set (uint32_t periph_debug_mode, confirm_state new_state)
set periph debug mode

Detailed Description

Function Documentation

◆ debug_device_id_get()

uint32_t debug_device_id_get ( void )

get debug device id

Parameters
none
Return values
the debug device id

Definition at line 48 of file at32f413_debug.c.

◆ debug_periph_mode_set()

void debug_periph_mode_set | ( | uint32_t | periph_debug_mode,
 |  | confirm_state | new_state )

set periph debug mode

Parameters
periph_debug_mode this parameter can be any combination of the following values:
  • DEBUG_SLEEP
  • DEBUG_DEEPSLEEP
  • DEBUG_STANDBY
  • DEBUG_WDT_PAUSE
  • DEBUG_WWDT_PAUSE
  • DEBUG_TMR1_PAUSE
  • DEBUG_TMR2_PAUSE
  • DEBUG_TMR3_PAUSE
  • DEBUG_TMR4_PAUSE
  • DEBUG_CAN1_PAUSE
  • DEBUG_I2C1_SMBUS_TIMEOUT
  • DEBUG_I2C2_SMBUS_TIMEOUT
  • DEBUG_TMR8_PAUSE
  • DEBUG_TMR5_PAUSE
  • DEBUG_CAN2_PAUSE
  • DEBUG_TMR9_PAUSE
  • DEBUG_TMR10_PAUSE
  • DEBUG_TMR11_PAUSE
new_state (TRUE or FALSE)
Return values
none

Definition at line 78 of file at32f413_debug.c.

Referenced by main().


AT32F413 Firmwary Library: DEBUG_private_functions

Functions
DEBUG_private_functions
AT32F413_periph_driver » DEBUG

Functions

uint32_t | debug_device_id_get (void)
get debug device id
void | debug_periph_mode_set (uint32_t periph_debug_mode, confirm_state new_state)
set periph debug mode

Detailed Description

Function Documentation

◆ debug_device_id_get()

uint32_t debug_device_id_get ( void )

get debug device id

Parameters
none
Return values
the debug device id

Definition at line 48 of file at32f413_debug.c.

◆ debug_periph_mode_set()

void debug_periph_mode_set | ( | uint32_t | periph_debug_mode,
 |  | confirm_state | new_state )

set periph debug mode

Parameters
periph_debug_mode this parameter can be any combination of the following values:
  • DEBUG_SLEEP
  • DEBUG_DEEPSLEEP
  • DEBUG_STANDBY
  • DEBUG_WDT_PAUSE
  • DEBUG_WWDT_PAUSE
  • DEBUG_TMR1_PAUSE
  • DEBUG_TMR2_PAUSE
  • DEBUG_TMR3_PAUSE
  • DEBUG_TMR4_PAUSE
  • DEBUG_CAN1_PAUSE
  • DEBUG_I2C1_SMBUS_TIMEOUT
  • DEBUG_I2C2_SMBUS_TIMEOUT
  • DEBUG_TMR8_PAUSE
  • DEBUG_TMR5_PAUSE
  • DEBUG_CAN2_PAUSE
  • DEBUG_TMR9_PAUSE
  • DEBUG_TMR10_PAUSE
  • DEBUG_TMR11_PAUSE
new_state (TRUE or FALSE)
Return values
none

Definition at line 78 of file at32f413_debug.c.

Referenced by main().


AT32F413 Firmwary Library: DMA

Topics | Macros
DMA
AT32F413_periph_driver

DMA driver modules. More...

Topics

DMA_interrupts_definition
dma interrupt
DMA_flexible_channel
DMA_flags_definition
dma flag
DMA_exported_types
DMA_exported_functions
DMA_private_functions

Macros

#define | DMA1 ((dma_type *) DMA1_BASE)
#define | DMA1_CHANNEL1 ((dma_channel_type *) DMA1_CHANNEL1_BASE)
#define | DMA1_CHANNEL2 ((dma_channel_type *) DMA1_CHANNEL2_BASE)
#define | DMA1_CHANNEL3 ((dma_channel_type *) DMA1_CHANNEL3_BASE)
#define | DMA1_CHANNEL4 ((dma_channel_type *) DMA1_CHANNEL4_BASE)
#define | DMA1_CHANNEL5 ((dma_channel_type *) DMA1_CHANNEL5_BASE)
#define | DMA1_CHANNEL6 ((dma_channel_type *) DMA1_CHANNEL6_BASE)
#define | DMA1_CHANNEL7 ((dma_channel_type *) DMA1_CHANNEL7_BASE)
#define | DMA2 ((dma_type *) DMA2_BASE)
#define | DMA2_CHANNEL1 ((dma_channel_type *) DMA2_CHANNEL1_BASE)
#define | DMA2_CHANNEL2 ((dma_channel_type *) DMA2_CHANNEL2_BASE)
#define | DMA2_CHANNEL3 ((dma_channel_type *) DMA2_CHANNEL3_BASE)
#define | DMA2_CHANNEL4 ((dma_channel_type *) DMA2_CHANNEL4_BASE)
#define | DMA2_CHANNEL5 ((dma_channel_type *) DMA2_CHANNEL5_BASE)
#define | DMA2_CHANNEL6 ((dma_channel_type *) DMA2_CHANNEL6_BASE)
#define | DMA2_CHANNEL7 ((dma_channel_type *) DMA2_CHANNEL7_BASE)

Detailed Description

DMA driver modules.

Macro Definition Documentation

◆ DMA1

#define DMA1 ((dma_type *) DMA1_BASE)

Definition at line 479 of file at32f413_dma.h.

Referenced by dma_configuration(), dma_flag_clear(), dma_flag_get(), dma_interrupt_flag_get(), and dma_reset().

◆ DMA1_CHANNEL1

#define DMA1_CHANNEL1 ((dma_channel_type *) DMA1_CHANNEL1_BASE)

Definition at line 480 of file at32f413_dma.h.

Referenced by DMA1_Channel1_IRQHandler(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_configuration(), and main().

◆ DMA1_CHANNEL2

#define DMA1_CHANNEL2 ((dma_channel_type *) DMA1_CHANNEL2_BASE)

Definition at line 481 of file at32f413_dma.h.

Referenced by DMA1_Channel2_IRQHandler(), dma_config(), dma_configuration(), and main().

◆ DMA1_CHANNEL3

#define DMA1_CHANNEL3 ((dma_channel_type *) DMA1_CHANNEL3_BASE)

Definition at line 482 of file at32f413_dma.h.

Referenced by codec_i2s_init(), codec_i2s_reset(), DMA1_Channel3_IRQHandler(), dma_config(), dma_config(), dma_config(), dma_configuration(), and main().

◆ DMA1_CHANNEL4

#define DMA1_CHANNEL4 ((dma_channel_type *) DMA1_CHANNEL4_BASE)

Definition at line 483 of file at32f413_dma.h.

Referenced by codec_i2s_init(), codec_i2s_reset(), DMA1_Channel4_IRQHandler(), dma_config(), dma_config(), dma_config(), dma_configuration(), main(), spi_bytes_read(), and spi_bytes_write().

◆ DMA1_CHANNEL5

#define DMA1_CHANNEL5 ((dma_channel_type *) DMA1_CHANNEL5_BASE)

Definition at line 484 of file at32f413_dma.h.

Referenced by dma_config(), main(), spi_bytes_read(), and spi_bytes_write().

◆ DMA1_CHANNEL6

#define DMA1_CHANNEL6 ((dma_channel_type *) DMA1_CHANNEL6_BASE)

Definition at line 485 of file at32f413_dma.h.

◆ DMA1_CHANNEL7

#define DMA1_CHANNEL7 ((dma_channel_type *) DMA1_CHANNEL7_BASE)

Definition at line 486 of file at32f413_dma.h.

◆ DMA2

#define DMA2 ((dma_type *) DMA2_BASE)

Definition at line 488 of file at32f413_dma.h.

Referenced by dma_flag_clear(), dma_flag_get(), dma_interrupt_flag_get(), dma_reset(), and main().

◆ DMA2_CHANNEL1

#define DMA2_CHANNEL1 ((dma_channel_type *) DMA2_CHANNEL1_BASE)

Definition at line 489 of file at32f413_dma.h.

Referenced by main().

◆ DMA2_CHANNEL2

#define DMA2_CHANNEL2 ((dma_channel_type *) DMA2_CHANNEL2_BASE)

Definition at line 490 of file at32f413_dma.h.

◆ DMA2_CHANNEL3

#define DMA2_CHANNEL3 ((dma_channel_type *) DMA2_CHANNEL3_BASE)

Definition at line 491 of file at32f413_dma.h.

◆ DMA2_CHANNEL4

#define DMA2_CHANNEL4 ((dma_channel_type *) DMA2_CHANNEL4_BASE)

Definition at line 492 of file at32f413_dma.h.

Referenced by sd_dma_config().

◆ DMA2_CHANNEL5

#define DMA2_CHANNEL5 ((dma_channel_type *) DMA2_CHANNEL5_BASE)

Definition at line 493 of file at32f413_dma.h.

◆ DMA2_CHANNEL6

#define DMA2_CHANNEL6 ((dma_channel_type *) DMA2_CHANNEL6_BASE)

Definition at line 494 of file at32f413_dma.h.

◆ DMA2_CHANNEL7

#define DMA2_CHANNEL7 ((dma_channel_type *) DMA2_CHANNEL7_BASE)

Definition at line 495 of file at32f413_dma.h.


AT32F413 Firmwary Library: DMA_interrupts_definition

Macros
DMA_interrupts_definition
AT32F413_periph_driver » DMA

dma interrupt More...

Macros

#define | DMA_FDT_INT ((uint32_t)0x00000002)
#define | DMA_HDT_INT ((uint32_t)0x00000004)
#define | DMA_DTERR_INT ((uint32_t)0x00000008)

Detailed Description

dma interrupt

Macro Definition Documentation

◆ DMA_DTERR_INT

#define DMA_DTERR_INT ((uint32_t)0x00000008)

dma errorr interrupt

Definition at line 53 of file at32f413_dma.h.

◆ DMA_FDT_INT

#define DMA_FDT_INT ((uint32_t)0x00000002)

dma full data transfer interrupt

Definition at line 51 of file at32f413_dma.h.

Referenced by codec_i2s_init(), dma_config(), dma_config(), dma_config(), dma_config(), dma_configuration(), i2c_dma_config(), i2c_dma_rx_irq_handler(), i2c_dma_tx_irq_handler(), and main().

◆ DMA_HDT_INT

#define DMA_HDT_INT ((uint32_t)0x00000004)

dma half data transfer interrupt

Definition at line 52 of file at32f413_dma.h.

Referenced by codec_i2s_init().


AT32F413 Firmwary Library: DMA_flexible_channel

Macros
DMA_flexible_channel
AT32F413_periph_driver » DMA

Macros

#define | FLEX_CHANNEL1 ((uint8_t)0x01)
#define | FLEX_CHANNEL2 ((uint8_t)0x02)
#define | FLEX_CHANNEL3 ((uint8_t)0x03)
#define | FLEX_CHANNEL4 ((uint8_t)0x04)
#define | FLEX_CHANNEL5 ((uint8_t)0x05)
#define | FLEX_CHANNEL6 ((uint8_t)0x06)
#define | FLEX_CHANNEL7 ((uint8_t)0x07)

Detailed Description

Macro Definition Documentation

◆ FLEX_CHANNEL1

#define FLEX_CHANNEL1 ((uint8_t)0x01)

dma flexible channel1

Definition at line 63 of file at32f413_dma.h.

Referenced by dma_configuration(), dma_flexible_config(), and main().

◆ FLEX_CHANNEL2

#define FLEX_CHANNEL2 ((uint8_t)0x02)

dma flexible channel2

Definition at line 64 of file at32f413_dma.h.

Referenced by dma_configuration(), and dma_flexible_config().

◆ FLEX_CHANNEL3

#define FLEX_CHANNEL3 ((uint8_t)0x03)

dma flexible channel3

Definition at line 65 of file at32f413_dma.h.

Referenced by dma_configuration(), and dma_flexible_config().

◆ FLEX_CHANNEL4

#define FLEX_CHANNEL4 ((uint8_t)0x04)

dma flexible channel4

Definition at line 66 of file at32f413_dma.h.

Referenced by dma_configuration(), and dma_flexible_config().

◆ FLEX_CHANNEL5

#define FLEX_CHANNEL5 ((uint8_t)0x05)

dma flexible channel5

Definition at line 67 of file at32f413_dma.h.

Referenced by dma_flexible_config().

◆ FLEX_CHANNEL6

#define FLEX_CHANNEL6 ((uint8_t)0x06)

dma flexible channel6

Definition at line 68 of file at32f413_dma.h.

Referenced by dma_flexible_config().

◆ FLEX_CHANNEL7

#define FLEX_CHANNEL7 ((uint8_t)0x07)

dma flexible channel7

Definition at line 69 of file at32f413_dma.h.

Referenced by dma_flexible_config().


AT32F413 Firmwary Library: DMA_flags_definition

Macros
DMA_flags_definition
AT32F413_periph_driver » DMA

dma flag More...

Macros

#define | DMA1_GL1_FLAG ((uint32_t)0x00000001)
#define | DMA1_FDT1_FLAG ((uint32_t)0x00000002)
#define | DMA1_HDT1_FLAG ((uint32_t)0x00000004)
#define | DMA1_DTERR1_FLAG ((uint32_t)0x00000008)
#define | DMA1_GL2_FLAG ((uint32_t)0x00000010)
#define | DMA1_FDT2_FLAG ((uint32_t)0x00000020)
#define | DMA1_HDT2_FLAG ((uint32_t)0x00000040)
#define | DMA1_DTERR2_FLAG ((uint32_t)0x00000080)
#define | DMA1_GL3_FLAG ((uint32_t)0x00000100)
#define | DMA1_FDT3_FLAG ((uint32_t)0x00000200)
#define | DMA1_HDT3_FLAG ((uint32_t)0x00000400)
#define | DMA1_DTERR3_FLAG ((uint32_t)0x00000800)
#define | DMA1_GL4_FLAG ((uint32_t)0x00001000)
#define | DMA1_FDT4_FLAG ((uint32_t)0x00002000)
#define | DMA1_HDT4_FLAG ((uint32_t)0x00004000)
#define | DMA1_DTERR4_FLAG ((uint32_t)0x00008000)
#define | DMA1_GL5_FLAG ((uint32_t)0x00010000)
#define | DMA1_FDT5_FLAG ((uint32_t)0x00020000)
#define | DMA1_HDT5_FLAG ((uint32_t)0x00040000)
#define | DMA1_DTERR5_FLAG ((uint32_t)0x00080000)
#define | DMA1_GL6_FLAG ((uint32_t)0x00100000)
#define | DMA1_FDT6_FLAG ((uint32_t)0x00200000)
#define | DMA1_HDT6_FLAG ((uint32_t)0x00400000)
#define | DMA1_DTERR6_FLAG ((uint32_t)0x00800000)
#define | DMA1_GL7_FLAG ((uint32_t)0x01000000)
#define | DMA1_FDT7_FLAG ((uint32_t)0x02000000)
#define | DMA1_HDT7_FLAG ((uint32_t)0x04000000)
#define | DMA1_DTERR7_FLAG ((uint32_t)0x08000000)
#define | DMA2_GL1_FLAG ((uint32_t)0x10000001)
#define | DMA2_FDT1_FLAG ((uint32_t)0x10000002)
#define | DMA2_HDT1_FLAG ((uint32_t)0x10000004)
#define | DMA2_DTERR1_FLAG ((uint32_t)0x10000008)
#define | DMA2_GL2_FLAG ((uint32_t)0x10000010)
#define | DMA2_FDT2_FLAG ((uint32_t)0x10000020)
#define | DMA2_HDT2_FLAG ((uint32_t)0x10000040)
#define | DMA2_DTERR2_FLAG ((uint32_t)0x10000080)
#define | DMA2_GL3_FLAG ((uint32_t)0x10000100)
#define | DMA2_FDT3_FLAG ((uint32_t)0x10000200)
#define | DMA2_HDT3_FLAG ((uint32_t)0x10000400)
#define | DMA2_DTERR3_FLAG ((uint32_t)0x10000800)
#define | DMA2_GL4_FLAG ((uint32_t)0x10001000)
#define | DMA2_FDT4_FLAG ((uint32_t)0x10002000)
#define | DMA2_HDT4_FLAG ((uint32_t)0x10004000)
#define | DMA2_DTERR4_FLAG ((uint32_t)0x10008000)
#define | DMA2_GL5_FLAG ((uint32_t)0x10010000)
#define | DMA2_FDT5_FLAG ((uint32_t)0x10020000)
#define | DMA2_HDT5_FLAG ((uint32_t)0x10040000)
#define | DMA2_DTERR5_FLAG ((uint32_t)0x10080000)
#define | DMA2_GL6_FLAG ((uint32_t)0x10100000)
#define | DMA2_FDT6_FLAG ((uint32_t)0x10200000)
#define | DMA2_HDT6_FLAG ((uint32_t)0x10400000)
#define | DMA2_DTERR6_FLAG ((uint32_t)0x10800000)
#define | DMA2_GL7_FLAG ((uint32_t)0x11000000)
#define | DMA2_FDT7_FLAG ((uint32_t)0x12000000)
#define | DMA2_HDT7_FLAG ((uint32_t)0x14000000)
#define | DMA2_DTERR7_FLAG ((uint32_t)0x18000000)

Detailed Description

dma flag

Macro Definition Documentation

◆ DMA1_DTERR1_FLAG

#define DMA1_DTERR1_FLAG ((uint32_t)0x00000008)

dma1 channel1 error flag

Definition at line 83 of file at32f413_dma.h.

◆ DMA1_DTERR2_FLAG

#define DMA1_DTERR2_FLAG ((uint32_t)0x00000080)

dma1 channel2 error flag

Definition at line 87 of file at32f413_dma.h.

◆ DMA1_DTERR3_FLAG

#define DMA1_DTERR3_FLAG ((uint32_t)0x00000800)

dma1 channel3 error flag

Definition at line 91 of file at32f413_dma.h.

◆ DMA1_DTERR4_FLAG

#define DMA1_DTERR4_FLAG ((uint32_t)0x00008000)

dma1 channel4 error flag

Definition at line 95 of file at32f413_dma.h.

◆ DMA1_DTERR5_FLAG

#define DMA1_DTERR5_FLAG ((uint32_t)0x00080000)

dma1 channel5 error flag

Definition at line 99 of file at32f413_dma.h.

◆ DMA1_DTERR6_FLAG

#define DMA1_DTERR6_FLAG ((uint32_t)0x00800000)

dma1 channel6 error flag

Definition at line 103 of file at32f413_dma.h.

◆ DMA1_DTERR7_FLAG

#define DMA1_DTERR7_FLAG ((uint32_t)0x08000000)

dma1 channel7 error flag

Definition at line 107 of file at32f413_dma.h.

◆ DMA1_FDT1_FLAG

#define DMA1_FDT1_FLAG ((uint32_t)0x00000002)

dma1 channel1 full data transfer flag

Definition at line 81 of file at32f413_dma.h.

Referenced by DMA1_Channel1_IRQHandler(), and main().

◆ DMA1_FDT2_FLAG

#define DMA1_FDT2_FLAG ((uint32_t)0x00000020)

dma1 channel2 full data transfer flag

Definition at line 85 of file at32f413_dma.h.

Referenced by DMA1_Channel2_IRQHandler(), and main().

◆ DMA1_FDT3_FLAG

#define DMA1_FDT3_FLAG ((uint32_t)0x00000200)

dma1 channel3 full data transfer flag

Definition at line 89 of file at32f413_dma.h.

Referenced by DMA1_Channel3_IRQHandler(), and main().

◆ DMA1_FDT4_FLAG

#define DMA1_FDT4_FLAG ((uint32_t)0x00002000)

dma1 channel4 full data transfer flag

Definition at line 93 of file at32f413_dma.h.

Referenced by DMA1_Channel4_IRQHandler(), main(), spi_bytes_read(), and spi_bytes_write().

◆ DMA1_FDT5_FLAG

#define DMA1_FDT5_FLAG ((uint32_t)0x00020000)

dma1 channel5 full data transfer flag

Definition at line 97 of file at32f413_dma.h.

◆ DMA1_FDT6_FLAG

#define DMA1_FDT6_FLAG ((uint32_t)0x00200000)

dma1 channel6 full data transfer flag

Definition at line 101 of file at32f413_dma.h.

◆ DMA1_FDT7_FLAG

#define DMA1_FDT7_FLAG ((uint32_t)0x02000000)

dma1 channel7 full data transfer flag

Definition at line 105 of file at32f413_dma.h.

◆ DMA1_GL1_FLAG

#define DMA1_GL1_FLAG ((uint32_t)0x00000001)

dma1 channel1 global flag

Definition at line 80 of file at32f413_dma.h.

◆ DMA1_GL2_FLAG

#define DMA1_GL2_FLAG ((uint32_t)0x00000010)

dma1 channel2 global flag

Definition at line 84 of file at32f413_dma.h.

◆ DMA1_GL3_FLAG

#define DMA1_GL3_FLAG ((uint32_t)0x00000100)

dma1 channel3 global flag

Definition at line 88 of file at32f413_dma.h.

◆ DMA1_GL4_FLAG

#define DMA1_GL4_FLAG ((uint32_t)0x00001000)

dma1 channel4 global flag

Definition at line 92 of file at32f413_dma.h.

◆ DMA1_GL5_FLAG

#define DMA1_GL5_FLAG ((uint32_t)0x00010000)

dma1 channel5 global flag

Definition at line 96 of file at32f413_dma.h.

◆ DMA1_GL6_FLAG

#define DMA1_GL6_FLAG ((uint32_t)0x00100000)

dma1 channel6 global flag

Definition at line 100 of file at32f413_dma.h.

◆ DMA1_GL7_FLAG

#define DMA1_GL7_FLAG ((uint32_t)0x01000000)

dma1 channel7 global flag

Definition at line 104 of file at32f413_dma.h.

◆ DMA1_HDT1_FLAG

#define DMA1_HDT1_FLAG ((uint32_t)0x00000004)

dma1 channel1 half data transfer flag

Definition at line 82 of file at32f413_dma.h.

◆ DMA1_HDT2_FLAG

#define DMA1_HDT2_FLAG ((uint32_t)0x00000040)

dma1 channel2 half data transfer flag

Definition at line 86 of file at32f413_dma.h.

◆ DMA1_HDT3_FLAG

#define DMA1_HDT3_FLAG ((uint32_t)0x00000400)

dma1 channel3 half data transfer flag

Definition at line 90 of file at32f413_dma.h.

Referenced by DMA1_Channel3_IRQHandler().

◆ DMA1_HDT4_FLAG

#define DMA1_HDT4_FLAG ((uint32_t)0x00004000)

dma1 channel4 half data transfer flag

Definition at line 94 of file at32f413_dma.h.

Referenced by DMA1_Channel4_IRQHandler().

◆ DMA1_HDT5_FLAG

#define DMA1_HDT5_FLAG ((uint32_t)0x00040000)

dma1 channel5 half data transfer flag

Definition at line 98 of file at32f413_dma.h.

◆ DMA1_HDT6_FLAG

#define DMA1_HDT6_FLAG ((uint32_t)0x00400000)

dma1 channel6 half data transfer flag

Definition at line 102 of file at32f413_dma.h.

◆ DMA1_HDT7_FLAG

#define DMA1_HDT7_FLAG ((uint32_t)0x04000000)

dma1 channel7 half data transfer flag

Definition at line 106 of file at32f413_dma.h.

◆ DMA2_DTERR1_FLAG

#define DMA2_DTERR1_FLAG ((uint32_t)0x10000008)

dma2 channel1 error flag

Definition at line 112 of file at32f413_dma.h.

◆ DMA2_DTERR2_FLAG

#define DMA2_DTERR2_FLAG ((uint32_t)0x10000080)

dma2 channel2 error flag

Definition at line 116 of file at32f413_dma.h.

◆ DMA2_DTERR3_FLAG

#define DMA2_DTERR3_FLAG ((uint32_t)0x10000800)

dma2 channel3 error flag

Definition at line 120 of file at32f413_dma.h.

◆ DMA2_DTERR4_FLAG

#define DMA2_DTERR4_FLAG ((uint32_t)0x10008000)

dma2 channel4 error flag

Definition at line 124 of file at32f413_dma.h.

◆ DMA2_DTERR5_FLAG

#define DMA2_DTERR5_FLAG ((uint32_t)0x10080000)

dma2 channel5 error flag

Definition at line 128 of file at32f413_dma.h.

◆ DMA2_DTERR6_FLAG

#define DMA2_DTERR6_FLAG ((uint32_t)0x10800000)

dma2 channel6 error flag

Definition at line 132 of file at32f413_dma.h.

◆ DMA2_DTERR7_FLAG

#define DMA2_DTERR7_FLAG ((uint32_t)0x18000000)

dma2 channel7 error flag

Definition at line 136 of file at32f413_dma.h.

◆ DMA2_FDT1_FLAG

#define DMA2_FDT1_FLAG ((uint32_t)0x10000002)

dma2 channel1 full data transfer flag

Definition at line 110 of file at32f413_dma.h.

Referenced by DMA2_Channel1_IRQHandler().

◆ DMA2_FDT2_FLAG

#define DMA2_FDT2_FLAG ((uint32_t)0x10000020)

dma2 channel2 full data transfer flag

Definition at line 114 of file at32f413_dma.h.

◆ DMA2_FDT3_FLAG

#define DMA2_FDT3_FLAG ((uint32_t)0x10000200)

dma2 channel3 full data transfer flag

Definition at line 118 of file at32f413_dma.h.

◆ DMA2_FDT4_FLAG

#define DMA2_FDT4_FLAG ((uint32_t)0x10002000)

dma2 channel4 full data transfer flag

Definition at line 122 of file at32f413_dma.h.

◆ DMA2_FDT5_FLAG

#define DMA2_FDT5_FLAG ((uint32_t)0x10020000)

dma2 channel5 full data transfer flag

Definition at line 126 of file at32f413_dma.h.

◆ DMA2_FDT6_FLAG

#define DMA2_FDT6_FLAG ((uint32_t)0x10200000)

dma2 channel6 full data transfer flag

Definition at line 130 of file at32f413_dma.h.

◆ DMA2_FDT7_FLAG

#define DMA2_FDT7_FLAG ((uint32_t)0x12000000)

dma2 channel7 full data transfer flag

Definition at line 134 of file at32f413_dma.h.

◆ DMA2_GL1_FLAG

#define DMA2_GL1_FLAG ((uint32_t)0x10000001)

dma2 channel1 global flag

Definition at line 109 of file at32f413_dma.h.

◆ DMA2_GL2_FLAG

#define DMA2_GL2_FLAG ((uint32_t)0x10000010)

dma2 channel2 global flag

Definition at line 113 of file at32f413_dma.h.

◆ DMA2_GL3_FLAG

#define DMA2_GL3_FLAG ((uint32_t)0x10000100)

dma2 channel3 global flag

Definition at line 117 of file at32f413_dma.h.

◆ DMA2_GL4_FLAG

#define DMA2_GL4_FLAG ((uint32_t)0x10001000)

dma2 channel4 global flag

Definition at line 121 of file at32f413_dma.h.

◆ DMA2_GL5_FLAG

#define DMA2_GL5_FLAG ((uint32_t)0x10010000)

dma2 channel5 global flag

Definition at line 125 of file at32f413_dma.h.

◆ DMA2_GL6_FLAG

#define DMA2_GL6_FLAG ((uint32_t)0x10100000)

dma2 channel6 global flag

Definition at line 129 of file at32f413_dma.h.

◆ DMA2_GL7_FLAG

#define DMA2_GL7_FLAG ((uint32_t)0x11000000)

dma2 channel7 global flag

Definition at line 133 of file at32f413_dma.h.

◆ DMA2_HDT1_FLAG

#define DMA2_HDT1_FLAG ((uint32_t)0x10000004)

dma2 channel1 half data transfer flag

Definition at line 111 of file at32f413_dma.h.

◆ DMA2_HDT2_FLAG

#define DMA2_HDT2_FLAG ((uint32_t)0x10000040)

dma2 channel2 half data transfer flag

Definition at line 115 of file at32f413_dma.h.

◆ DMA2_HDT3_FLAG

#define DMA2_HDT3_FLAG ((uint32_t)0x10000400)

dma2 channel3 half data transfer flag

Definition at line 119 of file at32f413_dma.h.

◆ DMA2_HDT4_FLAG

#define DMA2_HDT4_FLAG ((uint32_t)0x10004000)

dma2 channel4 half data transfer flag

Definition at line 123 of file at32f413_dma.h.

◆ DMA2_HDT5_FLAG

#define DMA2_HDT5_FLAG ((uint32_t)0x10040000)

dma2 channel5 half data transfer flag

Definition at line 127 of file at32f413_dma.h.

◆ DMA2_HDT6_FLAG

#define DMA2_HDT6_FLAG ((uint32_t)0x10400000)

dma2 channel6 half data transfer flag

Definition at line 131 of file at32f413_dma.h.

◆ DMA2_HDT7_FLAG

#define DMA2_HDT7_FLAG ((uint32_t)0x14000000)

dma2 channel7 half data transfer flag

Definition at line 135 of file at32f413_dma.h.


AT32F413 Firmwary Library: DMA_exported_types

Data Structures | Enumerations
DMA_exported_types
AT32F413_periph_driver » DMA

Data Structures

struct | dma_init_type
dma init type More...
struct | dma_type
type define dma register More...
struct | dma_channel_type
type define dma channel register all More...

Enumerations

enum dma_flexible_request_type {
DMA_FLEXIBLE_ADC1 = 0x01 , DMA_FLEXIBLE_SPI1_RX = 0x09 , DMA_FLEXIBLE_SPI1_TX = 0x0A , DMA_FLEXIBLE_SPI2_RX = 0x0B ,
DMA_FLEXIBLE_SPI2_TX = 0x0C , DMA_FLEXIBLE_UART1_RX = 0x19 , DMA_FLEXIBLE_UART1_TX = 0x1A , DMA_FLEXIBLE_UART2_RX = 0x1B ,
DMA_FLEXIBLE_UART2_TX = 0x1C , DMA_FLEXIBLE_UART3_RX = 0x1D , DMA_FLEXIBLE_UART3_TX = 0x1E , DMA_FLEXIBLE_UART4_RX = 0x1F ,
DMA_FLEXIBLE_UART4_TX = 0x20 , DMA_FLEXIBLE_UART5_RX = 0x21 , DMA_FLEXIBLE_UART5_TX = 0x22 , DMA_FLEXIBLE_I2C1_RX = 0x29 ,
DMA_FLEXIBLE_I2C1_TX = 0x2A , DMA_FLEXIBLE_I2C2_RX = 0x2B , DMA_FLEXIBLE_I2C2_TX = 0x2C , DMA_FLEXIBLE_SDIO1 = 0x31 ,
DMA_FLEXIBLE_TMR1_TRIG = 0x35 , DMA_FLEXIBLE_TMR1_HALL = 0x36 , DMA_FLEXIBLE_TMR1_OVERFLOW = 0x37 , DMA_FLEXIBLE_TMR1_CH1 = 0x38 ,
DMA_FLEXIBLE_TMR1_CH2 = 0x39 , DMA_FLEXIBLE_TMR1_CH3 = 0x3A , DMA_FLEXIBLE_TMR1_CH4 = 0x3B , DMA_FLEXIBLE_TMR2_TRIG = 0x3D ,
DMA_FLEXIBLE_TMR2_OVERFLOW = 0x3F , DMA_FLEXIBLE_TMR2_CH1 = 0x40 , DMA_FLEXIBLE_TMR2_CH2 = 0x41 , DMA_FLEXIBLE_TMR2_CH3 = 0x42 ,
DMA_FLEXIBLE_TMR2_CH4 = 0x43 , DMA_FLEXIBLE_TMR3_TRIG = 0x45 , DMA_FLEXIBLE_TMR3_OVERFLOW = 0x47 , DMA_FLEXIBLE_TMR3_CH1 = 0x48 ,
DMA_FLEXIBLE_TMR3_CH2 = 0x49 , DMA_FLEXIBLE_TMR3_CH3 = 0x4A , DMA_FLEXIBLE_TMR3_CH4 = 0x4B , DMA_FLEXIBLE_TMR4_TRIG = 0x4D ,
DMA_FLEXIBLE_TMR4_OVERFLOW = 0x4F , DMA_FLEXIBLE_TMR4_CH1 = 0x50 , DMA_FLEXIBLE_TMR4_CH2 = 0x51 , DMA_FLEXIBLE_TMR4_CH3 = 0x52 ,
DMA_FLEXIBLE_TMR4_CH4 = 0x53 , DMA_FLEXIBLE_TMR5_TRIG = 0x55 , DMA_FLEXIBLE_TMR5_OVERFLOW = 0x57 , DMA_FLEXIBLE_TMR5_CH1 = 0x58 ,
DMA_FLEXIBLE_TMR5_CH2 = 0x59 , DMA_FLEXIBLE_TMR5_CH3 = 0x5A , DMA_FLEXIBLE_TMR5_CH4 = 0x5B , DMA_FLEXIBLE_TMR8_TRIG = 0x6D ,
DMA_FLEXIBLE_TMR8_HALL = 0x6E , DMA_FLEXIBLE_TMR8_OVERFLOW = 0x6F , DMA_FLEXIBLE_TMR8_CH1 = 0x70 , DMA_FLEXIBLE_TMR8_CH2 = 0x71 ,
DMA_FLEXIBLE_TMR8_CH3 = 0x72 , DMA_FLEXIBLE_TMR8_CH4 = 0x73
}
dma flexible request type More...
enum | dma_dir_type { DMA_DIR_PERIPHERAL_TO_MEMORY = 0x0000 , DMA_DIR_MEMORY_TO_PERIPHERAL = 0x0010 , DMA_DIR_MEMORY_TO_MEMORY = 0x4000 }
dma direction type More...
enum | dma_peripheral_inc_type { DMA_PERIPHERAL_INC_DISABLE = 0x00 , DMA_PERIPHERAL_INC_ENABLE = 0x01 }
dma peripheral incremented type More...
enum | dma_memory_inc_type { DMA_MEMORY_INC_DISABLE = 0x00 , DMA_MEMORY_INC_ENABLE = 0x01 }
dma memory incremented type More...
enum | dma_peripheral_data_size_type { DMA_PERIPHERAL_DATA_WIDTH_BYTE = 0x00 , DMA_PERIPHERAL_DATA_WIDTH_HALFWORD = 0x01 , DMA_PERIPHERAL_DATA_WIDTH_WORD = 0x02 }
dma peripheral data size type More...
enum | dma_memory_data_size_type { DMA_MEMORY_DATA_WIDTH_BYTE = 0x00 , DMA_MEMORY_DATA_WIDTH_HALFWORD = 0x01 , DMA_MEMORY_DATA_WIDTH_WORD = 0x02 }
dma memory data size type More...
enum | dma_priority_level_type { DMA_PRIORITY_LOW = 0x00 , DMA_PRIORITY_MEDIUM = 0x01 , DMA_PRIORITY_HIGH = 0x02 , DMA_PRIORITY_VERY_HIGH = 0x03 }
dma priority level type More...

Detailed Description

Enumeration Type Documentation

◆ dma_dir_type

enum dma_dir_type

dma direction type

Enumerator
DMA_DIR_PERIPHERAL_TO_MEMORY | dma data transfer direction:peripheral to memory
DMA_DIR_MEMORY_TO_PERIPHERAL | dma data transfer direction:memory to peripheral
DMA_DIR_MEMORY_TO_MEMORY | dma data transfer direction:memory to memory, note:if the direction is memory to memory,peripheral_base_addr as source and memory_base_addr as destnation

Definition at line 214 of file at32f413_dma.h.

◆ dma_flexible_request_type

enum dma_flexible_request_type

dma flexible request type

Enumerator
DMA_FLEXIBLE_ADC1 | adc1 flexible request id
DMA_FLEXIBLE_SPI1_RX | spi1_rx flexible request id
DMA_FLEXIBLE_SPI1_TX | spi1_tx flexible request id
DMA_FLEXIBLE_SPI2_RX | spi2_rx flexible request id
DMA_FLEXIBLE_SPI2_TX | spi2_tx flexible request id
DMA_FLEXIBLE_UART1_RX | uart1_rx flexible request id
DMA_FLEXIBLE_UART1_TX | uart1_tx flexible request id
DMA_FLEXIBLE_UART2_RX | uart2_rx flexible request id
DMA_FLEXIBLE_UART2_TX | uart2_tx flexible request id
DMA_FLEXIBLE_UART3_RX | uart3_rx flexible request id
DMA_FLEXIBLE_UART3_TX | uart3_tx flexible request id
DMA_FLEXIBLE_UART4_RX | uart4_rx flexible request id
DMA_FLEXIBLE_UART4_TX | uart4_tx flexible request id
DMA_FLEXIBLE_UART5_RX | uart5_rx flexible request id
DMA_FLEXIBLE_UART5_TX | uart5_tx flexible request id
DMA_FLEXIBLE_I2C1_RX | i2c1_rx flexible request id
DMA_FLEXIBLE_I2C1_TX | i2c1_tx flexible request id
DMA_FLEXIBLE_I2C2_RX | i2c2_rx flexible request id
DMA_FLEXIBLE_I2C2_TX | i2c2_tx flexible request id
DMA_FLEXIBLE_SDIO1 | sdio1 flexible request id
DMA_FLEXIBLE_TMR1_TRIG | tmr1_trig flexible request id
DMA_FLEXIBLE_TMR1_HALL | tmr1_hall flexible request id
DMA_FLEXIBLE_TMR1_OVERFLOW | tmr1_overflow flexible request id
DMA_FLEXIBLE_TMR1_CH1 | tmr1_ch1 flexible request id
DMA_FLEXIBLE_TMR1_CH2 | tmr1_ch2 flexible request id
DMA_FLEXIBLE_TMR1_CH3 | tmr1_ch3 flexible request id
DMA_FLEXIBLE_TMR1_CH4 | tmr1_ch4 flexible request id
DMA_FLEXIBLE_TMR2_TRIG | tmr2_trig flexible request id
DMA_FLEXIBLE_TMR2_OVERFLOW | tmr2_overflow flexible request id
DMA_FLEXIBLE_TMR2_CH1 | tmr2_ch1 flexible request id
DMA_FLEXIBLE_TMR2_CH2 | tmr2_ch2 flexible request id
DMA_FLEXIBLE_TMR2_CH3 | tmr2_ch3 flexible request id
DMA_FLEXIBLE_TMR2_CH4 | tmr2_ch4 flexible request id
DMA_FLEXIBLE_TMR3_TRIG | tmr3_trig flexible request id
DMA_FLEXIBLE_TMR3_OVERFLOW | tmr3_overflow flexible request id
DMA_FLEXIBLE_TMR3_CH1 | tmr3_ch1 flexible request id
DMA_FLEXIBLE_TMR3_CH2 | tmr3_ch2 flexible request id
DMA_FLEXIBLE_TMR3_CH3 | tmr3_ch3 flexible request id
DMA_FLEXIBLE_TMR3_CH4 | tmr3_ch4 flexible request id
DMA_FLEXIBLE_TMR4_TRIG | tmr4_trig flexible request id
DMA_FLEXIBLE_TMR4_OVERFLOW | tmr4_overflow flexible request id
DMA_FLEXIBLE_TMR4_CH1 | tmr4_ch1 flexible request id
DMA_FLEXIBLE_TMR4_CH2 | tmr4_ch2 flexible request id
DMA_FLEXIBLE_TMR4_CH3 | tmr4_ch3 flexible request id
DMA_FLEXIBLE_TMR4_CH4 | tmr4_ch4 flexible request id
DMA_FLEXIBLE_TMR5_TRIG | tmr5_trig flexible request id
DMA_FLEXIBLE_TMR5_OVERFLOW | tmr5_overflow flexible request id
DMA_FLEXIBLE_TMR5_CH1 | tmr5_ch1 flexible request id
DMA_FLEXIBLE_TMR5_CH2 | tmr5_ch2 flexible request id
DMA_FLEXIBLE_TMR5_CH3 | tmr5_ch3 flexible request id
DMA_FLEXIBLE_TMR5_CH4 | tmr5_ch4 flexible request id
DMA_FLEXIBLE_TMR8_TRIG | tmr8_trig flexible request id
DMA_FLEXIBLE_TMR8_HALL | tmr8_hall flexible request id
DMA_FLEXIBLE_TMR8_OVERFLOW | tmr8_overflow flexible request id
DMA_FLEXIBLE_TMR8_CH1 | tmr8_ch1 flexible request id
DMA_FLEXIBLE_TMR8_CH2 | tmr8_ch2 flexible request id
DMA_FLEXIBLE_TMR8_CH3 | tmr8_ch3 flexible request id
DMA_FLEXIBLE_TMR8_CH4 | tmr8_ch4 flexible request id

Definition at line 149 of file at32f413_dma.h.

◆ dma_memory_data_size_type

enum dma_memory_data_size_type

dma memory data size type

Enumerator
DMA_MEMORY_DATA_WIDTH_BYTE | dma memory databus width 8bit
DMA_MEMORY_DATA_WIDTH_HALFWORD | dma memory databus width 16bit
DMA_MEMORY_DATA_WIDTH_WORD | dma memory databus width 32bit

Definition at line 253 of file at32f413_dma.h.

◆ dma_memory_inc_type

enum dma_memory_inc_type

dma memory incremented type

Enumerator
DMA_MEMORY_INC_DISABLE | dma memory increment mode disable
DMA_MEMORY_INC_ENABLE | dma memory increment mode enable

Definition at line 234 of file at32f413_dma.h.

◆ dma_peripheral_data_size_type

enum dma_peripheral_data_size_type

dma peripheral data size type

Enumerator
DMA_PERIPHERAL_DATA_WIDTH_BYTE | dma peripheral databus width 8bit
DMA_PERIPHERAL_DATA_WIDTH_HALFWORD | dma peripheral databus width 16bit
DMA_PERIPHERAL_DATA_WIDTH_WORD | dma peripheral databus width 32bit

Definition at line 243 of file at32f413_dma.h.

◆ dma_peripheral_inc_type

enum dma_peripheral_inc_type

dma peripheral incremented type

Enumerator
DMA_PERIPHERAL_INC_DISABLE | dma peripheral increment mode disable
DMA_PERIPHERAL_INC_ENABLE | dma peripheral increment mode enable

Definition at line 225 of file at32f413_dma.h.

◆ dma_priority_level_type

enum dma_priority_level_type

dma priority level type

Enumerator
DMA_PRIORITY_LOW | dma channel priority: low
DMA_PRIORITY_MEDIUM | dma channel priority: mediue
DMA_PRIORITY_HIGH | dma channel priority: high
DMA_PRIORITY_VERY_HIGH | dma channel priority: very high

Definition at line 263 of file at32f413_dma.h.


AT32F413 Firmwary Library: dma_init_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
dma_init_type Struct Reference
AT32F413_periph_driver » DMA » DMA_exported_types

dma init type More...

#include <at32f413_dma.h>

Data Fields

uint32_t | peripheral_base_addr
uint32_t | memory_base_addr
dma_dir_type direction
uint16_t | buffer_size
confirm_state peripheral_inc_enable
confirm_state memory_inc_enable
dma_peripheral_data_size_type peripheral_data_width
dma_memory_data_size_type memory_data_width
confirm_state loop_mode_enable
dma_priority_level_type priority

Detailed Description

dma init type

Definition at line 274 of file at32f413_dma.h.

Field Documentation

◆ buffer_size

uint16_t dma_init_type::buffer_size

counter to transfer

Definition at line 279 of file at32f413_dma.h.

Referenced by codec_i2s_init(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_configuration(), dma_default_para_init(), dma_init(), i2c_dma_config(), main(), sd_dma_config(), spi_bytes_read(), and spi_bytes_write().

◆ direction

dma_dir_type dma_init_type::direction

dma transmit direction, peripheral as source or as destnation

Definition at line 278 of file at32f413_dma.h.

Referenced by codec_i2s_init(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_configuration(), dma_default_para_init(), dma_init(), i2c_dma_config(), i2c_lowlevel_init(), main(), sd_dma_config(), spi_bytes_read(), and spi_bytes_write().

◆ loop_mode_enable

confirm_state dma_init_type::loop_mode_enable

when circular mode enable, buffer size will reload if count to 0

Definition at line 284 of file at32f413_dma.h.

Referenced by codec_i2s_init(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_configuration(), dma_default_para_init(), dma_init(), i2c_lowlevel_init(), main(), sd_dma_config(), spi_bytes_read(), and spi_bytes_write().

◆ memory_base_addr

uint32_t dma_init_type::memory_base_addr

base addrress for memory

Definition at line 277 of file at32f413_dma.h.

Referenced by codec_i2s_init(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_configuration(), dma_default_para_init(), dma_init(), i2c_dma_config(), main(), sd_dma_config(), spi_bytes_read(), and spi_bytes_write().

◆ memory_data_width

dma_memory_data_size_type dma_init_type::memory_data_width

memory data width for transmit

Definition at line 283 of file at32f413_dma.h.

Referenced by codec_i2s_init(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_configuration(), dma_default_para_init(), dma_init(), i2c_lowlevel_init(), main(), sd_dma_config(), spi_bytes_read(), and spi_bytes_write().

◆ memory_inc_enable

confirm_state dma_init_type::memory_inc_enable

memory address increment after one transmit

Definition at line 281 of file at32f413_dma.h.

Referenced by codec_i2s_init(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_configuration(), dma_default_para_init(), dma_init(), i2c_lowlevel_init(), main(), sd_dma_config(), spi_bytes_read(), and spi_bytes_write().

◆ peripheral_base_addr

uint32_t dma_init_type::peripheral_base_addr

base addrress for peripheral

Definition at line 276 of file at32f413_dma.h.

Referenced by codec_i2s_init(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_configuration(), dma_default_para_init(), dma_init(), i2c_dma_config(), main(), sd_dma_config(), spi_bytes_read(), and spi_bytes_write().

◆ peripheral_data_width

dma_peripheral_data_size_type dma_init_type::peripheral_data_width

peripheral data width for transmit

Definition at line 282 of file at32f413_dma.h.

Referenced by codec_i2s_init(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_configuration(), dma_default_para_init(), dma_init(), i2c_lowlevel_init(), main(), sd_dma_config(), spi_bytes_read(), and spi_bytes_write().

◆ peripheral_inc_enable

confirm_state dma_init_type::peripheral_inc_enable

periphera address increment after one transmit

Definition at line 280 of file at32f413_dma.h.

Referenced by codec_i2s_init(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_configuration(), dma_default_para_init(), dma_init(), i2c_lowlevel_init(), main(), sd_dma_config(), spi_bytes_read(), and spi_bytes_write().

◆ priority

dma_priority_level_type dma_init_type::priority

dma priority can choose from very high, high, dedium or low

Definition at line 285 of file at32f413_dma.h.

Referenced by codec_i2s_init(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_configuration(), dma_default_para_init(), dma_init(), i2c_lowlevel_init(), main(), sd_dma_config(), spi_bytes_read(), and spi_bytes_write().

The documentation for this struct was generated from the following file:
  • at32f413_dma.h


AT32F413 Firmwary Library: dma_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
dma_type Struct Reference
AT32F413_periph_driver » DMA » DMA_exported_types

type define dma register More...

#include <at32f413_dma.h>

Data Fields

union {
__IO uint32_t sts
struct {
__IO uint32_t gf1: 1
__IO uint32_t fdtf1: 1
__IO uint32_t hdtf1: 1
__IO uint32_t dterrf1: 1
__IO uint32_t gf2: 1
__IO uint32_t fdtf2: 1
__IO uint32_t hdtf2: 1
__IO uint32_t dterrf2: 1
__IO uint32_t gf3: 1
__IO uint32_t fdtf3: 1
__IO uint32_t hdtf3: 1
__IO uint32_t dterrf3: 1
__IO uint32_t gf4: 1
__IO uint32_t fdtf4: 1
__IO uint32_t hdtf4: 1
__IO uint32_t dterrf4: 1
__IO uint32_t gf5: 1
__IO uint32_t fdtf5: 1
__IO uint32_t hdtf5: 1
__IO uint32_t dterrf5: 1
__IO uint32_t gf6: 1
__IO uint32_t fdtf6: 1
__IO uint32_t hdtf6: 1
__IO uint32_t dterrf6: 1
__IO uint32_t gf7: 1
__IO uint32_t fdtf7: 1
__IO uint32_t hdtf7: 1
__IO uint32_t dterrf7: 1
__IO uint32_t reserved1: 4
} sts_bit
};
dma sts register, offset:0x00
union {
__IO uint32_t clr
struct {
__IO uint32_t gfc1: 1
__IO uint32_t fdtfc1: 1
__IO uint32_t hdtfc1: 1
__IO uint32_t dterrfc1: 1
__IO uint32_t gfc2: 1
__IO uint32_t fdtfc2: 1
__IO uint32_t hdtfc2: 1
__IO uint32_t dterrfc2: 1
__IO uint32_t gfc3: 1
__IO uint32_t fdtfc3: 1
__IO uint32_t hdtfc3: 1
__IO uint32_t dterrfc3: 1
__IO uint32_t gfc4: 1
__IO uint32_t fdtfc4: 1
__IO uint32_t hdtfc4: 1
__IO uint32_t dterrfc4: 1
__IO uint32_t gfc5: 1
__IO uint32_t fdtfc5: 1
__IO uint32_t hdtfc5: 1
__IO uint32_t dterrfc5: 1
__IO uint32_t gfc6: 1
__IO uint32_t fdtfc6: 1
__IO uint32_t hdtfc6: 1
__IO uint32_t dterrfc6: 1
__IO uint32_t gfc7: 1
__IO uint32_t fdtfc7: 1
__IO uint32_t hdtfc7: 1
__IO uint32_t dterrfc7: 1
__IO uint32_t reserved1: 4
} clr_bit
};
dma clr register, offset:0x04
union {
__IO uint32_t src_sel0
struct {
__IO uint32_t ch1_src: 8
__IO uint32_t ch2_src: 8
__IO uint32_t ch3_src: 8
__IO uint32_t ch4_src: 8
} src_sel0_bit
};
dma src_sel0 register, offset:0xA0
union {
__IO uint32_t src_sel1
struct {
__IO uint32_t ch5_src: 8
__IO uint32_t ch6_src: 8
__IO uint32_t ch7_src: 8
__IO uint32_t dma_flex_en: 1
__IO uint32_t reserved1: 7
} src_sel1_bit
};
dma src_sel1 register, offset:0xA4

Detailed Description

type define dma register

Definition at line 291 of file at32f413_dma.h.

Field Documentation

◆ [union]

union { ... } dma_type

dma sts register, offset:0x00

◆ [union]

union { ... } dma_type

dma clr register, offset:0x04

◆ [union]

union { ... } dma_type

dma src_sel0 register, offset:0xA0

◆ [union]

union { ... } dma_type

dma src_sel1 register, offset:0xA4

◆ ch1_src

__IO uint32_t dma_type::ch1_src

Definition at line 384 of file at32f413_dma.h.

Referenced by dma_flexible_config().

◆ ch2_src

__IO uint32_t dma_type::ch2_src

Definition at line 385 of file at32f413_dma.h.

Referenced by dma_flexible_config().

◆ ch3_src

__IO uint32_t dma_type::ch3_src

Definition at line 386 of file at32f413_dma.h.

Referenced by dma_flexible_config().

◆ ch4_src

__IO uint32_t dma_type::ch4_src

Definition at line 387 of file at32f413_dma.h.

Referenced by dma_flexible_config().

◆ ch5_src

__IO uint32_t dma_type::ch5_src

Definition at line 399 of file at32f413_dma.h.

Referenced by dma_flexible_config().

◆ ch6_src

__IO uint32_t dma_type::ch6_src

Definition at line 400 of file at32f413_dma.h.

Referenced by dma_flexible_config().

◆ ch7_src

__IO uint32_t dma_type::ch7_src

Definition at line 401 of file at32f413_dma.h.

Referenced by dma_flexible_config().

◆ clr

__IO uint32_t dma_type::clr

Definition at line 338 of file at32f413_dma.h.

◆ [struct]

struct { ... } dma_type::clr_bit

◆ dma_flex_en

__IO uint32_t dma_type::dma_flex_en

Definition at line 402 of file at32f413_dma.h.

Referenced by dma_flexible_config().

◆ dterrf1

__IO uint32_t dma_type::dterrf1

Definition at line 304 of file at32f413_dma.h.

◆ dterrf2

__IO uint32_t dma_type::dterrf2

Definition at line 308 of file at32f413_dma.h.

◆ dterrf3

__IO uint32_t dma_type::dterrf3

Definition at line 312 of file at32f413_dma.h.

◆ dterrf4

__IO uint32_t dma_type::dterrf4

Definition at line 316 of file at32f413_dma.h.

◆ dterrf5

__IO uint32_t dma_type::dterrf5

Definition at line 320 of file at32f413_dma.h.

◆ dterrf6

__IO uint32_t dma_type::dterrf6

Definition at line 324 of file at32f413_dma.h.

◆ dterrf7

__IO uint32_t dma_type::dterrf7

Definition at line 328 of file at32f413_dma.h.

◆ dterrfc1

__IO uint32_t dma_type::dterrfc1

Definition at line 344 of file at32f413_dma.h.

◆ dterrfc2

__IO uint32_t dma_type::dterrfc2

Definition at line 348 of file at32f413_dma.h.

◆ dterrfc3

__IO uint32_t dma_type::dterrfc3

Definition at line 352 of file at32f413_dma.h.

◆ dterrfc4

__IO uint32_t dma_type::dterrfc4

Definition at line 356 of file at32f413_dma.h.

◆ dterrfc5

__IO uint32_t dma_type::dterrfc5

Definition at line 360 of file at32f413_dma.h.

◆ dterrfc6

__IO uint32_t dma_type::dterrfc6

Definition at line 364 of file at32f413_dma.h.

◆ dterrfc7

__IO uint32_t dma_type::dterrfc7

Definition at line 368 of file at32f413_dma.h.

◆ fdtf1

__IO uint32_t dma_type::fdtf1

Definition at line 302 of file at32f413_dma.h.

◆ fdtf2

__IO uint32_t dma_type::fdtf2

Definition at line 306 of file at32f413_dma.h.

◆ fdtf3

__IO uint32_t dma_type::fdtf3

Definition at line 310 of file at32f413_dma.h.

◆ fdtf4

__IO uint32_t dma_type::fdtf4

Definition at line 314 of file at32f413_dma.h.

◆ fdtf5

__IO uint32_t dma_type::fdtf5

Definition at line 318 of file at32f413_dma.h.

◆ fdtf6

__IO uint32_t dma_type::fdtf6

Definition at line 322 of file at32f413_dma.h.

◆ fdtf7

__IO uint32_t dma_type::fdtf7

Definition at line 326 of file at32f413_dma.h.

◆ fdtfc1

__IO uint32_t dma_type::fdtfc1

Definition at line 342 of file at32f413_dma.h.

◆ fdtfc2

__IO uint32_t dma_type::fdtfc2

Definition at line 346 of file at32f413_dma.h.

◆ fdtfc3

__IO uint32_t dma_type::fdtfc3

Definition at line 350 of file at32f413_dma.h.

◆ fdtfc4

__IO uint32_t dma_type::fdtfc4

Definition at line 354 of file at32f413_dma.h.

◆ fdtfc5

__IO uint32_t dma_type::fdtfc5

Definition at line 358 of file at32f413_dma.h.

◆ fdtfc6

__IO uint32_t dma_type::fdtfc6

Definition at line 362 of file at32f413_dma.h.

◆ fdtfc7

__IO uint32_t dma_type::fdtfc7

Definition at line 366 of file at32f413_dma.h.

◆ gf1

__IO uint32_t dma_type::gf1

Definition at line 301 of file at32f413_dma.h.

◆ gf2

__IO uint32_t dma_type::gf2

Definition at line 305 of file at32f413_dma.h.

◆ gf3

__IO uint32_t dma_type::gf3

Definition at line 309 of file at32f413_dma.h.

◆ gf4

__IO uint32_t dma_type::gf4

Definition at line 313 of file at32f413_dma.h.

◆ gf5

__IO uint32_t dma_type::gf5

Definition at line 317 of file at32f413_dma.h.

◆ gf6

__IO uint32_t dma_type::gf6

Definition at line 321 of file at32f413_dma.h.

◆ gf7

__IO uint32_t dma_type::gf7

Definition at line 325 of file at32f413_dma.h.

◆ gfc1

__IO uint32_t dma_type::gfc1

Definition at line 341 of file at32f413_dma.h.

◆ gfc2

__IO uint32_t dma_type::gfc2

Definition at line 345 of file at32f413_dma.h.

◆ gfc3

__IO uint32_t dma_type::gfc3

Definition at line 349 of file at32f413_dma.h.

◆ gfc4

__IO uint32_t dma_type::gfc4

Definition at line 353 of file at32f413_dma.h.

◆ gfc5

__IO uint32_t dma_type::gfc5

Definition at line 357 of file at32f413_dma.h.

◆ gfc6

__IO uint32_t dma_type::gfc6

Definition at line 361 of file at32f413_dma.h.

◆ gfc7

__IO uint32_t dma_type::gfc7

Definition at line 365 of file at32f413_dma.h.

◆ hdtf1

__IO uint32_t dma_type::hdtf1

Definition at line 303 of file at32f413_dma.h.

◆ hdtf2

__IO uint32_t dma_type::hdtf2

Definition at line 307 of file at32f413_dma.h.

◆ hdtf3

__IO uint32_t dma_type::hdtf3

Definition at line 311 of file at32f413_dma.h.

◆ hdtf4

__IO uint32_t dma_type::hdtf4

Definition at line 315 of file at32f413_dma.h.

◆ hdtf5

__IO uint32_t dma_type::hdtf5

Definition at line 319 of file at32f413_dma.h.

◆ hdtf6

__IO uint32_t dma_type::hdtf6

Definition at line 323 of file at32f413_dma.h.

◆ hdtf7

__IO uint32_t dma_type::hdtf7

Definition at line 327 of file at32f413_dma.h.

◆ hdtfc1

__IO uint32_t dma_type::hdtfc1

Definition at line 343 of file at32f413_dma.h.

◆ hdtfc2

__IO uint32_t dma_type::hdtfc2

Definition at line 347 of file at32f413_dma.h.

◆ hdtfc3

__IO uint32_t dma_type::hdtfc3

Definition at line 351 of file at32f413_dma.h.

◆ hdtfc4

__IO uint32_t dma_type::hdtfc4

Definition at line 355 of file at32f413_dma.h.

◆ hdtfc5

__IO uint32_t dma_type::hdtfc5

Definition at line 359 of file at32f413_dma.h.

◆ hdtfc6

__IO uint32_t dma_type::hdtfc6

Definition at line 363 of file at32f413_dma.h.

◆ hdtfc7

__IO uint32_t dma_type::hdtfc7

Definition at line 367 of file at32f413_dma.h.

◆ reserved1

__IO uint32_t dma_type::reserved1

reserved, offset:0x08~0x9C

Definition at line 329 of file at32f413_dma.h.

◆ src_sel0

__IO uint32_t dma_type::src_sel0

Definition at line 381 of file at32f413_dma.h.

◆ [struct]

struct { ... } dma_type::src_sel0_bit

Referenced by dma_flexible_config().

◆ src_sel1

__IO uint32_t dma_type::src_sel1

Definition at line 396 of file at32f413_dma.h.

◆ [struct]

struct { ... } dma_type::src_sel1_bit

Referenced by dma_flexible_config().

◆ sts

__IO uint32_t dma_type::sts

Definition at line 298 of file at32f413_dma.h.

◆ [struct]

struct { ... } dma_type::sts_bit
The documentation for this struct was generated from the following file:
  • at32f413_dma.h


AT32F413 Firmwary Library: dma_channel_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
dma_channel_type Struct Reference
AT32F413_periph_driver » DMA » DMA_exported_types

type define dma channel register all More...

#include <at32f413_dma.h>

Data Fields

union {
__IO uint32_t ctrl
struct {
__IO uint32_t chen: 1
__IO uint32_t fdtien: 1
__IO uint32_t hdtien: 1
__IO uint32_t dterrien: 1
__IO uint32_t dtd: 1
__IO uint32_t lm: 1
__IO uint32_t pincm: 1
__IO uint32_t mincm: 1
__IO uint32_t pwidth: 2
__IO uint32_t mwidth: 2
__IO uint32_t chpl: 2
__IO uint32_t m2m: 1
__IO uint32_t reserved1: 17
} ctrl_bit
};
dma ctrl register, offset:0x08+20*(x-1) x=1...7
union {
__IO uint32_t dtcnt
struct {
__IO uint32_t cnt: 16
__IO uint32_t reserved1: 16
} dtcnt_bit
};
dma dtcnt register, offset:0x0C+20*(x-1) x=1...7
union {
__IO uint32_t paddr
struct {
__IO uint32_t paddr: 32
} paddr_bit
};
dma cpba register, offset:0x10+20*(x-1) x=1...7
union {
__IO uint32_t maddr
struct {
__IO uint32_t maddr: 32
} maddr_bit
};
dma cmba register, offset:0x14+20*(x-1) x=1...7

Detailed Description

type define dma channel register all

Definition at line 411 of file at32f413_dma.h.

Field Documentation

◆ [union]

union { ... } dma_channel_type

dma ctrl register, offset:0x08+20*(x-1) x=1...7

◆ [union]

union { ... } dma_channel_type

dma dtcnt register, offset:0x0C+20*(x-1) x=1...7

◆ [union]

union { ... } dma_channel_type

dma cpba register, offset:0x10+20*(x-1) x=1...7

◆ [union]

union { ... } dma_channel_type

dma cmba register, offset:0x14+20*(x-1) x=1...7

◆ chen

__IO uint32_t dma_channel_type::chen

Definition at line 421 of file at32f413_dma.h.

Referenced by dma_channel_enable(), and dma_reset().

◆ chpl

__IO uint32_t dma_channel_type::chpl

Definition at line 431 of file at32f413_dma.h.

Referenced by dma_init().

◆ cnt

__IO uint32_t dma_channel_type::cnt

Definition at line 445 of file at32f413_dma.h.

◆ ctrl

__IO uint32_t dma_channel_type::ctrl

Definition at line 418 of file at32f413_dma.h.

Referenced by dma_init(), dma_interrupt_enable(), and dma_reset().

◆ [struct]

struct { ... } dma_channel_type::ctrl_bit

Referenced by dma_channel_enable(), dma_init(), and dma_reset().

◆ dtcnt

__IO uint32_t dma_channel_type::dtcnt

Definition at line 442 of file at32f413_dma.h.

Referenced by dma_data_number_get(), dma_data_number_set(), dma_init(), and dma_reset().

◆ [struct]

struct { ... } dma_channel_type::dtcnt_bit

◆ dtd

__IO uint32_t dma_channel_type::dtd

Definition at line 425 of file at32f413_dma.h.

◆ dterrien

__IO uint32_t dma_channel_type::dterrien

Definition at line 424 of file at32f413_dma.h.

◆ fdtien

__IO uint32_t dma_channel_type::fdtien

Definition at line 422 of file at32f413_dma.h.

◆ hdtien

__IO uint32_t dma_channel_type::hdtien

Definition at line 423 of file at32f413_dma.h.

◆ lm

__IO uint32_t dma_channel_type::lm

Definition at line 426 of file at32f413_dma.h.

Referenced by dma_init().

◆ m2m

__IO uint32_t dma_channel_type::m2m

Definition at line 432 of file at32f413_dma.h.

◆ maddr

__IO uint32_t dma_channel_type::maddr

Definition at line 467 of file at32f413_dma.h.

Referenced by dma_init(), and dma_reset().

◆ [struct]

struct { ... } dma_channel_type::maddr_bit

◆ mincm

__IO uint32_t dma_channel_type::mincm

Definition at line 428 of file at32f413_dma.h.

Referenced by dma_init().

◆ mwidth

__IO uint32_t dma_channel_type::mwidth

Definition at line 430 of file at32f413_dma.h.

Referenced by dma_init().

◆ paddr

__IO uint32_t dma_channel_type::paddr

Definition at line 455 of file at32f413_dma.h.

Referenced by dma_init(), and dma_reset().

◆ [struct]

struct { ... } dma_channel_type::paddr_bit

◆ pincm

__IO uint32_t dma_channel_type::pincm

Definition at line 427 of file at32f413_dma.h.

Referenced by dma_init().

◆ pwidth

__IO uint32_t dma_channel_type::pwidth

Definition at line 429 of file at32f413_dma.h.

Referenced by dma_init().

◆ reserved1

__IO uint32_t dma_channel_type::reserved1

Definition at line 433 of file at32f413_dma.h.

The documentation for this struct was generated from the following file:
  • at32f413_dma.h


AT32F413 Firmwary Library: DMA_exported_functions

Functions
DMA_exported_functions
AT32F413_periph_driver » DMA

Functions

void | dma_reset (dma_channel_type *dmax_channely)
reset the dmax channely registers.
void | dma_default_para_init (dma_init_type *dma_init_struct)
dma init config with its default value.
void | dma_init (dma_channel_type *dmax_channely, dma_init_type *dma_init_struct)
dma init
void | dma_channel_enable (dma_channel_type *dmax_channely, confirm_state new_state)
enable or disable dma channely
void | dma_flexible_config (dma_type *dma_x, uint8_t flex_channelx, dma_flexible_request_type flexible_request)
initialize the dma_x flexible function according to the specified parameters.
void | dma_data_number_set (dma_channel_type *dmax_channely, uint16_t data_number)
set the number of data to be transferred
uint16_t | dma_data_number_get (dma_channel_type *dmax_channely)
get number of data from dtcnt register
void | dma_interrupt_enable (dma_channel_type *dmax_channely, uint32_t dma_int, confirm_state new_state)
enable or disable dma interrupt
flag_status | dma_flag_get (uint32_t dmax_flag)
get dma flag
flag_status | dma_interrupt_flag_get (uint32_t dmax_flag)
get dma interrupt flag
void | dma_flag_clear (uint32_t dmax_flag)
clear dma flag

Detailed Description

Function Documentation

◆ dma_channel_enable()

void dma_channel_enable | ( | dma_channel_type * | dmax_channely,
 |  | confirm_state | new_state )

enable or disable dma channely

Parameters
dmax_channely this parameter can be one of the following values:
  • DMA1_CHANNEL1
  • DMA1_CHANNEL2
  • DMA1_CHANNEL3
  • DMA1_CHANNEL4
  • DMA1_CHANNEL5
  • DMA1_CHANNEL6
  • DMA1_CHANNEL7
  • DMA2_CHANNEL1
  • DMA2_CHANNEL2
  • DMA2_CHANNEL3
  • DMA2_CHANNEL4
  • DMA2_CHANNEL5
  • DMA2_CHANNEL6
  • DMA2_CHANNEL7
new_state (TRUE or FALSE)
Return values
None

Definition at line 197 of file at32f413_dma.c.

Referenced by codec_i2s_init(), codec_i2s_reset(), DMA1_Channel1_IRQHandler(), DMA1_Channel2_IRQHandler(), DMA1_Channel3_IRQHandler(), DMA1_Channel4_IRQHandler(), dma_configuration(), i2c_dma_config(), main(), sd_dma_config(), spi_bytes_read(), and spi_bytes_write().

◆ dma_data_number_get()

uint16_t dma_data_number_get ( dma_channel_type * dmax_channely )

get number of data from dtcnt register

Parameters
dmax_channely this parameter can be one of the following values:
  • DMA1_CHANNEL1
  • DMA1_CHANNEL2
  • DMA1_CHANNEL3
  • DMA1_CHANNEL4
  • DMA1_CHANNEL5
  • DMA1_CHANNEL6
  • DMA1_CHANNEL7
  • DMA2_CHANNEL1
  • DMA2_CHANNEL2
  • DMA2_CHANNEL3
  • DMA2_CHANNEL4
  • DMA2_CHANNEL5
  • DMA2_CHANNEL6
  • DMA2_CHANNEL7
Return values
the number of data.

Definition at line 133 of file at32f413_dma.c.

◆ dma_data_number_set()

void dma_data_number_set | ( | dma_channel_type * | dmax_channely,
 |  | uint16_t | data_number )

set the number of data to be transferred

Parameters
dmax_channely this parameter can be one of the following values:
  • DMA1_CHANNEL1
  • DMA1_CHANNEL2
  • DMA1_CHANNEL3
  • DMA1_CHANNEL4
  • DMA1_CHANNEL5
  • DMA1_CHANNEL6
  • DMA1_CHANNEL7
  • DMA2_CHANNEL1
  • DMA2_CHANNEL2
  • DMA2_CHANNEL3
  • DMA2_CHANNEL4
  • DMA2_CHANNEL5
  • DMA2_CHANNEL6
  • DMA2_CHANNEL7
data_number the number of data to be transferred(0x0000~0xFFFF) transfer.
Return values
none.

Definition at line 108 of file at32f413_dma.c.

◆ dma_default_para_init()

void dma_default_para_init ( dma_init_type * dma_init_struct )

dma init config with its default value.

Parameters
dma_init_struct : pointer to a dma_init_type structure which will be initialized.
Return values
none

Definition at line 407 of file at32f413_dma.c.

Referenced by codec_i2s_init(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_configuration(), i2c_lowlevel_init(), main(), sd_dma_config(), spi_bytes_read(), and spi_bytes_write().

◆ dma_flag_clear()

void dma_flag_clear ( uint32_t dmax_flag )

clear dma flag

Parameters
dmax_flag this parameter can be one of the following values:
  • DMA1_GL1_FLAG - DMA1_FDT1_FLAG - DMA1_HDT1_FLAG - DMA1_DTERR1_FLAG
  • DMA1_GL2_FLAG - DMA1_FDT2_FLAG - DMA1_HDT2_FLAG - DMA1_DTERR2_FLAG
  • DMA1_GL3_FLAG - DMA1_FDT3_FLAG - DMA1_HDT3_FLAG - DMA1_DTERR3_FLAG
  • DMA1_GL4_FLAG - DMA1_FDT4_FLAG - DMA1_HDT4_FLAG - DMA1_DTERR4_FLAG
  • DMA1_GL5_FLAG - DMA1_FDT5_FLAG - DMA1_HDT5_FLAG - DMA1_DTERR5_FLAG
  • DMA1_GL6_FLAG - DMA1_FDT6_FLAG - DMA1_HDT6_FLAG - DMA1_DTERR6_FLAG
  • DMA1_GL7_FLAG - DMA1_FDT7_FLAG - DMA1_HDT7_FLAG - DMA1_DTERR7_FLAG
  • DMA2_GL1_FLAG - DMA2_FDT1_FLAG - DMA2_HDT1_FLAG - DMA2_DTERR1_FLAG
  • DMA2_GL2_FLAG - DMA2_FDT2_FLAG - DMA2_HDT2_FLAG - DMA2_DTERR2_FLAG
  • DMA2_GL3_FLAG - DMA2_FDT3_FLAG - DMA2_HDT3_FLAG - DMA2_DTERR3_FLAG
  • DMA2_GL4_FLAG - DMA2_FDT4_FLAG - DMA2_HDT4_FLAG - DMA2_DTERR4_FLAG
  • DMA2_GL5_FLAG - DMA2_FDT5_FLAG - DMA2_HDT5_FLAG - DMA2_DTERR5_FLAG
  • DMA2_GL6_FLAG - DMA2_FDT6_FLAG - DMA2_HDT6_FLAG - DMA2_DTERR6_FLAG
  • DMA2_GL7_FLAG - DMA2_FDT7_FLAG - DMA2_HDT7_FLAG - DMA2_DTERR7_FLAG
Return values
none

Definition at line 389 of file at32f413_dma.c.

Referenced by DMA1_Channel1_IRQHandler(), DMA1_Channel2_IRQHandler(), DMA1_Channel3_IRQHandler(), DMA1_Channel4_IRQHandler(), DMA2_Channel1_IRQHandler(), i2c_dma_rx_irq_handler(), i2c_dma_tx_irq_handler(), main(), spi_bytes_read(), and spi_bytes_write().

◆ dma_flag_get()

flag_status dma_flag_get ( uint32_t dmax_flag )

get dma flag

Parameters
dmax_flag this parameter can be one of the following values:
  • DMA1_GL1_FLAG - DMA1_FDT1_FLAG - DMA1_HDT1_FLAG - DMA1_DTERR1_FLAG
  • DMA1_GL2_FLAG - DMA1_FDT2_FLAG - DMA1_HDT2_FLAG - DMA1_DTERR2_FLAG
  • DMA1_GL3_FLAG - DMA1_FDT3_FLAG - DMA1_HDT3_FLAG - DMA1_DTERR3_FLAG
  • DMA1_GL4_FLAG - DMA1_FDT4_FLAG - DMA1_HDT4_FLAG - DMA1_DTERR4_FLAG
  • DMA1_GL5_FLAG - DMA1_FDT5_FLAG - DMA1_HDT5_FLAG - DMA1_DTERR5_FLAG
  • DMA1_GL6_FLAG - DMA1_FDT6_FLAG - DMA1_HDT6_FLAG - DMA1_DTERR6_FLAG
  • DMA1_GL7_FLAG - DMA1_FDT7_FLAG - DMA1_HDT7_FLAG - DMA1_DTERR7_FLAG
  • DMA2_GL1_FLAG - DMA2_FDT1_FLAG - DMA2_HDT1_FLAG - DMA2_DTERR1_FLAG
  • DMA2_GL2_FLAG - DMA2_FDT2_FLAG - DMA2_HDT2_FLAG - DMA2_DTERR2_FLAG
  • DMA2_GL3_FLAG - DMA2_FDT3_FLAG - DMA2_HDT3_FLAG - DMA2_DTERR3_FLAG
  • DMA2_GL4_FLAG - DMA2_FDT4_FLAG - DMA2_HDT4_FLAG - DMA2_DTERR4_FLAG
  • DMA2_GL5_FLAG - DMA2_FDT5_FLAG - DMA2_HDT5_FLAG - DMA2_DTERR5_FLAG
  • DMA2_GL6_FLAG - DMA2_FDT6_FLAG - DMA2_HDT6_FLAG - DMA2_DTERR6_FLAG
  • DMA2_GL7_FLAG - DMA2_FDT7_FLAG - DMA2_HDT7_FLAG - DMA2_DTERR7_FLAG
Return values
state of dma flag

Definition at line 343 of file at32f413_dma.c.

Referenced by i2c_dma_rx_irq_handler(), i2c_dma_tx_irq_handler(), main(), spi_bytes_read(), and spi_bytes_write().

◆ dma_flexible_config()

void dma_flexible_config | ( | dma_type * | dma_x,
 |  | uint8_t | flex_channelx,
 |  | dma_flexible_request_type | flexible_request )

initialize the dma_x flexible function according to the specified parameters.

Parameters
dma_x this parameter can be one of the following values:
  • DMA1
  • DMA2
flex_channelx this parameter can be one of the following values:
  • FLEX_CHANNEL1
  • FLEX_CHANNEL2
  • FLEX_CHANNEL3
  • FLEX_CHANNEL4
  • FLEX_CHANNEL5
  • FLEX_CHANNEL6
  • FLEX_CHANNEL7
flexible_request every peripheral have specified hardware_id. this parameter can be one of the following values:
  • DMA_FLEXIBLE_ADC1 - DMA_FLEXIBLE_SPI1_RX - DMA_FLEXIBLE_SPI1_TX - DMA_FLEXIBLE_SPI2_RX
  • DMA_FLEXIBLE_SPI2_TX - DMA_FLEXIBLE_UART1_RX - DMA_FLEXIBLE_UART1_TX - DMA_FLEXIBLE_UART2_RX
  • DMA_FLEXIBLE_UART2_TX - DMA_FLEXIBLE_UART3_RX - DMA_FLEXIBLE_UART3_TX - DMA_FLEXIBLE_UART4_RX
  • DMA_FLEXIBLE_UART4_TX - DMA_FLEXIBLE_UART5_RX - DMA_FLEXIBLE_UART5_TX - DMA_FLEXIBLE_I2C1_RX
  • DMA_FLEXIBLE_I2C1_TX - DMA_FLEXIBLE_I2C2_RX - DMA_FLEXIBLE_I2C2_TX - DMA_FLEXIBLE_SDIO1
  • DMA_FLEXIBLE_TMR1_TRIG - DMA_FLEXIBLE_TMR1_HALL - DMA_FLEXIBLE_TMR1_OVERFLOW- DMA_FLEXIBLE_TMR1_CH1
  • DMA_FLEXIBLE_TMR1_CH2 - DMA_FLEXIBLE_TMR1_CH3 - DMA_FLEXIBLE_TMR1_CH4 - DMA_FLEXIBLE_TMR2_TRIG
  • DMA_FLEXIBLE_TMR2_OVERFLOW- DMA_FLEXIBLE_TMR2_CH1 - DMA_FLEXIBLE_TMR2_CH2 - DMA_FLEXIBLE_TMR2_CH3
  • DMA_FLEXIBLE_TMR2_CH4 - DMA_FLEXIBLE_TMR3_TRIG - DMA_FLEXIBLE_TMR3_OVERFLOW- DMA_FLEXIBLE_TMR3_CH1
  • DMA_FLEXIBLE_TMR3_CH2 - DMA_FLEXIBLE_TMR3_CH3 - DMA_FLEXIBLE_TMR3_CH4 - DMA_FLEXIBLE_TMR4_TRIG
  • DMA_FLEXIBLE_TMR4_OVERFLOW- DMA_FLEXIBLE_TMR4_CH1 - DMA_FLEXIBLE_TMR4_CH2 - DMA_FLEXIBLE_TMR4_CH3
  • DMA_FLEXIBLE_TMR4_CH4 - DMA_FLEXIBLE_TMR5_TRIG - DMA_FLEXIBLE_TMR5_OVERFLOW- DMA_FLEXIBLE_TMR5_CH1
  • DMA_FLEXIBLE_TMR5_CH2 - DMA_FLEXIBLE_TMR5_CH3 - DMA_FLEXIBLE_TMR5_CH4 - DMA_FLEXIBLE_TMR8_TRIG
  • DMA_FLEXIBLE_TMR8_HALL - DMA_FLEXIBLE_TMR8_OVERFLOW- DMA_FLEXIBLE_TMR8_CH1 - DMA_FLEXIBLE_TMR8_CH2
  • DMA_FLEXIBLE_TMR8_CH3 - DMA_FLEXIBLE_TMR8_CH4
Return values
none

< dma flexible channel1

< dma flexible channel2

< dma flexible channel3

< dma flexible channel4

< dma flexible channel5

< dma flexible channel6

< dma flexible channel7

Definition at line 237 of file at32f413_dma.c.

Referenced by dma_configuration(), and main().

◆ dma_init()

void dma_init | ( | dma_channel_type * | dmax_channely,
 |  | dma_init_type * | dma_init_struct )

dma init

Parameters
dmax_channely this parameter can be one of the following values:
  • DMA1_CHANNEL1
  • DMA1_CHANNEL2
  • DMA1_CHANNEL3
  • DMA1_CHANNEL4
  • DMA1_CHANNEL5
  • DMA1_CHANNEL6
  • DMA1_CHANNEL7
  • DMA2_CHANNEL1
  • DMA2_CHANNEL2
  • DMA2_CHANNEL3
  • DMA2_CHANNEL4
  • DMA2_CHANNEL5
  • DMA2_CHANNEL6
  • DMA2_CHANNEL7
dma_initstruct : pointer to a dma_init_type structure.
Return values
none

Definition at line 442 of file at32f413_dma.c.

Referenced by codec_i2s_init(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_configuration(), i2c_dma_config(), i2c_lowlevel_init(), main(), sd_dma_config(), spi_bytes_read(), and spi_bytes_write().

◆ dma_interrupt_enable()

void dma_interrupt_enable | ( | dma_channel_type * | dmax_channely,
 |  | uint32_t | dma_int,
 |  | confirm_state | new_state )

enable or disable dma interrupt

Parameters
dmax_channely this parameter can be one of the following values:
  • DMA1_CHANNEL1
  • DMA1_CHANNEL2
  • DMA1_CHANNEL3
  • DMA1_CHANNEL4
  • DMA1_CHANNEL5
  • DMA1_CHANNEL6
  • DMA1_CHANNEL7
  • DMA2_CHANNEL1
  • DMA2_CHANNEL2
  • DMA2_CHANNEL3
  • DMA2_CHANNEL4
  • DMA2_CHANNEL5
  • DMA2_CHANNEL6
  • DMA2_CHANNEL7
dma_int this parameter can be any combination of the following values:
  • DMA_FDT_INT
  • DMA_HDT_INT
  • DMA_DTERR_INT
new_state (TRUE or FALSE)
Return values
none

Definition at line 164 of file at32f413_dma.c.

Referenced by codec_i2s_init(), dma_config(), dma_config(), dma_config(), dma_config(), dma_configuration(), i2c_dma_config(), i2c_dma_rx_irq_handler(), i2c_dma_tx_irq_handler(), and main().

◆ dma_interrupt_flag_get()

flag_status dma_interrupt_flag_get ( uint32_t dmax_flag )

get dma interrupt flag

Parameters
dmax_flag this parameter can be one of the following values:
  • DMA1_FDT1_FLAG - DMA1_HDT1_FLAG - DMA1_DTERR1_FLAG
  • DMA1_FDT2_FLAG - DMA1_HDT2_FLAG - DMA1_DTERR2_FLAG
  • DMA1_FDT3_FLAG - DMA1_HDT3_FLAG - DMA1_DTERR3_FLAG
  • DMA1_FDT4_FLAG - DMA1_HDT4_FLAG - DMA1_DTERR4_FLAG
  • DMA1_FDT5_FLAG - DMA1_HDT5_FLAG - DMA1_DTERR5_FLAG
  • DMA1_FDT6_FLAG - DMA1_HDT6_FLAG - DMA1_DTERR6_FLAG
  • DMA1_FDT7_FLAG - DMA1_HDT7_FLAG - DMA1_DTERR7_FLAG
  • DMA2_FDT1_FLAG - DMA2_HDT1_FLAG - DMA2_DTERR1_FLAG
  • DMA2_FDT2_FLAG - DMA2_HDT2_FLAG - DMA2_DTERR2_FLAG
  • DMA2_FDT3_FLAG - DMA2_HDT3_FLAG - DMA2_DTERR3_FLAG
  • DMA2_FDT4_FLAG - DMA2_HDT4_FLAG - DMA2_DTERR4_FLAG
  • DMA2_FDT5_FLAG - DMA2_HDT5_FLAG - DMA2_DTERR5_FLAG
  • DMA2_FDT6_FLAG - DMA2_HDT6_FLAG - DMA2_DTERR6_FLAG
  • DMA2_FDT7_FLAG - DMA2_HDT7_FLAG - DMA2_DTERR7_FLAG
Return values
state of dma flag

Definition at line 297 of file at32f413_dma.c.

Referenced by DMA1_Channel1_IRQHandler(), DMA1_Channel2_IRQHandler(), DMA1_Channel3_IRQHandler(), DMA1_Channel4_IRQHandler(), and DMA2_Channel1_IRQHandler().

◆ dma_reset()

void dma_reset ( dma_channel_type * dmax_channely )

reset the dmax channely registers.

Parameters
dmax_channely this parameter can be one of the following values:
  • DMA1_CHANNEL1
  • DMA1_CHANNEL2
  • DMA1_CHANNEL3
  • DMA1_CHANNEL4
  • DMA1_CHANNEL5
  • DMA1_CHANNEL6
  • DMA1_CHANNEL7
  • DMA2_CHANNEL1
  • DMA2_CHANNEL2
  • DMA2_CHANNEL3
  • DMA2_CHANNEL4
  • DMA2_CHANNEL5
  • DMA2_CHANNEL6
  • DMA2_CHANNEL7
Return values
none

Definition at line 63 of file at32f413_dma.c.

Referenced by codec_i2s_init(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_configuration(), i2c_lowlevel_init(), main(), sd_dma_config(), spi_bytes_read(), and spi_bytes_write().


AT32F413 Firmwary Library: DMA_private_functions

Functions
DMA_private_functions
AT32F413_periph_driver » DMA

Functions

void | dma_reset (dma_channel_type *dmax_channely)
reset the dmax channely registers.
void | dma_data_number_set (dma_channel_type *dmax_channely, uint16_t data_number)
set the number of data to be transferred
uint16_t | dma_data_number_get (dma_channel_type *dmax_channely)
get number of data from dtcnt register
void | dma_interrupt_enable (dma_channel_type *dmax_channely, uint32_t dma_int, confirm_state new_state)
enable or disable dma interrupt
void | dma_channel_enable (dma_channel_type *dmax_channely, confirm_state new_state)
enable or disable dma channely
void | dma_flexible_config (dma_type *dma_x, uint8_t flex_channelx, dma_flexible_request_type flexible_request)
initialize the dma_x flexible function according to the specified parameters.
flag_status | dma_interrupt_flag_get (uint32_t dmax_flag)
get dma interrupt flag
flag_status | dma_flag_get (uint32_t dmax_flag)
get dma flag
void | dma_flag_clear (uint32_t dmax_flag)
clear dma flag
void | dma_default_para_init (dma_init_type *dma_init_struct)
dma init config with its default value.
void | dma_init (dma_channel_type *dmax_channely, dma_init_type *dma_init_struct)
dma init

Detailed Description

Function Documentation

◆ dma_channel_enable()

void dma_channel_enable | ( | dma_channel_type * | dmax_channely,
 |  | confirm_state | new_state )

enable or disable dma channely

Parameters
dmax_channely this parameter can be one of the following values:
  • DMA1_CHANNEL1
  • DMA1_CHANNEL2
  • DMA1_CHANNEL3
  • DMA1_CHANNEL4
  • DMA1_CHANNEL5
  • DMA1_CHANNEL6
  • DMA1_CHANNEL7
  • DMA2_CHANNEL1
  • DMA2_CHANNEL2
  • DMA2_CHANNEL3
  • DMA2_CHANNEL4
  • DMA2_CHANNEL5
  • DMA2_CHANNEL6
  • DMA2_CHANNEL7
new_state (TRUE or FALSE)
Return values
None

Definition at line 197 of file at32f413_dma.c.

Referenced by codec_i2s_init(), codec_i2s_reset(), DMA1_Channel1_IRQHandler(), DMA1_Channel2_IRQHandler(), DMA1_Channel3_IRQHandler(), DMA1_Channel4_IRQHandler(), dma_configuration(), i2c_dma_config(), main(), sd_dma_config(), spi_bytes_read(), and spi_bytes_write().

◆ dma_data_number_get()

uint16_t dma_data_number_get ( dma_channel_type * dmax_channely )

get number of data from dtcnt register

Parameters
dmax_channely this parameter can be one of the following values:
  • DMA1_CHANNEL1
  • DMA1_CHANNEL2
  • DMA1_CHANNEL3
  • DMA1_CHANNEL4
  • DMA1_CHANNEL5
  • DMA1_CHANNEL6
  • DMA1_CHANNEL7
  • DMA2_CHANNEL1
  • DMA2_CHANNEL2
  • DMA2_CHANNEL3
  • DMA2_CHANNEL4
  • DMA2_CHANNEL5
  • DMA2_CHANNEL6
  • DMA2_CHANNEL7
Return values
the number of data.

Definition at line 133 of file at32f413_dma.c.

◆ dma_data_number_set()

void dma_data_number_set | ( | dma_channel_type * | dmax_channely,
 |  | uint16_t | data_number )

set the number of data to be transferred

Parameters
dmax_channely this parameter can be one of the following values:
  • DMA1_CHANNEL1
  • DMA1_CHANNEL2
  • DMA1_CHANNEL3
  • DMA1_CHANNEL4
  • DMA1_CHANNEL5
  • DMA1_CHANNEL6
  • DMA1_CHANNEL7
  • DMA2_CHANNEL1
  • DMA2_CHANNEL2
  • DMA2_CHANNEL3
  • DMA2_CHANNEL4
  • DMA2_CHANNEL5
  • DMA2_CHANNEL6
  • DMA2_CHANNEL7
data_number the number of data to be transferred(0x0000~0xFFFF) transfer.
Return values
none.

Definition at line 108 of file at32f413_dma.c.

◆ dma_default_para_init()

void dma_default_para_init ( dma_init_type * dma_init_struct )

dma init config with its default value.

Parameters
dma_init_struct : pointer to a dma_init_type structure which will be initialized.
Return values
none

Definition at line 407 of file at32f413_dma.c.

Referenced by codec_i2s_init(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_configuration(), i2c_lowlevel_init(), main(), sd_dma_config(), spi_bytes_read(), and spi_bytes_write().

◆ dma_flag_clear()

void dma_flag_clear ( uint32_t dmax_flag )

clear dma flag

Parameters
dmax_flag this parameter can be one of the following values:
  • DMA1_GL1_FLAG - DMA1_FDT1_FLAG - DMA1_HDT1_FLAG - DMA1_DTERR1_FLAG
  • DMA1_GL2_FLAG - DMA1_FDT2_FLAG - DMA1_HDT2_FLAG - DMA1_DTERR2_FLAG
  • DMA1_GL3_FLAG - DMA1_FDT3_FLAG - DMA1_HDT3_FLAG - DMA1_DTERR3_FLAG
  • DMA1_GL4_FLAG - DMA1_FDT4_FLAG - DMA1_HDT4_FLAG - DMA1_DTERR4_FLAG
  • DMA1_GL5_FLAG - DMA1_FDT5_FLAG - DMA1_HDT5_FLAG - DMA1_DTERR5_FLAG
  • DMA1_GL6_FLAG - DMA1_FDT6_FLAG - DMA1_HDT6_FLAG - DMA1_DTERR6_FLAG
  • DMA1_GL7_FLAG - DMA1_FDT7_FLAG - DMA1_HDT7_FLAG - DMA1_DTERR7_FLAG
  • DMA2_GL1_FLAG - DMA2_FDT1_FLAG - DMA2_HDT1_FLAG - DMA2_DTERR1_FLAG
  • DMA2_GL2_FLAG - DMA2_FDT2_FLAG - DMA2_HDT2_FLAG - DMA2_DTERR2_FLAG
  • DMA2_GL3_FLAG - DMA2_FDT3_FLAG - DMA2_HDT3_FLAG - DMA2_DTERR3_FLAG
  • DMA2_GL4_FLAG - DMA2_FDT4_FLAG - DMA2_HDT4_FLAG - DMA2_DTERR4_FLAG
  • DMA2_GL5_FLAG - DMA2_FDT5_FLAG - DMA2_HDT5_FLAG - DMA2_DTERR5_FLAG
  • DMA2_GL6_FLAG - DMA2_FDT6_FLAG - DMA2_HDT6_FLAG - DMA2_DTERR6_FLAG
  • DMA2_GL7_FLAG - DMA2_FDT7_FLAG - DMA2_HDT7_FLAG - DMA2_DTERR7_FLAG
Return values
none

Definition at line 389 of file at32f413_dma.c.

Referenced by DMA1_Channel1_IRQHandler(), DMA1_Channel2_IRQHandler(), DMA1_Channel3_IRQHandler(), DMA1_Channel4_IRQHandler(), DMA2_Channel1_IRQHandler(), i2c_dma_rx_irq_handler(), i2c_dma_tx_irq_handler(), main(), spi_bytes_read(), and spi_bytes_write().

◆ dma_flag_get()

flag_status dma_flag_get ( uint32_t dmax_flag )

get dma flag

Parameters
dmax_flag this parameter can be one of the following values:
  • DMA1_GL1_FLAG - DMA1_FDT1_FLAG - DMA1_HDT1_FLAG - DMA1_DTERR1_FLAG
  • DMA1_GL2_FLAG - DMA1_FDT2_FLAG - DMA1_HDT2_FLAG - DMA1_DTERR2_FLAG
  • DMA1_GL3_FLAG - DMA1_FDT3_FLAG - DMA1_HDT3_FLAG - DMA1_DTERR3_FLAG
  • DMA1_GL4_FLAG - DMA1_FDT4_FLAG - DMA1_HDT4_FLAG - DMA1_DTERR4_FLAG
  • DMA1_GL5_FLAG - DMA1_FDT5_FLAG - DMA1_HDT5_FLAG - DMA1_DTERR5_FLAG
  • DMA1_GL6_FLAG - DMA1_FDT6_FLAG - DMA1_HDT6_FLAG - DMA1_DTERR6_FLAG
  • DMA1_GL7_FLAG - DMA1_FDT7_FLAG - DMA1_HDT7_FLAG - DMA1_DTERR7_FLAG
  • DMA2_GL1_FLAG - DMA2_FDT1_FLAG - DMA2_HDT1_FLAG - DMA2_DTERR1_FLAG
  • DMA2_GL2_FLAG - DMA2_FDT2_FLAG - DMA2_HDT2_FLAG - DMA2_DTERR2_FLAG
  • DMA2_GL3_FLAG - DMA2_FDT3_FLAG - DMA2_HDT3_FLAG - DMA2_DTERR3_FLAG
  • DMA2_GL4_FLAG - DMA2_FDT4_FLAG - DMA2_HDT4_FLAG - DMA2_DTERR4_FLAG
  • DMA2_GL5_FLAG - DMA2_FDT5_FLAG - DMA2_HDT5_FLAG - DMA2_DTERR5_FLAG
  • DMA2_GL6_FLAG - DMA2_FDT6_FLAG - DMA2_HDT6_FLAG - DMA2_DTERR6_FLAG
  • DMA2_GL7_FLAG - DMA2_FDT7_FLAG - DMA2_HDT7_FLAG - DMA2_DTERR7_FLAG
Return values
state of dma flag

Definition at line 343 of file at32f413_dma.c.

Referenced by i2c_dma_rx_irq_handler(), i2c_dma_tx_irq_handler(), main(), spi_bytes_read(), and spi_bytes_write().

◆ dma_flexible_config()

void dma_flexible_config | ( | dma_type * | dma_x,
 |  | uint8_t | flex_channelx,
 |  | dma_flexible_request_type | flexible_request )

initialize the dma_x flexible function according to the specified parameters.

Parameters
dma_x this parameter can be one of the following values:
  • DMA1
  • DMA2
flex_channelx this parameter can be one of the following values:
  • FLEX_CHANNEL1
  • FLEX_CHANNEL2
  • FLEX_CHANNEL3
  • FLEX_CHANNEL4
  • FLEX_CHANNEL5
  • FLEX_CHANNEL6
  • FLEX_CHANNEL7
flexible_request every peripheral have specified hardware_id. this parameter can be one of the following values:
  • DMA_FLEXIBLE_ADC1 - DMA_FLEXIBLE_SPI1_RX - DMA_FLEXIBLE_SPI1_TX - DMA_FLEXIBLE_SPI2_RX
  • DMA_FLEXIBLE_SPI2_TX - DMA_FLEXIBLE_UART1_RX - DMA_FLEXIBLE_UART1_TX - DMA_FLEXIBLE_UART2_RX
  • DMA_FLEXIBLE_UART2_TX - DMA_FLEXIBLE_UART3_RX - DMA_FLEXIBLE_UART3_TX - DMA_FLEXIBLE_UART4_RX
  • DMA_FLEXIBLE_UART4_TX - DMA_FLEXIBLE_UART5_RX - DMA_FLEXIBLE_UART5_TX - DMA_FLEXIBLE_I2C1_RX
  • DMA_FLEXIBLE_I2C1_TX - DMA_FLEXIBLE_I2C2_RX - DMA_FLEXIBLE_I2C2_TX - DMA_FLEXIBLE_SDIO1
  • DMA_FLEXIBLE_TMR1_TRIG - DMA_FLEXIBLE_TMR1_HALL - DMA_FLEXIBLE_TMR1_OVERFLOW- DMA_FLEXIBLE_TMR1_CH1
  • DMA_FLEXIBLE_TMR1_CH2 - DMA_FLEXIBLE_TMR1_CH3 - DMA_FLEXIBLE_TMR1_CH4 - DMA_FLEXIBLE_TMR2_TRIG
  • DMA_FLEXIBLE_TMR2_OVERFLOW- DMA_FLEXIBLE_TMR2_CH1 - DMA_FLEXIBLE_TMR2_CH2 - DMA_FLEXIBLE_TMR2_CH3
  • DMA_FLEXIBLE_TMR2_CH4 - DMA_FLEXIBLE_TMR3_TRIG - DMA_FLEXIBLE_TMR3_OVERFLOW- DMA_FLEXIBLE_TMR3_CH1
  • DMA_FLEXIBLE_TMR3_CH2 - DMA_FLEXIBLE_TMR3_CH3 - DMA_FLEXIBLE_TMR3_CH4 - DMA_FLEXIBLE_TMR4_TRIG
  • DMA_FLEXIBLE_TMR4_OVERFLOW- DMA_FLEXIBLE_TMR4_CH1 - DMA_FLEXIBLE_TMR4_CH2 - DMA_FLEXIBLE_TMR4_CH3
  • DMA_FLEXIBLE_TMR4_CH4 - DMA_FLEXIBLE_TMR5_TRIG - DMA_FLEXIBLE_TMR5_OVERFLOW- DMA_FLEXIBLE_TMR5_CH1
  • DMA_FLEXIBLE_TMR5_CH2 - DMA_FLEXIBLE_TMR5_CH3 - DMA_FLEXIBLE_TMR5_CH4 - DMA_FLEXIBLE_TMR8_TRIG
  • DMA_FLEXIBLE_TMR8_HALL - DMA_FLEXIBLE_TMR8_OVERFLOW- DMA_FLEXIBLE_TMR8_CH1 - DMA_FLEXIBLE_TMR8_CH2
  • DMA_FLEXIBLE_TMR8_CH3 - DMA_FLEXIBLE_TMR8_CH4
Return values
none

< dma flexible channel1

< dma flexible channel2

< dma flexible channel3

< dma flexible channel4

< dma flexible channel5

< dma flexible channel6

< dma flexible channel7

Definition at line 237 of file at32f413_dma.c.

Referenced by dma_configuration(), and main().

◆ dma_init()

void dma_init | ( | dma_channel_type * | dmax_channely,
 |  | dma_init_type * | dma_init_struct )

dma init

Parameters
dmax_channely this parameter can be one of the following values:
  • DMA1_CHANNEL1
  • DMA1_CHANNEL2
  • DMA1_CHANNEL3
  • DMA1_CHANNEL4
  • DMA1_CHANNEL5
  • DMA1_CHANNEL6
  • DMA1_CHANNEL7
  • DMA2_CHANNEL1
  • DMA2_CHANNEL2
  • DMA2_CHANNEL3
  • DMA2_CHANNEL4
  • DMA2_CHANNEL5
  • DMA2_CHANNEL6
  • DMA2_CHANNEL7
dma_initstruct : pointer to a dma_init_type structure.
Return values
none

Definition at line 442 of file at32f413_dma.c.

Referenced by codec_i2s_init(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_configuration(), i2c_dma_config(), i2c_lowlevel_init(), main(), sd_dma_config(), spi_bytes_read(), and spi_bytes_write().

◆ dma_interrupt_enable()

void dma_interrupt_enable | ( | dma_channel_type * | dmax_channely,
 |  | uint32_t | dma_int,
 |  | confirm_state | new_state )

enable or disable dma interrupt

Parameters
dmax_channely this parameter can be one of the following values:
  • DMA1_CHANNEL1
  • DMA1_CHANNEL2
  • DMA1_CHANNEL3
  • DMA1_CHANNEL4
  • DMA1_CHANNEL5
  • DMA1_CHANNEL6
  • DMA1_CHANNEL7
  • DMA2_CHANNEL1
  • DMA2_CHANNEL2
  • DMA2_CHANNEL3
  • DMA2_CHANNEL4
  • DMA2_CHANNEL5
  • DMA2_CHANNEL6
  • DMA2_CHANNEL7
dma_int this parameter can be any combination of the following values:
  • DMA_FDT_INT
  • DMA_HDT_INT
  • DMA_DTERR_INT
new_state (TRUE or FALSE)
Return values
none

Definition at line 164 of file at32f413_dma.c.

Referenced by codec_i2s_init(), dma_config(), dma_config(), dma_config(), dma_config(), dma_configuration(), i2c_dma_config(), i2c_dma_rx_irq_handler(), i2c_dma_tx_irq_handler(), and main().

◆ dma_interrupt_flag_get()

flag_status dma_interrupt_flag_get ( uint32_t dmax_flag )

get dma interrupt flag

Parameters
dmax_flag this parameter can be one of the following values:
  • DMA1_FDT1_FLAG - DMA1_HDT1_FLAG - DMA1_DTERR1_FLAG
  • DMA1_FDT2_FLAG - DMA1_HDT2_FLAG - DMA1_DTERR2_FLAG
  • DMA1_FDT3_FLAG - DMA1_HDT3_FLAG - DMA1_DTERR3_FLAG
  • DMA1_FDT4_FLAG - DMA1_HDT4_FLAG - DMA1_DTERR4_FLAG
  • DMA1_FDT5_FLAG - DMA1_HDT5_FLAG - DMA1_DTERR5_FLAG
  • DMA1_FDT6_FLAG - DMA1_HDT6_FLAG - DMA1_DTERR6_FLAG
  • DMA1_FDT7_FLAG - DMA1_HDT7_FLAG - DMA1_DTERR7_FLAG
  • DMA2_FDT1_FLAG - DMA2_HDT1_FLAG - DMA2_DTERR1_FLAG
  • DMA2_FDT2_FLAG - DMA2_HDT2_FLAG - DMA2_DTERR2_FLAG
  • DMA2_FDT3_FLAG - DMA2_HDT3_FLAG - DMA2_DTERR3_FLAG
  • DMA2_FDT4_FLAG - DMA2_HDT4_FLAG - DMA2_DTERR4_FLAG
  • DMA2_FDT5_FLAG - DMA2_HDT5_FLAG - DMA2_DTERR5_FLAG
  • DMA2_FDT6_FLAG - DMA2_HDT6_FLAG - DMA2_DTERR6_FLAG
  • DMA2_FDT7_FLAG - DMA2_HDT7_FLAG - DMA2_DTERR7_FLAG
Return values
state of dma flag

Definition at line 297 of file at32f413_dma.c.

Referenced by DMA1_Channel1_IRQHandler(), DMA1_Channel2_IRQHandler(), DMA1_Channel3_IRQHandler(), DMA1_Channel4_IRQHandler(), and DMA2_Channel1_IRQHandler().

◆ dma_reset()

void dma_reset ( dma_channel_type * dmax_channely )

reset the dmax channely registers.

Parameters
dmax_channely this parameter can be one of the following values:
  • DMA1_CHANNEL1
  • DMA1_CHANNEL2
  • DMA1_CHANNEL3
  • DMA1_CHANNEL4
  • DMA1_CHANNEL5
  • DMA1_CHANNEL6
  • DMA1_CHANNEL7
  • DMA2_CHANNEL1
  • DMA2_CHANNEL2
  • DMA2_CHANNEL3
  • DMA2_CHANNEL4
  • DMA2_CHANNEL5
  • DMA2_CHANNEL6
  • DMA2_CHANNEL7
Return values
none

Definition at line 63 of file at32f413_dma.c.

Referenced by codec_i2s_init(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_configuration(), i2c_lowlevel_init(), main(), sd_dma_config(), spi_bytes_read(), and spi_bytes_write().


AT32F413 Firmwary Library: EXINT

Topics | Macros
EXINT
AT32F413_periph_driver

EXINT driver modules. More...

Topics

EXINT_lines
EXINT_exported_types
EXINT_exported_functions
EXINT_private_functions

Macros

#define EXINT ((exint_type *) EXINT_BASE)

Detailed Description

EXINT driver modules.

Macro Definition Documentation

◆ EXINT

#define EXINT ((exint_type *) EXINT_BASE)

Definition at line 198 of file at32f413_exint.h.

Referenced by exint_event_enable(), exint_flag_clear(), exint_flag_get(), exint_init(), exint_interrupt_enable(), exint_interrupt_flag_get(), exint_reset(), and exint_software_interrupt_event_generate().


AT32F413 Firmwary Library: EXINT_lines

Macros
EXINT_lines
AT32F413_periph_driver » EXINT

Macros

#define | EXINT_LINE_NONE ((uint32_t)0x000000)
#define | EXINT_LINE_0 ((uint32_t)0x000001)
#define | EXINT_LINE_1 ((uint32_t)0x000002)
#define | EXINT_LINE_2 ((uint32_t)0x000004)
#define | EXINT_LINE_3 ((uint32_t)0x000008)
#define | EXINT_LINE_4 ((uint32_t)0x000010)
#define | EXINT_LINE_5 ((uint32_t)0x000020)
#define | EXINT_LINE_6 ((uint32_t)0x000040)
#define | EXINT_LINE_7 ((uint32_t)0x000080)
#define | EXINT_LINE_8 ((uint32_t)0x000100)
#define | EXINT_LINE_9 ((uint32_t)0x000200)
#define | EXINT_LINE_10 ((uint32_t)0x000400)
#define | EXINT_LINE_11 ((uint32_t)0x000800)
#define | EXINT_LINE_12 ((uint32_t)0x001000)
#define | EXINT_LINE_13 ((uint32_t)0x002000)
#define | EXINT_LINE_14 ((uint32_t)0x004000)
#define | EXINT_LINE_15 ((uint32_t)0x008000)
#define | EXINT_LINE_16 ((uint32_t)0x010000)
#define | EXINT_LINE_17 ((uint32_t)0x020000)
#define | EXINT_LINE_18 ((uint32_t)0x040000)

Detailed Description

Macro Definition Documentation

◆ EXINT_LINE_0

#define EXINT_LINE_0 ((uint32_t)0x000001)

external interrupt line 0

Definition at line 51 of file at32f413_exint.h.

Referenced by button_exint_init(), button_isr(), EXINT0_IRQHandler(), and exint_line0_config().

◆ EXINT_LINE_1

#define EXINT_LINE_1 ((uint32_t)0x000002)

external interrupt line 1

Definition at line 52 of file at32f413_exint.h.

◆ EXINT_LINE_10

#define EXINT_LINE_10 ((uint32_t)0x000400)

external interrupt line 10

Definition at line 61 of file at32f413_exint.h.

◆ EXINT_LINE_11

#define EXINT_LINE_11 ((uint32_t)0x000800)

external interrupt line 11

Definition at line 62 of file at32f413_exint.h.

Referenced by exint_config().

◆ EXINT_LINE_12

#define EXINT_LINE_12 ((uint32_t)0x001000)

external interrupt line 12

Definition at line 63 of file at32f413_exint.h.

◆ EXINT_LINE_13

#define EXINT_LINE_13 ((uint32_t)0x002000)

external interrupt line 13

Definition at line 64 of file at32f413_exint.h.

◆ EXINT_LINE_14

#define EXINT_LINE_14 ((uint32_t)0x004000)

external interrupt line 14

Definition at line 65 of file at32f413_exint.h.

◆ EXINT_LINE_15

#define EXINT_LINE_15 ((uint32_t)0x008000)

external interrupt line 15

Definition at line 66 of file at32f413_exint.h.

Referenced by exint_config().

◆ EXINT_LINE_16

#define EXINT_LINE_16 ((uint32_t)0x010000)

external interrupt line 16 connected to the pvm output

Definition at line 67 of file at32f413_exint.h.

Referenced by main(), pvm_exint_config(), and PVM_IRQHandler().

◆ EXINT_LINE_17

#define EXINT_LINE_17 ((uint32_t)0x020000)

external interrupt line 17 connected to the rtc alarm event

Definition at line 68 of file at32f413_exint.h.

Referenced by rtc_config(), and RTCAlarm_IRQHandler().

◆ EXINT_LINE_18

#define EXINT_LINE_18 ((uint32_t)0x040000)

external interrupt line 18 connected to the usb fs wakeup from suspend event

Definition at line 69 of file at32f413_exint.h.

◆ EXINT_LINE_2

#define EXINT_LINE_2 ((uint32_t)0x000004)

external interrupt line 2

Definition at line 53 of file at32f413_exint.h.

◆ EXINT_LINE_3

#define EXINT_LINE_3 ((uint32_t)0x000008)

external interrupt line 3

Definition at line 54 of file at32f413_exint.h.

◆ EXINT_LINE_4

#define EXINT_LINE_4 ((uint32_t)0x000010)

external interrupt line 4

Definition at line 55 of file at32f413_exint.h.

Referenced by EXINT4_IRQHandler(), exint_line4_config(), and TMR1_OVF_TMR10_IRQHandler().

◆ EXINT_LINE_5

#define EXINT_LINE_5 ((uint32_t)0x000020)

external interrupt line 5

Definition at line 56 of file at32f413_exint.h.

◆ EXINT_LINE_6

#define EXINT_LINE_6 ((uint32_t)0x000040)

external interrupt line 6

Definition at line 57 of file at32f413_exint.h.

◆ EXINT_LINE_7

#define EXINT_LINE_7 ((uint32_t)0x000080)

external interrupt line 7

Definition at line 58 of file at32f413_exint.h.

◆ EXINT_LINE_8

#define EXINT_LINE_8 ((uint32_t)0x000100)

external interrupt line 8

Definition at line 59 of file at32f413_exint.h.

◆ EXINT_LINE_9

#define EXINT_LINE_9 ((uint32_t)0x000200)

external interrupt line 9

Definition at line 60 of file at32f413_exint.h.

◆ EXINT_LINE_NONE

#define EXINT_LINE_NONE ((uint32_t)0x000000)

Definition at line 50 of file at32f413_exint.h.

Referenced by exint_default_para_init().


AT32F413 Firmwary Library: EXINT_exported_types

Data Structures | Enumerations
EXINT_exported_types
AT32F413_periph_driver » EXINT

Data Structures

struct | exint_init_type
exint init type More...
struct | exint_type
type define exint register all More...

Enumerations

enum | exint_line_mode_type { EXINT_LINE_INTERRUPUT = 0x00 , EXINT_LINE_INTERRUPT = 0x00 , EXINT_LINE_EVENT = 0x01 }
exint line mode type More...
enum | exint_polarity_config_type { EXINT_TRIGGER_RISING_EDGE = 0x00 , EXINT_TRIGGER_FALLING_EDGE = 0x01 , EXINT_TRIGGER_BOTH_EDGE = 0x02 }
exint polarity configuration type More...

Detailed Description

Enumeration Type Documentation

◆ exint_line_mode_type

enum exint_line_mode_type

exint line mode type

Enumerator
EXINT_LINE_INTERRUPUT | external interrupt line interrupt mode
EXINT_LINE_INTERRUPT | same as EXINT_LINE_INTERRUPUT, fixed spelling error
EXINT_LINE_EVENT | external interrupt line event mode

Definition at line 81 of file at32f413_exint.h.

◆ exint_polarity_config_type

enum exint_polarity_config_type

exint polarity configuration type

Enumerator
EXINT_TRIGGER_RISING_EDGE | external interrupt line rising trigger mode
EXINT_TRIGGER_FALLING_EDGE | external interrupt line falling trigger mode
EXINT_TRIGGER_BOTH_EDGE | external interrupt line both rising and falling trigger mode

Definition at line 91 of file at32f413_exint.h.


AT32F413 Firmwary Library: exint_init_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
exint_init_type Struct Reference
AT32F413_periph_driver » EXINT » EXINT_exported_types

exint init type More...

#include <at32f413_exint.h>

Data Fields

exint_line_mode_type line_mode
uint32_t line_select
exint_polarity_config_type line_polarity
confirm_state line_enable

Detailed Description

exint init type

Definition at line 101 of file at32f413_exint.h.

Field Documentation

◆ line_enable

confirm_state exint_init_type::line_enable

enable or disable exint

Definition at line 106 of file at32f413_exint.h.

Referenced by button_exint_init(), exint_config(), exint_default_para_init(), exint_init(), exint_line0_config(), exint_line4_config(), pvm_exint_config(), rtc_config(), and usart_configuration().

◆ line_mode

exint_line_mode_type exint_init_type::line_mode

choose mode event or interrupt mode

Definition at line 103 of file at32f413_exint.h.

Referenced by button_exint_init(), exint_config(), exint_default_para_init(), exint_init(), exint_line0_config(), exint_line4_config(), pvm_exint_config(), rtc_config(), and usart_configuration().

◆ line_polarity

exint_polarity_config_type exint_init_type::line_polarity

select the tregger polarity, with rising edge, falling edge or both edge

Definition at line 105 of file at32f413_exint.h.

Referenced by button_exint_init(), exint_config(), exint_default_para_init(), exint_init(), exint_line0_config(), exint_line4_config(), pvm_exint_config(), rtc_config(), and usart_configuration().

◆ line_select

uint32_t exint_init_type::line_select

select the exint line, availiable for single line or multiple lines

Definition at line 104 of file at32f413_exint.h.

Referenced by button_exint_init(), exint_config(), exint_default_para_init(), exint_init(), exint_line0_config(), exint_line4_config(), pvm_exint_config(), rtc_config(), and usart_configuration().

The documentation for this struct was generated from the following file:
  • at32f413_exint.h


AT32F413 Firmwary Library: exint_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
exint_type Struct Reference
AT32F413_periph_driver » EXINT » EXINT_exported_types

type define exint register all More...

#include <at32f413_exint.h>

Data Fields

union {
__IO uint32_t inten
struct {
__IO uint32_t intenx: 23
__IO uint32_t reserved1: 9
} inten_bit
};
exint inten register, offset:0x00
union {
__IO uint32_t evten
struct {
__IO uint32_t evtenx: 23
__IO uint32_t reserved1: 9
} evten_bit
};
exint evten register, offset:0x04
union {
__IO uint32_t polcfg1
struct {
__IO uint32_t rpx: 23
__IO uint32_t reserved1: 9
} polcfg1_bit
};
exint polcfg1 register, offset:0x08
union {
__IO uint32_t polcfg2
struct {
__IO uint32_t fpx: 23
__IO uint32_t reserved1: 9
} polcfg2_bit
};
exint polcfg2 register, offset:0x0C
union {
__IO uint32_t swtrg
struct {
__IO uint32_t swtx: 23
__IO uint32_t reserved1: 9
} swtrg_bit
};
exint swtrg register, offset:0x10
union {
__IO uint32_t intsts
struct {
__IO uint32_t linex: 23
__IO uint32_t reserved1: 9
} intsts_bit
};
exint intsts register, offset:0x14

Detailed Description

type define exint register all

Definition at line 112 of file at32f413_exint.h.

Field Documentation

◆ [union]

union { ... } exint_type

exint inten register, offset:0x00

◆ [union]

union { ... } exint_type

exint evten register, offset:0x04

◆ [union]

union { ... } exint_type

exint polcfg1 register, offset:0x08

◆ [union]

union { ... } exint_type

exint polcfg2 register, offset:0x0C

◆ [union]

union { ... } exint_type

exint swtrg register, offset:0x10

◆ [union]

union { ... } exint_type

exint intsts register, offset:0x14

◆ evten

__IO uint32_t exint_type::evten

Definition at line 133 of file at32f413_exint.h.

◆ [struct]

struct { ... } exint_type::evten_bit

◆ evtenx

__IO uint32_t exint_type::evtenx

Definition at line 136 of file at32f413_exint.h.

◆ fpx

__IO uint32_t exint_type::fpx

Definition at line 162 of file at32f413_exint.h.

◆ inten

__IO uint32_t exint_type::inten

Definition at line 120 of file at32f413_exint.h.

◆ [struct]

struct { ... } exint_type::inten_bit

◆ intenx

__IO uint32_t exint_type::intenx

Definition at line 123 of file at32f413_exint.h.

◆ intsts

__IO uint32_t exint_type::intsts

Definition at line 185 of file at32f413_exint.h.

◆ [struct]

struct { ... } exint_type::intsts_bit

◆ linex

__IO uint32_t exint_type::linex

Definition at line 188 of file at32f413_exint.h.

◆ polcfg1

__IO uint32_t exint_type::polcfg1

Definition at line 146 of file at32f413_exint.h.

◆ [struct]

struct { ... } exint_type::polcfg1_bit

◆ polcfg2

__IO uint32_t exint_type::polcfg2

Definition at line 159 of file at32f413_exint.h.

◆ [struct]

struct { ... } exint_type::polcfg2_bit

◆ reserved1

__IO uint32_t exint_type::reserved1

Definition at line 124 of file at32f413_exint.h.

◆ rpx

__IO uint32_t exint_type::rpx

Definition at line 149 of file at32f413_exint.h.

◆ swtrg

__IO uint32_t exint_type::swtrg

Definition at line 172 of file at32f413_exint.h.

◆ [struct]

struct { ... } exint_type::swtrg_bit

◆ swtx

__IO uint32_t exint_type::swtx

Definition at line 175 of file at32f413_exint.h.

The documentation for this struct was generated from the following file:
  • at32f413_exint.h


AT32F413 Firmwary Library: EXINT_exported_functions

Functions
EXINT_exported_functions
AT32F413_periph_driver » EXINT

Functions

void | exint_reset (void)
exint reset
void | exint_default_para_init (exint_init_type *exint_struct)
exint default para init
void | exint_init (exint_init_type *exint_struct)
exint init
void | exint_flag_clear (uint32_t exint_line)
clear exint flag
flag_status | exint_flag_get (uint32_t exint_line)
get exint flag
flag_status | exint_interrupt_flag_get (uint32_t exint_line)
get exint interrupt flag
void | exint_software_interrupt_event_generate (uint32_t exint_line)
generate exint software interrupt event
void | exint_interrupt_enable (uint32_t exint_line, confirm_state new_state)
enable or disable exint interrupt
void | exint_event_enable (uint32_t exint_line, confirm_state new_state)
enable or disable exint event

Detailed Description

Function Documentation

◆ exint_default_para_init()

void exint_default_para_init ( exint_init_type * exint_struct )

exint default para init

Parameters
exint_struct
  • to the structure of exint_init_type
Return values
none

Definition at line 63 of file at32f413_exint.c.

Referenced by button_exint_init(), exint_config(), exint_line0_config(), exint_line4_config(), and usart_configuration().

◆ exint_event_enable()

void exint_event_enable | ( | uint32_t | exint_line,
 |  | confirm_state | new_state )

enable or disable exint event

Parameters
exint_line this parameter can be any combination of the following values:
  • EXINT_LINE_0
  • EXINT_LINE_1 ...
  • EXINT_LINE_17
  • EXINT_LINE_18
new_state new state of exint event. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 240 of file at32f413_exint.c.

◆ exint_flag_clear()

void exint_flag_clear ( uint32_t exint_line )

clear exint flag

Parameters
exint_line this parameter can be any combination of the following values:
  • EXINT_LINE_0
  • EXINT_LINE_1 ...
  • EXINT_LINE_17
  • EXINT_LINE_18
Return values
none

Definition at line 125 of file at32f413_exint.c.

Referenced by button_isr(), EXINT0_IRQHandler(), EXINT4_IRQHandler(), EXINT9_5_IRQHandler(), main(), PVM_IRQHandler(), RTCAlarm_IRQHandler(), and usart_configuration().

◆ exint_flag_get()

flag_status exint_flag_get ( uint32_t exint_line )

get exint flag

Parameters
exint_line this parameter can be one of the following values:
  • EXINT_LINE_0
  • EXINT_LINE_1 ...
  • EXINT_LINE_17
  • EXINT_LINE_18
Return values
the new state of exint flag(SET or RESET).

Definition at line 141 of file at32f413_exint.c.

Referenced by main().

◆ exint_init()

void exint_init ( exint_init_type * exint_struct )

exint init

Parameters
exint_struct
  • to the structure of exint_init_type
Return values
none

Definition at line 77 of file at32f413_exint.c.

Referenced by button_exint_init(), exint_config(), exint_line0_config(), exint_line4_config(), pvm_exint_config(), rtc_config(), and usart_configuration().

◆ exint_interrupt_enable()

void exint_interrupt_enable | ( | uint32_t | exint_line,
 |  | confirm_state | new_state )

enable or disable exint interrupt

Parameters
exint_line this parameter can be any combination of the following values:
  • EXINT_LINE_0
  • EXINT_LINE_1 ...
  • EXINT_LINE_17
  • EXINT_LINE_18
new_state new state of exint interrupt. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 215 of file at32f413_exint.c.

◆ exint_interrupt_flag_get()

flag_status exint_interrupt_flag_get ( uint32_t exint_line )

get exint interrupt flag

Parameters
exint_line this parameter can be one of the following values:
  • EXINT_LINE_0
  • EXINT_LINE_1 ...
  • EXINT_LINE_17
  • EXINT_LINE_18
Return values
the new state of exint flag(SET or RESET).

Definition at line 168 of file at32f413_exint.c.

Referenced by EXINT0_IRQHandler(), EXINT4_IRQHandler(), and PVM_IRQHandler().

◆ exint_reset()

void exint_reset ( void )

exint reset

Parameters
none
Return values
none

Definition at line 48 of file at32f413_exint.c.

◆ exint_software_interrupt_event_generate()

void exint_software_interrupt_event_generate ( uint32_t exint_line )

generate exint software interrupt event

Parameters
exint_line this parameter can be one of the following values:
  • EXINT_LINE_0
  • EXINT_LINE_1 ...
  • EXINT_LINE_17
  • EXINT_LINE_18
Return values
none

Definition at line 197 of file at32f413_exint.c.

Referenced by TMR1_OVF_TMR10_IRQHandler().


AT32F413 Firmwary Library: EXINT_private_functions

Functions
EXINT_private_functions
AT32F413_periph_driver » EXINT

Functions

void | exint_reset (void)
exint reset
void | exint_default_para_init (exint_init_type *exint_struct)
exint default para init
void | exint_init (exint_init_type *exint_struct)
exint init
void | exint_flag_clear (uint32_t exint_line)
clear exint flag
flag_status | exint_flag_get (uint32_t exint_line)
get exint flag
flag_status | exint_interrupt_flag_get (uint32_t exint_line)
get exint interrupt flag
void | exint_software_interrupt_event_generate (uint32_t exint_line)
generate exint software interrupt event
void | exint_interrupt_enable (uint32_t exint_line, confirm_state new_state)
enable or disable exint interrupt
void | exint_event_enable (uint32_t exint_line, confirm_state new_state)
enable or disable exint event

Detailed Description

Function Documentation

◆ exint_default_para_init()

void exint_default_para_init ( exint_init_type * exint_struct )

exint default para init

Parameters
exint_struct
  • to the structure of exint_init_type
Return values
none

Definition at line 63 of file at32f413_exint.c.

Referenced by button_exint_init(), exint_config(), exint_line0_config(), exint_line4_config(), and usart_configuration().

◆ exint_event_enable()

void exint_event_enable | ( | uint32_t | exint_line,
 |  | confirm_state | new_state )

enable or disable exint event

Parameters
exint_line this parameter can be any combination of the following values:
  • EXINT_LINE_0
  • EXINT_LINE_1 ...
  • EXINT_LINE_17
  • EXINT_LINE_18
new_state new state of exint event. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 240 of file at32f413_exint.c.

◆ exint_flag_clear()

void exint_flag_clear ( uint32_t exint_line )

clear exint flag

Parameters
exint_line this parameter can be any combination of the following values:
  • EXINT_LINE_0
  • EXINT_LINE_1 ...
  • EXINT_LINE_17
  • EXINT_LINE_18
Return values
none

Definition at line 125 of file at32f413_exint.c.

Referenced by button_isr(), EXINT0_IRQHandler(), EXINT4_IRQHandler(), EXINT9_5_IRQHandler(), main(), PVM_IRQHandler(), RTCAlarm_IRQHandler(), and usart_configuration().

◆ exint_flag_get()

flag_status exint_flag_get ( uint32_t exint_line )

get exint flag

Parameters
exint_line this parameter can be one of the following values:
  • EXINT_LINE_0
  • EXINT_LINE_1 ...
  • EXINT_LINE_17
  • EXINT_LINE_18
Return values
the new state of exint flag(SET or RESET).

Definition at line 141 of file at32f413_exint.c.

Referenced by main().

◆ exint_init()

void exint_init ( exint_init_type * exint_struct )

exint init

Parameters
exint_struct
  • to the structure of exint_init_type
Return values
none

Definition at line 77 of file at32f413_exint.c.

Referenced by button_exint_init(), exint_config(), exint_line0_config(), exint_line4_config(), pvm_exint_config(), rtc_config(), and usart_configuration().

◆ exint_interrupt_enable()

void exint_interrupt_enable | ( | uint32_t | exint_line,
 |  | confirm_state | new_state )

enable or disable exint interrupt

Parameters
exint_line this parameter can be any combination of the following values:
  • EXINT_LINE_0
  • EXINT_LINE_1 ...
  • EXINT_LINE_17
  • EXINT_LINE_18
new_state new state of exint interrupt. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 215 of file at32f413_exint.c.

◆ exint_interrupt_flag_get()

flag_status exint_interrupt_flag_get ( uint32_t exint_line )

get exint interrupt flag

Parameters
exint_line this parameter can be one of the following values:
  • EXINT_LINE_0
  • EXINT_LINE_1 ...
  • EXINT_LINE_17
  • EXINT_LINE_18
Return values
the new state of exint flag(SET or RESET).

Definition at line 168 of file at32f413_exint.c.

Referenced by EXINT0_IRQHandler(), EXINT4_IRQHandler(), and PVM_IRQHandler().

◆ exint_reset()

void exint_reset ( void )

exint reset

Parameters
none
Return values
none

Definition at line 48 of file at32f413_exint.c.

◆ exint_software_interrupt_event_generate()

void exint_software_interrupt_event_generate ( uint32_t exint_line )

generate exint software interrupt event

Parameters
exint_line this parameter can be one of the following values:
  • EXINT_LINE_0
  • EXINT_LINE_1 ...
  • EXINT_LINE_17
  • EXINT_LINE_18
Return values
none

Definition at line 197 of file at32f413_exint.c.

Referenced by TMR1_OVF_TMR10_IRQHandler().


AT32F413 Firmwary Library: FLASH

Topics | Macros
FLASH
AT32F413_periph_driver

FLASH driver modules. More...

Topics

FLASH_unlock_keys
flash unlock keys
FLASH_spim_address
flash spim address
FLASH_flags
flash flag
FLASH_interrupts
flash interrupts
FLASH_slib_mask
flash slib mask
FLASH_user_system_data
flash user system data
FLASH_timeout_definition
flash timeout definition
FLASH_exported_types
FLASH_exported_functions
FLASH_private_functions

Macros

#define | FLASH ((flash_type *) FLASH_REG_BASE)
#define | USD ((usd_type *) USD_BASE)

Detailed Description

FLASH driver modules.

Macro Definition Documentation

◆ FLASH

#define FLASH ((flash_type *) FLASH_REG_BASE)

Definition at line 563 of file at32f413_flash.h.

Referenced by flash_byte_program(), flash_crc_calibrate(), flash_epp_set(), flash_epp_status_get(), flash_fap_enable(), flash_fap_status_get(), flash_flag_clear(), flash_flag_get(), flash_halfword_program(), flash_internal_all_erase(), flash_interrupt_enable(), flash_lock(), flash_operation_status_get(), flash_sector_erase(), flash_slib_datastart_sector_get(), flash_slib_disable(), flash_slib_enable(), flash_slib_end_sector_get(), flash_slib_remaining_count_get(), flash_slib_start_sector_get(), flash_slib_state_get(), flash_spim_all_erase(), flash_spim_encryption_range_set(), flash_spim_lock(), flash_spim_mass_program(), flash_spim_model_select(), flash_spim_operation_status_get(), flash_spim_unlock(), flash_ssb_set(), flash_ssb_status_get(), flash_unlock(), flash_user_system_data_erase(), flash_user_system_data_program(), flash_word_program(), and spim_init().

◆ USD

#define USD ((usd_type *) USD_BASE)

Definition at line 564 of file at32f413_flash.h.

Referenced by flash_epp_set(), flash_fap_enable(), flash_ssb_set(), and flash_user_system_data_erase().


AT32F413 Firmwary Library: FLASH_unlock_keys

Macros
FLASH_unlock_keys
AT32F413_periph_driver » FLASH

flash unlock keys More...

Macros

#define | FLASH_UNLOCK_KEY1 ((uint32_t)0x45670123)
#define | FLASH_UNLOCK_KEY2 ((uint32_t)0xCDEF89AB)
#define | FAP_RELIEVE_KEY ((uint16_t)0x00A5)
#define | SLIB_UNLOCK_KEY ((uint32_t)0xA35F6D24)

Detailed Description

flash unlock keys

Macro Definition Documentation

◆ FAP_RELIEVE_KEY

#define FAP_RELIEVE_KEY ((uint16_t)0x00A5)

flash fap relieve key val

Definition at line 54 of file at32f413_flash.h.

Referenced by flash_fap_enable(), and flash_user_system_data_erase().

◆ FLASH_UNLOCK_KEY1

#define FLASH_UNLOCK_KEY1 ((uint32_t)0x45670123)

flash operation unlock order key1

Definition at line 52 of file at32f413_flash.h.

Referenced by flash_epp_set(), flash_fap_enable(), flash_spim_unlock(), flash_ssb_set(), flash_unlock(), flash_user_system_data_erase(), and flash_user_system_data_program().

◆ FLASH_UNLOCK_KEY2

#define FLASH_UNLOCK_KEY2 ((uint32_t)0xCDEF89AB)

flash operation unlock order key2

Definition at line 53 of file at32f413_flash.h.

Referenced by flash_epp_set(), flash_fap_enable(), flash_spim_unlock(), flash_ssb_set(), flash_unlock(), flash_user_system_data_erase(), and flash_user_system_data_program().

◆ SLIB_UNLOCK_KEY

#define SLIB_UNLOCK_KEY ((uint32_t)0xA35F6D24)

flash slib operation unlock order key

Definition at line 55 of file at32f413_flash.h.

Referenced by flash_slib_enable().


AT32F413 Firmwary Library: FLASH_spim_address

Macros
FLASH_spim_address
AT32F413_periph_driver » FLASH

flash spim address More...

Macros

#define FLASH_SPIM_START_ADDR ((uint32_t)0x08400000)

Detailed Description

flash spim address

Macro Definition Documentation

◆ FLASH_SPIM_START_ADDR

#define FLASH_SPIM_START_ADDR ((uint32_t)0x08400000)

flash start address of spim

Definition at line 65 of file at32f413_flash.h.

Referenced by flash_halfword_program(), flash_sector_erase(), flash_spim_dummy_read(), flash_spim_mass_program(), and flash_word_program().


AT32F413 Firmwary Library: FLASH_flags

Macros
FLASH_flags
AT32F413_periph_driver » FLASH

flash flag More...

Macros

#define | FLASH_OBF_FLAG ((uint32_t)0x00000001)
#define | FLASH_ODF_FLAG ((uint32_t)0x00000020)
#define | FLASH_PRGMERR_FLAG ((uint32_t)0x00000004)
#define | FLASH_EPPERR_FLAG ((uint32_t)0x00000010)
#define | FLASH_SPIM_OBF_FLAG ((uint32_t)0x20000001)
#define | FLASH_SPIM_ODF_FLAG ((uint32_t)0x20000020)
#define | FLASH_SPIM_PRGMERR_FLAG ((uint32_t)0x20000004)
#define | FLASH_SPIM_EPPERR_FLAG ((uint32_t)0x20000010)
#define | FLASH_USDERR_FLAG ((uint32_t)0x40000001)

Detailed Description

flash flag

Macro Definition Documentation

◆ FLASH_EPPERR_FLAG

#define FLASH_EPPERR_FLAG ((uint32_t)0x00000010)

flash bank1 erase/program protection error flag

Definition at line 79 of file at32f413_flash.h.

Referenced by FLASH_IRQHandler(), flash_write(), and spim_operate().

◆ FLASH_OBF_FLAG

#define FLASH_OBF_FLAG ((uint32_t)0x00000001)

flash bank1 operate busy flag

Definition at line 76 of file at32f413_flash.h.

◆ FLASH_ODF_FLAG

#define FLASH_ODF_FLAG ((uint32_t)0x00000020)

flash bank1 operate done flag

Definition at line 77 of file at32f413_flash.h.

◆ FLASH_PRGMERR_FLAG

#define FLASH_PRGMERR_FLAG ((uint32_t)0x00000004)

flash bank1 program error flag

Definition at line 78 of file at32f413_flash.h.

Referenced by flash_write(), and spim_operate().

◆ FLASH_SPIM_EPPERR_FLAG

#define FLASH_SPIM_EPPERR_FLAG ((uint32_t)0x20000010)

flash spim erase/program protection error flag

Definition at line 83 of file at32f413_flash.h.

◆ FLASH_SPIM_OBF_FLAG

#define FLASH_SPIM_OBF_FLAG ((uint32_t)0x20000001)

flash spim operate busy flag

Definition at line 80 of file at32f413_flash.h.

Referenced by spim_init().

◆ FLASH_SPIM_ODF_FLAG

#define FLASH_SPIM_ODF_FLAG ((uint32_t)0x20000020)

flash spim operate done flag

Definition at line 81 of file at32f413_flash.h.

◆ FLASH_SPIM_PRGMERR_FLAG

#define FLASH_SPIM_PRGMERR_FLAG ((uint32_t)0x20000004)

flash spim program error flag

Definition at line 82 of file at32f413_flash.h.

◆ FLASH_USDERR_FLAG

#define FLASH_USDERR_FLAG ((uint32_t)0x40000001)

flash user system data error flag

Definition at line 84 of file at32f413_flash.h.


AT32F413 Firmwary Library: FLASH_interrupts

Macros
FLASH_interrupts
AT32F413_periph_driver » FLASH

flash interrupts More...

Macros

#define | FLASH_ERR_INT ((uint32_t)0x00000001)
#define | FLASH_ODF_INT ((uint32_t)0x00000002)
#define | FLASH_SPIM_ERR_INT ((uint32_t)0x00000010)
#define | FLASH_SPIM_ODF_INT ((uint32_t)0x00000020)

Detailed Description

flash interrupts

Macro Definition Documentation

◆ FLASH_ERR_INT

#define FLASH_ERR_INT ((uint32_t)0x00000001)

flash bank1 error interrupt

Definition at line 95 of file at32f413_flash.h.

Referenced by config_flash_interrupt(), and flash_interrupt_enable().

◆ FLASH_ODF_INT

#define FLASH_ODF_INT ((uint32_t)0x00000002)

flash bank1 operate done interrupt

Definition at line 96 of file at32f413_flash.h.

Referenced by flash_interrupt_enable().

◆ FLASH_SPIM_ERR_INT

#define FLASH_SPIM_ERR_INT ((uint32_t)0x00000010)

flash spim error interrupt

Definition at line 97 of file at32f413_flash.h.

Referenced by flash_interrupt_enable().

◆ FLASH_SPIM_ODF_INT

#define FLASH_SPIM_ODF_INT ((uint32_t)0x00000020)

flash spim operate done interrupt

Definition at line 98 of file at32f413_flash.h.

Referenced by flash_interrupt_enable().


AT32F413 Firmwary Library: FLASH_slib_mask

Macros
FLASH_slib_mask
AT32F413_periph_driver » FLASH

flash slib mask More...

Macros

#define | FLASH_SLIB_START_SECTOR ((uint32_t)0x000007FF)
#define | FLASH_SLIB_DATA_START_SECTOR ((uint32_t)0x003FF800)
#define | FLASH_SLIB_END_SECTOR ((uint32_t)0xFFC00000)

Detailed Description

flash slib mask

Macro Definition Documentation

◆ FLASH_SLIB_DATA_START_SECTOR

#define FLASH_SLIB_DATA_START_SECTOR ((uint32_t)0x003FF800)

flash slib d-bus area start sector

Definition at line 110 of file at32f413_flash.h.

Referenced by flash_slib_enable().

◆ FLASH_SLIB_END_SECTOR

#define FLASH_SLIB_END_SECTOR ((uint32_t)0xFFC00000)

flash slib end sector

Definition at line 111 of file at32f413_flash.h.

Referenced by flash_slib_enable().

◆ FLASH_SLIB_START_SECTOR

#define FLASH_SLIB_START_SECTOR ((uint32_t)0x000007FF)

flash slib start sector

Definition at line 109 of file at32f413_flash.h.

Referenced by flash_slib_enable().


AT32F413 Firmwary Library: FLASH_user_system_data

Macros
FLASH_user_system_data
AT32F413_periph_driver » FLASH

flash user system data More...

Macros

#define | USD_WDT_ATO_DISABLE ((uint16_t)0x0001)
#define | USD_WDT_ATO_ENABLE ((uint16_t)0x0000)
#define | USD_DEPSLP_NO_RST ((uint16_t)0x0002)
#define | USD_DEPSLP_RST ((uint16_t)0x0000)
#define | USD_STDBY_NO_RST ((uint16_t)0x0004)
#define | USD_STDBY_RST ((uint16_t)0x0000)

Detailed Description

flash user system data

Macro Definition Documentation

◆ USD_DEPSLP_NO_RST

#define USD_DEPSLP_NO_RST ((uint16_t)0x0002)

no reset generated when entering in deepsleep

Definition at line 125 of file at32f413_flash.h.

◆ USD_DEPSLP_RST

#define USD_DEPSLP_RST ((uint16_t)0x0000)

reset generated when entering in deepsleep

Definition at line 126 of file at32f413_flash.h.

◆ USD_STDBY_NO_RST

#define USD_STDBY_NO_RST ((uint16_t)0x0004)

no reset generated when entering in standby

Definition at line 128 of file at32f413_flash.h.

◆ USD_STDBY_RST

#define USD_STDBY_RST ((uint16_t)0x0000)

reset generated when entering in standby

Definition at line 129 of file at32f413_flash.h.

◆ USD_WDT_ATO_DISABLE

#define USD_WDT_ATO_DISABLE ((uint16_t)0x0001)

wdt auto start disabled

Definition at line 122 of file at32f413_flash.h.

◆ USD_WDT_ATO_ENABLE

#define USD_WDT_ATO_ENABLE ((uint16_t)0x0000)

wdt auto start enabled

Definition at line 123 of file at32f413_flash.h.


AT32F413 Firmwary Library: FLASH_timeout_definition

Macros
FLASH_timeout_definition
AT32F413_periph_driver » FLASH

flash timeout definition More...

Macros

#define | ERASE_TIMEOUT ((uint32_t)0x40000000)
#define | PROGRAMMING_TIMEOUT ((uint32_t)0x00100000)
#define | SPIM_ERASE_TIMEOUT ((uint32_t)0xFFFFFFFF)
#define | SPIM_PROGRAMMING_TIMEOUT ((uint32_t)0x00100000)
#define | OPERATION_TIMEOUT ((uint32_t)0x10000000)

Detailed Description

flash timeout definition

Macro Definition Documentation

◆ ERASE_TIMEOUT

#define ERASE_TIMEOUT ((uint32_t)0x40000000)

internal flash erase operation timeout

Definition at line 140 of file at32f413_flash.h.

Referenced by flash_fap_enable(), flash_internal_all_erase(), flash_sector_erase(), flash_slib_disable(), flash_user_system_data_erase(), flash_write(), and spim_operate().

◆ OPERATION_TIMEOUT

#define OPERATION_TIMEOUT ((uint32_t)0x10000000)

flash common operation timeout

Definition at line 144 of file at32f413_flash.h.

Referenced by flash_crc_calibrate().

◆ PROGRAMMING_TIMEOUT

#define PROGRAMMING_TIMEOUT ((uint32_t)0x00100000)

internal flash program operation timeout

Definition at line 141 of file at32f413_flash.h.

Referenced by flash_byte_program(), flash_epp_set(), flash_halfword_program(), flash_slib_enable(), flash_ssb_set(), flash_user_system_data_erase(), flash_user_system_data_program(), and flash_word_program().

◆ SPIM_ERASE_TIMEOUT

#define SPIM_ERASE_TIMEOUT ((uint32_t)0xFFFFFFFF)

spim erase operation timeout

Definition at line 142 of file at32f413_flash.h.

Referenced by flash_sector_erase(), and flash_spim_all_erase().

◆ SPIM_PROGRAMMING_TIMEOUT

#define SPIM_PROGRAMMING_TIMEOUT ((uint32_t)0x00100000)

spim program operation timeout

Definition at line 143 of file at32f413_flash.h.

Referenced by flash_halfword_program(), flash_spim_mass_program(), and flash_word_program().


AT32F413 Firmwary Library: FLASH_exported_types

Data Structures | Enumerations
FLASH_exported_types
AT32F413_periph_driver » FLASH

Data Structures

struct | flash_type
type define flash register all More...
struct | usd_type
user system data More...

Enumerations

enum flash_status_type {
FLASH_OPERATE_BUSY = 0x00 , FLASH_PROGRAM_ERROR = 0x01 , FLASH_EPP_ERROR = 0x02 , FLASH_OPERATE_DONE = 0x03 ,
FLASH_OPERATE_TIMEOUT = 0x04
}
flash status type More...
enum flash_spim_model_type { FLASH_SPIM_MODEL1 = 0x01 , FLASH_SPIM_MODEL2 = 0x02 }
flash spim model type More...

Detailed Description

Enumeration Type Documentation

◆ flash_spim_model_type

enum flash_spim_model_type

flash spim model type

Enumerator
FLASH_SPIM_MODEL1 | spim model 1
FLASH_SPIM_MODEL2 | spim model 2

Definition at line 169 of file at32f413_flash.h.

◆ flash_status_type

enum flash_status_type

flash status type

Enumerator
FLASH_OPERATE_BUSY | flash status is operate busy
FLASH_PROGRAM_ERROR | flash status is program error
FLASH_EPP_ERROR | flash status is epp error
FLASH_OPERATE_DONE | flash status is operate done
FLASH_OPERATE_TIMEOUT | flash status is operate timeout

Definition at line 157 of file at32f413_flash.h.


AT32F413 Firmwary Library: flash_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
flash_type Struct Reference
AT32F413_periph_driver » FLASH » FLASH_exported_types

type define flash register all More...

#include <at32f413_flash.h>

Data Fields

union {
__IO uint32_t psr
struct {
__IO uint32_t reserved1: 32
} psr_bit
};
flash psr register, offset:0x00
union {
__IO uint32_t unlock
struct {
__IO uint32_t ukval: 32
} unlock_bit
};
flash unlock register, offset:0x04
union {
__IO uint32_t usd_unlock
struct {
__IO uint32_t usd_ukval: 32
} usd_unlock_bit
};
flash usd unlock register, offset:0x08
union {
__IO uint32_t sts
struct {
__IO uint32_t obf: 1
__IO uint32_t reserved1: 1
__IO uint32_t prgmerr: 1
__IO uint32_t reserved2: 1
__IO uint32_t epperr: 1
__IO uint32_t odf: 1
__IO uint32_t reserved3: 26
} sts_bit
};
flash sts register, offset:0x0C
union {
__IO uint32_t ctrl
struct {
__IO uint32_t fprgm: 1
__IO uint32_t secers: 1
__IO uint32_t bankers: 1
__IO uint32_t reserved1: 1
__IO uint32_t usdprgm: 1
__IO uint32_t usders: 1
__IO uint32_t erstr: 1
__IO uint32_t oplk: 1
__IO uint32_t reserved2: 1
__IO uint32_t usdulks: 1
__IO uint32_t errie: 1
__IO uint32_t reserved3: 1
__IO uint32_t odfie: 1
__IO uint32_t reserved4: 19
} ctrl_bit
};
flash ctrl register, offset:0x10
union {
__IO uint32_t addr
struct {
__IO uint32_t fa: 32
} addr_bit
};
flash addr register, offset:0x14
union {
__IO uint32_t usd
struct {
__IO uint32_t usderr: 1
__IO uint32_t fap: 1
__IO uint32_t wdt_ato_en: 1
__IO uint32_t depslp_rst: 1
__IO uint32_t stdby_rst: 1
__IO uint32_t reserved1: 5
__IO uint32_t user_d0: 8
__IO uint32_t user_d1: 8
__IO uint32_t reserved2: 6
} usd_bit
};
flash usd register, offset:0x1C
union {
__IO uint32_t epps
struct {
__IO uint32_t epps: 32
} epps_bit
};
flash epps register, offset:0x20
union {
__IO uint32_t unlock3
struct {
__IO uint32_t ukval: 32
} unlock3_bit
};
flash unlock3 register, offset:0x84
union {
__IO uint32_t select
struct {
__IO uint32_t select: 32
} select_bit
};
flash select register, offset:0x88
union {
__IO uint32_t sts3
struct {
__IO uint32_t obf: 1
__IO uint32_t reserved1: 1
__IO uint32_t prgmerr: 1
__IO uint32_t reserved2: 1
__IO uint32_t epperr: 1
__IO uint32_t odf: 1
__IO uint32_t reserved3: 26
} sts3_bit
};
flash sts3 register, offset:0x8C
union {
__IO uint32_t ctrl3
struct {
__IO uint32_t fprgm: 1
__IO uint32_t secers: 1
__IO uint32_t chpers: 1
__IO uint32_t reserved1: 3
__IO uint32_t erstr: 1
__IO uint32_t oplk: 1
__IO uint32_t reserved2: 2
__IO uint32_t errie: 1
__IO uint32_t reserved3: 1
__IO uint32_t odfie: 1
__IO uint32_t reserved4: 19
} ctrl3_bit
};
flash ctrl3 register, offset:0x90
union {
__IO uint32_t addr3
struct {
__IO uint32_t fa: 32
} addr3_bit
};
flash addr3 register, offset:0x94
union {
__IO uint32_t da
struct {
__IO uint32_t fda: 32
} da_bit
};
flash da register, offset:0x98
__IO uint32_t | reserved5 [12]
flash reserved5 register, offset:0xC8~0x9C
union {
__IO uint32_t slib_sts0
struct {
__IO uint32_t reserved1: 3
__IO uint32_t slib_enf: 1
__IO uint32_t reserved2: 28
} slib_sts0_bit
};
flash slib_sts0 register, offset:0xCC
union {
__IO uint32_t slib_sts1
struct {
__IO uint32_t slib_ss: 11
__IO uint32_t slib_dat_ss: 11
__IO uint32_t slib_es: 10
} slib_sts1_bit
};
flash slib_sts1 register, offset:0xD0
union {
__IO uint32_t slib_pwd_clr
struct {
__IO uint32_t slib_pclr_val: 32
} slib_pwd_clr_bit
};
flash slib_pwd_clr register, offset:0xD4
union {
__IO uint32_t slib_misc_sts
struct {
__IO uint32_t slib_pwd_err: 1
__IO uint32_t slib_pwd_ok: 1
__IO uint32_t slib_ulkf: 1
__IO uint32_t reserved1: 13
__IO uint32_t slib_rcnt: 9
__IO uint32_t reserved2: 7
} slib_misc_sts_bit
};
flash slib_misc_sts register, offset:0xD8
union {
__IO uint32_t slib_set_pwd
struct {
__IO uint32_t slib_pset_val: 32
} slib_set_pwd_bit
};
flash slib_set_pwd register, offset:0xDC
union {
__IO uint32_t slib_set_range
struct {
__IO uint32_t slib_ss_set: 11
__IO uint32_t slib_dss_set: 11
__IO uint32_t slib_es_set: 10
} slib_set_range_bit
};
flash slib_set_range register, offset:0xE0
__IO uint32_t | reserved6 [3]
flash reserved6 register, offset:0xEC~0xE4
union {
__IO uint32_t slib_unlock
struct {
__IO uint32_t slib_ukval: 32
} slib_unlock_bit
};
flash slib_unlock register, offset:0xF0
union {
__IO uint32_t crc_ctrl
struct {
__IO uint32_t crc_ss: 12
__IO uint32_t crc_sn: 12
__IO uint32_t reserved1: 7
__IO uint32_t crc_strt: 1
} crc_ctrl_bit
};
flash crc_ctrl register, offset:0xF4
union {
__IO uint32_t crc_chkr
struct {
__IO uint32_t crc_chkr: 32
} crc_chkr_bit
};
flash crc_chkr register, offset:0xF8

Detailed Description

type define flash register all

Definition at line 178 of file at32f413_flash.h.

Field Documentation

◆ [union]

union { ... } flash_type

flash psr register, offset:0x00

◆ [union]

union { ... } flash_type

flash unlock register, offset:0x04

◆ [union]

union { ... } flash_type

flash usd unlock register, offset:0x08

◆ [union]

union { ... } flash_type

flash sts register, offset:0x0C

◆ [union]

union { ... } flash_type

flash ctrl register, offset:0x10

◆ [union]

union { ... } flash_type

flash addr register, offset:0x14

◆ [union]

union { ... } flash_type

flash usd register, offset:0x1C

◆ [union]

union { ... } flash_type

flash epps register, offset:0x20

◆ [union]

union { ... } flash_type

flash unlock3 register, offset:0x84

◆ [union]

union { ... } flash_type

flash select register, offset:0x88

◆ [union]

union { ... } flash_type

flash sts3 register, offset:0x8C

◆ [union]

union { ... } flash_type

flash ctrl3 register, offset:0x90

◆ [union]

union { ... } flash_type

flash addr3 register, offset:0x94

◆ [union]

union { ... } flash_type

flash da register, offset:0x98

◆ [union]

union { ... } flash_type

flash slib_sts0 register, offset:0xCC

◆ [union]

union { ... } flash_type

flash slib_sts1 register, offset:0xD0

◆ [union]

union { ... } flash_type

flash slib_pwd_clr register, offset:0xD4

◆ [union]

union { ... } flash_type

flash slib_misc_sts register, offset:0xD8

◆ [union]

union { ... } flash_type

flash slib_set_pwd register, offset:0xDC

◆ [union]

union { ... } flash_type

flash slib_set_range register, offset:0xE0

◆ [union]

union { ... } flash_type

flash slib_unlock register, offset:0xF0

◆ [union]

union { ... } flash_type

flash crc_ctrl register, offset:0xF4

◆ [union]

union { ... } flash_type

flash crc_chkr register, offset:0xF8

◆ addr

__IO uint32_t flash_type::addr

Definition at line 264 of file at32f413_flash.h.

◆ addr3

__IO uint32_t flash_type::addr3

Definition at line 382 of file at32f413_flash.h.

◆ [struct]

struct { ... } flash_type::addr3_bit

◆ [struct]

struct { ... } flash_type::addr_bit

◆ bankers

__IO uint32_t flash_type::bankers

Definition at line 244 of file at32f413_flash.h.

◆ chpers

__IO uint32_t flash_type::chpers

Definition at line 365 of file at32f413_flash.h.

◆ crc_chkr

__IO uint32_t flash_type::crc_chkr

Definition at line 526 of file at32f413_flash.h.

◆ [struct]

struct { ... } flash_type::crc_chkr_bit

◆ crc_ctrl

__IO uint32_t flash_type::crc_ctrl

Definition at line 511 of file at32f413_flash.h.

◆ [struct]

struct { ... } flash_type::crc_ctrl_bit

◆ crc_sn

__IO uint32_t flash_type::crc_sn

Definition at line 515 of file at32f413_flash.h.

◆ crc_ss

__IO uint32_t flash_type::crc_ss

Definition at line 514 of file at32f413_flash.h.

◆ crc_strt

__IO uint32_t flash_type::crc_strt

Definition at line 517 of file at32f413_flash.h.

◆ ctrl

__IO uint32_t flash_type::ctrl

Definition at line 239 of file at32f413_flash.h.

◆ ctrl3

__IO uint32_t flash_type::ctrl3

Definition at line 360 of file at32f413_flash.h.

◆ [struct]

struct { ... } flash_type::ctrl3_bit

◆ [struct]

struct { ... } flash_type::ctrl_bit

◆ da

__IO uint32_t flash_type::da

Definition at line 394 of file at32f413_flash.h.

◆ [struct]

struct { ... } flash_type::da_bit

◆ depslp_rst

__IO uint32_t flash_type::depslp_rst

Definition at line 287 of file at32f413_flash.h.

◆ epperr

__IO uint32_t flash_type::epperr

Definition at line 228 of file at32f413_flash.h.

◆ epps

__IO uint32_t flash_type::epps

Definition at line 301 of file at32f413_flash.h.

◆ [struct]

struct { ... } flash_type::epps_bit

◆ errie

__IO uint32_t flash_type::errie

Definition at line 252 of file at32f413_flash.h.

◆ erstr

__IO uint32_t flash_type::erstr

Definition at line 248 of file at32f413_flash.h.

◆ fa

__IO uint32_t flash_type::fa

Definition at line 267 of file at32f413_flash.h.

◆ fap

__IO uint32_t flash_type::fap

Definition at line 285 of file at32f413_flash.h.

◆ fda

__IO uint32_t flash_type::fda

Definition at line 397 of file at32f413_flash.h.

◆ fprgm

__IO uint32_t flash_type::fprgm

Definition at line 242 of file at32f413_flash.h.

◆ obf

__IO uint32_t flash_type::obf

Definition at line 224 of file at32f413_flash.h.

◆ odf

__IO uint32_t flash_type::odf

Definition at line 229 of file at32f413_flash.h.

◆ odfie

__IO uint32_t flash_type::odfie

Definition at line 254 of file at32f413_flash.h.

◆ oplk

__IO uint32_t flash_type::oplk

Definition at line 249 of file at32f413_flash.h.

◆ prgmerr

__IO uint32_t flash_type::prgmerr

Definition at line 226 of file at32f413_flash.h.

◆ psr

__IO uint32_t flash_type::psr

Definition at line 185 of file at32f413_flash.h.

◆ [struct]

struct { ... } flash_type::psr_bit

◆ reserved1

__IO uint32_t flash_type::reserved1

flash reserved1 register, offset:0x18

Definition at line 188 of file at32f413_flash.h.

◆ reserved2

__IO uint32_t flash_type::reserved2

flash reserved2 register, offset:0x80~0x24

Definition at line 227 of file at32f413_flash.h.

◆ reserved3

__IO uint32_t flash_type::reserved3

Definition at line 230 of file at32f413_flash.h.

◆ reserved4

__IO uint32_t flash_type::reserved4

Definition at line 255 of file at32f413_flash.h.

◆ reserved5

__IO uint32_t flash_type::reserved5[12]

flash reserved5 register, offset:0xC8~0x9C

Definition at line 404 of file at32f413_flash.h.

◆ reserved6

__IO uint32_t flash_type::reserved6[3]

flash reserved6 register, offset:0xEC~0xE4

Definition at line 492 of file at32f413_flash.h.

◆ secers

__IO uint32_t flash_type::secers

Definition at line 243 of file at32f413_flash.h.

◆ select

__IO uint32_t flash_type::select

Definition at line 330 of file at32f413_flash.h.

◆ [struct]

struct { ... } flash_type::select_bit

◆ slib_dat_ss

__IO uint32_t flash_type::slib_dat_ss

Definition at line 429 of file at32f413_flash.h.

◆ slib_dss_set

__IO uint32_t flash_type::slib_dss_set

Definition at line 484 of file at32f413_flash.h.

◆ slib_enf

__IO uint32_t flash_type::slib_enf

Definition at line 415 of file at32f413_flash.h.

◆ slib_es

__IO uint32_t flash_type::slib_es

Definition at line 430 of file at32f413_flash.h.

◆ slib_es_set

__IO uint32_t flash_type::slib_es_set

Definition at line 485 of file at32f413_flash.h.

◆ slib_misc_sts

__IO uint32_t flash_type::slib_misc_sts

Definition at line 451 of file at32f413_flash.h.

◆ [struct]

struct { ... } flash_type::slib_misc_sts_bit

◆ slib_pclr_val

__IO uint32_t flash_type::slib_pclr_val

Definition at line 442 of file at32f413_flash.h.

◆ slib_pset_val

__IO uint32_t flash_type::slib_pset_val

Definition at line 471 of file at32f413_flash.h.

◆ slib_pwd_clr

__IO uint32_t flash_type::slib_pwd_clr

Definition at line 439 of file at32f413_flash.h.

◆ [struct]

struct { ... } flash_type::slib_pwd_clr_bit

◆ slib_pwd_err

__IO uint32_t flash_type::slib_pwd_err

Definition at line 454 of file at32f413_flash.h.

◆ slib_pwd_ok

__IO uint32_t flash_type::slib_pwd_ok

Definition at line 455 of file at32f413_flash.h.

◆ slib_rcnt

__IO uint32_t flash_type::slib_rcnt

Definition at line 458 of file at32f413_flash.h.

◆ slib_set_pwd

__IO uint32_t flash_type::slib_set_pwd

Definition at line 468 of file at32f413_flash.h.

◆ [struct]

struct { ... } flash_type::slib_set_pwd_bit

◆ slib_set_range

__IO uint32_t flash_type::slib_set_range

Definition at line 480 of file at32f413_flash.h.

◆ [struct]

struct { ... } flash_type::slib_set_range_bit

◆ slib_ss

__IO uint32_t flash_type::slib_ss

Definition at line 428 of file at32f413_flash.h.

◆ slib_ss_set

__IO uint32_t flash_type::slib_ss_set

Definition at line 483 of file at32f413_flash.h.

◆ slib_sts0

__IO uint32_t flash_type::slib_sts0

Definition at line 411 of file at32f413_flash.h.

◆ [struct]

struct { ... } flash_type::slib_sts0_bit

◆ slib_sts1

__IO uint32_t flash_type::slib_sts1

Definition at line 425 of file at32f413_flash.h.

◆ [struct]

struct { ... } flash_type::slib_sts1_bit

◆ slib_ukval

__IO uint32_t flash_type::slib_ukval

Definition at line 502 of file at32f413_flash.h.

◆ slib_ulkf

__IO uint32_t flash_type::slib_ulkf

Definition at line 456 of file at32f413_flash.h.

◆ slib_unlock

__IO uint32_t flash_type::slib_unlock

Definition at line 499 of file at32f413_flash.h.

◆ [struct]

struct { ... } flash_type::slib_unlock_bit

◆ stdby_rst

__IO uint32_t flash_type::stdby_rst

Definition at line 288 of file at32f413_flash.h.

◆ sts

__IO uint32_t flash_type::sts

Definition at line 221 of file at32f413_flash.h.

◆ sts3

__IO uint32_t flash_type::sts3

Definition at line 342 of file at32f413_flash.h.

◆ [struct]

struct { ... } flash_type::sts3_bit

◆ [struct]

struct { ... } flash_type::sts_bit

◆ ukval

__IO uint32_t flash_type::ukval

Definition at line 200 of file at32f413_flash.h.

◆ unlock

__IO uint32_t flash_type::unlock

Definition at line 197 of file at32f413_flash.h.

◆ unlock3

__IO uint32_t flash_type::unlock3

Definition at line 318 of file at32f413_flash.h.

◆ [struct]

struct { ... } flash_type::unlock3_bit

◆ [struct]

struct { ... } flash_type::unlock_bit

◆ usd

__IO uint32_t flash_type::usd

Definition at line 281 of file at32f413_flash.h.

◆ [struct]

struct { ... } flash_type::usd_bit

◆ usd_ukval

__IO uint32_t flash_type::usd_ukval

Definition at line 212 of file at32f413_flash.h.

◆ usd_unlock

__IO uint32_t flash_type::usd_unlock

Definition at line 209 of file at32f413_flash.h.

◆ [struct]

struct { ... } flash_type::usd_unlock_bit

◆ usderr

__IO uint32_t flash_type::usderr

Definition at line 284 of file at32f413_flash.h.

◆ usders

__IO uint32_t flash_type::usders

Definition at line 247 of file at32f413_flash.h.

◆ usdprgm

__IO uint32_t flash_type::usdprgm

Definition at line 246 of file at32f413_flash.h.

◆ usdulks

__IO uint32_t flash_type::usdulks

Definition at line 251 of file at32f413_flash.h.

◆ user_d0

__IO uint32_t flash_type::user_d0

Definition at line 290 of file at32f413_flash.h.

◆ user_d1

__IO uint32_t flash_type::user_d1

Definition at line 291 of file at32f413_flash.h.

◆ wdt_ato_en

__IO uint32_t flash_type::wdt_ato_en

Definition at line 286 of file at32f413_flash.h.

The documentation for this struct was generated from the following file:
  • at32f413_flash.h


AT32F413 Firmwary Library: usd_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
usd_type Struct Reference
AT32F413_periph_driver » FLASH » FLASH_exported_types

user system data More...

#include <at32f413_flash.h>

Data Fields

__IO uint16_t | fap
__IO uint16_t | ssb
__IO uint16_t | data0
__IO uint16_t | data1
__IO uint16_t | epp0
__IO uint16_t | epp1
__IO uint16_t | epp2
__IO uint16_t | epp3
__IO uint16_t | eopb0
__IO uint16_t | reserved
__IO uint16_t | data2
__IO uint16_t | data3
__IO uint16_t | data4
__IO uint16_t | data5
__IO uint16_t | data6
__IO uint16_t | data7
__IO uint16_t | ext_flash_key [8]

Detailed Description

user system data

Definition at line 538 of file at32f413_flash.h.

Field Documentation

◆ data0

__IO uint16_t usd_type::data0

Definition at line 542 of file at32f413_flash.h.

◆ data1

__IO uint16_t usd_type::data1

Definition at line 543 of file at32f413_flash.h.

◆ data2

__IO uint16_t usd_type::data2

Definition at line 550 of file at32f413_flash.h.

◆ data3

__IO uint16_t usd_type::data3

Definition at line 551 of file at32f413_flash.h.

◆ data4

__IO uint16_t usd_type::data4

Definition at line 552 of file at32f413_flash.h.

◆ data5

__IO uint16_t usd_type::data5

Definition at line 553 of file at32f413_flash.h.

◆ data6

__IO uint16_t usd_type::data6

Definition at line 554 of file at32f413_flash.h.

◆ data7

__IO uint16_t usd_type::data7

Definition at line 555 of file at32f413_flash.h.

◆ eopb0

__IO uint16_t usd_type::eopb0

Definition at line 548 of file at32f413_flash.h.

◆ epp0

__IO uint16_t usd_type::epp0

Definition at line 544 of file at32f413_flash.h.

◆ epp1

__IO uint16_t usd_type::epp1

Definition at line 545 of file at32f413_flash.h.

◆ epp2

__IO uint16_t usd_type::epp2

Definition at line 546 of file at32f413_flash.h.

◆ epp3

__IO uint16_t usd_type::epp3

Definition at line 547 of file at32f413_flash.h.

◆ ext_flash_key

__IO uint16_t usd_type::ext_flash_key[8]

Definition at line 556 of file at32f413_flash.h.

◆ fap

__IO uint16_t usd_type::fap

Definition at line 540 of file at32f413_flash.h.

◆ reserved

__IO uint16_t usd_type::reserved

Definition at line 549 of file at32f413_flash.h.

◆ ssb

__IO uint16_t usd_type::ssb

Definition at line 541 of file at32f413_flash.h.

The documentation for this struct was generated from the following file:
  • at32f413_flash.h


AT32F413 Firmwary Library: FLASH_exported_functions

Functions
FLASH_exported_functions
AT32F413_periph_driver » FLASH

Functions

flag_status | flash_flag_get (uint32_t flash_flag)
check whether the specified flash flag is set or not.
void | flash_flag_clear (uint32_t flash_flag)
clear the flash flag.
flash_status_type | flash_operation_status_get (void)
return the flash operation status.
flash_status_type | flash_spim_operation_status_get (void)
return the flash spim operation status.
flash_status_type | flash_operation_wait_for (uint32_t time_out)
wait for flash operation complete or timeout.
flash_status_type | flash_spim_operation_wait_for (uint32_t time_out)
wait for flash spim operation complete or timeout.
void | flash_unlock (void)
unlock the flash controller.
void | flash_spim_unlock (void)
unlock the flash spim controller.
void | flash_lock (void)
lock the flash controller.
void | flash_spim_lock (void)
lock the flash spim controller.
flash_status_type | flash_sector_erase (uint32_t sector_address)
erase a specified flash sector.
flash_status_type | flash_internal_all_erase (void)
erase flash all internal sectors.
flash_status_type | flash_spim_all_erase (void)
erase flash spim sectors.
flash_status_type | flash_user_system_data_erase (void)
erase the flash user system data.
flash_status_type | flash_word_program (uint32_t address, uint32_t data)
program a word at a specified address.
flash_status_type | flash_halfword_program (uint32_t address, uint16_t data)
program a halfword at a specified address.
flash_status_type | flash_byte_program (uint32_t address, uint8_t data)
program a byte at a specified address.
flash_status_type | flash_user_system_data_program (uint32_t address, uint8_t data)
program a halfword at a specified user system data address.
flash_status_type | flash_epp_set (uint32_t *sector_bits)
config erase/program protection for the desired sectors.
void | flash_epp_status_get (uint32_t *sector_bits)
return the flash erase/program protection status.
flash_status_type | flash_fap_enable (confirm_state new_state)
enable or disable the flash access protection.
flag_status | flash_fap_status_get (void)
check the flash access protection status.
flash_status_type | flash_ssb_set (uint8_t usd_ssb)
program the flash system setting byte in usd: wdt_ato_en / depslp_rst / stdby_rst.
uint8_t | flash_ssb_status_get (void)
return the flash system setting byte status.
void | flash_interrupt_enable (uint32_t flash_int, confirm_state new_state)
enable or disable the specified flash interrupts.
void | flash_spim_model_select (flash_spim_model_type mode)
select spim supports extended spi flash chip model.
void | flash_spim_encryption_range_set (uint32_t decode_address)
set the range of encryption in spim flash. when the address is larger than this value, the writing data will be directly written to spim without encryption.
void | flash_spim_dummy_read (void)
operate the flash spim dummy read.
flash_status_type | flash_spim_mass_program (uint32_t address, uint8_t *buf, uint32_t cnt)
mass program for flash spim.
flash_status_type | flash_slib_enable (uint32_t pwd, uint16_t start_sector, uint16_t data_start_sector, uint16_t end_sector)
enable security library function.
error_status | flash_slib_disable (uint32_t pwd)
disable slib when slib enabled.
uint32_t | flash_slib_remaining_count_get (void)
get remaining count of slib(range: 256~0).
flag_status | flash_slib_state_get (void)
get the slib state.
uint16_t | flash_slib_start_sector_get (void)
get the start sector of slib.
uint16_t | flash_slib_datastart_sector_get (void)
get the data start sector of slib.
uint16_t | flash_slib_end_sector_get (void)
get the end sector of slib.
uint32_t | flash_crc_calibrate (uint32_t start_sector, uint32_t sector_cnt)
flash crc calibration in main block.

Detailed Description

Function Documentation

◆ flash_byte_program()

flash_status_type flash_byte_program | ( | uint32_t | address,
 |  | uint8_t | data )

program a byte at a specified address.

Note
this function cannot be used to program spim.
Parameters
address | specifies the address to be programmed.
data | specifies the data to be programmed.
Return values
status the returned value can be: FLASH_PROGRAM_ERROR, FLASH_EPP_ERROR, FLASH_OPERATE_DONE or FLASH_OPERATE_TIMEOUT.

< internal flash program operation timeout

Definition at line 491 of file at32f413_flash.c.

Referenced by flash_write_data(), and msc_disk_write().

◆ flash_crc_calibrate()

uint32_t flash_crc_calibrate | ( | uint32_t | start_sector,
 |  | uint32_t | sector_cnt )

flash crc calibration in main block.

Parameters
start_sector crc calibration start sector number sector_cnt: crc calibration sector count
Return values
uint32 crc calibration result

< flash common operation timeout

Definition at line 942 of file at32f413_flash.c.

◆ flash_epp_set()

flash_status_type flash_epp_set ( uint32_t * sector_bits )

config erase/program protection for the desired sectors.

Parameters
sector_bits(1:ENABLE,0:DISABLE) the pointer of the address of the sectors to be erase/program protected. general every bit is used to protect the 4KB bytes, and the last one bit is used to protect the rest.
Return values
status the returned value can be: FLASH_PROGRAM_ERROR, FLASH_EPP_ERROR, FLASH_OPERATE_DONE or FLASH_OPERATE_TIMEOUT.

< flash operation unlock order key1

< flash operation unlock order key2

< internal flash program operation timeout

< internal flash program operation timeout

< internal flash program operation timeout

< internal flash program operation timeout

Definition at line 552 of file at32f413_flash.c.

◆ flash_epp_status_get()

void flash_epp_status_get ( uint32_t * sector_bits )

return the flash erase/program protection status.

Parameters
sector_bits pointer to get the epps register.
Return values
none

Definition at line 602 of file at32f413_flash.c.

◆ flash_fap_enable()

flash_status_type flash_fap_enable ( confirm_state new_state )

enable or disable the flash access protection.

Note
if the user has already programmed the other user system data before calling this function, must re-program them since this function erase all user system data.
Parameters
new_state new state of the flash access protection. this parameter can be: TRUE or FALSE.
Return values
status the returned value can be: FLASH_PROGRAM_ERROR, FLASH_EPP_ERROR, FLASH_OPERATE_DONE or FLASH_OPERATE_TIMEOUT.

< flash operation unlock order key1

< flash operation unlock order key2

< internal flash erase operation timeout

< flash fap relieve key val

< internal flash erase operation timeout

Definition at line 617 of file at32f413_flash.c.

◆ flash_fap_status_get()

flag_status flash_fap_status_get ( void )

check the flash access protection status.

Parameters
none
Return values
flash access protection status(SET or RESET)

Definition at line 659 of file at32f413_flash.c.

Referenced by flash_user_system_data_erase().

◆ flash_flag_clear()

void flash_flag_clear ( uint32_t flash_flag )

clear the flash flag.

Parameters
flash_flag specifies the flash flags to clear. this parameter can be any combination of the following values:
  • FLASH_ODF_FLAG
  • FLASH_PRGMERR_FLAG
  • FLASH_EPPERR_FLAG
  • FLASH_SPIM_ODF_FLAG
  • FLASH_SPIM_PRGMERR_FLAG
  • FLASH_SPIM_EPPERR_FLAG
Return values
none

Definition at line 97 of file at32f413_flash.c.

Referenced by FLASH_IRQHandler(), flash_write(), and spim_operate().

◆ flash_flag_get()

flag_status flash_flag_get ( uint32_t flash_flag )

check whether the specified flash flag is set or not.

Parameters
flash_flag specifies the flash flag to check. this parameter can be one of flash flag status:
  • FLASH_OBF_FLAG
  • FLASH_ODF_FLAG
  • FLASH_PRGMERR_FLAG
  • FLASH_EPPERR_FLAG
  • FLASH_SPIM_OBF_FLAG
  • FLASH_SPIM_ODF_FLAG
  • FLASH_SPIM_PRGMERR_FLAG
  • FLASH_SPIM_EPPERR_FLAG
  • FLASH_USDERR_FLAG
Return values
the new state of flash_flag (SET or RESET).

Definition at line 58 of file at32f413_flash.c.

Referenced by FLASH_IRQHandler(), and spim_init().

◆ flash_halfword_program()

flash_status_type flash_halfword_program | ( | uint32_t | address,
 |  | uint16_t | data )

program a halfword at a specified address.

Parameters
address | specifies the address to be programmed, halfword alignment is recommended.
data | specifies the data to be programmed.
Return values
status the returned value can be: FLASH_PROGRAM_ERROR, FLASH_EPP_ERROR, FLASH_OPERATE_DONE or FLASH_OPERATE_TIMEOUT.

< flash start address of spim

< spim program operation timeout

< internal flash program operation timeout

Definition at line 452 of file at32f413_flash.c.

Referenced by flash_2kb_write(), and flash_write_nocheck().

◆ flash_internal_all_erase()

flash_status_type flash_internal_all_erase ( void )

erase flash all internal sectors.

Parameters
none
Return values
status the returned value can be: FLASH_PROGRAM_ERROR, FLASH_EPP_ERROR, FLASH_OPERATE_DONE or FLASH_OPERATE_TIMEOUT.

< internal flash erase operation timeout

Definition at line 313 of file at32f413_flash.c.

◆ flash_interrupt_enable()

void flash_interrupt_enable | ( | uint32_t | flash_int,
 |  | confirm_state | new_state )

enable or disable the specified flash interrupts.

Parameters
flash_int specifies the flash interrupt sources to be enabled or disabled. this parameter can be any combination of the following values:
  • FLASH_ERR_INT
  • FLASH_ODF_INT
  • FLASH_SPIM_ERR_INT
  • FLASH_SPIM_ODF_INT
new_state new state of the specified flash interrupts. this parameter can be: TRUE or FALSE.
Return values
none

< flash bank1 error interrupt

< flash bank1 operate done interrupt

< flash spim error interrupt

< flash spim operate done interrupt

Definition at line 729 of file at32f413_flash.c.

Referenced by config_flash_interrupt().

◆ flash_lock()

void flash_lock ( void )

lock the flash controller.

Parameters
none
Return values
none

Definition at line 251 of file at32f413_flash.c.

Referenced by config_flash_interrupt(), flash_2kb_write(), flash_fat16_clear_upgrade_flag(), flash_fat16_set_upgrade_flag(), flash_write(), flash_write_data(), iap_clear_upgrade_flag(), iap_command_handle(), iap_data_write(), iap_erase_sector(), iap_init(), iap_set_upgrade_flag(), and msc_disk_write().

◆ flash_operation_status_get()

flash_status_type flash_operation_status_get ( void )

return the flash operation status.

Parameters
none
Return values
status the returned value can be: FLASH_OPERATE_BUSY, FLASH_PROGRAM_ERROR, FLASH_EPP_ERROR or FLASH_OPERATE_DONE.

Definition at line 121 of file at32f413_flash.c.

Referenced by flash_operation_wait_for().

◆ flash_operation_wait_for()

flash_status_type flash_operation_wait_for ( uint32_t time_out )

wait for flash operation complete or timeout.

Parameters
time_out flash operation timeout
Return values
status the returned value can be: FLASH_PROGRAM_ERROR, FLASH_EPP_ERROR, FLASH_OPERATE_DONE or FLASH_OPERATE_TIMEOUT.

Definition at line 179 of file at32f413_flash.c.

Referenced by flash_byte_program(), flash_crc_calibrate(), flash_epp_set(), flash_fap_enable(), flash_halfword_program(), flash_internal_all_erase(), flash_sector_erase(), flash_slib_disable(), flash_slib_enable(), flash_ssb_set(), flash_user_system_data_erase(), flash_user_system_data_program(), flash_word_program(), flash_write(), and spim_operate().

◆ flash_sector_erase()

flash_status_type flash_sector_erase ( uint32_t sector_address )

erase a specified flash sector.

Parameters
sector_address the sector address to be erased.
Return values
status the returned value can be: FLASH_PROGRAM_ERROR, FLASH_EPP_ERROR, FLASH_OPERATE_DONE or FLASH_OPERATE_TIMEOUT.

< flash start address of spim

< spim erase operation timeout

< internal flash erase operation timeout

Definition at line 272 of file at32f413_flash.c.

Referenced by flash_2kb_write(), flash_fat16_clear_upgrade_flag(), flash_write(), flash_write_data(), iap_clear_upgrade_flag(), iap_command_handle(), iap_erase_sector(), iap_init(), msc_disk_write(), slib_enable(), and spim_operate().

◆ flash_slib_datastart_sector_get()

uint16_t flash_slib_datastart_sector_get ( void )

get the data start sector of slib.

Parameters
none
Return values
uint16_t

Definition at line 921 of file at32f413_flash.c.

◆ flash_slib_disable()

error_status flash_slib_disable ( uint32_t pwd )

disable slib when slib enabled.

Parameters
pwd slib password
Return values
success or error

< internal flash erase operation timeout

Definition at line 866 of file at32f413_flash.c.

◆ flash_slib_enable()

flash_status_type flash_slib_enable | ( | uint32_t | pwd,
 |  | uint16_t | start_sector,
 |  | uint16_t | data_start_sector,
 |  | uint16_t | end_sector )

enable security library function.

Parameters
pwd slib password start_sector: security library start sector data_start_sector: security library d-bus area start sector end_sector: security library end sector
Return values
status the returned value can be: FLASH_PROGRAM_ERROR, FLASH_EPP_ERROR, FLASH_OPERATE_DONE or FLASH_OPERATE_TIMEOUT.

< flash slib operation unlock order key

< flash slib d-bus area start sector

< flash slib end sector

< flash slib start sector

< internal flash program operation timeout

< internal flash program operation timeout

Definition at line 831 of file at32f413_flash.c.

Referenced by slib_enable().

◆ flash_slib_end_sector_get()

uint16_t flash_slib_end_sector_get ( void )

get the end sector of slib.

Parameters
none
Return values
uint16_t

Definition at line 931 of file at32f413_flash.c.

◆ flash_slib_remaining_count_get()

uint32_t flash_slib_remaining_count_get ( void )

get remaining count of slib(range: 256~0).

Parameters
none
Return values
uint32_t

Definition at line 888 of file at32f413_flash.c.

◆ flash_slib_start_sector_get()

uint16_t flash_slib_start_sector_get ( void )

get the start sector of slib.

Parameters
none
Return values
uint16_t

Definition at line 911 of file at32f413_flash.c.

◆ flash_slib_state_get()

flag_status flash_slib_state_get ( void )

get the slib state.

Parameters
none
Return values
SET or RESET

Definition at line 898 of file at32f413_flash.c.

Referenced by main().

◆ flash_spim_all_erase()

flash_status_type flash_spim_all_erase ( void )

erase flash spim sectors.

Parameters
none
Return values
status the returned value can be: FLASH_PROGRAM_ERROR, FLASH_EPP_ERROR, FLASH_OPERATE_DONE or FLASH_OPERATE_TIMEOUT.

< spim erase operation timeout

Definition at line 336 of file at32f413_flash.c.

◆ flash_spim_dummy_read()

void flash_spim_dummy_read ( void )

operate the flash spim dummy read.

Parameters
none
Return values
none

< flash start address of spim

< flash start address of spim

< flash start address of spim

Definition at line 771 of file at32f413_flash.c.

Referenced by flash_halfword_program(), flash_sector_erase(), flash_spim_all_erase(), flash_spim_mass_program(), flash_spim_model_select(), and flash_word_program().

◆ flash_spim_encryption_range_set()

void flash_spim_encryption_range_set ( uint32_t decode_address )

set the range of encryption in spim flash. when the address is larger than this value, the writing data will be directly written to spim without encryption.

Parameters
decode_address the end address of encrypted data in spim
Return values
none

Definition at line 761 of file at32f413_flash.c.

Referenced by spim_init().

◆ flash_spim_lock()

void flash_spim_lock ( void )

lock the flash spim controller.

Parameters
none
Return values
none

Definition at line 261 of file at32f413_flash.c.

◆ flash_spim_mass_program()

flash_status_type flash_spim_mass_program | ( | uint32_t | address,
 |  | uint8_t * | buf,
 |  | uint32_t | cnt )

mass program for flash spim.

Parameters
address | specifies the start address to be programmed, word or halfword alignment is recommended.
buf | specifies the pointer of data to be programmed.
cnt | specifies the data counter to be programmed.
Return values
status the returned value can be: FLASH_PROGRAM_ERROR, FLASH_EPP_ERROR, FLASH_OPERATE_DONE or FLASH_OPERATE_TIMEOUT.

< flash start address of spim

< spim program operation timeout

< spim program operation timeout

Definition at line 786 of file at32f413_flash.c.

◆ flash_spim_model_select()

void flash_spim_model_select ( flash_spim_model_type mode )

select spim supports extended spi flash chip model.

Parameters
mode the extended spi flash model
Return values
none

Definition at line 746 of file at32f413_flash.c.

Referenced by spim_init().

◆ flash_spim_operation_status_get()

flash_status_type flash_spim_operation_status_get ( void )

return the flash spim operation status.

Parameters
none
Return values
status the returned value can be: FLASH_OPERATE_BUSY, FLASH_PROGRAM_ERROR, FLASH_EPP_ERROR or FLASH_OPERATE_DONE.

Definition at line 150 of file at32f413_flash.c.

Referenced by flash_spim_operation_wait_for().

◆ flash_spim_operation_wait_for()

flash_status_type flash_spim_operation_wait_for ( uint32_t time_out )

wait for flash spim operation complete or timeout.

Parameters
time_out flash operation timeout
Return values
status the returned value can be: FLASH_PROGRAM_ERROR, FLASH_EPP_ERROR, FLASH_OPERATE_DONE or FLASH_OPERATE_TIMEOUT.

Definition at line 204 of file at32f413_flash.c.

Referenced by flash_halfword_program(), flash_sector_erase(), flash_spim_all_erase(), flash_spim_mass_program(), and flash_word_program().

◆ flash_spim_unlock()

void flash_spim_unlock ( void )

unlock the flash spim controller.

Parameters
none
Return values
none

< flash operation unlock order key1

< flash operation unlock order key2

Definition at line 239 of file at32f413_flash.c.

Referenced by spim_init().

◆ flash_ssb_set()

flash_status_type flash_ssb_set ( uint8_t usd_ssb )

program the flash system setting byte in usd: wdt_ato_en / depslp_rst / stdby_rst.

Parameters
usd_ssb the system setting byte
Note
this parameter usd_ssb must contain a combination of all the following 3 types of data type 1: wdt_ato_en, select the wdt auto start this data can be one of the following values:
  • USD_WDT_ATO_DISABLE: disable wdt auto start
  • USD_WDT_ATO_ENABLE: enable wdt auto start type 2: depslp_rst, reset event when entering deepsleep mode. this data can be one of the following values:
  • USD_DEPSLP_NO_RST: no reset generated when entering in deepsleep
  • USD_DEPSLP_RST: reset generated when entering in deepsleep type 3: stdby_rst, reset event when entering standby mode. this data can be one of the following values:
  • USD_STDBY_NO_RST: no reset generated when entering in standby
  • USD_STDBY_RST: reset generated when entering in standby
Return values
status the returned value can be: FLASH_PROGRAM_ERROR, FLASH_EPP_ERROR, FLASH_OPERATE_DONE or FLASH_OPERATE_TIMEOUT.

< flash operation unlock order key1

< flash operation unlock order key2

< internal flash program operation timeout

Definition at line 683 of file at32f413_flash.c.

◆ flash_ssb_status_get()

uint8_t flash_ssb_status_get ( void )

return the flash system setting byte status.

Parameters
none
Return values
values from flash_usd register: wdt_ato_en(bit0), depslp_rst(bit1) and stdby_rst(bit2).

Definition at line 711 of file at32f413_flash.c.

◆ flash_unlock()

void flash_unlock ( void )

unlock the flash controller.

Parameters
none
Return values
none

< flash operation unlock order key1

< flash operation unlock order key2

Definition at line 228 of file at32f413_flash.c.

Referenced by config_flash_interrupt(), flash_2kb_write(), flash_fat16_clear_upgrade_flag(), flash_fat16_set_upgrade_flag(), flash_write(), flash_write_data(), iap_clear_upgrade_flag(), iap_command_handle(), iap_data_write(), iap_erase_sector(), iap_init(), iap_set_upgrade_flag(), msc_disk_write(), and slib_enable().

◆ flash_user_system_data_erase()

flash_status_type flash_user_system_data_erase ( void )

erase the flash user system data.

Note
this functions erases all user system data except the fap byte.
Parameters
none
Return values
status the returned value can be: FLASH_PROGRAM_ERROR, FLASH_EPP_ERROR, FLASH_OPERATE_DONE or FLASH_OPERATE_TIMEOUT.

< flash fap relieve key val

< flash operation unlock order key1

< flash operation unlock order key2

< internal flash erase operation timeout

< flash fap relieve key val

< internal flash program operation timeout

Definition at line 363 of file at32f413_flash.c.

◆ flash_user_system_data_program()

flash_status_type flash_user_system_data_program | ( | uint32_t | address,
 |  | uint8_t | data )

program a halfword at a specified user system data address.

Parameters
address | specifies the address to be programmed.
data | specifies the data to be programmed.
Return values
status the returned value can be: FLASH_PROGRAM_ERROR, FLASH_EPP_ERROR, FLASH_OPERATE_DONE or FLASH_OPERATE_TIMEOUT.

< flash operation unlock order key1

< flash operation unlock order key2

< internal flash program operation timeout

Definition at line 514 of file at32f413_flash.c.

◆ flash_word_program()

flash_status_type flash_word_program | ( | uint32_t | address,
 |  | uint32_t | data )

program a word at a specified address.

Parameters
address | specifies the address to be programmed, word alignment is recommended.
data | specifies the data to be programmed.
Return values
status the returned value can be: FLASH_PROGRAM_ERROR, FLASH_EPP_ERROR, FLASH_OPERATE_DONE or FLASH_OPERATE_TIMEOUT.

< flash start address of spim

< spim program operation timeout

< internal flash program operation timeout

Definition at line 414 of file at32f413_flash.c.

Referenced by flash_fat16_set_upgrade_flag(), iap_command_handle(), iap_data_write(), iap_set_upgrade_flag(), slib_enable(), and spim_operate().


AT32F413 Firmwary Library: FLASH_private_functions

Functions
FLASH_private_functions
AT32F413_periph_driver » FLASH

Functions

flag_status | flash_flag_get (uint32_t flash_flag)
check whether the specified flash flag is set or not.
void | flash_flag_clear (uint32_t flash_flag)
clear the flash flag.
flash_status_type | flash_operation_status_get (void)
return the flash operation status.
flash_status_type | flash_spim_operation_status_get (void)
return the flash spim operation status.
flash_status_type | flash_operation_wait_for (uint32_t time_out)
wait for flash operation complete or timeout.
flash_status_type | flash_spim_operation_wait_for (uint32_t time_out)
wait for flash spim operation complete or timeout.
void | flash_unlock (void)
unlock the flash controller.
void | flash_spim_unlock (void)
unlock the flash spim controller.
void | flash_lock (void)
lock the flash controller.
void | flash_spim_lock (void)
lock the flash spim controller.
flash_status_type | flash_sector_erase (uint32_t sector_address)
erase a specified flash sector.
flash_status_type | flash_internal_all_erase (void)
erase flash all internal sectors.
flash_status_type | flash_spim_all_erase (void)
erase flash spim sectors.
flash_status_type | flash_user_system_data_erase (void)
erase the flash user system data.
flash_status_type | flash_word_program (uint32_t address, uint32_t data)
program a word at a specified address.
flash_status_type | flash_halfword_program (uint32_t address, uint16_t data)
program a halfword at a specified address.
flash_status_type | flash_byte_program (uint32_t address, uint8_t data)
program a byte at a specified address.
flash_status_type | flash_user_system_data_program (uint32_t address, uint8_t data)
program a halfword at a specified user system data address.
flash_status_type | flash_epp_set (uint32_t *sector_bits)
config erase/program protection for the desired sectors.
void | flash_epp_status_get (uint32_t *sector_bits)
return the flash erase/program protection status.
flash_status_type | flash_fap_enable (confirm_state new_state)
enable or disable the flash access protection.
flag_status | flash_fap_status_get (void)
check the flash access protection status.
flash_status_type | flash_ssb_set (uint8_t usd_ssb)
program the flash system setting byte in usd: wdt_ato_en / depslp_rst / stdby_rst.
uint8_t | flash_ssb_status_get (void)
return the flash system setting byte status.
void | flash_interrupt_enable (uint32_t flash_int, confirm_state new_state)
enable or disable the specified flash interrupts.
void | flash_spim_model_select (flash_spim_model_type mode)
select spim supports extended spi flash chip model.
void | flash_spim_encryption_range_set (uint32_t decode_address)
set the range of encryption in spim flash. when the address is larger than this value, the writing data will be directly written to spim without encryption.
void | flash_spim_dummy_read (void)
operate the flash spim dummy read.
flash_status_type | flash_spim_mass_program (uint32_t address, uint8_t *buf, uint32_t cnt)
mass program for flash spim.
flash_status_type | flash_slib_enable (uint32_t pwd, uint16_t start_sector, uint16_t data_start_sector, uint16_t end_sector)
enable security library function.
error_status | flash_slib_disable (uint32_t pwd)
disable slib when slib enabled.
uint32_t | flash_slib_remaining_count_get (void)
get remaining count of slib(range: 256~0).
flag_status | flash_slib_state_get (void)
get the slib state.
uint16_t | flash_slib_start_sector_get (void)
get the start sector of slib.
uint16_t | flash_slib_datastart_sector_get (void)
get the data start sector of slib.
uint16_t | flash_slib_end_sector_get (void)
get the end sector of slib.
uint32_t | flash_crc_calibrate (uint32_t start_sector, uint32_t sector_cnt)
flash crc calibration in main block.

Detailed Description

Function Documentation

◆ flash_byte_program()

flash_status_type flash_byte_program | ( | uint32_t | address,
 |  | uint8_t | data )

program a byte at a specified address.

Note
this function cannot be used to program spim.
Parameters
address | specifies the address to be programmed.
data | specifies the data to be programmed.
Return values
status the returned value can be: FLASH_PROGRAM_ERROR, FLASH_EPP_ERROR, FLASH_OPERATE_DONE or FLASH_OPERATE_TIMEOUT.

< internal flash program operation timeout

Definition at line 491 of file at32f413_flash.c.

Referenced by flash_write_data(), and msc_disk_write().

◆ flash_crc_calibrate()

uint32_t flash_crc_calibrate | ( | uint32_t | start_sector,
 |  | uint32_t | sector_cnt )

flash crc calibration in main block.

Parameters
start_sector crc calibration start sector number sector_cnt: crc calibration sector count
Return values
uint32 crc calibration result

< flash common operation timeout

Definition at line 942 of file at32f413_flash.c.

◆ flash_epp_set()

flash_status_type flash_epp_set ( uint32_t * sector_bits )

config erase/program protection for the desired sectors.

Parameters
sector_bits(1:ENABLE,0:DISABLE) the pointer of the address of the sectors to be erase/program protected. general every bit is used to protect the 4KB bytes, and the last one bit is used to protect the rest.
Return values
status the returned value can be: FLASH_PROGRAM_ERROR, FLASH_EPP_ERROR, FLASH_OPERATE_DONE or FLASH_OPERATE_TIMEOUT.

< flash operation unlock order key1

< flash operation unlock order key2

< internal flash program operation timeout

< internal flash program operation timeout

< internal flash program operation timeout

< internal flash program operation timeout

Definition at line 552 of file at32f413_flash.c.

◆ flash_epp_status_get()

void flash_epp_status_get ( uint32_t * sector_bits )

return the flash erase/program protection status.

Parameters
sector_bits pointer to get the epps register.
Return values
none

Definition at line 602 of file at32f413_flash.c.

◆ flash_fap_enable()

flash_status_type flash_fap_enable ( confirm_state new_state )

enable or disable the flash access protection.

Note
if the user has already programmed the other user system data before calling this function, must re-program them since this function erase all user system data.
Parameters
new_state new state of the flash access protection. this parameter can be: TRUE or FALSE.
Return values
status the returned value can be: FLASH_PROGRAM_ERROR, FLASH_EPP_ERROR, FLASH_OPERATE_DONE or FLASH_OPERATE_TIMEOUT.

< flash operation unlock order key1

< flash operation unlock order key2

< internal flash erase operation timeout

< flash fap relieve key val

< internal flash erase operation timeout

Definition at line 617 of file at32f413_flash.c.

◆ flash_fap_status_get()

flag_status flash_fap_status_get ( void )

check the flash access protection status.

Parameters
none
Return values
flash access protection status(SET or RESET)

Definition at line 659 of file at32f413_flash.c.

Referenced by flash_user_system_data_erase().

◆ flash_flag_clear()

void flash_flag_clear ( uint32_t flash_flag )

clear the flash flag.

Parameters
flash_flag specifies the flash flags to clear. this parameter can be any combination of the following values:
  • FLASH_ODF_FLAG
  • FLASH_PRGMERR_FLAG
  • FLASH_EPPERR_FLAG
  • FLASH_SPIM_ODF_FLAG
  • FLASH_SPIM_PRGMERR_FLAG
  • FLASH_SPIM_EPPERR_FLAG
Return values
none

Definition at line 97 of file at32f413_flash.c.

Referenced by FLASH_IRQHandler(), flash_write(), and spim_operate().

◆ flash_flag_get()

flag_status flash_flag_get ( uint32_t flash_flag )

check whether the specified flash flag is set or not.

Parameters
flash_flag specifies the flash flag to check. this parameter can be one of flash flag status:
  • FLASH_OBF_FLAG
  • FLASH_ODF_FLAG
  • FLASH_PRGMERR_FLAG
  • FLASH_EPPERR_FLAG
  • FLASH_SPIM_OBF_FLAG
  • FLASH_SPIM_ODF_FLAG
  • FLASH_SPIM_PRGMERR_FLAG
  • FLASH_SPIM_EPPERR_FLAG
  • FLASH_USDERR_FLAG
Return values
the new state of flash_flag (SET or RESET).

Definition at line 58 of file at32f413_flash.c.

Referenced by FLASH_IRQHandler(), and spim_init().

◆ flash_halfword_program()

flash_status_type flash_halfword_program | ( | uint32_t | address,
 |  | uint16_t | data )

program a halfword at a specified address.

Parameters
address | specifies the address to be programmed, halfword alignment is recommended.
data | specifies the data to be programmed.
Return values
status the returned value can be: FLASH_PROGRAM_ERROR, FLASH_EPP_ERROR, FLASH_OPERATE_DONE or FLASH_OPERATE_TIMEOUT.

< flash start address of spim

< spim program operation timeout

< internal flash program operation timeout

Definition at line 452 of file at32f413_flash.c.

Referenced by flash_2kb_write(), and flash_write_nocheck().

◆ flash_internal_all_erase()

flash_status_type flash_internal_all_erase ( void )

erase flash all internal sectors.

Parameters
none
Return values
status the returned value can be: FLASH_PROGRAM_ERROR, FLASH_EPP_ERROR, FLASH_OPERATE_DONE or FLASH_OPERATE_TIMEOUT.

< internal flash erase operation timeout

Definition at line 313 of file at32f413_flash.c.

◆ flash_interrupt_enable()

void flash_interrupt_enable | ( | uint32_t | flash_int,
 |  | confirm_state | new_state )

enable or disable the specified flash interrupts.

Parameters
flash_int specifies the flash interrupt sources to be enabled or disabled. this parameter can be any combination of the following values:
  • FLASH_ERR_INT
  • FLASH_ODF_INT
  • FLASH_SPIM_ERR_INT
  • FLASH_SPIM_ODF_INT
new_state new state of the specified flash interrupts. this parameter can be: TRUE or FALSE.
Return values
none

< flash bank1 error interrupt

< flash bank1 operate done interrupt

< flash spim error interrupt

< flash spim operate done interrupt

Definition at line 729 of file at32f413_flash.c.

Referenced by config_flash_interrupt().

◆ flash_lock()

void flash_lock ( void )

lock the flash controller.

Parameters
none
Return values
none

Definition at line 251 of file at32f413_flash.c.

Referenced by config_flash_interrupt(), flash_2kb_write(), flash_fat16_clear_upgrade_flag(), flash_fat16_set_upgrade_flag(), flash_write(), flash_write_data(), iap_clear_upgrade_flag(), iap_command_handle(), iap_data_write(), iap_erase_sector(), iap_init(), iap_set_upgrade_flag(), and msc_disk_write().

◆ flash_operation_status_get()

flash_status_type flash_operation_status_get ( void )

return the flash operation status.

Parameters
none
Return values
status the returned value can be: FLASH_OPERATE_BUSY, FLASH_PROGRAM_ERROR, FLASH_EPP_ERROR or FLASH_OPERATE_DONE.

Definition at line 121 of file at32f413_flash.c.

Referenced by flash_operation_wait_for().

◆ flash_operation_wait_for()

flash_status_type flash_operation_wait_for ( uint32_t time_out )

wait for flash operation complete or timeout.

Parameters
time_out flash operation timeout
Return values
status the returned value can be: FLASH_PROGRAM_ERROR, FLASH_EPP_ERROR, FLASH_OPERATE_DONE or FLASH_OPERATE_TIMEOUT.

Definition at line 179 of file at32f413_flash.c.

Referenced by flash_byte_program(), flash_crc_calibrate(), flash_epp_set(), flash_fap_enable(), flash_halfword_program(), flash_internal_all_erase(), flash_sector_erase(), flash_slib_disable(), flash_slib_enable(), flash_ssb_set(), flash_user_system_data_erase(), flash_user_system_data_program(), flash_word_program(), flash_write(), and spim_operate().

◆ flash_sector_erase()

flash_status_type flash_sector_erase ( uint32_t sector_address )

erase a specified flash sector.

Parameters
sector_address the sector address to be erased.
Return values
status the returned value can be: FLASH_PROGRAM_ERROR, FLASH_EPP_ERROR, FLASH_OPERATE_DONE or FLASH_OPERATE_TIMEOUT.

< flash start address of spim

< spim erase operation timeout

< internal flash erase operation timeout

Definition at line 272 of file at32f413_flash.c.

Referenced by flash_2kb_write(), flash_fat16_clear_upgrade_flag(), flash_write(), flash_write_data(), iap_clear_upgrade_flag(), iap_command_handle(), iap_erase_sector(), iap_init(), msc_disk_write(), slib_enable(), and spim_operate().

◆ flash_slib_datastart_sector_get()

uint16_t flash_slib_datastart_sector_get ( void )

get the data start sector of slib.

Parameters
none
Return values
uint16_t

Definition at line 921 of file at32f413_flash.c.

◆ flash_slib_disable()

error_status flash_slib_disable ( uint32_t pwd )

disable slib when slib enabled.

Parameters
pwd slib password
Return values
success or error

< internal flash erase operation timeout

Definition at line 866 of file at32f413_flash.c.

◆ flash_slib_enable()

flash_status_type flash_slib_enable | ( | uint32_t | pwd,
 |  | uint16_t | start_sector,
 |  | uint16_t | data_start_sector,
 |  | uint16_t | end_sector )

enable security library function.

Parameters
pwd slib password start_sector: security library start sector data_start_sector: security library d-bus area start sector end_sector: security library end sector
Return values
status the returned value can be: FLASH_PROGRAM_ERROR, FLASH_EPP_ERROR, FLASH_OPERATE_DONE or FLASH_OPERATE_TIMEOUT.

< flash slib operation unlock order key

< flash slib d-bus area start sector

< flash slib end sector

< flash slib start sector

< internal flash program operation timeout

< internal flash program operation timeout

Definition at line 831 of file at32f413_flash.c.

Referenced by slib_enable().

◆ flash_slib_end_sector_get()

uint16_t flash_slib_end_sector_get ( void )

get the end sector of slib.

Parameters
none
Return values
uint16_t

Definition at line 931 of file at32f413_flash.c.

◆ flash_slib_remaining_count_get()

uint32_t flash_slib_remaining_count_get ( void )

get remaining count of slib(range: 256~0).

Parameters
none
Return values
uint32_t

Definition at line 888 of file at32f413_flash.c.

◆ flash_slib_start_sector_get()

uint16_t flash_slib_start_sector_get ( void )

get the start sector of slib.

Parameters
none
Return values
uint16_t

Definition at line 911 of file at32f413_flash.c.

◆ flash_slib_state_get()

flag_status flash_slib_state_get ( void )

get the slib state.

Parameters
none
Return values
SET or RESET

Definition at line 898 of file at32f413_flash.c.

Referenced by main().

◆ flash_spim_all_erase()

flash_status_type flash_spim_all_erase ( void )

erase flash spim sectors.

Parameters
none
Return values
status the returned value can be: FLASH_PROGRAM_ERROR, FLASH_EPP_ERROR, FLASH_OPERATE_DONE or FLASH_OPERATE_TIMEOUT.

< spim erase operation timeout

Definition at line 336 of file at32f413_flash.c.

◆ flash_spim_dummy_read()

void flash_spim_dummy_read ( void )

operate the flash spim dummy read.

Parameters
none
Return values
none

< flash start address of spim

< flash start address of spim

< flash start address of spim

Definition at line 771 of file at32f413_flash.c.

Referenced by flash_halfword_program(), flash_sector_erase(), flash_spim_all_erase(), flash_spim_mass_program(), flash_spim_model_select(), and flash_word_program().

◆ flash_spim_encryption_range_set()

void flash_spim_encryption_range_set ( uint32_t decode_address )

set the range of encryption in spim flash. when the address is larger than this value, the writing data will be directly written to spim without encryption.

Parameters
decode_address the end address of encrypted data in spim
Return values
none

Definition at line 761 of file at32f413_flash.c.

Referenced by spim_init().

◆ flash_spim_lock()

void flash_spim_lock ( void )

lock the flash spim controller.

Parameters
none
Return values
none

Definition at line 261 of file at32f413_flash.c.

◆ flash_spim_mass_program()

flash_status_type flash_spim_mass_program | ( | uint32_t | address,
 |  | uint8_t * | buf,
 |  | uint32_t | cnt )

mass program for flash spim.

Parameters
address | specifies the start address to be programmed, word or halfword alignment is recommended.
buf | specifies the pointer of data to be programmed.
cnt | specifies the data counter to be programmed.
Return values
status the returned value can be: FLASH_PROGRAM_ERROR, FLASH_EPP_ERROR, FLASH_OPERATE_DONE or FLASH_OPERATE_TIMEOUT.

< flash start address of spim

< spim program operation timeout

< spim program operation timeout

Definition at line 786 of file at32f413_flash.c.

◆ flash_spim_model_select()

void flash_spim_model_select ( flash_spim_model_type mode )

select spim supports extended spi flash chip model.

Parameters
mode the extended spi flash model
Return values
none

Definition at line 746 of file at32f413_flash.c.

Referenced by spim_init().

◆ flash_spim_operation_status_get()

flash_status_type flash_spim_operation_status_get ( void )

return the flash spim operation status.

Parameters
none
Return values
status the returned value can be: FLASH_OPERATE_BUSY, FLASH_PROGRAM_ERROR, FLASH_EPP_ERROR or FLASH_OPERATE_DONE.

Definition at line 150 of file at32f413_flash.c.

Referenced by flash_spim_operation_wait_for().

◆ flash_spim_operation_wait_for()

flash_status_type flash_spim_operation_wait_for ( uint32_t time_out )

wait for flash spim operation complete or timeout.

Parameters
time_out flash operation timeout
Return values
status the returned value can be: FLASH_PROGRAM_ERROR, FLASH_EPP_ERROR, FLASH_OPERATE_DONE or FLASH_OPERATE_TIMEOUT.

Definition at line 204 of file at32f413_flash.c.

Referenced by flash_halfword_program(), flash_sector_erase(), flash_spim_all_erase(), flash_spim_mass_program(), and flash_word_program().

◆ flash_spim_unlock()

void flash_spim_unlock ( void )

unlock the flash spim controller.

Parameters
none
Return values
none

< flash operation unlock order key1

< flash operation unlock order key2

Definition at line 239 of file at32f413_flash.c.

Referenced by spim_init().

◆ flash_ssb_set()

flash_status_type flash_ssb_set ( uint8_t usd_ssb )

program the flash system setting byte in usd: wdt_ato_en / depslp_rst / stdby_rst.

Parameters
usd_ssb the system setting byte
Note
this parameter usd_ssb must contain a combination of all the following 3 types of data type 1: wdt_ato_en, select the wdt auto start this data can be one of the following values:
  • USD_WDT_ATO_DISABLE: disable wdt auto start
  • USD_WDT_ATO_ENABLE: enable wdt auto start type 2: depslp_rst, reset event when entering deepsleep mode. this data can be one of the following values:
  • USD_DEPSLP_NO_RST: no reset generated when entering in deepsleep
  • USD_DEPSLP_RST: reset generated when entering in deepsleep type 3: stdby_rst, reset event when entering standby mode. this data can be one of the following values:
  • USD_STDBY_NO_RST: no reset generated when entering in standby
  • USD_STDBY_RST: reset generated when entering in standby
Return values
status the returned value can be: FLASH_PROGRAM_ERROR, FLASH_EPP_ERROR, FLASH_OPERATE_DONE or FLASH_OPERATE_TIMEOUT.

< flash operation unlock order key1

< flash operation unlock order key2

< internal flash program operation timeout

Definition at line 683 of file at32f413_flash.c.

◆ flash_ssb_status_get()

uint8_t flash_ssb_status_get ( void )

return the flash system setting byte status.

Parameters
none
Return values
values from flash_usd register: wdt_ato_en(bit0), depslp_rst(bit1) and stdby_rst(bit2).

Definition at line 711 of file at32f413_flash.c.

◆ flash_unlock()

void flash_unlock ( void )

unlock the flash controller.

Parameters
none
Return values
none

< flash operation unlock order key1

< flash operation unlock order key2

Definition at line 228 of file at32f413_flash.c.

Referenced by config_flash_interrupt(), flash_2kb_write(), flash_fat16_clear_upgrade_flag(), flash_fat16_set_upgrade_flag(), flash_write(), flash_write_data(), iap_clear_upgrade_flag(), iap_command_handle(), iap_data_write(), iap_erase_sector(), iap_init(), iap_set_upgrade_flag(), msc_disk_write(), and slib_enable().

◆ flash_user_system_data_erase()

flash_status_type flash_user_system_data_erase ( void )

erase the flash user system data.

Note
this functions erases all user system data except the fap byte.
Parameters
none
Return values
status the returned value can be: FLASH_PROGRAM_ERROR, FLASH_EPP_ERROR, FLASH_OPERATE_DONE or FLASH_OPERATE_TIMEOUT.

< flash fap relieve key val

< flash operation unlock order key1

< flash operation unlock order key2

< internal flash erase operation timeout

< flash fap relieve key val

< internal flash program operation timeout

Definition at line 363 of file at32f413_flash.c.

◆ flash_user_system_data_program()

flash_status_type flash_user_system_data_program | ( | uint32_t | address,
 |  | uint8_t | data )

program a halfword at a specified user system data address.

Parameters
address | specifies the address to be programmed.
data | specifies the data to be programmed.
Return values
status the returned value can be: FLASH_PROGRAM_ERROR, FLASH_EPP_ERROR, FLASH_OPERATE_DONE or FLASH_OPERATE_TIMEOUT.

< flash operation unlock order key1

< flash operation unlock order key2

< internal flash program operation timeout

Definition at line 514 of file at32f413_flash.c.

◆ flash_word_program()

flash_status_type flash_word_program | ( | uint32_t | address,
 |  | uint32_t | data )

program a word at a specified address.

Parameters
address | specifies the address to be programmed, word alignment is recommended.
data | specifies the data to be programmed.
Return values
status the returned value can be: FLASH_PROGRAM_ERROR, FLASH_EPP_ERROR, FLASH_OPERATE_DONE or FLASH_OPERATE_TIMEOUT.

< flash start address of spim

< spim program operation timeout

< internal flash program operation timeout

Definition at line 414 of file at32f413_flash.c.

Referenced by flash_fat16_set_upgrade_flag(), iap_command_handle(), iap_data_write(), iap_set_upgrade_flag(), slib_enable(), and spim_operate().


AT32F413 Firmwary Library: GPIO

Topics | Macros
GPIO
AT32F413_periph_driver

GPIO driver modules. More...

Topics

GPIO_pins_number_definition
IOMUX_map_definition
iomux map definitions
IOMUX_map2_definition
iomux map2 definitions
IOMUX_map3_definition
iomux map3 definitions
IOMUX_map4_definition
iomux map4 definitions
IOMUX_map5_definition
iomux map5 definitions
IOMUX_map6_definition
iomux map6 definitions
IOMUX_map7_definition
iomux map7 definitions
GPIO_exported_types
GPIO_exported_functions
GPIO_private_functions

Macros

#define | IOMUX_MAKE_VALUE(reg_offset, bit_addr, bit_num, bit_val)
#define | GPIOA ((gpio_type *) GPIOA_BASE)
#define | GPIOB ((gpio_type *) GPIOB_BASE)
#define | GPIOC ((gpio_type *) GPIOC_BASE)
#define | GPIOD ((gpio_type *) GPIOD_BASE)
#define | GPIOF ((gpio_type *) GPIOF_BASE)
#define | IOMUX ((iomux_type *) IOMUX_BASE)

Detailed Description

GPIO driver modules.

Macro Definition Documentation

◆ GPIOA

#define GPIOA ((gpio_type *) GPIOA_BASE)

Definition at line 747 of file at32f413_gpio.h.

Referenced by clkout_config(), clkout_config(), clkout_config(), exint_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_configuration(), gpio_reset(), main(), mclk_tmr1_init(), rs485_config(), rs485_send_data(), spim_init(), swj_dp_config(), tmr1_config(), TMR2_GLOBAL_IRQHandler(), uart_init(), usart1_config(), usart_configuration(), usart_gpio_config(), and usart_spi_configuration().

◆ GPIOB

#define GPIOB ((gpio_type *) GPIOB_BASE)

Definition at line 748 of file at32f413_gpio.h.

Referenced by can_gpio_config(), can_gpio_config(), can_gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_configuration(), gpio_reset(), main(), spiflash_init(), spim_init(), swj_dp_config(), usart_configuration(), and usart_spi_configuration().

◆ GPIOC

#define GPIOC ((gpio_type *) GPIOC_BASE)

Definition at line 749 of file at32f413_gpio.h.

Referenced by exint_config(), gpio_configuration(), gpio_reset(), main(), sd_init(), and TMR2_GLOBAL_IRQHandler().

◆ GPIOD

#define GPIOD ((gpio_type *) GPIOD_BASE)

Definition at line 750 of file at32f413_gpio.h.

Referenced by gpio_reset(), and sd_init().

◆ GPIOF

#define GPIOF ((gpio_type *) GPIOF_BASE)

Definition at line 751 of file at32f413_gpio.h.

Referenced by gpio_reset().

◆ IOMUX

#define IOMUX ((iomux_type *) IOMUX_BASE)

Definition at line 752 of file at32f413_gpio.h.

Referenced by gpio_event_output_config(), gpio_event_output_enable(), and gpio_exint_line_config().

◆ IOMUX_MAKE_VALUE

#define IOMUX_MAKE_VALUE | ( | reg_offset,
 |  | bit_addr,
 |  | bit_num,
 |  | bit_val )
Value:
(uint32_t)(((reg_offset) << 24) | ((bit_addr) << 16) | ((bit_num) << 8) | (bit_val))

Definition at line 72 of file at32f413_gpio.h.


AT32F413 Firmwary Library: GPIO_pins_number_definition

Macros
GPIO_pins_number_definition
AT32F413_periph_driver » GPIO

Macros

#define | GPIO_PINS_0 0x0001
#define | GPIO_PINS_1 0x0002
#define | GPIO_PINS_2 0x0004
#define | GPIO_PINS_3 0x0008
#define | GPIO_PINS_4 0x0010
#define | GPIO_PINS_5 0x0020
#define | GPIO_PINS_6 0x0040
#define | GPIO_PINS_7 0x0080
#define | GPIO_PINS_8 0x0100
#define | GPIO_PINS_9 0x0200
#define | GPIO_PINS_10 0x0400
#define | GPIO_PINS_11 0x0800
#define | GPIO_PINS_12 0x1000
#define | GPIO_PINS_13 0x2000
#define | GPIO_PINS_14 0x4000
#define | GPIO_PINS_15 0x8000
#define | GPIO_PINS_ALL 0xFFFF

Detailed Description

Macro Definition Documentation

◆ GPIO_PINS_0

#define GPIO_PINS_0 0x0001

gpio pins number 0

Definition at line 50 of file at32f413_gpio.h.

Referenced by gpio_config(), gpio_config(), gpio_config(), gpio_configuration(), main(), and usart_configuration().

◆ GPIO_PINS_1

#define GPIO_PINS_1 0x0002

gpio pins number 1

Definition at line 51 of file at32f413_gpio.h.

Referenced by gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_configuration(), main(), rs485_config(), rs485_send_data(), spim_init(), and usart_configuration().

◆ GPIO_PINS_10

#define GPIO_PINS_10 0x0400

gpio pins number 10

Definition at line 60 of file at32f413_gpio.h.

Referenced by main(), sd_init(), spim_init(), uart_init(), usart1_config(), and usart_configuration().

◆ GPIO_PINS_11

#define GPIO_PINS_11 0x0800

gpio pins number 11

Definition at line 61 of file at32f413_gpio.h.

Referenced by exint_config(), main(), sd_init(), spim_init(), and usart_configuration().

◆ GPIO_PINS_12

#define GPIO_PINS_12 0x1000

gpio pins number 12

Definition at line 62 of file at32f413_gpio.h.

Referenced by gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), main(), sd_init(), and spiflash_init().

◆ GPIO_PINS_13

#define GPIO_PINS_13 0x2000

gpio pins number 13

Definition at line 63 of file at32f413_gpio.h.

Referenced by gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), main(), spiflash_init(), swj_dp_config(), and usart_spi_configuration().

◆ GPIO_PINS_14

#define GPIO_PINS_14 0x4000

gpio pins number 14

Definition at line 64 of file at32f413_gpio.h.

Referenced by gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), main(), spiflash_init(), swj_dp_config(), and usart_spi_configuration().

◆ GPIO_PINS_15

#define GPIO_PINS_15 0x8000

gpio pins number 15

Definition at line 65 of file at32f413_gpio.h.

Referenced by exint_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), main(), spiflash_init(), swj_dp_config(), and usart_spi_configuration().

◆ GPIO_PINS_2

#define GPIO_PINS_2 0x0004

gpio pins number 2

Definition at line 52 of file at32f413_gpio.h.

Referenced by gpio_configuration(), main(), rs485_config(), sd_init(), usart_configuration(), usart_gpio_config(), and usart_spi_configuration().

◆ GPIO_PINS_3

#define GPIO_PINS_3 0x0008

gpio pins number 3

Definition at line 53 of file at32f413_gpio.h.

Referenced by gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_configuration(), main(), rs485_config(), swj_dp_config(), usart_configuration(), usart_gpio_config(), and usart_spi_configuration().

◆ GPIO_PINS_4

#define GPIO_PINS_4 0x0010

gpio pins number 4

Definition at line 54 of file at32f413_gpio.h.

Referenced by gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), main(), swj_dp_config(), and usart_spi_configuration().

◆ GPIO_PINS_5

#define GPIO_PINS_5 0x0020

gpio pins number 5

Definition at line 55 of file at32f413_gpio.h.

Referenced by gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), and gpio_config().

◆ GPIO_PINS_6

#define GPIO_PINS_6 0x0040

gpio pins number 6

Definition at line 56 of file at32f413_gpio.h.

Referenced by gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_configuration(), main(), spim_init(), and TMR2_GLOBAL_IRQHandler().

◆ GPIO_PINS_7

#define GPIO_PINS_7 0x0080

gpio pins number 7

Definition at line 57 of file at32f413_gpio.h.

Referenced by gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_configuration(), main(), spim_init(), and TMR2_GLOBAL_IRQHandler().

◆ GPIO_PINS_8

#define GPIO_PINS_8 0x0100

gpio pins number 8

Definition at line 58 of file at32f413_gpio.h.

Referenced by can_gpio_config(), can_gpio_config(), can_gpio_config(), clkout_config(), clkout_config(), clkout_config(), gpio_configuration(), main(), mclk_tmr1_init(), sd_init(), spim_init(), tmr1_config(), and TMR2_GLOBAL_IRQHandler().

◆ GPIO_PINS_9

#define GPIO_PINS_9 0x0200

gpio pins number 9

Definition at line 59 of file at32f413_gpio.h.

Referenced by can_gpio_config(), can_gpio_config(), can_gpio_config(), gpio_configuration(), main(), sd_init(), TMR2_GLOBAL_IRQHandler(), uart_init(), and usart1_config().

◆ GPIO_PINS_ALL

#define GPIO_PINS_ALL 0xFFFF

gpio all pins

Definition at line 66 of file at32f413_gpio.h.

Referenced by gpio_default_para_init(), and main().


AT32F413 Firmwary Library: IOMUX_map_definition

Macros
IOMUX_map_definition
AT32F413_periph_driver » GPIO

iomux map definitions More...

Macros

#define | SPI1_MUX_01 SPI1_GMUX_0001
#define | I2C1_MUX I2C1_GMUX_0001
#define | USART1_MUX USART1_GMUX_0001
#define | USART3_MUX_01 USART3_GMUX_0001
#define | TMR1_MUX_01 TMR1_GMUX_0001
#define | TMR2_MUX_01 TMR2_GMUX_001
#define | TMR2_MUX_10 TMR2_GMUX_010
#define | TMR2_MUX_11 TMR2_GMUX_011
#define | TMR3_MUX_10 TMR3_GMUX_0010
#define | TMR3_MUX_11 TMR3_GMUX_0011
#define | CAN_MUX_10 CAN1_GMUX_0010
#define | PD01_MUX PD01_GMUX
#define | TMR5CH4_MUX TMR5CH4_GMUX
#define | ADC1_ETP_MUX ADC1_ETP_GMUX
#define | ADC1_ETO_MUX ADC1_ETO_GMUX
#define | ADC2_ETP_MUX ADC2_ETP_GMUX
#define | ADC2_ETO_MUX ADC2_ETO_GMUX
#define | SWJTAG_CONF_001 SWJTAG_GMUX_001
#define | SWJTAG_CONF_010 SWJTAG_GMUX_010
#define | SWJTAG_CONF_100 SWJTAG_GMUX_100

Detailed Description

iomux map definitions

Macro Definition Documentation

◆ ADC1_ETO_MUX

#define ADC1_ETO_MUX ADC1_ETO_GMUX

adc1 external trigger ordinary conversion muxing

Definition at line 94 of file at32f413_gpio.h.

◆ ADC1_ETP_MUX

#define ADC1_ETP_MUX ADC1_ETP_GMUX

adc1 external trigger preempted conversion muxing

Definition at line 93 of file at32f413_gpio.h.

◆ ADC2_ETO_MUX

#define ADC2_ETO_MUX ADC2_ETO_GMUX

adc2 external trigger ordinary conversion muxing

Definition at line 96 of file at32f413_gpio.h.

◆ ADC2_ETP_MUX

#define ADC2_ETP_MUX ADC2_ETP_GMUX

adc2 external trigger preempted conversion muxing

Definition at line 95 of file at32f413_gpio.h.

◆ CAN_MUX_10

#define CAN_MUX_10 CAN1_GMUX_0010

can_rx(pb8), can_tx(pb9)

Definition at line 90 of file at32f413_gpio.h.

◆ I2C1_MUX

#define I2C1_MUX I2C1_GMUX_0001

i2c1_scl(pb8), i2c1_sda(pb9)

Definition at line 81 of file at32f413_gpio.h.

Referenced by i2c_lowlevel_init().

◆ PD01_MUX

#define PD01_MUX PD01_GMUX

pd0/pd1 mapping on osc_in/osc_out

Definition at line 91 of file at32f413_gpio.h.

◆ SPI1_MUX_01

#define SPI1_MUX_01 SPI1_GMUX_0001

spi1_cs/i2s1_ws(pa15), spi1_sck/i2s1_ck(pb3), spi1_miso(pb4), spi1_mosi/i2s1_sd(pb5), i2s1_mck(pb0)

Definition at line 80 of file at32f413_gpio.h.

Referenced by gpio_config(), gpio_config(), gpio_config(), gpio_config(), and gpio_config().

◆ SWJTAG_CONF_001

#define SWJTAG_CONF_001 SWJTAG_GMUX_001

full swj enabled (jtag-dp + sw-dp) but without jtrst

Definition at line 97 of file at32f413_gpio.h.

◆ SWJTAG_CONF_010

#define SWJTAG_CONF_010 SWJTAG_GMUX_010

jtag-dp disabled and sw-dp enabled

Definition at line 98 of file at32f413_gpio.h.

Referenced by main().

◆ SWJTAG_CONF_100

#define SWJTAG_CONF_100 SWJTAG_GMUX_100

full swj disabled (jtag-dp + sw-dp)

Definition at line 99 of file at32f413_gpio.h.

Referenced by main().

◆ TMR1_MUX_01

#define TMR1_MUX_01 TMR1_GMUX_0001

tmr1_ext(pa12), tmr1_ch1(pa8), tmr1_ch2(pa9), tmr1_ch3(pa10), tmr1_ch4(pa11), tmr1_brkin(pa6), tmr1_ch1c(pa7), tmr1_ch2c(pb0), tmr1_ch3c(pb1)

Definition at line 84 of file at32f413_gpio.h.

◆ TMR2_MUX_01

#define TMR2_MUX_01 TMR2_GMUX_001

tmr2_ch1_ext(pa15), tmr2_ch2(pb3), tmr2_ch3(pa2), tmr2_ch4(pa3)

Definition at line 85 of file at32f413_gpio.h.

◆ TMR2_MUX_10

#define TMR2_MUX_10 TMR2_GMUX_010

tmr2_ch1_ext(pa0), tmr2_ch2(pa1), tmr2_ch3(pb10), tmr2_ch4(pb11)

Definition at line 86 of file at32f413_gpio.h.

◆ TMR2_MUX_11

#define TMR2_MUX_11 TMR2_GMUX_011

tmr2_ch1_ext(pa15), tmr2_ch2(pb3), tmr2_ch3(pb10), tmr2_ch4(pb11)

Definition at line 87 of file at32f413_gpio.h.

◆ TMR3_MUX_10

#define TMR3_MUX_10 TMR3_GMUX_0010

tmr3_ch1(pb4), tmr3_ch2(pb5), tmr3_ch3(pb0), tmr3_ch4(pb1)

Definition at line 88 of file at32f413_gpio.h.

◆ TMR3_MUX_11

#define TMR3_MUX_11 TMR3_GMUX_0011

tmr3_ch1(pc6), tmr3_ch2(pc7), tmr3_ch3(pc8), tmr3_ch4(pc9)

Definition at line 89 of file at32f413_gpio.h.

◆ TMR5CH4_MUX

#define TMR5CH4_MUX TMR5CH4_GMUX

lick connected to tmr5_ch4 input capture for calibration

Definition at line 92 of file at32f413_gpio.h.

Referenced by main().

◆ USART1_MUX

#define USART1_MUX USART1_GMUX_0001

usart1_tx(pb6), usart1_rx(pb7)

Definition at line 82 of file at32f413_gpio.h.

◆ USART3_MUX_01

#define USART3_MUX_01 USART3_GMUX_0001

usart3_tx(pc10), usart3_rx(pc11), usart3_ck(pc12), usart3_cts(pb13), usart3_rts(pb14)

Definition at line 83 of file at32f413_gpio.h.


AT32F413 Firmwary Library: IOMUX_map2_definition

Macros
IOMUX_map2_definition
AT32F413_periph_driver » GPIO

iomux map2 definitions More...

Macros

#define EXT_SPIM_EN_MUX EXT_SPIM_GMUX_1000

Detailed Description

iomux map2 definitions

Macro Definition Documentation

◆ EXT_SPIM_EN_MUX

#define EXT_SPIM_EN_MUX EXT_SPIM_GMUX_1000

enable external spi-flash interface

Definition at line 110 of file at32f413_gpio.h.


AT32F413 Firmwary Library: IOMUX_map3_definition

Macros
IOMUX_map3_definition
AT32F413_periph_driver » GPIO

iomux map3 definitions More...

Macros

#define | TMR9_GMUX IOMUX_MAKE_VALUE(0x20, 0, 4, 0x02)
#define | TMR10_GMUX IOMUX_MAKE_VALUE(0x20, 4, 4, 0x02)
#define | TMR11_GMUX IOMUX_MAKE_VALUE(0x20, 8, 4, 0x02)

Detailed Description

iomux map3 definitions

Macro Definition Documentation

◆ TMR10_GMUX

#define TMR10_GMUX IOMUX_MAKE_VALUE(0x20, 4, 4, 0x02)

tmr10_ch1(pa6)

Definition at line 122 of file at32f413_gpio.h.

◆ TMR11_GMUX

#define TMR11_GMUX IOMUX_MAKE_VALUE(0x20, 8, 4, 0x02)

tmr11_ch1(pa7)

Definition at line 123 of file at32f413_gpio.h.

◆ TMR9_GMUX

#define TMR9_GMUX IOMUX_MAKE_VALUE(0x20, 0, 4, 0x02)

tmr9_ch1(pb14), tmr9_ch2(pb15)

Definition at line 121 of file at32f413_gpio.h.


AT32F413 Firmwary Library: IOMUX_map4_definition

Macros
IOMUX_map4_definition
AT32F413_periph_driver » GPIO

iomux map4 definitions More...

Macros

#define | TMR1_GMUX_0001 IOMUX_MAKE_VALUE(0x24, 0, 4, 0x01)
#define | TMR2_GMUX_001 IOMUX_MAKE_VALUE(0x24, 4, 3, 0x01)
#define | TMR2_GMUX_010 IOMUX_MAKE_VALUE(0x24, 4, 3, 0x02)
#define | TMR2_GMUX_011 IOMUX_MAKE_VALUE(0x24, 4, 3, 0x03)
#define | TMR2ITR1_GMUX IOMUX_MAKE_VALUE(0x24, 7, 1, 0x01)
#define | TMR3_GMUX_0010 IOMUX_MAKE_VALUE(0x24, 8, 4, 0x02)
#define | TMR3_GMUX_0011 IOMUX_MAKE_VALUE(0x24, 8, 4, 0x03)
#define | TMR5_GMUX_001 IOMUX_MAKE_VALUE(0x24, 16, 3, 0x01)
#define | TMR5CH4_GMUX IOMUX_MAKE_VALUE(0x24, 19, 1, 0x01)

Detailed Description

iomux map4 definitions

Macro Definition Documentation

◆ TMR1_GMUX_0001

#define TMR1_GMUX_0001 IOMUX_MAKE_VALUE(0x24, 0, 4, 0x01)

tmr1_ext(pa12), tmr1_ch1(pa8), tmr1_ch2(pa9), tmr1_ch3(pa10), tmr1_ch4(pa11), tmr1_brkin(pa6), tmr1_ch1c(pa7), tmr1_ch2c(pb0), tmr1_ch3c(pb1)

Definition at line 134 of file at32f413_gpio.h.

◆ TMR2_GMUX_001

#define TMR2_GMUX_001 IOMUX_MAKE_VALUE(0x24, 4, 3, 0x01)

tmr2_ch1_ext(pa15), tmr2_ch2(pb3), tmr2_ch3(pa2), tmr2_ch4(pa3)

Definition at line 135 of file at32f413_gpio.h.

◆ TMR2_GMUX_010

#define TMR2_GMUX_010 IOMUX_MAKE_VALUE(0x24, 4, 3, 0x02)

tmr2_ch1_ext(pa0), tmr2_ch2(pa1), tmr2_ch3(pb10), tmr2_ch4(pb11)

Definition at line 136 of file at32f413_gpio.h.

◆ TMR2_GMUX_011

#define TMR2_GMUX_011 IOMUX_MAKE_VALUE(0x24, 4, 3, 0x03)

tmr2_ch1_ext(pa15), tmr2_ch2(pb3), tmr2_ch3(pb10), tmr2_ch4(pb11)

Definition at line 137 of file at32f413_gpio.h.

◆ TMR2ITR1_GMUX

#define TMR2ITR1_GMUX IOMUX_MAKE_VALUE(0x24, 7, 1, 0x01)

usbdev sof as input to tmr2_int.1

Definition at line 138 of file at32f413_gpio.h.

◆ TMR3_GMUX_0010

#define TMR3_GMUX_0010 IOMUX_MAKE_VALUE(0x24, 8, 4, 0x02)

tmr3_ch1(pb4), tmr3_ch2(pb5), tmr3_ch3(pb0), tmr3_ch4(pb1)

Definition at line 139 of file at32f413_gpio.h.

◆ TMR3_GMUX_0011

#define TMR3_GMUX_0011 IOMUX_MAKE_VALUE(0x24, 8, 4, 0x03)

tmr3_ch1(pc6), tmr3_ch2(pc7), tmr3_ch3(pc8), tmr3_ch4(pc9)

Definition at line 140 of file at32f413_gpio.h.

◆ TMR5_GMUX_001

#define TMR5_GMUX_001 IOMUX_MAKE_VALUE(0x24, 16, 3, 0x01)

tmr5_ch1(pf4), tmr5_ch2(pf5)

Definition at line 141 of file at32f413_gpio.h.

◆ TMR5CH4_GMUX

#define TMR5CH4_GMUX IOMUX_MAKE_VALUE(0x24, 19, 1, 0x01)

lick connected to tmr5_ch4 input capture for calibration

Definition at line 142 of file at32f413_gpio.h.


AT32F413 Firmwary Library: IOMUX_map5_definition

Macros
IOMUX_map5_definition
AT32F413_periph_driver » GPIO

iomux map5 definitions More...

Macros

#define | I2C1_GMUX_0001 IOMUX_MAKE_VALUE(0x28, 4, 4, 0x01)
#define | I2C1_GMUX_0011 IOMUX_MAKE_VALUE(0x28, 4, 4, 0x03)
#define | I2C2_GMUX_0001 IOMUX_MAKE_VALUE(0x28, 8, 4, 0x01)
#define | I2C2_GMUX_0010 IOMUX_MAKE_VALUE(0x28, 8, 4, 0x02)
#define | I2C2_GMUX_0011 IOMUX_MAKE_VALUE(0x28, 8, 4, 0x03)
#define | SPI1_GMUX_0001 IOMUX_MAKE_VALUE(0x28, 16, 4, 0x01)
#define | SPI2_GMUX_0001 IOMUX_MAKE_VALUE(0x28, 20, 4, 0x01)

Detailed Description

iomux map5 definitions

Macro Definition Documentation

◆ I2C1_GMUX_0001

#define I2C1_GMUX_0001 IOMUX_MAKE_VALUE(0x28, 4, 4, 0x01)

i2c1_scl(pb8), i2c1_sda(pb9)

Definition at line 153 of file at32f413_gpio.h.

◆ I2C1_GMUX_0011

#define I2C1_GMUX_0011 IOMUX_MAKE_VALUE(0x28, 4, 4, 0x03)

i2c1_scl(pf6), i2c1_sda(pf7)

Definition at line 154 of file at32f413_gpio.h.

◆ I2C2_GMUX_0001

#define I2C2_GMUX_0001 IOMUX_MAKE_VALUE(0x28, 8, 4, 0x01)

i2c2_scl(pa8), i2c2_sda(pc9), i2c2_smba(pa9)

Definition at line 155 of file at32f413_gpio.h.

◆ I2C2_GMUX_0010

#define I2C2_GMUX_0010 IOMUX_MAKE_VALUE(0x28, 8, 4, 0x02)

i2c2_scl(pa8), i2c2_sda(pb4), i2c2_smba(pa9)

Definition at line 156 of file at32f413_gpio.h.

◆ I2C2_GMUX_0011

#define I2C2_GMUX_0011 IOMUX_MAKE_VALUE(0x28, 8, 4, 0x03)

i2c2_scl(pf6), i2c2_sda(pf7), i2c2_smba(pa9)

Definition at line 157 of file at32f413_gpio.h.

◆ SPI1_GMUX_0001

#define SPI1_GMUX_0001 IOMUX_MAKE_VALUE(0x28, 16, 4, 0x01)

spi1_cs/i2s1_ws(pa15), spi1_sck/i2s1_ck(pb3), spi1_miso(pb4), spi1_mosi/i2s1_sd(pb5), i2s1_mck(pb6)

Definition at line 158 of file at32f413_gpio.h.

◆ SPI2_GMUX_0001

#define SPI2_GMUX_0001 IOMUX_MAKE_VALUE(0x28, 20, 4, 0x01)

spi2_cs/i2s2_ws(pa15), spi2_sck/i2s2_ck(pb3), spi2_miso(pb4), spi2_mosi/i2s2_sd(pb5), i2s2_mck(pc7)

Definition at line 159 of file at32f413_gpio.h.


AT32F413 Firmwary Library: IOMUX_map6_definition

Macros
IOMUX_map6_definition
AT32F413_periph_driver » GPIO

iomux map6 definitions More...

Macros

#define | CAN1_GMUX_0010 IOMUX_MAKE_VALUE(0x2C, 0, 4, 0x02)
#define | CAN2_GMUX_0001 IOMUX_MAKE_VALUE(0x2C, 4, 4, 0x01)
#define | SDIO1_GMUX_0100 IOMUX_MAKE_VALUE(0x2C, 8, 4, 0x04)
#define | SDIO1_GMUX_0101 IOMUX_MAKE_VALUE(0x2C, 8, 4, 0x05)
#define | SDIO1_GMUX_0110 IOMUX_MAKE_VALUE(0x2C, 8, 4, 0x06)
#define | SDIO1_GMUX_0111 IOMUX_MAKE_VALUE(0x2C, 8, 4, 0x07)
#define | USART1_GMUX_0001 IOMUX_MAKE_VALUE(0x2C, 16, 4, 0x01)
#define | USART3_GMUX_0001 IOMUX_MAKE_VALUE(0x2C, 24, 4, 0x01)
#define | UART4_GMUX_0001 IOMUX_MAKE_VALUE(0x2C, 28, 4, 0x01)

Detailed Description

iomux map6 definitions

Macro Definition Documentation

◆ CAN1_GMUX_0010

#define CAN1_GMUX_0010 IOMUX_MAKE_VALUE(0x2C, 0, 4, 0x02)

can_rx(pb8), can_tx(pb9)

Definition at line 170 of file at32f413_gpio.h.

Referenced by can_gpio_config(), can_gpio_config(), and can_gpio_config().

◆ CAN2_GMUX_0001

#define CAN2_GMUX_0001 IOMUX_MAKE_VALUE(0x2C, 4, 4, 0x01)

can2_rx(pb5), can2_tx(pb6)

Definition at line 171 of file at32f413_gpio.h.

◆ SDIO1_GMUX_0100

#define SDIO1_GMUX_0100 IOMUX_MAKE_VALUE(0x2C, 8, 4, 0x04)

sdio1_ck(pc4), sdio1_cmd(pc5), sdio1_d0(pc0), sdio1_d1(pc1), sdio1_d2(pc2), sdio1_d3(pc3), sdio1_d4(pa4), sdio1_d5(pa5), sdio1_d6(pa6), sdio1_d7(pa7)

Definition at line 172 of file at32f413_gpio.h.

◆ SDIO1_GMUX_0101

#define SDIO1_GMUX_0101 IOMUX_MAKE_VALUE(0x2C, 8, 4, 0x05)

sdio1_ck(pc4), sdio1_cmd(pc5), sdio1_d0(pa4), sdio1_d1(pa5), sdio1_d2(pa6), sdio1_d3(pa7)

Definition at line 173 of file at32f413_gpio.h.

◆ SDIO1_GMUX_0110

#define SDIO1_GMUX_0110 IOMUX_MAKE_VALUE(0x2C, 8, 4, 0x06)

sdio1_ck(pa2), sdio1_cmd(pa3), sdio1_d0(pc0), sdio1_d1(pc1), sdio1_d2(pc2), sdio1_d3(pc3), sdio1_d4(pa4), sdio1_d5(pa5), sdio1_d6(pa6), sdio1_d7(pa7)

Definition at line 174 of file at32f413_gpio.h.

◆ SDIO1_GMUX_0111

#define SDIO1_GMUX_0111 IOMUX_MAKE_VALUE(0x2C, 8, 4, 0x07)

sdio1_ck(pa2), sdio1_cmd(pa3), sdio1_d0(pa4), sdio1_d1(pa5), sdio1_d2(pa6), sdio1_d3(pa7)

Definition at line 175 of file at32f413_gpio.h.

◆ UART4_GMUX_0001

#define UART4_GMUX_0001 IOMUX_MAKE_VALUE(0x2C, 28, 4, 0x01)

uart4_tx(pf4), uart4_rx(pf5)

Definition at line 178 of file at32f413_gpio.h.

◆ USART1_GMUX_0001

#define USART1_GMUX_0001 IOMUX_MAKE_VALUE(0x2C, 16, 4, 0x01)

usart1_tx(pb6), usart1_rx(pb7)

Definition at line 176 of file at32f413_gpio.h.

◆ USART3_GMUX_0001

#define USART3_GMUX_0001 IOMUX_MAKE_VALUE(0x2C, 24, 4, 0x01)

usart3_tx(pc10), usart3_rx(pc11), usart3_ck(pc12), usart3_cts(pb13), usart3_rts(pb14)

Definition at line 177 of file at32f413_gpio.h.


AT32F413 Firmwary Library: IOMUX_map7_definition

Macros
IOMUX_map7_definition
AT32F413_periph_driver » GPIO

iomux map7 definitions More...

Macros

#define | EXT_SPIM_GMUX_1000 IOMUX_MAKE_VALUE(0x30, 0, 4, 0x08)
#define | EXT_SPIM_GMUX_1001 IOMUX_MAKE_VALUE(0x30, 0, 4, 0x09)
#define | ADC1_ETP_GMUX IOMUX_MAKE_VALUE(0x30, 4, 1, 0x01)
#define | ADC1_ETO_GMUX IOMUX_MAKE_VALUE(0x30, 5, 1, 0x01)
#define | ADC2_ETP_GMUX IOMUX_MAKE_VALUE(0x30, 8, 1, 0x01)
#define | ADC2_ETO_GMUX IOMUX_MAKE_VALUE(0x30, 9, 1, 0x01)
#define | SWJTAG_GMUX_001 IOMUX_MAKE_VALUE(0x30, 16, 3, 0x01)
#define | SWJTAG_GMUX_010 IOMUX_MAKE_VALUE(0x30, 16, 3, 0x02)
#define | SWJTAG_GMUX_100 IOMUX_MAKE_VALUE(0x30, 16, 3, 0x04)
#define | PD01_GMUX IOMUX_MAKE_VALUE(0x30, 20, 1, 0x01)

Detailed Description

iomux map7 definitions

Macro Definition Documentation

◆ ADC1_ETO_GMUX

#define ADC1_ETO_GMUX IOMUX_MAKE_VALUE(0x30, 5, 1, 0x01)

adc1 external trigger ordinary conversion muxing

Definition at line 192 of file at32f413_gpio.h.

◆ ADC1_ETP_GMUX

#define ADC1_ETP_GMUX IOMUX_MAKE_VALUE(0x30, 4, 1, 0x01)

adc1 external trigger preempted conversion muxing

Definition at line 191 of file at32f413_gpio.h.

◆ ADC2_ETO_GMUX

#define ADC2_ETO_GMUX IOMUX_MAKE_VALUE(0x30, 9, 1, 0x01)

adc2 external trigger ordinary conversion muxing

Definition at line 194 of file at32f413_gpio.h.

◆ ADC2_ETP_GMUX

#define ADC2_ETP_GMUX IOMUX_MAKE_VALUE(0x30, 8, 1, 0x01)

adc2 external trigger preempted conversion muxing

Definition at line 193 of file at32f413_gpio.h.

◆ EXT_SPIM_GMUX_1000

#define EXT_SPIM_GMUX_1000 IOMUX_MAKE_VALUE(0x30, 0, 4, 0x08)

spim_sck(pb1), spim_cs(pa8), spim_io0(pa11), spim_io1(pa12), spim_io2(pb7), spim_sio3(pb6)

Definition at line 189 of file at32f413_gpio.h.

◆ EXT_SPIM_GMUX_1001

#define EXT_SPIM_GMUX_1001 IOMUX_MAKE_VALUE(0x30, 0, 4, 0x09)

spim_sck(pb1), spim_cs(pa8), spim_io0(pb10), spim_io1(pb11), spim_io2(pb7), spim_sio3(pb6)

Definition at line 190 of file at32f413_gpio.h.

Referenced by spim_init().

◆ PD01_GMUX

#define PD01_GMUX IOMUX_MAKE_VALUE(0x30, 20, 1, 0x01)

pd0/pd1 mapping on osc_in/osc_out

Definition at line 198 of file at32f413_gpio.h.

◆ SWJTAG_GMUX_001

#define SWJTAG_GMUX_001 IOMUX_MAKE_VALUE(0x30, 16, 3, 0x01)

full swj enabled (jtag-dp + sw-dp) but without jtrst

Definition at line 195 of file at32f413_gpio.h.

◆ SWJTAG_GMUX_010

#define SWJTAG_GMUX_010 IOMUX_MAKE_VALUE(0x30, 16, 3, 0x02)

jtag-dp disabled and sw-dp enabled

Definition at line 196 of file at32f413_gpio.h.

Referenced by gpio_config(), gpio_config(), gpio_config(), gpio_config(), and gpio_config().

◆ SWJTAG_GMUX_100

#define SWJTAG_GMUX_100 IOMUX_MAKE_VALUE(0x30, 16, 3, 0x04)

full swj disabled (jtag-dp + sw-dp)

Definition at line 197 of file at32f413_gpio.h.


AT32F413 Firmwary Library: GPIO_exported_types

Data Structures | Enumerations
GPIO_exported_types
AT32F413_periph_driver » GPIO

Data Structures

struct | gpio_init_type
gpio init type More...
struct | gpio_type
type define gpio register all More...
struct | iomux_type
type define iomux register all More...

Enumerations

enum | gpio_mode_type { GPIO_MODE_INPUT = 0x00 , GPIO_MODE_OUTPUT = 0x10 , GPIO_MODE_MUX = 0x08 , GPIO_MODE_ANALOG = 0x03 }
gpio mode select More...
enum | gpio_drive_type { GPIO_DRIVE_STRENGTH_STRONGER = 0x01 , GPIO_DRIVE_STRENGTH_MODERATE = 0x02 , GPIO_DRIVE_STRENGTH_MAXIMUM = 0x03 }
gpio output drive strength select More...
enum | gpio_output_type { GPIO_OUTPUT_PUSH_PULL = 0x00 , GPIO_OUTPUT_OPEN_DRAIN = 0x04 }
gpio output type More...
enum | gpio_pull_type { GPIO_PULL_NONE = 0x0004 , GPIO_PULL_UP = 0x0018 , GPIO_PULL_DOWN = 0x0028 }
gpio pull type More...
enum gpio_pins_source_type {
GPIO_PINS_SOURCE0 = 0x00 , GPIO_PINS_SOURCE1 = 0x01 , GPIO_PINS_SOURCE2 = 0x02 , GPIO_PINS_SOURCE3 = 0x03 ,
GPIO_PINS_SOURCE4 = 0x04 , GPIO_PINS_SOURCE5 = 0x05 , GPIO_PINS_SOURCE6 = 0x06 , GPIO_PINS_SOURCE7 = 0x07 ,
GPIO_PINS_SOURCE8 = 0x08 , GPIO_PINS_SOURCE9 = 0x09 , GPIO_PINS_SOURCE10 = 0x0A , GPIO_PINS_SOURCE11 = 0x0B ,
GPIO_PINS_SOURCE12 = 0x0C , GPIO_PINS_SOURCE13 = 0x0D , GPIO_PINS_SOURCE14 = 0x0E , GPIO_PINS_SOURCE15 = 0x0F
}
gpio pins source type More...
enum gpio_port_source_type {
GPIO_PORT_SOURCE_GPIOA = 0x00 , GPIO_PORT_SOURCE_GPIOB = 0x01 , GPIO_PORT_SOURCE_GPIOC = 0x02 , GPIO_PORT_SOURCE_GPIOD = 0x03 ,
GPIO_PORT_SOURCE_GPIOF = 0x05
}
gpio port source type More...

Detailed Description

Enumeration Type Documentation

◆ gpio_drive_type

enum gpio_drive_type

gpio output drive strength select

Enumerator
GPIO_DRIVE_STRENGTH_STRONGER | stronger sourcing/sinking strength
GPIO_DRIVE_STRENGTH_MODERATE | moderate sourcing/sinking strength
GPIO_DRIVE_STRENGTH_MAXIMUM | maximum sourcing/sinking strength

Definition at line 222 of file at32f413_gpio.h.

◆ gpio_mode_type

enum gpio_mode_type

gpio mode select

Enumerator
GPIO_MODE_INPUT | gpio input mode
GPIO_MODE_OUTPUT | gpio output mode
GPIO_MODE_MUX | gpio mux function mode
GPIO_MODE_ANALOG | gpio analog in/out mode

Definition at line 211 of file at32f413_gpio.h.

◆ gpio_output_type

enum gpio_output_type

gpio output type

Enumerator
GPIO_OUTPUT_PUSH_PULL | output push-pull
GPIO_OUTPUT_OPEN_DRAIN | output open-drain

Definition at line 232 of file at32f413_gpio.h.

◆ gpio_pins_source_type

enum gpio_pins_source_type

gpio pins source type

Enumerator
GPIO_PINS_SOURCE0 | gpio pins source number 0
GPIO_PINS_SOURCE1 | gpio pins source number 1
GPIO_PINS_SOURCE2 | gpio pins source number 2
GPIO_PINS_SOURCE3 | gpio pins source number 3
GPIO_PINS_SOURCE4 | gpio pins source number 4
GPIO_PINS_SOURCE5 | gpio pins source number 5
GPIO_PINS_SOURCE6 | gpio pins source number 6
GPIO_PINS_SOURCE7 | gpio pins source number 7
GPIO_PINS_SOURCE8 | gpio pins source number 8
GPIO_PINS_SOURCE9 | gpio pins source number 9
GPIO_PINS_SOURCE10 | gpio pins source number 10
GPIO_PINS_SOURCE11 | gpio pins source number 11
GPIO_PINS_SOURCE12 | gpio pins source number 12
GPIO_PINS_SOURCE13 | gpio pins source number 13
GPIO_PINS_SOURCE14 | gpio pins source number 14
GPIO_PINS_SOURCE15 | gpio pins source number 15

Definition at line 251 of file at32f413_gpio.h.

◆ gpio_port_source_type

enum gpio_port_source_type

gpio port source type

Enumerator
GPIO_PORT_SOURCE_GPIOA | gpio port source gpioa
GPIO_PORT_SOURCE_GPIOB | gpio port source gpiob
GPIO_PORT_SOURCE_GPIOC | gpio port source gpioc
GPIO_PORT_SOURCE_GPIOD | gpio port source gpiod
GPIO_PORT_SOURCE_GPIOF | gpio port source gpiof

Definition at line 274 of file at32f413_gpio.h.

◆ gpio_pull_type

enum gpio_pull_type

gpio pull type

Enumerator
GPIO_PULL_NONE | floating for input, no pull for output
GPIO_PULL_UP | pull-up
GPIO_PULL_DOWN | pull-down

Definition at line 241 of file at32f413_gpio.h.


AT32F413 Firmwary Library: gpio_init_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
gpio_init_type Struct Reference
AT32F413_periph_driver » GPIO » GPIO_exported_types

gpio init type More...

#include <at32f413_gpio.h>

Data Fields

uint32_t gpio_pins
gpio_output_type gpio_out_type
gpio_pull_type gpio_pull
gpio_mode_type gpio_mode
gpio_drive_type gpio_drive_strength

Detailed Description

gpio init type

Definition at line 286 of file at32f413_gpio.h.

Field Documentation

◆ gpio_drive_strength

gpio_drive_type gpio_init_type::gpio_drive_strength

drive strength selection

Definition at line 292 of file at32f413_gpio.h.

Referenced by at32_button_init(), at32_led_init(), can_gpio_config(), can_gpio_config(), can_gpio_config(), clkout_config(), clkout_config(), clkout_config(), codec_i2s_init(), exint_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_configuration(), gpio_default_para_init(), gpio_init(), i2c_lowlevel_init(), main(), mclk_tmr1_init(), rs485_config(), sd_init(), spiflash_init(), spim_init(), swj_dp_config(), tmr1_config(), uart_init(), uart_print_init(), usart1_config(), usart_configuration(), usart_gpio_config(), and usart_spi_configuration().

◆ gpio_mode

gpio_mode_type gpio_init_type::gpio_mode

mode selection

Definition at line 291 of file at32f413_gpio.h.

Referenced by at32_button_init(), at32_led_init(), can_gpio_config(), can_gpio_config(), can_gpio_config(), clkout_config(), clkout_config(), clkout_config(), codec_i2s_init(), exint_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_configuration(), gpio_default_para_init(), gpio_init(), i2c_lowlevel_init(), main(), mclk_tmr1_init(), rs485_config(), sd_init(), spiflash_init(), spim_init(), swj_dp_config(), tmr1_config(), uart_init(), uart_print_init(), usart1_config(), usart_configuration(), usart_gpio_config(), and usart_spi_configuration().

◆ gpio_out_type

gpio_output_type gpio_init_type::gpio_out_type

output type selection

Definition at line 289 of file at32f413_gpio.h.

Referenced by at32_button_init(), at32_led_init(), can_gpio_config(), can_gpio_config(), can_gpio_config(), clkout_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_configuration(), gpio_default_para_init(), gpio_init(), i2c_lowlevel_init(), main(), rs485_config(), sd_init(), spiflash_init(), spim_init(), swj_dp_config(), tmr1_config(), uart_init(), uart_print_init(), usart1_config(), usart_configuration(), usart_gpio_config(), and usart_spi_configuration().

◆ gpio_pins

uint32_t gpio_init_type::gpio_pins

pins number selection

Definition at line 288 of file at32f413_gpio.h.

Referenced by at32_button_init(), at32_led_init(), can_gpio_config(), can_gpio_config(), can_gpio_config(), clkout_config(), clkout_config(), clkout_config(), codec_i2s_init(), exint_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_configuration(), gpio_default_para_init(), gpio_init(), i2c_lowlevel_init(), main(), mclk_tmr1_init(), rs485_config(), sd_init(), spiflash_init(), spim_init(), swj_dp_config(), tmr1_config(), uart_init(), uart_print_init(), usart1_config(), usart_configuration(), usart_gpio_config(), and usart_spi_configuration().

◆ gpio_pull

gpio_pull_type gpio_init_type::gpio_pull

pull type selection

Definition at line 290 of file at32f413_gpio.h.

Referenced by at32_button_init(), at32_led_init(), can_gpio_config(), can_gpio_config(), can_gpio_config(), clkout_config(), clkout_config(), clkout_config(), codec_i2s_init(), exint_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_configuration(), gpio_default_para_init(), gpio_init(), i2c_lowlevel_init(), main(), rs485_config(), sd_init(), spiflash_init(), spim_init(), swj_dp_config(), tmr1_config(), uart_init(), uart_print_init(), usart1_config(), usart_configuration(), usart_gpio_config(), and usart_spi_configuration().

The documentation for this struct was generated from the following file:
  • at32f413_gpio.h


AT32F413 Firmwary Library: gpio_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
gpio_type Struct Reference
AT32F413_periph_driver » GPIO » GPIO_exported_types

type define gpio register all More...

#include <at32f413_gpio.h>

Data Fields

union {
__IO uint32_t cfglr
struct {
__IO uint32_t iomc0: 2
__IO uint32_t iofc0: 2
__IO uint32_t iomc1: 2
__IO uint32_t iofc1: 2
__IO uint32_t iomc2: 2
__IO uint32_t iofc2: 2
__IO uint32_t iomc3: 2
__IO uint32_t iofc3: 2
__IO uint32_t iomc4: 2
__IO uint32_t iofc4: 2
__IO uint32_t iomc5: 2
__IO uint32_t iofc5: 2
__IO uint32_t iomc6: 2
__IO uint32_t iofc6: 2
__IO uint32_t iomc7: 2
__IO uint32_t iofc7: 2
} cfglr_bit
};
gpio cfglr register, offset:0x00
union {
__IO uint32_t cfghr
struct {
__IO uint32_t iomc8: 2
__IO uint32_t iofc8: 2
__IO uint32_t iomc9: 2
__IO uint32_t iofc9: 2
__IO uint32_t iomc10: 2
__IO uint32_t iofc10: 2
__IO uint32_t iomc11: 2
__IO uint32_t iofc11: 2
__IO uint32_t iomc12: 2
__IO uint32_t iofc12: 2
__IO uint32_t iomc13: 2
__IO uint32_t iofc13: 2
__IO uint32_t iomc14: 2
__IO uint32_t iofc14: 2
__IO uint32_t iomc15: 2
__IO uint32_t iofc15: 2
} cfghr_bit
};
gpio cfghr register, offset:0x04
union {
__IO uint32_t idt
struct {
__IO uint32_t idt0: 1
__IO uint32_t idt1: 1
__IO uint32_t idt2: 1
__IO uint32_t idt3: 1
__IO uint32_t idt4: 1
__IO uint32_t idt5: 1
__IO uint32_t idt6: 1
__IO uint32_t idt7: 1
__IO uint32_t idt8: 1
__IO uint32_t idt9: 1
__IO uint32_t idt10: 1
__IO uint32_t idt11: 1
__IO uint32_t idt12: 1
__IO uint32_t idt13: 1
__IO uint32_t idt14: 1
__IO uint32_t idt15: 1
__IO uint32_t reserved1: 16
} idt_bit
};
gpio idt register, offset:0x08
union {
__IO uint32_t odt
struct {
__IO uint32_t odt0: 1
__IO uint32_t odt1: 1
__IO uint32_t odt2: 1
__IO uint32_t odt3: 1
__IO uint32_t odt4: 1
__IO uint32_t odt5: 1
__IO uint32_t odt6: 1
__IO uint32_t odt7: 1
__IO uint32_t odt8: 1
__IO uint32_t odt9: 1
__IO uint32_t odt10: 1
__IO uint32_t odt11: 1
__IO uint32_t odt12: 1
__IO uint32_t odt13: 1
__IO uint32_t odt14: 1
__IO uint32_t odt15: 1
__IO uint32_t reserved1: 16
} odt_bit
};
gpio odt register, offset:0x0C
union {
__IO uint32_t scr
struct {
__IO uint32_t iosb0: 1
__IO uint32_t iosb1: 1
__IO uint32_t iosb2: 1
__IO uint32_t iosb3: 1
__IO uint32_t iosb4: 1
__IO uint32_t iosb5: 1
__IO uint32_t iosb6: 1
__IO uint32_t iosb7: 1
__IO uint32_t iosb8: 1
__IO uint32_t iosb9: 1
__IO uint32_t iosb10: 1
__IO uint32_t iosb11: 1
__IO uint32_t iosb12: 1
__IO uint32_t iosb13: 1
__IO uint32_t iosb14: 1
__IO uint32_t iosb15: 1
__IO uint32_t iocb0: 1
__IO uint32_t iocb1: 1
__IO uint32_t iocb2: 1
__IO uint32_t iocb3: 1
__IO uint32_t iocb4: 1
__IO uint32_t iocb5: 1
__IO uint32_t iocb6: 1
__IO uint32_t iocb7: 1
__IO uint32_t iocb8: 1
__IO uint32_t iocb9: 1
__IO uint32_t iocb10: 1
__IO uint32_t iocb11: 1
__IO uint32_t iocb12: 1
__IO uint32_t iocb13: 1
__IO uint32_t iocb14: 1
__IO uint32_t iocb15: 1
} scr_bit
};
gpio scr register, offset:0x10
union {
__IO uint32_t clr
struct {
__IO uint32_t iocb0: 1
__IO uint32_t iocb1: 1
__IO uint32_t iocb2: 1
__IO uint32_t iocb3: 1
__IO uint32_t iocb4: 1
__IO uint32_t iocb5: 1
__IO uint32_t iocb6: 1
__IO uint32_t iocb7: 1
__IO uint32_t iocb8: 1
__IO uint32_t iocb9: 1
__IO uint32_t iocb10: 1
__IO uint32_t iocb11: 1
__IO uint32_t iocb12: 1
__IO uint32_t iocb13: 1
__IO uint32_t iocb14: 1
__IO uint32_t iocb15: 1
__IO uint32_t reserved1: 16
} clr_bit
};
gpio clr register, offset:0x14
union {
__IO uint32_t wpr
struct {
__IO uint32_t wpen0: 1
__IO uint32_t wpen1: 1
__IO uint32_t wpen2: 1
__IO uint32_t wpen3: 1
__IO uint32_t wpen4: 1
__IO uint32_t wpen5: 1
__IO uint32_t wpen6: 1
__IO uint32_t wpen7: 1
__IO uint32_t wpen8: 1
__IO uint32_t wpen9: 1
__IO uint32_t wpen10: 1
__IO uint32_t wpen11: 1
__IO uint32_t wpen12: 1
__IO uint32_t wpen13: 1
__IO uint32_t wpen14: 1
__IO uint32_t wpen15: 1
__IO uint32_t wpseq: 1
__IO uint32_t reserved1: 15
} wpr_bit
};
gpio wpr register, offset:0x18

Detailed Description

type define gpio register all

Definition at line 298 of file at32f413_gpio.h.

Field Documentation

◆ [union]

union { ... } gpio_type

gpio cfglr register, offset:0x00

◆ [union]

union { ... } gpio_type

gpio cfghr register, offset:0x04

◆ [union]

union { ... } gpio_type

gpio idt register, offset:0x08

◆ [union]

union { ... } gpio_type

gpio odt register, offset:0x0C

◆ [union]

union { ... } gpio_type

gpio scr register, offset:0x10

◆ [union]

union { ... } gpio_type

gpio clr register, offset:0x14

◆ [union]

union { ... } gpio_type

gpio wpr register, offset:0x18

◆ cfghr

__IO uint32_t gpio_type::cfghr

Definition at line 332 of file at32f413_gpio.h.

Referenced by gpio_init().

◆ [struct]

struct { ... } gpio_type::cfghr_bit

◆ cfglr

__IO uint32_t gpio_type::cfglr

Definition at line 305 of file at32f413_gpio.h.

Referenced by gpio_init().

◆ [struct]

struct { ... } gpio_type::cfglr_bit

◆ clr

__IO uint32_t gpio_type::clr

Definition at line 458 of file at32f413_gpio.h.

Referenced by at32_led_on(), gpio_bits_reset(), gpio_bits_write(), and gpio_init().

◆ [struct]

struct { ... } gpio_type::clr_bit

◆ idt

__IO uint32_t gpio_type::idt

Definition at line 359 of file at32f413_gpio.h.

Referenced by gpio_input_data_bit_read(), and gpio_input_data_read().

◆ idt0

__IO uint32_t gpio_type::idt0

Definition at line 362 of file at32f413_gpio.h.

◆ idt1

__IO uint32_t gpio_type::idt1

Definition at line 363 of file at32f413_gpio.h.

◆ idt10

__IO uint32_t gpio_type::idt10

Definition at line 372 of file at32f413_gpio.h.

◆ idt11

__IO uint32_t gpio_type::idt11

Definition at line 373 of file at32f413_gpio.h.

◆ idt12

__IO uint32_t gpio_type::idt12

Definition at line 374 of file at32f413_gpio.h.

◆ idt13

__IO uint32_t gpio_type::idt13

Definition at line 375 of file at32f413_gpio.h.

◆ idt14

__IO uint32_t gpio_type::idt14

Definition at line 376 of file at32f413_gpio.h.

◆ idt15

__IO uint32_t gpio_type::idt15

Definition at line 377 of file at32f413_gpio.h.

◆ idt2

__IO uint32_t gpio_type::idt2

Definition at line 364 of file at32f413_gpio.h.

◆ idt3

__IO uint32_t gpio_type::idt3

Definition at line 365 of file at32f413_gpio.h.

◆ idt4

__IO uint32_t gpio_type::idt4

Definition at line 366 of file at32f413_gpio.h.

◆ idt5

__IO uint32_t gpio_type::idt5

Definition at line 367 of file at32f413_gpio.h.

◆ idt6

__IO uint32_t gpio_type::idt6

Definition at line 368 of file at32f413_gpio.h.

◆ idt7

__IO uint32_t gpio_type::idt7

Definition at line 369 of file at32f413_gpio.h.

◆ idt8

__IO uint32_t gpio_type::idt8

Definition at line 370 of file at32f413_gpio.h.

◆ idt9

__IO uint32_t gpio_type::idt9

Definition at line 371 of file at32f413_gpio.h.

◆ [struct]

struct { ... } gpio_type::idt_bit

◆ iocb0

__IO uint32_t gpio_type::iocb0

Definition at line 434 of file at32f413_gpio.h.

◆ iocb1

__IO uint32_t gpio_type::iocb1

Definition at line 435 of file at32f413_gpio.h.

◆ iocb10

__IO uint32_t gpio_type::iocb10

Definition at line 444 of file at32f413_gpio.h.

◆ iocb11

__IO uint32_t gpio_type::iocb11

Definition at line 445 of file at32f413_gpio.h.

◆ iocb12

__IO uint32_t gpio_type::iocb12

Definition at line 446 of file at32f413_gpio.h.

◆ iocb13

__IO uint32_t gpio_type::iocb13

Definition at line 447 of file at32f413_gpio.h.

◆ iocb14

__IO uint32_t gpio_type::iocb14

Definition at line 448 of file at32f413_gpio.h.

◆ iocb15

__IO uint32_t gpio_type::iocb15

Definition at line 449 of file at32f413_gpio.h.

◆ iocb2

__IO uint32_t gpio_type::iocb2

Definition at line 436 of file at32f413_gpio.h.

◆ iocb3

__IO uint32_t gpio_type::iocb3

Definition at line 437 of file at32f413_gpio.h.

◆ iocb4

__IO uint32_t gpio_type::iocb4

Definition at line 438 of file at32f413_gpio.h.

◆ iocb5

__IO uint32_t gpio_type::iocb5

Definition at line 439 of file at32f413_gpio.h.

◆ iocb6

__IO uint32_t gpio_type::iocb6

Definition at line 440 of file at32f413_gpio.h.

◆ iocb7

__IO uint32_t gpio_type::iocb7

Definition at line 441 of file at32f413_gpio.h.

◆ iocb8

__IO uint32_t gpio_type::iocb8

Definition at line 442 of file at32f413_gpio.h.

◆ iocb9

__IO uint32_t gpio_type::iocb9

Definition at line 443 of file at32f413_gpio.h.

◆ iofc0

__IO uint32_t gpio_type::iofc0

Definition at line 309 of file at32f413_gpio.h.

◆ iofc1

__IO uint32_t gpio_type::iofc1

Definition at line 311 of file at32f413_gpio.h.

◆ iofc10

__IO uint32_t gpio_type::iofc10

Definition at line 340 of file at32f413_gpio.h.

◆ iofc11

__IO uint32_t gpio_type::iofc11

Definition at line 342 of file at32f413_gpio.h.

◆ iofc12

__IO uint32_t gpio_type::iofc12

Definition at line 344 of file at32f413_gpio.h.

◆ iofc13

__IO uint32_t gpio_type::iofc13

Definition at line 346 of file at32f413_gpio.h.

◆ iofc14

__IO uint32_t gpio_type::iofc14

Definition at line 348 of file at32f413_gpio.h.

◆ iofc15

__IO uint32_t gpio_type::iofc15

Definition at line 350 of file at32f413_gpio.h.

◆ iofc2

__IO uint32_t gpio_type::iofc2

Definition at line 313 of file at32f413_gpio.h.

◆ iofc3

__IO uint32_t gpio_type::iofc3

Definition at line 315 of file at32f413_gpio.h.

◆ iofc4

__IO uint32_t gpio_type::iofc4

Definition at line 317 of file at32f413_gpio.h.

◆ iofc5

__IO uint32_t gpio_type::iofc5

Definition at line 319 of file at32f413_gpio.h.

◆ iofc6

__IO uint32_t gpio_type::iofc6

Definition at line 321 of file at32f413_gpio.h.

◆ iofc7

__IO uint32_t gpio_type::iofc7

Definition at line 323 of file at32f413_gpio.h.

◆ iofc8

__IO uint32_t gpio_type::iofc8

Definition at line 336 of file at32f413_gpio.h.

◆ iofc9

__IO uint32_t gpio_type::iofc9

Definition at line 338 of file at32f413_gpio.h.

◆ iomc0

__IO uint32_t gpio_type::iomc0

Definition at line 308 of file at32f413_gpio.h.

◆ iomc1

__IO uint32_t gpio_type::iomc1

Definition at line 310 of file at32f413_gpio.h.

◆ iomc10

__IO uint32_t gpio_type::iomc10

Definition at line 339 of file at32f413_gpio.h.

◆ iomc11

__IO uint32_t gpio_type::iomc11

Definition at line 341 of file at32f413_gpio.h.

◆ iomc12

__IO uint32_t gpio_type::iomc12

Definition at line 343 of file at32f413_gpio.h.

◆ iomc13

__IO uint32_t gpio_type::iomc13

Definition at line 345 of file at32f413_gpio.h.

◆ iomc14

__IO uint32_t gpio_type::iomc14

Definition at line 347 of file at32f413_gpio.h.

◆ iomc15

__IO uint32_t gpio_type::iomc15

Definition at line 349 of file at32f413_gpio.h.

◆ iomc2

__IO uint32_t gpio_type::iomc2

Definition at line 312 of file at32f413_gpio.h.

◆ iomc3

__IO uint32_t gpio_type::iomc3

Definition at line 314 of file at32f413_gpio.h.

◆ iomc4

__IO uint32_t gpio_type::iomc4

Definition at line 316 of file at32f413_gpio.h.

◆ iomc5

__IO uint32_t gpio_type::iomc5

Definition at line 318 of file at32f413_gpio.h.

◆ iomc6

__IO uint32_t gpio_type::iomc6

Definition at line 320 of file at32f413_gpio.h.

◆ iomc7

__IO uint32_t gpio_type::iomc7

Definition at line 322 of file at32f413_gpio.h.

◆ iomc8

__IO uint32_t gpio_type::iomc8

Definition at line 335 of file at32f413_gpio.h.

◆ iomc9

__IO uint32_t gpio_type::iomc9

Definition at line 337 of file at32f413_gpio.h.

◆ iosb0

__IO uint32_t gpio_type::iosb0

Definition at line 418 of file at32f413_gpio.h.

◆ iosb1

__IO uint32_t gpio_type::iosb1

Definition at line 419 of file at32f413_gpio.h.

◆ iosb10

__IO uint32_t gpio_type::iosb10

Definition at line 428 of file at32f413_gpio.h.

◆ iosb11

__IO uint32_t gpio_type::iosb11

Definition at line 429 of file at32f413_gpio.h.

◆ iosb12

__IO uint32_t gpio_type::iosb12

Definition at line 430 of file at32f413_gpio.h.

◆ iosb13

__IO uint32_t gpio_type::iosb13

Definition at line 431 of file at32f413_gpio.h.

◆ iosb14

__IO uint32_t gpio_type::iosb14

Definition at line 432 of file at32f413_gpio.h.

◆ iosb15

__IO uint32_t gpio_type::iosb15

Definition at line 433 of file at32f413_gpio.h.

◆ iosb2

__IO uint32_t gpio_type::iosb2

Definition at line 420 of file at32f413_gpio.h.

◆ iosb3

__IO uint32_t gpio_type::iosb3

Definition at line 421 of file at32f413_gpio.h.

◆ iosb4

__IO uint32_t gpio_type::iosb4

Definition at line 422 of file at32f413_gpio.h.

◆ iosb5

__IO uint32_t gpio_type::iosb5

Definition at line 423 of file at32f413_gpio.h.

◆ iosb6

__IO uint32_t gpio_type::iosb6

Definition at line 424 of file at32f413_gpio.h.

◆ iosb7

__IO uint32_t gpio_type::iosb7

Definition at line 425 of file at32f413_gpio.h.

◆ iosb8

__IO uint32_t gpio_type::iosb8

Definition at line 426 of file at32f413_gpio.h.

◆ iosb9

__IO uint32_t gpio_type::iosb9

Definition at line 427 of file at32f413_gpio.h.

◆ odt

__IO uint32_t gpio_type::odt

Definition at line 387 of file at32f413_gpio.h.

Referenced by at32_led_toggle(), gpio_bits_toggle(), gpio_output_data_bit_read(), gpio_output_data_read(), gpio_pins_toggle(), and gpio_port_write().

◆ odt0

__IO uint32_t gpio_type::odt0

Definition at line 390 of file at32f413_gpio.h.

◆ odt1

__IO uint32_t gpio_type::odt1

Definition at line 391 of file at32f413_gpio.h.

◆ odt10

__IO uint32_t gpio_type::odt10

Definition at line 400 of file at32f413_gpio.h.

◆ odt11

__IO uint32_t gpio_type::odt11

Definition at line 401 of file at32f413_gpio.h.

◆ odt12

__IO uint32_t gpio_type::odt12

Definition at line 402 of file at32f413_gpio.h.

◆ odt13

__IO uint32_t gpio_type::odt13

Definition at line 403 of file at32f413_gpio.h.

◆ odt14

__IO uint32_t gpio_type::odt14

Definition at line 404 of file at32f413_gpio.h.

◆ odt15

__IO uint32_t gpio_type::odt15

Definition at line 405 of file at32f413_gpio.h.

◆ odt2

__IO uint32_t gpio_type::odt2

Definition at line 392 of file at32f413_gpio.h.

◆ odt3

__IO uint32_t gpio_type::odt3

Definition at line 393 of file at32f413_gpio.h.

◆ odt4

__IO uint32_t gpio_type::odt4

Definition at line 394 of file at32f413_gpio.h.

◆ odt5

__IO uint32_t gpio_type::odt5

Definition at line 395 of file at32f413_gpio.h.

◆ odt6

__IO uint32_t gpio_type::odt6

Definition at line 396 of file at32f413_gpio.h.

◆ odt7

__IO uint32_t gpio_type::odt7

Definition at line 397 of file at32f413_gpio.h.

◆ odt8

__IO uint32_t gpio_type::odt8

Definition at line 398 of file at32f413_gpio.h.

◆ odt9

__IO uint32_t gpio_type::odt9

Definition at line 399 of file at32f413_gpio.h.

◆ [struct]

struct { ... } gpio_type::odt_bit

◆ reserved1

__IO uint32_t gpio_type::reserved1

Definition at line 378 of file at32f413_gpio.h.

◆ scr

__IO uint32_t gpio_type::scr

Definition at line 415 of file at32f413_gpio.h.

Referenced by at32_led_off(), gpio_bits_set(), gpio_bits_toggle(), gpio_bits_write(), and gpio_init().

◆ [struct]

struct { ... } gpio_type::scr_bit

◆ wpen0

__IO uint32_t gpio_type::wpen0

Definition at line 489 of file at32f413_gpio.h.

◆ wpen1

__IO uint32_t gpio_type::wpen1

Definition at line 490 of file at32f413_gpio.h.

◆ wpen10

__IO uint32_t gpio_type::wpen10

Definition at line 499 of file at32f413_gpio.h.

◆ wpen11

__IO uint32_t gpio_type::wpen11

Definition at line 500 of file at32f413_gpio.h.

◆ wpen12

__IO uint32_t gpio_type::wpen12

Definition at line 501 of file at32f413_gpio.h.

◆ wpen13

__IO uint32_t gpio_type::wpen13

Definition at line 502 of file at32f413_gpio.h.

◆ wpen14

__IO uint32_t gpio_type::wpen14

Definition at line 503 of file at32f413_gpio.h.

◆ wpen15

__IO uint32_t gpio_type::wpen15

Definition at line 504 of file at32f413_gpio.h.

◆ wpen2

__IO uint32_t gpio_type::wpen2

Definition at line 491 of file at32f413_gpio.h.

◆ wpen3

__IO uint32_t gpio_type::wpen3

Definition at line 492 of file at32f413_gpio.h.

◆ wpen4

__IO uint32_t gpio_type::wpen4

Definition at line 493 of file at32f413_gpio.h.

◆ wpen5

__IO uint32_t gpio_type::wpen5

Definition at line 494 of file at32f413_gpio.h.

◆ wpen6

__IO uint32_t gpio_type::wpen6

Definition at line 495 of file at32f413_gpio.h.

◆ wpen7

__IO uint32_t gpio_type::wpen7

Definition at line 496 of file at32f413_gpio.h.

◆ wpen8

__IO uint32_t gpio_type::wpen8

Definition at line 497 of file at32f413_gpio.h.

◆ wpen9

__IO uint32_t gpio_type::wpen9

Definition at line 498 of file at32f413_gpio.h.

◆ wpr

__IO uint32_t gpio_type::wpr

Definition at line 486 of file at32f413_gpio.h.

Referenced by gpio_pin_wp_config().

◆ [struct]

struct { ... } gpio_type::wpr_bit

◆ wpseq

__IO uint32_t gpio_type::wpseq

Definition at line 505 of file at32f413_gpio.h.

The documentation for this struct was generated from the following file:
  • at32f413_gpio.h


AT32F413 Firmwary Library: iomux_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
iomux_type Struct Reference
AT32F413_periph_driver » GPIO » GPIO_exported_types

type define iomux register all More...

#include <at32f413_gpio.h>

Data Fields

union {
__IO uint32_t evtout
struct {
__IO uint32_t selpin: 4
__IO uint32_t selport: 3
__IO uint32_t evoen: 1
__IO uint32_t reserved1: 24
} evtout_bit
};
mux event control register, offset:0x00
union {
__IO uint32_t remap
struct {
__IO uint32_t spi1_mux_l: 1
__IO uint32_t i2c1_mux: 1
__IO uint32_t usart1_mux: 1
__IO uint32_t reserved1: 1
__IO uint32_t usart3_mux: 2
__IO uint32_t tmr1_mux: 2
__IO uint32_t tmr2_mux: 2
__IO uint32_t tmr3_mux: 2
__IO uint32_t reserved2: 1
__IO uint32_t can_mux: 2
__IO uint32_t pd01_mux: 1
__IO uint32_t tmr5ch4_mux: 1
__IO uint32_t adc1_extrgpre_mux: 1
__IO uint32_t adc1_extrgord_mux: 1
__IO uint32_t adc2_extrgpre_mux: 1
__IO uint32_t adc2_extrgord_mux: 1
__IO uint32_t reserved3: 3
__IO uint32_t swjtag_conf: 3
__IO uint32_t reserved4: 4
__IO uint32_t spi1_mux_h: 1
} remap_bit
};
iomux remap register, offset:0x04
union {
__IO uint32_t exintc1
struct {
__IO uint32_t exint0: 4
__IO uint32_t exint1: 4
__IO uint32_t exint2: 4
__IO uint32_t exint3: 4
__IO uint32_t reserved1: 16
} exintc1_bit
};
mux external interrupt configuration register 1, offset:0x08
union {
__IO uint32_t exintc2
struct {
__IO uint32_t exint4: 4
__IO uint32_t exint5: 4
__IO uint32_t exint6: 4
__IO uint32_t exint7: 4
__IO uint32_t reserved1: 16
} exintc2_bit
};
mux external interrupt configuration register 2, offset:0x0c
union {
__IO uint32_t exintc3
struct {
__IO uint32_t exint8: 4
__IO uint32_t exint9: 4
__IO uint32_t exint10: 4
__IO uint32_t exint11: 4
__IO uint32_t reserved1: 16
} exintc3_bit
};
mux external interrupt configuration register 3, offset:0x10
union {
__IO uint32_t exintc4
struct {
__IO uint32_t exint12: 4
__IO uint32_t exint13: 4
__IO uint32_t exint14: 4
__IO uint32_t exint15: 4
__IO uint32_t reserved1: 16
} exintc4_bit
};
mux external interrupt configuration register 4, offset:0x14
union {
__IO uint32_t remap2
struct {
__IO uint32_t reserved1: 21
__IO uint32_t ext_spim_en_mux: 1
__IO uint32_t reserved2: 10
} remap2_bit
};
iomux remap register 2, offset:0x1C
union {
__IO uint32_t remap3
struct {
__IO uint32_t tmr9_gmux: 4
__IO uint32_t tmr10_gmux: 4
__IO uint32_t tmr11_gmux: 4
__IO uint32_t reserved1: 20
} remap3_bit
};
iomux remap register 3, offset:0x20
union {
__IO uint32_t remap4
struct {
__IO uint32_t tmr1_gmux: 4
__IO uint32_t tmr2_gmux: 3
__IO uint32_t tmr2itr1_gmux: 1
__IO uint32_t tmr3_gmux: 4
__IO uint32_t reserved1: 4
__IO uint32_t tmr5_gmux: 3
__IO uint32_t tmr5ch4_gmux: 1
__IO uint32_t reserved2: 12
} remap4_bit
};
iomux remap register 4, offset:0x24
union {
__IO uint32_t remap5
struct {
__IO uint32_t reserved1: 4
__IO uint32_t i2c1_gmux: 4
__IO uint32_t i2c2_gmux: 4
__IO uint32_t reserved2: 4
__IO uint32_t spi1_gmux: 4
__IO uint32_t spi2_gmux: 4
__IO uint32_t reserved3: 8
} remap5_bit
};
iomux remap register 5, offset:0x28
union {
__IO uint32_t remap6
struct {
__IO uint32_t can1_gmux: 4
__IO uint32_t can2_gmux: 4
__IO uint32_t sdio1_gmux: 4
__IO uint32_t reserved1: 4
__IO uint32_t usart1_gmux: 4
__IO uint32_t reserved2: 4
__IO uint32_t usart3_gmux: 4
__IO uint32_t uart4_gmux: 4
} remap6_bit
};
iomux remap register 6, offset:0x2C
union {
__IO uint32_t remap7
struct {
__IO uint32_t ext_spim_gmux: 3
__IO uint32_t ext_spim_gen: 1
__IO uint32_t adc1_etp_gmux: 1
__IO uint32_t adc1_eto_gmux: 1
__IO uint32_t reserved1: 2
__IO uint32_t adc2_etp_gmux: 1
__IO uint32_t adc2_eto_gmux: 1
__IO uint32_t reserved2: 6
__IO uint32_t swjtag_gmux: 3
__IO uint32_t reserved3: 1
__IO uint32_t pd01_gmux: 1
__IO uint32_t reserved4: 11
} remap7_bit
};
iomux remap register 7, offset:0x30

Detailed Description

type define iomux register all

Definition at line 515 of file at32f413_gpio.h.

Field Documentation

◆ [union]

union { ... } iomux_type

mux event control register, offset:0x00

◆ [union]

union { ... } iomux_type

iomux remap register, offset:0x04

◆ [union]

union { ... } iomux_type

mux external interrupt configuration register 1, offset:0x08

◆ [union]

union { ... } iomux_type

mux external interrupt configuration register 2, offset:0x0c

◆ [union]

union { ... } iomux_type

mux external interrupt configuration register 3, offset:0x10

◆ [union]

union { ... } iomux_type

mux external interrupt configuration register 4, offset:0x14

◆ [union]

union { ... } iomux_type

iomux remap register 2, offset:0x1C

◆ [union]

union { ... } iomux_type

iomux remap register 3, offset:0x20

◆ [union]

union { ... } iomux_type

iomux remap register 4, offset:0x24

◆ [union]

union { ... } iomux_type

iomux remap register 5, offset:0x28

◆ [union]

union { ... } iomux_type

iomux remap register 6, offset:0x2C

◆ [union]

union { ... } iomux_type

iomux remap register 7, offset:0x30

◆ adc1_eto_gmux

__IO uint32_t iomux_type::adc1_eto_gmux

Definition at line 728 of file at32f413_gpio.h.

◆ adc1_etp_gmux

__IO uint32_t iomux_type::adc1_etp_gmux

Definition at line 727 of file at32f413_gpio.h.

◆ adc1_extrgord_mux

__IO uint32_t iomux_type::adc1_extrgord_mux

Definition at line 553 of file at32f413_gpio.h.

◆ adc1_extrgpre_mux

__IO uint32_t iomux_type::adc1_extrgpre_mux

Definition at line 552 of file at32f413_gpio.h.

◆ adc2_eto_gmux

__IO uint32_t iomux_type::adc2_eto_gmux

Definition at line 731 of file at32f413_gpio.h.

◆ adc2_etp_gmux

__IO uint32_t iomux_type::adc2_etp_gmux

Definition at line 730 of file at32f413_gpio.h.

◆ adc2_extrgord_mux

__IO uint32_t iomux_type::adc2_extrgord_mux

Definition at line 555 of file at32f413_gpio.h.

◆ adc2_extrgpre_mux

__IO uint32_t iomux_type::adc2_extrgpre_mux

Definition at line 554 of file at32f413_gpio.h.

◆ can1_gmux

__IO uint32_t iomux_type::can1_gmux

Definition at line 706 of file at32f413_gpio.h.

◆ can2_gmux

__IO uint32_t iomux_type::can2_gmux

Definition at line 707 of file at32f413_gpio.h.

◆ can_mux

__IO uint32_t iomux_type::can_mux

Definition at line 549 of file at32f413_gpio.h.

◆ evoen

__IO uint32_t iomux_type::evoen

Definition at line 527 of file at32f413_gpio.h.

◆ evtout

__IO uint32_t iomux_type::evtout

Definition at line 522 of file at32f413_gpio.h.

◆ [struct]

struct { ... } iomux_type::evtout_bit

◆ exint0

__IO uint32_t iomux_type::exint0

Definition at line 571 of file at32f413_gpio.h.

◆ exint1

__IO uint32_t iomux_type::exint1

Definition at line 572 of file at32f413_gpio.h.

◆ exint10

__IO uint32_t iomux_type::exint10

Definition at line 605 of file at32f413_gpio.h.

◆ exint11

__IO uint32_t iomux_type::exint11

Definition at line 606 of file at32f413_gpio.h.

◆ exint12

__IO uint32_t iomux_type::exint12

Definition at line 619 of file at32f413_gpio.h.

◆ exint13

__IO uint32_t iomux_type::exint13

Definition at line 620 of file at32f413_gpio.h.

◆ exint14

__IO uint32_t iomux_type::exint14

Definition at line 621 of file at32f413_gpio.h.

◆ exint15

__IO uint32_t iomux_type::exint15

Definition at line 622 of file at32f413_gpio.h.

◆ exint2

__IO uint32_t iomux_type::exint2

Definition at line 573 of file at32f413_gpio.h.

◆ exint3

__IO uint32_t iomux_type::exint3

Definition at line 574 of file at32f413_gpio.h.

◆ exint4

__IO uint32_t iomux_type::exint4

Definition at line 587 of file at32f413_gpio.h.

◆ exint5

__IO uint32_t iomux_type::exint5

Definition at line 588 of file at32f413_gpio.h.

◆ exint6

__IO uint32_t iomux_type::exint6

Definition at line 589 of file at32f413_gpio.h.

◆ exint7

__IO uint32_t iomux_type::exint7

Definition at line 590 of file at32f413_gpio.h.

◆ exint8

__IO uint32_t iomux_type::exint8

Definition at line 603 of file at32f413_gpio.h.

◆ exint9

__IO uint32_t iomux_type::exint9

Definition at line 604 of file at32f413_gpio.h.

◆ exintc1

__IO uint32_t iomux_type::exintc1

Definition at line 568 of file at32f413_gpio.h.

◆ [struct]

struct { ... } iomux_type::exintc1_bit

◆ exintc2

__IO uint32_t iomux_type::exintc2

Definition at line 584 of file at32f413_gpio.h.

◆ [struct]

struct { ... } iomux_type::exintc2_bit

◆ exintc3

__IO uint32_t iomux_type::exintc3

Definition at line 600 of file at32f413_gpio.h.

◆ [struct]

struct { ... } iomux_type::exintc3_bit

◆ exintc4

__IO uint32_t iomux_type::exintc4

Definition at line 616 of file at32f413_gpio.h.

◆ [struct]

struct { ... } iomux_type::exintc4_bit

◆ ext_spim_en_mux

__IO uint32_t iomux_type::ext_spim_en_mux

Definition at line 641 of file at32f413_gpio.h.

◆ ext_spim_gen

__IO uint32_t iomux_type::ext_spim_gen

Definition at line 726 of file at32f413_gpio.h.

◆ ext_spim_gmux

__IO uint32_t iomux_type::ext_spim_gmux

Definition at line 725 of file at32f413_gpio.h.

◆ i2c1_gmux

__IO uint32_t iomux_type::i2c1_gmux

Definition at line 689 of file at32f413_gpio.h.

◆ i2c1_mux

__IO uint32_t iomux_type::i2c1_mux

Definition at line 541 of file at32f413_gpio.h.

◆ i2c2_gmux

__IO uint32_t iomux_type::i2c2_gmux

Definition at line 690 of file at32f413_gpio.h.

◆ pd01_gmux

__IO uint32_t iomux_type::pd01_gmux

Definition at line 735 of file at32f413_gpio.h.

◆ pd01_mux

__IO uint32_t iomux_type::pd01_mux

Definition at line 550 of file at32f413_gpio.h.

◆ remap

__IO uint32_t iomux_type::remap

Definition at line 537 of file at32f413_gpio.h.

◆ remap2

__IO uint32_t iomux_type::remap2

Definition at line 637 of file at32f413_gpio.h.

◆ [struct]

struct { ... } iomux_type::remap2_bit

◆ remap3

__IO uint32_t iomux_type::remap3

Definition at line 651 of file at32f413_gpio.h.

◆ [struct]

struct { ... } iomux_type::remap3_bit

◆ remap4

__IO uint32_t iomux_type::remap4

Definition at line 666 of file at32f413_gpio.h.

◆ [struct]

struct { ... } iomux_type::remap4_bit

◆ remap5

__IO uint32_t iomux_type::remap5

Definition at line 685 of file at32f413_gpio.h.

◆ [struct]

struct { ... } iomux_type::remap5_bit

◆ remap6

__IO uint32_t iomux_type::remap6

Definition at line 703 of file at32f413_gpio.h.

◆ [struct]

struct { ... } iomux_type::remap6_bit

◆ remap7

__IO uint32_t iomux_type::remap7

Definition at line 722 of file at32f413_gpio.h.

◆ [struct]

struct { ... } iomux_type::remap7_bit

◆ [struct]

struct { ... } iomux_type::remap_bit

◆ reserved1

__IO uint32_t iomux_type::reserved1

iomux reserved1 register, offset:0x18

Definition at line 528 of file at32f413_gpio.h.

◆ reserved2

__IO uint32_t iomux_type::reserved2

Definition at line 548 of file at32f413_gpio.h.

◆ reserved3

__IO uint32_t iomux_type::reserved3

Definition at line 556 of file at32f413_gpio.h.

◆ reserved4

__IO uint32_t iomux_type::reserved4

Definition at line 558 of file at32f413_gpio.h.

◆ sdio1_gmux

__IO uint32_t iomux_type::sdio1_gmux

Definition at line 708 of file at32f413_gpio.h.

◆ selpin

__IO uint32_t iomux_type::selpin

Definition at line 525 of file at32f413_gpio.h.

◆ selport

__IO uint32_t iomux_type::selport

Definition at line 526 of file at32f413_gpio.h.

◆ spi1_gmux

__IO uint32_t iomux_type::spi1_gmux

Definition at line 692 of file at32f413_gpio.h.

◆ spi1_mux_h

__IO uint32_t iomux_type::spi1_mux_h

Definition at line 559 of file at32f413_gpio.h.

◆ spi1_mux_l

__IO uint32_t iomux_type::spi1_mux_l

Definition at line 540 of file at32f413_gpio.h.

◆ spi2_gmux

__IO uint32_t iomux_type::spi2_gmux

Definition at line 693 of file at32f413_gpio.h.

◆ swjtag_conf

__IO uint32_t iomux_type::swjtag_conf

Definition at line 557 of file at32f413_gpio.h.

◆ swjtag_gmux

__IO uint32_t iomux_type::swjtag_gmux

Definition at line 733 of file at32f413_gpio.h.

◆ tmr10_gmux

__IO uint32_t iomux_type::tmr10_gmux

Definition at line 655 of file at32f413_gpio.h.

◆ tmr11_gmux

__IO uint32_t iomux_type::tmr11_gmux

Definition at line 656 of file at32f413_gpio.h.

◆ tmr1_gmux

__IO uint32_t iomux_type::tmr1_gmux

Definition at line 669 of file at32f413_gpio.h.

◆ tmr1_mux

__IO uint32_t iomux_type::tmr1_mux

Definition at line 545 of file at32f413_gpio.h.

◆ tmr2_gmux

__IO uint32_t iomux_type::tmr2_gmux

Definition at line 670 of file at32f413_gpio.h.

◆ tmr2_mux

__IO uint32_t iomux_type::tmr2_mux

Definition at line 546 of file at32f413_gpio.h.

◆ tmr2itr1_gmux

__IO uint32_t iomux_type::tmr2itr1_gmux

Definition at line 671 of file at32f413_gpio.h.

◆ tmr3_gmux

__IO uint32_t iomux_type::tmr3_gmux

Definition at line 672 of file at32f413_gpio.h.

◆ tmr3_mux

__IO uint32_t iomux_type::tmr3_mux

Definition at line 547 of file at32f413_gpio.h.

◆ tmr5_gmux

__IO uint32_t iomux_type::tmr5_gmux

Definition at line 674 of file at32f413_gpio.h.

◆ tmr5ch4_gmux

__IO uint32_t iomux_type::tmr5ch4_gmux

Definition at line 675 of file at32f413_gpio.h.

◆ tmr5ch4_mux

__IO uint32_t iomux_type::tmr5ch4_mux

Definition at line 551 of file at32f413_gpio.h.

◆ tmr9_gmux

__IO uint32_t iomux_type::tmr9_gmux

Definition at line 654 of file at32f413_gpio.h.

◆ uart4_gmux

__IO uint32_t iomux_type::uart4_gmux

Definition at line 713 of file at32f413_gpio.h.

◆ usart1_gmux

__IO uint32_t iomux_type::usart1_gmux

Definition at line 710 of file at32f413_gpio.h.

◆ usart1_mux

__IO uint32_t iomux_type::usart1_mux

Definition at line 542 of file at32f413_gpio.h.

◆ usart3_gmux

__IO uint32_t iomux_type::usart3_gmux

Definition at line 712 of file at32f413_gpio.h.

◆ usart3_mux

__IO uint32_t iomux_type::usart3_mux

Definition at line 544 of file at32f413_gpio.h.

The documentation for this struct was generated from the following file:
  • at32f413_gpio.h


AT32F413 Firmwary Library: GPIO_exported_functions

Functions
GPIO_exported_functions
AT32F413_periph_driver » GPIO

Functions

void | gpio_reset (gpio_type *gpio_x)
reset the gpio register
void | gpio_iomux_reset (void)
reset the mux functions (remap, event control and exint configuration) registers to their default values.
void | gpio_init (gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
void | gpio_default_para_init (gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
flag_status | gpio_input_data_bit_read (gpio_type *gpio_x, uint16_t pins)
read the specified input port pin.
uint16_t | gpio_input_data_read (gpio_type *gpio_x)
read the specified gpio input data port.
flag_status | gpio_output_data_bit_read (gpio_type *gpio_x, uint16_t pins)
read the specified output port pin.
uint16_t | gpio_output_data_read (gpio_type *gpio_x)
read the specified gpio ouput data port.
void | gpio_bits_set (gpio_type *gpio_x, uint16_t pins)
set the selected data port bits.
void | gpio_bits_reset (gpio_type *gpio_x, uint16_t pins)
clear the selected data port bits.
void | gpio_bits_toggle (gpio_type *gpio_x, uint16_t pins)
toggle the selected data port bits.
void | gpio_bits_write (gpio_type *gpio_x, uint16_t pins, confirm_state bit_state)
set or clear the selected data port bit.
void | gpio_port_write (gpio_type *gpio_x, uint16_t port_value)
write data to the specified gpio data port.
void | gpio_pin_wp_config (gpio_type *gpio_x, uint16_t pins)
write protect gpio pins configuration registers.
void | gpio_event_output_config (gpio_port_source_type gpio_port_source, gpio_pins_source_type gpio_pin_source)
select the gpio pin used as event output.
void | gpio_event_output_enable (confirm_state new_state)
enable or disable the event output.
void | gpio_pin_remap_config (uint32_t gpio_remap, confirm_state new_state)
iomux remap and debug i/o configuration.
void | gpio_exint_line_config (gpio_port_source_type gpio_port_source, gpio_pins_source_type gpio_pin_source)
select the gpio pin used as exint line.

Detailed Description

Function Documentation

◆ gpio_bits_reset()

void gpio_bits_reset | ( | gpio_type * | gpio_x,
 |  | uint16_t | pins )

clear the selected data port bits.

Parameters
gpio_x to select the gpio peripheral. this parameter can be one of the following values: GPIOA, GPIOB, GPIOC, GPIOD, GPIOF.
pins gpio pin number parameter can be any combination of gpio_pin_x, gpio_pin_x as following values:
  • GPIO_PINS_0
  • GPIO_PINS_1
  • GPIO_PINS_2
  • GPIO_PINS_3
  • GPIO_PINS_4
  • GPIO_PINS_5
  • GPIO_PINS_6
  • GPIO_PINS_7
  • GPIO_PINS_8
  • GPIO_PINS_9
  • GPIO_PINS_10
  • GPIO_PINS_11
  • GPIO_PINS_12
  • GPIO_PINS_13
  • GPIO_PINS_14
  • GPIO_PINS_15
  • GPIO_PINS_ALL
Return values
none

Definition at line 340 of file at32f413_gpio.c.

Referenced by EXINT9_5_IRQHandler(), main(), rs485_config(), rs485_send_data(), and TMR2_GLOBAL_IRQHandler().

◆ gpio_bits_set()

void gpio_bits_set | ( | gpio_type * | gpio_x,
 |  | uint16_t | pins )

set the selected data port bits.

Parameters
gpio_x to select the gpio peripheral. this parameter can be one of the following values: GPIOA, GPIOB, GPIOC, GPIOD, GPIOF.
pins gpio pin number parameter can be any combination of gpio_pin_x, gpio_pin_x as following values:
  • GPIO_PINS_0
  • GPIO_PINS_1
  • GPIO_PINS_2
  • GPIO_PINS_3
  • GPIO_PINS_4
  • GPIO_PINS_5
  • GPIO_PINS_6
  • GPIO_PINS_7
  • GPIO_PINS_8
  • GPIO_PINS_9
  • GPIO_PINS_10
  • GPIO_PINS_11
  • GPIO_PINS_12
  • GPIO_PINS_13
  • GPIO_PINS_14
  • GPIO_PINS_15
  • GPIO_PINS_ALL
Return values
none

Definition at line 309 of file at32f413_gpio.c.

Referenced by EXINT9_5_IRQHandler(), main(), rs485_send_data(), and usart_configuration().

◆ gpio_bits_toggle()

void gpio_bits_toggle | ( | gpio_type * | gpio_x,
 |  | uint16_t | pins )

toggle the selected data port bits.

Parameters
gpio_x to select the gpio peripheral. this parameter can be one of the following values: GPIOA, GPIOB, GPIOC, GPIOD, GPIOF.
pins gpio pin number parameter can be any combination of gpio_pin_x, gpio_pin_x as following values:
  • GPIO_PINS_0
  • GPIO_PINS_1
  • GPIO_PINS_2
  • GPIO_PINS_3
  • GPIO_PINS_4
  • GPIO_PINS_5
  • GPIO_PINS_6
  • GPIO_PINS_7
  • GPIO_PINS_8
  • GPIO_PINS_9
  • GPIO_PINS_10
  • GPIO_PINS_11
  • GPIO_PINS_12
  • GPIO_PINS_13
  • GPIO_PINS_14
  • GPIO_PINS_15
  • GPIO_PINS_ALL
Return values
none

Definition at line 371 of file at32f413_gpio.c.

◆ gpio_bits_write()

void gpio_bits_write | ( | gpio_type * | gpio_x,
 |  | uint16_t | pins,
 |  | confirm_state | bit_state )

set or clear the selected data port bit.

Parameters
gpio_x | to select the gpio peripheral. this parameter can be one of the following values: GPIOA, GPIOB, GPIOC, GPIOD, GPIOF.
pins gpio pin number parameter can be any combination of gpio_pin_x, gpio_pin_x as following values:
  • GPIO_PINS_0
  • GPIO_PINS_1
  • GPIO_PINS_2
  • GPIO_PINS_3
  • GPIO_PINS_4
  • GPIO_PINS_5
  • GPIO_PINS_6
  • GPIO_PINS_7
  • GPIO_PINS_8
  • GPIO_PINS_9
  • GPIO_PINS_10
  • GPIO_PINS_11
  • GPIO_PINS_12
  • GPIO_PINS_13
  • GPIO_PINS_14
  • GPIO_PINS_15
  • GPIO_PINS_ALL
bit_state | specifies the value to be written to the selected bit (TRUE or FALSE).
Return values
none

Definition at line 405 of file at32f413_gpio.c.

Referenced by TMR2_GLOBAL_IRQHandler().

◆ gpio_default_para_init()

void gpio_default_para_init ( gpio_init_type * gpio_init_struct )

fill each gpio_init_type member with its default value.

Parameters
gpio_init_struct : pointer to a gpio_init_type structure which will be initialized.
Return values
none

< gpio all pins

Definition at line 167 of file at32f413_gpio.c.

Referenced by at32_button_init(), at32_led_init(), can_gpio_config(), can_gpio_config(), can_gpio_config(), clkout_config(), clkout_config(), clkout_config(), codec_i2s_init(), exint_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_configuration(), mclk_tmr1_init(), rs485_config(), spim_init(), tmr1_config(), uart_init(), uart_print_init(), usart1_config(), usart_configuration(), and usart_spi_configuration().

◆ gpio_event_output_config()

void gpio_event_output_config | ( | gpio_port_source_type | gpio_port_source,
 |  | gpio_pins_source_type | gpio_pin_source )

select the gpio pin used as event output.

Parameters
gpio_port_source select the gpio port to be used as source for event output. this parameter can be one of the following values:
  • GPIO_PORT_SOURCE_GPIOA
  • GPIO_PORT_SOURCE_GPIOB
  • GPIO_PORT_SOURCE_GPIOC
  • GPIO_PORT_SOURCE_GPIOD
  • GPIO_PORT_SOURCE_GPIOF
gpio_pin_source specifies the pin for the event output. this parameter can be one of the following values:
  • GPIO_PINS_SOURCE0
  • GPIO_PINS_SOURCE1
  • GPIO_PINS_SOURCE2
  • GPIO_PINS_SOURCE3
  • GPIO_PINS_SOURCE4
  • GPIO_PINS_SOURCE5
  • GPIO_PINS_SOURCE6
  • GPIO_PINS_SOURCE7
  • GPIO_PINS_SOURCE8
  • GPIO_PINS_SOURCE9
  • GPIO_PINS_SOURCE10
  • GPIO_PINS_SOURCE11
  • GPIO_PINS_SOURCE12
  • GPIO_PINS_SOURCE13
  • GPIO_PINS_SOURCE14
  • GPIO_PINS_SOURCE15
Return values
none

Definition at line 503 of file at32f413_gpio.c.

◆ gpio_event_output_enable()

void gpio_event_output_enable ( confirm_state new_state )

enable or disable the event output.

Parameters
confirm_state new state of the event output. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 522 of file at32f413_gpio.c.

◆ gpio_exint_line_config()

void gpio_exint_line_config | ( | gpio_port_source_type | gpio_port_source,
 |  | gpio_pins_source_type | gpio_pin_source )

select the gpio pin used as exint line.

Parameters
gpio_port_source select the gpio port to be used as source for exint. this parameter can be one of the following values:
  • GPIO_PORT_SOURCE_GPIOA
  • GPIO_PORT_SOURCE_GPIOB
  • GPIO_PORT_SOURCE_GPIOC
  • GPIO_PORT_SOURCE_GPIOD
  • GPIO_PORT_SOURCE_GPIOF
gpio_pin_source specifies the pin for the event output. this parameter can be one of the following values:
  • GPIO_PINS_SOURCE0
  • GPIO_PINS_SOURCE1
  • GPIO_PINS_SOURCE2
  • GPIO_PINS_SOURCE3
  • GPIO_PINS_SOURCE4
  • GPIO_PINS_SOURCE5
  • GPIO_PINS_SOURCE6
  • GPIO_PINS_SOURCE7
  • GPIO_PINS_SOURCE8
  • GPIO_PINS_SOURCE9
  • GPIO_PINS_SOURCE10
  • GPIO_PINS_SOURCE11
  • GPIO_PINS_SOURCE12
  • GPIO_PINS_SOURCE13
  • GPIO_PINS_SOURCE14
  • GPIO_PINS_SOURCE15
Return values
none

Definition at line 605 of file at32f413_gpio.c.

Referenced by button_exint_init(), exint_config(), exint_line0_config(), and usart_configuration().

◆ gpio_init()

void gpio_init | ( | gpio_type * | gpio_x,
 |  | gpio_init_type * | gpio_init_struct )

initialize the gpio peripheral.

Parameters
gpio_x | to select the gpio peripheral. this parameter can be one of the following values: GPIOA, GPIOB, GPIOC, GPIOD, GPIOF.
gpio_init_struct | pointer to gpio init structure.
Return values
none

Definition at line 99 of file at32f413_gpio.c.

Referenced by at32_button_init(), at32_led_init(), can_gpio_config(), can_gpio_config(), can_gpio_config(), clkout_config(), clkout_config(), clkout_config(), codec_i2s_init(), exint_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_configuration(), i2c_lowlevel_init(), main(), mclk_tmr1_init(), rs485_config(), sd_init(), spiflash_init(), spim_init(), swj_dp_config(), tmr1_config(), uart_init(), uart_print_init(), usart1_config(), usart_configuration(), usart_gpio_config(), and usart_spi_configuration().

◆ gpio_input_data_bit_read()

flag_status gpio_input_data_bit_read | ( | gpio_type * | gpio_x,
 |  | uint16_t | pins )

read the specified input port pin.

Parameters
gpio_x to select the gpio peripheral. this parameter can be one of the following values: GPIOA, GPIOB, GPIOC, GPIOD, GPIOF.
pins gpio pin number this parameter can be one of the following values:
  • GPIO_PINS_0
  • GPIO_PINS_1
  • GPIO_PINS_2
  • GPIO_PINS_3
  • GPIO_PINS_4
  • GPIO_PINS_5
  • GPIO_PINS_6
  • GPIO_PINS_7
  • GPIO_PINS_8
  • GPIO_PINS_9
  • GPIO_PINS_10
  • GPIO_PINS_11
  • GPIO_PINS_12
  • GPIO_PINS_13
  • GPIO_PINS_14
  • GPIO_PINS_15
Return values
flag_status (SET or RESET)

Definition at line 202 of file at32f413_gpio.c.

Referenced by at32_button_state(), and button_isr().

◆ gpio_input_data_read()

uint16_t gpio_input_data_read ( gpio_type * gpio_x )

read the specified gpio input data port.

Parameters
gpio_x to select the gpio peripheral. this parameter can be one of the following values: GPIOA, GPIOB, GPIOC, GPIOD, GPIOF.
Return values
gpio input data port value.

Definition at line 225 of file at32f413_gpio.c.

◆ gpio_iomux_reset()

void gpio_iomux_reset ( void )

reset the mux functions (remap, event control and exint configuration) registers to their default values.

Parameters
none
Return values
none

Definition at line 85 of file at32f413_gpio.c.

◆ gpio_output_data_bit_read()

flag_status gpio_output_data_bit_read | ( | gpio_type * | gpio_x,
 |  | uint16_t | pins )

read the specified output port pin.

Parameters
gpio_x to select the gpio peripheral. this parameter can be one of the following values: GPIOA, GPIOB, GPIOC, GPIOD, GPIOF.
pins gpio pin number this parameter can be one of the following values:
  • GPIO_PINS_0
  • GPIO_PINS_1
  • GPIO_PINS_2
  • GPIO_PINS_3
  • GPIO_PINS_4
  • GPIO_PINS_5
  • GPIO_PINS_6
  • GPIO_PINS_7
  • GPIO_PINS_8
  • GPIO_PINS_9
  • GPIO_PINS_10
  • GPIO_PINS_11
  • GPIO_PINS_12
  • GPIO_PINS_13
  • GPIO_PINS_14
  • GPIO_PINS_15
Return values
flag_status (SET or RESET)

Definition at line 255 of file at32f413_gpio.c.

Referenced by TMR2_GLOBAL_IRQHandler().

◆ gpio_output_data_read()

uint16_t gpio_output_data_read ( gpio_type * gpio_x )

read the specified gpio ouput data port.

Parameters
gpio_x to select the gpio peripheral. this parameter can be one of the following values: GPIOA, GPIOB, GPIOC, GPIOD, GPIOF.
Return values
gpio input data port value.

Definition at line 278 of file at32f413_gpio.c.

◆ gpio_pin_remap_config()

void gpio_pin_remap_config | ( | uint32_t | gpio_remap,
 |  | confirm_state | new_state )

iomux remap and debug i/o configuration.

Parameters
gpio_remap select the pin to remap. this parameter can be one of the following values:
  • SPI1_MUX_01 - I2C1_MUX - USART1_MUX - USART3_MUX_01
  • TMR1_MUX_01 - TMR2_MUX_01 - TMR2_MUX_10 - TMR2_MUX_11
  • TMR3_MUX_10 - TMR3_MUX_11 - CAN_MUX_10 - PD01_MUX
  • TMR5CH4_MUX - ADC1_EXTRGPRE_MUX - ADC1_EXTRGORD_MUX - ADC2_EXTRGPRE_MUX
  • ADC2_EXTRGORD_MUX - SWJTAG_CONF_001 - SWJTAG_CONF_010 - SWJTAG_CONF_100
  • EXT_SPIM_EN_MUX - TMR9_GMUX - TMR10_GMUX - TMR11_GMUX
  • TMR1_GMUX_0001 - TMR2_GMUX_001 - TMR2_GMUX_010 - TMR2_GMUX_011
  • TMR2ITR1_GMUX - TMR3_GMUX_0010 - TMR3_GMUX_0011 - TMR5_GMUX_001
  • TMR5CH4_GMUX - I2C1_GMUX_0001 - I2C1_GMUX_0011 - I2C2_GMUX_0001
  • I2C2_GMUX_0010 - I2C2_GMUX_0011 - SPI1_GMUX_0001 - SPI2_GMUX_0001
  • CAN1_GMUX_0010 - CAN2_GMUX_0001 - SDIO1_GMUX_0100 - SDIO1_GMUX_0101
  • SDIO1_GMUX_0110 - SDIO1_GMUX_0111 - USART1_GMUX_0001 - USART3_GMUX_0001
  • UART4_GMUX_0001 - EXT_SPIM_GMUX_1000 - EXT_SPIM_GMUX_1001 - ADC1_ETP_GMUX
  • ADC1_ETO_GMUX - ADC2_ETP_GMUX - ADC2_ETO_GMUX - SWJTAG_GMUX_001
  • SWJTAG_GMUX_010 - SWJTAG_GMUX_100 - PD01_GMUX
new_state (TRUE or FALSE)
Return values
none

Definition at line 549 of file at32f413_gpio.c.

Referenced by can_gpio_config(), can_gpio_config(), can_gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), i2c_lowlevel_init(), main(), and spim_init().

◆ gpio_pin_wp_config()

void gpio_pin_wp_config | ( | gpio_type * | gpio_x,
 |  | uint16_t | pins )

write protect gpio pins configuration registers.

Parameters
gpio_x to select the gpio peripheral. this parameter can be one of the following values: GPIOA, GPIOB, GPIOC, GPIOD, GPIOF.
pins gpio pin number this parameter can be any combination of the following:
  • GPIO_PINS_0
  • GPIO_PINS_1
  • GPIO_PINS_2
  • GPIO_PINS_3
  • GPIO_PINS_4
  • GPIO_PINS_5
  • GPIO_PINS_6
  • GPIO_PINS_7
  • GPIO_PINS_8
  • GPIO_PINS_9
  • GPIO_PINS_10
  • GPIO_PINS_11
  • GPIO_PINS_12
  • GPIO_PINS_13
  • GPIO_PINS_14
  • GPIO_PINS_15
  • GPIO_PINS_ALL
Return values
none

Definition at line 456 of file at32f413_gpio.c.

◆ gpio_port_write()

void gpio_port_write | ( | gpio_type * | gpio_x,
 |  | uint16_t | port_value )

write data to the specified gpio data port.

Parameters
gpio_x | to select the gpio peripheral. this parameter can be one of the following values: GPIOA, GPIOB, GPIOC, GPIOD, GPIOF.
port_value | specifies the value to be written to the port output data register.
Return values
none

Definition at line 425 of file at32f413_gpio.c.

◆ gpio_reset()

void gpio_reset ( gpio_type * gpio_x )

reset the gpio register

Parameters
gpio_x to select the gpio peripheral. this parameter can be one of the following values: GPIOA, GPIOB, GPIOC, GPIOD, GPIOF.
Return values
none

Definition at line 50 of file at32f413_gpio.c.


AT32F413 Firmwary Library: GPIO_private_functions

Functions
GPIO_private_functions
AT32F413_periph_driver » GPIO

Functions

void | gpio_reset (gpio_type *gpio_x)
reset the gpio register
void | gpio_iomux_reset (void)
reset the mux functions (remap, event control and exint configuration) registers to their default values.
void | gpio_init (gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
void | gpio_default_para_init (gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
flag_status | gpio_input_data_bit_read (gpio_type *gpio_x, uint16_t pins)
read the specified input port pin.
uint16_t | gpio_input_data_read (gpio_type *gpio_x)
read the specified gpio input data port.
flag_status | gpio_output_data_bit_read (gpio_type *gpio_x, uint16_t pins)
read the specified output port pin.
uint16_t | gpio_output_data_read (gpio_type *gpio_x)
read the specified gpio ouput data port.
void | gpio_bits_set (gpio_type *gpio_x, uint16_t pins)
set the selected data port bits.
void | gpio_bits_reset (gpio_type *gpio_x, uint16_t pins)
clear the selected data port bits.
void | gpio_bits_toggle (gpio_type *gpio_x, uint16_t pins)
toggle the selected data port bits.
void | gpio_bits_write (gpio_type *gpio_x, uint16_t pins, confirm_state bit_state)
set or clear the selected data port bit.
void | gpio_port_write (gpio_type *gpio_x, uint16_t port_value)
write data to the specified gpio data port.
void | gpio_pin_wp_config (gpio_type *gpio_x, uint16_t pins)
write protect gpio pins configuration registers.
void | gpio_event_output_config (gpio_port_source_type gpio_port_source, gpio_pins_source_type gpio_pin_source)
select the gpio pin used as event output.
void | gpio_event_output_enable (confirm_state new_state)
enable or disable the event output.
void | gpio_pin_remap_config (uint32_t gpio_remap, confirm_state new_state)
iomux remap and debug i/o configuration.
void | gpio_exint_line_config (gpio_port_source_type gpio_port_source, gpio_pins_source_type gpio_pin_source)
select the gpio pin used as exint line.

Detailed Description

Function Documentation

◆ gpio_bits_reset()

void gpio_bits_reset | ( | gpio_type * | gpio_x,
 |  | uint16_t | pins )

clear the selected data port bits.

Parameters
gpio_x to select the gpio peripheral. this parameter can be one of the following values: GPIOA, GPIOB, GPIOC, GPIOD, GPIOF.
pins gpio pin number parameter can be any combination of gpio_pin_x, gpio_pin_x as following values:
  • GPIO_PINS_0
  • GPIO_PINS_1
  • GPIO_PINS_2
  • GPIO_PINS_3
  • GPIO_PINS_4
  • GPIO_PINS_5
  • GPIO_PINS_6
  • GPIO_PINS_7
  • GPIO_PINS_8
  • GPIO_PINS_9
  • GPIO_PINS_10
  • GPIO_PINS_11
  • GPIO_PINS_12
  • GPIO_PINS_13
  • GPIO_PINS_14
  • GPIO_PINS_15
  • GPIO_PINS_ALL
Return values
none

Definition at line 340 of file at32f413_gpio.c.

Referenced by EXINT9_5_IRQHandler(), main(), rs485_config(), rs485_send_data(), and TMR2_GLOBAL_IRQHandler().

◆ gpio_bits_set()

void gpio_bits_set | ( | gpio_type * | gpio_x,
 |  | uint16_t | pins )

set the selected data port bits.

Parameters
gpio_x to select the gpio peripheral. this parameter can be one of the following values: GPIOA, GPIOB, GPIOC, GPIOD, GPIOF.
pins gpio pin number parameter can be any combination of gpio_pin_x, gpio_pin_x as following values:
  • GPIO_PINS_0
  • GPIO_PINS_1
  • GPIO_PINS_2
  • GPIO_PINS_3
  • GPIO_PINS_4
  • GPIO_PINS_5
  • GPIO_PINS_6
  • GPIO_PINS_7
  • GPIO_PINS_8
  • GPIO_PINS_9
  • GPIO_PINS_10
  • GPIO_PINS_11
  • GPIO_PINS_12
  • GPIO_PINS_13
  • GPIO_PINS_14
  • GPIO_PINS_15
  • GPIO_PINS_ALL
Return values
none

Definition at line 309 of file at32f413_gpio.c.

Referenced by EXINT9_5_IRQHandler(), main(), rs485_send_data(), and usart_configuration().

◆ gpio_bits_toggle()

void gpio_bits_toggle | ( | gpio_type * | gpio_x,
 |  | uint16_t | pins )

toggle the selected data port bits.

Parameters
gpio_x to select the gpio peripheral. this parameter can be one of the following values: GPIOA, GPIOB, GPIOC, GPIOD, GPIOF.
pins gpio pin number parameter can be any combination of gpio_pin_x, gpio_pin_x as following values:
  • GPIO_PINS_0
  • GPIO_PINS_1
  • GPIO_PINS_2
  • GPIO_PINS_3
  • GPIO_PINS_4
  • GPIO_PINS_5
  • GPIO_PINS_6
  • GPIO_PINS_7
  • GPIO_PINS_8
  • GPIO_PINS_9
  • GPIO_PINS_10
  • GPIO_PINS_11
  • GPIO_PINS_12
  • GPIO_PINS_13
  • GPIO_PINS_14
  • GPIO_PINS_15
  • GPIO_PINS_ALL
Return values
none

Definition at line 371 of file at32f413_gpio.c.

◆ gpio_bits_write()

void gpio_bits_write | ( | gpio_type * | gpio_x,
 |  | uint16_t | pins,
 |  | confirm_state | bit_state )

set or clear the selected data port bit.

Parameters
gpio_x | to select the gpio peripheral. this parameter can be one of the following values: GPIOA, GPIOB, GPIOC, GPIOD, GPIOF.
pins gpio pin number parameter can be any combination of gpio_pin_x, gpio_pin_x as following values:
  • GPIO_PINS_0
  • GPIO_PINS_1
  • GPIO_PINS_2
  • GPIO_PINS_3
  • GPIO_PINS_4
  • GPIO_PINS_5
  • GPIO_PINS_6
  • GPIO_PINS_7
  • GPIO_PINS_8
  • GPIO_PINS_9
  • GPIO_PINS_10
  • GPIO_PINS_11
  • GPIO_PINS_12
  • GPIO_PINS_13
  • GPIO_PINS_14
  • GPIO_PINS_15
  • GPIO_PINS_ALL
bit_state | specifies the value to be written to the selected bit (TRUE or FALSE).
Return values
none

Definition at line 405 of file at32f413_gpio.c.

Referenced by TMR2_GLOBAL_IRQHandler().

◆ gpio_default_para_init()

void gpio_default_para_init ( gpio_init_type * gpio_init_struct )

fill each gpio_init_type member with its default value.

Parameters
gpio_init_struct : pointer to a gpio_init_type structure which will be initialized.
Return values
none

< gpio all pins

Definition at line 167 of file at32f413_gpio.c.

Referenced by at32_button_init(), at32_led_init(), can_gpio_config(), can_gpio_config(), can_gpio_config(), clkout_config(), clkout_config(), clkout_config(), codec_i2s_init(), exint_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_configuration(), mclk_tmr1_init(), rs485_config(), spim_init(), tmr1_config(), uart_init(), uart_print_init(), usart1_config(), usart_configuration(), and usart_spi_configuration().

◆ gpio_event_output_config()

void gpio_event_output_config | ( | gpio_port_source_type | gpio_port_source,
 |  | gpio_pins_source_type | gpio_pin_source )

select the gpio pin used as event output.

Parameters
gpio_port_source select the gpio port to be used as source for event output. this parameter can be one of the following values:
  • GPIO_PORT_SOURCE_GPIOA
  • GPIO_PORT_SOURCE_GPIOB
  • GPIO_PORT_SOURCE_GPIOC
  • GPIO_PORT_SOURCE_GPIOD
  • GPIO_PORT_SOURCE_GPIOF
gpio_pin_source specifies the pin for the event output. this parameter can be one of the following values:
  • GPIO_PINS_SOURCE0
  • GPIO_PINS_SOURCE1
  • GPIO_PINS_SOURCE2
  • GPIO_PINS_SOURCE3
  • GPIO_PINS_SOURCE4
  • GPIO_PINS_SOURCE5
  • GPIO_PINS_SOURCE6
  • GPIO_PINS_SOURCE7
  • GPIO_PINS_SOURCE8
  • GPIO_PINS_SOURCE9
  • GPIO_PINS_SOURCE10
  • GPIO_PINS_SOURCE11
  • GPIO_PINS_SOURCE12
  • GPIO_PINS_SOURCE13
  • GPIO_PINS_SOURCE14
  • GPIO_PINS_SOURCE15
Return values
none

Definition at line 503 of file at32f413_gpio.c.

◆ gpio_event_output_enable()

void gpio_event_output_enable ( confirm_state new_state )

enable or disable the event output.

Parameters
confirm_state new state of the event output. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 522 of file at32f413_gpio.c.

◆ gpio_exint_line_config()

void gpio_exint_line_config | ( | gpio_port_source_type | gpio_port_source,
 |  | gpio_pins_source_type | gpio_pin_source )

select the gpio pin used as exint line.

Parameters
gpio_port_source select the gpio port to be used as source for exint. this parameter can be one of the following values:
  • GPIO_PORT_SOURCE_GPIOA
  • GPIO_PORT_SOURCE_GPIOB
  • GPIO_PORT_SOURCE_GPIOC
  • GPIO_PORT_SOURCE_GPIOD
  • GPIO_PORT_SOURCE_GPIOF
gpio_pin_source specifies the pin for the event output. this parameter can be one of the following values:
  • GPIO_PINS_SOURCE0
  • GPIO_PINS_SOURCE1
  • GPIO_PINS_SOURCE2
  • GPIO_PINS_SOURCE3
  • GPIO_PINS_SOURCE4
  • GPIO_PINS_SOURCE5
  • GPIO_PINS_SOURCE6
  • GPIO_PINS_SOURCE7
  • GPIO_PINS_SOURCE8
  • GPIO_PINS_SOURCE9
  • GPIO_PINS_SOURCE10
  • GPIO_PINS_SOURCE11
  • GPIO_PINS_SOURCE12
  • GPIO_PINS_SOURCE13
  • GPIO_PINS_SOURCE14
  • GPIO_PINS_SOURCE15
Return values
none

Definition at line 605 of file at32f413_gpio.c.

Referenced by button_exint_init(), exint_config(), exint_line0_config(), and usart_configuration().

◆ gpio_init()

void gpio_init | ( | gpio_type * | gpio_x,
 |  | gpio_init_type * | gpio_init_struct )

initialize the gpio peripheral.

Parameters
gpio_x | to select the gpio peripheral. this parameter can be one of the following values: GPIOA, GPIOB, GPIOC, GPIOD, GPIOF.
gpio_init_struct | pointer to gpio init structure.
Return values
none

Definition at line 99 of file at32f413_gpio.c.

Referenced by at32_button_init(), at32_led_init(), can_gpio_config(), can_gpio_config(), can_gpio_config(), clkout_config(), clkout_config(), clkout_config(), codec_i2s_init(), exint_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_configuration(), i2c_lowlevel_init(), main(), mclk_tmr1_init(), rs485_config(), sd_init(), spiflash_init(), spim_init(), swj_dp_config(), tmr1_config(), uart_init(), uart_print_init(), usart1_config(), usart_configuration(), usart_gpio_config(), and usart_spi_configuration().

◆ gpio_input_data_bit_read()

flag_status gpio_input_data_bit_read | ( | gpio_type * | gpio_x,
 |  | uint16_t | pins )

read the specified input port pin.

Parameters
gpio_x to select the gpio peripheral. this parameter can be one of the following values: GPIOA, GPIOB, GPIOC, GPIOD, GPIOF.
pins gpio pin number this parameter can be one of the following values:
  • GPIO_PINS_0
  • GPIO_PINS_1
  • GPIO_PINS_2
  • GPIO_PINS_3
  • GPIO_PINS_4
  • GPIO_PINS_5
  • GPIO_PINS_6
  • GPIO_PINS_7
  • GPIO_PINS_8
  • GPIO_PINS_9
  • GPIO_PINS_10
  • GPIO_PINS_11
  • GPIO_PINS_12
  • GPIO_PINS_13
  • GPIO_PINS_14
  • GPIO_PINS_15
Return values
flag_status (SET or RESET)

Definition at line 202 of file at32f413_gpio.c.

Referenced by at32_button_state(), and button_isr().

◆ gpio_input_data_read()

uint16_t gpio_input_data_read ( gpio_type * gpio_x )

read the specified gpio input data port.

Parameters
gpio_x to select the gpio peripheral. this parameter can be one of the following values: GPIOA, GPIOB, GPIOC, GPIOD, GPIOF.
Return values
gpio input data port value.

Definition at line 225 of file at32f413_gpio.c.

◆ gpio_iomux_reset()

void gpio_iomux_reset ( void )

reset the mux functions (remap, event control and exint configuration) registers to their default values.

Parameters
none
Return values
none

Definition at line 85 of file at32f413_gpio.c.

◆ gpio_output_data_bit_read()

flag_status gpio_output_data_bit_read | ( | gpio_type * | gpio_x,
 |  | uint16_t | pins )

read the specified output port pin.

Parameters
gpio_x to select the gpio peripheral. this parameter can be one of the following values: GPIOA, GPIOB, GPIOC, GPIOD, GPIOF.
pins gpio pin number this parameter can be one of the following values:
  • GPIO_PINS_0
  • GPIO_PINS_1
  • GPIO_PINS_2
  • GPIO_PINS_3
  • GPIO_PINS_4
  • GPIO_PINS_5
  • GPIO_PINS_6
  • GPIO_PINS_7
  • GPIO_PINS_8
  • GPIO_PINS_9
  • GPIO_PINS_10
  • GPIO_PINS_11
  • GPIO_PINS_12
  • GPIO_PINS_13
  • GPIO_PINS_14
  • GPIO_PINS_15
Return values
flag_status (SET or RESET)

Definition at line 255 of file at32f413_gpio.c.

Referenced by TMR2_GLOBAL_IRQHandler().

◆ gpio_output_data_read()

uint16_t gpio_output_data_read ( gpio_type * gpio_x )

read the specified gpio ouput data port.

Parameters
gpio_x to select the gpio peripheral. this parameter can be one of the following values: GPIOA, GPIOB, GPIOC, GPIOD, GPIOF.
Return values
gpio input data port value.

Definition at line 278 of file at32f413_gpio.c.

◆ gpio_pin_remap_config()

void gpio_pin_remap_config | ( | uint32_t | gpio_remap,
 |  | confirm_state | new_state )

iomux remap and debug i/o configuration.

Parameters
gpio_remap select the pin to remap. this parameter can be one of the following values:
  • SPI1_MUX_01 - I2C1_MUX - USART1_MUX - USART3_MUX_01
  • TMR1_MUX_01 - TMR2_MUX_01 - TMR2_MUX_10 - TMR2_MUX_11
  • TMR3_MUX_10 - TMR3_MUX_11 - CAN_MUX_10 - PD01_MUX
  • TMR5CH4_MUX - ADC1_EXTRGPRE_MUX - ADC1_EXTRGORD_MUX - ADC2_EXTRGPRE_MUX
  • ADC2_EXTRGORD_MUX - SWJTAG_CONF_001 - SWJTAG_CONF_010 - SWJTAG_CONF_100
  • EXT_SPIM_EN_MUX - TMR9_GMUX - TMR10_GMUX - TMR11_GMUX
  • TMR1_GMUX_0001 - TMR2_GMUX_001 - TMR2_GMUX_010 - TMR2_GMUX_011
  • TMR2ITR1_GMUX - TMR3_GMUX_0010 - TMR3_GMUX_0011 - TMR5_GMUX_001
  • TMR5CH4_GMUX - I2C1_GMUX_0001 - I2C1_GMUX_0011 - I2C2_GMUX_0001
  • I2C2_GMUX_0010 - I2C2_GMUX_0011 - SPI1_GMUX_0001 - SPI2_GMUX_0001
  • CAN1_GMUX_0010 - CAN2_GMUX_0001 - SDIO1_GMUX_0100 - SDIO1_GMUX_0101
  • SDIO1_GMUX_0110 - SDIO1_GMUX_0111 - USART1_GMUX_0001 - USART3_GMUX_0001
  • UART4_GMUX_0001 - EXT_SPIM_GMUX_1000 - EXT_SPIM_GMUX_1001 - ADC1_ETP_GMUX
  • ADC1_ETO_GMUX - ADC2_ETP_GMUX - ADC2_ETO_GMUX - SWJTAG_GMUX_001
  • SWJTAG_GMUX_010 - SWJTAG_GMUX_100 - PD01_GMUX
new_state (TRUE or FALSE)
Return values
none

Definition at line 549 of file at32f413_gpio.c.

Referenced by can_gpio_config(), can_gpio_config(), can_gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), gpio_config(), i2c_lowlevel_init(), main(), and spim_init().

◆ gpio_pin_wp_config()

void gpio_pin_wp_config | ( | gpio_type * | gpio_x,
 |  | uint16_t | pins )

write protect gpio pins configuration registers.

Parameters
gpio_x to select the gpio peripheral. this parameter can be one of the following values: GPIOA, GPIOB, GPIOC, GPIOD, GPIOF.
pins gpio pin number this parameter can be any combination of the following:
  • GPIO_PINS_0
  • GPIO_PINS_1
  • GPIO_PINS_2
  • GPIO_PINS_3
  • GPIO_PINS_4
  • GPIO_PINS_5
  • GPIO_PINS_6
  • GPIO_PINS_7
  • GPIO_PINS_8
  • GPIO_PINS_9
  • GPIO_PINS_10
  • GPIO_PINS_11
  • GPIO_PINS_12
  • GPIO_PINS_13
  • GPIO_PINS_14
  • GPIO_PINS_15
  • GPIO_PINS_ALL
Return values
none

Definition at line 456 of file at32f413_gpio.c.

◆ gpio_port_write()

void gpio_port_write | ( | gpio_type * | gpio_x,
 |  | uint16_t | port_value )

write data to the specified gpio data port.

Parameters
gpio_x | to select the gpio peripheral. this parameter can be one of the following values: GPIOA, GPIOB, GPIOC, GPIOD, GPIOF.
port_value | specifies the value to be written to the port output data register.
Return values
none

Definition at line 425 of file at32f413_gpio.c.

◆ gpio_reset()

void gpio_reset ( gpio_type * gpio_x )

reset the gpio register

Parameters
gpio_x to select the gpio peripheral. this parameter can be one of the following values: GPIOA, GPIOB, GPIOC, GPIOD, GPIOF.
Return values
none

Definition at line 50 of file at32f413_gpio.c.


AT32F413 Firmwary Library: I2C

Topics | Macros
I2C
AT32F413_periph_driver

I2C driver modules. More...

Topics

I2C_sts1_flags_definition
i2c sts1 flag
I2C_sts2_flags_definition
i2c sts2 flag
I2C_interrupts_definition
i2c interrupt
I2C_exported_types
I2C_exported_functions
I2C_private_functions

Macros

#define | I2C1 ((i2c_type *) I2C1_BASE)
#define | I2C2 ((i2c_type *) I2C2_BASE)

Detailed Description

I2C driver modules.

Macro Definition Documentation

◆ I2C1

#define I2C1 ((i2c_type *) I2C1_BASE)

Definition at line 346 of file at32f413_i2c.h.

Referenced by i2c_init(), and i2c_reset().

◆ I2C2

#define I2C2 ((i2c_type *) I2C2_BASE)

Definition at line 347 of file at32f413_i2c.h.

Referenced by i2c_init(), and i2c_reset().


AT32F413 Firmwary Library: I2C_sts1_flags_definition

Macros
I2C_sts1_flags_definition
AT32F413_periph_driver » I2C

i2c sts1 flag More...

Macros

#define | I2C_STARTF_FLAG ((uint32_t)0x00000001)
#define | I2C_ADDR7F_FLAG ((uint32_t)0x00000002)
#define | I2C_TDC_FLAG ((uint32_t)0x00000004)
#define | I2C_ADDRHF_FLAG ((uint32_t)0x00000008)
#define | I2C_STOPF_FLAG ((uint32_t)0x00000010)
#define | I2C_RDBF_FLAG ((uint32_t)0x00000040)
#define | I2C_TDBE_FLAG ((uint32_t)0x00000080)
#define | I2C_BUSERR_FLAG ((uint32_t)0x00000100)
#define | I2C_ARLOST_FLAG ((uint32_t)0x00000200)
#define | I2C_ACKFAIL_FLAG ((uint32_t)0x00000400)
#define | I2C_OUF_FLAG ((uint32_t)0x00000800)
#define | I2C_PECERR_FLAG ((uint32_t)0x00001000)
#define | I2C_TMOUT_FLAG ((uint32_t)0x00004000)
#define | I2C_ALERTF_FLAG ((uint32_t)0x00008000)

Detailed Description

i2c sts1 flag

Macro Definition Documentation

◆ I2C_ACKFAIL_FLAG

#define I2C_ACKFAIL_FLAG ((uint32_t)0x00000400)

i2c acknowledge failure flag

Definition at line 60 of file at32f413_i2c.h.

Referenced by i2c_dma_rx_irq_handler(), i2c_err_irq_handler(), i2c_interrupt_flag_get(), i2c_slave_transmit(), i2c_slave_tx_isr_int(), and i2c_wait_flag().

◆ I2C_ADDR7F_FLAG

#define I2C_ADDR7F_FLAG ((uint32_t)0x00000002)

i2c 0~7 bit address match flag

Definition at line 52 of file at32f413_i2c.h.

Referenced by eeprom_ready_check(), i2c_flag_clear(), i2c_interrupt_flag_get(), i2c_master_read_addr(), i2c_master_receive(), i2c_master_receive_dma(), i2c_master_receive_int(), i2c_master_transmit(), i2c_master_transmit_dma(), i2c_master_transmit_int(), i2c_master_write_addr(), i2c_memory_read(), i2c_memory_read_dma(), i2c_memory_read_int(), i2c_memory_write(), i2c_memory_write_dma(), i2c_memory_write_int(), i2c_slave_receive(), i2c_slave_rx_isr_int(), i2c_slave_transmit(), i2c_slave_tx_isr_int(), and i2c_slave_tx_rx_isr_dma().

◆ I2C_ADDRHF_FLAG

#define I2C_ADDRHF_FLAG ((uint32_t)0x00000008)

i2c master 9~8 bit address header match flag

Definition at line 54 of file at32f413_i2c.h.

Referenced by i2c_interrupt_flag_get(), i2c_master_read_addr(), and i2c_master_write_addr().

◆ I2C_ALERTF_FLAG

#define I2C_ALERTF_FLAG ((uint32_t)0x00008000)

i2c smbus alert flag

Definition at line 64 of file at32f413_i2c.h.

Referenced by i2c_err_irq_handler(), and i2c_interrupt_flag_get().

◆ I2C_ARLOST_FLAG

#define I2C_ARLOST_FLAG ((uint32_t)0x00000200)

i2c arbitration lost flag

Definition at line 59 of file at32f413_i2c.h.

Referenced by i2c_err_irq_handler(), and i2c_interrupt_flag_get().

◆ I2C_BUSERR_FLAG

#define I2C_BUSERR_FLAG ((uint32_t)0x00000100)

i2c bus error flag

Definition at line 58 of file at32f413_i2c.h.

Referenced by i2c_err_irq_handler(), and i2c_interrupt_flag_get().

◆ I2C_OUF_FLAG

#define I2C_OUF_FLAG ((uint32_t)0x00000800)

i2c overflow or underflow flag

Definition at line 61 of file at32f413_i2c.h.

Referenced by i2c_err_irq_handler(), and i2c_interrupt_flag_get().

◆ I2C_PECERR_FLAG

#define I2C_PECERR_FLAG ((uint32_t)0x00001000)

i2c pec receive error flag

Definition at line 62 of file at32f413_i2c.h.

Referenced by i2c_err_irq_handler(), and i2c_interrupt_flag_get().

◆ I2C_RDBF_FLAG

#define I2C_RDBF_FLAG ((uint32_t)0x00000040)

i2c receive data buffer full flag

Definition at line 56 of file at32f413_i2c.h.

Referenced by i2c_interrupt_flag_get(), i2c_master_receive(), i2c_master_rx_isr_int(), i2c_memory_read(), i2c_slave_receive(), and i2c_slave_rx_isr_int().

◆ I2C_STARTF_FLAG

#define I2C_STARTF_FLAG ((uint32_t)0x00000001)

i2c start condition generation complete flag

Definition at line 51 of file at32f413_i2c.h.

Referenced by eeprom_ready_check(), i2c_interrupt_flag_get(), i2c_master_read_addr(), and i2c_master_write_addr().

◆ I2C_STOPF_FLAG

#define I2C_STOPF_FLAG ((uint32_t)0x00000010)

i2c stop condition generation complete flag

Definition at line 55 of file at32f413_i2c.h.

Referenced by i2c_flag_clear(), i2c_interrupt_flag_get(), i2c_slave_receive(), i2c_slave_rx_isr_int(), i2c_slave_tx_rx_isr_dma(), and i2c_wait_flag().

◆ I2C_TDBE_FLAG

#define I2C_TDBE_FLAG ((uint32_t)0x00000080)

i2c transmit data buffer empty flag

Definition at line 57 of file at32f413_i2c.h.

Referenced by i2c_interrupt_flag_get(), i2c_master_transmit(), i2c_master_tx_isr_int(), i2c_memory_address_send(), i2c_memory_read(), i2c_memory_read_dma(), i2c_memory_read_int(), i2c_memory_write(), i2c_memory_write_dma(), i2c_memory_write_int(), i2c_slave_transmit(), and i2c_slave_tx_isr_int().

◆ I2C_TDC_FLAG

#define I2C_TDC_FLAG ((uint32_t)0x00000004)

i2c transmit data complete flag

Definition at line 53 of file at32f413_i2c.h.

Referenced by i2c_interrupt_flag_get(), i2c_master_receive(), i2c_master_rx_isr_int(), i2c_master_transmit(), i2c_master_tx_isr_dma(), i2c_memory_read(), and i2c_memory_write().

◆ I2C_TMOUT_FLAG

#define I2C_TMOUT_FLAG ((uint32_t)0x00004000)

i2c smbus timeout flag

Definition at line 63 of file at32f413_i2c.h.

Referenced by i2c_err_irq_handler(), and i2c_interrupt_flag_get().


AT32F413 Firmwary Library: I2C_sts2_flags_definition

Macros
I2C_sts2_flags_definition
AT32F413_periph_driver » I2C

i2c sts2 flag More...

Macros

#define | I2C_TRMODE_FLAG ((uint32_t)0x10010000)
#define | I2C_BUSYF_FLAG ((uint32_t)0x10020000)
#define | I2C_DIRF_FLAG ((uint32_t)0x10040000)
#define | I2C_GCADDRF_FLAG ((uint32_t)0x10100000)
#define | I2C_DEVADDRF_FLAG ((uint32_t)0x10200000)
#define | I2C_HOSTADDRF_FLAG ((uint32_t)0x10400000)
#define | I2C_ADDR2_FLAG ((uint32_t)0x10800000)

Detailed Description

i2c sts2 flag

Macro Definition Documentation

◆ I2C_ADDR2_FLAG

#define I2C_ADDR2_FLAG ((uint32_t)0x10800000)

i2c own address 2 received flag

Definition at line 81 of file at32f413_i2c.h.

◆ I2C_BUSYF_FLAG

#define I2C_BUSYF_FLAG ((uint32_t)0x10020000)

i2c bus busy flag transmission mode

Definition at line 76 of file at32f413_i2c.h.

Referenced by eeprom_ready_check(), i2c_master_receive(), i2c_master_receive_dma(), i2c_master_receive_int(), i2c_master_transmit(), i2c_master_transmit_dma(), i2c_master_transmit_int(), i2c_memory_read(), i2c_memory_read_dma(), i2c_memory_read_int(), i2c_memory_write(), i2c_memory_write_dma(), i2c_memory_write_int(), i2c_slave_receive(), i2c_slave_receive_dma(), i2c_slave_receive_int(), i2c_slave_transmit(), i2c_slave_transmit_dma(), i2c_slave_transmit_int(), and i2c_wait_flag().

◆ I2C_DEVADDRF_FLAG

#define I2C_DEVADDRF_FLAG ((uint32_t)0x10200000)

i2c smbus device address received flag

Definition at line 79 of file at32f413_i2c.h.

◆ I2C_DIRF_FLAG

#define I2C_DIRF_FLAG ((uint32_t)0x10040000)

i2c transmission direction flag

Definition at line 77 of file at32f413_i2c.h.

◆ I2C_GCADDRF_FLAG

#define I2C_GCADDRF_FLAG ((uint32_t)0x10100000)

i2c general call address received flag

Definition at line 78 of file at32f413_i2c.h.

◆ I2C_HOSTADDRF_FLAG

#define I2C_HOSTADDRF_FLAG ((uint32_t)0x10400000)

i2c smbus host address received flag

Definition at line 80 of file at32f413_i2c.h.

◆ I2C_TRMODE_FLAG

#define I2C_TRMODE_FLAG ((uint32_t)0x10010000)

i2c transmission mode

Definition at line 75 of file at32f413_i2c.h.


AT32F413 Firmwary Library: I2C_interrupts_definition

Macros
I2C_interrupts_definition
AT32F413_periph_driver » I2C

i2c interrupt More...

Macros

#define | I2C_DATA_INT ((uint16_t)0x0400)
#define | I2C_EVT_INT ((uint16_t)0x0200)
#define | I2C_ERR_INT ((uint16_t)0x0100)

Detailed Description

i2c interrupt

Macro Definition Documentation

◆ I2C_DATA_INT

#define I2C_DATA_INT ((uint16_t)0x0400)

i2c data transmission interrupt

Definition at line 92 of file at32f413_i2c.h.

Referenced by i2c_master_receive_int(), i2c_master_rx_isr_int(), i2c_master_transmit_int(), i2c_master_tx_isr_int(), i2c_memory_read_int(), i2c_memory_write_int(), i2c_slave_receive_int(), i2c_slave_rx_isr_int(), i2c_slave_transmit_int(), and i2c_slave_tx_isr_int().

◆ I2C_ERR_INT

#define I2C_ERR_INT ((uint16_t)0x0100)

i2c error interrupt

Definition at line 94 of file at32f413_i2c.h.

Referenced by i2c_dma_tx_irq_handler(), i2c_err_irq_handler(), i2c_master_receive_int(), i2c_master_rx_isr_int(), i2c_master_transmit_int(), i2c_master_tx_isr_int(), i2c_memory_read_int(), i2c_memory_write_int(), i2c_slave_receive_int(), i2c_slave_rx_isr_int(), i2c_slave_transmit_int(), and i2c_slave_tx_isr_int().

◆ I2C_EVT_INT

#define I2C_EVT_INT ((uint16_t)0x0200)

i2c event interrupt

Definition at line 93 of file at32f413_i2c.h.

Referenced by i2c_dma_rx_irq_handler(), i2c_dma_tx_irq_handler(), i2c_err_irq_handler(), i2c_master_receive_int(), i2c_master_rx_isr_int(), i2c_master_transmit_int(), i2c_master_tx_isr_dma(), i2c_master_tx_isr_int(), i2c_memory_read_int(), i2c_memory_write_int(), i2c_slave_receive_dma(), i2c_slave_receive_int(), i2c_slave_rx_isr_int(), i2c_slave_transmit_dma(), i2c_slave_transmit_int(), i2c_slave_tx_isr_int(), and i2c_slave_tx_rx_isr_dma().


AT32F413 Firmwary Library: I2C_exported_types

Data Structures | Enumerations
I2C_exported_types
AT32F413_periph_driver » I2C

Data Structures

struct i2c_type
type define i2c register all More...

Enumerations

enum | i2c_master_ack_type { I2C_MASTER_ACK_CURRENT = 0x00 , I2C_MASTER_ACK_NEXT = 0x01 }
i2c master receiving mode acknowledge control More...
enum | i2c_pec_position_type { I2C_PEC_POSITION_CURRENT = 0x00 , I2C_PEC_POSITION_NEXT = 0x01 }
i2c pec position set More...
enum | i2c_smbus_alert_set_type { I2C_SMBUS_ALERT_HIGH = 0x00 , I2C_SMBUS_ALERT_LOW = 0x01 }
i2c smbus alert pin set More...
enum | i2c_smbus_mode_set_type { I2C_SMBUS_MODE_DEVICE = 0x00 , I2C_SMBUS_MODE_HOST = 0x01 }
i2c smbus mode set More...
enum | i2c_fsmode_duty_cycle_type { I2C_FSMODE_DUTY_2_1 = 0x00 , I2C_FSMODE_DUTY_16_9 = 0x01 }
i2c fast mode duty cycle More...
enum | i2c_address_mode_type { I2C_ADDRESS_MODE_7BIT = 0x00 , I2C_ADDRESS_MODE_10BIT = 0x01 }
i2c address mode More...
enum | i2c_direction_type { I2C_DIRECTION_TRANSMIT = 0x00 , I2C_DIRECTION_RECEIVE = 0x01 }
i2c address direction More...

Detailed Description

Enumeration Type Documentation

◆ i2c_address_mode_type

enum i2c_address_mode_type

i2c address mode

Enumerator
I2C_ADDRESS_MODE_7BIT | 7bit address mode
I2C_ADDRESS_MODE_10BIT | 10bit address mode

Definition at line 154 of file at32f413_i2c.h.

◆ i2c_direction_type

enum i2c_direction_type

i2c address direction

Enumerator
I2C_DIRECTION_TRANSMIT | transmit mode
I2C_DIRECTION_RECEIVE | receive mode

Definition at line 163 of file at32f413_i2c.h.

◆ i2c_fsmode_duty_cycle_type

enum i2c_fsmode_duty_cycle_type

i2c fast mode duty cycle

Enumerator
I2C_FSMODE_DUTY_2_1 | duty cycle is 2:1 in fast mode
I2C_FSMODE_DUTY_16_9 | duty cycle is 16:9 in fast mode

Definition at line 145 of file at32f413_i2c.h.

◆ i2c_master_ack_type

enum i2c_master_ack_type

i2c master receiving mode acknowledge control

Enumerator
I2C_MASTER_ACK_CURRENT | acken bit acts on the current byte
I2C_MASTER_ACK_NEXT | acken bit acts on the next byte

Definition at line 107 of file at32f413_i2c.h.

◆ i2c_pec_position_type

enum i2c_pec_position_type

i2c pec position set

Enumerator
I2C_PEC_POSITION_CURRENT | the current byte is pec
I2C_PEC_POSITION_NEXT | the next byte is pec

Definition at line 116 of file at32f413_i2c.h.

◆ i2c_smbus_alert_set_type

enum i2c_smbus_alert_set_type

i2c smbus alert pin set

Enumerator
I2C_SMBUS_ALERT_HIGH | smbus alert pin set high
I2C_SMBUS_ALERT_LOW | smbus alert pin set low

Definition at line 126 of file at32f413_i2c.h.

◆ i2c_smbus_mode_set_type

enum i2c_smbus_mode_set_type

i2c smbus mode set

Enumerator
I2C_SMBUS_MODE_DEVICE | smbus device mode
I2C_SMBUS_MODE_HOST | smbus host mode

Definition at line 135 of file at32f413_i2c.h.


AT32F413 Firmwary Library: i2c_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
i2c_type Struct Reference
AT32F413_periph_driver » I2C » I2C_exported_types

type define i2c register all More...

#include <at32f413_i2c.h>

Data Fields

union {
__IO uint32_t ctrl1
struct {
__IO uint32_t i2cen: 1
__IO uint32_t permode: 1
__IO uint32_t reserved1: 1
__IO uint32_t smbmode: 1
__IO uint32_t arpen: 1
__IO uint32_t pecen: 1
__IO uint32_t gcaen: 1
__IO uint32_t stretch: 1
__IO uint32_t genstart: 1
__IO uint32_t genstop: 1
__IO uint32_t acken: 1
__IO uint32_t mackctrl: 1
__IO uint32_t pecten: 1
__IO uint32_t smbalert: 1
__IO uint32_t reserved2: 1
__IO uint32_t reset: 1
__IO uint32_t reserved3: 16
} ctrl1_bit
};
i2c ctrl1 register, offset:0x00
union {
__IO uint32_t ctrl2
struct {
__IO uint32_t clkfreq: 8
__IO uint32_t errien: 1
__IO uint32_t evtien: 1
__IO uint32_t dataien: 1
__IO uint32_t dmaen: 1
__IO uint32_t dmaend: 1
__IO uint32_t reserved1: 19
} ctrl2_bit
};
i2c ctrl2 register, offset:0x04
union {
__IO uint32_t oaddr1
struct {
__IO uint32_t addr1: 10
__IO uint32_t reserved1: 5
__IO uint32_t addr1mode: 1
__IO uint32_t reserved2: 16
} oaddr1_bit
};
i2c oaddr1 register, offset:0x08
union {
__IO uint32_t oaddr2
struct {
__IO uint32_t addr2en: 1
__IO uint32_t addr2: 7
__IO uint32_t reserved1: 24
} oaddr2_bit
};
i2c oaddr2 register, offset:0x0C
union {
__IO uint32_t dt
struct {
__IO uint32_t dt: 8
__IO uint32_t reserved1: 24
} dt_bit
};
i2c dt register, offset:0x10
union {
__IO uint32_t sts1
struct {
__IO uint32_t startf: 1
__IO uint32_t addr7f: 1
__IO uint32_t tdc: 1
__IO uint32_t addrhf: 1
__IO uint32_t stopf: 1
__IO uint32_t reserved1: 1
__IO uint32_t rdbf: 1
__IO uint32_t tdbe: 1
__IO uint32_t buserr: 1
__IO uint32_t arlost: 1
__IO uint32_t ackfail: 1
__IO uint32_t ouf: 1
__IO uint32_t pecerr: 1
__IO uint32_t reserved2: 1
__IO uint32_t tmout: 1
__IO uint32_t alertf: 1
__IO uint32_t reserved3: 16
} sts1_bit
};
i2c sts1 register, offset:0x14
union {
__IO uint32_t sts2
struct {
__IO uint32_t trmode: 1
__IO uint32_t busyf: 1
__IO uint32_t dirf: 1
__IO uint32_t reserved1: 1
__IO uint32_t gcaddrf: 1
__IO uint32_t devaddrf: 1
__IO uint32_t hostaddrf: 1
__IO uint32_t addr2: 1
__IO uint32_t pecval: 8
__IO uint32_t reserved2: 16
} sts2_bit
};
i2c sts2 register, offset:0x18
union {
__IO uint32_t clkctrl
struct {
__IO uint32_t speed: 12
__IO uint32_t reserved1: 2
__IO uint32_t dutymode: 1
__IO uint32_t speedmode: 1
__IO uint32_t reserved2: 16
} clkctrl_bit
};
i2c clkctrl register, offset:0x1C
union {
__IO uint32_t tmrise
struct {
__IO uint32_t risetime: 6
__IO uint32_t reserved1: 26
} tmrise_bit
};
i2c tmrise register, offset:0x20

Detailed Description

type define i2c register all

Definition at line 172 of file at32f413_i2c.h.

Field Documentation

◆ [union]

union { ... } i2c_type

i2c ctrl1 register, offset:0x00

◆ [union]

union { ... } i2c_type

i2c ctrl2 register, offset:0x04

◆ [union]

union { ... } i2c_type

i2c oaddr1 register, offset:0x08

◆ [union]

union { ... } i2c_type

i2c oaddr2 register, offset:0x0C

◆ [union]

union { ... } i2c_type

i2c dt register, offset:0x10

◆ [union]

union { ... } i2c_type

i2c sts1 register, offset:0x14

◆ [union]

union { ... } i2c_type

i2c sts2 register, offset:0x18

◆ [union]

union { ... } i2c_type

i2c clkctrl register, offset:0x1C

◆ [union]

union { ... } i2c_type

i2c tmrise register, offset:0x20

◆ acken

__IO uint32_t i2c_type::acken

Definition at line 192 of file at32f413_i2c.h.

Referenced by i2c_ack_enable().

◆ ackfail

__IO uint32_t i2c_type::ackfail

Definition at line 280 of file at32f413_i2c.h.

◆ addr1

__IO uint32_t i2c_type::addr1

Definition at line 228 of file at32f413_i2c.h.

Referenced by i2c_own_address1_set().

◆ addr1mode

__IO uint32_t i2c_type::addr1mode

Definition at line 230 of file at32f413_i2c.h.

Referenced by i2c_master_read_addr(), i2c_master_write_addr(), i2c_own_address1_set(), and i2c_slave_transmit().

◆ addr2

__IO uint32_t i2c_type::addr2

Definition at line 244 of file at32f413_i2c.h.

Referenced by i2c_own_address2_set().

◆ addr2en

__IO uint32_t i2c_type::addr2en

Definition at line 243 of file at32f413_i2c.h.

Referenced by i2c_own_address2_enable().

◆ addr7f

__IO uint32_t i2c_type::addr7f

Definition at line 271 of file at32f413_i2c.h.

◆ addrhf

__IO uint32_t i2c_type::addrhf

Definition at line 273 of file at32f413_i2c.h.

◆ alertf

__IO uint32_t i2c_type::alertf

Definition at line 285 of file at32f413_i2c.h.

◆ arlost

__IO uint32_t i2c_type::arlost

Definition at line 279 of file at32f413_i2c.h.

◆ arpen

__IO uint32_t i2c_type::arpen

Definition at line 186 of file at32f413_i2c.h.

Referenced by i2c_arp_mode_enable().

◆ buserr

__IO uint32_t i2c_type::buserr

Definition at line 278 of file at32f413_i2c.h.

◆ busyf

__IO uint32_t i2c_type::busyf

Definition at line 299 of file at32f413_i2c.h.

◆ clkctrl

__IO uint32_t i2c_type::clkctrl

Definition at line 316 of file at32f413_i2c.h.

◆ [struct]

struct { ... } i2c_type::clkctrl_bit

Referenced by i2c_fast_mode_duty_set(), and i2c_init().

◆ clkfreq

__IO uint32_t i2c_type::clkfreq

Definition at line 210 of file at32f413_i2c.h.

Referenced by i2c_init().

◆ ctrl1

__IO uint32_t i2c_type::ctrl1

Definition at line 179 of file at32f413_i2c.h.

◆ [struct]

struct { ... } i2c_type::ctrl1_bit

Referenced by i2c_ack_enable(), i2c_arp_mode_enable(), i2c_clock_stretch_enable(), i2c_enable(), i2c_flag_clear(), i2c_general_call_enable(), i2c_init(), i2c_master_receive_ack_set(), i2c_pec_calculate_enable(), i2c_pec_position_set(), i2c_pec_transmit_enable(), i2c_smbus_alert_set(), i2c_smbus_enable(), i2c_smbus_mode_set(), i2c_software_reset(), i2c_start_generate(), and i2c_stop_generate().

◆ ctrl2

__IO uint32_t i2c_type::ctrl2

Definition at line 207 of file at32f413_i2c.h.

Referenced by i2c_interrupt_enable().

◆ [struct]

struct { ... } i2c_type::ctrl2_bit

Referenced by i2c_dma_enable(), i2c_dma_end_transfer_set(), i2c_init(), and i2c_interrupt_flag_get().

◆ dataien

__IO uint32_t i2c_type::dataien

Definition at line 213 of file at32f413_i2c.h.

Referenced by i2c_interrupt_flag_get().

◆ devaddrf

__IO uint32_t i2c_type::devaddrf

Definition at line 303 of file at32f413_i2c.h.

◆ dirf

__IO uint32_t i2c_type::dirf

Definition at line 300 of file at32f413_i2c.h.

◆ dmaen

__IO uint32_t i2c_type::dmaen

Definition at line 214 of file at32f413_i2c.h.

Referenced by i2c_dma_enable().

◆ dmaend

__IO uint32_t i2c_type::dmaend

Definition at line 215 of file at32f413_i2c.h.

Referenced by i2c_dma_end_transfer_set().

◆ dt

__IO uint32_t i2c_type::dt

Definition at line 254 of file at32f413_i2c.h.

Referenced by i2c_7bit_address_send(), i2c_data_receive(), i2c_data_send(), and i2c_dma_config().

◆ [struct]

struct { ... } i2c_type::dt_bit

◆ dutymode

__IO uint32_t i2c_type::dutymode

Definition at line 321 of file at32f413_i2c.h.

Referenced by i2c_fast_mode_duty_set(), and i2c_init().

◆ errien

__IO uint32_t i2c_type::errien

Definition at line 211 of file at32f413_i2c.h.

Referenced by i2c_interrupt_flag_get().

◆ evtien

__IO uint32_t i2c_type::evtien

Definition at line 212 of file at32f413_i2c.h.

Referenced by i2c_interrupt_flag_get().

◆ gcaddrf

__IO uint32_t i2c_type::gcaddrf

Definition at line 302 of file at32f413_i2c.h.

◆ gcaen

__IO uint32_t i2c_type::gcaen

Definition at line 188 of file at32f413_i2c.h.

Referenced by i2c_general_call_enable().

◆ genstart

__IO uint32_t i2c_type::genstart

Definition at line 190 of file at32f413_i2c.h.

Referenced by i2c_start_generate().

◆ genstop

__IO uint32_t i2c_type::genstop

Definition at line 191 of file at32f413_i2c.h.

Referenced by i2c_stop_generate().

◆ hostaddrf

__IO uint32_t i2c_type::hostaddrf

Definition at line 304 of file at32f413_i2c.h.

◆ i2cen

__IO uint32_t i2c_type::i2cen

Definition at line 182 of file at32f413_i2c.h.

Referenced by i2c_enable(), i2c_flag_clear(), and i2c_init().

◆ mackctrl

__IO uint32_t i2c_type::mackctrl

Definition at line 193 of file at32f413_i2c.h.

Referenced by i2c_master_receive_ack_set(), and i2c_pec_position_set().

◆ oaddr1

__IO uint32_t i2c_type::oaddr1

Definition at line 225 of file at32f413_i2c.h.

◆ [struct]

struct { ... } i2c_type::oaddr1_bit

Referenced by i2c_master_read_addr(), i2c_master_write_addr(), i2c_own_address1_set(), and i2c_slave_transmit().

◆ oaddr2

__IO uint32_t i2c_type::oaddr2

Definition at line 240 of file at32f413_i2c.h.

◆ [struct]

struct { ... } i2c_type::oaddr2_bit

Referenced by i2c_own_address2_enable(), and i2c_own_address2_set().

◆ ouf

__IO uint32_t i2c_type::ouf

Definition at line 281 of file at32f413_i2c.h.

◆ pecen

__IO uint32_t i2c_type::pecen

Definition at line 187 of file at32f413_i2c.h.

Referenced by i2c_pec_calculate_enable().

◆ pecerr

__IO uint32_t i2c_type::pecerr

Definition at line 282 of file at32f413_i2c.h.

◆ pecten

__IO uint32_t i2c_type::pecten

Definition at line 194 of file at32f413_i2c.h.

Referenced by i2c_pec_transmit_enable().

◆ pecval

__IO uint32_t i2c_type::pecval

Definition at line 306 of file at32f413_i2c.h.

Referenced by i2c_pec_value_get().

◆ permode

__IO uint32_t i2c_type::permode

Definition at line 183 of file at32f413_i2c.h.

Referenced by i2c_smbus_enable().

◆ rdbf

__IO uint32_t i2c_type::rdbf

Definition at line 276 of file at32f413_i2c.h.

◆ reserved1

__IO uint32_t i2c_type::reserved1

Definition at line 184 of file at32f413_i2c.h.

◆ reserved2

__IO uint32_t i2c_type::reserved2

Definition at line 196 of file at32f413_i2c.h.

◆ reserved3

__IO uint32_t i2c_type::reserved3

Definition at line 198 of file at32f413_i2c.h.

◆ reset

__IO uint32_t i2c_type::reset

Definition at line 197 of file at32f413_i2c.h.

Referenced by i2c_software_reset().

◆ risetime

__IO uint32_t i2c_type::risetime

Definition at line 335 of file at32f413_i2c.h.

Referenced by i2c_init().

◆ smbalert

__IO uint32_t i2c_type::smbalert

Definition at line 195 of file at32f413_i2c.h.

Referenced by i2c_smbus_alert_set().

◆ smbmode

__IO uint32_t i2c_type::smbmode

Definition at line 185 of file at32f413_i2c.h.

Referenced by i2c_smbus_mode_set().

◆ speed

__IO uint32_t i2c_type::speed

Definition at line 319 of file at32f413_i2c.h.

Referenced by i2c_init().

◆ speedmode

__IO uint32_t i2c_type::speedmode

Definition at line 322 of file at32f413_i2c.h.

Referenced by i2c_init().

◆ startf

__IO uint32_t i2c_type::startf

Definition at line 270 of file at32f413_i2c.h.

◆ stopf

__IO uint32_t i2c_type::stopf

Definition at line 274 of file at32f413_i2c.h.

◆ stretch

__IO uint32_t i2c_type::stretch

Definition at line 189 of file at32f413_i2c.h.

Referenced by i2c_clock_stretch_enable().

◆ sts1

__IO uint32_t i2c_type::sts1

Definition at line 267 of file at32f413_i2c.h.

Referenced by i2c_flag_clear(), i2c_flag_get(), and i2c_interrupt_flag_get().

◆ [struct]

struct { ... } i2c_type::sts1_bit

◆ sts2

__IO uint32_t i2c_type::sts2

Definition at line 295 of file at32f413_i2c.h.

Referenced by i2c_flag_clear(), i2c_flag_get(), and i2c_interrupt_flag_get().

◆ [struct]

struct { ... } i2c_type::sts2_bit

Referenced by i2c_pec_value_get().

◆ tdbe

__IO uint32_t i2c_type::tdbe

Definition at line 277 of file at32f413_i2c.h.

◆ tdc

__IO uint32_t i2c_type::tdc

Definition at line 272 of file at32f413_i2c.h.

◆ tmout

__IO uint32_t i2c_type::tmout

Definition at line 284 of file at32f413_i2c.h.

◆ tmrise

__IO uint32_t i2c_type::tmrise

Definition at line 332 of file at32f413_i2c.h.

◆ [struct]

struct { ... } i2c_type::tmrise_bit

Referenced by i2c_init().

◆ trmode

__IO uint32_t i2c_type::trmode

Definition at line 298 of file at32f413_i2c.h.

The documentation for this struct was generated from the following file:
  • at32f413_i2c.h


AT32F413 Firmwary Library: I2C_exported_functions

Functions
I2C_exported_functions
AT32F413_periph_driver » I2C

Functions

void | i2c_reset (i2c_type *i2c_x)
reset the i2c register
void | i2c_software_reset (i2c_type *i2c_x, confirm_state new_state)
software reset.
void | i2c_init (i2c_type *i2c_x, i2c_fsmode_duty_cycle_type duty, uint32_t speed)
init i2c speed and duty cycle.
void | i2c_own_address1_set (i2c_type *i2c_x, i2c_address_mode_type mode, uint16_t address)
config own address1.
void | i2c_own_address2_set (i2c_type *i2c_x, uint8_t address)
config own address2.
void | i2c_own_address2_enable (i2c_type *i2c_x, confirm_state new_state)
enable or disable own address2.
void | i2c_smbus_enable (i2c_type *i2c_x, confirm_state new_state)
enable or disable the smbus mode
void | i2c_enable (i2c_type *i2c_x, confirm_state new_state)
enable or disable i2c periph
void | i2c_fast_mode_duty_set (i2c_type *i2c_x, i2c_fsmode_duty_cycle_type duty)
config fast mode duty cycle
void | i2c_clock_stretch_enable (i2c_type *i2c_x, confirm_state new_state)
enable or disable clock stretch.
void | i2c_ack_enable (i2c_type *i2c_x, confirm_state new_state)
enable or disable acknowledge.
void | i2c_master_receive_ack_set (i2c_type *i2c_x, i2c_master_ack_type pos)
master receiving mode acknowledge control.
void | i2c_pec_position_set (i2c_type *i2c_x, i2c_pec_position_type pos)
pec position set.
void | i2c_general_call_enable (i2c_type *i2c_x, confirm_state new_state)
enable or disable general call.
void | i2c_arp_mode_enable (i2c_type *i2c_x, confirm_state new_state)
enable or disable arp mode.
void | i2c_smbus_mode_set (i2c_type *i2c_x, i2c_smbus_mode_set_type mode)
config smbus host or device.
void | i2c_smbus_alert_set (i2c_type *i2c_x, i2c_smbus_alert_set_type level)
drive the smbus alert pin high or low.
void | i2c_pec_transmit_enable (i2c_type *i2c_x, confirm_state new_state)
enable or disable pec transfer.
void | i2c_pec_calculate_enable (i2c_type *i2c_x, confirm_state new_state)
enable or disable pec calcultetion.
uint8_t | i2c_pec_value_get (i2c_type *i2c_x)
get pec value.
void | i2c_dma_end_transfer_set (i2c_type *i2c_x, confirm_state new_state)
enable or disable if the next dma transfer will be the last one.
void | i2c_dma_enable (i2c_type *i2c_x, confirm_state new_state)
enable or disable dma requests.
void | i2c_interrupt_enable (i2c_type *i2c_x, uint16_t source, confirm_state new_state)
enable or disable interrupt
void | i2c_start_generate (i2c_type *i2c_x)
generate start condition.
void | i2c_stop_generate (i2c_type *i2c_x)
generate stop condition.
void | i2c_7bit_address_send (i2c_type *i2c_x, uint8_t address, i2c_direction_type direction)
transmit the slave address.
void | i2c_data_send (i2c_type *i2c_x, uint8_t data)
send a byte through the i2c periph.
uint8_t | i2c_data_receive (i2c_type *i2c_x)
receive a byte through the i2c periph.
flag_status | i2c_flag_get (i2c_type *i2c_x, uint32_t flag)
get flag status
flag_status | i2c_interrupt_flag_get (i2c_type *i2c_x, uint32_t flag)
get interrupt flag status
void | i2c_flag_clear (i2c_type *i2c_x, uint32_t flag)
clear flag status

Detailed Description

Function Documentation

◆ i2c_7bit_address_send()

void i2c_7bit_address_send | ( | i2c_type * | i2c_x,
 |  | uint8_t | address,
 |  | i2c_direction_type | direction )

transmit the slave address.

Parameters
i2c_x | to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
address | specifies the slave address which will be transmitted
direction this parameter can be one of the following values:
  • I2C_DIRECTION_TRANSMIT: transmit mode.
  • I2C_DIRECTION_RECEIVE: receive mode.
Return values
none.

Definition at line 509 of file at32f413_i2c.c.

Referenced by eeprom_ready_check(), i2c_master_read_addr(), and i2c_master_write_addr().

◆ i2c_ack_enable()

void i2c_ack_enable | ( | i2c_type * | i2c_x,
 |  | confirm_state | new_state )

enable or disable acknowledge.

Parameters
i2c_x | to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
new_state | (TRUE or FALSE)
Return values
none.

Definition at line 289 of file at32f413_i2c.c.

Referenced by i2c_err_irq_handler(), i2c_master_read_addr(), i2c_master_receive(), i2c_master_receive_dma(), i2c_master_receive_int(), i2c_master_rx_isr_int(), i2c_memory_read(), i2c_memory_read_dma(), i2c_memory_read_int(), i2c_slave_receive(), i2c_slave_receive_dma(), i2c_slave_receive_int(), i2c_slave_transmit(), i2c_slave_transmit_dma(), i2c_slave_transmit_int(), and i2c_slave_tx_rx_isr_dma().

◆ i2c_arp_mode_enable()

void i2c_arp_mode_enable | ( | i2c_type * | i2c_x,
 |  | confirm_state | new_state )

enable or disable arp mode.

Parameters
i2c_x | to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 347 of file at32f413_i2c.c.

◆ i2c_clock_stretch_enable()

void i2c_clock_stretch_enable | ( | i2c_type * | i2c_x,
 |  | confirm_state | new_state )

enable or disable clock stretch.

Parameters
i2c_x | to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 276 of file at32f413_i2c.c.

◆ i2c_data_receive()

uint8_t i2c_data_receive ( i2c_type * i2c_x )

receive a byte through the i2c periph.

Parameters
i2c_x to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
Return values
uint8_t received byte

Definition at line 541 of file at32f413_i2c.c.

Referenced by i2c_master_receive(), i2c_master_rx_isr_int(), i2c_memory_read(), i2c_slave_receive(), and i2c_slave_rx_isr_int().

◆ i2c_data_send()

void i2c_data_send | ( | i2c_type * | i2c_x,
 |  | uint8_t | data )

send a byte through the i2c periph.

Parameters
i2c_x | to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
data | byte to be transmitted.
Return values
none

Definition at line 529 of file at32f413_i2c.c.

Referenced by i2c_master_read_addr(), i2c_master_transmit(), i2c_master_tx_isr_int(), i2c_master_write_addr(), i2c_memory_address_send(), i2c_memory_write(), i2c_slave_transmit(), and i2c_slave_tx_isr_int().

◆ i2c_dma_enable()

void i2c_dma_enable | ( | i2c_type * | i2c_x,
 |  | confirm_state | new_state )

enable or disable dma requests.

Parameters
i2c_x | to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 443 of file at32f413_i2c.c.

Referenced by i2c_dma_rx_irq_handler(), i2c_dma_tx_irq_handler(), i2c_master_receive_dma(), i2c_master_transmit_dma(), i2c_memory_read_dma(), i2c_memory_write_dma(), i2c_slave_receive_dma(), and i2c_slave_transmit_dma().

◆ i2c_dma_end_transfer_set()

void i2c_dma_end_transfer_set | ( | i2c_type * | i2c_x,
 |  | confirm_state | new_state )

enable or disable if the next dma transfer will be the last one.

Parameters
i2c_x | to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 430 of file at32f413_i2c.c.

Referenced by i2c_master_receive_dma(), and i2c_memory_read_dma().

◆ i2c_enable()

void i2c_enable | ( | i2c_type * | i2c_x,
 |  | confirm_state | new_state )

enable or disable i2c periph

Parameters
i2c_x | to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 247 of file at32f413_i2c.c.

Referenced by i2c_config().

◆ i2c_fast_mode_duty_set()

void i2c_fast_mode_duty_set | ( | i2c_type * | i2c_x,
 |  | i2c_fsmode_duty_cycle_type | duty )

config fast mode duty cycle

Parameters
i2c_x to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
duty this parameter can be one of the following values:
  • I2C_FSMODE_DUTY_2_1: duty cycle 2:1
  • I2C_FSMODE_DUTY_16_9: duty cycle 16:9
Return values
none

Definition at line 263 of file at32f413_i2c.c.

◆ i2c_flag_clear()

void i2c_flag_clear | ( | i2c_type * | i2c_x,
 |  | uint32_t | flag )

clear flag status

Parameters
i2c_x to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2, I2C3.
flag this parameter can be any combination of the following values:
  • I2C_BUSERR_FLAG: bus error flag.
  • I2C_ARLOST_FLAG: arbitration lost flag.
  • I2C_ACKFAIL_FLAG: acknowledge failure flag.
  • I2C_OUF_FLAG: overflow or underflow flag.
  • I2C_PECERR_FLAG: pec receive error flag.
  • I2C_TMOUT_FLAG: smbus timeout flag.
  • I2C_ALERTF_FLAG: smbus alert flag.
  • I2C_STOPF_FLAG: stop condition generation complete flag.
  • I2C_ADDR7F_FLAG: i2c 0~7 bit address match flag.
Return values
none

< i2c 0~7 bit address match flag

< i2c stop condition generation complete flag

Definition at line 702 of file at32f413_i2c.c.

Referenced by eeprom_ready_check(), i2c_dma_rx_irq_handler(), i2c_err_irq_handler(), i2c_master_read_addr(), i2c_master_receive(), i2c_master_receive_dma(), i2c_master_receive_int(), i2c_master_transmit(), i2c_master_transmit_dma(), i2c_master_transmit_int(), i2c_memory_read(), i2c_memory_read_dma(), i2c_memory_read_int(), i2c_memory_write(), i2c_memory_write_dma(), i2c_memory_write_int(), i2c_slave_receive(), i2c_slave_rx_isr_int(), i2c_slave_transmit(), i2c_slave_tx_isr_int(), i2c_slave_tx_rx_isr_dma(), and i2c_wait_flag().

◆ i2c_flag_get()

flag_status i2c_flag_get | ( | i2c_type * | i2c_x,
 |  | uint32_t | flag )

get flag status

Parameters
i2c_x to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
flag this parameter can be one of the following values:
  • I2C_STARTF_FLAG: start condition generation complete flag.
  • I2C_ADDR7F_FLAG: 0~7 bit address match flag.
  • I2C_TDC_FLAG: transmit data complete flag.
  • I2C_ADDRHF_FLAG: master 9~8 bit address header match flag.
  • I2C_STOPF_FLAG: stop condition generation complete flag.
  • I2C_RDBF_FLAG: receive data buffer full flag.
  • I2C_TDBE_FLAG: transmit data buffer empty flag.
  • I2C_BUSERR_FLAG: bus error flag.
  • I2C_ARLOST_FLAG: arbitration lost flag.
  • I2C_ACKFAIL_FLAG: acknowledge failure flag.
  • I2C_OUF_FLAG: overflow or underflow flag.
  • I2C_PECERR_FLAG: pec receive error flag.
  • I2C_TMOUT_FLAG: smbus timeout flag.
  • I2C_ALERTF_FLAG: smbus alert flag.
  • I2C_TRMODE_FLAG: transmission mode.
  • I2C_BUSYF_FLAG: bus busy flag transmission mode.
  • I2C_DIRF_FLAG: transmission direction flag.
  • I2C_GCADDRF_FLAG: general call address received flag.
  • I2C_DEVADDRF_FLAG: smbus device address received flag.
  • I2C_HOSTADDRF_FLAG: smbus host address received flag.
  • I2C_ADDR2_FLAG: own address 2 received flag.
Return values
flag_status (SET or RESET)

Definition at line 576 of file at32f413_i2c.c.

Referenced by i2c_err_irq_handler(), i2c_master_rx_isr_int(), i2c_master_tx_isr_dma(), i2c_master_tx_isr_int(), i2c_slave_rx_isr_int(), i2c_slave_tx_isr_int(), i2c_slave_tx_rx_isr_dma(), and i2c_wait_flag().

◆ i2c_general_call_enable()

void i2c_general_call_enable | ( | i2c_type * | i2c_x,
 |  | confirm_state | new_state )

enable or disable general call.

Parameters
i2c_x | to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 334 of file at32f413_i2c.c.

◆ i2c_init()

void i2c_init | ( | i2c_type * | i2c_x,
 |  | i2c_fsmode_duty_cycle_type | duty,
 |  | uint32_t | speed )

init i2c speed and duty cycle.

Parameters
i2c_x | to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
duty this parameter can be one of the following values:
  • I2C_FSMODE_DUTY_2_1: duty cycle 2:1
  • I2C_FSMODE_DUTY_16_9: duty cycle 16:9
speed | i2c scl clock speed, such as 100000
Return values
none

Definition at line 89 of file at32f413_i2c.c.

Referenced by i2c_lowlevel_init().

◆ i2c_interrupt_enable()

void i2c_interrupt_enable | ( | i2c_type * | i2c_x,
 |  | uint16_t | source,
 |  | confirm_state | new_state )

enable or disable interrupt

Parameters
i2c_x | to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
source this parameter can be one of the following values:
  • I2C_DATA_INT: data interrupt.
  • I2C_EV_INT: event interrupt.
  • I2C_ERR_INT: error interrupt.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 461 of file at32f413_i2c.c.

Referenced by i2c_dma_rx_irq_handler(), i2c_dma_tx_irq_handler(), i2c_err_irq_handler(), i2c_master_receive_int(), i2c_master_rx_isr_int(), i2c_master_transmit_int(), i2c_master_tx_isr_dma(), i2c_master_tx_isr_int(), i2c_memory_read_int(), i2c_memory_write_int(), i2c_slave_receive_dma(), i2c_slave_receive_int(), i2c_slave_rx_isr_int(), i2c_slave_transmit_dma(), i2c_slave_transmit_int(), i2c_slave_tx_isr_int(), and i2c_slave_tx_rx_isr_dma().

◆ i2c_interrupt_flag_get()

flag_status i2c_interrupt_flag_get | ( | i2c_type * | i2c_x,
 |  | uint32_t | flag )

get interrupt flag status

Parameters
i2c_x to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
flag this parameter can be one of the following values:
  • I2C_STARTF_FLAG: start condition generation complete flag.
  • I2C_ADDR7F_FLAG: 0~7 bit address match flag.
  • I2C_TDC_FLAG: transmit data complete flag.
  • I2C_ADDRHF_FLAG: master 9~8 bit address header match flag.
  • I2C_STOPF_FLAG: stop condition generation complete flag.
  • I2C_RDBF_FLAG: receive data buffer full flag.
  • I2C_TDBE_FLAG: transmit data buffer empty flag.
  • I2C_BUSERR_FLAG: bus error flag.
  • I2C_ARLOST_FLAG: arbitration lost flag.
  • I2C_ACKFAIL_FLAG: acknowledge failure flag.
  • I2C_OUF_FLAG: overflow or underflow flag.
  • I2C_PECERR_FLAG: pec receive error flag.
  • I2C_TMOUT_FLAG: smbus timeout flag.
  • I2C_ALERTF_FLAG: smbus alert flag.
Return values
flag_status (SET or RESET)

< i2c start condition generation complete flag

< i2c 0~7 bit address match flag

< i2c transmit data complete flag

< i2c master 9~8 bit address header match flag

< i2c stop condition generation complete flag

< i2c receive data buffer full flag

< i2c transmit data buffer empty flag

< i2c bus error flag

< i2c arbitration lost flag

< i2c acknowledge failure flag

< i2c overflow or underflow flag

< i2c pec receive error flag

< i2c smbus timeout flag

< i2c smbus alert flag

Definition at line 628 of file at32f413_i2c.c.

◆ i2c_master_receive_ack_set()

void i2c_master_receive_ack_set | ( | i2c_type * | i2c_x,
 |  | i2c_master_ack_type | pos )

master receiving mode acknowledge control.

Parameters
i2c_x to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
pos this parameter can be one of the following values:
  • I2C_MASTER_ACK_CURRENT: acken bit acts on the current byte
  • I2C_MASTER_ACK_NEXT: acken bit acts on the next byte
Return values
none

Definition at line 305 of file at32f413_i2c.c.

Referenced by eeprom_ready_check(), i2c_master_receive(), i2c_master_receive_dma(), i2c_master_receive_int(), i2c_master_transmit(), i2c_master_transmit_dma(), i2c_master_transmit_int(), i2c_memory_read(), i2c_memory_read_dma(), i2c_memory_read_int(), i2c_memory_write(), i2c_memory_write_dma(), i2c_memory_write_int(), i2c_slave_receive(), i2c_slave_receive_dma(), i2c_slave_receive_int(), i2c_slave_transmit(), i2c_slave_transmit_dma(), and i2c_slave_transmit_int().

◆ i2c_own_address1_set()

void i2c_own_address1_set | ( | i2c_type * | i2c_x,
 |  | i2c_address_mode_type | mode,
 |  | uint16_t | address )

config own address1.

Parameters
i2c_x | to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
mode this parameter can be one of the following values:
  • I2C_ADDRESS_MODE_7BIT: 7bit address.
  • I2C_ADDRESS_MODE_10BIT: 10bit address.
address | own address1, such as 0xb0.
Return values
none

Definition at line 191 of file at32f413_i2c.c.

Referenced by i2c_lowlevel_init().

◆ i2c_own_address2_enable()

void i2c_own_address2_enable | ( | i2c_type * | i2c_x,
 |  | confirm_state | new_state )

enable or disable own address2.

Parameters
i2c_x | to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 221 of file at32f413_i2c.c.

◆ i2c_own_address2_set()

void i2c_own_address2_set | ( | i2c_type * | i2c_x,
 |  | uint8_t | address )

config own address2.

Parameters
i2c_x | to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
address | specifies the 7bit i2c own address2, such as 0xa0.
Return values
none.

Definition at line 208 of file at32f413_i2c.c.

◆ i2c_pec_calculate_enable()

void i2c_pec_calculate_enable | ( | i2c_type * | i2c_x,
 |  | confirm_state | new_state )

enable or disable pec calcultetion.

Parameters
i2c_x | to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 405 of file at32f413_i2c.c.

◆ i2c_pec_position_set()

void i2c_pec_position_set | ( | i2c_type * | i2c_x,
 |  | i2c_pec_position_type | pos )

pec position set.

Parameters
i2c_x to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
pos this parameter can be one of the following values:
  • I2C_PEC_POSITION_CURRENT: the current byte is pec
  • I2C_PEC_POSITION_NEXT: the next byte is pec
Return values
none

Definition at line 321 of file at32f413_i2c.c.

◆ i2c_pec_transmit_enable()

void i2c_pec_transmit_enable | ( | i2c_type * | i2c_x,
 |  | confirm_state | new_state )

enable or disable pec transfer.

Parameters
i2c_x | to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 392 of file at32f413_i2c.c.

◆ i2c_pec_value_get()

uint8_t i2c_pec_value_get ( i2c_type * i2c_x )

get pec value.

Parameters
i2c_x to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
Return values
uint8_t pec value.

Definition at line 417 of file at32f413_i2c.c.

◆ i2c_reset()

void i2c_reset ( i2c_type * i2c_x )

reset the i2c register

Parameters
i2c_x to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
Return values
none

Definition at line 50 of file at32f413_i2c.c.

Referenced by i2c_config().

◆ i2c_smbus_alert_set()

void i2c_smbus_alert_set | ( | i2c_type * | i2c_x,
 |  | i2c_smbus_alert_set_type | level )

drive the smbus alert pin high or low.

Parameters
i2c_x to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
level this parameter can be one of the following values:
  • I2C_SMBUS_ALERT_LOW: smbus alert pin set low.
  • I2C_SMBUS_ALERT_HIGH: smbus alert pin set high.
Return values
none

Definition at line 379 of file at32f413_i2c.c.

◆ i2c_smbus_enable()

void i2c_smbus_enable | ( | i2c_type * | i2c_x,
 |  | confirm_state | new_state )

enable or disable the smbus mode

Parameters
i2c_x | to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 234 of file at32f413_i2c.c.

◆ i2c_smbus_mode_set()

void i2c_smbus_mode_set | ( | i2c_type * | i2c_x,
 |  | i2c_smbus_mode_set_type | mode )

config smbus host or device.

Parameters
i2c_x to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
level this parameter can be one of the following values:
  • I2C_SMBUS_MODE_DEVICE: smbus device.
  • I2C_SMBUS_MODE_HOST: smbus host.
Return values
none

Definition at line 363 of file at32f413_i2c.c.

◆ i2c_software_reset()

void i2c_software_reset | ( | i2c_type * | i2c_x,
 |  | confirm_state | new_state )

software reset.

Parameters
i2c_x | to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 72 of file at32f413_i2c.c.

◆ i2c_start_generate()

void i2c_start_generate ( i2c_type * i2c_x )

generate start condition.

Parameters
i2c_x to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
Return values
none.

Definition at line 480 of file at32f413_i2c.c.

Referenced by eeprom_ready_check(), i2c_master_read_addr(), and i2c_master_write_addr().

◆ i2c_stop_generate()

void i2c_stop_generate ( i2c_type * i2c_x )

generate stop condition.

Parameters
i2c_x to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
Return values
none.

Definition at line 492 of file at32f413_i2c.c.

Referenced by eeprom_ready_check(), i2c_dma_rx_irq_handler(), i2c_master_receive(), i2c_master_receive_dma(), i2c_master_receive_int(), i2c_master_rx_isr_int(), i2c_master_transmit(), i2c_master_transmit_dma(), i2c_master_transmit_int(), i2c_master_tx_isr_dma(), i2c_master_tx_isr_int(), i2c_memory_address_send(), i2c_memory_read(), i2c_memory_read_dma(), i2c_memory_read_int(), i2c_memory_write(), i2c_memory_write_dma(), i2c_memory_write_int(), and i2c_wait_flag().


AT32F413 Firmwary Library: I2C_private_functions

Functions
I2C_private_functions
AT32F413_periph_driver » I2C

Functions

void | i2c_reset (i2c_type *i2c_x)
reset the i2c register
void | i2c_software_reset (i2c_type *i2c_x, confirm_state new_state)
software reset.
void | i2c_init (i2c_type *i2c_x, i2c_fsmode_duty_cycle_type duty, uint32_t speed)
init i2c speed and duty cycle.
void | i2c_own_address1_set (i2c_type *i2c_x, i2c_address_mode_type mode, uint16_t address)
config own address1.
void | i2c_own_address2_set (i2c_type *i2c_x, uint8_t address)
config own address2.
void | i2c_own_address2_enable (i2c_type *i2c_x, confirm_state new_state)
enable or disable own address2.
void | i2c_smbus_enable (i2c_type *i2c_x, confirm_state new_state)
enable or disable the smbus mode
void | i2c_enable (i2c_type *i2c_x, confirm_state new_state)
enable or disable i2c periph
void | i2c_fast_mode_duty_set (i2c_type *i2c_x, i2c_fsmode_duty_cycle_type duty)
config fast mode duty cycle
void | i2c_clock_stretch_enable (i2c_type *i2c_x, confirm_state new_state)
enable or disable clock stretch.
void | i2c_ack_enable (i2c_type *i2c_x, confirm_state new_state)
enable or disable acknowledge.
void | i2c_master_receive_ack_set (i2c_type *i2c_x, i2c_master_ack_type pos)
master receiving mode acknowledge control.
void | i2c_pec_position_set (i2c_type *i2c_x, i2c_pec_position_type pos)
pec position set.
void | i2c_general_call_enable (i2c_type *i2c_x, confirm_state new_state)
enable or disable general call.
void | i2c_arp_mode_enable (i2c_type *i2c_x, confirm_state new_state)
enable or disable arp mode.
void | i2c_smbus_mode_set (i2c_type *i2c_x, i2c_smbus_mode_set_type mode)
config smbus host or device.
void | i2c_smbus_alert_set (i2c_type *i2c_x, i2c_smbus_alert_set_type level)
drive the smbus alert pin high or low.
void | i2c_pec_transmit_enable (i2c_type *i2c_x, confirm_state new_state)
enable or disable pec transfer.
void | i2c_pec_calculate_enable (i2c_type *i2c_x, confirm_state new_state)
enable or disable pec calcultetion.
uint8_t | i2c_pec_value_get (i2c_type *i2c_x)
get pec value.
void | i2c_dma_end_transfer_set (i2c_type *i2c_x, confirm_state new_state)
enable or disable if the next dma transfer will be the last one.
void | i2c_dma_enable (i2c_type *i2c_x, confirm_state new_state)
enable or disable dma requests.
void | i2c_interrupt_enable (i2c_type *i2c_x, uint16_t source, confirm_state new_state)
enable or disable interrupt
void | i2c_start_generate (i2c_type *i2c_x)
generate start condition.
void | i2c_stop_generate (i2c_type *i2c_x)
generate stop condition.
void | i2c_7bit_address_send (i2c_type *i2c_x, uint8_t address, i2c_direction_type direction)
transmit the slave address.
void | i2c_data_send (i2c_type *i2c_x, uint8_t data)
send a byte through the i2c periph.
uint8_t | i2c_data_receive (i2c_type *i2c_x)
receive a byte through the i2c periph.
flag_status | i2c_flag_get (i2c_type *i2c_x, uint32_t flag)
get flag status
flag_status | i2c_interrupt_flag_get (i2c_type *i2c_x, uint32_t flag)
get interrupt flag status
void | i2c_flag_clear (i2c_type *i2c_x, uint32_t flag)
clear flag status

Detailed Description

Function Documentation

◆ i2c_7bit_address_send()

void i2c_7bit_address_send | ( | i2c_type * | i2c_x,
 |  | uint8_t | address,
 |  | i2c_direction_type | direction )

transmit the slave address.

Parameters
i2c_x | to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
address | specifies the slave address which will be transmitted
direction this parameter can be one of the following values:
  • I2C_DIRECTION_TRANSMIT: transmit mode.
  • I2C_DIRECTION_RECEIVE: receive mode.
Return values
none.

Definition at line 509 of file at32f413_i2c.c.

Referenced by eeprom_ready_check(), i2c_master_read_addr(), and i2c_master_write_addr().

◆ i2c_ack_enable()

void i2c_ack_enable | ( | i2c_type * | i2c_x,
 |  | confirm_state | new_state )

enable or disable acknowledge.

Parameters
i2c_x | to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
new_state | (TRUE or FALSE)
Return values
none.

Definition at line 289 of file at32f413_i2c.c.

Referenced by i2c_err_irq_handler(), i2c_master_read_addr(), i2c_master_receive(), i2c_master_receive_dma(), i2c_master_receive_int(), i2c_master_rx_isr_int(), i2c_memory_read(), i2c_memory_read_dma(), i2c_memory_read_int(), i2c_slave_receive(), i2c_slave_receive_dma(), i2c_slave_receive_int(), i2c_slave_transmit(), i2c_slave_transmit_dma(), i2c_slave_transmit_int(), and i2c_slave_tx_rx_isr_dma().

◆ i2c_arp_mode_enable()

void i2c_arp_mode_enable | ( | i2c_type * | i2c_x,
 |  | confirm_state | new_state )

enable or disable arp mode.

Parameters
i2c_x | to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 347 of file at32f413_i2c.c.

◆ i2c_clock_stretch_enable()

void i2c_clock_stretch_enable | ( | i2c_type * | i2c_x,
 |  | confirm_state | new_state )

enable or disable clock stretch.

Parameters
i2c_x | to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 276 of file at32f413_i2c.c.

◆ i2c_data_receive()

uint8_t i2c_data_receive ( i2c_type * i2c_x )

receive a byte through the i2c periph.

Parameters
i2c_x to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
Return values
uint8_t received byte

Definition at line 541 of file at32f413_i2c.c.

Referenced by i2c_master_receive(), i2c_master_rx_isr_int(), i2c_memory_read(), i2c_slave_receive(), and i2c_slave_rx_isr_int().

◆ i2c_data_send()

void i2c_data_send | ( | i2c_type * | i2c_x,
 |  | uint8_t | data )

send a byte through the i2c periph.

Parameters
i2c_x | to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
data | byte to be transmitted.
Return values
none

Definition at line 529 of file at32f413_i2c.c.

Referenced by i2c_master_read_addr(), i2c_master_transmit(), i2c_master_tx_isr_int(), i2c_master_write_addr(), i2c_memory_address_send(), i2c_memory_write(), i2c_slave_transmit(), and i2c_slave_tx_isr_int().

◆ i2c_dma_enable()

void i2c_dma_enable | ( | i2c_type * | i2c_x,
 |  | confirm_state | new_state )

enable or disable dma requests.

Parameters
i2c_x | to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 443 of file at32f413_i2c.c.

Referenced by i2c_dma_rx_irq_handler(), i2c_dma_tx_irq_handler(), i2c_master_receive_dma(), i2c_master_transmit_dma(), i2c_memory_read_dma(), i2c_memory_write_dma(), i2c_slave_receive_dma(), and i2c_slave_transmit_dma().

◆ i2c_dma_end_transfer_set()

void i2c_dma_end_transfer_set | ( | i2c_type * | i2c_x,
 |  | confirm_state | new_state )

enable or disable if the next dma transfer will be the last one.

Parameters
i2c_x | to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 430 of file at32f413_i2c.c.

Referenced by i2c_master_receive_dma(), and i2c_memory_read_dma().

◆ i2c_enable()

void i2c_enable | ( | i2c_type * | i2c_x,
 |  | confirm_state | new_state )

enable or disable i2c periph

Parameters
i2c_x | to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 247 of file at32f413_i2c.c.

Referenced by i2c_config().

◆ i2c_fast_mode_duty_set()

void i2c_fast_mode_duty_set | ( | i2c_type * | i2c_x,
 |  | i2c_fsmode_duty_cycle_type | duty )

config fast mode duty cycle

Parameters
i2c_x to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
duty this parameter can be one of the following values:
  • I2C_FSMODE_DUTY_2_1: duty cycle 2:1
  • I2C_FSMODE_DUTY_16_9: duty cycle 16:9
Return values
none

Definition at line 263 of file at32f413_i2c.c.

◆ i2c_flag_clear()

void i2c_flag_clear | ( | i2c_type * | i2c_x,
 |  | uint32_t | flag )

clear flag status

Parameters
i2c_x to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2, I2C3.
flag this parameter can be any combination of the following values:
  • I2C_BUSERR_FLAG: bus error flag.
  • I2C_ARLOST_FLAG: arbitration lost flag.
  • I2C_ACKFAIL_FLAG: acknowledge failure flag.
  • I2C_OUF_FLAG: overflow or underflow flag.
  • I2C_PECERR_FLAG: pec receive error flag.
  • I2C_TMOUT_FLAG: smbus timeout flag.
  • I2C_ALERTF_FLAG: smbus alert flag.
  • I2C_STOPF_FLAG: stop condition generation complete flag.
  • I2C_ADDR7F_FLAG: i2c 0~7 bit address match flag.
Return values
none

< i2c 0~7 bit address match flag

< i2c stop condition generation complete flag

Definition at line 702 of file at32f413_i2c.c.

Referenced by eeprom_ready_check(), i2c_dma_rx_irq_handler(), i2c_err_irq_handler(), i2c_master_read_addr(), i2c_master_receive(), i2c_master_receive_dma(), i2c_master_receive_int(), i2c_master_transmit(), i2c_master_transmit_dma(), i2c_master_transmit_int(), i2c_memory_read(), i2c_memory_read_dma(), i2c_memory_read_int(), i2c_memory_write(), i2c_memory_write_dma(), i2c_memory_write_int(), i2c_slave_receive(), i2c_slave_rx_isr_int(), i2c_slave_transmit(), i2c_slave_tx_isr_int(), i2c_slave_tx_rx_isr_dma(), and i2c_wait_flag().

◆ i2c_flag_get()

flag_status i2c_flag_get | ( | i2c_type * | i2c_x,
 |  | uint32_t | flag )

get flag status

Parameters
i2c_x to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
flag this parameter can be one of the following values:
  • I2C_STARTF_FLAG: start condition generation complete flag.
  • I2C_ADDR7F_FLAG: 0~7 bit address match flag.
  • I2C_TDC_FLAG: transmit data complete flag.
  • I2C_ADDRHF_FLAG: master 9~8 bit address header match flag.
  • I2C_STOPF_FLAG: stop condition generation complete flag.
  • I2C_RDBF_FLAG: receive data buffer full flag.
  • I2C_TDBE_FLAG: transmit data buffer empty flag.
  • I2C_BUSERR_FLAG: bus error flag.
  • I2C_ARLOST_FLAG: arbitration lost flag.
  • I2C_ACKFAIL_FLAG: acknowledge failure flag.
  • I2C_OUF_FLAG: overflow or underflow flag.
  • I2C_PECERR_FLAG: pec receive error flag.
  • I2C_TMOUT_FLAG: smbus timeout flag.
  • I2C_ALERTF_FLAG: smbus alert flag.
  • I2C_TRMODE_FLAG: transmission mode.
  • I2C_BUSYF_FLAG: bus busy flag transmission mode.
  • I2C_DIRF_FLAG: transmission direction flag.
  • I2C_GCADDRF_FLAG: general call address received flag.
  • I2C_DEVADDRF_FLAG: smbus device address received flag.
  • I2C_HOSTADDRF_FLAG: smbus host address received flag.
  • I2C_ADDR2_FLAG: own address 2 received flag.
Return values
flag_status (SET or RESET)

Definition at line 576 of file at32f413_i2c.c.

Referenced by i2c_err_irq_handler(), i2c_master_rx_isr_int(), i2c_master_tx_isr_dma(), i2c_master_tx_isr_int(), i2c_slave_rx_isr_int(), i2c_slave_tx_isr_int(), i2c_slave_tx_rx_isr_dma(), and i2c_wait_flag().

◆ i2c_general_call_enable()

void i2c_general_call_enable | ( | i2c_type * | i2c_x,
 |  | confirm_state | new_state )

enable or disable general call.

Parameters
i2c_x | to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 334 of file at32f413_i2c.c.

◆ i2c_init()

void i2c_init | ( | i2c_type * | i2c_x,
 |  | i2c_fsmode_duty_cycle_type | duty,
 |  | uint32_t | speed )

init i2c speed and duty cycle.

Parameters
i2c_x | to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
duty this parameter can be one of the following values:
  • I2C_FSMODE_DUTY_2_1: duty cycle 2:1
  • I2C_FSMODE_DUTY_16_9: duty cycle 16:9
speed | i2c scl clock speed, such as 100000
Return values
none

Definition at line 89 of file at32f413_i2c.c.

Referenced by i2c_lowlevel_init().

◆ i2c_interrupt_enable()

void i2c_interrupt_enable | ( | i2c_type * | i2c_x,
 |  | uint16_t | source,
 |  | confirm_state | new_state )

enable or disable interrupt

Parameters
i2c_x | to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
source this parameter can be one of the following values:
  • I2C_DATA_INT: data interrupt.
  • I2C_EV_INT: event interrupt.
  • I2C_ERR_INT: error interrupt.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 461 of file at32f413_i2c.c.

Referenced by i2c_dma_rx_irq_handler(), i2c_dma_tx_irq_handler(), i2c_err_irq_handler(), i2c_master_receive_int(), i2c_master_rx_isr_int(), i2c_master_transmit_int(), i2c_master_tx_isr_dma(), i2c_master_tx_isr_int(), i2c_memory_read_int(), i2c_memory_write_int(), i2c_slave_receive_dma(), i2c_slave_receive_int(), i2c_slave_rx_isr_int(), i2c_slave_transmit_dma(), i2c_slave_transmit_int(), i2c_slave_tx_isr_int(), and i2c_slave_tx_rx_isr_dma().

◆ i2c_interrupt_flag_get()

flag_status i2c_interrupt_flag_get | ( | i2c_type * | i2c_x,
 |  | uint32_t | flag )

get interrupt flag status

Parameters
i2c_x to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
flag this parameter can be one of the following values:
  • I2C_STARTF_FLAG: start condition generation complete flag.
  • I2C_ADDR7F_FLAG: 0~7 bit address match flag.
  • I2C_TDC_FLAG: transmit data complete flag.
  • I2C_ADDRHF_FLAG: master 9~8 bit address header match flag.
  • I2C_STOPF_FLAG: stop condition generation complete flag.
  • I2C_RDBF_FLAG: receive data buffer full flag.
  • I2C_TDBE_FLAG: transmit data buffer empty flag.
  • I2C_BUSERR_FLAG: bus error flag.
  • I2C_ARLOST_FLAG: arbitration lost flag.
  • I2C_ACKFAIL_FLAG: acknowledge failure flag.
  • I2C_OUF_FLAG: overflow or underflow flag.
  • I2C_PECERR_FLAG: pec receive error flag.
  • I2C_TMOUT_FLAG: smbus timeout flag.
  • I2C_ALERTF_FLAG: smbus alert flag.
Return values
flag_status (SET or RESET)

< i2c start condition generation complete flag

< i2c 0~7 bit address match flag

< i2c transmit data complete flag

< i2c master 9~8 bit address header match flag

< i2c stop condition generation complete flag

< i2c receive data buffer full flag

< i2c transmit data buffer empty flag

< i2c bus error flag

< i2c arbitration lost flag

< i2c acknowledge failure flag

< i2c overflow or underflow flag

< i2c pec receive error flag

< i2c smbus timeout flag

< i2c smbus alert flag

Definition at line 628 of file at32f413_i2c.c.

◆ i2c_master_receive_ack_set()

void i2c_master_receive_ack_set | ( | i2c_type * | i2c_x,
 |  | i2c_master_ack_type | pos )

master receiving mode acknowledge control.

Parameters
i2c_x to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
pos this parameter can be one of the following values:
  • I2C_MASTER_ACK_CURRENT: acken bit acts on the current byte
  • I2C_MASTER_ACK_NEXT: acken bit acts on the next byte
Return values
none

Definition at line 305 of file at32f413_i2c.c.

Referenced by eeprom_ready_check(), i2c_master_receive(), i2c_master_receive_dma(), i2c_master_receive_int(), i2c_master_transmit(), i2c_master_transmit_dma(), i2c_master_transmit_int(), i2c_memory_read(), i2c_memory_read_dma(), i2c_memory_read_int(), i2c_memory_write(), i2c_memory_write_dma(), i2c_memory_write_int(), i2c_slave_receive(), i2c_slave_receive_dma(), i2c_slave_receive_int(), i2c_slave_transmit(), i2c_slave_transmit_dma(), and i2c_slave_transmit_int().

◆ i2c_own_address1_set()

void i2c_own_address1_set | ( | i2c_type * | i2c_x,
 |  | i2c_address_mode_type | mode,
 |  | uint16_t | address )

config own address1.

Parameters
i2c_x | to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
mode this parameter can be one of the following values:
  • I2C_ADDRESS_MODE_7BIT: 7bit address.
  • I2C_ADDRESS_MODE_10BIT: 10bit address.
address | own address1, such as 0xb0.
Return values
none

Definition at line 191 of file at32f413_i2c.c.

Referenced by i2c_lowlevel_init().

◆ i2c_own_address2_enable()

void i2c_own_address2_enable | ( | i2c_type * | i2c_x,
 |  | confirm_state | new_state )

enable or disable own address2.

Parameters
i2c_x | to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 221 of file at32f413_i2c.c.

◆ i2c_own_address2_set()

void i2c_own_address2_set | ( | i2c_type * | i2c_x,
 |  | uint8_t | address )

config own address2.

Parameters
i2c_x | to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
address | specifies the 7bit i2c own address2, such as 0xa0.
Return values
none.

Definition at line 208 of file at32f413_i2c.c.

◆ i2c_pec_calculate_enable()

void i2c_pec_calculate_enable | ( | i2c_type * | i2c_x,
 |  | confirm_state | new_state )

enable or disable pec calcultetion.

Parameters
i2c_x | to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 405 of file at32f413_i2c.c.

◆ i2c_pec_position_set()

void i2c_pec_position_set | ( | i2c_type * | i2c_x,
 |  | i2c_pec_position_type | pos )

pec position set.

Parameters
i2c_x to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
pos this parameter can be one of the following values:
  • I2C_PEC_POSITION_CURRENT: the current byte is pec
  • I2C_PEC_POSITION_NEXT: the next byte is pec
Return values
none

Definition at line 321 of file at32f413_i2c.c.

◆ i2c_pec_transmit_enable()

void i2c_pec_transmit_enable | ( | i2c_type * | i2c_x,
 |  | confirm_state | new_state )

enable or disable pec transfer.

Parameters
i2c_x | to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 392 of file at32f413_i2c.c.

◆ i2c_pec_value_get()

uint8_t i2c_pec_value_get ( i2c_type * i2c_x )

get pec value.

Parameters
i2c_x to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
Return values
uint8_t pec value.

Definition at line 417 of file at32f413_i2c.c.

◆ i2c_reset()

void i2c_reset ( i2c_type * i2c_x )

reset the i2c register

Parameters
i2c_x to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
Return values
none

Definition at line 50 of file at32f413_i2c.c.

Referenced by i2c_config().

◆ i2c_smbus_alert_set()

void i2c_smbus_alert_set | ( | i2c_type * | i2c_x,
 |  | i2c_smbus_alert_set_type | level )

drive the smbus alert pin high or low.

Parameters
i2c_x to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
level this parameter can be one of the following values:
  • I2C_SMBUS_ALERT_LOW: smbus alert pin set low.
  • I2C_SMBUS_ALERT_HIGH: smbus alert pin set high.
Return values
none

Definition at line 379 of file at32f413_i2c.c.

◆ i2c_smbus_enable()

void i2c_smbus_enable | ( | i2c_type * | i2c_x,
 |  | confirm_state | new_state )

enable or disable the smbus mode

Parameters
i2c_x | to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 234 of file at32f413_i2c.c.

◆ i2c_smbus_mode_set()

void i2c_smbus_mode_set | ( | i2c_type * | i2c_x,
 |  | i2c_smbus_mode_set_type | mode )

config smbus host or device.

Parameters
i2c_x to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
level this parameter can be one of the following values:
  • I2C_SMBUS_MODE_DEVICE: smbus device.
  • I2C_SMBUS_MODE_HOST: smbus host.
Return values
none

Definition at line 363 of file at32f413_i2c.c.

◆ i2c_software_reset()

void i2c_software_reset | ( | i2c_type * | i2c_x,
 |  | confirm_state | new_state )

software reset.

Parameters
i2c_x | to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 72 of file at32f413_i2c.c.

◆ i2c_start_generate()

void i2c_start_generate ( i2c_type * i2c_x )

generate start condition.

Parameters
i2c_x to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
Return values
none.

Definition at line 480 of file at32f413_i2c.c.

Referenced by eeprom_ready_check(), i2c_master_read_addr(), and i2c_master_write_addr().

◆ i2c_stop_generate()

void i2c_stop_generate ( i2c_type * i2c_x )

generate stop condition.

Parameters
i2c_x to select the i2c peripheral. this parameter can be one of the following values: I2C1, I2C2.
Return values
none.

Definition at line 492 of file at32f413_i2c.c.

Referenced by eeprom_ready_check(), i2c_dma_rx_irq_handler(), i2c_master_receive(), i2c_master_receive_dma(), i2c_master_receive_int(), i2c_master_rx_isr_int(), i2c_master_transmit(), i2c_master_transmit_dma(), i2c_master_transmit_int(), i2c_master_tx_isr_dma(), i2c_master_tx_isr_int(), i2c_memory_address_send(), i2c_memory_read(), i2c_memory_read_dma(), i2c_memory_read_int(), i2c_memory_write(), i2c_memory_write_dma(), i2c_memory_write_int(), and i2c_wait_flag().


AT32F413 Firmwary Library: MISC

Topics
MISC
AT32F413_periph_driver

MISC driver modules. More...

Topics

MISC_vector_table_base_address
MISC_exported_types
MISC_exported_functions
MISC_private_functions

Detailed Description

MISC driver modules.


AT32F413 Firmwary Library: MISC_vector_table_base_address

Macros
MISC_vector_table_base_address
AT32F413_periph_driver » MISC

Macros

#define | NVIC_VECTTAB_RAM ((uint32_t)0x20000000)
#define | NVIC_VECTTAB_FLASH ((uint32_t)0x08000000)

Detailed Description

Macro Definition Documentation

◆ NVIC_VECTTAB_FLASH

#define NVIC_VECTTAB_FLASH ((uint32_t)0x08000000)

nvic vector table based flash address

Definition at line 51 of file at32f413_misc.h.

Referenced by main().

◆ NVIC_VECTTAB_RAM

#define NVIC_VECTTAB_RAM ((uint32_t)0x20000000)

nvic vector table based ram address

Definition at line 50 of file at32f413_misc.h.


AT32F413 Firmwary Library: MISC_exported_types

Enumerations
MISC_exported_types
AT32F413_periph_driver » MISC

Enumerations

enum nvic_priority_group_type {
NVIC_PRIORITY_GROUP_0 = ((uint32_t)0x7) , NVIC_PRIORITY_GROUP_1 = ((uint32_t)0x6) , NVIC_PRIORITY_GROUP_2 = ((uint32_t)0x5) , NVIC_PRIORITY_GROUP_3 = ((uint32_t)0x4) ,
NVIC_PRIORITY_GROUP_4 = ((uint32_t)0x3)
}
nvic interrupt priority group More...
enum | nvic_lowpower_mode_type { NVIC_LP_SLEEPONEXIT = 0x02 , NVIC_LP_SLEEPDEEP = 0x04 , NVIC_LP_SEVONPEND = 0x10 }
nvic low power mode More...
enum | systick_clock_source_type { SYSTICK_CLOCK_SOURCE_AHBCLK_DIV8 = ((uint32_t)0x00000000) , SYSTICK_CLOCK_SOURCE_AHBCLK_NODIV = ((uint32_t)0x00000004) }
systick clock source More...

Detailed Description

Enumeration Type Documentation

◆ nvic_lowpower_mode_type

enum nvic_lowpower_mode_type

nvic low power mode

Enumerator
NVIC_LP_SLEEPONEXIT | enable sleep-on-exit feature
NVIC_LP_SLEEPDEEP | enable sleep-deep output signal when entering sleep mode
NVIC_LP_SEVONPEND | send event on pending

Definition at line 76 of file at32f413_misc.h.

◆ nvic_priority_group_type

enum nvic_priority_group_type

nvic interrupt priority group

Enumerator
NVIC_PRIORITY_GROUP_0 | 0 bits for preemption priority, 4 bits for subpriority
NVIC_PRIORITY_GROUP_1 | 1 bits for preemption priority, 3 bits for subpriority
NVIC_PRIORITY_GROUP_2 | 2 bits for preemption priority, 2 bits for subpriority
NVIC_PRIORITY_GROUP_3 | 3 bits for preemption priority, 1 bits for subpriority
NVIC_PRIORITY_GROUP_4 | 4 bits for preemption priority, 0 bits for subpriority

Definition at line 64 of file at32f413_misc.h.

◆ systick_clock_source_type

enum systick_clock_source_type

systick clock source

Enumerator
SYSTICK_CLOCK_SOURCE_AHBCLK_DIV8 | systick clock source from core clock div8
SYSTICK_CLOCK_SOURCE_AHBCLK_NODIV | systick clock source from core clock

Definition at line 86 of file at32f413_misc.h.


AT32F413 Firmwary Library: MISC_exported_functions

Functions
MISC_exported_functions
AT32F413_periph_driver » MISC

Functions

void | nvic_system_reset (void)
system reset
void | nvic_irq_enable (IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
void | nvic_irq_disable (IRQn_Type irqn)
disable nvic irq number
void | nvic_priority_group_config (nvic_priority_group_type priority_group)
config nvic priority group
void | nvic_vector_table_set (uint32_t base, uint32_t offset)
set the vector table location and offset.
void | nvic_lowpower_mode_config (nvic_lowpower_mode_type lp_mode, confirm_state new_state)
config nvic lowpower mode
void | systick_clock_source_config (systick_clock_source_type source)
config systick clock source

Detailed Description

Function Documentation

◆ nvic_irq_disable()

void nvic_irq_disable ( IRQn_Type irqn )

disable nvic irq number

Parameters
irqn (IRQn_Type number)
Return values
none

Definition at line 80 of file at32f413_misc.c.

Referenced by app_load(), and jump_to_app().

◆ nvic_irq_enable()

void nvic_irq_enable | ( | IRQn_Type | irqn,
 |  | uint32_t | preempt_priority,
 |  | uint32_t | sub_priority )

enable nvic irq

Parameters
irqn | (IRQn_Type number)
preempt_priority | preemptive priority value (starting from 0)
sub_priority | subpriority value (starting from 0)
Return values
none

Definition at line 63 of file at32f413_misc.c.

Referenced by adc_config(), adc_config(), adc_config(), alarm_init(), button_exint_init(), can_configuration(), codec_i2s_init(), config_flash_interrupt(), dma_config(), dma_config(), dma_config(), dma_config(), dma_configuration(), exint_line0_config(), exint_line4_config(), i2c_lowlevel_init(), i2s_config(), main(), nvic_configuration(), nvic_configuration(), nvic_configuration(), nvic_configuration(), rs485_config(), rtc_config(), spi_config(), spi_config(), tmr1_config(), tmr2_config(), tmr_init(), uart_init(), usart1_config(), usart_configuration(), and usb_usart_config().

◆ nvic_lowpower_mode_config()

void nvic_lowpower_mode_config | ( | nvic_lowpower_mode_type | lp_mode,
 |  | confirm_state | new_state )

config nvic lowpower mode

Parameters
lp_mode this parameter can be one of the following values:
  • NVIC_LP_SEVONPEND
  • NVIC_LP_SLEEPDEEP
  • NVIC_LP_SLEEPONEXIT
new_state (new state of lp condition. ENABLE or DISABLE)
Return values
none

Definition at line 126 of file at32f413_misc.c.

◆ nvic_priority_group_config()

void nvic_priority_group_config ( nvic_priority_group_type priority_group )

config nvic priority group

Parameters
priority_group this parameter can be one of the following values:
  • NVIC_PRIORITY_GROUP_0
  • NVIC_PRIORITY_GROUP_1
  • NVIC_PRIORITY_GROUP_2
  • NVIC_PRIORITY_GROUP_3
  • NVIC_PRIORITY_GROUP_4
Return values
none

Definition at line 96 of file at32f413_misc.c.

Referenced by button_exint_init(), config_flash_interrupt(), exint_line0_config(), main(), nvic_configuration(), nvic_configuration(), nvic_configuration(), nvic_configuration(), and usart_configuration().

◆ nvic_system_reset()

void nvic_system_reset ( void )

system reset

Parameters
none
Return values
none

Definition at line 51 of file at32f413_misc.c.

Referenced by app_loop(), iap_command_handle(), and main().

◆ nvic_vector_table_set()

void nvic_vector_table_set | ( | uint32_t | base,
 |  | uint32_t | offset )

set the vector table location and offset.

Parameters
base this parameter can be one of the following values:
  • NVIC_VECTTAB_RAM
  • NVIC_VECTTAB_FLASH
offset (vector table base offset field. this value must be a multiple of 0x200)
Return values
none

Definition at line 111 of file at32f413_misc.c.

Referenced by main().

◆ systick_clock_source_config()

void systick_clock_source_config ( systick_clock_source_type source )

config systick clock source

Parameters
source this parameter can be one of the following values:
  • SYSTICK_CLOCK_SOURCE_AHBCLK_DIV8
  • SYSTICK_CLOCK_SOURCE_AHBCLK_NODIV
Return values
none

Definition at line 146 of file at32f413_misc.c.

Referenced by delay_init(), and main().


AT32F413 Firmwary Library: MISC_private_functions

Macros | Functions
MISC_private_functions
AT32F413_periph_driver » MISC

Macros

#define AIRCR_VECTKEY_MASK ((uint32_t)0x05FA0000)

Functions

void | nvic_system_reset (void)
system reset
void | nvic_irq_enable (IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
void | nvic_irq_disable (IRQn_Type irqn)
disable nvic irq number
void | nvic_priority_group_config (nvic_priority_group_type priority_group)
config nvic priority group
void | nvic_vector_table_set (uint32_t base, uint32_t offset)
set the vector table location and offset.
void | nvic_lowpower_mode_config (nvic_lowpower_mode_type lp_mode, confirm_state new_state)
config nvic lowpower mode
void | systick_clock_source_config (systick_clock_source_type source)
config systick clock source

Detailed Description

Macro Definition Documentation

◆ AIRCR_VECTKEY_MASK

#define AIRCR_VECTKEY_MASK ((uint32_t)0x05FA0000)

Definition at line 44 of file at32f413_misc.c.

Function Documentation

◆ nvic_irq_disable()

void nvic_irq_disable ( IRQn_Type irqn )

disable nvic irq number

Parameters
irqn (IRQn_Type number)
Return values
none

Definition at line 80 of file at32f413_misc.c.

Referenced by app_load(), and jump_to_app().

◆ nvic_irq_enable()

void nvic_irq_enable | ( | IRQn_Type | irqn,
 |  | uint32_t | preempt_priority,
 |  | uint32_t | sub_priority )

enable nvic irq

Parameters
irqn | (IRQn_Type number)
preempt_priority | preemptive priority value (starting from 0)
sub_priority | subpriority value (starting from 0)
Return values
none

Definition at line 63 of file at32f413_misc.c.

Referenced by adc_config(), adc_config(), adc_config(), alarm_init(), button_exint_init(), can_configuration(), codec_i2s_init(), config_flash_interrupt(), dma_config(), dma_config(), dma_config(), dma_config(), dma_configuration(), exint_line0_config(), exint_line4_config(), i2c_lowlevel_init(), i2s_config(), main(), nvic_configuration(), nvic_configuration(), nvic_configuration(), nvic_configuration(), rs485_config(), rtc_config(), spi_config(), spi_config(), tmr1_config(), tmr2_config(), tmr_init(), uart_init(), usart1_config(), usart_configuration(), and usb_usart_config().

◆ nvic_lowpower_mode_config()

void nvic_lowpower_mode_config | ( | nvic_lowpower_mode_type | lp_mode,
 |  | confirm_state | new_state )

config nvic lowpower mode

Parameters
lp_mode this parameter can be one of the following values:
  • NVIC_LP_SEVONPEND
  • NVIC_LP_SLEEPDEEP
  • NVIC_LP_SLEEPONEXIT
new_state (new state of lp condition. ENABLE or DISABLE)
Return values
none

Definition at line 126 of file at32f413_misc.c.

◆ nvic_priority_group_config()

void nvic_priority_group_config ( nvic_priority_group_type priority_group )

config nvic priority group

Parameters
priority_group this parameter can be one of the following values:
  • NVIC_PRIORITY_GROUP_0
  • NVIC_PRIORITY_GROUP_1
  • NVIC_PRIORITY_GROUP_2
  • NVIC_PRIORITY_GROUP_3
  • NVIC_PRIORITY_GROUP_4
Return values
none

Definition at line 96 of file at32f413_misc.c.

Referenced by button_exint_init(), config_flash_interrupt(), exint_line0_config(), main(), nvic_configuration(), nvic_configuration(), nvic_configuration(), nvic_configuration(), and usart_configuration().

◆ nvic_system_reset()

void nvic_system_reset ( void )

system reset

Parameters
none
Return values
none

Definition at line 51 of file at32f413_misc.c.

Referenced by app_loop(), iap_command_handle(), and main().

◆ nvic_vector_table_set()

void nvic_vector_table_set | ( | uint32_t | base,
 |  | uint32_t | offset )

set the vector table location and offset.

Parameters
base this parameter can be one of the following values:
  • NVIC_VECTTAB_RAM
  • NVIC_VECTTAB_FLASH
offset (vector table base offset field. this value must be a multiple of 0x200)
Return values
none

Definition at line 111 of file at32f413_misc.c.

Referenced by main().

◆ systick_clock_source_config()

void systick_clock_source_config ( systick_clock_source_type source )

config systick clock source

Parameters
source this parameter can be one of the following values:
  • SYSTICK_CLOCK_SOURCE_AHBCLK_DIV8
  • SYSTICK_CLOCK_SOURCE_AHBCLK_NODIV
Return values
none

Definition at line 146 of file at32f413_misc.c.

Referenced by delay_init(), and main().


AT32F413 Firmwary Library: PWC

Topics | Macros
PWC
AT32F413_periph_driver

PWC driver modules. More...

Topics

PWC_flags_definition
pwc flag
PWC_exported_types
PWC_exported_functions
PWC_private_functions

Macros

#define | PWC_WAKEUP_PIN_1 ((uint32_t)0x00000100)
pwc wakeup pin num definition
#define | PWC ((pwc_type *) PWC_BASE)

Detailed Description

PWC driver modules.

Macro Definition Documentation

◆ PWC

#define PWC ((pwc_type *) PWC_BASE)

Definition at line 147 of file at32f413_pwc.h.

Referenced by pwc_battery_powered_domain_access(), pwc_flag_clear(), pwc_flag_get(), pwc_power_voltage_monitor_enable(), pwc_pvm_level_select(), pwc_standby_mode_enter(), and pwc_wakeup_pin_enable().

◆ PWC_WAKEUP_PIN_1

#define PWC_WAKEUP_PIN_1 ((uint32_t)0x00000100)

pwc wakeup pin num definition

standby wake-up pin1(pa0)

Definition at line 62 of file at32f413_pwc.h.

Referenced by main().


AT32F413 Firmwary Library: PWC_flags_definition

Macros
PWC_flags_definition
AT32F413_periph_driver » PWC

pwc flag More...

Macros

#define | PWC_WAKEUP_FLAG ((uint32_t)0x00000001)
#define | PWC_STANDBY_FLAG ((uint32_t)0x00000002)
#define | PWC_PVM_OUTPUT_FLAG ((uint32_t)0x00000004)

Detailed Description

pwc flag

Macro Definition Documentation

◆ PWC_PVM_OUTPUT_FLAG

#define PWC_PVM_OUTPUT_FLAG ((uint32_t)0x00000004)

pvm output flag

Definition at line 53 of file at32f413_pwc.h.

◆ PWC_STANDBY_FLAG

#define PWC_STANDBY_FLAG ((uint32_t)0x00000002)

standby flag

Definition at line 52 of file at32f413_pwc.h.

Referenced by main(), and pwc_flag_clear().

◆ PWC_WAKEUP_FLAG

#define PWC_WAKEUP_FLAG ((uint32_t)0x00000001)

wakeup flag

Definition at line 51 of file at32f413_pwc.h.

Referenced by main(), and pwc_flag_clear().


AT32F413 Firmwary Library: PWC_exported_types

Data Structures | Enumerations
PWC_exported_types
AT32F413_periph_driver » PWC

Data Structures

struct pwc_type
type define pwc register all More...

Enumerations

enum pwc_pvm_voltage_type {
PWC_PVM_VOLTAGE_2V3 = 0x01 , PWC_PVM_VOLTAGE_2V4 = 0x02 , PWC_PVM_VOLTAGE_2V5 = 0x03 , PWC_PVM_VOLTAGE_2V6 = 0x04 ,
PWC_PVM_VOLTAGE_2V7 = 0x05 , PWC_PVM_VOLTAGE_2V8 = 0x06 , PWC_PVM_VOLTAGE_2V9 = 0x07
}
pwc pvm voltage type More...
enum | pwc_sleep_enter_type { PWC_SLEEP_ENTER_WFI = 0x00 , PWC_SLEEP_ENTER_WFE = 0x01 }
pwc sleep enter type More...
enum | pwc_deep_sleep_enter_type { PWC_DEEP_SLEEP_ENTER_WFI = 0x00 , PWC_DEEP_SLEEP_ENTER_WFE = 0x01 }
pwc deep sleep enter type More...

Detailed Description

Enumeration Type Documentation

◆ pwc_deep_sleep_enter_type

enum pwc_deep_sleep_enter_type

pwc deep sleep enter type

Enumerator
PWC_DEEP_SLEEP_ENTER_WFI | use wfi enter deepsleep mode
PWC_DEEP_SLEEP_ENTER_WFE | use wfe enter deepsleep mode

Definition at line 94 of file at32f413_pwc.h.

◆ pwc_pvm_voltage_type

enum pwc_pvm_voltage_type

pwc pvm voltage type

Enumerator
PWC_PVM_VOLTAGE_2V3 | power voltage monitoring boundary 2.3v
PWC_PVM_VOLTAGE_2V4 | power voltage monitoring boundary 2.4v
PWC_PVM_VOLTAGE_2V5 | power voltage monitoring boundary 2.5v
PWC_PVM_VOLTAGE_2V6 | power voltage monitoring boundary 2.6v
PWC_PVM_VOLTAGE_2V7 | power voltage monitoring boundary 2.7v
PWC_PVM_VOLTAGE_2V8 | power voltage monitoring boundary 2.8v
PWC_PVM_VOLTAGE_2V9 | power voltage monitoring boundary 2.9v

Definition at line 71 of file at32f413_pwc.h.

◆ pwc_sleep_enter_type

enum pwc_sleep_enter_type

pwc sleep enter type

Enumerator
PWC_SLEEP_ENTER_WFI | use wfi enter sleep mode
PWC_SLEEP_ENTER_WFE | use wfe enter sleep mode

Definition at line 85 of file at32f413_pwc.h.


AT32F413 Firmwary Library: pwc_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
pwc_type Struct Reference
AT32F413_periph_driver » PWC » PWC_exported_types

type define pwc register all More...

#include <at32f413_pwc.h>

Data Fields

union {
__IO uint32_t ctrl
struct {
__IO uint32_t reserved1: 1
__IO uint32_t lpsel: 1
__IO uint32_t clswef: 1
__IO uint32_t clsef: 1
__IO uint32_t pvmen: 1
__IO uint32_t pvmsel: 3
__IO uint32_t bpwen: 1
__IO uint32_t reserved2: 23
} ctrl_bit
};
pwc ctrl register, offset:0x00
union {
__IO uint32_t ctrlsts
struct {
__IO uint32_t swef: 1
__IO uint32_t sef: 1
__IO uint32_t pvmof: 1
__IO uint32_t reserved1: 5
__IO uint32_t swpen: 1
__IO uint32_t reserved2: 23
} ctrlsts_bit
};
pwc ctrlsts register, offset:0x04

Detailed Description

type define pwc register all

Definition at line 103 of file at32f413_pwc.h.

Field Documentation

◆ [union]

union { ... } pwc_type

pwc ctrl register, offset:0x00

◆ [union]

union { ... } pwc_type

pwc ctrlsts register, offset:0x04

◆ bpwen

__IO uint32_t pwc_type::bpwen

Definition at line 119 of file at32f413_pwc.h.

◆ clsef

__IO uint32_t pwc_type::clsef

Definition at line 116 of file at32f413_pwc.h.

◆ clswef

__IO uint32_t pwc_type::clswef

Definition at line 115 of file at32f413_pwc.h.

◆ ctrl

__IO uint32_t pwc_type::ctrl

Definition at line 110 of file at32f413_pwc.h.

◆ [struct]

struct { ... } pwc_type::ctrl_bit

◆ ctrlsts

__IO uint32_t pwc_type::ctrlsts

Definition at line 129 of file at32f413_pwc.h.

◆ [struct]

struct { ... } pwc_type::ctrlsts_bit

◆ lpsel

__IO uint32_t pwc_type::lpsel

Definition at line 114 of file at32f413_pwc.h.

◆ pvmen

__IO uint32_t pwc_type::pvmen

Definition at line 117 of file at32f413_pwc.h.

◆ pvmof

__IO uint32_t pwc_type::pvmof

Definition at line 134 of file at32f413_pwc.h.

◆ pvmsel

__IO uint32_t pwc_type::pvmsel

Definition at line 118 of file at32f413_pwc.h.

◆ reserved1

__IO uint32_t pwc_type::reserved1

Definition at line 113 of file at32f413_pwc.h.

◆ reserved2

__IO uint32_t pwc_type::reserved2

Definition at line 120 of file at32f413_pwc.h.

◆ sef

__IO uint32_t pwc_type::sef

Definition at line 133 of file at32f413_pwc.h.

◆ swef

__IO uint32_t pwc_type::swef

Definition at line 132 of file at32f413_pwc.h.

◆ swpen

__IO uint32_t pwc_type::swpen

Definition at line 136 of file at32f413_pwc.h.

The documentation for this struct was generated from the following file:
  • at32f413_pwc.h


AT32F413 Firmwary Library: PWC_exported_functions

Functions
PWC_exported_functions
AT32F413_periph_driver » PWC

Functions

void | pwc_reset (void)
deinitialize the pwc peripheral registers to their default reset values.
void | pwc_battery_powered_domain_access (confirm_state new_state)
enable or disable access to the battery powered domain.
void | pwc_pvm_level_select (pwc_pvm_voltage_type pvm_voltage)
select the voltage threshold detected by the power voltage detector.
void | pwc_power_voltage_monitor_enable (confirm_state new_state)
enable or disable pwc power voltage monitor (pvm)
void | pwc_wakeup_pin_enable (uint32_t pin_num, confirm_state new_state)
enable or disable pwc standby wakeup pin
void | pwc_flag_clear (uint32_t pwc_flag)
clear flag of pwc
flag_status | pwc_flag_get (uint32_t pwc_flag)
get flag of pwc
void | pwc_sleep_mode_enter (pwc_sleep_enter_type pwc_sleep_enter)
enter pwc sleep mode
void | pwc_deep_sleep_mode_enter (pwc_deep_sleep_enter_type pwc_deep_sleep_enter)
enter pwc deep-sleep mode
void | pwc_standby_mode_enter (void)
enter pwc standby mode

Detailed Description

Function Documentation

◆ pwc_battery_powered_domain_access()

void pwc_battery_powered_domain_access ( confirm_state new_state )

enable or disable access to the battery powered domain.

Parameters
new_state new state of battery powered domain access. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 60 of file at32f413_pwc.c.

Referenced by main(), rtc_alarm_clock_set(), rtc_config(), rtc_configuration(), rtc_init(), and rtc_time_set().

◆ pwc_deep_sleep_mode_enter()

void pwc_deep_sleep_mode_enter ( pwc_deep_sleep_enter_type pwc_deep_sleep_enter )

enter pwc deep-sleep mode

Parameters
pwc_deep_sleep_enter choose the instruction to enter deep sleep mode. this parameter can be one of the following values:
  • PWC_DEEP_SLEEP_ENTER_WFI
  • PWC_DEEP_SLEEP_ENTER_WFE
Return values
none

Definition at line 188 of file at32f413_pwc.c.

Referenced by main().

◆ pwc_flag_clear()

void pwc_flag_clear ( uint32_t pwc_flag )

clear flag of pwc

Parameters
pwc_flag select the pwc flag. this parameter can be any combination of the following values:
  • PWC_WAKEUP_FLAG
  • PWC_STANDBY_FLAG
  • note:"PWC_PVM_OUTPUT_FLAG" cannot be choose!this bit is readonly bit,it means the voltage monitoring output state
Return values
none

< standby flag

< wakeup flag

Definition at line 126 of file at32f413_pwc.c.

Referenced by main().

◆ pwc_flag_get()

flag_status pwc_flag_get ( uint32_t pwc_flag )

get flag of pwc

Parameters
pwc_flag select the pwc flag. this parameter can be one of the following values:
  • PWC_WAKEUP_FLAG
  • PWC_STANDBY_FLAG
  • PWC_PVM_OUTPUT_FLAG
Return values
state of select flag(SET or RESET).

Definition at line 143 of file at32f413_pwc.c.

Referenced by main().

◆ pwc_power_voltage_monitor_enable()

void pwc_power_voltage_monitor_enable ( confirm_state new_state )

enable or disable pwc power voltage monitor (pvm)

Parameters
new_state new state of pvm. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 89 of file at32f413_pwc.c.

Referenced by main().

◆ pwc_pvm_level_select()

void pwc_pvm_level_select ( pwc_pvm_voltage_type pvm_voltage )

select the voltage threshold detected by the power voltage detector.

Parameters
pvm_voltage select pwc pvm voltage this parameter can be one of the following values:
  • PWC_PVM_VOLTAGE_2V3
  • PWC_PVM_VOLTAGE_2V4
  • PWC_PVM_VOLTAGE_2V5
  • PWC_PVM_VOLTAGE_2V6
  • PWC_PVM_VOLTAGE_2V7
  • PWC_PVM_VOLTAGE_2V8
  • PWC_PVM_VOLTAGE_2V9
Return values
none

Definition at line 78 of file at32f413_pwc.c.

Referenced by main().

◆ pwc_reset()

void pwc_reset ( void )

deinitialize the pwc peripheral registers to their default reset values.

Parameters
none
Return values
none

Definition at line 48 of file at32f413_pwc.c.

◆ pwc_sleep_mode_enter()

void pwc_sleep_mode_enter ( pwc_sleep_enter_type pwc_sleep_enter )

enter pwc sleep mode

Parameters
sleep_mode_enter choose the instruction to enter sleep mode. this parameter can be one of the following values:
  • PWC_SLEEP_ENTER_WFI
  • PWC_SLEEP_ENTER_WFE
Return values
none

Definition at line 165 of file at32f413_pwc.c.

Referenced by main().

◆ pwc_standby_mode_enter()

void pwc_standby_mode_enter ( void )

enter pwc standby mode

Parameters
none
Return values
none

Definition at line 209 of file at32f413_pwc.c.

Referenced by main().

◆ pwc_wakeup_pin_enable()

void pwc_wakeup_pin_enable | ( | uint32_t | pin_num,
 |  | confirm_state | new_state )

enable or disable pwc standby wakeup pin

Parameters
pin_num choose the wakeup pin. this parameter can be be any combination of the following values:
  • PWC_WAKEUP_PIN_1
new_state new state of the standby wakeup pin. this parameter can be one of the following values:
  • TRUE <wakeup pin is used for wake up cpu from standby mode>
  • FALSE <wakeup pin is used for general purpose I/O>
Return values
none

Definition at line 105 of file at32f413_pwc.c.

Referenced by main().


AT32F413 Firmwary Library: PWC_private_functions

Functions
PWC_private_functions
AT32F413_periph_driver » PWC

Functions

void | pwc_reset (void)
deinitialize the pwc peripheral registers to their default reset values.
void | pwc_battery_powered_domain_access (confirm_state new_state)
enable or disable access to the battery powered domain.
void | pwc_pvm_level_select (pwc_pvm_voltage_type pvm_voltage)
select the voltage threshold detected by the power voltage detector.
void | pwc_power_voltage_monitor_enable (confirm_state new_state)
enable or disable pwc power voltage monitor (pvm)
void | pwc_wakeup_pin_enable (uint32_t pin_num, confirm_state new_state)
enable or disable pwc standby wakeup pin
void | pwc_flag_clear (uint32_t pwc_flag)
clear flag of pwc
flag_status | pwc_flag_get (uint32_t pwc_flag)
get flag of pwc
void | pwc_sleep_mode_enter (pwc_sleep_enter_type pwc_sleep_enter)
enter pwc sleep mode
void | pwc_deep_sleep_mode_enter (pwc_deep_sleep_enter_type pwc_deep_sleep_enter)
enter pwc deep-sleep mode
void | pwc_standby_mode_enter (void)
enter pwc standby mode

Detailed Description

Function Documentation

◆ pwc_battery_powered_domain_access()

void pwc_battery_powered_domain_access ( confirm_state new_state )

enable or disable access to the battery powered domain.

Parameters
new_state new state of battery powered domain access. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 60 of file at32f413_pwc.c.

Referenced by main(), rtc_alarm_clock_set(), rtc_config(), rtc_configuration(), rtc_init(), and rtc_time_set().

◆ pwc_deep_sleep_mode_enter()

void pwc_deep_sleep_mode_enter ( pwc_deep_sleep_enter_type pwc_deep_sleep_enter )

enter pwc deep-sleep mode

Parameters
pwc_deep_sleep_enter choose the instruction to enter deep sleep mode. this parameter can be one of the following values:
  • PWC_DEEP_SLEEP_ENTER_WFI
  • PWC_DEEP_SLEEP_ENTER_WFE
Return values
none

Definition at line 188 of file at32f413_pwc.c.

Referenced by main().

◆ pwc_flag_clear()

void pwc_flag_clear ( uint32_t pwc_flag )

clear flag of pwc

Parameters
pwc_flag select the pwc flag. this parameter can be any combination of the following values:
  • PWC_WAKEUP_FLAG
  • PWC_STANDBY_FLAG
  • note:"PWC_PVM_OUTPUT_FLAG" cannot be choose!this bit is readonly bit,it means the voltage monitoring output state
Return values
none

< standby flag

< wakeup flag

Definition at line 126 of file at32f413_pwc.c.

Referenced by main().

◆ pwc_flag_get()

flag_status pwc_flag_get ( uint32_t pwc_flag )

get flag of pwc

Parameters
pwc_flag select the pwc flag. this parameter can be one of the following values:
  • PWC_WAKEUP_FLAG
  • PWC_STANDBY_FLAG
  • PWC_PVM_OUTPUT_FLAG
Return values
state of select flag(SET or RESET).

Definition at line 143 of file at32f413_pwc.c.

Referenced by main().

◆ pwc_power_voltage_monitor_enable()

void pwc_power_voltage_monitor_enable ( confirm_state new_state )

enable or disable pwc power voltage monitor (pvm)

Parameters
new_state new state of pvm. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 89 of file at32f413_pwc.c.

Referenced by main().

◆ pwc_pvm_level_select()

void pwc_pvm_level_select ( pwc_pvm_voltage_type pvm_voltage )

select the voltage threshold detected by the power voltage detector.

Parameters
pvm_voltage select pwc pvm voltage this parameter can be one of the following values:
  • PWC_PVM_VOLTAGE_2V3
  • PWC_PVM_VOLTAGE_2V4
  • PWC_PVM_VOLTAGE_2V5
  • PWC_PVM_VOLTAGE_2V6
  • PWC_PVM_VOLTAGE_2V7
  • PWC_PVM_VOLTAGE_2V8
  • PWC_PVM_VOLTAGE_2V9
Return values
none

Definition at line 78 of file at32f413_pwc.c.

Referenced by main().

◆ pwc_reset()

void pwc_reset ( void )

deinitialize the pwc peripheral registers to their default reset values.

Parameters
none
Return values
none

Definition at line 48 of file at32f413_pwc.c.

◆ pwc_sleep_mode_enter()

void pwc_sleep_mode_enter ( pwc_sleep_enter_type pwc_sleep_enter )

enter pwc sleep mode

Parameters
sleep_mode_enter choose the instruction to enter sleep mode. this parameter can be one of the following values:
  • PWC_SLEEP_ENTER_WFI
  • PWC_SLEEP_ENTER_WFE
Return values
none

Definition at line 165 of file at32f413_pwc.c.

Referenced by main().

◆ pwc_standby_mode_enter()

void pwc_standby_mode_enter ( void )

enter pwc standby mode

Parameters
none
Return values
none

Definition at line 209 of file at32f413_pwc.c.

Referenced by main().

◆ pwc_wakeup_pin_enable()

void pwc_wakeup_pin_enable | ( | uint32_t | pin_num,
 |  | confirm_state | new_state )

enable or disable pwc standby wakeup pin

Parameters
pin_num choose the wakeup pin. this parameter can be be any combination of the following values:
  • PWC_WAKEUP_PIN_1
new_state new state of the standby wakeup pin. this parameter can be one of the following values:
  • TRUE <wakeup pin is used for wake up cpu from standby mode>
  • FALSE <wakeup pin is used for general purpose I/O>
Return values
none

Definition at line 105 of file at32f413_pwc.c.

Referenced by main().


AT32F413 Firmwary Library: RTC

Topics | Macros
RTC
AT32F413_periph_driver

RTC driver modules. More...

Topics

RTC_interrupts_definition
rtc interrupt
RTC_flags_definition
rtc flag
RTC_exported_types
RTC_exported_functions
RTC_private_functions

Macros

#define RTC ((rtc_type *) RTC_BASE)

Detailed Description

RTC driver modules.

Macro Definition Documentation

◆ RTC

#define RTC ((rtc_type *) RTC_BASE)

Definition at line 227 of file at32f413_rtc.h.

Referenced by rtc_alarm_set(), rtc_counter_set(), rtc_divider_get(), rtc_divider_set(), rtc_flag_clear(), rtc_flag_get(), rtc_interrupt_enable(), rtc_interrupt_flag_get(), rtc_lowlevel_counter_get(), rtc_wait_config_finish(), and rtc_wait_update_finish().


AT32F413 Firmwary Library: RTC_interrupts_definition

Macros
RTC_interrupts_definition
AT32F413_periph_driver » RTC

rtc interrupt More...

Macros

#define | RTC_TS_INT ((uint16_t)0x0001)
#define | RTC_TA_INT ((uint16_t)0x0002)
#define | RTC_OVF_INT ((uint16_t)0x0004)

Detailed Description

rtc interrupt

Macro Definition Documentation

◆ RTC_OVF_INT

#define RTC_OVF_INT ((uint16_t)0x0004)

rtc overflow interrupt

Definition at line 53 of file at32f413_rtc.h.

◆ RTC_TA_INT

#define RTC_TA_INT ((uint16_t)0x0002)

rtc time alarm interrupt

Definition at line 52 of file at32f413_rtc.h.

Referenced by alarm_init(), and rtc_config().

◆ RTC_TS_INT

#define RTC_TS_INT ((uint16_t)0x0001)

rtc time second interrupt

Definition at line 51 of file at32f413_rtc.h.

Referenced by rtc_configuration().


AT32F413 Firmwary Library: RTC_flags_definition

Macros
RTC_flags_definition
AT32F413_periph_driver » RTC

rtc flag More...

Macros

#define | RTC_TS_FLAG ((uint16_t)0x0001)
#define | RTC_TA_FLAG ((uint16_t)0x0002)
#define | RTC_OVF_FLAG ((uint16_t)0x0004)
#define | RTC_UPDF_FLAG ((uint16_t)0x0008)
#define | RTC_CFGF_FLAG ((uint16_t)0x0020)

Detailed Description

rtc flag

Macro Definition Documentation

◆ RTC_CFGF_FLAG

#define RTC_CFGF_FLAG ((uint16_t)0x0020)

rtc configuration finish flag

Definition at line 68 of file at32f413_rtc.h.

◆ RTC_OVF_FLAG

#define RTC_OVF_FLAG ((uint16_t)0x0004)

rtc overflow flag

Definition at line 66 of file at32f413_rtc.h.

◆ RTC_TA_FLAG

#define RTC_TA_FLAG ((uint16_t)0x0002)

rtc time alarm flag

Definition at line 65 of file at32f413_rtc.h.

Referenced by alarm_init(), RTC_IRQHandler(), and RTCAlarm_IRQHandler().

◆ RTC_TS_FLAG

#define RTC_TS_FLAG ((uint16_t)0x0001)

rtc time second flag

Definition at line 64 of file at32f413_rtc.h.

Referenced by main(), rtc_alarm_config(), and RTC_IRQHandler().

◆ RTC_UPDF_FLAG

#define RTC_UPDF_FLAG ((uint16_t)0x0008)

rtc update finish flag

Definition at line 67 of file at32f413_rtc.h.


AT32F413 Firmwary Library: RTC_exported_types

Data Structures
RTC_exported_types
AT32F413_periph_driver » RTC

Data Structures

struct rtc_type
type define rtc register all More...

Detailed Description

Generated by doxygen 1.12.0


AT32F413 Firmwary Library: rtc_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
rtc_type Struct Reference
AT32F413_periph_driver » RTC » RTC_exported_types

type define rtc register all More...

#include <at32f413_rtc.h>

Data Fields

union {
__IO uint32_t ctrlh
struct {
__IO uint32_t tsien: 1
__IO uint32_t taien: 1
__IO uint32_t ovfien: 1
__IO uint32_t reserved1: 29
} ctrlh_bit
};
rtc ctrlh register, offset:0x00
union {
__IO uint32_t ctrll
struct {
__IO uint32_t tsf: 1
__IO uint32_t taf: 1
__IO uint32_t ovff: 1
__IO uint32_t updf: 1
__IO uint32_t cfgen: 1
__IO uint32_t cfgf: 1
__IO uint32_t reserved1: 26
} ctrll_bit
};
rtc ctrll register, offset:0x04
union {
__IO uint32_t divh
struct {
__IO uint32_t div: 4
__IO uint32_t reserved1: 28
} divh_bit
};
rtc divh register, offset:0x08
union {
__IO uint32_t divl
struct {
__IO uint32_t div: 16
__IO uint32_t reserved1: 16
} divl_bit
};
rtc divl register, offset:0x0C
union {
__IO uint32_t divcnth
struct {
__IO uint32_t divcnt: 4
__IO uint32_t reserved1: 28
} divcnth_bit
};
rtc divcnth register, offset:0x10
union {
__IO uint32_t divcntl
struct {
__IO uint32_t divcnt: 16
__IO uint32_t reserved1: 16
} divcntl_bit
};
rtc divcntl register, offset:0x14
union {
__IO uint32_t cnth
struct {
__IO uint32_t cnt: 16
__IO uint32_t reserved1: 16
} cnth_bit
};
rtc cnth register, offset:0x18
union {
__IO uint32_t cntl
struct {
__IO uint32_t cnt: 16
__IO uint32_t reserved1: 16
} cntl_bit
};
rtc cntl register, offset:0x1C
union {
__IO uint32_t tah
struct {
__IO uint32_t ta: 16
__IO uint32_t reserved1: 16
} tah_bit
};
rtc tah register, offset:0x20
union {
__IO uint32_t tal
struct {
__IO uint32_t ta: 16
__IO uint32_t reserved1: 16
} tal_bit
};
rtc tal register, offset:0x24

Detailed Description

type define rtc register all

Definition at line 81 of file at32f413_rtc.h.

Field Documentation

◆ [union]

union { ... } rtc_type

rtc ctrlh register, offset:0x00

◆ [union]

union { ... } rtc_type

rtc ctrll register, offset:0x04

◆ [union]

union { ... } rtc_type

rtc divh register, offset:0x08

◆ [union]

union { ... } rtc_type

rtc divl register, offset:0x0C

◆ [union]

union { ... } rtc_type

rtc divcnth register, offset:0x10

◆ [union]

union { ... } rtc_type

rtc divcntl register, offset:0x14

◆ [union]

union { ... } rtc_type

rtc cnth register, offset:0x18

◆ [union]

union { ... } rtc_type

rtc cntl register, offset:0x1C

◆ [union]

union { ... } rtc_type

rtc tah register, offset:0x20

◆ [union]

union { ... } rtc_type

rtc tal register, offset:0x24

◆ cfgen

__IO uint32_t rtc_type::cfgen

Definition at line 111 of file at32f413_rtc.h.

◆ cfgf

__IO uint32_t rtc_type::cfgf

Definition at line 112 of file at32f413_rtc.h.

◆ cnt

__IO uint32_t rtc_type::cnt

Definition at line 177 of file at32f413_rtc.h.

◆ cnth

__IO uint32_t rtc_type::cnth

Definition at line 174 of file at32f413_rtc.h.

◆ [struct]

struct { ... } rtc_type::cnth_bit

◆ cntl

__IO uint32_t rtc_type::cntl

Definition at line 187 of file at32f413_rtc.h.

◆ [struct]

struct { ... } rtc_type::cntl_bit

◆ ctrlh

__IO uint32_t rtc_type::ctrlh

Definition at line 89 of file at32f413_rtc.h.

◆ [struct]

struct { ... } rtc_type::ctrlh_bit

◆ ctrll

__IO uint32_t rtc_type::ctrll

Definition at line 104 of file at32f413_rtc.h.

◆ [struct]

struct { ... } rtc_type::ctrll_bit

◆ div

__IO uint32_t rtc_type::div

Definition at line 125 of file at32f413_rtc.h.

◆ divcnt

__IO uint32_t rtc_type::divcnt

Definition at line 151 of file at32f413_rtc.h.

◆ divcnth

__IO uint32_t rtc_type::divcnth

Definition at line 148 of file at32f413_rtc.h.

◆ [struct]

struct { ... } rtc_type::divcnth_bit

◆ divcntl

__IO uint32_t rtc_type::divcntl

Definition at line 161 of file at32f413_rtc.h.

◆ [struct]

struct { ... } rtc_type::divcntl_bit

◆ divh

__IO uint32_t rtc_type::divh

Definition at line 122 of file at32f413_rtc.h.

◆ [struct]

struct { ... } rtc_type::divh_bit

◆ divl

__IO uint32_t rtc_type::divl

Definition at line 135 of file at32f413_rtc.h.

◆ [struct]

struct { ... } rtc_type::divl_bit

◆ ovff

__IO uint32_t rtc_type::ovff

Definition at line 109 of file at32f413_rtc.h.

◆ ovfien

__IO uint32_t rtc_type::ovfien

Definition at line 94 of file at32f413_rtc.h.

◆ reserved1

__IO uint32_t rtc_type::reserved1

Definition at line 95 of file at32f413_rtc.h.

◆ ta

__IO uint32_t rtc_type::ta

Definition at line 203 of file at32f413_rtc.h.

◆ taf

__IO uint32_t rtc_type::taf

Definition at line 108 of file at32f413_rtc.h.

◆ tah

__IO uint32_t rtc_type::tah

Definition at line 200 of file at32f413_rtc.h.

◆ [struct]

struct { ... } rtc_type::tah_bit

◆ taien

__IO uint32_t rtc_type::taien

Definition at line 93 of file at32f413_rtc.h.

◆ tal

__IO uint32_t rtc_type::tal

Definition at line 213 of file at32f413_rtc.h.

◆ [struct]

struct { ... } rtc_type::tal_bit

◆ tsf

__IO uint32_t rtc_type::tsf

Definition at line 107 of file at32f413_rtc.h.

◆ tsien

__IO uint32_t rtc_type::tsien

Definition at line 92 of file at32f413_rtc.h.

◆ updf

__IO uint32_t rtc_type::updf

Definition at line 110 of file at32f413_rtc.h.

The documentation for this struct was generated from the following file:
  • at32f413_rtc.h


AT32F413 Firmwary Library: RTC_exported_functions

Functions
RTC_exported_functions
AT32F413_periph_driver » RTC

Functions

void | rtc_counter_set (uint32_t counter_value)
rtc counter set
uint32_t | rtc_counter_get (void)
rtc counter get
void | rtc_divider_set (uint32_t div_value)
rtc divider set
uint32_t | rtc_divider_get (void)
rtc divider get
void | rtc_alarm_set (uint32_t alarm_value)
rtc alarm value set
void | rtc_interrupt_enable (uint16_t source, confirm_state new_state)
rtc interrupt enable
flag_status | rtc_flag_get (uint16_t flag)
rtc flag get
flag_status | rtc_interrupt_flag_get (uint16_t flag)
rtc interrupt flag get
void | rtc_flag_clear (uint16_t flag)
rtc flag clear
void | rtc_wait_config_finish (void)
rtc wait configuration finish
void | rtc_wait_update_finish (void)
rtc wait update finish

Detailed Description

Function Documentation

◆ rtc_alarm_set()

void rtc_alarm_set ( uint32_t alarm_value )

rtc alarm value set

Parameters
alarm_value (0x0000_0000 ~ 0xFFFF_FFFF)
Return values
none

Definition at line 136 of file at32f413_rtc.c.

Referenced by main(), rtc_alarm_clock_set(), and rtc_alarm_config().

◆ rtc_counter_get()

uint32_t rtc_counter_get ( void )

rtc counter get

Parameters
none
Return values
rtc counter

Definition at line 81 of file at32f413_rtc.c.

Referenced by main(), randnum_test(), rtc_alarm_config(), RTC_IRQHandler(), and rtc_time_get().

◆ rtc_counter_set()

void rtc_counter_set ( uint32_t counter_value )

rtc counter set

Parameters
counter_value (0x0000_0000 ~ 0xFFFF_FFFF)
Return values
none

Definition at line 48 of file at32f413_rtc.c.

Referenced by rtc_time_set().

◆ rtc_divider_get()

uint32_t rtc_divider_get ( void )

rtc divider get

Parameters
none
Return values
rtc counter

Definition at line 121 of file at32f413_rtc.c.

◆ rtc_divider_set()

void rtc_divider_set ( uint32_t div_value )

rtc divider set

Parameters
div_value (0x0000_0000 ~ 0x000F_FFFF)
Return values
none

Definition at line 103 of file at32f413_rtc.c.

Referenced by main(), rtc_config(), rtc_configuration(), and rtc_init().

◆ rtc_flag_clear()

void rtc_flag_clear ( uint16_t flag )

rtc flag clear

Parameters
interrupt_flag this parameter can be any combination of the following values:
  • RTC_TS_FLAG: time second flag.
  • RTC_TA_FLAG: time alarm flag.
  • RTC_OVF_FLAG: overflow flag.
  • RTC_UPDF_FLAG: rtc update finish flag.
Return values
none

Definition at line 233 of file at32f413_rtc.c.

Referenced by alarm_init(), main(), rtc_alarm_config(), RTC_IRQHandler(), and RTCAlarm_IRQHandler().

◆ rtc_flag_get()

flag_status rtc_flag_get ( uint16_t flag )

rtc flag get

Parameters
flag this parameter can be one of the following values:
  • RTC_TS_FLAG: time second flag.
  • RTC_TA_FLAG: time alarm flag.
  • RTC_OVF_FLAG: overflow flag.
  • RTC_UPDF_FLAG: rtc update finish flag.
  • RTC_CFGF_FLAG: rtc configuration finish flag.
Return values
state of rtc flag

Definition at line 182 of file at32f413_rtc.c.

Referenced by main(), and rtc_alarm_config().

◆ rtc_interrupt_enable()

void rtc_interrupt_enable | ( | uint16_t | source,
 |  | confirm_state | new_state )

rtc interrupt enable

Parameters
source this parameter can be any combination of the following values:
  • RTC_TS_INT: time second interrupt.
  • RTC_TA_INT: time alarm interrupt.
  • RTC_OVF_INT: overflow interrupt.
new_state (TRUE or FALSE)
Return values
none

Definition at line 159 of file at32f413_rtc.c.

Referenced by alarm_init(), rtc_config(), and rtc_configuration().

◆ rtc_interrupt_flag_get()

flag_status rtc_interrupt_flag_get ( uint16_t flag )

rtc interrupt flag get

Parameters
flag this parameter can be one of the following values:
  • RTC_TS_FLAG: time second flag.
  • RTC_TA_FLAG: time alarm flag.
  • RTC_OVF_FLAG: overflow flag.
Return values
state of rtc flag

Definition at line 207 of file at32f413_rtc.c.

Referenced by RTC_IRQHandler(), and RTCAlarm_IRQHandler().

◆ rtc_wait_config_finish()

void rtc_wait_config_finish ( void )

rtc wait configuration finish

Parameters
none
Return values
none

Definition at line 243 of file at32f413_rtc.c.

Referenced by alarm_init(), main(), rtc_alarm_clock_set(), rtc_alarm_config(), rtc_config(), rtc_configuration(), rtc_init(), rtc_time_set(), and RTCAlarm_IRQHandler().

◆ rtc_wait_update_finish()

void rtc_wait_update_finish ( void )

rtc wait update finish

Parameters
none
Return values
none

Definition at line 253 of file at32f413_rtc.c.

Referenced by rtc_config(), rtc_configuration(), and rtc_init().


AT32F413 Firmwary Library: RTC_private_functions

Functions
RTC_private_functions
AT32F413_periph_driver » RTC

Functions

void | rtc_counter_set (uint32_t counter_value)
rtc counter set
uint32_t | rtc_lowlevel_counter_get (void)
rtc lowlevel counter get
uint32_t | rtc_counter_get (void)
rtc counter get
void | rtc_divider_set (uint32_t div_value)
rtc divider set
uint32_t | rtc_divider_get (void)
rtc divider get
void | rtc_alarm_set (uint32_t alarm_value)
rtc alarm value set
void | rtc_interrupt_enable (uint16_t source, confirm_state new_state)
rtc interrupt enable
flag_status | rtc_flag_get (uint16_t flag)
rtc flag get
flag_status | rtc_interrupt_flag_get (uint16_t flag)
rtc interrupt flag get
void | rtc_flag_clear (uint16_t flag)
rtc flag clear
void | rtc_wait_config_finish (void)
rtc wait configuration finish
void | rtc_wait_update_finish (void)
rtc wait update finish

Detailed Description

Function Documentation

◆ rtc_alarm_set()

void rtc_alarm_set ( uint32_t alarm_value )

rtc alarm value set

Parameters
alarm_value (0x0000_0000 ~ 0xFFFF_FFFF)
Return values
none

Definition at line 136 of file at32f413_rtc.c.

Referenced by main(), rtc_alarm_clock_set(), and rtc_alarm_config().

◆ rtc_counter_get()

uint32_t rtc_counter_get ( void )

rtc counter get

Parameters
none
Return values
rtc counter

Definition at line 81 of file at32f413_rtc.c.

Referenced by main(), randnum_test(), rtc_alarm_config(), RTC_IRQHandler(), and rtc_time_get().

◆ rtc_counter_set()

void rtc_counter_set ( uint32_t counter_value )

rtc counter set

Parameters
counter_value (0x0000_0000 ~ 0xFFFF_FFFF)
Return values
none

Definition at line 48 of file at32f413_rtc.c.

Referenced by rtc_time_set().

◆ rtc_divider_get()

uint32_t rtc_divider_get ( void )

rtc divider get

Parameters
none
Return values
rtc counter

Definition at line 121 of file at32f413_rtc.c.

◆ rtc_divider_set()

void rtc_divider_set ( uint32_t div_value )

rtc divider set

Parameters
div_value (0x0000_0000 ~ 0x000F_FFFF)
Return values
none

Definition at line 103 of file at32f413_rtc.c.

Referenced by main(), rtc_config(), rtc_configuration(), and rtc_init().

◆ rtc_flag_clear()

void rtc_flag_clear ( uint16_t flag )

rtc flag clear

Parameters
interrupt_flag this parameter can be any combination of the following values:
  • RTC_TS_FLAG: time second flag.
  • RTC_TA_FLAG: time alarm flag.
  • RTC_OVF_FLAG: overflow flag.
  • RTC_UPDF_FLAG: rtc update finish flag.
Return values
none

Definition at line 233 of file at32f413_rtc.c.

Referenced by alarm_init(), main(), rtc_alarm_config(), RTC_IRQHandler(), and RTCAlarm_IRQHandler().

◆ rtc_flag_get()

flag_status rtc_flag_get ( uint16_t flag )

rtc flag get

Parameters
flag this parameter can be one of the following values:
  • RTC_TS_FLAG: time second flag.
  • RTC_TA_FLAG: time alarm flag.
  • RTC_OVF_FLAG: overflow flag.
  • RTC_UPDF_FLAG: rtc update finish flag.
  • RTC_CFGF_FLAG: rtc configuration finish flag.
Return values
state of rtc flag

Definition at line 182 of file at32f413_rtc.c.

Referenced by main(), and rtc_alarm_config().

◆ rtc_interrupt_enable()

void rtc_interrupt_enable | ( | uint16_t | source,
 |  | confirm_state | new_state )

rtc interrupt enable

Parameters
source this parameter can be any combination of the following values:
  • RTC_TS_INT: time second interrupt.
  • RTC_TA_INT: time alarm interrupt.
  • RTC_OVF_INT: overflow interrupt.
new_state (TRUE or FALSE)
Return values
none

Definition at line 159 of file at32f413_rtc.c.

Referenced by alarm_init(), rtc_config(), and rtc_configuration().

◆ rtc_interrupt_flag_get()

flag_status rtc_interrupt_flag_get ( uint16_t flag )

rtc interrupt flag get

Parameters
flag this parameter can be one of the following values:
  • RTC_TS_FLAG: time second flag.
  • RTC_TA_FLAG: time alarm flag.
  • RTC_OVF_FLAG: overflow flag.
Return values
state of rtc flag

Definition at line 207 of file at32f413_rtc.c.

Referenced by RTC_IRQHandler(), and RTCAlarm_IRQHandler().

◆ rtc_lowlevel_counter_get()

uint32_t rtc_lowlevel_counter_get ( void )

rtc lowlevel counter get

Parameters
none
Return values
rtc counter

Definition at line 66 of file at32f413_rtc.c.

Referenced by rtc_counter_get().

◆ rtc_wait_config_finish()

void rtc_wait_config_finish ( void )

rtc wait configuration finish

Parameters
none
Return values
none

Definition at line 243 of file at32f413_rtc.c.

Referenced by alarm_init(), main(), rtc_alarm_clock_set(), rtc_alarm_config(), rtc_config(), rtc_configuration(), rtc_init(), rtc_time_set(), and RTCAlarm_IRQHandler().

◆ rtc_wait_update_finish()

void rtc_wait_update_finish ( void )

rtc wait update finish

Parameters
none
Return values
none

Definition at line 253 of file at32f413_rtc.c.

Referenced by rtc_config(), rtc_configuration(), and rtc_init().


AT32F413 Firmwary Library: SDIO

Topics
SDIO
AT32F413_periph_driver

SDIO driver modules. More...

Topics

SDIO_interrupts_definition
sdio interrupt
SDIO_flags_definition
sdio flag
SDIO_exported_types
SDIO_exported_functions
SDIO_private_functions

Detailed Description

SDIO driver modules.


AT32F413 Firmwary Library: SDIO_interrupts_definition

Macros
SDIO_interrupts_definition
AT32F413_periph_driver » SDIO

sdio interrupt More...

Macros

#define | SDIO_CMDFAIL_INT ((uint32_t)0x00000001)
#define | SDIO_DTFAIL_INT ((uint32_t)0x00000002)
#define | SDIO_CMDTIMEOUT_INT ((uint32_t)0x00000004)
#define | SDIO_DTTIMEOUT_INT ((uint32_t)0x00000008)
#define | SDIO_TXERRU_INT ((uint32_t)0x00000010)
#define | SDIO_RXERRO_INT ((uint32_t)0x00000020)
#define | SDIO_CMDRSPCMPL_INT ((uint32_t)0x00000040)
#define | SDIO_CMDCMPL_INT ((uint32_t)0x00000080)
#define | SDIO_DTCMP_INT ((uint32_t)0x00000100)
#define | SDIO_SBITERR_INT ((uint32_t)0x00000200)
#define | SDIO_DTBLKCMPL_INT ((uint32_t)0x00000400)
#define | SDIO_DOCMD_INT ((uint32_t)0x00000800)
#define | SDIO_DOTX_INT ((uint32_t)0x00001000)
#define | SDIO_DORX_INT ((uint32_t)0x00002000)
#define | SDIO_TXBUFH_INT ((uint32_t)0x00004000)
#define | SDIO_RXBUFH_INT ((uint32_t)0x00008000)
#define | SDIO_TXBUFF_INT ((uint32_t)0x00010000)
#define | SDIO_RXBUFF_INT ((uint32_t)0x00020000)
#define | SDIO_TXBUFE_INT ((uint32_t)0x00040000)
#define | SDIO_RXBUFE_INT ((uint32_t)0x00080000)
#define | SDIO_TXBUF_INT ((uint32_t)0x00100000)
#define | SDIO_RXBUF_INT ((uint32_t)0x00200000)
#define | SDIO_SDIOIF_INT ((uint32_t)0x00400000)

Detailed Description

sdio interrupt

Macro Definition Documentation

◆ SDIO_CMDCMPL_INT

#define SDIO_CMDCMPL_INT ((uint32_t)0x00000080)

command sent interrupt

Definition at line 58 of file at32f413_sdio.h.

◆ SDIO_CMDFAIL_INT

#define SDIO_CMDFAIL_INT ((uint32_t)0x00000001)

command response received check failed interrupt

Definition at line 51 of file at32f413_sdio.h.

◆ SDIO_CMDRSPCMPL_INT

#define SDIO_CMDRSPCMPL_INT ((uint32_t)0x00000040)

command response received interrupt

Definition at line 57 of file at32f413_sdio.h.

◆ SDIO_CMDTIMEOUT_INT

#define SDIO_CMDTIMEOUT_INT ((uint32_t)0x00000004)

command response timerout interrupt

Definition at line 53 of file at32f413_sdio.h.

◆ SDIO_DOCMD_INT

#define SDIO_DOCMD_INT ((uint32_t)0x00000800)

command transfer in progress interrupt

Definition at line 62 of file at32f413_sdio.h.

◆ SDIO_DORX_INT

#define SDIO_DORX_INT ((uint32_t)0x00002000)

data receive in progress interrupt

Definition at line 64 of file at32f413_sdio.h.

◆ SDIO_DOTX_INT

#define SDIO_DOTX_INT ((uint32_t)0x00001000)

data transmit in progress interrupt

Definition at line 63 of file at32f413_sdio.h.

◆ SDIO_DTBLKCMPL_INT

#define SDIO_DTBLKCMPL_INT ((uint32_t)0x00000400)

data block sent/received interrupt

Definition at line 61 of file at32f413_sdio.h.

◆ SDIO_DTCMP_INT

#define SDIO_DTCMP_INT ((uint32_t)0x00000100)

data sent interrupt

Definition at line 59 of file at32f413_sdio.h.

Referenced by sd_irq_service().

◆ SDIO_DTFAIL_INT

#define SDIO_DTFAIL_INT ((uint32_t)0x00000002)

data block sent/received check failed interrupt

Definition at line 52 of file at32f413_sdio.h.

Referenced by sd_irq_service().

◆ SDIO_DTTIMEOUT_INT

#define SDIO_DTTIMEOUT_INT ((uint32_t)0x00000008)

data timeout interrupt

Definition at line 54 of file at32f413_sdio.h.

Referenced by sd_irq_service().

◆ SDIO_RXBUF_INT

#define SDIO_RXBUF_INT ((uint32_t)0x00200000)

data available in receive interrupt

Definition at line 72 of file at32f413_sdio.h.

◆ SDIO_RXBUFE_INT

#define SDIO_RXBUFE_INT ((uint32_t)0x00080000)

receive buf empty interrupt

Definition at line 70 of file at32f413_sdio.h.

◆ SDIO_RXBUFF_INT

#define SDIO_RXBUFF_INT ((uint32_t)0x00020000)

receive buf full interrupt

Definition at line 68 of file at32f413_sdio.h.

◆ SDIO_RXBUFH_INT

#define SDIO_RXBUFH_INT ((uint32_t)0x00008000)

receive buf half full interrupt

Definition at line 66 of file at32f413_sdio.h.

Referenced by sd_irq_service().

◆ SDIO_RXERRO_INT

#define SDIO_RXERRO_INT ((uint32_t)0x00000020)

received overrun error interrupt

Definition at line 56 of file at32f413_sdio.h.

Referenced by sd_irq_service().

◆ SDIO_SBITERR_INT

#define SDIO_SBITERR_INT ((uint32_t)0x00000200)

start bit not detected on data bus interrupt

Definition at line 60 of file at32f413_sdio.h.

Referenced by sd_irq_service().

◆ SDIO_SDIOIF_INT

#define SDIO_SDIOIF_INT ((uint32_t)0x00400000)

sdio interface received interrupt

Definition at line 73 of file at32f413_sdio.h.

◆ SDIO_TXBUF_INT

#define SDIO_TXBUF_INT ((uint32_t)0x00100000)

data available in transmit interrupt

Definition at line 71 of file at32f413_sdio.h.

◆ SDIO_TXBUFE_INT

#define SDIO_TXBUFE_INT ((uint32_t)0x00040000)

transmit buf empty interrupt

Definition at line 69 of file at32f413_sdio.h.

◆ SDIO_TXBUFF_INT

#define SDIO_TXBUFF_INT ((uint32_t)0x00010000)

transmit buf full interrupt

Definition at line 67 of file at32f413_sdio.h.

◆ SDIO_TXBUFH_INT

#define SDIO_TXBUFH_INT ((uint32_t)0x00004000)

transmit buf half empty interrupt

Definition at line 65 of file at32f413_sdio.h.

Referenced by sd_irq_service().

◆ SDIO_TXERRU_INT

#define SDIO_TXERRU_INT ((uint32_t)0x00000010)

transmit underrun error interrupt

Definition at line 55 of file at32f413_sdio.h.

Referenced by sd_irq_service().


AT32F413 Firmwary Library: SDIO_flags_definition

Macros
SDIO_flags_definition
AT32F413_periph_driver » SDIO

sdio flag More...

Macros

#define | SDIO_CMDFAIL_FLAG ((uint32_t)0x00000001)
#define | SDIO_DTFAIL_FLAG ((uint32_t)0x00000002)
#define | SDIO_CMDTIMEOUT_FLAG ((uint32_t)0x00000004)
#define | SDIO_DTTIMEOUT_FLAG ((uint32_t)0x00000008)
#define | SDIO_TXERRU_FLAG ((uint32_t)0x00000010)
#define | SDIO_RXERRO_FLAG ((uint32_t)0x00000020)
#define | SDIO_CMDRSPCMPL_FLAG ((uint32_t)0x00000040)
#define | SDIO_CMDCMPL_FLAG ((uint32_t)0x00000080)
#define | SDIO_DTCMPL_FLAG ((uint32_t)0x00000100)
#define | SDIO_SBITERR_FLAG ((uint32_t)0x00000200)
#define | SDIO_DTBLKCMPL_FLAG ((uint32_t)0x00000400)
#define | SDIO_DOCMD_FLAG ((uint32_t)0x00000800)
#define | SDIO_DOTX_FLAG ((uint32_t)0x00001000)
#define | SDIO_DORX_FLAG ((uint32_t)0x00002000)
#define | SDIO_TXBUFH_FLAG ((uint32_t)0x00004000)
#define | SDIO_RXBUFH_FLAG ((uint32_t)0x00008000)
#define | SDIO_TXBUFF_FLAG ((uint32_t)0x00010000)
#define | SDIO_RXBUFF_FLAG ((uint32_t)0x00020000)
#define | SDIO_TXBUFE_FLAG ((uint32_t)0x00040000)
#define | SDIO_RXBUFE_FLAG ((uint32_t)0x00080000)
#define | SDIO_TXBUF_FLAG ((uint32_t)0x00100000)
#define | SDIO_RXBUF_FLAG ((uint32_t)0x00200000)
#define | SDIO_SDIOIF_FLAG ((uint32_t)0x00400000)

Detailed Description

sdio flag

Macro Definition Documentation

◆ SDIO_CMDCMPL_FLAG

#define SDIO_CMDCMPL_FLAG ((uint32_t)0x00000080)

command sent flag

Definition at line 91 of file at32f413_sdio.h.

Referenced by command_error().

◆ SDIO_CMDFAIL_FLAG

#define SDIO_CMDFAIL_FLAG ((uint32_t)0x00000001)

command response received check failed flag

Definition at line 84 of file at32f413_sdio.h.

Referenced by check_card_programming(), command_rsp1_error(), command_rsp2_error(), command_rsp3_error(), command_rsp4_error(), command_rsp5_error(), command_rsp6_error(), and command_rsp7_error().

◆ SDIO_CMDRSPCMPL_FLAG

#define SDIO_CMDRSPCMPL_FLAG ((uint32_t)0x00000040)

command response received flag

Definition at line 90 of file at32f413_sdio.h.

Referenced by check_card_programming(), command_rsp1_error(), command_rsp2_error(), command_rsp3_error(), command_rsp4_error(), command_rsp5_error(), command_rsp6_error(), and command_rsp7_error().

◆ SDIO_CMDTIMEOUT_FLAG

#define SDIO_CMDTIMEOUT_FLAG ((uint32_t)0x00000004)

command response timerout flag

Definition at line 86 of file at32f413_sdio.h.

Referenced by check_card_programming(), command_rsp1_error(), command_rsp2_error(), command_rsp3_error(), command_rsp4_error(), command_rsp5_error(), command_rsp6_error(), and command_rsp7_error().

◆ SDIO_DOCMD_FLAG

#define SDIO_DOCMD_FLAG ((uint32_t)0x00000800)

command transfer in progress flag

Definition at line 95 of file at32f413_sdio.h.

◆ SDIO_DORX_FLAG

#define SDIO_DORX_FLAG ((uint32_t)0x00002000)

data receive in progress flag

Definition at line 97 of file at32f413_sdio.h.

◆ SDIO_DOTX_FLAG

#define SDIO_DOTX_FLAG ((uint32_t)0x00001000)

data transmit in progress flag

Definition at line 96 of file at32f413_sdio.h.

◆ SDIO_DTBLKCMPL_FLAG

#define SDIO_DTBLKCMPL_FLAG ((uint32_t)0x00000400)

data block sent/received flag

Definition at line 94 of file at32f413_sdio.h.

Referenced by get_ext_csd(), and scr_find().

◆ SDIO_DTCMPL_FLAG

#define SDIO_DTCMPL_FLAG ((uint32_t)0x00000100)

data sent flag

Definition at line 92 of file at32f413_sdio.h.

Referenced by sd_irq_service(), and sdio_command_data_send().

◆ SDIO_DTFAIL_FLAG

#define SDIO_DTFAIL_FLAG ((uint32_t)0x00000002)

data block sent/received check failed flag

Definition at line 85 of file at32f413_sdio.h.

Referenced by get_ext_csd(), scr_find(), sd_irq_service(), and sdio_command_data_send().

◆ SDIO_DTTIMEOUT_FLAG

#define SDIO_DTTIMEOUT_FLAG ((uint32_t)0x00000008)

data timeout flag

Definition at line 87 of file at32f413_sdio.h.

Referenced by get_ext_csd(), scr_find(), sd_irq_service(), and sdio_command_data_send().

◆ SDIO_RXBUF_FLAG

#define SDIO_RXBUF_FLAG ((uint32_t)0x00200000)

data available in receive flag

Definition at line 105 of file at32f413_sdio.h.

Referenced by get_ext_csd(), scr_find(), and sdio_command_data_send().

◆ SDIO_RXBUFE_FLAG

#define SDIO_RXBUFE_FLAG ((uint32_t)0x00080000)

receive buf empty flag

Definition at line 103 of file at32f413_sdio.h.

◆ SDIO_RXBUFF_FLAG

#define SDIO_RXBUFF_FLAG ((uint32_t)0x00020000)

receive buf full flag

Definition at line 101 of file at32f413_sdio.h.

◆ SDIO_RXBUFH_FLAG

#define SDIO_RXBUFH_FLAG ((uint32_t)0x00008000)

receive buf half full flag

Definition at line 99 of file at32f413_sdio.h.

Referenced by sdio_command_data_send().

◆ SDIO_RXERRO_FLAG

#define SDIO_RXERRO_FLAG ((uint32_t)0x00000020)

received overrun error flag

Definition at line 89 of file at32f413_sdio.h.

Referenced by get_ext_csd(), scr_find(), sd_irq_service(), and sdio_command_data_send().

◆ SDIO_SBITERR_FLAG

#define SDIO_SBITERR_FLAG ((uint32_t)0x00000200)

start bit not detected on data bus flag

Definition at line 93 of file at32f413_sdio.h.

Referenced by get_ext_csd(), scr_find(), sd_irq_service(), and sdio_command_data_send().

◆ SDIO_SDIOIF_FLAG

#define SDIO_SDIOIF_FLAG ((uint32_t)0x00400000)

sdio interface received flag

Definition at line 106 of file at32f413_sdio.h.

◆ SDIO_TXBUF_FLAG

#define SDIO_TXBUF_FLAG ((uint32_t)0x00100000)

data available in transmit flag

Definition at line 104 of file at32f413_sdio.h.

◆ SDIO_TXBUFE_FLAG

#define SDIO_TXBUFE_FLAG ((uint32_t)0x00040000)

transmit buf empty flag

Definition at line 102 of file at32f413_sdio.h.

◆ SDIO_TXBUFF_FLAG

#define SDIO_TXBUFF_FLAG ((uint32_t)0x00010000)

transmit buf full flag

Definition at line 100 of file at32f413_sdio.h.

◆ SDIO_TXBUFH_FLAG

#define SDIO_TXBUFH_FLAG ((uint32_t)0x00004000)

transmit buf half empty flag

Definition at line 98 of file at32f413_sdio.h.

Referenced by sdio_command_data_send().

◆ SDIO_TXERRU_FLAG

#define SDIO_TXERRU_FLAG ((uint32_t)0x00000010)

transmit underrun error flag

Definition at line 88 of file at32f413_sdio.h.

Referenced by sd_irq_service(), and sdio_command_data_send().


AT32F413 Firmwary Library: SDIO_exported_types

Data Structures | Enumerations | Variables
SDIO_exported_types
AT32F413_periph_driver » SDIO | AT32F413_periph_examples » SDIO_emmc_card | AT32F413_periph_examples » SDIO_sd_mmc_card | AT32F413_periph_examples » SDIO_sdio_fatfs

Data Structures

struct | sdio_command_struct_type
sdio command structure More...
struct | sdio_data_struct_type
sdio data structure More...
struct | sdio_type
type define sdio register all More...
struct | sd_csd_struct_type
struct | sd_cid_struct_type
struct | sd_scr_struct_type
struct | sd_card_info_struct_type

Enumerations

enum | sdio_power_state_type { SDIO_POWER_OFF = 0x00 , SDIO_POWER_ON = 0x03 }
sdio power state More...
enum | sdio_edge_phase_type { SDIO_CLOCK_EDGE_RISING = 0x00 , SDIO_CLOCK_EDGE_FALLING = 0x01 }
sdio edge phase More...
enum | sdio_bus_width_type { SDIO_BUS_WIDTH_D1 = 0x00 , SDIO_BUS_WIDTH_D4 = 0x01 , SDIO_BUS_WIDTH_D8 = 0x02 }
sdio bus width More...
enum | sdio_reponse_type { SDIO_RESPONSE_NO = 0x00 , SDIO_RESPONSE_SHORT = 0x01 , SDIO_RESPONSE_LONG = 0x03 }
sdio response type More...
enum | sdio_wait_type { SDIO_WAIT_FOR_NO = 0x00 , SDIO_WAIT_FOR_INT = 0x01 , SDIO_WAIT_FOR_PEND = 0x02 }
sdio wait type More...
enum | sdio_rsp_index_type { SDIO_RSP1_INDEX = 0x00 , SDIO_RSP2_INDEX = 0x01 , SDIO_RSP3_INDEX = 0x02 , SDIO_RSP4_INDEX = 0x03 }
sdio response register index More...
enum sdio_block_size_type {
SDIO_DATA_BLOCK_SIZE_1B = 0x00 , SDIO_DATA_BLOCK_SIZE_2B = 0x01 , SDIO_DATA_BLOCK_SIZE_4B = 0x02 , SDIO_DATA_BLOCK_SIZE_8B = 0x03 ,
SDIO_DATA_BLOCK_SIZE_16B = 0x04 , SDIO_DATA_BLOCK_SIZE_32B = 0x05 , SDIO_DATA_BLOCK_SIZE_64B = 0x06 , SDIO_DATA_BLOCK_SIZE_128B = 0x07 ,
SDIO_DATA_BLOCK_SIZE_256B = 0x08 , SDIO_DATA_BLOCK_SIZE_512B = 0x09 , SDIO_DATA_BLOCK_SIZE_1024B = 0x0A , SDIO_DATA_BLOCK_SIZE_2048B = 0x0B ,
SDIO_DATA_BLOCK_SIZE_4096B = 0x0C , SDIO_DATA_BLOCK_SIZE_8192B = 0x0D , SDIO_DATA_BLOCK_SIZE_16384B = 0x0E
}
sdio data block size More...
enum | sdio_transfer_mode_type { SDIO_DATA_BLOCK_TRANSFER = 0x00 , SDIO_DATA_STREAM_TRANSFER = 0x01 }
sdio data transfer mode More...
enum | sdio_transfer_direction_type { SDIO_DATA_TRANSFER_TO_CARD = 0x00 , SDIO_DATA_TRANSFER_TO_CONTROLLER = 0x01 }
sdio data transfer direction More...
enum | sdio_read_wait_mode_type { SDIO_READ_WAIT_CONTROLLED_BY_D2 = 0x00 , SDIO_READ_WAIT_CONTROLLED_BY_CK = 0x01 }
sdio read wait mode More...
enum | sd_data_transfer_mode_type { SD_TRANSFER_POLLING_MODE = 0 , SD_TRANSFER_DMA_MODE = 1 }
enum sd_error_status_type {
SD_CMD_FAIL = 1 , SD_DATA_FAIL = 2 , SD_CMD_RSP_TIMEOUT = 3 , SD_DATA_TIMEOUT = 4 ,
SD_TX_UNDERRUN = 5 , SD_RX_OVERRUN = 6 , SD_START_BIT_ERR = 7 , SD_CMD_OUT_OF_RANGE = 8 ,
SD_ADDR_MISALIGNED = 9 , SD_BLK_LEN_ERR = 10 , SD_ERASE_SEQ_ERR = 11 , SD_INVALID_ERASE_PARAM = 12 ,
SD_WR_PROTECT_VIOLATION = 13 , SD_LOCK_UNLOCK_ERROR = 14 , SD_CMD_CRC_ERROR = 15 , SD_ILLEGAL_CMD = 16 ,
SD_CARD_ECC_ERROR = 17 , SD_CARD_CONTROLLER_ERR = 18 , SD_GENERAL_UNKNOWN_ERROR = 19 , SD_STREAM_RD_UNDERRUN = 20 ,
SD_STREAM_WR_OVERRUN = 21 , SD_CID_CSD_OVERWRITE = 22 , SD_WP_ERASE_SKIP = 23 , SD_CARD_ECC_DISABLED = 24 ,
SD_ERASE_RESET = 25 , SD_AKE_SEQ_ERROR = 26 , SD_INVALID_VOLTRANGE = 27 , SD_ADDR_OUT_OF_RANGE = 28 ,
SD_SWITCH_ERROR = 29 , SD_SDIO_DISABLED = 30 , SD_SDIO_FUNC_BUSY = 31 , SD_SDIO_FUNC_ERROR = 32 ,
SD_SDIO_UNKNOWN_FUNC = 33 , SD_INTERNAL_ERROR , SD_NOT_CONFIGURED , SD_REQ_PENDING ,
SD_REQ_NOT_APPLICABLE , SD_INVALID_PARAMETER , SD_UNSUPPORTED_FEATURE , SD_UNSUPPORTED_HW ,
SD_ERROR , SD_OK = 0
}
enum sd_card_state_type {
SD_CARD_READY = ((uint32_t)0x00000001) , SD_CARD_IDENTIFICATION = ((uint32_t)0x00000002) , SD_CARD_STANDBY = ((uint32_t)0x00000003) , SD_CARD_TRANSFER = ((uint32_t)0x00000004) ,
SD_CARD_SENDING = ((uint32_t)0x00000005) , SD_CARD_RECEIVING = ((uint32_t)0x00000006) , SD_CARD_PROGRAMMING = ((uint32_t)0x00000007) , SD_CARD_DISCONNECTED = ((uint32_t)0x00000008) ,
SD_CARD_ERROR = ((uint32_t)0x000000FF)
}
enum sd_memory_card_type {
SDIO_STD_CAPACITY_SD_CARD_V1_1 = 0 , SDIO_STD_CAPACITY_SD_CARD_V2_0 = 1 , SDIO_HIGH_CAPACITY_SD_CARD = 2 , SDIO_MULTIMEDIA_CARD = 3 ,
SDIO_SECURE_DIGITAL_IO_CARD = 4 , SDIO_HIGH_SPEED_MULTIMEDIA_CARD = 5 , SDIO_SECURE_DIGITAL_IO_COMBO_CARD = 6 , SDIO_HIGH_CAPACITY_MMC_CARD = 7 ,
SDIO_SDIO_CARD = 8
}
enum | sd_data_transfer_mode_type { SD_TRANSFER_POLLING_MODE = 0 , SD_TRANSFER_DMA_MODE = 1 }
enum sd_error_status_type {
SD_CMD_FAIL = 1 , SD_DATA_FAIL = 2 , SD_CMD_RSP_TIMEOUT = 3 , SD_DATA_TIMEOUT = 4 ,
SD_TX_UNDERRUN = 5 , SD_RX_OVERRUN = 6 , SD_START_BIT_ERR = 7 , SD_CMD_OUT_OF_RANGE = 8 ,
SD_ADDR_MISALIGNED = 9 , SD_BLK_LEN_ERR = 10 , SD_ERASE_SEQ_ERR = 11 , SD_INVALID_ERASE_PARAM = 12 ,
SD_WR_PROTECT_VIOLATION = 13 , SD_LOCK_UNLOCK_ERROR = 14 , SD_CMD_CRC_ERROR = 15 , SD_ILLEGAL_CMD = 16 ,
SD_CARD_ECC_ERROR = 17 , SD_CARD_CONTROLLER_ERR = 18 , SD_GENERAL_UNKNOWN_ERROR = 19 , SD_STREAM_RD_UNDERRUN = 20 ,
SD_STREAM_WR_OVERRUN = 21 , SD_CID_CSD_OVERWRITE = 22 , SD_WP_ERASE_SKIP = 23 , SD_CARD_ECC_DISABLED = 24 ,
SD_ERASE_RESET = 25 , SD_AKE_SEQ_ERROR = 26 , SD_INVALID_VOLTRANGE = 27 , SD_ADDR_OUT_OF_RANGE = 28 ,
SD_SWITCH_ERROR = 29 , SD_SDIO_DISABLED = 30 , SD_SDIO_FUNC_BUSY = 31 , SD_SDIO_FUNC_ERROR = 32 ,
SD_SDIO_UNKNOWN_FUNC = 33 , SD_INTERNAL_ERROR , SD_NOT_CONFIGURED , SD_REQ_PENDING ,
SD_REQ_NOT_APPLICABLE , SD_INVALID_PARAMETER , SD_UNSUPPORTED_FEATURE , SD_UNSUPPORTED_HW ,
SD_ERROR , SD_OK = 0
}
enum sd_card_state_type {
SD_CARD_READY = ((uint32_t)0x00000001) , SD_CARD_IDENTIFICATION = ((uint32_t)0x00000002) , SD_CARD_STANDBY = ((uint32_t)0x00000003) , SD_CARD_TRANSFER = ((uint32_t)0x00000004) ,
SD_CARD_SENDING = ((uint32_t)0x00000005) , SD_CARD_RECEIVING = ((uint32_t)0x00000006) , SD_CARD_PROGRAMMING = ((uint32_t)0x00000007) , SD_CARD_DISCONNECTED = ((uint32_t)0x00000008) ,
SD_CARD_ERROR = ((uint32_t)0x000000FF)
}
enum sd_memory_card_type {
SDIO_STD_CAPACITY_SD_CARD_V1_1 = 0 , SDIO_STD_CAPACITY_SD_CARD_V2_0 = 1 , SDIO_HIGH_CAPACITY_SD_CARD = 2 , SDIO_MULTIMEDIA_CARD = 3 ,
SDIO_SECURE_DIGITAL_IO_CARD = 4 , SDIO_HIGH_SPEED_MULTIMEDIA_CARD = 5 , SDIO_SECURE_DIGITAL_IO_COMBO_CARD = 6 , SDIO_HIGH_CAPACITY_MMC_CARD = 7 ,
SDIO_SDIO_CARD = 8
}
enum | sd_data_transfer_mode_type { SD_TRANSFER_POLLING_MODE = 0 , SD_TRANSFER_DMA_MODE = 1 }
enum sd_error_status_type {
SD_CMD_FAIL = 1 , SD_DATA_FAIL = 2 , SD_CMD_RSP_TIMEOUT = 3 , SD_DATA_TIMEOUT = 4 ,
SD_TX_UNDERRUN = 5 , SD_RX_OVERRUN = 6 , SD_START_BIT_ERR = 7 , SD_CMD_OUT_OF_RANGE = 8 ,
SD_ADDR_MISALIGNED = 9 , SD_BLK_LEN_ERR = 10 , SD_ERASE_SEQ_ERR = 11 , SD_INVALID_ERASE_PARAM = 12 ,
SD_WR_PROTECT_VIOLATION = 13 , SD_LOCK_UNLOCK_ERROR = 14 , SD_CMD_CRC_ERROR = 15 , SD_ILLEGAL_CMD = 16 ,
SD_CARD_ECC_ERROR = 17 , SD_CARD_CONTROLLER_ERR = 18 , SD_GENERAL_UNKNOWN_ERROR = 19 , SD_STREAM_RD_UNDERRUN = 20 ,
SD_STREAM_WR_OVERRUN = 21 , SD_CID_CSD_OVERWRITE = 22 , SD_WP_ERASE_SKIP = 23 , SD_CARD_ECC_DISABLED = 24 ,
SD_ERASE_RESET = 25 , SD_AKE_SEQ_ERROR = 26 , SD_INVALID_VOLTRANGE = 27 , SD_ADDR_OUT_OF_RANGE = 28 ,
SD_SWITCH_ERROR = 29 , SD_SDIO_DISABLED = 30 , SD_SDIO_FUNC_BUSY = 31 , SD_SDIO_FUNC_ERROR = 32 ,
SD_SDIO_UNKNOWN_FUNC = 33 , SD_INTERNAL_ERROR , SD_NOT_CONFIGURED , SD_REQ_PENDING ,
SD_REQ_NOT_APPLICABLE , SD_INVALID_PARAMETER , SD_UNSUPPORTED_FEATURE , SD_UNSUPPORTED_HW ,
SD_ERROR , SD_OK = 0
}
enum sd_card_state_type {
SD_CARD_READY = ((uint32_t)0x00000001) , SD_CARD_IDENTIFICATION = ((uint32_t)0x00000002) , SD_CARD_STANDBY = ((uint32_t)0x00000003) , SD_CARD_TRANSFER = ((uint32_t)0x00000004) ,
SD_CARD_SENDING = ((uint32_t)0x00000005) , SD_CARD_RECEIVING = ((uint32_t)0x00000006) , SD_CARD_PROGRAMMING = ((uint32_t)0x00000007) , SD_CARD_DISCONNECTED = ((uint32_t)0x00000008) ,
SD_CARD_ERROR = ((uint32_t)0x000000FF)
}
enum sd_memory_card_type {
SDIO_STD_CAPACITY_SD_CARD_V1_1 = 0 , SDIO_STD_CAPACITY_SD_CARD_V2_0 = 1 , SDIO_HIGH_CAPACITY_SD_CARD = 2 , SDIO_MULTIMEDIA_CARD = 3 ,
SDIO_SECURE_DIGITAL_IO_CARD = 4 , SDIO_HIGH_SPEED_MULTIMEDIA_CARD = 5 , SDIO_SECURE_DIGITAL_IO_COMBO_CARD = 6 , SDIO_HIGH_CAPACITY_MMC_CARD = 7 ,
SDIO_SDIO_CARD = 8
}

Variables

sd_card_info_struct_type sd_card_info
sd_card_info_struct_type sd_card_info
sd_card_info_struct_type sd_card_info

Detailed Description

Enumeration Type Documentation

◆ sd_card_state_type [1/3]

enum sd_card_state_type

sd card status

Enumerator
SD_CARD_READY
SD_CARD_IDENTIFICATION
SD_CARD_STANDBY
SD_CARD_TRANSFER
SD_CARD_SENDING
SD_CARD_RECEIVING
SD_CARD_PROGRAMMING
SD_CARD_DISCONNECTED
SD_CARD_ERROR

Definition at line 185 of file emmc_card/inc/at32_sdio.h.

◆ sd_card_state_type [2/3]

enum sd_card_state_type

sd card status

Enumerator
SD_CARD_READY
SD_CARD_IDENTIFICATION
SD_CARD_STANDBY
SD_CARD_TRANSFER
SD_CARD_SENDING
SD_CARD_RECEIVING
SD_CARD_PROGRAMMING
SD_CARD_DISCONNECTED
SD_CARD_ERROR

Definition at line 185 of file sd_mmc_card/inc/at32_sdio.h.

◆ sd_card_state_type [3/3]

enum sd_card_state_type

sd card status

Enumerator
SD_CARD_READY
SD_CARD_IDENTIFICATION
SD_CARD_STANDBY
SD_CARD_TRANSFER
SD_CARD_SENDING
SD_CARD_RECEIVING
SD_CARD_PROGRAMMING
SD_CARD_DISCONNECTED
SD_CARD_ERROR

Definition at line 185 of file sdio_fatfs/inc/at32_sdio.h.

◆ sd_data_transfer_mode_type [1/3]

enum sd_data_transfer_mode_type

sdio data transfer mode

Enumerator
SD_TRANSFER_POLLING_MODE
SD_TRANSFER_DMA_MODE

Definition at line 63 of file emmc_card/inc/at32_sdio.h.

◆ sd_data_transfer_mode_type [2/3]

enum sd_data_transfer_mode_type

sdio data transfer mode

Enumerator
SD_TRANSFER_POLLING_MODE
SD_TRANSFER_DMA_MODE

Definition at line 63 of file sd_mmc_card/inc/at32_sdio.h.

◆ sd_data_transfer_mode_type [3/3]

enum sd_data_transfer_mode_type

sdio data transfer mode

Enumerator
SD_TRANSFER_POLLING_MODE
SD_TRANSFER_DMA_MODE

Definition at line 63 of file sdio_fatfs/inc/at32_sdio.h.

◆ sd_error_status_type [1/3]

enum sd_error_status_type

sdio error defines

Enumerator
SD_CMD_FAIL | command response received (but crc check error)
SD_DATA_FAIL | data bock sent/received (crc check error)
SD_CMD_RSP_TIMEOUT | command response timeout
SD_DATA_TIMEOUT | data time out
SD_TX_UNDERRUN | transmit fifo under-run
SD_RX_OVERRUN | receive fifo over-run
SD_START_BIT_ERR | start bit not detected on all data signals in wide bus mode
SD_CMD_OUT_OF_RANGE | cmd's argument was out of range.
SD_ADDR_MISALIGNED | misaligned address
SD_BLK_LEN_ERR | transferred block length is not allowed for the card or the number of transferred bytes does not match the block length
SD_ERASE_SEQ_ERR | an error in the sequence of erase command occurs.
SD_INVALID_ERASE_PARAM | an invalid selection for erase groups
SD_WR_PROTECT_VIOLATION | attempt to program a write protect block
SD_LOCK_UNLOCK_ERROR | sequence or password error has been detected in unlock command or if there was an attempt to access a locked card
SD_CMD_CRC_ERROR | crc check of the previous command error
SD_ILLEGAL_CMD | command is not legal for the card state
SD_CARD_ECC_ERROR | card internal ecc was applied but error to correct the data
SD_CARD_CONTROLLER_ERR | internal card controller error
SD_GENERAL_UNKNOWN_ERROR | general or unknown error
SD_STREAM_RD_UNDERRUN | the card could not sustain data transfer in stream read operation.
SD_STREAM_WR_OVERRUN | the card could not sustain data programming in stream mode
SD_CID_CSD_OVERWRITE | cid/csd overwrite error
SD_WP_ERASE_SKIP | only partial address space was erased
SD_CARD_ECC_DISABLED | command has been executed without using internal ecc
SD_ERASE_RESET | erase sequence was cleared before executing because an out of erase sequence command was received
SD_AKE_SEQ_ERROR | error in sequence of authentication.
SD_INVALID_VOLTRANGE | invalid voltage range
SD_ADDR_OUT_OF_RANGE | address out of range
SD_SWITCH_ERROR | switch error
SD_SDIO_DISABLED | sdio disabled
SD_SDIO_FUNC_BUSY | function busy
SD_SDIO_FUNC_ERROR | function error
SD_SDIO_UNKNOWN_FUNC | unknown function
SD_INTERNAL_ERROR | internal error
SD_NOT_CONFIGURED | sdio doesn't configuration
SD_REQ_PENDING | request pending
SD_REQ_NOT_APPLICABLE | request isn't applicable
SD_INVALID_PARAMETER | invalid parameter
SD_UNSUPPORTED_FEATURE | unsupported feature
SD_UNSUPPORTED_HW | unsupported hardware
SD_ERROR | error
SD_OK | pass

Definition at line 72 of file emmc_card/inc/at32_sdio.h.

◆ sd_error_status_type [2/3]

enum sd_error_status_type

sdio error defines

Enumerator
SD_CMD_FAIL | command response received (but crc check error)
SD_DATA_FAIL | data bock sent/received (crc check error)
SD_CMD_RSP_TIMEOUT | command response timeout
SD_DATA_TIMEOUT | data time out
SD_TX_UNDERRUN | transmit fifo under-run
SD_RX_OVERRUN | receive fifo over-run
SD_START_BIT_ERR | start bit not detected on all data signals in wide bus mode
SD_CMD_OUT_OF_RANGE | cmd's argument was out of range.
SD_ADDR_MISALIGNED | misaligned address
SD_BLK_LEN_ERR | transferred block length is not allowed for the card or the number of transferred bytes does not match the block length
SD_ERASE_SEQ_ERR | an error in the sequence of erase command occurs.
SD_INVALID_ERASE_PARAM | an invalid selection for erase groups
SD_WR_PROTECT_VIOLATION | attempt to program a write protect block
SD_LOCK_UNLOCK_ERROR | sequence or password error has been detected in unlock command or if there was an attempt to access a locked card
SD_CMD_CRC_ERROR | crc check of the previous command error
SD_ILLEGAL_CMD | command is not legal for the card state
SD_CARD_ECC_ERROR | card internal ecc was applied but error to correct the data
SD_CARD_CONTROLLER_ERR | internal card controller error
SD_GENERAL_UNKNOWN_ERROR | general or unknown error
SD_STREAM_RD_UNDERRUN | the card could not sustain data transfer in stream read operation.
SD_STREAM_WR_OVERRUN | the card could not sustain data programming in stream mode
SD_CID_CSD_OVERWRITE | cid/csd overwrite error
SD_WP_ERASE_SKIP | only partial address space was erased
SD_CARD_ECC_DISABLED | command has been executed without using internal ecc
SD_ERASE_RESET | erase sequence was cleared before executing because an out of erase sequence command was received
SD_AKE_SEQ_ERROR | error in sequence of authentication.
SD_INVALID_VOLTRANGE | invalid voltage range
SD_ADDR_OUT_OF_RANGE | address out of range
SD_SWITCH_ERROR | switch error
SD_SDIO_DISABLED | sdio disabled
SD_SDIO_FUNC_BUSY | function busy
SD_SDIO_FUNC_ERROR | function error
SD_SDIO_UNKNOWN_FUNC | unknown function
SD_INTERNAL_ERROR | internal error
SD_NOT_CONFIGURED | sdio doesn't configuration
SD_REQ_PENDING | request pending
SD_REQ_NOT_APPLICABLE | request isn't applicable
SD_INVALID_PARAMETER | invalid parameter
SD_UNSUPPORTED_FEATURE | unsupported feature
SD_UNSUPPORTED_HW | unsupported hardware
SD_ERROR | error
SD_OK | pass

Definition at line 72 of file sd_mmc_card/inc/at32_sdio.h.

◆ sd_error_status_type [3/3]

enum sd_error_status_type

sdio error defines

Enumerator
SD_CMD_FAIL | command response received (but crc check error)
SD_DATA_FAIL | data bock sent/received (crc check error)
SD_CMD_RSP_TIMEOUT | command response timeout
SD_DATA_TIMEOUT | data time out
SD_TX_UNDERRUN | transmit fifo under-run
SD_RX_OVERRUN | receive fifo over-run
SD_START_BIT_ERR | start bit not detected on all data signals in wide bus mode
SD_CMD_OUT_OF_RANGE | cmd's argument was out of range.
SD_ADDR_MISALIGNED | misaligned address
SD_BLK_LEN_ERR | transferred block length is not allowed for the card or the number of transferred bytes does not match the block length
SD_ERASE_SEQ_ERR | an error in the sequence of erase command occurs.
SD_INVALID_ERASE_PARAM | an invalid selection for erase groups
SD_WR_PROTECT_VIOLATION | attempt to program a write protect block
SD_LOCK_UNLOCK_ERROR | sequence or password error has been detected in unlock command or if there was an attempt to access a locked card
SD_CMD_CRC_ERROR | crc check of the previous command error
SD_ILLEGAL_CMD | command is not legal for the card state
SD_CARD_ECC_ERROR | card internal ecc was applied but error to correct the data
SD_CARD_CONTROLLER_ERR | internal card controller error
SD_GENERAL_UNKNOWN_ERROR | general or unknown error
SD_STREAM_RD_UNDERRUN | the card could not sustain data transfer in stream read operation.
SD_STREAM_WR_OVERRUN | the card could not sustain data programming in stream mode
SD_CID_CSD_OVERWRITE | cid/csd overwrite error
SD_WP_ERASE_SKIP | only partial address space was erased
SD_CARD_ECC_DISABLED | command has been executed without using internal ecc
SD_ERASE_RESET | erase sequence was cleared before executing because an out of erase sequence command was received
SD_AKE_SEQ_ERROR | error in sequence of authentication.
SD_INVALID_VOLTRANGE | invalid voltage range
SD_ADDR_OUT_OF_RANGE | address out of range
SD_SWITCH_ERROR | switch error
SD_SDIO_DISABLED | sdio disabled
SD_SDIO_FUNC_BUSY | function busy
SD_SDIO_FUNC_ERROR | function error
SD_SDIO_UNKNOWN_FUNC | unknown function
SD_INTERNAL_ERROR | internal error
SD_NOT_CONFIGURED | sdio doesn't configuration
SD_REQ_PENDING | request pending
SD_REQ_NOT_APPLICABLE | request isn't applicable
SD_INVALID_PARAMETER | invalid parameter
SD_UNSUPPORTED_FEATURE | unsupported feature
SD_UNSUPPORTED_HW | unsupported hardware
SD_ERROR | error
SD_OK | pass

Definition at line 72 of file sdio_fatfs/inc/at32_sdio.h.

◆ sd_memory_card_type [1/3]

enum sd_memory_card_type

supported sd memory cards

Enumerator
SDIO_STD_CAPACITY_SD_CARD_V1_1
SDIO_STD_CAPACITY_SD_CARD_V2_0
SDIO_HIGH_CAPACITY_SD_CARD
SDIO_MULTIMEDIA_CARD
SDIO_SECURE_DIGITAL_IO_CARD
SDIO_HIGH_SPEED_MULTIMEDIA_CARD
SDIO_SECURE_DIGITAL_IO_COMBO_CARD
SDIO_HIGH_CAPACITY_MMC_CARD
SDIO_SDIO_CARD

Definition at line 201 of file emmc_card/inc/at32_sdio.h.

◆ sd_memory_card_type [2/3]

enum sd_memory_card_type

supported sd memory cards

Enumerator
SDIO_STD_CAPACITY_SD_CARD_V1_1
SDIO_STD_CAPACITY_SD_CARD_V2_0
SDIO_HIGH_CAPACITY_SD_CARD
SDIO_MULTIMEDIA_CARD
SDIO_SECURE_DIGITAL_IO_CARD
SDIO_HIGH_SPEED_MULTIMEDIA_CARD
SDIO_SECURE_DIGITAL_IO_COMBO_CARD
SDIO_HIGH_CAPACITY_MMC_CARD
SDIO_SDIO_CARD

Definition at line 201 of file sd_mmc_card/inc/at32_sdio.h.

◆ sd_memory_card_type [3/3]

enum sd_memory_card_type

supported sd memory cards

Enumerator
SDIO_STD_CAPACITY_SD_CARD_V1_1
SDIO_STD_CAPACITY_SD_CARD_V2_0
SDIO_HIGH_CAPACITY_SD_CARD
SDIO_MULTIMEDIA_CARD
SDIO_SECURE_DIGITAL_IO_CARD
SDIO_HIGH_SPEED_MULTIMEDIA_CARD
SDIO_SECURE_DIGITAL_IO_COMBO_CARD
SDIO_HIGH_CAPACITY_MMC_CARD
SDIO_SDIO_CARD

Definition at line 201 of file sdio_fatfs/inc/at32_sdio.h.

◆ sdio_block_size_type

enum sdio_block_size_type

sdio data block size

Enumerator
SDIO_DATA_BLOCK_SIZE_1B | data block size 1 byte
SDIO_DATA_BLOCK_SIZE_2B | data block size 2 bytes
SDIO_DATA_BLOCK_SIZE_4B | data block size 4 bytes
SDIO_DATA_BLOCK_SIZE_8B | data block size 8 bytes
SDIO_DATA_BLOCK_SIZE_16B | data block size 16 bytes
SDIO_DATA_BLOCK_SIZE_32B | data block size 32 bytes
SDIO_DATA_BLOCK_SIZE_64B | data block size 64 bytes
SDIO_DATA_BLOCK_SIZE_128B | data block size 128 bytes
SDIO_DATA_BLOCK_SIZE_256B | data block size 256 bytes
SDIO_DATA_BLOCK_SIZE_512B | data block size 512 bytes
SDIO_DATA_BLOCK_SIZE_1024B | data block size 1024 bytes
SDIO_DATA_BLOCK_SIZE_2048B | data block size 2048 bytes
SDIO_DATA_BLOCK_SIZE_4096B | data block size 4096 bytes
SDIO_DATA_BLOCK_SIZE_8192B | data block size 8192 bytes
SDIO_DATA_BLOCK_SIZE_16384B | data block size 16384 bytes

Definition at line 178 of file at32f413_sdio.h.

◆ sdio_bus_width_type

enum sdio_bus_width_type

sdio bus width

Enumerator
SDIO_BUS_WIDTH_D1 | sdio wide bus select 1-bit
SDIO_BUS_WIDTH_D4 | sdio wide bus select 4-bit
SDIO_BUS_WIDTH_D8 | sdio wide bus select 8-bit

Definition at line 137 of file at32f413_sdio.h.

◆ sdio_edge_phase_type

enum sdio_edge_phase_type

sdio edge phase

Enumerator
SDIO_CLOCK_EDGE_RISING | sdio bus clock generated on the rising edge of the master clock
SDIO_CLOCK_EDGE_FALLING | sdio bus clock generated on the falling edge of the master clock

Definition at line 128 of file at32f413_sdio.h.

◆ sdio_power_state_type

enum sdio_power_state_type

sdio power state

Enumerator
SDIO_POWER_OFF | power-off, clock to card is stopped
SDIO_POWER_ON | power-on, the card is clocked

Definition at line 119 of file at32f413_sdio.h.

◆ sdio_read_wait_mode_type

enum sdio_read_wait_mode_type

sdio read wait mode

Enumerator
SDIO_READ_WAIT_CONTROLLED_BY_D2 | the sdio read wait on data2 line
SDIO_READ_WAIT_CONTROLLED_BY_CK | the sdio read wait on clock line

Definition at line 218 of file at32f413_sdio.h.

◆ sdio_reponse_type

enum sdio_reponse_type

sdio response type

Enumerator
SDIO_RESPONSE_NO | no response
SDIO_RESPONSE_SHORT | short response
SDIO_RESPONSE_LONG | long response

Definition at line 147 of file at32f413_sdio.h.

◆ sdio_rsp_index_type

enum sdio_rsp_index_type

sdio response register index

Enumerator
SDIO_RSP1_INDEX | response index 1, corresponding to sdio_rsp register 1
SDIO_RSP2_INDEX | response index 2, corresponding to sdio_rsp register 2
SDIO_RSP3_INDEX | response index 3, corresponding to sdio_rsp register 3
SDIO_RSP4_INDEX | response index 4, corresponding to sdio_rsp register 4

Definition at line 167 of file at32f413_sdio.h.

◆ sdio_transfer_direction_type

enum sdio_transfer_direction_type

sdio data transfer direction

Enumerator
SDIO_DATA_TRANSFER_TO_CARD | the sdio controller write
SDIO_DATA_TRANSFER_TO_CONTROLLER | the sdio controller read

Definition at line 209 of file at32f413_sdio.h.

◆ sdio_transfer_mode_type

enum sdio_transfer_mode_type

sdio data transfer mode

Enumerator
SDIO_DATA_BLOCK_TRANSFER | the sdio block transfer mode
SDIO_DATA_STREAM_TRANSFER | the sdio stream transfer mode

Definition at line 200 of file at32f413_sdio.h.

◆ sdio_wait_type

enum sdio_wait_type

sdio wait type

Enumerator
SDIO_WAIT_FOR_NO | no wait
SDIO_WAIT_FOR_INT | wait interrupt request
SDIO_WAIT_FOR_PEND | wait end of transfer

Definition at line 157 of file at32f413_sdio.h.

Variable Documentation

◆ sd_card_info [1/3]

sd_card_info_struct_type sd_card_info
extern

Definition at line 48 of file emmc_card/src/at32_sdio.c.

Referenced by disk_ioctl(), main(), and show_card_info().

◆ sd_card_info [2/3]

sd_card_info_struct_type sd_card_info
extern

Definition at line 48 of file emmc_card/src/at32_sdio.c.

◆ sd_card_info [3/3]

sd_card_info_struct_type sd_card_info
extern

Definition at line 48 of file emmc_card/src/at32_sdio.c.

Referenced by scr_find(), sd_bus_wide_enable(), sd_init(), and speed_change().


AT32F413 Firmwary Library: sdio_command_struct_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
sdio_command_struct_type Struct Reference
AT32F413_periph_driver » SDIO | AT32F413_periph_examples » SDIO_emmc_card | AT32F413_periph_examples » SDIO_sd_mmc_card | AT32F413_periph_examples » SDIO_sdio_fatfs » SDIO_exported_types

sdio command structure More...

#include <at32f413_sdio.h>

Data Fields

uint32_t | argument
uint8_t | cmd_index
sdio_reponse_type rsp_type
sdio_wait_type wait_type

Detailed Description

sdio command structure

Definition at line 227 of file at32f413_sdio.h.

Field Documentation

◆ argument

uint32_t sdio_command_struct_type::argument

the sdio command argument is sent to a card as part of command message

Definition at line 229 of file at32f413_sdio.h.

Referenced by check_card_programming(), get_ext_csd(), mmc_stream_read(), mmc_stream_write(), mmc_switch(), scr_find(), sd_block_read(), sd_block_write(), sd_blocks_erase(), sd_bus_wide_enable(), sd_card_init(), sd_deselect_select(), sd_irq_service(), sd_mult_blocks_read(), sd_mult_blocks_write(), sd_power_on(), sd_status_send(), sd_switch(), sdio_command_config(), and sdio_command_data_send().

◆ cmd_index

uint8_t sdio_command_struct_type::cmd_index

the sdio command index

Definition at line 230 of file at32f413_sdio.h.

Referenced by check_card_programming(), get_ext_csd(), mmc_stream_read(), mmc_stream_write(), mmc_switch(), scr_find(), sd_block_read(), sd_block_write(), sd_blocks_erase(), sd_bus_wide_enable(), sd_card_init(), sd_deselect_select(), sd_irq_service(), sd_mult_blocks_read(), sd_mult_blocks_write(), sd_power_on(), sd_status_send(), sd_switch(), sdio_command_config(), and sdio_command_data_send().

◆ rsp_type

sdio_reponse_type sdio_command_struct_type::rsp_type

the sdio response type

Definition at line 231 of file at32f413_sdio.h.

Referenced by check_card_programming(), get_ext_csd(), mmc_stream_read(), mmc_stream_write(), mmc_switch(), scr_find(), sd_block_read(), sd_block_write(), sd_blocks_erase(), sd_bus_wide_enable(), sd_card_init(), sd_deselect_select(), sd_irq_service(), sd_mult_blocks_read(), sd_mult_blocks_write(), sd_power_on(), sd_status_send(), sd_switch(), sdio_command_config(), and sdio_command_data_send().

◆ wait_type

sdio_wait_type sdio_command_struct_type::wait_type

the sdio wait for interrupt request is enabled or disable

Definition at line 232 of file at32f413_sdio.h.

Referenced by check_card_programming(), get_ext_csd(), mmc_stream_read(), mmc_stream_write(), mmc_switch(), scr_find(), sd_block_read(), sd_block_write(), sd_blocks_erase(), sd_bus_wide_enable(), sd_card_init(), sd_deselect_select(), sd_irq_service(), sd_mult_blocks_read(), sd_mult_blocks_write(), sd_power_on(), sd_status_send(), sd_switch(), sdio_command_config(), and sdio_command_data_send().

The documentation for this struct was generated from the following file:
  • at32f413_sdio.h


AT32F413 Firmwary Library: sdio_data_struct_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
sdio_data_struct_type Struct Reference
AT32F413_periph_driver » SDIO | AT32F413_periph_examples » SDIO_emmc_card | AT32F413_periph_examples » SDIO_sd_mmc_card | AT32F413_periph_examples » SDIO_sdio_fatfs » SDIO_exported_types

sdio data structure More...

#include <at32f413_sdio.h>

Data Fields

uint32_t | timeout
uint32_t | data_length
sdio_block_size_type block_size
sdio_transfer_mode_type transfer_mode
sdio_transfer_direction_type transfer_direction

Detailed Description

sdio data structure

Definition at line 238 of file at32f413_sdio.h.

Field Documentation

◆ block_size

sdio_block_size_type sdio_data_struct_type::block_size

the sdio data block size of block transfer mode

Definition at line 242 of file at32f413_sdio.h.

Referenced by get_ext_csd(), mmc_stream_read(), mmc_stream_write(), scr_find(), sd_block_read(), sd_block_write(), sd_blocks_erase(), sd_mult_blocks_read(), sd_mult_blocks_write(), sd_switch(), and sdio_data_config().

◆ data_length

uint32_t sdio_data_struct_type::data_length

the sdio data length

Definition at line 241 of file at32f413_sdio.h.

Referenced by get_ext_csd(), mmc_stream_read(), mmc_stream_write(), scr_find(), sd_block_read(), sd_block_write(), sd_blocks_erase(), sd_mult_blocks_read(), sd_mult_blocks_write(), sd_switch(), sdio_command_data_send(), and sdio_data_config().

◆ timeout

uint32_t sdio_data_struct_type::timeout

the sdio data timeout period in car bus clock periods

Definition at line 240 of file at32f413_sdio.h.

Referenced by get_ext_csd(), mmc_stream_read(), mmc_stream_write(), scr_find(), sd_block_read(), sd_block_write(), sd_blocks_erase(), sd_mult_blocks_read(), sd_mult_blocks_write(), sd_switch(), and sdio_data_config().

◆ transfer_direction

sdio_transfer_direction_type sdio_data_struct_type::transfer_direction

the sdio data transfer direction

Definition at line 244 of file at32f413_sdio.h.

Referenced by get_ext_csd(), mmc_stream_read(), mmc_stream_write(), scr_find(), sd_block_read(), sd_block_write(), sd_blocks_erase(), sd_mult_blocks_read(), sd_mult_blocks_write(), sd_switch(), sdio_command_data_send(), and sdio_data_config().

◆ transfer_mode

sdio_transfer_mode_type sdio_data_struct_type::transfer_mode

the sdio transfer mode, block or stream

Definition at line 243 of file at32f413_sdio.h.

Referenced by get_ext_csd(), mmc_stream_read(), mmc_stream_write(), scr_find(), sd_block_read(), sd_block_write(), sd_blocks_erase(), sd_mult_blocks_read(), sd_mult_blocks_write(), sd_switch(), and sdio_data_config().

The documentation for this struct was generated from the following file:
  • at32f413_sdio.h


AT32F413 Firmwary Library: sdio_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
sdio_type Struct Reference
AT32F413_periph_driver » SDIO | AT32F413_periph_examples » SDIO_emmc_card | AT32F413_periph_examples » SDIO_sd_mmc_card | AT32F413_periph_examples » SDIO_sdio_fatfs » SDIO_exported_types

type define sdio register all More...

#include <at32f413_sdio.h>

Data Fields

union {
__IO uint32_t pwrctrl
struct {
__IO uint32_t ps: 2
__IO uint32_t reserved1: 30
} pwrctrl_bit
};
sdio pwrctrl register, offset:0x00
union {
__IO uint32_t clkctrl
struct {
__IO uint32_t clkdiv_l: 8
__IO uint32_t clkoen: 1
__IO uint32_t pwrsven: 1
__IO uint32_t bypsen: 1
__IO uint32_t busws: 2
__IO uint32_t clkegs: 1
__IO uint32_t hfcen: 1
__IO uint32_t clkdiv_h: 2
__IO uint32_t reserved1: 15
} clkctrl_bit
};
sdio clkctrl register, offset:0x04
union {
__IO uint32_t argu
struct {
__IO uint32_t argu: 32
} argu_bit
};
sdio argu register, offset:0x08
union {
__IO uint32_t cmdctrl
struct {
__IO uint32_t cmdidx: 6
__IO uint32_t rspwt: 2
__IO uint32_t intwt: 1
__IO uint32_t pndwt: 1
__IO uint32_t ccsmen: 1
__IO uint32_t iosusp: 1
__IO uint32_t reserved1: 20
} cmdctrl_bit
};
sdio cmdctrl register, offset:0x0C
union {
__IO uint32_t rspcmd
struct {
__IO uint32_t rspcmd: 6
__IO uint32_t reserved1: 26
} rspcmd_bit
};
sdio rspcmd register, offset:0x10
union {
__IO uint32_t rsp1
struct {
__IO uint32_t cardsts1: 32
} rsp1_bit
};
sdio rsp1 register, offset:0x14
union {
__IO uint32_t rsp2
struct {
__IO uint32_t cardsts2: 32
} rsp2_bit
};
sdio rsp2 register, offset:0x18
union {
__IO uint32_t rsp3
struct {
__IO uint32_t cardsts3: 32
} rsp3_bit
};
sdio rsp3 register, offset:0x1C
union {
__IO uint32_t rsp4
struct {
__IO uint32_t cardsts4: 32
} rsp4_bit
};
sdio rsp4 register, offset:0x20
union {
__IO uint32_t dttmr
struct {
__IO uint32_t timeout: 32
} dttmr_bit
};
sdio dttmr register, offset:0x24
union {
__IO uint32_t dtlen
struct {
__IO uint32_t dtlen: 25
__IO uint32_t reserved1: 7
} dtlen_bit
};
sdio dtlen register, offset:0x28
union {
__IO uint32_t dtctrl
struct {
__IO uint32_t tfren: 1
__IO uint32_t tfrdir: 1
__IO uint32_t tfrmode: 1
__IO uint32_t dmaen: 1
__IO uint32_t blksize: 4
__IO uint32_t rdwtstart: 1
__IO uint32_t rdwtstop: 1
__IO uint32_t rdwtmode: 1
__IO uint32_t ioen: 1
__IO uint32_t reserved1: 20
} dtctrl_bit
};
sdio dtctrl register, offset:0x2C
union {
__IO uint32_t dtcnt
struct {
__IO uint32_t cnt: 25
__IO uint32_t reserved1: 7
} dtcnt_bit
};
sdio dtcnt register, offset:0x30
union {
__IO uint32_t sts
struct {
__IO uint32_t cmdfail: 1
__IO uint32_t dtfail: 1
__IO uint32_t cmdtimeout: 1
__IO uint32_t dttimeout: 1
__IO uint32_t txerru: 1
__IO uint32_t rxerro: 1
__IO uint32_t cmdrspcmpl: 1
__IO uint32_t cmdcmpl: 1
__IO uint32_t dtcmpl: 1
__IO uint32_t sbiterr: 1
__IO uint32_t dtblkcmpl: 1
__IO uint32_t docmd: 1
__IO uint32_t dotx: 1
__IO uint32_t dorx: 1
__IO uint32_t txbufh: 1
__IO uint32_t rxbufh: 1
__IO uint32_t txbuff: 1
__IO uint32_t rxbuff: 1
__IO uint32_t txbufe: 1
__IO uint32_t rxbufe: 1
__IO uint32_t txbuf: 1
__IO uint32_t rxbuf: 1
__IO uint32_t ioif: 1
__IO uint32_t reserved1: 9
} sts_bit
};
sdio sts register, offset:0x34
union {
__IO uint32_t intclr
struct {
__IO uint32_t cmdfail: 1
__IO uint32_t dtfail: 1
__IO uint32_t cmdtimeout: 1
__IO uint32_t dttimeout: 1
__IO uint32_t txerru: 1
__IO uint32_t rxerro: 1
__IO uint32_t cmdrspcmpl: 1
__IO uint32_t cmdcmpl: 1
__IO uint32_t dtcmpl: 1
__IO uint32_t sbiterr: 1
__IO uint32_t dtblkcmpl: 1
__IO uint32_t reserved1: 11
__IO uint32_t ioif: 1
__IO uint32_t reserved2: 9
} intclr_bit
};
sdio intclr register, offset:0x38
union {
__IO uint32_t inten
struct {
__IO uint32_t cmdfailien: 1
__IO uint32_t dtfailien: 1
__IO uint32_t cmdtimeoutien: 1
__IO uint32_t dttimeoutien: 1
__IO uint32_t txerruien: 1
__IO uint32_t rxerroien: 1
__IO uint32_t cmdrspcmplien: 1
__IO uint32_t cmdcmplien: 1
__IO uint32_t dtcmplien: 1
__IO uint32_t sbiterrien: 1
__IO uint32_t dtblkcmplien: 1
__IO uint32_t docmdien: 1
__IO uint32_t dotxien: 1
__IO uint32_t dorxien: 1
__IO uint32_t txbufhien: 1
__IO uint32_t rxbufhien: 1
__IO uint32_t txbuffien: 1
__IO uint32_t rxbuffien: 1
__IO uint32_t txbufeien: 1
__IO uint32_t rxbufeien: 1
__IO uint32_t txbufien: 1
__IO uint32_t rxbufien: 1
__IO uint32_t ioifien: 1
__IO uint32_t reserved1: 9
} inten_bit
};
sdio inten register, offset:0x3C
union {
__IO uint32_t bufcnt
struct {
__IO uint32_t cnt: 24
__IO uint32_t reserved1: 8
} bufcnt_bit
};
sdio bufcnt register, offset:0x48
union {
__IO uint32_t buf
struct {
__IO uint32_t dt: 32
} buf_bit
};
sdio buf register, offset:0x80

Detailed Description

type define sdio register all

Definition at line 250 of file at32f413_sdio.h.

Field Documentation

◆ [union]

union { ... } sdio_type

sdio pwrctrl register, offset:0x00

◆ [union]

union { ... } sdio_type

sdio clkctrl register, offset:0x04

◆ [union]

union { ... } sdio_type

sdio argu register, offset:0x08

◆ [union]

union { ... } sdio_type

sdio cmdctrl register, offset:0x0C

◆ [union]

union { ... } sdio_type

sdio rspcmd register, offset:0x10

◆ [union]

union { ... } sdio_type

sdio rsp1 register, offset:0x14

◆ [union]

union { ... } sdio_type

sdio rsp2 register, offset:0x18

◆ [union]

union { ... } sdio_type

sdio rsp3 register, offset:0x1C

◆ [union]

union { ... } sdio_type

sdio rsp4 register, offset:0x20

◆ [union]

union { ... } sdio_type

sdio dttmr register, offset:0x24

◆ [union]

union { ... } sdio_type

sdio dtlen register, offset:0x28

◆ [union]

union { ... } sdio_type

sdio dtctrl register, offset:0x2C

◆ [union]

union { ... } sdio_type

sdio dtcnt register, offset:0x30

◆ [union]

union { ... } sdio_type

sdio sts register, offset:0x34

◆ [union]

union { ... } sdio_type

sdio intclr register, offset:0x38

◆ [union]

union { ... } sdio_type

sdio inten register, offset:0x3C

◆ [union]

union { ... } sdio_type

sdio bufcnt register, offset:0x48

◆ [union]

union { ... } sdio_type

sdio buf register, offset:0x80

◆ argu

__IO uint32_t sdio_type::argu

Definition at line 290 of file at32f413_sdio.h.

Referenced by sdio_command_config(), and sdio_reset().

◆ [struct]

struct { ... } sdio_type::argu_bit

◆ blksize

__IO uint32_t sdio_type::blksize

Definition at line 413 of file at32f413_sdio.h.

Referenced by sdio_data_config().

◆ buf

__IO uint32_t sdio_type::buf

Definition at line 558 of file at32f413_sdio.h.

Referenced by sdio_data_read(), and sdio_data_write().

◆ [struct]

struct { ... } sdio_type::buf_bit

◆ bufcnt

__IO uint32_t sdio_type::bufcnt

Definition at line 540 of file at32f413_sdio.h.

Referenced by sdio_buffer_counter_get().

◆ [struct]

struct { ... } sdio_type::bufcnt_bit

◆ busws

__IO uint32_t sdio_type::busws

Definition at line 277 of file at32f413_sdio.h.

Referenced by sdio_bus_width_config().

◆ bypsen

__IO uint32_t sdio_type::bypsen

Definition at line 276 of file at32f413_sdio.h.

Referenced by sdio_clock_bypass().

◆ cardsts1

__IO uint32_t sdio_type::cardsts1

Definition at line 336 of file at32f413_sdio.h.

◆ cardsts2

__IO uint32_t sdio_type::cardsts2

Definition at line 348 of file at32f413_sdio.h.

◆ cardsts3

__IO uint32_t sdio_type::cardsts3

Definition at line 360 of file at32f413_sdio.h.

◆ cardsts4

__IO uint32_t sdio_type::cardsts4

Definition at line 372 of file at32f413_sdio.h.

◆ ccsmen

__IO uint32_t sdio_type::ccsmen

Definition at line 309 of file at32f413_sdio.h.

Referenced by sdio_command_config(), and sdio_command_state_machine_enable().

◆ clkctrl

__IO uint32_t sdio_type::clkctrl

Definition at line 270 of file at32f413_sdio.h.

Referenced by sdio_reset().

◆ [struct]

struct { ... } sdio_type::clkctrl_bit

Referenced by sdio_bus_width_config(), sdio_clock_bypass(), sdio_clock_config(), sdio_clock_enable(), sdio_flow_control_enable(), and sdio_power_saving_mode_enable().

◆ clkdiv_h

__IO uint32_t sdio_type::clkdiv_h

Definition at line 280 of file at32f413_sdio.h.

Referenced by sdio_clock_config().

◆ clkdiv_l

__IO uint32_t sdio_type::clkdiv_l

Definition at line 273 of file at32f413_sdio.h.

Referenced by sdio_clock_config().

◆ clkegs

__IO uint32_t sdio_type::clkegs

Definition at line 278 of file at32f413_sdio.h.

Referenced by sdio_clock_config().

◆ clkoen

__IO uint32_t sdio_type::clkoen

Definition at line 274 of file at32f413_sdio.h.

Referenced by sdio_clock_enable().

◆ cmdcmpl

__IO uint32_t sdio_type::cmdcmpl

Definition at line 450 of file at32f413_sdio.h.

◆ cmdcmplien

__IO uint32_t sdio_type::cmdcmplien

Definition at line 510 of file at32f413_sdio.h.

◆ cmdctrl

__IO uint32_t sdio_type::cmdctrl

Definition at line 302 of file at32f413_sdio.h.

Referenced by sdio_reset().

◆ [struct]

struct { ... } sdio_type::cmdctrl_bit

Referenced by sdio_command_config(), sdio_command_state_machine_enable(), and sdio_io_suspend_command_set().

◆ cmdfail

__IO uint32_t sdio_type::cmdfail

Definition at line 443 of file at32f413_sdio.h.

◆ cmdfailien

__IO uint32_t sdio_type::cmdfailien

Definition at line 503 of file at32f413_sdio.h.

◆ cmdidx

__IO uint32_t sdio_type::cmdidx

Definition at line 305 of file at32f413_sdio.h.

Referenced by sdio_command_config().

◆ cmdrspcmpl

__IO uint32_t sdio_type::cmdrspcmpl

Definition at line 449 of file at32f413_sdio.h.

◆ cmdrspcmplien

__IO uint32_t sdio_type::cmdrspcmplien

Definition at line 509 of file at32f413_sdio.h.

◆ cmdtimeout

__IO uint32_t sdio_type::cmdtimeout

Definition at line 445 of file at32f413_sdio.h.

◆ cmdtimeoutien

__IO uint32_t sdio_type::cmdtimeoutien

Definition at line 505 of file at32f413_sdio.h.

◆ cnt

__IO uint32_t sdio_type::cnt

Definition at line 430 of file at32f413_sdio.h.

◆ dmaen

__IO uint32_t sdio_type::dmaen

Definition at line 412 of file at32f413_sdio.h.

Referenced by sdio_dma_enable().

◆ docmd

__IO uint32_t sdio_type::docmd

Definition at line 454 of file at32f413_sdio.h.

◆ docmdien

__IO uint32_t sdio_type::docmdien

Definition at line 514 of file at32f413_sdio.h.

◆ dorx

__IO uint32_t sdio_type::dorx

Definition at line 456 of file at32f413_sdio.h.

◆ dorxien

__IO uint32_t sdio_type::dorxien

Definition at line 516 of file at32f413_sdio.h.

◆ dotx

__IO uint32_t sdio_type::dotx

Definition at line 455 of file at32f413_sdio.h.

◆ dotxien

__IO uint32_t sdio_type::dotxien

Definition at line 515 of file at32f413_sdio.h.

◆ dt

__IO uint32_t sdio_type::dt

Definition at line 561 of file at32f413_sdio.h.

◆ dtblkcmpl

__IO uint32_t sdio_type::dtblkcmpl

Definition at line 453 of file at32f413_sdio.h.

◆ dtblkcmplien

__IO uint32_t sdio_type::dtblkcmplien

Definition at line 513 of file at32f413_sdio.h.

◆ dtcmpl

__IO uint32_t sdio_type::dtcmpl

Definition at line 451 of file at32f413_sdio.h.

◆ dtcmplien

__IO uint32_t sdio_type::dtcmplien

Definition at line 511 of file at32f413_sdio.h.

◆ dtcnt

__IO uint32_t sdio_type::dtcnt

Definition at line 427 of file at32f413_sdio.h.

Referenced by sdio_data_counter_get().

◆ [struct]

struct { ... } sdio_type::dtcnt_bit

◆ dtctrl

__IO uint32_t sdio_type::dtctrl

Definition at line 406 of file at32f413_sdio.h.

Referenced by sdio_reset().

◆ [struct]

struct { ... } sdio_type::dtctrl_bit

Referenced by sdio_data_config(), sdio_data_state_machine_enable(), sdio_dma_enable(), sdio_io_function_enable(), sdio_read_wait_mode_set(), sdio_read_wait_start(), and sdio_read_wait_stop().

◆ dtfail

__IO uint32_t sdio_type::dtfail

Definition at line 444 of file at32f413_sdio.h.

◆ dtfailien

__IO uint32_t sdio_type::dtfailien

Definition at line 504 of file at32f413_sdio.h.

◆ dtlen

__IO uint32_t sdio_type::dtlen

Definition at line 393 of file at32f413_sdio.h.

Referenced by sdio_data_config(), and sdio_reset().

◆ [struct]

struct { ... } sdio_type::dtlen_bit

Referenced by sdio_data_config().

◆ dttimeout

__IO uint32_t sdio_type::dttimeout

Definition at line 446 of file at32f413_sdio.h.

◆ dttimeoutien

__IO uint32_t sdio_type::dttimeoutien

Definition at line 506 of file at32f413_sdio.h.

◆ dttmr

__IO uint32_t sdio_type::dttmr

Definition at line 381 of file at32f413_sdio.h.

Referenced by sdio_reset().

◆ [struct]

struct { ... } sdio_type::dttmr_bit

Referenced by sdio_data_config().

◆ hfcen

__IO uint32_t sdio_type::hfcen

Definition at line 279 of file at32f413_sdio.h.

Referenced by sdio_flow_control_enable().

◆ intclr

__IO uint32_t sdio_type::intclr

Definition at line 475 of file at32f413_sdio.h.

Referenced by sdio_flag_clear(), and sdio_reset().

◆ [struct]

struct { ... } sdio_type::intclr_bit

◆ inten

__IO uint32_t sdio_type::inten

Definition at line 500 of file at32f413_sdio.h.

Referenced by sdio_interrupt_enable(), sdio_interrupt_flag_get(), and sdio_reset().

◆ [struct]

struct { ... } sdio_type::inten_bit

◆ intwt

__IO uint32_t sdio_type::intwt

Definition at line 307 of file at32f413_sdio.h.

Referenced by sdio_command_config().

◆ ioen

__IO uint32_t sdio_type::ioen

Definition at line 417 of file at32f413_sdio.h.

Referenced by sdio_io_function_enable().

◆ ioif

__IO uint32_t sdio_type::ioif

Definition at line 465 of file at32f413_sdio.h.

◆ ioifien

__IO uint32_t sdio_type::ioifien

Definition at line 525 of file at32f413_sdio.h.

◆ iosusp

__IO uint32_t sdio_type::iosusp

Definition at line 310 of file at32f413_sdio.h.

Referenced by sdio_io_suspend_command_set().

◆ pndwt

__IO uint32_t sdio_type::pndwt

Definition at line 308 of file at32f413_sdio.h.

Referenced by sdio_command_config().

◆ ps

__IO uint32_t sdio_type::ps

Definition at line 260 of file at32f413_sdio.h.

Referenced by sdio_power_set(), and sdio_power_status_get().

◆ pwrctrl

__IO uint32_t sdio_type::pwrctrl

Definition at line 257 of file at32f413_sdio.h.

Referenced by sdio_reset().

◆ [struct]

struct { ... } sdio_type::pwrctrl_bit

Referenced by sdio_power_set(), and sdio_power_status_get().

◆ pwrsven

__IO uint32_t sdio_type::pwrsven

Definition at line 275 of file at32f413_sdio.h.

Referenced by sdio_power_saving_mode_enable().

◆ rdwtmode

__IO uint32_t sdio_type::rdwtmode

Definition at line 416 of file at32f413_sdio.h.

Referenced by sdio_read_wait_mode_set().

◆ rdwtstart

__IO uint32_t sdio_type::rdwtstart

Definition at line 414 of file at32f413_sdio.h.

Referenced by sdio_read_wait_start().

◆ rdwtstop

__IO uint32_t sdio_type::rdwtstop

Definition at line 415 of file at32f413_sdio.h.

Referenced by sdio_read_wait_stop().

◆ reserved1

__IO uint32_t sdio_type::reserved1

sdio reserved1 register, offset:0x40~0x44

Definition at line 261 of file at32f413_sdio.h.

◆ reserved2

__IO uint32_t sdio_type::reserved2

sdio reserved2 register, offset:0x4C~0x7C

Definition at line 491 of file at32f413_sdio.h.

◆ rsp1

__IO uint32_t sdio_type::rsp1

Definition at line 333 of file at32f413_sdio.h.

Referenced by sdio_response_get().

◆ [struct]

struct { ... } sdio_type::rsp1_bit

◆ rsp2

__IO uint32_t sdio_type::rsp2

Definition at line 345 of file at32f413_sdio.h.

Referenced by sdio_response_get().

◆ [struct]

struct { ... } sdio_type::rsp2_bit

◆ rsp3

__IO uint32_t sdio_type::rsp3

Definition at line 357 of file at32f413_sdio.h.

Referenced by sdio_response_get().

◆ [struct]

struct { ... } sdio_type::rsp3_bit

◆ rsp4

__IO uint32_t sdio_type::rsp4

Definition at line 369 of file at32f413_sdio.h.

Referenced by sdio_response_get().

◆ [struct]

struct { ... } sdio_type::rsp4_bit

◆ rspcmd

__IO uint32_t sdio_type::rspcmd

Definition at line 320 of file at32f413_sdio.h.

Referenced by sdio_command_response_get().

◆ [struct]

struct { ... } sdio_type::rspcmd_bit

Referenced by sdio_command_response_get().

◆ rspwt

__IO uint32_t sdio_type::rspwt

Definition at line 306 of file at32f413_sdio.h.

Referenced by sdio_command_config().

◆ rxbuf

__IO uint32_t sdio_type::rxbuf

Definition at line 464 of file at32f413_sdio.h.

◆ rxbufe

__IO uint32_t sdio_type::rxbufe

Definition at line 462 of file at32f413_sdio.h.

◆ rxbufeien

__IO uint32_t sdio_type::rxbufeien

Definition at line 522 of file at32f413_sdio.h.

◆ rxbuff

__IO uint32_t sdio_type::rxbuff

Definition at line 460 of file at32f413_sdio.h.

◆ rxbuffien

__IO uint32_t sdio_type::rxbuffien

Definition at line 520 of file at32f413_sdio.h.

◆ rxbufh

__IO uint32_t sdio_type::rxbufh

Definition at line 458 of file at32f413_sdio.h.

◆ rxbufhien

__IO uint32_t sdio_type::rxbufhien

Definition at line 518 of file at32f413_sdio.h.

◆ rxbufien

__IO uint32_t sdio_type::rxbufien

Definition at line 524 of file at32f413_sdio.h.

◆ rxerro

__IO uint32_t sdio_type::rxerro

Definition at line 448 of file at32f413_sdio.h.

◆ rxerroien

__IO uint32_t sdio_type::rxerroien

Definition at line 508 of file at32f413_sdio.h.

◆ sbiterr

__IO uint32_t sdio_type::sbiterr

Definition at line 452 of file at32f413_sdio.h.

◆ sbiterrien

__IO uint32_t sdio_type::sbiterrien

Definition at line 512 of file at32f413_sdio.h.

◆ sts

__IO uint32_t sdio_type::sts

Definition at line 440 of file at32f413_sdio.h.

Referenced by sdio_flag_get(), and sdio_interrupt_flag_get().

◆ [struct]

struct { ... } sdio_type::sts_bit

◆ tfrdir

__IO uint32_t sdio_type::tfrdir

Definition at line 410 of file at32f413_sdio.h.

Referenced by sdio_data_config().

◆ tfren

__IO uint32_t sdio_type::tfren

Definition at line 409 of file at32f413_sdio.h.

Referenced by sdio_data_config(), and sdio_data_state_machine_enable().

◆ tfrmode

__IO uint32_t sdio_type::tfrmode

Definition at line 411 of file at32f413_sdio.h.

Referenced by sdio_data_config().

◆ timeout

__IO uint32_t sdio_type::timeout

Definition at line 384 of file at32f413_sdio.h.

Referenced by sdio_data_config().

◆ txbuf

__IO uint32_t sdio_type::txbuf

Definition at line 463 of file at32f413_sdio.h.

◆ txbufe

__IO uint32_t sdio_type::txbufe

Definition at line 461 of file at32f413_sdio.h.

◆ txbufeien

__IO uint32_t sdio_type::txbufeien

Definition at line 521 of file at32f413_sdio.h.

◆ txbuff

__IO uint32_t sdio_type::txbuff

Definition at line 459 of file at32f413_sdio.h.

◆ txbuffien

__IO uint32_t sdio_type::txbuffien

Definition at line 519 of file at32f413_sdio.h.

◆ txbufh

__IO uint32_t sdio_type::txbufh

Definition at line 457 of file at32f413_sdio.h.

◆ txbufhien

__IO uint32_t sdio_type::txbufhien

Definition at line 517 of file at32f413_sdio.h.

◆ txbufien

__IO uint32_t sdio_type::txbufien

Definition at line 523 of file at32f413_sdio.h.

◆ txerru

__IO uint32_t sdio_type::txerru

Definition at line 447 of file at32f413_sdio.h.

◆ txerruien

__IO uint32_t sdio_type::txerruien

Definition at line 507 of file at32f413_sdio.h.

The documentation for this struct was generated from the following file:
  • at32f413_sdio.h


AT32F413 Firmwary Library: sd_csd_struct_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
sd_csd_struct_type Struct Reference
AT32F413_periph_driver » SDIO | AT32F413_periph_examples » SDIO_emmc_card | AT32F413_periph_examples » SDIO_sd_mmc_card | AT32F413_periph_examples » SDIO_sdio_fatfs » SDIO_exported_types

#include <at32_sdio.h>

Data Fields

uint8_t | csd_struct
uint8_t | spec_version
uint8_t | reserved1
uint8_t | taac
uint8_t | nsac
uint8_t | max_bus_clk_freq
uint16_t | card_cmd_classes
uint8_t | max_read_blk_length
uint8_t | part_blk_read
uint8_t | write_blk_misalign
uint8_t | read_blk_misalign
uint8_t | dsr_implemented
uint8_t | reserved2
uint32_t | device_size
uint8_t | max_read_current_vdd_min
uint8_t | max_read_current_vdd_max
uint8_t | max_write_current_vdd_min
uint8_t | max_write_current_vdd_max
uint8_t | device_size_mult
uint8_t | erase_group_size
uint8_t | erase_group_size_mult
uint8_t | write_protect_group_size
uint8_t | write_protect_group_enable
uint8_t | manufacturer_default_ecc
uint8_t | write_speed_factor
uint8_t | max_write_blk_length
uint8_t | part_blk_write
uint8_t | reserved3
uint8_t | content_protect_app
uint8_t | file_format_group
uint8_t | copy_flag
uint8_t | permanent_write_protect
uint8_t | temp_write_protect
uint8_t | file_formart
uint8_t | ecc_code
uint8_t | csd_crc
uint8_t | reserved4

Detailed Description

card specific data: csd register

Definition at line 124 of file emmc_card/inc/at32_sdio.h.

Field Documentation

◆ card_cmd_classes

uint16_t sd_csd_struct_type::card_cmd_classes

card command classes

Definition at line 132 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get().

◆ content_protect_app

uint8_t sd_csd_struct_type::content_protect_app

content protection application

Definition at line 154 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get().

◆ copy_flag

uint8_t sd_csd_struct_type::copy_flag

copy flag (otp)

Definition at line 156 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get().

◆ csd_crc

uint8_t sd_csd_struct_type::csd_crc

csd crc

Definition at line 161 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get().

◆ csd_struct

uint8_t sd_csd_struct_type::csd_struct

csd structure

Definition at line 126 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get().

◆ device_size

uint32_t sd_csd_struct_type::device_size

device size

Definition at line 139 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get(), sd_init(), and show_card_info().

◆ device_size_mult

uint8_t sd_csd_struct_type::device_size_mult

device size multiplier

Definition at line 144 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get().

◆ dsr_implemented

uint8_t sd_csd_struct_type::dsr_implemented

dsr implemented

Definition at line 137 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get().

◆ ecc_code

uint8_t sd_csd_struct_type::ecc_code

ecc code

Definition at line 160 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get().

◆ erase_group_size

uint8_t sd_csd_struct_type::erase_group_size

erase group size

Definition at line 145 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get().

◆ erase_group_size_mult

uint8_t sd_csd_struct_type::erase_group_size_mult

erase group size multiplier

Definition at line 146 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get().

◆ file_formart

uint8_t sd_csd_struct_type::file_formart

file format

Definition at line 159 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get().

◆ file_format_group

uint8_t sd_csd_struct_type::file_format_group

file format group

Definition at line 155 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get().

◆ manufacturer_default_ecc

uint8_t sd_csd_struct_type::manufacturer_default_ecc

manufacturer default ecc

Definition at line 149 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get().

◆ max_bus_clk_freq

uint8_t sd_csd_struct_type::max_bus_clk_freq

max. bus clock frequency

Definition at line 131 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get().

◆ max_read_blk_length

uint8_t sd_csd_struct_type::max_read_blk_length

max. read data block length

Definition at line 133 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get().

◆ max_read_current_vdd_max

uint8_t sd_csd_struct_type::max_read_current_vdd_max

max. read current @ vdd max

Definition at line 141 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get().

◆ max_read_current_vdd_min

uint8_t sd_csd_struct_type::max_read_current_vdd_min

max. read current @ vdd min

Definition at line 140 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get().

◆ max_write_blk_length

uint8_t sd_csd_struct_type::max_write_blk_length

max. write data block length

Definition at line 151 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get().

◆ max_write_current_vdd_max

uint8_t sd_csd_struct_type::max_write_current_vdd_max

max. write current @ vdd max

Definition at line 143 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get().

◆ max_write_current_vdd_min

uint8_t sd_csd_struct_type::max_write_current_vdd_min

max. write current @ vdd min

Definition at line 142 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get().

◆ nsac

uint8_t sd_csd_struct_type::nsac

data read access-time 2 in clk cycles

Definition at line 130 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get().

◆ part_blk_read

uint8_t sd_csd_struct_type::part_blk_read

partial blocks for read allowed

Definition at line 134 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get().

◆ part_blk_write

uint8_t sd_csd_struct_type::part_blk_write

partial blocks for write allowed

Definition at line 152 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get().

◆ permanent_write_protect

uint8_t sd_csd_struct_type::permanent_write_protect

permanent write protection

Definition at line 157 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get().

◆ read_blk_misalign

uint8_t sd_csd_struct_type::read_blk_misalign

read block misalignment

Definition at line 136 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get().

◆ reserved1

uint8_t sd_csd_struct_type::reserved1

reserved

Definition at line 128 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get().

◆ reserved2

uint8_t sd_csd_struct_type::reserved2

reserved

Definition at line 138 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get().

◆ reserved3

uint8_t sd_csd_struct_type::reserved3

reserded

Definition at line 153 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get().

◆ reserved4

uint8_t sd_csd_struct_type::reserved4

always

Definition at line 162 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get().

◆ spec_version

uint8_t sd_csd_struct_type::spec_version

system specification version

Definition at line 127 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get(), and sd_init().

◆ taac

uint8_t sd_csd_struct_type::taac

data read access-time 1

Definition at line 129 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get().

◆ temp_write_protect

uint8_t sd_csd_struct_type::temp_write_protect

temporary write protection

Definition at line 158 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get().

◆ write_blk_misalign

uint8_t sd_csd_struct_type::write_blk_misalign

write block misalignment

Definition at line 135 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get().

◆ write_protect_group_enable

uint8_t sd_csd_struct_type::write_protect_group_enable

write protect group enable

Definition at line 148 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get().

◆ write_protect_group_size

uint8_t sd_csd_struct_type::write_protect_group_size

write protect group size

Definition at line 147 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get().

◆ write_speed_factor

uint8_t sd_csd_struct_type::write_speed_factor

write speed factor

Definition at line 150 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get().

The documentation for this struct was generated from the following files:
  • emmc_card/inc/at32_sdio.h
  • sd_mmc_card/inc/at32_sdio.h
  • sdio_fatfs/inc/at32_sdio.h


AT32F413 Firmwary Library: sd_cid_struct_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
sd_cid_struct_type Struct Reference
AT32F413_periph_driver » SDIO | AT32F413_periph_examples » SDIO_emmc_card | AT32F413_periph_examples » SDIO_sd_mmc_card | AT32F413_periph_examples » SDIO_sdio_fatfs » SDIO_exported_types

#include <at32_sdio.h>

Data Fields

uint8_t | manufacturer_id
uint16_t | oem_app_id
uint32_t | product_name1
uint8_t | product_name2
uint8_t | product_reversion
uint32_t | product_sn
uint8_t | reserved1
uint16_t | manufact_date
uint8_t | cid_crc
uint8_t | reserved2

Detailed Description

card identification data: cid register

Definition at line 168 of file emmc_card/inc/at32_sdio.h.

Field Documentation

◆ cid_crc

uint8_t sd_cid_struct_type::cid_crc

cid crc

Definition at line 178 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get().

◆ manufact_date

uint16_t sd_cid_struct_type::manufact_date

manufacturing date

Definition at line 177 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get().

◆ manufacturer_id

uint8_t sd_cid_struct_type::manufacturer_id

manufacturer id

Definition at line 170 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get(), and show_card_info().

◆ oem_app_id

uint16_t sd_cid_struct_type::oem_app_id

oem/application id

Definition at line 171 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get().

◆ product_name1

uint32_t sd_cid_struct_type::product_name1

product name part1

Definition at line 172 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get().

◆ product_name2

uint8_t sd_cid_struct_type::product_name2

product name part2

Definition at line 173 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get().

◆ product_reversion

uint8_t sd_cid_struct_type::product_reversion

product revision

Definition at line 174 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get().

◆ product_sn

uint32_t sd_cid_struct_type::product_sn

product serial number

Definition at line 175 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get().

◆ reserved1

uint8_t sd_cid_struct_type::reserved1

reserved1

Definition at line 176 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get().

◆ reserved2

uint8_t sd_cid_struct_type::reserved2

always 1

Definition at line 179 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get().

The documentation for this struct was generated from the following files:
  • emmc_card/inc/at32_sdio.h
  • sd_mmc_card/inc/at32_sdio.h
  • sdio_fatfs/inc/at32_sdio.h


AT32F413 Firmwary Library: sd_scr_struct_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
sd_scr_struct_type Struct Reference
AT32F413_periph_driver » SDIO | AT32F413_periph_examples » SDIO_emmc_card | AT32F413_periph_examples » SDIO_sd_mmc_card | AT32F413_periph_examples » SDIO_sdio_fatfs » SDIO_exported_types

#include <at32_sdio.h>

Data Fields

uint32_t | sd_spec:4
uint32_t | scr_structure:4
uint32_t | sd_bus_width:4
uint32_t | sd_security:3
uint32_t | data_stat_after_erase:1
uint32_t | reserved1:7
uint32_t | sd_spec3:1
uint32_t | cmd20_support:1
uint32_t | cmd23_support:1
uint32_t | reserverd2:6
uint32_t | reserverd3

Detailed Description

sd card scr information

Definition at line 217 of file emmc_card/inc/at32_sdio.h.

Field Documentation

◆ cmd20_support

uint32_t sd_scr_struct_type::cmd20_support

Definition at line 226 of file emmc_card/inc/at32_sdio.h.

◆ cmd23_support

uint32_t sd_scr_struct_type::cmd23_support

Definition at line 227 of file emmc_card/inc/at32_sdio.h.

◆ data_stat_after_erase

uint32_t sd_scr_struct_type::data_stat_after_erase

Definition at line 223 of file emmc_card/inc/at32_sdio.h.

◆ reserved1

uint32_t sd_scr_struct_type::reserved1

Definition at line 224 of file emmc_card/inc/at32_sdio.h.

◆ reserverd2

uint32_t sd_scr_struct_type::reserverd2

Definition at line 228 of file emmc_card/inc/at32_sdio.h.

◆ reserverd3

uint32_t sd_scr_struct_type::reserverd3

Definition at line 229 of file emmc_card/inc/at32_sdio.h.

◆ scr_structure

uint32_t sd_scr_struct_type::scr_structure

Definition at line 220 of file emmc_card/inc/at32_sdio.h.

◆ sd_bus_width

uint32_t sd_scr_struct_type::sd_bus_width

Definition at line 221 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_bus_wide_enable().

◆ sd_security

uint32_t sd_scr_struct_type::sd_security

Definition at line 222 of file emmc_card/inc/at32_sdio.h.

◆ sd_spec

uint32_t sd_scr_struct_type::sd_spec

Definition at line 219 of file emmc_card/inc/at32_sdio.h.

Referenced by speed_change().

◆ sd_spec3

uint32_t sd_scr_struct_type::sd_spec3

Definition at line 225 of file emmc_card/inc/at32_sdio.h.

The documentation for this struct was generated from the following files:
  • emmc_card/inc/at32_sdio.h
  • sd_mmc_card/inc/at32_sdio.h
  • sdio_fatfs/inc/at32_sdio.h


AT32F413 Firmwary Library: sd_card_info_struct_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
sd_card_info_struct_type Struct Reference
AT32F413_periph_driver » SDIO | AT32F413_periph_examples » SDIO_emmc_card | AT32F413_periph_examples » SDIO_sd_mmc_card | AT32F413_periph_examples » SDIO_sdio_fatfs » SDIO_exported_types

#include <at32_sdio.h>

Data Fields

sd_csd_struct_type sd_csd_reg
sd_cid_struct_type sd_cid_reg
sd_scr_struct_type sd_scr_reg
long long | card_capacity
uint32_t | card_blk_size
uint16_t | rca
uint8_t | card_type

Detailed Description

sd card information

Definition at line 235 of file emmc_card/inc/at32_sdio.h.

Field Documentation

◆ card_blk_size

uint32_t sd_card_info_struct_type::card_blk_size

Definition at line 241 of file emmc_card/inc/at32_sdio.h.

Referenced by disk_ioctl(), sd_card_info_get(), and show_card_info().

◆ card_capacity

long long sd_card_info_struct_type::card_capacity

Definition at line 240 of file emmc_card/inc/at32_sdio.h.

Referenced by disk_ioctl(), sd_card_info_get(), sd_init(), and show_card_info().

◆ card_type

uint8_t sd_card_info_struct_type::card_type

Definition at line 243 of file emmc_card/inc/at32_sdio.h.

Referenced by main(), sd_card_info_get(), sd_init(), and show_card_info().

◆ rca

uint16_t sd_card_info_struct_type::rca

Definition at line 242 of file emmc_card/inc/at32_sdio.h.

Referenced by scr_find(), sd_bus_wide_enable(), sd_card_info_get(), sd_init(), and show_card_info().

◆ sd_cid_reg

sd_cid_struct_type sd_card_info_struct_type::sd_cid_reg

Definition at line 238 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get(), and show_card_info().

◆ sd_csd_reg

sd_csd_struct_type sd_card_info_struct_type::sd_csd_reg

Definition at line 237 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_info_get(), sd_init(), and show_card_info().

◆ sd_scr_reg

sd_scr_struct_type sd_card_info_struct_type::sd_scr_reg

Definition at line 239 of file emmc_card/inc/at32_sdio.h.

Referenced by scr_find(), sd_bus_wide_enable(), and speed_change().

The documentation for this struct was generated from the following files:
  • emmc_card/inc/at32_sdio.h
  • sd_mmc_card/inc/at32_sdio.h
  • sdio_fatfs/inc/at32_sdio.h


AT32F413 Firmwary Library: SDIO_exported_functions

Functions
SDIO_exported_functions
AT32F413_periph_driver » SDIO | AT32F413_periph_examples » SDIO_emmc_card | AT32F413_periph_examples » SDIO_sd_mmc_card | AT32F413_periph_examples » SDIO_sdio_fatfs

Functions

void | sdio_reset (sdio_type *sdio_x)
reset the sdio register
void | sdio_power_set (sdio_type *sdio_x, sdio_power_state_type power_state)
set the power status of the controller
sdio_power_state_type | sdio_power_status_get (sdio_type *sdio_x)
get power status.
void | sdio_clock_config (sdio_type *sdio_x, uint16_t clk_div, sdio_edge_phase_type clk_edg)
config sdio clock
void | sdio_bus_width_config (sdio_type *sdio_x, sdio_bus_width_type width)
config sdio bus width
void | sdio_clock_bypass (sdio_type *sdio_x, confirm_state new_state)
enable or disable clock divider bypss
void | sdio_power_saving_mode_enable (sdio_type *sdio_x, confirm_state new_state)
enable or disable power saving mode, config sdio_ck clock output when the bus is idle.
void | sdio_flow_control_enable (sdio_type *sdio_x, confirm_state new_state)
enable or disable hardware flow control.
void | sdio_clock_enable (sdio_type *sdio_x, confirm_state new_state)
enable or disable sdio_ck output.
void | sdio_dma_enable (sdio_type *sdio_x, confirm_state new_state)
enable or disable dma.
void | sdio_interrupt_enable (sdio_type *sdio_x, uint32_t int_opt, confirm_state new_state)
config corresponding interrupt.
flag_status | sdio_flag_get (sdio_type *sdio_x, uint32_t flag)
get sdio flag.
flag_status | sdio_interrupt_flag_get (sdio_type *sdio_x, uint32_t flag)
get sdio interrupt flag.
void | sdio_flag_clear (sdio_type *sdio_x, uint32_t flag)
clear sdio flag.
void | sdio_command_config (sdio_type *sdio_x, sdio_command_struct_type *command_struct)
config sdio command.
void | sdio_command_state_machine_enable (sdio_type *sdio_x, confirm_state new_state)
enable or disable command path state machine(CPSM).
uint8_t | sdio_command_response_get (sdio_type *sdio_x)
get command index of last command for which response received.
uint32_t | sdio_response_get (sdio_type *sdio_x, sdio_rsp_index_type reg_index)
get response received from the card for the last command.
void | sdio_data_config (sdio_type *sdio_x, sdio_data_struct_type *data_struct)
config sdio data.
void | sdio_data_state_machine_enable (sdio_type *sdio_x, confirm_state new_state)
enable or disable data path state machine(DPSM).
uint32_t | sdio_data_counter_get (sdio_type *sdio_x)
get the number of remaining data bytes to be transferred.
uint32_t | sdio_data_read (sdio_type *sdio_x)
read a word data from sdio fifo.
uint32_t | sdio_buffer_counter_get (sdio_type *sdio_x)
get the number of words left to be written to or read from fifo..
void | sdio_data_write (sdio_type *sdio_x, uint32_t data)
write one word data to fifo.
void | sdio_read_wait_mode_set (sdio_type *sdio_x, sdio_read_wait_mode_type mode)
set the read wait mode.
void | sdio_read_wait_start (sdio_type *sdio_x, confirm_state new_state)
enable or disable to start sd i/o read wait operation.
void | sdio_read_wait_stop (sdio_type *sdio_x, confirm_state new_state)
enable or disable to stop sd i/o read wait operation.
void | sdio_io_function_enable (sdio_type *sdio_x, confirm_state new_state)
enable or disable the sd i/o function.
void | sdio_io_suspend_command_set (sdio_type *sdio_x, confirm_state new_state)
enable or disable sd i/o suspend command sending.
sd_error_status_type | sd_init (void)
initializes the sd card and put it into standby state (ready for data transfer).
void | sdio_clock_set (uint32_t clkdiv)
set sdio clock devision factor.
sd_error_status_type | sd_power_on (void)
enquires cards about their operating voltage and configures clock controls.
sd_error_status_type | sd_power_off (void)
turns the sdio output signals off.
sd_error_status_type | sd_card_init (void)
intialises all cards or single card as the case may be card(s) come into standby state.
sd_error_status_type | sd_card_info_get (sd_card_info_struct_type *card_info)
returns information about specific card.
sd_error_status_type | sd_wide_bus_operation_config (sdio_bus_width_type mode)
enable wide bus opeartion for the requeseted card if supported by card.
sd_error_status_type | sd_device_mode_set (uint32_t mode)
set sdio work mode.
sd_error_status_type | sd_deselect_select (uint32_t addr)
selects od deselects the corresponding card.
sd_error_status_type | sd_status_send (uint32_t *p_card_status)
read current card status.
sd_card_state_type | sd_state_get (void)
returns information about sd card.
sd_error_status_type | sd_blocks_erase (long long addr, uint32_t nblks)
erase continuous data block
sd_error_status_type | sd_block_read (uint8_t *buf, long long addr, uint16_t blk_size)
allows to read one block from a specified address in a card. the data transfer can be managed by dma mode or polling mode.
sd_error_status_type | sd_mult_blocks_read (uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks)
allows to read blocks from a specified address in a card. the data transfer can be managed by dma mode or polling mode.
sd_error_status_type | sd_block_write (const uint8_t *buf, long long addr, uint16_t blk_size)
allows to write one block starting from a specified address in a card. the data transfer can be managed by dma mode or polling mode.
sd_error_status_type | sd_mult_blocks_write (const uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks)
allows to write blocks starting from a specified address in a card. the data transfer can be managed by dma mode only.
sd_error_status_type | mmc_stream_read (uint8_t *buf, long long addr, uint32_t len)
read mmc card data stream.
sd_error_status_type | mmc_stream_write (uint8_t *buf, long long addr, uint32_t len)
write mmc card data stream.
sd_error_status_type | sd_irq_service (void)
allows to process all the interrupts that are high.
void | sd_dma_config (uint32_t *mbuf, uint32_t buf_size, dma_dir_type dir)
set dma configuation for sdio

Detailed Description

Function Documentation

◆ mmc_stream_read()

sd_error_status_type mmc_stream_read | ( | uint8_t * | buf,
 |  | long long | addr,
 |  | uint32_t | len )

read mmc card data stream.

Parameters
buf | buffer of saving data from mmc card
addr | start address of data from mmc card
len | data size
Return values
sd_error_status_type sd card error code.

Definition at line 1675 of file emmc_card/src/at32_sdio.c.

Referenced by mmc_stream_test(), and mmc_stream_test().

◆ mmc_stream_write()

sd_error_status_type mmc_stream_write | ( | uint8_t * | buf,
 |  | long long | addr,
 |  | uint32_t | len )

write mmc card data stream.

Parameters
buf | data that writing to mmc card
addr | start address mmc card
len | data size
Return values
sd_error_status_type sd card error code.

Definition at line 1722 of file emmc_card/src/at32_sdio.c.

Referenced by mmc_stream_test(), and mmc_stream_test().

◆ sd_block_read()

sd_error_status_type sd_block_read | ( | uint8_t * | buf,
 |  | long long | addr,
 |  | uint16_t | blk_size )

allows to read one block from a specified address in a card. the data transfer can be managed by dma mode or polling mode.

Parameters
buf | pointer to the buffer that will contain the received data
addr | address from where data are to be read.
blk_size | the sd card data block size. the block size should be 512.
Return values
sd_error_status_type sd card error code.

Definition at line 1210 of file emmc_card/src/at32_sdio.c.

Referenced by sd_read_disk(), sd_single_block_test(), and sd_single_block_test().

◆ sd_block_write()

sd_error_status_type sd_block_write | ( | const uint8_t * | buf,
 |  | long long | addr,
 |  | uint16_t | blk_size )

allows to write one block starting from a specified address in a card. the data transfer can be managed by dma mode or polling mode.

Parameters
buf | pointer to the buffer that contain the data to be transferred.
addr | address from where data are to be read.
blk_size | the sd card data block size. the block size should be 512.
Return values
sd_error_status_type sd card error code.

Definition at line 1389 of file emmc_card/src/at32_sdio.c.

Referenced by sd_single_block_test(), sd_single_block_test(), and sd_write_disk().

◆ sd_blocks_erase()

sd_error_status_type sd_blocks_erase | ( | long long | addr,
 |  | uint32_t | nblks )

erase continuous data block

Parameters
addr | starting address
nblks | amount of erasing data block
Return values
sd_error_status_type sd card error code.

Definition at line 1052 of file emmc_card/src/at32_sdio.c.

◆ sd_card_info_get()

sd_error_status_type sd_card_info_get ( sd_card_info_struct_type * card_info )

returns information about specific card.

Parameters
card_info pointer to a sd_card_info_struct_type structure that contains all sd card information.
Return values
sd_error_status_type sd card error code.

Definition at line 554 of file emmc_card/src/at32_sdio.c.

Referenced by sd_init().

◆ sd_card_init()

sd_error_status_type sd_card_init ( void )

intialises all cards or single card as the case may be card(s) come into standby state.

Parameters
none
Return values
sd_error_status_type sd card error code.

Definition at line 439 of file emmc_card/src/at32_sdio.c.

Referenced by sd_init().

◆ sd_deselect_select()

sd_error_status_type sd_deselect_select ( uint32_t addr )

selects od deselects the corresponding card.

Parameters
addr address of the card to be selected.
Return values
sd_error_status_type sd card error code.

Definition at line 829 of file emmc_card/src/at32_sdio.c.

Referenced by sd_init().

◆ sd_device_mode_set()

sd_error_status_type sd_device_mode_set ( uint32_t mode )

set sdio work mode.

Parameters
mode parameter as following values:
  • SD_TRANSFER_POLLING_MODE: dma mode.
  • SD_TRANSFER_POLLING_MODE: polling mode.
Return values
sd_error_status_type sd card error code.

Definition at line 808 of file emmc_card/src/at32_sdio.c.

Referenced by sd_init().

◆ sd_dma_config()

void sd_dma_config | ( | uint32_t * | mbuf,
 |  | uint32_t | buf_size,
 |  | dma_dir_type | dir )

set dma configuation for sdio

Parameters
mbuf | buffer address
buf_size | transmission data size
dir | dma direction, it is DMA_DIR_MEMORY_TO_PERIPHERAL(writing data) or DMA_DIR_PERIPHERAL_TO_MEMORY(read data)
Return values
none

Definition at line 2799 of file emmc_card/src/at32_sdio.c.

Referenced by sdio_command_data_send().

◆ sd_init()

sd_error_status_type sd_init ( void )

initializes the sd card and put it into standby state (ready for data transfer).

Parameters
none
Return values
sd_error_status_type sd card error code.

Definition at line 73 of file emmc_card/src/at32_sdio.c.

Referenced by disk_initialize(), main(), and sdio_command_data_send().

◆ sd_irq_service()

sd_error_status_type sd_irq_service ( void )

allows to process all the interrupts that are high.

Parameters
none
Return values
sd_error_status_type sd card error code.

Definition at line 1811 of file emmc_card/src/at32_sdio.c.

Referenced by SDIO1_IRQHandler(), and SDIO2_IRQHandler().

◆ sd_mult_blocks_read()

sd_error_status_type sd_mult_blocks_read | ( | uint8_t * | buf,
 |  | long long | addr,
 |  | uint16_t | blk_size,
 |  | uint32_t | nblks )

allows to read blocks from a specified address in a card. the data transfer can be managed by dma mode or polling mode.

Parameters
buf | pointer to the buffer that will contain the received data.
addr | address from where data are to be read.
blk_size | the sd card data block size. the block size should be 512.
nblks | number of blocks to be read.
Return values
sd_error_status_type sd card error code.

Definition at line 1299 of file emmc_card/src/at32_sdio.c.

Referenced by sd_multiple_blocks_test(), sd_multiple_blocks_test(), and sd_read_disk().

◆ sd_mult_blocks_write()

sd_error_status_type sd_mult_blocks_write | ( | const uint8_t * | buf,
 |  | long long | addr,
 |  | uint16_t | blk_size,
 |  | uint32_t | nblks )

allows to write blocks starting from a specified address in a card. the data transfer can be managed by dma mode only.

Parameters
buf | pointer to the buffer that contain the data to be transferred.
addr | address from where data are to be read.
blk_size | the sd card data block size. the block size should be 512.
nblks | number of blocks to be written.
Return values
sd_error_status_type sd card error code.

Definition at line 1511 of file emmc_card/src/at32_sdio.c.

Referenced by sd_multiple_blocks_test(), sd_multiple_blocks_test(), and sd_write_disk().

◆ sd_power_off()

sd_error_status_type sd_power_off ( void )

turns the sdio output signals off.

Parameters
none
Return values
sd_error_status_type sd card error code.

Definition at line 425 of file emmc_card/src/at32_sdio.c.

◆ sd_power_on()

sd_error_status_type sd_power_on ( void )

enquires cards about their operating voltage and configures clock controls.

Parameters
none
Return values
sd_error_status_type sd card error code.

Definition at line 224 of file emmc_card/src/at32_sdio.c.

Referenced by sd_init().

◆ sd_state_get()

sd_card_state_type sd_state_get ( void )

returns information about sd card.

Parameters
none.
Return values
sd_card_state_type sd card state code.

Definition at line 2511 of file emmc_card/src/at32_sdio.c.

◆ sd_status_send()

sd_error_status_type sd_status_send ( uint32_t * p_card_status )

read current card status.

Parameters
p_card_status card status.
Return values
sd_error_status_type sd card error code.

Definition at line 2474 of file emmc_card/src/at32_sdio.c.

Referenced by mmc_switch(), sd_block_write(), sd_mult_blocks_write(), and sd_state_get().

◆ sd_wide_bus_operation_config()

sd_error_status_type sd_wide_bus_operation_config ( sdio_bus_width_type mode )

enable wide bus opeartion for the requeseted card if supported by card.

Parameters
mode specifies the sd card wide bus mode. this parameter can be one of the following values:
  • SDIO_BUS_WIDTH_D8: 8-bit data transfer (only for mmc)
  • SDIO_BUS_WIDTH_D4: 4-bit data transfer
  • SDIO_BUS_WIDTH_D1: 1-bit data transfer
Return values
sd_error_status_type sd card error code.

Definition at line 765 of file emmc_card/src/at32_sdio.c.

Referenced by mmc_stream_test(), mmc_stream_test(), sd_init(), sd_multiple_blocks_test(), sd_multiple_blocks_test(), sd_single_block_test(), and sd_single_block_test().

◆ sdio_buffer_counter_get()

uint32_t sdio_buffer_counter_get ( sdio_type * sdio_x )

get the number of words left to be written to or read from fifo..

Parameters
sdio_x to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
Return values
uint32_t number of words

Definition at line 520 of file at32f413_sdio.c.

◆ sdio_bus_width_config()

void sdio_bus_width_config | ( | sdio_type * | sdio_x,
 |  | sdio_bus_width_type | width )

config sdio bus width

Parameters
sdio_x to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
width this parameter can be one of the following values:
  • SDIO_BUS_WIDTH_D1
  • SDIO_BUS_WIDTH_D4
  • SDIO_BUS_WIDTH_D8
Return values
none

Definition at line 127 of file at32f413_sdio.c.

Referenced by sd_power_on(), and sd_wide_bus_operation_config().

◆ sdio_clock_bypass()

void sdio_clock_bypass | ( | sdio_type * | sdio_x,
 |  | confirm_state | new_state )

enable or disable clock divider bypss

Parameters
sdio_x | to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 140 of file at32f413_sdio.c.

Referenced by sd_power_on().

◆ sdio_clock_config()

void sdio_clock_config | ( | sdio_type * | sdio_x,
 |  | uint16_t | clk_div,
 |  | sdio_edge_phase_type | clk_edg )

config sdio clock

Parameters
sdio_x | to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
clk_div | sdio clock divide factor(frequency = sdio_clk / [clk_psc + 2]).
clk_edg this parameter can be one of the following values:
  • SDIO_CLOCK_EDGE_RISING
  • SDIO_CLOCK_EDGE_FALLING
Return values
none

Definition at line 103 of file at32f413_sdio.c.

Referenced by sd_power_on().

◆ sdio_clock_enable()

void sdio_clock_enable | ( | sdio_type * | sdio_x,
 |  | confirm_state | new_state )

enable or disable sdio_ck output.

Parameters
sdio_x | to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 180 of file at32f413_sdio.c.

Referenced by sd_power_on().

◆ sdio_clock_set()

void sdio_clock_set ( uint32_t clk_div )

set sdio clock devision factor.

Parameters
clkdiv sdio_ck = ahbclk / (clkdiv+2)
Return values
none

Definition at line 209 of file emmc_card/src/at32_sdio.c.

Referenced by sd_init().

◆ sdio_command_config()

void sdio_command_config | ( | sdio_type * | sdio_x,
 |  | sdio_command_struct_type * | command_struct )

config sdio command.

Parameters
sdio_x | to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
command_struct | : pointer to a sdio_command_struct_type structure that contains the configuration information for the sdio command.
Return values
none

Definition at line 372 of file at32f413_sdio.c.

Referenced by check_card_programming(), get_ext_csd(), mmc_switch(), scr_find(), sd_block_read(), sd_block_write(), sd_blocks_erase(), sd_bus_wide_enable(), sd_card_init(), sd_deselect_select(), sd_irq_service(), sd_mult_blocks_read(), sd_mult_blocks_write(), sd_power_on(), sd_status_send(), sd_switch(), and sdio_command_data_send().

◆ sdio_command_response_get()

uint8_t sdio_command_response_get ( sdio_type * sdio_x )

get command index of last command for which response received.

Parameters
sdio_x | to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
new_state | (TRUE or FALSE)
Return values
uint8_t command index

Definition at line 408 of file at32f413_sdio.c.

Referenced by check_card_programming(), command_rsp1_error(), command_rsp4_error(), command_rsp5_error(), and command_rsp6_error().

◆ sdio_command_state_machine_enable()

void sdio_command_state_machine_enable | ( | sdio_type * | sdio_x,
 |  | confirm_state | new_state )

enable or disable command path state machine(CPSM).

Parameters
sdio_x | to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 395 of file at32f413_sdio.c.

Referenced by check_card_programming(), get_ext_csd(), mmc_switch(), scr_find(), sd_block_read(), sd_block_write(), sd_blocks_erase(), sd_bus_wide_enable(), sd_card_init(), sd_deselect_select(), sd_irq_service(), sd_mult_blocks_read(), sd_mult_blocks_write(), sd_power_on(), sd_status_send(), sd_switch(), and sdio_command_data_send().

◆ sdio_data_config()

void sdio_data_config | ( | sdio_type * | sdio_x,
 |  | sdio_data_struct_type * | data_struct )

config sdio data.

Parameters
sdio_x | to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
data_struct | : pointer to a sdio_data_struct_type structure that contains the configuration information for the sdio data.
Return values
none

Definition at line 459 of file at32f413_sdio.c.

Referenced by get_ext_csd(), mmc_stream_read(), mmc_stream_write(), scr_find(), sd_block_read(), sd_block_write(), sd_blocks_erase(), sd_mult_blocks_read(), sd_mult_blocks_write(), and sdio_command_data_send().

◆ sdio_data_counter_get()

uint32_t sdio_data_counter_get ( sdio_type * sdio_x )

get the number of remaining data bytes to be transferred.

Parameters
sdio_x to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
Return values
uint32_t number of bytes

Definition at line 496 of file at32f413_sdio.c.

◆ sdio_data_read()

uint32_t sdio_data_read ( sdio_type * sdio_x )

read a word data from sdio fifo.

Parameters
sdio_x to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
Return values
uint32_t data received

Definition at line 508 of file at32f413_sdio.c.

Referenced by get_ext_csd(), scr_find(), and sdio_command_data_send().

◆ sdio_data_state_machine_enable()

void sdio_data_state_machine_enable | ( | sdio_type * | sdio_x,
 |  | confirm_state | new_state )

enable or disable data path state machine(DPSM).

Parameters
sdio_x | to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 484 of file at32f413_sdio.c.

Referenced by get_ext_csd(), mmc_stream_read(), mmc_stream_write(), scr_find(), sd_block_read(), sd_block_write(), sd_blocks_erase(), sd_mult_blocks_read(), sd_mult_blocks_write(), and sdio_command_data_send().

◆ sdio_data_write()

void sdio_data_write | ( | sdio_type * | sdio_x,
 |  | uint32_t | data )

write one word data to fifo.

Parameters
sdio_x | to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
data | data to be transferred.
Return values
none

Definition at line 533 of file at32f413_sdio.c.

Referenced by sdio_command_data_send().

◆ sdio_dma_enable()

void sdio_dma_enable | ( | sdio_type * | sdio_x,
 |  | confirm_state | new_state )

enable or disable dma.

Parameters
sdio_x | to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 193 of file at32f413_sdio.c.

Referenced by sdio_command_data_send().

◆ sdio_flag_clear()

void sdio_flag_clear | ( | sdio_type * | sdio_x,
 |  | uint32_t | flag )

clear sdio flag.

Parameters
sdio_x to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
int_opt this parameter can be any combination of the following values:
  • SDIO_CMDFAIL_FLAG
  • SDIO_DTFAIL_FLAG
  • SDIO_CMDTIMEOUT_FLAG
  • SDIO_DTTIMEOUT_FLAG
  • SDIO_TXERRU_FLAG
  • SDIO_RXERRO_FLAG
  • SDIO_CMDRSPCMPL_FLAG
  • SDIO_CMDCMPL_FLAG
  • SDIO_DTCMPL_FLAG
  • SDIO_SBITERR_FLAG
  • SDIO_DTBLKCMPL_FLAG
  • SDIO_SDIOIF_FLAG
Return values
none

Definition at line 358 of file at32f413_sdio.c.

Referenced by check_card_programming(), command_error(), command_rsp1_error(), command_rsp2_error(), command_rsp3_error(), command_rsp4_error(), command_rsp5_error(), command_rsp6_error(), command_rsp7_error(), get_ext_csd(), mmc_stream_write(), scr_find(), sd_block_write(), sd_irq_service(), sd_mult_blocks_write(), and sdio_command_data_send().

◆ sdio_flag_get()

flag_status sdio_flag_get | ( | sdio_type * | sdio_x,
 |  | uint32_t | flag )

get sdio flag.

Parameters
sdio_x to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
flag this parameter can be one of the following values:
  • SDIO_CMDFAIL_FLAG
  • SDIO_DTFAIL_FLAG
  • SDIO_CMDTIMEOUT_FLAG
  • SDIO_DTTIMEOUT_FLAG
  • SDIO_TXERRU_FLAG
  • SDIO_RXERRO_FLAG
  • SDIO_CMDRSPCMPL_FLAG
  • SDIO_CMDCMPL_FLAG
  • SDIO_DTCMPL_FLAG
  • SDIO_SBITERR_FLAG
  • SDIO_DTBLKCMPL_FLAG
  • SDIO_DOCMD_FLAG
  • SDIO_DOTX_FLAG
  • SDIO_DORX_FLAG
  • SDIO_TXBUFH_FLAG
  • SDIO_RXBUFH_FLAG
  • SDIO_TXBUFF_FLAG
  • SDIO_RXBUFF_FLAG
  • SDIO_TXBUFE_FLAG
  • SDIO_RXBUFE_FLAG
  • SDIO_TXBUF_FLAG
  • SDIO_RXBUF_FLAG
  • SDIO_SDIOIF_FLAG
Return values
flag_status (SET or RESET)

Definition at line 321 of file at32f413_sdio.c.

Referenced by check_card_programming(), command_error(), command_rsp1_error(), command_rsp2_error(), command_rsp3_error(), command_rsp4_error(), command_rsp5_error(), command_rsp6_error(), get_ext_csd(), scr_find(), and sdio_command_data_send().

◆ sdio_flow_control_enable()

void sdio_flow_control_enable | ( | sdio_type * | sdio_x,
 |  | confirm_state | new_state )

enable or disable hardware flow control.

Parameters
sdio_x | to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 167 of file at32f413_sdio.c.

Referenced by sd_power_on().

◆ sdio_interrupt_enable()

void sdio_interrupt_enable | ( | sdio_type * | sdio_x,
 |  | uint32_t | int_opt,
 |  | confirm_state | new_state )

config corresponding interrupt.

Parameters
sdio_x | to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
int_opt this parameter can be one of the following values:
  • SDIO_CMDFAIL_INT
  • SDIO_DTFAIL_INT
  • SDIO_CMDTIMEOUT_INT
  • SDIO_DTTIMEOUT_INT
  • SDIO_TXERRU_INT
  • SDIO_RXERRO_INT
  • SDIO_CMDRSPCMPL_INT
  • SDIO_CMDCMPL_INT
  • SDIO_DTCMP_INT
  • SDIO_SBITERR_INT
  • SDIO_DTBLKCMPL_INT
  • SDIO_DOCMD_INT
  • SDIO_DOTX_INT
  • SDIO_DORX_INT
  • SDIO_TXBUFH_INT
  • SDIO_RXBUFH_INT
  • SDIO_TXBUFF_INT
  • SDIO_RXBUFF_INT
  • SDIO_TXBUFE_INT
  • SDIO_RXBUFE_INT
  • SDIO_TXBUF_INT
  • SDIO_RXBUF_INT
  • SDIO_SDIOIF_INT
new_state | (TRUE or FALSE)
Return values
none

Definition at line 231 of file at32f413_sdio.c.

Referenced by sd_irq_service().

◆ sdio_interrupt_flag_get()

flag_status sdio_interrupt_flag_get | ( | sdio_type * | sdio_x,
 |  | uint32_t | flag )

get sdio interrupt flag.

Parameters
sdio_x to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
flag this parameter can be one of the following values:
  • SDIO_CMDFAIL_FLAG
  • SDIO_DTFAIL_FLAG
  • SDIO_CMDTIMEOUT_FLAG
  • SDIO_DTTIMEOUT_FLAG
  • SDIO_TXERRU_FLAG
  • SDIO_RXERRO_FLAG
  • SDIO_CMDRSPCMPL_FLAG
  • SDIO_CMDCMPL_FLAG
  • SDIO_DTCMPL_FLAG
  • SDIO_SBITERR_FLAG
  • SDIO_DTBLKCMPL_FLAG
  • SDIO_DOCMD_FLAG
  • SDIO_DOTX_FLAG
  • SDIO_DORX_FLAG
  • SDIO_TXBUFH_FLAG
  • SDIO_RXBUFH_FLAG
  • SDIO_TXBUFF_FLAG
  • SDIO_RXBUFF_FLAG
  • SDIO_TXBUFE_FLAG
  • SDIO_RXBUFE_FLAG
  • SDIO_TXBUF_FLAG
  • SDIO_RXBUF_FLAG
  • SDIO_SDIOIF_FLAG
Return values
flag_status (SET or RESET)

Definition at line 277 of file at32f413_sdio.c.

Referenced by sd_irq_service().

◆ sdio_io_function_enable()

void sdio_io_function_enable | ( | sdio_type * | sdio_x,
 |  | confirm_state | new_state )

enable or disable the sd i/o function.

Parameters
sdio_x | to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 588 of file at32f413_sdio.c.

◆ sdio_io_suspend_command_set()

void sdio_io_suspend_command_set | ( | sdio_type * | sdio_x,
 |  | confirm_state | new_state )

enable or disable sd i/o suspend command sending.

Parameters
sdio_x | to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 601 of file at32f413_sdio.c.

◆ sdio_power_saving_mode_enable()

void sdio_power_saving_mode_enable | ( | sdio_type * | sdio_x,
 |  | confirm_state | new_state )

enable or disable power saving mode, config sdio_ck clock output when the bus is idle.

Parameters
sdio_x | to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 154 of file at32f413_sdio.c.

Referenced by sd_power_on().

◆ sdio_power_set()

void sdio_power_set | ( | sdio_type * | sdio_x,
 |  | sdio_power_state_type | power_state )

set the power status of the controller

Parameters
sdio_x to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
power_state this parameter can be one of the following values:
  • SDIO_POWER_OFF
  • SDIO_POWER_ON
Return values
none

Definition at line 74 of file at32f413_sdio.c.

Referenced by sd_power_off(), and sd_power_on().

◆ sdio_power_status_get()

sdio_power_state_type sdio_power_status_get ( sdio_type * sdio_x )

get power status.

Parameters
sdio_x to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
Return values
sdio_power_state_type (SDIO_POWER_ON or SDIO_POWER_OFF)

Definition at line 86 of file at32f413_sdio.c.

Referenced by sd_card_init().

◆ sdio_read_wait_mode_set()

void sdio_read_wait_mode_set | ( | sdio_type * | sdio_x,
 |  | sdio_read_wait_mode_type | mode )

set the read wait mode.

Parameters
sdio_x to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
mode this parameter can be one of the following values:
  • SDIO_READ_WAIT_CONTROLLED_BY_D2
  • SDIO_READ_WAIT_CONTROLLED_BY_CK
Return values
none

Definition at line 549 of file at32f413_sdio.c.

◆ sdio_read_wait_start()

void sdio_read_wait_start | ( | sdio_type * | sdio_x,
 |  | confirm_state | new_state )

enable or disable to start sd i/o read wait operation.

Parameters
sdio_x | to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 562 of file at32f413_sdio.c.

◆ sdio_read_wait_stop()

void sdio_read_wait_stop | ( | sdio_type * | sdio_x,
 |  | confirm_state | new_state )

enable or disable to stop sd i/o read wait operation.

Parameters
sdio_x | to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 575 of file at32f413_sdio.c.

◆ sdio_reset()

void sdio_reset ( sdio_type * sdio_x )

reset the sdio register

Parameters
sdio_x to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
Return values
none

Definition at line 50 of file at32f413_sdio.c.

Referenced by sd_init().

◆ sdio_response_get()

uint32_t sdio_response_get | ( | sdio_type * | sdio_x,
 |  | sdio_rsp_index_type | reg_index )

get response received from the card for the last command.

Parameters
sdio_x to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
reg_index this parameter can be one of the following values:
  • SDIO_RSP1_INDEX
  • SDIO_RSP2_INDEX
  • SDIO_RSP3_INDEX
  • SDIO_RSP4_INDEX
Return values
uint32_t response register value

Definition at line 426 of file at32f413_sdio.c.

Referenced by check_card_programming(), command_rsp1_error(), command_rsp5_error(), command_rsp6_error(), mmc_stream_read(), mmc_stream_write(), mmc_switch(), sd_block_read(), sd_block_write(), sd_blocks_erase(), sd_bus_wide_enable(), sd_card_init(), sd_mult_blocks_read(), sd_mult_blocks_write(), sd_power_on(), and sd_status_send().


AT32F413 Firmwary Library: SDIO_private_functions

Functions
SDIO_private_functions
AT32F413_periph_driver » SDIO

Functions

void | sdio_reset (sdio_type *sdio_x)
reset the sdio register
void | sdio_power_set (sdio_type *sdio_x, sdio_power_state_type power_state)
set the power status of the controller
sdio_power_state_type | sdio_power_status_get (sdio_type *sdio_x)
get power status.
void | sdio_clock_config (sdio_type *sdio_x, uint16_t clk_div, sdio_edge_phase_type clk_edg)
config sdio clock
void | sdio_bus_width_config (sdio_type *sdio_x, sdio_bus_width_type width)
config sdio bus width
void | sdio_clock_bypass (sdio_type *sdio_x, confirm_state new_state)
enable or disable clock divider bypss
void | sdio_power_saving_mode_enable (sdio_type *sdio_x, confirm_state new_state)
enable or disable power saving mode, config sdio_ck clock output when the bus is idle.
void | sdio_flow_control_enable (sdio_type *sdio_x, confirm_state new_state)
enable or disable hardware flow control.
void | sdio_clock_enable (sdio_type *sdio_x, confirm_state new_state)
enable or disable sdio_ck output.
void | sdio_dma_enable (sdio_type *sdio_x, confirm_state new_state)
enable or disable dma.
void | sdio_interrupt_enable (sdio_type *sdio_x, uint32_t int_opt, confirm_state new_state)
config corresponding interrupt.
flag_status | sdio_interrupt_flag_get (sdio_type *sdio_x, uint32_t flag)
get sdio interrupt flag.
flag_status | sdio_flag_get (sdio_type *sdio_x, uint32_t flag)
get sdio flag.
void | sdio_flag_clear (sdio_type *sdio_x, uint32_t flag)
clear sdio flag.
void | sdio_command_config (sdio_type *sdio_x, sdio_command_struct_type *command_struct)
config sdio command.
void | sdio_command_state_machine_enable (sdio_type *sdio_x, confirm_state new_state)
enable or disable command path state machine(CPSM).
uint8_t | sdio_command_response_get (sdio_type *sdio_x)
get command index of last command for which response received.
uint32_t | sdio_response_get (sdio_type *sdio_x, sdio_rsp_index_type reg_index)
get response received from the card for the last command.
void | sdio_data_config (sdio_type *sdio_x, sdio_data_struct_type *data_struct)
config sdio data.
void | sdio_data_state_machine_enable (sdio_type *sdio_x, confirm_state new_state)
enable or disable data path state machine(DPSM).
uint32_t | sdio_data_counter_get (sdio_type *sdio_x)
get the number of remaining data bytes to be transferred.
uint32_t | sdio_data_read (sdio_type *sdio_x)
read a word data from sdio fifo.
uint32_t | sdio_buffer_counter_get (sdio_type *sdio_x)
get the number of words left to be written to or read from fifo..
void | sdio_data_write (sdio_type *sdio_x, uint32_t data)
write one word data to fifo.
void | sdio_read_wait_mode_set (sdio_type *sdio_x, sdio_read_wait_mode_type mode)
set the read wait mode.
void | sdio_read_wait_start (sdio_type *sdio_x, confirm_state new_state)
enable or disable to start sd i/o read wait operation.
void | sdio_read_wait_stop (sdio_type *sdio_x, confirm_state new_state)
enable or disable to stop sd i/o read wait operation.
void | sdio_io_function_enable (sdio_type *sdio_x, confirm_state new_state)
enable or disable the sd i/o function.
void | sdio_io_suspend_command_set (sdio_type *sdio_x, confirm_state new_state)
enable or disable sd i/o suspend command sending.

Detailed Description

Function Documentation

◆ sdio_buffer_counter_get()

uint32_t sdio_buffer_counter_get ( sdio_type * sdio_x )

get the number of words left to be written to or read from fifo..

Parameters
sdio_x to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
Return values
uint32_t number of words

Definition at line 520 of file at32f413_sdio.c.

◆ sdio_bus_width_config()

void sdio_bus_width_config | ( | sdio_type * | sdio_x,
 |  | sdio_bus_width_type | width )

config sdio bus width

Parameters
sdio_x to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
width this parameter can be one of the following values:
  • SDIO_BUS_WIDTH_D1
  • SDIO_BUS_WIDTH_D4
  • SDIO_BUS_WIDTH_D8
Return values
none

Definition at line 127 of file at32f413_sdio.c.

Referenced by sd_power_on(), and sd_wide_bus_operation_config().

◆ sdio_clock_bypass()

void sdio_clock_bypass | ( | sdio_type * | sdio_x,
 |  | confirm_state | new_state )

enable or disable clock divider bypss

Parameters
sdio_x | to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 140 of file at32f413_sdio.c.

Referenced by sd_power_on().

◆ sdio_clock_config()

void sdio_clock_config | ( | sdio_type * | sdio_x,
 |  | uint16_t | clk_div,
 |  | sdio_edge_phase_type | clk_edg )

config sdio clock

Parameters
sdio_x | to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
clk_div | sdio clock divide factor(frequency = sdio_clk / [clk_psc + 2]).
clk_edg this parameter can be one of the following values:
  • SDIO_CLOCK_EDGE_RISING
  • SDIO_CLOCK_EDGE_FALLING
Return values
none

Definition at line 103 of file at32f413_sdio.c.

Referenced by sd_power_on().

◆ sdio_clock_enable()

void sdio_clock_enable | ( | sdio_type * | sdio_x,
 |  | confirm_state | new_state )

enable or disable sdio_ck output.

Parameters
sdio_x | to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 180 of file at32f413_sdio.c.

Referenced by sd_power_on().

◆ sdio_command_config()

void sdio_command_config | ( | sdio_type * | sdio_x,
 |  | sdio_command_struct_type * | command_struct )

config sdio command.

Parameters
sdio_x | to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
command_struct | : pointer to a sdio_command_struct_type structure that contains the configuration information for the sdio command.
Return values
none

Definition at line 372 of file at32f413_sdio.c.

Referenced by check_card_programming(), get_ext_csd(), mmc_switch(), scr_find(), sd_block_read(), sd_block_write(), sd_blocks_erase(), sd_bus_wide_enable(), sd_card_init(), sd_deselect_select(), sd_irq_service(), sd_mult_blocks_read(), sd_mult_blocks_write(), sd_power_on(), sd_status_send(), sd_switch(), and sdio_command_data_send().

◆ sdio_command_response_get()

uint8_t sdio_command_response_get ( sdio_type * sdio_x )

get command index of last command for which response received.

Parameters
sdio_x | to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
new_state | (TRUE or FALSE)
Return values
uint8_t command index

Definition at line 408 of file at32f413_sdio.c.

Referenced by check_card_programming(), command_rsp1_error(), command_rsp4_error(), command_rsp5_error(), and command_rsp6_error().

◆ sdio_command_state_machine_enable()

void sdio_command_state_machine_enable | ( | sdio_type * | sdio_x,
 |  | confirm_state | new_state )

enable or disable command path state machine(CPSM).

Parameters
sdio_x | to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 395 of file at32f413_sdio.c.

Referenced by check_card_programming(), get_ext_csd(), mmc_switch(), scr_find(), sd_block_read(), sd_block_write(), sd_blocks_erase(), sd_bus_wide_enable(), sd_card_init(), sd_deselect_select(), sd_irq_service(), sd_mult_blocks_read(), sd_mult_blocks_write(), sd_power_on(), sd_status_send(), sd_switch(), and sdio_command_data_send().

◆ sdio_data_config()

void sdio_data_config | ( | sdio_type * | sdio_x,
 |  | sdio_data_struct_type * | data_struct )

config sdio data.

Parameters
sdio_x | to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
data_struct | : pointer to a sdio_data_struct_type structure that contains the configuration information for the sdio data.
Return values
none

Definition at line 459 of file at32f413_sdio.c.

Referenced by get_ext_csd(), mmc_stream_read(), mmc_stream_write(), scr_find(), sd_block_read(), sd_block_write(), sd_blocks_erase(), sd_mult_blocks_read(), sd_mult_blocks_write(), and sdio_command_data_send().

◆ sdio_data_counter_get()

uint32_t sdio_data_counter_get ( sdio_type * sdio_x )

get the number of remaining data bytes to be transferred.

Parameters
sdio_x to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
Return values
uint32_t number of bytes

Definition at line 496 of file at32f413_sdio.c.

◆ sdio_data_read()

uint32_t sdio_data_read ( sdio_type * sdio_x )

read a word data from sdio fifo.

Parameters
sdio_x to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
Return values
uint32_t data received

Definition at line 508 of file at32f413_sdio.c.

Referenced by get_ext_csd(), scr_find(), and sdio_command_data_send().

◆ sdio_data_state_machine_enable()

void sdio_data_state_machine_enable | ( | sdio_type * | sdio_x,
 |  | confirm_state | new_state )

enable or disable data path state machine(DPSM).

Parameters
sdio_x | to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 484 of file at32f413_sdio.c.

Referenced by get_ext_csd(), mmc_stream_read(), mmc_stream_write(), scr_find(), sd_block_read(), sd_block_write(), sd_blocks_erase(), sd_mult_blocks_read(), sd_mult_blocks_write(), and sdio_command_data_send().

◆ sdio_data_write()

void sdio_data_write | ( | sdio_type * | sdio_x,
 |  | uint32_t | data )

write one word data to fifo.

Parameters
sdio_x | to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
data | data to be transferred.
Return values
none

Definition at line 533 of file at32f413_sdio.c.

Referenced by sdio_command_data_send().

◆ sdio_dma_enable()

void sdio_dma_enable | ( | sdio_type * | sdio_x,
 |  | confirm_state | new_state )

enable or disable dma.

Parameters
sdio_x | to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 193 of file at32f413_sdio.c.

Referenced by sdio_command_data_send().

◆ sdio_flag_clear()

void sdio_flag_clear | ( | sdio_type * | sdio_x,
 |  | uint32_t | flag )

clear sdio flag.

Parameters
sdio_x to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
int_opt this parameter can be any combination of the following values:
  • SDIO_CMDFAIL_FLAG
  • SDIO_DTFAIL_FLAG
  • SDIO_CMDTIMEOUT_FLAG
  • SDIO_DTTIMEOUT_FLAG
  • SDIO_TXERRU_FLAG
  • SDIO_RXERRO_FLAG
  • SDIO_CMDRSPCMPL_FLAG
  • SDIO_CMDCMPL_FLAG
  • SDIO_DTCMPL_FLAG
  • SDIO_SBITERR_FLAG
  • SDIO_DTBLKCMPL_FLAG
  • SDIO_SDIOIF_FLAG
Return values
none

Definition at line 358 of file at32f413_sdio.c.

Referenced by check_card_programming(), command_error(), command_rsp1_error(), command_rsp2_error(), command_rsp3_error(), command_rsp4_error(), command_rsp5_error(), command_rsp6_error(), command_rsp7_error(), get_ext_csd(), mmc_stream_write(), scr_find(), sd_block_write(), sd_irq_service(), sd_mult_blocks_write(), and sdio_command_data_send().

◆ sdio_flag_get()

flag_status sdio_flag_get | ( | sdio_type * | sdio_x,
 |  | uint32_t | flag )

get sdio flag.

Parameters
sdio_x to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
flag this parameter can be one of the following values:
  • SDIO_CMDFAIL_FLAG
  • SDIO_DTFAIL_FLAG
  • SDIO_CMDTIMEOUT_FLAG
  • SDIO_DTTIMEOUT_FLAG
  • SDIO_TXERRU_FLAG
  • SDIO_RXERRO_FLAG
  • SDIO_CMDRSPCMPL_FLAG
  • SDIO_CMDCMPL_FLAG
  • SDIO_DTCMPL_FLAG
  • SDIO_SBITERR_FLAG
  • SDIO_DTBLKCMPL_FLAG
  • SDIO_DOCMD_FLAG
  • SDIO_DOTX_FLAG
  • SDIO_DORX_FLAG
  • SDIO_TXBUFH_FLAG
  • SDIO_RXBUFH_FLAG
  • SDIO_TXBUFF_FLAG
  • SDIO_RXBUFF_FLAG
  • SDIO_TXBUFE_FLAG
  • SDIO_RXBUFE_FLAG
  • SDIO_TXBUF_FLAG
  • SDIO_RXBUF_FLAG
  • SDIO_SDIOIF_FLAG
Return values
flag_status (SET or RESET)

Definition at line 321 of file at32f413_sdio.c.

Referenced by check_card_programming(), command_error(), command_rsp1_error(), command_rsp2_error(), command_rsp3_error(), command_rsp4_error(), command_rsp5_error(), command_rsp6_error(), get_ext_csd(), scr_find(), and sdio_command_data_send().

◆ sdio_flow_control_enable()

void sdio_flow_control_enable | ( | sdio_type * | sdio_x,
 |  | confirm_state | new_state )

enable or disable hardware flow control.

Parameters
sdio_x | to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 167 of file at32f413_sdio.c.

Referenced by sd_power_on().

◆ sdio_interrupt_enable()

void sdio_interrupt_enable | ( | sdio_type * | sdio_x,
 |  | uint32_t | int_opt,
 |  | confirm_state | new_state )

config corresponding interrupt.

Parameters
sdio_x | to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
int_opt this parameter can be one of the following values:
  • SDIO_CMDFAIL_INT
  • SDIO_DTFAIL_INT
  • SDIO_CMDTIMEOUT_INT
  • SDIO_DTTIMEOUT_INT
  • SDIO_TXERRU_INT
  • SDIO_RXERRO_INT
  • SDIO_CMDRSPCMPL_INT
  • SDIO_CMDCMPL_INT
  • SDIO_DTCMP_INT
  • SDIO_SBITERR_INT
  • SDIO_DTBLKCMPL_INT
  • SDIO_DOCMD_INT
  • SDIO_DOTX_INT
  • SDIO_DORX_INT
  • SDIO_TXBUFH_INT
  • SDIO_RXBUFH_INT
  • SDIO_TXBUFF_INT
  • SDIO_RXBUFF_INT
  • SDIO_TXBUFE_INT
  • SDIO_RXBUFE_INT
  • SDIO_TXBUF_INT
  • SDIO_RXBUF_INT
  • SDIO_SDIOIF_INT
new_state | (TRUE or FALSE)
Return values
none

Definition at line 231 of file at32f413_sdio.c.

Referenced by sd_irq_service().

◆ sdio_interrupt_flag_get()

flag_status sdio_interrupt_flag_get | ( | sdio_type * | sdio_x,
 |  | uint32_t | flag )

get sdio interrupt flag.

Parameters
sdio_x to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
flag this parameter can be one of the following values:
  • SDIO_CMDFAIL_FLAG
  • SDIO_DTFAIL_FLAG
  • SDIO_CMDTIMEOUT_FLAG
  • SDIO_DTTIMEOUT_FLAG
  • SDIO_TXERRU_FLAG
  • SDIO_RXERRO_FLAG
  • SDIO_CMDRSPCMPL_FLAG
  • SDIO_CMDCMPL_FLAG
  • SDIO_DTCMPL_FLAG
  • SDIO_SBITERR_FLAG
  • SDIO_DTBLKCMPL_FLAG
  • SDIO_DOCMD_FLAG
  • SDIO_DOTX_FLAG
  • SDIO_DORX_FLAG
  • SDIO_TXBUFH_FLAG
  • SDIO_RXBUFH_FLAG
  • SDIO_TXBUFF_FLAG
  • SDIO_RXBUFF_FLAG
  • SDIO_TXBUFE_FLAG
  • SDIO_RXBUFE_FLAG
  • SDIO_TXBUF_FLAG
  • SDIO_RXBUF_FLAG
  • SDIO_SDIOIF_FLAG
Return values
flag_status (SET or RESET)

Definition at line 277 of file at32f413_sdio.c.

Referenced by sd_irq_service().

◆ sdio_io_function_enable()

void sdio_io_function_enable | ( | sdio_type * | sdio_x,
 |  | confirm_state | new_state )

enable or disable the sd i/o function.

Parameters
sdio_x | to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 588 of file at32f413_sdio.c.

◆ sdio_io_suspend_command_set()

void sdio_io_suspend_command_set | ( | sdio_type * | sdio_x,
 |  | confirm_state | new_state )

enable or disable sd i/o suspend command sending.

Parameters
sdio_x | to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 601 of file at32f413_sdio.c.

◆ sdio_power_saving_mode_enable()

void sdio_power_saving_mode_enable | ( | sdio_type * | sdio_x,
 |  | confirm_state | new_state )

enable or disable power saving mode, config sdio_ck clock output when the bus is idle.

Parameters
sdio_x | to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 154 of file at32f413_sdio.c.

Referenced by sd_power_on().

◆ sdio_power_set()

void sdio_power_set | ( | sdio_type * | sdio_x,
 |  | sdio_power_state_type | power_state )

set the power status of the controller

Parameters
sdio_x to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
power_state this parameter can be one of the following values:
  • SDIO_POWER_OFF
  • SDIO_POWER_ON
Return values
none

Definition at line 74 of file at32f413_sdio.c.

Referenced by sd_power_off(), and sd_power_on().

◆ sdio_power_status_get()

sdio_power_state_type sdio_power_status_get ( sdio_type * sdio_x )

get power status.

Parameters
sdio_x to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
Return values
sdio_power_state_type (SDIO_POWER_ON or SDIO_POWER_OFF)

Definition at line 86 of file at32f413_sdio.c.

Referenced by sd_card_init().

◆ sdio_read_wait_mode_set()

void sdio_read_wait_mode_set | ( | sdio_type * | sdio_x,
 |  | sdio_read_wait_mode_type | mode )

set the read wait mode.

Parameters
sdio_x to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
mode this parameter can be one of the following values:
  • SDIO_READ_WAIT_CONTROLLED_BY_D2
  • SDIO_READ_WAIT_CONTROLLED_BY_CK
Return values
none

Definition at line 549 of file at32f413_sdio.c.

◆ sdio_read_wait_start()

void sdio_read_wait_start | ( | sdio_type * | sdio_x,
 |  | confirm_state | new_state )

enable or disable to start sd i/o read wait operation.

Parameters
sdio_x | to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 562 of file at32f413_sdio.c.

◆ sdio_read_wait_stop()

void sdio_read_wait_stop | ( | sdio_type * | sdio_x,
 |  | confirm_state | new_state )

enable or disable to stop sd i/o read wait operation.

Parameters
sdio_x | to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
new_state | (TRUE or FALSE)
Return values
none

Definition at line 575 of file at32f413_sdio.c.

◆ sdio_reset()

void sdio_reset ( sdio_type * sdio_x )

reset the sdio register

Parameters
sdio_x to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
Return values
none

Definition at line 50 of file at32f413_sdio.c.

Referenced by sd_init().

◆ sdio_response_get()

uint32_t sdio_response_get | ( | sdio_type * | sdio_x,
 |  | sdio_rsp_index_type | reg_index )

get response received from the card for the last command.

Parameters
sdio_x to select the sdio peripheral. this parameter can be one of the following values: SDIO1.
reg_index this parameter can be one of the following values:
  • SDIO_RSP1_INDEX
  • SDIO_RSP2_INDEX
  • SDIO_RSP3_INDEX
  • SDIO_RSP4_INDEX
Return values
uint32_t response register value

Definition at line 426 of file at32f413_sdio.c.

Referenced by check_card_programming(), command_rsp1_error(), command_rsp5_error(), command_rsp6_error(), mmc_stream_read(), mmc_stream_write(), mmc_switch(), sd_block_read(), sd_block_write(), sd_blocks_erase(), sd_bus_wide_enable(), sd_card_init(), sd_mult_blocks_read(), sd_mult_blocks_write(), sd_power_on(), and sd_status_send().


AT32F413 Firmwary Library: SPI

Topics | Macros
SPI
AT32F413_periph_driver

SPI driver modules. More...

Topics

SPI_I2S_flags_definition
spi i2s flag
SPI_I2S_interrupts_definition
spi i2s interrupt
SPI_exported_types
SPI_exported_functions
SPI_private_functions

Macros

#define | SPI1 ((spi_type *) SPI1_BASE)
#define | SPI2 ((spi_type *) SPI2_BASE)

Detailed Description

SPI driver modules.

Macro Definition Documentation

◆ SPI1

#define SPI1 ((spi_type *) SPI1_BASE)

Definition at line 447 of file at32f413_spi.h.

Referenced by codec_i2s_init(), codec_i2s_reset(), dma_config(), dma_config(), dma_config(), i2s_config(), i2s_config(), i2s_config(), main(), SPI1_IRQHandler(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), and spi_i2s_reset().

◆ SPI2

#define SPI2 ((spi_type *) SPI2_BASE)

Definition at line 448 of file at32f413_spi.h.

Referenced by codec_i2s_init(), codec_i2s_reset(), dma_config(), dma_config(), dma_config(), i2s_config(), i2s_config(), i2s_config(), main(), SPI2_IRQHandler(), spi_byte_write(), spi_bytes_read(), spi_bytes_write(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_i2s_reset(), spiflash_init(), and usart_spi_configuration().


AT32F413 Firmwary Library: SPI_I2S_flags_definition

Macros
SPI_I2S_flags_definition
AT32F413_periph_driver » SPI

spi i2s flag More...

Macros

#define | SPI_I2S_RDBF_FLAG 0x0001
#define | SPI_I2S_TDBE_FLAG 0x0002
#define | I2S_ACS_FLAG 0x0004
#define | I2S_TUERR_FLAG 0x0008
#define | SPI_CCERR_FLAG 0x0010
#define | SPI_MMERR_FLAG 0x0020
#define | SPI_I2S_ROERR_FLAG 0x0040
#define | SPI_I2S_BF_FLAG 0x0080

Detailed Description

spi i2s flag

Macro Definition Documentation

◆ I2S_ACS_FLAG

#define I2S_ACS_FLAG 0x0004

i2s audio channel state flag

Definition at line 54 of file at32f413_spi.h.

◆ I2S_TUERR_FLAG

#define I2S_TUERR_FLAG 0x0008

i2s transmitter underload error flag

Definition at line 55 of file at32f413_spi.h.

Referenced by spi_i2s_flag_clear(), and spi_i2s_interrupt_flag_get().

◆ SPI_CCERR_FLAG

#define SPI_CCERR_FLAG 0x0010

spi crc calculation error flag

Definition at line 56 of file at32f413_spi.h.

Referenced by main(), spi_i2s_flag_clear(), and spi_i2s_interrupt_flag_get().

◆ SPI_I2S_BF_FLAG

#define SPI_I2S_BF_FLAG 0x0080

spi or i2s busy flag

Definition at line 59 of file at32f413_spi.h.

Referenced by main(), spi_byte_write(), spi_bytes_read(), and spi_bytes_write().

◆ SPI_I2S_RDBF_FLAG

#define SPI_I2S_RDBF_FLAG 0x0001

spi or i2s receive data buffer full flag

Definition at line 52 of file at32f413_spi.h.

Referenced by main(), SPI1_IRQHandler(), SPI2_IRQHandler(), spi_byte_write(), spi_bytes_read(), spi_bytes_write(), spi_i2s_flag_clear(), and spi_i2s_interrupt_flag_get().

◆ SPI_I2S_ROERR_FLAG

#define SPI_I2S_ROERR_FLAG 0x0040

spi or i2s receiver overflow error flag

Definition at line 58 of file at32f413_spi.h.

Referenced by spi_i2s_flag_clear(), and spi_i2s_interrupt_flag_get().

◆ SPI_I2S_TDBE_FLAG

#define SPI_I2S_TDBE_FLAG 0x0002

spi or i2s transmit data buffer empty flag

Definition at line 53 of file at32f413_spi.h.

Referenced by main(), SPI1_IRQHandler(), SPI2_IRQHandler(), spi_bytes_read(), spi_bytes_write(), and spi_i2s_interrupt_flag_get().

◆ SPI_MMERR_FLAG

#define SPI_MMERR_FLAG 0x0020

spi master mode error flag

Definition at line 57 of file at32f413_spi.h.

Referenced by spi_i2s_flag_clear(), and spi_i2s_interrupt_flag_get().


AT32F413 Firmwary Library: SPI_I2S_interrupts_definition

Macros
SPI_I2S_interrupts_definition
AT32F413_periph_driver » SPI

spi i2s interrupt More...

Macros

#define | SPI_I2S_ERROR_INT 0x0020
#define | SPI_I2S_RDBF_INT 0x0040
#define | SPI_I2S_TDBE_INT 0x0080

Detailed Description

spi i2s interrupt

Macro Definition Documentation

◆ SPI_I2S_ERROR_INT

#define SPI_I2S_ERROR_INT 0x0020

error interrupt

Definition at line 71 of file at32f413_spi.h.

◆ SPI_I2S_RDBF_INT

#define SPI_I2S_RDBF_INT 0x0040

receive data buffer full interrupt

Definition at line 72 of file at32f413_spi.h.

Referenced by i2s_config(), main(), SPI1_IRQHandler(), spi_config(), and spi_config().

◆ SPI_I2S_TDBE_INT

#define SPI_I2S_TDBE_INT 0x0080

transmit data buffer empty interrupt

Definition at line 73 of file at32f413_spi.h.

Referenced by i2s_config(), main(), SPI1_IRQHandler(), SPI2_IRQHandler(), spi_config(), and spi_config().


AT32F413 Firmwary Library: SPI_exported_types

Data Structures | Enumerations
SPI_exported_types
AT32F413_periph_driver » SPI

Data Structures

struct | spi_init_type
spi init type More...
struct | i2s_init_type
i2s init type More...
struct | spi_type
type define spi register all More...

Enumerations

enum | spi_frame_bit_num_type { SPI_FRAME_8BIT = 0x00 , SPI_FRAME_16BIT = 0x01 }
spi frame bit num type More...
enum | spi_master_slave_mode_type { SPI_MODE_SLAVE = 0x00 , SPI_MODE_MASTER = 0x01 }
spi master/slave mode type More...
enum | spi_clock_polarity_type { SPI_CLOCK_POLARITY_LOW = 0x00 , SPI_CLOCK_POLARITY_HIGH = 0x01 }
spi clock polarity (clkpol) type More...
enum | spi_clock_phase_type { SPI_CLOCK_PHASE_1EDGE = 0x00 , SPI_CLOCK_PHASE_2EDGE = 0x01 }
spi clock phase (clkpha) type More...
enum | spi_cs_mode_type { SPI_CS_HARDWARE_MODE = 0x00 , SPI_CS_SOFTWARE_MODE = 0x01 }
spi cs mode type More...
enum spi_mclk_freq_div_type {
SPI_MCLK_DIV_2 = 0x00 , SPI_MCLK_DIV_4 = 0x01 , SPI_MCLK_DIV_8 = 0x02 , SPI_MCLK_DIV_16 = 0x03 ,
SPI_MCLK_DIV_32 = 0x04 , SPI_MCLK_DIV_64 = 0x05 , SPI_MCLK_DIV_128 = 0x06 , SPI_MCLK_DIV_256 = 0x07 ,
SPI_MCLK_DIV_512 = 0x08 , SPI_MCLK_DIV_1024 = 0x09
}
spi master clock frequency division type More...
enum | spi_first_bit_type { SPI_FIRST_BIT_MSB = 0x00 , SPI_FIRST_BIT_LSB = 0x01 }
spi transmit first bit (lsb/msb) type More...
enum | spi_transmission_mode_type { SPI_TRANSMIT_FULL_DUPLEX = 0x00 , SPI_TRANSMIT_SIMPLEX_RX = 0x01 , SPI_TRANSMIT_HALF_DUPLEX_RX = 0x02 , SPI_TRANSMIT_HALF_DUPLEX_TX = 0x03 }
spi transmission mode type More...
enum | spi_crc_direction_type { SPI_CRC_RX = 0x0014 , SPI_CRC_TX = 0x0018 }
spi crc direction type More...
enum | spi_half_duplex_direction_type { SPI_HALF_DUPLEX_DIRECTION_RX = 0x00 , SPI_HALF_DUPLEX_DIRECTION_TX = 0x01 }
spi single line bidirectional direction type More...
enum | spi_software_cs_level_type { SPI_SWCS_INTERNAL_LEVEL_LOW = 0x00 , SPI_SWCS_INTERNAL_LEVEL_HIGHT = 0x01 }
spi software cs internal level type More...
enum i2s_audio_protocol_type {
I2S_AUDIO_PROTOCOL_PHILLIPS = 0x00 , I2S_AUDIO_PROTOCOL_MSB = 0x01 , I2S_AUDIO_PROTOCOL_LSB = 0x02 , I2S_AUDIO_PROTOCOL_PCM_SHORT = 0x03 ,
I2S_AUDIO_PROTOCOL_PCM_LONG = 0x04
}
i2s audio protocol type More...
enum i2s_audio_sampling_freq_type {
I2S_AUDIO_FREQUENCY_DEFAULT = 2 , I2S_AUDIO_FREQUENCY_8K = 8000 , I2S_AUDIO_FREQUENCY_11_025K = 11025 , I2S_AUDIO_FREQUENCY_16K = 16000 ,
I2S_AUDIO_FREQUENCY_22_05K = 22050 , I2S_AUDIO_FREQUENCY_32K = 32000 , I2S_AUDIO_FREQUENCY_44_1K = 44100 , I2S_AUDIO_FREQUENCY_48K = 48000 ,
I2S_AUDIO_FREQUENCY_96K = 96000 , I2S_AUDIO_FREQUENCY_192K = 192000
}
i2s audio frequency type More...
enum | i2s_data_channel_format_type { I2S_DATA_16BIT_CHANNEL_16BIT = 0x01 , I2S_DATA_16BIT_CHANNEL_32BIT = 0x02 , I2S_DATA_24BIT_CHANNEL_32BIT = 0x03 , I2S_DATA_32BIT_CHANNEL_32BIT = 0x04 }
i2s data bit num and channel bit num type More...
enum | i2s_operation_mode_type { I2S_MODE_SLAVE_TX = 0x00 , I2S_MODE_SLAVE_RX = 0x01 , I2S_MODE_MASTER_TX = 0x02 , I2S_MODE_MASTER_RX = 0x03 }
i2s operation mode type More...
enum | i2s_clock_polarity_type { I2S_CLOCK_POLARITY_LOW = 0x00 , I2S_CLOCK_POLARITY_HIGH = 0x01 }
i2s clock polarity type More...

Detailed Description

Enumeration Type Documentation

◆ i2s_audio_protocol_type

enum i2s_audio_protocol_type

i2s audio protocol type

Enumerator
I2S_AUDIO_PROTOCOL_PHILLIPS | i2s philip standard
I2S_AUDIO_PROTOCOL_MSB | msb-justified standard
I2S_AUDIO_PROTOCOL_LSB | lsb-justified standard
I2S_AUDIO_PROTOCOL_PCM_SHORT | pcm standard-short frame
I2S_AUDIO_PROTOCOL_PCM_LONG | pcm standard-long frame

Definition at line 195 of file at32f413_spi.h.

◆ i2s_audio_sampling_freq_type

enum i2s_audio_sampling_freq_type

i2s audio frequency type

Enumerator
I2S_AUDIO_FREQUENCY_DEFAULT | i2s audio sampling frequency default
I2S_AUDIO_FREQUENCY_8K | i2s audio sampling frequency 8k
I2S_AUDIO_FREQUENCY_11_025K | i2s audio sampling frequency 11.025k
I2S_AUDIO_FREQUENCY_16K | i2s audio sampling frequency 16k
I2S_AUDIO_FREQUENCY_22_05K | i2s audio sampling frequency 22.05k
I2S_AUDIO_FREQUENCY_32K | i2s audio sampling frequency 32k
I2S_AUDIO_FREQUENCY_44_1K | i2s audio sampling frequency 44.1k
I2S_AUDIO_FREQUENCY_48K | i2s audio sampling frequency 48k
I2S_AUDIO_FREQUENCY_96K | i2s audio sampling frequency 96k
I2S_AUDIO_FREQUENCY_192K | i2s audio sampling frequency 192k

Definition at line 207 of file at32f413_spi.h.

◆ i2s_clock_polarity_type

enum i2s_clock_polarity_type

i2s clock polarity type

Enumerator
I2S_CLOCK_POLARITY_LOW | i2s clock steady state is low level
I2S_CLOCK_POLARITY_HIGH | i2s clock steady state is high level

Definition at line 246 of file at32f413_spi.h.

◆ i2s_data_channel_format_type

enum i2s_data_channel_format_type

i2s data bit num and channel bit num type

Enumerator
I2S_DATA_16BIT_CHANNEL_16BIT | 16-bit data packed in 16-bit channel frame
I2S_DATA_16BIT_CHANNEL_32BIT | 16-bit data packed in 32-bit channel frame
I2S_DATA_24BIT_CHANNEL_32BIT | 24-bit data packed in 32-bit channel frame
I2S_DATA_32BIT_CHANNEL_32BIT | 32-bit data packed in 32-bit channel frame

Definition at line 224 of file at32f413_spi.h.

◆ i2s_operation_mode_type

enum i2s_operation_mode_type

i2s operation mode type

Enumerator
I2S_MODE_SLAVE_TX | slave transmission mode
I2S_MODE_SLAVE_RX | slave reception mode
I2S_MODE_MASTER_TX | master transmission mode
I2S_MODE_MASTER_RX | master reception mode

Definition at line 235 of file at32f413_spi.h.

◆ spi_clock_phase_type

enum spi_clock_phase_type

spi clock phase (clkpha) type

Enumerator
SPI_CLOCK_PHASE_1EDGE | data capture start from the first clock edge
SPI_CLOCK_PHASE_2EDGE | data capture start from the second clock edge

Definition at line 113 of file at32f413_spi.h.

◆ spi_clock_polarity_type

enum spi_clock_polarity_type

spi clock polarity (clkpol) type

Enumerator
SPI_CLOCK_POLARITY_LOW | sck keeps low at idle state
SPI_CLOCK_POLARITY_HIGH | sck keeps high at idle state

Definition at line 104 of file at32f413_spi.h.

◆ spi_crc_direction_type

enum spi_crc_direction_type

spi crc direction type

Enumerator
SPI_CRC_RX | crc direction is rx
SPI_CRC_TX | crc direction is tx

Definition at line 168 of file at32f413_spi.h.

◆ spi_cs_mode_type

enum spi_cs_mode_type

spi cs mode type

Enumerator
SPI_CS_HARDWARE_MODE | cs is hardware mode
SPI_CS_SOFTWARE_MODE | cs is software mode

Definition at line 122 of file at32f413_spi.h.

◆ spi_first_bit_type

enum spi_first_bit_type

spi transmit first bit (lsb/msb) type

Enumerator
SPI_FIRST_BIT_MSB | the frame format is msb first
SPI_FIRST_BIT_LSB | the frame format is lsb first

Definition at line 148 of file at32f413_spi.h.

◆ spi_frame_bit_num_type

enum spi_frame_bit_num_type

spi frame bit num type

Enumerator
SPI_FRAME_8BIT | 8-bit data frame format
SPI_FRAME_16BIT | 16-bit data frame format

Definition at line 86 of file at32f413_spi.h.

◆ spi_half_duplex_direction_type

enum spi_half_duplex_direction_type

spi single line bidirectional direction type

Enumerator
SPI_HALF_DUPLEX_DIRECTION_RX | single line bidirectional half duplex mode direction: receive(slbtd = 0)
SPI_HALF_DUPLEX_DIRECTION_TX | single line bidirectional half duplex mode direction: transmit(slbtd = 1)

Definition at line 177 of file at32f413_spi.h.

◆ spi_master_slave_mode_type

enum spi_master_slave_mode_type

spi master/slave mode type

Enumerator
SPI_MODE_SLAVE | select as slave mode
SPI_MODE_MASTER | select as master mode

Definition at line 95 of file at32f413_spi.h.

◆ spi_mclk_freq_div_type

enum spi_mclk_freq_div_type

spi master clock frequency division type

Enumerator
SPI_MCLK_DIV_2 | master clock frequency division 2
SPI_MCLK_DIV_4 | master clock frequency division 4
SPI_MCLK_DIV_8 | master clock frequency division 8
SPI_MCLK_DIV_16 | master clock frequency division 16
SPI_MCLK_DIV_32 | master clock frequency division 32
SPI_MCLK_DIV_64 | master clock frequency division 64
SPI_MCLK_DIV_128 | master clock frequency division 128
SPI_MCLK_DIV_256 | master clock frequency division 256
SPI_MCLK_DIV_512 | master clock frequency division 512
SPI_MCLK_DIV_1024 | master clock frequency division 1024

Definition at line 131 of file at32f413_spi.h.

◆ spi_software_cs_level_type

enum spi_software_cs_level_type

spi software cs internal level type

Enumerator
SPI_SWCS_INTERNAL_LEVEL_LOW | internal level low
SPI_SWCS_INTERNAL_LEVEL_HIGHT | internal level high

Definition at line 186 of file at32f413_spi.h.

◆ spi_transmission_mode_type

enum spi_transmission_mode_type

spi transmission mode type

Enumerator
SPI_TRANSMIT_FULL_DUPLEX | dual line unidirectional full-duplex mode(slben = 0 and ora = 0)
SPI_TRANSMIT_SIMPLEX_RX | dual line unidirectional simplex receive-only mode(slben = 0 and ora = 1)
SPI_TRANSMIT_HALF_DUPLEX_RX | single line bidirectional half duplex mode-receiving(slben = 1 and slbtd = 0)
SPI_TRANSMIT_HALF_DUPLEX_TX | single line bidirectional half duplex mode-transmitting(slben = 1 and slbtd = 1)

Definition at line 157 of file at32f413_spi.h.


AT32F413 Firmwary Library: spi_init_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
spi_init_type Struct Reference
AT32F413_periph_driver » SPI » SPI_exported_types

spi init type More...

#include <at32f413_spi.h>

Data Fields

spi_transmission_mode_type transmission_mode
spi_master_slave_mode_type master_slave_mode
spi_mclk_freq_div_type mclk_freq_division
spi_first_bit_type first_bit_transmission
spi_frame_bit_num_type frame_bit_num
spi_clock_polarity_type clock_polarity
spi_clock_phase_type clock_phase
spi_cs_mode_type cs_mode_selection

Detailed Description

spi init type

Definition at line 255 of file at32f413_spi.h.

Field Documentation

◆ clock_phase

spi_clock_phase_type spi_init_type::clock_phase

clock phase selection

Definition at line 263 of file at32f413_spi.h.

Referenced by spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_default_para_init(), spi_init(), spiflash_init(), and usart_spi_configuration().

◆ clock_polarity

spi_clock_polarity_type spi_init_type::clock_polarity

clock polarity selection

Definition at line 262 of file at32f413_spi.h.

Referenced by spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_default_para_init(), spi_init(), spiflash_init(), and usart_spi_configuration().

◆ cs_mode_selection

spi_cs_mode_type spi_init_type::cs_mode_selection

hardware or software cs mode selection

Definition at line 264 of file at32f413_spi.h.

Referenced by main(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_default_para_init(), spi_init(), spiflash_init(), and usart_spi_configuration().

◆ first_bit_transmission

spi_first_bit_type spi_init_type::first_bit_transmission

transmit lsb or msb selection

Definition at line 260 of file at32f413_spi.h.

Referenced by spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_default_para_init(), spi_init(), spiflash_init(), and usart_spi_configuration().

◆ frame_bit_num

spi_frame_bit_num_type spi_init_type::frame_bit_num

frame bit num 8 or 16 bit selection

Definition at line 261 of file at32f413_spi.h.

Referenced by spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_default_para_init(), spi_init(), spiflash_init(), and usart_spi_configuration().

◆ master_slave_mode

spi_master_slave_mode_type spi_init_type::master_slave_mode

master or slave mode selection

Definition at line 258 of file at32f413_spi.h.

Referenced by main(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_default_para_init(), spi_init(), spiflash_init(), and usart_spi_configuration().

◆ mclk_freq_division

spi_mclk_freq_div_type spi_init_type::mclk_freq_division

master clock frequency division selection

Definition at line 259 of file at32f413_spi.h.

Referenced by spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_default_para_init(), spi_init(), and spiflash_init().

◆ transmission_mode

spi_transmission_mode_type spi_init_type::transmission_mode

transmission mode selection

Definition at line 257 of file at32f413_spi.h.

Referenced by main(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_default_para_init(), spi_init(), spiflash_init(), and usart_spi_configuration().

The documentation for this struct was generated from the following file:
  • at32f413_spi.h


AT32F413 Firmwary Library: i2s_init_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
i2s_init_type Struct Reference
AT32F413_periph_driver » SPI » SPI_exported_types

i2s init type More...

#include <at32f413_spi.h>

Data Fields

i2s_operation_mode_type operation_mode
i2s_audio_protocol_type audio_protocol
i2s_audio_sampling_freq_type audio_sampling_freq
i2s_data_channel_format_type data_channel_format
i2s_clock_polarity_type clock_polarity
confirm_state mclk_output_enable

Detailed Description

i2s init type

Definition at line 270 of file at32f413_spi.h.

Field Documentation

◆ audio_protocol

i2s_audio_protocol_type i2s_init_type::audio_protocol

audio protocol selection

Definition at line 273 of file at32f413_spi.h.

Referenced by codec_i2s_init(), i2s_config(), i2s_config(), i2s_config(), i2s_default_para_init(), and i2s_init().

◆ audio_sampling_freq

i2s_audio_sampling_freq_type i2s_init_type::audio_sampling_freq

audio frequency selection

Definition at line 274 of file at32f413_spi.h.

Referenced by codec_i2s_init(), i2s_config(), i2s_config(), i2s_config(), i2s_default_para_init(), and i2s_init().

◆ clock_polarity

i2s_clock_polarity_type i2s_init_type::clock_polarity

clock polarity selection

Definition at line 276 of file at32f413_spi.h.

Referenced by codec_i2s_init(), i2s_config(), i2s_config(), i2s_config(), i2s_default_para_init(), and i2s_init().

◆ data_channel_format

i2s_data_channel_format_type i2s_init_type::data_channel_format

data bit num and channel bit num selection

Definition at line 275 of file at32f413_spi.h.

Referenced by codec_i2s_init(), i2s_config(), i2s_config(), i2s_config(), i2s_default_para_init(), and i2s_init().

◆ mclk_output_enable

confirm_state i2s_init_type::mclk_output_enable

mclk_output selection

Definition at line 277 of file at32f413_spi.h.

Referenced by codec_i2s_init(), i2s_config(), i2s_config(), i2s_config(), i2s_default_para_init(), and i2s_init().

◆ operation_mode

i2s_operation_mode_type i2s_init_type::operation_mode

operation mode selection

Definition at line 272 of file at32f413_spi.h.

Referenced by codec_i2s_init(), i2s_config(), i2s_config(), i2s_config(), i2s_default_para_init(), and i2s_init().

The documentation for this struct was generated from the following file:
  • at32f413_spi.h


AT32F413 Firmwary Library: spi_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
spi_type Struct Reference
AT32F413_periph_driver » SPI » SPI_exported_types

type define spi register all More...

#include <at32f413_spi.h>

Data Fields

union {
__IO uint32_t ctrl1
struct {
__IO uint32_t clkpha: 1
__IO uint32_t clkpol: 1
__IO uint32_t msten: 1
__IO uint32_t mdiv_l: 3
__IO uint32_t spien: 1
__IO uint32_t ltf: 1
__IO uint32_t swcsil: 1
__IO uint32_t swcsen: 1
__IO uint32_t ora: 1
__IO uint32_t fbn: 1
__IO uint32_t ntc: 1
__IO uint32_t ccen: 1
__IO uint32_t slbtd: 1
__IO uint32_t slben: 1
__IO uint32_t reserved1: 16
} ctrl1_bit
};
spi ctrl1 register, offset:0x00
union {
__IO uint32_t ctrl2
struct {
__IO uint32_t dmaren: 1
__IO uint32_t dmaten: 1
__IO uint32_t hwcsoe: 1
__IO uint32_t reserved1: 2
__IO uint32_t errie: 1
__IO uint32_t rdbfie: 1
__IO uint32_t tdbeie: 1
__IO uint32_t mdiv_h: 1
__IO uint32_t reserved2: 23
} ctrl2_bit
};
spi ctrl2 register, offset:0x04
union {
__IO uint32_t sts
struct {
__IO uint32_t rdbf: 1
__IO uint32_t tdbe: 1
__IO uint32_t acs: 1
__IO uint32_t tuerr: 1
__IO uint32_t ccerr: 1
__IO uint32_t mmerr: 1
__IO uint32_t roerr: 1
__IO uint32_t bf: 1
__IO uint32_t reserved1: 24
} sts_bit
};
spi sts register, offset:0x08
union {
__IO uint32_t dt
struct {
__IO uint32_t dt: 16
__IO uint32_t reserved1: 16
} dt_bit
};
spi dt register, offset:0x0C
union {
__IO uint32_t cpoly
struct {
__IO uint32_t cpoly: 16
__IO uint32_t reserved1: 16
} cpoly_bit
};
spi cpoly register, offset:0x10
union {
__IO uint32_t rcrc
struct {
__IO uint32_t rcrc: 16
__IO uint32_t reserved1: 16
} rcrc_bit
};
spi rcrc register, offset:0x14
union {
__IO uint32_t tcrc
struct {
__IO uint32_t tcrc: 16
__IO uint32_t reserved1: 16
} tcrc_bit
};
spi tcrc register, offset:0x18
union {
__IO uint32_t i2sctrl
struct {
__IO uint32_t i2scbn: 1
__IO uint32_t i2sdbn: 2
__IO uint32_t i2sclkpol: 1
__IO uint32_t stdsel: 2
__IO uint32_t reserved1: 1
__IO uint32_t pcmfssel: 1
__IO uint32_t opersel: 2
__IO uint32_t i2sen: 1
__IO uint32_t i2smsel: 1
__IO uint32_t reserved2: 20
} i2sctrl_bit
};
spi i2sctrl register, offset:0x1C
union {
__IO uint32_t i2sclk
struct {
__IO uint32_t i2sdiv_l: 8
__IO uint32_t i2sodd: 1
__IO uint32_t i2smclkoe: 1
__IO uint32_t i2sdiv_h: 2
__IO uint32_t reserved1: 20
} i2sclk_bit
};
spi i2sclk register, offset:0x20

Detailed Description

type define spi register all

Definition at line 283 of file at32f413_spi.h.

Field Documentation

◆ [union]

union { ... } spi_type

spi ctrl1 register, offset:0x00

◆ [union]

union { ... } spi_type

spi ctrl2 register, offset:0x04

◆ [union]

union { ... } spi_type

spi sts register, offset:0x08

◆ [union]

union { ... } spi_type

spi dt register, offset:0x0C

◆ [union]

union { ... } spi_type

spi cpoly register, offset:0x10

◆ [union]

union { ... } spi_type

spi rcrc register, offset:0x14

◆ [union]

union { ... } spi_type

spi tcrc register, offset:0x18

◆ [union]

union { ... } spi_type

spi i2sctrl register, offset:0x1C

◆ [union]

union { ... } spi_type

spi i2sclk register, offset:0x20

◆ acs

__IO uint32_t spi_type::acs

Definition at line 342 of file at32f413_spi.h.

◆ bf

__IO uint32_t spi_type::bf

Definition at line 347 of file at32f413_spi.h.

◆ ccen

__IO uint32_t spi_type::ccen

Definition at line 305 of file at32f413_spi.h.

Referenced by spi_crc_enable().

◆ ccerr

__IO uint32_t spi_type::ccerr

Definition at line 344 of file at32f413_spi.h.

Referenced by spi_i2s_interrupt_flag_get().

◆ clkpha

__IO uint32_t spi_type::clkpha

Definition at line 294 of file at32f413_spi.h.

Referenced by spi_init().

◆ clkpol

__IO uint32_t spi_type::clkpol

Definition at line 295 of file at32f413_spi.h.

Referenced by spi_init().

◆ cpoly

__IO uint32_t spi_type::cpoly

Definition at line 370 of file at32f413_spi.h.

Referenced by spi_crc_polynomial_get(), and spi_crc_polynomial_set().

◆ [struct]

struct { ... } spi_type::cpoly_bit

Referenced by spi_crc_polynomial_get(), and spi_crc_polynomial_set().

◆ ctrl1

__IO uint32_t spi_type::ctrl1

Definition at line 291 of file at32f413_spi.h.

Referenced by spi_i2s_flag_clear().

◆ [struct]

struct { ... } spi_type::ctrl1_bit

Referenced by spi_crc_enable(), spi_crc_next_transmit(), spi_enable(), spi_frame_bit_num_set(), spi_half_duplex_direction_set(), spi_init(), and spi_software_cs_internal_level_set().

◆ ctrl2

__IO uint32_t spi_type::ctrl2

Definition at line 317 of file at32f413_spi.h.

Referenced by spi_i2s_interrupt_enable().

◆ [struct]

struct { ... } spi_type::ctrl2_bit

Referenced by spi_hardware_cs_output_enable(), spi_i2s_dma_receiver_enable(), spi_i2s_dma_transmitter_enable(), spi_i2s_interrupt_flag_get(), and spi_init().

◆ dmaren

__IO uint32_t spi_type::dmaren

Definition at line 320 of file at32f413_spi.h.

Referenced by spi_i2s_dma_receiver_enable().

◆ dmaten

__IO uint32_t spi_type::dmaten

Definition at line 321 of file at32f413_spi.h.

Referenced by spi_i2s_dma_transmitter_enable().

◆ dt

__IO uint32_t spi_type::dt

Definition at line 357 of file at32f413_spi.h.

Referenced by spi_i2s_data_receive(), spi_i2s_data_transmit(), and spi_i2s_flag_clear().

◆ [struct]

struct { ... } spi_type::dt_bit

◆ errie

__IO uint32_t spi_type::errie

Definition at line 324 of file at32f413_spi.h.

Referenced by spi_i2s_interrupt_flag_get().

◆ fbn

__IO uint32_t spi_type::fbn

Definition at line 303 of file at32f413_spi.h.

Referenced by spi_frame_bit_num_set(), and spi_init().

◆ hwcsoe

__IO uint32_t spi_type::hwcsoe

Definition at line 322 of file at32f413_spi.h.

Referenced by spi_hardware_cs_output_enable().

◆ i2scbn

__IO uint32_t spi_type::i2scbn

Definition at line 412 of file at32f413_spi.h.

Referenced by i2s_init().

◆ i2sclk

__IO uint32_t spi_type::i2sclk

Definition at line 430 of file at32f413_spi.h.

◆ [struct]

struct { ... } spi_type::i2sclk_bit

Referenced by i2s_init().

◆ i2sclkpol

__IO uint32_t spi_type::i2sclkpol

Definition at line 414 of file at32f413_spi.h.

Referenced by i2s_init().

◆ i2sctrl

__IO uint32_t spi_type::i2sctrl

Definition at line 409 of file at32f413_spi.h.

◆ [struct]

struct { ... } spi_type::i2sctrl_bit

Referenced by i2s_enable(), i2s_init(), and spi_init().

◆ i2sdbn

__IO uint32_t spi_type::i2sdbn

Definition at line 413 of file at32f413_spi.h.

Referenced by i2s_init().

◆ i2sdiv_h

__IO uint32_t spi_type::i2sdiv_h

Definition at line 436 of file at32f413_spi.h.

Referenced by i2s_init().

◆ i2sdiv_l

__IO uint32_t spi_type::i2sdiv_l

Definition at line 433 of file at32f413_spi.h.

Referenced by i2s_init().

◆ i2sen

__IO uint32_t spi_type::i2sen

Definition at line 419 of file at32f413_spi.h.

Referenced by i2s_enable().

◆ i2smclkoe

__IO uint32_t spi_type::i2smclkoe

Definition at line 435 of file at32f413_spi.h.

Referenced by i2s_init().

◆ i2smsel

__IO uint32_t spi_type::i2smsel

Definition at line 420 of file at32f413_spi.h.

Referenced by i2s_init(), and spi_init().

◆ i2sodd

__IO uint32_t spi_type::i2sodd

Definition at line 434 of file at32f413_spi.h.

Referenced by i2s_init().

◆ ltf

__IO uint32_t spi_type::ltf

Definition at line 299 of file at32f413_spi.h.

Referenced by spi_init().

◆ mdiv_h

__IO uint32_t spi_type::mdiv_h

Definition at line 327 of file at32f413_spi.h.

Referenced by spi_init().

◆ mdiv_l

__IO uint32_t spi_type::mdiv_l

Definition at line 297 of file at32f413_spi.h.

Referenced by spi_init().

◆ mmerr

__IO uint32_t spi_type::mmerr

Definition at line 345 of file at32f413_spi.h.

Referenced by spi_i2s_interrupt_flag_get().

◆ msten

__IO uint32_t spi_type::msten

Definition at line 296 of file at32f413_spi.h.

Referenced by spi_init().

◆ ntc

__IO uint32_t spi_type::ntc

Definition at line 304 of file at32f413_spi.h.

Referenced by spi_crc_next_transmit().

◆ opersel

__IO uint32_t spi_type::opersel

Definition at line 418 of file at32f413_spi.h.

Referenced by i2s_init().

◆ ora

__IO uint32_t spi_type::ora

Definition at line 302 of file at32f413_spi.h.

Referenced by spi_init().

◆ pcmfssel

__IO uint32_t spi_type::pcmfssel

Definition at line 417 of file at32f413_spi.h.

Referenced by i2s_init().

◆ rcrc

__IO uint32_t spi_type::rcrc

Definition at line 383 of file at32f413_spi.h.

Referenced by spi_crc_value_get().

◆ [struct]

struct { ... } spi_type::rcrc_bit

Referenced by spi_crc_value_get().

◆ rdbf

__IO uint32_t spi_type::rdbf

Definition at line 340 of file at32f413_spi.h.

Referenced by spi_i2s_interrupt_flag_get().

◆ rdbfie

__IO uint32_t spi_type::rdbfie

Definition at line 325 of file at32f413_spi.h.

Referenced by spi_i2s_interrupt_flag_get().

◆ reserved1

__IO uint32_t spi_type::reserved1

Definition at line 308 of file at32f413_spi.h.

◆ reserved2

__IO uint32_t spi_type::reserved2

Definition at line 328 of file at32f413_spi.h.

◆ roerr

__IO uint32_t spi_type::roerr

Definition at line 346 of file at32f413_spi.h.

Referenced by spi_i2s_interrupt_flag_get().

◆ slben

__IO uint32_t spi_type::slben

Definition at line 307 of file at32f413_spi.h.

Referenced by spi_init().

◆ slbtd

__IO uint32_t spi_type::slbtd

Definition at line 306 of file at32f413_spi.h.

Referenced by spi_half_duplex_direction_set(), and spi_init().

◆ spien

__IO uint32_t spi_type::spien

Definition at line 298 of file at32f413_spi.h.

Referenced by spi_enable().

◆ stdsel

__IO uint32_t spi_type::stdsel

Definition at line 415 of file at32f413_spi.h.

Referenced by i2s_init().

◆ sts

__IO uint32_t spi_type::sts

Definition at line 337 of file at32f413_spi.h.

Referenced by spi_i2s_flag_clear(), and spi_i2s_flag_get().

◆ [struct]

struct { ... } spi_type::sts_bit

Referenced by spi_i2s_interrupt_flag_get().

◆ swcsen

__IO uint32_t spi_type::swcsen

Definition at line 301 of file at32f413_spi.h.

Referenced by spi_init().

◆ swcsil

__IO uint32_t spi_type::swcsil

Definition at line 300 of file at32f413_spi.h.

Referenced by spi_init(), and spi_software_cs_internal_level_set().

◆ tcrc

__IO uint32_t spi_type::tcrc

Definition at line 396 of file at32f413_spi.h.

Referenced by spi_crc_value_get().

◆ [struct]

struct { ... } spi_type::tcrc_bit

Referenced by spi_crc_value_get().

◆ tdbe

__IO uint32_t spi_type::tdbe

Definition at line 341 of file at32f413_spi.h.

Referenced by spi_i2s_interrupt_flag_get().

◆ tdbeie

__IO uint32_t spi_type::tdbeie

Definition at line 326 of file at32f413_spi.h.

Referenced by spi_i2s_interrupt_flag_get().

◆ tuerr

__IO uint32_t spi_type::tuerr

Definition at line 343 of file at32f413_spi.h.

Referenced by spi_i2s_interrupt_flag_get().

The documentation for this struct was generated from the following file:
  • at32f413_spi.h


AT32F413 Firmwary Library: SPI_exported_functions

Functions
SPI_exported_functions
AT32F413_periph_driver » SPI

Functions

void | spi_i2s_reset (spi_type *spi_x)
spi reset by crm reset register
void | spi_default_para_init (spi_init_type *spi_init_struct)
spi init config with its default value.
void | spi_init (spi_type *spi_x, spi_init_type *spi_init_struct)
spi init config with its setting value.
void | spi_crc_next_transmit (spi_type *spi_x)
spi next transmit crc for the spi peripheral.
void | spi_crc_polynomial_set (spi_type *spi_x, uint16_t crc_poly)
set the crc polynomial value for the spi peripheral.
uint16_t | spi_crc_polynomial_get (spi_type *spi_x)
return the crc polynomial register value for the spi peripheral.
void | spi_crc_enable (spi_type *spi_x, confirm_state new_state)
enable or disable the hardware crc calculation for the spi peripheral.
uint16_t | spi_crc_value_get (spi_type *spi_x, spi_crc_direction_type crc_direction)
return the transmit or the receive crc value for the spi peripheral.
void | spi_hardware_cs_output_enable (spi_type *spi_x, confirm_state new_state)
enable or disable the hardware cs output for the spi peripheral.
void | spi_software_cs_internal_level_set (spi_type *spi_x, spi_software_cs_level_type level)
set the software cs internal level for the spi peripheral.
void | spi_frame_bit_num_set (spi_type *spi_x, spi_frame_bit_num_type bit_num)
set the data frame bit num for the spi peripheral.
void | spi_half_duplex_direction_set (spi_type *spi_x, spi_half_duplex_direction_type direction)
set the data transmission direction in single line bidirectiona half duplex mode of the spi peripheral.
void | spi_enable (spi_type *spi_x, confirm_state new_state)
enable or disable spi.
void | i2s_default_para_init (i2s_init_type *i2s_init_struct)
i2s init config with its default value.
void | i2s_init (spi_type *spi_x, i2s_init_type *i2s_init_struct)
i2s init config with its setting value.
void | i2s_enable (spi_type *spi_x, confirm_state new_state)
enable or disable i2s.
void | spi_i2s_interrupt_enable (spi_type *spi_x, uint32_t spi_i2s_int, confirm_state new_state)
enable or disable the specified spi/i2s interrupts.
void | spi_i2s_dma_transmitter_enable (spi_type *spi_x, confirm_state new_state)
enable or disable the spi/i2s dma transmitter mode.
void | spi_i2s_dma_receiver_enable (spi_type *spi_x, confirm_state new_state)
enable or disable the spi/i2s dma receiver mode.
void | spi_i2s_data_transmit (spi_type *spi_x, uint16_t tx_data)
spi/i2s data transmit
uint16_t | spi_i2s_data_receive (spi_type *spi_x)
spi/i2s data receive
flag_status | spi_i2s_flag_get (spi_type *spi_x, uint32_t spi_i2s_flag)
get flag of the specified spi/i2s peripheral.
flag_status | spi_i2s_interrupt_flag_get (spi_type *spi_x, uint32_t spi_i2s_flag)
get interrupt flag of the specified spi/i2s peripheral.
void | spi_i2s_flag_clear (spi_type *spi_x, uint32_t spi_i2s_flag)
clear flag of the specified spi/i2s peripheral.

Detailed Description

Function Documentation

◆ i2s_default_para_init()

void i2s_default_para_init ( i2s_init_type * i2s_init_struct )

i2s init config with its default value.

Parameters
i2s_init_struct : pointer to a i2s_init_type structure which will be initialized.
Return values
none

Definition at line 297 of file at32f413_spi.c.

Referenced by codec_i2s_init(), i2s_config(), i2s_config(), and i2s_config().

◆ i2s_enable()

void i2s_enable | ( | spi_type * | spi_x,
 |  | confirm_state | new_state )

enable or disable i2s.

Parameters
spi_x | select the i2s peripheral. this parameter can be one of the following values: SPI1, SPI2
new_state | new state of i2s. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 444 of file at32f413_spi.c.

Referenced by codec_i2s_init(), codec_i2s_reset(), i2s_config(), and main().

◆ i2s_init()

void i2s_init | ( | spi_type * | spi_x,
 |  | i2s_init_type * | i2s_init_struct )

i2s init config with its setting value.

Parameters
spi_x | select the spi peripheral. this parameter can be one of the following values: SPI1, SPI2
i2s_init_struct | : pointer to a i2s_init_type structure which will be initialized.
Return values
none

Definition at line 315 of file at32f413_spi.c.

Referenced by codec_i2s_init(), i2s_config(), i2s_config(), and i2s_config().

◆ spi_crc_enable()

void spi_crc_enable | ( | spi_type * | spi_x,
 |  | confirm_state | new_state )

enable or disable the hardware crc calculation for the spi peripheral.

Parameters
spi_x | select the spi peripheral. this parameter can be one of the following values: SPI1, SPI2
new_state | new state of crc calculation. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 190 of file at32f413_spi.c.

Referenced by spi_config().

◆ spi_crc_next_transmit()

void spi_crc_next_transmit ( spi_type * spi_x )

spi next transmit crc for the spi peripheral.

Parameters
spi_x select the spi peripheral. this parameter can be one of the following values: SPI1, SPI2
Return values
none

Definition at line 151 of file at32f413_spi.c.

Referenced by main().

◆ spi_crc_polynomial_get()

uint16_t spi_crc_polynomial_get ( spi_type * spi_x )

return the crc polynomial register value for the spi peripheral.

Parameters
spi_x select the spi peripheral. this parameter can be one of the following values: SPI1, SPI2
Return values
the select crc polynomial register value

Definition at line 176 of file at32f413_spi.c.

◆ spi_crc_polynomial_set()

void spi_crc_polynomial_set | ( | spi_type * | spi_x,
 |  | uint16_t | crc_poly )

set the crc polynomial value for the spi peripheral.

Parameters
spi_x | select the spi peripheral. this parameter can be one of the following values: SPI1, SPI2
crc_poly | crc polynomial value.
Return values
none

Definition at line 164 of file at32f413_spi.c.

Referenced by spi_config().

◆ spi_crc_value_get()

uint16_t spi_crc_value_get | ( | spi_type * | spi_x,
 |  | spi_crc_direction_type | crc_direction )

return the transmit or the receive crc value for the spi peripheral.

Parameters
spi_x select the spi peripheral. this parameter can be one of the following values: SPI1, SPI2
crc_direction select transmit or receive crc value to be read
  • SPI_CRC_RX
  • SPI_CRC_TX
Return values
the select crc register value

Definition at line 205 of file at32f413_spi.c.

◆ spi_default_para_init()

void spi_default_para_init ( spi_init_type * spi_init_struct )

spi init config with its default value.

Parameters
spi_init_struct : pointer to a spi_init_type structure which will be initialized.
Return values
none

Definition at line 70 of file at32f413_spi.c.

Referenced by spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spiflash_init(), and usart_spi_configuration().

◆ spi_enable()

void spi_enable | ( | spi_type * | spi_x,
 |  | confirm_state | new_state )

enable or disable spi.

Parameters
spi_x | select the spi peripheral. this parameter can be one of the following values: SPI1, SPI2
new_state | new state of spi. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 286 of file at32f413_spi.c.

Referenced by main(), SPI1_IRQHandler(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spiflash_init(), and usart_spi_configuration().

◆ spi_frame_bit_num_set()

void spi_frame_bit_num_set | ( | spi_type * | spi_x,
 |  | spi_frame_bit_num_type | bit_num )

set the data frame bit num for the spi peripheral.

Parameters
spi_x select the spi peripheral. this parameter can be one of the following values: SPI1, SPI2
bit_num set the data frame size
  • SPI_FRAME_8BIT
  • SPI_FRAME_16BIT
Return values
none

Definition at line 256 of file at32f413_spi.c.

◆ spi_half_duplex_direction_set()

void spi_half_duplex_direction_set | ( | spi_type * | spi_x,
 |  | spi_half_duplex_direction_type | direction )

set the data transmission direction in single line bidirectiona half duplex mode of the spi peripheral.

Parameters
spi_x select the spi peripheral. this parameter can be one of the following values: SPI1, SPI2
direction data transfer direction this parameter can be one of the following values:
  • SPI_HALF_DUPLEX_DIRECTION_RX
  • SPI_HALF_DUPLEX_DIRECTION_TX
Return values
none

Definition at line 272 of file at32f413_spi.c.

◆ spi_hardware_cs_output_enable()

void spi_hardware_cs_output_enable | ( | spi_type * | spi_x,
 |  | confirm_state | new_state )

enable or disable the hardware cs output for the spi peripheral.

Parameters
spi_x | select the spi peripheral. this parameter can be one of the following values: SPI1, SPI2
new_state | new state of spi master cs output. this parameter can be: TRUE or FALSE. note:the bit only use in spi master mode
Return values
none

Definition at line 223 of file at32f413_spi.c.

◆ spi_i2s_data_receive()

uint16_t spi_i2s_data_receive ( spi_type * spi_x )

spi/i2s data receive

Parameters
spi_x select the spi/i2s peripheral. this parameter can be one of the following values: SPI1, SPI2
Return values
the received data value

Definition at line 525 of file at32f413_spi.c.

Referenced by main(), SPI1_IRQHandler(), SPI2_IRQHandler(), spi_byte_write(), spi_bytes_read(), and spi_bytes_write().

◆ spi_i2s_data_transmit()

void spi_i2s_data_transmit | ( | spi_type * | spi_x,
 |  | uint16_t | tx_data )

spi/i2s data transmit

Parameters
spi_x select the spi/i2s peripheral. this parameter can be one of the following values: SPI1, SPI2
tx_data the data to be transmit. this parameter can be:
  • (0x0000~0xFFFF)
Return values
none

Definition at line 513 of file at32f413_spi.c.

Referenced by main(), SPI1_IRQHandler(), SPI2_IRQHandler(), spi_byte_write(), spi_bytes_read(), and spi_bytes_write().

◆ spi_i2s_dma_receiver_enable()

void spi_i2s_dma_receiver_enable | ( | spi_type * | spi_x,
 |  | confirm_state | new_state )

enable or disable the spi/i2s dma receiver mode.

Parameters
spi_x | select the spi/i2s peripheral. this parameter can be one of the following values: SPI1, SPI2
new_state | new state of the dma request. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 498 of file at32f413_spi.c.

Referenced by codec_i2s_init(), i2s_config(), spi_byte_write(), spi_bytes_read(), spi_bytes_write(), spi_config(), and spi_config().

◆ spi_i2s_dma_transmitter_enable()

void spi_i2s_dma_transmitter_enable | ( | spi_type * | spi_x,
 |  | confirm_state | new_state )

enable or disable the spi/i2s dma transmitter mode.

Parameters
spi_x | select the spi/i2s peripheral. this parameter can be one of the following values: SPI1, SPI2
new_state | new state of the dma request. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 484 of file at32f413_spi.c.

Referenced by codec_i2s_init(), i2s_config(), spi_byte_write(), spi_bytes_read(), spi_bytes_write(), spi_config(), and spi_config().

◆ spi_i2s_flag_clear()

void spi_i2s_flag_clear | ( | spi_type * | spi_x,
 |  | uint32_t | spi_i2s_flag )

clear flag of the specified spi/i2s peripheral.

Parameters
spi_x select the spi/i2s peripheral. this parameter can be one of the following values: SPI1, SPI2
spi_i2s_flag select the spi/i2s flag this parameter can be one of the following values:
  • SPI_CCERR_FLAG
  • SPI_I2S_RDBF_FLAG
  • I2S_TUERR_FLAG
  • SPI_MMERR_FLAG
  • SPI_I2S_ROERR_FLAG
Note
SPI_I2S_TDBE_FLAG this flag is cleared when the tx buffer already contain data to be transmit. I2S_ACS_FLAG this flag cann't cleared by software,the flag indicate the channel side(not use in pcm standard mode). SPI_I2S_BF_FLAG this flag cann't cleared by software, it's set and cleared by hardware.
Return values
none

< spi crc calculation error flag

< spi crc calculation error flag

< spi or i2s receive data buffer full flag

< i2s transmitter underload error flag

< spi master mode error flag

< spi or i2s receiver overflow error flag

Definition at line 642 of file at32f413_spi.c.

Referenced by main().

◆ spi_i2s_flag_get()

flag_status spi_i2s_flag_get | ( | spi_type * | spi_x,
 |  | uint32_t | spi_i2s_flag )

get flag of the specified spi/i2s peripheral.

Parameters
spi_x select the spi/i2s peripheral. this parameter can be one of the following values: SPI1, SPI2
spi_i2s_flag select the spi/i2s flag this parameter can be one of the following values:
  • SPI_I2S_RDBF_FLAG
  • SPI_I2S_TDBE_FLAG
  • I2S_ACS_FLAG (this flag only use in i2s mode)
  • I2S_TUERR_FLAG (this flag only use in i2s mode)
  • SPI_CCERR_FLAG (this flag only use in spi mode)
  • SPI_MMERR_FLAG (this flag only use in spi mode)
  • SPI_I2S_ROERR_FLAG
  • SPI_I2S_BF_FLAG
Return values
the new state of spi/i2s flag

Definition at line 547 of file at32f413_spi.c.

Referenced by main(), spi_byte_write(), spi_bytes_read(), and spi_bytes_write().

◆ spi_i2s_interrupt_enable()

void spi_i2s_interrupt_enable | ( | spi_type * | spi_x,
 |  | uint32_t | spi_i2s_int,
 |  | confirm_state | new_state )

enable or disable the specified spi/i2s interrupts.

Parameters
spi_x | select the spi/i2s peripheral. this parameter can be one of the following values: SPI1, SPI2
spi_i2s_int specifies the spi/i2s interrupt sources to be enabled or disabled. this parameter can be one of the following values:
  • SPI_I2S_ERROR_INT
  • SPI_I2S_RDBF_INT
  • SPI_I2S_TDBE_INT
new_state | new state of the specified spi/i2s interrupts. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 463 of file at32f413_spi.c.

Referenced by i2s_config(), main(), SPI1_IRQHandler(), SPI2_IRQHandler(), spi_config(), and spi_config().

◆ spi_i2s_interrupt_flag_get()

flag_status spi_i2s_interrupt_flag_get | ( | spi_type * | spi_x,
 |  | uint32_t | spi_i2s_flag )

get interrupt flag of the specified spi/i2s peripheral.

Parameters
spi_x select the spi/i2s peripheral. this parameter can be one of the following values: SPI1, SPI2
spi_i2s_flag select the spi/i2s flag this parameter can be one of the following values:
  • SPI_I2S_RDBF_FLAG
  • SPI_I2S_TDBE_FLAG
  • I2S_TUERR_FLAG (this flag only use in i2s mode)
  • SPI_CCERR_FLAG (this flag only use in spi mode)
  • SPI_MMERR_FLAG (this flag only use in spi mode)
  • SPI_I2S_ROERR_FLAG
Return values
the new state of spi/i2s flag

< spi or i2s receive data buffer full flag

< spi or i2s transmit data buffer empty flag

< i2s transmitter underload error flag

< spi crc calculation error flag

< spi master mode error flag

< spi or i2s receiver overflow error flag

Definition at line 576 of file at32f413_spi.c.

Referenced by SPI1_IRQHandler(), and SPI2_IRQHandler().

◆ spi_i2s_reset()

void spi_i2s_reset ( spi_type * spi_x )

spi reset by crm reset register

Parameters
spi_x select the spi peripheral. this parameter can be one of the following values: SPI1, SPI2
Return values
none

Definition at line 50 of file at32f413_spi.c.

Referenced by codec_i2s_init(), i2s_config(), i2s_config(), and spi_config().

◆ spi_init()

void spi_init | ( | spi_type * | spi_x,
 |  | spi_init_type * | spi_init_struct )

spi init config with its setting value.

Parameters
spi_x | select the spi peripheral. this parameter can be one of the following values: SPI1, SPI2
spi_init_struct | : pointer to a spi_init_type structure which will be initialized.
Return values
none

Definition at line 90 of file at32f413_spi.c.

Referenced by main(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spiflash_init(), and usart_spi_configuration().

◆ spi_software_cs_internal_level_set()

void spi_software_cs_internal_level_set | ( | spi_type * | spi_x,
 |  | spi_software_cs_level_type | level )

set the software cs internal level for the spi peripheral.

Parameters
spi_x select the spi peripheral. this parameter can be one of the following values: SPI1, SPI2
level set the state of spi cs level. this parameter can be one of the following values:
  • SPI_SWCS_INTERNAL_LEVEL_LOW
  • SPI_SWCS_INTERNAL_LEVEL_HIGHT note:the bit only use when swcsen bit is set. note:when use this bit,io operation on the cs pin are invalid.
Return values
none

Definition at line 241 of file at32f413_spi.c.


AT32F413 Firmwary Library: SPI_private_functions

Functions
SPI_private_functions
AT32F413_periph_driver » SPI

Functions

void | spi_i2s_reset (spi_type *spi_x)
spi reset by crm reset register
void | spi_default_para_init (spi_init_type *spi_init_struct)
spi init config with its default value.
void | spi_init (spi_type *spi_x, spi_init_type *spi_init_struct)
spi init config with its setting value.
void | spi_crc_next_transmit (spi_type *spi_x)
spi next transmit crc for the spi peripheral.
void | spi_crc_polynomial_set (spi_type *spi_x, uint16_t crc_poly)
set the crc polynomial value for the spi peripheral.
uint16_t | spi_crc_polynomial_get (spi_type *spi_x)
return the crc polynomial register value for the spi peripheral.
void | spi_crc_enable (spi_type *spi_x, confirm_state new_state)
enable or disable the hardware crc calculation for the spi peripheral.
uint16_t | spi_crc_value_get (spi_type *spi_x, spi_crc_direction_type crc_direction)
return the transmit or the receive crc value for the spi peripheral.
void | spi_hardware_cs_output_enable (spi_type *spi_x, confirm_state new_state)
enable or disable the hardware cs output for the spi peripheral.
void | spi_software_cs_internal_level_set (spi_type *spi_x, spi_software_cs_level_type level)
set the software cs internal level for the spi peripheral.
void | spi_frame_bit_num_set (spi_type *spi_x, spi_frame_bit_num_type bit_num)
set the data frame bit num for the spi peripheral.
void | spi_half_duplex_direction_set (spi_type *spi_x, spi_half_duplex_direction_type direction)
set the data transmission direction in single line bidirectiona half duplex mode of the spi peripheral.
void | spi_enable (spi_type *spi_x, confirm_state new_state)
enable or disable spi.
void | i2s_default_para_init (i2s_init_type *i2s_init_struct)
i2s init config with its default value.
void | i2s_init (spi_type *spi_x, i2s_init_type *i2s_init_struct)
i2s init config with its setting value.
void | i2s_enable (spi_type *spi_x, confirm_state new_state)
enable or disable i2s.
void | spi_i2s_interrupt_enable (spi_type *spi_x, uint32_t spi_i2s_int, confirm_state new_state)
enable or disable the specified spi/i2s interrupts.
void | spi_i2s_dma_transmitter_enable (spi_type *spi_x, confirm_state new_state)
enable or disable the spi/i2s dma transmitter mode.
void | spi_i2s_dma_receiver_enable (spi_type *spi_x, confirm_state new_state)
enable or disable the spi/i2s dma receiver mode.
void | spi_i2s_data_transmit (spi_type *spi_x, uint16_t tx_data)
spi/i2s data transmit
uint16_t | spi_i2s_data_receive (spi_type *spi_x)
spi/i2s data receive
flag_status | spi_i2s_flag_get (spi_type *spi_x, uint32_t spi_i2s_flag)
get flag of the specified spi/i2s peripheral.
flag_status | spi_i2s_interrupt_flag_get (spi_type *spi_x, uint32_t spi_i2s_flag)
get interrupt flag of the specified spi/i2s peripheral.
void | spi_i2s_flag_clear (spi_type *spi_x, uint32_t spi_i2s_flag)
clear flag of the specified spi/i2s peripheral.

Detailed Description

Function Documentation

◆ i2s_default_para_init()

void i2s_default_para_init ( i2s_init_type * i2s_init_struct )

i2s init config with its default value.

Parameters
i2s_init_struct : pointer to a i2s_init_type structure which will be initialized.
Return values
none

Definition at line 297 of file at32f413_spi.c.

Referenced by codec_i2s_init(), i2s_config(), i2s_config(), and i2s_config().

◆ i2s_enable()

void i2s_enable | ( | spi_type * | spi_x,
 |  | confirm_state | new_state )

enable or disable i2s.

Parameters
spi_x | select the i2s peripheral. this parameter can be one of the following values: SPI1, SPI2
new_state | new state of i2s. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 444 of file at32f413_spi.c.

Referenced by codec_i2s_init(), codec_i2s_reset(), i2s_config(), and main().

◆ i2s_init()

void i2s_init | ( | spi_type * | spi_x,
 |  | i2s_init_type * | i2s_init_struct )

i2s init config with its setting value.

Parameters
spi_x | select the spi peripheral. this parameter can be one of the following values: SPI1, SPI2
i2s_init_struct | : pointer to a i2s_init_type structure which will be initialized.
Return values
none

Definition at line 315 of file at32f413_spi.c.

Referenced by codec_i2s_init(), i2s_config(), i2s_config(), and i2s_config().

◆ spi_crc_enable()

void spi_crc_enable | ( | spi_type * | spi_x,
 |  | confirm_state | new_state )

enable or disable the hardware crc calculation for the spi peripheral.

Parameters
spi_x | select the spi peripheral. this parameter can be one of the following values: SPI1, SPI2
new_state | new state of crc calculation. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 190 of file at32f413_spi.c.

Referenced by spi_config().

◆ spi_crc_next_transmit()

void spi_crc_next_transmit ( spi_type * spi_x )

spi next transmit crc for the spi peripheral.

Parameters
spi_x select the spi peripheral. this parameter can be one of the following values: SPI1, SPI2
Return values
none

Definition at line 151 of file at32f413_spi.c.

Referenced by main().

◆ spi_crc_polynomial_get()

uint16_t spi_crc_polynomial_get ( spi_type * spi_x )

return the crc polynomial register value for the spi peripheral.

Parameters
spi_x select the spi peripheral. this parameter can be one of the following values: SPI1, SPI2
Return values
the select crc polynomial register value

Definition at line 176 of file at32f413_spi.c.

◆ spi_crc_polynomial_set()

void spi_crc_polynomial_set | ( | spi_type * | spi_x,
 |  | uint16_t | crc_poly )

set the crc polynomial value for the spi peripheral.

Parameters
spi_x | select the spi peripheral. this parameter can be one of the following values: SPI1, SPI2
crc_poly | crc polynomial value.
Return values
none

Definition at line 164 of file at32f413_spi.c.

Referenced by spi_config().

◆ spi_crc_value_get()

uint16_t spi_crc_value_get | ( | spi_type * | spi_x,
 |  | spi_crc_direction_type | crc_direction )

return the transmit or the receive crc value for the spi peripheral.

Parameters
spi_x select the spi peripheral. this parameter can be one of the following values: SPI1, SPI2
crc_direction select transmit or receive crc value to be read
  • SPI_CRC_RX
  • SPI_CRC_TX
Return values
the select crc register value

Definition at line 205 of file at32f413_spi.c.

◆ spi_default_para_init()

void spi_default_para_init ( spi_init_type * spi_init_struct )

spi init config with its default value.

Parameters
spi_init_struct : pointer to a spi_init_type structure which will be initialized.
Return values
none

Definition at line 70 of file at32f413_spi.c.

Referenced by spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spiflash_init(), and usart_spi_configuration().

◆ spi_enable()

void spi_enable | ( | spi_type * | spi_x,
 |  | confirm_state | new_state )

enable or disable spi.

Parameters
spi_x | select the spi peripheral. this parameter can be one of the following values: SPI1, SPI2
new_state | new state of spi. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 286 of file at32f413_spi.c.

Referenced by main(), SPI1_IRQHandler(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spiflash_init(), and usart_spi_configuration().

◆ spi_frame_bit_num_set()

void spi_frame_bit_num_set | ( | spi_type * | spi_x,
 |  | spi_frame_bit_num_type | bit_num )

set the data frame bit num for the spi peripheral.

Parameters
spi_x select the spi peripheral. this parameter can be one of the following values: SPI1, SPI2
bit_num set the data frame size
  • SPI_FRAME_8BIT
  • SPI_FRAME_16BIT
Return values
none

Definition at line 256 of file at32f413_spi.c.

◆ spi_half_duplex_direction_set()

void spi_half_duplex_direction_set | ( | spi_type * | spi_x,
 |  | spi_half_duplex_direction_type | direction )

set the data transmission direction in single line bidirectiona half duplex mode of the spi peripheral.

Parameters
spi_x select the spi peripheral. this parameter can be one of the following values: SPI1, SPI2
direction data transfer direction this parameter can be one of the following values:
  • SPI_HALF_DUPLEX_DIRECTION_RX
  • SPI_HALF_DUPLEX_DIRECTION_TX
Return values
none

Definition at line 272 of file at32f413_spi.c.

◆ spi_hardware_cs_output_enable()

void spi_hardware_cs_output_enable | ( | spi_type * | spi_x,
 |  | confirm_state | new_state )

enable or disable the hardware cs output for the spi peripheral.

Parameters
spi_x | select the spi peripheral. this parameter can be one of the following values: SPI1, SPI2
new_state | new state of spi master cs output. this parameter can be: TRUE or FALSE. note:the bit only use in spi master mode
Return values
none

Definition at line 223 of file at32f413_spi.c.

◆ spi_i2s_data_receive()

uint16_t spi_i2s_data_receive ( spi_type * spi_x )

spi/i2s data receive

Parameters
spi_x select the spi/i2s peripheral. this parameter can be one of the following values: SPI1, SPI2
Return values
the received data value

Definition at line 525 of file at32f413_spi.c.

Referenced by main(), SPI1_IRQHandler(), SPI2_IRQHandler(), spi_byte_write(), spi_bytes_read(), and spi_bytes_write().

◆ spi_i2s_data_transmit()

void spi_i2s_data_transmit | ( | spi_type * | spi_x,
 |  | uint16_t | tx_data )

spi/i2s data transmit

Parameters
spi_x select the spi/i2s peripheral. this parameter can be one of the following values: SPI1, SPI2
tx_data the data to be transmit. this parameter can be:
  • (0x0000~0xFFFF)
Return values
none

Definition at line 513 of file at32f413_spi.c.

Referenced by main(), SPI1_IRQHandler(), SPI2_IRQHandler(), spi_byte_write(), spi_bytes_read(), and spi_bytes_write().

◆ spi_i2s_dma_receiver_enable()

void spi_i2s_dma_receiver_enable | ( | spi_type * | spi_x,
 |  | confirm_state | new_state )

enable or disable the spi/i2s dma receiver mode.

Parameters
spi_x | select the spi/i2s peripheral. this parameter can be one of the following values: SPI1, SPI2
new_state | new state of the dma request. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 498 of file at32f413_spi.c.

Referenced by codec_i2s_init(), i2s_config(), spi_byte_write(), spi_bytes_read(), spi_bytes_write(), spi_config(), and spi_config().

◆ spi_i2s_dma_transmitter_enable()

void spi_i2s_dma_transmitter_enable | ( | spi_type * | spi_x,
 |  | confirm_state | new_state )

enable or disable the spi/i2s dma transmitter mode.

Parameters
spi_x | select the spi/i2s peripheral. this parameter can be one of the following values: SPI1, SPI2
new_state | new state of the dma request. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 484 of file at32f413_spi.c.

Referenced by codec_i2s_init(), i2s_config(), spi_byte_write(), spi_bytes_read(), spi_bytes_write(), spi_config(), and spi_config().

◆ spi_i2s_flag_clear()

void spi_i2s_flag_clear | ( | spi_type * | spi_x,
 |  | uint32_t | spi_i2s_flag )

clear flag of the specified spi/i2s peripheral.

Parameters
spi_x select the spi/i2s peripheral. this parameter can be one of the following values: SPI1, SPI2
spi_i2s_flag select the spi/i2s flag this parameter can be one of the following values:
  • SPI_CCERR_FLAG
  • SPI_I2S_RDBF_FLAG
  • I2S_TUERR_FLAG
  • SPI_MMERR_FLAG
  • SPI_I2S_ROERR_FLAG
Note
SPI_I2S_TDBE_FLAG this flag is cleared when the tx buffer already contain data to be transmit. I2S_ACS_FLAG this flag cann't cleared by software,the flag indicate the channel side(not use in pcm standard mode). SPI_I2S_BF_FLAG this flag cann't cleared by software, it's set and cleared by hardware.
Return values
none

< spi crc calculation error flag

< spi crc calculation error flag

< spi or i2s receive data buffer full flag

< i2s transmitter underload error flag

< spi master mode error flag

< spi or i2s receiver overflow error flag

Definition at line 642 of file at32f413_spi.c.

Referenced by main().

◆ spi_i2s_flag_get()

flag_status spi_i2s_flag_get | ( | spi_type * | spi_x,
 |  | uint32_t | spi_i2s_flag )

get flag of the specified spi/i2s peripheral.

Parameters
spi_x select the spi/i2s peripheral. this parameter can be one of the following values: SPI1, SPI2
spi_i2s_flag select the spi/i2s flag this parameter can be one of the following values:
  • SPI_I2S_RDBF_FLAG
  • SPI_I2S_TDBE_FLAG
  • I2S_ACS_FLAG (this flag only use in i2s mode)
  • I2S_TUERR_FLAG (this flag only use in i2s mode)
  • SPI_CCERR_FLAG (this flag only use in spi mode)
  • SPI_MMERR_FLAG (this flag only use in spi mode)
  • SPI_I2S_ROERR_FLAG
  • SPI_I2S_BF_FLAG
Return values
the new state of spi/i2s flag

Definition at line 547 of file at32f413_spi.c.

Referenced by main(), spi_byte_write(), spi_bytes_read(), and spi_bytes_write().

◆ spi_i2s_interrupt_enable()

void spi_i2s_interrupt_enable | ( | spi_type * | spi_x,
 |  | uint32_t | spi_i2s_int,
 |  | confirm_state | new_state )

enable or disable the specified spi/i2s interrupts.

Parameters
spi_x | select the spi/i2s peripheral. this parameter can be one of the following values: SPI1, SPI2
spi_i2s_int specifies the spi/i2s interrupt sources to be enabled or disabled. this parameter can be one of the following values:
  • SPI_I2S_ERROR_INT
  • SPI_I2S_RDBF_INT
  • SPI_I2S_TDBE_INT
new_state | new state of the specified spi/i2s interrupts. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 463 of file at32f413_spi.c.

Referenced by i2s_config(), main(), SPI1_IRQHandler(), SPI2_IRQHandler(), spi_config(), and spi_config().

◆ spi_i2s_interrupt_flag_get()

flag_status spi_i2s_interrupt_flag_get | ( | spi_type * | spi_x,
 |  | uint32_t | spi_i2s_flag )

get interrupt flag of the specified spi/i2s peripheral.

Parameters
spi_x select the spi/i2s peripheral. this parameter can be one of the following values: SPI1, SPI2
spi_i2s_flag select the spi/i2s flag this parameter can be one of the following values:
  • SPI_I2S_RDBF_FLAG
  • SPI_I2S_TDBE_FLAG
  • I2S_TUERR_FLAG (this flag only use in i2s mode)
  • SPI_CCERR_FLAG (this flag only use in spi mode)
  • SPI_MMERR_FLAG (this flag only use in spi mode)
  • SPI_I2S_ROERR_FLAG
Return values
the new state of spi/i2s flag

< spi or i2s receive data buffer full flag

< spi or i2s transmit data buffer empty flag

< i2s transmitter underload error flag

< spi crc calculation error flag

< spi master mode error flag

< spi or i2s receiver overflow error flag

Definition at line 576 of file at32f413_spi.c.

Referenced by SPI1_IRQHandler(), and SPI2_IRQHandler().

◆ spi_i2s_reset()

void spi_i2s_reset ( spi_type * spi_x )

spi reset by crm reset register

Parameters
spi_x select the spi peripheral. this parameter can be one of the following values: SPI1, SPI2
Return values
none

Definition at line 50 of file at32f413_spi.c.

Referenced by codec_i2s_init(), i2s_config(), i2s_config(), and spi_config().

◆ spi_init()

void spi_init | ( | spi_type * | spi_x,
 |  | spi_init_type * | spi_init_struct )

spi init config with its setting value.

Parameters
spi_x | select the spi peripheral. this parameter can be one of the following values: SPI1, SPI2
spi_init_struct | : pointer to a spi_init_type structure which will be initialized.
Return values
none

Definition at line 90 of file at32f413_spi.c.

Referenced by main(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spiflash_init(), and usart_spi_configuration().

◆ spi_software_cs_internal_level_set()

void spi_software_cs_internal_level_set | ( | spi_type * | spi_x,
 |  | spi_software_cs_level_type | level )

set the software cs internal level for the spi peripheral.

Parameters
spi_x select the spi peripheral. this parameter can be one of the following values: SPI1, SPI2
level set the state of spi cs level. this parameter can be one of the following values:
  • SPI_SWCS_INTERNAL_LEVEL_LOW
  • SPI_SWCS_INTERNAL_LEVEL_HIGHT note:the bit only use when swcsen bit is set. note:when use this bit,io operation on the cs pin are invalid.
Return values
none

Definition at line 241 of file at32f413_spi.c.


AT32F413 Firmwary Library: TMR

Topics | Macros
TMR
AT32F413_periph_driver

TMR driver modules. More...

Topics

TMR_flags_definition
tmr flag
TMR_interrupt_select_type_definition
tmr interrupt select type
TMR_exported_types
TMR_exported_functions
TMR_private_functions

Macros

#define | TMR1 ((tmr_type *) TMR1_BASE)
#define | TMR2 ((tmr_type *) TMR2_BASE)
#define | TMR3 ((tmr_type *) TMR3_BASE)
#define | TMR4 ((tmr_type *) TMR4_BASE)

Detailed Description

TMR driver modules.

Macro Definition Documentation

◆ TMR1

#define TMR1 ((tmr_type *) TMR1_BASE)

Definition at line 831 of file at32f413_tmr.h.

Referenced by main(), mclk_tmr1_init(), SysTick_Handler(), tmr1_config(), tmr1_config(), TMR1_OVF_TMR10_IRQHandler(), TMR1_TRG_HALL_TMR11_IRQHandler(), and tmr_reset().

◆ TMR2

#define TMR2 ((tmr_type *) TMR2_BASE)

Definition at line 832 of file at32f413_tmr.h.

Referenced by main(), tmr2_config(), TMR2_GLOBAL_IRQHandler(), tmr_32_bit_function_enable(), and tmr_reset().

◆ TMR3

#define TMR3 ((tmr_type *) TMR3_BASE)

Definition at line 833 of file at32f413_tmr.h.

Referenced by main(), TMR3_GLOBAL_IRQHandler(), tmr_init(), and tmr_reset().

◆ TMR4

#define TMR4 ((tmr_type *) TMR4_BASE)

Definition at line 834 of file at32f413_tmr.h.

Referenced by main(), and tmr_reset().


AT32F413 Firmwary Library: TMR_flags_definition

Macros
TMR_flags_definition
AT32F413_periph_driver » TMR

tmr flag More...

Macros

#define | TMR_OVF_FLAG ((uint32_t)0x000001)
#define | TMR_C1_FLAG ((uint32_t)0x000002)
#define | TMR_C2_FLAG ((uint32_t)0x000004)
#define | TMR_C3_FLAG ((uint32_t)0x000008)
#define | TMR_C4_FLAG ((uint32_t)0x000010)
#define | TMR_HALL_FLAG ((uint32_t)0x000020)
#define | TMR_TRIGGER_FLAG ((uint32_t)0x000040)
#define | TMR_BRK_FLAG ((uint32_t)0x000080)
#define | TMR_C1_RECAPTURE_FLAG ((uint32_t)0x000200)
#define | TMR_C2_RECAPTURE_FLAG ((uint32_t)0x000400)
#define | TMR_C3_RECAPTURE_FLAG ((uint32_t)0x000800)
#define | TMR_C4_RECAPTURE_FLAG ((uint32_t)0x001000)

Detailed Description

tmr flag

Macro Definition Documentation

◆ TMR_BRK_FLAG

#define TMR_BRK_FLAG ((uint32_t)0x000080)

tmr flag brake

Definition at line 58 of file at32f413_tmr.h.

◆ TMR_C1_FLAG

#define TMR_C1_FLAG ((uint32_t)0x000002)

tmr flag channel 1

Definition at line 52 of file at32f413_tmr.h.

Referenced by TMR1_BRK_TMR9_IRQHandler(), TMR2_GLOBAL_IRQHandler(), and TMR3_GLOBAL_IRQHandler().

◆ TMR_C1_RECAPTURE_FLAG

#define TMR_C1_RECAPTURE_FLAG ((uint32_t)0x000200)

tmr flag channel 1 recapture

Definition at line 59 of file at32f413_tmr.h.

◆ TMR_C2_FLAG

#define TMR_C2_FLAG ((uint32_t)0x000004)

tmr flag channel 2

Definition at line 53 of file at32f413_tmr.h.

Referenced by TMR1_BRK_TMR9_IRQHandler(), TMR2_GLOBAL_IRQHandler(), and TMR3_GLOBAL_IRQHandler().

◆ TMR_C2_RECAPTURE_FLAG

#define TMR_C2_RECAPTURE_FLAG ((uint32_t)0x000400)

tmr flag channel 2 recapture

Definition at line 60 of file at32f413_tmr.h.

◆ TMR_C3_FLAG

#define TMR_C3_FLAG ((uint32_t)0x000008)

tmr flag channel 3

Definition at line 54 of file at32f413_tmr.h.

Referenced by TMR2_GLOBAL_IRQHandler(), and TMR3_GLOBAL_IRQHandler().

◆ TMR_C3_RECAPTURE_FLAG

#define TMR_C3_RECAPTURE_FLAG ((uint32_t)0x000800)

tmr flag channel 3 recapture

Definition at line 61 of file at32f413_tmr.h.

◆ TMR_C4_FLAG

#define TMR_C4_FLAG ((uint32_t)0x000010)

tmr flag channel 4

Definition at line 55 of file at32f413_tmr.h.

Referenced by main(), TMR2_GLOBAL_IRQHandler(), TMR3_GLOBAL_IRQHandler(), and TMR5_GLOBAL_IRQHandler().

◆ TMR_C4_RECAPTURE_FLAG

#define TMR_C4_RECAPTURE_FLAG ((uint32_t)0x001000)

tmr flag channel 4 recapture

Definition at line 62 of file at32f413_tmr.h.

◆ TMR_HALL_FLAG

#define TMR_HALL_FLAG ((uint32_t)0x000020)

tmr flag hall

Definition at line 56 of file at32f413_tmr.h.

Referenced by TMR1_TRG_HALL_TMR11_IRQHandler().

◆ TMR_OVF_FLAG

#define TMR_OVF_FLAG ((uint32_t)0x000001)

tmr flag overflow

Definition at line 51 of file at32f413_tmr.h.

Referenced by TMR1_OVF_TMR10_IRQHandler(), TMR2_GLOBAL_IRQHandler(), and TMR3_GLOBAL_IRQHandler().

◆ TMR_TRIGGER_FLAG

#define TMR_TRIGGER_FLAG ((uint32_t)0x000040)

tmr flag trigger

Definition at line 57 of file at32f413_tmr.h.

Referenced by TMR2_GLOBAL_IRQHandler().


AT32F413 Firmwary Library: TMR_interrupt_select_type_definition

Macros
TMR_interrupt_select_type_definition
AT32F413_periph_driver » TMR

tmr interrupt select type More...

Macros

#define | TMR_OVF_INT ((uint32_t)0x000001)
#define | TMR_C1_INT ((uint32_t)0x000002)
#define | TMR_C2_INT ((uint32_t)0x000004)
#define | TMR_C3_INT ((uint32_t)0x000008)
#define | TMR_C4_INT ((uint32_t)0x000010)
#define | TMR_HALL_INT ((uint32_t)0x000020)
#define | TMR_TRIGGER_INT ((uint32_t)0x000040)
#define | TMR_BRK_INT ((uint32_t)0x000080)

Detailed Description

tmr interrupt select type

Macro Definition Documentation

◆ TMR_BRK_INT

#define TMR_BRK_INT ((uint32_t)0x000080)

tmr interrupt brake

Definition at line 80 of file at32f413_tmr.h.

◆ TMR_C1_INT

#define TMR_C1_INT ((uint32_t)0x000002)

tmr interrupt channel 1

Definition at line 74 of file at32f413_tmr.h.

Referenced by main().

◆ TMR_C2_INT

#define TMR_C2_INT ((uint32_t)0x000004)

tmr interrupt channel 2

Definition at line 75 of file at32f413_tmr.h.

Referenced by main().

◆ TMR_C3_INT

#define TMR_C3_INT ((uint32_t)0x000008)

tmr interrupt channel 3

Definition at line 76 of file at32f413_tmr.h.

Referenced by main().

◆ TMR_C4_INT

#define TMR_C4_INT ((uint32_t)0x000010)

tmr interrupt channel 4

Definition at line 77 of file at32f413_tmr.h.

Referenced by main(), and TMR5_GLOBAL_IRQHandler().

◆ TMR_HALL_INT

#define TMR_HALL_INT ((uint32_t)0x000020)

tmr interrupt hall

Definition at line 78 of file at32f413_tmr.h.

Referenced by main().

◆ TMR_OVF_INT

#define TMR_OVF_INT ((uint32_t)0x000001)

tmr interrupt overflow

Definition at line 73 of file at32f413_tmr.h.

Referenced by main(), tmr1_config(), tmr2_config(), and tmr_init().

◆ TMR_TRIGGER_INT

#define TMR_TRIGGER_INT ((uint32_t)0x000040)

tmr interrupt trigger

Definition at line 79 of file at32f413_tmr.h.

Referenced by main().


AT32F413 Firmwary Library: TMR_exported_types

Data Structures | Enumerations
TMR_exported_types
AT32F413_periph_driver » TMR

Data Structures

struct | tmr_output_config_type
tmr output config type More...
struct | tmr_input_config_type
tmr input capture config type More...
struct | tmr_brkdt_config_type
tmr brkdt config type More...
struct | tmr_type
type define tmr register all More...

Enumerations

enum | tmr_clock_division_type { TMR_CLOCK_DIV1 = 0x00 , TMR_CLOCK_DIV2 = 0x01 , TMR_CLOCK_DIV4 = 0x02 }
tmr clock division type More...
enum tmr_count_mode_type {
TMR_COUNT_UP = 0x00 , TMR_COUNT_DOWN = 0x01 , TMR_COUNT_TWO_WAY_1 = 0x02 , TMR_COUNT_TWO_WAY_2 = 0x04 ,
TMR_COUNT_TWO_WAY_3 = 0x06
}
tmr counter mode type More...
enum tmr_primary_select_type {
TMR_PRIMARY_SEL_RESET = 0x00 , TMR_PRIMARY_SEL_ENABLE = 0x01 , TMR_PRIMARY_SEL_OVERFLOW = 0x02 , TMR_PRIMARY_SEL_COMPARE = 0x03 ,
TMR_PRIMARY_SEL_C1ORAW = 0x04 , TMR_PRIMARY_SEL_C2ORAW = 0x05 , TMR_PRIMARY_SEL_C3ORAW = 0x06 , TMR_PRIMARY_SEL_C4ORAW = 0x07
}
tmr primary mode select type More...
enum sub_tmr_input_sel_type {
TMR_SUB_INPUT_SEL_IS0 = 0x00 , TMR_SUB_INPUT_SEL_IS1 = 0x01 , TMR_SUB_INPUT_SEL_IS2 = 0x02 , TMR_SUB_INPUT_SEL_IS3 = 0x03 ,
TMR_SUB_INPUT_SEL_C1INC = 0x04 , TMR_SUB_INPUT_SEL_C1DF1 = 0x05 , TMR_SUB_INPUT_SEL_C2DF2 = 0x06 , TMR_SUB_INPUT_SEL_EXTIN = 0x07
}
tmr subordinate mode input select type More...
enum tmr_sub_mode_select_type {
TMR_SUB_MODE_DIABLE = 0x00 , TMR_SUB_ENCODER_MODE_A = 0x01 , TMR_SUB_ENCODER_MODE_B = 0x02 , TMR_SUB_ENCODER_MODE_C = 0x03 ,
TMR_SUB_RESET_MODE = 0x04 , TMR_SUB_HANG_MODE = 0x05 , TMR_SUB_TRIGGER_MODE = 0x06 , TMR_SUB_EXTERNAL_CLOCK_MODE_A = 0x07
}
tmr subordinate mode select type More...
enum | tmr_encoder_mode_type { TMR_ENCODER_MODE_A = TMR_SUB_ENCODER_MODE_A , TMR_ENCODER_MODE_B = TMR_SUB_ENCODER_MODE_B , TMR_ENCODER_MODE_C = TMR_SUB_ENCODER_MODE_C }
tmr encoder mode type More...
enum tmr_output_control_mode_type {
TMR_OUTPUT_CONTROL_OFF = 0x00 , TMR_OUTPUT_CONTROL_HIGH = 0x01 , TMR_OUTPUT_CONTROL_LOW = 0x02 , TMR_OUTPUT_CONTROL_SWITCH = 0x03 ,
TMR_OUTPUT_CONTROL_FORCE_LOW = 0x04 , TMR_OUTPUT_CONTROL_FORCE_HIGH = 0x05 , TMR_OUTPUT_CONTROL_PWM_MODE_A = 0x06 , TMR_OUTPUT_CONTROL_PWM_MODE_B = 0x07
}
tmr output control mode type More...
enum | tmr_force_output_type { TMR_FORCE_OUTPUT_HIGH = TMR_OUTPUT_CONTROL_FORCE_HIGH , TMR_FORCE_OUTPUT_LOW = TMR_OUTPUT_CONTROL_FORCE_LOW }
tmr force output type More...
enum | tmr_output_polarity_type { TMR_OUTPUT_ACTIVE_HIGH = 0x00 , TMR_OUTPUT_ACTIVE_LOW = 0x01 }
tmr output channel polarity type More...
enum | tmr_input_polarity_type { TMR_INPUT_RISING_EDGE = 0x00 , TMR_INPUT_FALLING_EDGE = 0x01 , TMR_INPUT_BOTH_EDGE = 0x03 }
tmr input channel polarity type More...
enum tmr_channel_select_type {
TMR_SELECT_CHANNEL_1 = 0x00 , TMR_SELECT_CHANNEL_1C = 0x01 , TMR_SELECT_CHANNEL_2 = 0x02 , TMR_SELECT_CHANNEL_2C = 0x03 ,
TMR_SELECT_CHANNEL_3 = 0x04 , TMR_SELECT_CHANNEL_3C = 0x05 , TMR_SELECT_CHANNEL_4 = 0x06
}
tmr channel select type More...
enum | tmr_channel1_input_connected_type { TMR_CHANEL1_CONNECTED_C1IRAW = 0x00 , TMR_CHANEL1_2_3_CONNECTED_C1IRAW_XOR = 0x01 }
tmr channel1 input connected type More...
enum | tmr_input_direction_mapped_type { TMR_CC_CHANNEL_MAPPED_DIRECT = 0x01 , TMR_CC_CHANNEL_MAPPED_INDIRECT = 0x02 , TMR_CC_CHANNEL_MAPPED_STI = 0x03 }
tmr input channel mapped type channel direction More...
enum | tmr_channel_input_divider_type { TMR_CHANNEL_INPUT_DIV_1 = 0x00 , TMR_CHANNEL_INPUT_DIV_2 = 0x01 , TMR_CHANNEL_INPUT_DIV_4 = 0x02 , TMR_CHANNEL_INPUT_DIV_8 = 0x03 }
tmr input divider type More...
enum | tmr_dma_request_source_type { TMR_DMA_REQUEST_BY_CHANNEL = 0x00 , TMR_DMA_REQUEST_BY_OVERFLOW = 0x01 }
tmr dma request source select type More...
enum tmr_dma_request_type {
TMR_OVERFLOW_DMA_REQUEST = 0x00000100 , TMR_C1_DMA_REQUEST = 0x00000200 , TMR_C2_DMA_REQUEST = 0x00000400 , TMR_C3_DMA_REQUEST = 0x00000800 ,
TMR_C4_DMA_REQUEST = 0x00001000 , TMR_HALL_DMA_REQUEST = 0x00002000 , TMR_TRIGGER_DMA_REQUEST = 0x00004000
}
tmr dma request type More...
enum tmr_event_trigger_type {
TMR_OVERFLOW_SWTRIG = 0x00000001 , TMR_C1_SWTRIG = 0x00000002 , TMR_C2_SWTRIG = 0x00000004 , TMR_C3_SWTRIG = 0x00000008 ,
TMR_C4_SWTRIG = 0x00000010 , TMR_HALL_SWTRIG = 0x00000020 , TMR_TRIGGER_SWTRIG = 0x00000040 , TMR_BRK_SWTRIG = 0x00000080
}
tmr event triggered by software type More...
enum | tmr_polarity_active_type { TMR_POLARITY_ACTIVE_HIGH = 0x00 , TMR_POLARITY_ACTIVE_LOW = 0x01 , TMR_POLARITY_ACTIVE_BOTH = 0x02 }
tmr polarity active type More...
enum | tmr_external_signal_divider_type { TMR_ES_FREQUENCY_DIV_1 = 0x00 , TMR_ES_FREQUENCY_DIV_2 = 0x01 , TMR_ES_FREQUENCY_DIV_4 = 0x02 , TMR_ES_FREQUENCY_DIV_8 = 0x03 }
tmr external signal divider type More...
enum | tmr_external_signal_polarity_type { TMR_ES_POLARITY_NON_INVERTED = 0x00 , TMR_ES_POLARITY_INVERTED = 0x01 }
tmr external signal polarity type More...
enum tmr_dma_transfer_length_type {
TMR_DMA_TRANSFER_1BYTE = 0x00 , TMR_DMA_TRANSFER_2BYTES = 0x01 , TMR_DMA_TRANSFER_3BYTES = 0x02 , TMR_DMA_TRANSFER_4BYTES = 0x03 ,
TMR_DMA_TRANSFER_5BYTES = 0x04 , TMR_DMA_TRANSFER_6BYTES = 0x05 , TMR_DMA_TRANSFER_7BYTES = 0x06 , TMR_DMA_TRANSFER_8BYTES = 0x07 ,
TMR_DMA_TRANSFER_9BYTES = 0x08 , TMR_DMA_TRANSFER_10BYTES = 0x09 , TMR_DMA_TRANSFER_11BYTES = 0x0A , TMR_DMA_TRANSFER_12BYTES = 0x0B ,
TMR_DMA_TRANSFER_13BYTES = 0x0C , TMR_DMA_TRANSFER_14BYTES = 0x0D , TMR_DMA_TRANSFER_15BYTES = 0x0E , TMR_DMA_TRANSFER_16BYTES = 0x0F ,
TMR_DMA_TRANSFER_17BYTES = 0x10 , TMR_DMA_TRANSFER_18BYTES = 0x11
}
tmr dma transfer length type More...
enum tmr_dma_address_type {
TMR_CTRL1_ADDRESS = 0x0000 , TMR_CTRL2_ADDRESS = 0x0001 , TMR_STCTRL_ADDRESS = 0x0002 , TMR_IDEN_ADDRESS = 0x0003 ,
TMR_ISTS_ADDRESS = 0x0004 , TMR_SWEVT_ADDRESS = 0x0005 , TMR_CM1_ADDRESS = 0x0006 , TMR_CM2_ADDRESS = 0x0007 ,
TMR_CCTRL_ADDRESS = 0x0008 , TMR_CVAL_ADDRESS = 0x0009 , TMR_DIV_ADDRESS = 0x000A , TMR_PR_ADDRESS = 0x000B ,
TMR_RPR_ADDRESS = 0x000C , TMR_C1DT_ADDRESS = 0x000D , TMR_C2DT_ADDRESS = 0x000E , TMR_C3DT_ADDRESS = 0x000F ,
TMR_C4DT_ADDRESS = 0x0010 , TMR_BRK_ADDRESS = 0x0011 , TMR_DMACTRL_ADDRESS = 0x0012
}
tmr dma base address type More...
enum | tmr_brk_polarity_type { TMR_BRK_INPUT_ACTIVE_LOW = 0x00 , TMR_BRK_INPUT_ACTIVE_HIGH = 0x01 }
tmr brk polarity type More...
enum | tmr_wp_level_type { TMR_WP_OFF = 0x00 , TMR_WP_LEVEL_3 = 0x01 , TMR_WP_LEVEL_2 = 0x02 , TMR_WP_LEVEL_1 = 0x03 }
tmr write protect level type More...

Detailed Description

Enumeration Type Documentation

◆ sub_tmr_input_sel_type

enum sub_tmr_input_sel_type

tmr subordinate mode input select type

Enumerator
TMR_SUB_INPUT_SEL_IS0 | subordinate mode input select is0
TMR_SUB_INPUT_SEL_IS1 | subordinate mode input select is1
TMR_SUB_INPUT_SEL_IS2 | subordinate mode input select is2
TMR_SUB_INPUT_SEL_IS3 | subordinate mode input select is3
TMR_SUB_INPUT_SEL_C1INC | subordinate mode input select c1inc
TMR_SUB_INPUT_SEL_C1DF1 | subordinate mode input select c1df1
TMR_SUB_INPUT_SEL_C2DF2 | subordinate mode input select c2df2
TMR_SUB_INPUT_SEL_EXTIN | subordinate mode input select extin

Definition at line 130 of file at32f413_tmr.h.

◆ tmr_brk_polarity_type

enum tmr_brk_polarity_type

tmr brk polarity type

Enumerator
TMR_BRK_INPUT_ACTIVE_LOW | tmr brk input channel active low
TMR_BRK_INPUT_ACTIVE_HIGH | tmr brk input channel active high

Definition at line 376 of file at32f413_tmr.h.

◆ tmr_channel1_input_connected_type

enum tmr_channel1_input_connected_type

tmr channel1 input connected type

Enumerator
TMR_CHANEL1_CONNECTED_C1IRAW | channel1 pins is only connected to C1IRAW input
TMR_CHANEL1_2_3_CONNECTED_C1IRAW_XOR | channel1/2/3 pins are connected to C1IRAW input after xored

Definition at line 227 of file at32f413_tmr.h.

◆ tmr_channel_input_divider_type

enum tmr_channel_input_divider_type

tmr input divider type

Enumerator
TMR_CHANNEL_INPUT_DIV_1 | tmr channel input divider 1
TMR_CHANNEL_INPUT_DIV_2 | tmr channel input divider 2
TMR_CHANNEL_INPUT_DIV_4 | tmr channel input divider 4
TMR_CHANNEL_INPUT_DIV_8 | tmr channel input divider 8

Definition at line 246 of file at32f413_tmr.h.

◆ tmr_channel_select_type

enum tmr_channel_select_type

tmr channel select type

Enumerator
TMR_SELECT_CHANNEL_1 | tmr channel select channel 1
TMR_SELECT_CHANNEL_1C | tmr channel select channel 1 complementary
TMR_SELECT_CHANNEL_2 | tmr channel select channel 2
TMR_SELECT_CHANNEL_2C | tmr channel select channel 2 complementary
TMR_SELECT_CHANNEL_3 | tmr channel select channel 3
TMR_SELECT_CHANNEL_3C | tmr channel select channel 3 complementary
TMR_SELECT_CHANNEL_4 | tmr channel select channel 4

Definition at line 213 of file at32f413_tmr.h.

◆ tmr_clock_division_type

enum tmr_clock_division_type

tmr clock division type

Enumerator
TMR_CLOCK_DIV1 | tmr clock division 1
TMR_CLOCK_DIV2 | tmr clock division 2
TMR_CLOCK_DIV4 | tmr clock division 4

Definition at line 93 of file at32f413_tmr.h.

◆ tmr_count_mode_type

enum tmr_count_mode_type

tmr counter mode type

Enumerator
TMR_COUNT_UP | tmr counter mode up
TMR_COUNT_DOWN | tmr counter mode down
TMR_COUNT_TWO_WAY_1 | tmr counter mode two way 1
TMR_COUNT_TWO_WAY_2 | tmr counter mode two way 2
TMR_COUNT_TWO_WAY_3 | tmr counter mode two way 3

Definition at line 103 of file at32f413_tmr.h.

◆ tmr_dma_address_type

enum tmr_dma_address_type

tmr dma base address type

Enumerator
TMR_CTRL1_ADDRESS | tmr dma base address ctrl1
TMR_CTRL2_ADDRESS | tmr dma base address ctrl2
TMR_STCTRL_ADDRESS | tmr dma base address stctrl
TMR_IDEN_ADDRESS | tmr dma base address iden
TMR_ISTS_ADDRESS | tmr dma base address ists
TMR_SWEVT_ADDRESS | tmr dma base address swevt
TMR_CM1_ADDRESS | tmr dma base address cm1
TMR_CM2_ADDRESS | tmr dma base address cm2
TMR_CCTRL_ADDRESS | tmr dma base address cctrl
TMR_CVAL_ADDRESS | tmr dma base address cval
TMR_DIV_ADDRESS | tmr dma base address div
TMR_PR_ADDRESS | tmr dma base address pr
TMR_RPR_ADDRESS | tmr dma base address rpr
TMR_C1DT_ADDRESS | tmr dma base address c1dt
TMR_C2DT_ADDRESS | tmr dma base address c2dt
TMR_C3DT_ADDRESS | tmr dma base address c3dt
TMR_C4DT_ADDRESS | tmr dma base address c4dt
TMR_BRK_ADDRESS | tmr dma base address brake
TMR_DMACTRL_ADDRESS | tmr dma base address dmactrl

Definition at line 350 of file at32f413_tmr.h.

◆ tmr_dma_request_source_type

enum tmr_dma_request_source_type

tmr dma request source select type

Enumerator
TMR_DMA_REQUEST_BY_CHANNEL | tmr dma request source select channel
TMR_DMA_REQUEST_BY_OVERFLOW | tmr dma request source select overflow

Definition at line 257 of file at32f413_tmr.h.

◆ tmr_dma_request_type

enum tmr_dma_request_type

tmr dma request type

Enumerator
TMR_OVERFLOW_DMA_REQUEST | tmr dma request select overflow
TMR_C1_DMA_REQUEST | tmr dma request select channel 1
TMR_C2_DMA_REQUEST | tmr dma request select channel 2
TMR_C3_DMA_REQUEST | tmr dma request select channel 3
TMR_C4_DMA_REQUEST | tmr dma request select channel 4
TMR_HALL_DMA_REQUEST | tmr dma request select hall
TMR_TRIGGER_DMA_REQUEST | tmr dma request select trigger

Definition at line 266 of file at32f413_tmr.h.

◆ tmr_dma_transfer_length_type

enum tmr_dma_transfer_length_type

tmr dma transfer length type

Enumerator
TMR_DMA_TRANSFER_1BYTE | tmr dma transfer length 1 byte
TMR_DMA_TRANSFER_2BYTES | tmr dma transfer length 2 bytes
TMR_DMA_TRANSFER_3BYTES | tmr dma transfer length 3 bytes
TMR_DMA_TRANSFER_4BYTES | tmr dma transfer length 4 bytes
TMR_DMA_TRANSFER_5BYTES | tmr dma transfer length 5 bytes
TMR_DMA_TRANSFER_6BYTES | tmr dma transfer length 6 bytes
TMR_DMA_TRANSFER_7BYTES | tmr dma transfer length 7 bytes
TMR_DMA_TRANSFER_8BYTES | tmr dma transfer length 8 bytes
TMR_DMA_TRANSFER_9BYTES | tmr dma transfer length 9 bytes
TMR_DMA_TRANSFER_10BYTES | tmr dma transfer length 10 bytes
TMR_DMA_TRANSFER_11BYTES | tmr dma transfer length 11 bytes
TMR_DMA_TRANSFER_12BYTES | tmr dma transfer length 12 bytes
TMR_DMA_TRANSFER_13BYTES | tmr dma transfer length 13 bytes
TMR_DMA_TRANSFER_14BYTES | tmr dma transfer length 14 bytes
TMR_DMA_TRANSFER_15BYTES | tmr dma transfer length 15 bytes
TMR_DMA_TRANSFER_16BYTES | tmr dma transfer length 16 bytes
TMR_DMA_TRANSFER_17BYTES | tmr dma transfer length 17 bytes
TMR_DMA_TRANSFER_18BYTES | tmr dma transfer length 18 bytes

Definition at line 325 of file at32f413_tmr.h.

◆ tmr_encoder_mode_type

enum tmr_encoder_mode_type

tmr encoder mode type

Enumerator
TMR_ENCODER_MODE_A | tmr encoder mode a
TMR_ENCODER_MODE_B | tmr encoder mode b
TMR_ENCODER_MODE_C | tmr encoder mode c

Definition at line 160 of file at32f413_tmr.h.

◆ tmr_event_trigger_type

enum tmr_event_trigger_type

tmr event triggered by software type

Enumerator
TMR_OVERFLOW_SWTRIG | tmr event triggered by software of overflow
TMR_C1_SWTRIG | tmr event triggered by software of channel 1
TMR_C2_SWTRIG | tmr event triggered by software of channel 2
TMR_C3_SWTRIG | tmr event triggered by software of channel 3
TMR_C4_SWTRIG | tmr event triggered by software of channel 4
TMR_HALL_SWTRIG | tmr event triggered by software of hall
TMR_TRIGGER_SWTRIG | tmr event triggered by software of trigger
TMR_BRK_SWTRIG | tmr event triggered by software of brake

Definition at line 280 of file at32f413_tmr.h.

◆ tmr_external_signal_divider_type

enum tmr_external_signal_divider_type

tmr external signal divider type

Enumerator
TMR_ES_FREQUENCY_DIV_1 | tmr external signal frequency divider 1
TMR_ES_FREQUENCY_DIV_2 | tmr external signal frequency divider 2
TMR_ES_FREQUENCY_DIV_4 | tmr external signal frequency divider 4
TMR_ES_FREQUENCY_DIV_8 | tmr external signal frequency divider 8

Definition at line 305 of file at32f413_tmr.h.

◆ tmr_external_signal_polarity_type

enum tmr_external_signal_polarity_type

tmr external signal polarity type

Enumerator
TMR_ES_POLARITY_NON_INVERTED | tmr external signal polarity non-inerted
TMR_ES_POLARITY_INVERTED | tmr external signal polarity inerted

Definition at line 316 of file at32f413_tmr.h.

◆ tmr_force_output_type

enum tmr_force_output_type

tmr force output type

Enumerator
TMR_FORCE_OUTPUT_HIGH | tmr force output high
TMR_FORCE_OUTPUT_LOW | tmr force output low

Definition at line 185 of file at32f413_tmr.h.

◆ tmr_input_direction_mapped_type

enum tmr_input_direction_mapped_type

tmr input channel mapped type channel direction

Enumerator
TMR_CC_CHANNEL_MAPPED_DIRECT | channel is configured as input, mapped direct
TMR_CC_CHANNEL_MAPPED_INDIRECT | channel is configured as input, mapped indirect
TMR_CC_CHANNEL_MAPPED_STI | channel is configured as input, mapped sti

Definition at line 236 of file at32f413_tmr.h.

◆ tmr_input_polarity_type

enum tmr_input_polarity_type

tmr input channel polarity type

Enumerator
TMR_INPUT_RISING_EDGE | tmr input channel polarity rising
TMR_INPUT_FALLING_EDGE | tmr input channel polarity falling
TMR_INPUT_BOTH_EDGE | tmr input channel polarity both edge

Definition at line 203 of file at32f413_tmr.h.

◆ tmr_output_control_mode_type

enum tmr_output_control_mode_type

tmr output control mode type

Enumerator
TMR_OUTPUT_CONTROL_OFF | tmr output control mode off
TMR_OUTPUT_CONTROL_HIGH | tmr output control mode high
TMR_OUTPUT_CONTROL_LOW | tmr output control mode low
TMR_OUTPUT_CONTROL_SWITCH | tmr output control mode switch
TMR_OUTPUT_CONTROL_FORCE_LOW | tmr output control mode force low
TMR_OUTPUT_CONTROL_FORCE_HIGH | tmr output control mode force high
TMR_OUTPUT_CONTROL_PWM_MODE_A | tmr output control mode pwm a
TMR_OUTPUT_CONTROL_PWM_MODE_B | tmr output control mode pwm b

Definition at line 170 of file at32f413_tmr.h.

◆ tmr_output_polarity_type

enum tmr_output_polarity_type

tmr output channel polarity type

Enumerator
TMR_OUTPUT_ACTIVE_HIGH | tmr output channel polarity high
TMR_OUTPUT_ACTIVE_LOW | tmr output channel polarity low

Definition at line 194 of file at32f413_tmr.h.

◆ tmr_polarity_active_type

enum tmr_polarity_active_type

tmr polarity active type

Enumerator
TMR_POLARITY_ACTIVE_HIGH | tmr polarity active high
TMR_POLARITY_ACTIVE_LOW | tmr polarity active low
TMR_POLARITY_ACTIVE_BOTH | tmr polarity active both high ande low

Definition at line 295 of file at32f413_tmr.h.

◆ tmr_primary_select_type

enum tmr_primary_select_type

tmr primary mode select type

Enumerator
TMR_PRIMARY_SEL_RESET | tmr primary mode select reset
TMR_PRIMARY_SEL_ENABLE | tmr primary mode select enable
TMR_PRIMARY_SEL_OVERFLOW | tmr primary mode select overflow
TMR_PRIMARY_SEL_COMPARE | tmr primary mode select compare
TMR_PRIMARY_SEL_C1ORAW | tmr primary mode select c1oraw
TMR_PRIMARY_SEL_C2ORAW | tmr primary mode select c2oraw
TMR_PRIMARY_SEL_C3ORAW | tmr primary mode select c3oraw
TMR_PRIMARY_SEL_C4ORAW | tmr primary mode select c4oraw

Definition at line 115 of file at32f413_tmr.h.

◆ tmr_sub_mode_select_type

enum tmr_sub_mode_select_type

tmr subordinate mode select type

Enumerator
TMR_SUB_MODE_DIABLE | subordinate mode disable
TMR_SUB_ENCODER_MODE_A | subordinate mode select encoder mode a
TMR_SUB_ENCODER_MODE_B | subordinate mode select encoder mode b
TMR_SUB_ENCODER_MODE_C | subordinate mode select encoder mode c
TMR_SUB_RESET_MODE | subordinate mode select reset
TMR_SUB_HANG_MODE | subordinate mode select hang
TMR_SUB_TRIGGER_MODE | subordinate mode select trigger
TMR_SUB_EXTERNAL_CLOCK_MODE_A | subordinate mode external clock mode a

Definition at line 145 of file at32f413_tmr.h.

◆ tmr_wp_level_type

enum tmr_wp_level_type

tmr write protect level type

Enumerator
TMR_WP_OFF | tmr write protect off
TMR_WP_LEVEL_3 | tmr write protect level 3
TMR_WP_LEVEL_2 | tmr write protect level 2
TMR_WP_LEVEL_1 | tmr write protect level 1

Definition at line 385 of file at32f413_tmr.h.


AT32F413 Firmwary Library: tmr_output_config_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
tmr_output_config_type Struct Reference
AT32F413_periph_driver » TMR » TMR_exported_types

tmr output config type More...

#include <at32f413_tmr.h>

Data Fields

tmr_output_control_mode_type oc_mode
confirm_state oc_idle_state
confirm_state occ_idle_state
tmr_output_polarity_type oc_polarity
tmr_output_polarity_type occ_polarity
confirm_state oc_output_state
confirm_state occ_output_state

Detailed Description

tmr output config type

Definition at line 396 of file at32f413_tmr.h.

Field Documentation

◆ oc_idle_state

confirm_state tmr_output_config_type::oc_idle_state

output channel idle state

Definition at line 399 of file at32f413_tmr.h.

Referenced by main(), mclk_tmr1_init(), tmr1_config(), tmr_output_channel_config(), and tmr_output_default_para_init().

◆ oc_mode

tmr_output_control_mode_type tmr_output_config_type::oc_mode

output channel mode

Definition at line 398 of file at32f413_tmr.h.

Referenced by main(), mclk_tmr1_init(), tmr1_config(), tmr_output_channel_config(), and tmr_output_default_para_init().

◆ oc_output_state

confirm_state tmr_output_config_type::oc_output_state

output channel enable

Definition at line 403 of file at32f413_tmr.h.

Referenced by main(), mclk_tmr1_init(), tmr1_config(), tmr_output_channel_config(), and tmr_output_default_para_init().

◆ oc_polarity

tmr_output_polarity_type tmr_output_config_type::oc_polarity

output channel polarity

Definition at line 401 of file at32f413_tmr.h.

Referenced by main(), mclk_tmr1_init(), tmr1_config(), tmr_output_channel_config(), and tmr_output_default_para_init().

◆ occ_idle_state

confirm_state tmr_output_config_type::occ_idle_state

output channel complementary idle state

Definition at line 400 of file at32f413_tmr.h.

Referenced by main(), tmr_output_channel_config(), and tmr_output_default_para_init().

◆ occ_output_state

confirm_state tmr_output_config_type::occ_output_state

output channel complementary enable

Definition at line 404 of file at32f413_tmr.h.

Referenced by main(), tmr_output_channel_config(), and tmr_output_default_para_init().

◆ occ_polarity

tmr_output_polarity_type tmr_output_config_type::occ_polarity

output channel complementary polarity

Definition at line 402 of file at32f413_tmr.h.

Referenced by main(), tmr_output_channel_config(), and tmr_output_default_para_init().

The documentation for this struct was generated from the following file:
  • at32f413_tmr.h


AT32F413 Firmwary Library: tmr_input_config_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
tmr_input_config_type Struct Reference
AT32F413_periph_driver » TMR » TMR_exported_types

tmr input capture config type More...

#include <at32f413_tmr.h>

Data Fields

tmr_channel_select_type input_channel_select
tmr_input_polarity_type input_polarity_select
tmr_input_direction_mapped_type input_mapped_select
uint8_t input_filter_value

Detailed Description

tmr input capture config type

Definition at line 410 of file at32f413_tmr.h.

Field Documentation

◆ input_channel_select

tmr_channel_select_type tmr_input_config_type::input_channel_select

tmr input channel select

Definition at line 412 of file at32f413_tmr.h.

Referenced by main(), tmr_input_channel_init(), tmr_input_default_para_init(), and tmr_pwm_input_config().

◆ input_filter_value

uint8_t tmr_input_config_type::input_filter_value

tmr channel filter value

Definition at line 415 of file at32f413_tmr.h.

Referenced by main(), tmr_input_channel_init(), tmr_input_default_para_init(), and tmr_pwm_input_config().

◆ input_mapped_select

tmr_input_direction_mapped_type tmr_input_config_type::input_mapped_select

tmr channel mapped direct or indirect

Definition at line 414 of file at32f413_tmr.h.

Referenced by main(), tmr_input_channel_init(), tmr_input_default_para_init(), and tmr_pwm_input_config().

◆ input_polarity_select

tmr_input_polarity_type tmr_input_config_type::input_polarity_select

tmr input polarity select

Definition at line 413 of file at32f413_tmr.h.

Referenced by main(), tmr_input_channel_init(), tmr_input_default_para_init(), and tmr_pwm_input_config().

The documentation for this struct was generated from the following file:
  • at32f413_tmr.h


AT32F413 Firmwary Library: tmr_brkdt_config_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
tmr_brkdt_config_type Struct Reference
AT32F413_periph_driver » TMR » TMR_exported_types

tmr brkdt config type More...

#include <at32f413_tmr.h>

Data Fields

uint8_t deadtime
tmr_brk_polarity_type brk_polarity
tmr_wp_level_type wp_level
confirm_state auto_output_enable
confirm_state fcsoen_state
confirm_state fcsodis_state
confirm_state brk_enable

Detailed Description

tmr brkdt config type

Definition at line 421 of file at32f413_tmr.h.

Field Documentation

◆ auto_output_enable

confirm_state tmr_brkdt_config_type::auto_output_enable

automatic output enable

Definition at line 426 of file at32f413_tmr.h.

Referenced by main(), tmr_brkdt_config(), and tmr_brkdt_default_para_init().

◆ brk_enable

confirm_state tmr_brkdt_config_type::brk_enable

tmr brk enale

Definition at line 429 of file at32f413_tmr.h.

Referenced by main(), tmr_brkdt_config(), and tmr_brkdt_default_para_init().

◆ brk_polarity

tmr_brk_polarity_type tmr_brkdt_config_type::brk_polarity

tmr brake polarity

Definition at line 424 of file at32f413_tmr.h.

Referenced by main(), tmr_brkdt_config(), and tmr_brkdt_default_para_init().

◆ deadtime

uint8_t tmr_brkdt_config_type::deadtime

dead-time generator setup

Definition at line 423 of file at32f413_tmr.h.

Referenced by main(), tmr_brkdt_config(), and tmr_brkdt_default_para_init().

◆ fcsodis_state

confirm_state tmr_brkdt_config_type::fcsodis_state

frozen channel status when output disable

Definition at line 428 of file at32f413_tmr.h.

Referenced by main(), tmr_brkdt_config(), and tmr_brkdt_default_para_init().

◆ fcsoen_state

confirm_state tmr_brkdt_config_type::fcsoen_state

frozen channel status when output enable

Definition at line 427 of file at32f413_tmr.h.

Referenced by main(), tmr_brkdt_config(), and tmr_brkdt_default_para_init().

◆ wp_level

tmr_wp_level_type tmr_brkdt_config_type::wp_level

write protect configuration

Definition at line 425 of file at32f413_tmr.h.

Referenced by main(), tmr_brkdt_config(), and tmr_brkdt_default_para_init().

The documentation for this struct was generated from the following file:
  • at32f413_tmr.h


AT32F413 Firmwary Library: tmr_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
tmr_type Struct Reference
AT32F413_periph_driver » TMR » TMR_exported_types

type define tmr register all More...

#include <at32f413_tmr.h>

Data Fields

union {
__IO uint32_t ctrl1
struct {
__IO uint32_t tmren: 1
__IO uint32_t ovfen: 1
__IO uint32_t ovfs: 1
__IO uint32_t ocmen: 1
__IO uint32_t cnt_dir: 3
__IO uint32_t prben: 1
__IO uint32_t clkdiv: 2
__IO uint32_t pmen: 1
__IO uint32_t reserved1: 21
} ctrl1_bit
};
tmr ctrl1 register, offset:0x00
union {
__IO uint32_t ctrl2
struct {
__IO uint32_t cbctrl: 1
__IO uint32_t reserved1: 1
__IO uint32_t ccfs: 1
__IO uint32_t drs: 1
__IO uint32_t ptos: 3
__IO uint32_t c1insel: 1
__IO uint32_t c1ios: 1
__IO uint32_t c1cios: 1
__IO uint32_t c2ios: 1
__IO uint32_t c2cios: 1
__IO uint32_t c3ios: 1
__IO uint32_t c3cios: 1
__IO uint32_t c4ios: 1
__IO uint32_t reserved2: 17
} ctrl2_bit
};
tmr ctrl2 register, offset:0x04
union {
__IO uint32_t stctrl
struct {
__IO uint32_t smsel: 3
__IO uint32_t reserved1: 1
__IO uint32_t stis: 3
__IO uint32_t sts: 1
__IO uint32_t esf: 4
__IO uint32_t esdiv: 2
__IO uint32_t ecmben: 1
__IO uint32_t esp: 1
__IO uint32_t reserved2: 16
} stctrl_bit
};
tmr smc register, offset:0x08
union {
__IO uint32_t iden
struct {
__IO uint32_t ovfien: 1
__IO uint32_t c1ien: 1
__IO uint32_t c2ien: 1
__IO uint32_t c3ien: 1
__IO uint32_t c4ien: 1
__IO uint32_t hallien: 1
__IO uint32_t tien: 1
__IO uint32_t brkie: 1
__IO uint32_t ovfden: 1
__IO uint32_t c1den: 1
__IO uint32_t c2den: 1
__IO uint32_t c3den: 1
__IO uint32_t c4den: 1
__IO uint32_t hallde: 1
__IO uint32_t tden: 1
__IO uint32_t reserved1: 17
} iden_bit
};
tmr die register, offset:0x0C
union {
__IO uint32_t ists
struct {
__IO uint32_t ovfif: 1
__IO uint32_t c1if: 1
__IO uint32_t c2if: 1
__IO uint32_t c3if: 1
__IO uint32_t c4if: 1
__IO uint32_t hallif: 1
__IO uint32_t trgif: 1
__IO uint32_t brkif: 1
__IO uint32_t reserved1: 1
__IO uint32_t c1rf: 1
__IO uint32_t c2rf: 1
__IO uint32_t c3rf: 1
__IO uint32_t c4rf: 1
__IO uint32_t reserved2: 19
} ists_bit
};
tmr ists register, offset:0x10
union {
__IO uint32_t swevt
struct {
__IO uint32_t ovfswtr: 1
__IO uint32_t c1swtr: 1
__IO uint32_t c2swtr: 1
__IO uint32_t c3swtr: 1
__IO uint32_t c4swtr: 1
__IO uint32_t hallswtr: 1
__IO uint32_t trgswtr: 1
__IO uint32_t brkswtr: 1
__IO uint32_t reserved: 24
} swevt_bit
};
tmr eveg register, offset:0x14
union {
__IO uint32_t cm1
struct {
__IO uint32_t c1c: 2
__IO uint32_t c1oien: 1
__IO uint32_t c1oben: 1
__IO uint32_t c1octrl: 3
__IO uint32_t c1osen: 1
__IO uint32_t c2c: 2
__IO uint32_t c2oien: 1
__IO uint32_t c2oben: 1
__IO uint32_t c2octrl: 3
__IO uint32_t c2osen: 1
__IO uint32_t reserved1: 16
} cm1_output_bit
channel mode More...
struct {
__IO uint32_t c1c: 2
__IO uint32_t c1idiv: 2
__IO uint32_t c1df: 4
__IO uint32_t c2c: 2
__IO uint32_t c2idiv: 2
__IO uint32_t c2df: 4
__IO uint32_t reserved1: 16
} cm1_input_bit
input capture mode More...
};
tmr ccm1 register, offset:0x18
union {
__IO uint32_t cm2
struct {
__IO uint32_t c3c: 2
__IO uint32_t c3oien: 1
__IO uint32_t c3oben: 1
__IO uint32_t c3octrl: 3
__IO uint32_t c3osen: 1
__IO uint32_t c4c: 2
__IO uint32_t c4oien: 1
__IO uint32_t c4oben: 1
__IO uint32_t c4octrl: 3
__IO uint32_t c4osen: 1
__IO uint32_t reserved1: 16
} cm2_output_bit
channel mode More...
struct {
__IO uint32_t c3c: 2
__IO uint32_t c3idiv: 2
__IO uint32_t c3df: 4
__IO uint32_t c4c: 2
__IO uint32_t c4idiv: 2
__IO uint32_t c4df: 4
__IO uint32_t reserved1: 16
} cm2_input_bit
input capture mode More...
};
tmr ccm2 register, offset:0x1C
union {
uint32_t cctrl
struct {
__IO uint32_t c1en: 1
__IO uint32_t c1p: 1
__IO uint32_t c1cen: 1
__IO uint32_t c1cp: 1
__IO uint32_t c2en: 1
__IO uint32_t c2p: 1
__IO uint32_t c2cen: 1
__IO uint32_t c2cp: 1
__IO uint32_t c3en: 1
__IO uint32_t c3p: 1
__IO uint32_t c3cen: 1
__IO uint32_t c3cp: 1
__IO uint32_t c4en: 1
__IO uint32_t c4p: 1
__IO uint32_t reserved1: 18
} cctrl_bit
};
tmr cce register, offset:0x20
union {
__IO uint32_t cval
struct {
__IO uint32_t cval: 32
} cval_bit
};
tmr cnt register, offset:0x24
union {
__IO uint32_t div
struct {
__IO uint32_t div: 16
__IO uint32_t reserved1: 16
} div_bit
};
tmr div, offset:0x28
union {
__IO uint32_t pr
struct {
__IO uint32_t pr: 32
} pr_bit
};
tmr pr register, offset:0x2C
union {
__IO uint32_t rpr
struct {
__IO uint32_t rpr: 8
__IO uint32_t reserved1: 24
} rpr_bit
};
tmr rpr register, offset:0x30
union {
uint32_t c1dt
struct {
__IO uint32_t c1dt: 32
} c1dt_bit
};
tmr c1dt register, offset:0x34
union {
uint32_t c2dt
struct {
__IO uint32_t c2dt: 32
} c2dt_bit
};
tmr c2dt register, offset:0x38
union {
__IO uint32_t c3dt
struct {
__IO uint32_t c3dt: 32
} c3dt_bit
};
tmr c3dt register, offset:0x3C
union {
__IO uint32_t c4dt
struct {
__IO uint32_t c4dt: 32
} c4dt_bit
};
tmr c4dt register, offset:0x40
union {
__IO uint32_t brk
struct {
__IO uint32_t dtc: 8
__IO uint32_t wpc: 2
__IO uint32_t fcsodis: 1
__IO uint32_t fcsoen: 1
__IO uint32_t brken: 1
__IO uint32_t brkv: 1
__IO uint32_t aoen: 1
__IO uint32_t oen: 1
__IO uint32_t reserved1: 16
} brk_bit
};
tmr brk register, offset:0x44
union {
__IO uint32_t dmactrl
struct {
__IO uint32_t addr: 5
__IO uint32_t reserved1: 3
__IO uint32_t dtb: 5
__IO uint32_t reserved2: 19
} dmactrl_bit
};
tmr dmactrl register, offset:0x48
union {
__IO uint32_t dmadt
struct {
__IO uint32_t dmadt: 16
__IO uint32_t reserved1: 16
} dmadt_bit
};
tmr dmadt register, offset:0x4C

Detailed Description

type define tmr register all

Definition at line 435 of file at32f413_tmr.h.

Field Documentation

◆ [union]

union { ... } tmr_type

tmr ctrl1 register, offset:0x00

◆ [union]

union { ... } tmr_type

tmr ctrl2 register, offset:0x04

◆ [union]

union { ... } tmr_type

tmr smc register, offset:0x08

◆ [union]

union { ... } tmr_type

tmr die register, offset:0x0C

◆ [union]

union { ... } tmr_type

tmr ists register, offset:0x10

◆ [union]

union { ... } tmr_type

tmr eveg register, offset:0x14

◆ [union]

union { ... } tmr_type

tmr ccm1 register, offset:0x18

◆ [union]

union { ... } tmr_type

tmr ccm2 register, offset:0x1C

◆ [union]

union { ... } tmr_type

tmr cce register, offset:0x20

◆ [union]

union { ... } tmr_type

tmr cnt register, offset:0x24

◆ [union]

union { ... } tmr_type

tmr div, offset:0x28

◆ [union]

union { ... } tmr_type

tmr pr register, offset:0x2C

◆ [union]

union { ... } tmr_type

tmr rpr register, offset:0x30

◆ [union]

union { ... } tmr_type

tmr c1dt register, offset:0x34

◆ [union]

union { ... } tmr_type

tmr c2dt register, offset:0x38

◆ [union]

union { ... } tmr_type

tmr c3dt register, offset:0x3C

◆ [union]

union { ... } tmr_type

tmr c4dt register, offset:0x40

◆ [union]

union { ... } tmr_type

tmr brk register, offset:0x44

◆ [union]

union { ... } tmr_type

tmr dmactrl register, offset:0x48

◆ [union]

union { ... } tmr_type

tmr dmadt register, offset:0x4C

◆ addr

__IO uint32_t tmr_type::addr

Definition at line 805 of file at32f413_tmr.h.

Referenced by tmr_dma_control_config().

◆ aoen

__IO uint32_t tmr_type::aoen

Definition at line 792 of file at32f413_tmr.h.

Referenced by tmr_brkdt_config().

◆ brk

__IO uint32_t tmr_type::brk

Definition at line 783 of file at32f413_tmr.h.

◆ [struct]

struct { ... } tmr_type::brk_bit

Referenced by tmr_brkdt_config(), and tmr_output_enable().

◆ brken

__IO uint32_t tmr_type::brken

Definition at line 790 of file at32f413_tmr.h.

Referenced by tmr_brkdt_config().

◆ brkie

__IO uint32_t tmr_type::brkie

Definition at line 517 of file at32f413_tmr.h.

◆ brkif

__IO uint32_t tmr_type::brkif

Definition at line 544 of file at32f413_tmr.h.

◆ brkswtr

__IO uint32_t tmr_type::brkswtr

Definition at line 569 of file at32f413_tmr.h.

◆ brkv

__IO uint32_t tmr_type::brkv

Definition at line 791 of file at32f413_tmr.h.

Referenced by tmr_brkdt_config().

◆ c1c

__IO uint32_t tmr_type::c1c

Definition at line 586 of file at32f413_tmr.h.

Referenced by tmr_encoder_mode_config(), tmr_input_channel_init(), tmr_output_channel_config(), and tmr_pwm_input_config().

◆ c1cen

__IO uint32_t tmr_type::c1cen

Definition at line 664 of file at32f413_tmr.h.

Referenced by tmr_channel_enable().

◆ c1cios

__IO uint32_t tmr_type::c1cios

Definition at line 472 of file at32f413_tmr.h.

◆ c1cp

__IO uint32_t tmr_type::c1cp

Definition at line 665 of file at32f413_tmr.h.

Referenced by tmr_encoder_mode_config(), tmr_input_channel_init(), and tmr_output_channel_polarity_set().

◆ c1den

__IO uint32_t tmr_type::c1den

Definition at line 519 of file at32f413_tmr.h.

◆ c1df

__IO uint32_t tmr_type::c1df

Definition at line 606 of file at32f413_tmr.h.

Referenced by tmr_input_channel_filter_set(), tmr_input_channel_init(), and tmr_pwm_input_config().

◆ c1dt [1/2]

uint32_t tmr_type::c1dt

Definition at line 735 of file at32f413_tmr.h.

Referenced by tmr_channel_value_get(), and tmr_channel_value_set().

◆ c1dt [2/2]

__IO uint32_t tmr_type::c1dt

Definition at line 738 of file at32f413_tmr.h.

◆ [struct]

struct { ... } tmr_type::c1dt_bit

◆ c1en

__IO uint32_t tmr_type::c1en

Definition at line 662 of file at32f413_tmr.h.

Referenced by tmr_channel_enable(), tmr_encoder_mode_config(), tmr_input_channel_init(), and tmr_pwm_input_config().

◆ c1idiv

__IO uint32_t tmr_type::c1idiv

Definition at line 605 of file at32f413_tmr.h.

Referenced by tmr_input_channel_divider_set(), tmr_input_channel_init(), and tmr_pwm_input_config().

◆ c1ien

__IO uint32_t tmr_type::c1ien

Definition at line 511 of file at32f413_tmr.h.

◆ c1if

__IO uint32_t tmr_type::c1if

Definition at line 538 of file at32f413_tmr.h.

◆ c1insel

__IO uint32_t tmr_type::c1insel

Definition at line 470 of file at32f413_tmr.h.

Referenced by tmr_channel1_input_select().

◆ c1ios

__IO uint32_t tmr_type::c1ios

Definition at line 471 of file at32f413_tmr.h.

◆ c1oben

__IO uint32_t tmr_type::c1oben

Definition at line 588 of file at32f413_tmr.h.

Referenced by tmr_output_channel_buffer_enable().

◆ c1octrl

__IO uint32_t tmr_type::c1octrl

Definition at line 589 of file at32f413_tmr.h.

Referenced by tmr_force_output_set(), tmr_output_channel_config(), and tmr_output_channel_mode_select().

◆ c1oien

__IO uint32_t tmr_type::c1oien

Definition at line 587 of file at32f413_tmr.h.

Referenced by tmr_output_channel_immediately_set().

◆ c1osen

__IO uint32_t tmr_type::c1osen

Definition at line 590 of file at32f413_tmr.h.

Referenced by tmr_output_channel_switch_set().

◆ c1p

__IO uint32_t tmr_type::c1p

Definition at line 663 of file at32f413_tmr.h.

Referenced by tmr_encoder_mode_config(), tmr_input_channel_init(), tmr_output_channel_polarity_set(), and tmr_pwm_input_config().

◆ c1rf

__IO uint32_t tmr_type::c1rf

Definition at line 546 of file at32f413_tmr.h.

◆ c1swtr

__IO uint32_t tmr_type::c1swtr

Definition at line 563 of file at32f413_tmr.h.

◆ c2c

__IO uint32_t tmr_type::c2c

Definition at line 591 of file at32f413_tmr.h.

Referenced by tmr_encoder_mode_config(), tmr_input_channel_init(), tmr_output_channel_config(), and tmr_pwm_input_config().

◆ c2cen

__IO uint32_t tmr_type::c2cen

Definition at line 668 of file at32f413_tmr.h.

Referenced by tmr_channel_enable().

◆ c2cios

__IO uint32_t tmr_type::c2cios

Definition at line 474 of file at32f413_tmr.h.

◆ c2cp

__IO uint32_t tmr_type::c2cp

Definition at line 669 of file at32f413_tmr.h.

Referenced by tmr_encoder_mode_config(), tmr_input_channel_init(), and tmr_output_channel_polarity_set().

◆ c2den

__IO uint32_t tmr_type::c2den

Definition at line 520 of file at32f413_tmr.h.

◆ c2df

__IO uint32_t tmr_type::c2df

Definition at line 609 of file at32f413_tmr.h.

Referenced by tmr_input_channel_filter_set(), tmr_input_channel_init(), and tmr_pwm_input_config().

◆ c2dt [1/2]

uint32_t tmr_type::c2dt

Definition at line 747 of file at32f413_tmr.h.

Referenced by tmr_channel_value_get(), and tmr_channel_value_set().

◆ c2dt [2/2]

__IO uint32_t tmr_type::c2dt

Definition at line 750 of file at32f413_tmr.h.

◆ [struct]

struct { ... } tmr_type::c2dt_bit

◆ c2en

__IO uint32_t tmr_type::c2en

Definition at line 666 of file at32f413_tmr.h.

Referenced by tmr_channel_enable(), tmr_encoder_mode_config(), tmr_input_channel_init(), and tmr_pwm_input_config().

◆ c2idiv

__IO uint32_t tmr_type::c2idiv

Definition at line 608 of file at32f413_tmr.h.

Referenced by tmr_input_channel_divider_set(), tmr_input_channel_init(), and tmr_pwm_input_config().

◆ c2ien

__IO uint32_t tmr_type::c2ien

Definition at line 512 of file at32f413_tmr.h.

◆ c2if

__IO uint32_t tmr_type::c2if

Definition at line 539 of file at32f413_tmr.h.

◆ c2ios

__IO uint32_t tmr_type::c2ios

Definition at line 473 of file at32f413_tmr.h.

◆ c2oben

__IO uint32_t tmr_type::c2oben

Definition at line 593 of file at32f413_tmr.h.

Referenced by tmr_output_channel_buffer_enable().

◆ c2octrl

__IO uint32_t tmr_type::c2octrl

Definition at line 594 of file at32f413_tmr.h.

Referenced by tmr_force_output_set(), tmr_output_channel_config(), and tmr_output_channel_mode_select().

◆ c2oien

__IO uint32_t tmr_type::c2oien

Definition at line 592 of file at32f413_tmr.h.

Referenced by tmr_output_channel_immediately_set().

◆ c2osen

__IO uint32_t tmr_type::c2osen

Definition at line 595 of file at32f413_tmr.h.

Referenced by tmr_output_channel_switch_set().

◆ c2p

__IO uint32_t tmr_type::c2p

Definition at line 667 of file at32f413_tmr.h.

Referenced by tmr_encoder_mode_config(), tmr_input_channel_init(), tmr_output_channel_polarity_set(), and tmr_pwm_input_config().

◆ c2rf

__IO uint32_t tmr_type::c2rf

Definition at line 547 of file at32f413_tmr.h.

◆ c2swtr

__IO uint32_t tmr_type::c2swtr

Definition at line 564 of file at32f413_tmr.h.

◆ c3c

__IO uint32_t tmr_type::c3c

Definition at line 626 of file at32f413_tmr.h.

Referenced by tmr_input_channel_init(), and tmr_output_channel_config().

◆ c3cen

__IO uint32_t tmr_type::c3cen

Definition at line 672 of file at32f413_tmr.h.

Referenced by tmr_channel_enable().

◆ c3cios

__IO uint32_t tmr_type::c3cios

Definition at line 476 of file at32f413_tmr.h.

◆ c3cp

__IO uint32_t tmr_type::c3cp

Definition at line 673 of file at32f413_tmr.h.

Referenced by tmr_input_channel_init(), and tmr_output_channel_polarity_set().

◆ c3den

__IO uint32_t tmr_type::c3den

Definition at line 521 of file at32f413_tmr.h.

◆ c3df

__IO uint32_t tmr_type::c3df

Definition at line 646 of file at32f413_tmr.h.

Referenced by tmr_input_channel_filter_set(), and tmr_input_channel_init().

◆ c3dt

__IO uint32_t tmr_type::c3dt

Definition at line 759 of file at32f413_tmr.h.

Referenced by tmr_channel_value_get(), and tmr_channel_value_set().

◆ [struct]

struct { ... } tmr_type::c3dt_bit

◆ c3en

__IO uint32_t tmr_type::c3en

Definition at line 670 of file at32f413_tmr.h.

Referenced by tmr_channel_enable(), and tmr_input_channel_init().

◆ c3idiv

__IO uint32_t tmr_type::c3idiv

Definition at line 645 of file at32f413_tmr.h.

Referenced by tmr_input_channel_divider_set(), and tmr_input_channel_init().

◆ c3ien

__IO uint32_t tmr_type::c3ien

Definition at line 513 of file at32f413_tmr.h.

◆ c3if

__IO uint32_t tmr_type::c3if

Definition at line 540 of file at32f413_tmr.h.

◆ c3ios

__IO uint32_t tmr_type::c3ios

Definition at line 475 of file at32f413_tmr.h.

◆ c3oben

__IO uint32_t tmr_type::c3oben

Definition at line 628 of file at32f413_tmr.h.

Referenced by tmr_output_channel_buffer_enable().

◆ c3octrl

__IO uint32_t tmr_type::c3octrl

Definition at line 629 of file at32f413_tmr.h.

Referenced by tmr_force_output_set(), tmr_output_channel_config(), and tmr_output_channel_mode_select().

◆ c3oien

__IO uint32_t tmr_type::c3oien

Definition at line 627 of file at32f413_tmr.h.

Referenced by tmr_output_channel_immediately_set().

◆ c3osen

__IO uint32_t tmr_type::c3osen

Definition at line 630 of file at32f413_tmr.h.

Referenced by tmr_output_channel_switch_set().

◆ c3p

__IO uint32_t tmr_type::c3p

Definition at line 671 of file at32f413_tmr.h.

Referenced by tmr_input_channel_init(), and tmr_output_channel_polarity_set().

◆ c3rf

__IO uint32_t tmr_type::c3rf

Definition at line 548 of file at32f413_tmr.h.

◆ c3swtr

__IO uint32_t tmr_type::c3swtr

Definition at line 565 of file at32f413_tmr.h.

◆ c4c

__IO uint32_t tmr_type::c4c

Definition at line 631 of file at32f413_tmr.h.

Referenced by tmr_input_channel_init(), and tmr_output_channel_config().

◆ c4den

__IO uint32_t tmr_type::c4den

Definition at line 522 of file at32f413_tmr.h.

◆ c4df

__IO uint32_t tmr_type::c4df

Definition at line 649 of file at32f413_tmr.h.

Referenced by tmr_input_channel_filter_set(), and tmr_input_channel_init().

◆ c4dt

__IO uint32_t tmr_type::c4dt

Definition at line 771 of file at32f413_tmr.h.

Referenced by tmr_channel_value_get(), and tmr_channel_value_set().

◆ [struct]

struct { ... } tmr_type::c4dt_bit

◆ c4en

__IO uint32_t tmr_type::c4en

Definition at line 674 of file at32f413_tmr.h.

Referenced by tmr_channel_enable(), and tmr_input_channel_init().

◆ c4idiv

__IO uint32_t tmr_type::c4idiv

Definition at line 648 of file at32f413_tmr.h.

Referenced by tmr_input_channel_divider_set(), and tmr_input_channel_init().

◆ c4ien

__IO uint32_t tmr_type::c4ien

Definition at line 514 of file at32f413_tmr.h.

◆ c4if

__IO uint32_t tmr_type::c4if

Definition at line 541 of file at32f413_tmr.h.

◆ c4ios

__IO uint32_t tmr_type::c4ios

Definition at line 477 of file at32f413_tmr.h.

◆ c4oben

__IO uint32_t tmr_type::c4oben

Definition at line 633 of file at32f413_tmr.h.

Referenced by tmr_output_channel_buffer_enable().

◆ c4octrl

__IO uint32_t tmr_type::c4octrl

Definition at line 634 of file at32f413_tmr.h.

Referenced by tmr_force_output_set(), tmr_output_channel_config(), and tmr_output_channel_mode_select().

◆ c4oien

__IO uint32_t tmr_type::c4oien

Definition at line 632 of file at32f413_tmr.h.

Referenced by tmr_output_channel_immediately_set().

◆ c4osen

__IO uint32_t tmr_type::c4osen

Definition at line 635 of file at32f413_tmr.h.

Referenced by tmr_output_channel_switch_set().

◆ c4p

__IO uint32_t tmr_type::c4p

Definition at line 675 of file at32f413_tmr.h.

Referenced by tmr_input_channel_init(), and tmr_output_channel_polarity_set().

◆ c4rf

__IO uint32_t tmr_type::c4rf

Definition at line 549 of file at32f413_tmr.h.

◆ c4swtr

__IO uint32_t tmr_type::c4swtr

Definition at line 566 of file at32f413_tmr.h.

◆ cbctrl

__IO uint32_t tmr_type::cbctrl

Definition at line 465 of file at32f413_tmr.h.

Referenced by tmr_channel_buffer_enable().

◆ ccfs

__IO uint32_t tmr_type::ccfs

Definition at line 467 of file at32f413_tmr.h.

Referenced by tmr_hall_select().

◆ cctrl

uint32_t tmr_type::cctrl

Definition at line 659 of file at32f413_tmr.h.

Referenced by tmr_output_channel_config().

◆ [struct]

struct { ... } tmr_type::cctrl_bit

Referenced by tmr_channel_enable(), tmr_encoder_mode_config(), tmr_input_channel_init(), tmr_output_channel_polarity_set(), and tmr_pwm_input_config().

◆ clkdiv

__IO uint32_t tmr_type::clkdiv

Definition at line 451 of file at32f413_tmr.h.

Referenced by tmr_clock_source_div_set().

◆ cm1

__IO uint32_t tmr_type::cm1

Definition at line 579 of file at32f413_tmr.h.

◆ [struct]

struct { ... } tmr_type::cm1_input_bit

input capture mode

Referenced by tmr_encoder_mode_config(), tmr_input_channel_divider_set(), tmr_input_channel_filter_set(), tmr_input_channel_init(), and tmr_pwm_input_config().

◆ [struct]

struct { ... } tmr_type::cm1_output_bit

channel mode

Referenced by tmr_force_output_set(), tmr_output_channel_buffer_enable(), tmr_output_channel_config(), tmr_output_channel_immediately_set(), tmr_output_channel_mode_select(), and tmr_output_channel_switch_set().

◆ cm2

__IO uint32_t tmr_type::cm2

Definition at line 619 of file at32f413_tmr.h.

◆ [struct]

struct { ... } tmr_type::cm2_input_bit

input capture mode

Referenced by tmr_input_channel_divider_set(), tmr_input_channel_filter_set(), and tmr_input_channel_init().

◆ [struct]

struct { ... } tmr_type::cm2_output_bit

channel mode

Referenced by tmr_force_output_set(), tmr_output_channel_buffer_enable(), tmr_output_channel_config(), tmr_output_channel_immediately_set(), tmr_output_channel_mode_select(), and tmr_output_channel_switch_set().

◆ cnt_dir

__IO uint32_t tmr_type::cnt_dir

Definition at line 449 of file at32f413_tmr.h.

Referenced by tmr_cnt_dir_set().

◆ ctrl1

__IO uint32_t tmr_type::ctrl1

Definition at line 442 of file at32f413_tmr.h.

◆ [struct]

struct { ... } tmr_type::ctrl1_bit

Referenced by tmr_32_bit_function_enable(), tmr_clock_source_div_set(), tmr_cnt_dir_set(), tmr_counter_enable(), tmr_one_cycle_mode_enable(), tmr_overflow_event_disable(), tmr_overflow_request_source_set(), and tmr_period_buffer_enable().

◆ ctrl2

__IO uint32_t tmr_type::ctrl2

Definition at line 462 of file at32f413_tmr.h.

Referenced by tmr_output_channel_config().

◆ [struct]

struct { ... } tmr_type::ctrl2_bit

Referenced by tmr_channel1_input_select(), tmr_channel_buffer_enable(), tmr_channel_dma_select(), tmr_hall_select(), and tmr_primary_mode_select().

◆ cval

__IO uint32_t tmr_type::cval

Definition at line 685 of file at32f413_tmr.h.

Referenced by tmr_counter_value_get(), and tmr_counter_value_set().

◆ [struct]

struct { ... } tmr_type::cval_bit

◆ div

__IO uint32_t tmr_type::div

Definition at line 697 of file at32f413_tmr.h.

Referenced by tmr_base_init(), tmr_div_value_get(), and tmr_div_value_set().

◆ [struct]

struct { ... } tmr_type::div_bit

◆ dmactrl

__IO uint32_t tmr_type::dmactrl

Definition at line 802 of file at32f413_tmr.h.

◆ [struct]

struct { ... } tmr_type::dmactrl_bit

Referenced by tmr_dma_control_config().

◆ dmadt

__IO uint32_t tmr_type::dmadt

Definition at line 817 of file at32f413_tmr.h.

◆ [struct]

struct { ... } tmr_type::dmadt_bit

◆ drs

__IO uint32_t tmr_type::drs

Definition at line 468 of file at32f413_tmr.h.

Referenced by tmr_channel_dma_select().

◆ dtb

__IO uint32_t tmr_type::dtb

Definition at line 807 of file at32f413_tmr.h.

Referenced by tmr_dma_control_config().

◆ dtc

__IO uint32_t tmr_type::dtc

Definition at line 786 of file at32f413_tmr.h.

Referenced by tmr_brkdt_config().

◆ ecmben

__IO uint32_t tmr_type::ecmben

Definition at line 496 of file at32f413_tmr.h.

Referenced by tmr_external_clock_mode2_config().

◆ esdiv

__IO uint32_t tmr_type::esdiv

Definition at line 495 of file at32f413_tmr.h.

Referenced by tmr_external_clock_config().

◆ esf

__IO uint32_t tmr_type::esf

Definition at line 494 of file at32f413_tmr.h.

Referenced by tmr_external_clock_config().

◆ esp

__IO uint32_t tmr_type::esp

Definition at line 497 of file at32f413_tmr.h.

Referenced by tmr_external_clock_config().

◆ fcsodis

__IO uint32_t tmr_type::fcsodis

Definition at line 788 of file at32f413_tmr.h.

Referenced by tmr_brkdt_config().

◆ fcsoen

__IO uint32_t tmr_type::fcsoen

Definition at line 789 of file at32f413_tmr.h.

Referenced by tmr_brkdt_config().

◆ hallde

__IO uint32_t tmr_type::hallde

Definition at line 523 of file at32f413_tmr.h.

◆ hallien

__IO uint32_t tmr_type::hallien

Definition at line 515 of file at32f413_tmr.h.

◆ hallif

__IO uint32_t tmr_type::hallif

Definition at line 542 of file at32f413_tmr.h.

◆ hallswtr

__IO uint32_t tmr_type::hallswtr

Definition at line 567 of file at32f413_tmr.h.

◆ iden

__IO uint32_t tmr_type::iden

Definition at line 507 of file at32f413_tmr.h.

Referenced by tmr_dma_request_enable(), tmr_interrupt_enable(), and tmr_interrupt_flag_get().

◆ [struct]

struct { ... } tmr_type::iden_bit

◆ ists

__IO uint32_t tmr_type::ists

Definition at line 534 of file at32f413_tmr.h.

Referenced by tmr_flag_clear(), tmr_flag_get(), and tmr_interrupt_flag_get().

◆ [struct]

struct { ... } tmr_type::ists_bit

◆ ocmen

__IO uint32_t tmr_type::ocmen

Definition at line 448 of file at32f413_tmr.h.

Referenced by tmr_one_cycle_mode_enable().

◆ oen

__IO uint32_t tmr_type::oen

Definition at line 793 of file at32f413_tmr.h.

Referenced by tmr_output_enable().

◆ ovfden

__IO uint32_t tmr_type::ovfden

Definition at line 518 of file at32f413_tmr.h.

◆ ovfen

__IO uint32_t tmr_type::ovfen

Definition at line 446 of file at32f413_tmr.h.

Referenced by tmr_overflow_event_disable().

◆ ovfien

__IO uint32_t tmr_type::ovfien

Definition at line 510 of file at32f413_tmr.h.

◆ ovfif

__IO uint32_t tmr_type::ovfif

Definition at line 537 of file at32f413_tmr.h.

◆ ovfs

__IO uint32_t tmr_type::ovfs

Definition at line 447 of file at32f413_tmr.h.

Referenced by tmr_overflow_request_source_set().

◆ ovfswtr

__IO uint32_t tmr_type::ovfswtr

Definition at line 562 of file at32f413_tmr.h.

Referenced by tmr_base_init().

◆ pmen

__IO uint32_t tmr_type::pmen

Definition at line 452 of file at32f413_tmr.h.

Referenced by tmr_32_bit_function_enable().

◆ pr

__IO uint32_t tmr_type::pr

Definition at line 710 of file at32f413_tmr.h.

Referenced by tmr_base_init(), tmr_period_value_get(), and tmr_period_value_set().

◆ [struct]

struct { ... } tmr_type::pr_bit

◆ prben

__IO uint32_t tmr_type::prben

Definition at line 450 of file at32f413_tmr.h.

Referenced by tmr_period_buffer_enable().

◆ ptos

__IO uint32_t tmr_type::ptos

Definition at line 469 of file at32f413_tmr.h.

Referenced by tmr_primary_mode_select().

◆ reserved

__IO uint32_t tmr_type::reserved

Definition at line 570 of file at32f413_tmr.h.

◆ reserved1

__IO uint32_t tmr_type::reserved1

Definition at line 453 of file at32f413_tmr.h.

◆ reserved2

__IO uint32_t tmr_type::reserved2

Definition at line 478 of file at32f413_tmr.h.

◆ rpr

__IO uint32_t tmr_type::rpr

Definition at line 722 of file at32f413_tmr.h.

Referenced by tmr_repetition_counter_set().

◆ [struct]

struct { ... } tmr_type::rpr_bit

Referenced by tmr_repetition_counter_set().

◆ smsel

__IO uint32_t tmr_type::smsel

Definition at line 490 of file at32f413_tmr.h.

Referenced by tmr_encoder_mode_config(), tmr_external_clock_mode1_config(), tmr_internal_clock_set(), and tmr_sub_mode_select().

◆ stctrl

__IO uint32_t tmr_type::stctrl

Definition at line 487 of file at32f413_tmr.h.

◆ [struct]

struct { ... } tmr_type::stctrl_bit

Referenced by tmr_encoder_mode_config(), tmr_external_clock_config(), tmr_external_clock_mode1_config(), tmr_external_clock_mode2_config(), tmr_internal_clock_set(), tmr_sub_mode_select(), tmr_sub_sync_mode_set(), and tmr_trigger_input_select().

◆ stis

__IO uint32_t tmr_type::stis

Definition at line 492 of file at32f413_tmr.h.

Referenced by tmr_external_clock_mode1_config(), and tmr_trigger_input_select().

◆ sts

__IO uint32_t tmr_type::sts

Definition at line 493 of file at32f413_tmr.h.

Referenced by tmr_sub_sync_mode_set().

◆ swevt

__IO uint32_t tmr_type::swevt

Definition at line 559 of file at32f413_tmr.h.

Referenced by tmr_event_sw_trigger().

◆ [struct]

struct { ... } tmr_type::swevt_bit

Referenced by tmr_base_init().

◆ tden

__IO uint32_t tmr_type::tden

Definition at line 524 of file at32f413_tmr.h.

◆ tien

__IO uint32_t tmr_type::tien

Definition at line 516 of file at32f413_tmr.h.

◆ tmren

__IO uint32_t tmr_type::tmren

Definition at line 445 of file at32f413_tmr.h.

Referenced by tmr_counter_enable().

◆ trgif

__IO uint32_t tmr_type::trgif

Definition at line 543 of file at32f413_tmr.h.

◆ trgswtr

__IO uint32_t tmr_type::trgswtr

Definition at line 568 of file at32f413_tmr.h.

◆ wpc

__IO uint32_t tmr_type::wpc

Definition at line 787 of file at32f413_tmr.h.

Referenced by tmr_brkdt_config().

The documentation for this struct was generated from the following file:
  • at32f413_tmr.h


AT32F413 Firmwary Library: TMR_exported_functions

Functions
TMR_exported_functions
AT32F413_periph_driver » TMR

Functions

void | tmr_reset (tmr_type *tmr_x)
tmr reset by crm reset register
void | tmr_counter_enable (tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr counter
void | tmr_output_default_para_init (tmr_output_config_type *tmr_output_struct)
init tmr output default para
void | tmr_input_default_para_init (tmr_input_config_type *tmr_input_struct)
init tmr input default para
void | tmr_brkdt_default_para_init (tmr_brkdt_config_type *tmr_brkdt_struct)
init tmr brkdt default para
void | tmr_base_init (tmr_type *tmr_x, uint32_t tmr_pr, uint32_t tmr_div)
init tmr base
void | tmr_clock_source_div_set (tmr_type *tmr_x, tmr_clock_division_type tmr_clock_div)
set tmr clock source division
void | tmr_cnt_dir_set (tmr_type *tmr_x, tmr_count_mode_type tmr_cnt_dir)
set tmr counter count direction
void | tmr_repetition_counter_set (tmr_type *tmr_x, uint8_t tmr_rpr_value)
set the repetition counter register(rpr) value
void | tmr_counter_value_set (tmr_type *tmr_x, uint32_t tmr_cnt_value)
set tmr counter value
uint32_t | tmr_counter_value_get (tmr_type *tmr_x)
get tmr counter value
void | tmr_div_value_set (tmr_type *tmr_x, uint32_t tmr_div_value)
set tmr div value
uint32_t | tmr_div_value_get (tmr_type *tmr_x)
get tmr div value
void | tmr_output_channel_config (tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_output_config_type *tmr_output_struct)
config tmr output channel
void | tmr_output_channel_mode_select (tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_output_control_mode_type oc_mode)
select tmr output channel mode
void | tmr_period_value_set (tmr_type *tmr_x, uint32_t tmr_pr_value)
set tmr period value
uint32_t | tmr_period_value_get (tmr_type *tmr_x)
get tmr period value
void | tmr_channel_value_set (tmr_type *tmr_x, tmr_channel_select_type tmr_channel, uint32_t tmr_channel_value)
set tmr channel value
uint32_t | tmr_channel_value_get (tmr_type *tmr_x, tmr_channel_select_type tmr_channel)
get tmr channel value
void | tmr_period_buffer_enable (tmr_type *tmr_x, confirm_state new_state)
enable tmr period buffer
void | tmr_output_channel_buffer_enable (tmr_type *tmr_x, tmr_channel_select_type tmr_channel, confirm_state new_state)
enable tmr output channel buffer
void | tmr_output_channel_immediately_set (tmr_type *tmr_x, tmr_channel_select_type tmr_channel, confirm_state new_state)
set tmr output channel immediately
void | tmr_output_channel_switch_set (tmr_type *tmr_x, tmr_channel_select_type tmr_channel, confirm_state new_state)
set tmr output channel switch
void | tmr_one_cycle_mode_enable (tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr one cycle mode
void | tmr_32_bit_function_enable (tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr 32 bit function(plus mode)
void | tmr_overflow_request_source_set (tmr_type *tmr_x, confirm_state new_state)
select tmr the overflow event sources
void | tmr_overflow_event_disable (tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr overflow event generation
void | tmr_input_channel_init (tmr_type *tmr_x, tmr_input_config_type *input_struct, tmr_channel_input_divider_type divider_factor)
init tmr input channel
void | tmr_channel_enable (tmr_type *tmr_x, tmr_channel_select_type tmr_channel, confirm_state new_state)
tmr channel enable
void | tmr_input_channel_filter_set (tmr_type *tmr_x, tmr_channel_select_type tmr_channel, uint16_t filter_value)
set tmr input channel filter
void | tmr_pwm_input_config (tmr_type *tmr_x, tmr_input_config_type *input_struct, tmr_channel_input_divider_type divider_factor)
config tmr pwm input
void | tmr_channel1_input_select (tmr_type *tmr_x, tmr_channel1_input_connected_type ch1_connect)
select tmr channel1 input
void | tmr_input_channel_divider_set (tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_channel_input_divider_type divider_factor)
set tmr input channel divider
void | tmr_primary_mode_select (tmr_type *tmr_x, tmr_primary_select_type primary_mode)
select tmr primary mode
void | tmr_sub_mode_select (tmr_type *tmr_x, tmr_sub_mode_select_type sub_mode)
select tmr subordinate mode
void | tmr_channel_dma_select (tmr_type *tmr_x, tmr_dma_request_source_type cc_dma_select)
select tmr channel dma
void | tmr_hall_select (tmr_type *tmr_x, confirm_state new_state)
select tmr hall
void | tmr_channel_buffer_enable (tmr_type *tmr_x, confirm_state new_state)
enable tmr channel buffer
void | tmr_trigger_input_select (tmr_type *tmr_x, sub_tmr_input_sel_type trigger_select)
select tmr sub-trigger
void | tmr_sub_sync_mode_set (tmr_type *tmr_x, confirm_state new_state)
set tmr subordinate synchronization mode
void | tmr_dma_request_enable (tmr_type *tmr_x, tmr_dma_request_type dma_request, confirm_state new_state)
enable or disable tmr dma request
void | tmr_interrupt_enable (tmr_type *tmr_x, uint32_t tmr_interrupt, confirm_state new_state)
enable or disable tmr interrupt
flag_status | tmr_interrupt_flag_get (tmr_type *tmr_x, uint32_t tmr_flag)
get tmr interrupt flag
flag_status | tmr_flag_get (tmr_type *tmr_x, uint32_t tmr_flag)
get tmr flag
void | tmr_flag_clear (tmr_type *tmr_x, uint32_t tmr_flag)
clear tmr flag
void | tmr_event_sw_trigger (tmr_type *tmr_x, tmr_event_trigger_type tmr_event)
generate tmr event
void | tmr_output_enable (tmr_type *tmr_x, confirm_state new_state)
tmr output enable(oen),this function is important for advtm output enable
void | tmr_internal_clock_set (tmr_type *tmr_x)
set tmr select internal clock
void | tmr_output_channel_polarity_set (tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_polarity_active_type oc_polarity)
set tmr output channel polarity
void | tmr_external_clock_config (tmr_type *tmr_x, tmr_external_signal_divider_type es_divide, tmr_external_signal_polarity_type es_polarity, uint16_t es_filter)
config tmr external clock
void | tmr_external_clock_mode1_config (tmr_type *tmr_x, tmr_external_signal_divider_type es_divide, tmr_external_signal_polarity_type es_polarity, uint16_t es_filter)
config tmr external clock mode1
void | tmr_external_clock_mode2_config (tmr_type *tmr_x, tmr_external_signal_divider_type es_divide, tmr_external_signal_polarity_type es_polarity, uint16_t es_filter)
config tmr external clock mode2
void | tmr_encoder_mode_config (tmr_type *tmr_x, tmr_encoder_mode_type encoder_mode, tmr_input_polarity_type ic1_polarity, tmr_input_polarity_type ic2_polarity)
config tmr encoder mode
void | tmr_force_output_set (tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_force_output_type force_output)
set tmr force output
void | tmr_dma_control_config (tmr_type *tmr_x, tmr_dma_transfer_length_type dma_length, tmr_dma_address_type dma_base_address)
config tmr dma control
void | tmr_brkdt_config (tmr_type *tmr_x, tmr_brkdt_config_type *brkdt_struct)
config tmr brake mode and dead-time

Detailed Description

Function Documentation

◆ tmr_32_bit_function_enable()

void tmr_32_bit_function_enable | ( | tmr_type * | tmr_x,
 |  | confirm_state | new_state )

enable or disable tmr 32 bit function(plus mode)

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR2, TMR5
new_state | (TRUE or FALSE)
Return values
none

Definition at line 758 of file at32f413_tmr.c.

Referenced by main().

◆ tmr_base_init()

void tmr_base_init | ( | tmr_type * | tmr_x,
 |  | uint32_t | tmr_pr,
 |  | uint32_t | tmr_div )

init tmr base

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_pr | (for 16 bit tmr 0x0000~0xFFFF, for 32 bit tmr 0x0000_0000~0xFFFF_FFFF)
tmr_div | (timer div value:0x0000~0xFFFF)
Return values
none

Definition at line 179 of file at32f413_tmr.c.

Referenced by main(), mclk_tmr1_init(), tmr1_config(), tmr1_config(), tmr2_config(), and tmr_init().

◆ tmr_brkdt_config()

void tmr_brkdt_config | ( | tmr_type * | tmr_x,
 |  | tmr_brkdt_config_type * | brkdt_struct )

config tmr brake mode and dead-time

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR8
brkdt_struct
  • to the structure of tmr_brkdt_config_type
Return values
none

Definition at line 1769 of file at32f413_tmr.c.

Referenced by main().

◆ tmr_brkdt_default_para_init()

void tmr_brkdt_default_para_init ( tmr_brkdt_config_type * tmr_brkdt_struct )

init tmr brkdt default para

Parameters
tmr_brkdt_struct
  • to the structure of tmr_brkdt_config_type
Return values
none

Definition at line 157 of file at32f413_tmr.c.

Referenced by main().

◆ tmr_channel1_input_select()

void tmr_channel1_input_select | ( | tmr_type * | tmr_x,
 |  | tmr_channel1_input_connected_type | ch1_connect )

select tmr channel1 input

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8
ch1_connect this parameter can be one of the following values:
  • TMR_CHANEL1_CONNECTED_C1IRAW
  • TMR_CHANEL1_2_3_CONNECTED_C1IRAW_XOR
Return values
none

Definition at line 1102 of file at32f413_tmr.c.

Referenced by main().

◆ tmr_channel_buffer_enable()

void tmr_channel_buffer_enable | ( | tmr_type * | tmr_x,
 |  | confirm_state | new_state )

enable tmr channel buffer

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR8
new_state | (TRUE or FALSE)
Return values
none

Definition at line 1238 of file at32f413_tmr.c.

Referenced by main().

◆ tmr_channel_dma_select()

void tmr_channel_dma_select | ( | tmr_type * | tmr_x,
 |  | tmr_dma_request_source_type | cc_dma_select )

select tmr channel dma

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9
cc_dma_select this parameter can be one of the following values:
  • TMR_DMA_REQUEST_BY_CHANNEL
  • TMR_DMA_REQUEST_BY_OVERFLOW
Return values
none

Definition at line 1212 of file at32f413_tmr.c.

◆ tmr_channel_enable()

void tmr_channel_enable | ( | tmr_type * | tmr_x,
 |  | tmr_channel_select_type | tmr_channel,
 |  | confirm_state | new_state )

tmr channel enable

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_channel this parameter can be one of the following values:
  • TMR_SELECT_CHANNEL_1
  • TMR_SELECT_CHANNEL_1C
  • TMR_SELECT_CHANNEL_2
  • TMR_SELECT_CHANNEL_2C
  • TMR_SELECT_CHANNEL_3
  • TMR_SELECT_CHANNEL_3C
  • TMR_SELECT_CHANNEL_4
new_state | (TRUE or FALSE)
Return values
none

Definition at line 888 of file at32f413_tmr.c.

Referenced by main(), and TMR1_TRG_HALL_TMR11_IRQHandler().

◆ tmr_channel_value_get()

uint32_t tmr_channel_value_get | ( | tmr_type * | tmr_x,
 |  | tmr_channel_select_type | tmr_channel )

get tmr channel value

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_channel this parameter can be one of the following values:
  • TMR_SELECT_CHANNEL_1
  • TMR_SELECT_CHANNEL_2
  • TMR_SELECT_CHANNEL_3
  • TMR_SELECT_CHANNEL_4
Return values
tmr channel value

Definition at line 551 of file at32f413_tmr.c.

Referenced by TMR1_BRK_TMR9_IRQHandler(), TMR2_GLOBAL_IRQHandler(), and TMR3_GLOBAL_IRQHandler().

◆ tmr_channel_value_set()

void tmr_channel_value_set | ( | tmr_type * | tmr_x,
 |  | tmr_channel_select_type | tmr_channel,
 |  | uint32_t | tmr_channel_value )

set tmr channel value

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_channel this parameter can be one of the following values:
  • TMR_SELECT_CHANNEL_1
  • TMR_SELECT_CHANNEL_2
  • TMR_SELECT_CHANNEL_3
  • TMR_SELECT_CHANNEL_4
tmr_channel_value | (for 16 bit tmr 0x0000~0xFFFF, for 32 bit tmr 0x0000_0000~0xFFFF_FFFF)
Return values
none

Definition at line 506 of file at32f413_tmr.c.

Referenced by main(), mclk_tmr1_init(), TMR1_BRK_TMR9_IRQHandler(), tmr1_config(), TMR2_GLOBAL_IRQHandler(), and TMR3_GLOBAL_IRQHandler().

◆ tmr_clock_source_div_set()

void tmr_clock_source_div_set | ( | tmr_type * | tmr_x,
 |  | tmr_clock_division_type | tmr_clock_div )

set tmr clock source division

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_clock_div this parameter can be one of the following values:
  • TMR_CLOCK_DIV1
  • TMR_CLOCK_DIV2
  • TMR_CLOCK_DIV4
Return values
none

Definition at line 204 of file at32f413_tmr.c.

Referenced by main(), mclk_tmr1_init(), tmr1_config(), tmr1_config(), and tmr2_config().

◆ tmr_cnt_dir_set()

void tmr_cnt_dir_set | ( | tmr_type * | tmr_x,
 |  | tmr_count_mode_type | tmr_cnt_dir )

set tmr counter count direction

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_cnt_dir this parameter can be one of the following values:
  • TMR_COUNT_UP
  • TMR_COUNT_DOWN
  • TMR_COUNT_TWO_WAY_1
  • TMR_COUNT_TWO_WAY_2
  • TMR_COUNT_TWO_WAY_3
Return values
none

Definition at line 225 of file at32f413_tmr.c.

Referenced by main(), mclk_tmr1_init(), tmr1_config(), tmr1_config(), tmr2_config(), and tmr_init().

◆ tmr_counter_enable()

void tmr_counter_enable | ( | tmr_type * | tmr_x,
 |  | confirm_state | new_state )

enable or disable tmr counter

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
new_state | (TRUE or FALSE)
Return values
none

Definition at line 114 of file at32f413_tmr.c.

Referenced by main(), mclk_tmr1_init(), tmr2_config(), TMR5_GLOBAL_IRQHandler(), and tmr_init().

◆ tmr_counter_value_get()

uint32_t tmr_counter_value_get ( tmr_type * tmr_x )

get tmr counter value

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
Return values
tmr counter value

Definition at line 269 of file at32f413_tmr.c.

Referenced by main().

◆ tmr_counter_value_set()

void tmr_counter_value_set | ( | tmr_type * | tmr_x,
 |  | uint32_t | tmr_cnt_value )

set tmr counter value

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_cnt_value | (for 16 bit tmr 0x0000~0xFFFF, for 32 bit tmr 0x0000_0000~0xFFFF_FFFF)
Return values
none

Definition at line 255 of file at32f413_tmr.c.

◆ tmr_div_value_get()

uint32_t tmr_div_value_get ( tmr_type * tmr_x )

get tmr div value

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
Return values
tmr div value

Definition at line 297 of file at32f413_tmr.c.

◆ tmr_div_value_set()

void tmr_div_value_set | ( | tmr_type * | tmr_x,
 |  | uint32_t | tmr_div_value )

set tmr div value

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_div_value | (0x0000~0xFFFF)
Return values
none

Definition at line 283 of file at32f413_tmr.c.

◆ tmr_dma_control_config()

void tmr_dma_control_config | ( | tmr_type * | tmr_x,
 |  | tmr_dma_transfer_length_type | dma_length,
 |  | tmr_dma_address_type | dma_base_address )

config tmr dma control

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8
dma_length this parameter can be one of the following values:
  • TMR_DMA_TRANSFER_1BYTE
  • TMR_DMA_TRANSFER_2BYTES
  • TMR_DMA_TRANSFER_3BYTES ...
  • TMR_DMA_TRANSFER_17BYTES
  • TMR_DMA_TRANSFER_18BYTES
dma_base_address this parameter can be one of the following values:
  • TMR_CTRL1_ADDRESS
  • TMR_CTRL2_ADDRESS
  • TMR_STCTRL_ADDRESS
  • TMR_IDEN_ADDRESS
  • TMR_ISTS_ADDRESS
  • TMR_SWEVT_ADDRESS
  • TMR_CM1_ADDRESS
  • TMR_CM2_ADDRESS
  • TMR_CCTRL_ADDRESS
  • TMR_CVAL_ADDRESS
  • TMR_DIV_ADDRESS
  • TMR_PR_ADDRESS
  • TMR_RPR_ADDRESS
  • TMR_C1DT_ADDRESS
  • TMR_C2DT_ADDRESS
  • TMR_C3DT_ADDRESS
  • TMR_C4DT_ADDRESS
  • TMR_BRK_ADDRESS
  • TMR_DMACTRL_ADDRESS
Return values
none

Definition at line 1753 of file at32f413_tmr.c.

Referenced by main().

◆ tmr_dma_request_enable()

void tmr_dma_request_enable | ( | tmr_type * | tmr_x,
 |  | tmr_dma_request_type | dma_request,
 |  | confirm_state | new_state )

enable or disable tmr dma request

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
dma_request this parameter can be one of the following values:
  • TMR_OVERFLOW_DMA_REQUEST
  • TMR_C1_DMA_REQUEST
  • TMR_C2_DMA_REQUEST
  • TMR_C3_DMA_REQUEST
  • TMR_C4_DMA_REQUEST
  • TMR_HALL_DMA_REQUEST
  • TMR_TRIGGER_DMA_REQUEST
new_state | (TRUE or FALSE)
Return values
none

Definition at line 1296 of file at32f413_tmr.c.

Referenced by main().

◆ tmr_encoder_mode_config()

void tmr_encoder_mode_config | ( | tmr_type * | tmr_x,
 |  | tmr_encoder_mode_type | encoder_mode,
 |  | tmr_input_polarity_type | ic1_polarity,
 |  | tmr_input_polarity_type | ic2_polarity )

config tmr encoder mode

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8
encoder_mode this parameter can be one of the following values:
  • TMR_ENCODER_MODE_A
  • TMR_ENCODER_MODE_B
  • TMR_ENCODER_MODE_C
ic1_polarity this parameter can be one of the following values:
  • TMR_INPUT_RISING_EDGE
  • TMR_INPUT_FALLING_EDGE
  • TMR_INPUT_BOTH_EDGE
ic2_polarity this parameter can be one of the following values:
  • TMR_INPUT_RISING_EDGE
  • TMR_INPUT_FALLING_EDGE
  • TMR_INPUT_BOTH_EDGE
Return values
none

Definition at line 1648 of file at32f413_tmr.c.

Referenced by main().

◆ tmr_event_sw_trigger()

void tmr_event_sw_trigger | ( | tmr_type * | tmr_x,
 |  | tmr_event_trigger_type | tmr_event )

generate tmr event

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_event this parameter can be one of the following values:
  • TMR_OVERFLOW_SWTRIG
  • TMR_C1_SWTRIG
  • TMR_C2_SWTRIG
  • TMR_C3_SWTRIG
  • TMR_C4_SWTRIG
  • TMR_HALL_SWTRIG
  • TMR_TRIGGER_SWTRIG
  • TMR_BRK_SWTRIG
Return values
none

Definition at line 1456 of file at32f413_tmr.c.

Referenced by SysTick_Handler().

◆ tmr_external_clock_config()

void tmr_external_clock_config | ( | tmr_type * | tmr_x,
 |  | tmr_external_signal_divider_type | es_divide,
 |  | tmr_external_signal_polarity_type | es_polarity,
 |  | uint16_t | es_filter )

config tmr external clock

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8
es_divide this parameter can be one of the following values:
  • TMR_ES_FREQUENCY_DIV_1
  • TMR_ES_FREQUENCY_DIV_2
  • TMR_ES_FREQUENCY_DIV_4
  • TMR_ES_FREQUENCY_DIV_8
es_polarity this parameter can be one of the following values:
  • TMR_ES_POLARITY_NON_INVERTED
  • TMR_ES_POLARITY_INVERTED
es_filter | (0x0~0xf)
Return values
none

Definition at line 1567 of file at32f413_tmr.c.

Referenced by tmr_external_clock_mode1_config(), and tmr_external_clock_mode2_config().

◆ tmr_external_clock_mode1_config()

void tmr_external_clock_mode1_config | ( | tmr_type * | tmr_x,
 |  | tmr_external_signal_divider_type | es_divide,
 |  | tmr_external_signal_polarity_type | es_polarity,
 |  | uint16_t | es_filter )

config tmr external clock mode1

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9
es_divide this parameter can be one of the following values:
  • TMR_ES_FREQUENCY_DIV_1
  • TMR_ES_FREQUENCY_DIV_2
  • TMR_ES_FREQUENCY_DIV_4
  • TMR_ES_FREQUENCY_DIV_8
es_polarity this parameter can be one of the following values:
  • TMR_ES_POLARITY_NON_INVERTED
  • TMR_ES_POLARITY_INVERTED
es_filter | (0x0~0xf)
Return values
none

Definition at line 1593 of file at32f413_tmr.c.

◆ tmr_external_clock_mode2_config()

void tmr_external_clock_mode2_config | ( | tmr_type * | tmr_x,
 |  | tmr_external_signal_divider_type | es_divide,
 |  | tmr_external_signal_polarity_type | es_polarity,
 |  | uint16_t | es_filter )

config tmr external clock mode2

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8
es_divide this parameter can be one of the following values:
  • TMR_ES_FREQUENCY_DIV_1
  • TMR_ES_FREQUENCY_DIV_2
  • TMR_ES_FREQUENCY_DIV_4
  • TMR_ES_FREQUENCY_DIV_8
es_polarity this parameter can be one of the following values:
  • TMR_ES_POLARITY_NON_INVERTED
  • TMR_ES_POLARITY_INVERTED
es_filter | (0x0~0xf)
Return values
none

Definition at line 1619 of file at32f413_tmr.c.

◆ tmr_flag_clear()

void tmr_flag_clear | ( | tmr_type * | tmr_x,
 |  | uint32_t | tmr_flag )

clear tmr flag

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_flag this parameter can be any combination of the following values:
  • TMR_OVF_FLAG
  • TMR_C1_FLAG
  • TMR_C2_FLAG
  • TMR_C3_FLAG
  • TMR_C4_FLAG
  • TMR_HALL_FLAG
  • TMR_TRIGGER_FLAG
  • TMR_BRK_FLAG
  • TMR_C1_RECAPTURE_FLAG
  • TMR_C2_RECAPTURE_FLAG
  • TMR_C3_RECAPTURE_FLAG
  • TMR_C4_RECAPTURE_FLAG
Return values
none

Definition at line 1433 of file at32f413_tmr.c.

Referenced by TMR1_BRK_TMR9_IRQHandler(), TMR1_OVF_TMR10_IRQHandler(), TMR1_TRG_HALL_TMR11_IRQHandler(), TMR2_GLOBAL_IRQHandler(), and TMR3_GLOBAL_IRQHandler().

◆ tmr_flag_get()

flag_status tmr_flag_get | ( | tmr_type * | tmr_x,
 |  | uint32_t | tmr_flag )

get tmr flag

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_flag this parameter can be one of the following values:
  • TMR_OVF_FLAG
  • TMR_C1_FLAG
  • TMR_C2_FLAG
  • TMR_C3_FLAG
  • TMR_C4_FLAG
  • TMR_HALL_FLAG
  • TMR_TRIGGER_FLAG
  • TMR_BRK_FLAG
  • TMR_C1_RECAPTURE_FLAG
  • TMR_C2_RECAPTURE_FLAG
  • TMR_C3_RECAPTURE_FLAG
  • TMR_C4_RECAPTURE_FLAG
Return values
state of tmr flag

Definition at line 1395 of file at32f413_tmr.c.

Referenced by main().

◆ tmr_force_output_set()

void tmr_force_output_set | ( | tmr_type * | tmr_x,
 |  | tmr_channel_select_type | tmr_channel,
 |  | tmr_force_output_type | force_output )

set tmr force output

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_channel this parameter can be one of the following values:
  • TMR_SELECT_CHANNEL_1
  • TMR_SELECT_CHANNEL_2
  • TMR_SELECT_CHANNEL_3
  • TMR_SELECT_CHANNEL_4
force_output this parameter can be one of the following values:
  • TMR_FORCE_OUTPUT_HIGH
  • TMR_FORCE_OUTPUT_LOW
Return values
none

Definition at line 1687 of file at32f413_tmr.c.

◆ tmr_hall_select()

void tmr_hall_select | ( | tmr_type * | tmr_x,
 |  | confirm_state | new_state )

select tmr hall

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR8
new_state | (TRUE or FALSE)
Return values
none

Definition at line 1225 of file at32f413_tmr.c.

◆ tmr_input_channel_divider_set()

void tmr_input_channel_divider_set | ( | tmr_type * | tmr_x,
 |  | tmr_channel_select_type | tmr_channel,
 |  | tmr_channel_input_divider_type | divider_factor )

set tmr input channel divider

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_channel this parameter can be one of the following values:
  • TMR_SELECT_CHANNEL_1
  • TMR_SELECT_CHANNEL_2
  • TMR_SELECT_CHANNEL_3
  • TMR_SELECT_CHANNEL_4
divider_factor this parameter can be one of the following values:
  • TMR_CHANNEL_INPUT_DIV_1
  • TMR_CHANNEL_INPUT_DIV_2
  • TMR_CHANNEL_INPUT_DIV_4
  • TMR_CHANNEL_INPUT_DIV_8
Return values
none

Definition at line 1127 of file at32f413_tmr.c.

◆ tmr_input_channel_filter_set()

void tmr_input_channel_filter_set | ( | tmr_type * | tmr_x,
 |  | tmr_channel_select_type | tmr_channel,
 |  | uint16_t | filter_value )

set tmr input channel filter

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_channel this parameter can be one of the following values:
  • TMR_SELECT_CHANNEL_1
  • TMR_SELECT_CHANNEL_2
  • TMR_SELECT_CHANNEL_3
  • TMR_SELECT_CHANNEL_4
filter_value | (0x0~0xf)
Return values
none

Definition at line 944 of file at32f413_tmr.c.

◆ tmr_input_channel_init()

void tmr_input_channel_init | ( | tmr_type * | tmr_x,
 |  | tmr_input_config_type * | input_struct,
 |  | tmr_channel_input_divider_type | divider_factor )

init tmr input channel

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
input_struct
  • to the structure of tmr_input_config_type
divider_factor this parameter can be one of the following values:
  • TMR_CHANNEL_INPUT_DIV_1
  • TMR_CHANNEL_INPUT_DIV_2
  • TMR_CHANNEL_INPUT_DIV_4
  • TMR_CHANNEL_INPUT_DIV_8
Return values
none

Definition at line 816 of file at32f413_tmr.c.

Referenced by main().

◆ tmr_input_default_para_init()

void tmr_input_default_para_init ( tmr_input_config_type * tmr_input_struct )

init tmr input default para

Parameters
tmr_input_struct
  • to the structure of tmr_input_config_type
Return values
none

Definition at line 143 of file at32f413_tmr.c.

Referenced by main().

◆ tmr_internal_clock_set()

void tmr_internal_clock_set ( tmr_type * tmr_x )

set tmr select internal clock

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9
Return values
none

Definition at line 1481 of file at32f413_tmr.c.

◆ tmr_interrupt_enable()

void tmr_interrupt_enable | ( | tmr_type * | tmr_x,
 |  | uint32_t | tmr_interrupt,
 |  | confirm_state | new_state )

enable or disable tmr interrupt

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_interrupt this parameter can be one of the following values:
  • TMR_OVF_INT
  • TMR_C1_INT
  • TMR_C2_INT
  • TMR_C3_INT
  • TMR_C4_INT
  • TMR_HALL_INT
  • TMR_TRIGGER_INT
  • TMR_BRK_INT
new_state | (TRUE or FALSE)
Return values
none

Definition at line 1327 of file at32f413_tmr.c.

Referenced by main(), tmr1_config(), tmr2_config(), TMR5_GLOBAL_IRQHandler(), and tmr_init().

◆ tmr_interrupt_flag_get()

flag_status tmr_interrupt_flag_get | ( | tmr_type * | tmr_x,
 |  | uint32_t | tmr_flag )

get tmr interrupt flag

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_flag this parameter can be one of the following values:
  • TMR_OVF_FLAG
  • TMR_C1_FLAG
  • TMR_C2_FLAG
  • TMR_C3_FLAG
  • TMR_C4_FLAG
  • TMR_HALL_FLAG
  • TMR_TRIGGER_FLAG
  • TMR_BRK_FLAG
Return values
state of tmr interrupt flag

Definition at line 1357 of file at32f413_tmr.c.

Referenced by TMR1_BRK_TMR9_IRQHandler(), TMR1_OVF_TMR10_IRQHandler(), TMR2_GLOBAL_IRQHandler(), TMR3_GLOBAL_IRQHandler(), and TMR5_GLOBAL_IRQHandler().

◆ tmr_one_cycle_mode_enable()

void tmr_one_cycle_mode_enable | ( | tmr_type * | tmr_x,
 |  | confirm_state | new_state )

enable or disable tmr one cycle mode

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9
new_state | (TRUE or FALSE)
Return values
none

Definition at line 744 of file at32f413_tmr.c.

Referenced by main().

◆ tmr_output_channel_buffer_enable()

void tmr_output_channel_buffer_enable | ( | tmr_type * | tmr_x,
 |  | tmr_channel_select_type | tmr_channel,
 |  | confirm_state | new_state )

enable tmr output channel buffer

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_channel this parameter can be one of the following values:
  • TMR_SELECT_CHANNEL_1
  • TMR_SELECT_CHANNEL_2
  • TMR_SELECT_CHANNEL_3
  • TMR_SELECT_CHANNEL_4
new_state | (TRUE or FALSE)
Return values
none

Definition at line 613 of file at32f413_tmr.c.

Referenced by main(), and mclk_tmr1_init().

◆ tmr_output_channel_config()

void tmr_output_channel_config | ( | tmr_type * | tmr_x,
 |  | tmr_channel_select_type | tmr_channel,
 |  | tmr_output_config_type * | tmr_output_struct )

config tmr output channel

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_channel this parameter can be one of the following values:
  • TMR_SELECT_CHANNEL_1
  • TMR_SELECT_CHANNEL_2
  • TMR_SELECT_CHANNEL_3
  • TMR_SELECT_CHANNEL_4
tmr_output_struct
  • to the structure of tmr_output_config_type
Return values
none

Definition at line 318 of file at32f413_tmr.c.

Referenced by main(), mclk_tmr1_init(), and tmr1_config().

◆ tmr_output_channel_immediately_set()

void tmr_output_channel_immediately_set | ( | tmr_type * | tmr_x,
 |  | tmr_channel_select_type | tmr_channel,
 |  | confirm_state | new_state )

set tmr output channel immediately

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_channel this parameter can be one of the following values:
  • TMR_SELECT_CHANNEL_1
  • TMR_SELECT_CHANNEL_2
  • TMR_SELECT_CHANNEL_3
  • TMR_SELECT_CHANNEL_4
new_state | (TRUE or FALSE)
Return values
none

Definition at line 659 of file at32f413_tmr.c.

◆ tmr_output_channel_mode_select()

void tmr_output_channel_mode_select | ( | tmr_type * | tmr_x,
 |  | tmr_channel_select_type | tmr_channel,
 |  | tmr_output_control_mode_type | oc_mode )

select tmr output channel mode

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_channel this parameter can be one of the following values:
  • TMR_SELECT_CHANNEL_1
  • TMR_SELECT_CHANNEL_2
  • TMR_SELECT_CHANNEL_3
  • TMR_SELECT_CHANNEL_4
oc_mode this parameter can be one of the following values:
  • TMR_OUTPUT_CONTROL_OFF
  • TMR_OUTPUT_CONTROL_HIGH
  • TMR_OUTPUT_CONTROL_LOW
  • TMR_OUTPUT_CONTROL_SWITCH
  • TMR_OUTPUT_CONTROL_FORCE_HIGH
  • TMR_OUTPUT_CONTROL_FORCE_LOW
  • TMR_OUTPUT_CONTROL_PWM_MODE_A
  • TMR_OUTPUT_CONTROL_PWM_MODE_B
Return values
none

Definition at line 429 of file at32f413_tmr.c.

Referenced by TMR1_TRG_HALL_TMR11_IRQHandler().

◆ tmr_output_channel_polarity_set()

void tmr_output_channel_polarity_set | ( | tmr_type * | tmr_x,
 |  | tmr_channel_select_type | tmr_channel,
 |  | tmr_polarity_active_type | oc_polarity )

set tmr output channel polarity

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_channel this parameter can be one of the following values:
  • TMR_SELECT_CHANNEL_1
  • TMR_SELECT_CHANNEL_2
  • TMR_SELECT_CHANNEL_3
  • TMR_SELECT_CHANNEL_4
  • TMR_SELECT_CHANNEL_1C
  • TMR_SELECT_CHANNEL_2C
  • TMR_SELECT_CHANNEL_3C
oc_polarity this parameter can be one of the following values:
  • TMR_POLARITY_ACTIVE_HIGH
  • TMR_POLARITY_ACTIVE_LOW
Return values
none

Definition at line 1507 of file at32f413_tmr.c.

◆ tmr_output_channel_switch_set()

void tmr_output_channel_switch_set | ( | tmr_type * | tmr_x,
 |  | tmr_channel_select_type | tmr_channel,
 |  | confirm_state | new_state )

set tmr output channel switch

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_channel this parameter can be one of the following values:
  • TMR_SELECT_CHANNEL_1
  • TMR_SELECT_CHANNEL_2
  • TMR_SELECT_CHANNEL_3
  • TMR_SELECT_CHANNEL_4
new_state | (TRUE or FALSE)
Return values
none

Definition at line 705 of file at32f413_tmr.c.

◆ tmr_output_default_para_init()

void tmr_output_default_para_init ( tmr_output_config_type * tmr_output_struct )

init tmr output default para

Parameters
tmr_output_struct
  • to the structure of tmr_output_config_type
Return values
none

Definition at line 126 of file at32f413_tmr.c.

Referenced by main(), mclk_tmr1_init(), and tmr1_config().

◆ tmr_output_enable()

void tmr_output_enable | ( | tmr_type * | tmr_x,
 |  | confirm_state | new_state )

tmr output enable(oen),this function is important for advtm output enable

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR8
new_state | (TRUE or FALSE)
Return values
none

Definition at line 1469 of file at32f413_tmr.c.

Referenced by main(), and mclk_tmr1_init().

◆ tmr_overflow_event_disable()

void tmr_overflow_event_disable | ( | tmr_type * | tmr_x,
 |  | confirm_state | new_state )

enable or disable tmr overflow event generation

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
new_state | (TRUE or FALSE)
Return values
none

Definition at line 795 of file at32f413_tmr.c.

◆ tmr_overflow_request_source_set()

void tmr_overflow_request_source_set | ( | tmr_type * | tmr_x,
 |  | confirm_state | new_state )

select tmr the overflow event sources

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
new_state | (TRUE or FALSE)
Return values
none

Definition at line 781 of file at32f413_tmr.c.

◆ tmr_period_buffer_enable()

void tmr_period_buffer_enable | ( | tmr_type * | tmr_x,
 |  | confirm_state | new_state )

enable tmr period buffer

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
new_state | (TRUE or FALSE)
Return values
none

Definition at line 592 of file at32f413_tmr.c.

Referenced by main().

◆ tmr_period_value_get()

uint32_t tmr_period_value_get ( tmr_type * tmr_x )

get tmr period value

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
Return values
timer period register value of counter (for 16 bit tmr 0x0000~0xFFFF, for 32 bit tmr 0x0000_0000~0xFFFF_FFFF)

Definition at line 485 of file at32f413_tmr.c.

◆ tmr_period_value_set()

void tmr_period_value_set | ( | tmr_type * | tmr_x,
 |  | uint32_t | tmr_pr_value )

set tmr period value

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_pr_value | timer period register value of counter (for 16 bit tmr 0x0000~0xFFFF, for 32 bit tmr 0x0000_0000~0xFFFF_FFFF)
Return values
none

Definition at line 469 of file at32f413_tmr.c.

◆ tmr_primary_mode_select()

void tmr_primary_mode_select | ( | tmr_type * | tmr_x,
 |  | tmr_primary_select_type | primary_mode )

select tmr primary mode

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8
primary_mode this parameter can be one of the following values:
  • TMR_PRIMARY_SEL_RESET
  • TMR_PRIMARY_SEL_ENABLE
  • TMR_PRIMARY_SEL_OVERFLOW
  • TMR_PRIMARY_SEL_COMPARE
  • TMR_PRIMARY_SEL_C1ORAW
  • TMR_PRIMARY_SEL_C2ORAW
  • TMR_PRIMARY_SEL_C3ORAW
  • TMR_PRIMARY_SEL_C4ORAW
Return values
none

Definition at line 1174 of file at32f413_tmr.c.

Referenced by main().

◆ tmr_pwm_input_config()

void tmr_pwm_input_config | ( | tmr_type * | tmr_x,
 |  | tmr_input_config_type * | input_struct,
 |  | tmr_channel_input_divider_type | divider_factor )

config tmr pwm input

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
input_struct
  • to the structure of tmr_input_config_type
divider_factor this parameter can be one of the following values:
  • TMR_CHANNEL_INPUT_DIV_1
  • TMR_CHANNEL_INPUT_DIV_2
  • TMR_CHANNEL_INPUT_DIV_4
  • TMR_CHANNEL_INPUT_DIV_8
Return values
none

Definition at line 990 of file at32f413_tmr.c.

Referenced by main().

◆ tmr_repetition_counter_set()

void tmr_repetition_counter_set | ( | tmr_type * | tmr_x,
 |  | uint8_t | tmr_rpr_value )

set the repetition counter register(rpr) value

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR8
tmr_rpr_value | (0x00~0xFF)
Return values
none

Definition at line 239 of file at32f413_tmr.c.

Referenced by main().

◆ tmr_reset()

void tmr_reset ( tmr_type * tmr_x )

tmr reset by crm reset register

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
Return values
none

Definition at line 51 of file at32f413_tmr.c.

◆ tmr_sub_mode_select()

void tmr_sub_mode_select | ( | tmr_type * | tmr_x,
 |  | tmr_sub_mode_select_type | sub_mode )

select tmr subordinate mode

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9
sub_mode this parameter can be one of the following values:
  • TMR_SUB_MODE_DIABLE
  • TMR_SUB_ENCODER_MODE_A
  • TMR_SUB_ENCODER_MODE_B
  • TMR_SUB_ENCODER_MODE_C
  • TMR_SUB_RESET_MODE
  • TMR_SUB_HANG_MODE
  • TMR_SUB_TRIGGER_MODE
  • TMR_SUB_EXTERNAL_CLOCK_MODE_A
Return values
none

Definition at line 1196 of file at32f413_tmr.c.

Referenced by main().

◆ tmr_sub_sync_mode_set()

void tmr_sub_sync_mode_set | ( | tmr_type * | tmr_x,
 |  | confirm_state | new_state )

set tmr subordinate synchronization mode

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9
new_state | (TRUE or FALSE)
Return values
none

Definition at line 1273 of file at32f413_tmr.c.

Referenced by main().

◆ tmr_trigger_input_select()

void tmr_trigger_input_select | ( | tmr_type * | tmr_x,
 |  | sub_tmr_input_sel_type | trigger_select )

select tmr sub-trigger

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9
trigger_select this parameter can be one of the following values:
  • TMR_SUB_INPUT_SEL_IS0
  • TMR_SUB_INPUT_SEL_IS1
  • TMR_SUB_INPUT_SEL_IS2
  • TMR_SUB_INPUT_SEL_IS3
  • TMR_SUB_INPUT_SEL_C1INC
  • TMR_SUB_INPUT_SEL_C1DF1
  • TMR_SUB_INPUT_SEL_C2DF2
  • TMR_SUB_INPUT_SEL_EXTIN
Return values
none

Definition at line 1260 of file at32f413_tmr.c.

Referenced by main().


AT32F413 Firmwary Library: TMR_private_functions

Functions
TMR_private_functions
AT32F413_periph_driver » TMR

Functions

void | tmr_reset (tmr_type *tmr_x)
tmr reset by crm reset register
void | tmr_counter_enable (tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr counter
void | tmr_output_default_para_init (tmr_output_config_type *tmr_output_struct)
init tmr output default para
void | tmr_input_default_para_init (tmr_input_config_type *tmr_input_struct)
init tmr input default para
void | tmr_brkdt_default_para_init (tmr_brkdt_config_type *tmr_brkdt_struct)
init tmr brkdt default para
void | tmr_base_init (tmr_type *tmr_x, uint32_t tmr_pr, uint32_t tmr_div)
init tmr base
void | tmr_clock_source_div_set (tmr_type *tmr_x, tmr_clock_division_type tmr_clock_div)
set tmr clock source division
void | tmr_cnt_dir_set (tmr_type *tmr_x, tmr_count_mode_type tmr_cnt_dir)
set tmr counter count direction
void | tmr_repetition_counter_set (tmr_type *tmr_x, uint8_t tmr_rpr_value)
set the repetition counter register(rpr) value
void | tmr_counter_value_set (tmr_type *tmr_x, uint32_t tmr_cnt_value)
set tmr counter value
uint32_t | tmr_counter_value_get (tmr_type *tmr_x)
get tmr counter value
void | tmr_div_value_set (tmr_type *tmr_x, uint32_t tmr_div_value)
set tmr div value
uint32_t | tmr_div_value_get (tmr_type *tmr_x)
get tmr div value
void | tmr_output_channel_config (tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_output_config_type *tmr_output_struct)
config tmr output channel
void | tmr_output_channel_mode_select (tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_output_control_mode_type oc_mode)
select tmr output channel mode
void | tmr_period_value_set (tmr_type *tmr_x, uint32_t tmr_pr_value)
set tmr period value
uint32_t | tmr_period_value_get (tmr_type *tmr_x)
get tmr period value
void | tmr_channel_value_set (tmr_type *tmr_x, tmr_channel_select_type tmr_channel, uint32_t tmr_channel_value)
set tmr channel value
uint32_t | tmr_channel_value_get (tmr_type *tmr_x, tmr_channel_select_type tmr_channel)
get tmr channel value
void | tmr_period_buffer_enable (tmr_type *tmr_x, confirm_state new_state)
enable tmr period buffer
void | tmr_output_channel_buffer_enable (tmr_type *tmr_x, tmr_channel_select_type tmr_channel, confirm_state new_state)
enable tmr output channel buffer
void | tmr_output_channel_immediately_set (tmr_type *tmr_x, tmr_channel_select_type tmr_channel, confirm_state new_state)
set tmr output channel immediately
void | tmr_output_channel_switch_set (tmr_type *tmr_x, tmr_channel_select_type tmr_channel, confirm_state new_state)
set tmr output channel switch
void | tmr_one_cycle_mode_enable (tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr one cycle mode
void | tmr_32_bit_function_enable (tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr 32 bit function(plus mode)
void | tmr_overflow_request_source_set (tmr_type *tmr_x, confirm_state new_state)
select tmr the overflow event sources
void | tmr_overflow_event_disable (tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr overflow event generation
void | tmr_input_channel_init (tmr_type *tmr_x, tmr_input_config_type *input_struct, tmr_channel_input_divider_type divider_factor)
init tmr input channel
void | tmr_channel_enable (tmr_type *tmr_x, tmr_channel_select_type tmr_channel, confirm_state new_state)
tmr channel enable
void | tmr_input_channel_filter_set (tmr_type *tmr_x, tmr_channel_select_type tmr_channel, uint16_t filter_value)
set tmr input channel filter
void | tmr_pwm_input_config (tmr_type *tmr_x, tmr_input_config_type *input_struct, tmr_channel_input_divider_type divider_factor)
config tmr pwm input
void | tmr_channel1_input_select (tmr_type *tmr_x, tmr_channel1_input_connected_type ch1_connect)
select tmr channel1 input
void | tmr_input_channel_divider_set (tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_channel_input_divider_type divider_factor)
set tmr input channel divider
void | tmr_primary_mode_select (tmr_type *tmr_x, tmr_primary_select_type primary_mode)
select tmr primary mode
void | tmr_sub_mode_select (tmr_type *tmr_x, tmr_sub_mode_select_type sub_mode)
select tmr subordinate mode
void | tmr_channel_dma_select (tmr_type *tmr_x, tmr_dma_request_source_type cc_dma_select)
select tmr channel dma
void | tmr_hall_select (tmr_type *tmr_x, confirm_state new_state)
select tmr hall
void | tmr_channel_buffer_enable (tmr_type *tmr_x, confirm_state new_state)
enable tmr channel buffer
void | tmr_trigger_input_select (tmr_type *tmr_x, sub_tmr_input_sel_type trigger_select)
select tmr sub-trigger
void | tmr_sub_sync_mode_set (tmr_type *tmr_x, confirm_state new_state)
set tmr subordinate synchronization mode
void | tmr_dma_request_enable (tmr_type *tmr_x, tmr_dma_request_type dma_request, confirm_state new_state)
enable or disable tmr dma request
void | tmr_interrupt_enable (tmr_type *tmr_x, uint32_t tmr_interrupt, confirm_state new_state)
enable or disable tmr interrupt
flag_status | tmr_interrupt_flag_get (tmr_type *tmr_x, uint32_t tmr_flag)
get tmr interrupt flag
flag_status | tmr_flag_get (tmr_type *tmr_x, uint32_t tmr_flag)
get tmr flag
void | tmr_flag_clear (tmr_type *tmr_x, uint32_t tmr_flag)
clear tmr flag
void | tmr_event_sw_trigger (tmr_type *tmr_x, tmr_event_trigger_type tmr_event)
generate tmr event
void | tmr_output_enable (tmr_type *tmr_x, confirm_state new_state)
tmr output enable(oen),this function is important for advtm output enable
void | tmr_internal_clock_set (tmr_type *tmr_x)
set tmr select internal clock
void | tmr_output_channel_polarity_set (tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_polarity_active_type oc_polarity)
set tmr output channel polarity
void | tmr_external_clock_config (tmr_type *tmr_x, tmr_external_signal_divider_type es_divide, tmr_external_signal_polarity_type es_polarity, uint16_t es_filter)
config tmr external clock
void | tmr_external_clock_mode1_config (tmr_type *tmr_x, tmr_external_signal_divider_type es_divide, tmr_external_signal_polarity_type es_polarity, uint16_t es_filter)
config tmr external clock mode1
void | tmr_external_clock_mode2_config (tmr_type *tmr_x, tmr_external_signal_divider_type es_divide, tmr_external_signal_polarity_type es_polarity, uint16_t es_filter)
config tmr external clock mode2
void | tmr_encoder_mode_config (tmr_type *tmr_x, tmr_encoder_mode_type encoder_mode, tmr_input_polarity_type ic1_polarity, tmr_input_polarity_type ic2_polarity)
config tmr encoder mode
void | tmr_force_output_set (tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_force_output_type force_output)
set tmr force output
void | tmr_dma_control_config (tmr_type *tmr_x, tmr_dma_transfer_length_type dma_length, tmr_dma_address_type dma_base_address)
config tmr dma control
void | tmr_brkdt_config (tmr_type *tmr_x, tmr_brkdt_config_type *brkdt_struct)
config tmr brake mode and dead-time

Detailed Description

Function Documentation

◆ tmr_32_bit_function_enable()

void tmr_32_bit_function_enable | ( | tmr_type * | tmr_x,
 |  | confirm_state | new_state )

enable or disable tmr 32 bit function(plus mode)

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR2, TMR5
new_state | (TRUE or FALSE)
Return values
none

Definition at line 758 of file at32f413_tmr.c.

Referenced by main().

◆ tmr_base_init()

void tmr_base_init | ( | tmr_type * | tmr_x,
 |  | uint32_t | tmr_pr,
 |  | uint32_t | tmr_div )

init tmr base

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_pr | (for 16 bit tmr 0x0000~0xFFFF, for 32 bit tmr 0x0000_0000~0xFFFF_FFFF)
tmr_div | (timer div value:0x0000~0xFFFF)
Return values
none

Definition at line 179 of file at32f413_tmr.c.

Referenced by main(), mclk_tmr1_init(), tmr1_config(), tmr1_config(), tmr2_config(), and tmr_init().

◆ tmr_brkdt_config()

void tmr_brkdt_config | ( | tmr_type * | tmr_x,
 |  | tmr_brkdt_config_type * | brkdt_struct )

config tmr brake mode and dead-time

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR8
brkdt_struct
  • to the structure of tmr_brkdt_config_type
Return values
none

Definition at line 1769 of file at32f413_tmr.c.

Referenced by main().

◆ tmr_brkdt_default_para_init()

void tmr_brkdt_default_para_init ( tmr_brkdt_config_type * tmr_brkdt_struct )

init tmr brkdt default para

Parameters
tmr_brkdt_struct
  • to the structure of tmr_brkdt_config_type
Return values
none

Definition at line 157 of file at32f413_tmr.c.

Referenced by main().

◆ tmr_channel1_input_select()

void tmr_channel1_input_select | ( | tmr_type * | tmr_x,
 |  | tmr_channel1_input_connected_type | ch1_connect )

select tmr channel1 input

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8
ch1_connect this parameter can be one of the following values:
  • TMR_CHANEL1_CONNECTED_C1IRAW
  • TMR_CHANEL1_2_3_CONNECTED_C1IRAW_XOR
Return values
none

Definition at line 1102 of file at32f413_tmr.c.

Referenced by main().

◆ tmr_channel_buffer_enable()

void tmr_channel_buffer_enable | ( | tmr_type * | tmr_x,
 |  | confirm_state | new_state )

enable tmr channel buffer

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR8
new_state | (TRUE or FALSE)
Return values
none

Definition at line 1238 of file at32f413_tmr.c.

Referenced by main().

◆ tmr_channel_dma_select()

void tmr_channel_dma_select | ( | tmr_type * | tmr_x,
 |  | tmr_dma_request_source_type | cc_dma_select )

select tmr channel dma

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9
cc_dma_select this parameter can be one of the following values:
  • TMR_DMA_REQUEST_BY_CHANNEL
  • TMR_DMA_REQUEST_BY_OVERFLOW
Return values
none

Definition at line 1212 of file at32f413_tmr.c.

◆ tmr_channel_enable()

void tmr_channel_enable | ( | tmr_type * | tmr_x,
 |  | tmr_channel_select_type | tmr_channel,
 |  | confirm_state | new_state )

tmr channel enable

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_channel this parameter can be one of the following values:
  • TMR_SELECT_CHANNEL_1
  • TMR_SELECT_CHANNEL_1C
  • TMR_SELECT_CHANNEL_2
  • TMR_SELECT_CHANNEL_2C
  • TMR_SELECT_CHANNEL_3
  • TMR_SELECT_CHANNEL_3C
  • TMR_SELECT_CHANNEL_4
new_state | (TRUE or FALSE)
Return values
none

Definition at line 888 of file at32f413_tmr.c.

Referenced by main(), and TMR1_TRG_HALL_TMR11_IRQHandler().

◆ tmr_channel_value_get()

uint32_t tmr_channel_value_get | ( | tmr_type * | tmr_x,
 |  | tmr_channel_select_type | tmr_channel )

get tmr channel value

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_channel this parameter can be one of the following values:
  • TMR_SELECT_CHANNEL_1
  • TMR_SELECT_CHANNEL_2
  • TMR_SELECT_CHANNEL_3
  • TMR_SELECT_CHANNEL_4
Return values
tmr channel value

Definition at line 551 of file at32f413_tmr.c.

Referenced by TMR1_BRK_TMR9_IRQHandler(), TMR2_GLOBAL_IRQHandler(), and TMR3_GLOBAL_IRQHandler().

◆ tmr_channel_value_set()

void tmr_channel_value_set | ( | tmr_type * | tmr_x,
 |  | tmr_channel_select_type | tmr_channel,
 |  | uint32_t | tmr_channel_value )

set tmr channel value

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_channel this parameter can be one of the following values:
  • TMR_SELECT_CHANNEL_1
  • TMR_SELECT_CHANNEL_2
  • TMR_SELECT_CHANNEL_3
  • TMR_SELECT_CHANNEL_4
tmr_channel_value | (for 16 bit tmr 0x0000~0xFFFF, for 32 bit tmr 0x0000_0000~0xFFFF_FFFF)
Return values
none

Definition at line 506 of file at32f413_tmr.c.

Referenced by main(), mclk_tmr1_init(), TMR1_BRK_TMR9_IRQHandler(), tmr1_config(), TMR2_GLOBAL_IRQHandler(), and TMR3_GLOBAL_IRQHandler().

◆ tmr_clock_source_div_set()

void tmr_clock_source_div_set | ( | tmr_type * | tmr_x,
 |  | tmr_clock_division_type | tmr_clock_div )

set tmr clock source division

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_clock_div this parameter can be one of the following values:
  • TMR_CLOCK_DIV1
  • TMR_CLOCK_DIV2
  • TMR_CLOCK_DIV4
Return values
none

Definition at line 204 of file at32f413_tmr.c.

Referenced by main(), mclk_tmr1_init(), tmr1_config(), tmr1_config(), and tmr2_config().

◆ tmr_cnt_dir_set()

void tmr_cnt_dir_set | ( | tmr_type * | tmr_x,
 |  | tmr_count_mode_type | tmr_cnt_dir )

set tmr counter count direction

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_cnt_dir this parameter can be one of the following values:
  • TMR_COUNT_UP
  • TMR_COUNT_DOWN
  • TMR_COUNT_TWO_WAY_1
  • TMR_COUNT_TWO_WAY_2
  • TMR_COUNT_TWO_WAY_3
Return values
none

Definition at line 225 of file at32f413_tmr.c.

Referenced by main(), mclk_tmr1_init(), tmr1_config(), tmr1_config(), tmr2_config(), and tmr_init().

◆ tmr_counter_enable()

void tmr_counter_enable | ( | tmr_type * | tmr_x,
 |  | confirm_state | new_state )

enable or disable tmr counter

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
new_state | (TRUE or FALSE)
Return values
none

Definition at line 114 of file at32f413_tmr.c.

Referenced by main(), mclk_tmr1_init(), tmr2_config(), TMR5_GLOBAL_IRQHandler(), and tmr_init().

◆ tmr_counter_value_get()

uint32_t tmr_counter_value_get ( tmr_type * tmr_x )

get tmr counter value

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
Return values
tmr counter value

Definition at line 269 of file at32f413_tmr.c.

Referenced by main().

◆ tmr_counter_value_set()

void tmr_counter_value_set | ( | tmr_type * | tmr_x,
 |  | uint32_t | tmr_cnt_value )

set tmr counter value

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_cnt_value | (for 16 bit tmr 0x0000~0xFFFF, for 32 bit tmr 0x0000_0000~0xFFFF_FFFF)
Return values
none

Definition at line 255 of file at32f413_tmr.c.

◆ tmr_div_value_get()

uint32_t tmr_div_value_get ( tmr_type * tmr_x )

get tmr div value

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
Return values
tmr div value

Definition at line 297 of file at32f413_tmr.c.

◆ tmr_div_value_set()

void tmr_div_value_set | ( | tmr_type * | tmr_x,
 |  | uint32_t | tmr_div_value )

set tmr div value

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_div_value | (0x0000~0xFFFF)
Return values
none

Definition at line 283 of file at32f413_tmr.c.

◆ tmr_dma_control_config()

void tmr_dma_control_config | ( | tmr_type * | tmr_x,
 |  | tmr_dma_transfer_length_type | dma_length,
 |  | tmr_dma_address_type | dma_base_address )

config tmr dma control

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8
dma_length this parameter can be one of the following values:
  • TMR_DMA_TRANSFER_1BYTE
  • TMR_DMA_TRANSFER_2BYTES
  • TMR_DMA_TRANSFER_3BYTES ...
  • TMR_DMA_TRANSFER_17BYTES
  • TMR_DMA_TRANSFER_18BYTES
dma_base_address this parameter can be one of the following values:
  • TMR_CTRL1_ADDRESS
  • TMR_CTRL2_ADDRESS
  • TMR_STCTRL_ADDRESS
  • TMR_IDEN_ADDRESS
  • TMR_ISTS_ADDRESS
  • TMR_SWEVT_ADDRESS
  • TMR_CM1_ADDRESS
  • TMR_CM2_ADDRESS
  • TMR_CCTRL_ADDRESS
  • TMR_CVAL_ADDRESS
  • TMR_DIV_ADDRESS
  • TMR_PR_ADDRESS
  • TMR_RPR_ADDRESS
  • TMR_C1DT_ADDRESS
  • TMR_C2DT_ADDRESS
  • TMR_C3DT_ADDRESS
  • TMR_C4DT_ADDRESS
  • TMR_BRK_ADDRESS
  • TMR_DMACTRL_ADDRESS
Return values
none

Definition at line 1753 of file at32f413_tmr.c.

Referenced by main().

◆ tmr_dma_request_enable()

void tmr_dma_request_enable | ( | tmr_type * | tmr_x,
 |  | tmr_dma_request_type | dma_request,
 |  | confirm_state | new_state )

enable or disable tmr dma request

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
dma_request this parameter can be one of the following values:
  • TMR_OVERFLOW_DMA_REQUEST
  • TMR_C1_DMA_REQUEST
  • TMR_C2_DMA_REQUEST
  • TMR_C3_DMA_REQUEST
  • TMR_C4_DMA_REQUEST
  • TMR_HALL_DMA_REQUEST
  • TMR_TRIGGER_DMA_REQUEST
new_state | (TRUE or FALSE)
Return values
none

Definition at line 1296 of file at32f413_tmr.c.

Referenced by main().

◆ tmr_encoder_mode_config()

void tmr_encoder_mode_config | ( | tmr_type * | tmr_x,
 |  | tmr_encoder_mode_type | encoder_mode,
 |  | tmr_input_polarity_type | ic1_polarity,
 |  | tmr_input_polarity_type | ic2_polarity )

config tmr encoder mode

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8
encoder_mode this parameter can be one of the following values:
  • TMR_ENCODER_MODE_A
  • TMR_ENCODER_MODE_B
  • TMR_ENCODER_MODE_C
ic1_polarity this parameter can be one of the following values:
  • TMR_INPUT_RISING_EDGE
  • TMR_INPUT_FALLING_EDGE
  • TMR_INPUT_BOTH_EDGE
ic2_polarity this parameter can be one of the following values:
  • TMR_INPUT_RISING_EDGE
  • TMR_INPUT_FALLING_EDGE
  • TMR_INPUT_BOTH_EDGE
Return values
none

Definition at line 1648 of file at32f413_tmr.c.

Referenced by main().

◆ tmr_event_sw_trigger()

void tmr_event_sw_trigger | ( | tmr_type * | tmr_x,
 |  | tmr_event_trigger_type | tmr_event )

generate tmr event

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_event this parameter can be one of the following values:
  • TMR_OVERFLOW_SWTRIG
  • TMR_C1_SWTRIG
  • TMR_C2_SWTRIG
  • TMR_C3_SWTRIG
  • TMR_C4_SWTRIG
  • TMR_HALL_SWTRIG
  • TMR_TRIGGER_SWTRIG
  • TMR_BRK_SWTRIG
Return values
none

Definition at line 1456 of file at32f413_tmr.c.

Referenced by SysTick_Handler().

◆ tmr_external_clock_config()

void tmr_external_clock_config | ( | tmr_type * | tmr_x,
 |  | tmr_external_signal_divider_type | es_divide,
 |  | tmr_external_signal_polarity_type | es_polarity,
 |  | uint16_t | es_filter )

config tmr external clock

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8
es_divide this parameter can be one of the following values:
  • TMR_ES_FREQUENCY_DIV_1
  • TMR_ES_FREQUENCY_DIV_2
  • TMR_ES_FREQUENCY_DIV_4
  • TMR_ES_FREQUENCY_DIV_8
es_polarity this parameter can be one of the following values:
  • TMR_ES_POLARITY_NON_INVERTED
  • TMR_ES_POLARITY_INVERTED
es_filter | (0x0~0xf)
Return values
none

Definition at line 1567 of file at32f413_tmr.c.

Referenced by tmr_external_clock_mode1_config(), and tmr_external_clock_mode2_config().

◆ tmr_external_clock_mode1_config()

void tmr_external_clock_mode1_config | ( | tmr_type * | tmr_x,
 |  | tmr_external_signal_divider_type | es_divide,
 |  | tmr_external_signal_polarity_type | es_polarity,
 |  | uint16_t | es_filter )

config tmr external clock mode1

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9
es_divide this parameter can be one of the following values:
  • TMR_ES_FREQUENCY_DIV_1
  • TMR_ES_FREQUENCY_DIV_2
  • TMR_ES_FREQUENCY_DIV_4
  • TMR_ES_FREQUENCY_DIV_8
es_polarity this parameter can be one of the following values:
  • TMR_ES_POLARITY_NON_INVERTED
  • TMR_ES_POLARITY_INVERTED
es_filter | (0x0~0xf)
Return values
none

Definition at line 1593 of file at32f413_tmr.c.

◆ tmr_external_clock_mode2_config()

void tmr_external_clock_mode2_config | ( | tmr_type * | tmr_x,
 |  | tmr_external_signal_divider_type | es_divide,
 |  | tmr_external_signal_polarity_type | es_polarity,
 |  | uint16_t | es_filter )

config tmr external clock mode2

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8
es_divide this parameter can be one of the following values:
  • TMR_ES_FREQUENCY_DIV_1
  • TMR_ES_FREQUENCY_DIV_2
  • TMR_ES_FREQUENCY_DIV_4
  • TMR_ES_FREQUENCY_DIV_8
es_polarity this parameter can be one of the following values:
  • TMR_ES_POLARITY_NON_INVERTED
  • TMR_ES_POLARITY_INVERTED
es_filter | (0x0~0xf)
Return values
none

Definition at line 1619 of file at32f413_tmr.c.

◆ tmr_flag_clear()

void tmr_flag_clear | ( | tmr_type * | tmr_x,
 |  | uint32_t | tmr_flag )

clear tmr flag

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_flag this parameter can be any combination of the following values:
  • TMR_OVF_FLAG
  • TMR_C1_FLAG
  • TMR_C2_FLAG
  • TMR_C3_FLAG
  • TMR_C4_FLAG
  • TMR_HALL_FLAG
  • TMR_TRIGGER_FLAG
  • TMR_BRK_FLAG
  • TMR_C1_RECAPTURE_FLAG
  • TMR_C2_RECAPTURE_FLAG
  • TMR_C3_RECAPTURE_FLAG
  • TMR_C4_RECAPTURE_FLAG
Return values
none

Definition at line 1433 of file at32f413_tmr.c.

Referenced by TMR1_BRK_TMR9_IRQHandler(), TMR1_OVF_TMR10_IRQHandler(), TMR1_TRG_HALL_TMR11_IRQHandler(), TMR2_GLOBAL_IRQHandler(), and TMR3_GLOBAL_IRQHandler().

◆ tmr_flag_get()

flag_status tmr_flag_get | ( | tmr_type * | tmr_x,
 |  | uint32_t | tmr_flag )

get tmr flag

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_flag this parameter can be one of the following values:
  • TMR_OVF_FLAG
  • TMR_C1_FLAG
  • TMR_C2_FLAG
  • TMR_C3_FLAG
  • TMR_C4_FLAG
  • TMR_HALL_FLAG
  • TMR_TRIGGER_FLAG
  • TMR_BRK_FLAG
  • TMR_C1_RECAPTURE_FLAG
  • TMR_C2_RECAPTURE_FLAG
  • TMR_C3_RECAPTURE_FLAG
  • TMR_C4_RECAPTURE_FLAG
Return values
state of tmr flag

Definition at line 1395 of file at32f413_tmr.c.

Referenced by main().

◆ tmr_force_output_set()

void tmr_force_output_set | ( | tmr_type * | tmr_x,
 |  | tmr_channel_select_type | tmr_channel,
 |  | tmr_force_output_type | force_output )

set tmr force output

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_channel this parameter can be one of the following values:
  • TMR_SELECT_CHANNEL_1
  • TMR_SELECT_CHANNEL_2
  • TMR_SELECT_CHANNEL_3
  • TMR_SELECT_CHANNEL_4
force_output this parameter can be one of the following values:
  • TMR_FORCE_OUTPUT_HIGH
  • TMR_FORCE_OUTPUT_LOW
Return values
none

Definition at line 1687 of file at32f413_tmr.c.

◆ tmr_hall_select()

void tmr_hall_select | ( | tmr_type * | tmr_x,
 |  | confirm_state | new_state )

select tmr hall

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR8
new_state | (TRUE or FALSE)
Return values
none

Definition at line 1225 of file at32f413_tmr.c.

◆ tmr_input_channel_divider_set()

void tmr_input_channel_divider_set | ( | tmr_type * | tmr_x,
 |  | tmr_channel_select_type | tmr_channel,
 |  | tmr_channel_input_divider_type | divider_factor )

set tmr input channel divider

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_channel this parameter can be one of the following values:
  • TMR_SELECT_CHANNEL_1
  • TMR_SELECT_CHANNEL_2
  • TMR_SELECT_CHANNEL_3
  • TMR_SELECT_CHANNEL_4
divider_factor this parameter can be one of the following values:
  • TMR_CHANNEL_INPUT_DIV_1
  • TMR_CHANNEL_INPUT_DIV_2
  • TMR_CHANNEL_INPUT_DIV_4
  • TMR_CHANNEL_INPUT_DIV_8
Return values
none

Definition at line 1127 of file at32f413_tmr.c.

◆ tmr_input_channel_filter_set()

void tmr_input_channel_filter_set | ( | tmr_type * | tmr_x,
 |  | tmr_channel_select_type | tmr_channel,
 |  | uint16_t | filter_value )

set tmr input channel filter

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_channel this parameter can be one of the following values:
  • TMR_SELECT_CHANNEL_1
  • TMR_SELECT_CHANNEL_2
  • TMR_SELECT_CHANNEL_3
  • TMR_SELECT_CHANNEL_4
filter_value | (0x0~0xf)
Return values
none

Definition at line 944 of file at32f413_tmr.c.

◆ tmr_input_channel_init()

void tmr_input_channel_init | ( | tmr_type * | tmr_x,
 |  | tmr_input_config_type * | input_struct,
 |  | tmr_channel_input_divider_type | divider_factor )

init tmr input channel

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
input_struct
  • to the structure of tmr_input_config_type
divider_factor this parameter can be one of the following values:
  • TMR_CHANNEL_INPUT_DIV_1
  • TMR_CHANNEL_INPUT_DIV_2
  • TMR_CHANNEL_INPUT_DIV_4
  • TMR_CHANNEL_INPUT_DIV_8
Return values
none

Definition at line 816 of file at32f413_tmr.c.

Referenced by main().

◆ tmr_input_default_para_init()

void tmr_input_default_para_init ( tmr_input_config_type * tmr_input_struct )

init tmr input default para

Parameters
tmr_input_struct
  • to the structure of tmr_input_config_type
Return values
none

Definition at line 143 of file at32f413_tmr.c.

Referenced by main().

◆ tmr_internal_clock_set()

void tmr_internal_clock_set ( tmr_type * tmr_x )

set tmr select internal clock

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9
Return values
none

Definition at line 1481 of file at32f413_tmr.c.

◆ tmr_interrupt_enable()

void tmr_interrupt_enable | ( | tmr_type * | tmr_x,
 |  | uint32_t | tmr_interrupt,
 |  | confirm_state | new_state )

enable or disable tmr interrupt

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_interrupt this parameter can be one of the following values:
  • TMR_OVF_INT
  • TMR_C1_INT
  • TMR_C2_INT
  • TMR_C3_INT
  • TMR_C4_INT
  • TMR_HALL_INT
  • TMR_TRIGGER_INT
  • TMR_BRK_INT
new_state | (TRUE or FALSE)
Return values
none

Definition at line 1327 of file at32f413_tmr.c.

Referenced by main(), tmr1_config(), tmr2_config(), TMR5_GLOBAL_IRQHandler(), and tmr_init().

◆ tmr_interrupt_flag_get()

flag_status tmr_interrupt_flag_get | ( | tmr_type * | tmr_x,
 |  | uint32_t | tmr_flag )

get tmr interrupt flag

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_flag this parameter can be one of the following values:
  • TMR_OVF_FLAG
  • TMR_C1_FLAG
  • TMR_C2_FLAG
  • TMR_C3_FLAG
  • TMR_C4_FLAG
  • TMR_HALL_FLAG
  • TMR_TRIGGER_FLAG
  • TMR_BRK_FLAG
Return values
state of tmr interrupt flag

Definition at line 1357 of file at32f413_tmr.c.

Referenced by TMR1_BRK_TMR9_IRQHandler(), TMR1_OVF_TMR10_IRQHandler(), TMR2_GLOBAL_IRQHandler(), TMR3_GLOBAL_IRQHandler(), and TMR5_GLOBAL_IRQHandler().

◆ tmr_one_cycle_mode_enable()

void tmr_one_cycle_mode_enable | ( | tmr_type * | tmr_x,
 |  | confirm_state | new_state )

enable or disable tmr one cycle mode

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9
new_state | (TRUE or FALSE)
Return values
none

Definition at line 744 of file at32f413_tmr.c.

Referenced by main().

◆ tmr_output_channel_buffer_enable()

void tmr_output_channel_buffer_enable | ( | tmr_type * | tmr_x,
 |  | tmr_channel_select_type | tmr_channel,
 |  | confirm_state | new_state )

enable tmr output channel buffer

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_channel this parameter can be one of the following values:
  • TMR_SELECT_CHANNEL_1
  • TMR_SELECT_CHANNEL_2
  • TMR_SELECT_CHANNEL_3
  • TMR_SELECT_CHANNEL_4
new_state | (TRUE or FALSE)
Return values
none

Definition at line 613 of file at32f413_tmr.c.

Referenced by main(), and mclk_tmr1_init().

◆ tmr_output_channel_config()

void tmr_output_channel_config | ( | tmr_type * | tmr_x,
 |  | tmr_channel_select_type | tmr_channel,
 |  | tmr_output_config_type * | tmr_output_struct )

config tmr output channel

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_channel this parameter can be one of the following values:
  • TMR_SELECT_CHANNEL_1
  • TMR_SELECT_CHANNEL_2
  • TMR_SELECT_CHANNEL_3
  • TMR_SELECT_CHANNEL_4
tmr_output_struct
  • to the structure of tmr_output_config_type
Return values
none

Definition at line 318 of file at32f413_tmr.c.

Referenced by main(), mclk_tmr1_init(), and tmr1_config().

◆ tmr_output_channel_immediately_set()

void tmr_output_channel_immediately_set | ( | tmr_type * | tmr_x,
 |  | tmr_channel_select_type | tmr_channel,
 |  | confirm_state | new_state )

set tmr output channel immediately

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_channel this parameter can be one of the following values:
  • TMR_SELECT_CHANNEL_1
  • TMR_SELECT_CHANNEL_2
  • TMR_SELECT_CHANNEL_3
  • TMR_SELECT_CHANNEL_4
new_state | (TRUE or FALSE)
Return values
none

Definition at line 659 of file at32f413_tmr.c.

◆ tmr_output_channel_mode_select()

void tmr_output_channel_mode_select | ( | tmr_type * | tmr_x,
 |  | tmr_channel_select_type | tmr_channel,
 |  | tmr_output_control_mode_type | oc_mode )

select tmr output channel mode

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_channel this parameter can be one of the following values:
  • TMR_SELECT_CHANNEL_1
  • TMR_SELECT_CHANNEL_2
  • TMR_SELECT_CHANNEL_3
  • TMR_SELECT_CHANNEL_4
oc_mode this parameter can be one of the following values:
  • TMR_OUTPUT_CONTROL_OFF
  • TMR_OUTPUT_CONTROL_HIGH
  • TMR_OUTPUT_CONTROL_LOW
  • TMR_OUTPUT_CONTROL_SWITCH
  • TMR_OUTPUT_CONTROL_FORCE_HIGH
  • TMR_OUTPUT_CONTROL_FORCE_LOW
  • TMR_OUTPUT_CONTROL_PWM_MODE_A
  • TMR_OUTPUT_CONTROL_PWM_MODE_B
Return values
none

Definition at line 429 of file at32f413_tmr.c.

Referenced by TMR1_TRG_HALL_TMR11_IRQHandler().

◆ tmr_output_channel_polarity_set()

void tmr_output_channel_polarity_set | ( | tmr_type * | tmr_x,
 |  | tmr_channel_select_type | tmr_channel,
 |  | tmr_polarity_active_type | oc_polarity )

set tmr output channel polarity

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_channel this parameter can be one of the following values:
  • TMR_SELECT_CHANNEL_1
  • TMR_SELECT_CHANNEL_2
  • TMR_SELECT_CHANNEL_3
  • TMR_SELECT_CHANNEL_4
  • TMR_SELECT_CHANNEL_1C
  • TMR_SELECT_CHANNEL_2C
  • TMR_SELECT_CHANNEL_3C
oc_polarity this parameter can be one of the following values:
  • TMR_POLARITY_ACTIVE_HIGH
  • TMR_POLARITY_ACTIVE_LOW
Return values
none

Definition at line 1507 of file at32f413_tmr.c.

◆ tmr_output_channel_switch_set()

void tmr_output_channel_switch_set | ( | tmr_type * | tmr_x,
 |  | tmr_channel_select_type | tmr_channel,
 |  | confirm_state | new_state )

set tmr output channel switch

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_channel this parameter can be one of the following values:
  • TMR_SELECT_CHANNEL_1
  • TMR_SELECT_CHANNEL_2
  • TMR_SELECT_CHANNEL_3
  • TMR_SELECT_CHANNEL_4
new_state | (TRUE or FALSE)
Return values
none

Definition at line 705 of file at32f413_tmr.c.

◆ tmr_output_default_para_init()

void tmr_output_default_para_init ( tmr_output_config_type * tmr_output_struct )

init tmr output default para

Parameters
tmr_output_struct
  • to the structure of tmr_output_config_type
Return values
none

Definition at line 126 of file at32f413_tmr.c.

Referenced by main(), mclk_tmr1_init(), and tmr1_config().

◆ tmr_output_enable()

void tmr_output_enable | ( | tmr_type * | tmr_x,
 |  | confirm_state | new_state )

tmr output enable(oen),this function is important for advtm output enable

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR8
new_state | (TRUE or FALSE)
Return values
none

Definition at line 1469 of file at32f413_tmr.c.

Referenced by main(), and mclk_tmr1_init().

◆ tmr_overflow_event_disable()

void tmr_overflow_event_disable | ( | tmr_type * | tmr_x,
 |  | confirm_state | new_state )

enable or disable tmr overflow event generation

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
new_state | (TRUE or FALSE)
Return values
none

Definition at line 795 of file at32f413_tmr.c.

◆ tmr_overflow_request_source_set()

void tmr_overflow_request_source_set | ( | tmr_type * | tmr_x,
 |  | confirm_state | new_state )

select tmr the overflow event sources

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
new_state | (TRUE or FALSE)
Return values
none

Definition at line 781 of file at32f413_tmr.c.

◆ tmr_period_buffer_enable()

void tmr_period_buffer_enable | ( | tmr_type * | tmr_x,
 |  | confirm_state | new_state )

enable tmr period buffer

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
new_state | (TRUE or FALSE)
Return values
none

Definition at line 592 of file at32f413_tmr.c.

Referenced by main().

◆ tmr_period_value_get()

uint32_t tmr_period_value_get ( tmr_type * tmr_x )

get tmr period value

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
Return values
timer period register value of counter (for 16 bit tmr 0x0000~0xFFFF, for 32 bit tmr 0x0000_0000~0xFFFF_FFFF)

Definition at line 485 of file at32f413_tmr.c.

◆ tmr_period_value_set()

void tmr_period_value_set | ( | tmr_type * | tmr_x,
 |  | uint32_t | tmr_pr_value )

set tmr period value

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
tmr_pr_value | timer period register value of counter (for 16 bit tmr 0x0000~0xFFFF, for 32 bit tmr 0x0000_0000~0xFFFF_FFFF)
Return values
none

Definition at line 469 of file at32f413_tmr.c.

◆ tmr_primary_mode_select()

void tmr_primary_mode_select | ( | tmr_type * | tmr_x,
 |  | tmr_primary_select_type | primary_mode )

select tmr primary mode

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8
primary_mode this parameter can be one of the following values:
  • TMR_PRIMARY_SEL_RESET
  • TMR_PRIMARY_SEL_ENABLE
  • TMR_PRIMARY_SEL_OVERFLOW
  • TMR_PRIMARY_SEL_COMPARE
  • TMR_PRIMARY_SEL_C1ORAW
  • TMR_PRIMARY_SEL_C2ORAW
  • TMR_PRIMARY_SEL_C3ORAW
  • TMR_PRIMARY_SEL_C4ORAW
Return values
none

Definition at line 1174 of file at32f413_tmr.c.

Referenced by main().

◆ tmr_pwm_input_config()

void tmr_pwm_input_config | ( | tmr_type * | tmr_x,
 |  | tmr_input_config_type * | input_struct,
 |  | tmr_channel_input_divider_type | divider_factor )

config tmr pwm input

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
input_struct
  • to the structure of tmr_input_config_type
divider_factor this parameter can be one of the following values:
  • TMR_CHANNEL_INPUT_DIV_1
  • TMR_CHANNEL_INPUT_DIV_2
  • TMR_CHANNEL_INPUT_DIV_4
  • TMR_CHANNEL_INPUT_DIV_8
Return values
none

Definition at line 990 of file at32f413_tmr.c.

Referenced by main().

◆ tmr_repetition_counter_set()

void tmr_repetition_counter_set | ( | tmr_type * | tmr_x,
 |  | uint8_t | tmr_rpr_value )

set the repetition counter register(rpr) value

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR8
tmr_rpr_value | (0x00~0xFF)
Return values
none

Definition at line 239 of file at32f413_tmr.c.

Referenced by main().

◆ tmr_reset()

void tmr_reset ( tmr_type * tmr_x )

tmr reset by crm reset register

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9, TMR10, TMR11
Return values
none

Definition at line 51 of file at32f413_tmr.c.

◆ tmr_sub_mode_select()

void tmr_sub_mode_select | ( | tmr_type * | tmr_x,
 |  | tmr_sub_mode_select_type | sub_mode )

select tmr subordinate mode

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9
sub_mode this parameter can be one of the following values:
  • TMR_SUB_MODE_DIABLE
  • TMR_SUB_ENCODER_MODE_A
  • TMR_SUB_ENCODER_MODE_B
  • TMR_SUB_ENCODER_MODE_C
  • TMR_SUB_RESET_MODE
  • TMR_SUB_HANG_MODE
  • TMR_SUB_TRIGGER_MODE
  • TMR_SUB_EXTERNAL_CLOCK_MODE_A
Return values
none

Definition at line 1196 of file at32f413_tmr.c.

Referenced by main().

◆ tmr_sub_sync_mode_set()

void tmr_sub_sync_mode_set | ( | tmr_type * | tmr_x,
 |  | confirm_state | new_state )

set tmr subordinate synchronization mode

Parameters
tmr_x | select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9
new_state | (TRUE or FALSE)
Return values
none

Definition at line 1273 of file at32f413_tmr.c.

Referenced by main().

◆ tmr_trigger_input_select()

void tmr_trigger_input_select | ( | tmr_type * | tmr_x,
 |  | sub_tmr_input_sel_type | trigger_select )

select tmr sub-trigger

Parameters
tmr_x select the tmr peripheral. this parameter can be one of the following values: TMR1, TMR2, TMR3, TMR4, TMR5, TMR8, TMR9
trigger_select this parameter can be one of the following values:
  • TMR_SUB_INPUT_SEL_IS0
  • TMR_SUB_INPUT_SEL_IS1
  • TMR_SUB_INPUT_SEL_IS2
  • TMR_SUB_INPUT_SEL_IS3
  • TMR_SUB_INPUT_SEL_C1INC
  • TMR_SUB_INPUT_SEL_C1DF1
  • TMR_SUB_INPUT_SEL_C2DF2
  • TMR_SUB_INPUT_SEL_EXTIN
Return values
none

Definition at line 1260 of file at32f413_tmr.c.

Referenced by main().


AT32F413 Firmwary Library: USART

Topics | Macros
USART
AT32F413_periph_driver

USART driver modules. More...

Topics

USART_flags_definition
usart flag
USART_interrupts_definition
usart interrupt
USART_exported_types
USART_exported_functions
USART_private_functions

Macros

#define | USART1 ((usart_type *) USART1_BASE)
#define | USART2 ((usart_type *) USART2_BASE)

Detailed Description

USART driver modules.

Macro Definition Documentation

◆ USART1

#define USART1 ((usart_type *) USART1_BASE)

Definition at line 318 of file at32f413_usart.h.

Referenced by back_err(), back_ok(), data_take(), uart_init(), usart1_config(), USART1_IRQHandler(), usart_init(), and usart_reset().

◆ USART2

#define USART2 ((usart_type *) USART2_BASE)

Definition at line 319 of file at32f413_usart.h.

Referenced by dma_configuration(), main(), rs485_config(), rs485_send_data(), USART2_IRQHandler(), usart_configuration(), usart_reset(), usart_send_data(), usart_spi_configuration(), and usb_usart_config().


AT32F413 Firmwary Library: USART_flags_definition

Macros
USART_flags_definition
AT32F413_periph_driver » USART

usart flag More...

Macros

#define | USART_PERR_FLAG ((uint32_t)0x00000001)
#define | USART_FERR_FLAG ((uint32_t)0x00000002)
#define | USART_NERR_FLAG ((uint32_t)0x00000004)
#define | USART_ROERR_FLAG ((uint32_t)0x00000008)
#define | USART_IDLEF_FLAG ((uint32_t)0x00000010)
#define | USART_RDBF_FLAG ((uint32_t)0x00000020)
#define | USART_TDC_FLAG ((uint32_t)0x00000040)
#define | USART_TDBE_FLAG ((uint32_t)0x00000080)
#define | USART_BFF_FLAG ((uint32_t)0x00000100)
#define | USART_CTSCF_FLAG ((uint32_t)0x00000200)

Detailed Description

usart flag

Macro Definition Documentation

◆ USART_BFF_FLAG

#define USART_BFF_FLAG ((uint32_t)0x00000100)

usart break frame flag

Definition at line 59 of file at32f413_usart.h.

Referenced by usart_interrupt_flag_get().

◆ USART_CTSCF_FLAG

#define USART_CTSCF_FLAG ((uint32_t)0x00000200)

usart cts change flag

Definition at line 60 of file at32f413_usart.h.

Referenced by usart_interrupt_flag_get().

◆ USART_FERR_FLAG

#define USART_FERR_FLAG ((uint32_t)0x00000002)

usart framing error flag

Definition at line 52 of file at32f413_usart.h.

Referenced by usart_flag_clear(), and usart_interrupt_flag_get().

◆ USART_IDLEF_FLAG

#define USART_IDLEF_FLAG ((uint32_t)0x00000010)

usart idle flag

Definition at line 55 of file at32f413_usart.h.

Referenced by main(), USART2_IRQHandler(), usart_flag_clear(), and usart_interrupt_flag_get().

◆ USART_NERR_FLAG

#define USART_NERR_FLAG ((uint32_t)0x00000004)

usart noise error flag

Definition at line 53 of file at32f413_usart.h.

Referenced by usart_flag_clear(), and usart_interrupt_flag_get().

◆ USART_PERR_FLAG

#define USART_PERR_FLAG ((uint32_t)0x00000001)

usart parity error flag

Definition at line 51 of file at32f413_usart.h.

Referenced by USART2_IRQHandler(), usart_flag_clear(), and usart_interrupt_flag_get().

◆ USART_RDBF_FLAG

#define USART_RDBF_FLAG ((uint32_t)0x00000020)

usart receive data buffer full flag

Definition at line 56 of file at32f413_usart.h.

Referenced by main(), rs485_config(), USART1_IRQHandler(), USART2_IRQHandler(), USART3_IRQHandler(), usart_flag_clear(), and usart_interrupt_flag_get().

◆ USART_ROERR_FLAG

#define USART_ROERR_FLAG ((uint32_t)0x00000008)

usart receiver overflow error flag

Definition at line 54 of file at32f413_usart.h.

Referenced by usart_flag_clear(), and usart_interrupt_flag_get().

◆ USART_TDBE_FLAG

#define USART_TDBE_FLAG ((uint32_t)0x00000080)

usart transmit data buffer empty flag

Definition at line 58 of file at32f413_usart.h.

Referenced by fputc(), main(), rs485_send_data(), USART2_IRQHandler(), USART3_IRQHandler(), usart_interrupt_flag_get(), and usart_send_data().

◆ USART_TDC_FLAG

#define USART_TDC_FLAG ((uint32_t)0x00000040)

usart transmit data complete flag

Definition at line 57 of file at32f413_usart.h.

Referenced by back_err(), back_ok(), fputc(), main(), rs485_send_data(), and usart_interrupt_flag_get().


AT32F413 Firmwary Library: USART_interrupts_definition

Macros
USART_interrupts_definition
AT32F413_periph_driver » USART

usart interrupt More...

Macros

#define | USART_IDLE_INT MAKE_VALUE(0x0C,0x04)
#define | USART_RDBF_INT MAKE_VALUE(0x0C,0x05)
#define | USART_TDC_INT MAKE_VALUE(0x0C,0x06)
#define | USART_TDBE_INT MAKE_VALUE(0x0C,0x07)
#define | USART_PERR_INT MAKE_VALUE(0x0C,0x08)
#define | USART_BF_INT MAKE_VALUE(0x10,0x06)
#define | USART_ERR_INT MAKE_VALUE(0x14,0x00)
#define | USART_CTSCF_INT MAKE_VALUE(0x14,0x0A)

Detailed Description

usart interrupt

Macro Definition Documentation

◆ USART_BF_INT

#define USART_BF_INT MAKE_VALUE(0x10,0x06)

usart break frame interrupt

Definition at line 76 of file at32f413_usart.h.

◆ USART_CTSCF_INT

#define USART_CTSCF_INT MAKE_VALUE(0x14,0x0A)

usart cts change interrupt

Definition at line 78 of file at32f413_usart.h.

◆ USART_ERR_INT

#define USART_ERR_INT MAKE_VALUE(0x14,0x00)

usart error interrupt

Definition at line 77 of file at32f413_usart.h.

◆ USART_IDLE_INT

#define USART_IDLE_INT MAKE_VALUE(0x0C,0x04)

usart idle interrupt

Definition at line 71 of file at32f413_usart.h.

Referenced by usart_configuration().

◆ USART_PERR_INT

#define USART_PERR_INT MAKE_VALUE(0x0C,0x08)

usart parity error interrupt

Definition at line 75 of file at32f413_usart.h.

Referenced by usart_configuration().

◆ USART_RDBF_INT

#define USART_RDBF_INT MAKE_VALUE(0x0C,0x05)

usart receive data buffer full interrupt

Definition at line 72 of file at32f413_usart.h.

Referenced by data_take(), main(), rs485_config(), uart_init(), usart1_config(), USART2_IRQHandler(), USART3_IRQHandler(), usart_configuration(), and usb_usart_config().

◆ USART_TDBE_INT

#define USART_TDBE_INT MAKE_VALUE(0x0C,0x07)

usart transmit data buffer empty interrupt

Definition at line 74 of file at32f413_usart.h.

Referenced by USART2_IRQHandler(), USART3_IRQHandler(), and usart_configuration().

◆ USART_TDC_INT

#define USART_TDC_INT MAKE_VALUE(0x0C,0x06)

usart transmit data complete interrupt

Definition at line 73 of file at32f413_usart.h.


AT32F413 Firmwary Library: USART_exported_types

Data Structures | Enumerations
USART_exported_types
AT32F413_periph_driver » USART

Data Structures

struct usart_type
type define usart register all More...

Enumerations

enum | usart_parity_selection_type { USART_PARITY_NONE = 0x00 , USART_PARITY_EVEN = 0x01 , USART_PARITY_ODD = 0x02 }
usart parity selection type More...
enum | usart_wakeup_mode_type { USART_WAKEUP_BY_IDLE_FRAME = 0x00 , USART_WAKEUP_BY_MATCHING_ID = 0x01 }
usart wakeup mode type More...
enum | usart_data_bit_num_type { USART_DATA_8BITS = 0x00 , USART_DATA_9BITS = 0x01 }
usart data bit num type More...
enum | usart_break_bit_num_type { USART_BREAK_10BITS = 0x00 , USART_BREAK_11BITS = 0x01 }
usart break frame bit num type More...
enum | usart_clock_phase_type { USART_CLOCK_PHASE_1EDGE = 0x00 , USART_CLOCK_PHASE_2EDGE = 0x01 }
usart phase of the clock type More...
enum | usart_clock_polarity_type { USART_CLOCK_POLARITY_LOW = 0x00 , USART_CLOCK_POLARITY_HIGH = 0x01 }
usart polarity of the clock type More...
enum | usart_lbcp_type { USART_CLOCK_LAST_BIT_NONE = 0x00 , USART_CLOCK_LAST_BIT_OUTPUT = 0x01 }
usart last bit clock pulse type More...
enum | usart_stop_bit_num_type { USART_STOP_1_BIT = 0x00 , USART_STOP_0_5_BIT = 0x01 , USART_STOP_2_BIT = 0x02 , USART_STOP_1_5_BIT = 0x03 }
usart stop bit num type More...
enum | usart_hardware_flow_control_type { USART_HARDWARE_FLOW_NONE = 0x00 , USART_HARDWARE_FLOW_RTS = 0x01 , USART_HARDWARE_FLOW_CTS = 0x02 , USART_HARDWARE_FLOW_RTS_CTS = 0x03 }
usart hardware flow control type More...

Detailed Description

Enumeration Type Documentation

◆ usart_break_bit_num_type

enum usart_break_bit_num_type

usart break frame bit num type

Enumerator
USART_BREAK_10BITS | usart lin mode berak frame detection 10 bits
USART_BREAK_11BITS | usart lin mode berak frame detection 11 bits

Definition at line 119 of file at32f413_usart.h.

◆ usart_clock_phase_type

enum usart_clock_phase_type

usart phase of the clock type

Enumerator
USART_CLOCK_PHASE_1EDGE | usart data capture is done on the clock leading edge
USART_CLOCK_PHASE_2EDGE | usart data capture is done on the clock trailing edge

Definition at line 128 of file at32f413_usart.h.

◆ usart_clock_polarity_type

enum usart_clock_polarity_type

usart polarity of the clock type

Enumerator
USART_CLOCK_POLARITY_LOW | usart clock stay low level outside transmission window
USART_CLOCK_POLARITY_HIGH | usart clock stay high level outside transmission window

Definition at line 137 of file at32f413_usart.h.

◆ usart_data_bit_num_type

enum usart_data_bit_num_type

usart data bit num type

Enumerator
USART_DATA_8BITS | usart data size is 8 bits
USART_DATA_9BITS | usart data size is 9 bits

Definition at line 110 of file at32f413_usart.h.

◆ usart_hardware_flow_control_type

enum usart_hardware_flow_control_type

usart hardware flow control type

Enumerator
USART_HARDWARE_FLOW_NONE | usart without hardware flow
USART_HARDWARE_FLOW_RTS | usart hardware flow only rts
USART_HARDWARE_FLOW_CTS | usart hardware flow only cts
USART_HARDWARE_FLOW_RTS_CTS | usart hardware flow both rts and cts

Definition at line 166 of file at32f413_usart.h.

◆ usart_lbcp_type

enum usart_lbcp_type

usart last bit clock pulse type

Enumerator
USART_CLOCK_LAST_BIT_NONE | usart clock pulse of the last data bit is not outputted
USART_CLOCK_LAST_BIT_OUTPUT | usart clock pulse of the last data bit is outputted

Definition at line 146 of file at32f413_usart.h.

◆ usart_parity_selection_type

enum usart_parity_selection_type

usart parity selection type

Enumerator
USART_PARITY_NONE | usart no parity
USART_PARITY_EVEN | usart even parity
USART_PARITY_ODD | usart odd parity

Definition at line 91 of file at32f413_usart.h.

◆ usart_stop_bit_num_type

enum usart_stop_bit_num_type

usart stop bit num type

Enumerator
USART_STOP_1_BIT | usart stop bits num is 1
USART_STOP_0_5_BIT | usart stop bits num is 0.5
USART_STOP_2_BIT | usart stop bits num is 2
USART_STOP_1_5_BIT | usart stop bits num is 1.5

Definition at line 155 of file at32f413_usart.h.

◆ usart_wakeup_mode_type

enum usart_wakeup_mode_type

usart wakeup mode type

Enumerator
USART_WAKEUP_BY_IDLE_FRAME | usart wakeup by idle frame
USART_WAKEUP_BY_MATCHING_ID | usart wakeup by matching id

Definition at line 101 of file at32f413_usart.h.


AT32F413 Firmwary Library: usart_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
usart_type Struct Reference
AT32F413_periph_driver » USART » USART_exported_types

type define usart register all More...

#include <at32f413_usart.h>

Data Fields

union {
__IO uint32_t sts
struct {
__IO uint32_t perr: 1
__IO uint32_t ferr: 1
__IO uint32_t nerr: 1
__IO uint32_t roerr: 1
__IO uint32_t idlef: 1
__IO uint32_t rdbf: 1
__IO uint32_t tdc: 1
__IO uint32_t tdbe: 1
__IO uint32_t bff: 1
__IO uint32_t ctscf: 1
__IO uint32_t reserved1: 22
} sts_bit
};
usart sts register, offset:0x00
union {
__IO uint32_t dt
struct {
__IO uint32_t dt: 9
__IO uint32_t reserved1: 23
} dt_bit
};
usart dt register, offset:0x04
union {
__IO uint32_t baudr
struct {
__IO uint32_t div: 16
__IO uint32_t reserved1: 16
} baudr_bit
};
usart baudr register, offset:0x08
union {
__IO uint32_t ctrl1
struct {
__IO uint32_t sbf: 1
__IO uint32_t rm: 1
__IO uint32_t ren: 1
__IO uint32_t ten: 1
__IO uint32_t idleien: 1
__IO uint32_t rdbfien: 1
__IO uint32_t tdcien: 1
__IO uint32_t tdbeien: 1
__IO uint32_t perrien: 1
__IO uint32_t psel: 1
__IO uint32_t pen: 1
__IO uint32_t wum: 1
__IO uint32_t dbn: 1
__IO uint32_t uen: 1
__IO uint32_t reserved1: 18
} ctrl1_bit
};
usart ctrl1 register, offset:0x0C
union {
__IO uint32_t ctrl2
struct {
__IO uint32_t id: 4
__IO uint32_t reserved1: 1
__IO uint32_t bfbn: 1
__IO uint32_t bfien: 1
__IO uint32_t reserved2: 1
__IO uint32_t lbcp: 1
__IO uint32_t clkpha: 1
__IO uint32_t clkpol: 1
__IO uint32_t clken: 1
__IO uint32_t stopbn: 2
__IO uint32_t linen: 1
__IO uint32_t reserved3: 17
} ctrl2_bit
};
usart ctrl2 register, offset:0x10
union {
__IO uint32_t ctrl3
struct {
__IO uint32_t errien: 1
__IO uint32_t irdaen: 1
__IO uint32_t irdalp: 1
__IO uint32_t slben: 1
__IO uint32_t scnacken: 1
__IO uint32_t scmen: 1
__IO uint32_t dmaren: 1
__IO uint32_t dmaten: 1
__IO uint32_t rtsen: 1
__IO uint32_t ctsen: 1
__IO uint32_t ctscfien: 1
__IO uint32_t reserved1: 21
} ctrl3_bit
};
usart ctrl3 register, offset:0x14
union {
__IO uint32_t gdiv
struct {
__IO uint32_t isdiv: 8
__IO uint32_t scgt: 8
__IO uint32_t reserved1: 16
} gdiv_bit
};
usart gdiv register, offset:0x18

Detailed Description

type define usart register all

Definition at line 177 of file at32f413_usart.h.

Field Documentation

◆ [union]

union { ... } usart_type

usart sts register, offset:0x00

◆ [union]

union { ... } usart_type

usart dt register, offset:0x04

◆ [union]

union { ... } usart_type

usart baudr register, offset:0x08

◆ [union]

union { ... } usart_type

usart ctrl1 register, offset:0x0C

◆ [union]

union { ... } usart_type

usart ctrl2 register, offset:0x10

◆ [union]

union { ... } usart_type

usart ctrl3 register, offset:0x14

◆ [union]

union { ... } usart_type

usart gdiv register, offset:0x18

◆ baudr

__IO uint32_t usart_type::baudr

Definition at line 219 of file at32f413_usart.h.

◆ [struct]

struct { ... } usart_type::baudr_bit

Referenced by usart_init().

◆ bfbn

__IO uint32_t usart_type::bfbn

Definition at line 263 of file at32f413_usart.h.

Referenced by usart_break_bit_num_set().

◆ bff

__IO uint32_t usart_type::bff

Definition at line 195 of file at32f413_usart.h.

◆ bfien

__IO uint32_t usart_type::bfien

Definition at line 264 of file at32f413_usart.h.

Referenced by usart_interrupt_flag_get().

◆ clken

__IO uint32_t usart_type::clken

Definition at line 269 of file at32f413_usart.h.

Referenced by usart_clock_enable().

◆ clkpha

__IO uint32_t usart_type::clkpha

Definition at line 267 of file at32f413_usart.h.

Referenced by usart_clock_config().

◆ clkpol

__IO uint32_t usart_type::clkpol

Definition at line 268 of file at32f413_usart.h.

Referenced by usart_clock_config().

◆ ctrl1

__IO uint32_t usart_type::ctrl1

Definition at line 232 of file at32f413_usart.h.

◆ [struct]

struct { ... } usart_type::ctrl1_bit

Referenced by usart_break_send(), usart_enable(), usart_init(), usart_interrupt_flag_get(), usart_parity_selection_config(), usart_receiver_enable(), usart_receiver_mute_enable(), usart_transmitter_enable(), and usart_wakeup_mode_set().

◆ ctrl2

__IO uint32_t usart_type::ctrl2

Definition at line 258 of file at32f413_usart.h.

◆ [struct]

struct { ... } usart_type::ctrl2_bit

Referenced by usart_break_bit_num_set(), usart_clock_config(), usart_clock_enable(), usart_init(), usart_interrupt_flag_get(), usart_lin_mode_enable(), and usart_wakeup_id_set().

◆ ctrl3

__IO uint32_t usart_type::ctrl3

Definition at line 281 of file at32f413_usart.h.

◆ [struct]

struct { ... } usart_type::ctrl3_bit

Referenced by usart_dma_receiver_enable(), usart_dma_transmitter_enable(), usart_hardware_flow_control_set(), usart_interrupt_flag_get(), usart_irda_low_power_enable(), usart_irda_mode_enable(), usart_single_line_halfduplex_select(), usart_smartcard_mode_enable(), and usart_smartcard_nack_set().

◆ ctscf

__IO uint32_t usart_type::ctscf

Definition at line 196 of file at32f413_usart.h.

◆ ctscfien

__IO uint32_t usart_type::ctscfien

Definition at line 294 of file at32f413_usart.h.

Referenced by usart_interrupt_flag_get().

◆ ctsen

__IO uint32_t usart_type::ctsen

Definition at line 293 of file at32f413_usart.h.

Referenced by usart_hardware_flow_control_set().

◆ dbn

__IO uint32_t usart_type::dbn

Definition at line 247 of file at32f413_usart.h.

Referenced by usart_init().

◆ div

__IO uint32_t usart_type::div

Definition at line 222 of file at32f413_usart.h.

Referenced by usart_init().

◆ dmaren

__IO uint32_t usart_type::dmaren

Definition at line 290 of file at32f413_usart.h.

Referenced by usart_dma_receiver_enable().

◆ dmaten

__IO uint32_t usart_type::dmaten

Definition at line 291 of file at32f413_usart.h.

Referenced by usart_dma_transmitter_enable().

◆ dt

__IO uint32_t usart_type::dt

Definition at line 206 of file at32f413_usart.h.

Referenced by usart_data_receive(), usart_data_transmit(), and usart_flag_clear().

◆ [struct]

struct { ... } usart_type::dt_bit

◆ errien

__IO uint32_t usart_type::errien

Definition at line 284 of file at32f413_usart.h.

Referenced by usart_interrupt_flag_get().

◆ ferr

__IO uint32_t usart_type::ferr

Definition at line 188 of file at32f413_usart.h.

◆ gdiv

__IO uint32_t usart_type::gdiv

Definition at line 304 of file at32f413_usart.h.

◆ [struct]

struct { ... } usart_type::gdiv_bit

Referenced by usart_irda_smartcard_division_set(), and usart_smartcard_guard_time_set().

◆ id

__IO uint32_t usart_type::id

Definition at line 261 of file at32f413_usart.h.

Referenced by usart_wakeup_id_set().

◆ idlef

__IO uint32_t usart_type::idlef

Definition at line 191 of file at32f413_usart.h.

◆ idleien

__IO uint32_t usart_type::idleien

Definition at line 239 of file at32f413_usart.h.

Referenced by usart_interrupt_flag_get().

◆ irdaen

__IO uint32_t usart_type::irdaen

Definition at line 285 of file at32f413_usart.h.

Referenced by usart_irda_mode_enable().

◆ irdalp

__IO uint32_t usart_type::irdalp

Definition at line 286 of file at32f413_usart.h.

Referenced by usart_irda_low_power_enable().

◆ isdiv

__IO uint32_t usart_type::isdiv

Definition at line 307 of file at32f413_usart.h.

Referenced by usart_irda_smartcard_division_set().

◆ lbcp

__IO uint32_t usart_type::lbcp

Definition at line 266 of file at32f413_usart.h.

Referenced by usart_clock_config().

◆ linen

__IO uint32_t usart_type::linen

Definition at line 271 of file at32f413_usart.h.

Referenced by usart_lin_mode_enable().

◆ nerr

__IO uint32_t usart_type::nerr

Definition at line 189 of file at32f413_usart.h.

◆ pen

__IO uint32_t usart_type::pen

Definition at line 245 of file at32f413_usart.h.

Referenced by usart_parity_selection_config().

◆ perr

__IO uint32_t usart_type::perr

Definition at line 187 of file at32f413_usart.h.

◆ perrien

__IO uint32_t usart_type::perrien

Definition at line 243 of file at32f413_usart.h.

Referenced by usart_interrupt_flag_get().

◆ psel

__IO uint32_t usart_type::psel

Definition at line 244 of file at32f413_usart.h.

Referenced by usart_parity_selection_config().

◆ rdbf

__IO uint32_t usart_type::rdbf

Definition at line 192 of file at32f413_usart.h.

◆ rdbfien

__IO uint32_t usart_type::rdbfien

Definition at line 240 of file at32f413_usart.h.

Referenced by usart_interrupt_flag_get().

◆ ren

__IO uint32_t usart_type::ren

Definition at line 237 of file at32f413_usart.h.

Referenced by usart_receiver_enable().

◆ reserved1

__IO uint32_t usart_type::reserved1

Definition at line 197 of file at32f413_usart.h.

◆ reserved2

__IO uint32_t usart_type::reserved2

Definition at line 265 of file at32f413_usart.h.

◆ reserved3

__IO uint32_t usart_type::reserved3

Definition at line 272 of file at32f413_usart.h.

◆ rm

__IO uint32_t usart_type::rm

Definition at line 236 of file at32f413_usart.h.

Referenced by usart_receiver_mute_enable().

◆ roerr

__IO uint32_t usart_type::roerr

Definition at line 190 of file at32f413_usart.h.

◆ rtsen

__IO uint32_t usart_type::rtsen

Definition at line 292 of file at32f413_usart.h.

Referenced by usart_hardware_flow_control_set().

◆ sbf

__IO uint32_t usart_type::sbf

Definition at line 235 of file at32f413_usart.h.

Referenced by usart_break_send().

◆ scgt

__IO uint32_t usart_type::scgt

Definition at line 308 of file at32f413_usart.h.

Referenced by usart_smartcard_guard_time_set().

◆ scmen

__IO uint32_t usart_type::scmen

Definition at line 289 of file at32f413_usart.h.

Referenced by usart_smartcard_mode_enable().

◆ scnacken

__IO uint32_t usart_type::scnacken

Definition at line 288 of file at32f413_usart.h.

Referenced by usart_smartcard_nack_set().

◆ slben

__IO uint32_t usart_type::slben

Definition at line 287 of file at32f413_usart.h.

Referenced by usart_single_line_halfduplex_select().

◆ stopbn

__IO uint32_t usart_type::stopbn

Definition at line 270 of file at32f413_usart.h.

Referenced by usart_init().

◆ sts

__IO uint32_t usart_type::sts

Definition at line 184 of file at32f413_usart.h.

Referenced by usart_flag_clear(), usart_flag_get(), and usart_interrupt_flag_get().

◆ [struct]

struct { ... } usart_type::sts_bit

◆ tdbe

__IO uint32_t usart_type::tdbe

Definition at line 194 of file at32f413_usart.h.

◆ tdbeien

__IO uint32_t usart_type::tdbeien

Definition at line 242 of file at32f413_usart.h.

Referenced by usart_interrupt_flag_get().

◆ tdc

__IO uint32_t usart_type::tdc

Definition at line 193 of file at32f413_usart.h.

◆ tdcien

__IO uint32_t usart_type::tdcien

Definition at line 241 of file at32f413_usart.h.

Referenced by usart_interrupt_flag_get().

◆ ten

__IO uint32_t usart_type::ten

Definition at line 238 of file at32f413_usart.h.

Referenced by usart_transmitter_enable().

◆ uen

__IO uint32_t usart_type::uen

Definition at line 248 of file at32f413_usart.h.

Referenced by usart_enable().

◆ wum

__IO uint32_t usart_type::wum

Definition at line 246 of file at32f413_usart.h.

Referenced by usart_wakeup_mode_set().

The documentation for this struct was generated from the following file:
  • at32f413_usart.h


AT32F413 Firmwary Library: USART_exported_functions

Functions
USART_exported_functions
AT32F413_periph_driver » USART

Functions

void | usart_reset (usart_type *usart_x)
deinitialize the usart peripheral registers to their default reset values.
void | usart_init (usart_type *usart_x, uint32_t baud_rate, usart_data_bit_num_type data_bit, usart_stop_bit_num_type stop_bit)
initialize the usart peripheral according to the specified parameters.
void | usart_parity_selection_config (usart_type *usart_x, usart_parity_selection_type parity)
usart parity selection config.
void | usart_enable (usart_type *usart_x, confirm_state new_state)
enable or disable the specified usart peripheral.
void | usart_transmitter_enable (usart_type *usart_x, confirm_state new_state)
usart transmitter enable.
void | usart_receiver_enable (usart_type *usart_x, confirm_state new_state)
usart receiver enable.
void | usart_clock_config (usart_type *usart_x, usart_clock_polarity_type clk_pol, usart_clock_phase_type clk_pha, usart_lbcp_type clk_lb)
usart clock config.
void | usart_clock_enable (usart_type *usart_x, confirm_state new_state)
usart enable the ck pin.
void | usart_interrupt_enable (usart_type *usart_x, uint32_t usart_int, confirm_state new_state)
enable or disable the specified usart interrupts.
void | usart_dma_transmitter_enable (usart_type *usart_x, confirm_state new_state)
enable or disable the usart's dma transmitter interface.
void | usart_dma_receiver_enable (usart_type *usart_x, confirm_state new_state)
enable or disable the usart's dma receiver interface.
void | usart_wakeup_id_set (usart_type *usart_x, uint8_t usart_id)
set the wakeup id of the usart.
void | usart_wakeup_mode_set (usart_type *usart_x, usart_wakeup_mode_type wakeup_mode)
select the usart wakeup method in multi-processor communication.
void | usart_receiver_mute_enable (usart_type *usart_x, confirm_state new_state)
config the usart in mute mode in multi-processor communication.
void | usart_break_bit_num_set (usart_type *usart_x, usart_break_bit_num_type break_bit)
set the usart break frame bit num.
void | usart_lin_mode_enable (usart_type *usart_x, confirm_state new_state)
enable or disable the usart lin mode.
void | usart_data_transmit (usart_type *usart_x, uint16_t data)
transmit single data through the usart peripheral.
uint16_t | usart_data_receive (usart_type *usart_x)
return the most recent received data by the usart peripheral.
void | usart_break_send (usart_type *usart_x)
transmit break characters.
void | usart_smartcard_guard_time_set (usart_type *usart_x, uint8_t guard_time_val)
config the specified usart smartcard guard time.
void | usart_irda_smartcard_division_set (usart_type *usart_x, uint8_t div_val)
config the irda/smartcard division.
void | usart_smartcard_mode_enable (usart_type *usart_x, confirm_state new_state)
enable or disable the usart smart card mode.
void | usart_smartcard_nack_set (usart_type *usart_x, confirm_state new_state)
enable or disable nack transmission in smartcard mode.
void | usart_single_line_halfduplex_select (usart_type *usart_x, confirm_state new_state)
enable or disable the usart single line bidirectional half-duplex communication.
void | usart_irda_mode_enable (usart_type *usart_x, confirm_state new_state)
enable or disable the usart's irda interface.
void | usart_irda_low_power_enable (usart_type *usart_x, confirm_state new_state)
configure the usart's irda low power.
void | usart_hardware_flow_control_set (usart_type *usart_x, usart_hardware_flow_control_type flow_state)
configure the usart's hardware flow control.
flag_status | usart_flag_get (usart_type *usart_x, uint32_t flag)
check whether the specified usart flag is set or not.
flag_status | usart_interrupt_flag_get (usart_type *usart_x, uint32_t flag)
check whether the specified usart interrupt flag is set or not.
void | usart_flag_clear (usart_type *usart_x, uint32_t flag)
clear the usart's pending flags.

Detailed Description

Function Documentation

◆ usart_break_bit_num_set()

void usart_break_bit_num_set | ( | usart_type * | usart_x,
 |  | usart_break_bit_num_type | break_bit )

set the usart break frame bit num.

Parameters
usart_x select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
break_bit specifies the break bit num. this parameter can be one of the following values:
  • USART_BREAK_10BITS
  • USART_BREAK_11BITS
Return values
none

Definition at line 353 of file at32f413_usart.c.

◆ usart_break_send()

void usart_break_send ( usart_type * usart_x )

transmit break characters.

Parameters
usart_x select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
Return values
none

Definition at line 404 of file at32f413_usart.c.

◆ usart_clock_config()

void usart_clock_config | ( | usart_type * | usart_x,
 |  | usart_clock_polarity_type | clk_pol,
 |  | usart_clock_phase_type | clk_pha,
 |  | usart_lbcp_type | clk_lb )

usart clock config.

Note
clock config are not available for UART4 and UART5.
Parameters
usart_x select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2 or USART3.
clk_pol polarity of the clock output on the ck pin. this parameter can be one of the following values:
  • USART_CLOCK_POLARITY_LOW
  • USART_CLOCK_POLARITY_HIGH
clk_pha phase of the clock output on the ck pin. this parameter can be one of the following values:
  • USART_CLOCK_PHASE_1EDGE
  • USART_CLOCK_PHASE_2EDGE
clk_lb whether the clock pulse of the last data bit transmitted (MSB) is outputted on the ck pin. this parameter can be one of the following values:
  • USART_CLOCK_LAST_BIT_NONE
  • USART_CLOCK_LAST_BIT_OUTPUT
Return values
none

Definition at line 223 of file at32f413_usart.c.

Referenced by usart_spi_configuration().

◆ usart_clock_enable()

void usart_clock_enable | ( | usart_type * | usart_x,
 |  | confirm_state | new_state )

usart enable the ck pin.

Note
clock enable are not available for UART4 and UART5.
Parameters
usart_x | select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2 or USART3.
new_state | TRUE or FALSE
Return values
none

Definition at line 239 of file at32f413_usart.c.

Referenced by usart_configuration(), and usart_spi_configuration().

◆ usart_data_receive()

uint16_t usart_data_receive ( usart_type * usart_x )

return the most recent received data by the usart peripheral.

Parameters
usart_x select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
Return values
the received data.

Definition at line 392 of file at32f413_usart.c.

Referenced by main(), USART1_IRQHandler(), USART2_IRQHandler(), and USART3_IRQHandler().

◆ usart_data_transmit()

void usart_data_transmit | ( | usart_type * | usart_x,
 |  | uint16_t | data )

transmit single data through the usart peripheral.

Parameters
usart_x | select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
data | the data to transmit.
Return values
none

Definition at line 380 of file at32f413_usart.c.

Referenced by back_err(), back_ok(), fputc(), main(), rs485_send_data(), USART2_IRQHandler(), USART3_IRQHandler(), and usart_send_data().

◆ usart_dma_receiver_enable()

void usart_dma_receiver_enable | ( | usart_type * | usart_x,
 |  | confirm_state | new_state )

enable or disable the usart's dma receiver interface.

Parameters
usart_x | select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
new_state | new state of the dma request sources. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 294 of file at32f413_usart.c.

Referenced by usart_configuration().

◆ usart_dma_transmitter_enable()

void usart_dma_transmitter_enable | ( | usart_type * | usart_x,
 |  | confirm_state | new_state )

enable or disable the usart's dma transmitter interface.

Parameters
usart_x | select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
new_state | new state of the dma request sources. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 280 of file at32f413_usart.c.

Referenced by usart_configuration().

◆ usart_enable()

void usart_enable | ( | usart_type * | usart_x,
 |  | confirm_state | new_state )

enable or disable the specified usart peripheral.

Parameters
usart_x | select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
new_state | new state of the usart peripheral. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 172 of file at32f413_usart.c.

Referenced by rs485_config(), uart_init(), uart_print_init(), usart1_config(), usart_configuration(), usart_spi_configuration(), and usb_usart_config().

◆ usart_flag_clear()

void usart_flag_clear | ( | usart_type * | usart_x,
 |  | uint32_t | flag )

clear the usart's pending flags.

Parameters
usart_x select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
flag specifies the flag to clear. this parameter can be any combination of the following values:
  • USART_CTSCF_FLAG: (not available for UART4 and UART5).
  • USART_BFF_FLAG:
  • USART_TDC_FLAG:
  • USART_RDBF_FLAG:
  • USART_PERR_FLAG:
  • USART_FERR_FLAG:
  • USART_NERR_FLAG:
  • USART_ROERR_FLAG:
  • USART_IDLEF_FLAG:
Note
  • USART_PERR_FLAG, USART_FERR_FLAG, USART_NERR_FLAG, USART_ROERR_FLAG and USART_IDLEF_FLAG are cleared by software sequence: a read operation to usart sts register (usart_flag_get()) followed by a read operation to usart dt register (usart_data_receive()).
  • USART_TDC_FLAG can be also cleared by software sequence: a read operation to usart sts register (usart_flag_get()) followed by a write operation to usart dt register (usart_data_transmit()).
  • USART_TDBE_FLAG is cleared only by a write to the usart dt register(usart_data_transmit()).
Return values
none

< usart parity error flag

< usart framing error flag

< usart noise error flag

< usart receiver overflow error flag

< usart idle flag

< usart receive data buffer full flag

Definition at line 675 of file at32f413_usart.c.

Referenced by rs485_config().

◆ usart_flag_get()

flag_status usart_flag_get | ( | usart_type * | usart_x,
 |  | uint32_t | flag )

check whether the specified usart flag is set or not.

Parameters
usart_x select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
flag specifies the flag to check. this parameter can be one of the following values:
  • USART_CTSCF_FLAG: cts change flag (not available for UART4, UART5)
  • USART_BFF_FLAG: break frame flag
  • USART_TDBE_FLAG: transmit data buffer empty flag
  • USART_TDC_FLAG: transmit data complete flag
  • USART_RDBF_FLAG: receive data buffer full flag
  • USART_IDLEF_FLAG: idle flag
  • USART_ROERR_FLAG: receiver overflow error flag
  • USART_NERR_FLAG: noise error flag
  • USART_FERR_FLAG: framing error flag
  • USART_PERR_FLAG: parity error flag
Return values
the new state of usart_flag (SET or RESET).

Definition at line 565 of file at32f413_usart.c.

Referenced by back_err(), back_ok(), fputc(), main(), rs485_send_data(), USART2_IRQHandler(), and usart_send_data().

◆ usart_hardware_flow_control_set()

void usart_hardware_flow_control_set | ( | usart_type * | usart_x,
 |  | usart_hardware_flow_control_type | flow_state )

configure the usart's hardware flow control.

Parameters
usart_x select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2 or USART3
flow_state specifies the hardware flow control. this parameter can be one of the following values:
  • USART_HARDWARE_FLOW_NONE
  • USART_HARDWARE_FLOW_RTS,
  • USART_HARDWARE_FLOW_CTS,
  • USART_HARDWARE_FLOW_RTS_CTS
Return values
none

Definition at line 522 of file at32f413_usart.c.

Referenced by usart1_config(), and usart_configuration().

◆ usart_init()

void usart_init | ( | usart_type * | usart_x,
 |  | uint32_t | baud_rate,
 |  | usart_data_bit_num_type | data_bit,
 |  | usart_stop_bit_num_type | stop_bit )

initialize the usart peripheral according to the specified parameters.

Parameters
usart_x | select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
baud_rate | configure the usart communication baud rate.
data_bit data bits transmitted or received in a frame this parameter can be one of the following values:
  • USART_DATA_8BITS
  • USART_DATA_9BITS. note:
  • when parity check is disabled, the data bit width is the actual data bit number.
  • when parity check is enabled, the data bit width is the actual data bit number minus 1, and the MSB bit is replaced with the parity bit.
stop_bit stop bits transmitted this parameter can be one of the following values:
  • USART_STOP_1_BIT
  • USART_STOP_0_5_BIT.
  • USART_STOP_2_BIT
  • USART_STOP_1_5_BIT.
Return values
none

Definition at line 105 of file at32f413_usart.c.

Referenced by rs485_config(), uart_init(), uart_print_init(), usart1_config(), usart_configuration(), usart_spi_configuration(), and usb_usart_config().

◆ usart_interrupt_enable()

void usart_interrupt_enable | ( | usart_type * | usart_x,
 |  | uint32_t | usart_int,
 |  | confirm_state | new_state )

enable or disable the specified usart interrupts.

Parameters
usart_x | select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
usart_int specifies the USART interrupt sources to be enabled or disabled. this parameter can be one of the following values:
  • USART_IDLE_INT: idle interrupt
  • USART_RDBF_INT: rdbf interrupt
  • USART_TDC_INT: tdc interrupt
  • USART_TDBE_INT: tdbe interrupt
  • USART_PERR_INT: perr interrupt
  • USART_BF_INT: break frame interrupt
  • USART_ERR_INT: err interrupt
  • USART_CTSCF_INT: ctscf interrupt
new_state | new state of the specified usart interrupts. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 263 of file at32f413_usart.c.

Referenced by data_take(), main(), rs485_config(), uart_init(), usart1_config(), USART2_IRQHandler(), USART3_IRQHandler(), usart_configuration(), and usb_usart_config().

◆ usart_interrupt_flag_get()

flag_status usart_interrupt_flag_get | ( | usart_type * | usart_x,
 |  | uint32_t | flag )

check whether the specified usart interrupt flag is set or not.

Parameters
usart_x select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4, UART5.
flag specifies the flag to check. this parameter can be one of the following values:
  • USART_CTSCF_FLAG: cts change flag (not available for UART4, UART5)
  • USART_BFF_FLAG: break frame flag
  • USART_TDBE_FLAG: transmit data buffer empty flag
  • USART_TDC_FLAG: transmit data complete flag
  • USART_RDBF_FLAG: receive data buffer full flag
  • USART_IDLEF_FLAG: idle flag
  • USART_ROERR_FLAG: receiver overflow error flag
  • USART_NERR_FLAG: noise error flag
  • USART_FERR_FLAG: framing error flag
  • USART_PERR_FLAG: parity error flag
Return values
the new state of usart_flag (SET or RESET).

< usart cts change flag

< usart break frame flag

< usart transmit data buffer empty flag

< usart transmit data complete flag

< usart receive data buffer full flag

< usart receiver overflow error flag

< usart idle flag

< usart noise error flag

< usart framing error flag

< usart parity error flag

Definition at line 596 of file at32f413_usart.c.

Referenced by USART1_IRQHandler(), USART2_IRQHandler(), and USART3_IRQHandler().

◆ usart_irda_low_power_enable()

void usart_irda_low_power_enable | ( | usart_type * | usart_x,
 |  | confirm_state | new_state )

configure the usart's irda low power.

Parameters
usart_x | select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
new_state | new state of the irda mode. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 504 of file at32f413_usart.c.

◆ usart_irda_mode_enable()

void usart_irda_mode_enable | ( | usart_type * | usart_x,
 |  | confirm_state | new_state )

enable or disable the usart's irda interface.

Parameters
usart_x | select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
new_state | new state of the irda mode. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 490 of file at32f413_usart.c.

Referenced by usart_configuration().

◆ usart_irda_smartcard_division_set()

void usart_irda_smartcard_division_set | ( | usart_type * | usart_x,
 |  | uint8_t | div_val )

config the irda/smartcard division.

Note
the division are not available for UART4 and UART5.
Parameters
usart_x | select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2 or USART3.
div_val | specifies the division.
Return values
none

Definition at line 432 of file at32f413_usart.c.

Referenced by usart_configuration().

◆ usart_lin_mode_enable()

void usart_lin_mode_enable | ( | usart_type * | usart_x,
 |  | confirm_state | new_state )

enable or disable the usart lin mode.

Parameters
usart_x | select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
new_state | new state of the usart lin mode. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 367 of file at32f413_usart.c.

◆ usart_parity_selection_config()

void usart_parity_selection_config | ( | usart_type * | usart_x,
 |  | usart_parity_selection_type | parity )

usart parity selection config.

Parameters
usart_x select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
parity select the none, odd or even parity. this parameter can be one of the following values:
  • USART_PARITY_NONE
  • USART_PARITY_EVEN.
  • USART_PARITY_ODD
Return values
none

Definition at line 144 of file at32f413_usart.c.

Referenced by usart1_config(), usart_configuration(), and usb_usart_config().

◆ usart_receiver_enable()

void usart_receiver_enable | ( | usart_type * | usart_x,
 |  | confirm_state | new_state )

usart receiver enable.

Parameters
usart_x | select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
new_state | TRUE or FALSE.
Return values
none

Definition at line 198 of file at32f413_usart.c.

Referenced by rs485_config(), uart_init(), usart1_config(), usart_configuration(), usart_spi_configuration(), and usb_usart_config().

◆ usart_receiver_mute_enable()

void usart_receiver_mute_enable | ( | usart_type * | usart_x,
 |  | confirm_state | new_state )

config the usart in mute mode in multi-processor communication.

Parameters
usart_x | select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
new_state | new state of the usart mute mode. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 337 of file at32f413_usart.c.

Referenced by usart_configuration().

◆ usart_reset()

void usart_reset ( usart_type * usart_x )

deinitialize the usart peripheral registers to their default reset values.

Parameters
usart_x select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
Return values
none

Definition at line 51 of file at32f413_usart.c.

◆ usart_single_line_halfduplex_select()

void usart_single_line_halfduplex_select | ( | usart_type * | usart_x,
 |  | confirm_state | new_state )

enable or disable the usart single line bidirectional half-duplex communication.

Parameters
usart_x | select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
new_state | new state of the single line half-duplex select. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 476 of file at32f413_usart.c.

Referenced by usart_configuration().

◆ usart_smartcard_guard_time_set()

void usart_smartcard_guard_time_set | ( | usart_type * | usart_x,
 |  | uint8_t | guard_time_val )

config the specified usart smartcard guard time.

Note
The guard time bits are not available for UART4 and UART5.
Parameters
usart_x | select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2 or USART3.
guard_time_val | specifies the guard time (0x00~0xFF).
Return values
none

Definition at line 418 of file at32f413_usart.c.

Referenced by usart_configuration().

◆ usart_smartcard_mode_enable()

void usart_smartcard_mode_enable | ( | usart_type * | usart_x,
 |  | confirm_state | new_state )

enable or disable the usart smart card mode.

Note
the smart card mode are not available for UART4 and UART5.
Parameters
usart_x | select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2 or USART3.
new_state | new state of the smart card mode. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 447 of file at32f413_usart.c.

Referenced by usart_configuration().

◆ usart_smartcard_nack_set()

void usart_smartcard_nack_set | ( | usart_type * | usart_x,
 |  | confirm_state | new_state )

enable or disable nack transmission in smartcard mode.

Note
the smart card nack are not available for UART4 and UART5.
Parameters
usart_x | select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2 or USART3.
new_state | new state of the nack transmission. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 462 of file at32f413_usart.c.

Referenced by usart_configuration().

◆ usart_transmitter_enable()

void usart_transmitter_enable | ( | usart_type * | usart_x,
 |  | confirm_state | new_state )

usart transmitter enable.

Parameters
usart_x | select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
new_state | TRUE or FALSE.
Return values
none

Definition at line 185 of file at32f413_usart.c.

Referenced by rs485_config(), uart_init(), uart_print_init(), usart1_config(), usart_configuration(), usart_spi_configuration(), and usb_usart_config().

◆ usart_wakeup_id_set()

void usart_wakeup_id_set | ( | usart_type * | usart_x,
 |  | uint8_t | usart_id )

set the wakeup id of the usart.

Parameters
usart_x | select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
usart_id | the matching id(0x0~0xF).
Return values
none

Definition at line 307 of file at32f413_usart.c.

Referenced by usart_configuration().

◆ usart_wakeup_mode_set()

void usart_wakeup_mode_set | ( | usart_type * | usart_x,
 |  | usart_wakeup_mode_type | wakeup_mode )

select the usart wakeup method in multi-processor communication.

Parameters
usart_x select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
wakeup_mode determines the way to wake up usart method. this parameter can be one of the following values:
  • USART_WAKEUP_BY_IDLE_FRAME
  • USART_WAKEUP_BY_MATCHING_ID
Return values
none

Definition at line 323 of file at32f413_usart.c.

Referenced by usart_configuration().


AT32F413 Firmwary Library: USART_private_functions

Functions
USART_private_functions
AT32F413_periph_driver » USART

Functions

void | usart_reset (usart_type *usart_x)
deinitialize the usart peripheral registers to their default reset values.
void | usart_init (usart_type *usart_x, uint32_t baud_rate, usart_data_bit_num_type data_bit, usart_stop_bit_num_type stop_bit)
initialize the usart peripheral according to the specified parameters.
void | usart_parity_selection_config (usart_type *usart_x, usart_parity_selection_type parity)
usart parity selection config.
void | usart_enable (usart_type *usart_x, confirm_state new_state)
enable or disable the specified usart peripheral.
void | usart_transmitter_enable (usart_type *usart_x, confirm_state new_state)
usart transmitter enable.
void | usart_receiver_enable (usart_type *usart_x, confirm_state new_state)
usart receiver enable.
void | usart_clock_config (usart_type *usart_x, usart_clock_polarity_type clk_pol, usart_clock_phase_type clk_pha, usart_lbcp_type clk_lb)
usart clock config.
void | usart_clock_enable (usart_type *usart_x, confirm_state new_state)
usart enable the ck pin.
void | usart_interrupt_enable (usart_type *usart_x, uint32_t usart_int, confirm_state new_state)
enable or disable the specified usart interrupts.
void | usart_dma_transmitter_enable (usart_type *usart_x, confirm_state new_state)
enable or disable the usart's dma transmitter interface.
void | usart_dma_receiver_enable (usart_type *usart_x, confirm_state new_state)
enable or disable the usart's dma receiver interface.
void | usart_wakeup_id_set (usart_type *usart_x, uint8_t usart_id)
set the wakeup id of the usart.
void | usart_wakeup_mode_set (usart_type *usart_x, usart_wakeup_mode_type wakeup_mode)
select the usart wakeup method in multi-processor communication.
void | usart_receiver_mute_enable (usart_type *usart_x, confirm_state new_state)
config the usart in mute mode in multi-processor communication.
void | usart_break_bit_num_set (usart_type *usart_x, usart_break_bit_num_type break_bit)
set the usart break frame bit num.
void | usart_lin_mode_enable (usart_type *usart_x, confirm_state new_state)
enable or disable the usart lin mode.
void | usart_data_transmit (usart_type *usart_x, uint16_t data)
transmit single data through the usart peripheral.
uint16_t | usart_data_receive (usart_type *usart_x)
return the most recent received data by the usart peripheral.
void | usart_break_send (usart_type *usart_x)
transmit break characters.
void | usart_smartcard_guard_time_set (usart_type *usart_x, uint8_t guard_time_val)
config the specified usart smartcard guard time.
void | usart_irda_smartcard_division_set (usart_type *usart_x, uint8_t div_val)
config the irda/smartcard division.
void | usart_smartcard_mode_enable (usart_type *usart_x, confirm_state new_state)
enable or disable the usart smart card mode.
void | usart_smartcard_nack_set (usart_type *usart_x, confirm_state new_state)
enable or disable nack transmission in smartcard mode.
void | usart_single_line_halfduplex_select (usart_type *usart_x, confirm_state new_state)
enable or disable the usart single line bidirectional half-duplex communication.
void | usart_irda_mode_enable (usart_type *usart_x, confirm_state new_state)
enable or disable the usart's irda interface.
void | usart_irda_low_power_enable (usart_type *usart_x, confirm_state new_state)
configure the usart's irda low power.
void | usart_hardware_flow_control_set (usart_type *usart_x, usart_hardware_flow_control_type flow_state)
configure the usart's hardware flow control.
flag_status | usart_flag_get (usart_type *usart_x, uint32_t flag)
check whether the specified usart flag is set or not.
flag_status | usart_interrupt_flag_get (usart_type *usart_x, uint32_t flag)
check whether the specified usart interrupt flag is set or not.
void | usart_flag_clear (usart_type *usart_x, uint32_t flag)
clear the usart's pending flags.

Detailed Description

Function Documentation

◆ usart_break_bit_num_set()

void usart_break_bit_num_set | ( | usart_type * | usart_x,
 |  | usart_break_bit_num_type | break_bit )

set the usart break frame bit num.

Parameters
usart_x select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
break_bit specifies the break bit num. this parameter can be one of the following values:
  • USART_BREAK_10BITS
  • USART_BREAK_11BITS
Return values
none

Definition at line 353 of file at32f413_usart.c.

◆ usart_break_send()

void usart_break_send ( usart_type * usart_x )

transmit break characters.

Parameters
usart_x select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
Return values
none

Definition at line 404 of file at32f413_usart.c.

◆ usart_clock_config()

void usart_clock_config | ( | usart_type * | usart_x,
 |  | usart_clock_polarity_type | clk_pol,
 |  | usart_clock_phase_type | clk_pha,
 |  | usart_lbcp_type | clk_lb )

usart clock config.

Note
clock config are not available for UART4 and UART5.
Parameters
usart_x select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2 or USART3.
clk_pol polarity of the clock output on the ck pin. this parameter can be one of the following values:
  • USART_CLOCK_POLARITY_LOW
  • USART_CLOCK_POLARITY_HIGH
clk_pha phase of the clock output on the ck pin. this parameter can be one of the following values:
  • USART_CLOCK_PHASE_1EDGE
  • USART_CLOCK_PHASE_2EDGE
clk_lb whether the clock pulse of the last data bit transmitted (MSB) is outputted on the ck pin. this parameter can be one of the following values:
  • USART_CLOCK_LAST_BIT_NONE
  • USART_CLOCK_LAST_BIT_OUTPUT
Return values
none

Definition at line 223 of file at32f413_usart.c.

Referenced by usart_spi_configuration().

◆ usart_clock_enable()

void usart_clock_enable | ( | usart_type * | usart_x,
 |  | confirm_state | new_state )

usart enable the ck pin.

Note
clock enable are not available for UART4 and UART5.
Parameters
usart_x | select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2 or USART3.
new_state | TRUE or FALSE
Return values
none

Definition at line 239 of file at32f413_usart.c.

Referenced by usart_configuration(), and usart_spi_configuration().

◆ usart_data_receive()

uint16_t usart_data_receive ( usart_type * usart_x )

return the most recent received data by the usart peripheral.

Parameters
usart_x select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
Return values
the received data.

Definition at line 392 of file at32f413_usart.c.

Referenced by main(), USART1_IRQHandler(), USART2_IRQHandler(), and USART3_IRQHandler().

◆ usart_data_transmit()

void usart_data_transmit | ( | usart_type * | usart_x,
 |  | uint16_t | data )

transmit single data through the usart peripheral.

Parameters
usart_x | select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
data | the data to transmit.
Return values
none

Definition at line 380 of file at32f413_usart.c.

Referenced by back_err(), back_ok(), fputc(), main(), rs485_send_data(), USART2_IRQHandler(), USART3_IRQHandler(), and usart_send_data().

◆ usart_dma_receiver_enable()

void usart_dma_receiver_enable | ( | usart_type * | usart_x,
 |  | confirm_state | new_state )

enable or disable the usart's dma receiver interface.

Parameters
usart_x | select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
new_state | new state of the dma request sources. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 294 of file at32f413_usart.c.

Referenced by usart_configuration().

◆ usart_dma_transmitter_enable()

void usart_dma_transmitter_enable | ( | usart_type * | usart_x,
 |  | confirm_state | new_state )

enable or disable the usart's dma transmitter interface.

Parameters
usart_x | select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
new_state | new state of the dma request sources. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 280 of file at32f413_usart.c.

Referenced by usart_configuration().

◆ usart_enable()

void usart_enable | ( | usart_type * | usart_x,
 |  | confirm_state | new_state )

enable or disable the specified usart peripheral.

Parameters
usart_x | select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
new_state | new state of the usart peripheral. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 172 of file at32f413_usart.c.

Referenced by rs485_config(), uart_init(), uart_print_init(), usart1_config(), usart_configuration(), usart_spi_configuration(), and usb_usart_config().

◆ usart_flag_clear()

void usart_flag_clear | ( | usart_type * | usart_x,
 |  | uint32_t | flag )

clear the usart's pending flags.

Parameters
usart_x select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
flag specifies the flag to clear. this parameter can be any combination of the following values:
  • USART_CTSCF_FLAG: (not available for UART4 and UART5).
  • USART_BFF_FLAG:
  • USART_TDC_FLAG:
  • USART_RDBF_FLAG:
  • USART_PERR_FLAG:
  • USART_FERR_FLAG:
  • USART_NERR_FLAG:
  • USART_ROERR_FLAG:
  • USART_IDLEF_FLAG:
Note
  • USART_PERR_FLAG, USART_FERR_FLAG, USART_NERR_FLAG, USART_ROERR_FLAG and USART_IDLEF_FLAG are cleared by software sequence: a read operation to usart sts register (usart_flag_get()) followed by a read operation to usart dt register (usart_data_receive()).
  • USART_TDC_FLAG can be also cleared by software sequence: a read operation to usart sts register (usart_flag_get()) followed by a write operation to usart dt register (usart_data_transmit()).
  • USART_TDBE_FLAG is cleared only by a write to the usart dt register(usart_data_transmit()).
Return values
none

< usart parity error flag

< usart framing error flag

< usart noise error flag

< usart receiver overflow error flag

< usart idle flag

< usart receive data buffer full flag

Definition at line 675 of file at32f413_usart.c.

Referenced by rs485_config().

◆ usart_flag_get()

flag_status usart_flag_get | ( | usart_type * | usart_x,
 |  | uint32_t | flag )

check whether the specified usart flag is set or not.

Parameters
usart_x select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
flag specifies the flag to check. this parameter can be one of the following values:
  • USART_CTSCF_FLAG: cts change flag (not available for UART4, UART5)
  • USART_BFF_FLAG: break frame flag
  • USART_TDBE_FLAG: transmit data buffer empty flag
  • USART_TDC_FLAG: transmit data complete flag
  • USART_RDBF_FLAG: receive data buffer full flag
  • USART_IDLEF_FLAG: idle flag
  • USART_ROERR_FLAG: receiver overflow error flag
  • USART_NERR_FLAG: noise error flag
  • USART_FERR_FLAG: framing error flag
  • USART_PERR_FLAG: parity error flag
Return values
the new state of usart_flag (SET or RESET).

Definition at line 565 of file at32f413_usart.c.

Referenced by back_err(), back_ok(), fputc(), main(), rs485_send_data(), USART2_IRQHandler(), and usart_send_data().

◆ usart_hardware_flow_control_set()

void usart_hardware_flow_control_set | ( | usart_type * | usart_x,
 |  | usart_hardware_flow_control_type | flow_state )

configure the usart's hardware flow control.

Parameters
usart_x select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2 or USART3
flow_state specifies the hardware flow control. this parameter can be one of the following values:
  • USART_HARDWARE_FLOW_NONE
  • USART_HARDWARE_FLOW_RTS,
  • USART_HARDWARE_FLOW_CTS,
  • USART_HARDWARE_FLOW_RTS_CTS
Return values
none

Definition at line 522 of file at32f413_usart.c.

Referenced by usart1_config(), and usart_configuration().

◆ usart_init()

void usart_init | ( | usart_type * | usart_x,
 |  | uint32_t | baud_rate,
 |  | usart_data_bit_num_type | data_bit,
 |  | usart_stop_bit_num_type | stop_bit )

initialize the usart peripheral according to the specified parameters.

Parameters
usart_x | select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
baud_rate | configure the usart communication baud rate.
data_bit data bits transmitted or received in a frame this parameter can be one of the following values:
  • USART_DATA_8BITS
  • USART_DATA_9BITS. note:
  • when parity check is disabled, the data bit width is the actual data bit number.
  • when parity check is enabled, the data bit width is the actual data bit number minus 1, and the MSB bit is replaced with the parity bit.
stop_bit stop bits transmitted this parameter can be one of the following values:
  • USART_STOP_1_BIT
  • USART_STOP_0_5_BIT.
  • USART_STOP_2_BIT
  • USART_STOP_1_5_BIT.
Return values
none

Definition at line 105 of file at32f413_usart.c.

Referenced by rs485_config(), uart_init(), uart_print_init(), usart1_config(), usart_configuration(), usart_spi_configuration(), and usb_usart_config().

◆ usart_interrupt_enable()

void usart_interrupt_enable | ( | usart_type * | usart_x,
 |  | uint32_t | usart_int,
 |  | confirm_state | new_state )

enable or disable the specified usart interrupts.

Parameters
usart_x | select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
usart_int specifies the USART interrupt sources to be enabled or disabled. this parameter can be one of the following values:
  • USART_IDLE_INT: idle interrupt
  • USART_RDBF_INT: rdbf interrupt
  • USART_TDC_INT: tdc interrupt
  • USART_TDBE_INT: tdbe interrupt
  • USART_PERR_INT: perr interrupt
  • USART_BF_INT: break frame interrupt
  • USART_ERR_INT: err interrupt
  • USART_CTSCF_INT: ctscf interrupt
new_state | new state of the specified usart interrupts. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 263 of file at32f413_usart.c.

Referenced by data_take(), main(), rs485_config(), uart_init(), usart1_config(), USART2_IRQHandler(), USART3_IRQHandler(), usart_configuration(), and usb_usart_config().

◆ usart_interrupt_flag_get()

flag_status usart_interrupt_flag_get | ( | usart_type * | usart_x,
 |  | uint32_t | flag )

check whether the specified usart interrupt flag is set or not.

Parameters
usart_x select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4, UART5.
flag specifies the flag to check. this parameter can be one of the following values:
  • USART_CTSCF_FLAG: cts change flag (not available for UART4, UART5)
  • USART_BFF_FLAG: break frame flag
  • USART_TDBE_FLAG: transmit data buffer empty flag
  • USART_TDC_FLAG: transmit data complete flag
  • USART_RDBF_FLAG: receive data buffer full flag
  • USART_IDLEF_FLAG: idle flag
  • USART_ROERR_FLAG: receiver overflow error flag
  • USART_NERR_FLAG: noise error flag
  • USART_FERR_FLAG: framing error flag
  • USART_PERR_FLAG: parity error flag
Return values
the new state of usart_flag (SET or RESET).

< usart cts change flag

< usart break frame flag

< usart transmit data buffer empty flag

< usart transmit data complete flag

< usart receive data buffer full flag

< usart receiver overflow error flag

< usart idle flag

< usart noise error flag

< usart framing error flag

< usart parity error flag

Definition at line 596 of file at32f413_usart.c.

Referenced by USART1_IRQHandler(), USART2_IRQHandler(), and USART3_IRQHandler().

◆ usart_irda_low_power_enable()

void usart_irda_low_power_enable | ( | usart_type * | usart_x,
 |  | confirm_state | new_state )

configure the usart's irda low power.

Parameters
usart_x | select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
new_state | new state of the irda mode. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 504 of file at32f413_usart.c.

◆ usart_irda_mode_enable()

void usart_irda_mode_enable | ( | usart_type * | usart_x,
 |  | confirm_state | new_state )

enable or disable the usart's irda interface.

Parameters
usart_x | select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
new_state | new state of the irda mode. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 490 of file at32f413_usart.c.

Referenced by usart_configuration().

◆ usart_irda_smartcard_division_set()

void usart_irda_smartcard_division_set | ( | usart_type * | usart_x,
 |  | uint8_t | div_val )

config the irda/smartcard division.

Note
the division are not available for UART4 and UART5.
Parameters
usart_x | select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2 or USART3.
div_val | specifies the division.
Return values
none

Definition at line 432 of file at32f413_usart.c.

Referenced by usart_configuration().

◆ usart_lin_mode_enable()

void usart_lin_mode_enable | ( | usart_type * | usart_x,
 |  | confirm_state | new_state )

enable or disable the usart lin mode.

Parameters
usart_x | select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
new_state | new state of the usart lin mode. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 367 of file at32f413_usart.c.

◆ usart_parity_selection_config()

void usart_parity_selection_config | ( | usart_type * | usart_x,
 |  | usart_parity_selection_type | parity )

usart parity selection config.

Parameters
usart_x select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
parity select the none, odd or even parity. this parameter can be one of the following values:
  • USART_PARITY_NONE
  • USART_PARITY_EVEN.
  • USART_PARITY_ODD
Return values
none

Definition at line 144 of file at32f413_usart.c.

Referenced by usart1_config(), usart_configuration(), and usb_usart_config().

◆ usart_receiver_enable()

void usart_receiver_enable | ( | usart_type * | usart_x,
 |  | confirm_state | new_state )

usart receiver enable.

Parameters
usart_x | select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
new_state | TRUE or FALSE.
Return values
none

Definition at line 198 of file at32f413_usart.c.

Referenced by rs485_config(), uart_init(), usart1_config(), usart_configuration(), usart_spi_configuration(), and usb_usart_config().

◆ usart_receiver_mute_enable()

void usart_receiver_mute_enable | ( | usart_type * | usart_x,
 |  | confirm_state | new_state )

config the usart in mute mode in multi-processor communication.

Parameters
usart_x | select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
new_state | new state of the usart mute mode. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 337 of file at32f413_usart.c.

Referenced by usart_configuration().

◆ usart_reset()

void usart_reset ( usart_type * usart_x )

deinitialize the usart peripheral registers to their default reset values.

Parameters
usart_x select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
Return values
none

Definition at line 51 of file at32f413_usart.c.

◆ usart_single_line_halfduplex_select()

void usart_single_line_halfduplex_select | ( | usart_type * | usart_x,
 |  | confirm_state | new_state )

enable or disable the usart single line bidirectional half-duplex communication.

Parameters
usart_x | select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
new_state | new state of the single line half-duplex select. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 476 of file at32f413_usart.c.

Referenced by usart_configuration().

◆ usart_smartcard_guard_time_set()

void usart_smartcard_guard_time_set | ( | usart_type * | usart_x,
 |  | uint8_t | guard_time_val )

config the specified usart smartcard guard time.

Note
The guard time bits are not available for UART4 and UART5.
Parameters
usart_x | select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2 or USART3.
guard_time_val | specifies the guard time (0x00~0xFF).
Return values
none

Definition at line 418 of file at32f413_usart.c.

Referenced by usart_configuration().

◆ usart_smartcard_mode_enable()

void usart_smartcard_mode_enable | ( | usart_type * | usart_x,
 |  | confirm_state | new_state )

enable or disable the usart smart card mode.

Note
the smart card mode are not available for UART4 and UART5.
Parameters
usart_x | select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2 or USART3.
new_state | new state of the smart card mode. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 447 of file at32f413_usart.c.

Referenced by usart_configuration().

◆ usart_smartcard_nack_set()

void usart_smartcard_nack_set | ( | usart_type * | usart_x,
 |  | confirm_state | new_state )

enable or disable nack transmission in smartcard mode.

Note
the smart card nack are not available for UART4 and UART5.
Parameters
usart_x | select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2 or USART3.
new_state | new state of the nack transmission. this parameter can be: TRUE or FALSE.
Return values
none

Definition at line 462 of file at32f413_usart.c.

Referenced by usart_configuration().

◆ usart_transmitter_enable()

void usart_transmitter_enable | ( | usart_type * | usart_x,
 |  | confirm_state | new_state )

usart transmitter enable.

Parameters
usart_x | select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
new_state | TRUE or FALSE.
Return values
none

Definition at line 185 of file at32f413_usart.c.

Referenced by rs485_config(), uart_init(), uart_print_init(), usart1_config(), usart_configuration(), usart_spi_configuration(), and usb_usart_config().

◆ usart_wakeup_id_set()

void usart_wakeup_id_set | ( | usart_type * | usart_x,
 |  | uint8_t | usart_id )

set the wakeup id of the usart.

Parameters
usart_x | select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
usart_id | the matching id(0x0~0xF).
Return values
none

Definition at line 307 of file at32f413_usart.c.

Referenced by usart_configuration().

◆ usart_wakeup_mode_set()

void usart_wakeup_mode_set | ( | usart_type * | usart_x,
 |  | usart_wakeup_mode_type | wakeup_mode )

select the usart wakeup method in multi-processor communication.

Parameters
usart_x select the usart or the uart peripheral. this parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
wakeup_mode determines the way to wake up usart method. this parameter can be one of the following values:
  • USART_WAKEUP_BY_IDLE_FRAME
  • USART_WAKEUP_BY_MATCHING_ID
Return values
none

Definition at line 323 of file at32f413_usart.c.

Referenced by usart_configuration().


AT32F413 Firmwary Library: USB

Topics | Macros | Typedefs | Variables
USB
AT32F413_periph_driver

USB driver modules. More...

Topics

USB_interrupts_definition
usb interrupt mask
USB_interrupt_flags_definition
usb interrupt flag
USB_endpoint_register_bit_definition
usb endpoint register bit define
USB_endpoint_tx_and_rx_status_definition
usb endpoint tx and rx status
USB_device_endpoint_register_type_definition
usb device endpoint register type define
USB_buffer_table_default_offset_address_definition
usb buffer table default offset address
USB_packet_buffer_start_address_definition
usb packet buffer start address
USB_exported_enum_types
USB_macro_definition
USB_exported_types
USB_exported_functions
USB_private_functions

Macros

#define USB ((usbd_type *) USBFS_BASE)

Typedefs

typedef usbd_type usb_reg_type

Variables

uint32_t g_usb_packet_address

Detailed Description

USB driver modules.

Macro Definition Documentation

◆ USB

#define USB ((usbd_type *) USBFS_BASE)

Definition at line 665 of file at32f413_usb.h.

Referenced by main(), and usbd_clear_stall().

Typedef Documentation

◆ usb_reg_type

typedef usbd_type usb_reg_type

Definition at line 667 of file at32f413_usb.h.

Variable Documentation

◆ g_usb_packet_address

uint32_t g_usb_packet_address
extern

usb buffer address

Definition at line 48 of file at32f413_usb.c.

Referenced by usb_read_packet(), usb_usbbufs_enable(), and usb_write_packet().


AT32F413 Firmwary Library: USB_interrupts_definition

Macros
USB_interrupts_definition
AT32F413_periph_driver » USB

usb interrupt mask More...

Macros

#define | USB_LSOF_INT ((uint32_t)0x00000100)
#define | USB_SOF_INT ((uint32_t)0x00000200)
#define | USB_RST_INT ((uint32_t)0x00000400)
#define | USB_SP_INT ((uint32_t)0x00000800)
#define | USB_WK_INT ((uint32_t)0x00001000)
#define | USB_BE_INT ((uint32_t)0x00002000)
#define | USB_UCFOR_INT ((uint32_t)0x00004000)
#define | USB_TC_INT ((uint32_t)0x00008000)

Detailed Description

usb interrupt mask

Macro Definition Documentation

◆ USB_BE_INT

#define USB_BE_INT ((uint32_t)0x00002000)

usb bus error interrupt

Definition at line 58 of file at32f413_usb.h.

◆ USB_LSOF_INT

#define USB_LSOF_INT ((uint32_t)0x00000100)

usb lost sof interrupt

Definition at line 53 of file at32f413_usb.h.

Referenced by usbd_irq_handler().

◆ USB_RST_INT

#define USB_RST_INT ((uint32_t)0x00000400)

usb reset interrupt

Definition at line 55 of file at32f413_usb.h.

Referenced by usb_dev_init().

◆ USB_SOF_INT

#define USB_SOF_INT ((uint32_t)0x00000200)

usb sof interrupt

Definition at line 54 of file at32f413_usb.h.

Referenced by usb_dev_init(), and usbd_irq_handler().

◆ USB_SP_INT

#define USB_SP_INT ((uint32_t)0x00000800)

usb suspend interrupt

Definition at line 56 of file at32f413_usb.h.

Referenced by usb_dev_init(), and usbd_irq_handler().

◆ USB_TC_INT

#define USB_TC_INT ((uint32_t)0x00008000)

usb transmission completed interrupt

Definition at line 60 of file at32f413_usb.h.

Referenced by usb_dev_init().

◆ USB_UCFOR_INT

#define USB_UCFOR_INT ((uint32_t)0x00004000)

usb core fifo overrun interrupt

Definition at line 59 of file at32f413_usb.h.

◆ USB_WK_INT

#define USB_WK_INT ((uint32_t)0x00001000)

usb wakeup interrupt

Definition at line 57 of file at32f413_usb.h.

Referenced by usb_dev_init(), and usbd_irq_handler().


AT32F413 Firmwary Library: USB_interrupt_flags_definition

Macros
USB_interrupt_flags_definition
AT32F413_periph_driver » USB

usb interrupt flag More...

Macros

#define | USB_EPT_NUM_FLAG ((uint32_t)0x0000000F)
#define | USB_INOUT_FLAG ((uint32_t)0x00000010)
#define | USB_LSOF_FLAG ((uint32_t)0x00000100)
#define | USB_SOF_FLAG ((uint32_t)0x00000200)
#define | USB_RST_FLAG ((uint32_t)0x00000400)
#define | USB_SP_FLAG ((uint32_t)0x00000800)
#define | USB_WK_FLAG ((uint32_t)0x00001000)
#define | USB_BE_FLAG ((uint32_t)0x00002000)
#define | USB_UCFOR_FLAG ((uint32_t)0x00004000)
#define | USB_TC_FLAG ((uint32_t)0x00008000)

Detailed Description

usb interrupt flag

Macro Definition Documentation

◆ USB_BE_FLAG

#define USB_BE_FLAG ((uint32_t)0x00002000)

usb bus error flag

Definition at line 78 of file at32f413_usb.h.

◆ USB_EPT_NUM_FLAG

#define USB_EPT_NUM_FLAG ((uint32_t)0x0000000F)

usb endpoint number

Definition at line 71 of file at32f413_usb.h.

Referenced by usbd_ept_loop_handler().

◆ USB_INOUT_FLAG

#define USB_INOUT_FLAG ((uint32_t)0x00000010)

usb in/out transcation flag

Definition at line 72 of file at32f413_usb.h.

◆ USB_LSOF_FLAG

#define USB_LSOF_FLAG ((uint32_t)0x00000100)

usb lost sof flag

Definition at line 73 of file at32f413_usb.h.

Referenced by usbd_irq_handler().

◆ USB_RST_FLAG

#define USB_RST_FLAG ((uint32_t)0x00000400)

usb reset flag

Definition at line 75 of file at32f413_usb.h.

Referenced by usbd_irq_handler().

◆ USB_SOF_FLAG

#define USB_SOF_FLAG ((uint32_t)0x00000200)

usb sof flag

Definition at line 74 of file at32f413_usb.h.

Referenced by usbd_irq_handler().

◆ USB_SP_FLAG

#define USB_SP_FLAG ((uint32_t)0x00000800)

usb suspend flag

Definition at line 76 of file at32f413_usb.h.

Referenced by usbd_irq_handler().

◆ USB_TC_FLAG

#define USB_TC_FLAG ((uint32_t)0x00008000)

usb transmission completed flag

Definition at line 80 of file at32f413_usb.h.

Referenced by usb_interrupt_flag_get(), usbd_ept_loop_handler(), and usbd_irq_handler().

◆ USB_UCFOR_FLAG

#define USB_UCFOR_FLAG ((uint32_t)0x00004000)

usb core fifo overrun flag

Definition at line 79 of file at32f413_usb.h.

◆ USB_WK_FLAG

#define USB_WK_FLAG ((uint32_t)0x00001000)

usb wakeup flag

Definition at line 77 of file at32f413_usb.h.

Referenced by usbd_irq_handler().


AT32F413 Firmwary Library: USB_endpoint_register_bit_definition

Macros
USB_endpoint_register_bit_definition
AT32F413_periph_driver » USB

usb endpoint register bit define More...

Macros

#define | USB_EPTADDR ((uint32_t)0x0000000F)
#define | USB_TXSTS ((uint32_t)0x00000030)
#define | USB_TXDTS ((uint32_t)0x00000040)
#define | USB_TXTC ((uint32_t)0x00000080)
#define | USB_EXF ((uint32_t)0x00000100)
#define | USB_TRANS_TYPE ((uint32_t)0x00000600)
#define | USB_SETUPTC ((uint32_t)0x00000800)
#define | USB_RXSTS ((uint32_t)0x00003000)
#define | USB_RXDTS ((uint32_t)0x00004000)
#define | USB_RXTC ((uint32_t)0x00008000)
#define | USB_EPT_BIT_MASK (uint32_t)(USB_TXTC | USB_SETUPTC | USB_EPTADDR | USB_EXF | USB_RXTC | USB_TRANS_TYPE)
#define | USB_TX_MASK (USB_TXSTS | USB_EPT_BIT_MASK)
#define | USB_RX_MASK (USB_RXSTS | USB_EPT_BIT_MASK)

Detailed Description

usb endpoint register bit define

Macro Definition Documentation

◆ USB_EPT_BIT_MASK

#define USB_EPT_BIT_MASK (uint32_t)(USB_TXTC | USB_SETUPTC | USB_EPTADDR | USB_EXF | USB_RXTC | USB_TRANS_TYPE)

usb bit mask

Definition at line 102 of file at32f413_usb.h.

◆ USB_EPTADDR

#define USB_EPTADDR ((uint32_t)0x0000000F)

usb endpoint address

Definition at line 91 of file at32f413_usb.h.

◆ USB_EXF

#define USB_EXF ((uint32_t)0x00000100)

usb endpoint extend funtion

Definition at line 95 of file at32f413_usb.h.

◆ USB_RX_MASK

#define USB_RX_MASK (USB_RXSTS | USB_EPT_BIT_MASK)

usb rx mask

Definition at line 104 of file at32f413_usb.h.

◆ USB_RXDTS

#define USB_RXDTS ((uint32_t)0x00004000)

usb rx data toggle synchronization

Definition at line 99 of file at32f413_usb.h.

Referenced by usbd_eptn_handler().

◆ USB_RXSTS

#define USB_RXSTS ((uint32_t)0x00003000)

usb rx status

Definition at line 98 of file at32f413_usb.h.

◆ USB_RXTC

#define USB_RXTC ((uint32_t)0x00008000)

usb rx transcation completed

Definition at line 100 of file at32f413_usb.h.

Referenced by usbd_eptn_handler().

◆ USB_SETUPTC

#define USB_SETUPTC ((uint32_t)0x00000800)

usb setup transcation completed

Definition at line 97 of file at32f413_usb.h.

Referenced by usbd_eptn_handler().

◆ USB_TRANS_TYPE

#define USB_TRANS_TYPE ((uint32_t)0x00000600)

usb transfer type

Definition at line 96 of file at32f413_usb.h.

◆ USB_TX_MASK

#define USB_TX_MASK (USB_TXSTS | USB_EPT_BIT_MASK)

usb tx mask

Definition at line 103 of file at32f413_usb.h.

◆ USB_TXDTS

#define USB_TXDTS ((uint32_t)0x00000040)

usb tx data toggle synchronization

Definition at line 93 of file at32f413_usb.h.

◆ USB_TXSTS

#define USB_TXSTS ((uint32_t)0x00000030)

usb tx status

Definition at line 92 of file at32f413_usb.h.

◆ USB_TXTC

#define USB_TXTC ((uint32_t)0x00000080)

usb tx transcation completed

Definition at line 94 of file at32f413_usb.h.

Referenced by usbd_eptn_handler().


AT32F413 Firmwary Library: USB_endpoint_tx_and_rx_status_definition

Macros
USB_endpoint_tx_and_rx_status_definition
AT32F413_periph_driver » USB

usb endpoint tx and rx status More...

Macros

#define | USB_TX_DISABLE ((uint32_t)0x00000000)
#define | USB_TX_STALL ((uint32_t)0x00000010)
#define | USB_TX_NAK ((uint32_t)0x00000020)
#define | USB_TX_VALID ((uint32_t)0x00000030)
#define | USB_TXDTS0 ((uint32_t)0x00000010)
#define | USB_TXDTS1 ((uint32_t)0x00000020)
#define | USB_RX_DISABLE ((uint32_t)0x00000000)
#define | USB_RX_STALL ((uint32_t)0x00001000)
#define | USB_RX_NAK ((uint32_t)0x00002000)
#define | USB_RX_VALID ((uint32_t)0x00003000)
#define | USB_RXDTS0 ((uint32_t)0x00001000)
#define | USB_RXDTS1 ((uint32_t)0x00002000)

Detailed Description

usb endpoint tx and rx status

Macro Definition Documentation

◆ USB_RX_DISABLE

#define USB_RX_DISABLE ((uint32_t)0x00000000)

usb rx status disable

Definition at line 123 of file at32f413_usb.h.

Referenced by usb_ept_close(), and usb_ept_open().

◆ USB_RX_NAK

#define USB_RX_NAK ((uint32_t)0x00002000)

usb rx status nak

Definition at line 125 of file at32f413_usb.h.

◆ USB_RX_STALL

#define USB_RX_STALL ((uint32_t)0x00001000)

usb rx status stall

Definition at line 124 of file at32f413_usb.h.

Referenced by usb_ept_stall(), usbd_clear_stall(), and usbd_set_stall().

◆ USB_RX_VALID

#define USB_RX_VALID ((uint32_t)0x00003000)

usb rx status valid

Definition at line 126 of file at32f413_usb.h.

Referenced by usb_ept_open(), usbd_clear_stall(), and usbd_ept_recv().

◆ USB_RXDTS0

#define USB_RXDTS0 ((uint32_t)0x00001000)

usb rx data toggle bit 0

Definition at line 128 of file at32f413_usb.h.

◆ USB_RXDTS1

#define USB_RXDTS1 ((uint32_t)0x00002000)

usb rx data toggle bit 1

Definition at line 129 of file at32f413_usb.h.

◆ USB_TX_DISABLE

#define USB_TX_DISABLE ((uint32_t)0x00000000)

usb tx status disable

Definition at line 115 of file at32f413_usb.h.

Referenced by usb_ept_close(), and usb_ept_open().

◆ USB_TX_NAK

#define USB_TX_NAK ((uint32_t)0x00000020)

usb tx status nak

Definition at line 117 of file at32f413_usb.h.

Referenced by usb_ept_open(), and usbd_clear_stall().

◆ USB_TX_STALL

#define USB_TX_STALL ((uint32_t)0x00000010)

usb tx status stall

Definition at line 116 of file at32f413_usb.h.

Referenced by usb_ept_stall(), usbd_clear_stall(), and usbd_set_stall().

◆ USB_TX_VALID

#define USB_TX_VALID ((uint32_t)0x00000030)

usb tx status valid

Definition at line 118 of file at32f413_usb.h.

Referenced by usbd_ept_send().

◆ USB_TXDTS0

#define USB_TXDTS0 ((uint32_t)0x00000010)

usb tx data toggle bit 0

Definition at line 120 of file at32f413_usb.h.

◆ USB_TXDTS1

#define USB_TXDTS1 ((uint32_t)0x00000020)

usb tx data toggle bit 1

Definition at line 121 of file at32f413_usb.h.


AT32F413 Firmwary Library: USB_device_endpoint_register_type_definition

Macros
USB_device_endpoint_register_type_definition
AT32F413_periph_driver » USB

usb device endpoint register type define More...

Macros

#define | USB_EPT_CONTROL ((uint32_t)0x00000200)
#define | USB_EPT_BULK ((uint32_t)0x00000000)
#define | USB_EPT_INT ((uint32_t)0x00000600)
#define | USB_EPT_ISO ((uint32_t)0x00000400)

Detailed Description

usb device endpoint register type define

Macro Definition Documentation

◆ USB_EPT_BULK

#define USB_EPT_BULK ((uint32_t)0x00000000)

usb endpoint transfer type bulk

Definition at line 141 of file at32f413_usb.h.

Referenced by usb_ept_open().

◆ USB_EPT_CONTROL

#define USB_EPT_CONTROL ((uint32_t)0x00000200)

usb endpoint transfer type control

Definition at line 140 of file at32f413_usb.h.

Referenced by usb_ept_open().

◆ USB_EPT_INT

#define USB_EPT_INT ((uint32_t)0x00000600)

usb endpoint transfer type interrupt

Definition at line 142 of file at32f413_usb.h.

Referenced by usb_ept_open().

◆ USB_EPT_ISO

#define USB_EPT_ISO ((uint32_t)0x00000400)

usb endpoint transfer type iso

Definition at line 143 of file at32f413_usb.h.

Referenced by usb_ept_open().


AT32F413 Firmwary Library: USB_buffer_table_default_offset_address_definition

Macros
USB_buffer_table_default_offset_address_definition
AT32F413_periph_driver » USB

usb buffer table default offset address More...

Macros

#define USB_BUFFER_TABLE_ADDRESS 0x0000

Detailed Description

usb buffer table default offset address

Macro Definition Documentation

◆ USB_BUFFER_TABLE_ADDRESS

#define USB_BUFFER_TABLE_ADDRESS 0x0000

usb buffer table address

Definition at line 154 of file at32f413_usb.h.

Referenced by usb_dev_init().


AT32F413 Firmwary Library: USB_packet_buffer_start_address_definition

Macros
USB_packet_buffer_start_address_definition
AT32F413_periph_driver » USB

usb packet buffer start address More...

Macros

#define | USB_PACKET_BUFFER_ADDRESS 0x40006000
#define | USB_PACKET_BUFFER_ADDRESS_EX 0x40007800

Detailed Description

usb packet buffer start address

Macro Definition Documentation

◆ USB_PACKET_BUFFER_ADDRESS

#define USB_PACKET_BUFFER_ADDRESS 0x40006000

usb buffer address

Definition at line 165 of file at32f413_usb.h.

Referenced by usb_usbbufs_enable().

◆ USB_PACKET_BUFFER_ADDRESS_EX

#define USB_PACKET_BUFFER_ADDRESS_EX 0x40007800

usb buffer extend address

Definition at line 166 of file at32f413_usb.h.

Referenced by usb_usbbufs_enable().


AT32F413 Firmwary Library: USB_exported_enum_types

Enumerations
USB_exported_enum_types
AT32F413_periph_driver » USB

Enumerations

enum usb_ept_number_type {
USB_EPT0 = 0x00 , USB_EPT1 = 0x01 , USB_EPT2 = 0x02 , USB_EPT3 = 0x03 ,
USB_EPT4 = 0x04 , USB_EPT5 = 0x05 , USB_EPT6 = 0x06 , USB_EPT7 = 0x07
}
usb endpoint number define More...
enum | ept_trans_type { EPT_CONTROL_TYPE = 0x00 , EPT_ISO_TYPE = 0x01 , EPT_BULK_TYPE = 0x02 , EPT_INT_TYPE = 0x03 }
usb endpoint max num define More...
enum | ept_inout_type { EPT_IN = 0x00 , EPT_OUT = 0x01 }
endpoint endpoint direction define More...
enum | data_trans_dir { DATA_TRANS_OUT = 0x00 , DATA_TRANS_IN = 0x01 }
data transfer direction More...
enum | usb_clk48_s { USB_CLK_HICK , USB_CLK_HEXT }
usb clock select More...

Detailed Description

Enumeration Type Documentation

◆ data_trans_dir

enum data_trans_dir

data transfer direction

Enumerator
DATA_TRANS_OUT | usb data transfer direction out
DATA_TRANS_IN | usb data transfer direction in

Definition at line 220 of file at32f413_usb.h.

◆ ept_inout_type

enum ept_inout_type

endpoint endpoint direction define

Enumerator
EPT_IN | usb endpoint direction in
EPT_OUT | usb endpoint direction out

Definition at line 211 of file at32f413_usb.h.

◆ ept_trans_type

enum ept_trans_type

usb endpoint max num define

endpoint transfer type define

Enumerator
EPT_CONTROL_TYPE | usb transfer type control
EPT_ISO_TYPE | usb transfer type iso
EPT_BULK_TYPE | usb transfer type bulk
EPT_INT_TYPE | usb transfer type interrupt

Definition at line 200 of file at32f413_usb.h.

◆ usb_clk48_s

enum usb_clk48_s

usb clock select

Enumerator
USB_CLK_HICK
USB_CLK_HEXT

Definition at line 229 of file at32f413_usb.h.

◆ usb_ept_number_type

enum usb_ept_number_type

usb endpoint number define

Enumerator
USB_EPT0 | usb endpoint 0
USB_EPT1 | usb endpoint 1
USB_EPT2 | usb endpoint 2
USB_EPT3 | usb endpoint 3
USB_EPT4 | usb endpoint 4
USB_EPT5 | usb endpoint 5
USB_EPT6 | usb endpoint 6
USB_EPT7 | usb endpoint 7

Definition at line 179 of file at32f413_usb.h.


AT32F413 Firmwary Library: USB_macro_definition

Macros
USB_macro_definition
AT32F413_periph_driver » USB

Macros

#define | USB_SET_TXSTS(ept_num, new_sts)
set usb endpoint tx status
#define | USB_SET_RXSTS(ept_num, new_sts)
set usb endpoint rx status
#define | GET_TX_LEN_ADDR(eptn)
get usb endpoint tx/rx length address
#define | GET_RX_LEN_ADDR(eptn)
#define | USB_GET_TX_LEN(eptn)
get usb endpoint tx/rx data length
#define | USB_GET_RX_LEN(eptn)
#define | USB_DBUF0_GET_LEN(eptn)
double buffer mode get endpoint buf0/buf1 data length
#define | USB_DBUF1_GET_LEN(eptn)
#define | BLK32(reg, len, blks)
set usb length of rx buffer
#define | BLK2(reg, len, blks)
#define | USB_SET_RXLEN_REG(reg, len)
#define | USB_SET_TXLEN(eptn, len)
set endpoint tx/rx transfer length
#define | USB_SET_RXLEN(eptn, len)
#define | USB_OUT_EPT_DOUBLE_BUF0(eptn, len)
double buffer mode set endpoint rx buf0 length
#define | USB_SET_EPT_DOUBLE_BUF0_LEN(eptn, len, dir)
double buffer mode set endpoint buf0 length
#define | USB_SET_EPT_DOUBLE_BUF1_LEN(eptn, len, dir)
double buffer mode set endpoint buf1 length
#define | USB_SET_TX_ADDRESS(eptn, address)
set usb endpoint tx/rx fifo address
#define | USB_SET_RX_ADDRESS(eptn, address)
#define | USB_SET_DOUBLE_BUFF0_ADDRESS(eptn, address)
set double buffer mode usb endpoint buf0/buf1 fifo address
#define | USB_SET_DOUBLE_BUFF1_ADDRESS(eptn, address)
#define | USB_TOGGLE_TXDTS(eptn)
set usb tx/rx toggle
#define | USB_TOGGLE_RXDTS(eptn)
#define | USB_CLEAR_TXDTS(eptn)
clear usb tx/rx toggle
#define | USB_CLEAR_RXDTS(eptn)
#define | USB_SET_TRANS_TYPE(eptn, type)
set usb endpoint type
#define | USB_SET_EXF(eptn)
set/clear usb extend function
#define | USB_CLEAR_EXF(eptn)
#define | USB_SET_EPT_ADDRESS(eptn, address)
set usb device address
#define | USB_FREE_DB_USER_BUFFER(eptn, inout)
free buffer used by application
#define | USB_CLEAR_TXTC(eptn)
clear tx/rx transfer completed flag
#define | USB_CLEAR_RXTC(eptn)
#define | USB_SET_EPT_DOUBLE_BUFFER(eptn)
set/clear endpoint double buffer mode
#define | USB_CLEAR_EPT_DOUBLE_BUFFER(eptn)

Detailed Description

Macro Definition Documentation

◆ BLK2

#define BLK2 | ( | reg,
 |  | len,
 |  | blks )
Value:
{ \
blks = (len) >> 1; \
if(((len) & 0x1) == 0) \
blks ++; \
*reg = (uint16_t)((blks) << 10); \
}

Definition at line 309 of file at32f413_usb.h.

◆ BLK32

#define BLK32 | ( | reg,
 |  | len,
 |  | blks )
Value:
{ \
blks = (len) >> 5; \
if(((len) & 0x1F) == 0) \
blks --; \
*reg = ((uint16_t)((blks) << 10) | 0x8000); \
}

set usb length of rx buffer

Parameters
reg | usb rx length register
len | rx max length
blks | number of blocks

Definition at line 302 of file at32f413_usb.h.

◆ GET_RX_LEN_ADDR

#define GET_RX_LEN_ADDR ( eptn )
Value:
(uint32_t *)((USB->buftbl + eptn * 8 + 6) * 2 + g_usb_packet_address)
g_usb_packet_address
uint32_t g_usb_packet_address
Definition at32f413_usb.c:48
USB
#define USB
Definition at32f413_usb.h:665

Definition at line 278 of file at32f413_usb.h.

◆ GET_TX_LEN_ADDR

#define GET_TX_LEN_ADDR ( eptn )
Value:
(uint32_t *)((USB->buftbl + eptn * 8 + 2) * 2 + g_usb_packet_address)

get usb endpoint tx/rx length address

Parameters
eptn endpoint number
Return values
the length address of tx/rx

Definition at line 277 of file at32f413_usb.h.

◆ USB_CLEAR_EPT_DOUBLE_BUFFER

#define USB_CLEAR_EPT_DOUBLE_BUFFER ( eptn )
Value:
USB_CLEAR_EXF(eptn)
USB_CLEAR_EXF
#define USB_CLEAR_EXF(eptn)
Definition at32f413_usb.h:445

Definition at line 486 of file at32f413_usb.h.

◆ USB_CLEAR_EXF

#define USB_CLEAR_EXF ( eptn )
Value:
(USB->ept[eptn] = USB_TXTC | USB_RXTC | (USB->ept[eptn] & ((~USB_EXF) & USB_EPT_BIT_MASK)))
USB_RXTC
#define USB_RXTC
Definition at32f413_usb.h:100
USB_EPT_BIT_MASK
#define USB_EPT_BIT_MASK
Definition at32f413_usb.h:102
USB_TXTC
#define USB_TXTC
Definition at32f413_usb.h:94

Definition at line 445 of file at32f413_usb.h.

◆ USB_CLEAR_RXDTS

#define USB_CLEAR_RXDTS ( eptn )
Value:
{ \
if(USB->ept_bit[eptn].rxdts != 0) \
USB_TOGGLE_RXDTS(eptn); \
}

Definition at line 422 of file at32f413_usb.h.

Referenced by usb_ept_close(), usb_ept_open(), and usbd_clear_stall().

◆ USB_CLEAR_RXTC

#define USB_CLEAR_RXTC ( eptn )
Value:
(USB->ept[eptn] &= 0x7FFF & USB_EPT_BIT_MASK)

Definition at line 478 of file at32f413_usb.h.

Referenced by usbd_eptn_handler().

◆ USB_CLEAR_TXDTS

#define USB_CLEAR_TXDTS ( eptn )
Value:
{ \
if(USB->ept_bit[eptn].txdts != 0) \
USB_TOGGLE_TXDTS(eptn); \
}

clear usb tx/rx toggle

Parameters
eptn endpoint number
Return values
none

Definition at line 418 of file at32f413_usb.h.

Referenced by usb_ept_close(), usb_ept_open(), and usbd_clear_stall().

◆ USB_CLEAR_TXTC

#define USB_CLEAR_TXTC ( eptn )
Value:
(USB->ept[eptn] &= 0xFF7F & USB_EPT_BIT_MASK)

clear tx/rx transfer completed flag

Parameters
eptn endpoint number
Return values
none

Definition at line 477 of file at32f413_usb.h.

Referenced by usbd_eptn_handler().

◆ USB_DBUF0_GET_LEN

#define USB_DBUF0_GET_LEN ( eptn )
Value:
USB_GET_TX_LEN(eptn)
USB_GET_TX_LEN
#define USB_GET_TX_LEN(eptn)
get usb endpoint tx/rx data length
Definition at32f413_usb.h:285

double buffer mode get endpoint buf0/buf1 data length

Parameters
eptn endpoint number
Return values
the length of buf0/buf1

Definition at line 293 of file at32f413_usb.h.

Referenced by usbd_eptn_handler().

◆ USB_DBUF1_GET_LEN

#define USB_DBUF1_GET_LEN ( eptn )
Value:
USB_GET_RX_LEN(eptn)
USB_GET_RX_LEN
#define USB_GET_RX_LEN(eptn)
Definition at32f413_usb.h:286

Definition at line 294 of file at32f413_usb.h.

Referenced by usbd_eptn_handler().

◆ USB_FREE_DB_USER_BUFFER

#define USB_FREE_DB_USER_BUFFER | ( | eptn,
 |  | inout )
Value:
{ \
if(inout == DATA_TRANS_IN) \
{ \
USB_TOGGLE_RXDTS(eptn); \
} \
else \
{ \
USB_TOGGLE_TXDTS(eptn); \
} \
}
DATA_TRANS_IN
@ DATA_TRANS_IN
Definition at32f413_usb.h:223

free buffer used by application

Parameters
eptn | endpoint number
inout | transfer direction
Return values
none

Definition at line 461 of file at32f413_usb.h.

Referenced by usbd_ept_send(), and usbd_eptn_handler().

◆ USB_GET_RX_LEN

#define USB_GET_RX_LEN ( eptn )
Value:
((uint16_t)(*GET_RX_LEN_ADDR(eptn)) & 0x3ff)
GET_RX_LEN_ADDR
#define GET_RX_LEN_ADDR(eptn)
Definition at32f413_usb.h:278

Definition at line 286 of file at32f413_usb.h.

Referenced by usbd_eptn_handler().

◆ USB_GET_TX_LEN

#define USB_GET_TX_LEN ( eptn )
Value:
((uint16_t)(*GET_TX_LEN_ADDR(eptn)) & 0x3ff)
GET_TX_LEN_ADDR
#define GET_TX_LEN_ADDR(eptn)
get usb endpoint tx/rx length address
Definition at32f413_usb.h:277

get usb endpoint tx/rx data length

Parameters
eptn endpoint number
Return values
the length of tx/rx

Definition at line 285 of file at32f413_usb.h.

Referenced by usbd_eptn_handler().

◆ USB_OUT_EPT_DOUBLE_BUF0

#define USB_OUT_EPT_DOUBLE_BUF0 | ( | eptn,
 |  | len )
Value:
{ \
uint32_t *rx_reg = GET_TX_LEN_ADDR(eptn); \
USB_SET_RXLEN_REG(rx_reg, (len)); \
}

double buffer mode set endpoint rx buf0 length

Parameters
eptn | endpoint number
len | transfer length
Return values
none

Definition at line 346 of file at32f413_usb.h.

◆ USB_SET_DOUBLE_BUFF0_ADDRESS

#define USB_SET_DOUBLE_BUFF0_ADDRESS | ( | eptn,
 |  | address )
Value:
(USB_SET_TX_ADDRESS(eptn, address))
USB_SET_TX_ADDRESS
#define USB_SET_TX_ADDRESS(eptn, address)
set usb endpoint tx/rx fifo address
Definition at32f413_usb.h:393

set double buffer mode usb endpoint buf0/buf1 fifo address

Parameters
eptn | endpoint number
address | offset of the fifo address
Return values
none

Definition at line 402 of file at32f413_usb.h.

Referenced by usb_ept_open().

◆ USB_SET_DOUBLE_BUFF1_ADDRESS

#define USB_SET_DOUBLE_BUFF1_ADDRESS | ( | eptn,
 |  | address )
Value:
(USB_SET_RX_ADDRESS(eptn, address))
USB_SET_RX_ADDRESS
#define USB_SET_RX_ADDRESS(eptn, address)
Definition at32f413_usb.h:394

Definition at line 403 of file at32f413_usb.h.

Referenced by usb_ept_open().

◆ USB_SET_EPT_ADDRESS

#define USB_SET_EPT_ADDRESS | ( | eptn,
 |  | address )
Value:
(USB->ept[eptn] = ((USB->ept[eptn] & USB_EPT_BIT_MASK & (~USB_EPTADDR)) | address))

set usb device address

Parameters
eptn | endpoint number
address | device address
Return values
none

Definition at line 453 of file at32f413_usb.h.

Referenced by usb_ept_open().

◆ USB_SET_EPT_DOUBLE_BUF0_LEN

#define USB_SET_EPT_DOUBLE_BUF0_LEN | ( | eptn,
 |  | len,
 |  | dir )
Value:
{ \
if(dir == DATA_TRANS_OUT) \
{ \
USB_OUT_EPT_DOUBLE_BUF0(eptn, len); \
} \
else \
{ \
*(GET_TX_LEN_ADDR(eptn)) = (len); \
} \
}
DATA_TRANS_OUT
@ DATA_TRANS_OUT
Definition at32f413_usb.h:222

double buffer mode set endpoint buf0 length

Parameters
eptn | endpoint number
len | transfer length
dir | transfer direction(in/out)
Return values
none

Definition at line 358 of file at32f413_usb.h.

Referenced by usb_ept_open(), and usbd_ept_send().

◆ USB_SET_EPT_DOUBLE_BUF1_LEN

#define USB_SET_EPT_DOUBLE_BUF1_LEN | ( | eptn,
 |  | len,
 |  | dir )
Value:
{ \
if(dir == DATA_TRANS_OUT) \
{ \
USB_SET_RXLEN(eptn, len); \
} \
else \
{ \
*(GET_RX_LEN_ADDR(eptn)) = (len); \
} \
}

double buffer mode set endpoint buf1 length

Parameters
eptn | endpoint number
len | transfer length
dir | transfer direction(in/out)
Return values
none

Definition at line 376 of file at32f413_usb.h.

Referenced by usb_ept_open(), and usbd_ept_send().

◆ USB_SET_EPT_DOUBLE_BUFFER

#define USB_SET_EPT_DOUBLE_BUFFER ( eptn )
Value:
USB_SET_EXF(eptn)
USB_SET_EXF
#define USB_SET_EXF(eptn)
set/clear usb extend function
Definition at32f413_usb.h:444

set/clear endpoint double buffer mode

Parameters
eptn endpoint number
Return values
none

Definition at line 485 of file at32f413_usb.h.

Referenced by usb_ept_open().

◆ USB_SET_EXF

#define USB_SET_EXF ( eptn )
Value:
(USB->ept[eptn] = USB_TXTC | USB_RXTC | ((USB->ept[eptn] | USB_EXF) & USB_EPT_BIT_MASK))
USB_EXF
#define USB_EXF
Definition at32f413_usb.h:95

set/clear usb extend function

Parameters
eptn endpoint number
Return values
none

Definition at line 444 of file at32f413_usb.h.

◆ USB_SET_RX_ADDRESS

#define USB_SET_RX_ADDRESS | ( | eptn,
 |  | address )
Value:
(*(uint32_t *)((USB->buftbl + eptn * 8 + 4) * 2 + g_usb_packet_address) = address)

Definition at line 394 of file at32f413_usb.h.

Referenced by usb_ept_open().

◆ USB_SET_RXLEN

#define USB_SET_RXLEN | ( | eptn,
 |  | len )
Value:
{ \
uint32_t *rx_reg = GET_RX_LEN_ADDR(eptn); \
USB_SET_RXLEN_REG(rx_reg, (len)); \
}

Definition at line 335 of file at32f413_usb.h.

Referenced by usb_ept_open().

◆ USB_SET_RXLEN_REG

#define USB_SET_RXLEN_REG | ( | reg,
 |  | len )
Value:
{ \
uint16_t blks; \
if(len > 62) \
{ \
BLK32(reg, len, blks); \
} \
else \
{ \
BLK2(reg, len, blks); \
} \
}

Definition at line 316 of file at32f413_usb.h.

◆ USB_SET_RXSTS

#define USB_SET_RXSTS | ( | ept_num,
 |  | new_sts )
Value:
{ \
register uint16_t epsts = (USB->ept[ept_num]) & USB_RX_MASK; \
if((new_sts & USB_RXDTS0) != 0) \
epsts ^= USB_RXDTS0; \
if((new_sts & USB_RXDTS1) != 0) \
epsts ^= USB_RXDTS1; \
USB->ept[ept_num] = epsts | USB_RXTC | USB_TXTC; \
}
USB_RX_MASK
#define USB_RX_MASK
Definition at32f413_usb.h:104
USB_RXDTS0
#define USB_RXDTS0
Definition at32f413_usb.h:128
USB_RXDTS1
#define USB_RXDTS1
Definition at32f413_usb.h:129

set usb endpoint rx status

Parameters
ept_num | endpoint number
new_sts | the new rx status of this endpoint number
Return values
none

Definition at line 263 of file at32f413_usb.h.

Referenced by usb_ept_close(), usb_ept_open(), usb_ept_stall(), usbd_clear_stall(), usbd_ept_recv(), and usbd_set_stall().

◆ USB_SET_TRANS_TYPE

#define USB_SET_TRANS_TYPE | ( | eptn,
 |  | type )
Value:
(USB->ept[eptn] = (USB->ept[eptn] & USB_EPT_BIT_MASK & (~USB_TRANS_TYPE)) | type)

set usb endpoint type

set usb transfer type

Parameters
eptn | endpoint number
type | transfer type
Return values
none

Definition at line 437 of file at32f413_usb.h.

Referenced by usb_ept_open().

◆ USB_SET_TX_ADDRESS

#define USB_SET_TX_ADDRESS | ( | eptn,
 |  | address )
Value:
(*(uint32_t *)((USB->buftbl + eptn * 8) * 2 + g_usb_packet_address) = address)

set usb endpoint tx/rx fifo address

Parameters
eptn | endpoint number
address | offset of the fifo address
Return values
none

Definition at line 393 of file at32f413_usb.h.

Referenced by usb_ept_open().

◆ USB_SET_TXLEN

#define USB_SET_TXLEN | ( | eptn,
 |  | len )
Value:
(*(GET_TX_LEN_ADDR(eptn)) = (len))

set endpoint tx/rx transfer length

Parameters
eptn | endpoint number
len | transfer length
Return values
none

Definition at line 334 of file at32f413_usb.h.

Referenced by usbd_ept_send().

◆ USB_SET_TXSTS

#define USB_SET_TXSTS | ( | ept_num,
 |  | new_sts )
Value:
{ \
register uint16_t epsts = (USB->ept[ept_num]) & USB_TX_MASK; \
if((new_sts & USB_TXDTS0) != 0) \
epsts ^= USB_TXDTS0; \
if((new_sts & USB_TXDTS1) != 0) \
epsts ^= USB_TXDTS1; \
USB->ept[ept_num] = epsts | USB_RXTC | USB_TXTC; \
}
USB_TX_MASK
#define USB_TX_MASK
Definition at32f413_usb.h:103
USB_TXDTS1
#define USB_TXDTS1
Definition at32f413_usb.h:121
USB_TXDTS0
#define USB_TXDTS0
Definition at32f413_usb.h:120

set usb endpoint tx status

Parameters
ept_num | endpoint number
new_sts | the new tx status of this endpoint number
Return values
none

Definition at line 248 of file at32f413_usb.h.

Referenced by usb_ept_close(), usb_ept_open(), usb_ept_stall(), usbd_clear_stall(), usbd_ept_send(), and usbd_set_stall().

◆ USB_TOGGLE_RXDTS

#define USB_TOGGLE_RXDTS ( eptn )
Value:
(USB->ept[eptn] = ((USB->ept[eptn] & USB_EPT_BIT_MASK) | USB_RXDTS | USB_RXTC | USB_TXTC))
USB_RXDTS
#define USB_RXDTS
Definition at32f413_usb.h:99

Definition at line 411 of file at32f413_usb.h.

Referenced by usb_ept_close(), and usb_ept_open().

◆ USB_TOGGLE_TXDTS

#define USB_TOGGLE_TXDTS ( eptn )
Value:
(USB->ept[eptn] = ((USB->ept[eptn] & USB_EPT_BIT_MASK) | USB_TXDTS | USB_RXTC | USB_TXTC))
USB_TXDTS
#define USB_TXDTS
Definition at32f413_usb.h:93

set usb tx/rx toggle

Parameters
eptn endpoint number
Return values
none

Definition at line 410 of file at32f413_usb.h.

Referenced by usb_ept_close(), and usb_ept_open().


AT32F413 Firmwary Library: USB_exported_types

Data Structures
USB_exported_types
AT32F413_periph_driver » USB

Data Structures

struct | usb_ept_info
usb endpoint infomation structure definition More...
struct | usbd_type
type define usb register all More...

Detailed Description

Generated by doxygen 1.12.0


AT32F413 Firmwary Library: usb_ept_info Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
usb_ept_info Struct Reference
AT32F413_periph_driver » USB » USB_exported_types

usb endpoint infomation structure definition More...

#include <at32f413_usb.h>

Data Fields

uint8_t | eptn
uint8_t | ept_address
uint8_t | inout
uint8_t | trans_type
uint16_t | tx_addr
uint16_t | rx_addr
uint16_t | maxpacket
uint8_t | is_double_buffer
uint8_t | stall
uint16_t | status
uint16_t | total_len
uint16_t | trans_len
uint8_t * | trans_buf
uint16_t | last_len
uint16_t | rem0_len
uint16_t | ept0_slen

Detailed Description

usb endpoint infomation structure definition

Definition at line 499 of file at32f413_usb.h.

Field Documentation

◆ ept0_slen

uint16_t usb_ept_info::ept0_slen

endpoint 0 transfer sum length

Definition at line 520 of file at32f413_usb.h.

Referenced by usbd_core_in_handler(), usbd_ctrl_recv(), and usbd_ctrl_send().

◆ ept_address

uint8_t usb_ept_info::ept_address

endpoint address

Definition at line 502 of file at32f413_usb.h.

Referenced by usb_ept_open(), and usbd_ept_defaut_init().

◆ eptn

uint8_t usb_ept_info::eptn

endpoint register number (0~7)

Definition at line 501 of file at32f413_usb.h.

Referenced by usb_ept_close(), usb_ept_open(), usb_ept_stall(), usbd_clear_stall(), usbd_ept_defaut_init(), and usbd_set_stall().

◆ inout

uint8_t usb_ept_info::inout

endpoint dir DATA_TRANS_IN or DATA_TRANS_OUT

Definition at line 503 of file at32f413_usb.h.

Referenced by usb_ept_close(), usb_ept_open(), usb_ept_stall(), usbd_ept_buf_auto_define(), usbd_ept_buf_custom_define(), usbd_ept_defaut_init(), and usbd_ept_open().

◆ is_double_buffer

uint8_t usb_ept_info::is_double_buffer

endpoint double buffer flag

Definition at line 509 of file at32f413_usb.h.

Referenced by usb_ept_close(), usb_ept_open(), usbd_ept_buf_auto_define(), usbd_ept_buf_custom_define(), usbd_ept_dbuffer_enable(), usbd_ept_send(), and usbd_eptn_handler().

◆ last_len

uint16_t usb_ept_info::last_len

last transfer length

Definition at line 518 of file at32f413_usb.h.

Referenced by usbd_core_in_handler(), and usbd_ept_send().

◆ maxpacket

uint16_t usb_ept_info::maxpacket

endpoint max packet

Definition at line 508 of file at32f413_usb.h.

Referenced by usb_ept_open(), usbd_core_in_handler(), usbd_core_out_handler(), usbd_ept_buf_auto_define(), usbd_ept_defaut_init(), usbd_ept_open(), usbd_ept_recv(), and usbd_ept_send().

◆ rem0_len

uint16_t usb_ept_info::rem0_len

rem transfer length

Definition at line 519 of file at32f413_usb.h.

Referenced by usbd_core_in_handler(), usbd_core_out_handler(), usbd_ctrl_recv(), and usbd_ctrl_send().

◆ rx_addr

uint16_t usb_ept_info::rx_addr

endpoint rx buffer offset address

Definition at line 507 of file at32f413_usb.h.

Referenced by usb_ept_open(), usbd_ept_buf_auto_define(), usbd_ept_buf_custom_define(), usbd_ept_defaut_init(), usbd_ept_send(), and usbd_eptn_handler().

◆ stall

uint8_t usb_ept_info::stall

endpoint is stall state

Definition at line 510 of file at32f413_usb.h.

Referenced by usbd_clear_stall(), usbd_endpoint_request(), and usbd_set_stall().

◆ status

uint16_t usb_ept_info::status

endpoint status

Definition at line 511 of file at32f413_usb.h.

Referenced by usbd_endpoint_request().

◆ total_len

uint16_t usb_ept_info::total_len

endpoint transmission total length

Definition at line 514 of file at32f413_usb.h.

Referenced by usbd_ept_defaut_init(), usbd_ept_recv(), usbd_ept_send(), and usbd_eptn_handler().

◆ trans_buf

uint8_t* usb_ept_info::trans_buf

endpoint transmission buffer

Definition at line 516 of file at32f413_usb.h.

Referenced by usbd_core_in_handler(), usbd_core_out_handler(), usbd_ept_defaut_init(), usbd_ept_recv(), usbd_ept_send(), and usbd_eptn_handler().

◆ trans_len

uint16_t usb_ept_info::trans_len

endpoint transmission length

Definition at line 515 of file at32f413_usb.h.

Referenced by usbd_ept_recv(), usbd_ept_send(), usbd_eptn_handler(), and usbd_get_recv_len().

◆ trans_type

uint8_t usb_ept_info::trans_type

endpoint type: EPT_CONTROL_TYPE, EPT_BULK_TYPE, EPT_INT_TYPE, EPT_ISO_TYPE

Definition at line 504 of file at32f413_usb.h.

Referenced by usb_ept_open(), and usbd_ept_open().

◆ tx_addr

uint16_t usb_ept_info::tx_addr

endpoint tx buffer offset address

Definition at line 506 of file at32f413_usb.h.

Referenced by usb_ept_open(), usbd_ept_buf_auto_define(), usbd_ept_buf_custom_define(), usbd_ept_defaut_init(), usbd_ept_send(), and usbd_eptn_handler().

The documentation for this struct was generated from the following file:
  • at32f413_usb.h


AT32F413 Firmwary Library: usbd_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
usbd_type Struct Reference
AT32F413_periph_driver » USB » USB_exported_types

type define usb register all More...

#include <at32f413_usb.h>

Data Fields

union {
__IO uint32_t ept [8]
struct {
__IO uint32_t eptaddr: 4
__IO uint32_t txsts: 2
__IO uint32_t txdts: 1
__IO uint32_t txtc: 1
__IO uint32_t exf: 1
__IO uint32_t trans_type: 2
__IO uint32_t setuptc: 1
__IO uint32_t rxsts: 2
__IO uint32_t rxdts: 1
__IO uint32_t rxtc: 1
__IO uint32_t reserved1: 16
} ept_bit [8]
};
usb endpoint register, offset:0x00
union {
__IO uint32_t ctrl
struct {
__IO uint32_t csrst: 1
__IO uint32_t disusb: 1
__IO uint32_t lpm: 1
__IO uint32_t ssp: 1
__IO uint32_t gresume: 1
__IO uint32_t reserved1: 3
__IO uint32_t lsofien: 1
__IO uint32_t sofien: 1
__IO uint32_t rstien: 1
__IO uint32_t spien: 1
__IO uint32_t wkien: 1
__IO uint32_t beien: 1
__IO uint32_t ucforien: 1
__IO uint32_t tcien: 1
__IO uint32_t reserved2: 16
} ctrl_bit
};
usb control register, offset:0x40
union {
__IO uint32_t intsts
struct {
__IO uint32_t ept_num: 4
__IO uint32_t inout: 1
__IO uint32_t reserved1: 3
__IO uint32_t lsof: 1
__IO uint32_t sof: 1
__IO uint32_t rst: 1
__IO uint32_t sp: 1
__IO uint32_t wk: 1
__IO uint32_t be: 1
__IO uint32_t ucfor: 1
__IO uint32_t tc: 1
__IO uint32_t reserved2: 16
} intsts_bit
};
usb interrupt status register, offset:0x44
union {
__IO uint32_t sofrnum
struct {
__IO uint32_t sofnum: 11
__IO uint32_t lsofnum: 2
__IO uint32_t clck: 1
__IO uint32_t dmsts: 1
__IO uint32_t dpsts: 1
__IO uint32_t reserved1: 16
} sofrnum_bit
};
usb frame number register, offset:0x48
union {
__IO uint32_t devaddr
struct {
__IO uint32_t addr: 7
__IO uint32_t cen: 1
__IO uint32_t reserved1: 24
} devaddr_bit
};
usb device address register, offset:0x4c
union {
__IO uint32_t buftbl
struct {
__IO uint32_t reserved1: 3
__IO uint32_t btaddr: 13
__IO uint32_t reserved2: 16
} buftbl_bit
};
usb buffer address register, offset:0x50
union {
__IO uint32_t cfg
struct {
__IO uint32_t sofouten: 1
__IO uint32_t reserved1: 31
} cfg_bit
};
usb cfg control register, offset:0x60

Detailed Description

type define usb register all

Definition at line 526 of file at32f413_usb.h.

Field Documentation

◆ [union]

union { ... } usbd_type

usb endpoint register, offset:0x00

◆ [union]

union { ... } usbd_type

usb control register, offset:0x40

◆ [union]

union { ... } usbd_type

usb interrupt status register, offset:0x44

◆ [union]

union { ... } usbd_type

usb frame number register, offset:0x48

◆ [union]

union { ... } usbd_type

usb device address register, offset:0x4c

◆ [union]

union { ... } usbd_type

usb buffer address register, offset:0x50

◆ [union]

union { ... } usbd_type

usb cfg control register, offset:0x60

◆ addr

__IO uint32_t usbd_type::addr

Definition at line 626 of file at32f413_usb.h.

Referenced by usb_set_address().

◆ be

__IO uint32_t usbd_type::be

Definition at line 594 of file at32f413_usb.h.

◆ beien

__IO uint32_t usbd_type::beien

Definition at line 571 of file at32f413_usb.h.

◆ btaddr

__IO uint32_t usbd_type::btaddr

Definition at line 641 of file at32f413_usb.h.

◆ buftbl

__IO uint32_t usbd_type::buftbl

Definition at line 637 of file at32f413_usb.h.

Referenced by usb_dev_init().

◆ [struct]

struct { ... } usbd_type::buftbl_bit

◆ cen

__IO uint32_t usbd_type::cen

Definition at line 627 of file at32f413_usb.h.

Referenced by usb_set_address().

◆ cfg

__IO uint32_t usbd_type::cfg

Definition at line 651 of file at32f413_usb.h.

◆ [struct]

struct { ... } usbd_type::cfg_bit

◆ clck

__IO uint32_t usbd_type::clck

Definition at line 611 of file at32f413_usb.h.

◆ csrst

__IO uint32_t usbd_type::csrst

Definition at line 560 of file at32f413_usb.h.

Referenced by usb_dev_init().

◆ ctrl

__IO uint32_t usbd_type::ctrl

Definition at line 557 of file at32f413_usb.h.

Referenced by usb_interrupt_enable(), usb_interrupt_flag_get(), and usbd_irq_handler().

◆ [struct]

struct { ... } usbd_type::ctrl_bit

Referenced by usb_connect(), usb_dev_init(), usb_disconnect(), usb_enter_suspend(), usb_exit_suspend(), usb_remote_wkup_clear(), and usb_remote_wkup_set().

◆ devaddr

__IO uint32_t usbd_type::devaddr

Definition at line 623 of file at32f413_usb.h.

Referenced by usb_dev_init().

◆ [struct]

struct { ... } usbd_type::devaddr_bit

Referenced by usb_set_address().

◆ disusb

__IO uint32_t usbd_type::disusb

Definition at line 561 of file at32f413_usb.h.

Referenced by usb_connect(), and usb_disconnect().

◆ dmsts

__IO uint32_t usbd_type::dmsts

Definition at line 612 of file at32f413_usb.h.

◆ dpsts

__IO uint32_t usbd_type::dpsts

Definition at line 613 of file at32f413_usb.h.

◆ ept

__IO uint32_t usbd_type::ept[8]

Definition at line 533 of file at32f413_usb.h.

Referenced by usbd_eptn_handler().

◆ [struct]

struct { ... } usbd_type::ept_bit[8]

Referenced by usbd_ept_send().

◆ ept_num

__IO uint32_t usbd_type::ept_num

Definition at line 586 of file at32f413_usb.h.

◆ eptaddr

__IO uint32_t usbd_type::eptaddr

Definition at line 536 of file at32f413_usb.h.

◆ exf

__IO uint32_t usbd_type::exf

Definition at line 540 of file at32f413_usb.h.

◆ gresume

__IO uint32_t usbd_type::gresume

Definition at line 564 of file at32f413_usb.h.

Referenced by usb_remote_wkup_clear(), and usb_remote_wkup_set().

◆ inout

__IO uint32_t usbd_type::inout

Definition at line 587 of file at32f413_usb.h.

◆ intsts

__IO uint32_t usbd_type::intsts

Definition at line 583 of file at32f413_usb.h.

Referenced by usb_dev_init(), usb_flag_clear(), usb_flag_get(), usb_interrupt_flag_get(), usbd_ept_loop_handler(), and usbd_irq_handler().

◆ [struct]

struct { ... } usbd_type::intsts_bit

◆ lpm

__IO uint32_t usbd_type::lpm

Definition at line 562 of file at32f413_usb.h.

Referenced by usb_enter_suspend(), and usb_exit_suspend().

◆ lsof

__IO uint32_t usbd_type::lsof

Definition at line 589 of file at32f413_usb.h.

◆ lsofien

__IO uint32_t usbd_type::lsofien

Definition at line 566 of file at32f413_usb.h.

◆ lsofnum

__IO uint32_t usbd_type::lsofnum

Definition at line 610 of file at32f413_usb.h.

◆ reserved1

__IO uint32_t usbd_type::reserved1

Definition at line 546 of file at32f413_usb.h.

◆ reserved2

__IO uint32_t usbd_type::reserved2

Definition at line 574 of file at32f413_usb.h.

◆ rst

__IO uint32_t usbd_type::rst

Definition at line 591 of file at32f413_usb.h.

◆ rstien

__IO uint32_t usbd_type::rstien

Definition at line 568 of file at32f413_usb.h.

◆ rxdts

__IO uint32_t usbd_type::rxdts

Definition at line 544 of file at32f413_usb.h.

◆ rxsts

__IO uint32_t usbd_type::rxsts

Definition at line 543 of file at32f413_usb.h.

◆ rxtc

__IO uint32_t usbd_type::rxtc

Definition at line 545 of file at32f413_usb.h.

◆ setuptc

__IO uint32_t usbd_type::setuptc

Definition at line 542 of file at32f413_usb.h.

◆ sof

__IO uint32_t usbd_type::sof

Definition at line 590 of file at32f413_usb.h.

◆ sofien

__IO uint32_t usbd_type::sofien

Definition at line 567 of file at32f413_usb.h.

◆ sofnum

__IO uint32_t usbd_type::sofnum

Definition at line 609 of file at32f413_usb.h.

◆ sofouten

__IO uint32_t usbd_type::sofouten

Definition at line 654 of file at32f413_usb.h.

◆ sofrnum

__IO uint32_t usbd_type::sofrnum

Definition at line 606 of file at32f413_usb.h.

◆ [struct]

struct { ... } usbd_type::sofrnum_bit

◆ sp

__IO uint32_t usbd_type::sp

Definition at line 592 of file at32f413_usb.h.

◆ spien

__IO uint32_t usbd_type::spien

Definition at line 569 of file at32f413_usb.h.

◆ ssp

__IO uint32_t usbd_type::ssp

Definition at line 563 of file at32f413_usb.h.

Referenced by usb_enter_suspend(), and usb_exit_suspend().

◆ tc

__IO uint32_t usbd_type::tc

Definition at line 596 of file at32f413_usb.h.

◆ tcien

__IO uint32_t usbd_type::tcien

Definition at line 573 of file at32f413_usb.h.

◆ trans_type

__IO uint32_t usbd_type::trans_type

Definition at line 541 of file at32f413_usb.h.

◆ txdts

__IO uint32_t usbd_type::txdts

Definition at line 538 of file at32f413_usb.h.

Referenced by usbd_ept_send().

◆ txsts

__IO uint32_t usbd_type::txsts

Definition at line 537 of file at32f413_usb.h.

◆ txtc

__IO uint32_t usbd_type::txtc

Definition at line 539 of file at32f413_usb.h.

◆ ucfor

__IO uint32_t usbd_type::ucfor

Definition at line 595 of file at32f413_usb.h.

◆ ucforien

__IO uint32_t usbd_type::ucforien

Definition at line 572 of file at32f413_usb.h.

◆ wk

__IO uint32_t usbd_type::wk

Definition at line 593 of file at32f413_usb.h.

◆ wkien

__IO uint32_t usbd_type::wkien

Definition at line 570 of file at32f413_usb.h.

The documentation for this struct was generated from the following file:
  • at32f413_usb.h


AT32F413 Firmwary Library: USB_exported_functions

Functions
USB_exported_functions
AT32F413_periph_driver » USB

Functions

void | usb_dev_init (usbd_type *usbx)
initialize usb peripheral controller register
void | usb_connect (usbd_type *usbx)
connect usb device
void | usb_disconnect (usbd_type *usbx)
disconnect usb device
void | usb_usbbufs_enable (usbd_type *usbx, confirm_state state)
mapping usb packet buffer area two mapping intervals are available for packet buffer area, and are select by the usbbufs in the crm misc1 register. when usbbufs is 0,sram size is 512 bytes, packet buffer start address is 0x40006000.when usbbufs is 1, sram size is fixed to 768~1280 bytes, and the packet buffer start address is fixed to 0x40007800,packet buffer size decided by whether can1 and can2 are enabled;when both can1 and can2 are disabled, usb packet buffer can be set to the maximum of 1280 bytes; when either can1 or can2 is enabled, usb packet buffer can be set to the maximum of 1024 bytes; when both CAN1 and CAN2 are enabled, usb packet buffer can be set to the maximum of 768 bytes.
void | usb_ept_open (usbd_type *usbx, usb_ept_info *ept_info)
open usb endpoint
void | usb_ept_close (usbd_type *usbx, usb_ept_info *ept_info)
close usb endpoint
void | usb_write_packet (uint8_t *pusr_buf, uint16_t offset_addr, uint16_t nbytes)
write data from user memory to usb buffer
void | usb_read_packet (uint8_t *pusr_buf, uint16_t offset_addr, uint16_t nbytes)
read data from usb buffer to user buffer
void | usb_interrupt_enable (usbd_type *usbx, uint16_t interrupt, confirm_state new_state)
usb interrupt enable
void | usb_set_address (usbd_type *usbx, uint8_t address)
set the host assignment address
void | usb_ept_stall (usbd_type *usbx, usb_ept_info *ept_info)
set endpoint tx or rx status to stall
void | usb_enter_suspend (usbd_type *usbx)
usb device enter suspend mode
void | usb_exit_suspend (usbd_type *usbx)
usb device exit suspend mode
void | usb_remote_wkup_set (usbd_type *usbx)
usb remote wakeup set
void | usb_remote_wkup_clear (usbd_type *usbx)
usb remote wakeup clear
uint16_t | usb_buffer_malloc (uint16_t maxpacket)
usb auto malloc endpoint buffer
void | usb_buffer_free (void)
free usb endpoint buffer
flag_status | usb_flag_get (usbd_type *usbx, uint16_t flag)
get flag of usb.
flag_status | usb_interrupt_flag_get (usbd_type *usbx, uint16_t flag)
get interrupt flag of usb.
void | usb_flag_clear (usbd_type *usbx, uint16_t flag)
clear flag of usb.

Detailed Description

Function Documentation

◆ usb_buffer_free()

void usb_buffer_free ( void )

free usb endpoint buffer

Parameters
none
Return values
none

Definition at line 497 of file at32f413_usb.c.

Referenced by usbd_reset_handler().

◆ usb_buffer_malloc()

uint16_t usb_buffer_malloc ( uint16_t maxpacket )

usb auto malloc endpoint buffer

Parameters
mapacket endpoint support max packet size
Return values
none

Definition at line 485 of file at32f413_usb.c.

Referenced by usbd_ept_buf_auto_define().

◆ usb_connect()

void usb_connect ( usbd_type * usbx )

connect usb device

Parameters
usbx to select the usb peripheral. parameter as following values: USB
Return values
none

Definition at line 80 of file at32f413_usb.c.

Referenced by usbd_connect().

◆ usb_dev_init()

void usb_dev_init ( usbd_type * usbx )

initialize usb peripheral controller register

Parameters
usbx to select the usb peripheral. parameter as following values: USB
Return values
none

< usb buffer table address

< usb sof interrupt

< usb reset interrupt

< usb suspend interrupt

< usb wakeup interrupt

< usb transmission completed interrupt

Definition at line 57 of file at32f413_usb.c.

Referenced by usbd_core_init().

◆ usb_disconnect()

void usb_disconnect ( usbd_type * usbx )

disconnect usb device

Parameters
usbx to select the usb peripheral. parameter as following values: USB
Return values
none

Definition at line 92 of file at32f413_usb.c.

Referenced by usbd_disconnect().

◆ usb_enter_suspend()

void usb_enter_suspend ( usbd_type * usbx )

usb device enter suspend mode

Parameters
usbx to select the usb peripheral. parameter as following values: USB
Return values
none

Definition at line 440 of file at32f413_usb.c.

Referenced by usbd_enter_suspend().

◆ usb_ept_close()

void usb_ept_close | ( | usbd_type * | usbx,
 |  | usb_ept_info * | ept_info )

close usb endpoint

Parameters
usbx | to select the usb peripheral. parameter as following values: USB
ept_info | endpoint information structure
Return values
none

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb tx data toggle synchronization

< usb rx transcation completed

< usb tx transcation completed

< usb tx status

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb tx mask

< usb tx status disable

< usb tx data toggle bit 0

< usb tx data toggle bit 0

< usb tx status disable

< usb tx data toggle bit 1

< usb tx data toggle bit 1

< usb rx transcation completed

< usb tx transcation completed

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb rx data toggle synchronization

< usb rx transcation completed

< usb tx transcation completed

< usb rx status

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb rx mask

< usb rx status disable

< usb rx data toggle bit 0

< usb rx data toggle bit 0

< usb rx status disable

< usb rx data toggle bit 1

< usb rx data toggle bit 1

< usb rx transcation completed

< usb tx transcation completed

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb tx data toggle synchronization

< usb rx transcation completed

< usb tx transcation completed

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb rx data toggle synchronization

< usb rx transcation completed

< usb tx transcation completed

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb tx data toggle synchronization

< usb rx transcation completed

< usb tx transcation completed

< usb tx status

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb tx mask

< usb tx status disable

< usb tx data toggle bit 0

< usb tx data toggle bit 0

< usb tx status disable

< usb tx data toggle bit 1

< usb tx data toggle bit 1

< usb rx transcation completed

< usb tx transcation completed

< usb rx status

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb rx mask

< usb rx status disable

< usb rx data toggle bit 0

< usb rx data toggle bit 0

< usb rx status disable

< usb rx data toggle bit 1

< usb rx data toggle bit 1

< usb rx transcation completed

< usb tx transcation completed

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb rx data toggle synchronization

< usb rx transcation completed

< usb tx transcation completed

< usb tx status

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb tx mask

< usb tx status disable

< usb tx data toggle bit 0

< usb tx data toggle bit 0

< usb tx status disable

< usb tx data toggle bit 1

< usb tx data toggle bit 1

< usb rx transcation completed

< usb tx transcation completed

< usb rx status

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb rx mask

< usb rx status disable

< usb rx data toggle bit 0

< usb rx data toggle bit 0

< usb rx status disable

< usb rx data toggle bit 1

< usb rx data toggle bit 1

< usb rx transcation completed

< usb tx transcation completed

Definition at line 267 of file at32f413_usb.c.

Referenced by usbd_ept_close().

◆ usb_ept_open()

void usb_ept_open | ( | usbd_type * | usbx,
 |  | usb_ept_info * | ept_info )

open usb endpoint

Parameters
usbx | to select the usb peripheral. parameter as following values: USB
ept_info | endpoint information structure
Return values
none

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb endpoint address

< usb endpoint transfer type control

< usb endpoint transfer type bulk

< usb endpoint transfer type interrupt

< usb endpoint transfer type iso

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb transfer type

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb tx data toggle synchronization

< usb rx transcation completed

< usb tx transcation completed

< usb tx status

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb tx mask

< usb tx status nak

< usb tx data toggle bit 0

< usb tx data toggle bit 0

< usb tx status nak

< usb tx data toggle bit 1

< usb tx data toggle bit 1

< usb rx transcation completed

< usb tx transcation completed

< usb tx transcation completed

< usb rx transcation completed

< usb endpoint extend funtion

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb tx data toggle synchronization

< usb rx transcation completed

< usb tx transcation completed

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb rx data toggle synchronization

< usb rx transcation completed

< usb tx transcation completed

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb rx data toggle synchronization

< usb rx transcation completed

< usb tx transcation completed

< usb rx status

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb rx mask

< usb rx status disable

< usb rx data toggle bit 0

< usb rx data toggle bit 0

< usb rx status disable

< usb rx data toggle bit 1

< usb rx data toggle bit 1

< usb rx transcation completed

< usb tx transcation completed

< usb tx status

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb tx mask

< usb tx status disable

< usb tx data toggle bit 0

< usb tx data toggle bit 0

< usb tx status disable

< usb tx data toggle bit 1

< usb tx data toggle bit 1

< usb rx transcation completed

< usb tx transcation completed

< usb tx status

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb tx mask

< usb tx status nak

< usb tx data toggle bit 0

< usb tx data toggle bit 0

< usb tx status nak

< usb tx data toggle bit 1

< usb tx data toggle bit 1

< usb rx transcation completed

< usb tx transcation completed

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb rx data toggle synchronization

< usb rx transcation completed

< usb tx transcation completed

< usb rx status

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb rx mask

< usb rx status valid

< usb rx data toggle bit 0

< usb rx data toggle bit 0

< usb rx status valid

< usb rx data toggle bit 1

< usb rx data toggle bit 1

< usb rx transcation completed

< usb tx transcation completed

< usb tx transcation completed

< usb rx transcation completed

< usb endpoint extend funtion

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb tx data toggle synchronization

< usb rx transcation completed

< usb tx transcation completed

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb rx data toggle synchronization

< usb rx transcation completed

< usb tx transcation completed

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb tx data toggle synchronization

< usb rx transcation completed

< usb tx transcation completed

< usb rx status

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb rx mask

< usb rx status valid

< usb rx data toggle bit 0

< usb rx data toggle bit 0

< usb rx status valid

< usb rx data toggle bit 1

< usb rx data toggle bit 1

< usb rx transcation completed

< usb tx transcation completed

< usb tx status

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb tx mask

< usb tx status disable

< usb tx data toggle bit 0

< usb tx data toggle bit 0

< usb tx status disable

< usb tx data toggle bit 1

< usb tx data toggle bit 1

< usb rx transcation completed

< usb tx transcation completed

Definition at line 139 of file at32f413_usb.c.

Referenced by usbd_ept_open().

◆ usb_ept_stall()

void usb_ept_stall | ( | usbd_type * | usbx,
 |  | usb_ept_info * | ept_info )

set endpoint tx or rx status to stall

Parameters
usbx | to select the usb peripheral. parameter as following values: USB
ept_info | endpoint information structure
Return values
none

< usb tx status

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb tx mask

< usb tx status stall

< usb tx data toggle bit 0

< usb tx data toggle bit 0

< usb tx status stall

< usb tx data toggle bit 1

< usb tx data toggle bit 1

< usb rx transcation completed

< usb tx transcation completed

< usb rx status

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb rx mask

< usb rx status stall

< usb rx data toggle bit 0

< usb rx data toggle bit 0

< usb rx status stall

< usb rx data toggle bit 1

< usb rx data toggle bit 1

< usb rx transcation completed

< usb tx transcation completed

Definition at line 421 of file at32f413_usb.c.

◆ usb_exit_suspend()

void usb_exit_suspend ( usbd_type * usbx )

usb device exit suspend mode

Parameters
usbx to select the usb peripheral. parameter as following values: USB
Return values
none

Definition at line 452 of file at32f413_usb.c.

Referenced by usbd_remote_wakeup(), and usbd_wakeup_handler().

◆ usb_flag_clear()

void usb_flag_clear | ( | usbd_type * | usbx,
 |  | uint16_t | flag )

clear flag of usb.

Parameters
usbx select the usb peripheral
flag select the usb flag this parameter can be one of the following values:
  • USB_INOUT_FLAG
  • USB_LSOF_FLAG
  • USB_SOF_FLAG
  • USB_RST_FLAG
  • USB_SP_FLAG
  • USB_WK_FLAG
  • USB_BE_FLAG
  • USB_UCFOR_FLAG
  • USB_TC_FLAG
Return values
none

Definition at line 583 of file at32f413_usb.c.

Referenced by usbd_irq_handler().

◆ usb_flag_get()

flag_status usb_flag_get | ( | usbd_type * | usbx,
 |  | uint16_t | flag )

get flag of usb.

Parameters
usbx select the usb peripheral
flag select the usb flag this parameter can be one of the following values:
  • USB_INOUT_FLAG
  • USB_LSOF_FLAG
  • USB_SOF_FLAG
  • USB_RST_FLAG
  • USB_SP_FLAG
  • USB_WK_FLAG
  • USB_BE_FLAG
  • USB_UCFOR_FLAG
  • USB_TC_FLAG
Return values
none

Definition at line 518 of file at32f413_usb.c.

◆ usb_interrupt_enable()

void usb_interrupt_enable | ( | usbd_type * | usbx,
 |  | uint16_t | interrupt,
 |  | confirm_state | new_state )

usb interrupt enable

Parameters
usbx | to select the usb peripheral. parameter as following values: USB
interrupt this parameter can be any combination of the following values:
  • USB_LSOF_INT
  • USB_SOF_INT
  • USB_RST_INT
  • USB_SP_INT
  • USB_WK_INT
  • USB_BE_INT
  • USB_UCFOR_INT
  • USB_TC_INT
new_state | (TRUE or FALSE)
Return values
none

Definition at line 389 of file at32f413_usb.c.

Referenced by usb_dev_init().

◆ usb_interrupt_flag_get()

flag_status usb_interrupt_flag_get | ( | usbd_type * | usbx,
 |  | uint16_t | flag )

get interrupt flag of usb.

Parameters
usbx select the usb peripheral
flag select the usb flag this parameter can be one of the following values:
  • USB_LSOF_FLAG
  • USB_SOF_FLAG
  • USB_RST_FLAG
  • USB_SP_FLAG
  • USB_WK_FLAG
  • USB_BE_FLAG
  • USB_UCFOR_FLAG
  • USB_TC_FLAG
Return values
none

< usb transmission completed flag

< usb transmission completed flag

Definition at line 548 of file at32f413_usb.c.

◆ usb_read_packet()

void usb_read_packet | ( | uint8_t * | pusr_buf,
 |  | uint16_t | offset_addr,
 |  | uint16_t | nbytes )

read data from usb buffer to user buffer

Parameters
pusr_buf | point to user buffer
offset_addr | endpoint rx offset address
nbytes | number of bytes data write to usb buffer
Return values
none

Definition at line 353 of file at32f413_usb.c.

Referenced by usbd_eptn_handler().

◆ usb_remote_wkup_clear()

void usb_remote_wkup_clear ( usbd_type * usbx )

usb remote wakeup clear

Parameters
usbx to select the usb peripheral. parameter as following values: USB
Return values
none

Definition at line 475 of file at32f413_usb.c.

Referenced by usbd_remote_wakeup().

◆ usb_remote_wkup_set()

void usb_remote_wkup_set ( usbd_type * usbx )

usb remote wakeup set

Parameters
usbx to select the usb peripheral. parameter as following values: USB
Return values
none

Definition at line 464 of file at32f413_usb.c.

Referenced by usbd_remote_wakeup().

◆ usb_set_address()

void usb_set_address | ( | usbd_type * | usbx,
 |  | uint8_t | address )

set the host assignment address

Parameters
usbx | to select the usb peripheral. parameter as following values: USB
address | host assignment address
Return values
none

Definition at line 408 of file at32f413_usb.c.

Referenced by usbd_eptn_handler(), usbd_reset_handler(), and usbd_set_device_addr().

◆ usb_usbbufs_enable()

void usb_usbbufs_enable | ( | usbd_type * | usbx,
 |  | confirm_state | state )

mapping usb packet buffer area two mapping intervals are available for packet buffer area, and are select by the usbbufs in the crm misc1 register. when usbbufs is 0,sram size is 512 bytes, packet buffer start address is 0x40006000.when usbbufs is 1, sram size is fixed to 768~1280 bytes, and the packet buffer start address is fixed to 0x40007800,packet buffer size decided by whether can1 and can2 are enabled;when both can1 and can2 are disabled, usb packet buffer can be set to the maximum of 1280 bytes; when either can1 or can2 is enabled, usb packet buffer can be set to the maximum of 1024 bytes; when both CAN1 and CAN2 are enabled, usb packet buffer can be set to the maximum of 768 bytes.

Parameters
usbx to select the usb peripheral. parameter as following values: USB
Return values
none

< usb buffer extend address

< usb buffer address

Definition at line 115 of file at32f413_usb.c.

Referenced by usbd_core_init().

◆ usb_write_packet()

void usb_write_packet | ( | uint8_t * | pusr_buf,
 |  | uint16_t | offset_addr,
 |  | uint16_t | nbytes )

write data from user memory to usb buffer

Parameters
pusr_buf | point to user buffer
offset_addr | endpoint tx offset address
nbytes | number of bytes data write to usb buffer
Return values
none

Definition at line 326 of file at32f413_usb.c.

Referenced by usbd_ept_send().


AT32F413 Firmwary Library: USB_private_functions

Macros | Functions | Variables
USB_private_functions
AT32F413_periph_driver » USB

Macros

#define USB_ENDP_DESC_TABLE_OFFSET 0x40
usb packet buffer start address

Functions

void | usb_dev_init (usbd_type *usbx)
initialize usb peripheral controller register
void | usb_connect (usbd_type *usbx)
connect usb device
void | usb_disconnect (usbd_type *usbx)
disconnect usb device
void | usb_usbbufs_enable (usbd_type *usbx, confirm_state state)
mapping usb packet buffer area two mapping intervals are available for packet buffer area, and are select by the usbbufs in the crm misc1 register. when usbbufs is 0,sram size is 512 bytes, packet buffer start address is 0x40006000.when usbbufs is 1, sram size is fixed to 768~1280 bytes, and the packet buffer start address is fixed to 0x40007800,packet buffer size decided by whether can1 and can2 are enabled;when both can1 and can2 are disabled, usb packet buffer can be set to the maximum of 1280 bytes; when either can1 or can2 is enabled, usb packet buffer can be set to the maximum of 1024 bytes; when both CAN1 and CAN2 are enabled, usb packet buffer can be set to the maximum of 768 bytes.
void | usb_ept_open (usbd_type *usbx, usb_ept_info *ept_info)
open usb endpoint
void | usb_ept_close (usbd_type *usbx, usb_ept_info *ept_info)
close usb endpoint
void | usb_write_packet (uint8_t *pusr_buf, uint16_t offset_addr, uint16_t nbytes)
write data from user memory to usb buffer
void | usb_read_packet (uint8_t *pusr_buf, uint16_t offset_addr, uint16_t nbytes)
read data from usb buffer to user buffer
void | usb_interrupt_enable (usbd_type *usbx, uint16_t interrupt, confirm_state new_state)
usb interrupt enable
void | usb_set_address (usbd_type *usbx, uint8_t address)
set the host assignment address
void | usb_ept_stall (usbd_type *usbx, usb_ept_info *ept_info)
set endpoint tx or rx status to stall
void | usb_enter_suspend (usbd_type *usbx)
usb device enter suspend mode
void | usb_exit_suspend (usbd_type *usbx)
usb device exit suspend mode
void | usb_remote_wkup_set (usbd_type *usbx)
usb remote wakeup set
void | usb_remote_wkup_clear (usbd_type *usbx)
usb remote wakeup clear
uint16_t | usb_buffer_malloc (uint16_t maxpacket)
usb auto malloc endpoint buffer
void | usb_buffer_free (void)
free usb endpoint buffer
flag_status | usb_flag_get (usbd_type *usbx, uint16_t flag)
get flag of usb.
flag_status | usb_interrupt_flag_get (usbd_type *usbx, uint16_t flag)
get interrupt flag of usb.
void | usb_flag_clear (usbd_type *usbx, uint16_t flag)
clear flag of usb.

Variables

uint32_t | g_usb_packet_address = 0x40006000
static uint16_t | g_usb_offset_addr = 0x40

Detailed Description

Macro Definition Documentation

◆ USB_ENDP_DESC_TABLE_OFFSET

#define USB_ENDP_DESC_TABLE_OFFSET 0x40

usb packet buffer start address

Definition at line 47 of file at32f413_usb.c.

Referenced by usb_buffer_free().

Function Documentation

◆ usb_buffer_free()

void usb_buffer_free ( void )

free usb endpoint buffer

Parameters
none
Return values
none

Definition at line 497 of file at32f413_usb.c.

Referenced by usbd_reset_handler().

◆ usb_buffer_malloc()

uint16_t usb_buffer_malloc ( uint16_t maxpacket )

usb auto malloc endpoint buffer

Parameters
mapacket endpoint support max packet size
Return values
none

Definition at line 485 of file at32f413_usb.c.

Referenced by usbd_ept_buf_auto_define().

◆ usb_connect()

void usb_connect ( usbd_type * usbx )

connect usb device

Parameters
usbx to select the usb peripheral. parameter as following values: USB
Return values
none

Definition at line 80 of file at32f413_usb.c.

Referenced by usbd_connect().

◆ usb_dev_init()

void usb_dev_init ( usbd_type * usbx )

initialize usb peripheral controller register

Parameters
usbx to select the usb peripheral. parameter as following values: USB
Return values
none

< usb buffer table address

< usb sof interrupt

< usb reset interrupt

< usb suspend interrupt

< usb wakeup interrupt

< usb transmission completed interrupt

Definition at line 57 of file at32f413_usb.c.

Referenced by usbd_core_init().

◆ usb_disconnect()

void usb_disconnect ( usbd_type * usbx )

disconnect usb device

Parameters
usbx to select the usb peripheral. parameter as following values: USB
Return values
none

Definition at line 92 of file at32f413_usb.c.

Referenced by usbd_disconnect().

◆ usb_enter_suspend()

void usb_enter_suspend ( usbd_type * usbx )

usb device enter suspend mode

Parameters
usbx to select the usb peripheral. parameter as following values: USB
Return values
none

Definition at line 440 of file at32f413_usb.c.

Referenced by usbd_enter_suspend().

◆ usb_ept_close()

void usb_ept_close | ( | usbd_type * | usbx,
 |  | usb_ept_info * | ept_info )

close usb endpoint

Parameters
usbx | to select the usb peripheral. parameter as following values: USB
ept_info | endpoint information structure
Return values
none

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb tx data toggle synchronization

< usb rx transcation completed

< usb tx transcation completed

< usb tx status

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb tx mask

< usb tx status disable

< usb tx data toggle bit 0

< usb tx data toggle bit 0

< usb tx status disable

< usb tx data toggle bit 1

< usb tx data toggle bit 1

< usb rx transcation completed

< usb tx transcation completed

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb rx data toggle synchronization

< usb rx transcation completed

< usb tx transcation completed

< usb rx status

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb rx mask

< usb rx status disable

< usb rx data toggle bit 0

< usb rx data toggle bit 0

< usb rx status disable

< usb rx data toggle bit 1

< usb rx data toggle bit 1

< usb rx transcation completed

< usb tx transcation completed

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb tx data toggle synchronization

< usb rx transcation completed

< usb tx transcation completed

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb rx data toggle synchronization

< usb rx transcation completed

< usb tx transcation completed

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb tx data toggle synchronization

< usb rx transcation completed

< usb tx transcation completed

< usb tx status

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb tx mask

< usb tx status disable

< usb tx data toggle bit 0

< usb tx data toggle bit 0

< usb tx status disable

< usb tx data toggle bit 1

< usb tx data toggle bit 1

< usb rx transcation completed

< usb tx transcation completed

< usb rx status

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb rx mask

< usb rx status disable

< usb rx data toggle bit 0

< usb rx data toggle bit 0

< usb rx status disable

< usb rx data toggle bit 1

< usb rx data toggle bit 1

< usb rx transcation completed

< usb tx transcation completed

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb rx data toggle synchronization

< usb rx transcation completed

< usb tx transcation completed

< usb tx status

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb tx mask

< usb tx status disable

< usb tx data toggle bit 0

< usb tx data toggle bit 0

< usb tx status disable

< usb tx data toggle bit 1

< usb tx data toggle bit 1

< usb rx transcation completed

< usb tx transcation completed

< usb rx status

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb rx mask

< usb rx status disable

< usb rx data toggle bit 0

< usb rx data toggle bit 0

< usb rx status disable

< usb rx data toggle bit 1

< usb rx data toggle bit 1

< usb rx transcation completed

< usb tx transcation completed

Definition at line 267 of file at32f413_usb.c.

Referenced by usbd_ept_close().

◆ usb_ept_open()

void usb_ept_open | ( | usbd_type * | usbx,
 |  | usb_ept_info * | ept_info )

open usb endpoint

Parameters
usbx | to select the usb peripheral. parameter as following values: USB
ept_info | endpoint information structure
Return values
none

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb endpoint address

< usb endpoint transfer type control

< usb endpoint transfer type bulk

< usb endpoint transfer type interrupt

< usb endpoint transfer type iso

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb transfer type

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb tx data toggle synchronization

< usb rx transcation completed

< usb tx transcation completed

< usb tx status

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb tx mask

< usb tx status nak

< usb tx data toggle bit 0

< usb tx data toggle bit 0

< usb tx status nak

< usb tx data toggle bit 1

< usb tx data toggle bit 1

< usb rx transcation completed

< usb tx transcation completed

< usb tx transcation completed

< usb rx transcation completed

< usb endpoint extend funtion

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb tx data toggle synchronization

< usb rx transcation completed

< usb tx transcation completed

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb rx data toggle synchronization

< usb rx transcation completed

< usb tx transcation completed

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb rx data toggle synchronization

< usb rx transcation completed

< usb tx transcation completed

< usb rx status

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb rx mask

< usb rx status disable

< usb rx data toggle bit 0

< usb rx data toggle bit 0

< usb rx status disable

< usb rx data toggle bit 1

< usb rx data toggle bit 1

< usb rx transcation completed

< usb tx transcation completed

< usb tx status

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb tx mask

< usb tx status disable

< usb tx data toggle bit 0

< usb tx data toggle bit 0

< usb tx status disable

< usb tx data toggle bit 1

< usb tx data toggle bit 1

< usb rx transcation completed

< usb tx transcation completed

< usb tx status

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb tx mask

< usb tx status nak

< usb tx data toggle bit 0

< usb tx data toggle bit 0

< usb tx status nak

< usb tx data toggle bit 1

< usb tx data toggle bit 1

< usb rx transcation completed

< usb tx transcation completed

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb rx data toggle synchronization

< usb rx transcation completed

< usb tx transcation completed

< usb rx status

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb rx mask

< usb rx status valid

< usb rx data toggle bit 0

< usb rx data toggle bit 0

< usb rx status valid

< usb rx data toggle bit 1

< usb rx data toggle bit 1

< usb rx transcation completed

< usb tx transcation completed

< usb tx transcation completed

< usb rx transcation completed

< usb endpoint extend funtion

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb tx data toggle synchronization

< usb rx transcation completed

< usb tx transcation completed

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb rx data toggle synchronization

< usb rx transcation completed

< usb tx transcation completed

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb tx data toggle synchronization

< usb rx transcation completed

< usb tx transcation completed

< usb rx status

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb rx mask

< usb rx status valid

< usb rx data toggle bit 0

< usb rx data toggle bit 0

< usb rx status valid

< usb rx data toggle bit 1

< usb rx data toggle bit 1

< usb rx transcation completed

< usb tx transcation completed

< usb tx status

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb tx mask

< usb tx status disable

< usb tx data toggle bit 0

< usb tx data toggle bit 0

< usb tx status disable

< usb tx data toggle bit 1

< usb tx data toggle bit 1

< usb rx transcation completed

< usb tx transcation completed

Definition at line 139 of file at32f413_usb.c.

Referenced by usbd_ept_open().

◆ usb_ept_stall()

void usb_ept_stall | ( | usbd_type * | usbx,
 |  | usb_ept_info * | ept_info )

set endpoint tx or rx status to stall

Parameters
usbx | to select the usb peripheral. parameter as following values: USB
ept_info | endpoint information structure
Return values
none

< usb tx status

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb tx mask

< usb tx status stall

< usb tx data toggle bit 0

< usb tx data toggle bit 0

< usb tx status stall

< usb tx data toggle bit 1

< usb tx data toggle bit 1

< usb rx transcation completed

< usb tx transcation completed

< usb rx status

< usb tx transcation completed

< usb setup transcation completed

< usb endpoint address

< usb endpoint extend funtion

< usb rx transcation completed

< usb transfer type

< usb bit mask

< usb rx mask

< usb rx status stall

< usb rx data toggle bit 0

< usb rx data toggle bit 0

< usb rx status stall

< usb rx data toggle bit 1

< usb rx data toggle bit 1

< usb rx transcation completed

< usb tx transcation completed

Definition at line 421 of file at32f413_usb.c.

◆ usb_exit_suspend()

void usb_exit_suspend ( usbd_type * usbx )

usb device exit suspend mode

Parameters
usbx to select the usb peripheral. parameter as following values: USB
Return values
none

Definition at line 452 of file at32f413_usb.c.

Referenced by usbd_remote_wakeup(), and usbd_wakeup_handler().

◆ usb_flag_clear()

void usb_flag_clear | ( | usbd_type * | usbx,
 |  | uint16_t | flag )

clear flag of usb.

Parameters
usbx select the usb peripheral
flag select the usb flag this parameter can be one of the following values:
  • USB_INOUT_FLAG
  • USB_LSOF_FLAG
  • USB_SOF_FLAG
  • USB_RST_FLAG
  • USB_SP_FLAG
  • USB_WK_FLAG
  • USB_BE_FLAG
  • USB_UCFOR_FLAG
  • USB_TC_FLAG
Return values
none

Definition at line 583 of file at32f413_usb.c.

Referenced by usbd_irq_handler().

◆ usb_flag_get()

flag_status usb_flag_get | ( | usbd_type * | usbx,
 |  | uint16_t | flag )

get flag of usb.

Parameters
usbx select the usb peripheral
flag select the usb flag this parameter can be one of the following values:
  • USB_INOUT_FLAG
  • USB_LSOF_FLAG
  • USB_SOF_FLAG
  • USB_RST_FLAG
  • USB_SP_FLAG
  • USB_WK_FLAG
  • USB_BE_FLAG
  • USB_UCFOR_FLAG
  • USB_TC_FLAG
Return values
none

Definition at line 518 of file at32f413_usb.c.

◆ usb_interrupt_enable()

void usb_interrupt_enable | ( | usbd_type * | usbx,
 |  | uint16_t | interrupt,
 |  | confirm_state | new_state )

usb interrupt enable

Parameters
usbx | to select the usb peripheral. parameter as following values: USB
interrupt this parameter can be any combination of the following values:
  • USB_LSOF_INT
  • USB_SOF_INT
  • USB_RST_INT
  • USB_SP_INT
  • USB_WK_INT
  • USB_BE_INT
  • USB_UCFOR_INT
  • USB_TC_INT
new_state | (TRUE or FALSE)
Return values
none

Definition at line 389 of file at32f413_usb.c.

Referenced by usb_dev_init().

◆ usb_interrupt_flag_get()

flag_status usb_interrupt_flag_get | ( | usbd_type * | usbx,
 |  | uint16_t | flag )

get interrupt flag of usb.

Parameters
usbx select the usb peripheral
flag select the usb flag this parameter can be one of the following values:
  • USB_LSOF_FLAG
  • USB_SOF_FLAG
  • USB_RST_FLAG
  • USB_SP_FLAG
  • USB_WK_FLAG
  • USB_BE_FLAG
  • USB_UCFOR_FLAG
  • USB_TC_FLAG
Return values
none

< usb transmission completed flag

< usb transmission completed flag

Definition at line 548 of file at32f413_usb.c.

◆ usb_read_packet()

void usb_read_packet | ( | uint8_t * | pusr_buf,
 |  | uint16_t | offset_addr,
 |  | uint16_t | nbytes )

read data from usb buffer to user buffer

Parameters
pusr_buf | point to user buffer
offset_addr | endpoint rx offset address
nbytes | number of bytes data write to usb buffer
Return values
none

Definition at line 353 of file at32f413_usb.c.

Referenced by usbd_eptn_handler().

◆ usb_remote_wkup_clear()

void usb_remote_wkup_clear ( usbd_type * usbx )

usb remote wakeup clear

Parameters
usbx to select the usb peripheral. parameter as following values: USB
Return values
none

Definition at line 475 of file at32f413_usb.c.

Referenced by usbd_remote_wakeup().

◆ usb_remote_wkup_set()

void usb_remote_wkup_set ( usbd_type * usbx )

usb remote wakeup set

Parameters
usbx to select the usb peripheral. parameter as following values: USB
Return values
none

Definition at line 464 of file at32f413_usb.c.

Referenced by usbd_remote_wakeup().

◆ usb_set_address()

void usb_set_address | ( | usbd_type * | usbx,
 |  | uint8_t | address )

set the host assignment address

Parameters
usbx | to select the usb peripheral. parameter as following values: USB
address | host assignment address
Return values
none

Definition at line 408 of file at32f413_usb.c.

Referenced by usbd_eptn_handler(), usbd_reset_handler(), and usbd_set_device_addr().

◆ usb_usbbufs_enable()

void usb_usbbufs_enable | ( | usbd_type * | usbx,
 |  | confirm_state | state )

mapping usb packet buffer area two mapping intervals are available for packet buffer area, and are select by the usbbufs in the crm misc1 register. when usbbufs is 0,sram size is 512 bytes, packet buffer start address is 0x40006000.when usbbufs is 1, sram size is fixed to 768~1280 bytes, and the packet buffer start address is fixed to 0x40007800,packet buffer size decided by whether can1 and can2 are enabled;when both can1 and can2 are disabled, usb packet buffer can be set to the maximum of 1280 bytes; when either can1 or can2 is enabled, usb packet buffer can be set to the maximum of 1024 bytes; when both CAN1 and CAN2 are enabled, usb packet buffer can be set to the maximum of 768 bytes.

Parameters
usbx to select the usb peripheral. parameter as following values: USB
Return values
none

< usb buffer extend address

< usb buffer address

Definition at line 115 of file at32f413_usb.c.

Referenced by usbd_core_init().

◆ usb_write_packet()

void usb_write_packet | ( | uint8_t * | pusr_buf,
 |  | uint16_t | offset_addr,
 |  | uint16_t | nbytes )

write data from user memory to usb buffer

Parameters
pusr_buf | point to user buffer
offset_addr | endpoint tx offset address
nbytes | number of bytes data write to usb buffer
Return values
none

Definition at line 326 of file at32f413_usb.c.

Referenced by usbd_ept_send().

Variable Documentation

◆ g_usb_offset_addr

uint16_t g_usb_offset_addr = 0x40
static

Definition at line 49 of file at32f413_usb.c.

Referenced by usb_buffer_free(), and usb_buffer_malloc().

◆ g_usb_packet_address

uint32_t g_usb_packet_address = 0x40006000

usb buffer address

Definition at line 48 of file at32f413_usb.c.

Referenced by usb_read_packet(), usb_usbbufs_enable(), and usb_write_packet().


AT32F413 Firmwary Library: WDT

Topics | Macros
WDT
AT32F413_periph_driver

WDT driver modules. More...

Topics

WDT_flags_definition
wdt flag
WDT_exported_types
WDT_exported_functions
WDT_private_functions

Macros

#define WDT ((wdt_type *) WDT_BASE)

Detailed Description

WDT driver modules.

Macro Definition Documentation

◆ WDT

#define WDT ((wdt_type *) WDT_BASE)

Definition at line 153 of file at32f413_wdt.h.

Referenced by wdt_counter_reload(), wdt_divider_set(), wdt_enable(), wdt_flag_get(), wdt_register_write_enable(), and wdt_reload_value_set().


AT32F413 Firmwary Library: WDT_flags_definition

Macros
WDT_flags_definition
AT32F413_periph_driver » WDT

wdt flag More...

Macros

#define | WDT_DIVF_UPDATE_FLAG ((uint16_t)0x0001)
#define | WDT_RLDF_UPDATE_FLAG ((uint16_t)0x0002)

Detailed Description

wdt flag

Macro Definition Documentation

◆ WDT_DIVF_UPDATE_FLAG

#define WDT_DIVF_UPDATE_FLAG ((uint16_t)0x0001)

wdt division value update complete flag

Definition at line 52 of file at32f413_wdt.h.

◆ WDT_RLDF_UPDATE_FLAG

#define WDT_RLDF_UPDATE_FLAG ((uint16_t)0x0002)

wdt reload value update complete flag

Definition at line 53 of file at32f413_wdt.h.


AT32F413 Firmwary Library: WDT_exported_types

Data Structures | Enumerations
WDT_exported_types
AT32F413_periph_driver » WDT

Data Structures

struct wdt_type
type define wdt register all More...

Enumerations

enum wdt_division_type {
WDT_CLK_DIV_4 = 0x00 , WDT_CLK_DIV_8 = 0x01 , WDT_CLK_DIV_16 = 0x02 , WDT_CLK_DIV_32 = 0x03 ,
WDT_CLK_DIV_64 = 0x04 , WDT_CLK_DIV_128 = 0x05 , WDT_CLK_DIV_256 = 0x06
}
wdt division value type More...
enum wdt_cmd_value_type { WDT_CMD_LOCK = 0x0000 , WDT_CMD_UNLOCK = 0x5555 , WDT_CMD_ENABLE = 0xCCCC , WDT_CMD_RELOAD = 0xAAAA }
wdt cmd value type More...

Detailed Description

Enumeration Type Documentation

◆ wdt_cmd_value_type

enum wdt_cmd_value_type

wdt cmd value type

Enumerator
WDT_CMD_LOCK | disable write protection command
WDT_CMD_UNLOCK | enable write protection command
WDT_CMD_ENABLE | enable wdt command
WDT_CMD_RELOAD | reload command

Definition at line 80 of file at32f413_wdt.h.

◆ wdt_division_type

enum wdt_division_type

wdt division value type

Enumerator
WDT_CLK_DIV_4 | wdt clock divider value is 4
WDT_CLK_DIV_8 | wdt clock divider value is 8
WDT_CLK_DIV_16 | wdt clock divider value is 16
WDT_CLK_DIV_32 | wdt clock divider value is 32
WDT_CLK_DIV_64 | wdt clock divider value is 64
WDT_CLK_DIV_128 | wdt clock divider value is 128
WDT_CLK_DIV_256 | wdt clock divider value is 256

Definition at line 66 of file at32f413_wdt.h.


AT32F413 Firmwary Library: wdt_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
wdt_type Struct Reference
AT32F413_periph_driver » WDT » WDT_exported_types

type define wdt register all More...

#include <at32f413_wdt.h>

Data Fields

union {
__IO uint32_t cmd
struct {
__IO uint32_t cmd: 16
__IO uint32_t reserved1: 16
} cmd_bit
};
wdt cmd register, offset:0x00
union {
__IO uint32_t div
struct {
__IO uint32_t div: 3
__IO uint32_t reserved1: 29
} div_bit
};
wdt div register, offset:0x04
union {
__IO uint32_t rld
struct {
__IO uint32_t rld: 12
__IO uint32_t reserved1: 20
} rld_bit
};
wdt rld register, offset:0x08
union {
__IO uint32_t sts
struct {
__IO uint32_t divf: 1
__IO uint32_t rldf: 1
__IO uint32_t reserved1: 30
} sts_bit
};
wdt sts register, offset:0x0C

Detailed Description

type define wdt register all

Definition at line 91 of file at32f413_wdt.h.

Field Documentation

◆ [union]

union { ... } wdt_type

wdt cmd register, offset:0x00

◆ [union]

union { ... } wdt_type

wdt div register, offset:0x04

◆ [union]

union { ... } wdt_type

wdt rld register, offset:0x08

◆ [union]

union { ... } wdt_type

wdt sts register, offset:0x0C

◆ cmd

__IO uint32_t wdt_type::cmd

Definition at line 99 of file at32f413_wdt.h.

◆ [struct]

struct { ... } wdt_type::cmd_bit

◆ div

__IO uint32_t wdt_type::div

Definition at line 112 of file at32f413_wdt.h.

◆ [struct]

struct { ... } wdt_type::div_bit

◆ divf

__IO uint32_t wdt_type::divf

Definition at line 141 of file at32f413_wdt.h.

◆ reserved1

__IO uint32_t wdt_type::reserved1

Definition at line 103 of file at32f413_wdt.h.

◆ rld

__IO uint32_t wdt_type::rld

Definition at line 125 of file at32f413_wdt.h.

◆ [struct]

struct { ... } wdt_type::rld_bit

◆ rldf

__IO uint32_t wdt_type::rldf

Definition at line 142 of file at32f413_wdt.h.

◆ sts

__IO uint32_t wdt_type::sts

Definition at line 138 of file at32f413_wdt.h.

◆ [struct]

struct { ... } wdt_type::sts_bit
The documentation for this struct was generated from the following file:
  • at32f413_wdt.h


AT32F413 Firmwary Library: WDT_exported_functions

Functions
WDT_exported_functions
AT32F413_periph_driver » WDT

Functions

void | wdt_enable (void)
wdt enable ,the reload value will be sent to the counter
void | wdt_counter_reload (void)
reload wdt counter
void | wdt_reload_value_set (uint16_t reload_value)
set wdt counter reload value
void | wdt_divider_set (wdt_division_type division)
set wdt division divider
void | wdt_register_write_enable (confirm_state new_state)
enable or disable wdt cmd register write
flag_status | wdt_flag_get (uint16_t wdt_flag)
get wdt flag

Detailed Description

Function Documentation

◆ wdt_counter_reload()

void wdt_counter_reload ( void )

reload wdt counter

Parameters
none
Return values
none

Definition at line 58 of file at32f413_wdt.c.

Referenced by main().

◆ wdt_divider_set()

void wdt_divider_set ( wdt_division_type division )

set wdt division divider

Parameters
division this parameter can be one of the following values:
  • WDT_CLK_DIV_4
  • WDT_CLK_DIV_8
  • WDT_CLK_DIV_16
  • WDT_CLK_DIV_32
  • WDT_CLK_DIV_64
  • WDT_CLK_DIV_128
  • WDT_CLK_DIV_256
Return values
none

Definition at line 86 of file at32f413_wdt.c.

Referenced by main().

◆ wdt_enable()

void wdt_enable ( void )

wdt enable ,the reload value will be sent to the counter

Parameters
none
Return values
none

Definition at line 48 of file at32f413_wdt.c.

Referenced by main().

◆ wdt_flag_get()

flag_status wdt_flag_get ( uint16_t wdt_flag )

get wdt flag

Parameters
wdt_flag this parameter can be one of the following values:
  • WDT_DIVF_UPDATE_FLAG: division value update complete flag.
  • WDT_RLDF_UPDATE_FLAG: reload value update complete flag.
Return values
state of wdt flag

Definition at line 116 of file at32f413_wdt.c.

◆ wdt_register_write_enable()

void wdt_register_write_enable ( confirm_state new_state )

enable or disable wdt cmd register write

Parameters
new_state (TRUE or FALSE)
Return values
none

Definition at line 96 of file at32f413_wdt.c.

Referenced by main().

◆ wdt_reload_value_set()

void wdt_reload_value_set ( uint16_t reload_value )

set wdt counter reload value

Parameters
reload_value (0x0000~0x0FFF)
Return values
none

Definition at line 68 of file at32f413_wdt.c.

Referenced by main().


AT32F413 Firmwary Library: WDT_private_functions

Functions
WDT_private_functions
AT32F413_periph_driver » WDT

Functions

void | wdt_enable (void)
wdt enable ,the reload value will be sent to the counter
void | wdt_counter_reload (void)
reload wdt counter
void | wdt_reload_value_set (uint16_t reload_value)
set wdt counter reload value
void | wdt_divider_set (wdt_division_type division)
set wdt division divider
void | wdt_register_write_enable (confirm_state new_state)
enable or disable wdt cmd register write
flag_status | wdt_flag_get (uint16_t wdt_flag)
get wdt flag

Detailed Description

Function Documentation

◆ wdt_counter_reload()

void wdt_counter_reload ( void )

reload wdt counter

Parameters
none
Return values
none

Definition at line 58 of file at32f413_wdt.c.

Referenced by main().

◆ wdt_divider_set()

void wdt_divider_set ( wdt_division_type division )

set wdt division divider

Parameters
division this parameter can be one of the following values:
  • WDT_CLK_DIV_4
  • WDT_CLK_DIV_8
  • WDT_CLK_DIV_16
  • WDT_CLK_DIV_32
  • WDT_CLK_DIV_64
  • WDT_CLK_DIV_128
  • WDT_CLK_DIV_256
Return values
none

Definition at line 86 of file at32f413_wdt.c.

Referenced by main().

◆ wdt_enable()

void wdt_enable ( void )

wdt enable ,the reload value will be sent to the counter

Parameters
none
Return values
none

Definition at line 48 of file at32f413_wdt.c.

Referenced by main().

◆ wdt_flag_get()

flag_status wdt_flag_get ( uint16_t wdt_flag )

get wdt flag

Parameters
wdt_flag this parameter can be one of the following values:
  • WDT_DIVF_UPDATE_FLAG: division value update complete flag.
  • WDT_RLDF_UPDATE_FLAG: reload value update complete flag.
Return values
state of wdt flag

Definition at line 116 of file at32f413_wdt.c.

◆ wdt_register_write_enable()

void wdt_register_write_enable ( confirm_state new_state )

enable or disable wdt cmd register write

Parameters
new_state (TRUE or FALSE)
Return values
none

Definition at line 96 of file at32f413_wdt.c.

Referenced by main().

◆ wdt_reload_value_set()

void wdt_reload_value_set ( uint16_t reload_value )

set wdt counter reload value

Parameters
reload_value (0x0000~0x0FFF)
Return values
none

Definition at line 68 of file at32f413_wdt.c.

Referenced by main().


AT32F413 Firmwary Library: WWDT

Topics | Macros
WWDT
AT32F413_periph_driver

WWDT driver modules. More...

Topics

WWDT_enable_bit_definition
wwdt enable bit
WWDT_exported_types
WWDT_exported_functions
WWDT_private_functions

Macros

#define WWDT ((wwdt_type *) WWDT_BASE)

Detailed Description

WWDT driver modules.

Macro Definition Documentation

◆ WWDT

#define WWDT ((wwdt_type *) WWDT_BASE)

Definition at line 126 of file at32f413_wwdt.h.

Referenced by wwdt_counter_set(), wwdt_divider_set(), wwdt_enable(), wwdt_flag_clear(), wwdt_flag_get(), wwdt_interrupt_enable(), wwdt_interrupt_flag_get(), and wwdt_window_counter_set().


AT32F413 Firmwary Library: WWDT_enable_bit_definition

Macros
WWDT_enable_bit_definition
AT32F413_periph_driver » WWDT

wwdt enable bit More...

Macros

#define WWDT_EN_BIT ((uint32_t)0x00000080)

Detailed Description

wwdt enable bit

Macro Definition Documentation

◆ WWDT_EN_BIT

#define WWDT_EN_BIT ((uint32_t)0x00000080)

wwdt enable bit

Definition at line 51 of file at32f413_wwdt.h.

Referenced by wwdt_enable().


AT32F413 Firmwary Library: WWDT_exported_types

Data Structures | Enumerations
WWDT_exported_types
AT32F413_periph_driver » WWDT

Data Structures

struct wwdt_type
type define wwdt register all More...

Enumerations

enum wwdt_division_type { WWDT_PCLK1_DIV_4096 = 0x00 , WWDT_PCLK1_DIV_8192 = 0x01 , WWDT_PCLK1_DIV_16384 = 0x02 , WWDT_PCLK1_DIV_32768 = 0x03 }
wwdt division type More...

Detailed Description

Enumeration Type Documentation

◆ wwdt_division_type

enum wwdt_division_type

wwdt division type

Enumerator
WWDT_PCLK1_DIV_4096 | wwdt counter clock = (pclk1/4096)/1)
WWDT_PCLK1_DIV_8192 | wwdt counter clock = (pclk1/4096)/2)
WWDT_PCLK1_DIV_16384 | wwdt counter clock = (pclk1/4096)/4)
WWDT_PCLK1_DIV_32768 | wwdt counter clock = (pclk1/4096)/8)

Definition at line 64 of file at32f413_wwdt.h.


AT32F413 Firmwary Library: wwdt_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
wwdt_type Struct Reference
AT32F413_periph_driver » WWDT » WWDT_exported_types

type define wwdt register all More...

#include <at32f413_wwdt.h>

Data Fields

union {
__IO uint32_t ctrl
struct {
__IO uint32_t cnt: 7
__IO uint32_t wwdten: 1
__IO uint32_t reserved1: 24
} ctrl_bit
};
wwdt ctrl register, offset:0x00
union {
__IO uint32_t cfg
struct {
__IO uint32_t win: 7
__IO uint32_t div: 2
__IO uint32_t rldien: 1
__IO uint32_t reserved1: 22
} cfg_bit
};
wwdt cfg register, offset:0x04
union {
__IO uint32_t sts
struct {
__IO uint32_t rldf: 1
__IO uint32_t reserved1: 31
} sts_bit
};
wwdt cfg register, offset:0x08

Detailed Description

type define wwdt register all

Definition at line 75 of file at32f413_wwdt.h.

Field Documentation

◆ [union]

union { ... } wwdt_type

wwdt ctrl register, offset:0x00

◆ [union]

union { ... } wwdt_type

wwdt cfg register, offset:0x04

◆ [union]

union { ... } wwdt_type

wwdt cfg register, offset:0x08

◆ cfg

__IO uint32_t wwdt_type::cfg

Definition at line 97 of file at32f413_wwdt.h.

◆ [struct]

struct { ... } wwdt_type::cfg_bit

◆ cnt

__IO uint32_t wwdt_type::cnt

Definition at line 86 of file at32f413_wwdt.h.

◆ ctrl

__IO uint32_t wwdt_type::ctrl

Definition at line 83 of file at32f413_wwdt.h.

◆ [struct]

struct { ... } wwdt_type::ctrl_bit

◆ div

__IO uint32_t wwdt_type::div

Definition at line 101 of file at32f413_wwdt.h.

◆ reserved1

__IO uint32_t wwdt_type::reserved1

Definition at line 88 of file at32f413_wwdt.h.

◆ rldf

__IO uint32_t wwdt_type::rldf

Definition at line 115 of file at32f413_wwdt.h.

◆ rldien

__IO uint32_t wwdt_type::rldien

Definition at line 102 of file at32f413_wwdt.h.

◆ sts

__IO uint32_t wwdt_type::sts

Definition at line 112 of file at32f413_wwdt.h.

◆ [struct]

struct { ... } wwdt_type::sts_bit

◆ win

__IO uint32_t wwdt_type::win

Definition at line 100 of file at32f413_wwdt.h.

◆ wwdten

__IO uint32_t wwdt_type::wwdten

Definition at line 87 of file at32f413_wwdt.h.

The documentation for this struct was generated from the following file:
  • at32f413_wwdt.h


AT32F413 Firmwary Library: WWDT_exported_functions

Functions
WWDT_exported_functions
AT32F413_periph_driver » WWDT

Functions

void | wwdt_reset (void)
wwdt reset by crm reset register
void | wwdt_divider_set (wwdt_division_type division)
wwdt division set
void | wwdt_flag_clear (void)
wwdt reload counter interrupt flag clear
void | wwdt_enable (uint8_t wwdt_cnt)
wwdt enable and the counter value load
void | wwdt_interrupt_enable (void)
wwdt reload counter interrupt enable
flag_status | wwdt_flag_get (void)
wwdt reload counter interrupt flag get
flag_status | wwdt_interrupt_flag_get (void)
wwdt reload counter interrupt flag get
void | wwdt_counter_set (uint8_t wwdt_cnt)
wwdt counter value set
void | wwdt_window_counter_set (uint8_t window_cnt)
wwdt window counter value set

Detailed Description

Function Documentation

◆ wwdt_counter_set()

void wwdt_counter_set ( uint8_t wwdt_cnt )

wwdt counter value set

Parameters
wwdt_cnt (0x40~0x7f)
Return values
none

Definition at line 123 of file at32f413_wwdt.c.

Referenced by main().

◆ wwdt_divider_set()

void wwdt_divider_set ( wwdt_division_type division )

wwdt division set

Parameters
division this parameter can be one of the following values:
  • WWDT_PCLK1_DIV_4096 (wwdt counter clock = (pclk1/4096)/1)
  • WWDT_PCLK1_DIV_8192 (wwdt counter clock = (pclk1/4096)/2)
  • WWDT_PCLK1_DIV_16384 (wwdt counter clock = (pclk1/4096)/4)
  • WWDT_PCLK1_DIV_32768 (wwdt counter clock = (pclk1/4096)/8)
Return values
none

Definition at line 63 of file at32f413_wwdt.c.

Referenced by main().

◆ wwdt_enable()

void wwdt_enable ( uint8_t wwdt_cnt )

wwdt enable and the counter value load

Parameters
wwdt_cnt (0x40~0x7f)
Return values
none

< wwdt enable bit

Definition at line 83 of file at32f413_wwdt.c.

Referenced by main().

◆ wwdt_flag_clear()

void wwdt_flag_clear ( void )

wwdt reload counter interrupt flag clear

Parameters
none
Return values
none

Definition at line 73 of file at32f413_wwdt.c.

◆ wwdt_flag_get()

flag_status wwdt_flag_get ( void )

wwdt reload counter interrupt flag get

Parameters
none
Return values
state of reload counter interrupt flag

Definition at line 103 of file at32f413_wwdt.c.

◆ wwdt_interrupt_enable()

void wwdt_interrupt_enable ( void )

wwdt reload counter interrupt enable

Parameters
none
Return values
none

Definition at line 93 of file at32f413_wwdt.c.

◆ wwdt_interrupt_flag_get()

flag_status wwdt_interrupt_flag_get ( void )

wwdt reload counter interrupt flag get

Parameters
none
Return values
state of reload counter interrupt flag

Definition at line 113 of file at32f413_wwdt.c.

◆ wwdt_reset()

void wwdt_reset ( void )

wwdt reset by crm reset register

Return values
none

Definition at line 47 of file at32f413_wwdt.c.

◆ wwdt_window_counter_set()

void wwdt_window_counter_set ( uint8_t window_cnt )

wwdt window counter value set

Parameters
window_cnt (0x40~0x7f)
Return values
none

Definition at line 133 of file at32f413_wwdt.c.

Referenced by main().


AT32F413 Firmwary Library: WWDT_private_functions

Functions
WWDT_private_functions
AT32F413_periph_driver » WWDT

Functions

void | wwdt_reset (void)
wwdt reset by crm reset register
void | wwdt_divider_set (wwdt_division_type division)
wwdt division set
void | wwdt_flag_clear (void)
wwdt reload counter interrupt flag clear
void | wwdt_enable (uint8_t wwdt_cnt)
wwdt enable and the counter value load
void | wwdt_interrupt_enable (void)
wwdt reload counter interrupt enable
flag_status | wwdt_flag_get (void)
wwdt reload counter interrupt flag get
flag_status | wwdt_interrupt_flag_get (void)
wwdt reload counter interrupt flag get
void | wwdt_counter_set (uint8_t wwdt_cnt)
wwdt counter value set
void | wwdt_window_counter_set (uint8_t window_cnt)
wwdt window counter value set

Detailed Description

Function Documentation

◆ wwdt_counter_set()

void wwdt_counter_set ( uint8_t wwdt_cnt )

wwdt counter value set

Parameters
wwdt_cnt (0x40~0x7f)
Return values
none

Definition at line 123 of file at32f413_wwdt.c.

Referenced by main().

◆ wwdt_divider_set()

void wwdt_divider_set ( wwdt_division_type division )

wwdt division set

Parameters
division this parameter can be one of the following values:
  • WWDT_PCLK1_DIV_4096 (wwdt counter clock = (pclk1/4096)/1)
  • WWDT_PCLK1_DIV_8192 (wwdt counter clock = (pclk1/4096)/2)
  • WWDT_PCLK1_DIV_16384 (wwdt counter clock = (pclk1/4096)/4)
  • WWDT_PCLK1_DIV_32768 (wwdt counter clock = (pclk1/4096)/8)
Return values
none

Definition at line 63 of file at32f413_wwdt.c.

Referenced by main().

◆ wwdt_enable()

void wwdt_enable ( uint8_t wwdt_cnt )

wwdt enable and the counter value load

Parameters
wwdt_cnt (0x40~0x7f)
Return values
none

< wwdt enable bit

Definition at line 83 of file at32f413_wwdt.c.

Referenced by main().

◆ wwdt_flag_clear()

void wwdt_flag_clear ( void )

wwdt reload counter interrupt flag clear

Parameters
none
Return values
none

Definition at line 73 of file at32f413_wwdt.c.

◆ wwdt_flag_get()

flag_status wwdt_flag_get ( void )

wwdt reload counter interrupt flag get

Parameters
none
Return values
state of reload counter interrupt flag

Definition at line 103 of file at32f413_wwdt.c.

◆ wwdt_interrupt_enable()

void wwdt_interrupt_enable ( void )

wwdt reload counter interrupt enable

Parameters
none
Return values
none

Definition at line 93 of file at32f413_wwdt.c.

◆ wwdt_interrupt_flag_get()

flag_status wwdt_interrupt_flag_get ( void )

wwdt reload counter interrupt flag get

Parameters
none
Return values
state of reload counter interrupt flag

Definition at line 113 of file at32f413_wwdt.c.

◆ wwdt_reset()

void wwdt_reset ( void )

wwdt reset by crm reset register

Return values
none

Definition at line 47 of file at32f413_wwdt.c.

◆ wwdt_window_counter_set()

void wwdt_window_counter_set ( uint8_t window_cnt )

wwdt window counter value set

Parameters
window_cnt (0x40~0x7f)
Return values
none

Definition at line 133 of file at32f413_wwdt.c.

Referenced by main().


AT32F413 Firmwary Library: AT32F413_periph_examples

Topics
AT32F413_periph_examples

Topics

ACC_calibration
ADC_combine_mode_ordinary_simult
ADC_current_vref_value_check
ADC_exint_trigger_partitioned
ADC_internal_temperature_sensor
ADC_repeat_conversion_loop_transfer
ADC_tmr_trigger_automatic_preempted
ADC_voltage_monitoring
BPR_data
BPR_tamper
CAN_communication_mode
CAN_filter
CAN_loopback_mode
CORTEX_m4_bit_band
CORTEX_m4_cmsis_dsp
CORTEX_m4_fpu
CORTEX_m4_systick_interrupt
CRC_calculation
CRM_clock_failure_detection
CRM_sysclk_switch
DEBUG_tmr
DMA_data_to_gpio_flexible
DMA_flash_to_sram
EXINT_config
EXINT_software_trigger
FLASH_write_read
FLASH_operate_spim
FLASH_run_in_spim
GPIO_io_toggle
GPIO_led_toggle
GPIO_swjtag_remap
I2C_communication_dma
I2C_communication_int
I2C_communication_poll
I2C_eeprom
I2C_memory_write
I2S_halfduplex_dma
I2S_halfduplex_interrupt
I2S_spii2s_switch_halfduplex_polling
PWC_deepsleep_rtc
PWC_power_voltage_monitor
PWC_sleep_tmr2
PWC_sleep_usart1
PWC_standby_rtc
PWC_standby_wakeup_pin
RTC_calendar
RTC_lick_calibration
SDIO_emmc_card
SDIO_emmc_card
SDIO_sd_mmc_card
SDIO_sd_mmc_card
SDIO_sdio_fatfs
SDIO_sdio_fatfs
SPI_crc_transfer_polling
SPI_fullduplex_dma_jtagpin
SPI_fullduplex_polling
SPI_halfduplex_dma_jtagpin
SPI_halfduplex_interrupt
SPI_halfduplex_transceiver_switch
SPI_only_receive_mode_polling
SPI_w25q_flash
TMR_6_steps
TMR_7_pwm_output
TMR_cascade_synchro
TMR_complementary_signals
TMR_dma
TMR_dma_burst
TMR_encoder_tmr2
TMR_external_clock
TMR_hall_xor_tmr2
TMR_hang_mode
TMR_input_capture
TMR_oc_high
TMR_oc_low
TMR_oc_toggle_tmr3
TMR_oc_toggle_tmr9
TMR_one_cycle
TMR_parallel_synchro
TMR_pwm_input
TMR_pwm_input_dma
TMR_pwm_output_simulate
TMR_pwm_output_tmr10
TMR_pwm_output_tmr3
TMR_timer_base
TMR_tmr1_synchro
TMR_tmr2_32bit
USART_half_duplex
USART_hw_flow_control
USART_idle_detection
USART_interrupt
USART_irda
USART_polling
USART_printf
USART_receiver_mute
F413_USART_rs485
USART_smartcard
USART_synchronous
USART_transfer_by_dma_interrupt
USART_transfer_by_dma_polling
USB_device_audio
USB_device_audio_hid
USB_device_composite_vcp_keyboard
USB_device_msc
USB_device_composite_vcp_msc
USB_device_custom_hid
USB_device_keyboard
USB_device_mouse
USB_device_printer
USB_device_vcp_loopback
USB_device_virtual_msc_iap
USB_device_winusb
WDT_reset
WDT_standby
WWDT_reset

Detailed Description

Generated by doxygen 1.12.0


AT32F413 Firmwary Library: ACC_calibration

Macros | Functions | Variables
ACC_calibration
AT32F413_periph_examples

Macros

#define | EPT0_TX_ADDR 0x40
usb endpoint max num define
#define | EPT0_RX_ADDR 0x80
#define | EPT1_TX_ADDR 0xC0
#define | EPT1_RX_ADDR 0x100
#define | EPT2_TX_ADDR 0x140
#define | EPT2_RX_ADDR 0x180
#define | EPT3_TX_ADDR 0x00
#define | EPT3_RX_ADDR 0x00
#define | EPT4_TX_ADDR 0x00
#define | EPT4_RX_ADDR 0x00
#define | EPT5_TX_ADDR 0x00
#define | EPT5_RX_ADDR 0x00
#define | EPT6_TX_ADDR 0x00
#define | EPT6_RX_ADDR 0x00
#define | EPT7_TX_ADDR 0x00
#define | EPT7_RX_ADDR 0x00
#define | SCLK_FROM_HICK
#define | ACC_TRIM

Functions

void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.
void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | system_clock_config_for_acc (void)
system clock config for acc
void | clkout_config (void)
clkout configuration
void | usb_clock48m_select (usb_clk48_s clk_s)
usb 48M clock select
void | USBFS_L_CAN1_RX0_IRQHandler (void)
usbfs_l_can1_rx0 interrupt handler
void | ACC_IRQHandler (void)
acc interrupt handler
int | main (void)
main function.

Variables

usbd_core_type usb_core_dev
uint8_t | usb_buffer [256]
uint32_t | acc_c2_value = 0

Detailed Description

Macro Definition Documentation

◆ ACC_TRIM

#define ACC_TRIM

Definition at line 54 of file project/at_start_f413/examples/acc/calibration/src/main.c.

◆ EPT0_RX_ADDR

#define EPT0_RX_ADDR 0x80

Definition at line 74 of file project/at_start_f413/examples/acc/calibration/inc/usb_conf.h.

Referenced by usbd_reset_handler().

◆ EPT0_TX_ADDR

#define EPT0_TX_ADDR 0x40

usb endpoint max num define

usb buffer extend to 768-1280 bytes

auto malloc usb endpoint buffer

user custom endpoint buffer EPTn_TX_ADDR, EPTn_RX_ADDR must less than usb buffer size

Definition at line 73 of file project/at_start_f413/examples/acc/calibration/inc/usb_conf.h.

Referenced by usbd_reset_handler().

◆ EPT1_RX_ADDR

#define EPT1_RX_ADDR 0x100

Definition at line 77 of file project/at_start_f413/examples/acc/calibration/inc/usb_conf.h.

Referenced by class_init_handler(), class_init_handler(), class_init_handler(), and class_init_handler().

◆ EPT1_TX_ADDR

#define EPT1_TX_ADDR 0xC0

Definition at line 76 of file project/at_start_f413/examples/acc/calibration/inc/usb_conf.h.

Referenced by class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), and class_init_handler().

◆ EPT2_RX_ADDR

#define EPT2_RX_ADDR 0x180

Definition at line 80 of file project/at_start_f413/examples/acc/calibration/inc/usb_conf.h.

◆ EPT2_TX_ADDR

#define EPT2_TX_ADDR 0x140

Definition at line 79 of file project/at_start_f413/examples/acc/calibration/inc/usb_conf.h.

Referenced by class_init_handler(), and class_init_handler().

◆ EPT3_RX_ADDR

#define EPT3_RX_ADDR 0x00

Definition at line 83 of file project/at_start_f413/examples/acc/calibration/inc/usb_conf.h.

◆ EPT3_TX_ADDR

#define EPT3_TX_ADDR 0x00

Definition at line 82 of file project/at_start_f413/examples/acc/calibration/inc/usb_conf.h.

Referenced by class_init_handler().

◆ EPT4_RX_ADDR

#define EPT4_RX_ADDR 0x00

Definition at line 86 of file project/at_start_f413/examples/acc/calibration/inc/usb_conf.h.

◆ EPT4_TX_ADDR

#define EPT4_TX_ADDR 0x00

Definition at line 85 of file project/at_start_f413/examples/acc/calibration/inc/usb_conf.h.

◆ EPT5_RX_ADDR

#define EPT5_RX_ADDR 0x00

Definition at line 89 of file project/at_start_f413/examples/acc/calibration/inc/usb_conf.h.

◆ EPT5_TX_ADDR

#define EPT5_TX_ADDR 0x00

Definition at line 88 of file project/at_start_f413/examples/acc/calibration/inc/usb_conf.h.

◆ EPT6_RX_ADDR

#define EPT6_RX_ADDR 0x00

Definition at line 92 of file project/at_start_f413/examples/acc/calibration/inc/usb_conf.h.

◆ EPT6_TX_ADDR

#define EPT6_TX_ADDR 0x00

Definition at line 91 of file project/at_start_f413/examples/acc/calibration/inc/usb_conf.h.

◆ EPT7_RX_ADDR

#define EPT7_RX_ADDR 0x00

Definition at line 95 of file project/at_start_f413/examples/acc/calibration/inc/usb_conf.h.

◆ EPT7_TX_ADDR

#define EPT7_TX_ADDR 0x00

Definition at line 94 of file project/at_start_f413/examples/acc/calibration/inc/usb_conf.h.

◆ SCLK_FROM_HICK

#define SCLK_FROM_HICK

Definition at line 48 of file project/at_start_f413/examples/acc/calibration/src/main.c.

Function Documentation

◆ ACC_IRQHandler()

void ACC_IRQHandler ( void )

acc interrupt handler

Parameters
none
Return values
none

< acc internal high-speed clock calibration ready error flag

< acc internal high-speed clock calibration ready error flag

< acc reference signal lost error flag

< acc reference signal lost error flag

Definition at line 134 of file project/at_start_f413/examples/acc/calibration/src/main.c.

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 78 of file project/at_start_f413/examples/acc/calibration/src/at32f413_int.c.

◆ clkout_config()

void clkout_config ( void )

clkout configuration

Parameters
none
Return values
none

< gpio pins number 8

Definition at line 215 of file project/at_start_f413/examples/acc/calibration/src/main.c.

Referenced by system_clock_config_for_acc().

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 113 of file project/at_start_f413/examples/acc/calibration/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 52 of file project/at_start_f413/examples/acc/calibration/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< acc internal high-speed clock calibration ready interrupt enable

< acc reference signal lost interrupt enable

< acc hick trim

Definition at line 265 of file project/at_start_f413/examples/acc/calibration/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 65 of file project/at_start_f413/examples/acc/calibration/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 43 of file project/at_start_f413/examples/acc/calibration/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 122 of file project/at_start_f413/examples/acc/calibration/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 104 of file project/at_start_f413/examples/acc/calibration/src/at32f413_int.c.

◆ system_clock_config_for_acc()

void system_clock_config_for_acc ( void )

system clock config for acc

Parameters
none
Return values
none

< high speed internal clock stable flag

< phase locking loop stable flag

Definition at line 157 of file project/at_start_f413/examples/acc/calibration/src/main.c.

Referenced by main().

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 131 of file project/at_start_f413/examples/acc/calibration/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 91 of file project/at_start_f413/examples/acc/calibration/src/at32f413_int.c.

◆ usb_clock48m_select()

void usb_clock48m_select ( usb_clk48_s clk_s )

usb 48M clock select

Parameters
clk_s:USB_CLK_HICK,USB_CLK_HEXT
Return values
none

Definition at line 67 of file project/at_start_f413/examples/acc/calibration/src/main.c.

Referenced by main().

◆ usb_delay_ms()

void usb_delay_ms ( uint32_t ms )

usb delay millisecond function.

Parameters
ms number of millisecond delay
Return values
none

Definition at line 244 of file project/at_start_f413/examples/acc/calibration/src/main.c.

Referenced by usbd_remote_wakeup().

◆ usb_delay_us()

void usb_delay_us ( uint32_t us )

usb delay microsecond function.

Parameters
us number of microsecond delay
Return values
none

Definition at line 255 of file project/at_start_f413/examples/acc/calibration/src/main.c.

◆ USBFS_L_CAN1_RX0_IRQHandler()

void USBFS_L_CAN1_RX0_IRQHandler ( void )

usbfs_l_can1_rx0 interrupt handler

Parameters
none
Return values
none

Definition at line 124 of file project/at_start_f413/examples/acc/calibration/src/main.c.

Variable Documentation

◆ acc_c2_value

uint32_t acc_c2_value = 0

Definition at line 59 of file project/at_start_f413/examples/acc/calibration/src/main.c.

Referenced by acc_write_c2(), and main().

◆ usb_buffer

uint8_t usb_buffer[256]

Definition at line 44 of file project/at_start_f413/examples/acc/calibration/src/main.c.

Referenced by main().

◆ usb_core_dev

usbd_core_type usb_core_dev

Definition at line 43 of file project/at_start_f413/examples/acc/calibration/src/main.c.

Referenced by main(), and USBFS_L_CAN1_RX0_IRQHandler().


AT32F413 Firmwary Library: ADC_combine_mode_ordinary_simult

Functions | Variables
ADC_combine_mode_ordinary_simult
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
static void | gpio_config (void)
gpio configuration.
static void | dma_config (void)
dma configuration.
static void | adc_config (void)
adc configuration.
void | DMA1_Channel1_IRQHandler (void)
this function handles dma1_channel1 handler.
int | main (void)
main function.

Variables

__IO uint32_t | adc1_ordinary_valuetab [3]
__IO uint32_t | dma1_trans_complete_flag = 0
__IO uint32_t | conversion_times_index = 0

Detailed Description

Function Documentation

◆ adc_config()

static void adc_config ( void )
static

adc configuration.

Parameters
none
Return values
none

Definition at line 94 of file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/main.c.

Referenced by main().

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/at32f413_int.c.

◆ DMA1_Channel1_IRQHandler()

void DMA1_Channel1_IRQHandler ( void )

this function handles dma1_channel1 handler.

Parameters
none
Return values
none

< dma1 channel1 full data transfer flag

< dma1 channel1 full data transfer flag

Definition at line 145 of file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/main.c.

◆ dma_config()

static void dma_config ( void )
static

dma configuration.

Parameters
none
Return values
none

< dma full data transfer interrupt

Definition at line 67 of file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/main.c.

Referenced by main().

◆ gpio_config()

static void gpio_config ( void )
static

gpio configuration.

Parameters
none
Return values
none

< gpio pins number 4

< gpio pins number 5

< gpio pins number 6

< gpio pins number 7

< gpio pins number 0

< gpio pins number 1

Definition at line 46 of file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/main.c.

Referenced by main().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 159 of file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/at32f413_int.c.

Variable Documentation

◆ adc1_ordinary_valuetab

__IO uint32_t adc1_ordinary_valuetab[3]

Definition at line 37 of file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/main.c.

Referenced by dma_config(), and main().

◆ conversion_times_index

__IO uint32_t conversion_times_index = 0

Definition at line 39 of file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/main.c.

Referenced by main().

◆ dma1_trans_complete_flag

__IO uint32_t dma1_trans_complete_flag = 0

Definition at line 38 of file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/main.c.

Referenced by DMA1_Channel1_IRQHandler(), and main().


AT32F413 Firmwary Library: ADC_current_vref_value_check

Functions | Variables
ADC_current_vref_value_check
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
static void | dma_config (void)
dma configuration.
static void | adc_config (void)
adc configuration.
int | main (void)
main function.

Variables

__IO uint16_t adc1_ordinary_value = 0

Detailed Description

Function Documentation

◆ adc_config()

static void adc_config ( void )
static

adc configuration.

Parameters
none
Return values
none

Definition at line 68 of file project/at_start_f413/examples/adc/current_vref_value_check/src/main.c.

Referenced by main().

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/adc/current_vref_value_check/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/adc/current_vref_value_check/src/at32f413_int.c.

◆ dma_config()

static void dma_config ( void )
static

dma configuration.

Parameters
none
Return values
none

Definition at line 44 of file project/at_start_f413/examples/adc/current_vref_value_check/src/main.c.

Referenced by main().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/adc/current_vref_value_check/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< dma1 channel1 full data transfer flag

< dma1 channel1 full data transfer flag

Definition at line 104 of file project/at_start_f413/examples/adc/current_vref_value_check/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/adc/current_vref_value_check/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/adc/current_vref_value_check/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/adc/current_vref_value_check/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/adc/current_vref_value_check/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/adc/current_vref_value_check/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/adc/current_vref_value_check/src/at32f413_int.c.

Variable Documentation

◆ adc1_ordinary_value

__IO uint16_t adc1_ordinary_value = 0

Definition at line 37 of file project/at_start_f413/examples/adc/current_vref_value_check/src/main.c.

Referenced by dma_config(), and main().


AT32F413 Firmwary Library: ADC_exint_trigger_partitioned

Functions | Variables
ADC_exint_trigger_partitioned
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
static void | gpio_config (void)
gpio configuration.
static void | exint_config (void)
exint configuration.
static void | dma_config (void)
dma configuration.
static void | adc_config (void)
adc configuration.
void | DMA1_Channel1_IRQHandler (void)
this function handles dma1_channel1 handler.
void | ADC1_2_IRQHandler (void)
this function handles adc1_2 handler.
int | main (void)
main function.

Variables

__IO uint16_t | adc1_ordinary_valuetab [3] = {0}
__IO uint16_t | adc1_preempt_valuetab [3] = {0}
__IO uint16_t | dma_trans_complete_flag = 0
__IO uint16_t | ordinary_conversion_times_index = 0
__IO uint16_t | preempt_trigger_count = 0
__IO uint16_t | preempt_conversion_times_index = 0

Detailed Description

Function Documentation

◆ ADC1_2_IRQHandler()

void ADC1_2_IRQHandler ( void )

this function handles adc1_2 handler.

Parameters
none
Return values
none

< preempt channels conversion end flag

< preempt channels conversion end flag

Definition at line 199 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c.

◆ adc_config()

static void adc_config ( void )
static

adc configuration.

Parameters
none
Return values
none

< preempt channels conversion end interrupt

Definition at line 138 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c.

Referenced by main().

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/src/at32f413_int.c.

◆ DMA1_Channel1_IRQHandler()

void DMA1_Channel1_IRQHandler ( void )

this function handles dma1_channel1 handler.

Parameters
none
Return values
none

< dma1 channel1 full data transfer flag

< dma1 channel1 full data transfer flag

Definition at line 185 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c.

◆ dma_config()

static void dma_config ( void )
static

dma configuration.

Parameters
none
Return values
none

< dma full data transfer interrupt

Definition at line 111 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c.

Referenced by main().

◆ exint_config()

static void exint_config ( void )
static

exint configuration.

Parameters
none
Return values
none

< gpio pins number 11

< gpio pins number 15

< external interrupt line 11

< external interrupt line 15

Definition at line 71 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c.

Referenced by main().

◆ gpio_config()

static void gpio_config ( void )
static

gpio configuration.

Parameters
none
Return values
none

< gpio pins number 4

< gpio pins number 5

< gpio pins number 6

< gpio pins number 7

< gpio pins number 0

< gpio pins number 1

Definition at line 50 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c.

Referenced by main().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 216 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/src/at32f413_int.c.

Variable Documentation

◆ adc1_ordinary_valuetab

__IO uint16_t adc1_ordinary_valuetab[3] = {0}

Definition at line 38 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c.

Referenced by dma_config(), and main().

◆ adc1_preempt_valuetab

__IO uint16_t adc1_preempt_valuetab[3] = {0}

Definition at line 39 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c.

Referenced by ADC1_2_IRQHandler(), and main().

◆ dma_trans_complete_flag

__IO uint16_t dma_trans_complete_flag = 0

Definition at line 40 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c.

Referenced by DMA1_Channel1_IRQHandler(), and main().

◆ ordinary_conversion_times_index

__IO uint16_t ordinary_conversion_times_index = 0

Definition at line 41 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c.

Referenced by main().

◆ preempt_conversion_times_index

__IO uint16_t preempt_conversion_times_index = 0

Definition at line 43 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c.

Referenced by main().

◆ preempt_trigger_count

__IO uint16_t preempt_trigger_count = 0

Definition at line 42 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c.

Referenced by ADC1_2_IRQHandler(), and main().


AT32F413 Firmwary Library: ADC_internal_temperature_sensor

Macros | Functions | Variables
ADC_internal_temperature_sensor
AT32F413_periph_examples

Macros

#define | ADC_VREF (3.3)
#define | ADC_TEMP_BASE (1.28)
#define | ADC_TEMP_SLOPE (-0.00420)

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
static void | dma_config (void)
dma configuration.
static void | adc_config (void)
adc configuration.
int | main (void)
main function.

Variables

__IO uint16_t adc1_ordinary_value = 0

Detailed Description

Macro Definition Documentation

◆ ADC_TEMP_BASE

#define ADC_TEMP_BASE (1.28)

Definition at line 39 of file project/at_start_f413/examples/adc/internal_temperature_sensor/src/main.c.

Referenced by main().

◆ ADC_TEMP_SLOPE

#define ADC_TEMP_SLOPE (-0.00420)

Definition at line 40 of file project/at_start_f413/examples/adc/internal_temperature_sensor/src/main.c.

Referenced by main().

◆ ADC_VREF

#define ADC_VREF (3.3)

Definition at line 38 of file project/at_start_f413/examples/adc/internal_temperature_sensor/src/main.c.

Referenced by main().

Function Documentation

◆ adc_config()

static void adc_config ( void )
static

adc configuration.

Parameters
none
Return values
none

Definition at line 73 of file project/at_start_f413/examples/adc/internal_temperature_sensor/src/main.c.

Referenced by main().

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 78 of file project/at_start_f413/examples/adc/internal_temperature_sensor/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 113 of file project/at_start_f413/examples/adc/internal_temperature_sensor/src/at32f413_int.c.

◆ dma_config()

static void dma_config ( void )
static

dma configuration.

Parameters
none
Return values
none

Definition at line 49 of file project/at_start_f413/examples/adc/internal_temperature_sensor/src/main.c.

Referenced by main().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 52 of file project/at_start_f413/examples/adc/internal_temperature_sensor/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< dma1 channel1 full data transfer flag

< dma1 channel1 full data transfer flag

Definition at line 109 of file project/at_start_f413/examples/adc/internal_temperature_sensor/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 65 of file project/at_start_f413/examples/adc/internal_temperature_sensor/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 43 of file project/at_start_f413/examples/adc/internal_temperature_sensor/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 122 of file project/at_start_f413/examples/adc/internal_temperature_sensor/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 104 of file project/at_start_f413/examples/adc/internal_temperature_sensor/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 131 of file project/at_start_f413/examples/adc/internal_temperature_sensor/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 91 of file project/at_start_f413/examples/adc/internal_temperature_sensor/src/at32f413_int.c.

Variable Documentation

◆ adc1_ordinary_value

__IO uint16_t adc1_ordinary_value = 0

Definition at line 42 of file project/at_start_f413/examples/adc/internal_temperature_sensor/src/main.c.

Referenced by dma_config(), and main().


AT32F413 Firmwary Library: ADC_repeat_conversion_loop_transfer

Functions | Variables
ADC_repeat_conversion_loop_transfer
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
static void | gpio_config (void)
gpio configuration.
static void | dma_config (void)
dma configuration.
static void | adc_config (void)
adc configuration.
void | DMA1_Channel1_IRQHandler (void)
this function handles dma1_channel1 handler.
int | main (void)
main function.

Variables

__IO uint16_t | adc1_ordinary_valuetab [3] = {0}
__IO uint16_t | dma_trans_complete_flag = 0

Detailed Description

Function Documentation

◆ adc_config()

static void adc_config ( void )
static

adc configuration.

Parameters
none
Return values
none

Definition at line 88 of file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/main.c.

Referenced by main().

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/at32f413_int.c.

◆ DMA1_Channel1_IRQHandler()

void DMA1_Channel1_IRQHandler ( void )

this function handles dma1_channel1 handler.

Parameters
none
Return values
none

< dma1 channel1 full data transfer flag

< dma1 channel1 full data transfer flag

Definition at line 125 of file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/main.c.

◆ dma_config()

static void dma_config ( void )
static

dma configuration.

Parameters
none
Return values
none

< dma full data transfer interrupt

Definition at line 61 of file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/main.c.

Referenced by main().

◆ gpio_config()

static void gpio_config ( void )
static

gpio configuration.

Parameters
none
Return values
none

< gpio pins number 4

< gpio pins number 5

< gpio pins number 6

Definition at line 45 of file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/main.c.

Referenced by main().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 139 of file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/at32f413_int.c.

Variable Documentation

◆ adc1_ordinary_valuetab

__IO uint16_t adc1_ordinary_valuetab[3] = {0}

Definition at line 37 of file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/main.c.

Referenced by dma_config().

◆ dma_trans_complete_flag

__IO uint16_t dma_trans_complete_flag = 0

Definition at line 38 of file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/main.c.

Referenced by DMA1_Channel1_IRQHandler().


AT32F413 Firmwary Library: ADC_tmr_trigger_automatic_preempted

Functions | Variables
ADC_tmr_trigger_automatic_preempted
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
static void | gpio_config (void)
gpio configuration.
static void | dma_config (void)
dma configuration.
static void | tmr1_config (void)
tmr1 configuration.
static void | adc_config (void)
adc configuration.
void | DMA1_Channel1_IRQHandler (void)
this function handles dma1_channel1 handler.
void | ADC1_2_IRQHandler (void)
this function handles adc1_2 handler.
int | main (void)
main function.

Variables

__IO uint16_t | adc1_ordinary_valuetab [3] = {0}
__IO uint16_t | adc1_preempt_valuetab [3] = {0}
__IO uint16_t | dma_trans_complete_flag = 0
__IO uint16_t | ordinary_conversion_times_index = 0
__IO uint16_t | preempt_conversion_count = 0
__IO uint16_t | preempt_conversion_times_index = 0

Detailed Description

Function Documentation

◆ ADC1_2_IRQHandler()

void ADC1_2_IRQHandler ( void )

this function handles adc1_2 handler.

Parameters
none
Return values
none

< preempt channels conversion end flag

< preempt channels conversion end flag

Definition at line 196 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c.

◆ adc_config()

static void adc_config ( void )
static

adc configuration.

Parameters
none
Return values
none

< preempt channels conversion end interrupt

Definition at line 136 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c.

Referenced by main().

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/at32f413_int.c.

◆ DMA1_Channel1_IRQHandler()

void DMA1_Channel1_IRQHandler ( void )

this function handles dma1_channel1 handler.

Parameters
none
Return values
none

< dma1 channel1 full data transfer flag

< dma1 channel1 full data transfer flag

Definition at line 182 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c.

◆ dma_config()

static void dma_config ( void )
static

dma configuration.

Parameters
none
Return values
none

< dma full data transfer interrupt

Definition at line 70 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c.

Referenced by main().

◆ gpio_config()

static void gpio_config ( void )
static

gpio configuration.

Parameters
none
Return values
none

< gpio pins number 4

< gpio pins number 5

< gpio pins number 6

< gpio pins number 7

< gpio pins number 0

< gpio pins number 1

Definition at line 49 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c.

Referenced by main().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 214 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/at32f413_int.c.

◆ tmr1_config()

static void tmr1_config ( void )
static

tmr1 configuration.

Parameters
none
Return values
none

< gpio pins number 8

Definition at line 97 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c.

Referenced by main().

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/at32f413_int.c.

Variable Documentation

◆ adc1_ordinary_valuetab

__IO uint16_t adc1_ordinary_valuetab[3] = {0}

Definition at line 37 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c.

Referenced by dma_config(), and main().

◆ adc1_preempt_valuetab

__IO uint16_t adc1_preempt_valuetab[3] = {0}

Definition at line 38 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c.

Referenced by ADC1_2_IRQHandler(), and main().

◆ dma_trans_complete_flag

__IO uint16_t dma_trans_complete_flag = 0

Definition at line 39 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c.

Referenced by DMA1_Channel1_IRQHandler(), and main().

◆ ordinary_conversion_times_index

__IO uint16_t ordinary_conversion_times_index = 0

Definition at line 40 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c.

Referenced by main().

◆ preempt_conversion_count

__IO uint16_t preempt_conversion_count = 0

Definition at line 41 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c.

Referenced by ADC1_2_IRQHandler(), and main().

◆ preempt_conversion_times_index

__IO uint16_t preempt_conversion_times_index = 0

Definition at line 42 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: ADC_voltage_monitoring

Functions | Variables
ADC_voltage_monitoring
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
static void | gpio_config (void)
gpio configuration.
static void | dma_config (void)
dma configuration.
static void | adc_config (void)
adc configuration.
void | ADC1_2_IRQHandler (void)
this function handles adc1_2 handler.
int | main (void)
main function.

Variables

__IO uint16_t | adc1_ordinary_valuetab [3] = {0}
__IO uint16_t | vmor_flag_index = 0
__IO uint16_t | error_times_index = 0

Detailed Description

Function Documentation

◆ ADC1_2_IRQHandler()

void ADC1_2_IRQHandler ( void )

this function handles adc1_2 handler.

Parameters
none
Return values
none

< voltage monitoring out of range flag

< voltage monitoring out of range flag

Definition at line 128 of file project/at_start_f413/examples/adc/voltage_monitoring/src/main.c.

◆ adc_config()

static void adc_config ( void )
static

adc configuration.

Parameters
none
Return values
none

< voltage monitoring out of range interrupt

Definition at line 86 of file project/at_start_f413/examples/adc/voltage_monitoring/src/main.c.

Referenced by main().

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 78 of file project/at_start_f413/examples/adc/voltage_monitoring/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 113 of file project/at_start_f413/examples/adc/voltage_monitoring/src/at32f413_int.c.

◆ dma_config()

static void dma_config ( void )
static

dma configuration.

Parameters
none
Return values
none

Definition at line 62 of file project/at_start_f413/examples/adc/voltage_monitoring/src/main.c.

Referenced by main().

◆ gpio_config()

static void gpio_config ( void )
static

gpio configuration.

Parameters
none
Return values
none

< gpio pins number 4

< gpio pins number 5

< gpio pins number 6

Definition at line 46 of file project/at_start_f413/examples/adc/voltage_monitoring/src/main.c.

Referenced by main().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 52 of file project/at_start_f413/examples/adc/voltage_monitoring/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 143 of file project/at_start_f413/examples/adc/voltage_monitoring/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 65 of file project/at_start_f413/examples/adc/voltage_monitoring/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 43 of file project/at_start_f413/examples/adc/voltage_monitoring/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 122 of file project/at_start_f413/examples/adc/voltage_monitoring/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 104 of file project/at_start_f413/examples/adc/voltage_monitoring/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 131 of file project/at_start_f413/examples/adc/voltage_monitoring/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 91 of file project/at_start_f413/examples/adc/voltage_monitoring/src/at32f413_int.c.

Variable Documentation

◆ adc1_ordinary_valuetab

__IO uint16_t adc1_ordinary_valuetab[3] = {0}

Definition at line 37 of file project/at_start_f413/examples/adc/voltage_monitoring/src/main.c.

Referenced by dma_config(), and main().

◆ error_times_index

__IO uint16_t error_times_index = 0

Definition at line 39 of file project/at_start_f413/examples/adc/voltage_monitoring/src/main.c.

Referenced by main().

◆ vmor_flag_index

__IO uint16_t vmor_flag_index = 0

Definition at line 38 of file project/at_start_f413/examples/adc/voltage_monitoring/src/main.c.

Referenced by ADC1_2_IRQHandler(), and main().


AT32F413 Firmwary Library: BPR_data

Macros | Functions | Variables
BPR_data
AT32F413_periph_examples

Macros

#define BPR_DR_NUMBER 42

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | bpr_reg_write (void)
write data to bpr dt register.
uint8_t | bpr_reg_check (void)
checks if the bpr dt register values are correct or not.
void | uart_init (uint32_t baudrate)
init usart.
int | main (void)
main function.

Variables

bpr_data_type bpr_addr_tab [42]

Detailed Description

Macro Definition Documentation

◆ BPR_DR_NUMBER

#define BPR_DR_NUMBER 42

Definition at line 37 of file project/at_start_f413/examples/bpr/bpr_data/src/main.c.

Referenced by bpr_reg_check(), and bpr_reg_write().

Function Documentation

◆ bpr_reg_check()

uint8_t bpr_reg_check ( void )

checks if the bpr dt register values are correct or not.

Parameters
none.
Return values
- TRUE: all bpr dt register values are correct
  • FALSE: number of the bpr register which value is not correct

Definition at line 79 of file project/at_start_f413/examples/bpr/bpr_data/src/main.c.

Referenced by main().

◆ bpr_reg_write()

void bpr_reg_write ( void )

write data to bpr dt register.

Parameters
none.
Return values
none

Definition at line 61 of file project/at_start_f413/examples/bpr/bpr_data/src/main.c.

Referenced by main().

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 78 of file project/at_start_f413/examples/bpr/bpr_data/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 113 of file project/at_start_f413/examples/bpr/bpr_data/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 52 of file project/at_start_f413/examples/bpr/bpr_data/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< bpr tamper event flag

Definition at line 99 of file project/at_start_f413/examples/bpr/bpr_data/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 65 of file project/at_start_f413/examples/bpr/bpr_data/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 43 of file project/at_start_f413/examples/bpr/bpr_data/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 122 of file project/at_start_f413/examples/bpr/bpr_data/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 104 of file project/at_start_f413/examples/bpr/bpr_data/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 131 of file project/at_start_f413/examples/bpr/bpr_data/src/at32f413_int.c.

◆ uart_init()

void uart_init ( uint32_t baudrate )

init usart.

Parameters
none
Return values
none

Definition at line 44 of file app_led3_toggle/src/usart.c.

Referenced by main().

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 91 of file project/at_start_f413/examples/bpr/bpr_data/src/at32f413_int.c.

Variable Documentation

◆ bpr_addr_tab

bpr_data_type bpr_addr_tab[42]
Initial value:
=
{
BPR_DATA1, BPR_DATA2, BPR_DATA3, BPR_DATA4, BPR_DATA5,
BPR_DATA6, BPR_DATA7, BPR_DATA8, BPR_DATA9, BPR_DATA10,
BPR_DATA11, BPR_DATA12, BPR_DATA13, BPR_DATA14, BPR_DATA15,
BPR_DATA16, BPR_DATA17, BPR_DATA18, BPR_DATA19, BPR_DATA20,
BPR_DATA21, BPR_DATA22, BPR_DATA23, BPR_DATA24, BPR_DATA25,
BPR_DATA26, BPR_DATA27, BPR_DATA28, BPR_DATA29, BPR_DATA30,
BPR_DATA31, BPR_DATA32, BPR_DATA33, BPR_DATA34, BPR_DATA35,
BPR_DATA36, BPR_DATA37, BPR_DATA38, BPR_DATA39, BPR_DATA40,
BPR_DATA41, BPR_DATA42
}
BPR_DATA26
@ BPR_DATA26
Definition at32f413_bpr.h:92
BPR_DATA28
@ BPR_DATA28
Definition at32f413_bpr.h:94
BPR_DATA31
@ BPR_DATA31
Definition at32f413_bpr.h:97
BPR_DATA8
@ BPR_DATA8
Definition at32f413_bpr.h:74
BPR_DATA25
@ BPR_DATA25
Definition at32f413_bpr.h:91
BPR_DATA39
@ BPR_DATA39
Definition at32f413_bpr.h:105
BPR_DATA7
@ BPR_DATA7
Definition at32f413_bpr.h:73
BPR_DATA12
@ BPR_DATA12
Definition at32f413_bpr.h:78
BPR_DATA29
@ BPR_DATA29
Definition at32f413_bpr.h:95
BPR_DATA19
@ BPR_DATA19
Definition at32f413_bpr.h:85
BPR_DATA1
@ BPR_DATA1
Definition at32f413_bpr.h:67
BPR_DATA36
@ BPR_DATA36
Definition at32f413_bpr.h:102
BPR_DATA9
@ BPR_DATA9
Definition at32f413_bpr.h:75
BPR_DATA10
@ BPR_DATA10
Definition at32f413_bpr.h:76
BPR_DATA27
@ BPR_DATA27
Definition at32f413_bpr.h:93
BPR_DATA20
@ BPR_DATA20
Definition at32f413_bpr.h:86
BPR_DATA38
@ BPR_DATA38
Definition at32f413_bpr.h:104
BPR_DATA37
@ BPR_DATA37
Definition at32f413_bpr.h:103
BPR_DATA41
@ BPR_DATA41
Definition at32f413_bpr.h:107
BPR_DATA13
@ BPR_DATA13
Definition at32f413_bpr.h:79
BPR_DATA4
@ BPR_DATA4
Definition at32f413_bpr.h:70
BPR_DATA32
@ BPR_DATA32
Definition at32f413_bpr.h:98
BPR_DATA16
@ BPR_DATA16
Definition at32f413_bpr.h:82
BPR_DATA11
@ BPR_DATA11
Definition at32f413_bpr.h:77
BPR_DATA24
@ BPR_DATA24
Definition at32f413_bpr.h:90
BPR_DATA23
@ BPR_DATA23
Definition at32f413_bpr.h:89
BPR_DATA5
@ BPR_DATA5
Definition at32f413_bpr.h:71
BPR_DATA18
@ BPR_DATA18
Definition at32f413_bpr.h:84
BPR_DATA17
@ BPR_DATA17
Definition at32f413_bpr.h:83
BPR_DATA42
@ BPR_DATA42
Definition at32f413_bpr.h:108
BPR_DATA21
@ BPR_DATA21
Definition at32f413_bpr.h:87
BPR_DATA33
@ BPR_DATA33
Definition at32f413_bpr.h:99
BPR_DATA40
@ BPR_DATA40
Definition at32f413_bpr.h:106
BPR_DATA30
@ BPR_DATA30
Definition at32f413_bpr.h:96
BPR_DATA2
@ BPR_DATA2
Definition at32f413_bpr.h:68
BPR_DATA14
@ BPR_DATA14
Definition at32f413_bpr.h:80
BPR_DATA15
@ BPR_DATA15
Definition at32f413_bpr.h:81
BPR_DATA3
@ BPR_DATA3
Definition at32f413_bpr.h:69
BPR_DATA22
@ BPR_DATA22
Definition at32f413_bpr.h:88
BPR_DATA34
@ BPR_DATA34
Definition at32f413_bpr.h:100
BPR_DATA35
@ BPR_DATA35
Definition at32f413_bpr.h:101
BPR_DATA6
@ BPR_DATA6
Definition at32f413_bpr.h:72

Definition at line 39 of file project/at_start_f413/examples/bpr/bpr_data/src/main.c.

Referenced by bpr_reg_check(), and bpr_reg_write().


AT32F413 Firmwary Library: BPR_tamper

Macros | Functions | Variables
BPR_tamper
AT32F413_periph_examples

Macros

#define BPR_DR_NUMBER 42

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | TAMPER_IRQHandler (void)
this function handles tamper interrupt request.
void | bpr_reg_write (void)
write data to bpr dt registers.
uint8_t | bpr_reg_check (void)
checks if the bpr dt registers values are correct or not.
uint32_t | bpr_reg_judge (void)
checks if the bpr dt registers are reset or not.
int | main (void)
main function.

Variables

bpr_data_type bpr_addr_tab [42]

Detailed Description

Macro Definition Documentation

◆ BPR_DR_NUMBER

#define BPR_DR_NUMBER 42

Definition at line 37 of file project/at_start_f413/examples/bpr/tamper/src/main.c.

Referenced by bpr_reg_check(), bpr_reg_judge(), and bpr_reg_write().

Function Documentation

◆ bpr_reg_check()

uint8_t bpr_reg_check ( void )

checks if the bpr dt registers values are correct or not.

Parameters
none.
Return values
- TRUE: all bpr dt registers values are correct
  • FALSE: number of the bpr register which value is not correct

Definition at line 79 of file project/at_start_f413/examples/bpr/tamper/src/main.c.

Referenced by main().

◆ bpr_reg_judge()

uint32_t bpr_reg_judge ( void )

checks if the bpr dt registers are reset or not.

Parameters
none
Return values
- 0: all bpr dt registers are reset
  • value different from 0: number of the first bpr register not reset

Definition at line 102 of file project/at_start_f413/examples/bpr/tamper/src/main.c.

Referenced by TAMPER_IRQHandler().

◆ bpr_reg_write()

void bpr_reg_write ( void )

write data to bpr dt registers.

Parameters
none.
Return values
none

Definition at line 61 of file project/at_start_f413/examples/bpr/tamper/src/main.c.

Referenced by main().

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 80 of file project/at_start_f413/examples/bpr/tamper/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 115 of file project/at_start_f413/examples/bpr/tamper/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 54 of file project/at_start_f413/examples/bpr/tamper/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< bpr tamper event flag

Definition at line 122 of file project/at_start_f413/examples/bpr/tamper/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 67 of file project/at_start_f413/examples/bpr/tamper/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 45 of file project/at_start_f413/examples/bpr/tamper/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 124 of file project/at_start_f413/examples/bpr/tamper/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 106 of file project/at_start_f413/examples/bpr/tamper/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 133 of file project/at_start_f413/examples/bpr/tamper/src/at32f413_int.c.

◆ TAMPER_IRQHandler()

void TAMPER_IRQHandler ( void )

this function handles tamper interrupt request.

Parameters
none
Return values
none

< bpr tamper interrupt flag

< bpr tamper interrupt flag

< bpr tamper event flag

Definition at line 142 of file project/at_start_f413/examples/bpr/tamper/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 93 of file project/at_start_f413/examples/bpr/tamper/src/at32f413_int.c.

Variable Documentation

◆ bpr_addr_tab

bpr_data_type bpr_addr_tab[42]
Initial value:
=
{
BPR_DATA1, BPR_DATA2, BPR_DATA3, BPR_DATA4, BPR_DATA5,
BPR_DATA6, BPR_DATA7, BPR_DATA8, BPR_DATA9, BPR_DATA10,
BPR_DATA11, BPR_DATA12, BPR_DATA13, BPR_DATA14, BPR_DATA15,
BPR_DATA16, BPR_DATA17, BPR_DATA18, BPR_DATA19, BPR_DATA20,
BPR_DATA21, BPR_DATA22, BPR_DATA23, BPR_DATA24, BPR_DATA25,
BPR_DATA26, BPR_DATA27, BPR_DATA28, BPR_DATA29, BPR_DATA30,
BPR_DATA31, BPR_DATA32, BPR_DATA33, BPR_DATA34, BPR_DATA35,
BPR_DATA36, BPR_DATA37, BPR_DATA38, BPR_DATA39, BPR_DATA40,
BPR_DATA41, BPR_DATA42
}
BPR_DATA26
@ BPR_DATA26
Definition at32f413_bpr.h:92
BPR_DATA28
@ BPR_DATA28
Definition at32f413_bpr.h:94
BPR_DATA31
@ BPR_DATA31
Definition at32f413_bpr.h:97
BPR_DATA8
@ BPR_DATA8
Definition at32f413_bpr.h:74
BPR_DATA25
@ BPR_DATA25
Definition at32f413_bpr.h:91
BPR_DATA39
@ BPR_DATA39
Definition at32f413_bpr.h:105
BPR_DATA7
@ BPR_DATA7
Definition at32f413_bpr.h:73
BPR_DATA12
@ BPR_DATA12
Definition at32f413_bpr.h:78
BPR_DATA29
@ BPR_DATA29
Definition at32f413_bpr.h:95
BPR_DATA19
@ BPR_DATA19
Definition at32f413_bpr.h:85
BPR_DATA1
@ BPR_DATA1
Definition at32f413_bpr.h:67
BPR_DATA36
@ BPR_DATA36
Definition at32f413_bpr.h:102
BPR_DATA9
@ BPR_DATA9
Definition at32f413_bpr.h:75
BPR_DATA10
@ BPR_DATA10
Definition at32f413_bpr.h:76
BPR_DATA27
@ BPR_DATA27
Definition at32f413_bpr.h:93
BPR_DATA20
@ BPR_DATA20
Definition at32f413_bpr.h:86
BPR_DATA38
@ BPR_DATA38
Definition at32f413_bpr.h:104
BPR_DATA37
@ BPR_DATA37
Definition at32f413_bpr.h:103
BPR_DATA41
@ BPR_DATA41
Definition at32f413_bpr.h:107
BPR_DATA13
@ BPR_DATA13
Definition at32f413_bpr.h:79
BPR_DATA4
@ BPR_DATA4
Definition at32f413_bpr.h:70
BPR_DATA32
@ BPR_DATA32
Definition at32f413_bpr.h:98
BPR_DATA16
@ BPR_DATA16
Definition at32f413_bpr.h:82
BPR_DATA11
@ BPR_DATA11
Definition at32f413_bpr.h:77
BPR_DATA24
@ BPR_DATA24
Definition at32f413_bpr.h:90
BPR_DATA23
@ BPR_DATA23
Definition at32f413_bpr.h:89
BPR_DATA5
@ BPR_DATA5
Definition at32f413_bpr.h:71
BPR_DATA18
@ BPR_DATA18
Definition at32f413_bpr.h:84
BPR_DATA17
@ BPR_DATA17
Definition at32f413_bpr.h:83
BPR_DATA42
@ BPR_DATA42
Definition at32f413_bpr.h:108
BPR_DATA21
@ BPR_DATA21
Definition at32f413_bpr.h:87
BPR_DATA33
@ BPR_DATA33
Definition at32f413_bpr.h:99
BPR_DATA40
@ BPR_DATA40
Definition at32f413_bpr.h:106
BPR_DATA30
@ BPR_DATA30
Definition at32f413_bpr.h:96
BPR_DATA2
@ BPR_DATA2
Definition at32f413_bpr.h:68
BPR_DATA14
@ BPR_DATA14
Definition at32f413_bpr.h:80
BPR_DATA15
@ BPR_DATA15
Definition at32f413_bpr.h:81
BPR_DATA3
@ BPR_DATA3
Definition at32f413_bpr.h:69
BPR_DATA22
@ BPR_DATA22
Definition at32f413_bpr.h:88
BPR_DATA34
@ BPR_DATA34
Definition at32f413_bpr.h:100
BPR_DATA35
@ BPR_DATA35
Definition at32f413_bpr.h:101
BPR_DATA6
@ BPR_DATA6
Definition at32f413_bpr.h:72

Definition at line 39 of file project/at_start_f413/examples/bpr/tamper/src/main.c.

Referenced by bpr_reg_check(), bpr_reg_judge(), and bpr_reg_write().


AT32F413 Firmwary Library: CAN_communication_mode

Functions
CAN_communication_mode
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
static void | can_gpio_config (void)
can gpio config
error_status | can_configuration (void)
can configiguration.
static void | can_transmit_data (void)
can transmit data
void | USBFS_L_CAN1_RX0_IRQHandler (void)
can1 interrupt function rx0
void | CAN1_SE_IRQHandler (void)
can1 interrupt function se
int | main (void)
main function.

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 78 of file project/at_start_f413/examples/can/communication_mode/src/at32f413_int.c.

◆ CAN1_SE_IRQHandler()

void CAN1_SE_IRQHandler ( void )

can1 interrupt function se

Parameters
none
Return values
none

< error type record flag

< error type record flag

Definition at line 182 of file project/at_start_f413/examples/can/communication_mode/src/main.c.

◆ can_configuration()

error_status can_configuration ( void )

can configiguration.

Parameters
none
Return values
the result of can_configuration this parameter can be one of the following values: SUCCESS or ERROR

< high speed external crystal stable flag

< receive fifo 0 message interrupt

< error type record interrupt

< error occur interrupt

Definition at line 73 of file project/at_start_f413/examples/can/communication_mode/src/main.c.

Referenced by main().

◆ can_gpio_config()

static void can_gpio_config ( void )
static

can gpio config

Parameters
none
Return values
none

< can_rx(pb8), can_tx(pb9)

< gpio pins number 9

< gpio pins number 8

Definition at line 42 of file project/at_start_f413/examples/can/communication_mode/src/main.c.

Referenced by main().

◆ can_transmit_data()

static void can_transmit_data ( void )
static

can transmit data

Parameters
none
Return values
none

Definition at line 138 of file project/at_start_f413/examples/can/communication_mode/src/main.c.

Referenced by main().

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 113 of file project/at_start_f413/examples/can/communication_mode/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 52 of file project/at_start_f413/examples/can/communication_mode/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 203 of file project/at_start_f413/examples/can/communication_mode/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 65 of file project/at_start_f413/examples/can/communication_mode/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 43 of file project/at_start_f413/examples/can/communication_mode/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 122 of file project/at_start_f413/examples/can/communication_mode/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 104 of file project/at_start_f413/examples/can/communication_mode/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 131 of file project/at_start_f413/examples/can/communication_mode/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 91 of file project/at_start_f413/examples/can/communication_mode/src/at32f413_int.c.

◆ USBFS_L_CAN1_RX0_IRQHandler()

void USBFS_L_CAN1_RX0_IRQHandler ( void )

can1 interrupt function rx0

Parameters
none
Return values
none

< receive fifo 0 message num flag

Definition at line 164 of file project/at_start_f413/examples/can/communication_mode/src/main.c.


AT32F413 Firmwary Library: CAN_filter

Macros | Functions | Variables
CAN_filter
AT32F413_periph_examples

Macros

#define | FILTER_EXT_ID1 ((uint32_t)0x18F5F100)
#define | FILTER_EXT_ID2 ((uint32_t)0x18F5F200)
#define | FILTER_EXT_ID3 ((uint32_t)0x18F5F300)
#define | FILTER_STD_ID1 ((uint16_t)0x04F6)
#define | FILTER_STD_ID2 ((uint16_t)0x04F7)
#define | FILTER_STD_ID3 ((uint16_t)0x04F8)

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
static void | can_gpio_config (void)
can gpio config
error_status | can_configuration (void)
can configiguration.
static void | can_transmit_data (void)
can transmit data
void | USBFS_L_CAN1_RX0_IRQHandler (void)
can1 interrupt function rx0
void | CAN1_SE_IRQHandler (void)
can1 interrupt function se
int | main (void)
main function.

Variables

uint8_t test_result = 0

Detailed Description

Macro Definition Documentation

◆ FILTER_EXT_ID1

#define FILTER_EXT_ID1 ((uint32_t)0x18F5F100)

Definition at line 38 of file project/at_start_f413/examples/can/filter/src/main.c.

Referenced by can_configuration(), can_transmit_data(), and USBFS_L_CAN1_RX0_IRQHandler().

◆ FILTER_EXT_ID2

#define FILTER_EXT_ID2 ((uint32_t)0x18F5F200)

Definition at line 39 of file project/at_start_f413/examples/can/filter/src/main.c.

Referenced by can_configuration(), can_transmit_data(), and USBFS_L_CAN1_RX0_IRQHandler().

◆ FILTER_EXT_ID3

#define FILTER_EXT_ID3 ((uint32_t)0x18F5F300)

Definition at line 40 of file project/at_start_f413/examples/can/filter/src/main.c.

Referenced by can_transmit_data().

◆ FILTER_STD_ID1

#define FILTER_STD_ID1 ((uint16_t)0x04F6)

Definition at line 43 of file project/at_start_f413/examples/can/filter/src/main.c.

Referenced by can_configuration(), can_transmit_data(), and USBFS_L_CAN1_RX0_IRQHandler().

◆ FILTER_STD_ID2

#define FILTER_STD_ID2 ((uint16_t)0x04F7)

Definition at line 44 of file project/at_start_f413/examples/can/filter/src/main.c.

Referenced by can_configuration(), can_transmit_data(), and USBFS_L_CAN1_RX0_IRQHandler().

◆ FILTER_STD_ID3

#define FILTER_STD_ID3 ((uint16_t)0x04F8)

Definition at line 45 of file project/at_start_f413/examples/can/filter/src/main.c.

Referenced by can_transmit_data().

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 78 of file project/at_start_f413/examples/can/filter/src/at32f413_int.c.

◆ CAN1_SE_IRQHandler()

void CAN1_SE_IRQHandler ( void )

can1 interrupt function se

Parameters
none
Return values
none

< error type record flag

< error type record flag

Definition at line 304 of file project/at_start_f413/examples/can/filter/src/main.c.

◆ can_configuration()

error_status can_configuration ( void )

can configiguration.

Parameters
none
Return values
the result of can_configuration this parameter can be one of the following values: SUCCESS or ERROR

< high speed external crystal stable flag

< receive fifo 0 message interrupt

< error type record interrupt

< error occur interrupt

Definition at line 86 of file project/at_start_f413/examples/can/filter/src/main.c.

Referenced by main().

◆ can_gpio_config()

static void can_gpio_config ( void )
static

can gpio config

Parameters
none
Return values
none

< can_rx(pb8), can_tx(pb9)

< gpio pins number 9

< gpio pins number 8

Definition at line 53 of file project/at_start_f413/examples/can/filter/src/main.c.

Referenced by main().

◆ can_transmit_data()

static void can_transmit_data ( void )
static

can transmit data

Parameters
none
Return values
none

Definition at line 163 of file project/at_start_f413/examples/can/filter/src/main.c.

Referenced by main().

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 113 of file project/at_start_f413/examples/can/filter/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 52 of file project/at_start_f413/examples/can/filter/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 325 of file project/at_start_f413/examples/can/filter/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 65 of file project/at_start_f413/examples/can/filter/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 43 of file project/at_start_f413/examples/can/filter/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 122 of file project/at_start_f413/examples/can/filter/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 104 of file project/at_start_f413/examples/can/filter/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 131 of file project/at_start_f413/examples/can/filter/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 91 of file project/at_start_f413/examples/can/filter/src/at32f413_int.c.

◆ USBFS_L_CAN1_RX0_IRQHandler()

void USBFS_L_CAN1_RX0_IRQHandler ( void )

can1 interrupt function rx0

Parameters
none
Return values
none

< receive fifo 0 message num flag

Definition at line 276 of file project/at_start_f413/examples/can/filter/src/main.c.

Variable Documentation

◆ test_result

uint8_t test_result = 0

Definition at line 47 of file project/at_start_f413/examples/can/filter/src/main.c.

Referenced by main(), and USBFS_L_CAN1_RX0_IRQHandler().


AT32F413 Firmwary Library: CAN_loopback_mode

Functions
CAN_loopback_mode
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
static void | can_gpio_config (void)
can gpio config
error_status | can_configuration (void)
can configiguration.
static void | can_transmit_data (void)
can transmit data
void | USBFS_L_CAN1_RX0_IRQHandler (void)
can1 interrupt function rx0
void | CAN1_SE_IRQHandler (void)
can1 interrupt function se
int | main (void)
main function.

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 78 of file project/at_start_f413/examples/can/loopback_mode/src/at32f413_int.c.

◆ CAN1_SE_IRQHandler()

void CAN1_SE_IRQHandler ( void )

can1 interrupt function se

Parameters
none
Return values
none

< error type record flag

< error type record flag

Definition at line 180 of file project/at_start_f413/examples/can/loopback_mode/src/main.c.

◆ can_configuration()

error_status can_configuration ( void )

can configiguration.

Parameters
none
Return values
the result of can_configuration this parameter can be one of the following values: SUCCESS or ERROR

< high speed external crystal stable flag

< receive fifo 0 message interrupt

< error type record interrupt

< error occur interrupt

Definition at line 73 of file project/at_start_f413/examples/can/loopback_mode/src/main.c.

Referenced by main().

◆ can_gpio_config()

static void can_gpio_config ( void )
static

can gpio config

Parameters
none
Return values
none

< can_rx(pb8), can_tx(pb9)

< gpio pins number 9

< gpio pins number 8

Definition at line 42 of file project/at_start_f413/examples/can/loopback_mode/src/main.c.

Referenced by main().

◆ can_transmit_data()

static void can_transmit_data ( void )
static

can transmit data

Parameters
none
Return values
none

Definition at line 138 of file project/at_start_f413/examples/can/loopback_mode/src/main.c.

Referenced by main().

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 113 of file project/at_start_f413/examples/can/loopback_mode/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 52 of file project/at_start_f413/examples/can/loopback_mode/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 201 of file project/at_start_f413/examples/can/loopback_mode/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 65 of file project/at_start_f413/examples/can/loopback_mode/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 43 of file project/at_start_f413/examples/can/loopback_mode/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 122 of file project/at_start_f413/examples/can/loopback_mode/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 104 of file project/at_start_f413/examples/can/loopback_mode/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 131 of file project/at_start_f413/examples/can/loopback_mode/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 91 of file project/at_start_f413/examples/can/loopback_mode/src/at32f413_int.c.

◆ USBFS_L_CAN1_RX0_IRQHandler()

void USBFS_L_CAN1_RX0_IRQHandler ( void )

can1 interrupt function rx0

Parameters
none
Return values
none

< receive fifo 0 message num flag

Definition at line 164 of file project/at_start_f413/examples/can/loopback_mode/src/main.c.


AT32F413 Firmwary Library: CORTEX_m4_bit_band

Macros | Functions | Variables
CORTEX_m4_bit_band
AT32F413_periph_examples

Macros

#define | RAM_BASE 0x20000000
#define | RAM_BITBAND_BASE 0x22000000
#define | VARIABLES_RESET_BIT(variables_addr, bit_number)
#define | VARIABLES_SET_BIT(variables_addr, bit_number)
#define | VARIABLES_GET_BIT(variables_addr, bit_number)
#define | PERIPHERAL_BASE 0x40000000
#define | PERIPHERAL_BITBAND_BASE 0x42000000
#define | PERIPHERAL_RESET_BIT(peripheral_addr, bit_number)
#define | PERIPHERAL_SET_BIT(peripheral_addr, bit_number)

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | result_error (void)
led4 flick for error.
int | main (void)
main function.

Variables

__IO uint32_t | variables
__IO uint32_t | variables_addr = 0
__IO uint32_t | variables_bit_val = 0

Detailed Description

Macro Definition Documentation

◆ PERIPHERAL_BASE

#define PERIPHERAL_BASE 0x40000000

Definition at line 52 of file project/at_start_f413/examples/cortex_m4/bit_band/src/main.c.

◆ PERIPHERAL_BITBAND_BASE

#define PERIPHERAL_BITBAND_BASE 0x42000000

Definition at line 53 of file project/at_start_f413/examples/cortex_m4/bit_band/src/main.c.

◆ PERIPHERAL_RESET_BIT

#define PERIPHERAL_RESET_BIT | ( | peripheral_addr,
 |  | bit_number )
Value:
(*(uint32_t *)(PERIPHERAL_BITBAND_BASE + ((peripheral_addr - PERIPHERAL_BASE) * 32) + ((bit_number) * 4)) = 0)
PERIPHERAL_BASE
#define PERIPHERAL_BASE
Definition project/at_start_f413/examples/cortex_m4/bit_band/src/main.c:52
PERIPHERAL_BITBAND_BASE
#define PERIPHERAL_BITBAND_BASE
Definition project/at_start_f413/examples/cortex_m4/bit_band/src/main.c:53

Definition at line 55 of file project/at_start_f413/examples/cortex_m4/bit_band/src/main.c.

Referenced by main().

◆ PERIPHERAL_SET_BIT

#define PERIPHERAL_SET_BIT | ( | peripheral_addr,
 |  | bit_number )
Value:
(*(uint32_t *)(PERIPHERAL_BITBAND_BASE + ((peripheral_addr - PERIPHERAL_BASE) * 32) + ((bit_number) * 4)) = 1)

Definition at line 58 of file project/at_start_f413/examples/cortex_m4/bit_band/src/main.c.

Referenced by main().

◆ RAM_BASE

#define RAM_BASE 0x20000000

Definition at line 39 of file project/at_start_f413/examples/cortex_m4/bit_band/src/main.c.

◆ RAM_BITBAND_BASE

#define RAM_BITBAND_BASE 0x22000000

Definition at line 40 of file project/at_start_f413/examples/cortex_m4/bit_band/src/main.c.

◆ VARIABLES_GET_BIT

#define VARIABLES_GET_BIT | ( | variables_addr,
 |  | bit_number )
Value:
(*(uint32_t *)(RAM_BITBAND_BASE + ((variables_addr - RAM_BASE) * 32) + ((bit_number) * 4)))
variables_addr
__IO uint32_t variables_addr
Definition project/at_start_f413/examples/cortex_m4/bit_band/src/main.c:61
RAM_BASE
#define RAM_BASE
Definition project/at_start_f413/examples/cortex_m4/bit_band/src/main.c:39
RAM_BITBAND_BASE
#define RAM_BITBAND_BASE
Definition project/at_start_f413/examples/cortex_m4/bit_band/src/main.c:40

Definition at line 48 of file project/at_start_f413/examples/cortex_m4/bit_band/src/main.c.

Referenced by main().

◆ VARIABLES_RESET_BIT

#define VARIABLES_RESET_BIT | ( | variables_addr,
 |  | bit_number )
Value:
(*(uint32_t *)(RAM_BITBAND_BASE + ((variables_addr - RAM_BASE) * 32) + ((bit_number) * 4)) = 0)

Definition at line 42 of file project/at_start_f413/examples/cortex_m4/bit_band/src/main.c.

Referenced by main().

◆ VARIABLES_SET_BIT

#define VARIABLES_SET_BIT | ( | variables_addr,
 |  | bit_number )
Value:
(*(uint32_t *)(RAM_BITBAND_BASE + ((variables_addr - RAM_BASE) * 32) + ((bit_number) * 4)) = 1)

Definition at line 45 of file project/at_start_f413/examples/cortex_m4/bit_band/src/main.c.

Referenced by main().

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 78 of file project/at_start_f413/examples/cortex_m4/bit_band/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 113 of file project/at_start_f413/examples/cortex_m4/bit_band/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 52 of file project/at_start_f413/examples/cortex_m4/bit_band/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 82 of file project/at_start_f413/examples/cortex_m4/bit_band/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 65 of file project/at_start_f413/examples/cortex_m4/bit_band/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 43 of file project/at_start_f413/examples/cortex_m4/bit_band/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 122 of file project/at_start_f413/examples/cortex_m4/bit_band/src/at32f413_int.c.

◆ result_error()

void result_error ( void )

led4 flick for error.

Parameters
none
Return values
none

Definition at line 68 of file project/at_start_f413/examples/cortex_m4/bit_band/src/main.c.

Referenced by main().

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 104 of file project/at_start_f413/examples/cortex_m4/bit_band/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 131 of file project/at_start_f413/examples/cortex_m4/bit_band/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 91 of file project/at_start_f413/examples/cortex_m4/bit_band/src/at32f413_int.c.

Variable Documentation

◆ variables

__IO uint32_t variables

Definition at line 61 of file project/at_start_f413/examples/cortex_m4/bit_band/src/main.c.

Referenced by main().

◆ variables_addr

__IO uint32_t variables_addr = 0

Definition at line 61 of file project/at_start_f413/examples/cortex_m4/bit_band/src/main.c.

Referenced by main().

◆ variables_bit_val

__IO uint32_t variables_bit_val = 0

Definition at line 61 of file project/at_start_f413/examples/cortex_m4/bit_band/src/main.c.


AT32F413 Firmwary Library: CORTEX_m4_cmsis_dsp

Macros | Functions | Variables
CORTEX_m4_cmsis_dsp
AT32F413_periph_examples

Macros

#define | USE_STATIC_INIT
#define | TEST_LENGTH_SAMPLES (20*4)
#define | NUMSTUDENTS 20
#define | NUMSUBJECTS 4

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
int32_t | main ()
main function.

Variables

const float32_t | testMarks_f32 [(20 *4)]
const float32_t | testUnity_f32 [4]
static float32_t | testOutput [(20 *4)]
uint32_t | numStudents = 20
uint32_t | numSubjects = 4
float32_t | max_marks
float32_t | min_marks
float32_t | mean
float32_t | std
float32_t | var
uint32_t | student_num

Detailed Description

Macro Definition Documentation

◆ NUMSTUDENTS

#define NUMSTUDENTS 20

Definition at line 82 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c.

Referenced by main().

◆ NUMSUBJECTS

#define NUMSUBJECTS 4

Definition at line 83 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c.

Referenced by main().

◆ TEST_LENGTH_SAMPLES

#define TEST_LENGTH_SAMPLES (20*4)

Definition at line 42 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c.

◆ USE_STATIC_INIT

#define USE_STATIC_INIT

Definition at line 38 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c.

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 78 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 113 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 52 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/at32f413_int.c.

◆ main()

int32_t main ( void )

main function.

Parameters
none
Return values
none

Definition at line 97 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 65 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 43 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 122 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 104 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 131 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 91 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/at32f413_int.c.

Variable Documentation

◆ max_marks

float32_t max_marks

Definition at line 89 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c.

Referenced by main().

◆ mean

float32_t mean

Definition at line 89 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c.

Referenced by main().

◆ min_marks

float32_t min_marks

Definition at line 89 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c.

Referenced by main().

◆ numStudents

uint32_t numStudents = 20

Definition at line 87 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c.

Referenced by main().

◆ numSubjects

uint32_t numSubjects = 4

Definition at line 88 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c.

Referenced by main().

◆ std

float32_t std

Definition at line 89 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c.

Referenced by main().

◆ student_num

uint32_t student_num

Definition at line 90 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c.

Referenced by main().

◆ testMarks_f32

const float32_t testMarks_f32[(20 *4)]
Initial value:
=
{
42.000000, 37.000000, 81.000000, 28.000000,
83.000000, 72.000000, 36.000000, 38.000000,
32.000000, 51.000000, 63.000000, 64.000000,
97.000000, 82.000000, 95.000000, 90.000000,
66.000000, 51.000000, 54.000000, 42.000000,
67.000000, 56.000000, 45.000000, 57.000000,
67.000000, 69.000000, 35.000000, 52.000000,
29.000000, 81.000000, 58.000000, 47.000000,
38.000000, 76.000000, 100.000000, 29.000000,
33.000000, 47.000000, 29.000000, 50.000000,
34.000000, 41.000000, 61.000000, 46.000000,
52.000000, 50.000000, 48.000000, 36.000000,
47.000000, 55.000000, 44.000000, 40.000000,
100.000000, 94.000000, 84.000000, 37.000000,
32.000000, 71.000000, 47.000000, 77.000000,
31.000000, 50.000000, 49.000000, 35.000000,
63.000000, 67.000000, 40.000000, 31.000000,
29.000000, 68.000000, 61.000000, 38.000000,
31.000000, 28.000000, 28.000000, 76.000000,
55.000000, 33.000000, 29.000000, 39.000000
}

Definition at line 45 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c.

Referenced by main().

◆ testOutput

float32_t testOutput[(20 *4)]
static

Definition at line 78 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c.

Referenced by main().

◆ testUnity_f32

const float32_t testUnity_f32[4]
Initial value:
=
{
1.000, 1.000, 1.000, 1.000
}

Definition at line 71 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c.

Referenced by main().

◆ var

float32_t var

Definition at line 89 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: CORTEX_m4_fpu

Topics | Macros | Functions | Variables
CORTEX_m4_fpu
AT32F413_periph_examples

Topics

JULIA_fpu_functions

Macros

#define | ITERATION 200
#define | REAL_CONSTANT (0.285f)
#define | IMG_CONSTANT (0.01f)
#define | SCREEN_X_SIZE ((uint16_t)160)
#define | SCREEN_Y_SIZE ((uint16_t)120)
#define | ZOOM ((uint16_t)100)

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | generate_julia_fpu (uint16_t size_x, uint16_t size_y, uint16_t offset_x, uint16_t offset_y, uint16_t zoom, uint8_t *buffer)
julia calculation test with fpu option enable or disable
int | main (void)
main function.

Variables

uint8_t buffer [((uint16_t) 160) *((uint16_t) 120)]

Detailed Description

Macro Definition Documentation

◆ IMG_CONSTANT

#define IMG_CONSTANT (0.01f)

Definition at line 46 of file julia_fpu.h.

Referenced by generate_julia_fpu().

◆ ITERATION

#define ITERATION 200

Definition at line 44 of file julia_fpu.h.

Referenced by generate_julia_fpu().

◆ REAL_CONSTANT

#define REAL_CONSTANT (0.285f)

Definition at line 45 of file julia_fpu.h.

Referenced by generate_julia_fpu().

◆ SCREEN_X_SIZE

#define SCREEN_X_SIZE ((uint16_t)160)

Definition at line 38 of file project/at_start_f413/examples/cortex_m4/fpu/src/main.c.

Referenced by main().

◆ SCREEN_Y_SIZE

#define SCREEN_Y_SIZE ((uint16_t)120)

Definition at line 39 of file project/at_start_f413/examples/cortex_m4/fpu/src/main.c.

Referenced by main().

◆ ZOOM

#define ZOOM ((uint16_t)100)

Definition at line 40 of file project/at_start_f413/examples/cortex_m4/fpu/src/main.c.

Referenced by main().

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 79 of file project/at_start_f413/examples/cortex_m4/fpu/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 114 of file project/at_start_f413/examples/cortex_m4/fpu/src/at32f413_int.c.

◆ generate_julia_fpu()

void generate_julia_fpu | ( | uint16_t | size_x,
 |  | uint16_t | size_y,
 |  | uint16_t | offset_x,
 |  | uint16_t | offset_y,
 |  | uint16_t | zoom,
 |  | uint8_t * | buffer )

julia calculation test with fpu option enable or disable

Parameters
size_x | width in pixel
size_y | height in pixel
offset_x | x offset for starting point
offset_y | y offset for starting point
zoom | iteration zoom ratio
buffer | pointer to output buffer where values are stored
Return values
none

Definition at line 47 of file julia_fpu.c.

Referenced by main().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 53 of file project/at_start_f413/examples/cortex_m4/fpu/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 49 of file project/at_start_f413/examples/cortex_m4/fpu/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 66 of file project/at_start_f413/examples/cortex_m4/fpu/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 44 of file project/at_start_f413/examples/cortex_m4/fpu/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 123 of file project/at_start_f413/examples/cortex_m4/fpu/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 105 of file project/at_start_f413/examples/cortex_m4/fpu/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 132 of file project/at_start_f413/examples/cortex_m4/fpu/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 92 of file project/at_start_f413/examples/cortex_m4/fpu/src/at32f413_int.c.

Variable Documentation

◆ buffer

uint8_t buffer[((uint16_t) 160) *((uint16_t) 120)]

Definition at line 42 of file project/at_start_f413/examples/cortex_m4/fpu/src/main.c.

Referenced by audio_codec_mic_get_data(), bot_scsi_send_data(), generate_julia_fpu(), main(), memset16_buffer(), usbd_ctrl_recv(), usbd_ctrl_send(), usbd_ept_recv(), and usbd_ept_send().


AT32F413 Firmwary Library: JULIA_fpu_functions

Functions
JULIA_fpu_functions
AT32F413_periph_examples » CORTEX_m4_fpu

Functions

void generate_julia_fpu (uint16_t size_x, uint16_t size_y, uint16_t offset_x, uint16_t offset_y, uint16_t zoom, uint8_t *buffer)
julia calculation test with fpu option enable or disable

Detailed Description

Function Documentation

◆ generate_julia_fpu()

void generate_julia_fpu | ( | uint16_t | size_x,
 |  | uint16_t | size_y,
 |  | uint16_t | offset_x,
 |  | uint16_t | offset_y,
 |  | uint16_t | zoom,
 |  | uint8_t * | buffer )

julia calculation test with fpu option enable or disable

Parameters
size_x | width in pixel
size_y | height in pixel
offset_x | x offset for starting point
offset_y | y offset for starting point
zoom | iteration zoom ratio
buffer | pointer to output buffer where values are stored
Return values
none

Definition at line 47 of file julia_fpu.c.

Referenced by main().


AT32F413 Firmwary Library: CORTEX_m4_systick_interrupt

Macros | Functions
CORTEX_m4_systick_interrupt
AT32F413_periph_examples

Macros

#define | MS_TICK (system_core_clock / 1000U)
#define | DELAY 200 /* 200 ms ticks */

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | systick_handler (void)
systick interrupt handler.
static uint32_t | systick_interrupt_config (uint32_t ticks)
config systick and enable interrupt.
int | main (void)
main function.

Detailed Description

Macro Definition Documentation

◆ DELAY

#define DELAY 200 /* 200 ms ticks */

Definition at line 38 of file project/at_start_f413/examples/cortex_m4/systick_interrupt/src/main.c.

Referenced by systick_handler().

◆ MS_TICK

#define MS_TICK (system_core_clock / 1000U)

Definition at line 37 of file project/at_start_f413/examples/cortex_m4/systick_interrupt/src/main.c.

Referenced by main().

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 79 of file project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 114 of file project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 53 of file project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 84 of file project/at_start_f413/examples/cortex_m4/systick_interrupt/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 66 of file project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 44 of file project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 123 of file project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 105 of file project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 132 of file project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_int.c.

◆ systick_handler()

void systick_handler ( void )

systick interrupt handler.

Parameters
none
Return values
none

Definition at line 45 of file project/at_start_f413/examples/cortex_m4/systick_interrupt/src/main.c.

Referenced by SysTick_Handler().

◆ systick_interrupt_config()

static uint32_t systick_interrupt_config ( uint32_t ticks )
static

config systick and enable interrupt.

Parameters
none
Return values
none

< at32 uses 4 bits for the priority levels

Definition at line 64 of file project/at_start_f413/examples/cortex_m4/systick_interrupt/src/main.c.

Referenced by main().

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 92 of file project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_int.c.


AT32F413 Firmwary Library: CRC_calculation

Macros | Functions | Variables
CRC_calculation
AT32F413_periph_examples

Macros

#define BUFFER_SIZE 120

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
int | main (void)
main function.

Variables

static const uint32_t | data_buffer [120]
__IO uint32_t | crc_value = 0

Detailed Description

Macro Definition Documentation

◆ BUFFER_SIZE

#define BUFFER_SIZE 120

Definition at line 37 of file project/at_start_f413/examples/crc/calculation/src/main.c.

Referenced by main().

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/crc/calculation/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/crc/calculation/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/crc/calculation/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 70 of file project/at_start_f413/examples/crc/calculation/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/crc/calculation/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/crc/calculation/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/crc/calculation/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/crc/calculation/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/crc/calculation/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/crc/calculation/src/at32f413_int.c.

Variable Documentation

◆ crc_value

__IO uint32_t crc_value = 0

Definition at line 63 of file project/at_start_f413/examples/crc/calculation/src/main.c.

Referenced by iap_crc(), and main().

◆ data_buffer

const uint32_t data_buffer[120]
static
Initial value:
=
{
0xc33dd31c, 0xe37ff35e, 0x129022f3, 0x32d24235, 0x52146277, 0x7256b5ea,
0x4a755a54, 0x6a377a16, 0x0af11ad0, 0x2ab33a92, 0xed0fdd6c, 0xcd4dbdaa,
0xbb3bab1a, 0x6ca67c87, 0x5cc52c22, 0x3c030c60, 0x1c41edae, 0xfd8fcdec,
0xad8b9de8, 0x8dc97c26, 0x5c644c45, 0x3ca22c83, 0x1ce00cc1, 0xef1fff3e,
0x95a88589, 0xf56ee54f, 0xd52cc50d, 0x34e224c3, 0x04817466, 0x64475424,
0x78066827, 0x18c008e1, 0x28a3cb7d, 0xdb5ceb3f, 0xfb1e8bf9, 0x9bd8abbb,
0xdf7caf9b, 0xbfba8fd9, 0x9ff86e17, 0x7e364e55, 0x2e933eb2, 0x0ed11ef0,
0xa35ad3bd, 0xc39cf3ff, 0xe3de2462, 0x34430420, 0x64e674c7, 0x44a45485,
0xad2abd0b, 0x8d689d49, 0x7e976eb6, 0x5ed54ef4, 0x2e321e51, 0x0e70ff9f,
0xefbedfdd, 0xcffcbf1b, 0x9f598f78, 0x918881a9, 0xb1caa1eb, 0xd10cc12d,
0xe16f1080, 0x00a130c2, 0x20e35004, 0x40257046, 0x83b99398, 0xa3fbb3da,
0x00001021, 0x20423063, 0x408450a5, 0x60c670e7, 0x9129a14a, 0xb16bc18c,
0x569546b4, 0xb75ba77a, 0x97198738, 0xf7dfe7fe, 0xc7bc48c4, 0x58e56886,
0x4405a7db, 0xb7fa8799, 0xe75ff77e, 0xc71dd73c, 0x26d336f2, 0x069116b0,
0x76764615, 0x5634d94c, 0xc96df90e, 0xe92f99c8, 0xb98aa9ab, 0x58444865,
0x78a70840, 0x18612802, 0xc9ccd9ed, 0xe98ef9af, 0x89489969, 0xa90ab92b,
0xd1ade1ce, 0xf1ef1231, 0x32732252, 0x52b54294, 0x72f762d6, 0x93398318,
0xa56ab54b, 0x85289509, 0xf5cfc5ac, 0xd58d3653, 0x26721611, 0x063076d7,
0x8d689d49, 0xf7dfe7fe, 0xe98ef9af, 0x063076d7, 0x93398318, 0xb98aa9ab,
0x4ad47ab7, 0x6a961a71, 0x0a503a33, 0x2a12dbfd, 0xfbbfeb9e, 0x9b798b58
}

Definition at line 39 of file project/at_start_f413/examples/crc/calculation/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: CRM_clock_failure_detection

Functions
CRM_clock_failure_detection
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
static void | clkout_config (void)
clkout configuration.
static void | sclk_192m_hick_config (void)
config sclk 192 mhz with hick clock source.
void | clock_failure_detection_handler (void)
clock failure detection handler.
int | main (void)
main function.

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 80 of file project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_int.c.

◆ clkout_config()

static void clkout_config ( void )
static

clkout configuration.

Parameters
none
Return values
none

< gpio pins number 8

Definition at line 46 of file project/at_start_f413/examples/crm/clock_failure_detection/src/main.c.

Referenced by main(), and sclk_192m_hick_config().

◆ clock_failure_detection_handler()

void clock_failure_detection_handler ( void )

clock failure detection handler.

Parameters
none
Return values
none

< clock failure interrupt ready flag

< clock failure interrupt ready flag

Definition at line 75 of file project/at_start_f413/examples/crm/clock_failure_detection/src/main.c.

Referenced by NMI_Handler().

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 115 of file project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 54 of file project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 170 of file project/at_start_f413/examples/crm/clock_failure_detection/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 67 of file project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 44 of file project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 124 of file project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_int.c.

◆ sclk_192m_hick_config()

static void sclk_192m_hick_config ( void )
static

config sclk 192 mhz with hick clock source.

Note
the system clock is configured as follow: system clock (sclk) = hick / 2 * pll_mult system clock source = pll (hick)
  • hick = HICK_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< high speed internal clock stable flag

< phase locking loop stable flag

Definition at line 109 of file project/at_start_f413/examples/crm/clock_failure_detection/src/main.c.

Referenced by clock_failure_detection_handler().

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 106 of file project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 133 of file project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 93 of file project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_int.c.


AT32F413 Firmwary Library: CRM_sysclk_switch

Functions
CRM_sysclk_switch
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
static void | clkout_config (void)
clkout configuration.
static void | sclk_64m_hick_config (void)
config sclk 64 mhz with hick clock source.
static void | sclk_96m_hext_config (void)
config sclk 96 mhz with hext clock source.
static void | switch_system_clock (void)
sclk switch function.
int | main (void)
main function.

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/crm/sysclk_switch/src/at32f413_int.c.

◆ clkout_config()

void clkout_config ( void )
static

clkout configuration.

Parameters
none
Return values
none

< gpio pins number 8

Definition at line 47 of file project/at_start_f413/examples/crm/sysclk_switch/src/main.c.

Referenced by main(), sclk_64m_hick_config(), and sclk_96m_hext_config().

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/crm/sysclk_switch/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/crm/sysclk_switch/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 241 of file project/at_start_f413/examples/crm/sysclk_switch/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/crm/sysclk_switch/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/crm/sysclk_switch/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/crm/sysclk_switch/src/at32f413_int.c.

◆ sclk_64m_hick_config()

static void sclk_64m_hick_config ( void )
static

config sclk 64 mhz with hick clock source.

Note
the system clock is configured as follow: system clock (sclk) = hick / 2 * pll_mult system clock source = pll (hick)
  • hick = HICK_VALUE
  • sclk = 64000000
  • ahbdiv = 1
  • ahbclk = 64000000
  • apb2div = 2
  • apb2clk = 32000000
  • apb1div = 2
  • apb1clk = 32000000
  • pll_mult = 16
  • pll_range = LE72MHZ (less equal 72 mhz)
Parameters
none
Return values
none

< high speed internal clock stable flag

< phase locking loop stable flag

Definition at line 106 of file project/at_start_f413/examples/crm/sysclk_switch/src/main.c.

Referenced by switch_system_clock().

◆ sclk_96m_hext_config()

static void sclk_96m_hext_config ( void )
static

config sclk 96 mhz with hext clock source.

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 96000000
  • ahbdiv = 1
  • ahbclk = 96000000
  • apb2div = 2
  • apb2clk = 48000000
  • apb1div = 2
  • apb1clk = 48000000
  • pll_mult = 24
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 180 of file project/at_start_f413/examples/crm/sysclk_switch/src/main.c.

Referenced by switch_system_clock().

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/crm/sysclk_switch/src/at32f413_int.c.

◆ switch_system_clock()

static void switch_system_clock ( void )
static

sclk switch function.

Parameters
none
Return values
none

Definition at line 76 of file project/at_start_f413/examples/crm/sysclk_switch/src/main.c.

Referenced by main().

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/crm/sysclk_switch/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/crm/sysclk_switch/src/at32f413_int.c.


AT32F413 Firmwary Library: DEBUG_tmr

Functions | Variables
DEBUG_tmr
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | TMR1_OVF_TMR10_IRQHandler (void)
this function handles tmr1 overflow handler.
int | main (void)
main function.

Variables

crm_clocks_freq_type | crm_clocks_freq_struct = {0}
uint16_t | counter = 0

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/debug/tmr1/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/debug/tmr1/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/debug/tmr1/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< debug timer1 pause

< tmr interrupt overflow

Definition at line 61 of file project/at_start_f413/examples/debug/tmr1/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/debug/tmr1/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/debug/tmr1/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/debug/tmr1/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/debug/tmr1/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/debug/tmr1/src/at32f413_int.c.

◆ TMR1_OVF_TMR10_IRQHandler()

void TMR1_OVF_TMR10_IRQHandler ( void )

this function handles tmr1 overflow handler.

Parameters
none
Return values
none

< tmr flag overflow

< tmr flag overflow

Definition at line 46 of file project/at_start_f413/examples/debug/tmr1/src/main.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/debug/tmr1/src/at32f413_int.c.

Variable Documentation

◆ counter

uint16_t counter = 0

Definition at line 39 of file project/at_start_f413/examples/debug/tmr1/src/main.c.

Referenced by can_receive_error_counter_get(), can_transmit_error_counter_get(), and main().

◆ crm_clocks_freq_struct

crm_clocks_freq_type crm_clocks_freq_struct = {0}

Definition at line 38 of file project/at_start_f413/examples/debug/tmr1/src/main.c.

Referenced by main(), tmr1_config(), tmr1_config(), tmr2_config(), and tmr_init().


AT32F413 Firmwary Library: DMA_data_to_gpio_flexible

Macros | Functions | Variables
DMA_data_to_gpio_flexible
AT32F413_periph_examples

Macros

#define BUFFER_SIZE 16

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | DMA2_Channel1_IRQHandler (void)
this function handles DMA2 channel1 handler.
int | main (void)
main function.

Variables

gpio_init_type | gpio_init_struct = {0}
dma_init_type | dma_init_struct = {0}
uint16_t | src_buffer [16]

Detailed Description

Macro Definition Documentation

◆ BUFFER_SIZE

#define BUFFER_SIZE 16

Definition at line 40 of file project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c.

Referenced by main().

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/dma/data_to_gpio_flexible/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/dma/data_to_gpio_flexible/src/at32f413_int.c.

◆ DMA2_Channel1_IRQHandler()

void DMA2_Channel1_IRQHandler ( void )

this function handles DMA2 channel1 handler.

Parameters
none
Return values
none

< dma2 channel1 full data transfer flag

< dma2 channel1 full data transfer flag

Definition at line 49 of file project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/dma/data_to_gpio_flexible/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< jtag-dp disabled and sw-dp enabled

< jtag-dp disabled and sw-dp enabled

< gpio all pins

< dma full data transfer interrupt

< dma flexible channel1

Definition at line 66 of file project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/dma/data_to_gpio_flexible/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/dma/data_to_gpio_flexible/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/dma/data_to_gpio_flexible/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/dma/data_to_gpio_flexible/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/dma/data_to_gpio_flexible/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/dma/data_to_gpio_flexible/src/at32f413_int.c.

Variable Documentation

◆ dma_init_struct

dma_init_type dma_init_struct = {0}

Definition at line 38 of file project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c.

Referenced by codec_i2s_init(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_config(), dma_configuration(), dma_default_para_init(), dma_init(), main(), sd_dma_config(), spi_bytes_read(), and spi_bytes_write().

◆ gpio_init_struct

gpio_init_type gpio_init_struct = {0}

Definition at line 37 of file project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c.

Referenced by at32_button_init(), at32_led_init(), can_gpio_config(), can_gpio_config(), can_gpio_config(), clkout_config(), clkout_config(), clkout_config(), codec_i2s_init(), gpio_config(), gpio_configuration(), gpio_default_para_init(), gpio_init(), main(), mclk_tmr1_init(), rs485_config(), sd_init(), spim_init(), swj_dp_config(), uart_init(), uart_print_init(), usart1_config(), usart_configuration(), usart_gpio_config(), and usart_spi_configuration().

◆ src_buffer

uint16_t src_buffer[16]
Initial value:
= {0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008,
0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, 0x0010}

Definition at line 41 of file project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: DMA_flash_to_sram

Macros | Functions | Variables
DMA_flash_to_sram
AT32F413_periph_examples

Macros

#define BUFFER_SIZE 32

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
error_status | buffer_compare (const uint32_t *pbuffer, uint32_t *pbuffer1, uint16_t buffer_length)
compares two buffers.
void | DMA1_Channel1_IRQHandler (void)
this function handles dma1 channel1 handler.
int | main (void)
main function.

Variables

const uint32_t | src_const_buffer [32]
uint32_t | dst_buffer [32]
gpio_init_type | gpio_init_struct = {0}
dma_init_type | dma_init_struct = {0}
__IO uint32_t | data_counter_end = 0x01
error_status transfer_status = ERROR

Detailed Description

Macro Definition Documentation

◆ BUFFER_SIZE

#define BUFFER_SIZE 32

Definition at line 38 of file project/at_start_f413/examples/dma/flash_to_sram/src/main.c.

Referenced by main().

Function Documentation

◆ buffer_compare()

error_status buffer_compare | ( | const uint32_t * | pbuffer,
 |  | uint32_t * | pbuffer1,
 |  | uint16_t | buffer_length )

compares two buffers.

Parameters
pbuffer,pbuffer1 | buffers to be compared.
buffer_length | buffer's length
Return values
SUCCESS pbuffer identical to pbuffer1 ERROR: pbuffer differs from pbuffer1

Definition at line 77 of file project/at_start_f413/examples/dma/flash_to_sram/src/main.c.

Referenced by main().

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 79 of file project/at_start_f413/examples/dma/flash_to_sram/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 114 of file project/at_start_f413/examples/dma/flash_to_sram/src/at32f413_int.c.

◆ DMA1_Channel1_IRQHandler()

void DMA1_Channel1_IRQHandler ( void )

this function handles dma1 channel1 handler.

Parameters
none
Return values
none

< dma1 channel1 full data transfer flag

< dma1 channel1 full data transfer flag

Definition at line 61 of file project/at_start_f413/examples/dma/flash_to_sram/src/main.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 53 of file project/at_start_f413/examples/dma/flash_to_sram/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< dma full data transfer interrupt

Definition at line 98 of file project/at_start_f413/examples/dma/flash_to_sram/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 66 of file project/at_start_f413/examples/dma/flash_to_sram/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 44 of file project/at_start_f413/examples/dma/flash_to_sram/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 123 of file project/at_start_f413/examples/dma/flash_to_sram/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 105 of file project/at_start_f413/examples/dma/flash_to_sram/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 132 of file project/at_start_f413/examples/dma/flash_to_sram/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 92 of file project/at_start_f413/examples/dma/flash_to_sram/src/at32f413_int.c.

Variable Documentation

◆ data_counter_end

__IO uint32_t data_counter_end = 0x01

Definition at line 51 of file project/at_start_f413/examples/dma/flash_to_sram/src/main.c.

Referenced by DMA1_Channel1_IRQHandler(), and main().

◆ dma_init_struct

dma_init_type dma_init_struct = {0}

Definition at line 50 of file project/at_start_f413/examples/dma/flash_to_sram/src/main.c.

Referenced by main().

◆ dst_buffer

uint32_t dst_buffer[32]

Definition at line 48 of file project/at_start_f413/examples/dma/flash_to_sram/src/main.c.

Referenced by main().

◆ gpio_init_struct

gpio_init_type gpio_init_struct = {0}

Definition at line 49 of file project/at_start_f413/examples/dma/flash_to_sram/src/main.c.

◆ src_const_buffer

const uint32_t src_const_buffer[32]
Initial value:
= {0x01020304, 0x05060708, 0x090A0B0C, 0x0D0E0F10,
0x11121314, 0x15161718, 0x191A1B1C, 0x1D1E1F20,
0x21222324, 0x25262728, 0x292A2B2C, 0x2D2E2F30,
0x31323334, 0x35363738, 0x393A3B3C, 0x3D3E3F40,
0x41424344, 0x45464748, 0x494A4B4C, 0x4D4E4F50,
0x51525354, 0x55565758, 0x595A5B5C, 0x5D5E5F60,
0x61626364, 0x65666768, 0x696A6B6C, 0x6D6E6F70,
0x71727374, 0x75767778, 0x797A7B7C, 0x7D7E7F80}

Definition at line 40 of file project/at_start_f413/examples/dma/flash_to_sram/src/main.c.

Referenced by main().

◆ transfer_status

error_status transfer_status = ERROR

Definition at line 52 of file project/at_start_f413/examples/dma/flash_to_sram/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: EXINT_config

Functions
EXINT_config
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | exint_line0_config (void)
exint line0 config. configure pa0 in interrupt mode
int | main (void)
main function.
void | EXINT0_IRQHandler (void)
exint0 interrupt handler

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/exint/exint_config/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/exint/exint_config/src/at32f413_int.c.

◆ EXINT0_IRQHandler()

void EXINT0_IRQHandler ( void )

exint0 interrupt handler

Parameters
none
Return values
none

< external interrupt line 0

< external interrupt line 0

Definition at line 95 of file project/at_start_f413/examples/exint/exint_config/src/main.c.

◆ exint_line0_config()

void exint_line0_config ( void )

exint line0 config. configure pa0 in interrupt mode

Parameters
None
Return values
None

< external interrupt line 0

Definition at line 70 of file project/at_start_f413/examples/exint/exint_config/src/main.c.

Referenced by main().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/exint/exint_config/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 46 of file project/at_start_f413/examples/exint/exint_config/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/exint/exint_config/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/exint/exint_config/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/exint/exint_config/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/exint/exint_config/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/exint/exint_config/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/exint/exint_config/src/at32f413_int.c.


AT32F413 Firmwary Library: EXINT_software_trigger

Functions
EXINT_software_trigger
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | exint_line4_config (void)
exint line4 config. configure pa0 in interrupt mode
static void | tmr1_config (void)
tmr1 configuration.
void | TMR1_OVF_TMR10_IRQHandler (void)
tmr1 interrupt handler
void | EXINT4_IRQHandler (void)
exint4 interrupt handler
int | main (void)
main function.

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/exint/exint_software_trigger/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/exint/exint_software_trigger/src/at32f413_int.c.

◆ EXINT4_IRQHandler()

void EXINT4_IRQHandler ( void )

exint4 interrupt handler

Parameters
none
Return values
none

< external interrupt line 4

< external interrupt line 4

Definition at line 105 of file project/at_start_f413/examples/exint/exint_software_trigger/src/main.c.

◆ exint_line4_config()

void exint_line4_config ( void )

exint line4 config. configure pa0 in interrupt mode

Parameters
None
Return values
None

< external interrupt line 4

Definition at line 47 of file project/at_start_f413/examples/exint/exint_software_trigger/src/main.c.

Referenced by main().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/exint/exint_software_trigger/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 120 of file project/at_start_f413/examples/exint/exint_software_trigger/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/exint/exint_software_trigger/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/exint/exint_software_trigger/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/exint/exint_software_trigger/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/exint/exint_software_trigger/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/exint/exint_software_trigger/src/at32f413_int.c.

◆ tmr1_config()

static void tmr1_config ( void )
static

tmr1 configuration.

Parameters
none
Return values
none

< tmr interrupt overflow

Definition at line 68 of file project/at_start_f413/examples/exint/exint_software_trigger/src/main.c.

Referenced by main().

◆ TMR1_OVF_TMR10_IRQHandler()

void TMR1_OVF_TMR10_IRQHandler ( void )

tmr1 interrupt handler

Parameters
none
Return values
none

< tmr flag overflow

< external interrupt line 4

< tmr flag overflow

Definition at line 90 of file project/at_start_f413/examples/exint/exint_software_trigger/src/main.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/exint/exint_software_trigger/src/at32f413_int.c.


AT32F413 Firmwary Library: FLASH_write_read

Topics | Macros | Functions | Variables
FLASH_write_read
AT32F413_periph_examples

Topics

FLASH_write_read_functions

Macros

#define | SECTOR_SIZE 1024 /* this parameter depends on the specific model of the chip */
#define | TEST_BUFEER_SIZE 3000
#define | TEST_FLASH_ADDRESS_START (0x08000000 + 1024 * 10)

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | flash_read (uint32_t read_addr, uint16_t *p_buffer, uint16_t num_read)
read data using halfword mode
error_status | flash_write_nocheck (uint32_t write_addr, uint16_t *p_buffer, uint16_t num_write)
write data using halfword mode without checking
error_status | flash_write (uint32_t write_addr, uint16_t *p_buffer, uint16_t num_write)
write data using halfword mode with checking
error_status | buffer_compare (uint16_t *p_buffer1, uint16_t *p_buffer2, uint16_t buffer_length)
compares two buffers.
int | main (void)
main function.

Variables

uint16_t | flash_buf [1024/2]
uint16_t | buffer_write [3000]
uint16_t | buffer_read [3000]

Detailed Description

Macro Definition Documentation

◆ SECTOR_SIZE

#define SECTOR_SIZE 1024 /* this parameter depends on the specific model of the chip */

Definition at line 40 of file project/at_start_f413/examples/flash/flash_write_read/src/flash.c.

Referenced by flash_write().

◆ TEST_BUFEER_SIZE

#define TEST_BUFEER_SIZE 3000

Definition at line 38 of file project/at_start_f413/examples/flash/flash_write_read/src/main.c.

Referenced by main().

◆ TEST_FLASH_ADDRESS_START

#define TEST_FLASH_ADDRESS_START (0x08000000 + 1024 * 10)

Definition at line 39 of file project/at_start_f413/examples/flash/flash_write_read/src/main.c.

Referenced by main().

Function Documentation

◆ buffer_compare()

error_status buffer_compare | ( | uint16_t * | p_buffer1,
 |  | uint16_t * | p_buffer2,
 |  | uint16_t | buffer_length )

compares two buffers.

Parameters
p_buffer1,p_buffer2 | buffers to be compared.
buffer_length | buffer's length
Return values
SUCCESS p_buffer1 identical to p_buffer2 ERROR: p_buffer1 differs from p_buffer2

Definition at line 53 of file project/at_start_f413/examples/flash/flash_write_read/src/main.c.

Referenced by main().

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/flash/flash_write_read/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/flash/flash_write_read/src/at32f413_int.c.

◆ flash_read()

void flash_read | ( | uint32_t | read_addr,
 |  | uint16_t * | p_buffer,
 |  | uint16_t | num_read )

read data using halfword mode

Parameters
read_addr | the address of reading
p_buffer | the buffer of reading data
num_read | the number of reading data
Return values
none

Definition at line 52 of file project/at_start_f413/examples/flash/flash_write_read/src/flash.c.

Referenced by flash_write(), and main().

◆ flash_write()

error_status flash_write | ( | uint32_t | write_addr,
 |  | uint16_t * | p_buffer,
 |  | uint16_t | num_write )

write data using halfword mode with checking

Parameters
write_addr | the address of writing
p_buffer | the buffer of writing data
num_write | the number of writing data
Return values
result

Definition at line 90 of file project/at_start_f413/examples/flash/flash_write_read/src/flash.c.

Referenced by main().

◆ flash_write_nocheck()

error_status flash_write_nocheck | ( | uint32_t | write_addr,
 |  | uint16_t * | p_buffer,
 |  | uint16_t | num_write )

write data using halfword mode without checking

Parameters
write_addr | the address of writing
p_buffer | the buffer of writing data
num_write | the number of writing data
Return values
result

Definition at line 69 of file project/at_start_f413/examples/flash/flash_write_read/src/flash.c.

Referenced by flash_write().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/flash/flash_write_read/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 72 of file project/at_start_f413/examples/flash/flash_write_read/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/flash/flash_write_read/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/flash/flash_write_read/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/flash/flash_write_read/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/flash/flash_write_read/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/flash/flash_write_read/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/flash/flash_write_read/src/at32f413_int.c.

Variable Documentation

◆ buffer_read

uint16_t buffer_read[3000]

Definition at line 42 of file project/at_start_f413/examples/flash/flash_write_read/src/main.c.

Referenced by main().

◆ buffer_write

uint16_t buffer_write[3000]

Definition at line 41 of file project/at_start_f413/examples/flash/flash_write_read/src/main.c.

Referenced by main().

◆ flash_buf

uint16_t flash_buf[1024/2]

Definition at line 43 of file project/at_start_f413/examples/flash/flash_write_read/src/flash.c.

Referenced by flash_write().


AT32F413 Firmwary Library: FLASH_write_read_functions

Functions
FLASH_write_read_functions
AT32F413_periph_examples » FLASH_write_read

Functions

void | flash_read (uint32_t read_addr, uint16_t *p_buffer, uint16_t num_read)
read data using halfword mode
error_status | flash_write_nocheck (uint32_t write_addr, uint16_t *p_buffer, uint16_t num_write)
write data using halfword mode without checking
error_status | flash_write (uint32_t write_addr, uint16_t *p_Buffer, uint16_t num_write)
write data using halfword mode with checking

Detailed Description

Function Documentation

◆ flash_read()

void flash_read | ( | uint32_t | read_addr,
 |  | uint16_t * | p_buffer,
 |  | uint16_t | num_read )

read data using halfword mode

Parameters
read_addr | the address of reading
p_buffer | the buffer of reading data
num_read | the number of reading data
Return values
none

Definition at line 52 of file project/at_start_f413/examples/flash/flash_write_read/src/flash.c.

Referenced by flash_write(), and main().

◆ flash_write()

error_status flash_write | ( | uint32_t | write_addr,
 |  | uint16_t * | p_buffer,
 |  | uint16_t | num_write )

write data using halfword mode with checking

Parameters
write_addr | the address of writing
p_buffer | the buffer of writing data
num_write | the number of writing data
Return values
result

Definition at line 90 of file project/at_start_f413/examples/flash/flash_write_read/src/flash.c.

Referenced by main().

◆ flash_write_nocheck()

error_status flash_write_nocheck | ( | uint32_t | write_addr,
 |  | uint16_t * | p_buffer,
 |  | uint16_t | num_write )

write data using halfword mode without checking

Parameters
write_addr | the address of writing
p_buffer | the buffer of writing data
num_write | the number of writing data
Return values
result

Definition at line 69 of file project/at_start_f413/examples/flash/flash_write_read/src/flash.c.

Referenced by flash_write().


AT32F413 Firmwary Library: FLASH_operate_spim

Topics | Macros | Functions | Variables
FLASH_operate_spim
AT32F413_periph_examples

Topics

FLASH_operate_spim_functions

Macros

#define | SPIM_SECTOR_SIZE 4096
#define | SPIM_TEST_ADDR 0x08400000

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
int | main (void)
main function.
void | spim_init (void)
init the spim flash
void | sector_read (uint32_t address, uint32_t sector_size, uint8_t *buf)
read one sector from a specified address in spim flash
void | spim_operate (void)
operate spim flash

Variables

uint8_t | write_buffer [4096]
uint8_t | read_buffer [4096]

Detailed Description

Macro Definition Documentation

◆ SPIM_SECTOR_SIZE

#define SPIM_SECTOR_SIZE 4096

Definition at line 42 of file operate_spim.h.

Referenced by spim_operate().

◆ SPIM_TEST_ADDR

#define SPIM_TEST_ADDR 0x08400000

Definition at line 43 of file operate_spim.h.

Referenced by spim_operate().

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 78 of file project/at_start_f413/examples/flash/operate_spim/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 113 of file project/at_start_f413/examples/flash/operate_spim/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 52 of file project/at_start_f413/examples/flash/operate_spim/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 44 of file project/at_start_f413/examples/flash/operate_spim/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 65 of file project/at_start_f413/examples/flash/operate_spim/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 43 of file project/at_start_f413/examples/flash/operate_spim/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 122 of file project/at_start_f413/examples/flash/operate_spim/src/at32f413_int.c.

◆ sector_read()

void sector_read | ( | uint32_t | address,
 |  | uint32_t | sector_size,
 |  | uint8_t * | buf )

read one sector from a specified address in spim flash

Parameters
address | specifies the sector starting address
sector_size | sector size in bytes
buf | the content read from spim flash
Return values
none

Definition at line 95 of file operate_spim.c.

Referenced by spim_operate().

◆ spim_init()

void spim_init ( void )

init the spim flash

Parameters
none
Return values
none

Definition at line 48 of file operate_spim.c.

Referenced by spim_operate().

◆ spim_operate()

void spim_operate ( void )

operate spim flash

Parameters
none
Return values
none

Definition at line 111 of file operate_spim.c.

Referenced by main().

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 104 of file project/at_start_f413/examples/flash/operate_spim/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 131 of file project/at_start_f413/examples/flash/operate_spim/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 91 of file project/at_start_f413/examples/flash/operate_spim/src/at32f413_int.c.

Variable Documentation

◆ read_buffer

uint8_t read_buffer[4096]

Definition at line 41 of file operate_spim.c.

Referenced by spim_operate().

◆ write_buffer

uint8_t write_buffer[4096]

Definition at line 40 of file operate_spim.c.

Referenced by spim_operate().


AT32F413 Firmwary Library: FLASH_operate_spim_functions

Functions
FLASH_operate_spim_functions
AT32F413_periph_examples » FLASH_operate_spim

Functions

void spim_operate (void)
operate spim flash

Detailed Description

Function Documentation

◆ spim_operate()

void spim_operate ( void )

operate spim flash

Parameters
none
Return values
none

Definition at line 111 of file operate_spim.c.

Referenced by main().


AT32F413 Firmwary Library: FLASH_run_in_spim

Functions
FLASH_run_in_spim
AT32F413_periph_examples

Functions

void | spim_run (void)
check the led toggle in spim
void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | spim_init (void)
init the spim flash
int | main (void)
main function.

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 79 of file project/at_start_f413/examples/flash/run_in_spim/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 114 of file project/at_start_f413/examples/flash/run_in_spim/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 53 of file project/at_start_f413/examples/flash/run_in_spim/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 89 of file project/at_start_f413/examples/flash/run_in_spim/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 66 of file project/at_start_f413/examples/flash/run_in_spim/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 44 of file project/at_start_f413/examples/flash/run_in_spim/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 123 of file project/at_start_f413/examples/flash/run_in_spim/src/at32f413_int.c.

◆ spim_init()

void spim_init ( void )

init the spim flash

Parameters
none
Return values
none

< gpio pins number 8

< gpio pins number 1

< gpio pins number 6

< gpio pins number 7

< gpio pins number 10

< gpio pins number 11

< spim_sck(pb1), spim_cs(pa8), spim_io0(pb10), spim_io1(pb11), spim_io2(pb7), spim_sio3(pb6)

< flash spim operate busy flag

Definition at line 44 of file project/at_start_f413/examples/flash/run_in_spim/src/main.c.

Referenced by main().

◆ spim_run()

void spim_run ( void )

check the led toggle in spim

Parameters
none
Return values
none

Definition at line 44 of file run_in_spim.c.

Referenced by main().

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 105 of file project/at_start_f413/examples/flash/run_in_spim/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 132 of file project/at_start_f413/examples/flash/run_in_spim/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 92 of file project/at_start_f413/examples/flash/run_in_spim/src/at32f413_int.c.


AT32F413 Firmwary Library: GPIO_io_toggle

Functions
GPIO_io_toggle
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | gpio_config (void)
pa.01 gpio configuration.
int | main (void)
main function.

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/gpio/io_toggle/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/gpio/io_toggle/src/at32f413_int.c.

◆ gpio_config()

void gpio_config ( void )

pa.01 gpio configuration.

Parameters
none
Return values
none

< gpio pins number 1

Definition at line 43 of file project/at_start_f413/examples/gpio/io_toggle/src/main.c.

Referenced by main().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/gpio/io_toggle/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< gpio pins number 1

< gpio pins number 1

< gpio pins number 1

< gpio pins number 1

< gpio pins number 1

< gpio pins number 1

< gpio pins number 1

< gpio pins number 1

< gpio pins number 1

< gpio pins number 1

< gpio pins number 1

< gpio pins number 1

Definition at line 67 of file project/at_start_f413/examples/gpio/io_toggle/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/gpio/io_toggle/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/gpio/io_toggle/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/gpio/io_toggle/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/gpio/io_toggle/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/gpio/io_toggle/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/gpio/io_toggle/src/at32f413_int.c.


AT32F413 Firmwary Library: GPIO_led_toggle

Functions
GPIO_led_toggle
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
int | main (void)
main function.

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/gpio/led_toggle/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/gpio/led_toggle/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/gpio/led_toggle/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 43 of file project/at_start_f413/examples/gpio/led_toggle/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/gpio/led_toggle/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/gpio/led_toggle/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/gpio/led_toggle/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/gpio/led_toggle/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/gpio/led_toggle/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/gpio/led_toggle/src/at32f413_int.c.


AT32F413 Firmwary Library: GPIO_swjtag_remap

Functions
GPIO_swjtag_remap
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | swj_dp_config (void)
configure the gpio of swj-dp.
void | gpio_pins_toggle (gpio_type *gpio_x, uint16_t gpio_pin)
toggles the specified gpio pin
int | main (void)
main function.

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 78 of file project/at_start_f413/examples/gpio/swjtag_remap/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 113 of file project/at_start_f413/examples/gpio/swjtag_remap/src/at32f413_int.c.

◆ gpio_pins_toggle()

void gpio_pins_toggle | ( | gpio_type * | gpio_x,
 |  | uint16_t | gpio_pin )

toggles the specified gpio pin

Parameters
gpiox | where x can be (a..g depending on device used) to select the gpio peripheral
gpio_pin | specifies the pins to be toggled.
Return values
none

Definition at line 69 of file project/at_start_f413/examples/gpio/swjtag_remap/src/main.c.

Referenced by main().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 52 of file project/at_start_f413/examples/gpio/swjtag_remap/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< full swj disabled (jtag-dp + sw-dp)

< full swj disabled (jtag-dp + sw-dp)

< gpio pins number 13

< gpio pins number 14

< gpio pins number 15

< gpio pins number 3

< gpio pins number 4

Definition at line 79 of file project/at_start_f413/examples/gpio/swjtag_remap/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 65 of file project/at_start_f413/examples/gpio/swjtag_remap/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 43 of file project/at_start_f413/examples/gpio/swjtag_remap/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 122 of file project/at_start_f413/examples/gpio/swjtag_remap/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 104 of file project/at_start_f413/examples/gpio/swjtag_remap/src/at32f413_int.c.

◆ swj_dp_config()

void swj_dp_config ( void )

configure the gpio of swj-dp.

Parameters
none
Return values
none

< gpio pins number 13

< gpio pins number 14

< gpio pins number 15

< gpio pins number 3

< gpio pins number 4

Definition at line 46 of file project/at_start_f413/examples/gpio/swjtag_remap/src/main.c.

Referenced by main().

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 131 of file project/at_start_f413/examples/gpio/swjtag_remap/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 91 of file project/at_start_f413/examples/gpio/swjtag_remap/src/at32f413_int.c.


AT32F413 Firmwary Library: I2C_communication_dma

Macros | Functions | Variables
I2C_communication_dma
AT32F413_periph_examples

Macros

#define | I2C_TIMEOUT 0xFFFFFFFF
#define | I2Cx_SPEED 100000
#define | I2Cx_ADDRESS 0xA0
#define | I2Cx_PORT I2C1
#define | I2Cx_CLK CRM_I2C1_PERIPH_CLOCK
#define | I2Cx_SCL_PIN GPIO_PINS_6
#define | I2Cx_SCL_GPIO_PORT GPIOB
#define | I2Cx_SCL_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
#define | I2Cx_SDA_PIN GPIO_PINS_7
#define | I2Cx_SDA_GPIO_PORT GPIOB
#define | I2Cx_SDA_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
#define | I2Cx_DMA_CLK CRM_DMA1_PERIPH_CLOCK
#define | I2Cx_DMA_TX_CHANNEL DMA1_CHANNEL6
#define | I2Cx_DMA_TX_IRQn DMA1_Channel6_IRQn
#define | I2Cx_DMA_RX_CHANNEL DMA1_CHANNEL7
#define | I2Cx_DMA_RX_IRQn DMA1_Channel7_IRQn
#define | I2Cx_EVT_IRQn I2C1_EVT_IRQn
#define | I2Cx_ERR_IRQn I2C1_ERR_IRQn
#define | BUF_SIZE 8
#define | MASTER_BOARD

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | DMA1_Channel7_IRQHandler (void)
this function handles dma interrupt request.
void | DMA1_Channel6_IRQHandler (void)
this function handles dma interrupt request.
void | I2C1_EVT_IRQHandler (void)
this function handles i2c event interrupt request.
void | I2C1_ERR_IRQHandler (void)
this function handles i2c error interrupt request.
uint32_t | buffer_compare (uint8_t *buffer1, uint8_t *buffer2, uint32_t len)
compare whether the valus of buffer 1 and buffer 2 are equal.
void | i2c_lowlevel_init (i2c_handle_type *hi2c)
initializes peripherals used by the i2c.
void | error_handler (uint32_t error_code)
error handler program
int | main (void)
main function.

Variables

uint8_t | tx_buf [8] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}
uint8_t | rx_buf [8] = {0}
i2c_handle_type hi2cx

Detailed Description

Macro Definition Documentation

◆ BUF_SIZE

#define BUF_SIZE 8

Definition at line 64 of file project/at_start_f413/examples/i2c/communication_dma/src/main.c.

Referenced by main().

◆ I2C_TIMEOUT

#define I2C_TIMEOUT 0xFFFFFFFF

Definition at line 38 of file project/at_start_f413/examples/i2c/communication_dma/src/main.c.

Referenced by main().

◆ I2Cx_ADDRESS

#define I2Cx_ADDRESS 0xA0

Definition at line 41 of file project/at_start_f413/examples/i2c/communication_dma/src/main.c.

Referenced by i2c_lowlevel_init(), and main().

◆ I2Cx_CLK

#define I2Cx_CLK CRM_I2C1_PERIPH_CLOCK

Definition at line 44 of file project/at_start_f413/examples/i2c/communication_dma/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_DMA_CLK

#define I2Cx_DMA_CLK CRM_DMA1_PERIPH_CLOCK

Definition at line 54 of file project/at_start_f413/examples/i2c/communication_dma/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_DMA_RX_CHANNEL

#define I2Cx_DMA_RX_CHANNEL DMA1_CHANNEL7

Definition at line 58 of file project/at_start_f413/examples/i2c/communication_dma/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_DMA_RX_IRQn

#define I2Cx_DMA_RX_IRQn DMA1_Channel7_IRQn

Definition at line 59 of file project/at_start_f413/examples/i2c/communication_dma/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_DMA_TX_CHANNEL

#define I2Cx_DMA_TX_CHANNEL DMA1_CHANNEL6

Definition at line 55 of file project/at_start_f413/examples/i2c/communication_dma/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_DMA_TX_IRQn

#define I2Cx_DMA_TX_IRQn DMA1_Channel6_IRQn

Definition at line 56 of file project/at_start_f413/examples/i2c/communication_dma/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_ERR_IRQn

#define I2Cx_ERR_IRQn I2C1_ERR_IRQn

Definition at line 62 of file project/at_start_f413/examples/i2c/communication_dma/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_EVT_IRQn

#define I2Cx_EVT_IRQn I2C1_EVT_IRQn

Definition at line 61 of file project/at_start_f413/examples/i2c/communication_dma/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_PORT

#define I2Cx_PORT I2C1

Definition at line 43 of file project/at_start_f413/examples/i2c/communication_dma/src/main.c.

Referenced by i2c_lowlevel_init(), and main().

◆ I2Cx_SCL_GPIO_CLK

#define I2Cx_SCL_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK

Definition at line 48 of file project/at_start_f413/examples/i2c/communication_dma/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_SCL_GPIO_PORT

#define I2Cx_SCL_GPIO_PORT GPIOB

Definition at line 47 of file project/at_start_f413/examples/i2c/communication_dma/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_SCL_PIN

#define I2Cx_SCL_PIN GPIO_PINS_6

Definition at line 46 of file project/at_start_f413/examples/i2c/communication_dma/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_SDA_GPIO_CLK

#define I2Cx_SDA_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK

Definition at line 52 of file project/at_start_f413/examples/i2c/communication_dma/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_SDA_GPIO_PORT

#define I2Cx_SDA_GPIO_PORT GPIOB

Definition at line 51 of file project/at_start_f413/examples/i2c/communication_dma/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_SDA_PIN

#define I2Cx_SDA_PIN GPIO_PINS_7

Definition at line 50 of file project/at_start_f413/examples/i2c/communication_dma/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_SPEED

#define I2Cx_SPEED 100000

Definition at line 40 of file project/at_start_f413/examples/i2c/communication_dma/src/main.c.

Referenced by i2c_lowlevel_init().

◆ MASTER_BOARD

#define MASTER_BOARD

Definition at line 65 of file project/at_start_f413/examples/i2c/communication_dma/src/main.c.

Function Documentation

◆ buffer_compare()

uint32_t buffer_compare | ( | uint8_t * | buffer1,
 |  | uint8_t * | buffer2,
 |  | uint32_t | len )

compare whether the valus of buffer 1 and buffer 2 are equal.

Parameters
buffer1 buffer 1 address. buffer2: buffer 2 address.
Return values
0 equal. 1: unequal.

Definition at line 96 of file project/at_start_f413/examples/i2c/communication_dma/src/main.c.

Referenced by main().

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 85 of file project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 120 of file project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c.

◆ DMA1_Channel6_IRQHandler()

void DMA1_Channel6_IRQHandler ( void )

this function handles dma interrupt request.

Parameters
none
Return values
none

Definition at line 157 of file project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c.

◆ DMA1_Channel7_IRQHandler()

void DMA1_Channel7_IRQHandler ( void )

this function handles dma interrupt request.

Parameters
none
Return values
none

Definition at line 147 of file project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c.

◆ error_handler()

void error_handler ( uint32_t error_code )

error handler program

Parameters
i2c_status
Return values
none

Definition at line 80 of file project/at_start_f413/examples/i2c/communication_dma/src/main.c.

Referenced by main().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 59 of file project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c.

◆ I2C1_ERR_IRQHandler()

void I2C1_ERR_IRQHandler ( void )

this function handles i2c error interrupt request.

Parameters
none
Return values
none

Definition at line 177 of file project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c.

◆ I2C1_EVT_IRQHandler()

void I2C1_EVT_IRQHandler ( void )

this function handles i2c event interrupt request.

Parameters
none
Return values
none

Definition at line 167 of file project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c.

◆ i2c_lowlevel_init()

void i2c_lowlevel_init ( i2c_handle_type * hi2c )

initializes peripherals used by the i2c.

Parameters
none
Return values
none

< gpio pins number 6

< gpio pins number 7

Definition at line 116 of file project/at_start_f413/examples/i2c/communication_dma/src/main.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 183 of file project/at_start_f413/examples/i2c/communication_dma/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 72 of file project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 50 of file project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 129 of file project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 111 of file project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 138 of file project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 98 of file project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c.

Variable Documentation

◆ hi2cx

i2c_handle_type hi2cx

Definition at line 70 of file project/at_start_f413/examples/i2c/communication_dma/src/main.c.

Referenced by main().

◆ rx_buf

uint8_t rx_buf[8] = {0}

Definition at line 68 of file project/at_start_f413/examples/i2c/communication_dma/src/main.c.

Referenced by main().

◆ tx_buf

uint8_t tx_buf[8] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}

Definition at line 67 of file project/at_start_f413/examples/i2c/communication_dma/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: I2C_communication_int

Macros | Functions | Variables
I2C_communication_int
AT32F413_periph_examples

Macros

#define | I2C_TIMEOUT 0xFFFFFFFF
#define | I2Cx_SPEED 100000
#define | I2Cx_ADDRESS 0xA0
#define | I2Cx_PORT I2C1
#define | I2Cx_CLK CRM_I2C1_PERIPH_CLOCK
#define | I2Cx_SCL_PIN GPIO_PINS_6
#define | I2Cx_SCL_GPIO_PORT GPIOB
#define | I2Cx_SCL_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
#define | I2Cx_SDA_PIN GPIO_PINS_7
#define | I2Cx_SDA_GPIO_PORT GPIOB
#define | I2Cx_SDA_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
#define | I2Cx_EVT_IRQn I2C1_EVT_IRQn
#define | I2Cx_ERR_IRQn I2C1_ERR_IRQn
#define | BUF_SIZE 8
#define | MASTER_BOARD

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | I2C1_EVT_IRQHandler (void)
this function handles i2c event interrupt request.
void | I2C1_ERR_IRQHandler (void)
this function handles i2c error interrupt request.
uint32_t | buffer_compare (uint8_t *buffer1, uint8_t *buffer2, uint32_t len)
compare whether the valus of buffer 1 and buffer 2 are equal.
void | error_handler (uint32_t error_code)
error handler program
void | i2c_lowlevel_init (i2c_handle_type *hi2c)
initializes peripherals used by the i2c.
int | main (void)
main function.

Variables

uint8_t | tx_buf [8] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}
uint8_t | rx_buf [8] = {0}
i2c_handle_type hi2cx

Detailed Description

Macro Definition Documentation

◆ BUF_SIZE

#define BUF_SIZE 8

Definition at line 57 of file project/at_start_f413/examples/i2c/communication_int/src/main.c.

Referenced by main().

◆ I2C_TIMEOUT

#define I2C_TIMEOUT 0xFFFFFFFF

Definition at line 38 of file project/at_start_f413/examples/i2c/communication_int/src/main.c.

Referenced by main().

◆ I2Cx_ADDRESS

#define I2Cx_ADDRESS 0xA0

Definition at line 41 of file project/at_start_f413/examples/i2c/communication_int/src/main.c.

Referenced by i2c_lowlevel_init(), and main().

◆ I2Cx_CLK

#define I2Cx_CLK CRM_I2C1_PERIPH_CLOCK

Definition at line 44 of file project/at_start_f413/examples/i2c/communication_int/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_ERR_IRQn

#define I2Cx_ERR_IRQn I2C1_ERR_IRQn

Definition at line 55 of file project/at_start_f413/examples/i2c/communication_int/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_EVT_IRQn

#define I2Cx_EVT_IRQn I2C1_EVT_IRQn

Definition at line 54 of file project/at_start_f413/examples/i2c/communication_int/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_PORT

#define I2Cx_PORT I2C1

Definition at line 43 of file project/at_start_f413/examples/i2c/communication_int/src/main.c.

Referenced by i2c_lowlevel_init(), and main().

◆ I2Cx_SCL_GPIO_CLK

#define I2Cx_SCL_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK

Definition at line 48 of file project/at_start_f413/examples/i2c/communication_int/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_SCL_GPIO_PORT

#define I2Cx_SCL_GPIO_PORT GPIOB

Definition at line 47 of file project/at_start_f413/examples/i2c/communication_int/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_SCL_PIN

#define I2Cx_SCL_PIN GPIO_PINS_6

Definition at line 46 of file project/at_start_f413/examples/i2c/communication_int/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_SDA_GPIO_CLK

#define I2Cx_SDA_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK

Definition at line 52 of file project/at_start_f413/examples/i2c/communication_int/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_SDA_GPIO_PORT

#define I2Cx_SDA_GPIO_PORT GPIOB

Definition at line 51 of file project/at_start_f413/examples/i2c/communication_int/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_SDA_PIN

#define I2Cx_SDA_PIN GPIO_PINS_7

Definition at line 50 of file project/at_start_f413/examples/i2c/communication_int/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_SPEED

#define I2Cx_SPEED 100000

Definition at line 40 of file project/at_start_f413/examples/i2c/communication_int/src/main.c.

Referenced by i2c_lowlevel_init().

◆ MASTER_BOARD

#define MASTER_BOARD

Definition at line 58 of file project/at_start_f413/examples/i2c/communication_int/src/main.c.

Function Documentation

◆ buffer_compare()

uint32_t buffer_compare | ( | uint8_t * | buffer1,
 |  | uint8_t * | buffer2,
 |  | uint32_t | len )

compare whether the valus of buffer 1 and buffer 2 are equal.

Parameters
buffer1 buffer 1 address. buffer2: buffer 2 address.
Return values
0 equal. 1: unequal.

Definition at line 90 of file project/at_start_f413/examples/i2c/communication_int/src/main.c.

Referenced by main().

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 83 of file project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 118 of file project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c.

◆ error_handler()

void error_handler ( uint32_t error_code )

error handler program

Parameters
i2c_status
Return values
none

Definition at line 74 of file project/at_start_f413/examples/i2c/communication_int/src/main.c.

Referenced by main().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 57 of file project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c.

◆ I2C1_ERR_IRQHandler()

void I2C1_ERR_IRQHandler ( void )

this function handles i2c error interrupt request.

Parameters
none
Return values
none

Definition at line 155 of file project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c.

◆ I2C1_EVT_IRQHandler()

void I2C1_EVT_IRQHandler ( void )

this function handles i2c event interrupt request.

Parameters
none
Return values
none

Definition at line 145 of file project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c.

◆ i2c_lowlevel_init()

void i2c_lowlevel_init ( i2c_handle_type * hi2c )

initializes peripherals used by the i2c.

Parameters
none
Return values
none

< gpio pins number 6

< gpio pins number 7

Definition at line 110 of file project/at_start_f413/examples/i2c/communication_int/src/main.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 150 of file project/at_start_f413/examples/i2c/communication_int/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 70 of file project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 48 of file project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 127 of file project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 109 of file project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 136 of file project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 96 of file project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c.

Variable Documentation

◆ hi2cx

i2c_handle_type hi2cx

Definition at line 63 of file project/at_start_f413/examples/i2c/communication_int/src/main.c.

Referenced by main().

◆ rx_buf

uint8_t rx_buf[8] = {0}

Definition at line 61 of file project/at_start_f413/examples/i2c/communication_int/src/main.c.

Referenced by main().

◆ tx_buf

uint8_t tx_buf[8] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}

Definition at line 60 of file project/at_start_f413/examples/i2c/communication_int/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: I2C_communication_poll

Macros | Functions | Variables
I2C_communication_poll
AT32F413_periph_examples

Macros

#define | I2C_TIMEOUT 0xFFFFFFFF
#define | I2Cx_SPEED 100000
#define | I2Cx_ADDRESS 0xA0
#define | I2Cx_PORT I2C1
#define | I2Cx_CLK CRM_I2C1_PERIPH_CLOCK
#define | I2Cx_SCL_PIN GPIO_PINS_6
#define | I2Cx_SCL_GPIO_PORT GPIOB
#define | I2Cx_SCL_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
#define | I2Cx_SDA_PIN GPIO_PINS_7
#define | I2Cx_SDA_GPIO_PORT GPIOB
#define | I2Cx_SDA_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
#define | BUF_SIZE 8
#define | MASTER_BOARD

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | error_handler (uint32_t error_code)
error handler program
uint32_t | buffer_compare (uint8_t *buffer1, uint8_t *buffer2, uint32_t len)
compare whether the valus of buffer 1 and buffer 2 are equal.
void | i2c_lowlevel_init (i2c_handle_type *hi2c)
initializes peripherals used by the i2c.
int | main (void)
main function.

Variables

uint8_t | tx_buf [8] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}
uint8_t | rx_buf [8] = {0}
i2c_handle_type hi2cx

Detailed Description

Macro Definition Documentation

◆ BUF_SIZE

#define BUF_SIZE 8

Definition at line 54 of file project/at_start_f413/examples/i2c/communication_poll/src/main.c.

Referenced by main().

◆ I2C_TIMEOUT

#define I2C_TIMEOUT 0xFFFFFFFF

Definition at line 38 of file project/at_start_f413/examples/i2c/communication_poll/src/main.c.

Referenced by main().

◆ I2Cx_ADDRESS

#define I2Cx_ADDRESS 0xA0

Definition at line 41 of file project/at_start_f413/examples/i2c/communication_poll/src/main.c.

Referenced by i2c_lowlevel_init(), and main().

◆ I2Cx_CLK

#define I2Cx_CLK CRM_I2C1_PERIPH_CLOCK

Definition at line 44 of file project/at_start_f413/examples/i2c/communication_poll/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_PORT

#define I2Cx_PORT I2C1

Definition at line 43 of file project/at_start_f413/examples/i2c/communication_poll/src/main.c.

Referenced by i2c_lowlevel_init(), and main().

◆ I2Cx_SCL_GPIO_CLK

#define I2Cx_SCL_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK

Definition at line 48 of file project/at_start_f413/examples/i2c/communication_poll/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_SCL_GPIO_PORT

#define I2Cx_SCL_GPIO_PORT GPIOB

Definition at line 47 of file project/at_start_f413/examples/i2c/communication_poll/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_SCL_PIN

#define I2Cx_SCL_PIN GPIO_PINS_6

Definition at line 46 of file project/at_start_f413/examples/i2c/communication_poll/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_SDA_GPIO_CLK

#define I2Cx_SDA_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK

Definition at line 52 of file project/at_start_f413/examples/i2c/communication_poll/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_SDA_GPIO_PORT

#define I2Cx_SDA_GPIO_PORT GPIOB

Definition at line 51 of file project/at_start_f413/examples/i2c/communication_poll/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_SDA_PIN

#define I2Cx_SDA_PIN GPIO_PINS_7

Definition at line 50 of file project/at_start_f413/examples/i2c/communication_poll/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_SPEED

#define I2Cx_SPEED 100000

Definition at line 40 of file project/at_start_f413/examples/i2c/communication_poll/src/main.c.

Referenced by i2c_lowlevel_init().

◆ MASTER_BOARD

#define MASTER_BOARD

Definition at line 55 of file project/at_start_f413/examples/i2c/communication_poll/src/main.c.

Function Documentation

◆ buffer_compare()

uint32_t buffer_compare | ( | uint8_t * | buffer1,
 |  | uint8_t * | buffer2,
 |  | uint32_t | len )

compare whether the valus of buffer 1 and buffer 2 are equal.

Parameters
buffer1 buffer 1 address. buffer2: buffer 2 address.
Return values
0 equal. 1: unequal.

Definition at line 87 of file project/at_start_f413/examples/i2c/communication_poll/src/main.c.

Referenced by main().

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/i2c/communication_poll/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/i2c/communication_poll/src/at32f413_int.c.

◆ error_handler()

void error_handler ( uint32_t error_code )

error handler program

Parameters
i2c_status
Return values
none

Definition at line 71 of file project/at_start_f413/examples/i2c/communication_poll/src/main.c.

Referenced by main().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/i2c/communication_poll/src/at32f413_int.c.

◆ i2c_lowlevel_init()

void i2c_lowlevel_init ( i2c_handle_type * hi2c )

initializes peripherals used by the i2c.

Parameters
none
Return values
none

< gpio pins number 6

< gpio pins number 7

Definition at line 107 of file project/at_start_f413/examples/i2c/communication_poll/src/main.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 143 of file project/at_start_f413/examples/i2c/communication_poll/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/i2c/communication_poll/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/i2c/communication_poll/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/i2c/communication_poll/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/i2c/communication_poll/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/i2c/communication_poll/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/i2c/communication_poll/src/at32f413_int.c.

Variable Documentation

◆ hi2cx

i2c_handle_type hi2cx

Definition at line 60 of file project/at_start_f413/examples/i2c/communication_poll/src/main.c.

Referenced by main().

◆ rx_buf

uint8_t rx_buf[8] = {0}

Definition at line 58 of file project/at_start_f413/examples/i2c/communication_poll/src/main.c.

Referenced by main().

◆ tx_buf

uint8_t tx_buf[8] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}

Definition at line 57 of file project/at_start_f413/examples/i2c/communication_poll/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: I2C_eeprom

Macros | Functions | Variables
I2C_eeprom
AT32F413_periph_examples

Macros

#define | I2C_TIMEOUT 0xFFFFFFFF
#define | I2Cx_SPEED 100000
#define | I2Cx_ADDRESS 0xA0
#define | I2Cx_PORT I2C2
#define | I2Cx_CLK CRM_I2C2_PERIPH_CLOCK
#define | I2Cx_SCL_PIN GPIO_PINS_10
#define | I2Cx_SCL_GPIO_PORT GPIOB
#define | I2Cx_SCL_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
#define | I2Cx_SDA_PIN GPIO_PINS_11
#define | I2Cx_SDA_GPIO_PORT GPIOB
#define | I2Cx_SDA_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
#define | I2Cx_DMA_CLK CRM_DMA1_PERIPH_CLOCK
#define | I2Cx_DMA_TX_CHANNEL DMA1_CHANNEL4
#define | I2Cx_DMA_TX_IRQn DMA1_Channel4_IRQn
#define | I2Cx_DMA_RX_CHANNEL DMA1_CHANNEL5
#define | I2Cx_DMA_RX_IRQn DMA1_Channel5_IRQn
#define | I2Cx_EVT_IRQn I2C2_EVT_IRQn
#define | I2Cx_ERR_IRQn I2C2_ERR_IRQn
#define | BUF_SIZE 12

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | DMA1_Channel5_IRQHandler (void)
this function handles dma interrupt request.
void | DMA1_Channel4_IRQHandler (void)
this function handles dma interrupt request.
void | I2C2_EVT_IRQHandler (void)
this function handles i2c event interrupt request.
void | I2C2_ERR_IRQHandler (void)
this function handles i2c error interrupt request.
void | error_handler (uint32_t error_code)
error handler program
uint32_t | buffer_compare (uint8_t *buffer1, uint8_t *buffer2, uint32_t len)
compare whether the valus of buffer 1 and buffer 2 are equal.
void | i2c_lowlevel_init (i2c_handle_type *hi2c)
initializes peripherals used by the i2c.
int | main (void)
main function.

Variables

uint8_t | tx_buf1 [12] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C}
uint8_t | tx_buf2 [12] = {0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80, 0x90, 0xA0, 0xB0, 0xC0}
uint8_t | tx_buf3 [12] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC}
uint8_t | rx_buf1 [12] = {0}
uint8_t | rx_buf2 [12] = {0}
uint8_t | rx_buf3 [12] = {0}
i2c_handle_type hi2cx

Detailed Description

Macro Definition Documentation

◆ BUF_SIZE

#define BUF_SIZE 12

Definition at line 64 of file project/at_start_f413/examples/i2c/eeprom/src/main.c.

Referenced by main().

◆ I2C_TIMEOUT

#define I2C_TIMEOUT 0xFFFFFFFF

Definition at line 38 of file project/at_start_f413/examples/i2c/eeprom/src/main.c.

Referenced by main().

◆ I2Cx_ADDRESS

#define I2Cx_ADDRESS 0xA0

Definition at line 41 of file project/at_start_f413/examples/i2c/eeprom/src/main.c.

Referenced by i2c_lowlevel_init(), and main().

◆ I2Cx_CLK

#define I2Cx_CLK CRM_I2C2_PERIPH_CLOCK

Definition at line 44 of file project/at_start_f413/examples/i2c/eeprom/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_DMA_CLK

#define I2Cx_DMA_CLK CRM_DMA1_PERIPH_CLOCK

Definition at line 54 of file project/at_start_f413/examples/i2c/eeprom/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_DMA_RX_CHANNEL

#define I2Cx_DMA_RX_CHANNEL DMA1_CHANNEL5

Definition at line 58 of file project/at_start_f413/examples/i2c/eeprom/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_DMA_RX_IRQn

#define I2Cx_DMA_RX_IRQn DMA1_Channel5_IRQn

Definition at line 59 of file project/at_start_f413/examples/i2c/eeprom/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_DMA_TX_CHANNEL

#define I2Cx_DMA_TX_CHANNEL DMA1_CHANNEL4

Definition at line 55 of file project/at_start_f413/examples/i2c/eeprom/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_DMA_TX_IRQn

#define I2Cx_DMA_TX_IRQn DMA1_Channel4_IRQn

Definition at line 56 of file project/at_start_f413/examples/i2c/eeprom/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_ERR_IRQn

#define I2Cx_ERR_IRQn I2C2_ERR_IRQn

Definition at line 62 of file project/at_start_f413/examples/i2c/eeprom/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_EVT_IRQn

#define I2Cx_EVT_IRQn I2C2_EVT_IRQn

Definition at line 61 of file project/at_start_f413/examples/i2c/eeprom/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_PORT

#define I2Cx_PORT I2C2

Definition at line 43 of file project/at_start_f413/examples/i2c/eeprom/src/main.c.

Referenced by i2c_lowlevel_init(), and main().

◆ I2Cx_SCL_GPIO_CLK

#define I2Cx_SCL_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK

Definition at line 48 of file project/at_start_f413/examples/i2c/eeprom/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_SCL_GPIO_PORT

#define I2Cx_SCL_GPIO_PORT GPIOB

Definition at line 47 of file project/at_start_f413/examples/i2c/eeprom/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_SCL_PIN

#define I2Cx_SCL_PIN GPIO_PINS_10

Definition at line 46 of file project/at_start_f413/examples/i2c/eeprom/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_SDA_GPIO_CLK

#define I2Cx_SDA_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK

Definition at line 52 of file project/at_start_f413/examples/i2c/eeprom/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_SDA_GPIO_PORT

#define I2Cx_SDA_GPIO_PORT GPIOB

Definition at line 51 of file project/at_start_f413/examples/i2c/eeprom/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_SDA_PIN

#define I2Cx_SDA_PIN GPIO_PINS_11

Definition at line 50 of file project/at_start_f413/examples/i2c/eeprom/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_SPEED

#define I2Cx_SPEED 100000

Definition at line 40 of file project/at_start_f413/examples/i2c/eeprom/src/main.c.

Referenced by i2c_lowlevel_init().

Function Documentation

◆ buffer_compare()

uint32_t buffer_compare | ( | uint8_t * | buffer1,
 |  | uint8_t * | buffer2,
 |  | uint32_t | len )

compare whether the valus of buffer 1 and buffer 2 are equal.

Parameters
buffer1 buffer 1 address. buffer2: buffer 2 address.
Return values
0 equal. 1: unequal.

Definition at line 100 of file project/at_start_f413/examples/i2c/eeprom/src/main.c.

Referenced by main().

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 85 of file project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 120 of file project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c.

◆ DMA1_Channel4_IRQHandler()

void DMA1_Channel4_IRQHandler ( void )

this function handles dma interrupt request.

Parameters
none
Return values
none

Definition at line 157 of file project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c.

◆ DMA1_Channel5_IRQHandler()

void DMA1_Channel5_IRQHandler ( void )

this function handles dma interrupt request.

Parameters
none
Return values
none

Definition at line 147 of file project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c.

◆ error_handler()

void error_handler ( uint32_t error_code )

error handler program

Parameters
i2c_status
Return values
none

Definition at line 84 of file project/at_start_f413/examples/i2c/eeprom/src/main.c.

Referenced by main().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 59 of file project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c.

◆ I2C2_ERR_IRQHandler()

void I2C2_ERR_IRQHandler ( void )

this function handles i2c error interrupt request.

Parameters
none
Return values
none

Definition at line 177 of file project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c.

◆ I2C2_EVT_IRQHandler()

void I2C2_EVT_IRQHandler ( void )

this function handles i2c event interrupt request.

Parameters
none
Return values
none

Definition at line 167 of file project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c.

◆ i2c_lowlevel_init()

void i2c_lowlevel_init ( i2c_handle_type * hi2c )

initializes peripherals used by the i2c.

Parameters
none
Return values
none

< gpio pins number 10

< gpio pins number 11

Definition at line 120 of file project/at_start_f413/examples/i2c/eeprom/src/main.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 187 of file project/at_start_f413/examples/i2c/eeprom/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 72 of file project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 50 of file project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 129 of file project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 111 of file project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 138 of file project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 98 of file project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c.

Variable Documentation

◆ hi2cx

i2c_handle_type hi2cx

Definition at line 73 of file project/at_start_f413/examples/i2c/eeprom/src/main.c.

Referenced by main().

◆ rx_buf1

uint8_t rx_buf1[12] = {0}

Definition at line 69 of file project/at_start_f413/examples/i2c/eeprom/src/main.c.

Referenced by main().

◆ rx_buf2

uint8_t rx_buf2[12] = {0}

Definition at line 70 of file project/at_start_f413/examples/i2c/eeprom/src/main.c.

Referenced by main().

◆ rx_buf3

uint8_t rx_buf3[12] = {0}

Definition at line 71 of file project/at_start_f413/examples/i2c/eeprom/src/main.c.

Referenced by main().

◆ tx_buf1

uint8_t tx_buf1[12] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C}

Definition at line 66 of file project/at_start_f413/examples/i2c/eeprom/src/main.c.

Referenced by main().

◆ tx_buf2

uint8_t tx_buf2[12] = {0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80, 0x90, 0xA0, 0xB0, 0xC0}

Definition at line 67 of file project/at_start_f413/examples/i2c/eeprom/src/main.c.

Referenced by main().

◆ tx_buf3

uint8_t tx_buf3[12] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC}

Definition at line 68 of file project/at_start_f413/examples/i2c/eeprom/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: I2C_memory_write

Macros | Functions | Variables
I2C_memory_write
AT32F413_periph_examples

Macros

#define | I2C_TIMEOUT 0xFFFFFFFF
#define | I2Cx_SPEED 100000
#define | I2Cx_ADDRESS 0xA0
#define | I2Cx_PORT I2C2
#define | I2Cx_CLK CRM_I2C2_PERIPH_CLOCK
#define | I2Cx_SCL_PIN GPIO_PINS_10
#define | I2Cx_SCL_GPIO_PORT GPIOB
#define | I2Cx_SCL_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
#define | I2Cx_SDA_PIN GPIO_PINS_11
#define | I2Cx_SDA_GPIO_PORT GPIOB
#define | I2Cx_SDA_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
#define | I2Cx_DMA_CLK CRM_DMA1_PERIPH_CLOCK
#define | I2Cx_DMA_TX_CHANNEL DMA1_CHANNEL4
#define | I2Cx_DMA_TX_IRQn DMA1_Channel4_IRQn
#define | I2Cx_DMA_RX_CHANNEL DMA1_CHANNEL5
#define | I2Cx_DMA_RX_IRQn DMA1_Channel5_IRQn
#define | I2Cx_EVT_IRQn I2C2_EVT_IRQn
#define | I2Cx_ERR_IRQn I2C2_ERR_IRQn
#define | BUF_SIZE 8

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | DMA1_Channel5_IRQHandler (void)
this function handles dma interrupt request.
void | DMA1_Channel4_IRQHandler (void)
this function handles dma interrupt request.
void | I2C2_EVT_IRQHandler (void)
this function handles i2c event interrupt request.
void | I2C2_ERR_IRQHandler (void)
this function handles i2c error interrupt request.
void | error_handler (uint32_t error_code)
error handler program
uint32_t | buffer_compare (uint8_t *buffer1, uint8_t *buffer2, uint32_t len)
compare whether the valus of buffer 1 and buffer 2 are equal.
void | i2c_lowlevel_init (i2c_handle_type *hi2c)
initializes peripherals used by the i2c.
int | main (void)
main function.

Variables

uint8_t | tx_buf1 [8] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}
uint8_t | tx_buf2 [8] = {0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80}
uint8_t | tx_buf3 [8] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88}
uint8_t | rx_buf1 [8] = {0}
uint8_t | rx_buf2 [8] = {0}
uint8_t | rx_buf3 [8] = {0}
i2c_handle_type hi2cx

Detailed Description

Macro Definition Documentation

◆ BUF_SIZE

#define BUF_SIZE 8

Definition at line 64 of file project/at_start_f413/examples/i2c/memory_write/src/main.c.

Referenced by main().

◆ I2C_TIMEOUT

#define I2C_TIMEOUT 0xFFFFFFFF

Definition at line 38 of file project/at_start_f413/examples/i2c/memory_write/src/main.c.

Referenced by main().

◆ I2Cx_ADDRESS

#define I2Cx_ADDRESS 0xA0

Definition at line 41 of file project/at_start_f413/examples/i2c/memory_write/src/main.c.

Referenced by i2c_lowlevel_init(), and main().

◆ I2Cx_CLK

#define I2Cx_CLK CRM_I2C2_PERIPH_CLOCK

Definition at line 44 of file project/at_start_f413/examples/i2c/memory_write/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_DMA_CLK

#define I2Cx_DMA_CLK CRM_DMA1_PERIPH_CLOCK

Definition at line 54 of file project/at_start_f413/examples/i2c/memory_write/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_DMA_RX_CHANNEL

#define I2Cx_DMA_RX_CHANNEL DMA1_CHANNEL5

Definition at line 58 of file project/at_start_f413/examples/i2c/memory_write/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_DMA_RX_IRQn

#define I2Cx_DMA_RX_IRQn DMA1_Channel5_IRQn

Definition at line 59 of file project/at_start_f413/examples/i2c/memory_write/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_DMA_TX_CHANNEL

#define I2Cx_DMA_TX_CHANNEL DMA1_CHANNEL4

Definition at line 55 of file project/at_start_f413/examples/i2c/memory_write/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_DMA_TX_IRQn

#define I2Cx_DMA_TX_IRQn DMA1_Channel4_IRQn

Definition at line 56 of file project/at_start_f413/examples/i2c/memory_write/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_ERR_IRQn

#define I2Cx_ERR_IRQn I2C2_ERR_IRQn

Definition at line 62 of file project/at_start_f413/examples/i2c/memory_write/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_EVT_IRQn

#define I2Cx_EVT_IRQn I2C2_EVT_IRQn

Definition at line 61 of file project/at_start_f413/examples/i2c/memory_write/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_PORT

#define I2Cx_PORT I2C2

Definition at line 43 of file project/at_start_f413/examples/i2c/memory_write/src/main.c.

Referenced by i2c_lowlevel_init(), and main().

◆ I2Cx_SCL_GPIO_CLK

#define I2Cx_SCL_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK

Definition at line 48 of file project/at_start_f413/examples/i2c/memory_write/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_SCL_GPIO_PORT

#define I2Cx_SCL_GPIO_PORT GPIOB

Definition at line 47 of file project/at_start_f413/examples/i2c/memory_write/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_SCL_PIN

#define I2Cx_SCL_PIN GPIO_PINS_10

Definition at line 46 of file project/at_start_f413/examples/i2c/memory_write/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_SDA_GPIO_CLK

#define I2Cx_SDA_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK

Definition at line 52 of file project/at_start_f413/examples/i2c/memory_write/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_SDA_GPIO_PORT

#define I2Cx_SDA_GPIO_PORT GPIOB

Definition at line 51 of file project/at_start_f413/examples/i2c/memory_write/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_SDA_PIN

#define I2Cx_SDA_PIN GPIO_PINS_11

Definition at line 50 of file project/at_start_f413/examples/i2c/memory_write/src/main.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_SPEED

#define I2Cx_SPEED 100000

Definition at line 40 of file project/at_start_f413/examples/i2c/memory_write/src/main.c.

Referenced by i2c_lowlevel_init().

Function Documentation

◆ buffer_compare()

uint32_t buffer_compare | ( | uint8_t * | buffer1,
 |  | uint8_t * | buffer2,
 |  | uint32_t | len )

compare whether the valus of buffer 1 and buffer 2 are equal.

Parameters
buffer1 buffer 1 address. buffer2: buffer 2 address.
Return values
0 equal. 1: unequal.

Definition at line 100 of file project/at_start_f413/examples/i2c/memory_write/src/main.c.

Referenced by main().

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 85 of file project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 120 of file project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c.

◆ DMA1_Channel4_IRQHandler()

void DMA1_Channel4_IRQHandler ( void )

this function handles dma interrupt request.

Parameters
none
Return values
none

Definition at line 157 of file project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c.

◆ DMA1_Channel5_IRQHandler()

void DMA1_Channel5_IRQHandler ( void )

this function handles dma interrupt request.

Parameters
none
Return values
none

Definition at line 147 of file project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c.

◆ error_handler()

void error_handler ( uint32_t error_code )

error handler program

Parameters
i2c_status
Return values
none

Definition at line 84 of file project/at_start_f413/examples/i2c/memory_write/src/main.c.

Referenced by main().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 59 of file project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c.

◆ I2C2_ERR_IRQHandler()

void I2C2_ERR_IRQHandler ( void )

this function handles i2c error interrupt request.

Parameters
none
Return values
none

Definition at line 177 of file project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c.

◆ I2C2_EVT_IRQHandler()

void I2C2_EVT_IRQHandler ( void )

this function handles i2c event interrupt request.

Parameters
none
Return values
none

Definition at line 167 of file project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c.

◆ i2c_lowlevel_init()

void i2c_lowlevel_init ( i2c_handle_type * hi2c )

initializes peripherals used by the i2c.

Parameters
none
Return values
none

< gpio pins number 10

< gpio pins number 11

Definition at line 120 of file project/at_start_f413/examples/i2c/memory_write/src/main.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 187 of file project/at_start_f413/examples/i2c/memory_write/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 72 of file project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 50 of file project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 129 of file project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 111 of file project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 138 of file project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 98 of file project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c.

Variable Documentation

◆ hi2cx

i2c_handle_type hi2cx

Definition at line 73 of file project/at_start_f413/examples/i2c/memory_write/src/main.c.

Referenced by main().

◆ rx_buf1

uint8_t rx_buf1[8] = {0}

Definition at line 69 of file project/at_start_f413/examples/i2c/memory_write/src/main.c.

Referenced by main().

◆ rx_buf2

uint8_t rx_buf2[8] = {0}

Definition at line 70 of file project/at_start_f413/examples/i2c/memory_write/src/main.c.

Referenced by main().

◆ rx_buf3

uint8_t rx_buf3[8] = {0}

Definition at line 71 of file project/at_start_f413/examples/i2c/memory_write/src/main.c.

Referenced by main().

◆ tx_buf1

uint8_t tx_buf1[8] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}

Definition at line 66 of file project/at_start_f413/examples/i2c/memory_write/src/main.c.

Referenced by main().

◆ tx_buf2

uint8_t tx_buf2[8] = {0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80}

Definition at line 67 of file project/at_start_f413/examples/i2c/memory_write/src/main.c.

Referenced by main().

◆ tx_buf3

uint8_t tx_buf3[8] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88}

Definition at line 68 of file project/at_start_f413/examples/i2c/memory_write/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: I2S_halfduplex_dma

Functions | Variables
I2S_halfduplex_dma
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
error_status | buffer_compare (uint16_t *pbuffer1, uint16_t *pbuffer2, uint16_t buffer_length)
buffer_compare function.
static void | dma_config (void)
dma configuration.
static void | i2s_config (void)
i2s configuration.
static void | gpio_config (void)
gpio configuration.
int | main (void)
main function.

Variables

uint16_t | i2s1_buffer_tx [32]
uint16_t | i2s2_buffer_rx [32]
volatile error_status | transfer_status = ERROR

Detailed Description

Function Documentation

◆ buffer_compare()

error_status buffer_compare | ( | uint16_t * | pbuffer1,
 |  | uint16_t * | pbuffer2,
 |  | uint16_t | buffer_length )

buffer_compare function.

Parameters
none
Return values
the result of compare

Definition at line 53 of file project/at_start_f413/examples/i2s/halfduplex_dma/src/main.c.

Referenced by main().

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 78 of file project/at_start_f413/examples/i2s/halfduplex_dma/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 113 of file project/at_start_f413/examples/i2s/halfduplex_dma/src/at32f413_int.c.

◆ dma_config()

static void dma_config ( void )
static

dma configuration.

Parameters
none
Return values
none

Definition at line 73 of file project/at_start_f413/examples/i2s/halfduplex_dma/src/main.c.

Referenced by main().

◆ gpio_config()

static void gpio_config ( void )
static

gpio configuration.

Parameters
none
Return values
none

< jtag-dp disabled and sw-dp enabled

< spi1_cs/i2s1_ws(pa15), spi1_sck/i2s1_ck(pb3), spi1_miso(pb4), spi1_mosi/i2s1_sd(pb5), i2s1_mck(pb6)

< spi1_cs/i2s1_ws(pa15), spi1_sck/i2s1_ck(pb3), spi1_miso(pb4), spi1_mosi/i2s1_sd(pb5), i2s1_mck(pb0)

< gpio pins number 15

< gpio pins number 3

< gpio pins number 5

< gpio pins number 6

< gpio pins number 12

< gpio pins number 13

< gpio pins number 15

Definition at line 160 of file project/at_start_f413/examples/i2s/halfduplex_dma/src/main.c.

Referenced by main().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 52 of file project/at_start_f413/examples/i2s/halfduplex_dma/src/at32f413_int.c.

◆ i2s_config()

static void i2s_config ( void )
static

i2s configuration.

Parameters
none
Return values
none

Definition at line 115 of file project/at_start_f413/examples/i2s/halfduplex_dma/src/main.c.

Referenced by main().

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< dma1 channel4 full data transfer flag

< spi or i2s busy flag

< spi or i2s busy flag

Definition at line 221 of file project/at_start_f413/examples/i2s/halfduplex_dma/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 65 of file project/at_start_f413/examples/i2s/halfduplex_dma/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 43 of file project/at_start_f413/examples/i2s/halfduplex_dma/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 122 of file project/at_start_f413/examples/i2s/halfduplex_dma/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 104 of file project/at_start_f413/examples/i2s/halfduplex_dma/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 131 of file project/at_start_f413/examples/i2s/halfduplex_dma/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 91 of file project/at_start_f413/examples/i2s/halfduplex_dma/src/at32f413_int.c.

Variable Documentation

◆ i2s1_buffer_tx

uint16_t i2s1_buffer_tx[32]
Initial value:
= {0x0102, 0x0304, 0x0506, 0x0708, 0x090A, 0x0B0C,
0x0D0E, 0x0F10, 0x1112, 0x1314, 0x1516, 0x1718,
0x191A, 0x1B1C, 0x1D1E, 0x1F20, 0x2122, 0x2324,
0x2526, 0x2728, 0x292A, 0x2B2C, 0x2D2E, 0x2F30,
0x3132, 0x3334, 0x3536, 0x3738, 0x393A, 0x3B3C,
0x3D3E, 0x3F40}

Definition at line 39 of file project/at_start_f413/examples/i2s/halfduplex_dma/src/main.c.

Referenced by dma_config(), and main().

◆ i2s2_buffer_rx

uint16_t i2s2_buffer_rx[32]

Definition at line 45 of file project/at_start_f413/examples/i2s/halfduplex_dma/src/main.c.

Referenced by dma_config(), and main().

◆ transfer_status

volatile error_status transfer_status = ERROR

Definition at line 46 of file project/at_start_f413/examples/i2s/halfduplex_dma/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: I2S_halfduplex_interrupt

Functions | Variables
I2S_halfduplex_interrupt
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
error_status | buffer_compare (uint16_t *pbuffer1, uint16_t *pbuffer2, uint16_t buffer_length)
buffer_compare function.
error_status | buffer_compare_24bits (uint16_t *pbuffer1, uint16_t *pbuffer2, uint16_t buffer_length)
buffer_compare_24bits function.
static void | i2s_config (i2s_data_channel_format_type format, i2s_audio_sampling_freq_type freq)
i2s configuration.
static void | gpio_config (void)
gpio configuration.
void | SPI2_IRQHandler (void)
spi2 interrupt function
void | SPI1_IRQHandler (void)
spi1 interrupt function
int | main (void)
main function.

Variables

uint16_t | i2s1_buffer_tx [32]
uint16_t | i2s2_buffer_rx [32]
__IO uint32_t | tx_index = 0
__IO uint32_t | rx_index = 0
volatile error_status | transfer_status1 = ERROR
volatile error_status | transfer_status2 = ERROR

Detailed Description

Function Documentation

◆ buffer_compare()

error_status buffer_compare | ( | uint16_t * | pbuffer1,
 |  | uint16_t * | pbuffer2,
 |  | uint16_t | buffer_length )

buffer_compare function.

Parameters
none
Return values
the result of compare

Definition at line 53 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c.

Referenced by main().

◆ buffer_compare_24bits()

error_status buffer_compare_24bits | ( | uint16_t * | pbuffer1,
 |  | uint16_t * | pbuffer2,
 |  | uint16_t | buffer_length )

buffer_compare_24bits function.

Parameters
none
Return values
the result of compare

Definition at line 73 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c.

Referenced by main().

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/src/at32f413_int.c.

◆ gpio_config()

static void gpio_config ( void )
static

gpio configuration.

Parameters
none
Return values
none

< jtag-dp disabled and sw-dp enabled

< spi1_cs/i2s1_ws(pa15), spi1_sck/i2s1_ck(pb3), spi1_miso(pb4), spi1_mosi/i2s1_sd(pb5), i2s1_mck(pb6)

< spi1_cs/i2s1_ws(pa15), spi1_sck/i2s1_ck(pb3), spi1_miso(pb4), spi1_mosi/i2s1_sd(pb5), i2s1_mck(pb0)

< gpio pins number 15

< gpio pins number 3

< gpio pins number 5

< gpio pins number 6

< gpio pins number 12

< gpio pins number 13

< gpio pins number 15

Definition at line 141 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c.

Referenced by main().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/src/at32f413_int.c.

◆ i2s_config()

static void i2s_config | ( | i2s_data_channel_format_type | format,
 |  | i2s_audio_sampling_freq_type | freq )
 static

i2s configuration.

Parameters
none
Return values
none

< transmit data buffer empty interrupt

< receive data buffer full interrupt

Definition at line 96 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< spi or i2s busy flag

< spi or i2s busy flag

< spi or i2s busy flag

< spi or i2s busy flag

Definition at line 232 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/src/at32f413_int.c.

◆ SPI1_IRQHandler()

void SPI1_IRQHandler ( void )

spi1 interrupt function

Parameters
none
Return values
none

< spi or i2s transmit data buffer empty flag

< transmit data buffer empty interrupt

Definition at line 215 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c.

◆ SPI2_IRQHandler()

void SPI2_IRQHandler ( void )

spi2 interrupt function

Parameters
none
Return values
none

< spi or i2s receive data buffer full flag

Definition at line 202 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/src/at32f413_int.c.

Variable Documentation

◆ i2s1_buffer_tx

uint16_t i2s1_buffer_tx[32]
Initial value:
= {0x0102, 0x0304, 0x0506, 0x0708, 0x090A, 0x0B0C,
0x0D0E, 0x0F10, 0x1112, 0x1314, 0x1516, 0x1718,
0x191A, 0x1B1C, 0x1D1E, 0x1F20, 0x2122, 0x2324,
0x2526, 0x2728, 0x292A, 0x2B2C, 0x2D2E, 0x2F30,
0x3132, 0x3334, 0x3536, 0x3738, 0x393A, 0x3B3C,
0x3D3E, 0x3F40}

Definition at line 38 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c.

Referenced by main(), and SPI1_IRQHandler().

◆ i2s2_buffer_rx

uint16_t i2s2_buffer_rx[32]

Definition at line 44 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c.

Referenced by main(), and SPI2_IRQHandler().

◆ rx_index

__IO uint32_t rx_index = 0

Definition at line 45 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c.

Referenced by main(), and SPI2_IRQHandler().

◆ transfer_status1

volatile error_status transfer_status1 = ERROR

Definition at line 46 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c.

Referenced by main().

◆ transfer_status2

volatile error_status transfer_status2 = ERROR

Definition at line 46 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c.

Referenced by main().

◆ tx_index

__IO uint32_t tx_index = 0

Definition at line 45 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c.

Referenced by main(), and SPI1_IRQHandler().


AT32F413 Firmwary Library: I2S_spii2s_switch_halfduplex_polling

Macros | Functions | Variables
I2S_spii2s_switch_halfduplex_polling
AT32F413_periph_examples

Macros

#define | SPI_MASTER_CS_HIGH gpio_bits_set(GPIOA, GPIO_PINS_15)
#define | SPI_MASTER_CS_LOW gpio_bits_reset(GPIOA, GPIO_PINS_15)

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
error_status | buffer_compare (uint16_t *pbuffer1, uint16_t *pbuffer2, uint16_t buffer_length)
buffer_compare function.
static void | i2s_config (i2s_operation_mode_type i2s1_mode, i2s_operation_mode_type i2s2_mode)
i2s configuration.
static void | spi_config (void)
spi configuration.
static void | gpio_config (uint16_t spi_i2s_mode)
gpio configuration.
int | main (void)
main function.

Variables

uint16_t | i2s1_buffer_tx [32]
uint16_t | spi1_buffer_tx [32]
uint16_t | i2s2_buffer_rx [32]
uint16_t | spi2_buffer_rx [32]
__IO uint32_t | tx_index = 0
__IO uint32_t | rx_index = 0
volatile error_status | transfer_status1 = ERROR
volatile error_status | transfer_status2 = ERROR
volatile error_status | transfer_status3 = ERROR

Detailed Description

Macro Definition Documentation

◆ SPI_MASTER_CS_HIGH

#define SPI_MASTER_CS_HIGH gpio_bits_set(GPIOA, GPIO_PINS_15)

Definition at line 38 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c.

Referenced by gpio_config(), and main().

◆ SPI_MASTER_CS_LOW

#define SPI_MASTER_CS_LOW gpio_bits_reset(GPIOA, GPIO_PINS_15)

Definition at line 39 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c.

Referenced by main().

Function Documentation

◆ buffer_compare()

error_status buffer_compare | ( | uint16_t * | pbuffer1,
 |  | uint16_t * | pbuffer2,
 |  | uint16_t | buffer_length )

buffer_compare function.

Parameters
none
Return values
the result of compare

Definition at line 65 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c.

Referenced by main().

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 78 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 113 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/at32f413_int.c.

◆ gpio_config()

static void gpio_config ( uint16_t spi_i2s_mode )
static

gpio configuration.

Parameters
spi_i2s_mode:select spi or i2s to be use
  • 0 (spi mode)
  • 1 (i2s mode)
Return values
none

< jtag-dp disabled and sw-dp enabled

< spi1_cs/i2s1_ws(pa15), spi1_sck/i2s1_ck(pb3), spi1_miso(pb4), spi1_mosi/i2s1_sd(pb5), i2s1_mck(pb6)

< spi1_cs/i2s1_ws(pa15), spi1_sck/i2s1_ck(pb3), spi1_miso(pb4), spi1_mosi/i2s1_sd(pb5), i2s1_mck(pb0)

< gpio pins number 15

< gpio pins number 15

< gpio pins number 3

< gpio pins number 5

< gpio pins number 12

< gpio pins number 13

< gpio pins number 15

Definition at line 166 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 52 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/at32f413_int.c.

◆ i2s_config()

static void i2s_config | ( | i2s_operation_mode_type | i2s1_mode,
 |  | i2s_operation_mode_type | i2s2_mode )
 static

i2s configuration.

Parameters
none
Return values
none

Definition at line 85 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< spi or i2s transmit data buffer empty flag

< spi or i2s receive data buffer full flag

< spi or i2s busy flag

< spi or i2s busy flag

< gpio pins number 15

< spi or i2s transmit data buffer empty flag

< spi or i2s receive data buffer full flag

< spi or i2s busy flag

< spi or i2s busy flag

< gpio pins number 15

< spi or i2s transmit data buffer empty flag

< spi or i2s receive data buffer full flag

< spi or i2s transmit data buffer empty flag

Definition at line 232 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 65 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 43 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 122 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/at32f413_int.c.

◆ spi_config()

static void spi_config ( void )
static

spi configuration.

Parameters
none
Return values
none

Definition at line 119 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c.

Referenced by main().

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 104 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 131 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 91 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/at32f413_int.c.

Variable Documentation

◆ i2s1_buffer_tx

uint16_t i2s1_buffer_tx[32]
Initial value:
= {0x0102, 0x0304, 0x0506, 0x0708, 0x090A, 0x0B0C,
0x0D0E, 0x0F10, 0x1112, 0x1314, 0x1516, 0x1718,
0x191A, 0x1B1C, 0x1D1E, 0x1F20, 0x2122, 0x2324,
0x2526, 0x2728, 0x292A, 0x2B2C, 0x2D2E, 0x2F30,
0x3132, 0x3334, 0x3536, 0x3738, 0x393A, 0x3B3C,
0x3D3E, 0x3F40
}

Definition at line 41 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c.

Referenced by main().

◆ i2s2_buffer_rx

uint16_t i2s2_buffer_rx[32]

Definition at line 55 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c.

Referenced by main().

◆ rx_index

__IO uint32_t rx_index = 0

Definition at line 57 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c.

Referenced by main().

◆ spi1_buffer_tx

uint16_t spi1_buffer_tx[32]
Initial value:
= {0x5152, 0x5354, 0x5556, 0x5758, 0x595A, 0x5B5C,
0x5D5E, 0x5F60, 0x6162, 0x6364, 0x6566, 0x6768,
0x696A, 0x6B6C, 0x6D6E, 0x6F70, 0x7172, 0x7374,
0x7576, 0x7778, 0x797A, 0x7B7C, 0x7D7E, 0x7F80,
0x8182, 0x8384, 0x8586, 0x8788, 0x898A, 0x8B8C,
0x8D8E, 0x8F90
}

Definition at line 48 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c.

Referenced by main().

◆ spi2_buffer_rx

uint16_t spi2_buffer_rx[32]

Definition at line 56 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c.

Referenced by main().

◆ transfer_status1

volatile error_status transfer_status1 = ERROR

Definition at line 58 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c.

Referenced by main().

◆ transfer_status2

volatile error_status transfer_status2 = ERROR

Definition at line 58 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c.

Referenced by main().

◆ transfer_status3

volatile error_status transfer_status3 = ERROR

Definition at line 58 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c.

Referenced by main().

◆ tx_index

__IO uint32_t tx_index = 0

Definition at line 57 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: PWC_deepsleep_rtc

Functions
PWC_deepsleep_rtc
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | RTCAlarm_IRQHandler (void)
this function handles the rtc alarm through exint line interrupt request.
void | rtc_config (void)
rtc configuration.
void | system_clock_recover (void)
systemclock recover.
int | main (void)
main function.

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 80 of file project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 115 of file project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 54 of file project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< rtc time second flag

< rtc time second flag

< value of the high speed internal clock in hz

< value of the high speed internal clock in hz

Definition at line 126 of file project/at_start_f413/examples/pwc/deepsleep_rtc/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 67 of file project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 45 of file project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 124 of file project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_int.c.

◆ rtc_config()

void rtc_config ( void )

rtc configuration.

Parameters
none
Return values
none

< external interrupt line 17 connected to the rtc alarm event

< low speed internal clock stable flag

< rtc time alarm interrupt

Definition at line 44 of file project/at_start_f413/examples/pwc/deepsleep_rtc/src/main.c.

Referenced by main().

◆ RTCAlarm_IRQHandler()

void RTCAlarm_IRQHandler ( void )

this function handles the rtc alarm through exint line interrupt request.

Parameters
none
Return values
none

< rtc time alarm flag

< external interrupt line 17 connected to the rtc alarm event

< rtc time alarm flag

Definition at line 142 of file project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 106 of file project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_int.c.

◆ system_clock_recover()

void system_clock_recover ( void )

systemclock recover.

Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 97 of file project/at_start_f413/examples/pwc/deepsleep_rtc/src/main.c.

Referenced by main().

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 133 of file project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 93 of file project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_int.c.


AT32F413 Firmwary Library: PWC_power_voltage_monitor

Functions
PWC_power_voltage_monitor
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | PVM_IRQHandler (void)
this function handles the power voltage monitoring output interrupt request.
void | pvm_exint_config (void)
power voltage monitor exint configuration.
int | main (void)
main function.

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 80 of file project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 115 of file project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 54 of file project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< external interrupt line 16 connected to the pvm output

< external interrupt line 16 connected to the pvm output

Definition at line 61 of file project/at_start_f413/examples/pwc/power_voltage_monitor/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 67 of file project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 45 of file project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 124 of file project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_int.c.

◆ pvm_exint_config()

void pvm_exint_config ( void )

power voltage monitor exint configuration.

Parameters
none
Return values
none

< external interrupt line 16 connected to the pvm output

Definition at line 44 of file project/at_start_f413/examples/pwc/power_voltage_monitor/src/main.c.

Referenced by main().

◆ PVM_IRQHandler()

void PVM_IRQHandler ( void )

this function handles the power voltage monitoring output interrupt request.

Parameters
none
Return values
none

< external interrupt line 16 connected to the pvm output

< external interrupt line 16 connected to the pvm output

Definition at line 142 of file project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 106 of file project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 133 of file project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 93 of file project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_int.c.


AT32F413 Firmwary Library: PWC_sleep_tmr2

Functions
PWC_sleep_tmr2
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | TMR2_GLOBAL_IRQHandler (void)
this function handles the timer interrupt request.
void | tmr2_config (void)
tmr2 configuration.
int | main (void)
main function.

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 79 of file project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 114 of file project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 53 of file project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 78 of file project/at_start_f413/examples/pwc/sleep_tmr2/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 66 of file project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 44 of file project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 123 of file project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 105 of file project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 132 of file project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_int.c.

◆ tmr2_config()

void tmr2_config ( void )

tmr2 configuration.

Parameters
none
Return values
none

< tmr interrupt overflow

Definition at line 44 of file project/at_start_f413/examples/pwc/sleep_tmr2/src/main.c.

Referenced by main().

◆ TMR2_GLOBAL_IRQHandler()

void TMR2_GLOBAL_IRQHandler ( void )

this function handles the timer interrupt request.

Parameters
none
Return values
none

< tmr flag overflow

< tmr flag overflow

Definition at line 141 of file project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 92 of file project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_int.c.


AT32F413 Firmwary Library: PWC_sleep_usart1

Functions | Variables
PWC_sleep_usart1
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | USART1_IRQHandler (void)
this function handles the usatt interrupt request.
void | usart1_config (uint32_t baudrate)
usart1 configuration.
int | main (void)
main function.

Variables

uint16_t usart1_index = 0

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 81 of file project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 116 of file project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 55 of file project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 84 of file project/at_start_f413/examples/pwc/sleep_usart1/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 68 of file project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 46 of file project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 125 of file project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 107 of file project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 134 of file project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 94 of file project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c.

◆ usart1_config()

void usart1_config ( uint32_t baudrate )

usart1 configuration.

Parameters
none
Return values
none

< gpio pins number 9

< gpio pins number 10

< usart receive data buffer full interrupt

Definition at line 42 of file project/at_start_f413/examples/pwc/sleep_usart1/src/main.c.

Referenced by main().

◆ USART1_IRQHandler()

void USART1_IRQHandler ( void )

this function handles the usatt interrupt request.

Parameters
none
Return values
none

< usart receive data buffer full flag

Definition at line 143 of file project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c.

Variable Documentation

◆ usart1_index

uint16_t usart1_index = 0

Definition at line 40 of file project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c.

Referenced by USART1_IRQHandler().


AT32F413 Firmwary Library: PWC_standby_rtc

Functions
PWC_standby_rtc
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | rtc_config (void)
rtc configuration.
void | rtc_alarm_config (uint8_t alarm_time)
rtc alarm set.
int | main (void)
main function.

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 80 of file project/at_start_f413/examples/pwc/standby_rtc/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 115 of file project/at_start_f413/examples/pwc/standby_rtc/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 54 of file project/at_start_f413/examples/pwc/standby_rtc/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< standby flag

< standby flag

< wakeup flag

< wakeup flag

Definition at line 100 of file project/at_start_f413/examples/pwc/standby_rtc/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 67 of file project/at_start_f413/examples/pwc/standby_rtc/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 45 of file project/at_start_f413/examples/pwc/standby_rtc/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 124 of file project/at_start_f413/examples/pwc/standby_rtc/src/at32f413_int.c.

◆ rtc_alarm_config()

void rtc_alarm_config ( uint8_t alarm_time )

rtc alarm set.

Parameters
none
Return values
none

< rtc time second flag

< rtc time second flag

Definition at line 80 of file project/at_start_f413/examples/pwc/standby_rtc/src/main.c.

Referenced by main().

◆ rtc_config()

void rtc_config ( void )

rtc configuration.

Parameters
none
Return values
none

< low speed internal clock stable flag

Definition at line 45 of file project/at_start_f413/examples/pwc/standby_rtc/src/main.c.

Referenced by main().

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 106 of file project/at_start_f413/examples/pwc/standby_rtc/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 133 of file project/at_start_f413/examples/pwc/standby_rtc/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 93 of file project/at_start_f413/examples/pwc/standby_rtc/src/at32f413_int.c.


AT32F413 Firmwary Library: PWC_standby_wakeup_pin

Functions
PWC_standby_wakeup_pin
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
int | main (void)
main function.

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 78 of file project/at_start_f413/examples/pwc/standby_wakeup_pin/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 113 of file project/at_start_f413/examples/pwc/standby_wakeup_pin/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 52 of file project/at_start_f413/examples/pwc/standby_wakeup_pin/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< standby flag

< standby flag

< wakeup flag

< wakeup flag

< standby wake-up pin1(pa0)

Definition at line 43 of file project/at_start_f413/examples/pwc/standby_wakeup_pin/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 65 of file project/at_start_f413/examples/pwc/standby_wakeup_pin/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 43 of file project/at_start_f413/examples/pwc/standby_wakeup_pin/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 122 of file project/at_start_f413/examples/pwc/standby_wakeup_pin/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 104 of file project/at_start_f413/examples/pwc/standby_wakeup_pin/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 131 of file project/at_start_f413/examples/pwc/standby_wakeup_pin/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 91 of file project/at_start_f413/examples/pwc/standby_wakeup_pin/src/at32f413_int.c.


AT32F413 Firmwary Library: RTC_calendar

Topics | Functions | Variables
RTC_calendar
AT32F413_periph_examples

Topics

RTC_calendar_type
RTC_calendar_exported_functions

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | RTC_IRQHandler (void)
this function handles rtc handler.
void | alarm_init (void)
init alarm.
int | main (void)
main function.
uint8_t | rtc_init (calendar_type *calendar)
rtc peripheral initialization.
uint8_t | is_leap_year (uint16_t year)
judeg the leap year or common year.
uint8_t | rtc_time_set (calendar_type *calendar)
set time. convert the input clock to a second. the time basic : 1970.1.1 legitimate year: 1970 ~ 2099
uint8_t | rtc_alarm_clock_set (calendar_type *calendar)
set rtc alarm clock. the time basic : 1970.1.1 legitimate year: 1970 ~ 2099
uint8_t | rtc_week_get (uint16_t year, uint8_t month, uint8_t day)
get current week by input leap year\mouth\day.
void | rtc_time_get (void)
get current time.

Variables

calendar_type calendar
char const | weekday_table [7][10] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}
calendar_type calendar
const uint8_t | table_week [12] = {0, 3, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5}
const uint8_t | mon_table [12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}

Detailed Description

Function Documentation

◆ alarm_init()

void alarm_init ( void )

init alarm.

Parameters
none
Return values
none

< rtc time alarm flag

< rtc time alarm interrupt

Definition at line 45 of file project/at_start_f413/examples/rtc/calendar/src/main.c.

Referenced by main().

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 78 of file project/at_start_f413/examples/rtc/calendar/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 113 of file project/at_start_f413/examples/rtc/calendar/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 52 of file project/at_start_f413/examples/rtc/calendar/src/at32f413_int.c.

◆ is_leap_year()

uint8_t is_leap_year ( uint16_t year )

judeg the leap year or common year.

  • month 1 2 3 4 5 6 7 8 9 10 11 12
  • leap year 31 29 31 30 31 30 31 31 30 31 30 31
  • common year 31 28 31 30 31 30 31 31 30 31 30 31
    Parameters
    year
    Return values
    1 leap year 2: common year

Definition at line 116 of file rtc.c.

Referenced by rtc_alarm_clock_set(), rtc_time_get(), and rtc_time_set().

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< rtc time second flag

< rtc time second flag

Definition at line 81 of file project/at_start_f413/examples/rtc/calendar/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 65 of file project/at_start_f413/examples/rtc/calendar/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 43 of file project/at_start_f413/examples/rtc/calendar/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 122 of file project/at_start_f413/examples/rtc/calendar/src/at32f413_int.c.

◆ rtc_alarm_clock_set()

uint8_t rtc_alarm_clock_set ( calendar_type * calendar )

set rtc alarm clock. the time basic : 1970.1.1 legitimate year: 1970 ~ 2099

Parameters
calendar
Return values
0 set alarm right. 1: set alarm failed.

Definition at line 216 of file rtc.c.

Referenced by alarm_init().

◆ rtc_init()

uint8_t rtc_init ( calendar_type * calendar )

rtc peripheral initialization.

Parameters
calendar
Return values
0 rtc already init 1: rtc init

Definition at line 50 of file rtc.c.

Referenced by main().

◆ RTC_IRQHandler()

void RTC_IRQHandler ( void )

this function handles rtc handler.

Parameters
none
Return values
none

< rtc time alarm flag

< rtc time alarm flag

Definition at line 141 of file project/at_start_f413/examples/rtc/calendar/src/at32f413_int.c.

◆ rtc_time_get()

void rtc_time_get ( void )

get current time.

Parameters
none.
Return values
none.

Definition at line 308 of file rtc.c.

Referenced by main().

◆ rtc_time_set()

uint8_t rtc_time_set ( calendar_type * calendar )

set time. convert the input clock to a second. the time basic : 1970.1.1 legitimate year: 1970 ~ 2099

Parameters
calendar
Return values
0 set time right. 1: set time failed.

Definition at line 150 of file rtc.c.

Referenced by rtc_init().

◆ rtc_week_get()

uint8_t rtc_week_get | ( | uint16_t | year,
 |  | uint8_t | month,
 |  | uint8_t | day )

get current week by input leap year\mouth\day.

Parameters
year | : year
mon | : month
day | : day
Return values
week number.

Definition at line 278 of file rtc.c.

Referenced by rtc_time_get().

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 104 of file project/at_start_f413/examples/rtc/calendar/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 131 of file project/at_start_f413/examples/rtc/calendar/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 91 of file project/at_start_f413/examples/rtc/calendar/src/at32f413_int.c.

Variable Documentation

◆ calendar [1/2]

calendar_type calendar
extern

Definition at line 36 of file rtc.c.

Referenced by main(), rtc_alarm_clock_set(), rtc_init(), rtc_time_get(), and rtc_time_set().

◆ calendar [2/2]

calendar_type calendar

Definition at line 36 of file rtc.c.

Referenced by main(), rtc_alarm_clock_set(), rtc_init(), rtc_time_get(), and rtc_time_set().

◆ mon_table

const uint8_t mon_table[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}

Definition at line 42 of file rtc.c.

Referenced by rtc_alarm_clock_set(), rtc_time_get(), and rtc_time_set().

◆ table_week

const uint8_t table_week[12] = {0, 3, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5}

Definition at line 39 of file rtc.c.

Referenced by rtc_week_get().

◆ weekday_table

char const weekday_table[7][10] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}

Definition at line 38 of file project/at_start_f413/examples/rtc/calendar/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: RTC_calendar_type

Data Structures
RTC_calendar_type
AT32F413_periph_examples » RTC_calendar

Data Structures

struct calendar_type

Detailed Description

Generated by doxygen 1.12.0


AT32F413 Firmwary Library: calendar_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
calendar_type Struct Reference
AT32F413_periph_examples » RTC_calendar » RTC_calendar_type

#include <rtc.h>

Data Fields

__IO uint16_t | year
__IO uint8_t | month
__IO uint8_t | date
__IO uint8_t | hour
__IO uint8_t | min
__IO uint8_t | sec
__IO uint8_t | week

Detailed Description

Definition at line 47 of file rtc.h.

Field Documentation

◆ date

__IO uint8_t calendar_type::date

specifies the date of calendar.

Definition at line 51 of file rtc.h.

Referenced by alarm_init(), main(), rtc_alarm_clock_set(), rtc_time_get(), and rtc_time_set().

◆ hour

__IO uint8_t calendar_type::hour

specifies the hours of calendar.

Definition at line 52 of file rtc.h.

Referenced by alarm_init(), main(), rtc_alarm_clock_set(), rtc_time_get(), and rtc_time_set().

◆ min

__IO uint8_t calendar_type::min

specifies the minutes of calendar.

Definition at line 53 of file rtc.h.

Referenced by alarm_init(), main(), rtc_alarm_clock_set(), rtc_time_get(), and rtc_time_set().

◆ month

__IO uint8_t calendar_type::month

specifies the months of calendar.

Definition at line 50 of file rtc.h.

Referenced by alarm_init(), main(), rtc_alarm_clock_set(), rtc_time_get(), and rtc_time_set().

◆ sec

__IO uint8_t calendar_type::sec

specifies the second of calendar.

Definition at line 54 of file rtc.h.

Referenced by alarm_init(), main(), rtc_alarm_clock_set(), rtc_time_get(), and rtc_time_set().

◆ week

__IO uint8_t calendar_type::week

specifies the weeks of calendar.

Definition at line 55 of file rtc.h.

Referenced by main(), and rtc_time_get().

◆ year

__IO uint16_t calendar_type::year

specifies the years of calendar.

Definition at line 49 of file rtc.h.

Referenced by alarm_init(), main(), rtc_alarm_clock_set(), rtc_time_get(), and rtc_time_set().

The documentation for this struct was generated from the following file:
  • rtc.h


AT32F413 Firmwary Library: RTC_calendar_exported_functions

Functions
RTC_calendar_exported_functions
AT32F413_periph_examples » RTC_calendar

Functions

uint8_t | rtc_init (calendar_type *calendar)
rtc peripheral initialization.
uint8_t | rtc_time_set (calendar_type *calendar)
set time. convert the input clock to a second. the time basic : 1970.1.1 legitimate year: 1970 ~ 2099
uint8_t | rtc_alarm_clock_set (calendar_type *calendar)
set rtc alarm clock. the time basic : 1970.1.1 legitimate year: 1970 ~ 2099
void | rtc_time_get (void)
get current time.

Detailed Description

Function Documentation

◆ rtc_alarm_clock_set()

uint8_t rtc_alarm_clock_set ( calendar_type * calendar )

set rtc alarm clock. the time basic : 1970.1.1 legitimate year: 1970 ~ 2099

Parameters
calendar
Return values
0 set alarm right. 1: set alarm failed.

Definition at line 216 of file rtc.c.

Referenced by alarm_init().

◆ rtc_init()

uint8_t rtc_init ( calendar_type * calendar )

rtc peripheral initialization.

Parameters
calendar
Return values
0 rtc already init 1: rtc init

Definition at line 50 of file rtc.c.

Referenced by main().

◆ rtc_time_get()

void rtc_time_get ( void )

get current time.

Parameters
none.
Return values
none.

Definition at line 308 of file rtc.c.

Referenced by main().

◆ rtc_time_set()

uint8_t rtc_time_set ( calendar_type * calendar )

set time. convert the input clock to a second. the time basic : 1970.1.1 legitimate year: 1970 ~ 2099

Parameters
calendar
Return values
0 set time right. 1: set time failed.

Definition at line 150 of file rtc.c.

Referenced by rtc_init().


AT32F413 Firmwary Library: RTC_lick_calibration

Functions | Variables
RTC_lick_calibration
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | RTC_IRQHandler (void)
this function handles rtc global interrupt request.
void | TMR5_GLOBAL_IRQHandler (void)
this function handles tmr5 global interrupt request.
void | nvic_configuration (void)
configures the nested vectored interrupt controller.
void | rtc_configuration (void)
configures the rtc.
uint32_t | incrementvar_operationcomplete (void)
increments operationcomplete variable and return its value before increment operation.
uint32_t | getvar_operationcomplete (void)
returns operationcomplete value.
void | setvar_periodvalue (uint32_t value)
sets the periodvalue variable with input parameter.
int | main (void)
main function.

Variables

uint16_t | tmpCC4 [2] = {0, 0}
crm_clocks_freq_type crm_clocks
__IO uint32_t | periodvalue = 0
__IO uint32_t | lickfreq = 0
__IO uint32_t | operationcomplete = 0

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 88 of file project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 123 of file project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c.

◆ getvar_operationcomplete()

uint32_t getvar_operationcomplete ( void )

returns operationcomplete value.

Parameters
none
Return values
operationcomplete value

Definition at line 129 of file project/at_start_f413/examples/rtc/lick_calibration/src/main.c.

Referenced by TMR5_GLOBAL_IRQHandler().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 62 of file project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c.

◆ incrementvar_operationcomplete()

uint32_t incrementvar_operationcomplete ( void )

increments operationcomplete variable and return its value before increment operation.

Parameters
none
Return values
operationcomplete value before increment

Definition at line 117 of file project/at_start_f413/examples/rtc/lick_calibration/src/main.c.

Referenced by TMR5_GLOBAL_IRQHandler().

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< lick connected to tmr5_ch4 input capture for calibration

< lick connected to tmr5_ch4 input capture for calibration

< tmr flag channel 4

< tmr interrupt channel 4

Definition at line 149 of file project/at_start_f413/examples/rtc/lick_calibration/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 75 of file project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 53 of file project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c.

◆ nvic_configuration()

void nvic_configuration ( void )

configures the nested vectored interrupt controller.

Parameters
none
Return values
none

Definition at line 47 of file project/at_start_f413/examples/rtc/lick_calibration/src/main.c.

Referenced by main().

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 132 of file project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c.

◆ rtc_configuration()

void rtc_configuration ( void )

configures the rtc.

Parameters
none
Return values
none

< low speed internal clock stable flag

< rtc time second interrupt

Definition at line 64 of file project/at_start_f413/examples/rtc/lick_calibration/src/main.c.

Referenced by main().

◆ RTC_IRQHandler()

void RTC_IRQHandler ( void )

this function handles rtc global interrupt request.

Parameters
none
Return values
none

< rtc time second flag

< rtc time second flag

Definition at line 150 of file project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c.

◆ setvar_periodvalue()

void setvar_periodvalue ( uint32_t value )

sets the periodvalue variable with input parameter.

Parameters
value value of periodvalue to be set.
Return values
none

Definition at line 139 of file project/at_start_f413/examples/rtc/lick_calibration/src/main.c.

Referenced by TMR5_GLOBAL_IRQHandler().

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 114 of file project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 141 of file project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c.

◆ TMR5_GLOBAL_IRQHandler()

void TMR5_GLOBAL_IRQHandler ( void )

this function handles tmr5 global interrupt request.

Parameters
none
Return values
none

< tmr flag channel 4

< tmr flag channel 4

< tmr interrupt channel 4

Definition at line 169 of file project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 101 of file project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c.

Variable Documentation

◆ crm_clocks

crm_clocks_freq_type crm_clocks

Definition at line 37 of file project/at_start_f413/examples/rtc/lick_calibration/src/main.c.

Referenced by main().

◆ lickfreq

__IO uint32_t lickfreq = 0

Definition at line 39 of file project/at_start_f413/examples/rtc/lick_calibration/src/main.c.

Referenced by main().

◆ operationcomplete

__IO uint32_t operationcomplete = 0

Definition at line 40 of file project/at_start_f413/examples/rtc/lick_calibration/src/main.c.

Referenced by getvar_operationcomplete(), incrementvar_operationcomplete(), and main().

◆ periodvalue

__IO uint32_t periodvalue = 0

Definition at line 38 of file project/at_start_f413/examples/rtc/lick_calibration/src/main.c.

Referenced by main(), and setvar_periodvalue().

◆ tmpCC4

uint16_t tmpCC4[2] = {0, 0}

Definition at line 46 of file project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c.

Referenced by TMR5_GLOBAL_IRQHandler().


AT32F413 Firmwary Library: SDIO_emmc_card

Topics
SDIO_emmc_card
AT32F413_periph_examples

Topics

SDIO_instance_definition
SDIO_exported_types
SDIO_command_index_definition
SDIO_paremeters_definition
SDIO_response_definition
SDIO_command_class_definition
SDIO_cmd8_definition
SDIO_mmc_extend_definition
SDIO_interrupt_flags_definition
SDIO_exported_functions

Detailed Description

Generated by doxygen 1.12.0


AT32F413 Firmwary Library: SDIO_instance_definition

Macros
SDIO_instance_definition
AT32F413_periph_examples » SDIO_emmc_card | AT32F413_periph_examples » SDIO_sd_mmc_card | AT32F413_periph_examples » SDIO_sdio_fatfs

Macros

#define | SDIOx SDIO1
#define | SDIOx SDIO1
#define | SDIOx SDIO1

Detailed Description

Macro Definition Documentation

◆ SDIOx [1/3]

#define SDIOx SDIO1

Definition at line 50 of file emmc_card/inc/at32_sdio.h.

Referenced by check_card_programming(), command_error(), command_rsp1_error(), command_rsp2_error(), command_rsp3_error(), command_rsp4_error(), command_rsp5_error(), command_rsp6_error(), command_rsp7_error(), get_ext_csd(), mmc_stream_read(), mmc_stream_write(), mmc_switch(), scr_find(), sd_block_read(), sd_block_write(), sd_blocks_erase(), sd_bus_wide_enable(), sd_card_init(), sd_deselect_select(), sd_dma_config(), sd_init(), sd_irq_service(), sd_mult_blocks_read(), sd_mult_blocks_write(), sd_power_off(), sd_power_on(), sd_status_send(), sd_switch(), sd_wide_bus_operation_config(), sdio_clock_set(), sdio_clock_set(), and sdio_command_data_send().

◆ SDIOx [2/3]

#define SDIOx SDIO1

Definition at line 50 of file sd_mmc_card/inc/at32_sdio.h.

◆ SDIOx [3/3]

#define SDIOx SDIO1

Definition at line 50 of file sdio_fatfs/inc/at32_sdio.h.


AT32F413 Firmwary Library: SDIO_command_index_definition

Macros
SDIO_command_index_definition
AT32F413_periph_examples » SDIO_emmc_card | AT32F413_periph_examples » SDIO_sd_mmc_card | AT32F413_periph_examples » SDIO_sdio_fatfs

Macros

#define | SD_CMD_GO_IDLE_STATE ((uint8_t)0)
#define | SD_CMD_SEND_OP_COND ((uint8_t)1)
#define | SD_CMD_ALL_SEND_CID ((uint8_t)2)
#define | SD_CMD_SET_REL_ADDR ((uint8_t)3)
#define | SD_CMD_SET_DSR ((uint8_t)4)
#define | SD_CMD_SDIO_SEN_OP_COND ((uint8_t)5)
#define | SD_CMD_HS_SWITCH ((uint8_t)6)
#define | SD_CMD_SEL_DESEL_CARD ((uint8_t)7)
#define | SD_CMD_HS_SEND_EXT_CSD ((uint8_t)8)
#define | SD_CMD_SEND_CSD ((uint8_t)9)
#define | SD_CMD_SEND_CID ((uint8_t)10)
#define | SD_CMD_READ_DAT_UNTIL_STOP ((uint8_t)11)
#define | SD_CMD_STOP_TRANSMISSION ((uint8_t)12)
#define | SD_CMD_SEND_STATUS ((uint8_t)13)
#define | SD_CMD_HS_BUSTEST_READ ((uint8_t)14)
#define | SD_CMD_GO_INACTIVE_STATE ((uint8_t)15)
#define | SD_CMD_SET_BLOCKLEN ((uint8_t)16)
#define | SD_CMD_READ_SINGLE_BLOCK ((uint8_t)17)
#define | SD_CMD_READ_MULT_BLOCK ((uint8_t)18)
#define | SD_CMD_HS_BUSTEST_WRITE ((uint8_t)19)
#define | SD_CMD_WRITE_DAT_UNTIL_STOP ((uint8_t)20)
#define | SD_CMD_SET_BLOCK_COUNT ((uint8_t)23)
#define | SD_CMD_WRITE_SINGLE_BLOCK ((uint8_t)24)
#define | SD_CMD_WRITE_MULT_BLOCK ((uint8_t)25)
#define | SD_CMD_PROG_CID ((uint8_t)26)
#define | SD_CMD_PROG_CSD ((uint8_t)27)
#define | SD_CMD_SET_WRITE_PROT ((uint8_t)28)
#define | SD_CMD_CLR_WRITE_PROT ((uint8_t)29)
#define | SD_CMD_SEND_WRITE_PROT ((uint8_t)30)
#define | SD_CMD_SD_ERASE_GRP_START ((uint8_t)32)
#define | SD_CMD_SD_ERASE_GRP_END ((uint8_t)33)
#define | SD_CMD_ERASE_GRP_START ((uint8_t)35)
#define | SD_CMD_ERASE_GRP_END ((uint8_t)36)
#define | SD_CMD_ERASE ((uint8_t)38)
#define | SD_CMD_FAST_IO ((uint8_t)39)
#define | SD_CMD_GO_IRQ_STATE ((uint8_t)40)
#define | SD_CMD_LOCK_UNLOCK ((uint8_t)42)
#define | SD_CMD_APP_CMD ((uint8_t)55)
#define | SD_CMD_GEN_CMD ((uint8_t)56)
#define | SD_CMD_NO_CMD ((uint8_t)64)
#define | SD_CMD_APP_SD_SET_BUSWIDTH ((uint8_t)6)
#define | SD_CMD_SD_APP_STAUS ((uint8_t)13)
#define | SD_CMD_SD_APP_SEND_NUM_WRITE_BLOCKS ((uint8_t)22)
#define | SD_CMD_SD_APP_OP_COND ((uint8_t)41)
#define | SD_CMD_SD_APP_SET_CLR_CARD_DETECT ((uint8_t)42)
#define | SD_CMD_SD_APP_SEND_SCR ((uint8_t)51)
#define | SD_CMD_SDIO_RW_DIRECT ((uint8_t)52)
#define | SD_CMD_SDIO_RW_EXTENDED ((uint8_t)53)
#define | SD_CMD_SD_APP_GET_MKB ((uint8_t)43)
#define | SD_CMD_SD_APP_GET_MID ((uint8_t)44)
#define | SD_CMD_SD_APP_SET_CER_RN1 ((uint8_t)45)
#define | SD_CMD_SD_APP_GET_CER_RN2 ((uint8_t)46)
#define | SD_CMD_SD_APP_SET_CER_RES2 ((uint8_t)47)
#define | SD_CMD_SD_APP_GET_CER_RES1 ((uint8_t)48)
#define | SD_CMD_SD_APP_SECURE_READ_MULTIPLE_BLOCK ((uint8_t)18)
#define | SD_CMD_SD_APP_SECURE_WRITE_MULTIPLE_BLOCK ((uint8_t)25)
#define | SD_CMD_SD_APP_SECURE_ERASE ((uint8_t)38)
#define | SD_CMD_SD_APP_CHANGE_SECURE_AREA ((uint8_t)49)
#define | SD_CMD_SD_APP_SECURE_WRITE_MKB ((uint8_t)48)
#define | SD_CMD_GO_IDLE_STATE ((uint8_t)0)
#define | SD_CMD_SEND_OP_COND ((uint8_t)1)
#define | SD_CMD_ALL_SEND_CID ((uint8_t)2)
#define | SD_CMD_SET_REL_ADDR ((uint8_t)3)
#define | SD_CMD_SET_DSR ((uint8_t)4)
#define | SD_CMD_SDIO_SEN_OP_COND ((uint8_t)5)
#define | SD_CMD_HS_SWITCH ((uint8_t)6)
#define | SD_CMD_SEL_DESEL_CARD ((uint8_t)7)
#define | SD_CMD_HS_SEND_EXT_CSD ((uint8_t)8)
#define | SD_CMD_SEND_CSD ((uint8_t)9)
#define | SD_CMD_SEND_CID ((uint8_t)10)
#define | SD_CMD_READ_DAT_UNTIL_STOP ((uint8_t)11)
#define | SD_CMD_STOP_TRANSMISSION ((uint8_t)12)
#define | SD_CMD_SEND_STATUS ((uint8_t)13)
#define | SD_CMD_HS_BUSTEST_READ ((uint8_t)14)
#define | SD_CMD_GO_INACTIVE_STATE ((uint8_t)15)
#define | SD_CMD_SET_BLOCKLEN ((uint8_t)16)
#define | SD_CMD_READ_SINGLE_BLOCK ((uint8_t)17)
#define | SD_CMD_READ_MULT_BLOCK ((uint8_t)18)
#define | SD_CMD_HS_BUSTEST_WRITE ((uint8_t)19)
#define | SD_CMD_WRITE_DAT_UNTIL_STOP ((uint8_t)20)
#define | SD_CMD_SET_BLOCK_COUNT ((uint8_t)23)
#define | SD_CMD_WRITE_SINGLE_BLOCK ((uint8_t)24)
#define | SD_CMD_WRITE_MULT_BLOCK ((uint8_t)25)
#define | SD_CMD_PROG_CID ((uint8_t)26)
#define | SD_CMD_PROG_CSD ((uint8_t)27)
#define | SD_CMD_SET_WRITE_PROT ((uint8_t)28)
#define | SD_CMD_CLR_WRITE_PROT ((uint8_t)29)
#define | SD_CMD_SEND_WRITE_PROT ((uint8_t)30)
#define | SD_CMD_SD_ERASE_GRP_START ((uint8_t)32)
#define | SD_CMD_SD_ERASE_GRP_END ((uint8_t)33)
#define | SD_CMD_ERASE_GRP_START ((uint8_t)35)
#define | SD_CMD_ERASE_GRP_END ((uint8_t)36)
#define | SD_CMD_ERASE ((uint8_t)38)
#define | SD_CMD_FAST_IO ((uint8_t)39)
#define | SD_CMD_GO_IRQ_STATE ((uint8_t)40)
#define | SD_CMD_LOCK_UNLOCK ((uint8_t)42)
#define | SD_CMD_APP_CMD ((uint8_t)55)
#define | SD_CMD_GEN_CMD ((uint8_t)56)
#define | SD_CMD_NO_CMD ((uint8_t)64)
#define | SD_CMD_APP_SD_SET_BUSWIDTH ((uint8_t)6)
#define | SD_CMD_SD_APP_STAUS ((uint8_t)13)
#define | SD_CMD_SD_APP_SEND_NUM_WRITE_BLOCKS ((uint8_t)22)
#define | SD_CMD_SD_APP_OP_COND ((uint8_t)41)
#define | SD_CMD_SD_APP_SET_CLR_CARD_DETECT ((uint8_t)42)
#define | SD_CMD_SD_APP_SEND_SCR ((uint8_t)51)
#define | SD_CMD_SDIO_RW_DIRECT ((uint8_t)52)
#define | SD_CMD_SDIO_RW_EXTENDED ((uint8_t)53)
#define | SD_CMD_SD_APP_GET_MKB ((uint8_t)43)
#define | SD_CMD_SD_APP_GET_MID ((uint8_t)44)
#define | SD_CMD_SD_APP_SET_CER_RN1 ((uint8_t)45)
#define | SD_CMD_SD_APP_GET_CER_RN2 ((uint8_t)46)
#define | SD_CMD_SD_APP_SET_CER_RES2 ((uint8_t)47)
#define | SD_CMD_SD_APP_GET_CER_RES1 ((uint8_t)48)
#define | SD_CMD_SD_APP_SECURE_READ_MULTIPLE_BLOCK ((uint8_t)18)
#define | SD_CMD_SD_APP_SECURE_WRITE_MULTIPLE_BLOCK ((uint8_t)25)
#define | SD_CMD_SD_APP_SECURE_ERASE ((uint8_t)38)
#define | SD_CMD_SD_APP_CHANGE_SECURE_AREA ((uint8_t)49)
#define | SD_CMD_SD_APP_SECURE_WRITE_MKB ((uint8_t)48)
#define | SD_CMD_GO_IDLE_STATE ((uint8_t)0)
#define | SD_CMD_SEND_OP_COND ((uint8_t)1)
#define | SD_CMD_ALL_SEND_CID ((uint8_t)2)
#define | SD_CMD_SET_REL_ADDR ((uint8_t)3)
#define | SD_CMD_SET_DSR ((uint8_t)4)
#define | SD_CMD_SDIO_SEN_OP_COND ((uint8_t)5)
#define | SD_CMD_HS_SWITCH ((uint8_t)6)
#define | SD_CMD_SEL_DESEL_CARD ((uint8_t)7)
#define | SD_CMD_HS_SEND_EXT_CSD ((uint8_t)8)
#define | SD_CMD_SEND_CSD ((uint8_t)9)
#define | SD_CMD_SEND_CID ((uint8_t)10)
#define | SD_CMD_READ_DAT_UNTIL_STOP ((uint8_t)11)
#define | SD_CMD_STOP_TRANSMISSION ((uint8_t)12)
#define | SD_CMD_SEND_STATUS ((uint8_t)13)
#define | SD_CMD_HS_BUSTEST_READ ((uint8_t)14)
#define | SD_CMD_GO_INACTIVE_STATE ((uint8_t)15)
#define | SD_CMD_SET_BLOCKLEN ((uint8_t)16)
#define | SD_CMD_READ_SINGLE_BLOCK ((uint8_t)17)
#define | SD_CMD_READ_MULT_BLOCK ((uint8_t)18)
#define | SD_CMD_HS_BUSTEST_WRITE ((uint8_t)19)
#define | SD_CMD_WRITE_DAT_UNTIL_STOP ((uint8_t)20)
#define | SD_CMD_SET_BLOCK_COUNT ((uint8_t)23)
#define | SD_CMD_WRITE_SINGLE_BLOCK ((uint8_t)24)
#define | SD_CMD_WRITE_MULT_BLOCK ((uint8_t)25)
#define | SD_CMD_PROG_CID ((uint8_t)26)
#define | SD_CMD_PROG_CSD ((uint8_t)27)
#define | SD_CMD_SET_WRITE_PROT ((uint8_t)28)
#define | SD_CMD_CLR_WRITE_PROT ((uint8_t)29)
#define | SD_CMD_SEND_WRITE_PROT ((uint8_t)30)
#define | SD_CMD_SD_ERASE_GRP_START ((uint8_t)32)
#define | SD_CMD_SD_ERASE_GRP_END ((uint8_t)33)
#define | SD_CMD_ERASE_GRP_START ((uint8_t)35)
#define | SD_CMD_ERASE_GRP_END ((uint8_t)36)
#define | SD_CMD_ERASE ((uint8_t)38)
#define | SD_CMD_FAST_IO ((uint8_t)39)
#define | SD_CMD_GO_IRQ_STATE ((uint8_t)40)
#define | SD_CMD_LOCK_UNLOCK ((uint8_t)42)
#define | SD_CMD_APP_CMD ((uint8_t)55)
#define | SD_CMD_GEN_CMD ((uint8_t)56)
#define | SD_CMD_NO_CMD ((uint8_t)64)
#define | SD_CMD_APP_SD_SET_BUSWIDTH ((uint8_t)6)
#define | SD_CMD_SD_APP_STAUS ((uint8_t)13)
#define | SD_CMD_SD_APP_SEND_NUM_WRITE_BLOCKS ((uint8_t)22)
#define | SD_CMD_SD_APP_OP_COND ((uint8_t)41)
#define | SD_CMD_SD_APP_SET_CLR_CARD_DETECT ((uint8_t)42)
#define | SD_CMD_SD_APP_SEND_SCR ((uint8_t)51)
#define | SD_CMD_SDIO_RW_DIRECT ((uint8_t)52)
#define | SD_CMD_SDIO_RW_EXTENDED ((uint8_t)53)
#define | SD_CMD_SD_APP_GET_MKB ((uint8_t)43)
#define | SD_CMD_SD_APP_GET_MID ((uint8_t)44)
#define | SD_CMD_SD_APP_SET_CER_RN1 ((uint8_t)45)
#define | SD_CMD_SD_APP_GET_CER_RN2 ((uint8_t)46)
#define | SD_CMD_SD_APP_SET_CER_RES2 ((uint8_t)47)
#define | SD_CMD_SD_APP_GET_CER_RES1 ((uint8_t)48)
#define | SD_CMD_SD_APP_SECURE_READ_MULTIPLE_BLOCK ((uint8_t)18)
#define | SD_CMD_SD_APP_SECURE_WRITE_MULTIPLE_BLOCK ((uint8_t)25)
#define | SD_CMD_SD_APP_SECURE_ERASE ((uint8_t)38)
#define | SD_CMD_SD_APP_CHANGE_SECURE_AREA ((uint8_t)49)
#define | SD_CMD_SD_APP_SECURE_WRITE_MKB ((uint8_t)48)

Detailed Description

Macro Definition Documentation

◆ SD_CMD_ALL_SEND_CID [1/3]

#define SD_CMD_ALL_SEND_CID ((uint8_t)2)

Definition at line 261 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_init().

◆ SD_CMD_ALL_SEND_CID [2/3]

#define SD_CMD_ALL_SEND_CID ((uint8_t)2)

Definition at line 261 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_ALL_SEND_CID [3/3]

#define SD_CMD_ALL_SEND_CID ((uint8_t)2)

Definition at line 261 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_APP_CMD [1/3]

#define SD_CMD_APP_CMD ((uint8_t)55)

Definition at line 296 of file emmc_card/inc/at32_sdio.h.

Referenced by scr_find(), sd_bus_wide_enable(), sd_mult_blocks_write(), and sd_power_on().

◆ SD_CMD_APP_CMD [2/3]

#define SD_CMD_APP_CMD ((uint8_t)55)

Definition at line 296 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_APP_CMD [3/3]

#define SD_CMD_APP_CMD ((uint8_t)55)

Definition at line 296 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_APP_SD_SET_BUSWIDTH [1/3]

#define SD_CMD_APP_SD_SET_BUSWIDTH ((uint8_t)6)

following commands are sd card specific commands. should be sent before sending these commands.

Definition at line 304 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_bus_wide_enable().

◆ SD_CMD_APP_SD_SET_BUSWIDTH [2/3]

#define SD_CMD_APP_SD_SET_BUSWIDTH ((uint8_t)6)

following commands are sd card specific commands. should be sent before sending these commands.

Definition at line 304 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_APP_SD_SET_BUSWIDTH [3/3]

#define SD_CMD_APP_SD_SET_BUSWIDTH ((uint8_t)6)

following commands are sd card specific commands. should be sent before sending these commands.

Definition at line 304 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_CLR_WRITE_PROT [1/3]

#define SD_CMD_CLR_WRITE_PROT ((uint8_t)29)

Definition at line 286 of file emmc_card/inc/at32_sdio.h.

◆ SD_CMD_CLR_WRITE_PROT [2/3]

#define SD_CMD_CLR_WRITE_PROT ((uint8_t)29)

Definition at line 286 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_CLR_WRITE_PROT [3/3]

#define SD_CMD_CLR_WRITE_PROT ((uint8_t)29)

Definition at line 286 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_ERASE [1/3]

#define SD_CMD_ERASE ((uint8_t)38)

Definition at line 292 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_blocks_erase().

◆ SD_CMD_ERASE [2/3]

#define SD_CMD_ERASE ((uint8_t)38)

Definition at line 292 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_ERASE [3/3]

#define SD_CMD_ERASE ((uint8_t)38)

Definition at line 292 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_ERASE_GRP_END [1/3]

#define SD_CMD_ERASE_GRP_END ((uint8_t)36)

Definition at line 291 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_blocks_erase().

◆ SD_CMD_ERASE_GRP_END [2/3]

#define SD_CMD_ERASE_GRP_END ((uint8_t)36)

Definition at line 291 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_ERASE_GRP_END [3/3]

#define SD_CMD_ERASE_GRP_END ((uint8_t)36)

Definition at line 291 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_ERASE_GRP_START [1/3]

#define SD_CMD_ERASE_GRP_START ((uint8_t)35)

Definition at line 290 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_blocks_erase().

◆ SD_CMD_ERASE_GRP_START [2/3]

#define SD_CMD_ERASE_GRP_START ((uint8_t)35)

Definition at line 290 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_ERASE_GRP_START [3/3]

#define SD_CMD_ERASE_GRP_START ((uint8_t)35)

Definition at line 290 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_FAST_IO [1/3]

#define SD_CMD_FAST_IO ((uint8_t)39)

Definition at line 293 of file emmc_card/inc/at32_sdio.h.

◆ SD_CMD_FAST_IO [2/3]

#define SD_CMD_FAST_IO ((uint8_t)39)

Definition at line 293 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_FAST_IO [3/3]

#define SD_CMD_FAST_IO ((uint8_t)39)

Definition at line 293 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_GEN_CMD [1/3]

#define SD_CMD_GEN_CMD ((uint8_t)56)

Definition at line 297 of file emmc_card/inc/at32_sdio.h.

◆ SD_CMD_GEN_CMD [2/3]

#define SD_CMD_GEN_CMD ((uint8_t)56)

Definition at line 297 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_GEN_CMD [3/3]

#define SD_CMD_GEN_CMD ((uint8_t)56)

Definition at line 297 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_GO_IDLE_STATE [1/3]

#define SD_CMD_GO_IDLE_STATE ((uint8_t)0)

sdio commands index

Definition at line 259 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_power_on().

◆ SD_CMD_GO_IDLE_STATE [2/3]

#define SD_CMD_GO_IDLE_STATE ((uint8_t)0)

sdio commands index

Definition at line 259 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_GO_IDLE_STATE [3/3]

#define SD_CMD_GO_IDLE_STATE ((uint8_t)0)

sdio commands index

Definition at line 259 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_GO_INACTIVE_STATE [1/3]

#define SD_CMD_GO_INACTIVE_STATE ((uint8_t)15)

Definition at line 274 of file emmc_card/inc/at32_sdio.h.

◆ SD_CMD_GO_INACTIVE_STATE [2/3]

#define SD_CMD_GO_INACTIVE_STATE ((uint8_t)15)

Definition at line 274 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_GO_INACTIVE_STATE [3/3]

#define SD_CMD_GO_INACTIVE_STATE ((uint8_t)15)

Definition at line 274 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_GO_IRQ_STATE [1/3]

#define SD_CMD_GO_IRQ_STATE ((uint8_t)40)

Definition at line 294 of file emmc_card/inc/at32_sdio.h.

◆ SD_CMD_GO_IRQ_STATE [2/3]

#define SD_CMD_GO_IRQ_STATE ((uint8_t)40)

Definition at line 294 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_GO_IRQ_STATE [3/3]

#define SD_CMD_GO_IRQ_STATE ((uint8_t)40)

Definition at line 294 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_HS_BUSTEST_READ [1/3]

#define SD_CMD_HS_BUSTEST_READ ((uint8_t)14)

Definition at line 273 of file emmc_card/inc/at32_sdio.h.

◆ SD_CMD_HS_BUSTEST_READ [2/3]

#define SD_CMD_HS_BUSTEST_READ ((uint8_t)14)

Definition at line 273 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_HS_BUSTEST_READ [3/3]

#define SD_CMD_HS_BUSTEST_READ ((uint8_t)14)

Definition at line 273 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_HS_BUSTEST_WRITE [1/3]

#define SD_CMD_HS_BUSTEST_WRITE ((uint8_t)19)

Definition at line 278 of file emmc_card/inc/at32_sdio.h.

◆ SD_CMD_HS_BUSTEST_WRITE [2/3]

#define SD_CMD_HS_BUSTEST_WRITE ((uint8_t)19)

Definition at line 278 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_HS_BUSTEST_WRITE [3/3]

#define SD_CMD_HS_BUSTEST_WRITE ((uint8_t)19)

Definition at line 278 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_HS_SEND_EXT_CSD [1/3]

#define SD_CMD_HS_SEND_EXT_CSD ((uint8_t)8)

Definition at line 267 of file emmc_card/inc/at32_sdio.h.

Referenced by get_ext_csd().

◆ SD_CMD_HS_SEND_EXT_CSD [2/3]

#define SD_CMD_HS_SEND_EXT_CSD ((uint8_t)8)

Definition at line 267 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_HS_SEND_EXT_CSD [3/3]

#define SD_CMD_HS_SEND_EXT_CSD ((uint8_t)8)

Definition at line 267 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_HS_SWITCH [1/3]

#define SD_CMD_HS_SWITCH ((uint8_t)6)

Definition at line 265 of file emmc_card/inc/at32_sdio.h.

Referenced by mmc_switch(), and sd_switch().

◆ SD_CMD_HS_SWITCH [2/3]

#define SD_CMD_HS_SWITCH ((uint8_t)6)

Definition at line 265 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_HS_SWITCH [3/3]

#define SD_CMD_HS_SWITCH ((uint8_t)6)

Definition at line 265 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_LOCK_UNLOCK [1/3]

#define SD_CMD_LOCK_UNLOCK ((uint8_t)42)

Definition at line 295 of file emmc_card/inc/at32_sdio.h.

◆ SD_CMD_LOCK_UNLOCK [2/3]

#define SD_CMD_LOCK_UNLOCK ((uint8_t)42)

Definition at line 295 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_LOCK_UNLOCK [3/3]

#define SD_CMD_LOCK_UNLOCK ((uint8_t)42)

Definition at line 295 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_NO_CMD [1/3]

#define SD_CMD_NO_CMD ((uint8_t)64)

Definition at line 298 of file emmc_card/inc/at32_sdio.h.

◆ SD_CMD_NO_CMD [2/3]

#define SD_CMD_NO_CMD ((uint8_t)64)

Definition at line 298 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_NO_CMD [3/3]

#define SD_CMD_NO_CMD ((uint8_t)64)

Definition at line 298 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_PROG_CID [1/3]

#define SD_CMD_PROG_CID ((uint8_t)26)

Definition at line 283 of file emmc_card/inc/at32_sdio.h.

◆ SD_CMD_PROG_CID [2/3]

#define SD_CMD_PROG_CID ((uint8_t)26)

Definition at line 283 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_PROG_CID [3/3]

#define SD_CMD_PROG_CID ((uint8_t)26)

Definition at line 283 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_PROG_CSD [1/3]

#define SD_CMD_PROG_CSD ((uint8_t)27)

Definition at line 284 of file emmc_card/inc/at32_sdio.h.

◆ SD_CMD_PROG_CSD [2/3]

#define SD_CMD_PROG_CSD ((uint8_t)27)

Definition at line 284 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_PROG_CSD [3/3]

#define SD_CMD_PROG_CSD ((uint8_t)27)

Definition at line 284 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_READ_DAT_UNTIL_STOP [1/3]

#define SD_CMD_READ_DAT_UNTIL_STOP ((uint8_t)11)

Definition at line 270 of file emmc_card/inc/at32_sdio.h.

Referenced by mmc_stream_read().

◆ SD_CMD_READ_DAT_UNTIL_STOP [2/3]

#define SD_CMD_READ_DAT_UNTIL_STOP ((uint8_t)11)

Definition at line 270 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_READ_DAT_UNTIL_STOP [3/3]

#define SD_CMD_READ_DAT_UNTIL_STOP ((uint8_t)11)

Definition at line 270 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_READ_MULT_BLOCK [1/3]

#define SD_CMD_READ_MULT_BLOCK ((uint8_t)18)

Definition at line 277 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_mult_blocks_read().

◆ SD_CMD_READ_MULT_BLOCK [2/3]

#define SD_CMD_READ_MULT_BLOCK ((uint8_t)18)

Definition at line 277 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_READ_MULT_BLOCK [3/3]

#define SD_CMD_READ_MULT_BLOCK ((uint8_t)18)

Definition at line 277 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_READ_SINGLE_BLOCK [1/3]

#define SD_CMD_READ_SINGLE_BLOCK ((uint8_t)17)

Definition at line 276 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_block_read().

◆ SD_CMD_READ_SINGLE_BLOCK [2/3]

#define SD_CMD_READ_SINGLE_BLOCK ((uint8_t)17)

Definition at line 276 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_READ_SINGLE_BLOCK [3/3]

#define SD_CMD_READ_SINGLE_BLOCK ((uint8_t)17)

Definition at line 276 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_CHANGE_SECURE_AREA [1/3]

#define SD_CMD_SD_APP_CHANGE_SECURE_AREA ((uint8_t)49)

Definition at line 326 of file emmc_card/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_CHANGE_SECURE_AREA [2/3]

#define SD_CMD_SD_APP_CHANGE_SECURE_AREA ((uint8_t)49)

Definition at line 326 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_CHANGE_SECURE_AREA [3/3]

#define SD_CMD_SD_APP_CHANGE_SECURE_AREA ((uint8_t)49)

Definition at line 326 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_GET_CER_RES1 [1/3]

#define SD_CMD_SD_APP_GET_CER_RES1 ((uint8_t)48)

Definition at line 322 of file emmc_card/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_GET_CER_RES1 [2/3]

#define SD_CMD_SD_APP_GET_CER_RES1 ((uint8_t)48)

Definition at line 322 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_GET_CER_RES1 [3/3]

#define SD_CMD_SD_APP_GET_CER_RES1 ((uint8_t)48)

Definition at line 322 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_GET_CER_RN2 [1/3]

#define SD_CMD_SD_APP_GET_CER_RN2 ((uint8_t)46)

Definition at line 320 of file emmc_card/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_GET_CER_RN2 [2/3]

#define SD_CMD_SD_APP_GET_CER_RN2 ((uint8_t)46)

Definition at line 320 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_GET_CER_RN2 [3/3]

#define SD_CMD_SD_APP_GET_CER_RN2 ((uint8_t)46)

Definition at line 320 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_GET_MID [1/3]

#define SD_CMD_SD_APP_GET_MID ((uint8_t)44)

Definition at line 318 of file emmc_card/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_GET_MID [2/3]

#define SD_CMD_SD_APP_GET_MID ((uint8_t)44)

Definition at line 318 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_GET_MID [3/3]

#define SD_CMD_SD_APP_GET_MID ((uint8_t)44)

Definition at line 318 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_GET_MKB [1/3]

#define SD_CMD_SD_APP_GET_MKB ((uint8_t)43)

following commands are sd card specific security commands. sdio_app_cmd should be sent before sending these commands.

Definition at line 317 of file emmc_card/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_GET_MKB [2/3]

#define SD_CMD_SD_APP_GET_MKB ((uint8_t)43)

following commands are sd card specific security commands. sdio_app_cmd should be sent before sending these commands.

Definition at line 317 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_GET_MKB [3/3]

#define SD_CMD_SD_APP_GET_MKB ((uint8_t)43)

following commands are sd card specific security commands. sdio_app_cmd should be sent before sending these commands.

Definition at line 317 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_OP_COND [1/3]

#define SD_CMD_SD_APP_OP_COND ((uint8_t)41)

Definition at line 307 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_power_on().

◆ SD_CMD_SD_APP_OP_COND [2/3]

#define SD_CMD_SD_APP_OP_COND ((uint8_t)41)

Definition at line 307 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_OP_COND [3/3]

#define SD_CMD_SD_APP_OP_COND ((uint8_t)41)

Definition at line 307 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_SECURE_ERASE [1/3]

#define SD_CMD_SD_APP_SECURE_ERASE ((uint8_t)38)

Definition at line 325 of file emmc_card/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_SECURE_ERASE [2/3]

#define SD_CMD_SD_APP_SECURE_ERASE ((uint8_t)38)

Definition at line 325 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_SECURE_ERASE [3/3]

#define SD_CMD_SD_APP_SECURE_ERASE ((uint8_t)38)

Definition at line 325 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_SECURE_READ_MULTIPLE_BLOCK [1/3]

#define SD_CMD_SD_APP_SECURE_READ_MULTIPLE_BLOCK ((uint8_t)18)

Definition at line 323 of file emmc_card/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_SECURE_READ_MULTIPLE_BLOCK [2/3]

#define SD_CMD_SD_APP_SECURE_READ_MULTIPLE_BLOCK ((uint8_t)18)

Definition at line 323 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_SECURE_READ_MULTIPLE_BLOCK [3/3]

#define SD_CMD_SD_APP_SECURE_READ_MULTIPLE_BLOCK ((uint8_t)18)

Definition at line 323 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_SECURE_WRITE_MKB [1/3]

#define SD_CMD_SD_APP_SECURE_WRITE_MKB ((uint8_t)48)

Definition at line 327 of file emmc_card/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_SECURE_WRITE_MKB [2/3]

#define SD_CMD_SD_APP_SECURE_WRITE_MKB ((uint8_t)48)

Definition at line 327 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_SECURE_WRITE_MKB [3/3]

#define SD_CMD_SD_APP_SECURE_WRITE_MKB ((uint8_t)48)

Definition at line 327 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_SECURE_WRITE_MULTIPLE_BLOCK [1/3]

#define SD_CMD_SD_APP_SECURE_WRITE_MULTIPLE_BLOCK ((uint8_t)25)

Definition at line 324 of file emmc_card/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_SECURE_WRITE_MULTIPLE_BLOCK [2/3]

#define SD_CMD_SD_APP_SECURE_WRITE_MULTIPLE_BLOCK ((uint8_t)25)

Definition at line 324 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_SECURE_WRITE_MULTIPLE_BLOCK [3/3]

#define SD_CMD_SD_APP_SECURE_WRITE_MULTIPLE_BLOCK ((uint8_t)25)

Definition at line 324 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_SEND_NUM_WRITE_BLOCKS [1/3]

#define SD_CMD_SD_APP_SEND_NUM_WRITE_BLOCKS ((uint8_t)22)

Definition at line 306 of file emmc_card/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_SEND_NUM_WRITE_BLOCKS [2/3]

#define SD_CMD_SD_APP_SEND_NUM_WRITE_BLOCKS ((uint8_t)22)

Definition at line 306 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_SEND_NUM_WRITE_BLOCKS [3/3]

#define SD_CMD_SD_APP_SEND_NUM_WRITE_BLOCKS ((uint8_t)22)

Definition at line 306 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_SEND_SCR [1/3]

#define SD_CMD_SD_APP_SEND_SCR ((uint8_t)51)

Definition at line 309 of file emmc_card/inc/at32_sdio.h.

Referenced by scr_find().

◆ SD_CMD_SD_APP_SEND_SCR [2/3]

#define SD_CMD_SD_APP_SEND_SCR ((uint8_t)51)

Definition at line 309 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_SEND_SCR [3/3]

#define SD_CMD_SD_APP_SEND_SCR ((uint8_t)51)

Definition at line 309 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_SET_CER_RES2 [1/3]

#define SD_CMD_SD_APP_SET_CER_RES2 ((uint8_t)47)

Definition at line 321 of file emmc_card/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_SET_CER_RES2 [2/3]

#define SD_CMD_SD_APP_SET_CER_RES2 ((uint8_t)47)

Definition at line 321 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_SET_CER_RES2 [3/3]

#define SD_CMD_SD_APP_SET_CER_RES2 ((uint8_t)47)

Definition at line 321 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_SET_CER_RN1 [1/3]

#define SD_CMD_SD_APP_SET_CER_RN1 ((uint8_t)45)

Definition at line 319 of file emmc_card/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_SET_CER_RN1 [2/3]

#define SD_CMD_SD_APP_SET_CER_RN1 ((uint8_t)45)

Definition at line 319 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_SET_CER_RN1 [3/3]

#define SD_CMD_SD_APP_SET_CER_RN1 ((uint8_t)45)

Definition at line 319 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_SET_CLR_CARD_DETECT [1/3]

#define SD_CMD_SD_APP_SET_CLR_CARD_DETECT ((uint8_t)42)

Definition at line 308 of file emmc_card/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_SET_CLR_CARD_DETECT [2/3]

#define SD_CMD_SD_APP_SET_CLR_CARD_DETECT ((uint8_t)42)

Definition at line 308 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_SET_CLR_CARD_DETECT [3/3]

#define SD_CMD_SD_APP_SET_CLR_CARD_DETECT ((uint8_t)42)

Definition at line 308 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_STAUS [1/3]

#define SD_CMD_SD_APP_STAUS ((uint8_t)13)

Definition at line 305 of file emmc_card/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_STAUS [2/3]

#define SD_CMD_SD_APP_STAUS ((uint8_t)13)

Definition at line 305 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_SD_APP_STAUS [3/3]

#define SD_CMD_SD_APP_STAUS ((uint8_t)13)

Definition at line 305 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_SD_ERASE_GRP_END [1/3]

#define SD_CMD_SD_ERASE_GRP_END ((uint8_t)33)

Definition at line 289 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_blocks_erase().

◆ SD_CMD_SD_ERASE_GRP_END [2/3]

#define SD_CMD_SD_ERASE_GRP_END ((uint8_t)33)

Definition at line 289 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_SD_ERASE_GRP_END [3/3]

#define SD_CMD_SD_ERASE_GRP_END ((uint8_t)33)

Definition at line 289 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_SD_ERASE_GRP_START [1/3]

#define SD_CMD_SD_ERASE_GRP_START ((uint8_t)32)

Definition at line 288 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_blocks_erase().

◆ SD_CMD_SD_ERASE_GRP_START [2/3]

#define SD_CMD_SD_ERASE_GRP_START ((uint8_t)32)

Definition at line 288 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_SD_ERASE_GRP_START [3/3]

#define SD_CMD_SD_ERASE_GRP_START ((uint8_t)32)

Definition at line 288 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_SDIO_RW_DIRECT [1/3]

#define SD_CMD_SDIO_RW_DIRECT ((uint8_t)52)

Definition at line 310 of file emmc_card/inc/at32_sdio.h.

◆ SD_CMD_SDIO_RW_DIRECT [2/3]

#define SD_CMD_SDIO_RW_DIRECT ((uint8_t)52)

Definition at line 310 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_SDIO_RW_DIRECT [3/3]

#define SD_CMD_SDIO_RW_DIRECT ((uint8_t)52)

Definition at line 310 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_SDIO_RW_EXTENDED [1/3]

#define SD_CMD_SDIO_RW_EXTENDED ((uint8_t)53)

Definition at line 311 of file emmc_card/inc/at32_sdio.h.

◆ SD_CMD_SDIO_RW_EXTENDED [2/3]

#define SD_CMD_SDIO_RW_EXTENDED ((uint8_t)53)

Definition at line 311 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_SDIO_RW_EXTENDED [3/3]

#define SD_CMD_SDIO_RW_EXTENDED ((uint8_t)53)

Definition at line 311 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_SDIO_SEN_OP_COND [1/3]

#define SD_CMD_SDIO_SEN_OP_COND ((uint8_t)5)

Definition at line 264 of file emmc_card/inc/at32_sdio.h.

◆ SD_CMD_SDIO_SEN_OP_COND [2/3]

#define SD_CMD_SDIO_SEN_OP_COND ((uint8_t)5)

Definition at line 264 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_SDIO_SEN_OP_COND [3/3]

#define SD_CMD_SDIO_SEN_OP_COND ((uint8_t)5)

Definition at line 264 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_SEL_DESEL_CARD [1/3]

#define SD_CMD_SEL_DESEL_CARD ((uint8_t)7)

Definition at line 266 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_deselect_select().

◆ SD_CMD_SEL_DESEL_CARD [2/3]

#define SD_CMD_SEL_DESEL_CARD ((uint8_t)7)

Definition at line 266 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_SEL_DESEL_CARD [3/3]

#define SD_CMD_SEL_DESEL_CARD ((uint8_t)7)

Definition at line 266 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_SEND_CID [1/3]

#define SD_CMD_SEND_CID ((uint8_t)10)

Definition at line 269 of file emmc_card/inc/at32_sdio.h.

◆ SD_CMD_SEND_CID [2/3]

#define SD_CMD_SEND_CID ((uint8_t)10)

Definition at line 269 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_SEND_CID [3/3]

#define SD_CMD_SEND_CID ((uint8_t)10)

Definition at line 269 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_SEND_CSD [1/3]

#define SD_CMD_SEND_CSD ((uint8_t)9)

Definition at line 268 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_init().

◆ SD_CMD_SEND_CSD [2/3]

#define SD_CMD_SEND_CSD ((uint8_t)9)

Definition at line 268 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_SEND_CSD [3/3]

#define SD_CMD_SEND_CSD ((uint8_t)9)

Definition at line 268 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_SEND_OP_COND [1/3]

#define SD_CMD_SEND_OP_COND ((uint8_t)1)

Definition at line 260 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_power_on().

◆ SD_CMD_SEND_OP_COND [2/3]

#define SD_CMD_SEND_OP_COND ((uint8_t)1)

Definition at line 260 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_SEND_OP_COND [3/3]

#define SD_CMD_SEND_OP_COND ((uint8_t)1)

Definition at line 260 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_SEND_STATUS [1/3]

#define SD_CMD_SEND_STATUS ((uint8_t)13)

Definition at line 272 of file emmc_card/inc/at32_sdio.h.

Referenced by check_card_programming(), and sd_status_send().

◆ SD_CMD_SEND_STATUS [2/3]

#define SD_CMD_SEND_STATUS ((uint8_t)13)

Definition at line 272 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_SEND_STATUS [3/3]

#define SD_CMD_SEND_STATUS ((uint8_t)13)

Definition at line 272 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_SEND_WRITE_PROT [1/3]

#define SD_CMD_SEND_WRITE_PROT ((uint8_t)30)

Definition at line 287 of file emmc_card/inc/at32_sdio.h.

◆ SD_CMD_SEND_WRITE_PROT [2/3]

#define SD_CMD_SEND_WRITE_PROT ((uint8_t)30)

Definition at line 287 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_SEND_WRITE_PROT [3/3]

#define SD_CMD_SEND_WRITE_PROT ((uint8_t)30)

Definition at line 287 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_SET_BLOCK_COUNT [1/3]

#define SD_CMD_SET_BLOCK_COUNT ((uint8_t)23)

Definition at line 280 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_mult_blocks_write().

◆ SD_CMD_SET_BLOCK_COUNT [2/3]

#define SD_CMD_SET_BLOCK_COUNT ((uint8_t)23)

Definition at line 280 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_SET_BLOCK_COUNT [3/3]

#define SD_CMD_SET_BLOCK_COUNT ((uint8_t)23)

Definition at line 280 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_SET_BLOCKLEN [1/3]

#define SD_CMD_SET_BLOCKLEN ((uint8_t)16)

Definition at line 275 of file emmc_card/inc/at32_sdio.h.

Referenced by scr_find(), sd_block_read(), sd_block_write(), sd_mult_blocks_read(), sd_mult_blocks_write(), and sd_switch().

◆ SD_CMD_SET_BLOCKLEN [2/3]

#define SD_CMD_SET_BLOCKLEN ((uint8_t)16)

Definition at line 275 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_SET_BLOCKLEN [3/3]

#define SD_CMD_SET_BLOCKLEN ((uint8_t)16)

Definition at line 275 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_SET_DSR [1/3]

#define SD_CMD_SET_DSR ((uint8_t)4)

Definition at line 263 of file emmc_card/inc/at32_sdio.h.

◆ SD_CMD_SET_DSR [2/3]

#define SD_CMD_SET_DSR ((uint8_t)4)

Definition at line 263 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_SET_DSR [3/3]

#define SD_CMD_SET_DSR ((uint8_t)4)

Definition at line 263 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_SET_REL_ADDR [1/3]

#define SD_CMD_SET_REL_ADDR ((uint8_t)3)

Definition at line 262 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_card_init().

◆ SD_CMD_SET_REL_ADDR [2/3]

#define SD_CMD_SET_REL_ADDR ((uint8_t)3)

Definition at line 262 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_SET_REL_ADDR [3/3]

#define SD_CMD_SET_REL_ADDR ((uint8_t)3)

Definition at line 262 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_SET_WRITE_PROT [1/3]

#define SD_CMD_SET_WRITE_PROT ((uint8_t)28)

Definition at line 285 of file emmc_card/inc/at32_sdio.h.

◆ SD_CMD_SET_WRITE_PROT [2/3]

#define SD_CMD_SET_WRITE_PROT ((uint8_t)28)

Definition at line 285 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_SET_WRITE_PROT [3/3]

#define SD_CMD_SET_WRITE_PROT ((uint8_t)28)

Definition at line 285 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_STOP_TRANSMISSION [1/3]

#define SD_CMD_STOP_TRANSMISSION ((uint8_t)12)

Definition at line 271 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_irq_service(), and sdio_command_data_send().

◆ SD_CMD_STOP_TRANSMISSION [2/3]

#define SD_CMD_STOP_TRANSMISSION ((uint8_t)12)

Definition at line 271 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_STOP_TRANSMISSION [3/3]

#define SD_CMD_STOP_TRANSMISSION ((uint8_t)12)

Definition at line 271 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_WRITE_DAT_UNTIL_STOP [1/3]

#define SD_CMD_WRITE_DAT_UNTIL_STOP ((uint8_t)20)

Definition at line 279 of file emmc_card/inc/at32_sdio.h.

Referenced by mmc_stream_write().

◆ SD_CMD_WRITE_DAT_UNTIL_STOP [2/3]

#define SD_CMD_WRITE_DAT_UNTIL_STOP ((uint8_t)20)

Definition at line 279 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_WRITE_DAT_UNTIL_STOP [3/3]

#define SD_CMD_WRITE_DAT_UNTIL_STOP ((uint8_t)20)

Definition at line 279 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_WRITE_MULT_BLOCK [1/3]

#define SD_CMD_WRITE_MULT_BLOCK ((uint8_t)25)

Definition at line 282 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_mult_blocks_write().

◆ SD_CMD_WRITE_MULT_BLOCK [2/3]

#define SD_CMD_WRITE_MULT_BLOCK ((uint8_t)25)

Definition at line 282 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_WRITE_MULT_BLOCK [3/3]

#define SD_CMD_WRITE_MULT_BLOCK ((uint8_t)25)

Definition at line 282 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CMD_WRITE_SINGLE_BLOCK [1/3]

#define SD_CMD_WRITE_SINGLE_BLOCK ((uint8_t)24)

Definition at line 281 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_block_write().

◆ SD_CMD_WRITE_SINGLE_BLOCK [2/3]

#define SD_CMD_WRITE_SINGLE_BLOCK ((uint8_t)24)

Definition at line 281 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CMD_WRITE_SINGLE_BLOCK [3/3]

#define SD_CMD_WRITE_SINGLE_BLOCK ((uint8_t)24)

Definition at line 281 of file sdio_fatfs/inc/at32_sdio.h.


AT32F413 Firmwary Library: SDIO_paremeters_definition

Macros
SDIO_paremeters_definition
AT32F413_periph_examples » SDIO_emmc_card | AT32F413_periph_examples » SDIO_sd_mmc_card | AT32F413_periph_examples » SDIO_sdio_fatfs

Macros

#define | NULL 0
#define | SDIO_STATIC_FLAGS ((uint32_t)0x000005FF)
#define | SDIO_CMD0TIMEOUT ((uint32_t)0x00010000)
#define | SDIO_DATATIMEOUT ((uint32_t)0xFFFFFFFF)
#define | NULL 0
#define | SDIO_STATIC_FLAGS ((uint32_t)0x000005FF)
#define | SDIO_CMD0TIMEOUT ((uint32_t)0x00010000)
#define | SDIO_DATATIMEOUT ((uint32_t)0xFFFFFFFF)
#define | NULL 0
#define | SDIO_STATIC_FLAGS ((uint32_t)0x000005FF)
#define | SDIO_CMD0TIMEOUT ((uint32_t)0x00010000)
#define | SDIO_DATATIMEOUT ((uint32_t)0xFFFFFFFF)

Detailed Description

Macro Definition Documentation

◆ NULL [1/3]

#define NULL 0

sdio paremeters

Definition at line 340 of file emmc_card/inc/at32_sdio.h.

Referenced by fatfs_test(), get_device_other_speed(), get_device_other_speed(), get_device_other_speed(), get_device_other_speed(), get_device_other_speed(), get_device_other_speed(), get_device_other_speed(), get_device_other_speed(), get_device_other_speed(), get_device_other_speed(), get_device_other_speed(), get_device_other_speed(), get_device_qualifier(), get_device_qualifier(), get_device_qualifier(), get_device_qualifier(), get_device_qualifier(), get_device_qualifier(), get_device_qualifier(), get_device_qualifier(), get_device_qualifier(), get_device_qualifier(), get_device_qualifier(), get_device_qualifier(), get_inquiry(), main(), mmc_stream_write(), sd_block_read(), sd_block_write(), sd_mult_blocks_write(), sd_status_send(), sd_switch(), sdio_command_data_send(), uart_print_init(), and usbd_get_descriptor().

◆ NULL [2/3]

#define NULL 0

sdio paremeters

Definition at line 340 of file sd_mmc_card/inc/at32_sdio.h.

◆ NULL [3/3]

#define NULL 0

sdio paremeters

Definition at line 340 of file sdio_fatfs/inc/at32_sdio.h.

◆ SDIO_CMD0TIMEOUT [1/3]

#define SDIO_CMD0TIMEOUT ((uint32_t)0x00010000)

Definition at line 342 of file emmc_card/inc/at32_sdio.h.

Referenced by command_error(), command_rsp2_error(), and command_rsp7_error().

◆ SDIO_CMD0TIMEOUT [2/3]

#define SDIO_CMD0TIMEOUT ((uint32_t)0x00010000)

Definition at line 342 of file sd_mmc_card/inc/at32_sdio.h.

◆ SDIO_CMD0TIMEOUT [3/3]

#define SDIO_CMD0TIMEOUT ((uint32_t)0x00010000)

Definition at line 342 of file sdio_fatfs/inc/at32_sdio.h.

◆ SDIO_DATATIMEOUT [1/3]

#define SDIO_DATATIMEOUT ((uint32_t)0xFFFFFFFF)

Definition at line 343 of file emmc_card/inc/at32_sdio.h.

Referenced by sdio_command_data_send().

◆ SDIO_DATATIMEOUT [2/3]

#define SDIO_DATATIMEOUT ((uint32_t)0xFFFFFFFF)

Definition at line 343 of file sd_mmc_card/inc/at32_sdio.h.

◆ SDIO_DATATIMEOUT [3/3]

#define SDIO_DATATIMEOUT ((uint32_t)0xFFFFFFFF)

Definition at line 343 of file sdio_fatfs/inc/at32_sdio.h.

◆ SDIO_STATIC_FLAGS [1/3]

#define SDIO_STATIC_FLAGS ((uint32_t)0x000005FF)

Definition at line 341 of file emmc_card/inc/at32_sdio.h.

Referenced by check_card_programming(), command_error(), command_rsp1_error(), command_rsp2_error(), command_rsp3_error(), command_rsp4_error(), command_rsp5_error(), command_rsp6_error(), get_ext_csd(), mmc_stream_write(), scr_find(), sd_block_write(), sd_mult_blocks_write(), and sdio_command_data_send().

◆ SDIO_STATIC_FLAGS [2/3]

#define SDIO_STATIC_FLAGS ((uint32_t)0x000005FF)

Definition at line 341 of file sd_mmc_card/inc/at32_sdio.h.

◆ SDIO_STATIC_FLAGS [3/3]

#define SDIO_STATIC_FLAGS ((uint32_t)0x000005FF)

Definition at line 341 of file sdio_fatfs/inc/at32_sdio.h.


AT32F413 Firmwary Library: SDIO_response_definition

Macros
SDIO_response_definition
AT32F413_periph_examples » SDIO_emmc_card | AT32F413_periph_examples » SDIO_sd_mmc_card | AT32F413_periph_examples » SDIO_sdio_fatfs

Macros

#define | SD_OCR_ADDR_OUT_OF_RANGE ((uint32_t)0x80000000)
#define | SD_OCR_ADDR_MISALIGNED ((uint32_t)0x40000000)
#define | SD_OCR_BLK_LEN_ERR ((uint32_t)0x20000000)
#define | SD_OCR_ERASE_SEQ_ERR ((uint32_t)0x10000000)
#define | SD_OCR_INVALID_ERASE_PARAM ((uint32_t)0x08000000)
#define | SD_OCR_WR_PROTECT_VIOLATION ((uint32_t)0x04000000)
#define | SD_OCR_LOCK_UNLOCK_ERROR ((uint32_t)0x01000000)
#define | SD_OCR_CMD_CRC_ERROR ((uint32_t)0x00800000)
#define | SD_OCR_ILLEGAL_CMD ((uint32_t)0x00400000)
#define | SD_OCR_CARD_ECC_ERROR ((uint32_t)0x00200000)
#define | SD_OCR_CARD_CONTROLLER_ERR ((uint32_t)0x00100000)
#define | SD_OCR_GENERAL_UNKNOWN_ERROR ((uint32_t)0x00080000)
#define | SD_OCR_STREAM_RD_UNDERRUN ((uint32_t)0x00040000)
#define | SD_OCR_STREAM_WR_OVERRUN ((uint32_t)0x00020000)
#define | SD_OCR_CID_CSD_OVERWRIETE ((uint32_t)0x00010000)
#define | SD_OCR_WP_ERASE_SKIP ((uint32_t)0x00008000)
#define | SD_OCR_CARD_ECC_DISABLED ((uint32_t)0x00004000)
#define | SD_OCR_ERASE_RESET ((uint32_t)0x00002000)
#define | MMC_SWITCH_ERROR ((uint32_t)0x00000080)
#define | SD_OCR_AKE_SEQ_ERROR ((uint32_t)0x00000008)
#define | SD_OCR_ERRORBITS ((uint32_t)0xFDFFE008)
#define | SD_R5_OUT_OF_RANGE ((uint32_t)0x00000100)
#define | SD_R5_FUNCTION_NUMBER ((uint32_t)0x00000200)
#define | SD_R5_ERROR ((uint32_t)0x00000800)
#define | SD_R6_GENERAL_UNKNOWN_ERROR ((uint32_t)0x00002000)
#define | SD_R6_ILLEGAL_CMD ((uint32_t)0x00004000)
#define | SD_R6_CMD_CRC_ERROR ((uint32_t)0x00008000)
#define | SD_VOLTAGE_WINDOW_SD ((uint32_t)0x80100000)
#define | SD_HIGH_CAPACITY ((uint32_t)0x40000000)
#define | SD_STD_CAPACITY ((uint32_t)0x00000000)
#define | SD_CHECK_PATTERN ((uint32_t)0x000001AA)
#define | SD_VOLTAGE_WINDOW_MMC ((uint32_t)0x40FF8000)
#define | SD_MAX_VOLT_TRIAL ((uint32_t)0x000000FF)
#define | SD_ALLZERO ((uint32_t)0x00000000)
#define | SD_WIDE_BUS_SUPPORT ((uint32_t)0x00040000)
#define | SD_SINGLE_BUS_SUPPORT ((uint32_t)0x00010000)
#define | SD_CARD_LOCKED ((uint32_t)0x02000000)
#define | SD_CARD_PROGRAMMING ((uint32_t)0x00000007)
#define | SD_CARD_RECEIVING ((uint32_t)0x00000006)
#define | SD_DATATIMEOUT ((uint32_t)0xFFFFFFFF)
#define | SD_0TO7BITS ((uint32_t)0x000000FF)
#define | SD_8TO15BITS ((uint32_t)0x0000FF00)
#define | SD_16TO23BITS ((uint32_t)0x00FF0000)
#define | SD_24TO31BITS ((uint32_t)0xFF000000)
#define | SD_MAX_DATA_LENGTH ((uint32_t)0x01FFFFFF)
#define | SD_HALFFIFO ((uint32_t)0x00000008)
#define | SD_HALFFIFOBYTES ((uint32_t)0x00000020)
#define | SD_OCR_ADDR_OUT_OF_RANGE ((uint32_t)0x80000000)
#define | SD_OCR_ADDR_MISALIGNED ((uint32_t)0x40000000)
#define | SD_OCR_BLK_LEN_ERR ((uint32_t)0x20000000)
#define | SD_OCR_ERASE_SEQ_ERR ((uint32_t)0x10000000)
#define | SD_OCR_INVALID_ERASE_PARAM ((uint32_t)0x08000000)
#define | SD_OCR_WR_PROTECT_VIOLATION ((uint32_t)0x04000000)
#define | SD_OCR_LOCK_UNLOCK_ERROR ((uint32_t)0x01000000)
#define | SD_OCR_CMD_CRC_ERROR ((uint32_t)0x00800000)
#define | SD_OCR_ILLEGAL_CMD ((uint32_t)0x00400000)
#define | SD_OCR_CARD_ECC_ERROR ((uint32_t)0x00200000)
#define | SD_OCR_CARD_CONTROLLER_ERR ((uint32_t)0x00100000)
#define | SD_OCR_GENERAL_UNKNOWN_ERROR ((uint32_t)0x00080000)
#define | SD_OCR_STREAM_RD_UNDERRUN ((uint32_t)0x00040000)
#define | SD_OCR_STREAM_WR_OVERRUN ((uint32_t)0x00020000)
#define | SD_OCR_CID_CSD_OVERWRIETE ((uint32_t)0x00010000)
#define | SD_OCR_WP_ERASE_SKIP ((uint32_t)0x00008000)
#define | SD_OCR_CARD_ECC_DISABLED ((uint32_t)0x00004000)
#define | SD_OCR_ERASE_RESET ((uint32_t)0x00002000)
#define | MMC_SWITCH_ERROR ((uint32_t)0x00000080)
#define | SD_OCR_AKE_SEQ_ERROR ((uint32_t)0x00000008)
#define | SD_OCR_ERRORBITS ((uint32_t)0xFDFFE008)
#define | SD_R5_OUT_OF_RANGE ((uint32_t)0x00000100)
#define | SD_R5_FUNCTION_NUMBER ((uint32_t)0x00000200)
#define | SD_R5_ERROR ((uint32_t)0x00000800)
#define | SD_R6_GENERAL_UNKNOWN_ERROR ((uint32_t)0x00002000)
#define | SD_R6_ILLEGAL_CMD ((uint32_t)0x00004000)
#define | SD_R6_CMD_CRC_ERROR ((uint32_t)0x00008000)
#define | SD_VOLTAGE_WINDOW_SD ((uint32_t)0x80100000)
#define | SD_HIGH_CAPACITY ((uint32_t)0x40000000)
#define | SD_STD_CAPACITY ((uint32_t)0x00000000)
#define | SD_CHECK_PATTERN ((uint32_t)0x000001AA)
#define | SD_VOLTAGE_WINDOW_MMC ((uint32_t)0x40FF8000)
#define | SD_MAX_VOLT_TRIAL ((uint32_t)0x000000FF)
#define | SD_ALLZERO ((uint32_t)0x00000000)
#define | SD_WIDE_BUS_SUPPORT ((uint32_t)0x00040000)
#define | SD_SINGLE_BUS_SUPPORT ((uint32_t)0x00010000)
#define | SD_CARD_LOCKED ((uint32_t)0x02000000)
#define | SD_CARD_PROGRAMMING ((uint32_t)0x00000007)
#define | SD_CARD_RECEIVING ((uint32_t)0x00000006)
#define | SD_DATATIMEOUT ((uint32_t)0xFFFFFFFF)
#define | SD_0TO7BITS ((uint32_t)0x000000FF)
#define | SD_8TO15BITS ((uint32_t)0x0000FF00)
#define | SD_16TO23BITS ((uint32_t)0x00FF0000)
#define | SD_24TO31BITS ((uint32_t)0xFF000000)
#define | SD_MAX_DATA_LENGTH ((uint32_t)0x01FFFFFF)
#define | SD_HALFFIFO ((uint32_t)0x00000008)
#define | SD_HALFFIFOBYTES ((uint32_t)0x00000020)
#define | SD_OCR_ADDR_OUT_OF_RANGE ((uint32_t)0x80000000)
#define | SD_OCR_ADDR_MISALIGNED ((uint32_t)0x40000000)
#define | SD_OCR_BLK_LEN_ERR ((uint32_t)0x20000000)
#define | SD_OCR_ERASE_SEQ_ERR ((uint32_t)0x10000000)
#define | SD_OCR_INVALID_ERASE_PARAM ((uint32_t)0x08000000)
#define | SD_OCR_WR_PROTECT_VIOLATION ((uint32_t)0x04000000)
#define | SD_OCR_LOCK_UNLOCK_ERROR ((uint32_t)0x01000000)
#define | SD_OCR_CMD_CRC_ERROR ((uint32_t)0x00800000)
#define | SD_OCR_ILLEGAL_CMD ((uint32_t)0x00400000)
#define | SD_OCR_CARD_ECC_ERROR ((uint32_t)0x00200000)
#define | SD_OCR_CARD_CONTROLLER_ERR ((uint32_t)0x00100000)
#define | SD_OCR_GENERAL_UNKNOWN_ERROR ((uint32_t)0x00080000)
#define | SD_OCR_STREAM_RD_UNDERRUN ((uint32_t)0x00040000)
#define | SD_OCR_STREAM_WR_OVERRUN ((uint32_t)0x00020000)
#define | SD_OCR_CID_CSD_OVERWRIETE ((uint32_t)0x00010000)
#define | SD_OCR_WP_ERASE_SKIP ((uint32_t)0x00008000)
#define | SD_OCR_CARD_ECC_DISABLED ((uint32_t)0x00004000)
#define | SD_OCR_ERASE_RESET ((uint32_t)0x00002000)
#define | MMC_SWITCH_ERROR ((uint32_t)0x00000080)
#define | SD_OCR_AKE_SEQ_ERROR ((uint32_t)0x00000008)
#define | SD_OCR_ERRORBITS ((uint32_t)0xFDFFE008)
#define | SD_R5_OUT_OF_RANGE ((uint32_t)0x00000100)
#define | SD_R5_FUNCTION_NUMBER ((uint32_t)0x00000200)
#define | SD_R5_ERROR ((uint32_t)0x00000800)
#define | SD_R6_GENERAL_UNKNOWN_ERROR ((uint32_t)0x00002000)
#define | SD_R6_ILLEGAL_CMD ((uint32_t)0x00004000)
#define | SD_R6_CMD_CRC_ERROR ((uint32_t)0x00008000)
#define | SD_VOLTAGE_WINDOW_SD ((uint32_t)0x80100000)
#define | SD_HIGH_CAPACITY ((uint32_t)0x40000000)
#define | SD_STD_CAPACITY ((uint32_t)0x00000000)
#define | SD_CHECK_PATTERN ((uint32_t)0x000001AA)
#define | SD_VOLTAGE_WINDOW_MMC ((uint32_t)0x40FF8000)
#define | SD_MAX_VOLT_TRIAL ((uint32_t)0x000000FF)
#define | SD_ALLZERO ((uint32_t)0x00000000)
#define | SD_WIDE_BUS_SUPPORT ((uint32_t)0x00040000)
#define | SD_SINGLE_BUS_SUPPORT ((uint32_t)0x00010000)
#define | SD_CARD_LOCKED ((uint32_t)0x02000000)
#define | SD_CARD_PROGRAMMING ((uint32_t)0x00000007)
#define | SD_CARD_RECEIVING ((uint32_t)0x00000006)
#define | SD_DATATIMEOUT ((uint32_t)0xFFFFFFFF)
#define | SD_0TO7BITS ((uint32_t)0x000000FF)
#define | SD_8TO15BITS ((uint32_t)0x0000FF00)
#define | SD_16TO23BITS ((uint32_t)0x00FF0000)
#define | SD_24TO31BITS ((uint32_t)0xFF000000)
#define | SD_MAX_DATA_LENGTH ((uint32_t)0x01FFFFFF)
#define | SD_HALFFIFO ((uint32_t)0x00000008)
#define | SD_HALFFIFOBYTES ((uint32_t)0x00000020)

Detailed Description

Macro Definition Documentation

◆ MMC_SWITCH_ERROR [1/3]

#define MMC_SWITCH_ERROR ((uint32_t)0x00000080)

Definition at line 374 of file emmc_card/inc/at32_sdio.h.

Referenced by mmc_switch().

◆ MMC_SWITCH_ERROR [2/3]

#define MMC_SWITCH_ERROR ((uint32_t)0x00000080)

Definition at line 374 of file sd_mmc_card/inc/at32_sdio.h.

◆ MMC_SWITCH_ERROR [3/3]

#define MMC_SWITCH_ERROR ((uint32_t)0x00000080)

Definition at line 374 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_0TO7BITS [1/3]

#define SD_0TO7BITS ((uint32_t)0x000000FF)

Definition at line 404 of file emmc_card/inc/at32_sdio.h.

◆ SD_0TO7BITS [2/3]

#define SD_0TO7BITS ((uint32_t)0x000000FF)

Definition at line 404 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_0TO7BITS [3/3]

#define SD_0TO7BITS ((uint32_t)0x000000FF)

Definition at line 404 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_16TO23BITS [1/3]

#define SD_16TO23BITS ((uint32_t)0x00FF0000)

Definition at line 406 of file emmc_card/inc/at32_sdio.h.

◆ SD_16TO23BITS [2/3]

#define SD_16TO23BITS ((uint32_t)0x00FF0000)

Definition at line 406 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_16TO23BITS [3/3]

#define SD_16TO23BITS ((uint32_t)0x00FF0000)

Definition at line 406 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_24TO31BITS [1/3]

#define SD_24TO31BITS ((uint32_t)0xFF000000)

Definition at line 407 of file emmc_card/inc/at32_sdio.h.

◆ SD_24TO31BITS [2/3]

#define SD_24TO31BITS ((uint32_t)0xFF000000)

Definition at line 407 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_24TO31BITS [3/3]

#define SD_24TO31BITS ((uint32_t)0xFF000000)

Definition at line 407 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_8TO15BITS [1/3]

#define SD_8TO15BITS ((uint32_t)0x0000FF00)

Definition at line 405 of file emmc_card/inc/at32_sdio.h.

◆ SD_8TO15BITS [2/3]

#define SD_8TO15BITS ((uint32_t)0x0000FF00)

Definition at line 405 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_8TO15BITS [3/3]

#define SD_8TO15BITS ((uint32_t)0x0000FF00)

Definition at line 405 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_ALLZERO [1/3]

#define SD_ALLZERO ((uint32_t)0x00000000)

Definition at line 397 of file emmc_card/inc/at32_sdio.h.

Referenced by command_rsp6_error().

◆ SD_ALLZERO [2/3]

#define SD_ALLZERO ((uint32_t)0x00000000)

Definition at line 397 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_ALLZERO [3/3]

#define SD_ALLZERO ((uint32_t)0x00000000)

Definition at line 397 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CARD_LOCKED [1/3]

#define SD_CARD_LOCKED ((uint32_t)0x02000000)

Definition at line 400 of file emmc_card/inc/at32_sdio.h.

Referenced by mmc_stream_read(), mmc_stream_write(), sd_block_read(), sd_block_write(), sd_blocks_erase(), sd_bus_wide_enable(), sd_mult_blocks_read(), and sd_mult_blocks_write().

◆ SD_CARD_LOCKED [2/3]

#define SD_CARD_LOCKED ((uint32_t)0x02000000)

Definition at line 400 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CARD_LOCKED [3/3]

#define SD_CARD_LOCKED ((uint32_t)0x02000000)

Definition at line 400 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CARD_PROGRAMMING [1/3]

#define SD_CARD_PROGRAMMING ((uint32_t)0x00000007)

Definition at line 401 of file emmc_card/inc/at32_sdio.h.

Referenced by mmc_stream_write(), sd_block_write(), sd_blocks_erase(), and sd_mult_blocks_write().

◆ SD_CARD_PROGRAMMING [2/3]

#define SD_CARD_PROGRAMMING ((uint32_t)0x00000007)

Definition at line 401 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CARD_PROGRAMMING [3/3]

#define SD_CARD_PROGRAMMING ((uint32_t)0x00000007)

Definition at line 401 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CARD_RECEIVING [1/3]

#define SD_CARD_RECEIVING ((uint32_t)0x00000006)

Definition at line 402 of file emmc_card/inc/at32_sdio.h.

Referenced by mmc_stream_write(), sd_block_write(), sd_blocks_erase(), and sd_mult_blocks_write().

◆ SD_CARD_RECEIVING [2/3]

#define SD_CARD_RECEIVING ((uint32_t)0x00000006)

Definition at line 402 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CARD_RECEIVING [3/3]

#define SD_CARD_RECEIVING ((uint32_t)0x00000006)

Definition at line 402 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CHECK_PATTERN [1/3]

#define SD_CHECK_PATTERN ((uint32_t)0x000001AA)

Definition at line 394 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_power_on().

◆ SD_CHECK_PATTERN [2/3]

#define SD_CHECK_PATTERN ((uint32_t)0x000001AA)

Definition at line 394 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CHECK_PATTERN [3/3]

#define SD_CHECK_PATTERN ((uint32_t)0x000001AA)

Definition at line 394 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_DATATIMEOUT [1/3]

#define SD_DATATIMEOUT ((uint32_t)0xFFFFFFFF)

Definition at line 403 of file emmc_card/inc/at32_sdio.h.

Referenced by get_ext_csd(), mmc_stream_read(), mmc_stream_write(), mmc_switch(), scr_find(), sd_block_read(), sd_block_write(), sd_blocks_erase(), sd_mult_blocks_read(), sd_mult_blocks_write(), and sd_switch().

◆ SD_DATATIMEOUT [2/3]

#define SD_DATATIMEOUT ((uint32_t)0xFFFFFFFF)

Definition at line 403 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_DATATIMEOUT [3/3]

#define SD_DATATIMEOUT ((uint32_t)0xFFFFFFFF)

Definition at line 403 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_HALFFIFO [1/3]

#define SD_HALFFIFO ((uint32_t)0x00000008)

Definition at line 409 of file emmc_card/inc/at32_sdio.h.

◆ SD_HALFFIFO [2/3]

#define SD_HALFFIFO ((uint32_t)0x00000008)

Definition at line 409 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_HALFFIFO [3/3]

#define SD_HALFFIFO ((uint32_t)0x00000008)

Definition at line 409 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_HALFFIFOBYTES [1/3]

#define SD_HALFFIFOBYTES ((uint32_t)0x00000020)

Definition at line 410 of file emmc_card/inc/at32_sdio.h.

◆ SD_HALFFIFOBYTES [2/3]

#define SD_HALFFIFOBYTES ((uint32_t)0x00000020)

Definition at line 410 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_HALFFIFOBYTES [3/3]

#define SD_HALFFIFOBYTES ((uint32_t)0x00000020)

Definition at line 410 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_HIGH_CAPACITY [1/3]

#define SD_HIGH_CAPACITY ((uint32_t)0x40000000)

Definition at line 392 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_power_on().

◆ SD_HIGH_CAPACITY [2/3]

#define SD_HIGH_CAPACITY ((uint32_t)0x40000000)

Definition at line 392 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_HIGH_CAPACITY [3/3]

#define SD_HIGH_CAPACITY ((uint32_t)0x40000000)

Definition at line 392 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_MAX_DATA_LENGTH [1/3]

#define SD_MAX_DATA_LENGTH ((uint32_t)0x01FFFFFF)

Definition at line 408 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_mult_blocks_read(), and sd_mult_blocks_write().

◆ SD_MAX_DATA_LENGTH [2/3]

#define SD_MAX_DATA_LENGTH ((uint32_t)0x01FFFFFF)

Definition at line 408 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_MAX_DATA_LENGTH [3/3]

#define SD_MAX_DATA_LENGTH ((uint32_t)0x01FFFFFF)

Definition at line 408 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_MAX_VOLT_TRIAL [1/3]

#define SD_MAX_VOLT_TRIAL ((uint32_t)0x000000FF)

Definition at line 396 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_power_on().

◆ SD_MAX_VOLT_TRIAL [2/3]

#define SD_MAX_VOLT_TRIAL ((uint32_t)0x000000FF)

Definition at line 396 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_MAX_VOLT_TRIAL [3/3]

#define SD_MAX_VOLT_TRIAL ((uint32_t)0x000000FF)

Definition at line 396 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_OCR_ADDR_MISALIGNED [1/3]

#define SD_OCR_ADDR_MISALIGNED ((uint32_t)0x40000000)

Definition at line 357 of file emmc_card/inc/at32_sdio.h.

◆ SD_OCR_ADDR_MISALIGNED [2/3]

#define SD_OCR_ADDR_MISALIGNED ((uint32_t)0x40000000)

Definition at line 357 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_OCR_ADDR_MISALIGNED [3/3]

#define SD_OCR_ADDR_MISALIGNED ((uint32_t)0x40000000)

Definition at line 357 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_OCR_ADDR_OUT_OF_RANGE [1/3]

#define SD_OCR_ADDR_OUT_OF_RANGE ((uint32_t)0x80000000)

mask for errors card status r1 (ocr register)

Definition at line 356 of file emmc_card/inc/at32_sdio.h.

◆ SD_OCR_ADDR_OUT_OF_RANGE [2/3]

#define SD_OCR_ADDR_OUT_OF_RANGE ((uint32_t)0x80000000)

mask for errors card status r1 (ocr register)

Definition at line 356 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_OCR_ADDR_OUT_OF_RANGE [3/3]

#define SD_OCR_ADDR_OUT_OF_RANGE ((uint32_t)0x80000000)

mask for errors card status r1 (ocr register)

Definition at line 356 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_OCR_AKE_SEQ_ERROR [1/3]

#define SD_OCR_AKE_SEQ_ERROR ((uint32_t)0x00000008)

Definition at line 375 of file emmc_card/inc/at32_sdio.h.

◆ SD_OCR_AKE_SEQ_ERROR [2/3]

#define SD_OCR_AKE_SEQ_ERROR ((uint32_t)0x00000008)

Definition at line 375 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_OCR_AKE_SEQ_ERROR [3/3]

#define SD_OCR_AKE_SEQ_ERROR ((uint32_t)0x00000008)

Definition at line 375 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_OCR_BLK_LEN_ERR [1/3]

#define SD_OCR_BLK_LEN_ERR ((uint32_t)0x20000000)

Definition at line 358 of file emmc_card/inc/at32_sdio.h.

◆ SD_OCR_BLK_LEN_ERR [2/3]

#define SD_OCR_BLK_LEN_ERR ((uint32_t)0x20000000)

Definition at line 358 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_OCR_BLK_LEN_ERR [3/3]

#define SD_OCR_BLK_LEN_ERR ((uint32_t)0x20000000)

Definition at line 358 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_OCR_CARD_CONTROLLER_ERR [1/3]

#define SD_OCR_CARD_CONTROLLER_ERR ((uint32_t)0x00100000)

Definition at line 366 of file emmc_card/inc/at32_sdio.h.

◆ SD_OCR_CARD_CONTROLLER_ERR [2/3]

#define SD_OCR_CARD_CONTROLLER_ERR ((uint32_t)0x00100000)

Definition at line 366 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_OCR_CARD_CONTROLLER_ERR [3/3]

#define SD_OCR_CARD_CONTROLLER_ERR ((uint32_t)0x00100000)

Definition at line 366 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_OCR_CARD_ECC_DISABLED [1/3]

#define SD_OCR_CARD_ECC_DISABLED ((uint32_t)0x00004000)

Definition at line 372 of file emmc_card/inc/at32_sdio.h.

◆ SD_OCR_CARD_ECC_DISABLED [2/3]

#define SD_OCR_CARD_ECC_DISABLED ((uint32_t)0x00004000)

Definition at line 372 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_OCR_CARD_ECC_DISABLED [3/3]

#define SD_OCR_CARD_ECC_DISABLED ((uint32_t)0x00004000)

Definition at line 372 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_OCR_CARD_ECC_ERROR [1/3]

#define SD_OCR_CARD_ECC_ERROR ((uint32_t)0x00200000)

Definition at line 365 of file emmc_card/inc/at32_sdio.h.

◆ SD_OCR_CARD_ECC_ERROR [2/3]

#define SD_OCR_CARD_ECC_ERROR ((uint32_t)0x00200000)

Definition at line 365 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_OCR_CARD_ECC_ERROR [3/3]

#define SD_OCR_CARD_ECC_ERROR ((uint32_t)0x00200000)

Definition at line 365 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_OCR_CID_CSD_OVERWRIETE [1/3]

#define SD_OCR_CID_CSD_OVERWRIETE ((uint32_t)0x00010000)

Definition at line 370 of file emmc_card/inc/at32_sdio.h.

◆ SD_OCR_CID_CSD_OVERWRIETE [2/3]

#define SD_OCR_CID_CSD_OVERWRIETE ((uint32_t)0x00010000)

Definition at line 370 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_OCR_CID_CSD_OVERWRIETE [3/3]

#define SD_OCR_CID_CSD_OVERWRIETE ((uint32_t)0x00010000)

Definition at line 370 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_OCR_CMD_CRC_ERROR [1/3]

#define SD_OCR_CMD_CRC_ERROR ((uint32_t)0x00800000)

Definition at line 363 of file emmc_card/inc/at32_sdio.h.

◆ SD_OCR_CMD_CRC_ERROR [2/3]

#define SD_OCR_CMD_CRC_ERROR ((uint32_t)0x00800000)

Definition at line 363 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_OCR_CMD_CRC_ERROR [3/3]

#define SD_OCR_CMD_CRC_ERROR ((uint32_t)0x00800000)

Definition at line 363 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_OCR_ERASE_RESET [1/3]

#define SD_OCR_ERASE_RESET ((uint32_t)0x00002000)

Definition at line 373 of file emmc_card/inc/at32_sdio.h.

◆ SD_OCR_ERASE_RESET [2/3]

#define SD_OCR_ERASE_RESET ((uint32_t)0x00002000)

Definition at line 373 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_OCR_ERASE_RESET [3/3]

#define SD_OCR_ERASE_RESET ((uint32_t)0x00002000)

Definition at line 373 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_OCR_ERASE_SEQ_ERR [1/3]

#define SD_OCR_ERASE_SEQ_ERR ((uint32_t)0x10000000)

Definition at line 359 of file emmc_card/inc/at32_sdio.h.

◆ SD_OCR_ERASE_SEQ_ERR [2/3]

#define SD_OCR_ERASE_SEQ_ERR ((uint32_t)0x10000000)

Definition at line 359 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_OCR_ERASE_SEQ_ERR [3/3]

#define SD_OCR_ERASE_SEQ_ERR ((uint32_t)0x10000000)

Definition at line 359 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_OCR_ERRORBITS [1/3]

#define SD_OCR_ERRORBITS ((uint32_t)0xFDFFE008)

Definition at line 376 of file emmc_card/inc/at32_sdio.h.

Referenced by command_rsp1_error().

◆ SD_OCR_ERRORBITS [2/3]

#define SD_OCR_ERRORBITS ((uint32_t)0xFDFFE008)

Definition at line 376 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_OCR_ERRORBITS [3/3]

#define SD_OCR_ERRORBITS ((uint32_t)0xFDFFE008)

Definition at line 376 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_OCR_GENERAL_UNKNOWN_ERROR [1/3]

#define SD_OCR_GENERAL_UNKNOWN_ERROR ((uint32_t)0x00080000)

Definition at line 367 of file emmc_card/inc/at32_sdio.h.

◆ SD_OCR_GENERAL_UNKNOWN_ERROR [2/3]

#define SD_OCR_GENERAL_UNKNOWN_ERROR ((uint32_t)0x00080000)

Definition at line 367 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_OCR_GENERAL_UNKNOWN_ERROR [3/3]

#define SD_OCR_GENERAL_UNKNOWN_ERROR ((uint32_t)0x00080000)

Definition at line 367 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_OCR_ILLEGAL_CMD [1/3]

#define SD_OCR_ILLEGAL_CMD ((uint32_t)0x00400000)

Definition at line 364 of file emmc_card/inc/at32_sdio.h.

◆ SD_OCR_ILLEGAL_CMD [2/3]

#define SD_OCR_ILLEGAL_CMD ((uint32_t)0x00400000)

Definition at line 364 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_OCR_ILLEGAL_CMD [3/3]

#define SD_OCR_ILLEGAL_CMD ((uint32_t)0x00400000)

Definition at line 364 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_OCR_INVALID_ERASE_PARAM [1/3]

#define SD_OCR_INVALID_ERASE_PARAM ((uint32_t)0x08000000)

Definition at line 360 of file emmc_card/inc/at32_sdio.h.

◆ SD_OCR_INVALID_ERASE_PARAM [2/3]

#define SD_OCR_INVALID_ERASE_PARAM ((uint32_t)0x08000000)

Definition at line 360 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_OCR_INVALID_ERASE_PARAM [3/3]

#define SD_OCR_INVALID_ERASE_PARAM ((uint32_t)0x08000000)

Definition at line 360 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_OCR_LOCK_UNLOCK_ERROR [1/3]

#define SD_OCR_LOCK_UNLOCK_ERROR ((uint32_t)0x01000000)

Definition at line 362 of file emmc_card/inc/at32_sdio.h.

◆ SD_OCR_LOCK_UNLOCK_ERROR [2/3]

#define SD_OCR_LOCK_UNLOCK_ERROR ((uint32_t)0x01000000)

Definition at line 362 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_OCR_LOCK_UNLOCK_ERROR [3/3]

#define SD_OCR_LOCK_UNLOCK_ERROR ((uint32_t)0x01000000)

Definition at line 362 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_OCR_STREAM_RD_UNDERRUN [1/3]

#define SD_OCR_STREAM_RD_UNDERRUN ((uint32_t)0x00040000)

Definition at line 368 of file emmc_card/inc/at32_sdio.h.

◆ SD_OCR_STREAM_RD_UNDERRUN [2/3]

#define SD_OCR_STREAM_RD_UNDERRUN ((uint32_t)0x00040000)

Definition at line 368 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_OCR_STREAM_RD_UNDERRUN [3/3]

#define SD_OCR_STREAM_RD_UNDERRUN ((uint32_t)0x00040000)

Definition at line 368 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_OCR_STREAM_WR_OVERRUN [1/3]

#define SD_OCR_STREAM_WR_OVERRUN ((uint32_t)0x00020000)

Definition at line 369 of file emmc_card/inc/at32_sdio.h.

◆ SD_OCR_STREAM_WR_OVERRUN [2/3]

#define SD_OCR_STREAM_WR_OVERRUN ((uint32_t)0x00020000)

Definition at line 369 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_OCR_STREAM_WR_OVERRUN [3/3]

#define SD_OCR_STREAM_WR_OVERRUN ((uint32_t)0x00020000)

Definition at line 369 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_OCR_WP_ERASE_SKIP [1/3]

#define SD_OCR_WP_ERASE_SKIP ((uint32_t)0x00008000)

Definition at line 371 of file emmc_card/inc/at32_sdio.h.

◆ SD_OCR_WP_ERASE_SKIP [2/3]

#define SD_OCR_WP_ERASE_SKIP ((uint32_t)0x00008000)

Definition at line 371 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_OCR_WP_ERASE_SKIP [3/3]

#define SD_OCR_WP_ERASE_SKIP ((uint32_t)0x00008000)

Definition at line 371 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_OCR_WR_PROTECT_VIOLATION [1/3]

#define SD_OCR_WR_PROTECT_VIOLATION ((uint32_t)0x04000000)

Definition at line 361 of file emmc_card/inc/at32_sdio.h.

◆ SD_OCR_WR_PROTECT_VIOLATION [2/3]

#define SD_OCR_WR_PROTECT_VIOLATION ((uint32_t)0x04000000)

Definition at line 361 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_OCR_WR_PROTECT_VIOLATION [3/3]

#define SD_OCR_WR_PROTECT_VIOLATION ((uint32_t)0x04000000)

Definition at line 361 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_R5_ERROR [1/3]

#define SD_R5_ERROR ((uint32_t)0x00000800)

Definition at line 383 of file emmc_card/inc/at32_sdio.h.

Referenced by command_rsp5_error().

◆ SD_R5_ERROR [2/3]

#define SD_R5_ERROR ((uint32_t)0x00000800)

Definition at line 383 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_R5_ERROR [3/3]

#define SD_R5_ERROR ((uint32_t)0x00000800)

Definition at line 383 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_R5_FUNCTION_NUMBER [1/3]

#define SD_R5_FUNCTION_NUMBER ((uint32_t)0x00000200)

Definition at line 382 of file emmc_card/inc/at32_sdio.h.

Referenced by command_rsp5_error().

◆ SD_R5_FUNCTION_NUMBER [2/3]

#define SD_R5_FUNCTION_NUMBER ((uint32_t)0x00000200)

Definition at line 382 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_R5_FUNCTION_NUMBER [3/3]

#define SD_R5_FUNCTION_NUMBER ((uint32_t)0x00000200)

Definition at line 382 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_R5_OUT_OF_RANGE [1/3]

#define SD_R5_OUT_OF_RANGE ((uint32_t)0x00000100)

masks for r5 response

Definition at line 381 of file emmc_card/inc/at32_sdio.h.

Referenced by command_rsp5_error().

◆ SD_R5_OUT_OF_RANGE [2/3]

#define SD_R5_OUT_OF_RANGE ((uint32_t)0x00000100)

masks for r5 response

Definition at line 381 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_R5_OUT_OF_RANGE [3/3]

#define SD_R5_OUT_OF_RANGE ((uint32_t)0x00000100)

masks for r5 response

Definition at line 381 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_R6_CMD_CRC_ERROR [1/3]

#define SD_R6_CMD_CRC_ERROR ((uint32_t)0x00008000)

Definition at line 390 of file emmc_card/inc/at32_sdio.h.

Referenced by command_rsp6_error().

◆ SD_R6_CMD_CRC_ERROR [2/3]

#define SD_R6_CMD_CRC_ERROR ((uint32_t)0x00008000)

Definition at line 390 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_R6_CMD_CRC_ERROR [3/3]

#define SD_R6_CMD_CRC_ERROR ((uint32_t)0x00008000)

Definition at line 390 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_R6_GENERAL_UNKNOWN_ERROR [1/3]

#define SD_R6_GENERAL_UNKNOWN_ERROR ((uint32_t)0x00002000)

masks for r6 response

Definition at line 388 of file emmc_card/inc/at32_sdio.h.

Referenced by command_rsp6_error().

◆ SD_R6_GENERAL_UNKNOWN_ERROR [2/3]

#define SD_R6_GENERAL_UNKNOWN_ERROR ((uint32_t)0x00002000)

masks for r6 response

Definition at line 388 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_R6_GENERAL_UNKNOWN_ERROR [3/3]

#define SD_R6_GENERAL_UNKNOWN_ERROR ((uint32_t)0x00002000)

masks for r6 response

Definition at line 388 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_R6_ILLEGAL_CMD [1/3]

#define SD_R6_ILLEGAL_CMD ((uint32_t)0x00004000)

Definition at line 389 of file emmc_card/inc/at32_sdio.h.

Referenced by command_rsp6_error().

◆ SD_R6_ILLEGAL_CMD [2/3]

#define SD_R6_ILLEGAL_CMD ((uint32_t)0x00004000)

Definition at line 389 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_R6_ILLEGAL_CMD [3/3]

#define SD_R6_ILLEGAL_CMD ((uint32_t)0x00004000)

Definition at line 389 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_SINGLE_BUS_SUPPORT [1/3]

#define SD_SINGLE_BUS_SUPPORT ((uint32_t)0x00010000)

Definition at line 399 of file emmc_card/inc/at32_sdio.h.

◆ SD_SINGLE_BUS_SUPPORT [2/3]

#define SD_SINGLE_BUS_SUPPORT ((uint32_t)0x00010000)

Definition at line 399 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_SINGLE_BUS_SUPPORT [3/3]

#define SD_SINGLE_BUS_SUPPORT ((uint32_t)0x00010000)

Definition at line 399 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_STD_CAPACITY [1/3]

#define SD_STD_CAPACITY ((uint32_t)0x00000000)

Definition at line 393 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_power_on().

◆ SD_STD_CAPACITY [2/3]

#define SD_STD_CAPACITY ((uint32_t)0x00000000)

Definition at line 393 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_STD_CAPACITY [3/3]

#define SD_STD_CAPACITY ((uint32_t)0x00000000)

Definition at line 393 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_VOLTAGE_WINDOW_MMC [1/3]

#define SD_VOLTAGE_WINDOW_MMC ((uint32_t)0x40FF8000)

Definition at line 395 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_power_on().

◆ SD_VOLTAGE_WINDOW_MMC [2/3]

#define SD_VOLTAGE_WINDOW_MMC ((uint32_t)0x40FF8000)

Definition at line 395 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_VOLTAGE_WINDOW_MMC [3/3]

#define SD_VOLTAGE_WINDOW_MMC ((uint32_t)0x40FF8000)

Definition at line 395 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_VOLTAGE_WINDOW_SD [1/3]

#define SD_VOLTAGE_WINDOW_SD ((uint32_t)0x80100000)

Definition at line 391 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_power_on().

◆ SD_VOLTAGE_WINDOW_SD [2/3]

#define SD_VOLTAGE_WINDOW_SD ((uint32_t)0x80100000)

Definition at line 391 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_VOLTAGE_WINDOW_SD [3/3]

#define SD_VOLTAGE_WINDOW_SD ((uint32_t)0x80100000)

Definition at line 391 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_WIDE_BUS_SUPPORT [1/3]

#define SD_WIDE_BUS_SUPPORT ((uint32_t)0x00040000)

Definition at line 398 of file emmc_card/inc/at32_sdio.h.

◆ SD_WIDE_BUS_SUPPORT [2/3]

#define SD_WIDE_BUS_SUPPORT ((uint32_t)0x00040000)

Definition at line 398 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_WIDE_BUS_SUPPORT [3/3]

#define SD_WIDE_BUS_SUPPORT ((uint32_t)0x00040000)

Definition at line 398 of file sdio_fatfs/inc/at32_sdio.h.


AT32F413 Firmwary Library: SDIO_command_class_definition

Macros
SDIO_command_class_definition
AT32F413_periph_examples » SDIO_emmc_card | AT32F413_periph_examples » SDIO_sd_mmc_card | AT32F413_periph_examples » SDIO_sdio_fatfs

Macros

#define | SD_CCCC_LOCK_UNLOCK ((uint32_t)0x00000080)
#define | SD_CCCC_WRITE_PROT ((uint32_t)0x00000040)
#define | SD_CCCC_ERASE ((uint32_t)0x00000020)
#define | SD_CCCC_LOCK_UNLOCK ((uint32_t)0x00000080)
#define | SD_CCCC_WRITE_PROT ((uint32_t)0x00000040)
#define | SD_CCCC_ERASE ((uint32_t)0x00000020)
#define | SD_CCCC_LOCK_UNLOCK ((uint32_t)0x00000080)
#define | SD_CCCC_WRITE_PROT ((uint32_t)0x00000040)
#define | SD_CCCC_ERASE ((uint32_t)0x00000020)

Detailed Description

Macro Definition Documentation

◆ SD_CCCC_ERASE [1/3]

#define SD_CCCC_ERASE ((uint32_t)0x00000020)

Definition at line 425 of file emmc_card/inc/at32_sdio.h.

◆ SD_CCCC_ERASE [2/3]

#define SD_CCCC_ERASE ((uint32_t)0x00000020)

Definition at line 425 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CCCC_ERASE [3/3]

#define SD_CCCC_ERASE ((uint32_t)0x00000020)

Definition at line 425 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CCCC_LOCK_UNLOCK [1/3]

#define SD_CCCC_LOCK_UNLOCK ((uint32_t)0x00000080)

command class supported

Definition at line 423 of file emmc_card/inc/at32_sdio.h.

◆ SD_CCCC_LOCK_UNLOCK [2/3]

#define SD_CCCC_LOCK_UNLOCK ((uint32_t)0x00000080)

command class supported

Definition at line 423 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CCCC_LOCK_UNLOCK [3/3]

#define SD_CCCC_LOCK_UNLOCK ((uint32_t)0x00000080)

command class supported

Definition at line 423 of file sdio_fatfs/inc/at32_sdio.h.

◆ SD_CCCC_WRITE_PROT [1/3]

#define SD_CCCC_WRITE_PROT ((uint32_t)0x00000040)

Definition at line 424 of file emmc_card/inc/at32_sdio.h.

◆ SD_CCCC_WRITE_PROT [2/3]

#define SD_CCCC_WRITE_PROT ((uint32_t)0x00000040)

Definition at line 424 of file sd_mmc_card/inc/at32_sdio.h.

◆ SD_CCCC_WRITE_PROT [3/3]

#define SD_CCCC_WRITE_PROT ((uint32_t)0x00000040)

Definition at line 424 of file sdio_fatfs/inc/at32_sdio.h.


AT32F413 Firmwary Library: SDIO_cmd8_definition

Macros
SDIO_cmd8_definition
AT32F413_periph_examples » SDIO_emmc_card | AT32F413_periph_examples » SDIO_sd_mmc_card | AT32F413_periph_examples » SDIO_sdio_fatfs

Macros

#define | SDIO_SEND_IF_COND ((uint32_t)0x00000008)
#define | SDIO_SEND_IF_COND ((uint32_t)0x00000008)
#define | SDIO_SEND_IF_COND ((uint32_t)0x00000008)

Detailed Description

Macro Definition Documentation

◆ SDIO_SEND_IF_COND [1/3]

#define SDIO_SEND_IF_COND ((uint32_t)0x00000008)

cmd8

Definition at line 438 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_power_on().

◆ SDIO_SEND_IF_COND [2/3]

#define SDIO_SEND_IF_COND ((uint32_t)0x00000008)

cmd8

Definition at line 438 of file sd_mmc_card/inc/at32_sdio.h.

◆ SDIO_SEND_IF_COND [3/3]

#define SDIO_SEND_IF_COND ((uint32_t)0x00000008)

cmd8

Definition at line 438 of file sdio_fatfs/inc/at32_sdio.h.


AT32F413 Firmwary Library: SDIO_mmc_extend_definition

Macros
SDIO_mmc_extend_definition
AT32F413_periph_examples » SDIO_emmc_card | AT32F413_periph_examples » SDIO_sd_mmc_card | AT32F413_periph_examples » SDIO_sdio_fatfs

Macros

#define | EXT_CSD_Command_set 0x0
#define | EXT_CSD_Set_bit 0x1
#define | EXT_CSD_Clear_byte 0x2
#define | EXT_CSD_Write_byte 0x3
#define | EXT_CSD_CMD_SET_NORMAL (1<<0)
#define | EXT_CSD_CMD_SET_SECURE (1<<1)
#define | EXT_CSD_CMD_SET_CPSECURE (1<<2)
#define | EXT_CSD_BUS_WIDTH 183
#define | EXT_CSD_HS_TIMING 185
#define | EXT_CSD_Command_set 0x0
#define | EXT_CSD_Set_bit 0x1
#define | EXT_CSD_Clear_byte 0x2
#define | EXT_CSD_Write_byte 0x3
#define | EXT_CSD_CMD_SET_NORMAL (1<<0)
#define | EXT_CSD_CMD_SET_SECURE (1<<1)
#define | EXT_CSD_CMD_SET_CPSECURE (1<<2)
#define | EXT_CSD_BUS_WIDTH 183
#define | EXT_CSD_HS_TIMING 185
#define | EXT_CSD_Command_set 0x0
#define | EXT_CSD_Set_bit 0x1
#define | EXT_CSD_Clear_byte 0x2
#define | EXT_CSD_Write_byte 0x3
#define | EXT_CSD_CMD_SET_NORMAL (1<<0)
#define | EXT_CSD_CMD_SET_SECURE (1<<1)
#define | EXT_CSD_CMD_SET_CPSECURE (1<<2)
#define | EXT_CSD_BUS_WIDTH 183
#define | EXT_CSD_HS_TIMING 185

Detailed Description

Macro Definition Documentation

◆ EXT_CSD_BUS_WIDTH [1/3]

#define EXT_CSD_BUS_WIDTH 183

mmc ext_csd offset

Definition at line 463 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_wide_bus_operation_config(), and speed_change().

◆ EXT_CSD_BUS_WIDTH [2/3]

#define EXT_CSD_BUS_WIDTH 183

mmc ext_csd offset

Definition at line 463 of file sd_mmc_card/inc/at32_sdio.h.

◆ EXT_CSD_BUS_WIDTH [3/3]

#define EXT_CSD_BUS_WIDTH 183

mmc ext_csd offset

Definition at line 463 of file sdio_fatfs/inc/at32_sdio.h.

◆ EXT_CSD_Clear_byte [1/3]

#define EXT_CSD_Clear_byte 0x2

Definition at line 453 of file emmc_card/inc/at32_sdio.h.

◆ EXT_CSD_Clear_byte [2/3]

#define EXT_CSD_Clear_byte 0x2

Definition at line 453 of file sd_mmc_card/inc/at32_sdio.h.

◆ EXT_CSD_Clear_byte [3/3]

#define EXT_CSD_Clear_byte 0x2

Definition at line 453 of file sdio_fatfs/inc/at32_sdio.h.

◆ EXT_CSD_CMD_SET_CPSECURE [1/3]

#define EXT_CSD_CMD_SET_CPSECURE (1<<2)

Definition at line 458 of file emmc_card/inc/at32_sdio.h.

◆ EXT_CSD_CMD_SET_CPSECURE [2/3]

#define EXT_CSD_CMD_SET_CPSECURE (1<<2)

Definition at line 458 of file sd_mmc_card/inc/at32_sdio.h.

◆ EXT_CSD_CMD_SET_CPSECURE [3/3]

#define EXT_CSD_CMD_SET_CPSECURE (1<<2)

Definition at line 458 of file sdio_fatfs/inc/at32_sdio.h.

◆ EXT_CSD_CMD_SET_NORMAL [1/3]

#define EXT_CSD_CMD_SET_NORMAL (1<<0)

Definition at line 456 of file emmc_card/inc/at32_sdio.h.

Referenced by sd_wide_bus_operation_config(), and speed_change().

◆ EXT_CSD_CMD_SET_NORMAL [2/3]

#define EXT_CSD_CMD_SET_NORMAL (1<<0)

Definition at line 456 of file sd_mmc_card/inc/at32_sdio.h.

◆ EXT_CSD_CMD_SET_NORMAL [3/3]

#define EXT_CSD_CMD_SET_NORMAL (1<<0)

Definition at line 456 of file sdio_fatfs/inc/at32_sdio.h.

◆ EXT_CSD_CMD_SET_SECURE [1/3]

#define EXT_CSD_CMD_SET_SECURE (1<<1)

Definition at line 457 of file emmc_card/inc/at32_sdio.h.

◆ EXT_CSD_CMD_SET_SECURE [2/3]

#define EXT_CSD_CMD_SET_SECURE (1<<1)

Definition at line 457 of file sd_mmc_card/inc/at32_sdio.h.

◆ EXT_CSD_CMD_SET_SECURE [3/3]

#define EXT_CSD_CMD_SET_SECURE (1<<1)

Definition at line 457 of file sdio_fatfs/inc/at32_sdio.h.

◆ EXT_CSD_Command_set [1/3]

#define EXT_CSD_Command_set 0x0

mmc ext_csd operation

Definition at line 451 of file emmc_card/inc/at32_sdio.h.

◆ EXT_CSD_Command_set [2/3]

#define EXT_CSD_Command_set 0x0

mmc ext_csd operation

Definition at line 451 of file sd_mmc_card/inc/at32_sdio.h.

◆ EXT_CSD_Command_set [3/3]

#define EXT_CSD_Command_set 0x0

mmc ext_csd operation

Definition at line 451 of file sdio_fatfs/inc/at32_sdio.h.

◆ EXT_CSD_HS_TIMING [1/3]

#define EXT_CSD_HS_TIMING 185

Definition at line 464 of file emmc_card/inc/at32_sdio.h.

◆ EXT_CSD_HS_TIMING [2/3]

#define EXT_CSD_HS_TIMING 185

Definition at line 464 of file sd_mmc_card/inc/at32_sdio.h.

◆ EXT_CSD_HS_TIMING [3/3]

#define EXT_CSD_HS_TIMING 185

Definition at line 464 of file sdio_fatfs/inc/at32_sdio.h.

◆ EXT_CSD_Set_bit [1/3]

#define EXT_CSD_Set_bit 0x1

Definition at line 452 of file emmc_card/inc/at32_sdio.h.

◆ EXT_CSD_Set_bit [2/3]

#define EXT_CSD_Set_bit 0x1

Definition at line 452 of file sd_mmc_card/inc/at32_sdio.h.

◆ EXT_CSD_Set_bit [3/3]

#define EXT_CSD_Set_bit 0x1

Definition at line 452 of file sdio_fatfs/inc/at32_sdio.h.

◆ EXT_CSD_Write_byte [1/3]

#define EXT_CSD_Write_byte 0x3

Definition at line 454 of file emmc_card/inc/at32_sdio.h.

Referenced by mmc_switch().

◆ EXT_CSD_Write_byte [2/3]

#define EXT_CSD_Write_byte 0x3

Definition at line 454 of file sd_mmc_card/inc/at32_sdio.h.

◆ EXT_CSD_Write_byte [3/3]

#define EXT_CSD_Write_byte 0x3

Definition at line 454 of file sdio_fatfs/inc/at32_sdio.h.


AT32F413 Firmwary Library: SDIO_interrupt_flags_definition

Macros
SDIO_interrupt_flags_definition
AT32F413_periph_examples » SDIO_emmc_card | AT32F413_periph_examples » SDIO_sd_mmc_card | AT32F413_periph_examples » SDIO_sdio_fatfs

Macros

#define | SDIO_INTR_STS_WRITE_MASK
#define | SDIO_INTR_STS_READ_MASK
#define | SDIO_INTR_STS_WRITE_MASK
#define | SDIO_INTR_STS_READ_MASK
#define | SDIO_INTR_STS_WRITE_MASK
#define | SDIO_INTR_STS_READ_MASK

Detailed Description

Macro Definition Documentation

◆ SDIO_INTR_STS_READ_MASK [1/3]

#define SDIO_INTR_STS_READ_MASK
Value:
(SDIO_DTFAIL_FLAG | SDIO_DTTIMEOUT_FLAG | SDIO_RXERRO_FLAG | \
SDIO_DTCMPL_FLAG | SDIO_SBITERR_FLAG)
SDIO_DTFAIL_FLAG
#define SDIO_DTFAIL_FLAG
Definition at32f413_sdio.h:85
SDIO_RXERRO_FLAG
#define SDIO_RXERRO_FLAG
Definition at32f413_sdio.h:89
SDIO_DTTIMEOUT_FLAG
#define SDIO_DTTIMEOUT_FLAG
Definition at32f413_sdio.h:87
SDIO_SBITERR_FLAG
#define SDIO_SBITERR_FLAG
Definition at32f413_sdio.h:93
SDIO_DTCMPL_FLAG
#define SDIO_DTCMPL_FLAG
Definition at32f413_sdio.h:92

Definition at line 476 of file emmc_card/inc/at32_sdio.h.

Referenced by sdio_command_data_send().

◆ SDIO_INTR_STS_READ_MASK [2/3]

#define SDIO_INTR_STS_READ_MASK
Value:
(SDIO_DTFAIL_FLAG | SDIO_DTTIMEOUT_FLAG | SDIO_RXERRO_FLAG | \
SDIO_DTCMPL_FLAG | SDIO_SBITERR_FLAG)

Definition at line 476 of file sd_mmc_card/inc/at32_sdio.h.

◆ SDIO_INTR_STS_READ_MASK [3/3]

#define SDIO_INTR_STS_READ_MASK
Value:
(SDIO_DTFAIL_FLAG | SDIO_DTTIMEOUT_FLAG | SDIO_RXERRO_FLAG | \
SDIO_DTCMPL_FLAG | SDIO_SBITERR_FLAG)

Definition at line 476 of file sdio_fatfs/inc/at32_sdio.h.

◆ SDIO_INTR_STS_WRITE_MASK [1/3]

#define SDIO_INTR_STS_WRITE_MASK
Value:
(SDIO_DTFAIL_FLAG | SDIO_DTTIMEOUT_FLAG | SDIO_TXERRU_FLAG | \
SDIO_DTCMPL_FLAG | SDIO_SBITERR_FLAG)
SDIO_TXERRU_FLAG
#define SDIO_TXERRU_FLAG
Definition at32f413_sdio.h:88

Definition at line 474 of file emmc_card/inc/at32_sdio.h.

Referenced by sdio_command_data_send().

◆ SDIO_INTR_STS_WRITE_MASK [2/3]

#define SDIO_INTR_STS_WRITE_MASK
Value:
(SDIO_DTFAIL_FLAG | SDIO_DTTIMEOUT_FLAG | SDIO_TXERRU_FLAG | \
SDIO_DTCMPL_FLAG | SDIO_SBITERR_FLAG)

Definition at line 474 of file sd_mmc_card/inc/at32_sdio.h.

◆ SDIO_INTR_STS_WRITE_MASK [3/3]

#define SDIO_INTR_STS_WRITE_MASK
Value:
(SDIO_DTFAIL_FLAG | SDIO_DTTIMEOUT_FLAG | SDIO_TXERRU_FLAG | \
SDIO_DTCMPL_FLAG | SDIO_SBITERR_FLAG)

Definition at line 474 of file sdio_fatfs/inc/at32_sdio.h.


AT32F413 Firmwary Library: SDIO_emmc_card

Macros | Enumerations | Functions | Variables
SDIO_emmc_card
AT32F413_periph_examples

Macros

#define | BLOCK_SIZE (512)
#define | BLOCKS_NUMBER (8)
#define | MULTI_BUFFER_SIZE (BLOCK_SIZE * BLOCKS_NUMBER)
#define | STREAM_BUFFER_SIZE (1024)

Enumerations

enum test_result_type { TEST_FAIL = 0 , TEST_SUCCESS }

Functions

sd_error_status_type | command_error (void)
checks for error conditions for cmd0.
sd_error_status_type | command_rsp1_error (uint8_t cmd)
checks for error conditions for R1 response.
sd_error_status_type | command_rsp2_error (void)
checks for error conditions for R2 (cid or csd) response.
sd_error_status_type | command_rsp3_error (void)
checks for error conditions for R3 (ocr) response.
sd_error_status_type | command_rsp4_error (uint8_t cmd)
checks for error conditions for r4 response.
sd_error_status_type | command_rsp5_error (uint8_t cmd)
checks for error conditions for r5 response.
sd_error_status_type | command_rsp6_error (uint8_t cmd, uint16_t *prca)
checks for error conditions for r6 (rca) response.
sd_error_status_type | command_rsp7_error (void)
checks for error conditions for R7 response.
sd_error_status_type | sd_bus_wide_enable (confirm_state new_state)
enable or disable the sdio wide bus mode.
sd_error_status_type | mmc_switch (uint8_t set, uint8_t index, uint8_t value)
switch mmc card speed to high speed
sd_error_status_type | sd_switch (uint32_t mode, uint32_t group, uint8_t value, uint8_t *rsp)
switch sd card speed to high speed
sd_error_status_type | check_card_programming (uint8_t *p_status)
checks if the sd card is in programming state.
sd_error_status_type | speed_change (uint8_t speed)
set bus speed
sd_error_status_type | get_ext_csd (void)
find the sd card ext csd register value.
sd_error_status_type | scr_find (void)
find the sd card scr register value.
uint8_t | convert_from_bytes_to_power_of_two (uint16_t number_of_bytes)
converts the number of bytes in power of two and returns the power.
sd_error_status_type | sd_init (void)
initializes the sd card and put it into standby state (ready for data transfer).
void | sdio_clock_set (uint32_t clk_div)
set sdio clock devision factor.
sd_error_status_type | sd_power_on (void)
enquires cards about their operating voltage and configures clock controls.
sd_error_status_type | sd_power_off (void)
turns the sdio output signals off.
sd_error_status_type | sd_card_init (void)
intialises all cards or single card as the case may be card(s) come into standby state.
sd_error_status_type | sd_card_info_get (sd_card_info_struct_type *card_info)
returns information about specific card.
sd_error_status_type | sd_wide_bus_operation_config (sdio_bus_width_type mode)
enable wide bus opeartion for the requeseted card if supported by card.
sd_error_status_type | sd_device_mode_set (uint32_t mode)
set sdio work mode.
sd_error_status_type | sd_deselect_select (uint32_t addr)
selects od deselects the corresponding card.
sd_error_status_type | sdio_command_data_send (sdio_command_struct_type *sdio_cmd_init_t, sdio_data_struct_type *sdio_data_init_t, uint32_t *buf)
read data from or write data to sd card.
sd_error_status_type | sd_blocks_erase (long long addr, uint32_t nblks)
erase continuous data block
sd_error_status_type | sd_block_read (uint8_t *buf, long long addr, uint16_t blk_size)
allows to read one block from a specified address in a card. the data transfer can be managed by dma mode or polling mode.
sd_error_status_type | sd_mult_blocks_read (uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks)
allows to read blocks from a specified address in a card. the data transfer can be managed by dma mode or polling mode.
sd_error_status_type | sd_block_write (const uint8_t *buf, long long addr, uint16_t blk_size)
allows to write one block starting from a specified address in a card. the data transfer can be managed by dma mode or polling mode.
sd_error_status_type | sd_mult_blocks_write (const uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks)
allows to write blocks starting from a specified address in a card. the data transfer can be managed by dma mode only.
sd_error_status_type | mmc_stream_read (uint8_t *buf, long long addr, uint32_t len)
read mmc card data stream.
sd_error_status_type | mmc_stream_write (uint8_t *buf, long long addr, uint32_t len)
write mmc card data stream.
void | SDIO1_IRQHandler (void)
sdio1 isr.
void | SDIO2_IRQHandler (void)
sdio2 isr.
sd_error_status_type | sd_irq_service (void)
allows to process all the interrupts that are high.
sd_error_status_type | sd_status_send (uint32_t *p_card_status)
read current card status.
sd_card_state_type | sd_state_get (void)
returns information about sd card.
void | sd_dma_config (uint32_t *mbuf, uint32_t buf_size, dma_dir_type dir)
set dma configuation for sdio
void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
static test_result_type | sd_single_block_test (void)
sd card single block read/write test.
static test_result_type | sd_multiple_blocks_test (void)
sd card multiple blocks read/write test.
uint8_t | buffer_compare (uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t buffer_length)
compares two buffers.
static void | sd_test_error (void)
LED2 on off every 300ms for sd test error.
static void | nvic_configuration (void)
configures sdio1 irq channel.
static test_result_type | mmc_stream_test (void)
mmc card data stream read/write test.
void | show_card_info (void)
show sd/mmc card info.
int | main (void)
main function.

Variables

sdio_command_struct_type sdio_command_init_struct
sdio_data_struct_type sdio_data_init_struct
static sd_memory_card_type | card_type = SDIO_STD_CAPACITY_SD_CARD_V1_1
static uint32_t | csd_table [4]
static uint32_t | cid_table [4]
static uint32_t | rca = 0
static uint32_t | ext_csd_table [128]
static sd_data_transfer_mode_type | device_mode = SD_TRANSFER_POLLING_MODE
static uint8_t | stop_flag = 0
volatile sd_error_status_type | transfer_error = SD_OK
volatile uint8_t | transfer_end = 0
sd_card_info_struct_type sd_card_info
static uint8_t | sblock_tbuffer [(512)]
static uint8_t | sblock_rbuffer [(512)]
static uint8_t | mblock_tbuffer [((512) *(8))]
static uint8_t | mblock_rbuffer [((512) *(8))]
static uint8_t | stream_tbuffer [(1024)]
static uint8_t | stream_rbuffer [(1024)]

Detailed Description

Macro Definition Documentation

◆ BLOCK_SIZE

#define BLOCK_SIZE (512)

Definition at line 40 of file project/at_start_f413/examples/sdio/emmc_card/src/main.c.

Referenced by sd_multiple_blocks_test(), and sd_single_block_test().

◆ BLOCKS_NUMBER

#define BLOCKS_NUMBER (8)

Definition at line 41 of file project/at_start_f413/examples/sdio/emmc_card/src/main.c.

Referenced by sd_multiple_blocks_test().

◆ MULTI_BUFFER_SIZE

#define MULTI_BUFFER_SIZE (BLOCK_SIZE * BLOCKS_NUMBER)

Definition at line 42 of file project/at_start_f413/examples/sdio/emmc_card/src/main.c.

Referenced by sd_multiple_blocks_test().

◆ STREAM_BUFFER_SIZE

#define STREAM_BUFFER_SIZE (1024)

Definition at line 43 of file project/at_start_f413/examples/sdio/emmc_card/src/main.c.

Referenced by mmc_stream_test().

Enumeration Type Documentation

◆ test_result_type

enum test_result_type

test result

Enumerator
TEST_FAIL
TEST_SUCCESS

Definition at line 52 of file project/at_start_f413/examples/sdio/emmc_card/src/main.c.

Function Documentation

◆ buffer_compare()

uint8_t buffer_compare | ( | uint8_t * | pbuffer1,
 |  | uint8_t * | pbuffer2,
 |  | uint16_t | buffer_length )

compares two buffers.

Parameters
pbuffer1,pbuffer2 | buffers to be compared.
buffer_length | buffer's length
Return values
1 pbuffer1 identical to pbuffer2 0: pbuffer1 differs from pbuffer2

Definition at line 214 of file project/at_start_f413/examples/sdio/emmc_card/src/main.c.

Referenced by mmc_stream_test(), sd_multiple_blocks_test(), and sd_single_block_test().

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/sdio/emmc_card/src/at32f413_int.c.

◆ check_card_programming()

sd_error_status_type check_card_programming ( uint8_t * p_status )

checks if the sd card is in programming state.

Parameters
p_status pointer to the variable that will contain the sd card state.
Return values
sd_error_status_type sd card error code.

Definition at line 2420 of file emmc_card/src/at32_sdio.c.

Referenced by mmc_stream_write(), sd_block_write(), sd_blocks_erase(), and sd_mult_blocks_write().

◆ command_error()

sd_error_status_type command_error ( void )

checks for error conditions for cmd0.

Parameters
none
Return values
sd_error_status_type sd card error code.

Definition at line 1895 of file emmc_card/src/at32_sdio.c.

Referenced by sd_power_on().

◆ command_rsp1_error()

sd_error_status_type command_rsp1_error ( uint8_t cmd )

checks for error conditions for R1 response.

Parameters
cmd the sent command index.
Return values
sd_error_status_type sd card error code.

Definition at line 1959 of file emmc_card/src/at32_sdio.c.

Referenced by get_ext_csd(), mmc_switch(), scr_find(), sd_block_read(), sd_block_write(), sd_blocks_erase(), sd_bus_wide_enable(), sd_deselect_select(), sd_irq_service(), sd_mult_blocks_read(), sd_mult_blocks_write(), sd_power_on(), sd_status_send(), sd_switch(), and sdio_command_data_send().

◆ command_rsp2_error()

sd_error_status_type command_rsp2_error ( void )

checks for error conditions for R2 (cid or csd) response.

Parameters
none
Return values
sd_error_status_type sd card error code.

Definition at line 2032 of file emmc_card/src/at32_sdio.c.

Referenced by sd_card_init().

◆ command_rsp3_error()

sd_error_status_type command_rsp3_error ( void )

checks for error conditions for R3 (ocr) response.

Parameters
none
Return values
sd_error_status_type sd card error code.

Definition at line 2002 of file emmc_card/src/at32_sdio.c.

Referenced by sd_power_on().

◆ command_rsp4_error()

sd_error_status_type command_rsp4_error ( uint8_t cmd )

checks for error conditions for r4 response.

Parameters
cmd the sent command index.
Return values
sd_error_status_type sd card error code.

Definition at line 2072 of file emmc_card/src/at32_sdio.c.

◆ command_rsp5_error()

sd_error_status_type command_rsp5_error ( uint8_t cmd )

checks for error conditions for r5 response.

Parameters
cmd the sent command index.
Return values
sd_error_status_type sd card error code.

Definition at line 2115 of file emmc_card/src/at32_sdio.c.

◆ command_rsp6_error()

sd_error_status_type command_rsp6_error | ( | uint8_t | cmd,
 |  | uint16_t * | prca )

checks for error conditions for r6 (rca) response.

Parameters
cmd | the sent command index.
prca | pointer to the variable that will contain the sd card relative address rca.
Return values
sd_error_status_type sd card error code.

Definition at line 2178 of file emmc_card/src/at32_sdio.c.

Referenced by sd_card_init().

◆ command_rsp7_error()

sd_error_status_type command_rsp7_error ( void )

checks for error conditions for R7 response.

Parameters
none
Return values
sd_error_status_type sd card error code.

Definition at line 1922 of file emmc_card/src/at32_sdio.c.

Referenced by sd_power_on().

◆ convert_from_bytes_to_power_of_two()

uint8_t convert_from_bytes_to_power_of_two ( uint16_t number_of_bytes )

converts the number of bytes in power of two and returns the power.

Parameters
number_of_bytes number of bytes.
Return values
none

Definition at line 2778 of file emmc_card/src/at32_sdio.c.

Referenced by sd_block_read(), sd_block_write(), sd_mult_blocks_read(), sd_mult_blocks_write(), and sd_switch().

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/sdio/emmc_card/src/at32f413_int.c.

◆ get_ext_csd()

sd_error_status_type get_ext_csd ( void )

find the sd card ext csd register value.

Return values
sd_error_status_type sd card error code.

Definition at line 2529 of file emmc_card/src/at32_sdio.c.

Referenced by sd_init().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/sdio/emmc_card/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 283 of file project/at_start_f413/examples/sdio/emmc_card/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/sdio/emmc_card/src/at32f413_int.c.

◆ mmc_stream_read()

sd_error_status_type mmc_stream_read | ( | uint8_t * | buf,
 |  | long long | addr,
 |  | uint32_t | len )

read mmc card data stream.

Parameters
buf | buffer of saving data from mmc card
addr | start address of data from mmc card
len | data size
Return values
sd_error_status_type sd card error code.

Definition at line 1675 of file emmc_card/src/at32_sdio.c.

◆ mmc_stream_test()

static test_result_type mmc_stream_test ( void )
static

mmc card data stream read/write test.

Parameters
none
Return values
TEST_FAIL fail. TEST_SUCCESS: success.

Definition at line 165 of file project/at_start_f413/examples/sdio/emmc_card/src/main.c.

Referenced by main().

◆ mmc_stream_write()

sd_error_status_type mmc_stream_write | ( | uint8_t * | buf,
 |  | long long | addr,
 |  | uint32_t | len )

write mmc card data stream.

Parameters
buf | data that writing to mmc card
addr | start address mmc card
len | data size
Return values
sd_error_status_type sd card error code.

Definition at line 1722 of file emmc_card/src/at32_sdio.c.

◆ mmc_switch()

sd_error_status_type mmc_switch | ( | uint8_t | set,
 |  | uint8_t | index,
 |  | uint8_t | value )

switch mmc card speed to high speed

Parameters
set | new state of the sdio wide bus mode.
index | offset.
value | expect speed.
Return values
sd_error_status_type sd card error code.

Definition at line 2313 of file emmc_card/src/at32_sdio.c.

Referenced by sd_wide_bus_operation_config(), and speed_change().

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/sdio/emmc_card/src/at32f413_int.c.

◆ nvic_configuration()

static void nvic_configuration ( void )
static

configures sdio1 irq channel.

Parameters
none
Return values
none

Definition at line 246 of file project/at_start_f413/examples/sdio/emmc_card/src/main.c.

Referenced by main().

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/sdio/emmc_card/src/at32f413_int.c.

◆ scr_find()

sd_error_status_type scr_find ( void )

find the sd card scr register value.

Return values
sd_error_status_type sd card error code.

Definition at line 2600 of file emmc_card/src/at32_sdio.c.

Referenced by sd_init().

◆ sd_block_read()

sd_error_status_type sd_block_read | ( | uint8_t * | buf,
 |  | long long | addr,
 |  | uint16_t | blk_size )

allows to read one block from a specified address in a card. the data transfer can be managed by dma mode or polling mode.

Parameters
buf | pointer to the buffer that will contain the received data
addr | address from where data are to be read.
blk_size | the sd card data block size. the block size should be 512.
Return values
sd_error_status_type sd card error code.

Definition at line 1210 of file emmc_card/src/at32_sdio.c.

◆ sd_block_write()

sd_error_status_type sd_block_write | ( | const uint8_t * | buf,
 |  | long long | addr,
 |  | uint16_t | blk_size )

allows to write one block starting from a specified address in a card. the data transfer can be managed by dma mode or polling mode.

Parameters
buf | pointer to the buffer that contain the data to be transferred.
addr | address from where data are to be read.
blk_size | the sd card data block size. the block size should be 512.
Return values
sd_error_status_type sd card error code.

Definition at line 1389 of file emmc_card/src/at32_sdio.c.

◆ sd_blocks_erase()

sd_error_status_type sd_blocks_erase | ( | long long | addr,
 |  | uint32_t | nblks )

erase continuous data block

Parameters
addr | starting address
nblks | amount of erasing data block
Return values
sd_error_status_type sd card error code.

Definition at line 1052 of file emmc_card/src/at32_sdio.c.

◆ sd_bus_wide_enable()

sd_error_status_type sd_bus_wide_enable ( confirm_state new_state )

enable or disable the sdio wide bus mode.

Parameters
new_state new state of the sdio wide bus mode. (true or false)
Return values
sd_error_status_type sd card error code.

Definition at line 2244 of file emmc_card/src/at32_sdio.c.

Referenced by sd_wide_bus_operation_config().

◆ sd_card_info_get()

sd_error_status_type sd_card_info_get ( sd_card_info_struct_type * card_info )

returns information about specific card.

Parameters
card_info pointer to a sd_card_info_struct_type structure that contains all sd card information.
Return values
sd_error_status_type sd card error code.

Definition at line 554 of file emmc_card/src/at32_sdio.c.

Referenced by sd_init().

◆ sd_card_init()

sd_error_status_type sd_card_init ( void )

intialises all cards or single card as the case may be card(s) come into standby state.

Parameters
none
Return values
sd_error_status_type sd card error code.

Definition at line 439 of file emmc_card/src/at32_sdio.c.

Referenced by sd_init().

◆ sd_deselect_select()

sd_error_status_type sd_deselect_select ( uint32_t addr )

selects od deselects the corresponding card.

Parameters
addr address of the card to be selected.
Return values
sd_error_status_type sd card error code.

Definition at line 829 of file emmc_card/src/at32_sdio.c.

Referenced by sd_init().

◆ sd_device_mode_set()

sd_error_status_type sd_device_mode_set ( uint32_t mode )

set sdio work mode.

Parameters
mode parameter as following values:
  • SD_TRANSFER_POLLING_MODE: dma mode.
  • SD_TRANSFER_POLLING_MODE: polling mode.
Return values
sd_error_status_type sd card error code.

Definition at line 808 of file emmc_card/src/at32_sdio.c.

Referenced by sd_init().

◆ sd_dma_config()

void sd_dma_config | ( | uint32_t * | mbuf,
 |  | uint32_t | buf_size,
 |  | dma_dir_type | dir )

set dma configuation for sdio

Parameters
mbuf | buffer address
buf_size | transmission data size
dir | dma direction, it is DMA_DIR_MEMORY_TO_PERIPHERAL(writing data) or DMA_DIR_PERIPHERAL_TO_MEMORY(read data)
Return values
none

Definition at line 2799 of file emmc_card/src/at32_sdio.c.

Referenced by sdio_command_data_send().

◆ sd_init()

sd_error_status_type sd_init ( void )

initializes the sd card and put it into standby state (ready for data transfer).

Parameters
none
Return values
sd_error_status_type sd card error code.

Definition at line 73 of file emmc_card/src/at32_sdio.c.

Referenced by sdio_command_data_send().

◆ sd_irq_service()

sd_error_status_type sd_irq_service ( void )

allows to process all the interrupts that are high.

Parameters
none
Return values
sd_error_status_type sd card error code.

Definition at line 1811 of file emmc_card/src/at32_sdio.c.

Referenced by SDIO1_IRQHandler(), and SDIO2_IRQHandler().

◆ sd_mult_blocks_read()

sd_error_status_type sd_mult_blocks_read | ( | uint8_t * | buf,
 |  | long long | addr,
 |  | uint16_t | blk_size,
 |  | uint32_t | nblks )

allows to read blocks from a specified address in a card. the data transfer can be managed by dma mode or polling mode.

Parameters
buf | pointer to the buffer that will contain the received data.
addr | address from where data are to be read.
blk_size | the sd card data block size. the block size should be 512.
nblks | number of blocks to be read.
Return values
sd_error_status_type sd card error code.

Definition at line 1299 of file emmc_card/src/at32_sdio.c.

◆ sd_mult_blocks_write()

sd_error_status_type sd_mult_blocks_write | ( | const uint8_t * | buf,
 |  | long long | addr,
 |  | uint16_t | blk_size,
 |  | uint32_t | nblks )

allows to write blocks starting from a specified address in a card. the data transfer can be managed by dma mode only.

Parameters
buf | pointer to the buffer that contain the data to be transferred.
addr | address from where data are to be read.
blk_size | the sd card data block size. the block size should be 512.
nblks | number of blocks to be written.
Return values
sd_error_status_type sd card error code.

Definition at line 1511 of file emmc_card/src/at32_sdio.c.

◆ sd_multiple_blocks_test()

static test_result_type sd_multiple_blocks_test ( void )
static

sd card multiple blocks read/write test.

Parameters
none
Return values
TEST_FAIL fail. TEST_SUCCESS: success.

Definition at line 117 of file project/at_start_f413/examples/sdio/emmc_card/src/main.c.

Referenced by main().

◆ sd_power_off()

sd_error_status_type sd_power_off ( void )

turns the sdio output signals off.

Parameters
none
Return values
sd_error_status_type sd card error code.

Definition at line 425 of file emmc_card/src/at32_sdio.c.

◆ sd_power_on()

sd_error_status_type sd_power_on ( void )

enquires cards about their operating voltage and configures clock controls.

Parameters
none
Return values
sd_error_status_type sd card error code.

Definition at line 224 of file emmc_card/src/at32_sdio.c.

Referenced by sd_init().

◆ sd_single_block_test()

static test_result_type sd_single_block_test ( void )
static

sd card single block read/write test.

Parameters
none
Return values
TEST_FAIL fail. TEST_SUCCESS: success.

Definition at line 70 of file project/at_start_f413/examples/sdio/emmc_card/src/main.c.

Referenced by main().

◆ sd_state_get()

sd_card_state_type sd_state_get ( void )

returns information about sd card.

Parameters
none.
Return values
sd_card_state_type sd card state code.

Definition at line 2511 of file emmc_card/src/at32_sdio.c.

◆ sd_status_send()

sd_error_status_type sd_status_send ( uint32_t * p_card_status )

read current card status.

Parameters
p_card_status card status.
Return values
sd_error_status_type sd card error code.

Definition at line 2474 of file emmc_card/src/at32_sdio.c.

Referenced by mmc_switch(), sd_block_write(), sd_mult_blocks_write(), and sd_state_get().

◆ sd_switch()

sd_error_status_type sd_switch | ( | uint32_t | mode,
 |  | uint32_t | group,
 |  | uint8_t | value,
 |  | uint8_t * | rsp )

switch sd card speed to high speed

Parameters
mode | polling mode or dma mode
group | selected group
value | wanted speed
rsp | switch status
Return values
sd_error_status_type sd card error code.

Definition at line 2364 of file emmc_card/src/at32_sdio.c.

Referenced by speed_change().

◆ sd_test_error()

static void sd_test_error ( void )
static

LED2 on off every 300ms for sd test error.

Parameters
none
Return values
none

Definition at line 233 of file project/at_start_f413/examples/sdio/emmc_card/src/main.c.

Referenced by main().

◆ sd_wide_bus_operation_config()

sd_error_status_type sd_wide_bus_operation_config ( sdio_bus_width_type mode )

enable wide bus opeartion for the requeseted card if supported by card.

Parameters
mode specifies the sd card wide bus mode. this parameter can be one of the following values:
  • SDIO_BUS_WIDTH_D8: 8-bit data transfer (only for mmc)
  • SDIO_BUS_WIDTH_D4: 4-bit data transfer
  • SDIO_BUS_WIDTH_D1: 1-bit data transfer
Return values
sd_error_status_type sd card error code.

Definition at line 765 of file emmc_card/src/at32_sdio.c.

Referenced by sd_init().

◆ SDIO1_IRQHandler()

void SDIO1_IRQHandler ( void )

sdio1 isr.

Parameters
none.
Return values
none.

Definition at line 1791 of file emmc_card/src/at32_sdio.c.

◆ SDIO2_IRQHandler()

void SDIO2_IRQHandler ( void )

sdio2 isr.

Parameters
none.
Return values
none.

Definition at line 1801 of file emmc_card/src/at32_sdio.c.

◆ sdio_clock_set()

void sdio_clock_set ( uint32_t clk_div )

set sdio clock devision factor.

Parameters
clkdiv sdio_ck = ahbclk / (clkdiv+2)
Return values
none

Definition at line 209 of file emmc_card/src/at32_sdio.c.

Referenced by sd_init().

◆ sdio_command_data_send()

sd_error_status_type sdio_command_data_send | ( | sdio_command_struct_type * | sdio_cmd_init_t,
 |  | sdio_data_struct_type * | sdio_data_init_t,
 |  | uint32_t * | buf )

read data from or write data to sd card.

Parameters
sdio_cmd_init_struct | pointer to sdio_command_struct_type structure.
sdio_data_init_struct | pointer to sdio_data_struct_type structure.
buf | pointer to data buffer read or write.
Return values
sd_error_status_type sd card error code.

Definition at line 852 of file emmc_card/src/at32_sdio.c.

Referenced by mmc_stream_read(), mmc_stream_write(), sd_block_read(), sd_block_write(), sd_mult_blocks_read(), sd_mult_blocks_write(), and sd_switch().

◆ show_card_info()

void show_card_info ( void )

show sd/mmc card info.

Parameters
none
Return values
none

Definition at line 257 of file project/at_start_f413/examples/sdio/emmc_card/src/main.c.

Referenced by main().

◆ speed_change()

sd_error_status_type speed_change ( uint8_t speed )

set bus speed

Parameters
speed 0,normal speed; 1,high speed.
Return values
sd_error_status_type sd card error code.

Definition at line 2714 of file emmc_card/src/at32_sdio.c.

Referenced by sd_init().

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/sdio/emmc_card/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/sdio/emmc_card/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/sdio/emmc_card/src/at32f413_int.c.

Variable Documentation

◆ card_type

sd_memory_card_type card_type = SDIO_STD_CAPACITY_SD_CARD_V1_1
static

Definition at line 41 of file emmc_card/src/at32_sdio.c.

Referenced by sd_block_read(), sd_block_write(), sd_blocks_erase(), sd_card_info_get(), sd_card_init(), sd_init(), sd_mult_blocks_read(), sd_mult_blocks_write(), sd_power_on(), sd_wide_bus_operation_config(), and speed_change().

◆ cid_table

uint32_t cid_table[4]
static

Definition at line 42 of file emmc_card/src/at32_sdio.c.

Referenced by sd_card_info_get(), and sd_card_init().

◆ csd_table

uint32_t csd_table[4]
static

Definition at line 42 of file emmc_card/src/at32_sdio.c.

Referenced by sd_card_info_get(), and sd_card_init().

◆ device_mode

sd_data_transfer_mode_type device_mode = SD_TRANSFER_POLLING_MODE
static

Definition at line 44 of file emmc_card/src/at32_sdio.c.

Referenced by sd_device_mode_set(), and sdio_command_data_send().

◆ ext_csd_table

uint32_t ext_csd_table[128]
static

Definition at line 43 of file emmc_card/src/at32_sdio.c.

Referenced by get_ext_csd(), and sd_init().

◆ mblock_rbuffer

uint8_t mblock_rbuffer[((512) *(8))]
static

Definition at line 46 of file project/at_start_f413/examples/sdio/emmc_card/src/main.c.

Referenced by sd_multiple_blocks_test().

◆ mblock_tbuffer

uint8_t mblock_tbuffer[((512) *(8))]
static

Definition at line 46 of file project/at_start_f413/examples/sdio/emmc_card/src/main.c.

Referenced by sd_multiple_blocks_test().

◆ rca

uint32_t rca = 0
static

Definition at line 42 of file emmc_card/src/at32_sdio.c.

Referenced by check_card_programming(), sd_card_info_get(), sd_card_init(), sd_mult_blocks_write(), and sd_status_send().

◆ sblock_rbuffer

uint8_t sblock_rbuffer[(512)]
static

Definition at line 45 of file project/at_start_f413/examples/sdio/emmc_card/src/main.c.

Referenced by sd_single_block_test().

◆ sblock_tbuffer

uint8_t sblock_tbuffer[(512)]
static

Definition at line 45 of file project/at_start_f413/examples/sdio/emmc_card/src/main.c.

Referenced by sd_single_block_test().

◆ sd_card_info

sd_card_info_struct_type sd_card_info

Definition at line 48 of file emmc_card/src/at32_sdio.c.

Referenced by scr_find(), sd_bus_wide_enable(), sd_init(), and speed_change().

◆ sdio_command_init_struct

sdio_command_struct_type sdio_command_init_struct

Definition at line 38 of file emmc_card/src/at32_sdio.c.

Referenced by check_card_programming(), get_ext_csd(), mmc_stream_read(), mmc_stream_write(), mmc_switch(), scr_find(), sd_block_read(), sd_block_write(), sd_blocks_erase(), sd_bus_wide_enable(), sd_card_init(), sd_deselect_select(), sd_irq_service(), sd_mult_blocks_read(), sd_mult_blocks_write(), sd_power_on(), sd_status_send(), and sd_switch().

◆ sdio_data_init_struct

sdio_data_struct_type sdio_data_init_struct

Definition at line 39 of file emmc_card/src/at32_sdio.c.

Referenced by get_ext_csd(), mmc_stream_read(), mmc_stream_write(), scr_find(), sd_block_read(), sd_block_write(), sd_blocks_erase(), sd_mult_blocks_read(), sd_mult_blocks_write(), and sd_switch().

◆ stop_flag

uint8_t stop_flag = 0
static

Definition at line 45 of file emmc_card/src/at32_sdio.c.

Referenced by mmc_stream_read(), mmc_stream_write(), sd_block_read(), sd_block_write(), sd_irq_service(), sd_mult_blocks_read(), sd_mult_blocks_write(), sd_switch(), and sdio_command_data_send().

◆ stream_rbuffer

uint8_t stream_rbuffer[(1024)]
static

Definition at line 47 of file project/at_start_f413/examples/sdio/emmc_card/src/main.c.

Referenced by mmc_stream_test().

◆ stream_tbuffer

uint8_t stream_tbuffer[(1024)]
static

Definition at line 47 of file project/at_start_f413/examples/sdio/emmc_card/src/main.c.

Referenced by mmc_stream_test().

◆ transfer_end

volatile uint8_t transfer_end = 0

Definition at line 47 of file emmc_card/src/at32_sdio.c.

Referenced by sd_irq_service(), and sdio_command_data_send().

◆ transfer_error

volatile sd_error_status_type transfer_error = SD_OK

Definition at line 46 of file emmc_card/src/at32_sdio.c.

Referenced by sd_irq_service(), and sdio_command_data_send().


AT32F413 Firmwary Library: SDIO_sd_mmc_card

Topics
SDIO_sd_mmc_card
AT32F413_periph_examples

Topics

SDIO_instance_definition
SDIO_exported_types
SDIO_command_index_definition
SDIO_paremeters_definition
SDIO_response_definition
SDIO_command_class_definition
SDIO_cmd8_definition
SDIO_mmc_extend_definition
SDIO_interrupt_flags_definition
SDIO_exported_functions

Detailed Description

Generated by doxygen 1.12.0


AT32F413 Firmwary Library: SDIO_sd_mmc_card

Macros | Enumerations | Functions | Variables
SDIO_sd_mmc_card
AT32F413_periph_examples

Macros

#define | BLOCK_SIZE (512)
#define | BLOCKS_NUMBER (8)
#define | MULTI_BUFFER_SIZE (BLOCK_SIZE * BLOCKS_NUMBER)
#define | STREAM_BUFFER_SIZE (1024)

Enumerations

enum test_result_type { TEST_FAIL = 0 , TEST_SUCCESS }

Functions

sd_error_status_type | command_error (void)
checks for error conditions for cmd0.
sd_error_status_type | command_rsp1_error (uint8_t cmd)
checks for error conditions for R1 response.
sd_error_status_type | command_rsp2_error (void)
checks for error conditions for R2 (cid or csd) response.
sd_error_status_type | command_rsp3_error (void)
checks for error conditions for R3 (ocr) response.
sd_error_status_type | command_rsp4_error (uint8_t cmd)
checks for error conditions for r4 response.
sd_error_status_type | command_rsp5_error (uint8_t cmd)
checks for error conditions for r5 response.
sd_error_status_type | command_rsp6_error (uint8_t cmd, uint16_t *prca)
checks for error conditions for r6 (rca) response.
sd_error_status_type | command_rsp7_error (void)
checks for error conditions for R7 response.
sd_error_status_type | sd_bus_wide_enable (confirm_state new_state)
enable or disable the sdio wide bus mode.
sd_error_status_type | mmc_switch (uint8_t set, uint8_t index, uint8_t value)
switch mmc card speed to high speed
sd_error_status_type | sd_switch (uint32_t mode, uint32_t group, uint8_t value, uint8_t *rsp)
switch sd card speed to high speed
sd_error_status_type | check_card_programming (uint8_t *p_status)
checks if the sd card is in programming state.
sd_error_status_type | speed_change (uint8_t speed)
set bus speed
sd_error_status_type | get_ext_csd (void)
find the sd card ext csd register value.
sd_error_status_type | scr_find (void)
find the sd card scr register value.
uint8_t | convert_from_bytes_to_power_of_two (uint16_t number_of_bytes)
converts the number of bytes in power of two and returns the power.
sd_error_status_type | sd_init (void)
initializes the sd card and put it into standby state (ready for data transfer).
void | sdio_clock_set (uint32_t clk_div)
set sdio clock devision factor.
sd_error_status_type | sd_power_on (void)
enquires cards about their operating voltage and configures clock controls.
sd_error_status_type | sd_power_off (void)
turns the sdio output signals off.
sd_error_status_type | sd_card_init (void)
intialises all cards or single card as the case may be card(s) come into standby state.
sd_error_status_type | sd_card_info_get (sd_card_info_struct_type *card_info)
returns information about specific card.
sd_error_status_type | sd_wide_bus_operation_config (sdio_bus_width_type mode)
enable wide bus opeartion for the requeseted card if supported by card.
sd_error_status_type | sd_device_mode_set (uint32_t mode)
set sdio work mode.
sd_error_status_type | sd_deselect_select (uint32_t addr)
selects od deselects the corresponding card.
sd_error_status_type | sdio_command_data_send (sdio_command_struct_type *sdio_cmd_init_t, sdio_data_struct_type *sdio_data_init_t, uint32_t *buf)
read data from or write data to sd card.
sd_error_status_type | sd_blocks_erase (long long addr, uint32_t nblks)
erase continuous data block
sd_error_status_type | sd_block_read (uint8_t *buf, long long addr, uint16_t blk_size)
allows to read one block from a specified address in a card. the data transfer can be managed by dma mode or polling mode.
sd_error_status_type | sd_mult_blocks_read (uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks)
allows to read blocks from a specified address in a card. the data transfer can be managed by dma mode or polling mode.
sd_error_status_type | sd_block_write (const uint8_t *buf, long long addr, uint16_t blk_size)
allows to write one block starting from a specified address in a card. the data transfer can be managed by dma mode or polling mode.
sd_error_status_type | sd_mult_blocks_write (const uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks)
allows to write blocks starting from a specified address in a card. the data transfer can be managed by dma mode only.
sd_error_status_type | mmc_stream_read (uint8_t *buf, long long addr, uint32_t len)
read mmc card data stream.
sd_error_status_type | mmc_stream_write (uint8_t *buf, long long addr, uint32_t len)
write mmc card data stream.
void | SDIO1_IRQHandler (void)
sdio1 isr.
void | SDIO2_IRQHandler (void)
sdio2 isr.
sd_error_status_type | sd_irq_service (void)
allows to process all the interrupts that are high.
sd_error_status_type | sd_status_send (uint32_t *p_card_status)
read current card status.
sd_card_state_type | sd_state_get (void)
returns information about sd card.
void | sd_dma_config (uint32_t *mbuf, uint32_t buf_size, dma_dir_type dir)
set dma configuation for sdio
void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
static test_result_type | sd_single_block_test (void)
sd card single block read/write test.
static test_result_type | sd_multiple_blocks_test (void)
sd card multiple blocks read/write test.
uint8_t | buffer_compare (uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t buffer_length)
compares two buffers.
static void | sd_test_error (void)
LED2 on off every 300ms for sd test error.
static void | nvic_configuration (void)
configures sdio1 irq channel.
static test_result_type | mmc_stream_test (void)
mmc card data stream read/write test.
void | show_card_info (void)
show sd/mmc card info.
int | main (void)
main function.

Variables

sdio_command_struct_type sdio_command_init_struct
sdio_data_struct_type sdio_data_init_struct
static sd_memory_card_type | card_type = SDIO_STD_CAPACITY_SD_CARD_V1_1
static uint32_t | csd_table [4]
static uint32_t | cid_table [4]
static uint32_t | rca = 0
static uint32_t | ext_csd_table [128]
static sd_data_transfer_mode_type | device_mode = SD_TRANSFER_POLLING_MODE
static uint8_t | stop_flag = 0
volatile sd_error_status_type | transfer_error = SD_OK
volatile uint8_t | transfer_end = 0
sd_card_info_struct_type sd_card_info
static uint8_t | sblock_tbuffer [(512)]
static uint8_t | sblock_rbuffer [(512)]
static uint8_t | mblock_tbuffer [((512) *(8))]
static uint8_t | mblock_rbuffer [((512) *(8))]
static uint8_t | stream_tbuffer [(1024)]
static uint8_t | stream_rbuffer [(1024)]

Detailed Description

Macro Definition Documentation

◆ BLOCK_SIZE

#define BLOCK_SIZE (512)

Definition at line 40 of file project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c.

Referenced by sd_multiple_blocks_test(), and sd_single_block_test().

◆ BLOCKS_NUMBER

#define BLOCKS_NUMBER (8)

Definition at line 41 of file project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c.

Referenced by sd_multiple_blocks_test().

◆ MULTI_BUFFER_SIZE

#define MULTI_BUFFER_SIZE (BLOCK_SIZE * BLOCKS_NUMBER)

Definition at line 42 of file project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c.

Referenced by sd_multiple_blocks_test().

◆ STREAM_BUFFER_SIZE

#define STREAM_BUFFER_SIZE (1024)

Definition at line 43 of file project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c.

Referenced by mmc_stream_test().

Enumeration Type Documentation

◆ test_result_type

enum test_result_type

test result

Enumerator
TEST_FAIL
TEST_SUCCESS

Definition at line 52 of file project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c.

Function Documentation

◆ buffer_compare()

uint8_t buffer_compare | ( | uint8_t * | pbuffer1,
 |  | uint8_t * | pbuffer2,
 |  | uint16_t | buffer_length )

compares two buffers.

Parameters
pbuffer1,pbuffer2 | buffers to be compared.
buffer_length | buffer's length
Return values
1 pbuffer1 identical to pbuffer2 0: pbuffer1 differs from pbuffer2

Definition at line 214 of file project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c.

Referenced by mmc_stream_test(), sd_multiple_blocks_test(), and sd_single_block_test().

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/sdio/sd_mmc_card/src/at32f413_int.c.

◆ check_card_programming()

sd_error_status_type check_card_programming ( uint8_t * p_status )

checks if the sd card is in programming state.

Parameters
p_status pointer to the variable that will contain the sd card state.
Return values
sd_error_status_type sd card error code.

Definition at line 2420 of file sd_mmc_card/src/at32_sdio.c.

Referenced by mmc_stream_write(), sd_block_write(), sd_blocks_erase(), and sd_mult_blocks_write().

◆ command_error()

sd_error_status_type command_error ( void )

checks for error conditions for cmd0.

Parameters
none
Return values
sd_error_status_type sd card error code.

Definition at line 1895 of file sd_mmc_card/src/at32_sdio.c.

Referenced by sd_power_on().

◆ command_rsp1_error()

sd_error_status_type command_rsp1_error ( uint8_t cmd )

checks for error conditions for R1 response.

Parameters
cmd the sent command index.
Return values
sd_error_status_type sd card error code.

Definition at line 1959 of file sd_mmc_card/src/at32_sdio.c.

Referenced by get_ext_csd(), mmc_switch(), scr_find(), sd_block_read(), sd_block_write(), sd_blocks_erase(), sd_bus_wide_enable(), sd_deselect_select(), sd_irq_service(), sd_mult_blocks_read(), sd_mult_blocks_write(), sd_power_on(), sd_status_send(), sd_switch(), and sdio_command_data_send().

◆ command_rsp2_error()

sd_error_status_type command_rsp2_error ( void )

checks for error conditions for R2 (cid or csd) response.

Parameters
none
Return values
sd_error_status_type sd card error code.

Definition at line 2032 of file sd_mmc_card/src/at32_sdio.c.

Referenced by sd_card_init().

◆ command_rsp3_error()

sd_error_status_type command_rsp3_error ( void )

checks for error conditions for R3 (ocr) response.

Parameters
none
Return values
sd_error_status_type sd card error code.

Definition at line 2002 of file sd_mmc_card/src/at32_sdio.c.

Referenced by sd_power_on().

◆ command_rsp4_error()

sd_error_status_type command_rsp4_error ( uint8_t cmd )

checks for error conditions for r4 response.

Parameters
cmd the sent command index.
Return values
sd_error_status_type sd card error code.

Definition at line 2072 of file sd_mmc_card/src/at32_sdio.c.

◆ command_rsp5_error()

sd_error_status_type command_rsp5_error ( uint8_t cmd )

checks for error conditions for r5 response.

Parameters
cmd the sent command index.
Return values
sd_error_status_type sd card error code.

Definition at line 2115 of file sd_mmc_card/src/at32_sdio.c.

◆ command_rsp6_error()

sd_error_status_type command_rsp6_error | ( | uint8_t | cmd,
 |  | uint16_t * | prca )

checks for error conditions for r6 (rca) response.

Parameters
cmd | the sent command index.
prca | pointer to the variable that will contain the sd card relative address rca.
Return values
sd_error_status_type sd card error code.

Definition at line 2178 of file sd_mmc_card/src/at32_sdio.c.

Referenced by sd_card_init().

◆ command_rsp7_error()

sd_error_status_type command_rsp7_error ( void )

checks for error conditions for R7 response.

Parameters
none
Return values
sd_error_status_type sd card error code.

Definition at line 1922 of file sd_mmc_card/src/at32_sdio.c.

Referenced by sd_power_on().

◆ convert_from_bytes_to_power_of_two()

uint8_t convert_from_bytes_to_power_of_two ( uint16_t number_of_bytes )

converts the number of bytes in power of two and returns the power.

Parameters
number_of_bytes number of bytes.
Return values
none

Definition at line 2778 of file sd_mmc_card/src/at32_sdio.c.

Referenced by sd_block_read(), sd_block_write(), sd_mult_blocks_read(), sd_mult_blocks_write(), and sd_switch().

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/sdio/sd_mmc_card/src/at32f413_int.c.

◆ get_ext_csd()

sd_error_status_type get_ext_csd ( void )

find the sd card ext csd register value.

Return values
sd_error_status_type sd card error code.

Definition at line 2529 of file sd_mmc_card/src/at32_sdio.c.

Referenced by sd_init().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/sdio/sd_mmc_card/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 283 of file project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/sdio/sd_mmc_card/src/at32f413_int.c.

◆ mmc_stream_read()

sd_error_status_type mmc_stream_read | ( | uint8_t * | buf,
 |  | long long | addr,
 |  | uint32_t | len )

read mmc card data stream.

Parameters
buf | buffer of saving data from mmc card
addr | start address of data from mmc card
len | data size
Return values
sd_error_status_type sd card error code.

Definition at line 1675 of file sd_mmc_card/src/at32_sdio.c.

◆ mmc_stream_test()

static test_result_type mmc_stream_test ( void )
static

mmc card data stream read/write test.

Parameters
none
Return values
TEST_FAIL fail. TEST_SUCCESS: success.

Definition at line 165 of file project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c.

Referenced by main().

◆ mmc_stream_write()

sd_error_status_type mmc_stream_write | ( | uint8_t * | buf,
 |  | long long | addr,
 |  | uint32_t | len )

write mmc card data stream.

Parameters
buf | data that writing to mmc card
addr | start address mmc card
len | data size
Return values
sd_error_status_type sd card error code.

Definition at line 1722 of file sd_mmc_card/src/at32_sdio.c.

◆ mmc_switch()

sd_error_status_type mmc_switch | ( | uint8_t | set,
 |  | uint8_t | index,
 |  | uint8_t | value )

switch mmc card speed to high speed

Parameters
set | new state of the sdio wide bus mode.
index | offset.
value | expect speed.
Return values
sd_error_status_type sd card error code.

Definition at line 2313 of file sd_mmc_card/src/at32_sdio.c.

Referenced by sd_wide_bus_operation_config(), and speed_change().

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/sdio/sd_mmc_card/src/at32f413_int.c.

◆ nvic_configuration()

static void nvic_configuration ( void )
static

configures sdio1 irq channel.

Parameters
none
Return values
none

Definition at line 246 of file project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c.

Referenced by main().

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/sdio/sd_mmc_card/src/at32f413_int.c.

◆ scr_find()

sd_error_status_type scr_find ( void )

find the sd card scr register value.

Return values
sd_error_status_type sd card error code.

Definition at line 2600 of file sd_mmc_card/src/at32_sdio.c.

Referenced by sd_init().

◆ sd_block_read()

sd_error_status_type sd_block_read | ( | uint8_t * | buf,
 |  | long long | addr,
 |  | uint16_t | blk_size )

allows to read one block from a specified address in a card. the data transfer can be managed by dma mode or polling mode.

Parameters
buf | pointer to the buffer that will contain the received data
addr | address from where data are to be read.
blk_size | the sd card data block size. the block size should be 512.
Return values
sd_error_status_type sd card error code.

Definition at line 1210 of file sd_mmc_card/src/at32_sdio.c.

◆ sd_block_write()

sd_error_status_type sd_block_write | ( | const uint8_t * | buf,
 |  | long long | addr,
 |  | uint16_t | blk_size )

allows to write one block starting from a specified address in a card. the data transfer can be managed by dma mode or polling mode.

Parameters
buf | pointer to the buffer that contain the data to be transferred.
addr | address from where data are to be read.
blk_size | the sd card data block size. the block size should be 512.
Return values
sd_error_status_type sd card error code.

Definition at line 1389 of file sd_mmc_card/src/at32_sdio.c.

◆ sd_blocks_erase()

sd_error_status_type sd_blocks_erase | ( | long long | addr,
 |  | uint32_t | nblks )

erase continuous data block

Parameters
addr | starting address
nblks | amount of erasing data block
Return values
sd_error_status_type sd card error code.

Definition at line 1052 of file sd_mmc_card/src/at32_sdio.c.

◆ sd_bus_wide_enable()

sd_error_status_type sd_bus_wide_enable ( confirm_state new_state )

enable or disable the sdio wide bus mode.

Parameters
new_state new state of the sdio wide bus mode. (true or false)
Return values
sd_error_status_type sd card error code.

Definition at line 2244 of file sd_mmc_card/src/at32_sdio.c.

Referenced by sd_wide_bus_operation_config().

◆ sd_card_info_get()

sd_error_status_type sd_card_info_get ( sd_card_info_struct_type * card_info )

returns information about specific card.

Parameters
card_info pointer to a sd_card_info_struct_type structure that contains all sd card information.
Return values
sd_error_status_type sd card error code.

Definition at line 554 of file sd_mmc_card/src/at32_sdio.c.

Referenced by sd_init().

◆ sd_card_init()

sd_error_status_type sd_card_init ( void )

intialises all cards or single card as the case may be card(s) come into standby state.

Parameters
none
Return values
sd_error_status_type sd card error code.

Definition at line 439 of file sd_mmc_card/src/at32_sdio.c.

Referenced by sd_init().

◆ sd_deselect_select()

sd_error_status_type sd_deselect_select ( uint32_t addr )

selects od deselects the corresponding card.

Parameters
addr address of the card to be selected.
Return values
sd_error_status_type sd card error code.

Definition at line 829 of file sd_mmc_card/src/at32_sdio.c.

Referenced by sd_init().

◆ sd_device_mode_set()

sd_error_status_type sd_device_mode_set ( uint32_t mode )

set sdio work mode.

Parameters
mode parameter as following values:
  • SD_TRANSFER_POLLING_MODE: dma mode.
  • SD_TRANSFER_POLLING_MODE: polling mode.
Return values
sd_error_status_type sd card error code.

Definition at line 808 of file sd_mmc_card/src/at32_sdio.c.

Referenced by sd_init().

◆ sd_dma_config()

void sd_dma_config | ( | uint32_t * | mbuf,
 |  | uint32_t | buf_size,
 |  | dma_dir_type | dir )

set dma configuation for sdio

Parameters
mbuf | buffer address
buf_size | transmission data size
dir | dma direction, it is DMA_DIR_MEMORY_TO_PERIPHERAL(writing data) or DMA_DIR_PERIPHERAL_TO_MEMORY(read data)
Return values
none

Definition at line 2799 of file sd_mmc_card/src/at32_sdio.c.

Referenced by sdio_command_data_send().

◆ sd_init()

sd_error_status_type sd_init ( void )

initializes the sd card and put it into standby state (ready for data transfer).

Parameters
none
Return values
sd_error_status_type sd card error code.

Definition at line 73 of file sd_mmc_card/src/at32_sdio.c.

Referenced by sdio_command_data_send().

◆ sd_irq_service()

sd_error_status_type sd_irq_service ( void )

allows to process all the interrupts that are high.

Parameters
none
Return values
sd_error_status_type sd card error code.

Definition at line 1811 of file sd_mmc_card/src/at32_sdio.c.

Referenced by SDIO1_IRQHandler(), and SDIO2_IRQHandler().

◆ sd_mult_blocks_read()

sd_error_status_type sd_mult_blocks_read | ( | uint8_t * | buf,
 |  | long long | addr,
 |  | uint16_t | blk_size,
 |  | uint32_t | nblks )

allows to read blocks from a specified address in a card. the data transfer can be managed by dma mode or polling mode.

Parameters
buf | pointer to the buffer that will contain the received data.
addr | address from where data are to be read.
blk_size | the sd card data block size. the block size should be 512.
nblks | number of blocks to be read.
Return values
sd_error_status_type sd card error code.

Definition at line 1299 of file sd_mmc_card/src/at32_sdio.c.

◆ sd_mult_blocks_write()

sd_error_status_type sd_mult_blocks_write | ( | const uint8_t * | buf,
 |  | long long | addr,
 |  | uint16_t | blk_size,
 |  | uint32_t | nblks )

allows to write blocks starting from a specified address in a card. the data transfer can be managed by dma mode only.

Parameters
buf | pointer to the buffer that contain the data to be transferred.
addr | address from where data are to be read.
blk_size | the sd card data block size. the block size should be 512.
nblks | number of blocks to be written.
Return values
sd_error_status_type sd card error code.

Definition at line 1511 of file sd_mmc_card/src/at32_sdio.c.

◆ sd_multiple_blocks_test()

static test_result_type sd_multiple_blocks_test ( void )
static

sd card multiple blocks read/write test.

Parameters
none
Return values
TEST_FAIL fail. TEST_SUCCESS: success.

Definition at line 117 of file project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c.

Referenced by main().

◆ sd_power_off()

sd_error_status_type sd_power_off ( void )

turns the sdio output signals off.

Parameters
none
Return values
sd_error_status_type sd card error code.

Definition at line 425 of file sd_mmc_card/src/at32_sdio.c.

◆ sd_power_on()

sd_error_status_type sd_power_on ( void )

enquires cards about their operating voltage and configures clock controls.

Parameters
none
Return values
sd_error_status_type sd card error code.

Definition at line 224 of file sd_mmc_card/src/at32_sdio.c.

Referenced by sd_init().

◆ sd_single_block_test()

static test_result_type sd_single_block_test ( void )
static

sd card single block read/write test.

Parameters
none
Return values
TEST_FAIL fail. TEST_SUCCESS: success.

Definition at line 70 of file project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c.

Referenced by main().

◆ sd_state_get()

sd_card_state_type sd_state_get ( void )

returns information about sd card.

Parameters
none.
Return values
sd_card_state_type sd card state code.

Definition at line 2511 of file sd_mmc_card/src/at32_sdio.c.

◆ sd_status_send()

sd_error_status_type sd_status_send ( uint32_t * p_card_status )

read current card status.

Parameters
p_card_status card status.
Return values
sd_error_status_type sd card error code.

Definition at line 2474 of file sd_mmc_card/src/at32_sdio.c.

Referenced by mmc_switch(), sd_block_write(), sd_mult_blocks_write(), and sd_state_get().

◆ sd_switch()

sd_error_status_type sd_switch | ( | uint32_t | mode,
 |  | uint32_t | group,
 |  | uint8_t | value,
 |  | uint8_t * | rsp )

switch sd card speed to high speed

Parameters
mode | polling mode or dma mode
group | selected group
value | wanted speed
rsp | switch status
Return values
sd_error_status_type sd card error code.

Definition at line 2364 of file sd_mmc_card/src/at32_sdio.c.

Referenced by speed_change().

◆ sd_test_error()

static void sd_test_error ( void )
static

LED2 on off every 300ms for sd test error.

Parameters
none
Return values
none

Definition at line 233 of file project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c.

Referenced by main().

◆ sd_wide_bus_operation_config()

sd_error_status_type sd_wide_bus_operation_config ( sdio_bus_width_type mode )

enable wide bus opeartion for the requeseted card if supported by card.

Parameters
mode specifies the sd card wide bus mode. this parameter can be one of the following values:
  • SDIO_BUS_WIDTH_D8: 8-bit data transfer (only for mmc)
  • SDIO_BUS_WIDTH_D4: 4-bit data transfer
  • SDIO_BUS_WIDTH_D1: 1-bit data transfer
Return values
sd_error_status_type sd card error code.

Definition at line 765 of file sd_mmc_card/src/at32_sdio.c.

Referenced by sd_init().

◆ SDIO1_IRQHandler()

void SDIO1_IRQHandler ( void )

sdio1 isr.

Parameters
none.
Return values
none.

Definition at line 1791 of file sd_mmc_card/src/at32_sdio.c.

◆ SDIO2_IRQHandler()

void SDIO2_IRQHandler ( void )

sdio2 isr.

Parameters
none.
Return values
none.

Definition at line 1801 of file sd_mmc_card/src/at32_sdio.c.

◆ sdio_clock_set()

void sdio_clock_set ( uint32_t clk_div )

set sdio clock devision factor.

Parameters
clkdiv sdio_ck = ahbclk / (clkdiv+2)
Return values
none

Definition at line 209 of file sd_mmc_card/src/at32_sdio.c.

Referenced by sd_init().

◆ sdio_command_data_send()

sd_error_status_type sdio_command_data_send | ( | sdio_command_struct_type * | sdio_cmd_init_t,
 |  | sdio_data_struct_type * | sdio_data_init_t,
 |  | uint32_t * | buf )

read data from or write data to sd card.

Parameters
sdio_cmd_init_struct | pointer to sdio_command_struct_type structure.
sdio_data_init_struct | pointer to sdio_data_struct_type structure.
buf | pointer to data buffer read or write.
Return values
sd_error_status_type sd card error code.

Definition at line 852 of file sd_mmc_card/src/at32_sdio.c.

Referenced by mmc_stream_read(), mmc_stream_write(), sd_block_read(), sd_block_write(), sd_mult_blocks_read(), sd_mult_blocks_write(), and sd_switch().

◆ show_card_info()

void show_card_info ( void )

show sd/mmc card info.

Parameters
none
Return values
none

Definition at line 257 of file project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c.

Referenced by main().

◆ speed_change()

sd_error_status_type speed_change ( uint8_t speed )

set bus speed

Parameters
speed 0,normal speed; 1,high speed.
Return values
sd_error_status_type sd card error code.

Definition at line 2714 of file sd_mmc_card/src/at32_sdio.c.

Referenced by sd_init().

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/sdio/sd_mmc_card/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/sdio/sd_mmc_card/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/sdio/sd_mmc_card/src/at32f413_int.c.

Variable Documentation

◆ card_type

sd_memory_card_type card_type = SDIO_STD_CAPACITY_SD_CARD_V1_1
static

Definition at line 41 of file sd_mmc_card/src/at32_sdio.c.

Referenced by sd_block_read(), sd_block_write(), sd_blocks_erase(), sd_card_info_get(), sd_card_init(), sd_init(), sd_mult_blocks_read(), sd_mult_blocks_write(), sd_power_on(), sd_wide_bus_operation_config(), and speed_change().

◆ cid_table

uint32_t cid_table[4]
static

Definition at line 42 of file sd_mmc_card/src/at32_sdio.c.

Referenced by sd_card_info_get(), and sd_card_init().

◆ csd_table

uint32_t csd_table[4]
static

Definition at line 42 of file sd_mmc_card/src/at32_sdio.c.

Referenced by sd_card_info_get(), and sd_card_init().

◆ device_mode

sd_data_transfer_mode_type device_mode = SD_TRANSFER_POLLING_MODE
static

Definition at line 44 of file sd_mmc_card/src/at32_sdio.c.

Referenced by sd_device_mode_set(), and sdio_command_data_send().

◆ ext_csd_table

uint32_t ext_csd_table[128]
static

Definition at line 43 of file sd_mmc_card/src/at32_sdio.c.

Referenced by get_ext_csd(), and sd_init().

◆ mblock_rbuffer

uint8_t mblock_rbuffer[((512) *(8))]
static

Definition at line 46 of file project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c.

Referenced by sd_multiple_blocks_test().

◆ mblock_tbuffer

uint8_t mblock_tbuffer[((512) *(8))]
static

Definition at line 46 of file project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c.

Referenced by sd_multiple_blocks_test().

◆ rca

uint32_t rca = 0
static

Definition at line 42 of file sd_mmc_card/src/at32_sdio.c.

Referenced by check_card_programming(), sd_card_info_get(), sd_card_init(), sd_mult_blocks_write(), and sd_status_send().

◆ sblock_rbuffer

uint8_t sblock_rbuffer[(512)]
static

Definition at line 45 of file project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c.

Referenced by sd_single_block_test().

◆ sblock_tbuffer

uint8_t sblock_tbuffer[(512)]
static

Definition at line 45 of file project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c.

Referenced by sd_single_block_test().

◆ sd_card_info

sd_card_info_struct_type sd_card_info

Definition at line 48 of file sd_mmc_card/src/at32_sdio.c.

Referenced by scr_find(), sd_bus_wide_enable(), sd_init(), and speed_change().

◆ sdio_command_init_struct

sdio_command_struct_type sdio_command_init_struct

Definition at line 38 of file sd_mmc_card/src/at32_sdio.c.

Referenced by check_card_programming(), get_ext_csd(), mmc_stream_read(), mmc_stream_write(), mmc_switch(), scr_find(), sd_block_read(), sd_block_write(), sd_blocks_erase(), sd_bus_wide_enable(), sd_card_init(), sd_deselect_select(), sd_irq_service(), sd_mult_blocks_read(), sd_mult_blocks_write(), sd_power_on(), sd_status_send(), and sd_switch().

◆ sdio_data_init_struct

sdio_data_struct_type sdio_data_init_struct

Definition at line 39 of file sd_mmc_card/src/at32_sdio.c.

Referenced by get_ext_csd(), mmc_stream_read(), mmc_stream_write(), scr_find(), sd_block_read(), sd_block_write(), sd_blocks_erase(), sd_mult_blocks_read(), sd_mult_blocks_write(), and sd_switch().

◆ stop_flag

uint8_t stop_flag = 0
static

Definition at line 45 of file sd_mmc_card/src/at32_sdio.c.

Referenced by mmc_stream_read(), mmc_stream_write(), sd_block_read(), sd_block_write(), sd_irq_service(), sd_mult_blocks_read(), sd_mult_blocks_write(), sd_switch(), and sdio_command_data_send().

◆ stream_rbuffer

uint8_t stream_rbuffer[(1024)]
static

Definition at line 47 of file project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c.

Referenced by mmc_stream_test().

◆ stream_tbuffer

uint8_t stream_tbuffer[(1024)]
static

Definition at line 47 of file project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c.

Referenced by mmc_stream_test().

◆ transfer_end

volatile uint8_t transfer_end = 0

Definition at line 47 of file sd_mmc_card/src/at32_sdio.c.

Referenced by sd_irq_service(), and sdio_command_data_send().

◆ transfer_error

volatile sd_error_status_type transfer_error = SD_OK

Definition at line 46 of file sd_mmc_card/src/at32_sdio.c.

Referenced by sd_irq_service(), and sdio_command_data_send().


AT32F413 Firmwary Library: SDIO_sdio_fatfs

Topics
SDIO_sdio_fatfs
AT32F413_periph_examples

Topics

SDIO_instance_definition
SDIO_exported_types
SDIO_command_index_definition
SDIO_paremeters_definition
SDIO_response_definition
SDIO_command_class_definition
SDIO_cmd8_definition
SDIO_mmc_extend_definition
SDIO_interrupt_flags_definition
SDIO_exported_functions

Detailed Description

Generated by doxygen 1.12.0


AT32F413 Firmwary Library: SDIO_sdio_fatfs

Functions | Variables
SDIO_sdio_fatfs
AT32F413_periph_examples

Functions

sd_error_status_type | command_error (void)
checks for error conditions for cmd0.
sd_error_status_type | command_rsp1_error (uint8_t cmd)
checks for error conditions for R1 response.
sd_error_status_type | command_rsp2_error (void)
checks for error conditions for R2 (cid or csd) response.
sd_error_status_type | command_rsp3_error (void)
checks for error conditions for R3 (ocr) response.
sd_error_status_type | command_rsp4_error (uint8_t cmd)
checks for error conditions for r4 response.
sd_error_status_type | command_rsp5_error (uint8_t cmd)
checks for error conditions for r5 response.
sd_error_status_type | command_rsp6_error (uint8_t cmd, uint16_t *prca)
checks for error conditions for r6 (rca) response.
sd_error_status_type | command_rsp7_error (void)
checks for error conditions for R7 response.
sd_error_status_type | sd_bus_wide_enable (confirm_state new_state)
enable or disable the sdio wide bus mode.
sd_error_status_type | mmc_switch (uint8_t set, uint8_t index, uint8_t value)
switch mmc card speed to high speed
sd_error_status_type | sd_switch (uint32_t mode, uint32_t group, uint8_t value, uint8_t *rsp)
switch sd card speed to high speed
sd_error_status_type | check_card_programming (uint8_t *p_status)
checks if the sd card is in programming state.
sd_error_status_type | speed_change (uint8_t speed)
set bus speed
sd_error_status_type | get_ext_csd (void)
find the sd card ext csd register value.
sd_error_status_type | scr_find (void)
find the sd card scr register value.
uint8_t | convert_from_bytes_to_power_of_two (uint16_t number_of_bytes)
converts the number of bytes in power of two and returns the power.
sd_error_status_type | sd_init (void)
initializes the sd card and put it into standby state (ready for data transfer).
void | sdio_clock_set (uint32_t clk_div)
set sdio clock devision factor.
sd_error_status_type | sd_power_on (void)
enquires cards about their operating voltage and configures clock controls.
sd_error_status_type | sd_power_off (void)
turns the sdio output signals off.
sd_error_status_type | sd_card_init (void)
intialises all cards or single card as the case may be card(s) come into standby state.
sd_error_status_type | sd_card_info_get (sd_card_info_struct_type *card_info)
returns information about specific card.
sd_error_status_type | sd_wide_bus_operation_config (sdio_bus_width_type mode)
enable wide bus opeartion for the requeseted card if supported by card.
sd_error_status_type | sd_device_mode_set (uint32_t mode)
set sdio work mode.
sd_error_status_type | sd_deselect_select (uint32_t addr)
selects od deselects the corresponding card.
sd_error_status_type | sdio_command_data_send (sdio_command_struct_type *sdio_cmd_init_t, sdio_data_struct_type *sdio_data_init_t, uint32_t *buf)
read data from or write data to sd card.
sd_error_status_type | sd_blocks_erase (long long addr, uint32_t nblks)
erase continuous data block
sd_error_status_type | sd_block_read (uint8_t *buf, long long addr, uint16_t blk_size)
allows to read one block from a specified address in a card. the data transfer can be managed by dma mode or polling mode.
sd_error_status_type | sd_mult_blocks_read (uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks)
allows to read blocks from a specified address in a card. the data transfer can be managed by dma mode or polling mode.
sd_error_status_type | sd_block_write (const uint8_t *buf, long long addr, uint16_t blk_size)
allows to write one block starting from a specified address in a card. the data transfer can be managed by dma mode or polling mode.
sd_error_status_type | sd_mult_blocks_write (const uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks)
allows to write blocks starting from a specified address in a card. the data transfer can be managed by dma mode only.
sd_error_status_type | mmc_stream_read (uint8_t *buf, long long addr, uint32_t len)
read mmc card data stream.
sd_error_status_type | mmc_stream_write (uint8_t *buf, long long addr, uint32_t len)
write mmc card data stream.
void | SDIO1_IRQHandler (void)
sdio1 isr.
void | SDIO2_IRQHandler (void)
sdio2 isr.
sd_error_status_type | sd_irq_service (void)
allows to process all the interrupts that are high.
sd_error_status_type | sd_status_send (uint32_t *p_card_status)
read current card status.
sd_card_state_type | sd_state_get (void)
returns information about sd card.
void | sd_dma_config (uint32_t *mbuf, uint32_t buf_size, dma_dir_type dir)
set dma configuation for sdio
void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
uint8_t | buffer_compare (uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t buffer_length)
compares two buffers.
static void | sd_test_error (void)
led2 on off every 300ms for sd test failed.
static void | nvic_configuration (void)
configures sdio1 irq channel.
static error_status | fatfs_test (void)
fatfs file read/write test.
int | main (void)
main function.

Variables

sdio_command_struct_type sdio_command_init_struct
sdio_data_struct_type sdio_data_init_struct
static sd_memory_card_type | card_type = SDIO_STD_CAPACITY_SD_CARD_V1_1
static uint32_t | csd_table [4]
static uint32_t | cid_table [4]
static uint32_t | rca = 0
static uint32_t | ext_csd_table [128]
static sd_data_transfer_mode_type | device_mode = SD_TRANSFER_POLLING_MODE
static uint8_t | stop_flag = 0
volatile sd_error_status_type | transfer_error = SD_OK
volatile uint8_t | transfer_end = 0
sd_card_info_struct_type sd_card_info
FATFS | fs
FIL | file
BYTE | work [FF_MAX_SS]

Detailed Description

Function Documentation

◆ buffer_compare()

uint8_t buffer_compare | ( | uint8_t * | pbuffer1,
 |  | uint8_t * | pbuffer2,
 |  | uint16_t | buffer_length )

compares two buffers.

Parameters
pbuffer1,pbuffer2 | buffers to be compared.
buffer_length | buffer's length
Return values
1 pbuffer1 identical to pbuffer2 0: pbuffer1 differs from pbuffer2

Definition at line 56 of file project/at_start_f413/examples/sdio/sdio_fatfs/src/main.c.

Referenced by fatfs_test().

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/sdio/sdio_fatfs/src/at32f413_int.c.

◆ check_card_programming()

sd_error_status_type check_card_programming ( uint8_t * p_status )

checks if the sd card is in programming state.

Parameters
p_status pointer to the variable that will contain the sd card state.
Return values
sd_error_status_type sd card error code.

Definition at line 2421 of file sdio_fatfs/src/at32_sdio.c.

Referenced by mmc_stream_write(), sd_block_write(), sd_blocks_erase(), and sd_mult_blocks_write().

◆ command_error()

sd_error_status_type command_error ( void )

checks for error conditions for cmd0.

Parameters
none
Return values
sd_error_status_type sd card error code.

Definition at line 1896 of file sdio_fatfs/src/at32_sdio.c.

Referenced by sd_power_on().

◆ command_rsp1_error()

sd_error_status_type command_rsp1_error ( uint8_t cmd )

checks for error conditions for R1 response.

Parameters
cmd the sent command index.
Return values
sd_error_status_type sd card error code.

Definition at line 1960 of file sdio_fatfs/src/at32_sdio.c.

Referenced by get_ext_csd(), mmc_switch(), scr_find(), sd_block_read(), sd_block_write(), sd_blocks_erase(), sd_bus_wide_enable(), sd_deselect_select(), sd_irq_service(), sd_mult_blocks_read(), sd_mult_blocks_write(), sd_power_on(), sd_status_send(), sd_switch(), and sdio_command_data_send().

◆ command_rsp2_error()

sd_error_status_type command_rsp2_error ( void )

checks for error conditions for R2 (cid or csd) response.

Parameters
none
Return values
sd_error_status_type sd card error code.

Definition at line 2033 of file sdio_fatfs/src/at32_sdio.c.

Referenced by sd_card_init().

◆ command_rsp3_error()

sd_error_status_type command_rsp3_error ( void )

checks for error conditions for R3 (ocr) response.

Parameters
none
Return values
sd_error_status_type sd card error code.

Definition at line 2003 of file sdio_fatfs/src/at32_sdio.c.

Referenced by sd_power_on().

◆ command_rsp4_error()

sd_error_status_type command_rsp4_error ( uint8_t cmd )

checks for error conditions for r4 response.

Parameters
cmd the sent command index.
Return values
sd_error_status_type sd card error code.

Definition at line 2073 of file sdio_fatfs/src/at32_sdio.c.

◆ command_rsp5_error()

sd_error_status_type command_rsp5_error ( uint8_t cmd )

checks for error conditions for r5 response.

Parameters
cmd the sent command index.
Return values
sd_error_status_type sd card error code.

Definition at line 2116 of file sdio_fatfs/src/at32_sdio.c.

◆ command_rsp6_error()

sd_error_status_type command_rsp6_error | ( | uint8_t | cmd,
 |  | uint16_t * | prca )

checks for error conditions for r6 (rca) response.

Parameters
cmd | the sent command index.
prca | pointer to the variable that will contain the sd card relative address rca.
Return values
sd_error_status_type sd card error code.

Definition at line 2179 of file sdio_fatfs/src/at32_sdio.c.

Referenced by sd_card_init().

◆ command_rsp7_error()

sd_error_status_type command_rsp7_error ( void )

checks for error conditions for R7 response.

Parameters
none
Return values
sd_error_status_type sd card error code.

Definition at line 1923 of file sdio_fatfs/src/at32_sdio.c.

Referenced by sd_power_on().

◆ convert_from_bytes_to_power_of_two()

uint8_t convert_from_bytes_to_power_of_two ( uint16_t number_of_bytes )

converts the number of bytes in power of two and returns the power.

Parameters
number_of_bytes number of bytes.
Return values
none

Definition at line 2779 of file sdio_fatfs/src/at32_sdio.c.

Referenced by sd_block_read(), sd_block_write(), sd_mult_blocks_read(), sd_mult_blocks_write(), and sd_switch().

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/sdio/sdio_fatfs/src/at32f413_int.c.

◆ fatfs_test()

static error_status fatfs_test ( void )
static

fatfs file read/write test.

Parameters
none
Return values
ERROR fail. SUCCESS: success.

Definition at line 100 of file project/at_start_f413/examples/sdio/sdio_fatfs/src/main.c.

Referenced by main().

◆ get_ext_csd()

sd_error_status_type get_ext_csd ( void )

find the sd card ext csd register value.

Return values
sd_error_status_type sd card error code.

Definition at line 2530 of file sdio_fatfs/src/at32_sdio.c.

Referenced by sd_init().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/sdio/sdio_fatfs/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 204 of file project/at_start_f413/examples/sdio/sdio_fatfs/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/sdio/sdio_fatfs/src/at32f413_int.c.

◆ mmc_stream_read()

sd_error_status_type mmc_stream_read | ( | uint8_t * | buf,
 |  | long long | addr,
 |  | uint32_t | len )

read mmc card data stream.

Parameters
buf | buffer of saving data from mmc card
addr | start address of data from mmc card
len | data size
Return values
sd_error_status_type sd card error code.

Definition at line 1676 of file sdio_fatfs/src/at32_sdio.c.

Referenced by mmc_stream_test(), and mmc_stream_test().

◆ mmc_stream_write()

sd_error_status_type mmc_stream_write | ( | uint8_t * | buf,
 |  | long long | addr,
 |  | uint32_t | len )

write mmc card data stream.

Parameters
buf | data that writing to mmc card
addr | start address mmc card
len | data size
Return values
sd_error_status_type sd card error code.

Definition at line 1723 of file sdio_fatfs/src/at32_sdio.c.

Referenced by mmc_stream_test(), and mmc_stream_test().

◆ mmc_switch()

sd_error_status_type mmc_switch | ( | uint8_t | set,
 |  | uint8_t | index,
 |  | uint8_t | value )

switch mmc card speed to high speed

Parameters
set | new state of the sdio wide bus mode.
index | offset.
value | expect speed.
Return values
sd_error_status_type sd card error code.

Definition at line 2314 of file sdio_fatfs/src/at32_sdio.c.

Referenced by sd_wide_bus_operation_config(), and speed_change().

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/sdio/sdio_fatfs/src/at32f413_int.c.

◆ nvic_configuration()

static void nvic_configuration ( void )
static

configures sdio1 irq channel.

Parameters
none
Return values
none

Definition at line 88 of file project/at_start_f413/examples/sdio/sdio_fatfs/src/main.c.

Referenced by main().

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/sdio/sdio_fatfs/src/at32f413_int.c.

◆ scr_find()

sd_error_status_type scr_find ( void )

find the sd card scr register value.

Return values
sd_error_status_type sd card error code.

Definition at line 2601 of file sdio_fatfs/src/at32_sdio.c.

Referenced by sd_init().

◆ sd_block_read()

sd_error_status_type sd_block_read | ( | uint8_t * | buf,
 |  | long long | addr,
 |  | uint16_t | blk_size )

allows to read one block from a specified address in a card. the data transfer can be managed by dma mode or polling mode.

Parameters
buf | pointer to the buffer that will contain the received data
addr | address from where data are to be read.
blk_size | the sd card data block size. the block size should be 512.
Return values
sd_error_status_type sd card error code.

Definition at line 1211 of file sdio_fatfs/src/at32_sdio.c.

Referenced by sd_read_disk(), sd_single_block_test(), and sd_single_block_test().

◆ sd_block_write()

sd_error_status_type sd_block_write | ( | const uint8_t * | buf,
 |  | long long | addr,
 |  | uint16_t | blk_size )

allows to write one block starting from a specified address in a card. the data transfer can be managed by dma mode or polling mode.

Parameters
buf | pointer to the buffer that contain the data to be transferred.
addr | address from where data are to be read.
blk_size | the sd card data block size. the block size should be 512.
Return values
sd_error_status_type sd card error code.

Definition at line 1390 of file sdio_fatfs/src/at32_sdio.c.

Referenced by sd_single_block_test(), sd_single_block_test(), and sd_write_disk().

◆ sd_blocks_erase()

sd_error_status_type sd_blocks_erase | ( | long long | addr,
 |  | uint32_t | nblks )

erase continuous data block

Parameters
addr | starting address
nblks | amount of erasing data block
Return values
sd_error_status_type sd card error code.

Definition at line 1053 of file sdio_fatfs/src/at32_sdio.c.

◆ sd_bus_wide_enable()

sd_error_status_type sd_bus_wide_enable ( confirm_state new_state )

enable or disable the sdio wide bus mode.

Parameters
new_state new state of the sdio wide bus mode. (true or false)
Return values
sd_error_status_type sd card error code.

Definition at line 2245 of file sdio_fatfs/src/at32_sdio.c.

Referenced by sd_wide_bus_operation_config().

◆ sd_card_info_get()

sd_error_status_type sd_card_info_get ( sd_card_info_struct_type * card_info )

returns information about specific card.

Parameters
card_info pointer to a sd_card_info_struct_type structure that contains all sd card information.
Return values
sd_error_status_type sd card error code.

Definition at line 555 of file sdio_fatfs/src/at32_sdio.c.

Referenced by sd_init().

◆ sd_card_init()

sd_error_status_type sd_card_init ( void )

intialises all cards or single card as the case may be card(s) come into standby state.

Parameters
none
Return values
sd_error_status_type sd card error code.

Definition at line 440 of file sdio_fatfs/src/at32_sdio.c.

Referenced by sd_init().

◆ sd_deselect_select()

sd_error_status_type sd_deselect_select ( uint32_t addr )

selects od deselects the corresponding card.

Parameters
addr address of the card to be selected.
Return values
sd_error_status_type sd card error code.

Definition at line 830 of file sdio_fatfs/src/at32_sdio.c.

Referenced by sd_init().

◆ sd_device_mode_set()

sd_error_status_type sd_device_mode_set ( uint32_t mode )

set sdio work mode.

Parameters
mode parameter as following values:
  • SD_TRANSFER_POLLING_MODE: dma mode.
  • SD_TRANSFER_POLLING_MODE: polling mode.
Return values
sd_error_status_type sd card error code.

Definition at line 809 of file sdio_fatfs/src/at32_sdio.c.

Referenced by sd_init().

◆ sd_dma_config()

void sd_dma_config | ( | uint32_t * | mbuf,
 |  | uint32_t | buf_size,
 |  | dma_dir_type | dir )

set dma configuation for sdio

Parameters
mbuf | buffer address
buf_size | transmission data size
dir | dma direction, it is DMA_DIR_MEMORY_TO_PERIPHERAL(writing data) or DMA_DIR_PERIPHERAL_TO_MEMORY(read data)
Return values
none

Definition at line 2800 of file sdio_fatfs/src/at32_sdio.c.

Referenced by sdio_command_data_send().

◆ sd_init()

sd_error_status_type sd_init ( void )

initializes the sd card and put it into standby state (ready for data transfer).

Parameters
none
Return values
sd_error_status_type sd card error code.

Definition at line 74 of file sdio_fatfs/src/at32_sdio.c.

Referenced by disk_initialize(), main(), and sdio_command_data_send().

◆ sd_irq_service()

sd_error_status_type sd_irq_service ( void )

allows to process all the interrupts that are high.

Parameters
none
Return values
sd_error_status_type sd card error code.

Definition at line 1812 of file sdio_fatfs/src/at32_sdio.c.

Referenced by SDIO1_IRQHandler(), and SDIO2_IRQHandler().

◆ sd_mult_blocks_read()

sd_error_status_type sd_mult_blocks_read | ( | uint8_t * | buf,
 |  | long long | addr,
 |  | uint16_t | blk_size,
 |  | uint32_t | nblks )

allows to read blocks from a specified address in a card. the data transfer can be managed by dma mode or polling mode.

Parameters
buf | pointer to the buffer that will contain the received data.
addr | address from where data are to be read.
blk_size | the sd card data block size. the block size should be 512.
nblks | number of blocks to be read.
Return values
sd_error_status_type sd card error code.

Definition at line 1300 of file sdio_fatfs/src/at32_sdio.c.

Referenced by sd_multiple_blocks_test(), sd_multiple_blocks_test(), and sd_read_disk().

◆ sd_mult_blocks_write()

sd_error_status_type sd_mult_blocks_write | ( | const uint8_t * | buf,
 |  | long long | addr,
 |  | uint16_t | blk_size,
 |  | uint32_t | nblks )

allows to write blocks starting from a specified address in a card. the data transfer can be managed by dma mode only.

Parameters
buf | pointer to the buffer that contain the data to be transferred.
addr | address from where data are to be read.
blk_size | the sd card data block size. the block size should be 512.
nblks | number of blocks to be written.
Return values
sd_error_status_type sd card error code.

Definition at line 1512 of file sdio_fatfs/src/at32_sdio.c.

Referenced by sd_multiple_blocks_test(), sd_multiple_blocks_test(), and sd_write_disk().

◆ sd_power_off()

sd_error_status_type sd_power_off ( void )

turns the sdio output signals off.

Parameters
none
Return values
sd_error_status_type sd card error code.

Definition at line 426 of file sdio_fatfs/src/at32_sdio.c.

◆ sd_power_on()

sd_error_status_type sd_power_on ( void )

enquires cards about their operating voltage and configures clock controls.

Parameters
none
Return values
sd_error_status_type sd card error code.

Definition at line 225 of file sdio_fatfs/src/at32_sdio.c.

Referenced by sd_init().

◆ sd_state_get()

sd_card_state_type sd_state_get ( void )

returns information about sd card.

Parameters
none.
Return values
sd_card_state_type sd card state code.

Definition at line 2512 of file sdio_fatfs/src/at32_sdio.c.

◆ sd_status_send()

sd_error_status_type sd_status_send ( uint32_t * p_card_status )

read current card status.

Parameters
p_card_status card status.
Return values
sd_error_status_type sd card error code.

Definition at line 2475 of file sdio_fatfs/src/at32_sdio.c.

Referenced by mmc_switch(), sd_block_write(), sd_mult_blocks_write(), and sd_state_get().

◆ sd_switch()

sd_error_status_type sd_switch | ( | uint32_t | mode,
 |  | uint32_t | group,
 |  | uint8_t | value,
 |  | uint8_t * | rsp )

switch sd card speed to high speed

Parameters
mode | polling mode or dma mode
group | selected group
value | wanted speed
rsp | switch status
Return values
sd_error_status_type sd card error code.

Definition at line 2365 of file sdio_fatfs/src/at32_sdio.c.

Referenced by speed_change().

◆ sd_test_error()

static void sd_test_error ( void )
static

led2 on off every 300ms for sd test failed.

Parameters
none
Return values
none

Definition at line 75 of file project/at_start_f413/examples/sdio/sdio_fatfs/src/main.c.

Referenced by main().

◆ sd_wide_bus_operation_config()

sd_error_status_type sd_wide_bus_operation_config ( sdio_bus_width_type mode )

enable wide bus opeartion for the requeseted card if supported by card.

Parameters
mode specifies the sd card wide bus mode. this parameter can be one of the following values:
  • SDIO_BUS_WIDTH_D8: 8-bit data transfer (only for mmc)
  • SDIO_BUS_WIDTH_D4: 4-bit data transfer
  • SDIO_BUS_WIDTH_D1: 1-bit data transfer
Return values
sd_error_status_type sd card error code.

Definition at line 766 of file sdio_fatfs/src/at32_sdio.c.

Referenced by mmc_stream_test(), mmc_stream_test(), sd_init(), sd_multiple_blocks_test(), sd_multiple_blocks_test(), sd_single_block_test(), and sd_single_block_test().

◆ SDIO1_IRQHandler()

void SDIO1_IRQHandler ( void )

sdio1 isr.

Parameters
none.
Return values
none.

Definition at line 1792 of file sdio_fatfs/src/at32_sdio.c.

◆ SDIO2_IRQHandler()

void SDIO2_IRQHandler ( void )

sdio2 isr.

Parameters
none.
Return values
none.

Definition at line 1802 of file sdio_fatfs/src/at32_sdio.c.

◆ sdio_clock_set()

void sdio_clock_set ( uint32_t clk_div )

set sdio clock devision factor.

Parameters
clkdiv sdio_ck = ahbclk / (clkdiv+2)
Return values
none

Definition at line 210 of file sdio_fatfs/src/at32_sdio.c.

Referenced by sd_init().

◆ sdio_command_data_send()

sd_error_status_type sdio_command_data_send | ( | sdio_command_struct_type * | sdio_cmd_init_t,
 |  | sdio_data_struct_type * | sdio_data_init_t,
 |  | uint32_t * | buf )

read data from or write data to sd card.

Parameters
sdio_cmd_init_struct | pointer to sdio_command_struct_type structure.
sdio_data_init_struct | pointer to sdio_data_struct_type structure.
buf | pointer to data buffer read or write.
Return values
sd_error_status_type sd card error code.

Definition at line 853 of file sdio_fatfs/src/at32_sdio.c.

Referenced by mmc_stream_read(), mmc_stream_write(), sd_block_read(), sd_block_write(), sd_mult_blocks_read(), sd_mult_blocks_write(), and sd_switch().

◆ speed_change()

sd_error_status_type speed_change ( uint8_t speed )

set bus speed

Parameters
speed 0,normal speed; 1,high speed.
Return values
sd_error_status_type sd card error code.

Definition at line 2715 of file sdio_fatfs/src/at32_sdio.c.

Referenced by sd_init().

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/sdio/sdio_fatfs/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/sdio/sdio_fatfs/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/sdio/sdio_fatfs/src/at32f413_int.c.

Variable Documentation

◆ card_type

sd_memory_card_type card_type = SDIO_STD_CAPACITY_SD_CARD_V1_1
static

Definition at line 42 of file sdio_fatfs/src/at32_sdio.c.

Referenced by sd_block_read(), sd_block_write(), sd_blocks_erase(), sd_card_info_get(), sd_card_init(), sd_init(), sd_mult_blocks_read(), sd_mult_blocks_write(), sd_power_on(), sd_wide_bus_operation_config(), and speed_change().

◆ cid_table

uint32_t cid_table[4]
static

Definition at line 43 of file sdio_fatfs/src/at32_sdio.c.

Referenced by sd_card_info_get(), and sd_card_init().

◆ csd_table

uint32_t csd_table[4]
static

Definition at line 43 of file sdio_fatfs/src/at32_sdio.c.

Referenced by sd_card_info_get(), and sd_card_init().

◆ device_mode

sd_data_transfer_mode_type device_mode = SD_TRANSFER_POLLING_MODE
static

Definition at line 45 of file sdio_fatfs/src/at32_sdio.c.

Referenced by sd_device_mode_set(), and sdio_command_data_send().

◆ ext_csd_table

uint32_t ext_csd_table[128]
static

Definition at line 44 of file sdio_fatfs/src/at32_sdio.c.

Referenced by get_ext_csd(), and sd_init().

◆ file

FIL file

Definition at line 42 of file project/at_start_f413/examples/sdio/sdio_fatfs/src/main.c.

Referenced by fatfs_test().

◆ fs

FATFS fs

Definition at line 41 of file project/at_start_f413/examples/sdio/sdio_fatfs/src/main.c.

Referenced by fatfs_test().

◆ rca

uint32_t rca = 0
static

Definition at line 43 of file sdio_fatfs/src/at32_sdio.c.

Referenced by check_card_programming(), sd_card_info_get(), sd_card_init(), sd_mult_blocks_write(), and sd_status_send().

◆ sd_card_info

sd_card_info_struct_type sd_card_info

Definition at line 49 of file sdio_fatfs/src/at32_sdio.c.

Referenced by disk_ioctl(), main(), scr_find(), sd_bus_wide_enable(), sd_init(), show_card_info(), and speed_change().

◆ sdio_command_init_struct

sdio_command_struct_type sdio_command_init_struct

Definition at line 39 of file sdio_fatfs/src/at32_sdio.c.

Referenced by check_card_programming(), get_ext_csd(), mmc_stream_read(), mmc_stream_write(), mmc_switch(), scr_find(), sd_block_read(), sd_block_write(), sd_blocks_erase(), sd_bus_wide_enable(), sd_card_init(), sd_deselect_select(), sd_irq_service(), sd_mult_blocks_read(), sd_mult_blocks_write(), sd_power_on(), sd_status_send(), and sd_switch().

◆ sdio_data_init_struct

sdio_data_struct_type sdio_data_init_struct

Definition at line 40 of file sdio_fatfs/src/at32_sdio.c.

Referenced by get_ext_csd(), mmc_stream_read(), mmc_stream_write(), scr_find(), sd_block_read(), sd_block_write(), sd_blocks_erase(), sd_mult_blocks_read(), sd_mult_blocks_write(), and sd_switch().

◆ stop_flag

uint8_t stop_flag = 0
static

Definition at line 46 of file sdio_fatfs/src/at32_sdio.c.

Referenced by mmc_stream_read(), mmc_stream_write(), sd_block_read(), sd_block_write(), sd_irq_service(), sd_mult_blocks_read(), sd_mult_blocks_write(), sd_switch(), and sdio_command_data_send().

◆ transfer_end

volatile uint8_t transfer_end = 0

Definition at line 48 of file sdio_fatfs/src/at32_sdio.c.

Referenced by sd_irq_service(), and sdio_command_data_send().

◆ transfer_error

volatile sd_error_status_type transfer_error = SD_OK

Definition at line 47 of file sdio_fatfs/src/at32_sdio.c.

Referenced by sd_irq_service(), and sdio_command_data_send().

◆ work

BYTE work[FF_MAX_SS]

Definition at line 43 of file project/at_start_f413/examples/sdio/sdio_fatfs/src/main.c.

Referenced by fatfs_test().


AT32F413 Firmwary Library: SPI_crc_transfer_polling

Macros | Functions | Variables
SPI_crc_transfer_polling
AT32F413_periph_examples

Macros

#define | SPI_MASTER_CS_HIGH gpio_bits_set(GPIOA, GPIO_PINS_4)
#define | SPI_MASTER_CS_LOW gpio_bits_reset(GPIOA, GPIO_PINS_4)
#define | BUFFER_SIZE 32

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
error_status | buffer_compare (uint16_t *pbuffer1, uint16_t *pbuffer2, uint16_t buffer_length)
buffer compare function.
static void | spi_config (void)
spi configuration.
static void | gpio_config (void)
gpio configuration.
int | main (void)
main function.

Variables

uint16_t | spi1_tx_buffer [32]
uint16_t | spi2_tx_buffer [32]
uint16_t | spi1_rx_buffer [32]
uint16_t | spi2_rx_buffer [32]
uint32_t | tx_index = 0
uint32_t | rx_index = 0
__IO uint16_t | crc1_value = 0
__IO uint16_t | crc2_value = 0
volatile error_status | transfer_status1 = ERROR
volatile error_status | transfer_status2 = ERROR

Detailed Description

Macro Definition Documentation

◆ BUFFER_SIZE

#define BUFFER_SIZE 32

Definition at line 40 of file project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c.

Referenced by main().

◆ SPI_MASTER_CS_HIGH

#define SPI_MASTER_CS_HIGH gpio_bits_set(GPIOA, GPIO_PINS_4)

Definition at line 38 of file project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c.

Referenced by gpio_config(), and main().

◆ SPI_MASTER_CS_LOW

#define SPI_MASTER_CS_LOW gpio_bits_reset(GPIOA, GPIO_PINS_4)

Definition at line 39 of file project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c.

Referenced by main().

Function Documentation

◆ buffer_compare()

error_status buffer_compare | ( | uint16_t * | pbuffer1,
 |  | uint16_t * | pbuffer2,
 |  | uint16_t | buffer_length )

buffer compare function.

Parameters
pbuffer1,pbuffer2 | buffers to be compared.
buffer_length | buffer's length
Return values
the result of compare

Definition at line 61 of file project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c.

Referenced by main().

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 78 of file project/at_start_f413/examples/spi/crc_transfer_polling/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 113 of file project/at_start_f413/examples/spi/crc_transfer_polling/src/at32f413_int.c.

◆ gpio_config()

static void gpio_config ( void )
static

gpio configuration.

Parameters
none
Return values
none

< gpio pins number 4

< gpio pins number 4

< gpio pins number 5

< gpio pins number 6

< gpio pins number 7

< gpio pins number 12

< gpio pins number 13

< gpio pins number 14

< gpio pins number 15

Definition at line 131 of file project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c.

Referenced by main().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 52 of file project/at_start_f413/examples/spi/crc_transfer_polling/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< gpio pins number 4

< spi or i2s transmit data buffer empty flag

< spi or i2s transmit data buffer empty flag

< spi or i2s receive data buffer full flag

< spi or i2s receive data buffer full flag

< spi or i2s transmit data buffer empty flag

< spi or i2s transmit data buffer empty flag

< spi or i2s receive data buffer full flag

< spi or i2s receive data buffer full flag

< spi or i2s receive data buffer full flag

< spi or i2s receive data buffer full flag

< spi or i2s busy flag

< spi or i2s busy flag

< gpio pins number 4

< spi crc calculation error flag

< spi crc calculation error flag

< spi crc calculation error flag

< spi crc calculation error flag

Definition at line 210 of file project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 65 of file project/at_start_f413/examples/spi/crc_transfer_polling/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 43 of file project/at_start_f413/examples/spi/crc_transfer_polling/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 122 of file project/at_start_f413/examples/spi/crc_transfer_polling/src/at32f413_int.c.

◆ spi_config()

static void spi_config ( void )
static

spi configuration.

Parameters
none
Return values
none

Definition at line 80 of file project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c.

Referenced by main().

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 104 of file project/at_start_f413/examples/spi/crc_transfer_polling/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 131 of file project/at_start_f413/examples/spi/crc_transfer_polling/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 91 of file project/at_start_f413/examples/spi/crc_transfer_polling/src/at32f413_int.c.

Variable Documentation

◆ crc1_value

__IO uint16_t crc1_value = 0

Definition at line 52 of file project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c.

Referenced by main().

◆ crc2_value

__IO uint16_t crc2_value = 0

Definition at line 52 of file project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c.

Referenced by main().

◆ rx_index

uint32_t rx_index = 0

Definition at line 51 of file project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c.

Referenced by main().

◆ spi1_rx_buffer

uint16_t spi1_rx_buffer[32]

Definition at line 50 of file project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c.

Referenced by main().

◆ spi1_tx_buffer

uint16_t spi1_tx_buffer[32]
Initial value:
= {0x0102, 0x0304, 0x0506, 0x0708, 0x090A, 0x0B0C, 0x0D0E, 0x0F10,
0x1112, 0x1314, 0x1516, 0x1718, 0x191A, 0x1B1C, 0x1D1E, 0x1F20,
0x2122, 0x2324, 0x2526, 0x2728, 0x292A, 0x2B2C, 0x2D2E, 0x2F30,
0x3132, 0x3334, 0x3536, 0x3738, 0x393A, 0x3B3C, 0x3D3E, 0x3F40}

Definition at line 42 of file project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c.

Referenced by main().

◆ spi2_rx_buffer

uint16_t spi2_rx_buffer[32]

Definition at line 50 of file project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c.

Referenced by main().

◆ spi2_tx_buffer

uint16_t spi2_tx_buffer[32]
Initial value:
= {0x5152, 0x5354, 0x5556, 0x5758, 0x595A, 0x5B5C, 0x5D5E, 0x5F60,
0x6162, 0x6364, 0x6566, 0x6768, 0x696A, 0x6B6C, 0x6D6E, 0x6F70,
0x7172, 0x7374, 0x7576, 0x7778, 0x797A, 0x7B7C, 0x7D7E, 0x7F80,
0x8182, 0x8384, 0x8586, 0x8788, 0x898A, 0x8B8C, 0x8D8E, 0x8F90}

Definition at line 46 of file project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c.

Referenced by main().

◆ transfer_status1

volatile error_status transfer_status1 = ERROR

Definition at line 53 of file project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c.

Referenced by main().

◆ transfer_status2

volatile error_status transfer_status2 = ERROR

Definition at line 53 of file project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c.

Referenced by main().

◆ tx_index

uint32_t tx_index = 0

Definition at line 51 of file project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: SPI_fullduplex_dma_jtagpin

Macros | Functions | Variables
SPI_fullduplex_dma_jtagpin
AT32F413_periph_examples

Macros

#define | SPI_MASTER_CS_HIGH gpio_bits_set(GPIOA, GPIO_PINS_15)
#define | SPI_MASTER_CS_LOW gpio_bits_reset(GPIOA, GPIO_PINS_15)
#define | BUFFER_SIZE 32

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
error_status | buffer_compare (uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t bufferlength)
buffer compare function.
static void | dma_config (void)
dma configuration.
static void | spi_config (void)
spi configuration.
static void | gpio_config (void)
gpio configuration.
int | main (void)
main function.

Variables

spi_init_type spi_init_struct
uint8_t | spi1_tx_buffer [32]
uint8_t | spi2_tx_buffer [32]
uint8_t | spi1_rx_buffer [32]
uint8_t | spi2_rx_buffer [32]
volatile error_status | transfer_status1 = ERROR
volatile error_status | transfer_status2 = ERROR

Detailed Description

Macro Definition Documentation

◆ BUFFER_SIZE

#define BUFFER_SIZE 32

Definition at line 39 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c.

Referenced by dma_config(), and main().

◆ SPI_MASTER_CS_HIGH

#define SPI_MASTER_CS_HIGH gpio_bits_set(GPIOA, GPIO_PINS_15)

Definition at line 37 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c.

Referenced by gpio_config(), and main().

◆ SPI_MASTER_CS_LOW

#define SPI_MASTER_CS_LOW gpio_bits_reset(GPIOA, GPIO_PINS_15)

Definition at line 38 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c.

Referenced by main().

Function Documentation

◆ buffer_compare()

error_status buffer_compare | ( | uint8_t * | pbuffer1,
 |  | uint8_t * | pbuffer2,
 |  | uint16_t | bufferlength )

buffer compare function.

Parameters
pbuffer1,pbuffer2 | buffers to be compared.
buffer_length | buffer's length
Return values
the result of compare

Definition at line 59 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c.

Referenced by main().

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 78 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 113 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/at32f413_int.c.

◆ dma_config()

static void dma_config ( void )
static

dma configuration.

Parameters
none
Return values
none

Definition at line 79 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c.

Referenced by main().

◆ gpio_config()

static void gpio_config ( void )
static

gpio configuration.

Parameters
none
Return values
none

< jtag-dp disabled and sw-dp enabled

< spi1_cs/i2s1_ws(pa15), spi1_sck/i2s1_ck(pb3), spi1_miso(pb4), spi1_mosi/i2s1_sd(pb5), i2s1_mck(pb6)

< spi1_cs/i2s1_ws(pa15), spi1_sck/i2s1_ck(pb3), spi1_miso(pb4), spi1_mosi/i2s1_sd(pb5), i2s1_mck(pb0)

< gpio pins number 15

< gpio pins number 15

< gpio pins number 3

< gpio pins number 4

< gpio pins number 5

< gpio pins number 12

< gpio pins number 13

< gpio pins number 14

< gpio pins number 15

Definition at line 197 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c.

Referenced by main().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 52 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< gpio pins number 15

< dma1 channel2 full data transfer flag

< dma1 channel4 full data transfer flag

< spi or i2s busy flag

< spi or i2s busy flag

< gpio pins number 15

Definition at line 272 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 65 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 43 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 122 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/at32f413_int.c.

◆ spi_config()

static void spi_config ( void )
static

spi configuration.

Parameters
none
Return values
none

Definition at line 148 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c.

Referenced by main().

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 104 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 131 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 91 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/at32f413_int.c.

Variable Documentation

◆ spi1_rx_buffer

uint8_t spi1_rx_buffer[32]

Definition at line 50 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c.

Referenced by dma_config(), and main().

◆ spi1_tx_buffer

uint8_t spi1_tx_buffer[32]
Initial value:
= {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20}

Definition at line 42 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c.

Referenced by dma_config(), and main().

◆ spi2_rx_buffer

uint8_t spi2_rx_buffer[32]

Definition at line 50 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c.

Referenced by dma_config(), and main().

◆ spi2_tx_buffer

uint8_t spi2_tx_buffer[32]
Initial value:
= {0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60,
0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70}

Definition at line 46 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c.

Referenced by dma_config(), and main().

◆ spi_init_struct

spi_init_type spi_init_struct

Definition at line 41 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c.

Referenced by spi_config(), spi_config(), spi_config(), spi_config(), spi_config(), spi_default_para_init(), spi_init(), spiflash_init(), and usart_spi_configuration().

◆ transfer_status1

volatile error_status transfer_status1 = ERROR

Definition at line 51 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c.

Referenced by main().

◆ transfer_status2

volatile error_status transfer_status2 = ERROR

Definition at line 51 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: SPI_fullduplex_polling

Macros | Functions | Variables
SPI_fullduplex_polling
AT32F413_periph_examples

Macros

#define | SPI1_AS_MASTER_CS_HIGH gpio_bits_set(GPIOA, GPIO_PINS_4)
#define | SPI1_AS_MASTER_CS_LOW gpio_bits_reset(GPIOA, GPIO_PINS_4)
#define | SPI2_AS_MASTER_CS_HIGH gpio_bits_set(GPIOB, GPIO_PINS_12)
#define | SPI2_AS_MASTER_CS_LOW gpio_bits_reset(GPIOB, GPIO_PINS_12)
#define | BUFFER_SIZE 32

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
error_status | buffer_compare (uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t bufferlength)
buffer compare function.
static void | spi_config (void)
spi configuration.
static void | gpio_config (uint16_t spi1_mode, uint16_t spi2_mode)
gpio configuration.
int | main (void)
main function.

Variables

spi_init_type spi_init_struct
uint8_t | spi1_tx_buffer [32]
uint8_t | spi2_tx_buffer [32]
uint8_t | spi1_rx_buffer [32]
uint8_t | spi2_rx_buffer [32]
uint32_t | tx_index = 0
uint32_t | rx_index = 0
volatile error_status | transfer_status1 = ERROR
volatile error_status | transfer_status2 = ERROR
volatile error_status | transfer_status3 = ERROR
volatile error_status | transfer_status4 = ERROR

Detailed Description

Macro Definition Documentation

◆ BUFFER_SIZE

#define BUFFER_SIZE 32

Definition at line 43 of file project/at_start_f413/examples/spi/fullduplex_polling/src/main.c.

Referenced by main().

◆ SPI1_AS_MASTER_CS_HIGH

#define SPI1_AS_MASTER_CS_HIGH gpio_bits_set(GPIOA, GPIO_PINS_4)

Definition at line 38 of file project/at_start_f413/examples/spi/fullduplex_polling/src/main.c.

Referenced by gpio_config(), and main().

◆ SPI1_AS_MASTER_CS_LOW

#define SPI1_AS_MASTER_CS_LOW gpio_bits_reset(GPIOA, GPIO_PINS_4)

Definition at line 39 of file project/at_start_f413/examples/spi/fullduplex_polling/src/main.c.

Referenced by main().

◆ SPI2_AS_MASTER_CS_HIGH

#define SPI2_AS_MASTER_CS_HIGH gpio_bits_set(GPIOB, GPIO_PINS_12)

Definition at line 41 of file project/at_start_f413/examples/spi/fullduplex_polling/src/main.c.

Referenced by gpio_config(), and main().

◆ SPI2_AS_MASTER_CS_LOW

#define SPI2_AS_MASTER_CS_LOW gpio_bits_reset(GPIOB, GPIO_PINS_12)

Definition at line 42 of file project/at_start_f413/examples/spi/fullduplex_polling/src/main.c.

Referenced by main().

Function Documentation

◆ buffer_compare()

error_status buffer_compare | ( | uint8_t * | pbuffer1,
 |  | uint8_t * | pbuffer2,
 |  | uint16_t | bufferlength )

buffer compare function.

Parameters
pbuffer1,pbuffer2 | buffers to be compared.
buffer_length | buffer's length
Return values
the result of compare

Definition at line 65 of file project/at_start_f413/examples/spi/fullduplex_polling/src/main.c.

Referenced by main().

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 78 of file project/at_start_f413/examples/spi/fullduplex_polling/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 113 of file project/at_start_f413/examples/spi/fullduplex_polling/src/at32f413_int.c.

◆ gpio_config()

static void gpio_config | ( | uint16_t | spi1_mode,
 |  | uint16_t | spi2_mode )
 static

gpio configuration.

Parameters
none
Return values
none

< gpio pins number 4

< gpio pins number 5

< gpio pins number 6

< gpio pins number 7

< gpio pins number 12

< gpio pins number 13

< gpio pins number 14

< gpio pins number 15

< gpio pins number 4

< gpio pins number 12

Definition at line 126 of file project/at_start_f413/examples/spi/fullduplex_polling/src/main.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 52 of file project/at_start_f413/examples/spi/fullduplex_polling/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< gpio pins number 4

< spi or i2s transmit data buffer empty flag

< spi or i2s transmit data buffer empty flag

< spi or i2s receive data buffer full flag

< spi or i2s receive data buffer full flag

< spi or i2s busy flag

< spi or i2s busy flag

< gpio pins number 4

< gpio pins number 12

< spi or i2s transmit data buffer empty flag

< spi or i2s transmit data buffer empty flag

< spi or i2s receive data buffer full flag

< spi or i2s receive data buffer full flag

< spi or i2s busy flag

< spi or i2s busy flag

< gpio pins number 12

Definition at line 257 of file project/at_start_f413/examples/spi/fullduplex_polling/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 65 of file project/at_start_f413/examples/spi/fullduplex_polling/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 43 of file project/at_start_f413/examples/spi/fullduplex_polling/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 122 of file project/at_start_f413/examples/spi/fullduplex_polling/src/at32f413_int.c.

◆ spi_config()

static void spi_config ( void )
static

spi configuration.

Parameters
none
Return values
none

Definition at line 85 of file project/at_start_f413/examples/spi/fullduplex_polling/src/main.c.

Referenced by main().

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 104 of file project/at_start_f413/examples/spi/fullduplex_polling/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 131 of file project/at_start_f413/examples/spi/fullduplex_polling/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 91 of file project/at_start_f413/examples/spi/fullduplex_polling/src/at32f413_int.c.

Variable Documentation

◆ rx_index

uint32_t rx_index = 0

Definition at line 55 of file project/at_start_f413/examples/spi/fullduplex_polling/src/main.c.

Referenced by main().

◆ spi1_rx_buffer

uint8_t spi1_rx_buffer[32]

Definition at line 54 of file project/at_start_f413/examples/spi/fullduplex_polling/src/main.c.

Referenced by main().

◆ spi1_tx_buffer

uint8_t spi1_tx_buffer[32]
Initial value:
= {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20}

Definition at line 46 of file project/at_start_f413/examples/spi/fullduplex_polling/src/main.c.

Referenced by main().

◆ spi2_rx_buffer

uint8_t spi2_rx_buffer[32]

Definition at line 54 of file project/at_start_f413/examples/spi/fullduplex_polling/src/main.c.

Referenced by main().

◆ spi2_tx_buffer

uint8_t spi2_tx_buffer[32]
Initial value:
= {0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60,
0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70}

Definition at line 50 of file project/at_start_f413/examples/spi/fullduplex_polling/src/main.c.

Referenced by main().

◆ spi_init_struct

spi_init_type spi_init_struct

Definition at line 45 of file project/at_start_f413/examples/spi/fullduplex_polling/src/main.c.

Referenced by main(), and spi_config().

◆ transfer_status1

volatile error_status transfer_status1 = ERROR

Definition at line 56 of file project/at_start_f413/examples/spi/fullduplex_polling/src/main.c.

Referenced by main().

◆ transfer_status2

volatile error_status transfer_status2 = ERROR

Definition at line 56 of file project/at_start_f413/examples/spi/fullduplex_polling/src/main.c.

Referenced by main().

◆ transfer_status3

volatile error_status transfer_status3 = ERROR

Definition at line 57 of file project/at_start_f413/examples/spi/fullduplex_polling/src/main.c.

Referenced by main().

◆ transfer_status4

volatile error_status transfer_status4 = ERROR

Definition at line 57 of file project/at_start_f413/examples/spi/fullduplex_polling/src/main.c.

Referenced by main().

◆ tx_index

uint32_t tx_index = 0

Definition at line 55 of file project/at_start_f413/examples/spi/fullduplex_polling/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: SPI_halfduplex_dma_jtagpin

Macros | Functions | Variables
SPI_halfduplex_dma_jtagpin
AT32F413_periph_examples

Macros

#define | SPI_MASTER_CS_HIGH gpio_bits_set(GPIOA, GPIO_PINS_15)
#define | SPI_MASTER_CS_LOW gpio_bits_reset(GPIOA, GPIO_PINS_15)
#define | BUFFER_SIZE 32

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
error_status | buffer_compare (uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t bufferlength)
buffer compare function.
static void | dma_config (void)
dma configuration.
static void | spi_config (void)
spi configuration.
static void | gpio_config (void)
gpio configuration.
int | main (void)
main function.

Variables

spi_init_type spi_init_struct
uint8_t | spi1_tx_buffer [32]
uint8_t | spi2_rx_buffer [32]
volatile error_status | transfer_status = ERROR

Detailed Description

Macro Definition Documentation

◆ BUFFER_SIZE

#define BUFFER_SIZE 32

Definition at line 39 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c.

Referenced by dma_config(), and main().

◆ SPI_MASTER_CS_HIGH

#define SPI_MASTER_CS_HIGH gpio_bits_set(GPIOA, GPIO_PINS_15)

Definition at line 37 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c.

Referenced by gpio_config(), and main().

◆ SPI_MASTER_CS_LOW

#define SPI_MASTER_CS_LOW gpio_bits_reset(GPIOA, GPIO_PINS_15)

Definition at line 38 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c.

Referenced by main().

Function Documentation

◆ buffer_compare()

error_status buffer_compare | ( | uint8_t * | pbuffer1,
 |  | uint8_t * | pbuffer2,
 |  | uint16_t | bufferlength )

buffer compare function.

Parameters
pbuffer1,pbuffer2 | buffers to be compared.
buffer_length | buffer's length
Return values
the result of compare

Definition at line 55 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c.

Referenced by main().

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 78 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 113 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/at32f413_int.c.

◆ dma_config()

static void dma_config ( void )
static

dma configuration.

Parameters
none
Return values
none

Definition at line 75 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c.

Referenced by main().

◆ gpio_config()

static void gpio_config ( void )
static

gpio configuration.

Parameters
none
Return values
none

< jtag-dp disabled and sw-dp enabled

< spi1_cs/i2s1_ws(pa15), spi1_sck/i2s1_ck(pb3), spi1_miso(pb4), spi1_mosi/i2s1_sd(pb5), i2s1_mck(pb6)

< spi1_cs/i2s1_ws(pa15), spi1_sck/i2s1_ck(pb3), spi1_miso(pb4), spi1_mosi/i2s1_sd(pb5), i2s1_mck(pb0)

< gpio pins number 15

< gpio pins number 15

< gpio pins number 3

< gpio pins number 5

< gpio pins number 12

< gpio pins number 13

< gpio pins number 14

Definition at line 164 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c.

Referenced by main().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 52 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< gpio pins number 15

< dma1 channel3 full data transfer flag

< dma1 channel4 full data transfer flag

< spi or i2s busy flag

< spi or i2s busy flag

< gpio pins number 15

Definition at line 227 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 65 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 43 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 122 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/at32f413_int.c.

◆ spi_config()

static void spi_config ( void )
static

spi configuration.

Parameters
none
Return values
none

Definition at line 115 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c.

Referenced by main().

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 104 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 131 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 91 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/at32f413_int.c.

Variable Documentation

◆ spi1_tx_buffer

uint8_t spi1_tx_buffer[32]
Initial value:
= {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20}

Definition at line 42 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c.

Referenced by dma_config(), and main().

◆ spi2_rx_buffer

uint8_t spi2_rx_buffer[32]

Definition at line 46 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c.

Referenced by dma_config(), and main().

◆ spi_init_struct

spi_init_type spi_init_struct

Definition at line 41 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c.

Referenced by spi_config().

◆ transfer_status

volatile error_status transfer_status = ERROR

Definition at line 47 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: SPI_halfduplex_interrupt

Macros | Functions | Variables
SPI_halfduplex_interrupt
AT32F413_periph_examples

Macros

#define | SPI_MASTER_CS_HIGH gpio_bits_set(GPIOA, GPIO_PINS_4)
#define | SPI_MASTER_CS_LOW gpio_bits_reset(GPIOA, GPIO_PINS_4)
#define | BUFFER_SIZE 32

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
error_status | buffer_compare (uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t buffer_length)
buffer compare function.
static void | spi_config (void)
spi configuration.
static void | gpio_config (void)
gpio configuration.
void | SPI1_IRQHandler (void)
spi1 interrupt function
void | SPI2_IRQHandler (void)
spi2 interrupt function
int | main (void)
main function.

Variables

uint8_t | spi1_tx_buffer [32]
uint8_t | spi2_rx_buffer [32]
volatile uint32_t | tx_index = 0
volatile uint32_t | rx_index = 0
volatile error_status | transfer_status = ERROR

Detailed Description

Macro Definition Documentation

◆ BUFFER_SIZE

#define BUFFER_SIZE 32

Definition at line 39 of file project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c.

Referenced by main(), and SPI1_IRQHandler().

◆ SPI_MASTER_CS_HIGH

#define SPI_MASTER_CS_HIGH gpio_bits_set(GPIOA, GPIO_PINS_4)

Definition at line 37 of file project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c.

Referenced by gpio_config(), and main().

◆ SPI_MASTER_CS_LOW

#define SPI_MASTER_CS_LOW gpio_bits_reset(GPIOA, GPIO_PINS_4)

Definition at line 38 of file project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c.

Referenced by main().

Function Documentation

◆ buffer_compare()

error_status buffer_compare | ( | uint8_t * | pbuffer1,
 |  | uint8_t * | pbuffer2,
 |  | uint16_t | buffer_length )

buffer compare function.

Parameters
pbuffer1,pbuffer2 | buffers to be compared.
buffer_length | buffer's length
Return values
the result of compare

Definition at line 55 of file project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c.

Referenced by main().

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/spi/halfduplex_interrupt/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/spi/halfduplex_interrupt/src/at32f413_int.c.

◆ gpio_config()

static void gpio_config ( void )
static

gpio configuration.

Parameters
none
Return values
none

< gpio pins number 4

< gpio pins number 4

< gpio pins number 5

< gpio pins number 7

< gpio pins number 12

< gpio pins number 13

< gpio pins number 14

Definition at line 122 of file project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c.

Referenced by main().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/spi/halfduplex_interrupt/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< gpio pins number 4

< spi or i2s busy flag

< spi or i2s busy flag

< gpio pins number 4

Definition at line 211 of file project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/spi/halfduplex_interrupt/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/spi/halfduplex_interrupt/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/spi/halfduplex_interrupt/src/at32f413_int.c.

◆ SPI1_IRQHandler()

void SPI1_IRQHandler ( void )

spi1 interrupt function

Parameters
none
Return values
none

< spi or i2s transmit data buffer empty flag

< transmit data buffer empty interrupt

Definition at line 181 of file project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c.

◆ SPI2_IRQHandler()

void SPI2_IRQHandler ( void )

spi2 interrupt function

Parameters
none
Return values
none

< spi or i2s receive data buffer full flag

Definition at line 198 of file project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c.

◆ spi_config()

static void spi_config ( void )
static

spi configuration.

Parameters
none
Return values
none

< transmit data buffer empty interrupt

< receive data buffer full interrupt

Definition at line 75 of file project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c.

Referenced by main().

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/spi/halfduplex_interrupt/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/spi/halfduplex_interrupt/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/spi/halfduplex_interrupt/src/at32f413_int.c.

Variable Documentation

◆ rx_index

volatile uint32_t rx_index = 0

Definition at line 46 of file project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c.

Referenced by main(), and SPI2_IRQHandler().

◆ spi1_tx_buffer

uint8_t spi1_tx_buffer[32]
Initial value:
= {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20}

Definition at line 41 of file project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c.

Referenced by main(), and SPI1_IRQHandler().

◆ spi2_rx_buffer

uint8_t spi2_rx_buffer[32]

Definition at line 45 of file project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c.

Referenced by main(), and SPI2_IRQHandler().

◆ transfer_status

volatile error_status transfer_status = ERROR

Definition at line 47 of file project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c.

Referenced by main().

◆ tx_index

volatile uint32_t tx_index = 0

Definition at line 46 of file project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c.

Referenced by SPI1_IRQHandler().


AT32F413 Firmwary Library: SPI_halfduplex_transceiver_switch

Macros | Functions | Variables
SPI_halfduplex_transceiver_switch
AT32F413_periph_examples

Macros

#define | SPI_MASTER_CS_HIGH gpio_bits_set(GPIOA, GPIO_PINS_4)
#define | SPI_MASTER_CS_LOW gpio_bits_reset(GPIOA, GPIO_PINS_4)
#define | BUFFER_SIZE 32

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
error_status | buffer_compare (uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t buffer_length)
buffer compare function.
static void | spi_config (void)
spi configuration.
static void | gpio_config (void)
gpio configuration.
void | SPI1_IRQHandler (void)
spi1 interrupt function
void | SPI2_IRQHandler (void)
spi2 interrupt function
int | main (void)
main function.

Variables

spi_init_type spi_init_struct
uint8_t | spi1_tx_buffer [32]
uint8_t | spi2_tx_buffer [32]
uint8_t | spi1_rx_buffer [32]
uint8_t | spi2_rx_buffer [32]
volatile uint32_t | tx_index = 0
volatile uint32_t | rx_index = 0
volatile error_status | transfer_status1 = ERROR
volatile error_status | transfer_status2 = ERROR

Detailed Description

Macro Definition Documentation

◆ BUFFER_SIZE

#define BUFFER_SIZE 32

Definition at line 39 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c.

Referenced by main(), SPI1_IRQHandler(), and SPI2_IRQHandler().

◆ SPI_MASTER_CS_HIGH

#define SPI_MASTER_CS_HIGH gpio_bits_set(GPIOA, GPIO_PINS_4)

Definition at line 37 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c.

Referenced by gpio_config(), and main().

◆ SPI_MASTER_CS_LOW

#define SPI_MASTER_CS_LOW gpio_bits_reset(GPIOA, GPIO_PINS_4)

Definition at line 38 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c.

Referenced by main().

Function Documentation

◆ buffer_compare()

error_status buffer_compare | ( | uint8_t * | pbuffer1,
 |  | uint8_t * | pbuffer2,
 |  | uint16_t | buffer_length )

buffer compare function.

Parameters
pbuffer1,pbuffer2 | buffers to be compared.
buffer_length | buffer's length
Return values
the result of compare

Definition at line 60 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c.

Referenced by main().

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/at32f413_int.c.

◆ gpio_config()

static void gpio_config ( void )
static

gpio configuration.

Parameters
none
Return values
none

< gpio pins number 4

< gpio pins number 4

< gpio pins number 5

< gpio pins number 7

< gpio pins number 12

< gpio pins number 13

< gpio pins number 14

Definition at line 125 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c.

Referenced by main().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< gpio pins number 4

< spi or i2s busy flag

< spi or i2s busy flag

< gpio pins number 4

< transmit data buffer empty interrupt

< receive data buffer full interrupt

< receive data buffer full interrupt

< transmit data buffer empty interrupt

< gpio pins number 4

< gpio pins number 4

Definition at line 233 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/at32f413_int.c.

◆ SPI1_IRQHandler()

void SPI1_IRQHandler ( void )

spi1 interrupt function

Parameters
none
Return values
none

< spi or i2s transmit data buffer empty flag

< transmit data buffer empty interrupt

< spi or i2s receive data buffer full flag

< receive data buffer full interrupt

Definition at line 183 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c.

◆ SPI2_IRQHandler()

void SPI2_IRQHandler ( void )

spi2 interrupt function

Parameters
none
Return values
none

< spi or i2s transmit data buffer empty flag

< transmit data buffer empty interrupt

< spi or i2s receive data buffer full flag

Definition at line 211 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c.

◆ spi_config()

static void spi_config ( void )
static

spi configuration.

Parameters
none
Return values
none

< transmit data buffer empty interrupt

< receive data buffer full interrupt

Definition at line 80 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c.

Referenced by main().

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/at32f413_int.c.

Variable Documentation

◆ rx_index

volatile uint32_t rx_index = 0

Definition at line 51 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c.

Referenced by main(), SPI1_IRQHandler(), and SPI2_IRQHandler().

◆ spi1_rx_buffer

uint8_t spi1_rx_buffer[32]

Definition at line 50 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c.

Referenced by main(), and SPI1_IRQHandler().

◆ spi1_tx_buffer

uint8_t spi1_tx_buffer[32]
Initial value:
= {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20}

Definition at line 42 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c.

Referenced by main(), and SPI1_IRQHandler().

◆ spi2_rx_buffer

uint8_t spi2_rx_buffer[32]

Definition at line 50 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c.

Referenced by main(), and SPI2_IRQHandler().

◆ spi2_tx_buffer

uint8_t spi2_tx_buffer[32]
Initial value:
= {0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60,
0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70}

Definition at line 46 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c.

Referenced by main(), and SPI2_IRQHandler().

◆ spi_init_struct

spi_init_type spi_init_struct

Definition at line 41 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c.

Referenced by main(), and spi_config().

◆ transfer_status1

volatile error_status transfer_status1 = ERROR

Definition at line 52 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c.

Referenced by main().

◆ transfer_status2

volatile error_status transfer_status2 = ERROR

Definition at line 52 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c.

Referenced by main().

◆ tx_index

volatile uint32_t tx_index = 0

Definition at line 51 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c.

Referenced by main(), SPI1_IRQHandler(), and SPI2_IRQHandler().


AT32F413 Firmwary Library: SPI_only_receive_mode_polling

Macros | Functions | Variables
SPI_only_receive_mode_polling
AT32F413_periph_examples

Macros

#define | SPI_MASTER_CS_HIGH gpio_bits_set(GPIOA, GPIO_PINS_4)
#define | SPI_MASTER_CS_LOW gpio_bits_reset(GPIOA, GPIO_PINS_4)
#define | BUFFER_SIZE 32

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
error_status | buffer_compare (uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t buffer_length)
buffer compare function.
static void | spi_config (void)
spi configuration.
static void | gpio_config (void)
gpio configuration.
int | main (void)
main function.

Variables

uint8_t | spi1_tx_buffer [32]
uint8_t | spi2_rx_buffer [32]
uint32_t | tx_index = 0
uint32_t | rx_index = 0
volatile error_status | transfer_status = ERROR

Detailed Description

Macro Definition Documentation

◆ BUFFER_SIZE

#define BUFFER_SIZE 32

Definition at line 39 of file project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c.

Referenced by main().

◆ SPI_MASTER_CS_HIGH

#define SPI_MASTER_CS_HIGH gpio_bits_set(GPIOA, GPIO_PINS_4)

Definition at line 37 of file project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c.

Referenced by gpio_config(), and main().

◆ SPI_MASTER_CS_LOW

#define SPI_MASTER_CS_LOW gpio_bits_reset(GPIOA, GPIO_PINS_4)

Definition at line 38 of file project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c.

Referenced by main().

Function Documentation

◆ buffer_compare()

error_status buffer_compare | ( | uint8_t * | pbuffer1,
 |  | uint8_t * | pbuffer2,
 |  | uint16_t | buffer_length )

buffer compare function.

Parameters
pbuffer1,pbuffer2 | buffers to be compared.
buffer_length | buffer's length
Return values
the result of compare

Definition at line 55 of file project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c.

Referenced by main().

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 78 of file project/at_start_f413/examples/spi/only_receive_mode_polling/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 113 of file project/at_start_f413/examples/spi/only_receive_mode_polling/src/at32f413_int.c.

◆ gpio_config()

static void gpio_config ( void )
static

gpio configuration.

Parameters
none
Return values
none

< gpio pins number 4

< gpio pins number 4

< gpio pins number 5

< gpio pins number 7

< gpio pins number 12

< gpio pins number 13

< gpio pins number 15

Definition at line 118 of file project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c.

Referenced by main().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 52 of file project/at_start_f413/examples/spi/only_receive_mode_polling/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< gpio pins number 4

< spi or i2s transmit data buffer empty flag

< spi or i2s receive data buffer full flag

< spi or i2s busy flag

< spi or i2s busy flag

< gpio pins number 4

Definition at line 174 of file project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 65 of file project/at_start_f413/examples/spi/only_receive_mode_polling/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 43 of file project/at_start_f413/examples/spi/only_receive_mode_polling/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 122 of file project/at_start_f413/examples/spi/only_receive_mode_polling/src/at32f413_int.c.

◆ spi_config()

static void spi_config ( void )
static

spi configuration.

Parameters
none
Return values
none

Definition at line 75 of file project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c.

Referenced by main().

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 104 of file project/at_start_f413/examples/spi/only_receive_mode_polling/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 131 of file project/at_start_f413/examples/spi/only_receive_mode_polling/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 91 of file project/at_start_f413/examples/spi/only_receive_mode_polling/src/at32f413_int.c.

Variable Documentation

◆ rx_index

uint32_t rx_index = 0

Definition at line 46 of file project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c.

Referenced by main().

◆ spi1_tx_buffer

uint8_t spi1_tx_buffer[32]
Initial value:
= {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20}

Definition at line 41 of file project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c.

Referenced by main().

◆ spi2_rx_buffer

uint8_t spi2_rx_buffer[32]

Definition at line 45 of file project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c.

Referenced by main().

◆ transfer_status

volatile error_status transfer_status = ERROR

Definition at line 47 of file project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c.

Referenced by main().

◆ tx_index

uint32_t tx_index = 0

Definition at line 46 of file project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: SPI_w25q_flash

Topics | Macros | Functions | Variables
SPI_w25q_flash
AT32F413_periph_examples

Topics

SPI_flash_cs_pin_definition
SPI_flash_id_definition
SPI_flash_operation_definition
SPI_flash_exported_functions

Macros

#define | SPI_TRANS_DMA
#define | FLASH_TEST_ADDR 0x1000
#define | BUF_SIZE 0x256

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | tx_data_fill (void)
transfer data fill.
error_status | buffer_compare (uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t buffer_length)
buffer compare function.
int | main (void)
main function.
void | spiflash_init (void)
spi configuration.
void | spiflash_write (uint8_t *pbuffer, uint32_t write_addr, uint32_t length)
write data to flash
void | spiflash_read (uint8_t *pbuffer, uint32_t read_addr, uint32_t length)
read data from flash
void | spiflash_sector_erase (uint32_t erase_addr)
erase a sector data
void | spiflash_write_nocheck (uint8_t *pbuffer, uint32_t write_addr, uint32_t length)
write data without check
void | spiflash_page_write (uint8_t *pbuffer, uint32_t write_addr, uint32_t length)
write a page data
void | spi_bytes_write (uint8_t *pbuffer, uint32_t length)
write data continuously
void | spi_bytes_read (uint8_t *pbuffer, uint32_t length)
read data continuously
void | spiflash_wait_busy (void)
wait program done
uint8_t | spiflash_read_sr1 (void)
read sr1 register
void | spiflash_write_enable (void)
enable write operation
uint16_t | spiflash_read_id (void)
read device id
uint8_t | spi_byte_write (uint8_t data)
write a byte to flash
uint8_t | spi_byte_read (void)
read a byte to flash

Variables

uint8_t | tx_buffer [0x256]
uint8_t | rx_buffer [0x256]
volatile error_status | transfer_status = ERROR
uint8_t | spiflash_sector_buf [SPIF_SECTOR_SIZE]

Detailed Description

Macro Definition Documentation

◆ BUF_SIZE

#define BUF_SIZE 0x256

Definition at line 39 of file project/at_start_f413/examples/spi/w25q_flash/src/main.c.

Referenced by main(), and tx_data_fill().

◆ FLASH_TEST_ADDR

#define FLASH_TEST_ADDR 0x1000

Definition at line 38 of file project/at_start_f413/examples/spi/w25q_flash/src/main.c.

Referenced by main().

◆ SPI_TRANS_DMA

#define SPI_TRANS_DMA

Definition at line 45 of file spi_flash.h.

Function Documentation

◆ buffer_compare()

error_status buffer_compare | ( | uint8_t * | pbuffer1,
 |  | uint8_t * | pbuffer2,
 |  | uint16_t | buffer_length )

buffer compare function.

Parameters
pbuffer1,pbuffer2 | buffers to be compared.
buffer_length | buffer's length
Return values
the result of compare

Definition at line 68 of file project/at_start_f413/examples/spi/w25q_flash/src/main.c.

Referenced by main().

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 78 of file project/at_start_f413/examples/spi/w25q_flash/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 113 of file project/at_start_f413/examples/spi/w25q_flash/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 52 of file project/at_start_f413/examples/spi/w25q_flash/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 88 of file project/at_start_f413/examples/spi/w25q_flash/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 65 of file project/at_start_f413/examples/spi/w25q_flash/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 43 of file project/at_start_f413/examples/spi/w25q_flash/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 122 of file project/at_start_f413/examples/spi/w25q_flash/src/at32f413_int.c.

◆ spi_byte_read()

uint8_t spi_byte_read ( void )

read a byte to flash

Parameters
none
Return values
flash return data

Definition at line 518 of file spi_flash.c.

Referenced by spiflash_read_id(), and spiflash_read_sr1().

◆ spi_byte_write()

uint8_t spi_byte_write ( uint8_t data )

write a byte to flash

Parameters
data data to write
Return values
flash return data

Definition at line 498 of file spi_flash.c.

Referenced by spi_byte_read(), spiflash_page_write(), spiflash_read(), spiflash_read_id(), spiflash_read_sr1(), spiflash_sector_erase(), and spiflash_write_enable().

◆ spi_bytes_read()

void spi_bytes_read | ( | uint8_t * | pbuffer,
 |  | uint32_t | length )

read data continuously

Parameters
pbuffer | buffer to save data
length | buffer length
Return values
none

Definition at line 373 of file spi_flash.c.

Referenced by spiflash_read().

◆ spi_bytes_write()

void spi_bytes_write | ( | uint8_t * | pbuffer,
 |  | uint32_t | length )

write data continuously

Parameters
pbuffer | the pointer for data buffer
length | buffer length
Return values
none

Definition at line 302 of file spi_flash.c.

Referenced by spiflash_page_write().

◆ spiflash_init()

void spiflash_init ( void )

spi configuration.

Parameters
none
Return values
none

Definition at line 43 of file spi_flash.c.

Referenced by main().

◆ spiflash_page_write()

void spiflash_page_write | ( | uint8_t * | pbuffer,
 |  | uint32_t | write_addr,
 |  | uint32_t | length )

write a page data

Parameters
pbuffer | the pointer for data buffer
write_addr | the address where the data is written
length | buffer length
Return values
none

Definition at line 271 of file spi_flash.c.

Referenced by spiflash_write_nocheck().

◆ spiflash_read()

void spiflash_read | ( | uint8_t * | pbuffer,
 |  | uint32_t | read_addr,
 |  | uint32_t | length )

read data from flash

Parameters
pbuffer | the pointer for data buffer
read_addr | the address where the data is read
length | buffer length
Return values
none

Definition at line 186 of file spi_flash.c.

Referenced by main(), and spiflash_write().

◆ spiflash_read_id()

uint16_t spiflash_read_id ( void )

read device id

Parameters
none
Return values
device id

Definition at line 479 of file spi_flash.c.

Referenced by main().

◆ spiflash_read_sr1()

uint8_t spiflash_read_sr1 ( void )

read sr1 register

Parameters
none
Return values
none

Definition at line 452 of file spi_flash.c.

Referenced by spiflash_wait_busy().

◆ spiflash_sector_erase()

void spiflash_sector_erase ( uint32_t erase_addr )

erase a sector data

Parameters
erase_addr sector address to erase
Return values
none

Definition at line 202 of file spi_flash.c.

Referenced by main(), and spiflash_write().

◆ spiflash_wait_busy()

void spiflash_wait_busy ( void )

wait program done

Parameters
none
Return values
none

Definition at line 442 of file spi_flash.c.

Referenced by spiflash_page_write(), and spiflash_sector_erase().

◆ spiflash_write()

void spiflash_write | ( | uint8_t * | pbuffer,
 |  | uint32_t | write_addr,
 |  | uint32_t | length )

write data to flash

Parameters
pbuffer | the pointer for data buffer
write_addr | the address where the data is written
length | buffer length
Return values
none

Definition at line 98 of file spi_flash.c.

Referenced by main().

◆ spiflash_write_enable()

void spiflash_write_enable ( void )

enable write operation

Parameters
none
Return values
none

Definition at line 467 of file spi_flash.c.

Referenced by spiflash_page_write(), and spiflash_sector_erase().

◆ spiflash_write_nocheck()

void spiflash_write_nocheck | ( | uint8_t * | pbuffer,
 |  | uint32_t | write_addr,
 |  | uint32_t | length )

write data without check

Parameters
pbuffer | the pointer for data buffer
write_addr | the address where the data is written
length | buffer length
Return values
none

Definition at line 223 of file spi_flash.c.

Referenced by spiflash_write().

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 104 of file project/at_start_f413/examples/spi/w25q_flash/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 131 of file project/at_start_f413/examples/spi/w25q_flash/src/at32f413_int.c.

◆ tx_data_fill()

void tx_data_fill ( void )

transfer data fill.

Parameters
none
Return values
none

Definition at line 53 of file project/at_start_f413/examples/spi/w25q_flash/src/main.c.

Referenced by main().

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 91 of file project/at_start_f413/examples/spi/w25q_flash/src/at32f413_int.c.

Variable Documentation

◆ rx_buffer

uint8_t rx_buffer[0x256]

Definition at line 42 of file project/at_start_f413/examples/spi/w25q_flash/src/main.c.

Referenced by main().

◆ spiflash_sector_buf

uint8_t spiflash_sector_buf[SPIF_SECTOR_SIZE]

Definition at line 36 of file spi_flash.c.

Referenced by spiflash_write().

◆ transfer_status

volatile error_status transfer_status = ERROR

Definition at line 43 of file project/at_start_f413/examples/spi/w25q_flash/src/main.c.

Referenced by main().

◆ tx_buffer

uint8_t tx_buffer[0x256]

Definition at line 41 of file project/at_start_f413/examples/spi/w25q_flash/src/main.c.

Referenced by main(), and tx_data_fill().


AT32F413 Firmwary Library: SPI_flash_cs_pin_definition

Macros
SPI_flash_cs_pin_definition
AT32F413_periph_examples » SPI_w25q_flash

Macros

#define | FLASH_CS_HIGH()
#define | FLASH_CS_LOW()

Detailed Description

Macro Definition Documentation

◆ FLASH_CS_HIGH

#define FLASH_CS_HIGH ( )
Value:
gpio_bits_set(GPIOB, GPIO_PINS_12)
gpio_bits_set
void gpio_bits_set(gpio_type *gpio_x, uint16_t pins)
set the selected data port bits.
Definition at32f413_gpio.c:309
GPIO_PINS_12
#define GPIO_PINS_12
Definition at32f413_gpio.h:62
GPIOB
#define GPIOB
Definition at32f413_gpio.h:748

Definition at line 51 of file spi_flash.h.

Referenced by spiflash_init(), spiflash_page_write(), spiflash_read(), spiflash_read_id(), spiflash_read_sr1(), spiflash_sector_erase(), and spiflash_write_enable().

◆ FLASH_CS_LOW

#define FLASH_CS_LOW ( )
Value:
gpio_bits_reset(GPIOB, GPIO_PINS_12)
gpio_bits_reset
void gpio_bits_reset(gpio_type *gpio_x, uint16_t pins)
clear the selected data port bits.
Definition at32f413_gpio.c:340

Definition at line 52 of file spi_flash.h.

Referenced by spiflash_page_write(), spiflash_read(), spiflash_read_id(), spiflash_read_sr1(), spiflash_sector_erase(), and spiflash_write_enable().


AT32F413 Firmwary Library: SPI_flash_id_definition

Macros
SPI_flash_id_definition
AT32F413_periph_examples » SPI_w25q_flash

Macros

#define | W25Q80 0xEF13
#define | W25Q16 0xEF14
#define | W25Q32 0xEF15
#define | W25Q64 0xEF16
#define | W25Q128 0xEF17

Detailed Description

Macro Definition Documentation

◆ W25Q128

#define W25Q128 0xEF17

Definition at line 70 of file spi_flash.h.

Referenced by main().

◆ W25Q16

#define W25Q16 0xEF14

Definition at line 66 of file spi_flash.h.

Referenced by main().

◆ W25Q32

#define W25Q32 0xEF15

Definition at line 67 of file spi_flash.h.

Referenced by main().

◆ W25Q64

#define W25Q64 0xEF16

Definition at line 68 of file spi_flash.h.

Referenced by main().

◆ W25Q80

#define W25Q80 0xEF13

Definition at line 65 of file spi_flash.h.

Referenced by main().


AT32F413 Firmwary Library: SPI_flash_operation_definition

Macros
SPI_flash_operation_definition
AT32F413_periph_examples » SPI_w25q_flash

Macros

#define | SPIF_CHIP_SIZE 0x1000000
#define | SPIF_SECTOR_SIZE 4096
#define | SPIF_PAGE_SIZE 256
#define | SPIF_WRITEENABLE 0x06
#define | SPIF_WRITEDISABLE 0x04
#define | SPIF_READSTATUSREG1 0x05
#define | SPIF_WRITESTATUSREG1 0x01
#define | SPIF_READSTATUSREG2 0x35
#define | SPIF_WRITESTATUSREG2 0x31
#define | SPIF_READSTATUSREG3 0x15
#define | SPIF_WRITESTATUSREG3 0x11
#define | SPIF_READDATA 0x03
#define | SPIF_FASTREADDATA 0x0B
#define | SPIF_FASTREADDUAL 0x3B
#define | SPIF_PAGEPROGRAM 0x02
#define | SPIF_BLOCKERASE 0xD8
#define | SPIF_SECTORERASE 0x20
#define | SPIF_CHIPERASE 0xC7
#define | SPIF_POWERDOWN 0xB9
#define | SPIF_RELEASEPOWERDOWN 0xAB
#define | SPIF_DEVICEID 0xAB
#define | SPIF_MANUFACTDEVICEID 0x90
#define | SPIF_JEDECDEVICEID 0x9F
#define | FLASH_SPI_DUMMY_BYTE 0xA5

Detailed Description

Macro Definition Documentation

◆ FLASH_SPI_DUMMY_BYTE

#define FLASH_SPI_DUMMY_BYTE 0xA5

Definition at line 108 of file spi_flash.h.

Referenced by spi_byte_read(), and spi_bytes_read().

◆ SPIF_BLOCKERASE

#define SPIF_BLOCKERASE 0xD8

Definition at line 100 of file spi_flash.h.

◆ SPIF_CHIP_SIZE

#define SPIF_CHIP_SIZE 0x1000000

Definition at line 80 of file spi_flash.h.

◆ SPIF_CHIPERASE

#define SPIF_CHIPERASE 0xC7

Definition at line 102 of file spi_flash.h.

◆ SPIF_DEVICEID

#define SPIF_DEVICEID 0xAB

Definition at line 105 of file spi_flash.h.

◆ SPIF_FASTREADDATA

#define SPIF_FASTREADDATA 0x0B

Definition at line 96 of file spi_flash.h.

◆ SPIF_FASTREADDUAL

#define SPIF_FASTREADDUAL 0x3B

Definition at line 97 of file spi_flash.h.

◆ SPIF_JEDECDEVICEID

#define SPIF_JEDECDEVICEID 0x9F

Definition at line 107 of file spi_flash.h.

◆ SPIF_MANUFACTDEVICEID

#define SPIF_MANUFACTDEVICEID 0x90

Definition at line 106 of file spi_flash.h.

Referenced by spiflash_read_id().

◆ SPIF_PAGE_SIZE

#define SPIF_PAGE_SIZE 256

Definition at line 82 of file spi_flash.h.

Referenced by spiflash_page_write(), and spiflash_write_nocheck().

◆ SPIF_PAGEPROGRAM

#define SPIF_PAGEPROGRAM 0x02

Definition at line 98 of file spi_flash.h.

Referenced by spiflash_page_write().

◆ SPIF_POWERDOWN

#define SPIF_POWERDOWN 0xB9

Definition at line 103 of file spi_flash.h.

◆ SPIF_READDATA

#define SPIF_READDATA 0x03

Definition at line 95 of file spi_flash.h.

Referenced by spiflash_read().

◆ SPIF_READSTATUSREG1

#define SPIF_READSTATUSREG1 0x05

Definition at line 87 of file spi_flash.h.

Referenced by spiflash_read_sr1().

◆ SPIF_READSTATUSREG2

#define SPIF_READSTATUSREG2 0x35

Definition at line 90 of file spi_flash.h.

◆ SPIF_READSTATUSREG3

#define SPIF_READSTATUSREG3 0x15

Definition at line 93 of file spi_flash.h.

◆ SPIF_RELEASEPOWERDOWN

#define SPIF_RELEASEPOWERDOWN 0xAB

Definition at line 104 of file spi_flash.h.

◆ SPIF_SECTOR_SIZE

#define SPIF_SECTOR_SIZE 4096

Definition at line 81 of file spi_flash.h.

Referenced by main(), spiflash_sector_erase(), and spiflash_write().

◆ SPIF_SECTORERASE

#define SPIF_SECTORERASE 0x20

Definition at line 101 of file spi_flash.h.

Referenced by spiflash_sector_erase().

◆ SPIF_WRITEDISABLE

#define SPIF_WRITEDISABLE 0x04

Definition at line 85 of file spi_flash.h.

◆ SPIF_WRITEENABLE

#define SPIF_WRITEENABLE 0x06

Definition at line 84 of file spi_flash.h.

Referenced by spiflash_write_enable().

◆ SPIF_WRITESTATUSREG1

#define SPIF_WRITESTATUSREG1 0x01

Definition at line 88 of file spi_flash.h.

◆ SPIF_WRITESTATUSREG2

#define SPIF_WRITESTATUSREG2 0x31

Definition at line 91 of file spi_flash.h.

◆ SPIF_WRITESTATUSREG3

#define SPIF_WRITESTATUSREG3 0x11

Definition at line 94 of file spi_flash.h.


AT32F413 Firmwary Library: SPI_flash_exported_functions

Functions
SPI_flash_exported_functions
AT32F413_periph_examples » SPI_w25q_flash

Functions

void | spiflash_init (void)
spi configuration.
void | spiflash_write (uint8_t *pbuffer, uint32_t write_addr, uint32_t length)
write data to flash
void | spiflash_read (uint8_t *pbuffer, uint32_t read_addr, uint32_t length)
read data from flash
void | spiflash_sector_erase (uint32_t erase_addr)
erase a sector data
void | spiflash_write_nocheck (uint8_t *pbuffer, uint32_t write_addr, uint32_t length)
write data without check
void | spiflash_page_write (uint8_t *pbuffer, uint32_t write_addr, uint32_t length)
write a page data
void | spi_bytes_write (uint8_t *pbuffer, uint32_t length)
write data continuously
void | spi_bytes_read (uint8_t *pbuffer, uint32_t length)
read data continuously
void | spiflash_wait_busy (void)
wait program done
uint8_t | spiflash_read_sr1 (void)
read sr1 register
void | spiflash_write_enable (void)
enable write operation
uint16_t | spiflash_read_id (void)
read device id
uint8_t | spi_byte_write (uint8_t data)
write a byte to flash
uint8_t | spi_byte_read (void)
read a byte to flash

Detailed Description

Function Documentation

◆ spi_byte_read()

uint8_t spi_byte_read ( void )

read a byte to flash

Parameters
none
Return values
flash return data

Definition at line 518 of file spi_flash.c.

Referenced by spiflash_read_id(), and spiflash_read_sr1().

◆ spi_byte_write()

uint8_t spi_byte_write ( uint8_t data )

write a byte to flash

Parameters
data data to write
Return values
flash return data

Definition at line 498 of file spi_flash.c.

Referenced by spi_byte_read(), spiflash_page_write(), spiflash_read(), spiflash_read_id(), spiflash_read_sr1(), spiflash_sector_erase(), and spiflash_write_enable().

◆ spi_bytes_read()

void spi_bytes_read | ( | uint8_t * | pbuffer,
 |  | uint32_t | length )

read data continuously

Parameters
pbuffer | buffer to save data
length | buffer length
Return values
none

Definition at line 373 of file spi_flash.c.

Referenced by spiflash_read().

◆ spi_bytes_write()

void spi_bytes_write | ( | uint8_t * | pbuffer,
 |  | uint32_t | length )

write data continuously

Parameters
pbuffer | the pointer for data buffer
length | buffer length
Return values
none

Definition at line 302 of file spi_flash.c.

Referenced by spiflash_page_write().

◆ spiflash_init()

void spiflash_init ( void )

spi configuration.

Parameters
none
Return values
none

Definition at line 43 of file spi_flash.c.

Referenced by main().

◆ spiflash_page_write()

void spiflash_page_write | ( | uint8_t * | pbuffer,
 |  | uint32_t | write_addr,
 |  | uint32_t | length )

write a page data

Parameters
pbuffer | the pointer for data buffer
write_addr | the address where the data is written
length | buffer length
Return values
none

Definition at line 271 of file spi_flash.c.

Referenced by spiflash_write_nocheck().

◆ spiflash_read()

void spiflash_read | ( | uint8_t * | pbuffer,
 |  | uint32_t | read_addr,
 |  | uint32_t | length )

read data from flash

Parameters
pbuffer | the pointer for data buffer
read_addr | the address where the data is read
length | buffer length
Return values
none

Definition at line 186 of file spi_flash.c.

Referenced by main(), and spiflash_write().

◆ spiflash_read_id()

uint16_t spiflash_read_id ( void )

read device id

Parameters
none
Return values
device id

Definition at line 479 of file spi_flash.c.

Referenced by main().

◆ spiflash_read_sr1()

uint8_t spiflash_read_sr1 ( void )

read sr1 register

Parameters
none
Return values
none

Definition at line 452 of file spi_flash.c.

Referenced by spiflash_wait_busy().

◆ spiflash_sector_erase()

void spiflash_sector_erase ( uint32_t erase_addr )

erase a sector data

Parameters
erase_addr sector address to erase
Return values
none

Definition at line 202 of file spi_flash.c.

Referenced by main(), and spiflash_write().

◆ spiflash_wait_busy()

void spiflash_wait_busy ( void )

wait program done

Parameters
none
Return values
none

Definition at line 442 of file spi_flash.c.

Referenced by spiflash_page_write(), and spiflash_sector_erase().

◆ spiflash_write()

void spiflash_write | ( | uint8_t * | pbuffer,
 |  | uint32_t | write_addr,
 |  | uint32_t | length )

write data to flash

Parameters
pbuffer | the pointer for data buffer
write_addr | the address where the data is written
length | buffer length
Return values
none

Definition at line 98 of file spi_flash.c.

Referenced by main().

◆ spiflash_write_enable()

void spiflash_write_enable ( void )

enable write operation

Parameters
none
Return values
none

Definition at line 467 of file spi_flash.c.

Referenced by spiflash_page_write(), and spiflash_sector_erase().

◆ spiflash_write_nocheck()

void spiflash_write_nocheck | ( | uint8_t * | pbuffer,
 |  | uint32_t | write_addr,
 |  | uint32_t | length )

write data without check

Parameters
pbuffer | the pointer for data buffer
write_addr | the address where the data is written
length | buffer length
Return values
none

Definition at line 223 of file spi_flash.c.

Referenced by spiflash_write().


AT32F413 Firmwary Library: TMR_6_steps

Functions | Variables
TMR_6_steps
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | systick_configuration (void)
configures the systick.
int | main (void)
main function.
void | TMR1_TRG_HALL_TMR11_IRQHandler (void)
this function handles tmr1 trigger and hall interrupts requests.

Variables

gpio_init_type | gpio_init_struct = {0}
tmr_output_config_type tmr_output_struct
tmr_brkdt_config_type | tmr_brkdt_config_struct = {0}
crm_clocks_freq_type | crm_clocks_freq_struct = {0}
__IO uint32_t | step = 1

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/tmr/6_steps/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/tmr/6_steps/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/tmr/6_steps/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< gpio pins number 8

< gpio pins number 9

< gpio pins number 10

< gpio pins number 13

< gpio pins number 14

< gpio pins number 15

< gpio pins number 12

< tmr interrupt hall

Definition at line 52 of file project/at_start_f413/examples/tmr/6_steps/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/tmr/6_steps/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/tmr/6_steps/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/tmr/6_steps/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/tmr/6_steps/src/at32f413_int.c.

◆ systick_configuration()

void systick_configuration ( void )

configures the systick.

Parameters
none
Return values
none

Definition at line 184 of file project/at_start_f413/examples/tmr/6_steps/src/main.c.

Referenced by main().

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/tmr/6_steps/src/at32f413_int.c.

◆ TMR1_TRG_HALL_TMR11_IRQHandler()

void TMR1_TRG_HALL_TMR11_IRQHandler ( void )

this function handles tmr1 trigger and hall interrupts requests.

Parameters
none
Return values
none

< tmr flag hall

Definition at line 201 of file project/at_start_f413/examples/tmr/6_steps/src/main.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/tmr/6_steps/src/at32f413_int.c.

Variable Documentation

◆ crm_clocks_freq_struct

crm_clocks_freq_type crm_clocks_freq_struct = {0}

Definition at line 40 of file project/at_start_f413/examples/tmr/6_steps/src/main.c.

Referenced by main(), and systick_configuration().

◆ gpio_init_struct

gpio_init_type gpio_init_struct = {0}

Definition at line 37 of file project/at_start_f413/examples/tmr/6_steps/src/main.c.

Referenced by main().

◆ step

__IO uint32_t step = 1

Definition at line 42 of file project/at_start_f413/examples/tmr/6_steps/src/main.c.

Referenced by TMR1_TRG_HALL_TMR11_IRQHandler().

◆ tmr_brkdt_config_struct

tmr_brkdt_config_type tmr_brkdt_config_struct = {0}

Definition at line 39 of file project/at_start_f413/examples/tmr/6_steps/src/main.c.

Referenced by main().

◆ tmr_output_struct

tmr_output_config_type tmr_output_struct

Definition at line 38 of file project/at_start_f413/examples/tmr/6_steps/src/main.c.

Referenced by main(), tmr_output_channel_config(), and tmr_output_default_para_init().


AT32F413 Firmwary Library: TMR_7_pwm_output

Functions | Variables
TMR_7_pwm_output
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
int | main (void)
main function.

Variables

gpio_init_type | gpio_init_struct = {0}
tmr_output_config_type tmr_output_struct
crm_clocks_freq_type | crm_clocks_freq_struct = {0}
uint16_t | timer_period = 0
uint16_t | channel1_pulse = 0
uint16_t | channel2_pulse = 0
uint16_t | channel3_pulse = 0
uint16_t | channel4_pulse = 0

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/tmr/7_pwm_output/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/tmr/7_pwm_output/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/tmr/7_pwm_output/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< gpio pins number 8

< gpio pins number 9

< gpio pins number 10

< gpio pins number 11

< gpio pins number 13

< gpio pins number 14

< gpio pins number 15

< gpio pins number 12

Definition at line 49 of file project/at_start_f413/examples/tmr/7_pwm_output/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/tmr/7_pwm_output/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/tmr/7_pwm_output/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/tmr/7_pwm_output/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/tmr/7_pwm_output/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/tmr/7_pwm_output/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/tmr/7_pwm_output/src/at32f413_int.c.

Variable Documentation

◆ channel1_pulse

uint16_t channel1_pulse = 0

Definition at line 42 of file project/at_start_f413/examples/tmr/7_pwm_output/src/main.c.

Referenced by main().

◆ channel2_pulse

uint16_t channel2_pulse = 0

Definition at line 42 of file project/at_start_f413/examples/tmr/7_pwm_output/src/main.c.

Referenced by main().

◆ channel3_pulse

uint16_t channel3_pulse = 0

Definition at line 42 of file project/at_start_f413/examples/tmr/7_pwm_output/src/main.c.

Referenced by main().

◆ channel4_pulse

uint16_t channel4_pulse = 0

Definition at line 42 of file project/at_start_f413/examples/tmr/7_pwm_output/src/main.c.

Referenced by main().

◆ crm_clocks_freq_struct

crm_clocks_freq_type crm_clocks_freq_struct = {0}

Definition at line 39 of file project/at_start_f413/examples/tmr/7_pwm_output/src/main.c.

Referenced by main().

◆ gpio_init_struct

gpio_init_type gpio_init_struct = {0}

Definition at line 37 of file project/at_start_f413/examples/tmr/7_pwm_output/src/main.c.

Referenced by main().

◆ timer_period

uint16_t timer_period = 0

Definition at line 41 of file project/at_start_f413/examples/tmr/7_pwm_output/src/main.c.

Referenced by main().

◆ tmr_output_struct

tmr_output_config_type tmr_output_struct

Definition at line 38 of file project/at_start_f413/examples/tmr/7_pwm_output/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: TMR_cascade_synchro

Functions | Variables
TMR_cascade_synchro
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
int | main (void)
main function.

Variables

gpio_init_type gpio_init_struct = {0}
tmr_output_config_type tmr_output_struct

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/tmr/cascade_synchro/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/tmr/cascade_synchro/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/tmr/cascade_synchro/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< gpio pins number 6

< gpio pins number 0

< gpio pins number 6

Definition at line 45 of file project/at_start_f413/examples/tmr/cascade_synchro/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/tmr/cascade_synchro/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/tmr/cascade_synchro/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/tmr/cascade_synchro/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/tmr/cascade_synchro/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/tmr/cascade_synchro/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/tmr/cascade_synchro/src/at32f413_int.c.

Variable Documentation

◆ gpio_init_struct

gpio_init_type gpio_init_struct = {0}

Definition at line 37 of file project/at_start_f413/examples/tmr/cascade_synchro/src/main.c.

Referenced by main().

◆ tmr_output_struct

tmr_output_config_type tmr_output_struct

Definition at line 38 of file project/at_start_f413/examples/tmr/cascade_synchro/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: TMR_complementary_signals

Functions | Variables
TMR_complementary_signals
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
int | main (void)
main function.

Variables

gpio_init_type | gpio_init_struct = {0}
tmr_output_config_type tmr_output_struct
crm_clocks_freq_type | crm_clocks_freq_struct = {0}
tmr_brkdt_config_type | tmr_brkdt_config_struct = {0}
uint16_t | timer_period = 0
uint16_t | channel1_pulse = 0
uint16_t | channel2_pulse = 0
uint16_t | channel3_pulse = 0

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/tmr/complementary_signals/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/tmr/complementary_signals/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/tmr/complementary_signals/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< gpio pins number 8

< gpio pins number 9

< gpio pins number 10

< gpio pins number 13

< gpio pins number 14

< gpio pins number 15

< gpio pins number 12

Definition at line 50 of file project/at_start_f413/examples/tmr/complementary_signals/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/tmr/complementary_signals/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/tmr/complementary_signals/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/tmr/complementary_signals/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/tmr/complementary_signals/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/tmr/complementary_signals/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/tmr/complementary_signals/src/at32f413_int.c.

Variable Documentation

◆ channel1_pulse

uint16_t channel1_pulse = 0

Definition at line 43 of file project/at_start_f413/examples/tmr/complementary_signals/src/main.c.

Referenced by main().

◆ channel2_pulse

uint16_t channel2_pulse = 0

Definition at line 43 of file project/at_start_f413/examples/tmr/complementary_signals/src/main.c.

Referenced by main().

◆ channel3_pulse

uint16_t channel3_pulse = 0

Definition at line 43 of file project/at_start_f413/examples/tmr/complementary_signals/src/main.c.

Referenced by main().

◆ crm_clocks_freq_struct

crm_clocks_freq_type crm_clocks_freq_struct = {0}

Definition at line 39 of file project/at_start_f413/examples/tmr/complementary_signals/src/main.c.

Referenced by main().

◆ gpio_init_struct

gpio_init_type gpio_init_struct = {0}

Definition at line 37 of file project/at_start_f413/examples/tmr/complementary_signals/src/main.c.

Referenced by main().

◆ timer_period

uint16_t timer_period = 0

Definition at line 42 of file project/at_start_f413/examples/tmr/complementary_signals/src/main.c.

Referenced by main().

◆ tmr_brkdt_config_struct

tmr_brkdt_config_type tmr_brkdt_config_struct = {0}

Definition at line 40 of file project/at_start_f413/examples/tmr/complementary_signals/src/main.c.

Referenced by main().

◆ tmr_output_struct

tmr_output_config_type tmr_output_struct

Definition at line 38 of file project/at_start_f413/examples/tmr/complementary_signals/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: TMR_dma

Functions | Variables
TMR_dma
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
int | main (void)
main function.

Variables

gpio_init_type | gpio_init_struct = {0}
tmr_output_config_type tmr_output_struct
dma_init_type | dma_init_struct = {0}
crm_clocks_freq_type | crm_clocks_freq_struct = {0}
uint16_t | timer_period = 0
uint16_t | src_buffer [3] = {0, 0, 0}

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/tmr/dma/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/tmr/dma/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/tmr/dma/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< gpio pins number 10

< gpio pins number 15

Definition at line 50 of file project/at_start_f413/examples/tmr/dma/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/tmr/dma/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/tmr/dma/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/tmr/dma/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/tmr/dma/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/tmr/dma/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/tmr/dma/src/at32f413_int.c.

Variable Documentation

◆ crm_clocks_freq_struct

crm_clocks_freq_type crm_clocks_freq_struct = {0}

Definition at line 40 of file project/at_start_f413/examples/tmr/dma/src/main.c.

Referenced by main().

◆ dma_init_struct

dma_init_type dma_init_struct = {0}

Definition at line 39 of file project/at_start_f413/examples/tmr/dma/src/main.c.

Referenced by main().

◆ gpio_init_struct

gpio_init_type gpio_init_struct = {0}

Definition at line 37 of file project/at_start_f413/examples/tmr/dma/src/main.c.

Referenced by main().

◆ src_buffer

uint16_t src_buffer[3] = {0, 0, 0}

Definition at line 43 of file project/at_start_f413/examples/tmr/dma/src/main.c.

Referenced by main().

◆ timer_period

uint16_t timer_period = 0

Definition at line 42 of file project/at_start_f413/examples/tmr/dma/src/main.c.

Referenced by main().

◆ tmr_output_struct

tmr_output_config_type tmr_output_struct

Definition at line 38 of file project/at_start_f413/examples/tmr/dma/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: TMR_dma_burst

Functions | Variables
TMR_dma_burst
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
int | main (void)
main function.

Variables

gpio_init_type | gpio_init_struct = {0}
tmr_output_config_type tmr_output_struct
dma_init_type | dma_init_struct = {0}
crm_clocks_freq_type | crm_clocks_freq_struct = {0}
uint16_t | timer_period = 0
uint16_t | src_buffer [3] = {0x0FFF, 0x0000, 0x0555}

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/tmr/dma_burst/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/tmr/dma_burst/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/tmr/dma_burst/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< gpio pins number 8

Definition at line 50 of file project/at_start_f413/examples/tmr/dma_burst/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/tmr/dma_burst/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/tmr/dma_burst/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/tmr/dma_burst/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/tmr/dma_burst/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/tmr/dma_burst/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/tmr/dma_burst/src/at32f413_int.c.

Variable Documentation

◆ crm_clocks_freq_struct

crm_clocks_freq_type crm_clocks_freq_struct = {0}

Definition at line 40 of file project/at_start_f413/examples/tmr/dma_burst/src/main.c.

Referenced by main().

◆ dma_init_struct

dma_init_type dma_init_struct = {0}

Definition at line 39 of file project/at_start_f413/examples/tmr/dma_burst/src/main.c.

Referenced by main().

◆ gpio_init_struct

gpio_init_type gpio_init_struct = {0}

Definition at line 37 of file project/at_start_f413/examples/tmr/dma_burst/src/main.c.

Referenced by main().

◆ src_buffer

uint16_t src_buffer[3] = {0x0FFF, 0x0000, 0x0555}

Definition at line 43 of file project/at_start_f413/examples/tmr/dma_burst/src/main.c.

Referenced by main().

◆ timer_period

uint16_t timer_period = 0

Definition at line 42 of file project/at_start_f413/examples/tmr/dma_burst/src/main.c.

◆ tmr_output_struct

tmr_output_config_type tmr_output_struct

Definition at line 38 of file project/at_start_f413/examples/tmr/dma_burst/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: TMR_encoder_tmr2

Functions | Variables
TMR_encoder_tmr2
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | delay (uint32_t time)
delay function
int | main (void)
main function.

Variables

gpio_init_type | gpio_init_struct = {0}
crm_clocks_freq_type | crm_clocks_freq_struct = {0}
uint32_t | counter

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/tmr/encoder_tmr2/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/tmr/encoder_tmr2/src/at32f413_int.c.

◆ delay()

void delay ( uint32_t time )

delay function

Parameters
time number of time to delay
Return values
none

Definition at line 119 of file project/at_start_f413/examples/tmr/encoder_tmr2/src/main.c.

Referenced by main().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/tmr/encoder_tmr2/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< gpio pins number 0

< gpio pins number 1

< gpio pins number 2

< gpio pins number 3

< gpio pins number 2

< gpio pins number 3

< gpio pins number 2

< gpio pins number 3

Definition at line 48 of file project/at_start_f413/examples/tmr/encoder_tmr2/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/tmr/encoder_tmr2/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/tmr/encoder_tmr2/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/tmr/encoder_tmr2/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/tmr/encoder_tmr2/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/tmr/encoder_tmr2/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/tmr/encoder_tmr2/src/at32f413_int.c.

Variable Documentation

◆ counter

uint32_t counter

Definition at line 41 of file project/at_start_f413/examples/tmr/encoder_tmr2/src/main.c.

Referenced by main().

◆ crm_clocks_freq_struct

crm_clocks_freq_type crm_clocks_freq_struct = {0}

Definition at line 38 of file project/at_start_f413/examples/tmr/encoder_tmr2/src/main.c.

Referenced by main().

◆ gpio_init_struct

gpio_init_type gpio_init_struct = {0}

Definition at line 37 of file project/at_start_f413/examples/tmr/encoder_tmr2/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: TMR_external_clock

Functions | Variables
TMR_external_clock
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
int | main (void)
main function.

Variables

gpio_init_type | gpio_init_struct = {0}
crm_clocks_freq_type | crm_clocks_freq_struct = {0}
tmr_output_config_type tmr_output_struct
tmr_input_config_type tmr_input_config_struct

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/tmr/external_clock/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/tmr/external_clock/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/tmr/external_clock/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< gpio pins number 0

< gpio pins number 7

Definition at line 47 of file project/at_start_f413/examples/tmr/external_clock/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/tmr/external_clock/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/tmr/external_clock/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/tmr/external_clock/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/tmr/external_clock/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/tmr/external_clock/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/tmr/external_clock/src/at32f413_int.c.

Variable Documentation

◆ crm_clocks_freq_struct

crm_clocks_freq_type crm_clocks_freq_struct = {0}

Definition at line 38 of file project/at_start_f413/examples/tmr/external_clock/src/main.c.

Referenced by main().

◆ gpio_init_struct

gpio_init_type gpio_init_struct = {0}

Definition at line 37 of file project/at_start_f413/examples/tmr/external_clock/src/main.c.

Referenced by main().

◆ tmr_input_config_struct

tmr_input_config_type tmr_input_config_struct

Definition at line 40 of file project/at_start_f413/examples/tmr/external_clock/src/main.c.

Referenced by main().

◆ tmr_output_struct

tmr_output_config_type tmr_output_struct

Definition at line 39 of file project/at_start_f413/examples/tmr/external_clock/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: TMR_hall_xor_tmr2

Functions | Variables
TMR_hall_xor_tmr2
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
int | main (void)
main function.
void | TMR2_GLOBAL_IRQHandler (void)
this function handles TMR2 trigger exception.

Variables

gpio_init_type | gpio_init_struct = {0}
crm_clocks_freq_type | crm_clocks_freq_struct = {0}
tmr_output_config_type tmr_output_struct
tmr_input_config_type tmr_input_config_struct

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/tmr/hall_xor_tmr2/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/tmr/hall_xor_tmr2/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/tmr/hall_xor_tmr2/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< gpio pins number 0

< gpio pins number 1

< gpio pins number 2

< gpio pins number 3

< gpio pins number 6

< gpio pins number 7

< gpio pins number 8

< tmr interrupt trigger

< gpio pins number 3

< gpio pins number 6

< gpio pins number 7

< gpio pins number 3

< gpio pins number 6

< gpio pins number 7

Definition at line 47 of file project/at_start_f413/examples/tmr/hall_xor_tmr2/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/tmr/hall_xor_tmr2/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/tmr/hall_xor_tmr2/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/tmr/hall_xor_tmr2/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/tmr/hall_xor_tmr2/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/tmr/hall_xor_tmr2/src/at32f413_int.c.

◆ TMR2_GLOBAL_IRQHandler()

void TMR2_GLOBAL_IRQHandler ( void )

this function handles TMR2 trigger exception.

Parameters
none
Return values
none

< tmr flag trigger

< gpio pins number 8

< tmr flag trigger

Definition at line 138 of file project/at_start_f413/examples/tmr/hall_xor_tmr2/src/main.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/tmr/hall_xor_tmr2/src/at32f413_int.c.

Variable Documentation

◆ crm_clocks_freq_struct

crm_clocks_freq_type crm_clocks_freq_struct = {0}

Definition at line 38 of file project/at_start_f413/examples/tmr/hall_xor_tmr2/src/main.c.

Referenced by main().

◆ gpio_init_struct

gpio_init_type gpio_init_struct = {0}

Definition at line 37 of file project/at_start_f413/examples/tmr/hall_xor_tmr2/src/main.c.

Referenced by main().

◆ tmr_input_config_struct

tmr_input_config_type tmr_input_config_struct

Definition at line 40 of file project/at_start_f413/examples/tmr/hall_xor_tmr2/src/main.c.

Referenced by main().

◆ tmr_output_struct

tmr_output_config_type tmr_output_struct

Definition at line 39 of file project/at_start_f413/examples/tmr/hall_xor_tmr2/src/main.c.


AT32F413 Firmwary Library: TMR_hang_mode

Functions | Variables
TMR_hang_mode
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
int | main (void)
main function.

Variables

gpio_init_type | gpio_init_struct = {0}
crm_clocks_freq_type | crm_clocks_freq_struct = {0}
tmr_output_config_type tmr_output_struct
tmr_input_config_type tmr_input_config_struct

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/tmr/hang_mode/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/tmr/hang_mode/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/tmr/hang_mode/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< gpio pins number 8

< gpio pins number 9

Definition at line 47 of file project/at_start_f413/examples/tmr/hang_mode/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/tmr/hang_mode/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/tmr/hang_mode/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/tmr/hang_mode/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/tmr/hang_mode/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/tmr/hang_mode/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/tmr/hang_mode/src/at32f413_int.c.

Variable Documentation

◆ crm_clocks_freq_struct

crm_clocks_freq_type crm_clocks_freq_struct = {0}

Definition at line 38 of file project/at_start_f413/examples/tmr/hang_mode/src/main.c.

Referenced by main().

◆ gpio_init_struct

gpio_init_type gpio_init_struct = {0}

Definition at line 37 of file project/at_start_f413/examples/tmr/hang_mode/src/main.c.

Referenced by main().

◆ tmr_input_config_struct

tmr_input_config_type tmr_input_config_struct

Definition at line 40 of file project/at_start_f413/examples/tmr/hang_mode/src/main.c.

Referenced by main().

◆ tmr_output_struct

tmr_output_config_type tmr_output_struct

Definition at line 39 of file project/at_start_f413/examples/tmr/hang_mode/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: TMR_input_capture

Functions | Variables
TMR_input_capture
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | uart_init (uint32_t baudrate)
init usart.
void | TMR3_GLOBAL_IRQHandler (void)
this function handles tmr3 trigger exception.
int | main (void)
main function.

Variables

gpio_init_type | gpio_init_struct = {0}
crm_clocks_freq_type | crm_clocks_freq_struct = {0}
tmr_input_config_type tmr_input_config_struct
__IO uint32_t | tmr3freq = 0
__IO uint32_t | sys_counter = 0
__IO uint16_t | capturenumber = 0
__IO uint16_t | ch3readvalue1 = 0
__IO uint16_t | ch3readvalue2 = 0
__IO uint32_t | capture = 0

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/tmr/input_capture/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/tmr/input_capture/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/tmr/input_capture/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< gpio pins number 7

< tmr interrupt channel 2

Definition at line 90 of file project/at_start_f413/examples/tmr/input_capture/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/tmr/input_capture/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/tmr/input_capture/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/tmr/input_capture/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/tmr/input_capture/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/tmr/input_capture/src/at32f413_int.c.

◆ TMR3_GLOBAL_IRQHandler()

void TMR3_GLOBAL_IRQHandler ( void )

this function handles tmr3 trigger exception.

Parameters
none
Return values
none

< tmr flag channel 2

< tmr flag channel 2

Definition at line 52 of file project/at_start_f413/examples/tmr/input_capture/src/main.c.

◆ uart_init()

void uart_init ( uint32_t baudrate )

init usart.

Parameters
none
Return values
none

Definition at line 44 of file app_led3_toggle/src/usart.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/tmr/input_capture/src/at32f413_int.c.

Variable Documentation

◆ capture

__IO uint32_t capture = 0

Definition at line 45 of file project/at_start_f413/examples/tmr/input_capture/src/main.c.

Referenced by TMR3_GLOBAL_IRQHandler().

◆ capturenumber

__IO uint16_t capturenumber = 0

Definition at line 43 of file project/at_start_f413/examples/tmr/input_capture/src/main.c.

Referenced by TMR3_GLOBAL_IRQHandler().

◆ ch3readvalue1

__IO uint16_t ch3readvalue1 = 0

Definition at line 44 of file project/at_start_f413/examples/tmr/input_capture/src/main.c.

Referenced by TMR3_GLOBAL_IRQHandler().

◆ ch3readvalue2

__IO uint16_t ch3readvalue2 = 0

Definition at line 44 of file project/at_start_f413/examples/tmr/input_capture/src/main.c.

Referenced by TMR3_GLOBAL_IRQHandler().

◆ crm_clocks_freq_struct

crm_clocks_freq_type crm_clocks_freq_struct = {0}

Definition at line 38 of file project/at_start_f413/examples/tmr/input_capture/src/main.c.

Referenced by main(), and TMR3_GLOBAL_IRQHandler().

◆ gpio_init_struct

gpio_init_type gpio_init_struct = {0}

Definition at line 37 of file project/at_start_f413/examples/tmr/input_capture/src/main.c.

Referenced by main().

◆ sys_counter

__IO uint32_t sys_counter = 0

Definition at line 42 of file project/at_start_f413/examples/tmr/input_capture/src/main.c.

◆ tmr3freq

__IO uint32_t tmr3freq = 0

Definition at line 41 of file project/at_start_f413/examples/tmr/input_capture/src/main.c.

Referenced by main(), and TMR3_GLOBAL_IRQHandler().

◆ tmr_input_config_struct

tmr_input_config_type tmr_input_config_struct

Definition at line 39 of file project/at_start_f413/examples/tmr/input_capture/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: TMR_oc_high

Functions | Variables
TMR_oc_high
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | TMR2_GLOBAL_IRQHandler (void)
this function handles tmr2 global interrupt request.
void | gpio_configuration (void)
configure the gpioc pins.
int | main (void)
main function.

Variables

tmr_output_config_type tmr_oc_init_structure
crm_clocks_freq_type | crm_clocks_freq_struct = {0}
uint16_t | ch1_val = 1000
uint16_t | ch2_val = 500
uint16_t | ch3_val = 250
uint16_t | ch4_val = 125
uint16_t | div_value = 0

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/tmr/oc_high/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/tmr/oc_high/src/at32f413_int.c.

◆ gpio_configuration()

void gpio_configuration ( void )

configure the gpioc pins.

Parameters
none
Return values
none

< gpio pins number 6

< gpio pins number 7

< gpio pins number 8

< gpio pins number 9

Definition at line 52 of file project/at_start_f413/examples/tmr/oc_high/src/main.c.

Referenced by main().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/tmr/oc_high/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< tmr interrupt channel 1

< tmr interrupt channel 2

< tmr interrupt channel 3

< tmr interrupt channel 4

< gpio pins number 6

< gpio pins number 7

< gpio pins number 8

< gpio pins number 9

Definition at line 73 of file project/at_start_f413/examples/tmr/oc_high/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/tmr/oc_high/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/tmr/oc_high/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/tmr/oc_high/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/tmr/oc_high/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/tmr/oc_high/src/at32f413_int.c.

◆ TMR2_GLOBAL_IRQHandler()

void TMR2_GLOBAL_IRQHandler ( void )

this function handles tmr2 global interrupt request.

Parameters
none
Return values
none

< tmr flag channel 1

< tmr flag channel 1

< gpio pins number 6

< tmr flag channel 2

< tmr flag channel 2

< gpio pins number 7

< tmr flag channel 3

< tmr flag channel 3

< gpio pins number 8

< tmr flag channel 4

< gpio pins number 9

Definition at line 139 of file project/at_start_f413/examples/tmr/oc_high/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/tmr/oc_high/src/at32f413_int.c.

Variable Documentation

◆ ch1_val

uint16_t ch1_val = 1000

Definition at line 39 of file project/at_start_f413/examples/tmr/oc_high/src/main.c.

Referenced by main().

◆ ch2_val

uint16_t ch2_val = 500

Definition at line 40 of file project/at_start_f413/examples/tmr/oc_high/src/main.c.

Referenced by main().

◆ ch3_val

uint16_t ch3_val = 250

Definition at line 41 of file project/at_start_f413/examples/tmr/oc_high/src/main.c.

Referenced by main().

◆ ch4_val

uint16_t ch4_val = 125

Definition at line 42 of file project/at_start_f413/examples/tmr/oc_high/src/main.c.

Referenced by main().

◆ crm_clocks_freq_struct

crm_clocks_freq_type crm_clocks_freq_struct = {0}

Definition at line 38 of file project/at_start_f413/examples/tmr/oc_high/src/main.c.

Referenced by main().

◆ div_value

uint16_t div_value = 0

Definition at line 43 of file project/at_start_f413/examples/tmr/oc_high/src/main.c.

Referenced by crm_adc_clock_div_set(), crm_clocks_freq_get(), crm_usb_clock_div_set(), main(), rtc_divider_set(), and system_core_clock_update().

◆ tmr_oc_init_structure

tmr_output_config_type tmr_oc_init_structure

Definition at line 37 of file project/at_start_f413/examples/tmr/oc_high/src/main.c.

Referenced by main(), mclk_tmr1_init(), and tmr1_config().


AT32F413 Firmwary Library: TMR_oc_low

Functions | Variables
TMR_oc_low
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | TMR2_GLOBAL_IRQHandler (void)
this function handles tmr2 global interrupt request.
void | gpio_configuration (void)
configure the gpioc pins.
int | main (void)
main function.

Variables

tmr_output_config_type tmr_oc_init_structure
uint16_t | ch1_val = 1000
uint16_t | ch2_val = 500
uint16_t | ch3_val = 250
uint16_t | ch4_val = 125
uint16_t | div_value = 0

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/tmr/oc_low/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/tmr/oc_low/src/at32f413_int.c.

◆ gpio_configuration()

void gpio_configuration ( void )

configure the gpioc pins.

Parameters
none
Return values
none

< gpio pins number 6

< gpio pins number 7

< gpio pins number 8

< gpio pins number 9

Definition at line 51 of file project/at_start_f413/examples/tmr/oc_low/src/main.c.

Referenced by main().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/tmr/oc_low/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< tmr interrupt channel 1

< tmr interrupt channel 2

< tmr interrupt channel 3

< tmr interrupt channel 4

< gpio pins number 6

< gpio pins number 7

< gpio pins number 8

< gpio pins number 9

Definition at line 71 of file project/at_start_f413/examples/tmr/oc_low/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/tmr/oc_low/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/tmr/oc_low/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/tmr/oc_low/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/tmr/oc_low/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/tmr/oc_low/src/at32f413_int.c.

◆ TMR2_GLOBAL_IRQHandler()

void TMR2_GLOBAL_IRQHandler ( void )

this function handles tmr2 global interrupt request.

Parameters
none
Return values
none

< tmr flag channel 1

< tmr flag channel 1

< gpio pins number 6

< tmr flag channel 2

< tmr flag channel 2

< gpio pins number 7

< tmr flag channel 3

< tmr flag channel 3

< gpio pins number 8

< tmr flag channel 4

< gpio pins number 9

Definition at line 139 of file project/at_start_f413/examples/tmr/oc_low/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/tmr/oc_low/src/at32f413_int.c.

Variable Documentation

◆ ch1_val

uint16_t ch1_val = 1000

Definition at line 38 of file project/at_start_f413/examples/tmr/oc_low/src/main.c.

Referenced by main().

◆ ch2_val

uint16_t ch2_val = 500

Definition at line 39 of file project/at_start_f413/examples/tmr/oc_low/src/main.c.

Referenced by main().

◆ ch3_val

uint16_t ch3_val = 250

Definition at line 40 of file project/at_start_f413/examples/tmr/oc_low/src/main.c.

Referenced by main().

◆ ch4_val

uint16_t ch4_val = 125

Definition at line 41 of file project/at_start_f413/examples/tmr/oc_low/src/main.c.

Referenced by main().

◆ div_value

uint16_t div_value = 0

Definition at line 42 of file project/at_start_f413/examples/tmr/oc_low/src/main.c.

Referenced by main().

◆ tmr_oc_init_structure

tmr_output_config_type tmr_oc_init_structure

Definition at line 37 of file project/at_start_f413/examples/tmr/oc_low/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: TMR_oc_toggle_tmr3

Functions | Variables
TMR_oc_toggle_tmr3
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | TMR3_GLOBAL_IRQHandler (void)
this function handles tmr3 global interrupt request.
void | crm_configuration (void)
configures the different peripheral clocks.
void | gpio_configuration (void)
configure the tmr3 pins.
void | nvic_configuration (void)
configures the nested vectored interrupt controller.
int | main (void)
main function.

Variables

uint32_t | capture = 0
tmr_output_config_type tmr_oc_init_structure
__IO uint16_t | ch1_val = 32768
__IO uint16_t | ch2_val = 16384
__IO uint16_t | ch3_val = 8192
__IO uint16_t | ch4_val = 4096
uint16_t | div_value = 0

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 84 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c.

◆ crm_configuration()

void crm_configuration ( void )

configures the different peripheral clocks.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/main.c.

Referenced by main().

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 119 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c.

◆ gpio_configuration()

void gpio_configuration ( void )

configure the tmr3 pins.

Parameters
none
Return values
none

< gpio pins number 6

< gpio pins number 7

< gpio pins number 0

< gpio pins number 1

Definition at line 53 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/main.c.

Referenced by main().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 58 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< tmr interrupt channel 1

< tmr interrupt channel 2

< tmr interrupt channel 3

< tmr interrupt channel 4

Definition at line 92 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 71 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 49 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c.

◆ nvic_configuration()

void nvic_configuration ( void )

configures the nested vectored interrupt controller.

Parameters
none
Return values
none

Definition at line 47 of file project/at_start_f413/examples/rtc/lick_calibration/src/main.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 128 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 110 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 137 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c.

◆ TMR3_GLOBAL_IRQHandler()

void TMR3_GLOBAL_IRQHandler ( void )

this function handles tmr3 global interrupt request.

Parameters
none
Return values
none

< tmr flag channel 1

< tmr flag channel 1

< tmr flag channel 2

< tmr flag channel 2

< tmr flag channel 3

< tmr flag channel 3

< tmr flag channel 4

< tmr flag channel 4

Definition at line 146 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 97 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c.

Variable Documentation

◆ capture

uint32_t capture = 0

Definition at line 42 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c.

Referenced by TMR3_GLOBAL_IRQHandler().

◆ ch1_val

__IO uint16_t ch1_val = 32768

Definition at line 38 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/main.c.

Referenced by main().

◆ ch2_val

__IO uint16_t ch2_val = 16384

Definition at line 39 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/main.c.

Referenced by main().

◆ ch3_val

__IO uint16_t ch3_val = 8192

Definition at line 40 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/main.c.

Referenced by main().

◆ ch4_val

__IO uint16_t ch4_val = 4096

Definition at line 41 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/main.c.

Referenced by main().

◆ div_value

uint16_t div_value = 0

Definition at line 42 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/main.c.

Referenced by main().

◆ tmr_oc_init_structure

tmr_output_config_type tmr_oc_init_structure

Definition at line 37 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: TMR_oc_toggle_tmr9

Functions | Variables
TMR_oc_toggle_tmr9
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | TMR1_BRK_TMR9_IRQHandler (void)
this function handles TMR9 global interrupt request.
void | crm_configuration (void)
configures the different peripheral clocks.
void | gpio_configuration (void)
configure the tmr9 pins.
void | nvic_configuration (void)
configures the nested vectored interrupt controller.
int | main (void)
main function.

Variables

uint16_t | capture = 0
tmr_output_config_type tmr_oc_init_structure
__IO uint16_t | ch1_val = 32768
__IO uint16_t | ch2_val = 16384
uint16_t | div_value = 0

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 82 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c.

◆ crm_configuration()

void crm_configuration ( void )

configures the different peripheral clocks.

Parameters
none
Return values
none

Definition at line 71 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/main.c.

Referenced by main().

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 117 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c.

◆ gpio_configuration()

void gpio_configuration ( void )

configure the tmr9 pins.

Parameters
none
Return values
none

< gpio pins number 2

< gpio pins number 3

Definition at line 51 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/main.c.

Referenced by main().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 56 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< tmr interrupt channel 1

< tmr interrupt channel 2

Definition at line 85 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 69 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 47 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c.

◆ nvic_configuration()

void nvic_configuration ( void )

configures the nested vectored interrupt controller.

Parameters
none
Return values
none

Definition at line 47 of file project/at_start_f413/examples/rtc/lick_calibration/src/main.c.

Referenced by main().

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 126 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 108 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 135 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c.

◆ TMR1_BRK_TMR9_IRQHandler()

void TMR1_BRK_TMR9_IRQHandler ( void )

this function handles TMR9 global interrupt request.

Parameters
none
Return values
none

< tmr flag channel 1

< tmr flag channel 1

< tmr flag channel 2

< tmr flag channel 2

Definition at line 144 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 95 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c.

Variable Documentation

◆ capture

uint16_t capture = 0

Definition at line 40 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c.

Referenced by TMR1_BRK_TMR9_IRQHandler().

◆ ch1_val

__IO uint16_t ch1_val = 32768

Definition at line 38 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/main.c.

Referenced by main().

◆ ch2_val

__IO uint16_t ch2_val = 16384

Definition at line 39 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/main.c.

Referenced by main().

◆ div_value

uint16_t div_value = 0

Definition at line 40 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/main.c.

Referenced by main().

◆ tmr_oc_init_structure

tmr_output_config_type tmr_oc_init_structure

Definition at line 37 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: TMR_one_cycle

Functions | Variables
TMR_one_cycle
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | crm_configuration (void)
configures the different peripheral clocks.
void | gpio_configuration (void)
configure the tmr3 pins.
int | main (void)
main function.

Variables

tmr_output_config_type tmr_oc_init_structure
tmr_input_config_type tmr_ic_init_structure
uint16_t div_value = 0

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/tmr/one_cycle/src/at32f413_int.c.

◆ crm_configuration()

void crm_configuration ( void )

configures the different peripheral clocks.

Parameters
none
Return values
none

Definition at line 74 of file project/at_start_f413/examples/tmr/one_cycle/src/main.c.

Referenced by main().

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/tmr/one_cycle/src/at32f413_int.c.

◆ gpio_configuration()

void gpio_configuration ( void )

configure the tmr3 pins.

Parameters
none
Return values
none

< gpio pins number 7

< gpio pins number 6

Definition at line 49 of file project/at_start_f413/examples/tmr/one_cycle/src/main.c.

Referenced by main().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/tmr/one_cycle/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 88 of file project/at_start_f413/examples/tmr/one_cycle/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/tmr/one_cycle/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/tmr/one_cycle/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/tmr/one_cycle/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/tmr/one_cycle/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/tmr/one_cycle/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/tmr/one_cycle/src/at32f413_int.c.

Variable Documentation

◆ div_value

uint16_t div_value = 0

Definition at line 39 of file project/at_start_f413/examples/tmr/one_cycle/src/main.c.

Referenced by main().

◆ tmr_ic_init_structure

tmr_input_config_type tmr_ic_init_structure

Definition at line 38 of file project/at_start_f413/examples/tmr/one_cycle/src/main.c.

Referenced by main().

◆ tmr_oc_init_structure

tmr_output_config_type tmr_oc_init_structure

Definition at line 37 of file project/at_start_f413/examples/tmr/one_cycle/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: TMR_parallel_synchro

Functions | Variables
TMR_parallel_synchro
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | crm_configuration (void)
configures the different peripheral clocks.
void | gpio_configuration (void)
configure the tmr3 pins.
int | main (void)
main function.

Variables

tmr_output_config_type tmr_oc_init_structure

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/tmr/parallel_synchro/src/at32f413_int.c.

◆ crm_configuration()

void crm_configuration ( void )

configures the different peripheral clocks.

Parameters
none
Return values
none

Definition at line 70 of file project/at_start_f413/examples/tmr/parallel_synchro/src/main.c.

Referenced by main().

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/tmr/parallel_synchro/src/at32f413_int.c.

◆ gpio_configuration()

void gpio_configuration ( void )

configure the tmr3 pins.

Parameters
none
Return values
none

< gpio pins number 6

< gpio pins number 0

< gpio pins number 6

Definition at line 47 of file project/at_start_f413/examples/tmr/parallel_synchro/src/main.c.

Referenced by main().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/tmr/parallel_synchro/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 89 of file project/at_start_f413/examples/tmr/parallel_synchro/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/tmr/parallel_synchro/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/tmr/parallel_synchro/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/tmr/parallel_synchro/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/tmr/parallel_synchro/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/tmr/parallel_synchro/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/tmr/parallel_synchro/src/at32f413_int.c.

Variable Documentation

◆ tmr_oc_init_structure

tmr_output_config_type tmr_oc_init_structure

Definition at line 37 of file project/at_start_f413/examples/tmr/parallel_synchro/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: TMR_pwm_input

Functions | Variables
TMR_pwm_input
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | TMR3_GLOBAL_IRQHandler (void)
this function handles tmr3 global interrupt request.
void | crm_configuration (void)
configures the different peripheral clocks.
void | gpio_configuration (void)
configure the tmr3 pins.
int | main (void)
main function.

Variables

__IO uint16_t | ic2value = 0
tmr_input_config_type tmr_ic_init_structure
__IO uint16_t | duty_cycle = 0
__IO uint32_t | frequency = 0

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 82 of file project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c.

◆ crm_configuration()

void crm_configuration ( void )

configures the different peripheral clocks.

Parameters
none
Return values
none

Definition at line 69 of file project/at_start_f413/examples/tmr/pwm_input/src/main.c.

Referenced by main().

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 117 of file project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c.

◆ gpio_configuration()

void gpio_configuration ( void )

configure the tmr3 pins.

Parameters
none
Return values
none

< gpio pins number 7

Definition at line 50 of file project/at_start_f413/examples/tmr/pwm_input/src/main.c.

Referenced by main().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 56 of file project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< tmr interrupt channel 2

Definition at line 83 of file project/at_start_f413/examples/tmr/pwm_input/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 69 of file project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 47 of file project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 126 of file project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 108 of file project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 135 of file project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c.

◆ TMR3_GLOBAL_IRQHandler()

void TMR3_GLOBAL_IRQHandler ( void )

this function handles tmr3 global interrupt request.

Parameters
none
Return values
none

< tmr flag channel 2

Definition at line 144 of file project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 95 of file project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c.

Variable Documentation

◆ duty_cycle

__IO uint16_t duty_cycle = 0

Definition at line 39 of file project/at_start_f413/examples/tmr/pwm_input/src/main.c.

Referenced by main().

◆ frequency

__IO uint32_t frequency = 0

Definition at line 40 of file project/at_start_f413/examples/tmr/pwm_input/src/main.c.

Referenced by main().

◆ ic2value

__IO uint16_t ic2value = 0

Definition at line 40 of file project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c.

Referenced by TMR3_GLOBAL_IRQHandler().

◆ tmr_ic_init_structure

tmr_input_config_type tmr_ic_init_structure

Definition at line 37 of file project/at_start_f413/examples/tmr/pwm_input/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: TMR_pwm_input_dma

Macros | Functions | Variables
TMR_pwm_input_dma
AT32F413_periph_examples

Macros

#define SAMPLING_NUM 1000

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | crm_configuration (void)
configures the different peripheral clocks.
void | gpio_configuration (void)
configure the tmr1 pins.
void | DMA1_Channel2_IRQHandler (void)
int | main (void)
main function.

Variables

tmr_input_config_type tmr_ic_init_structure
dma_init_type dma_init_structure
__IO uint16_t | buffer_ch1 [1000]
__IO uint16_t | buffer_ch2 [1000]
__IO uint32_t | frequency = 0
__IO float | duty_cycle = 0
uint32_t | freq_result
float | duty_result

Detailed Description

Macro Definition Documentation

◆ SAMPLING_NUM

#define SAMPLING_NUM 1000

Definition at line 38 of file project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c.

Referenced by DMA1_Channel2_IRQHandler(), and main().

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/tmr/pwm_input_dma/src/at32f413_int.c.

◆ crm_configuration()

void crm_configuration ( void )

configures the different peripheral clocks.

Parameters
none
Return values
none

Definition at line 99 of file project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c.

Referenced by main().

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/tmr/pwm_input_dma/src/at32f413_int.c.

◆ DMA1_Channel2_IRQHandler()

void DMA1_Channel2_IRQHandler ( void )

< dma1 channel2 full data transfer flag

Definition at line 55 of file project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c.

◆ gpio_configuration()

void gpio_configuration ( void )

configure the tmr1 pins.

Parameters
none
Return values
none

< gpio pins number 8

Definition at line 80 of file project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c.

Referenced by main().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/tmr/pwm_input_dma/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< dma full data transfer interrupt

Definition at line 116 of file project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/tmr/pwm_input_dma/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/tmr/pwm_input_dma/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/tmr/pwm_input_dma/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/tmr/pwm_input_dma/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/tmr/pwm_input_dma/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/tmr/pwm_input_dma/src/at32f413_int.c.

Variable Documentation

◆ buffer_ch1

__IO uint16_t buffer_ch1[1000]

Definition at line 43 of file project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c.

Referenced by DMA1_Channel2_IRQHandler(), and main().

◆ buffer_ch2

__IO uint16_t buffer_ch2[1000]

Definition at line 44 of file project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c.

Referenced by DMA1_Channel2_IRQHandler(), and main().

◆ dma_init_structure

dma_init_type dma_init_structure

Definition at line 41 of file project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c.

Referenced by main().

◆ duty_cycle

__IO float duty_cycle = 0

Definition at line 47 of file project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c.

Referenced by DMA1_Channel2_IRQHandler(), and TMR3_GLOBAL_IRQHandler().

◆ duty_result

float duty_result

Definition at line 50 of file project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c.

Referenced by DMA1_Channel2_IRQHandler().

◆ freq_result

uint32_t freq_result

Definition at line 49 of file project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c.

Referenced by DMA1_Channel2_IRQHandler().

◆ frequency

__IO uint32_t frequency = 0

Definition at line 46 of file project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c.

Referenced by DMA1_Channel2_IRQHandler(), and TMR3_GLOBAL_IRQHandler().

◆ tmr_ic_init_structure

tmr_input_config_type tmr_ic_init_structure

Definition at line 40 of file project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: TMR_pwm_output_simulate

Functions | Variables
TMR_pwm_output_simulate
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | TMR2_GLOBAL_IRQHandler (void)
void | crm_configuration (void)
configures the different peripheral clocks.
void | gpio_configuration (void)
configure the tmr1 pins.
int | main (void)
main function.

Variables

uint16_t | capture = 0
tmr_output_config_type tmr_oc_init_structure
uint16_t | ch1_val = 40961
uint16_t | ch2_val = 27309
uint16_t | ch3_val = 13654
uint16_t | ch4_val = 6826
uint16_t | div_value = 0

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 84 of file project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c.

◆ crm_configuration()

void crm_configuration ( void )

configures the different peripheral clocks.

Parameters
none
Return values
none

Definition at line 72 of file project/at_start_f413/examples/tmr/pwm_output_simulate/src/main.c.

Referenced by main().

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 119 of file project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c.

◆ gpio_configuration()

void gpio_configuration ( void )

configure the tmr1 pins.

Parameters
none
Return values
none

< gpio pins number 6

< gpio pins number 7

< gpio pins number 8

< gpio pins number 9

Definition at line 53 of file project/at_start_f413/examples/tmr/pwm_output_simulate/src/main.c.

Referenced by main().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 58 of file project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< tmr interrupt channel 1

< tmr interrupt channel 2

< tmr interrupt channel 3

< tmr interrupt channel 4

Definition at line 86 of file project/at_start_f413/examples/tmr/pwm_output_simulate/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 71 of file project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 49 of file project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 128 of file project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 110 of file project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 137 of file project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c.

◆ TMR2_GLOBAL_IRQHandler()

void TMR2_GLOBAL_IRQHandler ( void )

< tmr flag channel 1

< tmr flag channel 1

< gpio pins number 6

< gpio pins number 6

< tmr flag channel 2

< tmr flag channel 2

< gpio pins number 7

< gpio pins number 7

< tmr flag channel 3

< tmr flag channel 3

< gpio pins number 8

< gpio pins number 8

< tmr flag channel 4

< gpio pins number 9

< gpio pins number 9

Definition at line 141 of file project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 97 of file project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c.

Variable Documentation

◆ capture

uint16_t capture = 0

Definition at line 42 of file project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c.

Referenced by TMR2_GLOBAL_IRQHandler().

◆ ch1_val

uint16_t ch1_val = 40961

Definition at line 39 of file project/at_start_f413/examples/tmr/pwm_output_simulate/src/main.c.

Referenced by main().

◆ ch2_val

uint16_t ch2_val = 27309

Definition at line 40 of file project/at_start_f413/examples/tmr/pwm_output_simulate/src/main.c.

Referenced by main().

◆ ch3_val

uint16_t ch3_val = 13654

Definition at line 41 of file project/at_start_f413/examples/tmr/pwm_output_simulate/src/main.c.

Referenced by main().

◆ ch4_val

uint16_t ch4_val = 6826

Definition at line 42 of file project/at_start_f413/examples/tmr/pwm_output_simulate/src/main.c.

Referenced by main().

◆ div_value

uint16_t div_value = 0

Definition at line 43 of file project/at_start_f413/examples/tmr/pwm_output_simulate/src/main.c.

Referenced by main().

◆ tmr_oc_init_structure

tmr_output_config_type tmr_oc_init_structure

Definition at line 37 of file project/at_start_f413/examples/tmr/pwm_output_simulate/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: TMR_pwm_output_tmr10

Functions | Variables
TMR_pwm_output_tmr10
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | crm_configuration (void)
configures the different peripheral clocks.
void | gpio_configuration (void)
configure the tmr1 pins.
int | main (void)
main function.

Variables

tmr_output_config_type tmr_oc_init_structure
uint16_t | ch1_val = 250
uint16_t | div_value = 0

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/tmr/pwm_output_tmr10/src/at32f413_int.c.

◆ crm_configuration()

void crm_configuration ( void )

configures the different peripheral clocks.

Parameters
none
Return values
none

Definition at line 69 of file project/at_start_f413/examples/tmr/pwm_output_tmr10/src/main.c.

Referenced by main().

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/tmr/pwm_output_tmr10/src/at32f413_int.c.

◆ gpio_configuration()

void gpio_configuration ( void )

configure the tmr1 pins.

Parameters
none
Return values
none

< gpio pins number 8

Definition at line 50 of file project/at_start_f413/examples/tmr/pwm_output_tmr10/src/main.c.

Referenced by main().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/tmr/pwm_output_tmr10/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 83 of file project/at_start_f413/examples/tmr/pwm_output_tmr10/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/tmr/pwm_output_tmr10/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/tmr/pwm_output_tmr10/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/tmr/pwm_output_tmr10/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/tmr/pwm_output_tmr10/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/tmr/pwm_output_tmr10/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/tmr/pwm_output_tmr10/src/at32f413_int.c.

Variable Documentation

◆ ch1_val

uint16_t ch1_val = 250

Definition at line 39 of file project/at_start_f413/examples/tmr/pwm_output_tmr10/src/main.c.

Referenced by main().

◆ div_value

uint16_t div_value = 0

Definition at line 40 of file project/at_start_f413/examples/tmr/pwm_output_tmr10/src/main.c.

Referenced by main().

◆ tmr_oc_init_structure

tmr_output_config_type tmr_oc_init_structure

Definition at line 37 of file project/at_start_f413/examples/tmr/pwm_output_tmr10/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: TMR_pwm_output_tmr3

Functions | Variables
TMR_pwm_output_tmr3
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | crm_configuration (void)
configures the different peripheral clocks.
void | gpio_configuration (void)
configure the tmr3 pins.
int | main (void)
main function.

Variables

tmr_output_config_type tmr_oc_init_structure
uint16_t | ch1_val = 333
uint16_t | ch2_val = 249
uint16_t | ch3_val = 166
uint16_t | ch4_val = 83
uint16_t | div_value = 0

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/src/at32f413_int.c.

◆ crm_configuration()

void crm_configuration ( void )

configures the different peripheral clocks.

Parameters
none
Return values
none

Definition at line 75 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/src/main.c.

Referenced by main().

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/src/at32f413_int.c.

◆ gpio_configuration()

void gpio_configuration ( void )

configure the tmr3 pins.

Parameters
none
Return values
none

< gpio pins number 6

< gpio pins number 7

< gpio pins number 0

< gpio pins number 1

Definition at line 53 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/src/main.c.

Referenced by main().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/src/at32f413_int.c.

Variable Documentation

◆ ch1_val

uint16_t ch1_val = 333

Definition at line 39 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/src/main.c.

Referenced by main().

◆ ch2_val

uint16_t ch2_val = 249

Definition at line 40 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/src/main.c.

Referenced by main().

◆ ch3_val

uint16_t ch3_val = 166

Definition at line 41 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/src/main.c.

Referenced by main().

◆ ch4_val

uint16_t ch4_val = 83

Definition at line 42 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/src/main.c.

Referenced by main().

◆ div_value

uint16_t div_value = 0

Definition at line 43 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/src/main.c.

Referenced by main().

◆ tmr_oc_init_structure

tmr_output_config_type tmr_oc_init_structure

Definition at line 37 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: TMR_timer_base

Functions | Variables
TMR_timer_base
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | clkout_config (void)
void | TMR1_OVF_TMR10_IRQHandler (void)
this function handles timer1 overflow handler.
int | main (void)
main function.

Variables

crm_clocks_freq_type crm_clocks_freq_struct = {0}

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/tmr/timer_base/src/at32f413_int.c.

◆ clkout_config()

void clkout_config ( void )

< gpio pins number 8

Definition at line 39 of file project/at_start_f413/examples/tmr/timer_base/src/main.c.

Referenced by main().

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/tmr/timer_base/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/tmr/timer_base/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< tmr interrupt overflow

Definition at line 84 of file project/at_start_f413/examples/tmr/timer_base/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/tmr/timer_base/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/tmr/timer_base/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/tmr/timer_base/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/tmr/timer_base/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/tmr/timer_base/src/at32f413_int.c.

◆ TMR1_OVF_TMR10_IRQHandler()

void TMR1_OVF_TMR10_IRQHandler ( void )

this function handles timer1 overflow handler.

Parameters
none
Return values
none

< tmr flag overflow

< tmr flag overflow

Definition at line 69 of file project/at_start_f413/examples/tmr/timer_base/src/main.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/tmr/timer_base/src/at32f413_int.c.

Variable Documentation

◆ crm_clocks_freq_struct

crm_clocks_freq_type crm_clocks_freq_struct = {0}

Definition at line 37 of file project/at_start_f413/examples/tmr/timer_base/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: TMR_tmr1_synchro

Functions | Variables
TMR_tmr1_synchro
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | crm_configuration (void)
configures the different peripheral clocks.
void | gpio_configuration (void)
configure the tmr1 pins.
int | main (void)
main function.

Variables

tmr_output_config_type tmr_oc_init_structure

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/tmr/tmr1_synchro/src/at32f413_int.c.

◆ crm_configuration()

void crm_configuration ( void )

configures the different peripheral clocks.

Parameters
none
Return values
none

Definition at line 69 of file project/at_start_f413/examples/tmr/tmr1_synchro/src/main.c.

Referenced by main().

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/tmr/tmr1_synchro/src/at32f413_int.c.

◆ gpio_configuration()

void gpio_configuration ( void )

configure the tmr1 pins.

Parameters
none
Return values
none

< gpio pins number 6

< gpio pins number 8

< gpio pins number 6

Definition at line 47 of file project/at_start_f413/examples/tmr/tmr1_synchro/src/main.c.

Referenced by main().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/tmr/tmr1_synchro/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 86 of file project/at_start_f413/examples/tmr/tmr1_synchro/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/tmr/tmr1_synchro/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/tmr/tmr1_synchro/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/tmr/tmr1_synchro/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/tmr/tmr1_synchro/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/tmr/tmr1_synchro/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/tmr/tmr1_synchro/src/at32f413_int.c.

Variable Documentation

◆ tmr_oc_init_structure

tmr_output_config_type tmr_oc_init_structure

Definition at line 37 of file project/at_start_f413/examples/tmr/tmr1_synchro/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: TMR_tmr2_32bit

Functions | Variables
TMR_tmr2_32bit
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | crm_configuration (void)
configures the different peripheral clocks.
void | gpio_configuration (void)
configure the tmr1 pins.
int | main (void)
main function.

Variables

tmr_output_config_type tmr_oc_init_structure
uint32_t | ch1_val = 0x7FFFF
uint32_t | ch2_val = 0x3FFFF
uint32_t | ch3_val = 0x1FFFF
uint32_t | ch4_val = 0xFFFF

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/tmr/tmr2_32bit/src/at32f413_int.c.

◆ crm_configuration()

void crm_configuration ( void )

configures the different peripheral clocks.

Parameters
none
Return values
none

Definition at line 71 of file project/at_start_f413/examples/tmr/tmr2_32bit/src/main.c.

Referenced by main().

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/tmr/tmr2_32bit/src/at32f413_int.c.

◆ gpio_configuration()

void gpio_configuration ( void )

configure the tmr1 pins.

Parameters
none
Return values
none

< gpio pins number 0

< gpio pins number 1

< gpio pins number 2

< gpio pins number 3

Definition at line 52 of file project/at_start_f413/examples/tmr/tmr2_32bit/src/main.c.

Referenced by main().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/tmr/tmr2_32bit/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 85 of file project/at_start_f413/examples/tmr/tmr2_32bit/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/tmr/tmr2_32bit/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/tmr/tmr2_32bit/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/tmr/tmr2_32bit/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/tmr/tmr2_32bit/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/tmr/tmr2_32bit/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/tmr/tmr2_32bit/src/at32f413_int.c.

Variable Documentation

◆ ch1_val

uint32_t ch1_val = 0x7FFFF

Definition at line 39 of file project/at_start_f413/examples/tmr/tmr2_32bit/src/main.c.

Referenced by main(), TMR1_BRK_TMR9_IRQHandler(), TMR2_GLOBAL_IRQHandler(), and TMR3_GLOBAL_IRQHandler().

◆ ch2_val

uint32_t ch2_val = 0x3FFFF

Definition at line 40 of file project/at_start_f413/examples/tmr/tmr2_32bit/src/main.c.

Referenced by main(), TMR1_BRK_TMR9_IRQHandler(), TMR2_GLOBAL_IRQHandler(), and TMR3_GLOBAL_IRQHandler().

◆ ch3_val

uint32_t ch3_val = 0x1FFFF

Definition at line 41 of file project/at_start_f413/examples/tmr/tmr2_32bit/src/main.c.

Referenced by main(), TMR2_GLOBAL_IRQHandler(), and TMR3_GLOBAL_IRQHandler().

◆ ch4_val

uint32_t ch4_val = 0xFFFF

Definition at line 42 of file project/at_start_f413/examples/tmr/tmr2_32bit/src/main.c.

Referenced by main(), TMR2_GLOBAL_IRQHandler(), and TMR3_GLOBAL_IRQHandler().

◆ tmr_oc_init_structure

tmr_output_config_type tmr_oc_init_structure

Definition at line 37 of file project/at_start_f413/examples/tmr/tmr2_32bit/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: USART_half_duplex

Macros | Functions | Variables
USART_half_duplex
AT32F413_periph_examples

Macros

#define | COUNTOF(a)
#define | USART2_TX_BUFFER_SIZE (COUNTOF(usart2_tx_buffer) - 1)
#define | USART3_TX_BUFFER_SIZE (COUNTOF(usart3_tx_buffer) - 1)

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | usart_configuration (void)
config usart
uint8_t | buffer_compare (uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t buffer_length)
compares two buffers.
int | main (void)
main function.

Variables

uint8_t | usart2_tx_buffer [] = "usart half-duplex transfer: usart2 -> usart3"
uint8_t | usart3_tx_buffer [] = "usart half-duplex transfer: usart3 -> usart2"
uint8_t | usart2_rx_buffer [((sizeof(usart3_tx_buffer)/sizeof(*(usart3_tx_buffer))) - 1)]
uint8_t | usart3_rx_buffer [((sizeof(usart2_tx_buffer)/sizeof(*(usart2_tx_buffer))) - 1)]
uint8_t | data_count

Detailed Description

Macro Definition Documentation

◆ COUNTOF

#define COUNTOF ( a )
Value:
(sizeof(a) / sizeof(*(a)))

Definition at line 37 of file project/at_start_f413/examples/usart/half_duplex/src/main.c.

◆ USART2_TX_BUFFER_SIZE

#define USART2_TX_BUFFER_SIZE (COUNTOF(usart2_tx_buffer) - 1)

Definition at line 38 of file project/at_start_f413/examples/usart/half_duplex/src/main.c.

Referenced by main().

◆ USART3_TX_BUFFER_SIZE

#define USART3_TX_BUFFER_SIZE (COUNTOF(usart3_tx_buffer) - 1)

Definition at line 39 of file project/at_start_f413/examples/usart/half_duplex/src/main.c.

Referenced by main().

Function Documentation

◆ buffer_compare()

uint8_t buffer_compare | ( | uint8_t * | pbuffer1,
 |  | uint8_t * | pbuffer2,
 |  | uint16_t | buffer_length )

compares two buffers.

Parameters
pbuffer1,pbuffer2 | buffers to be compared.
buffer_length | buffer's length
Return values
1 pbuffer1 identical to pbuffer2 0: pbuffer1 differs from pbuffer2

Definition at line 100 of file project/at_start_f413/examples/usart/half_duplex/src/main.c.

Referenced by main().

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/usart/half_duplex/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/usart/half_duplex/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/usart/half_duplex/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< usart transmit data buffer empty flag

< usart receive data buffer full flag

< usart transmit data buffer empty flag

< usart receive data buffer full flag

Definition at line 119 of file project/at_start_f413/examples/usart/half_duplex/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/usart/half_duplex/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/usart/half_duplex/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/usart/half_duplex/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/usart/half_duplex/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/usart/half_duplex/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/usart/half_duplex/src/at32f413_int.c.

◆ usart_configuration()

void usart_configuration ( void )

config usart

Parameters
none
Return values
none

< gpio pins number 2

< gpio pins number 10

Definition at line 52 of file project/at_start_f413/examples/usart/half_duplex/src/main.c.

Referenced by main().

Variable Documentation

◆ data_count

uint8_t data_count

Definition at line 45 of file project/at_start_f413/examples/usart/half_duplex/src/main.c.

Referenced by main().

◆ usart2_rx_buffer

uint8_t usart2_rx_buffer[((sizeof(usart3_tx_buffer)/sizeof(*(usart3_tx_buffer))) - 1)]

Definition at line 43 of file project/at_start_f413/examples/usart/half_duplex/src/main.c.

Referenced by main().

◆ usart2_tx_buffer

uint8_t usart2_tx_buffer[] = "usart half-duplex transfer: usart2 -> usart3"

Definition at line 41 of file project/at_start_f413/examples/usart/half_duplex/src/main.c.

Referenced by main().

◆ usart3_rx_buffer

uint8_t usart3_rx_buffer[((sizeof(usart2_tx_buffer)/sizeof(*(usart2_tx_buffer))) - 1)]

Definition at line 44 of file project/at_start_f413/examples/usart/half_duplex/src/main.c.

Referenced by main().

◆ usart3_tx_buffer

uint8_t usart3_tx_buffer[] = "usart half-duplex transfer: usart3 -> usart2"

Definition at line 42 of file project/at_start_f413/examples/usart/half_duplex/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: USART_hw_flow_control

Macros | Functions | Variables
USART_hw_flow_control
AT32F413_periph_examples

Macros

#define BUFFER_SIZE 16

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | usart_configuration (void)
config usart
int | main (void)
main function.

Variables

uint8_t | rx_buffer [16]
uint8_t | data_count

Detailed Description

Macro Definition Documentation

◆ BUFFER_SIZE

#define BUFFER_SIZE 16

Definition at line 37 of file project/at_start_f413/examples/usart/hw_flow_control/src/main.c.

Referenced by main().

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/usart/hw_flow_control/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/usart/hw_flow_control/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/usart/hw_flow_control/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< usart receive data buffer full flag

< usart transmit data buffer empty flag

Definition at line 86 of file project/at_start_f413/examples/usart/hw_flow_control/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/usart/hw_flow_control/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/usart/hw_flow_control/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/usart/hw_flow_control/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/usart/hw_flow_control/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/usart/hw_flow_control/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/usart/hw_flow_control/src/at32f413_int.c.

◆ usart_configuration()

void usart_configuration ( void )

config usart

Parameters
none
Return values
none

< gpio pins number 2

< gpio pins number 1

< gpio pins number 3

< gpio pins number 0

Definition at line 47 of file project/at_start_f413/examples/usart/hw_flow_control/src/main.c.

Referenced by main().

Variable Documentation

◆ data_count

uint8_t data_count

Definition at line 40 of file project/at_start_f413/examples/usart/hw_flow_control/src/main.c.

Referenced by main().

◆ rx_buffer

uint8_t rx_buffer[16]

Definition at line 39 of file project/at_start_f413/examples/usart/hw_flow_control/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: USART_idle_detection

Functions
USART_idle_detection
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | USART2_IRQHandler (void)
this function handles usart2 handler.
void | usart_configuration (void)
config usart
int | main (void)
main function.

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 78 of file project/at_start_f413/examples/usart/idle_detection/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 113 of file project/at_start_f413/examples/usart/idle_detection/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 52 of file project/at_start_f413/examples/usart/idle_detection/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< usart transmit data buffer empty flag

< usart receive data buffer full flag

Definition at line 85 of file project/at_start_f413/examples/usart/idle_detection/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 65 of file project/at_start_f413/examples/usart/idle_detection/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 43 of file project/at_start_f413/examples/usart/idle_detection/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 122 of file project/at_start_f413/examples/usart/idle_detection/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 104 of file project/at_start_f413/examples/usart/idle_detection/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 131 of file project/at_start_f413/examples/usart/idle_detection/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 91 of file project/at_start_f413/examples/usart/idle_detection/src/at32f413_int.c.

◆ USART2_IRQHandler()

void USART2_IRQHandler ( void )

this function handles usart2 handler.

Parameters
none
Return values
none

< usart idle flag

Definition at line 140 of file project/at_start_f413/examples/usart/idle_detection/src/at32f413_int.c.

◆ usart_configuration()

void usart_configuration ( void )

config usart

Parameters
none
Return values
none

< gpio pins number 2

< gpio pins number 3

< usart idle interrupt

Definition at line 42 of file project/at_start_f413/examples/usart/idle_detection/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: USART_interrupt

Macros | Functions | Variables
USART_interrupt
AT32F413_periph_examples

Macros

#define | COUNTOF(a)
#define | USART2_TX_BUFFER_SIZE (COUNTOF(usart2_tx_buffer) - 1)
#define | USART3_TX_BUFFER_SIZE (COUNTOF(usart3_tx_buffer) - 1)

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | USART2_IRQHandler (void)
this function handles usart2 handler.
void | USART3_IRQHandler (void)
this function handles usart3 handler.
void | usart_configuration (void)
config usart
uint8_t | buffer_compare (uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t buffer_length)
compares two buffers.
int | main (void)
main function.

Variables

uint8_t | usart2_tx_buffer [] = "usart transfer by interrupt: usart2 -> usart3 using interrupt"
uint8_t | usart3_tx_buffer [] = "usart transfer by interrupt: usart3 -> usart2 using interrupt"
uint8_t | usart2_rx_buffer [((sizeof(usart3_tx_buffer)/sizeof(*(usart3_tx_buffer))) - 1)]
uint8_t | usart3_rx_buffer [((sizeof(usart2_tx_buffer)/sizeof(*(usart2_tx_buffer))) - 1)]
volatile uint8_t | usart2_tx_counter = 0x00
volatile uint8_t | usart3_tx_counter = 0x00
volatile uint8_t | usart2_rx_counter = 0x00
volatile uint8_t | usart3_rx_counter = 0x00
uint8_t | usart2_tx_buffer_size = ( (sizeof(usart2_tx_buffer) / sizeof(*(usart2_tx_buffer))) - 1)
uint8_t | usart3_tx_buffer_size = ( (sizeof(usart3_tx_buffer) / sizeof(*(usart3_tx_buffer))) - 1)

Detailed Description

Macro Definition Documentation

◆ COUNTOF

#define COUNTOF ( a )
Value:
(sizeof(a) / sizeof(*(a)))

Definition at line 37 of file project/at_start_f413/examples/usart/interrupt/src/main.c.

◆ USART2_TX_BUFFER_SIZE

#define USART2_TX_BUFFER_SIZE (COUNTOF(usart2_tx_buffer) - 1)

Definition at line 38 of file project/at_start_f413/examples/usart/interrupt/src/main.c.

Referenced by main().

◆ USART3_TX_BUFFER_SIZE

#define USART3_TX_BUFFER_SIZE (COUNTOF(usart3_tx_buffer) - 1)

Definition at line 39 of file project/at_start_f413/examples/usart/interrupt/src/main.c.

Referenced by main().

Function Documentation

◆ buffer_compare()

uint8_t buffer_compare | ( | uint8_t * | pbuffer1,
 |  | uint8_t * | pbuffer2,
 |  | uint16_t | buffer_length )

compares two buffers.

Parameters
pbuffer1,pbuffer2 | buffers to be compared.
buffer_length | buffer's length
Return values
1 pbuffer1 identical to pbuffer2 0: pbuffer1 differs from pbuffer2

Definition at line 128 of file project/at_start_f413/examples/usart/interrupt/src/main.c.

Referenced by main().

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 88 of file project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 123 of file project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 62 of file project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 147 of file project/at_start_f413/examples/usart/interrupt/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 75 of file project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 53 of file project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 132 of file project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 114 of file project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 141 of file project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 101 of file project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c.

◆ USART2_IRQHandler()

void USART2_IRQHandler ( void )

this function handles usart2 handler.

Parameters
none
Return values
none

< usart receive data buffer full flag

< usart receive data buffer full interrupt

< usart transmit data buffer empty flag

< usart transmit data buffer empty interrupt

Definition at line 150 of file project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c.

◆ USART3_IRQHandler()

void USART3_IRQHandler ( void )

this function handles usart3 handler.

Parameters
none
Return values
none

< usart receive data buffer full flag

< usart receive data buffer full interrupt

< usart transmit data buffer empty flag

< usart transmit data buffer empty interrupt

Definition at line 182 of file project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c.

◆ usart_configuration()

void usart_configuration ( void )

config usart

Parameters
none
Return values
none

< gpio pins number 2

< gpio pins number 10

< gpio pins number 3

< gpio pins number 11

< usart receive data buffer full interrupt

< usart receive data buffer full interrupt

< usart transmit data buffer empty interrupt

< usart transmit data buffer empty interrupt

Definition at line 57 of file project/at_start_f413/examples/usart/interrupt/src/main.c.

Referenced by main().

Variable Documentation

◆ usart2_rx_buffer

uint8_t usart2_rx_buffer[((sizeof(usart3_tx_buffer)/sizeof(*(usart3_tx_buffer))) - 1)]

Definition at line 43 of file project/at_start_f413/examples/usart/interrupt/src/main.c.

Referenced by main().

◆ usart2_rx_counter

volatile uint8_t usart2_rx_counter = 0x00

Definition at line 47 of file project/at_start_f413/examples/usart/interrupt/src/main.c.

Referenced by main().

◆ usart2_tx_buffer

uint8_t usart2_tx_buffer[] = "usart transfer by interrupt: usart2 -> usart3 using interrupt"

Definition at line 41 of file project/at_start_f413/examples/usart/interrupt/src/main.c.

Referenced by main().

◆ usart2_tx_buffer_size

uint8_t usart2_tx_buffer_size = ( (sizeof(usart2_tx_buffer) / sizeof(*(usart2_tx_buffer))) - 1)

Definition at line 49 of file project/at_start_f413/examples/usart/interrupt/src/main.c.

Referenced by main().

◆ usart2_tx_counter

volatile uint8_t usart2_tx_counter = 0x00

Definition at line 45 of file project/at_start_f413/examples/usart/interrupt/src/main.c.

◆ usart3_rx_buffer

uint8_t usart3_rx_buffer[((sizeof(usart2_tx_buffer)/sizeof(*(usart2_tx_buffer))) - 1)]

Definition at line 44 of file project/at_start_f413/examples/usart/interrupt/src/main.c.

Referenced by main().

◆ usart3_rx_counter

volatile uint8_t usart3_rx_counter = 0x00

Definition at line 48 of file project/at_start_f413/examples/usart/interrupt/src/main.c.

Referenced by main().

◆ usart3_tx_buffer

uint8_t usart3_tx_buffer[] = "usart transfer by interrupt: usart3 -> usart2 using interrupt"

Definition at line 42 of file project/at_start_f413/examples/usart/interrupt/src/main.c.

Referenced by main().

◆ usart3_tx_buffer_size

uint8_t usart3_tx_buffer_size = ( (sizeof(usart3_tx_buffer) / sizeof(*(usart3_tx_buffer))) - 1)

Definition at line 50 of file project/at_start_f413/examples/usart/interrupt/src/main.c.

Referenced by main().

◆ usart3_tx_counter

volatile uint8_t usart3_tx_counter = 0x00

Definition at line 46 of file project/at_start_f413/examples/usart/interrupt/src/main.c.


AT32F413 Firmwary Library: USART_irda

Functions
USART_irda
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | usart_configuration (void)
config usart
int | main (void)
main function.

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/usart/irda/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/usart/irda/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/usart/irda/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 82 of file project/at_start_f413/examples/usart/irda/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/usart/irda/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/usart/irda/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/usart/irda/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/usart/irda/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/usart/irda/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/usart/irda/src/at32f413_int.c.

◆ usart_configuration()

void usart_configuration ( void )

config usart

Parameters
none
Return values
none

< gpio pins number 2

< gpio pins number 3

Definition at line 42 of file project/at_start_f413/examples/usart/irda/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: USART_polling

Macros | Functions | Variables
USART_polling
AT32F413_periph_examples

Macros

#define | COUNTOF(a)
#define | USART2_TX_BUFFER_SIZE (COUNTOF(usart2_tx_buffer) - 1)
#define | USART3_TX_BUFFER_SIZE (COUNTOF(usart3_tx_buffer) - 1)

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | usart_configuration (void)
config usart
uint8_t | buffer_compare (uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t buffer_length)
compares two buffers.
int | main (void)
main function.

Variables

uint8_t | usart2_tx_buffer [] = "usart transfer by interrupt: usart2 -> usart3 using interrupt"
uint8_t | usart3_tx_buffer [] = "usart transfer by interrupt: usart3 -> usart2 using interrupt"
uint8_t | usart2_rx_buffer [((sizeof(usart3_tx_buffer)/sizeof(*(usart3_tx_buffer))) - 1)]
uint8_t | usart3_rx_buffer [((sizeof(usart2_tx_buffer)/sizeof(*(usart2_tx_buffer))) - 1)]
uint8_t | usart2_tx_counter = 0x00
uint8_t | usart3_tx_counter = 0x00
uint8_t | usart2_rx_counter = 0x00
uint8_t | usart3_rx_counter = 0x00
uint8_t | usart2_tx_buffer_size = ( (sizeof(usart2_tx_buffer) / sizeof(*(usart2_tx_buffer))) - 1)
uint8_t | usart3_tx_buffer_size = ( (sizeof(usart3_tx_buffer) / sizeof(*(usart3_tx_buffer))) - 1)

Detailed Description

Macro Definition Documentation

◆ COUNTOF

#define COUNTOF ( a )
Value:
(sizeof(a) / sizeof(*(a)))

Definition at line 37 of file project/at_start_f413/examples/usart/polling/src/main.c.

◆ USART2_TX_BUFFER_SIZE

#define USART2_TX_BUFFER_SIZE (COUNTOF(usart2_tx_buffer) - 1)

Definition at line 38 of file project/at_start_f413/examples/usart/polling/src/main.c.

Referenced by main().

◆ USART3_TX_BUFFER_SIZE

#define USART3_TX_BUFFER_SIZE (COUNTOF(usart3_tx_buffer) - 1)

Definition at line 39 of file project/at_start_f413/examples/usart/polling/src/main.c.

Referenced by main().

Function Documentation

◆ buffer_compare()

uint8_t buffer_compare | ( | uint8_t * | pbuffer1,
 |  | uint8_t * | pbuffer2,
 |  | uint16_t | buffer_length )

compares two buffers.

Parameters
pbuffer1,pbuffer2 | buffers to be compared.
buffer_length | buffer's length
Return values
1 pbuffer1 identical to pbuffer2 0: pbuffer1 differs from pbuffer2

Definition at line 117 of file project/at_start_f413/examples/usart/polling/src/main.c.

Referenced by main().

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/usart/polling/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/usart/polling/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/usart/polling/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< usart transmit data buffer empty flag

< usart receive data buffer full flag

< usart transmit data buffer empty flag

< usart receive data buffer full flag

Definition at line 136 of file project/at_start_f413/examples/usart/polling/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/usart/polling/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/usart/polling/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/usart/polling/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/usart/polling/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/usart/polling/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/usart/polling/src/at32f413_int.c.

◆ usart_configuration()

void usart_configuration ( void )

config usart

Parameters
none
Return values
none

< gpio pins number 2

< gpio pins number 10

< gpio pins number 3

< gpio pins number 11

Definition at line 57 of file project/at_start_f413/examples/usart/polling/src/main.c.

Referenced by main().

Variable Documentation

◆ usart2_rx_buffer

uint8_t usart2_rx_buffer[((sizeof(usart3_tx_buffer)/sizeof(*(usart3_tx_buffer))) - 1)]

Definition at line 43 of file project/at_start_f413/examples/usart/polling/src/main.c.

Referenced by main().

◆ usart2_rx_counter

uint8_t usart2_rx_counter = 0x00

Definition at line 47 of file project/at_start_f413/examples/usart/polling/src/main.c.

Referenced by main().

◆ usart2_tx_buffer

uint8_t usart2_tx_buffer[] = "usart transfer by interrupt: usart2 -> usart3 using interrupt"

Definition at line 41 of file project/at_start_f413/examples/usart/polling/src/main.c.

Referenced by main().

◆ usart2_tx_buffer_size

uint8_t usart2_tx_buffer_size = ( (sizeof(usart2_tx_buffer) / sizeof(*(usart2_tx_buffer))) - 1)

Definition at line 49 of file project/at_start_f413/examples/usart/polling/src/main.c.

Referenced by main().

◆ usart2_tx_counter

uint8_t usart2_tx_counter = 0x00

Definition at line 45 of file project/at_start_f413/examples/usart/polling/src/main.c.

Referenced by main().

◆ usart3_rx_buffer

uint8_t usart3_rx_buffer[((sizeof(usart2_tx_buffer)/sizeof(*(usart2_tx_buffer))) - 1)]

Definition at line 44 of file project/at_start_f413/examples/usart/polling/src/main.c.

Referenced by main().

◆ usart3_rx_counter

uint8_t usart3_rx_counter = 0x00

Definition at line 48 of file project/at_start_f413/examples/usart/polling/src/main.c.

Referenced by main(), and USART3_IRQHandler().

◆ usart3_tx_buffer

uint8_t usart3_tx_buffer[] = "usart transfer by interrupt: usart3 -> usart2 using interrupt"

Definition at line 42 of file project/at_start_f413/examples/usart/polling/src/main.c.

Referenced by main().

◆ usart3_tx_buffer_size

uint8_t usart3_tx_buffer_size = ( (sizeof(usart3_tx_buffer) / sizeof(*(usart3_tx_buffer))) - 1)

Definition at line 50 of file project/at_start_f413/examples/usart/polling/src/main.c.

Referenced by main(), USART2_IRQHandler(), and USART3_IRQHandler().

◆ usart3_tx_counter

uint8_t usart3_tx_counter = 0x00

Definition at line 46 of file project/at_start_f413/examples/usart/polling/src/main.c.

Referenced by main(), and USART3_IRQHandler().


AT32F413 Firmwary Library: USART_printf

Functions | Variables
USART_printf
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
int | main (void)
main function.

Variables

__IO uint32_t time_cnt = 0

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/usart/printf/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/usart/printf/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/usart/printf/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 44 of file project/at_start_f413/examples/usart/printf/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/usart/printf/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/usart/printf/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/usart/printf/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/usart/printf/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/usart/printf/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/usart/printf/src/at32f413_int.c.

Variable Documentation

◆ time_cnt

__IO uint32_t time_cnt = 0

Definition at line 37 of file project/at_start_f413/examples/usart/printf/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: USART_receiver_mute

Macros | Functions | Variables
USART_receiver_mute
AT32F413_periph_examples

Macros

#define | BUFFER_SIZE 7
#define | MATCH_ID_VAL 0x81
#define | ERROR_ID_VAL 0x82
#define | DATA1_VAL 0x7F
#define | DATA2_VAL 0x7A
#define | DATA3_VAL 0x7B
#define | DATA4_VAL 0x7C

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | USART3_IRQHandler (void)
this function handles usart3 handler.
void | usart_configuration (void)
config usart
int | main (void)
main function.

Variables

uint8_t | usart2_tx_buffer [7] = { 0x7F , 0x81 , 0x7A , 0x82 , 0x7B , 0x81 , 0x7C }
uint8_t | usart3_rx_buffer [7]
uint8_t | tx_counter = 0
uint8_t | rx_counter = 0

Detailed Description

Macro Definition Documentation

◆ BUFFER_SIZE

#define BUFFER_SIZE 7

Definition at line 37 of file project/at_start_f413/examples/usart/receiver_mute/src/main.c.

Referenced by main().

◆ DATA1_VAL

#define DATA1_VAL 0x7F

Definition at line 40 of file project/at_start_f413/examples/usart/receiver_mute/src/main.c.

◆ DATA2_VAL

#define DATA2_VAL 0x7A

Definition at line 41 of file project/at_start_f413/examples/usart/receiver_mute/src/main.c.

Referenced by main().

◆ DATA3_VAL

#define DATA3_VAL 0x7B

Definition at line 42 of file project/at_start_f413/examples/usart/receiver_mute/src/main.c.

◆ DATA4_VAL

#define DATA4_VAL 0x7C

Definition at line 43 of file project/at_start_f413/examples/usart/receiver_mute/src/main.c.

Referenced by main().

◆ ERROR_ID_VAL

#define ERROR_ID_VAL 0x82

Definition at line 39 of file project/at_start_f413/examples/usart/receiver_mute/src/main.c.

◆ MATCH_ID_VAL

#define MATCH_ID_VAL 0x81

Definition at line 38 of file project/at_start_f413/examples/usart/receiver_mute/src/main.c.

Referenced by main().

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 80 of file project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 115 of file project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 54 of file project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< usart transmit data buffer empty flag

< usart transmit data complete flag

Definition at line 109 of file project/at_start_f413/examples/usart/receiver_mute/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 67 of file project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 45 of file project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 124 of file project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 106 of file project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 133 of file project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 93 of file project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c.

◆ USART3_IRQHandler()

void USART3_IRQHandler ( void )

this function handles usart3 handler.

Parameters
none
Return values
none

< usart receive data buffer full flag

Definition at line 142 of file project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c.

◆ usart_configuration()

void usart_configuration ( void )

config usart

Parameters
none
Return values
none

< gpio pins number 2

< gpio pins number 11

< usart receive data buffer full interrupt

Definition at line 55 of file project/at_start_f413/examples/usart/receiver_mute/src/main.c.

Referenced by main().

Variable Documentation

◆ rx_counter

uint8_t rx_counter = 0

Definition at line 48 of file project/at_start_f413/examples/usart/receiver_mute/src/main.c.

Referenced by USART3_IRQHandler().

◆ tx_counter

uint8_t tx_counter = 0

Definition at line 47 of file project/at_start_f413/examples/usart/receiver_mute/src/main.c.

Referenced by main().

◆ usart2_tx_buffer

uint8_t usart2_tx_buffer[7] = { 0x7F , 0x81 , 0x7A , 0x82 , 0x7B , 0x81 , 0x7C }

Definition at line 45 of file project/at_start_f413/examples/usart/receiver_mute/src/main.c.

Referenced by main().

◆ usart3_rx_buffer

uint8_t usart3_rx_buffer[7]

Definition at line 46 of file project/at_start_f413/examples/usart/receiver_mute/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: F413_USART_rs485

Macros | Functions | Variables
F413_USART_rs485
AT32F413_periph_examples

Macros

#define | RS485_BAUDRATE 9600
#define | RS485_BUFFER_SIZE 128

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
static void | rs485_config (void)
rs485 configiguration.
static void | rs485_send_data (u8 *buf, u8 cnt)
rs485 send data
int | main (void)
main function.
void | USART2_IRQHandler (void)
usart2 interrupt handler

Variables

uint8_t | rs485_buffer_rx [128]
uint8_t | rs485_buffer_rx_cnt = 0

Detailed Description

Macro Definition Documentation

◆ RS485_BAUDRATE

#define RS485_BAUDRATE 9600

Definition at line 37 of file project/at_start_f413/examples/usart/rs485/src/main.c.

Referenced by rs485_config().

◆ RS485_BUFFER_SIZE

#define RS485_BUFFER_SIZE 128

Definition at line 38 of file project/at_start_f413/examples/usart/rs485/src/main.c.

Referenced by USART2_IRQHandler().

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/usart/rs485/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/usart/rs485/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/usart/rs485/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< usart idle flag

< usart receive data buffer full interrupt

< usart receive data buffer full interrupt

Definition at line 113 of file project/at_start_f413/examples/usart/rs485/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/usart/rs485/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/usart/rs485/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/usart/rs485/src/at32f413_int.c.

◆ rs485_config()

static void rs485_config ( void )
static

rs485 configiguration.

Parameters
none
Return values
none

< gpio pins number 2

< gpio pins number 3

< gpio pins number 1

< gpio pins number 1

< usart receive data buffer full flag

< usart receive data buffer full interrupt

Definition at line 48 of file project/at_start_f413/examples/usart/rs485/src/main.c.

Referenced by main().

◆ rs485_send_data()

static void rs485_send_data | ( | u8 * | buf,
 |  | u8 | cnt )
 static

rs485 send data

Parameters
buf | pointer to the buffer that contain the data to be transferred.
cnt | size of buffer in bytes.
Return values
none

< gpio pins number 1

< usart transmit data buffer empty flag

< usart transmit data complete flag

< gpio pins number 1

Definition at line 97 of file project/at_start_f413/examples/usart/rs485/src/main.c.

Referenced by main().

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/usart/rs485/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/usart/rs485/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/usart/rs485/src/at32f413_int.c.

◆ USART2_IRQHandler()

void USART2_IRQHandler ( void )

usart2 interrupt handler

Parameters
none
Return values
none

< usart receive data buffer full flag

Definition at line 144 of file project/at_start_f413/examples/usart/rs485/src/main.c.

Variable Documentation

◆ rs485_buffer_rx

uint8_t rs485_buffer_rx[128]

Definition at line 40 of file project/at_start_f413/examples/usart/rs485/src/main.c.

Referenced by main(), and USART2_IRQHandler().

◆ rs485_buffer_rx_cnt

uint8_t rs485_buffer_rx_cnt = 0

Definition at line 41 of file project/at_start_f413/examples/usart/rs485/src/main.c.

Referenced by main(), and USART2_IRQHandler().


AT32F413 Firmwary Library: USART_smartcard

Data Structures | Macros | Functions | Variables
USART_smartcard
AT32F413_periph_examples

Data Structures

struct sc_atr_type

Macros

#define | T0_PROTOCOL 0x00 /* t0 protocol */
#define | SETUP_LENGTH 20
#define | HIST_LENGTH 20
#define | SC_RECEIVE_TIMEOUT 0xA000 /* direction to reader */
#define | SC_USART_DIV_VAL 20 /* ISO 7816-3 protocol: SC_CLOCK_FREQ(PCLK/(2*USART_DIV_VAL)) is between 1 and 5 MHz */
#define | SC_F_DIV_D 372 /* ISO 7816-3 protocol: F/D = 372 */

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | EXINT9_5_IRQHandler (void)
this function handles external lines 9 to 5 interrupt request.
void | USART2_IRQHandler (void)
this function handles sc_usart global interrupt request.
void | usart_configuration (void)
config usart
uint8_t | sc_response_decode (__IO uint8_t *card)
decode the card atr response.
int | main (void)
main function.

Variables

sc_atr_type sc_a2r_struct
uint32_t | sc_baud_rate = 0
uint32_t | sc_clock_freq = 0
uint32_t | counter = 0
error_status atr_decode_status = ERROR
uint32_t | card_inserted = 0
uint32_t | card_protocol = 1
uint8_t | dst_buffer [50]

Detailed Description

Macro Definition Documentation

◆ HIST_LENGTH

#define HIST_LENGTH 20

Definition at line 40 of file project/at_start_f413/examples/usart/smartcard/src/main.c.

Referenced by sc_response_decode().

◆ SC_F_DIV_D

#define SC_F_DIV_D 372 /* ISO 7816-3 protocol: F/D = 372 */

Definition at line 44 of file project/at_start_f413/examples/usart/smartcard/src/main.c.

Referenced by usart_configuration().

◆ SC_RECEIVE_TIMEOUT

#define SC_RECEIVE_TIMEOUT 0xA000 /* direction to reader */

Definition at line 41 of file project/at_start_f413/examples/usart/smartcard/src/main.c.

Referenced by main().

◆ SC_USART_DIV_VAL

#define SC_USART_DIV_VAL 20 /* ISO 7816-3 protocol: SC_CLOCK_FREQ(PCLK/(2*USART_DIV_VAL)) is between 1 and 5 MHz */

Definition at line 43 of file project/at_start_f413/examples/usart/smartcard/src/main.c.

Referenced by usart_configuration().

◆ SETUP_LENGTH

#define SETUP_LENGTH 20

Definition at line 39 of file project/at_start_f413/examples/usart/smartcard/src/main.c.

Referenced by sc_response_decode().

◆ T0_PROTOCOL

#define T0_PROTOCOL 0x00 /* t0 protocol */

Definition at line 38 of file project/at_start_f413/examples/usart/smartcard/src/main.c.

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 80 of file project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 115 of file project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c.

◆ EXINT9_5_IRQHandler()

void EXINT9_5_IRQHandler ( void )

this function handles external lines 9 to 5 interrupt request.

Parameters
none
Return values
none

< gpio pins number 7

< gpio pins number 6

< gpio pins number 6

< external interrupt line 8

Definition at line 142 of file project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 54 of file project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< usart receive data buffer full flag

Definition at line 277 of file project/at_start_f413/examples/usart/smartcard/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 67 of file project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 45 of file project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 124 of file project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c.

◆ sc_response_decode()

uint8_t sc_response_decode ( __IO uint8_t * card )

decode the card atr response.

Parameters
card pointer to the buffer containing the card atr.
Return values
card protocol

Definition at line 201 of file project/at_start_f413/examples/usart/smartcard/src/main.c.

Referenced by main().

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 106 of file project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 133 of file project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 93 of file project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c.

◆ USART2_IRQHandler()

void USART2_IRQHandler ( void )

this function handles sc_usart global interrupt request.

Parameters
none
Return values
none

< usart parity error flag

< usart receive data buffer full interrupt

< usart receive data buffer full flag

< usart receive data buffer full interrupt

Definition at line 165 of file project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c.

◆ usart_configuration()

void usart_configuration ( void )

config usart

Parameters
none
Return values
none

< usart parity error interrupt

Definition at line 74 of file project/at_start_f413/examples/usart/smartcard/src/main.c.

Referenced by main().

Variable Documentation

◆ atr_decode_status

error_status atr_decode_status = ERROR

Definition at line 61 of file project/at_start_f413/examples/usart/smartcard/src/main.c.

Referenced by main().

◆ card_inserted

uint32_t card_inserted = 0

Definition at line 62 of file project/at_start_f413/examples/usart/smartcard/src/main.c.

Referenced by EXINT9_5_IRQHandler(), and main().

◆ card_protocol

uint32_t card_protocol = 1

Definition at line 62 of file project/at_start_f413/examples/usart/smartcard/src/main.c.

Referenced by main().

◆ counter

uint32_t counter = 0

Definition at line 60 of file project/at_start_f413/examples/usart/smartcard/src/main.c.

Referenced by main().

◆ dst_buffer

uint8_t dst_buffer[50]
Initial value:
= {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1
}

Definition at line 63 of file project/at_start_f413/examples/usart/smartcard/src/main.c.

Referenced by main().

◆ sc_a2r_struct

sc_atr_type sc_a2r_struct

Definition at line 57 of file project/at_start_f413/examples/usart/smartcard/src/main.c.

Referenced by sc_response_decode().

◆ sc_baud_rate

uint32_t sc_baud_rate = 0

Definition at line 58 of file project/at_start_f413/examples/usart/smartcard/src/main.c.

Referenced by usart_configuration().

◆ sc_clock_freq

uint32_t sc_clock_freq = 0

Definition at line 59 of file project/at_start_f413/examples/usart/smartcard/src/main.c.

Referenced by usart_configuration().


AT32F413 Firmwary Library: sc_atr_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
sc_atr_type Struct Reference
AT32F413_periph_examples » USART_smartcard

Data Fields

uint8_t | ts
uint8_t | t0
uint8_t | t [20]
uint8_t | h [20]
uint8_t | tlength
uint8_t | hlength

Detailed Description

Definition at line 47 of file project/at_start_f413/examples/usart/smartcard/src/main.c.

Field Documentation

◆ h

uint8_t sc_atr_type::h[20]

Definition at line 52 of file project/at_start_f413/examples/usart/smartcard/src/main.c.

Referenced by sc_response_decode().

◆ hlength

uint8_t sc_atr_type::hlength

Definition at line 54 of file project/at_start_f413/examples/usart/smartcard/src/main.c.

Referenced by sc_response_decode().

◆ t

uint8_t sc_atr_type::t[20]

Definition at line 51 of file project/at_start_f413/examples/usart/smartcard/src/main.c.

Referenced by sc_response_decode().

◆ t0

uint8_t sc_atr_type::t0

Definition at line 50 of file project/at_start_f413/examples/usart/smartcard/src/main.c.

Referenced by sc_response_decode().

◆ tlength

uint8_t sc_atr_type::tlength

Definition at line 53 of file project/at_start_f413/examples/usart/smartcard/src/main.c.

Referenced by sc_response_decode().

◆ ts

uint8_t sc_atr_type::ts

Definition at line 49 of file project/at_start_f413/examples/usart/smartcard/src/main.c.

Referenced by sc_response_decode().

The documentation for this struct was generated from the following file:
  • project/at_start_f413/examples/usart/smartcard/src/main.c


AT32F413 Firmwary Library: USART_synchronous

Macros | Functions | Variables
USART_synchronous
AT32F413_periph_examples

Macros

#define | COUNTOF(a)
#define | USART2_TX_BUFFER_SIZE (COUNTOF(usart2_tx_buffer) - 1)
#define | SPI2_TX_BUFFER_SIZE (COUNTOF(spi2_tx_buffer) - 1)
#define | DYMMY_BYTE 0x00

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | usart_spi_configuration (void)
config usart and spi
uint8_t | buffer_compare (uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t buffer_length)
compares two buffers.
int | main (void)
main function.

Variables

uint8_t | usart2_tx_buffer [] = "usart synchronous example: usart2 -> spi2"
uint8_t | spi2_tx_buffer [] = "usart synchronous example: spi2 -> usart2"
uint8_t | usart2_rx_buffer [((sizeof(spi2_tx_buffer)/sizeof(*(spi2_tx_buffer))) - 1)]
uint8_t | spi2_rx_buffer [((sizeof(usart2_tx_buffer)/sizeof(*(usart2_tx_buffer))) - 1)]
uint8_t | usart2_tx_counter = 0x00
uint8_t | spi2_tx_counter = 0x00
uint8_t | usart2_rx_counter = 0x00
uint8_t | spi2_rx_counter = 0x00
uint8_t | usart2_tx_buffer_size = ( (sizeof(usart2_tx_buffer) / sizeof(*(usart2_tx_buffer))) - 1)
uint8_t | spi2_tx_buffer_size = ( (sizeof(spi2_tx_buffer) / sizeof(*(spi2_tx_buffer))) - 1)

Detailed Description

Macro Definition Documentation

◆ COUNTOF

#define COUNTOF ( a )
Value:
(sizeof(a) / sizeof(*(a)))

Definition at line 37 of file project/at_start_f413/examples/usart/synchronous/src/main.c.

◆ DYMMY_BYTE

#define DYMMY_BYTE 0x00

Definition at line 40 of file project/at_start_f413/examples/usart/synchronous/src/main.c.

Referenced by main().

◆ SPI2_TX_BUFFER_SIZE

#define SPI2_TX_BUFFER_SIZE (COUNTOF(spi2_tx_buffer) - 1)

Definition at line 39 of file project/at_start_f413/examples/usart/synchronous/src/main.c.

Referenced by main().

◆ USART2_TX_BUFFER_SIZE

#define USART2_TX_BUFFER_SIZE (COUNTOF(usart2_tx_buffer) - 1)

Definition at line 38 of file project/at_start_f413/examples/usart/synchronous/src/main.c.

Referenced by main().

Function Documentation

◆ buffer_compare()

uint8_t buffer_compare | ( | uint8_t * | pbuffer1,
 |  | uint8_t * | pbuffer2,
 |  | uint16_t | buffer_length )

compares two buffers.

Parameters
pbuffer1,pbuffer2 | buffers to be compared.
buffer_length | buffer's length
Return values
1 pbuffer1 identical to pbuffer2 0: pbuffer1 differs from pbuffer2

Definition at line 133 of file project/at_start_f413/examples/usart/synchronous/src/main.c.

Referenced by main().

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/usart/synchronous/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/usart/synchronous/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/usart/synchronous/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< usart transmit data buffer empty flag

< spi or i2s receive data buffer full flag

< usart receive data buffer full flag

< spi or i2s transmit data buffer empty flag

< usart transmit data buffer empty flag

< usart receive data buffer full flag

Definition at line 152 of file project/at_start_f413/examples/usart/synchronous/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/usart/synchronous/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/usart/synchronous/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/usart/synchronous/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/usart/synchronous/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/usart/synchronous/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/usart/synchronous/src/at32f413_int.c.

◆ usart_spi_configuration()

void usart_spi_configuration ( void )

config usart and spi

Parameters
none
Return values
none

< gpio pins number 2

< gpio pins number 4

< gpio pins number 3

< gpio pins number 15

< gpio pins number 13

< gpio pins number 14

Definition at line 58 of file project/at_start_f413/examples/usart/synchronous/src/main.c.

Referenced by main().

Variable Documentation

◆ spi2_rx_buffer

uint8_t spi2_rx_buffer[((sizeof(usart2_tx_buffer)/sizeof(*(usart2_tx_buffer))) - 1)]

Definition at line 45 of file project/at_start_f413/examples/usart/synchronous/src/main.c.

Referenced by main().

◆ spi2_rx_counter

uint8_t spi2_rx_counter = 0x00

Definition at line 49 of file project/at_start_f413/examples/usart/synchronous/src/main.c.

Referenced by main().

◆ spi2_tx_buffer

uint8_t spi2_tx_buffer[] = "usart synchronous example: spi2 -> usart2"

Definition at line 43 of file project/at_start_f413/examples/usart/synchronous/src/main.c.

Referenced by main().

◆ spi2_tx_buffer_size

uint8_t spi2_tx_buffer_size = ( (sizeof(spi2_tx_buffer) / sizeof(*(spi2_tx_buffer))) - 1)

Definition at line 51 of file project/at_start_f413/examples/usart/synchronous/src/main.c.

Referenced by main().

◆ spi2_tx_counter

uint8_t spi2_tx_counter = 0x00

Definition at line 47 of file project/at_start_f413/examples/usart/synchronous/src/main.c.

Referenced by main().

◆ usart2_rx_buffer

uint8_t usart2_rx_buffer[((sizeof(spi2_tx_buffer)/sizeof(*(spi2_tx_buffer))) - 1)]

Definition at line 44 of file project/at_start_f413/examples/usart/synchronous/src/main.c.

Referenced by main().

◆ usart2_rx_counter

uint8_t usart2_rx_counter = 0x00

Definition at line 48 of file project/at_start_f413/examples/usart/synchronous/src/main.c.

Referenced by main(), and USART2_IRQHandler().

◆ usart2_tx_buffer

uint8_t usart2_tx_buffer[] = "usart synchronous example: usart2 -> spi2"

Definition at line 42 of file project/at_start_f413/examples/usart/synchronous/src/main.c.

Referenced by main().

◆ usart2_tx_buffer_size

uint8_t usart2_tx_buffer_size = ( (sizeof(usart2_tx_buffer) / sizeof(*(usart2_tx_buffer))) - 1)

Definition at line 50 of file project/at_start_f413/examples/usart/synchronous/src/main.c.

Referenced by main(), USART2_IRQHandler(), and USART3_IRQHandler().

◆ usart2_tx_counter

uint8_t usart2_tx_counter = 0x00

Definition at line 46 of file project/at_start_f413/examples/usart/synchronous/src/main.c.

Referenced by main(), and USART2_IRQHandler().


AT32F413 Firmwary Library: USART_transfer_by_dma_interrupt

Macros | Functions | Variables
USART_transfer_by_dma_interrupt
AT32F413_periph_examples

Macros

#define | COUNTOF(a)
#define | USART2_TX_BUFFER_SIZE (COUNTOF(usart2_tx_buffer) - 1)
#define | USART3_TX_BUFFER_SIZE (COUNTOF(usart3_tx_buffer) - 1)

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | DMA1_Channel1_IRQHandler (void)
this function handles dma1 channel1 handler.
void | DMA1_Channel2_IRQHandler (void)
this function handles dma1 channel2 handler.
void | DMA1_Channel3_IRQHandler (void)
this function handles dma1 channel3 handler.
void | DMA1_Channel4_IRQHandler (void)
this function handles dma1 channel4 handler.
void | usart_configuration (void)
config usart
void | dma_configuration (void)
config dma for usart2 and usart3
uint8_t | buffer_compare (uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t buffer_length)
compares two buffers.
int | main (void)
main function.

Variables

uint8_t | usart2_tx_buffer [] = "usart transfer by dma interrupt: usart2 -> usart3 using dma"
uint8_t | usart3_tx_buffer [] = "usart transfer by dma interrupt: usart3 -> usart2 using dma"
uint8_t | usart2_rx_buffer [((sizeof(usart3_tx_buffer)/sizeof(*(usart3_tx_buffer))) - 1)]
uint8_t | usart3_rx_buffer [((sizeof(usart2_tx_buffer)/sizeof(*(usart2_tx_buffer))) - 1)]
volatile uint8_t | usart2_tx_dma_status = 0
volatile uint8_t | usart2_rx_dma_status = 0
volatile uint8_t | usart3_tx_dma_status = 0
volatile uint8_t | usart3_rx_dma_status = 0

Detailed Description

Macro Definition Documentation

◆ COUNTOF

#define COUNTOF ( a )
Value:
(sizeof(a) / sizeof(*(a)))

Definition at line 37 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c.

◆ USART2_TX_BUFFER_SIZE

#define USART2_TX_BUFFER_SIZE (COUNTOF(usart2_tx_buffer) - 1)

Definition at line 38 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c.

Referenced by dma_configuration(), and main().

◆ USART3_TX_BUFFER_SIZE

#define USART3_TX_BUFFER_SIZE (COUNTOF(usart3_tx_buffer) - 1)

Definition at line 39 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c.

Referenced by dma_configuration(), and main().

Function Documentation

◆ buffer_compare()

uint8_t buffer_compare | ( | uint8_t * | pbuffer1,
 |  | uint8_t * | pbuffer2,
 |  | uint16_t | buffer_length )

compares two buffers.

Parameters
pbuffer1,pbuffer2 | buffers to be compared.
buffer_length | buffer's length
Return values
1 pbuffer1 identical to pbuffer2 0: pbuffer1 differs from pbuffer2

Definition at line 230 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c.

Referenced by main().

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 82 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 117 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c.

◆ DMA1_Channel1_IRQHandler()

void DMA1_Channel1_IRQHandler ( void )

this function handles dma1 channel1 handler.

Parameters
none
Return values
none

< dma1 channel1 full data transfer flag

< dma1 channel1 full data transfer flag

Definition at line 144 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c.

◆ DMA1_Channel2_IRQHandler()

void DMA1_Channel2_IRQHandler ( void )

this function handles dma1 channel2 handler.

Parameters
none
Return values
none

< dma1 channel2 full data transfer flag

< dma1 channel2 full data transfer flag

Definition at line 159 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c.

◆ DMA1_Channel3_IRQHandler()

void DMA1_Channel3_IRQHandler ( void )

this function handles dma1 channel3 handler.

Parameters
none
Return values
none

< dma1 channel3 full data transfer flag

< dma1 channel3 full data transfer flag

Definition at line 174 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c.

◆ DMA1_Channel4_IRQHandler()

void DMA1_Channel4_IRQHandler ( void )

this function handles dma1 channel4 handler.

Parameters
none
Return values
none

< dma1 channel4 full data transfer flag

< dma1 channel4 full data transfer flag

Definition at line 189 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c.

◆ dma_configuration()

void dma_configuration ( void )

config dma for usart2 and usart3

Parameters
none
Return values
none

< dma full data transfer interrupt

< dma flexible channel1

< dma full data transfer interrupt

< dma flexible channel2

< dma full data transfer interrupt

< dma flexible channel3

< dma full data transfer interrupt

< dma flexible channel4

Definition at line 114 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c.

Referenced by main().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 56 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 249 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 69 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 47 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 126 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 108 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 135 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 95 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c.

◆ usart_configuration()

void usart_configuration ( void )

config usart

Parameters
none
Return values
none

< gpio pins number 2

< gpio pins number 10

< gpio pins number 3

< gpio pins number 11

Definition at line 55 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c.

Referenced by main().

Variable Documentation

◆ usart2_rx_buffer

uint8_t usart2_rx_buffer[((sizeof(usart3_tx_buffer)/sizeof(*(usart3_tx_buffer))) - 1)]

Definition at line 43 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c.

Referenced by dma_configuration(), and main().

◆ usart2_rx_dma_status

volatile uint8_t usart2_rx_dma_status = 0

Definition at line 46 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c.

Referenced by DMA1_Channel2_IRQHandler(), and main().

◆ usart2_tx_buffer

uint8_t usart2_tx_buffer[] = "usart transfer by dma interrupt: usart2 -> usart3 using dma"

Definition at line 41 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c.

Referenced by dma_configuration(), and main().

◆ usart2_tx_dma_status

volatile uint8_t usart2_tx_dma_status = 0

Definition at line 45 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c.

Referenced by DMA1_Channel1_IRQHandler(), and main().

◆ usart3_rx_buffer

uint8_t usart3_rx_buffer[((sizeof(usart2_tx_buffer)/sizeof(*(usart2_tx_buffer))) - 1)]

Definition at line 44 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c.

Referenced by dma_configuration(), and main().

◆ usart3_rx_dma_status

volatile uint8_t usart3_rx_dma_status = 0

Definition at line 48 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c.

Referenced by DMA1_Channel4_IRQHandler(), and main().

◆ usart3_tx_buffer

uint8_t usart3_tx_buffer[] = "usart transfer by dma interrupt: usart3 -> usart2 using dma"

Definition at line 42 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c.

Referenced by dma_configuration(), and main().

◆ usart3_tx_dma_status

volatile uint8_t usart3_tx_dma_status = 0

Definition at line 47 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c.

Referenced by DMA1_Channel3_IRQHandler(), and main().


AT32F413 Firmwary Library: USART_transfer_by_dma_polling

Macros | Functions | Variables
USART_transfer_by_dma_polling
AT32F413_periph_examples

Macros

#define | COUNTOF(a)
#define | USART2_TX_BUFFER_SIZE (COUNTOF(usart2_tx_buffer) - 1)
#define | USART3_TX_BUFFER_SIZE (COUNTOF(usart3_tx_buffer) - 1)

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | usart_configuration (void)
config usart
void | dma_configuration (void)
config dma for usart2 and usart3
uint8_t | buffer_compare (uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t buffer_length)
compares two buffers.
int | main (void)
main function.

Variables

uint8_t | usart2_tx_buffer [] = "usart transfer by dma interrupt: usart2 -> usart3 using dma"
uint8_t | usart3_tx_buffer [] = "usart transfer by dma interrupt: usart3 -> usart2 using dma"
uint8_t | usart2_rx_buffer [((sizeof(usart3_tx_buffer)/sizeof(*(usart3_tx_buffer))) - 1)]
uint8_t | usart3_rx_buffer [((sizeof(usart2_tx_buffer)/sizeof(*(usart2_tx_buffer))) - 1)]

Detailed Description

Macro Definition Documentation

◆ COUNTOF

#define COUNTOF ( a )
Value:
(sizeof(a) / sizeof(*(a)))

Definition at line 37 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c.

◆ USART2_TX_BUFFER_SIZE

#define USART2_TX_BUFFER_SIZE (COUNTOF(usart2_tx_buffer) - 1)

Definition at line 38 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c.

Referenced by dma_configuration(), and main().

◆ USART3_TX_BUFFER_SIZE

#define USART3_TX_BUFFER_SIZE (COUNTOF(usart3_tx_buffer) - 1)

Definition at line 39 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c.

Referenced by dma_configuration(), and main().

Function Documentation

◆ buffer_compare()

uint8_t buffer_compare | ( | uint8_t * | pbuffer1,
 |  | uint8_t * | pbuffer2,
 |  | uint16_t | buffer_length )

compares two buffers.

Parameters
pbuffer1,pbuffer2 | buffers to be compared.
buffer_length | buffer's length
Return values
1 pbuffer1 identical to pbuffer2 0: pbuffer1 differs from pbuffer2

Definition at line 202 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c.

Referenced by main().

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/src/at32f413_int.c.

◆ dma_configuration()

void dma_configuration ( void )

config dma for usart2 and usart3

Parameters
none
Return values
none

< dma flexible channel1

< dma flexible channel2

< dma flexible channel3

< dma flexible channel4

Definition at line 110 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c.

Referenced by main().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< dma1 channel1 full data transfer flag

< dma1 channel2 full data transfer flag

< dma1 channel3 full data transfer flag

< dma1 channel4 full data transfer flag

Definition at line 221 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/src/at32f413_int.c.

◆ usart_configuration()

void usart_configuration ( void )

config usart

Parameters
none
Return values
none

< gpio pins number 2

< gpio pins number 10

< gpio pins number 3

< gpio pins number 11

Definition at line 51 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c.

Referenced by main().

Variable Documentation

◆ usart2_rx_buffer

uint8_t usart2_rx_buffer[((sizeof(usart3_tx_buffer)/sizeof(*(usart3_tx_buffer))) - 1)]

Definition at line 43 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c.

Referenced by dma_configuration(), main(), and USART2_IRQHandler().

◆ usart2_tx_buffer

uint8_t usart2_tx_buffer[] = "usart transfer by dma interrupt: usart2 -> usart3 using dma"

Definition at line 41 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c.

Referenced by dma_configuration(), main(), and USART2_IRQHandler().

◆ usart3_rx_buffer

uint8_t usart3_rx_buffer[((sizeof(usart2_tx_buffer)/sizeof(*(usart2_tx_buffer))) - 1)]

Definition at line 44 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c.

Referenced by dma_configuration(), main(), and USART3_IRQHandler().

◆ usart3_tx_buffer

uint8_t usart3_tx_buffer[] = "usart transfer by dma interrupt: usart3 -> usart2 using dma"

Definition at line 42 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c.

Referenced by dma_configuration(), main(), and USART3_IRQHandler().


AT32F413 Firmwary Library: USB_device_audio

Topics | Macros | Functions | Variables
USB_device_audio
AT32F413_periph_examples

Topics

USB_device_audio_codec_reg_definition
USB_device_audio_codec_pin_definition
USB_device_audio_codec_exported_functions

Macros

#define | USB_BUFFER_SIZE_EX
usb endpoint max num define
#define | USB_EPT_AUTO_MALLOC_BUFFER
auto malloc usb endpoint buffer
#define | I2C_TIMEOUT 0xFFFFFFFF
#define | I2Cx_SPEED 100000
#define | I2Cx_ADDRESS 0x00
#define | I2Cx_PORT I2C1
#define | I2Cx_CLK CRM_I2C1_PERIPH_CLOCK
#define | I2Cx_SCL_PIN GPIO_PINS_8
#define | I2Cx_SCL_GPIO_PORT GPIOB
#define | I2Cx_SCL_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
#define | I2Cx_SDA_PIN GPIO_PINS_9
#define | I2Cx_SDA_GPIO_PORT GPIOB
#define | I2Cx_SDA_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
#define | WM8988_REG_FREQ48K ((WM8988_R8_SAMPLE_RATE << 9) | 0x0081)
wm8988 freq
#define | WM8988_REG_FREQ16K ((WM8988_R8_SAMPLE_RATE << 9) | 0x0095)
#define | WM8988_REG_BITW16 ((WM8988_R7_AUDIO_INTERFACE << 9) | 0x0042)
wm8988 bit width

Functions

void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.
void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | memset16_buffer (uint16_t *buffer, uint32_t set, uint32_t len)
buffer memset
void | codec_i2s_reset (void)
audio codec i2s reset
void | codec_i2s_init (audio_codec_type *param)
audio codec i2s init
void | mclk_tmr1_init (void)
mclk clock conifg
void | copy_buff (uint16_t *dest, uint16_t *src, uint32_t len)
copy buffer
void | audio_codec_set_mic_freq (uint32_t freq)
audio codec set microphone freq
void | audio_codec_set_spk_freq (uint32_t freq)
audio codec set speaker freq
void | audio_codec_spk_alt_setting (uint32_t alt_seting)
audio codec speaker alt setting config
void | audio_codec_mic_alt_setting (uint32_t alt_seting)
audio codec microphone alt setting config
void | audio_codec_set_mic_mute (uint8_t mute)
audio codec set microphone mute
void | audio_codec_set_spk_mute (uint8_t mute)
audio codec set speaker mute
void | audio_codec_set_mic_volume (uint16_t volume)
audio codec set microphone volume
void | audio_codec_set_spk_volume (uint16_t volume)
audio codec set speaker volume
uint8_t | audio_codec_spk_feedback (uint8_t *feedback)
codec speaker feedback
void | audio_codec_spk_fifo_write (uint8_t *data, uint32_t len)
codec speaker write fifo
uint32_t | audio_codec_mic_get_data (uint8_t *buffer)
codec microphone get data
void | audio_codec_modify_freq (uint32_t freq)
audio codec modify freq
void | i2c_lowlevel_init (i2c_handle_type *hi2c)
initializes peripherals used by the i2c.
void | DMA1_Channel3_IRQHandler (void)
this function handles dma1 channel3 interrupt.
void | DMA1_Channel4_IRQHandler (void)
this function handles dma1 channel4 interrupt.
error_status | audio_codec_init (void)
audio codec init
error_status | audio_codec_loop (void)
audio codec loop
void | usb_clock48m_select (usb_clk48_s clk_s)
usb 48M clock select
int | main (void)
main function.
void | USBFS_L_CAN1_RX0_IRQHandler (void)
this function handles usb interrupt.

Variables

uint16_t | reg_addr_data []
wm8988 register default value
i2c_handle_type hi2cx
audio_codec_type audio_codec
uint16_t | spk_dma_buffer [DMA_BUFFER_SIZE]
uint16_t | mic_dma_buffer [DMA_BUFFER_SIZE]
usbd_core_type usb_core_dev

Detailed Description

Macro Definition Documentation

◆ I2C_TIMEOUT

#define I2C_TIMEOUT 0xFFFFFFFF

Definition at line 40 of file audio/src/audio_codec.c.

◆ I2Cx_ADDRESS

#define I2Cx_ADDRESS 0x00

Definition at line 43 of file audio/src/audio_codec.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_CLK

#define I2Cx_CLK CRM_I2C1_PERIPH_CLOCK

Definition at line 46 of file audio/src/audio_codec.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_PORT

#define I2Cx_PORT I2C1

Definition at line 45 of file audio/src/audio_codec.c.

Referenced by audio_codec_init(), and i2c_lowlevel_init().

◆ I2Cx_SCL_GPIO_CLK

#define I2Cx_SCL_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK

Definition at line 50 of file audio/src/audio_codec.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_SCL_GPIO_PORT

#define I2Cx_SCL_GPIO_PORT GPIOB

Definition at line 49 of file audio/src/audio_codec.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_SCL_PIN

#define I2Cx_SCL_PIN GPIO_PINS_8

Definition at line 48 of file audio/src/audio_codec.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_SDA_GPIO_CLK

#define I2Cx_SDA_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK

Definition at line 54 of file audio/src/audio_codec.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_SDA_GPIO_PORT

#define I2Cx_SDA_GPIO_PORT GPIOB

Definition at line 53 of file audio/src/audio_codec.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_SDA_PIN

#define I2Cx_SDA_PIN GPIO_PINS_9

Definition at line 52 of file audio/src/audio_codec.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_SPEED

#define I2Cx_SPEED 100000

Definition at line 42 of file audio/src/audio_codec.c.

Referenced by i2c_lowlevel_init().

◆ USB_BUFFER_SIZE_EX

#define USB_BUFFER_SIZE_EX

usb endpoint max num define

usb buffer extend to 768-1280 bytes usb enable extend buffer

Definition at line 56 of file project/at_start_f413/examples/usb_device/audio/inc/usb_conf.h.

◆ USB_EPT_AUTO_MALLOC_BUFFER

#define USB_EPT_AUTO_MALLOC_BUFFER

auto malloc usb endpoint buffer

usb auto malloc endpoint tx and rx buffer

Definition at line 62 of file project/at_start_f413/examples/usb_device/audio/inc/usb_conf.h.

◆ WM8988_REG_BITW16

#define WM8988_REG_BITW16 ((WM8988_R7_AUDIO_INTERFACE << 9) | 0x0042)

wm8988 bit width

Definition at line 65 of file audio/src/audio_codec.c.

Referenced by audio_codec_init().

◆ WM8988_REG_FREQ16K

#define WM8988_REG_FREQ16K ((WM8988_R8_SAMPLE_RATE << 9) | 0x0095)

Definition at line 60 of file audio/src/audio_codec.c.

Referenced by audio_codec_init(), and audio_codec_modify_freq().

◆ WM8988_REG_FREQ48K

#define WM8988_REG_FREQ48K ((WM8988_R8_SAMPLE_RATE << 9) | 0x0081)

wm8988 freq

Definition at line 59 of file audio/src/audio_codec.c.

Referenced by audio_codec_init(), and audio_codec_modify_freq().

Function Documentation

◆ audio_codec_init()

error_status audio_codec_init ( void )

audio codec init

Parameters
none
Return values
error status

Definition at line 797 of file audio/src/audio_codec.c.

◆ audio_codec_loop()

error_status audio_codec_loop ( void )

audio codec loop

Parameters
none
Return values
none

Definition at line 856 of file audio/src/audio_codec.c.

◆ audio_codec_mic_alt_setting()

void audio_codec_mic_alt_setting ( uint32_t alt_seting )

audio codec microphone alt setting config

Parameters
none
Return values
none

Definition at line 168 of file audio/src/audio_codec.c.

◆ audio_codec_mic_get_data()

uint32_t audio_codec_mic_get_data ( uint8_t * buffer )

codec microphone get data

Parameters
data data buffer
Return values
data len

Definition at line 285 of file audio/src/audio_codec.c.

◆ audio_codec_modify_freq()

void audio_codec_modify_freq ( uint32_t freq )

audio codec modify freq

Parameters
freq freq (wm8988 microphone and speaker must as same freq)
Return values
none

Definition at line 345 of file audio/src/audio_codec.c.

Referenced by audio_codec_set_mic_freq(), and audio_codec_set_spk_freq().

◆ audio_codec_set_mic_freq()

void audio_codec_set_mic_freq ( uint32_t freq )

audio codec set microphone freq

Parameters
freq freq (wm8988 microphone and speaker must same freq)
Return values
none

Definition at line 120 of file audio/src/audio_codec.c.

◆ audio_codec_set_mic_mute()

void audio_codec_set_mic_mute ( uint8_t mute )

audio codec set microphone mute

Parameters
mute mute state
Return values
none

Definition at line 183 of file audio/src/audio_codec.c.

◆ audio_codec_set_mic_volume()

void audio_codec_set_mic_volume ( uint16_t volume )

audio codec set microphone volume

Parameters
volume the new volume
Return values
none

Definition at line 205 of file audio/src/audio_codec.c.

◆ audio_codec_set_spk_freq()

void audio_codec_set_spk_freq ( uint32_t freq )

audio codec set speaker freq

Parameters
freq freq(wm8988 microphone and speaker must same freq)
Return values
none

Definition at line 136 of file audio/src/audio_codec.c.

◆ audio_codec_set_spk_mute()

void audio_codec_set_spk_mute ( uint8_t mute )

audio codec set speaker mute

Parameters
mute mute state
Return values
none

Definition at line 194 of file audio/src/audio_codec.c.

◆ audio_codec_set_spk_volume()

void audio_codec_set_spk_volume ( uint16_t volume )

audio codec set speaker volume

Parameters
volume the new volume
Return values
none

Definition at line 220 of file audio/src/audio_codec.c.

◆ audio_codec_spk_alt_setting()

void audio_codec_spk_alt_setting ( uint32_t alt_seting )

audio codec speaker alt setting config

Parameters
none
Return values
none

Definition at line 153 of file audio/src/audio_codec.c.

◆ audio_codec_spk_feedback()

uint8_t audio_codec_spk_feedback ( uint8_t * feedback )

codec speaker feedback

Parameters
feedback data buffer
Return values
feedback len

Definition at line 231 of file audio/src/audio_codec.c.

◆ audio_codec_spk_fifo_write()

void audio_codec_spk_fifo_write | ( | uint8_t * | data,
 |  | uint32_t | len )

codec speaker write fifo

audio codec interface

Parameters
data | data buffer
len | data length
Return values
none

Definition at line 247 of file audio/src/audio_codec.c.

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/usb_device/audio/src/at32f413_int.c.

◆ codec_i2s_init()

void codec_i2s_init ( audio_codec_type * param )

audio codec i2s init

Parameters
freq | audio sampling freq
bitw_format | bit width
Return values
error status

Definition at line 495 of file audio/src/audio_codec.c.

Referenced by audio_codec_init(), audio_codec_set_mic_freq(), and audio_codec_set_spk_freq().

◆ codec_i2s_reset()

void codec_i2s_reset ( void )

audio codec i2s reset

Parameters
none
Return values
none

Definition at line 481 of file audio/src/audio_codec.c.

Referenced by audio_codec_set_mic_freq(), and audio_codec_set_spk_freq().

◆ copy_buff()

void copy_buff | ( | uint16_t * | dest,
 |  | uint16_t * | src,
 |  | uint32_t | len )

copy buffer

Parameters
dest | dest data buffer
src | src data buffer
len | data length
Return values
none

Definition at line 388 of file audio/src/audio_codec.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/usb_device/audio/src/at32f413_int.c.

◆ DMA1_Channel3_IRQHandler()

void DMA1_Channel3_IRQHandler ( void )

this function handles dma1 channel3 interrupt.

Parameters
none
Return values
none

Definition at line 652 of file audio/src/audio_codec.c.

◆ DMA1_Channel4_IRQHandler()

void DMA1_Channel4_IRQHandler ( void )

this function handles dma1 channel4 interrupt.

Parameters
none
Return values
none

Definition at line 727 of file audio/src/audio_codec.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/usb_device/audio/src/at32f413_int.c.

◆ i2c_lowlevel_init()

void i2c_lowlevel_init ( i2c_handle_type * hi2c )

initializes peripherals used by the i2c.

Parameters
none
Return values
none

< gpio pins number 6

< gpio pins number 7

< gpio pins number 6

< gpio pins number 7

< gpio pins number 6

< gpio pins number 7

< gpio pins number 10

< gpio pins number 11

< gpio pins number 10

< gpio pins number 11

Definition at line 402 of file audio/src/audio_codec.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 120 of file project/at_start_f413/examples/usb_device/audio/src/main.c.

◆ mclk_tmr1_init()

void mclk_tmr1_init ( void )

mclk clock conifg

Parameters
none
Return values
none

Definition at line 440 of file audio/src/audio_codec.c.

Referenced by audio_codec_init().

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/usb_device/audio/src/at32f413_int.c.

◆ memset16_buffer()

void memset16_buffer | ( | uint16_t * | buffer,
 |  | uint32_t | set,
 |  | uint32_t | len )

buffer memset

Parameters
buffer | buffer
set | memset data
len | data length
Return values
none

Definition at line 372 of file audio/src/audio_codec.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/usb_device/audio/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/usb_device/audio/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/usb_device/audio/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/usb_device/audio/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/usb_device/audio/src/at32f413_int.c.

◆ usb_clock48m_select()

void usb_clock48m_select ( usb_clk48_s clk_s )

usb 48M clock select

Parameters
clk_s:USB_CLK_HICK,USB_CLK_HEXT
Return values
none

< acc hick trim

Definition at line 49 of file project/at_start_f413/examples/usb_device/audio/src/main.c.

Referenced by main().

◆ usb_delay_ms()

void usb_delay_ms ( uint32_t ms )

usb delay millisecond function.

Parameters
ms number of millisecond delay
Return values
none

Definition at line 171 of file project/at_start_f413/examples/usb_device/audio/src/main.c.

◆ usb_delay_us()

void usb_delay_us ( uint32_t us )

usb delay microsecond function.

Parameters
us number of microsecond delay
Return values
none

Definition at line 182 of file project/at_start_f413/examples/usb_device/audio/src/main.c.

◆ USBFS_L_CAN1_RX0_IRQHandler()

void USBFS_L_CAN1_RX0_IRQHandler ( void )

this function handles usb interrupt.

Parameters
none
Return values
none

Definition at line 161 of file project/at_start_f413/examples/usb_device/audio/src/main.c.

Variable Documentation

◆ audio_codec

audio_codec_type audio_codec

Definition at line 105 of file audio/src/audio_codec.c.

Referenced by audio_codec_init(), audio_codec_loop(), audio_codec_mic_get_data(), audio_codec_set_mic_freq(), audio_codec_set_mic_mute(), audio_codec_set_mic_volume(), audio_codec_set_spk_freq(), audio_codec_set_spk_mute(), audio_codec_set_spk_volume(), audio_codec_spk_feedback(), audio_codec_spk_fifo_write(), DMA1_Channel3_IRQHandler(), and DMA1_Channel4_IRQHandler().

◆ hi2cx

i2c_handle_type hi2cx

Definition at line 103 of file audio/src/audio_codec.c.

Referenced by audio_codec_init(), audio_codec_loop(), and audio_codec_modify_freq().

◆ mic_dma_buffer

uint16_t mic_dma_buffer[DMA_BUFFER_SIZE]

Definition at line 107 of file audio/src/audio_codec.c.

Referenced by codec_i2s_init(), and DMA1_Channel4_IRQHandler().

◆ reg_addr_data

uint16_t reg_addr_data[]

wm8988 register default value

Definition at line 70 of file audio/src/audio_codec.c.

Referenced by audio_codec_init().

◆ spk_dma_buffer

uint16_t spk_dma_buffer[DMA_BUFFER_SIZE]

Definition at line 106 of file audio/src/audio_codec.c.

Referenced by codec_i2s_init(), and DMA1_Channel3_IRQHandler().

◆ usb_core_dev

usbd_core_type usb_core_dev

Definition at line 42 of file project/at_start_f413/examples/usb_device/audio/src/main.c.

Referenced by main(), and USBFS_L_CAN1_RX0_IRQHandler().


AT32F413 Firmwary Library: USB_device_audio_codec_reg_definition

Macros
USB_device_audio_codec_reg_definition
AT32F413_periph_examples » USB_device_audio

Macros

#define | WM8988_R0_LEFT_INPUT_VOLUME 0x00 /*Left channel PGA control*/
#define | WM8988_R1_RIGHT_INPUT_VOLUME 0x01 /*Right channel PGA control*/
#define | WM8988_R2_LOUT1_VOLUME 0x02
#define | WM8988_R3_ROUT1_VOLUME 0x03
#define | WM8988_R4_RESERVED 0x04
#define | WM8988_R5_ADC_DAC_CONTROL 0x05
#define | WM8988_R6_RESERVED 0x06
#define | WM8988_R7_AUDIO_INTERFACE 0x07
#define | WM8988_R8_SAMPLE_RATE 0x08
#define | WM8988_R9_RESERVED 0x09
#define | WM8988_R10_LEFT_DAC_VOLUME 0x0A
#define | WM8988_R11_RIGHT_DAC_VOLUME 0x0B
#define | WM8988_R12_BASS_CONTROL 0x0C
#define | WM8988_R13_TREBLE_CONTROL 0x0D
#define | WM8988_R14_
#define | WM8988_R15_RESET 0x0F
#define | WM8988_R16_3D_CONTROL 0x10
#define | WM8988_R17_ALC1 0x11
#define | WM8988_R18_ALC2 0x12
#define | WM8988_R19_ALC3 0x13
#define | WM8988_R20_NOISE_GATE 0x14
#define | WM8988_R21_LEFT_ADC_VOLUME 0x15
#define | WM8988_R22_RIGHT_ADC_VOLUME 0x16
#define | WM8988_R23_ADDITIONAL_1_CONTROL 0x17
#define | WM8988_R24_ADDITIONAL_2_CONTROL 0x18
#define | WM8988_R25_PWR_1_MGMT 0x19
#define | WM8988_R26_PWR_2_MGMT 0x1A
#define | WM8988_R27_ADDITIONAL_3_CONTROL 0x1B
#define | WM8988_R31_ADC_INPUT_MODE 0x1F
#define | WM8988_R32_ADC_L_SIGNAL_PATH 0x20
#define | WM8988_R33_ADC_R_SIGNAL_PATH 0x21
#define | WM8988_R34_LEFT_OUT_MIX_1 0x22
#define | WM8988_R35_LEFT_OUT_MIX_2 0x23
#define | WM8988_R36_RIGHT_OUT_MIX_1 0x24
#define | WM8988_R37_RIGHT_OUT_MIX_2 0x25
#define | WM8988_R38_RESERVED
#define | WM8988_R39_RESERVED
#define | WM8988_R40_LOUT2_VOLUME 0x28
#define | WM8988_R41_ROUT2_VOLUME 0x29
#define | WM8988_R42_RESERVED
#define | WM8988_R43_LOW_POWER_PALYBACK 0x43
#define | WM8988_I2C_ADDR_CSB_LOW 0x34
#define | WM8988_I2C_ADDR_CSB_HIGH 0x36

Detailed Description

Macro Definition Documentation

◆ WM8988_I2C_ADDR_CSB_HIGH

#define WM8988_I2C_ADDR_CSB_HIGH 0x36

Definition at line 93 of file audio/inc/audio_codec.h.

◆ WM8988_I2C_ADDR_CSB_LOW

#define WM8988_I2C_ADDR_CSB_LOW 0x34

Definition at line 92 of file audio/inc/audio_codec.h.

Referenced by audio_codec_init(), audio_codec_loop(), and audio_codec_modify_freq().

◆ WM8988_R0_LEFT_INPUT_VOLUME

#define WM8988_R0_LEFT_INPUT_VOLUME 0x00 /*Left channel PGA control*/

Definition at line 49 of file audio/inc/audio_codec.h.

◆ WM8988_R10_LEFT_DAC_VOLUME

#define WM8988_R10_LEFT_DAC_VOLUME 0x0A

Definition at line 59 of file audio/inc/audio_codec.h.

◆ WM8988_R11_RIGHT_DAC_VOLUME

#define WM8988_R11_RIGHT_DAC_VOLUME 0x0B

Definition at line 60 of file audio/inc/audio_codec.h.

◆ WM8988_R12_BASS_CONTROL

#define WM8988_R12_BASS_CONTROL 0x0C

Definition at line 61 of file audio/inc/audio_codec.h.

◆ WM8988_R13_TREBLE_CONTROL

#define WM8988_R13_TREBLE_CONTROL 0x0D

Definition at line 62 of file audio/inc/audio_codec.h.

◆ WM8988_R14_

#define WM8988_R14_

Definition at line 63 of file audio/inc/audio_codec.h.

◆ WM8988_R15_RESET

#define WM8988_R15_RESET 0x0F

Definition at line 64 of file audio/inc/audio_codec.h.

◆ WM8988_R16_3D_CONTROL

#define WM8988_R16_3D_CONTROL 0x10

Definition at line 65 of file audio/inc/audio_codec.h.

◆ WM8988_R17_ALC1

#define WM8988_R17_ALC1 0x11

Definition at line 66 of file audio/inc/audio_codec.h.

◆ WM8988_R18_ALC2

#define WM8988_R18_ALC2 0x12

Definition at line 67 of file audio/inc/audio_codec.h.

◆ WM8988_R19_ALC3

#define WM8988_R19_ALC3 0x13

Definition at line 68 of file audio/inc/audio_codec.h.

◆ WM8988_R1_RIGHT_INPUT_VOLUME

#define WM8988_R1_RIGHT_INPUT_VOLUME 0x01 /*Right channel PGA control*/

Definition at line 50 of file audio/inc/audio_codec.h.

◆ WM8988_R20_NOISE_GATE

#define WM8988_R20_NOISE_GATE 0x14

Definition at line 69 of file audio/inc/audio_codec.h.

◆ WM8988_R21_LEFT_ADC_VOLUME

#define WM8988_R21_LEFT_ADC_VOLUME 0x15

Definition at line 70 of file audio/inc/audio_codec.h.

Referenced by audio_codec_loop().

◆ WM8988_R22_RIGHT_ADC_VOLUME

#define WM8988_R22_RIGHT_ADC_VOLUME 0x16

Definition at line 71 of file audio/inc/audio_codec.h.

Referenced by audio_codec_loop().

◆ WM8988_R23_ADDITIONAL_1_CONTROL

#define WM8988_R23_ADDITIONAL_1_CONTROL 0x17

Definition at line 72 of file audio/inc/audio_codec.h.

◆ WM8988_R24_ADDITIONAL_2_CONTROL

#define WM8988_R24_ADDITIONAL_2_CONTROL 0x18

Definition at line 73 of file audio/inc/audio_codec.h.

◆ WM8988_R25_PWR_1_MGMT

#define WM8988_R25_PWR_1_MGMT 0x19

Definition at line 74 of file audio/inc/audio_codec.h.

◆ WM8988_R26_PWR_2_MGMT

#define WM8988_R26_PWR_2_MGMT 0x1A

Definition at line 75 of file audio/inc/audio_codec.h.

◆ WM8988_R27_ADDITIONAL_3_CONTROL

#define WM8988_R27_ADDITIONAL_3_CONTROL 0x1B

Definition at line 76 of file audio/inc/audio_codec.h.

◆ WM8988_R2_LOUT1_VOLUME

#define WM8988_R2_LOUT1_VOLUME 0x02

Definition at line 51 of file audio/inc/audio_codec.h.

Referenced by audio_codec_loop().

◆ WM8988_R31_ADC_INPUT_MODE

#define WM8988_R31_ADC_INPUT_MODE 0x1F

Definition at line 78 of file audio/inc/audio_codec.h.

◆ WM8988_R32_ADC_L_SIGNAL_PATH

#define WM8988_R32_ADC_L_SIGNAL_PATH 0x20

Definition at line 79 of file audio/inc/audio_codec.h.

◆ WM8988_R33_ADC_R_SIGNAL_PATH

#define WM8988_R33_ADC_R_SIGNAL_PATH 0x21

Definition at line 80 of file audio/inc/audio_codec.h.

◆ WM8988_R34_LEFT_OUT_MIX_1

#define WM8988_R34_LEFT_OUT_MIX_1 0x22

Definition at line 81 of file audio/inc/audio_codec.h.

◆ WM8988_R35_LEFT_OUT_MIX_2

#define WM8988_R35_LEFT_OUT_MIX_2 0x23

Definition at line 82 of file audio/inc/audio_codec.h.

◆ WM8988_R36_RIGHT_OUT_MIX_1

#define WM8988_R36_RIGHT_OUT_MIX_1 0x24

Definition at line 83 of file audio/inc/audio_codec.h.

◆ WM8988_R37_RIGHT_OUT_MIX_2

#define WM8988_R37_RIGHT_OUT_MIX_2 0x25

Definition at line 84 of file audio/inc/audio_codec.h.

◆ WM8988_R38_RESERVED

#define WM8988_R38_RESERVED

Definition at line 85 of file audio/inc/audio_codec.h.

◆ WM8988_R39_RESERVED

#define WM8988_R39_RESERVED

Definition at line 86 of file audio/inc/audio_codec.h.

◆ WM8988_R3_ROUT1_VOLUME

#define WM8988_R3_ROUT1_VOLUME 0x03

Definition at line 52 of file audio/inc/audio_codec.h.

Referenced by audio_codec_loop().

◆ WM8988_R40_LOUT2_VOLUME

#define WM8988_R40_LOUT2_VOLUME 0x28

Definition at line 87 of file audio/inc/audio_codec.h.

◆ WM8988_R41_ROUT2_VOLUME

#define WM8988_R41_ROUT2_VOLUME 0x29

Definition at line 88 of file audio/inc/audio_codec.h.

◆ WM8988_R42_RESERVED

#define WM8988_R42_RESERVED

Definition at line 89 of file audio/inc/audio_codec.h.

◆ WM8988_R43_LOW_POWER_PALYBACK

#define WM8988_R43_LOW_POWER_PALYBACK 0x43

Definition at line 90 of file audio/inc/audio_codec.h.

◆ WM8988_R4_RESERVED

#define WM8988_R4_RESERVED 0x04

Definition at line 53 of file audio/inc/audio_codec.h.

◆ WM8988_R5_ADC_DAC_CONTROL

#define WM8988_R5_ADC_DAC_CONTROL 0x05

Definition at line 54 of file audio/inc/audio_codec.h.

Referenced by audio_codec_loop().

◆ WM8988_R6_RESERVED

#define WM8988_R6_RESERVED 0x06

Definition at line 55 of file audio/inc/audio_codec.h.

◆ WM8988_R7_AUDIO_INTERFACE

#define WM8988_R7_AUDIO_INTERFACE 0x07

Definition at line 56 of file audio/inc/audio_codec.h.

◆ WM8988_R8_SAMPLE_RATE

#define WM8988_R8_SAMPLE_RATE 0x08

Definition at line 57 of file audio/inc/audio_codec.h.

◆ WM8988_R9_RESERVED

#define WM8988_R9_RESERVED 0x09

Definition at line 58 of file audio/inc/audio_codec.h.


AT32F413 Firmwary Library: USB_device_audio_codec_pin_definition

Macros
USB_device_audio_codec_pin_definition
AT32F413_periph_examples » USB_device_audio

Macros

#define | I2S1_WS_PIN GPIO_PINS_4
#define | I2S1_CK_PIN GPIO_PINS_5
#define | I2S1_SD_PIN GPIO_PINS_7
#define | I2S1_GPIO GPIOA
#define | I2S1_GPIO_CRM_CLK CRM_GPIOA_PERIPH_CLOCK
#define | I2S1_DT_ADDRESS (&(SPI1->dt))
#define | I2S2_WS_PIN GPIO_PINS_12
#define | I2S2_CK_PIN GPIO_PINS_13
#define | I2S2_SD_PIN GPIO_PINS_15
#define | I2S2_GPIO GPIOB
#define | I2S2_GPIO_CRM_CLK CRM_GPIOB_PERIPH_CLOCK
#define | I2S2_DT_ADDRESS (&(SPI2->dt))
#define | SPK_TX_FIFO_SIZE (1024 * 4)

Detailed Description

Macro Definition Documentation

◆ I2S1_CK_PIN

#define I2S1_CK_PIN GPIO_PINS_5

Definition at line 103 of file audio/inc/audio_codec.h.

Referenced by codec_i2s_init().

◆ I2S1_DT_ADDRESS

#define I2S1_DT_ADDRESS (&(SPI1->dt))

Definition at line 107 of file audio/inc/audio_codec.h.

Referenced by codec_i2s_init().

◆ I2S1_GPIO

#define I2S1_GPIO GPIOA

Definition at line 105 of file audio/inc/audio_codec.h.

Referenced by codec_i2s_init().

◆ I2S1_GPIO_CRM_CLK

#define I2S1_GPIO_CRM_CLK CRM_GPIOA_PERIPH_CLOCK

Definition at line 106 of file audio/inc/audio_codec.h.

Referenced by codec_i2s_init().

◆ I2S1_SD_PIN

#define I2S1_SD_PIN GPIO_PINS_7

Definition at line 104 of file audio/inc/audio_codec.h.

Referenced by codec_i2s_init().

◆ I2S1_WS_PIN

#define I2S1_WS_PIN GPIO_PINS_4

Definition at line 102 of file audio/inc/audio_codec.h.

Referenced by codec_i2s_init().

◆ I2S2_CK_PIN

#define I2S2_CK_PIN GPIO_PINS_13

Definition at line 111 of file audio/inc/audio_codec.h.

Referenced by codec_i2s_init().

◆ I2S2_DT_ADDRESS

#define I2S2_DT_ADDRESS (&(SPI2->dt))

Definition at line 115 of file audio/inc/audio_codec.h.

Referenced by codec_i2s_init().

◆ I2S2_GPIO

#define I2S2_GPIO GPIOB

Definition at line 113 of file audio/inc/audio_codec.h.

Referenced by codec_i2s_init().

◆ I2S2_GPIO_CRM_CLK

#define I2S2_GPIO_CRM_CLK CRM_GPIOB_PERIPH_CLOCK

Definition at line 114 of file audio/inc/audio_codec.h.

Referenced by codec_i2s_init().

◆ I2S2_SD_PIN

#define I2S2_SD_PIN GPIO_PINS_15

Definition at line 112 of file audio/inc/audio_codec.h.

Referenced by codec_i2s_init().

◆ I2S2_WS_PIN

#define I2S2_WS_PIN GPIO_PINS_12

Definition at line 110 of file audio/inc/audio_codec.h.

Referenced by codec_i2s_init().

◆ SPK_TX_FIFO_SIZE

#define SPK_TX_FIFO_SIZE (1024 * 4)

Definition at line 117 of file audio/inc/audio_codec.h.


AT32F413 Firmwary Library: USB_device_audio_codec_exported_functions

Data Structures | Macros | Functions
USB_device_audio_codec_exported_functions
AT32F413_periph_examples » USB_device_audio

Data Structures

struct audio_codec_type

Macros

#define | MIC_BUFFER_SIZE 1024
#define | SPK_BUFFER_SIZE 4096
#define | DMA_BUFFER_SIZE 288

Functions

error_status | audio_codec_init (void)
audio codec init
error_status | audio_codec_loop (void)
audio codec loop
void | audio_codec_modify_freq (uint32_t freq)
audio codec modify freq
void | audio_codec_spk_fifo_write (uint8_t *data, uint32_t len)
audio codec interface
uint32_t | audio_codec_mic_get_data (uint8_t *buffer)
codec microphone get data
uint8_t | audio_codec_spk_feedback (uint8_t *feedback)
codec speaker feedback
void | audio_codec_spk_alt_setting (uint32_t alt_seting)
audio codec speaker alt setting config
void | audio_codec_mic_alt_setting (uint32_t alt_seting)
audio codec microphone alt setting config
void | audio_codec_set_mic_mute (uint8_t mute)
audio codec set microphone mute
void | audio_codec_set_spk_mute (uint8_t mute)
audio codec set speaker mute
void | audio_codec_set_mic_volume (uint16_t volume)
audio codec set microphone volume
void | audio_codec_set_spk_volume (uint16_t volume)
audio codec set speaker volume
void | audio_codec_set_mic_freq (uint32_t freq)
audio codec set microphone freq
void | audio_codec_set_spk_freq (uint32_t freq)
audio codec set speaker freq

Detailed Description

Macro Definition Documentation

◆ DMA_BUFFER_SIZE

#define DMA_BUFFER_SIZE 288

Definition at line 128 of file audio/inc/audio_codec.h.

◆ MIC_BUFFER_SIZE

#define MIC_BUFFER_SIZE 1024

Definition at line 126 of file audio/inc/audio_codec.h.

Referenced by audio_codec_mic_get_data(), codec_i2s_init(), and DMA1_Channel4_IRQHandler().

◆ SPK_BUFFER_SIZE

#define SPK_BUFFER_SIZE 4096

Definition at line 127 of file audio/inc/audio_codec.h.

Referenced by audio_codec_spk_fifo_write(), codec_i2s_init(), and DMA1_Channel3_IRQHandler().

Function Documentation

◆ audio_codec_init()

error_status audio_codec_init ( void )

audio codec init

Parameters
none
Return values
error status

Definition at line 797 of file audio/src/audio_codec.c.

Referenced by main().

◆ audio_codec_loop()

error_status audio_codec_loop ( void )

audio codec loop

Parameters
none
Return values
none

Definition at line 856 of file audio/src/audio_codec.c.

Referenced by main().

◆ audio_codec_mic_alt_setting()

void audio_codec_mic_alt_setting ( uint32_t alt_seting )

audio codec microphone alt setting config

Parameters
none
Return values
none

Definition at line 168 of file audio/src/audio_codec.c.

Referenced by audio_set_interface(), audio_set_interface(), class_event_handler(), and class_event_handler().

◆ audio_codec_mic_get_data()

uint32_t audio_codec_mic_get_data ( uint8_t * buffer )

codec microphone get data

Parameters
data data buffer
Return values
data len

Definition at line 285 of file audio/src/audio_codec.c.

Referenced by audio_set_interface(), audio_set_interface(), class_in_handler(), and class_in_handler().

◆ audio_codec_modify_freq()

void audio_codec_modify_freq ( uint32_t freq )

audio codec modify freq

Parameters
freq freq (wm8988 microphone and speaker must as same freq)
Return values
none

Definition at line 345 of file audio/src/audio_codec.c.

◆ audio_codec_set_mic_freq()

void audio_codec_set_mic_freq ( uint32_t freq )

audio codec set microphone freq

Parameters
freq freq (wm8988 microphone and speaker must same freq)
Return values
none

Definition at line 120 of file audio/src/audio_codec.c.

Referenced by class_ept0_rx_handler(), and class_ept0_rx_handler().

◆ audio_codec_set_mic_mute()

void audio_codec_set_mic_mute ( uint8_t mute )

audio codec set microphone mute

Parameters
mute mute state
Return values
none

Definition at line 183 of file audio/src/audio_codec.c.

Referenced by class_ept0_rx_handler(), and class_ept0_rx_handler().

◆ audio_codec_set_mic_volume()

void audio_codec_set_mic_volume ( uint16_t volume )

audio codec set microphone volume

Parameters
volume the new volume
Return values
none

Definition at line 205 of file audio/src/audio_codec.c.

Referenced by class_ept0_rx_handler(), and class_ept0_rx_handler().

◆ audio_codec_set_spk_freq()

void audio_codec_set_spk_freq ( uint32_t freq )

audio codec set speaker freq

Parameters
freq freq(wm8988 microphone and speaker must same freq)
Return values
none

Definition at line 136 of file audio/src/audio_codec.c.

Referenced by class_ept0_rx_handler(), and class_ept0_rx_handler().

◆ audio_codec_set_spk_mute()

void audio_codec_set_spk_mute ( uint8_t mute )

audio codec set speaker mute

Parameters
mute mute state
Return values
none

Definition at line 194 of file audio/src/audio_codec.c.

Referenced by class_ept0_rx_handler(), and class_ept0_rx_handler().

◆ audio_codec_set_spk_volume()

void audio_codec_set_spk_volume ( uint16_t volume )

audio codec set speaker volume

Parameters
volume the new volume
Return values
none

Definition at line 220 of file audio/src/audio_codec.c.

Referenced by class_ept0_rx_handler(), and class_ept0_rx_handler().

◆ audio_codec_spk_alt_setting()

void audio_codec_spk_alt_setting ( uint32_t alt_seting )

audio codec speaker alt setting config

Parameters
none
Return values
none

Definition at line 153 of file audio/src/audio_codec.c.

Referenced by audio_set_interface(), audio_set_interface(), class_event_handler(), and class_event_handler().

◆ audio_codec_spk_feedback()

uint8_t audio_codec_spk_feedback ( uint8_t * feedback )

codec speaker feedback

Parameters
feedback data buffer
Return values
feedback len

Definition at line 231 of file audio/src/audio_codec.c.

Referenced by audio_set_interface(), audio_set_interface(), class_in_handler(), and class_in_handler().

◆ audio_codec_spk_fifo_write()

void audio_codec_spk_fifo_write | ( | uint8_t * | data,
 |  | uint32_t | len )

audio codec interface

audio codec interface

Parameters
data | data buffer
len | data length
Return values
none

Definition at line 247 of file audio/src/audio_codec.c.

Referenced by class_out_handler(), and class_out_handler().


AT32F413 Firmwary Library: audio_codec_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
audio_codec_type Struct Reference
AT32F413_periph_examples » USB_device_audio » USB_device_audio_codec_exported_functions | AT32F413_periph_examples » USB_device_audio_hid » USB_device_audio_hid_codec_exported_functions

#include <audio_codec.h>

Data Fields

uint32_t | audio_freq
uint32_t | audio_bitw
uint16_t | spk_buffer [4096]
uint16_t * | spk_roff
uint16_t * | spk_woff
uint16_t * | spk_rend
uint32_t | spk_freq
uint32_t | spk_wtotal
uint32_t | spk_rtotal
uint16_t | spk_threshold
uint16_t | spk_calc
uint8_t | spk_stage
uint16_t | mic_buffer [1024]
uint16_t * | mic_roff
uint16_t * | mic_woff
uint16_t * | mic_wend
uint32_t | mic_wtotal
uint32_t | mic_rtotal
uint32_t | mic_delta
uint16_t | mic_calc
uint16_t | mic_adj_count
uint8_t | mic_adj_stage
uint8_t | mic_stage
uint8_t | mic_mute
uint8_t | spk_mute
uint16_t | mic_volume
uint16_t | spk_volume
uint32_t | spk_tx_size
uint32_t | mic_rx_size
uint32_t | spk_enable
uint32_t | mic_enable

Detailed Description

Definition at line 130 of file audio/inc/audio_codec.h.

Field Documentation

◆ audio_bitw

uint32_t audio_codec_type::audio_bitw

Definition at line 133 of file audio/inc/audio_codec.h.

Referenced by audio_codec_init(), and codec_i2s_init().

◆ audio_freq

uint32_t audio_codec_type::audio_freq

Definition at line 132 of file audio/inc/audio_codec.h.

Referenced by audio_codec_init(), audio_codec_set_mic_freq(), audio_codec_set_spk_freq(), codec_i2s_init(), and DMA1_Channel3_IRQHandler().

◆ mic_adj_count

uint16_t audio_codec_type::mic_adj_count

Definition at line 155 of file audio/inc/audio_codec.h.

Referenced by audio_codec_mic_get_data(), and DMA1_Channel4_IRQHandler().

◆ mic_adj_stage

uint8_t audio_codec_type::mic_adj_stage

Definition at line 156 of file audio/inc/audio_codec.h.

Referenced by audio_codec_mic_get_data(), and DMA1_Channel4_IRQHandler().

◆ mic_buffer

uint16_t audio_codec_type::mic_buffer

Definition at line 147 of file audio/inc/audio_codec.h.

Referenced by audio_codec_mic_get_data(), codec_i2s_init(), and DMA1_Channel4_IRQHandler().

◆ mic_calc

uint16_t audio_codec_type::mic_calc

Definition at line 154 of file audio/inc/audio_codec.h.

Referenced by DMA1_Channel4_IRQHandler().

◆ mic_delta

uint32_t audio_codec_type::mic_delta

Definition at line 153 of file audio/inc/audio_codec.h.

Referenced by audio_codec_mic_get_data(), and DMA1_Channel4_IRQHandler().

◆ mic_enable

uint32_t audio_codec_type::mic_enable

Definition at line 169 of file audio/inc/audio_codec.h.

◆ mic_mute

uint8_t audio_codec_type::mic_mute

Definition at line 159 of file audio/inc/audio_codec.h.

Referenced by audio_codec_loop(), and audio_codec_set_mic_mute().

◆ mic_roff

uint16_t * audio_codec_type::mic_roff

Definition at line 148 of file audio/inc/audio_codec.h.

Referenced by audio_codec_mic_get_data(), codec_i2s_init(), and DMA1_Channel4_IRQHandler().

◆ mic_rtotal

uint32_t audio_codec_type::mic_rtotal

Definition at line 152 of file audio/inc/audio_codec.h.

Referenced by audio_codec_mic_get_data(), and DMA1_Channel4_IRQHandler().

◆ mic_rx_size

uint32_t audio_codec_type::mic_rx_size

Definition at line 166 of file audio/inc/audio_codec.h.

Referenced by audio_codec_mic_get_data(), codec_i2s_init(), and DMA1_Channel4_IRQHandler().

◆ mic_stage

uint8_t audio_codec_type::mic_stage

Definition at line 157 of file audio/inc/audio_codec.h.

Referenced by audio_codec_mic_get_data(), and DMA1_Channel4_IRQHandler().

◆ mic_volume

uint16_t audio_codec_type::mic_volume

Definition at line 162 of file audio/inc/audio_codec.h.

Referenced by audio_codec_loop(), and audio_codec_set_mic_volume().

◆ mic_wend

uint16_t * audio_codec_type::mic_wend

Definition at line 150 of file audio/inc/audio_codec.h.

Referenced by audio_codec_mic_get_data(), codec_i2s_init(), and DMA1_Channel4_IRQHandler().

◆ mic_woff

uint16_t * audio_codec_type::mic_woff

Definition at line 149 of file audio/inc/audio_codec.h.

Referenced by codec_i2s_init(), and DMA1_Channel4_IRQHandler().

◆ mic_wtotal

uint32_t audio_codec_type::mic_wtotal

Definition at line 151 of file audio/inc/audio_codec.h.

Referenced by audio_codec_mic_get_data(), and DMA1_Channel4_IRQHandler().

◆ spk_buffer

uint16_t audio_codec_type::spk_buffer

Definition at line 135 of file audio/inc/audio_codec.h.

Referenced by audio_codec_spk_fifo_write(), codec_i2s_init(), and DMA1_Channel3_IRQHandler().

◆ spk_calc

uint16_t audio_codec_type::spk_calc

Definition at line 143 of file audio/inc/audio_codec.h.

Referenced by DMA1_Channel3_IRQHandler().

◆ spk_enable

uint32_t audio_codec_type::spk_enable

Definition at line 168 of file audio/inc/audio_codec.h.

◆ spk_freq

uint32_t audio_codec_type::spk_freq

Definition at line 139 of file audio/inc/audio_codec.h.

Referenced by audio_codec_spk_feedback(), codec_i2s_init(), and DMA1_Channel3_IRQHandler().

◆ spk_mute

uint8_t audio_codec_type::spk_mute

Definition at line 160 of file audio/inc/audio_codec.h.

Referenced by audio_codec_loop(), and audio_codec_set_spk_mute().

◆ spk_rend

uint16_t * audio_codec_type::spk_rend

Definition at line 138 of file audio/inc/audio_codec.h.

Referenced by audio_codec_spk_fifo_write(), codec_i2s_init(), and DMA1_Channel3_IRQHandler().

◆ spk_roff

uint16_t * audio_codec_type::spk_roff

Definition at line 136 of file audio/inc/audio_codec.h.

Referenced by audio_codec_spk_fifo_write(), codec_i2s_init(), and DMA1_Channel3_IRQHandler().

◆ spk_rtotal

uint32_t audio_codec_type::spk_rtotal

Definition at line 141 of file audio/inc/audio_codec.h.

Referenced by audio_codec_spk_fifo_write(), and DMA1_Channel3_IRQHandler().

◆ spk_stage

uint8_t audio_codec_type::spk_stage

Definition at line 144 of file audio/inc/audio_codec.h.

Referenced by audio_codec_spk_fifo_write(), and DMA1_Channel3_IRQHandler().

◆ spk_threshold

uint16_t audio_codec_type::spk_threshold

Definition at line 142 of file audio/inc/audio_codec.h.

Referenced by audio_codec_spk_fifo_write(), and DMA1_Channel3_IRQHandler().

◆ spk_tx_size

uint32_t audio_codec_type::spk_tx_size

Definition at line 165 of file audio/inc/audio_codec.h.

Referenced by codec_i2s_init(), and DMA1_Channel3_IRQHandler().

◆ spk_volume

uint16_t audio_codec_type::spk_volume

Definition at line 163 of file audio/inc/audio_codec.h.

Referenced by audio_codec_loop(), and audio_codec_set_spk_volume().

◆ spk_woff

uint16_t * audio_codec_type::spk_woff

Definition at line 137 of file audio/inc/audio_codec.h.

Referenced by audio_codec_spk_fifo_write(), codec_i2s_init(), and DMA1_Channel3_IRQHandler().

◆ spk_wtotal

uint32_t audio_codec_type::spk_wtotal

Definition at line 140 of file audio/inc/audio_codec.h.

Referenced by audio_codec_spk_fifo_write(), and DMA1_Channel3_IRQHandler().

The documentation for this struct was generated from the following files:
  • audio/inc/audio_codec.h
  • composite_audio_hid/inc/audio_codec.h


AT32F413 Firmwary Library: USB_device_audio_hid

Topics | Macros | Functions | Variables
USB_device_audio_hid
AT32F413_periph_examples

Topics

USB_device_audio_hid_codec_reg_definition
USB_device_audio_hid_codec_pin_definition
USB_device_audio_hid_codec_exported_functions

Macros

#define | USB_BUFFER_SIZE_EX
usb endpoint max num define
#define | USB_EPT_AUTO_MALLOC_BUFFER
auto malloc usb endpoint buffer
#define | I2C_TIMEOUT 0xFFFFFFFF
#define | I2Cx_SPEED 200000
#define | I2Cx_ADDRESS 0x00
#define | I2Cx_PORT I2C1
#define | I2Cx_CLK CRM_I2C1_PERIPH_CLOCK
#define | I2Cx_SCL_PIN GPIO_PINS_8
#define | I2Cx_SCL_GPIO_PORT GPIOB
#define | I2Cx_SCL_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
#define | I2Cx_SDA_PIN GPIO_PINS_9
#define | I2Cx_SDA_GPIO_PORT GPIOB
#define | I2Cx_SDA_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
#define | WM8988_REG_FREQ48K ((WM8988_R8_SAMPLE_RATE << 9) | 0x0081)
wm8988 freq
#define | WM8988_REG_FREQ16K ((WM8988_R8_SAMPLE_RATE << 9) | 0x0095)
#define | WM8988_REG_BITW16 ((WM8988_R7_AUDIO_INTERFACE << 9) | 0x0042)
wm8988 bit width

Functions

void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.
void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | memset16_buffer (uint16_t *buffer, uint32_t set, uint32_t len)
buffer memset
void | codec_i2s_reset (void)
audio codec i2s reset
void | codec_i2s_init (audio_codec_type *param)
audio codec i2s init
void | mclk_tmr1_init (void)
mclk clock conifg
void | copy_buff (uint16_t *dest, uint16_t *src, uint32_t len)
copy buffer
void | audio_codec_set_mic_freq (uint32_t freq)
audio codec set microphone freq
void | audio_codec_set_spk_freq (uint32_t freq)
audio codec set speaker freq
void | audio_codec_spk_alt_setting (uint32_t alt_seting)
audio codec speaker alt setting config
void | audio_codec_mic_alt_setting (uint32_t alt_seting)
audio codec microphone alt setting config
void | audio_codec_set_mic_mute (uint8_t mute)
audio codec set microphone mute
void | audio_codec_set_spk_mute (uint8_t mute)
audio codec set speaker mute
void | audio_codec_set_mic_volume (uint16_t volume)
audio codec set microphone volume
void | audio_codec_set_spk_volume (uint16_t volume)
audio codec set speaker volume
uint8_t | audio_codec_spk_feedback (uint8_t *feedback)
codec speaker feedback
void | audio_codec_spk_fifo_write (uint8_t *data, uint32_t len)
codec speaker write fifo
uint32_t | audio_codec_mic_get_data (uint8_t *buffer)
codec microphone get data
void | audio_codec_modify_freq (uint32_t freq)
audio codec modify freq
void | i2c_lowlevel_init (i2c_handle_type *hi2c)
initializes peripherals used by the i2c.
void | DMA1_Channel3_IRQHandler (void)
this function handles dma1 channel3 interrupt.
void | DMA1_Channel4_IRQHandler (void)
this function handles dma1 channel4 interrupt.
error_status | audio_codec_init (void)
audio codec init
error_status | audio_codec_loop (void)
audio codec loop
void | usb_clock48m_select (usb_clk48_s clk_s)
usb 48M clock select
int | main (void)
main function.
void | USBFS_L_CAN1_RX0_IRQHandler (void)
this function handles usb interrupt.

Variables

uint16_t | reg_addr_data []
wm8988 register default value
i2c_handle_type hi2cx
audio_codec_type audio_codec
uint16_t | spk_dma_buffer [DMA_BUFFER_SIZE]
uint16_t | mic_dma_buffer [DMA_BUFFER_SIZE]
usbd_core_type usb_core_dev
uint8_t | report_buf [0x40]

Detailed Description

Macro Definition Documentation

◆ I2C_TIMEOUT

#define I2C_TIMEOUT 0xFFFFFFFF

Definition at line 40 of file composite_audio_hid/src/audio_codec.c.

◆ I2Cx_ADDRESS

#define I2Cx_ADDRESS 0x00

Definition at line 43 of file composite_audio_hid/src/audio_codec.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_CLK

#define I2Cx_CLK CRM_I2C1_PERIPH_CLOCK

Definition at line 46 of file composite_audio_hid/src/audio_codec.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_PORT

#define I2Cx_PORT I2C1

Definition at line 45 of file composite_audio_hid/src/audio_codec.c.

Referenced by audio_codec_init(), and i2c_lowlevel_init().

◆ I2Cx_SCL_GPIO_CLK

#define I2Cx_SCL_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK

Definition at line 50 of file composite_audio_hid/src/audio_codec.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_SCL_GPIO_PORT

#define I2Cx_SCL_GPIO_PORT GPIOB

Definition at line 49 of file composite_audio_hid/src/audio_codec.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_SCL_PIN

#define I2Cx_SCL_PIN GPIO_PINS_8

Definition at line 48 of file composite_audio_hid/src/audio_codec.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_SDA_GPIO_CLK

#define I2Cx_SDA_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK

Definition at line 54 of file composite_audio_hid/src/audio_codec.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_SDA_GPIO_PORT

#define I2Cx_SDA_GPIO_PORT GPIOB

Definition at line 53 of file composite_audio_hid/src/audio_codec.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_SDA_PIN

#define I2Cx_SDA_PIN GPIO_PINS_9

Definition at line 52 of file composite_audio_hid/src/audio_codec.c.

Referenced by i2c_lowlevel_init().

◆ I2Cx_SPEED

#define I2Cx_SPEED 200000

Definition at line 42 of file composite_audio_hid/src/audio_codec.c.

Referenced by i2c_lowlevel_init().

◆ USB_BUFFER_SIZE_EX

#define USB_BUFFER_SIZE_EX

usb endpoint max num define

usb buffer extend to 768-1280 bytes usb enable extend buffer

Definition at line 56 of file project/at_start_f413/examples/usb_device/composite_audio_hid/inc/usb_conf.h.

◆ USB_EPT_AUTO_MALLOC_BUFFER

#define USB_EPT_AUTO_MALLOC_BUFFER

auto malloc usb endpoint buffer

usb auto malloc endpoint tx and rx buffer

Definition at line 62 of file project/at_start_f413/examples/usb_device/composite_audio_hid/inc/usb_conf.h.

◆ WM8988_REG_BITW16

#define WM8988_REG_BITW16 ((WM8988_R7_AUDIO_INTERFACE << 9) | 0x0042)

wm8988 bit width

Definition at line 65 of file composite_audio_hid/src/audio_codec.c.

Referenced by audio_codec_init().

◆ WM8988_REG_FREQ16K

#define WM8988_REG_FREQ16K ((WM8988_R8_SAMPLE_RATE << 9) | 0x0095)

Definition at line 60 of file composite_audio_hid/src/audio_codec.c.

Referenced by audio_codec_init(), and audio_codec_modify_freq().

◆ WM8988_REG_FREQ48K

#define WM8988_REG_FREQ48K ((WM8988_R8_SAMPLE_RATE << 9) | 0x0081)

wm8988 freq

Definition at line 59 of file composite_audio_hid/src/audio_codec.c.

Referenced by audio_codec_init(), and audio_codec_modify_freq().

Function Documentation

◆ audio_codec_init()

error_status audio_codec_init ( void )

audio codec init

Parameters
none
Return values
error status

Definition at line 799 of file composite_audio_hid/src/audio_codec.c.

Referenced by main().

◆ audio_codec_loop()

error_status audio_codec_loop ( void )

audio codec loop

Parameters
none
Return values
none

Definition at line 858 of file composite_audio_hid/src/audio_codec.c.

Referenced by main().

◆ audio_codec_mic_alt_setting()

void audio_codec_mic_alt_setting ( uint32_t alt_seting )

audio codec microphone alt setting config

Parameters
none
Return values
none

Definition at line 168 of file composite_audio_hid/src/audio_codec.c.

Referenced by audio_set_interface(), audio_set_interface(), class_event_handler(), and class_event_handler().

◆ audio_codec_mic_get_data()

uint32_t audio_codec_mic_get_data ( uint8_t * buffer )

codec microphone get data

Parameters
data data buffer
Return values
data len

Definition at line 285 of file composite_audio_hid/src/audio_codec.c.

Referenced by audio_set_interface(), audio_set_interface(), class_in_handler(), and class_in_handler().

◆ audio_codec_modify_freq()

void audio_codec_modify_freq ( uint32_t freq )

audio codec modify freq

Parameters
freq freq (wm8988 microphone and speaker must as same freq)
Return values
none

Definition at line 345 of file composite_audio_hid/src/audio_codec.c.

Referenced by audio_codec_set_mic_freq(), and audio_codec_set_spk_freq().

◆ audio_codec_set_mic_freq()

void audio_codec_set_mic_freq ( uint32_t freq )

audio codec set microphone freq

Parameters
freq freq (wm8988 microphone and speaker must same freq)
Return values
none

Definition at line 120 of file composite_audio_hid/src/audio_codec.c.

Referenced by class_ept0_rx_handler(), and class_ept0_rx_handler().

◆ audio_codec_set_mic_mute()

void audio_codec_set_mic_mute ( uint8_t mute )

audio codec set microphone mute

Parameters
mute mute state
Return values
none

Definition at line 183 of file composite_audio_hid/src/audio_codec.c.

Referenced by class_ept0_rx_handler(), and class_ept0_rx_handler().

◆ audio_codec_set_mic_volume()

void audio_codec_set_mic_volume ( uint16_t volume )

audio codec set microphone volume

Parameters
volume the new volume
Return values
none

Definition at line 205 of file composite_audio_hid/src/audio_codec.c.

Referenced by class_ept0_rx_handler(), and class_ept0_rx_handler().

◆ audio_codec_set_spk_freq()

void audio_codec_set_spk_freq ( uint32_t freq )

audio codec set speaker freq

Parameters
freq freq(wm8988 microphone and speaker must same freq)
Return values
none

Definition at line 136 of file composite_audio_hid/src/audio_codec.c.

Referenced by class_ept0_rx_handler(), and class_ept0_rx_handler().

◆ audio_codec_set_spk_mute()

void audio_codec_set_spk_mute ( uint8_t mute )

audio codec set speaker mute

Parameters
mute mute state
Return values
none

Definition at line 194 of file composite_audio_hid/src/audio_codec.c.

Referenced by class_ept0_rx_handler(), and class_ept0_rx_handler().

◆ audio_codec_set_spk_volume()

void audio_codec_set_spk_volume ( uint16_t volume )

audio codec set speaker volume

Parameters
volume the new volume
Return values
none

Definition at line 220 of file composite_audio_hid/src/audio_codec.c.

Referenced by class_ept0_rx_handler(), and class_ept0_rx_handler().

◆ audio_codec_spk_alt_setting()

void audio_codec_spk_alt_setting ( uint32_t alt_seting )

audio codec speaker alt setting config

Parameters
none
Return values
none

Definition at line 153 of file composite_audio_hid/src/audio_codec.c.

Referenced by audio_set_interface(), audio_set_interface(), class_event_handler(), and class_event_handler().

◆ audio_codec_spk_feedback()

uint8_t audio_codec_spk_feedback ( uint8_t * feedback )

codec speaker feedback

Parameters
feedback data buffer
Return values
feedback len

Definition at line 231 of file composite_audio_hid/src/audio_codec.c.

Referenced by audio_set_interface(), audio_set_interface(), class_in_handler(), and class_in_handler().

◆ audio_codec_spk_fifo_write()

void audio_codec_spk_fifo_write | ( | uint8_t * | data,
 |  | uint32_t | len )

codec speaker write fifo

audio codec interface

Parameters
data | data buffer
len | data length
Return values
none

Definition at line 247 of file composite_audio_hid/src/audio_codec.c.

Referenced by class_out_handler(), and class_out_handler().

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/usb_device/composite_audio_hid/src/at32f413_int.c.

◆ codec_i2s_init()

void codec_i2s_init ( audio_codec_type * param )

audio codec i2s init

Parameters
freq | audio sampling freq
bitw_format | bit width
Return values
error status

Definition at line 496 of file composite_audio_hid/src/audio_codec.c.

Referenced by audio_codec_init(), audio_codec_set_mic_freq(), and audio_codec_set_spk_freq().

◆ codec_i2s_reset()

void codec_i2s_reset ( void )

audio codec i2s reset

Parameters
none
Return values
none

Definition at line 482 of file composite_audio_hid/src/audio_codec.c.

Referenced by audio_codec_set_mic_freq(), and audio_codec_set_spk_freq().

◆ copy_buff()

void copy_buff | ( | uint16_t * | dest,
 |  | uint16_t * | src,
 |  | uint32_t | len )

copy buffer

Parameters
dest | dest data buffer
src | src data buffer
len | data length
Return values
none

Definition at line 388 of file composite_audio_hid/src/audio_codec.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/usb_device/composite_audio_hid/src/at32f413_int.c.

◆ DMA1_Channel3_IRQHandler()

void DMA1_Channel3_IRQHandler ( void )

this function handles dma1 channel3 interrupt.

Parameters
none
Return values
none

Definition at line 654 of file composite_audio_hid/src/audio_codec.c.

◆ DMA1_Channel4_IRQHandler()

void DMA1_Channel4_IRQHandler ( void )

this function handles dma1 channel4 interrupt.

Parameters
none
Return values
none

Definition at line 729 of file composite_audio_hid/src/audio_codec.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/usb_device/composite_audio_hid/src/at32f413_int.c.

◆ i2c_lowlevel_init()

void i2c_lowlevel_init ( i2c_handle_type * hi2c )

initializes peripherals used by the i2c.

Parameters
none
Return values
none

< gpio pins number 6

< gpio pins number 7

< gpio pins number 6

< gpio pins number 7

< gpio pins number 6

< gpio pins number 7

< gpio pins number 10

< gpio pins number 11

< gpio pins number 10

< gpio pins number 11

Definition at line 402 of file composite_audio_hid/src/audio_codec.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 123 of file project/at_start_f413/examples/usb_device/composite_audio_hid/src/main.c.

◆ mclk_tmr1_init()

void mclk_tmr1_init ( void )

mclk clock conifg

Parameters
none
Return values
none

Definition at line 440 of file composite_audio_hid/src/audio_codec.c.

Referenced by audio_codec_init().

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/usb_device/composite_audio_hid/src/at32f413_int.c.

◆ memset16_buffer()

void memset16_buffer | ( | uint16_t * | buffer,
 |  | uint32_t | set,
 |  | uint32_t | len )

buffer memset

Parameters
buffer | buffer
set | memset data
len | data length
Return values
none

Definition at line 372 of file composite_audio_hid/src/audio_codec.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/usb_device/composite_audio_hid/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/usb_device/composite_audio_hid/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/usb_device/composite_audio_hid/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/usb_device/composite_audio_hid/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/usb_device/composite_audio_hid/src/at32f413_int.c.

◆ usb_clock48m_select()

void usb_clock48m_select ( usb_clk48_s clk_s )

usb 48M clock select

Parameters
clk_s:USB_CLK_HICK,USB_CLK_HEXT
Return values
none

< acc hick trim

Definition at line 52 of file project/at_start_f413/examples/usb_device/composite_audio_hid/src/main.c.

Referenced by main().

◆ usb_delay_ms()

void usb_delay_ms ( uint32_t ms )

usb delay millisecond function.

Parameters
ms number of millisecond delay
Return values
none

Definition at line 180 of file project/at_start_f413/examples/usb_device/composite_audio_hid/src/main.c.

◆ usb_delay_us()

void usb_delay_us ( uint32_t us )

usb delay microsecond function.

Parameters
us number of microsecond delay
Return values
none

Definition at line 191 of file project/at_start_f413/examples/usb_device/composite_audio_hid/src/main.c.

◆ USBFS_L_CAN1_RX0_IRQHandler()

void USBFS_L_CAN1_RX0_IRQHandler ( void )

this function handles usb interrupt.

Parameters
none
Return values
none

Definition at line 170 of file project/at_start_f413/examples/usb_device/composite_audio_hid/src/main.c.

Variable Documentation

◆ audio_codec

audio_codec_type audio_codec

Definition at line 105 of file composite_audio_hid/src/audio_codec.c.

Referenced by audio_codec_init(), audio_codec_loop(), audio_codec_mic_get_data(), audio_codec_set_mic_freq(), audio_codec_set_mic_mute(), audio_codec_set_mic_volume(), audio_codec_set_spk_freq(), audio_codec_set_spk_mute(), audio_codec_set_spk_volume(), audio_codec_spk_feedback(), audio_codec_spk_fifo_write(), DMA1_Channel3_IRQHandler(), and DMA1_Channel4_IRQHandler().

◆ hi2cx

i2c_handle_type hi2cx

Definition at line 103 of file composite_audio_hid/src/audio_codec.c.

Referenced by audio_codec_init(), audio_codec_loop(), audio_codec_modify_freq(), DMA1_Channel4_IRQHandler(), DMA1_Channel5_IRQHandler(), DMA1_Channel6_IRQHandler(), DMA1_Channel7_IRQHandler(), I2C1_ERR_IRQHandler(), I2C1_EVT_IRQHandler(), I2C2_ERR_IRQHandler(), and I2C2_EVT_IRQHandler().

◆ mic_dma_buffer

uint16_t mic_dma_buffer[DMA_BUFFER_SIZE]

Definition at line 107 of file composite_audio_hid/src/audio_codec.c.

Referenced by codec_i2s_init(), and DMA1_Channel4_IRQHandler().

◆ reg_addr_data

uint16_t reg_addr_data[]

wm8988 register default value

Definition at line 70 of file composite_audio_hid/src/audio_codec.c.

Referenced by audio_codec_init().

◆ report_buf

uint8_t report_buf[0x40]

Definition at line 45 of file project/at_start_f413/examples/usb_device/composite_audio_hid/src/main.c.

Referenced by main().

◆ spk_dma_buffer

uint16_t spk_dma_buffer[DMA_BUFFER_SIZE]

Definition at line 106 of file composite_audio_hid/src/audio_codec.c.

Referenced by codec_i2s_init(), and DMA1_Channel3_IRQHandler().

◆ usb_core_dev

usbd_core_type usb_core_dev

Definition at line 43 of file project/at_start_f413/examples/usb_device/composite_audio_hid/src/main.c.

Referenced by main(), and USBFS_L_CAN1_RX0_IRQHandler().


AT32F413 Firmwary Library: USB_device_audio_hid_codec_reg_definition

Macros
USB_device_audio_hid_codec_reg_definition
AT32F413_periph_examples » USB_device_audio_hid

Macros

#define | WM8988_R0_LEFT_INPUT_VOLUME 0x00 /*Left channel PGA control*/
#define | WM8988_R1_RIGHT_INPUT_VOLUME 0x01 /*Right channel PGA control*/
#define | WM8988_R2_LOUT1_VOLUME 0x02
#define | WM8988_R3_ROUT1_VOLUME 0x03
#define | WM8988_R4_RESERVED 0x04
#define | WM8988_R5_ADC_DAC_CONTROL 0x05
#define | WM8988_R6_RESERVED 0x06
#define | WM8988_R7_AUDIO_INTERFACE 0x07
#define | WM8988_R8_SAMPLE_RATE 0x08
#define | WM8988_R9_RESERVED 0x09
#define | WM8988_R10_LEFT_DAC_VOLUME 0x0A
#define | WM8988_R11_RIGHT_DAC_VOLUME 0x0B
#define | WM8988_R12_BASS_CONTROL 0x0C
#define | WM8988_R13_TREBLE_CONTROL 0x0D
#define | WM8988_R14_
#define | WM8988_R15_RESET 0x0F
#define | WM8988_R16_3D_CONTROL 0x10
#define | WM8988_R17_ALC1 0x11
#define | WM8988_R18_ALC2 0x12
#define | WM8988_R19_ALC3 0x13
#define | WM8988_R20_NOISE_GATE 0x14
#define | WM8988_R21_LEFT_ADC_VOLUME 0x15
#define | WM8988_R22_RIGHT_ADC_VOLUME 0x16
#define | WM8988_R23_ADDITIONAL_1_CONTROL 0x17
#define | WM8988_R24_ADDITIONAL_2_CONTROL 0x18
#define | WM8988_R25_PWR_1_MGMT 0x19
#define | WM8988_R26_PWR_2_MGMT 0x1A
#define | WM8988_R27_ADDITIONAL_3_CONTROL 0x1B
#define | WM8988_R31_ADC_INPUT_MODE 0x1F
#define | WM8988_R32_ADC_L_SIGNAL_PATH 0x20
#define | WM8988_R33_ADC_R_SIGNAL_PATH 0x21
#define | WM8988_R34_LEFT_OUT_MIX_1 0x22
#define | WM8988_R35_LEFT_OUT_MIX_2 0x23
#define | WM8988_R36_RIGHT_OUT_MIX_1 0x24
#define | WM8988_R37_RIGHT_OUT_MIX_2 0x25
#define | WM8988_R38_RESERVED
#define | WM8988_R39_RESERVED
#define | WM8988_R40_LOUT2_VOLUME 0x28
#define | WM8988_R41_ROUT2_VOLUME 0x29
#define | WM8988_R42_RESERVED
#define | WM8988_R43_LOW_POWER_PALYBACK 0x43
#define | WM8988_I2C_ADDR_CSB_LOW 0x34
#define | WM8988_I2C_ADDR_CSB_HIGH 0x36

Detailed Description

Macro Definition Documentation

◆ WM8988_I2C_ADDR_CSB_HIGH

#define WM8988_I2C_ADDR_CSB_HIGH 0x36

Definition at line 93 of file composite_audio_hid/inc/audio_codec.h.

◆ WM8988_I2C_ADDR_CSB_LOW

#define WM8988_I2C_ADDR_CSB_LOW 0x34

Definition at line 92 of file composite_audio_hid/inc/audio_codec.h.

◆ WM8988_R0_LEFT_INPUT_VOLUME

#define WM8988_R0_LEFT_INPUT_VOLUME 0x00 /*Left channel PGA control*/

Definition at line 49 of file composite_audio_hid/inc/audio_codec.h.

◆ WM8988_R10_LEFT_DAC_VOLUME

#define WM8988_R10_LEFT_DAC_VOLUME 0x0A

Definition at line 59 of file composite_audio_hid/inc/audio_codec.h.

◆ WM8988_R11_RIGHT_DAC_VOLUME

#define WM8988_R11_RIGHT_DAC_VOLUME 0x0B

Definition at line 60 of file composite_audio_hid/inc/audio_codec.h.

◆ WM8988_R12_BASS_CONTROL

#define WM8988_R12_BASS_CONTROL 0x0C

Definition at line 61 of file composite_audio_hid/inc/audio_codec.h.

◆ WM8988_R13_TREBLE_CONTROL

#define WM8988_R13_TREBLE_CONTROL 0x0D

Definition at line 62 of file composite_audio_hid/inc/audio_codec.h.

◆ WM8988_R14_

#define WM8988_R14_

Definition at line 63 of file composite_audio_hid/inc/audio_codec.h.

◆ WM8988_R15_RESET

#define WM8988_R15_RESET 0x0F

Definition at line 64 of file composite_audio_hid/inc/audio_codec.h.

◆ WM8988_R16_3D_CONTROL

#define WM8988_R16_3D_CONTROL 0x10

Definition at line 65 of file composite_audio_hid/inc/audio_codec.h.

◆ WM8988_R17_ALC1

#define WM8988_R17_ALC1 0x11

Definition at line 66 of file composite_audio_hid/inc/audio_codec.h.

◆ WM8988_R18_ALC2

#define WM8988_R18_ALC2 0x12

Definition at line 67 of file composite_audio_hid/inc/audio_codec.h.

◆ WM8988_R19_ALC3

#define WM8988_R19_ALC3 0x13

Definition at line 68 of file composite_audio_hid/inc/audio_codec.h.

◆ WM8988_R1_RIGHT_INPUT_VOLUME

#define WM8988_R1_RIGHT_INPUT_VOLUME 0x01 /*Right channel PGA control*/

Definition at line 50 of file composite_audio_hid/inc/audio_codec.h.

◆ WM8988_R20_NOISE_GATE

#define WM8988_R20_NOISE_GATE 0x14

Definition at line 69 of file composite_audio_hid/inc/audio_codec.h.

◆ WM8988_R21_LEFT_ADC_VOLUME

#define WM8988_R21_LEFT_ADC_VOLUME 0x15

Definition at line 70 of file composite_audio_hid/inc/audio_codec.h.

◆ WM8988_R22_RIGHT_ADC_VOLUME

#define WM8988_R22_RIGHT_ADC_VOLUME 0x16

Definition at line 71 of file composite_audio_hid/inc/audio_codec.h.

◆ WM8988_R23_ADDITIONAL_1_CONTROL

#define WM8988_R23_ADDITIONAL_1_CONTROL 0x17

Definition at line 72 of file composite_audio_hid/inc/audio_codec.h.

◆ WM8988_R24_ADDITIONAL_2_CONTROL

#define WM8988_R24_ADDITIONAL_2_CONTROL 0x18

Definition at line 73 of file composite_audio_hid/inc/audio_codec.h.

◆ WM8988_R25_PWR_1_MGMT

#define WM8988_R25_PWR_1_MGMT 0x19

Definition at line 74 of file composite_audio_hid/inc/audio_codec.h.

◆ WM8988_R26_PWR_2_MGMT

#define WM8988_R26_PWR_2_MGMT 0x1A

Definition at line 75 of file composite_audio_hid/inc/audio_codec.h.

◆ WM8988_R27_ADDITIONAL_3_CONTROL

#define WM8988_R27_ADDITIONAL_3_CONTROL 0x1B

Definition at line 76 of file composite_audio_hid/inc/audio_codec.h.

◆ WM8988_R2_LOUT1_VOLUME

#define WM8988_R2_LOUT1_VOLUME 0x02

Definition at line 51 of file composite_audio_hid/inc/audio_codec.h.

◆ WM8988_R31_ADC_INPUT_MODE

#define WM8988_R31_ADC_INPUT_MODE 0x1F

Definition at line 78 of file composite_audio_hid/inc/audio_codec.h.

◆ WM8988_R32_ADC_L_SIGNAL_PATH

#define WM8988_R32_ADC_L_SIGNAL_PATH 0x20

Definition at line 79 of file composite_audio_hid/inc/audio_codec.h.

◆ WM8988_R33_ADC_R_SIGNAL_PATH

#define WM8988_R33_ADC_R_SIGNAL_PATH 0x21

Definition at line 80 of file composite_audio_hid/inc/audio_codec.h.

◆ WM8988_R34_LEFT_OUT_MIX_1

#define WM8988_R34_LEFT_OUT_MIX_1 0x22

Definition at line 81 of file composite_audio_hid/inc/audio_codec.h.

◆ WM8988_R35_LEFT_OUT_MIX_2

#define WM8988_R35_LEFT_OUT_MIX_2 0x23

Definition at line 82 of file composite_audio_hid/inc/audio_codec.h.

◆ WM8988_R36_RIGHT_OUT_MIX_1

#define WM8988_R36_RIGHT_OUT_MIX_1 0x24

Definition at line 83 of file composite_audio_hid/inc/audio_codec.h.

◆ WM8988_R37_RIGHT_OUT_MIX_2

#define WM8988_R37_RIGHT_OUT_MIX_2 0x25

Definition at line 84 of file composite_audio_hid/inc/audio_codec.h.

◆ WM8988_R38_RESERVED

#define WM8988_R38_RESERVED

Definition at line 85 of file composite_audio_hid/inc/audio_codec.h.

◆ WM8988_R39_RESERVED

#define WM8988_R39_RESERVED

Definition at line 86 of file composite_audio_hid/inc/audio_codec.h.

◆ WM8988_R3_ROUT1_VOLUME

#define WM8988_R3_ROUT1_VOLUME 0x03

Definition at line 52 of file composite_audio_hid/inc/audio_codec.h.

◆ WM8988_R40_LOUT2_VOLUME

#define WM8988_R40_LOUT2_VOLUME 0x28

Definition at line 87 of file composite_audio_hid/inc/audio_codec.h.

◆ WM8988_R41_ROUT2_VOLUME

#define WM8988_R41_ROUT2_VOLUME 0x29

Definition at line 88 of file composite_audio_hid/inc/audio_codec.h.

◆ WM8988_R42_RESERVED

#define WM8988_R42_RESERVED

Definition at line 89 of file composite_audio_hid/inc/audio_codec.h.

◆ WM8988_R43_LOW_POWER_PALYBACK

#define WM8988_R43_LOW_POWER_PALYBACK 0x43

Definition at line 90 of file composite_audio_hid/inc/audio_codec.h.

◆ WM8988_R4_RESERVED

#define WM8988_R4_RESERVED 0x04

Definition at line 53 of file composite_audio_hid/inc/audio_codec.h.

◆ WM8988_R5_ADC_DAC_CONTROL

#define WM8988_R5_ADC_DAC_CONTROL 0x05

Definition at line 54 of file composite_audio_hid/inc/audio_codec.h.

◆ WM8988_R6_RESERVED

#define WM8988_R6_RESERVED 0x06

Definition at line 55 of file composite_audio_hid/inc/audio_codec.h.

◆ WM8988_R7_AUDIO_INTERFACE

#define WM8988_R7_AUDIO_INTERFACE 0x07

Definition at line 56 of file composite_audio_hid/inc/audio_codec.h.

◆ WM8988_R8_SAMPLE_RATE

#define WM8988_R8_SAMPLE_RATE 0x08

Definition at line 57 of file composite_audio_hid/inc/audio_codec.h.

◆ WM8988_R9_RESERVED

#define WM8988_R9_RESERVED 0x09

Definition at line 58 of file composite_audio_hid/inc/audio_codec.h.


AT32F413 Firmwary Library: USB_device_audio_hid_codec_pin_definition

Macros
USB_device_audio_hid_codec_pin_definition
AT32F413_periph_examples » USB_device_audio_hid

Macros

#define | I2S1_WS_PIN GPIO_PINS_4
#define | I2S1_CK_PIN GPIO_PINS_5
#define | I2S1_SD_PIN GPIO_PINS_7
#define | I2S1_GPIO GPIOA
#define | I2S1_GPIO_CRM_CLK CRM_GPIOA_PERIPH_CLOCK
#define | I2S1_DT_ADDRESS (&(SPI1->dt))
#define | I2S2_WS_PIN GPIO_PINS_12
#define | I2S2_CK_PIN GPIO_PINS_13
#define | I2S2_SD_PIN GPIO_PINS_15
#define | I2S2_GPIO GPIOB
#define | I2S2_GPIO_CRM_CLK CRM_GPIOB_PERIPH_CLOCK
#define | I2S2_DT_ADDRESS (&(SPI2->dt))
#define | SPK_TX_FIFO_SIZE (1024 * 4)

Detailed Description

Macro Definition Documentation

◆ I2S1_CK_PIN

#define I2S1_CK_PIN GPIO_PINS_5

Definition at line 103 of file composite_audio_hid/inc/audio_codec.h.

◆ I2S1_DT_ADDRESS

#define I2S1_DT_ADDRESS (&(SPI1->dt))

Definition at line 108 of file composite_audio_hid/inc/audio_codec.h.

◆ I2S1_GPIO

#define I2S1_GPIO GPIOA

Definition at line 106 of file composite_audio_hid/inc/audio_codec.h.

◆ I2S1_GPIO_CRM_CLK

#define I2S1_GPIO_CRM_CLK CRM_GPIOA_PERIPH_CLOCK

Definition at line 107 of file composite_audio_hid/inc/audio_codec.h.

◆ I2S1_SD_PIN

#define I2S1_SD_PIN GPIO_PINS_7

Definition at line 104 of file composite_audio_hid/inc/audio_codec.h.

◆ I2S1_WS_PIN

#define I2S1_WS_PIN GPIO_PINS_4

Definition at line 102 of file composite_audio_hid/inc/audio_codec.h.

◆ I2S2_CK_PIN

#define I2S2_CK_PIN GPIO_PINS_13

Definition at line 112 of file composite_audio_hid/inc/audio_codec.h.

◆ I2S2_DT_ADDRESS

#define I2S2_DT_ADDRESS (&(SPI2->dt))

Definition at line 118 of file composite_audio_hid/inc/audio_codec.h.

◆ I2S2_GPIO

#define I2S2_GPIO GPIOB

Definition at line 116 of file composite_audio_hid/inc/audio_codec.h.

◆ I2S2_GPIO_CRM_CLK

#define I2S2_GPIO_CRM_CLK CRM_GPIOB_PERIPH_CLOCK

Definition at line 117 of file composite_audio_hid/inc/audio_codec.h.

◆ I2S2_SD_PIN

#define I2S2_SD_PIN GPIO_PINS_15

Definition at line 113 of file composite_audio_hid/inc/audio_codec.h.

◆ I2S2_WS_PIN

#define I2S2_WS_PIN GPIO_PINS_12

Definition at line 111 of file composite_audio_hid/inc/audio_codec.h.

◆ SPK_TX_FIFO_SIZE

#define SPK_TX_FIFO_SIZE (1024 * 4)

Definition at line 120 of file composite_audio_hid/inc/audio_codec.h.


AT32F413 Firmwary Library: USB_device_audio_hid_codec_exported_functions

Data Structures | Macros | Functions
USB_device_audio_hid_codec_exported_functions
AT32F413_periph_examples » USB_device_audio_hid

Data Structures

struct audio_codec_type

Macros

#define | MIC_BUFFER_SIZE 1024
#define | SPK_BUFFER_SIZE 4096
#define | DMA_BUFFER_SIZE 288

Functions

error_status | audio_codec_init (void)
audio codec init
error_status | audio_codec_loop (void)
audio codec loop
void | audio_codec_modify_freq (uint32_t freq)
audio codec modify freq
void | audio_codec_spk_fifo_write (uint8_t *data, uint32_t len)
audio codec interface
uint32_t | audio_codec_mic_get_data (uint8_t *buffer)
codec microphone get data
uint8_t | audio_codec_spk_feedback (uint8_t *feedback)
codec speaker feedback
void | audio_codec_spk_alt_setting (uint32_t alt_seting)
audio codec speaker alt setting config
void | audio_codec_mic_alt_setting (uint32_t alt_seting)
audio codec microphone alt setting config
void | audio_codec_set_mic_mute (uint8_t mute)
audio codec set microphone mute
void | audio_codec_set_spk_mute (uint8_t mute)
audio codec set speaker mute
void | audio_codec_set_mic_volume (uint16_t volume)
audio codec set microphone volume
void | audio_codec_set_spk_volume (uint16_t volume)
audio codec set speaker volume
void | audio_codec_set_mic_freq (uint32_t freq)
audio codec set microphone freq
void | audio_codec_set_spk_freq (uint32_t freq)
audio codec set speaker freq

Detailed Description

Macro Definition Documentation

◆ DMA_BUFFER_SIZE

#define DMA_BUFFER_SIZE 288

Definition at line 131 of file composite_audio_hid/inc/audio_codec.h.

◆ MIC_BUFFER_SIZE

#define MIC_BUFFER_SIZE 1024

Definition at line 129 of file composite_audio_hid/inc/audio_codec.h.

◆ SPK_BUFFER_SIZE

#define SPK_BUFFER_SIZE 4096

Definition at line 130 of file composite_audio_hid/inc/audio_codec.h.

Function Documentation

◆ audio_codec_init()

error_status audio_codec_init ( void )

audio codec init

Parameters
none
Return values
error status

Definition at line 797 of file audio/src/audio_codec.c.

◆ audio_codec_loop()

error_status audio_codec_loop ( void )

audio codec loop

Parameters
none
Return values
none

Definition at line 856 of file audio/src/audio_codec.c.

◆ audio_codec_mic_alt_setting()

void audio_codec_mic_alt_setting ( uint32_t alt_seting )

audio codec microphone alt setting config

Parameters
none
Return values
none

Definition at line 168 of file audio/src/audio_codec.c.

◆ audio_codec_mic_get_data()

uint32_t audio_codec_mic_get_data ( uint8_t * buffer )

codec microphone get data

Parameters
data data buffer
Return values
data len

Definition at line 285 of file audio/src/audio_codec.c.

◆ audio_codec_modify_freq()

void audio_codec_modify_freq ( uint32_t freq )

audio codec modify freq

Parameters
freq freq (wm8988 microphone and speaker must as same freq)
Return values
none

Definition at line 345 of file audio/src/audio_codec.c.

Referenced by audio_codec_set_mic_freq(), and audio_codec_set_spk_freq().

◆ audio_codec_set_mic_freq()

void audio_codec_set_mic_freq ( uint32_t freq )

audio codec set microphone freq

Parameters
freq freq (wm8988 microphone and speaker must same freq)
Return values
none

Definition at line 120 of file audio/src/audio_codec.c.

◆ audio_codec_set_mic_mute()

void audio_codec_set_mic_mute ( uint8_t mute )

audio codec set microphone mute

Parameters
mute mute state
Return values
none

Definition at line 183 of file audio/src/audio_codec.c.

◆ audio_codec_set_mic_volume()

void audio_codec_set_mic_volume ( uint16_t volume )

audio codec set microphone volume

Parameters
volume the new volume
Return values
none

Definition at line 205 of file audio/src/audio_codec.c.

◆ audio_codec_set_spk_freq()

void audio_codec_set_spk_freq ( uint32_t freq )

audio codec set speaker freq

Parameters
freq freq(wm8988 microphone and speaker must same freq)
Return values
none

Definition at line 136 of file audio/src/audio_codec.c.

◆ audio_codec_set_spk_mute()

void audio_codec_set_spk_mute ( uint8_t mute )

audio codec set speaker mute

Parameters
mute mute state
Return values
none

Definition at line 194 of file audio/src/audio_codec.c.

◆ audio_codec_set_spk_volume()

void audio_codec_set_spk_volume ( uint16_t volume )

audio codec set speaker volume

Parameters
volume the new volume
Return values
none

Definition at line 220 of file audio/src/audio_codec.c.

◆ audio_codec_spk_alt_setting()

void audio_codec_spk_alt_setting ( uint32_t alt_seting )

audio codec speaker alt setting config

Parameters
none
Return values
none

Definition at line 153 of file audio/src/audio_codec.c.

◆ audio_codec_spk_feedback()

uint8_t audio_codec_spk_feedback ( uint8_t * feedback )

codec speaker feedback

Parameters
feedback data buffer
Return values
feedback len

Definition at line 231 of file audio/src/audio_codec.c.

◆ audio_codec_spk_fifo_write()

void audio_codec_spk_fifo_write | ( | uint8_t * | data,
 |  | uint32_t | len )

audio codec interface

audio codec interface

Parameters
data | data buffer
len | data length
Return values
none

Definition at line 247 of file audio/src/audio_codec.c.


AT32F413 Firmwary Library: USB_device_composite_vcp_keyboard

Macros | Functions | Variables
USB_device_composite_vcp_keyboard
AT32F413_periph_examples

Macros

#define | USB_EPT_AUTO_MALLOC_BUFFER
usb endpoint max num define
#define | USB_EPT_AUTO_MALLOC_BUFFER
usb endpoint max num define

Functions

void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.
void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | keyboard_send_string (void *udev, uint8_t *string, uint8_t len)
keyboard send string
void | usb_clock48m_select (usb_clk48_s clk_s)
usb 48M clock select
int | main (void)
main function.
void | USBFS_L_CAN1_RX0_IRQHandler (void)
this function handles usb interrupt.

Variables

usbd_core_type usb_core_dev
uint8_t usb_buffer [256]

Detailed Description

Macro Definition Documentation

◆ USB_EPT_AUTO_MALLOC_BUFFER [1/2]

#define USB_EPT_AUTO_MALLOC_BUFFER

usb endpoint max num define

usb buffer extend to 768-1280 bytes

auto malloc usb endpoint buffer usb auto malloc endpoint tx and rx buffer

Definition at line 62 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/usb_conf.h.

◆ USB_EPT_AUTO_MALLOC_BUFFER [2/2]

#define USB_EPT_AUTO_MALLOC_BUFFER

usb endpoint max num define

usb buffer extend to 768-1280 bytes

auto malloc usb endpoint buffer usb auto malloc endpoint tx and rx buffer

Definition at line 62 of file project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/usb_conf.h.

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/at32f413_int.c.

◆ keyboard_send_string()

void keyboard_send_string | ( | void * | udev,
 |  | uint8_t * | string,
 |  | uint8_t | len )

keyboard send string

Parameters
string | send string
len | send string length
Return values
none

Definition at line 122 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/main.c.

Referenced by main().

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 157 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/at32f413_int.c.

◆ usb_clock48m_select()

void usb_clock48m_select ( usb_clk48_s clk_s )

usb 48M clock select

Parameters
clk_s:USB_CLK_HICK,USB_CLK_HEXT
Return values
none

< acc hick trim

Definition at line 50 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/main.c.

Referenced by main().

◆ usb_delay_ms()

void usb_delay_ms ( uint32_t ms )

usb delay millisecond function.

Parameters
ms number of millisecond delay
Return values
none

Definition at line 237 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/main.c.

◆ usb_delay_us()

void usb_delay_us ( uint32_t us )

usb delay microsecond function.

Parameters
us number of microsecond delay
Return values
none

Definition at line 248 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/main.c.

◆ USBFS_L_CAN1_RX0_IRQHandler()

void USBFS_L_CAN1_RX0_IRQHandler ( void )

this function handles usb interrupt.

Parameters
none
Return values
none

Definition at line 227 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/main.c.

Variable Documentation

◆ usb_buffer

uint8_t usb_buffer[256]

Definition at line 42 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/main.c.

Referenced by main().

◆ usb_core_dev

usbd_core_type usb_core_dev

Definition at line 41 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/main.c.

Referenced by keyboard_send_string(), main(), and USBFS_L_CAN1_RX0_IRQHandler().


AT32F413 Firmwary Library: USB_device_msc

Macros | Functions | Variables
USB_device_msc
AT32F413_periph_examples

Macros

#define | INTERNAL_FLASH_LUN 0
#define | SPI_FLASH_LUN 1
#define | SD_LUN 2
#define | USB_FLASH_ADDR_OFFSET 0x08005000
#define | SECTOR_SIZE_1K 1024
#define | SECTOR_SIZE_2K 2048
#define | SECTOR_SIZE_4K 4096
#define | INTERNAL_FLASH_LUN 0
#define | SPI_FLASH_LUN 1
#define | SD_LUN 2
#define | USB_FLASH_ADDR_OFFSET 0x08008000
#define | SECTOR_SIZE_1K 1024
#define | SECTOR_SIZE_2K 2048
#define | SECTOR_SIZE_4K 4096
#define | USB_EPT_AUTO_MALLOC_BUFFER
usb endpoint max num define

Functions

uint8_t * | get_inquiry (uint8_t lun)
get disk inquiry
usb_sts_type | msc_disk_read (uint8_t lun, uint64_t addr, uint8_t *read_buf, uint32_t len)
disk read
usb_sts_type | msc_disk_write (uint8_t lun, uint64_t addr, uint8_t *buf, uint32_t len)
disk write
usb_sts_type | msc_disk_capacity (uint8_t lun, uint32_t *blk_nbr, uint32_t *blk_size)
disk capacity
void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.
void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | usb_clock48m_select (usb_clk48_s clk_s)
usb 48M clock select
int | main (void)
main function.
void | USBFS_L_CAN1_RX0_IRQHandler (void)
this function handles usb interrupt.

Variables

uint32_t | sector_size = 2048
uint32_t | msc_flash_size
uint8_t | scsi_inquiry [MSC_SUPPORT_MAX_LUN][SCSI_INQUIRY_DATA_LENGTH]
usbd_core_type usb_core_dev
uint32_t | sector_size = 2048
uint32_t | msc_flash_size
uint8_t | scsi_inquiry [1][36]

Detailed Description

Macro Definition Documentation

◆ INTERNAL_FLASH_LUN [1/2]

#define INTERNAL_FLASH_LUN 0

Definition at line 44 of file composite_vcp_msc/inc/msc_diskio.h.

Referenced by msc_disk_capacity().

◆ INTERNAL_FLASH_LUN [2/2]

#define INTERNAL_FLASH_LUN 0

Definition at line 44 of file msc/inc/msc_diskio.h.

◆ SD_LUN [1/2]

#define SD_LUN 2

Definition at line 46 of file composite_vcp_msc/inc/msc_diskio.h.

Referenced by msc_disk_capacity().

◆ SD_LUN [2/2]

#define SD_LUN 2

Definition at line 46 of file msc/inc/msc_diskio.h.

◆ SECTOR_SIZE_1K [1/2]

#define SECTOR_SIZE_1K 1024

Definition at line 50 of file composite_vcp_msc/inc/msc_diskio.h.

Referenced by iap_erase_sector(), iap_init(), and msc_disk_capacity().

◆ SECTOR_SIZE_1K [2/2]

#define SECTOR_SIZE_1K 1024

Definition at line 50 of file msc/inc/msc_diskio.h.

◆ SECTOR_SIZE_2K [1/2]

#define SECTOR_SIZE_2K 2048

Definition at line 51 of file composite_vcp_msc/inc/msc_diskio.h.

Referenced by iap_erase_sector(), iap_init(), and msc_disk_capacity().

◆ SECTOR_SIZE_2K [2/2]

#define SECTOR_SIZE_2K 2048

Definition at line 51 of file msc/inc/msc_diskio.h.

◆ SECTOR_SIZE_4K [1/2]

#define SECTOR_SIZE_4K 4096

Definition at line 52 of file composite_vcp_msc/inc/msc_diskio.h.

Referenced by iap_erase_sector().

◆ SECTOR_SIZE_4K [2/2]

#define SECTOR_SIZE_4K 4096

Definition at line 52 of file msc/inc/msc_diskio.h.

◆ SPI_FLASH_LUN [1/2]

#define SPI_FLASH_LUN 1

Definition at line 45 of file composite_vcp_msc/inc/msc_diskio.h.

Referenced by msc_disk_capacity().

◆ SPI_FLASH_LUN [2/2]

#define SPI_FLASH_LUN 1

Definition at line 45 of file msc/inc/msc_diskio.h.

◆ USB_EPT_AUTO_MALLOC_BUFFER

#define USB_EPT_AUTO_MALLOC_BUFFER

usb endpoint max num define

usb buffer extend to 768-1280 bytes

auto malloc usb endpoint buffer usb auto malloc endpoint tx and rx buffer

Definition at line 62 of file project/at_start_f413/examples/usb_device/msc/inc/usb_conf.h.

◆ USB_FLASH_ADDR_OFFSET [1/2]

#define USB_FLASH_ADDR_OFFSET 0x08005000

Definition at line 48 of file composite_vcp_msc/inc/msc_diskio.h.

Referenced by msc_disk_capacity(), msc_disk_read(), and msc_disk_write().

◆ USB_FLASH_ADDR_OFFSET [2/2]

#define USB_FLASH_ADDR_OFFSET 0x08008000

Definition at line 48 of file msc/inc/msc_diskio.h.

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/usb_device/msc/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/usb_device/msc/src/at32f413_int.c.

◆ get_inquiry()

uint8_t * get_inquiry ( uint8_t lun )

get disk inquiry

Parameters
lun logical units number
Return values
inquiry string

Definition at line 58 of file composite_vcp_msc/src/msc_diskio.c.

Referenced by bot_scsi_inquiry().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/usb_device/msc/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/usb_device/msc/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/usb_device/msc/src/at32f413_int.c.

◆ msc_disk_capacity()

usb_sts_type msc_disk_capacity | ( | uint8_t | lun,
 |  | uint32_t * | blk_nbr,
 |  | uint32_t * | blk_size )

disk capacity

Parameters
lun | logical units number
blk_nbr | pointer to number of block
blk_size | pointer to block size
Return values
status of usb_sts_type

Definition at line 135 of file composite_vcp_msc/src/msc_diskio.c.

Referenced by bot_scsi_capacity(), and bot_scsi_format_capacity().

◆ msc_disk_read()

usb_sts_type msc_disk_read | ( | uint8_t | lun,
 |  | uint64_t | addr,
 |  | uint8_t * | read_buf,
 |  | uint32_t | len )

disk read

Parameters
lun | logical units number
addr | logical address
read_buf | pointer to read buffer
len | read length
Return values
status of usb_sts_type

Definition at line 74 of file composite_vcp_msc/src/msc_diskio.c.

Referenced by bot_scsi_read10().

◆ msc_disk_write()

usb_sts_type msc_disk_write | ( | uint8_t | lun,
 |  | uint64_t | addr,
 |  | uint8_t * | buf,
 |  | uint32_t | len )

disk write

Parameters
lun | logical units number
addr | logical address
buf | pointer to write buffer
len | write length
Return values
status of usb_sts_type

Definition at line 101 of file composite_vcp_msc/src/msc_diskio.c.

Referenced by bot_scsi_write10().

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/usb_device/msc/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/usb_device/msc/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/usb_device/msc/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/usb_device/msc/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/usb_device/msc/src/at32f413_int.c.

◆ usb_clock48m_select()

void usb_clock48m_select ( usb_clk48_s clk_s )

usb 48M clock select

Parameters
clk_s:USB_CLK_HICK,USB_CLK_HEXT
Return values
none

< acc hick trim

Definition at line 50 of file project/at_start_f413/examples/usb_device/msc/src/main.c.

Referenced by main().

◆ usb_delay_ms()

void usb_delay_ms ( uint32_t ms )

usb delay millisecond function.

Parameters
ms number of millisecond delay
Return values
none

Definition at line 165 of file project/at_start_f413/examples/usb_device/msc/src/main.c.

◆ usb_delay_us()

void usb_delay_us ( uint32_t us )

usb delay microsecond function.

Parameters
us number of microsecond delay
Return values
none

Definition at line 176 of file project/at_start_f413/examples/usb_device/msc/src/main.c.

◆ USBFS_L_CAN1_RX0_IRQHandler()

void USBFS_L_CAN1_RX0_IRQHandler ( void )

this function handles usb interrupt.

Parameters
none
Return values
none

Definition at line 155 of file project/at_start_f413/examples/usb_device/msc/src/main.c.

Variable Documentation

◆ msc_flash_size [1/2]

uint32_t msc_flash_size

Definition at line 36 of file composite_vcp_msc/src/msc_diskio.c.

Referenced by msc_disk_capacity().

◆ msc_flash_size [2/2]

uint32_t msc_flash_size

Definition at line 36 of file msc/src/msc_diskio.c.

◆ scsi_inquiry [1/2]

uint8_t scsi_inquiry[1][36]
Initial value:
=
{
{
0x00,
0x80,
0x00,
0x01,
36 - 5,
0x00, 0x00, 0x00,
'A', 'T', '3', '2', ' ', ' ', ' ', ' ',
'D', 'i', 's', 'k', '0', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
'2', '.', '0', '0'
}
}

Definition at line 37 of file msc/src/msc_diskio.c.

◆ scsi_inquiry [2/2]

uint8_t scsi_inquiry[MSC_SUPPORT_MAX_LUN][SCSI_INQUIRY_DATA_LENGTH]
Initial value:
=
{
{
0x00,
0x80,
0x00,
0x01,
SCSI_INQUIRY_DATA_LENGTH - 5,
0x00, 0x00, 0x00,
'A', 'T', '3', '2', ' ', ' ', ' ', ' ',
'D', 'i', 's', 'k', '0', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
'2', '.', '0', '0'
}
}
SCSI_INQUIRY_DATA_LENGTH
#define SCSI_INQUIRY_DATA_LENGTH
Definition cdc_msc_class.h:156

Definition at line 37 of file composite_vcp_msc/src/msc_diskio.c.

Referenced by get_inquiry().

◆ sector_size [1/2]

uint32_t sector_size = 2048

Definition at line 35 of file composite_vcp_msc/src/msc_diskio.c.

Referenced by msc_disk_capacity(), and sector_read().

◆ sector_size [2/2]

uint32_t sector_size = 2048

Definition at line 35 of file msc/src/msc_diskio.c.

◆ usb_core_dev

usbd_core_type usb_core_dev

Definition at line 42 of file project/at_start_f413/examples/usb_device/msc/src/main.c.

Referenced by main(), and USBFS_L_CAN1_RX0_IRQHandler().


AT32F413 Firmwary Library: USB_device_composite_vcp_msc

Functions | Variables
USB_device_composite_vcp_msc
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | usb_clock48m_select (usb_clk48_s clk_s)
usb 48M clock select
int | main (void)
main function.
void | USBFS_L_CAN1_RX0_IRQHandler (void)
this function handles usb interrupt.
void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.

Variables

usbd_core_type usb_core_dev
uint8_t usb_buffer [256]

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/usb_device/composite_vcp_msc/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/usb_device/composite_vcp_msc/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/usb_device/composite_vcp_msc/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 120 of file project/at_start_f413/examples/usb_device/composite_vcp_msc/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/usb_device/composite_vcp_msc/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/usb_device/composite_vcp_msc/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/usb_device/composite_vcp_msc/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/usb_device/composite_vcp_msc/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/usb_device/composite_vcp_msc/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/usb_device/composite_vcp_msc/src/at32f413_int.c.

◆ usb_clock48m_select()

void usb_clock48m_select ( usb_clk48_s clk_s )

usb 48M clock select

Parameters
clk_s:USB_CLK_HICK,USB_CLK_HEXT
Return values
none

< acc hick trim

Definition at line 49 of file project/at_start_f413/examples/usb_device/composite_vcp_msc/src/main.c.

Referenced by main().

◆ usb_delay_ms()

void usb_delay_ms ( uint32_t ms )

usb delay millisecond function.

Parameters
ms number of millisecond delay
Return values
none

Definition at line 195 of file project/at_start_f413/examples/usb_device/composite_vcp_msc/src/main.c.

◆ usb_delay_us()

void usb_delay_us ( uint32_t us )

usb delay microsecond function.

Parameters
us number of microsecond delay
Return values
none

Definition at line 206 of file project/at_start_f413/examples/usb_device/composite_vcp_msc/src/main.c.

◆ USBFS_L_CAN1_RX0_IRQHandler()

void USBFS_L_CAN1_RX0_IRQHandler ( void )

this function handles usb interrupt.

Parameters
none
Return values
none

Definition at line 185 of file project/at_start_f413/examples/usb_device/composite_vcp_msc/src/main.c.

Variable Documentation

◆ usb_buffer

uint8_t usb_buffer[256]

Definition at line 42 of file project/at_start_f413/examples/usb_device/composite_vcp_msc/src/main.c.

Referenced by main().

◆ usb_core_dev

usbd_core_type usb_core_dev

Definition at line 41 of file project/at_start_f413/examples/usb_device/composite_vcp_msc/src/main.c.

Referenced by main(), and USBFS_L_CAN1_RX0_IRQHandler().


AT32F413 Firmwary Library: USB_device_custom_hid

Macros | Functions | Variables
USB_device_custom_hid
AT32F413_periph_examples

Macros

#define USB_EPT_AUTO_MALLOC_BUFFER
usb endpoint max num define

Functions

void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.
void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | usb_clock48m_select (usb_clk48_s clk_s)
usb 48M clock select
int | main (void)
main function.
void | USBFS_L_CAN1_RX0_IRQHandler (void)
this function handles usb interrupt.

Variables

usbd_core_type usb_core_dev
uint8_t report_buf [0x40]

Detailed Description

Macro Definition Documentation

◆ USB_EPT_AUTO_MALLOC_BUFFER

#define USB_EPT_AUTO_MALLOC_BUFFER

usb endpoint max num define

usb buffer extend to 768-1280 bytes

auto malloc usb endpoint buffer usb auto malloc endpoint tx and rx buffer

Definition at line 62 of file project/at_start_f413/examples/usb_device/custom_hid/inc/usb_conf.h.

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/usb_device/custom_hid/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/usb_device/custom_hid/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/usb_device/custom_hid/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 120 of file project/at_start_f413/examples/usb_device/custom_hid/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/usb_device/custom_hid/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/usb_device/custom_hid/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/usb_device/custom_hid/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/usb_device/custom_hid/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/usb_device/custom_hid/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/usb_device/custom_hid/src/at32f413_int.c.

◆ usb_clock48m_select()

void usb_clock48m_select ( usb_clk48_s clk_s )

usb 48M clock select

Parameters
clk_s:USB_CLK_HICK,USB_CLK_HEXT
Return values
none

< acc hick trim

Definition at line 49 of file project/at_start_f413/examples/usb_device/custom_hid/src/main.c.

Referenced by main().

◆ usb_delay_ms()

void usb_delay_ms ( uint32_t ms )

usb delay millisecond function.

Parameters
ms number of millisecond delay
Return values
none

Definition at line 172 of file project/at_start_f413/examples/usb_device/custom_hid/src/main.c.

◆ usb_delay_us()

void usb_delay_us ( uint32_t us )

usb delay microsecond function.

Parameters
us number of microsecond delay
Return values
none

Definition at line 183 of file project/at_start_f413/examples/usb_device/custom_hid/src/main.c.

◆ USBFS_L_CAN1_RX0_IRQHandler()

void USBFS_L_CAN1_RX0_IRQHandler ( void )

this function handles usb interrupt.

Parameters
none
Return values
none

Definition at line 162 of file project/at_start_f413/examples/usb_device/custom_hid/src/main.c.

Variable Documentation

◆ report_buf

uint8_t report_buf[0x40]

Definition at line 42 of file project/at_start_f413/examples/usb_device/custom_hid/src/main.c.

Referenced by main().

◆ usb_core_dev

usbd_core_type usb_core_dev

Definition at line 41 of file project/at_start_f413/examples/usb_device/custom_hid/src/main.c.

Referenced by main(), and USBFS_L_CAN1_RX0_IRQHandler().


AT32F413 Firmwary Library: USB_device_keyboard

Macros | Functions | Variables
USB_device_keyboard
AT32F413_periph_examples

Macros

#define | USB_EPT_AUTO_MALLOC_BUFFER
usb endpoint max num define
#define | USB_LOW_POWER_WAKUP
usb low power wakeup handler enable

Functions

void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.
void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | keyboard_send_string (void *udev, uint8_t *string, uint8_t len)
keyboard send string
void | system_clock_recover (void)
systemclock recover.
void | button_exint_init (void)
configure button exint
void | usb_low_power_wakeup_config (void)
void | usb_clock48m_select (usb_clk48_s clk_s)
usb 48M clock select
int | main (void)
main function.
void | USBFS_L_CAN1_RX0_IRQHandler (void)
this function handles usb interrupt.

Variables

usbd_core_type usb_core_dev
__IO uint8_t hid_suspend_flag

Detailed Description

Macro Definition Documentation

◆ USB_EPT_AUTO_MALLOC_BUFFER

#define USB_EPT_AUTO_MALLOC_BUFFER

usb endpoint max num define

usb buffer extend to 768-1280 bytes

auto malloc usb endpoint buffer usb auto malloc endpoint tx and rx buffer

Definition at line 62 of file project/at_start_f413/examples/usb_device/keyboard/inc/usb_conf.h.

◆ USB_LOW_POWER_WAKUP

#define USB_LOW_POWER_WAKUP

usb low power wakeup handler enable

Definition at line 102 of file project/at_start_f413/examples/usb_device/keyboard/inc/usb_conf.h.

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/usb_device/keyboard/src/at32f413_int.c.

◆ button_exint_init()

void button_exint_init ( void )

configure button exint

Parameters
none
Return values
none

< external interrupt line 0

Definition at line 51 of file project/at_start_f413/templates/src/main.c.

Referenced by main().

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/usb_device/keyboard/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/usb_device/keyboard/src/at32f413_int.c.

◆ keyboard_send_string()

void keyboard_send_string | ( | void * | udev,
 |  | uint8_t * | string,
 |  | uint8_t | len )

keyboard send string

Parameters
string | send string
len | send string length
Return values
none

Definition at line 54 of file project/at_start_f413/examples/usb_device/keyboard/src/main.c.

Referenced by main().

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 159 of file project/at_start_f413/examples/usb_device/keyboard/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/usb_device/keyboard/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/usb_device/keyboard/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/usb_device/keyboard/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/usb_device/keyboard/src/at32f413_int.c.

◆ system_clock_recover()

void system_clock_recover ( void )

systemclock recover.

Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 97 of file project/at_start_f413/examples/pwc/deepsleep_rtc/src/main.c.

Referenced by main().

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/usb_device/keyboard/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/usb_device/keyboard/src/at32f413_int.c.

◆ usb_clock48m_select()

void usb_clock48m_select ( usb_clk48_s clk_s )

usb 48M clock select

Parameters
clk_s:USB_CLK_HICK,USB_CLK_HEXT
Return values
none

< acc hick trim

Definition at line 88 of file project/at_start_f413/examples/usb_device/keyboard/src/main.c.

Referenced by main().

◆ usb_delay_ms()

void usb_delay_ms ( uint32_t ms )

usb delay millisecond function.

Parameters
ms number of millisecond delay
Return values
none

Definition at line 356 of file project/at_start_f413/examples/usb_device/keyboard/src/main.c.

◆ usb_delay_us()

void usb_delay_us ( uint32_t us )

usb delay microsecond function.

Parameters
us number of microsecond delay
Return values
none

Definition at line 367 of file project/at_start_f413/examples/usb_device/keyboard/src/main.c.

◆ usb_low_power_wakeup_config()

void usb_low_power_wakeup_config ( void )

Referenced by main().

◆ USBFS_L_CAN1_RX0_IRQHandler()

void USBFS_L_CAN1_RX0_IRQHandler ( void )

this function handles usb interrupt.

Parameters
none
Return values
none

Definition at line 346 of file project/at_start_f413/examples/usb_device/keyboard/src/main.c.

Variable Documentation

◆ hid_suspend_flag

__IO uint8_t hid_suspend_flag
extern

◆ usb_core_dev

usbd_core_type usb_core_dev

Definition at line 41 of file project/at_start_f413/examples/usb_device/keyboard/src/main.c.

Referenced by main(), and USBFS_L_CAN1_RX0_IRQHandler().


AT32F413 Firmwary Library: USB_device_mouse

Macros | Functions | Variables
USB_device_mouse
AT32F413_periph_examples

Macros

#define | USB_EPT_AUTO_MALLOC_BUFFER
usb endpoint max num define
#define | USB_LOW_POWER_WAKUP
usb low power wakeup handler enable

Functions

void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.
void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | system_clock_recover (void)
systemclock recover.
void | button_exint_init (void)
configure button exint
void | usb_low_power_wakeup_config (void)
void | usb_clock48m_select (usb_clk48_s clk_s)
usb 48M clock select
int | main (void)
main function.
void | USBFS_L_CAN1_RX0_IRQHandler (void)
this function handles usb interrupt.

Variables

usbd_core_type usb_core_dev
__IO uint8_t | press_mouse = 0
__IO uint8_t | hid_suspend_flag
uint8_t | report_buf [0x40]

Detailed Description

Macro Definition Documentation

◆ USB_EPT_AUTO_MALLOC_BUFFER

#define USB_EPT_AUTO_MALLOC_BUFFER

usb endpoint max num define

usb buffer extend to 768-1280 bytes

auto malloc usb endpoint buffer usb auto malloc endpoint tx and rx buffer

Definition at line 62 of file project/at_start_f413/examples/usb_device/mouse/inc/usb_conf.h.

◆ USB_LOW_POWER_WAKUP

#define USB_LOW_POWER_WAKUP

usb low power wakeup handler enable

Definition at line 102 of file project/at_start_f413/examples/usb_device/mouse/inc/usb_conf.h.

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/usb_device/mouse/src/at32f413_int.c.

◆ button_exint_init()

void button_exint_init ( void )

configure button exint

Parameters
none
Return values
none

< external interrupt line 0

Definition at line 51 of file project/at_start_f413/templates/src/main.c.

Referenced by main().

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/usb_device/mouse/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/usb_device/mouse/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 124 of file project/at_start_f413/examples/usb_device/mouse/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/usb_device/mouse/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/usb_device/mouse/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/usb_device/mouse/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/usb_device/mouse/src/at32f413_int.c.

◆ system_clock_recover()

void system_clock_recover ( void )

systemclock recover.

Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 97 of file project/at_start_f413/examples/pwc/deepsleep_rtc/src/main.c.

Referenced by main().

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/usb_device/mouse/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/usb_device/mouse/src/at32f413_int.c.

◆ usb_clock48m_select()

void usb_clock48m_select ( usb_clk48_s clk_s )

usb 48M clock select

Parameters
clk_s:USB_CLK_HICK,USB_CLK_HEXT
Return values
none

< acc hick trim

Definition at line 53 of file project/at_start_f413/examples/usb_device/mouse/src/main.c.

Referenced by main().

◆ usb_delay_ms()

void usb_delay_ms ( uint32_t ms )

usb delay millisecond function.

Parameters
ms number of millisecond delay
Return values
none

Definition at line 332 of file project/at_start_f413/examples/usb_device/mouse/src/main.c.

◆ usb_delay_us()

void usb_delay_us ( uint32_t us )

usb delay microsecond function.

Parameters
us number of microsecond delay
Return values
none

Definition at line 343 of file project/at_start_f413/examples/usb_device/mouse/src/main.c.

◆ usb_low_power_wakeup_config()

void usb_low_power_wakeup_config ( void )

Referenced by main().

◆ USBFS_L_CAN1_RX0_IRQHandler()

void USBFS_L_CAN1_RX0_IRQHandler ( void )

this function handles usb interrupt.

Parameters
none
Return values
none

Definition at line 321 of file project/at_start_f413/examples/usb_device/mouse/src/main.c.

Variable Documentation

◆ hid_suspend_flag

__IO uint8_t hid_suspend_flag
extern

◆ press_mouse

__IO uint8_t press_mouse = 0

Definition at line 42 of file project/at_start_f413/examples/usb_device/mouse/src/main.c.

Referenced by main().

◆ report_buf

uint8_t report_buf[0x40]

Definition at line 44 of file project/at_start_f413/examples/usb_device/mouse/src/main.c.

◆ usb_core_dev

usbd_core_type usb_core_dev

Definition at line 41 of file project/at_start_f413/examples/usb_device/mouse/src/main.c.

Referenced by main(), and USBFS_L_CAN1_RX0_IRQHandler().


AT32F413 Firmwary Library: USB_device_printer

Macros | Functions | Variables
USB_device_printer
AT32F413_periph_examples

Macros

#define USB_EPT_AUTO_MALLOC_BUFFER
usb endpoint max num define

Functions

void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.
void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | usb_clock48m_select (usb_clk48_s clk_s)
usb 48M clock select
int | main (void)
main function.
void | USBFS_L_CAN1_RX0_IRQHandler (void)
this function handles usb interrupt.

Variables

uint8_t usb_buffer [256]
usbd_core_type usb_core_dev

Detailed Description

Macro Definition Documentation

◆ USB_EPT_AUTO_MALLOC_BUFFER

#define USB_EPT_AUTO_MALLOC_BUFFER

usb endpoint max num define

usb buffer extend to 768-1280 bytes

auto malloc usb endpoint buffer usb auto malloc endpoint tx and rx buffer

Definition at line 62 of file project/at_start_f413/examples/usb_device/printer/inc/usb_conf.h.

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/usb_device/printer/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/usb_device/printer/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/usb_device/printer/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 120 of file project/at_start_f413/examples/usb_device/printer/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/usb_device/printer/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/usb_device/printer/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/usb_device/printer/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/usb_device/printer/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/usb_device/printer/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/usb_device/printer/src/at32f413_int.c.

◆ usb_clock48m_select()

void usb_clock48m_select ( usb_clk48_s clk_s )

usb 48M clock select

Parameters
clk_s:USB_CLK_HICK,USB_CLK_HEXT
Return values
none

< acc hick trim

Definition at line 49 of file project/at_start_f413/examples/usb_device/printer/src/main.c.

Referenced by main().

◆ usb_delay_ms()

void usb_delay_ms ( uint32_t ms )

usb delay millisecond function.

Parameters
ms number of millisecond delay
Return values
none

Definition at line 171 of file project/at_start_f413/examples/usb_device/printer/src/main.c.

◆ usb_delay_us()

void usb_delay_us ( uint32_t us )

usb delay microsecond function.

Parameters
us number of microsecond delay
Return values
none

Definition at line 182 of file project/at_start_f413/examples/usb_device/printer/src/main.c.

◆ USBFS_L_CAN1_RX0_IRQHandler()

void USBFS_L_CAN1_RX0_IRQHandler ( void )

this function handles usb interrupt.

Parameters
none
Return values
none

Definition at line 161 of file project/at_start_f413/examples/usb_device/printer/src/main.c.

Variable Documentation

◆ usb_buffer

uint8_t usb_buffer[256]

Definition at line 41 of file project/at_start_f413/examples/usb_device/printer/src/main.c.

Referenced by main().

◆ usb_core_dev

usbd_core_type usb_core_dev

Definition at line 42 of file project/at_start_f413/examples/usb_device/printer/src/main.c.

Referenced by main(), and USBFS_L_CAN1_RX0_IRQHandler().


AT32F413 Firmwary Library: USB_device_vcp_loopback

Macros | Functions | Variables
USB_device_vcp_loopback
AT32F413_periph_examples

Macros

#define | EPT0_TX_ADDR 0x40
usb endpoint max num define
#define | EPT0_RX_ADDR 0x80
#define | EPT1_TX_ADDR 0xC0
#define | EPT1_RX_ADDR 0x100
#define | EPT2_TX_ADDR 0x140
#define | EPT2_RX_ADDR 0x180
#define | EPT3_TX_ADDR 0x00
#define | EPT3_RX_ADDR 0x00
#define | EPT4_TX_ADDR 0x00
#define | EPT4_RX_ADDR 0x00
#define | EPT5_TX_ADDR 0x00
#define | EPT5_RX_ADDR 0x00
#define | EPT6_TX_ADDR 0x00
#define | EPT6_RX_ADDR 0x00
#define | EPT7_TX_ADDR 0x00
#define | EPT7_RX_ADDR 0x00
#define | USB_VIRTUAL_COMPORT
usb endpoint max num define
#define | EPT0_TX_ADDR 0x40
user custom endpoint buffer EPTn_TX_ADDR, EPTn_RX_ADDR must less than usb buffer size
#define | EPT0_RX_ADDR 0x80
#define | EPT1_TX_ADDR 0xC0
#define | EPT1_RX_ADDR 0x100
#define | EPT2_TX_ADDR 0x140
#define | EPT2_RX_ADDR 0x180
#define | EPT3_TX_ADDR 0x00
#define | EPT3_RX_ADDR 0x00
#define | EPT4_TX_ADDR 0x00
#define | EPT4_RX_ADDR 0x00
#define | EPT5_TX_ADDR 0x00
#define | EPT5_RX_ADDR 0x00
#define | EPT6_TX_ADDR 0x00
#define | EPT6_RX_ADDR 0x00
#define | EPT7_TX_ADDR 0x00
#define | EPT7_RX_ADDR 0x00
#define | usart_buffer_size 2048

Functions

void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.
void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | usb_clock48m_select (usb_clk48_s clk_s)
usb 48M clock select
int | main (void)
main function.
void | USBFS_L_CAN1_RX0_IRQHandler (void)
this function handles usb interrupt.
void | usb_usart_config (linecoding_type linecoding)
this function handles usart2 and linecoding config.
void | usart_gpio_config (void)
this function handles usart2 gpio config.
void | usart_send_data (uint8_t *send_data, uint16_t len)
this function handles usart2 send data.
uint16_t | usart_receive_data (void)
this function handles usart2 receive data.
void | USART2_IRQHandler (void)
this function handles usart2 handler.

Variables

usbd_core_type usb_core_dev
uint8_t | usb_buffer [256]
usbd_core_type usb_core_dev
uint8_t | usb_buffer [256]
linecoding_type linecoding
uint8_t | usart_rx_buffer [2048]
uint16_t | hw_usart_rx_index = 0
uint16_t | hw_usart_read_index = 0
uint16_t | usart_rx_data_len = 0
uint16_t | ov_cnt = 0

Detailed Description

Macro Definition Documentation

◆ EPT0_RX_ADDR [1/2]

#define EPT0_RX_ADDR 0x80

usb endpoint 0 rx buffer address offset

Definition at line 74 of file project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h.

◆ EPT0_RX_ADDR [2/2]

#define EPT0_RX_ADDR 0x80

usb endpoint 0 rx buffer address offset

Definition at line 78 of file project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h.

◆ EPT0_TX_ADDR [1/2]

#define EPT0_TX_ADDR 0x40

usb endpoint max num define

user custom endpoint buffer EPTn_TX_ADDR, EPTn_RX_ADDR must less than usb buffer size

usb buffer extend to 768-1280 bytes

auto malloc usb endpoint buffer

user custom endpoint buffer EPTn_TX_ADDR, EPTn_RX_ADDR must less than usb buffer size usb endpoint 0 tx buffer address offset

usb endpoint 0 tx buffer address offset

Definition at line 73 of file project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h.

◆ EPT0_TX_ADDR [2/2]

#define EPT0_TX_ADDR 0x40

user custom endpoint buffer EPTn_TX_ADDR, EPTn_RX_ADDR must less than usb buffer size

usb endpoint 0 tx buffer address offset

Definition at line 77 of file project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h.

◆ EPT1_RX_ADDR [1/2]

#define EPT1_RX_ADDR 0x100

usb endpoint 1 rx buffer address offset

Definition at line 77 of file project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h.

◆ EPT1_RX_ADDR [2/2]

#define EPT1_RX_ADDR 0x100

usb endpoint 1 rx buffer address offset

Definition at line 81 of file project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h.

◆ EPT1_TX_ADDR [1/2]

#define EPT1_TX_ADDR 0xC0

usb endpoint 1 tx buffer address offset

Definition at line 76 of file project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h.

◆ EPT1_TX_ADDR [2/2]

#define EPT1_TX_ADDR 0xC0

usb endpoint 1 tx buffer address offset

Definition at line 80 of file project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h.

◆ EPT2_RX_ADDR [1/2]

#define EPT2_RX_ADDR 0x180

usb endpoint 2 rx buffer address offset

Definition at line 80 of file project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h.

◆ EPT2_RX_ADDR [2/2]

#define EPT2_RX_ADDR 0x180

usb endpoint 2 rx buffer address offset

Definition at line 84 of file project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h.

◆ EPT2_TX_ADDR [1/2]

#define EPT2_TX_ADDR 0x140

usb endpoint 2 tx buffer address offset

Definition at line 79 of file project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h.

◆ EPT2_TX_ADDR [2/2]

#define EPT2_TX_ADDR 0x140

usb endpoint 2 tx buffer address offset

Definition at line 83 of file project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h.

◆ EPT3_RX_ADDR [1/2]

#define EPT3_RX_ADDR 0x00

usb endpoint 3 rx buffer address offset

Definition at line 83 of file project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h.

◆ EPT3_RX_ADDR [2/2]

#define EPT3_RX_ADDR 0x00

usb endpoint 3 rx buffer address offset

Definition at line 87 of file project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h.

◆ EPT3_TX_ADDR [1/2]

#define EPT3_TX_ADDR 0x00

usb endpoint 3 tx buffer address offset

Definition at line 82 of file project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h.

◆ EPT3_TX_ADDR [2/2]

#define EPT3_TX_ADDR 0x00

usb endpoint 3 tx buffer address offset

Definition at line 86 of file project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h.

◆ EPT4_RX_ADDR [1/2]

#define EPT4_RX_ADDR 0x00

usb endpoint 4 rx buffer address offset

Definition at line 86 of file project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h.

◆ EPT4_RX_ADDR [2/2]

#define EPT4_RX_ADDR 0x00

usb endpoint 4 rx buffer address offset

Definition at line 90 of file project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h.

◆ EPT4_TX_ADDR [1/2]

#define EPT4_TX_ADDR 0x00

usb endpoint 4 tx buffer address offset

Definition at line 85 of file project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h.

◆ EPT4_TX_ADDR [2/2]

#define EPT4_TX_ADDR 0x00

usb endpoint 4 tx buffer address offset

Definition at line 89 of file project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h.

◆ EPT5_RX_ADDR [1/2]

#define EPT5_RX_ADDR 0x00

usb endpoint 5 rx buffer address offset

Definition at line 89 of file project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h.

◆ EPT5_RX_ADDR [2/2]

#define EPT5_RX_ADDR 0x00

usb endpoint 5 rx buffer address offset

Definition at line 93 of file project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h.

◆ EPT5_TX_ADDR [1/2]

#define EPT5_TX_ADDR 0x00

usb endpoint 5 tx buffer address offset

Definition at line 88 of file project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h.

◆ EPT5_TX_ADDR [2/2]

#define EPT5_TX_ADDR 0x00

usb endpoint 5 tx buffer address offset

Definition at line 92 of file project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h.

◆ EPT6_RX_ADDR [1/2]

#define EPT6_RX_ADDR 0x00

usb endpoint 6 rx buffer address offset

Definition at line 92 of file project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h.

◆ EPT6_RX_ADDR [2/2]

#define EPT6_RX_ADDR 0x00

usb endpoint 6 rx buffer address offset

Definition at line 96 of file project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h.

◆ EPT6_TX_ADDR [1/2]

#define EPT6_TX_ADDR 0x00

usb endpoint 6 tx buffer address offset

Definition at line 91 of file project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h.

◆ EPT6_TX_ADDR [2/2]

#define EPT6_TX_ADDR 0x00

usb endpoint 6 tx buffer address offset

Definition at line 95 of file project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h.

◆ EPT7_RX_ADDR [1/2]

#define EPT7_RX_ADDR 0x00

usb endpoint 7 rx buffer address offset

Definition at line 95 of file project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h.

◆ EPT7_RX_ADDR [2/2]

#define EPT7_RX_ADDR 0x00

usb endpoint 7 rx buffer address offset

Definition at line 99 of file project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h.

◆ EPT7_TX_ADDR [1/2]

#define EPT7_TX_ADDR 0x00

usb endpoint 7 tx buffer address offset

Definition at line 94 of file project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h.

◆ EPT7_TX_ADDR [2/2]

#define EPT7_TX_ADDR 0x00

usb endpoint 7 tx buffer address offset

Definition at line 98 of file project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h.

◆ usart_buffer_size

#define usart_buffer_size 2048

Definition at line 48 of file project/at_start_f413/examples/usb_device/virtual_comport/src/main.c.

Referenced by USART2_IRQHandler(), and usart_receive_data().

◆ USB_VIRTUAL_COMPORT

#define USB_VIRTUAL_COMPORT

usb endpoint max num define

usb buffer extend to 768-1280 bytes

auto malloc usb endpoint buffer

usb virtual comport

Definition at line 67 of file project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h.

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/usb_device/vcp_loopback/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/usb_device/vcp_loopback/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/usb_device/vcp_loopback/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 120 of file project/at_start_f413/examples/usb_device/vcp_loopback/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/usb_device/vcp_loopback/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/usb_device/vcp_loopback/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/usb_device/vcp_loopback/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/usb_device/vcp_loopback/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/usb_device/vcp_loopback/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/usb_device/vcp_loopback/src/at32f413_int.c.

◆ USART2_IRQHandler()

void USART2_IRQHandler ( void )

this function handles usart2 handler.

Parameters
none
Return values
none

< usart receive data buffer full flag

Definition at line 286 of file project/at_start_f413/examples/usb_device/virtual_comport/src/main.c.

◆ usart_gpio_config()

void usart_gpio_config ( void )

this function handles usart2 gpio config.

Parameters
none
Return values
none

< gpio pins number 2

< gpio pins number 3

Definition at line 409 of file project/at_start_f413/examples/usb_device/virtual_comport/src/main.c.

◆ usart_receive_data()

uint16_t usart_receive_data ( void )

this function handles usart2 receive data.

Parameters
none
Return values
the data len

Definition at line 260 of file project/at_start_f413/examples/usb_device/virtual_comport/src/main.c.

◆ usart_send_data()

void usart_send_data | ( | uint8_t * | send_data,
 |  | uint16_t | len )

this function handles usart2 send data.

Parameters
send_data | pointer to data
len | data len
Return values
none

< usart transmit data buffer empty flag

Definition at line 241 of file project/at_start_f413/examples/usb_device/virtual_comport/src/main.c.

◆ usb_clock48m_select()

void usb_clock48m_select ( usb_clk48_s clk_s )

usb 48M clock select

Parameters
clk_s:USB_CLK_HICK,USB_CLK_HEXT
Return values
none

< acc hick trim

< acc hick trim

Definition at line 49 of file project/at_start_f413/examples/usb_device/vcp_loopback/src/main.c.

Referenced by main().

◆ usb_delay_ms()

void usb_delay_ms ( uint32_t ms )

usb delay millisecond function.

Parameters
ms number of millisecond delay
Return values
none

Definition at line 197 of file project/at_start_f413/examples/usb_device/vcp_loopback/src/main.c.

◆ usb_delay_us()

void usb_delay_us ( uint32_t us )

usb delay microsecond function.

Parameters
us number of microsecond delay
Return values
none

Definition at line 208 of file project/at_start_f413/examples/usb_device/vcp_loopback/src/main.c.

◆ usb_usart_config()

void usb_usart_config ( linecoding_type linecoding )

this function handles usart2 and linecoding config.

Parameters
linecoding linecoding value
Return values
none

< usart receive data buffer full interrupt

Definition at line 301 of file project/at_start_f413/examples/usb_device/virtual_comport/src/main.c.

Referenced by usb_vcp_cmd_process(), and usb_vcp_cmd_process().

◆ USBFS_L_CAN1_RX0_IRQHandler()

void USBFS_L_CAN1_RX0_IRQHandler ( void )

this function handles usb interrupt.

Parameters
none
Return values
none

Definition at line 187 of file project/at_start_f413/examples/usb_device/vcp_loopback/src/main.c.

Variable Documentation

◆ hw_usart_read_index

uint16_t hw_usart_read_index = 0

Definition at line 51 of file project/at_start_f413/examples/usb_device/virtual_comport/src/main.c.

Referenced by usart_receive_data().

◆ hw_usart_rx_index

uint16_t hw_usart_rx_index = 0

Definition at line 50 of file project/at_start_f413/examples/usb_device/virtual_comport/src/main.c.

Referenced by USART2_IRQHandler(), and usart_receive_data().

◆ linecoding

linecoding_type linecoding
extern

Definition at line 56 of file cdc_class.c.

Referenced by cdc_struct_init(), cdc_struct_init(), and usb_usart_config().

◆ ov_cnt

uint16_t ov_cnt = 0

Definition at line 53 of file project/at_start_f413/examples/usb_device/virtual_comport/src/main.c.

◆ usart_rx_buffer

uint8_t usart_rx_buffer[2048]

Definition at line 49 of file project/at_start_f413/examples/usb_device/virtual_comport/src/main.c.

Referenced by USART2_IRQHandler().

◆ usart_rx_data_len

uint16_t usart_rx_data_len = 0

Definition at line 52 of file project/at_start_f413/examples/usb_device/virtual_comport/src/main.c.

◆ usb_buffer [1/2]

uint8_t usb_buffer[256]

Definition at line 42 of file project/at_start_f413/examples/usb_device/vcp_loopback/src/main.c.

Referenced by main().

◆ usb_buffer [2/2]

uint8_t usb_buffer[256]

Definition at line 42 of file project/at_start_f413/examples/usb_device/virtual_comport/src/main.c.

◆ usb_core_dev [1/2]

usbd_core_type usb_core_dev

Definition at line 41 of file project/at_start_f413/examples/usb_device/vcp_loopback/src/main.c.

Referenced by main(), and USBFS_L_CAN1_RX0_IRQHandler().

◆ usb_core_dev [2/2]

usbd_core_type usb_core_dev

Definition at line 41 of file project/at_start_f413/examples/usb_device/virtual_comport/src/main.c.


AT32F413 Firmwary Library: USB_device_virtual_msc_iap

Topics | Macros | Functions | Variables
USB_device_virtual_msc_iap
AT32F413_periph_examples

Topics

USB_device_virtual_msc_iap_definition

Macros

#define | INTERNAL_FLASH_LUN 0
#define | SPI_FLASH_LUN 1
#define | SD_LUN 2
#define | USB_FLASH_ADDR_OFFSET 0x08004000
#define | USB_EPT_AUTO_MALLOC_BUFFER
usb endpoint max num define
#define | FAT16_SECTOR_SIZE 62
#define | FAT16_CLUSTER_SIZE (4 * 0x800)
#define | FAT16_FIRST_CLUSTER (8 * 0x800)

Functions

uint8_t * | get_inquiry (uint8_t lun)
get disk inquiry
usb_sts_type | msc_disk_read (uint8_t lun, uint64_t addr, uint8_t *read_buf, uint32_t len)
disk read
usb_sts_type | msc_disk_write (uint8_t lun, uint64_t addr, uint8_t *buf, uint32_t len)
disk write
usb_sts_type | msc_disk_capacity (uint8_t lun, uint32_t *blk_nbr, uint32_t *blk_size)
disk capacity
void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.
void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
uint32_t | flash_fat16_boot_dir_write (uint32_t fat_lbk, uint8_t *data, uint32_t len)
boot dir write
uint32_t | flash_fat16_sector_write (uint32_t fat_lbk, uint8_t *data, uint32_t len)
write sector
uint32_t | fat16_memory_copy (uint8_t *dst, const uint8_t *src, uint32_t len)
memory copy function
uint32_t | fat16_memory_memset (uint8_t *dst, uint32_t set, uint32_t len)
memset function
uint32_t | flash_write_data (uint32_t address, uint8_t *data, uint32_t len)
write data to flash
uint32_t | flash_read_data (uint32_t address, uint8_t *data, uint32_t len)
read data from flash
uint32_t | fat16_memory_cmp (uint8_t *dst, uint8_t *src, uint32_t len)
memory compare function
uint32_t | flash_crc_check (uint32_t address, uint8_t *data, uint32_t len)
crc check
void | flash_fat16_clear_upgrade_flag (void)
clear iap upgrade flag
void | flash_fat16_set_upgrade_flag (void)
set iap upgrade complete flag
uint8_t | flash_fat16_get_upgrade_flag (void)
get iap upgrade complete flag
uint32_t | flash_fat16_read (uint32_t fat_lbk, uint8_t *data, uint32_t len)
read a logical block address
uint32_t | flash_fat16_write (uint32_t fat_lbk, uint8_t *data, uint32_t len)
write a logical block address
uint32_t | flash_fat16_set_name (const uint8_t *file_name, uint8_t len)
set file name
uint32_t | flash_fat16_addr_offset (uint8_t *file_name)
get offset address
void | flash_fat16_init (void)
flash fat16 iap init
void | jump_to_app (uint32_t address)
jump to app
void | usb_clock48m_select (usb_clk48_s clk_s)
usb 48M clock select
int | main (void)
main function.
void | usb_reset ()
usb re-connect
void | flash_fat16_loop_status (void)
loop status
void | USBFS_L_CAN1_RX0_IRQHandler (void)
this function handles usb interrupt.

Variables

static uint8_t | fat16_sector [62]
const uint8_t | fat16_root_dir_sector [47]
const uint8_t | fat16_table_sector0 [4]
uint8_t | fat16_file_name [11]
fat_dir_type g_file_attr
flash_iap_type flash_iap
uint32_t | file_write_nr = 0
uint8_t | file_match = 0
usbd_core_type usb_core_dev
void(* | pftarget )(void)
uint32_t | stkptr
uint32_t | jumpaddr
uint8_t | scsi_inquiry [MSC_SUPPORT_MAX_LUN][SCSI_INQUIRY_DATA_LENGTH]

Detailed Description

Macro Definition Documentation

◆ FAT16_CLUSTER_SIZE

#define FAT16_CLUSTER_SIZE (4 * 0x800)

Definition at line 36 of file flash_fat16.c.

Referenced by flash_fat16_sector_write().

◆ FAT16_FIRST_CLUSTER

#define FAT16_FIRST_CLUSTER (8 * 0x800)

Definition at line 37 of file flash_fat16.c.

Referenced by flash_fat16_sector_write().

◆ FAT16_SECTOR_SIZE

#define FAT16_SECTOR_SIZE 62

Definition at line 35 of file flash_fat16.c.

Referenced by flash_fat16_read().

◆ INTERNAL_FLASH_LUN

#define INTERNAL_FLASH_LUN 0

Definition at line 44 of file virtual_msc_iap/inc/msc_diskio.h.

◆ SD_LUN

#define SD_LUN 2

Definition at line 46 of file virtual_msc_iap/inc/msc_diskio.h.

◆ SPI_FLASH_LUN

#define SPI_FLASH_LUN 1

Definition at line 45 of file virtual_msc_iap/inc/msc_diskio.h.

◆ USB_EPT_AUTO_MALLOC_BUFFER

#define USB_EPT_AUTO_MALLOC_BUFFER

usb endpoint max num define

usb buffer extend to 768-1280 bytes

auto malloc usb endpoint buffer usb auto malloc endpoint tx and rx buffer

Definition at line 62 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/usb_conf.h.

◆ USB_FLASH_ADDR_OFFSET

#define USB_FLASH_ADDR_OFFSET 0x08004000

Definition at line 48 of file virtual_msc_iap/inc/msc_diskio.h.

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/src/at32f413_int.c.

◆ fat16_memory_cmp()

uint32_t fat16_memory_cmp | ( | uint8_t * | dst,
 |  | uint8_t * | src,
 |  | uint32_t | len )

memory compare function

Parameters
dst | dest buffer pointer
src | src buffer pointer
len | compare length
Return values
compare result

Definition at line 230 of file flash_fat16.c.

Referenced by flash_fat16_sector_write().

◆ fat16_memory_copy()

uint32_t fat16_memory_copy | ( | uint8_t * | dst,
 |  | const uint8_t * | src,
 |  | uint32_t | len )

memory copy function

Parameters
dst | dest buffer pointer
src | src buffer pointer
len | copy length
Return values
nubmer of data copy

Definition at line 196 of file flash_fat16.c.

Referenced by flash_fat16_boot_dir_write(), and flash_fat16_read().

◆ fat16_memory_memset()

uint32_t fat16_memory_memset | ( | uint8_t * | dst,
 |  | uint32_t | set,
 |  | uint32_t | len )

memset function

Parameters
dst | dest buffer pointer
set | set value
len | set length
Return values
nubmer of data set

Definition at line 213 of file flash_fat16.c.

Referenced by flash_fat16_boot_dir_write(), and flash_fat16_read().

◆ flash_crc_check()

uint32_t flash_crc_check | ( | uint32_t | address,
 |  | uint8_t * | data,
 |  | uint32_t | len )

crc check

Parameters
address | flash address
data | pointer to array to store data
len | data length
Return values
crc result

Definition at line 617 of file flash_fat16.c.

Referenced by flash_write_data().

◆ flash_fat16_addr_offset()

uint32_t flash_fat16_addr_offset ( uint8_t * file_name )

get offset address

Parameters
file_name file name
Return values
offset address

Definition at line 440 of file flash_fat16.c.

Referenced by flash_fat16_sector_write().

◆ flash_fat16_boot_dir_write()

uint32_t flash_fat16_boot_dir_write | ( | uint32_t | fat_lbk,
 |  | uint8_t * | data,
 |  | uint32_t | len )

boot dir write

Parameters
fat_lbk | logical block address
data | pointer to array to store data
len | data length
Return values
nubmer of data

Definition at line 382 of file flash_fat16.c.

Referenced by flash_fat16_write().

◆ flash_fat16_clear_upgrade_flag()

void flash_fat16_clear_upgrade_flag ( void )

clear iap upgrade flag

Parameters
none
Return values
none

Definition at line 246 of file flash_fat16.c.

Referenced by flash_fat16_sector_write().

◆ flash_fat16_get_upgrade_flag()

uint8_t flash_fat16_get_upgrade_flag ( void )

get iap upgrade complete flag

Parameters
none
Return values
the iap flag

Definition at line 271 of file flash_fat16.c.

Referenced by main().

◆ flash_fat16_init()

void flash_fat16_init ( void )

flash fat16 iap init

Parameters
none
Return values
none

Definition at line 736 of file flash_fat16.c.

Referenced by main().

◆ flash_fat16_loop_status()

void flash_fat16_loop_status ( void )

loop status

Parameters
none
Return values
none

Definition at line 182 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c.

Referenced by main().

◆ flash_fat16_read()

uint32_t flash_fat16_read | ( | uint32_t | fat_lbk,
 |  | uint8_t * | data,
 |  | uint32_t | len )

read a logical block address

Parameters
fat_lbk | logical block address to read
data | pointer to array to store data read
len | data length
Return values
read length

Definition at line 291 of file flash_fat16.c.

Referenced by msc_disk_read().

◆ flash_fat16_sector_write()

uint32_t flash_fat16_sector_write | ( | uint32_t | fat_lbk,
 |  | uint8_t * | data,
 |  | uint32_t | len )

write sector

Parameters
fat_lbk | logical block address
data | pointer to array to store data
len | data length
Return values
nubmer of data

Definition at line 489 of file flash_fat16.c.

Referenced by flash_fat16_write().

◆ flash_fat16_set_name()

uint32_t flash_fat16_set_name | ( | const uint8_t * | file_name,
 |  | uint8_t | len )

set file name

Parameters
file_name | file name
len | filename length
Return values
filename length

Definition at line 360 of file flash_fat16.c.

Referenced by flash_fat16_loop_status().

◆ flash_fat16_set_upgrade_flag()

void flash_fat16_set_upgrade_flag ( void )

set iap upgrade complete flag

Parameters
none
Return values
none

Definition at line 258 of file flash_fat16.c.

Referenced by flash_fat16_boot_dir_write(), and flash_fat16_sector_write().

◆ flash_fat16_write()

uint32_t flash_fat16_write | ( | uint32_t | fat_lbk,
 |  | uint8_t * | data,
 |  | uint32_t | len )

write a logical block address

Parameters
fat_lbk | logical block address to read
data | pointer to array to store data read
len | data length
Return values
read length

Definition at line 332 of file flash_fat16.c.

Referenced by msc_disk_write().

◆ flash_read_data()

uint32_t flash_read_data | ( | uint32_t | address,
 |  | uint8_t * | data,
 |  | uint32_t | len )

read data from flash

Parameters
address | flash address
data | pointer to array to store data
len | data length
Return values
read length

Definition at line 668 of file flash_fat16.c.

◆ flash_write_data()

uint32_t flash_write_data | ( | uint32_t | address,
 |  | uint8_t * | data,
 |  | uint32_t | len )

write data to flash

Parameters
address | flash address
data | pointer to array to store data
len | data length
Return values
write status

Definition at line 687 of file flash_fat16.c.

Referenced by flash_fat16_sector_write().

◆ get_inquiry()

uint8_t * get_inquiry ( uint8_t lun )

get disk inquiry

Parameters
lun logical units number
Return values
inquiry string

Definition at line 58 of file virtual_msc_iap/src/msc_diskio.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/src/at32f413_int.c.

◆ jump_to_app()

void jump_to_app ( uint32_t address )

jump to app

Parameters
none
Return values
none

Definition at line 249 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 126 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/src/at32f413_int.c.

◆ msc_disk_capacity()

usb_sts_type msc_disk_capacity | ( | uint8_t | lun,
 |  | uint32_t * | blk_nbr,
 |  | uint32_t * | blk_size )

disk capacity

Parameters
lun | logical units number
blk_nbr | pointer to number of block
blk_size | pointer to block size
Return values
status of usb_sts_type

Definition at line 116 of file virtual_msc_iap/src/msc_diskio.c.

◆ msc_disk_read()

usb_sts_type msc_disk_read | ( | uint8_t | lun,
 |  | uint64_t | addr,
 |  | uint8_t * | read_buf,
 |  | uint32_t | len )

disk read

Parameters
lun | logical units number
addr | logical address
read_buf | pointer to read buffer
len | read length
Return values
status of usb_sts_type

Definition at line 74 of file virtual_msc_iap/src/msc_diskio.c.

◆ msc_disk_write()

usb_sts_type msc_disk_write | ( | uint8_t | lun,
 |  | uint64_t | addr,
 |  | uint8_t * | buf,
 |  | uint32_t | len )

disk write

Parameters
lun | logical units number
addr | logical address
buf | pointer to write buffer
len | write length
Return values
status of usb_sts_type

Definition at line 96 of file virtual_msc_iap/src/msc_diskio.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/src/at32f413_int.c.

◆ usb_clock48m_select()

void usb_clock48m_select ( usb_clk48_s clk_s )

usb 48M clock select

Parameters
clk_s:USB_CLK_HICK,USB_CLK_HEXT
Return values
none

< acc hick trim

Definition at line 55 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c.

Referenced by main().

◆ usb_delay_ms()

void usb_delay_ms ( uint32_t ms )

usb delay millisecond function.

Parameters
ms number of millisecond delay
Return values
none

Definition at line 281 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c.

◆ usb_delay_us()

void usb_delay_us ( uint32_t us )

usb delay microsecond function.

Parameters
us number of microsecond delay
Return values
none

Definition at line 292 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c.

◆ usb_reset()

void usb_reset ( )

usb re-connect

Parameters
none
Return values
none

Definition at line 169 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c.

Referenced by flash_fat16_loop_status().

◆ USBFS_L_CAN1_RX0_IRQHandler()

void USBFS_L_CAN1_RX0_IRQHandler ( void )

this function handles usb interrupt.

Parameters
none
Return values
none

Definition at line 271 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c.

Variable Documentation

◆ fat16_file_name

uint8_t fat16_file_name[11]
Initial value:
=
{
'R',
'e',
'a',
'd',
'y',
' ',
' ',
' ',
'T',
'X',
'T'
}

Definition at line 158 of file flash_fat16.c.

Referenced by flash_fat16_read(), and flash_fat16_set_name().

◆ fat16_root_dir_sector

const uint8_t fat16_root_dir_sector[47]

Definition at line 109 of file flash_fat16.c.

Referenced by flash_fat16_read().

◆ fat16_sector

uint8_t fat16_sector[62]
static

Definition at line 38 of file flash_fat16.c.

Referenced by flash_fat16_read().

◆ fat16_table_sector0

const uint8_t fat16_table_sector0[4]
Initial value:
=
{
0xF8,
0xFF,
0xFF,
0xFF
}

Definition at line 150 of file flash_fat16.c.

Referenced by flash_fat16_read().

◆ file_match

uint8_t file_match = 0

Definition at line 176 of file flash_fat16.c.

Referenced by flash_fat16_boot_dir_write(), and flash_fat16_sector_write().

◆ file_write_nr

uint32_t file_write_nr = 0

Definition at line 175 of file flash_fat16.c.

◆ flash_iap

flash_iap_type flash_iap

Definition at line 174 of file flash_fat16.c.

Referenced by flash_fat16_addr_offset(), flash_fat16_boot_dir_write(), flash_fat16_clear_upgrade_flag(), flash_fat16_get_upgrade_flag(), flash_fat16_init(), flash_fat16_loop_status(), flash_fat16_sector_write(), flash_fat16_set_upgrade_flag(), flash_write_data(), and main().

◆ g_file_attr

fat_dir_type g_file_attr

Definition at line 173 of file flash_fat16.c.

Referenced by flash_fat16_boot_dir_write(), and flash_fat16_sector_write().

◆ jumpaddr

uint32_t jumpaddr

Definition at line 47 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c.

Referenced by jump_to_app().

◆ pftarget

void(* pftarget) (void) ( void )

Definition at line 44 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c.

Referenced by jump_to_app().

◆ scsi_inquiry

uint8_t scsi_inquiry[MSC_SUPPORT_MAX_LUN][SCSI_INQUIRY_DATA_LENGTH]
Initial value:
=
{
{
0x00,
0x80,
0x00,
0x01,
SCSI_INQUIRY_DATA_LENGTH - 5,
0x00, 0x00, 0x00,
'A', 'T', '3', '2', ' ', ' ', ' ', ' ',
'M', 's', 'c', ' ', 'i', 'a', 'p', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
'2', '.', '0', '0'
},
}
SCSI_INQUIRY_DATA_LENGTH
#define SCSI_INQUIRY_DATA_LENGTH
Definition cdc_msc_class.h:156

Definition at line 37 of file virtual_msc_iap/src/msc_diskio.c.

Referenced by get_inquiry().

◆ stkptr

uint32_t stkptr

Definition at line 47 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c.

Referenced by jump_to_app().

◆ usb_core_dev

usbd_core_type usb_core_dev

Definition at line 42 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c.

Referenced by main(), usb_reset(), and USBFS_L_CAN1_RX0_IRQHandler().


AT32F413 Firmwary Library: USB_device_virtual_msc_iap_definition

Data Structures | Macros | Enumerations | Functions | Variables
USB_device_virtual_msc_iap_definition
AT32F413_periph_examples » USB_device_virtual_msc_iap

Data Structures

struct | fat_dir_type
struct | flash_iap_type

Macros

#define | FAT16_SECTOR_SIZE 62
#define | FAT16_TABLE_SIZE 4
#define | FAT16_BYTE_PER_SIZE 2048
#define | FAT16_FILENAME_SIZE 11
#define | FAT16_DIR_SIZE 47
#define | FLASH_FAT16_BOOT_SECTOR_ADDR 0x00
#define | FLASH_FAT16_1_ADDR 0x3000
#define | FLASH_FAT16_2_ADDR 0x3800
#define | FLASH_FAT16_ROOT_ADDR 0x4000
#define | FLASH_FAT16_FILE_START_ADDR 0x8800
#define | FLASH_APP_START_ADDR 0x08005000
#define | FLASH_SECTOR_1K_SIZE 0x400
#define | FLASH_SECTOR_2K_SIZE 0x800
#define | FLASH_SECTOR_4K_SIZE 0x1000
#define | FLASH_SECTOR_1K_ALLGNED 0x3FF
#define | FLASH_SECTOR_2K_ALLGNED 0x7FF
#define | FLASH_SECTOR_4K_ALLGNED 0xFFF
#define | FILE_SUFFIX1_LEN 3
#define | FILE_SUFFIX2_LEN 3
#define | FILE_SUFFIX1_NAME "BIN"
#define | FILE_SUFFIX2_NAME "bin"
#define | INVAILD_OFFSET_ADDR 0xFFFFFFFF
#define | IAP_UPGRADE_COMPLETE_FLAG 0x41544B38
#define | IAP_SUCCESS 0
#define | IAP_FAILED 1

Enumerations

enum upgrade_status_type {
UPGRADE_READY = 0 , UPGRAGE_ONGOING , UPGRADE_SUCCESS , UPGRADE_FAILED ,
UPGRADE_LARGE , UPGRADE_UNKNOWN , UPGRADE_DONE , UPGRADE_JUMP
}

Functions

uint32_t | flash_fat16_write (uint32_t fat_lbk, uint8_t *data, uint32_t len)
write a logical block address
uint32_t | flash_fat16_read (uint32_t fat_lbk, uint8_t *data, uint32_t len)
read a logical block address
void | flash_fat16_init (void)
flash fat16 iap init
void | flash_fat16_loop_status (void)
loop status
uint32_t | flash_fat16_set_name (const uint8_t *file_name, uint8_t len)
set file name
uint8_t | flash_fat16_get_upgrade_flag (void)
get iap upgrade complete flag

Variables

flash_iap_type flash_iap

Detailed Description

Macro Definition Documentation

◆ FAT16_BYTE_PER_SIZE

#define FAT16_BYTE_PER_SIZE 2048

Definition at line 49 of file flash_fat16.h.

Referenced by flash_fat16_read().

◆ FAT16_DIR_SIZE

#define FAT16_DIR_SIZE 47

Definition at line 51 of file flash_fat16.h.

Referenced by flash_fat16_read().

◆ FAT16_FILENAME_SIZE

#define FAT16_FILENAME_SIZE 11

Definition at line 50 of file flash_fat16.h.

Referenced by flash_fat16_read().

◆ FAT16_SECTOR_SIZE

#define FAT16_SECTOR_SIZE 62

Definition at line 47 of file flash_fat16.h.

◆ FAT16_TABLE_SIZE

#define FAT16_TABLE_SIZE 4

Definition at line 48 of file flash_fat16.h.

Referenced by flash_fat16_read().

◆ FILE_SUFFIX1_LEN

#define FILE_SUFFIX1_LEN 3

Definition at line 69 of file flash_fat16.h.

Referenced by flash_fat16_sector_write().

◆ FILE_SUFFIX1_NAME

#define FILE_SUFFIX1_NAME "BIN"

Definition at line 71 of file flash_fat16.h.

Referenced by flash_fat16_sector_write().

◆ FILE_SUFFIX2_LEN

#define FILE_SUFFIX2_LEN 3

Definition at line 70 of file flash_fat16.h.

Referenced by flash_fat16_sector_write().

◆ FILE_SUFFIX2_NAME

#define FILE_SUFFIX2_NAME "bin"

Definition at line 72 of file flash_fat16.h.

Referenced by flash_fat16_sector_write().

◆ FLASH_APP_START_ADDR

#define FLASH_APP_START_ADDR 0x08005000

Definition at line 59 of file flash_fat16.h.

Referenced by flash_fat16_init(), and flash_fat16_sector_write().

◆ FLASH_FAT16_1_ADDR

#define FLASH_FAT16_1_ADDR 0x3000

Definition at line 54 of file flash_fat16.h.

Referenced by flash_fat16_read(), and flash_fat16_write().

◆ FLASH_FAT16_2_ADDR

#define FLASH_FAT16_2_ADDR 0x3800

Definition at line 55 of file flash_fat16.h.

Referenced by flash_fat16_read(), and flash_fat16_write().

◆ FLASH_FAT16_BOOT_SECTOR_ADDR

#define FLASH_FAT16_BOOT_SECTOR_ADDR 0x00

Definition at line 53 of file flash_fat16.h.

Referenced by flash_fat16_read(), and flash_fat16_write().

◆ FLASH_FAT16_FILE_START_ADDR

#define FLASH_FAT16_FILE_START_ADDR 0x8800

Definition at line 57 of file flash_fat16.h.

Referenced by flash_fat16_write().

◆ FLASH_FAT16_ROOT_ADDR

#define FLASH_FAT16_ROOT_ADDR 0x4000

Definition at line 56 of file flash_fat16.h.

Referenced by flash_fat16_read(), and flash_fat16_write().

◆ FLASH_SECTOR_1K_ALLGNED

#define FLASH_SECTOR_1K_ALLGNED 0x3FF

Definition at line 65 of file flash_fat16.h.

Referenced by flash_fat16_init().

◆ FLASH_SECTOR_1K_SIZE

#define FLASH_SECTOR_1K_SIZE 0x400

Definition at line 61 of file flash_fat16.h.

Referenced by flash_fat16_init().

◆ FLASH_SECTOR_2K_ALLGNED

#define FLASH_SECTOR_2K_ALLGNED 0x7FF

Definition at line 66 of file flash_fat16.h.

Referenced by flash_fat16_init().

◆ FLASH_SECTOR_2K_SIZE

#define FLASH_SECTOR_2K_SIZE 0x800

Definition at line 62 of file flash_fat16.h.

Referenced by flash_fat16_init(), and msc_disk_capacity().

◆ FLASH_SECTOR_4K_ALLGNED

#define FLASH_SECTOR_4K_ALLGNED 0xFFF

Definition at line 67 of file flash_fat16.h.

◆ FLASH_SECTOR_4K_SIZE

#define FLASH_SECTOR_4K_SIZE 0x1000

Definition at line 63 of file flash_fat16.h.

◆ IAP_FAILED

#define IAP_FAILED 1

Definition at line 77 of file flash_fat16.h.

Referenced by flash_fat16_get_upgrade_flag(), iap_address(), iap_get_upgrade_flag(), usbd_hid_iap_process(), and usbd_hid_iap_process().

◆ IAP_SUCCESS

#define IAP_SUCCESS 0

Definition at line 76 of file flash_fat16.h.

Referenced by flash_fat16_get_upgrade_flag(), iap_address(), iap_data_write(), iap_get_upgrade_flag(), main(), usbd_hid_iap_process(), and usbd_hid_iap_process().

◆ IAP_UPGRADE_COMPLETE_FLAG

#define IAP_UPGRADE_COMPLETE_FLAG 0x41544B38

Definition at line 75 of file flash_fat16.h.

Referenced by flash_fat16_get_upgrade_flag(), flash_fat16_set_upgrade_flag(), iap_get_upgrade_flag(), and iap_set_upgrade_flag().

◆ INVAILD_OFFSET_ADDR

#define INVAILD_OFFSET_ADDR 0xFFFFFFFF

Definition at line 74 of file flash_fat16.h.

Referenced by flash_fat16_addr_offset(), and flash_fat16_sector_write().

Enumeration Type Documentation

◆ upgrade_status_type

enum upgrade_status_type
Enumerator
UPGRADE_READY
UPGRAGE_ONGOING
UPGRADE_SUCCESS
UPGRADE_FAILED
UPGRADE_LARGE
UPGRADE_UNKNOWN
UPGRADE_DONE
UPGRADE_JUMP

Definition at line 79 of file flash_fat16.h.

Function Documentation

◆ flash_fat16_get_upgrade_flag()

uint8_t flash_fat16_get_upgrade_flag ( void )

get iap upgrade complete flag

Parameters
none
Return values
the iap flag

Definition at line 271 of file flash_fat16.c.

Referenced by main().

◆ flash_fat16_init()

void flash_fat16_init ( void )

flash fat16 iap init

Parameters
none
Return values
none

Definition at line 736 of file flash_fat16.c.

Referenced by main().

◆ flash_fat16_loop_status()

void flash_fat16_loop_status ( void )

loop status

Parameters
none
Return values
none

Definition at line 182 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c.

Referenced by main().

◆ flash_fat16_read()

uint32_t flash_fat16_read | ( | uint32_t | fat_lbk,
 |  | uint8_t * | data,
 |  | uint32_t | len )

read a logical block address

Parameters
fat_lbk | logical block address to read
data | pointer to array to store data read
len | data length
Return values
read length

Definition at line 291 of file flash_fat16.c.

Referenced by msc_disk_read().

◆ flash_fat16_set_name()

uint32_t flash_fat16_set_name | ( | const uint8_t * | file_name,
 |  | uint8_t | len )

set file name

Parameters
file_name | file name
len | filename length
Return values
filename length

Definition at line 360 of file flash_fat16.c.

Referenced by flash_fat16_loop_status().

◆ flash_fat16_write()

uint32_t flash_fat16_write | ( | uint32_t | fat_lbk,
 |  | uint8_t * | data,
 |  | uint32_t | len )

write a logical block address

Parameters
fat_lbk | logical block address to read
data | pointer to array to store data read
len | data length
Return values
read length

Definition at line 332 of file flash_fat16.c.

Referenced by msc_disk_write().

Variable Documentation

◆ flash_iap

flash_iap_type flash_iap
extern

Definition at line 174 of file flash_fat16.c.

Referenced by flash_fat16_addr_offset(), flash_fat16_boot_dir_write(), flash_fat16_clear_upgrade_flag(), flash_fat16_get_upgrade_flag(), flash_fat16_init(), flash_fat16_loop_status(), flash_fat16_sector_write(), flash_fat16_set_upgrade_flag(), flash_write_data(), and main().


AT32F413 Firmwary Library: fat_dir_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
fat_dir_type Struct Reference
AT32F413_periph_examples » USB_device_virtual_msc_iap » USB_device_virtual_msc_iap_definition

#include <flash_fat16.h>

Data Fields

uint8_t | file_name [11]
uint8_t | attr
uint8_t | res
uint8_t | create_time_tenth
uint16_t | create_time
uint16_t | create_data
uint16_t | last_access_data
uint16_t | clus_high
uint16_t | write_time
uint16_t | write_data
uint16_t | clus_low
uint32_t | file_size

Detailed Description

Definition at line 91 of file flash_fat16.h.

Field Documentation

◆ attr

uint8_t fat_dir_type::attr

Definition at line 94 of file flash_fat16.h.

Referenced by flash_fat16_boot_dir_write().

◆ clus_high

uint16_t fat_dir_type::clus_high

Definition at line 100 of file flash_fat16.h.

◆ clus_low

uint16_t fat_dir_type::clus_low

Definition at line 103 of file flash_fat16.h.

Referenced by flash_fat16_sector_write().

◆ create_data

uint16_t fat_dir_type::create_data

Definition at line 98 of file flash_fat16.h.

◆ create_time

uint16_t fat_dir_type::create_time

Definition at line 97 of file flash_fat16.h.

◆ create_time_tenth

uint8_t fat_dir_type::create_time_tenth

Definition at line 96 of file flash_fat16.h.

◆ file_name

uint8_t fat_dir_type::file_name[11]

Definition at line 93 of file flash_fat16.h.

Referenced by flash_fat16_sector_write().

◆ file_size

uint32_t fat_dir_type::file_size

Definition at line 104 of file flash_fat16.h.

Referenced by flash_fat16_boot_dir_write(), and flash_fat16_sector_write().

◆ last_access_data

uint16_t fat_dir_type::last_access_data

Definition at line 99 of file flash_fat16.h.

◆ res

uint8_t fat_dir_type::res

Definition at line 95 of file flash_fat16.h.

◆ write_data

uint16_t fat_dir_type::write_data

Definition at line 102 of file flash_fat16.h.

Referenced by flash_fat16_boot_dir_write().

◆ write_time

uint16_t fat_dir_type::write_time

Definition at line 101 of file flash_fat16.h.

Referenced by flash_fat16_boot_dir_write().

The documentation for this struct was generated from the following file:
  • flash_fat16.h


AT32F413 Firmwary Library: flash_iap_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
flash_iap_type Struct Reference
AT32F413_periph_examples » USB_device_virtual_msc_iap » USB_device_virtual_msc_iap_definition

#include <flash_fat16.h>

Data Fields

uint32_t | flash_base_addr
uint32_t | flash_app_addr
uint32_t | flash_size
uint32_t | flash_app_size
uint32_t | sector_size
uint32_t | sector_mask
uint32_t | firmware_length
uint32_t | write_crc
uint32_t | read_crc
uint32_t | write_addr
uint32_t | file_write_nr
upgrade_status_type msc_up_status

Detailed Description

Definition at line 107 of file flash_fat16.h.

Field Documentation

◆ file_write_nr

uint32_t flash_iap_type::file_write_nr

Definition at line 120 of file flash_fat16.h.

Referenced by flash_fat16_boot_dir_write(), and flash_fat16_sector_write().

◆ firmware_length

uint32_t flash_iap_type::firmware_length

Definition at line 115 of file flash_fat16.h.

◆ flash_app_addr

uint32_t flash_iap_type::flash_app_addr

Definition at line 110 of file flash_fat16.h.

Referenced by flash_fat16_addr_offset(), flash_fat16_clear_upgrade_flag(), flash_fat16_get_upgrade_flag(), flash_fat16_init(), flash_fat16_set_upgrade_flag(), and main().

◆ flash_app_size

uint32_t flash_iap_type::flash_app_size

Definition at line 112 of file flash_fat16.h.

Referenced by flash_fat16_init(), and flash_fat16_sector_write().

◆ flash_base_addr

uint32_t flash_iap_type::flash_base_addr

Definition at line 109 of file flash_fat16.h.

Referenced by flash_fat16_addr_offset(), flash_fat16_init(), flash_fat16_sector_write(), and flash_write_data().

◆ flash_size

uint32_t flash_iap_type::flash_size

Definition at line 111 of file flash_fat16.h.

Referenced by flash_fat16_addr_offset(), flash_fat16_init(), and flash_write_data().

◆ msc_up_status

upgrade_status_type flash_iap_type::msc_up_status

Definition at line 121 of file flash_fat16.h.

Referenced by flash_fat16_boot_dir_write(), flash_fat16_loop_status(), and flash_fat16_sector_write().

◆ read_crc

uint32_t flash_iap_type::read_crc

Definition at line 117 of file flash_fat16.h.

◆ sector_mask

uint32_t flash_iap_type::sector_mask

Definition at line 114 of file flash_fat16.h.

Referenced by flash_fat16_init(), and flash_write_data().

◆ sector_size

uint32_t flash_iap_type::sector_size

Definition at line 113 of file flash_fat16.h.

Referenced by flash_fat16_clear_upgrade_flag(), flash_fat16_get_upgrade_flag(), flash_fat16_init(), flash_fat16_set_upgrade_flag(), and flash_write_data().

◆ write_addr

uint32_t flash_iap_type::write_addr

Definition at line 119 of file flash_fat16.h.

Referenced by flash_fat16_init(), flash_fat16_loop_status(), and flash_fat16_sector_write().

◆ write_crc

uint32_t flash_iap_type::write_crc

Definition at line 116 of file flash_fat16.h.

The documentation for this struct was generated from the following file:
  • flash_fat16.h


AT32F413 Firmwary Library: USB_device_winusb

Macros | Functions | Variables
USB_device_winusb
AT32F413_periph_examples

Macros

#define | EPT0_TX_ADDR 0x40
usb endpoint max num define
#define | EPT0_RX_ADDR 0x80
#define | EPT1_TX_ADDR 0xC0
#define | EPT1_RX_ADDR 0x100
#define | EPT2_TX_ADDR 0x140
#define | EPT2_RX_ADDR 0x180
#define | EPT3_TX_ADDR 0x00
#define | EPT3_RX_ADDR 0x00
#define | EPT4_TX_ADDR 0x00
#define | EPT4_RX_ADDR 0x00
#define | EPT5_TX_ADDR 0x00
#define | EPT5_RX_ADDR 0x00
#define | EPT6_TX_ADDR 0x00
#define | EPT6_RX_ADDR 0x00
#define | EPT7_TX_ADDR 0x00
#define | EPT7_RX_ADDR 0x00
#define | USBD_SUPPORT_WINUSB 1
support winusb

Functions

void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.
void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | usb_clock48m_select (usb_clk48_s clk_s)
usb 48M clock select
int | main (void)
main function.
void | USBFS_L_CAN1_RX0_IRQHandler (void)
this function handles usb interrupt.

Variables

usbd_core_type usb_core_dev
uint8_t usb_buffer [256]

Detailed Description

Macro Definition Documentation

◆ EPT0_RX_ADDR

#define EPT0_RX_ADDR 0x80

usb endpoint 0 rx buffer address offset

Definition at line 74 of file project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h.

◆ EPT0_TX_ADDR

#define EPT0_TX_ADDR 0x40

usb endpoint max num define

usb buffer extend to 768-1280 bytes

auto malloc usb endpoint buffer

user custom endpoint buffer EPTn_TX_ADDR, EPTn_RX_ADDR must less than usb buffer size usb endpoint 0 tx buffer address offset

Definition at line 73 of file project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h.

◆ EPT1_RX_ADDR

#define EPT1_RX_ADDR 0x100

usb endpoint 1 rx buffer address offset

Definition at line 77 of file project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h.

◆ EPT1_TX_ADDR

#define EPT1_TX_ADDR 0xC0

usb endpoint 1 tx buffer address offset

Definition at line 76 of file project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h.

◆ EPT2_RX_ADDR

#define EPT2_RX_ADDR 0x180

usb endpoint 2 rx buffer address offset

Definition at line 80 of file project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h.

◆ EPT2_TX_ADDR

#define EPT2_TX_ADDR 0x140

usb endpoint 2 tx buffer address offset

Definition at line 79 of file project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h.

◆ EPT3_RX_ADDR

#define EPT3_RX_ADDR 0x00

usb endpoint 3 rx buffer address offset

Definition at line 83 of file project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h.

◆ EPT3_TX_ADDR

#define EPT3_TX_ADDR 0x00

usb endpoint 3 tx buffer address offset

Definition at line 82 of file project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h.

◆ EPT4_RX_ADDR

#define EPT4_RX_ADDR 0x00

usb endpoint 4 rx buffer address offset

Definition at line 86 of file project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h.

◆ EPT4_TX_ADDR

#define EPT4_TX_ADDR 0x00

usb endpoint 4 tx buffer address offset

Definition at line 85 of file project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h.

◆ EPT5_RX_ADDR

#define EPT5_RX_ADDR 0x00

usb endpoint 5 rx buffer address offset

Definition at line 89 of file project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h.

◆ EPT5_TX_ADDR

#define EPT5_TX_ADDR 0x00

usb endpoint 5 tx buffer address offset

Definition at line 88 of file project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h.

◆ EPT6_RX_ADDR

#define EPT6_RX_ADDR 0x00

usb endpoint 6 rx buffer address offset

Definition at line 92 of file project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h.

◆ EPT6_TX_ADDR

#define EPT6_TX_ADDR 0x00

usb endpoint 6 tx buffer address offset

Definition at line 91 of file project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h.

◆ EPT7_RX_ADDR

#define EPT7_RX_ADDR 0x00

usb endpoint 7 rx buffer address offset

Definition at line 95 of file project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h.

◆ EPT7_TX_ADDR

#define EPT7_TX_ADDR 0x00

usb endpoint 7 tx buffer address offset

Definition at line 94 of file project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h.

◆ USBD_SUPPORT_WINUSB

#define USBD_SUPPORT_WINUSB 1

support winusb

Definition at line 102 of file project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h.

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/usb_device/winusb/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/usb_device/winusb/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/usb_device/winusb/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 120 of file project/at_start_f413/examples/usb_device/winusb/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/usb_device/winusb/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/usb_device/winusb/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/usb_device/winusb/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/usb_device/winusb/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/usb_device/winusb/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/usb_device/winusb/src/at32f413_int.c.

◆ usb_clock48m_select()

void usb_clock48m_select ( usb_clk48_s clk_s )

usb 48M clock select

Parameters
clk_s:USB_CLK_HICK,USB_CLK_HEXT
Return values
none

< acc hick trim

Definition at line 49 of file project/at_start_f413/examples/usb_device/winusb/src/main.c.

Referenced by main().

◆ usb_delay_ms()

void usb_delay_ms ( uint32_t ms )

usb delay millisecond function.

Parameters
ms number of millisecond delay
Return values
none

Definition at line 190 of file project/at_start_f413/examples/usb_device/winusb/src/main.c.

◆ usb_delay_us()

void usb_delay_us ( uint32_t us )

usb delay microsecond function.

Parameters
us number of microsecond delay
Return values
none

Definition at line 201 of file project/at_start_f413/examples/usb_device/winusb/src/main.c.

◆ USBFS_L_CAN1_RX0_IRQHandler()

void USBFS_L_CAN1_RX0_IRQHandler ( void )

this function handles usb interrupt.

Parameters
none
Return values
none

Definition at line 180 of file project/at_start_f413/examples/usb_device/winusb/src/main.c.

Variable Documentation

◆ usb_buffer

uint8_t usb_buffer[256]

Definition at line 42 of file project/at_start_f413/examples/usb_device/winusb/src/main.c.

Referenced by main().

◆ usb_core_dev

usbd_core_type usb_core_dev

Definition at line 41 of file project/at_start_f413/examples/usb_device/winusb/src/main.c.

Referenced by main(), and USBFS_L_CAN1_RX0_IRQHandler().


AT32F413 Firmwary Library: WDT_reset

Functions
WDT_reset
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
int | main (void)
main function.

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/wdt/wdt_reset/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/wdt/wdt_reset/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/wdt/wdt_reset/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< watchdog timer reset flag

< watchdog timer reset flag

Definition at line 43 of file project/at_start_f413/examples/wdt/wdt_reset/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/wdt/wdt_reset/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/wdt/wdt_reset/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/wdt/wdt_reset/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/wdt/wdt_reset/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/wdt/wdt_reset/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/wdt/wdt_reset/src/at32f413_int.c.


AT32F413 Firmwary Library: WDT_standby

Functions
WDT_standby
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
int | main (void)
main function.

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/examples/wdt/wdt_standby/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/examples/wdt/wdt_standby/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/examples/wdt/wdt_standby/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< watchdog timer reset flag

< watchdog timer reset flag

Definition at line 43 of file project/at_start_f413/examples/wdt/wdt_standby/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/examples/wdt/wdt_standby/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/examples/wdt/wdt_standby/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/examples/wdt/wdt_standby/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/examples/wdt/wdt_standby/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/examples/wdt/wdt_standby/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/examples/wdt/wdt_standby/src/at32f413_int.c.


AT32F413 Firmwary Library: WWDT_reset

Functions
WWDT_reset
AT32F413_periph_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
int | main (void)
main function.

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 78 of file project/at_start_f413/examples/wwdt/wwdt_reset/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 113 of file project/at_start_f413/examples/wwdt/wwdt_reset/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 52 of file project/at_start_f413/examples/wwdt/wwdt_reset/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< window watchdog timer reset flag

< window watchdog timer reset flag

Definition at line 42 of file project/at_start_f413/examples/wwdt/wwdt_reset/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 65 of file project/at_start_f413/examples/wwdt/wwdt_reset/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 43 of file project/at_start_f413/examples/wwdt/wwdt_reset/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 122 of file project/at_start_f413/examples/wwdt/wwdt_reset/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 104 of file project/at_start_f413/examples/wwdt/wwdt_reset/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 131 of file project/at_start_f413/examples/wwdt/wwdt_reset/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 91 of file project/at_start_f413/examples/wwdt/wwdt_reset/src/at32f413_int.c.


AT32F413 Firmwary Library: AT32F413_periph_template

Topics
AT32F413_periph_template

Topics

System_clock_configuration
LED_toggle
Library_configuration

Detailed Description

Generated by doxygen 1.12.0


AT32F413 Firmwary Library: System_clock_configuration

Functions
System_clock_configuration
AT32F413_periph_template

Functions

void system_clock_config (void)
system clock config program

Detailed Description

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 55 of file project/at_start_f413/templates/src/at32f413_clock.c.


AT32F413 Firmwary Library: LED_toggle

Macros | Functions | Variables
LED_toggle
AT32F413_periph_template

Macros

#define | DELAY 100
#define | FAST 1
#define | SLOW 4

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | button_exint_init (void)
configure button exint
void | button_isr (void)
button handler function
void | EXINT0_IRQHandler (void)
exint0 interrupt handler
int | main (void)
main function.

Variables

uint8_t g_speed = 1

Detailed Description

Macro Definition Documentation

◆ DELAY

#define DELAY 100

Definition at line 37 of file project/at_start_f413/templates/src/main.c.

Referenced by main().

◆ FAST

#define FAST 1

Definition at line 38 of file project/at_start_f413/templates/src/main.c.

Referenced by button_isr().

◆ SLOW

#define SLOW 4

Definition at line 39 of file project/at_start_f413/templates/src/main.c.

Referenced by button_isr().

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file project/at_start_f413/templates/src/at32f413_int.c.

◆ button_exint_init()

void button_exint_init ( void )

configure button exint

Parameters
none
Return values
none

< external interrupt line 0

Definition at line 51 of file project/at_start_f413/templates/src/main.c.

Referenced by main().

◆ button_isr()

void button_isr ( void )

button handler function

Parameters
none
Return values
none

< external interrupt line 0

Definition at line 74 of file project/at_start_f413/templates/src/main.c.

Referenced by EXINT0_IRQHandler().

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file project/at_start_f413/templates/src/at32f413_int.c.

◆ EXINT0_IRQHandler()

void EXINT0_IRQHandler ( void )

exint0 interrupt handler

Parameters
none
Return values
none

Definition at line 97 of file project/at_start_f413/templates/src/main.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file project/at_start_f413/templates/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 107 of file project/at_start_f413/templates/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file project/at_start_f413/templates/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file project/at_start_f413/templates/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file project/at_start_f413/templates/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file project/at_start_f413/templates/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file project/at_start_f413/templates/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file project/at_start_f413/templates/src/at32f413_int.c.

Variable Documentation

◆ g_speed

uint8_t g_speed = 1

Definition at line 41 of file project/at_start_f413/templates/src/main.c.

Referenced by button_isr(), and main().


AT32F413 Firmwary Library: Library_configuration

Macros
Library_configuration
AT32F413_periph_template

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 84 of file project/at_start_f413/templates/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/templates/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/templates/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/templates/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 78 of file project/at_start_f413/templates/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/templates/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/templates/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/templates/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 81 of file project/at_start_f413/templates/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 77 of file project/at_start_f413/templates/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/templates/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 59 of file project/at_start_f413/templates/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 52 of file project/at_start_f413/templates/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 60 of file project/at_start_f413/templates/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/templates/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 61 of file project/at_start_f413/templates/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 85 of file project/at_start_f413/templates/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/templates/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/templates/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 82 of file project/at_start_f413/templates/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/templates/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/templates/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/templates/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 83 of file project/at_start_f413/templates/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 80 of file project/at_start_f413/templates/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 79 of file project/at_start_f413/templates/inc/at32f413_conf.h.


AT32F413 Firmwary Library: AT32F413_board

Topics
AT32F413_board

Topics

BOARD
onboard periph driver

Detailed Description

Generated by doxygen 1.12.0


AT32F413 Firmwary Library: BOARD

Topics | Macros | Functions | Variables
BOARD
AT32F413_board

onboard periph driver More...

Topics

BOARD_pins_definition
BOARD_exported_functions

Macros

#define | STEP_DELAY_MS 50
#define | PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)

Functions

int | fputc (int ch, FILE *f)
retargets the c library printf function to the usart.
void | uart_print_init (uint32_t baudrate)
initialize uart
void | at32_board_init ()
board initialize interface init led and button
void | at32_button_init (void)
configure button gpio
uint8_t | at32_button_state (void)
returns the selected button state
button_type at32_button_press ()
returns which button have press down
void | at32_led_init (led_type led)
configure led gpio
void | at32_led_on (led_type led)
turns selected led on.
void | at32_led_off (led_type led)
turns selected led off.
void | at32_led_toggle (led_type led)
turns selected led toggle.
void | delay_init ()
initialize delay function
void | delay_us (uint32_t nus)
inserts a delay time.
void | delay_ms (uint16_t nms)
inserts a delay time.
void | delay_sec (uint16_t sec)
inserts a delay time.

Variables

gpio_type * | led_gpio_port [3] = {LED2_GPIO, LED3_GPIO, LED4_GPIO}
uint16_t | led_gpio_pin [3] = {LED2_PIN, LED3_PIN, LED4_PIN}
crm_periph_clock_type | led_gpio_crm_clk [3] = {LED2_GPIO_CRM_CLK, LED3_GPIO_CRM_CLK, LED4_GPIO_CRM_CLK}
static __IO uint32_t | fac_us
static __IO uint32_t | fac_ms

Detailed Description

onboard periph driver

Macro Definition Documentation

◆ PUTCHAR_PROTOTYPE

#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)

Definition at line 85 of file at32f413_board.c.

◆ STEP_DELAY_MS

#define STEP_DELAY_MS 50

Definition at line 38 of file at32f413_board.c.

Referenced by delay_ms().

Function Documentation

◆ at32_board_init()

void at32_board_init ( void )

board initialize interface init led and button

Parameters
none
Return values
none

Definition at line 162 of file at32f413_board.c.

Referenced by main().

◆ at32_button_init()

void at32_button_init ( void )

configure button gpio

Parameters
button specifies the button to be configured.
Return values
none

< gpio pins number 0

Definition at line 184 of file at32f413_board.c.

Referenced by at32_board_init().

◆ at32_button_press()

button_type at32_button_press ( void )

returns which button have press down

Parameters
none
Return values
the button have press down

Definition at line 218 of file at32f413_board.c.

Referenced by main().

◆ at32_button_state()

uint8_t at32_button_state ( void )

returns the selected button state

Parameters
none
Return values
the button gpio pin value

< gpio pins number 0

Definition at line 208 of file at32f413_board.c.

Referenced by at32_button_press().

◆ at32_led_init()

void at32_led_init ( led_type led )

configure led gpio

Parameters
led specifies the led to be configured.
Return values
none

Definition at line 242 of file at32f413_board.c.

Referenced by at32_board_init(), and main().

◆ at32_led_off()

void at32_led_off ( led_type led )

turns selected led off.

Parameters
led specifies the led to be set off. this parameter can be one of following parameters:
  • LED2
  • LED3
  • LED4
Return values
none

Definition at line 287 of file at32f413_board.c.

Referenced by at32_board_init(), main(), sd_test_error(), sd_test_error(), sd_test_error(), TAMPER_IRQHandler(), usb_hid_buf_process(), and usb_hid_buf_process().

◆ at32_led_on()

void at32_led_on ( led_type led )

turns selected led on.

Parameters
led specifies the led to be set on. this parameter can be one of following parameters:
  • LED2
  • LED3
  • LED4
Return values
none

Definition at line 270 of file at32f413_board.c.

Referenced by DMA2_Channel1_IRQHandler(), main(), sd_test_error(), sd_test_error(), sd_test_error(), TAMPER_IRQHandler(), USART2_IRQHandler(), usb_hid_buf_process(), and usb_hid_buf_process().

◆ at32_led_toggle()

void at32_led_toggle ( led_type led )

turns selected led toggle.

Parameters
led specifies the led to be set off. this parameter can be one of following parameters:
  • LED2
  • LED3
  • LED4
Return values
none

Definition at line 304 of file at32f413_board.c.

Referenced by ACC_IRQHandler(), ADC1_2_IRQHandler(), error_handler(), EXINT0_IRQHandler(), EXINT4_IRQHandler(), led2_task_function(), led3_task_function(), main(), PVM_IRQHandler(), result_error(), RTC_IRQHandler(), RTCAlarm_IRQHandler(), spim_operate(), spim_run(), systick_handler(), TMR1_OVF_TMR10_IRQHandler(), TMR2_GLOBAL_IRQHandler(), TMR3_GLOBAL_IRQHandler(), USART1_IRQHandler(), and USBFS_L_CAN1_RX0_IRQHandler().

◆ delay_init()

void delay_init ( void )

initialize delay function

Parameters
none
Return values
none

Definition at line 317 of file at32f413_board.c.

Referenced by at32_board_init(), sclk_192m_hick_config(), sclk_64m_hick_config(), and sclk_96m_hext_config().

◆ delay_ms()

void delay_ms ( uint16_t nms )

inserts a delay time.

Parameters
nms specifies the delay time length, in milliseconds.
Return values
none

Definition at line 350 of file at32f413_board.c.

Referenced by at32_button_press(), button_isr(), delay_sec(), error_handler(), flash_fat16_loop_status(), FLASH_IRQHandler(), iap_loop(), main(), randnum_test(), sd_power_on(), sd_test_error(), sd_test_error(), sd_test_error(), spim_init(), spim_operate(), spim_run(), usb_delay_ms(), and usb_reset().

◆ delay_sec()

void delay_sec ( uint16_t sec )

inserts a delay time.

Parameters
sec specifies the delay time, in seconds.
Return values
none

Definition at line 382 of file at32f413_board.c.

Referenced by main(), and result_error().

◆ delay_us()

void delay_us ( uint32_t nus )

inserts a delay time.

Parameters
nus specifies the delay time length, in microsecond.
Return values
none

Definition at line 330 of file at32f413_board.c.

Referenced by main(), and usb_delay_us().

◆ fputc()

int fputc | ( | int | ch,
 |  | FILE * | f )

retargets the c library printf function to the usart.

Parameters
none
Return values
none

< usart transmit data buffer empty flag

< usart transmit data complete flag

Definition at line 93 of file at32f413_board.c.

◆ uart_print_init()

void uart_print_init ( uint32_t baudrate )

initialize uart

Parameters
baudrate uart baudrate
Return values
none

< gpio pins number 9

Definition at line 129 of file at32f413_board.c.

Referenced by main(), and main().

Variable Documentation

◆ fac_ms

__IO uint32_t fac_ms
static

Definition at line 47 of file at32f413_board.c.

Referenced by delay_init(), and delay_ms().

◆ fac_us

__IO uint32_t fac_us
static

Definition at line 46 of file at32f413_board.c.

Referenced by delay_init(), and delay_us().

◆ led_gpio_crm_clk

crm_periph_clock_type led_gpio_crm_clk[3] = {LED2_GPIO_CRM_CLK, LED3_GPIO_CRM_CLK, LED4_GPIO_CRM_CLK}

Definition at line 43 of file at32f413_board.c.

Referenced by at32_led_init().

◆ led_gpio_pin

uint16_t led_gpio_pin[3] = {LED2_PIN, LED3_PIN, LED4_PIN}

Definition at line 42 of file at32f413_board.c.

Referenced by at32_led_init(), at32_led_off(), at32_led_on(), and at32_led_toggle().

◆ led_gpio_port

gpio_type* led_gpio_port[3] = {LED2_GPIO, LED3_GPIO, LED4_GPIO}

Definition at line 41 of file at32f413_board.c.

Referenced by at32_led_init(), at32_led_off(), at32_led_on(), and at32_led_toggle().


AT32F413 Firmwary Library: BOARD_pins_definition

Macros | Enumerations
BOARD_pins_definition
AT32F413_board » BOARD

Macros

#define | LED_NUM 3
#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
#define | USER_BUTTON_PIN GPIO_PINS_0
#define | USER_BUTTON_PORT GPIOA
#define | USER_BUTTON_CRM_CLK CRM_GPIOA_PERIPH_CLOCK

Enumerations

enum | led_type { LED2 = 0 , LED3 = 1 , LED4 = 2 }
enum | button_type { USER_BUTTON = 0 , NO_BUTTON = 1 }

Detailed Description

Macro Definition Documentation

◆ LED_NUM

#define LED_NUM 3

Definition at line 67 of file at32f413_board.h.

Referenced by at32_led_off(), at32_led_on(), and at32_led_toggle().

◆ PRINT_UART

#define PRINT_UART USART1

Definition at line 84 of file at32f413_board.h.

Referenced by fputc(), and uart_print_init().

◆ PRINT_UART_CRM_CLK

#define PRINT_UART_CRM_CLK CRM_USART1_PERIPH_CLOCK

Definition at line 85 of file at32f413_board.h.

Referenced by uart_print_init().

◆ PRINT_UART_TX_GPIO

#define PRINT_UART_TX_GPIO GPIOA

Definition at line 87 of file at32f413_board.h.

Referenced by uart_print_init().

◆ PRINT_UART_TX_GPIO_CRM_CLK

#define PRINT_UART_TX_GPIO_CRM_CLK CRM_GPIOA_PERIPH_CLOCK

Definition at line 88 of file at32f413_board.h.

Referenced by uart_print_init().

◆ PRINT_UART_TX_PIN

#define PRINT_UART_TX_PIN GPIO_PINS_9

Definition at line 86 of file at32f413_board.h.

Referenced by uart_print_init().

◆ USER_BUTTON_CRM_CLK

#define USER_BUTTON_CRM_CLK CRM_GPIOA_PERIPH_CLOCK

Definition at line 99 of file at32f413_board.h.

Referenced by at32_button_init().

◆ USER_BUTTON_PIN

#define USER_BUTTON_PIN GPIO_PINS_0

Definition at line 97 of file at32f413_board.h.

Referenced by at32_button_init(), at32_button_state(), and button_isr().

◆ USER_BUTTON_PORT

#define USER_BUTTON_PORT GPIOA

Definition at line 98 of file at32f413_board.h.

Referenced by at32_button_init(), at32_button_state(), and button_isr().

Enumeration Type Documentation

◆ button_type

enum button_type
Enumerator
USER_BUTTON
NO_BUTTON

Definition at line 91 of file at32f413_board.h.

◆ led_type

enum led_type

this header include define support list:

  1. at-start-f413 v1.x board if define AT_START_F413_V1, the header file support at-start-f413 v1.x board
Enumerator
LED2
LED3
LED4

Definition at line 60 of file at32f413_board.h.


AT32F413 Firmwary Library: BOARD_exported_functions

Functions
BOARD_exported_functions
AT32F413_board » BOARD

Functions

void | at32_board_init (void)
board initialize interface init led and button
void | at32_led_init (led_type led)
configure led gpio
void | at32_led_on (led_type led)
turns selected led on.
void | at32_led_off (led_type led)
turns selected led off.
void | at32_led_toggle (led_type led)
turns selected led toggle.
void | at32_button_init (void)
configure button gpio
button_type | at32_button_press (void)
returns which button have press down
uint8_t | at32_button_state (void)
returns the selected button state
void | delay_init (void)
initialize delay function
void | delay_us (uint32_t nus)
inserts a delay time.
void | delay_ms (uint16_t nms)
inserts a delay time.
void | delay_sec (uint16_t sec)
inserts a delay time.
void | uart_print_init (uint32_t baudrate)
initialize uart

Detailed Description

Function Documentation

◆ at32_board_init()

void at32_board_init ( void )

board initialize interface init led and button

Parameters
none
Return values
none

Definition at line 162 of file at32f413_board.c.

Referenced by main().

◆ at32_button_init()

void at32_button_init ( void )

configure button gpio

Parameters
button specifies the button to be configured.
Return values
none

< gpio pins number 0

Definition at line 184 of file at32f413_board.c.

Referenced by at32_board_init().

◆ at32_button_press()

button_type at32_button_press ( void )

returns which button have press down

Parameters
none
Return values
the button have press down

Definition at line 218 of file at32f413_board.c.

Referenced by main().

◆ at32_button_state()

uint8_t at32_button_state ( void )

returns the selected button state

Parameters
none
Return values
the button gpio pin value

< gpio pins number 0

Definition at line 208 of file at32f413_board.c.

Referenced by at32_button_press().

◆ at32_led_init()

void at32_led_init ( led_type led )

configure led gpio

Parameters
led specifies the led to be configured.
Return values
none

Definition at line 242 of file at32f413_board.c.

Referenced by at32_board_init(), and main().

◆ at32_led_off()

void at32_led_off ( led_type led )

turns selected led off.

Parameters
led specifies the led to be set off. this parameter can be one of following parameters:
  • LED2
  • LED3
  • LED4
Return values
none

Definition at line 287 of file at32f413_board.c.

Referenced by at32_board_init(), main(), sd_test_error(), sd_test_error(), sd_test_error(), TAMPER_IRQHandler(), usb_hid_buf_process(), and usb_hid_buf_process().

◆ at32_led_on()

void at32_led_on ( led_type led )

turns selected led on.

Parameters
led specifies the led to be set on. this parameter can be one of following parameters:
  • LED2
  • LED3
  • LED4
Return values
none

Definition at line 270 of file at32f413_board.c.

Referenced by DMA2_Channel1_IRQHandler(), main(), sd_test_error(), sd_test_error(), sd_test_error(), TAMPER_IRQHandler(), USART2_IRQHandler(), usb_hid_buf_process(), and usb_hid_buf_process().

◆ at32_led_toggle()

void at32_led_toggle ( led_type led )

turns selected led toggle.

Parameters
led specifies the led to be set off. this parameter can be one of following parameters:
  • LED2
  • LED3
  • LED4
Return values
none

Definition at line 304 of file at32f413_board.c.

Referenced by ACC_IRQHandler(), ADC1_2_IRQHandler(), error_handler(), EXINT0_IRQHandler(), EXINT4_IRQHandler(), led2_task_function(), led3_task_function(), main(), PVM_IRQHandler(), result_error(), RTC_IRQHandler(), RTCAlarm_IRQHandler(), spim_operate(), spim_run(), systick_handler(), TMR1_OVF_TMR10_IRQHandler(), TMR2_GLOBAL_IRQHandler(), TMR3_GLOBAL_IRQHandler(), USART1_IRQHandler(), and USBFS_L_CAN1_RX0_IRQHandler().

◆ delay_init()

void delay_init ( void )

initialize delay function

Parameters
none
Return values
none

Definition at line 317 of file at32f413_board.c.

Referenced by at32_board_init(), sclk_192m_hick_config(), sclk_64m_hick_config(), and sclk_96m_hext_config().

◆ delay_ms()

void delay_ms ( uint16_t nms )

inserts a delay time.

Parameters
nms specifies the delay time length, in milliseconds.
Return values
none

Definition at line 350 of file at32f413_board.c.

Referenced by at32_button_press(), button_isr(), delay_sec(), error_handler(), flash_fat16_loop_status(), FLASH_IRQHandler(), iap_loop(), main(), randnum_test(), sd_power_on(), sd_test_error(), sd_test_error(), sd_test_error(), spim_init(), spim_operate(), spim_run(), usb_delay_ms(), and usb_reset().

◆ delay_sec()

void delay_sec ( uint16_t sec )

inserts a delay time.

Parameters
sec specifies the delay time, in seconds.
Return values
none

Definition at line 382 of file at32f413_board.c.

Referenced by main(), and result_error().

◆ delay_us()

void delay_us ( uint32_t nus )

inserts a delay time.

Parameters
nus specifies the delay time length, in microsecond.
Return values
none

Definition at line 330 of file at32f413_board.c.

Referenced by main(), and usb_delay_us().

◆ uart_print_init()

void uart_print_init ( uint32_t baudrate )

initialize uart

Parameters
baudrate uart baudrate
Return values
none

< gpio pins number 9

Definition at line 129 of file at32f413_board.c.

Referenced by main(), and main().


AT32F413 Firmwary Library: AT32F413_middlewares_i2c_application_library

Topics | Macros | Functions
AT32F413_middlewares_i2c_application_library

Topics

I2C_library_event_check_flag
I2C_library_memory_address_width_mode
I2C_library_transmission_mode
I2C_library_status_code
I2C_library_handler
I2C_library_exported_functions

Macros

#define | DMA_GET_TC_FLAG(DMA_CHANNEL)
get the dma transfer complete flag through the channel
#define | DMA_GET_HT_FLAG(DMA_CHANNEL)
get the dma half transfer flag through the channel
#define | DMA_GET_TERR_FLAG(DMA_CHANNEL)
get the dma transfer error flag through the channel
#define | I2C_START 0
i2c transmission status
#define | I2C_END 1

Functions

__WEAK void | i2c_lowlevel_init (i2c_handle_type *hi2c)
initializes peripherals used by the i2c.
void | i2c_config (i2c_handle_type *hi2c)
i2c peripheral initialization.
i2c_status_type | i2c_wait_end (i2c_handle_type *hi2c, uint32_t timeout)
wait for the transfer to end.
i2c_status_type | i2c_wait_flag (i2c_handle_type *hi2c, uint32_t flag, uint32_t event_check, uint32_t timeout)
wait for the flag to be set or reset, only BUSYF flag is waiting to be reset, and other flags are waiting to be set
void | i2c_dma_config (i2c_handle_type *hi2c, dma_channel_type *dma_channelx, uint8_t *pdata, uint16_t size)
dma transfer cofiguration.
i2c_status_type | i2c_master_write_addr (i2c_handle_type *hi2c, uint16_t address, uint32_t timeout)
send address in master transmits mode.
i2c_status_type | i2c_master_read_addr (i2c_handle_type *hi2c, uint16_t address, uint32_t timeout)
send address in master receive mode.
i2c_status_type | i2c_master_transmit (i2c_handle_type *hi2c, uint16_t address, uint8_t *pdata, uint16_t size, uint32_t timeout)
the master transmits data through polling mode.
i2c_status_type | i2c_slave_receive (i2c_handle_type *hi2c, uint8_t *pdata, uint16_t size, uint32_t timeout)
the slave receive data through polling mode.
i2c_status_type | i2c_master_receive (i2c_handle_type *hi2c, uint16_t address, uint8_t *pdata, uint16_t size, uint32_t timeout)
the master receive data through polling mode.
i2c_status_type | i2c_slave_transmit (i2c_handle_type *hi2c, uint8_t *pdata, uint16_t size, uint32_t timeout)
the slave transmits data through polling mode.
i2c_status_type | i2c_master_transmit_int (i2c_handle_type *hi2c, uint16_t address, uint8_t *pdata, uint16_t size, uint32_t timeout)
the master transmits data through interrupt mode.
i2c_status_type | i2c_slave_receive_int (i2c_handle_type *hi2c, uint8_t *pdata, uint16_t size, uint32_t timeout)
the slave receive data through interrupt mode.
i2c_status_type | i2c_master_receive_int (i2c_handle_type *hi2c, uint16_t address, uint8_t *pdata, uint16_t size, uint32_t timeout)
the master receive data through interrupt mode.
i2c_status_type | i2c_slave_transmit_int (i2c_handle_type *hi2c, uint8_t *pdata, uint16_t size, uint32_t timeout)
the slave transmits data through interrupt mode.
i2c_status_type | i2c_master_transmit_dma (i2c_handle_type *hi2c, uint16_t address, uint8_t *pdata, uint16_t size, uint32_t timeout)
the master transmits data through dma mode.
i2c_status_type | i2c_slave_receive_dma (i2c_handle_type *hi2c, uint8_t *pdata, uint16_t size, uint32_t timeout)
the slave receive data through dma mode.
i2c_status_type | i2c_master_receive_dma (i2c_handle_type *hi2c, uint16_t address, uint8_t *pdata, uint16_t size, uint32_t timeout)
the master receive data through dma mode.
i2c_status_type | i2c_slave_transmit_dma (i2c_handle_type *hi2c, uint8_t *pdata, uint16_t size, uint32_t timeout)
the slave transmits data through dma mode.
i2c_status_type | i2c_memory_address_send (i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t mem_address, int32_t timeout)
send memory address.
i2c_status_type | i2c_memory_write (i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
write data to the memory device through polling mode.
i2c_status_type | i2c_memory_read (i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
read data from memory device through polling mode.
i2c_status_type | i2c_memory_write_int (i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
write data to the memory device through interrupt mode.
i2c_status_type | i2c_memory_read_int (i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
read data from memory device through interrupt mode.
i2c_status_type | i2c_memory_write_dma (i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
write data to the memory device through dma mode.
i2c_status_type | i2c_memory_read_dma (i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
read data from memory device through polling mode.
void | i2c_master_tx_isr_int (i2c_handle_type *hi2c)
master transfer mode interrupt procession function
void | i2c_master_rx_isr_int (i2c_handle_type *hi2c)
master receive mode interrupt procession function
void | i2c_slave_tx_isr_int (i2c_handle_type *hi2c)
slave transfer mode interrupt procession function
void | i2c_slave_rx_isr_int (i2c_handle_type *hi2c)
slave receive mode interrupt procession function
void | i2c_master_tx_isr_dma (i2c_handle_type *hi2c)
master interrupt processing function in dma mode.
void | i2c_slave_tx_rx_isr_dma (i2c_handle_type *hi2c)
slave interrupt processing function in dma mode.
void | i2c_evt_irq_handler (i2c_handle_type *hi2c)
interrupt procession function.
void | i2c_dma_tx_irq_handler (i2c_handle_type *hi2c)
dma transmission complete interrupt function.
void | i2c_dma_rx_irq_handler (i2c_handle_type *hi2c)
dma reveive complete interrupt function.
void | i2c_err_irq_handler (i2c_handle_type *hi2c)
i2c error interrupt function.

Detailed Description

< define to prevent recursive inclusion ----------------------------------—

Macro Definition Documentation

◆ DMA_GET_HT_FLAG

#define DMA_GET_HT_FLAG ( DMA_CHANNEL )
Value:
(((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA1_CHANNEL1))? DMA1_HDT1_FLAG : \
((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA1_CHANNEL2))? DMA1_HDT2_FLAG : \
((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA1_CHANNEL3))? DMA1_HDT3_FLAG : \
((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA1_CHANNEL4))? DMA1_HDT4_FLAG : \
((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA1_CHANNEL5))? DMA1_HDT5_FLAG : \
((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA1_CHANNEL6))? DMA1_HDT6_FLAG : \
((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA1_CHANNEL7))? DMA1_HDT7_FLAG : \
((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA2_CHANNEL1))? DMA2_HDT1_FLAG : \
((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA2_CHANNEL2))? DMA2_HDT2_FLAG : \
((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA2_CHANNEL3))? DMA2_HDT3_FLAG : \
((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA2_CHANNEL4))? DMA2_HDT4_FLAG : \
((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA2_CHANNEL5))? DMA2_HDT5_FLAG : \
((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA2_CHANNEL6))? DMA2_HDT6_FLAG : \
DMA2_HDT7_FLAG)
DMA1_HDT5_FLAG
#define DMA1_HDT5_FLAG
Definition at32f413_dma.h:98
DMA2_HDT6_FLAG
#define DMA2_HDT6_FLAG
Definition at32f413_dma.h:131
DMA1_HDT7_FLAG
#define DMA1_HDT7_FLAG
Definition at32f413_dma.h:106
DMA2_HDT3_FLAG
#define DMA2_HDT3_FLAG
Definition at32f413_dma.h:119
DMA1_HDT4_FLAG
#define DMA1_HDT4_FLAG
Definition at32f413_dma.h:94
DMA2_HDT5_FLAG
#define DMA2_HDT5_FLAG
Definition at32f413_dma.h:127
DMA1_HDT3_FLAG
#define DMA1_HDT3_FLAG
Definition at32f413_dma.h:90
DMA2_HDT1_FLAG
#define DMA2_HDT1_FLAG
Definition at32f413_dma.h:111
DMA2_HDT2_FLAG
#define DMA2_HDT2_FLAG
Definition at32f413_dma.h:115
DMA1_HDT1_FLAG
#define DMA1_HDT1_FLAG
Definition at32f413_dma.h:82
DMA2_HDT4_FLAG
#define DMA2_HDT4_FLAG
Definition at32f413_dma.h:123
DMA2_HDT7_FLAG
#define DMA2_HDT7_FLAG
Definition at32f413_dma.h:135
DMA1_HDT2_FLAG
#define DMA1_HDT2_FLAG
Definition at32f413_dma.h:86
DMA1_HDT6_FLAG
#define DMA1_HDT6_FLAG
Definition at32f413_dma.h:102
DMA2_CHANNEL5
#define DMA2_CHANNEL5
Definition at32f413_dma.h:493
DMA1_CHANNEL3
#define DMA1_CHANNEL3
Definition at32f413_dma.h:482
DMA1_CHANNEL5
#define DMA1_CHANNEL5
Definition at32f413_dma.h:484
DMA2_CHANNEL2
#define DMA2_CHANNEL2
Definition at32f413_dma.h:490
DMA2_CHANNEL3
#define DMA2_CHANNEL3
Definition at32f413_dma.h:491
DMA1_CHANNEL4
#define DMA1_CHANNEL4
Definition at32f413_dma.h:483
DMA1_CHANNEL1
#define DMA1_CHANNEL1
Definition at32f413_dma.h:480
DMA2_CHANNEL6
#define DMA2_CHANNEL6
Definition at32f413_dma.h:494
DMA1_CHANNEL2
#define DMA1_CHANNEL2
Definition at32f413_dma.h:481
DMA2_CHANNEL4
#define DMA2_CHANNEL4
Definition at32f413_dma.h:492
DMA2_CHANNEL1
#define DMA2_CHANNEL1
Definition at32f413_dma.h:489
DMA1_CHANNEL6
#define DMA1_CHANNEL6
Definition at32f413_dma.h:485
DMA1_CHANNEL7
#define DMA1_CHANNEL7
Definition at32f413_dma.h:486

get the dma half transfer flag through the channel

Definition at line 55 of file i2c_application.c.

◆ DMA_GET_TC_FLAG

#define DMA_GET_TC_FLAG ( DMA_CHANNEL )
Value:
(((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA1_CHANNEL1))? DMA1_FDT1_FLAG : \
((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA1_CHANNEL2))? DMA1_FDT2_FLAG : \
((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA1_CHANNEL3))? DMA1_FDT3_FLAG : \
((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA1_CHANNEL4))? DMA1_FDT4_FLAG : \
((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA1_CHANNEL5))? DMA1_FDT5_FLAG : \
((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA1_CHANNEL6))? DMA1_FDT6_FLAG : \
((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA1_CHANNEL7))? DMA1_FDT7_FLAG : \
((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA2_CHANNEL1))? DMA2_FDT1_FLAG : \
((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA2_CHANNEL2))? DMA2_FDT2_FLAG : \
((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA2_CHANNEL3))? DMA2_FDT3_FLAG : \
((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA2_CHANNEL4))? DMA2_FDT4_FLAG : \
((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA2_CHANNEL5))? DMA2_FDT5_FLAG : \
((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA2_CHANNEL6))? DMA2_FDT6_FLAG : \
DMA2_FDT7_FLAG)
DMA1_FDT7_FLAG
#define DMA1_FDT7_FLAG
Definition at32f413_dma.h:105
DMA2_FDT7_FLAG
#define DMA2_FDT7_FLAG
Definition at32f413_dma.h:134
DMA2_FDT4_FLAG
#define DMA2_FDT4_FLAG
Definition at32f413_dma.h:122
DMA2_FDT6_FLAG
#define DMA2_FDT6_FLAG
Definition at32f413_dma.h:130
DMA2_FDT2_FLAG
#define DMA2_FDT2_FLAG
Definition at32f413_dma.h:114
DMA1_FDT4_FLAG
#define DMA1_FDT4_FLAG
Definition at32f413_dma.h:93
DMA1_FDT1_FLAG
#define DMA1_FDT1_FLAG
Definition at32f413_dma.h:81
DMA1_FDT6_FLAG
#define DMA1_FDT6_FLAG
Definition at32f413_dma.h:101
DMA2_FDT5_FLAG
#define DMA2_FDT5_FLAG
Definition at32f413_dma.h:126
DMA2_FDT1_FLAG
#define DMA2_FDT1_FLAG
Definition at32f413_dma.h:110
DMA2_FDT3_FLAG
#define DMA2_FDT3_FLAG
Definition at32f413_dma.h:118
DMA1_FDT5_FLAG
#define DMA1_FDT5_FLAG
Definition at32f413_dma.h:97
DMA1_FDT2_FLAG
#define DMA1_FDT2_FLAG
Definition at32f413_dma.h:85
DMA1_FDT3_FLAG
#define DMA1_FDT3_FLAG
Definition at32f413_dma.h:89

get the dma transfer complete flag through the channel

Definition at line 36 of file i2c_application.c.

Referenced by i2c_dma_rx_irq_handler(), and i2c_dma_tx_irq_handler().

◆ DMA_GET_TERR_FLAG

#define DMA_GET_TERR_FLAG ( DMA_CHANNEL )
Value:
(((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA1_CHANNEL1))? DMA1_DTERR1_FLAG : \
((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA1_CHANNEL2))? DMA1_DTERR2_FLAG : \
((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA1_CHANNEL3))? DMA1_DTERR3_FLAG : \
((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA1_CHANNEL4))? DMA1_DTERR4_FLAG : \
((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA1_CHANNEL5))? DMA1_DTERR5_FLAG : \
((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA1_CHANNEL6))? DMA1_DTERR6_FLAG : \
((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA1_CHANNEL7))? DMA1_DTERR7_FLAG : \
((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA2_CHANNEL1))? DMA2_DTERR1_FLAG : \
((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA2_CHANNEL2))? DMA2_DTERR2_FLAG : \
((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA2_CHANNEL3))? DMA2_DTERR3_FLAG : \
((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA2_CHANNEL4))? DMA2_DTERR4_FLAG : \
((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA2_CHANNEL5))? DMA2_DTERR5_FLAG : \
((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA2_CHANNEL6))? DMA2_DTERR6_FLAG : \
DMA2_DTERR7_FLAG)
DMA1_DTERR7_FLAG
#define DMA1_DTERR7_FLAG
Definition at32f413_dma.h:107
DMA1_DTERR3_FLAG
#define DMA1_DTERR3_FLAG
Definition at32f413_dma.h:91
DMA2_DTERR4_FLAG
#define DMA2_DTERR4_FLAG
Definition at32f413_dma.h:124
DMA2_DTERR7_FLAG
#define DMA2_DTERR7_FLAG
Definition at32f413_dma.h:136
DMA1_DTERR1_FLAG
#define DMA1_DTERR1_FLAG
Definition at32f413_dma.h:83
DMA1_DTERR4_FLAG
#define DMA1_DTERR4_FLAG
Definition at32f413_dma.h:95
DMA2_DTERR6_FLAG
#define DMA2_DTERR6_FLAG
Definition at32f413_dma.h:132
DMA1_DTERR6_FLAG
#define DMA1_DTERR6_FLAG
Definition at32f413_dma.h:103
DMA1_DTERR5_FLAG
#define DMA1_DTERR5_FLAG
Definition at32f413_dma.h:99
DMA1_DTERR2_FLAG
#define DMA1_DTERR2_FLAG
Definition at32f413_dma.h:87
DMA2_DTERR3_FLAG
#define DMA2_DTERR3_FLAG
Definition at32f413_dma.h:120
DMA2_DTERR5_FLAG
#define DMA2_DTERR5_FLAG
Definition at32f413_dma.h:128
DMA2_DTERR1_FLAG
#define DMA2_DTERR1_FLAG
Definition at32f413_dma.h:112
DMA2_DTERR2_FLAG
#define DMA2_DTERR2_FLAG
Definition at32f413_dma.h:116

get the dma transfer error flag through the channel

Definition at line 74 of file i2c_application.c.

◆ I2C_END

#define I2C_END 1

Definition at line 94 of file i2c_application.c.

Referenced by i2c_dma_rx_irq_handler(), i2c_err_irq_handler(), i2c_master_rx_isr_int(), i2c_master_tx_isr_dma(), i2c_master_tx_isr_int(), i2c_slave_rx_isr_int(), i2c_slave_tx_isr_int(), i2c_slave_tx_rx_isr_dma(), and i2c_wait_end().

◆ I2C_START

#define I2C_START 0

i2c transmission status

Definition at line 93 of file i2c_application.c.

Referenced by i2c_master_receive_dma(), i2c_master_receive_int(), i2c_master_transmit_dma(), i2c_master_transmit_int(), i2c_memory_read_dma(), i2c_memory_read_int(), i2c_memory_write_dma(), i2c_memory_write_int(), i2c_slave_receive_dma(), i2c_slave_receive_int(), i2c_slave_transmit_dma(), and i2c_slave_transmit_int().

Function Documentation

◆ i2c_config()

void i2c_config ( i2c_handle_type * hi2c )

i2c peripheral initialization.

Parameters
hi2c the handle points to the operation information.
Return values
none.

Definition at line 111 of file i2c_application.c.

Referenced by audio_codec_init(), and main().

◆ i2c_dma_config()

void i2c_dma_config | ( | i2c_handle_type * | hi2c,
 |  | dma_channel_type * | dma_channelx,
 |  | uint8_t * | pdata,
 |  | uint16_t | size )

dma transfer cofiguration.

Parameters
hi2c | the handle points to the operation information.
dma_channelx | dma channel to be cofigured.
pdata | data buffer.
size | data size.
Return values
none.

< dma full data transfer interrupt

< dma full data transfer interrupt

Definition at line 256 of file i2c_application.c.

Referenced by i2c_master_receive_dma(), i2c_master_transmit_dma(), i2c_memory_read_dma(), i2c_memory_write_dma(), i2c_slave_receive_dma(), and i2c_slave_transmit_dma().

◆ i2c_dma_rx_irq_handler()

void i2c_dma_rx_irq_handler ( i2c_handle_type * hi2c )

dma reveive complete interrupt function.

Parameters
hi2c the handle points to the operation information.
Return values
none.

< dma1 channel1 full data transfer flag

< dma1 channel2 full data transfer flag

< dma1 channel3 full data transfer flag

< dma1 channel4 full data transfer flag

< dma1 channel5 full data transfer flag

< dma1 channel6 full data transfer flag

< dma1 channel7 full data transfer flag

< dma2 channel1 full data transfer flag

< dma2 channel2 full data transfer flag

< dma2 channel3 full data transfer flag

< dma2 channel4 full data transfer flag

< dma2 channel5 full data transfer flag

< dma2 channel6 full data transfer flag

< dma2 channel7 full data transfer flag

< dma full data transfer interrupt

< dma1 channel1 full data transfer flag

< dma1 channel2 full data transfer flag

< dma1 channel3 full data transfer flag

< dma1 channel4 full data transfer flag

< dma1 channel5 full data transfer flag

< dma1 channel6 full data transfer flag

< dma1 channel7 full data transfer flag

< dma2 channel1 full data transfer flag

< dma2 channel2 full data transfer flag

< dma2 channel3 full data transfer flag

< dma2 channel4 full data transfer flag

< dma2 channel5 full data transfer flag

< dma2 channel6 full data transfer flag

< dma2 channel7 full data transfer flag

< i2c acknowledge failure flag

< i2c event interrupt

Definition at line 2293 of file i2c_application.c.

Referenced by DMA1_Channel5_IRQHandler(), and DMA1_Channel7_IRQHandler().

◆ i2c_dma_tx_irq_handler()

void i2c_dma_tx_irq_handler ( i2c_handle_type * hi2c )

dma transmission complete interrupt function.

Parameters
hi2c the handle points to the operation information.
Return values
none.

< dma1 channel1 full data transfer flag

< dma1 channel2 full data transfer flag

< dma1 channel3 full data transfer flag

< dma1 channel4 full data transfer flag

< dma1 channel5 full data transfer flag

< dma1 channel6 full data transfer flag

< dma1 channel7 full data transfer flag

< dma2 channel1 full data transfer flag

< dma2 channel2 full data transfer flag

< dma2 channel3 full data transfer flag

< dma2 channel4 full data transfer flag

< dma2 channel5 full data transfer flag

< dma2 channel6 full data transfer flag

< dma2 channel7 full data transfer flag

< dma full data transfer interrupt

< dma1 channel1 full data transfer flag

< dma1 channel2 full data transfer flag

< dma1 channel3 full data transfer flag

< dma1 channel4 full data transfer flag

< dma1 channel5 full data transfer flag

< dma1 channel6 full data transfer flag

< dma1 channel7 full data transfer flag

< dma2 channel1 full data transfer flag

< dma2 channel2 full data transfer flag

< dma2 channel3 full data transfer flag

< dma2 channel4 full data transfer flag

< dma2 channel5 full data transfer flag

< dma2 channel6 full data transfer flag

< dma2 channel7 full data transfer flag

< i2c event interrupt

< i2c error interrupt

Definition at line 2256 of file i2c_application.c.

Referenced by DMA1_Channel4_IRQHandler(), and DMA1_Channel6_IRQHandler().

◆ i2c_err_irq_handler()

void i2c_err_irq_handler ( i2c_handle_type * hi2c )

i2c error interrupt function.

Parameters
hi2c the handle points to the operation information.
Return values
none.

< i2c bus error flag

< i2c bus error flag

< i2c arbitration lost flag

< i2c arbitration lost flag

< i2c acknowledge failure flag

< i2c acknowledge failure flag

< i2c event interrupt

< i2c overflow or underflow flag

< i2c overflow or underflow flag

< i2c pec receive error flag

< i2c pec receive error flag

< i2c smbus timeout flag

< i2c smbus timeout flag

< i2c smbus alert flag

< i2c smbus alert flag

< i2c error interrupt

Definition at line 2339 of file i2c_application.c.

Referenced by I2C1_ERR_IRQHandler(), and I2C2_ERR_IRQHandler().

◆ i2c_evt_irq_handler()

void i2c_evt_irq_handler ( i2c_handle_type * hi2c )

interrupt procession function.

Parameters
hi2c the handle points to the operation information.
Return values
none.

Definition at line 2223 of file i2c_application.c.

Referenced by I2C1_EVT_IRQHandler(), and I2C2_EVT_IRQHandler().

◆ i2c_lowlevel_init()

__WEAK void i2c_lowlevel_init ( i2c_handle_type * hi2c )

initializes peripherals used by the i2c.

Parameters
none
Return values
none

< gpio pins number 6

< gpio pins number 7

< gpio pins number 6

< gpio pins number 7

< gpio pins number 6

< gpio pins number 7

< gpio pins number 10

< gpio pins number 11

< gpio pins number 10

< gpio pins number 11

Definition at line 101 of file i2c_application.c.

Referenced by i2c_config().

◆ i2c_master_read_addr()

i2c_status_type i2c_master_read_addr | ( | i2c_handle_type * | hi2c,
 |  | uint16_t | address,
 |  | uint32_t | timeout )

send address in master receive mode.

Parameters
hi2c | the handle points to the operation information.
address | slave address.
timeout | maximum waiting time.
Return values
i2c status.

< i2c start condition generation complete flag

< check flag none

< i2c master 9~8 bit address header match flag

< check flag ackfail

< i2c 0~7 bit address match flag

< check flag ackfail

< i2c 0~7 bit address match flag

< i2c start condition generation complete flag

< check flag none

< i2c 0~7 bit address match flag

< check flag ackfail

Definition at line 338 of file i2c_application.c.

Referenced by i2c_master_receive(), i2c_master_receive_dma(), i2c_master_receive_int(), i2c_memory_read(), i2c_memory_read_dma(), and i2c_memory_read_int().

◆ i2c_master_receive()

i2c_status_type i2c_master_receive | ( | i2c_handle_type * | hi2c,
 |  | uint16_t | address,
 |  | uint8_t * | pdata,
 |  | uint16_t | size,
 |  | uint32_t | timeout )

the master receive data through polling mode.

Parameters
hi2c | the handle points to the operation information.
address | slave address.
pdata | data buffer.
size | data size.
timeout | maximum waiting time.
Return values
i2c status.

< i2c bus busy flag transmission mode

< check flag none

< i2c 0~7 bit address match flag

< i2c 0~7 bit address match flag

< i2c 0~7 bit address match flag

< i2c receive data buffer full flag

< check flag none

< i2c transmit data complete flag

< check flag none

< i2c transmit data complete flag

< check flag none

< i2c transmit data complete flag

< check flag none

< i2c receive data buffer full flag

< check flag none

Definition at line 564 of file i2c_application.c.

Referenced by main().

◆ i2c_master_receive_dma()

i2c_status_type i2c_master_receive_dma | ( | i2c_handle_type * | hi2c,
 |  | uint16_t | address,
 |  | uint8_t * | pdata,
 |  | uint16_t | size,
 |  | uint32_t | timeout )

the master receive data through dma mode.

Parameters
hi2c | the handle points to the operation information.
address | slave address.
pdata | data buffer.
size | data size.
timeout | maximum waiting time.
Return values
i2c status.

< i2c bus busy flag transmission mode

< check flag none

< i2c 0~7 bit address match flag

< i2c 0~7 bit address match flag

Definition at line 1126 of file i2c_application.c.

Referenced by main().

◆ i2c_master_receive_int()

i2c_status_type i2c_master_receive_int | ( | i2c_handle_type * | hi2c,
 |  | uint16_t | address,
 |  | uint8_t * | pdata,
 |  | uint16_t | size,
 |  | uint32_t | timeout )

the master receive data through interrupt mode.

Parameters
hi2c | the handle points to the operation information.
address | slave address.
pdata | data buffer.
size | data size.
timeout | maximum waiting time.
Return values
i2c status.

< i2c bus busy flag transmission mode

< check flag none

< i2c 0~7 bit address match flag

< i2c 0~7 bit address match flag

< i2c 0~7 bit address match flag

< i2c event interrupt

< i2c data transmission interrupt

< i2c error interrupt

Definition at line 908 of file i2c_application.c.

Referenced by main().

◆ i2c_master_rx_isr_int()

void i2c_master_rx_isr_int ( i2c_handle_type * hi2c )

master receive mode interrupt procession function

Parameters
hi2c the handle points to the operation information.
Return values
none.

< i2c transmit data complete flag

< i2c event interrupt

< i2c data transmission interrupt

< i2c error interrupt

< i2c receive data buffer full flag

< i2c data transmission interrupt

< i2c event interrupt

< i2c data transmission interrupt

< i2c error interrupt

Definition at line 2017 of file i2c_application.c.

Referenced by i2c_evt_irq_handler().

◆ i2c_master_transmit()

i2c_status_type i2c_master_transmit | ( | i2c_handle_type * | hi2c,
 |  | uint16_t | address,
 |  | uint8_t * | pdata,
 |  | uint16_t | size,
 |  | uint32_t | timeout )

the master transmits data through polling mode.

Parameters
hi2c | the handle points to the operation information.
address | slave address.
pdata | data buffer.
size | data size.
timeout | maximum waiting time.
Return values
i2c status.

< i2c bus busy flag transmission mode

< check flag none

< i2c 0~7 bit address match flag

< i2c transmit data buffer empty flag

< check flag ackfail

< i2c transmit data complete flag

< check flag ackfail

Definition at line 421 of file i2c_application.c.

Referenced by audio_codec_init(), audio_codec_loop(), audio_codec_modify_freq(), and main().

◆ i2c_master_transmit_dma()

i2c_status_type i2c_master_transmit_dma | ( | i2c_handle_type * | hi2c,
 |  | uint16_t | address,
 |  | uint8_t * | pdata,
 |  | uint16_t | size,
 |  | uint32_t | timeout )

the master transmits data through dma mode.

Parameters
hi2c | the handle points to the operation information.
address | slave address.
pdata | data buffer.
size | data size.
timeout | maximum waiting time.
Return values
i2c status.

< i2c bus busy flag transmission mode

< check flag none

< i2c 0~7 bit address match flag

Definition at line 1025 of file i2c_application.c.

Referenced by main().

◆ i2c_master_transmit_int()

i2c_status_type i2c_master_transmit_int | ( | i2c_handle_type * | hi2c,
 |  | uint16_t | address,
 |  | uint8_t * | pdata,
 |  | uint16_t | size,
 |  | uint32_t | timeout )

the master transmits data through interrupt mode.

Parameters
hi2c | the handle points to the operation information.
address | slave address.
pdata | data buffer.
size | data size.
timeout | maximum waiting time.
Return values
i2c status.

< i2c bus busy flag transmission mode

< check flag none

< i2c 0~7 bit address match flag

< i2c event interrupt

< i2c data transmission interrupt

< i2c error interrupt

Definition at line 822 of file i2c_application.c.

Referenced by main().

◆ i2c_master_tx_isr_dma()

void i2c_master_tx_isr_dma ( i2c_handle_type * hi2c )

master interrupt processing function in dma mode.

Parameters
hi2c the handle points to the operation information.
Return values
none.

< i2c transmit data complete flag

< i2c event interrupt

Definition at line 2171 of file i2c_application.c.

Referenced by i2c_evt_irq_handler().

◆ i2c_master_tx_isr_int()

void i2c_master_tx_isr_int ( i2c_handle_type * hi2c )

master transfer mode interrupt procession function

Parameters
hi2c the handle points to the operation information.
Return values
none.

< i2c transmit data buffer empty flag

< i2c event interrupt

< i2c data transmission interrupt

< i2c error interrupt

Definition at line 1987 of file i2c_application.c.

Referenced by i2c_evt_irq_handler().

◆ i2c_master_write_addr()

i2c_status_type i2c_master_write_addr | ( | i2c_handle_type * | hi2c,
 |  | uint16_t | address,
 |  | uint32_t | timeout )

send address in master transmits mode.

Parameters
hi2c | the handle points to the operation information.
address | slave address.
timeout | maximum waiting time.
Return values
i2c status.

< i2c start condition generation complete flag

< check flag none

< i2c master 9~8 bit address header match flag

< check flag ackfail

< i2c 0~7 bit address match flag

< check flag ackfail

Definition at line 285 of file i2c_application.c.

Referenced by i2c_master_transmit(), i2c_master_transmit_dma(), i2c_master_transmit_int(), i2c_memory_read(), i2c_memory_read_dma(), i2c_memory_read_int(), i2c_memory_write(), i2c_memory_write_dma(), and i2c_memory_write_int().

◆ i2c_memory_address_send()

i2c_status_type i2c_memory_address_send | ( | i2c_handle_type * | hi2c,
 |  | i2c_mem_address_width_type | mem_address_width,
 |  | uint16_t | mem_address,
 |  | int32_t | timeout )

send memory address.

Parameters
hi2c | the handle points to the operation information.
mem_address_width memory address width. this parameter can be one of the following values:
  • I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit
  • I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit
address | memory device address.
mem_address | memory address.
timeout | maximum waiting time.
Return values
i2c status.

< i2c transmit data buffer empty flag

< check flag ackfail

Definition at line 1253 of file i2c_application.c.

Referenced by i2c_memory_read(), i2c_memory_read_dma(), i2c_memory_read_int(), i2c_memory_write(), i2c_memory_write_dma(), and i2c_memory_write_int().

◆ i2c_memory_read()

i2c_status_type i2c_memory_read | ( | i2c_handle_type * | hi2c,
 |  | i2c_mem_address_width_type | mem_address_width,
 |  | uint16_t | address,
 |  | uint16_t | mem_address,
 |  | uint8_t * | pdata,
 |  | uint16_t | size,
 |  | uint32_t | timeout )

read data from memory device through polling mode.

Parameters
hi2c | the handle points to the operation information.
mem_address_width memory address width. this parameter can be one of the following values:
  • I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit
  • I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit
address | memory device address.
mem_address | memory address.
pdata | data buffer.
size | data size.
timeout | maximum waiting time.
Return values
i2c status.

< i2c bus busy flag transmission mode

< check flag none

< i2c 0~7 bit address match flag

< i2c transmit data buffer empty flag

< check flag ackfail

< i2c transmit data buffer empty flag

< check flag ackfail

< i2c 0~7 bit address match flag

< i2c 0~7 bit address match flag

< i2c 0~7 bit address match flag

< i2c receive data buffer full flag

< check flag none

< i2c transmit data complete flag

< check flag none

< i2c transmit data complete flag

< check flag none

< i2c transmit data complete flag

< check flag none

< i2c receive data buffer full flag

< check flag none

Definition at line 1388 of file i2c_application.c.

Referenced by eeprom_read_buffer(), and main().

◆ i2c_memory_read_dma()

i2c_status_type i2c_memory_read_dma | ( | i2c_handle_type * | hi2c,
 |  | i2c_mem_address_width_type | mem_address_width,
 |  | uint16_t | address,
 |  | uint16_t | mem_address,
 |  | uint8_t * | pdata,
 |  | uint16_t | size,
 |  | uint32_t | timeout )

read data from memory device through polling mode.

Parameters
hi2c | the handle points to the operation information.
mem_address_width memory address width. this parameter can be one of the following values:
  • I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit
  • I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit
address | memory device address.
mem_address | memory address.
pdata | data buffer.
size | data size.
timeout | maximum waiting time.
Return values
i2c status.

< i2c bus busy flag transmission mode

< check flag none

< i2c 0~7 bit address match flag

< i2c transmit data buffer empty flag

< check flag ackfail

< i2c transmit data buffer empty flag

< check flag ackfail

< i2c 0~7 bit address match flag

< i2c 0~7 bit address match flag

Definition at line 1878 of file i2c_application.c.

Referenced by eeprom_read_buffer(), and main().

◆ i2c_memory_read_int()

i2c_status_type i2c_memory_read_int | ( | i2c_handle_type * | hi2c,
 |  | i2c_mem_address_width_type | mem_address_width,
 |  | uint16_t | address,
 |  | uint16_t | mem_address,
 |  | uint8_t * | pdata,
 |  | uint16_t | size,
 |  | uint32_t | timeout )

read data from memory device through interrupt mode.

Parameters
hi2c | the handle points to the operation information.
mem_address_width memory address width. this parameter can be one of the following values:
  • I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit
  • I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit
address | memory device address.
mem_address | memory address.
pdata | data buffer.
size | data size.
timeout | maximum waiting time.
Return values
i2c status.

< i2c bus busy flag transmission mode

< check flag none

< i2c 0~7 bit address match flag

< i2c transmit data buffer empty flag

< check flag ackfail

< i2c transmit data buffer empty flag

< check flag ackfail

< i2c 0~7 bit address match flag

< i2c 0~7 bit address match flag

< i2c 0~7 bit address match flag

< i2c event interrupt

< i2c data transmission interrupt

< i2c error interrupt

Definition at line 1678 of file i2c_application.c.

Referenced by eeprom_read_buffer(), and main().

◆ i2c_memory_write()

i2c_status_type i2c_memory_write | ( | i2c_handle_type * | hi2c,
 |  | i2c_mem_address_width_type | mem_address_width,
 |  | uint16_t | address,
 |  | uint16_t | mem_address,
 |  | uint8_t * | pdata,
 |  | uint16_t | size,
 |  | uint32_t | timeout )

write data to the memory device through polling mode.

Parameters
hi2c | the handle points to the operation information.
mem_address_width memory address width. this parameter can be one of the following values:
  • I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit
  • I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit
address | memory device address.
mem_address | memory address.
pdata | data buffer.
size | data size.
timeout | maximum waiting time.
Return values
i2c status.

< i2c bus busy flag transmission mode

< check flag none

< i2c 0~7 bit address match flag

< i2c transmit data buffer empty flag

< check flag ackfail

< i2c transmit data buffer empty flag

< check flag ackfail

< i2c transmit data complete flag

< check flag ackfail

Definition at line 1299 of file i2c_application.c.

Referenced by eeprom_write_page(), and main().

◆ i2c_memory_write_dma()

i2c_status_type i2c_memory_write_dma | ( | i2c_handle_type * | hi2c,
 |  | i2c_mem_address_width_type | mem_address_width,
 |  | uint16_t | address,
 |  | uint16_t | mem_address,
 |  | uint8_t * | pdata,
 |  | uint16_t | size,
 |  | uint32_t | timeout )

write data to the memory device through dma mode.

Parameters
hi2c | the handle points to the operation information.
mem_address_width memory address width. this parameter can be one of the following values:
  • I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit
  • I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit
address | memory device address.
mem_address | memory address.
pdata | data buffer.
size | data size.
timeout | maximum waiting time.
Return values
i2c status.

< i2c bus busy flag transmission mode

< check flag none

< i2c 0~7 bit address match flag

< i2c transmit data buffer empty flag

< check flag ackfail

< i2c transmit data buffer empty flag

< check flag ackfail

Definition at line 1795 of file i2c_application.c.

Referenced by eeprom_write_page(), and main().

◆ i2c_memory_write_int()

i2c_status_type i2c_memory_write_int | ( | i2c_handle_type * | hi2c,
 |  | i2c_mem_address_width_type | mem_address_width,
 |  | uint16_t | address,
 |  | uint16_t | mem_address,
 |  | uint8_t * | pdata,
 |  | uint16_t | size,
 |  | uint32_t | timeout )

write data to the memory device through interrupt mode.

Parameters
hi2c | the handle points to the operation information.
mem_address_width memory address width. this parameter can be one of the following values:
  • I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit
  • I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit
address | memory device address.
mem_address | memory address.
pdata | data buffer.
size | data size.
timeout | maximum waiting time.
Return values
i2c status.

< i2c bus busy flag transmission mode

< check flag none

< i2c 0~7 bit address match flag

< i2c transmit data buffer empty flag

< check flag ackfail

< i2c transmit data buffer empty flag

< check flag ackfail

< i2c event interrupt

< i2c data transmission interrupt

< i2c error interrupt

Definition at line 1601 of file i2c_application.c.

Referenced by eeprom_write_page(), and main().

◆ i2c_slave_receive()

i2c_status_type i2c_slave_receive | ( | i2c_handle_type * | hi2c,
 |  | uint8_t * | pdata,
 |  | uint16_t | size,
 |  | uint32_t | timeout )

the slave receive data through polling mode.

Parameters
hi2c | the handle points to the operation information.
pdata | data buffer.
size | data size.
timeout | maximum waiting time.
Return values
i2c status.

< i2c bus busy flag transmission mode

< check flag none

< i2c 0~7 bit address match flag

< check flag none

< i2c 0~7 bit address match flag

< i2c receive data buffer full flag

< check flag stop

< i2c stop condition generation complete flag

< check flag ackfail

< i2c stop condition generation complete flag

Definition at line 489 of file i2c_application.c.

Referenced by main().

◆ i2c_slave_receive_dma()

i2c_status_type i2c_slave_receive_dma | ( | i2c_handle_type * | hi2c,
 |  | uint8_t * | pdata,
 |  | uint16_t | size,
 |  | uint32_t | timeout )

the slave receive data through dma mode.

Parameters
hi2c | the handle points to the operation information.
pdata | data buffer.
size | data size.
timeout | maximum waiting time.
Return values
i2c status.

< i2c bus busy flag transmission mode

< check flag none

< i2c event interrupt

Definition at line 1078 of file i2c_application.c.

Referenced by main().

◆ i2c_slave_receive_int()

i2c_status_type i2c_slave_receive_int | ( | i2c_handle_type * | hi2c,
 |  | uint8_t * | pdata,
 |  | uint16_t | size,
 |  | uint32_t | timeout )

the slave receive data through interrupt mode.

Parameters
hi2c | the handle points to the operation information.
pdata | data buffer.
size | data size.
timeout | maximum waiting time.
Return values
i2c status.

< i2c bus busy flag transmission mode

< check flag none

< i2c event interrupt

< i2c data transmission interrupt

< i2c error interrupt

Definition at line 869 of file i2c_application.c.

Referenced by main().

◆ i2c_slave_rx_isr_int()

void i2c_slave_rx_isr_int ( i2c_handle_type * hi2c )

slave receive mode interrupt procession function

Parameters
hi2c the handle points to the operation information.
Return values
none.

< i2c 0~7 bit address match flag

< i2c 0~7 bit address match flag

< i2c receive data buffer full flag

< i2c stop condition generation complete flag

< i2c stop condition generation complete flag

< i2c event interrupt

< i2c data transmission interrupt

< i2c error interrupt

Definition at line 2131 of file i2c_application.c.

Referenced by i2c_evt_irq_handler().

◆ i2c_slave_transmit()

i2c_status_type i2c_slave_transmit | ( | i2c_handle_type * | hi2c,
 |  | uint8_t * | pdata,
 |  | uint16_t | size,
 |  | uint32_t | timeout )

the slave transmits data through polling mode.

Parameters
hi2c | the handle points to the operation information.
pdata | data buffer.
size | data size.
timeout | maximum waiting time.
Return values
i2c status.

< i2c bus busy flag transmission mode

< check flag none

< i2c 0~7 bit address match flag

< check flag none

< i2c 0~7 bit address match flag

< i2c 0~7 bit address match flag

< check flag none

< i2c 0~7 bit address match flag

< i2c transmit data buffer empty flag

< check flag ackfail

< i2c acknowledge failure flag

< check flag none

< i2c acknowledge failure flag

Definition at line 735 of file i2c_application.c.

Referenced by main().

◆ i2c_slave_transmit_dma()

i2c_status_type i2c_slave_transmit_dma | ( | i2c_handle_type * | hi2c,
 |  | uint8_t * | pdata,
 |  | uint16_t | size,
 |  | uint32_t | timeout )

the slave transmits data through dma mode.

Parameters
hi2c | the handle points to the operation information.
pdata | data buffer.
size | data size.
timeout | maximum waiting time.
Return values
i2c status.

< i2c bus busy flag transmission mode

< check flag none

< i2c event interrupt

Definition at line 1202 of file i2c_application.c.

Referenced by main().

◆ i2c_slave_transmit_int()

i2c_status_type i2c_slave_transmit_int | ( | i2c_handle_type * | hi2c,
 |  | uint8_t * | pdata,
 |  | uint16_t | size,
 |  | uint32_t | timeout )

the slave transmits data through interrupt mode.

Parameters
hi2c | the handle points to the operation information.
pdata | data buffer.
size | data size.
timeout | maximum waiting time.
Return values
i2c status.

< i2c bus busy flag transmission mode

< check flag none

< i2c event interrupt

< i2c data transmission interrupt

< i2c error interrupt

Definition at line 986 of file i2c_application.c.

Referenced by main().

◆ i2c_slave_tx_isr_int()

void i2c_slave_tx_isr_int ( i2c_handle_type * hi2c )

slave transfer mode interrupt procession function

Parameters
hi2c the handle points to the operation information.
Return values
none.

< i2c 0~7 bit address match flag

< i2c 0~7 bit address match flag

< i2c transmit data buffer empty flag

< i2c data transmission interrupt

< i2c event interrupt

< i2c error interrupt

< i2c acknowledge failure flag

< check flag none

< i2c acknowledge failure flag

Definition at line 2090 of file i2c_application.c.

Referenced by i2c_evt_irq_handler().

◆ i2c_slave_tx_rx_isr_dma()

void i2c_slave_tx_rx_isr_dma ( i2c_handle_type * hi2c )

slave interrupt processing function in dma mode.

Parameters
hi2c the handle points to the operation information.
Return values
none.

< i2c 0~7 bit address match flag

< i2c 0~7 bit address match flag

< i2c stop condition generation complete flag

< i2c stop condition generation complete flag

< i2c event interrupt

Definition at line 2192 of file i2c_application.c.

Referenced by i2c_evt_irq_handler().

◆ i2c_wait_end()

i2c_status_type i2c_wait_end | ( | i2c_handle_type * | hi2c,
 |  | uint32_t | timeout )

wait for the transfer to end.

Parameters
hi2c | the handle points to the operation information.
timeout | maximum waiting time.
Return values
i2c status.

Definition at line 129 of file i2c_application.c.

Referenced by eeprom_read_buffer(), eeprom_write_page(), and main().

◆ i2c_wait_flag()

i2c_status_type i2c_wait_flag | ( | i2c_handle_type * | hi2c,
 |  | uint32_t | flag,
 |  | uint32_t | event_check,
 |  | uint32_t | timeout )

wait for the flag to be set or reset, only BUSYF flag is waiting to be reset, and other flags are waiting to be set

Parameters
hi2c | the handle points to the operation information.
flag specifies the flag to check. this parameter can be one of the following values:
  • I2C_STARTF_FLAG: start condition generation complete flag.
  • I2C_ADDR7F_FLAG: 0~7 bit address match flag.
  • I2C_TDC_FLAG: transmit data complete flag.
  • I2C_ADDRHF_FLAG: master 9~8 bit address header match flag.
  • I2C_STOPF_FLAG: stop condition generation complete flag.
  • I2C_RDBF_FLAG: receive data buffer full flag.
  • I2C_TDBE_FLAG: transmit data buffer empty flag.
  • I2C_BUSERR_FLAG: bus error flag.
  • I2C_ARLOST_FLAG: arbitration lost flag.
  • I2C_ACKFAIL_FLAG: acknowledge failure flag.
  • I2C_OUF_FLAG: overflow or underflow flag.
  • I2C_PECERR_FLAG: pec receive error flag.
  • I2C_TMOUT_FLAG: smbus timeout flag.
  • I2C_ALERTF_FLAG: smbus alert flag.
  • I2C_TRMODE_FLAG: transmission mode.
  • I2C_BUSYF_FLAG: bus busy flag transmission mode.
  • I2C_DIRF_FLAG: transmission direction flag.
  • I2C_GCADDRF_FLAG: general call address received flag.
  • I2C_DEVADDRF_FLAG: smbus device address received flag.
  • I2C_HOSTADDRF_FLAG: smbus host address received flag.
  • I2C_ADDR2_FLAG: own address 2 received flag.
event_check check other error flags while waiting for the flag. parameter as following values:
  • I2C_EVENT_CHECK_NONE
  • I2C_EVENT_CHECK_ACKFAIL
  • I2C_EVENT_CHECK_STOP
timeout | maximum waiting time.
Return values
i2c status.

< i2c bus busy flag transmission mode

< check flag ackfail

< i2c acknowledge failure flag

< i2c acknowledge failure flag

< check flag stop

< i2c stop condition generation complete flag

< i2c stop condition generation complete flag

Definition at line 185 of file i2c_application.c.

Referenced by eeprom_ready_check(), i2c_master_read_addr(), i2c_master_receive(), i2c_master_receive_dma(), i2c_master_receive_int(), i2c_master_transmit(), i2c_master_transmit_dma(), i2c_master_transmit_int(), i2c_master_write_addr(), i2c_memory_address_send(), i2c_memory_read(), i2c_memory_read_dma(), i2c_memory_read_int(), i2c_memory_write(), i2c_memory_write_dma(), i2c_memory_write_int(), i2c_slave_receive(), i2c_slave_receive_dma(), i2c_slave_receive_int(), i2c_slave_transmit(), i2c_slave_transmit_dma(), i2c_slave_transmit_int(), and i2c_slave_tx_isr_int().


AT32F413 Firmwary Library: I2C_library_event_check_flag

Macros
I2C_library_event_check_flag
AT32F413_middlewares_i2c_application_library

Macros

#define | I2C_EVENT_CHECK_NONE ((uint32_t)0x00000000)
#define | I2C_EVENT_CHECK_ACKFAIL ((uint32_t)0x00000001)
#define | I2C_EVENT_CHECK_STOP ((uint32_t)0x00000002)

Detailed Description

Macro Definition Documentation

◆ I2C_EVENT_CHECK_ACKFAIL

#define I2C_EVENT_CHECK_ACKFAIL ((uint32_t)0x00000001)

check flag ackfail

Definition at line 47 of file i2c_application.h.

Referenced by eeprom_ready_check(), i2c_master_read_addr(), i2c_master_transmit(), i2c_master_write_addr(), i2c_memory_address_send(), i2c_memory_read(), i2c_memory_read_dma(), i2c_memory_read_int(), i2c_memory_write(), i2c_memory_write_dma(), i2c_memory_write_int(), i2c_slave_receive(), i2c_slave_transmit(), and i2c_wait_flag().

◆ I2C_EVENT_CHECK_NONE

#define I2C_EVENT_CHECK_NONE ((uint32_t)0x00000000)

check flag none

Definition at line 46 of file i2c_application.h.

Referenced by eeprom_ready_check(), i2c_master_read_addr(), i2c_master_receive(), i2c_master_receive_dma(), i2c_master_receive_int(), i2c_master_transmit(), i2c_master_transmit_dma(), i2c_master_transmit_int(), i2c_master_write_addr(), i2c_memory_read(), i2c_memory_read_dma(), i2c_memory_read_int(), i2c_memory_write(), i2c_memory_write_dma(), i2c_memory_write_int(), i2c_slave_receive(), i2c_slave_receive_dma(), i2c_slave_receive_int(), i2c_slave_transmit(), i2c_slave_transmit_dma(), i2c_slave_transmit_int(), and i2c_slave_tx_isr_int().

◆ I2C_EVENT_CHECK_STOP

#define I2C_EVENT_CHECK_STOP ((uint32_t)0x00000002)

check flag stop

Definition at line 48 of file i2c_application.h.

Referenced by i2c_slave_receive(), and i2c_wait_flag().


AT32F413 Firmwary Library: I2C_library_memory_address_width_mode

Enumerations
I2C_library_memory_address_width_mode
AT32F413_middlewares_i2c_application_library

Enumerations

enum i2c_mem_address_width_type { I2C_MEM_ADDR_WIDIH_8 = 0x01 , I2C_MEM_ADDR_WIDIH_16 = 0x02 }

Detailed Description

Enumeration Type Documentation

◆ i2c_mem_address_width_type

enum i2c_mem_address_width_type
Enumerator
I2C_MEM_ADDR_WIDIH_8 | memory address is 8 bit
I2C_MEM_ADDR_WIDIH_16 | memory address is 16 bit

Definition at line 58 of file i2c_application.h.


AT32F413 Firmwary Library: I2C_library_transmission_mode

Enumerations
I2C_library_transmission_mode
AT32F413_middlewares_i2c_application_library

Enumerations

enum i2c_mode_type {
I2C_INT_MA_TX = 0 , I2C_INT_MA_RX , I2C_INT_SLA_TX , I2C_INT_SLA_RX ,
I2C_DMA_MA_TX , I2C_DMA_MA_RX , I2C_DMA_SLA_TX , I2C_DMA_SLA_RX
}

Detailed Description

Enumeration Type Documentation

◆ i2c_mode_type

enum i2c_mode_type
Enumerator
I2C_INT_MA_TX
I2C_INT_MA_RX
I2C_INT_SLA_TX
I2C_INT_SLA_RX
I2C_DMA_MA_TX
I2C_DMA_MA_RX
I2C_DMA_SLA_TX
I2C_DMA_SLA_RX

Definition at line 72 of file i2c_application.h.


AT32F413 Firmwary Library: I2C_library_status_code

Enumerations
I2C_library_status_code
AT32F413_middlewares_i2c_application_library

Enumerations

enum i2c_status_type {
I2C_OK = 0 , I2C_ERR_STEP_1 , I2C_ERR_STEP_2 , I2C_ERR_STEP_3 ,
I2C_ERR_STEP_4 , I2C_ERR_STEP_5 , I2C_ERR_STEP_6 , I2C_ERR_STEP_7 ,
I2C_ERR_STEP_8 , I2C_ERR_STEP_9 , I2C_ERR_STEP_10 , I2C_ERR_STEP_11 ,
I2C_ERR_STEP_12 , I2C_ERR_START , I2C_ERR_ADDR10 , I2C_ERR_ADDR ,
I2C_ERR_STOP , I2C_ERR_ACKFAIL , I2C_ERR_TIMEOUT , I2C_ERR_INTERRUPT
}

Detailed Description

Enumeration Type Documentation

◆ i2c_status_type

enum i2c_status_type
Enumerator
I2C_OK | no error
I2C_ERR_STEP_1 | step 1 error
I2C_ERR_STEP_2 | step 2 error
I2C_ERR_STEP_3 | step 3 error
I2C_ERR_STEP_4 | step 4 error
I2C_ERR_STEP_5 | step 5 error
I2C_ERR_STEP_6 | step 6 error
I2C_ERR_STEP_7 | step 7 error
I2C_ERR_STEP_8 | step 8 error
I2C_ERR_STEP_9 | step 9 error
I2C_ERR_STEP_10 | step 10 error
I2C_ERR_STEP_11 | step 11 error
I2C_ERR_STEP_12 | step 12 error
I2C_ERR_START | start error
I2C_ERR_ADDR10 | addr10 error
I2C_ERR_ADDR | addr error
I2C_ERR_STOP | stop error
I2C_ERR_ACKFAIL | ackfail error
I2C_ERR_TIMEOUT | timeout error
I2C_ERR_INTERRUPT | interrupt error

Definition at line 93 of file i2c_application.h.


AT32F413 Firmwary Library: I2C_library_handler

Data Structures
I2C_library_handler
AT32F413_middlewares_i2c_application_library

Data Structures

struct i2c_handle_type

Detailed Description

Generated by doxygen 1.12.0


AT32F413 Firmwary Library: i2c_handle_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
i2c_handle_type Struct Reference
AT32F413_middlewares_i2c_application_library » I2C_library_handler

#include <i2c_application.h>

Data Fields

i2c_type * i2cx
uint8_t * | pbuff
__IO uint16_t | pcount
__IO uint32_t | mode
__IO uint32_t | timeout
__IO uint32_t | status
__IO i2c_status_type | error_code
dma_channel_type * dma_tx_channel
dma_channel_type * dma_rx_channel
dma_init_type dma_init_struct

Detailed Description

Definition at line 126 of file i2c_application.h.

Field Documentation

◆ dma_init_struct

dma_init_type i2c_handle_type::dma_init_struct

dma init parameters

Definition at line 137 of file i2c_application.h.

Referenced by i2c_dma_config(), and i2c_lowlevel_init().

◆ dma_rx_channel

dma_channel_type* i2c_handle_type::dma_rx_channel

dma receive channel

Definition at line 136 of file i2c_application.h.

Referenced by i2c_dma_rx_irq_handler(), i2c_lowlevel_init(), i2c_master_receive_dma(), i2c_memory_read_dma(), and i2c_slave_receive_dma().

◆ dma_tx_channel

dma_channel_type* i2c_handle_type::dma_tx_channel

dma transmit channel

Definition at line 135 of file i2c_application.h.

Referenced by i2c_dma_config(), i2c_dma_tx_irq_handler(), i2c_lowlevel_init(), i2c_master_transmit_dma(), i2c_memory_write_dma(), and i2c_slave_transmit_dma().

◆ error_code

__IO i2c_status_type i2c_handle_type::error_code

i2c error code

Definition at line 134 of file i2c_application.h.

Referenced by i2c_err_irq_handler(), i2c_master_read_addr(), i2c_master_receive(), i2c_master_receive_dma(), i2c_master_receive_int(), i2c_master_transmit(), i2c_master_transmit_dma(), i2c_master_transmit_int(), i2c_master_write_addr(), i2c_memory_read(), i2c_memory_read_dma(), i2c_memory_read_int(), i2c_memory_write(), i2c_memory_write_dma(), i2c_memory_write_int(), i2c_slave_receive(), i2c_slave_receive_dma(), i2c_slave_receive_int(), i2c_slave_transmit(), i2c_slave_transmit_dma(), i2c_slave_transmit_int(), i2c_wait_end(), and i2c_wait_flag().

◆ i2cx

i2c_type* i2c_handle_type::i2cx

i2c registers base address

Definition at line 128 of file i2c_application.h.

Referenced by audio_codec_init(), eeprom_ready_check(), i2c_config(), i2c_dma_config(), i2c_dma_rx_irq_handler(), i2c_dma_tx_irq_handler(), i2c_err_irq_handler(), i2c_lowlevel_init(), i2c_master_read_addr(), i2c_master_receive(), i2c_master_receive_dma(), i2c_master_receive_int(), i2c_master_rx_isr_int(), i2c_master_transmit(), i2c_master_transmit_dma(), i2c_master_transmit_int(), i2c_master_tx_isr_dma(), i2c_master_tx_isr_int(), i2c_master_write_addr(), i2c_memory_address_send(), i2c_memory_read(), i2c_memory_read_dma(), i2c_memory_read_int(), i2c_memory_write(), i2c_memory_write_dma(), i2c_memory_write_int(), i2c_slave_receive(), i2c_slave_receive_dma(), i2c_slave_receive_int(), i2c_slave_rx_isr_int(), i2c_slave_transmit(), i2c_slave_transmit_dma(), i2c_slave_transmit_int(), i2c_slave_tx_isr_int(), i2c_slave_tx_rx_isr_dma(), i2c_wait_flag(), and main().

◆ mode

__IO uint32_t i2c_handle_type::mode

i2c communication mode

Definition at line 131 of file i2c_application.h.

Referenced by i2c_dma_rx_irq_handler(), i2c_dma_tx_irq_handler(), i2c_err_irq_handler(), i2c_evt_irq_handler(), i2c_master_receive_dma(), i2c_master_receive_int(), i2c_master_transmit_dma(), i2c_master_transmit_int(), i2c_memory_read_dma(), i2c_memory_read_int(), i2c_memory_write_dma(), i2c_memory_write_int(), i2c_slave_receive_dma(), i2c_slave_receive_int(), i2c_slave_transmit_dma(), and i2c_slave_transmit_int().

◆ pbuff

uint8_t* i2c_handle_type::pbuff

pointer to i2c transfer buffer

Definition at line 129 of file i2c_application.h.

Referenced by i2c_master_receive(), i2c_master_receive_dma(), i2c_master_receive_int(), i2c_master_rx_isr_int(), i2c_master_transmit(), i2c_master_transmit_dma(), i2c_master_transmit_int(), i2c_master_tx_isr_int(), i2c_memory_read(), i2c_memory_read_dma(), i2c_memory_read_int(), i2c_memory_write(), i2c_memory_write_dma(), i2c_memory_write_int(), i2c_slave_receive(), i2c_slave_receive_dma(), i2c_slave_receive_int(), i2c_slave_rx_isr_int(), i2c_slave_transmit(), i2c_slave_transmit_dma(), i2c_slave_transmit_int(), and i2c_slave_tx_isr_int().

◆ pcount

__IO uint16_t i2c_handle_type::pcount

i2c transfer counter

Definition at line 130 of file i2c_application.h.

Referenced by i2c_dma_rx_irq_handler(), i2c_dma_tx_irq_handler(), i2c_master_receive(), i2c_master_receive_dma(), i2c_master_receive_int(), i2c_master_rx_isr_int(), i2c_master_transmit(), i2c_master_transmit_dma(), i2c_master_transmit_int(), i2c_master_tx_isr_int(), i2c_memory_read(), i2c_memory_read_dma(), i2c_memory_read_int(), i2c_memory_write(), i2c_memory_write_dma(), i2c_memory_write_int(), i2c_slave_receive(), i2c_slave_receive_dma(), i2c_slave_receive_int(), i2c_slave_rx_isr_int(), i2c_slave_transmit(), i2c_slave_transmit_dma(), i2c_slave_transmit_int(), and i2c_slave_tx_isr_int().

◆ status

__IO uint32_t i2c_handle_type::status

i2c communication status

Definition at line 133 of file i2c_application.h.

Referenced by i2c_dma_rx_irq_handler(), i2c_err_irq_handler(), i2c_master_receive_dma(), i2c_master_receive_int(), i2c_master_rx_isr_int(), i2c_master_transmit_dma(), i2c_master_transmit_int(), i2c_master_tx_isr_dma(), i2c_master_tx_isr_int(), i2c_memory_read_dma(), i2c_memory_read_int(), i2c_memory_write_dma(), i2c_memory_write_int(), i2c_slave_receive_dma(), i2c_slave_receive_int(), i2c_slave_rx_isr_int(), i2c_slave_transmit_dma(), i2c_slave_transmit_int(), i2c_slave_tx_isr_int(), i2c_slave_tx_rx_isr_dma(), and i2c_wait_end().

◆ timeout

__IO uint32_t i2c_handle_type::timeout

i2c wait time

Definition at line 132 of file i2c_application.h.

Referenced by i2c_master_receive_dma(), i2c_master_receive_int(), i2c_master_transmit_dma(), i2c_master_transmit_int(), i2c_memory_read_dma(), i2c_memory_read_int(), i2c_memory_write_dma(), i2c_memory_write_int(), i2c_slave_receive_dma(), i2c_slave_receive_int(), i2c_slave_transmit_dma(), i2c_slave_transmit_int(), and i2c_slave_tx_isr_int().

The documentation for this struct was generated from the following file:
  • i2c_application.h


AT32F413 Firmwary Library: I2C_library_exported_functions

Functions
I2C_library_exported_functions
AT32F413_middlewares_i2c_application_library

Functions

void | i2c_config (i2c_handle_type *hi2c)
i2c peripheral initialization.
void | i2c_lowlevel_init (i2c_handle_type *hi2c)
initializes peripherals used by the i2c.
i2c_status_type | i2c_wait_end (i2c_handle_type *hi2c, uint32_t timeout)
wait for the transfer to end.
i2c_status_type | i2c_wait_flag (i2c_handle_type *hi2c, uint32_t flag, uint32_t event_check, uint32_t timeout)
wait for the flag to be set or reset, only BUSYF flag is waiting to be reset, and other flags are waiting to be set
i2c_status_type | i2c_master_transmit (i2c_handle_type *hi2c, uint16_t address, uint8_t *pdata, uint16_t size, uint32_t timeout)
the master transmits data through polling mode.
i2c_status_type | i2c_master_receive (i2c_handle_type *hi2c, uint16_t address, uint8_t *pdata, uint16_t size, uint32_t timeout)
the master receive data through polling mode.
i2c_status_type | i2c_slave_transmit (i2c_handle_type *hi2c, uint8_t *pdata, uint16_t size, uint32_t timeout)
the slave transmits data through polling mode.
i2c_status_type | i2c_slave_receive (i2c_handle_type *hi2c, uint8_t *pdata, uint16_t size, uint32_t timeout)
the slave receive data through polling mode.
i2c_status_type | i2c_master_transmit_int (i2c_handle_type *hi2c, uint16_t address, uint8_t *pdata, uint16_t size, uint32_t timeout)
the master transmits data through interrupt mode.
i2c_status_type | i2c_master_receive_int (i2c_handle_type *hi2c, uint16_t address, uint8_t *pdata, uint16_t size, uint32_t timeout)
the master receive data through interrupt mode.
i2c_status_type | i2c_slave_transmit_int (i2c_handle_type *hi2c, uint8_t *pdata, uint16_t size, uint32_t timeout)
the slave transmits data through interrupt mode.
i2c_status_type | i2c_slave_receive_int (i2c_handle_type *hi2c, uint8_t *pdata, uint16_t size, uint32_t timeout)
the slave receive data through interrupt mode.
i2c_status_type | i2c_master_transmit_dma (i2c_handle_type *hi2c, uint16_t address, uint8_t *pdata, uint16_t size, uint32_t timeout)
the master transmits data through dma mode.
i2c_status_type | i2c_master_receive_dma (i2c_handle_type *hi2c, uint16_t address, uint8_t *pdata, uint16_t size, uint32_t timeout)
the master receive data through dma mode.
i2c_status_type | i2c_slave_transmit_dma (i2c_handle_type *hi2c, uint8_t *pdata, uint16_t size, uint32_t timeout)
the slave transmits data through dma mode.
i2c_status_type | i2c_slave_receive_dma (i2c_handle_type *hi2c, uint8_t *pdata, uint16_t size, uint32_t timeout)
the slave receive data through dma mode.
i2c_status_type | i2c_memory_write (i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
write data to the memory device through polling mode.
i2c_status_type | i2c_memory_write_int (i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
write data to the memory device through interrupt mode.
i2c_status_type | i2c_memory_write_dma (i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
write data to the memory device through dma mode.
i2c_status_type | i2c_memory_read (i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
read data from memory device through polling mode.
i2c_status_type | i2c_memory_read_int (i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
read data from memory device through interrupt mode.
i2c_status_type | i2c_memory_read_dma (i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
read data from memory device through polling mode.
void | i2c_evt_irq_handler (i2c_handle_type *hi2c)
interrupt procession function.
void | i2c_err_irq_handler (i2c_handle_type *hi2c)
i2c error interrupt function.
void | i2c_dma_tx_irq_handler (i2c_handle_type *hi2c)
dma transmission complete interrupt function.
void | i2c_dma_rx_irq_handler (i2c_handle_type *hi2c)
dma reveive complete interrupt function.

Detailed Description

Function Documentation

◆ i2c_config()

void i2c_config ( i2c_handle_type * hi2c )

i2c peripheral initialization.

Parameters
hi2c the handle points to the operation information.
Return values
none.

Definition at line 111 of file i2c_application.c.

Referenced by audio_codec_init(), and main().

◆ i2c_dma_rx_irq_handler()

void i2c_dma_rx_irq_handler ( i2c_handle_type * hi2c )

dma reveive complete interrupt function.

Parameters
hi2c the handle points to the operation information.
Return values
none.

< dma1 channel1 full data transfer flag

< dma1 channel2 full data transfer flag

< dma1 channel3 full data transfer flag

< dma1 channel4 full data transfer flag

< dma1 channel5 full data transfer flag

< dma1 channel6 full data transfer flag

< dma1 channel7 full data transfer flag

< dma2 channel1 full data transfer flag

< dma2 channel2 full data transfer flag

< dma2 channel3 full data transfer flag

< dma2 channel4 full data transfer flag

< dma2 channel5 full data transfer flag

< dma2 channel6 full data transfer flag

< dma2 channel7 full data transfer flag

< dma full data transfer interrupt

< dma1 channel1 full data transfer flag

< dma1 channel2 full data transfer flag

< dma1 channel3 full data transfer flag

< dma1 channel4 full data transfer flag

< dma1 channel5 full data transfer flag

< dma1 channel6 full data transfer flag

< dma1 channel7 full data transfer flag

< dma2 channel1 full data transfer flag

< dma2 channel2 full data transfer flag

< dma2 channel3 full data transfer flag

< dma2 channel4 full data transfer flag

< dma2 channel5 full data transfer flag

< dma2 channel6 full data transfer flag

< dma2 channel7 full data transfer flag

< i2c acknowledge failure flag

< i2c event interrupt

Definition at line 2293 of file i2c_application.c.

Referenced by DMA1_Channel5_IRQHandler(), and DMA1_Channel7_IRQHandler().

◆ i2c_dma_tx_irq_handler()

void i2c_dma_tx_irq_handler ( i2c_handle_type * hi2c )

dma transmission complete interrupt function.

Parameters
hi2c the handle points to the operation information.
Return values
none.

< dma1 channel1 full data transfer flag

< dma1 channel2 full data transfer flag

< dma1 channel3 full data transfer flag

< dma1 channel4 full data transfer flag

< dma1 channel5 full data transfer flag

< dma1 channel6 full data transfer flag

< dma1 channel7 full data transfer flag

< dma2 channel1 full data transfer flag

< dma2 channel2 full data transfer flag

< dma2 channel3 full data transfer flag

< dma2 channel4 full data transfer flag

< dma2 channel5 full data transfer flag

< dma2 channel6 full data transfer flag

< dma2 channel7 full data transfer flag

< dma full data transfer interrupt

< dma1 channel1 full data transfer flag

< dma1 channel2 full data transfer flag

< dma1 channel3 full data transfer flag

< dma1 channel4 full data transfer flag

< dma1 channel5 full data transfer flag

< dma1 channel6 full data transfer flag

< dma1 channel7 full data transfer flag

< dma2 channel1 full data transfer flag

< dma2 channel2 full data transfer flag

< dma2 channel3 full data transfer flag

< dma2 channel4 full data transfer flag

< dma2 channel5 full data transfer flag

< dma2 channel6 full data transfer flag

< dma2 channel7 full data transfer flag

< i2c event interrupt

< i2c error interrupt

Definition at line 2256 of file i2c_application.c.

Referenced by DMA1_Channel4_IRQHandler(), and DMA1_Channel6_IRQHandler().

◆ i2c_err_irq_handler()

void i2c_err_irq_handler ( i2c_handle_type * hi2c )

i2c error interrupt function.

Parameters
hi2c the handle points to the operation information.
Return values
none.

< i2c bus error flag

< i2c bus error flag

< i2c arbitration lost flag

< i2c arbitration lost flag

< i2c acknowledge failure flag

< i2c acknowledge failure flag

< i2c event interrupt

< i2c overflow or underflow flag

< i2c overflow or underflow flag

< i2c pec receive error flag

< i2c pec receive error flag

< i2c smbus timeout flag

< i2c smbus timeout flag

< i2c smbus alert flag

< i2c smbus alert flag

< i2c error interrupt

Definition at line 2339 of file i2c_application.c.

Referenced by I2C1_ERR_IRQHandler(), and I2C2_ERR_IRQHandler().

◆ i2c_evt_irq_handler()

void i2c_evt_irq_handler ( i2c_handle_type * hi2c )

interrupt procession function.

Parameters
hi2c the handle points to the operation information.
Return values
none.

Definition at line 2223 of file i2c_application.c.

Referenced by I2C1_EVT_IRQHandler(), and I2C2_EVT_IRQHandler().

◆ i2c_lowlevel_init()

void i2c_lowlevel_init ( i2c_handle_type * hi2c )

initializes peripherals used by the i2c.

Parameters
none
Return values
none

< gpio pins number 6

< gpio pins number 7

< gpio pins number 6

< gpio pins number 7

< gpio pins number 6

< gpio pins number 7

< gpio pins number 10

< gpio pins number 11

< gpio pins number 10

< gpio pins number 11

Definition at line 116 of file project/at_start_f413/examples/i2c/communication_dma/src/main.c.

Referenced by i2c_config().

◆ i2c_master_receive()

i2c_status_type i2c_master_receive | ( | i2c_handle_type * | hi2c,
 |  | uint16_t | address,
 |  | uint8_t * | pdata,
 |  | uint16_t | size,
 |  | uint32_t | timeout )

the master receive data through polling mode.

Parameters
hi2c | the handle points to the operation information.
address | slave address.
pdata | data buffer.
size | data size.
timeout | maximum waiting time.
Return values
i2c status.

< i2c bus busy flag transmission mode

< check flag none

< i2c 0~7 bit address match flag

< i2c 0~7 bit address match flag

< i2c 0~7 bit address match flag

< i2c receive data buffer full flag

< check flag none

< i2c transmit data complete flag

< check flag none

< i2c transmit data complete flag

< check flag none

< i2c transmit data complete flag

< check flag none

< i2c receive data buffer full flag

< check flag none

Definition at line 564 of file i2c_application.c.

Referenced by main().

◆ i2c_master_receive_dma()

i2c_status_type i2c_master_receive_dma | ( | i2c_handle_type * | hi2c,
 |  | uint16_t | address,
 |  | uint8_t * | pdata,
 |  | uint16_t | size,
 |  | uint32_t | timeout )

the master receive data through dma mode.

Parameters
hi2c | the handle points to the operation information.
address | slave address.
pdata | data buffer.
size | data size.
timeout | maximum waiting time.
Return values
i2c status.

< i2c bus busy flag transmission mode

< check flag none

< i2c 0~7 bit address match flag

< i2c 0~7 bit address match flag

Definition at line 1126 of file i2c_application.c.

Referenced by main().

◆ i2c_master_receive_int()

i2c_status_type i2c_master_receive_int | ( | i2c_handle_type * | hi2c,
 |  | uint16_t | address,
 |  | uint8_t * | pdata,
 |  | uint16_t | size,
 |  | uint32_t | timeout )

the master receive data through interrupt mode.

Parameters
hi2c | the handle points to the operation information.
address | slave address.
pdata | data buffer.
size | data size.
timeout | maximum waiting time.
Return values
i2c status.

< i2c bus busy flag transmission mode

< check flag none

< i2c 0~7 bit address match flag

< i2c 0~7 bit address match flag

< i2c 0~7 bit address match flag

< i2c event interrupt

< i2c data transmission interrupt

< i2c error interrupt

Definition at line 908 of file i2c_application.c.

Referenced by main().

◆ i2c_master_transmit()

i2c_status_type i2c_master_transmit | ( | i2c_handle_type * | hi2c,
 |  | uint16_t | address,
 |  | uint8_t * | pdata,
 |  | uint16_t | size,
 |  | uint32_t | timeout )

the master transmits data through polling mode.

Parameters
hi2c | the handle points to the operation information.
address | slave address.
pdata | data buffer.
size | data size.
timeout | maximum waiting time.
Return values
i2c status.

< i2c bus busy flag transmission mode

< check flag none

< i2c 0~7 bit address match flag

< i2c transmit data buffer empty flag

< check flag ackfail

< i2c transmit data complete flag

< check flag ackfail

Definition at line 421 of file i2c_application.c.

Referenced by audio_codec_init(), audio_codec_loop(), audio_codec_modify_freq(), and main().

◆ i2c_master_transmit_dma()

i2c_status_type i2c_master_transmit_dma | ( | i2c_handle_type * | hi2c,
 |  | uint16_t | address,
 |  | uint8_t * | pdata,
 |  | uint16_t | size,
 |  | uint32_t | timeout )

the master transmits data through dma mode.

Parameters
hi2c | the handle points to the operation information.
address | slave address.
pdata | data buffer.
size | data size.
timeout | maximum waiting time.
Return values
i2c status.

< i2c bus busy flag transmission mode

< check flag none

< i2c 0~7 bit address match flag

Definition at line 1025 of file i2c_application.c.

Referenced by main().

◆ i2c_master_transmit_int()

i2c_status_type i2c_master_transmit_int | ( | i2c_handle_type * | hi2c,
 |  | uint16_t | address,
 |  | uint8_t * | pdata,
 |  | uint16_t | size,
 |  | uint32_t | timeout )

the master transmits data through interrupt mode.

Parameters
hi2c | the handle points to the operation information.
address | slave address.
pdata | data buffer.
size | data size.
timeout | maximum waiting time.
Return values
i2c status.

< i2c bus busy flag transmission mode

< check flag none

< i2c 0~7 bit address match flag

< i2c event interrupt

< i2c data transmission interrupt

< i2c error interrupt

Definition at line 822 of file i2c_application.c.

Referenced by main().

◆ i2c_memory_read()

i2c_status_type i2c_memory_read | ( | i2c_handle_type * | hi2c,
 |  | i2c_mem_address_width_type | mem_address_width,
 |  | uint16_t | address,
 |  | uint16_t | mem_address,
 |  | uint8_t * | pdata,
 |  | uint16_t | size,
 |  | uint32_t | timeout )

read data from memory device through polling mode.

Parameters
hi2c | the handle points to the operation information.
mem_address_width memory address width. this parameter can be one of the following values:
  • I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit
  • I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit
address | memory device address.
mem_address | memory address.
pdata | data buffer.
size | data size.
timeout | maximum waiting time.
Return values
i2c status.

< i2c bus busy flag transmission mode

< check flag none

< i2c 0~7 bit address match flag

< i2c transmit data buffer empty flag

< check flag ackfail

< i2c transmit data buffer empty flag

< check flag ackfail

< i2c 0~7 bit address match flag

< i2c 0~7 bit address match flag

< i2c 0~7 bit address match flag

< i2c receive data buffer full flag

< check flag none

< i2c transmit data complete flag

< check flag none

< i2c transmit data complete flag

< check flag none

< i2c transmit data complete flag

< check flag none

< i2c receive data buffer full flag

< check flag none

Definition at line 1388 of file i2c_application.c.

Referenced by eeprom_read_buffer(), and main().

◆ i2c_memory_read_dma()

i2c_status_type i2c_memory_read_dma | ( | i2c_handle_type * | hi2c,
 |  | i2c_mem_address_width_type | mem_address_width,
 |  | uint16_t | address,
 |  | uint16_t | mem_address,
 |  | uint8_t * | pdata,
 |  | uint16_t | size,
 |  | uint32_t | timeout )

read data from memory device through polling mode.

Parameters
hi2c | the handle points to the operation information.
mem_address_width memory address width. this parameter can be one of the following values:
  • I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit
  • I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit
address | memory device address.
mem_address | memory address.
pdata | data buffer.
size | data size.
timeout | maximum waiting time.
Return values
i2c status.

< i2c bus busy flag transmission mode

< check flag none

< i2c 0~7 bit address match flag

< i2c transmit data buffer empty flag

< check flag ackfail

< i2c transmit data buffer empty flag

< check flag ackfail

< i2c 0~7 bit address match flag

< i2c 0~7 bit address match flag

Definition at line 1878 of file i2c_application.c.

Referenced by eeprom_read_buffer(), and main().

◆ i2c_memory_read_int()

i2c_status_type i2c_memory_read_int | ( | i2c_handle_type * | hi2c,
 |  | i2c_mem_address_width_type | mem_address_width,
 |  | uint16_t | address,
 |  | uint16_t | mem_address,
 |  | uint8_t * | pdata,
 |  | uint16_t | size,
 |  | uint32_t | timeout )

read data from memory device through interrupt mode.

Parameters
hi2c | the handle points to the operation information.
mem_address_width memory address width. this parameter can be one of the following values:
  • I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit
  • I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit
address | memory device address.
mem_address | memory address.
pdata | data buffer.
size | data size.
timeout | maximum waiting time.
Return values
i2c status.

< i2c bus busy flag transmission mode

< check flag none

< i2c 0~7 bit address match flag

< i2c transmit data buffer empty flag

< check flag ackfail

< i2c transmit data buffer empty flag

< check flag ackfail

< i2c 0~7 bit address match flag

< i2c 0~7 bit address match flag

< i2c 0~7 bit address match flag

< i2c event interrupt

< i2c data transmission interrupt

< i2c error interrupt

Definition at line 1678 of file i2c_application.c.

Referenced by eeprom_read_buffer(), and main().

◆ i2c_memory_write()

i2c_status_type i2c_memory_write | ( | i2c_handle_type * | hi2c,
 |  | i2c_mem_address_width_type | mem_address_width,
 |  | uint16_t | address,
 |  | uint16_t | mem_address,
 |  | uint8_t * | pdata,
 |  | uint16_t | size,
 |  | uint32_t | timeout )

write data to the memory device through polling mode.

Parameters
hi2c | the handle points to the operation information.
mem_address_width memory address width. this parameter can be one of the following values:
  • I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit
  • I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit
address | memory device address.
mem_address | memory address.
pdata | data buffer.
size | data size.
timeout | maximum waiting time.
Return values
i2c status.

< i2c bus busy flag transmission mode

< check flag none

< i2c 0~7 bit address match flag

< i2c transmit data buffer empty flag

< check flag ackfail

< i2c transmit data buffer empty flag

< check flag ackfail

< i2c transmit data complete flag

< check flag ackfail

Definition at line 1299 of file i2c_application.c.

Referenced by eeprom_write_page(), and main().

◆ i2c_memory_write_dma()

i2c_status_type i2c_memory_write_dma | ( | i2c_handle_type * | hi2c,
 |  | i2c_mem_address_width_type | mem_address_width,
 |  | uint16_t | address,
 |  | uint16_t | mem_address,
 |  | uint8_t * | pdata,
 |  | uint16_t | size,
 |  | uint32_t | timeout )

write data to the memory device through dma mode.

Parameters
hi2c | the handle points to the operation information.
mem_address_width memory address width. this parameter can be one of the following values:
  • I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit
  • I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit
address | memory device address.
mem_address | memory address.
pdata | data buffer.
size | data size.
timeout | maximum waiting time.
Return values
i2c status.

< i2c bus busy flag transmission mode

< check flag none

< i2c 0~7 bit address match flag

< i2c transmit data buffer empty flag

< check flag ackfail

< i2c transmit data buffer empty flag

< check flag ackfail

Definition at line 1795 of file i2c_application.c.

Referenced by eeprom_write_page(), and main().

◆ i2c_memory_write_int()

i2c_status_type i2c_memory_write_int | ( | i2c_handle_type * | hi2c,
 |  | i2c_mem_address_width_type | mem_address_width,
 |  | uint16_t | address,
 |  | uint16_t | mem_address,
 |  | uint8_t * | pdata,
 |  | uint16_t | size,
 |  | uint32_t | timeout )

write data to the memory device through interrupt mode.

Parameters
hi2c | the handle points to the operation information.
mem_address_width memory address width. this parameter can be one of the following values:
  • I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit
  • I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit
address | memory device address.
mem_address | memory address.
pdata | data buffer.
size | data size.
timeout | maximum waiting time.
Return values
i2c status.

< i2c bus busy flag transmission mode

< check flag none

< i2c 0~7 bit address match flag

< i2c transmit data buffer empty flag

< check flag ackfail

< i2c transmit data buffer empty flag

< check flag ackfail

< i2c event interrupt

< i2c data transmission interrupt

< i2c error interrupt

Definition at line 1601 of file i2c_application.c.

Referenced by eeprom_write_page(), and main().

◆ i2c_slave_receive()

i2c_status_type i2c_slave_receive | ( | i2c_handle_type * | hi2c,
 |  | uint8_t * | pdata,
 |  | uint16_t | size,
 |  | uint32_t | timeout )

the slave receive data through polling mode.

Parameters
hi2c | the handle points to the operation information.
pdata | data buffer.
size | data size.
timeout | maximum waiting time.
Return values
i2c status.

< i2c bus busy flag transmission mode

< check flag none

< i2c 0~7 bit address match flag

< check flag none

< i2c 0~7 bit address match flag

< i2c receive data buffer full flag

< check flag stop

< i2c stop condition generation complete flag

< check flag ackfail

< i2c stop condition generation complete flag

Definition at line 489 of file i2c_application.c.

Referenced by main().

◆ i2c_slave_receive_dma()

i2c_status_type i2c_slave_receive_dma | ( | i2c_handle_type * | hi2c,
 |  | uint8_t * | pdata,
 |  | uint16_t | size,
 |  | uint32_t | timeout )

the slave receive data through dma mode.

Parameters
hi2c | the handle points to the operation information.
pdata | data buffer.
size | data size.
timeout | maximum waiting time.
Return values
i2c status.

< i2c bus busy flag transmission mode

< check flag none

< i2c event interrupt

Definition at line 1078 of file i2c_application.c.

Referenced by main().

◆ i2c_slave_receive_int()

i2c_status_type i2c_slave_receive_int | ( | i2c_handle_type * | hi2c,
 |  | uint8_t * | pdata,
 |  | uint16_t | size,
 |  | uint32_t | timeout )

the slave receive data through interrupt mode.

Parameters
hi2c | the handle points to the operation information.
pdata | data buffer.
size | data size.
timeout | maximum waiting time.
Return values
i2c status.

< i2c bus busy flag transmission mode

< check flag none

< i2c event interrupt

< i2c data transmission interrupt

< i2c error interrupt

Definition at line 869 of file i2c_application.c.

Referenced by main().

◆ i2c_slave_transmit()

i2c_status_type i2c_slave_transmit | ( | i2c_handle_type * | hi2c,
 |  | uint8_t * | pdata,
 |  | uint16_t | size,
 |  | uint32_t | timeout )

the slave transmits data through polling mode.

Parameters
hi2c | the handle points to the operation information.
pdata | data buffer.
size | data size.
timeout | maximum waiting time.
Return values
i2c status.

< i2c bus busy flag transmission mode

< check flag none

< i2c 0~7 bit address match flag

< check flag none

< i2c 0~7 bit address match flag

< i2c 0~7 bit address match flag

< check flag none

< i2c 0~7 bit address match flag

< i2c transmit data buffer empty flag

< check flag ackfail

< i2c acknowledge failure flag

< check flag none

< i2c acknowledge failure flag

Definition at line 735 of file i2c_application.c.

Referenced by main().

◆ i2c_slave_transmit_dma()

i2c_status_type i2c_slave_transmit_dma | ( | i2c_handle_type * | hi2c,
 |  | uint8_t * | pdata,
 |  | uint16_t | size,
 |  | uint32_t | timeout )

the slave transmits data through dma mode.

Parameters
hi2c | the handle points to the operation information.
pdata | data buffer.
size | data size.
timeout | maximum waiting time.
Return values
i2c status.

< i2c bus busy flag transmission mode

< check flag none

< i2c event interrupt

Definition at line 1202 of file i2c_application.c.

Referenced by main().

◆ i2c_slave_transmit_int()

i2c_status_type i2c_slave_transmit_int | ( | i2c_handle_type * | hi2c,
 |  | uint8_t * | pdata,
 |  | uint16_t | size,
 |  | uint32_t | timeout )

the slave transmits data through interrupt mode.

Parameters
hi2c | the handle points to the operation information.
pdata | data buffer.
size | data size.
timeout | maximum waiting time.
Return values
i2c status.

< i2c bus busy flag transmission mode

< check flag none

< i2c event interrupt

< i2c data transmission interrupt

< i2c error interrupt

Definition at line 986 of file i2c_application.c.

Referenced by main().

◆ i2c_wait_end()

i2c_status_type i2c_wait_end | ( | i2c_handle_type * | hi2c,
 |  | uint32_t | timeout )

wait for the transfer to end.

Parameters
hi2c | the handle points to the operation information.
timeout | maximum waiting time.
Return values
i2c status.

Definition at line 129 of file i2c_application.c.

Referenced by eeprom_read_buffer(), eeprom_write_page(), and main().

◆ i2c_wait_flag()

i2c_status_type i2c_wait_flag | ( | i2c_handle_type * | hi2c,
 |  | uint32_t | flag,
 |  | uint32_t | event_check,
 |  | uint32_t | timeout )

wait for the flag to be set or reset, only BUSYF flag is waiting to be reset, and other flags are waiting to be set

Parameters
hi2c | the handle points to the operation information.
flag specifies the flag to check. this parameter can be one of the following values:
  • I2C_STARTF_FLAG: start condition generation complete flag.
  • I2C_ADDR7F_FLAG: 0~7 bit address match flag.
  • I2C_TDC_FLAG: transmit data complete flag.
  • I2C_ADDRHF_FLAG: master 9~8 bit address header match flag.
  • I2C_STOPF_FLAG: stop condition generation complete flag.
  • I2C_RDBF_FLAG: receive data buffer full flag.
  • I2C_TDBE_FLAG: transmit data buffer empty flag.
  • I2C_BUSERR_FLAG: bus error flag.
  • I2C_ARLOST_FLAG: arbitration lost flag.
  • I2C_ACKFAIL_FLAG: acknowledge failure flag.
  • I2C_OUF_FLAG: overflow or underflow flag.
  • I2C_PECERR_FLAG: pec receive error flag.
  • I2C_TMOUT_FLAG: smbus timeout flag.
  • I2C_ALERTF_FLAG: smbus alert flag.
  • I2C_TRMODE_FLAG: transmission mode.
  • I2C_BUSYF_FLAG: bus busy flag transmission mode.
  • I2C_DIRF_FLAG: transmission direction flag.
  • I2C_GCADDRF_FLAG: general call address received flag.
  • I2C_DEVADDRF_FLAG: smbus device address received flag.
  • I2C_HOSTADDRF_FLAG: smbus host address received flag.
  • I2C_ADDR2_FLAG: own address 2 received flag.
event_check check other error flags while waiting for the flag. parameter as following values:
  • I2C_EVENT_CHECK_NONE
  • I2C_EVENT_CHECK_ACKFAIL
  • I2C_EVENT_CHECK_STOP
timeout | maximum waiting time.
Return values
i2c status.

< i2c bus busy flag transmission mode

< check flag ackfail

< i2c acknowledge failure flag

< i2c acknowledge failure flag

< check flag stop

< i2c stop condition generation complete flag

< i2c stop condition generation complete flag

Definition at line 185 of file i2c_application.c.

Referenced by eeprom_ready_check(), i2c_master_read_addr(), i2c_master_receive(), i2c_master_receive_dma(), i2c_master_receive_int(), i2c_master_transmit(), i2c_master_transmit_dma(), i2c_master_transmit_int(), i2c_master_write_addr(), i2c_memory_address_send(), i2c_memory_read(), i2c_memory_read_dma(), i2c_memory_read_int(), i2c_memory_write(), i2c_memory_write_dma(), i2c_memory_write_int(), i2c_slave_receive(), i2c_slave_receive_dma(), i2c_slave_receive_int(), i2c_slave_transmit(), i2c_slave_transmit_dma(), i2c_slave_transmit_int(), and i2c_slave_tx_isr_int().


AT32F413 Firmwary Library: AT32F413_middlewares_usbd_class

Topics | Variables
AT32F413_middlewares_usbd_class

Topics

USB_audio_class
usb device class audio demo
USB_audio_desc
usb device audio descriptor
USB_audio_hid_class
usb device class audio hid demo
USB_audio_hid_desc
usb device audio hid descriptor
USB_cdc_class
usb device class cdc demo
USB_cdc_desc
usb device cdc descriptor
USB_cdc_keyboard_class
usb device class composite cdc and keyboard
USB_cdc_keyboard_desc
usb device cdc keyboard descriptor
USB_cdc_msc_class
usb device class cdc msc demo
USB_cdc_msc_desc
usb device cdc msc descriptor
USB_msc_bot_scsi
usb device class mass storage demo
USB_custom_hid_class
usb device custom hid demo
USB_custom_hid_desc
usb device custom_hid descriptor
USB_hid_iap_class
usb device class hid iap demo
USB_hid_iap_desc
usb device hid_iap descriptor
USB_keyboard_class
usb device keyboard demo
USB_keyboard_desc
usb device keyboard descriptor
USB_mouse_class
usb device mouse demo
USB_mouse_desc
usb device mouse descriptor
USB_msc_class
usb device class msc demo
USB_msc_desc
usb device msc descriptor
USB_printer_class
usb device class printer demo
USB_printer_desc
usb device printer descriptor
USB_winusb_class
usb device class win usb
USB_winusb_desc
usb device winusb descriptor

Variables

uint8_t | cbd_typical_type::opcode
uint8_t | cbd_typical_type::lun
uint32_t | cbd_typical_type::address
uint8_t | cbd_typical_type::reserved1
uint32_t | cbd_typical_type::alloc_length
uint16_t | cbd_typical_type::reserved2
uint8_t | cbd_extended_type::opcode
uint8_t | cbd_extended_type::lun
uint32_t | cbd_extended_type::address
uint8_t | cbd_extended_type::reserved1
uint32_t | cbd_extended_type::alloc_length
uint16_t | cbd_extended_type::reserved2
uint32_t | cbw_type::dCBWSignature
uint32_t | cbw_type::dCBWTage
uint32_t | cbw_type::dCBWDataTransferLength
uint8_t | cbw_type::bmCBWFlags
uint8_t | cbw_type::bCBWLUN
uint8_t | cbw_type::bCBWCBLength
uint8_t | cbw_type::CBWCB [16]
uint32_t | csw_type::dCSWSignature
uint32_t | csw_type::dCSWTag
uint32_t | csw_type::dCSWDataResidue
uint32_t | csw_type::bCSWStatus
uint8_t | sense_type::err_code
uint8_t | sense_type::reserved1
uint8_t | sense_type::sense_key
uint32_t | sense_type::information
uint8_t | sense_type::as_length
uint32_t | sense_type::reserved2
uint8_t | sense_type::asc
uint8_t | sense_type::ascq
uint32_t | sense_type::reserved3
uint8_t | msc_type::msc_state
uint8_t | msc_type::bot_status
uint32_t | msc_type::max_lun
uint32_t | msc_type::blk_nbr [1]
uint32_t | msc_type::blk_size [1]
uint32_t | msc_type::blk_addr
uint32_t | msc_type::blk_len
uint32_t | msc_type::data_len
uint8_t | msc_type::data [4096]
uint32_t | msc_type::alt_setting
cbw_type msc_type::cbw_struct
csw_type msc_type::csw_struct
uint32_t | cdc_msc_struct_type::alt_setting
uint8_t | cdc_msc_struct_type::g_rx_buff [0x40]
uint8_t | cdc_msc_struct_type::g_cmd [0x08]
uint8_t | cdc_msc_struct_type::g_req
uint16_t | cdc_msc_struct_type::g_len
uint16_t | cdc_msc_struct_type::g_rxlen
__IO uint8_t | cdc_msc_struct_type::g_tx_completed
__IO uint8_t | cdc_msc_struct_type::g_rx_completed
linecoding_type cdc_msc_struct_type::linecoding
uint8_t | cdc_msc_struct_type::msc_state
uint8_t | cdc_msc_struct_type::bot_status
uint32_t | cdc_msc_struct_type::max_lun
uint32_t | cdc_msc_struct_type::blk_nbr [1]
uint32_t | cdc_msc_struct_type::blk_size [1]
uint64_t | cdc_msc_struct_type::blk_addr
uint32_t | cdc_msc_struct_type::blk_len
uint32_t | cdc_msc_struct_type::data_len
uint8_t | cdc_msc_struct_type::data [4096]
cbw_type cdc_msc_struct_type::cbw_struct
csw_type cdc_msc_struct_type::csw_struct

Detailed Description

Variable Documentation

◆ address [1/2]

uint32_t cbd_extended_type::address

Definition at line 178 of file cdc_msc_class.h.

◆ address [2/2]

uint32_t cbd_typical_type::address

Definition at line 165 of file cdc_msc_class.h.

◆ alloc_length [1/2]

uint32_t cbd_extended_type::alloc_length

Definition at line 180 of file cdc_msc_class.h.

◆ alloc_length [2/2]

uint32_t cbd_typical_type::alloc_length

Definition at line 167 of file cdc_msc_class.h.

◆ alt_setting [1/2]

uint32_t cdc_msc_struct_type::alt_setting

Definition at line 254 of file cdc_msc_class.h.

Referenced by cdc_class_setup_handler(), cdc_struct_init(), and msc_class_setup_handler().

◆ alt_setting [2/2]

uint32_t msc_type::alt_setting

Definition at line 241 of file cdc_msc_class.h.

Referenced by class_setup_handler().

◆ as_length

uint8_t sense_type::as_length

Definition at line 218 of file cdc_msc_class.h.

◆ asc

uint8_t sense_type::asc

Definition at line 220 of file cdc_msc_class.h.

◆ ascq

uint8_t sense_type::ascq

Definition at line 221 of file cdc_msc_class.h.

◆ bCBWCBLength

uint8_t cbw_type::bCBWCBLength

Definition at line 194 of file cdc_msc_class.h.

Referenced by bot_cbw_decode().

◆ bCBWLUN

uint8_t cbw_type::bCBWLUN

Definition at line 193 of file cdc_msc_class.h.

Referenced by bot_cbw_decode(), and bot_scsi_cmd_process().

◆ bCSWStatus

uint32_t csw_type::bCSWStatus

Definition at line 206 of file cdc_msc_class.h.

Referenced by bot_scsi_send_csw(), and bot_scsi_send_data().

◆ blk_addr [1/2]

uint64_t cdc_msc_struct_type::blk_addr

Definition at line 270 of file cdc_msc_class.h.

Referenced by bot_scsi_read10(), bot_scsi_verify(), and bot_scsi_write10().

◆ blk_addr [2/2]

uint32_t msc_type::blk_addr

Definition at line 235 of file cdc_msc_class.h.

◆ blk_len [1/2]

uint32_t cdc_msc_struct_type::blk_len

Definition at line 271 of file cdc_msc_class.h.

Referenced by bot_scsi_read10(), bot_scsi_verify(), and bot_scsi_write10().

◆ blk_len [2/2]

uint32_t msc_type::blk_len

Definition at line 236 of file cdc_msc_class.h.

◆ blk_nbr [1/2]

uint32_t cdc_msc_struct_type::blk_nbr[1]

Definition at line 267 of file cdc_msc_class.h.

Referenced by bot_scsi_capacity(), bot_scsi_check_address(), and bot_scsi_format_capacity().

◆ blk_nbr [2/2]

uint32_t msc_type::blk_nbr

Definition at line 232 of file cdc_msc_class.h.

◆ blk_size [1/2]

uint32_t cdc_msc_struct_type::blk_size[1]

Definition at line 268 of file cdc_msc_class.h.

Referenced by bot_scsi_capacity(), bot_scsi_format_capacity(), bot_scsi_read10(), and bot_scsi_write10().

◆ blk_size [2/2]

uint32_t msc_type::blk_size

Definition at line 233 of file cdc_msc_class.h.

◆ bmCBWFlags

uint8_t cbw_type::bmCBWFlags

Definition at line 192 of file cdc_msc_class.h.

Referenced by bot_scsi_read10(), bot_scsi_stall(), and bot_scsi_write10().

◆ bot_status [1/2]

uint8_t cdc_msc_struct_type::bot_status

Definition at line 264 of file cdc_msc_class.h.

Referenced by bot_cbw_decode(), bot_scsi_clear_feature(), bot_scsi_init(), bot_scsi_reset(), and bot_scsi_stall().

◆ bot_status [2/2]

uint8_t msc_type::bot_status

Definition at line 229 of file cdc_msc_class.h.

◆ cbw_struct [1/2]

cbw_type cdc_msc_struct_type::cbw_struct

Definition at line 276 of file cdc_msc_class.h.

Referenced by bot_cbw_decode(), bot_scsi_cmd_process(), bot_scsi_init(), bot_scsi_inquiry(), bot_scsi_read10(), bot_scsi_request_sense(), bot_scsi_reset(), bot_scsi_send_csw(), bot_scsi_send_data(), bot_scsi_stall(), bot_scsi_test_unit(), bot_scsi_verify(), and bot_scsi_write10().

◆ cbw_struct [2/2]

cbw_type msc_type::cbw_struct

Definition at line 243 of file cdc_msc_class.h.

◆ CBWCB

uint8_t cbw_type::CBWCB

Definition at line 195 of file cdc_msc_class.h.

Referenced by bot_scsi_cmd_process(), bot_scsi_inquiry(), bot_scsi_read10(), bot_scsi_verify(), and bot_scsi_write10().

◆ csw_struct [1/2]

csw_type cdc_msc_struct_type::csw_struct

Definition at line 277 of file cdc_msc_class.h.

Referenced by bot_cbw_decode(), bot_scsi_init(), bot_scsi_read10(), bot_scsi_send_csw(), bot_scsi_send_data(), and bot_scsi_write10().

◆ csw_struct [2/2]

csw_type msc_type::csw_struct

Definition at line 244 of file cdc_msc_class.h.

◆ data [1/2]

uint8_t cdc_msc_struct_type::data[4096]

Definition at line 274 of file cdc_msc_class.h.

Referenced by bot_cbw_decode(), bot_scsi_capacity(), bot_scsi_format_capacity(), bot_scsi_inquiry(), bot_scsi_mode_sense10(), bot_scsi_mode_sense6(), bot_scsi_read10(), bot_scsi_request_sense(), and bot_scsi_write10().

◆ data [2/2]

uint8_t msc_type::data

Definition at line 239 of file cdc_msc_class.h.

◆ data_len [1/2]

uint32_t cdc_msc_struct_type::data_len

Definition at line 273 of file cdc_msc_class.h.

Referenced by bot_cbw_decode(), bot_scsi_allow_medium_removal(), bot_scsi_capacity(), bot_scsi_format_capacity(), bot_scsi_inquiry(), bot_scsi_mode_sense10(), bot_scsi_mode_sense6(), bot_scsi_read10(), bot_scsi_request_sense(), bot_scsi_start_stop(), bot_scsi_test_unit(), and bot_scsi_verify().

◆ data_len [2/2]

uint32_t msc_type::data_len

Definition at line 238 of file cdc_msc_class.h.

◆ dCBWDataTransferLength

uint32_t cbw_type::dCBWDataTransferLength

Definition at line 191 of file cdc_msc_class.h.

Referenced by bot_cbw_decode(), bot_scsi_inquiry(), bot_scsi_read10(), bot_scsi_request_sense(), bot_scsi_send_data(), bot_scsi_stall(), bot_scsi_test_unit(), and bot_scsi_write10().

◆ dCBWSignature

uint32_t cbw_type::dCBWSignature

Definition at line 189 of file cdc_msc_class.h.

Referenced by bot_cbw_decode().

◆ dCBWTage

uint32_t cbw_type::dCBWTage

Definition at line 190 of file cdc_msc_class.h.

Referenced by bot_cbw_decode().

◆ dCSWDataResidue

uint32_t csw_type::dCSWDataResidue

Definition at line 205 of file cdc_msc_class.h.

Referenced by bot_cbw_decode(), bot_scsi_init(), bot_scsi_read10(), bot_scsi_send_data(), and bot_scsi_write10().

◆ dCSWSignature

uint32_t csw_type::dCSWSignature

Definition at line 203 of file cdc_msc_class.h.

Referenced by bot_scsi_init(), and bot_scsi_send_csw().

◆ dCSWTag

uint32_t csw_type::dCSWTag

Definition at line 204 of file cdc_msc_class.h.

Referenced by bot_cbw_decode(), and bot_scsi_init().

◆ err_code

uint8_t sense_type::err_code

Definition at line 214 of file cdc_msc_class.h.

◆ g_cmd

uint8_t cdc_msc_struct_type::g_cmd[0x08]

Definition at line 256 of file cdc_msc_class.h.

Referenced by cdc_class_setup_handler(), and class_ept0_rx_handler().

◆ g_len

uint16_t cdc_msc_struct_type::g_len

Definition at line 258 of file cdc_msc_class.h.

Referenced by cdc_class_setup_handler().

◆ g_req

uint8_t cdc_msc_struct_type::g_req

Definition at line 257 of file cdc_msc_class.h.

Referenced by cdc_class_setup_handler(), and class_ept0_rx_handler().

◆ g_rx_buff

uint8_t cdc_msc_struct_type::g_rx_buff[0x40]

Definition at line 255 of file cdc_msc_class.h.

Referenced by class_init_handler(), and usb_vcp_get_rxdata().

◆ g_rx_completed

__IO uint8_t cdc_msc_struct_type::g_rx_completed

Definition at line 259 of file cdc_msc_class.h.

Referenced by cdc_struct_init(), class_out_handler(), and usb_vcp_get_rxdata().

◆ g_rxlen

uint16_t cdc_msc_struct_type::g_rxlen

Definition at line 258 of file cdc_msc_class.h.

Referenced by class_out_handler(), and usb_vcp_get_rxdata().

◆ g_tx_completed

__IO uint8_t cdc_msc_struct_type::g_tx_completed

Definition at line 259 of file cdc_msc_class.h.

Referenced by cdc_struct_init(), class_in_handler(), and usb_vcp_send_data().

◆ information

uint32_t sense_type::information

Definition at line 217 of file cdc_msc_class.h.

◆ linecoding

linecoding_type cdc_msc_struct_type::linecoding

Definition at line 260 of file cdc_msc_class.h.

Referenced by cdc_struct_init(), and usb_vcp_cmd_process().

◆ lun [1/2]

uint8_t cbd_extended_type::lun

Definition at line 177 of file cdc_msc_class.h.

◆ lun [2/2]

uint8_t cbd_typical_type::lun

Definition at line 164 of file cdc_msc_class.h.

◆ max_lun [1/2]

uint32_t cdc_msc_struct_type::max_lun

Definition at line 265 of file cdc_msc_class.h.

Referenced by bot_scsi_init(), bot_scsi_reset(), and msc_class_setup_handler().

◆ max_lun [2/2]

uint32_t msc_type::max_lun

Definition at line 230 of file cdc_msc_class.h.

Referenced by class_setup_handler().

◆ msc_state [1/2]

uint8_t cdc_msc_struct_type::msc_state

Definition at line 263 of file cdc_msc_class.h.

Referenced by bot_cbw_decode(), bot_scsi_datain_handler(), bot_scsi_dataout_handler(), bot_scsi_init(), bot_scsi_read10(), bot_scsi_reset(), bot_scsi_send_csw(), bot_scsi_send_data(), and bot_scsi_write10().

◆ msc_state [2/2]

uint8_t msc_type::msc_state

Definition at line 228 of file cdc_msc_class.h.

◆ opcode [1/2]

uint8_t cbd_extended_type::opcode

Definition at line 176 of file cdc_msc_class.h.

◆ opcode [2/2]

uint8_t cbd_typical_type::opcode

Definition at line 163 of file cdc_msc_class.h.

◆ reserved1 [1/3]

uint8_t cbd_extended_type::reserved1

Definition at line 179 of file cdc_msc_class.h.

◆ reserved1 [2/3]

uint8_t cbd_typical_type::reserved1

Definition at line 166 of file cdc_msc_class.h.

◆ reserved1 [3/3]

uint8_t sense_type::reserved1

Definition at line 215 of file cdc_msc_class.h.

◆ reserved2 [1/3]

uint16_t cbd_extended_type::reserved2

Definition at line 181 of file cdc_msc_class.h.

◆ reserved2 [2/3]

uint16_t cbd_typical_type::reserved2

Definition at line 168 of file cdc_msc_class.h.

◆ reserved2 [3/3]

uint32_t sense_type::reserved2

Definition at line 219 of file cdc_msc_class.h.

◆ reserved3

uint32_t sense_type::reserved3

Definition at line 222 of file cdc_msc_class.h.

◆ sense_key

uint8_t sense_type::sense_key

Definition at line 216 of file cdc_msc_class.h.


AT32F413 Firmwary Library: USB_audio_class

Topics
USB_audio_class
AT32F413_middlewares_usbd_class

usb device class audio demo More...

Topics

USB_audio_class_private_functions
USB_audio_class_definition
USB_device_audio_config_definition

Detailed Description

usb device class audio demo


AT32F413 Firmwary Library: USB_audio_class_private_functions

Functions | Variables
USB_audio_class_private_functions
AT32F413_middlewares_usbd_class » USB_audio_class

Functions

static usb_sts_type | class_init_handler (void *udev)
initialize usb custom hid endpoint
static usb_sts_type | class_clear_handler (void *udev)
clear endpoint or other state
static usb_sts_type | class_setup_handler (void *udev, usb_setup_type *setup)
usb device class setup request handler
static usb_sts_type | class_ept0_tx_handler (void *udev)
usb device endpoint 0 in status stage complete
static usb_sts_type | class_ept0_rx_handler (void *udev)
usb device endpoint 0 out status stage complete
static usb_sts_type | class_in_handler (void *udev, uint8_t ept_num)
usb device transmision complete handler
static usb_sts_type | class_out_handler (void *udev, uint8_t ept_num)
usb device endpoint receive data
static usb_sts_type | class_sof_handler (void *udev)
usb device sof handler
static usb_sts_type | class_event_handler (void *udev, usbd_event_type event)
usb device event handler
static void | audio_req_get_cur (void *udev, usb_setup_type *setup)
usb audio request get cur
static void | audio_req_set_cur (void *udev, usb_setup_type *setup)
usb audio request set cur
static void | audio_req_get_min (void *udev, usb_setup_type *setup)
usb audio request get min
static void | audio_req_get_max (void *udev, usb_setup_type *setup)
usb audio request get max
static void | audio_req_get_res (void *udev, usb_setup_type *setup)
usb audio request get res
static void | audio_get_interface (void *udev, usb_setup_type *setup)
usb audio get interface
static void | audio_set_interface (void *udev, usb_setup_type *setup)
usb audio set interface

Variables

usb_audio_type audio_struct = {0, 0, 0, 0, 0, 0x1400, 0, 0, 0, {0x0000, 0x1400, 0x33}, {0x0000, 0x1400, 0x33}, 0, 0}
usbd_class_handler audio_class_handler

Detailed Description

Function Documentation

◆ audio_get_interface()

static void audio_get_interface | ( | void * | udev,
 |  | usb_setup_type * | setup )
 static

usb audio get interface

Parameters
udev | usb device core handler type
setup | setup class
Return values
none

Definition at line 705 of file audio_class.c.

Referenced by class_setup_handler().

◆ audio_req_get_cur()

static void audio_req_get_cur | ( | void * | udev,
 |  | usb_setup_type * | setup )
 static

usb audio request get cur

Parameters
udev | usb device core handler type
setup | setup class
Return values
none

Definition at line 417 of file audio_class.c.

Referenced by class_setup_handler().

◆ audio_req_get_max()

static void audio_req_get_max | ( | void * | udev,
 |  | usb_setup_type * | setup )
 static

usb audio request get max

Parameters
udev | usb device core handler type
setup | setup class
Return values
none

Definition at line 593 of file audio_class.c.

Referenced by class_setup_handler().

◆ audio_req_get_min()

static void audio_req_get_min | ( | void * | udev,
 |  | usb_setup_type * | setup )
 static

usb audio request get min

Parameters
udev | usb device core handler type
setup | setup class
Return values
none

Definition at line 555 of file audio_class.c.

Referenced by class_setup_handler().

◆ audio_req_get_res()

static void audio_req_get_res | ( | void * | udev,
 |  | usb_setup_type * | setup )
 static

usb audio request get res

Parameters
udev | usb device core handler type
setup | setup class
Return values
none

Definition at line 631 of file audio_class.c.

Referenced by class_setup_handler().

◆ audio_req_set_cur()

static void audio_req_set_cur | ( | void * | udev,
 |  | usb_setup_type * | setup )
 static

usb audio request set cur

Parameters
udev | usb device core handler type
setup | setup class
Return values
none

Definition at line 499 of file audio_class.c.

Referenced by class_setup_handler().

◆ audio_set_interface()

static void audio_set_interface | ( | void * | udev,
 |  | usb_setup_type * | setup )
 static

usb audio set interface

Parameters
udev | usb device core handler type
setup | setup class
Return values
none

Definition at line 668 of file audio_class.c.

Referenced by class_setup_handler().

◆ class_clear_handler()

static usb_sts_type class_clear_handler ( void * udev )
static

clear endpoint or other state

Parameters
udev usb device core handler type
Return values
status of usb_sts_type

Definition at line 117 of file audio_class.c.

◆ class_ept0_rx_handler()

static usb_sts_type class_ept0_rx_handler ( void * udev )
static

usb device endpoint 0 out status stage complete

Parameters
udev usb device core handler type
Return values
status of usb_sts_type

Definition at line 237 of file audio_class.c.

◆ class_ept0_tx_handler()

static usb_sts_type class_ept0_tx_handler ( void * udev )
static

usb device endpoint 0 in status stage complete

Parameters
udev usb device core handler type
Return values
status of usb_sts_type

Definition at line 223 of file audio_class.c.

◆ class_event_handler()

usb_sts_type class_event_handler | ( | void * | udev,
 |  | usbd_event_type | event )
 static

usb device event handler

Parameters
udev | usb device core handler type
event | usb device event
Return values
status of usb_sts_type

Definition at line 381 of file audio_class.c.

◆ class_in_handler()

static usb_sts_type class_in_handler | ( | void * | udev,
 |  | uint8_t | ept_num )
 static

usb device transmision complete handler

Parameters
udev | usb device core handler type
ept_num | endpoint number
Return values
status of usb_sts_type

Definition at line 308 of file audio_class.c.

◆ class_init_handler()

static usb_sts_type class_init_handler ( void * udev )
static

initialize usb custom hid endpoint

Parameters
udev usb device core handler type
Return values
status of usb_sts_type

Definition at line 83 of file audio_class.c.

◆ class_out_handler()

static usb_sts_type class_out_handler | ( | void * | udev,
 |  | uint8_t | ept_num )
 static

usb device endpoint receive data

Parameters
udev | usb device core handler type
ept_num | endpoint number
Return values
status of usb_sts_type

Definition at line 339 of file audio_class.c.

◆ class_setup_handler()

static usb_sts_type class_setup_handler | ( | void * | udev,
 |  | usb_setup_type * | setup )
 static

usb device class setup request handler

Parameters
udev | usb device core handler type
setup | setup packet
Return values
status of usb_sts_type

Definition at line 140 of file audio_class.c.

◆ class_sof_handler()

static usb_sts_type class_sof_handler ( void * udev )
static

usb device sof handler

Parameters
udev usb device core handler type
Return values
status of usb_sts_type

Definition at line 366 of file audio_class.c.

Variable Documentation

◆ audio_class_handler

usbd_class_handler audio_class_handler
Initial value:
=
{
class_init_handler,
class_clear_handler,
class_setup_handler,
class_ept0_tx_handler,
class_ept0_rx_handler,
class_in_handler,
class_out_handler,
class_sof_handler,
class_event_handler,
&audio_struct
}
class_sof_handler
static usb_sts_type class_sof_handler(void *udev)
usb device sof handler
Definition audio_class.c:366
class_in_handler
static usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
usb device transmision complete handler
Definition audio_class.c:308
class_clear_handler
static usb_sts_type class_clear_handler(void *udev)
clear endpoint or other state
Definition audio_class.c:117
class_setup_handler
static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
usb device class setup request handler
Definition audio_class.c:140
class_ept0_tx_handler
static usb_sts_type class_ept0_tx_handler(void *udev)
usb device endpoint 0 in status stage complete
Definition audio_class.c:223
class_event_handler
static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
usb device event handler
Definition audio_class.c:381
class_ept0_rx_handler
static usb_sts_type class_ept0_rx_handler(void *udev)
usb device endpoint 0 out status stage complete
Definition audio_class.c:237
audio_struct
usb_audio_type audio_struct
Definition audio_class.c:61
class_init_handler
static usb_sts_type class_init_handler(void *udev)
initialize usb custom hid endpoint
Definition audio_class.c:83
class_out_handler
static usb_sts_type class_out_handler(void *udev, uint8_t ept_num)
usb device endpoint receive data
Definition audio_class.c:339

Definition at line 64 of file audio_class.c.

Referenced by main().

◆ audio_struct

usb_audio_type audio_struct = {0, 0, 0, 0, 0, 0x1400, 0, 0, 0, {0x0000, 0x1400, 0x33}, {0x0000, 0x1400, 0x33}, 0, 0}

Definition at line 61 of file audio_class.c.


AT32F413 Firmwary Library: USB_audio_class_definition

Data Structures | Macros | Variables
USB_audio_class_definition
AT32F413_middlewares_usbd_class » USB_audio_class

Data Structures

struct usb_audio_type
usb audio control struct More...

Macros

#define | USBD_AUDIO_MIC_IN_EPT 0x81
endpoint define
#define | USBD_AUDIO_SPK_OUT_EPT 0x02
#define | USBD_AUDIO_FEEDBACK_EPT 0x83
#define | AUDIO_REMAIN_SIZE 40
endpoint support max size
#define | AUDIO_MIC_IN_MAXPACKET_SIZE (AUDIO_SUPPORT_MAX_FREQ * AUDIO_MIC_CHANEL_NUM * (AUDIO_MIC_DEFAULT_BITW / 8) + AUDIO_REMAIN_SIZE)
#define | AUDIO_SPK_OUT_MAXPACKET_SIZE (AUDIO_SUPPORT_MAX_FREQ * AUDIO_SPK_CHANEL_NUM * (AUDIO_SPK_DEFAULT_BITW / 8) + AUDIO_REMAIN_SIZE)
#define | AUDIO_FEEDBACK_MAXPACKET_SIZE 0x3
#define | FEEDBACK_REFRESH_TIME 0x8
#define | AUDIO_REQ_CONTROL_INTERFACE 0x01
request type define
#define | AUDIO_REQ_CONTROL_ENDPOINT 0x02
#define | AUDIO_REQ_CONTROL_MASK 0x03
#define | AUDIO_MUTE_CONTROL 0x01
audio set cur type define
#define | AUDIO_VOLUME_CONTROL 0x02
#define | AUDIO_FREQ_SET_CONTROL 0x03
#define | AUDIO_SAMPLING_FREQ_CONTROL 0x01
#define | AUDIO_DESCRIPTOR_TYPE 0x21
audio descriptor type
#define | AUDIO_DESCRIPTOR_SIZE 0x09

Variables

usbd_class_handler audio_class_handler

Detailed Description

Macro Definition Documentation

◆ AUDIO_DESCRIPTOR_SIZE

#define AUDIO_DESCRIPTOR_SIZE 0x09

Definition at line 84 of file audio_class.h.

Referenced by class_audio_setup_handler(), and class_setup_handler().

◆ AUDIO_DESCRIPTOR_TYPE

#define AUDIO_DESCRIPTOR_TYPE 0x21

audio descriptor type

Definition at line 83 of file audio_class.h.

Referenced by class_audio_setup_handler(), and class_setup_handler().

◆ AUDIO_FEEDBACK_MAXPACKET_SIZE

#define AUDIO_FEEDBACK_MAXPACKET_SIZE 0x3

Definition at line 63 of file audio_class.h.

Referenced by class_init_handler(), and class_init_handler().

◆ AUDIO_FREQ_SET_CONTROL

#define AUDIO_FREQ_SET_CONTROL 0x03

Definition at line 77 of file audio_class.h.

Referenced by audio_req_set_cur(), audio_req_set_cur(), class_ept0_rx_handler(), and class_ept0_rx_handler().

◆ AUDIO_MIC_IN_MAXPACKET_SIZE

#define AUDIO_MIC_IN_MAXPACKET_SIZE (AUDIO_SUPPORT_MAX_FREQ * AUDIO_MIC_CHANEL_NUM * (AUDIO_MIC_DEFAULT_BITW / 8) + AUDIO_REMAIN_SIZE)

Definition at line 61 of file audio_class.h.

Referenced by class_init_handler(), and class_init_handler().

◆ AUDIO_MUTE_CONTROL

#define AUDIO_MUTE_CONTROL 0x01

audio set cur type define

Definition at line 75 of file audio_class.h.

Referenced by audio_req_get_cur(), audio_req_get_cur(), audio_req_set_cur(), audio_req_set_cur(), class_ept0_rx_handler(), and class_ept0_rx_handler().

◆ AUDIO_REMAIN_SIZE

#define AUDIO_REMAIN_SIZE 40

endpoint support max size

Definition at line 60 of file audio_class.h.

◆ AUDIO_REQ_CONTROL_ENDPOINT

#define AUDIO_REQ_CONTROL_ENDPOINT 0x02

Definition at line 69 of file audio_class.h.

Referenced by audio_req_get_cur(), audio_req_get_cur(), audio_req_get_max(), audio_req_get_max(), audio_req_get_min(), audio_req_get_min(), audio_req_get_res(), audio_req_get_res(), audio_req_set_cur(), and audio_req_set_cur().

◆ AUDIO_REQ_CONTROL_INTERFACE

#define AUDIO_REQ_CONTROL_INTERFACE 0x01

request type define

Definition at line 68 of file audio_class.h.

Referenced by audio_req_get_cur(), audio_req_get_cur(), audio_req_get_max(), audio_req_get_max(), audio_req_get_min(), audio_req_get_min(), audio_req_get_res(), audio_req_get_res(), audio_req_set_cur(), and audio_req_set_cur().

◆ AUDIO_REQ_CONTROL_MASK

#define AUDIO_REQ_CONTROL_MASK 0x03

Definition at line 70 of file audio_class.h.

Referenced by audio_req_get_cur(), audio_req_get_cur(), audio_req_get_max(), audio_req_get_max(), audio_req_get_min(), audio_req_get_min(), audio_req_get_res(), audio_req_get_res(), audio_req_set_cur(), and audio_req_set_cur().

◆ AUDIO_SAMPLING_FREQ_CONTROL

#define AUDIO_SAMPLING_FREQ_CONTROL 0x01

Definition at line 78 of file audio_class.h.

Referenced by audio_req_get_cur(), audio_req_get_cur(), audio_req_set_cur(), and audio_req_set_cur().

◆ AUDIO_SPK_OUT_MAXPACKET_SIZE

#define AUDIO_SPK_OUT_MAXPACKET_SIZE (AUDIO_SUPPORT_MAX_FREQ * AUDIO_SPK_CHANEL_NUM * (AUDIO_SPK_DEFAULT_BITW / 8) + AUDIO_REMAIN_SIZE)

Definition at line 62 of file audio_class.h.

Referenced by audio_set_interface(), audio_set_interface(), class_init_handler(), class_init_handler(), class_out_handler(), and class_out_handler().

◆ AUDIO_VOLUME_CONTROL

#define AUDIO_VOLUME_CONTROL 0x02

Definition at line 76 of file audio_class.h.

Referenced by audio_req_get_cur(), audio_req_get_cur(), audio_req_set_cur(), audio_req_set_cur(), class_ept0_rx_handler(), and class_ept0_rx_handler().

◆ FEEDBACK_REFRESH_TIME

#define FEEDBACK_REFRESH_TIME 0x8

Definition at line 64 of file audio_class.h.

◆ USBD_AUDIO_FEEDBACK_EPT

#define USBD_AUDIO_FEEDBACK_EPT 0x83

Definition at line 55 of file audio_class.h.

Referenced by audio_set_interface(), class_clear_handler(), class_in_handler(), and class_init_handler().

◆ USBD_AUDIO_MIC_IN_EPT

#define USBD_AUDIO_MIC_IN_EPT 0x81

endpoint define

Definition at line 53 of file audio_class.h.

Referenced by audio_req_get_cur(), audio_set_interface(), class_clear_handler(), class_ept0_rx_handler(), class_in_handler(), and class_init_handler().

◆ USBD_AUDIO_SPK_OUT_EPT

#define USBD_AUDIO_SPK_OUT_EPT 0x02

Definition at line 54 of file audio_class.h.

Referenced by audio_req_get_cur(), audio_set_interface(), class_clear_handler(), class_init_handler(), and class_out_handler().

Variable Documentation

◆ audio_class_handler

usbd_class_handler audio_class_handler
extern

Definition at line 64 of file audio_class.c.

Referenced by main().


AT32F413 Firmwary Library: usb_audio_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
usb_audio_type Struct Reference
AT32F413_middlewares_usbd_class » USB_audio_class » USB_audio_class_definition

usb audio control struct More...

#include <audio_class.h>

Data Fields

uint8_t | enpd
uint8_t | interface
uint8_t | request_no
uint8_t | spk_mute
uint8_t | mic_mute
uint16_t | spk_volume
uint16_t | mic_volume
uint32_t | spk_freq
uint32_t | mic_freq
uint16_t | spk_volume_limits [3]
uint16_t | mic_volume_limits [3]
uint8_t | audio_cmd
uint32_t | audio_cmd_len
uint32_t | spk_alt_setting
uint32_t | mic_alt_setting
uint8_t | g_audio_cur [64]
uint8_t | audio_spk_data [(48 *2 *(16/8)+40)]
uint8_t | audio_mic_data [(48 *2 *(16/8)+40)]
uint8_t | audio_feed_back [0x3+1]

Detailed Description

usb audio control struct

Definition at line 89 of file audio_class.h.

Field Documentation

◆ audio_cmd

uint8_t usb_audio_type::audio_cmd

Definition at line 103 of file audio_class.h.

Referenced by audio_req_set_cur(), and class_ept0_rx_handler().

◆ audio_cmd_len

uint32_t usb_audio_type::audio_cmd_len

Definition at line 104 of file audio_class.h.

Referenced by audio_req_set_cur().

◆ audio_feed_back

uint8_t usb_audio_type::audio_feed_back[0x3+1]

Definition at line 110 of file audio_class.h.

Referenced by audio_set_interface(), and class_in_handler().

◆ audio_mic_data

uint8_t usb_audio_type::audio_mic_data[(48 *2 *(16/8)+40)]

Definition at line 109 of file audio_class.h.

Referenced by audio_set_interface(), and class_in_handler().

◆ audio_spk_data

uint8_t usb_audio_type::audio_spk_data[(48 *2 *(16/8)+40)]

Definition at line 108 of file audio_class.h.

Referenced by audio_set_interface(), class_init_handler(), and class_out_handler().

◆ enpd

uint8_t usb_audio_type::enpd

Definition at line 91 of file audio_class.h.

Referenced by audio_req_set_cur(), and class_ept0_rx_handler().

◆ g_audio_cur

uint8_t usb_audio_type::g_audio_cur[64]

Definition at line 107 of file audio_class.h.

Referenced by audio_req_get_cur(), audio_req_get_max(), audio_req_get_min(), audio_req_get_res(), audio_req_set_cur(), and class_ept0_rx_handler().

◆ interface

uint8_t usb_audio_type::interface

Definition at line 92 of file audio_class.h.

Referenced by audio_req_set_cur(), and class_ept0_rx_handler().

◆ mic_alt_setting

uint32_t usb_audio_type::mic_alt_setting

Definition at line 106 of file audio_class.h.

Referenced by audio_get_interface(), audio_set_interface(), and class_event_handler().

◆ mic_freq

uint32_t usb_audio_type::mic_freq

Definition at line 99 of file audio_class.h.

Referenced by audio_req_get_cur(), and class_ept0_rx_handler().

◆ mic_mute

uint8_t usb_audio_type::mic_mute

Definition at line 95 of file audio_class.h.

Referenced by audio_req_get_cur(), and class_ept0_rx_handler().

◆ mic_volume

uint16_t usb_audio_type::mic_volume

Definition at line 97 of file audio_class.h.

Referenced by audio_req_get_cur(), and class_ept0_rx_handler().

◆ mic_volume_limits

uint16_t usb_audio_type::mic_volume_limits[3]

Definition at line 101 of file audio_class.h.

Referenced by audio_req_get_max(), audio_req_get_min(), audio_req_get_res(), and class_ept0_rx_handler().

◆ request_no

uint8_t usb_audio_type::request_no

Definition at line 93 of file audio_class.h.

Referenced by audio_req_set_cur(), and class_ept0_rx_handler().

◆ spk_alt_setting

uint32_t usb_audio_type::spk_alt_setting

Definition at line 105 of file audio_class.h.

Referenced by audio_get_interface(), audio_set_interface(), and class_event_handler().

◆ spk_freq

uint32_t usb_audio_type::spk_freq

Definition at line 98 of file audio_class.h.

Referenced by audio_req_get_cur(), and class_ept0_rx_handler().

◆ spk_mute

uint8_t usb_audio_type::spk_mute

Definition at line 94 of file audio_class.h.

Referenced by audio_req_get_cur(), and class_ept0_rx_handler().

◆ spk_volume

uint16_t usb_audio_type::spk_volume

Definition at line 96 of file audio_class.h.

Referenced by audio_req_get_cur(), and class_ept0_rx_handler().

◆ spk_volume_limits

uint16_t usb_audio_type::spk_volume_limits[3]

Definition at line 100 of file audio_class.h.

Referenced by audio_req_get_max(), audio_req_get_min(), audio_req_get_res(), and class_ept0_rx_handler().

The documentation for this struct was generated from the following file:
  • audio_class.h


AT32F413 Firmwary Library: USB_device_audio_config_definition

Macros
USB_device_audio_config_definition
AT32F413_middlewares_usbd_class » USB_audio_class

Macros

#define | AUDIO_SUPPORT_SPK 1
#define | AUDIO_SUPPORT_MIC 1
#define | AUDIO_SUPPORT_FEEDBACK 1
#define | AUDIO_SUPPORT_FREQ_16K 1
#define | AUDIO_SUPPORT_FREQ_48K 1
#define | AUDIO_SUPPORT_FREQ
#define | AUDIO_FREQ_16K 16000
#define | AUDIO_FREQ_48K 48000
#define | AUDIO_BITW_16 16
#define | AUDIO_MIC_CHANEL_NUM 2
#define | AUDIO_MIC_DEFAULT_BITW AUDIO_BITW_16
#define | AUDIO_SPK_CHANEL_NUM 2
#define | AUDIO_SPK_DEFAULT_BITW AUDIO_BITW_16
#define | AUDIO_SUPPORT_MAX_FREQ 48
#define | AUDIO_DEFAULT_FREQ AUDIO_FREQ_48K
#define | AUDIO_DEFAULT_BITW AUDIO_BITW_16

Detailed Description

Macro Definition Documentation

◆ AUDIO_BITW_16

#define AUDIO_BITW_16 16

Definition at line 60 of file audio/audio_conf.h.

Referenced by audio_codec_init().

◆ AUDIO_DEFAULT_BITW

#define AUDIO_DEFAULT_BITW AUDIO_BITW_16

Definition at line 71 of file audio/audio_conf.h.

Referenced by audio_codec_init().

◆ AUDIO_DEFAULT_FREQ

#define AUDIO_DEFAULT_FREQ AUDIO_FREQ_48K

Definition at line 70 of file audio/audio_conf.h.

Referenced by audio_codec_init().

◆ AUDIO_FREQ_16K

#define AUDIO_FREQ_16K 16000

Definition at line 58 of file audio/audio_conf.h.

Referenced by audio_codec_init(), and audio_codec_modify_freq().

◆ AUDIO_FREQ_48K

#define AUDIO_FREQ_48K 48000

Definition at line 59 of file audio/audio_conf.h.

Referenced by audio_codec_init(), and audio_codec_modify_freq().

◆ AUDIO_MIC_CHANEL_NUM

#define AUDIO_MIC_CHANEL_NUM 2

Definition at line 62 of file audio/audio_conf.h.

Referenced by codec_i2s_init().

◆ AUDIO_MIC_DEFAULT_BITW

#define AUDIO_MIC_DEFAULT_BITW AUDIO_BITW_16

Definition at line 63 of file audio/audio_conf.h.

◆ AUDIO_SPK_CHANEL_NUM

#define AUDIO_SPK_CHANEL_NUM 2

Definition at line 65 of file audio/audio_conf.h.

Referenced by codec_i2s_init().

◆ AUDIO_SPK_DEFAULT_BITW

#define AUDIO_SPK_DEFAULT_BITW AUDIO_BITW_16

Definition at line 66 of file audio/audio_conf.h.

◆ AUDIO_SUPPORT_FEEDBACK

#define AUDIO_SUPPORT_FEEDBACK 1

Definition at line 48 of file audio/audio_conf.h.

◆ AUDIO_SUPPORT_FREQ

#define AUDIO_SUPPORT_FREQ
Value:
(AUDIO_SUPPORT_FREQ_16K + \
AUDIO_SUPPORT_FREQ_48K \
)
AUDIO_SUPPORT_FREQ_48K
#define AUDIO_SUPPORT_FREQ_48K
Definition audio/audio_conf.h:51
AUDIO_SUPPORT_FREQ_16K
#define AUDIO_SUPPORT_FREQ_16K
Definition audio/audio_conf.h:50

Definition at line 54 of file audio/audio_conf.h.

◆ AUDIO_SUPPORT_FREQ_16K

#define AUDIO_SUPPORT_FREQ_16K 1

Definition at line 50 of file audio/audio_conf.h.

◆ AUDIO_SUPPORT_FREQ_48K

#define AUDIO_SUPPORT_FREQ_48K 1

Definition at line 51 of file audio/audio_conf.h.

◆ AUDIO_SUPPORT_MAX_FREQ

#define AUDIO_SUPPORT_MAX_FREQ 48

Definition at line 69 of file audio/audio_conf.h.

◆ AUDIO_SUPPORT_MIC

#define AUDIO_SUPPORT_MIC 1

Definition at line 47 of file audio/audio_conf.h.

◆ AUDIO_SUPPORT_SPK

#define AUDIO_SUPPORT_SPK 1

Definition at line 46 of file audio/audio_conf.h.


AT32F413 Firmwary Library: USB_audio_desc

Topics
USB_audio_desc
AT32F413_middlewares_usbd_class

usb device audio descriptor More...

Topics

USB_audio_desc_private_functions
USB_audio_desc_definition

Detailed Description

usb device audio descriptor


AT32F413 Firmwary Library: USB_audio_desc_private_functions

Functions | Variables
USB_audio_desc_private_functions
AT32F413_middlewares_usbd_class » USB_audio_desc

Functions

static usbd_desc_t * | get_device_descriptor (void)
get device descriptor
static usbd_desc_t * | get_device_qualifier (void)
get device qualifier
static usbd_desc_t * | get_device_configuration (void)
get config descriptor
static usbd_desc_t * | get_device_other_speed (void)
get other speed descriptor
static usbd_desc_t * | get_device_lang_id (void)
get lang id descriptor
static usbd_desc_t * | get_device_manufacturer_string (void)
get manufacturer descriptor
static usbd_desc_t * | get_device_product_string (void)
get product descriptor
static usbd_desc_t * | get_device_serial_string (void)
get serial descriptor
static usbd_desc_t * | get_device_interface_string (void)
get interface descriptor
static usbd_desc_t * | get_device_config_string (void)
get device config descriptor
static uint16_t | usbd_unicode_convert (uint8_t *string, uint8_t *unicode_buf)
standard usb unicode convert
static void | usbd_int_to_unicode (uint32_t value, uint8_t *pbuf, uint8_t len)
usb int convert to unicode
static void | get_serial_num (void)
usb get serial number

Variables

static ALIGNED_HEAD uint8_t g_usbd_desc_buffer[256] | ALIGNED_TAIL
usb device standard descriptor
usbd_desc_handler audio_desc_handler
device descriptor handler structure
static usbd_desc_t | device_descriptor
static usbd_desc_t | config_descriptor
static usbd_desc_t | langid_descriptor
static usbd_desc_t | serial_descriptor
static usbd_desc_t | vp_desc

Detailed Description

Function Documentation

◆ get_device_config_string()

static usbd_desc_t * get_device_config_string ( void )
static

get device config descriptor

Parameters
none
Return values
usbd_desc

Definition at line 624 of file audio_desc.c.

◆ get_device_configuration()

static usbd_desc_t * get_device_configuration ( void )
static

get config descriptor

Parameters
none
Return values
usbd_desc

Definition at line 546 of file audio_desc.c.

◆ get_device_descriptor()

static usbd_desc_t * get_device_descriptor ( void )
static

get device descriptor

Parameters
none
Return values
usbd_desc

Definition at line 526 of file audio_desc.c.

◆ get_device_interface_string()

static usbd_desc_t * get_device_interface_string ( void )
static

get interface descriptor

Parameters
none
Return values
usbd_desc

Definition at line 612 of file audio_desc.c.

◆ get_device_lang_id()

static usbd_desc_t * get_device_lang_id ( void )
static

get lang id descriptor

Parameters
none
Return values
usbd_desc

Definition at line 566 of file audio_desc.c.

◆ get_device_manufacturer_string()

static usbd_desc_t * get_device_manufacturer_string ( void )
static

get manufacturer descriptor

Parameters
none
Return values
usbd_desc

Definition at line 577 of file audio_desc.c.

◆ get_device_other_speed()

static usbd_desc_t * get_device_other_speed ( void )
static

get other speed descriptor

Parameters
none
Return values
usbd_desc

Definition at line 556 of file audio_desc.c.

◆ get_device_product_string()

static usbd_desc_t * get_device_product_string ( void )
static

get product descriptor

Parameters
none
Return values
usbd_desc

Definition at line 589 of file audio_desc.c.

◆ get_device_qualifier()

static usbd_desc_t * get_device_qualifier ( void )
static

get device qualifier

Parameters
none
Return values
usbd_desc

Definition at line 536 of file audio_desc.c.

◆ get_device_serial_string()

static usbd_desc_t * get_device_serial_string ( void )
static

get serial descriptor

Parameters
none
Return values
usbd_desc

Definition at line 601 of file audio_desc.c.

◆ get_serial_num()

static void get_serial_num ( void )
static

usb get serial number

Parameters
none
Return values
none

Definition at line 504 of file audio_desc.c.

Referenced by get_device_serial_string().

◆ usbd_int_to_unicode()

static void usbd_int_to_unicode | ( | uint32_t | value,
 |  | uint8_t * | pbuf,
 |  | uint8_t | len )
 static

usb int convert to unicode

Parameters
value | int value
pbus | unicode buffer
len | length
Return values
none

Definition at line 478 of file audio_desc.c.

Referenced by get_serial_num().

◆ usbd_unicode_convert()

static uint16_t usbd_unicode_convert | ( | uint8_t * | string,
 |  | uint8_t * | unicode_buf )
 static

standard usb unicode convert

Parameters
string | source string
unicode_buf | unicode buffer
Return values
length

< usb standard device type string

Definition at line 452 of file audio_desc.c.

Referenced by get_device_config_string(), get_device_interface_string(), get_device_manufacturer_string(), and get_device_product_string().

Variable Documentation

◆ ALIGNED_TAIL

ALIGNED_HEAD uint8_t g_string_serial [ 0x1A ] ALIGNED_TAIL
static
Initial value:
=
{
0x12 ,
1 ,
0x00,
0x02,
0x00,
0x00,
0x00,
64 ,
((uint8_t)( 0x2E3C & 0x00FF)) ,
((uint8_t)(( 0x2E3C & 0xFF00) >>8)) ,
((uint8_t)( 0x5730 & 0x00FF)) ,
((uint8_t)(( 0x5730 & 0xFF00) >>8)) ,
0x00,
0x02,
1 ,
2 ,
3 ,
0x01
}

usb device standard descriptor

usb string serial

usb string lang id

usb configuration standard descriptor

Definition at line 59 of file audio_desc.c.

◆ audio_desc_handler

usbd_desc_handler audio_desc_handler
Initial value:
=
{
get_device_descriptor,
get_device_qualifier,
get_device_configuration,
get_device_other_speed,
get_device_lang_id,
get_device_manufacturer_string,
get_device_product_string,
get_device_serial_string,
get_device_interface_string,
get_device_config_string,
}
get_device_configuration
static usbd_desc_t * get_device_configuration(void)
get config descriptor
Definition audio_desc.c:546
get_device_descriptor
static usbd_desc_t * get_device_descriptor(void)
get device descriptor
Definition audio_desc.c:526
get_device_manufacturer_string
static usbd_desc_t * get_device_manufacturer_string(void)
get manufacturer descriptor
Definition audio_desc.c:577
get_device_qualifier
static usbd_desc_t * get_device_qualifier(void)
get device qualifier
Definition audio_desc.c:536
get_device_interface_string
static usbd_desc_t * get_device_interface_string(void)
get interface descriptor
Definition audio_desc.c:612
get_device_other_speed
static usbd_desc_t * get_device_other_speed(void)
get other speed descriptor
Definition audio_desc.c:556
get_device_product_string
static usbd_desc_t * get_device_product_string(void)
get product descriptor
Definition audio_desc.c:589
get_device_config_string
static usbd_desc_t * get_device_config_string(void)
get device config descriptor
Definition audio_desc.c:624
get_device_lang_id
static usbd_desc_t * get_device_lang_id(void)
get lang id descriptor
Definition audio_desc.c:566
get_device_serial_string
static usbd_desc_t * get_device_serial_string(void)
get serial descriptor
Definition audio_desc.c:601

device descriptor handler structure

Definition at line 64 of file audio_desc.c.

Referenced by main().

◆ config_descriptor

usbd_desc_t config_descriptor
static
Initial value:
=
{
( 0x12 + ((0x08 + ( 1 + 1 )) + ( 1 + 1 )* 0x22)+ + (0x31 + ( ( 1 + 1 ))* 3) + (0x31 + ( ( 1 + 1 ))* 3) + (9 * 1 ) ),
g_usbd_configuration
}

Definition at line 424 of file audio_desc.c.

Referenced by get_device_configuration().

◆ device_descriptor

usbd_desc_t device_descriptor
static
Initial value:
=
{
0x12 ,
g_usbd_descriptor
}

Definition at line 417 of file audio_desc.c.

Referenced by get_device_descriptor().

◆ langid_descriptor

usbd_desc_t langid_descriptor
static
Initial value:
=
{
4 ,
g_string_lang_id
}

Definition at line 431 of file audio_desc.c.

Referenced by get_device_lang_id().

◆ serial_descriptor

usbd_desc_t serial_descriptor
static
Initial value:
=
{
0x1A ,
g_string_serial
}

Definition at line 438 of file audio_desc.c.

Referenced by get_device_serial_string().

◆ vp_desc

usbd_desc_t vp_desc
static

Definition at line 444 of file audio_desc.c.

Referenced by get_device_config_string(), get_device_interface_string(), get_device_manufacturer_string(), and get_device_product_string().


AT32F413 Firmwary Library: USB_audio_desc_definition

Macros | Variables
USB_audio_desc_definition
AT32F413_middlewares_usbd_class » USB_audio_desc

Macros

#define | AUDIO_BCD_NUM 0x0100
#define | USBD_AUDIO_VENDOR_ID 0x2E3C
#define | USBD_AUDIO_PRODUCT_ID 0x5730
#define | USBD_AUDIO_SIZ_STRING_LANGID 4
#define | USBD_AUDIO_SIZ_STRING_SERIAL 0x1A
#define | USBD_AUDIO_DESC_MANUFACTURER_STRING "Artery"
#define | USBD_AUDIO_DESC_PRODUCT_STRING "AT32 Audio"
#define | USBD_AUDIO_DESC_CONFIGURATION_STRING "Audio Config"
#define | USBD_AUDIO_DESC_INTERFACE_STRING "Audio Interface"
#define | AUDIO_SUBCLASS_UNDEFINED 0x00
audio interface subclass codes
#define | AUDIO_SUBCLASS_AUDIOCONTROL 0x01
#define | AUDIO_SUBCLASS_AUDIOSTREAMING 0x02
#define | AUDIO_SUBCLASS_MIDISTREMING 0x03
#define | AUDIO_CS_INTERFACE 0x24
audio class-specific descriptor types
#define | AUDIO_CS_ENDPOINT 0x25
#define | AUDIO_CS_STRING 0x23
#define | AUDIO_CS_CONFIGURATION 0x22
#define | AUDIO_CS_DEVICE 0x21
#define | AUDIO_CS_UNDEFINED 0x20
#define | AUDIO_PROTOCOL_UNDEFINED 0x00
audio interface protocol codes
#define | AUDIO_AC_DESCRIPTOR_UNDEFINED 0x00
audio class-specific ac interface descriptor subtypes
#define | AUDIO_AC_HEADER 0x01
#define | AUDIO_AC_INPUT_TERMINAL 0x02
#define | AUDIO_AC_OUTPUT_TERMINAL 0x03
#define | AUDIO_AC_MIXER_UNIT 0x04
#define | AUDIO_AC_SELECTOR_UNIT 0x05
#define | AUDIO_AC_FEATURE_UNIT 0x06
#define | AUDIO_AC_PROCESSING_UNIT 0x07
#define | AUDIO_AC_EXTENSION_UNIT 0x08
#define | AUDIO_AS_DESCRIPTOR_UNDEFINED 0x00
audio class-specific as interface descriptor subtypes
#define | AUDIO_AS_GENERAL 0x01
#define | AUDIO_AS_FORMAT_TYPE 0x02
#define | AUDIO_AS_FORMAT_SPECIFIC 0x03
#define | AUDIO_REQUEST_CODE_UNDEFINED 0x00
audio class-specific request codes
#define | AUDIO_REQ_SET_CUR 0x01
#define | AUDIO_REQ_GET_CUR 0x81
#define | AUDIO_REQ_SET_MIN 0x02
#define | AUDIO_REQ_GET_MIN 0x82
#define | AUDIO_REQ_SET_MAX 0x03
#define | AUDIO_REQ_GET_MAX 0x83
#define | AUDIO_REQ_SET_RES 0x04
#define | AUDIO_REQ_GET_RES 0x84
#define | AUDIO_REQ_SET_MEM 0x05
#define | AUDIO_REQ_GET_MEM 0x85
#define | AUDIO_REQ_GET_STAT 0xFF
#define | AUDIO_FU_CONTROL_UNDEFINED 0x00
audio feature unit control selectors
#define | AUDIO_FU_MUTE_CONTROL 0x01
#define | AUDIO_FU_VOLUME_CONTROL 0x02
#define | AUDIO_FU_BASS_CONTROL 0x03
#define | AUDIO_FU_MID_CONTROL 0x04
#define | AUDIO_FU_TREBLE_CONTROL 0x05
#define | AUDIO_TERMINAL_TYPE_UNDEFINED 0x0100
audio terminal type
#define | AUDIO_TERMINAL_TYPE_STREAMING 0x0101
#define | AUDIO_TERMINAL_TYPE_VENDOR 0x01FF
#define | AUDIO_INPUT_TERMINAL_UNDEFINED 0x0200
#define | AUDIO_INPUT_TERMINAL_MICROPHONE 0x0201
#define | AUDIO_OUTPUT_TERMINAL_UNDEFINED 0x0300
#define | AUDIO_OUTPUT_TERMINAL_SPEAKER 0x0301
#define | AUDIO_FORMAT_TYPE_I 0x01
audio format type 1
#define | AUDIO_INTERFACE_NUM (AUDIO_SUPPORT_SPK + AUDIO_SUPPORT_MIC)
audio interface config
#define | AUDIO_INTERFACE_LEN ((0x08 + AUDIO_INTERFACE_NUM) + AUDIO_INTERFACE_NUM * 0x22)
#define | AUDIO_MIC_INTERFACE 0x01
#define | AUDIO_SPK_INTERFACE 0x02
#define | AUDIO_INPUT_TERMINAL_SIZE 0x0C
audio interface descriptor size define
#define | AUDIO_OUTPUT_TERMINAL_SIZE 0x09
#define | AUDIO_FEATURE_UNIT_SIZE 0x0D
#define | AUDIO_MIC_INPUT_TERMINAL_ID 0x01
audio terminal id define
#define | AUDIO_MIC_FEATURE_UNIT_ID 0x02
#define | AUDIO_MIC_OUTPUT_TERMINAL_ID 0x03
#define | AUDIO_SPK_INPUT_TERMINAL_ID 0x04
#define | AUDIO_SPK_FEATURE_UNIT_ID 0x05
#define | AUDIO_SPK_OUTPUT_TERMINAL_ID 0x06
#define | AUDIO_MIC_INTERFACE_NUMBER 0x01
audio interface number
#define | AUDIO_SPK_INTERFACE_NUMBER 0x02
#define | AT32_AUDIO_FREQ_16K 16000
audio support freq
#define | AT32_AUDIO_FREQ_48K 48000
#define | AUDIO_MIC_FREQ_SIZE (AUDIO_SUPPORT_FREQ)
audio microphone freq and channel config
#define | AUDIO_MIC_CHR AUDIO_MIC_CHANEL_NUM
#define | AUDIO_MIC_BITW (AUDIO_MIC_DEFAULT_BITW)
#define | AUDIO_SPK_FREQ_SIZE (AUDIO_SUPPORT_FREQ)
audio speaker freq and channel config
#define | AUDIO_SPK_CHR AUDIO_SPK_CHANEL_NUM
#define | AUDIO_SPK_BITW (AUDIO_SPK_DEFAULT_BITW)
#define | AUDIO_BINTERVAL_TIME 0x01
#define | USBD_AUDIO_CONFIG_DESC_SIZE
#define | SAMPLE_FREQ(frq)
#define | MCU_ID1 (0x1FFFF7E8)
#define | MCU_ID2 (0x1FFFF7EC)
#define | MCU_ID3 (0x1FFFF7F0)

Variables

usbd_desc_handler audio_desc_handler
device descriptor handler structure

Detailed Description

Macro Definition Documentation

◆ AT32_AUDIO_FREQ_16K

#define AT32_AUDIO_FREQ_16K 16000

audio support freq

Definition at line 187 of file audio_desc.h.

◆ AT32_AUDIO_FREQ_48K

#define AT32_AUDIO_FREQ_48K 48000

Definition at line 188 of file audio_desc.h.

◆ AUDIO_AC_DESCRIPTOR_UNDEFINED

#define AUDIO_AC_DESCRIPTOR_UNDEFINED 0x00

audio class-specific ac interface descriptor subtypes

Definition at line 89 of file audio_desc.h.

◆ AUDIO_AC_EXTENSION_UNIT

#define AUDIO_AC_EXTENSION_UNIT 0x08

Definition at line 97 of file audio_desc.h.

◆ AUDIO_AC_FEATURE_UNIT

#define AUDIO_AC_FEATURE_UNIT 0x06

Definition at line 95 of file audio_desc.h.

◆ AUDIO_AC_HEADER

#define AUDIO_AC_HEADER 0x01

Definition at line 90 of file audio_desc.h.

◆ AUDIO_AC_INPUT_TERMINAL

#define AUDIO_AC_INPUT_TERMINAL 0x02

Definition at line 91 of file audio_desc.h.

◆ AUDIO_AC_MIXER_UNIT

#define AUDIO_AC_MIXER_UNIT 0x04

Definition at line 93 of file audio_desc.h.

◆ AUDIO_AC_OUTPUT_TERMINAL

#define AUDIO_AC_OUTPUT_TERMINAL 0x03

Definition at line 92 of file audio_desc.h.

◆ AUDIO_AC_PROCESSING_UNIT

#define AUDIO_AC_PROCESSING_UNIT 0x07

Definition at line 96 of file audio_desc.h.

◆ AUDIO_AC_SELECTOR_UNIT

#define AUDIO_AC_SELECTOR_UNIT 0x05

Definition at line 94 of file audio_desc.h.

◆ AUDIO_AS_DESCRIPTOR_UNDEFINED

#define AUDIO_AS_DESCRIPTOR_UNDEFINED 0x00

audio class-specific as interface descriptor subtypes

Definition at line 102 of file audio_desc.h.

◆ AUDIO_AS_FORMAT_SPECIFIC

#define AUDIO_AS_FORMAT_SPECIFIC 0x03

Definition at line 105 of file audio_desc.h.

◆ AUDIO_AS_FORMAT_TYPE

#define AUDIO_AS_FORMAT_TYPE 0x02

Definition at line 104 of file audio_desc.h.

◆ AUDIO_AS_GENERAL

#define AUDIO_AS_GENERAL 0x01

Definition at line 103 of file audio_desc.h.

◆ AUDIO_BCD_NUM

#define AUDIO_BCD_NUM 0x0100

Definition at line 50 of file audio_desc.h.

◆ AUDIO_BINTERVAL_TIME

#define AUDIO_BINTERVAL_TIME 0x01

Definition at line 204 of file audio_desc.h.

◆ AUDIO_CS_CONFIGURATION

#define AUDIO_CS_CONFIGURATION 0x22

Definition at line 77 of file audio_desc.h.

◆ AUDIO_CS_DEVICE

#define AUDIO_CS_DEVICE 0x21

Definition at line 78 of file audio_desc.h.

◆ AUDIO_CS_ENDPOINT

#define AUDIO_CS_ENDPOINT 0x25

Definition at line 75 of file audio_desc.h.

◆ AUDIO_CS_INTERFACE

#define AUDIO_CS_INTERFACE 0x24

audio class-specific descriptor types

Definition at line 74 of file audio_desc.h.

◆ AUDIO_CS_STRING

#define AUDIO_CS_STRING 0x23

Definition at line 76 of file audio_desc.h.

◆ AUDIO_CS_UNDEFINED

#define AUDIO_CS_UNDEFINED 0x20

Definition at line 79 of file audio_desc.h.

◆ AUDIO_FEATURE_UNIT_SIZE

#define AUDIO_FEATURE_UNIT_SIZE 0x0D

Definition at line 162 of file audio_desc.h.

◆ AUDIO_FORMAT_TYPE_I

#define AUDIO_FORMAT_TYPE_I 0x01

audio format type 1

Definition at line 147 of file audio_desc.h.

◆ AUDIO_FU_BASS_CONTROL

#define AUDIO_FU_BASS_CONTROL 0x03

Definition at line 129 of file audio_desc.h.

◆ AUDIO_FU_CONTROL_UNDEFINED

#define AUDIO_FU_CONTROL_UNDEFINED 0x00

audio feature unit control selectors

Definition at line 126 of file audio_desc.h.

◆ AUDIO_FU_MID_CONTROL

#define AUDIO_FU_MID_CONTROL 0x04

Definition at line 130 of file audio_desc.h.

◆ AUDIO_FU_MUTE_CONTROL

#define AUDIO_FU_MUTE_CONTROL 0x01

Definition at line 127 of file audio_desc.h.

◆ AUDIO_FU_TREBLE_CONTROL

#define AUDIO_FU_TREBLE_CONTROL 0x05

Definition at line 131 of file audio_desc.h.

◆ AUDIO_FU_VOLUME_CONTROL

#define AUDIO_FU_VOLUME_CONTROL 0x02

Definition at line 128 of file audio_desc.h.

◆ AUDIO_INPUT_TERMINAL_MICROPHONE

#define AUDIO_INPUT_TERMINAL_MICROPHONE 0x0201

Definition at line 140 of file audio_desc.h.

◆ AUDIO_INPUT_TERMINAL_SIZE

#define AUDIO_INPUT_TERMINAL_SIZE 0x0C

audio interface descriptor size define

Definition at line 160 of file audio_desc.h.

◆ AUDIO_INPUT_TERMINAL_UNDEFINED

#define AUDIO_INPUT_TERMINAL_UNDEFINED 0x0200

Definition at line 139 of file audio_desc.h.

◆ AUDIO_INTERFACE_LEN

#define AUDIO_INTERFACE_LEN ((0x08 + AUDIO_INTERFACE_NUM) + AUDIO_INTERFACE_NUM * 0x22)

Definition at line 153 of file audio_desc.h.

◆ AUDIO_INTERFACE_NUM

#define AUDIO_INTERFACE_NUM (AUDIO_SUPPORT_SPK + AUDIO_SUPPORT_MIC)

audio interface config

Definition at line 152 of file audio_desc.h.

◆ AUDIO_MIC_BITW

#define AUDIO_MIC_BITW (AUDIO_MIC_DEFAULT_BITW)

Definition at line 195 of file audio_desc.h.

◆ AUDIO_MIC_CHR

#define AUDIO_MIC_CHR AUDIO_MIC_CHANEL_NUM

Definition at line 194 of file audio_desc.h.

◆ AUDIO_MIC_FEATURE_UNIT_ID

#define AUDIO_MIC_FEATURE_UNIT_ID 0x02

Definition at line 168 of file audio_desc.h.

Referenced by audio_req_get_cur(), audio_req_get_cur(), audio_req_get_max(), audio_req_get_max(), audio_req_get_min(), audio_req_get_min(), audio_req_get_res(), and audio_req_get_res().

◆ AUDIO_MIC_FREQ_SIZE

#define AUDIO_MIC_FREQ_SIZE (AUDIO_SUPPORT_FREQ)

audio microphone freq and channel config

Definition at line 193 of file audio_desc.h.

◆ AUDIO_MIC_INPUT_TERMINAL_ID

#define AUDIO_MIC_INPUT_TERMINAL_ID 0x01

audio terminal id define

Definition at line 167 of file audio_desc.h.

◆ AUDIO_MIC_INTERFACE

#define AUDIO_MIC_INTERFACE 0x01

Definition at line 154 of file audio_desc.h.

◆ AUDIO_MIC_INTERFACE_NUMBER

#define AUDIO_MIC_INTERFACE_NUMBER 0x01

audio interface number

Definition at line 177 of file audio_desc.h.

Referenced by audio_get_interface(), audio_get_interface(), audio_set_interface(), and audio_set_interface().

◆ AUDIO_MIC_OUTPUT_TERMINAL_ID

#define AUDIO_MIC_OUTPUT_TERMINAL_ID 0x03

Definition at line 169 of file audio_desc.h.

◆ AUDIO_OUTPUT_TERMINAL_SIZE

#define AUDIO_OUTPUT_TERMINAL_SIZE 0x09

Definition at line 161 of file audio_desc.h.

◆ AUDIO_OUTPUT_TERMINAL_SPEAKER

#define AUDIO_OUTPUT_TERMINAL_SPEAKER 0x0301

Definition at line 142 of file audio_desc.h.

◆ AUDIO_OUTPUT_TERMINAL_UNDEFINED

#define AUDIO_OUTPUT_TERMINAL_UNDEFINED 0x0300

Definition at line 141 of file audio_desc.h.

◆ AUDIO_PROTOCOL_UNDEFINED

#define AUDIO_PROTOCOL_UNDEFINED 0x00

audio interface protocol codes

Definition at line 84 of file audio_desc.h.

◆ AUDIO_REQ_GET_CUR

#define AUDIO_REQ_GET_CUR 0x81

Definition at line 112 of file audio_desc.h.

Referenced by class_audio_setup_handler(), and class_setup_handler().

◆ AUDIO_REQ_GET_MAX

#define AUDIO_REQ_GET_MAX 0x83

Definition at line 116 of file audio_desc.h.

Referenced by class_audio_setup_handler(), and class_setup_handler().

◆ AUDIO_REQ_GET_MEM

#define AUDIO_REQ_GET_MEM 0x85

Definition at line 120 of file audio_desc.h.

◆ AUDIO_REQ_GET_MIN

#define AUDIO_REQ_GET_MIN 0x82

Definition at line 114 of file audio_desc.h.

Referenced by class_audio_setup_handler(), and class_setup_handler().

◆ AUDIO_REQ_GET_RES

#define AUDIO_REQ_GET_RES 0x84

Definition at line 118 of file audio_desc.h.

Referenced by class_audio_setup_handler(), and class_setup_handler().

◆ AUDIO_REQ_GET_STAT

#define AUDIO_REQ_GET_STAT 0xFF

Definition at line 121 of file audio_desc.h.

◆ AUDIO_REQ_SET_CUR

#define AUDIO_REQ_SET_CUR 0x01

Definition at line 111 of file audio_desc.h.

Referenced by audio_req_set_cur(), audio_req_set_cur(), class_audio_setup_handler(), class_ept0_rx_handler(), class_ept0_rx_handler(), and class_setup_handler().

◆ AUDIO_REQ_SET_MAX

#define AUDIO_REQ_SET_MAX 0x03

Definition at line 115 of file audio_desc.h.

◆ AUDIO_REQ_SET_MEM

#define AUDIO_REQ_SET_MEM 0x05

Definition at line 119 of file audio_desc.h.

◆ AUDIO_REQ_SET_MIN

#define AUDIO_REQ_SET_MIN 0x02

Definition at line 113 of file audio_desc.h.

◆ AUDIO_REQ_SET_RES

#define AUDIO_REQ_SET_RES 0x04

Definition at line 117 of file audio_desc.h.

◆ AUDIO_REQUEST_CODE_UNDEFINED

#define AUDIO_REQUEST_CODE_UNDEFINED 0x00

audio class-specific request codes

Definition at line 110 of file audio_desc.h.

◆ AUDIO_SPK_BITW

#define AUDIO_SPK_BITW (AUDIO_SPK_DEFAULT_BITW)

Definition at line 202 of file audio_desc.h.

◆ AUDIO_SPK_CHR

#define AUDIO_SPK_CHR AUDIO_SPK_CHANEL_NUM

Definition at line 201 of file audio_desc.h.

◆ AUDIO_SPK_FEATURE_UNIT_ID

#define AUDIO_SPK_FEATURE_UNIT_ID 0x05

Definition at line 171 of file audio_desc.h.

Referenced by audio_req_get_cur(), audio_req_get_cur(), audio_req_get_max(), audio_req_get_max(), audio_req_get_min(), audio_req_get_min(), audio_req_get_res(), audio_req_get_res(), class_ept0_rx_handler(), and class_ept0_rx_handler().

◆ AUDIO_SPK_FREQ_SIZE

#define AUDIO_SPK_FREQ_SIZE (AUDIO_SUPPORT_FREQ)

audio speaker freq and channel config

Definition at line 200 of file audio_desc.h.

◆ AUDIO_SPK_INPUT_TERMINAL_ID

#define AUDIO_SPK_INPUT_TERMINAL_ID 0x04

Definition at line 170 of file audio_desc.h.

◆ AUDIO_SPK_INTERFACE

#define AUDIO_SPK_INTERFACE 0x02

Definition at line 155 of file audio_desc.h.

◆ AUDIO_SPK_INTERFACE_NUMBER

#define AUDIO_SPK_INTERFACE_NUMBER 0x02

Definition at line 179 of file audio_desc.h.

Referenced by audio_get_interface(), audio_get_interface(), audio_set_interface(), and audio_set_interface().

◆ AUDIO_SPK_OUTPUT_TERMINAL_ID

#define AUDIO_SPK_OUTPUT_TERMINAL_ID 0x06

Definition at line 172 of file audio_desc.h.

◆ AUDIO_SUBCLASS_AUDIOCONTROL

#define AUDIO_SUBCLASS_AUDIOCONTROL 0x01

Definition at line 67 of file audio_desc.h.

◆ AUDIO_SUBCLASS_AUDIOSTREAMING

#define AUDIO_SUBCLASS_AUDIOSTREAMING 0x02

Definition at line 68 of file audio_desc.h.

◆ AUDIO_SUBCLASS_MIDISTREMING

#define AUDIO_SUBCLASS_MIDISTREMING 0x03

Definition at line 69 of file audio_desc.h.

◆ AUDIO_SUBCLASS_UNDEFINED

#define AUDIO_SUBCLASS_UNDEFINED 0x00

audio interface subclass codes

Definition at line 66 of file audio_desc.h.

◆ AUDIO_TERMINAL_TYPE_STREAMING

#define AUDIO_TERMINAL_TYPE_STREAMING 0x0101

Definition at line 137 of file audio_desc.h.

◆ AUDIO_TERMINAL_TYPE_UNDEFINED

#define AUDIO_TERMINAL_TYPE_UNDEFINED 0x0100

audio terminal type

Definition at line 136 of file audio_desc.h.

◆ AUDIO_TERMINAL_TYPE_VENDOR

#define AUDIO_TERMINAL_TYPE_VENDOR 0x01FF

Definition at line 138 of file audio_desc.h.

◆ MCU_ID1

#define MCU_ID1 (0x1FFFF7E8)

Definition at line 214 of file audio_desc.h.

Referenced by get_serial_num(), get_serial_num(), get_serial_num(), get_serial_num(), get_serial_num(), get_serial_num(), get_serial_num(), get_serial_num(), get_serial_num(), get_serial_num(), get_serial_num(), and get_serial_num().

◆ MCU_ID2

#define MCU_ID2 (0x1FFFF7EC)

Definition at line 215 of file audio_desc.h.

Referenced by get_serial_num(), get_serial_num(), get_serial_num(), get_serial_num(), get_serial_num(), get_serial_num(), get_serial_num(), get_serial_num(), get_serial_num(), get_serial_num(), get_serial_num(), and get_serial_num().

◆ MCU_ID3

#define MCU_ID3 (0x1FFFF7F0)

Definition at line 216 of file audio_desc.h.

Referenced by get_serial_num(), get_serial_num(), get_serial_num(), get_serial_num(), get_serial_num(), get_serial_num(), get_serial_num(), get_serial_num(), get_serial_num(), get_serial_num(), get_serial_num(), and get_serial_num().

◆ SAMPLE_FREQ

#define SAMPLE_FREQ ( frq )
Value:
(uint8_t)(frq), (uint8_t)((frq >> 8)), (uint8_t)((frq >> 16))

Definition at line 212 of file audio_desc.h.

◆ USBD_AUDIO_CONFIG_DESC_SIZE

#define USBD_AUDIO_CONFIG_DESC_SIZE
Value:
( 0x12 + AUDIO_INTERFACE_LEN + \
+ (0x31 + AUDIO_SPK_FREQ_SIZE * 3) \
+ (0x31 + AUDIO_MIC_FREQ_SIZE * 3) \
+ (9 * AUDIO_SUPPORT_FEEDBACK) \
)
AUDIO_MIC_FREQ_SIZE
#define AUDIO_MIC_FREQ_SIZE
audio microphone freq and channel config
Definition audio_desc.h:193
AUDIO_SPK_FREQ_SIZE
#define AUDIO_SPK_FREQ_SIZE
audio speaker freq and channel config
Definition audio_desc.h:200
AUDIO_INTERFACE_LEN
#define AUDIO_INTERFACE_LEN
Definition audio_desc.h:153
AUDIO_SUPPORT_FEEDBACK
#define AUDIO_SUPPORT_FEEDBACK
Definition audio/audio_conf.h:48

Definition at line 207 of file audio_desc.h.

◆ USBD_AUDIO_DESC_CONFIGURATION_STRING

#define USBD_AUDIO_DESC_CONFIGURATION_STRING "Audio Config"

Definition at line 60 of file audio_desc.h.

Referenced by get_device_config_string().

◆ USBD_AUDIO_DESC_INTERFACE_STRING

#define USBD_AUDIO_DESC_INTERFACE_STRING "Audio Interface"

Definition at line 61 of file audio_desc.h.

Referenced by get_device_interface_string().

◆ USBD_AUDIO_DESC_MANUFACTURER_STRING

#define USBD_AUDIO_DESC_MANUFACTURER_STRING "Artery"

Definition at line 58 of file audio_desc.h.

Referenced by get_device_manufacturer_string().

◆ USBD_AUDIO_DESC_PRODUCT_STRING

#define USBD_AUDIO_DESC_PRODUCT_STRING "AT32 Audio"

Definition at line 59 of file audio_desc.h.

Referenced by get_device_product_string().

◆ USBD_AUDIO_PRODUCT_ID

#define USBD_AUDIO_PRODUCT_ID 0x5730

Definition at line 53 of file audio_desc.h.

◆ USBD_AUDIO_SIZ_STRING_LANGID

#define USBD_AUDIO_SIZ_STRING_LANGID 4

Definition at line 55 of file audio_desc.h.

◆ USBD_AUDIO_SIZ_STRING_SERIAL

#define USBD_AUDIO_SIZ_STRING_SERIAL 0x1A

Definition at line 56 of file audio_desc.h.

◆ USBD_AUDIO_VENDOR_ID

#define USBD_AUDIO_VENDOR_ID 0x2E3C

Definition at line 52 of file audio_desc.h.

Variable Documentation

◆ audio_desc_handler

usbd_desc_handler audio_desc_handler
extern

device descriptor handler structure

Definition at line 64 of file audio_desc.c.

Referenced by main().


AT32F413 Firmwary Library: USB_audio_hid_class

Topics
USB_audio_hid_class
AT32F413_middlewares_usbd_class

usb device class audio hid demo More...

Topics

USB_device_audio_hid_config_definition
USB_audio_hid_class_private_functions
USB_audio_hid_class_definition

Detailed Description

usb device class audio hid demo


AT32F413 Firmwary Library: USB_device_audio_hid_config_definition

Macros
USB_device_audio_hid_config_definition
AT32F413_middlewares_usbd_class » USB_audio_hid_class

Macros

#define | AUDIO_SUPPORT_SPK 1
#define | AUDIO_SUPPORT_MIC 1
#define | AUDIO_SUPPORT_FEEDBACK 1
#define | AUDIO_SUPPORT_FREQ_16K 0
#define | AUDIO_SUPPORT_FREQ_48K 1
#define | AUDIO_SUPPORT_FREQ
#define | AUDIO_FREQ_16K 16000
#define | AUDIO_FREQ_48K 48000
#define | AUDIO_BITW_16 16
#define | AUDIO_MIC_CHANEL_NUM 2
#define | AUDIO_MIC_DEFAULT_BITW AUDIO_BITW_16
#define | AUDIO_SPK_CHANEL_NUM 2
#define | AUDIO_SPK_DEFAULT_BITW AUDIO_BITW_16
#define | AUDIO_SUPPORT_MAX_FREQ 48
#define | AUDIO_DEFAULT_FREQ AUDIO_FREQ_48K
#define | AUDIO_DEFAULT_BITW AUDIO_BITW_16

Detailed Description

Macro Definition Documentation

◆ AUDIO_BITW_16

#define AUDIO_BITW_16 16

Definition at line 60 of file audio_hid/audio_conf.h.

◆ AUDIO_DEFAULT_BITW

#define AUDIO_DEFAULT_BITW AUDIO_BITW_16

Definition at line 71 of file audio_hid/audio_conf.h.

◆ AUDIO_DEFAULT_FREQ

#define AUDIO_DEFAULT_FREQ AUDIO_FREQ_48K

Definition at line 70 of file audio_hid/audio_conf.h.

◆ AUDIO_FREQ_16K

#define AUDIO_FREQ_16K 16000

Definition at line 58 of file audio_hid/audio_conf.h.

◆ AUDIO_FREQ_48K

#define AUDIO_FREQ_48K 48000

Definition at line 59 of file audio_hid/audio_conf.h.

◆ AUDIO_MIC_CHANEL_NUM

#define AUDIO_MIC_CHANEL_NUM 2

Definition at line 62 of file audio_hid/audio_conf.h.

◆ AUDIO_MIC_DEFAULT_BITW

#define AUDIO_MIC_DEFAULT_BITW AUDIO_BITW_16

Definition at line 63 of file audio_hid/audio_conf.h.

◆ AUDIO_SPK_CHANEL_NUM

#define AUDIO_SPK_CHANEL_NUM 2

Definition at line 65 of file audio_hid/audio_conf.h.

◆ AUDIO_SPK_DEFAULT_BITW

#define AUDIO_SPK_DEFAULT_BITW AUDIO_BITW_16

Definition at line 66 of file audio_hid/audio_conf.h.

◆ AUDIO_SUPPORT_FEEDBACK

#define AUDIO_SUPPORT_FEEDBACK 1

Definition at line 48 of file audio_hid/audio_conf.h.

◆ AUDIO_SUPPORT_FREQ

#define AUDIO_SUPPORT_FREQ
Value:
(AUDIO_SUPPORT_FREQ_16K + \
AUDIO_SUPPORT_FREQ_48K \
)
AUDIO_SUPPORT_FREQ_48K
#define AUDIO_SUPPORT_FREQ_48K
Definition audio_hid/audio_conf.h:51
AUDIO_SUPPORT_FREQ_16K
#define AUDIO_SUPPORT_FREQ_16K
Definition audio_hid/audio_conf.h:50

Definition at line 54 of file audio_hid/audio_conf.h.

◆ AUDIO_SUPPORT_FREQ_16K

#define AUDIO_SUPPORT_FREQ_16K 0

Definition at line 50 of file audio_hid/audio_conf.h.

◆ AUDIO_SUPPORT_FREQ_48K

#define AUDIO_SUPPORT_FREQ_48K 1

Definition at line 51 of file audio_hid/audio_conf.h.

◆ AUDIO_SUPPORT_MAX_FREQ

#define AUDIO_SUPPORT_MAX_FREQ 48

Definition at line 69 of file audio_hid/audio_conf.h.

◆ AUDIO_SUPPORT_MIC

#define AUDIO_SUPPORT_MIC 1

Definition at line 47 of file audio_hid/audio_conf.h.

◆ AUDIO_SUPPORT_SPK

#define AUDIO_SUPPORT_SPK 1

Definition at line 46 of file audio_hid/audio_conf.h.


AT32F413 Firmwary Library: USB_audio_hid_class_private_functions

Functions | Variables
USB_audio_hid_class_private_functions
AT32F413_middlewares_usbd_class » USB_audio_hid_class

Functions

static usb_sts_type | class_init_handler (void *udev)
initialize usb custom hid endpoint
static usb_sts_type | class_clear_handler (void *udev)
clear endpoint or other state
static usb_sts_type | class_setup_handler (void *udev, usb_setup_type *setup)
usb device class setup request handler
static usb_sts_type | class_ept0_tx_handler (void *udev)
usb device endpoint 0 in status stage complete
static usb_sts_type | class_ept0_rx_handler (void *udev)
usb device endpoint 0 out status stage complete
static usb_sts_type | class_in_handler (void *udev, uint8_t ept_num)
usb device transmision complete handler
static usb_sts_type | class_out_handler (void *udev, uint8_t ept_num)
usb device endpoint receive data
static usb_sts_type | class_sof_handler (void *udev)
usb device sof handler
static usb_sts_type | class_event_handler (void *udev, usbd_event_type event)
usb device event handler
static void | audio_req_get_cur (void *udev, usb_setup_type *setup)
usb audio request get cur
static void | audio_req_set_cur (void *udev, usb_setup_type *setup)
usb audio request set cur
static void | audio_req_get_min (void *udev, usb_setup_type *setup)
usb audio request get min
static void | audio_req_get_max (void *udev, usb_setup_type *setup)
usb audio request get max
static void | audio_req_get_res (void *udev, usb_setup_type *setup)
usb audio request get res
static void | audio_get_interface (void *udev, usb_setup_type *setup)
usb audio get interface
static void | audio_set_interface (void *udev, usb_setup_type *setup)
usb audio set interface
static void | usb_hid_buf_process (void *udev, uint8_t *report, uint16_t len)
usb device report function
usb_sts_type | class_audio_setup_handler (void *udev, usb_setup_type *setup)
usb device class setup request handler
usb_sts_type | class_hid_setup_handler (void *udev, usb_setup_type *setup)
usb device class setup request handler
usb_sts_type | audio_hid_class_send_report (void *udev, uint8_t *report, uint16_t len)
usb device class send report

Variables

usb_audio_hid_type audio_hid_struct = {0, 0, 0, 0, 0, 0x1400, 0, 0, 0, {0x0000, 0x1400, 0x33}, {0x0000, 0x1400, 0x33}, 0, 0}
usbd_class_handler audio_hid_class_handler

Detailed Description

Function Documentation

◆ audio_get_interface()

static void audio_get_interface | ( | void * | udev,
 |  | usb_setup_type * | setup )
 static

usb audio get interface

Parameters
udev | usb device core handler type
setup | setup class
Return values
none

Definition at line 870 of file audio_hid_class.c.

Referenced by class_audio_setup_handler().

◆ audio_hid_class_send_report()

usb_sts_type audio_hid_class_send_report | ( | void * | udev,
 |  | uint8_t * | report,
 |  | uint16_t | len )

usb device class send report

Parameters
udev | to the structure of usbd_core_type
report | report buffer
len | report length
Return values
status of usb_sts_type

Definition at line 895 of file audio_hid_class.c.

Referenced by main().

◆ audio_req_get_cur()

static void audio_req_get_cur | ( | void * | udev,
 |  | usb_setup_type * | setup )
 static

usb audio request get cur

Parameters
udev | usb device core handler type
setup | setup class
Return values
none

Definition at line 580 of file audio_hid_class.c.

Referenced by class_audio_setup_handler().

◆ audio_req_get_max()

static void audio_req_get_max | ( | void * | udev,
 |  | usb_setup_type * | setup )
 static

usb audio request get max

Parameters
udev | usb device core handler type
setup | setup class
Return values
none

Definition at line 757 of file audio_hid_class.c.

Referenced by class_audio_setup_handler().

◆ audio_req_get_min()

static void audio_req_get_min | ( | void * | udev,
 |  | usb_setup_type * | setup )
 static

usb audio request get min

Parameters
udev | usb device core handler type
setup | setup class
Return values
none

Definition at line 719 of file audio_hid_class.c.

Referenced by class_audio_setup_handler().

◆ audio_req_get_res()

static void audio_req_get_res | ( | void * | udev,
 |  | usb_setup_type * | setup )
 static

usb audio request get res

Parameters
udev | usb device core handler type
setup | setup class
Return values
none

Definition at line 795 of file audio_hid_class.c.

Referenced by class_audio_setup_handler().

◆ audio_req_set_cur()

static void audio_req_set_cur | ( | void * | udev,
 |  | usb_setup_type * | setup )
 static

usb audio request set cur

Parameters
udev | usb device core handler type
setup | setup class
Return values
none

Definition at line 662 of file audio_hid_class.c.

Referenced by class_audio_setup_handler().

◆ audio_set_interface()

static void audio_set_interface | ( | void * | udev,
 |  | usb_setup_type * | setup )
 static

usb audio set interface

Parameters
udev | usb device core handler type
setup | setup class
Return values
none

Definition at line 833 of file audio_hid_class.c.

Referenced by class_audio_setup_handler().

◆ class_audio_setup_handler()

usb_sts_type class_audio_setup_handler | ( | void * | udev,
 |  | usb_setup_type * | setup )

usb device class setup request handler

Parameters
udev | usb device core handler type
setup | setup packet
Return values
status of usb_sts_type

Definition at line 158 of file audio_hid_class.c.

Referenced by class_setup_handler().

◆ class_clear_handler()

static usb_sts_type class_clear_handler ( void * udev )
static

clear endpoint or other state

Parameters
udev usb device core handler type
Return values
status of usb_sts_type

Definition at line 127 of file audio_hid_class.c.

◆ class_ept0_rx_handler()

static usb_sts_type class_ept0_rx_handler ( void * udev )
static

usb device endpoint 0 out status stage complete

Parameters
udev usb device core handler type
Return values
status of usb_sts_type

Definition at line 373 of file audio_hid_class.c.

◆ class_ept0_tx_handler()

usb_sts_type class_ept0_tx_handler ( void * udev )
static

usb device endpoint 0 in status stage complete

Parameters
udev usb device core handler type
Return values
status of usb_sts_type

Definition at line 359 of file audio_hid_class.c.

◆ class_event_handler()

static usb_sts_type class_event_handler | ( | void * | udev,
 |  | usbd_event_type | event )
 static

usb device event handler

Parameters
udev | usb device core handler type
event | usb device event
Return values
status of usb_sts_type

Definition at line 544 of file audio_hid_class.c.

◆ class_hid_setup_handler()

usb_sts_type class_hid_setup_handler | ( | void * | udev,
 |  | usb_setup_type * | setup )

usb device class setup request handler

Parameters
udev | usb device core handler type
setup | setup packet
Return values
status of usb_sts_type

Definition at line 244 of file audio_hid_class.c.

Referenced by class_setup_handler().

◆ class_in_handler()

usb_sts_type class_in_handler | ( | void * | udev,
 |  | uint8_t | ept_num )
 static

usb device transmision complete handler

Parameters
udev | usb device core handler type
ept_num | endpoint number
Return values
status of usb_sts_type

Definition at line 459 of file audio_hid_class.c.

◆ class_init_handler()

static usb_sts_type class_init_handler ( void * udev )
static

initialize usb custom hid endpoint

Parameters
udev usb device core handler type
Return values
status of usb_sts_type

Definition at line 82 of file audio_hid_class.c.

◆ class_out_handler()

static usb_sts_type class_out_handler | ( | void * | udev,
 |  | uint8_t | ept_num )
 static

usb device endpoint receive data

Parameters
udev | usb device core handler type
ept_num | endpoint number
Return values
status of usb_sts_type

Definition at line 495 of file audio_hid_class.c.

◆ class_setup_handler()

usb_sts_type class_setup_handler | ( | void * | udev,
 |  | usb_setup_type * | setup )
 static

usb device class setup request handler

Parameters
udev | usb device core handler type
setup | setup packet
Return values
status of usb_sts_type

Definition at line 328 of file audio_hid_class.c.

◆ class_sof_handler()

static usb_sts_type class_sof_handler ( void * udev )
static

usb device sof handler

Parameters
udev usb device core handler type
Return values
status of usb_sts_type

Definition at line 529 of file audio_hid_class.c.

◆ usb_hid_buf_process()

static void usb_hid_buf_process | ( | void * | udev,
 |  | uint8_t * | report,
 |  | uint16_t | len )
 static

usb device report function

Parameters
udev | to the structure of usbd_core_type
report | report buffer
len | report length
Return values
none

Definition at line 914 of file audio_hid_class.c.

Referenced by class_ept0_rx_handler(), and class_out_handler().

Variable Documentation

◆ audio_hid_class_handler

usbd_class_handler audio_hid_class_handler
Initial value:
=
{
class_init_handler,
class_clear_handler,
class_setup_handler,
class_ept0_tx_handler,
class_ept0_rx_handler,
class_in_handler,
class_out_handler,
class_sof_handler,
class_event_handler,
&audio_hid_struct
}
class_sof_handler
static usb_sts_type class_sof_handler(void *udev)
usb device sof handler
Definition audio_hid_class.c:529
class_clear_handler
static usb_sts_type class_clear_handler(void *udev)
clear endpoint or other state
Definition audio_hid_class.c:127
class_ept0_rx_handler
static usb_sts_type class_ept0_rx_handler(void *udev)
usb device endpoint 0 out status stage complete
Definition audio_hid_class.c:373
class_event_handler
static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
usb device event handler
Definition audio_hid_class.c:544
class_setup_handler
static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
usb device class setup request handler
Definition audio_hid_class.c:328
class_init_handler
static usb_sts_type class_init_handler(void *udev)
initialize usb custom hid endpoint
Definition audio_hid_class.c:82
audio_hid_struct
usb_audio_hid_type audio_hid_struct
Definition audio_hid_class.c:61
class_ept0_tx_handler
static usb_sts_type class_ept0_tx_handler(void *udev)
usb device endpoint 0 in status stage complete
Definition audio_hid_class.c:359
class_out_handler
static usb_sts_type class_out_handler(void *udev, uint8_t ept_num)
usb device endpoint receive data
Definition audio_hid_class.c:495
class_in_handler
static usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
usb device transmision complete handler
Definition audio_hid_class.c:459

Definition at line 63 of file audio_hid_class.c.

Referenced by main().

◆ audio_hid_struct

usb_audio_hid_type audio_hid_struct = {0, 0, 0, 0, 0, 0x1400, 0, 0, 0, {0x0000, 0x1400, 0x33}, {0x0000, 0x1400, 0x33}, 0, 0}

Definition at line 61 of file audio_hid_class.c.


AT32F413 Firmwary Library: USB_audio_hid_class_definition

Data Structures | Macros | Functions | Variables
USB_audio_hid_class_definition
AT32F413_middlewares_usbd_class » USB_audio_hid_class

Data Structures

struct usb_audio_hid_type
usb audio control struct More...

Macros

#define | USBD_AUHID_AUDIO_MIC_IN_EPT 0x81
endpoint define
#define | USBD_AUHID_AUDIO_SPK_OUT_EPT 0x02
#define | USBD_AUHID_AUDIO_FEEDBACK_EPT 0x83
#define | USBD_AUHID_HID_IN_EPT 0x84
usb custom hid use endpoint define
#define | USBD_AUHID_HID_OUT_EPT 0x05
#define | USBD_AUHID_IN_MAXPACKET_SIZE 0x40
usb custom hid in and out max packet size define
#define | USBD_AUHID_OUT_MAXPACKET_SIZE 0x40
#define | AUDIO_REMAIN_SIZE 40
endpoint support max size
#define | AUDIO_MIC_IN_MAXPACKET_SIZE (AUDIO_SUPPORT_MAX_FREQ * AUDIO_MIC_CHANEL_NUM * (AUDIO_MIC_DEFAULT_BITW / 8) + AUDIO_REMAIN_SIZE)
#define | AUDIO_SPK_OUT_MAXPACKET_SIZE (AUDIO_SUPPORT_MAX_FREQ * AUDIO_SPK_CHANEL_NUM * (AUDIO_SPK_DEFAULT_BITW / 8) + AUDIO_REMAIN_SIZE)
#define | AUDIO_FEEDBACK_MAXPACKET_SIZE 0x3
#define | FEEDBACK_REFRESH_TIME 0x8
#define | AUDIO_REQ_CONTROL_INTERFACE 0x01
request type define
#define | AUDIO_REQ_CONTROL_ENDPOINT 0x02
#define | AUDIO_REQ_CONTROL_MASK 0x03
#define | AUDIO_MUTE_CONTROL 0x01
audio set cur type define
#define | AUDIO_MUTE_CONTROL 0x01
audio set cur type define
#define | AUDIO_VOLUME_CONTROL 0x02
#define | AUDIO_VOLUME_CONTROL 0x02
#define | AUDIO_FREQ_SET_CONTROL 0x03
#define | AUDIO_FREQ_SET_CONTROL 0x03
#define | AUDIO_SAMPLING_FREQ_CONTROL 0x01
#define | AUDIO_DESCRIPTOR_TYPE 0x21
audio descriptor type
#define | AUDIO_DESCRIPTOR_SIZE 0x09

Functions

usb_sts_type audio_hid_class_send_report (void *udev, uint8_t *report, uint16_t len)
usb device class send report

Variables

usbd_class_handler audio_hid_class_handler

Detailed Description

Macro Definition Documentation

◆ AUDIO_DESCRIPTOR_SIZE

#define AUDIO_DESCRIPTOR_SIZE 0x09

Definition at line 107 of file audio_hid_class.h.

◆ AUDIO_DESCRIPTOR_TYPE

#define AUDIO_DESCRIPTOR_TYPE 0x21

audio descriptor type

Definition at line 106 of file audio_hid_class.h.

◆ AUDIO_FEEDBACK_MAXPACKET_SIZE

#define AUDIO_FEEDBACK_MAXPACKET_SIZE 0x3

Definition at line 75 of file audio_hid_class.h.

◆ AUDIO_FREQ_SET_CONTROL [1/2]

#define AUDIO_FREQ_SET_CONTROL 0x03

Definition at line 89 of file audio_hid_class.h.

◆ AUDIO_FREQ_SET_CONTROL [2/2]

#define AUDIO_FREQ_SET_CONTROL 0x03

Definition at line 89 of file audio_hid_class.h.

◆ AUDIO_MIC_IN_MAXPACKET_SIZE

#define AUDIO_MIC_IN_MAXPACKET_SIZE (AUDIO_SUPPORT_MAX_FREQ * AUDIO_MIC_CHANEL_NUM * (AUDIO_MIC_DEFAULT_BITW / 8) + AUDIO_REMAIN_SIZE)

Definition at line 73 of file audio_hid_class.h.

◆ AUDIO_MUTE_CONTROL [1/2]

#define AUDIO_MUTE_CONTROL 0x01

audio set cur type define

audio descriptor type

audio set cur type define

Definition at line 87 of file audio_hid_class.h.

◆ AUDIO_MUTE_CONTROL [2/2]

#define AUDIO_MUTE_CONTROL 0x01

audio set cur type define

audio descriptor type

audio set cur type define

Definition at line 87 of file audio_hid_class.h.

◆ AUDIO_REMAIN_SIZE

#define AUDIO_REMAIN_SIZE 40

endpoint support max size

Definition at line 72 of file audio_hid_class.h.

◆ AUDIO_REQ_CONTROL_ENDPOINT

#define AUDIO_REQ_CONTROL_ENDPOINT 0x02

Definition at line 81 of file audio_hid_class.h.

◆ AUDIO_REQ_CONTROL_INTERFACE

#define AUDIO_REQ_CONTROL_INTERFACE 0x01

request type define

Definition at line 80 of file audio_hid_class.h.

◆ AUDIO_REQ_CONTROL_MASK

#define AUDIO_REQ_CONTROL_MASK 0x03

Definition at line 82 of file audio_hid_class.h.

◆ AUDIO_SAMPLING_FREQ_CONTROL

#define AUDIO_SAMPLING_FREQ_CONTROL 0x01

Definition at line 90 of file audio_hid_class.h.

◆ AUDIO_SPK_OUT_MAXPACKET_SIZE

#define AUDIO_SPK_OUT_MAXPACKET_SIZE (AUDIO_SUPPORT_MAX_FREQ * AUDIO_SPK_CHANEL_NUM * (AUDIO_SPK_DEFAULT_BITW / 8) + AUDIO_REMAIN_SIZE)

Definition at line 74 of file audio_hid_class.h.

◆ AUDIO_VOLUME_CONTROL [1/2]

#define AUDIO_VOLUME_CONTROL 0x02

Definition at line 88 of file audio_hid_class.h.

◆ AUDIO_VOLUME_CONTROL [2/2]

#define AUDIO_VOLUME_CONTROL 0x02

Definition at line 88 of file audio_hid_class.h.

◆ FEEDBACK_REFRESH_TIME

#define FEEDBACK_REFRESH_TIME 0x8

Definition at line 76 of file audio_hid_class.h.

◆ USBD_AUHID_AUDIO_FEEDBACK_EPT

#define USBD_AUHID_AUDIO_FEEDBACK_EPT 0x83

Definition at line 55 of file audio_hid_class.h.

Referenced by audio_set_interface(), class_clear_handler(), class_in_handler(), and class_init_handler().

◆ USBD_AUHID_AUDIO_MIC_IN_EPT

#define USBD_AUHID_AUDIO_MIC_IN_EPT 0x81

endpoint define

Definition at line 53 of file audio_hid_class.h.

Referenced by audio_req_get_cur(), audio_set_interface(), class_clear_handler(), class_ept0_rx_handler(), class_in_handler(), and class_init_handler().

◆ USBD_AUHID_AUDIO_SPK_OUT_EPT

#define USBD_AUHID_AUDIO_SPK_OUT_EPT 0x02

Definition at line 54 of file audio_hid_class.h.

Referenced by audio_req_get_cur(), audio_set_interface(), class_clear_handler(), class_init_handler(), and class_out_handler().

◆ USBD_AUHID_HID_IN_EPT

#define USBD_AUHID_HID_IN_EPT 0x84

usb custom hid use endpoint define

Definition at line 60 of file audio_hid_class.h.

Referenced by audio_hid_class_send_report(), class_clear_handler(), class_in_handler(), class_init_handler(), and usb_hid_buf_process().

◆ USBD_AUHID_HID_OUT_EPT

#define USBD_AUHID_HID_OUT_EPT 0x05

Definition at line 61 of file audio_hid_class.h.

Referenced by class_clear_handler(), class_init_handler(), and class_out_handler().

◆ USBD_AUHID_IN_MAXPACKET_SIZE

#define USBD_AUHID_IN_MAXPACKET_SIZE 0x40

usb custom hid in and out max packet size define

Definition at line 66 of file audio_hid_class.h.

Referenced by class_init_handler(), and main().

◆ USBD_AUHID_OUT_MAXPACKET_SIZE

#define USBD_AUHID_OUT_MAXPACKET_SIZE 0x40

Definition at line 67 of file audio_hid_class.h.

Referenced by class_init_handler(), and class_out_handler().

Function Documentation

◆ audio_hid_class_send_report()

usb_sts_type audio_hid_class_send_report | ( | void * | udev,
 |  | uint8_t * | report,
 |  | uint16_t | len )

usb device class send report

Parameters
udev | to the structure of usbd_core_type
report | report buffer
len | report length
Return values
status of usb_sts_type

Definition at line 895 of file audio_hid_class.c.

Referenced by main().

Variable Documentation

◆ audio_hid_class_handler

usbd_class_handler audio_hid_class_handler
extern

Definition at line 63 of file audio_hid_class.c.

Referenced by main().


AT32F413 Firmwary Library: usb_audio_hid_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
usb_audio_hid_type Struct Reference
AT32F413_middlewares_usbd_class » USB_audio_hid_class » USB_audio_hid_class_definition

usb audio control struct More...

#include <audio_hid_class.h>

Data Fields

uint8_t | enpd
uint8_t | interface
uint8_t | request_no
uint8_t | spk_mute
uint8_t | mic_mute
uint16_t | spk_volume
uint16_t | mic_volume
uint32_t | spk_freq
uint32_t | mic_freq
uint16_t | spk_volume_limits [3]
uint16_t | mic_volume_limits [3]
uint8_t | audio_cmd
uint32_t | audio_cmd_len
uint32_t | spk_alt_setting
uint32_t | mic_alt_setting
uint8_t | g_audio_cur [64]
uint8_t | audio_spk_data [(48 *2 *(16/8)+40)]
uint8_t | audio_mic_data [(48 *2 *(16/8)+40)]
uint8_t | audio_feed_back [0x3+1]
uint32_t | hid_protocol
uint32_t | hid_set_idle
uint32_t | alt_setting
uint8_t | hid_set_report [64]
uint8_t | g_rxhid_buff [0x40]
uint8_t | g_txhid_buff [0x40]
uint8_t | hid_state

Detailed Description

usb audio control struct

Definition at line 112 of file audio_hid_class.h.

Field Documentation

◆ alt_setting

uint32_t usb_audio_hid_type::alt_setting

Definition at line 139 of file audio_hid_class.h.

Referenced by class_hid_setup_handler().

◆ audio_cmd

uint8_t usb_audio_hid_type::audio_cmd

Definition at line 126 of file audio_hid_class.h.

Referenced by audio_req_set_cur(), and class_ept0_rx_handler().

◆ audio_cmd_len

uint32_t usb_audio_hid_type::audio_cmd_len

Definition at line 127 of file audio_hid_class.h.

Referenced by audio_req_set_cur().

◆ audio_feed_back

uint8_t usb_audio_hid_type::audio_feed_back[0x3+1]

Definition at line 133 of file audio_hid_class.h.

Referenced by audio_set_interface(), and class_in_handler().

◆ audio_mic_data

uint8_t usb_audio_hid_type::audio_mic_data[(48 *2 *(16/8)+40)]

Definition at line 132 of file audio_hid_class.h.

Referenced by audio_set_interface(), and class_in_handler().

◆ audio_spk_data

uint8_t usb_audio_hid_type::audio_spk_data[(48 *2 *(16/8)+40)]

Definition at line 131 of file audio_hid_class.h.

Referenced by audio_set_interface(), class_init_handler(), and class_out_handler().

◆ enpd

uint8_t usb_audio_hid_type::enpd

Definition at line 114 of file audio_hid_class.h.

Referenced by audio_req_set_cur(), and class_ept0_rx_handler().

◆ g_audio_cur

uint8_t usb_audio_hid_type::g_audio_cur[64]

Definition at line 130 of file audio_hid_class.h.

Referenced by audio_req_get_cur(), audio_req_get_max(), audio_req_get_min(), audio_req_get_res(), audio_req_set_cur(), and class_ept0_rx_handler().

◆ g_rxhid_buff

uint8_t usb_audio_hid_type::g_rxhid_buff[0x40]

Definition at line 141 of file audio_hid_class.h.

Referenced by class_init_handler(), class_out_handler(), and usb_hid_buf_process().

◆ g_txhid_buff

uint8_t usb_audio_hid_type::g_txhid_buff[0x40]

Definition at line 142 of file audio_hid_class.h.

Referenced by usb_hid_buf_process().

◆ hid_protocol

uint32_t usb_audio_hid_type::hid_protocol

Definition at line 137 of file audio_hid_class.h.

Referenced by class_hid_setup_handler().

◆ hid_set_idle

uint32_t usb_audio_hid_type::hid_set_idle

Definition at line 138 of file audio_hid_class.h.

Referenced by class_hid_setup_handler().

◆ hid_set_report

uint8_t usb_audio_hid_type::hid_set_report[64]

Definition at line 140 of file audio_hid_class.h.

Referenced by class_ept0_rx_handler(), and class_hid_setup_handler().

◆ hid_state

uint8_t usb_audio_hid_type::hid_state

Definition at line 143 of file audio_hid_class.h.

Referenced by class_ept0_rx_handler(), and class_hid_setup_handler().

◆ interface

uint8_t usb_audio_hid_type::interface

Definition at line 115 of file audio_hid_class.h.

Referenced by audio_req_set_cur(), and class_ept0_rx_handler().

◆ mic_alt_setting

uint32_t usb_audio_hid_type::mic_alt_setting

Definition at line 129 of file audio_hid_class.h.

Referenced by audio_get_interface(), audio_set_interface(), and class_event_handler().

◆ mic_freq

uint32_t usb_audio_hid_type::mic_freq

Definition at line 122 of file audio_hid_class.h.

Referenced by audio_req_get_cur(), and class_ept0_rx_handler().

◆ mic_mute

uint8_t usb_audio_hid_type::mic_mute

Definition at line 118 of file audio_hid_class.h.

Referenced by audio_req_get_cur(), and class_ept0_rx_handler().

◆ mic_volume

uint16_t usb_audio_hid_type::mic_volume

Definition at line 120 of file audio_hid_class.h.

Referenced by audio_req_get_cur(), and class_ept0_rx_handler().

◆ mic_volume_limits

uint16_t usb_audio_hid_type::mic_volume_limits[3]

Definition at line 124 of file audio_hid_class.h.

Referenced by audio_req_get_max(), audio_req_get_min(), audio_req_get_res(), and class_ept0_rx_handler().

◆ request_no

uint8_t usb_audio_hid_type::request_no

Definition at line 116 of file audio_hid_class.h.

Referenced by audio_req_set_cur(), and class_ept0_rx_handler().

◆ spk_alt_setting

uint32_t usb_audio_hid_type::spk_alt_setting

Definition at line 128 of file audio_hid_class.h.

Referenced by audio_get_interface(), audio_set_interface(), and class_event_handler().

◆ spk_freq

uint32_t usb_audio_hid_type::spk_freq

Definition at line 121 of file audio_hid_class.h.

Referenced by audio_req_get_cur(), and class_ept0_rx_handler().

◆ spk_mute

uint8_t usb_audio_hid_type::spk_mute

Definition at line 117 of file audio_hid_class.h.

Referenced by audio_req_get_cur(), and class_ept0_rx_handler().

◆ spk_volume

uint16_t usb_audio_hid_type::spk_volume

Definition at line 119 of file audio_hid_class.h.

Referenced by audio_req_get_cur(), and class_ept0_rx_handler().

◆ spk_volume_limits

uint16_t usb_audio_hid_type::spk_volume_limits[3]

Definition at line 123 of file audio_hid_class.h.

Referenced by audio_req_get_max(), audio_req_get_min(), audio_req_get_res(), and class_ept0_rx_handler().

The documentation for this struct was generated from the following file:
  • audio_hid_class.h


AT32F413 Firmwary Library: USB_audio_hid_desc

Topics
USB_audio_hid_desc
AT32F413_middlewares_usbd_class

usb device audio hid descriptor More...

Topics

USB_audio_hid_desc_private_functions
USB_audio_hid_desc_definition

Detailed Description

usb device audio hid descriptor


AT32F413 Firmwary Library: USB_audio_hid_desc_private_functions

Functions | Variables
USB_audio_hid_desc_private_functions
AT32F413_middlewares_usbd_class » USB_audio_hid_desc

Functions

static usbd_desc_t * | get_device_descriptor (void)
get device descriptor
static usbd_desc_t * | get_device_qualifier (void)
get device qualifier
static usbd_desc_t * | get_device_configuration (void)
get config descriptor
static usbd_desc_t * | get_device_other_speed (void)
get other speed descriptor
static usbd_desc_t * | get_device_lang_id (void)
get lang id descriptor
static usbd_desc_t * | get_device_manufacturer_string (void)
get manufacturer descriptor
static usbd_desc_t * | get_device_product_string (void)
get product descriptor
static usbd_desc_t * | get_device_serial_string (void)
get serial descriptor
static usbd_desc_t * | get_device_interface_string (void)
get interface descriptor
static usbd_desc_t * | get_device_config_string (void)
get device config descriptor
static uint16_t | usbd_unicode_convert (uint8_t *string, uint8_t *unicode_buf)
standard usb unicode convert
static void | usbd_int_to_unicode (uint32_t value, uint8_t *pbuf, uint8_t len)
usb int convert to unicode
static void | get_serial_num (void)
usb get serial number

Variables

static ALIGNED_HEAD uint8_t g_usbd_desc_buffer[256] | ALIGNED_TAIL
usb device standard descriptor
usbd_desc_handler audio_hid_desc_handler
device descriptor handler structure
static usbd_desc_t | device_descriptor
static usbd_desc_t | config_descriptor
static usbd_desc_t | langid_descriptor
static usbd_desc_t | serial_descriptor
static usbd_desc_t | vp_desc

Detailed Description

Function Documentation

◆ get_device_config_string()

static usbd_desc_t * get_device_config_string ( void )
static

get device config descriptor

Parameters
none
Return values
usbd_desc

Definition at line 779 of file audio_hid_desc.c.

◆ get_device_configuration()

static usbd_desc_t * get_device_configuration ( void )
static

get config descriptor

Parameters
none
Return values
usbd_desc

Definition at line 701 of file audio_hid_desc.c.

◆ get_device_descriptor()

static usbd_desc_t * get_device_descriptor ( void )
static

get device descriptor

Parameters
none
Return values
usbd_desc

Definition at line 681 of file audio_hid_desc.c.

◆ get_device_interface_string()

static usbd_desc_t * get_device_interface_string ( void )
static

get interface descriptor

Parameters
none
Return values
usbd_desc

Definition at line 767 of file audio_hid_desc.c.

◆ get_device_lang_id()

static usbd_desc_t * get_device_lang_id ( void )
static

get lang id descriptor

Parameters
none
Return values
usbd_desc

Definition at line 721 of file audio_hid_desc.c.

◆ get_device_manufacturer_string()

static usbd_desc_t * get_device_manufacturer_string ( void )
static

get manufacturer descriptor

Parameters
none
Return values
usbd_desc

Definition at line 732 of file audio_hid_desc.c.

◆ get_device_other_speed()

static usbd_desc_t * get_device_other_speed ( void )
static

get other speed descriptor

Parameters
none
Return values
usbd_desc

Definition at line 711 of file audio_hid_desc.c.

◆ get_device_product_string()

static usbd_desc_t * get_device_product_string ( void )
static

get product descriptor

Parameters
none
Return values
usbd_desc

Definition at line 744 of file audio_hid_desc.c.

◆ get_device_qualifier()

static usbd_desc_t * get_device_qualifier ( void )
static

get device qualifier

Parameters
none
Return values
usbd_desc

Definition at line 691 of file audio_hid_desc.c.

◆ get_device_serial_string()

static usbd_desc_t * get_device_serial_string ( void )
static

get serial descriptor

Parameters
none
Return values
usbd_desc

Definition at line 756 of file audio_hid_desc.c.

◆ get_serial_num()

static void get_serial_num ( void )
static

usb get serial number

Parameters
none
Return values
none

Definition at line 659 of file audio_hid_desc.c.

Referenced by get_device_serial_string().

◆ usbd_int_to_unicode()

static void usbd_int_to_unicode | ( | uint32_t | value,
 |  | uint8_t * | pbuf,
 |  | uint8_t | len )
 static

usb int convert to unicode

Parameters
value | int value
pbus | unicode buffer
len | length
Return values
none

Definition at line 633 of file audio_hid_desc.c.

Referenced by get_serial_num().

◆ usbd_unicode_convert()

static uint16_t usbd_unicode_convert | ( | uint8_t * | string,
 |  | uint8_t * | unicode_buf )
 static

standard usb unicode convert

Parameters
string | source string
unicode_buf | unicode buffer
Return values
length

Definition at line 607 of file audio_hid_desc.c.

Referenced by get_device_config_string(), get_device_interface_string(), get_device_manufacturer_string(), and get_device_product_string().

Variable Documentation

◆ ALIGNED_TAIL

ALIGNED_HEAD uint8_t g_string_serial [ 0x1A ] ALIGNED_TAIL
static
Initial value:
=
{
USB_DEVICE_DESC_LEN,
USB_DESCIPTOR_TYPE_DEVICE,
0x00,
0x02,
0x00,
0x00,
0x00,
USB_MAX_EP0_SIZE,
LBYTE( 0x2E3C ),
HBYTE( 0x2E3C ),
LBYTE( 0x5555 ),
HBYTE( 0x5555 ),
0x00,
0x02,
USB_MFC_STRING,
USB_PRODUCT_STRING,
USB_SERIAL_STRING,
0x01
}
HBYTE
#define HBYTE(x)
Definition usb_std.h:271
USB_MAX_EP0_SIZE
#define USB_MAX_EP0_SIZE
endpoint 0 max size
Definition usb_std.h:248
USB_PRODUCT_STRING
#define USB_PRODUCT_STRING
Definition usb_std.h:105
LBYTE
#define LBYTE(x)
low byte and high byte define
Definition usb_std.h:270
USB_DEVICE_DESC_LEN
#define USB_DEVICE_DESC_LEN
Definition usb_std.h:156
USB_MFC_STRING
#define USB_MFC_STRING
Definition usb_std.h:104
USB_SERIAL_STRING
#define USB_SERIAL_STRING
Definition usb_std.h:106
USB_DESCIPTOR_TYPE_DEVICE
#define USB_DESCIPTOR_TYPE_DEVICE
usb standard device type
Definition usb_std.h:91

usb device standard descriptor

usb string serial

usb string lang id

usb hid descriptor

usb hid report descriptor

usb configuration standard descriptor

Definition at line 61 of file audio_hid_desc.c.

◆ audio_hid_desc_handler

usbd_desc_handler audio_hid_desc_handler
Initial value:
=
{
get_device_descriptor,
get_device_qualifier,
get_device_configuration,
get_device_other_speed,
get_device_lang_id,
get_device_manufacturer_string,
get_device_product_string,
get_device_serial_string,
get_device_interface_string,
get_device_config_string,
}
get_device_configuration
static usbd_desc_t * get_device_configuration(void)
get config descriptor
Definition audio_hid_desc.c:701
get_device_descriptor
static usbd_desc_t * get_device_descriptor(void)
get device descriptor
Definition audio_hid_desc.c:681
get_device_manufacturer_string
static usbd_desc_t * get_device_manufacturer_string(void)
get manufacturer descriptor
Definition audio_hid_desc.c:732
get_device_qualifier
static usbd_desc_t * get_device_qualifier(void)
get device qualifier
Definition audio_hid_desc.c:691
get_device_interface_string
static usbd_desc_t * get_device_interface_string(void)
get interface descriptor
Definition audio_hid_desc.c:767
get_device_other_speed
static usbd_desc_t * get_device_other_speed(void)
get other speed descriptor
Definition audio_hid_desc.c:711
get_device_product_string
static usbd_desc_t * get_device_product_string(void)
get product descriptor
Definition audio_hid_desc.c:744
get_device_config_string
static usbd_desc_t * get_device_config_string(void)
get device config descriptor
Definition audio_hid_desc.c:779
get_device_lang_id
static usbd_desc_t * get_device_lang_id(void)
get lang id descriptor
Definition audio_hid_desc.c:721
get_device_serial_string
static usbd_desc_t * get_device_serial_string(void)
get serial descriptor
Definition audio_hid_desc.c:756

device descriptor handler structure

Definition at line 66 of file audio_hid_desc.c.

Referenced by main().

◆ config_descriptor

usbd_desc_t config_descriptor
static
Initial value:
=
{
( 0x12 + ((0x08 + ( 1 + 1 )) + ( 1 + 1 )* 0x22)+ + (0x31 + ( ( 0 + 1 ))* 3) + (0x31 + ( ( 0 + 1 ))* 3) + (9 * 1 ) + 32 ),
g_usbd_configuration
}

Definition at line 579 of file audio_hid_desc.c.

Referenced by get_device_configuration().

◆ device_descriptor

usbd_desc_t device_descriptor
static
Initial value:
=
{
USB_DEVICE_DESC_LEN,
g_usbd_descriptor
}

Definition at line 572 of file audio_hid_desc.c.

Referenced by get_device_descriptor().

◆ langid_descriptor

usbd_desc_t langid_descriptor
static
Initial value:
=
{
4 ,
g_string_lang_id
}

Definition at line 586 of file audio_hid_desc.c.

Referenced by get_device_lang_id().

◆ serial_descriptor

usbd_desc_t serial_descriptor
static
Initial value:
=
{
0x1A ,
g_string_serial
}

Definition at line 593 of file audio_hid_desc.c.

Referenced by get_device_serial_string().

◆ vp_desc

usbd_desc_t vp_desc
static

Definition at line 599 of file audio_hid_desc.c.

Referenced by get_device_config_string(), get_device_interface_string(), get_device_manufacturer_string(), and get_device_product_string().


AT32F413 Firmwary Library: USB_audio_hid_desc_definition

Macros | Variables
USB_audio_hid_desc_definition
AT32F413_middlewares_usbd_class » USB_audio_hid_desc

Macros

#define | AUHID_BCD_NUM 0x0100
#define | USBD_AUHID_VENDOR_ID 0x2E3C
#define | USBD_AUHID_PRODUCT_ID 0x5555
#define | USBD_AUHID_SIZ_STRING_LANGID 4
#define | USBD_AUHID_SIZ_STRING_SERIAL 0x1A
#define | USBD_AUHID_DESC_MANUFACTURER_STRING "Artery"
#define | USBD_AUHID_DESC_PRODUCT_STRING "AT32 Audio"
#define | USBD_AUHID_DESC_CONFIGURATION_STRING "Audio Config"
#define | USBD_AUHID_DESC_INTERFACE_STRING "Audio Interface"
#define | AUDIO_SUBCLASS_UNDEFINED 0x00
audio interface subclass codes
#define | AUDIO_SUBCLASS_AUDIOCONTROL 0x01
#define | AUDIO_SUBCLASS_AUDIOSTREAMING 0x02
#define | AUDIO_SUBCLASS_MIDISTREMING 0x03
#define | AUDIO_CS_INTERFACE 0x24
audio class-specific descriptor types
#define | AUDIO_CS_ENDPOINT 0x25
#define | AUDIO_CS_STRING 0x23
#define | AUDIO_CS_CONFIGURATION 0x22
#define | AUDIO_CS_DEVICE 0x21
#define | AUDIO_CS_UNDEFINED 0x20
#define | AUDIO_PROTOCOL_UNDEFINED 0x00
audio interface protocol codes
#define | AUDIO_AC_DESCRIPTOR_UNDEFINED 0x00
audio class-specific ac interface descriptor subtypes
#define | AUDIO_AC_HEADER 0x01
#define | AUDIO_AC_INPUT_TERMINAL 0x02
#define | AUDIO_AC_OUTPUT_TERMINAL 0x03
#define | AUDIO_AC_MIXER_UNIT 0x04
#define | AUDIO_AC_SELECTOR_UNIT 0x05
#define | AUDIO_AC_FEATURE_UNIT 0x06
#define | AUDIO_AC_PROCESSING_UNIT 0x07
#define | AUDIO_AC_EXTENSION_UNIT 0x08
#define | AUDIO_AS_DESCRIPTOR_UNDEFINED 0x00
audio class-specific as interface descriptor subtypes
#define | AUDIO_AS_GENERAL 0x01
#define | AUDIO_AS_FORMAT_TYPE 0x02
#define | AUDIO_AS_FORMAT_SPECIFIC 0x03
#define | AUDIO_REQUEST_CODE_UNDEFINED 0x00
audio class-specific request codes
#define | AUDIO_REQ_SET_CUR 0x01
#define | AUDIO_REQ_GET_CUR 0x81
#define | AUDIO_REQ_SET_MIN 0x02
#define | AUDIO_REQ_GET_MIN 0x82
#define | AUDIO_REQ_SET_MAX 0x03
#define | AUDIO_REQ_GET_MAX 0x83
#define | AUDIO_REQ_SET_RES 0x04
#define | AUDIO_REQ_GET_RES 0x84
#define | AUDIO_REQ_SET_MEM 0x05
#define | AUDIO_REQ_GET_MEM 0x85
#define | AUDIO_REQ_GET_STAT 0xFF
#define | AUDIO_FU_CONTROL_UNDEFINED 0x00
audio feature unit control selectors
#define | AUDIO_FU_MUTE_CONTROL 0x01
#define | AUDIO_FU_VOLUME_CONTROL 0x02
#define | AUDIO_FU_BASS_CONTROL 0x03
#define | AUDIO_FU_MID_CONTROL 0x04
#define | AUDIO_FU_TREBLE_CONTROL 0x05
#define | AUDIO_TERMINAL_TYPE_UNDEFINED 0x0100
audio terminal type
#define | AUDIO_TERMINAL_TYPE_STREAMING 0x0101
#define | AUDIO_TERMINAL_TYPE_VENDOR 0x01FF
#define | AUDIO_INPUT_TERMINAL_UNDEFINED 0x0200
#define | AUDIO_INPUT_TERMINAL_MICROPHONE 0x0201
#define | AUDIO_OUTPUT_TERMINAL_UNDEFINED 0x0300
#define | AUDIO_OUTPUT_TERMINAL_SPEAKER 0x0301
#define | AUDIO_FORMAT_TYPE_I 0x01
audio format type 1
#define | AUDIO_INTERFACE_NUM (AUDIO_SUPPORT_SPK + AUDIO_SUPPORT_MIC)
audio interface config
#define | AUDIO_INTERFACE_LEN ((0x08 + AUDIO_INTERFACE_NUM) + AUDIO_INTERFACE_NUM * 0x22)
#define | AUDIO_MIC_INTERFACE 0x01
#define | AUDIO_SPK_INTERFACE 0x02
#define | AUDIO_INPUT_TERMINAL_SIZE 0x0C
audio interface descriptor size define
#define | AUDIO_OUTPUT_TERMINAL_SIZE 0x09
#define | AUDIO_FEATURE_UNIT_SIZE 0x0D
#define | AUDIO_MIC_INPUT_TERMINAL_ID 0x01
audio terminal id define
#define | AUDIO_MIC_FEATURE_UNIT_ID 0x02
#define | AUDIO_MIC_OUTPUT_TERMINAL_ID 0x03
#define | AUDIO_SPK_INPUT_TERMINAL_ID 0x04
#define | AUDIO_SPK_FEATURE_UNIT_ID 0x05
#define | AUDIO_SPK_OUTPUT_TERMINAL_ID 0x06
#define | AUDIO_MIC_INTERFACE_NUMBER 0x01
audio interface number
#define | AUDIO_SPK_INTERFACE_NUMBER 0x02
#define | HID_INTERFACE_NUMBER 0x03
#define | AT32_AUDIO_FREQ_16K 16000
audio support freq
#define | AT32_AUDIO_FREQ_48K 48000
#define | AUDIO_MIC_FREQ_SIZE (AUDIO_SUPPORT_FREQ)
audio microphone freq and channel config
#define | AUDIO_MIC_CHR AUDIO_MIC_CHANEL_NUM
#define | AUDIO_MIC_BITW (AUDIO_MIC_DEFAULT_BITW)
#define | AUDIO_SPK_FREQ_SIZE (AUDIO_SUPPORT_FREQ)
audio speaker freq and channel config
#define | AUDIO_SPK_CHR AUDIO_SPK_CHANEL_NUM
#define | AUDIO_SPK_BITW (AUDIO_SPK_DEFAULT_BITW)
#define | AUHID_HID_BINTERVAL_TIME 0x01
#define | AUHID_HID_BCD_NUM 0x0110
usb bcd number define
#define | HID_CLASS_DESC_HID 0x21
usb hid class descriptor define
#define | HID_CLASS_DESC_REPORT 0x22
#define | HID_CLASS_DESC_PHYSICAL 0x23
#define | HID_REPORT_ID_1 0x01
usb hid report id define
#define | HID_REPORT_ID_2 0x02
#define | HID_REPORT_ID_3 0x03
#define | HID_REPORT_ID_4 0x04
#define | HID_REPORT_ID_5 0x05
#define | HID_REPORT_ID_6 0xF0
#define | MCU_ID1 (0x1FFFF7E8)
#define | MCU_ID2 (0x1FFFF7EC)
#define | MCU_ID3 (0x1FFFF7F0)
#define | SAMPLE_FREQ(frq)
#define | USBD_AUHID_HID_SIZ_REPORT_DESC 126
#define | USBD_AUHID_HID_DESC_SIZE 32
#define | USBD_AUHID_CONFIG_DESC_SIZE

Variables

uint8_t | g_usbd_audio_hid_report [126]
uint8_t | g_audio_hid_usb_desc [9]
usbd_desc_handler audio_hid_desc_handler
device descriptor handler structure

Detailed Description

Macro Definition Documentation

◆ AT32_AUDIO_FREQ_16K

#define AT32_AUDIO_FREQ_16K 16000

audio support freq

Definition at line 187 of file audio_hid_desc.h.

◆ AT32_AUDIO_FREQ_48K

#define AT32_AUDIO_FREQ_48K 48000

Definition at line 188 of file audio_hid_desc.h.

◆ AUDIO_AC_DESCRIPTOR_UNDEFINED

#define AUDIO_AC_DESCRIPTOR_UNDEFINED 0x00

audio class-specific ac interface descriptor subtypes

Definition at line 88 of file audio_hid_desc.h.

◆ AUDIO_AC_EXTENSION_UNIT

#define AUDIO_AC_EXTENSION_UNIT 0x08

Definition at line 96 of file audio_hid_desc.h.

◆ AUDIO_AC_FEATURE_UNIT

#define AUDIO_AC_FEATURE_UNIT 0x06

Definition at line 94 of file audio_hid_desc.h.

◆ AUDIO_AC_HEADER

#define AUDIO_AC_HEADER 0x01

Definition at line 89 of file audio_hid_desc.h.

◆ AUDIO_AC_INPUT_TERMINAL

#define AUDIO_AC_INPUT_TERMINAL 0x02

Definition at line 90 of file audio_hid_desc.h.

◆ AUDIO_AC_MIXER_UNIT

#define AUDIO_AC_MIXER_UNIT 0x04

Definition at line 92 of file audio_hid_desc.h.

◆ AUDIO_AC_OUTPUT_TERMINAL

#define AUDIO_AC_OUTPUT_TERMINAL 0x03

Definition at line 91 of file audio_hid_desc.h.

◆ AUDIO_AC_PROCESSING_UNIT

#define AUDIO_AC_PROCESSING_UNIT 0x07

Definition at line 95 of file audio_hid_desc.h.

◆ AUDIO_AC_SELECTOR_UNIT

#define AUDIO_AC_SELECTOR_UNIT 0x05

Definition at line 93 of file audio_hid_desc.h.

◆ AUDIO_AS_DESCRIPTOR_UNDEFINED

#define AUDIO_AS_DESCRIPTOR_UNDEFINED 0x00

audio class-specific as interface descriptor subtypes

Definition at line 101 of file audio_hid_desc.h.

◆ AUDIO_AS_FORMAT_SPECIFIC

#define AUDIO_AS_FORMAT_SPECIFIC 0x03

Definition at line 104 of file audio_hid_desc.h.

◆ AUDIO_AS_FORMAT_TYPE

#define AUDIO_AS_FORMAT_TYPE 0x02

Definition at line 103 of file audio_hid_desc.h.

◆ AUDIO_AS_GENERAL

#define AUDIO_AS_GENERAL 0x01

Definition at line 102 of file audio_hid_desc.h.

◆ AUDIO_CS_CONFIGURATION

#define AUDIO_CS_CONFIGURATION 0x22

Definition at line 76 of file audio_hid_desc.h.

◆ AUDIO_CS_DEVICE

#define AUDIO_CS_DEVICE 0x21

Definition at line 77 of file audio_hid_desc.h.

◆ AUDIO_CS_ENDPOINT

#define AUDIO_CS_ENDPOINT 0x25

Definition at line 74 of file audio_hid_desc.h.

◆ AUDIO_CS_INTERFACE

#define AUDIO_CS_INTERFACE 0x24

audio class-specific descriptor types

Definition at line 73 of file audio_hid_desc.h.

◆ AUDIO_CS_STRING

#define AUDIO_CS_STRING 0x23

Definition at line 75 of file audio_hid_desc.h.

◆ AUDIO_CS_UNDEFINED

#define AUDIO_CS_UNDEFINED 0x20

Definition at line 78 of file audio_hid_desc.h.

◆ AUDIO_FEATURE_UNIT_SIZE

#define AUDIO_FEATURE_UNIT_SIZE 0x0D

Definition at line 161 of file audio_hid_desc.h.

◆ AUDIO_FORMAT_TYPE_I

#define AUDIO_FORMAT_TYPE_I 0x01

audio format type 1

Definition at line 146 of file audio_hid_desc.h.

◆ AUDIO_FU_BASS_CONTROL

#define AUDIO_FU_BASS_CONTROL 0x03

Definition at line 128 of file audio_hid_desc.h.

◆ AUDIO_FU_CONTROL_UNDEFINED

#define AUDIO_FU_CONTROL_UNDEFINED 0x00

audio feature unit control selectors

Definition at line 125 of file audio_hid_desc.h.

◆ AUDIO_FU_MID_CONTROL

#define AUDIO_FU_MID_CONTROL 0x04

Definition at line 129 of file audio_hid_desc.h.

◆ AUDIO_FU_MUTE_CONTROL

#define AUDIO_FU_MUTE_CONTROL 0x01

Definition at line 126 of file audio_hid_desc.h.

◆ AUDIO_FU_TREBLE_CONTROL

#define AUDIO_FU_TREBLE_CONTROL 0x05

Definition at line 130 of file audio_hid_desc.h.

◆ AUDIO_FU_VOLUME_CONTROL

#define AUDIO_FU_VOLUME_CONTROL 0x02

Definition at line 127 of file audio_hid_desc.h.

◆ AUDIO_INPUT_TERMINAL_MICROPHONE

#define AUDIO_INPUT_TERMINAL_MICROPHONE 0x0201

Definition at line 139 of file audio_hid_desc.h.

◆ AUDIO_INPUT_TERMINAL_SIZE

#define AUDIO_INPUT_TERMINAL_SIZE 0x0C

audio interface descriptor size define

Definition at line 159 of file audio_hid_desc.h.

◆ AUDIO_INPUT_TERMINAL_UNDEFINED

#define AUDIO_INPUT_TERMINAL_UNDEFINED 0x0200

Definition at line 138 of file audio_hid_desc.h.

◆ AUDIO_INTERFACE_LEN

#define AUDIO_INTERFACE_LEN ((0x08 + AUDIO_INTERFACE_NUM) + AUDIO_INTERFACE_NUM * 0x22)

Definition at line 152 of file audio_hid_desc.h.

◆ AUDIO_INTERFACE_NUM

#define AUDIO_INTERFACE_NUM (AUDIO_SUPPORT_SPK + AUDIO_SUPPORT_MIC)

audio interface config

Definition at line 151 of file audio_hid_desc.h.

◆ AUDIO_MIC_BITW

#define AUDIO_MIC_BITW (AUDIO_MIC_DEFAULT_BITW)

Definition at line 195 of file audio_hid_desc.h.

◆ AUDIO_MIC_CHR

#define AUDIO_MIC_CHR AUDIO_MIC_CHANEL_NUM

Definition at line 194 of file audio_hid_desc.h.

◆ AUDIO_MIC_FEATURE_UNIT_ID

#define AUDIO_MIC_FEATURE_UNIT_ID 0x02

Definition at line 167 of file audio_hid_desc.h.

◆ AUDIO_MIC_FREQ_SIZE

#define AUDIO_MIC_FREQ_SIZE (AUDIO_SUPPORT_FREQ)

audio microphone freq and channel config

Definition at line 193 of file audio_hid_desc.h.

◆ AUDIO_MIC_INPUT_TERMINAL_ID

#define AUDIO_MIC_INPUT_TERMINAL_ID 0x01

audio terminal id define

Definition at line 166 of file audio_hid_desc.h.

◆ AUDIO_MIC_INTERFACE

#define AUDIO_MIC_INTERFACE 0x01

Definition at line 153 of file audio_hid_desc.h.

◆ AUDIO_MIC_INTERFACE_NUMBER

#define AUDIO_MIC_INTERFACE_NUMBER 0x01

audio interface number

Definition at line 176 of file audio_hid_desc.h.

◆ AUDIO_MIC_OUTPUT_TERMINAL_ID

#define AUDIO_MIC_OUTPUT_TERMINAL_ID 0x03

Definition at line 168 of file audio_hid_desc.h.

◆ AUDIO_OUTPUT_TERMINAL_SIZE

#define AUDIO_OUTPUT_TERMINAL_SIZE 0x09

Definition at line 160 of file audio_hid_desc.h.

◆ AUDIO_OUTPUT_TERMINAL_SPEAKER

#define AUDIO_OUTPUT_TERMINAL_SPEAKER 0x0301

Definition at line 141 of file audio_hid_desc.h.

◆ AUDIO_OUTPUT_TERMINAL_UNDEFINED

#define AUDIO_OUTPUT_TERMINAL_UNDEFINED 0x0300

Definition at line 140 of file audio_hid_desc.h.

◆ AUDIO_PROTOCOL_UNDEFINED

#define AUDIO_PROTOCOL_UNDEFINED 0x00

audio interface protocol codes

Definition at line 83 of file audio_hid_desc.h.

◆ AUDIO_REQ_GET_CUR

#define AUDIO_REQ_GET_CUR 0x81

Definition at line 111 of file audio_hid_desc.h.

◆ AUDIO_REQ_GET_MAX

#define AUDIO_REQ_GET_MAX 0x83

Definition at line 115 of file audio_hid_desc.h.

◆ AUDIO_REQ_GET_MEM

#define AUDIO_REQ_GET_MEM 0x85

Definition at line 119 of file audio_hid_desc.h.

◆ AUDIO_REQ_GET_MIN

#define AUDIO_REQ_GET_MIN 0x82

Definition at line 113 of file audio_hid_desc.h.

◆ AUDIO_REQ_GET_RES

#define AUDIO_REQ_GET_RES 0x84

Definition at line 117 of file audio_hid_desc.h.

◆ AUDIO_REQ_GET_STAT

#define AUDIO_REQ_GET_STAT 0xFF

Definition at line 120 of file audio_hid_desc.h.

◆ AUDIO_REQ_SET_CUR

#define AUDIO_REQ_SET_CUR 0x01

Definition at line 110 of file audio_hid_desc.h.

◆ AUDIO_REQ_SET_MAX

#define AUDIO_REQ_SET_MAX 0x03

Definition at line 114 of file audio_hid_desc.h.

◆ AUDIO_REQ_SET_MEM

#define AUDIO_REQ_SET_MEM 0x05

Definition at line 118 of file audio_hid_desc.h.

◆ AUDIO_REQ_SET_MIN

#define AUDIO_REQ_SET_MIN 0x02

Definition at line 112 of file audio_hid_desc.h.

◆ AUDIO_REQ_SET_RES

#define AUDIO_REQ_SET_RES 0x04

Definition at line 116 of file audio_hid_desc.h.

◆ AUDIO_REQUEST_CODE_UNDEFINED

#define AUDIO_REQUEST_CODE_UNDEFINED 0x00

audio class-specific request codes

Definition at line 109 of file audio_hid_desc.h.

◆ AUDIO_SPK_BITW

#define AUDIO_SPK_BITW (AUDIO_SPK_DEFAULT_BITW)

Definition at line 202 of file audio_hid_desc.h.

◆ AUDIO_SPK_CHR

#define AUDIO_SPK_CHR AUDIO_SPK_CHANEL_NUM

Definition at line 201 of file audio_hid_desc.h.

◆ AUDIO_SPK_FEATURE_UNIT_ID

#define AUDIO_SPK_FEATURE_UNIT_ID 0x05

Definition at line 170 of file audio_hid_desc.h.

◆ AUDIO_SPK_FREQ_SIZE

#define AUDIO_SPK_FREQ_SIZE (AUDIO_SUPPORT_FREQ)

audio speaker freq and channel config

Definition at line 200 of file audio_hid_desc.h.

◆ AUDIO_SPK_INPUT_TERMINAL_ID

#define AUDIO_SPK_INPUT_TERMINAL_ID 0x04

Definition at line 169 of file audio_hid_desc.h.

◆ AUDIO_SPK_INTERFACE

#define AUDIO_SPK_INTERFACE 0x02

Definition at line 154 of file audio_hid_desc.h.

◆ AUDIO_SPK_INTERFACE_NUMBER

#define AUDIO_SPK_INTERFACE_NUMBER 0x02

Definition at line 178 of file audio_hid_desc.h.

◆ AUDIO_SPK_OUTPUT_TERMINAL_ID

#define AUDIO_SPK_OUTPUT_TERMINAL_ID 0x06

Definition at line 171 of file audio_hid_desc.h.

◆ AUDIO_SUBCLASS_AUDIOCONTROL

#define AUDIO_SUBCLASS_AUDIOCONTROL 0x01

Definition at line 66 of file audio_hid_desc.h.

◆ AUDIO_SUBCLASS_AUDIOSTREAMING

#define AUDIO_SUBCLASS_AUDIOSTREAMING 0x02

Definition at line 67 of file audio_hid_desc.h.

◆ AUDIO_SUBCLASS_MIDISTREMING

#define AUDIO_SUBCLASS_MIDISTREMING 0x03

Definition at line 68 of file audio_hid_desc.h.

◆ AUDIO_SUBCLASS_UNDEFINED

#define AUDIO_SUBCLASS_UNDEFINED 0x00

audio interface subclass codes

Definition at line 65 of file audio_hid_desc.h.

◆ AUDIO_TERMINAL_TYPE_STREAMING

#define AUDIO_TERMINAL_TYPE_STREAMING 0x0101

Definition at line 136 of file audio_hid_desc.h.

◆ AUDIO_TERMINAL_TYPE_UNDEFINED

#define AUDIO_TERMINAL_TYPE_UNDEFINED 0x0100

audio terminal type

Definition at line 135 of file audio_hid_desc.h.

◆ AUDIO_TERMINAL_TYPE_VENDOR

#define AUDIO_TERMINAL_TYPE_VENDOR 0x01FF

Definition at line 137 of file audio_hid_desc.h.

◆ AUHID_BCD_NUM

#define AUHID_BCD_NUM 0x0100

Definition at line 50 of file audio_hid_desc.h.

◆ AUHID_HID_BCD_NUM

#define AUHID_HID_BCD_NUM 0x0110

usb bcd number define

Definition at line 209 of file audio_hid_desc.h.

◆ AUHID_HID_BINTERVAL_TIME

#define AUHID_HID_BINTERVAL_TIME 0x01

Definition at line 204 of file audio_hid_desc.h.

◆ HID_CLASS_DESC_HID

#define HID_CLASS_DESC_HID 0x21

usb hid class descriptor define

Definition at line 214 of file audio_hid_desc.h.

◆ HID_CLASS_DESC_PHYSICAL

#define HID_CLASS_DESC_PHYSICAL 0x23

Definition at line 216 of file audio_hid_desc.h.

◆ HID_CLASS_DESC_REPORT

#define HID_CLASS_DESC_REPORT 0x22

Definition at line 215 of file audio_hid_desc.h.

◆ HID_INTERFACE_NUMBER

#define HID_INTERFACE_NUMBER 0x03

Definition at line 182 of file audio_hid_desc.h.

Referenced by class_ept0_rx_handler(), and class_setup_handler().

◆ HID_REPORT_ID_1

#define HID_REPORT_ID_1 0x01

usb hid report id define

Definition at line 221 of file audio_hid_desc.h.

◆ HID_REPORT_ID_2

#define HID_REPORT_ID_2 0x02

Definition at line 222 of file audio_hid_desc.h.

Referenced by usb_hid_buf_process(), and usb_hid_buf_process().

◆ HID_REPORT_ID_3

#define HID_REPORT_ID_3 0x03

Definition at line 223 of file audio_hid_desc.h.

Referenced by usb_hid_buf_process(), and usb_hid_buf_process().

◆ HID_REPORT_ID_4

#define HID_REPORT_ID_4 0x04

Definition at line 224 of file audio_hid_desc.h.

Referenced by usb_hid_buf_process(), and usb_hid_buf_process().

◆ HID_REPORT_ID_5

#define HID_REPORT_ID_5 0x05

Definition at line 225 of file audio_hid_desc.h.

Referenced by main().

◆ HID_REPORT_ID_6

#define HID_REPORT_ID_6 0xF0

Definition at line 226 of file audio_hid_desc.h.

Referenced by usb_hid_buf_process(), and usb_hid_buf_process().

◆ MCU_ID1

#define MCU_ID1 (0x1FFFF7E8)

Definition at line 228 of file audio_hid_desc.h.

◆ MCU_ID2

#define MCU_ID2 (0x1FFFF7EC)

Definition at line 229 of file audio_hid_desc.h.

◆ MCU_ID3

#define MCU_ID3 (0x1FFFF7F0)

Definition at line 230 of file audio_hid_desc.h.

◆ SAMPLE_FREQ

#define SAMPLE_FREQ ( frq )
Value:
(uint8_t)(frq), (uint8_t)((frq >> 8)), (uint8_t)((frq >> 16))

Definition at line 233 of file audio_hid_desc.h.

◆ USBD_AUHID_CONFIG_DESC_SIZE

#define USBD_AUHID_CONFIG_DESC_SIZE
Value:
( 0x12 + AUDIO_INTERFACE_LEN + \
+ (0x31 + AUDIO_SPK_FREQ_SIZE * 3) \
+ (0x31 + AUDIO_MIC_FREQ_SIZE * 3) \
+ (9 * AUDIO_SUPPORT_FEEDBACK) \
+ USBD_AUHID_HID_DESC_SIZE)
AUDIO_MIC_FREQ_SIZE
#define AUDIO_MIC_FREQ_SIZE
audio microphone freq and channel config
Definition audio_hid_desc.h:193
AUDIO_SPK_FREQ_SIZE
#define AUDIO_SPK_FREQ_SIZE
audio speaker freq and channel config
Definition audio_hid_desc.h:200
USBD_AUHID_HID_DESC_SIZE
#define USBD_AUHID_HID_DESC_SIZE
Definition audio_hid_desc.h:236
AUDIO_INTERFACE_LEN
#define AUDIO_INTERFACE_LEN
Definition audio_hid_desc.h:152
AUDIO_SUPPORT_FEEDBACK
#define AUDIO_SUPPORT_FEEDBACK
Definition audio/audio_conf.h:48

Definition at line 237 of file audio_hid_desc.h.

◆ USBD_AUHID_DESC_CONFIGURATION_STRING

#define USBD_AUHID_DESC_CONFIGURATION_STRING "Audio Config"

Definition at line 60 of file audio_hid_desc.h.

Referenced by get_device_config_string().

◆ USBD_AUHID_DESC_INTERFACE_STRING

#define USBD_AUHID_DESC_INTERFACE_STRING "Audio Interface"

Definition at line 61 of file audio_hid_desc.h.

Referenced by get_device_interface_string().

◆ USBD_AUHID_DESC_MANUFACTURER_STRING

#define USBD_AUHID_DESC_MANUFACTURER_STRING "Artery"

Definition at line 58 of file audio_hid_desc.h.

Referenced by get_device_manufacturer_string().

◆ USBD_AUHID_DESC_PRODUCT_STRING

#define USBD_AUHID_DESC_PRODUCT_STRING "AT32 Audio"

Definition at line 59 of file audio_hid_desc.h.

Referenced by get_device_product_string().

◆ USBD_AUHID_HID_DESC_SIZE

#define USBD_AUHID_HID_DESC_SIZE 32

Definition at line 236 of file audio_hid_desc.h.

◆ USBD_AUHID_HID_SIZ_REPORT_DESC

#define USBD_AUHID_HID_SIZ_REPORT_DESC 126

Definition at line 235 of file audio_hid_desc.h.

Referenced by class_hid_setup_handler().

◆ USBD_AUHID_PRODUCT_ID

#define USBD_AUHID_PRODUCT_ID 0x5555

Definition at line 53 of file audio_hid_desc.h.

◆ USBD_AUHID_SIZ_STRING_LANGID

#define USBD_AUHID_SIZ_STRING_LANGID 4

Definition at line 55 of file audio_hid_desc.h.

◆ USBD_AUHID_SIZ_STRING_SERIAL

#define USBD_AUHID_SIZ_STRING_SERIAL 0x1A

Definition at line 56 of file audio_hid_desc.h.

◆ USBD_AUHID_VENDOR_ID

#define USBD_AUHID_VENDOR_ID 0x2E3C

Definition at line 52 of file audio_hid_desc.h.

Variable Documentation

◆ audio_hid_desc_handler

usbd_desc_handler audio_hid_desc_handler
extern

device descriptor handler structure

Definition at line 66 of file audio_hid_desc.c.

Referenced by main().

◆ g_audio_hid_usb_desc

uint8_t g_audio_hid_usb_desc[9]
extern

Referenced by class_hid_setup_handler().

◆ g_usbd_audio_hid_report

uint8_t g_usbd_audio_hid_report[126]
extern

Referenced by class_hid_setup_handler().


AT32F413 Firmwary Library: USB_cdc_class

Topics
USB_cdc_class
AT32F413_middlewares_usbd_class

usb device class cdc demo More...

Topics

USB_cdc_class_private_functions
USB_cdc_class_definition
USB_cdc_class_exported_types
USB_cdc_class_exported_functions

Detailed Description

usb device class cdc demo


AT32F413 Firmwary Library: USB_cdc_class_private_functions

Functions | Variables
USB_cdc_class_private_functions
AT32F413_middlewares_usbd_class » USB_cdc_class

Functions

static usb_sts_type | class_init_handler (void *udev)
initialize usb endpoint
static usb_sts_type | class_clear_handler (void *udev)
clear endpoint or other state
static usb_sts_type | class_setup_handler (void *udev, usb_setup_type *setup)
usb device class setup request handler
static usb_sts_type | class_ept0_tx_handler (void *udev)
usb device class endpoint 0 in status stage complete
static usb_sts_type | class_ept0_rx_handler (void *udev)
usb device class endpoint 0 out status stage complete
static usb_sts_type | class_in_handler (void *udev, uint8_t ept_num)
usb device class transmision complete handler
static usb_sts_type | class_out_handler (void *udev, uint8_t ept_num)
usb device class endpoint receive data
static usb_sts_type | class_sof_handler (void *udev)
usb device class sof handler
static usb_sts_type | class_event_handler (void *udev, usbd_event_type event)
usb device class event handler
static usb_sts_type | cdc_struct_init (cdc_struct_type *pcdc)
usb device cdc init
void | usb_usart_config (linecoding_type linecoding)
this function handles usart2 and linecoding config.
static void | usb_vcp_cmd_process (void *udev, uint8_t cmd, uint8_t *buff, uint16_t len)
usb device class request function
uint16_t | usb_vcp_get_rxdata (void *udev, uint8_t *recv_data)
usb device class rx data process
error_status | usb_vcp_send_data (void *udev, uint8_t *send_data, uint16_t len)
usb device class send data

Variables

linecoding_type linecoding
cdc_struct_type cdc_struct
usbd_class_handler cdc_class_handler

Detailed Description

Function Documentation

◆ cdc_struct_init()

static usb_sts_type cdc_struct_init ( cdc_struct_type * pcdc )
static

usb device cdc init

Parameters
pcdc to the structure of cdc_struct
Return values
status of usb_sts_type

Definition at line 326 of file cdc_class.c.

Referenced by class_init_handler().

◆ class_clear_handler()

static usb_sts_type class_clear_handler ( void * udev )
static

clear endpoint or other state

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 122 of file cdc_class.c.

◆ class_ept0_rx_handler()

static usb_sts_type class_ept0_rx_handler ( void * udev )
static

usb device class endpoint 0 out status stage complete

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 219 of file cdc_class.c.

◆ class_ept0_tx_handler()

static usb_sts_type class_ept0_tx_handler ( void * udev )
static

usb device class endpoint 0 in status stage complete

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 205 of file cdc_class.c.

◆ class_event_handler()

static usb_sts_type class_event_handler | ( | void * | udev,
 |  | usbd_event_type | event )
 static

usb device class event handler

Parameters
udev | to the structure of usbd_core_type
event | usb device event
Return values
status of usb_sts_type

Definition at line 296 of file cdc_class.c.

◆ class_in_handler()

static usb_sts_type class_in_handler | ( | void * | udev,
 |  | uint8_t | ept_num )
 static

usb device class transmision complete handler

Parameters
udev | to the structure of usbd_core_type
ept_num | endpoint number
Return values
status of usb_sts_type

Definition at line 241 of file cdc_class.c.

◆ class_init_handler()

static usb_sts_type class_init_handler ( void * udev )
static

initialize usb endpoint

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 87 of file cdc_class.c.

◆ class_out_handler()

static usb_sts_type class_out_handler | ( | void * | udev,
 |  | uint8_t | ept_num )
 static

usb device class endpoint receive data

Parameters
udev | to the structure of usbd_core_type
ept_num | endpoint number
Return values
status of usb_sts_type

Definition at line 261 of file cdc_class.c.

◆ class_setup_handler()

static usb_sts_type class_setup_handler | ( | void * | udev,
 |  | usb_setup_type * | setup )
 static

usb device class setup request handler

Parameters
udev | to the structure of usbd_core_type
setup | setup packet
Return values
status of usb_sts_type

Definition at line 145 of file cdc_class.c.

◆ class_sof_handler()

static usb_sts_type class_sof_handler ( void * udev )
static

usb device class sof handler

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 281 of file cdc_class.c.

◆ usb_usart_config()

void usb_usart_config ( linecoding_type linecoding )
extern

this function handles usart2 and linecoding config.

Parameters
linecoding linecoding value
Return values
none

< usart receive data buffer full interrupt

Definition at line 301 of file project/at_start_f413/examples/usb_device/virtual_comport/src/main.c.

Referenced by usb_vcp_cmd_process().

◆ usb_vcp_cmd_process()

static void usb_vcp_cmd_process | ( | void * | udev,
 |  | uint8_t | cmd,
 |  | uint8_t * | buff,
 |  | uint16_t | len )
 static

usb device class request function

Parameters
udev | to the structure of usbd_core_type
cmd | request number
buff | request buffer
len | buffer length
Return values
none

Definition at line 400 of file cdc_class.c.

Referenced by class_ept0_rx_handler(), and class_setup_handler().

◆ usb_vcp_get_rxdata()

uint16_t usb_vcp_get_rxdata | ( | void * | udev,
 |  | uint8_t * | recv_data )

usb device class rx data process

Parameters
udev | to the structure of usbd_core_type
recv_data | receive buffer
Return values
receive data len

Definition at line 344 of file cdc_class.c.

Referenced by main().

◆ usb_vcp_send_data()

error_status usb_vcp_send_data | ( | void * | udev,
 |  | uint8_t * | send_data,
 |  | uint16_t | len )

usb device class send data

Parameters
udev | to the structure of usbd_core_type
send_data | send data buffer
len | send length
Return values
error status

Definition at line 374 of file cdc_class.c.

Referenced by main().

Variable Documentation

◆ cdc_class_handler

usbd_class_handler cdc_class_handler
Initial value:
=
{
class_init_handler,
class_clear_handler,
class_setup_handler,
class_ept0_tx_handler,
class_ept0_rx_handler,
class_in_handler,
class_out_handler,
class_sof_handler,
class_event_handler,
&cdc_struct
}
class_sof_handler
static usb_sts_type class_sof_handler(void *udev)
usb device class sof handler
Definition cdc_class.c:281
class_in_handler
static usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
usb device class transmision complete handler
Definition cdc_class.c:241
class_clear_handler
static usb_sts_type class_clear_handler(void *udev)
clear endpoint or other state
Definition cdc_class.c:122
class_setup_handler
static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
usb device class setup request handler
Definition cdc_class.c:145
class_ept0_tx_handler
static usb_sts_type class_ept0_tx_handler(void *udev)
usb device class endpoint 0 in status stage complete
Definition cdc_class.c:205
class_ept0_rx_handler
static usb_sts_type class_ept0_rx_handler(void *udev)
usb device class endpoint 0 out status stage complete
Definition cdc_class.c:219
class_event_handler
static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
usb device class event handler
Definition cdc_class.c:296
class_init_handler
static usb_sts_type class_init_handler(void *udev)
initialize usb endpoint
Definition cdc_class.c:87
class_out_handler
static usb_sts_type class_out_handler(void *udev, uint8_t ept_num)
usb device class endpoint receive data
Definition cdc_class.c:261
cdc_struct
cdc_struct_type cdc_struct
Definition cdc_class.c:65

Definition at line 68 of file cdc_class.c.

Referenced by main().

◆ cdc_struct

cdc_struct_type cdc_struct

Definition at line 65 of file cdc_class.c.

◆ linecoding

linecoding_type linecoding
Initial value:
=
{
115200,
0,
0,
8
}

Definition at line 56 of file cdc_class.c.

Referenced by cdc_struct_init().


AT32F413 Firmwary Library: USB_cdc_class_definition

Macros
USB_cdc_class_definition
AT32F413_middlewares_usbd_class » USB_cdc_class | AT32F413_middlewares_usbd_class » USB_cdc_msc_class

Macros

#define | USBD_CDC_INT_EPT 0x82
usb cdc use endpoint define
#define | USBD_CDC_BULK_IN_EPT 0x81
#define | USBD_CDC_BULK_OUT_EPT 0x01
#define | USBD_CDC_IN_MAXPACKET_SIZE 0x40
usb cdc in and out max packet size define
#define | USBD_CDC_OUT_MAXPACKET_SIZE 0x40
#define | USBD_CDC_CMD_MAXPACKET_SIZE 0x08
#define | USBD_CDC_INT_EPT 0x82
usb cdc use endpoint define
#define | USBD_CDC_BULK_IN_EPT 0x83
#define | USBD_CDC_BULK_OUT_EPT 0x02
#define | USBD_MSC_BULK_IN_EPT 0x81
#define | USBD_MSC_BULK_OUT_EPT 0x01
#define | USBD_CDC_MSC_IN_MAXPACKET_SIZE 0x40
usb cdc in and out max packet size define
#define | USBD_CDC_MSC_OUT_MAXPACKET_SIZE 0x40
#define | USBD_CDC_CMD_MAXPACKET_SIZE 0x08

Detailed Description

Macro Definition Documentation

◆ USBD_CDC_BULK_IN_EPT [1/2]

#define USBD_CDC_BULK_IN_EPT 0x81

Definition at line 53 of file cdc_class.h.

Referenced by class_clear_handler(), class_clear_handler(), class_in_handler(), class_init_handler(), class_init_handler(), and usb_vcp_send_data().

◆ USBD_CDC_BULK_IN_EPT [2/2]

#define USBD_CDC_BULK_IN_EPT 0x83

Definition at line 53 of file cdc_msc_class.h.

◆ USBD_CDC_BULK_OUT_EPT [1/2]

#define USBD_CDC_BULK_OUT_EPT 0x01

Definition at line 54 of file cdc_class.h.

Referenced by class_clear_handler(), class_clear_handler(), class_init_handler(), class_init_handler(), class_out_handler(), and usb_vcp_get_rxdata().

◆ USBD_CDC_BULK_OUT_EPT [2/2]

#define USBD_CDC_BULK_OUT_EPT 0x02

Definition at line 54 of file cdc_msc_class.h.

◆ USBD_CDC_CMD_MAXPACKET_SIZE [1/2]

#define USBD_CDC_CMD_MAXPACKET_SIZE 0x08

Definition at line 61 of file cdc_class.h.

Referenced by class_init_handler(), and class_init_handler().

◆ USBD_CDC_CMD_MAXPACKET_SIZE [2/2]

#define USBD_CDC_CMD_MAXPACKET_SIZE 0x08

Definition at line 65 of file cdc_msc_class.h.

◆ USBD_CDC_IN_MAXPACKET_SIZE

#define USBD_CDC_IN_MAXPACKET_SIZE 0x40

usb cdc in and out max packet size define

Definition at line 59 of file cdc_class.h.

Referenced by class_init_handler().

◆ USBD_CDC_INT_EPT [1/2]

#define USBD_CDC_INT_EPT 0x82

usb cdc use endpoint define

Definition at line 52 of file cdc_class.h.

Referenced by class_clear_handler(), class_clear_handler(), class_init_handler(), and class_init_handler().

◆ USBD_CDC_INT_EPT [2/2]

#define USBD_CDC_INT_EPT 0x82

usb cdc use endpoint define

Definition at line 52 of file cdc_msc_class.h.

◆ USBD_CDC_MSC_IN_MAXPACKET_SIZE

#define USBD_CDC_MSC_IN_MAXPACKET_SIZE 0x40

usb cdc in and out max packet size define

Definition at line 62 of file cdc_msc_class.h.

Referenced by class_init_handler(), and msc_class_setup_handler().

◆ USBD_CDC_MSC_OUT_MAXPACKET_SIZE

#define USBD_CDC_MSC_OUT_MAXPACKET_SIZE 0x40

Definition at line 64 of file cdc_msc_class.h.

Referenced by class_init_handler(), msc_class_setup_handler(), and usb_vcp_get_rxdata().

◆ USBD_CDC_OUT_MAXPACKET_SIZE

#define USBD_CDC_OUT_MAXPACKET_SIZE 0x40

Definition at line 60 of file cdc_class.h.

Referenced by class_init_handler(), and usb_vcp_get_rxdata().

◆ USBD_MSC_BULK_IN_EPT

#define USBD_MSC_BULK_IN_EPT 0x81

Definition at line 56 of file cdc_msc_class.h.

Referenced by bot_scsi_clear_feature(), bot_scsi_read10(), bot_scsi_send_csw(), bot_scsi_send_data(), bot_scsi_stall(), class_clear_handler(), class_clear_handler(), class_in_handler(), class_init_handler(), class_init_handler(), and class_setup_handler().

◆ USBD_MSC_BULK_OUT_EPT

#define USBD_MSC_BULK_OUT_EPT 0x01

Definition at line 57 of file cdc_msc_class.h.

Referenced by bot_cbw_decode(), bot_scsi_init(), bot_scsi_reset(), bot_scsi_send_csw(), bot_scsi_stall(), bot_scsi_write10(), class_clear_handler(), class_clear_handler(), class_init_handler(), class_init_handler(), class_out_handler(), and class_setup_handler().


AT32F413 Firmwary Library: USB_cdc_class_exported_types

Topics | Data Structures
USB_cdc_class_exported_types
AT32F413_middlewares_usbd_class » USB_cdc_class | AT32F413_middlewares_usbd_class » USB_cdc_keyboard_class | AT32F413_middlewares_usbd_class » USB_cdc_msc_class

Topics

USB_msc_bot_scsi_definition
USB_cdc_msc_class_exported_functions

Data Structures

struct | cdc_struct_type
usb cdc class struct More...
struct | vcp_keyboard_type

Detailed Description

Generated by doxygen 1.12.0


AT32F413 Firmwary Library: USB_msc_bot_scsi_definition

Data Structures | Macros | Functions
USB_msc_bot_scsi_definition
AT32F413_middlewares_usbd_class » USB_cdc_class | AT32F413_middlewares_usbd_class » USB_cdc_keyboard_class | AT32F413_middlewares_usbd_class » USB_cdc_msc_class » USB_cdc_class_exported_types | AT32F413_middlewares_usbd_class » USB_msc_bot_scsi

Data Structures

struct | cbd_typical_type
typical command block description More...
struct | cbd_extended_type
extended command block description More...
struct | cbw_type
command block wrapper More...
struct | csw_type
command block wrapper More...
struct | sense_type
request sense standard data More...
struct | msc_type
struct | cdc_msc_struct_type
usb cdc class struct More...

Macros

#define | MSC_SUPPORT_MAX_LUN 1
#define | MSC_MAX_DATA_BUF_LEN 4096
#define | MSC_CMD_FORMAT_UNIT 0x04
#define | MSC_CMD_INQUIRY 0x12
#define | MSC_CMD_START_STOP 0x1B
#define | MSC_CMD_MODE_SENSE6 0x1A
#define | MSC_CMD_MODE_SENSE10 0x5A
#define | MSC_CMD_ALLOW_MEDIUM_REMOVAL 0x1E
#define | MSC_CMD_READ_10 0x28
#define | MSC_CMD_READ_12 0xA8
#define | MSC_CMD_READ_CAPACITY 0x25
#define | MSC_CMD_READ_FORMAT_CAPACITY 0x23
#define | MSC_CMD_REQUEST_SENSE 0x03
#define | MSC_CMD_TEST_UNIT 0x00
#define | MSC_CMD_VERIFY 0x2F
#define | MSC_CMD_WRITE_10 0x2A
#define | MSC_CMD_WRITE_12 0xAA
#define | MSC_CMD_WRITE_VERIFY 0x2E
#define | MSC_REQ_GET_MAX_LUN 0xFE
#define | MSC_REQ_BO_RESET 0xFF
#define | SET_LINE_CODING 0x20
#define | GET_LINE_CODING 0x21
#define | CBW_CMD_LENGTH 31
#define | CBW_DCBWSIGNATURE 0x43425355
#define | CBW_BMCBWFLAGS_DIR_OUT 0x00
#define | CBW_BMCBWFLAGS_DIR_IN 0x80
#define | CSW_CMD_LENGTH 13
#define | CSW_DCSWSIGNATURE 0x53425355
#define | CSW_BCSWSTATUS_PASS 0x00
#define | CSW_BCSWSTATUS_FAILED 0x01
#define | CSW_BCSWSTATUS_PHASE_ERR 0x02
#define | MSC_STATE_MACHINE_CMD 0x00
#define | MSC_STATE_MACHINE_DATA_IN 0x01
#define | MSC_STATE_MACHINE_DATA_OUT 0x02
#define | MSC_STATE_MACHINE_SEND_DATA 0x03
#define | MSC_STATE_MACHINE_LAST_DATA 0x04
#define | MSC_STATE_MACHINE_STATUS 0x05
#define | MSC_STATE_MACHINE_FAILED 0x06
#define | MSC_STATE_MACHINE_IDLE 0x07
#define | MSC_BOT_STATE_IDLE 0x00
#define | MSC_BOT_STATE_RECOVERY 0x01
#define | MSC_BOT_STATE_ERROR 0x02
#define | REQ_SENSE_STANDARD_DATA_LEN 0x12
#define | SENSE_KEY_NO_SENSE 0x00
#define | SENSE_KEY_RECOVERED_ERROR 0x01
#define | SENSE_KEY_NOT_READY 0x02
#define | SENSE_KEY_MEDIUM_ERROR 0x03
#define | SENSE_KEY_HARDWARE_ERROR 0x04
#define | SENSE_KEY_ILLEGAL_REQUEST 0x05
#define | SENSE_KEY_UNIT_ATTENTION 0x06
#define | SENSE_KEY_DATA_PROTECT 0x07
#define | SENSE_KEY_BLANK_CHECK 0x08
#define | SENSE_KEY_VENDERO_SPECIFIC 0x09
#define | SENSE_KEY_ABORTED_COMMAND 0x0B
#define | SENSE_KEY_VOLUME_OVERFLOW 0x0D
#define | SENSE_KEY_MISCOMPARE 0x0E
#define | INVALID_COMMAND 0x20
#define | INVALID_FIELED_IN_COMMAND 0x24
#define | PARAMETER_LIST_LENGTH_ERROR 0x1A
#define | INVALID_FIELD_IN_PARAMETER_LIST 0x26
#define | ADDRESS_OUT_OF_RANGE 0x21
#define | MEDIUM_NOT_PRESENT 0x3A
#define | MEDIUM_HAVE_CHANGED 0x28
#define | SCSI_INQUIRY_DATA_LENGTH 36
#define | MSC_SUPPORT_MAX_LUN 1
#define | MSC_MAX_DATA_BUF_LEN 4096
#define | MSC_CMD_FORMAT_UNIT 0x04
#define | MSC_CMD_INQUIRY 0x12
#define | MSC_CMD_START_STOP 0x1B
#define | MSC_CMD_MODE_SENSE6 0x1A
#define | MSC_CMD_MODE_SENSE10 0x5A
#define | MSC_CMD_ALLOW_MEDIUM_REMOVAL 0x1E
#define | MSC_CMD_READ_10 0x28
#define | MSC_CMD_READ_12 0xA8
#define | MSC_CMD_READ_CAPACITY 0x25
#define | MSC_CMD_READ_FORMAT_CAPACITY 0x23
#define | MSC_CMD_REQUEST_SENSE 0x03
#define | MSC_CMD_TEST_UNIT 0x00
#define | MSC_CMD_VERIFY 0x2F
#define | MSC_CMD_WRITE_10 0x2A
#define | MSC_CMD_WRITE_12 0xAA
#define | MSC_CMD_WRITE_VERIFY 0x2E
#define | MSC_REQ_GET_MAX_LUN 0xFE
#define | MSC_REQ_BO_RESET 0xFF
#define | SET_LINE_CODING 0x20
#define | GET_LINE_CODING 0x21
#define | CBW_CMD_LENGTH 31
#define | CBW_DCBWSIGNATURE 0x43425355
#define | CBW_BMCBWFLAGS_DIR_OUT 0x00
#define | CBW_BMCBWFLAGS_DIR_IN 0x80
#define | CSW_CMD_LENGTH 13
#define | CSW_DCSWSIGNATURE 0x53425355
#define | CSW_BCSWSTATUS_PASS 0x00
#define | CSW_BCSWSTATUS_FAILED 0x01
#define | CSW_BCSWSTATUS_PHASE_ERR 0x02
#define | MSC_STATE_MACHINE_CMD 0x00
#define | MSC_STATE_MACHINE_DATA_IN 0x01
#define | MSC_STATE_MACHINE_DATA_OUT 0x02
#define | MSC_STATE_MACHINE_SEND_DATA 0x03
#define | MSC_STATE_MACHINE_LAST_DATA 0x04
#define | MSC_STATE_MACHINE_STATUS 0x05
#define | MSC_STATE_MACHINE_FAILED 0x06
#define | MSC_STATE_MACHINE_IDLE 0x07
#define | MSC_BOT_STATE_IDLE 0x00
#define | MSC_BOT_STATE_RECOVERY 0x01
#define | MSC_BOT_STATE_ERROR 0x02
#define | REQ_SENSE_STANDARD_DATA_LEN 0x12
#define | SENSE_KEY_NO_SENSE 0x00
#define | SENSE_KEY_RECOVERED_ERROR 0x01
#define | SENSE_KEY_NOT_READY 0x02
#define | SENSE_KEY_MEDIUM_ERROR 0x03
#define | SENSE_KEY_HARDWARE_ERROR 0x04
#define | SENSE_KEY_ILLEGAL_REQUEST 0x05
#define | SENSE_KEY_UNIT_ATTENTION 0x06
#define | SENSE_KEY_DATA_PROTECT 0x07
#define | SENSE_KEY_BLANK_CHECK 0x08
#define | SENSE_KEY_VENDERO_SPECIFIC 0x09
#define | SENSE_KEY_ABORTED_COMMAND 0x0B
#define | SENSE_KEY_VOLUME_OVERFLOW 0x0D
#define | SENSE_KEY_MISCOMPARE 0x0E
#define | INVALID_COMMAND 0x20
#define | INVALID_FIELED_IN_COMMAND 0x24
#define | PARAMETER_LIST_LENGTH_ERROR 0x1A
#define | INVALID_FIELD_IN_PARAMETER_LIST 0x26
#define | ADDRESS_OUT_OF_RANGE 0x21
#define | MEDIUM_NOT_PRESENT 0x3A
#define | MEDIUM_HAVE_CHANGED 0x28
#define | SCSI_INQUIRY_DATA_LENGTH 36

Functions

void | bot_scsi_init (void *udev)
initialize bulk-only transport and scsi
void | bot_scsi_reset (void *udev)
reset bulk-only transport and scsi
void | bot_scsi_datain_handler (void *pudev, uint8_t ept_num)
bulk-only transport data in handler
void | bot_scsi_dataout_handler (void *pudev, uint8_t ept_num)
bulk-only transport data out handler
void | bot_cbw_decode (void *udev)
bulk-only cbw decode
void | bot_scsi_send_data (void *udev, uint8_t *buffer, uint32_t len)
send bot data
void | bot_scsi_send_csw (void *udev, uint8_t status)
send command status
void | bot_scsi_sense_code (void *udev, uint8_t sense_key, uint8_t asc)
send scsi sense code
usb_sts_type | bot_scsi_check_address (void *udev, uint8_t lun, uint32_t blk_offset, uint32_t blk_count)
check address
void | bot_scsi_stall (void *udev)
bot endpoint stall
usb_sts_type | bot_scsi_cmd_process (void *udev)
bulk-only transport scsi command process
usb_sts_type | bot_scsi_test_unit (void *udev, uint8_t lun)
bulk-only transport scsi command test unit
usb_sts_type | bot_scsi_inquiry (void *udev, uint8_t lun)
bulk-only transport scsi command inquiry
usb_sts_type | bot_scsi_start_stop (void *udev, uint8_t lun)
bulk-only transport scsi command start stop
usb_sts_type | bot_scsi_allow_medium_removal (void *udev, uint8_t lun)
bulk-only transport scsi command meidum removal
usb_sts_type | bot_scsi_mode_sense6 (void *udev, uint8_t lun)
bulk-only transport scsi command mode sense6
usb_sts_type | bot_scsi_mode_sense10 (void *udev, uint8_t lun)
bulk-only transport scsi command mode sense10
usb_sts_type | bot_scsi_read10 (void *udev, uint8_t lun)
bulk-only transport scsi command read10
usb_sts_type | bot_scsi_capacity (void *udev, uint8_t lun)
bulk-only transport scsi command capacity
usb_sts_type | bot_scsi_format_capacity (void *udev, uint8_t lun)
bulk-only transport scsi command format capacity
usb_sts_type | bot_scsi_request_sense (void *udev, uint8_t lun)
bulk-only transport scsi command request sense
usb_sts_type | bot_scsi_verify (void *udev, uint8_t lun)
bulk-only transport scsi command verify
usb_sts_type | bot_scsi_write10 (void *udev, uint8_t lun)
bulk-only transport scsi command write10
void | bot_scsi_clear_feature (void *udev, uint8_t ept_num)
clear feature

Detailed Description

Macro Definition Documentation

◆ ADDRESS_OUT_OF_RANGE [1/2]

#define ADDRESS_OUT_OF_RANGE 0x21

Definition at line 152 of file cdc_msc_class.h.

Referenced by bot_scsi_check_address().

◆ ADDRESS_OUT_OF_RANGE [2/2]

#define ADDRESS_OUT_OF_RANGE 0x21

Definition at line 118 of file msc_bot_scsi.h.

◆ CBW_BMCBWFLAGS_DIR_IN [1/2]

#define CBW_BMCBWFLAGS_DIR_IN 0x80

Definition at line 111 of file cdc_msc_class.h.

◆ CBW_BMCBWFLAGS_DIR_IN [2/2]

#define CBW_BMCBWFLAGS_DIR_IN 0x80

Definition at line 77 of file msc_bot_scsi.h.

◆ CBW_BMCBWFLAGS_DIR_OUT [1/2]

#define CBW_BMCBWFLAGS_DIR_OUT 0x00

Definition at line 110 of file cdc_msc_class.h.

◆ CBW_BMCBWFLAGS_DIR_OUT [2/2]

#define CBW_BMCBWFLAGS_DIR_OUT 0x00

Definition at line 76 of file msc_bot_scsi.h.

◆ CBW_CMD_LENGTH [1/2]

#define CBW_CMD_LENGTH 31

Definition at line 108 of file cdc_msc_class.h.

Referenced by bot_cbw_decode(), bot_scsi_init(), bot_scsi_reset(), bot_scsi_send_csw(), and bot_scsi_stall().

◆ CBW_CMD_LENGTH [2/2]

#define CBW_CMD_LENGTH 31

Definition at line 74 of file msc_bot_scsi.h.

◆ CBW_DCBWSIGNATURE [1/2]

#define CBW_DCBWSIGNATURE 0x43425355

Definition at line 109 of file cdc_msc_class.h.

Referenced by bot_cbw_decode().

◆ CBW_DCBWSIGNATURE [2/2]

#define CBW_DCBWSIGNATURE 0x43425355

Definition at line 75 of file msc_bot_scsi.h.

◆ CSW_BCSWSTATUS_FAILED [1/2]

#define CSW_BCSWSTATUS_FAILED 0x01

Definition at line 116 of file cdc_msc_class.h.

Referenced by bot_scsi_clear_feature(), bot_scsi_datain_handler(), and bot_scsi_dataout_handler().

◆ CSW_BCSWSTATUS_FAILED [2/2]

#define CSW_BCSWSTATUS_FAILED 0x01

Definition at line 82 of file msc_bot_scsi.h.

◆ CSW_BCSWSTATUS_PASS [1/2]

#define CSW_BCSWSTATUS_PASS 0x00

Definition at line 115 of file cdc_msc_class.h.

Referenced by bot_cbw_decode(), bot_scsi_datain_handler(), bot_scsi_init(), bot_scsi_send_data(), and bot_scsi_write10().

◆ CSW_BCSWSTATUS_PASS [2/2]

#define CSW_BCSWSTATUS_PASS 0x00

Definition at line 81 of file msc_bot_scsi.h.

◆ CSW_BCSWSTATUS_PHASE_ERR [1/2]

#define CSW_BCSWSTATUS_PHASE_ERR 0x02

Definition at line 117 of file cdc_msc_class.h.

◆ CSW_BCSWSTATUS_PHASE_ERR [2/2]

#define CSW_BCSWSTATUS_PHASE_ERR 0x02

Definition at line 83 of file msc_bot_scsi.h.

◆ CSW_CMD_LENGTH [1/2]

#define CSW_CMD_LENGTH 13

Definition at line 113 of file cdc_msc_class.h.

Referenced by bot_scsi_send_csw().

◆ CSW_CMD_LENGTH [2/2]

#define CSW_CMD_LENGTH 13

Definition at line 79 of file msc_bot_scsi.h.

◆ CSW_DCSWSIGNATURE [1/2]

#define CSW_DCSWSIGNATURE 0x53425355

Definition at line 114 of file cdc_msc_class.h.

Referenced by bot_scsi_init(), and bot_scsi_send_csw().

◆ CSW_DCSWSIGNATURE [2/2]

#define CSW_DCSWSIGNATURE 0x53425355

Definition at line 80 of file msc_bot_scsi.h.

◆ GET_LINE_CODING [1/2]

#define GET_LINE_CODING 0x21

Definition at line 106 of file cdc_msc_class.h.

Referenced by usb_vcp_cmd_process(), usb_vcp_cmd_process(), and usb_vcp_cmd_process().

◆ GET_LINE_CODING [2/2]

#define GET_LINE_CODING 0x21

Definition at line 72 of file msc_bot_scsi.h.

◆ INVALID_COMMAND [1/2]

#define INVALID_COMMAND 0x20

Definition at line 148 of file cdc_msc_class.h.

Referenced by bot_cbw_decode(), bot_scsi_cmd_process(), bot_scsi_read10(), bot_scsi_test_unit(), and bot_scsi_write10().

◆ INVALID_COMMAND [2/2]

#define INVALID_COMMAND 0x20

Definition at line 114 of file msc_bot_scsi.h.

◆ INVALID_FIELD_IN_PARAMETER_LIST [1/2]

#define INVALID_FIELD_IN_PARAMETER_LIST 0x26

Definition at line 151 of file cdc_msc_class.h.

◆ INVALID_FIELD_IN_PARAMETER_LIST [2/2]

#define INVALID_FIELD_IN_PARAMETER_LIST 0x26

Definition at line 117 of file msc_bot_scsi.h.

◆ INVALID_FIELED_IN_COMMAND [1/2]

#define INVALID_FIELED_IN_COMMAND 0x24

Definition at line 149 of file cdc_msc_class.h.

Referenced by bot_scsi_verify().

◆ INVALID_FIELED_IN_COMMAND [2/2]

#define INVALID_FIELED_IN_COMMAND 0x24

Definition at line 115 of file msc_bot_scsi.h.

◆ MEDIUM_HAVE_CHANGED [1/2]

#define MEDIUM_HAVE_CHANGED 0x28

Definition at line 154 of file cdc_msc_class.h.

◆ MEDIUM_HAVE_CHANGED [2/2]

#define MEDIUM_HAVE_CHANGED 0x28

Definition at line 120 of file msc_bot_scsi.h.

◆ MEDIUM_NOT_PRESENT [1/2]

#define MEDIUM_NOT_PRESENT 0x3A

Definition at line 153 of file cdc_msc_class.h.

Referenced by bot_scsi_read10(), and bot_scsi_write10().

◆ MEDIUM_NOT_PRESENT [2/2]

#define MEDIUM_NOT_PRESENT 0x3A

Definition at line 119 of file msc_bot_scsi.h.

◆ MSC_BOT_STATE_ERROR [1/2]

#define MSC_BOT_STATE_ERROR 0x02

Definition at line 130 of file cdc_msc_class.h.

Referenced by bot_cbw_decode(), bot_scsi_clear_feature(), and bot_scsi_stall().

◆ MSC_BOT_STATE_ERROR [2/2]

#define MSC_BOT_STATE_ERROR 0x02

Definition at line 96 of file msc_bot_scsi.h.

◆ MSC_BOT_STATE_IDLE [1/2]

#define MSC_BOT_STATE_IDLE 0x00

Definition at line 128 of file cdc_msc_class.h.

Referenced by bot_scsi_clear_feature(), bot_scsi_init(), and bot_scsi_stall().

◆ MSC_BOT_STATE_IDLE [2/2]

#define MSC_BOT_STATE_IDLE 0x00

Definition at line 94 of file msc_bot_scsi.h.

◆ MSC_BOT_STATE_RECOVERY [1/2]

#define MSC_BOT_STATE_RECOVERY 0x01

Definition at line 129 of file cdc_msc_class.h.

Referenced by bot_scsi_clear_feature(), and bot_scsi_reset().

◆ MSC_BOT_STATE_RECOVERY [2/2]

#define MSC_BOT_STATE_RECOVERY 0x01

Definition at line 95 of file msc_bot_scsi.h.

◆ MSC_CMD_ALLOW_MEDIUM_REMOVAL [1/2]

#define MSC_CMD_ALLOW_MEDIUM_REMOVAL 0x1E

Definition at line 90 of file cdc_msc_class.h.

Referenced by bot_scsi_cmd_process().

◆ MSC_CMD_ALLOW_MEDIUM_REMOVAL [2/2]

#define MSC_CMD_ALLOW_MEDIUM_REMOVAL 0x1E

Definition at line 56 of file msc_bot_scsi.h.

◆ MSC_CMD_FORMAT_UNIT [1/2]

#define MSC_CMD_FORMAT_UNIT 0x04

Definition at line 85 of file cdc_msc_class.h.

◆ MSC_CMD_FORMAT_UNIT [2/2]

#define MSC_CMD_FORMAT_UNIT 0x04

Definition at line 51 of file msc_bot_scsi.h.

◆ MSC_CMD_INQUIRY [1/2]

#define MSC_CMD_INQUIRY 0x12

Definition at line 86 of file cdc_msc_class.h.

Referenced by bot_scsi_cmd_process().

◆ MSC_CMD_INQUIRY [2/2]

#define MSC_CMD_INQUIRY 0x12

Definition at line 52 of file msc_bot_scsi.h.

◆ MSC_CMD_MODE_SENSE10 [1/2]

#define MSC_CMD_MODE_SENSE10 0x5A

Definition at line 89 of file cdc_msc_class.h.

Referenced by bot_scsi_cmd_process().

◆ MSC_CMD_MODE_SENSE10 [2/2]

#define MSC_CMD_MODE_SENSE10 0x5A

Definition at line 55 of file msc_bot_scsi.h.

◆ MSC_CMD_MODE_SENSE6 [1/2]

#define MSC_CMD_MODE_SENSE6 0x1A

Definition at line 88 of file cdc_msc_class.h.

Referenced by bot_scsi_cmd_process().

◆ MSC_CMD_MODE_SENSE6 [2/2]

#define MSC_CMD_MODE_SENSE6 0x1A

Definition at line 54 of file msc_bot_scsi.h.

◆ MSC_CMD_READ_10 [1/2]

#define MSC_CMD_READ_10 0x28

Definition at line 91 of file cdc_msc_class.h.

Referenced by bot_scsi_cmd_process().

◆ MSC_CMD_READ_10 [2/2]

#define MSC_CMD_READ_10 0x28

Definition at line 57 of file msc_bot_scsi.h.

◆ MSC_CMD_READ_12 [1/2]

#define MSC_CMD_READ_12 0xA8

Definition at line 92 of file cdc_msc_class.h.

◆ MSC_CMD_READ_12 [2/2]

#define MSC_CMD_READ_12 0xA8

Definition at line 58 of file msc_bot_scsi.h.

◆ MSC_CMD_READ_CAPACITY [1/2]

#define MSC_CMD_READ_CAPACITY 0x25

Definition at line 93 of file cdc_msc_class.h.

Referenced by bot_scsi_cmd_process().

◆ MSC_CMD_READ_CAPACITY [2/2]

#define MSC_CMD_READ_CAPACITY 0x25

Definition at line 59 of file msc_bot_scsi.h.

◆ MSC_CMD_READ_FORMAT_CAPACITY [1/2]

#define MSC_CMD_READ_FORMAT_CAPACITY 0x23

Definition at line 94 of file cdc_msc_class.h.

Referenced by bot_scsi_cmd_process().

◆ MSC_CMD_READ_FORMAT_CAPACITY [2/2]

#define MSC_CMD_READ_FORMAT_CAPACITY 0x23

Definition at line 60 of file msc_bot_scsi.h.

◆ MSC_CMD_REQUEST_SENSE [1/2]

#define MSC_CMD_REQUEST_SENSE 0x03

Definition at line 95 of file cdc_msc_class.h.

Referenced by bot_scsi_cmd_process().

◆ MSC_CMD_REQUEST_SENSE [2/2]

#define MSC_CMD_REQUEST_SENSE 0x03

Definition at line 61 of file msc_bot_scsi.h.

◆ MSC_CMD_START_STOP [1/2]

#define MSC_CMD_START_STOP 0x1B

Definition at line 87 of file cdc_msc_class.h.

Referenced by bot_scsi_cmd_process().

◆ MSC_CMD_START_STOP [2/2]

#define MSC_CMD_START_STOP 0x1B

Definition at line 53 of file msc_bot_scsi.h.

◆ MSC_CMD_TEST_UNIT [1/2]

#define MSC_CMD_TEST_UNIT 0x00

Definition at line 96 of file cdc_msc_class.h.

Referenced by bot_scsi_cmd_process().

◆ MSC_CMD_TEST_UNIT [2/2]

#define MSC_CMD_TEST_UNIT 0x00

Definition at line 62 of file msc_bot_scsi.h.

◆ MSC_CMD_VERIFY [1/2]

#define MSC_CMD_VERIFY 0x2F

Definition at line 97 of file cdc_msc_class.h.

Referenced by bot_scsi_cmd_process().

◆ MSC_CMD_VERIFY [2/2]

#define MSC_CMD_VERIFY 0x2F

Definition at line 63 of file msc_bot_scsi.h.

◆ MSC_CMD_WRITE_10 [1/2]

#define MSC_CMD_WRITE_10 0x2A

Definition at line 98 of file cdc_msc_class.h.

Referenced by bot_scsi_cmd_process().

◆ MSC_CMD_WRITE_10 [2/2]

#define MSC_CMD_WRITE_10 0x2A

Definition at line 64 of file msc_bot_scsi.h.

◆ MSC_CMD_WRITE_12 [1/2]

#define MSC_CMD_WRITE_12 0xAA

Definition at line 99 of file cdc_msc_class.h.

◆ MSC_CMD_WRITE_12 [2/2]

#define MSC_CMD_WRITE_12 0xAA

Definition at line 65 of file msc_bot_scsi.h.

◆ MSC_CMD_WRITE_VERIFY [1/2]

#define MSC_CMD_WRITE_VERIFY 0x2E

Definition at line 100 of file cdc_msc_class.h.

◆ MSC_CMD_WRITE_VERIFY [2/2]

#define MSC_CMD_WRITE_VERIFY 0x2E

Definition at line 66 of file msc_bot_scsi.h.

◆ MSC_MAX_DATA_BUF_LEN [1/2]

#define MSC_MAX_DATA_BUF_LEN 4096

Definition at line 83 of file cdc_msc_class.h.

Referenced by bot_scsi_read10(), and bot_scsi_write10().

◆ MSC_MAX_DATA_BUF_LEN [2/2]

#define MSC_MAX_DATA_BUF_LEN 4096

Definition at line 49 of file msc_bot_scsi.h.

◆ MSC_REQ_BO_RESET [1/2]

#define MSC_REQ_BO_RESET 0xFF

bulk only mass storage reset

Definition at line 103 of file cdc_msc_class.h.

Referenced by class_setup_handler(), and msc_class_setup_handler().

◆ MSC_REQ_BO_RESET [2/2]

#define MSC_REQ_BO_RESET 0xFF

bulk only mass storage reset

Definition at line 69 of file msc_bot_scsi.h.

◆ MSC_REQ_GET_MAX_LUN [1/2]

#define MSC_REQ_GET_MAX_LUN 0xFE

get max lun

Definition at line 102 of file cdc_msc_class.h.

Referenced by class_setup_handler(), and msc_class_setup_handler().

◆ MSC_REQ_GET_MAX_LUN [2/2]

#define MSC_REQ_GET_MAX_LUN 0xFE

get max lun

Definition at line 68 of file msc_bot_scsi.h.

◆ MSC_STATE_MACHINE_CMD [1/2]

#define MSC_STATE_MACHINE_CMD 0x00

Definition at line 119 of file cdc_msc_class.h.

◆ MSC_STATE_MACHINE_CMD [2/2]

#define MSC_STATE_MACHINE_CMD 0x00

Definition at line 85 of file msc_bot_scsi.h.

◆ MSC_STATE_MACHINE_DATA_IN [1/2]

#define MSC_STATE_MACHINE_DATA_IN 0x01

Definition at line 120 of file cdc_msc_class.h.

Referenced by bot_cbw_decode(), bot_scsi_datain_handler(), and bot_scsi_read10().

◆ MSC_STATE_MACHINE_DATA_IN [2/2]

#define MSC_STATE_MACHINE_DATA_IN 0x01

Definition at line 86 of file msc_bot_scsi.h.

◆ MSC_STATE_MACHINE_DATA_OUT [1/2]

#define MSC_STATE_MACHINE_DATA_OUT 0x02

Definition at line 121 of file cdc_msc_class.h.

Referenced by bot_cbw_decode(), bot_scsi_dataout_handler(), and bot_scsi_write10().

◆ MSC_STATE_MACHINE_DATA_OUT [2/2]

#define MSC_STATE_MACHINE_DATA_OUT 0x02

Definition at line 87 of file msc_bot_scsi.h.

◆ MSC_STATE_MACHINE_FAILED [1/2]

#define MSC_STATE_MACHINE_FAILED 0x06

Definition at line 125 of file cdc_msc_class.h.

◆ MSC_STATE_MACHINE_FAILED [2/2]

#define MSC_STATE_MACHINE_FAILED 0x06

Definition at line 91 of file msc_bot_scsi.h.

◆ MSC_STATE_MACHINE_IDLE [1/2]

#define MSC_STATE_MACHINE_IDLE 0x07

Definition at line 126 of file cdc_msc_class.h.

Referenced by bot_scsi_dataout_handler(), bot_scsi_init(), bot_scsi_read10(), bot_scsi_reset(), bot_scsi_send_csw(), and bot_scsi_write10().

◆ MSC_STATE_MACHINE_IDLE [2/2]

#define MSC_STATE_MACHINE_IDLE 0x07

Definition at line 92 of file msc_bot_scsi.h.

◆ MSC_STATE_MACHINE_LAST_DATA [1/2]

#define MSC_STATE_MACHINE_LAST_DATA 0x04

Definition at line 123 of file cdc_msc_class.h.

Referenced by bot_cbw_decode(), bot_scsi_datain_handler(), and bot_scsi_read10().

◆ MSC_STATE_MACHINE_LAST_DATA [2/2]

#define MSC_STATE_MACHINE_LAST_DATA 0x04

Definition at line 89 of file msc_bot_scsi.h.

◆ MSC_STATE_MACHINE_SEND_DATA [1/2]

#define MSC_STATE_MACHINE_SEND_DATA 0x03

Definition at line 122 of file cdc_msc_class.h.

Referenced by bot_scsi_datain_handler(), and bot_scsi_send_data().

◆ MSC_STATE_MACHINE_SEND_DATA [2/2]

#define MSC_STATE_MACHINE_SEND_DATA 0x03

Definition at line 88 of file msc_bot_scsi.h.

◆ MSC_STATE_MACHINE_STATUS [1/2]

#define MSC_STATE_MACHINE_STATUS 0x05

Definition at line 124 of file cdc_msc_class.h.

◆ MSC_STATE_MACHINE_STATUS [2/2]

#define MSC_STATE_MACHINE_STATUS 0x05

Definition at line 90 of file msc_bot_scsi.h.

◆ MSC_SUPPORT_MAX_LUN [1/2]

#define MSC_SUPPORT_MAX_LUN 1

Definition at line 82 of file cdc_msc_class.h.

Referenced by bot_cbw_decode(), bot_scsi_init(), bot_scsi_reset(), and get_inquiry().

◆ MSC_SUPPORT_MAX_LUN [2/2]

#define MSC_SUPPORT_MAX_LUN 1

Definition at line 48 of file msc_bot_scsi.h.

◆ PARAMETER_LIST_LENGTH_ERROR [1/2]

#define PARAMETER_LIST_LENGTH_ERROR 0x1A

Definition at line 150 of file cdc_msc_class.h.

◆ PARAMETER_LIST_LENGTH_ERROR [2/2]

#define PARAMETER_LIST_LENGTH_ERROR 0x1A

Definition at line 116 of file msc_bot_scsi.h.

◆ REQ_SENSE_STANDARD_DATA_LEN [1/2]

#define REQ_SENSE_STANDARD_DATA_LEN 0x12

Definition at line 132 of file cdc_msc_class.h.

Referenced by bot_scsi_request_sense().

◆ REQ_SENSE_STANDARD_DATA_LEN [2/2]

#define REQ_SENSE_STANDARD_DATA_LEN 0x12

Definition at line 98 of file msc_bot_scsi.h.

◆ SCSI_INQUIRY_DATA_LENGTH [1/2]

#define SCSI_INQUIRY_DATA_LENGTH 36

Definition at line 156 of file cdc_msc_class.h.

Referenced by bot_scsi_inquiry().

◆ SCSI_INQUIRY_DATA_LENGTH [2/2]

#define SCSI_INQUIRY_DATA_LENGTH 36

Definition at line 122 of file msc_bot_scsi.h.

◆ SENSE_KEY_ABORTED_COMMAND [1/2]

#define SENSE_KEY_ABORTED_COMMAND 0x0B

Definition at line 143 of file cdc_msc_class.h.

◆ SENSE_KEY_ABORTED_COMMAND [2/2]

#define SENSE_KEY_ABORTED_COMMAND 0x0B

Definition at line 109 of file msc_bot_scsi.h.

◆ SENSE_KEY_BLANK_CHECK [1/2]

#define SENSE_KEY_BLANK_CHECK 0x08

Definition at line 141 of file cdc_msc_class.h.

◆ SENSE_KEY_BLANK_CHECK [2/2]

#define SENSE_KEY_BLANK_CHECK 0x08

Definition at line 107 of file msc_bot_scsi.h.

◆ SENSE_KEY_DATA_PROTECT [1/2]

#define SENSE_KEY_DATA_PROTECT 0x07

Definition at line 140 of file cdc_msc_class.h.

◆ SENSE_KEY_DATA_PROTECT [2/2]

#define SENSE_KEY_DATA_PROTECT 0x07

Definition at line 106 of file msc_bot_scsi.h.

◆ SENSE_KEY_HARDWARE_ERROR [1/2]

#define SENSE_KEY_HARDWARE_ERROR 0x04

Definition at line 137 of file cdc_msc_class.h.

Referenced by bot_scsi_read10(), and bot_scsi_write10().

◆ SENSE_KEY_HARDWARE_ERROR [2/2]

#define SENSE_KEY_HARDWARE_ERROR 0x04

Definition at line 103 of file msc_bot_scsi.h.

◆ SENSE_KEY_ILLEGAL_REQUEST [1/2]

#define SENSE_KEY_ILLEGAL_REQUEST 0x05

Definition at line 138 of file cdc_msc_class.h.

Referenced by bot_cbw_decode(), bot_scsi_check_address(), bot_scsi_cmd_process(), bot_scsi_read10(), bot_scsi_test_unit(), bot_scsi_verify(), and bot_scsi_write10().

◆ SENSE_KEY_ILLEGAL_REQUEST [2/2]

#define SENSE_KEY_ILLEGAL_REQUEST 0x05

Definition at line 104 of file msc_bot_scsi.h.

◆ SENSE_KEY_MEDIUM_ERROR [1/2]

#define SENSE_KEY_MEDIUM_ERROR 0x03

Definition at line 136 of file cdc_msc_class.h.

◆ SENSE_KEY_MEDIUM_ERROR [2/2]

#define SENSE_KEY_MEDIUM_ERROR 0x03

Definition at line 102 of file msc_bot_scsi.h.

◆ SENSE_KEY_MISCOMPARE [1/2]

#define SENSE_KEY_MISCOMPARE 0x0E

Definition at line 145 of file cdc_msc_class.h.

◆ SENSE_KEY_MISCOMPARE [2/2]

#define SENSE_KEY_MISCOMPARE 0x0E

Definition at line 111 of file msc_bot_scsi.h.

◆ SENSE_KEY_NO_SENSE [1/2]

#define SENSE_KEY_NO_SENSE 0x00

Definition at line 133 of file cdc_msc_class.h.

◆ SENSE_KEY_NO_SENSE [2/2]

#define SENSE_KEY_NO_SENSE 0x00

Definition at line 99 of file msc_bot_scsi.h.

◆ SENSE_KEY_NOT_READY [1/2]

#define SENSE_KEY_NOT_READY 0x02

Definition at line 135 of file cdc_msc_class.h.

◆ SENSE_KEY_NOT_READY [2/2]

#define SENSE_KEY_NOT_READY 0x02

Definition at line 101 of file msc_bot_scsi.h.

◆ SENSE_KEY_RECOVERED_ERROR [1/2]

#define SENSE_KEY_RECOVERED_ERROR 0x01

Definition at line 134 of file cdc_msc_class.h.

◆ SENSE_KEY_RECOVERED_ERROR [2/2]

#define SENSE_KEY_RECOVERED_ERROR 0x01

Definition at line 100 of file msc_bot_scsi.h.

◆ SENSE_KEY_UNIT_ATTENTION [1/2]

#define SENSE_KEY_UNIT_ATTENTION 0x06

Definition at line 139 of file cdc_msc_class.h.

◆ SENSE_KEY_UNIT_ATTENTION [2/2]

#define SENSE_KEY_UNIT_ATTENTION 0x06

Definition at line 105 of file msc_bot_scsi.h.

◆ SENSE_KEY_VENDERO_SPECIFIC [1/2]

#define SENSE_KEY_VENDERO_SPECIFIC 0x09

Definition at line 142 of file cdc_msc_class.h.

◆ SENSE_KEY_VENDERO_SPECIFIC [2/2]

#define SENSE_KEY_VENDERO_SPECIFIC 0x09

Definition at line 108 of file msc_bot_scsi.h.

◆ SENSE_KEY_VOLUME_OVERFLOW [1/2]

#define SENSE_KEY_VOLUME_OVERFLOW 0x0D

Definition at line 144 of file cdc_msc_class.h.

◆ SENSE_KEY_VOLUME_OVERFLOW [2/2]

#define SENSE_KEY_VOLUME_OVERFLOW 0x0D

Definition at line 110 of file msc_bot_scsi.h.

◆ SET_LINE_CODING [1/2]

#define SET_LINE_CODING 0x20

Definition at line 105 of file cdc_msc_class.h.

Referenced by class_ept0_rx_handler(), class_ept0_rx_handler(), class_ept0_rx_handler(), usb_vcp_cmd_process(), usb_vcp_cmd_process(), and usb_vcp_cmd_process().

◆ SET_LINE_CODING [2/2]

#define SET_LINE_CODING 0x20

Definition at line 71 of file msc_bot_scsi.h.

Function Documentation

◆ bot_cbw_decode()

void bot_cbw_decode ( void * udev )

bulk-only cbw decode

Parameters
udev to the structure of usbd_core_type
Return values
none
Parameters
udev to the structure of usbd_core_type
Return values
none

Definition at line 196 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by bot_scsi_dataout_handler().

◆ bot_scsi_allow_medium_removal()

usb_sts_type bot_scsi_allow_medium_removal | ( | void * | udev,
 |  | uint8_t | lun )

bulk-only transport scsi command meidum removal

Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type
Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type

Definition at line 423 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by bot_scsi_cmd_process().

◆ bot_scsi_capacity()

usb_sts_type bot_scsi_capacity | ( | void * | udev,
 |  | uint8_t | lun )

bulk-only transport scsi command capacity

Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type
Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type

Definition at line 477 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by bot_scsi_cmd_process().

◆ bot_scsi_check_address()

usb_sts_type bot_scsi_check_address | ( | void * | udev,
 |  | uint8_t | lun,
 |  | uint32_t | blk_offset,
 |  | uint32_t | blk_count )

check address

Parameters
udev | to the structure of usbd_core_type
lun | logical units number
blk_offset | blk offset address
blk_count | blk number
Return values
usb_sts_type
Parameters
udev | to the structure of usbd_core_type
lun | logical units number
blk_offset | blk offset address
blk_count | blk number
Return values
usb_sts_type

Definition at line 303 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by bot_scsi_read10(), bot_scsi_verify(), and bot_scsi_write10().

◆ bot_scsi_clear_feature()

void bot_scsi_clear_feature | ( | void * | udev,
 |  | uint8_t | ept_num )

clear feature

Parameters
udev | to the structure of usbd_core_type
etp_num | endpoint number
Return values
status of usb_sts_type
Parameters
udev | to the structure of usbd_core_type
etp_num | endpoint number
Return values
status of usb_sts_type

Definition at line 729 of file composite_cdc_msc/msc_bot_scsi.c.

◆ bot_scsi_cmd_process()

usb_sts_type bot_scsi_cmd_process ( void * udev )

bulk-only transport scsi command process

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type
Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 749 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by bot_cbw_decode(), bot_scsi_datain_handler(), and bot_scsi_dataout_handler().

◆ bot_scsi_datain_handler()

void bot_scsi_datain_handler | ( | void * | udev,
 |  | uint8_t | ept_num )

bulk-only transport data in handler

Parameters
udev | to the structure of usbd_core_type
ept_num | endpoint number
Return values
none
Parameters
udev | to the structure of usbd_core_type
ept_num | endpoint number
Return values
none

Definition at line 143 of file composite_cdc_msc/msc_bot_scsi.c.

◆ bot_scsi_dataout_handler()

void bot_scsi_dataout_handler | ( | void * | udev,
 |  | uint8_t | ept_num )

bulk-only transport data out handler

Parameters
udev | to the structure of usbd_core_type
ept_num | endpoint number
Return values
none
Parameters
udev | to the structure of usbd_core_type
ept_num | endpoint number
Return values
none

Definition at line 172 of file composite_cdc_msc/msc_bot_scsi.c.

◆ bot_scsi_format_capacity()

usb_sts_type bot_scsi_format_capacity | ( | void * | udev,
 |  | uint8_t | lun )

bulk-only transport scsi command format capacity

Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type
Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type

Definition at line 504 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by bot_scsi_cmd_process().

◆ bot_scsi_init()

void bot_scsi_init ( void * udev )

initialize bulk-only transport and scsi

Parameters
udev to the structure of usbd_core_type
Return values
none
Parameters
udev to the structure of usbd_core_type
Return values
none

Definition at line 103 of file composite_cdc_msc/msc_bot_scsi.c.

◆ bot_scsi_inquiry()

usb_sts_type bot_scsi_inquiry | ( | void * | udev,
 |  | uint8_t | lun )

bulk-only transport scsi command inquiry

Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type
Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type

Definition at line 368 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by bot_scsi_cmd_process().

◆ bot_scsi_mode_sense10()

usb_sts_type bot_scsi_mode_sense10 | ( | void * | udev,
 |  | uint8_t | lun )

bulk-only transport scsi command mode sense10

Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type
Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type

Definition at line 457 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by bot_scsi_cmd_process().

◆ bot_scsi_mode_sense6()

usb_sts_type bot_scsi_mode_sense6 | ( | void * | udev,
 |  | uint8_t | lun )

bulk-only transport scsi command mode sense6

Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type
Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type

Definition at line 437 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by bot_scsi_cmd_process().

◆ bot_scsi_read10()

usb_sts_type bot_scsi_read10 | ( | void * | udev,
 |  | uint8_t | lun )

bulk-only transport scsi command read10

Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type
Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type

Definition at line 598 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by bot_scsi_cmd_process().

◆ bot_scsi_request_sense()

usb_sts_type bot_scsi_request_sense | ( | void * | udev,
 |  | uint8_t | lun )

bulk-only transport scsi command request sense

Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type
Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type

Definition at line 539 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by bot_scsi_cmd_process().

◆ bot_scsi_reset()

void bot_scsi_reset ( void * udev )

reset bulk-only transport and scsi

Parameters
udev to the structure of usbd_core_type
Return values
none
Parameters
udev to the structure of usbd_core_type
Return values
none

Definition at line 125 of file composite_cdc_msc/msc_bot_scsi.c.

◆ bot_scsi_send_csw()

void bot_scsi_send_csw | ( | void * | udev,
 |  | uint8_t | status )

send command status

Parameters
udev | to the structure of usbd_core_type
status | csw status
Return values
none
Parameters
udev | to the structure of usbd_core_type
status | csw status
Return values
none

Definition at line 264 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by bot_cbw_decode(), bot_scsi_clear_feature(), bot_scsi_datain_handler(), bot_scsi_dataout_handler(), and bot_scsi_write10().

◆ bot_scsi_send_data()

void bot_scsi_send_data | ( | void * | udev,
 |  | uint8_t * | buffer,
 |  | uint32_t | len )

send bot data

Parameters
udev | to the structure of usbd_core_type
buffer | data buffer
len | data len
Return values
none
Parameters
udev | to the structure of usbd_core_type
buffer | data buffer
len | data len
Return values
none

Definition at line 243 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by bot_cbw_decode().

◆ bot_scsi_sense_code()

void bot_scsi_sense_code | ( | void * | udev,
 |  | uint8_t | sense_key,
 |  | uint8_t | asc )

send scsi sense code

Parameters
udev | to the structure of usbd_core_type
sense_key | sense key
asc | asc
Return values
none
Parameters
udev | to the structure of usbd_core_type
sense_key | sense key
asc | asc
Return values
none

Definition at line 288 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by bot_cbw_decode(), bot_scsi_check_address(), bot_scsi_cmd_process(), bot_scsi_read10(), bot_scsi_test_unit(), bot_scsi_verify(), and bot_scsi_write10().

◆ bot_scsi_stall()

void bot_scsi_stall ( void * udev )

bot endpoint stall

Parameters
udev to the structure of usbd_core_type
Return values
none
Parameters
udev to the structure of usbd_core_type
Return values
none

Definition at line 320 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by bot_cbw_decode().

◆ bot_scsi_start_stop()

usb_sts_type bot_scsi_start_stop | ( | void * | udev,
 |  | uint8_t | lun )

bulk-only transport scsi command start stop

Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type
Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type

Definition at line 409 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by bot_scsi_cmd_process().

◆ bot_scsi_test_unit()

usb_sts_type bot_scsi_test_unit | ( | void * | udev,
 |  | uint8_t | lun )

bulk-only transport scsi command test unit

Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type
Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type

Definition at line 346 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by bot_scsi_cmd_process().

◆ bot_scsi_verify()

usb_sts_type bot_scsi_verify | ( | void * | udev,
 |  | uint8_t | lun )

bulk-only transport scsi command verify

Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type
Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type

Definition at line 570 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by bot_scsi_cmd_process().

◆ bot_scsi_write10()

usb_sts_type bot_scsi_write10 | ( | void * | udev,
 |  | uint8_t | lun )

bulk-only transport scsi command write10

Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type
Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type

Definition at line 659 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by bot_scsi_cmd_process().


AT32F413 Firmwary Library: cbd_typical_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
cbd_typical_type Struct Reference
AT32F413_middlewares_usbd_class » USB_cdc_class | AT32F413_middlewares_usbd_class » USB_cdc_keyboard_class | AT32F413_middlewares_usbd_class » USB_cdc_msc_class » USB_cdc_class_exported_types | AT32F413_middlewares_usbd_class » USB_msc_bot_scsi » USB_msc_bot_scsi_definition

typical command block description More...

#include <cdc_msc_class.h>

Data Fields

uint8_t | opcode
uint8_t | lun
uint32_t | address
uint8_t | reserved1
uint32_t | alloc_length
uint16_t | reserved2

Detailed Description

typical command block description

Definition at line 161 of file cdc_msc_class.h.

The documentation for this struct was generated from the following files:
  • cdc_msc_class.h
  • msc_bot_scsi.h


AT32F413 Firmwary Library: cbd_extended_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
cbd_extended_type Struct Reference
AT32F413_middlewares_usbd_class » USB_cdc_class | AT32F413_middlewares_usbd_class » USB_cdc_keyboard_class | AT32F413_middlewares_usbd_class » USB_cdc_msc_class » USB_cdc_class_exported_types | AT32F413_middlewares_usbd_class » USB_msc_bot_scsi » USB_msc_bot_scsi_definition

extended command block description More...

#include <cdc_msc_class.h>

Data Fields

uint8_t | opcode
uint8_t | lun
uint32_t | address
uint8_t | reserved1
uint32_t | alloc_length
uint16_t | reserved2

Detailed Description

extended command block description

Definition at line 174 of file cdc_msc_class.h.

The documentation for this struct was generated from the following files:
  • cdc_msc_class.h
  • msc_bot_scsi.h


AT32F413 Firmwary Library: cbw_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
cbw_type Struct Reference
AT32F413_middlewares_usbd_class » USB_cdc_class | AT32F413_middlewares_usbd_class » USB_cdc_keyboard_class | AT32F413_middlewares_usbd_class » USB_cdc_msc_class » USB_cdc_class_exported_types | AT32F413_middlewares_usbd_class » USB_msc_bot_scsi » USB_msc_bot_scsi_definition

command block wrapper More...

#include <cdc_msc_class.h>

Data Fields

uint32_t | dCBWSignature
uint32_t | dCBWTage
uint32_t | dCBWDataTransferLength
uint8_t | bmCBWFlags
uint8_t | bCBWLUN
uint8_t | bCBWCBLength
uint8_t | CBWCB [16]

Detailed Description

command block wrapper

Definition at line 187 of file cdc_msc_class.h.

The documentation for this struct was generated from the following files:
  • cdc_msc_class.h
  • msc_bot_scsi.h


AT32F413 Firmwary Library: csw_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
csw_type Struct Reference
AT32F413_middlewares_usbd_class » USB_cdc_class | AT32F413_middlewares_usbd_class » USB_cdc_keyboard_class | AT32F413_middlewares_usbd_class » USB_cdc_msc_class » USB_cdc_class_exported_types | AT32F413_middlewares_usbd_class » USB_msc_bot_scsi » USB_msc_bot_scsi_definition

command block wrapper More...

#include <cdc_msc_class.h>

Data Fields

uint32_t | dCSWSignature
uint32_t | dCSWTag
uint32_t | dCSWDataResidue
uint32_t | bCSWStatus

Detailed Description

command block wrapper

Definition at line 201 of file cdc_msc_class.h.

The documentation for this struct was generated from the following files:
  • cdc_msc_class.h
  • msc_bot_scsi.h


AT32F413 Firmwary Library: sense_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
sense_type Struct Reference
AT32F413_middlewares_usbd_class » USB_cdc_class | AT32F413_middlewares_usbd_class » USB_cdc_keyboard_class | AT32F413_middlewares_usbd_class » USB_cdc_msc_class » USB_cdc_class_exported_types | AT32F413_middlewares_usbd_class » USB_msc_bot_scsi » USB_msc_bot_scsi_definition

request sense standard data More...

#include <cdc_msc_class.h>

Data Fields

uint8_t | err_code
uint8_t | reserved1
uint8_t | sense_key
uint32_t | information
uint8_t | as_length
uint32_t | reserved2
uint8_t | asc
uint8_t | ascq
uint32_t | reserved3

Detailed Description

request sense standard data

Definition at line 212 of file cdc_msc_class.h.

The documentation for this struct was generated from the following files:
  • cdc_msc_class.h
  • msc_bot_scsi.h


AT32F413 Firmwary Library: msc_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
msc_type Struct Reference
AT32F413_middlewares_usbd_class » USB_cdc_class | AT32F413_middlewares_usbd_class » USB_cdc_keyboard_class | AT32F413_middlewares_usbd_class » USB_cdc_msc_class » USB_cdc_class_exported_types | AT32F413_middlewares_usbd_class » USB_msc_bot_scsi » USB_msc_bot_scsi_definition

#include <cdc_msc_class.h>

Data Fields

uint8_t | msc_state
uint8_t | bot_status
uint32_t | max_lun
uint32_t | blk_nbr [1]
uint32_t | blk_size [1]
uint32_t | blk_addr
uint32_t | blk_len
uint32_t | data_len
uint8_t | data [4096]
uint32_t | alt_setting
cbw_type cbw_struct
csw_type csw_struct
uint64_t | blk_addr

Detailed Description

Definition at line 226 of file cdc_msc_class.h.

Field Documentation

◆ blk_addr

uint64_t msc_type::blk_addr

Definition at line 201 of file msc_bot_scsi.h.

The documentation for this struct was generated from the following files:
  • cdc_msc_class.h
  • msc_bot_scsi.h


AT32F413 Firmwary Library: cdc_msc_struct_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
cdc_msc_struct_type Struct Reference
AT32F413_middlewares_usbd_class » USB_cdc_class | AT32F413_middlewares_usbd_class » USB_cdc_keyboard_class | AT32F413_middlewares_usbd_class » USB_cdc_msc_class » USB_cdc_class_exported_types | AT32F413_middlewares_usbd_class » USB_msc_bot_scsi » USB_msc_bot_scsi_definition

usb cdc class struct More...

#include <cdc_msc_class.h>

Data Fields

uint32_t | alt_setting
uint8_t | g_rx_buff [0x40]
uint8_t | g_cmd [0x08]
uint8_t | g_req
uint16_t | g_len
uint16_t | g_rxlen
__IO uint8_t | g_tx_completed
__IO uint8_t | g_rx_completed
linecoding_type linecoding
uint8_t | msc_state
uint8_t | bot_status
uint32_t | max_lun
uint32_t | blk_nbr [1]
uint32_t | blk_size [1]
uint64_t | blk_addr
uint32_t | blk_len
uint32_t | data_len
uint8_t | data [4096]
cbw_type cbw_struct
csw_type csw_struct

Detailed Description

usb cdc class struct

Definition at line 251 of file cdc_msc_class.h.

The documentation for this struct was generated from the following file:
  • cdc_msc_class.h


AT32F413 Firmwary Library: USB_cdc_msc_class_exported_functions

Functions | Variables
USB_cdc_msc_class_exported_functions
AT32F413_middlewares_usbd_class » USB_cdc_class | AT32F413_middlewares_usbd_class » USB_cdc_keyboard_class | AT32F413_middlewares_usbd_class » USB_cdc_msc_class » USB_cdc_class_exported_types

Functions

uint16_t | usb_vcp_get_rxdata (void *udev, uint8_t *recv_data)
usb device class rx data process
error_status | usb_vcp_send_data (void *udev, uint8_t *send_data, uint16_t len)
usb device class send data
void | bot_scsi_init (void *udev)
initialize bulk-only transport and scsi
void | bot_scsi_reset (void *udev)
reset bulk-only transport and scsi
void | bot_scsi_datain_handler (void *pudev, uint8_t ept_num)
bulk-only transport data in handler
void | bot_scsi_dataout_handler (void *pudev, uint8_t ept_num)
bulk-only transport data out handler
void | bot_cbw_decode (void *udev)
bulk-only cbw decode
void | bot_scsi_send_data (void *udev, uint8_t *buffer, uint32_t len)
send bot data
void | bot_scsi_send_csw (void *udev, uint8_t status)
send command status
void | bot_scsi_sense_code (void *udev, uint8_t sense_key, uint8_t asc)
send scsi sense code
usb_sts_type | bot_scsi_check_address (void *udev, uint8_t lun, uint32_t blk_offset, uint32_t blk_count)
check address
void | bot_scsi_stall (void *udev)
bot endpoint stall
usb_sts_type | bot_scsi_cmd_process (void *udev)
bulk-only transport scsi command process
usb_sts_type | bot_scsi_test_unit (void *udev, uint8_t lun)
bulk-only transport scsi command test unit
usb_sts_type | bot_scsi_inquiry (void *udev, uint8_t lun)
bulk-only transport scsi command inquiry
usb_sts_type | bot_scsi_start_stop (void *udev, uint8_t lun)
bulk-only transport scsi command start stop
usb_sts_type | bot_scsi_allow_medium_removal (void *udev, uint8_t lun)
bulk-only transport scsi command meidum removal
usb_sts_type | bot_scsi_mode_sense6 (void *udev, uint8_t lun)
bulk-only transport scsi command mode sense6
usb_sts_type | bot_scsi_mode_sense10 (void *udev, uint8_t lun)
bulk-only transport scsi command mode sense10
usb_sts_type | bot_scsi_read10 (void *udev, uint8_t lun)
bulk-only transport scsi command read10
usb_sts_type | bot_scsi_capacity (void *udev, uint8_t lun)
bulk-only transport scsi command capacity
usb_sts_type | bot_scsi_format_capacity (void *udev, uint8_t lun)
bulk-only transport scsi command format capacity
usb_sts_type | bot_scsi_request_sense (void *udev, uint8_t lun)
bulk-only transport scsi command request sense
usb_sts_type | bot_scsi_verify (void *udev, uint8_t lun)
bulk-only transport scsi command verify
usb_sts_type | bot_scsi_write10 (void *udev, uint8_t lun)
bulk-only transport scsi command write10
void | bot_scsi_clear_feature (void *udev, uint8_t ept_num)
clear feature

Variables

usbd_class_handler cdc_msc_class_handler

Detailed Description

Function Documentation

◆ bot_cbw_decode()

void bot_cbw_decode ( void * udev )

bulk-only cbw decode

Parameters
udev to the structure of usbd_core_type
Return values
none
Parameters
udev to the structure of usbd_core_type
Return values
none

Definition at line 196 of file composite_cdc_msc/msc_bot_scsi.c.

◆ bot_scsi_allow_medium_removal()

usb_sts_type bot_scsi_allow_medium_removal | ( | void * | udev,
 |  | uint8_t | lun )

bulk-only transport scsi command meidum removal

Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type
Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type

Definition at line 423 of file composite_cdc_msc/msc_bot_scsi.c.

◆ bot_scsi_capacity()

usb_sts_type bot_scsi_capacity | ( | void * | udev,
 |  | uint8_t | lun )

bulk-only transport scsi command capacity

Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type
Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type

Definition at line 477 of file composite_cdc_msc/msc_bot_scsi.c.

◆ bot_scsi_check_address()

usb_sts_type bot_scsi_check_address | ( | void * | udev,
 |  | uint8_t | lun,
 |  | uint32_t | blk_offset,
 |  | uint32_t | blk_count )

check address

Parameters
udev | to the structure of usbd_core_type
lun | logical units number
blk_offset | blk offset address
blk_count | blk number
Return values
usb_sts_type
Parameters
udev | to the structure of usbd_core_type
lun | logical units number
blk_offset | blk offset address
blk_count | blk number
Return values
usb_sts_type

Definition at line 303 of file composite_cdc_msc/msc_bot_scsi.c.

◆ bot_scsi_clear_feature()

void bot_scsi_clear_feature | ( | void * | udev,
 |  | uint8_t | ept_num )

clear feature

Parameters
udev | to the structure of usbd_core_type
etp_num | endpoint number
Return values
status of usb_sts_type
Parameters
udev | to the structure of usbd_core_type
etp_num | endpoint number
Return values
status of usb_sts_type

Definition at line 729 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by class_setup_handler(), and msc_class_setup_handler().

◆ bot_scsi_cmd_process()

usb_sts_type bot_scsi_cmd_process ( void * udev )

bulk-only transport scsi command process

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type
Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 749 of file composite_cdc_msc/msc_bot_scsi.c.

◆ bot_scsi_datain_handler()

void bot_scsi_datain_handler | ( | void * | udev,
 |  | uint8_t | ept_num )

bulk-only transport data in handler

Parameters
udev | to the structure of usbd_core_type
ept_num | endpoint number
Return values
none
Parameters
udev | to the structure of usbd_core_type
ept_num | endpoint number
Return values
none

Definition at line 143 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by class_in_handler(), and class_in_handler().

◆ bot_scsi_dataout_handler()

void bot_scsi_dataout_handler | ( | void * | udev,
 |  | uint8_t | ept_num )

bulk-only transport data out handler

Parameters
udev | to the structure of usbd_core_type
ept_num | endpoint number
Return values
none
Parameters
udev | to the structure of usbd_core_type
ept_num | endpoint number
Return values
none

Definition at line 172 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by class_out_handler(), and class_out_handler().

◆ bot_scsi_format_capacity()

usb_sts_type bot_scsi_format_capacity | ( | void * | udev,
 |  | uint8_t | lun )

bulk-only transport scsi command format capacity

Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type
Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type

Definition at line 504 of file composite_cdc_msc/msc_bot_scsi.c.

◆ bot_scsi_init()

void bot_scsi_init ( void * udev )

initialize bulk-only transport and scsi

Parameters
udev to the structure of usbd_core_type
Return values
none
Parameters
udev to the structure of usbd_core_type
Return values
none

Definition at line 103 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by class_init_handler(), and class_init_handler().

◆ bot_scsi_inquiry()

usb_sts_type bot_scsi_inquiry | ( | void * | udev,
 |  | uint8_t | lun )

bulk-only transport scsi command inquiry

Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type
Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type

Definition at line 368 of file composite_cdc_msc/msc_bot_scsi.c.

◆ bot_scsi_mode_sense10()

usb_sts_type bot_scsi_mode_sense10 | ( | void * | udev,
 |  | uint8_t | lun )

bulk-only transport scsi command mode sense10

Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type
Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type

Definition at line 457 of file composite_cdc_msc/msc_bot_scsi.c.

◆ bot_scsi_mode_sense6()

usb_sts_type bot_scsi_mode_sense6 | ( | void * | udev,
 |  | uint8_t | lun )

bulk-only transport scsi command mode sense6

Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type
Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type

Definition at line 437 of file composite_cdc_msc/msc_bot_scsi.c.

◆ bot_scsi_read10()

usb_sts_type bot_scsi_read10 | ( | void * | udev,
 |  | uint8_t | lun )

bulk-only transport scsi command read10

Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type
Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type

Definition at line 598 of file composite_cdc_msc/msc_bot_scsi.c.

◆ bot_scsi_request_sense()

usb_sts_type bot_scsi_request_sense | ( | void * | udev,
 |  | uint8_t | lun )

bulk-only transport scsi command request sense

Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type
Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type

Definition at line 539 of file composite_cdc_msc/msc_bot_scsi.c.

◆ bot_scsi_reset()

void bot_scsi_reset ( void * udev )

reset bulk-only transport and scsi

Parameters
udev to the structure of usbd_core_type
Return values
none
Parameters
udev to the structure of usbd_core_type
Return values
none

Definition at line 125 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by class_setup_handler(), and msc_class_setup_handler().

◆ bot_scsi_send_csw()

void bot_scsi_send_csw | ( | void * | udev,
 |  | uint8_t | status )

send command status

Parameters
udev | to the structure of usbd_core_type
status | csw status
Return values
none
Parameters
udev | to the structure of usbd_core_type
status | csw status
Return values
none

Definition at line 264 of file composite_cdc_msc/msc_bot_scsi.c.

◆ bot_scsi_send_data()

void bot_scsi_send_data | ( | void * | udev,
 |  | uint8_t * | buffer,
 |  | uint32_t | len )

send bot data

Parameters
udev | to the structure of usbd_core_type
buffer | data buffer
len | data len
Return values
none
Parameters
udev | to the structure of usbd_core_type
buffer | data buffer
len | data len
Return values
none

Definition at line 243 of file composite_cdc_msc/msc_bot_scsi.c.

◆ bot_scsi_sense_code()

void bot_scsi_sense_code | ( | void * | udev,
 |  | uint8_t | sense_key,
 |  | uint8_t | asc )

send scsi sense code

Parameters
udev | to the structure of usbd_core_type
sense_key | sense key
asc | asc
Return values
none
Parameters
udev | to the structure of usbd_core_type
sense_key | sense key
asc | asc
Return values
none

Definition at line 288 of file composite_cdc_msc/msc_bot_scsi.c.

◆ bot_scsi_stall()

void bot_scsi_stall ( void * udev )

bot endpoint stall

Parameters
udev to the structure of usbd_core_type
Return values
none
Parameters
udev to the structure of usbd_core_type
Return values
none

Definition at line 320 of file composite_cdc_msc/msc_bot_scsi.c.

◆ bot_scsi_start_stop()

usb_sts_type bot_scsi_start_stop | ( | void * | udev,
 |  | uint8_t | lun )

bulk-only transport scsi command start stop

Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type
Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type

Definition at line 409 of file composite_cdc_msc/msc_bot_scsi.c.

◆ bot_scsi_test_unit()

usb_sts_type bot_scsi_test_unit | ( | void * | udev,
 |  | uint8_t | lun )

bulk-only transport scsi command test unit

Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type
Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type

Definition at line 346 of file composite_cdc_msc/msc_bot_scsi.c.

◆ bot_scsi_verify()

usb_sts_type bot_scsi_verify | ( | void * | udev,
 |  | uint8_t | lun )

bulk-only transport scsi command verify

Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type
Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type

Definition at line 570 of file composite_cdc_msc/msc_bot_scsi.c.

◆ bot_scsi_write10()

usb_sts_type bot_scsi_write10 | ( | void * | udev,
 |  | uint8_t | lun )

bulk-only transport scsi command write10

Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type
Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type

Definition at line 659 of file composite_cdc_msc/msc_bot_scsi.c.

◆ usb_vcp_get_rxdata()

uint16_t usb_vcp_get_rxdata | ( | void * | udev,
 |  | uint8_t * | recv_data )

usb device class rx data process

Parameters
udev | to the structure of usbd_core_type
recv_data | receive buffer
Return values
receive data len
Parameters
udev | to the structure of usbd_core_type
recv_data | receive buffer
Return values
receive data len

Definition at line 344 of file cdc_class.c.

Referenced by main().

◆ usb_vcp_send_data()

error_status usb_vcp_send_data | ( | void * | udev,
 |  | uint8_t * | send_data,
 |  | uint16_t | len )

usb device class send data

Parameters
udev | to the structure of usbd_core_type
send_data | send data buffer
len | send length
Return values
error status
Parameters
udev | to the structure of usbd_core_type
send_data | send data buffer
len | send length
Return values
error status

Definition at line 374 of file cdc_class.c.

Referenced by main().

Variable Documentation

◆ cdc_msc_class_handler

usbd_class_handler cdc_msc_class_handler
extern

Definition at line 71 of file cdc_msc_class.c.

Referenced by main().


AT32F413 Firmwary Library: cdc_struct_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
cdc_struct_type Struct Reference
AT32F413_middlewares_usbd_class » USB_cdc_class | AT32F413_middlewares_usbd_class » USB_cdc_keyboard_class | AT32F413_middlewares_usbd_class » USB_cdc_msc_class » USB_cdc_class_exported_types

usb cdc class struct More...

#include <cdc_class.h>

Data Fields

uint32_t | alt_setting
uint8_t | g_rx_buff [0x40]
uint8_t | g_cmd [0x08]
uint8_t | g_req
uint16_t | g_len
uint16_t | g_rxlen
__IO uint8_t | g_tx_completed
__IO uint8_t | g_rx_completed
linecoding_type linecoding

Detailed Description

usb cdc class struct

Definition at line 74 of file cdc_class.h.

Field Documentation

◆ alt_setting

uint32_t cdc_struct_type::alt_setting

Definition at line 76 of file cdc_class.h.

Referenced by cdc_struct_init(), and class_setup_handler().

◆ g_cmd

uint8_t cdc_struct_type::g_cmd[0x08]

Definition at line 78 of file cdc_class.h.

Referenced by class_ept0_rx_handler(), and class_setup_handler().

◆ g_len

uint16_t cdc_struct_type::g_len

Definition at line 80 of file cdc_class.h.

Referenced by class_setup_handler().

◆ g_req

uint8_t cdc_struct_type::g_req

Definition at line 79 of file cdc_class.h.

Referenced by class_ept0_rx_handler(), and class_setup_handler().

◆ g_rx_buff

uint8_t cdc_struct_type::g_rx_buff[0x40]

Definition at line 77 of file cdc_class.h.

Referenced by class_init_handler(), and usb_vcp_get_rxdata().

◆ g_rx_completed

__IO uint8_t cdc_struct_type::g_rx_completed

Definition at line 81 of file cdc_class.h.

Referenced by cdc_struct_init(), class_out_handler(), and usb_vcp_get_rxdata().

◆ g_rxlen

uint16_t cdc_struct_type::g_rxlen

Definition at line 80 of file cdc_class.h.

Referenced by class_out_handler(), and usb_vcp_get_rxdata().

◆ g_tx_completed

__IO uint8_t cdc_struct_type::g_tx_completed

Definition at line 81 of file cdc_class.h.

Referenced by cdc_struct_init(), class_in_handler(), and usb_vcp_send_data().

◆ linecoding

linecoding_type cdc_struct_type::linecoding

Definition at line 82 of file cdc_class.h.

Referenced by cdc_struct_init(), and usb_vcp_cmd_process().

The documentation for this struct was generated from the following file:
  • cdc_class.h


AT32F413 Firmwary Library: vcp_keyboard_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
vcp_keyboard_type Struct Reference
AT32F413_middlewares_usbd_class » USB_cdc_class | AT32F413_middlewares_usbd_class » USB_cdc_keyboard_class | AT32F413_middlewares_usbd_class » USB_cdc_msc_class » USB_cdc_class_exported_types

#include <cdc_keyboard_class.h>

Data Fields

uint32_t | alt_setting
uint32_t | hid_protocol
uint32_t | hid_set_idle
uint8_t | hid_set_report [64]
uint8_t | g_rx_buff [0x40]
uint8_t | g_cmd [0x08]
uint8_t | g_req
uint8_t | hid_state
uint16_t | g_len
uint16_t | g_rxlen
__IO uint8_t | g_tx_completed
__IO uint8_t | g_rx_completed
__IO uint8_t | g_keyboard_tx_completed
linecoding_type linecoding

Detailed Description

Definition at line 73 of file cdc_keyboard_class.h.

Field Documentation

◆ alt_setting

uint32_t vcp_keyboard_type::alt_setting

Definition at line 75 of file cdc_keyboard_class.h.

Referenced by cdc_class_setup_handler(), and keyboard_class_setup_handler().

◆ g_cmd

uint8_t vcp_keyboard_type::g_cmd[0x08]

Definition at line 81 of file cdc_keyboard_class.h.

Referenced by cdc_class_setup_handler(), and class_ept0_rx_handler().

◆ g_keyboard_tx_completed

__IO uint8_t vcp_keyboard_type::g_keyboard_tx_completed

Definition at line 87 of file cdc_keyboard_class.h.

Referenced by class_in_handler(), class_init_handler(), and keyboard_send_string().

◆ g_len

uint16_t vcp_keyboard_type::g_len

Definition at line 84 of file cdc_keyboard_class.h.

Referenced by cdc_class_setup_handler().

◆ g_req

uint8_t vcp_keyboard_type::g_req

Definition at line 82 of file cdc_keyboard_class.h.

Referenced by cdc_class_setup_handler(), and class_ept0_rx_handler().

◆ g_rx_buff

uint8_t vcp_keyboard_type::g_rx_buff[0x40]

Definition at line 80 of file cdc_keyboard_class.h.

Referenced by class_init_handler(), and usb_vcpkybrd_vcp_get_rxdata().

◆ g_rx_completed

__IO uint8_t vcp_keyboard_type::g_rx_completed

Definition at line 86 of file cdc_keyboard_class.h.

Referenced by class_out_handler(), and usb_vcpkybrd_vcp_get_rxdata().

◆ g_rxlen

uint16_t vcp_keyboard_type::g_rxlen

Definition at line 84 of file cdc_keyboard_class.h.

Referenced by class_out_handler(), and usb_vcpkybrd_vcp_get_rxdata().

◆ g_tx_completed

__IO uint8_t vcp_keyboard_type::g_tx_completed

Definition at line 85 of file cdc_keyboard_class.h.

Referenced by class_in_handler(), class_init_handler(), and usb_vcpkybrd_vcp_send_data().

◆ hid_protocol

uint32_t vcp_keyboard_type::hid_protocol

Definition at line 76 of file cdc_keyboard_class.h.

Referenced by keyboard_class_setup_handler().

◆ hid_set_idle

uint32_t vcp_keyboard_type::hid_set_idle

Definition at line 77 of file cdc_keyboard_class.h.

Referenced by keyboard_class_setup_handler().

◆ hid_set_report

uint8_t vcp_keyboard_type::hid_set_report[64]

Definition at line 79 of file cdc_keyboard_class.h.

Referenced by keyboard_class_setup_handler().

◆ hid_state

uint8_t vcp_keyboard_type::hid_state

Definition at line 83 of file cdc_keyboard_class.h.

Referenced by class_ept0_rx_handler(), and keyboard_class_setup_handler().

◆ linecoding

linecoding_type vcp_keyboard_type::linecoding

Definition at line 89 of file cdc_keyboard_class.h.

Referenced by class_init_handler(), and usb_vcp_cmd_process().

The documentation for this struct was generated from the following file:
  • cdc_keyboard_class.h


AT32F413 Firmwary Library: USB_cdc_class_exported_functions

Functions | Variables
USB_cdc_class_exported_functions
AT32F413_middlewares_usbd_class » USB_cdc_class | AT32F413_middlewares_usbd_class » USB_winusb_class

Functions

uint16_t | usb_vcp_get_rxdata (void *udev, uint8_t *recv_data)
usb device class rx data process
error_status | usb_vcp_send_data (void *udev, uint8_t *send_data, uint16_t len)
usb device class send data
uint16_t | usb_winusb_get_rxdata (void *udev, uint8_t *recv_data)
usb device class rx data process
error_status | usb_winusb_send_data (void *udev, uint8_t *send_data, uint16_t len)
usb device class send data

Variables

usbd_class_handler cdc_class_handler
usbd_class_handler winusb_class_handler

Detailed Description

Function Documentation

◆ usb_vcp_get_rxdata()

uint16_t usb_vcp_get_rxdata | ( | void * | udev,
 |  | uint8_t * | recv_data )

usb device class rx data process

Parameters
udev | to the structure of usbd_core_type
recv_data | receive buffer
Return values
receive data len
Parameters
udev | to the structure of usbd_core_type
recv_data | receive buffer
Return values
receive data len

Definition at line 344 of file cdc_class.c.

◆ usb_vcp_send_data()

error_status usb_vcp_send_data | ( | void * | udev,
 |  | uint8_t * | send_data,
 |  | uint16_t | len )

usb device class send data

Parameters
udev | to the structure of usbd_core_type
send_data | send data buffer
len | send length
Return values
error status
Parameters
udev | to the structure of usbd_core_type
send_data | send data buffer
len | send length
Return values
error status

Definition at line 374 of file cdc_class.c.

◆ usb_winusb_get_rxdata()

uint16_t usb_winusb_get_rxdata | ( | void * | udev,
 |  | uint8_t * | recv_data )

usb device class rx data process

Parameters
udev | to the structure of usbd_core_type
recv_data | receive buffer
Return values
receive data len

Definition at line 356 of file winusb_class.c.

Referenced by main().

◆ usb_winusb_send_data()

error_status usb_winusb_send_data | ( | void * | udev,
 |  | uint8_t * | send_data,
 |  | uint16_t | len )

usb device class send data

Parameters
udev | to the structure of usbd_core_type
send_data | send data buffer
len | send length
Return values
error status

Definition at line 386 of file winusb_class.c.

Referenced by main().

Variable Documentation

◆ cdc_class_handler

usbd_class_handler cdc_class_handler
extern

Definition at line 68 of file cdc_class.c.

Referenced by main().

◆ winusb_class_handler

usbd_class_handler winusb_class_handler
extern

Definition at line 66 of file winusb_class.c.

Referenced by main().


AT32F413 Firmwary Library: USB_cdc_desc

Topics | Variables
USB_cdc_desc
AT32F413_middlewares_usbd_class

usb device cdc descriptor More...

Topics

USB_cdc_desc_private_functions
USB_cdc_desc_definition

Variables

usbd_desc_handler cdc_desc_handler
device descriptor handler structure

Detailed Description

usb device cdc descriptor

Variable Documentation

◆ cdc_desc_handler

usbd_desc_handler cdc_desc_handler
extern

device descriptor handler structure

Definition at line 65 of file cdc_desc.c.

Referenced by main().


AT32F413 Firmwary Library: USB_cdc_desc_private_functions

Functions | Variables
USB_cdc_desc_private_functions
AT32F413_middlewares_usbd_class » USB_cdc_desc

Functions

static usbd_desc_t * | get_device_descriptor (void)
get device descriptor
static usbd_desc_t * | get_device_qualifier (void)
get device qualifier
static usbd_desc_t * | get_device_configuration (void)
get config descriptor
static usbd_desc_t * | get_device_other_speed (void)
get other speed descriptor
static usbd_desc_t * | get_device_lang_id (void)
get lang id descriptor
static usbd_desc_t * | get_device_manufacturer_string (void)
get manufacturer descriptor
static usbd_desc_t * | get_device_product_string (void)
get product descriptor
static usbd_desc_t * | get_device_serial_string (void)
get serial descriptor
static usbd_desc_t * | get_device_interface_string (void)
get interface descriptor
static usbd_desc_t * | get_device_config_string (void)
get device config descriptor
static uint16_t | usbd_unicode_convert (uint8_t *string, uint8_t *unicode_buf)
standard usb unicode convert
static void | usbd_int_to_unicode (uint32_t value, uint8_t *pbuf, uint8_t len)
usb int convert to unicode
static void | get_serial_num (void)
usb get serial number

Variables

static ALIGNED_HEAD uint8_t g_usbd_desc_buffer[256] | ALIGNED_TAIL
usb device standard descriptor
usbd_desc_handler cdc_desc_handler
device descriptor handler structure
static usbd_desc_t | device_descriptor
static usbd_desc_t | config_descriptor
static usbd_desc_t | langid_descriptor
static usbd_desc_t | serial_descriptor
static usbd_desc_t | vp_desc

Detailed Description

Function Documentation

◆ get_device_config_string()

static usbd_desc_t * get_device_config_string ( void )
static

get device config descriptor

Parameters
none
Return values
usbd_desc

Definition at line 430 of file cdc_desc.c.

◆ get_device_configuration()

static usbd_desc_t * get_device_configuration ( void )
static

get config descriptor

Parameters
none
Return values
usbd_desc

Definition at line 352 of file cdc_desc.c.

◆ get_device_descriptor()

static usbd_desc_t * get_device_descriptor ( void )
static

get device descriptor

Parameters
none
Return values
usbd_desc

Definition at line 332 of file cdc_desc.c.

◆ get_device_interface_string()

static usbd_desc_t * get_device_interface_string ( void )
static

get interface descriptor

Parameters
none
Return values
usbd_desc

Definition at line 418 of file cdc_desc.c.

◆ get_device_lang_id()

static usbd_desc_t * get_device_lang_id ( void )
static

get lang id descriptor

Parameters
none
Return values
usbd_desc

Definition at line 372 of file cdc_desc.c.

◆ get_device_manufacturer_string()

static usbd_desc_t * get_device_manufacturer_string ( void )
static

get manufacturer descriptor

Parameters
none
Return values
usbd_desc

Definition at line 383 of file cdc_desc.c.

◆ get_device_other_speed()

static usbd_desc_t * get_device_other_speed ( void )
static

get other speed descriptor

Parameters
none
Return values
usbd_desc

Definition at line 362 of file cdc_desc.c.

◆ get_device_product_string()

static usbd_desc_t * get_device_product_string ( void )
static

get product descriptor

Parameters
none
Return values
usbd_desc

Definition at line 395 of file cdc_desc.c.

◆ get_device_qualifier()

static usbd_desc_t * get_device_qualifier ( void )
static

get device qualifier

Parameters
none
Return values
usbd_desc

Definition at line 342 of file cdc_desc.c.

◆ get_device_serial_string()

static usbd_desc_t * get_device_serial_string ( void )
static

get serial descriptor

Parameters
none
Return values
usbd_desc

Definition at line 407 of file cdc_desc.c.

◆ get_serial_num()

static void get_serial_num ( void )
static

usb get serial number

Parameters
none
Return values
none

Definition at line 310 of file cdc_desc.c.

Referenced by get_device_serial_string().

◆ usbd_int_to_unicode()

static void usbd_int_to_unicode | ( | uint32_t | value,
 |  | uint8_t * | pbuf,
 |  | uint8_t | len )
 static

usb int convert to unicode

Parameters
value | int value
pbus | unicode buffer
len | length
Return values
none

Definition at line 284 of file cdc_desc.c.

Referenced by get_serial_num().

◆ usbd_unicode_convert()

static uint16_t usbd_unicode_convert | ( | uint8_t * | string,
 |  | uint8_t * | unicode_buf )
 static

standard usb unicode convert

Parameters
string | source string
unicode_buf | unicode buffer
Return values
length

Definition at line 258 of file cdc_desc.c.

Referenced by get_device_config_string(), get_device_interface_string(), get_device_manufacturer_string(), and get_device_product_string().

Variable Documentation

◆ ALIGNED_TAIL

ALIGNED_HEAD uint8_t g_string_serial [ 0x1A ] ALIGNED_TAIL
static
Initial value:
=
{
USB_DEVICE_DESC_LEN,
USB_DESCIPTOR_TYPE_DEVICE,
0x00,
0x02,
0x02,
0x00,
0x00,
USB_MAX_EP0_SIZE,
LBYTE( 0x2E3C ),
HBYTE( 0x2E3C ),
LBYTE( 0x5740 ),
HBYTE( 0x5740 ),
0x00,
0x02,
USB_MFC_STRING,
USB_PRODUCT_STRING,
USB_SERIAL_STRING,
1
}
HBYTE
#define HBYTE(x)
Definition usb_std.h:271
USB_MAX_EP0_SIZE
#define USB_MAX_EP0_SIZE
endpoint 0 max size
Definition usb_std.h:248
USB_PRODUCT_STRING
#define USB_PRODUCT_STRING
Definition usb_std.h:105
LBYTE
#define LBYTE(x)
low byte and high byte define
Definition usb_std.h:270
USB_DEVICE_DESC_LEN
#define USB_DEVICE_DESC_LEN
Definition usb_std.h:156
USB_MFC_STRING
#define USB_MFC_STRING
Definition usb_std.h:104
USB_SERIAL_STRING
#define USB_SERIAL_STRING
Definition usb_std.h:106
USB_DESCIPTOR_TYPE_DEVICE
#define USB_DESCIPTOR_TYPE_DEVICE
usb standard device type
Definition usb_std.h:91

usb device standard descriptor

usb string serial

usb string lang id

usb configuration standard descriptor

Definition at line 60 of file cdc_desc.c.

◆ cdc_desc_handler

usbd_desc_handler cdc_desc_handler
Initial value:
=
{
get_device_descriptor,
get_device_qualifier,
get_device_configuration,
get_device_other_speed,
get_device_lang_id,
get_device_manufacturer_string,
get_device_product_string,
get_device_serial_string,
get_device_interface_string,
get_device_config_string,
}
get_device_configuration
static usbd_desc_t * get_device_configuration(void)
get config descriptor
Definition cdc_desc.c:352
get_device_descriptor
static usbd_desc_t * get_device_descriptor(void)
get device descriptor
Definition cdc_desc.c:332
get_device_manufacturer_string
static usbd_desc_t * get_device_manufacturer_string(void)
get manufacturer descriptor
Definition cdc_desc.c:383
get_device_qualifier
static usbd_desc_t * get_device_qualifier(void)
get device qualifier
Definition cdc_desc.c:342
get_device_interface_string
static usbd_desc_t * get_device_interface_string(void)
get interface descriptor
Definition cdc_desc.c:418
get_device_other_speed
static usbd_desc_t * get_device_other_speed(void)
get other speed descriptor
Definition cdc_desc.c:362
get_device_product_string
static usbd_desc_t * get_device_product_string(void)
get product descriptor
Definition cdc_desc.c:395
get_device_config_string
static usbd_desc_t * get_device_config_string(void)
get device config descriptor
Definition cdc_desc.c:430
get_device_lang_id
static usbd_desc_t * get_device_lang_id(void)
get lang id descriptor
Definition cdc_desc.c:372
get_device_serial_string
static usbd_desc_t * get_device_serial_string(void)
get serial descriptor
Definition cdc_desc.c:407

device descriptor handler structure

Definition at line 65 of file cdc_desc.c.

Referenced by main().

◆ config_descriptor

usbd_desc_t config_descriptor
static
Initial value:
=
{
67 ,
g_usbd_configuration
}

Definition at line 230 of file cdc_desc.c.

Referenced by get_device_configuration().

◆ device_descriptor

usbd_desc_t device_descriptor
static
Initial value:
=
{
USB_DEVICE_DESC_LEN,
g_usbd_descriptor
}

Definition at line 223 of file cdc_desc.c.

Referenced by get_device_descriptor().

◆ langid_descriptor

usbd_desc_t langid_descriptor
static
Initial value:
=
{
4 ,
g_string_lang_id
}

Definition at line 237 of file cdc_desc.c.

Referenced by get_device_lang_id().

◆ serial_descriptor

usbd_desc_t serial_descriptor
static
Initial value:
=
{
0x1A ,
g_string_serial
}

Definition at line 244 of file cdc_desc.c.

Referenced by get_device_serial_string().

◆ vp_desc

usbd_desc_t vp_desc
static

Definition at line 250 of file cdc_desc.c.

Referenced by get_device_config_string(), get_device_interface_string(), get_device_manufacturer_string(), and get_device_product_string().


AT32F413 Firmwary Library: USB_cdc_desc_definition

Macros
USB_cdc_desc_definition
AT32F413_middlewares_usbd_class » USB_cdc_desc | AT32F413_middlewares_usbd_class » USB_cdc_msc_desc

Macros

#define | CDC_BCD_NUM 0x0110
usb bcd number define
#define | USBD_CDC_VENDOR_ID 0x2E3C
usb vendor id and product id define
#define | USBD_CDC_PRODUCT_ID 0x5740
#define | USBD_CDC_CONFIG_DESC_SIZE 67
usb descriptor size define
#define | USBD_CDC_SIZ_STRING_LANGID 4
#define | USBD_CDC_SIZ_STRING_SERIAL 0x1A
#define | USBD_CDC_DESC_MANUFACTURER_STRING "Artery"
usb string define(vendor, product configuration, interface)
#define | USBD_CDC_DESC_PRODUCT_STRING "AT32 Virtual Com Port "
#define | USBD_CDC_DESC_CONFIGURATION_STRING "Virtual ComPort Config"
#define | USBD_CDC_DESC_INTERFACE_STRING "Virtual ComPort Interface"
#define | CDC_HID_BINTERVAL_TIME 0xFF
usb endpoint interval define
#define | MCU_ID1 (0x1FFFF7E8)
usb mcu id address deine
#define | MCU_ID2 (0x1FFFF7EC)
#define | MCU_ID3 (0x1FFFF7F0)
#define | CDC_BCD_NUM 0x0110
usb bcd number define
#define | USBD_CDC_MSC_VENDOR_ID 0x2E3C
usb vendor id and product id define
#define | USBD_CDC_MSC_PRODUCT_ID 0x5760
#define | USBD_CDC_MSC_CONFIG_DESC_SIZE 106
usb descriptor size define
#define | USBD_CDC_SIZ_STRING_LANGID 4
#define | USBD_CDC_SIZ_STRING_SERIAL 0x1A
#define | USBD_CDC_DESC_MANUFACTURER_STRING "Artery"
usb string define(vendor, product configuration, interface)
#define | USBD_CDC_DESC_PRODUCT_STRING "AT32 Composite VCP and MSC "
#define | USBD_CDC_DESC_CONFIGURATION_STRING "Composite VCP and MSC Config"
#define | USBD_CDC_DESC_INTERFACE_STRING "Composite VCP and MSC Interface"
#define | CDC_HID_BINTERVAL_TIME 0xFF
usb endpoint interval define
#define | VCPMSC_MSC_INTERFACE 0x00
usb interface define
#define | VCPMSC_CDC_INTERFACE 0x01
#define | VCPMSC_CDC_DATA_INTERFACE 0x02
#define | MCU_ID1 (0x1FFFF7E8)
usb mcu id address deine
#define | MCU_ID2 (0x1FFFF7EC)
#define | MCU_ID3 (0x1FFFF7F0)

Detailed Description

Macro Definition Documentation

◆ CDC_BCD_NUM [1/2]

#define CDC_BCD_NUM 0x0110

usb bcd number define

Definition at line 51 of file cdc_desc.h.

◆ CDC_BCD_NUM [2/2]

#define CDC_BCD_NUM 0x0110

usb bcd number define

Definition at line 51 of file cdc_msc_desc.h.

◆ CDC_HID_BINTERVAL_TIME [1/2]

#define CDC_HID_BINTERVAL_TIME 0xFF

usb endpoint interval define

Definition at line 77 of file cdc_desc.h.

◆ CDC_HID_BINTERVAL_TIME [2/2]

#define CDC_HID_BINTERVAL_TIME 0xFF

usb endpoint interval define

Definition at line 78 of file cdc_msc_desc.h.

◆ MCU_ID1 [1/2]

#define MCU_ID1 (0x1FFFF7E8)

usb mcu id address deine

Definition at line 82 of file cdc_desc.h.

◆ MCU_ID1 [2/2]

#define MCU_ID1 (0x1FFFF7E8)

usb mcu id address deine

Definition at line 91 of file cdc_msc_desc.h.

◆ MCU_ID2 [1/2]

#define MCU_ID2 (0x1FFFF7EC)

Definition at line 83 of file cdc_desc.h.

◆ MCU_ID2 [2/2]

#define MCU_ID2 (0x1FFFF7EC)

Definition at line 92 of file cdc_msc_desc.h.

◆ MCU_ID3 [1/2]

#define MCU_ID3 (0x1FFFF7F0)

Definition at line 84 of file cdc_desc.h.

◆ MCU_ID3 [2/2]

#define MCU_ID3 (0x1FFFF7F0)

Definition at line 93 of file cdc_msc_desc.h.

◆ USBD_CDC_CONFIG_DESC_SIZE

#define USBD_CDC_CONFIG_DESC_SIZE 67

usb descriptor size define

Definition at line 62 of file cdc_desc.h.

◆ USBD_CDC_DESC_CONFIGURATION_STRING [1/2]

#define USBD_CDC_DESC_CONFIGURATION_STRING "Virtual ComPort Config"

Definition at line 71 of file cdc_desc.h.

Referenced by get_device_config_string(), and get_device_config_string().

◆ USBD_CDC_DESC_CONFIGURATION_STRING [2/2]

#define USBD_CDC_DESC_CONFIGURATION_STRING "Composite VCP and MSC Config"

Definition at line 72 of file cdc_msc_desc.h.

◆ USBD_CDC_DESC_INTERFACE_STRING [1/2]

#define USBD_CDC_DESC_INTERFACE_STRING "Virtual ComPort Interface"

Definition at line 72 of file cdc_desc.h.

Referenced by get_device_interface_string(), and get_device_interface_string().

◆ USBD_CDC_DESC_INTERFACE_STRING [2/2]

#define USBD_CDC_DESC_INTERFACE_STRING "Composite VCP and MSC Interface"

Definition at line 73 of file cdc_msc_desc.h.

◆ USBD_CDC_DESC_MANUFACTURER_STRING [1/2]

#define USBD_CDC_DESC_MANUFACTURER_STRING "Artery"

usb string define(vendor, product configuration, interface)

Definition at line 69 of file cdc_desc.h.

Referenced by get_device_manufacturer_string(), and get_device_manufacturer_string().

◆ USBD_CDC_DESC_MANUFACTURER_STRING [2/2]

#define USBD_CDC_DESC_MANUFACTURER_STRING "Artery"

usb string define(vendor, product configuration, interface)

Definition at line 70 of file cdc_msc_desc.h.

◆ USBD_CDC_DESC_PRODUCT_STRING [1/2]

#define USBD_CDC_DESC_PRODUCT_STRING "AT32 Virtual Com Port "

Definition at line 70 of file cdc_desc.h.

Referenced by get_device_product_string(), and get_device_product_string().

◆ USBD_CDC_DESC_PRODUCT_STRING [2/2]

#define USBD_CDC_DESC_PRODUCT_STRING "AT32 Composite VCP and MSC "

Definition at line 71 of file cdc_msc_desc.h.

◆ USBD_CDC_MSC_CONFIG_DESC_SIZE

#define USBD_CDC_MSC_CONFIG_DESC_SIZE 106

usb descriptor size define

Definition at line 63 of file cdc_msc_desc.h.

◆ USBD_CDC_MSC_PRODUCT_ID

#define USBD_CDC_MSC_PRODUCT_ID 0x5760

Definition at line 57 of file cdc_msc_desc.h.

◆ USBD_CDC_MSC_VENDOR_ID

#define USBD_CDC_MSC_VENDOR_ID 0x2E3C

usb vendor id and product id define

Definition at line 56 of file cdc_msc_desc.h.

◆ USBD_CDC_PRODUCT_ID

#define USBD_CDC_PRODUCT_ID 0x5740

Definition at line 57 of file cdc_desc.h.

◆ USBD_CDC_SIZ_STRING_LANGID [1/2]

#define USBD_CDC_SIZ_STRING_LANGID 4

Definition at line 63 of file cdc_desc.h.

◆ USBD_CDC_SIZ_STRING_LANGID [2/2]

#define USBD_CDC_SIZ_STRING_LANGID 4

Definition at line 64 of file cdc_msc_desc.h.

◆ USBD_CDC_SIZ_STRING_SERIAL [1/2]

#define USBD_CDC_SIZ_STRING_SERIAL 0x1A

Definition at line 64 of file cdc_desc.h.

◆ USBD_CDC_SIZ_STRING_SERIAL [2/2]

#define USBD_CDC_SIZ_STRING_SERIAL 0x1A

Definition at line 65 of file cdc_msc_desc.h.

◆ USBD_CDC_VENDOR_ID

#define USBD_CDC_VENDOR_ID 0x2E3C

usb vendor id and product id define

Definition at line 56 of file cdc_desc.h.

◆ VCPMSC_CDC_DATA_INTERFACE

#define VCPMSC_CDC_DATA_INTERFACE 0x02

Definition at line 85 of file cdc_msc_desc.h.

◆ VCPMSC_CDC_INTERFACE

#define VCPMSC_CDC_INTERFACE 0x01

Definition at line 84 of file cdc_msc_desc.h.

◆ VCPMSC_MSC_INTERFACE

#define VCPMSC_MSC_INTERFACE 0x00

usb interface define

Definition at line 83 of file cdc_msc_desc.h.

Referenced by class_setup_handler().


AT32F413 Firmwary Library: USB_cdc_keyboard_class

Topics
USB_cdc_keyboard_class
AT32F413_middlewares_usbd_class

usb device class composite cdc and keyboard More...

Topics

USB_cdc_keyboard_class_private_functions
USB_cdc_keyboard_class_definition
USB_cdc_class_exported_types
USB_cdc_keyboar_class_exported_functions

Detailed Description

usb device class composite cdc and keyboard


AT32F413 Firmwary Library: USB_cdc_keyboard_class_private_functions

Macros | Functions | Variables
USB_cdc_keyboard_class_private_functions
AT32F413_middlewares_usbd_class » USB_cdc_keyboard_class

Macros

#define SHIFT 0x80

Functions

static usb_sts_type | class_init_handler (void *udev)
initialize usb endpoint
static usb_sts_type | class_clear_handler (void *udev)
clear endpoint or other state
static usb_sts_type | class_setup_handler (void *udev, usb_setup_type *setup)
usb device class setup request handler
static usb_sts_type | class_ept0_tx_handler (void *udev)
usb device class endpoint 0 in status stage complete
static usb_sts_type | class_ept0_rx_handler (void *udev)
usb device class endpoint 0 out status stage complete
static usb_sts_type | class_in_handler (void *udev, uint8_t ept_num)
usb device class transmision complete handler
static usb_sts_type | class_out_handler (void *udev, uint8_t ept_num)
usb device class endpoint receive data
static usb_sts_type | class_sof_handler (void *udev)
usb device class sof handler
static usb_sts_type | class_event_handler (void *udev, usbd_event_type event)
usb device class event handler
static usb_sts_type | cdc_class_setup_handler (void *udev, usb_setup_type *setup)
usb device class setup request handler
static usb_sts_type | keyboard_class_setup_handler (void *udev, usb_setup_type *setup)
usb device class setup request handler
static void | usb_vcp_cmd_process (void *udev, uint8_t cmd, uint8_t *buff, uint16_t len)
usb device class request function
uint16_t | usb_vcpkybrd_vcp_get_rxdata (void *udev, uint8_t *recv_data)
usb device class rx data process
error_status | usb_vcpkybrd_vcp_send_data (void *udev, uint8_t *send_data, uint16_t len)
usb device class send data
usb_sts_type | usb_vcpkybrd_class_send_report (void *udev, uint8_t *report, uint16_t len)
usb device class send report
void | usb_vcpkybrd_keyboard_send_char (void *udev, uint8_t ascii_code)
usb keyoard send char

Variables

vcp_keyboard_type vcp_keyboard_struct
static const unsigned char _asciimap [128]
linecoding_type linecoding_vcpkybrd
usbd_class_handler cdc_keyboard_class_handler

Detailed Description

Macro Definition Documentation

◆ SHIFT

#define SHIFT 0x80

Definition at line 58 of file cdc_keyboard_class.c.

Referenced by usb_vcpkybrd_keyboard_send_char().

Function Documentation

◆ cdc_class_setup_handler()

static usb_sts_type cdc_class_setup_handler | ( | void * | udev,
 |  | usb_setup_type * | setup )
 static

usb device class setup request handler

Parameters
udev | to the structure of usbd_core_type
setup | setup packet
Return values
status of usb_sts_type

Definition at line 321 of file cdc_keyboard_class.c.

Referenced by class_setup_handler().

◆ class_clear_handler()

static usb_sts_type class_clear_handler ( void * udev )
static

clear endpoint or other state

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 266 of file cdc_keyboard_class.c.

◆ class_ept0_rx_handler()

static usb_sts_type class_ept0_rx_handler ( void * udev )
static

usb device class endpoint 0 out status stage complete

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 480 of file cdc_keyboard_class.c.

◆ class_ept0_tx_handler()

static usb_sts_type class_ept0_tx_handler ( void * udev )
static

usb device class endpoint 0 in status stage complete

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 466 of file cdc_keyboard_class.c.

◆ class_event_handler()

static usb_sts_type class_event_handler | ( | void * | udev,
 |  | usbd_event_type | event )
 static

usb device class event handler

Parameters
udev | to the structure of usbd_core_type
event | usb device event
Return values
status of usb_sts_type

Definition at line 570 of file cdc_keyboard_class.c.

◆ class_in_handler()

static usb_sts_type class_in_handler | ( | void * | udev,
 |  | uint8_t | ept_num )
 static

usb device class transmision complete handler

Parameters
udev | to the structure of usbd_core_type
ept_num | endpoint number
Return values
status of usb_sts_type

Definition at line 507 of file cdc_keyboard_class.c.

◆ class_init_handler()

static usb_sts_type class_init_handler ( void * udev )
static

initialize usb endpoint

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 223 of file cdc_keyboard_class.c.

◆ class_out_handler()

static usb_sts_type class_out_handler | ( | void * | udev,
 |  | uint8_t | ept_num )
 static

usb device class endpoint receive data

Parameters
udev | to the structure of usbd_core_type
ept_num | endpoint number
Return values
status of usb_sts_type

Definition at line 535 of file cdc_keyboard_class.c.

◆ class_setup_handler()

static usb_sts_type class_setup_handler | ( | void * | udev,
 |  | usb_setup_type * | setup )
 static

usb device class setup request handler

Parameters
udev | to the structure of usbd_core_type
setup | setup packet
Return values
status of usb_sts_type

Definition at line 292 of file cdc_keyboard_class.c.

◆ class_sof_handler()

static usb_sts_type class_sof_handler ( void * udev )
static

usb device class sof handler

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 555 of file cdc_keyboard_class.c.

◆ keyboard_class_setup_handler()

static usb_sts_type keyboard_class_setup_handler | ( | void * | udev,
 |  | usb_setup_type * | setup )
 static

usb device class setup request handler

Parameters
udev | to the structure of usbd_core_type
setup | setup packet
Return values
status of usb_sts_type

Definition at line 382 of file cdc_keyboard_class.c.

Referenced by class_setup_handler().

◆ usb_vcp_cmd_process()

static void usb_vcp_cmd_process | ( | void * | udev,
 |  | uint8_t | cmd,
 |  | uint8_t * | buff,
 |  | uint16_t | len )
 static

usb device class request function

Parameters
udev | to the structure of usbd_core_type
cmd | request number
buff | request buffer
len | buffer length
Return values
none

Definition at line 658 of file cdc_keyboard_class.c.

Referenced by cdc_class_setup_handler(), and class_ept0_rx_handler().

◆ usb_vcpkybrd_class_send_report()

usb_sts_type usb_vcpkybrd_class_send_report | ( | void * | udev,
 |  | uint8_t * | report,
 |  | uint16_t | len )

usb device class send report

Parameters
udev | to the structure of usbd_core_type
report | report buffer
len | report length
Return values
status of usb_sts_type

Definition at line 693 of file cdc_keyboard_class.c.

Referenced by usb_vcpkybrd_keyboard_send_char().

◆ usb_vcpkybrd_keyboard_send_char()

void usb_vcpkybrd_keyboard_send_char | ( | void * | udev,
 |  | uint8_t | ascii_code )

usb keyoard send char

Parameters
udev | to the structure of usbd_core_type
op | operation
Return values
none

Definition at line 711 of file cdc_keyboard_class.c.

Referenced by keyboard_send_string().

◆ usb_vcpkybrd_vcp_get_rxdata()

uint16_t usb_vcpkybrd_vcp_get_rxdata | ( | void * | udev,
 |  | uint8_t * | recv_data )

usb device class rx data process

Parameters
udev | to the structure of usbd_core_type
recv_data | receive buffer
Return values
receive data len

Definition at line 601 of file cdc_keyboard_class.c.

Referenced by main().

◆ usb_vcpkybrd_vcp_send_data()

error_status usb_vcpkybrd_vcp_send_data | ( | void * | udev,
 |  | uint8_t * | send_data,
 |  | uint16_t | len )

usb device class send data

Parameters
udev | to the structure of usbd_core_type
send_data | send data buffer
len | send length
Return values
error status

Definition at line 632 of file cdc_keyboard_class.c.

Referenced by main().

Variable Documentation

◆ _asciimap

const unsigned char _asciimap[128]
static

Definition at line 59 of file cdc_keyboard_class.c.

Referenced by usb_vcpkybrd_keyboard_send_char().

◆ cdc_keyboard_class_handler

usbd_class_handler cdc_keyboard_class_handler
Initial value:
=
{
class_init_handler,
class_clear_handler,
class_setup_handler,
class_ept0_tx_handler,
class_ept0_rx_handler,
class_in_handler,
class_out_handler,
class_sof_handler,
class_event_handler,
&vcp_keyboard_struct
}
class_sof_handler
static usb_sts_type class_sof_handler(void *udev)
usb device class sof handler
Definition cdc_keyboard_class.c:555
class_in_handler
static usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
usb device class transmision complete handler
Definition cdc_keyboard_class.c:507
class_clear_handler
static usb_sts_type class_clear_handler(void *udev)
clear endpoint or other state
Definition cdc_keyboard_class.c:266
class_setup_handler
static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
usb device class setup request handler
Definition cdc_keyboard_class.c:292
class_ept0_tx_handler
static usb_sts_type class_ept0_tx_handler(void *udev)
usb device class endpoint 0 in status stage complete
Definition cdc_keyboard_class.c:466
class_ept0_rx_handler
static usb_sts_type class_ept0_rx_handler(void *udev)
usb device class endpoint 0 out status stage complete
Definition cdc_keyboard_class.c:480
class_event_handler
static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
usb device class event handler
Definition cdc_keyboard_class.c:570
class_init_handler
static usb_sts_type class_init_handler(void *udev)
initialize usb endpoint
Definition cdc_keyboard_class.c:223
class_out_handler
static usb_sts_type class_out_handler(void *udev, uint8_t ept_num)
usb device class endpoint receive data
Definition cdc_keyboard_class.c:535
vcp_keyboard_struct
vcp_keyboard_type vcp_keyboard_struct
Definition cdc_keyboard_class.c:56

Definition at line 204 of file cdc_keyboard_class.c.

Referenced by main().

◆ linecoding_vcpkybrd

linecoding_type linecoding_vcpkybrd
Initial value:
=
{
115200,
0x00,
0x00,
0x08
}

Definition at line 192 of file cdc_keyboard_class.c.

Referenced by class_init_handler().

◆ vcp_keyboard_struct

vcp_keyboard_type vcp_keyboard_struct

Definition at line 56 of file cdc_keyboard_class.c.


AT32F413 Firmwary Library: USB_cdc_keyboard_class_definition

Macros
USB_cdc_keyboard_class_definition
AT32F413_middlewares_usbd_class » USB_cdc_keyboard_class

Macros

#define | USBD_VCPKYBRD_CDC_INT_EPT 0x82
usb use endpoint define
#define | USBD_VCPKYBRD_CDC_BULK_IN_EPT 0x81
#define | USBD_VCPKYBRD_CDC_BULK_OUT_EPT 0x01
#define | USBD_VCPKYBRD_HID_IN_EPT 0x83
#define | USBD_VCPKYBRD_IN_MAXPACKET_SIZE 0x40
usb in and out max packet size define
#define | USBD_VCPKYBRD_OUT_MAXPACKET_SIZE 0x40
#define | USBD_VCPKYBRD_CMD_MAXPACKET_SIZE 0x08

Detailed Description

Macro Definition Documentation

◆ USBD_VCPKYBRD_CDC_BULK_IN_EPT

#define USBD_VCPKYBRD_CDC_BULK_IN_EPT 0x81

Definition at line 53 of file cdc_keyboard_class.h.

Referenced by class_clear_handler(), class_in_handler(), class_init_handler(), and usb_vcpkybrd_vcp_send_data().

◆ USBD_VCPKYBRD_CDC_BULK_OUT_EPT

#define USBD_VCPKYBRD_CDC_BULK_OUT_EPT 0x01

Definition at line 54 of file cdc_keyboard_class.h.

Referenced by class_clear_handler(), class_init_handler(), and usb_vcpkybrd_vcp_get_rxdata().

◆ USBD_VCPKYBRD_CDC_INT_EPT

#define USBD_VCPKYBRD_CDC_INT_EPT 0x82

usb use endpoint define

Definition at line 52 of file cdc_keyboard_class.h.

Referenced by class_clear_handler(), and class_init_handler().

◆ USBD_VCPKYBRD_CMD_MAXPACKET_SIZE

#define USBD_VCPKYBRD_CMD_MAXPACKET_SIZE 0x08

Definition at line 62 of file cdc_keyboard_class.h.

Referenced by class_init_handler().

◆ USBD_VCPKYBRD_HID_IN_EPT

#define USBD_VCPKYBRD_HID_IN_EPT 0x83

Definition at line 55 of file cdc_keyboard_class.h.

Referenced by class_clear_handler(), class_in_handler(), class_init_handler(), and usb_vcpkybrd_class_send_report().

◆ USBD_VCPKYBRD_IN_MAXPACKET_SIZE

#define USBD_VCPKYBRD_IN_MAXPACKET_SIZE 0x40

usb in and out max packet size define

Definition at line 60 of file cdc_keyboard_class.h.

Referenced by class_init_handler().

◆ USBD_VCPKYBRD_OUT_MAXPACKET_SIZE

#define USBD_VCPKYBRD_OUT_MAXPACKET_SIZE 0x40

Definition at line 61 of file cdc_keyboard_class.h.

Referenced by class_init_handler(), and usb_vcpkybrd_vcp_get_rxdata().


AT32F413 Firmwary Library: USB_cdc_keyboar_class_exported_functions

Functions | Variables
USB_cdc_keyboar_class_exported_functions
AT32F413_middlewares_usbd_class » USB_cdc_keyboard_class

Functions

uint16_t | usb_vcpkybrd_vcp_get_rxdata (void *udev, uint8_t *recv_data)
usb device class rx data process
error_status | usb_vcpkybrd_vcp_send_data (void *udev, uint8_t *send_data, uint16_t len)
usb device class send data
usb_sts_type | usb_vcpkybrd_class_send_report (void *udev, uint8_t *report, uint16_t len)
usb device class send report
void | usb_vcpkybrd_keyboard_send_char (void *udev, uint8_t ascii_code)
usb keyoard send char

Variables

usbd_class_handler cdc_keyboard_class_handler

Detailed Description

Function Documentation

◆ usb_vcpkybrd_class_send_report()

usb_sts_type usb_vcpkybrd_class_send_report | ( | void * | udev,
 |  | uint8_t * | report,
 |  | uint16_t | len )

usb device class send report

Parameters
udev | to the structure of usbd_core_type
report | report buffer
len | report length
Return values
status of usb_sts_type

Definition at line 693 of file cdc_keyboard_class.c.

Referenced by usb_vcpkybrd_keyboard_send_char().

◆ usb_vcpkybrd_keyboard_send_char()

void usb_vcpkybrd_keyboard_send_char | ( | void * | udev,
 |  | uint8_t | ascii_code )

usb keyoard send char

Parameters
udev | to the structure of usbd_core_type
op | operation
Return values
none

Definition at line 711 of file cdc_keyboard_class.c.

Referenced by keyboard_send_string().

◆ usb_vcpkybrd_vcp_get_rxdata()

uint16_t usb_vcpkybrd_vcp_get_rxdata | ( | void * | udev,
 |  | uint8_t * | recv_data )

usb device class rx data process

Parameters
udev | to the structure of usbd_core_type
recv_data | receive buffer
Return values
receive data len

Definition at line 601 of file cdc_keyboard_class.c.

Referenced by main().

◆ usb_vcpkybrd_vcp_send_data()

error_status usb_vcpkybrd_vcp_send_data | ( | void * | udev,
 |  | uint8_t * | send_data,
 |  | uint16_t | len )

usb device class send data

Parameters
udev | to the structure of usbd_core_type
send_data | send data buffer
len | send length
Return values
error status

Definition at line 632 of file cdc_keyboard_class.c.

Referenced by main().

Variable Documentation

◆ cdc_keyboard_class_handler

usbd_class_handler cdc_keyboard_class_handler
extern

Definition at line 204 of file cdc_keyboard_class.c.

Referenced by main().


AT32F413 Firmwary Library: USB_cdc_keyboard_desc

Topics | Variables
USB_cdc_keyboard_desc
AT32F413_middlewares_usbd_class

usb device cdc keyboard descriptor More...

Topics

USB_cdc_keyboard_desc_private_functions
USB_cdc_keyboard_desc_definition

Variables

uint8_t | g_usbd_vcpkybrd_hid_report [63]
uint8_t | g_vcpkybrd_hid_usb_desc [9]
usbd_desc_handler cdc_keyboard_desc_handler
device descriptor handler structure

Detailed Description

usb device cdc keyboard descriptor

Variable Documentation

◆ cdc_keyboard_desc_handler

usbd_desc_handler cdc_keyboard_desc_handler
extern

device descriptor handler structure

Definition at line 64 of file cdc_keyboard_desc.c.

Referenced by main().

◆ g_usbd_vcpkybrd_hid_report

uint8_t g_usbd_vcpkybrd_hid_report[63]
extern

Referenced by keyboard_class_setup_handler().

◆ g_vcpkybrd_hid_usb_desc

uint8_t g_vcpkybrd_hid_usb_desc[9]
extern

Referenced by keyboard_class_setup_handler().


AT32F413 Firmwary Library: USB_cdc_keyboard_desc_private_functions

Functions | Variables
USB_cdc_keyboard_desc_private_functions
AT32F413_middlewares_usbd_class » USB_cdc_keyboard_desc

Functions

static usbd_desc_t * | get_device_descriptor (void)
get device descriptor
static usbd_desc_t * | get_device_qualifier (void)
get device qualifier
static usbd_desc_t * | get_device_configuration (void)
get config descriptor
static usbd_desc_t * | get_device_other_speed (void)
get other speed descriptor
static usbd_desc_t * | get_device_lang_id (void)
get lang id descriptor
static usbd_desc_t * | get_device_manufacturer_string (void)
get manufacturer descriptor
static usbd_desc_t * | get_device_product_string (void)
get product descriptor
static usbd_desc_t * | get_device_serial_string (void)
get serial descriptor
static usbd_desc_t * | get_device_interface_string (void)
get interface descriptor
static usbd_desc_t * | get_device_config_string (void)
get device config descriptor
static uint16_t | usbd_unicode_convert (uint8_t *string, uint8_t *unicode_buf)
standard usb unicode convert
static void | usbd_int_to_unicode (uint32_t value, uint8_t *pbuf, uint8_t len)
usb int convert to unicode
static void | get_serial_num (void)
usb get serial number

Variables

static ALIGNED_HEAD uint8_t g_usbd_desc_buffer[256] | ALIGNED_TAIL
usb device standard descriptor
usbd_desc_handler cdc_keyboard_desc_handler
device descriptor handler structure
static usbd_desc_t | device_descriptor
static usbd_desc_t | config_descriptor
static usbd_desc_t | langid_descriptor
static usbd_desc_t | serial_descriptor
static usbd_desc_t | vp_desc

Detailed Description

Function Documentation

◆ get_device_config_string()

static usbd_desc_t * get_device_config_string ( void )
static

get device config descriptor

Parameters
none
Return values
usbd_desc

Definition at line 535 of file cdc_keyboard_desc.c.

◆ get_device_configuration()

static usbd_desc_t * get_device_configuration ( void )
static

get config descriptor

Parameters
none
Return values
usbd_desc

Definition at line 457 of file cdc_keyboard_desc.c.

◆ get_device_descriptor()

static usbd_desc_t * get_device_descriptor ( void )
static

get device descriptor

Parameters
none
Return values
usbd_desc

Definition at line 437 of file cdc_keyboard_desc.c.

◆ get_device_interface_string()

static usbd_desc_t * get_device_interface_string ( void )
static

get interface descriptor

Parameters
none
Return values
usbd_desc

Definition at line 523 of file cdc_keyboard_desc.c.

◆ get_device_lang_id()

static usbd_desc_t * get_device_lang_id ( void )
static

get lang id descriptor

Parameters
none
Return values
usbd_desc

Definition at line 477 of file cdc_keyboard_desc.c.

◆ get_device_manufacturer_string()

static usbd_desc_t * get_device_manufacturer_string ( void )
static

get manufacturer descriptor

Parameters
none
Return values
usbd_desc

Definition at line 488 of file cdc_keyboard_desc.c.

◆ get_device_other_speed()

static usbd_desc_t * get_device_other_speed ( void )
static

get other speed descriptor

Parameters
none
Return values
usbd_desc

Definition at line 467 of file cdc_keyboard_desc.c.

◆ get_device_product_string()

static usbd_desc_t * get_device_product_string ( void )
static

get product descriptor

Parameters
none
Return values
usbd_desc

Definition at line 500 of file cdc_keyboard_desc.c.

◆ get_device_qualifier()

static usbd_desc_t * get_device_qualifier ( void )
static

get device qualifier

Parameters
none
Return values
usbd_desc

Definition at line 447 of file cdc_keyboard_desc.c.

◆ get_device_serial_string()

static usbd_desc_t * get_device_serial_string ( void )
static

get serial descriptor

Parameters
none
Return values
usbd_desc

Definition at line 512 of file cdc_keyboard_desc.c.

◆ get_serial_num()

static void get_serial_num ( void )
static

usb get serial number

Parameters
none
Return values
none

Definition at line 415 of file cdc_keyboard_desc.c.

Referenced by get_device_serial_string().

◆ usbd_int_to_unicode()

static void usbd_int_to_unicode | ( | uint32_t | value,
 |  | uint8_t * | pbuf,
 |  | uint8_t | len )
 static

usb int convert to unicode

Parameters
value | int value
pbus | unicode buffer
len | length
Return values
none

Definition at line 389 of file cdc_keyboard_desc.c.

Referenced by get_serial_num().

◆ usbd_unicode_convert()

static uint16_t usbd_unicode_convert | ( | uint8_t * | string,
 |  | uint8_t * | unicode_buf )
 static

standard usb unicode convert

Parameters
string | source string
unicode_buf | unicode buffer
Return values
length

Definition at line 363 of file cdc_keyboard_desc.c.

Referenced by get_device_config_string(), get_device_interface_string(), get_device_manufacturer_string(), and get_device_product_string().

Variable Documentation

◆ ALIGNED_TAIL

ALIGNED_HEAD uint8_t g_string_serial [ 0x1A ] ALIGNED_TAIL
static
Initial value:
=
{
USB_DEVICE_DESC_LEN,
USB_DESCIPTOR_TYPE_DEVICE,
0x00,
0x02,
0xEF,
0x02,
0x01,
USB_MAX_EP0_SIZE,
LBYTE( 0x2E3C ),
HBYTE( 0x2E3C ),
LBYTE( 0x5750 ),
HBYTE( 0x5750 ),
0x00,
0x02,
USB_MFC_STRING,
USB_PRODUCT_STRING,
USB_SERIAL_STRING,
1
}
HBYTE
#define HBYTE(x)
Definition usb_std.h:271
USB_MAX_EP0_SIZE
#define USB_MAX_EP0_SIZE
endpoint 0 max size
Definition usb_std.h:248
USB_PRODUCT_STRING
#define USB_PRODUCT_STRING
Definition usb_std.h:105
LBYTE
#define LBYTE(x)
low byte and high byte define
Definition usb_std.h:270
USB_DEVICE_DESC_LEN
#define USB_DEVICE_DESC_LEN
Definition usb_std.h:156
USB_MFC_STRING
#define USB_MFC_STRING
Definition usb_std.h:104
USB_SERIAL_STRING
#define USB_SERIAL_STRING
Definition usb_std.h:106
USB_DESCIPTOR_TYPE_DEVICE
#define USB_DESCIPTOR_TYPE_DEVICE
usb standard device type
Definition usb_std.h:91

usb device standard descriptor

usb string serial

usb string lang id

usb hid keyboard report descriptor

usb hid descriptor

usb configuration standard descriptor

Definition at line 59 of file cdc_keyboard_desc.c.

◆ cdc_keyboard_desc_handler

usbd_desc_handler cdc_keyboard_desc_handler
Initial value:
=
{
get_device_descriptor,
get_device_qualifier,
get_device_configuration,
get_device_other_speed,
get_device_lang_id,
get_device_manufacturer_string,
get_device_product_string,
get_device_serial_string,
get_device_interface_string,
get_device_config_string,
}
get_device_configuration
static usbd_desc_t * get_device_configuration(void)
get config descriptor
Definition cdc_keyboard_desc.c:457
get_device_descriptor
static usbd_desc_t * get_device_descriptor(void)
get device descriptor
Definition cdc_keyboard_desc.c:437
get_device_manufacturer_string
static usbd_desc_t * get_device_manufacturer_string(void)
get manufacturer descriptor
Definition cdc_keyboard_desc.c:488
get_device_qualifier
static usbd_desc_t * get_device_qualifier(void)
get device qualifier
Definition cdc_keyboard_desc.c:447
get_device_interface_string
static usbd_desc_t * get_device_interface_string(void)
get interface descriptor
Definition cdc_keyboard_desc.c:523
get_device_other_speed
static usbd_desc_t * get_device_other_speed(void)
get other speed descriptor
Definition cdc_keyboard_desc.c:467
get_device_product_string
static usbd_desc_t * get_device_product_string(void)
get product descriptor
Definition cdc_keyboard_desc.c:500
get_device_config_string
static usbd_desc_t * get_device_config_string(void)
get device config descriptor
Definition cdc_keyboard_desc.c:535
get_device_lang_id
static usbd_desc_t * get_device_lang_id(void)
get lang id descriptor
Definition cdc_keyboard_desc.c:477
get_device_serial_string
static usbd_desc_t * get_device_serial_string(void)
get serial descriptor
Definition cdc_keyboard_desc.c:512

device descriptor handler structure

Definition at line 64 of file cdc_keyboard_desc.c.

Referenced by main().

◆ config_descriptor

usbd_desc_t config_descriptor
static
Initial value:
=
{
108 ,
g_usbd_configuration
}

Definition at line 335 of file cdc_keyboard_desc.c.

Referenced by get_device_configuration().

◆ device_descriptor

usbd_desc_t device_descriptor
static
Initial value:
=
{
USB_DEVICE_DESC_LEN,
g_usbd_descriptor
}

Definition at line 328 of file cdc_keyboard_desc.c.

Referenced by get_device_descriptor().

◆ langid_descriptor

usbd_desc_t langid_descriptor
static
Initial value:
=
{
4 ,
g_string_lang_id
}

Definition at line 342 of file cdc_keyboard_desc.c.

Referenced by get_device_lang_id().

◆ serial_descriptor

usbd_desc_t serial_descriptor
static
Initial value:
=
{
0x1A ,
g_string_serial
}

Definition at line 349 of file cdc_keyboard_desc.c.

Referenced by get_device_serial_string().

◆ vp_desc

usbd_desc_t vp_desc
static

Definition at line 355 of file cdc_keyboard_desc.c.

Referenced by get_device_config_string(), get_device_interface_string(), get_device_manufacturer_string(), and get_device_product_string().


AT32F413 Firmwary Library: USB_cdc_keyboard_desc_definition

Macros
USB_cdc_keyboard_desc_definition
AT32F413_middlewares_usbd_class » USB_cdc_keyboard_desc

Macros

#define | VCPKYBRD_BCD_NUM 0x0110
usb bcd number define
#define | USBD_VCPKYBRD_VENDOR_ID 0x2E3C
usb vendor id and product id define
#define | USBD_VCPKYBRD_PRODUCT_ID 0x5750
#define | USBD_VCPKYBRD_CONFIG_DESC_SIZE 108
usb descriptor size define
#define | USBD_VCPKYBRD_HID_SIZ_REPORT_DESC 63
#define | USBD_VCPKYBRD_SIZ_STRING_LANGID 4
#define | USBD_VCPKYBRD_SIZ_STRING_SERIAL 0x1A
#define | USBD_VCPKYBRD_DESC_MANUFACTURER_STRING "Artery"
usb string define(vendor, product configuration, interface)
#define | USBD_VCPKYBRD_DESC_PRODUCT_STRING "AT32 Composite VCP and Keyboard"
#define | USBD_VCPKYBRD_DESC_CONFIGURATION_STRING "Composite VCP and Keyboard Config"
#define | USBD_VCPKYBRD_DESC_INTERFACE_STRING "Composite VCP and Keyboard Interface"
#define | VCPKYBRD_HID_BINTERVAL_TIME 0x0A
usb endpoint interval define
#define | VCPKYBRD_CDC_INTERFACE 0x00
usb interface define
#define | VCPKYBRD_CDC_DATA_INTERFACE 0x01
#define | VCPKYBRD_KEYBOARD_INTERFACE 0x02
#define | MCU_ID1 (0x1FFFF7E8)
usb mcu id address deine
#define | MCU_ID2 (0x1FFFF7EC)
#define | MCU_ID3 (0x1FFFF7F0)

Detailed Description

Macro Definition Documentation

◆ MCU_ID1

#define MCU_ID1 (0x1FFFF7E8)

usb mcu id address deine

Definition at line 92 of file cdc_keyboard_desc.h.

◆ MCU_ID2

#define MCU_ID2 (0x1FFFF7EC)

Definition at line 93 of file cdc_keyboard_desc.h.

◆ MCU_ID3

#define MCU_ID3 (0x1FFFF7F0)

Definition at line 94 of file cdc_keyboard_desc.h.

◆ USBD_VCPKYBRD_CONFIG_DESC_SIZE

#define USBD_VCPKYBRD_CONFIG_DESC_SIZE 108

usb descriptor size define

Definition at line 64 of file cdc_keyboard_desc.h.

◆ USBD_VCPKYBRD_DESC_CONFIGURATION_STRING

#define USBD_VCPKYBRD_DESC_CONFIGURATION_STRING "Composite VCP and Keyboard Config"

Definition at line 74 of file cdc_keyboard_desc.h.

Referenced by get_device_config_string().

◆ USBD_VCPKYBRD_DESC_INTERFACE_STRING

#define USBD_VCPKYBRD_DESC_INTERFACE_STRING "Composite VCP and Keyboard Interface"

Definition at line 75 of file cdc_keyboard_desc.h.

Referenced by get_device_interface_string().

◆ USBD_VCPKYBRD_DESC_MANUFACTURER_STRING

#define USBD_VCPKYBRD_DESC_MANUFACTURER_STRING "Artery"

usb string define(vendor, product configuration, interface)

Definition at line 72 of file cdc_keyboard_desc.h.

Referenced by get_device_manufacturer_string().

◆ USBD_VCPKYBRD_DESC_PRODUCT_STRING

#define USBD_VCPKYBRD_DESC_PRODUCT_STRING "AT32 Composite VCP and Keyboard"

Definition at line 73 of file cdc_keyboard_desc.h.

Referenced by get_device_product_string().

◆ USBD_VCPKYBRD_HID_SIZ_REPORT_DESC

#define USBD_VCPKYBRD_HID_SIZ_REPORT_DESC 63

Definition at line 65 of file cdc_keyboard_desc.h.

Referenced by keyboard_class_setup_handler().

◆ USBD_VCPKYBRD_PRODUCT_ID

#define USBD_VCPKYBRD_PRODUCT_ID 0x5750

Definition at line 58 of file cdc_keyboard_desc.h.

◆ USBD_VCPKYBRD_SIZ_STRING_LANGID

#define USBD_VCPKYBRD_SIZ_STRING_LANGID 4

Definition at line 66 of file cdc_keyboard_desc.h.

◆ USBD_VCPKYBRD_SIZ_STRING_SERIAL

#define USBD_VCPKYBRD_SIZ_STRING_SERIAL 0x1A

Definition at line 67 of file cdc_keyboard_desc.h.

◆ USBD_VCPKYBRD_VENDOR_ID

#define USBD_VCPKYBRD_VENDOR_ID 0x2E3C

usb vendor id and product id define

Definition at line 57 of file cdc_keyboard_desc.h.

◆ VCPKYBRD_BCD_NUM

#define VCPKYBRD_BCD_NUM 0x0110

usb bcd number define

Definition at line 52 of file cdc_keyboard_desc.h.

◆ VCPKYBRD_CDC_DATA_INTERFACE

#define VCPKYBRD_CDC_DATA_INTERFACE 0x01

Definition at line 86 of file cdc_keyboard_desc.h.

◆ VCPKYBRD_CDC_INTERFACE

#define VCPKYBRD_CDC_INTERFACE 0x00

usb interface define

Definition at line 85 of file cdc_keyboard_desc.h.

◆ VCPKYBRD_HID_BINTERVAL_TIME

#define VCPKYBRD_HID_BINTERVAL_TIME 0x0A

usb endpoint interval define

Definition at line 80 of file cdc_keyboard_desc.h.

◆ VCPKYBRD_KEYBOARD_INTERFACE

#define VCPKYBRD_KEYBOARD_INTERFACE 0x02

Definition at line 87 of file cdc_keyboard_desc.h.

Referenced by class_setup_handler().


AT32F413 Firmwary Library: USB_cdc_msc_class

Topics
USB_cdc_msc_class
AT32F413_middlewares_usbd_class

usb device class cdc msc demo More...

Topics

USB_cdc_msc_class_private_functions
USB_cdc_class_definition
USB_cdc_class_exported_types

Detailed Description

usb device class cdc msc demo


AT32F413 Firmwary Library: USB_cdc_msc_class_private_functions

Functions | Variables
USB_cdc_msc_class_private_functions
AT32F413_middlewares_usbd_class » USB_cdc_msc_class

Functions

static usb_sts_type | class_init_handler (void *udev)
initialize usb custom hid endpoint
static usb_sts_type | class_clear_handler (void *udev)
clear endpoint or other state
static usb_sts_type | class_setup_handler (void *udev, usb_setup_type *setup)
usb device class setup request handler
static usb_sts_type | class_ept0_tx_handler (void *udev)
usb device endpoint 0 in status stage complete
static usb_sts_type | class_ept0_rx_handler (void *udev)
usb device endpoint 0 out status stage complete
static usb_sts_type | class_in_handler (void *udev, uint8_t ept_num)
usb device transmision complete handler
static usb_sts_type | class_out_handler (void *udev, uint8_t ept_num)
usb device endpoint receive data
static usb_sts_type | class_sof_handler (void *udev)
usb device sof handler
static usb_sts_type | class_event_handler (void *udev, usbd_event_type event)
usb device event handler
static usb_sts_type | cdc_struct_init (cdc_msc_struct_type *pcdc)
usb device cdc init
void | usb_usart_config (linecoding_type linecoding)
this function handles usart2 and linecoding config.
static void | usb_vcp_cmd_process (void *udev, uint8_t cmd, uint8_t *buff, uint16_t len)
usb device function
static usb_sts_type | cdc_class_setup_handler (void *udev, usb_setup_type *setup)
usb device class setup request handler
static usb_sts_type | msc_class_setup_handler (void *udev, usb_setup_type *setup)
usb device class setup request handler
uint16_t | usb_vcp_get_rxdata (void *udev, uint8_t *recv_data)
usb device class rx data process
error_status | usb_vcp_send_data (void *udev, uint8_t *send_data, uint16_t len)
usb device class send data

Variables

linecoding_type linecoding
cdc_msc_struct_type cdc_msc_struct
usbd_class_handler cdc_msc_class_handler

Detailed Description

Function Documentation

◆ cdc_class_setup_handler()

static usb_sts_type cdc_class_setup_handler | ( | void * | udev,
 |  | usb_setup_type * | setup )
 static

usb device class setup request handler

Parameters
udev | to the structure of usbd_core_type
setup | setup packet
Return values
status of usb_sts_type

Definition at line 192 of file cdc_msc_class.c.

Referenced by class_setup_handler().

◆ cdc_struct_init()

static usb_sts_type cdc_struct_init ( cdc_msc_struct_type * pcdc )
static

usb device cdc init

Parameters
pcdc to the structure of cdc_struct
Return values
status of usb_sts_type

Definition at line 462 of file cdc_msc_class.c.

Referenced by class_init_handler().

◆ class_clear_handler()

static usb_sts_type class_clear_handler ( void * udev )
static

clear endpoint or other state

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 126 of file cdc_msc_class.c.

◆ class_ept0_rx_handler()

static usb_sts_type class_ept0_rx_handler ( void * udev )
static

usb device endpoint 0 out status stage complete

Parameters
udev usb device core handler type
Return values
status of usb_sts_type

Definition at line 338 of file cdc_msc_class.c.

◆ class_ept0_tx_handler()

static usb_sts_type class_ept0_tx_handler ( void * udev )
static

usb device endpoint 0 in status stage complete

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 324 of file cdc_msc_class.c.

◆ class_event_handler()

static usb_sts_type class_event_handler | ( | void * | udev,
 |  | usbd_event_type | event )
 static

usb device event handler

Parameters
udev | to the structure of usbd_core_type
event | usb device event
Return values
status of usb_sts_type

Definition at line 432 of file cdc_msc_class.c.

◆ class_in_handler()

static usb_sts_type class_in_handler | ( | void * | udev,
 |  | uint8_t | ept_num )
 static

usb device transmision complete handler

Parameters
udev | to the structure of usbd_core_type
ept_num | endpoint number
Return values
status of usb_sts_type

Definition at line 360 of file cdc_msc_class.c.

◆ class_init_handler()

static usb_sts_type class_init_handler ( void * udev )
static

initialize usb custom hid endpoint

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 89 of file cdc_msc_class.c.

◆ class_out_handler()

static usb_sts_type class_out_handler | ( | void * | udev,
 |  | uint8_t | ept_num )
 static

usb device endpoint receive data

Parameters
udev | to the structure of usbd_core_type
ept_num | endpoint number
Return values
status of usb_sts_type

Definition at line 388 of file cdc_msc_class.c.

◆ class_setup_handler()

static usb_sts_type class_setup_handler | ( | void * | udev,
 |  | usb_setup_type * | setup )
 static

usb device class setup request handler

Parameters
udev | to the structure of usbd_core_type
setup | setup packet
Return values
status of usb_sts_type

Definition at line 155 of file cdc_msc_class.c.

◆ class_sof_handler()

static usb_sts_type class_sof_handler ( void * udev )
static

usb device sof handler

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 417 of file cdc_msc_class.c.

◆ msc_class_setup_handler()

static usb_sts_type msc_class_setup_handler | ( | void * | udev,
 |  | usb_setup_type * | setup )
 static

usb device class setup request handler

Parameters
udev | to the structure of usbd_core_type
setup | setup packet
Return values
status of usb_sts_type

< get max lun

< bulk only mass storage reset

Definition at line 253 of file cdc_msc_class.c.

Referenced by class_setup_handler().

◆ usb_usart_config()

void usb_usart_config ( linecoding_type linecoding )
extern

this function handles usart2 and linecoding config.

Parameters
linecoding linecoding value
Return values
none

< usart receive data buffer full interrupt

Definition at line 301 of file project/at_start_f413/examples/usb_device/virtual_comport/src/main.c.

Referenced by usb_vcp_cmd_process().

◆ usb_vcp_cmd_process()

static void usb_vcp_cmd_process | ( | void * | udev,
 |  | uint8_t | cmd,
 |  | uint8_t * | buff,
 |  | uint16_t | len )
 static

usb device function

Parameters
udev | to the structure of usbd_core_type
cmd | request number
buff | request buffer
len | buffer length
Return values
none

Definition at line 535 of file cdc_msc_class.c.

Referenced by cdc_class_setup_handler(), and class_ept0_rx_handler().

◆ usb_vcp_get_rxdata()

uint16_t usb_vcp_get_rxdata | ( | void * | udev,
 |  | uint8_t * | recv_data )

usb device class rx data process

Parameters
udev | to the structure of usbd_core_type
recv_data | receive buffer
Return values
receive data len

Definition at line 480 of file cdc_msc_class.c.

◆ usb_vcp_send_data()

error_status usb_vcp_send_data | ( | void * | udev,
 |  | uint8_t * | send_data,
 |  | uint16_t | len )

usb device class send data

Parameters
udev | to the structure of usbd_core_type
send_data | send data buffer
len | send length
Return values
error status

Definition at line 510 of file cdc_msc_class.c.

Variable Documentation

◆ cdc_msc_class_handler

usbd_class_handler cdc_msc_class_handler
Initial value:
=
{
class_init_handler,
class_clear_handler,
class_setup_handler,
class_ept0_tx_handler,
class_ept0_rx_handler,
class_in_handler,
class_out_handler,
class_sof_handler,
class_event_handler,
&cdc_msc_struct
}
class_sof_handler
static usb_sts_type class_sof_handler(void *udev)
usb device sof handler
Definition cdc_msc_class.c:417
cdc_msc_struct
cdc_msc_struct_type cdc_msc_struct
Definition cdc_msc_class.c:68
class_in_handler
static usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
usb device transmision complete handler
Definition cdc_msc_class.c:360
class_clear_handler
static usb_sts_type class_clear_handler(void *udev)
clear endpoint or other state
Definition cdc_msc_class.c:126
class_setup_handler
static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
usb device class setup request handler
Definition cdc_msc_class.c:155
class_ept0_tx_handler
static usb_sts_type class_ept0_tx_handler(void *udev)
usb device endpoint 0 in status stage complete
Definition cdc_msc_class.c:324
class_ept0_rx_handler
static usb_sts_type class_ept0_rx_handler(void *udev)
usb device endpoint 0 out status stage complete
Definition cdc_msc_class.c:338
class_event_handler
static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
usb device event handler
Definition cdc_msc_class.c:432
class_init_handler
static usb_sts_type class_init_handler(void *udev)
initialize usb custom hid endpoint
Definition cdc_msc_class.c:89
class_out_handler
static usb_sts_type class_out_handler(void *udev, uint8_t ept_num)
usb device endpoint receive data
Definition cdc_msc_class.c:388

Definition at line 71 of file cdc_msc_class.c.

Referenced by main().

◆ cdc_msc_struct

cdc_msc_struct_type cdc_msc_struct

Definition at line 68 of file cdc_msc_class.c.

Referenced by msc_class_setup_handler().

◆ linecoding

linecoding_type linecoding
Initial value:
=
{
115200,
0,
0,
8
}

Definition at line 59 of file cdc_msc_class.c.

Referenced by cdc_struct_init(), and usb_usart_config().


AT32F413 Firmwary Library: USB_cdc_msc_desc

Topics | Variables
USB_cdc_msc_desc
AT32F413_middlewares_usbd_class

usb device cdc msc descriptor More...

Topics

USB_cdc_msc_desc_private_functions
USB_cdc_desc_definition

Variables

usbd_desc_handler cdc_msc_desc_handler
device descriptor handler structure

Detailed Description

usb device cdc msc descriptor

Variable Documentation

◆ cdc_msc_desc_handler

usbd_desc_handler cdc_msc_desc_handler
extern

device descriptor handler structure

Definition at line 68 of file cdc_msc_desc.c.

Referenced by main().


AT32F413 Firmwary Library: USB_cdc_msc_desc_private_functions

Macros | Functions | Variables
USB_cdc_msc_desc_private_functions
AT32F413_middlewares_usbd_class » USB_cdc_msc_desc

Macros

#define USB_INTERFACE_ASSOCIATION_TYPE 0x0B

Functions

static usbd_desc_t * | get_device_descriptor (void)
get device descriptor
static usbd_desc_t * | get_device_qualifier (void)
get device qualifier
static usbd_desc_t * | get_device_configuration (void)
get config descriptor
static usbd_desc_t * | get_device_other_speed (void)
get other speed descriptor
static usbd_desc_t * | get_device_lang_id (void)
get lang id descriptor
static usbd_desc_t * | get_device_manufacturer_string (void)
get manufacturer descriptor
static usbd_desc_t * | get_device_product_string (void)
get product descriptor
static usbd_desc_t * | get_device_serial_string (void)
get serial descriptor
static usbd_desc_t * | get_device_interface_string (void)
get interface descriptor
static usbd_desc_t * | get_device_config_string (void)
get device config descriptor
static uint16_t | usbd_unicode_convert (uint8_t *string, uint8_t *unicode_buf)
standard usb unicode convert
static void | usbd_int_to_unicode (uint32_t value, uint8_t *pbuf, uint8_t len)
usb int convert to unicode
static void | get_serial_num (void)
usb get serial number

Variables

static ALIGNED_HEAD uint8_t g_usbd_desc_buffer[256] | ALIGNED_TAIL
usb device standard descriptor
usbd_desc_handler cdc_msc_desc_handler
device descriptor handler structure
static usbd_desc_t | device_descriptor
static usbd_desc_t | config_descriptor
static usbd_desc_t | langid_descriptor
static usbd_desc_t | serial_descriptor
static usbd_desc_t | vp_desc

Detailed Description

Macro Definition Documentation

◆ USB_INTERFACE_ASSOCIATION_TYPE

#define USB_INTERFACE_ASSOCIATION_TYPE 0x0B

Definition at line 44 of file cdc_msc_desc.c.

Function Documentation

◆ get_device_config_string()

static usbd_desc_t * get_device_config_string ( void )
static

get device config descriptor

Parameters
none
Return values
usbd_desc

Definition at line 483 of file cdc_msc_desc.c.

◆ get_device_configuration()

static usbd_desc_t * get_device_configuration ( void )
static

get config descriptor

Parameters
none
Return values
usbd_desc

Definition at line 405 of file cdc_msc_desc.c.

◆ get_device_descriptor()

static usbd_desc_t * get_device_descriptor ( void )
static

get device descriptor

Parameters
none
Return values
usbd_desc

Definition at line 385 of file cdc_msc_desc.c.

◆ get_device_interface_string()

static usbd_desc_t * get_device_interface_string ( void )
static

get interface descriptor

Parameters
none
Return values
usbd_desc

Definition at line 471 of file cdc_msc_desc.c.

◆ get_device_lang_id()

static usbd_desc_t * get_device_lang_id ( void )
static

get lang id descriptor

Parameters
none
Return values
usbd_desc

Definition at line 425 of file cdc_msc_desc.c.

◆ get_device_manufacturer_string()

static usbd_desc_t * get_device_manufacturer_string ( void )
static

get manufacturer descriptor

Parameters
none
Return values
usbd_desc

Definition at line 436 of file cdc_msc_desc.c.

◆ get_device_other_speed()

static usbd_desc_t * get_device_other_speed ( void )
static

get other speed descriptor

Parameters
none
Return values
usbd_desc

Definition at line 415 of file cdc_msc_desc.c.

◆ get_device_product_string()

static usbd_desc_t * get_device_product_string ( void )
static

get product descriptor

Parameters
none
Return values
usbd_desc

Definition at line 448 of file cdc_msc_desc.c.

◆ get_device_qualifier()

static usbd_desc_t * get_device_qualifier ( void )
static

get device qualifier

Parameters
none
Return values
usbd_desc

Definition at line 395 of file cdc_msc_desc.c.

◆ get_device_serial_string()

static usbd_desc_t * get_device_serial_string ( void )
static

get serial descriptor

Parameters
none
Return values
usbd_desc

Definition at line 460 of file cdc_msc_desc.c.

◆ get_serial_num()

static void get_serial_num ( void )
static

usb get serial number

Parameters
none
Return values
none

Definition at line 363 of file cdc_msc_desc.c.

Referenced by get_device_serial_string().

◆ usbd_int_to_unicode()

static void usbd_int_to_unicode | ( | uint32_t | value,
 |  | uint8_t * | pbuf,
 |  | uint8_t | len )
 static

usb int convert to unicode

Parameters
value | int value
pbus | unicode buffer
len | length
Return values
none

Definition at line 337 of file cdc_msc_desc.c.

Referenced by get_serial_num().

◆ usbd_unicode_convert()

static uint16_t usbd_unicode_convert | ( | uint8_t * | string,
 |  | uint8_t * | unicode_buf )
 static

standard usb unicode convert

Parameters
string | source string
unicode_buf | unicode buffer
Return values
length

Definition at line 311 of file cdc_msc_desc.c.

Referenced by get_device_config_string(), get_device_interface_string(), get_device_manufacturer_string(), and get_device_product_string().

Variable Documentation

◆ ALIGNED_TAIL

ALIGNED_HEAD uint8_t g_string_serial [ 0x1A ] ALIGNED_TAIL
static
Initial value:
=
{
USB_DEVICE_DESC_LEN,
USB_DESCIPTOR_TYPE_DEVICE,
0x00,
0x02,
0xEF,
0x02,
0x01,
USB_MAX_EP0_SIZE,
LBYTE( 0x2E3C ),
HBYTE( 0x2E3C ),
LBYTE( 0x5760 ),
HBYTE( 0x5760 ),
0x00,
0x02,
USB_MFC_STRING,
USB_PRODUCT_STRING,
USB_SERIAL_STRING,
1
}
HBYTE
#define HBYTE(x)
Definition usb_std.h:271
USB_MAX_EP0_SIZE
#define USB_MAX_EP0_SIZE
endpoint 0 max size
Definition usb_std.h:248
USB_PRODUCT_STRING
#define USB_PRODUCT_STRING
Definition usb_std.h:105
LBYTE
#define LBYTE(x)
low byte and high byte define
Definition usb_std.h:270
USB_DEVICE_DESC_LEN
#define USB_DEVICE_DESC_LEN
Definition usb_std.h:156
USB_MFC_STRING
#define USB_MFC_STRING
Definition usb_std.h:104
USB_SERIAL_STRING
#define USB_SERIAL_STRING
Definition usb_std.h:106
USB_DESCIPTOR_TYPE_DEVICE
#define USB_DESCIPTOR_TYPE_DEVICE
usb standard device type
Definition usb_std.h:91

usb device standard descriptor

usb string serial

usb string lang id

usb configuration standard descriptor

Definition at line 63 of file cdc_msc_desc.c.

◆ cdc_msc_desc_handler

usbd_desc_handler cdc_msc_desc_handler
Initial value:
=
{
get_device_descriptor,
get_device_qualifier,
get_device_configuration,
get_device_other_speed,
get_device_lang_id,
get_device_manufacturer_string,
get_device_product_string,
get_device_serial_string,
get_device_interface_string,
get_device_config_string,
}
get_device_configuration
static usbd_desc_t * get_device_configuration(void)
get config descriptor
Definition cdc_msc_desc.c:405
get_device_descriptor
static usbd_desc_t * get_device_descriptor(void)
get device descriptor
Definition cdc_msc_desc.c:385
get_device_manufacturer_string
static usbd_desc_t * get_device_manufacturer_string(void)
get manufacturer descriptor
Definition cdc_msc_desc.c:436
get_device_qualifier
static usbd_desc_t * get_device_qualifier(void)
get device qualifier
Definition cdc_msc_desc.c:395
get_device_interface_string
static usbd_desc_t * get_device_interface_string(void)
get interface descriptor
Definition cdc_msc_desc.c:471
get_device_other_speed
static usbd_desc_t * get_device_other_speed(void)
get other speed descriptor
Definition cdc_msc_desc.c:415
get_device_product_string
static usbd_desc_t * get_device_product_string(void)
get product descriptor
Definition cdc_msc_desc.c:448
get_device_config_string
static usbd_desc_t * get_device_config_string(void)
get device config descriptor
Definition cdc_msc_desc.c:483
get_device_lang_id
static usbd_desc_t * get_device_lang_id(void)
get lang id descriptor
Definition cdc_msc_desc.c:425
get_device_serial_string
static usbd_desc_t * get_device_serial_string(void)
get serial descriptor
Definition cdc_msc_desc.c:460

device descriptor handler structure

Definition at line 68 of file cdc_msc_desc.c.

Referenced by main().

◆ config_descriptor

usbd_desc_t config_descriptor
static
Initial value:
=
{
106 ,
g_usbd_configuration
}

Definition at line 283 of file cdc_msc_desc.c.

Referenced by get_device_configuration().

◆ device_descriptor

usbd_desc_t device_descriptor
static
Initial value:
=
{
USB_DEVICE_DESC_LEN,
g_usbd_descriptor
}

Definition at line 276 of file cdc_msc_desc.c.

Referenced by get_device_descriptor().

◆ langid_descriptor

usbd_desc_t langid_descriptor
static
Initial value:
=
{
4 ,
g_string_lang_id
}

Definition at line 290 of file cdc_msc_desc.c.

Referenced by get_device_lang_id().

◆ serial_descriptor

usbd_desc_t serial_descriptor
static
Initial value:
=
{
0x1A ,
g_string_serial
}

Definition at line 297 of file cdc_msc_desc.c.

Referenced by get_device_serial_string().

◆ vp_desc

usbd_desc_t vp_desc
static

Definition at line 303 of file cdc_msc_desc.c.

Referenced by get_device_config_string(), get_device_interface_string(), get_device_manufacturer_string(), and get_device_product_string().


AT32F413 Firmwary Library: USB_msc_bot_scsi

Topics
USB_msc_bot_scsi
AT32F413_middlewares_usbd_class

usb device class mass storage demo More...

Topics

USB_msc_bot_functions
USB_msc_bot_scsi_definition

Detailed Description

usb device class mass storage demo


AT32F413 Firmwary Library: USB_msc_bot_functions

Functions | Variables
USB_msc_bot_functions
AT32F413_middlewares_usbd_class » USB_msc_bot_scsi

Functions

void | bot_scsi_init (void *udev)
initialize bulk-only transport and scsi
void | bot_scsi_reset (void *udev)
reset bulk-only transport and scsi
void | bot_scsi_datain_handler (void *udev, uint8_t ept_num)
bulk-only transport data in handler
void | bot_scsi_dataout_handler (void *udev, uint8_t ept_num)
bulk-only transport data out handler
void | bot_cbw_decode (void *udev)
bulk-only cbw decode
void | bot_scsi_send_data (void *udev, uint8_t *buffer, uint32_t len)
send bot data
void | bot_scsi_send_csw (void *udev, uint8_t status)
send command status
void | bot_scsi_sense_code (void *udev, uint8_t sense_key, uint8_t asc)
send scsi sense code
usb_sts_type | bot_scsi_check_address (void *udev, uint8_t lun, uint32_t blk_offset, uint32_t blk_count)
check address
void | bot_scsi_stall (void *udev)
bot endpoint stall
usb_sts_type | bot_scsi_test_unit (void *udev, uint8_t lun)
bulk-only transport scsi command test unit
usb_sts_type | bot_scsi_inquiry (void *udev, uint8_t lun)
bulk-only transport scsi command inquiry
usb_sts_type | bot_scsi_start_stop (void *udev, uint8_t lun)
bulk-only transport scsi command start stop
usb_sts_type | bot_scsi_allow_medium_removal (void *udev, uint8_t lun)
bulk-only transport scsi command meidum removal
usb_sts_type | bot_scsi_mode_sense6 (void *udev, uint8_t lun)
bulk-only transport scsi command mode sense6
usb_sts_type | bot_scsi_mode_sense10 (void *udev, uint8_t lun)
bulk-only transport scsi command mode sense10
usb_sts_type | bot_scsi_capacity (void *udev, uint8_t lun)
bulk-only transport scsi command capacity
usb_sts_type | bot_scsi_format_capacity (void *udev, uint8_t lun)
bulk-only transport scsi command format capacity
usb_sts_type | bot_scsi_request_sense (void *udev, uint8_t lun)
bulk-only transport scsi command request sense
usb_sts_type | bot_scsi_verify (void *udev, uint8_t lun)
bulk-only transport scsi command verify
usb_sts_type | bot_scsi_read10 (void *udev, uint8_t lun)
bulk-only transport scsi command read10
usb_sts_type | bot_scsi_write10 (void *udev, uint8_t lun)
bulk-only transport scsi command write10
void | bot_scsi_clear_feature (void *udev, uint8_t ept_num)
clear feature
usb_sts_type | bot_scsi_cmd_process (void *udev)
bulk-only transport scsi command process

Variables

ALIGNED_HEAD uint8_t page00_inquiry_data[] | ALIGNED_TAIL
ALIGNED_HEAD uint8_t page00_inquiry_data[] | ALIGNED_TAIL
ALIGNED_HEAD uint8_t sdio_data_buffer[512] | ALIGNED_TAIL

Detailed Description

Function Documentation

◆ bot_cbw_decode()

void bot_cbw_decode ( void * udev )

bulk-only cbw decode

Parameters
udev to the structure of usbd_core_type
Return values
none
Parameters
udev to the structure of usbd_core_type
Return values
none

Definition at line 196 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by bot_scsi_dataout_handler().

◆ bot_scsi_allow_medium_removal()

usb_sts_type bot_scsi_allow_medium_removal | ( | void * | udev,
 |  | uint8_t | lun )

bulk-only transport scsi command meidum removal

Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type
Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type

Definition at line 423 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by bot_scsi_cmd_process().

◆ bot_scsi_capacity()

usb_sts_type bot_scsi_capacity | ( | void * | udev,
 |  | uint8_t | lun )

bulk-only transport scsi command capacity

Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type
Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type

Definition at line 477 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by bot_scsi_cmd_process().

◆ bot_scsi_check_address()

usb_sts_type bot_scsi_check_address | ( | void * | udev,
 |  | uint8_t | lun,
 |  | uint32_t | blk_offset,
 |  | uint32_t | blk_count )

check address

Parameters
udev | to the structure of usbd_core_type
lun | logical units number
blk_offset | blk offset address
blk_count | blk number
Return values
usb_sts_type
Parameters
udev | to the structure of usbd_core_type
lun | logical units number
blk_offset | blk offset address
blk_count | blk number
Return values
usb_sts_type

Definition at line 303 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by bot_scsi_read10(), bot_scsi_verify(), and bot_scsi_write10().

◆ bot_scsi_clear_feature()

void bot_scsi_clear_feature | ( | void * | udev,
 |  | uint8_t | ept_num )

clear feature

Parameters
udev | to the structure of usbd_core_type
etp_num | endpoint number
Return values
status of usb_sts_type
Parameters
udev | to the structure of usbd_core_type
etp_num | endpoint number
Return values
status of usb_sts_type

Definition at line 729 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by class_setup_handler(), and msc_class_setup_handler().

◆ bot_scsi_cmd_process()

usb_sts_type bot_scsi_cmd_process ( void * udev )

bulk-only transport scsi command process

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type
Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 749 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by bot_cbw_decode(), bot_scsi_datain_handler(), and bot_scsi_dataout_handler().

◆ bot_scsi_datain_handler()

void bot_scsi_datain_handler | ( | void * | udev,
 |  | uint8_t | ept_num )

bulk-only transport data in handler

Parameters
udev | to the structure of usbd_core_type
ept_num | endpoint number
Return values
none
Parameters
udev | to the structure of usbd_core_type
ept_num | endpoint number
Return values
none

Definition at line 143 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by class_in_handler(), and class_in_handler().

◆ bot_scsi_dataout_handler()

void bot_scsi_dataout_handler | ( | void * | udev,
 |  | uint8_t | ept_num )

bulk-only transport data out handler

Parameters
udev | to the structure of usbd_core_type
ept_num | endpoint number
Return values
none
Parameters
udev | to the structure of usbd_core_type
ept_num | endpoint number
Return values
none

Definition at line 172 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by class_out_handler(), and class_out_handler().

◆ bot_scsi_format_capacity()

usb_sts_type bot_scsi_format_capacity | ( | void * | udev,
 |  | uint8_t | lun )

bulk-only transport scsi command format capacity

Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type
Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type

Definition at line 504 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by bot_scsi_cmd_process().

◆ bot_scsi_init()

void bot_scsi_init ( void * udev )

initialize bulk-only transport and scsi

Parameters
udev to the structure of usbd_core_type
Return values
none
Parameters
udev to the structure of usbd_core_type
Return values
none

Definition at line 103 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by class_init_handler(), and class_init_handler().

◆ bot_scsi_inquiry()

usb_sts_type bot_scsi_inquiry | ( | void * | udev,
 |  | uint8_t | lun )

bulk-only transport scsi command inquiry

Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type
Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type

Definition at line 368 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by bot_scsi_cmd_process().

◆ bot_scsi_mode_sense10()

usb_sts_type bot_scsi_mode_sense10 | ( | void * | udev,
 |  | uint8_t | lun )

bulk-only transport scsi command mode sense10

Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type
Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type

Definition at line 457 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by bot_scsi_cmd_process().

◆ bot_scsi_mode_sense6()

usb_sts_type bot_scsi_mode_sense6 | ( | void * | udev,
 |  | uint8_t | lun )

bulk-only transport scsi command mode sense6

Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type
Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type

Definition at line 437 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by bot_scsi_cmd_process().

◆ bot_scsi_read10()

usb_sts_type bot_scsi_read10 | ( | void * | udev,
 |  | uint8_t | lun )

bulk-only transport scsi command read10

Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type
Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type

Definition at line 598 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by bot_scsi_cmd_process().

◆ bot_scsi_request_sense()

usb_sts_type bot_scsi_request_sense | ( | void * | udev,
 |  | uint8_t | lun )

bulk-only transport scsi command request sense

Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type
Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type

Definition at line 539 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by bot_scsi_cmd_process().

◆ bot_scsi_reset()

void bot_scsi_reset ( void * udev )

reset bulk-only transport and scsi

Parameters
udev to the structure of usbd_core_type
Return values
none
Parameters
udev to the structure of usbd_core_type
Return values
none

Definition at line 125 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by class_setup_handler(), and msc_class_setup_handler().

◆ bot_scsi_send_csw()

void bot_scsi_send_csw | ( | void * | udev,
 |  | uint8_t | status )

send command status

Parameters
udev | to the structure of usbd_core_type
status | csw status
Return values
none
Parameters
udev | to the structure of usbd_core_type
status | csw status
Return values
none

Definition at line 264 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by bot_cbw_decode(), bot_scsi_clear_feature(), bot_scsi_datain_handler(), bot_scsi_dataout_handler(), and bot_scsi_write10().

◆ bot_scsi_send_data()

void bot_scsi_send_data | ( | void * | udev,
 |  | uint8_t * | buffer,
 |  | uint32_t | len )

send bot data

Parameters
udev | to the structure of usbd_core_type
buffer | data buffer
len | data len
Return values
none
Parameters
udev | to the structure of usbd_core_type
buffer | data buffer
len | data len
Return values
none

Definition at line 243 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by bot_cbw_decode().

◆ bot_scsi_sense_code()

void bot_scsi_sense_code | ( | void * | udev,
 |  | uint8_t | sense_key,
 |  | uint8_t | asc )

send scsi sense code

Parameters
udev | to the structure of usbd_core_type
sense_key | sense key
asc | asc
Return values
none
Parameters
udev | to the structure of usbd_core_type
sense_key | sense key
asc | asc
Return values
none

Definition at line 288 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by bot_cbw_decode(), bot_scsi_check_address(), bot_scsi_cmd_process(), bot_scsi_read10(), bot_scsi_test_unit(), bot_scsi_verify(), and bot_scsi_write10().

◆ bot_scsi_stall()

void bot_scsi_stall ( void * udev )

bot endpoint stall

Parameters
udev to the structure of usbd_core_type
Return values
none
Parameters
udev to the structure of usbd_core_type
Return values
none

Definition at line 320 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by bot_cbw_decode().

◆ bot_scsi_start_stop()

usb_sts_type bot_scsi_start_stop | ( | void * | udev,
 |  | uint8_t | lun )

bulk-only transport scsi command start stop

Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type
Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type

Definition at line 409 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by bot_scsi_cmd_process().

◆ bot_scsi_test_unit()

usb_sts_type bot_scsi_test_unit | ( | void * | udev,
 |  | uint8_t | lun )

bulk-only transport scsi command test unit

Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type
Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type

Definition at line 346 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by bot_scsi_cmd_process().

◆ bot_scsi_verify()

usb_sts_type bot_scsi_verify | ( | void * | udev,
 |  | uint8_t | lun )

bulk-only transport scsi command verify

Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type
Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type

Definition at line 570 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by bot_scsi_cmd_process().

◆ bot_scsi_write10()

usb_sts_type bot_scsi_write10 | ( | void * | udev,
 |  | uint8_t | lun )

bulk-only transport scsi command write10

Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type
Parameters
udev | to the structure of usbd_core_type
lun | logical units number
Return values
status of usb_sts_type

Definition at line 659 of file composite_cdc_msc/msc_bot_scsi.c.

Referenced by bot_scsi_cmd_process().

Variable Documentation

◆ ALIGNED_TAIL [1/3]

ALIGNED_HEAD uint8_t mode_sense10_data [8] ALIGNED_TAIL
Initial value:
= {
0x00,
0x00,
0x00,
0x00,
0x00,
}

Definition at line 45 of file composite_cdc_msc/msc_bot_scsi.c.

◆ ALIGNED_TAIL [2/3]

ALIGNED_HEAD uint8_t mode_sense10_data [8] ALIGNED_TAIL
Initial value:
= {
0x00,
0x00,
0x00,
0x00,
0x00,
}

Definition at line 45 of file msc/msc_bot_scsi.c.

◆ ALIGNED_TAIL [3/3]

ALIGNED_HEAD sense_type sense_data ALIGNED_TAIL
Initial value:
=
{
0x70,
0x00,
0x05 ,
0x00000000,
0x0A,
0x00000000,
0x20,
0x00,
0x00000000
}

Definition at line 25 of file diskio.c.


AT32F413 Firmwary Library: USB_custom_hid_class

Topics
USB_custom_hid_class
AT32F413_middlewares_usbd_class

usb device custom hid demo More...

Topics

USB_custom_hid_class_private_functions
USB_custom_hid_class_endpoint_definition
USB_custom_hid_class_request_code_definition
USB_custom_hid_class_exported_functions

Detailed Description

usb device custom hid demo


AT32F413 Firmwary Library: USB_custom_hid_class_private_functions

Functions | Variables
USB_custom_hid_class_private_functions
AT32F413_middlewares_usbd_class » USB_custom_hid_class

Functions

static usb_sts_type | class_init_handler (void *udev)
initialize usb endpoint
static usb_sts_type | class_clear_handler (void *udev)
clear endpoint or other state
static usb_sts_type | class_setup_handler (void *udev, usb_setup_type *setup)
usb device class setup request handler
static usb_sts_type | class_ept0_tx_handler (void *udev)
usb device class endpoint 0 in status stage complete
static usb_sts_type | class_ept0_rx_handler (void *udev)
usb device class endpoint 0 out status stage complete
static usb_sts_type | class_in_handler (void *udev, uint8_t ept_num)
usb device class transmision complete handler
static usb_sts_type | class_out_handler (void *udev, uint8_t ept_num)
usb device class endpoint receive data
static usb_sts_type | class_sof_handler (void *udev)
usb device class sof handler
static usb_sts_type | class_event_handler (void *udev, usbd_event_type event)
usb device class event handler
static void | usb_hid_buf_process (void *udev, uint8_t *report, uint16_t len)
usb device class report function
usb_sts_type | custom_hid_class_send_report (void *udev, uint8_t *report, uint16_t len)
usb device class send report

Variables

custom_hid_type custom_hid_struct
usbd_class_handler custom_hid_class_handler

Detailed Description

Function Documentation

◆ class_clear_handler()

static usb_sts_type class_clear_handler ( void * udev )
static

clear endpoint or other state

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 105 of file custom_hid_class.c.

◆ class_ept0_rx_handler()

static usb_sts_type class_ept0_rx_handler ( void * udev )
static

usb device class endpoint 0 out status stage complete

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 226 of file custom_hid_class.c.

◆ class_ept0_tx_handler()

static usb_sts_type class_ept0_tx_handler ( void * udev )
static

usb device class endpoint 0 in status stage complete

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 212 of file custom_hid_class.c.

◆ class_event_handler()

static usb_sts_type class_event_handler | ( | void * | udev,
 |  | usbd_event_type | event )
 static

usb device class event handler

Parameters
udev | to the structure of usbd_core_type
event | usb device event
Return values
status of usb_sts_type

Definition at line 307 of file custom_hid_class.c.

◆ class_in_handler()

static usb_sts_type class_in_handler | ( | void * | udev,
 |  | uint8_t | ept_num )
 static

usb device class transmision complete handler

Parameters
udev | to the structure of usbd_core_type
ept_num | endpoint number
Return values
status of usb_sts_type

Definition at line 249 of file custom_hid_class.c.

◆ class_init_handler()

static usb_sts_type class_init_handler ( void * udev )
static

initialize usb endpoint

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 75 of file custom_hid_class.c.

◆ class_out_handler()

static usb_sts_type class_out_handler | ( | void * | udev,
 |  | uint8_t | ept_num )
 static

usb device class endpoint receive data

Parameters
udev | to the structure of usbd_core_type
ept_num | endpoint number
Return values
status of usb_sts_type

Definition at line 269 of file custom_hid_class.c.

◆ class_setup_handler()

static usb_sts_type class_setup_handler | ( | void * | udev,
 |  | usb_setup_type * | setup )
 static

usb device class setup request handler

Parameters
udev | to the structure of usbd_core_type
setup | setup packet
Return values
status of usb_sts_type

Definition at line 125 of file custom_hid_class.c.

◆ class_sof_handler()

static usb_sts_type class_sof_handler ( void * udev )
static

usb device class sof handler

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 292 of file custom_hid_class.c.

◆ custom_hid_class_send_report()

usb_sts_type custom_hid_class_send_report | ( | void * | udev,
 |  | uint8_t * | report,
 |  | uint16_t | len )

usb device class send report

Parameters
udev | to the structure of usbd_core_type
report | report buffer
len | report length
Return values
status of usb_sts_type

Definition at line 339 of file custom_hid_class.c.

Referenced by main(), and usb_hid_buf_process().

◆ usb_hid_buf_process()

static void usb_hid_buf_process | ( | void * | udev,
 |  | uint8_t * | report,
 |  | uint16_t | len )
 static

usb device class report function

Parameters
udev | to the structure of usbd_core_type
report | report buffer
len | report length
Return values
none

Definition at line 361 of file custom_hid_class.c.

Referenced by class_ept0_rx_handler(), and class_out_handler().

Variable Documentation

◆ custom_hid_class_handler

usbd_class_handler custom_hid_class_handler
Initial value:
=
{
class_init_handler,
class_clear_handler,
class_setup_handler,
class_ept0_tx_handler,
class_ept0_rx_handler,
class_in_handler,
class_out_handler,
class_sof_handler,
class_event_handler,
&custom_hid_struct
}
class_sof_handler
static usb_sts_type class_sof_handler(void *udev)
usb device class sof handler
Definition custom_hid_class.c:292
class_in_handler
static usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
usb device class transmision complete handler
Definition custom_hid_class.c:249
class_clear_handler
static usb_sts_type class_clear_handler(void *udev)
clear endpoint or other state
Definition custom_hid_class.c:105
class_setup_handler
static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
usb device class setup request handler
Definition custom_hid_class.c:125
class_ept0_tx_handler
static usb_sts_type class_ept0_tx_handler(void *udev)
usb device class endpoint 0 in status stage complete
Definition custom_hid_class.c:212
class_ept0_rx_handler
static usb_sts_type class_ept0_rx_handler(void *udev)
usb device class endpoint 0 out status stage complete
Definition custom_hid_class.c:226
class_event_handler
static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
usb device class event handler
Definition custom_hid_class.c:307
class_init_handler
static usb_sts_type class_init_handler(void *udev)
initialize usb endpoint
Definition custom_hid_class.c:75
class_out_handler
static usb_sts_type class_out_handler(void *udev, uint8_t ept_num)
usb device class endpoint receive data
Definition custom_hid_class.c:269
custom_hid_struct
custom_hid_type custom_hid_struct
Definition custom_hid_class.c:53

Definition at line 56 of file custom_hid_class.c.

Referenced by main().

◆ custom_hid_struct

custom_hid_type custom_hid_struct

Definition at line 53 of file custom_hid_class.c.


AT32F413 Firmwary Library: USB_custom_hid_class_endpoint_definition

Macros
USB_custom_hid_class_endpoint_definition
AT32F413_middlewares_usbd_class » USB_custom_hid_class

Macros

#define | USBD_CUSTOM_HID_IN_EPT 0x81
usb custom hid use endpoint define
#define | USBD_CUSTOM_HID_OUT_EPT 0x01
#define | USBD_CUSTOM_IN_MAXPACKET_SIZE 0x40
usb custom hid in and out max packet size define
#define | USBD_CUSTOM_OUT_MAXPACKET_SIZE 0x40

Detailed Description

Macro Definition Documentation

◆ USBD_CUSTOM_HID_IN_EPT

#define USBD_CUSTOM_HID_IN_EPT 0x81

usb custom hid use endpoint define

Definition at line 52 of file custom_hid_class.h.

Referenced by class_clear_handler(), class_init_handler(), and custom_hid_class_send_report().

◆ USBD_CUSTOM_HID_OUT_EPT

#define USBD_CUSTOM_HID_OUT_EPT 0x01

Definition at line 53 of file custom_hid_class.h.

Referenced by class_clear_handler(), class_init_handler(), and class_out_handler().

◆ USBD_CUSTOM_IN_MAXPACKET_SIZE

#define USBD_CUSTOM_IN_MAXPACKET_SIZE 0x40

usb custom hid in and out max packet size define

Definition at line 58 of file custom_hid_class.h.

Referenced by class_init_handler(), and main().

◆ USBD_CUSTOM_OUT_MAXPACKET_SIZE

#define USBD_CUSTOM_OUT_MAXPACKET_SIZE 0x40

Definition at line 59 of file custom_hid_class.h.

Referenced by class_init_handler().


AT32F413 Firmwary Library: USB_custom_hid_class_request_code_definition

Data Structures
USB_custom_hid_class_request_code_definition
AT32F413_middlewares_usbd_class » USB_custom_hid_class

Data Structures

struct custom_hid_type

Detailed Description

Generated by doxygen 1.12.0


AT32F413 Firmwary Library: custom_hid_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
custom_hid_type Struct Reference
AT32F413_middlewares_usbd_class » USB_custom_hid_class » USB_custom_hid_class_request_code_definition

#include <custom_hid_class.h>

Data Fields

uint8_t | g_rxhid_buff [0x40]
uint8_t | g_txhid_buff [0x40]
uint32_t | hid_protocol
uint32_t | hid_set_idle
uint32_t | alt_setting
uint8_t | hid_set_report [64]
uint8_t | hid_get_report [64]
uint8_t | hid_state
uint8_t | send_state

Detailed Description

Definition at line 69 of file custom_hid_class.h.

Field Documentation

◆ alt_setting

uint32_t custom_hid_type::alt_setting

Definition at line 76 of file custom_hid_class.h.

Referenced by class_setup_handler().

◆ g_rxhid_buff

uint8_t custom_hid_type::g_rxhid_buff[0x40]

Definition at line 71 of file custom_hid_class.h.

Referenced by class_init_handler(), class_out_handler(), and usb_hid_buf_process().

◆ g_txhid_buff

uint8_t custom_hid_type::g_txhid_buff[0x40]

Definition at line 72 of file custom_hid_class.h.

Referenced by usb_hid_buf_process().

◆ hid_get_report

uint8_t custom_hid_type::hid_get_report[64]

Definition at line 79 of file custom_hid_class.h.

Referenced by class_setup_handler().

◆ hid_protocol

uint32_t custom_hid_type::hid_protocol

Definition at line 74 of file custom_hid_class.h.

Referenced by class_setup_handler().

◆ hid_set_idle

uint32_t custom_hid_type::hid_set_idle

Definition at line 75 of file custom_hid_class.h.

Referenced by class_setup_handler().

◆ hid_set_report

uint8_t custom_hid_type::hid_set_report[64]

Definition at line 78 of file custom_hid_class.h.

Referenced by class_ept0_rx_handler(), and class_setup_handler().

◆ hid_state

uint8_t custom_hid_type::hid_state

Definition at line 80 of file custom_hid_class.h.

Referenced by class_ept0_rx_handler(), and class_setup_handler().

◆ send_state

uint8_t custom_hid_type::send_state

Definition at line 81 of file custom_hid_class.h.

Referenced by class_in_handler(), class_init_handler(), and custom_hid_class_send_report().

The documentation for this struct was generated from the following file:
  • custom_hid_class.h


AT32F413 Firmwary Library: USB_custom_hid_class_exported_functions

Functions | Variables
USB_custom_hid_class_exported_functions
AT32F413_middlewares_usbd_class » USB_custom_hid_class

Functions

usb_sts_type custom_hid_class_send_report (void *udev, uint8_t *report, uint16_t len)
usb device class send report

Variables

usbd_class_handler custom_hid_class_handler

Detailed Description

Function Documentation

◆ custom_hid_class_send_report()

usb_sts_type custom_hid_class_send_report | ( | void * | udev,
 |  | uint8_t * | report,
 |  | uint16_t | len )

usb device class send report

Parameters
udev | to the structure of usbd_core_type
report | report buffer
len | report length
Return values
status of usb_sts_type

Definition at line 339 of file custom_hid_class.c.

Referenced by main(), and usb_hid_buf_process().

Variable Documentation

◆ custom_hid_class_handler

usbd_class_handler custom_hid_class_handler
extern

Definition at line 56 of file custom_hid_class.c.

Referenced by main().


AT32F413 Firmwary Library: USB_custom_hid_desc

Topics | Variables
USB_custom_hid_desc
AT32F413_middlewares_usbd_class

usb device custom_hid descriptor More...

Topics

USB_custom_hid_desc_private_functions
USB_custom_hid_desc_definition

Variables

uint8_t | g_usbd_custom_hid_report [126]
uint8_t | g_custom_hid_usb_desc [9]
usbd_desc_handler custom_hid_desc_handler
custom hid device descriptor handler structure

Detailed Description

usb device custom_hid descriptor

Variable Documentation

◆ custom_hid_desc_handler

usbd_desc_handler custom_hid_desc_handler
extern

custom hid device descriptor handler structure

Definition at line 64 of file custom_hid_desc.c.

Referenced by main().

◆ g_custom_hid_usb_desc

uint8_t g_custom_hid_usb_desc[9]
extern

Referenced by class_setup_handler().

◆ g_usbd_custom_hid_report

uint8_t g_usbd_custom_hid_report[126]
extern

Referenced by class_setup_handler().


AT32F413 Firmwary Library: USB_custom_hid_desc_private_functions

Functions | Variables
USB_custom_hid_desc_private_functions
AT32F413_middlewares_usbd_class » USB_custom_hid_desc

Functions

static usbd_desc_t * | get_device_descriptor (void)
get device descriptor
static usbd_desc_t * | get_device_qualifier (void)
get device qualifier
static usbd_desc_t * | get_device_configuration (void)
get config descriptor
static usbd_desc_t * | get_device_other_speed (void)
get other speed descriptor
static usbd_desc_t * | get_device_lang_id (void)
get lang id descriptor
static usbd_desc_t * | get_device_manufacturer_string (void)
get manufacturer descriptor
static usbd_desc_t * | get_device_product_string (void)
get product descriptor
static usbd_desc_t * | get_device_serial_string (void)
get serial descriptor
static usbd_desc_t * | get_device_interface_string (void)
get interface descriptor
static usbd_desc_t * | get_device_config_string (void)
get device config descriptor
static uint16_t | usbd_unicode_convert (uint8_t *string, uint8_t *unicode_buf)
standard usb unicode convert
static void | usbd_int_to_unicode (uint32_t value, uint8_t *pbuf, uint8_t len)
usb int convert to unicode
static void | get_serial_num (void)
usb get serial number

Variables

static ALIGNED_HEAD uint8_t g_usbd_desc_buffer[256] | ALIGNED_TAIL
usb device standard descriptor
usbd_desc_handler custom_hid_desc_handler
custom hid device descriptor handler structure
static usbd_desc_t | device_descriptor
static usbd_desc_t | config_descriptor
static usbd_desc_t | langid_descriptor
static usbd_desc_t | serial_descriptor
static usbd_desc_t | vp_desc

Detailed Description

Function Documentation

◆ get_device_config_string()

static usbd_desc_t * get_device_config_string ( void )
static

get device config descriptor

Parameters
none
Return values
usbd_desc

Definition at line 515 of file custom_hid_desc.c.

◆ get_device_configuration()

static usbd_desc_t * get_device_configuration ( void )
static

get config descriptor

Parameters
none
Return values
usbd_desc

Definition at line 437 of file custom_hid_desc.c.

◆ get_device_descriptor()

static usbd_desc_t * get_device_descriptor ( void )
static

get device descriptor

Parameters
none
Return values
usbd_desc

Definition at line 417 of file custom_hid_desc.c.

◆ get_device_interface_string()

static usbd_desc_t * get_device_interface_string ( void )
static

get interface descriptor

Parameters
none
Return values
usbd_desc

Definition at line 503 of file custom_hid_desc.c.

◆ get_device_lang_id()

static usbd_desc_t * get_device_lang_id ( void )
static

get lang id descriptor

Parameters
none
Return values
usbd_desc

Definition at line 457 of file custom_hid_desc.c.

◆ get_device_manufacturer_string()

static usbd_desc_t * get_device_manufacturer_string ( void )
static

get manufacturer descriptor

Parameters
none
Return values
usbd_desc

Definition at line 468 of file custom_hid_desc.c.

◆ get_device_other_speed()

static usbd_desc_t * get_device_other_speed ( void )
static

get other speed descriptor

Parameters
none
Return values
usbd_desc

Definition at line 447 of file custom_hid_desc.c.

◆ get_device_product_string()

static usbd_desc_t * get_device_product_string ( void )
static

get product descriptor

Parameters
none
Return values
usbd_desc

Definition at line 480 of file custom_hid_desc.c.

◆ get_device_qualifier()

static usbd_desc_t * get_device_qualifier ( void )
static

get device qualifier

Parameters
none
Return values
usbd_desc

Definition at line 427 of file custom_hid_desc.c.

◆ get_device_serial_string()

static usbd_desc_t * get_device_serial_string ( void )
static

get serial descriptor

Parameters
none
Return values
usbd_desc

Definition at line 492 of file custom_hid_desc.c.

◆ get_serial_num()

static void get_serial_num ( void )
static

usb get serial number

Parameters
none
Return values
none

Definition at line 395 of file custom_hid_desc.c.

Referenced by get_device_serial_string().

◆ usbd_int_to_unicode()

static void usbd_int_to_unicode | ( | uint32_t | value,
 |  | uint8_t * | pbuf,
 |  | uint8_t | len )
 static

usb int convert to unicode

Parameters
value | int value
pbus | unicode buffer
len | length
Return values
none

Definition at line 369 of file custom_hid_desc.c.

Referenced by get_serial_num().

◆ usbd_unicode_convert()

static uint16_t usbd_unicode_convert | ( | uint8_t * | string,
 |  | uint8_t * | unicode_buf )
 static

standard usb unicode convert

Parameters
string | source string
unicode_buf | unicode buffer
Return values
length

Definition at line 343 of file custom_hid_desc.c.

Referenced by get_device_config_string(), get_device_interface_string(), get_device_manufacturer_string(), and get_device_product_string().

Variable Documentation

◆ ALIGNED_TAIL

ALIGNED_HEAD uint8_t g_string_serial [ 0x1A ] ALIGNED_TAIL
static
Initial value:
=
{
USB_DEVICE_DESC_LEN,
USB_DESCIPTOR_TYPE_DEVICE,
0x00,
0x02,
0x00,
0x00,
0x00,
USB_MAX_EP0_SIZE,
LBYTE( 0x2E3C ),
HBYTE( 0x2E3C ),
LBYTE( 0x5745 ),
HBYTE( 0x5745 ),
0x00,
0x02,
USB_MFC_STRING,
USB_PRODUCT_STRING,
USB_SERIAL_STRING,
1
}
HBYTE
#define HBYTE(x)
Definition usb_std.h:271
USB_MAX_EP0_SIZE
#define USB_MAX_EP0_SIZE
endpoint 0 max size
Definition usb_std.h:248
USB_PRODUCT_STRING
#define USB_PRODUCT_STRING
Definition usb_std.h:105
LBYTE
#define LBYTE(x)
low byte and high byte define
Definition usb_std.h:270
USB_DEVICE_DESC_LEN
#define USB_DEVICE_DESC_LEN
Definition usb_std.h:156
USB_MFC_STRING
#define USB_MFC_STRING
Definition usb_std.h:104
USB_SERIAL_STRING
#define USB_SERIAL_STRING
Definition usb_std.h:106
USB_DESCIPTOR_TYPE_DEVICE
#define USB_DESCIPTOR_TYPE_DEVICE
usb standard device type
Definition usb_std.h:91

usb device standard descriptor

usb string serial

usb string lang id

usb hid descriptor

usb hid report descriptor

usb configuration standard descriptor

Definition at line 59 of file custom_hid_desc.c.

◆ config_descriptor

usbd_desc_t config_descriptor
static
Initial value:
=
{
41 ,
g_usbd_configuration
}

Definition at line 315 of file custom_hid_desc.c.

Referenced by get_device_configuration().

◆ custom_hid_desc_handler

usbd_desc_handler custom_hid_desc_handler
Initial value:
=
{
get_device_descriptor,
get_device_qualifier,
get_device_configuration,
get_device_other_speed,
get_device_lang_id,
get_device_manufacturer_string,
get_device_product_string,
get_device_serial_string,
get_device_interface_string,
get_device_config_string,
}
get_device_configuration
static usbd_desc_t * get_device_configuration(void)
get config descriptor
Definition custom_hid_desc.c:437
get_device_descriptor
static usbd_desc_t * get_device_descriptor(void)
get device descriptor
Definition custom_hid_desc.c:417
get_device_manufacturer_string
static usbd_desc_t * get_device_manufacturer_string(void)
get manufacturer descriptor
Definition custom_hid_desc.c:468
get_device_qualifier
static usbd_desc_t * get_device_qualifier(void)
get device qualifier
Definition custom_hid_desc.c:427
get_device_interface_string
static usbd_desc_t * get_device_interface_string(void)
get interface descriptor
Definition custom_hid_desc.c:503
get_device_other_speed
static usbd_desc_t * get_device_other_speed(void)
get other speed descriptor
Definition custom_hid_desc.c:447
get_device_product_string
static usbd_desc_t * get_device_product_string(void)
get product descriptor
Definition custom_hid_desc.c:480
get_device_config_string
static usbd_desc_t * get_device_config_string(void)
get device config descriptor
Definition custom_hid_desc.c:515
get_device_lang_id
static usbd_desc_t * get_device_lang_id(void)
get lang id descriptor
Definition custom_hid_desc.c:457
get_device_serial_string
static usbd_desc_t * get_device_serial_string(void)
get serial descriptor
Definition custom_hid_desc.c:492

custom hid device descriptor handler structure

Definition at line 64 of file custom_hid_desc.c.

Referenced by main().

◆ device_descriptor

usbd_desc_t device_descriptor
static
Initial value:
=
{
USB_DEVICE_DESC_LEN,
g_usbd_descriptor
}

Definition at line 308 of file custom_hid_desc.c.

Referenced by get_device_descriptor().

◆ langid_descriptor

usbd_desc_t langid_descriptor
static
Initial value:
=
{
4 ,
g_string_lang_id
}

Definition at line 322 of file custom_hid_desc.c.

Referenced by get_device_lang_id().

◆ serial_descriptor

usbd_desc_t serial_descriptor
static
Initial value:
=
{
0x1A ,
g_string_serial
}

Definition at line 329 of file custom_hid_desc.c.

Referenced by get_device_serial_string().

◆ vp_desc

usbd_desc_t vp_desc
static

Definition at line 335 of file custom_hid_desc.c.

Referenced by get_device_config_string(), get_device_interface_string(), get_device_manufacturer_string(), and get_device_product_string().


AT32F413 Firmwary Library: USB_custom_hid_desc_definition

Macros
USB_custom_hid_desc_definition
AT32F413_middlewares_usbd_class » USB_custom_hid_desc

Macros

#define | CUSHID_BCD_NUM 0x0110
usb bcd number define
#define | USBD_CUSHID_VENDOR_ID 0x2E3C
usb vendor id and product id define
#define | USBD_CUSHID_PRODUCT_ID 0x5745
#define | USBD_CUSHID_CONFIG_DESC_SIZE 41
usb descriptor size define
#define | USBD_CUSHID_SIZ_REPORT_DESC 126
#define | USBD_CUSHID_SIZ_STRING_LANGID 4
#define | USBD_CUSHID_SIZ_STRING_SERIAL 0x1A
#define | USBD_CUSHID_DESC_MANUFACTURER_STRING "Artery"
usb string define(vendor, product configuration, interface)
#define | USBD_CUSHID_DESC_PRODUCT_STRING "Custom HID"
#define | USBD_CUSHID_DESC_CONFIGURATION_STRING "Custom HID Config"
#define | USBD_CUSHID_DESC_INTERFACE_STRING "Custom HID Interface"
#define | CUSHID_BINTERVAL_TIME 0x0A
#define | HID_REPORT_ID_1 0x01
usb hid report id define
#define | HID_REPORT_ID_2 0x02
#define | HID_REPORT_ID_3 0x03
#define | HID_REPORT_ID_4 0x04
#define | HID_REPORT_ID_5 0x05
#define | HID_REPORT_ID_6 0xF0
#define | MCU_ID1 (0x1FFFF7E8)
usb mcu id address deine
#define | MCU_ID2 (0x1FFFF7EC)
#define | MCU_ID3 (0x1FFFF7F0)

Detailed Description

Macro Definition Documentation

◆ CUSHID_BCD_NUM

#define CUSHID_BCD_NUM 0x0110

usb bcd number define

Definition at line 53 of file custom_hid_desc.h.

◆ CUSHID_BINTERVAL_TIME

#define CUSHID_BINTERVAL_TIME 0x0A

Definition at line 77 of file custom_hid_desc.h.

◆ HID_REPORT_ID_1

#define HID_REPORT_ID_1 0x01

usb hid report id define

usb hid report id define

Definition at line 85 of file custom_hid_desc.h.

◆ HID_REPORT_ID_2

#define HID_REPORT_ID_2 0x02

Definition at line 86 of file custom_hid_desc.h.

◆ HID_REPORT_ID_3

#define HID_REPORT_ID_3 0x03

Definition at line 87 of file custom_hid_desc.h.

◆ HID_REPORT_ID_4

#define HID_REPORT_ID_4 0x04

Definition at line 88 of file custom_hid_desc.h.

◆ HID_REPORT_ID_5

#define HID_REPORT_ID_5 0x05

Definition at line 89 of file custom_hid_desc.h.

◆ HID_REPORT_ID_6

#define HID_REPORT_ID_6 0xF0

Definition at line 90 of file custom_hid_desc.h.

◆ MCU_ID1

#define MCU_ID1 (0x1FFFF7E8)

usb mcu id address deine

Definition at line 95 of file custom_hid_desc.h.

◆ MCU_ID2

#define MCU_ID2 (0x1FFFF7EC)

Definition at line 96 of file custom_hid_desc.h.

◆ MCU_ID3

#define MCU_ID3 (0x1FFFF7F0)

Definition at line 97 of file custom_hid_desc.h.

◆ USBD_CUSHID_CONFIG_DESC_SIZE

#define USBD_CUSHID_CONFIG_DESC_SIZE 41

usb descriptor size define

Definition at line 64 of file custom_hid_desc.h.

◆ USBD_CUSHID_DESC_CONFIGURATION_STRING

#define USBD_CUSHID_DESC_CONFIGURATION_STRING "Custom HID Config"

Definition at line 74 of file custom_hid_desc.h.

Referenced by get_device_config_string().

◆ USBD_CUSHID_DESC_INTERFACE_STRING

#define USBD_CUSHID_DESC_INTERFACE_STRING "Custom HID Interface"

Definition at line 75 of file custom_hid_desc.h.

Referenced by get_device_interface_string().

◆ USBD_CUSHID_DESC_MANUFACTURER_STRING

#define USBD_CUSHID_DESC_MANUFACTURER_STRING "Artery"

usb string define(vendor, product configuration, interface)

Definition at line 72 of file custom_hid_desc.h.

Referenced by get_device_manufacturer_string().

◆ USBD_CUSHID_DESC_PRODUCT_STRING

#define USBD_CUSHID_DESC_PRODUCT_STRING "Custom HID"

Definition at line 73 of file custom_hid_desc.h.

Referenced by get_device_product_string().

◆ USBD_CUSHID_PRODUCT_ID

#define USBD_CUSHID_PRODUCT_ID 0x5745

Definition at line 59 of file custom_hid_desc.h.

◆ USBD_CUSHID_SIZ_REPORT_DESC

#define USBD_CUSHID_SIZ_REPORT_DESC 126

Definition at line 65 of file custom_hid_desc.h.

Referenced by class_setup_handler().

◆ USBD_CUSHID_SIZ_STRING_LANGID

#define USBD_CUSHID_SIZ_STRING_LANGID 4

Definition at line 66 of file custom_hid_desc.h.

◆ USBD_CUSHID_SIZ_STRING_SERIAL

#define USBD_CUSHID_SIZ_STRING_SERIAL 0x1A

Definition at line 67 of file custom_hid_desc.h.

◆ USBD_CUSHID_VENDOR_ID

#define USBD_CUSHID_VENDOR_ID 0x2E3C

usb vendor id and product id define

Definition at line 58 of file custom_hid_desc.h.


AT32F413 Firmwary Library: USB_hid_iap_class

Topics
USB_hid_iap_class
AT32F413_middlewares_usbd_class

usb device class hid iap demo More...

Topics

USB_hid_iap_class_private_functions
USB_hid_iap_class_definition

Detailed Description

usb device class hid iap demo


AT32F413 Firmwary Library: USB_hid_iap_class_private_functions

Functions | Variables
USB_hid_iap_class_private_functions
AT32F413_middlewares_usbd_class » USB_hid_iap_class

Functions

static usb_sts_type | class_init_handler (void *udev)
initialize usb custom hid endpoint
static usb_sts_type | class_clear_handler (void *udev)
clear endpoint or other state
static usb_sts_type | class_setup_handler (void *udev, usb_setup_type *setup)
usb device class setup request handler
static usb_sts_type | class_ept0_tx_handler (void *udev)
usb device endpoint 0 in status stage complete
static usb_sts_type | class_ept0_rx_handler (void *udev)
usb device endpoint 0 out status stage complete
static usb_sts_type | class_in_handler (void *udev, uint8_t ept_num)
usb device transmision complete handler
static usb_sts_type | class_out_handler (void *udev, uint8_t ept_num)
usb device endpoint receive data
static usb_sts_type | class_sof_handler (void *udev)
usb device sof handler
static usb_sts_type | class_event_handler (void *udev, usbd_event_type event)
usb device event handler
usb_sts_type | usb_iap_class_send_report (void *udev, uint8_t *report, uint16_t len)
usb device class send report

Variables

iap_info_type iap_info
usbd_class_handler hid_iap_class_handler

Detailed Description

Function Documentation

◆ class_clear_handler()

static usb_sts_type class_clear_handler ( void * udev )
static

clear endpoint or other state

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 97 of file hid_iap_class.c.

◆ class_ept0_rx_handler()

static usb_sts_type class_ept0_rx_handler ( void * udev )
static

usb device endpoint 0 out status stage complete

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 215 of file hid_iap_class.c.

◆ class_ept0_tx_handler()

static usb_sts_type class_ept0_tx_handler ( void * udev )
static

usb device endpoint 0 in status stage complete

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 201 of file hid_iap_class.c.

◆ class_event_handler()

static usb_sts_type class_event_handler | ( | void * | udev,
 |  | usbd_event_type | event )
 static

usb device event handler

Parameters
udev | to the structure of usbd_core_type
event | usb device event
Return values
status of usb_sts_type

Definition at line 293 of file hid_iap_class.c.

◆ class_in_handler()

static usb_sts_type class_in_handler | ( | void * | udev,
 |  | uint8_t | ept_num )
 static

usb device transmision complete handler

Parameters
udev | to the structure of usbd_core_type
ept_num | endpoint number
Return values
status of usb_sts_type

Definition at line 237 of file hid_iap_class.c.

◆ class_init_handler()

static usb_sts_type class_init_handler ( void * udev )
static

initialize usb custom hid endpoint

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 75 of file hid_iap_class.c.

◆ class_out_handler()

static usb_sts_type class_out_handler | ( | void * | udev,
 |  | uint8_t | ept_num )
 static

usb device endpoint receive data

Parameters
udev | to the structure of usbd_core_type
ept_num | endpoint number
Return values
status of usb_sts_type

Definition at line 255 of file hid_iap_class.c.

◆ class_setup_handler()

static usb_sts_type class_setup_handler | ( | void * | udev,
 |  | usb_setup_type * | setup )
 static

usb device class setup request handler

Parameters
udev | to the structure of usbd_core_type
setup | setup packet
Return values
status of usb_sts_type

Definition at line 117 of file hid_iap_class.c.

◆ class_sof_handler()

static usb_sts_type class_sof_handler ( void * udev )
static

usb device sof handler

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 278 of file hid_iap_class.c.

◆ usb_iap_class_send_report()

usb_sts_type usb_iap_class_send_report | ( | void * | udev,
 |  | uint8_t * | report,
 |  | uint16_t | len )

usb device class send report

Parameters
udev | to the structure of usbd_core_type
report | report buffer
len | report length
Return values
status of usb_sts_type

Definition at line 325 of file hid_iap_class.c.

Referenced by usbd_hid_iap_process(), and usbd_hid_iap_process().

Variable Documentation

◆ hid_iap_class_handler

usbd_class_handler hid_iap_class_handler
Initial value:
=
{
class_init_handler,
class_clear_handler,
class_setup_handler,
class_ept0_tx_handler,
class_ept0_rx_handler,
class_in_handler,
class_out_handler,
class_sof_handler,
class_event_handler,
&iap_info
}
class_sof_handler
static usb_sts_type class_sof_handler(void *udev)
usb device sof handler
Definition hid_iap_class.c:278
iap_info
iap_info_type iap_info
Definition hid_iap_class.c:53
class_in_handler
static usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
usb device transmision complete handler
Definition hid_iap_class.c:237
class_clear_handler
static usb_sts_type class_clear_handler(void *udev)
clear endpoint or other state
Definition hid_iap_class.c:97
class_setup_handler
static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
usb device class setup request handler
Definition hid_iap_class.c:117
class_ept0_tx_handler
static usb_sts_type class_ept0_tx_handler(void *udev)
usb device endpoint 0 in status stage complete
Definition hid_iap_class.c:201
class_ept0_rx_handler
static usb_sts_type class_ept0_rx_handler(void *udev)
usb device endpoint 0 out status stage complete
Definition hid_iap_class.c:215
class_event_handler
static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
usb device event handler
Definition hid_iap_class.c:293
class_init_handler
static usb_sts_type class_init_handler(void *udev)
initialize usb custom hid endpoint
Definition hid_iap_class.c:75
class_out_handler
static usb_sts_type class_out_handler(void *udev, uint8_t ept_num)
usb device endpoint receive data
Definition hid_iap_class.c:255

Definition at line 56 of file hid_iap_class.c.

Referenced by main().

◆ iap_info

iap_info_type iap_info

Definition at line 53 of file hid_iap_class.c.

Referenced by app_loop(), iap_address(), iap_clear_upgrade_flag(), iap_crc(), iap_data_write(), iap_erase_sector(), iap_finish(), iap_get(), iap_get_upgrade_flag(), iap_idle(), iap_init(), iap_jump(), iap_loop(), iap_respond(), iap_set_upgrade_flag(), iap_start(), usbd_hid_iap_in_complete(), usbd_hid_iap_process(), and usbd_hid_iap_process().


AT32F413 Firmwary Library: USB_hid_iap_class_definition

Data Structures | Macros | Enumerations | Functions | Variables
USB_hid_iap_class_definition
AT32F413_middlewares_usbd_class » USB_hid_iap_class

Data Structures

struct iap_info_type

Macros

#define | USBD_HIDIAP_IN_EPT 0x81
#define | USBD_HIDIAP_OUT_EPT 0x01
#define | USBD_HIDIAP_IN_MAXPACKET_SIZE 0x40
#define | USBD_HIDIAP_OUT_MAXPACKET_SIZE 0x40
#define | FLASH_SIZE_REG()
#define | KB_TO_B(kb)
#define | SECTOR_SIZE_1K 0x400
#define | SECTOR_SIZE_2K 0x800
#define | SECTOR_SIZE_4K 0x1000
#define | IAP_CMD_IDLE 0x5AA0
iap command
#define | IAP_CMD_START 0x5AA1
#define | IAP_CMD_ADDR 0x5AA2
#define | IAP_CMD_DATA 0x5AA3
#define | IAP_CMD_FINISH 0x5AA4
#define | IAP_CMD_CRC 0x5AA5
#define | IAP_CMD_JMP 0x5AA6
#define | IAP_CMD_GET 0x5AA7
#define | HID_IAP_BUFFER_LEN 1024
#define | IAP_UPGRADE_COMPLETE_FLAG 0x41544B38
#define | CONVERT_ENDIAN(dwValue)
#define | IAP_ACK 0xFF00
#define | IAP_NACK 0x00FF

Enumerations

enum iap_result_type { IAP_SUCCESS , IAP_WAIT , IAP_FAILED }
enum iap_machine_state_type {
IAP_STS_IDLE , IAP_STS_START , IAP_STS_ADDR , IAP_STS_DATA ,
IAP_STS_FINISH , IAP_STS_CRC , IAP_STS_JMP_WAIT , IAP_STS_JMP
}

Functions

usb_sts_type | usb_iap_class_send_report (void *udev, uint8_t *report, uint16_t len)
usb device class send report
iap_result_type | usbd_hid_iap_process (void *udev, uint8_t *report, uint16_t len)
usb device iap function
void | usbd_hid_iap_in_complete (void *udev)
usb device in transfer complete function

Variables

usbd_class_handler hid_iap_class_handler
iap_info_type iap_info

Detailed Description

Macro Definition Documentation

◆ CONVERT_ENDIAN

#define CONVERT_ENDIAN ( dwValue )
Value:
((dwValue >> 24) | ((dwValue >> 8) & 0xFF00) | \
((dwValue << 8) & 0xFF0000) | (dwValue << 24) )

Definition at line 78 of file hid_iap_class.h.

Referenced by crc_cal().

◆ FLASH_SIZE_REG

#define FLASH_SIZE_REG ( )
Value:
((*(uint32_t *)0x1FFFF7E0) & 0xFFFF) /*Get Flash size*/

Definition at line 57 of file hid_iap_class.h.

Referenced by iap_init().

◆ HID_IAP_BUFFER_LEN

#define HID_IAP_BUFFER_LEN 1024

Definition at line 76 of file hid_iap_class.h.

Referenced by iap_data_write().

◆ IAP_ACK

#define IAP_ACK 0xFF00

Definition at line 81 of file hid_iap_class.h.

Referenced by iap_address(), iap_crc(), iap_data_write(), iap_finish(), iap_get(), iap_idle(), iap_jump(), and iap_start().

◆ IAP_CMD_ADDR

#define IAP_CMD_ADDR 0x5AA2

Definition at line 69 of file hid_iap_class.h.

Referenced by iap_address(), and usbd_hid_iap_process().

◆ IAP_CMD_CRC

#define IAP_CMD_CRC 0x5AA5

Definition at line 72 of file hid_iap_class.h.

Referenced by iap_crc(), and usbd_hid_iap_process().

◆ IAP_CMD_DATA

#define IAP_CMD_DATA 0x5AA3

Definition at line 70 of file hid_iap_class.h.

Referenced by iap_data_write(), and usbd_hid_iap_process().

◆ IAP_CMD_FINISH

#define IAP_CMD_FINISH 0x5AA4

Definition at line 71 of file hid_iap_class.h.

Referenced by iap_finish(), and usbd_hid_iap_process().

◆ IAP_CMD_GET

#define IAP_CMD_GET 0x5AA7

Definition at line 74 of file hid_iap_class.h.

Referenced by iap_get(), usbd_hid_iap_process(), and usbd_hid_iap_process().

◆ IAP_CMD_IDLE

#define IAP_CMD_IDLE 0x5AA0

iap command

Definition at line 67 of file hid_iap_class.h.

Referenced by iap_idle(), usbd_hid_iap_process(), and usbd_hid_iap_process().

◆ IAP_CMD_JMP

#define IAP_CMD_JMP 0x5AA6

Definition at line 73 of file hid_iap_class.h.

Referenced by iap_jump(), usbd_hid_iap_process(), and usbd_hid_iap_process().

◆ IAP_CMD_START

#define IAP_CMD_START 0x5AA1

Definition at line 68 of file hid_iap_class.h.

Referenced by iap_start(), usbd_hid_iap_process(), and usbd_hid_iap_process().

◆ IAP_NACK

#define IAP_NACK 0x00FF

Definition at line 82 of file hid_iap_class.h.

Referenced by iap_address(), and iap_data_write().

◆ IAP_UPGRADE_COMPLETE_FLAG

#define IAP_UPGRADE_COMPLETE_FLAG 0x41544B38

Definition at line 77 of file hid_iap_class.h.

◆ KB_TO_B

#define KB_TO_B ( kb )
Value:
((kb) << 10)

Definition at line 58 of file hid_iap_class.h.

Referenced by iap_init().

◆ SECTOR_SIZE_1K

#define SECTOR_SIZE_1K 0x400

Definition at line 60 of file hid_iap_class.h.

◆ SECTOR_SIZE_2K

#define SECTOR_SIZE_2K 0x800

Definition at line 61 of file hid_iap_class.h.

◆ SECTOR_SIZE_4K

#define SECTOR_SIZE_4K 0x1000

Definition at line 62 of file hid_iap_class.h.

◆ USBD_HIDIAP_IN_EPT

#define USBD_HIDIAP_IN_EPT 0x81

Definition at line 51 of file hid_iap_class.h.

Referenced by class_clear_handler(), class_init_handler(), and usb_iap_class_send_report().

◆ USBD_HIDIAP_IN_MAXPACKET_SIZE

#define USBD_HIDIAP_IN_MAXPACKET_SIZE 0x40

Definition at line 54 of file hid_iap_class.h.

Referenced by class_init_handler().

◆ USBD_HIDIAP_OUT_EPT

#define USBD_HIDIAP_OUT_EPT 0x01

Definition at line 52 of file hid_iap_class.h.

Referenced by class_clear_handler(), class_init_handler(), and class_out_handler().

◆ USBD_HIDIAP_OUT_MAXPACKET_SIZE

#define USBD_HIDIAP_OUT_MAXPACKET_SIZE 0x40

Definition at line 55 of file hid_iap_class.h.

Referenced by class_init_handler(), and class_out_handler().

Enumeration Type Documentation

◆ iap_machine_state_type

enum iap_machine_state_type
Enumerator
IAP_STS_IDLE
IAP_STS_START
IAP_STS_ADDR
IAP_STS_DATA
IAP_STS_FINISH
IAP_STS_CRC
IAP_STS_JMP_WAIT
IAP_STS_JMP

Definition at line 91 of file hid_iap_class.h.

◆ iap_result_type

enum iap_result_type
Enumerator
IAP_SUCCESS
IAP_WAIT
IAP_FAILED

Definition at line 84 of file hid_iap_class.h.

Function Documentation

◆ usb_iap_class_send_report()

usb_sts_type usb_iap_class_send_report | ( | void * | udev,
 |  | uint8_t * | report,
 |  | uint16_t | len )

usb device class send report

Parameters
udev | to the structure of usbd_core_type
report | report buffer
len | report length
Return values
status of usb_sts_type

Definition at line 325 of file hid_iap_class.c.

Referenced by usbd_hid_iap_process(), and usbd_hid_iap_process().

◆ usbd_hid_iap_in_complete()

void usbd_hid_iap_in_complete ( void * udev )

usb device in transfer complete function

Parameters
udev to the structure of usbd_core_type
Return values
none

Definition at line 239 of file app_led3_toggle/src/hid_iap_user.c.

Referenced by class_in_handler().

◆ usbd_hid_iap_process()

iap_result_type usbd_hid_iap_process | ( | void * | udev,
 |  | uint8_t * | pdata,
 |  | uint16_t | len )

usb device iap function

Parameters
udev | to the structure of usbd_core_type
pdata | data buffer point
len | data length
Return values
iap_result_type

Definition at line 193 of file app_led3_toggle/src/hid_iap_user.c.

Referenced by class_out_handler().

Variable Documentation

◆ hid_iap_class_handler

usbd_class_handler hid_iap_class_handler
extern

Definition at line 56 of file hid_iap_class.c.

Referenced by main().

◆ iap_info

iap_info_type iap_info
extern

Definition at line 53 of file hid_iap_class.c.

Referenced by app_loop(), iap_address(), iap_clear_upgrade_flag(), iap_crc(), iap_data_write(), iap_erase_sector(), iap_finish(), iap_get(), iap_get_upgrade_flag(), iap_idle(), iap_init(), iap_jump(), iap_loop(), iap_respond(), iap_set_upgrade_flag(), iap_start(), usbd_hid_iap_in_complete(), usbd_hid_iap_process(), and usbd_hid_iap_process().


AT32F413 Firmwary Library: iap_info_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
iap_info_type Struct Reference
AT32F413_middlewares_usbd_class » USB_hid_iap_class » USB_hid_iap_class_definition

#include <hid_iap_class.h>

Data Fields

uint8_t | iap_fifo [1024]
uint8_t | iap_rx [0x40]
uint8_t | iap_tx [0x40]
uint32_t | fifo_length
uint32_t | tx_length
uint32_t | app_address
uint32_t | iap_address
uint32_t | flag_address
uint32_t | flash_start_address
uint32_t | flash_end_address
uint32_t | sector_size
uint32_t | flash_size
uint32_t | respond_flag
uint8_t | g_rxhid_buff [0x40]
uint32_t | hid_protocol
uint32_t | hid_set_idle
uint32_t | alt_setting
uint32_t | hid_state
uint8_t | hid_set_report [64]
iap_machine_state_type state

Detailed Description

Definition at line 103 of file hid_iap_class.h.

Field Documentation

◆ alt_setting

uint32_t iap_info_type::alt_setting

Definition at line 128 of file hid_iap_class.h.

Referenced by class_setup_handler().

◆ app_address

uint32_t iap_info_type::app_address

Definition at line 113 of file hid_iap_class.h.

Referenced by iap_get(), iap_init(), and iap_loop().

◆ fifo_length

uint32_t iap_info_type::fifo_length

Definition at line 110 of file hid_iap_class.h.

Referenced by iap_data_write(), and iap_init().

◆ flag_address

uint32_t iap_info_type::flag_address

Definition at line 115 of file hid_iap_class.h.

Referenced by iap_clear_upgrade_flag(), iap_get_upgrade_flag(), iap_init(), and iap_set_upgrade_flag().

◆ flash_end_address

uint32_t iap_info_type::flash_end_address

Definition at line 118 of file hid_iap_class.h.

Referenced by iap_address(), and iap_init().

◆ flash_size

uint32_t iap_info_type::flash_size

Definition at line 121 of file hid_iap_class.h.

Referenced by iap_init().

◆ flash_start_address

uint32_t iap_info_type::flash_start_address

Definition at line 117 of file hid_iap_class.h.

Referenced by iap_init().

◆ g_rxhid_buff

uint8_t iap_info_type::g_rxhid_buff[0x40]

Definition at line 125 of file hid_iap_class.h.

Referenced by class_init_handler(), and class_out_handler().

◆ hid_protocol

uint32_t iap_info_type::hid_protocol

Definition at line 126 of file hid_iap_class.h.

Referenced by class_setup_handler().

◆ hid_set_idle

uint32_t iap_info_type::hid_set_idle

Definition at line 127 of file hid_iap_class.h.

Referenced by class_setup_handler().

◆ hid_set_report

uint8_t iap_info_type::hid_set_report[64]

Definition at line 130 of file hid_iap_class.h.

Referenced by class_setup_handler().

◆ hid_state

uint32_t iap_info_type::hid_state

Definition at line 129 of file hid_iap_class.h.

Referenced by class_ept0_rx_handler(), and class_setup_handler().

◆ iap_address

uint32_t iap_info_type::iap_address

Definition at line 114 of file hid_iap_class.h.

Referenced by iap_address(), iap_data_write(), and iap_init().

◆ iap_fifo

uint8_t iap_info_type::iap_fifo[1024]

Definition at line 106 of file hid_iap_class.h.

Referenced by iap_data_write().

◆ iap_rx

uint8_t iap_info_type::iap_rx[0x40]

Definition at line 107 of file hid_iap_class.h.

◆ iap_tx

uint8_t iap_info_type::iap_tx[0x40]

Definition at line 108 of file hid_iap_class.h.

Referenced by iap_address(), iap_crc(), iap_data_write(), iap_finish(), iap_get(), iap_idle(), iap_jump(), iap_start(), usbd_hid_iap_process(), and usbd_hid_iap_process().

◆ respond_flag

uint32_t iap_info_type::respond_flag

Definition at line 123 of file hid_iap_class.h.

Referenced by iap_respond(), usbd_hid_iap_process(), and usbd_hid_iap_process().

◆ sector_size

uint32_t iap_info_type::sector_size

Definition at line 120 of file hid_iap_class.h.

Referenced by iap_erase_sector(), and iap_init().

◆ state

iap_machine_state_type iap_info_type::state

Definition at line 132 of file hid_iap_class.h.

Referenced by app_loop(), iap_address(), iap_data_write(), iap_finish(), iap_idle(), iap_jump(), iap_loop(), iap_start(), and usbd_hid_iap_in_complete().

◆ tx_length

uint32_t iap_info_type::tx_length

Definition at line 111 of file hid_iap_class.h.

The documentation for this struct was generated from the following file:
  • hid_iap_class.h


AT32F413 Firmwary Library: USB_hid_iap_desc

Topics
USB_hid_iap_desc
AT32F413_middlewares_usbd_class

usb device hid_iap descriptor More...

Topics

USB_hid_iap_desc_private_functions
USB_hid_iap_desc_definition

Detailed Description

usb device hid_iap descriptor


AT32F413 Firmwary Library: USB_hid_iap_desc_private_functions

Functions | Variables
USB_hid_iap_desc_private_functions
AT32F413_middlewares_usbd_class » USB_hid_iap_desc

Functions

static usbd_desc_t * | get_device_descriptor (void)
get device descriptor
static usbd_desc_t * | get_device_qualifier (void)
get device qualifier
static usbd_desc_t * | get_device_configuration (void)
get config descriptor
static usbd_desc_t * | get_device_other_speed (void)
get other speed descriptor
static usbd_desc_t * | get_device_lang_id (void)
get lang id descriptor
static usbd_desc_t * | get_device_manufacturer_string (void)
get manufacturer descriptor
static usbd_desc_t * | get_device_product_string (void)
get product descriptor
static usbd_desc_t * | get_device_serial_string (void)
get serial descriptor
static usbd_desc_t * | get_device_interface_string (void)
get interface descriptor
static usbd_desc_t * | get_device_config_string (void)
get device config descriptor
static uint16_t | usbd_unicode_convert (uint8_t *string, uint8_t *unicode_buf)
standard usb unicode convert
static void | usbd_int_to_unicode (uint32_t value, uint8_t *pbuf, uint8_t len)
usb int convert to unicode
static void | get_serial_num (void)
usb get serial number

Variables

static ALIGNED_HEAD uint8_t g_usbd_desc_buffer[256] | ALIGNED_TAIL
usb device standard descriptor
usbd_desc_handler hid_iap_desc_handler
hid device descriptor handler structure
static usbd_desc_t | device_descriptor
static usbd_desc_t | config_descriptor
static usbd_desc_t | langid_descriptor
static usbd_desc_t | serial_descriptor
static usbd_desc_t | vp_desc

Detailed Description

Function Documentation

◆ get_device_config_string()

static usbd_desc_t * get_device_config_string ( void )
static

get device config descriptor

Parameters
none
Return values
usbd_desc

Definition at line 451 of file hid_iap_desc.c.

◆ get_device_configuration()

static usbd_desc_t * get_device_configuration ( void )
static

get config descriptor

Parameters
none
Return values
usbd_desc

Definition at line 373 of file hid_iap_desc.c.

◆ get_device_descriptor()

static usbd_desc_t * get_device_descriptor ( void )
static

get device descriptor

Parameters
none
Return values
usbd_desc

Definition at line 353 of file hid_iap_desc.c.

◆ get_device_interface_string()

static usbd_desc_t * get_device_interface_string ( void )
static

get interface descriptor

Parameters
none
Return values
usbd_desc

Definition at line 439 of file hid_iap_desc.c.

◆ get_device_lang_id()

static usbd_desc_t * get_device_lang_id ( void )
static

get lang id descriptor

Parameters
none
Return values
usbd_desc

Definition at line 393 of file hid_iap_desc.c.

◆ get_device_manufacturer_string()

static usbd_desc_t * get_device_manufacturer_string ( void )
static

get manufacturer descriptor

Parameters
none
Return values
usbd_desc

Definition at line 404 of file hid_iap_desc.c.

◆ get_device_other_speed()

static usbd_desc_t * get_device_other_speed ( void )
static

get other speed descriptor

Parameters
none
Return values
usbd_desc

Definition at line 383 of file hid_iap_desc.c.

◆ get_device_product_string()

static usbd_desc_t * get_device_product_string ( void )
static

get product descriptor

Parameters
none
Return values
usbd_desc

Definition at line 416 of file hid_iap_desc.c.

◆ get_device_qualifier()

static usbd_desc_t * get_device_qualifier ( void )
static

get device qualifier

Parameters
none
Return values
usbd_desc

Definition at line 363 of file hid_iap_desc.c.

◆ get_device_serial_string()

static usbd_desc_t * get_device_serial_string ( void )
static

get serial descriptor

Parameters
none
Return values
usbd_desc

Definition at line 428 of file hid_iap_desc.c.

◆ get_serial_num()

static void get_serial_num ( void )
static

usb get serial number

Parameters
none
Return values
none

Definition at line 331 of file hid_iap_desc.c.

Referenced by get_device_serial_string().

◆ usbd_int_to_unicode()

static void usbd_int_to_unicode | ( | uint32_t | value,
 |  | uint8_t * | pbuf,
 |  | uint8_t | len )
 static

usb int convert to unicode

Parameters
value | int value
pbus | unicode buffer
len | length
Return values
none

Definition at line 305 of file hid_iap_desc.c.

Referenced by get_serial_num().

◆ usbd_unicode_convert()

static uint16_t usbd_unicode_convert | ( | uint8_t * | string,
 |  | uint8_t * | unicode_buf )
 static

standard usb unicode convert

Parameters
string | source string
unicode_buf | unicode buffer
Return values
length

Definition at line 279 of file hid_iap_desc.c.

Referenced by get_device_config_string(), get_device_interface_string(), get_device_manufacturer_string(), and get_device_product_string().

Variable Documentation

◆ ALIGNED_TAIL

ALIGNED_HEAD uint8_t g_string_serial [ 0x1A ] ALIGNED_TAIL
static
Initial value:
=
{
USB_DEVICE_DESC_LEN,
USB_DESCIPTOR_TYPE_DEVICE,
0x00,
0x02,
0x00,
0x00,
0x00,
USB_MAX_EP0_SIZE,
LBYTE( 0x2E3C ),
HBYTE( 0x2E3C ),
LBYTE( 0xAF01 ),
HBYTE( 0xAF01 ),
0x00,
0x02,
USB_MFC_STRING,
USB_PRODUCT_STRING,
USB_SERIAL_STRING,
1
}
HBYTE
#define HBYTE(x)
Definition usb_std.h:271
USB_MAX_EP0_SIZE
#define USB_MAX_EP0_SIZE
endpoint 0 max size
Definition usb_std.h:248
USB_PRODUCT_STRING
#define USB_PRODUCT_STRING
Definition usb_std.h:105
LBYTE
#define LBYTE(x)
low byte and high byte define
Definition usb_std.h:270
USB_DEVICE_DESC_LEN
#define USB_DEVICE_DESC_LEN
Definition usb_std.h:156
USB_MFC_STRING
#define USB_MFC_STRING
Definition usb_std.h:104
USB_SERIAL_STRING
#define USB_SERIAL_STRING
Definition usb_std.h:106
USB_DESCIPTOR_TYPE_DEVICE
#define USB_DESCIPTOR_TYPE_DEVICE
usb standard device type
Definition usb_std.h:91

usb device standard descriptor

usb string serial

usb string lang id

usb hid descriptor

usb hid report descriptor

usb configuration standard descriptor

Definition at line 62 of file hid_iap_desc.c.

◆ config_descriptor

usbd_desc_t config_descriptor
static
Initial value:
=
{
41 ,
g_usbd_configuration
}

Definition at line 251 of file hid_iap_desc.c.

Referenced by get_device_configuration().

◆ device_descriptor

usbd_desc_t device_descriptor
static
Initial value:
=
{
USB_DEVICE_DESC_LEN,
g_usbd_descriptor
}

Definition at line 244 of file hid_iap_desc.c.

Referenced by get_device_descriptor().

◆ hid_iap_desc_handler

usbd_desc_handler hid_iap_desc_handler
Initial value:
=
{
get_device_descriptor,
get_device_qualifier,
get_device_configuration,
get_device_other_speed,
get_device_lang_id,
get_device_manufacturer_string,
get_device_product_string,
get_device_serial_string,
get_device_interface_string,
get_device_config_string,
}
get_device_configuration
static usbd_desc_t * get_device_configuration(void)
get config descriptor
Definition hid_iap_desc.c:373
get_device_descriptor
static usbd_desc_t * get_device_descriptor(void)
get device descriptor
Definition hid_iap_desc.c:353
get_device_manufacturer_string
static usbd_desc_t * get_device_manufacturer_string(void)
get manufacturer descriptor
Definition hid_iap_desc.c:404
get_device_qualifier
static usbd_desc_t * get_device_qualifier(void)
get device qualifier
Definition hid_iap_desc.c:363
get_device_interface_string
static usbd_desc_t * get_device_interface_string(void)
get interface descriptor
Definition hid_iap_desc.c:439
get_device_other_speed
static usbd_desc_t * get_device_other_speed(void)
get other speed descriptor
Definition hid_iap_desc.c:383
get_device_product_string
static usbd_desc_t * get_device_product_string(void)
get product descriptor
Definition hid_iap_desc.c:416
get_device_config_string
static usbd_desc_t * get_device_config_string(void)
get device config descriptor
Definition hid_iap_desc.c:451
get_device_lang_id
static usbd_desc_t * get_device_lang_id(void)
get lang id descriptor
Definition hid_iap_desc.c:393
get_device_serial_string
static usbd_desc_t * get_device_serial_string(void)
get serial descriptor
Definition hid_iap_desc.c:428

hid device descriptor handler structure

Definition at line 67 of file hid_iap_desc.c.

Referenced by main().

◆ langid_descriptor

usbd_desc_t langid_descriptor
static
Initial value:
=
{
4 ,
g_string_lang_id
}

Definition at line 258 of file hid_iap_desc.c.

Referenced by get_device_lang_id().

◆ serial_descriptor

usbd_desc_t serial_descriptor
static
Initial value:
=
{
0x1A ,
g_string_serial
}

Definition at line 265 of file hid_iap_desc.c.

Referenced by get_device_serial_string().

◆ vp_desc

usbd_desc_t vp_desc
static

Definition at line 271 of file hid_iap_desc.c.

Referenced by get_device_config_string(), get_device_interface_string(), get_device_manufacturer_string(), and get_device_product_string().


AT32F413 Firmwary Library: USB_hid_iap_desc_definition

Macros | Variables
USB_hid_iap_desc_definition
AT32F413_middlewares_usbd_class » USB_hid_iap_desc

Macros

#define | HIDIAP_BCD_NUM 0x0110
#define | USBD_HIDIAP_VENDOR_ID 0x2E3C
#define | USBD_HIDIAP_PRODUCT_ID 0xAF01
#define | USBD_HIDIAP_CONFIG_DESC_SIZE 41
#define | USBD_HIDIAP_SIZ_REPORT_DESC 32
#define | USBD_HIDIAP_SIZ_STRING_LANGID 4
#define | USBD_HIDIAP_SIZ_STRING_SERIAL 0x1A
#define | USBD_HIDIAP_DESC_MANUFACTURER_STRING "Artery"
#define | USBD_HIDIAP_DESC_PRODUCT_STRING "HID IAP"
#define | USBD_HIDIAP_DESC_CONFIGURATION_STRING "HID IAP Config"
#define | USBD_HIDIAP_DESC_INTERFACE_STRING "HID IAP Interface"
#define | HIDIAP_BINTERVAL_TIME 0x01
#define | MCU_ID1 (0x1FFFF7E8)
#define | MCU_ID2 (0x1FFFF7EC)
#define | MCU_ID3 (0x1FFFF7F0)

Variables

uint8_t | g_usbd_hidiap_report [32]
uint8_t | g_hidiap_usb_desc [9]
usbd_desc_handler hid_iap_desc_handler
hid device descriptor handler structure

Detailed Description

Macro Definition Documentation

◆ HIDIAP_BCD_NUM

#define HIDIAP_BCD_NUM 0x0110

Definition at line 50 of file hid_iap_desc.h.

◆ HIDIAP_BINTERVAL_TIME

#define HIDIAP_BINTERVAL_TIME 0x01

Definition at line 65 of file hid_iap_desc.h.

◆ MCU_ID1

#define MCU_ID1 (0x1FFFF7E8)

Definition at line 67 of file hid_iap_desc.h.

◆ MCU_ID2

#define MCU_ID2 (0x1FFFF7EC)

Definition at line 68 of file hid_iap_desc.h.

◆ MCU_ID3

#define MCU_ID3 (0x1FFFF7F0)

Definition at line 69 of file hid_iap_desc.h.

◆ USBD_HIDIAP_CONFIG_DESC_SIZE

#define USBD_HIDIAP_CONFIG_DESC_SIZE 41

Definition at line 55 of file hid_iap_desc.h.

◆ USBD_HIDIAP_DESC_CONFIGURATION_STRING

#define USBD_HIDIAP_DESC_CONFIGURATION_STRING "HID IAP Config"

Definition at line 62 of file hid_iap_desc.h.

Referenced by get_device_config_string().

◆ USBD_HIDIAP_DESC_INTERFACE_STRING

#define USBD_HIDIAP_DESC_INTERFACE_STRING "HID IAP Interface"

Definition at line 63 of file hid_iap_desc.h.

Referenced by get_device_interface_string().

◆ USBD_HIDIAP_DESC_MANUFACTURER_STRING

#define USBD_HIDIAP_DESC_MANUFACTURER_STRING "Artery"

Definition at line 60 of file hid_iap_desc.h.

Referenced by get_device_manufacturer_string().

◆ USBD_HIDIAP_DESC_PRODUCT_STRING

#define USBD_HIDIAP_DESC_PRODUCT_STRING "HID IAP"

Definition at line 61 of file hid_iap_desc.h.

Referenced by get_device_product_string().

◆ USBD_HIDIAP_PRODUCT_ID

#define USBD_HIDIAP_PRODUCT_ID 0xAF01

Definition at line 53 of file hid_iap_desc.h.

◆ USBD_HIDIAP_SIZ_REPORT_DESC

#define USBD_HIDIAP_SIZ_REPORT_DESC 32

Definition at line 56 of file hid_iap_desc.h.

Referenced by class_setup_handler().

◆ USBD_HIDIAP_SIZ_STRING_LANGID

#define USBD_HIDIAP_SIZ_STRING_LANGID 4

Definition at line 57 of file hid_iap_desc.h.

◆ USBD_HIDIAP_SIZ_STRING_SERIAL

#define USBD_HIDIAP_SIZ_STRING_SERIAL 0x1A

Definition at line 58 of file hid_iap_desc.h.

◆ USBD_HIDIAP_VENDOR_ID

#define USBD_HIDIAP_VENDOR_ID 0x2E3C

Definition at line 52 of file hid_iap_desc.h.

Variable Documentation

◆ g_hidiap_usb_desc

uint8_t g_hidiap_usb_desc[9]
extern

Referenced by class_setup_handler().

◆ g_usbd_hidiap_report

uint8_t g_usbd_hidiap_report[32]
extern

Referenced by class_setup_handler().

◆ hid_iap_desc_handler

usbd_desc_handler hid_iap_desc_handler
extern

hid device descriptor handler structure

Definition at line 67 of file hid_iap_desc.c.

Referenced by main().


AT32F413 Firmwary Library: USB_keyboard_class

Topics | Data Structures
USB_keyboard_class
AT32F413_middlewares_usbd_class

usb device keyboard demo More...

Topics

USB_keyboard_class_private_functions
USB_keyboard_class_endpoint_definition
USB_hid_class_exported_functions

Data Structures

struct keyboard_type

Detailed Description

usb device keyboard demo


AT32F413 Firmwary Library: USB_keyboard_class_private_functions

Macros | Functions | Variables
USB_keyboard_class_private_functions
AT32F413_middlewares_usbd_class » USB_keyboard_class

Macros

#define SHIFT 0x80

Functions

static usb_sts_type | class_init_handler (void *udev)
initialize usb endpoint
static usb_sts_type | class_clear_handler (void *udev)
clear endpoint or other state
static usb_sts_type | class_setup_handler (void *udev, usb_setup_type *setup)
usb device class setup request handler
static usb_sts_type | class_ept0_tx_handler (void *udev)
usb device class endpoint 0 in status stage complete
static usb_sts_type | class_ept0_rx_handler (void *udev)
usb device class endpoint 0 out status stage complete
static usb_sts_type | class_in_handler (void *udev, uint8_t ept_num)
usb device class transmision complete handler
static usb_sts_type | class_out_handler (void *udev, uint8_t ept_num)
usb device class endpoint receive data
static usb_sts_type | class_sof_handler (void *udev)
usb device class sof handler
static usb_sts_type | class_event_handler (void *udev, usbd_event_type event)
usb device class event handler
usb_sts_type | usb_keyboard_class_send_report (void *udev, uint8_t *report, uint16_t len)
usb device class send report
void | usb_hid_keyboard_send_char (void *udev, uint8_t ascii_code)
usb device class report function

Variables

keyboard_type keyboard_struct
static const unsigned char _asciimap [128]
usbd_class_handler keyboard_class_handler

Detailed Description

Macro Definition Documentation

◆ SHIFT

#define SHIFT 0x80

Definition at line 53 of file keyboard_class.c.

Referenced by usb_hid_keyboard_send_char().

Function Documentation

◆ class_clear_handler()

static usb_sts_type class_clear_handler ( void * udev )
static

clear endpoint or other state

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 231 of file keyboard_class.c.

◆ class_ept0_rx_handler()

static usb_sts_type class_ept0_rx_handler ( void * udev )
static

usb device class endpoint 0 out status stage complete

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 346 of file keyboard_class.c.

◆ class_ept0_tx_handler()

static usb_sts_type class_ept0_tx_handler ( void * udev )
static

usb device class endpoint 0 in status stage complete

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 332 of file keyboard_class.c.

◆ class_event_handler()

static usb_sts_type class_event_handler | ( | void * | udev,
 |  | usbd_event_type | event )
 static

usb device class event handler

Parameters
udev | to the structure of usbd_core_type
event | usb device event
Return values
status of usb_sts_type

Definition at line 416 of file keyboard_class.c.

◆ class_in_handler()

static usb_sts_type class_in_handler | ( | void * | udev,
 |  | uint8_t | ept_num )
 static

usb device class transmision complete handler

Parameters
udev | to the structure of usbd_core_type
ept_num | endpoint number
Return values
status of usb_sts_type

Definition at line 368 of file keyboard_class.c.

◆ class_init_handler()

static usb_sts_type class_init_handler ( void * udev )
static

initialize usb endpoint

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 207 of file keyboard_class.c.

◆ class_out_handler()

static usb_sts_type class_out_handler | ( | void * | udev,
 |  | uint8_t | ept_num )
 static

usb device class endpoint receive data

Parameters
udev | to the structure of usbd_core_type
ept_num | endpoint number
Return values
status of usb_sts_type

Definition at line 389 of file keyboard_class.c.

◆ class_setup_handler()

static usb_sts_type class_setup_handler | ( | void * | udev,
 |  | usb_setup_type * | setup )
 static

usb device class setup request handler

Parameters
udev | to the structure of usbd_core_type
setup | setup packet
Return values
status of usb_sts_type

Definition at line 248 of file keyboard_class.c.

◆ class_sof_handler()

static usb_sts_type class_sof_handler ( void * udev )
static

usb device class sof handler

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 401 of file keyboard_class.c.

◆ usb_hid_keyboard_send_char()

void usb_hid_keyboard_send_char | ( | void * | udev,
 |  | uint8_t | ascii_code )

usb device class report function

Parameters
udev | to the structure of usbd_core_type
op | operation
Return values
none

Definition at line 473 of file keyboard_class.c.

Referenced by keyboard_send_string().

◆ usb_keyboard_class_send_report()

usb_sts_type usb_keyboard_class_send_report | ( | void * | udev,
 |  | uint8_t * | report,
 |  | uint16_t | len )

usb device class send report

Parameters
udev | to the structure of usbd_core_type
report | report buffer
len | report length
Return values
status of usb_sts_type

Definition at line 450 of file keyboard_class.c.

Referenced by usb_hid_keyboard_send_char().

Variable Documentation

◆ _asciimap

const unsigned char _asciimap[128]
static

Definition at line 54 of file keyboard_class.c.

Referenced by usb_hid_keyboard_send_char().

◆ keyboard_class_handler

usbd_class_handler keyboard_class_handler
Initial value:
=
{
class_init_handler,
class_clear_handler,
class_setup_handler,
class_ept0_tx_handler,
class_ept0_rx_handler,
class_in_handler,
class_out_handler,
class_sof_handler,
class_event_handler,
&keyboard_struct
}
class_sof_handler
static usb_sts_type class_sof_handler(void *udev)
usb device class sof handler
Definition keyboard_class.c:401
class_in_handler
static usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
usb device class transmision complete handler
Definition keyboard_class.c:368
keyboard_struct
keyboard_type keyboard_struct
Definition keyboard_class.c:52
class_clear_handler
static usb_sts_type class_clear_handler(void *udev)
clear endpoint or other state
Definition keyboard_class.c:231
class_setup_handler
static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
usb device class setup request handler
Definition keyboard_class.c:248
class_ept0_tx_handler
static usb_sts_type class_ept0_tx_handler(void *udev)
usb device class endpoint 0 in status stage complete
Definition keyboard_class.c:332
class_ept0_rx_handler
static usb_sts_type class_ept0_rx_handler(void *udev)
usb device class endpoint 0 out status stage complete
Definition keyboard_class.c:346
class_event_handler
static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
usb device class event handler
Definition keyboard_class.c:416
class_init_handler
static usb_sts_type class_init_handler(void *udev)
initialize usb endpoint
Definition keyboard_class.c:207
class_out_handler
static usb_sts_type class_out_handler(void *udev, uint8_t ept_num)
usb device class endpoint receive data
Definition keyboard_class.c:389

Definition at line 188 of file keyboard_class.c.

Referenced by main().

◆ keyboard_struct

keyboard_type keyboard_struct

Definition at line 52 of file keyboard_class.c.


AT32F413 Firmwary Library: USB_keyboard_class_endpoint_definition

Macros
USB_keyboard_class_endpoint_definition
AT32F413_middlewares_usbd_class » USB_keyboard_class

Macros

#define | USBD_KEYBOARD_IN_EPT 0x81
usb hid use endpoint define
#define | USBD_KEYBOARD_IN_MAXPACKET_SIZE 0x40
usb hid in and out max packet size define
#define | USBD_KEYBOARD_OUT_MAXPACKET_SIZE 0x40

Detailed Description

Macro Definition Documentation

◆ USBD_KEYBOARD_IN_EPT

#define USBD_KEYBOARD_IN_EPT 0x81

usb hid use endpoint define

Definition at line 52 of file keyboard_class.h.

Referenced by class_clear_handler(), class_init_handler(), and usb_keyboard_class_send_report().

◆ USBD_KEYBOARD_IN_MAXPACKET_SIZE

#define USBD_KEYBOARD_IN_MAXPACKET_SIZE 0x40

usb hid in and out max packet size define

Definition at line 57 of file keyboard_class.h.

Referenced by class_init_handler().

◆ USBD_KEYBOARD_OUT_MAXPACKET_SIZE

#define USBD_KEYBOARD_OUT_MAXPACKET_SIZE 0x40

Definition at line 58 of file keyboard_class.h.


AT32F413 Firmwary Library: USB_hid_class_exported_functions

Functions | Variables
USB_hid_class_exported_functions
AT32F413_middlewares_usbd_class » USB_keyboard_class | AT32F413_middlewares_usbd_class » USB_mouse_class

Functions

usb_sts_type | usb_keyboard_class_send_report (void *udev, uint8_t *report, uint16_t len)
usb device class send report
void | usb_hid_keyboard_send_char (void *udev, uint8_t ascii_code)
usb device class report function
usb_sts_type | usb_mouse_class_send_report (void *udev, uint8_t *report, uint16_t len)
usb device class send report
void | usb_hid_mouse_send (void *udev, uint8_t op)
usb device class report function

Variables

usbd_class_handler keyboard_class_handler
usbd_class_handler mouse_class_handler

Detailed Description

Function Documentation

◆ usb_hid_keyboard_send_char()

void usb_hid_keyboard_send_char | ( | void * | udev,
 |  | uint8_t | ascii_code )

usb device class report function

Parameters
udev | to the structure of usbd_core_type
op | operation
Return values
none

Definition at line 473 of file keyboard_class.c.

Referenced by keyboard_send_string().

◆ usb_hid_mouse_send()

void usb_hid_mouse_send | ( | void * | udev,
 |  | uint8_t | op )

usb device class report function

Parameters
udev | to the structure of usbd_core_type
op | operation
Return values
none

Definition at line 337 of file mouse_class.c.

Referenced by main().

◆ usb_keyboard_class_send_report()

usb_sts_type usb_keyboard_class_send_report | ( | void * | udev,
 |  | uint8_t * | report,
 |  | uint16_t | len )

usb device class send report

Parameters
udev | to the structure of usbd_core_type
report | report buffer
len | report length
Return values
status of usb_sts_type

Definition at line 450 of file keyboard_class.c.

Referenced by usb_hid_keyboard_send_char().

◆ usb_mouse_class_send_report()

usb_sts_type usb_mouse_class_send_report | ( | void * | udev,
 |  | uint8_t * | report,
 |  | uint16_t | len )

usb device class send report

Parameters
udev | to the structure of usbd_core_type
report | report buffer
len | report length
Return values
status of usb_sts_type

Definition at line 315 of file mouse_class.c.

Referenced by usb_hid_mouse_send().

Variable Documentation

◆ keyboard_class_handler

usbd_class_handler keyboard_class_handler
extern

Definition at line 188 of file keyboard_class.c.

Referenced by main().

◆ mouse_class_handler

usbd_class_handler mouse_class_handler
extern

Definition at line 55 of file mouse_class.c.

Referenced by main().


AT32F413 Firmwary Library: keyboard_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
keyboard_type Struct Reference
AT32F413_middlewares_usbd_class » USB_keyboard_class

#include <keyboard_class.h>

Data Fields

uint32_t | hid_protocol
uint32_t | hid_set_idle
uint32_t | alt_setting
uint8_t | hid_set_report [64]
uint8_t | keyboard_buf [8]
__IO uint8_t | hid_suspend_flag
__IO uint8_t | g_u8tx_completed
uint8_t | send_state
uint8_t | hid_state
uint8_t | temp

Detailed Description

Definition at line 65 of file keyboard_class.h.

Field Documentation

◆ alt_setting

uint32_t keyboard_type::alt_setting

Definition at line 69 of file keyboard_class.h.

Referenced by class_setup_handler().

◆ g_u8tx_completed

__IO uint8_t keyboard_type::g_u8tx_completed

Definition at line 74 of file keyboard_class.h.

Referenced by class_in_handler(), class_init_handler(), and keyboard_send_string().

◆ hid_protocol

uint32_t keyboard_type::hid_protocol

Definition at line 67 of file keyboard_class.h.

Referenced by class_setup_handler().

◆ hid_set_idle

uint32_t keyboard_type::hid_set_idle

Definition at line 68 of file keyboard_class.h.

Referenced by class_setup_handler().

◆ hid_set_report

uint8_t keyboard_type::hid_set_report[64]

Definition at line 70 of file keyboard_class.h.

Referenced by class_setup_handler().

◆ hid_state

uint8_t keyboard_type::hid_state

Definition at line 76 of file keyboard_class.h.

Referenced by class_ept0_rx_handler(), and class_setup_handler().

◆ hid_suspend_flag

__IO uint8_t keyboard_type::hid_suspend_flag

Definition at line 73 of file keyboard_class.h.

Referenced by class_event_handler().

◆ keyboard_buf

uint8_t keyboard_type::keyboard_buf[8]

Definition at line 71 of file keyboard_class.h.

Referenced by usb_hid_keyboard_send_char().

◆ send_state

uint8_t keyboard_type::send_state

Definition at line 75 of file keyboard_class.h.

Referenced by class_in_handler(), class_init_handler(), and usb_keyboard_class_send_report().

◆ temp

uint8_t keyboard_type::temp

Definition at line 77 of file keyboard_class.h.

Referenced by usb_hid_keyboard_send_char().

The documentation for this struct was generated from the following file:
  • keyboard_class.h


AT32F413 Firmwary Library: USB_keyboard_desc

Topics | Variables
USB_keyboard_desc
AT32F413_middlewares_usbd_class

usb device keyboard descriptor More...

Topics

USB_keyboard_desc_private_functions
USB_keyboard_desc_definition

Variables

uint8_t | g_usbd_keyboard_report [63]
uint8_t | g_keyboard_usb_desc [9]
usbd_desc_handler keyboard_desc_handler
keyboard device descriptor handler structure

Detailed Description

usb device keyboard descriptor

Variable Documentation

◆ g_keyboard_usb_desc

uint8_t g_keyboard_usb_desc[9]
extern

Referenced by class_setup_handler().

◆ g_usbd_keyboard_report

uint8_t g_usbd_keyboard_report[63]
extern

Referenced by class_setup_handler().

◆ keyboard_desc_handler

usbd_desc_handler keyboard_desc_handler
extern

keyboard device descriptor handler structure

Definition at line 65 of file keyboard_desc.c.

Referenced by main().


AT32F413 Firmwary Library: USB_keyboard_desc_private_functions

Functions | Variables
USB_keyboard_desc_private_functions
AT32F413_middlewares_usbd_class » USB_keyboard_desc

Functions

static usbd_desc_t * | get_device_descriptor (void)
get device descriptor
static usbd_desc_t * | get_device_qualifier (void)
get device qualifier
static usbd_desc_t * | get_device_configuration (void)
get config descriptor
static usbd_desc_t * | get_device_other_speed (void)
get other speed descriptor
static usbd_desc_t * | get_device_lang_id (void)
get lang id descriptor
static usbd_desc_t * | get_device_manufacturer_string (void)
get manufacturer descriptor
static usbd_desc_t * | get_device_product_string (void)
get product descriptor
static usbd_desc_t * | get_device_serial_string (void)
get serial descriptor
static usbd_desc_t * | get_device_interface_string (void)
get interface descriptor
static usbd_desc_t * | get_device_config_string (void)
get device config descriptor
static uint16_t | usbd_unicode_convert (uint8_t *string, uint8_t *unicode_buf)
standard usb unicode convert
static void | usbd_int_to_unicode (uint32_t value, uint8_t *pbuf, uint8_t len)
usb int convert to unicode
static void | get_serial_num (void)
usb get serial number

Variables

static ALIGNED_HEAD uint8_t g_usbd_desc_buffer[256] | ALIGNED_TAIL
usb device standard descriptor
usbd_desc_handler keyboard_desc_handler
keyboard device descriptor handler structure
static usbd_desc_t | device_descriptor
static usbd_desc_t | config_descriptor
static usbd_desc_t | langid_descriptor
static usbd_desc_t | serial_descriptor
static usbd_desc_t | vp_desc

Detailed Description

Function Documentation

◆ get_device_config_string()

static usbd_desc_t * get_device_config_string ( void )
static

get device config descriptor

Parameters
none
Return values
usbd_desc

Definition at line 452 of file keyboard_desc.c.

◆ get_device_configuration()

static usbd_desc_t * get_device_configuration ( void )
static

get config descriptor

Parameters
none
Return values
usbd_desc

Definition at line 374 of file keyboard_desc.c.

◆ get_device_descriptor()

static usbd_desc_t * get_device_descriptor ( void )
static

get device descriptor

Parameters
none
Return values
usbd_desc

Definition at line 354 of file keyboard_desc.c.

◆ get_device_interface_string()

static usbd_desc_t * get_device_interface_string ( void )
static

get interface descriptor

Parameters
none
Return values
usbd_desc

Definition at line 440 of file keyboard_desc.c.

◆ get_device_lang_id()

static usbd_desc_t * get_device_lang_id ( void )
static

get lang id descriptor

Parameters
none
Return values
usbd_desc

Definition at line 394 of file keyboard_desc.c.

◆ get_device_manufacturer_string()

static usbd_desc_t * get_device_manufacturer_string ( void )
static

get manufacturer descriptor

Parameters
none
Return values
usbd_desc

Definition at line 405 of file keyboard_desc.c.

◆ get_device_other_speed()

static usbd_desc_t * get_device_other_speed ( void )
static

get other speed descriptor

Parameters
none
Return values
usbd_desc

Definition at line 384 of file keyboard_desc.c.

◆ get_device_product_string()

static usbd_desc_t * get_device_product_string ( void )
static

get product descriptor

Parameters
none
Return values
usbd_desc

Definition at line 417 of file keyboard_desc.c.

◆ get_device_qualifier()

static usbd_desc_t * get_device_qualifier ( void )
static

get device qualifier

Parameters
none
Return values
usbd_desc

Definition at line 364 of file keyboard_desc.c.

◆ get_device_serial_string()

static usbd_desc_t * get_device_serial_string ( void )
static

get serial descriptor

Parameters
none
Return values
usbd_desc

Definition at line 429 of file keyboard_desc.c.

◆ get_serial_num()

static void get_serial_num ( void )
static

usb get serial number

Parameters
none
Return values
none

Definition at line 332 of file keyboard_desc.c.

Referenced by get_device_serial_string().

◆ usbd_int_to_unicode()

static void usbd_int_to_unicode | ( | uint32_t | value,
 |  | uint8_t * | pbuf,
 |  | uint8_t | len )
 static

usb int convert to unicode

Parameters
value | int value
pbus | unicode buffer
len | length
Return values
none

Definition at line 306 of file keyboard_desc.c.

Referenced by get_serial_num().

◆ usbd_unicode_convert()

static uint16_t usbd_unicode_convert | ( | uint8_t * | string,
 |  | uint8_t * | unicode_buf )
 static

standard usb unicode convert

Parameters
string | source string
unicode_buf | unicode buffer
Return values
length

Definition at line 280 of file keyboard_desc.c.

Referenced by get_device_config_string(), get_device_interface_string(), get_device_manufacturer_string(), and get_device_product_string().

Variable Documentation

◆ ALIGNED_TAIL

ALIGNED_HEAD uint8_t g_string_serial [ 0x1A ] ALIGNED_TAIL
static
Initial value:
=
{
USB_DEVICE_DESC_LEN,
USB_DESCIPTOR_TYPE_DEVICE,
0x00,
0x02,
0x00,
0x00,
0x00,
USB_MAX_EP0_SIZE,
LBYTE( 0x2E3C ),
HBYTE( 0x2E3C ),
LBYTE( 0x6040 ),
HBYTE( 0x6040 ),
0x00,
0x02,
USB_MFC_STRING,
USB_PRODUCT_STRING,
USB_SERIAL_STRING,
1
}
HBYTE
#define HBYTE(x)
Definition usb_std.h:271
USB_MAX_EP0_SIZE
#define USB_MAX_EP0_SIZE
endpoint 0 max size
Definition usb_std.h:248
USB_PRODUCT_STRING
#define USB_PRODUCT_STRING
Definition usb_std.h:105
LBYTE
#define LBYTE(x)
low byte and high byte define
Definition usb_std.h:270
USB_DEVICE_DESC_LEN
#define USB_DEVICE_DESC_LEN
Definition usb_std.h:156
USB_MFC_STRING
#define USB_MFC_STRING
Definition usb_std.h:104
USB_SERIAL_STRING
#define USB_SERIAL_STRING
Definition usb_std.h:106
USB_DESCIPTOR_TYPE_DEVICE
#define USB_DESCIPTOR_TYPE_DEVICE
usb standard device type
Definition usb_std.h:91

usb device standard descriptor

usb string serial

usb string lang id

usb hid descriptor

usb mouse report descriptor

usb configuration standard descriptor

Definition at line 60 of file keyboard_desc.c.

◆ config_descriptor

usbd_desc_t config_descriptor
static
Initial value:
=
{
34 ,
g_usbd_configuration
}

Definition at line 252 of file keyboard_desc.c.

Referenced by get_device_configuration().

◆ device_descriptor

usbd_desc_t device_descriptor
static
Initial value:
=
{
USB_DEVICE_DESC_LEN,
g_usbd_descriptor
}

Definition at line 245 of file keyboard_desc.c.

Referenced by get_device_descriptor().

◆ keyboard_desc_handler

usbd_desc_handler keyboard_desc_handler
Initial value:
=
{
get_device_descriptor,
get_device_qualifier,
get_device_configuration,
get_device_other_speed,
get_device_lang_id,
get_device_manufacturer_string,
get_device_product_string,
get_device_serial_string,
get_device_interface_string,
get_device_config_string,
}
get_device_configuration
static usbd_desc_t * get_device_configuration(void)
get config descriptor
Definition keyboard_desc.c:374
get_device_descriptor
static usbd_desc_t * get_device_descriptor(void)
get device descriptor
Definition keyboard_desc.c:354
get_device_manufacturer_string
static usbd_desc_t * get_device_manufacturer_string(void)
get manufacturer descriptor
Definition keyboard_desc.c:405
get_device_qualifier
static usbd_desc_t * get_device_qualifier(void)
get device qualifier
Definition keyboard_desc.c:364
get_device_interface_string
static usbd_desc_t * get_device_interface_string(void)
get interface descriptor
Definition keyboard_desc.c:440
get_device_other_speed
static usbd_desc_t * get_device_other_speed(void)
get other speed descriptor
Definition keyboard_desc.c:384
get_device_product_string
static usbd_desc_t * get_device_product_string(void)
get product descriptor
Definition keyboard_desc.c:417
get_device_config_string
static usbd_desc_t * get_device_config_string(void)
get device config descriptor
Definition keyboard_desc.c:452
get_device_lang_id
static usbd_desc_t * get_device_lang_id(void)
get lang id descriptor
Definition keyboard_desc.c:394
get_device_serial_string
static usbd_desc_t * get_device_serial_string(void)
get serial descriptor
Definition keyboard_desc.c:429

keyboard device descriptor handler structure

Definition at line 65 of file keyboard_desc.c.

Referenced by main().

◆ langid_descriptor

usbd_desc_t langid_descriptor
static
Initial value:
=
{
4 ,
g_string_lang_id
}

Definition at line 259 of file keyboard_desc.c.

Referenced by get_device_lang_id().

◆ serial_descriptor

usbd_desc_t serial_descriptor
static
Initial value:
=
{
0x1A ,
g_string_serial
}

Definition at line 266 of file keyboard_desc.c.

Referenced by get_device_serial_string().

◆ vp_desc

usbd_desc_t vp_desc
static

Definition at line 272 of file keyboard_desc.c.

Referenced by get_device_config_string(), get_device_interface_string(), get_device_manufacturer_string(), and get_device_product_string().


AT32F413 Firmwary Library: USB_keyboard_desc_definition

Macros
USB_keyboard_desc_definition
AT32F413_middlewares_usbd_class » USB_keyboard_desc

Macros

#define | KEYBOARD_BCD_NUM 0x0110
usb bcd number define
#define | USBD_KEYBOARD_VENDOR_ID 0x2E3C
usb vendor id and product id define
#define | USBD_KEYBOARD_PRODUCT_ID 0x6040
#define | USBD_KEYBOARD_CONFIG_DESC_SIZE 34
usb descriptor size define
#define | USBD_KEYBOARD_SIZ_REPORT_DESC 63
#define | USBD_KEYBOARD_SIZ_STRING_LANGID 4
#define | USBD_KEYBOARD_SIZ_STRING_SERIAL 0x1A
#define | USBD_KEYBOARD_DESC_MANUFACTURER_STRING "Artery"
usb string define(vendor, product configuration, interface)
#define | USBD_KEYBOARD_DESC_PRODUCT_STRING "Keyboard"
#define | USBD_KEYBOARD_DESC_CONFIGURATION_STRING "Keyboard Config"
#define | USBD_KEYBOARD_DESC_INTERFACE_STRING "Keyboard Interface"
#define | KEYBOARD_BINTERVAL_TIME 0x0A
usb hid endpoint interval define
#define | MCU_ID1 (0x1FFFF7E8)
usb mcu id address deine
#define | MCU_ID2 (0x1FFFF7EC)
#define | MCU_ID3 (0x1FFFF7F0)

Detailed Description

Macro Definition Documentation

◆ KEYBOARD_BCD_NUM

#define KEYBOARD_BCD_NUM 0x0110

usb bcd number define

Definition at line 52 of file keyboard_desc.h.

◆ KEYBOARD_BINTERVAL_TIME

#define KEYBOARD_BINTERVAL_TIME 0x0A

usb hid endpoint interval define

Definition at line 79 of file keyboard_desc.h.

◆ MCU_ID1

#define MCU_ID1 (0x1FFFF7E8)

usb mcu id address deine

Definition at line 84 of file keyboard_desc.h.

◆ MCU_ID2

#define MCU_ID2 (0x1FFFF7EC)

Definition at line 85 of file keyboard_desc.h.

◆ MCU_ID3

#define MCU_ID3 (0x1FFFF7F0)

Definition at line 86 of file keyboard_desc.h.

◆ USBD_KEYBOARD_CONFIG_DESC_SIZE

#define USBD_KEYBOARD_CONFIG_DESC_SIZE 34

usb descriptor size define

Definition at line 63 of file keyboard_desc.h.

◆ USBD_KEYBOARD_DESC_CONFIGURATION_STRING

#define USBD_KEYBOARD_DESC_CONFIGURATION_STRING "Keyboard Config"

Definition at line 73 of file keyboard_desc.h.

Referenced by get_device_config_string().

◆ USBD_KEYBOARD_DESC_INTERFACE_STRING

#define USBD_KEYBOARD_DESC_INTERFACE_STRING "Keyboard Interface"

Definition at line 74 of file keyboard_desc.h.

Referenced by get_device_interface_string().

◆ USBD_KEYBOARD_DESC_MANUFACTURER_STRING

#define USBD_KEYBOARD_DESC_MANUFACTURER_STRING "Artery"

usb string define(vendor, product configuration, interface)

Definition at line 71 of file keyboard_desc.h.

Referenced by get_device_manufacturer_string().

◆ USBD_KEYBOARD_DESC_PRODUCT_STRING

#define USBD_KEYBOARD_DESC_PRODUCT_STRING "Keyboard"

Definition at line 72 of file keyboard_desc.h.

Referenced by get_device_product_string().

◆ USBD_KEYBOARD_PRODUCT_ID

#define USBD_KEYBOARD_PRODUCT_ID 0x6040

Definition at line 58 of file keyboard_desc.h.

◆ USBD_KEYBOARD_SIZ_REPORT_DESC

#define USBD_KEYBOARD_SIZ_REPORT_DESC 63

Definition at line 64 of file keyboard_desc.h.

Referenced by class_setup_handler().

◆ USBD_KEYBOARD_SIZ_STRING_LANGID

#define USBD_KEYBOARD_SIZ_STRING_LANGID 4

Definition at line 65 of file keyboard_desc.h.

◆ USBD_KEYBOARD_SIZ_STRING_SERIAL

#define USBD_KEYBOARD_SIZ_STRING_SERIAL 0x1A

Definition at line 66 of file keyboard_desc.h.

◆ USBD_KEYBOARD_VENDOR_ID

#define USBD_KEYBOARD_VENDOR_ID 0x2E3C

usb vendor id and product id define

Definition at line 57 of file keyboard_desc.h.


AT32F413 Firmwary Library: USB_mouse_class

Topics
USB_mouse_class
AT32F413_middlewares_usbd_class

usb device mouse demo More...

Topics

USB_mouse_class_private_functions
USB_mouse_class_endpoint_definition
USB_mouse_class_request_code_definition
USB_hid_class_exported_functions

Detailed Description

usb device mouse demo


AT32F413 Firmwary Library: USB_mouse_class_private_functions

Functions | Variables
USB_mouse_class_private_functions
AT32F413_middlewares_usbd_class » USB_mouse_class

Functions

static usb_sts_type | class_init_handler (void *udev)
initialize usb endpoint
static usb_sts_type | class_clear_handler (void *udev)
clear endpoint or other state
static usb_sts_type | class_setup_handler (void *udev, usb_setup_type *setup)
usb device class setup request handler
static usb_sts_type | class_ept0_tx_handler (void *udev)
usb device class endpoint 0 in status stage complete
static usb_sts_type | class_ept0_rx_handler (void *udev)
usb device class endpoint 0 out status stage complete
static usb_sts_type | class_in_handler (void *udev, uint8_t ept_num)
usb device class transmision complete handler
static usb_sts_type | class_out_handler (void *udev, uint8_t ept_num)
usb device class endpoint receive data
static usb_sts_type | class_sof_handler (void *udev)
usb device class sof handler
static usb_sts_type | class_event_handler (void *udev, usbd_event_type event)
usb device class event handler
usb_sts_type | usb_mouse_class_send_report (void *udev, uint8_t *report, uint16_t len)
usb device class send report
void | usb_hid_mouse_send (void *udev, uint8_t op)
usb device class report function

Variables

mouse_type mouse_struct
usbd_class_handler mouse_class_handler

Detailed Description

Function Documentation

◆ class_clear_handler()

static usb_sts_type class_clear_handler ( void * udev )
static

clear endpoint or other state

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 98 of file mouse_class.c.

◆ class_ept0_rx_handler()

static usb_sts_type class_ept0_rx_handler ( void * udev )
static

usb device class endpoint 0 out status stage complete

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 213 of file mouse_class.c.

◆ class_ept0_tx_handler()

static usb_sts_type class_ept0_tx_handler ( void * udev )
static

usb device class endpoint 0 in status stage complete

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 199 of file mouse_class.c.

◆ class_event_handler()

static usb_sts_type class_event_handler | ( | void * | udev,
 |  | usbd_event_type | event )
 static

usb device class event handler

Parameters
udev | to the structure of usbd_core_type
event | usb device event
Return values
status of usb_sts_type

Definition at line 281 of file mouse_class.c.

◆ class_in_handler()

static usb_sts_type class_in_handler | ( | void * | udev,
 |  | uint8_t | ept_num )
 static

usb device class transmision complete handler

Parameters
udev | to the structure of usbd_core_type
ept_num | endpoint number
Return values
status of usb_sts_type

Definition at line 235 of file mouse_class.c.

◆ class_init_handler()

static usb_sts_type class_init_handler ( void * udev )
static

initialize usb endpoint

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 74 of file mouse_class.c.

◆ class_out_handler()

static usb_sts_type class_out_handler | ( | void * | udev,
 |  | uint8_t | ept_num )
 static

usb device class endpoint receive data

Parameters
udev | to the structure of usbd_core_type
ept_num | endpoint number
Return values
status of usb_sts_type

Definition at line 254 of file mouse_class.c.

◆ class_setup_handler()

static usb_sts_type class_setup_handler | ( | void * | udev,
 |  | usb_setup_type * | setup )
 static

usb device class setup request handler

Parameters
udev | to the structure of usbd_core_type
setup | setup packet
Return values
status of usb_sts_type

Definition at line 115 of file mouse_class.c.

◆ class_sof_handler()

static usb_sts_type class_sof_handler ( void * udev )
static

usb device class sof handler

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 266 of file mouse_class.c.

◆ usb_hid_mouse_send()

void usb_hid_mouse_send | ( | void * | udev,
 |  | uint8_t | op )

usb device class report function

Parameters
udev | to the structure of usbd_core_type
op | operation
Return values
none

Definition at line 337 of file mouse_class.c.

Referenced by main().

◆ usb_mouse_class_send_report()

usb_sts_type usb_mouse_class_send_report | ( | void * | udev,
 |  | uint8_t * | report,
 |  | uint16_t | len )

usb device class send report

Parameters
udev | to the structure of usbd_core_type
report | report buffer
len | report length
Return values
status of usb_sts_type

Definition at line 315 of file mouse_class.c.

Referenced by usb_hid_mouse_send().

Variable Documentation

◆ mouse_class_handler

usbd_class_handler mouse_class_handler
Initial value:
=
{
class_init_handler,
class_clear_handler,
class_setup_handler,
class_ept0_tx_handler,
class_ept0_rx_handler,
class_in_handler,
class_out_handler,
class_sof_handler,
class_event_handler,
&mouse_struct
}
class_sof_handler
static usb_sts_type class_sof_handler(void *udev)
usb device class sof handler
Definition mouse_class.c:266
class_in_handler
static usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
usb device class transmision complete handler
Definition mouse_class.c:235
class_clear_handler
static usb_sts_type class_clear_handler(void *udev)
clear endpoint or other state
Definition mouse_class.c:98
class_setup_handler
static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
usb device class setup request handler
Definition mouse_class.c:115
class_ept0_tx_handler
static usb_sts_type class_ept0_tx_handler(void *udev)
usb device class endpoint 0 in status stage complete
Definition mouse_class.c:199
class_ept0_rx_handler
static usb_sts_type class_ept0_rx_handler(void *udev)
usb device class endpoint 0 out status stage complete
Definition mouse_class.c:213
mouse_struct
mouse_type mouse_struct
Definition mouse_class.c:52
class_event_handler
static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
usb device class event handler
Definition mouse_class.c:281
class_init_handler
static usb_sts_type class_init_handler(void *udev)
initialize usb endpoint
Definition mouse_class.c:74
class_out_handler
static usb_sts_type class_out_handler(void *udev, uint8_t ept_num)
usb device class endpoint receive data
Definition mouse_class.c:254

Definition at line 55 of file mouse_class.c.

Referenced by main().

◆ mouse_struct

mouse_type mouse_struct

Definition at line 52 of file mouse_class.c.


AT32F413 Firmwary Library: USB_mouse_class_endpoint_definition

Macros
USB_mouse_class_endpoint_definition
AT32F413_middlewares_usbd_class » USB_mouse_class

Macros

#define | USBD_MOUSE_IN_EPT 0x81
usb hid use endpoint define
#define | USBD_MOUSE_IN_MAXPACKET_SIZE 0x40
usb hid in and out max packet size define

Detailed Description

Macro Definition Documentation

◆ USBD_MOUSE_IN_EPT

#define USBD_MOUSE_IN_EPT 0x81

usb hid use endpoint define

Definition at line 52 of file mouse_class.h.

Referenced by class_clear_handler(), class_init_handler(), and usb_mouse_class_send_report().

◆ USBD_MOUSE_IN_MAXPACKET_SIZE

#define USBD_MOUSE_IN_MAXPACKET_SIZE 0x40

usb hid in and out max packet size define

Definition at line 57 of file mouse_class.h.

Referenced by class_init_handler().


AT32F413 Firmwary Library: USB_mouse_class_request_code_definition

Data Structures | Macros
USB_mouse_class_request_code_definition
AT32F413_middlewares_usbd_class » USB_mouse_class

Data Structures

struct mouse_type

Macros

#define | MOVE_STEP 20
usb hid mouse operation
#define | BUTTON_RELEASE 0
#define | LEFT_BUTTON 1
#define | RIGHT_BUTTON 2
#define | LEFT_MOVE 3
#define | RIGHT_MOVE 4
#define | UP_MOVE 5
#define | DOWN_MOVE 6

Detailed Description

Macro Definition Documentation

◆ BUTTON_RELEASE

#define BUTTON_RELEASE 0

Definition at line 73 of file mouse_class.h.

Referenced by main().

◆ DOWN_MOVE

#define DOWN_MOVE 6

Definition at line 79 of file mouse_class.h.

Referenced by usb_hid_mouse_send().

◆ LEFT_BUTTON

#define LEFT_BUTTON 1

Definition at line 74 of file mouse_class.h.

Referenced by usb_hid_mouse_send().

◆ LEFT_MOVE

#define LEFT_MOVE 3

Definition at line 76 of file mouse_class.h.

Referenced by usb_hid_mouse_send().

◆ MOVE_STEP

#define MOVE_STEP 20

usb hid mouse operation

Definition at line 71 of file mouse_class.h.

Referenced by usb_hid_mouse_send().

◆ RIGHT_BUTTON

#define RIGHT_BUTTON 2

Definition at line 75 of file mouse_class.h.

Referenced by main(), and usb_hid_mouse_send().

◆ RIGHT_MOVE

#define RIGHT_MOVE 4

Definition at line 77 of file mouse_class.h.

Referenced by usb_hid_mouse_send().

◆ UP_MOVE

#define UP_MOVE 5

Definition at line 78 of file mouse_class.h.

Referenced by usb_hid_mouse_send().


AT32F413 Firmwary Library: mouse_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
mouse_type Struct Reference
AT32F413_middlewares_usbd_class » USB_mouse_class » USB_mouse_class_request_code_definition

#include <mouse_class.h>

Data Fields

uint32_t | hid_protocol
uint32_t | hid_set_idle
uint32_t | alt_setting
uint8_t | hid_set_report [64]
uint8_t | mouse_buffer [4]
uint8_t | hid_state
__IO uint8_t | hid_suspend_flag
uint8_t | send_state

Detailed Description

Definition at line 81 of file mouse_class.h.

Field Documentation

◆ alt_setting

uint32_t mouse_type::alt_setting

Definition at line 85 of file mouse_class.h.

Referenced by class_setup_handler().

◆ hid_protocol

uint32_t mouse_type::hid_protocol

Definition at line 83 of file mouse_class.h.

Referenced by class_setup_handler().

◆ hid_set_idle

uint32_t mouse_type::hid_set_idle

Definition at line 84 of file mouse_class.h.

Referenced by class_setup_handler().

◆ hid_set_report

uint8_t mouse_type::hid_set_report[64]

Definition at line 87 of file mouse_class.h.

Referenced by class_setup_handler().

◆ hid_state

uint8_t mouse_type::hid_state

Definition at line 89 of file mouse_class.h.

Referenced by class_ept0_rx_handler(), and class_setup_handler().

◆ hid_suspend_flag

__IO uint8_t mouse_type::hid_suspend_flag

Definition at line 90 of file mouse_class.h.

Referenced by class_event_handler().

◆ mouse_buffer

uint8_t mouse_type::mouse_buffer[4]

Definition at line 88 of file mouse_class.h.

Referenced by usb_hid_mouse_send().

◆ send_state

uint8_t mouse_type::send_state

Definition at line 91 of file mouse_class.h.

Referenced by class_in_handler(), class_init_handler(), and usb_mouse_class_send_report().

The documentation for this struct was generated from the following file:
  • mouse_class.h


AT32F413 Firmwary Library: USB_mouse_desc

Topics | Variables
USB_mouse_desc
AT32F413_middlewares_usbd_class

usb device mouse descriptor More...

Topics

USB_mouse_desc_private_functions
USB_mouse_desc_definition

Variables

uint8_t | g_usbd_mouse_report [74]
uint8_t | g_mouse_usb_desc [9]
usbd_desc_handler mouse_desc_handler
mouse device descriptor handler structure

Detailed Description

usb device mouse descriptor

Variable Documentation

◆ g_mouse_usb_desc

uint8_t g_mouse_usb_desc[9]
extern

Referenced by class_setup_handler().

◆ g_usbd_mouse_report

uint8_t g_usbd_mouse_report[74]
extern

Referenced by class_setup_handler().

◆ mouse_desc_handler

usbd_desc_handler mouse_desc_handler
extern

mouse device descriptor handler structure

Definition at line 65 of file mouse_desc.c.

Referenced by main().


AT32F413 Firmwary Library: USB_mouse_desc_private_functions

Functions | Variables
USB_mouse_desc_private_functions
AT32F413_middlewares_usbd_class » USB_mouse_desc

Functions

static usbd_desc_t * | get_device_descriptor (void)
get device descriptor
static usbd_desc_t * | get_device_qualifier (void)
get device qualifier
static usbd_desc_t * | get_device_configuration (void)
get config descriptor
static usbd_desc_t * | get_device_other_speed (void)
get other speed descriptor
static usbd_desc_t * | get_device_lang_id (void)
get lang id descriptor
static usbd_desc_t * | get_device_manufacturer_string (void)
get manufacturer descriptor
static usbd_desc_t * | get_device_product_string (void)
get product descriptor
static usbd_desc_t * | get_device_serial_string (void)
get serial descriptor
static usbd_desc_t * | get_device_interface_string (void)
get interface descriptor
static usbd_desc_t * | get_device_config_string (void)
get device config descriptor
static uint16_t | usbd_unicode_convert (uint8_t *string, uint8_t *unicode_buf)
standard usb unicode convert
static void | usbd_int_to_unicode (uint32_t value, uint8_t *pbuf, uint8_t len)
usb int convert to unicode
static void | get_serial_num (void)
usb get serial number

Variables

static ALIGNED_HEAD uint8_t g_usbd_desc_buffer[256] | ALIGNED_TAIL
usb device standard descriptor
usbd_desc_handler mouse_desc_handler
mouse device descriptor handler structure
static usbd_desc_t | device_descriptor
static usbd_desc_t | config_descriptor
static usbd_desc_t | langid_descriptor
static usbd_desc_t | serial_descriptor
static usbd_desc_t | vp_desc

Detailed Description

Function Documentation

◆ get_device_config_string()

static usbd_desc_t * get_device_config_string ( void )
static

get device config descriptor

Parameters
none
Return values
usbd_desc

Definition at line 466 of file mouse_desc.c.

◆ get_device_configuration()

static usbd_desc_t * get_device_configuration ( void )
static

get config descriptor

Parameters
none
Return values
usbd_desc

Definition at line 388 of file mouse_desc.c.

◆ get_device_descriptor()

static usbd_desc_t * get_device_descriptor ( void )
static

get device descriptor

Parameters
none
Return values
usbd_desc

Definition at line 368 of file mouse_desc.c.

◆ get_device_interface_string()

static usbd_desc_t * get_device_interface_string ( void )
static

get interface descriptor

Parameters
none
Return values
usbd_desc

Definition at line 454 of file mouse_desc.c.

◆ get_device_lang_id()

static usbd_desc_t * get_device_lang_id ( void )
static

get lang id descriptor

Parameters
none
Return values
usbd_desc

Definition at line 408 of file mouse_desc.c.

◆ get_device_manufacturer_string()

static usbd_desc_t * get_device_manufacturer_string ( void )
static

get manufacturer descriptor

Parameters
none
Return values
usbd_desc

Definition at line 419 of file mouse_desc.c.

◆ get_device_other_speed()

static usbd_desc_t * get_device_other_speed ( void )
static

get other speed descriptor

Parameters
none
Return values
usbd_desc

Definition at line 398 of file mouse_desc.c.

◆ get_device_product_string()

static usbd_desc_t * get_device_product_string ( void )
static

get product descriptor

Parameters
none
Return values
usbd_desc

Definition at line 431 of file mouse_desc.c.

◆ get_device_qualifier()

static usbd_desc_t * get_device_qualifier ( void )
static

get device qualifier

Parameters
none
Return values
usbd_desc

Definition at line 378 of file mouse_desc.c.

◆ get_device_serial_string()

static usbd_desc_t * get_device_serial_string ( void )
static

get serial descriptor

Parameters
none
Return values
usbd_desc

Definition at line 443 of file mouse_desc.c.

◆ get_serial_num()

static void get_serial_num ( void )
static

usb get serial number

Parameters
none
Return values
none

Definition at line 346 of file mouse_desc.c.

Referenced by get_device_serial_string().

◆ usbd_int_to_unicode()

static void usbd_int_to_unicode | ( | uint32_t | value,
 |  | uint8_t * | pbuf,
 |  | uint8_t | len )
 static

usb int convert to unicode

Parameters
value | int value
pbus | unicode buffer
len | length
Return values
none

Definition at line 320 of file mouse_desc.c.

Referenced by get_serial_num().

◆ usbd_unicode_convert()

static uint16_t usbd_unicode_convert | ( | uint8_t * | string,
 |  | uint8_t * | unicode_buf )
 static

standard usb unicode convert

Parameters
string | source string
unicode_buf | unicode buffer
Return values
length

Definition at line 294 of file mouse_desc.c.

Referenced by get_device_config_string(), get_device_interface_string(), get_device_manufacturer_string(), and get_device_product_string().

Variable Documentation

◆ ALIGNED_TAIL

ALIGNED_HEAD uint8_t g_string_serial [ 0x1A ] ALIGNED_TAIL
static
Initial value:
=
{
USB_DEVICE_DESC_LEN,
USB_DESCIPTOR_TYPE_DEVICE,
0x00,
0x02,
0x00,
0x00,
0x00,
USB_MAX_EP0_SIZE,
LBYTE( 0x2E3C ),
HBYTE( 0x2E3C ),
LBYTE( 0x5710 ),
HBYTE( 0x5710 ),
0x00,
0x02,
USB_MFC_STRING,
USB_PRODUCT_STRING,
USB_SERIAL_STRING,
1
}
HBYTE
#define HBYTE(x)
Definition usb_std.h:271
USB_MAX_EP0_SIZE
#define USB_MAX_EP0_SIZE
endpoint 0 max size
Definition usb_std.h:248
USB_PRODUCT_STRING
#define USB_PRODUCT_STRING
Definition usb_std.h:105
LBYTE
#define LBYTE(x)
low byte and high byte define
Definition usb_std.h:270
USB_DEVICE_DESC_LEN
#define USB_DEVICE_DESC_LEN
Definition usb_std.h:156
USB_MFC_STRING
#define USB_MFC_STRING
Definition usb_std.h:104
USB_SERIAL_STRING
#define USB_SERIAL_STRING
Definition usb_std.h:106
USB_DESCIPTOR_TYPE_DEVICE
#define USB_DESCIPTOR_TYPE_DEVICE
usb standard device type
Definition usb_std.h:91

usb device standard descriptor

usb string serial

usb string lang id

usb hid descriptor

usb mouse report descriptor

usb configuration standard descriptor

Definition at line 60 of file mouse_desc.c.

◆ config_descriptor

usbd_desc_t config_descriptor
static
Initial value:
=
{
34 ,
g_usbd_configuration
}

Definition at line 266 of file mouse_desc.c.

Referenced by get_device_configuration().

◆ device_descriptor

usbd_desc_t device_descriptor
static
Initial value:
=
{
USB_DEVICE_DESC_LEN,
g_usbd_descriptor
}

Definition at line 259 of file mouse_desc.c.

Referenced by get_device_descriptor().

◆ langid_descriptor

usbd_desc_t langid_descriptor
static
Initial value:
=
{
4 ,
g_string_lang_id
}

Definition at line 273 of file mouse_desc.c.

Referenced by get_device_lang_id().

◆ mouse_desc_handler

usbd_desc_handler mouse_desc_handler
Initial value:
=
{
get_device_descriptor,
get_device_qualifier,
get_device_configuration,
get_device_other_speed,
get_device_lang_id,
get_device_manufacturer_string,
get_device_product_string,
get_device_serial_string,
get_device_interface_string,
get_device_config_string,
}
get_device_configuration
static usbd_desc_t * get_device_configuration(void)
get config descriptor
Definition mouse_desc.c:388
get_device_descriptor
static usbd_desc_t * get_device_descriptor(void)
get device descriptor
Definition mouse_desc.c:368
get_device_manufacturer_string
static usbd_desc_t * get_device_manufacturer_string(void)
get manufacturer descriptor
Definition mouse_desc.c:419
get_device_qualifier
static usbd_desc_t * get_device_qualifier(void)
get device qualifier
Definition mouse_desc.c:378
get_device_interface_string
static usbd_desc_t * get_device_interface_string(void)
get interface descriptor
Definition mouse_desc.c:454
get_device_other_speed
static usbd_desc_t * get_device_other_speed(void)
get other speed descriptor
Definition mouse_desc.c:398
get_device_product_string
static usbd_desc_t * get_device_product_string(void)
get product descriptor
Definition mouse_desc.c:431
get_device_config_string
static usbd_desc_t * get_device_config_string(void)
get device config descriptor
Definition mouse_desc.c:466
get_device_lang_id
static usbd_desc_t * get_device_lang_id(void)
get lang id descriptor
Definition mouse_desc.c:408
get_device_serial_string
static usbd_desc_t * get_device_serial_string(void)
get serial descriptor
Definition mouse_desc.c:443

mouse device descriptor handler structure

Definition at line 65 of file mouse_desc.c.

Referenced by main().

◆ serial_descriptor

usbd_desc_t serial_descriptor
static
Initial value:
=
{
0x1A ,
g_string_serial
}

Definition at line 280 of file mouse_desc.c.

Referenced by get_device_serial_string().

◆ vp_desc

usbd_desc_t vp_desc
static

Definition at line 286 of file mouse_desc.c.

Referenced by get_device_config_string(), get_device_interface_string(), get_device_manufacturer_string(), and get_device_product_string().


AT32F413 Firmwary Library: USB_mouse_desc_definition

Macros
USB_mouse_desc_definition
AT32F413_middlewares_usbd_class » USB_mouse_desc

Macros

#define | MOUSE_BCD_NUM 0x0110
usb bcd number define
#define | USBD_MOUSE_VENDOR_ID 0x2E3C
usb vendor id and product id define
#define | USBD_MOUSE_PRODUCT_ID 0x5710
#define | USBD_MOUSE_CONFIG_DESC_SIZE 34
usb descriptor size define
#define | USBD_MOUSE_SIZ_REPORT_DESC 74
#define | USBD_MOUSE_SIZ_STRING_LANGID 4
#define | USBD_MOUSE_SIZ_STRING_SERIAL 0x1A
#define | USBD_MOUSE_DESC_MANUFACTURER_STRING "Artery"
usb string define(vendor, product configuration, interface)
#define | USBD_MOUSE_DESC_PRODUCT_STRING "Mouse"
#define | USBD_MOUSE_DESC_CONFIGURATION_STRING "Mouse Config"
#define | USBD_MOUSE_DESC_INTERFACE_STRING "Mouse Interface"
#define | MOUSE_BINTERVAL_TIME 0x0A
usb hid endpoint interval define
#define | MCU_ID1 (0x1FFFF7E8)
usb mcu id address deine
#define | MCU_ID2 (0x1FFFF7EC)
#define | MCU_ID3 (0x1FFFF7F0)

Detailed Description

Macro Definition Documentation

◆ MCU_ID1

#define MCU_ID1 (0x1FFFF7E8)

usb mcu id address deine

Definition at line 84 of file mouse_desc.h.

◆ MCU_ID2

#define MCU_ID2 (0x1FFFF7EC)

Definition at line 85 of file mouse_desc.h.

◆ MCU_ID3

#define MCU_ID3 (0x1FFFF7F0)

Definition at line 86 of file mouse_desc.h.

◆ MOUSE_BCD_NUM

#define MOUSE_BCD_NUM 0x0110

usb bcd number define

Definition at line 52 of file mouse_desc.h.

◆ MOUSE_BINTERVAL_TIME

#define MOUSE_BINTERVAL_TIME 0x0A

usb hid endpoint interval define

Definition at line 79 of file mouse_desc.h.

◆ USBD_MOUSE_CONFIG_DESC_SIZE

#define USBD_MOUSE_CONFIG_DESC_SIZE 34

usb descriptor size define

Definition at line 63 of file mouse_desc.h.

◆ USBD_MOUSE_DESC_CONFIGURATION_STRING

#define USBD_MOUSE_DESC_CONFIGURATION_STRING "Mouse Config"

Definition at line 73 of file mouse_desc.h.

Referenced by get_device_config_string().

◆ USBD_MOUSE_DESC_INTERFACE_STRING

#define USBD_MOUSE_DESC_INTERFACE_STRING "Mouse Interface"

Definition at line 74 of file mouse_desc.h.

Referenced by get_device_interface_string().

◆ USBD_MOUSE_DESC_MANUFACTURER_STRING

#define USBD_MOUSE_DESC_MANUFACTURER_STRING "Artery"

usb string define(vendor, product configuration, interface)

Definition at line 71 of file mouse_desc.h.

Referenced by get_device_manufacturer_string().

◆ USBD_MOUSE_DESC_PRODUCT_STRING

#define USBD_MOUSE_DESC_PRODUCT_STRING "Mouse"

Definition at line 72 of file mouse_desc.h.

Referenced by get_device_product_string().

◆ USBD_MOUSE_PRODUCT_ID

#define USBD_MOUSE_PRODUCT_ID 0x5710

Definition at line 58 of file mouse_desc.h.

◆ USBD_MOUSE_SIZ_REPORT_DESC

#define USBD_MOUSE_SIZ_REPORT_DESC 74

Definition at line 64 of file mouse_desc.h.

Referenced by class_setup_handler().

◆ USBD_MOUSE_SIZ_STRING_LANGID

#define USBD_MOUSE_SIZ_STRING_LANGID 4

Definition at line 65 of file mouse_desc.h.

◆ USBD_MOUSE_SIZ_STRING_SERIAL

#define USBD_MOUSE_SIZ_STRING_SERIAL 0x1A

Definition at line 66 of file mouse_desc.h.

◆ USBD_MOUSE_VENDOR_ID

#define USBD_MOUSE_VENDOR_ID 0x2E3C

usb vendor id and product id define

Definition at line 57 of file mouse_desc.h.


AT32F413 Firmwary Library: USB_msc_class

Topics
USB_msc_class
AT32F413_middlewares_usbd_class

usb device class msc demo More...

Topics

USB_msc_class_private_functions
USB_msc_class_definition

Detailed Description

usb device class msc demo


AT32F413 Firmwary Library: USB_msc_class_private_functions

Functions | Variables
USB_msc_class_private_functions
AT32F413_middlewares_usbd_class » USB_msc_class

Functions

static usb_sts_type | class_init_handler (void *udev)
initialize usb endpoint
static usb_sts_type | class_clear_handler (void *udev)
clear endpoint or other state
static usb_sts_type | class_setup_handler (void *udev, usb_setup_type *setup)
usb device class setup request handler
static usb_sts_type | class_ept0_tx_handler (void *udev)
usb device endpoint 0 in status stage complete
static usb_sts_type | class_ept0_rx_handler (void *udev)
usb device endpoint 0 out status stage complete
static usb_sts_type | class_in_handler (void *udev, uint8_t ept_num)
usb device transmision complete handler
static usb_sts_type | class_out_handler (void *udev, uint8_t ept_num)
usb device endpoint receive data
static usb_sts_type | class_sof_handler (void *udev)
usb device sof handler
static usb_sts_type | class_event_handler (void *udev, usbd_event_type event)
usb device event handler

Variables

msc_type msc_struct
usbd_class_handler msc_class_handler

Detailed Description

Function Documentation

◆ class_clear_handler()

static usb_sts_type class_clear_handler ( void * udev )
static

clear endpoint or other state

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 96 of file msc_class.c.

◆ class_ept0_rx_handler()

static usb_sts_type class_ept0_rx_handler ( void * udev )
static

usb device endpoint 0 out status stage complete

Parameters
udev usb device core handler type
Return values
status of usb_sts_type

Definition at line 201 of file msc_class.c.

◆ class_ept0_tx_handler()

static usb_sts_type class_ept0_tx_handler ( void * udev )
static

usb device endpoint 0 in status stage complete

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 187 of file msc_class.c.

◆ class_event_handler()

static usb_sts_type class_event_handler | ( | void * | udev,
 |  | usbd_event_type | event )
 static

usb device event handler

Parameters
udev | to the structure of usbd_core_type
event | usb device event
Return values
status of usb_sts_type

Definition at line 257 of file msc_class.c.

◆ class_in_handler()

static usb_sts_type class_in_handler | ( | void * | udev,
 |  | uint8_t | ept_num )
 static

usb device transmision complete handler

Parameters
udev | to the structure of usbd_core_type
ept_num | endpoint number
Return values
status of usb_sts_type

Definition at line 216 of file msc_class.c.

◆ class_init_handler()

static usb_sts_type class_init_handler ( void * udev )
static

initialize usb endpoint

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 75 of file msc_class.c.

◆ class_out_handler()

static usb_sts_type class_out_handler | ( | void * | udev,
 |  | uint8_t | ept_num )
 static

usb device endpoint receive data

Parameters
udev | to the structure of usbd_core_type
ept_num | endpoint number
Return values
status of usb_sts_type

Definition at line 230 of file msc_class.c.

◆ class_setup_handler()

static usb_sts_type class_setup_handler | ( | void * | udev,
 |  | usb_setup_type * | setup )
 static

usb device class setup request handler

Parameters
udev | to the structure of usbd_core_type
setup | setup packet
Return values
status of usb_sts_type

< get max lun

< bulk only mass storage reset

Definition at line 116 of file msc_class.c.

◆ class_sof_handler()

static usb_sts_type class_sof_handler ( void * udev )
static

usb device sof handler

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 242 of file msc_class.c.

Variable Documentation

◆ msc_class_handler

usbd_class_handler msc_class_handler
Initial value:
=
{
class_init_handler,
class_clear_handler,
class_setup_handler,
class_ept0_tx_handler,
class_ept0_rx_handler,
class_in_handler,
class_out_handler,
class_sof_handler,
class_event_handler,
&msc_struct
}
class_sof_handler
static usb_sts_type class_sof_handler(void *udev)
usb device sof handler
Definition msc_class.c:242
class_in_handler
static usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
usb device transmision complete handler
Definition msc_class.c:216
msc_struct
msc_type msc_struct
Definition msc_class.c:53
class_clear_handler
static usb_sts_type class_clear_handler(void *udev)
clear endpoint or other state
Definition msc_class.c:96
class_setup_handler
static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
usb device class setup request handler
Definition msc_class.c:116
class_ept0_tx_handler
static usb_sts_type class_ept0_tx_handler(void *udev)
usb device endpoint 0 in status stage complete
Definition msc_class.c:187
class_ept0_rx_handler
static usb_sts_type class_ept0_rx_handler(void *udev)
usb device endpoint 0 out status stage complete
Definition msc_class.c:201
class_event_handler
static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
usb device event handler
Definition msc_class.c:257
class_init_handler
static usb_sts_type class_init_handler(void *udev)
initialize usb endpoint
Definition msc_class.c:75
class_out_handler
static usb_sts_type class_out_handler(void *udev, uint8_t ept_num)
usb device endpoint receive data
Definition msc_class.c:230

Definition at line 56 of file msc_class.c.

Referenced by main().

◆ msc_struct

msc_type msc_struct

Definition at line 53 of file msc_class.c.


AT32F413 Firmwary Library: USB_msc_class_definition

Macros | Variables
USB_msc_class_definition
AT32F413_middlewares_usbd_class » USB_msc_class

Macros

#define | USBD_MSC_BULK_IN_EPT 0x81
#define | USBD_MSC_BULK_OUT_EPT 0x01
#define | USBD_IN_MAXPACKET_SIZE 0x40
#define | USBD_OUT_MAXPACKET_SIZE 0x40

Variables

usbd_class_handler msc_class_handler

Detailed Description

Macro Definition Documentation

◆ USBD_IN_MAXPACKET_SIZE

#define USBD_IN_MAXPACKET_SIZE 0x40

Definition at line 51 of file msc_class.h.

Referenced by class_setup_handler().

◆ USBD_MSC_BULK_IN_EPT

#define USBD_MSC_BULK_IN_EPT 0x81

Definition at line 48 of file msc_class.h.

◆ USBD_MSC_BULK_OUT_EPT

#define USBD_MSC_BULK_OUT_EPT 0x01

Definition at line 49 of file msc_class.h.

◆ USBD_OUT_MAXPACKET_SIZE

#define USBD_OUT_MAXPACKET_SIZE 0x40

Definition at line 52 of file msc_class.h.

Referenced by class_init_handler(), and class_setup_handler().

Variable Documentation

◆ msc_class_handler

usbd_class_handler msc_class_handler
extern

Definition at line 56 of file msc_class.c.

Referenced by main().


AT32F413 Firmwary Library: USB_msc_desc

Topics
USB_msc_desc
AT32F413_middlewares_usbd_class

usb device msc descriptor More...

Topics

USB_msc_desc_private_functions
USB_msc_desc_definition

Detailed Description

usb device msc descriptor


AT32F413 Firmwary Library: USB_msc_desc_private_functions

Functions | Variables
USB_msc_desc_private_functions
AT32F413_middlewares_usbd_class » USB_msc_desc

Functions

static usbd_desc_t * | get_device_descriptor (void)
get device descriptor
static usbd_desc_t * | get_device_qualifier (void)
get device qualifier
static usbd_desc_t * | get_device_configuration (void)
get config descriptor
static usbd_desc_t * | get_device_other_speed (void)
get other speed descriptor
static usbd_desc_t * | get_device_lang_id (void)
get lang id descriptor
static usbd_desc_t * | get_device_manufacturer_string (void)
get manufacturer descriptor
static usbd_desc_t * | get_device_product_string (void)
get product descriptor
static usbd_desc_t * | get_device_serial_string (void)
get serial descriptor
static usbd_desc_t * | get_device_interface_string (void)
get interface descriptor
static usbd_desc_t * | get_device_config_string (void)
get device config descriptor
static uint16_t | usbd_unicode_convert (uint8_t *string, uint8_t *unicode_buf)
standard usb unicode convert
static void | usbd_int_to_unicode (uint32_t value, uint8_t *pbuf, uint8_t len)
usb int convert to unicode
static void | get_serial_num (void)
usb get serial number

Variables

static ALIGNED_HEAD uint8_t g_usbd_desc_buffer[256] | ALIGNED_TAIL
usb device standard descriptor
usbd_desc_handler msc_desc_handler
device descriptor handler structure
static usbd_desc_t | device_descriptor
static usbd_desc_t | config_descriptor
static usbd_desc_t | langid_descriptor
static usbd_desc_t | serial_descriptor
static usbd_desc_t | vp_desc

Detailed Description

Function Documentation

◆ get_device_config_string()

static usbd_desc_t * get_device_config_string ( void )
static

get device config descriptor

Parameters
none
Return values
usbd_desc

Definition at line 389 of file msc_desc.c.

◆ get_device_configuration()

static usbd_desc_t * get_device_configuration ( void )
static

get config descriptor

Parameters
none
Return values
usbd_desc

Definition at line 311 of file msc_desc.c.

◆ get_device_descriptor()

static usbd_desc_t * get_device_descriptor ( void )
static

get device descriptor

Parameters
none
Return values
usbd_desc

Definition at line 291 of file msc_desc.c.

◆ get_device_interface_string()

static usbd_desc_t * get_device_interface_string ( void )
static

get interface descriptor

Parameters
none
Return values
usbd_desc

Definition at line 377 of file msc_desc.c.

◆ get_device_lang_id()

static usbd_desc_t * get_device_lang_id ( void )
static

get lang id descriptor

Parameters
none
Return values
usbd_desc

Definition at line 331 of file msc_desc.c.

◆ get_device_manufacturer_string()

static usbd_desc_t * get_device_manufacturer_string ( void )
static

get manufacturer descriptor

Parameters
none
Return values
usbd_desc

Definition at line 342 of file msc_desc.c.

◆ get_device_other_speed()

static usbd_desc_t * get_device_other_speed ( void )
static

get other speed descriptor

Parameters
none
Return values
usbd_desc

Definition at line 321 of file msc_desc.c.

◆ get_device_product_string()

static usbd_desc_t * get_device_product_string ( void )
static

get product descriptor

Parameters
none
Return values
usbd_desc

Definition at line 354 of file msc_desc.c.

◆ get_device_qualifier()

static usbd_desc_t * get_device_qualifier ( void )
static

get device qualifier

Parameters
none
Return values
usbd_desc

Definition at line 301 of file msc_desc.c.

◆ get_device_serial_string()

static usbd_desc_t * get_device_serial_string ( void )
static

get serial descriptor

Parameters
none
Return values
usbd_desc

Definition at line 366 of file msc_desc.c.

◆ get_serial_num()

static void get_serial_num ( void )
static

usb get serial number

Parameters
none
Return values
none

Definition at line 269 of file msc_desc.c.

Referenced by get_device_serial_string().

◆ usbd_int_to_unicode()

static void usbd_int_to_unicode | ( | uint32_t | value,
 |  | uint8_t * | pbuf,
 |  | uint8_t | len )
 static

usb int convert to unicode

Parameters
value | int value
pbus | unicode buffer
len | length
Return values
none

Definition at line 243 of file msc_desc.c.

Referenced by get_serial_num().

◆ usbd_unicode_convert()

static uint16_t usbd_unicode_convert | ( | uint8_t * | string,
 |  | uint8_t * | unicode_buf )
 static

standard usb unicode convert

Parameters
string | source string
unicode_buf | unicode buffer
Return values
length

Definition at line 217 of file msc_desc.c.

Referenced by get_device_config_string(), get_device_interface_string(), get_device_manufacturer_string(), and get_device_product_string().

Variable Documentation

◆ ALIGNED_TAIL

ALIGNED_HEAD uint8_t g_string_serial [ 0x1A ] ALIGNED_TAIL
static
Initial value:
=
{
USB_DEVICE_DESC_LEN,
USB_DESCIPTOR_TYPE_DEVICE,
0x00,
0x02,
0x00,
0x00,
0x00,
USB_MAX_EP0_SIZE,
LBYTE( 0x2E3C ),
HBYTE( 0x2E3C ),
LBYTE( 0x5720 ),
HBYTE( 0x5720 ),
0x00,
0x02,
USB_MFC_STRING,
USB_PRODUCT_STRING,
USB_SERIAL_STRING,
1
}
HBYTE
#define HBYTE(x)
Definition usb_std.h:271
USB_MAX_EP0_SIZE
#define USB_MAX_EP0_SIZE
endpoint 0 max size
Definition usb_std.h:248
USB_PRODUCT_STRING
#define USB_PRODUCT_STRING
Definition usb_std.h:105
LBYTE
#define LBYTE(x)
low byte and high byte define
Definition usb_std.h:270
USB_DEVICE_DESC_LEN
#define USB_DEVICE_DESC_LEN
Definition usb_std.h:156
USB_MFC_STRING
#define USB_MFC_STRING
Definition usb_std.h:104
USB_SERIAL_STRING
#define USB_SERIAL_STRING
Definition usb_std.h:106
USB_DESCIPTOR_TYPE_DEVICE
#define USB_DESCIPTOR_TYPE_DEVICE
usb standard device type
Definition usb_std.h:91

usb device standard descriptor

usb string serial

usb string lang id

usb configuration standard descriptor

Definition at line 61 of file msc_desc.c.

◆ config_descriptor

usbd_desc_t config_descriptor
static
Initial value:
=
{
32 ,
g_usbd_configuration
}

Definition at line 189 of file msc_desc.c.

Referenced by get_device_configuration().

◆ device_descriptor

usbd_desc_t device_descriptor
static
Initial value:
=
{
USB_DEVICE_DESC_LEN,
g_usbd_descriptor
}

Definition at line 182 of file msc_desc.c.

Referenced by get_device_descriptor().

◆ langid_descriptor

usbd_desc_t langid_descriptor
static
Initial value:
=
{
4 ,
g_string_lang_id
}

Definition at line 196 of file msc_desc.c.

Referenced by get_device_lang_id().

◆ msc_desc_handler

usbd_desc_handler msc_desc_handler
Initial value:
=
{
get_device_descriptor,
get_device_qualifier,
get_device_configuration,
get_device_other_speed,
get_device_lang_id,
get_device_manufacturer_string,
get_device_product_string,
get_device_serial_string,
get_device_interface_string,
get_device_config_string,
}
get_device_configuration
static usbd_desc_t * get_device_configuration(void)
get config descriptor
Definition msc_desc.c:311
get_device_descriptor
static usbd_desc_t * get_device_descriptor(void)
get device descriptor
Definition msc_desc.c:291
get_device_manufacturer_string
static usbd_desc_t * get_device_manufacturer_string(void)
get manufacturer descriptor
Definition msc_desc.c:342
get_device_qualifier
static usbd_desc_t * get_device_qualifier(void)
get device qualifier
Definition msc_desc.c:301
get_device_interface_string
static usbd_desc_t * get_device_interface_string(void)
get interface descriptor
Definition msc_desc.c:377
get_device_other_speed
static usbd_desc_t * get_device_other_speed(void)
get other speed descriptor
Definition msc_desc.c:321
get_device_product_string
static usbd_desc_t * get_device_product_string(void)
get product descriptor
Definition msc_desc.c:354
get_device_config_string
static usbd_desc_t * get_device_config_string(void)
get device config descriptor
Definition msc_desc.c:389
get_device_lang_id
static usbd_desc_t * get_device_lang_id(void)
get lang id descriptor
Definition msc_desc.c:331
get_device_serial_string
static usbd_desc_t * get_device_serial_string(void)
get serial descriptor
Definition msc_desc.c:366

device descriptor handler structure

Definition at line 66 of file msc_desc.c.

Referenced by main().

◆ serial_descriptor

usbd_desc_t serial_descriptor
static
Initial value:
=
{
0x1A ,
g_string_serial
}

Definition at line 203 of file msc_desc.c.

Referenced by get_device_serial_string().

◆ vp_desc

usbd_desc_t vp_desc
static

Definition at line 209 of file msc_desc.c.

Referenced by get_device_config_string(), get_device_interface_string(), get_device_manufacturer_string(), and get_device_product_string().


AT32F413 Firmwary Library: USB_msc_desc_definition

Macros | Variables
USB_msc_desc_definition
AT32F413_middlewares_usbd_class » USB_msc_desc

Macros

#define | MSC_BCD_NUM 0x0110
#define | USBD_MSC_VENDOR_ID 0x2E3C
#define | USBD_MSC_PRODUCT_ID 0x5720
#define | USBD_MSC_CONFIG_DESC_SIZE 32
#define | USBD_MSC_SIZ_STRING_LANGID 4
#define | USBD_MSC_SIZ_STRING_SERIAL 0x1A
#define | USBD_MSC_DESC_MANUFACTURER_STRING "Artery"
#define | USBD_MSC_DESC_PRODUCT_STRING "AT32 Mass Storage"
#define | USBD_MSC_DESC_CONFIGURATION_STRING "Mass Storage Config"
#define | USBD_MSC_DESC_INTERFACE_STRING "Mass Storage Interface"
#define | MCU_ID1 (0x1FFFF7E8)
#define | MCU_ID2 (0x1FFFF7EC)
#define | MCU_ID3 (0x1FFFF7F0)

Variables

usbd_desc_handler msc_desc_handler
device descriptor handler structure

Detailed Description

Macro Definition Documentation

◆ MCU_ID1

#define MCU_ID1 (0x1FFFF7E8)

Definition at line 63 of file msc_desc.h.

◆ MCU_ID2

#define MCU_ID2 (0x1FFFF7EC)

Definition at line 64 of file msc_desc.h.

◆ MCU_ID3

#define MCU_ID3 (0x1FFFF7F0)

Definition at line 65 of file msc_desc.h.

◆ MSC_BCD_NUM

#define MSC_BCD_NUM 0x0110

Definition at line 49 of file msc_desc.h.

◆ USBD_MSC_CONFIG_DESC_SIZE

#define USBD_MSC_CONFIG_DESC_SIZE 32

Definition at line 54 of file msc_desc.h.

◆ USBD_MSC_DESC_CONFIGURATION_STRING

#define USBD_MSC_DESC_CONFIGURATION_STRING "Mass Storage Config"

Definition at line 60 of file msc_desc.h.

Referenced by get_device_config_string().

◆ USBD_MSC_DESC_INTERFACE_STRING

#define USBD_MSC_DESC_INTERFACE_STRING "Mass Storage Interface"

Definition at line 61 of file msc_desc.h.

Referenced by get_device_interface_string().

◆ USBD_MSC_DESC_MANUFACTURER_STRING

#define USBD_MSC_DESC_MANUFACTURER_STRING "Artery"

Definition at line 58 of file msc_desc.h.

Referenced by get_device_manufacturer_string().

◆ USBD_MSC_DESC_PRODUCT_STRING

#define USBD_MSC_DESC_PRODUCT_STRING "AT32 Mass Storage"

Definition at line 59 of file msc_desc.h.

Referenced by get_device_product_string().

◆ USBD_MSC_PRODUCT_ID

#define USBD_MSC_PRODUCT_ID 0x5720

Definition at line 52 of file msc_desc.h.

◆ USBD_MSC_SIZ_STRING_LANGID

#define USBD_MSC_SIZ_STRING_LANGID 4

Definition at line 55 of file msc_desc.h.

◆ USBD_MSC_SIZ_STRING_SERIAL

#define USBD_MSC_SIZ_STRING_SERIAL 0x1A

Definition at line 56 of file msc_desc.h.

◆ USBD_MSC_VENDOR_ID

#define USBD_MSC_VENDOR_ID 0x2E3C

Definition at line 51 of file msc_desc.h.

Variable Documentation

◆ msc_desc_handler

usbd_desc_handler msc_desc_handler
extern

device descriptor handler structure

Definition at line 66 of file msc_desc.c.

Referenced by main().


AT32F413 Firmwary Library: USB_printer_class

Topics
USB_printer_class
AT32F413_middlewares_usbd_class

usb device class printer demo More...

Topics

USB_printer_class_private_functions
USB_printer_class_definition

Detailed Description

usb device class printer demo


AT32F413 Firmwary Library: USB_printer_class_private_functions

Functions | Variables
USB_printer_class_private_functions
AT32F413_middlewares_usbd_class » USB_printer_class

Functions

static usb_sts_type | class_init_handler (void *udev)
initialize usb custom hid endpoint
static usb_sts_type | class_clear_handler (void *udev)
clear endpoint or other state
static usb_sts_type | class_setup_handler (void *udev, usb_setup_type *setup)
usb device class setup request handler
static usb_sts_type | class_ept0_tx_handler (void *udev)
usb device endpoint 0 in status stage complete
static usb_sts_type | class_ept0_rx_handler (void *udev)
usb device endpoint 0 out status stage complete
static usb_sts_type | class_in_handler (void *udev, uint8_t ept_num)
usb device transmision complete handler
static usb_sts_type | class_out_handler (void *udev, uint8_t ept_num)
usb device endpoint receive data
static usb_sts_type | class_sof_handler (void *udev)
usb device sof handler
static usb_sts_type | class_event_handler (void *udev, usbd_event_type event)
usb device event handler
uint16_t | usb_printer_get_rxdata (void *udev, uint8_t *recv_data)
usb device class rx data process
error_status | usb_printer_send_data (void *udev, uint8_t *send_data, uint16_t len)
usb device class send data

Variables

static ALIGNED_HEAD uint8_t printer_device_id[24] ALIGNED_TAIL
printer_type printer_struct
usbd_class_handler printer_class_handler

Detailed Description

Function Documentation

◆ class_clear_handler()

static usb_sts_type class_clear_handler ( void * udev )
static

clear endpoint or other state

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 108 of file printer_class.c.

◆ class_ept0_rx_handler()

static usb_sts_type class_ept0_rx_handler ( void * udev )
static

usb device endpoint 0 out status stage complete

Parameters
udev usb device core handler type
Return values
status of usb_sts_type

Definition at line 202 of file printer_class.c.

◆ class_ept0_tx_handler()

static usb_sts_type class_ept0_tx_handler ( void * udev )
static

usb device endpoint 0 in status stage complete

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 188 of file printer_class.c.

◆ class_event_handler()

static usb_sts_type class_event_handler | ( | void * | udev,
 |  | usbd_event_type | event )
 static

usb device event handler

Parameters
udev | to the structure of usbd_core_type
event | usb device event
Return values
status of usb_sts_type

Definition at line 271 of file printer_class.c.

◆ class_in_handler()

static usb_sts_type class_in_handler | ( | void * | udev,
 |  | uint8_t | ept_num )
 static

usb device transmision complete handler

Parameters
udev | to the structure of usbd_core_type
ept_num | endpoint number
Return values
status of usb_sts_type

Definition at line 217 of file printer_class.c.

◆ class_init_handler()

static usb_sts_type class_init_handler ( void * udev )
static

initialize usb custom hid endpoint

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 82 of file printer_class.c.

◆ class_out_handler()

static usb_sts_type class_out_handler | ( | void * | udev,
 |  | uint8_t | ept_num )
 static

usb device endpoint receive data

Parameters
udev | to the structure of usbd_core_type
ept_num | endpoint number
Return values
status of usb_sts_type

Definition at line 237 of file printer_class.c.

◆ class_setup_handler()

static usb_sts_type class_setup_handler | ( | void * | udev,
 |  | usb_setup_type * | setup )
 static

usb device class setup request handler

Parameters
udev | to the structure of usbd_core_type
setup | setup packet
Return values
status of usb_sts_type

Definition at line 128 of file printer_class.c.

◆ class_sof_handler()

static usb_sts_type class_sof_handler ( void * udev )
static

usb device sof handler

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 256 of file printer_class.c.

◆ usb_printer_get_rxdata()

uint16_t usb_printer_get_rxdata | ( | void * | udev,
 |  | uint8_t * | recv_data )

usb device class rx data process

Parameters
udev | to the structure of usbd_core_type
recv_data | receive buffer
Return values
receive data len

Definition at line 303 of file printer_class.c.

Referenced by main().

◆ usb_printer_send_data()

error_status usb_printer_send_data | ( | void * | udev,
 |  | uint8_t * | send_data,
 |  | uint16_t | len )

usb device class send data

Parameters
udev | to the structure of usbd_core_type
send_data | send data buffer
len | send length
Return values
error status

Definition at line 333 of file printer_class.c.

Variable Documentation

◆ ALIGNED_TAIL

ALIGNED_HEAD uint8_t printer_device_id [ 24 ] ALIGNED_TAIL
static
Initial value:
=
{
0x00, 0x16,
'M', 'F', 'G',':','A','r','t','e', 'r', 'y' ,' ',
'C','M', 'D', ':', 'E', 'S', 'C', 'P', 'O', 'S',' ',
}

Definition at line 52 of file printer_class.c.

◆ printer_class_handler

usbd_class_handler printer_class_handler
Initial value:
=
{
class_init_handler,
class_clear_handler,
class_setup_handler,
class_ept0_tx_handler,
class_ept0_rx_handler,
class_in_handler,
class_out_handler,
class_sof_handler,
class_event_handler,
&printer_struct
}
class_sof_handler
static usb_sts_type class_sof_handler(void *udev)
usb device sof handler
Definition printer_class.c:256
class_in_handler
static usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
usb device transmision complete handler
Definition printer_class.c:217
class_clear_handler
static usb_sts_type class_clear_handler(void *udev)
clear endpoint or other state
Definition printer_class.c:108
class_setup_handler
static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
usb device class setup request handler
Definition printer_class.c:128
class_ept0_tx_handler
static usb_sts_type class_ept0_tx_handler(void *udev)
usb device endpoint 0 in status stage complete
Definition printer_class.c:188
class_ept0_rx_handler
static usb_sts_type class_ept0_rx_handler(void *udev)
usb device endpoint 0 out status stage complete
Definition printer_class.c:202
class_event_handler
static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
usb device event handler
Definition printer_class.c:271
class_init_handler
static usb_sts_type class_init_handler(void *udev)
initialize usb custom hid endpoint
Definition printer_class.c:82
class_out_handler
static usb_sts_type class_out_handler(void *udev, uint8_t ept_num)
usb device endpoint receive data
Definition printer_class.c:237
printer_struct
printer_type printer_struct
Definition printer_class.c:60

Definition at line 63 of file printer_class.c.

Referenced by main().

◆ printer_struct

printer_type printer_struct

Definition at line 60 of file printer_class.c.


AT32F413 Firmwary Library: USB_printer_class_definition

Data Structures | Macros | Enumerations | Functions | Variables
USB_printer_class_definition
AT32F413_middlewares_usbd_class » USB_printer_class

Data Structures

struct printer_type

Macros

#define | USBD_PRINTER_BULK_IN_EPT 0x81
#define | USBD_PRINTER_BULK_OUT_EPT 0x01
#define | USBD_PRINTER_IN_MAXPACKET_SIZE 0x40
#define | USBD_PRINTER_OUT_MAXPACKET_SIZE 0x40
#define | PRINTER_DEVICE_ID_LEN 24

Enumerations

enum printer_req_type { PRINTER_REQ_GET_DEVICE_ID = 0x00 , PRINTER_REQ_GET_PORT_STATUS = 0x01 , PRINTER_REQ_GET_SOFT_RESET = 0x02 }

Functions

uint16_t | usb_printer_get_rxdata (void *udev, uint8_t *recv_data)
usb device class rx data process
error_status | usb_printer_send_data (void *udev, uint8_t *send_data, uint16_t len)
usb device class send data

Variables

usbd_class_handler printer_class_handler

Detailed Description

Macro Definition Documentation

◆ PRINTER_DEVICE_ID_LEN

#define PRINTER_DEVICE_ID_LEN 24

Definition at line 56 of file printer_class.h.

Referenced by class_setup_handler().

◆ USBD_PRINTER_BULK_IN_EPT

#define USBD_PRINTER_BULK_IN_EPT 0x81

Definition at line 49 of file printer_class.h.

Referenced by class_clear_handler(), class_init_handler(), and usb_printer_send_data().

◆ USBD_PRINTER_BULK_OUT_EPT

#define USBD_PRINTER_BULK_OUT_EPT 0x01

Definition at line 50 of file printer_class.h.

Referenced by class_clear_handler(), class_init_handler(), and usb_printer_get_rxdata().

◆ USBD_PRINTER_IN_MAXPACKET_SIZE

#define USBD_PRINTER_IN_MAXPACKET_SIZE 0x40

Definition at line 53 of file printer_class.h.

Referenced by class_init_handler().

◆ USBD_PRINTER_OUT_MAXPACKET_SIZE

#define USBD_PRINTER_OUT_MAXPACKET_SIZE 0x40

Definition at line 54 of file printer_class.h.

Referenced by class_init_handler(), class_setup_handler(), and usb_printer_get_rxdata().

Enumeration Type Documentation

◆ printer_req_type

enum printer_req_type
Enumerator
PRINTER_REQ_GET_DEVICE_ID
PRINTER_REQ_GET_PORT_STATUS
PRINTER_REQ_GET_SOFT_RESET

Definition at line 58 of file printer_class.h.

Function Documentation

◆ usb_printer_get_rxdata()

uint16_t usb_printer_get_rxdata | ( | void * | udev,
 |  | uint8_t * | recv_data )

usb device class rx data process

Parameters
udev | to the structure of usbd_core_type
recv_data | receive buffer
Return values
receive data len

Definition at line 303 of file printer_class.c.

Referenced by main().

◆ usb_printer_send_data()

error_status usb_printer_send_data | ( | void * | udev,
 |  | uint8_t * | send_data,
 |  | uint16_t | len )

usb device class send data

Parameters
udev | to the structure of usbd_core_type
send_data | send data buffer
len | send length
Return values
error status

Definition at line 333 of file printer_class.c.

Variable Documentation

◆ printer_class_handler

usbd_class_handler printer_class_handler
extern

Definition at line 63 of file printer_class.c.

Referenced by main().


AT32F413 Firmwary Library: printer_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
printer_type Struct Reference
AT32F413_middlewares_usbd_class » USB_printer_class » USB_printer_class_definition

#include <printer_class.h>

Data Fields

uint32_t | alt_setting
uint32_t | g_printer_port_status
uint8_t | g_rx_buff [0x40]
uint8_t | g_printer_data [0x40]
__IO uint8_t | g_tx_completed
__IO uint8_t | g_rx_completed
uint32_t | g_rxlen

Detailed Description

Definition at line 66 of file printer_class.h.

Field Documentation

◆ alt_setting

uint32_t printer_type::alt_setting

Definition at line 68 of file printer_class.h.

Referenced by class_setup_handler().

◆ g_printer_data

uint8_t printer_type::g_printer_data[0x40]

Definition at line 71 of file printer_class.h.

Referenced by class_setup_handler().

◆ g_printer_port_status

uint32_t printer_type::g_printer_port_status

Definition at line 69 of file printer_class.h.

Referenced by class_init_handler(), and class_setup_handler().

◆ g_rx_buff

uint8_t printer_type::g_rx_buff[0x40]

Definition at line 70 of file printer_class.h.

Referenced by class_init_handler(), and usb_printer_get_rxdata().

◆ g_rx_completed

__IO uint8_t printer_type::g_rx_completed

Definition at line 73 of file printer_class.h.

Referenced by class_out_handler(), and usb_printer_get_rxdata().

◆ g_rxlen

uint32_t printer_type::g_rxlen

Definition at line 74 of file printer_class.h.

Referenced by class_out_handler(), and usb_printer_get_rxdata().

◆ g_tx_completed

__IO uint8_t printer_type::g_tx_completed

Definition at line 72 of file printer_class.h.

Referenced by class_in_handler(), class_init_handler(), and usb_printer_send_data().

The documentation for this struct was generated from the following file:
  • printer_class.h


AT32F413 Firmwary Library: USB_printer_desc

Topics
USB_printer_desc
AT32F413_middlewares_usbd_class

usb device printer descriptor More...

Topics

USB_printer_desc_private_functions
USB_printer_desc_definition

Detailed Description

usb device printer descriptor


AT32F413 Firmwary Library: USB_printer_desc_private_functions

Functions | Variables
USB_printer_desc_private_functions
AT32F413_middlewares_usbd_class » USB_printer_desc

Functions

static usbd_desc_t * | get_device_descriptor (void)
get device descriptor
static usbd_desc_t * | get_device_qualifier (void)
get device qualifier
static usbd_desc_t * | get_device_configuration (void)
get config descriptor
static usbd_desc_t * | get_device_other_speed (void)
get other speed descriptor
static usbd_desc_t * | get_device_lang_id (void)
get lang id descriptor
static usbd_desc_t * | get_device_manufacturer_string (void)
get manufacturer descriptor
static usbd_desc_t * | get_device_product_string (void)
get product descriptor
static usbd_desc_t * | get_device_serial_string (void)
get serial descriptor
static usbd_desc_t * | get_device_interface_string (void)
get interface descriptor
static usbd_desc_t * | get_device_config_string (void)
get device config descriptor
static uint16_t | usbd_unicode_convert (uint8_t *string, uint8_t *unicode_buf)
standard usb unicode convert
static void | usbd_int_to_unicode (uint32_t value, uint8_t *pbuf, uint8_t len)
usb int convert to unicode
static void | get_serial_num (void)
usb get serial number

Variables

static ALIGNED_HEAD uint8_t g_usbd_desc_buffer[256] | ALIGNED_TAIL
usb device standard descriptor
usbd_desc_handler printer_desc_handler
device descriptor handler structure
static usbd_desc_t | device_descriptor
static usbd_desc_t | config_descriptor
static usbd_desc_t | langid_descriptor
static usbd_desc_t | serial_descriptor
static usbd_desc_t | vp_desc

Detailed Description

Function Documentation

◆ get_device_config_string()

static usbd_desc_t * get_device_config_string ( void )
static

get device config descriptor

Parameters
none
Return values
usbd_desc

Definition at line 389 of file printer_desc.c.

◆ get_device_configuration()

static usbd_desc_t * get_device_configuration ( void )
static

get config descriptor

Parameters
none
Return values
usbd_desc

Definition at line 311 of file printer_desc.c.

◆ get_device_descriptor()

static usbd_desc_t * get_device_descriptor ( void )
static

get device descriptor

Parameters
none
Return values
usbd_desc

Definition at line 291 of file printer_desc.c.

◆ get_device_interface_string()

static usbd_desc_t * get_device_interface_string ( void )
static

get interface descriptor

Parameters
none
Return values
usbd_desc

Definition at line 377 of file printer_desc.c.

◆ get_device_lang_id()

static usbd_desc_t * get_device_lang_id ( void )
static

get lang id descriptor

Parameters
none
Return values
usbd_desc

Definition at line 331 of file printer_desc.c.

◆ get_device_manufacturer_string()

static usbd_desc_t * get_device_manufacturer_string ( void )
static

get manufacturer descriptor

Parameters
none
Return values
usbd_desc

Definition at line 342 of file printer_desc.c.

◆ get_device_other_speed()

static usbd_desc_t * get_device_other_speed ( void )
static

get other speed descriptor

Parameters
none
Return values
usbd_desc

Definition at line 321 of file printer_desc.c.

◆ get_device_product_string()

static usbd_desc_t * get_device_product_string ( void )
static

get product descriptor

Parameters
none
Return values
usbd_desc

Definition at line 354 of file printer_desc.c.

◆ get_device_qualifier()

static usbd_desc_t * get_device_qualifier ( void )
static

get device qualifier

Parameters
none
Return values
usbd_desc

Definition at line 301 of file printer_desc.c.

◆ get_device_serial_string()

static usbd_desc_t * get_device_serial_string ( void )
static

get serial descriptor

Parameters
none
Return values
usbd_desc

Definition at line 366 of file printer_desc.c.

◆ get_serial_num()

static void get_serial_num ( void )
static

usb get serial number

Parameters
none
Return values
none

Definition at line 269 of file printer_desc.c.

Referenced by get_device_serial_string().

◆ usbd_int_to_unicode()

static void usbd_int_to_unicode | ( | uint32_t | value,
 |  | uint8_t * | pbuf,
 |  | uint8_t | len )
 static

usb int convert to unicode

Parameters
value | int value
pbus | unicode buffer
len | length
Return values
none

Definition at line 243 of file printer_desc.c.

Referenced by get_serial_num().

◆ usbd_unicode_convert()

static uint16_t usbd_unicode_convert | ( | uint8_t * | string,
 |  | uint8_t * | unicode_buf )
 static

standard usb unicode convert

Parameters
string | source string
unicode_buf | unicode buffer
Return values
length

Definition at line 217 of file printer_desc.c.

Referenced by get_device_config_string(), get_device_interface_string(), get_device_manufacturer_string(), and get_device_product_string().

Variable Documentation

◆ ALIGNED_TAIL

ALIGNED_HEAD uint8_t g_string_serial [ 0x1A ] ALIGNED_TAIL
static
Initial value:
=
{
USB_DEVICE_DESC_LEN,
USB_DESCIPTOR_TYPE_DEVICE,
0x00,
0x02,
0x00,
0x00,
0x00,
USB_MAX_EP0_SIZE,
LBYTE( 0x2E3C ),
HBYTE( 0x2E3C ),
LBYTE( 0x57FF ),
HBYTE( 0x57FF ),
0x00,
0x02,
USB_MFC_STRING,
USB_PRODUCT_STRING,
USB_SERIAL_STRING,
1
}
HBYTE
#define HBYTE(x)
Definition usb_std.h:271
USB_MAX_EP0_SIZE
#define USB_MAX_EP0_SIZE
endpoint 0 max size
Definition usb_std.h:248
USB_PRODUCT_STRING
#define USB_PRODUCT_STRING
Definition usb_std.h:105
LBYTE
#define LBYTE(x)
low byte and high byte define
Definition usb_std.h:270
USB_DEVICE_DESC_LEN
#define USB_DEVICE_DESC_LEN
Definition usb_std.h:156
USB_MFC_STRING
#define USB_MFC_STRING
Definition usb_std.h:104
USB_SERIAL_STRING
#define USB_SERIAL_STRING
Definition usb_std.h:106
USB_DESCIPTOR_TYPE_DEVICE
#define USB_DESCIPTOR_TYPE_DEVICE
usb standard device type
Definition usb_std.h:91

usb device standard descriptor

usb string serial

usb string lang id

usb configuration standard descriptor

Definition at line 61 of file printer_desc.c.

◆ config_descriptor

usbd_desc_t config_descriptor
static
Initial value:
=
{
32 ,
g_usbd_configuration
}

Definition at line 189 of file printer_desc.c.

Referenced by get_device_configuration().

◆ device_descriptor

usbd_desc_t device_descriptor
static
Initial value:
=
{
USB_DEVICE_DESC_LEN,
g_usbd_descriptor
}

Definition at line 182 of file printer_desc.c.

Referenced by get_device_descriptor().

◆ langid_descriptor

usbd_desc_t langid_descriptor
static
Initial value:
=
{
4 ,
g_string_lang_id
}

Definition at line 196 of file printer_desc.c.

Referenced by get_device_lang_id().

◆ printer_desc_handler

usbd_desc_handler printer_desc_handler
Initial value:
=
{
get_device_descriptor,
get_device_qualifier,
get_device_configuration,
get_device_other_speed,
get_device_lang_id,
get_device_manufacturer_string,
get_device_product_string,
get_device_serial_string,
get_device_interface_string,
get_device_config_string,
}
get_device_configuration
static usbd_desc_t * get_device_configuration(void)
get config descriptor
Definition printer_desc.c:311
get_device_descriptor
static usbd_desc_t * get_device_descriptor(void)
get device descriptor
Definition printer_desc.c:291
get_device_manufacturer_string
static usbd_desc_t * get_device_manufacturer_string(void)
get manufacturer descriptor
Definition printer_desc.c:342
get_device_qualifier
static usbd_desc_t * get_device_qualifier(void)
get device qualifier
Definition printer_desc.c:301
get_device_interface_string
static usbd_desc_t * get_device_interface_string(void)
get interface descriptor
Definition printer_desc.c:377
get_device_other_speed
static usbd_desc_t * get_device_other_speed(void)
get other speed descriptor
Definition printer_desc.c:321
get_device_product_string
static usbd_desc_t * get_device_product_string(void)
get product descriptor
Definition printer_desc.c:354
get_device_config_string
static usbd_desc_t * get_device_config_string(void)
get device config descriptor
Definition printer_desc.c:389
get_device_lang_id
static usbd_desc_t * get_device_lang_id(void)
get lang id descriptor
Definition printer_desc.c:331
get_device_serial_string
static usbd_desc_t * get_device_serial_string(void)
get serial descriptor
Definition printer_desc.c:366

device descriptor handler structure

Definition at line 66 of file printer_desc.c.

Referenced by main().

◆ serial_descriptor

usbd_desc_t serial_descriptor
static
Initial value:
=
{
0x1A ,
g_string_serial
}

Definition at line 203 of file printer_desc.c.

Referenced by get_device_serial_string().

◆ vp_desc

usbd_desc_t vp_desc
static

Definition at line 209 of file printer_desc.c.

Referenced by get_device_config_string(), get_device_interface_string(), get_device_manufacturer_string(), and get_device_product_string().


AT32F413 Firmwary Library: USB_printer_desc_definition

Macros | Variables
USB_printer_desc_definition
AT32F413_middlewares_usbd_class » USB_printer_desc

Macros

#define | PRINTER_BCD_NUM 0x0110
#define | USBD_PRINTER_VENDOR_ID 0x2E3C
#define | USBD_PRINTER_PRODUCT_ID 0x57FF
#define | USBD_PRINTER_CONFIG_DESC_SIZE 32
#define | USBD_PRINTER_SIZ_STRING_LANGID 4
#define | USBD_PRINTER_SIZ_STRING_SERIAL 0x1A
#define | USBD_PRINTER_DESC_MANUFACTURER_STRING "Artery"
#define | USBD_PRINTER_DESC_PRODUCT_STRING "AT32 Printer"
#define | USBD_PRINTER_DESC_CONFIGURATION_STRING "Printer Config"
#define | USBD_PRINTER_DESC_INTERFACE_STRING "Printer Interface"
#define | PRINTER_PROTOCOL_UNIDIRECTIONAL 0x01
#define | PRINTER_PROTOCOL_BI_DIRECTIONAL 0x02
#define | PRINTER_PROTOCOL_1284_4 0x03
#define | PRINTER_PROTOCOL_VENDOR_SPECIFIC 0xFF
#define | MCU_ID1 (0x1FFFF7E8)
#define | MCU_ID2 (0x1FFFF7EC)
#define | MCU_ID3 (0x1FFFF7F0)

Variables

usbd_desc_handler printer_desc_handler
device descriptor handler structure

Detailed Description

Macro Definition Documentation

◆ MCU_ID1

#define MCU_ID1 (0x1FFFF7E8)

Definition at line 69 of file printer_desc.h.

◆ MCU_ID2

#define MCU_ID2 (0x1FFFF7EC)

Definition at line 70 of file printer_desc.h.

◆ MCU_ID3

#define MCU_ID3 (0x1FFFF7F0)

Definition at line 71 of file printer_desc.h.

◆ PRINTER_BCD_NUM

#define PRINTER_BCD_NUM 0x0110

Definition at line 49 of file printer_desc.h.

◆ PRINTER_PROTOCOL_1284_4

#define PRINTER_PROTOCOL_1284_4 0x03

Definition at line 65 of file printer_desc.h.

◆ PRINTER_PROTOCOL_BI_DIRECTIONAL

#define PRINTER_PROTOCOL_BI_DIRECTIONAL 0x02

Definition at line 64 of file printer_desc.h.

◆ PRINTER_PROTOCOL_UNIDIRECTIONAL

#define PRINTER_PROTOCOL_UNIDIRECTIONAL 0x01

Definition at line 63 of file printer_desc.h.

◆ PRINTER_PROTOCOL_VENDOR_SPECIFIC

#define PRINTER_PROTOCOL_VENDOR_SPECIFIC 0xFF

Definition at line 66 of file printer_desc.h.

◆ USBD_PRINTER_CONFIG_DESC_SIZE

#define USBD_PRINTER_CONFIG_DESC_SIZE 32

Definition at line 54 of file printer_desc.h.

◆ USBD_PRINTER_DESC_CONFIGURATION_STRING

#define USBD_PRINTER_DESC_CONFIGURATION_STRING "Printer Config"

Definition at line 60 of file printer_desc.h.

Referenced by get_device_config_string().

◆ USBD_PRINTER_DESC_INTERFACE_STRING

#define USBD_PRINTER_DESC_INTERFACE_STRING "Printer Interface"

Definition at line 61 of file printer_desc.h.

Referenced by get_device_interface_string().

◆ USBD_PRINTER_DESC_MANUFACTURER_STRING

#define USBD_PRINTER_DESC_MANUFACTURER_STRING "Artery"

Definition at line 58 of file printer_desc.h.

Referenced by get_device_manufacturer_string().

◆ USBD_PRINTER_DESC_PRODUCT_STRING

#define USBD_PRINTER_DESC_PRODUCT_STRING "AT32 Printer"

Definition at line 59 of file printer_desc.h.

Referenced by get_device_product_string().

◆ USBD_PRINTER_PRODUCT_ID

#define USBD_PRINTER_PRODUCT_ID 0x57FF

Definition at line 52 of file printer_desc.h.

◆ USBD_PRINTER_SIZ_STRING_LANGID

#define USBD_PRINTER_SIZ_STRING_LANGID 4

Definition at line 55 of file printer_desc.h.

◆ USBD_PRINTER_SIZ_STRING_SERIAL

#define USBD_PRINTER_SIZ_STRING_SERIAL 0x1A

Definition at line 56 of file printer_desc.h.

◆ USBD_PRINTER_VENDOR_ID

#define USBD_PRINTER_VENDOR_ID 0x2E3C

Definition at line 51 of file printer_desc.h.

Variable Documentation

◆ printer_desc_handler

usbd_desc_handler printer_desc_handler
extern

device descriptor handler structure

Definition at line 66 of file printer_desc.c.

Referenced by main().


AT32F413 Firmwary Library: USB_winusb_class

Topics
USB_winusb_class
AT32F413_middlewares_usbd_class

usb device class win usb More...

Topics

USB_winusb_class_private_functions
USB_winusb_class_definition
USB_winusb_class_exported_types
USB_cdc_class_exported_functions

Detailed Description

usb device class win usb


AT32F413 Firmwary Library: USB_winusb_class_private_functions

Functions | Variables
USB_winusb_class_private_functions
AT32F413_middlewares_usbd_class » USB_winusb_class

Functions

static usb_sts_type | class_init_handler (void *udev)
initialize usb endpoint
static usb_sts_type | class_clear_handler (void *udev)
clear endpoint or other state
static usb_sts_type | class_setup_handler (void *udev, usb_setup_type *setup)
usb device class setup request handler
static usb_sts_type | class_ept0_tx_handler (void *udev)
usb device endpoint 0 in status stage complete
static usb_sts_type | class_ept0_rx_handler (void *udev)
usb device endpoint 0 out status stage complete
static usb_sts_type | class_in_handler (void *udev, uint8_t ept_num)
usb device transmision complete handler
static usb_sts_type | class_out_handler (void *udev, uint8_t ept_num)
usb device endpoint receive data
static usb_sts_type | class_sof_handler (void *udev)
usb device sof handler
static usb_sts_type | class_event_handler (void *udev, usbd_event_type event)
usb device event handler
static usb_sts_type | winusb_struct_init (winusb_struct_type *p_winusb)
usb device winusb init
uint16_t | usb_winusb_get_rxdata (void *udev, uint8_t *recv_data)
usb device class rx data process
error_status | usb_winusb_send_data (void *udev, uint8_t *send_data, uint16_t len)
usb device class send data

Variables

winusb_struct_type winusb_struct
static uint32_t g_winusb_rx_buffer [16]
usbd_class_handler winusb_class_handler

Detailed Description

Function Documentation

◆ class_clear_handler()

static usb_sts_type class_clear_handler ( void * udev )
static

clear endpoint or other state

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 118 of file winusb_class.c.

◆ class_ept0_rx_handler()

static usb_sts_type class_ept0_rx_handler ( void * udev )
static

usb device endpoint 0 out status stage complete

Parameters
udev usb device core handler type
Return values
status of usb_sts_type

Definition at line 243 of file winusb_class.c.

◆ class_ept0_tx_handler()

static usb_sts_type class_ept0_tx_handler ( void * udev )
static

usb device endpoint 0 in status stage complete

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 229 of file winusb_class.c.

◆ class_event_handler()

static usb_sts_type class_event_handler | ( | void * | udev,
 |  | usbd_event_type | event )
 static

usb device event handler

Parameters
udev | to the structure of usbd_core_type
event | usb device event
Return values
status of usb_sts_type

Definition at line 310 of file winusb_class.c.

◆ class_in_handler()

static usb_sts_type class_in_handler | ( | void * | udev,
 |  | uint8_t | ept_num )
 static

usb device transmision complete handler

Parameters
udev | to the structure of usbd_core_type
ept_num | endpoint number
Return values
status of usb_sts_type

Definition at line 255 of file winusb_class.c.

◆ class_init_handler()

static usb_sts_type class_init_handler ( void * udev )
static

initialize usb endpoint

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 84 of file winusb_class.c.

◆ class_out_handler()

static usb_sts_type class_out_handler | ( | void * | udev,
 |  | uint8_t | ept_num )
 static

usb device endpoint receive data

Parameters
udev | to the structure of usbd_core_type
ept_num | endpoint number
Return values
status of usb_sts_type

Definition at line 275 of file winusb_class.c.

◆ class_setup_handler()

static usb_sts_type class_setup_handler | ( | void * | udev,
 |  | usb_setup_type * | setup )
 static

usb device class setup request handler

Parameters
udev | to the structure of usbd_core_type
setup | setup packet
Return values
status of usb_sts_type

Definition at line 138 of file winusb_class.c.

◆ class_sof_handler()

static usb_sts_type class_sof_handler ( void * udev )
static

usb device sof handler

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 295 of file winusb_class.c.

◆ usb_winusb_get_rxdata()

uint16_t usb_winusb_get_rxdata | ( | void * | udev,
 |  | uint8_t * | recv_data )

usb device class rx data process

Parameters
udev | to the structure of usbd_core_type
recv_data | receive buffer
Return values
receive data len

Definition at line 356 of file winusb_class.c.

Referenced by main().

◆ usb_winusb_send_data()

error_status usb_winusb_send_data | ( | void * | udev,
 |  | uint8_t * | send_data,
 |  | uint16_t | len )

usb device class send data

Parameters
udev | to the structure of usbd_core_type
send_data | send data buffer
len | send length
Return values
error status

Definition at line 386 of file winusb_class.c.

Referenced by main().

◆ winusb_struct_init()

static usb_sts_type winusb_struct_init ( winusb_struct_type * p_winusb )
static

usb device winusb init

Parameters
p_winusb to the structure of winusb_struct
Return values
status of usb_sts_type

Definition at line 341 of file winusb_class.c.

Referenced by class_init_handler().

Variable Documentation

◆ g_winusb_rx_buffer

uint32_t g_winusb_rx_buffer[16]
static

Definition at line 63 of file winusb_class.c.

Referenced by winusb_struct_init().

◆ winusb_class_handler

usbd_class_handler winusb_class_handler
Initial value:
=
{
class_init_handler,
class_clear_handler,
class_setup_handler,
class_ept0_tx_handler,
class_ept0_rx_handler,
class_in_handler,
class_out_handler,
class_sof_handler,
class_event_handler,
&winusb_struct
}
class_sof_handler
static usb_sts_type class_sof_handler(void *udev)
usb device sof handler
Definition winusb_class.c:295
class_in_handler
static usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
usb device transmision complete handler
Definition winusb_class.c:255
class_clear_handler
static usb_sts_type class_clear_handler(void *udev)
clear endpoint or other state
Definition winusb_class.c:118
class_setup_handler
static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
usb device class setup request handler
Definition winusb_class.c:138
class_ept0_tx_handler
static usb_sts_type class_ept0_tx_handler(void *udev)
usb device endpoint 0 in status stage complete
Definition winusb_class.c:229
class_ept0_rx_handler
static usb_sts_type class_ept0_rx_handler(void *udev)
usb device endpoint 0 out status stage complete
Definition winusb_class.c:243
class_event_handler
static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
usb device event handler
Definition winusb_class.c:310
class_init_handler
static usb_sts_type class_init_handler(void *udev)
initialize usb endpoint
Definition winusb_class.c:84
winusb_struct
winusb_struct_type winusb_struct
Definition winusb_class.c:60
class_out_handler
static usb_sts_type class_out_handler(void *udev, uint8_t ept_num)
usb device endpoint receive data
Definition winusb_class.c:275

Definition at line 66 of file winusb_class.c.

Referenced by main().

◆ winusb_struct

winusb_struct_type winusb_struct

Definition at line 60 of file winusb_class.c.


AT32F413 Firmwary Library: USB_winusb_class_definition

Macros
USB_winusb_class_definition
AT32F413_middlewares_usbd_class » USB_winusb_class

Macros

#define | USBD_WINUSB_BULK_IN_EPT 0x81
usb use endpoint define
#define | USBD_WINUSB_BULK_OUT_EPT 0x01
#define | USBD_FS_WINUSB_MAXPACKET_SIZE 0x40
usb in and out max packet size define
#define | USBD_WINUSB_IN_MAXPACKET_SIZE USBD_FS_WINUSB_MAXPACKET_SIZE
#define | USBD_WINUSB_OUT_MAXPACKET_SIZE USBD_FS_WINUSB_MAXPACKET_SIZE
#define | WINUSB_BMS_VENDOR_CODE 0xA0

Detailed Description

Macro Definition Documentation

◆ USBD_FS_WINUSB_MAXPACKET_SIZE

#define USBD_FS_WINUSB_MAXPACKET_SIZE 0x40

usb in and out max packet size define

Definition at line 59 of file winusb_class.h.

Referenced by class_init_handler().

◆ USBD_WINUSB_BULK_IN_EPT

#define USBD_WINUSB_BULK_IN_EPT 0x81

usb use endpoint define

Definition at line 52 of file winusb_class.h.

Referenced by class_clear_handler(), class_init_handler(), and usb_winusb_send_data().

◆ USBD_WINUSB_BULK_OUT_EPT

#define USBD_WINUSB_BULK_OUT_EPT 0x01

Definition at line 53 of file winusb_class.h.

Referenced by class_clear_handler(), class_init_handler(), and usb_winusb_get_rxdata().

◆ USBD_WINUSB_IN_MAXPACKET_SIZE

#define USBD_WINUSB_IN_MAXPACKET_SIZE USBD_FS_WINUSB_MAXPACKET_SIZE

Definition at line 60 of file winusb_class.h.

Referenced by class_init_handler().

◆ USBD_WINUSB_OUT_MAXPACKET_SIZE

#define USBD_WINUSB_OUT_MAXPACKET_SIZE USBD_FS_WINUSB_MAXPACKET_SIZE

Definition at line 61 of file winusb_class.h.

Referenced by class_init_handler().

◆ WINUSB_BMS_VENDOR_CODE

#define WINUSB_BMS_VENDOR_CODE 0xA0

Definition at line 63 of file winusb_class.h.

Referenced by class_setup_handler().


AT32F413 Firmwary Library: USB_winusb_class_exported_types

Data Structures
USB_winusb_class_exported_types
AT32F413_middlewares_usbd_class » USB_winusb_class

Data Structures

struct winusb_struct_type
usb winusb class struct More...

Detailed Description

Generated by doxygen 1.12.0


AT32F413 Firmwary Library: winusb_struct_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
winusb_struct_type Struct Reference
AT32F413_middlewares_usbd_class » USB_winusb_class » USB_winusb_class_exported_types

usb winusb class struct More...

#include <winusb_class.h>

Data Fields

uint32_t | alt_setting
uint8_t * | g_rx_buff
uint16_t | g_len
uint16_t | g_rxlen
__IO uint8_t | g_tx_completed
__IO uint8_t | g_rx_completed
uint32_t | maxpacket

Detailed Description

usb winusb class struct

Definition at line 76 of file winusb_class.h.

Field Documentation

◆ alt_setting

uint32_t winusb_struct_type::alt_setting

Definition at line 78 of file winusb_class.h.

Referenced by class_setup_handler(), and winusb_struct_init().

◆ g_len

uint16_t winusb_struct_type::g_len

Definition at line 80 of file winusb_class.h.

◆ g_rx_buff

uint8_t* winusb_struct_type::g_rx_buff

Definition at line 79 of file winusb_class.h.

Referenced by class_init_handler(), usb_winusb_get_rxdata(), and winusb_struct_init().

◆ g_rx_completed

__IO uint8_t winusb_struct_type::g_rx_completed

Definition at line 81 of file winusb_class.h.

Referenced by class_out_handler(), usb_winusb_get_rxdata(), and winusb_struct_init().

◆ g_rxlen

uint16_t winusb_struct_type::g_rxlen

Definition at line 80 of file winusb_class.h.

Referenced by class_out_handler(), and usb_winusb_get_rxdata().

◆ g_tx_completed

__IO uint8_t winusb_struct_type::g_tx_completed

Definition at line 81 of file winusb_class.h.

Referenced by class_in_handler(), usb_winusb_send_data(), and winusb_struct_init().

◆ maxpacket

uint32_t winusb_struct_type::maxpacket

Definition at line 82 of file winusb_class.h.

Referenced by class_init_handler(), and usb_winusb_get_rxdata().

The documentation for this struct was generated from the following file:
  • winusb_class.h


AT32F413 Firmwary Library: USB_winusb_desc

Topics | Variables
USB_winusb_desc
AT32F413_middlewares_usbd_class

usb device winusb descriptor More...

Topics

USB_winusb_desc_private_functions
USB_winusb_desc_definition

Variables

usbd_desc_handler winusb_desc_handler
device descriptor handler structure

Detailed Description

usb device winusb descriptor

Variable Documentation

◆ winusb_desc_handler

usbd_desc_handler winusb_desc_handler
extern

device descriptor handler structure

Definition at line 73 of file winusb_desc.c.

Referenced by main().


AT32F413 Firmwary Library: USB_winusb_desc_private_functions

Functions | Variables
USB_winusb_desc_private_functions
AT32F413_middlewares_usbd_class » USB_winusb_desc

Functions

static usbd_desc_t * | get_device_descriptor (void)
get device descriptor
static usbd_desc_t * | get_device_qualifier (void)
get device qualifier
static usbd_desc_t * | get_device_configuration (void)
get config descriptor
static usbd_desc_t * | get_device_other_speed (void)
get other speed descriptor
static usbd_desc_t * | get_device_lang_id (void)
get lang id descriptor
static usbd_desc_t * | get_device_manufacturer_string (void)
get manufacturer descriptor
static usbd_desc_t * | get_device_product_string (void)
get product descriptor
static usbd_desc_t * | get_device_serial_string (void)
get serial descriptor
static usbd_desc_t * | get_device_interface_string (void)
get interface descriptor
static usbd_desc_t * | get_device_config_string (void)
get device config descriptor
static uint16_t | usbd_unicode_convert (uint8_t *string, uint8_t *unicode_buf)
standard usb unicode convert
static void | usbd_int_to_unicode (uint32_t value, uint8_t *pbuf, uint8_t len)
usb int convert to unicode
static void | get_serial_num (void)
usb get serial number

Variables

static ALIGNED_HEAD uint8_t g_usbd_desc_buffer[256] | ALIGNED_TAIL
usb device standard descriptor
usbd_desc_handler winusb_desc_handler
device descriptor handler structure
static usbd_desc_t | device_descriptor
static usbd_desc_t | config_descriptor
static usbd_desc_t | langid_descriptor
static usbd_desc_t | serial_descriptor
static usbd_desc_t | vp_desc

Detailed Description

Function Documentation

◆ get_device_config_string()

static usbd_desc_t * get_device_config_string ( void )
static

get device config descriptor

Parameters
none
Return values
usbd_desc

Definition at line 402 of file winusb_desc.c.

◆ get_device_configuration()

static usbd_desc_t * get_device_configuration ( void )
static

get config descriptor

Parameters
none
Return values
usbd_desc

Definition at line 323 of file winusb_desc.c.

◆ get_device_descriptor()

static usbd_desc_t * get_device_descriptor ( void )
static

get device descriptor

Parameters
none
Return values
usbd_desc

Definition at line 303 of file winusb_desc.c.

◆ get_device_interface_string()

static usbd_desc_t * get_device_interface_string ( void )
static

get interface descriptor

Parameters
none
Return values
usbd_desc

Definition at line 390 of file winusb_desc.c.

◆ get_device_lang_id()

static usbd_desc_t * get_device_lang_id ( void )
static

get lang id descriptor

Parameters
none
Return values
usbd_desc

Definition at line 344 of file winusb_desc.c.

◆ get_device_manufacturer_string()

static usbd_desc_t * get_device_manufacturer_string ( void )
static

get manufacturer descriptor

Parameters
none
Return values
usbd_desc

Definition at line 355 of file winusb_desc.c.

◆ get_device_other_speed()

static usbd_desc_t * get_device_other_speed ( void )
static

get other speed descriptor

Parameters
none
Return values
usbd_desc

Definition at line 334 of file winusb_desc.c.

◆ get_device_product_string()

static usbd_desc_t * get_device_product_string ( void )
static

get product descriptor

Parameters
none
Return values
usbd_desc

Definition at line 367 of file winusb_desc.c.

◆ get_device_qualifier()

static usbd_desc_t * get_device_qualifier ( void )
static

get device qualifier

Parameters
none
Return values
usbd_desc

Definition at line 313 of file winusb_desc.c.

◆ get_device_serial_string()

static usbd_desc_t * get_device_serial_string ( void )
static

get serial descriptor

Parameters
none
Return values
usbd_desc

Definition at line 379 of file winusb_desc.c.

◆ get_serial_num()

static void get_serial_num ( void )
static

usb get serial number

Parameters
none
Return values
none

Definition at line 281 of file winusb_desc.c.

Referenced by get_device_serial_string().

◆ usbd_int_to_unicode()

static void usbd_int_to_unicode | ( | uint32_t | value,
 |  | uint8_t * | pbuf,
 |  | uint8_t | len )
 static

usb int convert to unicode

Parameters
value | int value
pbus | unicode buffer
len | length
Return values
none

Definition at line 255 of file winusb_desc.c.

Referenced by get_serial_num().

◆ usbd_unicode_convert()

static uint16_t usbd_unicode_convert | ( | uint8_t * | string,
 |  | uint8_t * | unicode_buf )
 static

standard usb unicode convert

Parameters
string | source string
unicode_buf | unicode buffer
Return values
length

Definition at line 229 of file winusb_desc.c.

Referenced by get_device_config_string(), get_device_interface_string(), get_device_manufacturer_string(), and get_device_product_string().

Variable Documentation

◆ ALIGNED_TAIL

ALIGNED_HEAD uint8_t g_string_serial [ 0x1A ] ALIGNED_TAIL
static
Initial value:
=
{
USB_DEVICE_DESC_LEN,
USB_DESCIPTOR_TYPE_DEVICE,
0x00,
0x02,
0x00,
0x00,
0x00,
USB_MAX_EP0_SIZE,
LBYTE( 0x2E3C ),
HBYTE( 0x2E3C ),
LBYTE( 0x5780 ),
HBYTE( 0x5780 ),
0x00,
0x02,
USB_MFC_STRING,
USB_PRODUCT_STRING,
USB_SERIAL_STRING,
1
}
HBYTE
#define HBYTE(x)
Definition usb_std.h:271
USB_MAX_EP0_SIZE
#define USB_MAX_EP0_SIZE
endpoint 0 max size
Definition usb_std.h:248
USB_PRODUCT_STRING
#define USB_PRODUCT_STRING
Definition usb_std.h:105
LBYTE
#define LBYTE(x)
low byte and high byte define
Definition usb_std.h:270
USB_DEVICE_DESC_LEN
#define USB_DEVICE_DESC_LEN
Definition usb_std.h:156
USB_MFC_STRING
#define USB_MFC_STRING
Definition usb_std.h:104
USB_SERIAL_STRING
#define USB_SERIAL_STRING
Definition usb_std.h:106
USB_DESCIPTOR_TYPE_DEVICE
#define USB_DESCIPTOR_TYPE_DEVICE
usb standard device type
Definition usb_std.h:91

usb device standard descriptor

usb string serial

usb string lang id

usb configuration standard descriptor

Definition at line 68 of file winusb_desc.c.

◆ config_descriptor

usbd_desc_t config_descriptor
static
Initial value:
=
{
32 ,
g_usbd_configuration
}

Definition at line 201 of file winusb_desc.c.

Referenced by get_device_configuration().

◆ device_descriptor

usbd_desc_t device_descriptor
static
Initial value:
=
{
USB_DEVICE_DESC_LEN,
g_usbd_descriptor
}

Definition at line 194 of file winusb_desc.c.

Referenced by get_device_descriptor().

◆ langid_descriptor

usbd_desc_t langid_descriptor
static
Initial value:
=
{
4 ,
g_string_lang_id
}

Definition at line 208 of file winusb_desc.c.

Referenced by get_device_lang_id().

◆ serial_descriptor

usbd_desc_t serial_descriptor
static
Initial value:
=
{
0x1A ,
g_string_serial
}

Definition at line 215 of file winusb_desc.c.

Referenced by get_device_serial_string().

◆ vp_desc

usbd_desc_t vp_desc
static

Definition at line 221 of file winusb_desc.c.

Referenced by get_device_config_string(), get_device_interface_string(), get_device_manufacturer_string(), and get_device_product_string().

◆ winusb_desc_handler

usbd_desc_handler winusb_desc_handler
Initial value:
=
{
get_device_descriptor,
get_device_qualifier,
get_device_configuration,
get_device_other_speed,
get_device_lang_id,
get_device_manufacturer_string,
get_device_product_string,
get_device_serial_string,
get_device_interface_string,
get_device_config_string,
}
get_device_configuration
static usbd_desc_t * get_device_configuration(void)
get config descriptor
Definition winusb_desc.c:323
get_device_descriptor
static usbd_desc_t * get_device_descriptor(void)
get device descriptor
Definition winusb_desc.c:303
get_device_manufacturer_string
static usbd_desc_t * get_device_manufacturer_string(void)
get manufacturer descriptor
Definition winusb_desc.c:355
get_device_qualifier
static usbd_desc_t * get_device_qualifier(void)
get device qualifier
Definition winusb_desc.c:313
get_device_interface_string
static usbd_desc_t * get_device_interface_string(void)
get interface descriptor
Definition winusb_desc.c:390
get_device_other_speed
static usbd_desc_t * get_device_other_speed(void)
get other speed descriptor
Definition winusb_desc.c:334
get_device_product_string
static usbd_desc_t * get_device_product_string(void)
get product descriptor
Definition winusb_desc.c:367
get_device_config_string
static usbd_desc_t * get_device_config_string(void)
get device config descriptor
Definition winusb_desc.c:402
get_device_lang_id
static usbd_desc_t * get_device_lang_id(void)
get lang id descriptor
Definition winusb_desc.c:344
get_device_serial_string
static usbd_desc_t * get_device_serial_string(void)
get serial descriptor
Definition winusb_desc.c:379

device descriptor handler structure

Definition at line 73 of file winusb_desc.c.

Referenced by main().


AT32F413 Firmwary Library: USB_winusb_desc_definition

Macros
USB_winusb_desc_definition
AT32F413_middlewares_usbd_class » USB_winusb_desc

Macros

#define | USBD_WINUSB_VENDOR_ID 0x2E3C
usb vendor id and product id define
#define | USBD_WINUSB_PRODUCT_ID 0x5780
#define | USBD_WINUSB_CONFIG_DESC_SIZE 32
usb descriptor size define
#define | USBD_WINUSB_SIZ_STRING_LANGID 4
#define | USBD_WINUSB_SIZ_STRING_SERIAL 0x1A
#define | USBD_WINUSB_DESC_MANUFACTURER_STRING "Artery"
usb string define(vendor, product configuration, interface)
#define | USBD_WINUSB_DESC_PRODUCT_STRING "AT32 WinUSB"
#define | USBD_WINUSB_DESC_CONFIGURATION_STRING "WinUSB Config"
#define | USBD_WINUSB_DESC_INTERFACE_STRING "WinUSB Interface"
#define | MCU_ID1 (0x1FFFF7E8)
usb mcu id address deine
#define | MCU_ID2 (0x1FFFF7EC)
#define | MCU_ID3 (0x1FFFF7F0)

Detailed Description

Macro Definition Documentation

◆ MCU_ID1

#define MCU_ID1 (0x1FFFF7E8)

usb mcu id address deine

Definition at line 72 of file winusb_desc.h.

◆ MCU_ID2

#define MCU_ID2 (0x1FFFF7EC)

Definition at line 73 of file winusb_desc.h.

◆ MCU_ID3

#define MCU_ID3 (0x1FFFF7F0)

Definition at line 74 of file winusb_desc.h.

◆ USBD_WINUSB_CONFIG_DESC_SIZE

#define USBD_WINUSB_CONFIG_DESC_SIZE 32

usb descriptor size define

Definition at line 57 of file winusb_desc.h.

◆ USBD_WINUSB_DESC_CONFIGURATION_STRING

#define USBD_WINUSB_DESC_CONFIGURATION_STRING "WinUSB Config"

Definition at line 66 of file winusb_desc.h.

Referenced by get_device_config_string().

◆ USBD_WINUSB_DESC_INTERFACE_STRING

#define USBD_WINUSB_DESC_INTERFACE_STRING "WinUSB Interface"

Definition at line 67 of file winusb_desc.h.

Referenced by get_device_interface_string().

◆ USBD_WINUSB_DESC_MANUFACTURER_STRING

#define USBD_WINUSB_DESC_MANUFACTURER_STRING "Artery"

usb string define(vendor, product configuration, interface)

Definition at line 64 of file winusb_desc.h.

Referenced by get_device_manufacturer_string().

◆ USBD_WINUSB_DESC_PRODUCT_STRING

#define USBD_WINUSB_DESC_PRODUCT_STRING "AT32 WinUSB"

Definition at line 65 of file winusb_desc.h.

Referenced by get_device_product_string().

◆ USBD_WINUSB_PRODUCT_ID

#define USBD_WINUSB_PRODUCT_ID 0x5780

Definition at line 52 of file winusb_desc.h.

◆ USBD_WINUSB_SIZ_STRING_LANGID

#define USBD_WINUSB_SIZ_STRING_LANGID 4

Definition at line 58 of file winusb_desc.h.

◆ USBD_WINUSB_SIZ_STRING_SERIAL

#define USBD_WINUSB_SIZ_STRING_SERIAL 0x1A

Definition at line 59 of file winusb_desc.h.

◆ USBD_WINUSB_VENDOR_ID

#define USBD_WINUSB_VENDOR_ID 0x2E3C

usb vendor id and product id define

Definition at line 51 of file winusb_desc.h.


AT32F413 Firmwary Library: AT32F413_middlewares_usbd_drivers

Topics
AT32F413_middlewares_usbd_drivers

Topics

USBD_drivers_core
usb device drivers core
USBD_drivers_interrupt
usb device interrupt
USBD_drivers_standard_request
usb device standard_request
USB_standard

Detailed Description

Generated by doxygen 1.12.0


AT32F413 Firmwary Library: USBD_drivers_core

Topics
USBD_drivers_core
AT32F413_middlewares_usbd_drivers

usb device drivers core More...

Topics

USBD_core_exported_types
USBD_core_exported_functions
USBD_core_private_functions

Detailed Description

usb device drivers core


AT32F413 Firmwary Library: USBD_core_exported_types

Data Structures | Enumerations
USBD_core_exported_types
AT32F413_middlewares_usbd_drivers » USBD_drivers_core

Data Structures

struct | usbd_desc_t
usb device descriptor struct More...
struct | usbd_desc_handler
usb device descriptor handler More...
struct | usbd_class_handler
usb device class handler More...
struct | usbd_core_type
usb device core struct type More...

Enumerations

enum usbd_event_type {
USBD_NOP_EVENT , USBD_RESET_EVENT , USBD_SUSPEND_EVENT , USBD_WAKEUP_EVENT ,
USBD_ERR_EVENT
}
usb device event More...

Detailed Description

Enumeration Type Documentation

◆ usbd_event_type

enum usbd_event_type

usb device event

Enumerator
USBD_NOP_EVENT | usb device event nop
USBD_RESET_EVENT | usb device event reset
USBD_SUSPEND_EVENT | usb device event suspend
USBD_WAKEUP_EVENT | usb device event wakeup
USBD_ERR_EVENT | usb device event error

Definition at line 53 of file usbd_core.h.


AT32F413 Firmwary Library: usbd_desc_t Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
usbd_desc_t Struct Reference
AT32F413_middlewares_usbd_drivers » USBD_drivers_core » USBD_core_exported_types

usb device descriptor struct More...

#include <usbd_core.h>

Data Fields

uint16_t | length
uint8_t * | descriptor

Detailed Description

usb device descriptor struct

Definition at line 65 of file usbd_core.h.

Field Documentation

◆ descriptor

uint8_t* usbd_desc_t::descriptor

descriptor string

Definition at line 68 of file usbd_core.h.

Referenced by class_audio_setup_handler(), class_setup_handler(), get_device_config_string(), get_device_config_string(), get_device_config_string(), get_device_config_string(), get_device_config_string(), get_device_config_string(), get_device_config_string(), get_device_config_string(), get_device_config_string(), get_device_config_string(), get_device_config_string(), get_device_config_string(), get_device_interface_string(), get_device_interface_string(), get_device_interface_string(), get_device_interface_string(), get_device_interface_string(), get_device_interface_string(), get_device_interface_string(), get_device_interface_string(), get_device_interface_string(), get_device_interface_string(), get_device_interface_string(), get_device_interface_string(), get_device_manufacturer_string(), get_device_manufacturer_string(), get_device_manufacturer_string(), get_device_manufacturer_string(), get_device_manufacturer_string(), get_device_manufacturer_string(), get_device_manufacturer_string(), get_device_manufacturer_string(), get_device_manufacturer_string(), get_device_manufacturer_string(), get_device_manufacturer_string(), get_device_manufacturer_string(), get_device_product_string(), get_device_product_string(), get_device_product_string(), get_device_product_string(), get_device_product_string(), get_device_product_string(), get_device_product_string(), get_device_product_string(), get_device_product_string(), get_device_product_string(), get_device_product_string(), get_device_product_string(), and usbd_get_descriptor().

◆ length

uint16_t usbd_desc_t::length

descriptor length

Definition at line 67 of file usbd_core.h.

Referenced by get_device_config_string(), get_device_config_string(), get_device_config_string(), get_device_config_string(), get_device_config_string(), get_device_config_string(), get_device_config_string(), get_device_config_string(), get_device_config_string(), get_device_config_string(), get_device_config_string(), get_device_config_string(), get_device_interface_string(), get_device_interface_string(), get_device_interface_string(), get_device_interface_string(), get_device_interface_string(), get_device_interface_string(), get_device_interface_string(), get_device_interface_string(), get_device_interface_string(), get_device_interface_string(), get_device_interface_string(), get_device_interface_string(), get_device_manufacturer_string(), get_device_manufacturer_string(), get_device_manufacturer_string(), get_device_manufacturer_string(), get_device_manufacturer_string(), get_device_manufacturer_string(), get_device_manufacturer_string(), get_device_manufacturer_string(), get_device_manufacturer_string(), get_device_manufacturer_string(), get_device_manufacturer_string(), get_device_manufacturer_string(), get_device_product_string(), get_device_product_string(), get_device_product_string(), get_device_product_string(), get_device_product_string(), get_device_product_string(), get_device_product_string(), get_device_product_string(), get_device_product_string(), get_device_product_string(), get_device_product_string(), get_device_product_string(), and usbd_get_descriptor().

The documentation for this struct was generated from the following file:
  • usbd_core.h


AT32F413 Firmwary Library: usbd_desc_handler Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
usbd_desc_handler Struct Reference
AT32F413_middlewares_usbd_drivers » USBD_drivers_core » USBD_core_exported_types

usb device descriptor handler More...

#include <usbd_core.h>

Data Fields

usbd_desc_t *(* | get_device_descriptor )(void)
usbd_desc_t *(* | get_device_qualifier )(void)
usbd_desc_t *(* | get_device_configuration )(void)
usbd_desc_t *(* | get_device_other_speed )(void)
usbd_desc_t *(* | get_device_lang_id )(void)
usbd_desc_t *(* | get_device_manufacturer_string )(void)
usbd_desc_t *(* | get_device_product_string )(void)
usbd_desc_t *(* | get_device_serial_string )(void)
usbd_desc_t *(* | get_device_interface_string )(void)
usbd_desc_t *(* | get_device_config_string )(void)

Detailed Description

usb device descriptor handler

Definition at line 74 of file usbd_core.h.

Field Documentation

◆ get_device_config_string

usbd_desc_t *(* usbd_desc_handler::get_device_config_string) (void)

get device device config callback

Definition at line 85 of file usbd_core.h.

Referenced by usbd_get_descriptor().

◆ get_device_configuration

usbd_desc_t *(* usbd_desc_handler::get_device_configuration) (void)

get device configuration callback

Definition at line 78 of file usbd_core.h.

Referenced by class_audio_setup_handler(), class_setup_handler(), and usbd_get_descriptor().

◆ get_device_descriptor

usbd_desc_t *(* usbd_desc_handler::get_device_descriptor) (void)

get device descriptor callback

Definition at line 76 of file usbd_core.h.

Referenced by usbd_get_descriptor().

◆ get_device_interface_string

usbd_desc_t *(* usbd_desc_handler::get_device_interface_string) (void)

get device interface string callback

Definition at line 84 of file usbd_core.h.

Referenced by usbd_get_descriptor().

◆ get_device_lang_id

usbd_desc_t *(* usbd_desc_handler::get_device_lang_id) (void)

get device lang id callback

Definition at line 80 of file usbd_core.h.

Referenced by usbd_get_descriptor().

◆ get_device_manufacturer_string

usbd_desc_t *(* usbd_desc_handler::get_device_manufacturer_string) (void)

get device manufacturer callback

Definition at line 81 of file usbd_core.h.

Referenced by usbd_get_descriptor().

◆ get_device_other_speed

usbd_desc_t *(* usbd_desc_handler::get_device_other_speed) (void)

get device other speed callback

Definition at line 79 of file usbd_core.h.

◆ get_device_product_string

usbd_desc_t *(* usbd_desc_handler::get_device_product_string) (void)

get device product callback

Definition at line 82 of file usbd_core.h.

Referenced by usbd_get_descriptor().

◆ get_device_qualifier

usbd_desc_t *(* usbd_desc_handler::get_device_qualifier) (void)

get device qualifier callback

Definition at line 77 of file usbd_core.h.

◆ get_device_serial_string

usbd_desc_t *(* usbd_desc_handler::get_device_serial_string) (void)

get device serial callback

Definition at line 83 of file usbd_core.h.

Referenced by usbd_get_descriptor().

The documentation for this struct was generated from the following file:
  • usbd_core.h


AT32F413 Firmwary Library: usbd_class_handler Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
usbd_class_handler Struct Reference
AT32F413_middlewares_usbd_drivers » USBD_drivers_core » USBD_core_exported_types

usb device class handler More...

#include <usbd_core.h>

Data Fields

usb_sts_type(* | init_handler )(void *udev)
usb_sts_type(* | clear_handler )(void *udev)
usb_sts_type(* | setup_handler )(void *udev, usb_setup_type *setup)
usb_sts_type(* | ept0_tx_handler )(void *udev)
usb_sts_type(* | ept0_rx_handler )(void *udev)
usb_sts_type(* | in_handler )(void *udev, uint8_t ept_num)
usb_sts_type(* | out_handler )(void *udev, uint8_t ept_num)
usb_sts_type(* | sof_handler )(void *udev)
usb_sts_type(* | event_handler )(void *udev, usbd_event_type event)
void * | pdata

Detailed Description

usb device class handler

Definition at line 96 of file usbd_core.h.

Field Documentation

◆ clear_handler

usb_sts_type(* usbd_class_handler::clear_handler) (void *udev)

usb class clear handler

Definition at line 99 of file usbd_core.h.

Referenced by usbd_set_configuration().

◆ ept0_rx_handler

usb_sts_type(* usbd_class_handler::ept0_rx_handler) (void *udev)

usb class endpoint 0 rx complete handler

Definition at line 102 of file usbd_core.h.

Referenced by usbd_core_out_handler().

◆ ept0_tx_handler

usb_sts_type(* usbd_class_handler::ept0_tx_handler) (void *udev)

usb class endpoint 0 tx complete handler

Definition at line 101 of file usbd_core.h.

Referenced by usbd_core_in_handler().

◆ event_handler

usb_sts_type(* usbd_class_handler::event_handler) (void *udev, usbd_event_type event)

usb class event handler

Definition at line 106 of file usbd_core.h.

Referenced by usbd_reset_handler(), usbd_suspend_handler(), and usbd_wakeup_handler().

◆ in_handler

usb_sts_type(* usbd_class_handler::in_handler) (void *udev, uint8_t ept_num)

usb class in transfer complete handler

Definition at line 103 of file usbd_core.h.

Referenced by usbd_core_in_handler().

◆ init_handler

usb_sts_type(* usbd_class_handler::init_handler) (void *udev)

usb class init handler

Definition at line 98 of file usbd_core.h.

Referenced by usbd_set_configuration().

◆ out_handler

usb_sts_type(* usbd_class_handler::out_handler) (void *udev, uint8_t ept_num)

usb class out transfer complete handler

Definition at line 104 of file usbd_core.h.

Referenced by usbd_core_out_handler().

◆ pdata

void* usbd_class_handler::pdata

usb class data pointer

Definition at line 107 of file usbd_core.h.

Referenced by audio_get_interface(), audio_get_interface(), audio_req_get_cur(), audio_req_get_cur(), audio_req_get_max(), audio_req_get_max(), audio_req_get_min(), audio_req_get_min(), audio_req_get_res(), audio_req_get_res(), audio_req_set_cur(), audio_req_set_cur(), audio_set_interface(), audio_set_interface(), bot_cbw_decode(), bot_scsi_allow_medium_removal(), bot_scsi_capacity(), bot_scsi_check_address(), bot_scsi_clear_feature(), bot_scsi_cmd_process(), bot_scsi_datain_handler(), bot_scsi_dataout_handler(), bot_scsi_format_capacity(), bot_scsi_init(), bot_scsi_inquiry(), bot_scsi_mode_sense10(), bot_scsi_mode_sense6(), bot_scsi_read10(), bot_scsi_request_sense(), bot_scsi_reset(), bot_scsi_send_csw(), bot_scsi_send_data(), bot_scsi_stall(), bot_scsi_start_stop(), bot_scsi_test_unit(), bot_scsi_verify(), bot_scsi_write10(), cdc_class_setup_handler(), cdc_class_setup_handler(), class_ept0_rx_handler(), class_ept0_rx_handler(), class_ept0_rx_handler(), class_ept0_rx_handler(), class_ept0_rx_handler(), class_ept0_rx_handler(), class_ept0_rx_handler(), class_ept0_rx_handler(), class_ept0_rx_handler(), class_event_handler(), class_event_handler(), class_event_handler(), class_event_handler(), class_hid_setup_handler(), class_in_handler(), class_in_handler(), class_in_handler(), class_in_handler(), class_in_handler(), class_in_handler(), class_in_handler(), class_in_handler(), class_in_handler(), class_in_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_out_handler(), class_out_handler(), class_out_handler(), class_out_handler(), class_out_handler(), class_out_handler(), class_out_handler(), class_out_handler(), class_out_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), custom_hid_class_send_report(), keyboard_class_setup_handler(), keyboard_send_string(), main(), msc_class_setup_handler(), usb_hid_buf_process(), usb_hid_buf_process(), usb_hid_keyboard_send_char(), usb_hid_mouse_send(), usb_keyboard_class_send_report(), usb_mouse_class_send_report(), usb_printer_get_rxdata(), usb_printer_send_data(), usb_vcp_cmd_process(), usb_vcp_cmd_process(), usb_vcp_cmd_process(), usb_vcp_get_rxdata(), usb_vcp_send_data(), usb_vcpkybrd_vcp_get_rxdata(), usb_vcpkybrd_vcp_send_data(), usb_winusb_get_rxdata(), and usb_winusb_send_data().

◆ setup_handler

usb_sts_type(* usbd_class_handler::setup_handler) (void *udev, usb_setup_type *setup)

usb class setup handler

Definition at line 100 of file usbd_core.h.

Referenced by usbd_clear_feature(), usbd_device_request(), usbd_endpoint_request(), usbd_get_descriptor(), usbd_interface_request(), and usbd_set_feature().

◆ sof_handler

usb_sts_type(* usbd_class_handler::sof_handler) (void *udev)

usb class sof handler

Definition at line 105 of file usbd_core.h.

Referenced by usbd_sof_handler().

The documentation for this struct was generated from the following file:
  • usbd_core.h


AT32F413 Firmwary Library: usbd_core_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
usbd_core_type Struct Reference
AT32F413_middlewares_usbd_drivers » USBD_drivers_core » USBD_core_exported_types

usb device core struct type More...

#include <usbd_core.h>

Data Fields

usb_reg_type * usb_reg
usbd_class_handler * class_handler
usbd_desc_handler * desc_handler
usb_ept_info | ept_in [USB_EPT_MAX_NUM]
usb_ept_info | ept_out [USB_EPT_MAX_NUM]
usb_setup_type setup
uint8_t | setup_buffer [12]
uint8_t | ept0_sts
uint8_t | speed
uint16_t | ept0_wlength
usbd_conn_state conn_state
usbd_conn_state old_conn_state
uint8_t | device_addr
uint8_t | remote_wakup
uint8_t | default_config
uint8_t | dev_config
uint16_t | config_status

Detailed Description

usb device core struct type

Definition at line 113 of file usbd_core.h.

Field Documentation

◆ class_handler

usbd_class_handler* usbd_core_type::class_handler

usb device class handler pointer

Definition at line 117 of file usbd_core.h.

Referenced by audio_get_interface(), audio_get_interface(), audio_req_get_cur(), audio_req_get_cur(), audio_req_get_max(), audio_req_get_max(), audio_req_get_min(), audio_req_get_min(), audio_req_get_res(), audio_req_get_res(), audio_req_set_cur(), audio_req_set_cur(), audio_set_interface(), audio_set_interface(), bot_cbw_decode(), bot_scsi_allow_medium_removal(), bot_scsi_capacity(), bot_scsi_check_address(), bot_scsi_clear_feature(), bot_scsi_cmd_process(), bot_scsi_datain_handler(), bot_scsi_dataout_handler(), bot_scsi_format_capacity(), bot_scsi_init(), bot_scsi_inquiry(), bot_scsi_mode_sense10(), bot_scsi_mode_sense6(), bot_scsi_read10(), bot_scsi_request_sense(), bot_scsi_reset(), bot_scsi_send_csw(), bot_scsi_send_data(), bot_scsi_stall(), bot_scsi_start_stop(), bot_scsi_test_unit(), bot_scsi_verify(), bot_scsi_write10(), cdc_class_setup_handler(), cdc_class_setup_handler(), class_ept0_rx_handler(), class_ept0_rx_handler(), class_ept0_rx_handler(), class_ept0_rx_handler(), class_ept0_rx_handler(), class_ept0_rx_handler(), class_ept0_rx_handler(), class_ept0_rx_handler(), class_ept0_rx_handler(), class_event_handler(), class_event_handler(), class_event_handler(), class_event_handler(), class_hid_setup_handler(), class_in_handler(), class_in_handler(), class_in_handler(), class_in_handler(), class_in_handler(), class_in_handler(), class_in_handler(), class_in_handler(), class_in_handler(), class_in_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_out_handler(), class_out_handler(), class_out_handler(), class_out_handler(), class_out_handler(), class_out_handler(), class_out_handler(), class_out_handler(), class_out_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), custom_hid_class_send_report(), keyboard_class_setup_handler(), keyboard_send_string(), main(), msc_class_setup_handler(), usb_hid_buf_process(), usb_hid_buf_process(), usb_hid_keyboard_send_char(), usb_hid_mouse_send(), usb_keyboard_class_send_report(), usb_mouse_class_send_report(), usb_printer_get_rxdata(), usb_printer_send_data(), usb_vcp_cmd_process(), usb_vcp_cmd_process(), usb_vcp_cmd_process(), usb_vcp_get_rxdata(), usb_vcp_send_data(), usb_vcpkybrd_vcp_get_rxdata(), usb_vcpkybrd_vcp_send_data(), usb_winusb_get_rxdata(), usb_winusb_send_data(), usbd_clear_feature(), usbd_core_in_handler(), usbd_core_init(), usbd_core_out_handler(), usbd_device_request(), usbd_endpoint_request(), usbd_get_descriptor(), usbd_interface_request(), usbd_reset_handler(), usbd_set_configuration(), usbd_set_feature(), usbd_sof_handler(), usbd_suspend_handler(), and usbd_wakeup_handler().

◆ config_status

uint16_t usbd_core_type::config_status

usb configure status

Definition at line 137 of file usbd_core.h.

Referenced by usbd_clear_feature(), and usbd_get_status().

◆ conn_state

usbd_conn_state usbd_core_type::conn_state

usb current connect state

Definition at line 130 of file usbd_core.h.

Referenced by usbd_clear_feature(), usbd_connect_state_get(), usbd_core_in_handler(), usbd_core_init(), usbd_core_out_handler(), usbd_endpoint_request(), usbd_eptn_handler(), usbd_get_configuration(), usbd_get_status(), usbd_interface_request(), usbd_remote_wakeup(), usbd_reset_handler(), usbd_set_address(), usbd_set_configuration(), usbd_suspend_handler(), and usbd_wakeup_handler().

◆ default_config

uint8_t usbd_core_type::default_config

usb default config state

Definition at line 135 of file usbd_core.h.

Referenced by usbd_get_configuration().

◆ desc_handler

usbd_desc_handler* usbd_core_type::desc_handler

usb device descriptor handler pointer

Definition at line 118 of file usbd_core.h.

Referenced by class_audio_setup_handler(), class_setup_handler(), usbd_core_init(), and usbd_get_descriptor().

◆ dev_config

uint8_t usbd_core_type::dev_config

usb device config state

Definition at line 136 of file usbd_core.h.

Referenced by usbd_get_configuration(), and usbd_set_configuration().

◆ device_addr

uint8_t usbd_core_type::device_addr

device address

Definition at line 133 of file usbd_core.h.

Referenced by usbd_eptn_handler(), and usbd_set_address().

◆ ept0_sts

uint8_t usbd_core_type::ept0_sts

usb control endpoint 0 state

Definition at line 126 of file usbd_core.h.

Referenced by usbd_core_in_handler(), usbd_core_out_handler(), usbd_core_setup_handler(), usbd_ctrl_recv(), usbd_ctrl_recv_status(), usbd_ctrl_send(), and usbd_ctrl_send_status().

◆ ept0_wlength

uint16_t usbd_core_type::ept0_wlength

usb endpoint 0 transfer length

Definition at line 128 of file usbd_core.h.

Referenced by usbd_core_in_handler(), and usbd_core_setup_handler().

◆ ept_in

usb_ept_info usbd_core_type::ept_in[USB_EPT_MAX_NUM]

usb in endpoint infomation struct

Definition at line 120 of file usbd_core.h.

Referenced by usbd_clear_stall(), usbd_core_in_handler(), usbd_ctrl_send(), usbd_endpoint_request(), usbd_ept_buf_custom_define(), usbd_ept_close(), usbd_ept_dbuffer_enable(), usbd_ept_defaut_init(), usbd_ept_open(), usbd_ept_send(), usbd_eptn_handler(), and usbd_set_stall().

◆ ept_out

usb_ept_info usbd_core_type::ept_out[USB_EPT_MAX_NUM]

usb out endpoint infomation struct

Definition at line 121 of file usbd_core.h.

Referenced by usbd_clear_stall(), usbd_core_out_handler(), usbd_ctrl_recv(), usbd_endpoint_request(), usbd_ept_buf_custom_define(), usbd_ept_close(), usbd_ept_dbuffer_enable(), usbd_ept_defaut_init(), usbd_ept_open(), usbd_ept_recv(), usbd_eptn_handler(), usbd_get_recv_len(), and usbd_set_stall().

◆ old_conn_state

usbd_conn_state usbd_core_type::old_conn_state

usb save the previous connect state

Definition at line 131 of file usbd_core.h.

Referenced by usbd_remote_wakeup(), usbd_suspend_handler(), and usbd_wakeup_handler().

◆ remote_wakup

uint8_t usbd_core_type::remote_wakup

remote wakeup state

Definition at line 134 of file usbd_core.h.

Referenced by main(), usbd_clear_feature(), usbd_get_status(), and usbd_set_feature().

◆ setup

usb_setup_type usbd_core_type::setup

usb setup type struct

Definition at line 123 of file usbd_core.h.

Referenced by class_ept0_rx_handler(), usbd_clear_feature(), usbd_core_setup_handler(), usbd_device_request(), usbd_endpoint_request(), usbd_get_configuration(), usbd_get_descriptor(), usbd_interface_request(), usbd_set_address(), usbd_set_configuration(), and usbd_set_feature().

◆ setup_buffer

uint8_t usbd_core_type::setup_buffer[12]

usb setup request buffer

Definition at line 124 of file usbd_core.h.

Referenced by usbd_core_setup_handler(), and usbd_eptn_handler().

◆ speed

uint8_t usbd_core_type::speed

usb speed

Definition at line 127 of file usbd_core.h.

◆ usb_reg

usb_reg_type* usbd_core_type::usb_reg

usb register pointer

Definition at line 115 of file usbd_core.h.

Referenced by usbd_connect(), usbd_core_init(), usbd_disconnect(), usbd_enter_suspend(), usbd_ept_close(), usbd_ept_loop_handler(), usbd_ept_open(), usbd_ept_send(), usbd_eptn_handler(), usbd_irq_handler(), usbd_remote_wakeup(), usbd_reset_handler(), usbd_set_device_addr(), and usbd_wakeup_handler().

The documentation for this struct was generated from the following file:
  • usbd_core.h


AT32F413 Firmwary Library: USBD_core_exported_functions

Functions
USBD_core_exported_functions
AT32F413_middlewares_usbd_drivers » USBD_drivers_core

Functions

void | usbd_core_in_handler (usbd_core_type *udev, uint8_t ept_num)
usb core in transfer complete handler
void | usbd_core_out_handler (usbd_core_type *udev, uint8_t ept_num)
usb core out transfer complete handler
void | usbd_core_setup_handler (usbd_core_type *udev, uint8_t ept_num)
usb core setup transfer complete handler
void | usbd_ctrl_unsupport (usbd_core_type *udev)
un-support device request
void | usbd_ctrl_send (usbd_core_type *udev, uint8_t *buffer, uint16_t len)
usb control endpoint send data
void | usbd_ctrl_recv (usbd_core_type *udev, uint8_t *buffer, uint16_t len)
usb control endpoint receive data
void | usbd_ctrl_send_status (usbd_core_type *udev)
usb control endpoint send in status
void | usbd_ctrl_recv_status (usbd_core_type *udev)
usb control endpoint send out status
void | usbd_set_stall (usbd_core_type *udev, uint8_t ept_addr)
usb set endpoint to stall.
void | usbd_clear_stall (usbd_core_type *udev, uint8_t ept_addr)
clear endpoint stall
void | usbd_ept_open (usbd_core_type *udev, uint8_t ept_addr, uint8_t ept_type, uint16_t maxpacket)
usb open endpoint
void | usbd_ept_close (usbd_core_type *udev, uint8_t ept_addr)
usb close endpoint
void | usbd_ept_send (usbd_core_type *udev, uint8_t ept_num, uint8_t *buffer, uint16_t len)
usb endpoint send data
void | usbd_ept_recv (usbd_core_type *udev, uint8_t ept_num, uint8_t *buffer, uint16_t len)
usb endpoint receive data
void | usbd_connect (usbd_core_type *udev)
usb device connect to host
void | usbd_disconnect (usbd_core_type *udev)
usb device disconnect to host
void | usbd_set_device_addr (usbd_core_type *udev, uint8_t address)
usb device set device address.
uint32_t | usbd_get_recv_len (usbd_core_type *udev, uint8_t ept_addr)
usb endpoint get receive data length
usbd_conn_state | usbd_connect_state_get (usbd_core_type *udev)
get usb connect state
void | usbd_ept_dbuffer_enable (usbd_core_type *udev, uint8_t ept_addr)
enable endpoint double buffer.
void | usbd_ept_buf_auto_define (usb_ept_info *ept_info)
usb auto define endpoint buffer
void | usbd_ept_buf_custom_define (usbd_core_type *udev, uint8_t ept_addr, uint32_t addr)
usb custom define endpoint buffer
void | usbd_ept_defaut_init (usbd_core_type *udev)
usb endpoint structure initialization
void | usbd_remote_wakeup (usbd_core_type *udev)
usb device remote wakeup
void | usbd_enter_suspend (usbd_core_type *udev)
usb device enter suspend mode
void | usbd_core_init (usbd_core_type *udev, usb_reg_type *usb_reg, usbd_class_handler *dev_handler, usbd_desc_handler *desc_handler, uint8_t core_id)
initializes the usb core

Detailed Description

Function Documentation

◆ usbd_clear_stall()

void usbd_clear_stall | ( | usbd_core_type * | udev,
 |  | uint8_t | ept_addr )

clear endpoint stall

Parameters
udev | to the structure of usbd_core_type
ept_addr | endpoint number
Return values
none

Definition at line 235 of file usbd_core.c.

Referenced by usbd_endpoint_request().

◆ usbd_connect()

void usbd_connect ( usbd_core_type * udev )

usb device connect to host

Parameters
udev to the structure of usbd_core_type
Return values
none

Definition at line 564 of file usbd_core.c.

Referenced by main(), and usb_reset().

◆ usbd_connect_state_get()

usbd_conn_state usbd_connect_state_get ( usbd_core_type * udev )

get usb connect state

Parameters
udev to the structure of usbd_core_type
Return values
usb connect state

Definition at line 595 of file usbd_core.c.

Referenced by audio_hid_class_send_report(), custom_hid_class_send_report(), main(), usb_iap_class_send_report(), usb_keyboard_class_send_report(), usb_mouse_class_send_report(), and usb_vcpkybrd_class_send_report().

◆ usbd_core_in_handler()

void usbd_core_in_handler | ( | usbd_core_type * | udev,
 |  | uint8_t | ept_addr )

usb core in transfer complete handler

Parameters
udev | to the structure of usbd_core_type
ept_addr | endpoint number
Return values
none

Definition at line 47 of file usbd_core.c.

Referenced by usbd_eptn_handler().

◆ usbd_core_init()

void usbd_core_init | ( | usbd_core_type * | udev,
 |  | usb_reg_type * | usb_reg,
 |  | usbd_class_handler * | class_handler,
 |  | usbd_desc_handler * | desc_handler,
 |  | uint8_t | core_id )

initializes the usb core

Parameters
udev | to the structure of usbd_core_type
usb_reg | usb register pointer (USB)
class_handler | usb class handler
desc_handler | device config handler
core_id | usb core id number
Return values
none

Definition at line 675 of file usbd_core.c.

Referenced by main().

◆ usbd_core_out_handler()

void usbd_core_out_handler | ( | usbd_core_type * | udev,
 |  | uint8_t | ept_addr )

usb core out transfer complete handler

Parameters
udev | to the structure of usbd_core_type
ept_addr | endpoint number
Return values
none

Definition at line 99 of file usbd_core.c.

Referenced by usbd_eptn_handler().

◆ usbd_core_setup_handler()

void usbd_core_setup_handler | ( | usbd_core_type * | udev,
 |  | uint8_t | ept_num )

usb core setup transfer complete handler

Parameters
udev | to the structure of usbd_core_type
ept_addr | endpoint number
Return values
none

Definition at line 139 of file usbd_core.c.

Referenced by usbd_eptn_handler().

◆ usbd_ctrl_recv()

void usbd_ctrl_recv | ( | usbd_core_type * | udev,
 |  | uint8_t * | buffer,
 |  | uint16_t | len )

usb control endpoint receive data

Parameters
udev | to the structure of usbd_core_type
ept_addr | endpoint number
buffer | recv data buffer
len | recv data length
Return values
none

Definition at line 194 of file usbd_core.c.

Referenced by audio_req_set_cur(), audio_req_set_cur(), cdc_class_setup_handler(), cdc_class_setup_handler(), class_hid_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), and keyboard_class_setup_handler().

◆ usbd_ctrl_recv_status()

void usbd_ctrl_recv_status ( usbd_core_type * udev )

usb control endpoint send out status

Parameters
udev usb device core handler type
Return values
none

Definition at line 222 of file usbd_core.c.

Referenced by usbd_core_in_handler().

◆ usbd_ctrl_send()

void usbd_ctrl_send | ( | usbd_core_type * | udev,
 |  | uint8_t * | buffer,
 |  | uint16_t | len )

usb control endpoint send data

Parameters
udev | to the structure of usbd_core_type
ept_addr | endpoint number
buffer | send data buffer
len | send data length
Return values
none

Definition at line 175 of file usbd_core.c.

Referenced by audio_get_interface(), audio_get_interface(), audio_req_get_cur(), audio_req_get_cur(), audio_req_get_max(), audio_req_get_max(), audio_req_get_min(), audio_req_get_min(), audio_req_get_res(), audio_req_get_res(), cdc_class_setup_handler(), cdc_class_setup_handler(), class_audio_setup_handler(), class_hid_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), keyboard_class_setup_handler(), msc_class_setup_handler(), usbd_endpoint_request(), usbd_get_configuration(), usbd_get_descriptor(), and usbd_get_status().

◆ usbd_ctrl_send_status()

void usbd_ctrl_send_status ( usbd_core_type * udev )

usb control endpoint send in status

Parameters
udev to the structure of usbd_core_type
Return values
none

Definition at line 210 of file usbd_core.c.

Referenced by class_audio_setup_handler(), class_setup_handler(), class_setup_handler(), msc_class_setup_handler(), usbd_clear_feature(), usbd_core_out_handler(), usbd_endpoint_request(), usbd_interface_request(), usbd_set_address(), usbd_set_configuration(), and usbd_set_feature().

◆ usbd_ctrl_unsupport()

void usbd_ctrl_unsupport ( usbd_core_type * udev )

un-support device request

Parameters
udev usb device core handler type
Return values
none

Definition at line 289 of file usbd_core.c.

Referenced by audio_get_interface(), audio_get_interface(), audio_req_get_cur(), audio_req_get_cur(), audio_req_get_max(), audio_req_get_max(), audio_req_get_min(), audio_req_get_min(), audio_req_get_res(), audio_req_get_res(), audio_req_set_cur(), audio_req_set_cur(), cdc_class_setup_handler(), cdc_class_setup_handler(), class_audio_setup_handler(), class_hid_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), keyboard_class_setup_handler(), msc_class_setup_handler(), usbd_clear_feature(), usbd_device_request(), usbd_endpoint_request(), usbd_get_configuration(), usbd_get_descriptor(), usbd_get_status(), usbd_interface_request(), usbd_set_address(), usbd_set_configuration(), and usbd_set_feature().

◆ usbd_disconnect()

void usbd_disconnect ( usbd_core_type * udev )

usb device disconnect to host

Parameters
udev to the structure of usbd_core_type
Return values
none

Definition at line 574 of file usbd_core.c.

Referenced by usb_reset().

◆ usbd_enter_suspend()

void usbd_enter_suspend ( usbd_core_type * udev )

usb device enter suspend mode

Parameters
udev to the structure of usbd_core_type
Return values
none

Definition at line 625 of file usbd_core.c.

Referenced by usbd_suspend_handler().

◆ usbd_ept_buf_auto_define()

void usbd_ept_buf_auto_define ( usb_ept_info * ept_info )

usb auto define endpoint buffer

Parameters
usb_ept_info endpoint information
Return values
none

Definition at line 430 of file usbd_core.c.

Referenced by usbd_ept_open().

◆ usbd_ept_buf_custom_define()

void usbd_ept_buf_custom_define | ( | usbd_core_type * | udev,
 |  | uint8_t | ept_addr,
 |  | uint32_t | addr )

usb custom define endpoint buffer

Parameters
udev | to the structure of usbd_core_type
ept_addr | endpoint number
addr | usb fifo offset address
Return values
none

Definition at line 464 of file usbd_core.c.

Referenced by class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), and usbd_reset_handler().

◆ usbd_ept_close()

void usbd_ept_close | ( | usbd_core_type * | udev,
 |  | uint8_t | ept_addr )

usb close endpoint

Parameters
udev | to the structure of usbd_core_type
ept_addr | endpoint number
Return values
none

Definition at line 541 of file usbd_core.c.

Referenced by class_clear_handler(), class_clear_handler(), class_clear_handler(), class_clear_handler(), class_clear_handler(), class_clear_handler(), class_clear_handler(), class_clear_handler(), class_clear_handler(), class_clear_handler(), class_clear_handler(), class_clear_handler(), class_setup_handler(), and msc_class_setup_handler().

◆ usbd_ept_dbuffer_enable()

void usbd_ept_dbuffer_enable | ( | usbd_core_type * | udev,
 |  | uint8_t | ept_addr )

enable endpoint double buffer.

Parameters
udev | to the structure of usbd_core_type
ept_addr | endpoint number
Return values
none

Definition at line 409 of file usbd_core.c.

Referenced by class_init_handler(), and class_init_handler().

◆ usbd_ept_defaut_init()

void usbd_ept_defaut_init ( usbd_core_type * udev )

usb endpoint structure initialization

Parameters
udev to the structure of usbd_core_type
Return values
none

Definition at line 635 of file usbd_core.c.

Referenced by usbd_core_init(), and usbd_reset_handler().

◆ usbd_ept_open()

void usbd_ept_open | ( | usbd_core_type * | udev,
 |  | uint8_t | ept_addr,
 |  | uint8_t | ept_type,
 |  | uint16_t | maxpacket )

usb open endpoint

Parameters
udev | to the structure of usbd_core_type
ept_addr | endpoint number
ept_type | endpoint type
maxpacket | endpoint support max buffer size
Return values
none

Definition at line 506 of file usbd_core.c.

Referenced by class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_setup_handler(), msc_class_setup_handler(), and usbd_reset_handler().

◆ usbd_ept_recv()

void usbd_ept_recv | ( | usbd_core_type * | udev,
 |  | uint8_t | ept_addr,
 |  | uint8_t * | buffer,
 |  | uint16_t | len )

usb endpoint receive data

Parameters
udev | to the structure of usbd_core_type
ept_addr | endpoint number
buffer | receive data buffer
len | receive data length
Return values
none

Definition at line 364 of file usbd_core.c.

Referenced by audio_set_interface(), audio_set_interface(), bot_scsi_init(), bot_scsi_reset(), bot_scsi_send_csw(), bot_scsi_stall(), bot_scsi_write10(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_out_handler(), class_out_handler(), class_out_handler(), class_out_handler(), usb_printer_get_rxdata(), usb_vcp_get_rxdata(), usb_vcpkybrd_vcp_get_rxdata(), usb_winusb_get_rxdata(), usbd_core_in_handler(), usbd_core_out_handler(), usbd_ctrl_recv(), usbd_ctrl_recv_status(), and usbd_eptn_handler().

◆ usbd_ept_send()

void usbd_ept_send | ( | usbd_core_type * | udev,
 |  | uint8_t | ept_addr,
 |  | uint8_t * | buffer,
 |  | uint16_t | len )

usb endpoint send data

Parameters
udev | to the structure of usbd_core_type
ept_addr | endpoint number
buffer | send data buffer
len | send data length
Return values
none

Definition at line 304 of file usbd_core.c.

Referenced by audio_hid_class_send_report(), audio_set_interface(), audio_set_interface(), bot_scsi_read10(), bot_scsi_send_csw(), bot_scsi_send_data(), class_in_handler(), class_in_handler(), custom_hid_class_send_report(), usb_hid_buf_process(), usb_iap_class_send_report(), usb_keyboard_class_send_report(), usb_mouse_class_send_report(), usb_printer_send_data(), usb_vcp_send_data(), usb_vcpkybrd_class_send_report(), usb_vcpkybrd_vcp_send_data(), usb_winusb_send_data(), usbd_core_in_handler(), usbd_ctrl_send(), usbd_ctrl_send_status(), and usbd_eptn_handler().

◆ usbd_get_recv_len()

uint32_t usbd_get_recv_len | ( | usbd_core_type * | udev,
 |  | uint8_t | ept_addr )

usb endpoint get receive data length

Parameters
udev | to the structure of usbd_core_type
ept_addr | endpoint number
Return values
none

Definition at line 397 of file usbd_core.c.

Referenced by bot_cbw_decode(), class_ept0_rx_handler(), class_ept0_rx_handler(), class_ept0_rx_handler(), class_ept0_rx_handler(), class_ept0_rx_handler(), class_ept0_rx_handler(), class_ept0_rx_handler(), class_ept0_rx_handler(), class_ept0_rx_handler(), class_ept0_rx_handler(), class_out_handler(), class_out_handler(), class_out_handler(), class_out_handler(), class_out_handler(), class_out_handler(), class_out_handler(), class_out_handler(), and class_out_handler().

◆ usbd_remote_wakeup()

void usbd_remote_wakeup ( usbd_core_type * udev )

usb device remote wakeup

Parameters
udev to the structure of usbd_core_type
Return values
none

Definition at line 605 of file usbd_core.c.

Referenced by main().

◆ usbd_set_device_addr()

void usbd_set_device_addr | ( | usbd_core_type * | udev,
 |  | uint8_t | address )

usb device set device address.

Parameters
udev | to the structure of usbd_core_type
address | host assignment address
Return values
none

Definition at line 585 of file usbd_core.c.

◆ usbd_set_stall()

void usbd_set_stall | ( | usbd_core_type * | udev,
 |  | uint8_t | ept_addr )

usb set endpoint to stall.

Parameters
udev | to the structure of usbd_core_type
ept_addr | endpoint number
Return values
none

Definition at line 264 of file usbd_core.c.

Referenced by bot_scsi_clear_feature(), bot_scsi_stall(), usbd_ctrl_unsupport(), and usbd_endpoint_request().


AT32F413 Firmwary Library: USBD_core_private_functions

Functions
USBD_core_private_functions
AT32F413_middlewares_usbd_drivers » USBD_drivers_core

Functions

void | usbd_core_in_handler (usbd_core_type *udev, uint8_t ept_addr)
usb core in transfer complete handler
void | usbd_core_out_handler (usbd_core_type *udev, uint8_t ept_addr)
usb core out transfer complete handler
void | usbd_core_setup_handler (usbd_core_type *udev, uint8_t ept_num)
usb core setup transfer complete handler
void | usbd_ctrl_send (usbd_core_type *udev, uint8_t *buffer, uint16_t len)
usb control endpoint send data
void | usbd_ctrl_recv (usbd_core_type *udev, uint8_t *buffer, uint16_t len)
usb control endpoint receive data
void | usbd_ctrl_send_status (usbd_core_type *udev)
usb control endpoint send in status
void | usbd_ctrl_recv_status (usbd_core_type *udev)
usb control endpoint send out status
void | usbd_clear_stall (usbd_core_type *udev, uint8_t ept_addr)
clear endpoint stall
void | usbd_set_stall (usbd_core_type *udev, uint8_t ept_addr)
usb set endpoint to stall.
void | usbd_ctrl_unsupport (usbd_core_type *udev)
un-support device request
void | usbd_ept_send (usbd_core_type *udev, uint8_t ept_addr, uint8_t *buffer, uint16_t len)
usb endpoint send data
void | usbd_ept_recv (usbd_core_type *udev, uint8_t ept_addr, uint8_t *buffer, uint16_t len)
usb endpoint receive data
uint32_t | usbd_get_recv_len (usbd_core_type *udev, uint8_t ept_addr)
usb endpoint get receive data length
void | usbd_ept_dbuffer_enable (usbd_core_type *udev, uint8_t ept_addr)
enable endpoint double buffer.
void | usbd_ept_buf_auto_define (usb_ept_info *ept_info)
usb auto define endpoint buffer
void | usbd_ept_buf_custom_define (usbd_core_type *udev, uint8_t ept_addr, uint32_t addr)
usb custom define endpoint buffer
void | usbd_ept_open (usbd_core_type *udev, uint8_t ept_addr, uint8_t ept_type, uint16_t maxpacket)
usb open endpoint
void | usbd_ept_close (usbd_core_type *udev, uint8_t ept_addr)
usb close endpoint
void | usbd_connect (usbd_core_type *udev)
usb device connect to host
void | usbd_disconnect (usbd_core_type *udev)
usb device disconnect to host
void | usbd_set_device_addr (usbd_core_type *udev, uint8_t address)
usb device set device address.
usbd_conn_state | usbd_connect_state_get (usbd_core_type *udev)
get usb connect state
void | usbd_remote_wakeup (usbd_core_type *udev)
usb device remote wakeup
void | usbd_enter_suspend (usbd_core_type *udev)
usb device enter suspend mode
void | usbd_ept_defaut_init (usbd_core_type *udev)
usb endpoint structure initialization
void | usbd_core_init (usbd_core_type *udev, usb_reg_type *usb_reg, usbd_class_handler *class_handler, usbd_desc_handler *desc_handler, uint8_t core_id)
initializes the usb core

Detailed Description

Function Documentation

◆ usbd_clear_stall()

void usbd_clear_stall | ( | usbd_core_type * | udev,
 |  | uint8_t | ept_addr )

clear endpoint stall

Parameters
udev | to the structure of usbd_core_type
ept_addr | endpoint number
Return values
none

Definition at line 235 of file usbd_core.c.

Referenced by usbd_endpoint_request().

◆ usbd_connect()

void usbd_connect ( usbd_core_type * udev )

usb device connect to host

Parameters
udev to the structure of usbd_core_type
Return values
none

Definition at line 564 of file usbd_core.c.

Referenced by main(), and usb_reset().

◆ usbd_connect_state_get()

usbd_conn_state usbd_connect_state_get ( usbd_core_type * udev )

get usb connect state

Parameters
udev to the structure of usbd_core_type
Return values
usb connect state

Definition at line 595 of file usbd_core.c.

Referenced by audio_hid_class_send_report(), custom_hid_class_send_report(), main(), usb_iap_class_send_report(), usb_keyboard_class_send_report(), usb_mouse_class_send_report(), and usb_vcpkybrd_class_send_report().

◆ usbd_core_in_handler()

void usbd_core_in_handler | ( | usbd_core_type * | udev,
 |  | uint8_t | ept_addr )

usb core in transfer complete handler

Parameters
udev | to the structure of usbd_core_type
ept_addr | endpoint number
Return values
none

Definition at line 47 of file usbd_core.c.

Referenced by usbd_eptn_handler().

◆ usbd_core_init()

void usbd_core_init | ( | usbd_core_type * | udev,
 |  | usb_reg_type * | usb_reg,
 |  | usbd_class_handler * | class_handler,
 |  | usbd_desc_handler * | desc_handler,
 |  | uint8_t | core_id )

initializes the usb core

Parameters
udev | to the structure of usbd_core_type
usb_reg | usb register pointer (USB)
class_handler | usb class handler
desc_handler | device config handler
core_id | usb core id number
Return values
none

Definition at line 675 of file usbd_core.c.

Referenced by main().

◆ usbd_core_out_handler()

void usbd_core_out_handler | ( | usbd_core_type * | udev,
 |  | uint8_t | ept_addr )

usb core out transfer complete handler

Parameters
udev | to the structure of usbd_core_type
ept_addr | endpoint number
Return values
none

Definition at line 99 of file usbd_core.c.

Referenced by usbd_eptn_handler().

◆ usbd_core_setup_handler()

void usbd_core_setup_handler | ( | usbd_core_type * | udev,
 |  | uint8_t | ept_num )

usb core setup transfer complete handler

Parameters
udev | to the structure of usbd_core_type
ept_addr | endpoint number
Return values
none

Definition at line 139 of file usbd_core.c.

Referenced by usbd_eptn_handler().

◆ usbd_ctrl_recv()

void usbd_ctrl_recv | ( | usbd_core_type * | udev,
 |  | uint8_t * | buffer,
 |  | uint16_t | len )

usb control endpoint receive data

Parameters
udev | to the structure of usbd_core_type
ept_addr | endpoint number
buffer | recv data buffer
len | recv data length
Return values
none

Definition at line 194 of file usbd_core.c.

Referenced by audio_req_set_cur(), audio_req_set_cur(), cdc_class_setup_handler(), cdc_class_setup_handler(), class_hid_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), and keyboard_class_setup_handler().

◆ usbd_ctrl_recv_status()

void usbd_ctrl_recv_status ( usbd_core_type * udev )

usb control endpoint send out status

Parameters
udev usb device core handler type
Return values
none

Definition at line 222 of file usbd_core.c.

Referenced by usbd_core_in_handler().

◆ usbd_ctrl_send()

void usbd_ctrl_send | ( | usbd_core_type * | udev,
 |  | uint8_t * | buffer,
 |  | uint16_t | len )

usb control endpoint send data

Parameters
udev | to the structure of usbd_core_type
ept_addr | endpoint number
buffer | send data buffer
len | send data length
Return values
none

Definition at line 175 of file usbd_core.c.

Referenced by audio_get_interface(), audio_get_interface(), audio_req_get_cur(), audio_req_get_cur(), audio_req_get_max(), audio_req_get_max(), audio_req_get_min(), audio_req_get_min(), audio_req_get_res(), audio_req_get_res(), cdc_class_setup_handler(), cdc_class_setup_handler(), class_audio_setup_handler(), class_hid_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), keyboard_class_setup_handler(), msc_class_setup_handler(), usbd_endpoint_request(), usbd_get_configuration(), usbd_get_descriptor(), and usbd_get_status().

◆ usbd_ctrl_send_status()

void usbd_ctrl_send_status ( usbd_core_type * udev )

usb control endpoint send in status

Parameters
udev to the structure of usbd_core_type
Return values
none

Definition at line 210 of file usbd_core.c.

Referenced by class_audio_setup_handler(), class_setup_handler(), class_setup_handler(), msc_class_setup_handler(), usbd_clear_feature(), usbd_core_out_handler(), usbd_endpoint_request(), usbd_interface_request(), usbd_set_address(), usbd_set_configuration(), and usbd_set_feature().

◆ usbd_ctrl_unsupport()

void usbd_ctrl_unsupport ( usbd_core_type * udev )

un-support device request

Parameters
udev usb device core handler type
Return values
none

Definition at line 289 of file usbd_core.c.

Referenced by audio_get_interface(), audio_get_interface(), audio_req_get_cur(), audio_req_get_cur(), audio_req_get_max(), audio_req_get_max(), audio_req_get_min(), audio_req_get_min(), audio_req_get_res(), audio_req_get_res(), audio_req_set_cur(), audio_req_set_cur(), cdc_class_setup_handler(), cdc_class_setup_handler(), class_audio_setup_handler(), class_hid_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), keyboard_class_setup_handler(), msc_class_setup_handler(), usbd_clear_feature(), usbd_device_request(), usbd_endpoint_request(), usbd_get_configuration(), usbd_get_descriptor(), usbd_get_status(), usbd_interface_request(), usbd_set_address(), usbd_set_configuration(), and usbd_set_feature().

◆ usbd_disconnect()

void usbd_disconnect ( usbd_core_type * udev )

usb device disconnect to host

Parameters
udev to the structure of usbd_core_type
Return values
none

Definition at line 574 of file usbd_core.c.

Referenced by usb_reset().

◆ usbd_enter_suspend()

void usbd_enter_suspend ( usbd_core_type * udev )

usb device enter suspend mode

Parameters
udev to the structure of usbd_core_type
Return values
none

Definition at line 625 of file usbd_core.c.

Referenced by usbd_suspend_handler().

◆ usbd_ept_buf_auto_define()

void usbd_ept_buf_auto_define ( usb_ept_info * ept_info )

usb auto define endpoint buffer

Parameters
usb_ept_info endpoint information
Return values
none

Definition at line 430 of file usbd_core.c.

Referenced by usbd_ept_open().

◆ usbd_ept_buf_custom_define()

void usbd_ept_buf_custom_define | ( | usbd_core_type * | udev,
 |  | uint8_t | ept_addr,
 |  | uint32_t | addr )

usb custom define endpoint buffer

Parameters
udev | to the structure of usbd_core_type
ept_addr | endpoint number
addr | usb fifo offset address
Return values
none

Definition at line 464 of file usbd_core.c.

Referenced by class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), and usbd_reset_handler().

◆ usbd_ept_close()

void usbd_ept_close | ( | usbd_core_type * | udev,
 |  | uint8_t | ept_addr )

usb close endpoint

Parameters
udev | to the structure of usbd_core_type
ept_addr | endpoint number
Return values
none

Definition at line 541 of file usbd_core.c.

Referenced by class_clear_handler(), class_clear_handler(), class_clear_handler(), class_clear_handler(), class_clear_handler(), class_clear_handler(), class_clear_handler(), class_clear_handler(), class_clear_handler(), class_clear_handler(), class_clear_handler(), class_clear_handler(), class_setup_handler(), and msc_class_setup_handler().

◆ usbd_ept_dbuffer_enable()

void usbd_ept_dbuffer_enable | ( | usbd_core_type * | udev,
 |  | uint8_t | ept_addr )

enable endpoint double buffer.

Parameters
udev | to the structure of usbd_core_type
ept_addr | endpoint number
Return values
none

Definition at line 409 of file usbd_core.c.

Referenced by class_init_handler(), and class_init_handler().

◆ usbd_ept_defaut_init()

void usbd_ept_defaut_init ( usbd_core_type * udev )

usb endpoint structure initialization

Parameters
udev to the structure of usbd_core_type
Return values
none

Definition at line 635 of file usbd_core.c.

Referenced by usbd_core_init(), and usbd_reset_handler().

◆ usbd_ept_open()

void usbd_ept_open | ( | usbd_core_type * | udev,
 |  | uint8_t | ept_addr,
 |  | uint8_t | ept_type,
 |  | uint16_t | maxpacket )

usb open endpoint

Parameters
udev | to the structure of usbd_core_type
ept_addr | endpoint number
ept_type | endpoint type
maxpacket | endpoint support max buffer size
Return values
none

Definition at line 506 of file usbd_core.c.

Referenced by class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_setup_handler(), msc_class_setup_handler(), and usbd_reset_handler().

◆ usbd_ept_recv()

void usbd_ept_recv | ( | usbd_core_type * | udev,
 |  | uint8_t | ept_addr,
 |  | uint8_t * | buffer,
 |  | uint16_t | len )

usb endpoint receive data

Parameters
udev | to the structure of usbd_core_type
ept_addr | endpoint number
buffer | receive data buffer
len | receive data length
Return values
none

Definition at line 364 of file usbd_core.c.

Referenced by audio_set_interface(), audio_set_interface(), bot_scsi_init(), bot_scsi_reset(), bot_scsi_send_csw(), bot_scsi_stall(), bot_scsi_write10(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_init_handler(), class_out_handler(), class_out_handler(), class_out_handler(), class_out_handler(), usb_printer_get_rxdata(), usb_vcp_get_rxdata(), usb_vcpkybrd_vcp_get_rxdata(), usb_winusb_get_rxdata(), usbd_core_in_handler(), usbd_core_out_handler(), usbd_ctrl_recv(), usbd_ctrl_recv_status(), and usbd_eptn_handler().

◆ usbd_ept_send()

void usbd_ept_send | ( | usbd_core_type * | udev,
 |  | uint8_t | ept_addr,
 |  | uint8_t * | buffer,
 |  | uint16_t | len )

usb endpoint send data

Parameters
udev | to the structure of usbd_core_type
ept_addr | endpoint number
buffer | send data buffer
len | send data length
Return values
none

Definition at line 304 of file usbd_core.c.

Referenced by audio_hid_class_send_report(), audio_set_interface(), audio_set_interface(), bot_scsi_read10(), bot_scsi_send_csw(), bot_scsi_send_data(), class_in_handler(), class_in_handler(), custom_hid_class_send_report(), usb_hid_buf_process(), usb_iap_class_send_report(), usb_keyboard_class_send_report(), usb_mouse_class_send_report(), usb_printer_send_data(), usb_vcp_send_data(), usb_vcpkybrd_class_send_report(), usb_vcpkybrd_vcp_send_data(), usb_winusb_send_data(), usbd_core_in_handler(), usbd_ctrl_send(), usbd_ctrl_send_status(), and usbd_eptn_handler().

◆ usbd_get_recv_len()

uint32_t usbd_get_recv_len | ( | usbd_core_type * | udev,
 |  | uint8_t | ept_addr )

usb endpoint get receive data length

Parameters
udev | to the structure of usbd_core_type
ept_addr | endpoint number
Return values
none

Definition at line 397 of file usbd_core.c.

Referenced by bot_cbw_decode(), class_ept0_rx_handler(), class_ept0_rx_handler(), class_ept0_rx_handler(), class_ept0_rx_handler(), class_ept0_rx_handler(), class_ept0_rx_handler(), class_ept0_rx_handler(), class_ept0_rx_handler(), class_ept0_rx_handler(), class_ept0_rx_handler(), class_out_handler(), class_out_handler(), class_out_handler(), class_out_handler(), class_out_handler(), class_out_handler(), class_out_handler(), class_out_handler(), and class_out_handler().

◆ usbd_remote_wakeup()

void usbd_remote_wakeup ( usbd_core_type * udev )

usb device remote wakeup

Parameters
udev to the structure of usbd_core_type
Return values
none

Definition at line 605 of file usbd_core.c.

Referenced by main().

◆ usbd_set_device_addr()

void usbd_set_device_addr | ( | usbd_core_type * | udev,
 |  | uint8_t | address )

usb device set device address.

Parameters
udev | to the structure of usbd_core_type
address | host assignment address
Return values
none

Definition at line 585 of file usbd_core.c.

◆ usbd_set_stall()

void usbd_set_stall | ( | usbd_core_type * | udev,
 |  | uint8_t | ept_addr )

usb set endpoint to stall.

Parameters
udev | to the structure of usbd_core_type
ept_addr | endpoint number
Return values
none

Definition at line 264 of file usbd_core.c.

Referenced by bot_scsi_clear_feature(), bot_scsi_stall(), usbd_ctrl_unsupport(), and usbd_endpoint_request().


AT32F413 Firmwary Library: USBD_drivers_interrupt

Topics
USBD_drivers_interrupt
AT32F413_middlewares_usbd_drivers

usb device interrupt More...

Topics

USBD_int_exported_functions
USBD_int_private_functions

Detailed Description

usb device interrupt


AT32F413 Firmwary Library: USBD_int_exported_functions

Functions
USBD_int_exported_functions
AT32F413_middlewares_usbd_drivers » USBD_drivers_interrupt

Functions

void | usbd_irq_handler (usbd_core_type *udev)
usb device interrput request handler.
void | usbd_ept_loop_handler (usbd_core_type *udev)
usb device endpoint loop handler.
void | usbd_eptn_handler (usbd_core_type *udev, usb_ept_number_type ept_num)
usb device endpoint request handler.
void | usbd_reset_handler (usbd_core_type *udev)
usb device reset interrupt request handler.
void | usbd_sof_handler (usbd_core_type *udev)
usb device sof interrupt request handler.
void | usbd_suspend_handler (usbd_core_type *udev)
usb device suspend interrupt request handler.
void | usbd_wakeup_handler (usbd_core_type *udev)
usb device wakup interrupt request handler.

Detailed Description

Function Documentation

◆ usbd_ept_loop_handler()

void usbd_ept_loop_handler ( usbd_core_type * udev )

usb device endpoint loop handler.

Parameters
udev to the structure of usbd_core_type
Return values
none

Definition at line 223 of file usbd_int.c.

Referenced by usbd_irq_handler().

◆ usbd_eptn_handler()

void usbd_eptn_handler | ( | usbd_core_type * | udev,
 |  | usb_ept_number_type | ept_num )

usb device endpoint request handler.

Parameters
udev | to the structure of usbd_core_type
ept_num | endpoint number
Return values
none

Definition at line 110 of file usbd_int.c.

Referenced by usbd_ept_loop_handler().

◆ usbd_irq_handler()

void usbd_irq_handler ( usbd_core_type * udev )

usb device interrput request handler.

Parameters
udev to the structure of usbd_core_type
Return values
none

Definition at line 45 of file usbd_int.c.

Referenced by USBFS_L_CAN1_RX0_IRQHandler().

◆ usbd_reset_handler()

void usbd_reset_handler ( usbd_core_type * udev )

usb device reset interrupt request handler.

Parameters
udev to the structure of usbd_core_type
Return values
none

Definition at line 243 of file usbd_int.c.

Referenced by usbd_irq_handler().

◆ usbd_sof_handler()

void usbd_sof_handler ( usbd_core_type * udev )

usb device sof interrupt request handler.

Parameters
udev to the structure of usbd_core_type
Return values
none

Definition at line 276 of file usbd_int.c.

Referenced by usbd_irq_handler().

◆ usbd_suspend_handler()

void usbd_suspend_handler ( usbd_core_type * udev )

usb device suspend interrupt request handler.

Parameters
udev to the structure of usbd_core_type
Return values
none

Definition at line 288 of file usbd_int.c.

Referenced by usbd_irq_handler().

◆ usbd_wakeup_handler()

void usbd_wakeup_handler ( usbd_core_type * udev )

usb device wakup interrupt request handler.

Parameters
udev to the structure of usbd_core_type
Return values
none

Definition at line 309 of file usbd_int.c.

Referenced by usbd_irq_handler().


AT32F413 Firmwary Library: USBD_int_private_functions

Functions
USBD_int_private_functions
AT32F413_middlewares_usbd_drivers » USBD_drivers_interrupt

Functions

void | usbd_irq_handler (usbd_core_type *udev)
usb device interrput request handler.
void | usbd_eptn_handler (usbd_core_type *udev, usb_ept_number_type ept_num)
usb device endpoint request handler.
void | usbd_ept_loop_handler (usbd_core_type *udev)
usb device endpoint loop handler.
void | usbd_reset_handler (usbd_core_type *udev)
usb device reset interrupt request handler.
void | usbd_sof_handler (usbd_core_type *udev)
usb device sof interrupt request handler.
void | usbd_suspend_handler (usbd_core_type *udev)
usb device suspend interrupt request handler.
void | usbd_wakeup_handler (usbd_core_type *udev)
usb device wakup interrupt request handler.

Detailed Description

Function Documentation

◆ usbd_ept_loop_handler()

void usbd_ept_loop_handler ( usbd_core_type * udev )

usb device endpoint loop handler.

Parameters
udev to the structure of usbd_core_type
Return values
none

Definition at line 223 of file usbd_int.c.

Referenced by usbd_irq_handler().

◆ usbd_eptn_handler()

void usbd_eptn_handler | ( | usbd_core_type * | udev,
 |  | usb_ept_number_type | ept_num )

usb device endpoint request handler.

Parameters
udev | to the structure of usbd_core_type
ept_num | endpoint number
Return values
none

Definition at line 110 of file usbd_int.c.

Referenced by usbd_ept_loop_handler().

◆ usbd_irq_handler()

void usbd_irq_handler ( usbd_core_type * udev )

usb device interrput request handler.

Parameters
udev to the structure of usbd_core_type
Return values
none

Definition at line 45 of file usbd_int.c.

Referenced by USBFS_L_CAN1_RX0_IRQHandler().

◆ usbd_reset_handler()

void usbd_reset_handler ( usbd_core_type * udev )

usb device reset interrupt request handler.

Parameters
udev to the structure of usbd_core_type
Return values
none

Definition at line 243 of file usbd_int.c.

Referenced by usbd_irq_handler().

◆ usbd_sof_handler()

void usbd_sof_handler ( usbd_core_type * udev )

usb device sof interrupt request handler.

Parameters
udev to the structure of usbd_core_type
Return values
none

Definition at line 276 of file usbd_int.c.

Referenced by usbd_irq_handler().

◆ usbd_suspend_handler()

void usbd_suspend_handler ( usbd_core_type * udev )

usb device suspend interrupt request handler.

Parameters
udev to the structure of usbd_core_type
Return values
none

Definition at line 288 of file usbd_int.c.

Referenced by usbd_irq_handler().

◆ usbd_wakeup_handler()

void usbd_wakeup_handler ( usbd_core_type * udev )

usb device wakup interrupt request handler.

Parameters
udev to the structure of usbd_core_type
Return values
none

Definition at line 309 of file usbd_int.c.

Referenced by usbd_irq_handler().


AT32F413 Firmwary Library: USBD_drivers_standard_request

Topics
USBD_drivers_standard_request
AT32F413_middlewares_usbd_drivers

usb device standard_request More...

Topics

USBD_sdr_exported_functions
USBD_sdr_private_functions

Detailed Description

usb device standard_request


AT32F413 Firmwary Library: USBD_sdr_exported_functions

Functions
USBD_sdr_exported_functions
AT32F413_middlewares_usbd_drivers » USBD_drivers_standard_request

Functions

void | usbd_setup_request_parse (usb_setup_type *setup, uint8_t *buf)
usb parse standard setup request
usb_sts_type | usbd_device_request (usbd_core_type *udev)
standard usb device requests
usb_sts_type | usbd_interface_request (usbd_core_type *udev)
standard usb interface requests
usb_sts_type | usbd_endpoint_request (usbd_core_type *udev)
standard usb endpoint requests

Detailed Description

Function Documentation

◆ usbd_device_request()

usb_sts_type usbd_device_request ( usbd_core_type * udev )

standard usb device requests

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 367 of file usbd_sdr.c.

Referenced by usbd_core_setup_handler().

◆ usbd_endpoint_request()

usb_sts_type usbd_endpoint_request ( usbd_core_type * udev )

standard usb endpoint requests

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 438 of file usbd_sdr.c.

Referenced by usbd_core_setup_handler().

◆ usbd_interface_request()

usb_sts_type usbd_interface_request ( usbd_core_type * udev )

standard usb interface requests

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 411 of file usbd_sdr.c.

Referenced by usbd_core_setup_handler().

◆ usbd_setup_request_parse()

void usbd_setup_request_parse | ( | usb_setup_type * | setup,
 |  | uint8_t * | buf )

usb parse standard setup request

Parameters
setup | setup structure
buf | setup buffer
Return values
none

Definition at line 54 of file usbd_sdr.c.

Referenced by usbd_core_setup_handler().


AT32F413 Firmwary Library: USBD_sdr_private_functions

Functions
USBD_sdr_private_functions
AT32F413_middlewares_usbd_drivers » USBD_drivers_standard_request

Functions

static usb_sts_type | usbd_get_descriptor (usbd_core_type *udev)
get usb standard device description request
static usb_sts_type | usbd_set_address (usbd_core_type *udev)
this request sets the device address
static usb_sts_type | usbd_get_status (usbd_core_type *udev)
get usb status request
static usb_sts_type | usbd_clear_feature (usbd_core_type *udev)
clear usb feature request
static usb_sts_type | usbd_set_feature (usbd_core_type *udev)
set usb feature request
static usb_sts_type | usbd_get_configuration (usbd_core_type *udev)
get usb configuration request
static usb_sts_type | usbd_set_configuration (usbd_core_type *udev)
sets the usb device configuration request
void | usbd_setup_request_parse (usb_setup_type *setup, uint8_t *buf)
usb parse standard setup request
usb_sts_type | usbd_device_request (usbd_core_type *udev)
standard usb device requests
usb_sts_type | usbd_interface_request (usbd_core_type *udev)
standard usb interface requests
usb_sts_type | usbd_endpoint_request (usbd_core_type *udev)
standard usb endpoint requests

Detailed Description

Function Documentation

◆ usbd_clear_feature()

static usb_sts_type usbd_clear_feature ( usbd_core_type * udev )
static

clear usb feature request

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 223 of file usbd_sdr.c.

Referenced by usbd_device_request().

◆ usbd_device_request()

usb_sts_type usbd_device_request ( usbd_core_type * udev )

standard usb device requests

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 367 of file usbd_sdr.c.

Referenced by usbd_core_setup_handler().

◆ usbd_endpoint_request()

usb_sts_type usbd_endpoint_request ( usbd_core_type * udev )

standard usb endpoint requests

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 438 of file usbd_sdr.c.

Referenced by usbd_core_setup_handler().

◆ usbd_get_configuration()

static usb_sts_type usbd_get_configuration ( usbd_core_type * udev )
static

get usb configuration request

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 273 of file usbd_sdr.c.

Referenced by usbd_device_request().

◆ usbd_get_descriptor()

static usb_sts_type usbd_get_descriptor ( usbd_core_type * udev )
static

get usb standard device description request

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 68 of file usbd_sdr.c.

Referenced by usbd_device_request().

◆ usbd_get_status()

static usb_sts_type usbd_get_status ( usbd_core_type * udev )
static

get usb status request

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 198 of file usbd_sdr.c.

Referenced by usbd_device_request().

◆ usbd_interface_request()

usb_sts_type usbd_interface_request ( usbd_core_type * udev )

standard usb interface requests

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 411 of file usbd_sdr.c.

Referenced by usbd_core_setup_handler().

◆ usbd_set_address()

static usb_sts_type usbd_set_address ( usbd_core_type * udev )
static

this request sets the device address

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 152 of file usbd_sdr.c.

Referenced by usbd_device_request().

◆ usbd_set_configuration()

static usb_sts_type usbd_set_configuration ( usbd_core_type * udev )
static

sets the usb device configuration request

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 305 of file usbd_sdr.c.

Referenced by usbd_device_request().

◆ usbd_set_feature()

static usb_sts_type usbd_set_feature ( usbd_core_type * udev )
static

set usb feature request

Parameters
udev to the structure of usbd_core_type
Return values
status of usb_sts_type

Definition at line 251 of file usbd_sdr.c.

Referenced by usbd_device_request().

◆ usbd_setup_request_parse()

void usbd_setup_request_parse | ( | usb_setup_type * | setup,
 |  | uint8_t * | buf )

usb parse standard setup request

Parameters
setup | setup structure
buf | setup buffer
Return values
none

Definition at line 54 of file usbd_sdr.c.

Referenced by usbd_core_setup_handler().


AT32F413 Firmwary Library: USB_standard

Topics
USB_standard
AT32F413_middlewares_usbd_drivers

Topics

USB_standard_define
USB_standard_exported_types

Detailed Description

Generated by doxygen 1.12.0


AT32F413 Firmwary Library: USB_standard_define

Data Structures | Macros | Enumerations
USB_standard_define
AT32F413_middlewares_usbd_drivers » USB_standard

Data Structures

struct linecoding_type
usb cdc class set line coding struct More...

Macros

#define | USB_REQ_RECIPIENT_DEVICE 0x00
usb request recipient
#define | USB_REQ_RECIPIENT_INTERFACE 0x01
#define | USB_REQ_RECIPIENT_ENDPOINT 0x02
#define | USB_REQ_RECIPIENT_OTHER 0x03
#define | USB_REQ_RECIPIENT_MASK 0x1F
#define | USB_REQ_TYPE_STANDARD 0x00
usb request type
#define | USB_REQ_TYPE_CLASS 0x20
#define | USB_REQ_TYPE_VENDOR 0x40
#define | USB_REQ_TYPE_RESERVED 0x60
#define | USB_REQ_DIR_HTD 0x00
usb request data transfer direction
#define | USB_REQ_DIR_DTH 0x80
#define | USB_STD_REQ_GET_STATUS 0
usb standard device requests codes
#define | USB_STD_REQ_CLEAR_FEATURE 1
#define | USB_STD_REQ_SET_FEATURE 3
#define | USB_STD_REQ_SET_ADDRESS 5
#define | USB_STD_REQ_GET_DESCRIPTOR 6
#define | USB_STD_REQ_SET_DESCRIPTOR 7
#define | USB_STD_REQ_GET_CONFIGURATION 8
#define | USB_STD_REQ_SET_CONFIGURATION 9
#define | USB_STD_REQ_GET_INTERFACE 10
#define | USB_STD_REQ_SET_INTERFACE 11
#define | USB_STD_REQ_SYNCH_FRAME 12
#define | USB_DESCIPTOR_TYPE_DEVICE 1
usb standard device type
#define | USB_DESCIPTOR_TYPE_CONFIGURATION 2
#define | USB_DESCIPTOR_TYPE_STRING 3
#define | USB_DESCIPTOR_TYPE_INTERFACE 4
#define | USB_DESCIPTOR_TYPE_ENDPOINT 5
#define | USB_DESCIPTOR_TYPE_DEVICE_QUALIFIER 6
#define | USB_DESCIPTOR_TYPE_OTHER_SPEED 7
#define | USB_DESCIPTOR_TYPE_INTERFACE_POWER 8
#define | USB_LANGID_STRING 0
usb standard string type
#define | USB_MFC_STRING 1
#define | USB_PRODUCT_STRING 2
#define | USB_SERIAL_STRING 3
#define | USB_CONFIG_STRING 4
#define | USB_INTERFACE_STRING 5
#define | USB_WINUSB_OS_STRING 0xEE
#define | USB_CONF_REMOTE_WAKEUP 2
usb configuration attributes
#define | USB_CONF_SELF_POWERED 1
#define | USB_FEATURE_EPT_HALT 0
usb standard feature selectors
#define | USB_FEATURE_REMOTE_WAKEUP 1
#define | USB_FEATURE_TEST_MODE 2
#define | USB_WINUSB_COMPAT_ID 0x04
usb winusb feature id
#define | USB_WINUSB_PROPERTIES_ID 0x05
#define | USB_EPT0_IDLE 0
endpoint 0 state
#define | USB_EPT0_SETUP 1
#define | USB_EPT0_DATA_IN 2
#define | USB_EPT0_DATA_OUT 3
#define | USB_EPT0_STATUS_IN 4
#define | USB_EPT0_STATUS_OUT 5
#define | USB_EPT0_STALL 6
#define | USB_DEVICE_QUALIFIER_DESC_LEN 0x0A
usb descriptor length
#define | USB_DEVICE_DESC_LEN 0x12
#define | USB_DEVICE_CFG_DESC_LEN 0x09
#define | USB_DEVICE_IF_DESC_LEN 0x09
#define | USB_DEVICE_EPT_LEN 0x07
#define | USB_DEVICE_OTG_DESC_LEN 0x03
#define | USB_DEVICE_LANGID_STR_DESC_LEN 0x04
#define | USB_DEVICE_OTHER_SPEED_DESC_SIZ_LEN 0x09
#define | USB_CLASS_CODE_AUDIO 0x01
usb class code
#define | USB_CLASS_CODE_CDC 0x02
#define | USB_CLASS_CODE_HID 0x03
#define | USB_CLASS_CODE_PRINTER 0x07
#define | USB_CLASS_CODE_MSC 0x08
#define | USB_CLASS_CODE_HUB 0x09
#define | USB_CLASS_CODE_CDCDATA 0x0A
#define | USB_CLASS_CODE_CCID 0x0B
#define | USB_CLASS_CODE_VIDEO 0x0E
#define | USB_CLASS_CODE_VENDOR 0xFF
#define | USB_EPT_DESC_CONTROL 0x00
usb endpoint type
#define | USB_EPT_DESC_ISO 0x01
#define | USB_EPT_DESC_BULK 0x02
#define | USB_EPT_DESC_INTERRUPT 0x03
#define | USB_EPT_DESC_NSYNC 0x00
#define | USB_ETP_DESC_ASYNC 0x04
#define | USB_ETP_DESC_ADAPTIVE 0x08
#define | USB_ETP_DESC_SYNC 0x0C
#define | USB_EPT_DESC_DATA_EPT 0x00
#define | USB_EPT_DESC_FD_EPT 0x10
#define | USB_EPT_DESC_FDDATA_EPT 0x20
#define | USBD_CDC_CS_INTERFACE 0x24
usb cdc class descriptor define
#define | USBD_CDC_CS_ENDPOINT 0x25
#define | USBD_CDC_SUBTYPE_HEADER 0x00
usb cdc class sub-type define
#define | USBD_CDC_SUBTYPE_CMF 0x01
#define | USBD_CDC_SUBTYPE_ACM 0x02
#define | USBD_CDC_SUBTYPE_UFD 0x06
#define | SET_LINE_CODING 0x20
usb cdc class request code define
#define | GET_LINE_CODING 0x21
#define | HID_CLASS_DESC_HID 0x21
usb hid class descriptor define
#define | HID_CLASS_DESC_REPORT 0x22
#define | HID_CLASS_DESC_PHYSICAL 0x23
#define | HID_REQ_SET_PROTOCOL 0x0B
usb hid class request code define
#define | HID_REQ_GET_PROTOCOL 0x03
#define | HID_REQ_SET_IDLE 0x0A
#define | HID_REQ_GET_IDLE 0x02
#define | HID_REQ_SET_REPORT 0x09
#define | HID_REQ_GET_REPORT 0x01
#define | HID_DESCRIPTOR_TYPE 0x21
#define | HID_REPORT_DESC 0x22
#define | USB_MAX_EP0_SIZE 64
endpoint 0 max size
#define | SWAPBYTE(addr)
usb swap address
#define | MIN(a, b)
min and max define
#define | MAX(a, b)
#define | LBYTE(x)
low byte and high byte define
#define | HBYTE(x)

Enumerations

enum usbd_conn_state { USB_CONN_STATE_DEFAULT =1 , USB_CONN_STATE_ADDRESSED , USB_CONN_STATE_CONFIGURED , USB_CONN_STATE_SUSPENDED }
usb device connect state More...

Detailed Description

Macro Definition Documentation

◆ GET_LINE_CODING

#define GET_LINE_CODING 0x21

Definition at line 213 of file usb_std.h.

◆ HBYTE

#define HBYTE ( x )
Value:
((uint8_t)((x & 0xFF00) >>8))

high byte define

Definition at line 271 of file usb_std.h.

Referenced by audio_req_get_cur(), audio_req_get_cur(), audio_req_get_max(), audio_req_get_max(), audio_req_get_min(), audio_req_get_min(), audio_req_get_res(), audio_req_get_res(), audio_req_set_cur(), and audio_req_set_cur().

◆ HID_CLASS_DESC_HID

#define HID_CLASS_DESC_HID 0x21

usb hid class descriptor define

Definition at line 229 of file usb_std.h.

◆ HID_CLASS_DESC_PHYSICAL

#define HID_CLASS_DESC_PHYSICAL 0x23

Definition at line 231 of file usb_std.h.

◆ HID_CLASS_DESC_REPORT

#define HID_CLASS_DESC_REPORT 0x22

Definition at line 230 of file usb_std.h.

◆ HID_DESCRIPTOR_TYPE

#define HID_DESCRIPTOR_TYPE 0x21

Definition at line 242 of file usb_std.h.

Referenced by class_hid_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), and keyboard_class_setup_handler().

◆ HID_REPORT_DESC

#define HID_REPORT_DESC 0x22

Definition at line 243 of file usb_std.h.

Referenced by class_hid_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), and keyboard_class_setup_handler().

◆ HID_REQ_GET_IDLE

#define HID_REQ_GET_IDLE 0x02

Definition at line 239 of file usb_std.h.

Referenced by class_hid_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), and keyboard_class_setup_handler().

◆ HID_REQ_GET_PROTOCOL

#define HID_REQ_GET_PROTOCOL 0x03

Definition at line 237 of file usb_std.h.

Referenced by class_hid_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), and keyboard_class_setup_handler().

◆ HID_REQ_GET_REPORT

#define HID_REQ_GET_REPORT 0x01

Definition at line 241 of file usb_std.h.

Referenced by class_setup_handler().

◆ HID_REQ_SET_IDLE

#define HID_REQ_SET_IDLE 0x0A

Definition at line 238 of file usb_std.h.

Referenced by class_hid_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), and keyboard_class_setup_handler().

◆ HID_REQ_SET_PROTOCOL

#define HID_REQ_SET_PROTOCOL 0x0B

usb hid class request code define

Definition at line 236 of file usb_std.h.

Referenced by class_hid_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), and keyboard_class_setup_handler().

◆ HID_REQ_SET_REPORT

#define HID_REQ_SET_REPORT 0x09

Definition at line 240 of file usb_std.h.

Referenced by class_ept0_rx_handler(), class_ept0_rx_handler(), class_ept0_rx_handler(), class_ept0_rx_handler(), class_ept0_rx_handler(), class_ept0_rx_handler(), class_hid_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), and keyboard_class_setup_handler().

◆ LBYTE

#define LBYTE ( x )
Value:
((uint8_t)(x & 0x00FF))

low byte and high byte define

low byte define

Definition at line 270 of file usb_std.h.

Referenced by audio_get_interface(), audio_get_interface(), audio_set_interface(), audio_set_interface(), and usbd_endpoint_request().

◆ MAX

#define MAX | ( | a,
 |  | b )
Value:
(uint16_t)(((a) > (b)) ? (a) : (b))

max define

Definition at line 264 of file usb_std.h.

◆ MIN

#define MIN | ( | a,
 |  | b )
Value:
(uint16_t)(((a) < (b)) ? (a) : (b))

min and max define

min define

Definition at line 260 of file usb_std.h.

Referenced by bot_scsi_read10(), bot_scsi_send_data(), bot_scsi_write10(), class_audio_setup_handler(), class_hid_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), keyboard_class_setup_handler(), usbd_core_in_handler(), usbd_core_out_handler(), and usbd_get_descriptor().

◆ SET_LINE_CODING

#define SET_LINE_CODING 0x20

usb cdc class request code define

Definition at line 212 of file usb_std.h.

◆ SWAPBYTE

#define SWAPBYTE ( addr )
Value:
(uint16_t)(((uint16_t)(*((uint8_t *)(addr)))) + \
(((uint16_t)(*(((uint8_t *)(addr)) + 1))) << 8))

usb swap address

swap address

Definition at line 253 of file usb_std.h.

Referenced by usbd_setup_request_parse().

◆ USB_CLASS_CODE_AUDIO

#define USB_CLASS_CODE_AUDIO 0x01

usb class code

usb class code audio

Definition at line 167 of file usb_std.h.

◆ USB_CLASS_CODE_CCID

#define USB_CLASS_CODE_CCID 0x0B

usb class code ccid

Definition at line 174 of file usb_std.h.

◆ USB_CLASS_CODE_CDC

#define USB_CLASS_CODE_CDC 0x02

usb class code cdc

Definition at line 168 of file usb_std.h.

◆ USB_CLASS_CODE_CDCDATA

#define USB_CLASS_CODE_CDCDATA 0x0A

usb class code cdc data

Definition at line 173 of file usb_std.h.

◆ USB_CLASS_CODE_HID

#define USB_CLASS_CODE_HID 0x03

usb class code hid

Definition at line 169 of file usb_std.h.

◆ USB_CLASS_CODE_HUB

#define USB_CLASS_CODE_HUB 0x09

usb class code hub

Definition at line 172 of file usb_std.h.

◆ USB_CLASS_CODE_MSC

#define USB_CLASS_CODE_MSC 0x08

usb class code msc

Definition at line 171 of file usb_std.h.

◆ USB_CLASS_CODE_PRINTER

#define USB_CLASS_CODE_PRINTER 0x07

usb class code printer

Definition at line 170 of file usb_std.h.

◆ USB_CLASS_CODE_VENDOR

#define USB_CLASS_CODE_VENDOR 0xFF

usb class code vendor

Definition at line 176 of file usb_std.h.

◆ USB_CLASS_CODE_VIDEO

#define USB_CLASS_CODE_VIDEO 0x0E

usb class code video

Definition at line 175 of file usb_std.h.

◆ USB_CONF_REMOTE_WAKEUP

#define USB_CONF_REMOTE_WAKEUP 2

usb configuration attributes

usb configuration attributes remote wakeup

Definition at line 114 of file usb_std.h.

Referenced by usbd_get_status().

◆ USB_CONF_SELF_POWERED

#define USB_CONF_SELF_POWERED 1

usb configuration attributes self powered

Definition at line 115 of file usb_std.h.

◆ USB_CONFIG_STRING

#define USB_CONFIG_STRING 4

usb standard string type config

Definition at line 107 of file usb_std.h.

Referenced by usbd_get_descriptor().

◆ USB_DESCIPTOR_TYPE_CONFIGURATION

#define USB_DESCIPTOR_TYPE_CONFIGURATION 2

usb standard device type configuration

Definition at line 92 of file usb_std.h.

Referenced by usbd_get_descriptor().

◆ USB_DESCIPTOR_TYPE_DEVICE

#define USB_DESCIPTOR_TYPE_DEVICE 1

usb standard device type

usb standard device type device

Definition at line 91 of file usb_std.h.

Referenced by usbd_get_descriptor().

◆ USB_DESCIPTOR_TYPE_DEVICE_QUALIFIER

#define USB_DESCIPTOR_TYPE_DEVICE_QUALIFIER 6

usb standard device type qualifier

Definition at line 96 of file usb_std.h.

Referenced by usbd_get_descriptor().

◆ USB_DESCIPTOR_TYPE_ENDPOINT

#define USB_DESCIPTOR_TYPE_ENDPOINT 5

usb standard device type endpoint

Definition at line 95 of file usb_std.h.

◆ USB_DESCIPTOR_TYPE_INTERFACE

#define USB_DESCIPTOR_TYPE_INTERFACE 4

usb standard device type interface

Definition at line 94 of file usb_std.h.

◆ USB_DESCIPTOR_TYPE_INTERFACE_POWER

#define USB_DESCIPTOR_TYPE_INTERFACE_POWER 8

usb standard device type interface power

Definition at line 98 of file usb_std.h.

◆ USB_DESCIPTOR_TYPE_OTHER_SPEED

#define USB_DESCIPTOR_TYPE_OTHER_SPEED 7

usb standard device type other speed

Definition at line 97 of file usb_std.h.

Referenced by usbd_get_descriptor().

◆ USB_DESCIPTOR_TYPE_STRING

#define USB_DESCIPTOR_TYPE_STRING 3

usb standard device type string

Definition at line 93 of file usb_std.h.

Referenced by usbd_get_descriptor(), usbd_unicode_convert(), usbd_unicode_convert(), usbd_unicode_convert(), usbd_unicode_convert(), usbd_unicode_convert(), usbd_unicode_convert(), usbd_unicode_convert(), usbd_unicode_convert(), usbd_unicode_convert(), usbd_unicode_convert(), usbd_unicode_convert(), and usbd_unicode_convert().

◆ USB_DEVICE_CFG_DESC_LEN

#define USB_DEVICE_CFG_DESC_LEN 0x09

usb configuration descriptor length

Definition at line 157 of file usb_std.h.

◆ USB_DEVICE_DESC_LEN

#define USB_DEVICE_DESC_LEN 0x12

usb device descriptor length

Definition at line 156 of file usb_std.h.

◆ USB_DEVICE_EPT_LEN

#define USB_DEVICE_EPT_LEN 0x07

usb endpoint descriptor length

Definition at line 159 of file usb_std.h.

◆ USB_DEVICE_IF_DESC_LEN

#define USB_DEVICE_IF_DESC_LEN 0x09

usb interface descriptor length

Definition at line 158 of file usb_std.h.

◆ USB_DEVICE_LANGID_STR_DESC_LEN

#define USB_DEVICE_LANGID_STR_DESC_LEN 0x04

usb lang id string descriptor length

Definition at line 161 of file usb_std.h.

◆ USB_DEVICE_OTG_DESC_LEN

#define USB_DEVICE_OTG_DESC_LEN 0x03

usb otg descriptor length

Definition at line 160 of file usb_std.h.

◆ USB_DEVICE_OTHER_SPEED_DESC_SIZ_LEN

#define USB_DEVICE_OTHER_SPEED_DESC_SIZ_LEN 0x09

usb other speed descriptor length

Definition at line 162 of file usb_std.h.

◆ USB_DEVICE_QUALIFIER_DESC_LEN

#define USB_DEVICE_QUALIFIER_DESC_LEN 0x0A

usb descriptor length

usb qualifier descriptor length

Definition at line 155 of file usb_std.h.

◆ USB_EPT0_DATA_IN

#define USB_EPT0_DATA_IN 2

usb endpoint state data in

Definition at line 146 of file usb_std.h.

Referenced by usbd_core_in_handler(), and usbd_ctrl_send().

◆ USB_EPT0_DATA_OUT

#define USB_EPT0_DATA_OUT 3

usb endpoint state data out

Definition at line 147 of file usb_std.h.

Referenced by usbd_core_out_handler(), and usbd_ctrl_recv().

◆ USB_EPT0_IDLE

#define USB_EPT0_IDLE 0

endpoint 0 state

usb endpoint state idle

Definition at line 144 of file usb_std.h.

◆ USB_EPT0_SETUP

#define USB_EPT0_SETUP 1

usb endpoint state setup

Definition at line 145 of file usb_std.h.

Referenced by usbd_core_setup_handler().

◆ USB_EPT0_STALL

#define USB_EPT0_STALL 6

usb endpoint state stall

Definition at line 150 of file usb_std.h.

◆ USB_EPT0_STATUS_IN

#define USB_EPT0_STATUS_IN 4

usb endpoint state status in

Definition at line 148 of file usb_std.h.

Referenced by usbd_ctrl_send_status().

◆ USB_EPT0_STATUS_OUT

#define USB_EPT0_STATUS_OUT 5

usb endpoint state status out

Definition at line 149 of file usb_std.h.

Referenced by usbd_ctrl_recv_status().

◆ USB_EPT_DESC_BULK

#define USB_EPT_DESC_BULK 0x02

usb endpoint description type bulk

Definition at line 183 of file usb_std.h.

◆ USB_EPT_DESC_CONTROL

#define USB_EPT_DESC_CONTROL 0x00

usb endpoint type

usb endpoint description type control

Definition at line 181 of file usb_std.h.

◆ USB_EPT_DESC_DATA_EPT

#define USB_EPT_DESC_DATA_EPT 0x00

usb endpoint description data

Definition at line 191 of file usb_std.h.

◆ USB_EPT_DESC_FD_EPT

#define USB_EPT_DESC_FD_EPT 0x10

usb endpoint description fd

Definition at line 192 of file usb_std.h.

◆ USB_EPT_DESC_FDDATA_EPT

#define USB_EPT_DESC_FDDATA_EPT 0x20

usb endpoint description fddata

Definition at line 193 of file usb_std.h.

◆ USB_EPT_DESC_INTERRUPT

#define USB_EPT_DESC_INTERRUPT 0x03

usb endpoint description type interrupt

Definition at line 184 of file usb_std.h.

◆ USB_EPT_DESC_ISO

#define USB_EPT_DESC_ISO 0x01

usb endpoint description type iso

Definition at line 182 of file usb_std.h.

◆ USB_EPT_DESC_NSYNC

#define USB_EPT_DESC_NSYNC 0x00

usb endpoint description nsync

Definition at line 186 of file usb_std.h.

◆ USB_ETP_DESC_ADAPTIVE

#define USB_ETP_DESC_ADAPTIVE 0x08

usb endpoint description adaptive

Definition at line 188 of file usb_std.h.

◆ USB_ETP_DESC_ASYNC

#define USB_ETP_DESC_ASYNC 0x04

usb endpoint description async

Definition at line 187 of file usb_std.h.

◆ USB_ETP_DESC_SYNC

#define USB_ETP_DESC_SYNC 0x0C

usb endpoint description sync

Definition at line 189 of file usb_std.h.

◆ USB_FEATURE_EPT_HALT

#define USB_FEATURE_EPT_HALT 0

usb standard feature selectors

usb standard feature selectors endpoint halt

Definition at line 120 of file usb_std.h.

Referenced by usbd_endpoint_request().

◆ USB_FEATURE_REMOTE_WAKEUP

#define USB_FEATURE_REMOTE_WAKEUP 1

usb standard feature selectors remote wakeup

Definition at line 121 of file usb_std.h.

Referenced by usbd_clear_feature(), and usbd_set_feature().

◆ USB_FEATURE_TEST_MODE

#define USB_FEATURE_TEST_MODE 2

usb standard feature selectors test mode

Definition at line 122 of file usb_std.h.

◆ USB_INTERFACE_STRING

#define USB_INTERFACE_STRING 5

usb standard string type interface

Definition at line 108 of file usb_std.h.

Referenced by usbd_get_descriptor().

◆ USB_LANGID_STRING

#define USB_LANGID_STRING 0

usb standard string type

usb standard string type lang id

Definition at line 103 of file usb_std.h.

Referenced by usbd_get_descriptor().

◆ USB_MAX_EP0_SIZE

#define USB_MAX_EP0_SIZE 64

endpoint 0 max size

usb endpoint 0 max size

Definition at line 248 of file usb_std.h.

◆ USB_MFC_STRING

#define USB_MFC_STRING 1

usb standard string type mfc

Definition at line 104 of file usb_std.h.

Referenced by usbd_get_descriptor().

◆ USB_PRODUCT_STRING

#define USB_PRODUCT_STRING 2

usb standard string type product

Definition at line 105 of file usb_std.h.

Referenced by usbd_get_descriptor().

◆ USB_REQ_DIR_DTH

#define USB_REQ_DIR_DTH 0x80

usb request data transfer direction device to host

Definition at line 71 of file usb_std.h.

Referenced by cdc_class_setup_handler(), cdc_class_setup_handler(), and class_setup_handler().

◆ USB_REQ_DIR_HTD

#define USB_REQ_DIR_HTD 0x00

usb request data transfer direction

usb request data transfer direction host to device

Definition at line 70 of file usb_std.h.

◆ USB_REQ_RECIPIENT_DEVICE

#define USB_REQ_RECIPIENT_DEVICE 0x00

usb request recipient

usb request recipient device

Definition at line 53 of file usb_std.h.

Referenced by usbd_core_setup_handler().

◆ USB_REQ_RECIPIENT_ENDPOINT

#define USB_REQ_RECIPIENT_ENDPOINT 0x02

usb request recipient endpoint

Definition at line 55 of file usb_std.h.

Referenced by class_setup_handler(), class_setup_handler(), class_setup_handler(), and usbd_core_setup_handler().

◆ USB_REQ_RECIPIENT_INTERFACE

#define USB_REQ_RECIPIENT_INTERFACE 0x01

usb request recipient interface

Definition at line 54 of file usb_std.h.

Referenced by class_setup_handler(), class_setup_handler(), class_setup_handler(), and usbd_core_setup_handler().

◆ USB_REQ_RECIPIENT_MASK

#define USB_REQ_RECIPIENT_MASK 0x1F

usb request recipient mask

Definition at line 57 of file usb_std.h.

Referenced by class_setup_handler(), class_setup_handler(), class_setup_handler(), and usbd_core_setup_handler().

◆ USB_REQ_RECIPIENT_OTHER

#define USB_REQ_RECIPIENT_OTHER 0x03

usb request recipient other

Definition at line 56 of file usb_std.h.

◆ USB_REQ_TYPE_CLASS

#define USB_REQ_TYPE_CLASS 0x20

usb request type class

Definition at line 63 of file usb_std.h.

Referenced by cdc_class_setup_handler(), cdc_class_setup_handler(), class_audio_setup_handler(), class_hid_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), keyboard_class_setup_handler(), and msc_class_setup_handler().

◆ USB_REQ_TYPE_RESERVED

#define USB_REQ_TYPE_RESERVED 0x60

usb request type reserved

Definition at line 65 of file usb_std.h.

Referenced by cdc_class_setup_handler(), cdc_class_setup_handler(), class_audio_setup_handler(), class_hid_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), keyboard_class_setup_handler(), msc_class_setup_handler(), usbd_device_request(), and usbd_endpoint_request().

◆ USB_REQ_TYPE_STANDARD

#define USB_REQ_TYPE_STANDARD 0x00

usb request type

usb request type standard

Definition at line 62 of file usb_std.h.

Referenced by cdc_class_setup_handler(), cdc_class_setup_handler(), class_audio_setup_handler(), class_hid_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), keyboard_class_setup_handler(), msc_class_setup_handler(), usbd_device_request(), and usbd_endpoint_request().

◆ USB_REQ_TYPE_VENDOR

#define USB_REQ_TYPE_VENDOR 0x40

usb request type vendor

Definition at line 64 of file usb_std.h.

Referenced by class_setup_handler().

◆ USB_SERIAL_STRING

#define USB_SERIAL_STRING 3

usb standard string type serial

Definition at line 106 of file usb_std.h.

Referenced by usbd_get_descriptor().

◆ USB_STD_REQ_CLEAR_FEATURE

#define USB_STD_REQ_CLEAR_FEATURE 1

usb request code clear feature

Definition at line 77 of file usb_std.h.

Referenced by cdc_class_setup_handler(), cdc_class_setup_handler(), class_audio_setup_handler(), class_hid_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), keyboard_class_setup_handler(), msc_class_setup_handler(), usbd_device_request(), and usbd_endpoint_request().

◆ USB_STD_REQ_GET_CONFIGURATION

#define USB_STD_REQ_GET_CONFIGURATION 8

usb request code get configuration

Definition at line 82 of file usb_std.h.

Referenced by usbd_device_request().

◆ USB_STD_REQ_GET_DESCRIPTOR

#define USB_STD_REQ_GET_DESCRIPTOR 6

usb request code get descriptor

Definition at line 80 of file usb_std.h.

Referenced by cdc_class_setup_handler(), cdc_class_setup_handler(), class_audio_setup_handler(), class_hid_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), keyboard_class_setup_handler(), msc_class_setup_handler(), and usbd_device_request().

◆ USB_STD_REQ_GET_INTERFACE

#define USB_STD_REQ_GET_INTERFACE 10

usb request code get interface

Definition at line 84 of file usb_std.h.

Referenced by cdc_class_setup_handler(), cdc_class_setup_handler(), class_audio_setup_handler(), class_hid_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), keyboard_class_setup_handler(), and msc_class_setup_handler().

◆ USB_STD_REQ_GET_STATUS

#define USB_STD_REQ_GET_STATUS 0

usb standard device requests codes

usb request code status

Definition at line 76 of file usb_std.h.

Referenced by usbd_device_request(), and usbd_endpoint_request().

◆ USB_STD_REQ_SET_ADDRESS

#define USB_STD_REQ_SET_ADDRESS 5

usb request code address

Definition at line 79 of file usb_std.h.

Referenced by usbd_device_request().

◆ USB_STD_REQ_SET_CONFIGURATION

#define USB_STD_REQ_SET_CONFIGURATION 9

usb request code set configuration

Definition at line 83 of file usb_std.h.

Referenced by usbd_device_request().

◆ USB_STD_REQ_SET_DESCRIPTOR

#define USB_STD_REQ_SET_DESCRIPTOR 7

usb request code set descriptor

Definition at line 81 of file usb_std.h.

◆ USB_STD_REQ_SET_FEATURE

#define USB_STD_REQ_SET_FEATURE 3

usb request code feature

Definition at line 78 of file usb_std.h.

Referenced by cdc_class_setup_handler(), cdc_class_setup_handler(), class_audio_setup_handler(), class_hid_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), keyboard_class_setup_handler(), msc_class_setup_handler(), usbd_device_request(), and usbd_endpoint_request().

◆ USB_STD_REQ_SET_INTERFACE

#define USB_STD_REQ_SET_INTERFACE 11

usb request code set interface

Definition at line 85 of file usb_std.h.

Referenced by cdc_class_setup_handler(), cdc_class_setup_handler(), class_audio_setup_handler(), class_hid_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), keyboard_class_setup_handler(), and msc_class_setup_handler().

◆ USB_STD_REQ_SYNCH_FRAME

#define USB_STD_REQ_SYNCH_FRAME 12

usb request code synch frame

Definition at line 86 of file usb_std.h.

◆ USB_WINUSB_COMPAT_ID

#define USB_WINUSB_COMPAT_ID 0x04

usb winusb feature id

usb winusb compat id os descriptor

Definition at line 127 of file usb_std.h.

◆ USB_WINUSB_OS_STRING

#define USB_WINUSB_OS_STRING 0xEE

usb microsoft os string

Definition at line 109 of file usb_std.h.

Referenced by usbd_get_descriptor().

◆ USB_WINUSB_PROPERTIES_ID

#define USB_WINUSB_PROPERTIES_ID 0x05

usb winusb properties id os descriptor

Definition at line 128 of file usb_std.h.

◆ USBD_CDC_CS_ENDPOINT

#define USBD_CDC_CS_ENDPOINT 0x25

Definition at line 199 of file usb_std.h.

◆ USBD_CDC_CS_INTERFACE

#define USBD_CDC_CS_INTERFACE 0x24

usb cdc class descriptor define

Definition at line 198 of file usb_std.h.

◆ USBD_CDC_SUBTYPE_ACM

#define USBD_CDC_SUBTYPE_ACM 0x02

Definition at line 206 of file usb_std.h.

◆ USBD_CDC_SUBTYPE_CMF

#define USBD_CDC_SUBTYPE_CMF 0x01

Definition at line 205 of file usb_std.h.

◆ USBD_CDC_SUBTYPE_HEADER

#define USBD_CDC_SUBTYPE_HEADER 0x00

usb cdc class sub-type define

Definition at line 204 of file usb_std.h.

◆ USBD_CDC_SUBTYPE_UFD

#define USBD_CDC_SUBTYPE_UFD 0x06

Definition at line 207 of file usb_std.h.

Enumeration Type Documentation

◆ usbd_conn_state

enum usbd_conn_state

usb device connect state

Enumerator
USB_CONN_STATE_DEFAULT | usb device connect state default
USB_CONN_STATE_ADDRESSED | usb device connect state address
USB_CONN_STATE_CONFIGURED | usb device connect state configured
USB_CONN_STATE_SUSPENDED | usb device connect state suspend

Definition at line 133 of file usb_std.h.


AT32F413 Firmwary Library: linecoding_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
linecoding_type Struct Reference
AT32F413_middlewares_usbd_drivers » USB_standard » USB_standard_define

usb cdc class set line coding struct More...

#include <usb_std.h>

Data Fields

uint32_t | bitrate
uint8_t | format
uint8_t | parity
uint8_t | data

Detailed Description

usb cdc class set line coding struct

Definition at line 218 of file usb_std.h.

Field Documentation

◆ bitrate

uint32_t linecoding_type::bitrate

Definition at line 220 of file usb_std.h.

Referenced by cdc_struct_init(), cdc_struct_init(), class_init_handler(), usb_usart_config(), usb_vcp_cmd_process(), usb_vcp_cmd_process(), and usb_vcp_cmd_process().

◆ data

uint8_t linecoding_type::data

Definition at line 223 of file usb_std.h.

Referenced by cdc_struct_init(), cdc_struct_init(), class_init_handler(), usb_usart_config(), usb_vcp_cmd_process(), usb_vcp_cmd_process(), and usb_vcp_cmd_process().

◆ format

uint8_t linecoding_type::format

Definition at line 221 of file usb_std.h.

Referenced by cdc_struct_init(), cdc_struct_init(), class_init_handler(), usb_usart_config(), usb_vcp_cmd_process(), usb_vcp_cmd_process(), and usb_vcp_cmd_process().

◆ parity

uint8_t linecoding_type::parity

Definition at line 222 of file usb_std.h.

Referenced by cdc_struct_init(), cdc_struct_init(), class_init_handler(), usb_usart_config(), usb_vcp_cmd_process(), usb_vcp_cmd_process(), and usb_vcp_cmd_process().

The documentation for this struct was generated from the following file:
  • usb_std.h


AT32F413 Firmwary Library: USB_standard_exported_types

Data Structures | Enumerations
USB_standard_exported_types
AT32F413_middlewares_usbd_drivers » USB_standard

Data Structures

struct | usb_setup_type
format of usb setup data More...
struct | usb_device_desc_type
format of standard device descriptor More...
struct | usb_configuration_desc_type
format of standard configuration descriptor More...
struct | usb_interface_desc_type
format of standard interface descriptor More...
struct | usb_endpoint_desc_type
format of standard endpoint descriptor More...
struct | usb_header_desc_type
format of header More...

Enumerations

enum usb_sts_type {
USB_OK , USB_FAIL , USB_WAIT , USB_NOT_SUPPORT ,
USB_ERROR
}
usb return status More...

Detailed Description

Enumeration Type Documentation

◆ usb_sts_type

enum usb_sts_type

usb return status

Enumerator
USB_OK | usb status ok
USB_FAIL | usb status fail
USB_WAIT | usb status wait
USB_NOT_SUPPORT | usb status not support
USB_ERROR | usb status error

Definition at line 284 of file usb_std.h.


AT32F413 Firmwary Library: usb_setup_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
usb_setup_type Struct Reference
AT32F413_middlewares_usbd_drivers » USB_standard » USB_standard_exported_types

format of usb setup data More...

#include <usb_std.h>

Data Fields

uint8_t | bmRequestType
uint8_t | bRequest
uint16_t | wValue
uint16_t | wIndex
uint16_t | wLength

Detailed Description

format of usb setup data

Definition at line 296 of file usb_std.h.

Field Documentation

◆ bmRequestType

uint8_t usb_setup_type::bmRequestType

characteristics of request

Definition at line 298 of file usb_std.h.

Referenced by audio_req_get_cur(), audio_req_get_cur(), audio_req_get_max(), audio_req_get_max(), audio_req_get_min(), audio_req_get_min(), audio_req_get_res(), audio_req_get_res(), audio_req_set_cur(), audio_req_set_cur(), cdc_class_setup_handler(), cdc_class_setup_handler(), class_audio_setup_handler(), class_hid_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), keyboard_class_setup_handler(), msc_class_setup_handler(), usbd_core_setup_handler(), usbd_device_request(), usbd_endpoint_request(), and usbd_setup_request_parse().

◆ bRequest

uint8_t usb_setup_type::bRequest

specific request

Definition at line 299 of file usb_std.h.

Referenced by cdc_class_setup_handler(), cdc_class_setup_handler(), class_audio_setup_handler(), class_hid_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), keyboard_class_setup_handler(), msc_class_setup_handler(), usbd_device_request(), usbd_endpoint_request(), and usbd_setup_request_parse().

◆ wIndex

uint16_t usb_setup_type::wIndex

word-sized field that varies according to request typically used to pass an index or offset

Definition at line 301 of file usb_std.h.

Referenced by audio_get_interface(), audio_get_interface(), audio_req_get_cur(), audio_req_get_cur(), audio_req_get_max(), audio_req_get_max(), audio_req_get_min(), audio_req_get_min(), audio_req_get_res(), audio_req_get_res(), audio_req_set_cur(), audio_req_set_cur(), audio_set_interface(), audio_set_interface(), class_ept0_rx_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), msc_class_setup_handler(), usbd_endpoint_request(), usbd_set_address(), usbd_set_configuration(), and usbd_setup_request_parse().

◆ wLength

uint16_t usb_setup_type::wLength

number of bytes to transfer if there is a data stage

Definition at line 303 of file usb_std.h.

Referenced by audio_req_get_cur(), audio_req_get_cur(), audio_req_get_max(), audio_req_get_max(), audio_req_get_min(), audio_req_get_min(), audio_req_get_res(), audio_req_get_res(), audio_req_set_cur(), audio_req_set_cur(), cdc_class_setup_handler(), cdc_class_setup_handler(), class_audio_setup_handler(), class_hid_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), keyboard_class_setup_handler(), usbd_core_setup_handler(), usbd_get_configuration(), usbd_get_descriptor(), usbd_interface_request(), usbd_set_address(), usbd_set_configuration(), and usbd_setup_request_parse().

◆ wValue

uint16_t usb_setup_type::wValue

word-sized field that varies according to request

Definition at line 300 of file usb_std.h.

Referenced by audio_req_get_cur(), audio_req_get_cur(), audio_req_set_cur(), audio_req_set_cur(), audio_set_interface(), audio_set_interface(), cdc_class_setup_handler(), cdc_class_setup_handler(), class_audio_setup_handler(), class_hid_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), class_setup_handler(), keyboard_class_setup_handler(), msc_class_setup_handler(), usbd_clear_feature(), usbd_endpoint_request(), usbd_get_descriptor(), usbd_set_address(), usbd_set_configuration(), usbd_set_feature(), and usbd_setup_request_parse().

The documentation for this struct was generated from the following file:
  • usb_std.h


AT32F413 Firmwary Library: usb_device_desc_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
usb_device_desc_type Struct Reference
AT32F413_middlewares_usbd_drivers » USB_standard » USB_standard_exported_types

format of standard device descriptor More...

#include <usb_std.h>

Data Fields

uint8_t | bLength
uint8_t | bDescriptorType
uint16_t | bcdUSB
uint8_t | bDeviceClass
uint8_t | bDeviceSubClass
uint8_t | bDeviceProtocol
uint8_t | bMaxPacketSize0
uint16_t | idVendor
uint16_t | idProduct
uint16_t | bcdDevice
uint8_t | iManufacturer
uint8_t | iProduct
uint8_t | iSerialNumber
uint8_t | bNumConfigurations

Detailed Description

format of standard device descriptor

Definition at line 309 of file usb_std.h.

Field Documentation

◆ bcdDevice

uint16_t usb_device_desc_type::bcdDevice

device release number in binary-coded decimal

Definition at line 320 of file usb_std.h.

◆ bcdUSB

uint16_t usb_device_desc_type::bcdUSB

usb specification release number

Definition at line 313 of file usb_std.h.

◆ bDescriptorType

uint8_t usb_device_desc_type::bDescriptorType

device descriptor type

Definition at line 312 of file usb_std.h.

◆ bDeviceClass

uint8_t usb_device_desc_type::bDeviceClass

class code (assigned by the usb-if)

Definition at line 314 of file usb_std.h.

◆ bDeviceProtocol

uint8_t usb_device_desc_type::bDeviceProtocol

protocol code ((assigned by the usb-if))

Definition at line 316 of file usb_std.h.

◆ bDeviceSubClass

uint8_t usb_device_desc_type::bDeviceSubClass

subclass code (assigned by the usb-if)

Definition at line 315 of file usb_std.h.

◆ bLength

uint8_t usb_device_desc_type::bLength

size of this descriptor in bytes

Definition at line 311 of file usb_std.h.

◆ bMaxPacketSize0

uint8_t usb_device_desc_type::bMaxPacketSize0

maximum packet size for endpoint zero

Definition at line 317 of file usb_std.h.

◆ bNumConfigurations

uint8_t usb_device_desc_type::bNumConfigurations

number of possible configurations

Definition at line 324 of file usb_std.h.

◆ idProduct

uint16_t usb_device_desc_type::idProduct

product id ((assigned by the usb-if))

Definition at line 319 of file usb_std.h.

◆ idVendor

uint16_t usb_device_desc_type::idVendor

verndor id ((assigned by the usb-if))

Definition at line 318 of file usb_std.h.

◆ iManufacturer

uint8_t usb_device_desc_type::iManufacturer

index of string descriptor describing manufacturer

Definition at line 321 of file usb_std.h.

◆ iProduct

uint8_t usb_device_desc_type::iProduct

index of string descriptor describing product

Definition at line 322 of file usb_std.h.

◆ iSerialNumber

uint8_t usb_device_desc_type::iSerialNumber

index of string descriptor describing serial number

Definition at line 323 of file usb_std.h.

The documentation for this struct was generated from the following file:
  • usb_std.h


AT32F413 Firmwary Library: usb_configuration_desc_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
usb_configuration_desc_type Struct Reference
AT32F413_middlewares_usbd_drivers » USB_standard » USB_standard_exported_types

format of standard configuration descriptor More...

#include <usb_std.h>

Data Fields

uint8_t | bLength
uint8_t | bDescriptorType
uint16_t | wTotalLength
uint8_t | bNumInterfaces
uint8_t | bConfigurationValue
uint8_t | iConfiguration
uint8_t | bmAttributes
uint8_t | bMaxPower

Detailed Description

format of standard configuration descriptor

Definition at line 330 of file usb_std.h.

Field Documentation

◆ bConfigurationValue

uint8_t usb_configuration_desc_type::bConfigurationValue

value to use as an argument to the SetConfiguration() request

Definition at line 336 of file usb_std.h.

◆ bDescriptorType

uint8_t usb_configuration_desc_type::bDescriptorType

configuration descriptor type

Definition at line 333 of file usb_std.h.

◆ bLength

uint8_t usb_configuration_desc_type::bLength

size of this descriptor in bytes

Definition at line 332 of file usb_std.h.

◆ bmAttributes

uint8_t usb_configuration_desc_type::bmAttributes

configuration characteristics D7 reserved D6 self-powered D5 remote wakeup D4~D0 reserved

Definition at line 338 of file usb_std.h.

◆ bMaxPower

uint8_t usb_configuration_desc_type::bMaxPower

maximum power consumption of the usb device from the bus

Definition at line 343 of file usb_std.h.

◆ bNumInterfaces

uint8_t usb_configuration_desc_type::bNumInterfaces

number of interfaces supported by this configuration

Definition at line 335 of file usb_std.h.

◆ iConfiguration

uint8_t usb_configuration_desc_type::iConfiguration

index of string descriptor describing this configuration

Definition at line 337 of file usb_std.h.

◆ wTotalLength

uint16_t usb_configuration_desc_type::wTotalLength

total length of data returned for this configuration

Definition at line 334 of file usb_std.h.

The documentation for this struct was generated from the following file:
  • usb_std.h


AT32F413 Firmwary Library: usb_interface_desc_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
usb_interface_desc_type Struct Reference
AT32F413_middlewares_usbd_drivers » USB_standard » USB_standard_exported_types

format of standard interface descriptor More...

#include <usb_std.h>

Data Fields

uint8_t | bLength
uint8_t | bDescriptorType
uint8_t | bInterfaceNumber
uint8_t | bAlternateSetting
uint8_t | bNumEndpoints
uint8_t | bInterfaceClass
uint8_t | bInterfaceSubClass
uint8_t | bInterfaceProtocol
uint8_t | iInterface

Detailed Description

format of standard interface descriptor

Definition at line 351 of file usb_std.h.

Field Documentation

◆ bAlternateSetting

uint8_t usb_interface_desc_type::bAlternateSetting

value used to select this alternate setting for the interface

Definition at line 356 of file usb_std.h.

◆ bDescriptorType

uint8_t usb_interface_desc_type::bDescriptorType

interface descriptor type

Definition at line 354 of file usb_std.h.

◆ bInterfaceClass

uint8_t usb_interface_desc_type::bInterfaceClass

class code (assigned by the usb-if)

Definition at line 358 of file usb_std.h.

◆ bInterfaceNumber

uint8_t usb_interface_desc_type::bInterfaceNumber

number of this interface

Definition at line 355 of file usb_std.h.

◆ bInterfaceProtocol

uint8_t usb_interface_desc_type::bInterfaceProtocol

protocol code (assigned by the usb-if)

Definition at line 360 of file usb_std.h.

◆ bInterfaceSubClass

uint8_t usb_interface_desc_type::bInterfaceSubClass

subclass code (assigned by the usb-if)

Definition at line 359 of file usb_std.h.

◆ bLength

uint8_t usb_interface_desc_type::bLength

size of this descriptor in bytes

Definition at line 353 of file usb_std.h.

◆ bNumEndpoints

uint8_t usb_interface_desc_type::bNumEndpoints

number of endpoints used by this interface

Definition at line 357 of file usb_std.h.

◆ iInterface

uint8_t usb_interface_desc_type::iInterface

index of string descriptor describing this interface

Definition at line 361 of file usb_std.h.

The documentation for this struct was generated from the following file:
  • usb_std.h


AT32F413 Firmwary Library: usb_endpoint_desc_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
usb_endpoint_desc_type Struct Reference
AT32F413_middlewares_usbd_drivers » USB_standard » USB_standard_exported_types

format of standard endpoint descriptor More...

#include <usb_std.h>

Data Fields

uint8_t | bLength
uint8_t | bDescriptorType
uint8_t | bEndpointAddress
uint8_t | bmAttributes
uint16_t | wMaxPacketSize
uint8_t | bInterval

Detailed Description

format of standard endpoint descriptor

Definition at line 367 of file usb_std.h.

Field Documentation

◆ bDescriptorType

uint8_t usb_endpoint_desc_type::bDescriptorType

endpoint descriptor type

Definition at line 370 of file usb_std.h.

◆ bEndpointAddress

uint8_t usb_endpoint_desc_type::bEndpointAddress

the address of the endpoint on the usb device described by this descriptor

Definition at line 371 of file usb_std.h.

◆ bInterval

uint8_t usb_endpoint_desc_type::bInterval

interval for polling endpoint for data transfers

Definition at line 374 of file usb_std.h.

◆ bLength

uint8_t usb_endpoint_desc_type::bLength

size of this descriptor in bytes

Definition at line 369 of file usb_std.h.

◆ bmAttributes

uint8_t usb_endpoint_desc_type::bmAttributes

describes the endpoints attributes when it is configured using bConfiguration value

Definition at line 372 of file usb_std.h.

◆ wMaxPacketSize

uint16_t usb_endpoint_desc_type::wMaxPacketSize

maximum packet size this endpoint

Definition at line 373 of file usb_std.h.

The documentation for this struct was generated from the following file:
  • usb_std.h


AT32F413 Firmwary Library: usb_header_desc_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
usb_header_desc_type Struct Reference
AT32F413_middlewares_usbd_drivers » USB_standard » USB_standard_exported_types

format of header More...

#include <usb_std.h>

Data Fields

uint8_t | bLength
uint8_t | bDescriptorType

Detailed Description

format of header

Definition at line 380 of file usb_std.h.

Field Documentation

◆ bDescriptorType

uint8_t usb_header_desc_type::bDescriptorType

descriptor type

Definition at line 383 of file usb_std.h.

◆ bLength

uint8_t usb_header_desc_type::bLength

size of this descriptor in bytes

Definition at line 382 of file usb_std.h.

The documentation for this struct was generated from the following file:
  • usb_std.h


AT32F413 Firmwary Library: UTILITIES_examples

Topics
UTILITIES_examples

Topics

FreeRTOS_demo
GEN_random_number_demo
SLIB_project_l0
SLIB_project_l1
USART_iap_app_led3_toggle
USART_iap_app_led4_toggle
USART_iap_bootloader
USB_iap_app_led3_toggle
USB_iap_app_led4_toggle
USB_iap_bootloader

Detailed Description

Generated by doxygen 1.12.0


AT32F413 Firmwary Library: FreeRTOS_demo

Functions | Variables
FreeRTOS_demo
UTILITIES_examples

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | DebugMon_Handler (void)
this function handles svcall exception.
void | led2_task_function (void *pvParameters)
void | led3_task_function (void *pvParameters)
int | main (void)
main function.

Variables

TaskHandle_t | led2_handler
TaskHandle_t | led3_handler

Detailed Description

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file utilities/at32f413_freertos_demo/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles svcall exception.

this function handles debug monitor exception.

Parameters
none
Return values
none

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file utilities/at32f413_freertos_demo/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file utilities/at32f413_freertos_demo/src/at32f413_int.c.

◆ led2_task_function()

void led2_task_function ( void * pvParameters )

Definition at line 104 of file utilities/at32f413_freertos_demo/src/main.c.

Referenced by main().

◆ led3_task_function()

void led3_task_function ( void * pvParameters )

Definition at line 114 of file utilities/at32f413_freertos_demo/src/main.c.

Referenced by main().

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 51 of file utilities/at32f413_freertos_demo/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file utilities/at32f413_freertos_demo/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file utilities/at32f413_freertos_demo/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file utilities/at32f413_freertos_demo/src/at32f413_int.c.

Variable Documentation

◆ led2_handler

TaskHandle_t led2_handler

Definition at line 38 of file utilities/at32f413_freertos_demo/src/main.c.

Referenced by main().

◆ led3_handler

TaskHandle_t led3_handler

Definition at line 39 of file utilities/at32f413_freertos_demo/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: GEN_random_number_demo

Topics | Macros | Functions
GEN_random_number_demo
UTILITIES_examples

Topics

RTC_asseed_definition
GEN_random_number_demo_exported_functions

Macros

#define DEVICE_ID_ADDR1 0x1FFFF7E8

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
int | main (void)
main function.
int | get_uid_for_seed (void)
get uid value as seed
void | randnum_test (void)
enable rtc as seed

Detailed Description

Macro Definition Documentation

◆ DEVICE_ID_ADDR1

#define DEVICE_ID_ADDR1 0x1FFFF7E8

Definition at line 40 of file random.c.

Referenced by get_uid_for_seed().

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file utilities/at32f413_gen_random_number_demo/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file utilities/at32f413_gen_random_number_demo/src/at32f413_int.c.

◆ get_uid_for_seed()

int get_uid_for_seed ( void )

get uid value as seed

Parameters
none
Return values
uid_one_word

Definition at line 47 of file random.c.

Referenced by randnum_test().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file utilities/at32f413_gen_random_number_demo/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 44 of file utilities/at32f413_gen_random_number_demo/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file utilities/at32f413_gen_random_number_demo/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file utilities/at32f413_gen_random_number_demo/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file utilities/at32f413_gen_random_number_demo/src/at32f413_int.c.

◆ randnum_test()

void randnum_test ( void )

enable rtc as seed

Parameters
none
Return values
none

random number test

Parameters
none
Return values
none

Definition at line 121 of file random.c.

Referenced by main().

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file utilities/at32f413_gen_random_number_demo/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file utilities/at32f413_gen_random_number_demo/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file utilities/at32f413_gen_random_number_demo/src/at32f413_int.c.


AT32F413 Firmwary Library: RTC_asseed_definition

Macros
RTC_asseed_definition
UTILITIES_examples » GEN_random_number_demo

Macros

#define ENABLE_RTC_ASSEED (1)

Detailed Description

Macro Definition Documentation

◆ ENABLE_RTC_ASSEED

#define ENABLE_RTC_ASSEED (1)

Definition at line 48 of file random.h.


AT32F413 Firmwary Library: GEN_random_number_demo_exported_functions

Functions
GEN_random_number_demo_exported_functions
UTILITIES_examples » GEN_random_number_demo

Functions

void randnum_test (void)
enable rtc as seed

Detailed Description

Function Documentation

◆ randnum_test()

void randnum_test ( void )

enable rtc as seed

Parameters
none
Return values
none

random number test

Parameters
none
Return values
none

Definition at line 121 of file random.c.

Referenced by main().


AT32F413 Firmwary Library: SLIB_project_l0

Macros | Functions | Variables
SLIB_project_l0
UTILITIES_examples

Macros

#define | USE_SLIB_FUNCTION /* define it when user want to activate slib in this project */
#define | FLASH_START_ADDR 0x08000000
#define | TEST_SLIB_PSW 0x55665566
#define | SLIB_START_ADDR 0x0800D800
#define | SLIB_DATA_ADDR 0x0800E800
#define | SLIB_END_ADDR 0x0800F000
#define | FLASH_SECTOR_SIZE 0x800
#define | SECTOR_NUM(dwAddr)
#define | SECTOR_WORD_CNT (FLASH_SECTOR_SIZE >> 2) /* words per sector */
#define | SNR_THRESHOLD_F32 140.0f
#define | TEST_LENGTH_SAMPLES 320

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | FLASH_IRQHandler (void)
flash handler.
flash_status_type | slib_enable (void)
config slib enable and program slib area.
void | config_flash_interrupt (void)
config flash error interrupt.
int | main (void)
main function.

Variables

uint32_t | dw_start_sector
uint32_t | dw_data_start_sector
uint32_t | dw_end_sector
uint32_t | temp_buf [512]
static float32_t | testOutput [320]

Detailed Description

Macro Definition Documentation

◆ FLASH_SECTOR_SIZE

#define FLASH_SECTOR_SIZE 0x800

Definition at line 51 of file utilities/at32f413_slib_demo/project_l0/src/main.c.

Referenced by slib_enable().

◆ FLASH_START_ADDR

#define FLASH_START_ADDR 0x08000000

Definition at line 46 of file utilities/at32f413_slib_demo/project_l0/src/main.c.

◆ SECTOR_NUM

#define SECTOR_NUM ( dwAddr )
Value:
((dwAddr & (FLASH_START_ADDR - 1)) / FLASH_SECTOR_SIZE)
FLASH_SECTOR_SIZE
#define FLASH_SECTOR_SIZE
Definition utilities/at32f413_slib_demo/project_l0/src/main.c:51
FLASH_START_ADDR
#define FLASH_START_ADDR
Definition utilities/at32f413_slib_demo/project_l0/src/main.c:46

Definition at line 52 of file utilities/at32f413_slib_demo/project_l0/src/main.c.

Referenced by slib_enable().

◆ SECTOR_WORD_CNT

#define SECTOR_WORD_CNT (FLASH_SECTOR_SIZE >> 2) /* words per sector */

Definition at line 53 of file utilities/at32f413_slib_demo/project_l0/src/main.c.

Referenced by slib_enable().

◆ SLIB_DATA_ADDR

#define SLIB_DATA_ADDR 0x0800E800

Definition at line 49 of file utilities/at32f413_slib_demo/project_l0/src/main.c.

Referenced by slib_enable().

◆ SLIB_END_ADDR

#define SLIB_END_ADDR 0x0800F000

Definition at line 50 of file utilities/at32f413_slib_demo/project_l0/src/main.c.

Referenced by slib_enable().

◆ SLIB_START_ADDR

#define SLIB_START_ADDR 0x0800D800

Definition at line 48 of file utilities/at32f413_slib_demo/project_l0/src/main.c.

Referenced by slib_enable().

◆ SNR_THRESHOLD_F32

#define SNR_THRESHOLD_F32 140.0f

Definition at line 55 of file utilities/at32f413_slib_demo/project_l0/src/main.c.

Referenced by main().

◆ TEST_LENGTH_SAMPLES

#define TEST_LENGTH_SAMPLES 320

Definition at line 56 of file utilities/at32f413_slib_demo/project_l0/src/main.c.

Referenced by main().

◆ TEST_SLIB_PSW

#define TEST_SLIB_PSW 0x55665566

Definition at line 47 of file utilities/at32f413_slib_demo/project_l0/src/main.c.

Referenced by slib_enable().

◆ USE_SLIB_FUNCTION

#define USE_SLIB_FUNCTION /* define it when user want to activate slib in this project */

Definition at line 43 of file utilities/at32f413_slib_demo/project_l0/src/main.c.

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 78 of file utilities/at32f413_slib_demo/project_l0/src/at32f413_int.c.

◆ config_flash_interrupt()

void config_flash_interrupt ( void )

config flash error interrupt.

Parameters
none
Return values
flash status

< flash bank1 error interrupt

Definition at line 75 of file utilities/at32f413_slib_demo/project_l0/src/main.c.

Referenced by main().

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 113 of file utilities/at32f413_slib_demo/project_l0/src/at32f413_int.c.

◆ FLASH_IRQHandler()

void FLASH_IRQHandler ( void )

flash handler.

Parameters
none
Return values
none

< flash bank1 erase/program protection error flag

< flash bank1 erase/program protection error flag

Definition at line 140 of file utilities/at32f413_slib_demo/project_l0/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 52 of file utilities/at32f413_slib_demo/project_l0/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 128 of file utilities/at32f413_slib_demo/project_l0/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 65 of file utilities/at32f413_slib_demo/project_l0/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 43 of file utilities/at32f413_slib_demo/project_l0/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 122 of file utilities/at32f413_slib_demo/project_l0/src/at32f413_int.c.

◆ slib_enable()

flash_status_type slib_enable ( void )

config slib enable and program slib area.

Parameters
none
Return values
flash status

Definition at line 92 of file utilities/at32f413_slib_demo/project_l0/src/main.c.

Referenced by main().

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 104 of file utilities/at32f413_slib_demo/project_l0/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 131 of file utilities/at32f413_slib_demo/project_l0/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 91 of file utilities/at32f413_slib_demo/project_l0/src/at32f413_int.c.

Variable Documentation

◆ dw_data_start_sector

uint32_t dw_data_start_sector

Definition at line 59 of file utilities/at32f413_slib_demo/project_l0/src/main.c.

Referenced by slib_enable().

◆ dw_end_sector

uint32_t dw_end_sector

Definition at line 59 of file utilities/at32f413_slib_demo/project_l0/src/main.c.

Referenced by slib_enable().

◆ dw_start_sector

uint32_t dw_start_sector

Definition at line 59 of file utilities/at32f413_slib_demo/project_l0/src/main.c.

Referenced by slib_enable().

◆ temp_buf

uint32_t temp_buf[512]

Definition at line 60 of file utilities/at32f413_slib_demo/project_l0/src/main.c.

Referenced by slib_enable().

◆ testOutput

float32_t testOutput[320]
static

Definition at line 63 of file utilities/at32f413_slib_demo/project_l0/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: SLIB_project_l1

Macros | Functions | Variables
SLIB_project_l1
UTILITIES_examples

Macros

#define | SNR_THRESHOLD_F32 140.0f
#define | TEST_LENGTH_SAMPLES 320

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | FLASH_IRQHandler (void)
flash handler.
void | config_flash_interrupt (void)
config flash error interrupt.
int | main (void)
main function.

Variables

static float32_t testOutput [320]

Detailed Description

Macro Definition Documentation

◆ SNR_THRESHOLD_F32

#define SNR_THRESHOLD_F32 140.0f

Definition at line 43 of file utilities/at32f413_slib_demo/project_l1/src/main.c.

Referenced by main().

◆ TEST_LENGTH_SAMPLES

#define TEST_LENGTH_SAMPLES 320

Definition at line 44 of file utilities/at32f413_slib_demo/project_l1/src/main.c.

Referenced by main().

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 78 of file utilities/at32f413_slib_demo/project_l1/src/at32f413_int.c.

◆ config_flash_interrupt()

void config_flash_interrupt ( void )

config flash error interrupt.

Parameters
none
Return values
flash status

< flash bank1 error interrupt

Definition at line 55 of file utilities/at32f413_slib_demo/project_l1/src/main.c.

Referenced by main().

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 113 of file utilities/at32f413_slib_demo/project_l1/src/at32f413_int.c.

◆ FLASH_IRQHandler()

void FLASH_IRQHandler ( void )

flash handler.

Parameters
none
Return values
none

< flash bank1 erase/program protection error flag

< flash bank1 erase/program protection error flag

Definition at line 140 of file utilities/at32f413_slib_demo/project_l1/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 52 of file utilities/at32f413_slib_demo/project_l1/src/at32f413_int.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 71 of file utilities/at32f413_slib_demo/project_l1/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 65 of file utilities/at32f413_slib_demo/project_l1/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 43 of file utilities/at32f413_slib_demo/project_l1/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 122 of file utilities/at32f413_slib_demo/project_l1/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 104 of file utilities/at32f413_slib_demo/project_l1/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 131 of file utilities/at32f413_slib_demo/project_l1/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 91 of file utilities/at32f413_slib_demo/project_l1/src/at32f413_int.c.

Variable Documentation

◆ testOutput

float32_t testOutput[320]
static

Definition at line 46 of file utilities/at32f413_slib_demo/project_l1/src/main.c.

Referenced by main().


AT32F413 Firmwary Library: USART_iap_app_led3_toggle

Topics | Functions | Variables
USART_iap_app_led3_toggle
UTILITIES_examples

Topics

App_led3_definition
App_led3_exported_functions

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | iap_command_handle (void)
iap command handle handle.
void | iap_init (void)
iap init.
int | main (void)
main function.
void | tmr_init (void)
init tmr.
void | TMR3_GLOBAL_IRQHandler (void)
tmr3 global interrupt handler.
void | uart_init (uint32_t baudrate)
init usart.
void | USART1_IRQHandler (void)
usart1 interrupt handler.
void | back_ok (void)
command response ok.
void | back_err (void)
command response error.

Variables

uint8_t iap_flag = IAP_REV_FLAG_NO

Detailed Description

Function Documentation

◆ back_err()

void back_err ( void )

command response error.

Parameters
none
Return values
none

Definition at line 119 of file app_led3_toggle/src/usart.c.

◆ back_ok()

void back_ok ( void )

command response ok.

Parameters
none
Return values
none

Definition at line 106 of file app_led3_toggle/src/usart.c.

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c.

◆ iap_command_handle()

void iap_command_handle ( void )

iap command handle handle.

Parameters
none
Return values
none

Definition at line 43 of file app_led3_toggle/src/iap.c.

◆ iap_init()

void iap_init ( void )

iap init.

Parameters
none
Return values
none

Definition at line 60 of file app_led3_toggle/src/iap.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< nvic vector table based flash address

Definition at line 45 of file utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c.

◆ TMR3_GLOBAL_IRQHandler()

void TMR3_GLOBAL_IRQHandler ( void )

tmr3 global interrupt handler.

Parameters
none
Return values
none

Definition at line 71 of file app_led3_toggle/src/tmr.c.

◆ tmr_init()

void tmr_init ( void )

init tmr.

Parameters
none
Return values
none

Definition at line 43 of file app_led3_toggle/src/tmr.c.

◆ uart_init()

void uart_init ( uint32_t baudrate )

init usart.

Parameters
none
Return values
none

Definition at line 44 of file app_led3_toggle/src/usart.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c.

◆ USART1_IRQHandler()

void USART1_IRQHandler ( void )

usart1 interrupt handler.

Parameters
none
Return values
none

Definition at line 86 of file app_led3_toggle/src/usart.c.

Variable Documentation

◆ iap_flag

uint8_t iap_flag = IAP_REV_FLAG_NO

Definition at line 37 of file app_led3_toggle/src/usart.c.

Referenced by USART1_IRQHandler().


AT32F413 Firmwary Library: App_led3_definition

Macros
App_led3_definition
UTILITIES_examples » USART_iap_app_led3_toggle

Macros

#define | APP_START_ADDR 0x08004000
#define | IAP_UPGRADE_FLAG_ADDR (APP_START_ADDR - 0x800)
#define | IAP_UPGRADE_FLAG 0x41544B38
#define | IAP_REV_FLAG_NO 0
#define | IAP_REV_FLAG_5A 1
#define | IAP_REV_FLAG_DONE 2
#define | IAP_REV_FLAG_ERROR 3

Detailed Description

Macro Definition Documentation

◆ APP_START_ADDR

#define APP_START_ADDR 0x08004000

Definition at line 48 of file app_led3_toggle/inc/iap.h.

Referenced by app_update_handle(), and main().

◆ IAP_REV_FLAG_5A

#define IAP_REV_FLAG_5A 1

Definition at line 50 of file app_led3_toggle/inc/usart.h.

Referenced by USART1_IRQHandler().

◆ IAP_REV_FLAG_DONE

#define IAP_REV_FLAG_DONE 2

Definition at line 51 of file app_led3_toggle/inc/usart.h.

Referenced by iap_command_handle(), and USART1_IRQHandler().

◆ IAP_REV_FLAG_ERROR

#define IAP_REV_FLAG_ERROR 3

Definition at line 52 of file app_led3_toggle/inc/usart.h.

◆ IAP_REV_FLAG_NO

#define IAP_REV_FLAG_NO 0

Definition at line 49 of file app_led3_toggle/inc/usart.h.

Referenced by USART1_IRQHandler().

◆ IAP_UPGRADE_FLAG

#define IAP_UPGRADE_FLAG 0x41544B38

Definition at line 55 of file app_led3_toggle/inc/iap.h.

Referenced by flash_upgrade_flag_read(), iap_command_handle(), and iap_init().

◆ IAP_UPGRADE_FLAG_ADDR

#define IAP_UPGRADE_FLAG_ADDR (APP_START_ADDR - 0x800)

Definition at line 51 of file app_led3_toggle/inc/iap.h.

Referenced by flash_upgrade_flag_read(), iap_command_handle(), and iap_init().


AT32F413 Firmwary Library: App_led3_exported_functions

Functions
App_led3_exported_functions
UTILITIES_examples » USART_iap_app_led3_toggle

Functions

void | iap_command_handle (void)
iap command handle handle.
void | iap_init (void)
iap init.
void | tmr_init (void)
init tmr.
void | uart_init (uint32_t baudrate)
init usart.
void | back_ok (void)
command response ok.
void | back_err (void)
command response error.

Detailed Description

Function Documentation

◆ back_err()

void back_err ( void )

command response error.

Parameters
none
Return values
none

Definition at line 119 of file app_led3_toggle/src/usart.c.

Referenced by TMR3_GLOBAL_IRQHandler().

◆ back_ok()

void back_ok ( void )

command response ok.

Parameters
none
Return values
none

Definition at line 106 of file app_led3_toggle/src/usart.c.

Referenced by main().

◆ iap_command_handle()

void iap_command_handle ( void )

iap command handle handle.

Parameters
none
Return values
none

Definition at line 43 of file app_led3_toggle/src/iap.c.

Referenced by main().

◆ iap_init()

void iap_init ( void )

iap init.

Parameters
none
Return values
none

iap init.

Parameters
none
Return values
none

Definition at line 60 of file app_led3_toggle/src/iap.c.

Referenced by main().

◆ tmr_init()

void tmr_init ( void )

init tmr.

Parameters
none
Return values
none

Definition at line 43 of file app_led3_toggle/src/tmr.c.

Referenced by main().

◆ uart_init()

void uart_init ( uint32_t baudrate )

init usart.

Parameters
none
Return values
none

Definition at line 44 of file app_led3_toggle/src/usart.c.


AT32F413 Firmwary Library: USART_iap_app_led4_toggle

Topics | Functions | Variables
USART_iap_app_led4_toggle
UTILITIES_examples

Topics

App_led4_definition
App_led4_exported_functions

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | iap_command_handle (void)
iap command handle handle.
void | iap_init (void)
iap init.
int | main (void)
main function.
void | tmr_init (void)
init tmr.
void | TMR3_GLOBAL_IRQHandler (void)
tmr3 global interrupt handler.
void | uart_init (uint32_t baudrate)
init usart.
void | USART1_IRQHandler (void)
usart1 interrupt handler.
void | back_ok (void)
command response ok.
void | back_err (void)
command response error.

Variables

uint8_t iap_flag = IAP_REV_FLAG_NO

Detailed Description

Function Documentation

◆ back_err()

void back_err ( void )

command response error.

Parameters
none
Return values
none

Definition at line 119 of file app_led4_toggle/src/usart.c.

◆ back_ok()

void back_ok ( void )

command response ok.

Parameters
none
Return values
none

Definition at line 106 of file app_led4_toggle/src/usart.c.

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c.

◆ iap_command_handle()

void iap_command_handle ( void )

iap command handle handle.

Parameters
none
Return values
none

Definition at line 43 of file app_led4_toggle/src/iap.c.

Referenced by main().

◆ iap_init()

void iap_init ( void )

iap init.

Parameters
none
Return values
none

Definition at line 60 of file app_led4_toggle/src/iap.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< nvic vector table based flash address

Definition at line 45 of file utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c.

◆ TMR3_GLOBAL_IRQHandler()

void TMR3_GLOBAL_IRQHandler ( void )

tmr3 global interrupt handler.

Parameters
none
Return values
none

Definition at line 71 of file app_led4_toggle/src/tmr.c.

◆ tmr_init()

void tmr_init ( void )

init tmr.

Parameters
none
Return values
none

Definition at line 43 of file app_led4_toggle/src/tmr.c.

◆ uart_init()

void uart_init ( uint32_t baudrate )

init usart.

Parameters
none
Return values
none

Definition at line 44 of file app_led4_toggle/src/usart.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c.

◆ USART1_IRQHandler()

void USART1_IRQHandler ( void )

usart1 interrupt handler.

Parameters
none
Return values
none

Definition at line 86 of file app_led4_toggle/src/usart.c.

Variable Documentation

◆ iap_flag

uint8_t iap_flag = IAP_REV_FLAG_NO

Definition at line 37 of file app_led4_toggle/src/usart.c.

Referenced by iap_command_handle(), and USART1_IRQHandler().


AT32F413 Firmwary Library: App_led4_definition

Macros
App_led4_definition
UTILITIES_examples » USART_iap_app_led4_toggle

Macros

#define | APP_START_ADDR 0x08004000
#define | IAP_UPGRADE_FLAG_ADDR (APP_START_ADDR - 0x800)
#define | IAP_UPGRADE_FLAG 0x41544B38
#define | IAP_REV_FLAG_NO 0
#define | IAP_REV_FLAG_5A 1
#define | IAP_REV_FLAG_DONE 2
#define | IAP_REV_FLAG_ERROR 3

Detailed Description

Macro Definition Documentation

◆ APP_START_ADDR

#define APP_START_ADDR 0x08004000

Definition at line 48 of file app_led4_toggle/inc/iap.h.

◆ IAP_REV_FLAG_5A

#define IAP_REV_FLAG_5A 1

Definition at line 50 of file app_led4_toggle/inc/usart.h.

◆ IAP_REV_FLAG_DONE

#define IAP_REV_FLAG_DONE 2

Definition at line 51 of file app_led4_toggle/inc/usart.h.

◆ IAP_REV_FLAG_ERROR

#define IAP_REV_FLAG_ERROR 3

Definition at line 52 of file app_led4_toggle/inc/usart.h.

◆ IAP_REV_FLAG_NO

#define IAP_REV_FLAG_NO 0

Definition at line 49 of file app_led4_toggle/inc/usart.h.

◆ IAP_UPGRADE_FLAG

#define IAP_UPGRADE_FLAG 0x41544B38

Definition at line 55 of file app_led4_toggle/inc/iap.h.

◆ IAP_UPGRADE_FLAG_ADDR

#define IAP_UPGRADE_FLAG_ADDR (APP_START_ADDR - 0x800)

Definition at line 51 of file app_led4_toggle/inc/iap.h.


AT32F413 Firmwary Library: App_led4_exported_functions

Functions
App_led4_exported_functions
UTILITIES_examples » USART_iap_app_led4_toggle

Functions

void | iap_command_handle (void)
iap command handle handle.
void | iap_init (void)
iap init.
void | tmr_init (void)
init tmr.
void | uart_init (uint32_t baudrate)
init usart.
void | back_ok (void)
command response ok.
void | back_err (void)
command response error.

Detailed Description

Function Documentation

◆ back_err()

void back_err ( void )

command response error.

Parameters
none
Return values
none

Definition at line 119 of file app_led3_toggle/src/usart.c.

◆ back_ok()

void back_ok ( void )

command response ok.

Parameters
none
Return values
none

Definition at line 106 of file app_led3_toggle/src/usart.c.

◆ iap_command_handle()

void iap_command_handle ( void )

iap command handle handle.

Parameters
none
Return values
none

Definition at line 43 of file app_led3_toggle/src/iap.c.

◆ iap_init()

void iap_init ( void )

iap init.

Parameters
none
Return values
none

iap init.

Parameters
none
Return values
none

Definition at line 60 of file app_led3_toggle/src/iap.c.

◆ tmr_init()

void tmr_init ( void )

init tmr.

Parameters
none
Return values
none

Definition at line 43 of file app_led3_toggle/src/tmr.c.

◆ uart_init()

void uart_init ( uint32_t baudrate )

init usart.

Parameters
none
Return values
none

Definition at line 44 of file app_led3_toggle/src/usart.c.


AT32F413 Firmwary Library: USART_iap_bootloader

Topics | Functions | Variables
USART_iap_bootloader
UTILITIES_examples

Topics

Bootloader_definition
Bootloader_exported_functions
Bootloader_exported_types

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | flash_2kb_write (uint32_t write_addr, uint8_t *pbuffer)
flash erase/program operation.
flag_status | flash_upgrade_flag_read (void)
check flash upgrade flag.
void | app_load (uint32_t app_addr)
app load.
uint8_t | data_take (void)
take data from usart buf.
void | command_handle (void)
command analysis handle.
void | back_ok (void)
command response ok.
void | back_err (void)
command response error.
void | app_update_handle (void)
app update flow handle.
void | iap_upgrade_app_handle (void)
iap upgrade app handle.
int | main (void)
main function.
void | tmr_init (void)
init tmr.
void | TMR3_GLOBAL_IRQHandler (void)
tmr3 global interrupt handler.
void | uart_init (uint32_t baudrate)
init usart.
void | USART1_IRQHandler (void)
usart1 interrupt handler.

Variables

cmd_data_group_type cmd_data_group_type_struct
cmd_data_step_type cmd_data_step
cmd_ctr_step_type cmd_ctr_step
update_status_type update_status
usart_group_type usart_group_struct
cmd_data_step_type cmd_data_step = CMD_DATA_IDLE
cmd_ctr_step_type cmd_ctr_step = CMD_CTR_IDLE
cmd_data_group_type cmd_data_group_struct
update_status_type update_status = UPDATE_PRE
static uint8_t | cmd_addr_cnt = 0
static uint32_t | cmd_data_cnt = 0
iapfun jump_to_app
uint8_t | time_ira_cnt =0
uint8_t | get_data_from_usart_flag = 0
usart_group_type usart_group_struct

Detailed Description

Function Documentation

◆ app_load()

void app_load ( uint32_t app_addr )

app load.

Parameters
app_addr app code starting address
Return values
none

Definition at line 66 of file bootloader/src/iap.c.

Referenced by app_update_handle(), and main().

◆ app_update_handle()

void app_update_handle ( void )

app update flow handle.

Parameters
none
Return values
none

Definition at line 268 of file bootloader/src/iap.c.

Referenced by iap_upgrade_app_handle().

◆ back_err()

void back_err ( void )

command response error.

Parameters
none
Return values
none

Definition at line 247 of file bootloader/src/iap.c.

Referenced by app_update_handle(), and TMR3_GLOBAL_IRQHandler().

◆ back_ok()

void back_ok ( void )

command response ok.

Parameters
none
Return values
none

Definition at line 234 of file bootloader/src/iap.c.

Referenced by app_update_handle(), and main().

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file utilities/at32f413_usart_iap_demo/source_code/bootloader/src/at32f413_int.c.

◆ command_handle()

void command_handle ( void )

command analysis handle.

Parameters
none
Return values
none

Definition at line 112 of file bootloader/src/iap.c.

Referenced by iap_upgrade_app_handle().

◆ data_take()

uint8_t data_take ( void )

take data from usart buf.

Parameters
app_addr app code starting address
Return values
val took data

Definition at line 95 of file bootloader/src/iap.c.

Referenced by command_handle().

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file utilities/at32f413_usart_iap_demo/source_code/bootloader/src/at32f413_int.c.

◆ flash_2kb_write()

void flash_2kb_write | ( | uint32_t | write_addr,
 |  | uint8_t * | pbuffer )

flash erase/program operation.

Note
follow 2kb operation of ont time
Parameters
none
Return values
none

Definition at line 44 of file utilities/at32f413_usart_iap_demo/source_code/bootloader/src/flash.c.

Referenced by app_update_handle().

◆ flash_upgrade_flag_read()

flag_status flash_upgrade_flag_read ( void )

check flash upgrade flag.

Parameters
none
Return values
none

Definition at line 65 of file utilities/at32f413_usart_iap_demo/source_code/bootloader/src/flash.c.

Referenced by main().

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file utilities/at32f413_usart_iap_demo/source_code/bootloader/src/at32f413_int.c.

◆ iap_upgrade_app_handle()

void iap_upgrade_app_handle ( void )

iap upgrade app handle.

Parameters
none
Return values
none

Definition at line 350 of file bootloader/src/iap.c.

Referenced by main().

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 46 of file utilities/at32f413_usart_iap_demo/source_code/bootloader/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file utilities/at32f413_usart_iap_demo/source_code/bootloader/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file utilities/at32f413_usart_iap_demo/source_code/bootloader/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file utilities/at32f413_usart_iap_demo/source_code/bootloader/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file utilities/at32f413_usart_iap_demo/source_code/bootloader/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file utilities/at32f413_usart_iap_demo/source_code/bootloader/src/at32f413_int.c.

◆ TMR3_GLOBAL_IRQHandler()

void TMR3_GLOBAL_IRQHandler ( void )

tmr3 global interrupt handler.

Parameters
none
Return values
none

Definition at line 74 of file bootloader/src/tmr.c.

◆ tmr_init()

void tmr_init ( void )

init tmr.

Parameters
none
Return values
none

Definition at line 46 of file bootloader/src/tmr.c.

Referenced by main().

◆ uart_init()

void uart_init ( uint32_t baudrate )

init usart.

Parameters
none
Return values
none

Definition at line 44 of file bootloader/src/usart.c.

Referenced by main().

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file utilities/at32f413_usart_iap_demo/source_code/bootloader/src/at32f413_int.c.

◆ USART1_IRQHandler()

void USART1_IRQHandler ( void )

usart1 interrupt handler.

Parameters
none
Return values
none

Definition at line 86 of file bootloader/src/usart.c.

Variable Documentation

◆ cmd_addr_cnt

uint8_t cmd_addr_cnt = 0
static

Definition at line 43 of file bootloader/src/iap.c.

Referenced by back_err(), and command_handle().

◆ cmd_ctr_step [1/2]

cmd_ctr_step_type cmd_ctr_step
extern

Definition at line 40 of file bootloader/src/iap.c.

Referenced by app_update_handle(), back_err(), and command_handle().

◆ cmd_ctr_step [2/2]

cmd_ctr_step_type cmd_ctr_step = CMD_CTR_IDLE

Definition at line 40 of file bootloader/src/iap.c.

Referenced by app_update_handle(), back_err(), and command_handle().

◆ cmd_data_cnt

uint32_t cmd_data_cnt = 0
static

Definition at line 44 of file bootloader/src/iap.c.

Referenced by back_err(), and command_handle().

◆ cmd_data_group_struct

cmd_data_group_type cmd_data_group_struct

Definition at line 41 of file bootloader/src/iap.c.

Referenced by app_update_handle(), and command_handle().

◆ cmd_data_group_type_struct

cmd_data_group_type cmd_data_group_type_struct
extern

◆ cmd_data_step [1/2]

cmd_data_step_type cmd_data_step
extern

Definition at line 39 of file bootloader/src/iap.c.

Referenced by app_update_handle(), back_err(), and command_handle().

◆ cmd_data_step [2/2]

cmd_data_step_type cmd_data_step = CMD_DATA_IDLE

Definition at line 39 of file bootloader/src/iap.c.

Referenced by app_update_handle(), back_err(), and command_handle().

◆ get_data_from_usart_flag

uint8_t get_data_from_usart_flag = 0

Definition at line 39 of file bootloader/src/tmr.c.

Referenced by app_update_handle(), back_err(), and TMR3_GLOBAL_IRQHandler().

◆ jump_to_app

iapfun jump_to_app

Definition at line 45 of file bootloader/src/iap.c.

Referenced by app_load(), flash_fat16_loop_status(), iap_loop(), and main().

◆ time_ira_cnt

uint8_t time_ira_cnt =0

Definition at line 38 of file bootloader/src/tmr.c.

Referenced by back_err(), TMR3_GLOBAL_IRQHandler(), and USART1_IRQHandler().

◆ update_status [1/2]

update_status_type update_status
extern

Definition at line 42 of file bootloader/src/iap.c.

Referenced by app_update_handle(), back_err(), and command_handle().

◆ update_status [2/2]

update_status_type update_status = UPDATE_PRE

Definition at line 42 of file bootloader/src/iap.c.

Referenced by app_update_handle(), back_err(), and command_handle().

◆ usart_group_struct [1/2]

usart_group_type usart_group_struct
extern

Definition at line 37 of file bootloader/src/usart.c.

Referenced by command_handle(), data_take(), and USART1_IRQHandler().

◆ usart_group_struct [2/2]

usart_group_type usart_group_struct

Definition at line 37 of file bootloader/src/usart.c.

Referenced by command_handle(), data_take(), and USART1_IRQHandler().


AT32F413 Firmwary Library: Bootloader_definition

Macros
Bootloader_definition
UTILITIES_examples » USART_iap_bootloader | UTILITIES_examples » USB_iap_bootloader

Macros

#define | FLASH_SIZE (*((uint32_t*)0x1FFFF7E0)) /* read from at32 flash capacity register(unit:kbyte) */
#define | SRAM_SIZE 64 /* sram size, unit:kbyte */
#define | APP_START_ADDR 0x08004000
#define | IAP_UPGRADE_FLAG_ADDR (APP_START_ADDR - 0x800)
#define | IAP_UPGRADE_FLAG 0x41544B38
#define | USART_REC_LEN 1024
#define | FLASH_APP_ADDRESS 0x08006000

Detailed Description

Macro Definition Documentation

◆ APP_START_ADDR

#define APP_START_ADDR 0x08004000

Definition at line 48 of file bootloader/inc/iap.h.

◆ FLASH_APP_ADDRESS

#define FLASH_APP_ADDRESS 0x08006000

Definition at line 48 of file bootloader/inc/hid_iap_user.h.

◆ FLASH_SIZE

#define FLASH_SIZE (*((uint32_t*)0x1FFFF7E0)) /* read from at32 flash capacity register(unit:kbyte) */

Definition at line 47 of file utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/flash.h.

Referenced by app_update_handle(), and flash_2kb_write().

◆ IAP_UPGRADE_FLAG

#define IAP_UPGRADE_FLAG 0x41544B38

Definition at line 55 of file bootloader/inc/iap.h.

◆ IAP_UPGRADE_FLAG_ADDR

#define IAP_UPGRADE_FLAG_ADDR (APP_START_ADDR - 0x800)

Definition at line 51 of file bootloader/inc/iap.h.

◆ SRAM_SIZE

#define SRAM_SIZE 64 /* sram size, unit:kbyte */

Definition at line 48 of file utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/flash.h.

Referenced by app_load().

◆ USART_REC_LEN

#define USART_REC_LEN 1024

Definition at line 47 of file bootloader/inc/usart.h.

Referenced by data_take(), and USART1_IRQHandler().


AT32F413 Firmwary Library: Bootloader_exported_functions

Functions
Bootloader_exported_functions
UTILITIES_examples » USART_iap_bootloader | UTILITIES_examples » USB_iap_bootloader

Functions

void | flash_2kb_write (uint32_t write_addr, uint8_t *pbuffer)
flash erase/program operation.
flag_status | flash_upgrade_flag_read (void)
check flash upgrade flag.
void | command_handle (void)
command analysis handle.
void | back_err (void)
command response error.
void | back_ok (void)
command response ok.
void | iap_upgrade_app_handle (void)
iap upgrade app handle.
void | app_load (uint32_t appxaddr)
app load.
void | tmr_init (void)
init tmr.
void | uart_init (uint32_t baudrate)
init usart.
void | iap_init (void)
iap init.
iap_result_type | iap_get_upgrade_flag (void)
get iap upgrade complete flag
void | iap_loop (void)
iap loop
void | jump_to_app (uint32_t address)
jump to app

Detailed Description

Function Documentation

◆ app_load()

void app_load ( uint32_t app_addr )

app load.

Parameters
app_addr app code starting address
Return values
none

Definition at line 66 of file bootloader/src/iap.c.

Referenced by app_update_handle(), and main().

◆ back_err()

void back_err ( void )

command response error.

Parameters
none
Return values
none

Definition at line 119 of file app_led3_toggle/src/usart.c.

Referenced by app_update_handle().

◆ back_ok()

void back_ok ( void )

command response ok.

Parameters
none
Return values
none

Definition at line 106 of file app_led3_toggle/src/usart.c.

Referenced by app_update_handle().

◆ command_handle()

void command_handle ( void )

command analysis handle.

Parameters
none
Return values
none

Definition at line 112 of file bootloader/src/iap.c.

Referenced by iap_upgrade_app_handle().

◆ flash_2kb_write()

void flash_2kb_write | ( | uint32_t | write_addr,
 |  | uint8_t * | pbuffer )

flash erase/program operation.

Note
follow 2kb operation of ont time
Parameters
none
Return values
none

Definition at line 44 of file utilities/at32f413_usart_iap_demo/source_code/bootloader/src/flash.c.

Referenced by app_update_handle().

◆ flash_upgrade_flag_read()

flag_status flash_upgrade_flag_read ( void )

check flash upgrade flag.

Parameters
none
Return values
none

Definition at line 65 of file utilities/at32f413_usart_iap_demo/source_code/bootloader/src/flash.c.

Referenced by main().

◆ iap_get_upgrade_flag()

iap_result_type iap_get_upgrade_flag ( void )

get iap upgrade complete flag

Parameters
none
Return values
the status of the iap flag

Definition at line 78 of file app_led3_toggle/src/hid_iap_user.c.

◆ iap_init()

void iap_init ( void )

iap init.

Parameters
none
Return values
none

iap init.

Parameters
none
Return values
none

Definition at line 60 of file app_led3_toggle/src/iap.c.

Referenced by iap_idle(), and iap_start().

◆ iap_loop()

void iap_loop ( void )

iap loop

Parameters
none
Return values
none

Definition at line 485 of file bootloader/src/hid_iap_user.c.

Referenced by main().

◆ iap_upgrade_app_handle()

void iap_upgrade_app_handle ( void )

iap upgrade app handle.

Parameters
none
Return values
none

Definition at line 350 of file bootloader/src/iap.c.

Referenced by main().

◆ jump_to_app()

void jump_to_app ( uint32_t address )

jump to app

Parameters
none
Return values
none

Definition at line 249 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c.

◆ tmr_init()

void tmr_init ( void )

init tmr.

Parameters
none
Return values
none

Definition at line 43 of file app_led3_toggle/src/tmr.c.

◆ uart_init()

void uart_init ( uint32_t baudrate )

init usart.

Parameters
none
Return values
none

Definition at line 44 of file app_led3_toggle/src/usart.c.


AT32F413 Firmwary Library: Bootloader_exported_types

Data Structures | Typedefs | Enumerations
Bootloader_exported_types
UTILITIES_examples » USART_iap_bootloader

Data Structures

struct | cmd_data_group_type
cmd data group type More...
struct | usart_group_type
usart group type More...

Typedefs

typedef void(* iapfun) (void)

Enumerations

enum cmd_data_step_type {
CMD_DATA_IDLE , CMD_DATA_ADDR , CMD_DATA_BUF , CMD_DATA_CHACK ,
CMD_DATA_DONE , CMD_DATA_ERR
}
cmd data step type More...
enum cmd_ctr_step_type {
CMD_CTR_IDLE , CMD_CTR_INIT , CMD_CTR_DONE , CMD_CTR_ERR ,
CMD_CTR_APP
}
cmd ctr step type More...
enum update_status_type { UPDATE_PRE , UPDATE_CLEAR_FLAG , UPDATE_ING , UPDATE_DONE }
update status type More...

Detailed Description

Typedef Documentation

◆ iapfun

typedef void(* iapfun) (void)

Definition at line 112 of file bootloader/inc/iap.h.

Enumeration Type Documentation

◆ cmd_ctr_step_type

enum cmd_ctr_step_type

cmd ctr step type

Enumerator
CMD_CTR_IDLE
CMD_CTR_INIT
CMD_CTR_DONE
CMD_CTR_ERR
CMD_CTR_APP

Definition at line 92 of file bootloader/inc/iap.h.

◆ cmd_data_step_type

enum cmd_data_step_type

cmd data step type

Enumerator
CMD_DATA_IDLE
CMD_DATA_ADDR
CMD_DATA_BUF
CMD_DATA_CHACK
CMD_DATA_DONE
CMD_DATA_ERR

Definition at line 79 of file bootloader/inc/iap.h.

◆ update_status_type

enum update_status_type

update status type

Enumerator
UPDATE_PRE
UPDATE_CLEAR_FLAG
UPDATE_ING
UPDATE_DONE

Definition at line 104 of file bootloader/inc/iap.h.


AT32F413 Firmwary Library: cmd_data_group_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
cmd_data_group_type Struct Reference
UTILITIES_examples » USART_iap_bootloader » Bootloader_exported_types

cmd data group type More...

#include <iap.h>

Data Fields

uint8_t | cmd_head
uint8_t | cmd_addr [4]
uint8_t | cmd_buf [0x800]
uint8_t | cmd_check

Detailed Description

cmd data group type

Definition at line 68 of file bootloader/inc/iap.h.

Field Documentation

◆ cmd_addr

uint8_t cmd_data_group_type::cmd_addr[4]

Definition at line 71 of file bootloader/inc/iap.h.

Referenced by app_update_handle(), and command_handle().

◆ cmd_buf

uint8_t cmd_data_group_type::cmd_buf[0x800]

Definition at line 72 of file bootloader/inc/iap.h.

Referenced by app_update_handle(), and command_handle().

◆ cmd_check

uint8_t cmd_data_group_type::cmd_check

Definition at line 73 of file bootloader/inc/iap.h.

◆ cmd_head

uint8_t cmd_data_group_type::cmd_head

Definition at line 70 of file bootloader/inc/iap.h.

The documentation for this struct was generated from the following file:
  • bootloader/inc/iap.h


AT32F413 Firmwary Library: usart_group_type Struct Reference

  • Data Structure Index
  • Data Fields
Data Fields
usart_group_type Struct Reference
UTILITIES_examples » USART_iap_bootloader » Bootloader_exported_types

usart group type More...

#include <usart.h>

Data Fields

uint16_t | buf [1024]
uint16_t | head
uint16_t | tail
uint16_t | count

Detailed Description

usart group type

Definition at line 60 of file bootloader/inc/usart.h.

Field Documentation

◆ buf

uint16_t usart_group_type::buf[1024]

Definition at line 62 of file bootloader/inc/usart.h.

Referenced by data_take(), and USART1_IRQHandler().

◆ count

uint16_t usart_group_type::count

Definition at line 65 of file bootloader/inc/usart.h.

Referenced by command_handle(), data_take(), and USART1_IRQHandler().

◆ head

uint16_t usart_group_type::head

Definition at line 63 of file bootloader/inc/usart.h.

Referenced by USART1_IRQHandler().

◆ tail

uint16_t usart_group_type::tail

Definition at line 64 of file bootloader/inc/usart.h.

Referenced by data_take(), and USART1_IRQHandler().

The documentation for this struct was generated from the following file:
  • bootloader/inc/usart.h


AT32F413 Firmwary Library: USB_iap_app_led3_toggle

Topics | Macros | Functions | Variables
USB_iap_app_led3_toggle
UTILITIES_examples

Topics

App_led3_toggle_definition
App_led3_toggle_exported_functions

Macros

#define USB_EPT_AUTO_MALLOC_BUFFER
usb endpoint max num define

Functions

void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.
void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | iap_clear_upgrade_flag (void)
clear iap upgrade flag
void | iap_set_upgrade_flag (void)
set iap upgrade complete flag
uint32_t | crc_cal (uint32_t addr, uint16_t nk)
crc cal
void | iap_idle (void)
iap idle function
void | iap_start (void)
iap start function
void | iap_finish (void)
void | iap_jump (void)
void | iap_respond (uint8_t *res_buf, uint16_t iap_cmd, uint16_t result)
iap_result_type | iap_get_upgrade_flag (void)
get iap upgrade complete flag
void | iap_init (void)
iap init
void | iap_get ()
iap_result_type | usbd_hid_iap_process (void *udev, uint8_t *pdata, uint16_t len)
usb device iap function
void | usbd_hid_iap_in_complete (void *udev)
usb device in transfer complete function
void | app_loop (void)
iap loop
void | usb_clock48m_select (usb_clk48_s clk_s)
usb 48M clock select
void | USBFS_L_CAN1_RX0_IRQHandler (void)
this function handles usb interrupt.
int | main (void)
main function.

Variables

void(* pftarget )(void)
usbd_core_type usb_core_dev

Detailed Description

Macro Definition Documentation

◆ USB_EPT_AUTO_MALLOC_BUFFER

#define USB_EPT_AUTO_MALLOC_BUFFER

usb endpoint max num define

usb buffer extend to 768-1280 bytes

auto malloc usb endpoint buffer usb auto malloc endpoint tx and rx buffer

Definition at line 62 of file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/usb_conf.h.

Function Documentation

◆ app_loop()

void app_loop ( void )

iap loop

Parameters
none
Return values
none

Definition at line 252 of file app_led3_toggle/src/hid_iap_user.c.

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c.

◆ crc_cal()

uint32_t crc_cal | ( | uint32_t | addr,
 |  | uint16_t | nk )

crc cal

Parameters
addr | start address
nk | nk byte
Return values
crc value

Definition at line 167 of file bootloader/src/hid_iap_user.c.

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c.

◆ iap_clear_upgrade_flag()

void iap_clear_upgrade_flag ( void )

clear iap upgrade flag

Parameters
none
Return values
none

Definition at line 54 of file app_led3_toggle/src/hid_iap_user.c.

Referenced by app_loop().

◆ iap_finish()

void iap_finish ( void )

Definition at line 327 of file bootloader/src/hid_iap_user.c.

◆ iap_get()

void iap_get ( )

Definition at line 158 of file app_led3_toggle/src/hid_iap_user.c.

Referenced by usbd_hid_iap_process().

◆ iap_get_upgrade_flag()

iap_result_type iap_get_upgrade_flag ( void )

get iap upgrade complete flag

Parameters
none
Return values
the status of the iap flag

Definition at line 78 of file app_led3_toggle/src/hid_iap_user.c.

◆ iap_idle()

void iap_idle ( void )

iap idle function

Parameters
none
Return values
none

Definition at line 123 of file app_led3_toggle/src/hid_iap_user.c.

Referenced by usbd_hid_iap_process().

◆ iap_init()

void iap_init ( void )

iap init

iap init.

Parameters
none
Return values
none

Definition at line 96 of file app_led3_toggle/src/hid_iap_user.c.

Referenced by iap_idle(), and iap_start().

◆ iap_jump()

void iap_jump ( void )

Definition at line 147 of file app_led3_toggle/src/hid_iap_user.c.

Referenced by usbd_hid_iap_process().

◆ iap_respond()

void iap_respond | ( | uint8_t * | res_buf,
 |  | uint16_t | iap_cmd,
 |  | uint16_t | result )

Definition at line 176 of file app_led3_toggle/src/hid_iap_user.c.

Referenced by iap_get(), iap_idle(), iap_jump(), and iap_start().

◆ iap_set_upgrade_flag()

void iap_set_upgrade_flag ( void )

set iap upgrade complete flag

Parameters
none
Return values
none

Definition at line 66 of file app_led3_toggle/src/hid_iap_user.c.

◆ iap_start()

void iap_start ( void )

iap start function

Parameters
none
Return values
none

Definition at line 135 of file app_led3_toggle/src/hid_iap_user.c.

Referenced by usbd_hid_iap_process().

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< nvic vector table based flash address

Definition at line 153 of file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c.

◆ usb_clock48m_select()

void usb_clock48m_select ( usb_clk48_s clk_s )

usb 48M clock select

Parameters
clk_s:USB_CLK_HICK,USB_CLK_HEXT
Return values
none

< acc hick trim

Definition at line 51 of file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/main.c.

Referenced by main().

◆ usb_delay_ms()

void usb_delay_ms ( uint32_t ms )

usb delay millisecond function.

Parameters
ms number of millisecond delay
Return values
none

Definition at line 132 of file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/main.c.

◆ usb_delay_us()

void usb_delay_us ( uint32_t us )

usb delay microsecond function.

Parameters
us number of microsecond delay
Return values
none

Definition at line 143 of file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/main.c.

◆ usbd_hid_iap_in_complete()

void usbd_hid_iap_in_complete ( void * udev )

usb device in transfer complete function

Parameters
udev to the structure of usbd_core_type
Return values
none

Definition at line 239 of file app_led3_toggle/src/hid_iap_user.c.

◆ usbd_hid_iap_process()

iap_result_type usbd_hid_iap_process | ( | void * | udev,
 |  | uint8_t * | pdata,
 |  | uint16_t | len )

usb device iap function

Parameters
udev | to the structure of usbd_core_type
pdata | data buffer point
len | data length
Return values
iap_result_type

Definition at line 193 of file app_led3_toggle/src/hid_iap_user.c.

◆ USBFS_L_CAN1_RX0_IRQHandler()

void USBFS_L_CAN1_RX0_IRQHandler ( void )

this function handles usb interrupt.

Parameters
none
Return values
none

Definition at line 122 of file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/main.c.

Variable Documentation

◆ pftarget

void(* pftarget) (void) ( void )

Definition at line 38 of file app_led3_toggle/src/hid_iap_user.c.

◆ usb_core_dev

usbd_core_type usb_core_dev

Definition at line 42 of file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/main.c.

Referenced by main(), and USBFS_L_CAN1_RX0_IRQHandler().


AT32F413 Firmwary Library: App_led3_toggle_definition

Macros
App_led3_toggle_definition
UTILITIES_examples » USB_iap_app_led3_toggle

Macros

#define FLASH_APP_ADDRESS 0x08006000

Detailed Description

Macro Definition Documentation

◆ FLASH_APP_ADDRESS

#define FLASH_APP_ADDRESS 0x08006000

Definition at line 48 of file app_led3_toggle/inc/hid_iap_user.h.

Referenced by iap_init(), and main().


AT32F413 Firmwary Library: App_led3_toggle_exported_functions

Functions
App_led3_toggle_exported_functions
UTILITIES_examples » USB_iap_app_led3_toggle

Functions

void | iap_init (void)
iap init.
iap_result_type | iap_get_upgrade_flag (void)
get iap upgrade complete flag
void | app_loop (void)
iap loop

Detailed Description

Function Documentation

◆ app_loop()

void app_loop ( void )

iap loop

Parameters
none
Return values
none

Definition at line 252 of file app_led3_toggle/src/hid_iap_user.c.

Referenced by main().

◆ iap_get_upgrade_flag()

iap_result_type iap_get_upgrade_flag ( void )

get iap upgrade complete flag

Parameters
none
Return values
the status of the iap flag

Definition at line 78 of file app_led3_toggle/src/hid_iap_user.c.

Referenced by main().

◆ iap_init()

void iap_init ( void )

iap init.

Parameters
none
Return values
none

iap init.

Parameters
none
Return values
none

Definition at line 60 of file app_led3_toggle/src/iap.c.


AT32F413 Firmwary Library: USB_iap_app_led4_toggle

Topics | Macros | Functions | Variables
USB_iap_app_led4_toggle
UTILITIES_examples

Topics

App_led4_toggle_definition
App_led4_toggle_exported_functions

Macros

#define USB_EPT_AUTO_MALLOC_BUFFER
usb endpoint max num define

Functions

void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.
void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | iap_clear_upgrade_flag (void)
clear iap upgrade flag
void | iap_set_upgrade_flag (void)
set iap upgrade complete flag
uint32_t | crc_cal (uint32_t addr, uint16_t nk)
crc cal
void | iap_idle (void)
iap idle function
void | iap_start (void)
iap start function
void | iap_finish (void)
void | iap_jump (void)
void | iap_respond (uint8_t *res_buf, uint16_t iap_cmd, uint16_t result)
iap_result_type | iap_get_upgrade_flag (void)
get iap upgrade complete flag
void | iap_init (void)
iap init
void | iap_get ()
iap_result_type | usbd_hid_iap_process (void *udev, uint8_t *pdata, uint16_t len)
usb device iap function
void | usbd_hid_iap_in_complete (void *udev)
usb device in transfer complete function
void | app_loop (void)
iap loop
void | usb_clock48m_select (usb_clk48_s clk_s)
usb 48M clock select
void | USBFS_L_CAN1_RX0_IRQHandler (void)
this function handles usb interrupt.
int | main (void)
main function.

Variables

void(* pftarget )(void)
usbd_core_type usb_core_dev

Detailed Description

Macro Definition Documentation

◆ USB_EPT_AUTO_MALLOC_BUFFER

#define USB_EPT_AUTO_MALLOC_BUFFER

usb endpoint max num define

usb buffer extend to 768-1280 bytes

auto malloc usb endpoint buffer usb auto malloc endpoint tx and rx buffer

Definition at line 62 of file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/usb_conf.h.

Function Documentation

◆ app_loop()

void app_loop ( void )

iap loop

Parameters
none
Return values
none

Definition at line 252 of file app_led4_toggle/src/hid_iap_user.c.

Referenced by main().

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c.

◆ crc_cal()

uint32_t crc_cal | ( | uint32_t | addr,
 |  | uint16_t | nk )

crc cal

Parameters
addr | start address
nk | nk byte
Return values
crc value

Definition at line 167 of file bootloader/src/hid_iap_user.c.

Referenced by iap_crc().

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c.

◆ iap_clear_upgrade_flag()

void iap_clear_upgrade_flag ( void )

clear iap upgrade flag

Parameters
none
Return values
none

Definition at line 54 of file app_led4_toggle/src/hid_iap_user.c.

Referenced by app_loop().

◆ iap_finish()

void iap_finish ( void )

Definition at line 327 of file bootloader/src/hid_iap_user.c.

Referenced by usbd_hid_iap_process().

◆ iap_get()

void iap_get ( )

Definition at line 158 of file app_led4_toggle/src/hid_iap_user.c.

Referenced by usbd_hid_iap_process().

◆ iap_get_upgrade_flag()

iap_result_type iap_get_upgrade_flag ( void )

get iap upgrade complete flag

Parameters
none
Return values
the status of the iap flag

Definition at line 78 of file app_led4_toggle/src/hid_iap_user.c.

◆ iap_idle()

void iap_idle ( void )

iap idle function

Parameters
none
Return values
none

Definition at line 123 of file app_led4_toggle/src/hid_iap_user.c.

Referenced by usbd_hid_iap_process().

◆ iap_init()

void iap_init ( void )

iap init

iap init.

Parameters
none
Return values
none

Definition at line 96 of file app_led4_toggle/src/hid_iap_user.c.

Referenced by iap_idle(), and iap_start().

◆ iap_jump()

void iap_jump ( void )

Definition at line 147 of file app_led4_toggle/src/hid_iap_user.c.

Referenced by usbd_hid_iap_process().

◆ iap_respond()

void iap_respond | ( | uint8_t * | res_buf,
 |  | uint16_t | iap_cmd,
 |  | uint16_t | result )

Definition at line 176 of file app_led4_toggle/src/hid_iap_user.c.

Referenced by iap_get(), iap_idle(), iap_jump(), and iap_start().

◆ iap_set_upgrade_flag()

void iap_set_upgrade_flag ( void )

set iap upgrade complete flag

Parameters
none
Return values
none

Definition at line 66 of file app_led4_toggle/src/hid_iap_user.c.

◆ iap_start()

void iap_start ( void )

iap start function

Parameters
none
Return values
none

Definition at line 135 of file app_led4_toggle/src/hid_iap_user.c.

Referenced by usbd_hid_iap_process().

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

< nvic vector table based flash address

Definition at line 153 of file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c.

◆ usb_clock48m_select()

void usb_clock48m_select ( usb_clk48_s clk_s )

usb 48M clock select

Parameters
clk_s:USB_CLK_HICK,USB_CLK_HEXT
Return values
none

< acc hick trim

Definition at line 51 of file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/main.c.

Referenced by main().

◆ usb_delay_ms()

void usb_delay_ms ( uint32_t ms )

usb delay millisecond function.

Parameters
ms number of millisecond delay
Return values
none

Definition at line 132 of file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/main.c.

◆ usb_delay_us()

void usb_delay_us ( uint32_t us )

usb delay microsecond function.

Parameters
us number of microsecond delay
Return values
none

Definition at line 143 of file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/main.c.

◆ usbd_hid_iap_in_complete()

void usbd_hid_iap_in_complete ( void * udev )

usb device in transfer complete function

Parameters
udev to the structure of usbd_core_type
Return values
none

Definition at line 239 of file app_led4_toggle/src/hid_iap_user.c.

◆ usbd_hid_iap_process()

iap_result_type usbd_hid_iap_process | ( | void * | udev,
 |  | uint8_t * | pdata,
 |  | uint16_t | len )

usb device iap function

Parameters
udev | to the structure of usbd_core_type
pdata | data buffer point
len | data length
Return values
iap_result_type

Definition at line 193 of file app_led4_toggle/src/hid_iap_user.c.

◆ USBFS_L_CAN1_RX0_IRQHandler()

void USBFS_L_CAN1_RX0_IRQHandler ( void )

this function handles usb interrupt.

Parameters
none
Return values
none

Definition at line 122 of file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/main.c.

Variable Documentation

◆ pftarget

void(* pftarget) (void) ( void )

Definition at line 38 of file app_led4_toggle/src/hid_iap_user.c.

◆ usb_core_dev

usbd_core_type usb_core_dev

Definition at line 42 of file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/main.c.

Referenced by main(), and USBFS_L_CAN1_RX0_IRQHandler().


AT32F413 Firmwary Library: App_led4_toggle_definition

Macros
App_led4_toggle_definition
UTILITIES_examples » USB_iap_app_led4_toggle

Macros

#define FLASH_APP_ADDRESS 0x08006000

Detailed Description

Macro Definition Documentation

◆ FLASH_APP_ADDRESS

#define FLASH_APP_ADDRESS 0x08006000

Definition at line 48 of file app_led4_toggle/inc/hid_iap_user.h.


AT32F413 Firmwary Library: App_led4_toggle_exported_functions

Functions
App_led4_toggle_exported_functions
UTILITIES_examples » USB_iap_app_led4_toggle

Functions

void | iap_init (void)
iap init.
iap_result_type | iap_get_upgrade_flag (void)
get iap upgrade complete flag
void | app_loop (void)
iap loop

Detailed Description

Function Documentation

◆ app_loop()

void app_loop ( void )

iap loop

Parameters
none
Return values
none

Definition at line 252 of file app_led3_toggle/src/hid_iap_user.c.

◆ iap_get_upgrade_flag()

iap_result_type iap_get_upgrade_flag ( void )

get iap upgrade complete flag

Parameters
none
Return values
the status of the iap flag

Definition at line 78 of file app_led3_toggle/src/hid_iap_user.c.

◆ iap_init()

void iap_init ( void )

iap init.

Parameters
none
Return values
none

iap init.

Parameters
none
Return values
none

Definition at line 60 of file app_led3_toggle/src/iap.c.


AT32F413 Firmwary Library: USB_iap_bootloader

Topics | Macros | Functions | Variables
USB_iap_bootloader
UTILITIES_examples

Topics

Bootloader_definition
Bootloader_exported_functions

Macros

#define USB_EPT_AUTO_MALLOC_BUFFER
usb endpoint max num define

Functions

void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.
void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | iap_clear_upgrade_flag (void)
clear iap upgrade flag
void | iap_set_upgrade_flag (void)
set iap upgrade complete flag
uint32_t | crc_cal (uint32_t addr, uint16_t nk)
crc cal
void | iap_idle (void)
iap idle function
void | iap_start (void)
iap start function
iap_result_type | iap_address (uint8_t *pdata, uint32_t len)
iap parse address
void | iap_finish (void)
iap_result_type | iap_data_write (uint8_t *pdata, uint32_t len)
void | iap_jump (void)
void | iap_respond (uint8_t *res_buf, uint16_t iap_cmd, uint16_t result)
void | jump_to_app (uint32_t address)
jump to app
iap_result_type | iap_get_upgrade_flag (void)
get iap upgrade complete flag
void | iap_erase_sector (uint32_t address)
set iap upgrade complete flag
void | iap_init (void)
iap init
void | iap_crc (uint8_t *pdata, uint32_t len)
void | iap_get ()
iap_result_type | usbd_hid_iap_process (void *udev, uint8_t *pdata, uint16_t len)
usb device iap function
void | usbd_hid_iap_in_complete (void *udev)
usb device in transfer complete function
void | iap_loop (void)
iap loop
void | usb_clock48m_select (usb_clk48_s clk_s)
usb 48M clock select
void | USBFS_L_CAN1_RX0_IRQHandler (void)
this function handles usb interrupt.
int | main (void)
main function.

Variables

void(* | pftarget )(void)
uint32_t | stkptr
uint32_t | jumpaddr
usbd_core_type usb_core_dev

Detailed Description

Macro Definition Documentation

◆ USB_EPT_AUTO_MALLOC_BUFFER

#define USB_EPT_AUTO_MALLOC_BUFFER

usb endpoint max num define

usb buffer extend to 768-1280 bytes

auto malloc usb endpoint buffer usb auto malloc endpoint tx and rx buffer

Definition at line 62 of file utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/usb_conf.h.

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void )

this function handles bus fault exception.

Parameters
none
Return values
none

Definition at line 77 of file utilities/at32f413_usb_iap_demo/source_code/bootloader/src/at32f413_int.c.

◆ crc_cal()

uint32_t crc_cal | ( | uint32_t | addr,
 |  | uint16_t | nk )

crc cal

Parameters
addr | start address
nk | nk byte
Return values
crc value

Definition at line 167 of file bootloader/src/hid_iap_user.c.

Referenced by iap_crc().

◆ DebugMon_Handler()

void DebugMon_Handler ( void )

this function handles debug monitor exception.

Parameters
none
Return values
none

Definition at line 112 of file utilities/at32f413_usb_iap_demo/source_code/bootloader/src/at32f413_int.c.

◆ HardFault_Handler()

void HardFault_Handler ( void )

this function handles hard fault exception.

Parameters
none
Return values
none

Definition at line 51 of file utilities/at32f413_usb_iap_demo/source_code/bootloader/src/at32f413_int.c.

◆ iap_address()

iap_result_type iap_address | ( | uint8_t * | pdata,
 |  | uint32_t | len )

iap parse address

Parameters
pdata | data buffer pointer.
len | data length
Return values
the result of the address parse

Definition at line 241 of file bootloader/src/hid_iap_user.c.

Referenced by usbd_hid_iap_process().

◆ iap_clear_upgrade_flag()

void iap_clear_upgrade_flag ( void )

clear iap upgrade flag

Parameters
none
Return values
none

Definition at line 94 of file bootloader/src/hid_iap_user.c.

Referenced by iap_address().

◆ iap_crc()

void iap_crc | ( | uint8_t * | pdata,
 |  | uint32_t | len )

Definition at line 340 of file bootloader/src/hid_iap_user.c.

Referenced by usbd_hid_iap_process().

◆ iap_data_write()

iap_result_type iap_data_write | ( | uint8_t * | pdata,
 |  | uint32_t | len )

Definition at line 282 of file bootloader/src/hid_iap_user.c.

Referenced by usbd_hid_iap_process().

◆ iap_erase_sector()

void iap_erase_sector ( uint32_t address )

set iap upgrade complete flag

Parameters
none
Return values
none

Definition at line 136 of file bootloader/src/hid_iap_user.c.

Referenced by iap_address().

◆ iap_finish()

void iap_finish ( void )

Definition at line 327 of file bootloader/src/hid_iap_user.c.

Referenced by usbd_hid_iap_process().

◆ iap_get()

void iap_get ( )

Definition at line 379 of file bootloader/src/hid_iap_user.c.

Referenced by usbd_hid_iap_process().

◆ iap_get_upgrade_flag()

iap_result_type iap_get_upgrade_flag ( void )

get iap upgrade complete flag

Parameters
none
Return values
the status of the iap flag

Definition at line 118 of file bootloader/src/hid_iap_user.c.

Referenced by main().

◆ iap_idle()

void iap_idle ( void )

iap idle function

Parameters
none
Return values
none

Definition at line 216 of file bootloader/src/hid_iap_user.c.

Referenced by usbd_hid_iap_process().

◆ iap_init()

void iap_init ( void )

iap init

iap init.

Parameters
none
Return values
none

Definition at line 189 of file bootloader/src/hid_iap_user.c.

Referenced by iap_idle(), iap_start(), and main().

◆ iap_jump()

void iap_jump ( void )

Definition at line 368 of file bootloader/src/hid_iap_user.c.

Referenced by usbd_hid_iap_process().

◆ iap_loop()

void iap_loop ( void )

iap loop

Parameters
none
Return values
none

Definition at line 485 of file bootloader/src/hid_iap_user.c.

Referenced by main().

◆ iap_respond()

void iap_respond | ( | uint8_t * | res_buf,
 |  | uint16_t | iap_cmd,
 |  | uint16_t | result )

Definition at line 397 of file bootloader/src/hid_iap_user.c.

Referenced by iap_address(), iap_crc(), iap_data_write(), iap_finish(), iap_get(), iap_idle(), iap_jump(), and iap_start().

◆ iap_set_upgrade_flag()

void iap_set_upgrade_flag ( void )

set iap upgrade complete flag

Parameters
none
Return values
none

Definition at line 106 of file bootloader/src/hid_iap_user.c.

Referenced by iap_finish().

◆ iap_start()

void iap_start ( void )

iap start function

Parameters
none
Return values
none

Definition at line 228 of file bootloader/src/hid_iap_user.c.

Referenced by usbd_hid_iap_process().

◆ jump_to_app()

void jump_to_app ( uint32_t address )

jump to app

Parameters
none
Return values
none

Definition at line 70 of file bootloader/src/hid_iap_user.c.

◆ main()

int main ( void )

main function.

Parameters
none
Return values
none

Definition at line 154 of file utilities/at32f413_usb_iap_demo/source_code/bootloader/src/main.c.

◆ MemManage_Handler()

void MemManage_Handler ( void )

this function handles memory manage exception.

Parameters
none
Return values
none

Definition at line 64 of file utilities/at32f413_usb_iap_demo/source_code/bootloader/src/at32f413_int.c.

◆ NMI_Handler()

void NMI_Handler ( void )

this function handles nmi exception.

Parameters
none
Return values
none

Definition at line 42 of file utilities/at32f413_usb_iap_demo/source_code/bootloader/src/at32f413_int.c.

◆ PendSV_Handler()

void PendSV_Handler ( void )

this function handles pendsv_handler exception.

Parameters
none
Return values
none

Definition at line 121 of file utilities/at32f413_usb_iap_demo/source_code/bootloader/src/at32f413_int.c.

◆ SVC_Handler()

void SVC_Handler ( void )

this function handles svcall exception.

Parameters
none
Return values
none

Definition at line 103 of file utilities/at32f413_usb_iap_demo/source_code/bootloader/src/at32f413_int.c.

◆ SysTick_Handler()

void SysTick_Handler ( void )

this function handles systick handler.

Parameters
none
Return values
none

Definition at line 130 of file utilities/at32f413_usb_iap_demo/source_code/bootloader/src/at32f413_int.c.

◆ UsageFault_Handler()

void UsageFault_Handler ( void )

this function handles usage fault exception.

Parameters
none
Return values
none

Definition at line 90 of file utilities/at32f413_usb_iap_demo/source_code/bootloader/src/at32f413_int.c.

◆ usb_clock48m_select()

void usb_clock48m_select ( usb_clk48_s clk_s )

usb 48M clock select

Parameters
clk_s:USB_CLK_HICK,USB_CLK_HEXT
Return values
none

< acc hick trim

Definition at line 51 of file utilities/at32f413_usb_iap_demo/source_code/bootloader/src/main.c.

Referenced by main().

◆ usb_delay_ms()

void usb_delay_ms ( uint32_t ms )

usb delay millisecond function.

Parameters
ms number of millisecond delay
Return values
none

Definition at line 133 of file utilities/at32f413_usb_iap_demo/source_code/bootloader/src/main.c.

◆ usb_delay_us()

void usb_delay_us ( uint32_t us )

usb delay microsecond function.

Parameters
us number of microsecond delay
Return values
none

Definition at line 144 of file utilities/at32f413_usb_iap_demo/source_code/bootloader/src/main.c.

◆ usbd_hid_iap_in_complete()

void usbd_hid_iap_in_complete ( void * udev )

usb device in transfer complete function

Parameters
udev to the structure of usbd_core_type
Return values
none

Definition at line 472 of file bootloader/src/hid_iap_user.c.

Referenced by class_in_handler().

◆ usbd_hid_iap_process()

iap_result_type usbd_hid_iap_process | ( | void * | udev,
 |  | uint8_t * | pdata,
 |  | uint16_t | len )

usb device iap function

Parameters
udev | to the structure of usbd_core_type
pdata | data buffer point
len | data length
Return values
iap_result_type

Definition at line 414 of file bootloader/src/hid_iap_user.c.

Referenced by class_out_handler().

◆ USBFS_L_CAN1_RX0_IRQHandler()

void USBFS_L_CAN1_RX0_IRQHandler ( void )

this function handles usb interrupt.

Parameters
none
Return values
none

Definition at line 123 of file utilities/at32f413_usb_iap_demo/source_code/bootloader/src/main.c.

Variable Documentation

◆ jumpaddr

uint32_t jumpaddr

Definition at line 50 of file bootloader/src/hid_iap_user.c.

Referenced by jump_to_app().

◆ pftarget

void(* pftarget) (void) ( void )

Definition at line 38 of file bootloader/src/hid_iap_user.c.

Referenced by jump_to_app().

◆ stkptr

uint32_t stkptr

Definition at line 50 of file bootloader/src/hid_iap_user.c.

Referenced by jump_to_app().

◆ usb_core_dev

usbd_core_type usb_core_dev

Definition at line 42 of file utilities/at32f413_usb_iap_demo/source_code/bootloader/src/main.c.

Referenced by main(), and USBFS_L_CAN1_RX0_IRQHandler().


AT32F413 Firmwary Library: Data Structures

  • Data Structure Index
  • Data Fields
Data Structures
Here are the data structures with brief descriptions:
C acc_type | Type define acc register all
C adc_base_config_type | Adc base config type
C adc_type | Type define adc register all
C audio_codec_type |
C bpr_type | Type define bpr register all
C calendar_type |
C can_base_type | Can init structure definition
C can_baudrate_type | Can baudrate structure definition
C can_fifo_mailbox_type | Can controller area network fifo mailbox
C can_filter_init_type | Can filter init structure definition
C can_filter_register_type | Can controller area network filter bit register
C can_rx_message_type | Can rx message structure definition
C can_tx_mailbox_type | Can controller area network tx mailbox
C can_tx_message_type | Can tx message structure definition
C can_type | Type define can register all
C cbd_extended_type | Extended command block description
C cbd_typical_type | Typical command block description
C cbw_type | Command block wrapper
C cdc_msc_struct_type | Usb cdc class struct
C cdc_struct_type | Usb cdc class struct
C cmd_data_group_type | Cmd data group type
C crc_type | Type define crc register all
C crm_clocks_freq_type | Crm clocks freqency structure
C crm_type | Type define crm register all
C csw_type | Command block wrapper
C custom_hid_type |
C debug_type | Type define debug register all
C dma_channel_type | Type define dma channel register all
C dma_init_type | Dma init type
C dma_type | Type define dma register
C exint_init_type | Exint init type
C exint_type | Type define exint register all
C fat_dir_type |
C flash_iap_type |
C flash_type | Type define flash register all
C gpio_init_type | Gpio init type
C gpio_type | Type define gpio register all
C i2c_handle_type |
C i2c_type | Type define i2c register all
C i2s_init_type | I2s init type
C iap_info_type |
C iomux_type | Type define iomux register all
C keyboard_type |
C linecoding_type | Usb cdc class set line coding struct
C mouse_type |
C msc_type |
C printer_type |
C pwc_type | Type define pwc register all
C rtc_type | Type define rtc register all
C sc_atr_type |
C sd_card_info_struct_type |
C sd_cid_struct_type |
C sd_csd_struct_type |
C sd_scr_struct_type |
C sdio_command_struct_type | Sdio command structure
C sdio_data_struct_type | Sdio data structure
C sdio_type | Type define sdio register all
C sense_type | Request sense standard data
C spi_init_type | Spi init type
C spi_type | Type define spi register all
C tmr_brkdt_config_type | Tmr brkdt config type
C tmr_input_config_type | Tmr input capture config type
C tmr_output_config_type | Tmr output config type
C tmr_type | Type define tmr register all
C usart_group_type | Usart group type
C usart_type | Type define usart register all
C usb_audio_hid_type | Usb audio control struct
C usb_audio_type | Usb audio control struct
C usb_configuration_desc_type | Format of standard configuration descriptor
C usb_device_desc_type | Format of standard device descriptor
C usb_endpoint_desc_type | Format of standard endpoint descriptor
C usb_ept_info | Usb endpoint infomation structure definition
C usb_header_desc_type | Format of header
C usb_interface_desc_type | Format of standard interface descriptor
C usb_setup_type | Format of usb setup data
C usbd_class_handler | Usb device class handler
C usbd_core_type | Usb device core struct type
C usbd_desc_handler | Usb device descriptor handler
C usbd_desc_t | Usb device descriptor struct
C usbd_type | Type define usb register all
C usd_type | User system data
C vcp_keyboard_type |
C wdt_type | Type define wdt register all
C winusb_struct_type | Usb winusb class struct
C wwdt_type | Type define wwdt register all


AT32F413 Firmwary Library: Data Structure Index

  • Data Structure Index
  • Data Fields
Data Structure Index
A | B | C | D | E | F | G | I | K | L | M | P | R | S | T | U | V | W
A
acc_type
adc_base_config_type
adc_type
audio_codec_type
B
bpr_type
C
calendar_type
can_base_type
can_baudrate_type
can_fifo_mailbox_type
can_filter_init_type
can_filter_register_type
can_rx_message_type
can_tx_mailbox_type
can_tx_message_type
can_type
cbd_extended_type
cbd_typical_type
cbw_type
cdc_msc_struct_type
cdc_struct_type
cmd_data_group_type
crc_type
crm_clocks_freq_type
crm_type
csw_type
custom_hid_type
D
debug_type
dma_channel_type
dma_init_type
dma_type
E
exint_init_type
exint_type
F
fat_dir_type
flash_iap_type
flash_type
G
gpio_init_type
gpio_type
I
i2c_handle_type
i2c_type
i2s_init_type
iap_info_type
iomux_type
K
keyboard_type
L
linecoding_type
M
mouse_type
msc_type
P
printer_type
pwc_type
R
rtc_type
S
sc_atr_type
sd_card_info_struct_type
sd_cid_struct_type
sd_csd_struct_type
sd_scr_struct_type
sdio_command_struct_type
sdio_data_struct_type
sdio_type
sense_type
spi_init_type
spi_type
T
tmr_brkdt_config_type
tmr_input_config_type
tmr_output_config_type
tmr_type
U
usart_group_type
usart_type
usb_audio_hid_type
usb_audio_type
usb_configuration_desc_type
usb_device_desc_type
usb_endpoint_desc_type
usb_ept_info
usb_header_desc_type
usb_interface_desc_type
usb_setup_type
usbd_class_handler
usbd_core_type
usbd_desc_handler
usbd_desc_t
usbd_type
usd_type
V
vcp_keyboard_type
W
wdt_type
winusb_struct_type
wwdt_type


AT32F413 Firmwary Library: Data Fields

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all struct and union fields with links to the structures/unions they belong to:

- a -

  • accen : crm_type
  • accrst : crm_type
  • acken : i2c_type
  • ackfail : i2c_type
  • acs : spi_type
  • adc1_eto_gmux : iomux_type
  • adc1_etp_gmux : iomux_type
  • adc1_extrgord_mux : iomux_type
  • adc1_extrgpre_mux : iomux_type
  • adc1en : crm_type
  • adc1rst : crm_type
  • adc2_eto_gmux : iomux_type
  • adc2_etp_gmux : iomux_type
  • adc2_extrgord_mux : iomux_type
  • adc2_extrgpre_mux : iomux_type
  • adc2en : crm_type
  • adc2odt : adc_type
  • adc2rst : crm_type
  • adc_freq : crm_clocks_freq_type
  • adcal : adc_type
  • adcalinit : adc_type
  • adcdiv_h : crm_type
  • adcdiv_l : crm_type
  • adcen : adc_type
  • addr : flash_type, tmr_type, usbd_type
  • addr1 : i2c_type
  • addr1mode : i2c_type
  • addr2 : i2c_type
  • addr2en : i2c_type
  • addr3 : flash_type
  • addr3_bit : flash_type
  • addr7f : i2c_type
  • addr_bit : flash_type
  • address : cbd_extended_type, cbd_typical_type
  • addrhf : i2c_type
  • aebo_enable : can_base_type
  • aeboen : can_type
  • aed_enable : can_base_type
  • aeden : can_type
  • ahb_freq : crm_clocks_freq_type
  • ahbdiv : crm_type
  • ahben : crm_type
  • ahben_bit : crm_type
  • alertf : i2c_type
  • alloc_length : cbd_extended_type, cbd_typical_type
  • alt_setting : cdc_msc_struct_type, cdc_struct_type, custom_hid_type, iap_info_type, keyboard_type, mouse_type, msc_type, printer_type, usb_audio_hid_type, vcp_keyboard_type, winusb_struct_type
  • aoen : tmr_type
  • apb1_freq : crm_clocks_freq_type
  • apb1div : crm_type
  • apb1en : crm_type
  • apb1en_bit : crm_type
  • apb1rst : crm_type
  • apb1rst_bit : crm_type
  • apb2_freq : crm_clocks_freq_type
  • apb2div : crm_type
  • apb2en : crm_type
  • apb2en_bit : crm_type
  • apb2rst : crm_type
  • apb2rst_bit : crm_type
  • app_address : iap_info_type
  • argu : sdio_type
  • argu_bit : sdio_type
  • argument : sdio_command_struct_type
  • arlost : i2c_type
  • arpen : i2c_type
  • as_length : sense_type
  • asc : sense_type
  • ascq : sense_type
  • attr : fat_dir_type
  • audio_bitw : audio_codec_type
  • audio_cmd : usb_audio_hid_type, usb_audio_type
  • audio_cmd_len : usb_audio_hid_type, usb_audio_type
  • audio_feed_back : usb_audio_hid_type, usb_audio_type
  • audio_freq : audio_codec_type
  • audio_mic_data : usb_audio_hid_type, usb_audio_type
  • audio_protocol : i2s_init_type
  • audio_sampling_freq : i2s_init_type
  • audio_spk_data : usb_audio_hid_type, usb_audio_type
  • auto_output_enable : tmr_brkdt_config_type
  • auto_step_en : crm_type


AT32F413 Firmwary Library: Data Fields

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all struct and union fields with links to the structures/unions they belong to:

- b -

  • bAlternateSetting : usb_interface_desc_type
  • bankers : flash_type
  • baudr : usart_type
  • baudr_bit : usart_type
  • baudrate_div : can_baudrate_type
  • bCBWCBLength : cbw_type
  • bCBWLUN : cbw_type
  • bcdDevice : usb_device_desc_type
  • bcdUSB : usb_device_desc_type
  • bConfigurationValue : usb_configuration_desc_type
  • bCSWStatus : csw_type
  • bDescriptorType : usb_configuration_desc_type, usb_device_desc_type, usb_endpoint_desc_type, usb_header_desc_type, usb_interface_desc_type
  • bDeviceClass : usb_device_desc_type
  • bDeviceProtocol : usb_device_desc_type
  • bDeviceSubClass : usb_device_desc_type
  • be : usbd_type
  • beien : usbd_type
  • bEndpointAddress : usb_endpoint_desc_type
  • bf : spi_type
  • bfbn : usart_type
  • bff : usart_type
  • bfien : usart_type
  • bInterfaceClass : usb_interface_desc_type
  • bInterfaceNumber : usb_interface_desc_type
  • bInterfaceProtocol : usb_interface_desc_type
  • bInterfaceSubClass : usb_interface_desc_type
  • bInterval : usb_endpoint_desc_type
  • bitrate : linecoding_type
  • bLength : usb_configuration_desc_type, usb_device_desc_type, usb_endpoint_desc_type, usb_header_desc_type, usb_interface_desc_type
  • blk_addr : cdc_msc_struct_type, msc_type
  • blk_len : cdc_msc_struct_type, msc_type
  • blk_nbr : cdc_msc_struct_type, msc_type
  • blk_size : cdc_msc_struct_type, msc_type
  • blksize : sdio_type
  • block_size : sdio_data_struct_type
  • bmAttributes : usb_configuration_desc_type, usb_endpoint_desc_type
  • bMaxPacketSize0 : usb_device_desc_type
  • bMaxPower : usb_configuration_desc_type
  • bmCBWFlags : cbw_type
  • bmRequestType : usb_setup_type
  • bNumConfigurations : usb_device_desc_type
  • bNumEndpoints : usb_interface_desc_type
  • bNumInterfaces : usb_configuration_desc_type
  • bof : can_type
  • boien : can_type
  • bot_status : cdc_msc_struct_type, msc_type
  • bpdc : crm_type
  • bpdc_bit : crm_type
  • bpdrst : crm_type
  • bpren : crm_type
  • bprrst : crm_type
  • bpwen : pwc_type
  • brdiv : can_type
  • bRequest : usb_setup_type
  • brk : tmr_type
  • brk_bit : tmr_type
  • brk_enable : tmr_brkdt_config_type
  • brk_polarity : tmr_brkdt_config_type
  • brken : tmr_type
  • brkie : tmr_type
  • brkif : tmr_type
  • brkswtr : tmr_type
  • brkv : tmr_type
  • btaddr : usbd_type
  • btmg : can_type
  • btmg_bit : can_type
  • bts1 : can_type
  • bts1_size : can_baudrate_type
  • bts2 : can_type
  • bts2_size : can_baudrate_type
  • buf : sdio_type, usart_group_type
  • buf_bit : sdio_type
  • bufcnt : sdio_type
  • bufcnt_bit : sdio_type
  • buffer_size : dma_init_type
  • buftbl : usbd_type
  • buftbl_bit : usbd_type
  • buserr : i2c_type
  • busws : sdio_type
  • busyf : i2c_type
  • bypsen : sdio_type


AT32F413 Firmwary Library: Data Fields

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all struct and union fields with links to the structures/unions they belong to:

- c -

  • c1 : acc_type
  • c1_bit : acc_type
  • c1c : tmr_type
  • c1cen : tmr_type
  • c1cios : tmr_type
  • c1cp : tmr_type
  • c1den : tmr_type
  • c1df : tmr_type
  • c1dt : tmr_type
  • c1dt_bit : tmr_type
  • c1en : tmr_type
  • c1idiv : tmr_type
  • c1ien : tmr_type
  • c1if : tmr_type
  • c1insel : tmr_type
  • c1ios : tmr_type
  • c1oben : tmr_type
  • c1octrl : tmr_type
  • c1oien : tmr_type
  • c1osen : tmr_type
  • c1p : tmr_type
  • c1rf : tmr_type
  • c1swtr : tmr_type
  • c2 : acc_type
  • c2_bit : acc_type
  • c2c : tmr_type
  • c2cen : tmr_type
  • c2cios : tmr_type
  • c2cp : tmr_type
  • c2den : tmr_type
  • c2df : tmr_type
  • c2dt : tmr_type
  • c2dt_bit : tmr_type
  • c2en : tmr_type
  • c2idiv : tmr_type
  • c2ien : tmr_type
  • c2if : tmr_type
  • c2ios : tmr_type
  • c2oben : tmr_type
  • c2octrl : tmr_type
  • c2oien : tmr_type
  • c2osen : tmr_type
  • c2p : tmr_type
  • c2rf : tmr_type
  • c2swtr : tmr_type
  • c3 : acc_type
  • c3_bit : acc_type
  • c3c : tmr_type
  • c3cen : tmr_type
  • c3cios : tmr_type
  • c3cp : tmr_type
  • c3den : tmr_type
  • c3df : tmr_type
  • c3dt : tmr_type
  • c3dt_bit : tmr_type
  • c3en : tmr_type
  • c3idiv : tmr_type
  • c3ien : tmr_type
  • c3if : tmr_type
  • c3ios : tmr_type
  • c3oben : tmr_type
  • c3octrl : tmr_type
  • c3oien : tmr_type
  • c3osen : tmr_type
  • c3p : tmr_type
  • c3rf : tmr_type
  • c3swtr : tmr_type
  • c4c : tmr_type
  • c4den : tmr_type
  • c4df : tmr_type
  • c4dt : tmr_type
  • c4dt_bit : tmr_type
  • c4en : tmr_type
  • c4idiv : tmr_type
  • c4ien : tmr_type
  • c4if : tmr_type
  • c4ios : tmr_type
  • c4oben : tmr_type
  • c4octrl : tmr_type
  • c4oien : tmr_type
  • c4osen : tmr_type
  • c4p : tmr_type
  • c4rf : tmr_type
  • c4swtr : tmr_type
  • calon : acc_type
  • calout : bpr_type
  • calrdy : acc_type
  • calrdyien : acc_type
  • calval : bpr_type
  • can1_gmux : iomux_type
  • can1_pause : debug_type
  • can1en : crm_type
  • can1rst : crm_type
  • can2_gmux : iomux_type
  • can2_pause : debug_type
  • can2en : crm_type
  • can2rst : crm_type
  • can_mux : iomux_type
  • card_blk_size : sd_card_info_struct_type
  • card_capacity : sd_card_info_struct_type
  • card_cmd_classes : sd_csd_struct_type
  • card_type : sd_card_info_struct_type
  • cardsts1 : sdio_type
  • cardsts2 : sdio_type
  • cardsts3 : sdio_type
  • cardsts4 : sdio_type
  • cbctrl : tmr_type
  • cbw_struct : cdc_msc_struct_type, msc_type
  • CBWCB : cbw_type
  • cce : adc_type
  • cceien : adc_type
  • ccen : spi_type
  • ccerr : spi_type
  • ccfs : tmr_type
  • ccos : bpr_type
  • ccsmen : sdio_type
  • cctrl : tmr_type
  • cctrl_bit : tmr_type
  • cdt : crc_type
  • cdt_bit : crc_type
  • cen : usbd_type
  • cfden : crm_type
  • cfdf : crm_type
  • cfdfc : crm_type
  • cfg : crm_type, usbd_type, wwdt_type
  • cfg_bit : crm_type, usbd_type, wwdt_type
  • cfgen : rtc_type
  • cfgf : rtc_type
  • cfghr : gpio_type
  • cfghr_bit : gpio_type
  • cfglr : gpio_type
  • cfglr_bit : gpio_type
  • ch1_src : dma_type
  • ch2_src : dma_type
  • ch3_src : dma_type
  • ch4_src : dma_type
  • ch5_src : dma_type
  • ch6_src : dma_type
  • ch7_src : dma_type
  • chen : dma_channel_type
  • chpers : flash_type
  • chpl : dma_channel_type
  • cid_crc : sd_cid_struct_type
  • class_handler : usbd_core_type
  • clck : usbd_type
  • clear_handler : usbd_class_handler
  • clk_to_tmr : crm_type
  • clkctrl : i2c_type, sdio_type
  • clkctrl_bit : i2c_type, sdio_type
  • clkdiv : tmr_type
  • clkdiv_h : sdio_type
  • clkdiv_l : sdio_type
  • clkegs : sdio_type
  • clken : usart_type
  • clkfreq : i2c_type
  • clkint : crm_type
  • clkint_bit : crm_type
  • clkoen : sdio_type
  • clkout_sel : crm_type
  • clkoutdiv : crm_type
  • clkpha : spi_type, usart_type
  • clkpol : spi_type, usart_type
  • clock_phase : spi_init_type
  • clock_polarity : i2s_init_type, spi_init_type
  • clr : dma_type, gpio_type
  • clr_bit : dma_type, gpio_type
  • clsef : pwc_type
  • clswef : pwc_type
  • clus_high : fat_dir_type
  • clus_low : fat_dir_type
  • cm1 : tmr_type
  • cm1_input_bit : tmr_type
  • cm1_output_bit : tmr_type
  • cm2 : tmr_type
  • cm2_input_bit : tmr_type
  • cm2_output_bit : tmr_type
  • cmd : wdt_type
  • cmd20_support : sd_scr_struct_type
  • cmd23_support : sd_scr_struct_type
  • cmd_addr : cmd_data_group_type
  • cmd_bit : wdt_type
  • cmd_buf : cmd_data_group_type
  • cmd_check : cmd_data_group_type
  • cmd_head : cmd_data_group_type
  • cmd_index : sdio_command_struct_type
  • cmdcmpl : sdio_type
  • cmdcmplien : sdio_type
  • cmdctrl : sdio_type
  • cmdctrl_bit : sdio_type
  • cmdfail : sdio_type
  • cmdfailien : sdio_type
  • cmdidx : sdio_type
  • cmdrspcmpl : sdio_type
  • cmdrspcmplien : sdio_type
  • cmdtimeout : sdio_type
  • cmdtimeoutien : sdio_type
  • cnt : dma_channel_type, rtc_type, sdio_type, wwdt_type
  • cnt_dir : tmr_type
  • cnth : rtc_type
  • cnth_bit : rtc_type
  • cntl : rtc_type
  • cntl_bit : rtc_type
  • config_status : usbd_core_type
  • conn_state : usbd_core_type
  • content_protect_app : sd_csd_struct_type
  • copy_flag : sd_csd_struct_type
  • count : usart_group_type
  • cpoly : spi_type
  • cpoly_bit : spi_type
  • crc_chkr : flash_type
  • crc_chkr_bit : flash_type
  • crc_ctrl : flash_type
  • crc_ctrl_bit : flash_type
  • crc_sn : flash_type
  • crc_ss : flash_type
  • crc_strt : flash_type
  • crcen : crm_type
  • create_data : fat_dir_type
  • create_time : fat_dir_type
  • create_time_tenth : fat_dir_type
  • cs_mode_selection : spi_init_type
  • csd_crc : sd_csd_struct_type
  • csd_struct : sd_csd_struct_type
  • cspt0 : adc_type
  • cspt1 : adc_type
  • cspt10 : adc_type
  • cspt11 : adc_type
  • cspt12 : adc_type
  • cspt13 : adc_type
  • cspt14 : adc_type
  • cspt15 : adc_type
  • cspt16 : adc_type
  • cspt17 : adc_type
  • cspt2 : adc_type
  • cspt3 : adc_type
  • cspt4 : adc_type
  • cspt5 : adc_type
  • cspt6 : adc_type
  • cspt7 : adc_type
  • cspt8 : adc_type
  • cspt9 : adc_type
  • csrst : usbd_type
  • csw_struct : cdc_msc_struct_type, msc_type
  • ctrl : bpr_type, crc_type, crm_type, debug_type, dma_channel_type, flash_type, pwc_type, usbd_type, wwdt_type
  • ctrl1 : acc_type, adc_type, i2c_type, spi_type, tmr_type, usart_type
  • ctrl1_bit : acc_type, adc_type, i2c_type, spi_type, tmr_type, usart_type
  • ctrl2 : acc_type, adc_type, i2c_type, spi_type, tmr_type, usart_type
  • ctrl2_bit : acc_type, adc_type, i2c_type, spi_type, tmr_type, usart_type
  • ctrl3 : flash_type, usart_type
  • ctrl3_bit : flash_type, usart_type
  • ctrl_bit : bpr_type, crc_type, crm_type, debug_type, dma_channel_type, flash_type, pwc_type, usbd_type, wwdt_type
  • ctrlh : rtc_type
  • ctrlh_bit : rtc_type
  • ctrll : rtc_type
  • ctrll_bit : rtc_type
  • ctrlsts : bpr_type, crm_type, pwc_type
  • ctrlsts_bit : bpr_type, crm_type, pwc_type
  • ctscf : usart_type
  • ctscfien : usart_type
  • ctsen : usart_type
  • curs : can_type
  • cuss : can_type
  • cval : tmr_type
  • cval_bit : tmr_type


AT32F413 Firmwary Library: Data Fields

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all struct and union fields with links to the structures/unions they belong to:

- d -

  • da : flash_type
  • da_bit : flash_type
  • data : can_rx_message_type, can_tx_message_type, cdc_msc_struct_type, linecoding_type, msc_type
  • data0 : usd_type
  • data1 : usd_type
  • data2 : usd_type
  • data3 : usd_type
  • data4 : usd_type
  • data5 : usd_type
  • data6 : usd_type
  • data7 : usd_type
  • data_align : adc_base_config_type
  • data_channel_format : i2s_init_type
  • data_len : cdc_msc_struct_type, msc_type
  • data_length : sdio_data_struct_type
  • data_stat_after_erase : sd_scr_struct_type
  • dataien : i2c_type
  • date : calendar_type
  • dbn : usart_type
  • dCBWDataTransferLength : cbw_type
  • dCBWSignature : cbw_type
  • dCBWTage : cbw_type
  • dCSWDataResidue : csw_type
  • dCSWSignature : csw_type
  • dCSWTag : csw_type
  • deadtime : tmr_brkdt_config_type
  • deepsleep_debug : debug_type
  • default_config : usbd_core_type
  • depslp_rst : flash_type
  • desc_handler : usbd_core_type
  • descriptor : usbd_desc_t
  • dev_config : usbd_core_type
  • devaddr : usbd_type
  • devaddr_bit : usbd_type
  • devaddrf : i2c_type
  • device_addr : usbd_core_type
  • device_size : sd_csd_struct_type
  • device_size_mult : sd_csd_struct_type
  • direction : dma_init_type
  • dirf : i2c_type
  • disusb : usbd_type
  • div : rtc_type, tmr_type, usart_type, wdt_type, wwdt_type
  • div_bit : tmr_type, wdt_type
  • divcnt : rtc_type
  • divcnth : rtc_type
  • divcnth_bit : rtc_type
  • divcntl : rtc_type
  • divcntl_bit : rtc_type
  • divf : wdt_type
  • divh : rtc_type
  • divh_bit : rtc_type
  • divl : rtc_type
  • divl_bit : rtc_type
  • dlc : can_rx_message_type, can_tx_message_type
  • dma1en : crm_type
  • dma2en : crm_type
  • dma_flex_en : dma_type
  • dma_init_struct : i2c_handle_type
  • dma_rx_channel : i2c_handle_type
  • dma_tx_channel : i2c_handle_type
  • dmactrl : tmr_type
  • dmactrl_bit : tmr_type
  • dmadt : tmr_type
  • dmadt_bit : tmr_type
  • dmaen : i2c_type, sdio_type
  • dmaend : i2c_type
  • dmaren : spi_type, usart_type
  • dmaten : spi_type, usart_type
  • dmsts : usbd_type
  • docmd : sdio_type
  • docmdien : sdio_type
  • dorx : sdio_type
  • dorxien : sdio_type
  • dotx : sdio_type
  • dotxien : sdio_type
  • dpsts : usbd_type
  • drs : tmr_type
  • dsr_implemented : sd_csd_struct_type
  • dt : bpr_type, crc_type, i2c_type, sdio_type, spi_type, usart_type
  • dt1 : bpr_type
  • dt10 : bpr_type
  • dt10_bit : bpr_type
  • dt11 : bpr_type
  • dt11_bit : bpr_type
  • dt12 : bpr_type
  • dt12_bit : bpr_type
  • dt13 : bpr_type
  • dt13_bit : bpr_type
  • dt14 : bpr_type
  • dt14_bit : bpr_type
  • dt15 : bpr_type
  • dt15_bit : bpr_type
  • dt16 : bpr_type
  • dt16_bit : bpr_type
  • dt17 : bpr_type
  • dt17_bit : bpr_type
  • dt18 : bpr_type
  • dt18_bit : bpr_type
  • dt19 : bpr_type
  • dt19_bit : bpr_type
  • dt1_bit : bpr_type
  • dt2 : bpr_type
  • dt20 : bpr_type
  • dt20_bit : bpr_type
  • dt21 : bpr_type
  • dt21_bit : bpr_type
  • dt22 : bpr_type
  • dt22_bit : bpr_type
  • dt23 : bpr_type
  • dt23_bit : bpr_type
  • dt24 : bpr_type
  • dt24_bit : bpr_type
  • dt25 : bpr_type
  • dt25_bit : bpr_type
  • dt26 : bpr_type
  • dt26_bit : bpr_type
  • dt27 : bpr_type
  • dt27_bit : bpr_type
  • dt28 : bpr_type
  • dt28_bit : bpr_type
  • dt29 : bpr_type
  • dt29_bit : bpr_type
  • dt2_bit : bpr_type
  • dt3 : bpr_type
  • dt30 : bpr_type
  • dt30_bit : bpr_type
  • dt31 : bpr_type
  • dt31_bit : bpr_type
  • dt32 : bpr_type
  • dt32_bit : bpr_type
  • dt33 : bpr_type
  • dt33_bit : bpr_type
  • dt34 : bpr_type
  • dt34_bit : bpr_type
  • dt35 : bpr_type
  • dt35_bit : bpr_type
  • dt36 : bpr_type
  • dt36_bit : bpr_type
  • dt37 : bpr_type
  • dt37_bit : bpr_type
  • dt38 : bpr_type
  • dt38_bit : bpr_type
  • dt39 : bpr_type
  • dt39_bit : bpr_type
  • dt3_bit : bpr_type
  • dt4 : bpr_type
  • dt40 : bpr_type
  • dt40_bit : bpr_type
  • dt41 : bpr_type
  • dt41_bit : bpr_type
  • dt42 : bpr_type
  • dt42_bit : bpr_type
  • dt4_bit : bpr_type
  • dt5 : bpr_type
  • dt5_bit : bpr_type
  • dt6 : bpr_type
  • dt6_bit : bpr_type
  • dt7 : bpr_type
  • dt7_bit : bpr_type
  • dt8 : bpr_type
  • dt8_bit : bpr_type
  • dt9 : bpr_type
  • dt9_bit : bpr_type
  • dt_bit : crc_type, i2c_type, spi_type, usart_type
  • dtalign : adc_type
  • dtb : tmr_type
  • dtblkcmpl : sdio_type
  • dtblkcmplien : sdio_type
  • dtc : tmr_type
  • dtcmpl : sdio_type
  • dtcmplien : sdio_type
  • dtcnt : dma_channel_type, sdio_type
  • dtcnt_bit : dma_channel_type, sdio_type
  • dtctrl : sdio_type
  • dtctrl_bit : sdio_type
  • dtd : dma_channel_type
  • dterrf1 : dma_type
  • dterrf2 : dma_type
  • dterrf3 : dma_type
  • dterrf4 : dma_type
  • dterrf5 : dma_type
  • dterrf6 : dma_type
  • dterrf7 : dma_type
  • dterrfc1 : dma_type
  • dterrfc2 : dma_type
  • dterrfc3 : dma_type
  • dterrfc4 : dma_type
  • dterrfc5 : dma_type
  • dterrfc6 : dma_type
  • dterrfc7 : dma_type
  • dterrien : dma_channel_type
  • dtfail : sdio_type
  • dtfailien : sdio_type
  • dtlen : sdio_type
  • dtlen_bit : sdio_type
  • dttimeout : sdio_type
  • dttimeoutien : sdio_type
  • dttmr : sdio_type
  • dttmr_bit : sdio_type
  • dutymode : i2c_type
  • dzc : can_type
  • dzen : can_type


AT32F413 Firmwary Library: Data Fields

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all struct and union fields with links to the structures/unions they belong to:

- e -

  • eaf : can_type
  • eaien : can_type
  • ecc_code : sd_csd_struct_type
  • ecmben : tmr_type
  • edzien : can_type
  • edzif : can_type
  • eien : acc_type
  • enpd : usb_audio_hid_type, usb_audio_type
  • entrim : acc_type
  • eoien : can_type
  • eoif : can_type
  • eopb0 : usd_type
  • epf : can_type
  • epien : can_type
  • epp0 : usd_type
  • epp1 : usd_type
  • epp2 : usd_type
  • epp3 : usd_type
  • epperr : flash_type
  • epps : flash_type
  • epps_bit : flash_type
  • ept : usbd_type
  • ept0_rx_handler : usbd_class_handler
  • ept0_slen : usb_ept_info
  • ept0_sts : usbd_core_type
  • ept0_tx_handler : usbd_class_handler
  • ept0_wlength : usbd_core_type
  • ept_address : usb_ept_info
  • ept_bit : usbd_type
  • ept_in : usbd_core_type
  • ept_num : usbd_type
  • ept_out : usbd_core_type
  • eptaddr : usbd_type
  • eptn : usb_ept_info
  • erase_group_size : sd_csd_struct_type
  • erase_group_size_mult : sd_csd_struct_type
  • err_code : sense_type
  • errie : flash_type, spi_type
  • errien : i2c_type, usart_type
  • error_code : i2c_handle_type
  • erstr : flash_type
  • esdiv : tmr_type
  • esf : tmr_type
  • esp : tmr_type
  • ests : can_type
  • ests_bit : can_type
  • etr : can_type
  • etrien : can_type
  • event_handler : usbd_class_handler
  • evoen : iomux_type
  • evten : exint_type
  • evten_bit : exint_type
  • evtenx : exint_type
  • evtien : i2c_type
  • evtout : iomux_type
  • evtout_bit : iomux_type
  • exf : usbd_type
  • exint0 : iomux_type
  • exint1 : iomux_type
  • exint10 : iomux_type
  • exint11 : iomux_type
  • exint12 : iomux_type
  • exint13 : iomux_type
  • exint14 : iomux_type
  • exint15 : iomux_type
  • exint2 : iomux_type
  • exint3 : iomux_type
  • exint4 : iomux_type
  • exint5 : iomux_type
  • exint6 : iomux_type
  • exint7 : iomux_type
  • exint8 : iomux_type
  • exint9 : iomux_type
  • exintc1 : iomux_type
  • exintc1_bit : iomux_type
  • exintc2 : iomux_type
  • exintc2_bit : iomux_type
  • exintc3 : iomux_type
  • exintc3_bit : iomux_type
  • exintc4 : iomux_type
  • exintc4_bit : iomux_type
  • exintrst : crm_type
  • ext_flash_key : usd_type
  • ext_spim_en_mux : iomux_type
  • ext_spim_gen : iomux_type
  • ext_spim_gmux : iomux_type
  • extended_id : can_rx_message_type, can_tx_message_type


AT32F413 Firmwary Library: Data Fields

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all struct and union fields with links to the structures/unions they belong to:

- f -

  • fa : flash_type
  • facfg : can_type
  • facfg_bit : can_type
  • faen0 : can_type
  • faen1 : can_type
  • faen10 : can_type
  • faen11 : can_type
  • faen12 : can_type
  • faen13 : can_type
  • faen2 : can_type
  • faen3 : can_type
  • faen4 : can_type
  • faen5 : can_type
  • faen6 : can_type
  • faen7 : can_type
  • faen8 : can_type
  • faen9 : can_type
  • fap : flash_type, usd_type
  • fbn : spi_type
  • fbwcfg : can_type
  • fbwcfg_bit : can_type
  • fbwsel0 : can_type
  • fbwsel1 : can_type
  • fbwsel10 : can_type
  • fbwsel11 : can_type
  • fbwsel12 : can_type
  • fbwsel13 : can_type
  • fbwsel2 : can_type
  • fbwsel3 : can_type
  • fbwsel4 : can_type
  • fbwsel5 : can_type
  • fbwsel6 : can_type
  • fbwsel7 : can_type
  • fbwsel8 : can_type
  • fbwsel9 : can_type
  • fcs : can_type
  • fcsodis : tmr_type
  • fcsodis_state : tmr_brkdt_config_type
  • fcsoen : tmr_type
  • fcsoen_state : tmr_brkdt_config_type
  • fctrl : can_type
  • fctrl_bit : can_type
  • fda : flash_type
  • fdtf1 : dma_type
  • fdtf2 : dma_type
  • fdtf3 : dma_type
  • fdtf4 : dma_type
  • fdtf5 : dma_type
  • fdtf6 : dma_type
  • fdtf7 : dma_type
  • fdtfc1 : dma_type
  • fdtfc2 : dma_type
  • fdtfc3 : dma_type
  • fdtfc4 : dma_type
  • fdtfc5 : dma_type
  • fdtfc6 : dma_type
  • fdtfc7 : dma_type
  • fdtien : dma_channel_type
  • ferr : usart_type
  • ffb : can_type
  • ffdb1 : can_filter_register_type
  • ffdb2 : can_filter_register_type
  • fifo_length : iap_info_type
  • fifo_mailbox : can_type
  • file_formart : sd_csd_struct_type
  • file_format_group : sd_csd_struct_type
  • file_name : fat_dir_type
  • file_size : fat_dir_type
  • file_write_nr : flash_iap_type
  • filter_activate_enable : can_filter_init_type
  • filter_bit : can_filter_init_type
  • filter_fifo : can_filter_init_type
  • filter_id_high : can_filter_init_type
  • filter_id_low : can_filter_init_type
  • filter_index : can_rx_message_type
  • filter_mask_high : can_filter_init_type
  • filter_mask_low : can_filter_init_type
  • filter_mode : can_filter_init_type
  • filter_number : can_filter_init_type
  • firmware_length : flash_iap_type
  • first_bit_transmission : spi_init_type
  • flag_address : iap_info_type
  • flash_app_addr : flash_iap_type
  • flash_app_size : flash_iap_type
  • flash_base_addr : flash_iap_type
  • flash_end_address : iap_info_type
  • flash_size : flash_iap_type, iap_info_type
  • flash_start_address : iap_info_type
  • flashen : crm_type
  • fmcfg : can_type
  • fmcfg_bit : can_type
  • fmsel0 : can_type
  • fmsel1 : can_type
  • fmsel10 : can_type
  • fmsel11 : can_type
  • fmsel12 : can_type
  • fmsel13 : can_type
  • fmsel2 : can_type
  • fmsel3 : can_type
  • fmsel4 : can_type
  • fmsel5 : can_type
  • fmsel6 : can_type
  • fmsel7 : can_type
  • fmsel8 : can_type
  • fmsel9 : can_type
  • format : linecoding_type
  • fprgm : flash_type
  • fpx : exint_type
  • frame_bit_num : spi_init_type
  • frame_type : can_rx_message_type, can_tx_message_type
  • frf : can_type
  • frf_bit : can_type
  • frfsel0 : can_type
  • frfsel1 : can_type
  • frfsel10 : can_type
  • frfsel11 : can_type
  • frfsel12 : can_type
  • frfsel13 : can_type
  • frfsel2 : can_type
  • frfsel3 : can_type
  • frfsel4 : can_type
  • frfsel5 : can_type
  • frfsel6 : can_type
  • frfsel7 : can_type
  • frfsel8 : can_type
  • frfsel9 : can_type
  • fzc : can_type
  • fzen : can_type


AT32F413 Firmwary Library: Data Fields

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all struct and union fields with links to the structures/unions they belong to:

- g -

  • g_audio_cur : usb_audio_hid_type, usb_audio_type
  • g_cmd : cdc_msc_struct_type, cdc_struct_type, vcp_keyboard_type
  • g_keyboard_tx_completed : vcp_keyboard_type
  • g_len : cdc_msc_struct_type, cdc_struct_type, vcp_keyboard_type, winusb_struct_type
  • g_printer_data : printer_type
  • g_printer_port_status : printer_type
  • g_req : cdc_msc_struct_type, cdc_struct_type, vcp_keyboard_type
  • g_rx_buff : cdc_msc_struct_type, cdc_struct_type, printer_type, vcp_keyboard_type, winusb_struct_type
  • g_rx_completed : cdc_msc_struct_type, cdc_struct_type, printer_type, vcp_keyboard_type, winusb_struct_type
  • g_rxhid_buff : custom_hid_type, iap_info_type, usb_audio_hid_type
  • g_rxlen : cdc_msc_struct_type, cdc_struct_type, printer_type, vcp_keyboard_type, winusb_struct_type
  • g_tx_completed : cdc_msc_struct_type, cdc_struct_type, printer_type, vcp_keyboard_type, winusb_struct_type
  • g_txhid_buff : custom_hid_type, usb_audio_hid_type
  • g_u8tx_completed : keyboard_type
  • gcaddrf : i2c_type
  • gcaen : i2c_type
  • gdiv : usart_type
  • gdiv_bit : usart_type
  • genstart : i2c_type
  • genstop : i2c_type
  • get_device_config_string : usbd_desc_handler
  • get_device_configuration : usbd_desc_handler
  • get_device_descriptor : usbd_desc_handler
  • get_device_interface_string : usbd_desc_handler
  • get_device_lang_id : usbd_desc_handler
  • get_device_manufacturer_string : usbd_desc_handler
  • get_device_other_speed : usbd_desc_handler
  • get_device_product_string : usbd_desc_handler
  • get_device_qualifier : usbd_desc_handler
  • get_device_serial_string : usbd_desc_handler
  • gf1 : dma_type
  • gf2 : dma_type
  • gf3 : dma_type
  • gf4 : dma_type
  • gf5 : dma_type
  • gf6 : dma_type
  • gf7 : dma_type
  • gfc1 : dma_type
  • gfc2 : dma_type
  • gfc3 : dma_type
  • gfc4 : dma_type
  • gfc5 : dma_type
  • gfc6 : dma_type
  • gfc7 : dma_type
  • gpio_drive_strength : gpio_init_type
  • gpio_mode : gpio_init_type
  • gpio_out_type : gpio_init_type
  • gpio_pins : gpio_init_type
  • gpio_pull : gpio_init_type
  • gpioaen : crm_type
  • gpioarst : crm_type
  • gpioben : crm_type
  • gpiobrst : crm_type
  • gpiocen : crm_type
  • gpiocrst : crm_type
  • gpioden : crm_type
  • gpiodrst : crm_type
  • gpioerst : crm_type
  • gpiofen : crm_type
  • gresume : usbd_type


AT32F413 Firmwary Library: Data Fields

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all struct and union fields with links to the structures/unions they belong to:

- h -

  • h : sc_atr_type
  • hallde : tmr_type
  • hallien : tmr_type
  • hallif : tmr_type
  • hallswtr : tmr_type
  • hdtf1 : dma_type
  • hdtf2 : dma_type
  • hdtf3 : dma_type
  • hdtf4 : dma_type
  • hdtf5 : dma_type
  • hdtf6 : dma_type
  • hdtf7 : dma_type
  • hdtfc1 : dma_type
  • hdtfc2 : dma_type
  • hdtfc3 : dma_type
  • hdtfc4 : dma_type
  • hdtfc5 : dma_type
  • hdtfc6 : dma_type
  • hdtfc7 : dma_type
  • hdtien : dma_channel_type
  • head : usart_group_type
  • hextbyps : crm_type
  • hexten : crm_type
  • hextstbl : crm_type
  • hextstblf : crm_type
  • hextstblfc : crm_type
  • hextstblien : crm_type
  • hfcen : sdio_type
  • hick_to_sclk : crm_type
  • hick_to_usb : crm_type
  • hickcal : acc_type, crm_type
  • hickcal_key : crm_type
  • hickdiv : crm_type
  • hicken : crm_type
  • hickstbl : crm_type
  • hickstblf : crm_type
  • hickstblfc : crm_type
  • hickstblien : crm_type
  • hicktrim : acc_type, crm_type
  • hid_get_report : custom_hid_type
  • hid_protocol : custom_hid_type, iap_info_type, keyboard_type, mouse_type, usb_audio_hid_type, vcp_keyboard_type
  • hid_set_idle : custom_hid_type, iap_info_type, keyboard_type, mouse_type, usb_audio_hid_type, vcp_keyboard_type
  • hid_set_report : custom_hid_type, iap_info_type, keyboard_type, mouse_type, usb_audio_hid_type, vcp_keyboard_type
  • hid_state : custom_hid_type, iap_info_type, keyboard_type, mouse_type, usb_audio_hid_type, vcp_keyboard_type
  • hid_suspend_flag : keyboard_type, mouse_type
  • hlength : sc_atr_type
  • hostaddrf : i2c_type
  • hour : calendar_type
  • hwcsoe : spi_type


AT32F413 Firmwary Library: Data Fields

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all struct and union fields with links to the structures/unions they belong to:

- i -

  • i2c1_gmux : iomux_type
  • i2c1_mux : iomux_type
  • i2c1_smbus_timeout : debug_type
  • i2c1en : crm_type
  • i2c1rst : crm_type
  • i2c2_gmux : iomux_type
  • i2c2_smbus_timeout : debug_type
  • i2c2en : crm_type
  • i2c2rst : crm_type
  • i2cen : i2c_type
  • i2cx : i2c_handle_type
  • i2scbn : spi_type
  • i2sclk : spi_type
  • i2sclk_bit : spi_type
  • i2sclkpol : spi_type
  • i2sctrl : spi_type
  • i2sctrl_bit : spi_type
  • i2sdbn : spi_type
  • i2sdiv_h : spi_type
  • i2sdiv_l : spi_type
  • i2sen : spi_type
  • i2smclkoe : spi_type
  • i2smsel : spi_type
  • i2sodd : spi_type
  • iap_address : iap_info_type
  • iap_fifo : iap_info_type
  • iap_rx : iap_info_type
  • iap_tx : iap_info_type
  • iConfiguration : usb_configuration_desc_type
  • id : usart_type
  • id_type : can_rx_message_type, can_tx_message_type
  • idcode_bit : debug_type
  • iden : tmr_type
  • iden_bit : tmr_type
  • idlef : usart_type
  • idleien : usart_type
  • idProduct : usb_device_desc_type
  • idt : crc_type, gpio_type
  • idt0 : gpio_type
  • idt1 : gpio_type
  • idt10 : gpio_type
  • idt11 : gpio_type
  • idt12 : gpio_type
  • idt13 : gpio_type
  • idt14 : gpio_type
  • idt15 : gpio_type
  • idt2 : gpio_type
  • idt3 : gpio_type
  • idt4 : gpio_type
  • idt5 : gpio_type
  • idt6 : gpio_type
  • idt7 : gpio_type
  • idt8 : gpio_type
  • idt9 : gpio_type
  • idt_bit : crc_type, gpio_type
  • idVendor : usb_device_desc_type
  • iInterface : usb_interface_desc_type
  • iManufacturer : usb_device_desc_type
  • in_handler : usbd_class_handler
  • information : sense_type
  • init_handler : usbd_class_handler
  • inout : usb_ept_info, usbd_type
  • input_channel_select : tmr_input_config_type
  • input_filter_value : tmr_input_config_type
  • input_mapped_select : tmr_input_config_type
  • input_polarity_select : tmr_input_config_type
  • intclr : sdio_type
  • intclr_bit : sdio_type
  • inten : can_type, exint_type, sdio_type
  • inten_bit : can_type, exint_type, sdio_type
  • intenx : exint_type
  • interface : usb_audio_hid_type, usb_audio_type
  • intmap : crm_type
  • intmap_bit : crm_type
  • intsts : exint_type, usbd_type
  • intsts_bit : exint_type, usbd_type
  • intwt : sdio_type
  • iocb0 : gpio_type
  • iocb1 : gpio_type
  • iocb10 : gpio_type
  • iocb11 : gpio_type
  • iocb12 : gpio_type
  • iocb13 : gpio_type
  • iocb14 : gpio_type
  • iocb15 : gpio_type
  • iocb2 : gpio_type
  • iocb3 : gpio_type
  • iocb4 : gpio_type
  • iocb5 : gpio_type
  • iocb6 : gpio_type
  • iocb7 : gpio_type
  • iocb8 : gpio_type
  • iocb9 : gpio_type
  • ioen : sdio_type
  • iofc0 : gpio_type
  • iofc1 : gpio_type
  • iofc10 : gpio_type
  • iofc11 : gpio_type
  • iofc12 : gpio_type
  • iofc13 : gpio_type
  • iofc14 : gpio_type
  • iofc15 : gpio_type
  • iofc2 : gpio_type
  • iofc3 : gpio_type
  • iofc4 : gpio_type
  • iofc5 : gpio_type
  • iofc6 : gpio_type
  • iofc7 : gpio_type
  • iofc8 : gpio_type
  • iofc9 : gpio_type
  • ioif : sdio_type
  • ioifien : sdio_type
  • iomc0 : gpio_type
  • iomc1 : gpio_type
  • iomc10 : gpio_type
  • iomc11 : gpio_type
  • iomc12 : gpio_type
  • iomc13 : gpio_type
  • iomc14 : gpio_type
  • iomc15 : gpio_type
  • iomc2 : gpio_type
  • iomc3 : gpio_type
  • iomc4 : gpio_type
  • iomc5 : gpio_type
  • iomc6 : gpio_type
  • iomc7 : gpio_type
  • iomc8 : gpio_type
  • iomc9 : gpio_type
  • iomuxen : crm_type
  • iomuxrst : crm_type
  • iosb0 : gpio_type
  • iosb1 : gpio_type
  • iosb10 : gpio_type
  • iosb11 : gpio_type
  • iosb12 : gpio_type
  • iosb13 : gpio_type
  • iosb14 : gpio_type
  • iosb15 : gpio_type
  • iosb2 : gpio_type
  • iosb3 : gpio_type
  • iosb4 : gpio_type
  • iosb5 : gpio_type
  • iosb6 : gpio_type
  • iosb7 : gpio_type
  • iosb8 : gpio_type
  • iosb9 : gpio_type
  • iosusp : sdio_type
  • iProduct : usb_device_desc_type
  • irdaen : usart_type
  • irdalp : usart_type
  • is_double_buffer : usb_ept_info
  • isdiv : usart_type
  • iSerialNumber : usb_device_desc_type
  • ists : tmr_type
  • ists_bit : tmr_type
  • itsrven : adc_type


AT32F413 Firmwary Library: Data Fields

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all struct and union fields with links to the structures/unions they belong to:

- k -

  • keyboard_buf : keyboard_type


AT32F413 Firmwary Library: Data Fields

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all struct and union fields with links to the structures/unions they belong to:

- l -

  • last_access_data : fat_dir_type
  • last_len : usb_ept_info
  • lbcp : usart_type
  • lben : can_type
  • length : usbd_desc_t
  • lextbyps : crm_type
  • lexten : crm_type
  • lextstbl : crm_type
  • lextstblf : crm_type
  • lextstblfc : crm_type
  • lextstblien : crm_type
  • licken : crm_type
  • lickstbl : crm_type
  • lickstblf : crm_type
  • lickstblfc : crm_type
  • lickstblien : crm_type
  • line_enable : exint_init_type
  • line_mode : exint_init_type
  • line_polarity : exint_init_type
  • line_select : exint_init_type
  • linecoding : cdc_msc_struct_type, cdc_struct_type, vcp_keyboard_type
  • linen : usart_type
  • linex : exint_type
  • lm : dma_channel_type
  • loen : can_type
  • loop_mode_enable : dma_init_type
  • lpm : usbd_type
  • lprstf : crm_type
  • lpsel : pwc_type
  • lsamprx : can_type
  • lsof : usbd_type
  • lsofien : usbd_type
  • lsofnum : usbd_type
  • ltf : spi_type
  • lun : cbd_extended_type, cbd_typical_type


AT32F413 Firmwary Library: Data Fields

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all struct and union fields with links to the structures/unions they belong to:

- m -

  • m2m : dma_channel_type
  • mackctrl : i2c_type
  • maddr : dma_channel_type
  • maddr_bit : dma_channel_type
  • manufact_date : sd_cid_struct_type
  • manufacturer_default_ecc : sd_csd_struct_type
  • manufacturer_id : sd_cid_struct_type
  • master_slave_mode : spi_init_type
  • max_bus_clk_freq : sd_csd_struct_type
  • max_lun : cdc_msc_struct_type, msc_type
  • max_read_blk_length : sd_csd_struct_type
  • max_read_current_vdd_max : sd_csd_struct_type
  • max_read_current_vdd_min : sd_csd_struct_type
  • max_write_blk_length : sd_csd_struct_type
  • max_write_current_vdd_max : sd_csd_struct_type
  • max_write_current_vdd_min : sd_csd_struct_type
  • maxpacket : usb_ept_info, winusb_struct_type
  • mclk_freq_division : spi_init_type
  • mclk_output_enable : i2s_init_type
  • mctrl : can_type
  • mctrl_bit : can_type
  • mdiv_h : spi_type
  • mdiv_l : spi_type
  • mdrsel : can_type
  • mdrsel_selection : can_base_type
  • memory_base_addr : dma_init_type
  • memory_data_width : dma_init_type
  • memory_inc_enable : dma_init_type
  • mic_adj_count : audio_codec_type
  • mic_adj_stage : audio_codec_type
  • mic_alt_setting : usb_audio_hid_type, usb_audio_type
  • mic_buffer : audio_codec_type
  • mic_calc : audio_codec_type
  • mic_delta : audio_codec_type
  • mic_enable : audio_codec_type
  • mic_freq : usb_audio_hid_type, usb_audio_type
  • mic_mute : audio_codec_type, usb_audio_hid_type, usb_audio_type
  • mic_roff : audio_codec_type
  • mic_rtotal : audio_codec_type
  • mic_rx_size : audio_codec_type
  • mic_stage : audio_codec_type
  • mic_volume : audio_codec_type, usb_audio_hid_type, usb_audio_type
  • mic_volume_limits : usb_audio_hid_type, usb_audio_type
  • mic_wend : audio_codec_type
  • mic_woff : audio_codec_type
  • mic_wtotal : audio_codec_type
  • min : calendar_type
  • mincm : dma_channel_type
  • misc1 : crm_type
  • misc1_bit : crm_type
  • misc2 : crm_type
  • misc2_bit : crm_type
  • misc3 : crm_type
  • misc3_bit : crm_type
  • mmerr : spi_type
  • mmssr : can_type
  • mmssr_selection : can_base_type
  • mode : i2c_handle_type
  • mode_selection : can_base_type
  • month : calendar_type
  • mouse_buffer : mouse_type
  • msc_state : cdc_msc_struct_type, msc_type
  • msc_up_status : flash_iap_type
  • mssel : adc_type
  • msten : spi_type
  • msts : can_type
  • msts_bit : can_type
  • mwidth : dma_channel_type


AT32F413 Firmwary Library: Data Fields

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all struct and union fields with links to the structures/unions they belong to:

- n -

  • nerr : usart_type
  • nrstf : crm_type
  • nsac : sd_csd_struct_type
  • ntc : spi_type


AT32F413 Firmwary Library: Data Fields

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all struct and union fields with links to the structures/unions they belong to:

- o -

  • oaddr1 : i2c_type
  • oaddr1_bit : i2c_type
  • oaddr2 : i2c_type
  • oaddr2_bit : i2c_type
  • obf : flash_type
  • oc_idle_state : tmr_output_config_type
  • oc_mode : tmr_output_config_type
  • oc_output_state : tmr_output_config_type
  • oc_polarity : tmr_output_config_type
  • occ_idle_state : tmr_output_config_type
  • occ_output_state : tmr_output_config_type
  • occ_polarity : tmr_output_config_type
  • occs : adc_type
  • ocdmaen : adc_type
  • oclen : adc_type
  • ocmen : tmr_type
  • ocpcnt : adc_type
  • ocpen : adc_type
  • ocswtrg : adc_type
  • octen : adc_type
  • octesel_h : adc_type
  • octesel_l : adc_type
  • ocvmen : adc_type
  • odf : flash_type
  • odfie : flash_type
  • odt : adc_type, gpio_type
  • odt0 : gpio_type
  • odt1 : gpio_type
  • odt10 : gpio_type
  • odt11 : gpio_type
  • odt12 : gpio_type
  • odt13 : gpio_type
  • odt14 : gpio_type
  • odt15 : gpio_type
  • odt2 : gpio_type
  • odt3 : gpio_type
  • odt4 : gpio_type
  • odt5 : gpio_type
  • odt6 : gpio_type
  • odt7 : gpio_type
  • odt8 : gpio_type
  • odt9 : gpio_type
  • odt_bit : adc_type, gpio_type
  • oem_app_id : sd_cid_struct_type
  • oen : tmr_type
  • old_conn_state : usbd_core_type
  • opcode : cbd_extended_type, cbd_typical_type
  • operation_mode : i2s_init_type
  • opersel : spi_type
  • oplk : flash_type
  • ora : spi_type
  • ordinary_channel_length : adc_base_config_type
  • osn1 : adc_type
  • osn10 : adc_type
  • osn11 : adc_type
  • osn12 : adc_type
  • osn13 : adc_type
  • osn14 : adc_type
  • osn15 : adc_type
  • osn16 : adc_type
  • osn2 : adc_type
  • osn3 : adc_type
  • osn4 : adc_type
  • osn5 : adc_type
  • osn6 : adc_type
  • osn7 : adc_type
  • osn8 : adc_type
  • osn9 : adc_type
  • osq1 : adc_type
  • osq1_bit : adc_type
  • osq2 : adc_type
  • osq2_bit : adc_type
  • osq3 : adc_type
  • osq3_bit : adc_type
  • ouf : i2c_type
  • out_handler : usbd_class_handler
  • outen : bpr_type
  • outm : bpr_type
  • outsel : bpr_type
  • ovfden : tmr_type
  • ovfen : tmr_type
  • ovff : rtc_type
  • ovfien : rtc_type, tmr_type
  • ovfif : tmr_type
  • ovfs : tmr_type
  • ovfswtr : tmr_type


AT32F413 Firmwary Library: Data Fields

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all struct and union fields with links to the structures/unions they belong to:

- p -

  • paddr : dma_channel_type
  • paddr_bit : dma_channel_type
  • parity : linecoding_type
  • part_blk_read : sd_csd_struct_type
  • part_blk_write : sd_csd_struct_type
  • pbuff : i2c_handle_type
  • pcautoen : adc_type
  • pcce : adc_type
  • pcceien : adc_type
  • pccs : adc_type
  • pcdto1 : adc_type
  • pcdto1_bit : adc_type
  • pcdto2 : adc_type
  • pcdto2_bit : adc_type
  • pcdto3 : adc_type
  • pcdto3_bit : adc_type
  • pcdto4 : adc_type
  • pcdto4_bit : adc_type
  • pclen : adc_type
  • pcmfssel : spi_type
  • pcount : i2c_handle_type
  • pcpen : adc_type
  • pcswtrg : adc_type
  • pcten : adc_type
  • pctesel_h : adc_type
  • pctesel_l : adc_type
  • pcvmen : adc_type
  • pd01_gmux : iomux_type
  • pd01_mux : iomux_type
  • pdata : usbd_class_handler
  • pdt1 : adc_type
  • pdt1_bit : adc_type
  • pdt2 : adc_type
  • pdt2_bit : adc_type
  • pdt3 : adc_type
  • pdt3_bit : adc_type
  • pdt4 : adc_type
  • pdt4_bit : adc_type
  • pecen : i2c_type
  • pecerr : i2c_type
  • pecten : i2c_type
  • pecval : i2c_type
  • pen : usart_type
  • peripheral_base_addr : dma_init_type
  • peripheral_data_width : dma_init_type
  • peripheral_inc_enable : dma_init_type
  • permanent_write_protect : sd_csd_struct_type
  • permode : i2c_type
  • perr : usart_type
  • perrien : usart_type
  • pid : debug_type
  • pincm : dma_channel_type
  • pllen : crm_type
  • pllhextdiv : crm_type
  • pllmult_h : crm_type
  • pllmult_l : crm_type
  • pllrange : crm_type
  • pllrcs : crm_type
  • pllstbl : crm_type
  • pllstblf : crm_type
  • pllstblfc : crm_type
  • pllstblien : crm_type
  • pmen : tmr_type
  • pndwt : sdio_type
  • polcfg1 : exint_type
  • polcfg1_bit : exint_type
  • polcfg2 : exint_type
  • polcfg2_bit : exint_type
  • poly : crc_type
  • poly_bit : crc_type
  • poly_size : crc_type
  • porrstf : crm_type
  • pr : tmr_type
  • pr_bit : tmr_type
  • prben : tmr_type
  • prgmerr : flash_type
  • priority : dma_init_type
  • product_name1 : sd_cid_struct_type
  • product_name2 : sd_cid_struct_type
  • product_reversion : sd_cid_struct_type
  • product_sn : sd_cid_struct_type
  • prsf_enable : can_base_type
  • prsfen : can_type
  • ps : sdio_type
  • psel : usart_type
  • psn1 : adc_type
  • psn2 : adc_type
  • psn3 : adc_type
  • psn4 : adc_type
  • psq : adc_type
  • psq_bit : adc_type
  • psr : flash_type
  • psr_bit : flash_type
  • ptd : can_type
  • ptos : tmr_type
  • pvmen : pwc_type
  • pvmof : pwc_type
  • pvmsel : pwc_type
  • pwcen : crm_type
  • pwcrst : crm_type
  • pwidth : dma_channel_type
  • pwrctrl : sdio_type
  • pwrctrl_bit : sdio_type
  • pwrsven : sdio_type


AT32F413 Firmwary Library: Data Fields

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all struct and union fields with links to the structures/unions they belong to:

- q -

  • qdzien : can_type
  • qdzif : can_type


AT32F413 Firmwary Library: Data Fields

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all struct and union fields with links to the structures/unions they belong to:

- r -

  • rca : sd_card_info_struct_type
  • rcrc : spi_type
  • rcrc_bit : spi_type
  • rdbf : i2c_type, spi_type, usart_type
  • rdbfie : spi_type
  • rdbfien : usart_type
  • rdwtmode : sdio_type
  • rdwtstart : sdio_type
  • rdwtstop : sdio_type
  • read_blk_misalign : sd_csd_struct_type
  • read_crc : flash_iap_type
  • realrx : can_type
  • rec : can_type
  • rem0_len : usb_ept_info
  • remap : iomux_type
  • remap2 : iomux_type
  • remap2_bit : iomux_type
  • remap3 : iomux_type
  • remap3_bit : iomux_type
  • remap4 : iomux_type
  • remap4_bit : iomux_type
  • remap5 : iomux_type
  • remap5_bit : iomux_type
  • remap6 : iomux_type
  • remap6_bit : iomux_type
  • remap7 : iomux_type
  • remap7_bit : iomux_type
  • remap_bit : iomux_type
  • remote_wakup : usbd_core_type
  • ren : usart_type
  • repeat_mode : adc_base_config_type
  • request_no : usb_audio_hid_type, usb_audio_type
  • res : fat_dir_type
  • reserved : tmr_type, usd_type
  • reserved1 : acc_type, adc_type, bpr_type, can_fifo_mailbox_type, can_tx_mailbox_type, can_type, cbd_extended_type, cbd_typical_type, crc_type, crm_type, debug_type, dma_channel_type, dma_type, exint_type, flash_type, gpio_type, i2c_type, iomux_type, pwc_type, rtc_type, sd_cid_struct_type, sd_csd_struct_type, sd_scr_struct_type, sdio_type, sense_type, spi_type, tmr_type, usart_type, usbd_type, wdt_type, wwdt_type
  • reserved2 : acc_type, adc_type, bpr_type, can_tx_mailbox_type, can_type, cbd_extended_type, cbd_typical_type, crc_type, crm_type, debug_type, flash_type, i2c_type, iomux_type, pwc_type, sd_cid_struct_type, sd_csd_struct_type, sdio_type, sense_type, spi_type, tmr_type, usart_type, usbd_type
  • reserved3 : acc_type, adc_type, bpr_type, can_type, crm_type, debug_type, flash_type, i2c_type, iomux_type, sd_csd_struct_type, sense_type, usart_type
  • reserved4 : adc_type, can_type, crm_type, debug_type, flash_type, iomux_type, sd_csd_struct_type
  • reserved5 : can_type, crm_type, flash_type
  • reserved6 : can_type, crm_type, flash_type
  • reserverd2 : sd_scr_struct_type
  • reserverd3 : sd_scr_struct_type
  • reset : i2c_type
  • respond_flag : iap_info_type
  • revid : crc_type
  • revod : crc_type
  • rf0 : can_type
  • rf0_bit : can_type
  • rf0ff : can_type
  • rf0fien : can_type
  • rf0mien : can_type
  • rf0mn : can_type
  • rf0of : can_type
  • rf0oien : can_type
  • rf0r : can_type
  • rf1 : can_type
  • rf1_bit : can_type
  • rf1ff : can_type
  • rf1fien : can_type
  • rf1mien : can_type
  • rf1mn : can_type
  • rf1of : can_type
  • rf1oien : can_type
  • rf1r : can_type
  • rfc : can_fifo_mailbox_type
  • rfc_bit : can_fifo_mailbox_type
  • rfdt0 : can_fifo_mailbox_type
  • rfdt1 : can_fifo_mailbox_type
  • rfdt2 : can_fifo_mailbox_type
  • rfdt3 : can_fifo_mailbox_type
  • rfdt4 : can_fifo_mailbox_type
  • rfdt5 : can_fifo_mailbox_type
  • rfdt6 : can_fifo_mailbox_type
  • rfdt7 : can_fifo_mailbox_type
  • rfdth : can_fifo_mailbox_type
  • rfdth_bit : can_fifo_mailbox_type
  • rfdtl : can_fifo_mailbox_type
  • rfdtl_bit : can_fifo_mailbox_type
  • rfeid : can_fifo_mailbox_type
  • rffmn : can_fifo_mailbox_type
  • rffri : can_fifo_mailbox_type
  • rfi : can_fifo_mailbox_type
  • rfi_bit : can_fifo_mailbox_type
  • rfidi : can_fifo_mailbox_type
  • rfsid : can_fifo_mailbox_type
  • rfts : can_fifo_mailbox_type
  • risetime : i2c_type
  • rld : wdt_type
  • rld_bit : wdt_type
  • rldf : wdt_type, wwdt_type
  • rldien : wwdt_type
  • rm : usart_type
  • roerr : spi_type, usart_type
  • rpen : adc_type
  • rpr : tmr_type
  • rpr_bit : tmr_type
  • rpx : exint_type
  • rsaw : can_type
  • rsaw_size : can_baudrate_type
  • rslost : acc_type
  • rsp1 : sdio_type
  • rsp1_bit : sdio_type
  • rsp2 : sdio_type
  • rsp2_bit : sdio_type
  • rsp3 : sdio_type
  • rsp3_bit : sdio_type
  • rsp4 : sdio_type
  • rsp4_bit : sdio_type
  • rsp_type : sdio_command_struct_type
  • rspcmd : sdio_type
  • rspcmd_bit : sdio_type
  • rspwt : sdio_type
  • rst : crc_type, usbd_type
  • rstfc : crm_type
  • rstien : usbd_type
  • rtccal : bpr_type
  • rtccal_bit : bpr_type
  • rtcen : crm_type
  • rtcsel : crm_type
  • rtsen : usart_type
  • rx_addr : usb_ept_info
  • rxbuf : sdio_type
  • rxbufe : sdio_type
  • rxbufeien : sdio_type
  • rxbuff : sdio_type
  • rxbuffien : sdio_type
  • rxbufh : sdio_type
  • rxbufhien : sdio_type
  • rxbufien : sdio_type
  • rxdts : usbd_type
  • rxerro : sdio_type
  • rxerroien : sdio_type
  • rxsts : usbd_type
  • rxtc : usbd_type


AT32F413 Firmwary Library: Data Fields

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all struct and union fields with links to the structures/unions they belong to:

- s -

  • sbf : usart_type
  • sbiterr : sdio_type
  • sbiterrien : sdio_type
  • scgt : usart_type
  • sclk_freq : crm_clocks_freq_type
  • sclksel : crm_type
  • sclksts : crm_type
  • scmen : usart_type
  • scnacken : usart_type
  • scr : gpio_type
  • scr_bit : gpio_type
  • scr_structure : sd_scr_struct_type
  • sd_bus_width : sd_scr_struct_type
  • sd_cid_reg : sd_card_info_struct_type
  • sd_csd_reg : sd_card_info_struct_type
  • sd_scr_reg : sd_card_info_struct_type
  • sd_security : sd_scr_struct_type
  • sd_spec : sd_scr_struct_type
  • sd_spec3 : sd_scr_struct_type
  • sdio1_gmux : iomux_type
  • sdio1en : crm_type
  • sec : calendar_type
  • secers : flash_type
  • sector_mask : flash_iap_type
  • sector_size : flash_iap_type, iap_info_type
  • sef : pwc_type
  • select : flash_type
  • select_bit : flash_type
  • selpin : iomux_type
  • selport : iomux_type
  • send_state : custom_hid_type, keyboard_type, mouse_type
  • sense_key : sense_type
  • sequence_mode : adc_base_config_type
  • setup : usbd_core_type
  • setup_buffer : usbd_core_type
  • setup_handler : usbd_class_handler
  • setuptc : usbd_type
  • slben : spi_type, usart_type
  • slbtd : spi_type
  • sleep_debug : debug_type
  • slib_dat_ss : flash_type
  • slib_dss_set : flash_type
  • slib_enf : flash_type
  • slib_es : flash_type
  • slib_es_set : flash_type
  • slib_misc_sts : flash_type
  • slib_misc_sts_bit : flash_type
  • slib_pclr_val : flash_type
  • slib_pset_val : flash_type
  • slib_pwd_clr : flash_type
  • slib_pwd_clr_bit : flash_type
  • slib_pwd_err : flash_type
  • slib_pwd_ok : flash_type
  • slib_rcnt : flash_type
  • slib_set_pwd : flash_type
  • slib_set_pwd_bit : flash_type
  • slib_set_range : flash_type
  • slib_set_range_bit : flash_type
  • slib_ss : flash_type
  • slib_ss_set : flash_type
  • slib_sts0 : flash_type
  • slib_sts0_bit : flash_type
  • slib_sts1 : flash_type
  • slib_sts1_bit : flash_type
  • slib_ukval : flash_type
  • slib_ulkf : flash_type
  • slib_unlock : flash_type
  • slib_unlock_bit : flash_type
  • smbalert : i2c_type
  • smbmode : i2c_type
  • smsel : tmr_type
  • sof : usbd_type
  • sof_handler : usbd_class_handler
  • sofien : usbd_type
  • sofnum : usbd_type
  • sofouten : usbd_type
  • sofrnum : usbd_type
  • sofrnum_bit : usbd_type
  • sp : usbd_type
  • spec_version : sd_csd_struct_type
  • speed : i2c_type, usbd_core_type
  • speedmode : i2c_type
  • spi1_gmux : iomux_type
  • spi1_mux_h : iomux_type
  • spi1_mux_l : iomux_type
  • spi1en : crm_type
  • spi1rst : crm_type
  • spi2_gmux : iomux_type
  • spi2en : crm_type
  • spi2rst : crm_type
  • spien : spi_type, usbd_type
  • spk_alt_setting : usb_audio_hid_type, usb_audio_type
  • spk_buffer : audio_codec_type
  • spk_calc : audio_codec_type
  • spk_enable : audio_codec_type
  • spk_freq : audio_codec_type, usb_audio_hid_type, usb_audio_type
  • spk_mute : audio_codec_type, usb_audio_hid_type, usb_audio_type
  • spk_rend : audio_codec_type
  • spk_roff : audio_codec_type
  • spk_rtotal : audio_codec_type
  • spk_stage : audio_codec_type
  • spk_threshold : audio_codec_type
  • spk_tx_size : audio_codec_type
  • spk_volume : audio_codec_type, usb_audio_hid_type, usb_audio_type
  • spk_volume_limits : usb_audio_hid_type, usb_audio_type
  • spk_woff : audio_codec_type
  • spk_wtotal : audio_codec_type
  • sprst : can_type
  • spt1 : adc_type
  • spt1_bit : adc_type
  • spt2 : adc_type
  • spt2_bit : adc_type
  • sqen : adc_type
  • sramen : crm_type
  • src_sel0 : dma_type
  • src_sel0_bit : dma_type
  • src_sel1 : dma_type
  • src_sel1_bit : dma_type
  • ssb : usd_type
  • ssp : usbd_type
  • stall : usb_ept_info
  • standard_id : can_rx_message_type, can_tx_message_type
  • standby_debug : debug_type
  • startf : i2c_type
  • state : iap_info_type
  • status : i2c_handle_type, usb_ept_info
  • stctrl : tmr_type
  • stctrl_bit : tmr_type
  • stdby_rst : flash_type
  • stdsel : spi_type
  • step : acc_type
  • stis : tmr_type
  • stopbn : usart_type
  • stopf : i2c_type
  • stretch : i2c_type
  • sts : acc_type, adc_type, dma_type, flash_type, sdio_type, spi_type, tmr_type, usart_type, wdt_type, wwdt_type
  • sts1 : i2c_type
  • sts1_bit : i2c_type
  • sts2 : i2c_type
  • sts2_bit : i2c_type
  • sts3 : flash_type
  • sts3_bit : flash_type
  • sts_bit : acc_type, adc_type, dma_type, flash_type, sdio_type, spi_type, usart_type, wdt_type, wwdt_type
  • swcsen : spi_type
  • swcsil : spi_type
  • swef : pwc_type
  • swevt : tmr_type
  • swevt_bit : tmr_type
  • swjtag_conf : iomux_type
  • swjtag_gmux : iomux_type
  • swpen : pwc_type
  • swrstf : crm_type
  • swtrg : exint_type
  • swtrg_bit : exint_type
  • swtx : exint_type


AT32F413 Firmwary Library: Data Fields

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all struct and union fields with links to the structures/unions they belong to:

- t -

  • t : sc_atr_type
  • t0 : sc_atr_type
  • ta : rtc_type
  • taac : sd_csd_struct_type
  • taf : rtc_type
  • tah : rtc_type
  • tah_bit : rtc_type
  • taien : rtc_type
  • tail : usart_group_type
  • tal : rtc_type
  • tal_bit : rtc_type
  • tc : usbd_type
  • tcien : can_type, usbd_type
  • tcrc : spi_type
  • tcrc_bit : spi_type
  • tdbe : i2c_type, spi_type, usart_type
  • tdbeie : spi_type
  • tdbeien : usart_type
  • tdc : i2c_type, usart_type
  • tdcien : usart_type
  • tden : tmr_type
  • tec : can_type
  • temp : keyboard_type
  • temp_write_protect : sd_csd_struct_type
  • ten : usart_type
  • tfrdir : sdio_type
  • tfren : sdio_type
  • tfrmode : sdio_type
  • tien : tmr_type
  • timeout : i2c_handle_type, sdio_data_struct_type, sdio_type
  • tlength : sc_atr_type
  • tm0alf : can_type
  • tm0ct : can_type
  • tm0ef : can_type
  • tm0lpf : can_type
  • tm0tcf : can_type
  • tm0tef : can_type
  • tm0tsf : can_type
  • tm1alf : can_type
  • tm1ct : can_type
  • tm1ef : can_type
  • tm1lpf : can_type
  • tm1tcf : can_type
  • tm1tef : can_type
  • tm1tsf : can_type
  • tm2alf : can_type
  • tm2ct : can_type
  • tm2ef : can_type
  • tm2lpf : can_type
  • tm2tcf : can_type
  • tm2tef : can_type
  • tm2tsf : can_type
  • tmc : can_tx_mailbox_type
  • tmc_bit : can_tx_mailbox_type
  • tmdt0 : can_tx_mailbox_type
  • tmdt1 : can_tx_mailbox_type
  • tmdt2 : can_tx_mailbox_type
  • tmdt3 : can_tx_mailbox_type
  • tmdt4 : can_tx_mailbox_type
  • tmdt5 : can_tx_mailbox_type
  • tmdt6 : can_tx_mailbox_type
  • tmdt7 : can_tx_mailbox_type
  • tmdtbl : can_tx_mailbox_type
  • tmdth : can_tx_mailbox_type
  • tmdth_bit : can_tx_mailbox_type
  • tmdtl : can_tx_mailbox_type
  • tmdtl_bit : can_tx_mailbox_type
  • tmeid : can_tx_mailbox_type
  • tmfrsel : can_tx_mailbox_type
  • tmi : can_tx_mailbox_type
  • tmi_bit : can_tx_mailbox_type
  • tmidsel : can_tx_mailbox_type
  • tmnr : can_type
  • tmout : i2c_type
  • tmr10_gmux : iomux_type
  • tmr10_pause : debug_type
  • tmr10en : crm_type
  • tmr10rst : crm_type
  • tmr11_gmux : iomux_type
  • tmr11_pause : debug_type
  • tmr11en : crm_type
  • tmr11rst : crm_type
  • tmr1_gmux : iomux_type
  • tmr1_mux : iomux_type
  • tmr1_pause : debug_type
  • tmr1en : crm_type
  • tmr1rst : crm_type
  • tmr2_gmux : iomux_type
  • tmr2_mux : iomux_type
  • tmr2_pause : debug_type
  • tmr2en : crm_type
  • tmr2itr1_gmux : iomux_type
  • tmr2rst : crm_type
  • tmr3_gmux : iomux_type
  • tmr3_mux : iomux_type
  • tmr3_pause : debug_type
  • tmr3en : crm_type
  • tmr3rst : crm_type
  • tmr4_pause : debug_type
  • tmr4en : crm_type
  • tmr4rst : crm_type
  • tmr5_gmux : iomux_type
  • tmr5_pause : debug_type
  • tmr5ch4_gmux : iomux_type
  • tmr5ch4_mux : iomux_type
  • tmr5en : crm_type
  • tmr5rst : crm_type
  • tmr8_pause : debug_type
  • tmr8en : crm_type
  • tmr8rst : crm_type
  • tmr9_gmux : iomux_type
  • tmr9_pause : debug_type
  • tmr9en : crm_type
  • tmr9rst : crm_type
  • tmren : tmr_type
  • tmrise : i2c_type
  • tmrise_bit : i2c_type
  • tmsid : can_tx_mailbox_type
  • tmsr : can_tx_mailbox_type
  • tmts : can_tx_mailbox_type
  • tmtsten : can_tx_mailbox_type
  • total_len : usb_ept_info
  • tpef : bpr_type
  • tpefclr : bpr_type
  • tpen : bpr_type
  • tpien : bpr_type
  • tpif : bpr_type
  • tpifclr : bpr_type
  • tpp : bpr_type
  • trace_ioen : debug_type
  • trace_mode : debug_type
  • trans_buf : usb_ept_info
  • trans_len : usb_ept_info
  • trans_type : usb_ept_info, usbd_type
  • transfer_direction : sdio_data_struct_type
  • transfer_mode : sdio_data_struct_type
  • transmission_mode : spi_init_type
  • trgif : tmr_type
  • trgswtr : tmr_type
  • trmode : i2c_type
  • ts : sc_atr_type
  • tsf : rtc_type
  • tsien : rtc_type
  • tsts : can_type
  • tsts_bit : can_type
  • ttc_enable : can_base_type
  • ttcen : can_type
  • tuerr : spi_type
  • tx_addr : usb_ept_info
  • tx_length : iap_info_type
  • tx_mailbox : can_type
  • txbuf : sdio_type
  • txbufe : sdio_type
  • txbufeien : sdio_type
  • txbuff : sdio_type
  • txbuffien : sdio_type
  • txbufh : sdio_type
  • txbufhien : sdio_type
  • txbufien : sdio_type
  • txdts : usbd_type
  • txerru : sdio_type
  • txerruien : sdio_type
  • txsts : usbd_type
  • txtc : usbd_type


AT32F413 Firmwary Library: Data Fields

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all struct and union fields with links to the structures/unions they belong to:

- u -

  • uart4_gmux : iomux_type
  • uart4en : crm_type
  • uart4rst : crm_type
  • uart5en : crm_type
  • uart5rst : crm_type
  • ucfor : usbd_type
  • ucforien : usbd_type
  • uen : usart_type
  • ukval : flash_type
  • unlock : flash_type
  • unlock3 : flash_type
  • unlock3_bit : flash_type
  • unlock_bit : flash_type
  • updf : rtc_type
  • usart1_gmux : iomux_type
  • usart1_mux : iomux_type
  • usart1en : crm_type
  • usart1rst : crm_type
  • usart2en : crm_type
  • usart2rst : crm_type
  • usart3_gmux : iomux_type
  • usart3_mux : iomux_type
  • usart3en : crm_type
  • usart3rst : crm_type
  • usb_reg : usbd_core_type
  • usbbufs : crm_type
  • usbdiv_h : crm_type
  • usbdiv_l : crm_type
  • usben : crm_type
  • usbintmap : crm_type
  • usbrst : crm_type
  • usd : flash_type
  • usd_bit : flash_type
  • usd_ukval : flash_type
  • usd_unlock : flash_type
  • usd_unlock_bit : flash_type
  • usderr : flash_type
  • usders : flash_type
  • usdprgm : flash_type
  • usdulks : flash_type
  • user_d0 : flash_type
  • user_d1 : flash_type


AT32F413 Firmwary Library: Data Fields

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all struct and union fields with links to the structures/unions they belong to:

- v -

  • vmcsel : adc_type
  • vmhb : adc_type
  • vmhb_bit : adc_type
  • vmlb : adc_type
  • vmlb_bit : adc_type
  • vmor : adc_type
  • vmorien : adc_type
  • vmsgen : adc_type


AT32F413 Firmwary Library: Data Fields

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all struct and union fields with links to the structures/unions they belong to:

- w -

  • wait_type : sdio_command_struct_type
  • wdt_ato_en : flash_type
  • wdt_pause : debug_type
  • wdtrstf : crm_type
  • week : calendar_type
  • win : wwdt_type
  • wIndex : usb_setup_type
  • wk : usbd_type
  • wkien : usbd_type
  • wLength : usb_setup_type
  • wMaxPacketSize : usb_endpoint_desc_type
  • wp_level : tmr_brkdt_config_type
  • wpc : tmr_type
  • wpen0 : gpio_type
  • wpen1 : gpio_type
  • wpen10 : gpio_type
  • wpen11 : gpio_type
  • wpen12 : gpio_type
  • wpen13 : gpio_type
  • wpen14 : gpio_type
  • wpen15 : gpio_type
  • wpen2 : gpio_type
  • wpen3 : gpio_type
  • wpen4 : gpio_type
  • wpen5 : gpio_type
  • wpen6 : gpio_type
  • wpen7 : gpio_type
  • wpen8 : gpio_type
  • wpen9 : gpio_type
  • wpr : gpio_type
  • wpr_bit : gpio_type
  • wpseq : gpio_type
  • write_addr : flash_iap_type
  • write_blk_misalign : sd_csd_struct_type
  • write_crc : flash_iap_type
  • write_data : fat_dir_type
  • write_protect_group_enable : sd_csd_struct_type
  • write_protect_group_size : sd_csd_struct_type
  • write_speed_factor : sd_csd_struct_type
  • write_time : fat_dir_type
  • wTotalLength : usb_configuration_desc_type
  • wum : usart_type
  • wValue : usb_setup_type
  • wwdt_pause : debug_type
  • wwdten : crm_type, wwdt_type
  • wwdtrst : crm_type
  • wwdtrstf : crm_type


AT32F413 Firmwary Library: Data Fields

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all struct and union fields with links to the structures/unions they belong to:

- y -

  • year : calendar_type


AT32F413 Firmwary Library: Data Fields - Variables

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all variables with links to the structures/unions they belong to:

- a -

  • accen : crm_type
  • accrst : crm_type
  • acken : i2c_type
  • ackfail : i2c_type
  • acs : spi_type
  • adc1_eto_gmux : iomux_type
  • adc1_etp_gmux : iomux_type
  • adc1_extrgord_mux : iomux_type
  • adc1_extrgpre_mux : iomux_type
  • adc1en : crm_type
  • adc1rst : crm_type
  • adc2_eto_gmux : iomux_type
  • adc2_etp_gmux : iomux_type
  • adc2_extrgord_mux : iomux_type
  • adc2_extrgpre_mux : iomux_type
  • adc2en : crm_type
  • adc2odt : adc_type
  • adc2rst : crm_type
  • adc_freq : crm_clocks_freq_type
  • adcal : adc_type
  • adcalinit : adc_type
  • adcdiv_h : crm_type
  • adcdiv_l : crm_type
  • adcen : adc_type
  • addr : flash_type, tmr_type, usbd_type
  • addr1 : i2c_type
  • addr1mode : i2c_type
  • addr2 : i2c_type
  • addr2en : i2c_type
  • addr3 : flash_type
  • addr3_bit : flash_type
  • addr7f : i2c_type
  • addr_bit : flash_type
  • address : cbd_extended_type, cbd_typical_type
  • addrhf : i2c_type
  • aebo_enable : can_base_type
  • aeboen : can_type
  • aed_enable : can_base_type
  • aeden : can_type
  • ahb_freq : crm_clocks_freq_type
  • ahbdiv : crm_type
  • ahben : crm_type
  • ahben_bit : crm_type
  • alertf : i2c_type
  • alloc_length : cbd_extended_type, cbd_typical_type
  • alt_setting : cdc_msc_struct_type, cdc_struct_type, custom_hid_type, iap_info_type, keyboard_type, mouse_type, msc_type, printer_type, usb_audio_hid_type, vcp_keyboard_type, winusb_struct_type
  • aoen : tmr_type
  • apb1_freq : crm_clocks_freq_type
  • apb1div : crm_type
  • apb1en : crm_type
  • apb1en_bit : crm_type
  • apb1rst : crm_type
  • apb1rst_bit : crm_type
  • apb2_freq : crm_clocks_freq_type
  • apb2div : crm_type
  • apb2en : crm_type
  • apb2en_bit : crm_type
  • apb2rst : crm_type
  • apb2rst_bit : crm_type
  • app_address : iap_info_type
  • argu : sdio_type
  • argu_bit : sdio_type
  • argument : sdio_command_struct_type
  • arlost : i2c_type
  • arpen : i2c_type
  • as_length : sense_type
  • asc : sense_type
  • ascq : sense_type
  • attr : fat_dir_type
  • audio_bitw : audio_codec_type
  • audio_cmd : usb_audio_hid_type, usb_audio_type
  • audio_cmd_len : usb_audio_hid_type, usb_audio_type
  • audio_feed_back : usb_audio_hid_type, usb_audio_type
  • audio_freq : audio_codec_type
  • audio_mic_data : usb_audio_hid_type, usb_audio_type
  • audio_protocol : i2s_init_type
  • audio_sampling_freq : i2s_init_type
  • audio_spk_data : usb_audio_hid_type, usb_audio_type
  • auto_output_enable : tmr_brkdt_config_type
  • auto_step_en : crm_type


AT32F413 Firmwary Library: Data Fields - Variables

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all variables with links to the structures/unions they belong to:

- b -

  • bAlternateSetting : usb_interface_desc_type
  • bankers : flash_type
  • baudr : usart_type
  • baudr_bit : usart_type
  • baudrate_div : can_baudrate_type
  • bCBWCBLength : cbw_type
  • bCBWLUN : cbw_type
  • bcdDevice : usb_device_desc_type
  • bcdUSB : usb_device_desc_type
  • bConfigurationValue : usb_configuration_desc_type
  • bCSWStatus : csw_type
  • bDescriptorType : usb_configuration_desc_type, usb_device_desc_type, usb_endpoint_desc_type, usb_header_desc_type, usb_interface_desc_type
  • bDeviceClass : usb_device_desc_type
  • bDeviceProtocol : usb_device_desc_type
  • bDeviceSubClass : usb_device_desc_type
  • be : usbd_type
  • beien : usbd_type
  • bEndpointAddress : usb_endpoint_desc_type
  • bf : spi_type
  • bfbn : usart_type
  • bff : usart_type
  • bfien : usart_type
  • bInterfaceClass : usb_interface_desc_type
  • bInterfaceNumber : usb_interface_desc_type
  • bInterfaceProtocol : usb_interface_desc_type
  • bInterfaceSubClass : usb_interface_desc_type
  • bInterval : usb_endpoint_desc_type
  • bitrate : linecoding_type
  • bLength : usb_configuration_desc_type, usb_device_desc_type, usb_endpoint_desc_type, usb_header_desc_type, usb_interface_desc_type
  • blk_addr : cdc_msc_struct_type, msc_type
  • blk_len : cdc_msc_struct_type, msc_type
  • blk_nbr : cdc_msc_struct_type, msc_type
  • blk_size : cdc_msc_struct_type, msc_type
  • blksize : sdio_type
  • block_size : sdio_data_struct_type
  • bmAttributes : usb_configuration_desc_type, usb_endpoint_desc_type
  • bMaxPacketSize0 : usb_device_desc_type
  • bMaxPower : usb_configuration_desc_type
  • bmCBWFlags : cbw_type
  • bmRequestType : usb_setup_type
  • bNumConfigurations : usb_device_desc_type
  • bNumEndpoints : usb_interface_desc_type
  • bNumInterfaces : usb_configuration_desc_type
  • bof : can_type
  • boien : can_type
  • bot_status : cdc_msc_struct_type, msc_type
  • bpdc : crm_type
  • bpdc_bit : crm_type
  • bpdrst : crm_type
  • bpren : crm_type
  • bprrst : crm_type
  • bpwen : pwc_type
  • brdiv : can_type
  • bRequest : usb_setup_type
  • brk : tmr_type
  • brk_bit : tmr_type
  • brk_enable : tmr_brkdt_config_type
  • brk_polarity : tmr_brkdt_config_type
  • brken : tmr_type
  • brkie : tmr_type
  • brkif : tmr_type
  • brkswtr : tmr_type
  • brkv : tmr_type
  • btaddr : usbd_type
  • btmg : can_type
  • btmg_bit : can_type
  • bts1 : can_type
  • bts1_size : can_baudrate_type
  • bts2 : can_type
  • bts2_size : can_baudrate_type
  • buf : sdio_type, usart_group_type
  • buf_bit : sdio_type
  • bufcnt : sdio_type
  • bufcnt_bit : sdio_type
  • buffer_size : dma_init_type
  • buftbl : usbd_type
  • buftbl_bit : usbd_type
  • buserr : i2c_type
  • busws : sdio_type
  • busyf : i2c_type
  • bypsen : sdio_type


AT32F413 Firmwary Library: Data Fields - Variables

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all variables with links to the structures/unions they belong to:

- c -

  • c1 : acc_type
  • c1_bit : acc_type
  • c1c : tmr_type
  • c1cen : tmr_type
  • c1cios : tmr_type
  • c1cp : tmr_type
  • c1den : tmr_type
  • c1df : tmr_type
  • c1dt : tmr_type
  • c1dt_bit : tmr_type
  • c1en : tmr_type
  • c1idiv : tmr_type
  • c1ien : tmr_type
  • c1if : tmr_type
  • c1insel : tmr_type
  • c1ios : tmr_type
  • c1oben : tmr_type
  • c1octrl : tmr_type
  • c1oien : tmr_type
  • c1osen : tmr_type
  • c1p : tmr_type
  • c1rf : tmr_type
  • c1swtr : tmr_type
  • c2 : acc_type
  • c2_bit : acc_type
  • c2c : tmr_type
  • c2cen : tmr_type
  • c2cios : tmr_type
  • c2cp : tmr_type
  • c2den : tmr_type
  • c2df : tmr_type
  • c2dt : tmr_type
  • c2dt_bit : tmr_type
  • c2en : tmr_type
  • c2idiv : tmr_type
  • c2ien : tmr_type
  • c2if : tmr_type
  • c2ios : tmr_type
  • c2oben : tmr_type
  • c2octrl : tmr_type
  • c2oien : tmr_type
  • c2osen : tmr_type
  • c2p : tmr_type
  • c2rf : tmr_type
  • c2swtr : tmr_type
  • c3 : acc_type
  • c3_bit : acc_type
  • c3c : tmr_type
  • c3cen : tmr_type
  • c3cios : tmr_type
  • c3cp : tmr_type
  • c3den : tmr_type
  • c3df : tmr_type
  • c3dt : tmr_type
  • c3dt_bit : tmr_type
  • c3en : tmr_type
  • c3idiv : tmr_type
  • c3ien : tmr_type
  • c3if : tmr_type
  • c3ios : tmr_type
  • c3oben : tmr_type
  • c3octrl : tmr_type
  • c3oien : tmr_type
  • c3osen : tmr_type
  • c3p : tmr_type
  • c3rf : tmr_type
  • c3swtr : tmr_type
  • c4c : tmr_type
  • c4den : tmr_type
  • c4df : tmr_type
  • c4dt : tmr_type
  • c4dt_bit : tmr_type
  • c4en : tmr_type
  • c4idiv : tmr_type
  • c4ien : tmr_type
  • c4if : tmr_type
  • c4ios : tmr_type
  • c4oben : tmr_type
  • c4octrl : tmr_type
  • c4oien : tmr_type
  • c4osen : tmr_type
  • c4p : tmr_type
  • c4rf : tmr_type
  • c4swtr : tmr_type
  • calon : acc_type
  • calout : bpr_type
  • calrdy : acc_type
  • calrdyien : acc_type
  • calval : bpr_type
  • can1_gmux : iomux_type
  • can1_pause : debug_type
  • can1en : crm_type
  • can1rst : crm_type
  • can2_gmux : iomux_type
  • can2_pause : debug_type
  • can2en : crm_type
  • can2rst : crm_type
  • can_mux : iomux_type
  • card_blk_size : sd_card_info_struct_type
  • card_capacity : sd_card_info_struct_type
  • card_cmd_classes : sd_csd_struct_type
  • card_type : sd_card_info_struct_type
  • cardsts1 : sdio_type
  • cardsts2 : sdio_type
  • cardsts3 : sdio_type
  • cardsts4 : sdio_type
  • cbctrl : tmr_type
  • cbw_struct : cdc_msc_struct_type, msc_type
  • CBWCB : cbw_type
  • cce : adc_type
  • cceien : adc_type
  • ccen : spi_type
  • ccerr : spi_type
  • ccfs : tmr_type
  • ccos : bpr_type
  • ccsmen : sdio_type
  • cctrl : tmr_type
  • cctrl_bit : tmr_type
  • cdt : crc_type
  • cdt_bit : crc_type
  • cen : usbd_type
  • cfden : crm_type
  • cfdf : crm_type
  • cfdfc : crm_type
  • cfg : crm_type, usbd_type, wwdt_type
  • cfg_bit : crm_type, usbd_type, wwdt_type
  • cfgen : rtc_type
  • cfgf : rtc_type
  • cfghr : gpio_type
  • cfghr_bit : gpio_type
  • cfglr : gpio_type
  • cfglr_bit : gpio_type
  • ch1_src : dma_type
  • ch2_src : dma_type
  • ch3_src : dma_type
  • ch4_src : dma_type
  • ch5_src : dma_type
  • ch6_src : dma_type
  • ch7_src : dma_type
  • chen : dma_channel_type
  • chpers : flash_type
  • chpl : dma_channel_type
  • cid_crc : sd_cid_struct_type
  • class_handler : usbd_core_type
  • clck : usbd_type
  • clear_handler : usbd_class_handler
  • clk_to_tmr : crm_type
  • clkctrl : i2c_type, sdio_type
  • clkctrl_bit : i2c_type, sdio_type
  • clkdiv : tmr_type
  • clkdiv_h : sdio_type
  • clkdiv_l : sdio_type
  • clkegs : sdio_type
  • clken : usart_type
  • clkfreq : i2c_type
  • clkint : crm_type
  • clkint_bit : crm_type
  • clkoen : sdio_type
  • clkout_sel : crm_type
  • clkoutdiv : crm_type
  • clkpha : spi_type, usart_type
  • clkpol : spi_type, usart_type
  • clock_phase : spi_init_type
  • clock_polarity : i2s_init_type, spi_init_type
  • clr : dma_type, gpio_type
  • clr_bit : dma_type, gpio_type
  • clsef : pwc_type
  • clswef : pwc_type
  • clus_high : fat_dir_type
  • clus_low : fat_dir_type
  • cm1 : tmr_type
  • cm1_input_bit : tmr_type
  • cm1_output_bit : tmr_type
  • cm2 : tmr_type
  • cm2_input_bit : tmr_type
  • cm2_output_bit : tmr_type
  • cmd : wdt_type
  • cmd20_support : sd_scr_struct_type
  • cmd23_support : sd_scr_struct_type
  • cmd_addr : cmd_data_group_type
  • cmd_bit : wdt_type
  • cmd_buf : cmd_data_group_type
  • cmd_check : cmd_data_group_type
  • cmd_head : cmd_data_group_type
  • cmd_index : sdio_command_struct_type
  • cmdcmpl : sdio_type
  • cmdcmplien : sdio_type
  • cmdctrl : sdio_type
  • cmdctrl_bit : sdio_type
  • cmdfail : sdio_type
  • cmdfailien : sdio_type
  • cmdidx : sdio_type
  • cmdrspcmpl : sdio_type
  • cmdrspcmplien : sdio_type
  • cmdtimeout : sdio_type
  • cmdtimeoutien : sdio_type
  • cnt : dma_channel_type, rtc_type, sdio_type, wwdt_type
  • cnt_dir : tmr_type
  • cnth : rtc_type
  • cnth_bit : rtc_type
  • cntl : rtc_type
  • cntl_bit : rtc_type
  • config_status : usbd_core_type
  • conn_state : usbd_core_type
  • content_protect_app : sd_csd_struct_type
  • copy_flag : sd_csd_struct_type
  • count : usart_group_type
  • cpoly : spi_type
  • cpoly_bit : spi_type
  • crc_chkr : flash_type
  • crc_chkr_bit : flash_type
  • crc_ctrl : flash_type
  • crc_ctrl_bit : flash_type
  • crc_sn : flash_type
  • crc_ss : flash_type
  • crc_strt : flash_type
  • crcen : crm_type
  • create_data : fat_dir_type
  • create_time : fat_dir_type
  • create_time_tenth : fat_dir_type
  • cs_mode_selection : spi_init_type
  • csd_crc : sd_csd_struct_type
  • csd_struct : sd_csd_struct_type
  • cspt0 : adc_type
  • cspt1 : adc_type
  • cspt10 : adc_type
  • cspt11 : adc_type
  • cspt12 : adc_type
  • cspt13 : adc_type
  • cspt14 : adc_type
  • cspt15 : adc_type
  • cspt16 : adc_type
  • cspt17 : adc_type
  • cspt2 : adc_type
  • cspt3 : adc_type
  • cspt4 : adc_type
  • cspt5 : adc_type
  • cspt6 : adc_type
  • cspt7 : adc_type
  • cspt8 : adc_type
  • cspt9 : adc_type
  • csrst : usbd_type
  • csw_struct : cdc_msc_struct_type, msc_type
  • ctrl : bpr_type, crc_type, crm_type, debug_type, dma_channel_type, flash_type, pwc_type, usbd_type, wwdt_type
  • ctrl1 : acc_type, adc_type, i2c_type, spi_type, tmr_type, usart_type
  • ctrl1_bit : acc_type, adc_type, i2c_type, spi_type, tmr_type, usart_type
  • ctrl2 : acc_type, adc_type, i2c_type, spi_type, tmr_type, usart_type
  • ctrl2_bit : acc_type, adc_type, i2c_type, spi_type, tmr_type, usart_type
  • ctrl3 : flash_type, usart_type
  • ctrl3_bit : flash_type, usart_type
  • ctrl_bit : bpr_type, crc_type, crm_type, debug_type, dma_channel_type, flash_type, pwc_type, usbd_type, wwdt_type
  • ctrlh : rtc_type
  • ctrlh_bit : rtc_type
  • ctrll : rtc_type
  • ctrll_bit : rtc_type
  • ctrlsts : bpr_type, crm_type, pwc_type
  • ctrlsts_bit : bpr_type, crm_type, pwc_type
  • ctscf : usart_type
  • ctscfien : usart_type
  • ctsen : usart_type
  • curs : can_type
  • cuss : can_type
  • cval : tmr_type
  • cval_bit : tmr_type


AT32F413 Firmwary Library: Data Fields - Variables

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all variables with links to the structures/unions they belong to:

- d -

  • da : flash_type
  • da_bit : flash_type
  • data : can_rx_message_type, can_tx_message_type, cdc_msc_struct_type, linecoding_type, msc_type
  • data0 : usd_type
  • data1 : usd_type
  • data2 : usd_type
  • data3 : usd_type
  • data4 : usd_type
  • data5 : usd_type
  • data6 : usd_type
  • data7 : usd_type
  • data_align : adc_base_config_type
  • data_channel_format : i2s_init_type
  • data_len : cdc_msc_struct_type, msc_type
  • data_length : sdio_data_struct_type
  • data_stat_after_erase : sd_scr_struct_type
  • dataien : i2c_type
  • date : calendar_type
  • dbn : usart_type
  • dCBWDataTransferLength : cbw_type
  • dCBWSignature : cbw_type
  • dCBWTage : cbw_type
  • dCSWDataResidue : csw_type
  • dCSWSignature : csw_type
  • dCSWTag : csw_type
  • deadtime : tmr_brkdt_config_type
  • deepsleep_debug : debug_type
  • default_config : usbd_core_type
  • depslp_rst : flash_type
  • desc_handler : usbd_core_type
  • descriptor : usbd_desc_t
  • dev_config : usbd_core_type
  • devaddr : usbd_type
  • devaddr_bit : usbd_type
  • devaddrf : i2c_type
  • device_addr : usbd_core_type
  • device_size : sd_csd_struct_type
  • device_size_mult : sd_csd_struct_type
  • direction : dma_init_type
  • dirf : i2c_type
  • disusb : usbd_type
  • div : rtc_type, tmr_type, usart_type, wdt_type, wwdt_type
  • div_bit : tmr_type, wdt_type
  • divcnt : rtc_type
  • divcnth : rtc_type
  • divcnth_bit : rtc_type
  • divcntl : rtc_type
  • divcntl_bit : rtc_type
  • divf : wdt_type
  • divh : rtc_type
  • divh_bit : rtc_type
  • divl : rtc_type
  • divl_bit : rtc_type
  • dlc : can_rx_message_type, can_tx_message_type
  • dma1en : crm_type
  • dma2en : crm_type
  • dma_flex_en : dma_type
  • dma_init_struct : i2c_handle_type
  • dma_rx_channel : i2c_handle_type
  • dma_tx_channel : i2c_handle_type
  • dmactrl : tmr_type
  • dmactrl_bit : tmr_type
  • dmadt : tmr_type
  • dmadt_bit : tmr_type
  • dmaen : i2c_type, sdio_type
  • dmaend : i2c_type
  • dmaren : spi_type, usart_type
  • dmaten : spi_type, usart_type
  • dmsts : usbd_type
  • docmd : sdio_type
  • docmdien : sdio_type
  • dorx : sdio_type
  • dorxien : sdio_type
  • dotx : sdio_type
  • dotxien : sdio_type
  • dpsts : usbd_type
  • drs : tmr_type
  • dsr_implemented : sd_csd_struct_type
  • dt : bpr_type, crc_type, i2c_type, sdio_type, spi_type, usart_type
  • dt1 : bpr_type
  • dt10 : bpr_type
  • dt10_bit : bpr_type
  • dt11 : bpr_type
  • dt11_bit : bpr_type
  • dt12 : bpr_type
  • dt12_bit : bpr_type
  • dt13 : bpr_type
  • dt13_bit : bpr_type
  • dt14 : bpr_type
  • dt14_bit : bpr_type
  • dt15 : bpr_type
  • dt15_bit : bpr_type
  • dt16 : bpr_type
  • dt16_bit : bpr_type
  • dt17 : bpr_type
  • dt17_bit : bpr_type
  • dt18 : bpr_type
  • dt18_bit : bpr_type
  • dt19 : bpr_type
  • dt19_bit : bpr_type
  • dt1_bit : bpr_type
  • dt2 : bpr_type
  • dt20 : bpr_type
  • dt20_bit : bpr_type
  • dt21 : bpr_type
  • dt21_bit : bpr_type
  • dt22 : bpr_type
  • dt22_bit : bpr_type
  • dt23 : bpr_type
  • dt23_bit : bpr_type
  • dt24 : bpr_type
  • dt24_bit : bpr_type
  • dt25 : bpr_type
  • dt25_bit : bpr_type
  • dt26 : bpr_type
  • dt26_bit : bpr_type
  • dt27 : bpr_type
  • dt27_bit : bpr_type
  • dt28 : bpr_type
  • dt28_bit : bpr_type
  • dt29 : bpr_type
  • dt29_bit : bpr_type
  • dt2_bit : bpr_type
  • dt3 : bpr_type
  • dt30 : bpr_type
  • dt30_bit : bpr_type
  • dt31 : bpr_type
  • dt31_bit : bpr_type
  • dt32 : bpr_type
  • dt32_bit : bpr_type
  • dt33 : bpr_type
  • dt33_bit : bpr_type
  • dt34 : bpr_type
  • dt34_bit : bpr_type
  • dt35 : bpr_type
  • dt35_bit : bpr_type
  • dt36 : bpr_type
  • dt36_bit : bpr_type
  • dt37 : bpr_type
  • dt37_bit : bpr_type
  • dt38 : bpr_type
  • dt38_bit : bpr_type
  • dt39 : bpr_type
  • dt39_bit : bpr_type
  • dt3_bit : bpr_type
  • dt4 : bpr_type
  • dt40 : bpr_type
  • dt40_bit : bpr_type
  • dt41 : bpr_type
  • dt41_bit : bpr_type
  • dt42 : bpr_type
  • dt42_bit : bpr_type
  • dt4_bit : bpr_type
  • dt5 : bpr_type
  • dt5_bit : bpr_type
  • dt6 : bpr_type
  • dt6_bit : bpr_type
  • dt7 : bpr_type
  • dt7_bit : bpr_type
  • dt8 : bpr_type
  • dt8_bit : bpr_type
  • dt9 : bpr_type
  • dt9_bit : bpr_type
  • dt_bit : crc_type, i2c_type, spi_type, usart_type
  • dtalign : adc_type
  • dtb : tmr_type
  • dtblkcmpl : sdio_type
  • dtblkcmplien : sdio_type
  • dtc : tmr_type
  • dtcmpl : sdio_type
  • dtcmplien : sdio_type
  • dtcnt : dma_channel_type, sdio_type
  • dtcnt_bit : dma_channel_type, sdio_type
  • dtctrl : sdio_type
  • dtctrl_bit : sdio_type
  • dtd : dma_channel_type
  • dterrf1 : dma_type
  • dterrf2 : dma_type
  • dterrf3 : dma_type
  • dterrf4 : dma_type
  • dterrf5 : dma_type
  • dterrf6 : dma_type
  • dterrf7 : dma_type
  • dterrfc1 : dma_type
  • dterrfc2 : dma_type
  • dterrfc3 : dma_type
  • dterrfc4 : dma_type
  • dterrfc5 : dma_type
  • dterrfc6 : dma_type
  • dterrfc7 : dma_type
  • dterrien : dma_channel_type
  • dtfail : sdio_type
  • dtfailien : sdio_type
  • dtlen : sdio_type
  • dtlen_bit : sdio_type
  • dttimeout : sdio_type
  • dttimeoutien : sdio_type
  • dttmr : sdio_type
  • dttmr_bit : sdio_type
  • dutymode : i2c_type
  • dzc : can_type
  • dzen : can_type


AT32F413 Firmwary Library: Data Fields - Variables

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all variables with links to the structures/unions they belong to:

- e -

  • eaf : can_type
  • eaien : can_type
  • ecc_code : sd_csd_struct_type
  • ecmben : tmr_type
  • edzien : can_type
  • edzif : can_type
  • eien : acc_type
  • enpd : usb_audio_hid_type, usb_audio_type
  • entrim : acc_type
  • eoien : can_type
  • eoif : can_type
  • eopb0 : usd_type
  • epf : can_type
  • epien : can_type
  • epp0 : usd_type
  • epp1 : usd_type
  • epp2 : usd_type
  • epp3 : usd_type
  • epperr : flash_type
  • epps : flash_type
  • epps_bit : flash_type
  • ept : usbd_type
  • ept0_rx_handler : usbd_class_handler
  • ept0_slen : usb_ept_info
  • ept0_sts : usbd_core_type
  • ept0_tx_handler : usbd_class_handler
  • ept0_wlength : usbd_core_type
  • ept_address : usb_ept_info
  • ept_bit : usbd_type
  • ept_in : usbd_core_type
  • ept_num : usbd_type
  • ept_out : usbd_core_type
  • eptaddr : usbd_type
  • eptn : usb_ept_info
  • erase_group_size : sd_csd_struct_type
  • erase_group_size_mult : sd_csd_struct_type
  • err_code : sense_type
  • errie : flash_type, spi_type
  • errien : i2c_type, usart_type
  • error_code : i2c_handle_type
  • erstr : flash_type
  • esdiv : tmr_type
  • esf : tmr_type
  • esp : tmr_type
  • ests : can_type
  • ests_bit : can_type
  • etr : can_type
  • etrien : can_type
  • event_handler : usbd_class_handler
  • evoen : iomux_type
  • evten : exint_type
  • evten_bit : exint_type
  • evtenx : exint_type
  • evtien : i2c_type
  • evtout : iomux_type
  • evtout_bit : iomux_type
  • exf : usbd_type
  • exint0 : iomux_type
  • exint1 : iomux_type
  • exint10 : iomux_type
  • exint11 : iomux_type
  • exint12 : iomux_type
  • exint13 : iomux_type
  • exint14 : iomux_type
  • exint15 : iomux_type
  • exint2 : iomux_type
  • exint3 : iomux_type
  • exint4 : iomux_type
  • exint5 : iomux_type
  • exint6 : iomux_type
  • exint7 : iomux_type
  • exint8 : iomux_type
  • exint9 : iomux_type
  • exintc1 : iomux_type
  • exintc1_bit : iomux_type
  • exintc2 : iomux_type
  • exintc2_bit : iomux_type
  • exintc3 : iomux_type
  • exintc3_bit : iomux_type
  • exintc4 : iomux_type
  • exintc4_bit : iomux_type
  • exintrst : crm_type
  • ext_flash_key : usd_type
  • ext_spim_en_mux : iomux_type
  • ext_spim_gen : iomux_type
  • ext_spim_gmux : iomux_type
  • extended_id : can_rx_message_type, can_tx_message_type


AT32F413 Firmwary Library: Data Fields - Variables

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all variables with links to the structures/unions they belong to:

- f -

  • fa : flash_type
  • facfg : can_type
  • facfg_bit : can_type
  • faen0 : can_type
  • faen1 : can_type
  • faen10 : can_type
  • faen11 : can_type
  • faen12 : can_type
  • faen13 : can_type
  • faen2 : can_type
  • faen3 : can_type
  • faen4 : can_type
  • faen5 : can_type
  • faen6 : can_type
  • faen7 : can_type
  • faen8 : can_type
  • faen9 : can_type
  • fap : flash_type, usd_type
  • fbn : spi_type
  • fbwcfg : can_type
  • fbwcfg_bit : can_type
  • fbwsel0 : can_type
  • fbwsel1 : can_type
  • fbwsel10 : can_type
  • fbwsel11 : can_type
  • fbwsel12 : can_type
  • fbwsel13 : can_type
  • fbwsel2 : can_type
  • fbwsel3 : can_type
  • fbwsel4 : can_type
  • fbwsel5 : can_type
  • fbwsel6 : can_type
  • fbwsel7 : can_type
  • fbwsel8 : can_type
  • fbwsel9 : can_type
  • fcs : can_type
  • fcsodis : tmr_type
  • fcsodis_state : tmr_brkdt_config_type
  • fcsoen : tmr_type
  • fcsoen_state : tmr_brkdt_config_type
  • fctrl : can_type
  • fctrl_bit : can_type
  • fda : flash_type
  • fdtf1 : dma_type
  • fdtf2 : dma_type
  • fdtf3 : dma_type
  • fdtf4 : dma_type
  • fdtf5 : dma_type
  • fdtf6 : dma_type
  • fdtf7 : dma_type
  • fdtfc1 : dma_type
  • fdtfc2 : dma_type
  • fdtfc3 : dma_type
  • fdtfc4 : dma_type
  • fdtfc5 : dma_type
  • fdtfc6 : dma_type
  • fdtfc7 : dma_type
  • fdtien : dma_channel_type
  • ferr : usart_type
  • ffb : can_type
  • ffdb1 : can_filter_register_type
  • ffdb2 : can_filter_register_type
  • fifo_length : iap_info_type
  • fifo_mailbox : can_type
  • file_formart : sd_csd_struct_type
  • file_format_group : sd_csd_struct_type
  • file_name : fat_dir_type
  • file_size : fat_dir_type
  • file_write_nr : flash_iap_type
  • filter_activate_enable : can_filter_init_type
  • filter_bit : can_filter_init_type
  • filter_fifo : can_filter_init_type
  • filter_id_high : can_filter_init_type
  • filter_id_low : can_filter_init_type
  • filter_index : can_rx_message_type
  • filter_mask_high : can_filter_init_type
  • filter_mask_low : can_filter_init_type
  • filter_mode : can_filter_init_type
  • filter_number : can_filter_init_type
  • firmware_length : flash_iap_type
  • first_bit_transmission : spi_init_type
  • flag_address : iap_info_type
  • flash_app_addr : flash_iap_type
  • flash_app_size : flash_iap_type
  • flash_base_addr : flash_iap_type
  • flash_end_address : iap_info_type
  • flash_size : flash_iap_type, iap_info_type
  • flash_start_address : iap_info_type
  • flashen : crm_type
  • fmcfg : can_type
  • fmcfg_bit : can_type
  • fmsel0 : can_type
  • fmsel1 : can_type
  • fmsel10 : can_type
  • fmsel11 : can_type
  • fmsel12 : can_type
  • fmsel13 : can_type
  • fmsel2 : can_type
  • fmsel3 : can_type
  • fmsel4 : can_type
  • fmsel5 : can_type
  • fmsel6 : can_type
  • fmsel7 : can_type
  • fmsel8 : can_type
  • fmsel9 : can_type
  • format : linecoding_type
  • fprgm : flash_type
  • fpx : exint_type
  • frame_bit_num : spi_init_type
  • frame_type : can_rx_message_type, can_tx_message_type
  • frf : can_type
  • frf_bit : can_type
  • frfsel0 : can_type
  • frfsel1 : can_type
  • frfsel10 : can_type
  • frfsel11 : can_type
  • frfsel12 : can_type
  • frfsel13 : can_type
  • frfsel2 : can_type
  • frfsel3 : can_type
  • frfsel4 : can_type
  • frfsel5 : can_type
  • frfsel6 : can_type
  • frfsel7 : can_type
  • frfsel8 : can_type
  • frfsel9 : can_type
  • fzc : can_type
  • fzen : can_type


AT32F413 Firmwary Library: Data Fields - Variables

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all variables with links to the structures/unions they belong to:

- g -

  • g_audio_cur : usb_audio_hid_type, usb_audio_type
  • g_cmd : cdc_msc_struct_type, cdc_struct_type, vcp_keyboard_type
  • g_keyboard_tx_completed : vcp_keyboard_type
  • g_len : cdc_msc_struct_type, cdc_struct_type, vcp_keyboard_type, winusb_struct_type
  • g_printer_data : printer_type
  • g_printer_port_status : printer_type
  • g_req : cdc_msc_struct_type, cdc_struct_type, vcp_keyboard_type
  • g_rx_buff : cdc_msc_struct_type, cdc_struct_type, printer_type, vcp_keyboard_type, winusb_struct_type
  • g_rx_completed : cdc_msc_struct_type, cdc_struct_type, printer_type, vcp_keyboard_type, winusb_struct_type
  • g_rxhid_buff : custom_hid_type, iap_info_type, usb_audio_hid_type
  • g_rxlen : cdc_msc_struct_type, cdc_struct_type, printer_type, vcp_keyboard_type, winusb_struct_type
  • g_tx_completed : cdc_msc_struct_type, cdc_struct_type, printer_type, vcp_keyboard_type, winusb_struct_type
  • g_txhid_buff : custom_hid_type, usb_audio_hid_type
  • g_u8tx_completed : keyboard_type
  • gcaddrf : i2c_type
  • gcaen : i2c_type
  • gdiv : usart_type
  • gdiv_bit : usart_type
  • genstart : i2c_type
  • genstop : i2c_type
  • get_device_config_string : usbd_desc_handler
  • get_device_configuration : usbd_desc_handler
  • get_device_descriptor : usbd_desc_handler
  • get_device_interface_string : usbd_desc_handler
  • get_device_lang_id : usbd_desc_handler
  • get_device_manufacturer_string : usbd_desc_handler
  • get_device_other_speed : usbd_desc_handler
  • get_device_product_string : usbd_desc_handler
  • get_device_qualifier : usbd_desc_handler
  • get_device_serial_string : usbd_desc_handler
  • gf1 : dma_type
  • gf2 : dma_type
  • gf3 : dma_type
  • gf4 : dma_type
  • gf5 : dma_type
  • gf6 : dma_type
  • gf7 : dma_type
  • gfc1 : dma_type
  • gfc2 : dma_type
  • gfc3 : dma_type
  • gfc4 : dma_type
  • gfc5 : dma_type
  • gfc6 : dma_type
  • gfc7 : dma_type
  • gpio_drive_strength : gpio_init_type
  • gpio_mode : gpio_init_type
  • gpio_out_type : gpio_init_type
  • gpio_pins : gpio_init_type
  • gpio_pull : gpio_init_type
  • gpioaen : crm_type
  • gpioarst : crm_type
  • gpioben : crm_type
  • gpiobrst : crm_type
  • gpiocen : crm_type
  • gpiocrst : crm_type
  • gpioden : crm_type
  • gpiodrst : crm_type
  • gpioerst : crm_type
  • gpiofen : crm_type
  • gresume : usbd_type


AT32F413 Firmwary Library: Data Fields - Variables

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all variables with links to the structures/unions they belong to:

- h -

  • h : sc_atr_type
  • hallde : tmr_type
  • hallien : tmr_type
  • hallif : tmr_type
  • hallswtr : tmr_type
  • hdtf1 : dma_type
  • hdtf2 : dma_type
  • hdtf3 : dma_type
  • hdtf4 : dma_type
  • hdtf5 : dma_type
  • hdtf6 : dma_type
  • hdtf7 : dma_type
  • hdtfc1 : dma_type
  • hdtfc2 : dma_type
  • hdtfc3 : dma_type
  • hdtfc4 : dma_type
  • hdtfc5 : dma_type
  • hdtfc6 : dma_type
  • hdtfc7 : dma_type
  • hdtien : dma_channel_type
  • head : usart_group_type
  • hextbyps : crm_type
  • hexten : crm_type
  • hextstbl : crm_type
  • hextstblf : crm_type
  • hextstblfc : crm_type
  • hextstblien : crm_type
  • hfcen : sdio_type
  • hick_to_sclk : crm_type
  • hick_to_usb : crm_type
  • hickcal : acc_type, crm_type
  • hickcal_key : crm_type
  • hickdiv : crm_type
  • hicken : crm_type
  • hickstbl : crm_type
  • hickstblf : crm_type
  • hickstblfc : crm_type
  • hickstblien : crm_type
  • hicktrim : acc_type, crm_type
  • hid_get_report : custom_hid_type
  • hid_protocol : custom_hid_type, iap_info_type, keyboard_type, mouse_type, usb_audio_hid_type, vcp_keyboard_type
  • hid_set_idle : custom_hid_type, iap_info_type, keyboard_type, mouse_type, usb_audio_hid_type, vcp_keyboard_type
  • hid_set_report : custom_hid_type, iap_info_type, keyboard_type, mouse_type, usb_audio_hid_type, vcp_keyboard_type
  • hid_state : custom_hid_type, iap_info_type, keyboard_type, mouse_type, usb_audio_hid_type, vcp_keyboard_type
  • hid_suspend_flag : keyboard_type, mouse_type
  • hlength : sc_atr_type
  • hostaddrf : i2c_type
  • hour : calendar_type
  • hwcsoe : spi_type


AT32F413 Firmwary Library: Data Fields - Variables

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all variables with links to the structures/unions they belong to:

- i -

  • i2c1_gmux : iomux_type
  • i2c1_mux : iomux_type
  • i2c1_smbus_timeout : debug_type
  • i2c1en : crm_type
  • i2c1rst : crm_type
  • i2c2_gmux : iomux_type
  • i2c2_smbus_timeout : debug_type
  • i2c2en : crm_type
  • i2c2rst : crm_type
  • i2cen : i2c_type
  • i2cx : i2c_handle_type
  • i2scbn : spi_type
  • i2sclk : spi_type
  • i2sclk_bit : spi_type
  • i2sclkpol : spi_type
  • i2sctrl : spi_type
  • i2sctrl_bit : spi_type
  • i2sdbn : spi_type
  • i2sdiv_h : spi_type
  • i2sdiv_l : spi_type
  • i2sen : spi_type
  • i2smclkoe : spi_type
  • i2smsel : spi_type
  • i2sodd : spi_type
  • iap_address : iap_info_type
  • iap_fifo : iap_info_type
  • iap_rx : iap_info_type
  • iap_tx : iap_info_type
  • iConfiguration : usb_configuration_desc_type
  • id : usart_type
  • id_type : can_rx_message_type, can_tx_message_type
  • idcode_bit : debug_type
  • iden : tmr_type
  • iden_bit : tmr_type
  • idlef : usart_type
  • idleien : usart_type
  • idProduct : usb_device_desc_type
  • idt : crc_type, gpio_type
  • idt0 : gpio_type
  • idt1 : gpio_type
  • idt10 : gpio_type
  • idt11 : gpio_type
  • idt12 : gpio_type
  • idt13 : gpio_type
  • idt14 : gpio_type
  • idt15 : gpio_type
  • idt2 : gpio_type
  • idt3 : gpio_type
  • idt4 : gpio_type
  • idt5 : gpio_type
  • idt6 : gpio_type
  • idt7 : gpio_type
  • idt8 : gpio_type
  • idt9 : gpio_type
  • idt_bit : crc_type, gpio_type
  • idVendor : usb_device_desc_type
  • iInterface : usb_interface_desc_type
  • iManufacturer : usb_device_desc_type
  • in_handler : usbd_class_handler
  • information : sense_type
  • init_handler : usbd_class_handler
  • inout : usb_ept_info, usbd_type
  • input_channel_select : tmr_input_config_type
  • input_filter_value : tmr_input_config_type
  • input_mapped_select : tmr_input_config_type
  • input_polarity_select : tmr_input_config_type
  • intclr : sdio_type
  • intclr_bit : sdio_type
  • inten : can_type, exint_type, sdio_type
  • inten_bit : can_type, exint_type, sdio_type
  • intenx : exint_type
  • interface : usb_audio_hid_type, usb_audio_type
  • intmap : crm_type
  • intmap_bit : crm_type
  • intsts : exint_type, usbd_type
  • intsts_bit : exint_type, usbd_type
  • intwt : sdio_type
  • iocb0 : gpio_type
  • iocb1 : gpio_type
  • iocb10 : gpio_type
  • iocb11 : gpio_type
  • iocb12 : gpio_type
  • iocb13 : gpio_type
  • iocb14 : gpio_type
  • iocb15 : gpio_type
  • iocb2 : gpio_type
  • iocb3 : gpio_type
  • iocb4 : gpio_type
  • iocb5 : gpio_type
  • iocb6 : gpio_type
  • iocb7 : gpio_type
  • iocb8 : gpio_type
  • iocb9 : gpio_type
  • ioen : sdio_type
  • iofc0 : gpio_type
  • iofc1 : gpio_type
  • iofc10 : gpio_type
  • iofc11 : gpio_type
  • iofc12 : gpio_type
  • iofc13 : gpio_type
  • iofc14 : gpio_type
  • iofc15 : gpio_type
  • iofc2 : gpio_type
  • iofc3 : gpio_type
  • iofc4 : gpio_type
  • iofc5 : gpio_type
  • iofc6 : gpio_type
  • iofc7 : gpio_type
  • iofc8 : gpio_type
  • iofc9 : gpio_type
  • ioif : sdio_type
  • ioifien : sdio_type
  • iomc0 : gpio_type
  • iomc1 : gpio_type
  • iomc10 : gpio_type
  • iomc11 : gpio_type
  • iomc12 : gpio_type
  • iomc13 : gpio_type
  • iomc14 : gpio_type
  • iomc15 : gpio_type
  • iomc2 : gpio_type
  • iomc3 : gpio_type
  • iomc4 : gpio_type
  • iomc5 : gpio_type
  • iomc6 : gpio_type
  • iomc7 : gpio_type
  • iomc8 : gpio_type
  • iomc9 : gpio_type
  • iomuxen : crm_type
  • iomuxrst : crm_type
  • iosb0 : gpio_type
  • iosb1 : gpio_type
  • iosb10 : gpio_type
  • iosb11 : gpio_type
  • iosb12 : gpio_type
  • iosb13 : gpio_type
  • iosb14 : gpio_type
  • iosb15 : gpio_type
  • iosb2 : gpio_type
  • iosb3 : gpio_type
  • iosb4 : gpio_type
  • iosb5 : gpio_type
  • iosb6 : gpio_type
  • iosb7 : gpio_type
  • iosb8 : gpio_type
  • iosb9 : gpio_type
  • iosusp : sdio_type
  • iProduct : usb_device_desc_type
  • irdaen : usart_type
  • irdalp : usart_type
  • is_double_buffer : usb_ept_info
  • isdiv : usart_type
  • iSerialNumber : usb_device_desc_type
  • ists : tmr_type
  • ists_bit : tmr_type
  • itsrven : adc_type


AT32F413 Firmwary Library: Data Fields - Variables

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all variables with links to the structures/unions they belong to:

- k -

  • keyboard_buf : keyboard_type


AT32F413 Firmwary Library: Data Fields - Variables

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all variables with links to the structures/unions they belong to:

- l -

  • last_access_data : fat_dir_type
  • last_len : usb_ept_info
  • lbcp : usart_type
  • lben : can_type
  • length : usbd_desc_t
  • lextbyps : crm_type
  • lexten : crm_type
  • lextstbl : crm_type
  • lextstblf : crm_type
  • lextstblfc : crm_type
  • lextstblien : crm_type
  • licken : crm_type
  • lickstbl : crm_type
  • lickstblf : crm_type
  • lickstblfc : crm_type
  • lickstblien : crm_type
  • line_enable : exint_init_type
  • line_mode : exint_init_type
  • line_polarity : exint_init_type
  • line_select : exint_init_type
  • linecoding : cdc_msc_struct_type, cdc_struct_type, vcp_keyboard_type
  • linen : usart_type
  • linex : exint_type
  • lm : dma_channel_type
  • loen : can_type
  • loop_mode_enable : dma_init_type
  • lpm : usbd_type
  • lprstf : crm_type
  • lpsel : pwc_type
  • lsamprx : can_type
  • lsof : usbd_type
  • lsofien : usbd_type
  • lsofnum : usbd_type
  • ltf : spi_type
  • lun : cbd_extended_type, cbd_typical_type


AT32F413 Firmwary Library: Data Fields - Variables

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all variables with links to the structures/unions they belong to:

- m -

  • m2m : dma_channel_type
  • mackctrl : i2c_type
  • maddr : dma_channel_type
  • maddr_bit : dma_channel_type
  • manufact_date : sd_cid_struct_type
  • manufacturer_default_ecc : sd_csd_struct_type
  • manufacturer_id : sd_cid_struct_type
  • master_slave_mode : spi_init_type
  • max_bus_clk_freq : sd_csd_struct_type
  • max_lun : cdc_msc_struct_type, msc_type
  • max_read_blk_length : sd_csd_struct_type
  • max_read_current_vdd_max : sd_csd_struct_type
  • max_read_current_vdd_min : sd_csd_struct_type
  • max_write_blk_length : sd_csd_struct_type
  • max_write_current_vdd_max : sd_csd_struct_type
  • max_write_current_vdd_min : sd_csd_struct_type
  • maxpacket : usb_ept_info, winusb_struct_type
  • mclk_freq_division : spi_init_type
  • mclk_output_enable : i2s_init_type
  • mctrl : can_type
  • mctrl_bit : can_type
  • mdiv_h : spi_type
  • mdiv_l : spi_type
  • mdrsel : can_type
  • mdrsel_selection : can_base_type
  • memory_base_addr : dma_init_type
  • memory_data_width : dma_init_type
  • memory_inc_enable : dma_init_type
  • mic_adj_count : audio_codec_type
  • mic_adj_stage : audio_codec_type
  • mic_alt_setting : usb_audio_hid_type, usb_audio_type
  • mic_buffer : audio_codec_type
  • mic_calc : audio_codec_type
  • mic_delta : audio_codec_type
  • mic_enable : audio_codec_type
  • mic_freq : usb_audio_hid_type, usb_audio_type
  • mic_mute : audio_codec_type, usb_audio_hid_type, usb_audio_type
  • mic_roff : audio_codec_type
  • mic_rtotal : audio_codec_type
  • mic_rx_size : audio_codec_type
  • mic_stage : audio_codec_type
  • mic_volume : audio_codec_type, usb_audio_hid_type, usb_audio_type
  • mic_volume_limits : usb_audio_hid_type, usb_audio_type
  • mic_wend : audio_codec_type
  • mic_woff : audio_codec_type
  • mic_wtotal : audio_codec_type
  • min : calendar_type
  • mincm : dma_channel_type
  • misc1 : crm_type
  • misc1_bit : crm_type
  • misc2 : crm_type
  • misc2_bit : crm_type
  • misc3 : crm_type
  • misc3_bit : crm_type
  • mmerr : spi_type
  • mmssr : can_type
  • mmssr_selection : can_base_type
  • mode : i2c_handle_type
  • mode_selection : can_base_type
  • month : calendar_type
  • mouse_buffer : mouse_type
  • msc_state : cdc_msc_struct_type, msc_type
  • msc_up_status : flash_iap_type
  • mssel : adc_type
  • msten : spi_type
  • msts : can_type
  • msts_bit : can_type
  • mwidth : dma_channel_type


AT32F413 Firmwary Library: Data Fields - Variables

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all variables with links to the structures/unions they belong to:

- n -

  • nerr : usart_type
  • nrstf : crm_type
  • nsac : sd_csd_struct_type
  • ntc : spi_type


AT32F413 Firmwary Library: Data Fields - Variables

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all variables with links to the structures/unions they belong to:

- o -

  • oaddr1 : i2c_type
  • oaddr1_bit : i2c_type
  • oaddr2 : i2c_type
  • oaddr2_bit : i2c_type
  • obf : flash_type
  • oc_idle_state : tmr_output_config_type
  • oc_mode : tmr_output_config_type
  • oc_output_state : tmr_output_config_type
  • oc_polarity : tmr_output_config_type
  • occ_idle_state : tmr_output_config_type
  • occ_output_state : tmr_output_config_type
  • occ_polarity : tmr_output_config_type
  • occs : adc_type
  • ocdmaen : adc_type
  • oclen : adc_type
  • ocmen : tmr_type
  • ocpcnt : adc_type
  • ocpen : adc_type
  • ocswtrg : adc_type
  • octen : adc_type
  • octesel_h : adc_type
  • octesel_l : adc_type
  • ocvmen : adc_type
  • odf : flash_type
  • odfie : flash_type
  • odt : adc_type, gpio_type
  • odt0 : gpio_type
  • odt1 : gpio_type
  • odt10 : gpio_type
  • odt11 : gpio_type
  • odt12 : gpio_type
  • odt13 : gpio_type
  • odt14 : gpio_type
  • odt15 : gpio_type
  • odt2 : gpio_type
  • odt3 : gpio_type
  • odt4 : gpio_type
  • odt5 : gpio_type
  • odt6 : gpio_type
  • odt7 : gpio_type
  • odt8 : gpio_type
  • odt9 : gpio_type
  • odt_bit : adc_type, gpio_type
  • oem_app_id : sd_cid_struct_type
  • oen : tmr_type
  • old_conn_state : usbd_core_type
  • opcode : cbd_extended_type, cbd_typical_type
  • operation_mode : i2s_init_type
  • opersel : spi_type
  • oplk : flash_type
  • ora : spi_type
  • ordinary_channel_length : adc_base_config_type
  • osn1 : adc_type
  • osn10 : adc_type
  • osn11 : adc_type
  • osn12 : adc_type
  • osn13 : adc_type
  • osn14 : adc_type
  • osn15 : adc_type
  • osn16 : adc_type
  • osn2 : adc_type
  • osn3 : adc_type
  • osn4 : adc_type
  • osn5 : adc_type
  • osn6 : adc_type
  • osn7 : adc_type
  • osn8 : adc_type
  • osn9 : adc_type
  • osq1 : adc_type
  • osq1_bit : adc_type
  • osq2 : adc_type
  • osq2_bit : adc_type
  • osq3 : adc_type
  • osq3_bit : adc_type
  • ouf : i2c_type
  • out_handler : usbd_class_handler
  • outen : bpr_type
  • outm : bpr_type
  • outsel : bpr_type
  • ovfden : tmr_type
  • ovfen : tmr_type
  • ovff : rtc_type
  • ovfien : rtc_type, tmr_type
  • ovfif : tmr_type
  • ovfs : tmr_type
  • ovfswtr : tmr_type


AT32F413 Firmwary Library: Data Fields - Variables

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all variables with links to the structures/unions they belong to:

- p -

  • paddr : dma_channel_type
  • paddr_bit : dma_channel_type
  • parity : linecoding_type
  • part_blk_read : sd_csd_struct_type
  • part_blk_write : sd_csd_struct_type
  • pbuff : i2c_handle_type
  • pcautoen : adc_type
  • pcce : adc_type
  • pcceien : adc_type
  • pccs : adc_type
  • pcdto1 : adc_type
  • pcdto1_bit : adc_type
  • pcdto2 : adc_type
  • pcdto2_bit : adc_type
  • pcdto3 : adc_type
  • pcdto3_bit : adc_type
  • pcdto4 : adc_type
  • pcdto4_bit : adc_type
  • pclen : adc_type
  • pcmfssel : spi_type
  • pcount : i2c_handle_type
  • pcpen : adc_type
  • pcswtrg : adc_type
  • pcten : adc_type
  • pctesel_h : adc_type
  • pctesel_l : adc_type
  • pcvmen : adc_type
  • pd01_gmux : iomux_type
  • pd01_mux : iomux_type
  • pdata : usbd_class_handler
  • pdt1 : adc_type
  • pdt1_bit : adc_type
  • pdt2 : adc_type
  • pdt2_bit : adc_type
  • pdt3 : adc_type
  • pdt3_bit : adc_type
  • pdt4 : adc_type
  • pdt4_bit : adc_type
  • pecen : i2c_type
  • pecerr : i2c_type
  • pecten : i2c_type
  • pecval : i2c_type
  • pen : usart_type
  • peripheral_base_addr : dma_init_type
  • peripheral_data_width : dma_init_type
  • peripheral_inc_enable : dma_init_type
  • permanent_write_protect : sd_csd_struct_type
  • permode : i2c_type
  • perr : usart_type
  • perrien : usart_type
  • pid : debug_type
  • pincm : dma_channel_type
  • pllen : crm_type
  • pllhextdiv : crm_type
  • pllmult_h : crm_type
  • pllmult_l : crm_type
  • pllrange : crm_type
  • pllrcs : crm_type
  • pllstbl : crm_type
  • pllstblf : crm_type
  • pllstblfc : crm_type
  • pllstblien : crm_type
  • pmen : tmr_type
  • pndwt : sdio_type
  • polcfg1 : exint_type
  • polcfg1_bit : exint_type
  • polcfg2 : exint_type
  • polcfg2_bit : exint_type
  • poly : crc_type
  • poly_bit : crc_type
  • poly_size : crc_type
  • porrstf : crm_type
  • pr : tmr_type
  • pr_bit : tmr_type
  • prben : tmr_type
  • prgmerr : flash_type
  • priority : dma_init_type
  • product_name1 : sd_cid_struct_type
  • product_name2 : sd_cid_struct_type
  • product_reversion : sd_cid_struct_type
  • product_sn : sd_cid_struct_type
  • prsf_enable : can_base_type
  • prsfen : can_type
  • ps : sdio_type
  • psel : usart_type
  • psn1 : adc_type
  • psn2 : adc_type
  • psn3 : adc_type
  • psn4 : adc_type
  • psq : adc_type
  • psq_bit : adc_type
  • psr : flash_type
  • psr_bit : flash_type
  • ptd : can_type
  • ptos : tmr_type
  • pvmen : pwc_type
  • pvmof : pwc_type
  • pvmsel : pwc_type
  • pwcen : crm_type
  • pwcrst : crm_type
  • pwidth : dma_channel_type
  • pwrctrl : sdio_type
  • pwrctrl_bit : sdio_type
  • pwrsven : sdio_type


AT32F413 Firmwary Library: Data Fields - Variables

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all variables with links to the structures/unions they belong to:

- q -

  • qdzien : can_type
  • qdzif : can_type


AT32F413 Firmwary Library: Data Fields - Variables

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all variables with links to the structures/unions they belong to:

- r -

  • rca : sd_card_info_struct_type
  • rcrc : spi_type
  • rcrc_bit : spi_type
  • rdbf : i2c_type, spi_type, usart_type
  • rdbfie : spi_type
  • rdbfien : usart_type
  • rdwtmode : sdio_type
  • rdwtstart : sdio_type
  • rdwtstop : sdio_type
  • read_blk_misalign : sd_csd_struct_type
  • read_crc : flash_iap_type
  • realrx : can_type
  • rec : can_type
  • rem0_len : usb_ept_info
  • remap : iomux_type
  • remap2 : iomux_type
  • remap2_bit : iomux_type
  • remap3 : iomux_type
  • remap3_bit : iomux_type
  • remap4 : iomux_type
  • remap4_bit : iomux_type
  • remap5 : iomux_type
  • remap5_bit : iomux_type
  • remap6 : iomux_type
  • remap6_bit : iomux_type
  • remap7 : iomux_type
  • remap7_bit : iomux_type
  • remap_bit : iomux_type
  • remote_wakup : usbd_core_type
  • ren : usart_type
  • repeat_mode : adc_base_config_type
  • request_no : usb_audio_hid_type, usb_audio_type
  • res : fat_dir_type
  • reserved : tmr_type, usd_type
  • reserved1 : acc_type, adc_type, bpr_type, can_fifo_mailbox_type, can_tx_mailbox_type, can_type, cbd_extended_type, cbd_typical_type, crc_type, crm_type, debug_type, dma_channel_type, dma_type, exint_type, flash_type, gpio_type, i2c_type, iomux_type, pwc_type, rtc_type, sd_cid_struct_type, sd_csd_struct_type, sd_scr_struct_type, sdio_type, sense_type, spi_type, tmr_type, usart_type, usbd_type, wdt_type, wwdt_type
  • reserved2 : acc_type, adc_type, bpr_type, can_tx_mailbox_type, can_type, cbd_extended_type, cbd_typical_type, crc_type, crm_type, debug_type, flash_type, i2c_type, iomux_type, pwc_type, sd_cid_struct_type, sd_csd_struct_type, sdio_type, sense_type, spi_type, tmr_type, usart_type, usbd_type
  • reserved3 : acc_type, adc_type, bpr_type, can_type, crm_type, debug_type, flash_type, i2c_type, iomux_type, sd_csd_struct_type, sense_type, usart_type
  • reserved4 : adc_type, can_type, crm_type, debug_type, flash_type, iomux_type, sd_csd_struct_type
  • reserved5 : can_type, crm_type, flash_type
  • reserved6 : can_type, crm_type, flash_type
  • reserverd2 : sd_scr_struct_type
  • reserverd3 : sd_scr_struct_type
  • reset : i2c_type
  • respond_flag : iap_info_type
  • revid : crc_type
  • revod : crc_type
  • rf0 : can_type
  • rf0_bit : can_type
  • rf0ff : can_type
  • rf0fien : can_type
  • rf0mien : can_type
  • rf0mn : can_type
  • rf0of : can_type
  • rf0oien : can_type
  • rf0r : can_type
  • rf1 : can_type
  • rf1_bit : can_type
  • rf1ff : can_type
  • rf1fien : can_type
  • rf1mien : can_type
  • rf1mn : can_type
  • rf1of : can_type
  • rf1oien : can_type
  • rf1r : can_type
  • rfc : can_fifo_mailbox_type
  • rfc_bit : can_fifo_mailbox_type
  • rfdt0 : can_fifo_mailbox_type
  • rfdt1 : can_fifo_mailbox_type
  • rfdt2 : can_fifo_mailbox_type
  • rfdt3 : can_fifo_mailbox_type
  • rfdt4 : can_fifo_mailbox_type
  • rfdt5 : can_fifo_mailbox_type
  • rfdt6 : can_fifo_mailbox_type
  • rfdt7 : can_fifo_mailbox_type
  • rfdth : can_fifo_mailbox_type
  • rfdth_bit : can_fifo_mailbox_type
  • rfdtl : can_fifo_mailbox_type
  • rfdtl_bit : can_fifo_mailbox_type
  • rfeid : can_fifo_mailbox_type
  • rffmn : can_fifo_mailbox_type
  • rffri : can_fifo_mailbox_type
  • rfi : can_fifo_mailbox_type
  • rfi_bit : can_fifo_mailbox_type
  • rfidi : can_fifo_mailbox_type
  • rfsid : can_fifo_mailbox_type
  • rfts : can_fifo_mailbox_type
  • risetime : i2c_type
  • rld : wdt_type
  • rld_bit : wdt_type
  • rldf : wdt_type, wwdt_type
  • rldien : wwdt_type
  • rm : usart_type
  • roerr : spi_type, usart_type
  • rpen : adc_type
  • rpr : tmr_type
  • rpr_bit : tmr_type
  • rpx : exint_type
  • rsaw : can_type
  • rsaw_size : can_baudrate_type
  • rslost : acc_type
  • rsp1 : sdio_type
  • rsp1_bit : sdio_type
  • rsp2 : sdio_type
  • rsp2_bit : sdio_type
  • rsp3 : sdio_type
  • rsp3_bit : sdio_type
  • rsp4 : sdio_type
  • rsp4_bit : sdio_type
  • rsp_type : sdio_command_struct_type
  • rspcmd : sdio_type
  • rspcmd_bit : sdio_type
  • rspwt : sdio_type
  • rst : crc_type, usbd_type
  • rstfc : crm_type
  • rstien : usbd_type
  • rtccal : bpr_type
  • rtccal_bit : bpr_type
  • rtcen : crm_type
  • rtcsel : crm_type
  • rtsen : usart_type
  • rx_addr : usb_ept_info
  • rxbuf : sdio_type
  • rxbufe : sdio_type
  • rxbufeien : sdio_type
  • rxbuff : sdio_type
  • rxbuffien : sdio_type
  • rxbufh : sdio_type
  • rxbufhien : sdio_type
  • rxbufien : sdio_type
  • rxdts : usbd_type
  • rxerro : sdio_type
  • rxerroien : sdio_type
  • rxsts : usbd_type
  • rxtc : usbd_type


AT32F413 Firmwary Library: Data Fields - Variables

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all variables with links to the structures/unions they belong to:

- s -

  • sbf : usart_type
  • sbiterr : sdio_type
  • sbiterrien : sdio_type
  • scgt : usart_type
  • sclk_freq : crm_clocks_freq_type
  • sclksel : crm_type
  • sclksts : crm_type
  • scmen : usart_type
  • scnacken : usart_type
  • scr : gpio_type
  • scr_bit : gpio_type
  • scr_structure : sd_scr_struct_type
  • sd_bus_width : sd_scr_struct_type
  • sd_cid_reg : sd_card_info_struct_type
  • sd_csd_reg : sd_card_info_struct_type
  • sd_scr_reg : sd_card_info_struct_type
  • sd_security : sd_scr_struct_type
  • sd_spec : sd_scr_struct_type
  • sd_spec3 : sd_scr_struct_type
  • sdio1_gmux : iomux_type
  • sdio1en : crm_type
  • sec : calendar_type
  • secers : flash_type
  • sector_mask : flash_iap_type
  • sector_size : flash_iap_type, iap_info_type
  • sef : pwc_type
  • select : flash_type
  • select_bit : flash_type
  • selpin : iomux_type
  • selport : iomux_type
  • send_state : custom_hid_type, keyboard_type, mouse_type
  • sense_key : sense_type
  • sequence_mode : adc_base_config_type
  • setup : usbd_core_type
  • setup_buffer : usbd_core_type
  • setup_handler : usbd_class_handler
  • setuptc : usbd_type
  • slben : spi_type, usart_type
  • slbtd : spi_type
  • sleep_debug : debug_type
  • slib_dat_ss : flash_type
  • slib_dss_set : flash_type
  • slib_enf : flash_type
  • slib_es : flash_type
  • slib_es_set : flash_type
  • slib_misc_sts : flash_type
  • slib_misc_sts_bit : flash_type
  • slib_pclr_val : flash_type
  • slib_pset_val : flash_type
  • slib_pwd_clr : flash_type
  • slib_pwd_clr_bit : flash_type
  • slib_pwd_err : flash_type
  • slib_pwd_ok : flash_type
  • slib_rcnt : flash_type
  • slib_set_pwd : flash_type
  • slib_set_pwd_bit : flash_type
  • slib_set_range : flash_type
  • slib_set_range_bit : flash_type
  • slib_ss : flash_type
  • slib_ss_set : flash_type
  • slib_sts0 : flash_type
  • slib_sts0_bit : flash_type
  • slib_sts1 : flash_type
  • slib_sts1_bit : flash_type
  • slib_ukval : flash_type
  • slib_ulkf : flash_type
  • slib_unlock : flash_type
  • slib_unlock_bit : flash_type
  • smbalert : i2c_type
  • smbmode : i2c_type
  • smsel : tmr_type
  • sof : usbd_type
  • sof_handler : usbd_class_handler
  • sofien : usbd_type
  • sofnum : usbd_type
  • sofouten : usbd_type
  • sofrnum : usbd_type
  • sofrnum_bit : usbd_type
  • sp : usbd_type
  • spec_version : sd_csd_struct_type
  • speed : i2c_type, usbd_core_type
  • speedmode : i2c_type
  • spi1_gmux : iomux_type
  • spi1_mux_h : iomux_type
  • spi1_mux_l : iomux_type
  • spi1en : crm_type
  • spi1rst : crm_type
  • spi2_gmux : iomux_type
  • spi2en : crm_type
  • spi2rst : crm_type
  • spien : spi_type, usbd_type
  • spk_alt_setting : usb_audio_hid_type, usb_audio_type
  • spk_buffer : audio_codec_type
  • spk_calc : audio_codec_type
  • spk_enable : audio_codec_type
  • spk_freq : audio_codec_type, usb_audio_hid_type, usb_audio_type
  • spk_mute : audio_codec_type, usb_audio_hid_type, usb_audio_type
  • spk_rend : audio_codec_type
  • spk_roff : audio_codec_type
  • spk_rtotal : audio_codec_type
  • spk_stage : audio_codec_type
  • spk_threshold : audio_codec_type
  • spk_tx_size : audio_codec_type
  • spk_volume : audio_codec_type, usb_audio_hid_type, usb_audio_type
  • spk_volume_limits : usb_audio_hid_type, usb_audio_type
  • spk_woff : audio_codec_type
  • spk_wtotal : audio_codec_type
  • sprst : can_type
  • spt1 : adc_type
  • spt1_bit : adc_type
  • spt2 : adc_type
  • spt2_bit : adc_type
  • sqen : adc_type
  • sramen : crm_type
  • src_sel0 : dma_type
  • src_sel0_bit : dma_type
  • src_sel1 : dma_type
  • src_sel1_bit : dma_type
  • ssb : usd_type
  • ssp : usbd_type
  • stall : usb_ept_info
  • standard_id : can_rx_message_type, can_tx_message_type
  • standby_debug : debug_type
  • startf : i2c_type
  • state : iap_info_type
  • status : i2c_handle_type, usb_ept_info
  • stctrl : tmr_type
  • stctrl_bit : tmr_type
  • stdby_rst : flash_type
  • stdsel : spi_type
  • step : acc_type
  • stis : tmr_type
  • stopbn : usart_type
  • stopf : i2c_type
  • stretch : i2c_type
  • sts : acc_type, adc_type, dma_type, flash_type, sdio_type, spi_type, tmr_type, usart_type, wdt_type, wwdt_type
  • sts1 : i2c_type
  • sts1_bit : i2c_type
  • sts2 : i2c_type
  • sts2_bit : i2c_type
  • sts3 : flash_type
  • sts3_bit : flash_type
  • sts_bit : acc_type, adc_type, dma_type, flash_type, sdio_type, spi_type, usart_type, wdt_type, wwdt_type
  • swcsen : spi_type
  • swcsil : spi_type
  • swef : pwc_type
  • swevt : tmr_type
  • swevt_bit : tmr_type
  • swjtag_conf : iomux_type
  • swjtag_gmux : iomux_type
  • swpen : pwc_type
  • swrstf : crm_type
  • swtrg : exint_type
  • swtrg_bit : exint_type
  • swtx : exint_type


AT32F413 Firmwary Library: Data Fields - Variables

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all variables with links to the structures/unions they belong to:

- t -

  • t : sc_atr_type
  • t0 : sc_atr_type
  • ta : rtc_type
  • taac : sd_csd_struct_type
  • taf : rtc_type
  • tah : rtc_type
  • tah_bit : rtc_type
  • taien : rtc_type
  • tail : usart_group_type
  • tal : rtc_type
  • tal_bit : rtc_type
  • tc : usbd_type
  • tcien : can_type, usbd_type
  • tcrc : spi_type
  • tcrc_bit : spi_type
  • tdbe : i2c_type, spi_type, usart_type
  • tdbeie : spi_type
  • tdbeien : usart_type
  • tdc : i2c_type, usart_type
  • tdcien : usart_type
  • tden : tmr_type
  • tec : can_type
  • temp : keyboard_type
  • temp_write_protect : sd_csd_struct_type
  • ten : usart_type
  • tfrdir : sdio_type
  • tfren : sdio_type
  • tfrmode : sdio_type
  • tien : tmr_type
  • timeout : i2c_handle_type, sdio_data_struct_type, sdio_type
  • tlength : sc_atr_type
  • tm0alf : can_type
  • tm0ct : can_type
  • tm0ef : can_type
  • tm0lpf : can_type
  • tm0tcf : can_type
  • tm0tef : can_type
  • tm0tsf : can_type
  • tm1alf : can_type
  • tm1ct : can_type
  • tm1ef : can_type
  • tm1lpf : can_type
  • tm1tcf : can_type
  • tm1tef : can_type
  • tm1tsf : can_type
  • tm2alf : can_type
  • tm2ct : can_type
  • tm2ef : can_type
  • tm2lpf : can_type
  • tm2tcf : can_type
  • tm2tef : can_type
  • tm2tsf : can_type
  • tmc : can_tx_mailbox_type
  • tmc_bit : can_tx_mailbox_type
  • tmdt0 : can_tx_mailbox_type
  • tmdt1 : can_tx_mailbox_type
  • tmdt2 : can_tx_mailbox_type
  • tmdt3 : can_tx_mailbox_type
  • tmdt4 : can_tx_mailbox_type
  • tmdt5 : can_tx_mailbox_type
  • tmdt6 : can_tx_mailbox_type
  • tmdt7 : can_tx_mailbox_type
  • tmdtbl : can_tx_mailbox_type
  • tmdth : can_tx_mailbox_type
  • tmdth_bit : can_tx_mailbox_type
  • tmdtl : can_tx_mailbox_type
  • tmdtl_bit : can_tx_mailbox_type
  • tmeid : can_tx_mailbox_type
  • tmfrsel : can_tx_mailbox_type
  • tmi : can_tx_mailbox_type
  • tmi_bit : can_tx_mailbox_type
  • tmidsel : can_tx_mailbox_type
  • tmnr : can_type
  • tmout : i2c_type
  • tmr10_gmux : iomux_type
  • tmr10_pause : debug_type
  • tmr10en : crm_type
  • tmr10rst : crm_type
  • tmr11_gmux : iomux_type
  • tmr11_pause : debug_type
  • tmr11en : crm_type
  • tmr11rst : crm_type
  • tmr1_gmux : iomux_type
  • tmr1_mux : iomux_type
  • tmr1_pause : debug_type
  • tmr1en : crm_type
  • tmr1rst : crm_type
  • tmr2_gmux : iomux_type
  • tmr2_mux : iomux_type
  • tmr2_pause : debug_type
  • tmr2en : crm_type
  • tmr2itr1_gmux : iomux_type
  • tmr2rst : crm_type
  • tmr3_gmux : iomux_type
  • tmr3_mux : iomux_type
  • tmr3_pause : debug_type
  • tmr3en : crm_type
  • tmr3rst : crm_type
  • tmr4_pause : debug_type
  • tmr4en : crm_type
  • tmr4rst : crm_type
  • tmr5_gmux : iomux_type
  • tmr5_pause : debug_type
  • tmr5ch4_gmux : iomux_type
  • tmr5ch4_mux : iomux_type
  • tmr5en : crm_type
  • tmr5rst : crm_type
  • tmr8_pause : debug_type
  • tmr8en : crm_type
  • tmr8rst : crm_type
  • tmr9_gmux : iomux_type
  • tmr9_pause : debug_type
  • tmr9en : crm_type
  • tmr9rst : crm_type
  • tmren : tmr_type
  • tmrise : i2c_type
  • tmrise_bit : i2c_type
  • tmsid : can_tx_mailbox_type
  • tmsr : can_tx_mailbox_type
  • tmts : can_tx_mailbox_type
  • tmtsten : can_tx_mailbox_type
  • total_len : usb_ept_info
  • tpef : bpr_type
  • tpefclr : bpr_type
  • tpen : bpr_type
  • tpien : bpr_type
  • tpif : bpr_type
  • tpifclr : bpr_type
  • tpp : bpr_type
  • trace_ioen : debug_type
  • trace_mode : debug_type
  • trans_buf : usb_ept_info
  • trans_len : usb_ept_info
  • trans_type : usb_ept_info, usbd_type
  • transfer_direction : sdio_data_struct_type
  • transfer_mode : sdio_data_struct_type
  • transmission_mode : spi_init_type
  • trgif : tmr_type
  • trgswtr : tmr_type
  • trmode : i2c_type
  • ts : sc_atr_type
  • tsf : rtc_type
  • tsien : rtc_type
  • tsts : can_type
  • tsts_bit : can_type
  • ttc_enable : can_base_type
  • ttcen : can_type
  • tuerr : spi_type
  • tx_addr : usb_ept_info
  • tx_length : iap_info_type
  • tx_mailbox : can_type
  • txbuf : sdio_type
  • txbufe : sdio_type
  • txbufeien : sdio_type
  • txbuff : sdio_type
  • txbuffien : sdio_type
  • txbufh : sdio_type
  • txbufhien : sdio_type
  • txbufien : sdio_type
  • txdts : usbd_type
  • txerru : sdio_type
  • txerruien : sdio_type
  • txsts : usbd_type
  • txtc : usbd_type


AT32F413 Firmwary Library: Data Fields - Variables

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all variables with links to the structures/unions they belong to:

- u -

  • uart4_gmux : iomux_type
  • uart4en : crm_type
  • uart4rst : crm_type
  • uart5en : crm_type
  • uart5rst : crm_type
  • ucfor : usbd_type
  • ucforien : usbd_type
  • uen : usart_type
  • ukval : flash_type
  • unlock : flash_type
  • unlock3 : flash_type
  • unlock3_bit : flash_type
  • unlock_bit : flash_type
  • updf : rtc_type
  • usart1_gmux : iomux_type
  • usart1_mux : iomux_type
  • usart1en : crm_type
  • usart1rst : crm_type
  • usart2en : crm_type
  • usart2rst : crm_type
  • usart3_gmux : iomux_type
  • usart3_mux : iomux_type
  • usart3en : crm_type
  • usart3rst : crm_type
  • usb_reg : usbd_core_type
  • usbbufs : crm_type
  • usbdiv_h : crm_type
  • usbdiv_l : crm_type
  • usben : crm_type
  • usbintmap : crm_type
  • usbrst : crm_type
  • usd : flash_type
  • usd_bit : flash_type
  • usd_ukval : flash_type
  • usd_unlock : flash_type
  • usd_unlock_bit : flash_type
  • usderr : flash_type
  • usders : flash_type
  • usdprgm : flash_type
  • usdulks : flash_type
  • user_d0 : flash_type
  • user_d1 : flash_type


AT32F413 Firmwary Library: Data Fields - Variables

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all variables with links to the structures/unions they belong to:

- v -

  • vmcsel : adc_type
  • vmhb : adc_type
  • vmhb_bit : adc_type
  • vmlb : adc_type
  • vmlb_bit : adc_type
  • vmor : adc_type
  • vmorien : adc_type
  • vmsgen : adc_type


AT32F413 Firmwary Library: Data Fields - Variables

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all variables with links to the structures/unions they belong to:

- w -

  • wait_type : sdio_command_struct_type
  • wdt_ato_en : flash_type
  • wdt_pause : debug_type
  • wdtrstf : crm_type
  • week : calendar_type
  • win : wwdt_type
  • wIndex : usb_setup_type
  • wk : usbd_type
  • wkien : usbd_type
  • wLength : usb_setup_type
  • wMaxPacketSize : usb_endpoint_desc_type
  • wp_level : tmr_brkdt_config_type
  • wpc : tmr_type
  • wpen0 : gpio_type
  • wpen1 : gpio_type
  • wpen10 : gpio_type
  • wpen11 : gpio_type
  • wpen12 : gpio_type
  • wpen13 : gpio_type
  • wpen14 : gpio_type
  • wpen15 : gpio_type
  • wpen2 : gpio_type
  • wpen3 : gpio_type
  • wpen4 : gpio_type
  • wpen5 : gpio_type
  • wpen6 : gpio_type
  • wpen7 : gpio_type
  • wpen8 : gpio_type
  • wpen9 : gpio_type
  • wpr : gpio_type
  • wpr_bit : gpio_type
  • wpseq : gpio_type
  • write_addr : flash_iap_type
  • write_blk_misalign : sd_csd_struct_type
  • write_crc : flash_iap_type
  • write_data : fat_dir_type
  • write_protect_group_enable : sd_csd_struct_type
  • write_protect_group_size : sd_csd_struct_type
  • write_speed_factor : sd_csd_struct_type
  • write_time : fat_dir_type
  • wTotalLength : usb_configuration_desc_type
  • wum : usart_type
  • wValue : usb_setup_type
  • wwdt_pause : debug_type
  • wwdten : crm_type, wwdt_type
  • wwdtrst : crm_type
  • wwdtrstf : crm_type


AT32F413 Firmwary Library: Data Fields - Variables

  • Data Structure Index
  • Data Fields
  • All
  • Variables
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • y
Here is a list of all variables with links to the structures/unions they belong to:

- y -

  • year : calendar_type


AT32F413 Firmwary Library: File List

  • File List
  • Globals
File List
Here is a list of all files with brief descriptions:
[detail level 12345678]
▼ AT32F413_Firmware_Library_V2.1.7 |
▼ libraries |
▼ cmsis |
► cm4 |
► device_support |
at32f413.h | At32f413 header file
system_at32f413.c | All the functions for cmsis cortex-m4 system source file
system_at32f413.h | Cmsis cortex-m4 system header file
▼ drivers |
► inc |
at32f413_acc.h | At32f413 acc header file
at32f413_adc.h | At32f413 adc header file
at32f413_bpr.h | At32f413 bpr header file
at32f413_can.h | At32f413 can header file
at32f413_crc.h | At32f413 crc header file
at32f413_crm.h | At32f413 crm header file
at32f413_debug.h | At32f413 debug header file
at32f413_def.h | At32f413 macros header file
at32f413_dma.h | At32f413 dma header file
at32f413_exint.h | At32f413 exint header file
at32f413_flash.h | At32f413 flash header file
at32f413_gpio.h | At32f413 gpio header file
at32f413_i2c.h | At32f413 i2c header file
at32f413_misc.h | At32f413 misc header file
at32f413_pwc.h | At32f413 pwc header file
at32f413_rtc.h | At32f413 rtc header file
at32f413_sdio.h | At32f413 sdio header file
at32f413_spi.h | At32f413 spi header file
at32f413_tmr.h | At32f413 tmr header file
at32f413_usart.h | At32f413 usart header file
at32f413_usb.h | At32f413 usb header file
at32f413_wdt.h | At32f413 wdt header file
at32f413_wwdt.h | At32f413 wwdt header file
► src |
at32f413_acc.c | All the functions for the acc firmware library
at32f413_adc.c | All the functions for the adc firmware library
at32f413_bpr.c | All the functions for the bpr firmware library
at32f413_can.c | All the functions for the can firmware library
at32f413_crc.c | All the functions for the crc firmware library
at32f413_crm.c | All the functions for the crm firmware library
at32f413_debug.c | All the functions for the debug firmware library
at32f413_dma.c | All the functions for the dma firmware library
at32f413_exint.c | All the functions for the exint firmware library
at32f413_flash.c | All the functions for the flash firmware library
at32f413_gpio.c | All the functions for the gpio firmware library
at32f413_i2c.c | All the functions for the i2c firmware library
at32f413_misc.c | All the functions for the misc firmware library
at32f413_pwc.c | All the functions for the pwc firmware library
at32f413_rtc.c | All the functions for the rtc firmware library
at32f413_sdio.c | All the functions for the sdio firmware library
at32f413_spi.c | All the functions for the spi firmware library
at32f413_tmr.c | All the functions for the tmr firmware library
at32f413_usart.c | All the functions for the usart firmware library
at32f413_usb.c | Functions for the usb firmware library
at32f413_wdt.c | All the functions for the wdt firmware library
at32f413_wwdt.c | All the functions for the wwdt firmware library
▼ main_page |
main_page.h |
▼ middlewares |
▼ i2c_application_library |
i2c_application.c | Driver library of the i2c peripheral
i2c_application.h | I2c application libray header file
▼ usbd_class |
► audio |
audio_class.c | Usb audio class type
audio_class.h | Usb audio class file
audio_conf.h | Usb audio config
audio_desc.c | Usb audio device descriptor
audio_desc.h | Usb audio descriptor header file
► audio_hid |
audio_conf.h | Usb audio config
audio_hid_class.c |
audio_hid_class.h |
audio_hid_desc.c |
audio_hid_desc.h |
► cdc |
cdc_class.c | Usb cdc class type
cdc_class.h | Usb cdc class file
cdc_desc.c | Usb cdc device descriptor
cdc_desc.h | Usb cdc descriptor header file
► composite_cdc_keyboard |
cdc_keyboard_class.c | Usb cdc and keyboard class type
cdc_keyboard_class.h | Usb cdc and keyboard class file
cdc_keyboard_desc.c | Usb cdc and keyboard device descriptor
cdc_keyboard_desc.h | Usb cdc and keyboard descriptor header file
► composite_cdc_msc |
cdc_msc_class.c | Usb cdc class type
cdc_msc_class.h | Usb cdc class file
cdc_msc_desc.c | Usb cdc device descriptor
cdc_msc_desc.h | Usb cdc descriptor header file
msc_bot_scsi.c | Usb mass storage bulk-only transport and scsi command
► custom_hid |
custom_hid_class.c | Usb custom hid class type
custom_hid_class.h | Usb custom hid header file
custom_hid_desc.c | Usb hid device descriptor
custom_hid_desc.h | Usb custom hid descriptor header file
► hid_iap |
hid_iap_class.c | Usb hid iap class type
hid_iap_class.h | Usb hid iap header file
hid_iap_desc.c | Usb hid device descriptor
hid_iap_desc.h | Usb hid descriptor header file
► keyboard |
keyboard_class.c | Usb hid keyboard class type
keyboard_class.h | Usb hid keyboard header file
keyboard_desc.c | Usb hid keyboard device descriptor
keyboard_desc.h | Usb keyboard descriptor header file
► mouse |
mouse_class.c | Usb hid mouse class type
mouse_class.h | Usb hid mouse header file
mouse_desc.c | Usb hid mouse device descriptor
mouse_desc.h | Usb mouse descriptor header file
► msc |
msc_bot_scsi.c | Usb mass storage bulk-only transport and scsi command
msc_bot_scsi.h | Usb mass storage bulk-only transport and scsi command header file
msc_class.c | Usb msc class type
msc_class.h | Usb msc class file
msc_desc.c | Usb msc device descriptor
msc_desc.h | Usb msc descriptor header file
► printer |
printer_class.c | Usb printer class type
printer_class.h | Usb printer class file
printer_desc.c | Usb printer device descriptor
printer_desc.h | Usb printer descriptor header file
► winusb |
winusb_class.c | Usb winusb class type
winusb_class.h | Usb winusb class file
winusb_desc.c | Usb winusb device descriptor
winusb_desc.h | Usb winusb descriptor header file
▼ usbd_drivers |
► inc |
usb_std.h | Usb standard header file
usbd_core.h | Usb device core header file
usbd_int.h |
usbd_sdr.h | Usb standard request header file
► src |
usbd_core.c | Usb driver
usbd_int.c | Usb interrupt request
usbd_sdr.c | Usb standard device request
▼ project |
▼ at32f413_board |
at32f413_board.c | Set of firmware functions to manage leds and push-button. initialize delay function
at32f413_board.h | Header file for at-start board. set of firmware functions to manage leds and push-button. initialize delay function
▼ at_start_f413 |
► examples |
► acc |
► calibration |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
usb_conf.h | Usb config header file
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► adc |
► combine_mode_ordinary_simult |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► current_vref_value_check |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► exint_trigger_partitioned |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► internal_temperature_sensor |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► repeat_conversion_loop_transfer |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► tmr_trigger_automatic_preempted |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► voltage_monitoring |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► bpr |
► bpr_data |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► tamper |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► can |
► communication_mode |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► filter |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► loopback_mode |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► cortex_m4 |
► bit_band |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► cmsis_dsp |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► fpu |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
julia_fpu.h | Julia_fpu header file
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
julia_fpu.c | Julia_fpu source file
main.c | Main program
► systick_interrupt |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► crc |
► calculation |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► crm |
► clock_failure_detection |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► sysclk_switch |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► debug |
► tmr1 |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► dma |
► data_to_gpio_flexible |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► flash_to_sram |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► exint |
► exint_config |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► exint_software_trigger |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► flash |
► flash_write_read |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
flash.h | Flash header file
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
flash.c | Flash program
main.c | Main program
► operate_spim |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
operate_spim.h | Operate_spim header file
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
operate_spim.c | Operate spim program
► run_in_spim |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
run_in_spim.h | Run_in_spim header file
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
run_in_spim.c | Run in spim program
► gpio |
► io_toggle |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► led_toggle |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► swjtag_remap |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► i2c |
► communication_dma |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► communication_int |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► communication_poll |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► eeprom |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
eeprom.h | I2c eeprom libray header file
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
eeprom.c | Driver library of the i2c eeprom
main.c | Main program
► memory_write |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► i2s |
► halfduplex_dma |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► halfduplex_interrupt |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► spii2s_switch_halfduplex_polling |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► pwc |
► deepsleep_rtc |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► power_voltage_monitor |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► sleep_tmr2 |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► sleep_usart1 |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► standby_rtc |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► standby_wakeup_pin |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► rtc |
► calendar |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
rtc.h | This file provides template for calendar api
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
rtc.c | This file provides template for calendar api
► lick_calibration |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► sdio |
► emmc_card |
► inc |
at32_sdio.h | This file contains all the functions prototypes for the sd/mmc card at32_sdio driver firmware library
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32_sdio.c | This file provides a set of functions needed to manage the sdio/mmc card memory
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► sd_mmc_card |
► inc |
at32_sdio.h | This file contains all the functions prototypes for the sd/mmc card at32_sdio driver firmware library
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32_sdio.c | This file provides a set of functions needed to manage the sdio/mmc card memory
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► sdio_fatfs |
► inc |
at32_sdio.h | This file contains all the functions prototypes for the sd/mmc card at32_sdio driver firmware library
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
ffconf.h |
► src |
at32_sdio.c | This file provides a set of functions needed to manage the sdio/mmc card memory
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
diskio.c |
main.c | Main program
► spi |
► crc_transfer_polling |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► fullduplex_dma_jtagpin |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► fullduplex_polling |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► halfduplex_dma_jtagpin |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► halfduplex_interrupt |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► halfduplex_transceiver_switch |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► only_receive_mode_polling |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► w25q_flash |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
spi_flash.h | Header file of spi_flash
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
spi_flash.c | Spi_flash source code
► tmr |
► 6_steps |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► 7_pwm_output |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► cascade_synchro |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► complementary_signals |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► dma |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► dma_burst |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► encoder_tmr2 |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► external_clock |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► hall_xor_tmr2 |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► hang_mode |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► input_capture |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► oc_high |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► oc_low |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► oc_toggle_tmr3 |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► oc_toggle_tmr9 |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► one_cycle |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► parallel_synchro |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► pwm_input |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► pwm_input_dma |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► pwm_output_simulate |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► pwm_output_tmr10 |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► pwm_output_tmr3 |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► timer_base |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► tmr1_synchro |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► tmr2_32bit |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► usart |
► half_duplex |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► hw_flow_control |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► idle_detection |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► interrupt |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► irda |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► polling |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► printf |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► receiver_mute |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► rs485 |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► smartcard |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
smartcard_config.h | Header file of clock program
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► synchronous |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► transfer_by_dma_interrupt |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► transfer_by_dma_polling |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► usb_device |
► audio |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
audio_codec.h | Audio codec header file
usb_conf.h | Usb config header file
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
audio_codec.c | Audio codec function
main.c | Main program
► composite_audio_hid |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
audio_codec.h | Audio codec header file
usb_conf.h | Usb config header file
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
audio_codec.c | Audio codec function
main.c | Main program
► composite_vcp_keyboard |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
usb_conf.h | Usb config header file
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► composite_vcp_msc |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
msc_diskio.h | Usb mass storage disk interface header file
usb_conf.h | Usb config header file
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
msc_diskio.c | Usb mass storage disk function
► custom_hid |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
usb_conf.h | Usb config header file
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► keyboard |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
usb_conf.h | Usb config header file
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► mouse |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
usb_conf.h | Usb config header file
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► msc |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
msc_diskio.h | Usb mass storage disk interface header file
usb_conf.h | Usb config header file
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
msc_diskio.c | Usb mass storage disk function
► printer |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
usb_conf.h | Usb config header file
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► vcp_loopback |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
usb_conf.h | Usb config header file
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► virtual_comport |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
usb_conf.h | Usb config header file
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► virtual_msc_iap |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
flash_fat16.h | Fat16 file system header file
msc_diskio.h | Usb mass storage disk interface header file
usb_conf.h | Usb config header file
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
flash_fat16.c | Fat16 file system
main.c | Main program
msc_diskio.c | Usb mass storage disk function
► winusb |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
usb_conf.h | Usb config header file
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► wdt |
► wdt_reset |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► wdt_standby |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► wwdt |
► wwdt_reset |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
► templates |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
▼ utilities |
▼ at32f413_freertos_demo |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
FreeRTOSConfig.h |
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
include_port.c | Include_port program
main.c | Main program
▼ at32f413_gen_random_number_demo |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
random.h | At32f413 random header file
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
random.c | Set of firmware functions to random function
▼ at32f413_slib_demo |
► project_l0 |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
fir_filter.h |
math_helper.h |
► src |
arm_fir_data.c |
arm_fir_init_f32.c |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
fir_coefficient.c |
fir_filter.c |
main.c | Main program
math_helper.c |
► project_l1 |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
fir_filter.h |
math_helper.h |
► src |
arm_fir_data.c |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
main.c | Main program
math_helper.c |
▼ at32f413_usart_iap_demo |
► source_code |
► app_led3_toggle |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
iap.h | Iap header file
tmr.h | Tmr header file
usart.h | Usart header file
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
iap.c | Iap program
main.c | Main program
tmr.c | Tmr program
usart.c | Usart program
► app_led4_toggle |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
iap.h | Iap header file
tmr.h | Tmr header file
usart.h | Usart header file
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
iap.c | Iap program
main.c | Main program
tmr.c | Tmr program
usart.c | Usart program
► bootloader |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
flash.h | Flash header file
iap.h | Iap header file
tmr.h | Tmr header file
usart.h | Usart header file
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
flash.c | Flash program
iap.c | Iap program
main.c | Main program
tmr.c | Tmr program
usart.c | Usart program
▼ at32f413_usb_iap_demo |
► source_code |
► app_led3_toggle |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
hid_iap_user.h | Usb config header file
usb_conf.h | Usb config header file
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
hid_iap_user.c | Usb hid iap user file
main.c | Main program
► app_led4_toggle |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
hid_iap_user.h | Usb config header file
usb_conf.h | Usb config header file
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
hid_iap_user.c | Usb hid iap user file
main.c | Main program
► bootloader |
► inc |
at32f413_clock.h | Header file of clock program
at32f413_conf.h | At32f413 config header file
at32f413_int.h | Header file of main interrupt service routines
hid_iap_user.h | Usb config header file
usb_conf.h | Usb config header file
► src |
at32f413_clock.c | System clock config program
at32f413_int.c | Main interrupt service routines
hid_iap_user.c | Usb hid iap user file
main.c | Main program


AT32F413 Firmwary Library: AT32F413_Firmware_Library_V2.1.7 Directory Reference

  • AT32F413_Firmware_Library_V2.1.7
AT32F413_Firmware_Library_V2.1.7 Directory Reference

Directories

libraries
main_page
middlewares
project
utilities


AT32F413 Firmwary Library: libraries Directory Reference

  • libraries
libraries Directory Reference

Directories

cmsis
drivers


AT32F413 Firmwary Library: cmsis Directory Reference

  • libraries
  • cmsis
cmsis Directory Reference

Directories

cm4


AT32F413 Firmwary Library: cm4 Directory Reference

  • libraries
  • cmsis
  • cm4
cm4 Directory Reference

Directories

device_support


AT32F413 Firmwary Library: device_support Directory Reference

  • libraries
  • cmsis
  • cm4
  • device_support
device_support Directory Reference

Files

at32f413.h
at32f413 header file
system_at32f413.c
contains all the functions for cmsis cortex-m4 system source file
system_at32f413.h
cmsis cortex-m4 system header file.


AT32F413 Firmwary Library: at32f413.h File Reference

  • libraries
  • cmsis
  • cm4
  • device_support
Macros | Typedefs | Enumerations
at32f413.h File Reference

at32f413 header file More...

#include "core_cm4.h"
#include "system_at32f413.h"
#include <stdint.h>
#include "at32f413_def.h"
#include "at32f413_conf.h"

Go to the source code of this file.

Macros

#define | __AT32F413_LIBRARY_VERSION_MAJOR (0x02)
at32f413 standard peripheral library version number
#define | __AT32F413_LIBRARY_VERSION_MIDDLE (0x01)
#define | __AT32F413_LIBRARY_VERSION_MINOR (0x07)
#define | __AT32F413_LIBRARY_VERSION_RC (0x00)
#define | __AT32F413_LIBRARY_VERSION
#define | __CM4_REV 0x0001U
configuration of the cortex-m4 processor and core peripherals
#define | __MPU_PRESENT 1
#define | __NVIC_PRIO_BITS 4
#define | __Vendor_SysTickConfig 0
#define | __FPU_PRESENT 1U
#define | REG8(addr)
#define | REG16(addr)
#define | REG32(addr)
#define | MAKE_VALUE(reg_offset, bit_num)
#define | PERIPH_REG(periph_base, value)
#define | PERIPH_REG_BIT(value)
#define | FLASH_BASE ((uint32_t)0x08000000)
#define | SPIM_FLASH_BASE ((uint32_t)0x08400000)
#define | USD_BASE ((uint32_t)0x1FFFF800)
#define | SRAM_BASE ((uint32_t)0x20000000)
#define | PERIPH_BASE ((uint32_t)0x40000000)
#define | XMC_REG_BASE ((uint32_t)0xA0000000)
#define | DEBUG_BASE ((uint32_t)0xE0042000)
#define | APB1PERIPH_BASE (PERIPH_BASE + 0x00000)
#define | APB2PERIPH_BASE (PERIPH_BASE + 0x10000)
#define | AHBPERIPH_BASE (PERIPH_BASE + 0x20000)
#define | TMR2_BASE (APB1PERIPH_BASE + 0x0000)
#define | TMR3_BASE (APB1PERIPH_BASE + 0x0400)
#define | TMR4_BASE (APB1PERIPH_BASE + 0x0800)
#define | TMR5_BASE (APB1PERIPH_BASE + 0x0C00)
#define | RTC_BASE (APB1PERIPH_BASE + 0x2800)
#define | WWDT_BASE (APB1PERIPH_BASE + 0x2C00)
#define | WDT_BASE (APB1PERIPH_BASE + 0x3000)
#define | SPI2_BASE (APB1PERIPH_BASE + 0x3800)
#define | USART2_BASE (APB1PERIPH_BASE + 0x4400)
#define | USART3_BASE (APB1PERIPH_BASE + 0x4800)
#define | UART4_BASE (APB1PERIPH_BASE + 0x4C00)
#define | UART5_BASE (APB1PERIPH_BASE + 0x5000)
#define | I2C1_BASE (APB1PERIPH_BASE + 0x5400)
#define | I2C2_BASE (APB1PERIPH_BASE + 0x5800)
#define | USBFS_BASE (APB1PERIPH_BASE + 0x5C00)
#define | CAN1_BASE (APB1PERIPH_BASE + 0x6400)
#define | CAN2_BASE (APB1PERIPH_BASE + 0x6800)
#define | BPR_BASE (APB1PERIPH_BASE + 0x6C00)
#define | PWC_BASE (APB1PERIPH_BASE + 0x7000)
#define | IOMUX_BASE (APB2PERIPH_BASE + 0x0000)
#define | EXINT_BASE (APB2PERIPH_BASE + 0x0400)
#define | GPIOA_BASE (APB2PERIPH_BASE + 0x0800)
#define | GPIOB_BASE (APB2PERIPH_BASE + 0x0C00)
#define | GPIOC_BASE (APB2PERIPH_BASE + 0x1000)
#define | GPIOD_BASE (APB2PERIPH_BASE + 0x1400)
#define | GPIOF_BASE (APB2PERIPH_BASE + 0x1C00)
#define | ADC1_BASE (APB2PERIPH_BASE + 0x2400)
#define | ADC2_BASE (APB2PERIPH_BASE + 0x2800)
#define | TMR1_BASE (APB2PERIPH_BASE + 0x2C00)
#define | SPI1_BASE (APB2PERIPH_BASE + 0x3000)
#define | TMR8_BASE (APB2PERIPH_BASE + 0x3400)
#define | USART1_BASE (APB2PERIPH_BASE + 0x3800)
#define | TMR9_BASE (APB2PERIPH_BASE + 0x4C00)
#define | TMR10_BASE (APB2PERIPH_BASE + 0x5000)
#define | TMR11_BASE (APB2PERIPH_BASE + 0x5400)
#define | ACC_BASE (APB2PERIPH_BASE + 0x5800)
#define | SDIO1_BASE (APB2PERIPH_BASE + 0x8000)
#define | DMA1_BASE (AHBPERIPH_BASE + 0x0000)
#define | DMA1_CHANNEL1_BASE (AHBPERIPH_BASE + 0x0008)
#define | DMA1_CHANNEL2_BASE (AHBPERIPH_BASE + 0x001C)
#define | DMA1_CHANNEL3_BASE (AHBPERIPH_BASE + 0x0030)
#define | DMA1_CHANNEL4_BASE (AHBPERIPH_BASE + 0x0044)
#define | DMA1_CHANNEL5_BASE (AHBPERIPH_BASE + 0x0058)
#define | DMA1_CHANNEL6_BASE (AHBPERIPH_BASE + 0x006C)
#define | DMA1_CHANNEL7_BASE (AHBPERIPH_BASE + 0x0080)
#define | DMA2_BASE (AHBPERIPH_BASE + 0x0400)
#define | DMA2_CHANNEL1_BASE (AHBPERIPH_BASE + 0x0408)
#define | DMA2_CHANNEL2_BASE (AHBPERIPH_BASE + 0x041C)
#define | DMA2_CHANNEL3_BASE (AHBPERIPH_BASE + 0x0430)
#define | DMA2_CHANNEL4_BASE (AHBPERIPH_BASE + 0x0444)
#define | DMA2_CHANNEL5_BASE (AHBPERIPH_BASE + 0x0458)
#define | DMA2_CHANNEL6_BASE (AHBPERIPH_BASE + 0x046C)
#define | DMA2_CHANNEL7_BASE (AHBPERIPH_BASE + 0x0480)
#define | CRM_BASE (AHBPERIPH_BASE + 0x1000)
#define | FLASH_REG_BASE (AHBPERIPH_BASE + 0x2000)
#define | CRC_BASE (AHBPERIPH_BASE + 0x3000)

Typedefs

typedef enum IRQn | IRQn_Type
at32f413 interrupt number definition, according to the selected device in Library_configuration_section
typedef int32_t | INT32
typedef int16_t | INT16
typedef int8_t | INT8
typedef uint32_t | UINT32
typedef uint16_t | UINT16
typedef uint8_t | UINT8
typedef int32_t | s32
typedef int16_t | s16
typedef int8_t | s8
typedef const int32_t | sc32
typedef const int16_t | sc16
typedef const int8_t | sc8
typedef __IO int32_t | vs32
typedef __IO int16_t | vs16
typedef __IO int8_t | vs8
typedef __I int32_t | vsc32
typedef __I int16_t | vsc16
typedef __I int8_t | vsc8
typedef uint32_t | u32
typedef uint16_t | u16
typedef uint8_t | u8
typedef const uint32_t | uc32
typedef const uint16_t | uc16
typedef const uint8_t | uc8
typedef __IO uint32_t | vu32
typedef __IO uint16_t | vu16
typedef __IO uint8_t | vu8
typedef __I uint32_t | vuc32
typedef __I uint16_t | vuc16
typedef __I uint8_t | vuc8

Enumerations

enum IRQn {
Reset_IRQn = -15 , NonMaskableInt_IRQn = -14 , HardFault_IRQn = -13 , MemoryManagement_IRQn = -12 ,
BusFault_IRQn = -11 , UsageFault_IRQn = -10 , SVCall_IRQn = -5 , DebugMonitor_IRQn = -4 ,
PendSV_IRQn = -2 , SysTick_IRQn = -1 , WWDT_IRQn = 0 , PVM_IRQn = 1 ,
TAMPER_IRQn = 2 , RTC_IRQn = 3 , FLASH_IRQn = 4 , CRM_IRQn = 5 ,
EXINT0_IRQn = 6 , EXINT1_IRQn = 7 , EXINT2_IRQn = 8 , EXINT3_IRQn = 9 ,
EXINT4_IRQn = 10 , DMA1_Channel1_IRQn = 11 , DMA1_Channel2_IRQn = 12 , DMA1_Channel3_IRQn = 13 ,
DMA1_Channel4_IRQn = 14 , DMA1_Channel5_IRQn = 15 , DMA1_Channel6_IRQn = 16 , DMA1_Channel7_IRQn = 17 ,
ADC1_2_IRQn = 18 , USBFS_H_CAN1_TX_IRQn = 19 , USBFS_L_CAN1_RX0_IRQn = 20 , CAN1_RX1_IRQn = 21 ,
CAN1_SE_IRQn = 22 , EXINT9_5_IRQn = 23 , TMR1_BRK_TMR9_IRQn = 24 , TMR1_OVF_TMR10_IRQn = 25 ,
TMR1_TRG_HALL_TMR11_IRQn = 26 , TMR1_CH_IRQn = 27 , TMR2_GLOBAL_IRQn = 28 , TMR3_GLOBAL_IRQn = 29 ,
TMR4_GLOBAL_IRQn = 30 , I2C1_EVT_IRQn = 31 , I2C1_ERR_IRQn = 32 , I2C2_EVT_IRQn = 33 ,
I2C2_ERR_IRQn = 34 , SPI1_IRQn = 35 , SPI2_IRQn = 36 , USART1_IRQn = 37 ,
USART2_IRQn = 38 , USART3_IRQn = 39 , EXINT15_10_IRQn = 40 , RTCAlarm_IRQn = 41 ,
USBFSWakeUp_IRQn = 42 , TMR8_BRK_IRQn = 43 , TMR8_OVF_IRQn = 44 , TMR8_TRG_HALL_IRQn = 45 ,
TMR8_CH_IRQn = 46 , SDIO1_IRQn = 49 , TMR5_GLOBAL_IRQn = 50 , UART4_IRQn = 52 ,
UART5_IRQn = 53 , DMA2_Channel1_IRQn = 56 , DMA2_Channel2_IRQn = 57 , DMA2_Channel3_IRQn = 58 ,
DMA2_Channel4_5_IRQn = 59 , CAN2_TX_IRQn = 68 , CAN2_RX0_IRQn = 69 , CAN2_RX1_IRQn = 70 ,
CAN2_SE_IRQn = 71 , ACC_IRQn = 72 , USBFS_MAPH_IRQn = 73 , USBFS_MAPL_IRQn = 74 ,
DMA2_Channel6_7_IRQn = 75
}
at32f413 interrupt number definition, according to the selected device in Library_configuration_section More...
enum | flag_status { RESET = 0 , SET = !RESET }
flag status More...
enum | confirm_state { FALSE = 0 , TRUE = !FALSE }
confirm state More...
enum | error_status { ERROR = 0 , SUCCESS = !ERROR }
error status More...

Detailed Description

at32f413 header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413.h.


AT32F413 Firmwary Library: system_at32f413.c File Reference

  • libraries
  • cmsis
  • cm4
  • device_support
Macros | Functions | Variables
system_at32f413.c File Reference

contains all the functions for cmsis cortex-m4 system source file More...

#include "at32f413.h"

Go to the source code of this file.

Macros

#define VECT_TAB_OFFSET 0x0

Functions

void | SystemInit (void)
setup the microcontroller system initialize the flash interface.
void | system_core_clock_update (void)
update system_core_clock variable according to clock register values. the system_core_clock variable contains the core clock (hclk), it can be used by the user application to setup the systick timer or configure other parameters.

Variables

unsigned int system_core_clock = ((uint32_t)8000000)

Detailed Description

contains all the functions for cmsis cortex-m4 system source file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file system_at32f413.c.


AT32F413 Firmwary Library: system_at32f413.h File Reference

  • libraries
  • cmsis
  • cm4
  • device_support
Macros | Functions | Variables
system_at32f413.h File Reference

cmsis cortex-m4 system header file. More...

Go to the source code of this file.

Macros

#define | HEXT_STABLE_DELAY (5000u)
#define | PLL_STABLE_DELAY (500u)
#define | SystemCoreClock system_core_clock
#define | DUMMY_NOP()

Functions

void | SystemInit (void)
setup the microcontroller system initialize the flash interface.
void | system_core_clock_update (void)
update system_core_clock variable according to clock register values. the system_core_clock variable contains the core clock (hclk), it can be used by the user application to setup the systick timer or configure other parameters.

Variables

unsigned int system_core_clock

Detailed Description

cmsis cortex-m4 system header file.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file system_at32f413.h.


AT32F413 Firmwary Library: drivers Directory Reference

  • libraries
  • drivers
drivers Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • libraries
  • drivers
  • inc
inc Directory Reference

Files

at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_def.h
at32f413 macros header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_acc.h File Reference

  • libraries
  • drivers
  • inc
Data Structures | Macros | Functions
at32f413_acc.h File Reference

at32f413 acc header file More...

#include "at32f413.h"

Go to the source code of this file.

Data Structures

struct acc_type
type define acc register all More...

Macros

#define | ACC_CAL_HICKCAL ((uint16_t)0x0000)
#define | ACC_CAL_HICKTRIM ((uint16_t)0x0002)
#define | ACC_RSLOST_FLAG ((uint16_t)0x0002)
#define | ACC_CALRDY_FLAG ((uint16_t)0x0001)
#define | ACC_CALRDYIEN_INT ((uint16_t)0x0020)
#define | ACC_EIEN_INT ((uint16_t)0x0010)
#define | ACC ((acc_type *) ACC_BASE)

Functions

void | acc_calibration_mode_enable (uint16_t acc_trim, confirm_state new_state)
enable or disable the acc calibration mode.
void | acc_step_set (uint8_t step_value)
store calibration step data in acc's ctrl1 register.
void | acc_interrupt_enable (uint16_t acc_int, confirm_state new_state)
enable or disable the specified acc interrupts.
uint8_t | acc_hicktrim_get (void)
return the current acc hicktrim value.
uint8_t | acc_hickcal_get (void)
return the current acc hickcal value.
void | acc_write_c1 (uint16_t acc_c1_value)
wtire the value to acc c1 register.
void | acc_write_c2 (uint16_t acc_c2_value)
wtire the value to acc c2 register.
void | acc_write_c3 (uint16_t acc_c3_value)
wtire the value to acc c3 register.
uint16_t | acc_read_c1 (void)
return the current acc c1 value.
uint16_t | acc_read_c2 (void)
return the current acc c2 value.
uint16_t | acc_read_c3 (void)
return the current acc c3 value.
flag_status | acc_flag_get (uint16_t acc_flag)
check whether the specified acc flag is set or not.
flag_status | acc_interrupt_flag_get (uint16_t acc_flag)
check whether the specified acc interrupt flag is set or not.
void | acc_flag_clear (uint16_t acc_flag)
clear the specified acc flag is set or not.

Detailed Description

at32f413 acc header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_acc.h.


AT32F413 Firmwary Library: at32f413_adc.h File Reference

  • libraries
  • drivers
  • inc
Data Structures | Macros | Enumerations | Functions
at32f413_adc.h File Reference

at32f413 adc header file More...

#include "at32f413.h"

Go to the source code of this file.

Data Structures

struct | adc_base_config_type
adc base config type More...
struct | adc_type
type define adc register all More...

Macros

#define | ADC_CCE_INT ((uint32_t)0x00000020)
#define | ADC_VMOR_INT ((uint32_t)0x00000040)
#define | ADC_PCCE_INT ((uint32_t)0x00000080)
#define | ADC_VMOR_FLAG ((uint8_t)0x01)
#define | ADC_CCE_FLAG ((uint8_t)0x02)
#define | ADC_PCCE_FLAG ((uint8_t)0x04)
#define | ADC_PCCS_FLAG ((uint8_t)0x08)
#define | ADC_OCCS_FLAG ((uint8_t)0x10)
#define | ADC1 ((adc_type *) ADC1_BASE)
#define | ADC2 ((adc_type *) ADC2_BASE)

Enumerations

enum adc_combine_mode_type {
ADC_INDEPENDENT_MODE = 0x00 , ADC_ORDINARY_SMLT_PREEMPT_SMLT_MODE = 0x01 , ADC_ORDINARY_SMLT_PREEMPT_INTERLTRIG_MODE = 0x02 , ADC_ORDINARY_SHORTSHIFT_PREEMPT_SMLT_MODE = 0x03 ,
ADC_ORDINARY_LONGSHIFT_PREEMPT_SMLT_MODE = 0x04 , ADC_PREEMPT_SMLT_ONLY_MODE = 0x05 , ADC_ORDINARY_SMLT_ONLY_MODE = 0x06 , ADC_ORDINARY_SHORTSHIFT_ONLY_MODE = 0x07 ,
ADC_ORDINARY_LONGSHIFT_ONLY_MODE = 0x08 , ADC_PREEMPT_INTERLTRIG_ONLY_MODE = 0x09
}
adc combine mode type(these options are reserved in adc2) More...
enum | adc_data_align_type { ADC_RIGHT_ALIGNMENT = 0x00 , ADC_LEFT_ALIGNMENT = 0x01 }
adc data align type More...
enum adc_channel_select_type {
ADC_CHANNEL_0 = 0x00 , ADC_CHANNEL_1 = 0x01 , ADC_CHANNEL_2 = 0x02 , ADC_CHANNEL_3 = 0x03 ,
ADC_CHANNEL_4 = 0x04 , ADC_CHANNEL_5 = 0x05 , ADC_CHANNEL_6 = 0x06 , ADC_CHANNEL_7 = 0x07 ,
ADC_CHANNEL_8 = 0x08 , ADC_CHANNEL_9 = 0x09 , ADC_CHANNEL_10 = 0x0A , ADC_CHANNEL_11 = 0x0B ,
ADC_CHANNEL_12 = 0x0C , ADC_CHANNEL_13 = 0x0D , ADC_CHANNEL_14 = 0x0E , ADC_CHANNEL_15 = 0x0F ,
ADC_CHANNEL_16 = 0x10 , ADC_CHANNEL_17 = 0x11
}
adc channel select type More...
enum adc_sampletime_select_type {
ADC_SAMPLETIME_1_5 = 0x00 , ADC_SAMPLETIME_7_5 = 0x01 , ADC_SAMPLETIME_13_5 = 0x02 , ADC_SAMPLETIME_28_5 = 0x03 ,
ADC_SAMPLETIME_41_5 = 0x04 , ADC_SAMPLETIME_55_5 = 0x05 , ADC_SAMPLETIME_71_5 = 0x06 , ADC_SAMPLETIME_239_5 = 0x07
}
adc sampletime select type More...
enum adc_ordinary_trig_select_type {
ADC12_ORDINARY_TRIG_TMR1CH1 = 0x00 , ADC12_ORDINARY_TRIG_TMR1CH2 = 0x01 , ADC12_ORDINARY_TRIG_TMR1CH3 = 0x02 , ADC12_ORDINARY_TRIG_TMR2CH2 = 0x03 ,
ADC12_ORDINARY_TRIG_TMR3TRGOUT = 0x04 , ADC12_ORDINARY_TRIG_TMR4CH4 = 0x05 , ADC12_ORDINARY_TRIG_EXINT11_TMR8TRGOUT = 0x06 , ADC12_ORDINARY_TRIG_SOFTWARE = 0x07 ,
ADC12_ORDINARY_TRIG_TMR1TRGOUT = 0x0D , ADC12_ORDINARY_TRIG_TMR8CH1 = 0x0E , ADC12_ORDINARY_TRIG_TMR8CH2 = 0x0F
}
adc ordinary group trigger event select type More...
enum adc_preempt_trig_select_type {
ADC12_PREEMPT_TRIG_TMR1TRGOUT = 0x00 , ADC12_PREEMPT_TRIG_TMR1CH4 = 0x01 , ADC12_PREEMPT_TRIG_TMR2TRGOUT = 0x02 , ADC12_PREEMPT_TRIG_TMR2CH1 = 0x03 ,
ADC12_PREEMPT_TRIG_TMR3CH4 = 0x04 , ADC12_PREEMPT_TRIG_TMR4TRGOUT = 0x05 , ADC12_PREEMPT_TRIG_EXINT15_TMR8CH4 = 0x06 , ADC12_PREEMPT_TRIG_SOFTWARE = 0x07 ,
ADC12_PREEMPT_TRIG_TMR1CH1 = 0x0D , ADC12_PREEMPT_TRIG_TMR8CH1 = 0x0E , ADC12_PREEMPT_TRIG_TMR8TRGOUT = 0x0F
}
adc preempt group trigger event select type More...
enum | adc_preempt_channel_type { ADC_PREEMPT_CHANNEL_1 = 0x00 , ADC_PREEMPT_CHANNEL_2 = 0x01 , ADC_PREEMPT_CHANNEL_3 = 0x02 , ADC_PREEMPT_CHANNEL_4 = 0x03 }
adc preempt channel type More...
enum adc_voltage_monitoring_type {
ADC_VMONITOR_SINGLE_ORDINARY = 0x00800200 , ADC_VMONITOR_SINGLE_PREEMPT = 0x00400200 , ADC_VMONITOR_SINGLE_ORDINARY_PREEMPT = 0x00C00200 , ADC_VMONITOR_ALL_ORDINARY = 0x00800000 ,
ADC_VMONITOR_ALL_PREEMPT = 0x00400000 , ADC_VMONITOR_ALL_ORDINARY_PREEMPT = 0x00C00000 , ADC_VMONITOR_NONE = 0x00000000
}
adc voltage_monitoring type More...

Functions

void | adc_reset (adc_type *adc_x)
deinitialize the adc peripheral registers to their default reset values.
void | adc_enable (adc_type *adc_x, confirm_state new_state)
enable or disable the specified adc peripheral.
void | adc_combine_mode_select (adc_combine_mode_type combine_mode)
select combine mode of the specified adc peripheral.
void | adc_base_default_para_init (adc_base_config_type *adc_base_struct)
adc base default para init.
void | adc_base_config (adc_type *adc_x, adc_base_config_type *adc_base_struct)
initialize the adc peripheral according to the specified parameters.
void | adc_dma_mode_enable (adc_type *adc_x, confirm_state new_state)
enable or disable the adc dma transfer.
void | adc_interrupt_enable (adc_type *adc_x, uint32_t adc_int, confirm_state new_state)
enable or disable the specified adc interrupts.
void | adc_calibration_init (adc_type *adc_x)
initialize calibration register of the specified adc peripheral.
flag_status | adc_calibration_init_status_get (adc_type *adc_x)
get calibration register's initialize status of the specified adc peripheral.
void | adc_calibration_start (adc_type *adc_x)
start calibration process of the specified adc peripheral.
flag_status | adc_calibration_status_get (adc_type *adc_x)
get calibration status of the specified adc peripheral.
void | adc_voltage_monitor_enable (adc_type *adc_x, adc_voltage_monitoring_type adc_voltage_monitoring)
enable or disable the voltage monitoring on single/all ordinary or preempt channels of the specified adc peripheral.
void | adc_voltage_monitor_threshold_value_set (adc_type *adc_x, uint16_t adc_high_threshold, uint16_t adc_low_threshold)
set voltage monitoring's high and low thresholds value of the specified adc peripheral.
void | adc_voltage_monitor_single_channel_select (adc_type *adc_x, adc_channel_select_type adc_channel)
select the voltage monitoring's channel of the specified adc peripheral.
void | adc_ordinary_channel_set (adc_type *adc_x, adc_channel_select_type adc_channel, uint8_t adc_sequence, adc_sampletime_select_type adc_sampletime)
set ordinary channel's corresponding rank in the sequencer and sample time of the specified adc peripheral.
void | adc_preempt_channel_length_set (adc_type *adc_x, uint8_t adc_channel_lenght)
set preempt channel lenghth of the specified adc peripheral.
void | adc_preempt_channel_set (adc_type *adc_x, adc_channel_select_type adc_channel, uint8_t adc_sequence, adc_sampletime_select_type adc_sampletime)
configure preempt channel's corresponding rank in the sequencer and sample time of the specified adc peripheral.
void | adc_ordinary_conversion_trigger_set (adc_type *adc_x, adc_ordinary_trig_select_type adc_ordinary_trig, confirm_state new_state)
enable or disable the ordinary channel's external trigger and set external trigger event of the specified adc peripheral.
void | adc_preempt_conversion_trigger_set (adc_type *adc_x, adc_preempt_trig_select_type adc_preempt_trig, confirm_state new_state)
enable or disable the preempt channel's external trigger and set external trigger event of the specified adc peripheral.
void | adc_preempt_offset_value_set (adc_type *adc_x, adc_preempt_channel_type adc_preempt_channel, uint16_t adc_offset_value)
set preempt channel's conversion value offset of the specified adc peripheral.
void | adc_ordinary_part_count_set (adc_type *adc_x, uint8_t adc_channel_count)
set partitioned mode channel count of the specified adc peripheral.
void | adc_ordinary_part_mode_enable (adc_type *adc_x, confirm_state new_state)
enable or disable the partitioned mode on ordinary channel of the specified adc peripheral.
void | adc_preempt_part_mode_enable (adc_type *adc_x, confirm_state new_state)
enable or disable the partitioned mode on preempt channel of the specified adc peripheral.
void | adc_preempt_auto_mode_enable (adc_type *adc_x, confirm_state new_state)
enable or disable automatic preempt group conversion of the specified adc peripheral.
void | adc_tempersensor_vintrv_enable (confirm_state new_state)
enable or disable the temperature sensor and vintrv channel.
void | adc_ordinary_software_trigger_enable (adc_type *adc_x, confirm_state new_state)
enable or disable ordinary software start conversion of the specified adc peripheral.
flag_status | adc_ordinary_software_trigger_status_get (adc_type *adc_x)
get ordinary software start conversion status of the specified adc peripheral.
void | adc_preempt_software_trigger_enable (adc_type *adc_x, confirm_state new_state)
enable or disable preempt software start conversion of the specified adc peripheral.
flag_status | adc_preempt_software_trigger_status_get (adc_type *adc_x)
get preempt software start conversion status of the specified adc peripheral.
uint16_t | adc_ordinary_conversion_data_get (adc_type *adc_x)
return the last conversion data for ordinary channel of the specified adc peripheral.
uint32_t | adc_combine_ordinary_conversion_data_get (void)
return the last conversion data for ordinary channel of combine adc(adc1 and adc2).
uint16_t | adc_preempt_conversion_data_get (adc_type *adc_x, adc_preempt_channel_type adc_preempt_channel)
return the conversion data for selection preempt channel of the specified adc peripheral.
flag_status | adc_flag_get (adc_type *adc_x, uint8_t adc_flag)
get flag of the specified adc peripheral.
flag_status | adc_interrupt_flag_get (adc_type *adc_x, uint8_t adc_flag)
get interrupt flag of the specified adc peripheral.
void | adc_flag_clear (adc_type *adc_x, uint32_t adc_flag)
clear flag of the specified adc peripheral.

Detailed Description

at32f413 adc header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_adc.h.


AT32F413 Firmwary Library: at32f413_bpr.h File Reference

  • libraries
  • drivers
  • inc
Data Structures | Macros | Enumerations | Functions
at32f413_bpr.h File Reference

at32f413 bpr header file More...

#include "at32f413.h"

Go to the source code of this file.

Data Structures

struct bpr_type
type define bpr register all More...

Macros

#define | BPR_TAMPER_INTERRUPT_FLAG ((uint32_t)0x00000001)
#define | BPR_TAMPER_EVENT_FLAG ((uint32_t)0x00000002)
#define | BPR ((bpr_type *) BPR_BASE)

Enumerations

enum bpr_data_type {
BPR_DATA1 = 0x04 , BPR_DATA2 = 0x08 , BPR_DATA3 = 0x0C , BPR_DATA4 = 0x10 ,
BPR_DATA5 = 0x14 , BPR_DATA6 = 0x18 , BPR_DATA7 = 0x1C , BPR_DATA8 = 0x20 ,
BPR_DATA9 = 0x24 , BPR_DATA10 = 0x28 , BPR_DATA11 = 0x40 , BPR_DATA12 = 0x44 ,
BPR_DATA13 = 0x48 , BPR_DATA14 = 0x4C , BPR_DATA15 = 0x50 , BPR_DATA16 = 0x54 ,
BPR_DATA17 = 0x58 , BPR_DATA18 = 0x5C , BPR_DATA19 = 0x60 , BPR_DATA20 = 0x64 ,
BPR_DATA21 = 0x68 , BPR_DATA22 = 0x6C , BPR_DATA23 = 0x70 , BPR_DATA24 = 0x74 ,
BPR_DATA25 = 0x78 , BPR_DATA26 = 0x7C , BPR_DATA27 = 0x80 , BPR_DATA28 = 0x84 ,
BPR_DATA29 = 0x88 , BPR_DATA30 = 0x8C , BPR_DATA31 = 0x90 , BPR_DATA32 = 0x94 ,
BPR_DATA33 = 0x98 , BPR_DATA34 = 0x9C , BPR_DATA35 = 0xA0 , BPR_DATA36 = 0xA4 ,
BPR_DATA37 = 0xA8 , BPR_DATA38 = 0xAC , BPR_DATA39 = 0xB0 , BPR_DATA40 = 0xB4 ,
BPR_DATA41 = 0xB8 , BPR_DATA42 = 0xBC
}
battery powered register data type More...
enum bpr_rtc_output_type {
BPR_RTC_OUTPUT_NONE = 0x000 , BPR_RTC_OUTPUT_CLOCK_CAL_BEFORE = 0x080 , BPR_RTC_OUTPUT_ALARM = 0x100 , BPR_RTC_OUTPUT_SECOND = 0x300 ,
BPR_RTC_OUTPUT_CLOCK_CAL_AFTER = 0x480
}
bpr rtc output type More...
enum bpr_tamper_pin_active_level_type { BPR_TAMPER_PIN_ACTIVE_HIGH = 0x00 , BPR_TAMPER_PIN_ACTIVE_LOW = 0x01 }
tamper pin active level type More...

Functions

void | bpr_reset (void)
bpr reset by crm reset register
flag_status | bpr_flag_get (uint32_t flag)
bpr event flag get, for tamper event flag
flag_status | bpr_interrupt_flag_get (uint32_t flag)
bpr interrupt flag get
void | bpr_flag_clear (uint32_t flag)
clear bpr tamper flag
void | bpr_interrupt_enable (confirm_state new_state)
enable or disable bpr tamper interrupt
uint16_t | bpr_data_read (bpr_data_type bpr_data)
read bpr bpr data
void | bpr_data_write (bpr_data_type bpr_data, uint16_t data_value)
write bpr data
void | bpr_rtc_output_select (bpr_rtc_output_type output_source)
select bpr rtc output
void | bpr_rtc_clock_calibration_value_set (uint8_t calibration_value)
set rtc clock calibration value
void | bpr_tamper_pin_enable (confirm_state new_state)
enable or disable bpr tamper pin
void | bpr_tamper_pin_active_level_set (bpr_tamper_pin_active_level_type active_level)
set bpr tamper pin active level

Detailed Description

at32f413 bpr header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_bpr.h.


AT32F413 Firmwary Library: at32f413_can.h File Reference

  • libraries
  • drivers
  • inc
Data Structures | Macros | Enumerations | Functions
at32f413_can.h File Reference

at32f413 can header file More...

#include "at32f413.h"

Go to the source code of this file.

Data Structures

struct | can_base_type
can init structure definition More...
struct | can_baudrate_type
can baudrate structure definition More...
struct | can_filter_init_type
can filter init structure definition More...
struct | can_tx_message_type
can tx message structure definition More...
struct | can_rx_message_type
can rx message structure definition More...
struct | can_tx_mailbox_type
can controller area network tx mailbox More...
struct | can_fifo_mailbox_type
can controller area network fifo mailbox More...
struct | can_filter_register_type
can controller area network filter bit register More...
struct | can_type
type define can register all More...

Macros

#define | FZC_TIMEOUT ((uint32_t)0x0000FFFF)
#define | DZC_TIMEOUT ((uint32_t)0x0000FFFF)
#define | CAN_EAF_FLAG ((uint32_t)0x01)
#define | CAN_EPF_FLAG ((uint32_t)0x02)
#define | CAN_BOF_FLAG ((uint32_t)0x03)
#define | CAN_ETR_FLAG ((uint32_t)0x04)
#define | CAN_EOIF_FLAG ((uint32_t)0x05)
#define | CAN_TM0TCF_FLAG ((uint32_t)0x06)
#define | CAN_TM1TCF_FLAG ((uint32_t)0x07)
#define | CAN_TM2TCF_FLAG ((uint32_t)0x08)
#define | CAN_RF0MN_FLAG ((uint32_t)0x09)
#define | CAN_RF0FF_FLAG ((uint32_t)0x0A)
#define | CAN_RF0OF_FLAG ((uint32_t)0x0B)
#define | CAN_RF1MN_FLAG ((uint32_t)0x0C)
#define | CAN_RF1FF_FLAG ((uint32_t)0x0D)
#define | CAN_RF1OF_FLAG ((uint32_t)0x0E)
#define | CAN_QDZIF_FLAG ((uint32_t)0x0F)
#define | CAN_EDZC_FLAG ((uint32_t)0x10)
#define | CAN_TMEF_FLAG ((uint32_t)0x11)
#define | CAN_TCIEN_INT ((uint32_t)0x00000001)
#define | CAN_RF0MIEN_INT ((uint32_t)0x00000002)
#define | CAN_RF0FIEN_INT ((uint32_t)0x00000004)
#define | CAN_RF0OIEN_INT ((uint32_t)0x00000008)
#define | CAN_RF1MIEN_INT ((uint32_t)0x00000010)
#define | CAN_RF1FIEN_INT ((uint32_t)0x00000020)
#define | CAN_RF1OIEN_INT ((uint32_t)0x00000040)
#define | CAN_EAIEN_INT ((uint32_t)0x00000100)
#define | CAN_EPIEN_INT ((uint32_t)0x00000200)
#define | CAN_BOIEN_INT ((uint32_t)0x00000400)
#define | CAN_ETRIEN_INT ((uint32_t)0x00000800)
#define | CAN_EOIEN_INT ((uint32_t)0x00008000)
#define | CAN_QDZIEN_INT ((uint32_t)0x00010000)
#define | CAN_EDZIEN_INT ((uint32_t)0x00020000)
#define | CAN_MSTS_EOIF_VAL ((uint32_t)0x00000004)
can flag clear operation macro definition val
#define | CAN_MSTS_QDZIF_VAL ((uint32_t)0x00000008)
#define | CAN_MSTS_EDZIF_VAL ((uint32_t)0x00000010)
#define | CAN_TSTS_TM0TCF_VAL ((uint32_t)0x00000001)
#define | CAN_TSTS_TM1TCF_VAL ((uint32_t)0x00000100)
#define | CAN_TSTS_TM2TCF_VAL ((uint32_t)0x00010000)
#define | CAN_TSTS_TM0CT_VAL ((uint32_t)0x00000080)
#define | CAN_TSTS_TM1CT_VAL ((uint32_t)0x00008000)
#define | CAN_TSTS_TM2CT_VAL ((uint32_t)0x00800000)
#define | CAN_RF0_RF0FF_VAL ((uint32_t)0x00000008)
#define | CAN_RF0_RF0OF_VAL ((uint32_t)0x00000010)
#define | CAN_RF0_RF0R_VAL ((uint32_t)0x00000020)
#define | CAN_RF1_RF1FF_VAL ((uint32_t)0x00000008)
#define | CAN_RF1_RF1OF_VAL ((uint32_t)0x00000010)
#define | CAN_RF1_RF1R_VAL ((uint32_t)0x00000020)
#define | CAN1 ((can_type *) CAN1_BASE)

Enumerations

enum | can_filter_fifo_type { CAN_FILTER_FIFO0 = 0x00 , CAN_FILTER_FIFO1 = 0x01 }
can filter fifo More...
enum | can_filter_mode_type { CAN_FILTER_MODE_ID_MASK = 0x00 , CAN_FILTER_MODE_ID_LIST = 0x01 }
can filter mode More...
enum | can_filter_bit_width_type { CAN_FILTER_16BIT = 0x00 , CAN_FILTER_32BIT = 0x01 }
can filter bit width select More...
enum | can_mode_type { CAN_MODE_COMMUNICATE = 0x00 , CAN_MODE_LOOPBACK = 0x01 , CAN_MODE_LISTENONLY = 0x02 , CAN_MODE_LISTENONLY_LOOPBACK = 0x03 }
can mode More...
enum | can_operating_mode_type { CAN_OPERATINGMODE_FREEZE = 0x00 , CAN_OPERATINGMODE_DOZE = 0x01 , CAN_OPERATINGMODE_COMMUNICATE = 0x02 }
can operating mode More...
enum | can_rsaw_type { CAN_RSAW_1TQ = 0x00 , CAN_RSAW_2TQ = 0x01 , CAN_RSAW_3TQ = 0x02 , CAN_RSAW_4TQ = 0x03 }
can resynchronization adjust width More...
enum can_bts1_type {
CAN_BTS1_1TQ = 0x00 , CAN_BTS1_2TQ = 0x01 , CAN_BTS1_3TQ = 0x02 , CAN_BTS1_4TQ = 0x03 ,
CAN_BTS1_5TQ = 0x04 , CAN_BTS1_6TQ = 0x05 , CAN_BTS1_7TQ = 0x06 , CAN_BTS1_8TQ = 0x07 ,
CAN_BTS1_9TQ = 0x08 , CAN_BTS1_10TQ = 0x09 , CAN_BTS1_11TQ = 0x0A , CAN_BTS1_12TQ = 0x0B ,
CAN_BTS1_13TQ = 0x0C , CAN_BTS1_14TQ = 0x0D , CAN_BTS1_15TQ = 0x0E , CAN_BTS1_16TQ = 0x0F
}
can bit time segment 1 More...
enum can_bts2_type {
CAN_BTS2_1TQ = 0x00 , CAN_BTS2_2TQ = 0x01 , CAN_BTS2_3TQ = 0x02 , CAN_BTS2_4TQ = 0x03 ,
CAN_BTS2_5TQ = 0x04 , CAN_BTS2_6TQ = 0x05 , CAN_BTS2_7TQ = 0x06 , CAN_BTS2_8TQ = 0x07
}
can bit time segment 2 More...
enum | can_identifier_type { CAN_ID_STANDARD = 0x00 , CAN_ID_EXTENDED = 0x01 }
can identifier type More...
enum | can_trans_frame_type { CAN_TFT_DATA = 0x00 , CAN_TFT_REMOTE = 0x01 }
can transmission frame type More...
enum | can_tx_mailbox_num_type { CAN_TX_MAILBOX0 = 0x00 , CAN_TX_MAILBOX1 = 0x01 , CAN_TX_MAILBOX2 = 0x02 }
can tx mailboxes More...
enum | can_rx_fifo_num_type { CAN_RX_FIFO0 = 0x00 , CAN_RX_FIFO1 = 0x01 }
can receive fifo More...
enum | can_transmit_status_type { CAN_TX_STATUS_FAILED = 0x00 , CAN_TX_STATUS_SUCCESSFUL = 0x01 , CAN_TX_STATUS_PENDING = 0x02 , CAN_TX_STATUS_NO_EMPTY = 0x04 }
can transmit status More...
enum | can_enter_doze_status_type { CAN_ENTER_DOZE_FAILED = 0x00 , CAN_ENTER_DOZE_SUCCESSFUL = 0x01 }
can enter doze mode status More...
enum | can_quit_doze_status_type { CAN_QUIT_DOZE_FAILED = 0x00 , CAN_QUIT_DOZE_SUCCESSFUL = 0x01 }
can quit doze mode status More...
enum | can_msg_discarding_rule_type { CAN_DISCARDING_FIRST_RECEIVED = 0x00 , CAN_DISCARDING_LAST_RECEIVED = 0x01 }
can message discarding rule select when overflow More...
enum | can_msg_sending_rule_type { CAN_SENDING_BY_ID = 0x00 , CAN_SENDING_BY_REQUEST = 0x01 }
can multiple message sending sequence rule More...
enum can_error_record_type {
CAN_ERRORRECORD_NOERR = 0x00 , CAN_ERRORRECORD_STUFFERR = 0x01 , CAN_ERRORRECORD_FORMERR = 0x02 , CAN_ERRORRECORD_ACKERR = 0x03 ,
CAN_ERRORRECORD_BITRECESSIVEERR = 0x04 , CAN_ERRORRECORD_BITDOMINANTERR = 0x05 , CAN_ERRORRECORD_CRCERR = 0x06 , CAN_ERRORRECORD_SOFTWARESETERR = 0x07
}
can error type record More...

Functions

void | can_reset (can_type *can_x)
deinitialize the can peripheral registers to their default reset values.
void | can_baudrate_default_para_init (can_baudrate_type *can_baudrate_struct)
fill each can_baudrate_struct member with its default value.
error_status | can_baudrate_set (can_type *can_x, can_baudrate_type *can_baudrate_struct)
set the baudrate of the can peripheral
void | can_default_para_init (can_base_type *can_base_struct)
fill each can_init_struct member with its default value.
error_status | can_base_init (can_type *can_x, can_base_type *can_base_struct)
initialize the can peripheral according to the specified parameters in the can_init_struct.
void | can_filter_default_para_init (can_filter_init_type *can_filter_init_struct)
fill each can_filter_init_struct member with its default value.
void | can_filter_init (can_type *can_x, can_filter_init_type *can_filter_init_struct)
initialize the can peripheral according to the specified parameters in the can_filter_init_struct.
void | can_debug_transmission_prohibit (can_type *can_x, confirm_state new_state)
enable or disable the debug transmission prohibit of the specified can peripheral.
void | can_ttc_mode_enable (can_type *can_x, confirm_state new_state)
enable or disable time trigger operation communication mode of the specified can peripheral.
uint8_t | can_message_transmit (can_type *can_x, can_tx_message_type *tx_message_struct)
fill the transmission message and transmit of the specified can peripheral.
can_transmit_status_type | can_transmit_status_get (can_type *can_x, can_tx_mailbox_num_type transmit_mailbox)
check the transmission state of the specified can peripheral.
void | can_transmit_cancel (can_type *can_x, can_tx_mailbox_num_type transmit_mailbox)
cancel a transmit request of the specified can peripheral.
void | can_message_receive (can_type *can_x, can_rx_fifo_num_type fifo_number, can_rx_message_type *rx_message_struct)
receive message of the specified can peripheral.
void | can_receive_fifo_release (can_type *can_x, can_rx_fifo_num_type fifo_number)
release the specified fifo of the specified can peripheral.
uint8_t | can_receive_message_pending_get (can_type *can_x, can_rx_fifo_num_type fifo_number)
return the number of pending messages of the specified can peripheral.
error_status | can_operating_mode_set (can_type *can_x, can_operating_mode_type can_operating_mode)
set the operation mode of the specified can peripheral.
can_enter_doze_status_type | can_doze_mode_enter (can_type *can_x)
enter the low power mode of the specified can peripheral.
can_quit_doze_status_type | can_doze_mode_exit (can_type *can_x)
exit the doze mode of the specified can peripheral.
can_error_record_type | can_error_type_record_get (can_type *can_x)
return the error type record (etr) of the specified can peripheral.
uint8_t | can_receive_error_counter_get (can_type *can_x)
return the receive error counter (rec) of the specified can peripheral.
uint8_t | can_transmit_error_counter_get (can_type *can_x)
return the transmit error counter of the specified can peripheral.
void | can_interrupt_enable (can_type *can_x, uint32_t can_int, confirm_state new_state)
enable or disable the interrupt of the specified can peripheral.
flag_status | can_interrupt_flag_get (can_type *can_x, uint32_t can_flag)
get interrupt flag of the specified can peripheral.
flag_status | can_flag_get (can_type *can_x, uint32_t can_flag)
get flag of the specified can peripheral.
void | can_flag_clear (can_type *can_x, uint32_t can_flag)
clear flag of the specified can peripheral.

Detailed Description

at32f413 can header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_can.h.


AT32F413 Firmwary Library: at32f413_crc.h File Reference

  • libraries
  • drivers
  • inc
Data Structures | Macros | Enumerations | Functions
at32f413_crc.h File Reference

at32f413 crc header file More...

#include "at32f413.h"

Go to the source code of this file.

Data Structures

struct crc_type
type define crc register all More...

Macros

#define CRC ((crc_type *) CRC_BASE)

Enumerations

enum | crc_reverse_input_type { CRC_REVERSE_INPUT_NO_AFFECTE = 0x00 , CRC_REVERSE_INPUT_BY_BYTE = 0x01 , CRC_REVERSE_INPUT_BY_HALFWORD = 0x02 , CRC_REVERSE_INPUT_BY_WORD = 0x03 }
crc reverse input data More...
enum | crc_reverse_output_type { CRC_REVERSE_OUTPUT_NO_AFFECTE = 0x00 , CRC_REVERSE_OUTPUT_DATA = 0x01 }
crc reverse output data More...
enum | crc_poly_size_type { CRC_POLY_SIZE_32B = 0x00 , CRC_POLY_SIZE_16B = 0x01 , CRC_POLY_SIZE_8B = 0x02 , CRC_POLY_SIZE_7B = 0x03 }
crc polynomial size More...

Functions

void | crc_data_reset (void)
reset the crc data register.
uint32_t | crc_one_word_calculate (uint32_t data)
compute the 32-bit crc of a given data word(32-bit).
uint32_t | crc_block_calculate (uint32_t *pbuffer, uint32_t length)
compute the 32-bit crc of a given buffer of data word(32-bit).
uint32_t | crc_data_get (void)
return the current crc value.
void | crc_common_data_set (uint8_t cdt_value)
store a 8-bit data in the common data register.
uint8_t | crc_common_data_get (void)
return the 8-bit data stored in the common data register
void | crc_init_data_set (uint32_t value)
set the 32-bit initial data of crc
void | crc_reverse_input_data_set (crc_reverse_input_type value)
control the reversal of the bit order in the input data
void | crc_reverse_output_data_set (crc_reverse_output_type value)
control the reversal of the bit order in the output data
void | crc_poly_value_set (uint32_t value)
config crc polynomial value
uint32_t | crc_poly_value_get (void)
return crc polynomial value
void | crc_poly_size_set (crc_poly_size_type size)
config crc polynomial data size
crc_poly_size_type | crc_poly_size_get (void)
return crc polynomial data size

Detailed Description

at32f413 crc header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_crc.h.


AT32F413 Firmwary Library: at32f413_crm.h File Reference

  • libraries
  • drivers
  • inc
Data Structures | Macros | Enumerations | Functions
at32f413_crm.h File Reference

at32f413 crm header file More...

#include "at32f413.h"

Go to the source code of this file.

Data Structures

struct | crm_clocks_freq_type
crm clocks freqency structure More...
struct | crm_type
type define crm register all More...

Macros

#define | CRM_REG(value)
#define | CRM_REG_BIT(value)
#define | CRM_HICK_STABLE_FLAG MAKE_VALUE(0x00, 1)
#define | CRM_HEXT_STABLE_FLAG MAKE_VALUE(0x00, 17)
#define | CRM_PLL_STABLE_FLAG MAKE_VALUE(0x00, 25)
#define | CRM_LEXT_STABLE_FLAG MAKE_VALUE(0x20, 1)
#define | CRM_LICK_STABLE_FLAG MAKE_VALUE(0x24, 1)
#define | CRM_ALL_RESET_FLAG MAKE_VALUE(0x24, 24)
#define | CRM_NRST_RESET_FLAG MAKE_VALUE(0x24, 26)
#define | CRM_POR_RESET_FLAG MAKE_VALUE(0x24, 27)
#define | CRM_SW_RESET_FLAG MAKE_VALUE(0x24, 28)
#define | CRM_WDT_RESET_FLAG MAKE_VALUE(0x24, 29)
#define | CRM_WWDT_RESET_FLAG MAKE_VALUE(0x24, 30)
#define | CRM_LOWPOWER_RESET_FLAG MAKE_VALUE(0x24, 31)
#define | CRM_LICK_READY_INT_FLAG MAKE_VALUE(0x08, 0)
#define | CRM_LEXT_READY_INT_FLAG MAKE_VALUE(0x08, 1)
#define | CRM_HICK_READY_INT_FLAG MAKE_VALUE(0x08, 2)
#define | CRM_HEXT_READY_INT_FLAG MAKE_VALUE(0x08, 3)
#define | CRM_PLL_READY_INT_FLAG MAKE_VALUE(0x08, 4)
#define | CRM_CLOCK_FAILURE_INT_FLAG MAKE_VALUE(0x08, 7)
#define | CRM_LICK_STABLE_INT ((uint32_t)0x00000100)
#define | CRM_LEXT_STABLE_INT ((uint32_t)0x00000200)
#define | CRM_HICK_STABLE_INT ((uint32_t)0x00000400)
#define | CRM_HEXT_STABLE_INT ((uint32_t)0x00000800)
#define | CRM_PLL_STABLE_INT ((uint32_t)0x00001000)
#define | CRM_CLOCK_FAILURE_INT ((uint32_t)0x00800000)
#define | CRM ((crm_type *) CRM_BASE)

Enumerations

enum crm_periph_clock_type {
CRM_DMA1_PERIPH_CLOCK = (uint32_t)(((0x14) << 16) | (0 & 0x1F)) , CRM_DMA2_PERIPH_CLOCK = (uint32_t)(((0x14) << 16) | (1 & 0x1F)) , CRM_CRC_PERIPH_CLOCK = (uint32_t)(((0x14) << 16) | (6 & 0x1F)) , CRM_SDIO1_PERIPH_CLOCK = (uint32_t)(((0x14) << 16) | (10 & 0x1F)) ,
CRM_IOMUX_PERIPH_CLOCK = (uint32_t)(((0x18) << 16) | (0 & 0x1F)) , CRM_GPIOA_PERIPH_CLOCK = (uint32_t)(((0x18) << 16) | (2 & 0x1F)) , CRM_GPIOB_PERIPH_CLOCK = (uint32_t)(((0x18) << 16) | (3 & 0x1F)) , CRM_GPIOC_PERIPH_CLOCK = (uint32_t)(((0x18) << 16) | (4 & 0x1F)) ,
CRM_GPIOD_PERIPH_CLOCK = (uint32_t)(((0x18) << 16) | (5 & 0x1F)) , CRM_GPIOF_PERIPH_CLOCK = (uint32_t)(((0x18) << 16) | (7 & 0x1F)) , CRM_ADC1_PERIPH_CLOCK = (uint32_t)(((0x18) << 16) | (9 & 0x1F)) , CRM_ADC2_PERIPH_CLOCK = (uint32_t)(((0x18) << 16) | (10 & 0x1F)) ,
CRM_TMR1_PERIPH_CLOCK = (uint32_t)(((0x18) << 16) | (11 & 0x1F)) , CRM_SPI1_PERIPH_CLOCK = (uint32_t)(((0x18) << 16) | (12 & 0x1F)) , CRM_TMR8_PERIPH_CLOCK = (uint32_t)(((0x18) << 16) | (13 & 0x1F)) , CRM_USART1_PERIPH_CLOCK = (uint32_t)(((0x18) << 16) | (14 & 0x1F)) ,
CRM_TMR9_PERIPH_CLOCK = (uint32_t)(((0x18) << 16) | (19 & 0x1F)) , CRM_TMR10_PERIPH_CLOCK = (uint32_t)(((0x18) << 16) | (20 & 0x1F)) , CRM_TMR11_PERIPH_CLOCK = (uint32_t)(((0x18) << 16) | (21 & 0x1F)) , CRM_ACC_PERIPH_CLOCK = (uint32_t)(((0x18) << 16) | (22 & 0x1F)) ,
CRM_TMR2_PERIPH_CLOCK = (uint32_t)(((0x1C) << 16) | (0 & 0x1F)) , CRM_TMR3_PERIPH_CLOCK = (uint32_t)(((0x1C) << 16) | (1 & 0x1F)) , CRM_TMR4_PERIPH_CLOCK = (uint32_t)(((0x1C) << 16) | (2 & 0x1F)) , CRM_TMR5_PERIPH_CLOCK = (uint32_t)(((0x1C) << 16) | (3 & 0x1F)) ,
CRM_WWDT_PERIPH_CLOCK = (uint32_t)(((0x1C) << 16) | (11 & 0x1F)) , CRM_SPI2_PERIPH_CLOCK = (uint32_t)(((0x1C) << 16) | (14 & 0x1F)) , CRM_USART2_PERIPH_CLOCK = (uint32_t)(((0x1C) << 16) | (17 & 0x1F)) , CRM_USART3_PERIPH_CLOCK = (uint32_t)(((0x1C) << 16) | (18 & 0x1F)) ,
CRM_UART4_PERIPH_CLOCK = (uint32_t)(((0x1C) << 16) | (19 & 0x1F)) , CRM_UART5_PERIPH_CLOCK = (uint32_t)(((0x1C) << 16) | (20 & 0x1F)) , CRM_I2C1_PERIPH_CLOCK = (uint32_t)(((0x1C) << 16) | (21 & 0x1F)) , CRM_I2C2_PERIPH_CLOCK = (uint32_t)(((0x1C) << 16) | (22 & 0x1F)) ,
CRM_USB_PERIPH_CLOCK = (uint32_t)(((0x1C) << 16) | (23 & 0x1F)) , CRM_CAN1_PERIPH_CLOCK = (uint32_t)(((0x1C) << 16) | (25 & 0x1F)) , CRM_BPR_PERIPH_CLOCK = (uint32_t)(((0x1C) << 16) | (27 & 0x1F)) , CRM_PWC_PERIPH_CLOCK = (uint32_t)(((0x1C) << 16) | (28 & 0x1F)) ,
CRM_CAN2_PERIPH_CLOCK = (uint32_t)(((0x1C) << 16) | (31 & 0x1F))
}
crm periph clock More...
enum crm_periph_reset_type {
CRM_IOMUX_PERIPH_RESET = (uint32_t)(((0x0C) << 16) | (0 & 0x1F)) , CRM_EXINT_PERIPH_RESET = (uint32_t)(((0x0C) << 16) | (1 & 0x1F)) , CRM_GPIOA_PERIPH_RESET = (uint32_t)(((0x0C) << 16) | (2 & 0x1F)) , CRM_GPIOB_PERIPH_RESET = (uint32_t)(((0x0C) << 16) | (3 & 0x1F)) ,
CRM_GPIOC_PERIPH_RESET = (uint32_t)(((0x0C) << 16) | (4 & 0x1F)) , CRM_GPIOD_PERIPH_RESET = (uint32_t)(((0x0C) << 16) | (5 & 0x1F)) , CRM_GPIOF_PERIPH_RESET = (uint32_t)(((0x0C) << 16) | (7 & 0x1F)) , CRM_ADC1_PERIPH_RESET = (uint32_t)(((0x0C) << 16) | (9 & 0x1F)) ,
CRM_ADC2_PERIPH_RESET = (uint32_t)(((0x0C) << 16) | (10 & 0x1F)) , CRM_TMR1_PERIPH_RESET = (uint32_t)(((0x0C) << 16) | (11 & 0x1F)) , CRM_SPI1_PERIPH_RESET = (uint32_t)(((0x0C) << 16) | (12 & 0x1F)) , CRM_TMR8_PERIPH_RESET = (uint32_t)(((0x0C) << 16) | (13 & 0x1F)) ,
CRM_USART1_PERIPH_RESET = (uint32_t)(((0x0C) << 16) | (14 & 0x1F)) , CRM_TMR9_PERIPH_RESET = (uint32_t)(((0x0C) << 16) | (19 & 0x1F)) , CRM_TMR10_PERIPH_RESET = (uint32_t)(((0x0C) << 16) | (20 & 0x1F)) , CRM_TMR11_PERIPH_RESET = (uint32_t)(((0x0C) << 16) | (21 & 0x1F)) ,
CRM_ACC_PERIPH_RESET = (uint32_t)(((0x0C) << 16) | (22 & 0x1F)) , CRM_TMR2_PERIPH_RESET = (uint32_t)(((0x10) << 16) | (0 & 0x1F)) , CRM_TMR3_PERIPH_RESET = (uint32_t)(((0x10) << 16) | (1 & 0x1F)) , CRM_TMR4_PERIPH_RESET = (uint32_t)(((0x10) << 16) | (2 & 0x1F)) ,
CRM_TMR5_PERIPH_RESET = (uint32_t)(((0x10) << 16) | (3 & 0x1F)) , CRM_WWDT_PERIPH_RESET = (uint32_t)(((0x10) << 16) | (11 & 0x1F)) , CRM_SPI2_PERIPH_RESET = (uint32_t)(((0x10) << 16) | (14 & 0x1F)) , CRM_USART2_PERIPH_RESET = (uint32_t)(((0x10) << 16) | (17 & 0x1F)) ,
CRM_USART3_PERIPH_RESET = (uint32_t)(((0x10) << 16) | (18 & 0x1F)) , CRM_UART4_PERIPH_RESET = (uint32_t)(((0x10) << 16) | (19 & 0x1F)) , CRM_UART5_PERIPH_RESET = (uint32_t)(((0x10) << 16) | (20 & 0x1F)) , CRM_I2C1_PERIPH_RESET = (uint32_t)(((0x10) << 16) | (21 & 0x1F)) ,
CRM_I2C2_PERIPH_RESET = (uint32_t)(((0x10) << 16) | (22 & 0x1F)) , CRM_USB_PERIPH_RESET = (uint32_t)(((0x10) << 16) | (23 & 0x1F)) , CRM_CAN1_PERIPH_RESET = (uint32_t)(((0x10) << 16) | (25 & 0x1F)) , CRM_BPR_PERIPH_RESET = (uint32_t)(((0x10) << 16) | (27 & 0x1F)) ,
CRM_PWC_PERIPH_RESET = (uint32_t)(((0x10) << 16) | (28 & 0x1F)) , CRM_CAN2_PERIPH_RESET = (uint32_t)(((0x10) << 16) | (31 & 0x1F))
}
crm periph reset More...
enum | crm_periph_clock_sleepmd_type { CRM_SRAM_PERIPH_CLOCK_SLEEP_MODE = (uint32_t)(((0x14) << 16) | (2 & 0x1F)) , CRM_FLASH_PERIPH_CLOCK_SLEEP_MODE = (uint32_t)(((0x14) << 16) | (4 & 0x1F)) }
crm periph clock in sleep mode More...
enum crm_pll_mult_type {
CRM_PLL_MULT_2 = 0 , CRM_PLL_MULT_3 = 1 , CRM_PLL_MULT_4 = 2 , CRM_PLL_MULT_5 = 3 ,
CRM_PLL_MULT_6 = 4 , CRM_PLL_MULT_7 = 5 , CRM_PLL_MULT_8 = 6 , CRM_PLL_MULT_9 = 7 ,
CRM_PLL_MULT_10 = 8 , CRM_PLL_MULT_11 = 9 , CRM_PLL_MULT_12 = 10 , CRM_PLL_MULT_13 = 11 ,
CRM_PLL_MULT_14 = 12 , CRM_PLL_MULT_15 = 13 , CRM_PLL_MULT_16 = 15 , CRM_PLL_MULT_17 = 16 ,
CRM_PLL_MULT_18 = 17 , CRM_PLL_MULT_19 = 18 , CRM_PLL_MULT_20 = 19 , CRM_PLL_MULT_21 = 20 ,
CRM_PLL_MULT_22 = 21 , CRM_PLL_MULT_23 = 22 , CRM_PLL_MULT_24 = 23 , CRM_PLL_MULT_25 = 24 ,
CRM_PLL_MULT_26 = 25 , CRM_PLL_MULT_27 = 26 , CRM_PLL_MULT_28 = 27 , CRM_PLL_MULT_29 = 28 ,
CRM_PLL_MULT_30 = 29 , CRM_PLL_MULT_31 = 30 , CRM_PLL_MULT_32 = 31 , CRM_PLL_MULT_33 = 32 ,
CRM_PLL_MULT_34 = 33 , CRM_PLL_MULT_35 = 34 , CRM_PLL_MULT_36 = 35 , CRM_PLL_MULT_37 = 36 ,
CRM_PLL_MULT_38 = 37 , CRM_PLL_MULT_39 = 38 , CRM_PLL_MULT_40 = 39 , CRM_PLL_MULT_41 = 40 ,
CRM_PLL_MULT_42 = 41 , CRM_PLL_MULT_43 = 42 , CRM_PLL_MULT_44 = 43 , CRM_PLL_MULT_45 = 44 ,
CRM_PLL_MULT_46 = 45 , CRM_PLL_MULT_47 = 46 , CRM_PLL_MULT_48 = 47 , CRM_PLL_MULT_49 = 48 ,
CRM_PLL_MULT_50 = 49 , CRM_PLL_MULT_51 = 50 , CRM_PLL_MULT_52 = 51 , CRM_PLL_MULT_53 = 52 ,
CRM_PLL_MULT_54 = 53 , CRM_PLL_MULT_55 = 54 , CRM_PLL_MULT_56 = 55 , CRM_PLL_MULT_57 = 56 ,
CRM_PLL_MULT_58 = 57 , CRM_PLL_MULT_59 = 58 , CRM_PLL_MULT_60 = 59 , CRM_PLL_MULT_61 = 60 ,
CRM_PLL_MULT_62 = 61 , CRM_PLL_MULT_63 = 62 , CRM_PLL_MULT_64 = 63
}
crm pll mult_x More...
enum | crm_pll_clock_source_type { CRM_PLL_SOURCE_HICK = 0x00 , CRM_PLL_SOURCE_HEXT = 0x01 , CRM_PLL_SOURCE_HEXT_DIV = 0x02 }
crm pll clock source More...
enum | crm_pll_output_range_type { CRM_PLL_OUTPUT_RANGE_LE72MHZ = 0x00 , CRM_PLL_OUTPUT_RANGE_GT72MHZ = 0x01 }
crm pll clock output range More...
enum crm_clock_source_type {
CRM_CLOCK_SOURCE_HICK = 0x00 , CRM_CLOCK_SOURCE_HEXT = 0x01 , CRM_CLOCK_SOURCE_PLL = 0x02 , CRM_CLOCK_SOURCE_LEXT = 0x03 ,
CRM_CLOCK_SOURCE_LICK = 0x04
}
crm clock source More...
enum crm_ahb_div_type {
CRM_AHB_DIV_1 = 0x00 , CRM_AHB_DIV_2 = 0x08 , CRM_AHB_DIV_4 = 0x09 , CRM_AHB_DIV_8 = 0x0A ,
CRM_AHB_DIV_16 = 0x0B , CRM_AHB_DIV_64 = 0x0C , CRM_AHB_DIV_128 = 0x0D , CRM_AHB_DIV_256 = 0x0E ,
CRM_AHB_DIV_512 = 0x0F
}
crm ahb division More...
enum crm_apb1_div_type {
CRM_APB1_DIV_1 = 0x00 , CRM_APB1_DIV_2 = 0x04 , CRM_APB1_DIV_4 = 0x05 , CRM_APB1_DIV_8 = 0x06 ,
CRM_APB1_DIV_16 = 0x07
}
crm apb1 division More...
enum crm_apb2_div_type {
CRM_APB2_DIV_1 = 0x00 , CRM_APB2_DIV_2 = 0x04 , CRM_APB2_DIV_4 = 0x05 , CRM_APB2_DIV_8 = 0x06 ,
CRM_APB2_DIV_16 = 0x07
}
crm apb2 division More...
enum crm_adc_div_type {
CRM_ADC_DIV_2 = 0x00 , CRM_ADC_DIV_4 = 0x01 , CRM_ADC_DIV_6 = 0x02 , CRM_ADC_DIV_8 = 0x03 ,
CRM_ADC_DIV_12 = 0x05 , CRM_ADC_DIV_16 = 0x07
}
crm adc division More...
enum crm_usb_div_type {
CRM_USB_DIV_1_5 = 0x00 , CRM_USB_DIV_1 = 0x01 , CRM_USB_DIV_2_5 = 0x02 , CRM_USB_DIV_2 = 0x03 ,
CRM_USB_DIV_3_5 = 0x04 , CRM_USB_DIV_3 = 0x05 , CRM_USB_DIV_4 = 0x06
}
crm usb division More...
enum | crm_rtc_clock_type { CRM_RTC_CLOCK_NOCLK = 0x00 , CRM_RTC_CLOCK_LEXT = 0x01 , CRM_RTC_CLOCK_LICK = 0x02 , CRM_RTC_CLOCK_HEXT_DIV = 0x03 }
crm rtc clock More...
enum | crm_hick_div_6_type { CRM_HICK48_DIV6 = 0x00 , CRM_HICK48_NODIV = 0x01 }
crm hick 48mhz division More...
enum | crm_sclk_type { CRM_SCLK_HICK = 0x00 , CRM_SCLK_HEXT = 0x01 , CRM_SCLK_PLL = 0x02 }
crm sclk select More...
enum crm_clkout_select_type {
CRM_CLKOUT_NOCLK = 0x00 , CRM_CLKOUT_LICK = 0x02 , CRM_CLKOUT_LEXT = 0x03 , CRM_CLKOUT_SCLK = 0x04 ,
CRM_CLKOUT_HICK = 0x05 , CRM_CLKOUT_HEXT = 0x06 , CRM_CLKOUT_PLL_DIV_2 = 0x07 , CRM_CLKOUT_PLL_DIV_4 = 0x0C ,
CRM_CLKOUT_USB = 0x0D , CRM_CLKOUT_ADC = 0x0E
}
crm clkout select More...
enum crm_clkout_div_type {
CRM_CLKOUT_DIV_1 = 0x00 , CRM_CLKOUT_DIV_2 = 0x08 , CRM_CLKOUT_DIV_4 = 0x09 , CRM_CLKOUT_DIV_8 = 0x0A ,
CRM_CLKOUT_DIV_16 = 0x0B , CRM_CLKOUT_DIV_64 = 0x0C , CRM_CLKOUT_DIV_128 = 0x0D , CRM_CLKOUT_DIV_256 = 0x0E ,
CRM_CLKOUT_DIV_512 = 0x0F
}
crm clkout division More...
enum | crm_auto_step_mode_type { CRM_AUTO_STEP_MODE_DISABLE = 0x00 , CRM_AUTO_STEP_MODE_ENABLE = 0x03 }
crm auto step mode More...
enum | crm_usb_int_map_type { CRM_USB_INT19_INT20 = 0x00 , CRM_USB_INT73_INT74 = 0x01 }
crm usbdev interrupt remap More...
enum | crm_usb_clock_source_type { CRM_USB_CLOCK_SOURCE_PLL = 0x00 , CRM_USB_CLOCK_SOURCE_HICK = 0x01 }
crm usb 48 mhz clock source select More...
enum | crm_hick_sclk_frequency_type { CRM_HICK_SCLK_8MHZ = 0x00 , CRM_HICK_SCLK_48MHZ = 0x01 }
crm hick as system clock frequency select More...

Functions

void | crm_reset (void)
reset the crm register
void | crm_lext_bypass (confirm_state new_state)
enable or disable crm low speed external crystal bypass
void | crm_hext_bypass (confirm_state new_state)
enable or disable crm high speed external crystal bypass
flag_status | crm_flag_get (uint32_t flag)
get crm flag status
flag_status | crm_interrupt_flag_get (uint32_t flag)
get crm interrupt flag status
error_status | crm_hext_stable_wait (void)
wait for hext stable
void | crm_hick_clock_trimming_set (uint8_t trim_value)
set the hick trimming value
void | crm_hick_clock_calibration_set (uint8_t cali_value)
set the crm calibration value
void | crm_periph_clock_enable (crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
void | crm_periph_reset (crm_periph_reset_type value, confirm_state new_state)
enable or disable the peripheral reset
void | crm_periph_sleep_mode_clock_enable (crm_periph_clock_sleepmd_type value, confirm_state new_state)
enable or disable the peripheral clock in sleep mode
void | crm_clock_source_enable (crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
void | crm_flag_clear (uint32_t flag)
clear the crm reset flags
void | crm_rtc_clock_select (crm_rtc_clock_type value)
select rtc clock
void | crm_rtc_clock_enable (confirm_state new_state)
enable or disable rtc
void | crm_ahb_div_set (crm_ahb_div_type value)
set crm ahb division
void | crm_apb1_div_set (crm_apb1_div_type value)
set crm apb1 division
void | crm_apb2_div_set (crm_apb2_div_type value)
set crm apb2 division
void | crm_adc_clock_div_set (crm_adc_div_type div_value)
set crm adc division
void | crm_usb_clock_div_set (crm_usb_div_type div_value)
set crm usb division
void | crm_clock_failure_detection_enable (confirm_state new_state)
enable or disable clock failure detection
void | crm_battery_powered_domain_reset (confirm_state new_state)
battery powered domain software reset
void | crm_pll_config (crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
void | crm_sysclk_switch (crm_sclk_type value)
select system clock source
crm_sclk_type | crm_sysclk_switch_status_get (void)
indicate which clock source is used as system clock
void | crm_clocks_freq_get (crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
void | crm_clock_out_set (crm_clkout_select_type clkout)
set crm clkout
void | crm_interrupt_enable (uint32_t crm_int, confirm_state new_state)
config crm interrupt
void | crm_auto_step_mode_enable (confirm_state new_state)
auto step clock switch enable
void | crm_usb_interrupt_remapping_set (crm_usb_int_map_type int_remap)
usbdev interrupt remapping control
void | crm_hick_divider_select (crm_hick_div_6_type value)
config hick divider select
void | crm_hick_sclk_frequency_select (crm_hick_sclk_frequency_type value)
hick as system clock frequency select
void | crm_usb_clock_source_select (crm_usb_clock_source_type value)
usb 48 mhz clock source select
void | crm_clkout_to_tmr10_enable (confirm_state new_state)
enable or disable clkout direct to tmr10 channel 1
void | crm_clkout_div_set (crm_clkout_div_type clkout_div)
set crm clkout division

Detailed Description

at32f413 crm header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_crm.h.


AT32F413 Firmwary Library: at32f413_debug.h File Reference

  • libraries
  • drivers
  • inc
Data Structures | Macros | Functions
at32f413_debug.h File Reference

at32f413 debug header file More...

#include "at32f413.h"

Go to the source code of this file.

Data Structures

struct debug_type
type define debug register all More...

Macros

#define | DEBUG_SLEEP 0x00000001
#define | DEBUG_DEEPSLEEP 0x00000002
#define | DEBUG_STANDBY 0x00000004
#define | DEBUG_WDT_PAUSE 0x00000100
#define | DEBUG_WWDT_PAUSE 0x00000200
#define | DEBUG_TMR1_PAUSE 0x00000400
#define | DEBUG_TMR2_PAUSE 0x00000800
#define | DEBUG_TMR3_PAUSE 0x00001000
#define | DEBUG_TMR4_PAUSE 0x00002000
#define | DEBUG_CAN1_PAUSE 0x00004000
#define | DEBUG_I2C1_SMBUS_TIMEOUT 0x00008000
#define | DEBUG_I2C2_SMBUS_TIMEOUT 0x00010000
#define | DEBUG_TMR8_PAUSE 0x00020000
#define | DEBUG_TMR5_PAUSE 0x00040000
#define | DEBUG_CAN2_PAUSE 0x00200000
#define | DEBUG_TMR9_PAUSE 0x10000000
#define | DEBUG_TMR10_PAUSE 0x20000000
#define | DEBUG_TMR11_PAUSE 0x40000000
#define | DEBUGMCU ((debug_type *) DEBUG_BASE)

Functions

uint32_t | debug_device_id_get (void)
get debug device id
void | debug_periph_mode_set (uint32_t periph_debug_mode, confirm_state new_state)
set periph debug mode

Detailed Description

at32f413 debug header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_debug.h.


AT32F413 Firmwary Library: at32f413_def.h File Reference

  • libraries
  • drivers
  • inc
Macros
at32f413_def.h File Reference

at32f413 macros header file More...

Go to the source code of this file.

Macros

#define UNUSED(x)

Detailed Description

at32f413 macros header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_def.h.

Macro Definition Documentation

◆ UNUSED

#define UNUSED ( x )
Value:
(void)x /* to avoid gcc/g++ warnings */

Definition at line 64 of file at32f413_def.h.

Referenced by flash_spim_dummy_read(), flash_spim_model_select(), flash_spim_unlock(), fputc(), i2c_flag_clear(), main(), spi_i2s_flag_clear(), usart_flag_clear(), usb_ept_close(), usb_ept_open(), usb_ept_stall(), and usb_usbbufs_enable().


AT32F413 Firmwary Library: at32f413_dma.h File Reference

  • libraries
  • drivers
  • inc
Data Structures | Macros | Enumerations | Functions
at32f413_dma.h File Reference

at32f413 dma header file More...

#include "at32f413.h"

Go to the source code of this file.

Data Structures

struct | dma_init_type
dma init type More...
struct | dma_type
type define dma register More...
struct | dma_channel_type
type define dma channel register all More...

Macros

#define | DMA_FDT_INT ((uint32_t)0x00000002)
#define | DMA_HDT_INT ((uint32_t)0x00000004)
#define | DMA_DTERR_INT ((uint32_t)0x00000008)
#define | FLEX_CHANNEL1 ((uint8_t)0x01)
#define | FLEX_CHANNEL2 ((uint8_t)0x02)
#define | FLEX_CHANNEL3 ((uint8_t)0x03)
#define | FLEX_CHANNEL4 ((uint8_t)0x04)
#define | FLEX_CHANNEL5 ((uint8_t)0x05)
#define | FLEX_CHANNEL6 ((uint8_t)0x06)
#define | FLEX_CHANNEL7 ((uint8_t)0x07)
#define | DMA1_GL1_FLAG ((uint32_t)0x00000001)
#define | DMA1_FDT1_FLAG ((uint32_t)0x00000002)
#define | DMA1_HDT1_FLAG ((uint32_t)0x00000004)
#define | DMA1_DTERR1_FLAG ((uint32_t)0x00000008)
#define | DMA1_GL2_FLAG ((uint32_t)0x00000010)
#define | DMA1_FDT2_FLAG ((uint32_t)0x00000020)
#define | DMA1_HDT2_FLAG ((uint32_t)0x00000040)
#define | DMA1_DTERR2_FLAG ((uint32_t)0x00000080)
#define | DMA1_GL3_FLAG ((uint32_t)0x00000100)
#define | DMA1_FDT3_FLAG ((uint32_t)0x00000200)
#define | DMA1_HDT3_FLAG ((uint32_t)0x00000400)
#define | DMA1_DTERR3_FLAG ((uint32_t)0x00000800)
#define | DMA1_GL4_FLAG ((uint32_t)0x00001000)
#define | DMA1_FDT4_FLAG ((uint32_t)0x00002000)
#define | DMA1_HDT4_FLAG ((uint32_t)0x00004000)
#define | DMA1_DTERR4_FLAG ((uint32_t)0x00008000)
#define | DMA1_GL5_FLAG ((uint32_t)0x00010000)
#define | DMA1_FDT5_FLAG ((uint32_t)0x00020000)
#define | DMA1_HDT5_FLAG ((uint32_t)0x00040000)
#define | DMA1_DTERR5_FLAG ((uint32_t)0x00080000)
#define | DMA1_GL6_FLAG ((uint32_t)0x00100000)
#define | DMA1_FDT6_FLAG ((uint32_t)0x00200000)
#define | DMA1_HDT6_FLAG ((uint32_t)0x00400000)
#define | DMA1_DTERR6_FLAG ((uint32_t)0x00800000)
#define | DMA1_GL7_FLAG ((uint32_t)0x01000000)
#define | DMA1_FDT7_FLAG ((uint32_t)0x02000000)
#define | DMA1_HDT7_FLAG ((uint32_t)0x04000000)
#define | DMA1_DTERR7_FLAG ((uint32_t)0x08000000)
#define | DMA2_GL1_FLAG ((uint32_t)0x10000001)
#define | DMA2_FDT1_FLAG ((uint32_t)0x10000002)
#define | DMA2_HDT1_FLAG ((uint32_t)0x10000004)
#define | DMA2_DTERR1_FLAG ((uint32_t)0x10000008)
#define | DMA2_GL2_FLAG ((uint32_t)0x10000010)
#define | DMA2_FDT2_FLAG ((uint32_t)0x10000020)
#define | DMA2_HDT2_FLAG ((uint32_t)0x10000040)
#define | DMA2_DTERR2_FLAG ((uint32_t)0x10000080)
#define | DMA2_GL3_FLAG ((uint32_t)0x10000100)
#define | DMA2_FDT3_FLAG ((uint32_t)0x10000200)
#define | DMA2_HDT3_FLAG ((uint32_t)0x10000400)
#define | DMA2_DTERR3_FLAG ((uint32_t)0x10000800)
#define | DMA2_GL4_FLAG ((uint32_t)0x10001000)
#define | DMA2_FDT4_FLAG ((uint32_t)0x10002000)
#define | DMA2_HDT4_FLAG ((uint32_t)0x10004000)
#define | DMA2_DTERR4_FLAG ((uint32_t)0x10008000)
#define | DMA2_GL5_FLAG ((uint32_t)0x10010000)
#define | DMA2_FDT5_FLAG ((uint32_t)0x10020000)
#define | DMA2_HDT5_FLAG ((uint32_t)0x10040000)
#define | DMA2_DTERR5_FLAG ((uint32_t)0x10080000)
#define | DMA2_GL6_FLAG ((uint32_t)0x10100000)
#define | DMA2_FDT6_FLAG ((uint32_t)0x10200000)
#define | DMA2_HDT6_FLAG ((uint32_t)0x10400000)
#define | DMA2_DTERR6_FLAG ((uint32_t)0x10800000)
#define | DMA2_GL7_FLAG ((uint32_t)0x11000000)
#define | DMA2_FDT7_FLAG ((uint32_t)0x12000000)
#define | DMA2_HDT7_FLAG ((uint32_t)0x14000000)
#define | DMA2_DTERR7_FLAG ((uint32_t)0x18000000)
#define | DMA1 ((dma_type *) DMA1_BASE)
#define | DMA1_CHANNEL1 ((dma_channel_type *) DMA1_CHANNEL1_BASE)
#define | DMA1_CHANNEL2 ((dma_channel_type *) DMA1_CHANNEL2_BASE)
#define | DMA1_CHANNEL3 ((dma_channel_type *) DMA1_CHANNEL3_BASE)
#define | DMA1_CHANNEL4 ((dma_channel_type *) DMA1_CHANNEL4_BASE)
#define | DMA1_CHANNEL5 ((dma_channel_type *) DMA1_CHANNEL5_BASE)
#define | DMA1_CHANNEL6 ((dma_channel_type *) DMA1_CHANNEL6_BASE)
#define | DMA1_CHANNEL7 ((dma_channel_type *) DMA1_CHANNEL7_BASE)
#define | DMA2 ((dma_type *) DMA2_BASE)
#define | DMA2_CHANNEL1 ((dma_channel_type *) DMA2_CHANNEL1_BASE)
#define | DMA2_CHANNEL2 ((dma_channel_type *) DMA2_CHANNEL2_BASE)
#define | DMA2_CHANNEL3 ((dma_channel_type *) DMA2_CHANNEL3_BASE)
#define | DMA2_CHANNEL4 ((dma_channel_type *) DMA2_CHANNEL4_BASE)
#define | DMA2_CHANNEL5 ((dma_channel_type *) DMA2_CHANNEL5_BASE)
#define | DMA2_CHANNEL6 ((dma_channel_type *) DMA2_CHANNEL6_BASE)
#define | DMA2_CHANNEL7 ((dma_channel_type *) DMA2_CHANNEL7_BASE)

Enumerations

enum dma_flexible_request_type {
DMA_FLEXIBLE_ADC1 = 0x01 , DMA_FLEXIBLE_SPI1_RX = 0x09 , DMA_FLEXIBLE_SPI1_TX = 0x0A , DMA_FLEXIBLE_SPI2_RX = 0x0B ,
DMA_FLEXIBLE_SPI2_TX = 0x0C , DMA_FLEXIBLE_UART1_RX = 0x19 , DMA_FLEXIBLE_UART1_TX = 0x1A , DMA_FLEXIBLE_UART2_RX = 0x1B ,
DMA_FLEXIBLE_UART2_TX = 0x1C , DMA_FLEXIBLE_UART3_RX = 0x1D , DMA_FLEXIBLE_UART3_TX = 0x1E , DMA_FLEXIBLE_UART4_RX = 0x1F ,
DMA_FLEXIBLE_UART4_TX = 0x20 , DMA_FLEXIBLE_UART5_RX = 0x21 , DMA_FLEXIBLE_UART5_TX = 0x22 , DMA_FLEXIBLE_I2C1_RX = 0x29 ,
DMA_FLEXIBLE_I2C1_TX = 0x2A , DMA_FLEXIBLE_I2C2_RX = 0x2B , DMA_FLEXIBLE_I2C2_TX = 0x2C , DMA_FLEXIBLE_SDIO1 = 0x31 ,
DMA_FLEXIBLE_TMR1_TRIG = 0x35 , DMA_FLEXIBLE_TMR1_HALL = 0x36 , DMA_FLEXIBLE_TMR1_OVERFLOW = 0x37 , DMA_FLEXIBLE_TMR1_CH1 = 0x38 ,
DMA_FLEXIBLE_TMR1_CH2 = 0x39 , DMA_FLEXIBLE_TMR1_CH3 = 0x3A , DMA_FLEXIBLE_TMR1_CH4 = 0x3B , DMA_FLEXIBLE_TMR2_TRIG = 0x3D ,
DMA_FLEXIBLE_TMR2_OVERFLOW = 0x3F , DMA_FLEXIBLE_TMR2_CH1 = 0x40 , DMA_FLEXIBLE_TMR2_CH2 = 0x41 , DMA_FLEXIBLE_TMR2_CH3 = 0x42 ,
DMA_FLEXIBLE_TMR2_CH4 = 0x43 , DMA_FLEXIBLE_TMR3_TRIG = 0x45 , DMA_FLEXIBLE_TMR3_OVERFLOW = 0x47 , DMA_FLEXIBLE_TMR3_CH1 = 0x48 ,
DMA_FLEXIBLE_TMR3_CH2 = 0x49 , DMA_FLEXIBLE_TMR3_CH3 = 0x4A , DMA_FLEXIBLE_TMR3_CH4 = 0x4B , DMA_FLEXIBLE_TMR4_TRIG = 0x4D ,
DMA_FLEXIBLE_TMR4_OVERFLOW = 0x4F , DMA_FLEXIBLE_TMR4_CH1 = 0x50 , DMA_FLEXIBLE_TMR4_CH2 = 0x51 , DMA_FLEXIBLE_TMR4_CH3 = 0x52 ,
DMA_FLEXIBLE_TMR4_CH4 = 0x53 , DMA_FLEXIBLE_TMR5_TRIG = 0x55 , DMA_FLEXIBLE_TMR5_OVERFLOW = 0x57 , DMA_FLEXIBLE_TMR5_CH1 = 0x58 ,
DMA_FLEXIBLE_TMR5_CH2 = 0x59 , DMA_FLEXIBLE_TMR5_CH3 = 0x5A , DMA_FLEXIBLE_TMR5_CH4 = 0x5B , DMA_FLEXIBLE_TMR8_TRIG = 0x6D ,
DMA_FLEXIBLE_TMR8_HALL = 0x6E , DMA_FLEXIBLE_TMR8_OVERFLOW = 0x6F , DMA_FLEXIBLE_TMR8_CH1 = 0x70 , DMA_FLEXIBLE_TMR8_CH2 = 0x71 ,
DMA_FLEXIBLE_TMR8_CH3 = 0x72 , DMA_FLEXIBLE_TMR8_CH4 = 0x73
}
dma flexible request type More...
enum | dma_dir_type { DMA_DIR_PERIPHERAL_TO_MEMORY = 0x0000 , DMA_DIR_MEMORY_TO_PERIPHERAL = 0x0010 , DMA_DIR_MEMORY_TO_MEMORY = 0x4000 }
dma direction type More...
enum | dma_peripheral_inc_type { DMA_PERIPHERAL_INC_DISABLE = 0x00 , DMA_PERIPHERAL_INC_ENABLE = 0x01 }
dma peripheral incremented type More...
enum | dma_memory_inc_type { DMA_MEMORY_INC_DISABLE = 0x00 , DMA_MEMORY_INC_ENABLE = 0x01 }
dma memory incremented type More...
enum | dma_peripheral_data_size_type { DMA_PERIPHERAL_DATA_WIDTH_BYTE = 0x00 , DMA_PERIPHERAL_DATA_WIDTH_HALFWORD = 0x01 , DMA_PERIPHERAL_DATA_WIDTH_WORD = 0x02 }
dma peripheral data size type More...
enum | dma_memory_data_size_type { DMA_MEMORY_DATA_WIDTH_BYTE = 0x00 , DMA_MEMORY_DATA_WIDTH_HALFWORD = 0x01 , DMA_MEMORY_DATA_WIDTH_WORD = 0x02 }
dma memory data size type More...
enum | dma_priority_level_type { DMA_PRIORITY_LOW = 0x00 , DMA_PRIORITY_MEDIUM = 0x01 , DMA_PRIORITY_HIGH = 0x02 , DMA_PRIORITY_VERY_HIGH = 0x03 }
dma priority level type More...

Functions

void | dma_reset (dma_channel_type *dmax_channely)
reset the dmax channely registers.
void | dma_default_para_init (dma_init_type *dma_init_struct)
dma init config with its default value.
void | dma_init (dma_channel_type *dmax_channely, dma_init_type *dma_init_struct)
dma init
void | dma_channel_enable (dma_channel_type *dmax_channely, confirm_state new_state)
enable or disable dma channely
void | dma_flexible_config (dma_type *dma_x, uint8_t flex_channelx, dma_flexible_request_type flexible_request)
initialize the dma_x flexible function according to the specified parameters.
void | dma_data_number_set (dma_channel_type *dmax_channely, uint16_t data_number)
set the number of data to be transferred
uint16_t | dma_data_number_get (dma_channel_type *dmax_channely)
get number of data from dtcnt register
void | dma_interrupt_enable (dma_channel_type *dmax_channely, uint32_t dma_int, confirm_state new_state)
enable or disable dma interrupt
flag_status | dma_flag_get (uint32_t dmax_flag)
get dma flag
flag_status | dma_interrupt_flag_get (uint32_t dmax_flag)
get dma interrupt flag
void | dma_flag_clear (uint32_t dmax_flag)
clear dma flag

Detailed Description

at32f413 dma header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_dma.h.


AT32F413 Firmwary Library: at32f413_exint.h File Reference

  • libraries
  • drivers
  • inc
Data Structures | Macros | Enumerations | Functions
at32f413_exint.h File Reference

at32f413 exint header file More...

#include "at32f413.h"

Go to the source code of this file.

Data Structures

struct | exint_init_type
exint init type More...
struct | exint_type
type define exint register all More...

Macros

#define | EXINT_LINE_NONE ((uint32_t)0x000000)
#define | EXINT_LINE_0 ((uint32_t)0x000001)
#define | EXINT_LINE_1 ((uint32_t)0x000002)
#define | EXINT_LINE_2 ((uint32_t)0x000004)
#define | EXINT_LINE_3 ((uint32_t)0x000008)
#define | EXINT_LINE_4 ((uint32_t)0x000010)
#define | EXINT_LINE_5 ((uint32_t)0x000020)
#define | EXINT_LINE_6 ((uint32_t)0x000040)
#define | EXINT_LINE_7 ((uint32_t)0x000080)
#define | EXINT_LINE_8 ((uint32_t)0x000100)
#define | EXINT_LINE_9 ((uint32_t)0x000200)
#define | EXINT_LINE_10 ((uint32_t)0x000400)
#define | EXINT_LINE_11 ((uint32_t)0x000800)
#define | EXINT_LINE_12 ((uint32_t)0x001000)
#define | EXINT_LINE_13 ((uint32_t)0x002000)
#define | EXINT_LINE_14 ((uint32_t)0x004000)
#define | EXINT_LINE_15 ((uint32_t)0x008000)
#define | EXINT_LINE_16 ((uint32_t)0x010000)
#define | EXINT_LINE_17 ((uint32_t)0x020000)
#define | EXINT_LINE_18 ((uint32_t)0x040000)
#define | EXINT ((exint_type *) EXINT_BASE)

Enumerations

enum | exint_line_mode_type { EXINT_LINE_INTERRUPUT = 0x00 , EXINT_LINE_INTERRUPT = 0x00 , EXINT_LINE_EVENT = 0x01 }
exint line mode type More...
enum | exint_polarity_config_type { EXINT_TRIGGER_RISING_EDGE = 0x00 , EXINT_TRIGGER_FALLING_EDGE = 0x01 , EXINT_TRIGGER_BOTH_EDGE = 0x02 }
exint polarity configuration type More...

Functions

void | exint_reset (void)
exint reset
void | exint_default_para_init (exint_init_type *exint_struct)
exint default para init
void | exint_init (exint_init_type *exint_struct)
exint init
void | exint_flag_clear (uint32_t exint_line)
clear exint flag
flag_status | exint_flag_get (uint32_t exint_line)
get exint flag
flag_status | exint_interrupt_flag_get (uint32_t exint_line)
get exint interrupt flag
void | exint_software_interrupt_event_generate (uint32_t exint_line)
generate exint software interrupt event
void | exint_interrupt_enable (uint32_t exint_line, confirm_state new_state)
enable or disable exint interrupt
void | exint_event_enable (uint32_t exint_line, confirm_state new_state)
enable or disable exint event

Detailed Description

at32f413 exint header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_exint.h.


AT32F413 Firmwary Library: at32f413_flash.h File Reference

  • libraries
  • drivers
  • inc
Data Structures | Macros | Enumerations | Functions
at32f413_flash.h File Reference

at32f413 flash header file More...

#include "at32f413.h"

Go to the source code of this file.

Data Structures

struct | flash_type
type define flash register all More...
struct | usd_type
user system data More...

Macros

#define | FLASH_UNLOCK_KEY1 ((uint32_t)0x45670123)
#define | FLASH_UNLOCK_KEY2 ((uint32_t)0xCDEF89AB)
#define | FAP_RELIEVE_KEY ((uint16_t)0x00A5)
#define | SLIB_UNLOCK_KEY ((uint32_t)0xA35F6D24)
#define | FLASH_SPIM_START_ADDR ((uint32_t)0x08400000)
#define | FLASH_OBF_FLAG ((uint32_t)0x00000001)
#define | FLASH_ODF_FLAG ((uint32_t)0x00000020)
#define | FLASH_PRGMERR_FLAG ((uint32_t)0x00000004)
#define | FLASH_EPPERR_FLAG ((uint32_t)0x00000010)
#define | FLASH_SPIM_OBF_FLAG ((uint32_t)0x20000001)
#define | FLASH_SPIM_ODF_FLAG ((uint32_t)0x20000020)
#define | FLASH_SPIM_PRGMERR_FLAG ((uint32_t)0x20000004)
#define | FLASH_SPIM_EPPERR_FLAG ((uint32_t)0x20000010)
#define | FLASH_USDERR_FLAG ((uint32_t)0x40000001)
#define | FLASH_ERR_INT ((uint32_t)0x00000001)
#define | FLASH_ODF_INT ((uint32_t)0x00000002)
#define | FLASH_SPIM_ERR_INT ((uint32_t)0x00000010)
#define | FLASH_SPIM_ODF_INT ((uint32_t)0x00000020)
#define | FLASH_SLIB_START_SECTOR ((uint32_t)0x000007FF)
#define | FLASH_SLIB_DATA_START_SECTOR ((uint32_t)0x003FF800)
#define | FLASH_SLIB_END_SECTOR ((uint32_t)0xFFC00000)
#define | USD_WDT_ATO_DISABLE ((uint16_t)0x0001)
#define | USD_WDT_ATO_ENABLE ((uint16_t)0x0000)
#define | USD_DEPSLP_NO_RST ((uint16_t)0x0002)
#define | USD_DEPSLP_RST ((uint16_t)0x0000)
#define | USD_STDBY_NO_RST ((uint16_t)0x0004)
#define | USD_STDBY_RST ((uint16_t)0x0000)
#define | ERASE_TIMEOUT ((uint32_t)0x40000000)
#define | PROGRAMMING_TIMEOUT ((uint32_t)0x00100000)
#define | SPIM_ERASE_TIMEOUT ((uint32_t)0xFFFFFFFF)
#define | SPIM_PROGRAMMING_TIMEOUT ((uint32_t)0x00100000)
#define | OPERATION_TIMEOUT ((uint32_t)0x10000000)
#define | FLASH ((flash_type *) FLASH_REG_BASE)
#define | USD ((usd_type *) USD_BASE)

Enumerations

enum flash_status_type {
FLASH_OPERATE_BUSY = 0x00 , FLASH_PROGRAM_ERROR = 0x01 , FLASH_EPP_ERROR = 0x02 , FLASH_OPERATE_DONE = 0x03 ,
FLASH_OPERATE_TIMEOUT = 0x04
}
flash status type More...
enum flash_spim_model_type { FLASH_SPIM_MODEL1 = 0x01 , FLASH_SPIM_MODEL2 = 0x02 }
flash spim model type More...

Functions

flag_status | flash_flag_get (uint32_t flash_flag)
check whether the specified flash flag is set or not.
void | flash_flag_clear (uint32_t flash_flag)
clear the flash flag.
flash_status_type | flash_operation_status_get (void)
return the flash operation status.
flash_status_type | flash_spim_operation_status_get (void)
return the flash spim operation status.
flash_status_type | flash_operation_wait_for (uint32_t time_out)
wait for flash operation complete or timeout.
flash_status_type | flash_spim_operation_wait_for (uint32_t time_out)
wait for flash spim operation complete or timeout.
void | flash_unlock (void)
unlock the flash controller.
void | flash_spim_unlock (void)
unlock the flash spim controller.
void | flash_lock (void)
lock the flash controller.
void | flash_spim_lock (void)
lock the flash spim controller.
flash_status_type | flash_sector_erase (uint32_t sector_address)
erase a specified flash sector.
flash_status_type | flash_internal_all_erase (void)
erase flash all internal sectors.
flash_status_type | flash_spim_all_erase (void)
erase flash spim sectors.
flash_status_type | flash_user_system_data_erase (void)
erase the flash user system data.
flash_status_type | flash_word_program (uint32_t address, uint32_t data)
program a word at a specified address.
flash_status_type | flash_halfword_program (uint32_t address, uint16_t data)
program a halfword at a specified address.
flash_status_type | flash_byte_program (uint32_t address, uint8_t data)
program a byte at a specified address.
flash_status_type | flash_user_system_data_program (uint32_t address, uint8_t data)
program a halfword at a specified user system data address.
flash_status_type | flash_epp_set (uint32_t *sector_bits)
config erase/program protection for the desired sectors.
void | flash_epp_status_get (uint32_t *sector_bits)
return the flash erase/program protection status.
flash_status_type | flash_fap_enable (confirm_state new_state)
enable or disable the flash access protection.
flag_status | flash_fap_status_get (void)
check the flash access protection status.
flash_status_type | flash_ssb_set (uint8_t usd_ssb)
program the flash system setting byte in usd: wdt_ato_en / depslp_rst / stdby_rst.
uint8_t | flash_ssb_status_get (void)
return the flash system setting byte status.
void | flash_interrupt_enable (uint32_t flash_int, confirm_state new_state)
enable or disable the specified flash interrupts.
void | flash_spim_model_select (flash_spim_model_type mode)
select spim supports extended spi flash chip model.
void | flash_spim_encryption_range_set (uint32_t decode_address)
set the range of encryption in spim flash. when the address is larger than this value, the writing data will be directly written to spim without encryption.
void | flash_spim_dummy_read (void)
operate the flash spim dummy read.
flash_status_type | flash_spim_mass_program (uint32_t address, uint8_t *buf, uint32_t cnt)
mass program for flash spim.
flash_status_type | flash_slib_enable (uint32_t pwd, uint16_t start_sector, uint16_t data_start_sector, uint16_t end_sector)
enable security library function.
error_status | flash_slib_disable (uint32_t pwd)
disable slib when slib enabled.
uint32_t | flash_slib_remaining_count_get (void)
get remaining count of slib(range: 256~0).
flag_status | flash_slib_state_get (void)
get the slib state.
uint16_t | flash_slib_start_sector_get (void)
get the start sector of slib.
uint16_t | flash_slib_datastart_sector_get (void)
get the data start sector of slib.
uint16_t | flash_slib_end_sector_get (void)
get the end sector of slib.
uint32_t | flash_crc_calibrate (uint32_t start_sector, uint32_t sector_cnt)
flash crc calibration in main block.

Detailed Description

at32f413 flash header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_flash.h.


AT32F413 Firmwary Library: at32f413_gpio.h File Reference

  • libraries
  • drivers
  • inc
Data Structures | Macros | Enumerations | Functions
at32f413_gpio.h File Reference

at32f413 gpio header file More...

#include "at32f413.h"

Go to the source code of this file.

Data Structures

struct | gpio_init_type
gpio init type More...
struct | gpio_type
type define gpio register all More...
struct | iomux_type
type define iomux register all More...

Macros

#define | GPIO_PINS_0 0x0001
#define | GPIO_PINS_1 0x0002
#define | GPIO_PINS_2 0x0004
#define | GPIO_PINS_3 0x0008
#define | GPIO_PINS_4 0x0010
#define | GPIO_PINS_5 0x0020
#define | GPIO_PINS_6 0x0040
#define | GPIO_PINS_7 0x0080
#define | GPIO_PINS_8 0x0100
#define | GPIO_PINS_9 0x0200
#define | GPIO_PINS_10 0x0400
#define | GPIO_PINS_11 0x0800
#define | GPIO_PINS_12 0x1000
#define | GPIO_PINS_13 0x2000
#define | GPIO_PINS_14 0x4000
#define | GPIO_PINS_15 0x8000
#define | GPIO_PINS_ALL 0xFFFF
#define | IOMUX_MAKE_VALUE(reg_offset, bit_addr, bit_num, bit_val)
#define | SPI1_MUX_01 SPI1_GMUX_0001
#define | I2C1_MUX I2C1_GMUX_0001
#define | USART1_MUX USART1_GMUX_0001
#define | USART3_MUX_01 USART3_GMUX_0001
#define | TMR1_MUX_01 TMR1_GMUX_0001
#define | TMR2_MUX_01 TMR2_GMUX_001
#define | TMR2_MUX_10 TMR2_GMUX_010
#define | TMR2_MUX_11 TMR2_GMUX_011
#define | TMR3_MUX_10 TMR3_GMUX_0010
#define | TMR3_MUX_11 TMR3_GMUX_0011
#define | CAN_MUX_10 CAN1_GMUX_0010
#define | PD01_MUX PD01_GMUX
#define | TMR5CH4_MUX TMR5CH4_GMUX
#define | ADC1_ETP_MUX ADC1_ETP_GMUX
#define | ADC1_ETO_MUX ADC1_ETO_GMUX
#define | ADC2_ETP_MUX ADC2_ETP_GMUX
#define | ADC2_ETO_MUX ADC2_ETO_GMUX
#define | SWJTAG_CONF_001 SWJTAG_GMUX_001
#define | SWJTAG_CONF_010 SWJTAG_GMUX_010
#define | SWJTAG_CONF_100 SWJTAG_GMUX_100
#define | EXT_SPIM_EN_MUX EXT_SPIM_GMUX_1000
#define | TMR9_GMUX IOMUX_MAKE_VALUE(0x20, 0, 4, 0x02)
#define | TMR10_GMUX IOMUX_MAKE_VALUE(0x20, 4, 4, 0x02)
#define | TMR11_GMUX IOMUX_MAKE_VALUE(0x20, 8, 4, 0x02)
#define | TMR1_GMUX_0001 IOMUX_MAKE_VALUE(0x24, 0, 4, 0x01)
#define | TMR2_GMUX_001 IOMUX_MAKE_VALUE(0x24, 4, 3, 0x01)
#define | TMR2_GMUX_010 IOMUX_MAKE_VALUE(0x24, 4, 3, 0x02)
#define | TMR2_GMUX_011 IOMUX_MAKE_VALUE(0x24, 4, 3, 0x03)
#define | TMR2ITR1_GMUX IOMUX_MAKE_VALUE(0x24, 7, 1, 0x01)
#define | TMR3_GMUX_0010 IOMUX_MAKE_VALUE(0x24, 8, 4, 0x02)
#define | TMR3_GMUX_0011 IOMUX_MAKE_VALUE(0x24, 8, 4, 0x03)
#define | TMR5_GMUX_001 IOMUX_MAKE_VALUE(0x24, 16, 3, 0x01)
#define | TMR5CH4_GMUX IOMUX_MAKE_VALUE(0x24, 19, 1, 0x01)
#define | I2C1_GMUX_0001 IOMUX_MAKE_VALUE(0x28, 4, 4, 0x01)
#define | I2C1_GMUX_0011 IOMUX_MAKE_VALUE(0x28, 4, 4, 0x03)
#define | I2C2_GMUX_0001 IOMUX_MAKE_VALUE(0x28, 8, 4, 0x01)
#define | I2C2_GMUX_0010 IOMUX_MAKE_VALUE(0x28, 8, 4, 0x02)
#define | I2C2_GMUX_0011 IOMUX_MAKE_VALUE(0x28, 8, 4, 0x03)
#define | SPI1_GMUX_0001 IOMUX_MAKE_VALUE(0x28, 16, 4, 0x01)
#define | SPI2_GMUX_0001 IOMUX_MAKE_VALUE(0x28, 20, 4, 0x01)
#define | CAN1_GMUX_0010 IOMUX_MAKE_VALUE(0x2C, 0, 4, 0x02)
#define | CAN2_GMUX_0001 IOMUX_MAKE_VALUE(0x2C, 4, 4, 0x01)
#define | SDIO1_GMUX_0100 IOMUX_MAKE_VALUE(0x2C, 8, 4, 0x04)
#define | SDIO1_GMUX_0101 IOMUX_MAKE_VALUE(0x2C, 8, 4, 0x05)
#define | SDIO1_GMUX_0110 IOMUX_MAKE_VALUE(0x2C, 8, 4, 0x06)
#define | SDIO1_GMUX_0111 IOMUX_MAKE_VALUE(0x2C, 8, 4, 0x07)
#define | USART1_GMUX_0001 IOMUX_MAKE_VALUE(0x2C, 16, 4, 0x01)
#define | USART3_GMUX_0001 IOMUX_MAKE_VALUE(0x2C, 24, 4, 0x01)
#define | UART4_GMUX_0001 IOMUX_MAKE_VALUE(0x2C, 28, 4, 0x01)
#define | EXT_SPIM_GMUX_1000 IOMUX_MAKE_VALUE(0x30, 0, 4, 0x08)
#define | EXT_SPIM_GMUX_1001 IOMUX_MAKE_VALUE(0x30, 0, 4, 0x09)
#define | ADC1_ETP_GMUX IOMUX_MAKE_VALUE(0x30, 4, 1, 0x01)
#define | ADC1_ETO_GMUX IOMUX_MAKE_VALUE(0x30, 5, 1, 0x01)
#define | ADC2_ETP_GMUX IOMUX_MAKE_VALUE(0x30, 8, 1, 0x01)
#define | ADC2_ETO_GMUX IOMUX_MAKE_VALUE(0x30, 9, 1, 0x01)
#define | SWJTAG_GMUX_001 IOMUX_MAKE_VALUE(0x30, 16, 3, 0x01)
#define | SWJTAG_GMUX_010 IOMUX_MAKE_VALUE(0x30, 16, 3, 0x02)
#define | SWJTAG_GMUX_100 IOMUX_MAKE_VALUE(0x30, 16, 3, 0x04)
#define | PD01_GMUX IOMUX_MAKE_VALUE(0x30, 20, 1, 0x01)
#define | GPIOA ((gpio_type *) GPIOA_BASE)
#define | GPIOB ((gpio_type *) GPIOB_BASE)
#define | GPIOC ((gpio_type *) GPIOC_BASE)
#define | GPIOD ((gpio_type *) GPIOD_BASE)
#define | GPIOF ((gpio_type *) GPIOF_BASE)
#define | IOMUX ((iomux_type *) IOMUX_BASE)

Enumerations

enum | gpio_mode_type { GPIO_MODE_INPUT = 0x00 , GPIO_MODE_OUTPUT = 0x10 , GPIO_MODE_MUX = 0x08 , GPIO_MODE_ANALOG = 0x03 }
gpio mode select More...
enum | gpio_drive_type { GPIO_DRIVE_STRENGTH_STRONGER = 0x01 , GPIO_DRIVE_STRENGTH_MODERATE = 0x02 , GPIO_DRIVE_STRENGTH_MAXIMUM = 0x03 }
gpio output drive strength select More...
enum | gpio_output_type { GPIO_OUTPUT_PUSH_PULL = 0x00 , GPIO_OUTPUT_OPEN_DRAIN = 0x04 }
gpio output type More...
enum | gpio_pull_type { GPIO_PULL_NONE = 0x0004 , GPIO_PULL_UP = 0x0018 , GPIO_PULL_DOWN = 0x0028 }
gpio pull type More...
enum gpio_pins_source_type {
GPIO_PINS_SOURCE0 = 0x00 , GPIO_PINS_SOURCE1 = 0x01 , GPIO_PINS_SOURCE2 = 0x02 , GPIO_PINS_SOURCE3 = 0x03 ,
GPIO_PINS_SOURCE4 = 0x04 , GPIO_PINS_SOURCE5 = 0x05 , GPIO_PINS_SOURCE6 = 0x06 , GPIO_PINS_SOURCE7 = 0x07 ,
GPIO_PINS_SOURCE8 = 0x08 , GPIO_PINS_SOURCE9 = 0x09 , GPIO_PINS_SOURCE10 = 0x0A , GPIO_PINS_SOURCE11 = 0x0B ,
GPIO_PINS_SOURCE12 = 0x0C , GPIO_PINS_SOURCE13 = 0x0D , GPIO_PINS_SOURCE14 = 0x0E , GPIO_PINS_SOURCE15 = 0x0F
}
gpio pins source type More...
enum gpio_port_source_type {
GPIO_PORT_SOURCE_GPIOA = 0x00 , GPIO_PORT_SOURCE_GPIOB = 0x01 , GPIO_PORT_SOURCE_GPIOC = 0x02 , GPIO_PORT_SOURCE_GPIOD = 0x03 ,
GPIO_PORT_SOURCE_GPIOF = 0x05
}
gpio port source type More...

Functions

void | gpio_reset (gpio_type *gpio_x)
reset the gpio register
void | gpio_iomux_reset (void)
reset the mux functions (remap, event control and exint configuration) registers to their default values.
void | gpio_init (gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
void | gpio_default_para_init (gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
flag_status | gpio_input_data_bit_read (gpio_type *gpio_x, uint16_t pins)
read the specified input port pin.
uint16_t | gpio_input_data_read (gpio_type *gpio_x)
read the specified gpio input data port.
flag_status | gpio_output_data_bit_read (gpio_type *gpio_x, uint16_t pins)
read the specified output port pin.
uint16_t | gpio_output_data_read (gpio_type *gpio_x)
read the specified gpio ouput data port.
void | gpio_bits_set (gpio_type *gpio_x, uint16_t pins)
set the selected data port bits.
void | gpio_bits_reset (gpio_type *gpio_x, uint16_t pins)
clear the selected data port bits.
void | gpio_bits_toggle (gpio_type *gpio_x, uint16_t pins)
toggle the selected data port bits.
void | gpio_bits_write (gpio_type *gpio_x, uint16_t pins, confirm_state bit_state)
set or clear the selected data port bit.
void | gpio_port_write (gpio_type *gpio_x, uint16_t port_value)
write data to the specified gpio data port.
void | gpio_pin_wp_config (gpio_type *gpio_x, uint16_t pins)
write protect gpio pins configuration registers.
void | gpio_event_output_config (gpio_port_source_type gpio_port_source, gpio_pins_source_type gpio_pin_source)
select the gpio pin used as event output.
void | gpio_event_output_enable (confirm_state new_state)
enable or disable the event output.
void | gpio_pin_remap_config (uint32_t gpio_remap, confirm_state new_state)
iomux remap and debug i/o configuration.
void | gpio_exint_line_config (gpio_port_source_type gpio_port_source, gpio_pins_source_type gpio_pin_source)
select the gpio pin used as exint line.

Detailed Description

at32f413 gpio header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_gpio.h.


AT32F413 Firmwary Library: at32f413_i2c.h File Reference

  • libraries
  • drivers
  • inc
Data Structures | Macros | Enumerations | Functions
at32f413_i2c.h File Reference

at32f413 i2c header file More...

#include "at32f413.h"

Go to the source code of this file.

Data Structures

struct i2c_type
type define i2c register all More...

Macros

#define | I2C_STARTF_FLAG ((uint32_t)0x00000001)
#define | I2C_ADDR7F_FLAG ((uint32_t)0x00000002)
#define | I2C_TDC_FLAG ((uint32_t)0x00000004)
#define | I2C_ADDRHF_FLAG ((uint32_t)0x00000008)
#define | I2C_STOPF_FLAG ((uint32_t)0x00000010)
#define | I2C_RDBF_FLAG ((uint32_t)0x00000040)
#define | I2C_TDBE_FLAG ((uint32_t)0x00000080)
#define | I2C_BUSERR_FLAG ((uint32_t)0x00000100)
#define | I2C_ARLOST_FLAG ((uint32_t)0x00000200)
#define | I2C_ACKFAIL_FLAG ((uint32_t)0x00000400)
#define | I2C_OUF_FLAG ((uint32_t)0x00000800)
#define | I2C_PECERR_FLAG ((uint32_t)0x00001000)
#define | I2C_TMOUT_FLAG ((uint32_t)0x00004000)
#define | I2C_ALERTF_FLAG ((uint32_t)0x00008000)
#define | I2C_TRMODE_FLAG ((uint32_t)0x10010000)
#define | I2C_BUSYF_FLAG ((uint32_t)0x10020000)
#define | I2C_DIRF_FLAG ((uint32_t)0x10040000)
#define | I2C_GCADDRF_FLAG ((uint32_t)0x10100000)
#define | I2C_DEVADDRF_FLAG ((uint32_t)0x10200000)
#define | I2C_HOSTADDRF_FLAG ((uint32_t)0x10400000)
#define | I2C_ADDR2_FLAG ((uint32_t)0x10800000)
#define | I2C_DATA_INT ((uint16_t)0x0400)
#define | I2C_EVT_INT ((uint16_t)0x0200)
#define | I2C_ERR_INT ((uint16_t)0x0100)
#define | I2C1 ((i2c_type *) I2C1_BASE)
#define | I2C2 ((i2c_type *) I2C2_BASE)

Enumerations

enum | i2c_master_ack_type { I2C_MASTER_ACK_CURRENT = 0x00 , I2C_MASTER_ACK_NEXT = 0x01 }
i2c master receiving mode acknowledge control More...
enum | i2c_pec_position_type { I2C_PEC_POSITION_CURRENT = 0x00 , I2C_PEC_POSITION_NEXT = 0x01 }
i2c pec position set More...
enum | i2c_smbus_alert_set_type { I2C_SMBUS_ALERT_HIGH = 0x00 , I2C_SMBUS_ALERT_LOW = 0x01 }
i2c smbus alert pin set More...
enum | i2c_smbus_mode_set_type { I2C_SMBUS_MODE_DEVICE = 0x00 , I2C_SMBUS_MODE_HOST = 0x01 }
i2c smbus mode set More...
enum | i2c_fsmode_duty_cycle_type { I2C_FSMODE_DUTY_2_1 = 0x00 , I2C_FSMODE_DUTY_16_9 = 0x01 }
i2c fast mode duty cycle More...
enum | i2c_address_mode_type { I2C_ADDRESS_MODE_7BIT = 0x00 , I2C_ADDRESS_MODE_10BIT = 0x01 }
i2c address mode More...
enum | i2c_direction_type { I2C_DIRECTION_TRANSMIT = 0x00 , I2C_DIRECTION_RECEIVE = 0x01 }
i2c address direction More...

Functions

void | i2c_reset (i2c_type *i2c_x)
reset the i2c register
void | i2c_software_reset (i2c_type *i2c_x, confirm_state new_state)
software reset.
void | i2c_init (i2c_type *i2c_x, i2c_fsmode_duty_cycle_type duty, uint32_t speed)
init i2c speed and duty cycle.
void | i2c_own_address1_set (i2c_type *i2c_x, i2c_address_mode_type mode, uint16_t address)
config own address1.
void | i2c_own_address2_set (i2c_type *i2c_x, uint8_t address)
config own address2.
void | i2c_own_address2_enable (i2c_type *i2c_x, confirm_state new_state)
enable or disable own address2.
void | i2c_smbus_enable (i2c_type *i2c_x, confirm_state new_state)
enable or disable the smbus mode
void | i2c_enable (i2c_type *i2c_x, confirm_state new_state)
enable or disable i2c periph
void | i2c_fast_mode_duty_set (i2c_type *i2c_x, i2c_fsmode_duty_cycle_type duty)
config fast mode duty cycle
void | i2c_clock_stretch_enable (i2c_type *i2c_x, confirm_state new_state)
enable or disable clock stretch.
void | i2c_ack_enable (i2c_type *i2c_x, confirm_state new_state)
enable or disable acknowledge.
void | i2c_master_receive_ack_set (i2c_type *i2c_x, i2c_master_ack_type pos)
master receiving mode acknowledge control.
void | i2c_pec_position_set (i2c_type *i2c_x, i2c_pec_position_type pos)
pec position set.
void | i2c_general_call_enable (i2c_type *i2c_x, confirm_state new_state)
enable or disable general call.
void | i2c_arp_mode_enable (i2c_type *i2c_x, confirm_state new_state)
enable or disable arp mode.
void | i2c_smbus_mode_set (i2c_type *i2c_x, i2c_smbus_mode_set_type mode)
config smbus host or device.
void | i2c_smbus_alert_set (i2c_type *i2c_x, i2c_smbus_alert_set_type level)
drive the smbus alert pin high or low.
void | i2c_pec_transmit_enable (i2c_type *i2c_x, confirm_state new_state)
enable or disable pec transfer.
void | i2c_pec_calculate_enable (i2c_type *i2c_x, confirm_state new_state)
enable or disable pec calcultetion.
uint8_t | i2c_pec_value_get (i2c_type *i2c_x)
get pec value.
void | i2c_dma_end_transfer_set (i2c_type *i2c_x, confirm_state new_state)
enable or disable if the next dma transfer will be the last one.
void | i2c_dma_enable (i2c_type *i2c_x, confirm_state new_state)
enable or disable dma requests.
void | i2c_interrupt_enable (i2c_type *i2c_x, uint16_t source, confirm_state new_state)
enable or disable interrupt
void | i2c_start_generate (i2c_type *i2c_x)
generate start condition.
void | i2c_stop_generate (i2c_type *i2c_x)
generate stop condition.
void | i2c_7bit_address_send (i2c_type *i2c_x, uint8_t address, i2c_direction_type direction)
transmit the slave address.
void | i2c_data_send (i2c_type *i2c_x, uint8_t data)
send a byte through the i2c periph.
uint8_t | i2c_data_receive (i2c_type *i2c_x)
receive a byte through the i2c periph.
flag_status | i2c_flag_get (i2c_type *i2c_x, uint32_t flag)
get flag status
flag_status | i2c_interrupt_flag_get (i2c_type *i2c_x, uint32_t flag)
get interrupt flag status
void | i2c_flag_clear (i2c_type *i2c_x, uint32_t flag)
clear flag status

Detailed Description

at32f413 i2c header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_i2c.h.


AT32F413 Firmwary Library: at32f413_misc.h File Reference

  • libraries
  • drivers
  • inc
Macros | Enumerations | Functions
at32f413_misc.h File Reference

at32f413 misc header file More...

#include "at32f413.h"

Go to the source code of this file.

Macros

#define | NVIC_VECTTAB_RAM ((uint32_t)0x20000000)
#define | NVIC_VECTTAB_FLASH ((uint32_t)0x08000000)

Enumerations

enum nvic_priority_group_type {
NVIC_PRIORITY_GROUP_0 = ((uint32_t)0x7) , NVIC_PRIORITY_GROUP_1 = ((uint32_t)0x6) , NVIC_PRIORITY_GROUP_2 = ((uint32_t)0x5) , NVIC_PRIORITY_GROUP_3 = ((uint32_t)0x4) ,
NVIC_PRIORITY_GROUP_4 = ((uint32_t)0x3)
}
nvic interrupt priority group More...
enum | nvic_lowpower_mode_type { NVIC_LP_SLEEPONEXIT = 0x02 , NVIC_LP_SLEEPDEEP = 0x04 , NVIC_LP_SEVONPEND = 0x10 }
nvic low power mode More...
enum | systick_clock_source_type { SYSTICK_CLOCK_SOURCE_AHBCLK_DIV8 = ((uint32_t)0x00000000) , SYSTICK_CLOCK_SOURCE_AHBCLK_NODIV = ((uint32_t)0x00000004) }
systick clock source More...

Functions

void | nvic_system_reset (void)
system reset
void | nvic_irq_enable (IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
void | nvic_irq_disable (IRQn_Type irqn)
disable nvic irq number
void | nvic_priority_group_config (nvic_priority_group_type priority_group)
config nvic priority group
void | nvic_vector_table_set (uint32_t base, uint32_t offset)
set the vector table location and offset.
void | nvic_lowpower_mode_config (nvic_lowpower_mode_type lp_mode, confirm_state new_state)
config nvic lowpower mode
void | systick_clock_source_config (systick_clock_source_type source)
config systick clock source

Detailed Description

at32f413 misc header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_misc.h.


AT32F413 Firmwary Library: at32f413_pwc.h File Reference

  • libraries
  • drivers
  • inc
Data Structures | Macros | Enumerations | Functions
at32f413_pwc.h File Reference

at32f413 pwc header file More...

#include "at32f413.h"

Go to the source code of this file.

Data Structures

struct pwc_type
type define pwc register all More...

Macros

#define | PWC_WAKEUP_FLAG ((uint32_t)0x00000001)
#define | PWC_STANDBY_FLAG ((uint32_t)0x00000002)
#define | PWC_PVM_OUTPUT_FLAG ((uint32_t)0x00000004)
#define | PWC_WAKEUP_PIN_1 ((uint32_t)0x00000100)
pwc wakeup pin num definition
#define | PWC ((pwc_type *) PWC_BASE)

Enumerations

enum pwc_pvm_voltage_type {
PWC_PVM_VOLTAGE_2V3 = 0x01 , PWC_PVM_VOLTAGE_2V4 = 0x02 , PWC_PVM_VOLTAGE_2V5 = 0x03 , PWC_PVM_VOLTAGE_2V6 = 0x04 ,
PWC_PVM_VOLTAGE_2V7 = 0x05 , PWC_PVM_VOLTAGE_2V8 = 0x06 , PWC_PVM_VOLTAGE_2V9 = 0x07
}
pwc pvm voltage type More...
enum | pwc_sleep_enter_type { PWC_SLEEP_ENTER_WFI = 0x00 , PWC_SLEEP_ENTER_WFE = 0x01 }
pwc sleep enter type More...
enum | pwc_deep_sleep_enter_type { PWC_DEEP_SLEEP_ENTER_WFI = 0x00 , PWC_DEEP_SLEEP_ENTER_WFE = 0x01 }
pwc deep sleep enter type More...

Functions

void | pwc_reset (void)
deinitialize the pwc peripheral registers to their default reset values.
void | pwc_battery_powered_domain_access (confirm_state new_state)
enable or disable access to the battery powered domain.
void | pwc_pvm_level_select (pwc_pvm_voltage_type pvm_voltage)
select the voltage threshold detected by the power voltage detector.
void | pwc_power_voltage_monitor_enable (confirm_state new_state)
enable or disable pwc power voltage monitor (pvm)
void | pwc_wakeup_pin_enable (uint32_t pin_num, confirm_state new_state)
enable or disable pwc standby wakeup pin
void | pwc_flag_clear (uint32_t pwc_flag)
clear flag of pwc
flag_status | pwc_flag_get (uint32_t pwc_flag)
get flag of pwc
void | pwc_sleep_mode_enter (pwc_sleep_enter_type pwc_sleep_enter)
enter pwc sleep mode
void | pwc_deep_sleep_mode_enter (pwc_deep_sleep_enter_type pwc_deep_sleep_enter)
enter pwc deep-sleep mode
void | pwc_standby_mode_enter (void)
enter pwc standby mode

Detailed Description

at32f413 pwc header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_pwc.h.


AT32F413 Firmwary Library: at32f413_rtc.h File Reference

  • libraries
  • drivers
  • inc
Data Structures | Macros | Functions
at32f413_rtc.h File Reference

at32f413 rtc header file More...

#include "at32f413.h"

Go to the source code of this file.

Data Structures

struct rtc_type
type define rtc register all More...

Macros

#define | RTC_TS_INT ((uint16_t)0x0001)
#define | RTC_TA_INT ((uint16_t)0x0002)
#define | RTC_OVF_INT ((uint16_t)0x0004)
#define | RTC_TS_FLAG ((uint16_t)0x0001)
#define | RTC_TA_FLAG ((uint16_t)0x0002)
#define | RTC_OVF_FLAG ((uint16_t)0x0004)
#define | RTC_UPDF_FLAG ((uint16_t)0x0008)
#define | RTC_CFGF_FLAG ((uint16_t)0x0020)
#define | RTC ((rtc_type *) RTC_BASE)

Functions

void | rtc_counter_set (uint32_t counter_value)
rtc counter set
uint32_t | rtc_counter_get (void)
rtc counter get
void | rtc_divider_set (uint32_t div_value)
rtc divider set
uint32_t | rtc_divider_get (void)
rtc divider get
void | rtc_alarm_set (uint32_t alarm_value)
rtc alarm value set
void | rtc_interrupt_enable (uint16_t source, confirm_state new_state)
rtc interrupt enable
flag_status | rtc_flag_get (uint16_t flag)
rtc flag get
flag_status | rtc_interrupt_flag_get (uint16_t flag)
rtc interrupt flag get
void | rtc_flag_clear (uint16_t flag)
rtc flag clear
void | rtc_wait_config_finish (void)
rtc wait configuration finish
void | rtc_wait_update_finish (void)
rtc wait update finish

Detailed Description

at32f413 rtc header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_rtc.h.


AT32F413 Firmwary Library: at32f413_sdio.h File Reference

  • libraries
  • drivers
  • inc
Data Structures | Macros | Enumerations | Functions
at32f413_sdio.h File Reference

at32f413 sdio header file More...

#include "at32f413.h"

Go to the source code of this file.

Data Structures

struct | sdio_command_struct_type
sdio command structure More...
struct | sdio_data_struct_type
sdio data structure More...
struct | sdio_type
type define sdio register all More...

Macros

#define | SDIO_CMDFAIL_INT ((uint32_t)0x00000001)
#define | SDIO_DTFAIL_INT ((uint32_t)0x00000002)
#define | SDIO_CMDTIMEOUT_INT ((uint32_t)0x00000004)
#define | SDIO_DTTIMEOUT_INT ((uint32_t)0x00000008)
#define | SDIO_TXERRU_INT ((uint32_t)0x00000010)
#define | SDIO_RXERRO_INT ((uint32_t)0x00000020)
#define | SDIO_CMDRSPCMPL_INT ((uint32_t)0x00000040)
#define | SDIO_CMDCMPL_INT ((uint32_t)0x00000080)
#define | SDIO_DTCMP_INT ((uint32_t)0x00000100)
#define | SDIO_SBITERR_INT ((uint32_t)0x00000200)
#define | SDIO_DTBLKCMPL_INT ((uint32_t)0x00000400)
#define | SDIO_DOCMD_INT ((uint32_t)0x00000800)
#define | SDIO_DOTX_INT ((uint32_t)0x00001000)
#define | SDIO_DORX_INT ((uint32_t)0x00002000)
#define | SDIO_TXBUFH_INT ((uint32_t)0x00004000)
#define | SDIO_RXBUFH_INT ((uint32_t)0x00008000)
#define | SDIO_TXBUFF_INT ((uint32_t)0x00010000)
#define | SDIO_RXBUFF_INT ((uint32_t)0x00020000)
#define | SDIO_TXBUFE_INT ((uint32_t)0x00040000)
#define | SDIO_RXBUFE_INT ((uint32_t)0x00080000)
#define | SDIO_TXBUF_INT ((uint32_t)0x00100000)
#define | SDIO_RXBUF_INT ((uint32_t)0x00200000)
#define | SDIO_SDIOIF_INT ((uint32_t)0x00400000)
#define | SDIO_CMDFAIL_FLAG ((uint32_t)0x00000001)
#define | SDIO_DTFAIL_FLAG ((uint32_t)0x00000002)
#define | SDIO_CMDTIMEOUT_FLAG ((uint32_t)0x00000004)
#define | SDIO_DTTIMEOUT_FLAG ((uint32_t)0x00000008)
#define | SDIO_TXERRU_FLAG ((uint32_t)0x00000010)
#define | SDIO_RXERRO_FLAG ((uint32_t)0x00000020)
#define | SDIO_CMDRSPCMPL_FLAG ((uint32_t)0x00000040)
#define | SDIO_CMDCMPL_FLAG ((uint32_t)0x00000080)
#define | SDIO_DTCMPL_FLAG ((uint32_t)0x00000100)
#define | SDIO_SBITERR_FLAG ((uint32_t)0x00000200)
#define | SDIO_DTBLKCMPL_FLAG ((uint32_t)0x00000400)
#define | SDIO_DOCMD_FLAG ((uint32_t)0x00000800)
#define | SDIO_DOTX_FLAG ((uint32_t)0x00001000)
#define | SDIO_DORX_FLAG ((uint32_t)0x00002000)
#define | SDIO_TXBUFH_FLAG ((uint32_t)0x00004000)
#define | SDIO_RXBUFH_FLAG ((uint32_t)0x00008000)
#define | SDIO_TXBUFF_FLAG ((uint32_t)0x00010000)
#define | SDIO_RXBUFF_FLAG ((uint32_t)0x00020000)
#define | SDIO_TXBUFE_FLAG ((uint32_t)0x00040000)
#define | SDIO_RXBUFE_FLAG ((uint32_t)0x00080000)
#define | SDIO_TXBUF_FLAG ((uint32_t)0x00100000)
#define | SDIO_RXBUF_FLAG ((uint32_t)0x00200000)
#define | SDIO_SDIOIF_FLAG ((uint32_t)0x00400000)

Enumerations

enum | sdio_power_state_type { SDIO_POWER_OFF = 0x00 , SDIO_POWER_ON = 0x03 }
sdio power state More...
enum | sdio_edge_phase_type { SDIO_CLOCK_EDGE_RISING = 0x00 , SDIO_CLOCK_EDGE_FALLING = 0x01 }
sdio edge phase More...
enum | sdio_bus_width_type { SDIO_BUS_WIDTH_D1 = 0x00 , SDIO_BUS_WIDTH_D4 = 0x01 , SDIO_BUS_WIDTH_D8 = 0x02 }
sdio bus width More...
enum | sdio_reponse_type { SDIO_RESPONSE_NO = 0x00 , SDIO_RESPONSE_SHORT = 0x01 , SDIO_RESPONSE_LONG = 0x03 }
sdio response type More...
enum | sdio_wait_type { SDIO_WAIT_FOR_NO = 0x00 , SDIO_WAIT_FOR_INT = 0x01 , SDIO_WAIT_FOR_PEND = 0x02 }
sdio wait type More...
enum | sdio_rsp_index_type { SDIO_RSP1_INDEX = 0x00 , SDIO_RSP2_INDEX = 0x01 , SDIO_RSP3_INDEX = 0x02 , SDIO_RSP4_INDEX = 0x03 }
sdio response register index More...
enum sdio_block_size_type {
SDIO_DATA_BLOCK_SIZE_1B = 0x00 , SDIO_DATA_BLOCK_SIZE_2B = 0x01 , SDIO_DATA_BLOCK_SIZE_4B = 0x02 , SDIO_DATA_BLOCK_SIZE_8B = 0x03 ,
SDIO_DATA_BLOCK_SIZE_16B = 0x04 , SDIO_DATA_BLOCK_SIZE_32B = 0x05 , SDIO_DATA_BLOCK_SIZE_64B = 0x06 , SDIO_DATA_BLOCK_SIZE_128B = 0x07 ,
SDIO_DATA_BLOCK_SIZE_256B = 0x08 , SDIO_DATA_BLOCK_SIZE_512B = 0x09 , SDIO_DATA_BLOCK_SIZE_1024B = 0x0A , SDIO_DATA_BLOCK_SIZE_2048B = 0x0B ,
SDIO_DATA_BLOCK_SIZE_4096B = 0x0C , SDIO_DATA_BLOCK_SIZE_8192B = 0x0D , SDIO_DATA_BLOCK_SIZE_16384B = 0x0E
}
sdio data block size More...
enum | sdio_transfer_mode_type { SDIO_DATA_BLOCK_TRANSFER = 0x00 , SDIO_DATA_STREAM_TRANSFER = 0x01 }
sdio data transfer mode More...
enum | sdio_transfer_direction_type { SDIO_DATA_TRANSFER_TO_CARD = 0x00 , SDIO_DATA_TRANSFER_TO_CONTROLLER = 0x01 }
sdio data transfer direction More...
enum | sdio_read_wait_mode_type { SDIO_READ_WAIT_CONTROLLED_BY_D2 = 0x00 , SDIO_READ_WAIT_CONTROLLED_BY_CK = 0x01 }
sdio read wait mode More...

Functions

void | sdio_reset (sdio_type *sdio_x)
reset the sdio register
void | sdio_power_set (sdio_type *sdio_x, sdio_power_state_type power_state)
set the power status of the controller
sdio_power_state_type | sdio_power_status_get (sdio_type *sdio_x)
get power status.
void | sdio_clock_config (sdio_type *sdio_x, uint16_t clk_div, sdio_edge_phase_type clk_edg)
config sdio clock
void | sdio_bus_width_config (sdio_type *sdio_x, sdio_bus_width_type width)
config sdio bus width
void | sdio_clock_bypass (sdio_type *sdio_x, confirm_state new_state)
enable or disable clock divider bypss
void | sdio_power_saving_mode_enable (sdio_type *sdio_x, confirm_state new_state)
enable or disable power saving mode, config sdio_ck clock output when the bus is idle.
void | sdio_flow_control_enable (sdio_type *sdio_x, confirm_state new_state)
enable or disable hardware flow control.
void | sdio_clock_enable (sdio_type *sdio_x, confirm_state new_state)
enable or disable sdio_ck output.
void | sdio_dma_enable (sdio_type *sdio_x, confirm_state new_state)
enable or disable dma.
void | sdio_interrupt_enable (sdio_type *sdio_x, uint32_t int_opt, confirm_state new_state)
config corresponding interrupt.
flag_status | sdio_flag_get (sdio_type *sdio_x, uint32_t flag)
get sdio flag.
flag_status | sdio_interrupt_flag_get (sdio_type *sdio_x, uint32_t flag)
get sdio interrupt flag.
void | sdio_flag_clear (sdio_type *sdio_x, uint32_t flag)
clear sdio flag.
void | sdio_command_config (sdio_type *sdio_x, sdio_command_struct_type *command_struct)
config sdio command.
void | sdio_command_state_machine_enable (sdio_type *sdio_x, confirm_state new_state)
enable or disable command path state machine(CPSM).
uint8_t | sdio_command_response_get (sdio_type *sdio_x)
get command index of last command for which response received.
uint32_t | sdio_response_get (sdio_type *sdio_x, sdio_rsp_index_type reg_index)
get response received from the card for the last command.
void | sdio_data_config (sdio_type *sdio_x, sdio_data_struct_type *data_struct)
config sdio data.
void | sdio_data_state_machine_enable (sdio_type *sdio_x, confirm_state new_state)
enable or disable data path state machine(DPSM).
uint32_t | sdio_data_counter_get (sdio_type *sdio_x)
get the number of remaining data bytes to be transferred.
uint32_t | sdio_data_read (sdio_type *sdio_x)
read a word data from sdio fifo.
uint32_t | sdio_buffer_counter_get (sdio_type *sdio_x)
get the number of words left to be written to or read from fifo..
void | sdio_data_write (sdio_type *sdio_x, uint32_t data)
write one word data to fifo.
void | sdio_read_wait_mode_set (sdio_type *sdio_x, sdio_read_wait_mode_type mode)
set the read wait mode.
void | sdio_read_wait_start (sdio_type *sdio_x, confirm_state new_state)
enable or disable to start sd i/o read wait operation.
void | sdio_read_wait_stop (sdio_type *sdio_x, confirm_state new_state)
enable or disable to stop sd i/o read wait operation.
void | sdio_io_function_enable (sdio_type *sdio_x, confirm_state new_state)
enable or disable the sd i/o function.
void | sdio_io_suspend_command_set (sdio_type *sdio_x, confirm_state new_state)
enable or disable sd i/o suspend command sending.

Detailed Description

at32f413 sdio header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_sdio.h.


AT32F413 Firmwary Library: at32f413_spi.h File Reference

  • libraries
  • drivers
  • inc
Data Structures | Macros | Enumerations | Functions
at32f413_spi.h File Reference

at32f413 spi header file More...

#include "at32f413.h"

Go to the source code of this file.

Data Structures

struct | spi_init_type
spi init type More...
struct | i2s_init_type
i2s init type More...
struct | spi_type
type define spi register all More...

Macros

#define | SPI_I2S_RDBF_FLAG 0x0001
#define | SPI_I2S_TDBE_FLAG 0x0002
#define | I2S_ACS_FLAG 0x0004
#define | I2S_TUERR_FLAG 0x0008
#define | SPI_CCERR_FLAG 0x0010
#define | SPI_MMERR_FLAG 0x0020
#define | SPI_I2S_ROERR_FLAG 0x0040
#define | SPI_I2S_BF_FLAG 0x0080
#define | SPI_I2S_ERROR_INT 0x0020
#define | SPI_I2S_RDBF_INT 0x0040
#define | SPI_I2S_TDBE_INT 0x0080
#define | SPI1 ((spi_type *) SPI1_BASE)
#define | SPI2 ((spi_type *) SPI2_BASE)

Enumerations

enum | spi_frame_bit_num_type { SPI_FRAME_8BIT = 0x00 , SPI_FRAME_16BIT = 0x01 }
spi frame bit num type More...
enum | spi_master_slave_mode_type { SPI_MODE_SLAVE = 0x00 , SPI_MODE_MASTER = 0x01 }
spi master/slave mode type More...
enum | spi_clock_polarity_type { SPI_CLOCK_POLARITY_LOW = 0x00 , SPI_CLOCK_POLARITY_HIGH = 0x01 }
spi clock polarity (clkpol) type More...
enum | spi_clock_phase_type { SPI_CLOCK_PHASE_1EDGE = 0x00 , SPI_CLOCK_PHASE_2EDGE = 0x01 }
spi clock phase (clkpha) type More...
enum | spi_cs_mode_type { SPI_CS_HARDWARE_MODE = 0x00 , SPI_CS_SOFTWARE_MODE = 0x01 }
spi cs mode type More...
enum spi_mclk_freq_div_type {
SPI_MCLK_DIV_2 = 0x00 , SPI_MCLK_DIV_4 = 0x01 , SPI_MCLK_DIV_8 = 0x02 , SPI_MCLK_DIV_16 = 0x03 ,
SPI_MCLK_DIV_32 = 0x04 , SPI_MCLK_DIV_64 = 0x05 , SPI_MCLK_DIV_128 = 0x06 , SPI_MCLK_DIV_256 = 0x07 ,
SPI_MCLK_DIV_512 = 0x08 , SPI_MCLK_DIV_1024 = 0x09
}
spi master clock frequency division type More...
enum | spi_first_bit_type { SPI_FIRST_BIT_MSB = 0x00 , SPI_FIRST_BIT_LSB = 0x01 }
spi transmit first bit (lsb/msb) type More...
enum | spi_transmission_mode_type { SPI_TRANSMIT_FULL_DUPLEX = 0x00 , SPI_TRANSMIT_SIMPLEX_RX = 0x01 , SPI_TRANSMIT_HALF_DUPLEX_RX = 0x02 , SPI_TRANSMIT_HALF_DUPLEX_TX = 0x03 }
spi transmission mode type More...
enum | spi_crc_direction_type { SPI_CRC_RX = 0x0014 , SPI_CRC_TX = 0x0018 }
spi crc direction type More...
enum | spi_half_duplex_direction_type { SPI_HALF_DUPLEX_DIRECTION_RX = 0x00 , SPI_HALF_DUPLEX_DIRECTION_TX = 0x01 }
spi single line bidirectional direction type More...
enum | spi_software_cs_level_type { SPI_SWCS_INTERNAL_LEVEL_LOW = 0x00 , SPI_SWCS_INTERNAL_LEVEL_HIGHT = 0x01 }
spi software cs internal level type More...
enum i2s_audio_protocol_type {
I2S_AUDIO_PROTOCOL_PHILLIPS = 0x00 , I2S_AUDIO_PROTOCOL_MSB = 0x01 , I2S_AUDIO_PROTOCOL_LSB = 0x02 , I2S_AUDIO_PROTOCOL_PCM_SHORT = 0x03 ,
I2S_AUDIO_PROTOCOL_PCM_LONG = 0x04
}
i2s audio protocol type More...
enum i2s_audio_sampling_freq_type {
I2S_AUDIO_FREQUENCY_DEFAULT = 2 , I2S_AUDIO_FREQUENCY_8K = 8000 , I2S_AUDIO_FREQUENCY_11_025K = 11025 , I2S_AUDIO_FREQUENCY_16K = 16000 ,
I2S_AUDIO_FREQUENCY_22_05K = 22050 , I2S_AUDIO_FREQUENCY_32K = 32000 , I2S_AUDIO_FREQUENCY_44_1K = 44100 , I2S_AUDIO_FREQUENCY_48K = 48000 ,
I2S_AUDIO_FREQUENCY_96K = 96000 , I2S_AUDIO_FREQUENCY_192K = 192000
}
i2s audio frequency type More...
enum | i2s_data_channel_format_type { I2S_DATA_16BIT_CHANNEL_16BIT = 0x01 , I2S_DATA_16BIT_CHANNEL_32BIT = 0x02 , I2S_DATA_24BIT_CHANNEL_32BIT = 0x03 , I2S_DATA_32BIT_CHANNEL_32BIT = 0x04 }
i2s data bit num and channel bit num type More...
enum | i2s_operation_mode_type { I2S_MODE_SLAVE_TX = 0x00 , I2S_MODE_SLAVE_RX = 0x01 , I2S_MODE_MASTER_TX = 0x02 , I2S_MODE_MASTER_RX = 0x03 }
i2s operation mode type More...
enum | i2s_clock_polarity_type { I2S_CLOCK_POLARITY_LOW = 0x00 , I2S_CLOCK_POLARITY_HIGH = 0x01 }
i2s clock polarity type More...

Functions

void | spi_i2s_reset (spi_type *spi_x)
spi reset by crm reset register
void | spi_default_para_init (spi_init_type *spi_init_struct)
spi init config with its default value.
void | spi_init (spi_type *spi_x, spi_init_type *spi_init_struct)
spi init config with its setting value.
void | spi_crc_next_transmit (spi_type *spi_x)
spi next transmit crc for the spi peripheral.
void | spi_crc_polynomial_set (spi_type *spi_x, uint16_t crc_poly)
set the crc polynomial value for the spi peripheral.
uint16_t | spi_crc_polynomial_get (spi_type *spi_x)
return the crc polynomial register value for the spi peripheral.
void | spi_crc_enable (spi_type *spi_x, confirm_state new_state)
enable or disable the hardware crc calculation for the spi peripheral.
uint16_t | spi_crc_value_get (spi_type *spi_x, spi_crc_direction_type crc_direction)
return the transmit or the receive crc value for the spi peripheral.
void | spi_hardware_cs_output_enable (spi_type *spi_x, confirm_state new_state)
enable or disable the hardware cs output for the spi peripheral.
void | spi_software_cs_internal_level_set (spi_type *spi_x, spi_software_cs_level_type level)
set the software cs internal level for the spi peripheral.
void | spi_frame_bit_num_set (spi_type *spi_x, spi_frame_bit_num_type bit_num)
set the data frame bit num for the spi peripheral.
void | spi_half_duplex_direction_set (spi_type *spi_x, spi_half_duplex_direction_type direction)
set the data transmission direction in single line bidirectiona half duplex mode of the spi peripheral.
void | spi_enable (spi_type *spi_x, confirm_state new_state)
enable or disable spi.
void | i2s_default_para_init (i2s_init_type *i2s_init_struct)
i2s init config with its default value.
void | i2s_init (spi_type *spi_x, i2s_init_type *i2s_init_struct)
i2s init config with its setting value.
void | i2s_enable (spi_type *spi_x, confirm_state new_state)
enable or disable i2s.
void | spi_i2s_interrupt_enable (spi_type *spi_x, uint32_t spi_i2s_int, confirm_state new_state)
enable or disable the specified spi/i2s interrupts.
void | spi_i2s_dma_transmitter_enable (spi_type *spi_x, confirm_state new_state)
enable or disable the spi/i2s dma transmitter mode.
void | spi_i2s_dma_receiver_enable (spi_type *spi_x, confirm_state new_state)
enable or disable the spi/i2s dma receiver mode.
void | spi_i2s_data_transmit (spi_type *spi_x, uint16_t tx_data)
spi/i2s data transmit
uint16_t | spi_i2s_data_receive (spi_type *spi_x)
spi/i2s data receive
flag_status | spi_i2s_flag_get (spi_type *spi_x, uint32_t spi_i2s_flag)
get flag of the specified spi/i2s peripheral.
flag_status | spi_i2s_interrupt_flag_get (spi_type *spi_x, uint32_t spi_i2s_flag)
get interrupt flag of the specified spi/i2s peripheral.
void | spi_i2s_flag_clear (spi_type *spi_x, uint32_t spi_i2s_flag)
clear flag of the specified spi/i2s peripheral.

Detailed Description

at32f413 spi header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_spi.h.


AT32F413 Firmwary Library: at32f413_tmr.h File Reference

  • libraries
  • drivers
  • inc
Data Structures | Macros | Enumerations | Functions
at32f413_tmr.h File Reference

at32f413 tmr header file More...

#include "at32f413.h"

Go to the source code of this file.

Data Structures

struct | tmr_output_config_type
tmr output config type More...
struct | tmr_input_config_type
tmr input capture config type More...
struct | tmr_brkdt_config_type
tmr brkdt config type More...
struct | tmr_type
type define tmr register all More...

Macros

#define | TMR_OVF_FLAG ((uint32_t)0x000001)
#define | TMR_C1_FLAG ((uint32_t)0x000002)
#define | TMR_C2_FLAG ((uint32_t)0x000004)
#define | TMR_C3_FLAG ((uint32_t)0x000008)
#define | TMR_C4_FLAG ((uint32_t)0x000010)
#define | TMR_HALL_FLAG ((uint32_t)0x000020)
#define | TMR_TRIGGER_FLAG ((uint32_t)0x000040)
#define | TMR_BRK_FLAG ((uint32_t)0x000080)
#define | TMR_C1_RECAPTURE_FLAG ((uint32_t)0x000200)
#define | TMR_C2_RECAPTURE_FLAG ((uint32_t)0x000400)
#define | TMR_C3_RECAPTURE_FLAG ((uint32_t)0x000800)
#define | TMR_C4_RECAPTURE_FLAG ((uint32_t)0x001000)
#define | TMR_OVF_INT ((uint32_t)0x000001)
#define | TMR_C1_INT ((uint32_t)0x000002)
#define | TMR_C2_INT ((uint32_t)0x000004)
#define | TMR_C3_INT ((uint32_t)0x000008)
#define | TMR_C4_INT ((uint32_t)0x000010)
#define | TMR_HALL_INT ((uint32_t)0x000020)
#define | TMR_TRIGGER_INT ((uint32_t)0x000040)
#define | TMR_BRK_INT ((uint32_t)0x000080)
#define | TMR1 ((tmr_type *) TMR1_BASE)
#define | TMR2 ((tmr_type *) TMR2_BASE)
#define | TMR3 ((tmr_type *) TMR3_BASE)
#define | TMR4 ((tmr_type *) TMR4_BASE)

Enumerations

enum | tmr_clock_division_type { TMR_CLOCK_DIV1 = 0x00 , TMR_CLOCK_DIV2 = 0x01 , TMR_CLOCK_DIV4 = 0x02 }
tmr clock division type More...
enum tmr_count_mode_type {
TMR_COUNT_UP = 0x00 , TMR_COUNT_DOWN = 0x01 , TMR_COUNT_TWO_WAY_1 = 0x02 , TMR_COUNT_TWO_WAY_2 = 0x04 ,
TMR_COUNT_TWO_WAY_3 = 0x06
}
tmr counter mode type More...
enum tmr_primary_select_type {
TMR_PRIMARY_SEL_RESET = 0x00 , TMR_PRIMARY_SEL_ENABLE = 0x01 , TMR_PRIMARY_SEL_OVERFLOW = 0x02 , TMR_PRIMARY_SEL_COMPARE = 0x03 ,
TMR_PRIMARY_SEL_C1ORAW = 0x04 , TMR_PRIMARY_SEL_C2ORAW = 0x05 , TMR_PRIMARY_SEL_C3ORAW = 0x06 , TMR_PRIMARY_SEL_C4ORAW = 0x07
}
tmr primary mode select type More...
enum sub_tmr_input_sel_type {
TMR_SUB_INPUT_SEL_IS0 = 0x00 , TMR_SUB_INPUT_SEL_IS1 = 0x01 , TMR_SUB_INPUT_SEL_IS2 = 0x02 , TMR_SUB_INPUT_SEL_IS3 = 0x03 ,
TMR_SUB_INPUT_SEL_C1INC = 0x04 , TMR_SUB_INPUT_SEL_C1DF1 = 0x05 , TMR_SUB_INPUT_SEL_C2DF2 = 0x06 , TMR_SUB_INPUT_SEL_EXTIN = 0x07
}
tmr subordinate mode input select type More...
enum tmr_sub_mode_select_type {
TMR_SUB_MODE_DIABLE = 0x00 , TMR_SUB_ENCODER_MODE_A = 0x01 , TMR_SUB_ENCODER_MODE_B = 0x02 , TMR_SUB_ENCODER_MODE_C = 0x03 ,
TMR_SUB_RESET_MODE = 0x04 , TMR_SUB_HANG_MODE = 0x05 , TMR_SUB_TRIGGER_MODE = 0x06 , TMR_SUB_EXTERNAL_CLOCK_MODE_A = 0x07
}
tmr subordinate mode select type More...
enum | tmr_encoder_mode_type { TMR_ENCODER_MODE_A = TMR_SUB_ENCODER_MODE_A , TMR_ENCODER_MODE_B = TMR_SUB_ENCODER_MODE_B , TMR_ENCODER_MODE_C = TMR_SUB_ENCODER_MODE_C }
tmr encoder mode type More...
enum tmr_output_control_mode_type {
TMR_OUTPUT_CONTROL_OFF = 0x00 , TMR_OUTPUT_CONTROL_HIGH = 0x01 , TMR_OUTPUT_CONTROL_LOW = 0x02 , TMR_OUTPUT_CONTROL_SWITCH = 0x03 ,
TMR_OUTPUT_CONTROL_FORCE_LOW = 0x04 , TMR_OUTPUT_CONTROL_FORCE_HIGH = 0x05 , TMR_OUTPUT_CONTROL_PWM_MODE_A = 0x06 , TMR_OUTPUT_CONTROL_PWM_MODE_B = 0x07
}
tmr output control mode type More...
enum | tmr_force_output_type { TMR_FORCE_OUTPUT_HIGH = TMR_OUTPUT_CONTROL_FORCE_HIGH , TMR_FORCE_OUTPUT_LOW = TMR_OUTPUT_CONTROL_FORCE_LOW }
tmr force output type More...
enum | tmr_output_polarity_type { TMR_OUTPUT_ACTIVE_HIGH = 0x00 , TMR_OUTPUT_ACTIVE_LOW = 0x01 }
tmr output channel polarity type More...
enum | tmr_input_polarity_type { TMR_INPUT_RISING_EDGE = 0x00 , TMR_INPUT_FALLING_EDGE = 0x01 , TMR_INPUT_BOTH_EDGE = 0x03 }
tmr input channel polarity type More...
enum tmr_channel_select_type {
TMR_SELECT_CHANNEL_1 = 0x00 , TMR_SELECT_CHANNEL_1C = 0x01 , TMR_SELECT_CHANNEL_2 = 0x02 , TMR_SELECT_CHANNEL_2C = 0x03 ,
TMR_SELECT_CHANNEL_3 = 0x04 , TMR_SELECT_CHANNEL_3C = 0x05 , TMR_SELECT_CHANNEL_4 = 0x06
}
tmr channel select type More...
enum | tmr_channel1_input_connected_type { TMR_CHANEL1_CONNECTED_C1IRAW = 0x00 , TMR_CHANEL1_2_3_CONNECTED_C1IRAW_XOR = 0x01 }
tmr channel1 input connected type More...
enum | tmr_input_direction_mapped_type { TMR_CC_CHANNEL_MAPPED_DIRECT = 0x01 , TMR_CC_CHANNEL_MAPPED_INDIRECT = 0x02 , TMR_CC_CHANNEL_MAPPED_STI = 0x03 }
tmr input channel mapped type channel direction More...
enum | tmr_channel_input_divider_type { TMR_CHANNEL_INPUT_DIV_1 = 0x00 , TMR_CHANNEL_INPUT_DIV_2 = 0x01 , TMR_CHANNEL_INPUT_DIV_4 = 0x02 , TMR_CHANNEL_INPUT_DIV_8 = 0x03 }
tmr input divider type More...
enum | tmr_dma_request_source_type { TMR_DMA_REQUEST_BY_CHANNEL = 0x00 , TMR_DMA_REQUEST_BY_OVERFLOW = 0x01 }
tmr dma request source select type More...
enum tmr_dma_request_type {
TMR_OVERFLOW_DMA_REQUEST = 0x00000100 , TMR_C1_DMA_REQUEST = 0x00000200 , TMR_C2_DMA_REQUEST = 0x00000400 , TMR_C3_DMA_REQUEST = 0x00000800 ,
TMR_C4_DMA_REQUEST = 0x00001000 , TMR_HALL_DMA_REQUEST = 0x00002000 , TMR_TRIGGER_DMA_REQUEST = 0x00004000
}
tmr dma request type More...
enum tmr_event_trigger_type {
TMR_OVERFLOW_SWTRIG = 0x00000001 , TMR_C1_SWTRIG = 0x00000002 , TMR_C2_SWTRIG = 0x00000004 , TMR_C3_SWTRIG = 0x00000008 ,
TMR_C4_SWTRIG = 0x00000010 , TMR_HALL_SWTRIG = 0x00000020 , TMR_TRIGGER_SWTRIG = 0x00000040 , TMR_BRK_SWTRIG = 0x00000080
}
tmr event triggered by software type More...
enum | tmr_polarity_active_type { TMR_POLARITY_ACTIVE_HIGH = 0x00 , TMR_POLARITY_ACTIVE_LOW = 0x01 , TMR_POLARITY_ACTIVE_BOTH = 0x02 }
tmr polarity active type More...
enum | tmr_external_signal_divider_type { TMR_ES_FREQUENCY_DIV_1 = 0x00 , TMR_ES_FREQUENCY_DIV_2 = 0x01 , TMR_ES_FREQUENCY_DIV_4 = 0x02 , TMR_ES_FREQUENCY_DIV_8 = 0x03 }
tmr external signal divider type More...
enum | tmr_external_signal_polarity_type { TMR_ES_POLARITY_NON_INVERTED = 0x00 , TMR_ES_POLARITY_INVERTED = 0x01 }
tmr external signal polarity type More...
enum tmr_dma_transfer_length_type {
TMR_DMA_TRANSFER_1BYTE = 0x00 , TMR_DMA_TRANSFER_2BYTES = 0x01 , TMR_DMA_TRANSFER_3BYTES = 0x02 , TMR_DMA_TRANSFER_4BYTES = 0x03 ,
TMR_DMA_TRANSFER_5BYTES = 0x04 , TMR_DMA_TRANSFER_6BYTES = 0x05 , TMR_DMA_TRANSFER_7BYTES = 0x06 , TMR_DMA_TRANSFER_8BYTES = 0x07 ,
TMR_DMA_TRANSFER_9BYTES = 0x08 , TMR_DMA_TRANSFER_10BYTES = 0x09 , TMR_DMA_TRANSFER_11BYTES = 0x0A , TMR_DMA_TRANSFER_12BYTES = 0x0B ,
TMR_DMA_TRANSFER_13BYTES = 0x0C , TMR_DMA_TRANSFER_14BYTES = 0x0D , TMR_DMA_TRANSFER_15BYTES = 0x0E , TMR_DMA_TRANSFER_16BYTES = 0x0F ,
TMR_DMA_TRANSFER_17BYTES = 0x10 , TMR_DMA_TRANSFER_18BYTES = 0x11
}
tmr dma transfer length type More...
enum tmr_dma_address_type {
TMR_CTRL1_ADDRESS = 0x0000 , TMR_CTRL2_ADDRESS = 0x0001 , TMR_STCTRL_ADDRESS = 0x0002 , TMR_IDEN_ADDRESS = 0x0003 ,
TMR_ISTS_ADDRESS = 0x0004 , TMR_SWEVT_ADDRESS = 0x0005 , TMR_CM1_ADDRESS = 0x0006 , TMR_CM2_ADDRESS = 0x0007 ,
TMR_CCTRL_ADDRESS = 0x0008 , TMR_CVAL_ADDRESS = 0x0009 , TMR_DIV_ADDRESS = 0x000A , TMR_PR_ADDRESS = 0x000B ,
TMR_RPR_ADDRESS = 0x000C , TMR_C1DT_ADDRESS = 0x000D , TMR_C2DT_ADDRESS = 0x000E , TMR_C3DT_ADDRESS = 0x000F ,
TMR_C4DT_ADDRESS = 0x0010 , TMR_BRK_ADDRESS = 0x0011 , TMR_DMACTRL_ADDRESS = 0x0012
}
tmr dma base address type More...
enum | tmr_brk_polarity_type { TMR_BRK_INPUT_ACTIVE_LOW = 0x00 , TMR_BRK_INPUT_ACTIVE_HIGH = 0x01 }
tmr brk polarity type More...
enum | tmr_wp_level_type { TMR_WP_OFF = 0x00 , TMR_WP_LEVEL_3 = 0x01 , TMR_WP_LEVEL_2 = 0x02 , TMR_WP_LEVEL_1 = 0x03 }
tmr write protect level type More...

Functions

void | tmr_reset (tmr_type *tmr_x)
tmr reset by crm reset register
void | tmr_counter_enable (tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr counter
void | tmr_output_default_para_init (tmr_output_config_type *tmr_output_struct)
init tmr output default para
void | tmr_input_default_para_init (tmr_input_config_type *tmr_input_struct)
init tmr input default para
void | tmr_brkdt_default_para_init (tmr_brkdt_config_type *tmr_brkdt_struct)
init tmr brkdt default para
void | tmr_base_init (tmr_type *tmr_x, uint32_t tmr_pr, uint32_t tmr_div)
init tmr base
void | tmr_clock_source_div_set (tmr_type *tmr_x, tmr_clock_division_type tmr_clock_div)
set tmr clock source division
void | tmr_cnt_dir_set (tmr_type *tmr_x, tmr_count_mode_type tmr_cnt_dir)
set tmr counter count direction
void | tmr_repetition_counter_set (tmr_type *tmr_x, uint8_t tmr_rpr_value)
set the repetition counter register(rpr) value
void | tmr_counter_value_set (tmr_type *tmr_x, uint32_t tmr_cnt_value)
set tmr counter value
uint32_t | tmr_counter_value_get (tmr_type *tmr_x)
get tmr counter value
void | tmr_div_value_set (tmr_type *tmr_x, uint32_t tmr_div_value)
set tmr div value
uint32_t | tmr_div_value_get (tmr_type *tmr_x)
get tmr div value
void | tmr_output_channel_config (tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_output_config_type *tmr_output_struct)
config tmr output channel
void | tmr_output_channel_mode_select (tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_output_control_mode_type oc_mode)
select tmr output channel mode
void | tmr_period_value_set (tmr_type *tmr_x, uint32_t tmr_pr_value)
set tmr period value
uint32_t | tmr_period_value_get (tmr_type *tmr_x)
get tmr period value
void | tmr_channel_value_set (tmr_type *tmr_x, tmr_channel_select_type tmr_channel, uint32_t tmr_channel_value)
set tmr channel value
uint32_t | tmr_channel_value_get (tmr_type *tmr_x, tmr_channel_select_type tmr_channel)
get tmr channel value
void | tmr_period_buffer_enable (tmr_type *tmr_x, confirm_state new_state)
enable tmr period buffer
void | tmr_output_channel_buffer_enable (tmr_type *tmr_x, tmr_channel_select_type tmr_channel, confirm_state new_state)
enable tmr output channel buffer
void | tmr_output_channel_immediately_set (tmr_type *tmr_x, tmr_channel_select_type tmr_channel, confirm_state new_state)
set tmr output channel immediately
void | tmr_output_channel_switch_set (tmr_type *tmr_x, tmr_channel_select_type tmr_channel, confirm_state new_state)
set tmr output channel switch
void | tmr_one_cycle_mode_enable (tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr one cycle mode
void | tmr_32_bit_function_enable (tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr 32 bit function(plus mode)
void | tmr_overflow_request_source_set (tmr_type *tmr_x, confirm_state new_state)
select tmr the overflow event sources
void | tmr_overflow_event_disable (tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr overflow event generation
void | tmr_input_channel_init (tmr_type *tmr_x, tmr_input_config_type *input_struct, tmr_channel_input_divider_type divider_factor)
init tmr input channel
void | tmr_channel_enable (tmr_type *tmr_x, tmr_channel_select_type tmr_channel, confirm_state new_state)
tmr channel enable
void | tmr_input_channel_filter_set (tmr_type *tmr_x, tmr_channel_select_type tmr_channel, uint16_t filter_value)
set tmr input channel filter
void | tmr_pwm_input_config (tmr_type *tmr_x, tmr_input_config_type *input_struct, tmr_channel_input_divider_type divider_factor)
config tmr pwm input
void | tmr_channel1_input_select (tmr_type *tmr_x, tmr_channel1_input_connected_type ch1_connect)
select tmr channel1 input
void | tmr_input_channel_divider_set (tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_channel_input_divider_type divider_factor)
set tmr input channel divider
void | tmr_primary_mode_select (tmr_type *tmr_x, tmr_primary_select_type primary_mode)
select tmr primary mode
void | tmr_sub_mode_select (tmr_type *tmr_x, tmr_sub_mode_select_type sub_mode)
select tmr subordinate mode
void | tmr_channel_dma_select (tmr_type *tmr_x, tmr_dma_request_source_type cc_dma_select)
select tmr channel dma
void | tmr_hall_select (tmr_type *tmr_x, confirm_state new_state)
select tmr hall
void | tmr_channel_buffer_enable (tmr_type *tmr_x, confirm_state new_state)
enable tmr channel buffer
void | tmr_trigger_input_select (tmr_type *tmr_x, sub_tmr_input_sel_type trigger_select)
select tmr sub-trigger
void | tmr_sub_sync_mode_set (tmr_type *tmr_x, confirm_state new_state)
set tmr subordinate synchronization mode
void | tmr_dma_request_enable (tmr_type *tmr_x, tmr_dma_request_type dma_request, confirm_state new_state)
enable or disable tmr dma request
void | tmr_interrupt_enable (tmr_type *tmr_x, uint32_t tmr_interrupt, confirm_state new_state)
enable or disable tmr interrupt
flag_status | tmr_interrupt_flag_get (tmr_type *tmr_x, uint32_t tmr_flag)
get tmr interrupt flag
flag_status | tmr_flag_get (tmr_type *tmr_x, uint32_t tmr_flag)
get tmr flag
void | tmr_flag_clear (tmr_type *tmr_x, uint32_t tmr_flag)
clear tmr flag
void | tmr_event_sw_trigger (tmr_type *tmr_x, tmr_event_trigger_type tmr_event)
generate tmr event
void | tmr_output_enable (tmr_type *tmr_x, confirm_state new_state)
tmr output enable(oen),this function is important for advtm output enable
void | tmr_internal_clock_set (tmr_type *tmr_x)
set tmr select internal clock
void | tmr_output_channel_polarity_set (tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_polarity_active_type oc_polarity)
set tmr output channel polarity
void | tmr_external_clock_config (tmr_type *tmr_x, tmr_external_signal_divider_type es_divide, tmr_external_signal_polarity_type es_polarity, uint16_t es_filter)
config tmr external clock
void | tmr_external_clock_mode1_config (tmr_type *tmr_x, tmr_external_signal_divider_type es_divide, tmr_external_signal_polarity_type es_polarity, uint16_t es_filter)
config tmr external clock mode1
void | tmr_external_clock_mode2_config (tmr_type *tmr_x, tmr_external_signal_divider_type es_divide, tmr_external_signal_polarity_type es_polarity, uint16_t es_filter)
config tmr external clock mode2
void | tmr_encoder_mode_config (tmr_type *tmr_x, tmr_encoder_mode_type encoder_mode, tmr_input_polarity_type ic1_polarity, tmr_input_polarity_type ic2_polarity)
config tmr encoder mode
void | tmr_force_output_set (tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_force_output_type force_output)
set tmr force output
void | tmr_dma_control_config (tmr_type *tmr_x, tmr_dma_transfer_length_type dma_length, tmr_dma_address_type dma_base_address)
config tmr dma control
void | tmr_brkdt_config (tmr_type *tmr_x, tmr_brkdt_config_type *brkdt_struct)
config tmr brake mode and dead-time

Detailed Description

at32f413 tmr header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_tmr.h.


AT32F413 Firmwary Library: at32f413_usart.h File Reference

  • libraries
  • drivers
  • inc
Data Structures | Macros | Enumerations | Functions
at32f413_usart.h File Reference

at32f413 usart header file More...

#include "at32f413.h"

Go to the source code of this file.

Data Structures

struct usart_type
type define usart register all More...

Macros

#define | USART_PERR_FLAG ((uint32_t)0x00000001)
#define | USART_FERR_FLAG ((uint32_t)0x00000002)
#define | USART_NERR_FLAG ((uint32_t)0x00000004)
#define | USART_ROERR_FLAG ((uint32_t)0x00000008)
#define | USART_IDLEF_FLAG ((uint32_t)0x00000010)
#define | USART_RDBF_FLAG ((uint32_t)0x00000020)
#define | USART_TDC_FLAG ((uint32_t)0x00000040)
#define | USART_TDBE_FLAG ((uint32_t)0x00000080)
#define | USART_BFF_FLAG ((uint32_t)0x00000100)
#define | USART_CTSCF_FLAG ((uint32_t)0x00000200)
#define | USART_IDLE_INT MAKE_VALUE(0x0C,0x04)
#define | USART_RDBF_INT MAKE_VALUE(0x0C,0x05)
#define | USART_TDC_INT MAKE_VALUE(0x0C,0x06)
#define | USART_TDBE_INT MAKE_VALUE(0x0C,0x07)
#define | USART_PERR_INT MAKE_VALUE(0x0C,0x08)
#define | USART_BF_INT MAKE_VALUE(0x10,0x06)
#define | USART_ERR_INT MAKE_VALUE(0x14,0x00)
#define | USART_CTSCF_INT MAKE_VALUE(0x14,0x0A)
#define | USART1 ((usart_type *) USART1_BASE)
#define | USART2 ((usart_type *) USART2_BASE)

Enumerations

enum | usart_parity_selection_type { USART_PARITY_NONE = 0x00 , USART_PARITY_EVEN = 0x01 , USART_PARITY_ODD = 0x02 }
usart parity selection type More...
enum | usart_wakeup_mode_type { USART_WAKEUP_BY_IDLE_FRAME = 0x00 , USART_WAKEUP_BY_MATCHING_ID = 0x01 }
usart wakeup mode type More...
enum | usart_data_bit_num_type { USART_DATA_8BITS = 0x00 , USART_DATA_9BITS = 0x01 }
usart data bit num type More...
enum | usart_break_bit_num_type { USART_BREAK_10BITS = 0x00 , USART_BREAK_11BITS = 0x01 }
usart break frame bit num type More...
enum | usart_clock_phase_type { USART_CLOCK_PHASE_1EDGE = 0x00 , USART_CLOCK_PHASE_2EDGE = 0x01 }
usart phase of the clock type More...
enum | usart_clock_polarity_type { USART_CLOCK_POLARITY_LOW = 0x00 , USART_CLOCK_POLARITY_HIGH = 0x01 }
usart polarity of the clock type More...
enum | usart_lbcp_type { USART_CLOCK_LAST_BIT_NONE = 0x00 , USART_CLOCK_LAST_BIT_OUTPUT = 0x01 }
usart last bit clock pulse type More...
enum | usart_stop_bit_num_type { USART_STOP_1_BIT = 0x00 , USART_STOP_0_5_BIT = 0x01 , USART_STOP_2_BIT = 0x02 , USART_STOP_1_5_BIT = 0x03 }
usart stop bit num type More...
enum | usart_hardware_flow_control_type { USART_HARDWARE_FLOW_NONE = 0x00 , USART_HARDWARE_FLOW_RTS = 0x01 , USART_HARDWARE_FLOW_CTS = 0x02 , USART_HARDWARE_FLOW_RTS_CTS = 0x03 }
usart hardware flow control type More...

Functions

void | usart_reset (usart_type *usart_x)
deinitialize the usart peripheral registers to their default reset values.
void | usart_init (usart_type *usart_x, uint32_t baud_rate, usart_data_bit_num_type data_bit, usart_stop_bit_num_type stop_bit)
initialize the usart peripheral according to the specified parameters.
void | usart_parity_selection_config (usart_type *usart_x, usart_parity_selection_type parity)
usart parity selection config.
void | usart_enable (usart_type *usart_x, confirm_state new_state)
enable or disable the specified usart peripheral.
void | usart_transmitter_enable (usart_type *usart_x, confirm_state new_state)
usart transmitter enable.
void | usart_receiver_enable (usart_type *usart_x, confirm_state new_state)
usart receiver enable.
void | usart_clock_config (usart_type *usart_x, usart_clock_polarity_type clk_pol, usart_clock_phase_type clk_pha, usart_lbcp_type clk_lb)
usart clock config.
void | usart_clock_enable (usart_type *usart_x, confirm_state new_state)
usart enable the ck pin.
void | usart_interrupt_enable (usart_type *usart_x, uint32_t usart_int, confirm_state new_state)
enable or disable the specified usart interrupts.
void | usart_dma_transmitter_enable (usart_type *usart_x, confirm_state new_state)
enable or disable the usart's dma transmitter interface.
void | usart_dma_receiver_enable (usart_type *usart_x, confirm_state new_state)
enable or disable the usart's dma receiver interface.
void | usart_wakeup_id_set (usart_type *usart_x, uint8_t usart_id)
set the wakeup id of the usart.
void | usart_wakeup_mode_set (usart_type *usart_x, usart_wakeup_mode_type wakeup_mode)
select the usart wakeup method in multi-processor communication.
void | usart_receiver_mute_enable (usart_type *usart_x, confirm_state new_state)
config the usart in mute mode in multi-processor communication.
void | usart_break_bit_num_set (usart_type *usart_x, usart_break_bit_num_type break_bit)
set the usart break frame bit num.
void | usart_lin_mode_enable (usart_type *usart_x, confirm_state new_state)
enable or disable the usart lin mode.
void | usart_data_transmit (usart_type *usart_x, uint16_t data)
transmit single data through the usart peripheral.
uint16_t | usart_data_receive (usart_type *usart_x)
return the most recent received data by the usart peripheral.
void | usart_break_send (usart_type *usart_x)
transmit break characters.
void | usart_smartcard_guard_time_set (usart_type *usart_x, uint8_t guard_time_val)
config the specified usart smartcard guard time.
void | usart_irda_smartcard_division_set (usart_type *usart_x, uint8_t div_val)
config the irda/smartcard division.
void | usart_smartcard_mode_enable (usart_type *usart_x, confirm_state new_state)
enable or disable the usart smart card mode.
void | usart_smartcard_nack_set (usart_type *usart_x, confirm_state new_state)
enable or disable nack transmission in smartcard mode.
void | usart_single_line_halfduplex_select (usart_type *usart_x, confirm_state new_state)
enable or disable the usart single line bidirectional half-duplex communication.
void | usart_irda_mode_enable (usart_type *usart_x, confirm_state new_state)
enable or disable the usart's irda interface.
void | usart_irda_low_power_enable (usart_type *usart_x, confirm_state new_state)
configure the usart's irda low power.
void | usart_hardware_flow_control_set (usart_type *usart_x, usart_hardware_flow_control_type flow_state)
configure the usart's hardware flow control.
flag_status | usart_flag_get (usart_type *usart_x, uint32_t flag)
check whether the specified usart flag is set or not.
flag_status | usart_interrupt_flag_get (usart_type *usart_x, uint32_t flag)
check whether the specified usart interrupt flag is set or not.
void | usart_flag_clear (usart_type *usart_x, uint32_t flag)
clear the usart's pending flags.

Detailed Description

at32f413 usart header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_usart.h.


AT32F413 Firmwary Library: at32f413_usb.h File Reference

  • libraries
  • drivers
  • inc
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
at32f413_usb.h File Reference

at32f413 usb header file More...

#include "at32f413.h"

Go to the source code of this file.

Data Structures

struct | usb_ept_info
usb endpoint infomation structure definition More...
struct | usbd_type
type define usb register all More...

Macros

#define | USB_LSOF_INT ((uint32_t)0x00000100)
#define | USB_SOF_INT ((uint32_t)0x00000200)
#define | USB_RST_INT ((uint32_t)0x00000400)
#define | USB_SP_INT ((uint32_t)0x00000800)
#define | USB_WK_INT ((uint32_t)0x00001000)
#define | USB_BE_INT ((uint32_t)0x00002000)
#define | USB_UCFOR_INT ((uint32_t)0x00004000)
#define | USB_TC_INT ((uint32_t)0x00008000)
#define | USB_EPT_NUM_FLAG ((uint32_t)0x0000000F)
#define | USB_INOUT_FLAG ((uint32_t)0x00000010)
#define | USB_LSOF_FLAG ((uint32_t)0x00000100)
#define | USB_SOF_FLAG ((uint32_t)0x00000200)
#define | USB_RST_FLAG ((uint32_t)0x00000400)
#define | USB_SP_FLAG ((uint32_t)0x00000800)
#define | USB_WK_FLAG ((uint32_t)0x00001000)
#define | USB_BE_FLAG ((uint32_t)0x00002000)
#define | USB_UCFOR_FLAG ((uint32_t)0x00004000)
#define | USB_TC_FLAG ((uint32_t)0x00008000)
#define | USB_EPTADDR ((uint32_t)0x0000000F)
#define | USB_TXSTS ((uint32_t)0x00000030)
#define | USB_TXDTS ((uint32_t)0x00000040)
#define | USB_TXTC ((uint32_t)0x00000080)
#define | USB_EXF ((uint32_t)0x00000100)
#define | USB_TRANS_TYPE ((uint32_t)0x00000600)
#define | USB_SETUPTC ((uint32_t)0x00000800)
#define | USB_RXSTS ((uint32_t)0x00003000)
#define | USB_RXDTS ((uint32_t)0x00004000)
#define | USB_RXTC ((uint32_t)0x00008000)
#define | USB_EPT_BIT_MASK (uint32_t)(USB_TXTC | USB_SETUPTC | USB_EPTADDR | USB_EXF | USB_RXTC | USB_TRANS_TYPE)
#define | USB_TX_MASK (USB_TXSTS | USB_EPT_BIT_MASK)
#define | USB_RX_MASK (USB_RXSTS | USB_EPT_BIT_MASK)
#define | USB_TX_DISABLE ((uint32_t)0x00000000)
#define | USB_TX_STALL ((uint32_t)0x00000010)
#define | USB_TX_NAK ((uint32_t)0x00000020)
#define | USB_TX_VALID ((uint32_t)0x00000030)
#define | USB_TXDTS0 ((uint32_t)0x00000010)
#define | USB_TXDTS1 ((uint32_t)0x00000020)
#define | USB_RX_DISABLE ((uint32_t)0x00000000)
#define | USB_RX_STALL ((uint32_t)0x00001000)
#define | USB_RX_NAK ((uint32_t)0x00002000)
#define | USB_RX_VALID ((uint32_t)0x00003000)
#define | USB_RXDTS0 ((uint32_t)0x00001000)
#define | USB_RXDTS1 ((uint32_t)0x00002000)
#define | USB_EPT_CONTROL ((uint32_t)0x00000200)
#define | USB_EPT_BULK ((uint32_t)0x00000000)
#define | USB_EPT_INT ((uint32_t)0x00000600)
#define | USB_EPT_ISO ((uint32_t)0x00000400)
#define | USB_BUFFER_TABLE_ADDRESS 0x0000
#define | USB_PACKET_BUFFER_ADDRESS 0x40006000
#define | USB_PACKET_BUFFER_ADDRESS_EX 0x40007800
#define | USB_SET_TXSTS(ept_num, new_sts)
set usb endpoint tx status
#define | USB_SET_RXSTS(ept_num, new_sts)
set usb endpoint rx status
#define | GET_TX_LEN_ADDR(eptn)
get usb endpoint tx/rx length address
#define | GET_RX_LEN_ADDR(eptn)
#define | USB_GET_TX_LEN(eptn)
get usb endpoint tx/rx data length
#define | USB_GET_RX_LEN(eptn)
#define | USB_DBUF0_GET_LEN(eptn)
double buffer mode get endpoint buf0/buf1 data length
#define | USB_DBUF1_GET_LEN(eptn)
#define | BLK32(reg, len, blks)
set usb length of rx buffer
#define | BLK2(reg, len, blks)
#define | USB_SET_RXLEN_REG(reg, len)
#define | USB_SET_TXLEN(eptn, len)
set endpoint tx/rx transfer length
#define | USB_SET_RXLEN(eptn, len)
#define | USB_OUT_EPT_DOUBLE_BUF0(eptn, len)
double buffer mode set endpoint rx buf0 length
#define | USB_SET_EPT_DOUBLE_BUF0_LEN(eptn, len, dir)
double buffer mode set endpoint buf0 length
#define | USB_SET_EPT_DOUBLE_BUF1_LEN(eptn, len, dir)
double buffer mode set endpoint buf1 length
#define | USB_SET_TX_ADDRESS(eptn, address)
set usb endpoint tx/rx fifo address
#define | USB_SET_RX_ADDRESS(eptn, address)
#define | USB_SET_DOUBLE_BUFF0_ADDRESS(eptn, address)
set double buffer mode usb endpoint buf0/buf1 fifo address
#define | USB_SET_DOUBLE_BUFF1_ADDRESS(eptn, address)
#define | USB_TOGGLE_TXDTS(eptn)
set usb tx/rx toggle
#define | USB_TOGGLE_RXDTS(eptn)
#define | USB_CLEAR_TXDTS(eptn)
clear usb tx/rx toggle
#define | USB_CLEAR_RXDTS(eptn)
#define | USB_SET_TRANS_TYPE(eptn, type)
set usb endpoint type
#define | USB_SET_EXF(eptn)
set/clear usb extend function
#define | USB_CLEAR_EXF(eptn)
#define | USB_SET_EPT_ADDRESS(eptn, address)
set usb device address
#define | USB_FREE_DB_USER_BUFFER(eptn, inout)
free buffer used by application
#define | USB_CLEAR_TXTC(eptn)
clear tx/rx transfer completed flag
#define | USB_CLEAR_RXTC(eptn)
#define | USB_SET_EPT_DOUBLE_BUFFER(eptn)
set/clear endpoint double buffer mode
#define | USB_CLEAR_EPT_DOUBLE_BUFFER(eptn)
#define | USB ((usbd_type *) USBFS_BASE)

Typedefs

typedef usbd_type usb_reg_type

Enumerations

enum usb_ept_number_type {
USB_EPT0 = 0x00 , USB_EPT1 = 0x01 , USB_EPT2 = 0x02 , USB_EPT3 = 0x03 ,
USB_EPT4 = 0x04 , USB_EPT5 = 0x05 , USB_EPT6 = 0x06 , USB_EPT7 = 0x07
}
usb endpoint number define More...
enum | ept_trans_type { EPT_CONTROL_TYPE = 0x00 , EPT_ISO_TYPE = 0x01 , EPT_BULK_TYPE = 0x02 , EPT_INT_TYPE = 0x03 }
usb endpoint max num define More...
enum | ept_inout_type { EPT_IN = 0x00 , EPT_OUT = 0x01 }
endpoint endpoint direction define More...
enum | data_trans_dir { DATA_TRANS_OUT = 0x00 , DATA_TRANS_IN = 0x01 }
data transfer direction More...
enum | usb_clk48_s { USB_CLK_HICK , USB_CLK_HEXT }
usb clock select More...

Functions

void | usb_dev_init (usbd_type *usbx)
initialize usb peripheral controller register
void | usb_connect (usbd_type *usbx)
connect usb device
void | usb_disconnect (usbd_type *usbx)
disconnect usb device
void | usb_usbbufs_enable (usbd_type *usbx, confirm_state state)
mapping usb packet buffer area two mapping intervals are available for packet buffer area, and are select by the usbbufs in the crm misc1 register. when usbbufs is 0,sram size is 512 bytes, packet buffer start address is 0x40006000.when usbbufs is 1, sram size is fixed to 768~1280 bytes, and the packet buffer start address is fixed to 0x40007800,packet buffer size decided by whether can1 and can2 are enabled;when both can1 and can2 are disabled, usb packet buffer can be set to the maximum of 1280 bytes; when either can1 or can2 is enabled, usb packet buffer can be set to the maximum of 1024 bytes; when both CAN1 and CAN2 are enabled, usb packet buffer can be set to the maximum of 768 bytes.
void | usb_ept_open (usbd_type *usbx, usb_ept_info *ept_info)
open usb endpoint
void | usb_ept_close (usbd_type *usbx, usb_ept_info *ept_info)
close usb endpoint
void | usb_write_packet (uint8_t *pusr_buf, uint16_t offset_addr, uint16_t nbytes)
write data from user memory to usb buffer
void | usb_read_packet (uint8_t *pusr_buf, uint16_t offset_addr, uint16_t nbytes)
read data from usb buffer to user buffer
void | usb_interrupt_enable (usbd_type *usbx, uint16_t interrupt, confirm_state new_state)
usb interrupt enable
void | usb_set_address (usbd_type *usbx, uint8_t address)
set the host assignment address
void | usb_ept_stall (usbd_type *usbx, usb_ept_info *ept_info)
set endpoint tx or rx status to stall
void | usb_enter_suspend (usbd_type *usbx)
usb device enter suspend mode
void | usb_exit_suspend (usbd_type *usbx)
usb device exit suspend mode
void | usb_remote_wkup_set (usbd_type *usbx)
usb remote wakeup set
void | usb_remote_wkup_clear (usbd_type *usbx)
usb remote wakeup clear
uint16_t | usb_buffer_malloc (uint16_t maxpacket)
usb auto malloc endpoint buffer
void | usb_buffer_free (void)
free usb endpoint buffer
flag_status | usb_flag_get (usbd_type *usbx, uint16_t flag)
get flag of usb.
flag_status | usb_interrupt_flag_get (usbd_type *usbx, uint16_t flag)
get interrupt flag of usb.
void | usb_flag_clear (usbd_type *usbx, uint16_t flag)
clear flag of usb.

Variables

uint32_t g_usb_packet_address

Detailed Description

at32f413 usb header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_usb.h.


AT32F413 Firmwary Library: at32f413_wdt.h File Reference

  • libraries
  • drivers
  • inc
Data Structures | Macros | Enumerations | Functions
at32f413_wdt.h File Reference

at32f413 wdt header file More...

#include "at32f413.h"

Go to the source code of this file.

Data Structures

struct wdt_type
type define wdt register all More...

Macros

#define | WDT_DIVF_UPDATE_FLAG ((uint16_t)0x0001)
#define | WDT_RLDF_UPDATE_FLAG ((uint16_t)0x0002)
#define | WDT ((wdt_type *) WDT_BASE)

Enumerations

enum wdt_division_type {
WDT_CLK_DIV_4 = 0x00 , WDT_CLK_DIV_8 = 0x01 , WDT_CLK_DIV_16 = 0x02 , WDT_CLK_DIV_32 = 0x03 ,
WDT_CLK_DIV_64 = 0x04 , WDT_CLK_DIV_128 = 0x05 , WDT_CLK_DIV_256 = 0x06
}
wdt division value type More...
enum wdt_cmd_value_type { WDT_CMD_LOCK = 0x0000 , WDT_CMD_UNLOCK = 0x5555 , WDT_CMD_ENABLE = 0xCCCC , WDT_CMD_RELOAD = 0xAAAA }
wdt cmd value type More...

Functions

void | wdt_enable (void)
wdt enable ,the reload value will be sent to the counter
void | wdt_counter_reload (void)
reload wdt counter
void | wdt_reload_value_set (uint16_t reload_value)
set wdt counter reload value
void | wdt_divider_set (wdt_division_type division)
set wdt division divider
void | wdt_register_write_enable (confirm_state new_state)
enable or disable wdt cmd register write
flag_status | wdt_flag_get (uint16_t wdt_flag)
get wdt flag

Detailed Description

at32f413 wdt header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_wdt.h.


AT32F413 Firmwary Library: at32f413_wwdt.h File Reference

  • libraries
  • drivers
  • inc
Data Structures | Macros | Enumerations | Functions
at32f413_wwdt.h File Reference

at32f413 wwdt header file More...

#include "at32f413.h"

Go to the source code of this file.

Data Structures

struct wwdt_type
type define wwdt register all More...

Macros

#define | WWDT_EN_BIT ((uint32_t)0x00000080)
#define | WWDT ((wwdt_type *) WWDT_BASE)

Enumerations

enum wwdt_division_type { WWDT_PCLK1_DIV_4096 = 0x00 , WWDT_PCLK1_DIV_8192 = 0x01 , WWDT_PCLK1_DIV_16384 = 0x02 , WWDT_PCLK1_DIV_32768 = 0x03 }
wwdt division type More...

Functions

void | wwdt_reset (void)
wwdt reset by crm reset register
void | wwdt_divider_set (wwdt_division_type division)
wwdt division set
void | wwdt_flag_clear (void)
wwdt reload counter interrupt flag clear
void | wwdt_enable (uint8_t wwdt_cnt)
wwdt enable and the counter value load
void | wwdt_interrupt_enable (void)
wwdt reload counter interrupt enable
flag_status | wwdt_flag_get (void)
wwdt reload counter interrupt flag get
flag_status | wwdt_interrupt_flag_get (void)
wwdt reload counter interrupt flag get
void | wwdt_counter_set (uint8_t wwdt_cnt)
wwdt counter value set
void | wwdt_window_counter_set (uint8_t window_cnt)
wwdt window counter value set

Detailed Description

at32f413 wwdt header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_wwdt.h.


AT32F413 Firmwary Library: src Directory Reference

  • libraries
  • drivers
  • src
src Directory Reference

Files

at32f413_acc.c
contains all the functions for the acc firmware library
at32f413_adc.c
contains all the functions for the adc firmware library
at32f413_bpr.c
contains all the functions for the bpr firmware library
at32f413_can.c
contains all the functions for the can firmware library
at32f413_crc.c
contains all the functions for the crc firmware library
at32f413_crm.c
contains all the functions for the crm firmware library
at32f413_debug.c
contains all the functions for the debug firmware library
at32f413_dma.c
contains all the functions for the dma firmware library
at32f413_exint.c
contains all the functions for the exint firmware library
at32f413_flash.c
contains all the functions for the flash firmware library
at32f413_gpio.c
contains all the functions for the gpio firmware library
at32f413_i2c.c
contains all the functions for the i2c firmware library
at32f413_misc.c
contains all the functions for the misc firmware library
at32f413_pwc.c
contains all the functions for the pwc firmware library
at32f413_rtc.c
contains all the functions for the rtc firmware library
at32f413_sdio.c
contains all the functions for the sdio firmware library
at32f413_spi.c
contains all the functions for the spi firmware library
at32f413_tmr.c
contains all the functions for the tmr firmware library
at32f413_usart.c
contains all the functions for the usart firmware library
at32f413_usb.c
contains the functions for the usb firmware library
at32f413_wdt.c
contains all the functions for the wdt firmware library
at32f413_wwdt.c
contains all the functions for the wwdt firmware library


AT32F413 Firmwary Library: at32f413_acc.c File Reference

  • libraries
  • drivers
  • src
Functions
at32f413_acc.c File Reference

contains all the functions for the acc firmware library More...

#include "at32f413_conf.h"

Go to the source code of this file.

Functions

void | acc_calibration_mode_enable (uint16_t acc_trim, confirm_state new_state)
enable or disable the acc calibration mode.
void | acc_step_set (uint8_t step_value)
store calibration step data in acc's ctrl1 register.
void | acc_interrupt_enable (uint16_t acc_int, confirm_state new_state)
enable or disable the specified acc interrupts.
uint8_t | acc_hicktrim_get (void)
return the current acc hicktrim value.
uint8_t | acc_hickcal_get (void)
return the current acc hickcal value.
void | acc_write_c1 (uint16_t acc_c1_value)
wtire the value to acc c1 register.
void | acc_write_c2 (uint16_t acc_c2_value)
wtire the value to acc c2 register.
void | acc_write_c3 (uint16_t acc_c3_value)
wtire the value to acc c3 register.
uint16_t | acc_read_c1 (void)
return the current acc c1 value.
uint16_t | acc_read_c2 (void)
return the current acc c2 value.
uint16_t | acc_read_c3 (void)
return the current acc c3 value.
flag_status | acc_flag_get (uint16_t acc_flag)
check whether the specified acc flag is set or not.
flag_status | acc_interrupt_flag_get (uint16_t acc_flag)
check whether the specified acc interrupt flag is set or not.
void | acc_flag_clear (uint16_t acc_flag)
clear the specified acc flag is set or not.

Detailed Description

contains all the functions for the acc firmware library

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_acc.c.


AT32F413 Firmwary Library: at32f413_adc.c File Reference

  • libraries
  • drivers
  • src
Functions
at32f413_adc.c File Reference

contains all the functions for the adc firmware library More...

#include "at32f413_conf.h"

Go to the source code of this file.

Functions

void | adc_reset (adc_type *adc_x)
deinitialize the adc peripheral registers to their default reset values.
void | adc_enable (adc_type *adc_x, confirm_state new_state)
enable or disable the specified adc peripheral.
void | adc_combine_mode_select (adc_combine_mode_type combine_mode)
select combine mode of the specified adc peripheral.
void | adc_base_default_para_init (adc_base_config_type *adc_base_struct)
adc base default para init.
void | adc_base_config (adc_type *adc_x, adc_base_config_type *adc_base_struct)
initialize the adc peripheral according to the specified parameters.
void | adc_dma_mode_enable (adc_type *adc_x, confirm_state new_state)
enable or disable the adc dma transfer.
void | adc_interrupt_enable (adc_type *adc_x, uint32_t adc_int, confirm_state new_state)
enable or disable the specified adc interrupts.
void | adc_calibration_init (adc_type *adc_x)
initialize calibration register of the specified adc peripheral.
flag_status | adc_calibration_init_status_get (adc_type *adc_x)
get calibration register's initialize status of the specified adc peripheral.
void | adc_calibration_start (adc_type *adc_x)
start calibration process of the specified adc peripheral.
flag_status | adc_calibration_status_get (adc_type *adc_x)
get calibration status of the specified adc peripheral.
void | adc_voltage_monitor_enable (adc_type *adc_x, adc_voltage_monitoring_type adc_voltage_monitoring)
enable or disable the voltage monitoring on single/all ordinary or preempt channels of the specified adc peripheral.
void | adc_voltage_monitor_threshold_value_set (adc_type *adc_x, uint16_t adc_high_threshold, uint16_t adc_low_threshold)
set voltage monitoring's high and low thresholds value of the specified adc peripheral.
void | adc_voltage_monitor_single_channel_select (adc_type *adc_x, adc_channel_select_type adc_channel)
select the voltage monitoring's channel of the specified adc peripheral.
void | adc_ordinary_channel_set (adc_type *adc_x, adc_channel_select_type adc_channel, uint8_t adc_sequence, adc_sampletime_select_type adc_sampletime)
set ordinary channel's corresponding rank in the sequencer and sample time of the specified adc peripheral.
void | adc_preempt_channel_length_set (adc_type *adc_x, uint8_t adc_channel_lenght)
set preempt channel lenghth of the specified adc peripheral.
void | adc_preempt_channel_set (adc_type *adc_x, adc_channel_select_type adc_channel, uint8_t adc_sequence, adc_sampletime_select_type adc_sampletime)
configure preempt channel's corresponding rank in the sequencer and sample time of the specified adc peripheral.
void | adc_ordinary_conversion_trigger_set (adc_type *adc_x, adc_ordinary_trig_select_type adc_ordinary_trig, confirm_state new_state)
enable or disable the ordinary channel's external trigger and set external trigger event of the specified adc peripheral.
void | adc_preempt_conversion_trigger_set (adc_type *adc_x, adc_preempt_trig_select_type adc_preempt_trig, confirm_state new_state)
enable or disable the preempt channel's external trigger and set external trigger event of the specified adc peripheral.
void | adc_preempt_offset_value_set (adc_type *adc_x, adc_preempt_channel_type adc_preempt_channel, uint16_t adc_offset_value)
set preempt channel's conversion value offset of the specified adc peripheral.
void | adc_ordinary_part_count_set (adc_type *adc_x, uint8_t adc_channel_count)
set partitioned mode channel count of the specified adc peripheral.
void | adc_ordinary_part_mode_enable (adc_type *adc_x, confirm_state new_state)
enable or disable the partitioned mode on ordinary channel of the specified adc peripheral.
void | adc_preempt_part_mode_enable (adc_type *adc_x, confirm_state new_state)
enable or disable the partitioned mode on preempt channel of the specified adc peripheral.
void | adc_preempt_auto_mode_enable (adc_type *adc_x, confirm_state new_state)
enable or disable automatic preempt group conversion of the specified adc peripheral.
void | adc_tempersensor_vintrv_enable (confirm_state new_state)
enable or disable the temperature sensor and vintrv channel.
void | adc_ordinary_software_trigger_enable (adc_type *adc_x, confirm_state new_state)
enable or disable ordinary software start conversion of the specified adc peripheral.
flag_status | adc_ordinary_software_trigger_status_get (adc_type *adc_x)
get ordinary software start conversion status of the specified adc peripheral.
void | adc_preempt_software_trigger_enable (adc_type *adc_x, confirm_state new_state)
enable or disable preempt software start conversion of the specified adc peripheral.
flag_status | adc_preempt_software_trigger_status_get (adc_type *adc_x)
get preempt software start conversion status of the specified adc peripheral.
uint16_t | adc_ordinary_conversion_data_get (adc_type *adc_x)
return the last conversion data for ordinary channel of the specified adc peripheral.
uint32_t | adc_combine_ordinary_conversion_data_get (void)
return the last conversion data for ordinary channel of combine adc(adc1 and adc2).
uint16_t | adc_preempt_conversion_data_get (adc_type *adc_x, adc_preempt_channel_type adc_preempt_channel)
return the conversion data for selection preempt channel of the specified adc peripheral.
flag_status | adc_flag_get (adc_type *adc_x, uint8_t adc_flag)
get flag of the specified adc peripheral.
flag_status | adc_interrupt_flag_get (adc_type *adc_x, uint8_t adc_flag)
get interrupt flag of the specified adc peripheral.
void | adc_flag_clear (adc_type *adc_x, uint32_t adc_flag)
clear flag of the specified adc peripheral.

Detailed Description

contains all the functions for the adc firmware library

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_adc.c.


AT32F413 Firmwary Library: at32f413_bpr.c File Reference

  • libraries
  • drivers
  • src
Functions
at32f413_bpr.c File Reference

contains all the functions for the bpr firmware library More...

#include "at32f413_conf.h"

Go to the source code of this file.

Functions

void | bpr_reset (void)
bpr reset by crm reset register
flag_status | bpr_flag_get (uint32_t flag)
bpr event flag get, for tamper event flag
flag_status | bpr_interrupt_flag_get (uint32_t flag)
bpr interrupt flag get
void | bpr_flag_clear (uint32_t flag)
clear bpr tamper flag
void | bpr_interrupt_enable (confirm_state new_state)
enable or disable bpr tamper interrupt
uint16_t | bpr_data_read (bpr_data_type bpr_data)
read bpr bpr data
void | bpr_data_write (bpr_data_type bpr_data, uint16_t data_value)
write bpr data
void | bpr_rtc_output_select (bpr_rtc_output_type output_source)
select bpr rtc output
void | bpr_rtc_clock_calibration_value_set (uint8_t calibration_value)
set rtc clock calibration value
void | bpr_tamper_pin_enable (confirm_state new_state)
enable or disable bpr tamper pin
void | bpr_tamper_pin_active_level_set (bpr_tamper_pin_active_level_type active_level)
set bpr tamper pin active level

Detailed Description

contains all the functions for the bpr firmware library

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_bpr.c.


AT32F413 Firmwary Library: at32f413_can.c File Reference

  • libraries
  • drivers
  • src
Functions
at32f413_can.c File Reference

contains all the functions for the can firmware library More...

#include "at32f413_conf.h"

Go to the source code of this file.

Functions

void | can_reset (can_type *can_x)
deinitialize the can peripheral registers to their default reset values.
void | can_baudrate_default_para_init (can_baudrate_type *can_baudrate_struct)
fill each can_baudrate_struct member with its default value.
error_status | can_baudrate_set (can_type *can_x, can_baudrate_type *can_baudrate_struct)
set the baudrate of the can peripheral
void | can_default_para_init (can_base_type *can_base_struct)
fill each can_init_struct member with its default value.
error_status | can_base_init (can_type *can_x, can_base_type *can_base_struct)
initialize the can peripheral according to the specified parameters in the can_init_struct.
void | can_filter_default_para_init (can_filter_init_type *can_filter_init_struct)
fill each can_filter_init_struct member with its default value.
void | can_filter_init (can_type *can_x, can_filter_init_type *can_filter_init_struct)
initialize the can peripheral according to the specified parameters in the can_filter_init_struct.
void | can_debug_transmission_prohibit (can_type *can_x, confirm_state new_state)
enable or disable the debug transmission prohibit of the specified can peripheral.
void | can_ttc_mode_enable (can_type *can_x, confirm_state new_state)
enable or disable time trigger operation communication mode of the specified can peripheral.
uint8_t | can_message_transmit (can_type *can_x, can_tx_message_type *tx_message_struct)
fill the transmission message and transmit of the specified can peripheral.
can_transmit_status_type | can_transmit_status_get (can_type *can_x, can_tx_mailbox_num_type transmit_mailbox)
check the transmission state of the specified can peripheral.
void | can_transmit_cancel (can_type *can_x, can_tx_mailbox_num_type transmit_mailbox)
cancel a transmit request of the specified can peripheral.
void | can_message_receive (can_type *can_x, can_rx_fifo_num_type fifo_number, can_rx_message_type *rx_message_struct)
receive message of the specified can peripheral.
void | can_receive_fifo_release (can_type *can_x, can_rx_fifo_num_type fifo_number)
release the specified fifo of the specified can peripheral.
uint8_t | can_receive_message_pending_get (can_type *can_x, can_rx_fifo_num_type fifo_number)
return the number of pending messages of the specified can peripheral.
error_status | can_operating_mode_set (can_type *can_x, can_operating_mode_type can_operating_mode)
set the operation mode of the specified can peripheral.
can_enter_doze_status_type | can_doze_mode_enter (can_type *can_x)
enter the low power mode of the specified can peripheral.
can_quit_doze_status_type | can_doze_mode_exit (can_type *can_x)
exit the doze mode of the specified can peripheral.
can_error_record_type | can_error_type_record_get (can_type *can_x)
return the error type record (etr) of the specified can peripheral.
uint8_t | can_receive_error_counter_get (can_type *can_x)
return the receive error counter (rec) of the specified can peripheral.
uint8_t | can_transmit_error_counter_get (can_type *can_x)
return the transmit error counter of the specified can peripheral.
void | can_interrupt_enable (can_type *can_x, uint32_t can_int, confirm_state new_state)
enable or disable the interrupt of the specified can peripheral.
flag_status | can_interrupt_flag_get (can_type *can_x, uint32_t can_flag)
get interrupt flag of the specified can peripheral.
flag_status | can_flag_get (can_type *can_x, uint32_t can_flag)
get flag of the specified can peripheral.
void | can_flag_clear (can_type *can_x, uint32_t can_flag)
clear flag of the specified can peripheral.

Detailed Description

contains all the functions for the can firmware library

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_can.c.


AT32F413 Firmwary Library: at32f413_crc.c File Reference

  • libraries
  • drivers
  • src
Functions
at32f413_crc.c File Reference

contains all the functions for the crc firmware library More...

#include "at32f413_conf.h"

Go to the source code of this file.

Functions

void | crc_data_reset (void)
reset the crc data register.
uint32_t | crc_one_word_calculate (uint32_t data)
compute the 32-bit crc of a given data word(32-bit).
uint32_t | crc_block_calculate (uint32_t *pbuffer, uint32_t length)
compute the 32-bit crc of a given buffer of data word(32-bit).
uint32_t | crc_data_get (void)
return the current crc value.
void | crc_common_data_set (uint8_t cdt_value)
store a 8-bit data in the common data register.
uint8_t | crc_common_data_get (void)
return the 8-bit data stored in the common data register
void | crc_init_data_set (uint32_t value)
set the 32-bit initial data of crc
void | crc_reverse_input_data_set (crc_reverse_input_type value)
control the reversal of the bit order in the input data
void | crc_reverse_output_data_set (crc_reverse_output_type value)
control the reversal of the bit order in the output data
void | crc_poly_value_set (uint32_t value)
config crc polynomial value
uint32_t | crc_poly_value_get (void)
return crc polynomial value
void | crc_poly_size_set (crc_poly_size_type size)
config crc polynomial data size
crc_poly_size_type | crc_poly_size_get (void)
return crc polynomial data size

Detailed Description

contains all the functions for the crc firmware library

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_crc.c.


AT32F413 Firmwary Library: at32f413_crm.c File Reference

  • libraries
  • drivers
  • src
Functions
at32f413_crm.c File Reference

contains all the functions for the crm firmware library More...

#include "at32f413_conf.h"

Go to the source code of this file.

Functions

void | crm_reset (void)
reset the crm register
void | crm_lext_bypass (confirm_state new_state)
enable or disable crm low speed external crystal bypass
void | crm_hext_bypass (confirm_state new_state)
enable or disable crm high speed external crystal bypass
flag_status | crm_flag_get (uint32_t flag)
get crm flag status
flag_status | crm_interrupt_flag_get (uint32_t flag)
get crm interrupt flag status
error_status | crm_hext_stable_wait (void)
wait for hext stable
void | crm_hick_clock_trimming_set (uint8_t trim_value)
set the hick trimming value
void | crm_hick_clock_calibration_set (uint8_t cali_value)
set the crm calibration value
void | crm_periph_clock_enable (crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
void | crm_periph_reset (crm_periph_reset_type value, confirm_state new_state)
enable or disable the peripheral reset
void | crm_periph_sleep_mode_clock_enable (crm_periph_clock_sleepmd_type value, confirm_state new_state)
enable or disable the peripheral clock in sleep mode
void | crm_clock_source_enable (crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
void | crm_flag_clear (uint32_t flag)
clear the crm reset flags
void | crm_rtc_clock_select (crm_rtc_clock_type value)
select rtc clock
void | crm_rtc_clock_enable (confirm_state new_state)
enable or disable rtc
void | crm_ahb_div_set (crm_ahb_div_type value)
set crm ahb division
void | crm_apb1_div_set (crm_apb1_div_type value)
set crm apb1 division
void | crm_apb2_div_set (crm_apb2_div_type value)
set crm apb2 division
void | crm_adc_clock_div_set (crm_adc_div_type div_value)
set crm adc division
void | crm_usb_clock_div_set (crm_usb_div_type div_value)
set crm usb division
void | crm_clock_failure_detection_enable (confirm_state new_state)
enable or disable clock failure detection
void | crm_battery_powered_domain_reset (confirm_state new_state)
battery powered domain software reset
void | crm_pll_config (crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
void | crm_sysclk_switch (crm_sclk_type value)
select system clock source
crm_sclk_type | crm_sysclk_switch_status_get (void)
indicate which clock source is used as system clock
void | crm_clocks_freq_get (crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
void | crm_clock_out_set (crm_clkout_select_type clkout)
set crm clkout
void | crm_interrupt_enable (uint32_t crm_int, confirm_state new_state)
config crm interrupt
void | crm_auto_step_mode_enable (confirm_state new_state)
auto step clock switch enable
void | crm_usb_interrupt_remapping_set (crm_usb_int_map_type int_remap)
usbdev interrupt remapping control
void | crm_hick_divider_select (crm_hick_div_6_type value)
config hick divider select
void | crm_hick_sclk_frequency_select (crm_hick_sclk_frequency_type value)
hick as system clock frequency select
void | crm_usb_clock_source_select (crm_usb_clock_source_type value)
usb 48 mhz clock source select
void | crm_clkout_to_tmr10_enable (confirm_state new_state)
enable or disable clkout direct to tmr10 channel 1
void | crm_clkout_div_set (crm_clkout_div_type clkout_div)
set crm clkout division

Detailed Description

contains all the functions for the crm firmware library

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_crm.c.


AT32F413 Firmwary Library: at32f413_debug.c File Reference

  • libraries
  • drivers
  • src
Functions
at32f413_debug.c File Reference

contains all the functions for the debug firmware library More...

#include "at32f413_conf.h"

Go to the source code of this file.

Functions

uint32_t | debug_device_id_get (void)
get debug device id
void | debug_periph_mode_set (uint32_t periph_debug_mode, confirm_state new_state)
set periph debug mode

Detailed Description

contains all the functions for the debug firmware library

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_debug.c.


AT32F413 Firmwary Library: at32f413_dma.c File Reference

  • libraries
  • drivers
  • src
Functions
at32f413_dma.c File Reference

contains all the functions for the dma firmware library More...

#include "at32f413_conf.h"

Go to the source code of this file.

Functions

void | dma_reset (dma_channel_type *dmax_channely)
reset the dmax channely registers.
void | dma_data_number_set (dma_channel_type *dmax_channely, uint16_t data_number)
set the number of data to be transferred
uint16_t | dma_data_number_get (dma_channel_type *dmax_channely)
get number of data from dtcnt register
void | dma_interrupt_enable (dma_channel_type *dmax_channely, uint32_t dma_int, confirm_state new_state)
enable or disable dma interrupt
void | dma_channel_enable (dma_channel_type *dmax_channely, confirm_state new_state)
enable or disable dma channely
void | dma_flexible_config (dma_type *dma_x, uint8_t flex_channelx, dma_flexible_request_type flexible_request)
initialize the dma_x flexible function according to the specified parameters.
flag_status | dma_interrupt_flag_get (uint32_t dmax_flag)
get dma interrupt flag
flag_status | dma_flag_get (uint32_t dmax_flag)
get dma flag
void | dma_flag_clear (uint32_t dmax_flag)
clear dma flag
void | dma_default_para_init (dma_init_type *dma_init_struct)
dma init config with its default value.
void | dma_init (dma_channel_type *dmax_channely, dma_init_type *dma_init_struct)
dma init

Detailed Description

contains all the functions for the dma firmware library

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_dma.c.


AT32F413 Firmwary Library: at32f413_exint.c File Reference

  • libraries
  • drivers
  • src
Functions
at32f413_exint.c File Reference

contains all the functions for the exint firmware library More...

#include "at32f413_conf.h"

Go to the source code of this file.

Functions

void | exint_reset (void)
exint reset
void | exint_default_para_init (exint_init_type *exint_struct)
exint default para init
void | exint_init (exint_init_type *exint_struct)
exint init
void | exint_flag_clear (uint32_t exint_line)
clear exint flag
flag_status | exint_flag_get (uint32_t exint_line)
get exint flag
flag_status | exint_interrupt_flag_get (uint32_t exint_line)
get exint interrupt flag
void | exint_software_interrupt_event_generate (uint32_t exint_line)
generate exint software interrupt event
void | exint_interrupt_enable (uint32_t exint_line, confirm_state new_state)
enable or disable exint interrupt
void | exint_event_enable (uint32_t exint_line, confirm_state new_state)
enable or disable exint event

Detailed Description

contains all the functions for the exint firmware library

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_exint.c.


AT32F413 Firmwary Library: at32f413_flash.c File Reference

  • libraries
  • drivers
  • src
Functions
at32f413_flash.c File Reference

contains all the functions for the flash firmware library More...

#include "at32f413_conf.h"

Go to the source code of this file.

Functions

flag_status | flash_flag_get (uint32_t flash_flag)
check whether the specified flash flag is set or not.
void | flash_flag_clear (uint32_t flash_flag)
clear the flash flag.
flash_status_type | flash_operation_status_get (void)
return the flash operation status.
flash_status_type | flash_spim_operation_status_get (void)
return the flash spim operation status.
flash_status_type | flash_operation_wait_for (uint32_t time_out)
wait for flash operation complete or timeout.
flash_status_type | flash_spim_operation_wait_for (uint32_t time_out)
wait for flash spim operation complete or timeout.
void | flash_unlock (void)
unlock the flash controller.
void | flash_spim_unlock (void)
unlock the flash spim controller.
void | flash_lock (void)
lock the flash controller.
void | flash_spim_lock (void)
lock the flash spim controller.
flash_status_type | flash_sector_erase (uint32_t sector_address)
erase a specified flash sector.
flash_status_type | flash_internal_all_erase (void)
erase flash all internal sectors.
flash_status_type | flash_spim_all_erase (void)
erase flash spim sectors.
flash_status_type | flash_user_system_data_erase (void)
erase the flash user system data.
flash_status_type | flash_word_program (uint32_t address, uint32_t data)
program a word at a specified address.
flash_status_type | flash_halfword_program (uint32_t address, uint16_t data)
program a halfword at a specified address.
flash_status_type | flash_byte_program (uint32_t address, uint8_t data)
program a byte at a specified address.
flash_status_type | flash_user_system_data_program (uint32_t address, uint8_t data)
program a halfword at a specified user system data address.
flash_status_type | flash_epp_set (uint32_t *sector_bits)
config erase/program protection for the desired sectors.
void | flash_epp_status_get (uint32_t *sector_bits)
return the flash erase/program protection status.
flash_status_type | flash_fap_enable (confirm_state new_state)
enable or disable the flash access protection.
flag_status | flash_fap_status_get (void)
check the flash access protection status.
flash_status_type | flash_ssb_set (uint8_t usd_ssb)
program the flash system setting byte in usd: wdt_ato_en / depslp_rst / stdby_rst.
uint8_t | flash_ssb_status_get (void)
return the flash system setting byte status.
void | flash_interrupt_enable (uint32_t flash_int, confirm_state new_state)
enable or disable the specified flash interrupts.
void | flash_spim_model_select (flash_spim_model_type mode)
select spim supports extended spi flash chip model.
void | flash_spim_encryption_range_set (uint32_t decode_address)
set the range of encryption in spim flash. when the address is larger than this value, the writing data will be directly written to spim without encryption.
void | flash_spim_dummy_read (void)
operate the flash spim dummy read.
flash_status_type | flash_spim_mass_program (uint32_t address, uint8_t *buf, uint32_t cnt)
mass program for flash spim.
flash_status_type | flash_slib_enable (uint32_t pwd, uint16_t start_sector, uint16_t data_start_sector, uint16_t end_sector)
enable security library function.
error_status | flash_slib_disable (uint32_t pwd)
disable slib when slib enabled.
uint32_t | flash_slib_remaining_count_get (void)
get remaining count of slib(range: 256~0).
flag_status | flash_slib_state_get (void)
get the slib state.
uint16_t | flash_slib_start_sector_get (void)
get the start sector of slib.
uint16_t | flash_slib_datastart_sector_get (void)
get the data start sector of slib.
uint16_t | flash_slib_end_sector_get (void)
get the end sector of slib.
uint32_t | flash_crc_calibrate (uint32_t start_sector, uint32_t sector_cnt)
flash crc calibration in main block.

Detailed Description

contains all the functions for the flash firmware library

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_flash.c.


AT32F413 Firmwary Library: at32f413_gpio.c File Reference

  • libraries
  • drivers
  • src
Functions
at32f413_gpio.c File Reference

contains all the functions for the gpio firmware library More...

#include "at32f413_conf.h"

Go to the source code of this file.

Functions

void | gpio_reset (gpio_type *gpio_x)
reset the gpio register
void | gpio_iomux_reset (void)
reset the mux functions (remap, event control and exint configuration) registers to their default values.
void | gpio_init (gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
void | gpio_default_para_init (gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
flag_status | gpio_input_data_bit_read (gpio_type *gpio_x, uint16_t pins)
read the specified input port pin.
uint16_t | gpio_input_data_read (gpio_type *gpio_x)
read the specified gpio input data port.
flag_status | gpio_output_data_bit_read (gpio_type *gpio_x, uint16_t pins)
read the specified output port pin.
uint16_t | gpio_output_data_read (gpio_type *gpio_x)
read the specified gpio ouput data port.
void | gpio_bits_set (gpio_type *gpio_x, uint16_t pins)
set the selected data port bits.
void | gpio_bits_reset (gpio_type *gpio_x, uint16_t pins)
clear the selected data port bits.
void | gpio_bits_toggle (gpio_type *gpio_x, uint16_t pins)
toggle the selected data port bits.
void | gpio_bits_write (gpio_type *gpio_x, uint16_t pins, confirm_state bit_state)
set or clear the selected data port bit.
void | gpio_port_write (gpio_type *gpio_x, uint16_t port_value)
write data to the specified gpio data port.
void | gpio_pin_wp_config (gpio_type *gpio_x, uint16_t pins)
write protect gpio pins configuration registers.
void | gpio_event_output_config (gpio_port_source_type gpio_port_source, gpio_pins_source_type gpio_pin_source)
select the gpio pin used as event output.
void | gpio_event_output_enable (confirm_state new_state)
enable or disable the event output.
void | gpio_pin_remap_config (uint32_t gpio_remap, confirm_state new_state)
iomux remap and debug i/o configuration.
void | gpio_exint_line_config (gpio_port_source_type gpio_port_source, gpio_pins_source_type gpio_pin_source)
select the gpio pin used as exint line.

Detailed Description

contains all the functions for the gpio firmware library

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_gpio.c.


AT32F413 Firmwary Library: at32f413_i2c.c File Reference

  • libraries
  • drivers
  • src
Functions
at32f413_i2c.c File Reference

contains all the functions for the i2c firmware library More...

#include "at32f413_conf.h"

Go to the source code of this file.

Functions

void | i2c_reset (i2c_type *i2c_x)
reset the i2c register
void | i2c_software_reset (i2c_type *i2c_x, confirm_state new_state)
software reset.
void | i2c_init (i2c_type *i2c_x, i2c_fsmode_duty_cycle_type duty, uint32_t speed)
init i2c speed and duty cycle.
void | i2c_own_address1_set (i2c_type *i2c_x, i2c_address_mode_type mode, uint16_t address)
config own address1.
void | i2c_own_address2_set (i2c_type *i2c_x, uint8_t address)
config own address2.
void | i2c_own_address2_enable (i2c_type *i2c_x, confirm_state new_state)
enable or disable own address2.
void | i2c_smbus_enable (i2c_type *i2c_x, confirm_state new_state)
enable or disable the smbus mode
void | i2c_enable (i2c_type *i2c_x, confirm_state new_state)
enable or disable i2c periph
void | i2c_fast_mode_duty_set (i2c_type *i2c_x, i2c_fsmode_duty_cycle_type duty)
config fast mode duty cycle
void | i2c_clock_stretch_enable (i2c_type *i2c_x, confirm_state new_state)
enable or disable clock stretch.
void | i2c_ack_enable (i2c_type *i2c_x, confirm_state new_state)
enable or disable acknowledge.
void | i2c_master_receive_ack_set (i2c_type *i2c_x, i2c_master_ack_type pos)
master receiving mode acknowledge control.
void | i2c_pec_position_set (i2c_type *i2c_x, i2c_pec_position_type pos)
pec position set.
void | i2c_general_call_enable (i2c_type *i2c_x, confirm_state new_state)
enable or disable general call.
void | i2c_arp_mode_enable (i2c_type *i2c_x, confirm_state new_state)
enable or disable arp mode.
void | i2c_smbus_mode_set (i2c_type *i2c_x, i2c_smbus_mode_set_type mode)
config smbus host or device.
void | i2c_smbus_alert_set (i2c_type *i2c_x, i2c_smbus_alert_set_type level)
drive the smbus alert pin high or low.
void | i2c_pec_transmit_enable (i2c_type *i2c_x, confirm_state new_state)
enable or disable pec transfer.
void | i2c_pec_calculate_enable (i2c_type *i2c_x, confirm_state new_state)
enable or disable pec calcultetion.
uint8_t | i2c_pec_value_get (i2c_type *i2c_x)
get pec value.
void | i2c_dma_end_transfer_set (i2c_type *i2c_x, confirm_state new_state)
enable or disable if the next dma transfer will be the last one.
void | i2c_dma_enable (i2c_type *i2c_x, confirm_state new_state)
enable or disable dma requests.
void | i2c_interrupt_enable (i2c_type *i2c_x, uint16_t source, confirm_state new_state)
enable or disable interrupt
void | i2c_start_generate (i2c_type *i2c_x)
generate start condition.
void | i2c_stop_generate (i2c_type *i2c_x)
generate stop condition.
void | i2c_7bit_address_send (i2c_type *i2c_x, uint8_t address, i2c_direction_type direction)
transmit the slave address.
void | i2c_data_send (i2c_type *i2c_x, uint8_t data)
send a byte through the i2c periph.
uint8_t | i2c_data_receive (i2c_type *i2c_x)
receive a byte through the i2c periph.
flag_status | i2c_flag_get (i2c_type *i2c_x, uint32_t flag)
get flag status
flag_status | i2c_interrupt_flag_get (i2c_type *i2c_x, uint32_t flag)
get interrupt flag status
void | i2c_flag_clear (i2c_type *i2c_x, uint32_t flag)
clear flag status

Detailed Description

contains all the functions for the i2c firmware library

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_i2c.c.


AT32F413 Firmwary Library: at32f413_misc.c File Reference

  • libraries
  • drivers
  • src
Macros | Functions
at32f413_misc.c File Reference

contains all the functions for the misc firmware library More...

#include "at32f413_conf.h"

Go to the source code of this file.

Macros

#define AIRCR_VECTKEY_MASK ((uint32_t)0x05FA0000)

Functions

void | nvic_system_reset (void)
system reset
void | nvic_irq_enable (IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
void | nvic_irq_disable (IRQn_Type irqn)
disable nvic irq number
void | nvic_priority_group_config (nvic_priority_group_type priority_group)
config nvic priority group
void | nvic_vector_table_set (uint32_t base, uint32_t offset)
set the vector table location and offset.
void | nvic_lowpower_mode_config (nvic_lowpower_mode_type lp_mode, confirm_state new_state)
config nvic lowpower mode
void | systick_clock_source_config (systick_clock_source_type source)
config systick clock source

Detailed Description

contains all the functions for the misc firmware library

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_misc.c.


AT32F413 Firmwary Library: at32f413_pwc.c File Reference

  • libraries
  • drivers
  • src
Functions
at32f413_pwc.c File Reference

contains all the functions for the pwc firmware library More...

#include "at32f413_conf.h"

Go to the source code of this file.

Functions

void | pwc_reset (void)
deinitialize the pwc peripheral registers to their default reset values.
void | pwc_battery_powered_domain_access (confirm_state new_state)
enable or disable access to the battery powered domain.
void | pwc_pvm_level_select (pwc_pvm_voltage_type pvm_voltage)
select the voltage threshold detected by the power voltage detector.
void | pwc_power_voltage_monitor_enable (confirm_state new_state)
enable or disable pwc power voltage monitor (pvm)
void | pwc_wakeup_pin_enable (uint32_t pin_num, confirm_state new_state)
enable or disable pwc standby wakeup pin
void | pwc_flag_clear (uint32_t pwc_flag)
clear flag of pwc
flag_status | pwc_flag_get (uint32_t pwc_flag)
get flag of pwc
void | pwc_sleep_mode_enter (pwc_sleep_enter_type pwc_sleep_enter)
enter pwc sleep mode
void | pwc_deep_sleep_mode_enter (pwc_deep_sleep_enter_type pwc_deep_sleep_enter)
enter pwc deep-sleep mode
void | pwc_standby_mode_enter (void)
enter pwc standby mode

Detailed Description

contains all the functions for the pwc firmware library

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_pwc.c.


AT32F413 Firmwary Library: at32f413_rtc.c File Reference

  • libraries
  • drivers
  • src
Functions
at32f413_rtc.c File Reference

contains all the functions for the rtc firmware library More...

#include "at32f413_conf.h"

Go to the source code of this file.

Functions

void | rtc_counter_set (uint32_t counter_value)
rtc counter set
uint32_t | rtc_lowlevel_counter_get (void)
rtc lowlevel counter get
uint32_t | rtc_counter_get (void)
rtc counter get
void | rtc_divider_set (uint32_t div_value)
rtc divider set
uint32_t | rtc_divider_get (void)
rtc divider get
void | rtc_alarm_set (uint32_t alarm_value)
rtc alarm value set
void | rtc_interrupt_enable (uint16_t source, confirm_state new_state)
rtc interrupt enable
flag_status | rtc_flag_get (uint16_t flag)
rtc flag get
flag_status | rtc_interrupt_flag_get (uint16_t flag)
rtc interrupt flag get
void | rtc_flag_clear (uint16_t flag)
rtc flag clear
void | rtc_wait_config_finish (void)
rtc wait configuration finish
void | rtc_wait_update_finish (void)
rtc wait update finish

Detailed Description

contains all the functions for the rtc firmware library

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_rtc.c.


AT32F413 Firmwary Library: at32f413_sdio.c File Reference

  • libraries
  • drivers
  • src
Functions
at32f413_sdio.c File Reference

contains all the functions for the sdio firmware library More...

#include "at32f413_conf.h"

Go to the source code of this file.

Functions

void | sdio_reset (sdio_type *sdio_x)
reset the sdio register
void | sdio_power_set (sdio_type *sdio_x, sdio_power_state_type power_state)
set the power status of the controller
sdio_power_state_type | sdio_power_status_get (sdio_type *sdio_x)
get power status.
void | sdio_clock_config (sdio_type *sdio_x, uint16_t clk_div, sdio_edge_phase_type clk_edg)
config sdio clock
void | sdio_bus_width_config (sdio_type *sdio_x, sdio_bus_width_type width)
config sdio bus width
void | sdio_clock_bypass (sdio_type *sdio_x, confirm_state new_state)
enable or disable clock divider bypss
void | sdio_power_saving_mode_enable (sdio_type *sdio_x, confirm_state new_state)
enable or disable power saving mode, config sdio_ck clock output when the bus is idle.
void | sdio_flow_control_enable (sdio_type *sdio_x, confirm_state new_state)
enable or disable hardware flow control.
void | sdio_clock_enable (sdio_type *sdio_x, confirm_state new_state)
enable or disable sdio_ck output.
void | sdio_dma_enable (sdio_type *sdio_x, confirm_state new_state)
enable or disable dma.
void | sdio_interrupt_enable (sdio_type *sdio_x, uint32_t int_opt, confirm_state new_state)
config corresponding interrupt.
flag_status | sdio_interrupt_flag_get (sdio_type *sdio_x, uint32_t flag)
get sdio interrupt flag.
flag_status | sdio_flag_get (sdio_type *sdio_x, uint32_t flag)
get sdio flag.
void | sdio_flag_clear (sdio_type *sdio_x, uint32_t flag)
clear sdio flag.
void | sdio_command_config (sdio_type *sdio_x, sdio_command_struct_type *command_struct)
config sdio command.
void | sdio_command_state_machine_enable (sdio_type *sdio_x, confirm_state new_state)
enable or disable command path state machine(CPSM).
uint8_t | sdio_command_response_get (sdio_type *sdio_x)
get command index of last command for which response received.
uint32_t | sdio_response_get (sdio_type *sdio_x, sdio_rsp_index_type reg_index)
get response received from the card for the last command.
void | sdio_data_config (sdio_type *sdio_x, sdio_data_struct_type *data_struct)
config sdio data.
void | sdio_data_state_machine_enable (sdio_type *sdio_x, confirm_state new_state)
enable or disable data path state machine(DPSM).
uint32_t | sdio_data_counter_get (sdio_type *sdio_x)
get the number of remaining data bytes to be transferred.
uint32_t | sdio_data_read (sdio_type *sdio_x)
read a word data from sdio fifo.
uint32_t | sdio_buffer_counter_get (sdio_type *sdio_x)
get the number of words left to be written to or read from fifo..
void | sdio_data_write (sdio_type *sdio_x, uint32_t data)
write one word data to fifo.
void | sdio_read_wait_mode_set (sdio_type *sdio_x, sdio_read_wait_mode_type mode)
set the read wait mode.
void | sdio_read_wait_start (sdio_type *sdio_x, confirm_state new_state)
enable or disable to start sd i/o read wait operation.
void | sdio_read_wait_stop (sdio_type *sdio_x, confirm_state new_state)
enable or disable to stop sd i/o read wait operation.
void | sdio_io_function_enable (sdio_type *sdio_x, confirm_state new_state)
enable or disable the sd i/o function.
void | sdio_io_suspend_command_set (sdio_type *sdio_x, confirm_state new_state)
enable or disable sd i/o suspend command sending.

Detailed Description

contains all the functions for the sdio firmware library

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_sdio.c.


AT32F413 Firmwary Library: at32f413_spi.c File Reference

  • libraries
  • drivers
  • src
Functions
at32f413_spi.c File Reference

contains all the functions for the spi firmware library More...

#include "at32f413_conf.h"

Go to the source code of this file.

Functions

void | spi_i2s_reset (spi_type *spi_x)
spi reset by crm reset register
void | spi_default_para_init (spi_init_type *spi_init_struct)
spi init config with its default value.
void | spi_init (spi_type *spi_x, spi_init_type *spi_init_struct)
spi init config with its setting value.
void | spi_crc_next_transmit (spi_type *spi_x)
spi next transmit crc for the spi peripheral.
void | spi_crc_polynomial_set (spi_type *spi_x, uint16_t crc_poly)
set the crc polynomial value for the spi peripheral.
uint16_t | spi_crc_polynomial_get (spi_type *spi_x)
return the crc polynomial register value for the spi peripheral.
void | spi_crc_enable (spi_type *spi_x, confirm_state new_state)
enable or disable the hardware crc calculation for the spi peripheral.
uint16_t | spi_crc_value_get (spi_type *spi_x, spi_crc_direction_type crc_direction)
return the transmit or the receive crc value for the spi peripheral.
void | spi_hardware_cs_output_enable (spi_type *spi_x, confirm_state new_state)
enable or disable the hardware cs output for the spi peripheral.
void | spi_software_cs_internal_level_set (spi_type *spi_x, spi_software_cs_level_type level)
set the software cs internal level for the spi peripheral.
void | spi_frame_bit_num_set (spi_type *spi_x, spi_frame_bit_num_type bit_num)
set the data frame bit num for the spi peripheral.
void | spi_half_duplex_direction_set (spi_type *spi_x, spi_half_duplex_direction_type direction)
set the data transmission direction in single line bidirectiona half duplex mode of the spi peripheral.
void | spi_enable (spi_type *spi_x, confirm_state new_state)
enable or disable spi.
void | i2s_default_para_init (i2s_init_type *i2s_init_struct)
i2s init config with its default value.
void | i2s_init (spi_type *spi_x, i2s_init_type *i2s_init_struct)
i2s init config with its setting value.
void | i2s_enable (spi_type *spi_x, confirm_state new_state)
enable or disable i2s.
void | spi_i2s_interrupt_enable (spi_type *spi_x, uint32_t spi_i2s_int, confirm_state new_state)
enable or disable the specified spi/i2s interrupts.
void | spi_i2s_dma_transmitter_enable (spi_type *spi_x, confirm_state new_state)
enable or disable the spi/i2s dma transmitter mode.
void | spi_i2s_dma_receiver_enable (spi_type *spi_x, confirm_state new_state)
enable or disable the spi/i2s dma receiver mode.
void | spi_i2s_data_transmit (spi_type *spi_x, uint16_t tx_data)
spi/i2s data transmit
uint16_t | spi_i2s_data_receive (spi_type *spi_x)
spi/i2s data receive
flag_status | spi_i2s_flag_get (spi_type *spi_x, uint32_t spi_i2s_flag)
get flag of the specified spi/i2s peripheral.
flag_status | spi_i2s_interrupt_flag_get (spi_type *spi_x, uint32_t spi_i2s_flag)
get interrupt flag of the specified spi/i2s peripheral.
void | spi_i2s_flag_clear (spi_type *spi_x, uint32_t spi_i2s_flag)
clear flag of the specified spi/i2s peripheral.

Detailed Description

contains all the functions for the spi firmware library

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_spi.c.


AT32F413 Firmwary Library: at32f413_tmr.c File Reference

  • libraries
  • drivers
  • src
Functions
at32f413_tmr.c File Reference

contains all the functions for the tmr firmware library More...

#include "at32f413_conf.h"

Go to the source code of this file.

Functions

void | tmr_reset (tmr_type *tmr_x)
tmr reset by crm reset register
void | tmr_counter_enable (tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr counter
void | tmr_output_default_para_init (tmr_output_config_type *tmr_output_struct)
init tmr output default para
void | tmr_input_default_para_init (tmr_input_config_type *tmr_input_struct)
init tmr input default para
void | tmr_brkdt_default_para_init (tmr_brkdt_config_type *tmr_brkdt_struct)
init tmr brkdt default para
void | tmr_base_init (tmr_type *tmr_x, uint32_t tmr_pr, uint32_t tmr_div)
init tmr base
void | tmr_clock_source_div_set (tmr_type *tmr_x, tmr_clock_division_type tmr_clock_div)
set tmr clock source division
void | tmr_cnt_dir_set (tmr_type *tmr_x, tmr_count_mode_type tmr_cnt_dir)
set tmr counter count direction
void | tmr_repetition_counter_set (tmr_type *tmr_x, uint8_t tmr_rpr_value)
set the repetition counter register(rpr) value
void | tmr_counter_value_set (tmr_type *tmr_x, uint32_t tmr_cnt_value)
set tmr counter value
uint32_t | tmr_counter_value_get (tmr_type *tmr_x)
get tmr counter value
void | tmr_div_value_set (tmr_type *tmr_x, uint32_t tmr_div_value)
set tmr div value
uint32_t | tmr_div_value_get (tmr_type *tmr_x)
get tmr div value
void | tmr_output_channel_config (tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_output_config_type *tmr_output_struct)
config tmr output channel
void | tmr_output_channel_mode_select (tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_output_control_mode_type oc_mode)
select tmr output channel mode
void | tmr_period_value_set (tmr_type *tmr_x, uint32_t tmr_pr_value)
set tmr period value
uint32_t | tmr_period_value_get (tmr_type *tmr_x)
get tmr period value
void | tmr_channel_value_set (tmr_type *tmr_x, tmr_channel_select_type tmr_channel, uint32_t tmr_channel_value)
set tmr channel value
uint32_t | tmr_channel_value_get (tmr_type *tmr_x, tmr_channel_select_type tmr_channel)
get tmr channel value
void | tmr_period_buffer_enable (tmr_type *tmr_x, confirm_state new_state)
enable tmr period buffer
void | tmr_output_channel_buffer_enable (tmr_type *tmr_x, tmr_channel_select_type tmr_channel, confirm_state new_state)
enable tmr output channel buffer
void | tmr_output_channel_immediately_set (tmr_type *tmr_x, tmr_channel_select_type tmr_channel, confirm_state new_state)
set tmr output channel immediately
void | tmr_output_channel_switch_set (tmr_type *tmr_x, tmr_channel_select_type tmr_channel, confirm_state new_state)
set tmr output channel switch
void | tmr_one_cycle_mode_enable (tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr one cycle mode
void | tmr_32_bit_function_enable (tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr 32 bit function(plus mode)
void | tmr_overflow_request_source_set (tmr_type *tmr_x, confirm_state new_state)
select tmr the overflow event sources
void | tmr_overflow_event_disable (tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr overflow event generation
void | tmr_input_channel_init (tmr_type *tmr_x, tmr_input_config_type *input_struct, tmr_channel_input_divider_type divider_factor)
init tmr input channel
void | tmr_channel_enable (tmr_type *tmr_x, tmr_channel_select_type tmr_channel, confirm_state new_state)
tmr channel enable
void | tmr_input_channel_filter_set (tmr_type *tmr_x, tmr_channel_select_type tmr_channel, uint16_t filter_value)
set tmr input channel filter
void | tmr_pwm_input_config (tmr_type *tmr_x, tmr_input_config_type *input_struct, tmr_channel_input_divider_type divider_factor)
config tmr pwm input
void | tmr_channel1_input_select (tmr_type *tmr_x, tmr_channel1_input_connected_type ch1_connect)
select tmr channel1 input
void | tmr_input_channel_divider_set (tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_channel_input_divider_type divider_factor)
set tmr input channel divider
void | tmr_primary_mode_select (tmr_type *tmr_x, tmr_primary_select_type primary_mode)
select tmr primary mode
void | tmr_sub_mode_select (tmr_type *tmr_x, tmr_sub_mode_select_type sub_mode)
select tmr subordinate mode
void | tmr_channel_dma_select (tmr_type *tmr_x, tmr_dma_request_source_type cc_dma_select)
select tmr channel dma
void | tmr_hall_select (tmr_type *tmr_x, confirm_state new_state)
select tmr hall
void | tmr_channel_buffer_enable (tmr_type *tmr_x, confirm_state new_state)
enable tmr channel buffer
void | tmr_trigger_input_select (tmr_type *tmr_x, sub_tmr_input_sel_type trigger_select)
select tmr sub-trigger
void | tmr_sub_sync_mode_set (tmr_type *tmr_x, confirm_state new_state)
set tmr subordinate synchronization mode
void | tmr_dma_request_enable (tmr_type *tmr_x, tmr_dma_request_type dma_request, confirm_state new_state)
enable or disable tmr dma request
void | tmr_interrupt_enable (tmr_type *tmr_x, uint32_t tmr_interrupt, confirm_state new_state)
enable or disable tmr interrupt
flag_status | tmr_interrupt_flag_get (tmr_type *tmr_x, uint32_t tmr_flag)
get tmr interrupt flag
flag_status | tmr_flag_get (tmr_type *tmr_x, uint32_t tmr_flag)
get tmr flag
void | tmr_flag_clear (tmr_type *tmr_x, uint32_t tmr_flag)
clear tmr flag
void | tmr_event_sw_trigger (tmr_type *tmr_x, tmr_event_trigger_type tmr_event)
generate tmr event
void | tmr_output_enable (tmr_type *tmr_x, confirm_state new_state)
tmr output enable(oen),this function is important for advtm output enable
void | tmr_internal_clock_set (tmr_type *tmr_x)
set tmr select internal clock
void | tmr_output_channel_polarity_set (tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_polarity_active_type oc_polarity)
set tmr output channel polarity
void | tmr_external_clock_config (tmr_type *tmr_x, tmr_external_signal_divider_type es_divide, tmr_external_signal_polarity_type es_polarity, uint16_t es_filter)
config tmr external clock
void | tmr_external_clock_mode1_config (tmr_type *tmr_x, tmr_external_signal_divider_type es_divide, tmr_external_signal_polarity_type es_polarity, uint16_t es_filter)
config tmr external clock mode1
void | tmr_external_clock_mode2_config (tmr_type *tmr_x, tmr_external_signal_divider_type es_divide, tmr_external_signal_polarity_type es_polarity, uint16_t es_filter)
config tmr external clock mode2
void | tmr_encoder_mode_config (tmr_type *tmr_x, tmr_encoder_mode_type encoder_mode, tmr_input_polarity_type ic1_polarity, tmr_input_polarity_type ic2_polarity)
config tmr encoder mode
void | tmr_force_output_set (tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_force_output_type force_output)
set tmr force output
void | tmr_dma_control_config (tmr_type *tmr_x, tmr_dma_transfer_length_type dma_length, tmr_dma_address_type dma_base_address)
config tmr dma control
void | tmr_brkdt_config (tmr_type *tmr_x, tmr_brkdt_config_type *brkdt_struct)
config tmr brake mode and dead-time

Detailed Description

contains all the functions for the tmr firmware library

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_tmr.c.


AT32F413 Firmwary Library: at32f413_usart.c File Reference

  • libraries
  • drivers
  • src
Functions
at32f413_usart.c File Reference

contains all the functions for the usart firmware library More...

#include "at32f413_conf.h"

Go to the source code of this file.

Functions

void | usart_reset (usart_type *usart_x)
deinitialize the usart peripheral registers to their default reset values.
void | usart_init (usart_type *usart_x, uint32_t baud_rate, usart_data_bit_num_type data_bit, usart_stop_bit_num_type stop_bit)
initialize the usart peripheral according to the specified parameters.
void | usart_parity_selection_config (usart_type *usart_x, usart_parity_selection_type parity)
usart parity selection config.
void | usart_enable (usart_type *usart_x, confirm_state new_state)
enable or disable the specified usart peripheral.
void | usart_transmitter_enable (usart_type *usart_x, confirm_state new_state)
usart transmitter enable.
void | usart_receiver_enable (usart_type *usart_x, confirm_state new_state)
usart receiver enable.
void | usart_clock_config (usart_type *usart_x, usart_clock_polarity_type clk_pol, usart_clock_phase_type clk_pha, usart_lbcp_type clk_lb)
usart clock config.
void | usart_clock_enable (usart_type *usart_x, confirm_state new_state)
usart enable the ck pin.
void | usart_interrupt_enable (usart_type *usart_x, uint32_t usart_int, confirm_state new_state)
enable or disable the specified usart interrupts.
void | usart_dma_transmitter_enable (usart_type *usart_x, confirm_state new_state)
enable or disable the usart's dma transmitter interface.
void | usart_dma_receiver_enable (usart_type *usart_x, confirm_state new_state)
enable or disable the usart's dma receiver interface.
void | usart_wakeup_id_set (usart_type *usart_x, uint8_t usart_id)
set the wakeup id of the usart.
void | usart_wakeup_mode_set (usart_type *usart_x, usart_wakeup_mode_type wakeup_mode)
select the usart wakeup method in multi-processor communication.
void | usart_receiver_mute_enable (usart_type *usart_x, confirm_state new_state)
config the usart in mute mode in multi-processor communication.
void | usart_break_bit_num_set (usart_type *usart_x, usart_break_bit_num_type break_bit)
set the usart break frame bit num.
void | usart_lin_mode_enable (usart_type *usart_x, confirm_state new_state)
enable or disable the usart lin mode.
void | usart_data_transmit (usart_type *usart_x, uint16_t data)
transmit single data through the usart peripheral.
uint16_t | usart_data_receive (usart_type *usart_x)
return the most recent received data by the usart peripheral.
void | usart_break_send (usart_type *usart_x)
transmit break characters.
void | usart_smartcard_guard_time_set (usart_type *usart_x, uint8_t guard_time_val)
config the specified usart smartcard guard time.
void | usart_irda_smartcard_division_set (usart_type *usart_x, uint8_t div_val)
config the irda/smartcard division.
void | usart_smartcard_mode_enable (usart_type *usart_x, confirm_state new_state)
enable or disable the usart smart card mode.
void | usart_smartcard_nack_set (usart_type *usart_x, confirm_state new_state)
enable or disable nack transmission in smartcard mode.
void | usart_single_line_halfduplex_select (usart_type *usart_x, confirm_state new_state)
enable or disable the usart single line bidirectional half-duplex communication.
void | usart_irda_mode_enable (usart_type *usart_x, confirm_state new_state)
enable or disable the usart's irda interface.
void | usart_irda_low_power_enable (usart_type *usart_x, confirm_state new_state)
configure the usart's irda low power.
void | usart_hardware_flow_control_set (usart_type *usart_x, usart_hardware_flow_control_type flow_state)
configure the usart's hardware flow control.
flag_status | usart_flag_get (usart_type *usart_x, uint32_t flag)
check whether the specified usart flag is set or not.
flag_status | usart_interrupt_flag_get (usart_type *usart_x, uint32_t flag)
check whether the specified usart interrupt flag is set or not.
void | usart_flag_clear (usart_type *usart_x, uint32_t flag)
clear the usart's pending flags.

Detailed Description

contains all the functions for the usart firmware library

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_usart.c.


AT32F413 Firmwary Library: at32f413_usb.c File Reference

  • libraries
  • drivers
  • src
Macros | Functions | Variables
at32f413_usb.c File Reference

contains the functions for the usb firmware library More...

#include "at32f413_conf.h"

Go to the source code of this file.

Macros

#define USB_ENDP_DESC_TABLE_OFFSET 0x40
usb packet buffer start address

Functions

void | usb_dev_init (usbd_type *usbx)
initialize usb peripheral controller register
void | usb_connect (usbd_type *usbx)
connect usb device
void | usb_disconnect (usbd_type *usbx)
disconnect usb device
void | usb_usbbufs_enable (usbd_type *usbx, confirm_state state)
mapping usb packet buffer area two mapping intervals are available for packet buffer area, and are select by the usbbufs in the crm misc1 register. when usbbufs is 0,sram size is 512 bytes, packet buffer start address is 0x40006000.when usbbufs is 1, sram size is fixed to 768~1280 bytes, and the packet buffer start address is fixed to 0x40007800,packet buffer size decided by whether can1 and can2 are enabled;when both can1 and can2 are disabled, usb packet buffer can be set to the maximum of 1280 bytes; when either can1 or can2 is enabled, usb packet buffer can be set to the maximum of 1024 bytes; when both CAN1 and CAN2 are enabled, usb packet buffer can be set to the maximum of 768 bytes.
void | usb_ept_open (usbd_type *usbx, usb_ept_info *ept_info)
open usb endpoint
void | usb_ept_close (usbd_type *usbx, usb_ept_info *ept_info)
close usb endpoint
void | usb_write_packet (uint8_t *pusr_buf, uint16_t offset_addr, uint16_t nbytes)
write data from user memory to usb buffer
void | usb_read_packet (uint8_t *pusr_buf, uint16_t offset_addr, uint16_t nbytes)
read data from usb buffer to user buffer
void | usb_interrupt_enable (usbd_type *usbx, uint16_t interrupt, confirm_state new_state)
usb interrupt enable
void | usb_set_address (usbd_type *usbx, uint8_t address)
set the host assignment address
void | usb_ept_stall (usbd_type *usbx, usb_ept_info *ept_info)
set endpoint tx or rx status to stall
void | usb_enter_suspend (usbd_type *usbx)
usb device enter suspend mode
void | usb_exit_suspend (usbd_type *usbx)
usb device exit suspend mode
void | usb_remote_wkup_set (usbd_type *usbx)
usb remote wakeup set
void | usb_remote_wkup_clear (usbd_type *usbx)
usb remote wakeup clear
uint16_t | usb_buffer_malloc (uint16_t maxpacket)
usb auto malloc endpoint buffer
void | usb_buffer_free (void)
free usb endpoint buffer
flag_status | usb_flag_get (usbd_type *usbx, uint16_t flag)
get flag of usb.
flag_status | usb_interrupt_flag_get (usbd_type *usbx, uint16_t flag)
get interrupt flag of usb.
void | usb_flag_clear (usbd_type *usbx, uint16_t flag)
clear flag of usb.

Variables

uint32_t | g_usb_packet_address = 0x40006000
static uint16_t | g_usb_offset_addr = 0x40

Detailed Description

contains the functions for the usb firmware library

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_usb.c.


AT32F413 Firmwary Library: at32f413_wdt.c File Reference

  • libraries
  • drivers
  • src
Functions
at32f413_wdt.c File Reference

contains all the functions for the wdt firmware library More...

#include "at32f413_conf.h"

Go to the source code of this file.

Functions

void | wdt_enable (void)
wdt enable ,the reload value will be sent to the counter
void | wdt_counter_reload (void)
reload wdt counter
void | wdt_reload_value_set (uint16_t reload_value)
set wdt counter reload value
void | wdt_divider_set (wdt_division_type division)
set wdt division divider
void | wdt_register_write_enable (confirm_state new_state)
enable or disable wdt cmd register write
flag_status | wdt_flag_get (uint16_t wdt_flag)
get wdt flag

Detailed Description

contains all the functions for the wdt firmware library

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_wdt.c.


AT32F413 Firmwary Library: at32f413_wwdt.c File Reference

  • libraries
  • drivers
  • src
Functions
at32f413_wwdt.c File Reference

contains all the functions for the wwdt firmware library More...

#include "at32f413_conf.h"

Go to the source code of this file.

Functions

void | wwdt_reset (void)
wwdt reset by crm reset register
void | wwdt_divider_set (wwdt_division_type division)
wwdt division set
void | wwdt_flag_clear (void)
wwdt reload counter interrupt flag clear
void | wwdt_enable (uint8_t wwdt_cnt)
wwdt enable and the counter value load
void | wwdt_interrupt_enable (void)
wwdt reload counter interrupt enable
flag_status | wwdt_flag_get (void)
wwdt reload counter interrupt flag get
flag_status | wwdt_interrupt_flag_get (void)
wwdt reload counter interrupt flag get
void | wwdt_counter_set (uint8_t wwdt_cnt)
wwdt counter value set
void | wwdt_window_counter_set (uint8_t window_cnt)
wwdt window counter value set

Detailed Description

contains all the functions for the wwdt firmware library

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_wwdt.c.


AT32F413 Firmwary Library: main_page Directory Reference

  • main_page
main_page Directory Reference

Files

main_page.h


AT32F413 Firmwary Library: main_page.h File Reference

  • main_page
main_page.h File Reference

Go to the source code of this file.


AT32F413 Firmwary Library: middlewares Directory Reference

  • middlewares
middlewares Directory Reference

Directories

i2c_application_library
usbd_class
usbd_drivers


AT32F413 Firmwary Library: i2c_application_library Directory Reference

  • middlewares
  • i2c_application_library
i2c_application_library Directory Reference

Files

i2c_application.c
the driver library of the i2c peripheral
i2c_application.h
i2c application libray header file


AT32F413 Firmwary Library: i2c_application.c File Reference

  • middlewares
  • i2c_application_library
Macros | Functions
i2c_application.c File Reference

the driver library of the i2c peripheral More...

#include "i2c_application.h"

Go to the source code of this file.

Macros

#define | DMA_GET_TC_FLAG(DMA_CHANNEL)
get the dma transfer complete flag through the channel
#define | DMA_GET_HT_FLAG(DMA_CHANNEL)
get the dma half transfer flag through the channel
#define | DMA_GET_TERR_FLAG(DMA_CHANNEL)
get the dma transfer error flag through the channel
#define | I2C_START 0
i2c transmission status
#define | I2C_END 1

Functions

__WEAK void | i2c_lowlevel_init (i2c_handle_type *hi2c)
initializes peripherals used by the i2c.
void | i2c_config (i2c_handle_type *hi2c)
i2c peripheral initialization.
i2c_status_type | i2c_wait_end (i2c_handle_type *hi2c, uint32_t timeout)
wait for the transfer to end.
i2c_status_type | i2c_wait_flag (i2c_handle_type *hi2c, uint32_t flag, uint32_t event_check, uint32_t timeout)
wait for the flag to be set or reset, only BUSYF flag is waiting to be reset, and other flags are waiting to be set
void | i2c_dma_config (i2c_handle_type *hi2c, dma_channel_type *dma_channelx, uint8_t *pdata, uint16_t size)
dma transfer cofiguration.
i2c_status_type | i2c_master_write_addr (i2c_handle_type *hi2c, uint16_t address, uint32_t timeout)
send address in master transmits mode.
i2c_status_type | i2c_master_read_addr (i2c_handle_type *hi2c, uint16_t address, uint32_t timeout)
send address in master receive mode.
i2c_status_type | i2c_master_transmit (i2c_handle_type *hi2c, uint16_t address, uint8_t *pdata, uint16_t size, uint32_t timeout)
the master transmits data through polling mode.
i2c_status_type | i2c_slave_receive (i2c_handle_type *hi2c, uint8_t *pdata, uint16_t size, uint32_t timeout)
the slave receive data through polling mode.
i2c_status_type | i2c_master_receive (i2c_handle_type *hi2c, uint16_t address, uint8_t *pdata, uint16_t size, uint32_t timeout)
the master receive data through polling mode.
i2c_status_type | i2c_slave_transmit (i2c_handle_type *hi2c, uint8_t *pdata, uint16_t size, uint32_t timeout)
the slave transmits data through polling mode.
i2c_status_type | i2c_master_transmit_int (i2c_handle_type *hi2c, uint16_t address, uint8_t *pdata, uint16_t size, uint32_t timeout)
the master transmits data through interrupt mode.
i2c_status_type | i2c_slave_receive_int (i2c_handle_type *hi2c, uint8_t *pdata, uint16_t size, uint32_t timeout)
the slave receive data through interrupt mode.
i2c_status_type | i2c_master_receive_int (i2c_handle_type *hi2c, uint16_t address, uint8_t *pdata, uint16_t size, uint32_t timeout)
the master receive data through interrupt mode.
i2c_status_type | i2c_slave_transmit_int (i2c_handle_type *hi2c, uint8_t *pdata, uint16_t size, uint32_t timeout)
the slave transmits data through interrupt mode.
i2c_status_type | i2c_master_transmit_dma (i2c_handle_type *hi2c, uint16_t address, uint8_t *pdata, uint16_t size, uint32_t timeout)
the master transmits data through dma mode.
i2c_status_type | i2c_slave_receive_dma (i2c_handle_type *hi2c, uint8_t *pdata, uint16_t size, uint32_t timeout)
the slave receive data through dma mode.
i2c_status_type | i2c_master_receive_dma (i2c_handle_type *hi2c, uint16_t address, uint8_t *pdata, uint16_t size, uint32_t timeout)
the master receive data through dma mode.
i2c_status_type | i2c_slave_transmit_dma (i2c_handle_type *hi2c, uint8_t *pdata, uint16_t size, uint32_t timeout)
the slave transmits data through dma mode.
i2c_status_type | i2c_memory_address_send (i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t mem_address, int32_t timeout)
send memory address.
i2c_status_type | i2c_memory_write (i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
write data to the memory device through polling mode.
i2c_status_type | i2c_memory_read (i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
read data from memory device through polling mode.
i2c_status_type | i2c_memory_write_int (i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
write data to the memory device through interrupt mode.
i2c_status_type | i2c_memory_read_int (i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
read data from memory device through interrupt mode.
i2c_status_type | i2c_memory_write_dma (i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
write data to the memory device through dma mode.
i2c_status_type | i2c_memory_read_dma (i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
read data from memory device through polling mode.
void | i2c_master_tx_isr_int (i2c_handle_type *hi2c)
master transfer mode interrupt procession function
void | i2c_master_rx_isr_int (i2c_handle_type *hi2c)
master receive mode interrupt procession function
void | i2c_slave_tx_isr_int (i2c_handle_type *hi2c)
slave transfer mode interrupt procession function
void | i2c_slave_rx_isr_int (i2c_handle_type *hi2c)
slave receive mode interrupt procession function
void | i2c_master_tx_isr_dma (i2c_handle_type *hi2c)
master interrupt processing function in dma mode.
void | i2c_slave_tx_rx_isr_dma (i2c_handle_type *hi2c)
slave interrupt processing function in dma mode.
void | i2c_evt_irq_handler (i2c_handle_type *hi2c)
interrupt procession function.
void | i2c_dma_tx_irq_handler (i2c_handle_type *hi2c)
dma transmission complete interrupt function.
void | i2c_dma_rx_irq_handler (i2c_handle_type *hi2c)
dma reveive complete interrupt function.
void | i2c_err_irq_handler (i2c_handle_type *hi2c)
i2c error interrupt function.

Detailed Description

the driver library of the i2c peripheral

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file i2c_application.c.


AT32F413 Firmwary Library: i2c_application.h File Reference

  • middlewares
  • i2c_application_library
Data Structures | Macros | Enumerations | Functions
i2c_application.h File Reference

i2c application libray header file More...

#include "at32f413.h"

Go to the source code of this file.

Data Structures

struct i2c_handle_type

Macros

#define | I2C_EVENT_CHECK_NONE ((uint32_t)0x00000000)
#define | I2C_EVENT_CHECK_ACKFAIL ((uint32_t)0x00000001)
#define | I2C_EVENT_CHECK_STOP ((uint32_t)0x00000002)

Enumerations

enum i2c_mem_address_width_type { I2C_MEM_ADDR_WIDIH_8 = 0x01 , I2C_MEM_ADDR_WIDIH_16 = 0x02 }
enum i2c_mode_type {
I2C_INT_MA_TX = 0 , I2C_INT_MA_RX , I2C_INT_SLA_TX , I2C_INT_SLA_RX ,
I2C_DMA_MA_TX , I2C_DMA_MA_RX , I2C_DMA_SLA_TX , I2C_DMA_SLA_RX
}
enum i2c_status_type {
I2C_OK = 0 , I2C_ERR_STEP_1 , I2C_ERR_STEP_2 , I2C_ERR_STEP_3 ,
I2C_ERR_STEP_4 , I2C_ERR_STEP_5 , I2C_ERR_STEP_6 , I2C_ERR_STEP_7 ,
I2C_ERR_STEP_8 , I2C_ERR_STEP_9 , I2C_ERR_STEP_10 , I2C_ERR_STEP_11 ,
I2C_ERR_STEP_12 , I2C_ERR_START , I2C_ERR_ADDR10 , I2C_ERR_ADDR ,
I2C_ERR_STOP , I2C_ERR_ACKFAIL , I2C_ERR_TIMEOUT , I2C_ERR_INTERRUPT
}

Functions

void | i2c_config (i2c_handle_type *hi2c)
i2c peripheral initialization.
void | i2c_lowlevel_init (i2c_handle_type *hi2c)
initializes peripherals used by the i2c.
i2c_status_type | i2c_wait_end (i2c_handle_type *hi2c, uint32_t timeout)
wait for the transfer to end.
i2c_status_type | i2c_wait_flag (i2c_handle_type *hi2c, uint32_t flag, uint32_t event_check, uint32_t timeout)
wait for the flag to be set or reset, only BUSYF flag is waiting to be reset, and other flags are waiting to be set
i2c_status_type | i2c_master_transmit (i2c_handle_type *hi2c, uint16_t address, uint8_t *pdata, uint16_t size, uint32_t timeout)
the master transmits data through polling mode.
i2c_status_type | i2c_master_receive (i2c_handle_type *hi2c, uint16_t address, uint8_t *pdata, uint16_t size, uint32_t timeout)
the master receive data through polling mode.
i2c_status_type | i2c_slave_transmit (i2c_handle_type *hi2c, uint8_t *pdata, uint16_t size, uint32_t timeout)
the slave transmits data through polling mode.
i2c_status_type | i2c_slave_receive (i2c_handle_type *hi2c, uint8_t *pdata, uint16_t size, uint32_t timeout)
the slave receive data through polling mode.
i2c_status_type | i2c_master_transmit_int (i2c_handle_type *hi2c, uint16_t address, uint8_t *pdata, uint16_t size, uint32_t timeout)
the master transmits data through interrupt mode.
i2c_status_type | i2c_master_receive_int (i2c_handle_type *hi2c, uint16_t address, uint8_t *pdata, uint16_t size, uint32_t timeout)
the master receive data through interrupt mode.
i2c_status_type | i2c_slave_transmit_int (i2c_handle_type *hi2c, uint8_t *pdata, uint16_t size, uint32_t timeout)
the slave transmits data through interrupt mode.
i2c_status_type | i2c_slave_receive_int (i2c_handle_type *hi2c, uint8_t *pdata, uint16_t size, uint32_t timeout)
the slave receive data through interrupt mode.
i2c_status_type | i2c_master_transmit_dma (i2c_handle_type *hi2c, uint16_t address, uint8_t *pdata, uint16_t size, uint32_t timeout)
the master transmits data through dma mode.
i2c_status_type | i2c_master_receive_dma (i2c_handle_type *hi2c, uint16_t address, uint8_t *pdata, uint16_t size, uint32_t timeout)
the master receive data through dma mode.
i2c_status_type | i2c_slave_transmit_dma (i2c_handle_type *hi2c, uint8_t *pdata, uint16_t size, uint32_t timeout)
the slave transmits data through dma mode.
i2c_status_type | i2c_slave_receive_dma (i2c_handle_type *hi2c, uint8_t *pdata, uint16_t size, uint32_t timeout)
the slave receive data through dma mode.
i2c_status_type | i2c_memory_write (i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
write data to the memory device through polling mode.
i2c_status_type | i2c_memory_write_int (i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
write data to the memory device through interrupt mode.
i2c_status_type | i2c_memory_write_dma (i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
write data to the memory device through dma mode.
i2c_status_type | i2c_memory_read (i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
read data from memory device through polling mode.
i2c_status_type | i2c_memory_read_int (i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
read data from memory device through interrupt mode.
i2c_status_type | i2c_memory_read_dma (i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
read data from memory device through polling mode.
void | i2c_evt_irq_handler (i2c_handle_type *hi2c)
interrupt procession function.
void | i2c_err_irq_handler (i2c_handle_type *hi2c)
i2c error interrupt function.
void | i2c_dma_tx_irq_handler (i2c_handle_type *hi2c)
dma transmission complete interrupt function.
void | i2c_dma_rx_irq_handler (i2c_handle_type *hi2c)
dma reveive complete interrupt function.

Detailed Description

i2c application libray header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file i2c_application.h.


AT32F413 Firmwary Library: usbd_class Directory Reference

  • middlewares
  • usbd_class
usbd_class Directory Reference

Directories

audio
audio_hid
cdc
composite_cdc_keyboard
composite_cdc_msc
custom_hid
hid_iap
keyboard
mouse
msc
printer
winusb


AT32F413 Firmwary Library: audio Directory Reference

  • middlewares
  • usbd_class
  • audio
audio Directory Reference

Files

audio_class.c
usb audio class type
audio_class.h
usb audio class file
audio_conf.h
usb audio config
audio_desc.c
usb audio device descriptor
audio_desc.h
usb audio descriptor header file


AT32F413 Firmwary Library: audio_class.c File Reference

  • middlewares
  • usbd_class
  • audio
Functions | Variables
audio_class.c File Reference

usb audio class type More...

#include "usbd_core.h"
#include "audio_class.h"
#include "audio_desc.h"
#include "audio_codec.h"

Go to the source code of this file.

Functions

static usb_sts_type | class_init_handler (void *udev)
initialize usb custom hid endpoint
static usb_sts_type | class_clear_handler (void *udev)
clear endpoint or other state
static usb_sts_type | class_setup_handler (void *udev, usb_setup_type *setup)
usb device class setup request handler
static usb_sts_type | class_ept0_tx_handler (void *udev)
usb device endpoint 0 in status stage complete
static usb_sts_type | class_ept0_rx_handler (void *udev)
usb device endpoint 0 out status stage complete
static usb_sts_type | class_in_handler (void *udev, uint8_t ept_num)
usb device transmision complete handler
static usb_sts_type | class_out_handler (void *udev, uint8_t ept_num)
usb device endpoint receive data
static usb_sts_type | class_sof_handler (void *udev)
usb device sof handler
static usb_sts_type | class_event_handler (void *udev, usbd_event_type event)
usb device event handler
static void | audio_req_get_cur (void *udev, usb_setup_type *setup)
usb audio request get cur
static void | audio_req_set_cur (void *udev, usb_setup_type *setup)
usb audio request set cur
static void | audio_req_get_min (void *udev, usb_setup_type *setup)
usb audio request get min
static void | audio_req_get_max (void *udev, usb_setup_type *setup)
usb audio request get max
static void | audio_req_get_res (void *udev, usb_setup_type *setup)
usb audio request get res
static void | audio_get_interface (void *udev, usb_setup_type *setup)
usb audio get interface
static void | audio_set_interface (void *udev, usb_setup_type *setup)
usb audio set interface

Variables

usb_audio_type audio_struct = {0, 0, 0, 0, 0, 0x1400, 0, 0, 0, {0x0000, 0x1400, 0x33}, {0x0000, 0x1400, 0x33}, 0, 0}
usbd_class_handler audio_class_handler

Detailed Description

usb audio class type

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file audio_class.c.


AT32F413 Firmwary Library: audio_class.h File Reference

  • middlewares
  • usbd_class
  • audio
Data Structures | Macros | Variables
audio_class.h File Reference

usb audio class file More...

#include "usb_std.h"
#include "usbd_core.h"
#include "audio_conf.h"

Go to the source code of this file.

Data Structures

struct usb_audio_type
usb audio control struct More...

Macros

#define | USBD_AUDIO_MIC_IN_EPT 0x81
endpoint define
#define | USBD_AUDIO_SPK_OUT_EPT 0x02
#define | USBD_AUDIO_FEEDBACK_EPT 0x83
#define | AUDIO_REMAIN_SIZE 40
endpoint support max size
#define | AUDIO_MIC_IN_MAXPACKET_SIZE (AUDIO_SUPPORT_MAX_FREQ * AUDIO_MIC_CHANEL_NUM * (AUDIO_MIC_DEFAULT_BITW / 8) + AUDIO_REMAIN_SIZE)
#define | AUDIO_SPK_OUT_MAXPACKET_SIZE (AUDIO_SUPPORT_MAX_FREQ * AUDIO_SPK_CHANEL_NUM * (AUDIO_SPK_DEFAULT_BITW / 8) + AUDIO_REMAIN_SIZE)
#define | AUDIO_FEEDBACK_MAXPACKET_SIZE 0x3
#define | FEEDBACK_REFRESH_TIME 0x8
#define | AUDIO_REQ_CONTROL_INTERFACE 0x01
request type define
#define | AUDIO_REQ_CONTROL_ENDPOINT 0x02
#define | AUDIO_REQ_CONTROL_MASK 0x03
#define | AUDIO_MUTE_CONTROL 0x01
audio set cur type define
#define | AUDIO_VOLUME_CONTROL 0x02
#define | AUDIO_FREQ_SET_CONTROL 0x03
#define | AUDIO_SAMPLING_FREQ_CONTROL 0x01
#define | AUDIO_DESCRIPTOR_TYPE 0x21
audio descriptor type
#define | AUDIO_DESCRIPTOR_SIZE 0x09

Variables

usbd_class_handler audio_class_handler

Detailed Description

usb audio class file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file audio_class.h.


AT32F413 Firmwary Library: audio_conf.h File Reference

  • middlewares
  • usbd_class
  • audio
Macros
audio_conf.h File Reference

usb audio config More...

Go to the source code of this file.

Macros

#define | AUDIO_SUPPORT_SPK 1
#define | AUDIO_SUPPORT_MIC 1
#define | AUDIO_SUPPORT_FEEDBACK 1
#define | AUDIO_SUPPORT_FREQ_16K 1
#define | AUDIO_SUPPORT_FREQ_48K 1
#define | AUDIO_SUPPORT_FREQ
#define | AUDIO_FREQ_16K 16000
#define | AUDIO_FREQ_48K 48000
#define | AUDIO_BITW_16 16
#define | AUDIO_MIC_CHANEL_NUM 2
#define | AUDIO_MIC_DEFAULT_BITW AUDIO_BITW_16
#define | AUDIO_SPK_CHANEL_NUM 2
#define | AUDIO_SPK_DEFAULT_BITW AUDIO_BITW_16
#define | AUDIO_SUPPORT_MAX_FREQ 48
#define | AUDIO_DEFAULT_FREQ AUDIO_FREQ_48K
#define | AUDIO_DEFAULT_BITW AUDIO_BITW_16

Detailed Description

usb audio config

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file audio/audio_conf.h.


AT32F413 Firmwary Library: audio_desc.c File Reference

  • middlewares
  • usbd_class
  • audio
Functions | Variables
audio_desc.c File Reference

usb audio device descriptor More...

#include "usb_std.h"
#include "usbd_sdr.h"
#include "usbd_core.h"
#include "audio_desc.h"

Go to the source code of this file.

Functions

static usbd_desc_t * | get_device_descriptor (void)
get device descriptor
static usbd_desc_t * | get_device_qualifier (void)
get device qualifier
static usbd_desc_t * | get_device_configuration (void)
get config descriptor
static usbd_desc_t * | get_device_other_speed (void)
get other speed descriptor
static usbd_desc_t * | get_device_lang_id (void)
get lang id descriptor
static usbd_desc_t * | get_device_manufacturer_string (void)
get manufacturer descriptor
static usbd_desc_t * | get_device_product_string (void)
get product descriptor
static usbd_desc_t * | get_device_serial_string (void)
get serial descriptor
static usbd_desc_t * | get_device_interface_string (void)
get interface descriptor
static usbd_desc_t * | get_device_config_string (void)
get device config descriptor
static uint16_t | usbd_unicode_convert (uint8_t *string, uint8_t *unicode_buf)
standard usb unicode convert
static void | usbd_int_to_unicode (uint32_t value, uint8_t *pbuf, uint8_t len)
usb int convert to unicode
static void | get_serial_num (void)
usb get serial number

Variables

static ALIGNED_HEAD uint8_t g_usbd_desc_buffer[256] | ALIGNED_TAIL
usb device standard descriptor
usbd_desc_handler audio_desc_handler
device descriptor handler structure
static usbd_desc_t | device_descriptor
static usbd_desc_t | config_descriptor
static usbd_desc_t | langid_descriptor
static usbd_desc_t | serial_descriptor
static usbd_desc_t | vp_desc

Detailed Description

usb audio device descriptor

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file audio_desc.c.


AT32F413 Firmwary Library: audio_desc.h File Reference

  • middlewares
  • usbd_class
  • audio
Macros | Variables
audio_desc.h File Reference

usb audio descriptor header file More...

#include "audio_class.h"
#include "usbd_core.h"
#include "audio_conf.h"

Go to the source code of this file.

Macros

#define | AUDIO_BCD_NUM 0x0100
#define | USBD_AUDIO_VENDOR_ID 0x2E3C
#define | USBD_AUDIO_PRODUCT_ID 0x5730
#define | USBD_AUDIO_SIZ_STRING_LANGID 4
#define | USBD_AUDIO_SIZ_STRING_SERIAL 0x1A
#define | USBD_AUDIO_DESC_MANUFACTURER_STRING "Artery"
#define | USBD_AUDIO_DESC_PRODUCT_STRING "AT32 Audio"
#define | USBD_AUDIO_DESC_CONFIGURATION_STRING "Audio Config"
#define | USBD_AUDIO_DESC_INTERFACE_STRING "Audio Interface"
#define | AUDIO_SUBCLASS_UNDEFINED 0x00
audio interface subclass codes
#define | AUDIO_SUBCLASS_AUDIOCONTROL 0x01
#define | AUDIO_SUBCLASS_AUDIOSTREAMING 0x02
#define | AUDIO_SUBCLASS_MIDISTREMING 0x03
#define | AUDIO_CS_INTERFACE 0x24
audio class-specific descriptor types
#define | AUDIO_CS_ENDPOINT 0x25
#define | AUDIO_CS_STRING 0x23
#define | AUDIO_CS_CONFIGURATION 0x22
#define | AUDIO_CS_DEVICE 0x21
#define | AUDIO_CS_UNDEFINED 0x20
#define | AUDIO_PROTOCOL_UNDEFINED 0x00
audio interface protocol codes
#define | AUDIO_AC_DESCRIPTOR_UNDEFINED 0x00
audio class-specific ac interface descriptor subtypes
#define | AUDIO_AC_HEADER 0x01
#define | AUDIO_AC_INPUT_TERMINAL 0x02
#define | AUDIO_AC_OUTPUT_TERMINAL 0x03
#define | AUDIO_AC_MIXER_UNIT 0x04
#define | AUDIO_AC_SELECTOR_UNIT 0x05
#define | AUDIO_AC_FEATURE_UNIT 0x06
#define | AUDIO_AC_PROCESSING_UNIT 0x07
#define | AUDIO_AC_EXTENSION_UNIT 0x08
#define | AUDIO_AS_DESCRIPTOR_UNDEFINED 0x00
audio class-specific as interface descriptor subtypes
#define | AUDIO_AS_GENERAL 0x01
#define | AUDIO_AS_FORMAT_TYPE 0x02
#define | AUDIO_AS_FORMAT_SPECIFIC 0x03
#define | AUDIO_REQUEST_CODE_UNDEFINED 0x00
audio class-specific request codes
#define | AUDIO_REQ_SET_CUR 0x01
#define | AUDIO_REQ_GET_CUR 0x81
#define | AUDIO_REQ_SET_MIN 0x02
#define | AUDIO_REQ_GET_MIN 0x82
#define | AUDIO_REQ_SET_MAX 0x03
#define | AUDIO_REQ_GET_MAX 0x83
#define | AUDIO_REQ_SET_RES 0x04
#define | AUDIO_REQ_GET_RES 0x84
#define | AUDIO_REQ_SET_MEM 0x05
#define | AUDIO_REQ_GET_MEM 0x85
#define | AUDIO_REQ_GET_STAT 0xFF
#define | AUDIO_FU_CONTROL_UNDEFINED 0x00
audio feature unit control selectors
#define | AUDIO_FU_MUTE_CONTROL 0x01
#define | AUDIO_FU_VOLUME_CONTROL 0x02
#define | AUDIO_FU_BASS_CONTROL 0x03
#define | AUDIO_FU_MID_CONTROL 0x04
#define | AUDIO_FU_TREBLE_CONTROL 0x05
#define | AUDIO_TERMINAL_TYPE_UNDEFINED 0x0100
audio terminal type
#define | AUDIO_TERMINAL_TYPE_STREAMING 0x0101
#define | AUDIO_TERMINAL_TYPE_VENDOR 0x01FF
#define | AUDIO_INPUT_TERMINAL_UNDEFINED 0x0200
#define | AUDIO_INPUT_TERMINAL_MICROPHONE 0x0201
#define | AUDIO_OUTPUT_TERMINAL_UNDEFINED 0x0300
#define | AUDIO_OUTPUT_TERMINAL_SPEAKER 0x0301
#define | AUDIO_FORMAT_TYPE_I 0x01
audio format type 1
#define | AUDIO_INTERFACE_NUM (AUDIO_SUPPORT_SPK + AUDIO_SUPPORT_MIC)
audio interface config
#define | AUDIO_INTERFACE_LEN ((0x08 + AUDIO_INTERFACE_NUM) + AUDIO_INTERFACE_NUM * 0x22)
#define | AUDIO_MIC_INTERFACE 0x01
#define | AUDIO_SPK_INTERFACE 0x02
#define | AUDIO_INPUT_TERMINAL_SIZE 0x0C
audio interface descriptor size define
#define | AUDIO_OUTPUT_TERMINAL_SIZE 0x09
#define | AUDIO_FEATURE_UNIT_SIZE 0x0D
#define | AUDIO_MIC_INPUT_TERMINAL_ID 0x01
audio terminal id define
#define | AUDIO_MIC_FEATURE_UNIT_ID 0x02
#define | AUDIO_MIC_OUTPUT_TERMINAL_ID 0x03
#define | AUDIO_SPK_INPUT_TERMINAL_ID 0x04
#define | AUDIO_SPK_FEATURE_UNIT_ID 0x05
#define | AUDIO_SPK_OUTPUT_TERMINAL_ID 0x06
#define | AUDIO_MIC_INTERFACE_NUMBER 0x01
audio interface number
#define | AUDIO_SPK_INTERFACE_NUMBER 0x02
#define | AT32_AUDIO_FREQ_16K 16000
audio support freq
#define | AT32_AUDIO_FREQ_48K 48000
#define | AUDIO_MIC_FREQ_SIZE (AUDIO_SUPPORT_FREQ)
audio microphone freq and channel config
#define | AUDIO_MIC_CHR AUDIO_MIC_CHANEL_NUM
#define | AUDIO_MIC_BITW (AUDIO_MIC_DEFAULT_BITW)
#define | AUDIO_SPK_FREQ_SIZE (AUDIO_SUPPORT_FREQ)
audio speaker freq and channel config
#define | AUDIO_SPK_CHR AUDIO_SPK_CHANEL_NUM
#define | AUDIO_SPK_BITW (AUDIO_SPK_DEFAULT_BITW)
#define | AUDIO_BINTERVAL_TIME 0x01
#define | USBD_AUDIO_CONFIG_DESC_SIZE
#define | SAMPLE_FREQ(frq)
#define | MCU_ID1 (0x1FFFF7E8)
#define | MCU_ID2 (0x1FFFF7EC)
#define | MCU_ID3 (0x1FFFF7F0)

Variables

usbd_desc_handler audio_desc_handler
device descriptor handler structure

Detailed Description

usb audio descriptor header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file audio_desc.h.


AT32F413 Firmwary Library: audio_hid Directory Reference

  • middlewares
  • usbd_class
  • audio_hid
audio_hid Directory Reference

Files

audio_conf.h
usb audio config
audio_hid_class.c
audio_hid_class.h
audio_hid_desc.c
audio_hid_desc.h


AT32F413 Firmwary Library: audio_conf.h File Reference

  • middlewares
  • usbd_class
  • audio_hid
Macros
audio_conf.h File Reference

usb audio config More...

Go to the source code of this file.

Macros

#define | AUDIO_SUPPORT_SPK 1
#define | AUDIO_SUPPORT_MIC 1
#define | AUDIO_SUPPORT_FEEDBACK 1
#define | AUDIO_SUPPORT_FREQ_16K 0
#define | AUDIO_SUPPORT_FREQ_48K 1
#define | AUDIO_SUPPORT_FREQ
#define | AUDIO_FREQ_16K 16000
#define | AUDIO_FREQ_48K 48000
#define | AUDIO_BITW_16 16
#define | AUDIO_MIC_CHANEL_NUM 2
#define | AUDIO_MIC_DEFAULT_BITW AUDIO_BITW_16
#define | AUDIO_SPK_CHANEL_NUM 2
#define | AUDIO_SPK_DEFAULT_BITW AUDIO_BITW_16
#define | AUDIO_SUPPORT_MAX_FREQ 48
#define | AUDIO_DEFAULT_FREQ AUDIO_FREQ_48K
#define | AUDIO_DEFAULT_BITW AUDIO_BITW_16

Detailed Description

usb audio config

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file audio_hid/audio_conf.h.


AT32F413 Firmwary Library: audio_hid_class.c File Reference

  • middlewares
  • usbd_class
  • audio_hid
Functions | Variables
audio_hid_class.c File Reference
#include "usbd_core.h"
#include "audio_hid_class.h"
#include "audio_hid_desc.h"
#include "audio_codec.h"

Go to the source code of this file.

Functions

static usb_sts_type | class_init_handler (void *udev)
initialize usb custom hid endpoint
static usb_sts_type | class_clear_handler (void *udev)
clear endpoint or other state
static usb_sts_type | class_setup_handler (void *udev, usb_setup_type *setup)
usb device class setup request handler
static usb_sts_type | class_ept0_tx_handler (void *udev)
usb device endpoint 0 in status stage complete
static usb_sts_type | class_ept0_rx_handler (void *udev)
usb device endpoint 0 out status stage complete
static usb_sts_type | class_in_handler (void *udev, uint8_t ept_num)
usb device transmision complete handler
static usb_sts_type | class_out_handler (void *udev, uint8_t ept_num)
usb device endpoint receive data
static usb_sts_type | class_sof_handler (void *udev)
usb device sof handler
static usb_sts_type | class_event_handler (void *udev, usbd_event_type event)
usb device event handler
static void | audio_req_get_cur (void *udev, usb_setup_type *setup)
usb audio request get cur
static void | audio_req_set_cur (void *udev, usb_setup_type *setup)
usb audio request set cur
static void | audio_req_get_min (void *udev, usb_setup_type *setup)
usb audio request get min
static void | audio_req_get_max (void *udev, usb_setup_type *setup)
usb audio request get max
static void | audio_req_get_res (void *udev, usb_setup_type *setup)
usb audio request get res
static void | audio_get_interface (void *udev, usb_setup_type *setup)
usb audio get interface
static void | audio_set_interface (void *udev, usb_setup_type *setup)
usb audio set interface
static void | usb_hid_buf_process (void *udev, uint8_t *report, uint16_t len)
usb device report function
usb_sts_type | class_audio_setup_handler (void *udev, usb_setup_type *setup)
usb device class setup request handler
usb_sts_type | class_hid_setup_handler (void *udev, usb_setup_type *setup)
usb device class setup request handler
usb_sts_type | audio_hid_class_send_report (void *udev, uint8_t *report, uint16_t len)
usb device class send report

Variables

usb_audio_hid_type audio_hid_struct = {0, 0, 0, 0, 0, 0x1400, 0, 0, 0, {0x0000, 0x1400, 0x33}, {0x0000, 0x1400, 0x33}, 0, 0}
usbd_class_handler audio_hid_class_handler


AT32F413 Firmwary Library: audio_hid_class.h File Reference

  • middlewares
  • usbd_class
  • audio_hid
Data Structures | Macros | Functions | Variables
audio_hid_class.h File Reference
#include "usb_std.h"
#include "usbd_core.h"
#include "audio_conf.h"

Go to the source code of this file.

Data Structures

struct usb_audio_hid_type
usb audio control struct More...

Macros

#define | USBD_AUHID_AUDIO_MIC_IN_EPT 0x81
endpoint define
#define | USBD_AUHID_AUDIO_SPK_OUT_EPT 0x02
#define | USBD_AUHID_AUDIO_FEEDBACK_EPT 0x83
#define | USBD_AUHID_HID_IN_EPT 0x84
usb custom hid use endpoint define
#define | USBD_AUHID_HID_OUT_EPT 0x05
#define | USBD_AUHID_IN_MAXPACKET_SIZE 0x40
usb custom hid in and out max packet size define
#define | USBD_AUHID_OUT_MAXPACKET_SIZE 0x40
#define | AUDIO_REMAIN_SIZE 40
endpoint support max size
#define | AUDIO_MIC_IN_MAXPACKET_SIZE (AUDIO_SUPPORT_MAX_FREQ * AUDIO_MIC_CHANEL_NUM * (AUDIO_MIC_DEFAULT_BITW / 8) + AUDIO_REMAIN_SIZE)
#define | AUDIO_SPK_OUT_MAXPACKET_SIZE (AUDIO_SUPPORT_MAX_FREQ * AUDIO_SPK_CHANEL_NUM * (AUDIO_SPK_DEFAULT_BITW / 8) + AUDIO_REMAIN_SIZE)
#define | AUDIO_FEEDBACK_MAXPACKET_SIZE 0x3
#define | FEEDBACK_REFRESH_TIME 0x8
#define | AUDIO_REQ_CONTROL_INTERFACE 0x01
request type define
#define | AUDIO_REQ_CONTROL_ENDPOINT 0x02
#define | AUDIO_REQ_CONTROL_MASK 0x03
#define | AUDIO_MUTE_CONTROL 0x01
audio set cur type define
#define | AUDIO_VOLUME_CONTROL 0x02
#define | AUDIO_FREQ_SET_CONTROL 0x03
#define | AUDIO_SAMPLING_FREQ_CONTROL 0x01
#define | AUDIO_MUTE_CONTROL 0x01
audio set cur type define
#define | AUDIO_VOLUME_CONTROL 0x02
#define | AUDIO_FREQ_SET_CONTROL 0x03
#define | AUDIO_DESCRIPTOR_TYPE 0x21
audio descriptor type
#define | AUDIO_DESCRIPTOR_SIZE 0x09

Functions

usb_sts_type audio_hid_class_send_report (void *udev, uint8_t *report, uint16_t len)
usb device class send report

Variables

usbd_class_handler audio_hid_class_handler


AT32F413 Firmwary Library: audio_hid_desc.c File Reference

  • middlewares
  • usbd_class
  • audio_hid
Functions | Variables
audio_hid_desc.c File Reference
#include "usb_std.h"
#include "usbd_sdr.h"
#include "usbd_core.h"
#include "audio_hid_desc.h"

Go to the source code of this file.

Functions

static usbd_desc_t * | get_device_descriptor (void)
get device descriptor
static usbd_desc_t * | get_device_qualifier (void)
get device qualifier
static usbd_desc_t * | get_device_configuration (void)
get config descriptor
static usbd_desc_t * | get_device_other_speed (void)
get other speed descriptor
static usbd_desc_t * | get_device_lang_id (void)
get lang id descriptor
static usbd_desc_t * | get_device_manufacturer_string (void)
get manufacturer descriptor
static usbd_desc_t * | get_device_product_string (void)
get product descriptor
static usbd_desc_t * | get_device_serial_string (void)
get serial descriptor
static usbd_desc_t * | get_device_interface_string (void)
get interface descriptor
static usbd_desc_t * | get_device_config_string (void)
get device config descriptor
static uint16_t | usbd_unicode_convert (uint8_t *string, uint8_t *unicode_buf)
standard usb unicode convert
static void | usbd_int_to_unicode (uint32_t value, uint8_t *pbuf, uint8_t len)
usb int convert to unicode
static void | get_serial_num (void)
usb get serial number

Variables

static ALIGNED_HEAD uint8_t g_usbd_desc_buffer[256] | ALIGNED_TAIL
usb device standard descriptor
usbd_desc_handler audio_hid_desc_handler
device descriptor handler structure
static usbd_desc_t | device_descriptor
static usbd_desc_t | config_descriptor
static usbd_desc_t | langid_descriptor
static usbd_desc_t | serial_descriptor
static usbd_desc_t | vp_desc


AT32F413 Firmwary Library: audio_hid_desc.h File Reference

  • middlewares
  • usbd_class
  • audio_hid
Macros | Variables
audio_hid_desc.h File Reference
#include "audio_hid_class.h"
#include "usbd_core.h"
#include "audio_conf.h"

Go to the source code of this file.

Macros

#define | AUHID_BCD_NUM 0x0100
#define | USBD_AUHID_VENDOR_ID 0x2E3C
#define | USBD_AUHID_PRODUCT_ID 0x5555
#define | USBD_AUHID_SIZ_STRING_LANGID 4
#define | USBD_AUHID_SIZ_STRING_SERIAL 0x1A
#define | USBD_AUHID_DESC_MANUFACTURER_STRING "Artery"
#define | USBD_AUHID_DESC_PRODUCT_STRING "AT32 Audio"
#define | USBD_AUHID_DESC_CONFIGURATION_STRING "Audio Config"
#define | USBD_AUHID_DESC_INTERFACE_STRING "Audio Interface"
#define | AUDIO_SUBCLASS_UNDEFINED 0x00
audio interface subclass codes
#define | AUDIO_SUBCLASS_AUDIOCONTROL 0x01
#define | AUDIO_SUBCLASS_AUDIOSTREAMING 0x02
#define | AUDIO_SUBCLASS_MIDISTREMING 0x03
#define | AUDIO_CS_INTERFACE 0x24
audio class-specific descriptor types
#define | AUDIO_CS_ENDPOINT 0x25
#define | AUDIO_CS_STRING 0x23
#define | AUDIO_CS_CONFIGURATION 0x22
#define | AUDIO_CS_DEVICE 0x21
#define | AUDIO_CS_UNDEFINED 0x20
#define | AUDIO_PROTOCOL_UNDEFINED 0x00
audio interface protocol codes
#define | AUDIO_AC_DESCRIPTOR_UNDEFINED 0x00
audio class-specific ac interface descriptor subtypes
#define | AUDIO_AC_HEADER 0x01
#define | AUDIO_AC_INPUT_TERMINAL 0x02
#define | AUDIO_AC_OUTPUT_TERMINAL 0x03
#define | AUDIO_AC_MIXER_UNIT 0x04
#define | AUDIO_AC_SELECTOR_UNIT 0x05
#define | AUDIO_AC_FEATURE_UNIT 0x06
#define | AUDIO_AC_PROCESSING_UNIT 0x07
#define | AUDIO_AC_EXTENSION_UNIT 0x08
#define | AUDIO_AS_DESCRIPTOR_UNDEFINED 0x00
audio class-specific as interface descriptor subtypes
#define | AUDIO_AS_GENERAL 0x01
#define | AUDIO_AS_FORMAT_TYPE 0x02
#define | AUDIO_AS_FORMAT_SPECIFIC 0x03
#define | AUDIO_REQUEST_CODE_UNDEFINED 0x00
audio class-specific request codes
#define | AUDIO_REQ_SET_CUR 0x01
#define | AUDIO_REQ_GET_CUR 0x81
#define | AUDIO_REQ_SET_MIN 0x02
#define | AUDIO_REQ_GET_MIN 0x82
#define | AUDIO_REQ_SET_MAX 0x03
#define | AUDIO_REQ_GET_MAX 0x83
#define | AUDIO_REQ_SET_RES 0x04
#define | AUDIO_REQ_GET_RES 0x84
#define | AUDIO_REQ_SET_MEM 0x05
#define | AUDIO_REQ_GET_MEM 0x85
#define | AUDIO_REQ_GET_STAT 0xFF
#define | AUDIO_FU_CONTROL_UNDEFINED 0x00
audio feature unit control selectors
#define | AUDIO_FU_MUTE_CONTROL 0x01
#define | AUDIO_FU_VOLUME_CONTROL 0x02
#define | AUDIO_FU_BASS_CONTROL 0x03
#define | AUDIO_FU_MID_CONTROL 0x04
#define | AUDIO_FU_TREBLE_CONTROL 0x05
#define | AUDIO_TERMINAL_TYPE_UNDEFINED 0x0100
audio terminal type
#define | AUDIO_TERMINAL_TYPE_STREAMING 0x0101
#define | AUDIO_TERMINAL_TYPE_VENDOR 0x01FF
#define | AUDIO_INPUT_TERMINAL_UNDEFINED 0x0200
#define | AUDIO_INPUT_TERMINAL_MICROPHONE 0x0201
#define | AUDIO_OUTPUT_TERMINAL_UNDEFINED 0x0300
#define | AUDIO_OUTPUT_TERMINAL_SPEAKER 0x0301
#define | AUDIO_FORMAT_TYPE_I 0x01
audio format type 1
#define | AUDIO_INTERFACE_NUM (AUDIO_SUPPORT_SPK + AUDIO_SUPPORT_MIC)
audio interface config
#define | AUDIO_INTERFACE_LEN ((0x08 + AUDIO_INTERFACE_NUM) + AUDIO_INTERFACE_NUM * 0x22)
#define | AUDIO_MIC_INTERFACE 0x01
#define | AUDIO_SPK_INTERFACE 0x02
#define | AUDIO_INPUT_TERMINAL_SIZE 0x0C
audio interface descriptor size define
#define | AUDIO_OUTPUT_TERMINAL_SIZE 0x09
#define | AUDIO_FEATURE_UNIT_SIZE 0x0D
#define | AUDIO_MIC_INPUT_TERMINAL_ID 0x01
audio terminal id define
#define | AUDIO_MIC_FEATURE_UNIT_ID 0x02
#define | AUDIO_MIC_OUTPUT_TERMINAL_ID 0x03
#define | AUDIO_SPK_INPUT_TERMINAL_ID 0x04
#define | AUDIO_SPK_FEATURE_UNIT_ID 0x05
#define | AUDIO_SPK_OUTPUT_TERMINAL_ID 0x06
#define | AUDIO_MIC_INTERFACE_NUMBER 0x01
audio interface number
#define | AUDIO_SPK_INTERFACE_NUMBER 0x02
#define | HID_INTERFACE_NUMBER 0x03
#define | AT32_AUDIO_FREQ_16K 16000
audio support freq
#define | AT32_AUDIO_FREQ_48K 48000
#define | AUDIO_MIC_FREQ_SIZE (AUDIO_SUPPORT_FREQ)
audio microphone freq and channel config
#define | AUDIO_MIC_CHR AUDIO_MIC_CHANEL_NUM
#define | AUDIO_MIC_BITW (AUDIO_MIC_DEFAULT_BITW)
#define | AUDIO_SPK_FREQ_SIZE (AUDIO_SUPPORT_FREQ)
audio speaker freq and channel config
#define | AUDIO_SPK_CHR AUDIO_SPK_CHANEL_NUM
#define | AUDIO_SPK_BITW (AUDIO_SPK_DEFAULT_BITW)
#define | AUHID_HID_BINTERVAL_TIME 0x01
#define | AUHID_HID_BCD_NUM 0x0110
usb bcd number define
#define | HID_CLASS_DESC_HID 0x21
usb hid class descriptor define
#define | HID_CLASS_DESC_REPORT 0x22
#define | HID_CLASS_DESC_PHYSICAL 0x23
#define | HID_REPORT_ID_1 0x01
usb hid report id define
#define | HID_REPORT_ID_2 0x02
#define | HID_REPORT_ID_3 0x03
#define | HID_REPORT_ID_4 0x04
#define | HID_REPORT_ID_5 0x05
#define | HID_REPORT_ID_6 0xF0
#define | MCU_ID1 (0x1FFFF7E8)
#define | MCU_ID2 (0x1FFFF7EC)
#define | MCU_ID3 (0x1FFFF7F0)
#define | SAMPLE_FREQ(frq)
#define | USBD_AUHID_HID_SIZ_REPORT_DESC 126
#define | USBD_AUHID_HID_DESC_SIZE 32
#define | USBD_AUHID_CONFIG_DESC_SIZE

Variables

uint8_t | g_usbd_audio_hid_report [126]
uint8_t | g_audio_hid_usb_desc [9]
usbd_desc_handler audio_hid_desc_handler
device descriptor handler structure


AT32F413 Firmwary Library: cdc Directory Reference

  • middlewares
  • usbd_class
  • cdc
cdc Directory Reference

Files

cdc_class.c
usb cdc class type
cdc_class.h
usb cdc class file
cdc_desc.c
usb cdc device descriptor
cdc_desc.h
usb cdc descriptor header file


AT32F413 Firmwary Library: cdc_class.c File Reference

  • middlewares
  • usbd_class
  • cdc
Functions | Variables
cdc_class.c File Reference

usb cdc class type More...

#include "usbd_core.h"
#include "cdc_class.h"
#include "cdc_desc.h"

Go to the source code of this file.

Functions

static usb_sts_type | class_init_handler (void *udev)
initialize usb endpoint
static usb_sts_type | class_clear_handler (void *udev)
clear endpoint or other state
static usb_sts_type | class_setup_handler (void *udev, usb_setup_type *setup)
usb device class setup request handler
static usb_sts_type | class_ept0_tx_handler (void *udev)
usb device class endpoint 0 in status stage complete
static usb_sts_type | class_ept0_rx_handler (void *udev)
usb device class endpoint 0 out status stage complete
static usb_sts_type | class_in_handler (void *udev, uint8_t ept_num)
usb device class transmision complete handler
static usb_sts_type | class_out_handler (void *udev, uint8_t ept_num)
usb device class endpoint receive data
static usb_sts_type | class_sof_handler (void *udev)
usb device class sof handler
static usb_sts_type | class_event_handler (void *udev, usbd_event_type event)
usb device class event handler
static usb_sts_type | cdc_struct_init (cdc_struct_type *pcdc)
usb device cdc init
void | usb_usart_config (linecoding_type linecoding)
this function handles usart2 and linecoding config.
static void | usb_vcp_cmd_process (void *udev, uint8_t cmd, uint8_t *buff, uint16_t len)
usb device class request function
uint16_t | usb_vcp_get_rxdata (void *udev, uint8_t *recv_data)
usb device class rx data process
error_status | usb_vcp_send_data (void *udev, uint8_t *send_data, uint16_t len)
usb device class send data

Variables

linecoding_type linecoding
cdc_struct_type cdc_struct
usbd_class_handler cdc_class_handler

Detailed Description

usb cdc class type

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file cdc_class.c.


AT32F413 Firmwary Library: cdc_class.h File Reference

  • middlewares
  • usbd_class
  • cdc
Data Structures | Macros | Functions | Variables
cdc_class.h File Reference

usb cdc class file More...

#include "usb_std.h"
#include "usbd_core.h"

Go to the source code of this file.

Data Structures

struct cdc_struct_type
usb cdc class struct More...

Macros

#define | USBD_CDC_INT_EPT 0x82
usb cdc use endpoint define
#define | USBD_CDC_BULK_IN_EPT 0x81
#define | USBD_CDC_BULK_OUT_EPT 0x01
#define | USBD_CDC_IN_MAXPACKET_SIZE 0x40
usb cdc in and out max packet size define
#define | USBD_CDC_OUT_MAXPACKET_SIZE 0x40
#define | USBD_CDC_CMD_MAXPACKET_SIZE 0x08

Functions

uint16_t | usb_vcp_get_rxdata (void *udev, uint8_t *recv_data)
usb device class rx data process
error_status | usb_vcp_send_data (void *udev, uint8_t *send_data, uint16_t len)
usb device class send data

Variables

usbd_class_handler cdc_class_handler

Detailed Description

usb cdc class file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file cdc_class.h.


AT32F413 Firmwary Library: cdc_desc.c File Reference

  • middlewares
  • usbd_class
  • cdc
Functions | Variables
cdc_desc.c File Reference

usb cdc device descriptor More...

#include "usb_std.h"
#include "usbd_sdr.h"
#include "usbd_core.h"
#include "cdc_desc.h"

Go to the source code of this file.

Functions

static usbd_desc_t * | get_device_descriptor (void)
get device descriptor
static usbd_desc_t * | get_device_qualifier (void)
get device qualifier
static usbd_desc_t * | get_device_configuration (void)
get config descriptor
static usbd_desc_t * | get_device_other_speed (void)
get other speed descriptor
static usbd_desc_t * | get_device_lang_id (void)
get lang id descriptor
static usbd_desc_t * | get_device_manufacturer_string (void)
get manufacturer descriptor
static usbd_desc_t * | get_device_product_string (void)
get product descriptor
static usbd_desc_t * | get_device_serial_string (void)
get serial descriptor
static usbd_desc_t * | get_device_interface_string (void)
get interface descriptor
static usbd_desc_t * | get_device_config_string (void)
get device config descriptor
static uint16_t | usbd_unicode_convert (uint8_t *string, uint8_t *unicode_buf)
standard usb unicode convert
static void | usbd_int_to_unicode (uint32_t value, uint8_t *pbuf, uint8_t len)
usb int convert to unicode
static void | get_serial_num (void)
usb get serial number

Variables

static ALIGNED_HEAD uint8_t g_usbd_desc_buffer[256] | ALIGNED_TAIL
usb device standard descriptor
usbd_desc_handler cdc_desc_handler
device descriptor handler structure
static usbd_desc_t | device_descriptor
static usbd_desc_t | config_descriptor
static usbd_desc_t | langid_descriptor
static usbd_desc_t | serial_descriptor
static usbd_desc_t | vp_desc

Detailed Description

usb cdc device descriptor

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file cdc_desc.c.


AT32F413 Firmwary Library: cdc_desc.h File Reference

  • middlewares
  • usbd_class
  • cdc
Macros | Variables
cdc_desc.h File Reference

usb cdc descriptor header file More...

#include "cdc_class.h"
#include "usbd_core.h"

Go to the source code of this file.

Macros

#define | CDC_BCD_NUM 0x0110
usb bcd number define
#define | USBD_CDC_VENDOR_ID 0x2E3C
usb vendor id and product id define
#define | USBD_CDC_PRODUCT_ID 0x5740
#define | USBD_CDC_CONFIG_DESC_SIZE 67
usb descriptor size define
#define | USBD_CDC_SIZ_STRING_LANGID 4
#define | USBD_CDC_SIZ_STRING_SERIAL 0x1A
#define | USBD_CDC_DESC_MANUFACTURER_STRING "Artery"
usb string define(vendor, product configuration, interface)
#define | USBD_CDC_DESC_PRODUCT_STRING "AT32 Virtual Com Port "
#define | USBD_CDC_DESC_CONFIGURATION_STRING "Virtual ComPort Config"
#define | USBD_CDC_DESC_INTERFACE_STRING "Virtual ComPort Interface"
#define | CDC_HID_BINTERVAL_TIME 0xFF
usb endpoint interval define
#define | MCU_ID1 (0x1FFFF7E8)
usb mcu id address deine
#define | MCU_ID2 (0x1FFFF7EC)
#define | MCU_ID3 (0x1FFFF7F0)

Variables

usbd_desc_handler cdc_desc_handler
device descriptor handler structure

Detailed Description

usb cdc descriptor header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file cdc_desc.h.


AT32F413 Firmwary Library: composite_cdc_keyboard Directory Reference

  • middlewares
  • usbd_class
  • composite_cdc_keyboard
composite_cdc_keyboard Directory Reference

Files

cdc_keyboard_class.c
usb cdc and keyboard class type
cdc_keyboard_class.h
usb cdc and keyboard class file
cdc_keyboard_desc.c
usb cdc and keyboard device descriptor
cdc_keyboard_desc.h
usb cdc and keyboard descriptor header file


AT32F413 Firmwary Library: cdc_keyboard_class.c File Reference

  • middlewares
  • usbd_class
  • composite_cdc_keyboard
Macros | Functions | Variables
cdc_keyboard_class.c File Reference

usb cdc and keyboard class type More...

#include "usbd_core.h"
#include "cdc_keyboard_class.h"
#include "cdc_keyboard_desc.h"

Go to the source code of this file.

Macros

#define SHIFT 0x80

Functions

static usb_sts_type | class_init_handler (void *udev)
initialize usb endpoint
static usb_sts_type | class_clear_handler (void *udev)
clear endpoint or other state
static usb_sts_type | class_setup_handler (void *udev, usb_setup_type *setup)
usb device class setup request handler
static usb_sts_type | class_ept0_tx_handler (void *udev)
usb device class endpoint 0 in status stage complete
static usb_sts_type | class_ept0_rx_handler (void *udev)
usb device class endpoint 0 out status stage complete
static usb_sts_type | class_in_handler (void *udev, uint8_t ept_num)
usb device class transmision complete handler
static usb_sts_type | class_out_handler (void *udev, uint8_t ept_num)
usb device class endpoint receive data
static usb_sts_type | class_sof_handler (void *udev)
usb device class sof handler
static usb_sts_type | class_event_handler (void *udev, usbd_event_type event)
usb device class event handler
static usb_sts_type | cdc_class_setup_handler (void *udev, usb_setup_type *setup)
usb device class setup request handler
static usb_sts_type | keyboard_class_setup_handler (void *udev, usb_setup_type *setup)
usb device class setup request handler
static void | usb_vcp_cmd_process (void *udev, uint8_t cmd, uint8_t *buff, uint16_t len)
usb device class request function
uint16_t | usb_vcpkybrd_vcp_get_rxdata (void *udev, uint8_t *recv_data)
usb device class rx data process
error_status | usb_vcpkybrd_vcp_send_data (void *udev, uint8_t *send_data, uint16_t len)
usb device class send data
usb_sts_type | usb_vcpkybrd_class_send_report (void *udev, uint8_t *report, uint16_t len)
usb device class send report
void | usb_vcpkybrd_keyboard_send_char (void *udev, uint8_t ascii_code)
usb keyoard send char

Variables

vcp_keyboard_type vcp_keyboard_struct
static const unsigned char _asciimap [128]
linecoding_type linecoding_vcpkybrd
usbd_class_handler cdc_keyboard_class_handler

Detailed Description

usb cdc and keyboard class type

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file cdc_keyboard_class.c.


AT32F413 Firmwary Library: cdc_keyboard_class.h File Reference

  • middlewares
  • usbd_class
  • composite_cdc_keyboard
Data Structures | Macros | Functions | Variables
cdc_keyboard_class.h File Reference

usb cdc and keyboard class file More...

#include "usb_std.h"
#include "usbd_core.h"

Go to the source code of this file.

Data Structures

struct vcp_keyboard_type

Macros

#define | USBD_VCPKYBRD_CDC_INT_EPT 0x82
usb use endpoint define
#define | USBD_VCPKYBRD_CDC_BULK_IN_EPT 0x81
#define | USBD_VCPKYBRD_CDC_BULK_OUT_EPT 0x01
#define | USBD_VCPKYBRD_HID_IN_EPT 0x83
#define | USBD_VCPKYBRD_IN_MAXPACKET_SIZE 0x40
usb in and out max packet size define
#define | USBD_VCPKYBRD_OUT_MAXPACKET_SIZE 0x40
#define | USBD_VCPKYBRD_CMD_MAXPACKET_SIZE 0x08

Functions

uint16_t | usb_vcpkybrd_vcp_get_rxdata (void *udev, uint8_t *recv_data)
usb device class rx data process
error_status | usb_vcpkybrd_vcp_send_data (void *udev, uint8_t *send_data, uint16_t len)
usb device class send data
usb_sts_type | usb_vcpkybrd_class_send_report (void *udev, uint8_t *report, uint16_t len)
usb device class send report
void | usb_vcpkybrd_keyboard_send_char (void *udev, uint8_t ascii_code)
usb keyoard send char

Variables

usbd_class_handler cdc_keyboard_class_handler

Detailed Description

usb cdc and keyboard class file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file cdc_keyboard_class.h.


AT32F413 Firmwary Library: cdc_keyboard_desc.c File Reference

  • middlewares
  • usbd_class
  • composite_cdc_keyboard
Functions | Variables
cdc_keyboard_desc.c File Reference

usb cdc and keyboard device descriptor More...

#include "usb_std.h"
#include "usbd_sdr.h"
#include "usbd_core.h"
#include "cdc_keyboard_desc.h"

Go to the source code of this file.

Functions

static usbd_desc_t * | get_device_descriptor (void)
get device descriptor
static usbd_desc_t * | get_device_qualifier (void)
get device qualifier
static usbd_desc_t * | get_device_configuration (void)
get config descriptor
static usbd_desc_t * | get_device_other_speed (void)
get other speed descriptor
static usbd_desc_t * | get_device_lang_id (void)
get lang id descriptor
static usbd_desc_t * | get_device_manufacturer_string (void)
get manufacturer descriptor
static usbd_desc_t * | get_device_product_string (void)
get product descriptor
static usbd_desc_t * | get_device_serial_string (void)
get serial descriptor
static usbd_desc_t * | get_device_interface_string (void)
get interface descriptor
static usbd_desc_t * | get_device_config_string (void)
get device config descriptor
static uint16_t | usbd_unicode_convert (uint8_t *string, uint8_t *unicode_buf)
standard usb unicode convert
static void | usbd_int_to_unicode (uint32_t value, uint8_t *pbuf, uint8_t len)
usb int convert to unicode
static void | get_serial_num (void)
usb get serial number

Variables

static ALIGNED_HEAD uint8_t g_usbd_desc_buffer[256] | ALIGNED_TAIL
usb device standard descriptor
usbd_desc_handler cdc_keyboard_desc_handler
device descriptor handler structure
static usbd_desc_t | device_descriptor
static usbd_desc_t | config_descriptor
static usbd_desc_t | langid_descriptor
static usbd_desc_t | serial_descriptor
static usbd_desc_t | vp_desc

Detailed Description

usb cdc and keyboard device descriptor

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file cdc_keyboard_desc.c.


AT32F413 Firmwary Library: cdc_keyboard_desc.h File Reference

  • middlewares
  • usbd_class
  • composite_cdc_keyboard
Macros | Variables
cdc_keyboard_desc.h File Reference

usb cdc and keyboard descriptor header file More...

#include "cdc_keyboard_class.h"
#include "usbd_core.h"

Go to the source code of this file.

Macros

#define | VCPKYBRD_BCD_NUM 0x0110
usb bcd number define
#define | USBD_VCPKYBRD_VENDOR_ID 0x2E3C
usb vendor id and product id define
#define | USBD_VCPKYBRD_PRODUCT_ID 0x5750
#define | USBD_VCPKYBRD_CONFIG_DESC_SIZE 108
usb descriptor size define
#define | USBD_VCPKYBRD_HID_SIZ_REPORT_DESC 63
#define | USBD_VCPKYBRD_SIZ_STRING_LANGID 4
#define | USBD_VCPKYBRD_SIZ_STRING_SERIAL 0x1A
#define | USBD_VCPKYBRD_DESC_MANUFACTURER_STRING "Artery"
usb string define(vendor, product configuration, interface)
#define | USBD_VCPKYBRD_DESC_PRODUCT_STRING "AT32 Composite VCP and Keyboard"
#define | USBD_VCPKYBRD_DESC_CONFIGURATION_STRING "Composite VCP and Keyboard Config"
#define | USBD_VCPKYBRD_DESC_INTERFACE_STRING "Composite VCP and Keyboard Interface"
#define | VCPKYBRD_HID_BINTERVAL_TIME 0x0A
usb endpoint interval define
#define | VCPKYBRD_CDC_INTERFACE 0x00
usb interface define
#define | VCPKYBRD_CDC_DATA_INTERFACE 0x01
#define | VCPKYBRD_KEYBOARD_INTERFACE 0x02
#define | MCU_ID1 (0x1FFFF7E8)
usb mcu id address deine
#define | MCU_ID2 (0x1FFFF7EC)
#define | MCU_ID3 (0x1FFFF7F0)

Variables

uint8_t | g_usbd_vcpkybrd_hid_report [63]
uint8_t | g_vcpkybrd_hid_usb_desc [9]
usbd_desc_handler cdc_keyboard_desc_handler
device descriptor handler structure

Detailed Description

usb cdc and keyboard descriptor header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file cdc_keyboard_desc.h.


AT32F413 Firmwary Library: composite_cdc_msc Directory Reference

  • middlewares
  • usbd_class
  • composite_cdc_msc
composite_cdc_msc Directory Reference

Files

cdc_msc_class.c
usb cdc class type
cdc_msc_class.h
usb cdc class file
cdc_msc_desc.c
usb cdc device descriptor
cdc_msc_desc.h
usb cdc descriptor header file
msc_bot_scsi.c
usb mass storage bulk-only transport and scsi command


AT32F413 Firmwary Library: cdc_msc_class.c File Reference

  • middlewares
  • usbd_class
  • composite_cdc_msc
Functions | Variables
cdc_msc_class.c File Reference

usb cdc class type More...

#include "usbd_core.h"
#include "cdc_msc_class.h"
#include "cdc_msc_desc.h"

Go to the source code of this file.

Functions

static usb_sts_type | class_init_handler (void *udev)
initialize usb custom hid endpoint
static usb_sts_type | class_clear_handler (void *udev)
clear endpoint or other state
static usb_sts_type | class_setup_handler (void *udev, usb_setup_type *setup)
usb device class setup request handler
static usb_sts_type | class_ept0_tx_handler (void *udev)
usb device endpoint 0 in status stage complete
static usb_sts_type | class_ept0_rx_handler (void *udev)
usb device endpoint 0 out status stage complete
static usb_sts_type | class_in_handler (void *udev, uint8_t ept_num)
usb device transmision complete handler
static usb_sts_type | class_out_handler (void *udev, uint8_t ept_num)
usb device endpoint receive data
static usb_sts_type | class_sof_handler (void *udev)
usb device sof handler
static usb_sts_type | class_event_handler (void *udev, usbd_event_type event)
usb device event handler
static usb_sts_type | cdc_struct_init (cdc_msc_struct_type *pcdc)
usb device cdc init
void | usb_usart_config (linecoding_type linecoding)
this function handles usart2 and linecoding config.
static void | usb_vcp_cmd_process (void *udev, uint8_t cmd, uint8_t *buff, uint16_t len)
usb device function
static usb_sts_type | cdc_class_setup_handler (void *udev, usb_setup_type *setup)
usb device class setup request handler
static usb_sts_type | msc_class_setup_handler (void *udev, usb_setup_type *setup)
usb device class setup request handler
uint16_t | usb_vcp_get_rxdata (void *udev, uint8_t *recv_data)
usb device class rx data process
error_status | usb_vcp_send_data (void *udev, uint8_t *send_data, uint16_t len)
usb device class send data

Variables

linecoding_type linecoding
cdc_msc_struct_type cdc_msc_struct
usbd_class_handler cdc_msc_class_handler

Detailed Description

usb cdc class type

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file cdc_msc_class.c.


AT32F413 Firmwary Library: cdc_msc_class.h File Reference

  • middlewares
  • usbd_class
  • composite_cdc_msc
Data Structures | Macros | Functions | Variables
cdc_msc_class.h File Reference

usb cdc class file More...

#include "usb_std.h"
#include "usbd_core.h"

Go to the source code of this file.

Data Structures

struct | cbd_typical_type
typical command block description More...
struct | cbd_extended_type
extended command block description More...
struct | cbw_type
command block wrapper More...
struct | csw_type
command block wrapper More...
struct | sense_type
request sense standard data More...
struct | msc_type
struct | cdc_msc_struct_type
usb cdc class struct More...

Macros

#define | USBD_CDC_INT_EPT 0x82
usb cdc use endpoint define
#define | USBD_CDC_BULK_IN_EPT 0x83
#define | USBD_CDC_BULK_OUT_EPT 0x02
#define | USBD_MSC_BULK_IN_EPT 0x81
#define | USBD_MSC_BULK_OUT_EPT 0x01
#define | USBD_CDC_MSC_IN_MAXPACKET_SIZE 0x40
usb cdc in and out max packet size define
#define | USBD_CDC_MSC_OUT_MAXPACKET_SIZE 0x40
#define | USBD_CDC_CMD_MAXPACKET_SIZE 0x08
#define | MSC_SUPPORT_MAX_LUN 1
#define | MSC_MAX_DATA_BUF_LEN 4096
#define | MSC_CMD_FORMAT_UNIT 0x04
#define | MSC_CMD_INQUIRY 0x12
#define | MSC_CMD_START_STOP 0x1B
#define | MSC_CMD_MODE_SENSE6 0x1A
#define | MSC_CMD_MODE_SENSE10 0x5A
#define | MSC_CMD_ALLOW_MEDIUM_REMOVAL 0x1E
#define | MSC_CMD_READ_10 0x28
#define | MSC_CMD_READ_12 0xA8
#define | MSC_CMD_READ_CAPACITY 0x25
#define | MSC_CMD_READ_FORMAT_CAPACITY 0x23
#define | MSC_CMD_REQUEST_SENSE 0x03
#define | MSC_CMD_TEST_UNIT 0x00
#define | MSC_CMD_VERIFY 0x2F
#define | MSC_CMD_WRITE_10 0x2A
#define | MSC_CMD_WRITE_12 0xAA
#define | MSC_CMD_WRITE_VERIFY 0x2E
#define | MSC_REQ_GET_MAX_LUN 0xFE
#define | MSC_REQ_BO_RESET 0xFF
#define | SET_LINE_CODING 0x20
#define | GET_LINE_CODING 0x21
#define | CBW_CMD_LENGTH 31
#define | CBW_DCBWSIGNATURE 0x43425355
#define | CBW_BMCBWFLAGS_DIR_OUT 0x00
#define | CBW_BMCBWFLAGS_DIR_IN 0x80
#define | CSW_CMD_LENGTH 13
#define | CSW_DCSWSIGNATURE 0x53425355
#define | CSW_BCSWSTATUS_PASS 0x00
#define | CSW_BCSWSTATUS_FAILED 0x01
#define | CSW_BCSWSTATUS_PHASE_ERR 0x02
#define | MSC_STATE_MACHINE_CMD 0x00
#define | MSC_STATE_MACHINE_DATA_IN 0x01
#define | MSC_STATE_MACHINE_DATA_OUT 0x02
#define | MSC_STATE_MACHINE_SEND_DATA 0x03
#define | MSC_STATE_MACHINE_LAST_DATA 0x04
#define | MSC_STATE_MACHINE_STATUS 0x05
#define | MSC_STATE_MACHINE_FAILED 0x06
#define | MSC_STATE_MACHINE_IDLE 0x07
#define | MSC_BOT_STATE_IDLE 0x00
#define | MSC_BOT_STATE_RECOVERY 0x01
#define | MSC_BOT_STATE_ERROR 0x02
#define | REQ_SENSE_STANDARD_DATA_LEN 0x12
#define | SENSE_KEY_NO_SENSE 0x00
#define | SENSE_KEY_RECOVERED_ERROR 0x01
#define | SENSE_KEY_NOT_READY 0x02
#define | SENSE_KEY_MEDIUM_ERROR 0x03
#define | SENSE_KEY_HARDWARE_ERROR 0x04
#define | SENSE_KEY_ILLEGAL_REQUEST 0x05
#define | SENSE_KEY_UNIT_ATTENTION 0x06
#define | SENSE_KEY_DATA_PROTECT 0x07
#define | SENSE_KEY_BLANK_CHECK 0x08
#define | SENSE_KEY_VENDERO_SPECIFIC 0x09
#define | SENSE_KEY_ABORTED_COMMAND 0x0B
#define | SENSE_KEY_VOLUME_OVERFLOW 0x0D
#define | SENSE_KEY_MISCOMPARE 0x0E
#define | INVALID_COMMAND 0x20
#define | INVALID_FIELED_IN_COMMAND 0x24
#define | PARAMETER_LIST_LENGTH_ERROR 0x1A
#define | INVALID_FIELD_IN_PARAMETER_LIST 0x26
#define | ADDRESS_OUT_OF_RANGE 0x21
#define | MEDIUM_NOT_PRESENT 0x3A
#define | MEDIUM_HAVE_CHANGED 0x28
#define | SCSI_INQUIRY_DATA_LENGTH 36

Functions

uint16_t | usb_vcp_get_rxdata (void *udev, uint8_t *recv_data)
usb device class rx data process
error_status | usb_vcp_send_data (void *udev, uint8_t *send_data, uint16_t len)
usb device class send data
void | bot_scsi_init (void *udev)
initialize bulk-only transport and scsi
void | bot_scsi_reset (void *udev)
reset bulk-only transport and scsi
void | bot_scsi_datain_handler (void *pudev, uint8_t ept_num)
bulk-only transport data in handler
void | bot_scsi_dataout_handler (void *pudev, uint8_t ept_num)
bulk-only transport data out handler
void | bot_cbw_decode (void *udev)
bulk-only cbw decode
void | bot_scsi_send_data (void *udev, uint8_t *buffer, uint32_t len)
send bot data
void | bot_scsi_send_csw (void *udev, uint8_t status)
send command status
void | bot_scsi_sense_code (void *udev, uint8_t sense_key, uint8_t asc)
send scsi sense code
usb_sts_type | bot_scsi_check_address (void *udev, uint8_t lun, uint32_t blk_offset, uint32_t blk_count)
check address
void | bot_scsi_stall (void *udev)
bot endpoint stall
usb_sts_type | bot_scsi_cmd_process (void *udev)
bulk-only transport scsi command process
usb_sts_type | bot_scsi_test_unit (void *udev, uint8_t lun)
bulk-only transport scsi command test unit
usb_sts_type | bot_scsi_inquiry (void *udev, uint8_t lun)
bulk-only transport scsi command inquiry
usb_sts_type | bot_scsi_start_stop (void *udev, uint8_t lun)
bulk-only transport scsi command start stop
usb_sts_type | bot_scsi_allow_medium_removal (void *udev, uint8_t lun)
bulk-only transport scsi command meidum removal
usb_sts_type | bot_scsi_mode_sense6 (void *udev, uint8_t lun)
bulk-only transport scsi command mode sense6
usb_sts_type | bot_scsi_mode_sense10 (void *udev, uint8_t lun)
bulk-only transport scsi command mode sense10
usb_sts_type | bot_scsi_read10 (void *udev, uint8_t lun)
bulk-only transport scsi command read10
usb_sts_type | bot_scsi_capacity (void *udev, uint8_t lun)
bulk-only transport scsi command capacity
usb_sts_type | bot_scsi_format_capacity (void *udev, uint8_t lun)
bulk-only transport scsi command format capacity
usb_sts_type | bot_scsi_request_sense (void *udev, uint8_t lun)
bulk-only transport scsi command request sense
usb_sts_type | bot_scsi_verify (void *udev, uint8_t lun)
bulk-only transport scsi command verify
usb_sts_type | bot_scsi_write10 (void *udev, uint8_t lun)
bulk-only transport scsi command write10
void | bot_scsi_clear_feature (void *udev, uint8_t ept_num)
clear feature

Variables

usbd_class_handler cdc_msc_class_handler

Detailed Description

usb cdc class file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file cdc_msc_class.h.


AT32F413 Firmwary Library: cdc_msc_desc.c File Reference

  • middlewares
  • usbd_class
  • composite_cdc_msc
Macros | Functions | Variables
cdc_msc_desc.c File Reference

usb cdc device descriptor More...

#include "stdio.h"
#include "usb_std.h"
#include "usbd_sdr.h"
#include "usbd_core.h"
#include "cdc_msc_desc.h"

Go to the source code of this file.

Macros

#define USB_INTERFACE_ASSOCIATION_TYPE 0x0B

Functions

static usbd_desc_t * | get_device_descriptor (void)
get device descriptor
static usbd_desc_t * | get_device_qualifier (void)
get device qualifier
static usbd_desc_t * | get_device_configuration (void)
get config descriptor
static usbd_desc_t * | get_device_other_speed (void)
get other speed descriptor
static usbd_desc_t * | get_device_lang_id (void)
get lang id descriptor
static usbd_desc_t * | get_device_manufacturer_string (void)
get manufacturer descriptor
static usbd_desc_t * | get_device_product_string (void)
get product descriptor
static usbd_desc_t * | get_device_serial_string (void)
get serial descriptor
static usbd_desc_t * | get_device_interface_string (void)
get interface descriptor
static usbd_desc_t * | get_device_config_string (void)
get device config descriptor
static uint16_t | usbd_unicode_convert (uint8_t *string, uint8_t *unicode_buf)
standard usb unicode convert
static void | usbd_int_to_unicode (uint32_t value, uint8_t *pbuf, uint8_t len)
usb int convert to unicode
static void | get_serial_num (void)
usb get serial number

Variables

static ALIGNED_HEAD uint8_t g_usbd_desc_buffer[256] | ALIGNED_TAIL
usb device standard descriptor
usbd_desc_handler cdc_msc_desc_handler
device descriptor handler structure
static usbd_desc_t | device_descriptor
static usbd_desc_t | config_descriptor
static usbd_desc_t | langid_descriptor
static usbd_desc_t | serial_descriptor
static usbd_desc_t | vp_desc

Detailed Description

usb cdc device descriptor

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file cdc_msc_desc.c.


AT32F413 Firmwary Library: cdc_msc_desc.h File Reference

  • middlewares
  • usbd_class
  • composite_cdc_msc
Macros | Variables
cdc_msc_desc.h File Reference

usb cdc descriptor header file More...

#include "cdc_msc_class.h"
#include "usbd_core.h"

Go to the source code of this file.

Macros

#define | CDC_BCD_NUM 0x0110
usb bcd number define
#define | USBD_CDC_MSC_VENDOR_ID 0x2E3C
usb vendor id and product id define
#define | USBD_CDC_MSC_PRODUCT_ID 0x5760
#define | USBD_CDC_MSC_CONFIG_DESC_SIZE 106
usb descriptor size define
#define | USBD_CDC_SIZ_STRING_LANGID 4
#define | USBD_CDC_SIZ_STRING_SERIAL 0x1A
#define | USBD_CDC_DESC_MANUFACTURER_STRING "Artery"
usb string define(vendor, product configuration, interface)
#define | USBD_CDC_DESC_PRODUCT_STRING "AT32 Composite VCP and MSC "
#define | USBD_CDC_DESC_CONFIGURATION_STRING "Composite VCP and MSC Config"
#define | USBD_CDC_DESC_INTERFACE_STRING "Composite VCP and MSC Interface"
#define | CDC_HID_BINTERVAL_TIME 0xFF
usb endpoint interval define
#define | VCPMSC_MSC_INTERFACE 0x00
usb interface define
#define | VCPMSC_CDC_INTERFACE 0x01
#define | VCPMSC_CDC_DATA_INTERFACE 0x02
#define | MCU_ID1 (0x1FFFF7E8)
usb mcu id address deine
#define | MCU_ID2 (0x1FFFF7EC)
#define | MCU_ID3 (0x1FFFF7F0)

Variables

usbd_desc_handler cdc_msc_desc_handler
device descriptor handler structure

Detailed Description

usb cdc descriptor header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file cdc_msc_desc.h.


AT32F413 Firmwary Library: msc_bot_scsi.c File Reference

  • middlewares
  • usbd_class
  • composite_cdc_msc
Functions | Variables
msc_bot_scsi.c File Reference

usb mass storage bulk-only transport and scsi command More...

#include "cdc_msc_class.h"
#include "msc_diskio.h"

Go to the source code of this file.

Functions

void | bot_scsi_init (void *udev)
initialize bulk-only transport and scsi
void | bot_scsi_reset (void *udev)
reset bulk-only transport and scsi
void | bot_scsi_datain_handler (void *udev, uint8_t ept_num)
bulk-only transport data in handler
void | bot_scsi_dataout_handler (void *udev, uint8_t ept_num)
bulk-only transport data out handler
void | bot_cbw_decode (void *udev)
bulk-only cbw decode
void | bot_scsi_send_data (void *udev, uint8_t *buffer, uint32_t len)
send bot data
void | bot_scsi_send_csw (void *udev, uint8_t status)
send command status
void | bot_scsi_sense_code (void *udev, uint8_t sense_key, uint8_t asc)
send scsi sense code
usb_sts_type | bot_scsi_check_address (void *udev, uint8_t lun, uint32_t blk_offset, uint32_t blk_count)
check address
void | bot_scsi_stall (void *udev)
bot endpoint stall
usb_sts_type | bot_scsi_test_unit (void *udev, uint8_t lun)
bulk-only transport scsi command test unit
usb_sts_type | bot_scsi_inquiry (void *udev, uint8_t lun)
bulk-only transport scsi command inquiry
usb_sts_type | bot_scsi_start_stop (void *udev, uint8_t lun)
bulk-only transport scsi command start stop
usb_sts_type | bot_scsi_allow_medium_removal (void *udev, uint8_t lun)
bulk-only transport scsi command meidum removal
usb_sts_type | bot_scsi_mode_sense6 (void *udev, uint8_t lun)
bulk-only transport scsi command mode sense6
usb_sts_type | bot_scsi_mode_sense10 (void *udev, uint8_t lun)
bulk-only transport scsi command mode sense10
usb_sts_type | bot_scsi_capacity (void *udev, uint8_t lun)
bulk-only transport scsi command capacity
usb_sts_type | bot_scsi_format_capacity (void *udev, uint8_t lun)
bulk-only transport scsi command format capacity
usb_sts_type | bot_scsi_request_sense (void *udev, uint8_t lun)
bulk-only transport scsi command request sense
usb_sts_type | bot_scsi_verify (void *udev, uint8_t lun)
bulk-only transport scsi command verify
usb_sts_type | bot_scsi_read10 (void *udev, uint8_t lun)
bulk-only transport scsi command read10
usb_sts_type | bot_scsi_write10 (void *udev, uint8_t lun)
bulk-only transport scsi command write10
void | bot_scsi_clear_feature (void *udev, uint8_t ept_num)
clear feature
usb_sts_type | bot_scsi_cmd_process (void *udev)
bulk-only transport scsi command process

Variables

ALIGNED_HEAD uint8_t page00_inquiry_data[] ALIGNED_TAIL

Detailed Description

usb mass storage bulk-only transport and scsi command

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file composite_cdc_msc/msc_bot_scsi.c.


AT32F413 Firmwary Library: custom_hid Directory Reference

  • middlewares
  • usbd_class
  • custom_hid
custom_hid Directory Reference

Files

custom_hid_class.c
usb custom hid class type
custom_hid_class.h
usb custom hid header file
custom_hid_desc.c
usb hid device descriptor
custom_hid_desc.h
usb custom hid descriptor header file


AT32F413 Firmwary Library: custom_hid_class.c File Reference

  • middlewares
  • usbd_class
  • custom_hid
Functions | Variables
custom_hid_class.c File Reference

usb custom hid class type More...

#include "usbd_core.h"
#include "custom_hid_class.h"
#include "custom_hid_desc.h"

Go to the source code of this file.

Functions

static usb_sts_type | class_init_handler (void *udev)
initialize usb endpoint
static usb_sts_type | class_clear_handler (void *udev)
clear endpoint or other state
static usb_sts_type | class_setup_handler (void *udev, usb_setup_type *setup)
usb device class setup request handler
static usb_sts_type | class_ept0_tx_handler (void *udev)
usb device class endpoint 0 in status stage complete
static usb_sts_type | class_ept0_rx_handler (void *udev)
usb device class endpoint 0 out status stage complete
static usb_sts_type | class_in_handler (void *udev, uint8_t ept_num)
usb device class transmision complete handler
static usb_sts_type | class_out_handler (void *udev, uint8_t ept_num)
usb device class endpoint receive data
static usb_sts_type | class_sof_handler (void *udev)
usb device class sof handler
static usb_sts_type | class_event_handler (void *udev, usbd_event_type event)
usb device class event handler
static void | usb_hid_buf_process (void *udev, uint8_t *report, uint16_t len)
usb device class report function
usb_sts_type | custom_hid_class_send_report (void *udev, uint8_t *report, uint16_t len)
usb device class send report

Variables

custom_hid_type custom_hid_struct
usbd_class_handler custom_hid_class_handler

Detailed Description

usb custom hid class type

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file custom_hid_class.c.


AT32F413 Firmwary Library: custom_hid_class.h File Reference

  • middlewares
  • usbd_class
  • custom_hid
Data Structures | Macros | Functions | Variables
custom_hid_class.h File Reference

usb custom hid header file More...

#include "usb_std.h"
#include "usbd_core.h"

Go to the source code of this file.

Data Structures

struct custom_hid_type

Macros

#define | USBD_CUSTOM_HID_IN_EPT 0x81
usb custom hid use endpoint define
#define | USBD_CUSTOM_HID_OUT_EPT 0x01
#define | USBD_CUSTOM_IN_MAXPACKET_SIZE 0x40
usb custom hid in and out max packet size define
#define | USBD_CUSTOM_OUT_MAXPACKET_SIZE 0x40

Functions

usb_sts_type custom_hid_class_send_report (void *udev, uint8_t *report, uint16_t len)
usb device class send report

Variables

usbd_class_handler custom_hid_class_handler

Detailed Description

usb custom hid header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file custom_hid_class.h.


AT32F413 Firmwary Library: custom_hid_desc.c File Reference

  • middlewares
  • usbd_class
  • custom_hid
Functions | Variables
custom_hid_desc.c File Reference

usb hid device descriptor More...

#include "usb_std.h"
#include "usbd_sdr.h"
#include "usbd_core.h"
#include "custom_hid_desc.h"

Go to the source code of this file.

Functions

static usbd_desc_t * | get_device_descriptor (void)
get device descriptor
static usbd_desc_t * | get_device_qualifier (void)
get device qualifier
static usbd_desc_t * | get_device_configuration (void)
get config descriptor
static usbd_desc_t * | get_device_other_speed (void)
get other speed descriptor
static usbd_desc_t * | get_device_lang_id (void)
get lang id descriptor
static usbd_desc_t * | get_device_manufacturer_string (void)
get manufacturer descriptor
static usbd_desc_t * | get_device_product_string (void)
get product descriptor
static usbd_desc_t * | get_device_serial_string (void)
get serial descriptor
static usbd_desc_t * | get_device_interface_string (void)
get interface descriptor
static usbd_desc_t * | get_device_config_string (void)
get device config descriptor
static uint16_t | usbd_unicode_convert (uint8_t *string, uint8_t *unicode_buf)
standard usb unicode convert
static void | usbd_int_to_unicode (uint32_t value, uint8_t *pbuf, uint8_t len)
usb int convert to unicode
static void | get_serial_num (void)
usb get serial number

Variables

static ALIGNED_HEAD uint8_t g_usbd_desc_buffer[256] | ALIGNED_TAIL
usb device standard descriptor
usbd_desc_handler custom_hid_desc_handler
custom hid device descriptor handler structure
static usbd_desc_t | device_descriptor
static usbd_desc_t | config_descriptor
static usbd_desc_t | langid_descriptor
static usbd_desc_t | serial_descriptor
static usbd_desc_t | vp_desc

Detailed Description

usb hid device descriptor

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file custom_hid_desc.c.


AT32F413 Firmwary Library: custom_hid_desc.h File Reference

  • middlewares
  • usbd_class
  • custom_hid
Macros | Variables
custom_hid_desc.h File Reference

usb custom hid descriptor header file More...

#include "custom_hid_class.h"
#include "usbd_core.h"

Go to the source code of this file.

Macros

#define | CUSHID_BCD_NUM 0x0110
usb bcd number define
#define | USBD_CUSHID_VENDOR_ID 0x2E3C
usb vendor id and product id define
#define | USBD_CUSHID_PRODUCT_ID 0x5745
#define | USBD_CUSHID_CONFIG_DESC_SIZE 41
usb descriptor size define
#define | USBD_CUSHID_SIZ_REPORT_DESC 126
#define | USBD_CUSHID_SIZ_STRING_LANGID 4
#define | USBD_CUSHID_SIZ_STRING_SERIAL 0x1A
#define | USBD_CUSHID_DESC_MANUFACTURER_STRING "Artery"
usb string define(vendor, product configuration, interface)
#define | USBD_CUSHID_DESC_PRODUCT_STRING "Custom HID"
#define | USBD_CUSHID_DESC_CONFIGURATION_STRING "Custom HID Config"
#define | USBD_CUSHID_DESC_INTERFACE_STRING "Custom HID Interface"
#define | CUSHID_BINTERVAL_TIME 0x0A
#define | HID_REPORT_ID_1 0x01
usb hid report id define
#define | HID_REPORT_ID_2 0x02
#define | HID_REPORT_ID_3 0x03
#define | HID_REPORT_ID_4 0x04
#define | HID_REPORT_ID_5 0x05
#define | HID_REPORT_ID_6 0xF0
#define | MCU_ID1 (0x1FFFF7E8)
usb mcu id address deine
#define | MCU_ID2 (0x1FFFF7EC)
#define | MCU_ID3 (0x1FFFF7F0)

Variables

uint8_t | g_usbd_custom_hid_report [126]
uint8_t | g_custom_hid_usb_desc [9]
usbd_desc_handler custom_hid_desc_handler
custom hid device descriptor handler structure

Detailed Description

usb custom hid descriptor header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file custom_hid_desc.h.


AT32F413 Firmwary Library: hid_iap Directory Reference

  • middlewares
  • usbd_class
  • hid_iap
hid_iap Directory Reference

Files

hid_iap_class.c
usb hid iap class type
hid_iap_class.h
usb hid iap header file
hid_iap_desc.c
usb hid device descriptor
hid_iap_desc.h
usb hid descriptor header file


AT32F413 Firmwary Library: hid_iap_class.c File Reference

  • middlewares
  • usbd_class
  • hid_iap
Functions | Variables
hid_iap_class.c File Reference

usb hid iap class type More...

#include "usbd_core.h"
#include "hid_iap_class.h"
#include "hid_iap_desc.h"

Go to the source code of this file.

Functions

static usb_sts_type | class_init_handler (void *udev)
initialize usb custom hid endpoint
static usb_sts_type | class_clear_handler (void *udev)
clear endpoint or other state
static usb_sts_type | class_setup_handler (void *udev, usb_setup_type *setup)
usb device class setup request handler
static usb_sts_type | class_ept0_tx_handler (void *udev)
usb device endpoint 0 in status stage complete
static usb_sts_type | class_ept0_rx_handler (void *udev)
usb device endpoint 0 out status stage complete
static usb_sts_type | class_in_handler (void *udev, uint8_t ept_num)
usb device transmision complete handler
static usb_sts_type | class_out_handler (void *udev, uint8_t ept_num)
usb device endpoint receive data
static usb_sts_type | class_sof_handler (void *udev)
usb device sof handler
static usb_sts_type | class_event_handler (void *udev, usbd_event_type event)
usb device event handler
usb_sts_type | usb_iap_class_send_report (void *udev, uint8_t *report, uint16_t len)
usb device class send report

Variables

iap_info_type iap_info
usbd_class_handler hid_iap_class_handler

Detailed Description

usb hid iap class type

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file hid_iap_class.c.


AT32F413 Firmwary Library: hid_iap_class.h File Reference

  • middlewares
  • usbd_class
  • hid_iap
Data Structures | Macros | Enumerations | Functions | Variables
hid_iap_class.h File Reference

usb hid iap header file More...

#include "usb_std.h"
#include "usbd_core.h"

Go to the source code of this file.

Data Structures

struct iap_info_type

Macros

#define | USBD_HIDIAP_IN_EPT 0x81
#define | USBD_HIDIAP_OUT_EPT 0x01
#define | USBD_HIDIAP_IN_MAXPACKET_SIZE 0x40
#define | USBD_HIDIAP_OUT_MAXPACKET_SIZE 0x40
#define | FLASH_SIZE_REG()
#define | KB_TO_B(kb)
#define | SECTOR_SIZE_1K 0x400
#define | SECTOR_SIZE_2K 0x800
#define | SECTOR_SIZE_4K 0x1000
#define | IAP_CMD_IDLE 0x5AA0
iap command
#define | IAP_CMD_START 0x5AA1
#define | IAP_CMD_ADDR 0x5AA2
#define | IAP_CMD_DATA 0x5AA3
#define | IAP_CMD_FINISH 0x5AA4
#define | IAP_CMD_CRC 0x5AA5
#define | IAP_CMD_JMP 0x5AA6
#define | IAP_CMD_GET 0x5AA7
#define | HID_IAP_BUFFER_LEN 1024
#define | IAP_UPGRADE_COMPLETE_FLAG 0x41544B38
#define | CONVERT_ENDIAN(dwValue)
#define | IAP_ACK 0xFF00
#define | IAP_NACK 0x00FF

Enumerations

enum iap_result_type { IAP_SUCCESS , IAP_WAIT , IAP_FAILED }
enum iap_machine_state_type {
IAP_STS_IDLE , IAP_STS_START , IAP_STS_ADDR , IAP_STS_DATA ,
IAP_STS_FINISH , IAP_STS_CRC , IAP_STS_JMP_WAIT , IAP_STS_JMP
}

Functions

usb_sts_type | usb_iap_class_send_report (void *udev, uint8_t *report, uint16_t len)
usb device class send report
iap_result_type | usbd_hid_iap_process (void *udev, uint8_t *report, uint16_t len)
usb device iap function
void | usbd_hid_iap_in_complete (void *udev)
usb device in transfer complete function

Variables

usbd_class_handler hid_iap_class_handler
iap_info_type iap_info

Detailed Description

usb hid iap header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file hid_iap_class.h.


AT32F413 Firmwary Library: hid_iap_desc.c File Reference

  • middlewares
  • usbd_class
  • hid_iap
Functions | Variables
hid_iap_desc.c File Reference

usb hid device descriptor More...

#include "usb_std.h"
#include "usbd_sdr.h"
#include "usbd_core.h"
#include "hid_iap_desc.h"

Go to the source code of this file.

Functions

static usbd_desc_t * | get_device_descriptor (void)
get device descriptor
static usbd_desc_t * | get_device_qualifier (void)
get device qualifier
static usbd_desc_t * | get_device_configuration (void)
get config descriptor
static usbd_desc_t * | get_device_other_speed (void)
get other speed descriptor
static usbd_desc_t * | get_device_lang_id (void)
get lang id descriptor
static usbd_desc_t * | get_device_manufacturer_string (void)
get manufacturer descriptor
static usbd_desc_t * | get_device_product_string (void)
get product descriptor
static usbd_desc_t * | get_device_serial_string (void)
get serial descriptor
static usbd_desc_t * | get_device_interface_string (void)
get interface descriptor
static usbd_desc_t * | get_device_config_string (void)
get device config descriptor
static uint16_t | usbd_unicode_convert (uint8_t *string, uint8_t *unicode_buf)
standard usb unicode convert
static void | usbd_int_to_unicode (uint32_t value, uint8_t *pbuf, uint8_t len)
usb int convert to unicode
static void | get_serial_num (void)
usb get serial number

Variables

static ALIGNED_HEAD uint8_t g_usbd_desc_buffer[256] | ALIGNED_TAIL
usb device standard descriptor
usbd_desc_handler hid_iap_desc_handler
hid device descriptor handler structure
static usbd_desc_t | device_descriptor
static usbd_desc_t | config_descriptor
static usbd_desc_t | langid_descriptor
static usbd_desc_t | serial_descriptor
static usbd_desc_t | vp_desc

Detailed Description

usb hid device descriptor

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file hid_iap_desc.c.


AT32F413 Firmwary Library: hid_iap_desc.h File Reference

  • middlewares
  • usbd_class
  • hid_iap
Macros | Variables
hid_iap_desc.h File Reference

usb hid descriptor header file More...

#include "hid_iap_class.h"
#include "usbd_core.h"

Go to the source code of this file.

Macros

#define | HIDIAP_BCD_NUM 0x0110
#define | USBD_HIDIAP_VENDOR_ID 0x2E3C
#define | USBD_HIDIAP_PRODUCT_ID 0xAF01
#define | USBD_HIDIAP_CONFIG_DESC_SIZE 41
#define | USBD_HIDIAP_SIZ_REPORT_DESC 32
#define | USBD_HIDIAP_SIZ_STRING_LANGID 4
#define | USBD_HIDIAP_SIZ_STRING_SERIAL 0x1A
#define | USBD_HIDIAP_DESC_MANUFACTURER_STRING "Artery"
#define | USBD_HIDIAP_DESC_PRODUCT_STRING "HID IAP"
#define | USBD_HIDIAP_DESC_CONFIGURATION_STRING "HID IAP Config"
#define | USBD_HIDIAP_DESC_INTERFACE_STRING "HID IAP Interface"
#define | HIDIAP_BINTERVAL_TIME 0x01
#define | MCU_ID1 (0x1FFFF7E8)
#define | MCU_ID2 (0x1FFFF7EC)
#define | MCU_ID3 (0x1FFFF7F0)

Variables

uint8_t | g_usbd_hidiap_report [32]
uint8_t | g_hidiap_usb_desc [9]
usbd_desc_handler hid_iap_desc_handler
hid device descriptor handler structure

Detailed Description

usb hid descriptor header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file hid_iap_desc.h.


AT32F413 Firmwary Library: keyboard Directory Reference

  • middlewares
  • usbd_class
  • keyboard
keyboard Directory Reference

Files

keyboard_class.c
usb hid keyboard class type
keyboard_class.h
usb hid keyboard header file
keyboard_desc.c
usb hid keyboard device descriptor
keyboard_desc.h
usb keyboard descriptor header file


AT32F413 Firmwary Library: keyboard_class.c File Reference

  • middlewares
  • usbd_class
  • keyboard
Macros | Functions | Variables
keyboard_class.c File Reference

usb hid keyboard class type More...

#include "usbd_core.h"
#include "keyboard_class.h"
#include "keyboard_desc.h"

Go to the source code of this file.

Macros

#define SHIFT 0x80

Functions

static usb_sts_type | class_init_handler (void *udev)
initialize usb endpoint
static usb_sts_type | class_clear_handler (void *udev)
clear endpoint or other state
static usb_sts_type | class_setup_handler (void *udev, usb_setup_type *setup)
usb device class setup request handler
static usb_sts_type | class_ept0_tx_handler (void *udev)
usb device class endpoint 0 in status stage complete
static usb_sts_type | class_ept0_rx_handler (void *udev)
usb device class endpoint 0 out status stage complete
static usb_sts_type | class_in_handler (void *udev, uint8_t ept_num)
usb device class transmision complete handler
static usb_sts_type | class_out_handler (void *udev, uint8_t ept_num)
usb device class endpoint receive data
static usb_sts_type | class_sof_handler (void *udev)
usb device class sof handler
static usb_sts_type | class_event_handler (void *udev, usbd_event_type event)
usb device class event handler
usb_sts_type | usb_keyboard_class_send_report (void *udev, uint8_t *report, uint16_t len)
usb device class send report
void | usb_hid_keyboard_send_char (void *udev, uint8_t ascii_code)
usb device class report function

Variables

keyboard_type keyboard_struct
static const unsigned char _asciimap [128]
usbd_class_handler keyboard_class_handler

Detailed Description

usb hid keyboard class type

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file keyboard_class.c.


AT32F413 Firmwary Library: keyboard_class.h File Reference

  • middlewares
  • usbd_class
  • keyboard
Data Structures | Macros | Functions | Variables
keyboard_class.h File Reference

usb hid keyboard header file More...

#include "usb_std.h"
#include "usbd_core.h"

Go to the source code of this file.

Data Structures

struct keyboard_type

Macros

#define | USBD_KEYBOARD_IN_EPT 0x81
usb hid use endpoint define
#define | USBD_KEYBOARD_IN_MAXPACKET_SIZE 0x40
usb hid in and out max packet size define
#define | USBD_KEYBOARD_OUT_MAXPACKET_SIZE 0x40

Functions

usb_sts_type | usb_keyboard_class_send_report (void *udev, uint8_t *report, uint16_t len)
usb device class send report
void | usb_hid_keyboard_send_char (void *udev, uint8_t ascii_code)
usb device class report function

Variables

usbd_class_handler keyboard_class_handler

Detailed Description

usb hid keyboard header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file keyboard_class.h.


AT32F413 Firmwary Library: keyboard_desc.c File Reference

  • middlewares
  • usbd_class
  • keyboard
Functions | Variables
keyboard_desc.c File Reference

usb hid keyboard device descriptor More...

#include "usb_std.h"
#include "usbd_sdr.h"
#include "usbd_core.h"
#include "keyboard_desc.h"

Go to the source code of this file.

Functions

static usbd_desc_t * | get_device_descriptor (void)
get device descriptor
static usbd_desc_t * | get_device_qualifier (void)
get device qualifier
static usbd_desc_t * | get_device_configuration (void)
get config descriptor
static usbd_desc_t * | get_device_other_speed (void)
get other speed descriptor
static usbd_desc_t * | get_device_lang_id (void)
get lang id descriptor
static usbd_desc_t * | get_device_manufacturer_string (void)
get manufacturer descriptor
static usbd_desc_t * | get_device_product_string (void)
get product descriptor
static usbd_desc_t * | get_device_serial_string (void)
get serial descriptor
static usbd_desc_t * | get_device_interface_string (void)
get interface descriptor
static usbd_desc_t * | get_device_config_string (void)
get device config descriptor
static uint16_t | usbd_unicode_convert (uint8_t *string, uint8_t *unicode_buf)
standard usb unicode convert
static void | usbd_int_to_unicode (uint32_t value, uint8_t *pbuf, uint8_t len)
usb int convert to unicode
static void | get_serial_num (void)
usb get serial number

Variables

static ALIGNED_HEAD uint8_t g_usbd_desc_buffer[256] | ALIGNED_TAIL
usb device standard descriptor
usbd_desc_handler keyboard_desc_handler
keyboard device descriptor handler structure
static usbd_desc_t | device_descriptor
static usbd_desc_t | config_descriptor
static usbd_desc_t | langid_descriptor
static usbd_desc_t | serial_descriptor
static usbd_desc_t | vp_desc

Detailed Description

usb hid keyboard device descriptor

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file keyboard_desc.c.


AT32F413 Firmwary Library: keyboard_desc.h File Reference

  • middlewares
  • usbd_class
  • keyboard
Macros | Variables
keyboard_desc.h File Reference

usb keyboard descriptor header file More...

#include "keyboard_class.h"
#include "usbd_core.h"

Go to the source code of this file.

Macros

#define | KEYBOARD_BCD_NUM 0x0110
usb bcd number define
#define | USBD_KEYBOARD_VENDOR_ID 0x2E3C
usb vendor id and product id define
#define | USBD_KEYBOARD_PRODUCT_ID 0x6040
#define | USBD_KEYBOARD_CONFIG_DESC_SIZE 34
usb descriptor size define
#define | USBD_KEYBOARD_SIZ_REPORT_DESC 63
#define | USBD_KEYBOARD_SIZ_STRING_LANGID 4
#define | USBD_KEYBOARD_SIZ_STRING_SERIAL 0x1A
#define | USBD_KEYBOARD_DESC_MANUFACTURER_STRING "Artery"
usb string define(vendor, product configuration, interface)
#define | USBD_KEYBOARD_DESC_PRODUCT_STRING "Keyboard"
#define | USBD_KEYBOARD_DESC_CONFIGURATION_STRING "Keyboard Config"
#define | USBD_KEYBOARD_DESC_INTERFACE_STRING "Keyboard Interface"
#define | KEYBOARD_BINTERVAL_TIME 0x0A
usb hid endpoint interval define
#define | MCU_ID1 (0x1FFFF7E8)
usb mcu id address deine
#define | MCU_ID2 (0x1FFFF7EC)
#define | MCU_ID3 (0x1FFFF7F0)

Variables

uint8_t | g_usbd_keyboard_report [63]
uint8_t | g_keyboard_usb_desc [9]
usbd_desc_handler keyboard_desc_handler
keyboard device descriptor handler structure

Detailed Description

usb keyboard descriptor header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file keyboard_desc.h.


AT32F413 Firmwary Library: mouse Directory Reference

  • middlewares
  • usbd_class
  • mouse
mouse Directory Reference

Files

mouse_class.c
usb hid mouse class type
mouse_class.h
usb hid mouse header file
mouse_desc.c
usb hid mouse device descriptor
mouse_desc.h
usb mouse descriptor header file


AT32F413 Firmwary Library: mouse_class.c File Reference

  • middlewares
  • usbd_class
  • mouse
Functions | Variables
mouse_class.c File Reference

usb hid mouse class type More...

#include "usbd_core.h"
#include "mouse_class.h"
#include "mouse_desc.h"

Go to the source code of this file.

Functions

static usb_sts_type | class_init_handler (void *udev)
initialize usb endpoint
static usb_sts_type | class_clear_handler (void *udev)
clear endpoint or other state
static usb_sts_type | class_setup_handler (void *udev, usb_setup_type *setup)
usb device class setup request handler
static usb_sts_type | class_ept0_tx_handler (void *udev)
usb device class endpoint 0 in status stage complete
static usb_sts_type | class_ept0_rx_handler (void *udev)
usb device class endpoint 0 out status stage complete
static usb_sts_type | class_in_handler (void *udev, uint8_t ept_num)
usb device class transmision complete handler
static usb_sts_type | class_out_handler (void *udev, uint8_t ept_num)
usb device class endpoint receive data
static usb_sts_type | class_sof_handler (void *udev)
usb device class sof handler
static usb_sts_type | class_event_handler (void *udev, usbd_event_type event)
usb device class event handler
usb_sts_type | usb_mouse_class_send_report (void *udev, uint8_t *report, uint16_t len)
usb device class send report
void | usb_hid_mouse_send (void *udev, uint8_t op)
usb device class report function

Variables

mouse_type mouse_struct
usbd_class_handler mouse_class_handler

Detailed Description

usb hid mouse class type

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file mouse_class.c.


AT32F413 Firmwary Library: mouse_class.h File Reference

  • middlewares
  • usbd_class
  • mouse
Data Structures | Macros | Functions | Variables
mouse_class.h File Reference

usb hid mouse header file More...

#include "usb_std.h"
#include "usbd_core.h"

Go to the source code of this file.

Data Structures

struct mouse_type

Macros

#define | USBD_MOUSE_IN_EPT 0x81
usb hid use endpoint define
#define | USBD_MOUSE_IN_MAXPACKET_SIZE 0x40
usb hid in and out max packet size define
#define | MOVE_STEP 20
usb hid mouse operation
#define | BUTTON_RELEASE 0
#define | LEFT_BUTTON 1
#define | RIGHT_BUTTON 2
#define | LEFT_MOVE 3
#define | RIGHT_MOVE 4
#define | UP_MOVE 5
#define | DOWN_MOVE 6

Functions

usb_sts_type | usb_mouse_class_send_report (void *udev, uint8_t *report, uint16_t len)
usb device class send report
void | usb_hid_mouse_send (void *udev, uint8_t op)
usb device class report function

Variables

usbd_class_handler mouse_class_handler

Detailed Description

usb hid mouse header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file mouse_class.h.


AT32F413 Firmwary Library: mouse_desc.c File Reference

  • middlewares
  • usbd_class
  • mouse
Functions | Variables
mouse_desc.c File Reference

usb hid mouse device descriptor More...

#include "usb_std.h"
#include "usbd_sdr.h"
#include "usbd_core.h"
#include "mouse_desc.h"

Go to the source code of this file.

Functions

static usbd_desc_t * | get_device_descriptor (void)
get device descriptor
static usbd_desc_t * | get_device_qualifier (void)
get device qualifier
static usbd_desc_t * | get_device_configuration (void)
get config descriptor
static usbd_desc_t * | get_device_other_speed (void)
get other speed descriptor
static usbd_desc_t * | get_device_lang_id (void)
get lang id descriptor
static usbd_desc_t * | get_device_manufacturer_string (void)
get manufacturer descriptor
static usbd_desc_t * | get_device_product_string (void)
get product descriptor
static usbd_desc_t * | get_device_serial_string (void)
get serial descriptor
static usbd_desc_t * | get_device_interface_string (void)
get interface descriptor
static usbd_desc_t * | get_device_config_string (void)
get device config descriptor
static uint16_t | usbd_unicode_convert (uint8_t *string, uint8_t *unicode_buf)
standard usb unicode convert
static void | usbd_int_to_unicode (uint32_t value, uint8_t *pbuf, uint8_t len)
usb int convert to unicode
static void | get_serial_num (void)
usb get serial number

Variables

static ALIGNED_HEAD uint8_t g_usbd_desc_buffer[256] | ALIGNED_TAIL
usb device standard descriptor
usbd_desc_handler mouse_desc_handler
mouse device descriptor handler structure
static usbd_desc_t | device_descriptor
static usbd_desc_t | config_descriptor
static usbd_desc_t | langid_descriptor
static usbd_desc_t | serial_descriptor
static usbd_desc_t | vp_desc

Detailed Description

usb hid mouse device descriptor

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file mouse_desc.c.


AT32F413 Firmwary Library: mouse_desc.h File Reference

  • middlewares
  • usbd_class
  • mouse
Macros | Variables
mouse_desc.h File Reference

usb mouse descriptor header file More...

#include "mouse_class.h"
#include "usbd_core.h"

Go to the source code of this file.

Macros

#define | MOUSE_BCD_NUM 0x0110
usb bcd number define
#define | USBD_MOUSE_VENDOR_ID 0x2E3C
usb vendor id and product id define
#define | USBD_MOUSE_PRODUCT_ID 0x5710
#define | USBD_MOUSE_CONFIG_DESC_SIZE 34
usb descriptor size define
#define | USBD_MOUSE_SIZ_REPORT_DESC 74
#define | USBD_MOUSE_SIZ_STRING_LANGID 4
#define | USBD_MOUSE_SIZ_STRING_SERIAL 0x1A
#define | USBD_MOUSE_DESC_MANUFACTURER_STRING "Artery"
usb string define(vendor, product configuration, interface)
#define | USBD_MOUSE_DESC_PRODUCT_STRING "Mouse"
#define | USBD_MOUSE_DESC_CONFIGURATION_STRING "Mouse Config"
#define | USBD_MOUSE_DESC_INTERFACE_STRING "Mouse Interface"
#define | MOUSE_BINTERVAL_TIME 0x0A
usb hid endpoint interval define
#define | MCU_ID1 (0x1FFFF7E8)
usb mcu id address deine
#define | MCU_ID2 (0x1FFFF7EC)
#define | MCU_ID3 (0x1FFFF7F0)

Variables

uint8_t | g_usbd_mouse_report [74]
uint8_t | g_mouse_usb_desc [9]
usbd_desc_handler mouse_desc_handler
mouse device descriptor handler structure

Detailed Description

usb mouse descriptor header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file mouse_desc.h.


AT32F413 Firmwary Library: msc Directory Reference

  • middlewares
  • usbd_class
  • msc
msc Directory Reference

Files

msc_bot_scsi.c
usb mass storage bulk-only transport and scsi command
msc_bot_scsi.h
usb mass storage bulk-only transport and scsi command header file
msc_class.c
usb msc class type
msc_class.h
usb msc class file
msc_desc.c
usb msc device descriptor
msc_desc.h
usb msc descriptor header file


AT32F413 Firmwary Library: msc_bot_scsi.c File Reference

  • middlewares
  • usbd_class
  • msc
Functions | Variables
msc_bot_scsi.c File Reference

usb mass storage bulk-only transport and scsi command More...

#include "msc_bot_scsi.h"
#include "msc_diskio.h"

Go to the source code of this file.

Functions

void | bot_scsi_init (void *udev)
initialize bulk-only transport and scsi
void | bot_scsi_reset (void *udev)
reset bulk-only transport and scsi
void | bot_scsi_datain_handler (void *udev, uint8_t ept_num)
bulk-only transport data in handler
void | bot_scsi_dataout_handler (void *udev, uint8_t ept_num)
bulk-only transport data out handler
void | bot_cbw_decode (void *udev)
bulk-only cbw decode
void | bot_scsi_send_data (void *udev, uint8_t *buffer, uint32_t len)
send bot data
void | bot_scsi_send_csw (void *udev, uint8_t status)
send command status
void | bot_scsi_sense_code (void *udev, uint8_t sense_key, uint8_t asc)
send scsi sense code
usb_sts_type | bot_scsi_check_address (void *udev, uint8_t lun, uint32_t blk_offset, uint32_t blk_count)
check address
void | bot_scsi_stall (void *udev)
bot endpoint stall
usb_sts_type | bot_scsi_test_unit (void *udev, uint8_t lun)
bulk-only transport scsi command test unit
usb_sts_type | bot_scsi_inquiry (void *udev, uint8_t lun)
bulk-only transport scsi command inquiry
usb_sts_type | bot_scsi_start_stop (void *udev, uint8_t lun)
bulk-only transport scsi command start stop
usb_sts_type | bot_scsi_allow_medium_removal (void *udev, uint8_t lun)
bulk-only transport scsi command meidum removal
usb_sts_type | bot_scsi_mode_sense6 (void *udev, uint8_t lun)
bulk-only transport scsi command mode sense6
usb_sts_type | bot_scsi_mode_sense10 (void *udev, uint8_t lun)
bulk-only transport scsi command mode sense10
usb_sts_type | bot_scsi_capacity (void *udev, uint8_t lun)
bulk-only transport scsi command capacity
usb_sts_type | bot_scsi_format_capacity (void *udev, uint8_t lun)
bulk-only transport scsi command format capacity
usb_sts_type | bot_scsi_request_sense (void *udev, uint8_t lun)
bulk-only transport scsi command request sense
usb_sts_type | bot_scsi_verify (void *udev, uint8_t lun)
bulk-only transport scsi command verify
usb_sts_type | bot_scsi_read10 (void *udev, uint8_t lun)
bulk-only transport scsi command read10
usb_sts_type | bot_scsi_write10 (void *udev, uint8_t lun)
bulk-only transport scsi command write10
void | bot_scsi_clear_feature (void *udev, uint8_t ept_num)
clear feature
usb_sts_type | bot_scsi_cmd_process (void *udev)
bulk-only transport scsi command process

Variables

ALIGNED_HEAD uint8_t page00_inquiry_data[] ALIGNED_TAIL

Detailed Description

usb mass storage bulk-only transport and scsi command

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file msc/msc_bot_scsi.c.


AT32F413 Firmwary Library: msc_bot_scsi.h File Reference

  • middlewares
  • usbd_class
  • msc
Data Structures | Macros | Functions
msc_bot_scsi.h File Reference

usb mass storage bulk-only transport and scsi command header file More...

#include "msc_class.h"
#include "usbd_core.h"

Go to the source code of this file.

Data Structures

struct | cbd_typical_type
typical command block description More...
struct | cbd_extended_type
extended command block description More...
struct | cbw_type
command block wrapper More...
struct | csw_type
command block wrapper More...
struct | sense_type
request sense standard data More...
struct | msc_type

Macros

#define | MSC_SUPPORT_MAX_LUN 1
#define | MSC_MAX_DATA_BUF_LEN 4096
#define | MSC_CMD_FORMAT_UNIT 0x04
#define | MSC_CMD_INQUIRY 0x12
#define | MSC_CMD_START_STOP 0x1B
#define | MSC_CMD_MODE_SENSE6 0x1A
#define | MSC_CMD_MODE_SENSE10 0x5A
#define | MSC_CMD_ALLOW_MEDIUM_REMOVAL 0x1E
#define | MSC_CMD_READ_10 0x28
#define | MSC_CMD_READ_12 0xA8
#define | MSC_CMD_READ_CAPACITY 0x25
#define | MSC_CMD_READ_FORMAT_CAPACITY 0x23
#define | MSC_CMD_REQUEST_SENSE 0x03
#define | MSC_CMD_TEST_UNIT 0x00
#define | MSC_CMD_VERIFY 0x2F
#define | MSC_CMD_WRITE_10 0x2A
#define | MSC_CMD_WRITE_12 0xAA
#define | MSC_CMD_WRITE_VERIFY 0x2E
#define | MSC_REQ_GET_MAX_LUN 0xFE
#define | MSC_REQ_BO_RESET 0xFF
#define | SET_LINE_CODING 0x20
#define | GET_LINE_CODING 0x21
#define | CBW_CMD_LENGTH 31
#define | CBW_DCBWSIGNATURE 0x43425355
#define | CBW_BMCBWFLAGS_DIR_OUT 0x00
#define | CBW_BMCBWFLAGS_DIR_IN 0x80
#define | CSW_CMD_LENGTH 13
#define | CSW_DCSWSIGNATURE 0x53425355
#define | CSW_BCSWSTATUS_PASS 0x00
#define | CSW_BCSWSTATUS_FAILED 0x01
#define | CSW_BCSWSTATUS_PHASE_ERR 0x02
#define | MSC_STATE_MACHINE_CMD 0x00
#define | MSC_STATE_MACHINE_DATA_IN 0x01
#define | MSC_STATE_MACHINE_DATA_OUT 0x02
#define | MSC_STATE_MACHINE_SEND_DATA 0x03
#define | MSC_STATE_MACHINE_LAST_DATA 0x04
#define | MSC_STATE_MACHINE_STATUS 0x05
#define | MSC_STATE_MACHINE_FAILED 0x06
#define | MSC_STATE_MACHINE_IDLE 0x07
#define | MSC_BOT_STATE_IDLE 0x00
#define | MSC_BOT_STATE_RECOVERY 0x01
#define | MSC_BOT_STATE_ERROR 0x02
#define | REQ_SENSE_STANDARD_DATA_LEN 0x12
#define | SENSE_KEY_NO_SENSE 0x00
#define | SENSE_KEY_RECOVERED_ERROR 0x01
#define | SENSE_KEY_NOT_READY 0x02
#define | SENSE_KEY_MEDIUM_ERROR 0x03
#define | SENSE_KEY_HARDWARE_ERROR 0x04
#define | SENSE_KEY_ILLEGAL_REQUEST 0x05
#define | SENSE_KEY_UNIT_ATTENTION 0x06
#define | SENSE_KEY_DATA_PROTECT 0x07
#define | SENSE_KEY_BLANK_CHECK 0x08
#define | SENSE_KEY_VENDERO_SPECIFIC 0x09
#define | SENSE_KEY_ABORTED_COMMAND 0x0B
#define | SENSE_KEY_VOLUME_OVERFLOW 0x0D
#define | SENSE_KEY_MISCOMPARE 0x0E
#define | INVALID_COMMAND 0x20
#define | INVALID_FIELED_IN_COMMAND 0x24
#define | PARAMETER_LIST_LENGTH_ERROR 0x1A
#define | INVALID_FIELD_IN_PARAMETER_LIST 0x26
#define | ADDRESS_OUT_OF_RANGE 0x21
#define | MEDIUM_NOT_PRESENT 0x3A
#define | MEDIUM_HAVE_CHANGED 0x28
#define | SCSI_INQUIRY_DATA_LENGTH 36

Functions

void | bot_scsi_init (void *udev)
initialize bulk-only transport and scsi
void | bot_scsi_reset (void *udev)
reset bulk-only transport and scsi
void | bot_scsi_datain_handler (void *pudev, uint8_t ept_num)
bulk-only transport data in handler
void | bot_scsi_dataout_handler (void *pudev, uint8_t ept_num)
bulk-only transport data out handler
void | bot_cbw_decode (void *udev)
bulk-only cbw decode
void | bot_scsi_send_data (void *udev, uint8_t *buffer, uint32_t len)
send bot data
void | bot_scsi_send_csw (void *udev, uint8_t status)
send command status
void | bot_scsi_sense_code (void *udev, uint8_t sense_key, uint8_t asc)
send scsi sense code
usb_sts_type | bot_scsi_check_address (void *udev, uint8_t lun, uint32_t blk_offset, uint32_t blk_count)
check address
void | bot_scsi_stall (void *udev)
bot endpoint stall
usb_sts_type | bot_scsi_cmd_process (void *udev)
bulk-only transport scsi command process
usb_sts_type | bot_scsi_test_unit (void *udev, uint8_t lun)
bulk-only transport scsi command test unit
usb_sts_type | bot_scsi_inquiry (void *udev, uint8_t lun)
bulk-only transport scsi command inquiry
usb_sts_type | bot_scsi_start_stop (void *udev, uint8_t lun)
bulk-only transport scsi command start stop
usb_sts_type | bot_scsi_allow_medium_removal (void *udev, uint8_t lun)
bulk-only transport scsi command meidum removal
usb_sts_type | bot_scsi_mode_sense6 (void *udev, uint8_t lun)
bulk-only transport scsi command mode sense6
usb_sts_type | bot_scsi_mode_sense10 (void *udev, uint8_t lun)
bulk-only transport scsi command mode sense10
usb_sts_type | bot_scsi_read10 (void *udev, uint8_t lun)
bulk-only transport scsi command read10
usb_sts_type | bot_scsi_capacity (void *udev, uint8_t lun)
bulk-only transport scsi command capacity
usb_sts_type | bot_scsi_format_capacity (void *udev, uint8_t lun)
bulk-only transport scsi command format capacity
usb_sts_type | bot_scsi_request_sense (void *udev, uint8_t lun)
bulk-only transport scsi command request sense
usb_sts_type | bot_scsi_verify (void *udev, uint8_t lun)
bulk-only transport scsi command verify
usb_sts_type | bot_scsi_write10 (void *udev, uint8_t lun)
bulk-only transport scsi command write10
void | bot_scsi_clear_feature (void *udev, uint8_t ept_num)
clear feature

Detailed Description

usb mass storage bulk-only transport and scsi command header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file msc_bot_scsi.h.


AT32F413 Firmwary Library: msc_class.c File Reference

  • middlewares
  • usbd_class
  • msc
Functions | Variables
msc_class.c File Reference

usb msc class type More...

#include "usbd_core.h"
#include "msc_class.h"
#include "msc_desc.h"
#include "msc_bot_scsi.h"

Go to the source code of this file.

Functions

static usb_sts_type | class_init_handler (void *udev)
initialize usb endpoint
static usb_sts_type | class_clear_handler (void *udev)
clear endpoint or other state
static usb_sts_type | class_setup_handler (void *udev, usb_setup_type *setup)
usb device class setup request handler
static usb_sts_type | class_ept0_tx_handler (void *udev)
usb device endpoint 0 in status stage complete
static usb_sts_type | class_ept0_rx_handler (void *udev)
usb device endpoint 0 out status stage complete
static usb_sts_type | class_in_handler (void *udev, uint8_t ept_num)
usb device transmision complete handler
static usb_sts_type | class_out_handler (void *udev, uint8_t ept_num)
usb device endpoint receive data
static usb_sts_type | class_sof_handler (void *udev)
usb device sof handler
static usb_sts_type | class_event_handler (void *udev, usbd_event_type event)
usb device event handler

Variables

msc_type msc_struct
usbd_class_handler msc_class_handler

Detailed Description

usb msc class type

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file msc_class.c.


AT32F413 Firmwary Library: msc_class.h File Reference

  • middlewares
  • usbd_class
  • msc
Macros | Variables
msc_class.h File Reference

usb msc class file More...

#include "usb_std.h"
#include "usbd_core.h"

Go to the source code of this file.

Macros

#define | USBD_MSC_BULK_IN_EPT 0x81
#define | USBD_MSC_BULK_OUT_EPT 0x01
#define | USBD_IN_MAXPACKET_SIZE 0x40
#define | USBD_OUT_MAXPACKET_SIZE 0x40

Variables

usbd_class_handler msc_class_handler

Detailed Description

usb msc class file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file msc_class.h.


AT32F413 Firmwary Library: msc_desc.c File Reference

  • middlewares
  • usbd_class
  • msc
Functions | Variables
msc_desc.c File Reference

usb msc device descriptor More...

#include "stdio.h"
#include "usb_std.h"
#include "usbd_sdr.h"
#include "usbd_core.h"
#include "msc_desc.h"

Go to the source code of this file.

Functions

static usbd_desc_t * | get_device_descriptor (void)
get device descriptor
static usbd_desc_t * | get_device_qualifier (void)
get device qualifier
static usbd_desc_t * | get_device_configuration (void)
get config descriptor
static usbd_desc_t * | get_device_other_speed (void)
get other speed descriptor
static usbd_desc_t * | get_device_lang_id (void)
get lang id descriptor
static usbd_desc_t * | get_device_manufacturer_string (void)
get manufacturer descriptor
static usbd_desc_t * | get_device_product_string (void)
get product descriptor
static usbd_desc_t * | get_device_serial_string (void)
get serial descriptor
static usbd_desc_t * | get_device_interface_string (void)
get interface descriptor
static usbd_desc_t * | get_device_config_string (void)
get device config descriptor
static uint16_t | usbd_unicode_convert (uint8_t *string, uint8_t *unicode_buf)
standard usb unicode convert
static void | usbd_int_to_unicode (uint32_t value, uint8_t *pbuf, uint8_t len)
usb int convert to unicode
static void | get_serial_num (void)
usb get serial number

Variables

static ALIGNED_HEAD uint8_t g_usbd_desc_buffer[256] | ALIGNED_TAIL
usb device standard descriptor
usbd_desc_handler msc_desc_handler
device descriptor handler structure
static usbd_desc_t | device_descriptor
static usbd_desc_t | config_descriptor
static usbd_desc_t | langid_descriptor
static usbd_desc_t | serial_descriptor
static usbd_desc_t | vp_desc

Detailed Description

usb msc device descriptor

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file msc_desc.c.


AT32F413 Firmwary Library: msc_desc.h File Reference

  • middlewares
  • usbd_class
  • msc
Macros | Variables
msc_desc.h File Reference

usb msc descriptor header file More...

#include "msc_class.h"
#include "usbd_core.h"

Go to the source code of this file.

Macros

#define | MSC_BCD_NUM 0x0110
#define | USBD_MSC_VENDOR_ID 0x2E3C
#define | USBD_MSC_PRODUCT_ID 0x5720
#define | USBD_MSC_CONFIG_DESC_SIZE 32
#define | USBD_MSC_SIZ_STRING_LANGID 4
#define | USBD_MSC_SIZ_STRING_SERIAL 0x1A
#define | USBD_MSC_DESC_MANUFACTURER_STRING "Artery"
#define | USBD_MSC_DESC_PRODUCT_STRING "AT32 Mass Storage"
#define | USBD_MSC_DESC_CONFIGURATION_STRING "Mass Storage Config"
#define | USBD_MSC_DESC_INTERFACE_STRING "Mass Storage Interface"
#define | MCU_ID1 (0x1FFFF7E8)
#define | MCU_ID2 (0x1FFFF7EC)
#define | MCU_ID3 (0x1FFFF7F0)

Variables

usbd_desc_handler msc_desc_handler
device descriptor handler structure

Detailed Description

usb msc descriptor header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file msc_desc.h.


AT32F413 Firmwary Library: printer Directory Reference

  • middlewares
  • usbd_class
  • printer
printer Directory Reference

Files

printer_class.c
usb printer class type
printer_class.h
usb printer class file
printer_desc.c
usb printer device descriptor
printer_desc.h
usb printer descriptor header file


AT32F413 Firmwary Library: printer_class.c File Reference

  • middlewares
  • usbd_class
  • printer
Functions | Variables
printer_class.c File Reference

usb printer class type More...

#include "usbd_core.h"
#include "printer_class.h"
#include "printer_desc.h"

Go to the source code of this file.

Functions

static usb_sts_type | class_init_handler (void *udev)
initialize usb custom hid endpoint
static usb_sts_type | class_clear_handler (void *udev)
clear endpoint or other state
static usb_sts_type | class_setup_handler (void *udev, usb_setup_type *setup)
usb device class setup request handler
static usb_sts_type | class_ept0_tx_handler (void *udev)
usb device endpoint 0 in status stage complete
static usb_sts_type | class_ept0_rx_handler (void *udev)
usb device endpoint 0 out status stage complete
static usb_sts_type | class_in_handler (void *udev, uint8_t ept_num)
usb device transmision complete handler
static usb_sts_type | class_out_handler (void *udev, uint8_t ept_num)
usb device endpoint receive data
static usb_sts_type | class_sof_handler (void *udev)
usb device sof handler
static usb_sts_type | class_event_handler (void *udev, usbd_event_type event)
usb device event handler
uint16_t | usb_printer_get_rxdata (void *udev, uint8_t *recv_data)
usb device class rx data process
error_status | usb_printer_send_data (void *udev, uint8_t *send_data, uint16_t len)
usb device class send data

Variables

static ALIGNED_HEAD uint8_t printer_device_id[24] ALIGNED_TAIL
printer_type printer_struct
usbd_class_handler printer_class_handler

Detailed Description

usb printer class type

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file printer_class.c.


AT32F413 Firmwary Library: printer_class.h File Reference

  • middlewares
  • usbd_class
  • printer
Data Structures | Macros | Enumerations | Functions | Variables
printer_class.h File Reference

usb printer class file More...

#include "usb_std.h"
#include "usbd_core.h"

Go to the source code of this file.

Data Structures

struct printer_type

Macros

#define | USBD_PRINTER_BULK_IN_EPT 0x81
#define | USBD_PRINTER_BULK_OUT_EPT 0x01
#define | USBD_PRINTER_IN_MAXPACKET_SIZE 0x40
#define | USBD_PRINTER_OUT_MAXPACKET_SIZE 0x40
#define | PRINTER_DEVICE_ID_LEN 24

Enumerations

enum printer_req_type { PRINTER_REQ_GET_DEVICE_ID = 0x00 , PRINTER_REQ_GET_PORT_STATUS = 0x01 , PRINTER_REQ_GET_SOFT_RESET = 0x02 }

Functions

uint16_t | usb_printer_get_rxdata (void *udev, uint8_t *recv_data)
usb device class rx data process
error_status | usb_printer_send_data (void *udev, uint8_t *send_data, uint16_t len)
usb device class send data

Variables

usbd_class_handler printer_class_handler

Detailed Description

usb printer class file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file printer_class.h.


AT32F413 Firmwary Library: printer_desc.c File Reference

  • middlewares
  • usbd_class
  • printer
Functions | Variables
printer_desc.c File Reference

usb printer device descriptor More...

#include "stdio.h"
#include "usb_std.h"
#include "usbd_sdr.h"
#include "usbd_core.h"
#include "printer_desc.h"

Go to the source code of this file.

Functions

static usbd_desc_t * | get_device_descriptor (void)
get device descriptor
static usbd_desc_t * | get_device_qualifier (void)
get device qualifier
static usbd_desc_t * | get_device_configuration (void)
get config descriptor
static usbd_desc_t * | get_device_other_speed (void)
get other speed descriptor
static usbd_desc_t * | get_device_lang_id (void)
get lang id descriptor
static usbd_desc_t * | get_device_manufacturer_string (void)
get manufacturer descriptor
static usbd_desc_t * | get_device_product_string (void)
get product descriptor
static usbd_desc_t * | get_device_serial_string (void)
get serial descriptor
static usbd_desc_t * | get_device_interface_string (void)
get interface descriptor
static usbd_desc_t * | get_device_config_string (void)
get device config descriptor
static uint16_t | usbd_unicode_convert (uint8_t *string, uint8_t *unicode_buf)
standard usb unicode convert
static void | usbd_int_to_unicode (uint32_t value, uint8_t *pbuf, uint8_t len)
usb int convert to unicode
static void | get_serial_num (void)
usb get serial number

Variables

static ALIGNED_HEAD uint8_t g_usbd_desc_buffer[256] | ALIGNED_TAIL
usb device standard descriptor
usbd_desc_handler printer_desc_handler
device descriptor handler structure
static usbd_desc_t | device_descriptor
static usbd_desc_t | config_descriptor
static usbd_desc_t | langid_descriptor
static usbd_desc_t | serial_descriptor
static usbd_desc_t | vp_desc

Detailed Description

usb printer device descriptor

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file printer_desc.c.


AT32F413 Firmwary Library: printer_desc.h File Reference

  • middlewares
  • usbd_class
  • printer
Macros | Variables
printer_desc.h File Reference

usb printer descriptor header file More...

#include "printer_class.h"
#include "usbd_core.h"

Go to the source code of this file.

Macros

#define | PRINTER_BCD_NUM 0x0110
#define | USBD_PRINTER_VENDOR_ID 0x2E3C
#define | USBD_PRINTER_PRODUCT_ID 0x57FF
#define | USBD_PRINTER_CONFIG_DESC_SIZE 32
#define | USBD_PRINTER_SIZ_STRING_LANGID 4
#define | USBD_PRINTER_SIZ_STRING_SERIAL 0x1A
#define | USBD_PRINTER_DESC_MANUFACTURER_STRING "Artery"
#define | USBD_PRINTER_DESC_PRODUCT_STRING "AT32 Printer"
#define | USBD_PRINTER_DESC_CONFIGURATION_STRING "Printer Config"
#define | USBD_PRINTER_DESC_INTERFACE_STRING "Printer Interface"
#define | PRINTER_PROTOCOL_UNIDIRECTIONAL 0x01
#define | PRINTER_PROTOCOL_BI_DIRECTIONAL 0x02
#define | PRINTER_PROTOCOL_1284_4 0x03
#define | PRINTER_PROTOCOL_VENDOR_SPECIFIC 0xFF
#define | MCU_ID1 (0x1FFFF7E8)
#define | MCU_ID2 (0x1FFFF7EC)
#define | MCU_ID3 (0x1FFFF7F0)

Variables

usbd_desc_handler printer_desc_handler
device descriptor handler structure

Detailed Description

usb printer descriptor header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file printer_desc.h.


AT32F413 Firmwary Library: winusb Directory Reference

  • middlewares
  • usbd_class
  • winusb
winusb Directory Reference

Files

winusb_class.c
usb winusb class type
winusb_class.h
usb winusb class file
winusb_desc.c
usb winusb device descriptor
winusb_desc.h
usb winusb descriptor header file


AT32F413 Firmwary Library: winusb_class.c File Reference

  • middlewares
  • usbd_class
  • winusb
Functions | Variables
winusb_class.c File Reference

usb winusb class type More...

#include "usbd_core.h"
#include "winusb_class.h"
#include "winusb_desc.h"
#include "string.h"
#include "stdio.h"
#include "stdlib.h"

Go to the source code of this file.

Functions

static usb_sts_type | class_init_handler (void *udev)
initialize usb endpoint
static usb_sts_type | class_clear_handler (void *udev)
clear endpoint or other state
static usb_sts_type | class_setup_handler (void *udev, usb_setup_type *setup)
usb device class setup request handler
static usb_sts_type | class_ept0_tx_handler (void *udev)
usb device endpoint 0 in status stage complete
static usb_sts_type | class_ept0_rx_handler (void *udev)
usb device endpoint 0 out status stage complete
static usb_sts_type | class_in_handler (void *udev, uint8_t ept_num)
usb device transmision complete handler
static usb_sts_type | class_out_handler (void *udev, uint8_t ept_num)
usb device endpoint receive data
static usb_sts_type | class_sof_handler (void *udev)
usb device sof handler
static usb_sts_type | class_event_handler (void *udev, usbd_event_type event)
usb device event handler
static usb_sts_type | winusb_struct_init (winusb_struct_type *p_winusb)
usb device winusb init
uint16_t | usb_winusb_get_rxdata (void *udev, uint8_t *recv_data)
usb device class rx data process
error_status | usb_winusb_send_data (void *udev, uint8_t *send_data, uint16_t len)
usb device class send data

Variables

winusb_struct_type winusb_struct
static uint32_t g_winusb_rx_buffer [16]
usbd_class_handler winusb_class_handler

Detailed Description

usb winusb class type

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file winusb_class.c.


AT32F413 Firmwary Library: winusb_class.h File Reference

  • middlewares
  • usbd_class
  • winusb
Data Structures | Macros | Functions | Variables
winusb_class.h File Reference

usb winusb class file More...

#include "usb_std.h"
#include "usbd_core.h"

Go to the source code of this file.

Data Structures

struct winusb_struct_type
usb winusb class struct More...

Macros

#define | USBD_WINUSB_BULK_IN_EPT 0x81
usb use endpoint define
#define | USBD_WINUSB_BULK_OUT_EPT 0x01
#define | USBD_FS_WINUSB_MAXPACKET_SIZE 0x40
usb in and out max packet size define
#define | USBD_WINUSB_IN_MAXPACKET_SIZE USBD_FS_WINUSB_MAXPACKET_SIZE
#define | USBD_WINUSB_OUT_MAXPACKET_SIZE USBD_FS_WINUSB_MAXPACKET_SIZE
#define | WINUSB_BMS_VENDOR_CODE 0xA0

Functions

uint16_t | usb_winusb_get_rxdata (void *udev, uint8_t *recv_data)
usb device class rx data process
error_status | usb_winusb_send_data (void *udev, uint8_t *send_data, uint16_t len)
usb device class send data

Variables

usbd_class_handler winusb_class_handler

Detailed Description

usb winusb class file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file winusb_class.h.


AT32F413 Firmwary Library: winusb_desc.c File Reference

  • middlewares
  • usbd_class
  • winusb
Functions | Variables
winusb_desc.c File Reference

usb winusb device descriptor More...

#include "stdio.h"
#include "usb_std.h"
#include "usbd_sdr.h"
#include "usbd_core.h"
#include "winusb_desc.h"

Go to the source code of this file.

Functions

static usbd_desc_t * | get_device_descriptor (void)
get device descriptor
static usbd_desc_t * | get_device_qualifier (void)
get device qualifier
static usbd_desc_t * | get_device_configuration (void)
get config descriptor
static usbd_desc_t * | get_device_other_speed (void)
get other speed descriptor
static usbd_desc_t * | get_device_lang_id (void)
get lang id descriptor
static usbd_desc_t * | get_device_manufacturer_string (void)
get manufacturer descriptor
static usbd_desc_t * | get_device_product_string (void)
get product descriptor
static usbd_desc_t * | get_device_serial_string (void)
get serial descriptor
static usbd_desc_t * | get_device_interface_string (void)
get interface descriptor
static usbd_desc_t * | get_device_config_string (void)
get device config descriptor
static uint16_t | usbd_unicode_convert (uint8_t *string, uint8_t *unicode_buf)
standard usb unicode convert
static void | usbd_int_to_unicode (uint32_t value, uint8_t *pbuf, uint8_t len)
usb int convert to unicode
static void | get_serial_num (void)
usb get serial number

Variables

static ALIGNED_HEAD uint8_t g_usbd_desc_buffer[256] | ALIGNED_TAIL
usb device standard descriptor
usbd_desc_handler winusb_desc_handler
device descriptor handler structure
static usbd_desc_t | device_descriptor
static usbd_desc_t | config_descriptor
static usbd_desc_t | langid_descriptor
static usbd_desc_t | serial_descriptor
static usbd_desc_t | vp_desc

Detailed Description

usb winusb device descriptor

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file winusb_desc.c.


AT32F413 Firmwary Library: winusb_desc.h File Reference

  • middlewares
  • usbd_class
  • winusb
Macros | Variables
winusb_desc.h File Reference

usb winusb descriptor header file More...

#include "winusb_class.h"
#include "usbd_core.h"

Go to the source code of this file.

Macros

#define | USBD_WINUSB_VENDOR_ID 0x2E3C
usb vendor id and product id define
#define | USBD_WINUSB_PRODUCT_ID 0x5780
#define | USBD_WINUSB_CONFIG_DESC_SIZE 32
usb descriptor size define
#define | USBD_WINUSB_SIZ_STRING_LANGID 4
#define | USBD_WINUSB_SIZ_STRING_SERIAL 0x1A
#define | USBD_WINUSB_DESC_MANUFACTURER_STRING "Artery"
usb string define(vendor, product configuration, interface)
#define | USBD_WINUSB_DESC_PRODUCT_STRING "AT32 WinUSB"
#define | USBD_WINUSB_DESC_CONFIGURATION_STRING "WinUSB Config"
#define | USBD_WINUSB_DESC_INTERFACE_STRING "WinUSB Interface"
#define | MCU_ID1 (0x1FFFF7E8)
usb mcu id address deine
#define | MCU_ID2 (0x1FFFF7EC)
#define | MCU_ID3 (0x1FFFF7F0)

Variables

usbd_desc_handler winusb_desc_handler
device descriptor handler structure

Detailed Description

usb winusb descriptor header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file winusb_desc.h.


AT32F413 Firmwary Library: usbd_drivers Directory Reference

  • middlewares
  • usbd_drivers
usbd_drivers Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • middlewares
  • usbd_drivers
  • inc
inc Directory Reference

Files

usb_std.h
usb standard header file
usbd_core.h
usb device core header file
usbd_int.h
usbd_sdr.h
usb standard request header file


AT32F413 Firmwary Library: usb_std.h File Reference

  • middlewares
  • usbd_drivers
  • inc
Data Structures | Macros | Enumerations
usb_std.h File Reference

usb standard header file More...

#include "usb_conf.h"

Go to the source code of this file.

Data Structures

struct | linecoding_type
usb cdc class set line coding struct More...
struct | usb_setup_type
format of usb setup data More...
struct | usb_device_desc_type
format of standard device descriptor More...
struct | usb_configuration_desc_type
format of standard configuration descriptor More...
struct | usb_interface_desc_type
format of standard interface descriptor More...
struct | usb_endpoint_desc_type
format of standard endpoint descriptor More...
struct | usb_header_desc_type
format of header More...

Macros

#define | USB_REQ_RECIPIENT_DEVICE 0x00
usb request recipient
#define | USB_REQ_RECIPIENT_INTERFACE 0x01
#define | USB_REQ_RECIPIENT_ENDPOINT 0x02
#define | USB_REQ_RECIPIENT_OTHER 0x03
#define | USB_REQ_RECIPIENT_MASK 0x1F
#define | USB_REQ_TYPE_STANDARD 0x00
usb request type
#define | USB_REQ_TYPE_CLASS 0x20
#define | USB_REQ_TYPE_VENDOR 0x40
#define | USB_REQ_TYPE_RESERVED 0x60
#define | USB_REQ_DIR_HTD 0x00
usb request data transfer direction
#define | USB_REQ_DIR_DTH 0x80
#define | USB_STD_REQ_GET_STATUS 0
usb standard device requests codes
#define | USB_STD_REQ_CLEAR_FEATURE 1
#define | USB_STD_REQ_SET_FEATURE 3
#define | USB_STD_REQ_SET_ADDRESS 5
#define | USB_STD_REQ_GET_DESCRIPTOR 6
#define | USB_STD_REQ_SET_DESCRIPTOR 7
#define | USB_STD_REQ_GET_CONFIGURATION 8
#define | USB_STD_REQ_SET_CONFIGURATION 9
#define | USB_STD_REQ_GET_INTERFACE 10
#define | USB_STD_REQ_SET_INTERFACE 11
#define | USB_STD_REQ_SYNCH_FRAME 12
#define | USB_DESCIPTOR_TYPE_DEVICE 1
usb standard device type
#define | USB_DESCIPTOR_TYPE_CONFIGURATION 2
#define | USB_DESCIPTOR_TYPE_STRING 3
#define | USB_DESCIPTOR_TYPE_INTERFACE 4
#define | USB_DESCIPTOR_TYPE_ENDPOINT 5
#define | USB_DESCIPTOR_TYPE_DEVICE_QUALIFIER 6
#define | USB_DESCIPTOR_TYPE_OTHER_SPEED 7
#define | USB_DESCIPTOR_TYPE_INTERFACE_POWER 8
#define | USB_LANGID_STRING 0
usb standard string type
#define | USB_MFC_STRING 1
#define | USB_PRODUCT_STRING 2
#define | USB_SERIAL_STRING 3
#define | USB_CONFIG_STRING 4
#define | USB_INTERFACE_STRING 5
#define | USB_WINUSB_OS_STRING 0xEE
#define | USB_CONF_REMOTE_WAKEUP 2
usb configuration attributes
#define | USB_CONF_SELF_POWERED 1
#define | USB_FEATURE_EPT_HALT 0
usb standard feature selectors
#define | USB_FEATURE_REMOTE_WAKEUP 1
#define | USB_FEATURE_TEST_MODE 2
#define | USB_WINUSB_COMPAT_ID 0x04
usb winusb feature id
#define | USB_WINUSB_PROPERTIES_ID 0x05
#define | USB_EPT0_IDLE 0
endpoint 0 state
#define | USB_EPT0_SETUP 1
#define | USB_EPT0_DATA_IN 2
#define | USB_EPT0_DATA_OUT 3
#define | USB_EPT0_STATUS_IN 4
#define | USB_EPT0_STATUS_OUT 5
#define | USB_EPT0_STALL 6
#define | USB_DEVICE_QUALIFIER_DESC_LEN 0x0A
usb descriptor length
#define | USB_DEVICE_DESC_LEN 0x12
#define | USB_DEVICE_CFG_DESC_LEN 0x09
#define | USB_DEVICE_IF_DESC_LEN 0x09
#define | USB_DEVICE_EPT_LEN 0x07
#define | USB_DEVICE_OTG_DESC_LEN 0x03
#define | USB_DEVICE_LANGID_STR_DESC_LEN 0x04
#define | USB_DEVICE_OTHER_SPEED_DESC_SIZ_LEN 0x09
#define | USB_CLASS_CODE_AUDIO 0x01
usb class code
#define | USB_CLASS_CODE_CDC 0x02
#define | USB_CLASS_CODE_HID 0x03
#define | USB_CLASS_CODE_PRINTER 0x07
#define | USB_CLASS_CODE_MSC 0x08
#define | USB_CLASS_CODE_HUB 0x09
#define | USB_CLASS_CODE_CDCDATA 0x0A
#define | USB_CLASS_CODE_CCID 0x0B
#define | USB_CLASS_CODE_VIDEO 0x0E
#define | USB_CLASS_CODE_VENDOR 0xFF
#define | USB_EPT_DESC_CONTROL 0x00
usb endpoint type
#define | USB_EPT_DESC_ISO 0x01
#define | USB_EPT_DESC_BULK 0x02
#define | USB_EPT_DESC_INTERRUPT 0x03
#define | USB_EPT_DESC_NSYNC 0x00
#define | USB_ETP_DESC_ASYNC 0x04
#define | USB_ETP_DESC_ADAPTIVE 0x08
#define | USB_ETP_DESC_SYNC 0x0C
#define | USB_EPT_DESC_DATA_EPT 0x00
#define | USB_EPT_DESC_FD_EPT 0x10
#define | USB_EPT_DESC_FDDATA_EPT 0x20
#define | USBD_CDC_CS_INTERFACE 0x24
usb cdc class descriptor define
#define | USBD_CDC_CS_ENDPOINT 0x25
#define | USBD_CDC_SUBTYPE_HEADER 0x00
usb cdc class sub-type define
#define | USBD_CDC_SUBTYPE_CMF 0x01
#define | USBD_CDC_SUBTYPE_ACM 0x02
#define | USBD_CDC_SUBTYPE_UFD 0x06
#define | SET_LINE_CODING 0x20
usb cdc class request code define
#define | GET_LINE_CODING 0x21
#define | HID_CLASS_DESC_HID 0x21
usb hid class descriptor define
#define | HID_CLASS_DESC_REPORT 0x22
#define | HID_CLASS_DESC_PHYSICAL 0x23
#define | HID_REQ_SET_PROTOCOL 0x0B
usb hid class request code define
#define | HID_REQ_GET_PROTOCOL 0x03
#define | HID_REQ_SET_IDLE 0x0A
#define | HID_REQ_GET_IDLE 0x02
#define | HID_REQ_SET_REPORT 0x09
#define | HID_REQ_GET_REPORT 0x01
#define | HID_DESCRIPTOR_TYPE 0x21
#define | HID_REPORT_DESC 0x22
#define | USB_MAX_EP0_SIZE 64
endpoint 0 max size
#define | SWAPBYTE(addr)
usb swap address
#define | MIN(a, b)
min and max define
#define | MAX(a, b)
#define | LBYTE(x)
low byte and high byte define
#define | HBYTE(x)

Enumerations

enum usbd_conn_state { USB_CONN_STATE_DEFAULT =1 , USB_CONN_STATE_ADDRESSED , USB_CONN_STATE_CONFIGURED , USB_CONN_STATE_SUSPENDED }
usb device connect state More...
enum usb_sts_type {
USB_OK , USB_FAIL , USB_WAIT , USB_NOT_SUPPORT ,
USB_ERROR
}
usb return status More...

Detailed Description

usb standard header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file usb_std.h.


AT32F413 Firmwary Library: usbd_core.h File Reference

  • middlewares
  • usbd_drivers
  • inc
Data Structures | Enumerations | Functions
usbd_core.h File Reference

usb device core header file More...

#include "usb_conf.h"
#include "usb_std.h"

Go to the source code of this file.

Data Structures

struct | usbd_desc_t
usb device descriptor struct More...
struct | usbd_desc_handler
usb device descriptor handler More...
struct | usbd_class_handler
usb device class handler More...
struct | usbd_core_type
usb device core struct type More...

Enumerations

enum usbd_event_type {
USBD_NOP_EVENT , USBD_RESET_EVENT , USBD_SUSPEND_EVENT , USBD_WAKEUP_EVENT ,
USBD_ERR_EVENT
}
usb device event More...

Functions

void | usbd_core_in_handler (usbd_core_type *udev, uint8_t ept_num)
usb core in transfer complete handler
void | usbd_core_out_handler (usbd_core_type *udev, uint8_t ept_num)
usb core out transfer complete handler
void | usbd_core_setup_handler (usbd_core_type *udev, uint8_t ept_num)
usb core setup transfer complete handler
void | usbd_ctrl_unsupport (usbd_core_type *udev)
un-support device request
void | usbd_ctrl_send (usbd_core_type *udev, uint8_t *buffer, uint16_t len)
usb control endpoint send data
void | usbd_ctrl_recv (usbd_core_type *udev, uint8_t *buffer, uint16_t len)
usb control endpoint receive data
void | usbd_ctrl_send_status (usbd_core_type *udev)
usb control endpoint send in status
void | usbd_ctrl_recv_status (usbd_core_type *udev)
usb control endpoint send out status
void | usbd_set_stall (usbd_core_type *udev, uint8_t ept_addr)
usb set endpoint to stall.
void | usbd_clear_stall (usbd_core_type *udev, uint8_t ept_addr)
clear endpoint stall
void | usbd_ept_open (usbd_core_type *udev, uint8_t ept_addr, uint8_t ept_type, uint16_t maxpacket)
usb open endpoint
void | usbd_ept_close (usbd_core_type *udev, uint8_t ept_addr)
usb close endpoint
void | usbd_ept_send (usbd_core_type *udev, uint8_t ept_num, uint8_t *buffer, uint16_t len)
usb endpoint send data
void | usbd_ept_recv (usbd_core_type *udev, uint8_t ept_num, uint8_t *buffer, uint16_t len)
usb endpoint receive data
void | usbd_connect (usbd_core_type *udev)
usb device connect to host
void | usbd_disconnect (usbd_core_type *udev)
usb device disconnect to host
void | usbd_set_device_addr (usbd_core_type *udev, uint8_t address)
usb device set device address.
uint32_t | usbd_get_recv_len (usbd_core_type *udev, uint8_t ept_addr)
usb endpoint get receive data length
usbd_conn_state | usbd_connect_state_get (usbd_core_type *udev)
get usb connect state
void | usbd_ept_dbuffer_enable (usbd_core_type *udev, uint8_t ept_addr)
enable endpoint double buffer.
void | usbd_ept_buf_auto_define (usb_ept_info *ept_info)
usb auto define endpoint buffer
void | usbd_ept_buf_custom_define (usbd_core_type *udev, uint8_t ept_addr, uint32_t addr)
usb custom define endpoint buffer
void | usbd_ept_defaut_init (usbd_core_type *udev)
usb endpoint structure initialization
void | usbd_remote_wakeup (usbd_core_type *udev)
usb device remote wakeup
void | usbd_enter_suspend (usbd_core_type *udev)
usb device enter suspend mode
void | usbd_core_init (usbd_core_type *udev, usb_reg_type *usb_reg, usbd_class_handler *dev_handler, usbd_desc_handler *desc_handler, uint8_t core_id)
initializes the usb core

Detailed Description

usb device core header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file usbd_core.h.


AT32F413 Firmwary Library: usbd_int.h File Reference

  • middlewares
  • usbd_drivers
  • inc
Functions
usbd_int.h File Reference
#include "usbd_core.h"

Go to the source code of this file.

Functions

void | usbd_irq_handler (usbd_core_type *udev)
usb device interrput request handler.
void | usbd_ept_loop_handler (usbd_core_type *udev)
usb device endpoint loop handler.
void | usbd_eptn_handler (usbd_core_type *udev, usb_ept_number_type ept_num)
usb device endpoint request handler.
void | usbd_reset_handler (usbd_core_type *udev)
usb device reset interrupt request handler.
void | usbd_sof_handler (usbd_core_type *udev)
usb device sof interrupt request handler.
void | usbd_suspend_handler (usbd_core_type *udev)
usb device suspend interrupt request handler.
void | usbd_wakeup_handler (usbd_core_type *udev)
usb device wakup interrupt request handler.


AT32F413 Firmwary Library: usbd_sdr.h File Reference

  • middlewares
  • usbd_drivers
  • inc
Functions
usbd_sdr.h File Reference

usb standard request header file More...

#include "usbd_core.h"

Go to the source code of this file.

Functions

void | usbd_setup_request_parse (usb_setup_type *setup, uint8_t *buf)
usb parse standard setup request
usb_sts_type | usbd_device_request (usbd_core_type *udev)
standard usb device requests
usb_sts_type | usbd_interface_request (usbd_core_type *udev)
standard usb interface requests
usb_sts_type | usbd_endpoint_request (usbd_core_type *udev)
standard usb endpoint requests

Detailed Description

usb standard request header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file usbd_sdr.h.


AT32F413 Firmwary Library: src Directory Reference

  • middlewares
  • usbd_drivers
  • src
src Directory Reference

Files

usbd_core.c
usb driver
usbd_int.c
usb interrupt request
usbd_sdr.c
usb standard device request


AT32F413 Firmwary Library: usbd_core.c File Reference

  • middlewares
  • usbd_drivers
  • src
Functions
usbd_core.c File Reference

usb driver More...

#include "usbd_core.h"
#include "usbd_sdr.h"

Go to the source code of this file.

Functions

void | usbd_core_in_handler (usbd_core_type *udev, uint8_t ept_addr)
usb core in transfer complete handler
void | usbd_core_out_handler (usbd_core_type *udev, uint8_t ept_addr)
usb core out transfer complete handler
void | usbd_core_setup_handler (usbd_core_type *udev, uint8_t ept_num)
usb core setup transfer complete handler
void | usbd_ctrl_send (usbd_core_type *udev, uint8_t *buffer, uint16_t len)
usb control endpoint send data
void | usbd_ctrl_recv (usbd_core_type *udev, uint8_t *buffer, uint16_t len)
usb control endpoint receive data
void | usbd_ctrl_send_status (usbd_core_type *udev)
usb control endpoint send in status
void | usbd_ctrl_recv_status (usbd_core_type *udev)
usb control endpoint send out status
void | usbd_clear_stall (usbd_core_type *udev, uint8_t ept_addr)
clear endpoint stall
void | usbd_set_stall (usbd_core_type *udev, uint8_t ept_addr)
usb set endpoint to stall.
void | usbd_ctrl_unsupport (usbd_core_type *udev)
un-support device request
void | usbd_ept_send (usbd_core_type *udev, uint8_t ept_addr, uint8_t *buffer, uint16_t len)
usb endpoint send data
void | usbd_ept_recv (usbd_core_type *udev, uint8_t ept_addr, uint8_t *buffer, uint16_t len)
usb endpoint receive data
uint32_t | usbd_get_recv_len (usbd_core_type *udev, uint8_t ept_addr)
usb endpoint get receive data length
void | usbd_ept_dbuffer_enable (usbd_core_type *udev, uint8_t ept_addr)
enable endpoint double buffer.
void | usbd_ept_buf_auto_define (usb_ept_info *ept_info)
usb auto define endpoint buffer
void | usbd_ept_buf_custom_define (usbd_core_type *udev, uint8_t ept_addr, uint32_t addr)
usb custom define endpoint buffer
void | usbd_ept_open (usbd_core_type *udev, uint8_t ept_addr, uint8_t ept_type, uint16_t maxpacket)
usb open endpoint
void | usbd_ept_close (usbd_core_type *udev, uint8_t ept_addr)
usb close endpoint
void | usbd_connect (usbd_core_type *udev)
usb device connect to host
void | usbd_disconnect (usbd_core_type *udev)
usb device disconnect to host
void | usbd_set_device_addr (usbd_core_type *udev, uint8_t address)
usb device set device address.
usbd_conn_state | usbd_connect_state_get (usbd_core_type *udev)
get usb connect state
void | usbd_remote_wakeup (usbd_core_type *udev)
usb device remote wakeup
void | usbd_enter_suspend (usbd_core_type *udev)
usb device enter suspend mode
void | usbd_ept_defaut_init (usbd_core_type *udev)
usb endpoint structure initialization
void | usbd_core_init (usbd_core_type *udev, usb_reg_type *usb_reg, usbd_class_handler *class_handler, usbd_desc_handler *desc_handler, uint8_t core_id)
initializes the usb core

Detailed Description

usb driver

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file usbd_core.c.


AT32F413 Firmwary Library: usbd_int.c File Reference

  • middlewares
  • usbd_drivers
  • src
Functions
usbd_int.c File Reference

usb interrupt request More...

#include "usbd_int.h"

Go to the source code of this file.

Functions

void | usbd_irq_handler (usbd_core_type *udev)
usb device interrput request handler.
void | usbd_eptn_handler (usbd_core_type *udev, usb_ept_number_type ept_num)
usb device endpoint request handler.
void | usbd_ept_loop_handler (usbd_core_type *udev)
usb device endpoint loop handler.
void | usbd_reset_handler (usbd_core_type *udev)
usb device reset interrupt request handler.
void | usbd_sof_handler (usbd_core_type *udev)
usb device sof interrupt request handler.
void | usbd_suspend_handler (usbd_core_type *udev)
usb device suspend interrupt request handler.
void | usbd_wakeup_handler (usbd_core_type *udev)
usb device wakup interrupt request handler.

Detailed Description

usb interrupt request

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file usbd_int.c.


AT32F413 Firmwary Library: usbd_sdr.c File Reference

  • middlewares
  • usbd_drivers
  • src
Functions
usbd_sdr.c File Reference

usb standard device request More...

#include "usbd_sdr.h"

Go to the source code of this file.

Functions

static usb_sts_type | usbd_get_descriptor (usbd_core_type *udev)
get usb standard device description request
static usb_sts_type | usbd_set_address (usbd_core_type *udev)
this request sets the device address
static usb_sts_type | usbd_get_status (usbd_core_type *udev)
get usb status request
static usb_sts_type | usbd_clear_feature (usbd_core_type *udev)
clear usb feature request
static usb_sts_type | usbd_set_feature (usbd_core_type *udev)
set usb feature request
static usb_sts_type | usbd_get_configuration (usbd_core_type *udev)
get usb configuration request
static usb_sts_type | usbd_set_configuration (usbd_core_type *udev)
sets the usb device configuration request
void | usbd_setup_request_parse (usb_setup_type *setup, uint8_t *buf)
usb parse standard setup request
usb_sts_type | usbd_device_request (usbd_core_type *udev)
standard usb device requests
usb_sts_type | usbd_interface_request (usbd_core_type *udev)
standard usb interface requests
usb_sts_type | usbd_endpoint_request (usbd_core_type *udev)
standard usb endpoint requests

Detailed Description

usb standard device request

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file usbd_sdr.c.


AT32F413 Firmwary Library: project Directory Reference

  • project
project Directory Reference

Directories

at32f413_board
at_start_f413


AT32F413 Firmwary Library: at32f413_board Directory Reference

  • project
  • at32f413_board
at32f413_board Directory Reference

Files

at32f413_board.c
set of firmware functions to manage leds and push-button. initialize delay function.
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button. initialize delay function.


AT32F413 Firmwary Library: at32f413_board.c File Reference

  • at32f413_board
Macros | Functions | Variables
at32f413_board.c File Reference

set of firmware functions to manage leds and push-button. initialize delay function. More...

#include "at32f413_board.h"

Go to the source code of this file.

Macros

#define | STEP_DELAY_MS 50
#define | PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)

Functions

int | fputc (int ch, FILE *f)
retargets the c library printf function to the usart.
void | uart_print_init (uint32_t baudrate)
initialize uart
void | at32_board_init ()
board initialize interface init led and button
void | at32_button_init (void)
configure button gpio
uint8_t | at32_button_state (void)
returns the selected button state
button_type at32_button_press ()
returns which button have press down
void | at32_led_init (led_type led)
configure led gpio
void | at32_led_on (led_type led)
turns selected led on.
void | at32_led_off (led_type led)
turns selected led off.
void | at32_led_toggle (led_type led)
turns selected led toggle.
void | delay_init ()
initialize delay function
void | delay_us (uint32_t nus)
inserts a delay time.
void | delay_ms (uint16_t nms)
inserts a delay time.
void | delay_sec (uint16_t sec)
inserts a delay time.

Variables

gpio_type * | led_gpio_port [3] = {LED2_GPIO, LED3_GPIO, LED4_GPIO}
uint16_t | led_gpio_pin [3] = {LED2_PIN, LED3_PIN, LED4_PIN}
crm_periph_clock_type | led_gpio_crm_clk [3] = {LED2_GPIO_CRM_CLK, LED3_GPIO_CRM_CLK, LED4_GPIO_CRM_CLK}
static __IO uint32_t | fac_us
static __IO uint32_t | fac_ms

Detailed Description

set of firmware functions to manage leds and push-button. initialize delay function.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_board.c.


AT32F413 Firmwary Library: at32f413_board.h File Reference

  • at32f413_board
Macros | Enumerations | Functions
at32f413_board.h File Reference

header file for at-start board. set of firmware functions to manage leds and push-button. initialize delay function. More...

#include "stdio.h"
#include "at32f413.h"

Go to the source code of this file.

Macros

#define | LED_NUM 3
#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
#define | USER_BUTTON_PIN GPIO_PINS_0
#define | USER_BUTTON_PORT GPIOA
#define | USER_BUTTON_CRM_CLK CRM_GPIOA_PERIPH_CLOCK

Enumerations

enum | led_type { LED2 = 0 , LED3 = 1 , LED4 = 2 }
enum | button_type { USER_BUTTON = 0 , NO_BUTTON = 1 }

Functions

void | at32_board_init (void)
board initialize interface init led and button
void | at32_led_init (led_type led)
configure led gpio
void | at32_led_on (led_type led)
turns selected led on.
void | at32_led_off (led_type led)
turns selected led off.
void | at32_led_toggle (led_type led)
turns selected led toggle.
void | at32_button_init (void)
configure button gpio
button_type | at32_button_press (void)
returns which button have press down
uint8_t | at32_button_state (void)
returns the selected button state
void | delay_init (void)
initialize delay function
void | delay_us (uint32_t nus)
inserts a delay time.
void | delay_ms (uint16_t nms)
inserts a delay time.
void | delay_sec (uint16_t sec)
inserts a delay time.
void | uart_print_init (uint32_t baudrate)
initialize uart

Detailed Description

header file for at-start board. set of firmware functions to manage leds and push-button. initialize delay function.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file at32f413_board.h.


AT32F413 Firmwary Library: at_start_f413 Directory Reference

  • at_start_f413
at_start_f413 Directory Reference

Directories

examples
templates


AT32F413 Firmwary Library: examples Directory Reference

  • examples
examples Directory Reference

Directories

acc
adc
bpr
can
cortex_m4
crc
crm
debug
dma
exint
flash
gpio
i2c
i2s
pwc
rtc
sdio
spi
tmr
usart
usb_device
wdt
wwdt


AT32F413 Firmwary Library: acc Directory Reference

  • acc
acc Directory Reference

Directories

calibration


AT32F413 Firmwary Library: calibration Directory Reference

  • acc
  • calibration
calibration Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • acc
  • calibration
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.
usb_conf.h
usb config header file


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • acc
  • calibration
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/acc/calibration/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • acc
  • calibration
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h.

Referenced by crm_hext_stable_wait().

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h.

Referenced by crm_clocks_freq_get(), and system_core_clock_update().

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h.

Referenced by crm_clocks_freq_get(), main(), and system_core_clock_update().

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • acc
  • calibration
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/acc/calibration/inc/at32f413_int.h.


AT32F413 Firmwary Library: usb_conf.h File Reference

  • acc
  • calibration
  • inc
Macros | Functions
usb_conf.h File Reference

usb config header file More...

#include "at32f413.h"
#include "at32f413_board.h"
#include "stdio.h"

Go to the source code of this file.

Macros

#define | EPT0_TX_ADDR 0x40
usb endpoint max num define
#define | EPT0_RX_ADDR 0x80
#define | EPT1_TX_ADDR 0xC0
#define | EPT1_RX_ADDR 0x100
#define | EPT2_TX_ADDR 0x140
#define | EPT2_RX_ADDR 0x180
#define | EPT3_TX_ADDR 0x00
#define | EPT3_RX_ADDR 0x00
#define | EPT4_TX_ADDR 0x00
#define | EPT4_RX_ADDR 0x00
#define | EPT5_TX_ADDR 0x00
#define | EPT5_RX_ADDR 0x00
#define | EPT6_TX_ADDR 0x00
#define | EPT6_RX_ADDR 0x00
#define | EPT7_TX_ADDR 0x00
#define | EPT7_RX_ADDR 0x00

Functions

void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.

Detailed Description

usb config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/acc/calibration/inc/usb_conf.h.


AT32F413 Firmwary Library: src Directory Reference

  • acc
  • calibration
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • acc
  • calibration
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • acc
  • calibration
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/acc/calibration/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • acc
  • calibration
  • src
Macros | Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include "usbd_core.h"
#include "cdc_class.h"
#include "cdc_desc.h"
#include "usbd_int.h"

Go to the source code of this file.

Macros

#define | SCLK_FROM_HICK
#define | ACC_TRIM

Functions

void | system_clock_config_for_acc (void)
system clock config for acc
void | clkout_config (void)
clkout configuration
void | usb_clock48m_select (usb_clk48_s clk_s)
usb 48M clock select
void | USBFS_L_CAN1_RX0_IRQHandler (void)
usbfs_l_can1_rx0 interrupt handler
void | ACC_IRQHandler (void)
acc interrupt handler
void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.
int | main (void)
main function.

Variables

usbd_core_type usb_core_dev
uint8_t | usb_buffer [256]
uint32_t | acc_c2_value = 0

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/acc/calibration/src/main.c.


AT32F413 Firmwary Library: adc Directory Reference

  • adc
adc Directory Reference

Directories

combine_mode_ordinary_simult
current_vref_value_check
exint_trigger_partitioned
internal_temperature_sensor
repeat_conversion_loop_transfer
tmr_trigger_automatic_preempted
voltage_monitoring


AT32F413 Firmwary Library: combine_mode_ordinary_simult Directory Reference

  • adc
  • combine_mode_ordinary_simult
combine_mode_ordinary_simult Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • adc
  • combine_mode_ordinary_simult
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • adc
  • combine_mode_ordinary_simult
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • adc
  • combine_mode_ordinary_simult
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • adc
  • combine_mode_ordinary_simult
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • adc
  • combine_mode_ordinary_simult
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • adc
  • combine_mode_ordinary_simult
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • adc
  • combine_mode_ordinary_simult
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • adc
  • combine_mode_ordinary_simult
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

static void | gpio_config (void)
gpio configuration.
static void | dma_config (void)
dma configuration.
static void | adc_config (void)
adc configuration.
void | DMA1_Channel1_IRQHandler (void)
this function handles dma1_channel1 handler.
int | main (void)
main function.

Variables

__IO uint32_t | adc1_ordinary_valuetab [3]
__IO uint32_t | dma1_trans_complete_flag = 0
__IO uint32_t | conversion_times_index = 0

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/main.c.


AT32F413 Firmwary Library: current_vref_value_check Directory Reference

  • adc
  • current_vref_value_check
current_vref_value_check Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • adc
  • current_vref_value_check
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • adc
  • current_vref_value_check
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • adc
  • current_vref_value_check
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • adc
  • current_vref_value_check
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • adc
  • current_vref_value_check
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • adc
  • current_vref_value_check
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/adc/current_vref_value_check/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/adc/current_vref_value_check/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • adc
  • current_vref_value_check
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/adc/current_vref_value_check/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • adc
  • current_vref_value_check
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

static void | dma_config (void)
dma configuration.
static void | adc_config (void)
adc configuration.
int | main (void)
main function.

Variables

__IO uint16_t adc1_ordinary_value = 0

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/adc/current_vref_value_check/src/main.c.


AT32F413 Firmwary Library: exint_trigger_partitioned Directory Reference

  • adc
  • exint_trigger_partitioned
exint_trigger_partitioned Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • adc
  • exint_trigger_partitioned
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • adc
  • exint_trigger_partitioned
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • adc
  • exint_trigger_partitioned
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • adc
  • exint_trigger_partitioned
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • adc
  • exint_trigger_partitioned
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • adc
  • exint_trigger_partitioned
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/adc/exint_trigger_partitioned/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/adc/exint_trigger_partitioned/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • adc
  • exint_trigger_partitioned
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/adc/exint_trigger_partitioned/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • adc
  • exint_trigger_partitioned
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

static void | gpio_config (void)
gpio configuration.
static void | exint_config (void)
exint configuration.
static void | dma_config (void)
dma configuration.
static void | adc_config (void)
adc configuration.
void | DMA1_Channel1_IRQHandler (void)
this function handles dma1_channel1 handler.
void | ADC1_2_IRQHandler (void)
this function handles adc1_2 handler.
int | main (void)
main function.

Variables

__IO uint16_t | adc1_ordinary_valuetab [3] = {0}
__IO uint16_t | adc1_preempt_valuetab [3] = {0}
__IO uint16_t | dma_trans_complete_flag = 0
__IO uint16_t | ordinary_conversion_times_index = 0
__IO uint16_t | preempt_trigger_count = 0
__IO uint16_t | preempt_conversion_times_index = 0

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c.


AT32F413 Firmwary Library: internal_temperature_sensor Directory Reference

  • adc
  • internal_temperature_sensor
internal_temperature_sensor Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • adc
  • internal_temperature_sensor
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • adc
  • internal_temperature_sensor
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • adc
  • internal_temperature_sensor
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • adc
  • internal_temperature_sensor
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • adc
  • internal_temperature_sensor
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • adc
  • internal_temperature_sensor
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/adc/internal_temperature_sensor/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/adc/internal_temperature_sensor/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • adc
  • internal_temperature_sensor
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/adc/internal_temperature_sensor/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • adc
  • internal_temperature_sensor
  • src
Macros | Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Macros

#define | ADC_VREF (3.3)
#define | ADC_TEMP_BASE (1.28)
#define | ADC_TEMP_SLOPE (-0.00420)

Functions

static void | dma_config (void)
dma configuration.
static void | adc_config (void)
adc configuration.
int | main (void)
main function.

Variables

__IO uint16_t adc1_ordinary_value = 0

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/adc/internal_temperature_sensor/src/main.c.


AT32F413 Firmwary Library: repeat_conversion_loop_transfer Directory Reference

  • adc
  • repeat_conversion_loop_transfer
repeat_conversion_loop_transfer Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • adc
  • repeat_conversion_loop_transfer
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • adc
  • repeat_conversion_loop_transfer
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • adc
  • repeat_conversion_loop_transfer
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • adc
  • repeat_conversion_loop_transfer
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • adc
  • repeat_conversion_loop_transfer
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • adc
  • repeat_conversion_loop_transfer
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • adc
  • repeat_conversion_loop_transfer
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • adc
  • repeat_conversion_loop_transfer
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

static void | gpio_config (void)
gpio configuration.
static void | dma_config (void)
dma configuration.
static void | adc_config (void)
adc configuration.
void | DMA1_Channel1_IRQHandler (void)
this function handles dma1_channel1 handler.
int | main (void)
main function.

Variables

__IO uint16_t | adc1_ordinary_valuetab [3] = {0}
__IO uint16_t | dma_trans_complete_flag = 0

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/main.c.


AT32F413 Firmwary Library: tmr_trigger_automatic_preempted Directory Reference

  • adc
  • tmr_trigger_automatic_preempted
tmr_trigger_automatic_preempted Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • adc
  • tmr_trigger_automatic_preempted
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • adc
  • tmr_trigger_automatic_preempted
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • adc
  • tmr_trigger_automatic_preempted
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • adc
  • tmr_trigger_automatic_preempted
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • adc
  • tmr_trigger_automatic_preempted
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • adc
  • tmr_trigger_automatic_preempted
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • adc
  • tmr_trigger_automatic_preempted
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • adc
  • tmr_trigger_automatic_preempted
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

static void | gpio_config (void)
gpio configuration.
static void | dma_config (void)
dma configuration.
static void | tmr1_config (void)
tmr1 configuration.
static void | adc_config (void)
adc configuration.
void | DMA1_Channel1_IRQHandler (void)
this function handles dma1_channel1 handler.
void | ADC1_2_IRQHandler (void)
this function handles adc1_2 handler.
int | main (void)
main function.

Variables

__IO uint16_t | adc1_ordinary_valuetab [3] = {0}
__IO uint16_t | adc1_preempt_valuetab [3] = {0}
__IO uint16_t | dma_trans_complete_flag = 0
__IO uint16_t | ordinary_conversion_times_index = 0
__IO uint16_t | preempt_conversion_count = 0
__IO uint16_t | preempt_conversion_times_index = 0

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c.


AT32F413 Firmwary Library: voltage_monitoring Directory Reference

  • adc
  • voltage_monitoring
voltage_monitoring Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • adc
  • voltage_monitoring
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • adc
  • voltage_monitoring
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • adc
  • voltage_monitoring
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • adc
  • voltage_monitoring
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • adc
  • voltage_monitoring
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • adc
  • voltage_monitoring
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/adc/voltage_monitoring/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/adc/voltage_monitoring/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • adc
  • voltage_monitoring
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/adc/voltage_monitoring/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • adc
  • voltage_monitoring
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

static void | gpio_config (void)
gpio configuration.
static void | dma_config (void)
dma configuration.
static void | adc_config (void)
adc configuration.
void | ADC1_2_IRQHandler (void)
this function handles adc1_2 handler.
int | main (void)
main function.

Variables

__IO uint16_t | adc1_ordinary_valuetab [3] = {0}
__IO uint16_t | vmor_flag_index = 0
__IO uint16_t | error_times_index = 0

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/adc/voltage_monitoring/src/main.c.


AT32F413 Firmwary Library: bpr Directory Reference

  • bpr
bpr Directory Reference

Directories

bpr_data
tamper


AT32F413 Firmwary Library: bpr_data Directory Reference

  • bpr
  • bpr_data
bpr_data Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • bpr
  • bpr_data
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • bpr
  • bpr_data
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • bpr
  • bpr_data
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • bpr
  • bpr_data
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • bpr
  • bpr_data
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • bpr
  • bpr_data
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/bpr/bpr_data/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/bpr/bpr_data/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • bpr
  • bpr_data
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/bpr/bpr_data/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • bpr
  • bpr_data
  • src
Macros | Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Macros

#define BPR_DR_NUMBER 42

Functions

void | bpr_reg_write (void)
write data to bpr dt register.
uint8_t | bpr_reg_check (void)
checks if the bpr dt register values are correct or not.
void | uart_init (uint32_t baudrate)
init usart.
int | main (void)
main function.

Variables

bpr_data_type bpr_addr_tab [42]

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/bpr/bpr_data/src/main.c.


AT32F413 Firmwary Library: tamper Directory Reference

  • bpr
  • tamper
tamper Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • bpr
  • tamper
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • bpr
  • tamper
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/bpr/tamper/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • bpr
  • tamper
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • bpr
  • tamper
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/bpr/tamper/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • bpr
  • tamper
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • bpr
  • tamper
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/bpr/tamper/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/bpr/tamper/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • bpr
  • tamper
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"
#include "at32f413_board.h"

Go to the source code of this file.

Functions

uint32_t | bpr_reg_judge (void)
checks if the bpr dt registers are reset or not.
void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | TAMPER_IRQHandler (void)
this function handles tamper interrupt request.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/bpr/tamper/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • bpr
  • tamper
  • src
Macros | Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Macros

#define BPR_DR_NUMBER 42

Functions

void | bpr_reg_write (void)
write data to bpr dt registers.
uint8_t | bpr_reg_check (void)
checks if the bpr dt registers values are correct or not.
uint32_t | bpr_reg_judge (void)
checks if the bpr dt registers are reset or not.
int | main (void)
main function.

Variables

bpr_data_type bpr_addr_tab [42]

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/bpr/tamper/src/main.c.


AT32F413 Firmwary Library: can Directory Reference

  • can
can Directory Reference

Directories

communication_mode
filter
loopback_mode


AT32F413 Firmwary Library: communication_mode Directory Reference

  • can
  • communication_mode
communication_mode Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • can
  • communication_mode
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • can
  • communication_mode
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/can/communication_mode/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • can
  • communication_mode
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • can
  • communication_mode
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/can/communication_mode/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • can
  • communication_mode
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • can
  • communication_mode
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/can/communication_mode/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/can/communication_mode/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • can
  • communication_mode
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/can/communication_mode/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • can
  • communication_mode
  • src
Functions
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

static void | can_gpio_config (void)
can gpio config
error_status | can_configuration (void)
can configiguration.
static void | can_transmit_data (void)
can transmit data
void | USBFS_L_CAN1_RX0_IRQHandler (void)
can1 interrupt function rx0
void | CAN1_SE_IRQHandler (void)
can1 interrupt function se
int | main (void)
main function.

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/can/communication_mode/src/main.c.


AT32F413 Firmwary Library: filter Directory Reference

  • can
  • filter
filter Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • can
  • filter
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • can
  • filter
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/can/filter/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • can
  • filter
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/can/filter/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/can/filter/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/can/filter/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/can/filter/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/can/filter/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/can/filter/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/can/filter/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/can/filter/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/can/filter/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/can/filter/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/can/filter/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/can/filter/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/can/filter/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/can/filter/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/can/filter/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/can/filter/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/can/filter/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/can/filter/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/can/filter/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/can/filter/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/can/filter/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/can/filter/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/can/filter/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/can/filter/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/can/filter/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/can/filter/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/can/filter/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • can
  • filter
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/can/filter/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • can
  • filter
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • can
  • filter
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/can/filter/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/can/filter/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • can
  • filter
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/can/filter/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • can
  • filter
  • src
Macros | Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Macros

#define | FILTER_EXT_ID1 ((uint32_t)0x18F5F100)
#define | FILTER_EXT_ID2 ((uint32_t)0x18F5F200)
#define | FILTER_EXT_ID3 ((uint32_t)0x18F5F300)
#define | FILTER_STD_ID1 ((uint16_t)0x04F6)
#define | FILTER_STD_ID2 ((uint16_t)0x04F7)
#define | FILTER_STD_ID3 ((uint16_t)0x04F8)

Functions

static void | can_gpio_config (void)
can gpio config
error_status | can_configuration (void)
can configiguration.
static void | can_transmit_data (void)
can transmit data
void | USBFS_L_CAN1_RX0_IRQHandler (void)
can1 interrupt function rx0
void | CAN1_SE_IRQHandler (void)
can1 interrupt function se
int | main (void)
main function.

Variables

uint8_t test_result = 0

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/can/filter/src/main.c.


AT32F413 Firmwary Library: loopback_mode Directory Reference

  • can
  • loopback_mode
loopback_mode Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • can
  • loopback_mode
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • can
  • loopback_mode
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/can/loopback_mode/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • can
  • loopback_mode
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • can
  • loopback_mode
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/can/loopback_mode/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • can
  • loopback_mode
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • can
  • loopback_mode
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/can/loopback_mode/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/can/loopback_mode/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • can
  • loopback_mode
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/can/loopback_mode/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • can
  • loopback_mode
  • src
Functions
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

static void | can_gpio_config (void)
can gpio config
error_status | can_configuration (void)
can configiguration.
static void | can_transmit_data (void)
can transmit data
void | USBFS_L_CAN1_RX0_IRQHandler (void)
can1 interrupt function rx0
void | CAN1_SE_IRQHandler (void)
can1 interrupt function se
int | main (void)
main function.

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/can/loopback_mode/src/main.c.


AT32F413 Firmwary Library: cortex_m4 Directory Reference

  • cortex_m4
cortex_m4 Directory Reference

Directories

bit_band
cmsis_dsp
fpu
systick_interrupt


AT32F413 Firmwary Library: bit_band Directory Reference

  • cortex_m4
  • bit_band
bit_band Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • cortex_m4
  • bit_band
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • cortex_m4
  • bit_band
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • cortex_m4
  • bit_band
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • cortex_m4
  • bit_band
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • cortex_m4
  • bit_band
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • cortex_m4
  • bit_band
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/cortex_m4/bit_band/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/cortex_m4/bit_band/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • cortex_m4
  • bit_band
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/cortex_m4/bit_band/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • cortex_m4
  • bit_band
  • src
Macros | Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Macros

#define | RAM_BASE 0x20000000
#define | RAM_BITBAND_BASE 0x22000000
#define | VARIABLES_RESET_BIT(variables_addr, bit_number)
#define | VARIABLES_SET_BIT(variables_addr, bit_number)
#define | VARIABLES_GET_BIT(variables_addr, bit_number)
#define | PERIPHERAL_BASE 0x40000000
#define | PERIPHERAL_BITBAND_BASE 0x42000000
#define | PERIPHERAL_RESET_BIT(peripheral_addr, bit_number)
#define | PERIPHERAL_SET_BIT(peripheral_addr, bit_number)

Functions

void | result_error (void)
led4 flick for error.
int | main (void)
main function.

Variables

__IO uint32_t | variables
__IO uint32_t | variables_addr = 0
__IO uint32_t | variables_bit_val = 0

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/cortex_m4/bit_band/src/main.c.


AT32F413 Firmwary Library: cmsis_dsp Directory Reference

  • cortex_m4
  • cmsis_dsp
cmsis_dsp Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • cortex_m4
  • cmsis_dsp
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • cortex_m4
  • cmsis_dsp
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • cortex_m4
  • cmsis_dsp
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • cortex_m4
  • cmsis_dsp
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • cortex_m4
  • cmsis_dsp
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • cortex_m4
  • cmsis_dsp
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • cortex_m4
  • cmsis_dsp
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • cortex_m4
  • cmsis_dsp
  • src
Macros | Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include "arm_math.h"

Go to the source code of this file.

Macros

#define | USE_STATIC_INIT
#define | TEST_LENGTH_SAMPLES (20*4)
#define | NUMSTUDENTS 20
#define | NUMSUBJECTS 4

Functions

int32_t main ()
main function.

Variables

const float32_t | testMarks_f32 [(20 *4)]
const float32_t | testUnity_f32 [4]
static float32_t | testOutput [(20 *4)]
uint32_t | numStudents = 20
uint32_t | numSubjects = 4
float32_t | max_marks
float32_t | min_marks
float32_t | mean
float32_t | std
float32_t | var
uint32_t | student_num

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c.


AT32F413 Firmwary Library: fpu Directory Reference

  • cortex_m4
  • fpu
fpu Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • cortex_m4
  • fpu
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.
julia_fpu.h
julia_fpu header file


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • cortex_m4
  • fpu
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • cortex_m4
  • fpu
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • cortex_m4
  • fpu
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_int.h.


AT32F413 Firmwary Library: julia_fpu.h File Reference

  • cortex_m4
  • fpu
  • inc
Macros | Functions
julia_fpu.h File Reference

julia_fpu header file More...

#include "at32f413.h"

Go to the source code of this file.

Macros

#define | ITERATION 200
#define | REAL_CONSTANT (0.285f)
#define | IMG_CONSTANT (0.01f)

Functions

void generate_julia_fpu (uint16_t size_x, uint16_t size_y, uint16_t offset_x, uint16_t offset_y, uint16_t zoom, uint8_t *buffer)
julia calculation test with fpu option enable or disable

Detailed Description

julia_fpu header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file julia_fpu.h.


AT32F413 Firmwary Library: src Directory Reference

  • cortex_m4
  • fpu
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
julia_fpu.c
julia_fpu source file
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • cortex_m4
  • fpu
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/cortex_m4/fpu/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/cortex_m4/fpu/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • cortex_m4
  • fpu
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/cortex_m4/fpu/src/at32f413_int.c.


AT32F413 Firmwary Library: julia_fpu.c File Reference

  • cortex_m4
  • fpu
  • src
Functions
julia_fpu.c File Reference

julia_fpu source file More...

#include "julia_fpu.h"

Go to the source code of this file.

Functions

void generate_julia_fpu (uint16_t size_x, uint16_t size_y, uint16_t offset_x, uint16_t offset_y, uint16_t zoom, uint8_t *buffer)
julia calculation test with fpu option enable or disable

Detailed Description

julia_fpu source file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file julia_fpu.c.


AT32F413 Firmwary Library: main.c File Reference

  • cortex_m4
  • fpu
  • src
Macros | Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include "julia_fpu.h"

Go to the source code of this file.

Macros

#define | SCREEN_X_SIZE ((uint16_t)160)
#define | SCREEN_Y_SIZE ((uint16_t)120)
#define | ZOOM ((uint16_t)100)

Functions

int main (void)
main function.

Variables

uint8_t buffer [((uint16_t) 160) *((uint16_t) 120)]

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/cortex_m4/fpu/src/main.c.


AT32F413 Firmwary Library: systick_interrupt Directory Reference

  • cortex_m4
  • systick_interrupt
systick_interrupt Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • cortex_m4
  • systick_interrupt
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • cortex_m4
  • systick_interrupt
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • cortex_m4
  • systick_interrupt
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • cortex_m4
  • systick_interrupt
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • cortex_m4
  • systick_interrupt
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • cortex_m4
  • systick_interrupt
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • cortex_m4
  • systick_interrupt
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | systick_handler (void)
systick interrupt handler.
void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • cortex_m4
  • systick_interrupt
  • src
Macros | Functions
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Macros

#define | MS_TICK (system_core_clock / 1000U)
#define | DELAY 200 /* 200 ms ticks */

Functions

void | systick_handler (void)
systick interrupt handler.
static uint32_t | systick_interrupt_config (uint32_t ticks)
config systick and enable interrupt.
int | main (void)
main function.

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/cortex_m4/systick_interrupt/src/main.c.


AT32F413 Firmwary Library: crc Directory Reference

  • crc
crc Directory Reference

Directories

calculation


AT32F413 Firmwary Library: calculation Directory Reference

  • crc
  • calculation
calculation Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • crc
  • calculation
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • crc
  • calculation
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/crc/calculation/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • crc
  • calculation
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • crc
  • calculation
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/crc/calculation/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • crc
  • calculation
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • crc
  • calculation
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/crc/calculation/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/crc/calculation/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • crc
  • calculation
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/crc/calculation/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • crc
  • calculation
  • src
Macros | Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Macros

#define BUFFER_SIZE 120

Functions

int main (void)
main function.

Variables

static const uint32_t | data_buffer [120]
__IO uint32_t | crc_value = 0

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/crc/calculation/src/main.c.


AT32F413 Firmwary Library: crm Directory Reference

  • crm
crm Directory Reference

Directories

clock_failure_detection
sysclk_switch


AT32F413 Firmwary Library: clock_failure_detection Directory Reference

  • crm
  • clock_failure_detection
clock_failure_detection Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • crm
  • clock_failure_detection
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • crm
  • clock_failure_detection
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • crm
  • clock_failure_detection
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • crm
  • clock_failure_detection
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • crm
  • clock_failure_detection
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • crm
  • clock_failure_detection
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • crm
  • clock_failure_detection
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | clock_failure_detection_handler (void)
clock failure detection handler.
void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • crm
  • clock_failure_detection
  • src
Functions
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

static void | clkout_config (void)
clkout configuration.
static void | sclk_192m_hick_config (void)
config sclk 192 mhz with hick clock source.
void | clock_failure_detection_handler (void)
clock failure detection handler.
int | main (void)
main function.

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/crm/clock_failure_detection/src/main.c.


AT32F413 Firmwary Library: sysclk_switch Directory Reference

  • crm
  • sysclk_switch
sysclk_switch Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • crm
  • sysclk_switch
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • crm
  • sysclk_switch
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • crm
  • sysclk_switch
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • crm
  • sysclk_switch
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • crm
  • sysclk_switch
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • crm
  • sysclk_switch
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/crm/sysclk_switch/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/crm/sysclk_switch/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • crm
  • sysclk_switch
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/crm/sysclk_switch/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • crm
  • sysclk_switch
  • src
Functions
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

static void | clkout_config (void)
clkout configuration.
static void | sclk_64m_hick_config (void)
config sclk 64 mhz with hick clock source.
static void | sclk_96m_hext_config (void)
config sclk 96 mhz with hext clock source.
static void | switch_system_clock (void)
sclk switch function.
int | main (void)
main function.

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/crm/sysclk_switch/src/main.c.


AT32F413 Firmwary Library: debug Directory Reference

  • debug
debug Directory Reference

Directories

tmr1


AT32F413 Firmwary Library: tmr1 Directory Reference

  • debug
  • tmr1
tmr1 Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • debug
  • tmr1
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • debug
  • tmr1
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/debug/tmr1/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • debug
  • tmr1
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • debug
  • tmr1
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/debug/tmr1/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • debug
  • tmr1
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • debug
  • tmr1
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/debug/tmr1/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/debug/tmr1/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • debug
  • tmr1
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/debug/tmr1/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • debug
  • tmr1
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void | TMR1_OVF_TMR10_IRQHandler (void)
this function handles tmr1 overflow handler.
int | main (void)
main function.

Variables

crm_clocks_freq_type | crm_clocks_freq_struct = {0}
uint16_t | counter = 0

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/debug/tmr1/src/main.c.


AT32F413 Firmwary Library: dma Directory Reference

  • dma
dma Directory Reference

Directories

data_to_gpio_flexible
flash_to_sram


AT32F413 Firmwary Library: data_to_gpio_flexible Directory Reference

  • dma
  • data_to_gpio_flexible
data_to_gpio_flexible Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • dma
  • data_to_gpio_flexible
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • dma
  • data_to_gpio_flexible
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • dma
  • data_to_gpio_flexible
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • dma
  • data_to_gpio_flexible
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • dma
  • data_to_gpio_flexible
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • dma
  • data_to_gpio_flexible
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/dma/data_to_gpio_flexible/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/dma/data_to_gpio_flexible/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • dma
  • data_to_gpio_flexible
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/dma/data_to_gpio_flexible/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • dma
  • data_to_gpio_flexible
  • src
Macros | Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Macros

#define BUFFER_SIZE 16

Functions

void | DMA2_Channel1_IRQHandler (void)
this function handles DMA2 channel1 handler.
int | main (void)
main function.

Variables

gpio_init_type | gpio_init_struct = {0}
dma_init_type | dma_init_struct = {0}
uint16_t | src_buffer [16]

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c.


AT32F413 Firmwary Library: flash_to_sram Directory Reference

  • dma
  • flash_to_sram
flash_to_sram Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • dma
  • flash_to_sram
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • dma
  • flash_to_sram
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • dma
  • flash_to_sram
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • dma
  • flash_to_sram
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • dma
  • flash_to_sram
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • dma
  • flash_to_sram
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/dma/flash_to_sram/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/dma/flash_to_sram/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • dma
  • flash_to_sram
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/dma/flash_to_sram/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • dma
  • flash_to_sram
  • src
Macros | Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Macros

#define BUFFER_SIZE 32

Functions

error_status | buffer_compare (const uint32_t *pbuffer, uint32_t *pbuffer1, uint16_t buffer_length)
compares two buffers.
void | DMA1_Channel1_IRQHandler (void)
this function handles dma1 channel1 handler.
int | main (void)
main function.

Variables

const uint32_t | src_const_buffer [32]
uint32_t | dst_buffer [32]
gpio_init_type | gpio_init_struct = {0}
dma_init_type | dma_init_struct = {0}
__IO uint32_t | data_counter_end = 0x01
error_status transfer_status = ERROR

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/dma/flash_to_sram/src/main.c.


AT32F413 Firmwary Library: exint Directory Reference

  • exint
exint Directory Reference

Directories

exint_config
exint_software_trigger


AT32F413 Firmwary Library: exint_config Directory Reference

  • exint
  • exint_config
exint_config Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • exint
  • exint_config
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • exint
  • exint_config
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/exint/exint_config/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • exint
  • exint_config
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • exint
  • exint_config
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/exint/exint_config/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • exint
  • exint_config
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • exint
  • exint_config
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/exint/exint_config/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/exint/exint_config/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • exint
  • exint_config
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/exint/exint_config/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • exint
  • exint_config
  • src
Functions
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void | exint_line0_config (void)
exint line0 config. configure pa0 in interrupt mode
int | main (void)
main function.
void | EXINT0_IRQHandler (void)
exint0 interrupt handler

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/exint/exint_config/src/main.c.


AT32F413 Firmwary Library: exint_software_trigger Directory Reference

  • exint
  • exint_software_trigger
exint_software_trigger Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • exint
  • exint_software_trigger
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • exint
  • exint_software_trigger
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • exint
  • exint_software_trigger
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • exint
  • exint_software_trigger
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • exint
  • exint_software_trigger
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • exint
  • exint_software_trigger
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/exint/exint_software_trigger/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/exint/exint_software_trigger/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • exint
  • exint_software_trigger
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/exint/exint_software_trigger/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • exint
  • exint_software_trigger
  • src
Functions
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void | exint_line4_config (void)
exint line4 config. configure pa0 in interrupt mode
static void | tmr1_config (void)
tmr1 configuration.
void | TMR1_OVF_TMR10_IRQHandler (void)
tmr1 interrupt handler
void | EXINT4_IRQHandler (void)
exint4 interrupt handler
int | main (void)
main function.

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/exint/exint_software_trigger/src/main.c.


AT32F413 Firmwary Library: flash Directory Reference

  • flash
flash Directory Reference

Directories

flash_write_read
operate_spim
run_in_spim


AT32F413 Firmwary Library: flash_write_read Directory Reference

  • flash
  • flash_write_read
flash_write_read Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • flash
  • flash_write_read
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.
flash.h
flash header file


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • flash
  • flash_write_read
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • flash
  • flash_write_read
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • flash
  • flash_write_read
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_int.h.


AT32F413 Firmwary Library: flash.h File Reference

  • flash
  • flash_write_read
  • inc
Functions
flash.h File Reference

flash header file More...

#include "at32f413_board.h"

Go to the source code of this file.

Functions

void | flash_read (uint32_t read_addr, uint16_t *p_buffer, uint16_t num_read)
read data using halfword mode
error_status | flash_write_nocheck (uint32_t write_addr, uint16_t *p_buffer, uint16_t num_write)
write data using halfword mode without checking
error_status | flash_write (uint32_t write_addr, uint16_t *p_Buffer, uint16_t num_write)
write data using halfword mode with checking

Detailed Description

flash header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/flash/flash_write_read/inc/flash.h.


AT32F413 Firmwary Library: src Directory Reference

  • flash
  • flash_write_read
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
flash.c
flash program
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • flash
  • flash_write_read
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/flash/flash_write_read/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/flash/flash_write_read/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • flash
  • flash_write_read
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/flash/flash_write_read/src/at32f413_int.c.


AT32F413 Firmwary Library: flash.c File Reference

  • flash
  • flash_write_read
  • src
Macros | Functions | Variables
flash.c File Reference

flash program More...

#include "at32f413_board.h"
#include "flash.h"

Go to the source code of this file.

Macros

#define SECTOR_SIZE 1024 /* this parameter depends on the specific model of the chip */

Functions

void | flash_read (uint32_t read_addr, uint16_t *p_buffer, uint16_t num_read)
read data using halfword mode
error_status | flash_write_nocheck (uint32_t write_addr, uint16_t *p_buffer, uint16_t num_write)
write data using halfword mode without checking
error_status | flash_write (uint32_t write_addr, uint16_t *p_buffer, uint16_t num_write)
write data using halfword mode with checking

Variables

uint16_t flash_buf [1024/2]

Detailed Description

flash program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/flash/flash_write_read/src/flash.c.


AT32F413 Firmwary Library: main.c File Reference

  • flash
  • flash_write_read
  • src
Macros | Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include "flash.h"

Go to the source code of this file.

Macros

#define | TEST_BUFEER_SIZE 3000
#define | TEST_FLASH_ADDRESS_START (0x08000000 + 1024 * 10)

Functions

error_status | buffer_compare (uint16_t *p_buffer1, uint16_t *p_buffer2, uint16_t buffer_length)
compares two buffers.
int | main (void)
main function.

Variables

uint16_t | buffer_write [3000]
uint16_t | buffer_read [3000]

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/flash/flash_write_read/src/main.c.


AT32F413 Firmwary Library: operate_spim Directory Reference

  • flash
  • operate_spim
operate_spim Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • flash
  • operate_spim
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.
operate_spim.h
operate_spim header file


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • flash
  • operate_spim
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/flash/operate_spim/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • flash
  • operate_spim
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • flash
  • operate_spim
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/flash/operate_spim/inc/at32f413_int.h.


AT32F413 Firmwary Library: operate_spim.h File Reference

  • flash
  • operate_spim
  • inc
Macros | Functions
operate_spim.h File Reference

operate_spim header file More...

Go to the source code of this file.

Macros

#define | SPIM_SECTOR_SIZE 4096
#define | SPIM_TEST_ADDR 0x08400000

Functions

void spim_operate (void)
operate spim flash

Detailed Description

operate_spim header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file operate_spim.h.


AT32F413 Firmwary Library: src Directory Reference

  • flash
  • operate_spim
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program
operate_spim.c
operate spim program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • flash
  • operate_spim
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/flash/operate_spim/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 120000000
  • ahbdiv = 1
  • ahbclk = 120000000
  • apb2div = 2
  • apb2clk = 60000000
  • apb1div = 2
  • apb1clk = 60000000
  • pll_mult = 30
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/flash/operate_spim/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • flash
  • operate_spim
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/flash/operate_spim/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • flash
  • operate_spim
  • src
Functions
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include "operate_spim.h"

Go to the source code of this file.

Functions

int main (void)
main function.

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/flash/operate_spim/src/main.c.


AT32F413 Firmwary Library: operate_spim.c File Reference

  • flash
  • operate_spim
  • src
Functions | Variables
operate_spim.c File Reference

operate spim program More...

#include "at32f413_board.h"
#include "operate_spim.h"
#include <string.h>

Go to the source code of this file.

Functions

void | spim_init (void)
init the spim flash
void | sector_read (uint32_t address, uint32_t sector_size, uint8_t *buf)
read one sector from a specified address in spim flash
void | spim_operate (void)
operate spim flash

Variables

uint8_t | write_buffer [4096]
uint8_t | read_buffer [4096]

Detailed Description

operate spim program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file operate_spim.c.


AT32F413 Firmwary Library: run_in_spim Directory Reference

  • flash
  • run_in_spim
run_in_spim Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • flash
  • run_in_spim
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.
run_in_spim.h
run_in_spim header file


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • flash
  • run_in_spim
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • flash
  • run_in_spim
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • flash
  • run_in_spim
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_int.h.


AT32F413 Firmwary Library: run_in_spim.h File Reference

  • flash
  • run_in_spim
  • inc
Functions
run_in_spim.h File Reference

run_in_spim header file More...

Go to the source code of this file.

Functions

void spim_run (void)
check the led toggle in spim

Detailed Description

run_in_spim header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file run_in_spim.h.


AT32F413 Firmwary Library: src Directory Reference

  • flash
  • run_in_spim
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program
run_in_spim.c
run in spim program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • flash
  • run_in_spim
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/flash/run_in_spim/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 120000000
  • ahbdiv = 1
  • ahbclk = 120000000
  • apb2div = 2
  • apb2clk = 60000000
  • apb1div = 2
  • apb1clk = 60000000
  • pll_mult = 30
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/flash/run_in_spim/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • flash
  • run_in_spim
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/flash/run_in_spim/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • flash
  • run_in_spim
  • src
Functions
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include "run_in_spim.h"

Go to the source code of this file.

Functions

void | spim_init (void)
init the spim flash
int | main (void)
main function.

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/flash/run_in_spim/src/main.c.


AT32F413 Firmwary Library: run_in_spim.c File Reference

  • flash
  • run_in_spim
  • src
Functions
run_in_spim.c File Reference

run in spim program More...

#include "at32f413_board.h"
#include "run_in_spim.h"

Go to the source code of this file.

Functions

void spim_run (void)
check the led toggle in spim

Detailed Description

run in spim program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file run_in_spim.c.


AT32F413 Firmwary Library: gpio Directory Reference

  • gpio
gpio Directory Reference

Directories

io_toggle
led_toggle
swjtag_remap


AT32F413 Firmwary Library: io_toggle Directory Reference

  • gpio
  • io_toggle
io_toggle Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • gpio
  • io_toggle
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • gpio
  • io_toggle
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • gpio
  • io_toggle
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • gpio
  • io_toggle
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • gpio
  • io_toggle
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • gpio
  • io_toggle
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/gpio/io_toggle/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/gpio/io_toggle/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • gpio
  • io_toggle
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/gpio/io_toggle/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • gpio
  • io_toggle
  • src
Functions
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void | gpio_config (void)
pa.01 gpio configuration.
int | main (void)
main function.

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/gpio/io_toggle/src/main.c.


AT32F413 Firmwary Library: led_toggle Directory Reference

  • gpio
  • led_toggle
led_toggle Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • gpio
  • led_toggle
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • gpio
  • led_toggle
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • gpio
  • led_toggle
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • gpio
  • led_toggle
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • gpio
  • led_toggle
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • gpio
  • led_toggle
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/gpio/led_toggle/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/gpio/led_toggle/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • gpio
  • led_toggle
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/gpio/led_toggle/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • gpio
  • led_toggle
  • src
Functions
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

int main (void)
main function.

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/gpio/led_toggle/src/main.c.


AT32F413 Firmwary Library: swjtag_remap Directory Reference

  • gpio
  • swjtag_remap
swjtag_remap Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • gpio
  • swjtag_remap
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • gpio
  • swjtag_remap
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • gpio
  • swjtag_remap
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • gpio
  • swjtag_remap
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • gpio
  • swjtag_remap
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • gpio
  • swjtag_remap
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/gpio/swjtag_remap/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/gpio/swjtag_remap/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • gpio
  • swjtag_remap
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/gpio/swjtag_remap/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • gpio
  • swjtag_remap
  • src
Functions
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void | swj_dp_config (void)
configure the gpio of swj-dp.
void | gpio_pins_toggle (gpio_type *gpio_x, uint16_t gpio_pin)
toggles the specified gpio pin
int | main (void)
main function.

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/gpio/swjtag_remap/src/main.c.


AT32F413 Firmwary Library: i2c Directory Reference

  • i2c
i2c Directory Reference

Directories

communication_dma
communication_int
communication_poll
eeprom
memory_write


AT32F413 Firmwary Library: communication_dma Directory Reference

  • i2c
  • communication_dma
communication_dma Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • i2c
  • communication_dma
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • i2c
  • communication_dma
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • i2c
  • communication_dma
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • i2c
  • communication_dma
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • i2c
  • communication_dma
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • i2c
  • communication_dma
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2c/communication_dma/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/i2c/communication_dma/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • i2c
  • communication_dma
  • src
Macros | Functions | Variables
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"
#include "i2c_application.h"

Go to the source code of this file.

Macros

#define | I2Cx_DMA_TX_IRQHandler DMA1_Channel6_IRQHandler
#define | I2Cx_DMA_RX_IRQHandler DMA1_Channel7_IRQHandler
#define | I2Cx_EVT_IRQHandler I2C1_EVT_IRQHandler
#define | I2Cx_ERR_IRQHandler I2C1_ERR_IRQHandler

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | DMA1_Channel7_IRQHandler (void)
this function handles dma interrupt request.
void | DMA1_Channel6_IRQHandler (void)
this function handles dma interrupt request.
void | I2C1_EVT_IRQHandler (void)
this function handles i2c event interrupt request.
void | I2C1_ERR_IRQHandler (void)
this function handles i2c error interrupt request.

Variables

i2c_handle_type hi2cx

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c.

Macro Definition Documentation

◆ I2Cx_DMA_RX_IRQHandler

#define I2Cx_DMA_RX_IRQHandler DMA1_Channel7_IRQHandler

Definition at line 33 of file project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c.

◆ I2Cx_DMA_TX_IRQHandler

#define I2Cx_DMA_TX_IRQHandler DMA1_Channel6_IRQHandler

Definition at line 32 of file project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c.

◆ I2Cx_ERR_IRQHandler

#define I2Cx_ERR_IRQHandler I2C1_ERR_IRQHandler

Definition at line 35 of file project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c.

◆ I2Cx_EVT_IRQHandler

#define I2Cx_EVT_IRQHandler I2C1_EVT_IRQHandler

Definition at line 34 of file project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • i2c
  • communication_dma
  • src
Macros | Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include "i2c_application.h"

Go to the source code of this file.

Macros

#define | I2C_TIMEOUT 0xFFFFFFFF
#define | I2Cx_SPEED 100000
#define | I2Cx_ADDRESS 0xA0
#define | I2Cx_PORT I2C1
#define | I2Cx_CLK CRM_I2C1_PERIPH_CLOCK
#define | I2Cx_SCL_PIN GPIO_PINS_6
#define | I2Cx_SCL_GPIO_PORT GPIOB
#define | I2Cx_SCL_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
#define | I2Cx_SDA_PIN GPIO_PINS_7
#define | I2Cx_SDA_GPIO_PORT GPIOB
#define | I2Cx_SDA_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
#define | I2Cx_DMA_CLK CRM_DMA1_PERIPH_CLOCK
#define | I2Cx_DMA_TX_CHANNEL DMA1_CHANNEL6
#define | I2Cx_DMA_TX_IRQn DMA1_Channel6_IRQn
#define | I2Cx_DMA_RX_CHANNEL DMA1_CHANNEL7
#define | I2Cx_DMA_RX_IRQn DMA1_Channel7_IRQn
#define | I2Cx_EVT_IRQn I2C1_EVT_IRQn
#define | I2Cx_ERR_IRQn I2C1_ERR_IRQn
#define | BUF_SIZE 8
#define | MASTER_BOARD

Functions

uint32_t | buffer_compare (uint8_t *buffer1, uint8_t *buffer2, uint32_t len)
compare whether the valus of buffer 1 and buffer 2 are equal.
void | i2c_lowlevel_init (i2c_handle_type *hi2c)
initializes peripherals used by the i2c.
void | error_handler (uint32_t error_code)
error handler program
int | main (void)
main function.

Variables

uint8_t | tx_buf [8] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}
uint8_t | rx_buf [8] = {0}
i2c_handle_type hi2cx

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2c/communication_dma/src/main.c.


AT32F413 Firmwary Library: communication_int Directory Reference

  • i2c
  • communication_int
communication_int Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • i2c
  • communication_int
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • i2c
  • communication_int
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2c/communication_int/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • i2c
  • communication_int
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • i2c
  • communication_int
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2c/communication_int/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • i2c
  • communication_int
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • i2c
  • communication_int
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2c/communication_int/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/i2c/communication_int/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • i2c
  • communication_int
  • src
Macros | Functions | Variables
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"
#include "i2c_application.h"

Go to the source code of this file.

Macros

#define | I2Cx_EVT_IRQHandler I2C1_EVT_IRQHandler
#define | I2Cx_ERR_IRQHandler I2C1_ERR_IRQHandler

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | I2C1_EVT_IRQHandler (void)
this function handles i2c event interrupt request.
void | I2C1_ERR_IRQHandler (void)
this function handles i2c error interrupt request.

Variables

i2c_handle_type hi2cx

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c.

Macro Definition Documentation

◆ I2Cx_ERR_IRQHandler

#define I2Cx_ERR_IRQHandler I2C1_ERR_IRQHandler

Definition at line 33 of file project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c.

◆ I2Cx_EVT_IRQHandler

#define I2Cx_EVT_IRQHandler I2C1_EVT_IRQHandler

Definition at line 32 of file project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • i2c
  • communication_int
  • src
Macros | Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include "i2c_application.h"

Go to the source code of this file.

Macros

#define | I2C_TIMEOUT 0xFFFFFFFF
#define | I2Cx_SPEED 100000
#define | I2Cx_ADDRESS 0xA0
#define | I2Cx_PORT I2C1
#define | I2Cx_CLK CRM_I2C1_PERIPH_CLOCK
#define | I2Cx_SCL_PIN GPIO_PINS_6
#define | I2Cx_SCL_GPIO_PORT GPIOB
#define | I2Cx_SCL_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
#define | I2Cx_SDA_PIN GPIO_PINS_7
#define | I2Cx_SDA_GPIO_PORT GPIOB
#define | I2Cx_SDA_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
#define | I2Cx_EVT_IRQn I2C1_EVT_IRQn
#define | I2Cx_ERR_IRQn I2C1_ERR_IRQn
#define | BUF_SIZE 8
#define | MASTER_BOARD

Functions

uint32_t | buffer_compare (uint8_t *buffer1, uint8_t *buffer2, uint32_t len)
compare whether the valus of buffer 1 and buffer 2 are equal.
void | error_handler (uint32_t error_code)
error handler program
void | i2c_lowlevel_init (i2c_handle_type *hi2c)
initializes peripherals used by the i2c.
int | main (void)
main function.

Variables

uint8_t | tx_buf [8] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}
uint8_t | rx_buf [8] = {0}
i2c_handle_type hi2cx

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2c/communication_int/src/main.c.


AT32F413 Firmwary Library: communication_poll Directory Reference

  • i2c
  • communication_poll
communication_poll Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • i2c
  • communication_poll
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • i2c
  • communication_poll
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • i2c
  • communication_poll
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • i2c
  • communication_poll
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • i2c
  • communication_poll
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • i2c
  • communication_poll
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2c/communication_poll/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/i2c/communication_poll/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • i2c
  • communication_poll
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2c/communication_poll/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • i2c
  • communication_poll
  • src
Macros | Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include "i2c_application.h"

Go to the source code of this file.

Macros

#define | I2C_TIMEOUT 0xFFFFFFFF
#define | I2Cx_SPEED 100000
#define | I2Cx_ADDRESS 0xA0
#define | I2Cx_PORT I2C1
#define | I2Cx_CLK CRM_I2C1_PERIPH_CLOCK
#define | I2Cx_SCL_PIN GPIO_PINS_6
#define | I2Cx_SCL_GPIO_PORT GPIOB
#define | I2Cx_SCL_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
#define | I2Cx_SDA_PIN GPIO_PINS_7
#define | I2Cx_SDA_GPIO_PORT GPIOB
#define | I2Cx_SDA_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
#define | BUF_SIZE 8
#define | MASTER_BOARD

Functions

void | error_handler (uint32_t error_code)
error handler program
uint32_t | buffer_compare (uint8_t *buffer1, uint8_t *buffer2, uint32_t len)
compare whether the valus of buffer 1 and buffer 2 are equal.
void | i2c_lowlevel_init (i2c_handle_type *hi2c)
initializes peripherals used by the i2c.
int | main (void)
main function.

Variables

uint8_t | tx_buf [8] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}
uint8_t | rx_buf [8] = {0}
i2c_handle_type hi2cx

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2c/communication_poll/src/main.c.


AT32F413 Firmwary Library: eeprom Directory Reference

  • i2c
  • eeprom
eeprom Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • i2c
  • eeprom
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.
eeprom.h
i2c eeprom libray header file


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • i2c
  • eeprom
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2c/eeprom/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • i2c
  • eeprom
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • i2c
  • eeprom
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2c/eeprom/inc/at32f413_int.h.


AT32F413 Firmwary Library: eeprom.h File Reference

  • i2c
  • eeprom
  • inc
Macros | Enumerations | Functions
eeprom.h File Reference

i2c eeprom libray header file More...

#include "i2c_application.h"

Go to the source code of this file.

Macros

#define | EEPROM_BUSY_TIMEOUT 1000
#define | EEPROM_PAGE_SIZE 8
#define | EEPROM_I2C_ADDRESS 0xA0

Enumerations

enum eeprom_mode_type { EE_MODE_POLL = 0x01 , EE_MODE_INT = 0x02 , EE_MODE_DMA = 0x03 }

Functions

i2c_status_type | eeprom_write_buffer (i2c_handle_type *hi2c, eeprom_mode_type mode, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
write data to the eeprom device.
i2c_status_type | eeprom_read_buffer (i2c_handle_type *hi2c, eeprom_mode_type mode, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
read data from eeprom.

Detailed Description

i2c eeprom libray header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file eeprom.h.

Macro Definition Documentation

◆ EEPROM_BUSY_TIMEOUT

#define EEPROM_BUSY_TIMEOUT 1000

eeprom busy waiting timeout

Definition at line 31 of file eeprom.h.

Referenced by eeprom_ready_wait().

◆ EEPROM_I2C_ADDRESS

#define EEPROM_I2C_ADDRESS 0xA0

eeprom i2c address

Definition at line 33 of file eeprom.h.

◆ EEPROM_PAGE_SIZE

#define EEPROM_PAGE_SIZE 8

eeprom page size

Definition at line 32 of file eeprom.h.

Referenced by eeprom_write_buffer().

Enumeration Type Documentation

◆ eeprom_mode_type

enum eeprom_mode_type
Enumerator
EE_MODE_POLL | polling communication
EE_MODE_INT | interrupt communication
EE_MODE_DMA | dma communication

Definition at line 35 of file eeprom.h.

Function Documentation

◆ eeprom_read_buffer()

i2c_status_type eeprom_read_buffer | ( | i2c_handle_type * | hi2c,
 |  | eeprom_mode_type | mode,
 |  | i2c_mem_address_width_type | mem_address_width,
 |  | uint16_t | address,
 |  | uint16_t | mem_address,
 |  | uint8_t * | pdata,
 |  | uint16_t | size,
 |  | uint32_t | timeout )

read data from eeprom.

Parameters
hi2c | the handle points to the operation information.
mode transfer mode. this parameter can be one of the following values:
  • EE_MODE_POLL: poll mode
  • EE_MODE_INT: interrupt mode
  • EE_MODE_DMA: dma mode
mem_address_width memory address width. this parameter can be one of the following values:
  • I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit
  • I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit
address | eeprom address.
mem_address | memory address.
pdata | data buffer.
size | data size.
timeout | maximum waiting time.
Return values
i2c status.

Definition at line 177 of file eeprom.c.

Referenced by main().

◆ eeprom_write_buffer()

i2c_status_type eeprom_write_buffer | ( | i2c_handle_type * | hi2c,
 |  | eeprom_mode_type | mode,
 |  | i2c_mem_address_width_type | mem_address_width,
 |  | uint16_t | address,
 |  | uint16_t | mem_address,
 |  | uint8_t * | pdata,
 |  | uint16_t | size,
 |  | uint32_t | timeout )

write data to the eeprom device.

Parameters
hi2c | the handle points to the operation information.
mode transfer mode. this parameter can be one of the following values:
  • EE_MODE_POLL: poll mode
  • EE_MODE_INT: interrupt mode
  • EE_MODE_DMA: dma mode
mem_address_width memory address width. this parameter can be one of the following values:
  • I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit
  • I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit
address | eeprom address.
mem_address | memory address.
pdata | data buffer.
size | data size.
timeout | maximum waiting time.
Return values
i2c status.

< eeprom page size

< eeprom page size

< eeprom page size

< eeprom page size

< eeprom page size

< eeprom page size

< eeprom page size

< eeprom page size

Definition at line 231 of file eeprom.c.

Referenced by main().


AT32F413 Firmwary Library: src Directory Reference

  • i2c
  • eeprom
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
eeprom.c
the driver library of the i2c eeprom
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • i2c
  • eeprom
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2c/eeprom/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/i2c/eeprom/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • i2c
  • eeprom
  • src
Macros | Functions | Variables
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"
#include "i2c_application.h"

Go to the source code of this file.

Macros

#define | I2Cx_DMA_TX_IRQHandler DMA1_Channel4_IRQHandler
#define | I2Cx_DMA_RX_IRQHandler DMA1_Channel5_IRQHandler
#define | I2Cx_EVT_IRQHandler I2C2_EVT_IRQHandler
#define | I2Cx_ERR_IRQHandler I2C2_ERR_IRQHandler

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | DMA1_Channel5_IRQHandler (void)
this function handles dma interrupt request.
void | DMA1_Channel4_IRQHandler (void)
this function handles dma interrupt request.
void | I2C2_EVT_IRQHandler (void)
this function handles i2c event interrupt request.
void | I2C2_ERR_IRQHandler (void)
this function handles i2c error interrupt request.

Variables

i2c_handle_type hi2cx

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c.

Macro Definition Documentation

◆ I2Cx_DMA_RX_IRQHandler

#define I2Cx_DMA_RX_IRQHandler DMA1_Channel5_IRQHandler

Definition at line 33 of file project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c.

◆ I2Cx_DMA_TX_IRQHandler

#define I2Cx_DMA_TX_IRQHandler DMA1_Channel4_IRQHandler

Definition at line 32 of file project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c.

◆ I2Cx_ERR_IRQHandler

#define I2Cx_ERR_IRQHandler I2C2_ERR_IRQHandler

Definition at line 35 of file project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c.

◆ I2Cx_EVT_IRQHandler

#define I2Cx_EVT_IRQHandler I2C2_EVT_IRQHandler

Definition at line 34 of file project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c.


AT32F413 Firmwary Library: eeprom.c File Reference

  • i2c
  • eeprom
  • src
Functions
eeprom.c File Reference

the driver library of the i2c eeprom More...

#include "eeprom.h"

Go to the source code of this file.

Functions

i2c_status_type | eeprom_ready_check (i2c_handle_type *hi2c, uint16_t address, uint32_t timeout)
check if the eeprom device is ready
i2c_status_type | eeprom_ready_wait (i2c_handle_type *hi2c, uint16_t address, uint32_t timeout)
wait for eeprom device to be ready
i2c_status_type | eeprom_write_page (i2c_handle_type *hi2c, eeprom_mode_type mode, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
write data to the eeprom page.
i2c_status_type | eeprom_read_buffer (i2c_handle_type *hi2c, eeprom_mode_type mode, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
read data from eeprom.
i2c_status_type | eeprom_write_buffer (i2c_handle_type *hi2c, eeprom_mode_type mode, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
write data to the eeprom device.

Detailed Description

the driver library of the i2c eeprom

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file eeprom.c.

Function Documentation

◆ eeprom_read_buffer()

i2c_status_type eeprom_read_buffer | ( | i2c_handle_type * | hi2c,
 |  | eeprom_mode_type | mode,
 |  | i2c_mem_address_width_type | mem_address_width,
 |  | uint16_t | address,
 |  | uint16_t | mem_address,
 |  | uint8_t * | pdata,
 |  | uint16_t | size,
 |  | uint32_t | timeout )

read data from eeprom.

Parameters
hi2c | the handle points to the operation information.
mode transfer mode. this parameter can be one of the following values:
  • EE_MODE_POLL: poll mode
  • EE_MODE_INT: interrupt mode
  • EE_MODE_DMA: dma mode
mem_address_width memory address width. this parameter can be one of the following values:
  • I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit
  • I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit
address | eeprom address.
mem_address | memory address.
pdata | data buffer.
size | data size.
timeout | maximum waiting time.
Return values
i2c status.

Definition at line 177 of file eeprom.c.

Referenced by main().

◆ eeprom_ready_check()

i2c_status_type eeprom_ready_check | ( | i2c_handle_type * | hi2c,
 |  | uint16_t | address,
 |  | uint32_t | timeout )

check if the eeprom device is ready

Parameters
hi2c | the handle points to the operation information.
address | eeprom address.
timeout | maximum waiting time.
Return values
i2c status.

Definition at line 34 of file eeprom.c.

Referenced by eeprom_ready_wait().

◆ eeprom_ready_wait()

i2c_status_type eeprom_ready_wait | ( | i2c_handle_type * | hi2c,
 |  | uint16_t | address,
 |  | uint32_t | timeout )

wait for eeprom device to be ready

Parameters
hi2c | the handle points to the operation information.
address | eeprom address.
timeout | maximum waiting time.
Return values
i2c status.

< eeprom busy waiting timeout

Definition at line 88 of file eeprom.c.

Referenced by eeprom_write_buffer().

◆ eeprom_write_buffer()

i2c_status_type eeprom_write_buffer | ( | i2c_handle_type * | hi2c,
 |  | eeprom_mode_type | mode,
 |  | i2c_mem_address_width_type | mem_address_width,
 |  | uint16_t | address,
 |  | uint16_t | mem_address,
 |  | uint8_t * | pdata,
 |  | uint16_t | size,
 |  | uint32_t | timeout )

write data to the eeprom device.

Parameters
hi2c | the handle points to the operation information.
mode transfer mode. this parameter can be one of the following values:
  • EE_MODE_POLL: poll mode
  • EE_MODE_INT: interrupt mode
  • EE_MODE_DMA: dma mode
mem_address_width memory address width. this parameter can be one of the following values:
  • I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit
  • I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit
address | eeprom address.
mem_address | memory address.
pdata | data buffer.
size | data size.
timeout | maximum waiting time.
Return values
i2c status.

< eeprom page size

< eeprom page size

< eeprom page size

< eeprom page size

< eeprom page size

< eeprom page size

< eeprom page size

< eeprom page size

Definition at line 231 of file eeprom.c.

Referenced by main().

◆ eeprom_write_page()

i2c_status_type eeprom_write_page | ( | i2c_handle_type * | hi2c,
 |  | eeprom_mode_type | mode,
 |  | i2c_mem_address_width_type | mem_address_width,
 |  | uint16_t | address,
 |  | uint16_t | mem_address,
 |  | uint8_t * | pdata,
 |  | uint16_t | size,
 |  | uint32_t | timeout )

write data to the eeprom page.

Parameters
hi2c | the handle points to the operation information.
mode transfer mode. this parameter can be one of the following values:
  • EE_MODE_POLL: poll mode
  • EE_MODE_INT: interrupt mode
  • EE_MODE_DMA: dma mode
mem_address_width memory address width. this parameter can be one of the following values:
  • I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit
  • I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit
address | eeprom address.
mem_address | memory address.
pdata | data buffer.
size | data size.
timeout | maximum waiting time.
Return values
i2c status.

Definition at line 123 of file eeprom.c.

Referenced by eeprom_write_buffer().


AT32F413 Firmwary Library: main.c File Reference

  • i2c
  • eeprom
  • src
Macros | Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include "eeprom.h"

Go to the source code of this file.

Macros

#define | I2C_TIMEOUT 0xFFFFFFFF
#define | I2Cx_SPEED 100000
#define | I2Cx_ADDRESS 0xA0
#define | I2Cx_PORT I2C2
#define | I2Cx_CLK CRM_I2C2_PERIPH_CLOCK
#define | I2Cx_SCL_PIN GPIO_PINS_10
#define | I2Cx_SCL_GPIO_PORT GPIOB
#define | I2Cx_SCL_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
#define | I2Cx_SDA_PIN GPIO_PINS_11
#define | I2Cx_SDA_GPIO_PORT GPIOB
#define | I2Cx_SDA_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
#define | I2Cx_DMA_CLK CRM_DMA1_PERIPH_CLOCK
#define | I2Cx_DMA_TX_CHANNEL DMA1_CHANNEL4
#define | I2Cx_DMA_TX_IRQn DMA1_Channel4_IRQn
#define | I2Cx_DMA_RX_CHANNEL DMA1_CHANNEL5
#define | I2Cx_DMA_RX_IRQn DMA1_Channel5_IRQn
#define | I2Cx_EVT_IRQn I2C2_EVT_IRQn
#define | I2Cx_ERR_IRQn I2C2_ERR_IRQn
#define | BUF_SIZE 12

Functions

void | error_handler (uint32_t error_code)
error handler program
uint32_t | buffer_compare (uint8_t *buffer1, uint8_t *buffer2, uint32_t len)
compare whether the valus of buffer 1 and buffer 2 are equal.
void | i2c_lowlevel_init (i2c_handle_type *hi2c)
initializes peripherals used by the i2c.
int | main (void)
main function.

Variables

uint8_t | tx_buf1 [12] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C}
uint8_t | tx_buf2 [12] = {0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80, 0x90, 0xA0, 0xB0, 0xC0}
uint8_t | tx_buf3 [12] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC}
uint8_t | rx_buf1 [12] = {0}
uint8_t | rx_buf2 [12] = {0}
uint8_t | rx_buf3 [12] = {0}
i2c_handle_type hi2cx

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2c/eeprom/src/main.c.


AT32F413 Firmwary Library: memory_write Directory Reference

  • i2c
  • memory_write
memory_write Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • i2c
  • memory_write
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • i2c
  • memory_write
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2c/memory_write/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • i2c
  • memory_write
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • i2c
  • memory_write
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2c/memory_write/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • i2c
  • memory_write
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • i2c
  • memory_write
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2c/memory_write/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/i2c/memory_write/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • i2c
  • memory_write
  • src
Macros | Functions | Variables
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"
#include "i2c_application.h"

Go to the source code of this file.

Macros

#define | I2Cx_DMA_TX_IRQHandler DMA1_Channel4_IRQHandler
#define | I2Cx_DMA_RX_IRQHandler DMA1_Channel5_IRQHandler
#define | I2Cx_EVT_IRQHandler I2C2_EVT_IRQHandler
#define | I2Cx_ERR_IRQHandler I2C2_ERR_IRQHandler

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | DMA1_Channel5_IRQHandler (void)
this function handles dma interrupt request.
void | DMA1_Channel4_IRQHandler (void)
this function handles dma interrupt request.
void | I2C2_EVT_IRQHandler (void)
this function handles i2c event interrupt request.
void | I2C2_ERR_IRQHandler (void)
this function handles i2c error interrupt request.

Variables

i2c_handle_type hi2cx

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c.

Macro Definition Documentation

◆ I2Cx_DMA_RX_IRQHandler

#define I2Cx_DMA_RX_IRQHandler DMA1_Channel5_IRQHandler

Definition at line 33 of file project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c.

◆ I2Cx_DMA_TX_IRQHandler

#define I2Cx_DMA_TX_IRQHandler DMA1_Channel4_IRQHandler

Definition at line 32 of file project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c.

◆ I2Cx_ERR_IRQHandler

#define I2Cx_ERR_IRQHandler I2C2_ERR_IRQHandler

Definition at line 35 of file project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c.

◆ I2Cx_EVT_IRQHandler

#define I2Cx_EVT_IRQHandler I2C2_EVT_IRQHandler

Definition at line 34 of file project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • i2c
  • memory_write
  • src
Macros | Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include "i2c_application.h"

Go to the source code of this file.

Macros

#define | I2C_TIMEOUT 0xFFFFFFFF
#define | I2Cx_SPEED 100000
#define | I2Cx_ADDRESS 0xA0
#define | I2Cx_PORT I2C2
#define | I2Cx_CLK CRM_I2C2_PERIPH_CLOCK
#define | I2Cx_SCL_PIN GPIO_PINS_10
#define | I2Cx_SCL_GPIO_PORT GPIOB
#define | I2Cx_SCL_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
#define | I2Cx_SDA_PIN GPIO_PINS_11
#define | I2Cx_SDA_GPIO_PORT GPIOB
#define | I2Cx_SDA_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
#define | I2Cx_DMA_CLK CRM_DMA1_PERIPH_CLOCK
#define | I2Cx_DMA_TX_CHANNEL DMA1_CHANNEL4
#define | I2Cx_DMA_TX_IRQn DMA1_Channel4_IRQn
#define | I2Cx_DMA_RX_CHANNEL DMA1_CHANNEL5
#define | I2Cx_DMA_RX_IRQn DMA1_Channel5_IRQn
#define | I2Cx_EVT_IRQn I2C2_EVT_IRQn
#define | I2Cx_ERR_IRQn I2C2_ERR_IRQn
#define | BUF_SIZE 8

Functions

void | error_handler (uint32_t error_code)
error handler program
uint32_t | buffer_compare (uint8_t *buffer1, uint8_t *buffer2, uint32_t len)
compare whether the valus of buffer 1 and buffer 2 are equal.
void | i2c_lowlevel_init (i2c_handle_type *hi2c)
initializes peripherals used by the i2c.
int | main (void)
main function.

Variables

uint8_t | tx_buf1 [8] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}
uint8_t | tx_buf2 [8] = {0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80}
uint8_t | tx_buf3 [8] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88}
uint8_t | rx_buf1 [8] = {0}
uint8_t | rx_buf2 [8] = {0}
uint8_t | rx_buf3 [8] = {0}
i2c_handle_type hi2cx

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2c/memory_write/src/main.c.


AT32F413 Firmwary Library: i2s Directory Reference

  • i2s
i2s Directory Reference

Directories

halfduplex_dma
halfduplex_interrupt
spii2s_switch_halfduplex_polling


AT32F413 Firmwary Library: halfduplex_dma Directory Reference

  • i2s
  • halfduplex_dma
halfduplex_dma Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • i2s
  • halfduplex_dma
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • i2s
  • halfduplex_dma
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • i2s
  • halfduplex_dma
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • i2s
  • halfduplex_dma
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • i2s
  • halfduplex_dma
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • i2s
  • halfduplex_dma
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2s/halfduplex_dma/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/i2s/halfduplex_dma/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • i2s
  • halfduplex_dma
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"
#include "at32f413_board.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2s/halfduplex_dma/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • i2s
  • halfduplex_dma
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include <stdio.h>

Go to the source code of this file.

Functions

error_status | buffer_compare (uint16_t *pbuffer1, uint16_t *pbuffer2, uint16_t buffer_length)
buffer_compare function.
static void | dma_config (void)
dma configuration.
static void | i2s_config (void)
i2s configuration.
static void | gpio_config (void)
gpio configuration.
int | main (void)
main function.

Variables

uint16_t | i2s1_buffer_tx [32]
uint16_t | i2s2_buffer_rx [32]
volatile error_status | transfer_status = ERROR

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2s/halfduplex_dma/src/main.c.


AT32F413 Firmwary Library: halfduplex_interrupt Directory Reference

  • i2s
  • halfduplex_interrupt
halfduplex_interrupt Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • i2s
  • halfduplex_interrupt
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • i2s
  • halfduplex_interrupt
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • i2s
  • halfduplex_interrupt
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • i2s
  • halfduplex_interrupt
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • i2s
  • halfduplex_interrupt
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • i2s
  • halfduplex_interrupt
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2s/halfduplex_interrupt/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/i2s/halfduplex_interrupt/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • i2s
  • halfduplex_interrupt
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2s/halfduplex_interrupt/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • i2s
  • halfduplex_interrupt
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include <stdio.h>

Go to the source code of this file.

Functions

error_status | buffer_compare (uint16_t *pbuffer1, uint16_t *pbuffer2, uint16_t buffer_length)
buffer_compare function.
error_status | buffer_compare_24bits (uint16_t *pbuffer1, uint16_t *pbuffer2, uint16_t buffer_length)
buffer_compare_24bits function.
static void | i2s_config (i2s_data_channel_format_type format, i2s_audio_sampling_freq_type freq)
i2s configuration.
static void | gpio_config (void)
gpio configuration.
void | SPI2_IRQHandler (void)
spi2 interrupt function
void | SPI1_IRQHandler (void)
spi1 interrupt function
int | main (void)
main function.

Variables

uint16_t | i2s1_buffer_tx [32]
uint16_t | i2s2_buffer_rx [32]
__IO uint32_t | tx_index = 0
__IO uint32_t | rx_index = 0
volatile error_status | transfer_status1 = ERROR
volatile error_status | transfer_status2 = ERROR

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c.


AT32F413 Firmwary Library: spii2s_switch_halfduplex_polling Directory Reference

  • i2s
  • spii2s_switch_halfduplex_polling
spii2s_switch_halfduplex_polling Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • i2s
  • spii2s_switch_halfduplex_polling
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • i2s
  • spii2s_switch_halfduplex_polling
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • i2s
  • spii2s_switch_halfduplex_polling
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • i2s
  • spii2s_switch_halfduplex_polling
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • i2s
  • spii2s_switch_halfduplex_polling
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • i2s
  • spii2s_switch_halfduplex_polling
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • i2s
  • spii2s_switch_halfduplex_polling
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"
#include "at32f413_board.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • i2s
  • spii2s_switch_halfduplex_polling
  • src
Macros | Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include <stdio.h>

Go to the source code of this file.

Macros

#define | SPI_MASTER_CS_HIGH gpio_bits_set(GPIOA, GPIO_PINS_15)
#define | SPI_MASTER_CS_LOW gpio_bits_reset(GPIOA, GPIO_PINS_15)

Functions

error_status | buffer_compare (uint16_t *pbuffer1, uint16_t *pbuffer2, uint16_t buffer_length)
buffer_compare function.
static void | i2s_config (i2s_operation_mode_type i2s1_mode, i2s_operation_mode_type i2s2_mode)
i2s configuration.
static void | spi_config (void)
spi configuration.
static void | gpio_config (uint16_t spi_i2s_mode)
gpio configuration.
int | main (void)
main function.

Variables

uint16_t | i2s1_buffer_tx [32]
uint16_t | spi1_buffer_tx [32]
uint16_t | i2s2_buffer_rx [32]
uint16_t | spi2_buffer_rx [32]
__IO uint32_t | tx_index = 0
__IO uint32_t | rx_index = 0
volatile error_status | transfer_status1 = ERROR
volatile error_status | transfer_status2 = ERROR
volatile error_status | transfer_status3 = ERROR

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c.


AT32F413 Firmwary Library: pwc Directory Reference

  • pwc
pwc Directory Reference

Directories

deepsleep_rtc
power_voltage_monitor
sleep_tmr2
sleep_usart1
standby_rtc
standby_wakeup_pin


AT32F413 Firmwary Library: deepsleep_rtc Directory Reference

  • pwc
  • deepsleep_rtc
deepsleep_rtc Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • pwc
  • deepsleep_rtc
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • pwc
  • deepsleep_rtc
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • pwc
  • deepsleep_rtc
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • pwc
  • deepsleep_rtc
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • pwc
  • deepsleep_rtc
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • pwc
  • deepsleep_rtc
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • pwc
  • deepsleep_rtc
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"
#include "at32f413_board.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | RTCAlarm_IRQHandler (void)
this function handles the rtc alarm through exint line interrupt request.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • pwc
  • deepsleep_rtc
  • src
Functions
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include <stdio.h>

Go to the source code of this file.

Functions

void | rtc_config (void)
rtc configuration.
void | system_clock_recover (void)
systemclock recover.
int | main (void)
main function.

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/pwc/deepsleep_rtc/src/main.c.


AT32F413 Firmwary Library: power_voltage_monitor Directory Reference

  • pwc
  • power_voltage_monitor
power_voltage_monitor Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • pwc
  • power_voltage_monitor
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • pwc
  • power_voltage_monitor
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • pwc
  • power_voltage_monitor
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • pwc
  • power_voltage_monitor
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • pwc
  • power_voltage_monitor
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • pwc
  • power_voltage_monitor
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • pwc
  • power_voltage_monitor
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"
#include "at32f413_board.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | PVM_IRQHandler (void)
this function handles the power voltage monitoring output interrupt request.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • pwc
  • power_voltage_monitor
  • src
Functions
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void | pvm_exint_config (void)
power voltage monitor exint configuration.
int | main (void)
main function.

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/pwc/power_voltage_monitor/src/main.c.


AT32F413 Firmwary Library: sleep_tmr2 Directory Reference

  • pwc
  • sleep_tmr2
sleep_tmr2 Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • pwc
  • sleep_tmr2
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • pwc
  • sleep_tmr2
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • pwc
  • sleep_tmr2
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • pwc
  • sleep_tmr2
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • pwc
  • sleep_tmr2
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • pwc
  • sleep_tmr2
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • pwc
  • sleep_tmr2
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"
#include "at32f413_board.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | TMR2_GLOBAL_IRQHandler (void)
this function handles the timer interrupt request.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • pwc
  • sleep_tmr2
  • src
Functions
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void | tmr2_config (void)
tmr2 configuration.
int | main (void)
main function.

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/pwc/sleep_tmr2/src/main.c.


AT32F413 Firmwary Library: sleep_usart1 Directory Reference

  • pwc
  • sleep_usart1
sleep_usart1 Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • pwc
  • sleep_usart1
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • pwc
  • sleep_usart1
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • pwc
  • sleep_usart1
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • pwc
  • sleep_usart1
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • pwc
  • sleep_usart1
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • pwc
  • sleep_usart1
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • pwc
  • sleep_usart1
  • src
Functions | Variables
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"
#include "at32f413_board.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | USART1_IRQHandler (void)
this function handles the usatt interrupt request.

Variables

uint16_t usart1_index = 0

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • pwc
  • sleep_usart1
  • src
Functions
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void | usart1_config (uint32_t baudrate)
usart1 configuration.
int | main (void)
main function.

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/pwc/sleep_usart1/src/main.c.


AT32F413 Firmwary Library: standby_rtc Directory Reference

  • pwc
  • standby_rtc
standby_rtc Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • pwc
  • standby_rtc
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • pwc
  • standby_rtc
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • pwc
  • standby_rtc
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • pwc
  • standby_rtc
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • pwc
  • standby_rtc
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • pwc
  • standby_rtc
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/pwc/standby_rtc/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/pwc/standby_rtc/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • pwc
  • standby_rtc
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"
#include "at32f413_board.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/pwc/standby_rtc/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • pwc
  • standby_rtc
  • src
Functions
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include <stdio.h>

Go to the source code of this file.

Functions

void | rtc_config (void)
rtc configuration.
void | rtc_alarm_config (uint8_t alarm_time)
rtc alarm set.
int | main (void)
main function.

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/pwc/standby_rtc/src/main.c.


AT32F413 Firmwary Library: standby_wakeup_pin Directory Reference

  • pwc
  • standby_wakeup_pin
standby_wakeup_pin Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • pwc
  • standby_wakeup_pin
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • pwc
  • standby_wakeup_pin
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • pwc
  • standby_wakeup_pin
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • pwc
  • standby_wakeup_pin
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • pwc
  • standby_wakeup_pin
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • pwc
  • standby_wakeup_pin
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/pwc/standby_wakeup_pin/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/pwc/standby_wakeup_pin/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • pwc
  • standby_wakeup_pin
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"
#include "at32f413_board.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/pwc/standby_wakeup_pin/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • pwc
  • standby_wakeup_pin
  • src
Functions
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include <stdio.h>

Go to the source code of this file.

Functions

int main (void)
main function.

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/pwc/standby_wakeup_pin/src/main.c.


AT32F413 Firmwary Library: rtc Directory Reference

  • rtc
rtc Directory Reference

Directories

calendar
lick_calibration


AT32F413 Firmwary Library: calendar Directory Reference

  • rtc
  • calendar
calendar Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • rtc
  • calendar
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.
rtc.h
this file provides template for calendar api.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • rtc
  • calendar
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/rtc/calendar/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • rtc
  • calendar
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • rtc
  • calendar
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/rtc/calendar/inc/at32f413_int.h.


AT32F413 Firmwary Library: rtc.h File Reference

  • rtc
  • calendar
  • inc
Data Structures | Functions | Variables
rtc.h File Reference

this file provides template for calendar api. More...

#include "at32f413.h"

Go to the source code of this file.

Data Structures

struct calendar_type

Functions

uint8_t | rtc_init (calendar_type *calendar)
rtc peripheral initialization.
uint8_t | rtc_time_set (calendar_type *calendar)
set time. convert the input clock to a second. the time basic : 1970.1.1 legitimate year: 1970 ~ 2099
uint8_t | rtc_alarm_clock_set (calendar_type *calendar)
set rtc alarm clock. the time basic : 1970.1.1 legitimate year: 1970 ~ 2099
void | rtc_time_get (void)
get current time.

Variables

calendar_type calendar

Detailed Description

this file provides template for calendar api.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file rtc.h.


AT32F413 Firmwary Library: src Directory Reference

  • rtc
  • calendar
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program
rtc.c
this file provides template for calendar api.


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • rtc
  • calendar
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/rtc/calendar/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/rtc/calendar/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • rtc
  • calendar
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"
#include "at32f413_board.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | RTC_IRQHandler (void)
this function handles rtc handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/rtc/calendar/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • rtc
  • calendar
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include "rtc.h"

Go to the source code of this file.

Functions

void | alarm_init (void)
init alarm.
int | main (void)
main function.

Variables

char const weekday_table [7][10] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/rtc/calendar/src/main.c.


AT32F413 Firmwary Library: rtc.c File Reference

  • rtc
  • calendar
  • src
Functions | Variables
rtc.c File Reference

this file provides template for calendar api. More...

#include "rtc.h"

Go to the source code of this file.

Functions

uint8_t | rtc_init (calendar_type *calendar)
rtc peripheral initialization.
uint8_t | is_leap_year (uint16_t year)
judeg the leap year or common year.
uint8_t | rtc_time_set (calendar_type *calendar)
set time. convert the input clock to a second. the time basic : 1970.1.1 legitimate year: 1970 ~ 2099
uint8_t | rtc_alarm_clock_set (calendar_type *calendar)
set rtc alarm clock. the time basic : 1970.1.1 legitimate year: 1970 ~ 2099
uint8_t | rtc_week_get (uint16_t year, uint8_t month, uint8_t day)
get current week by input leap year\mouth\day.
void | rtc_time_get (void)
get current time.

Variables

calendar_type calendar
const uint8_t | table_week [12] = {0, 3, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5}
const uint8_t | mon_table [12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}

Detailed Description

this file provides template for calendar api.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file rtc.c.


AT32F413 Firmwary Library: lick_calibration Directory Reference

  • rtc
  • lick_calibration
lick_calibration Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • rtc
  • lick_calibration
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • rtc
  • lick_calibration
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • rtc
  • lick_calibration
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • rtc
  • lick_calibration
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • rtc
  • lick_calibration
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • rtc
  • lick_calibration
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • rtc
  • lick_calibration
  • src
Functions | Variables
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"
#include "at32f413_board.h"
#include "stdio.h"

Go to the source code of this file.

Functions

uint32_t | incrementvar_operationcomplete (void)
increments operationcomplete variable and return its value before increment operation.
uint32_t | getvar_operationcomplete (void)
returns operationcomplete value.
void | setvar_periodvalue (uint32_t Value)
sets the periodvalue variable with input parameter.
void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | RTC_IRQHandler (void)
this function handles rtc global interrupt request.
void | TMR5_GLOBAL_IRQHandler (void)
this function handles tmr5 global interrupt request.

Variables

__IO uint32_t | periodvalue
__IO uint32_t | operationcomplete
uint16_t | tmpCC4 [2] = {0, 0}

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • rtc
  • lick_calibration
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void | nvic_configuration (void)
configures the nested vectored interrupt controller.
void | rtc_configuration (void)
configures the rtc.
uint32_t | incrementvar_operationcomplete (void)
increments operationcomplete variable and return its value before increment operation.
uint32_t | getvar_operationcomplete (void)
returns operationcomplete value.
void | setvar_periodvalue (uint32_t value)
sets the periodvalue variable with input parameter.
int | main (void)
main function.

Variables

crm_clocks_freq_type crm_clocks
__IO uint32_t | periodvalue = 0
__IO uint32_t | lickfreq = 0
__IO uint32_t | operationcomplete = 0

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/rtc/lick_calibration/src/main.c.


AT32F413 Firmwary Library: sdio Directory Reference

  • sdio
sdio Directory Reference

Directories

emmc_card
sd_mmc_card
sdio_fatfs


AT32F413 Firmwary Library: emmc_card Directory Reference

  • sdio
  • emmc_card
emmc_card Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • sdio
  • emmc_card
  • inc
inc Directory Reference

Files

at32_sdio.h
this file contains all the functions prototypes for the sd/mmc card at32_sdio driver firmware library.
at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32_sdio.h File Reference

  • sdio
  • emmc_card
  • inc
Data Structures | Macros | Enumerations | Functions | Variables
at32_sdio.h File Reference

this file contains all the functions prototypes for the sd/mmc card at32_sdio driver firmware library. More...

#include "at32f413.h"

Go to the source code of this file.

Data Structures

struct | sd_csd_struct_type
struct | sd_cid_struct_type
struct | sd_scr_struct_type
struct | sd_card_info_struct_type

Macros

#define | SDIOx SDIO1
#define | SD_CMD_GO_IDLE_STATE ((uint8_t)0)
#define | SD_CMD_SEND_OP_COND ((uint8_t)1)
#define | SD_CMD_ALL_SEND_CID ((uint8_t)2)
#define | SD_CMD_SET_REL_ADDR ((uint8_t)3)
#define | SD_CMD_SET_DSR ((uint8_t)4)
#define | SD_CMD_SDIO_SEN_OP_COND ((uint8_t)5)
#define | SD_CMD_HS_SWITCH ((uint8_t)6)
#define | SD_CMD_SEL_DESEL_CARD ((uint8_t)7)
#define | SD_CMD_HS_SEND_EXT_CSD ((uint8_t)8)
#define | SD_CMD_SEND_CSD ((uint8_t)9)
#define | SD_CMD_SEND_CID ((uint8_t)10)
#define | SD_CMD_READ_DAT_UNTIL_STOP ((uint8_t)11)
#define | SD_CMD_STOP_TRANSMISSION ((uint8_t)12)
#define | SD_CMD_SEND_STATUS ((uint8_t)13)
#define | SD_CMD_HS_BUSTEST_READ ((uint8_t)14)
#define | SD_CMD_GO_INACTIVE_STATE ((uint8_t)15)
#define | SD_CMD_SET_BLOCKLEN ((uint8_t)16)
#define | SD_CMD_READ_SINGLE_BLOCK ((uint8_t)17)
#define | SD_CMD_READ_MULT_BLOCK ((uint8_t)18)
#define | SD_CMD_HS_BUSTEST_WRITE ((uint8_t)19)
#define | SD_CMD_WRITE_DAT_UNTIL_STOP ((uint8_t)20)
#define | SD_CMD_SET_BLOCK_COUNT ((uint8_t)23)
#define | SD_CMD_WRITE_SINGLE_BLOCK ((uint8_t)24)
#define | SD_CMD_WRITE_MULT_BLOCK ((uint8_t)25)
#define | SD_CMD_PROG_CID ((uint8_t)26)
#define | SD_CMD_PROG_CSD ((uint8_t)27)
#define | SD_CMD_SET_WRITE_PROT ((uint8_t)28)
#define | SD_CMD_CLR_WRITE_PROT ((uint8_t)29)
#define | SD_CMD_SEND_WRITE_PROT ((uint8_t)30)
#define | SD_CMD_SD_ERASE_GRP_START ((uint8_t)32)
#define | SD_CMD_SD_ERASE_GRP_END ((uint8_t)33)
#define | SD_CMD_ERASE_GRP_START ((uint8_t)35)
#define | SD_CMD_ERASE_GRP_END ((uint8_t)36)
#define | SD_CMD_ERASE ((uint8_t)38)
#define | SD_CMD_FAST_IO ((uint8_t)39)
#define | SD_CMD_GO_IRQ_STATE ((uint8_t)40)
#define | SD_CMD_LOCK_UNLOCK ((uint8_t)42)
#define | SD_CMD_APP_CMD ((uint8_t)55)
#define | SD_CMD_GEN_CMD ((uint8_t)56)
#define | SD_CMD_NO_CMD ((uint8_t)64)
#define | SD_CMD_APP_SD_SET_BUSWIDTH ((uint8_t)6)
#define | SD_CMD_SD_APP_STAUS ((uint8_t)13)
#define | SD_CMD_SD_APP_SEND_NUM_WRITE_BLOCKS ((uint8_t)22)
#define | SD_CMD_SD_APP_OP_COND ((uint8_t)41)
#define | SD_CMD_SD_APP_SET_CLR_CARD_DETECT ((uint8_t)42)
#define | SD_CMD_SD_APP_SEND_SCR ((uint8_t)51)
#define | SD_CMD_SDIO_RW_DIRECT ((uint8_t)52)
#define | SD_CMD_SDIO_RW_EXTENDED ((uint8_t)53)
#define | SD_CMD_SD_APP_GET_MKB ((uint8_t)43)
#define | SD_CMD_SD_APP_GET_MID ((uint8_t)44)
#define | SD_CMD_SD_APP_SET_CER_RN1 ((uint8_t)45)
#define | SD_CMD_SD_APP_GET_CER_RN2 ((uint8_t)46)
#define | SD_CMD_SD_APP_SET_CER_RES2 ((uint8_t)47)
#define | SD_CMD_SD_APP_GET_CER_RES1 ((uint8_t)48)
#define | SD_CMD_SD_APP_SECURE_READ_MULTIPLE_BLOCK ((uint8_t)18)
#define | SD_CMD_SD_APP_SECURE_WRITE_MULTIPLE_BLOCK ((uint8_t)25)
#define | SD_CMD_SD_APP_SECURE_ERASE ((uint8_t)38)
#define | SD_CMD_SD_APP_CHANGE_SECURE_AREA ((uint8_t)49)
#define | SD_CMD_SD_APP_SECURE_WRITE_MKB ((uint8_t)48)
#define | NULL 0
#define | SDIO_STATIC_FLAGS ((uint32_t)0x000005FF)
#define | SDIO_CMD0TIMEOUT ((uint32_t)0x00010000)
#define | SDIO_DATATIMEOUT ((uint32_t)0xFFFFFFFF)
#define | SD_OCR_ADDR_OUT_OF_RANGE ((uint32_t)0x80000000)
#define | SD_OCR_ADDR_MISALIGNED ((uint32_t)0x40000000)
#define | SD_OCR_BLK_LEN_ERR ((uint32_t)0x20000000)
#define | SD_OCR_ERASE_SEQ_ERR ((uint32_t)0x10000000)
#define | SD_OCR_INVALID_ERASE_PARAM ((uint32_t)0x08000000)
#define | SD_OCR_WR_PROTECT_VIOLATION ((uint32_t)0x04000000)
#define | SD_OCR_LOCK_UNLOCK_ERROR ((uint32_t)0x01000000)
#define | SD_OCR_CMD_CRC_ERROR ((uint32_t)0x00800000)
#define | SD_OCR_ILLEGAL_CMD ((uint32_t)0x00400000)
#define | SD_OCR_CARD_ECC_ERROR ((uint32_t)0x00200000)
#define | SD_OCR_CARD_CONTROLLER_ERR ((uint32_t)0x00100000)
#define | SD_OCR_GENERAL_UNKNOWN_ERROR ((uint32_t)0x00080000)
#define | SD_OCR_STREAM_RD_UNDERRUN ((uint32_t)0x00040000)
#define | SD_OCR_STREAM_WR_OVERRUN ((uint32_t)0x00020000)
#define | SD_OCR_CID_CSD_OVERWRIETE ((uint32_t)0x00010000)
#define | SD_OCR_WP_ERASE_SKIP ((uint32_t)0x00008000)
#define | SD_OCR_CARD_ECC_DISABLED ((uint32_t)0x00004000)
#define | SD_OCR_ERASE_RESET ((uint32_t)0x00002000)
#define | MMC_SWITCH_ERROR ((uint32_t)0x00000080)
#define | SD_OCR_AKE_SEQ_ERROR ((uint32_t)0x00000008)
#define | SD_OCR_ERRORBITS ((uint32_t)0xFDFFE008)
#define | SD_R5_OUT_OF_RANGE ((uint32_t)0x00000100)
#define | SD_R5_FUNCTION_NUMBER ((uint32_t)0x00000200)
#define | SD_R5_ERROR ((uint32_t)0x00000800)
#define | SD_R6_GENERAL_UNKNOWN_ERROR ((uint32_t)0x00002000)
#define | SD_R6_ILLEGAL_CMD ((uint32_t)0x00004000)
#define | SD_R6_CMD_CRC_ERROR ((uint32_t)0x00008000)
#define | SD_VOLTAGE_WINDOW_SD ((uint32_t)0x80100000)
#define | SD_HIGH_CAPACITY ((uint32_t)0x40000000)
#define | SD_STD_CAPACITY ((uint32_t)0x00000000)
#define | SD_CHECK_PATTERN ((uint32_t)0x000001AA)
#define | SD_VOLTAGE_WINDOW_MMC ((uint32_t)0x40FF8000)
#define | SD_MAX_VOLT_TRIAL ((uint32_t)0x000000FF)
#define | SD_ALLZERO ((uint32_t)0x00000000)
#define | SD_WIDE_BUS_SUPPORT ((uint32_t)0x00040000)
#define | SD_SINGLE_BUS_SUPPORT ((uint32_t)0x00010000)
#define | SD_CARD_LOCKED ((uint32_t)0x02000000)
#define | SD_CARD_PROGRAMMING ((uint32_t)0x00000007)
#define | SD_CARD_RECEIVING ((uint32_t)0x00000006)
#define | SD_DATATIMEOUT ((uint32_t)0xFFFFFFFF)
#define | SD_0TO7BITS ((uint32_t)0x000000FF)
#define | SD_8TO15BITS ((uint32_t)0x0000FF00)
#define | SD_16TO23BITS ((uint32_t)0x00FF0000)
#define | SD_24TO31BITS ((uint32_t)0xFF000000)
#define | SD_MAX_DATA_LENGTH ((uint32_t)0x01FFFFFF)
#define | SD_HALFFIFO ((uint32_t)0x00000008)
#define | SD_HALFFIFOBYTES ((uint32_t)0x00000020)
#define | SD_CCCC_LOCK_UNLOCK ((uint32_t)0x00000080)
#define | SD_CCCC_WRITE_PROT ((uint32_t)0x00000040)
#define | SD_CCCC_ERASE ((uint32_t)0x00000020)
#define | SDIO_SEND_IF_COND ((uint32_t)0x00000008)
#define | EXT_CSD_Command_set 0x0
#define | EXT_CSD_Set_bit 0x1
#define | EXT_CSD_Clear_byte 0x2
#define | EXT_CSD_Write_byte 0x3
#define | EXT_CSD_CMD_SET_NORMAL (1<<0)
#define | EXT_CSD_CMD_SET_SECURE (1<<1)
#define | EXT_CSD_CMD_SET_CPSECURE (1<<2)
#define | EXT_CSD_BUS_WIDTH 183
#define | EXT_CSD_HS_TIMING 185
#define | SDIO_INTR_STS_WRITE_MASK
#define | SDIO_INTR_STS_READ_MASK

Enumerations

enum sd_data_transfer_mode_type { SD_TRANSFER_POLLING_MODE = 0 , SD_TRANSFER_DMA_MODE = 1 }
enum sd_error_status_type {
SD_CMD_FAIL = 1 , SD_DATA_FAIL = 2 , SD_CMD_RSP_TIMEOUT = 3 , SD_DATA_TIMEOUT = 4 ,
SD_TX_UNDERRUN = 5 , SD_RX_OVERRUN = 6 , SD_START_BIT_ERR = 7 , SD_CMD_OUT_OF_RANGE = 8 ,
SD_ADDR_MISALIGNED = 9 , SD_BLK_LEN_ERR = 10 , SD_ERASE_SEQ_ERR = 11 , SD_INVALID_ERASE_PARAM = 12 ,
SD_WR_PROTECT_VIOLATION = 13 , SD_LOCK_UNLOCK_ERROR = 14 , SD_CMD_CRC_ERROR = 15 , SD_ILLEGAL_CMD = 16 ,
SD_CARD_ECC_ERROR = 17 , SD_CARD_CONTROLLER_ERR = 18 , SD_GENERAL_UNKNOWN_ERROR = 19 , SD_STREAM_RD_UNDERRUN = 20 ,
SD_STREAM_WR_OVERRUN = 21 , SD_CID_CSD_OVERWRITE = 22 , SD_WP_ERASE_SKIP = 23 , SD_CARD_ECC_DISABLED = 24 ,
SD_ERASE_RESET = 25 , SD_AKE_SEQ_ERROR = 26 , SD_INVALID_VOLTRANGE = 27 , SD_ADDR_OUT_OF_RANGE = 28 ,
SD_SWITCH_ERROR = 29 , SD_SDIO_DISABLED = 30 , SD_SDIO_FUNC_BUSY = 31 , SD_SDIO_FUNC_ERROR = 32 ,
SD_SDIO_UNKNOWN_FUNC = 33 , SD_INTERNAL_ERROR , SD_NOT_CONFIGURED , SD_REQ_PENDING ,
SD_REQ_NOT_APPLICABLE , SD_INVALID_PARAMETER , SD_UNSUPPORTED_FEATURE , SD_UNSUPPORTED_HW ,
SD_ERROR , SD_OK = 0
}
enum sd_card_state_type {
SD_CARD_READY = ((uint32_t)0x00000001) , SD_CARD_IDENTIFICATION = ((uint32_t)0x00000002) , SD_CARD_STANDBY = ((uint32_t)0x00000003) , SD_CARD_TRANSFER = ((uint32_t)0x00000004) ,
SD_CARD_SENDING = ((uint32_t)0x00000005) , SD_CARD_RECEIVING = ((uint32_t)0x00000006) , SD_CARD_PROGRAMMING = ((uint32_t)0x00000007) , SD_CARD_DISCONNECTED = ((uint32_t)0x00000008) ,
SD_CARD_ERROR = ((uint32_t)0x000000FF)
}
enum sd_memory_card_type {
SDIO_STD_CAPACITY_SD_CARD_V1_1 = 0 , SDIO_STD_CAPACITY_SD_CARD_V2_0 = 1 , SDIO_HIGH_CAPACITY_SD_CARD = 2 , SDIO_MULTIMEDIA_CARD = 3 ,
SDIO_SECURE_DIGITAL_IO_CARD = 4 , SDIO_HIGH_SPEED_MULTIMEDIA_CARD = 5 , SDIO_SECURE_DIGITAL_IO_COMBO_CARD = 6 , SDIO_HIGH_CAPACITY_MMC_CARD = 7 ,
SDIO_SDIO_CARD = 8
}

Functions

sd_error_status_type | sd_init (void)
initializes the sd card and put it into standby state (ready for data transfer).
void | sdio_clock_set (uint32_t clkdiv)
set sdio clock devision factor.
sd_error_status_type | sd_power_on (void)
enquires cards about their operating voltage and configures clock controls.
sd_error_status_type | sd_power_off (void)
turns the sdio output signals off.
sd_error_status_type | sd_card_init (void)
intialises all cards or single card as the case may be card(s) come into standby state.
sd_error_status_type | sd_card_info_get (sd_card_info_struct_type *card_info)
returns information about specific card.
sd_error_status_type | sd_wide_bus_operation_config (sdio_bus_width_type mode)
enable wide bus opeartion for the requeseted card if supported by card.
sd_error_status_type | sd_device_mode_set (uint32_t mode)
set sdio work mode.
sd_error_status_type | sd_deselect_select (uint32_t addr)
selects od deselects the corresponding card.
sd_error_status_type | sd_status_send (uint32_t *p_card_status)
read current card status.
sd_card_state_type | sd_state_get (void)
returns information about sd card.
sd_error_status_type | sd_blocks_erase (long long addr, uint32_t nblks)
erase continuous data block
sd_error_status_type | sd_block_read (uint8_t *buf, long long addr, uint16_t blk_size)
allows to read one block from a specified address in a card. the data transfer can be managed by dma mode or polling mode.
sd_error_status_type | sd_mult_blocks_read (uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks)
allows to read blocks from a specified address in a card. the data transfer can be managed by dma mode or polling mode.
sd_error_status_type | sd_block_write (const uint8_t *buf, long long addr, uint16_t blk_size)
allows to write one block starting from a specified address in a card. the data transfer can be managed by dma mode or polling mode.
sd_error_status_type | sd_mult_blocks_write (const uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks)
allows to write blocks starting from a specified address in a card. the data transfer can be managed by dma mode only.
sd_error_status_type | mmc_stream_read (uint8_t *buf, long long addr, uint32_t len)
read mmc card data stream.
sd_error_status_type | mmc_stream_write (uint8_t *buf, long long addr, uint32_t len)
write mmc card data stream.
sd_error_status_type | sd_irq_service (void)
allows to process all the interrupts that are high.
void | sd_dma_config (uint32_t *mbuf, uint32_t buf_size, dma_dir_type dir)
set dma configuation for sdio

Variables

sd_card_info_struct_type sd_card_info

Detailed Description

this file contains all the functions prototypes for the sd/mmc card at32_sdio driver firmware library.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file emmc_card/inc/at32_sdio.h.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • sdio
  • emmc_card
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • sdio
  • emmc_card
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • sdio
  • emmc_card
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • sdio
  • emmc_card
  • src
src Directory Reference

Files

at32_sdio.c
this file provides a set of functions needed to manage the sdio/mmc card memory.
at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32_sdio.c File Reference

  • sdio
  • emmc_card
  • src
Functions | Variables
at32_sdio.c File Reference

this file provides a set of functions needed to manage the sdio/mmc card memory. More...

#include "at32_sdio.h"
#include "at32f413_board.h"

Go to the source code of this file.

Functions

sd_error_status_type | command_error (void)
checks for error conditions for cmd0.
sd_error_status_type | command_rsp1_error (uint8_t cmd)
checks for error conditions for R1 response.
sd_error_status_type | command_rsp2_error (void)
checks for error conditions for R2 (cid or csd) response.
sd_error_status_type | command_rsp3_error (void)
checks for error conditions for R3 (ocr) response.
sd_error_status_type | command_rsp4_error (uint8_t cmd)
checks for error conditions for r4 response.
sd_error_status_type | command_rsp5_error (uint8_t cmd)
checks for error conditions for r5 response.
sd_error_status_type | command_rsp6_error (uint8_t cmd, uint16_t *prca)
checks for error conditions for r6 (rca) response.
sd_error_status_type | command_rsp7_error (void)
checks for error conditions for R7 response.
sd_error_status_type | sd_bus_wide_enable (confirm_state new_state)
enable or disable the sdio wide bus mode.
sd_error_status_type | mmc_switch (uint8_t set, uint8_t index, uint8_t value)
switch mmc card speed to high speed
sd_error_status_type | sd_switch (uint32_t mode, uint32_t group, uint8_t value, uint8_t *rsp)
switch sd card speed to high speed
sd_error_status_type | check_card_programming (uint8_t *p_status)
checks if the sd card is in programming state.
sd_error_status_type | speed_change (uint8_t speed)
set bus speed
sd_error_status_type | get_ext_csd (void)
find the sd card ext csd register value.
sd_error_status_type | scr_find (void)
find the sd card scr register value.
uint8_t | convert_from_bytes_to_power_of_two (uint16_t number_of_bytes)
converts the number of bytes in power of two and returns the power.
sd_error_status_type | sd_init (void)
initializes the sd card and put it into standby state (ready for data transfer).
void | sdio_clock_set (uint32_t clk_div)
set sdio clock devision factor.
sd_error_status_type | sd_power_on (void)
enquires cards about their operating voltage and configures clock controls.
sd_error_status_type | sd_power_off (void)
turns the sdio output signals off.
sd_error_status_type | sd_card_init (void)
intialises all cards or single card as the case may be card(s) come into standby state.
sd_error_status_type | sd_card_info_get (sd_card_info_struct_type *card_info)
returns information about specific card.
sd_error_status_type | sd_wide_bus_operation_config (sdio_bus_width_type mode)
enable wide bus opeartion for the requeseted card if supported by card.
sd_error_status_type | sd_device_mode_set (uint32_t mode)
set sdio work mode.
sd_error_status_type | sd_deselect_select (uint32_t addr)
selects od deselects the corresponding card.
sd_error_status_type | sdio_command_data_send (sdio_command_struct_type *sdio_cmd_init_t, sdio_data_struct_type *sdio_data_init_t, uint32_t *buf)
read data from or write data to sd card.
sd_error_status_type | sd_blocks_erase (long long addr, uint32_t nblks)
erase continuous data block
sd_error_status_type | sd_block_read (uint8_t *buf, long long addr, uint16_t blk_size)
allows to read one block from a specified address in a card. the data transfer can be managed by dma mode or polling mode.
sd_error_status_type | sd_mult_blocks_read (uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks)
allows to read blocks from a specified address in a card. the data transfer can be managed by dma mode or polling mode.
sd_error_status_type | sd_block_write (const uint8_t *buf, long long addr, uint16_t blk_size)
allows to write one block starting from a specified address in a card. the data transfer can be managed by dma mode or polling mode.
sd_error_status_type | sd_mult_blocks_write (const uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks)
allows to write blocks starting from a specified address in a card. the data transfer can be managed by dma mode only.
sd_error_status_type | mmc_stream_read (uint8_t *buf, long long addr, uint32_t len)
read mmc card data stream.
sd_error_status_type | mmc_stream_write (uint8_t *buf, long long addr, uint32_t len)
write mmc card data stream.
void | SDIO1_IRQHandler (void)
sdio1 isr.
void | SDIO2_IRQHandler (void)
sdio2 isr.
sd_error_status_type | sd_irq_service (void)
allows to process all the interrupts that are high.
sd_error_status_type | sd_status_send (uint32_t *p_card_status)
read current card status.
sd_card_state_type | sd_state_get (void)
returns information about sd card.
void | sd_dma_config (uint32_t *mbuf, uint32_t buf_size, dma_dir_type dir)
set dma configuation for sdio

Variables

sdio_command_struct_type sdio_command_init_struct
sdio_data_struct_type sdio_data_init_struct
static sd_memory_card_type | card_type = SDIO_STD_CAPACITY_SD_CARD_V1_1
static uint32_t | csd_table [4]
static uint32_t | cid_table [4]
static uint32_t | rca = 0
static uint32_t | ext_csd_table [128]
static sd_data_transfer_mode_type | device_mode = SD_TRANSFER_POLLING_MODE
static uint8_t | stop_flag = 0
volatile sd_error_status_type | transfer_error = SD_OK
volatile uint8_t | transfer_end = 0
sd_card_info_struct_type sd_card_info

Detailed Description

this file provides a set of functions needed to manage the sdio/mmc card memory.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file emmc_card/src/at32_sdio.c.


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • sdio
  • emmc_card
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/sdio/emmc_card/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/sdio/emmc_card/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • sdio
  • emmc_card
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/sdio/emmc_card/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • sdio
  • emmc_card
  • src
Macros | Enumerations | Functions | Variables
main.c File Reference

main program More...

#include <stdbool.h>
#include <string.h>
#include "at32_sdio.h"
#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Macros

#define | BLOCK_SIZE (512)
#define | BLOCKS_NUMBER (8)
#define | MULTI_BUFFER_SIZE (BLOCK_SIZE * BLOCKS_NUMBER)
#define | STREAM_BUFFER_SIZE (1024)

Enumerations

enum test_result_type { TEST_FAIL = 0 , TEST_SUCCESS }

Functions

static test_result_type | sd_single_block_test (void)
sd card single block read/write test.
static test_result_type | sd_multiple_blocks_test (void)
sd card multiple blocks read/write test.
uint8_t | buffer_compare (uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t buffer_length)
compares two buffers.
static void | sd_test_error (void)
LED2 on off every 300ms for sd test error.
static void | nvic_configuration (void)
configures sdio1 irq channel.
static test_result_type | mmc_stream_test (void)
mmc card data stream read/write test.
void | show_card_info (void)
show sd/mmc card info.
int | main (void)
main function.

Variables

static uint8_t | sblock_tbuffer [(512)]
static uint8_t | sblock_rbuffer [(512)]
static uint8_t | mblock_tbuffer [((512) *(8))]
static uint8_t | mblock_rbuffer [((512) *(8))]
static uint8_t | stream_tbuffer [(1024)]
static uint8_t | stream_rbuffer [(1024)]

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/sdio/emmc_card/src/main.c.


AT32F413 Firmwary Library: sd_mmc_card Directory Reference

  • sdio
  • sd_mmc_card
sd_mmc_card Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • sdio
  • sd_mmc_card
  • inc
inc Directory Reference

Files

at32_sdio.h
this file contains all the functions prototypes for the sd/mmc card at32_sdio driver firmware library.
at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32_sdio.h File Reference

  • sdio
  • sd_mmc_card
  • inc
Data Structures | Macros | Enumerations | Functions | Variables
at32_sdio.h File Reference

this file contains all the functions prototypes for the sd/mmc card at32_sdio driver firmware library. More...

#include "at32f413.h"

Go to the source code of this file.

Data Structures

struct | sd_csd_struct_type
struct | sd_cid_struct_type
struct | sd_scr_struct_type
struct | sd_card_info_struct_type

Macros

#define | SDIOx SDIO1
#define | SD_CMD_GO_IDLE_STATE ((uint8_t)0)
#define | SD_CMD_SEND_OP_COND ((uint8_t)1)
#define | SD_CMD_ALL_SEND_CID ((uint8_t)2)
#define | SD_CMD_SET_REL_ADDR ((uint8_t)3)
#define | SD_CMD_SET_DSR ((uint8_t)4)
#define | SD_CMD_SDIO_SEN_OP_COND ((uint8_t)5)
#define | SD_CMD_HS_SWITCH ((uint8_t)6)
#define | SD_CMD_SEL_DESEL_CARD ((uint8_t)7)
#define | SD_CMD_HS_SEND_EXT_CSD ((uint8_t)8)
#define | SD_CMD_SEND_CSD ((uint8_t)9)
#define | SD_CMD_SEND_CID ((uint8_t)10)
#define | SD_CMD_READ_DAT_UNTIL_STOP ((uint8_t)11)
#define | SD_CMD_STOP_TRANSMISSION ((uint8_t)12)
#define | SD_CMD_SEND_STATUS ((uint8_t)13)
#define | SD_CMD_HS_BUSTEST_READ ((uint8_t)14)
#define | SD_CMD_GO_INACTIVE_STATE ((uint8_t)15)
#define | SD_CMD_SET_BLOCKLEN ((uint8_t)16)
#define | SD_CMD_READ_SINGLE_BLOCK ((uint8_t)17)
#define | SD_CMD_READ_MULT_BLOCK ((uint8_t)18)
#define | SD_CMD_HS_BUSTEST_WRITE ((uint8_t)19)
#define | SD_CMD_WRITE_DAT_UNTIL_STOP ((uint8_t)20)
#define | SD_CMD_SET_BLOCK_COUNT ((uint8_t)23)
#define | SD_CMD_WRITE_SINGLE_BLOCK ((uint8_t)24)
#define | SD_CMD_WRITE_MULT_BLOCK ((uint8_t)25)
#define | SD_CMD_PROG_CID ((uint8_t)26)
#define | SD_CMD_PROG_CSD ((uint8_t)27)
#define | SD_CMD_SET_WRITE_PROT ((uint8_t)28)
#define | SD_CMD_CLR_WRITE_PROT ((uint8_t)29)
#define | SD_CMD_SEND_WRITE_PROT ((uint8_t)30)
#define | SD_CMD_SD_ERASE_GRP_START ((uint8_t)32)
#define | SD_CMD_SD_ERASE_GRP_END ((uint8_t)33)
#define | SD_CMD_ERASE_GRP_START ((uint8_t)35)
#define | SD_CMD_ERASE_GRP_END ((uint8_t)36)
#define | SD_CMD_ERASE ((uint8_t)38)
#define | SD_CMD_FAST_IO ((uint8_t)39)
#define | SD_CMD_GO_IRQ_STATE ((uint8_t)40)
#define | SD_CMD_LOCK_UNLOCK ((uint8_t)42)
#define | SD_CMD_APP_CMD ((uint8_t)55)
#define | SD_CMD_GEN_CMD ((uint8_t)56)
#define | SD_CMD_NO_CMD ((uint8_t)64)
#define | SD_CMD_APP_SD_SET_BUSWIDTH ((uint8_t)6)
#define | SD_CMD_SD_APP_STAUS ((uint8_t)13)
#define | SD_CMD_SD_APP_SEND_NUM_WRITE_BLOCKS ((uint8_t)22)
#define | SD_CMD_SD_APP_OP_COND ((uint8_t)41)
#define | SD_CMD_SD_APP_SET_CLR_CARD_DETECT ((uint8_t)42)
#define | SD_CMD_SD_APP_SEND_SCR ((uint8_t)51)
#define | SD_CMD_SDIO_RW_DIRECT ((uint8_t)52)
#define | SD_CMD_SDIO_RW_EXTENDED ((uint8_t)53)
#define | SD_CMD_SD_APP_GET_MKB ((uint8_t)43)
#define | SD_CMD_SD_APP_GET_MID ((uint8_t)44)
#define | SD_CMD_SD_APP_SET_CER_RN1 ((uint8_t)45)
#define | SD_CMD_SD_APP_GET_CER_RN2 ((uint8_t)46)
#define | SD_CMD_SD_APP_SET_CER_RES2 ((uint8_t)47)
#define | SD_CMD_SD_APP_GET_CER_RES1 ((uint8_t)48)
#define | SD_CMD_SD_APP_SECURE_READ_MULTIPLE_BLOCK ((uint8_t)18)
#define | SD_CMD_SD_APP_SECURE_WRITE_MULTIPLE_BLOCK ((uint8_t)25)
#define | SD_CMD_SD_APP_SECURE_ERASE ((uint8_t)38)
#define | SD_CMD_SD_APP_CHANGE_SECURE_AREA ((uint8_t)49)
#define | SD_CMD_SD_APP_SECURE_WRITE_MKB ((uint8_t)48)
#define | NULL 0
#define | SDIO_STATIC_FLAGS ((uint32_t)0x000005FF)
#define | SDIO_CMD0TIMEOUT ((uint32_t)0x00010000)
#define | SDIO_DATATIMEOUT ((uint32_t)0xFFFFFFFF)
#define | SD_OCR_ADDR_OUT_OF_RANGE ((uint32_t)0x80000000)
#define | SD_OCR_ADDR_MISALIGNED ((uint32_t)0x40000000)
#define | SD_OCR_BLK_LEN_ERR ((uint32_t)0x20000000)
#define | SD_OCR_ERASE_SEQ_ERR ((uint32_t)0x10000000)
#define | SD_OCR_INVALID_ERASE_PARAM ((uint32_t)0x08000000)
#define | SD_OCR_WR_PROTECT_VIOLATION ((uint32_t)0x04000000)
#define | SD_OCR_LOCK_UNLOCK_ERROR ((uint32_t)0x01000000)
#define | SD_OCR_CMD_CRC_ERROR ((uint32_t)0x00800000)
#define | SD_OCR_ILLEGAL_CMD ((uint32_t)0x00400000)
#define | SD_OCR_CARD_ECC_ERROR ((uint32_t)0x00200000)
#define | SD_OCR_CARD_CONTROLLER_ERR ((uint32_t)0x00100000)
#define | SD_OCR_GENERAL_UNKNOWN_ERROR ((uint32_t)0x00080000)
#define | SD_OCR_STREAM_RD_UNDERRUN ((uint32_t)0x00040000)
#define | SD_OCR_STREAM_WR_OVERRUN ((uint32_t)0x00020000)
#define | SD_OCR_CID_CSD_OVERWRIETE ((uint32_t)0x00010000)
#define | SD_OCR_WP_ERASE_SKIP ((uint32_t)0x00008000)
#define | SD_OCR_CARD_ECC_DISABLED ((uint32_t)0x00004000)
#define | SD_OCR_ERASE_RESET ((uint32_t)0x00002000)
#define | MMC_SWITCH_ERROR ((uint32_t)0x00000080)
#define | SD_OCR_AKE_SEQ_ERROR ((uint32_t)0x00000008)
#define | SD_OCR_ERRORBITS ((uint32_t)0xFDFFE008)
#define | SD_R5_OUT_OF_RANGE ((uint32_t)0x00000100)
#define | SD_R5_FUNCTION_NUMBER ((uint32_t)0x00000200)
#define | SD_R5_ERROR ((uint32_t)0x00000800)
#define | SD_R6_GENERAL_UNKNOWN_ERROR ((uint32_t)0x00002000)
#define | SD_R6_ILLEGAL_CMD ((uint32_t)0x00004000)
#define | SD_R6_CMD_CRC_ERROR ((uint32_t)0x00008000)
#define | SD_VOLTAGE_WINDOW_SD ((uint32_t)0x80100000)
#define | SD_HIGH_CAPACITY ((uint32_t)0x40000000)
#define | SD_STD_CAPACITY ((uint32_t)0x00000000)
#define | SD_CHECK_PATTERN ((uint32_t)0x000001AA)
#define | SD_VOLTAGE_WINDOW_MMC ((uint32_t)0x40FF8000)
#define | SD_MAX_VOLT_TRIAL ((uint32_t)0x000000FF)
#define | SD_ALLZERO ((uint32_t)0x00000000)
#define | SD_WIDE_BUS_SUPPORT ((uint32_t)0x00040000)
#define | SD_SINGLE_BUS_SUPPORT ((uint32_t)0x00010000)
#define | SD_CARD_LOCKED ((uint32_t)0x02000000)
#define | SD_CARD_PROGRAMMING ((uint32_t)0x00000007)
#define | SD_CARD_RECEIVING ((uint32_t)0x00000006)
#define | SD_DATATIMEOUT ((uint32_t)0xFFFFFFFF)
#define | SD_0TO7BITS ((uint32_t)0x000000FF)
#define | SD_8TO15BITS ((uint32_t)0x0000FF00)
#define | SD_16TO23BITS ((uint32_t)0x00FF0000)
#define | SD_24TO31BITS ((uint32_t)0xFF000000)
#define | SD_MAX_DATA_LENGTH ((uint32_t)0x01FFFFFF)
#define | SD_HALFFIFO ((uint32_t)0x00000008)
#define | SD_HALFFIFOBYTES ((uint32_t)0x00000020)
#define | SD_CCCC_LOCK_UNLOCK ((uint32_t)0x00000080)
#define | SD_CCCC_WRITE_PROT ((uint32_t)0x00000040)
#define | SD_CCCC_ERASE ((uint32_t)0x00000020)
#define | SDIO_SEND_IF_COND ((uint32_t)0x00000008)
#define | EXT_CSD_Command_set 0x0
#define | EXT_CSD_Set_bit 0x1
#define | EXT_CSD_Clear_byte 0x2
#define | EXT_CSD_Write_byte 0x3
#define | EXT_CSD_CMD_SET_NORMAL (1<<0)
#define | EXT_CSD_CMD_SET_SECURE (1<<1)
#define | EXT_CSD_CMD_SET_CPSECURE (1<<2)
#define | EXT_CSD_BUS_WIDTH 183
#define | EXT_CSD_HS_TIMING 185
#define | SDIO_INTR_STS_WRITE_MASK
#define | SDIO_INTR_STS_READ_MASK

Enumerations

enum sd_data_transfer_mode_type { SD_TRANSFER_POLLING_MODE = 0 , SD_TRANSFER_DMA_MODE = 1 }
enum sd_error_status_type {
SD_CMD_FAIL = 1 , SD_DATA_FAIL = 2 , SD_CMD_RSP_TIMEOUT = 3 , SD_DATA_TIMEOUT = 4 ,
SD_TX_UNDERRUN = 5 , SD_RX_OVERRUN = 6 , SD_START_BIT_ERR = 7 , SD_CMD_OUT_OF_RANGE = 8 ,
SD_ADDR_MISALIGNED = 9 , SD_BLK_LEN_ERR = 10 , SD_ERASE_SEQ_ERR = 11 , SD_INVALID_ERASE_PARAM = 12 ,
SD_WR_PROTECT_VIOLATION = 13 , SD_LOCK_UNLOCK_ERROR = 14 , SD_CMD_CRC_ERROR = 15 , SD_ILLEGAL_CMD = 16 ,
SD_CARD_ECC_ERROR = 17 , SD_CARD_CONTROLLER_ERR = 18 , SD_GENERAL_UNKNOWN_ERROR = 19 , SD_STREAM_RD_UNDERRUN = 20 ,
SD_STREAM_WR_OVERRUN = 21 , SD_CID_CSD_OVERWRITE = 22 , SD_WP_ERASE_SKIP = 23 , SD_CARD_ECC_DISABLED = 24 ,
SD_ERASE_RESET = 25 , SD_AKE_SEQ_ERROR = 26 , SD_INVALID_VOLTRANGE = 27 , SD_ADDR_OUT_OF_RANGE = 28 ,
SD_SWITCH_ERROR = 29 , SD_SDIO_DISABLED = 30 , SD_SDIO_FUNC_BUSY = 31 , SD_SDIO_FUNC_ERROR = 32 ,
SD_SDIO_UNKNOWN_FUNC = 33 , SD_INTERNAL_ERROR , SD_NOT_CONFIGURED , SD_REQ_PENDING ,
SD_REQ_NOT_APPLICABLE , SD_INVALID_PARAMETER , SD_UNSUPPORTED_FEATURE , SD_UNSUPPORTED_HW ,
SD_ERROR , SD_OK = 0
}
enum sd_card_state_type {
SD_CARD_READY = ((uint32_t)0x00000001) , SD_CARD_IDENTIFICATION = ((uint32_t)0x00000002) , SD_CARD_STANDBY = ((uint32_t)0x00000003) , SD_CARD_TRANSFER = ((uint32_t)0x00000004) ,
SD_CARD_SENDING = ((uint32_t)0x00000005) , SD_CARD_RECEIVING = ((uint32_t)0x00000006) , SD_CARD_PROGRAMMING = ((uint32_t)0x00000007) , SD_CARD_DISCONNECTED = ((uint32_t)0x00000008) ,
SD_CARD_ERROR = ((uint32_t)0x000000FF)
}
enum sd_memory_card_type {
SDIO_STD_CAPACITY_SD_CARD_V1_1 = 0 , SDIO_STD_CAPACITY_SD_CARD_V2_0 = 1 , SDIO_HIGH_CAPACITY_SD_CARD = 2 , SDIO_MULTIMEDIA_CARD = 3 ,
SDIO_SECURE_DIGITAL_IO_CARD = 4 , SDIO_HIGH_SPEED_MULTIMEDIA_CARD = 5 , SDIO_SECURE_DIGITAL_IO_COMBO_CARD = 6 , SDIO_HIGH_CAPACITY_MMC_CARD = 7 ,
SDIO_SDIO_CARD = 8
}

Functions

sd_error_status_type | sd_init (void)
initializes the sd card and put it into standby state (ready for data transfer).
void | sdio_clock_set (uint32_t clkdiv)
set sdio clock devision factor.
sd_error_status_type | sd_power_on (void)
enquires cards about their operating voltage and configures clock controls.
sd_error_status_type | sd_power_off (void)
turns the sdio output signals off.
sd_error_status_type | sd_card_init (void)
intialises all cards or single card as the case may be card(s) come into standby state.
sd_error_status_type | sd_card_info_get (sd_card_info_struct_type *card_info)
returns information about specific card.
sd_error_status_type | sd_wide_bus_operation_config (sdio_bus_width_type mode)
enable wide bus opeartion for the requeseted card if supported by card.
sd_error_status_type | sd_device_mode_set (uint32_t mode)
set sdio work mode.
sd_error_status_type | sd_deselect_select (uint32_t addr)
selects od deselects the corresponding card.
sd_error_status_type | sd_status_send (uint32_t *p_card_status)
read current card status.
sd_card_state_type | sd_state_get (void)
returns information about sd card.
sd_error_status_type | sd_blocks_erase (long long addr, uint32_t nblks)
erase continuous data block
sd_error_status_type | sd_block_read (uint8_t *buf, long long addr, uint16_t blk_size)
allows to read one block from a specified address in a card. the data transfer can be managed by dma mode or polling mode.
sd_error_status_type | sd_mult_blocks_read (uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks)
allows to read blocks from a specified address in a card. the data transfer can be managed by dma mode or polling mode.
sd_error_status_type | sd_block_write (const uint8_t *buf, long long addr, uint16_t blk_size)
allows to write one block starting from a specified address in a card. the data transfer can be managed by dma mode or polling mode.
sd_error_status_type | sd_mult_blocks_write (const uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks)
allows to write blocks starting from a specified address in a card. the data transfer can be managed by dma mode only.
sd_error_status_type | mmc_stream_read (uint8_t *buf, long long addr, uint32_t len)
read mmc card data stream.
sd_error_status_type | mmc_stream_write (uint8_t *buf, long long addr, uint32_t len)
write mmc card data stream.
sd_error_status_type | sd_irq_service (void)
allows to process all the interrupts that are high.
void | sd_dma_config (uint32_t *mbuf, uint32_t buf_size, dma_dir_type dir)
set dma configuation for sdio

Variables

sd_card_info_struct_type sd_card_info

Detailed Description

this file contains all the functions prototypes for the sd/mmc card at32_sdio driver firmware library.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file sd_mmc_card/inc/at32_sdio.h.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • sdio
  • sd_mmc_card
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • sdio
  • sd_mmc_card
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • sdio
  • sd_mmc_card
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • sdio
  • sd_mmc_card
  • src
src Directory Reference

Files

at32_sdio.c
this file provides a set of functions needed to manage the sdio/mmc card memory.
at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32_sdio.c File Reference

  • sdio
  • sd_mmc_card
  • src
Functions | Variables
at32_sdio.c File Reference

this file provides a set of functions needed to manage the sdio/mmc card memory. More...

#include "at32_sdio.h"
#include "at32f413_board.h"

Go to the source code of this file.

Functions

sd_error_status_type | command_error (void)
checks for error conditions for cmd0.
sd_error_status_type | command_rsp1_error (uint8_t cmd)
checks for error conditions for R1 response.
sd_error_status_type | command_rsp2_error (void)
checks for error conditions for R2 (cid or csd) response.
sd_error_status_type | command_rsp3_error (void)
checks for error conditions for R3 (ocr) response.
sd_error_status_type | command_rsp4_error (uint8_t cmd)
checks for error conditions for r4 response.
sd_error_status_type | command_rsp5_error (uint8_t cmd)
checks for error conditions for r5 response.
sd_error_status_type | command_rsp6_error (uint8_t cmd, uint16_t *prca)
checks for error conditions for r6 (rca) response.
sd_error_status_type | command_rsp7_error (void)
checks for error conditions for R7 response.
sd_error_status_type | sd_bus_wide_enable (confirm_state new_state)
enable or disable the sdio wide bus mode.
sd_error_status_type | mmc_switch (uint8_t set, uint8_t index, uint8_t value)
switch mmc card speed to high speed
sd_error_status_type | sd_switch (uint32_t mode, uint32_t group, uint8_t value, uint8_t *rsp)
switch sd card speed to high speed
sd_error_status_type | check_card_programming (uint8_t *p_status)
checks if the sd card is in programming state.
sd_error_status_type | speed_change (uint8_t speed)
set bus speed
sd_error_status_type | get_ext_csd (void)
find the sd card ext csd register value.
sd_error_status_type | scr_find (void)
find the sd card scr register value.
uint8_t | convert_from_bytes_to_power_of_two (uint16_t number_of_bytes)
converts the number of bytes in power of two and returns the power.
sd_error_status_type | sd_init (void)
initializes the sd card and put it into standby state (ready for data transfer).
void | sdio_clock_set (uint32_t clk_div)
set sdio clock devision factor.
sd_error_status_type | sd_power_on (void)
enquires cards about their operating voltage and configures clock controls.
sd_error_status_type | sd_power_off (void)
turns the sdio output signals off.
sd_error_status_type | sd_card_init (void)
intialises all cards or single card as the case may be card(s) come into standby state.
sd_error_status_type | sd_card_info_get (sd_card_info_struct_type *card_info)
returns information about specific card.
sd_error_status_type | sd_wide_bus_operation_config (sdio_bus_width_type mode)
enable wide bus opeartion for the requeseted card if supported by card.
sd_error_status_type | sd_device_mode_set (uint32_t mode)
set sdio work mode.
sd_error_status_type | sd_deselect_select (uint32_t addr)
selects od deselects the corresponding card.
sd_error_status_type | sdio_command_data_send (sdio_command_struct_type *sdio_cmd_init_t, sdio_data_struct_type *sdio_data_init_t, uint32_t *buf)
read data from or write data to sd card.
sd_error_status_type | sd_blocks_erase (long long addr, uint32_t nblks)
erase continuous data block
sd_error_status_type | sd_block_read (uint8_t *buf, long long addr, uint16_t blk_size)
allows to read one block from a specified address in a card. the data transfer can be managed by dma mode or polling mode.
sd_error_status_type | sd_mult_blocks_read (uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks)
allows to read blocks from a specified address in a card. the data transfer can be managed by dma mode or polling mode.
sd_error_status_type | sd_block_write (const uint8_t *buf, long long addr, uint16_t blk_size)
allows to write one block starting from a specified address in a card. the data transfer can be managed by dma mode or polling mode.
sd_error_status_type | sd_mult_blocks_write (const uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks)
allows to write blocks starting from a specified address in a card. the data transfer can be managed by dma mode only.
sd_error_status_type | mmc_stream_read (uint8_t *buf, long long addr, uint32_t len)
read mmc card data stream.
sd_error_status_type | mmc_stream_write (uint8_t *buf, long long addr, uint32_t len)
write mmc card data stream.
void | SDIO1_IRQHandler (void)
sdio1 isr.
void | SDIO2_IRQHandler (void)
sdio2 isr.
sd_error_status_type | sd_irq_service (void)
allows to process all the interrupts that are high.
sd_error_status_type | sd_status_send (uint32_t *p_card_status)
read current card status.
sd_card_state_type | sd_state_get (void)
returns information about sd card.
void | sd_dma_config (uint32_t *mbuf, uint32_t buf_size, dma_dir_type dir)
set dma configuation for sdio

Variables

sdio_command_struct_type sdio_command_init_struct
sdio_data_struct_type sdio_data_init_struct
static sd_memory_card_type | card_type = SDIO_STD_CAPACITY_SD_CARD_V1_1
static uint32_t | csd_table [4]
static uint32_t | cid_table [4]
static uint32_t | rca = 0
static uint32_t | ext_csd_table [128]
static sd_data_transfer_mode_type | device_mode = SD_TRANSFER_POLLING_MODE
static uint8_t | stop_flag = 0
volatile sd_error_status_type | transfer_error = SD_OK
volatile uint8_t | transfer_end = 0
sd_card_info_struct_type sd_card_info

Detailed Description

this file provides a set of functions needed to manage the sdio/mmc card memory.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file sd_mmc_card/src/at32_sdio.c.


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • sdio
  • sd_mmc_card
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/sdio/sd_mmc_card/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/sdio/sd_mmc_card/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • sdio
  • sd_mmc_card
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/sdio/sd_mmc_card/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • sdio
  • sd_mmc_card
  • src
Macros | Enumerations | Functions | Variables
main.c File Reference

main program More...

#include <stdbool.h>
#include <string.h>
#include "at32_sdio.h"
#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Macros

#define | BLOCK_SIZE (512)
#define | BLOCKS_NUMBER (8)
#define | MULTI_BUFFER_SIZE (BLOCK_SIZE * BLOCKS_NUMBER)
#define | STREAM_BUFFER_SIZE (1024)

Enumerations

enum test_result_type { TEST_FAIL = 0 , TEST_SUCCESS }

Functions

static test_result_type | sd_single_block_test (void)
sd card single block read/write test.
static test_result_type | sd_multiple_blocks_test (void)
sd card multiple blocks read/write test.
uint8_t | buffer_compare (uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t buffer_length)
compares two buffers.
static void | sd_test_error (void)
LED2 on off every 300ms for sd test error.
static void | nvic_configuration (void)
configures sdio1 irq channel.
static test_result_type | mmc_stream_test (void)
mmc card data stream read/write test.
void | show_card_info (void)
show sd/mmc card info.
int | main (void)
main function.

Variables

static uint8_t | sblock_tbuffer [(512)]
static uint8_t | sblock_rbuffer [(512)]
static uint8_t | mblock_tbuffer [((512) *(8))]
static uint8_t | mblock_rbuffer [((512) *(8))]
static uint8_t | stream_tbuffer [(1024)]
static uint8_t | stream_rbuffer [(1024)]

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c.


AT32F413 Firmwary Library: sdio_fatfs Directory Reference

  • sdio
  • sdio_fatfs
sdio_fatfs Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • sdio
  • sdio_fatfs
  • inc
inc Directory Reference

Files

at32_sdio.h
this file contains all the functions prototypes for the sd/mmc card at32_sdio driver firmware library.
at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.
ffconf.h


AT32F413 Firmwary Library: at32_sdio.h File Reference

  • sdio
  • sdio_fatfs
  • inc
Data Structures | Macros | Enumerations | Functions | Variables
at32_sdio.h File Reference

this file contains all the functions prototypes for the sd/mmc card at32_sdio driver firmware library. More...

#include "at32f413.h"

Go to the source code of this file.

Data Structures

struct | sd_csd_struct_type
struct | sd_cid_struct_type
struct | sd_scr_struct_type
struct | sd_card_info_struct_type

Macros

#define | SDIOx SDIO1
#define | SD_CMD_GO_IDLE_STATE ((uint8_t)0)
#define | SD_CMD_SEND_OP_COND ((uint8_t)1)
#define | SD_CMD_ALL_SEND_CID ((uint8_t)2)
#define | SD_CMD_SET_REL_ADDR ((uint8_t)3)
#define | SD_CMD_SET_DSR ((uint8_t)4)
#define | SD_CMD_SDIO_SEN_OP_COND ((uint8_t)5)
#define | SD_CMD_HS_SWITCH ((uint8_t)6)
#define | SD_CMD_SEL_DESEL_CARD ((uint8_t)7)
#define | SD_CMD_HS_SEND_EXT_CSD ((uint8_t)8)
#define | SD_CMD_SEND_CSD ((uint8_t)9)
#define | SD_CMD_SEND_CID ((uint8_t)10)
#define | SD_CMD_READ_DAT_UNTIL_STOP ((uint8_t)11)
#define | SD_CMD_STOP_TRANSMISSION ((uint8_t)12)
#define | SD_CMD_SEND_STATUS ((uint8_t)13)
#define | SD_CMD_HS_BUSTEST_READ ((uint8_t)14)
#define | SD_CMD_GO_INACTIVE_STATE ((uint8_t)15)
#define | SD_CMD_SET_BLOCKLEN ((uint8_t)16)
#define | SD_CMD_READ_SINGLE_BLOCK ((uint8_t)17)
#define | SD_CMD_READ_MULT_BLOCK ((uint8_t)18)
#define | SD_CMD_HS_BUSTEST_WRITE ((uint8_t)19)
#define | SD_CMD_WRITE_DAT_UNTIL_STOP ((uint8_t)20)
#define | SD_CMD_SET_BLOCK_COUNT ((uint8_t)23)
#define | SD_CMD_WRITE_SINGLE_BLOCK ((uint8_t)24)
#define | SD_CMD_WRITE_MULT_BLOCK ((uint8_t)25)
#define | SD_CMD_PROG_CID ((uint8_t)26)
#define | SD_CMD_PROG_CSD ((uint8_t)27)
#define | SD_CMD_SET_WRITE_PROT ((uint8_t)28)
#define | SD_CMD_CLR_WRITE_PROT ((uint8_t)29)
#define | SD_CMD_SEND_WRITE_PROT ((uint8_t)30)
#define | SD_CMD_SD_ERASE_GRP_START ((uint8_t)32)
#define | SD_CMD_SD_ERASE_GRP_END ((uint8_t)33)
#define | SD_CMD_ERASE_GRP_START ((uint8_t)35)
#define | SD_CMD_ERASE_GRP_END ((uint8_t)36)
#define | SD_CMD_ERASE ((uint8_t)38)
#define | SD_CMD_FAST_IO ((uint8_t)39)
#define | SD_CMD_GO_IRQ_STATE ((uint8_t)40)
#define | SD_CMD_LOCK_UNLOCK ((uint8_t)42)
#define | SD_CMD_APP_CMD ((uint8_t)55)
#define | SD_CMD_GEN_CMD ((uint8_t)56)
#define | SD_CMD_NO_CMD ((uint8_t)64)
#define | SD_CMD_APP_SD_SET_BUSWIDTH ((uint8_t)6)
#define | SD_CMD_SD_APP_STAUS ((uint8_t)13)
#define | SD_CMD_SD_APP_SEND_NUM_WRITE_BLOCKS ((uint8_t)22)
#define | SD_CMD_SD_APP_OP_COND ((uint8_t)41)
#define | SD_CMD_SD_APP_SET_CLR_CARD_DETECT ((uint8_t)42)
#define | SD_CMD_SD_APP_SEND_SCR ((uint8_t)51)
#define | SD_CMD_SDIO_RW_DIRECT ((uint8_t)52)
#define | SD_CMD_SDIO_RW_EXTENDED ((uint8_t)53)
#define | SD_CMD_SD_APP_GET_MKB ((uint8_t)43)
#define | SD_CMD_SD_APP_GET_MID ((uint8_t)44)
#define | SD_CMD_SD_APP_SET_CER_RN1 ((uint8_t)45)
#define | SD_CMD_SD_APP_GET_CER_RN2 ((uint8_t)46)
#define | SD_CMD_SD_APP_SET_CER_RES2 ((uint8_t)47)
#define | SD_CMD_SD_APP_GET_CER_RES1 ((uint8_t)48)
#define | SD_CMD_SD_APP_SECURE_READ_MULTIPLE_BLOCK ((uint8_t)18)
#define | SD_CMD_SD_APP_SECURE_WRITE_MULTIPLE_BLOCK ((uint8_t)25)
#define | SD_CMD_SD_APP_SECURE_ERASE ((uint8_t)38)
#define | SD_CMD_SD_APP_CHANGE_SECURE_AREA ((uint8_t)49)
#define | SD_CMD_SD_APP_SECURE_WRITE_MKB ((uint8_t)48)
#define | NULL 0
#define | SDIO_STATIC_FLAGS ((uint32_t)0x000005FF)
#define | SDIO_CMD0TIMEOUT ((uint32_t)0x00010000)
#define | SDIO_DATATIMEOUT ((uint32_t)0xFFFFFFFF)
#define | SD_OCR_ADDR_OUT_OF_RANGE ((uint32_t)0x80000000)
#define | SD_OCR_ADDR_MISALIGNED ((uint32_t)0x40000000)
#define | SD_OCR_BLK_LEN_ERR ((uint32_t)0x20000000)
#define | SD_OCR_ERASE_SEQ_ERR ((uint32_t)0x10000000)
#define | SD_OCR_INVALID_ERASE_PARAM ((uint32_t)0x08000000)
#define | SD_OCR_WR_PROTECT_VIOLATION ((uint32_t)0x04000000)
#define | SD_OCR_LOCK_UNLOCK_ERROR ((uint32_t)0x01000000)
#define | SD_OCR_CMD_CRC_ERROR ((uint32_t)0x00800000)
#define | SD_OCR_ILLEGAL_CMD ((uint32_t)0x00400000)
#define | SD_OCR_CARD_ECC_ERROR ((uint32_t)0x00200000)
#define | SD_OCR_CARD_CONTROLLER_ERR ((uint32_t)0x00100000)
#define | SD_OCR_GENERAL_UNKNOWN_ERROR ((uint32_t)0x00080000)
#define | SD_OCR_STREAM_RD_UNDERRUN ((uint32_t)0x00040000)
#define | SD_OCR_STREAM_WR_OVERRUN ((uint32_t)0x00020000)
#define | SD_OCR_CID_CSD_OVERWRIETE ((uint32_t)0x00010000)
#define | SD_OCR_WP_ERASE_SKIP ((uint32_t)0x00008000)
#define | SD_OCR_CARD_ECC_DISABLED ((uint32_t)0x00004000)
#define | SD_OCR_ERASE_RESET ((uint32_t)0x00002000)
#define | MMC_SWITCH_ERROR ((uint32_t)0x00000080)
#define | SD_OCR_AKE_SEQ_ERROR ((uint32_t)0x00000008)
#define | SD_OCR_ERRORBITS ((uint32_t)0xFDFFE008)
#define | SD_R5_OUT_OF_RANGE ((uint32_t)0x00000100)
#define | SD_R5_FUNCTION_NUMBER ((uint32_t)0x00000200)
#define | SD_R5_ERROR ((uint32_t)0x00000800)
#define | SD_R6_GENERAL_UNKNOWN_ERROR ((uint32_t)0x00002000)
#define | SD_R6_ILLEGAL_CMD ((uint32_t)0x00004000)
#define | SD_R6_CMD_CRC_ERROR ((uint32_t)0x00008000)
#define | SD_VOLTAGE_WINDOW_SD ((uint32_t)0x80100000)
#define | SD_HIGH_CAPACITY ((uint32_t)0x40000000)
#define | SD_STD_CAPACITY ((uint32_t)0x00000000)
#define | SD_CHECK_PATTERN ((uint32_t)0x000001AA)
#define | SD_VOLTAGE_WINDOW_MMC ((uint32_t)0x40FF8000)
#define | SD_MAX_VOLT_TRIAL ((uint32_t)0x000000FF)
#define | SD_ALLZERO ((uint32_t)0x00000000)
#define | SD_WIDE_BUS_SUPPORT ((uint32_t)0x00040000)
#define | SD_SINGLE_BUS_SUPPORT ((uint32_t)0x00010000)
#define | SD_CARD_LOCKED ((uint32_t)0x02000000)
#define | SD_CARD_PROGRAMMING ((uint32_t)0x00000007)
#define | SD_CARD_RECEIVING ((uint32_t)0x00000006)
#define | SD_DATATIMEOUT ((uint32_t)0xFFFFFFFF)
#define | SD_0TO7BITS ((uint32_t)0x000000FF)
#define | SD_8TO15BITS ((uint32_t)0x0000FF00)
#define | SD_16TO23BITS ((uint32_t)0x00FF0000)
#define | SD_24TO31BITS ((uint32_t)0xFF000000)
#define | SD_MAX_DATA_LENGTH ((uint32_t)0x01FFFFFF)
#define | SD_HALFFIFO ((uint32_t)0x00000008)
#define | SD_HALFFIFOBYTES ((uint32_t)0x00000020)
#define | SD_CCCC_LOCK_UNLOCK ((uint32_t)0x00000080)
#define | SD_CCCC_WRITE_PROT ((uint32_t)0x00000040)
#define | SD_CCCC_ERASE ((uint32_t)0x00000020)
#define | SDIO_SEND_IF_COND ((uint32_t)0x00000008)
#define | EXT_CSD_Command_set 0x0
#define | EXT_CSD_Set_bit 0x1
#define | EXT_CSD_Clear_byte 0x2
#define | EXT_CSD_Write_byte 0x3
#define | EXT_CSD_CMD_SET_NORMAL (1<<0)
#define | EXT_CSD_CMD_SET_SECURE (1<<1)
#define | EXT_CSD_CMD_SET_CPSECURE (1<<2)
#define | EXT_CSD_BUS_WIDTH 183
#define | EXT_CSD_HS_TIMING 185
#define | SDIO_INTR_STS_WRITE_MASK
#define | SDIO_INTR_STS_READ_MASK

Enumerations

enum sd_data_transfer_mode_type { SD_TRANSFER_POLLING_MODE = 0 , SD_TRANSFER_DMA_MODE = 1 }
enum sd_error_status_type {
SD_CMD_FAIL = 1 , SD_DATA_FAIL = 2 , SD_CMD_RSP_TIMEOUT = 3 , SD_DATA_TIMEOUT = 4 ,
SD_TX_UNDERRUN = 5 , SD_RX_OVERRUN = 6 , SD_START_BIT_ERR = 7 , SD_CMD_OUT_OF_RANGE = 8 ,
SD_ADDR_MISALIGNED = 9 , SD_BLK_LEN_ERR = 10 , SD_ERASE_SEQ_ERR = 11 , SD_INVALID_ERASE_PARAM = 12 ,
SD_WR_PROTECT_VIOLATION = 13 , SD_LOCK_UNLOCK_ERROR = 14 , SD_CMD_CRC_ERROR = 15 , SD_ILLEGAL_CMD = 16 ,
SD_CARD_ECC_ERROR = 17 , SD_CARD_CONTROLLER_ERR = 18 , SD_GENERAL_UNKNOWN_ERROR = 19 , SD_STREAM_RD_UNDERRUN = 20 ,
SD_STREAM_WR_OVERRUN = 21 , SD_CID_CSD_OVERWRITE = 22 , SD_WP_ERASE_SKIP = 23 , SD_CARD_ECC_DISABLED = 24 ,
SD_ERASE_RESET = 25 , SD_AKE_SEQ_ERROR = 26 , SD_INVALID_VOLTRANGE = 27 , SD_ADDR_OUT_OF_RANGE = 28 ,
SD_SWITCH_ERROR = 29 , SD_SDIO_DISABLED = 30 , SD_SDIO_FUNC_BUSY = 31 , SD_SDIO_FUNC_ERROR = 32 ,
SD_SDIO_UNKNOWN_FUNC = 33 , SD_INTERNAL_ERROR , SD_NOT_CONFIGURED , SD_REQ_PENDING ,
SD_REQ_NOT_APPLICABLE , SD_INVALID_PARAMETER , SD_UNSUPPORTED_FEATURE , SD_UNSUPPORTED_HW ,
SD_ERROR , SD_OK = 0
}
enum sd_card_state_type {
SD_CARD_READY = ((uint32_t)0x00000001) , SD_CARD_IDENTIFICATION = ((uint32_t)0x00000002) , SD_CARD_STANDBY = ((uint32_t)0x00000003) , SD_CARD_TRANSFER = ((uint32_t)0x00000004) ,
SD_CARD_SENDING = ((uint32_t)0x00000005) , SD_CARD_RECEIVING = ((uint32_t)0x00000006) , SD_CARD_PROGRAMMING = ((uint32_t)0x00000007) , SD_CARD_DISCONNECTED = ((uint32_t)0x00000008) ,
SD_CARD_ERROR = ((uint32_t)0x000000FF)
}
enum sd_memory_card_type {
SDIO_STD_CAPACITY_SD_CARD_V1_1 = 0 , SDIO_STD_CAPACITY_SD_CARD_V2_0 = 1 , SDIO_HIGH_CAPACITY_SD_CARD = 2 , SDIO_MULTIMEDIA_CARD = 3 ,
SDIO_SECURE_DIGITAL_IO_CARD = 4 , SDIO_HIGH_SPEED_MULTIMEDIA_CARD = 5 , SDIO_SECURE_DIGITAL_IO_COMBO_CARD = 6 , SDIO_HIGH_CAPACITY_MMC_CARD = 7 ,
SDIO_SDIO_CARD = 8
}

Functions

sd_error_status_type | sd_init (void)
initializes the sd card and put it into standby state (ready for data transfer).
void | sdio_clock_set (uint32_t clkdiv)
set sdio clock devision factor.
sd_error_status_type | sd_power_on (void)
enquires cards about their operating voltage and configures clock controls.
sd_error_status_type | sd_power_off (void)
turns the sdio output signals off.
sd_error_status_type | sd_card_init (void)
intialises all cards or single card as the case may be card(s) come into standby state.
sd_error_status_type | sd_card_info_get (sd_card_info_struct_type *card_info)
returns information about specific card.
sd_error_status_type | sd_wide_bus_operation_config (sdio_bus_width_type mode)
enable wide bus opeartion for the requeseted card if supported by card.
sd_error_status_type | sd_device_mode_set (uint32_t mode)
set sdio work mode.
sd_error_status_type | sd_deselect_select (uint32_t addr)
selects od deselects the corresponding card.
sd_error_status_type | sd_status_send (uint32_t *p_card_status)
read current card status.
sd_card_state_type | sd_state_get (void)
returns information about sd card.
sd_error_status_type | sd_blocks_erase (long long addr, uint32_t nblks)
erase continuous data block
sd_error_status_type | sd_block_read (uint8_t *buf, long long addr, uint16_t blk_size)
allows to read one block from a specified address in a card. the data transfer can be managed by dma mode or polling mode.
sd_error_status_type | sd_mult_blocks_read (uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks)
allows to read blocks from a specified address in a card. the data transfer can be managed by dma mode or polling mode.
sd_error_status_type | sd_block_write (const uint8_t *buf, long long addr, uint16_t blk_size)
allows to write one block starting from a specified address in a card. the data transfer can be managed by dma mode or polling mode.
sd_error_status_type | sd_mult_blocks_write (const uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks)
allows to write blocks starting from a specified address in a card. the data transfer can be managed by dma mode only.
sd_error_status_type | mmc_stream_read (uint8_t *buf, long long addr, uint32_t len)
read mmc card data stream.
sd_error_status_type | mmc_stream_write (uint8_t *buf, long long addr, uint32_t len)
write mmc card data stream.
sd_error_status_type | sd_irq_service (void)
allows to process all the interrupts that are high.
void | sd_dma_config (uint32_t *mbuf, uint32_t buf_size, dma_dir_type dir)
set dma configuation for sdio

Variables

sd_card_info_struct_type sd_card_info

Detailed Description

this file contains all the functions prototypes for the sd/mmc card at32_sdio driver firmware library.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file sdio_fatfs/inc/at32_sdio.h.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • sdio
  • sdio_fatfs
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • sdio
  • sdio_fatfs
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • sdio
  • sdio_fatfs
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_int.h.


AT32F413 Firmwary Library: ffconf.h File Reference

  • sdio
  • sdio_fatfs
  • inc
Macros
ffconf.h File Reference

Go to the source code of this file.

Macros

#define | FFCONF_DEF 86631 /* Revision ID */
#define | FF_FS_READONLY 0
#define | FF_FS_MINIMIZE 0
#define | FF_USE_FIND 0
#define | FF_USE_MKFS 1
#define | FF_USE_FASTSEEK 1
#define | FF_USE_EXPAND 0
#define | FF_USE_CHMOD 0
#define | FF_USE_LABEL 0
#define | FF_USE_FORWARD 0
#define | FF_USE_STRFUNC 0
#define | FF_PRINT_LLI 0
#define | FF_PRINT_FLOAT 0
#define | FF_STRF_ENCODE 0
#define | FF_CODE_PAGE 932
#define | FF_USE_LFN 0
#define | FF_MAX_LFN 255
#define | FF_LFN_UNICODE 0
#define | FF_LFN_BUF 255
#define | FF_SFN_BUF 12
#define | FF_FS_RPATH 0
#define | FF_VOLUMES 3
#define | FF_STR_VOLUME_ID 0
#define | FF_VOLUME_STRS "RAM","NAND","CF","SD","SD2","USB","USB2","USB3"
#define | FF_MULTI_PARTITION 0
#define | FF_MIN_SS 512
#define | FF_MAX_SS 512
#define | FF_LBA64 0
#define | FF_MIN_GPT 0x10000000
#define | FF_USE_TRIM 0
#define | FF_FS_TINY 0
#define | FF_FS_EXFAT 0
#define | FF_FS_NORTC 1
#define | FF_NORTC_MON 1
#define | FF_NORTC_MDAY 1
#define | FF_NORTC_YEAR 2020
#define | FF_FS_NOFSINFO 0
#define | FF_FS_LOCK 0
#define | FF_FS_REENTRANT 0
#define | FF_FS_TIMEOUT 1000
#define | FF_SYNC_t HANDLE

Macro Definition Documentation

◆ FF_CODE_PAGE

#define FF_CODE_PAGE 932

Definition at line 87 of file ffconf.h.

◆ FF_FS_EXFAT

#define FF_FS_EXFAT 0

Definition at line 234 of file ffconf.h.

◆ FF_FS_LOCK

#define FF_FS_LOCK 0

Definition at line 266 of file ffconf.h.

◆ FF_FS_MINIMIZE

#define FF_FS_MINIMIZE 0

Definition at line 18 of file ffconf.h.

◆ FF_FS_NOFSINFO

#define FF_FS_NOFSINFO 0

Definition at line 254 of file ffconf.h.

◆ FF_FS_NORTC

#define FF_FS_NORTC 1

Definition at line 240 of file ffconf.h.

◆ FF_FS_READONLY

#define FF_FS_READONLY 0

Definition at line 11 of file ffconf.h.

◆ FF_FS_REENTRANT

#define FF_FS_REENTRANT 0

Definition at line 279 of file ffconf.h.

◆ FF_FS_RPATH

#define FF_FS_RPATH 0

Definition at line 156 of file ffconf.h.

◆ FF_FS_TIMEOUT

#define FF_FS_TIMEOUT 1000

Definition at line 280 of file ffconf.h.

◆ FF_FS_TINY

#define FF_FS_TINY 0

Definition at line 227 of file ffconf.h.

◆ FF_LBA64

#define FF_LBA64 0

Definition at line 206 of file ffconf.h.

◆ FF_LFN_BUF

#define FF_LFN_BUF 255

Definition at line 148 of file ffconf.h.

◆ FF_LFN_UNICODE

#define FF_LFN_UNICODE 0

Definition at line 136 of file ffconf.h.

◆ FF_MAX_LFN

#define FF_MAX_LFN 255

Definition at line 117 of file ffconf.h.

◆ FF_MAX_SS

#define FF_MAX_SS 512

Definition at line 197 of file ffconf.h.

◆ FF_MIN_GPT

#define FF_MIN_GPT 0x10000000

Definition at line 211 of file ffconf.h.

◆ FF_MIN_SS

#define FF_MIN_SS 512

Definition at line 196 of file ffconf.h.

◆ FF_MULTI_PARTITION

#define FF_MULTI_PARTITION 0

Definition at line 187 of file ffconf.h.

◆ FF_NORTC_MDAY

#define FF_NORTC_MDAY 1

Definition at line 242 of file ffconf.h.

◆ FF_NORTC_MON

#define FF_NORTC_MON 1

Definition at line 241 of file ffconf.h.

◆ FF_NORTC_YEAR

#define FF_NORTC_YEAR 2020

Definition at line 243 of file ffconf.h.

◆ FF_PRINT_FLOAT

#define FF_PRINT_FLOAT 0

Definition at line 61 of file ffconf.h.

◆ FF_PRINT_LLI

#define FF_PRINT_LLI 0

Definition at line 60 of file ffconf.h.

◆ FF_SFN_BUF

#define FF_SFN_BUF 12

Definition at line 149 of file ffconf.h.

◆ FF_STR_VOLUME_ID

#define FF_STR_VOLUME_ID 0

Definition at line 173 of file ffconf.h.

◆ FF_STRF_ENCODE

#define FF_STRF_ENCODE 0

Definition at line 62 of file ffconf.h.

◆ FF_SYNC_t

#define FF_SYNC_t HANDLE

Definition at line 281 of file ffconf.h.

◆ FF_USE_CHMOD

#define FF_USE_CHMOD 0

Definition at line 45 of file ffconf.h.

◆ FF_USE_EXPAND

#define FF_USE_EXPAND 0

Definition at line 41 of file ffconf.h.

◆ FF_USE_FASTSEEK

#define FF_USE_FASTSEEK 1

Definition at line 37 of file ffconf.h.

◆ FF_USE_FIND

#define FF_USE_FIND 0

Definition at line 28 of file ffconf.h.

◆ FF_USE_FORWARD

#define FF_USE_FORWARD 0

Definition at line 55 of file ffconf.h.

◆ FF_USE_LABEL

#define FF_USE_LABEL 0

Definition at line 50 of file ffconf.h.

◆ FF_USE_LFN

#define FF_USE_LFN 0

Definition at line 116 of file ffconf.h.

◆ FF_USE_MKFS

#define FF_USE_MKFS 1

Definition at line 33 of file ffconf.h.

◆ FF_USE_STRFUNC

#define FF_USE_STRFUNC 0

Definition at line 59 of file ffconf.h.

◆ FF_USE_TRIM

#define FF_USE_TRIM 0

Definition at line 216 of file ffconf.h.

◆ FF_VOLUME_STRS

#define FF_VOLUME_STRS "RAM","NAND","CF","SD","SD2","USB","USB2","USB3"

Definition at line 174 of file ffconf.h.

◆ FF_VOLUMES

#define FF_VOLUMES 3

Definition at line 169 of file ffconf.h.

◆ FFCONF_DEF

#define FFCONF_DEF 86631 /* Revision ID */

Definition at line 5 of file ffconf.h.


AT32F413 Firmwary Library: src Directory Reference

  • sdio
  • sdio_fatfs
  • src
src Directory Reference

Files

at32_sdio.c
this file provides a set of functions needed to manage the sdio/mmc card memory.
at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
diskio.c
main.c
main program


AT32F413 Firmwary Library: at32_sdio.c File Reference

  • sdio
  • sdio_fatfs
  • src
Functions | Variables
at32_sdio.c File Reference

this file provides a set of functions needed to manage the sdio/mmc card memory. More...

#include <string.h>
#include "at32_sdio.h"
#include "at32f413_board.h"

Go to the source code of this file.

Functions

sd_error_status_type | command_error (void)
checks for error conditions for cmd0.
sd_error_status_type | command_rsp1_error (uint8_t cmd)
checks for error conditions for R1 response.
sd_error_status_type | command_rsp2_error (void)
checks for error conditions for R2 (cid or csd) response.
sd_error_status_type | command_rsp3_error (void)
checks for error conditions for R3 (ocr) response.
sd_error_status_type | command_rsp4_error (uint8_t cmd)
checks for error conditions for r4 response.
sd_error_status_type | command_rsp5_error (uint8_t cmd)
checks for error conditions for r5 response.
sd_error_status_type | command_rsp6_error (uint8_t cmd, uint16_t *prca)
checks for error conditions for r6 (rca) response.
sd_error_status_type | command_rsp7_error (void)
checks for error conditions for R7 response.
sd_error_status_type | sd_bus_wide_enable (confirm_state new_state)
enable or disable the sdio wide bus mode.
sd_error_status_type | mmc_switch (uint8_t set, uint8_t index, uint8_t value)
switch mmc card speed to high speed
sd_error_status_type | sd_switch (uint32_t mode, uint32_t group, uint8_t value, uint8_t *rsp)
switch sd card speed to high speed
sd_error_status_type | check_card_programming (uint8_t *p_status)
checks if the sd card is in programming state.
sd_error_status_type | speed_change (uint8_t speed)
set bus speed
sd_error_status_type | get_ext_csd (void)
find the sd card ext csd register value.
sd_error_status_type | scr_find (void)
find the sd card scr register value.
uint8_t | convert_from_bytes_to_power_of_two (uint16_t number_of_bytes)
converts the number of bytes in power of two and returns the power.
sd_error_status_type | sd_init (void)
initializes the sd card and put it into standby state (ready for data transfer).
void | sdio_clock_set (uint32_t clk_div)
set sdio clock devision factor.
sd_error_status_type | sd_power_on (void)
enquires cards about their operating voltage and configures clock controls.
sd_error_status_type | sd_power_off (void)
turns the sdio output signals off.
sd_error_status_type | sd_card_init (void)
intialises all cards or single card as the case may be card(s) come into standby state.
sd_error_status_type | sd_card_info_get (sd_card_info_struct_type *card_info)
returns information about specific card.
sd_error_status_type | sd_wide_bus_operation_config (sdio_bus_width_type mode)
enable wide bus opeartion for the requeseted card if supported by card.
sd_error_status_type | sd_device_mode_set (uint32_t mode)
set sdio work mode.
sd_error_status_type | sd_deselect_select (uint32_t addr)
selects od deselects the corresponding card.
sd_error_status_type | sdio_command_data_send (sdio_command_struct_type *sdio_cmd_init_t, sdio_data_struct_type *sdio_data_init_t, uint32_t *buf)
read data from or write data to sd card.
sd_error_status_type | sd_blocks_erase (long long addr, uint32_t nblks)
erase continuous data block
sd_error_status_type | sd_block_read (uint8_t *buf, long long addr, uint16_t blk_size)
allows to read one block from a specified address in a card. the data transfer can be managed by dma mode or polling mode.
sd_error_status_type | sd_mult_blocks_read (uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks)
allows to read blocks from a specified address in a card. the data transfer can be managed by dma mode or polling mode.
sd_error_status_type | sd_block_write (const uint8_t *buf, long long addr, uint16_t blk_size)
allows to write one block starting from a specified address in a card. the data transfer can be managed by dma mode or polling mode.
sd_error_status_type | sd_mult_blocks_write (const uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks)
allows to write blocks starting from a specified address in a card. the data transfer can be managed by dma mode only.
sd_error_status_type | mmc_stream_read (uint8_t *buf, long long addr, uint32_t len)
read mmc card data stream.
sd_error_status_type | mmc_stream_write (uint8_t *buf, long long addr, uint32_t len)
write mmc card data stream.
void | SDIO1_IRQHandler (void)
sdio1 isr.
void | SDIO2_IRQHandler (void)
sdio2 isr.
sd_error_status_type | sd_irq_service (void)
allows to process all the interrupts that are high.
sd_error_status_type | sd_status_send (uint32_t *p_card_status)
read current card status.
sd_card_state_type | sd_state_get (void)
returns information about sd card.
void | sd_dma_config (uint32_t *mbuf, uint32_t buf_size, dma_dir_type dir)
set dma configuation for sdio

Variables

sdio_command_struct_type sdio_command_init_struct
sdio_data_struct_type sdio_data_init_struct
static sd_memory_card_type | card_type = SDIO_STD_CAPACITY_SD_CARD_V1_1
static uint32_t | csd_table [4]
static uint32_t | cid_table [4]
static uint32_t | rca = 0
static uint32_t | ext_csd_table [128]
static sd_data_transfer_mode_type | device_mode = SD_TRANSFER_POLLING_MODE
static uint8_t | stop_flag = 0
volatile sd_error_status_type | transfer_error = SD_OK
volatile uint8_t | transfer_end = 0
sd_card_info_struct_type sd_card_info

Detailed Description

this file provides a set of functions needed to manage the sdio/mmc card memory.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file sdio_fatfs/src/at32_sdio.c.


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • sdio
  • sdio_fatfs
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/sdio/sdio_fatfs/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/sdio/sdio_fatfs/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • sdio
  • sdio_fatfs
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/sdio/sdio_fatfs/src/at32f413_int.c.


AT32F413 Firmwary Library: diskio.c File Reference

  • sdio
  • sdio_fatfs
  • src
Macros | Functions | Variables
diskio.c File Reference
#include "ff.h"
#include "diskio.h"
#include <string.h>
#include "at32_sdio.h"

Go to the source code of this file.

Macros

#define | DEV_RAM 0 /* Example: Map Ramdisk to physical drive 0 */
#define | DEV_MMC 1 /* Example: Map MMC/SD card to physical drive 1 */
#define | DEV_USB 2 /* Example: Map USB MSD to physical drive 2 */

Functions

sd_error_status_type | sd_read_disk (uint8_t *buf, uint32_t sector, uint8_t cnt)
read sd card sector
sd_error_status_type | sd_write_disk (const uint8_t *buf, uint32_t sector, uint8_t cnt)
write sd card sector
DSTATUS | disk_status (BYTE pdrv)
DSTATUS | disk_initialize (BYTE pdrv)
DRESULT | disk_read (BYTE pdrv, BYTE *buff, LBA_t sector, UINT count)
DRESULT | disk_write (BYTE pdrv, const BYTE *buff, LBA_t sector, UINT count)
DRESULT | disk_ioctl (BYTE pdrv, BYTE cmd, void *buff)

Variables

ALIGNED_HEAD uint8_t sdio_data_buffer[512] ALIGNED_TAIL

Macro Definition Documentation

◆ DEV_MMC

#define DEV_MMC 1 /* Example: Map MMC/SD card to physical drive 1 */

Definition at line 19 of file diskio.c.

Referenced by disk_initialize(), disk_ioctl(), disk_read(), disk_status(), and disk_write().

◆ DEV_RAM

#define DEV_RAM 0 /* Example: Map Ramdisk to physical drive 0 */

Definition at line 18 of file diskio.c.

Referenced by disk_initialize(), disk_ioctl(), disk_read(), disk_status(), and disk_write().

◆ DEV_USB

#define DEV_USB 2 /* Example: Map USB MSD to physical drive 2 */

Definition at line 20 of file diskio.c.

Referenced by disk_initialize(), disk_ioctl(), disk_read(), disk_status(), and disk_write().

Function Documentation

◆ disk_initialize()

DSTATUS disk_initialize ( BYTE pdrv )

Definition at line 144 of file diskio.c.

◆ disk_ioctl()

DRESULT disk_ioctl | ( | BYTE | pdrv,
 |  | BYTE | cmd,
 |  | void * | buff )

Definition at line 248 of file diskio.c.

◆ disk_read()

DRESULT disk_read | ( | BYTE | pdrv,
 |  | BYTE * | buff,
 |  | LBA_t | sector,
 |  | UINT | count )

Definition at line 175 of file diskio.c.

◆ disk_status()

DSTATUS disk_status ( BYTE pdrv )

Definition at line 113 of file diskio.c.

◆ disk_write()

DRESULT disk_write | ( | BYTE | pdrv,
 |  | const BYTE * | buff,
 |  | LBA_t | sector,
 |  | UINT | count )

Definition at line 212 of file diskio.c.

◆ sd_read_disk()

sd_error_status_type sd_read_disk | ( | uint8_t * | buf,
 |  | uint32_t | sector,
 |  | uint8_t | cnt )

read sd card sector

Parameters
buf | read data buf
sector | sector address
cnt | sector count
Return values
sd_error_status_type sd card error code.

Definition at line 37 of file diskio.c.

Referenced by disk_read().

◆ sd_write_disk()

sd_error_status_type sd_write_disk | ( | const uint8_t * | buf,
 |  | uint32_t | sector,
 |  | uint8_t | cnt )

write sd card sector

Parameters
buf | write data buf
sector | sector address
cnt | sector count
Return values
sd_error_status_type sd card error code.

Definition at line 77 of file diskio.c.

Referenced by disk_write().


AT32F413 Firmwary Library: main.c File Reference

  • sdio
  • sdio_fatfs
  • src
Functions | Variables
main.c File Reference

main program More...

#include <stdbool.h>
#include <string.h>
#include "at32_sdio.h"
#include "at32f413_board.h"
#include "at32f413_clock.h"
#include "ff.h"

Go to the source code of this file.

Functions

uint8_t | buffer_compare (uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t buffer_length)
compares two buffers.
static void | sd_test_error (void)
led2 on off every 300ms for sd test failed.
static void | nvic_configuration (void)
configures sdio1 irq channel.
static error_status | fatfs_test (void)
fatfs file read/write test.
int | main (void)
main function.

Variables

FATFS | fs
FIL | file
BYTE | work [FF_MAX_SS]

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/sdio/sdio_fatfs/src/main.c.


AT32F413 Firmwary Library: spi Directory Reference

  • spi
spi Directory Reference

Directories

crc_transfer_polling
fullduplex_dma_jtagpin
fullduplex_polling
halfduplex_dma_jtagpin
halfduplex_interrupt
halfduplex_transceiver_switch
only_receive_mode_polling
w25q_flash


AT32F413 Firmwary Library: crc_transfer_polling Directory Reference

  • spi
  • crc_transfer_polling
crc_transfer_polling Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • spi
  • crc_transfer_polling
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • spi
  • crc_transfer_polling
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • spi
  • crc_transfer_polling
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • spi
  • crc_transfer_polling
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • spi
  • crc_transfer_polling
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • spi
  • crc_transfer_polling
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/crc_transfer_polling/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/spi/crc_transfer_polling/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • spi
  • crc_transfer_polling
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"
#include "at32f413_board.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/crc_transfer_polling/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • spi
  • crc_transfer_polling
  • src
Macros | Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include <stdio.h>

Go to the source code of this file.

Macros

#define | SPI_MASTER_CS_HIGH gpio_bits_set(GPIOA, GPIO_PINS_4)
#define | SPI_MASTER_CS_LOW gpio_bits_reset(GPIOA, GPIO_PINS_4)
#define | BUFFER_SIZE 32

Functions

error_status | buffer_compare (uint16_t *pbuffer1, uint16_t *pbuffer2, uint16_t buffer_length)
buffer compare function.
static void | spi_config (void)
spi configuration.
static void | gpio_config (void)
gpio configuration.
int | main (void)
main function.

Variables

uint16_t | spi1_tx_buffer [32]
uint16_t | spi2_tx_buffer [32]
uint16_t | spi1_rx_buffer [32]
uint16_t | spi2_rx_buffer [32]
uint32_t | tx_index = 0
uint32_t | rx_index = 0
__IO uint16_t | crc1_value = 0
__IO uint16_t | crc2_value = 0
volatile error_status | transfer_status1 = ERROR
volatile error_status | transfer_status2 = ERROR

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c.


AT32F413 Firmwary Library: fullduplex_dma_jtagpin Directory Reference

  • spi
  • fullduplex_dma_jtagpin
fullduplex_dma_jtagpin Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • spi
  • fullduplex_dma_jtagpin
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • spi
  • fullduplex_dma_jtagpin
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • spi
  • fullduplex_dma_jtagpin
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • spi
  • fullduplex_dma_jtagpin
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • spi
  • fullduplex_dma_jtagpin
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • spi
  • fullduplex_dma_jtagpin
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • spi
  • fullduplex_dma_jtagpin
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"
#include "at32f413_board.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • spi
  • fullduplex_dma_jtagpin
  • src
Macros | Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Macros

#define | SPI_MASTER_CS_HIGH gpio_bits_set(GPIOA, GPIO_PINS_15)
#define | SPI_MASTER_CS_LOW gpio_bits_reset(GPIOA, GPIO_PINS_15)
#define | BUFFER_SIZE 32

Functions

error_status | buffer_compare (uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t bufferlength)
buffer compare function.
static void | dma_config (void)
dma configuration.
static void | spi_config (void)
spi configuration.
static void | gpio_config (void)
gpio configuration.
int | main (void)
main function.

Variables

spi_init_type spi_init_struct
uint8_t | spi1_tx_buffer [32]
uint8_t | spi2_tx_buffer [32]
uint8_t | spi1_rx_buffer [32]
uint8_t | spi2_rx_buffer [32]
volatile error_status | transfer_status1 = ERROR
volatile error_status | transfer_status2 = ERROR

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c.


AT32F413 Firmwary Library: fullduplex_polling Directory Reference

  • spi
  • fullduplex_polling
fullduplex_polling Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • spi
  • fullduplex_polling
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • spi
  • fullduplex_polling
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • spi
  • fullduplex_polling
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • spi
  • fullduplex_polling
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • spi
  • fullduplex_polling
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • spi
  • fullduplex_polling
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/fullduplex_polling/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/spi/fullduplex_polling/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • spi
  • fullduplex_polling
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"
#include "at32f413_board.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/fullduplex_polling/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • spi
  • fullduplex_polling
  • src
Macros | Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include <stdio.h>

Go to the source code of this file.

Macros

#define | SPI1_AS_MASTER_CS_HIGH gpio_bits_set(GPIOA, GPIO_PINS_4)
#define | SPI1_AS_MASTER_CS_LOW gpio_bits_reset(GPIOA, GPIO_PINS_4)
#define | SPI2_AS_MASTER_CS_HIGH gpio_bits_set(GPIOB, GPIO_PINS_12)
#define | SPI2_AS_MASTER_CS_LOW gpio_bits_reset(GPIOB, GPIO_PINS_12)
#define | BUFFER_SIZE 32

Functions

error_status | buffer_compare (uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t bufferlength)
buffer compare function.
static void | spi_config (void)
spi configuration.
static void | gpio_config (uint16_t spi1_mode, uint16_t spi2_mode)
gpio configuration.
int | main (void)
main function.

Variables

spi_init_type spi_init_struct
uint8_t | spi1_tx_buffer [32]
uint8_t | spi2_tx_buffer [32]
uint8_t | spi1_rx_buffer [32]
uint8_t | spi2_rx_buffer [32]
uint32_t | tx_index = 0
uint32_t | rx_index = 0
volatile error_status | transfer_status1 = ERROR
volatile error_status | transfer_status2 = ERROR
volatile error_status | transfer_status3 = ERROR
volatile error_status | transfer_status4 = ERROR

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/fullduplex_polling/src/main.c.


AT32F413 Firmwary Library: halfduplex_dma_jtagpin Directory Reference

  • spi
  • halfduplex_dma_jtagpin
halfduplex_dma_jtagpin Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • spi
  • halfduplex_dma_jtagpin
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • spi
  • halfduplex_dma_jtagpin
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • spi
  • halfduplex_dma_jtagpin
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • spi
  • halfduplex_dma_jtagpin
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • spi
  • halfduplex_dma_jtagpin
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • spi
  • halfduplex_dma_jtagpin
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • spi
  • halfduplex_dma_jtagpin
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"
#include "at32f413_board.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • spi
  • halfduplex_dma_jtagpin
  • src
Macros | Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Macros

#define | SPI_MASTER_CS_HIGH gpio_bits_set(GPIOA, GPIO_PINS_15)
#define | SPI_MASTER_CS_LOW gpio_bits_reset(GPIOA, GPIO_PINS_15)
#define | BUFFER_SIZE 32

Functions

error_status | buffer_compare (uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t bufferlength)
buffer compare function.
static void | dma_config (void)
dma configuration.
static void | spi_config (void)
spi configuration.
static void | gpio_config (void)
gpio configuration.
int | main (void)
main function.

Variables

spi_init_type spi_init_struct
uint8_t | spi1_tx_buffer [32]
uint8_t | spi2_rx_buffer [32]
volatile error_status | transfer_status = ERROR

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c.


AT32F413 Firmwary Library: halfduplex_interrupt Directory Reference

  • spi
  • halfduplex_interrupt
halfduplex_interrupt Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • spi
  • halfduplex_interrupt
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • spi
  • halfduplex_interrupt
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • spi
  • halfduplex_interrupt
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • spi
  • halfduplex_interrupt
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • spi
  • halfduplex_interrupt
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • spi
  • halfduplex_interrupt
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/halfduplex_interrupt/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/spi/halfduplex_interrupt/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • spi
  • halfduplex_interrupt
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/halfduplex_interrupt/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • spi
  • halfduplex_interrupt
  • src
Macros | Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Macros

#define | SPI_MASTER_CS_HIGH gpio_bits_set(GPIOA, GPIO_PINS_4)
#define | SPI_MASTER_CS_LOW gpio_bits_reset(GPIOA, GPIO_PINS_4)
#define | BUFFER_SIZE 32

Functions

error_status | buffer_compare (uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t buffer_length)
buffer compare function.
static void | spi_config (void)
spi configuration.
static void | gpio_config (void)
gpio configuration.
void | SPI1_IRQHandler (void)
spi1 interrupt function
void | SPI2_IRQHandler (void)
spi2 interrupt function
int | main (void)
main function.

Variables

uint8_t | spi1_tx_buffer [32]
uint8_t | spi2_rx_buffer [32]
volatile uint32_t | tx_index = 0
volatile uint32_t | rx_index = 0
volatile error_status | transfer_status = ERROR

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c.


AT32F413 Firmwary Library: halfduplex_transceiver_switch Directory Reference

  • spi
  • halfduplex_transceiver_switch
halfduplex_transceiver_switch Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • spi
  • halfduplex_transceiver_switch
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • spi
  • halfduplex_transceiver_switch
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • spi
  • halfduplex_transceiver_switch
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • spi
  • halfduplex_transceiver_switch
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • spi
  • halfduplex_transceiver_switch
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • spi
  • halfduplex_transceiver_switch
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • spi
  • halfduplex_transceiver_switch
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • spi
  • halfduplex_transceiver_switch
  • src
Macros | Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Macros

#define | SPI_MASTER_CS_HIGH gpio_bits_set(GPIOA, GPIO_PINS_4)
#define | SPI_MASTER_CS_LOW gpio_bits_reset(GPIOA, GPIO_PINS_4)
#define | BUFFER_SIZE 32

Functions

error_status | buffer_compare (uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t buffer_length)
buffer compare function.
static void | spi_config (void)
spi configuration.
static void | gpio_config (void)
gpio configuration.
void | SPI1_IRQHandler (void)
spi1 interrupt function
void | SPI2_IRQHandler (void)
spi2 interrupt function
int | main (void)
main function.

Variables

spi_init_type spi_init_struct
uint8_t | spi1_tx_buffer [32]
uint8_t | spi2_tx_buffer [32]
uint8_t | spi1_rx_buffer [32]
uint8_t | spi2_rx_buffer [32]
volatile uint32_t | tx_index = 0
volatile uint32_t | rx_index = 0
volatile error_status | transfer_status1 = ERROR
volatile error_status | transfer_status2 = ERROR

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c.


AT32F413 Firmwary Library: only_receive_mode_polling Directory Reference

  • spi
  • only_receive_mode_polling
only_receive_mode_polling Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • spi
  • only_receive_mode_polling
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • spi
  • only_receive_mode_polling
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • spi
  • only_receive_mode_polling
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • spi
  • only_receive_mode_polling
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • spi
  • only_receive_mode_polling
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • spi
  • only_receive_mode_polling
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/only_receive_mode_polling/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/spi/only_receive_mode_polling/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • spi
  • only_receive_mode_polling
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"
#include "at32f413_board.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/only_receive_mode_polling/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • spi
  • only_receive_mode_polling
  • src
Macros | Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Macros

#define | SPI_MASTER_CS_HIGH gpio_bits_set(GPIOA, GPIO_PINS_4)
#define | SPI_MASTER_CS_LOW gpio_bits_reset(GPIOA, GPIO_PINS_4)
#define | BUFFER_SIZE 32

Functions

error_status | buffer_compare (uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t buffer_length)
buffer compare function.
static void | spi_config (void)
spi configuration.
static void | gpio_config (void)
gpio configuration.
int | main (void)
main function.

Variables

uint8_t | spi1_tx_buffer [32]
uint8_t | spi2_rx_buffer [32]
uint32_t | tx_index = 0
uint32_t | rx_index = 0
volatile error_status | transfer_status = ERROR

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c.


AT32F413 Firmwary Library: w25q_flash Directory Reference

  • spi
  • w25q_flash
w25q_flash Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • spi
  • w25q_flash
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.
spi_flash.h
header file of spi_flash


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • spi
  • w25q_flash
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • spi
  • w25q_flash
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • spi
  • w25q_flash
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_int.h.


AT32F413 Firmwary Library: spi_flash.h File Reference

  • spi
  • w25q_flash
  • inc
Macros | Functions
spi_flash.h File Reference

header file of spi_flash More...

#include "at32f413.h"

Go to the source code of this file.

Macros

#define | SPI_TRANS_DMA
#define | FLASH_CS_HIGH()
#define | FLASH_CS_LOW()
#define | W25Q80 0xEF13
#define | W25Q16 0xEF14
#define | W25Q32 0xEF15
#define | W25Q64 0xEF16
#define | W25Q128 0xEF17
#define | SPIF_CHIP_SIZE 0x1000000
#define | SPIF_SECTOR_SIZE 4096
#define | SPIF_PAGE_SIZE 256
#define | SPIF_WRITEENABLE 0x06
#define | SPIF_WRITEDISABLE 0x04
#define | SPIF_READSTATUSREG1 0x05
#define | SPIF_WRITESTATUSREG1 0x01
#define | SPIF_READSTATUSREG2 0x35
#define | SPIF_WRITESTATUSREG2 0x31
#define | SPIF_READSTATUSREG3 0x15
#define | SPIF_WRITESTATUSREG3 0x11
#define | SPIF_READDATA 0x03
#define | SPIF_FASTREADDATA 0x0B
#define | SPIF_FASTREADDUAL 0x3B
#define | SPIF_PAGEPROGRAM 0x02
#define | SPIF_BLOCKERASE 0xD8
#define | SPIF_SECTORERASE 0x20
#define | SPIF_CHIPERASE 0xC7
#define | SPIF_POWERDOWN 0xB9
#define | SPIF_RELEASEPOWERDOWN 0xAB
#define | SPIF_DEVICEID 0xAB
#define | SPIF_MANUFACTDEVICEID 0x90
#define | SPIF_JEDECDEVICEID 0x9F
#define | FLASH_SPI_DUMMY_BYTE 0xA5

Functions

void | spiflash_init (void)
spi configuration.
void | spiflash_write (uint8_t *pbuffer, uint32_t write_addr, uint32_t length)
write data to flash
void | spiflash_read (uint8_t *pbuffer, uint32_t read_addr, uint32_t length)
read data from flash
void | spiflash_sector_erase (uint32_t erase_addr)
erase a sector data
void | spiflash_write_nocheck (uint8_t *pbuffer, uint32_t write_addr, uint32_t length)
write data without check
void | spiflash_page_write (uint8_t *pbuffer, uint32_t write_addr, uint32_t length)
write a page data
void | spi_bytes_write (uint8_t *pbuffer, uint32_t length)
write data continuously
void | spi_bytes_read (uint8_t *pbuffer, uint32_t length)
read data continuously
void | spiflash_wait_busy (void)
wait program done
uint8_t | spiflash_read_sr1 (void)
read sr1 register
void | spiflash_write_enable (void)
enable write operation
uint16_t | spiflash_read_id (void)
read device id
uint8_t | spi_byte_write (uint8_t data)
write a byte to flash
uint8_t | spi_byte_read (void)
read a byte to flash

Detailed Description

header file of spi_flash

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file spi_flash.h.


AT32F413 Firmwary Library: src Directory Reference

  • spi
  • w25q_flash
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program
spi_flash.c
spi_flash source code


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • spi
  • w25q_flash
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/w25q_flash/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/spi/w25q_flash/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • spi
  • w25q_flash
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"
#include "at32f413_board.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/w25q_flash/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • spi
  • w25q_flash
  • src
Macros | Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include "spi_flash.h"

Go to the source code of this file.

Macros

#define | FLASH_TEST_ADDR 0x1000
#define | BUF_SIZE 0x256

Functions

void | tx_data_fill (void)
transfer data fill.
error_status | buffer_compare (uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t buffer_length)
buffer compare function.
int | main (void)
main function.

Variables

uint8_t | tx_buffer [0x256]
uint8_t | rx_buffer [0x256]
volatile error_status | transfer_status = ERROR

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/spi/w25q_flash/src/main.c.


AT32F413 Firmwary Library: spi_flash.c File Reference

  • spi
  • w25q_flash
  • src
Functions | Variables
spi_flash.c File Reference

spi_flash source code More...

#include "spi_flash.h"

Go to the source code of this file.

Functions

void | spiflash_init (void)
spi configuration.
void | spiflash_write (uint8_t *pbuffer, uint32_t write_addr, uint32_t length)
write data to flash
void | spiflash_read (uint8_t *pbuffer, uint32_t read_addr, uint32_t length)
read data from flash
void | spiflash_sector_erase (uint32_t erase_addr)
erase a sector data
void | spiflash_write_nocheck (uint8_t *pbuffer, uint32_t write_addr, uint32_t length)
write data without check
void | spiflash_page_write (uint8_t *pbuffer, uint32_t write_addr, uint32_t length)
write a page data
void | spi_bytes_write (uint8_t *pbuffer, uint32_t length)
write data continuously
void | spi_bytes_read (uint8_t *pbuffer, uint32_t length)
read data continuously
void | spiflash_wait_busy (void)
wait program done
uint8_t | spiflash_read_sr1 (void)
read sr1 register
void | spiflash_write_enable (void)
enable write operation
uint16_t | spiflash_read_id (void)
read device id
uint8_t | spi_byte_write (uint8_t data)
write a byte to flash
uint8_t | spi_byte_read (void)
read a byte to flash

Variables

uint8_t spiflash_sector_buf [SPIF_SECTOR_SIZE]

Detailed Description

spi_flash source code

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file spi_flash.c.


AT32F413 Firmwary Library: tmr Directory Reference

  • tmr
tmr Directory Reference

Directories

6_steps
7_pwm_output
cascade_synchro
complementary_signals
dma
dma_burst
encoder_tmr2
external_clock
hall_xor_tmr2
hang_mode
input_capture
oc_high
oc_low
oc_toggle_tmr3
oc_toggle_tmr9
one_cycle
parallel_synchro
pwm_input
pwm_input_dma
pwm_output_simulate
pwm_output_tmr10
pwm_output_tmr3
timer_base
tmr1_synchro
tmr2_32bit


AT32F413 Firmwary Library: 6_steps Directory Reference

  • tmr
  • 6_steps
6_steps Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • tmr
  • 6_steps
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • tmr
  • 6_steps
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/6_steps/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • tmr
  • 6_steps
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • tmr
  • 6_steps
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/6_steps/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • tmr
  • 6_steps
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • tmr
  • 6_steps
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/6_steps/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/tmr/6_steps/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • tmr
  • 6_steps
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/6_steps/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • tmr
  • 6_steps
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void | systick_configuration (void)
configures the systick.
int | main (void)
main function.
void | TMR1_TRG_HALL_TMR11_IRQHandler (void)
this function handles tmr1 trigger and hall interrupts requests.

Variables

gpio_init_type | gpio_init_struct = {0}
tmr_output_config_type tmr_output_struct
tmr_brkdt_config_type | tmr_brkdt_config_struct = {0}
crm_clocks_freq_type | crm_clocks_freq_struct = {0}
__IO uint32_t | step = 1

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/6_steps/src/main.c.


AT32F413 Firmwary Library: 7_pwm_output Directory Reference

  • tmr
  • 7_pwm_output
7_pwm_output Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • tmr
  • 7_pwm_output
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • tmr
  • 7_pwm_output
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • tmr
  • 7_pwm_output
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • tmr
  • 7_pwm_output
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • tmr
  • 7_pwm_output
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • tmr
  • 7_pwm_output
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/7_pwm_output/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/tmr/7_pwm_output/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • tmr
  • 7_pwm_output
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/7_pwm_output/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • tmr
  • 7_pwm_output
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

int main (void)
main function.

Variables

gpio_init_type | gpio_init_struct = {0}
tmr_output_config_type tmr_output_struct
crm_clocks_freq_type | crm_clocks_freq_struct = {0}
uint16_t | timer_period = 0
uint16_t | channel1_pulse = 0
uint16_t | channel2_pulse = 0
uint16_t | channel3_pulse = 0
uint16_t | channel4_pulse = 0

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/7_pwm_output/src/main.c.


AT32F413 Firmwary Library: cascade_synchro Directory Reference

  • tmr
  • cascade_synchro
cascade_synchro Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • tmr
  • cascade_synchro
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • tmr
  • cascade_synchro
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • tmr
  • cascade_synchro
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • tmr
  • cascade_synchro
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • tmr
  • cascade_synchro
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • tmr
  • cascade_synchro
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/cascade_synchro/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/tmr/cascade_synchro/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • tmr
  • cascade_synchro
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/cascade_synchro/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • tmr
  • cascade_synchro
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

int main (void)
main function.

Variables

gpio_init_type gpio_init_struct = {0}
tmr_output_config_type tmr_output_struct

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/cascade_synchro/src/main.c.


AT32F413 Firmwary Library: complementary_signals Directory Reference

  • tmr
  • complementary_signals
complementary_signals Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • tmr
  • complementary_signals
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • tmr
  • complementary_signals
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • tmr
  • complementary_signals
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • tmr
  • complementary_signals
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • tmr
  • complementary_signals
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • tmr
  • complementary_signals
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/complementary_signals/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/tmr/complementary_signals/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • tmr
  • complementary_signals
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/complementary_signals/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • tmr
  • complementary_signals
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

int main (void)
main function.

Variables

gpio_init_type | gpio_init_struct = {0}
tmr_output_config_type tmr_output_struct
crm_clocks_freq_type | crm_clocks_freq_struct = {0}
tmr_brkdt_config_type | tmr_brkdt_config_struct = {0}
uint16_t | timer_period = 0
uint16_t | channel1_pulse = 0
uint16_t | channel2_pulse = 0
uint16_t | channel3_pulse = 0

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/complementary_signals/src/main.c.


AT32F413 Firmwary Library: dma Directory Reference

  • tmr
  • dma
dma Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • tmr
  • dma
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • tmr
  • dma
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/dma/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • tmr
  • dma
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • tmr
  • dma
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/dma/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • tmr
  • dma
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • tmr
  • dma
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/dma/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/tmr/dma/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • tmr
  • dma
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/dma/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • tmr
  • dma
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

int main (void)
main function.

Variables

gpio_init_type | gpio_init_struct = {0}
tmr_output_config_type tmr_output_struct
dma_init_type | dma_init_struct = {0}
crm_clocks_freq_type | crm_clocks_freq_struct = {0}
uint16_t | timer_period = 0
uint16_t | src_buffer [3] = {0, 0, 0}

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/dma/src/main.c.


AT32F413 Firmwary Library: dma_burst Directory Reference

  • tmr
  • dma_burst
dma_burst Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • tmr
  • dma_burst
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • tmr
  • dma_burst
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • tmr
  • dma_burst
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • tmr
  • dma_burst
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • tmr
  • dma_burst
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • tmr
  • dma_burst
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/dma_burst/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/tmr/dma_burst/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • tmr
  • dma_burst
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/dma_burst/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • tmr
  • dma_burst
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

int main (void)
main function.

Variables

gpio_init_type | gpio_init_struct = {0}
tmr_output_config_type tmr_output_struct
dma_init_type | dma_init_struct = {0}
crm_clocks_freq_type | crm_clocks_freq_struct = {0}
uint16_t | timer_period = 0
uint16_t | src_buffer [3] = {0x0FFF, 0x0000, 0x0555}

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/dma_burst/src/main.c.


AT32F413 Firmwary Library: encoder_tmr2 Directory Reference

  • tmr
  • encoder_tmr2
encoder_tmr2 Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • tmr
  • encoder_tmr2
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • tmr
  • encoder_tmr2
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • tmr
  • encoder_tmr2
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • tmr
  • encoder_tmr2
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • tmr
  • encoder_tmr2
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • tmr
  • encoder_tmr2
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/encoder_tmr2/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/tmr/encoder_tmr2/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • tmr
  • encoder_tmr2
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/encoder_tmr2/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • tmr
  • encoder_tmr2
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void | delay (uint32_t time)
delay function
int | main (void)
main function.

Variables

gpio_init_type | gpio_init_struct = {0}
crm_clocks_freq_type | crm_clocks_freq_struct = {0}
uint32_t | counter

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/encoder_tmr2/src/main.c.


AT32F413 Firmwary Library: external_clock Directory Reference

  • tmr
  • external_clock
external_clock Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • tmr
  • external_clock
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • tmr
  • external_clock
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/external_clock/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • tmr
  • external_clock
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • tmr
  • external_clock
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/external_clock/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • tmr
  • external_clock
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • tmr
  • external_clock
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/external_clock/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/tmr/external_clock/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • tmr
  • external_clock
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/external_clock/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • tmr
  • external_clock
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

int main (void)
main function.

Variables

gpio_init_type | gpio_init_struct = {0}
crm_clocks_freq_type | crm_clocks_freq_struct = {0}
tmr_output_config_type tmr_output_struct
tmr_input_config_type tmr_input_config_struct

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/external_clock/src/main.c.


AT32F413 Firmwary Library: hall_xor_tmr2 Directory Reference

  • tmr
  • hall_xor_tmr2
hall_xor_tmr2 Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • tmr
  • hall_xor_tmr2
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • tmr
  • hall_xor_tmr2
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • tmr
  • hall_xor_tmr2
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • tmr
  • hall_xor_tmr2
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • tmr
  • hall_xor_tmr2
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • tmr
  • hall_xor_tmr2
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/hall_xor_tmr2/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/tmr/hall_xor_tmr2/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • tmr
  • hall_xor_tmr2
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/hall_xor_tmr2/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • tmr
  • hall_xor_tmr2
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

int | main (void)
main function.
void | TMR2_GLOBAL_IRQHandler (void)
this function handles TMR2 trigger exception.

Variables

gpio_init_type | gpio_init_struct = {0}
crm_clocks_freq_type | crm_clocks_freq_struct = {0}
tmr_output_config_type tmr_output_struct
tmr_input_config_type tmr_input_config_struct

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/hall_xor_tmr2/src/main.c.


AT32F413 Firmwary Library: hang_mode Directory Reference

  • tmr
  • hang_mode
hang_mode Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • tmr
  • hang_mode
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • tmr
  • hang_mode
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • tmr
  • hang_mode
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • tmr
  • hang_mode
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • tmr
  • hang_mode
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • tmr
  • hang_mode
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/hang_mode/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/tmr/hang_mode/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • tmr
  • hang_mode
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/hang_mode/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • tmr
  • hang_mode
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

int main (void)
main function.

Variables

gpio_init_type | gpio_init_struct = {0}
crm_clocks_freq_type | crm_clocks_freq_struct = {0}
tmr_output_config_type tmr_output_struct
tmr_input_config_type tmr_input_config_struct

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/hang_mode/src/main.c.


AT32F413 Firmwary Library: input_capture Directory Reference

  • tmr
  • input_capture
input_capture Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • tmr
  • input_capture
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • tmr
  • input_capture
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/input_capture/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • tmr
  • input_capture
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • tmr
  • input_capture
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/input_capture/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • tmr
  • input_capture
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • tmr
  • input_capture
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/input_capture/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/tmr/input_capture/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • tmr
  • input_capture
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/input_capture/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • tmr
  • input_capture
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void | uart_init (uint32_t baudrate)
init usart.
void | TMR3_GLOBAL_IRQHandler (void)
this function handles tmr3 trigger exception.
int | main (void)
main function.

Variables

gpio_init_type | gpio_init_struct = {0}
crm_clocks_freq_type | crm_clocks_freq_struct = {0}
tmr_input_config_type tmr_input_config_struct
__IO uint32_t | tmr3freq = 0
__IO uint32_t | sys_counter = 0
__IO uint16_t | capturenumber = 0
__IO uint16_t | ch3readvalue1 = 0
__IO uint16_t | ch3readvalue2 = 0
__IO uint32_t | capture = 0

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/input_capture/src/main.c.


AT32F413 Firmwary Library: oc_high Directory Reference

  • tmr
  • oc_high
oc_high Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • tmr
  • oc_high
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • tmr
  • oc_high
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/oc_high/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • tmr
  • oc_high
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • tmr
  • oc_high
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/oc_high/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • tmr
  • oc_high
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • tmr
  • oc_high
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/oc_high/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/tmr/oc_high/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • tmr
  • oc_high
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | TMR2_GLOBAL_IRQHandler (void)
this function handles tmr2 global interrupt request.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/oc_high/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • tmr
  • oc_high
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void | gpio_configuration (void)
configure the gpioc pins.
int | main (void)
main function.

Variables

tmr_output_config_type tmr_oc_init_structure
crm_clocks_freq_type | crm_clocks_freq_struct = {0}
uint16_t | ch1_val = 1000
uint16_t | ch2_val = 500
uint16_t | ch3_val = 250
uint16_t | ch4_val = 125
uint16_t | div_value = 0

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/oc_high/src/main.c.


AT32F413 Firmwary Library: oc_low Directory Reference

  • tmr
  • oc_low
oc_low Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • tmr
  • oc_low
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • tmr
  • oc_low
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/oc_low/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • tmr
  • oc_low
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • tmr
  • oc_low
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/oc_low/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • tmr
  • oc_low
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • tmr
  • oc_low
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/oc_low/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/tmr/oc_low/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • tmr
  • oc_low
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | TMR2_GLOBAL_IRQHandler (void)
this function handles tmr2 global interrupt request.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/oc_low/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • tmr
  • oc_low
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void | gpio_configuration (void)
configure the gpioc pins.
int | main (void)
main function.

Variables

tmr_output_config_type tmr_oc_init_structure
uint16_t | ch1_val = 1000
uint16_t | ch2_val = 500
uint16_t | ch3_val = 250
uint16_t | ch4_val = 125
uint16_t | div_value = 0

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/oc_low/src/main.c.


AT32F413 Firmwary Library: oc_toggle_tmr3 Directory Reference

  • tmr
  • oc_toggle_tmr3
oc_toggle_tmr3 Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • tmr
  • oc_toggle_tmr3
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • tmr
  • oc_toggle_tmr3
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • tmr
  • oc_toggle_tmr3
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • tmr
  • oc_toggle_tmr3
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • tmr
  • oc_toggle_tmr3
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • tmr
  • oc_toggle_tmr3
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • tmr
  • oc_toggle_tmr3
  • src
Functions | Variables
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | TMR3_GLOBAL_IRQHandler (void)
this function handles tmr3 global interrupt request.

Variables

__IO uint16_t | ch1_val
__IO uint16_t | ch2_val
__IO uint16_t | ch3_val
__IO uint16_t | ch4_val
uint32_t | capture = 0

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • tmr
  • oc_toggle_tmr3
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void | crm_configuration (void)
configures the different peripheral clocks.
void | gpio_configuration (void)
configure the tmr3 pins.
void | nvic_configuration (void)
configures the nested vectored interrupt controller.
int | main (void)
main function.

Variables

tmr_output_config_type tmr_oc_init_structure
__IO uint16_t | ch1_val = 32768
__IO uint16_t | ch2_val = 16384
__IO uint16_t | ch3_val = 8192
__IO uint16_t | ch4_val = 4096
uint16_t | div_value = 0

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/main.c.


AT32F413 Firmwary Library: oc_toggle_tmr9 Directory Reference

  • tmr
  • oc_toggle_tmr9
oc_toggle_tmr9 Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • tmr
  • oc_toggle_tmr9
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • tmr
  • oc_toggle_tmr9
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • tmr
  • oc_toggle_tmr9
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • tmr
  • oc_toggle_tmr9
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • tmr
  • oc_toggle_tmr9
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • tmr
  • oc_toggle_tmr9
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • tmr
  • oc_toggle_tmr9
  • src
Functions | Variables
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | TMR1_BRK_TMR9_IRQHandler (void)
this function handles TMR9 global interrupt request.

Variables

__IO uint16_t | ch1_val
__IO uint16_t | ch2_val
uint16_t | capture = 0

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • tmr
  • oc_toggle_tmr9
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void | crm_configuration (void)
configures the different peripheral clocks.
void | gpio_configuration (void)
configure the tmr9 pins.
void | nvic_configuration (void)
configures the nested vectored interrupt controller.
int | main (void)
main function.

Variables

tmr_output_config_type tmr_oc_init_structure
__IO uint16_t | ch1_val = 32768
__IO uint16_t | ch2_val = 16384
uint16_t | div_value = 0

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/main.c.


AT32F413 Firmwary Library: one_cycle Directory Reference

  • tmr
  • one_cycle
one_cycle Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • tmr
  • one_cycle
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • tmr
  • one_cycle
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • tmr
  • one_cycle
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • tmr
  • one_cycle
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • tmr
  • one_cycle
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • tmr
  • one_cycle
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/one_cycle/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/tmr/one_cycle/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • tmr
  • one_cycle
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/one_cycle/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • tmr
  • one_cycle
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void | crm_configuration (void)
configures the different peripheral clocks.
void | gpio_configuration (void)
configure the tmr3 pins.
int | main (void)
main function.

Variables

tmr_output_config_type tmr_oc_init_structure
tmr_input_config_type tmr_ic_init_structure
uint16_t div_value = 0

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/one_cycle/src/main.c.


AT32F413 Firmwary Library: parallel_synchro Directory Reference

  • tmr
  • parallel_synchro
parallel_synchro Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • tmr
  • parallel_synchro
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • tmr
  • parallel_synchro
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • tmr
  • parallel_synchro
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • tmr
  • parallel_synchro
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • tmr
  • parallel_synchro
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • tmr
  • parallel_synchro
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/parallel_synchro/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/tmr/parallel_synchro/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • tmr
  • parallel_synchro
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/parallel_synchro/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • tmr
  • parallel_synchro
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void | crm_configuration (void)
configures the different peripheral clocks.
void | gpio_configuration (void)
configure the tmr3 pins.
int | main (void)
main function.

Variables

tmr_output_config_type tmr_oc_init_structure

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/parallel_synchro/src/main.c.


AT32F413 Firmwary Library: pwm_input Directory Reference

  • tmr
  • pwm_input
pwm_input Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • tmr
  • pwm_input
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • tmr
  • pwm_input
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • tmr
  • pwm_input
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • tmr
  • pwm_input
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • tmr
  • pwm_input
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • tmr
  • pwm_input
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/pwm_input/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/tmr/pwm_input/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • tmr
  • pwm_input
  • src
Functions | Variables
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | TMR3_GLOBAL_IRQHandler (void)
this function handles tmr3 global interrupt request.

Variables

uint16_t | duty_cycle
uint32_t | frequency
__IO uint16_t | ic2value = 0

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • tmr
  • pwm_input
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void | crm_configuration (void)
configures the different peripheral clocks.
void | gpio_configuration (void)
configure the tmr3 pins.
int | main (void)
main function.

Variables

tmr_input_config_type tmr_ic_init_structure
__IO uint16_t | duty_cycle = 0
__IO uint32_t | frequency = 0

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/pwm_input/src/main.c.


AT32F413 Firmwary Library: pwm_input_dma Directory Reference

  • tmr
  • pwm_input_dma
pwm_input_dma Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • tmr
  • pwm_input_dma
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • tmr
  • pwm_input_dma
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • tmr
  • pwm_input_dma
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • tmr
  • pwm_input_dma
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • tmr
  • pwm_input_dma
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • tmr
  • pwm_input_dma
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/pwm_input_dma/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/tmr/pwm_input_dma/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • tmr
  • pwm_input_dma
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/pwm_input_dma/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • tmr
  • pwm_input_dma
  • src
Macros | Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include "stdio.h"

Go to the source code of this file.

Macros

#define SAMPLING_NUM 1000

Functions

void | crm_configuration (void)
configures the different peripheral clocks.
void | gpio_configuration (void)
configure the tmr1 pins.
void | DMA1_Channel2_IRQHandler (void)
int | main (void)
main function.

Variables

tmr_input_config_type tmr_ic_init_structure
dma_init_type dma_init_structure
__IO uint16_t | buffer_ch1 [1000]
__IO uint16_t | buffer_ch2 [1000]
__IO uint32_t | frequency = 0
__IO float | duty_cycle = 0
uint32_t | freq_result
float | duty_result

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c.


AT32F413 Firmwary Library: pwm_output_simulate Directory Reference

  • tmr
  • pwm_output_simulate
pwm_output_simulate Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • tmr
  • pwm_output_simulate
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • tmr
  • pwm_output_simulate
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • tmr
  • pwm_output_simulate
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • tmr
  • pwm_output_simulate
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • tmr
  • pwm_output_simulate
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • tmr
  • pwm_output_simulate
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • tmr
  • pwm_output_simulate
  • src
Functions | Variables
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | TMR2_GLOBAL_IRQHandler (void)

Variables

__IO uint16_t | ch1_val
__IO uint16_t | ch2_val
__IO uint16_t | ch3_val
__IO uint16_t | ch4_val
uint16_t | capture = 0

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • tmr
  • pwm_output_simulate
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void | crm_configuration (void)
configures the different peripheral clocks.
void | gpio_configuration (void)
configure the tmr1 pins.
int | main (void)
main function.

Variables

tmr_output_config_type tmr_oc_init_structure
uint16_t | ch1_val = 40961
uint16_t | ch2_val = 27309
uint16_t | ch3_val = 13654
uint16_t | ch4_val = 6826
uint16_t | div_value = 0

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/pwm_output_simulate/src/main.c.


AT32F413 Firmwary Library: pwm_output_tmr10 Directory Reference

  • tmr
  • pwm_output_tmr10
pwm_output_tmr10 Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • tmr
  • pwm_output_tmr10
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • tmr
  • pwm_output_tmr10
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • tmr
  • pwm_output_tmr10
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • tmr
  • pwm_output_tmr10
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • tmr
  • pwm_output_tmr10
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • tmr
  • pwm_output_tmr10
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/pwm_output_tmr10/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/tmr/pwm_output_tmr10/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • tmr
  • pwm_output_tmr10
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/pwm_output_tmr10/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • tmr
  • pwm_output_tmr10
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void | crm_configuration (void)
configures the different peripheral clocks.
void | gpio_configuration (void)
configure the tmr1 pins.
int | main (void)
main function.

Variables

tmr_output_config_type tmr_oc_init_structure
uint16_t | ch1_val = 250
uint16_t | div_value = 0

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/pwm_output_tmr10/src/main.c.


AT32F413 Firmwary Library: pwm_output_tmr3 Directory Reference

  • tmr
  • pwm_output_tmr3
pwm_output_tmr3 Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • tmr
  • pwm_output_tmr3
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • tmr
  • pwm_output_tmr3
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • tmr
  • pwm_output_tmr3
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • tmr
  • pwm_output_tmr3
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • tmr
  • pwm_output_tmr3
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • tmr
  • pwm_output_tmr3
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/pwm_output_tmr3/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/tmr/pwm_output_tmr3/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • tmr
  • pwm_output_tmr3
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/pwm_output_tmr3/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • tmr
  • pwm_output_tmr3
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void | crm_configuration (void)
configures the different peripheral clocks.
void | gpio_configuration (void)
configure the tmr3 pins.
int | main (void)
main function.

Variables

tmr_output_config_type tmr_oc_init_structure
uint16_t | ch1_val = 333
uint16_t | ch2_val = 249
uint16_t | ch3_val = 166
uint16_t | ch4_val = 83
uint16_t | div_value = 0

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/pwm_output_tmr3/src/main.c.


AT32F413 Firmwary Library: timer_base Directory Reference

  • tmr
  • timer_base
timer_base Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • tmr
  • timer_base
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • tmr
  • timer_base
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/timer_base/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • tmr
  • timer_base
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • tmr
  • timer_base
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/timer_base/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • tmr
  • timer_base
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • tmr
  • timer_base
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/timer_base/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/tmr/timer_base/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • tmr
  • timer_base
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/timer_base/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • tmr
  • timer_base
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void | clkout_config (void)
void | TMR1_OVF_TMR10_IRQHandler (void)
this function handles timer1 overflow handler.
int | main (void)
main function.

Variables

crm_clocks_freq_type crm_clocks_freq_struct = {0}

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/timer_base/src/main.c.


AT32F413 Firmwary Library: tmr1_synchro Directory Reference

  • tmr
  • tmr1_synchro
tmr1_synchro Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • tmr
  • tmr1_synchro
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • tmr
  • tmr1_synchro
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • tmr
  • tmr1_synchro
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • tmr
  • tmr1_synchro
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • tmr
  • tmr1_synchro
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • tmr
  • tmr1_synchro
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/tmr1_synchro/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/tmr/tmr1_synchro/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • tmr
  • tmr1_synchro
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/tmr1_synchro/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • tmr
  • tmr1_synchro
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void | crm_configuration (void)
configures the different peripheral clocks.
void | gpio_configuration (void)
configure the tmr1 pins.
int | main (void)
main function.

Variables

tmr_output_config_type tmr_oc_init_structure

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/tmr1_synchro/src/main.c.


AT32F413 Firmwary Library: tmr2_32bit Directory Reference

  • tmr
  • tmr2_32bit
tmr2_32bit Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • tmr
  • tmr2_32bit
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • tmr
  • tmr2_32bit
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • tmr
  • tmr2_32bit
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • tmr
  • tmr2_32bit
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • tmr
  • tmr2_32bit
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • tmr
  • tmr2_32bit
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/tmr2_32bit/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/tmr/tmr2_32bit/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • tmr
  • tmr2_32bit
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/tmr2_32bit/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • tmr
  • tmr2_32bit
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void | crm_configuration (void)
configures the different peripheral clocks.
void | gpio_configuration (void)
configure the tmr1 pins.
int | main (void)
main function.

Variables

tmr_output_config_type tmr_oc_init_structure
uint32_t | ch1_val = 0x7FFFF
uint32_t | ch2_val = 0x3FFFF
uint32_t | ch3_val = 0x1FFFF
uint32_t | ch4_val = 0xFFFF

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/tmr/tmr2_32bit/src/main.c.


AT32F413 Firmwary Library: usart Directory Reference

  • usart
usart Directory Reference

Directories

half_duplex
hw_flow_control
idle_detection
interrupt
irda
polling
printf
receiver_mute
rs485
smartcard
synchronous
transfer_by_dma_interrupt
transfer_by_dma_polling


AT32F413 Firmwary Library: half_duplex Directory Reference

  • usart
  • half_duplex
half_duplex Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • usart
  • half_duplex
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • usart
  • half_duplex
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/half_duplex/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • usart
  • half_duplex
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • usart
  • half_duplex
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/half_duplex/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • usart
  • half_duplex
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • usart
  • half_duplex
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/half_duplex/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/usart/half_duplex/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • usart
  • half_duplex
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/half_duplex/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • usart
  • half_duplex
  • src
Macros | Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Macros

#define | COUNTOF(a)
#define | USART2_TX_BUFFER_SIZE (COUNTOF(usart2_tx_buffer) - 1)
#define | USART3_TX_BUFFER_SIZE (COUNTOF(usart3_tx_buffer) - 1)

Functions

void | usart_configuration (void)
config usart
uint8_t | buffer_compare (uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t buffer_length)
compares two buffers.
int | main (void)
main function.

Variables

uint8_t | usart2_tx_buffer [] = "usart half-duplex transfer: usart2 -> usart3"
uint8_t | usart3_tx_buffer [] = "usart half-duplex transfer: usart3 -> usart2"
uint8_t | usart2_rx_buffer [((sizeof(usart3_tx_buffer)/sizeof(*(usart3_tx_buffer))) - 1)]
uint8_t | usart3_rx_buffer [((sizeof(usart2_tx_buffer)/sizeof(*(usart2_tx_buffer))) - 1)]
uint8_t | data_count

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/half_duplex/src/main.c.


AT32F413 Firmwary Library: hw_flow_control Directory Reference

  • usart
  • hw_flow_control
hw_flow_control Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • usart
  • hw_flow_control
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • usart
  • hw_flow_control
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • usart
  • hw_flow_control
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • usart
  • hw_flow_control
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • usart
  • hw_flow_control
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • usart
  • hw_flow_control
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/hw_flow_control/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/usart/hw_flow_control/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • usart
  • hw_flow_control
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/hw_flow_control/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • usart
  • hw_flow_control
  • src
Macros | Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Macros

#define BUFFER_SIZE 16

Functions

void | usart_configuration (void)
config usart
int | main (void)
main function.

Variables

uint8_t | rx_buffer [16]
uint8_t | data_count

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/hw_flow_control/src/main.c.


AT32F413 Firmwary Library: idle_detection Directory Reference

  • usart
  • idle_detection
idle_detection Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • usart
  • idle_detection
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • usart
  • idle_detection
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/idle_detection/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • usart
  • idle_detection
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • usart
  • idle_detection
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/idle_detection/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • usart
  • idle_detection
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • usart
  • idle_detection
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/idle_detection/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/usart/idle_detection/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • usart
  • idle_detection
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"
#include "at32f413_board.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | USART2_IRQHandler (void)
this function handles usart2 handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/idle_detection/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • usart
  • idle_detection
  • src
Functions
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void | usart_configuration (void)
config usart
int | main (void)
main function.

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/idle_detection/src/main.c.


AT32F413 Firmwary Library: interrupt Directory Reference

  • usart
  • interrupt
interrupt Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • usart
  • interrupt
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • usart
  • interrupt
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/interrupt/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • usart
  • interrupt
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • usart
  • interrupt
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/interrupt/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • usart
  • interrupt
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • usart
  • interrupt
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/interrupt/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/usart/interrupt/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • usart
  • interrupt
  • src
Functions | Variables
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | USART2_IRQHandler (void)
this function handles usart2 handler.
void | USART3_IRQHandler (void)
this function handles usart3 handler.

Variables

uint8_t | usart2_tx_buffer []
uint8_t | usart3_tx_buffer []
uint8_t | usart2_rx_buffer []
uint8_t | usart3_rx_buffer []
uint8_t | usart2_tx_counter
uint8_t | usart3_tx_counter
uint8_t | usart2_rx_counter
uint8_t | usart3_rx_counter
uint8_t | usart2_tx_buffer_size
uint8_t | usart3_tx_buffer_size

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • usart
  • interrupt
  • src
Macros | Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Macros

#define | COUNTOF(a)
#define | USART2_TX_BUFFER_SIZE (COUNTOF(usart2_tx_buffer) - 1)
#define | USART3_TX_BUFFER_SIZE (COUNTOF(usart3_tx_buffer) - 1)

Functions

void | usart_configuration (void)
config usart
uint8_t | buffer_compare (uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t buffer_length)
compares two buffers.
int | main (void)
main function.

Variables

uint8_t | usart2_tx_buffer [] = "usart transfer by interrupt: usart2 -> usart3 using interrupt"
uint8_t | usart3_tx_buffer [] = "usart transfer by interrupt: usart3 -> usart2 using interrupt"
uint8_t | usart2_rx_buffer [((sizeof(usart3_tx_buffer)/sizeof(*(usart3_tx_buffer))) - 1)]
uint8_t | usart3_rx_buffer [((sizeof(usart2_tx_buffer)/sizeof(*(usart2_tx_buffer))) - 1)]
volatile uint8_t | usart2_tx_counter = 0x00
volatile uint8_t | usart3_tx_counter = 0x00
volatile uint8_t | usart2_rx_counter = 0x00
volatile uint8_t | usart3_rx_counter = 0x00
uint8_t | usart2_tx_buffer_size = ( (sizeof(usart2_tx_buffer) / sizeof(*(usart2_tx_buffer))) - 1)
uint8_t | usart3_tx_buffer_size = ( (sizeof(usart3_tx_buffer) / sizeof(*(usart3_tx_buffer))) - 1)

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/interrupt/src/main.c.


AT32F413 Firmwary Library: irda Directory Reference

  • usart
  • irda
irda Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • usart
  • irda
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • usart
  • irda
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/irda/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • usart
  • irda
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • usart
  • irda
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/irda/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • usart
  • irda
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • usart
  • irda
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/irda/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/usart/irda/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • usart
  • irda
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/irda/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • usart
  • irda
  • src
Functions
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void | usart_configuration (void)
config usart
int | main (void)
main function.

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/irda/src/main.c.


AT32F413 Firmwary Library: polling Directory Reference

  • usart
  • polling
polling Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • usart
  • polling
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • usart
  • polling
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/polling/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • usart
  • polling
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • usart
  • polling
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/polling/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • usart
  • polling
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • usart
  • polling
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/polling/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/usart/polling/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • usart
  • polling
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/polling/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • usart
  • polling
  • src
Macros | Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Macros

#define | COUNTOF(a)
#define | USART2_TX_BUFFER_SIZE (COUNTOF(usart2_tx_buffer) - 1)
#define | USART3_TX_BUFFER_SIZE (COUNTOF(usart3_tx_buffer) - 1)

Functions

void | usart_configuration (void)
config usart
uint8_t | buffer_compare (uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t buffer_length)
compares two buffers.
int | main (void)
main function.

Variables

uint8_t | usart2_tx_buffer [] = "usart transfer by interrupt: usart2 -> usart3 using interrupt"
uint8_t | usart3_tx_buffer [] = "usart transfer by interrupt: usart3 -> usart2 using interrupt"
uint8_t | usart2_rx_buffer [((sizeof(usart3_tx_buffer)/sizeof(*(usart3_tx_buffer))) - 1)]
uint8_t | usart3_rx_buffer [((sizeof(usart2_tx_buffer)/sizeof(*(usart2_tx_buffer))) - 1)]
uint8_t | usart2_tx_counter = 0x00
uint8_t | usart3_tx_counter = 0x00
uint8_t | usart2_rx_counter = 0x00
uint8_t | usart3_rx_counter = 0x00
uint8_t | usart2_tx_buffer_size = ( (sizeof(usart2_tx_buffer) / sizeof(*(usart2_tx_buffer))) - 1)
uint8_t | usart3_tx_buffer_size = ( (sizeof(usart3_tx_buffer) / sizeof(*(usart3_tx_buffer))) - 1)

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/polling/src/main.c.


AT32F413 Firmwary Library: printf Directory Reference

  • usart
  • printf
printf Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • usart
  • printf
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • usart
  • printf
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/printf/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • usart
  • printf
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • usart
  • printf
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/printf/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • usart
  • printf
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • usart
  • printf
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/printf/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/usart/printf/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • usart
  • printf
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/printf/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • usart
  • printf
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

int main (void)
main function.

Variables

__IO uint32_t time_cnt = 0

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/printf/src/main.c.


AT32F413 Firmwary Library: receiver_mute Directory Reference

  • usart
  • receiver_mute
receiver_mute Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • usart
  • receiver_mute
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • usart
  • receiver_mute
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • usart
  • receiver_mute
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • usart
  • receiver_mute
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • usart
  • receiver_mute
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • usart
  • receiver_mute
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/receiver_mute/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/usart/receiver_mute/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • usart
  • receiver_mute
  • src
Functions | Variables
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | USART3_IRQHandler (void)
this function handles usart3 handler.

Variables

uint8_t | usart3_rx_buffer []
uint8_t | rx_counter

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • usart
  • receiver_mute
  • src
Macros | Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Macros

#define | BUFFER_SIZE 7
#define | MATCH_ID_VAL 0x81
#define | ERROR_ID_VAL 0x82
#define | DATA1_VAL 0x7F
#define | DATA2_VAL 0x7A
#define | DATA3_VAL 0x7B
#define | DATA4_VAL 0x7C

Functions

void | usart_configuration (void)
config usart
int | main (void)
main function.

Variables

uint8_t | usart2_tx_buffer [7] = { 0x7F , 0x81 , 0x7A , 0x82 , 0x7B , 0x81 , 0x7C }
uint8_t | usart3_rx_buffer [7]
uint8_t | tx_counter = 0
uint8_t | rx_counter = 0

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/receiver_mute/src/main.c.


AT32F413 Firmwary Library: rs485 Directory Reference

  • usart
  • rs485
rs485 Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • usart
  • rs485
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • usart
  • rs485
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/rs485/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • usart
  • rs485
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • usart
  • rs485
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/rs485/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • usart
  • rs485
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • usart
  • rs485
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/rs485/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/usart/rs485/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • usart
  • rs485
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/rs485/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • usart
  • rs485
  • src
Macros | Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Macros

#define | RS485_BAUDRATE 9600
#define | RS485_BUFFER_SIZE 128

Functions

static void | rs485_config (void)
rs485 configiguration.
static void | rs485_send_data (u8 *buf, u8 cnt)
rs485 send data
int | main (void)
main function.
void | USART2_IRQHandler (void)
usart2 interrupt handler

Variables

uint8_t | rs485_buffer_rx [128]
uint8_t | rs485_buffer_rx_cnt = 0

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/rs485/src/main.c.


AT32F413 Firmwary Library: smartcard Directory Reference

  • usart
  • smartcard
smartcard Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • usart
  • smartcard
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.
smartcard_config.h
header file of clock program


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • usart
  • smartcard
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/smartcard/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • usart
  • smartcard
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • usart
  • smartcard
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/smartcard/inc/at32f413_int.h.


AT32F413 Firmwary Library: smartcard_config.h File Reference

  • usart
  • smartcard
  • inc
Macros
smartcard_config.h File Reference

header file of clock program More...

Go to the source code of this file.

Macros

#define | SC_USART USART2
#define | SC_USART_CLK CRM_USART2_PERIPH_CLOCK
#define | SC_USART_GPIO_CLK CRM_GPIOA_PERIPH_CLOCK
#define | SC_USART_TX_PIN GPIO_PINS_2
#define | SC_USART_TX_PORT GPIOA
#define | SC_USART_CLK_PIN GPIO_PINS_4
#define | SC_USART_CLK_PORT GPIOA
#define | SC_USART_IRQn USART2_IRQn
#define | SC_USART_IRQHandler USART2_IRQHandler
#define | SC_3_5V_PIN GPIO_PINS_5
#define | SC_RESET_PIN GPIO_PINS_6
#define | SC_CMDVCC_PIN GPIO_PINS_7
#define | SC_OFF_PIN GPIO_PINS_8
#define | SC_3_5V_PORT GPIOA
#define | SC_RESET_PORT GPIOA
#define | SC_CMDVCC_PORT GPIOA
#define | SC_OFF_PORT GPIOA
#define | SC_3_5V_CLK CRM_GPIOA_PERIPH_CLOCK
#define | SC_RESET_CLK CRM_GPIOA_PERIPH_CLOCK
#define | SC_CMDVCC_CLK CRM_GPIOA_PERIPH_CLOCK
#define | SC_OFF_CLK CRM_GPIOA_PERIPH_CLOCK
#define | SC_OFF_EXINT EXINT_LINE_8
#define | SC_OFF_PORTSOURCE GPIO_PORT_SOURCE_GPIOA
#define | SC_OFF_PINSOURCE GPIO_PINS_SOURCE8
#define | SC_OFF_EXINT_IRQ EXINT9_5_IRQn

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file smartcard_config.h.

Macro Definition Documentation

◆ SC_3_5V_CLK

#define SC_3_5V_CLK CRM_GPIOA_PERIPH_CLOCK

Definition at line 54 of file smartcard_config.h.

Referenced by usart_configuration().

◆ SC_3_5V_PIN

#define SC_3_5V_PIN GPIO_PINS_5

Definition at line 46 of file smartcard_config.h.

Referenced by usart_configuration().

◆ SC_3_5V_PORT

#define SC_3_5V_PORT GPIOA

Definition at line 50 of file smartcard_config.h.

Referenced by usart_configuration().

◆ SC_CMDVCC_CLK

#define SC_CMDVCC_CLK CRM_GPIOA_PERIPH_CLOCK

Definition at line 56 of file smartcard_config.h.

Referenced by usart_configuration().

◆ SC_CMDVCC_PIN

#define SC_CMDVCC_PIN GPIO_PINS_7

Definition at line 48 of file smartcard_config.h.

Referenced by EXINT9_5_IRQHandler(), and usart_configuration().

◆ SC_CMDVCC_PORT

#define SC_CMDVCC_PORT GPIOA

Definition at line 52 of file smartcard_config.h.

Referenced by EXINT9_5_IRQHandler(), and usart_configuration().

◆ SC_OFF_CLK

#define SC_OFF_CLK CRM_GPIOA_PERIPH_CLOCK

Definition at line 57 of file smartcard_config.h.

Referenced by usart_configuration().

◆ SC_OFF_EXINT

#define SC_OFF_EXINT EXINT_LINE_8

Definition at line 58 of file smartcard_config.h.

Referenced by EXINT9_5_IRQHandler(), and usart_configuration().

◆ SC_OFF_EXINT_IRQ

#define SC_OFF_EXINT_IRQ EXINT9_5_IRQn

Definition at line 61 of file smartcard_config.h.

Referenced by usart_configuration().

◆ SC_OFF_PIN

#define SC_OFF_PIN GPIO_PINS_8

Definition at line 49 of file smartcard_config.h.

Referenced by usart_configuration().

◆ SC_OFF_PINSOURCE

#define SC_OFF_PINSOURCE GPIO_PINS_SOURCE8

Definition at line 60 of file smartcard_config.h.

Referenced by usart_configuration().

◆ SC_OFF_PORT

#define SC_OFF_PORT GPIOA

Definition at line 53 of file smartcard_config.h.

Referenced by usart_configuration().

◆ SC_OFF_PORTSOURCE

#define SC_OFF_PORTSOURCE GPIO_PORT_SOURCE_GPIOA

Definition at line 59 of file smartcard_config.h.

Referenced by usart_configuration().

◆ SC_RESET_CLK

#define SC_RESET_CLK CRM_GPIOA_PERIPH_CLOCK

Definition at line 55 of file smartcard_config.h.

Referenced by usart_configuration().

◆ SC_RESET_PIN

#define SC_RESET_PIN GPIO_PINS_6

Definition at line 47 of file smartcard_config.h.

Referenced by EXINT9_5_IRQHandler(), and usart_configuration().

◆ SC_RESET_PORT

#define SC_RESET_PORT GPIOA

Definition at line 51 of file smartcard_config.h.

Referenced by EXINT9_5_IRQHandler(), and usart_configuration().

◆ SC_USART

#define SC_USART USART2

Definition at line 35 of file smartcard_config.h.

Referenced by main(), USART2_IRQHandler(), and usart_configuration().

◆ SC_USART_CLK

#define SC_USART_CLK CRM_USART2_PERIPH_CLOCK

Definition at line 36 of file smartcard_config.h.

Referenced by usart_configuration().

◆ SC_USART_CLK_PIN

#define SC_USART_CLK_PIN GPIO_PINS_4

Definition at line 40 of file smartcard_config.h.

Referenced by usart_configuration().

◆ SC_USART_CLK_PORT

#define SC_USART_CLK_PORT GPIOA

Definition at line 41 of file smartcard_config.h.

Referenced by usart_configuration().

◆ SC_USART_GPIO_CLK

#define SC_USART_GPIO_CLK CRM_GPIOA_PERIPH_CLOCK

Definition at line 37 of file smartcard_config.h.

Referenced by usart_configuration().

◆ SC_USART_IRQHandler

#define SC_USART_IRQHandler USART2_IRQHandler

Definition at line 43 of file smartcard_config.h.

◆ SC_USART_IRQn

#define SC_USART_IRQn USART2_IRQn

Definition at line 42 of file smartcard_config.h.

Referenced by usart_configuration().

◆ SC_USART_TX_PIN

#define SC_USART_TX_PIN GPIO_PINS_2

Definition at line 38 of file smartcard_config.h.

Referenced by usart_configuration().

◆ SC_USART_TX_PORT

#define SC_USART_TX_PORT GPIOA

Definition at line 39 of file smartcard_config.h.

Referenced by usart_configuration().


AT32F413 Firmwary Library: src Directory Reference

  • usart
  • smartcard
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • usart
  • smartcard
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/smartcard/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/usart/smartcard/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • usart
  • smartcard
  • src
Functions | Variables
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"
#include "smartcard_config.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | EXINT9_5_IRQHandler (void)
this function handles external lines 9 to 5 interrupt request.
void | USART2_IRQHandler (void)
this function handles sc_usart global interrupt request.

Variables

uint32_t card_inserted

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • usart
  • smartcard
  • src
Data Structures | Macros | Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include "smartcard_config.h"

Go to the source code of this file.

Data Structures

struct sc_atr_type

Macros

#define | T0_PROTOCOL 0x00 /* t0 protocol */
#define | SETUP_LENGTH 20
#define | HIST_LENGTH 20
#define | SC_RECEIVE_TIMEOUT 0xA000 /* direction to reader */
#define | SC_USART_DIV_VAL 20 /* ISO 7816-3 protocol: SC_CLOCK_FREQ(PCLK/(2*USART_DIV_VAL)) is between 1 and 5 MHz */
#define | SC_F_DIV_D 372 /* ISO 7816-3 protocol: F/D = 372 */

Functions

void | usart_configuration (void)
config usart
uint8_t | sc_response_decode (__IO uint8_t *card)
decode the card atr response.
int | main (void)
main function.

Variables

sc_atr_type sc_a2r_struct
uint32_t | sc_baud_rate = 0
uint32_t | sc_clock_freq = 0
uint32_t | counter = 0
error_status atr_decode_status = ERROR
uint32_t | card_inserted = 0
uint32_t | card_protocol = 1
uint8_t | dst_buffer [50]

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/smartcard/src/main.c.


AT32F413 Firmwary Library: synchronous Directory Reference

  • usart
  • synchronous
synchronous Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • usart
  • synchronous
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • usart
  • synchronous
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/synchronous/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • usart
  • synchronous
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • usart
  • synchronous
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/synchronous/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • usart
  • synchronous
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • usart
  • synchronous
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/synchronous/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/usart/synchronous/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • usart
  • synchronous
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/synchronous/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • usart
  • synchronous
  • src
Macros | Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Macros

#define | COUNTOF(a)
#define | USART2_TX_BUFFER_SIZE (COUNTOF(usart2_tx_buffer) - 1)
#define | SPI2_TX_BUFFER_SIZE (COUNTOF(spi2_tx_buffer) - 1)
#define | DYMMY_BYTE 0x00

Functions

void | usart_spi_configuration (void)
config usart and spi
uint8_t | buffer_compare (uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t buffer_length)
compares two buffers.
int | main (void)
main function.

Variables

uint8_t | usart2_tx_buffer [] = "usart synchronous example: usart2 -> spi2"
uint8_t | spi2_tx_buffer [] = "usart synchronous example: spi2 -> usart2"
uint8_t | usart2_rx_buffer [((sizeof(spi2_tx_buffer)/sizeof(*(spi2_tx_buffer))) - 1)]
uint8_t | spi2_rx_buffer [((sizeof(usart2_tx_buffer)/sizeof(*(usart2_tx_buffer))) - 1)]
uint8_t | usart2_tx_counter = 0x00
uint8_t | spi2_tx_counter = 0x00
uint8_t | usart2_rx_counter = 0x00
uint8_t | spi2_rx_counter = 0x00
uint8_t | usart2_tx_buffer_size = ( (sizeof(usart2_tx_buffer) / sizeof(*(usart2_tx_buffer))) - 1)
uint8_t | spi2_tx_buffer_size = ( (sizeof(spi2_tx_buffer) / sizeof(*(spi2_tx_buffer))) - 1)

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/synchronous/src/main.c.


AT32F413 Firmwary Library: transfer_by_dma_interrupt Directory Reference

  • usart
  • transfer_by_dma_interrupt
transfer_by_dma_interrupt Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • usart
  • transfer_by_dma_interrupt
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • usart
  • transfer_by_dma_interrupt
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • usart
  • transfer_by_dma_interrupt
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • usart
  • transfer_by_dma_interrupt
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • usart
  • transfer_by_dma_interrupt
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • usart
  • transfer_by_dma_interrupt
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • usart
  • transfer_by_dma_interrupt
  • src
Functions | Variables
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | DMA1_Channel1_IRQHandler (void)
this function handles dma1 channel1 handler.
void | DMA1_Channel2_IRQHandler (void)
this function handles dma1 channel2 handler.
void | DMA1_Channel3_IRQHandler (void)
this function handles dma1 channel3 handler.
void | DMA1_Channel4_IRQHandler (void)
this function handles dma1 channel4 handler.

Variables

uint8_t | usart2_tx_dma_status
uint8_t | usart2_rx_dma_status
uint8_t | usart3_tx_dma_status
uint8_t | usart3_rx_dma_status

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • usart
  • transfer_by_dma_interrupt
  • src
Macros | Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Macros

#define | COUNTOF(a)
#define | USART2_TX_BUFFER_SIZE (COUNTOF(usart2_tx_buffer) - 1)
#define | USART3_TX_BUFFER_SIZE (COUNTOF(usart3_tx_buffer) - 1)

Functions

void | usart_configuration (void)
config usart
void | dma_configuration (void)
config dma for usart2 and usart3
uint8_t | buffer_compare (uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t buffer_length)
compares two buffers.
int | main (void)
main function.

Variables

uint8_t | usart2_tx_buffer [] = "usart transfer by dma interrupt: usart2 -> usart3 using dma"
uint8_t | usart3_tx_buffer [] = "usart transfer by dma interrupt: usart3 -> usart2 using dma"
uint8_t | usart2_rx_buffer [((sizeof(usart3_tx_buffer)/sizeof(*(usart3_tx_buffer))) - 1)]
uint8_t | usart3_rx_buffer [((sizeof(usart2_tx_buffer)/sizeof(*(usart2_tx_buffer))) - 1)]
volatile uint8_t | usart2_tx_dma_status = 0
volatile uint8_t | usart2_rx_dma_status = 0
volatile uint8_t | usart3_tx_dma_status = 0
volatile uint8_t | usart3_rx_dma_status = 0

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c.


AT32F413 Firmwary Library: transfer_by_dma_polling Directory Reference

  • usart
  • transfer_by_dma_polling
transfer_by_dma_polling Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • usart
  • transfer_by_dma_polling
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • usart
  • transfer_by_dma_polling
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • usart
  • transfer_by_dma_polling
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • usart
  • transfer_by_dma_polling
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • usart
  • transfer_by_dma_polling
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • usart
  • transfer_by_dma_polling
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/transfer_by_dma_polling/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/usart/transfer_by_dma_polling/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • usart
  • transfer_by_dma_polling
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/transfer_by_dma_polling/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • usart
  • transfer_by_dma_polling
  • src
Macros | Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Macros

#define | COUNTOF(a)
#define | USART2_TX_BUFFER_SIZE (COUNTOF(usart2_tx_buffer) - 1)
#define | USART3_TX_BUFFER_SIZE (COUNTOF(usart3_tx_buffer) - 1)

Functions

void | usart_configuration (void)
config usart
void | dma_configuration (void)
config dma for usart2 and usart3
uint8_t | buffer_compare (uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t buffer_length)
compares two buffers.
int | main (void)
main function.

Variables

uint8_t | usart2_tx_buffer [] = "usart transfer by dma interrupt: usart2 -> usart3 using dma"
uint8_t | usart3_tx_buffer [] = "usart transfer by dma interrupt: usart3 -> usart2 using dma"
uint8_t | usart2_rx_buffer [((sizeof(usart3_tx_buffer)/sizeof(*(usart3_tx_buffer))) - 1)]
uint8_t | usart3_rx_buffer [((sizeof(usart2_tx_buffer)/sizeof(*(usart2_tx_buffer))) - 1)]

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c.


AT32F413 Firmwary Library: usb_device Directory Reference

  • usb_device
usb_device Directory Reference

Directories

audio
composite_audio_hid
composite_vcp_keyboard
composite_vcp_msc
custom_hid
keyboard
mouse
msc
printer
vcp_loopback
virtual_comport
virtual_msc_iap
winusb


AT32F413 Firmwary Library: audio Directory Reference

  • usb_device
  • audio
audio Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • usb_device
  • audio
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.
audio_codec.h
audio codec header file
usb_conf.h
usb config header file


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • usb_device
  • audio
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/audio/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • usb_device
  • audio
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • usb_device
  • audio
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/audio/inc/at32f413_int.h.


AT32F413 Firmwary Library: audio_codec.h File Reference

  • usb_device
  • audio
  • inc
Data Structures | Macros | Functions
audio_codec.h File Reference

audio codec header file More...

#include "at32f413.h"

Go to the source code of this file.

Data Structures

struct audio_codec_type

Macros

#define | WM8988_R0_LEFT_INPUT_VOLUME 0x00 /*Left channel PGA control*/
#define | WM8988_R1_RIGHT_INPUT_VOLUME 0x01 /*Right channel PGA control*/
#define | WM8988_R2_LOUT1_VOLUME 0x02
#define | WM8988_R3_ROUT1_VOLUME 0x03
#define | WM8988_R4_RESERVED 0x04
#define | WM8988_R5_ADC_DAC_CONTROL 0x05
#define | WM8988_R6_RESERVED 0x06
#define | WM8988_R7_AUDIO_INTERFACE 0x07
#define | WM8988_R8_SAMPLE_RATE 0x08
#define | WM8988_R9_RESERVED 0x09
#define | WM8988_R10_LEFT_DAC_VOLUME 0x0A
#define | WM8988_R11_RIGHT_DAC_VOLUME 0x0B
#define | WM8988_R12_BASS_CONTROL 0x0C
#define | WM8988_R13_TREBLE_CONTROL 0x0D
#define | WM8988_R14_
#define | WM8988_R15_RESET 0x0F
#define | WM8988_R16_3D_CONTROL 0x10
#define | WM8988_R17_ALC1 0x11
#define | WM8988_R18_ALC2 0x12
#define | WM8988_R19_ALC3 0x13
#define | WM8988_R20_NOISE_GATE 0x14
#define | WM8988_R21_LEFT_ADC_VOLUME 0x15
#define | WM8988_R22_RIGHT_ADC_VOLUME 0x16
#define | WM8988_R23_ADDITIONAL_1_CONTROL 0x17
#define | WM8988_R24_ADDITIONAL_2_CONTROL 0x18
#define | WM8988_R25_PWR_1_MGMT 0x19
#define | WM8988_R26_PWR_2_MGMT 0x1A
#define | WM8988_R27_ADDITIONAL_3_CONTROL 0x1B
#define | WM8988_R31_ADC_INPUT_MODE 0x1F
#define | WM8988_R32_ADC_L_SIGNAL_PATH 0x20
#define | WM8988_R33_ADC_R_SIGNAL_PATH 0x21
#define | WM8988_R34_LEFT_OUT_MIX_1 0x22
#define | WM8988_R35_LEFT_OUT_MIX_2 0x23
#define | WM8988_R36_RIGHT_OUT_MIX_1 0x24
#define | WM8988_R37_RIGHT_OUT_MIX_2 0x25
#define | WM8988_R38_RESERVED
#define | WM8988_R39_RESERVED
#define | WM8988_R40_LOUT2_VOLUME 0x28
#define | WM8988_R41_ROUT2_VOLUME 0x29
#define | WM8988_R42_RESERVED
#define | WM8988_R43_LOW_POWER_PALYBACK 0x43
#define | WM8988_I2C_ADDR_CSB_LOW 0x34
#define | WM8988_I2C_ADDR_CSB_HIGH 0x36
#define | I2S1_WS_PIN GPIO_PINS_4
#define | I2S1_CK_PIN GPIO_PINS_5
#define | I2S1_SD_PIN GPIO_PINS_7
#define | I2S1_GPIO GPIOA
#define | I2S1_GPIO_CRM_CLK CRM_GPIOA_PERIPH_CLOCK
#define | I2S1_DT_ADDRESS (&(SPI1->dt))
#define | I2S2_WS_PIN GPIO_PINS_12
#define | I2S2_CK_PIN GPIO_PINS_13
#define | I2S2_SD_PIN GPIO_PINS_15
#define | I2S2_GPIO GPIOB
#define | I2S2_GPIO_CRM_CLK CRM_GPIOB_PERIPH_CLOCK
#define | I2S2_DT_ADDRESS (&(SPI2->dt))
#define | SPK_TX_FIFO_SIZE (1024 * 4)
#define | MIC_BUFFER_SIZE 1024
#define | SPK_BUFFER_SIZE 4096
#define | DMA_BUFFER_SIZE 288

Functions

error_status | audio_codec_init (void)
audio codec init
error_status | audio_codec_loop (void)
audio codec loop
void | audio_codec_modify_freq (uint32_t freq)
audio codec modify freq
void | audio_codec_spk_fifo_write (uint8_t *data, uint32_t len)
audio codec interface
uint32_t | audio_codec_mic_get_data (uint8_t *buffer)
codec microphone get data
uint8_t | audio_codec_spk_feedback (uint8_t *feedback)
codec speaker feedback
void | audio_codec_spk_alt_setting (uint32_t alt_seting)
audio codec speaker alt setting config
void | audio_codec_mic_alt_setting (uint32_t alt_seting)
audio codec microphone alt setting config
void | audio_codec_set_mic_mute (uint8_t mute)
audio codec set microphone mute
void | audio_codec_set_spk_mute (uint8_t mute)
audio codec set speaker mute
void | audio_codec_set_mic_volume (uint16_t volume)
audio codec set microphone volume
void | audio_codec_set_spk_volume (uint16_t volume)
audio codec set speaker volume
void | audio_codec_set_mic_freq (uint32_t freq)
audio codec set microphone freq
void | audio_codec_set_spk_freq (uint32_t freq)
audio codec set speaker freq

Detailed Description

audio codec header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file audio/inc/audio_codec.h.


AT32F413 Firmwary Library: usb_conf.h File Reference

  • usb_device
  • audio
  • inc
Macros | Functions
usb_conf.h File Reference

usb config header file More...

#include "at32f413.h"
#include "at32f413_board.h"
#include "stdio.h"

Go to the source code of this file.

Macros

#define | USB_BUFFER_SIZE_EX
usb endpoint max num define
#define | USB_EPT_AUTO_MALLOC_BUFFER
auto malloc usb endpoint buffer

Functions

void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.

Detailed Description

usb config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/audio/inc/usb_conf.h.


AT32F413 Firmwary Library: src Directory Reference

  • usb_device
  • audio
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
audio_codec.c
audio codec function
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • usb_device
  • audio
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/audio/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/usb_device/audio/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • usb_device
  • audio
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/audio/src/at32f413_int.c.


AT32F413 Firmwary Library: audio_codec.c File Reference

  • usb_device
  • audio
  • src
Macros | Functions | Variables
audio_codec.c File Reference

audio codec function More...

#include "audio_codec.h"
#include "i2c_application.h"
#include "audio_conf.h"
#include <string.h>

Go to the source code of this file.

Macros

#define | I2C_TIMEOUT 0xFFFFFFFF
#define | I2Cx_SPEED 100000
#define | I2Cx_ADDRESS 0x00
#define | I2Cx_PORT I2C1
#define | I2Cx_CLK CRM_I2C1_PERIPH_CLOCK
#define | I2Cx_SCL_PIN GPIO_PINS_8
#define | I2Cx_SCL_GPIO_PORT GPIOB
#define | I2Cx_SCL_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
#define | I2Cx_SDA_PIN GPIO_PINS_9
#define | I2Cx_SDA_GPIO_PORT GPIOB
#define | I2Cx_SDA_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
#define | WM8988_REG_FREQ48K ((WM8988_R8_SAMPLE_RATE << 9) | 0x0081)
wm8988 freq
#define | WM8988_REG_FREQ16K ((WM8988_R8_SAMPLE_RATE << 9) | 0x0095)
#define | WM8988_REG_BITW16 ((WM8988_R7_AUDIO_INTERFACE << 9) | 0x0042)
wm8988 bit width

Functions

void | memset16_buffer (uint16_t *buffer, uint32_t set, uint32_t len)
buffer memset
void | codec_i2s_reset (void)
audio codec i2s reset
void | codec_i2s_init (audio_codec_type *param)
audio codec i2s init
void | mclk_tmr1_init (void)
mclk clock conifg
void | copy_buff (uint16_t *dest, uint16_t *src, uint32_t len)
copy buffer
void | audio_codec_set_mic_freq (uint32_t freq)
audio codec set microphone freq
void | audio_codec_set_spk_freq (uint32_t freq)
audio codec set speaker freq
void | audio_codec_spk_alt_setting (uint32_t alt_seting)
audio codec speaker alt setting config
void | audio_codec_mic_alt_setting (uint32_t alt_seting)
audio codec microphone alt setting config
void | audio_codec_set_mic_mute (uint8_t mute)
audio codec set microphone mute
void | audio_codec_set_spk_mute (uint8_t mute)
audio codec set speaker mute
void | audio_codec_set_mic_volume (uint16_t volume)
audio codec set microphone volume
void | audio_codec_set_spk_volume (uint16_t volume)
audio codec set speaker volume
uint8_t | audio_codec_spk_feedback (uint8_t *feedback)
codec speaker feedback
void | audio_codec_spk_fifo_write (uint8_t *data, uint32_t len)
codec speaker write fifo
uint32_t | audio_codec_mic_get_data (uint8_t *buffer)
codec microphone get data
void | audio_codec_modify_freq (uint32_t freq)
audio codec modify freq
void | i2c_lowlevel_init (i2c_handle_type *hi2c)
initializes peripherals used by the i2c.
void | DMA1_Channel3_IRQHandler (void)
this function handles dma1 channel3 interrupt.
void | DMA1_Channel4_IRQHandler (void)
this function handles dma1 channel4 interrupt.
error_status | audio_codec_init (void)
audio codec init
error_status | audio_codec_loop (void)
audio codec loop

Variables

uint16_t | reg_addr_data []
wm8988 register default value
i2c_handle_type hi2cx
audio_codec_type audio_codec
uint16_t | spk_dma_buffer [DMA_BUFFER_SIZE]
uint16_t | mic_dma_buffer [DMA_BUFFER_SIZE]

Detailed Description

audio codec function

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file audio/src/audio_codec.c.


AT32F413 Firmwary Library: main.c File Reference

  • usb_device
  • audio
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include "usbd_core.h"
#include "audio_class.h"
#include "audio_desc.h"
#include "usbd_int.h"
#include "audio_codec.h"

Go to the source code of this file.

Functions

void | usb_clock48m_select (usb_clk48_s clk_s)
usb 48M clock select
int | main (void)
main function.
void | USBFS_L_CAN1_RX0_IRQHandler (void)
this function handles usb interrupt.
void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.

Variables

usbd_core_type usb_core_dev

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/audio/src/main.c.


AT32F413 Firmwary Library: composite_audio_hid Directory Reference

  • usb_device
  • composite_audio_hid
composite_audio_hid Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • usb_device
  • composite_audio_hid
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.
audio_codec.h
audio codec header file
usb_conf.h
usb config header file


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • usb_device
  • composite_audio_hid
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • usb_device
  • composite_audio_hid
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • usb_device
  • composite_audio_hid
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_int.h.


AT32F413 Firmwary Library: audio_codec.h File Reference

  • usb_device
  • composite_audio_hid
  • inc
Data Structures | Macros | Functions
audio_codec.h File Reference

audio codec header file More...

#include "at32f413.h"

Go to the source code of this file.

Data Structures

struct audio_codec_type

Macros

#define | WM8988_R0_LEFT_INPUT_VOLUME 0x00 /*Left channel PGA control*/
#define | WM8988_R1_RIGHT_INPUT_VOLUME 0x01 /*Right channel PGA control*/
#define | WM8988_R2_LOUT1_VOLUME 0x02
#define | WM8988_R3_ROUT1_VOLUME 0x03
#define | WM8988_R4_RESERVED 0x04
#define | WM8988_R5_ADC_DAC_CONTROL 0x05
#define | WM8988_R6_RESERVED 0x06
#define | WM8988_R7_AUDIO_INTERFACE 0x07
#define | WM8988_R8_SAMPLE_RATE 0x08
#define | WM8988_R9_RESERVED 0x09
#define | WM8988_R10_LEFT_DAC_VOLUME 0x0A
#define | WM8988_R11_RIGHT_DAC_VOLUME 0x0B
#define | WM8988_R12_BASS_CONTROL 0x0C
#define | WM8988_R13_TREBLE_CONTROL 0x0D
#define | WM8988_R14_
#define | WM8988_R15_RESET 0x0F
#define | WM8988_R16_3D_CONTROL 0x10
#define | WM8988_R17_ALC1 0x11
#define | WM8988_R18_ALC2 0x12
#define | WM8988_R19_ALC3 0x13
#define | WM8988_R20_NOISE_GATE 0x14
#define | WM8988_R21_LEFT_ADC_VOLUME 0x15
#define | WM8988_R22_RIGHT_ADC_VOLUME 0x16
#define | WM8988_R23_ADDITIONAL_1_CONTROL 0x17
#define | WM8988_R24_ADDITIONAL_2_CONTROL 0x18
#define | WM8988_R25_PWR_1_MGMT 0x19
#define | WM8988_R26_PWR_2_MGMT 0x1A
#define | WM8988_R27_ADDITIONAL_3_CONTROL 0x1B
#define | WM8988_R31_ADC_INPUT_MODE 0x1F
#define | WM8988_R32_ADC_L_SIGNAL_PATH 0x20
#define | WM8988_R33_ADC_R_SIGNAL_PATH 0x21
#define | WM8988_R34_LEFT_OUT_MIX_1 0x22
#define | WM8988_R35_LEFT_OUT_MIX_2 0x23
#define | WM8988_R36_RIGHT_OUT_MIX_1 0x24
#define | WM8988_R37_RIGHT_OUT_MIX_2 0x25
#define | WM8988_R38_RESERVED
#define | WM8988_R39_RESERVED
#define | WM8988_R40_LOUT2_VOLUME 0x28
#define | WM8988_R41_ROUT2_VOLUME 0x29
#define | WM8988_R42_RESERVED
#define | WM8988_R43_LOW_POWER_PALYBACK 0x43
#define | WM8988_I2C_ADDR_CSB_LOW 0x34
#define | WM8988_I2C_ADDR_CSB_HIGH 0x36
#define | I2S1_WS_PIN GPIO_PINS_4
#define | I2S1_CK_PIN GPIO_PINS_5
#define | I2S1_SD_PIN GPIO_PINS_7
#define | I2S1_GPIO GPIOA
#define | I2S1_GPIO_CRM_CLK CRM_GPIOA_PERIPH_CLOCK
#define | I2S1_DT_ADDRESS (&(SPI1->dt))
#define | I2S2_WS_PIN GPIO_PINS_12
#define | I2S2_CK_PIN GPIO_PINS_13
#define | I2S2_SD_PIN GPIO_PINS_15
#define | I2S2_GPIO GPIOB
#define | I2S2_GPIO_CRM_CLK CRM_GPIOB_PERIPH_CLOCK
#define | I2S2_DT_ADDRESS (&(SPI2->dt))
#define | SPK_TX_FIFO_SIZE (1024 * 4)
#define | MIC_BUFFER_SIZE 1024
#define | SPK_BUFFER_SIZE 4096
#define | DMA_BUFFER_SIZE 288

Functions

error_status | audio_codec_init (void)
audio codec init
error_status | audio_codec_loop (void)
audio codec loop
void | audio_codec_modify_freq (uint32_t freq)
audio codec modify freq
void | audio_codec_spk_fifo_write (uint8_t *data, uint32_t len)
audio codec interface
uint32_t | audio_codec_mic_get_data (uint8_t *buffer)
codec microphone get data
uint8_t | audio_codec_spk_feedback (uint8_t *feedback)
codec speaker feedback
void | audio_codec_spk_alt_setting (uint32_t alt_seting)
audio codec speaker alt setting config
void | audio_codec_mic_alt_setting (uint32_t alt_seting)
audio codec microphone alt setting config
void | audio_codec_set_mic_mute (uint8_t mute)
audio codec set microphone mute
void | audio_codec_set_spk_mute (uint8_t mute)
audio codec set speaker mute
void | audio_codec_set_mic_volume (uint16_t volume)
audio codec set microphone volume
void | audio_codec_set_spk_volume (uint16_t volume)
audio codec set speaker volume
void | audio_codec_set_mic_freq (uint32_t freq)
audio codec set microphone freq
void | audio_codec_set_spk_freq (uint32_t freq)
audio codec set speaker freq

Detailed Description

audio codec header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file composite_audio_hid/inc/audio_codec.h.


AT32F413 Firmwary Library: usb_conf.h File Reference

  • usb_device
  • composite_audio_hid
  • inc
Macros | Functions
usb_conf.h File Reference

usb config header file More...

#include "at32f413.h"
#include "at32f413_board.h"
#include "stdio.h"

Go to the source code of this file.

Macros

#define | USB_BUFFER_SIZE_EX
usb endpoint max num define
#define | USB_EPT_AUTO_MALLOC_BUFFER
auto malloc usb endpoint buffer

Functions

void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.

Detailed Description

usb config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/composite_audio_hid/inc/usb_conf.h.


AT32F413 Firmwary Library: src Directory Reference

  • usb_device
  • composite_audio_hid
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
audio_codec.c
audio codec function
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • usb_device
  • composite_audio_hid
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/composite_audio_hid/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/usb_device/composite_audio_hid/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • usb_device
  • composite_audio_hid
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/composite_audio_hid/src/at32f413_int.c.


AT32F413 Firmwary Library: audio_codec.c File Reference

  • usb_device
  • composite_audio_hid
  • src
Macros | Functions | Variables
audio_codec.c File Reference

audio codec function More...

#include "audio_codec.h"
#include "i2c_application.h"
#include "audio_conf.h"
#include <string.h>

Go to the source code of this file.

Macros

#define | I2C_TIMEOUT 0xFFFFFFFF
#define | I2Cx_SPEED 200000
#define | I2Cx_ADDRESS 0x00
#define | I2Cx_PORT I2C1
#define | I2Cx_CLK CRM_I2C1_PERIPH_CLOCK
#define | I2Cx_SCL_PIN GPIO_PINS_8
#define | I2Cx_SCL_GPIO_PORT GPIOB
#define | I2Cx_SCL_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
#define | I2Cx_SDA_PIN GPIO_PINS_9
#define | I2Cx_SDA_GPIO_PORT GPIOB
#define | I2Cx_SDA_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
#define | WM8988_REG_FREQ48K ((WM8988_R8_SAMPLE_RATE << 9) | 0x0081)
wm8988 freq
#define | WM8988_REG_FREQ16K ((WM8988_R8_SAMPLE_RATE << 9) | 0x0095)
#define | WM8988_REG_BITW16 ((WM8988_R7_AUDIO_INTERFACE << 9) | 0x0042)
wm8988 bit width

Functions

void | memset16_buffer (uint16_t *buffer, uint32_t set, uint32_t len)
buffer memset
void | codec_i2s_reset (void)
audio codec i2s reset
void | codec_i2s_init (audio_codec_type *param)
audio codec i2s init
void | mclk_tmr1_init (void)
mclk clock conifg
void | copy_buff (uint16_t *dest, uint16_t *src, uint32_t len)
copy buffer
void | audio_codec_set_mic_freq (uint32_t freq)
audio codec set microphone freq
void | audio_codec_set_spk_freq (uint32_t freq)
audio codec set speaker freq
void | audio_codec_spk_alt_setting (uint32_t alt_seting)
audio codec speaker alt setting config
void | audio_codec_mic_alt_setting (uint32_t alt_seting)
audio codec microphone alt setting config
void | audio_codec_set_mic_mute (uint8_t mute)
audio codec set microphone mute
void | audio_codec_set_spk_mute (uint8_t mute)
audio codec set speaker mute
void | audio_codec_set_mic_volume (uint16_t volume)
audio codec set microphone volume
void | audio_codec_set_spk_volume (uint16_t volume)
audio codec set speaker volume
uint8_t | audio_codec_spk_feedback (uint8_t *feedback)
codec speaker feedback
void | audio_codec_spk_fifo_write (uint8_t *data, uint32_t len)
codec speaker write fifo
uint32_t | audio_codec_mic_get_data (uint8_t *buffer)
codec microphone get data
void | audio_codec_modify_freq (uint32_t freq)
audio codec modify freq
void | i2c_lowlevel_init (i2c_handle_type *hi2c)
initializes peripherals used by the i2c.
void | DMA1_Channel3_IRQHandler (void)
this function handles dma1 channel3 interrupt.
void | DMA1_Channel4_IRQHandler (void)
this function handles dma1 channel4 interrupt.
error_status | audio_codec_init (void)
audio codec init
error_status | audio_codec_loop (void)
audio codec loop

Variables

uint16_t | reg_addr_data []
wm8988 register default value
i2c_handle_type hi2cx
audio_codec_type audio_codec
uint16_t | spk_dma_buffer [DMA_BUFFER_SIZE]
uint16_t | mic_dma_buffer [DMA_BUFFER_SIZE]

Detailed Description

audio codec function

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file composite_audio_hid/src/audio_codec.c.


AT32F413 Firmwary Library: main.c File Reference

  • usb_device
  • composite_audio_hid
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include "usbd_core.h"
#include "usbd_int.h"
#include "audio_hid_class.h"
#include "audio_hid_desc.h"
#include "audio_codec.h"

Go to the source code of this file.

Functions

void | usb_clock48m_select (usb_clk48_s clk_s)
usb 48M clock select
int | main (void)
main function.
void | USBFS_L_CAN1_RX0_IRQHandler (void)
this function handles usb interrupt.
void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.

Variables

usbd_core_type usb_core_dev
uint8_t report_buf [0x40]

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/composite_audio_hid/src/main.c.


AT32F413 Firmwary Library: composite_vcp_keyboard Directory Reference

  • usb_device
  • composite_vcp_keyboard
composite_vcp_keyboard Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • usb_device
  • composite_vcp_keyboard
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.
usb_conf.h
usb config header file


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • usb_device
  • composite_vcp_keyboard
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • usb_device
  • composite_vcp_keyboard
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • usb_device
  • composite_vcp_keyboard
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_int.h.


AT32F413 Firmwary Library: usb_conf.h File Reference

  • usb_device
  • composite_vcp_keyboard
  • inc
Macros | Functions
usb_conf.h File Reference

usb config header file More...

#include "at32f413.h"
#include "at32f413_board.h"
#include "stdio.h"

Go to the source code of this file.

Macros

#define USB_EPT_AUTO_MALLOC_BUFFER
usb endpoint max num define

Functions

void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.

Detailed Description

usb config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/usb_conf.h.


AT32F413 Firmwary Library: src Directory Reference

  • usb_device
  • composite_vcp_keyboard
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • usb_device
  • composite_vcp_keyboard
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • usb_device
  • composite_vcp_keyboard
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • usb_device
  • composite_vcp_keyboard
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include "usbd_core.h"
#include "cdc_keyboard_class.h"
#include "cdc_keyboard_desc.h"
#include "usbd_int.h"

Go to the source code of this file.

Functions

void | keyboard_send_string (void *udev, uint8_t *string, uint8_t len)
keyboard send string
void | usb_clock48m_select (usb_clk48_s clk_s)
usb 48M clock select
int | main (void)
main function.
void | USBFS_L_CAN1_RX0_IRQHandler (void)
this function handles usb interrupt.
void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.

Variables

usbd_core_type usb_core_dev
uint8_t usb_buffer [256]

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/main.c.


AT32F413 Firmwary Library: composite_vcp_msc Directory Reference

  • usb_device
  • composite_vcp_msc
composite_vcp_msc Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • usb_device
  • composite_vcp_msc
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.
msc_diskio.h
usb mass storage disk interface header file
usb_conf.h
usb config header file


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • usb_device
  • composite_vcp_msc
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • usb_device
  • composite_vcp_msc
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • usb_device
  • composite_vcp_msc
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_int.h.


AT32F413 Firmwary Library: msc_diskio.h File Reference

  • usb_device
  • composite_vcp_msc
  • inc
Macros | Functions
msc_diskio.h File Reference

usb mass storage disk interface header file More...

#include "usb_conf.h"
#include "usb_std.h"

Go to the source code of this file.

Macros

#define | INTERNAL_FLASH_LUN 0
#define | SPI_FLASH_LUN 1
#define | SD_LUN 2
#define | USB_FLASH_ADDR_OFFSET 0x08005000
#define | SECTOR_SIZE_1K 1024
#define | SECTOR_SIZE_2K 2048
#define | SECTOR_SIZE_4K 4096

Functions

uint8_t * | get_inquiry (uint8_t lun)
get disk inquiry
usb_sts_type | msc_disk_read (uint8_t lun, uint64_t addr, uint8_t *read_buf, uint32_t len)
disk read
usb_sts_type | msc_disk_write (uint8_t lun, uint64_t addr, uint8_t *buf, uint32_t len)
disk write
usb_sts_type | msc_disk_capacity (uint8_t lun, uint32_t *blk_nbr, uint32_t *blk_size)
disk capacity

Detailed Description

usb mass storage disk interface header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file composite_vcp_msc/inc/msc_diskio.h.


AT32F413 Firmwary Library: usb_conf.h File Reference

  • usb_device
  • composite_vcp_msc
  • inc
Macros | Functions
usb_conf.h File Reference

usb config header file More...

#include "at32f413.h"
#include "at32f413_board.h"
#include "stdio.h"

Go to the source code of this file.

Macros

#define USB_EPT_AUTO_MALLOC_BUFFER
usb endpoint max num define

Functions

void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.

Detailed Description

usb config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/usb_conf.h.


AT32F413 Firmwary Library: src Directory Reference

  • usb_device
  • composite_vcp_msc
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program
msc_diskio.c
usb mass storage disk function


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • usb_device
  • composite_vcp_msc
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/composite_vcp_msc/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/usb_device/composite_vcp_msc/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • usb_device
  • composite_vcp_msc
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/composite_vcp_msc/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • usb_device
  • composite_vcp_msc
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include "usbd_core.h"
#include "cdc_msc_class.h"
#include "cdc_msc_desc.h"
#include "usbd_int.h"

Go to the source code of this file.

Functions

void | usb_clock48m_select (usb_clk48_s clk_s)
usb 48M clock select
int | main (void)
main function.
void | USBFS_L_CAN1_RX0_IRQHandler (void)
this function handles usb interrupt.
void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.

Variables

usbd_core_type usb_core_dev
uint8_t usb_buffer [256]

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/composite_vcp_msc/src/main.c.


AT32F413 Firmwary Library: msc_diskio.c File Reference

  • usb_device
  • composite_vcp_msc
  • src
Functions | Variables
msc_diskio.c File Reference

usb mass storage disk function More...

#include "msc_diskio.h"
#include "cdc_msc_class.h"

Go to the source code of this file.

Functions

uint8_t * | get_inquiry (uint8_t lun)
get disk inquiry
usb_sts_type | msc_disk_read (uint8_t lun, uint64_t addr, uint8_t *read_buf, uint32_t len)
disk read
usb_sts_type | msc_disk_write (uint8_t lun, uint64_t addr, uint8_t *buf, uint32_t len)
disk write
usb_sts_type | msc_disk_capacity (uint8_t lun, uint32_t *blk_nbr, uint32_t *blk_size)
disk capacity

Variables

uint32_t | sector_size = 2048
uint32_t | msc_flash_size
uint8_t | scsi_inquiry [MSC_SUPPORT_MAX_LUN][SCSI_INQUIRY_DATA_LENGTH]

Detailed Description

usb mass storage disk function

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file composite_vcp_msc/src/msc_diskio.c.


AT32F413 Firmwary Library: custom_hid Directory Reference

  • usb_device
  • custom_hid
custom_hid Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • usb_device
  • custom_hid
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.
usb_conf.h
usb config header file


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • usb_device
  • custom_hid
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • usb_device
  • custom_hid
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • usb_device
  • custom_hid
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_int.h.


AT32F413 Firmwary Library: usb_conf.h File Reference

  • usb_device
  • custom_hid
  • inc
Macros | Functions
usb_conf.h File Reference

usb config header file More...

#include "at32f413.h"
#include "at32f413_board.h"
#include "stdio.h"

Go to the source code of this file.

Macros

#define USB_EPT_AUTO_MALLOC_BUFFER
usb endpoint max num define

Functions

void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.

Detailed Description

usb config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/custom_hid/inc/usb_conf.h.


AT32F413 Firmwary Library: src Directory Reference

  • usb_device
  • custom_hid
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • usb_device
  • custom_hid
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/custom_hid/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/usb_device/custom_hid/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • usb_device
  • custom_hid
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/custom_hid/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • usb_device
  • custom_hid
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include "usbd_core.h"
#include "custom_hid_class.h"
#include "custom_hid_desc.h"
#include "usbd_int.h"

Go to the source code of this file.

Functions

void | usb_clock48m_select (usb_clk48_s clk_s)
usb 48M clock select
int | main (void)
main function.
void | USBFS_L_CAN1_RX0_IRQHandler (void)
this function handles usb interrupt.
void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.

Variables

usbd_core_type usb_core_dev
uint8_t report_buf [0x40]

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/custom_hid/src/main.c.


AT32F413 Firmwary Library: keyboard Directory Reference

  • usb_device
  • keyboard
keyboard Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • usb_device
  • keyboard
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.
usb_conf.h
usb config header file


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • usb_device
  • keyboard
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • usb_device
  • keyboard
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • usb_device
  • keyboard
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_int.h.


AT32F413 Firmwary Library: usb_conf.h File Reference

  • usb_device
  • keyboard
  • inc
Macros | Functions
usb_conf.h File Reference

usb config header file More...

#include "at32f413.h"
#include "at32f413_board.h"
#include "stdio.h"

Go to the source code of this file.

Macros

#define | USB_EPT_AUTO_MALLOC_BUFFER
usb endpoint max num define
#define | USB_LOW_POWER_WAKUP
usb low power wakeup handler enable

Functions

void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.

Detailed Description

usb config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/keyboard/inc/usb_conf.h.


AT32F413 Firmwary Library: src Directory Reference

  • usb_device
  • keyboard
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • usb_device
  • keyboard
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/keyboard/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/usb_device/keyboard/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • usb_device
  • keyboard
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/keyboard/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • usb_device
  • keyboard
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include "usbd_core.h"
#include "keyboard_class.h"
#include "keyboard_desc.h"
#include "usbd_int.h"

Go to the source code of this file.

Functions

void | keyboard_send_string (void *udev, uint8_t *string, uint8_t len)
keyboard send string
void | system_clock_recover (void)
systemclock recover.
void | button_exint_init (void)
configure button exint
void | usb_low_power_wakeup_config (void)
void | usb_clock48m_select (usb_clk48_s clk_s)
usb 48M clock select
int | main (void)
main function.
void | USBFS_L_CAN1_RX0_IRQHandler (void)
this function handles usb interrupt.
void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.

Variables

usbd_core_type usb_core_dev
__IO uint8_t hid_suspend_flag

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/keyboard/src/main.c.


AT32F413 Firmwary Library: mouse Directory Reference

  • usb_device
  • mouse
mouse Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • usb_device
  • mouse
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.
usb_conf.h
usb config header file


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • usb_device
  • mouse
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/mouse/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • usb_device
  • mouse
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • usb_device
  • mouse
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/mouse/inc/at32f413_int.h.


AT32F413 Firmwary Library: usb_conf.h File Reference

  • usb_device
  • mouse
  • inc
Macros | Functions
usb_conf.h File Reference

usb config header file More...

#include "at32f413.h"
#include "at32f413_board.h"
#include "stdio.h"

Go to the source code of this file.

Macros

#define | USB_EPT_AUTO_MALLOC_BUFFER
usb endpoint max num define
#define | USB_LOW_POWER_WAKUP
usb low power wakeup handler enable

Functions

void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.

Detailed Description

usb config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/mouse/inc/usb_conf.h.


AT32F413 Firmwary Library: src Directory Reference

  • usb_device
  • mouse
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • usb_device
  • mouse
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/mouse/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/usb_device/mouse/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • usb_device
  • mouse
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/mouse/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • usb_device
  • mouse
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include "usbd_core.h"
#include "mouse_class.h"
#include "mouse_desc.h"
#include "usbd_int.h"

Go to the source code of this file.

Functions

void | system_clock_recover (void)
systemclock recover.
void | button_exint_init (void)
configure button exint
void | usb_low_power_wakeup_config (void)
void | usb_clock48m_select (usb_clk48_s clk_s)
usb 48M clock select
int | main (void)
main function.
void | USBFS_L_CAN1_RX0_IRQHandler (void)
this function handles usb interrupt.
void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.

Variables

usbd_core_type usb_core_dev
__IO uint8_t | press_mouse = 0
__IO uint8_t | hid_suspend_flag
uint8_t | report_buf [0x40]

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/mouse/src/main.c.


AT32F413 Firmwary Library: msc Directory Reference

  • usb_device
  • msc
msc Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • usb_device
  • msc
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.
msc_diskio.h
usb mass storage disk interface header file
usb_conf.h
usb config header file


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • usb_device
  • msc
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/msc/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • usb_device
  • msc
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • usb_device
  • msc
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/msc/inc/at32f413_int.h.


AT32F413 Firmwary Library: msc_diskio.h File Reference

  • usb_device
  • msc
  • inc
Macros | Functions
msc_diskio.h File Reference

usb mass storage disk interface header file More...

#include "usb_conf.h"
#include "usb_std.h"

Go to the source code of this file.

Macros

#define | INTERNAL_FLASH_LUN 0
#define | SPI_FLASH_LUN 1
#define | SD_LUN 2
#define | USB_FLASH_ADDR_OFFSET 0x08008000
#define | SECTOR_SIZE_1K 1024
#define | SECTOR_SIZE_2K 2048
#define | SECTOR_SIZE_4K 4096

Functions

uint8_t * | get_inquiry (uint8_t lun)
get disk inquiry
usb_sts_type | msc_disk_read (uint8_t lun, uint64_t addr, uint8_t *read_buf, uint32_t len)
disk read
usb_sts_type | msc_disk_write (uint8_t lun, uint64_t addr, uint8_t *buf, uint32_t len)
disk write
usb_sts_type | msc_disk_capacity (uint8_t lun, uint32_t *blk_nbr, uint32_t *blk_size)
disk capacity

Detailed Description

usb mass storage disk interface header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file msc/inc/msc_diskio.h.


AT32F413 Firmwary Library: usb_conf.h File Reference

  • usb_device
  • msc
  • inc
Macros | Functions
usb_conf.h File Reference

usb config header file More...

#include "at32f413.h"
#include "at32f413_board.h"
#include "stdio.h"

Go to the source code of this file.

Macros

#define USB_EPT_AUTO_MALLOC_BUFFER
usb endpoint max num define

Functions

void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.

Detailed Description

usb config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/msc/inc/usb_conf.h.


AT32F413 Firmwary Library: src Directory Reference

  • usb_device
  • msc
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program
msc_diskio.c
usb mass storage disk function


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • usb_device
  • msc
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/msc/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/usb_device/msc/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • usb_device
  • msc
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/msc/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • usb_device
  • msc
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include "usbd_core.h"
#include "msc_class.h"
#include "msc_desc.h"
#include "usbd_int.h"

Go to the source code of this file.

Functions

void | usb_clock48m_select (usb_clk48_s clk_s)
usb 48M clock select
int | main (void)
main function.
void | USBFS_L_CAN1_RX0_IRQHandler (void)
this function handles usb interrupt.
void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.

Variables

usbd_core_type usb_core_dev

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/msc/src/main.c.


AT32F413 Firmwary Library: msc_diskio.c File Reference

  • usb_device
  • msc
  • src
Functions | Variables
msc_diskio.c File Reference

usb mass storage disk function More...

#include "msc_diskio.h"
#include "msc_bot_scsi.h"

Go to the source code of this file.

Functions

uint8_t * | get_inquiry (uint8_t lun)
get disk inquiry
usb_sts_type | msc_disk_read (uint8_t lun, uint64_t addr, uint8_t *read_buf, uint32_t len)
disk read
usb_sts_type | msc_disk_write (uint8_t lun, uint64_t addr, uint8_t *buf, uint32_t len)
disk write
usb_sts_type | msc_disk_capacity (uint8_t lun, uint32_t *blk_nbr, uint32_t *blk_size)
disk capacity

Variables

uint32_t | sector_size = 2048
uint32_t | msc_flash_size
uint8_t | scsi_inquiry [1][36]

Detailed Description

usb mass storage disk function

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file msc/src/msc_diskio.c.


AT32F413 Firmwary Library: printer Directory Reference

  • usb_device
  • printer
printer Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • usb_device
  • printer
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.
usb_conf.h
usb config header file


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • usb_device
  • printer
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/printer/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • usb_device
  • printer
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • usb_device
  • printer
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/printer/inc/at32f413_int.h.


AT32F413 Firmwary Library: usb_conf.h File Reference

  • usb_device
  • printer
  • inc
Macros | Functions
usb_conf.h File Reference

usb config header file More...

#include "at32f413.h"
#include "at32f413_board.h"
#include "stdio.h"

Go to the source code of this file.

Macros

#define USB_EPT_AUTO_MALLOC_BUFFER
usb endpoint max num define

Functions

void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.

Detailed Description

usb config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/printer/inc/usb_conf.h.


AT32F413 Firmwary Library: src Directory Reference

  • usb_device
  • printer
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • usb_device
  • printer
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/printer/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/usb_device/printer/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • usb_device
  • printer
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/printer/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • usb_device
  • printer
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include "usbd_core.h"
#include "printer_class.h"
#include "printer_desc.h"
#include "usbd_int.h"

Go to the source code of this file.

Functions

void | usb_clock48m_select (usb_clk48_s clk_s)
usb 48M clock select
int | main (void)
main function.
void | USBFS_L_CAN1_RX0_IRQHandler (void)
this function handles usb interrupt.
void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.

Variables

uint8_t usb_buffer [256]
usbd_core_type usb_core_dev

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/printer/src/main.c.


AT32F413 Firmwary Library: vcp_loopback Directory Reference

  • usb_device
  • vcp_loopback
vcp_loopback Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • usb_device
  • vcp_loopback
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.
usb_conf.h
usb config header file


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • usb_device
  • vcp_loopback
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • usb_device
  • vcp_loopback
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • usb_device
  • vcp_loopback
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_int.h.


AT32F413 Firmwary Library: usb_conf.h File Reference

  • usb_device
  • vcp_loopback
  • inc
Macros | Functions
usb_conf.h File Reference

usb config header file More...

#include "at32f413.h"
#include "at32f413_board.h"
#include "stdio.h"

Go to the source code of this file.

Macros

#define | EPT0_TX_ADDR 0x40
usb endpoint max num define
#define | EPT0_RX_ADDR 0x80
#define | EPT1_TX_ADDR 0xC0
#define | EPT1_RX_ADDR 0x100
#define | EPT2_TX_ADDR 0x140
#define | EPT2_RX_ADDR 0x180
#define | EPT3_TX_ADDR 0x00
#define | EPT3_RX_ADDR 0x00
#define | EPT4_TX_ADDR 0x00
#define | EPT4_RX_ADDR 0x00
#define | EPT5_TX_ADDR 0x00
#define | EPT5_RX_ADDR 0x00
#define | EPT6_TX_ADDR 0x00
#define | EPT6_RX_ADDR 0x00
#define | EPT7_TX_ADDR 0x00
#define | EPT7_RX_ADDR 0x00

Functions

void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.

Detailed Description

usb config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h.


AT32F413 Firmwary Library: src Directory Reference

  • usb_device
  • vcp_loopback
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • usb_device
  • vcp_loopback
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/vcp_loopback/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/usb_device/vcp_loopback/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • usb_device
  • vcp_loopback
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/vcp_loopback/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • usb_device
  • vcp_loopback
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include "usbd_core.h"
#include "cdc_class.h"
#include "cdc_desc.h"
#include "usbd_int.h"

Go to the source code of this file.

Functions

void | usb_clock48m_select (usb_clk48_s clk_s)
usb 48M clock select
int | main (void)
main function.
void | USBFS_L_CAN1_RX0_IRQHandler (void)
this function handles usb interrupt.
void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.

Variables

usbd_core_type usb_core_dev
uint8_t usb_buffer [256]

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/vcp_loopback/src/main.c.


AT32F413 Firmwary Library: virtual_comport Directory Reference

  • usb_device
  • virtual_comport
virtual_comport Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • usb_device
  • virtual_comport
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.
usb_conf.h
usb config header file


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • usb_device
  • virtual_comport
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • usb_device
  • virtual_comport
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • usb_device
  • virtual_comport
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_int.h.


AT32F413 Firmwary Library: usb_conf.h File Reference

  • usb_device
  • virtual_comport
  • inc
Macros | Functions
usb_conf.h File Reference

usb config header file More...

#include "at32f413.h"
#include "at32f413_board.h"
#include "stdio.h"

Go to the source code of this file.

Macros

#define | USB_VIRTUAL_COMPORT
usb endpoint max num define
#define | EPT0_TX_ADDR 0x40
user custom endpoint buffer EPTn_TX_ADDR, EPTn_RX_ADDR must less than usb buffer size
#define | EPT0_RX_ADDR 0x80
#define | EPT1_TX_ADDR 0xC0
#define | EPT1_RX_ADDR 0x100
#define | EPT2_TX_ADDR 0x140
#define | EPT2_RX_ADDR 0x180
#define | EPT3_TX_ADDR 0x00
#define | EPT3_RX_ADDR 0x00
#define | EPT4_TX_ADDR 0x00
#define | EPT4_RX_ADDR 0x00
#define | EPT5_TX_ADDR 0x00
#define | EPT5_RX_ADDR 0x00
#define | EPT6_TX_ADDR 0x00
#define | EPT6_RX_ADDR 0x00
#define | EPT7_TX_ADDR 0x00
#define | EPT7_RX_ADDR 0x00

Functions

void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.

Detailed Description

usb config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h.


AT32F413 Firmwary Library: src Directory Reference

  • usb_device
  • virtual_comport
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • usb_device
  • virtual_comport
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/virtual_comport/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/usb_device/virtual_comport/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • usb_device
  • virtual_comport
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/virtual_comport/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • usb_device
  • virtual_comport
  • src
Macros | Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include "usbd_core.h"
#include "cdc_class.h"
#include "cdc_desc.h"
#include "usbd_int.h"

Go to the source code of this file.

Macros

#define usart_buffer_size 2048

Functions

void | usb_usart_config (linecoding_type linecoding)
this function handles usart2 and linecoding config.
void | usart_gpio_config (void)
this function handles usart2 gpio config.
void | usart_send_data (uint8_t *send_data, uint16_t len)
this function handles usart2 send data.
uint16_t | usart_receive_data (void)
this function handles usart2 receive data.
void | usb_clock48m_select (usb_clk48_s clk_s)
usb 48M clock select
int | main (void)
main function.
void | USART2_IRQHandler (void)
this function handles usart2 handler.
void | USBFS_L_CAN1_RX0_IRQHandler (void)
this function handles usb interrupt.
void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.

Variables

usbd_core_type usb_core_dev
uint8_t | usb_buffer [256]
linecoding_type linecoding
uint8_t | usart_rx_buffer [2048]
uint16_t | hw_usart_rx_index = 0
uint16_t | hw_usart_read_index = 0
uint16_t | usart_rx_data_len = 0
uint16_t | ov_cnt = 0

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/virtual_comport/src/main.c.


AT32F413 Firmwary Library: virtual_msc_iap Directory Reference

  • usb_device
  • virtual_msc_iap
virtual_msc_iap Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • usb_device
  • virtual_msc_iap
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.
flash_fat16.h
fat16 file system header file
msc_diskio.h
usb mass storage disk interface header file
usb_conf.h
usb config header file


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • usb_device
  • virtual_msc_iap
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • usb_device
  • virtual_msc_iap
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • usb_device
  • virtual_msc_iap
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_int.h.


AT32F413 Firmwary Library: flash_fat16.h File Reference

  • usb_device
  • virtual_msc_iap
  • inc
Data Structures | Macros | Enumerations | Functions | Variables
flash_fat16.h File Reference

fat16 file system header file More...

#include "usb_conf.h"

Go to the source code of this file.

Data Structures

struct | fat_dir_type
struct | flash_iap_type

Macros

#define | FAT16_SECTOR_SIZE 62
#define | FAT16_TABLE_SIZE 4
#define | FAT16_BYTE_PER_SIZE 2048
#define | FAT16_FILENAME_SIZE 11
#define | FAT16_DIR_SIZE 47
#define | FLASH_FAT16_BOOT_SECTOR_ADDR 0x00
#define | FLASH_FAT16_1_ADDR 0x3000
#define | FLASH_FAT16_2_ADDR 0x3800
#define | FLASH_FAT16_ROOT_ADDR 0x4000
#define | FLASH_FAT16_FILE_START_ADDR 0x8800
#define | FLASH_APP_START_ADDR 0x08005000
#define | FLASH_SECTOR_1K_SIZE 0x400
#define | FLASH_SECTOR_2K_SIZE 0x800
#define | FLASH_SECTOR_4K_SIZE 0x1000
#define | FLASH_SECTOR_1K_ALLGNED 0x3FF
#define | FLASH_SECTOR_2K_ALLGNED 0x7FF
#define | FLASH_SECTOR_4K_ALLGNED 0xFFF
#define | FILE_SUFFIX1_LEN 3
#define | FILE_SUFFIX2_LEN 3
#define | FILE_SUFFIX1_NAME "BIN"
#define | FILE_SUFFIX2_NAME "bin"
#define | INVAILD_OFFSET_ADDR 0xFFFFFFFF
#define | IAP_UPGRADE_COMPLETE_FLAG 0x41544B38
#define | IAP_SUCCESS 0
#define | IAP_FAILED 1

Enumerations

enum upgrade_status_type {
UPGRADE_READY = 0 , UPGRAGE_ONGOING , UPGRADE_SUCCESS , UPGRADE_FAILED ,
UPGRADE_LARGE , UPGRADE_UNKNOWN , UPGRADE_DONE , UPGRADE_JUMP
}

Functions

uint32_t | flash_fat16_write (uint32_t fat_lbk, uint8_t *data, uint32_t len)
write a logical block address
uint32_t | flash_fat16_read (uint32_t fat_lbk, uint8_t *data, uint32_t len)
read a logical block address
void | flash_fat16_init (void)
flash fat16 iap init
void | flash_fat16_loop_status (void)
loop status
uint32_t | flash_fat16_set_name (const uint8_t *file_name, uint8_t len)
set file name
uint8_t | flash_fat16_get_upgrade_flag (void)
get iap upgrade complete flag

Variables

flash_iap_type flash_iap

Detailed Description

fat16 file system header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file flash_fat16.h.


AT32F413 Firmwary Library: msc_diskio.h File Reference

  • usb_device
  • virtual_msc_iap
  • inc
Macros | Functions
msc_diskio.h File Reference

usb mass storage disk interface header file More...

#include "usb_conf.h"
#include "usb_std.h"

Go to the source code of this file.

Macros

#define | INTERNAL_FLASH_LUN 0
#define | SPI_FLASH_LUN 1
#define | SD_LUN 2
#define | USB_FLASH_ADDR_OFFSET 0x08004000

Functions

uint8_t * | get_inquiry (uint8_t lun)
get disk inquiry
usb_sts_type | msc_disk_read (uint8_t lun, uint64_t addr, uint8_t *read_buf, uint32_t len)
disk read
usb_sts_type | msc_disk_write (uint8_t lun, uint64_t addr, uint8_t *buf, uint32_t len)
disk write
usb_sts_type | msc_disk_capacity (uint8_t lun, uint32_t *blk_nbr, uint32_t *blk_size)
disk capacity

Detailed Description

usb mass storage disk interface header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file virtual_msc_iap/inc/msc_diskio.h.


AT32F413 Firmwary Library: usb_conf.h File Reference

  • usb_device
  • virtual_msc_iap
  • inc
Macros | Functions
usb_conf.h File Reference

usb config header file More...

#include "at32f413.h"
#include "at32f413_board.h"
#include "stdio.h"

Go to the source code of this file.

Macros

#define USB_EPT_AUTO_MALLOC_BUFFER
usb endpoint max num define

Functions

void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.

Detailed Description

usb config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/usb_conf.h.


AT32F413 Firmwary Library: src Directory Reference

  • usb_device
  • virtual_msc_iap
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
flash_fat16.c
fat16 file system
main.c
main program
msc_diskio.c
usb mass storage disk function


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • usb_device
  • virtual_msc_iap
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/virtual_msc_iap/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/usb_device/virtual_msc_iap/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • usb_device
  • virtual_msc_iap
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/virtual_msc_iap/src/at32f413_int.c.


AT32F413 Firmwary Library: flash_fat16.c File Reference

  • usb_device
  • virtual_msc_iap
  • src
Macros | Functions | Variables
flash_fat16.c File Reference

fat16 file system More...

#include "flash_fat16.h"
#include "usb_conf.h"

Go to the source code of this file.

Macros

#define | FAT16_SECTOR_SIZE 62
#define | FAT16_CLUSTER_SIZE (4 * 0x800)
#define | FAT16_FIRST_CLUSTER (8 * 0x800)

Functions

uint32_t | flash_fat16_boot_dir_write (uint32_t fat_lbk, uint8_t *data, uint32_t len)
boot dir write
uint32_t | flash_fat16_sector_write (uint32_t fat_lbk, uint8_t *data, uint32_t len)
write sector
uint32_t | fat16_memory_copy (uint8_t *dst, const uint8_t *src, uint32_t len)
memory copy function
uint32_t | fat16_memory_memset (uint8_t *dst, uint32_t set, uint32_t len)
memset function
uint32_t | flash_write_data (uint32_t address, uint8_t *data, uint32_t len)
write data to flash
uint32_t | flash_read_data (uint32_t address, uint8_t *data, uint32_t len)
read data from flash
uint32_t | fat16_memory_cmp (uint8_t *dst, uint8_t *src, uint32_t len)
memory compare function
uint32_t | flash_crc_check (uint32_t address, uint8_t *data, uint32_t len)
crc check
void | flash_fat16_clear_upgrade_flag (void)
clear iap upgrade flag
void | flash_fat16_set_upgrade_flag (void)
set iap upgrade complete flag
uint8_t | flash_fat16_get_upgrade_flag (void)
get iap upgrade complete flag
uint32_t | flash_fat16_read (uint32_t fat_lbk, uint8_t *data, uint32_t len)
read a logical block address
uint32_t | flash_fat16_write (uint32_t fat_lbk, uint8_t *data, uint32_t len)
write a logical block address
uint32_t | flash_fat16_set_name (const uint8_t *file_name, uint8_t len)
set file name
uint32_t | flash_fat16_addr_offset (uint8_t *file_name)
get offset address
void | flash_fat16_init (void)
flash fat16 iap init

Variables

static uint8_t | fat16_sector [62]
const uint8_t | fat16_root_dir_sector [47]
const uint8_t | fat16_table_sector0 [4]
uint8_t | fat16_file_name [11]
fat_dir_type g_file_attr
flash_iap_type flash_iap
uint32_t | file_write_nr = 0
uint8_t | file_match = 0

Detailed Description

fat16 file system

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file flash_fat16.c.


AT32F413 Firmwary Library: main.c File Reference

  • usb_device
  • virtual_msc_iap
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include "usbd_core.h"
#include "msc_class.h"
#include "msc_desc.h"
#include "usbd_int.h"
#include "flash_fat16.h"

Go to the source code of this file.

Functions

void | jump_to_app (uint32_t address)
jump to app
void | usb_clock48m_select (usb_clk48_s clk_s)
usb 48M clock select
int | main (void)
main function.
void | usb_reset ()
usb re-connect
void | flash_fat16_loop_status (void)
loop status
void | USBFS_L_CAN1_RX0_IRQHandler (void)
this function handles usb interrupt.
void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.

Variables

usbd_core_type usb_core_dev
void(* | pftarget )(void)
uint32_t | stkptr
uint32_t | jumpaddr

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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

Definition in file project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c.


AT32F413 Firmwary Library: msc_diskio.c File Reference

  • usb_device
  • virtual_msc_iap
  • src
Functions | Variables
msc_diskio.c File Reference

usb mass storage disk function More...

#include "msc_diskio.h"
#include "msc_bot_scsi.h"
#include "flash_fat16.h"

Go to the source code of this file.

Functions

uint8_t * | get_inquiry (uint8_t lun)
get disk inquiry
usb_sts_type | msc_disk_read (uint8_t lun, uint64_t addr, uint8_t *read_buf, uint32_t len)
disk read
usb_sts_type | msc_disk_write (uint8_t lun, uint64_t addr, uint8_t *buf, uint32_t len)
disk write
usb_sts_type | msc_disk_capacity (uint8_t lun, uint32_t *blk_nbr, uint32_t *blk_size)
disk capacity

Variables

uint8_t scsi_inquiry [MSC_SUPPORT_MAX_LUN][SCSI_INQUIRY_DATA_LENGTH]

Detailed Description

usb mass storage disk function

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file virtual_msc_iap/src/msc_diskio.c.


AT32F413 Firmwary Library: winusb Directory Reference

  • usb_device
  • winusb
winusb Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • usb_device
  • winusb
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.
usb_conf.h
usb config header file


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • usb_device
  • winusb
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file project/at_start_f413/examples/usb_device/winusb/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • usb_device
  • winusb
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • usb_device
  • winusb
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file project/at_start_f413/examples/usb_device/winusb/inc/at32f413_int.h.


AT32F413 Firmwary Library: usb_conf.h File Reference

  • usb_device
  • winusb
  • inc
Macros | Functions
usb_conf.h File Reference

usb config header file More...

#include "at32f413.h"
#include "at32f413_board.h"
#include "stdio.h"

Go to the source code of this file.

Macros

#define | EPT0_TX_ADDR 0x40
usb endpoint max num define
#define | EPT0_RX_ADDR 0x80
#define | EPT1_TX_ADDR 0xC0
#define | EPT1_RX_ADDR 0x100
#define | EPT2_TX_ADDR 0x140
#define | EPT2_RX_ADDR 0x180
#define | EPT3_TX_ADDR 0x00
#define | EPT3_RX_ADDR 0x00
#define | EPT4_TX_ADDR 0x00
#define | EPT4_RX_ADDR 0x00
#define | EPT5_TX_ADDR 0x00
#define | EPT5_RX_ADDR 0x00
#define | EPT6_TX_ADDR 0x00
#define | EPT6_RX_ADDR 0x00
#define | EPT7_TX_ADDR 0x00
#define | EPT7_RX_ADDR 0x00
#define | USBD_SUPPORT_WINUSB 1
support winusb

Functions

void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.

Detailed Description

usb config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h.


AT32F413 Firmwary Library: src Directory Reference

  • usb_device
  • winusb
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • usb_device
  • winusb
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file project/at_start_f413/examples/usb_device/winusb/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/usb_device/winusb/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • usb_device
  • winusb
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file project/at_start_f413/examples/usb_device/winusb/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • usb_device
  • winusb
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include "usbd_core.h"
#include "winusb_class.h"
#include "winusb_desc.h"
#include "usbd_int.h"

Go to the source code of this file.

Functions

void | usb_clock48m_select (usb_clk48_s clk_s)
usb 48M clock select
int | main (void)
main function.
void | USBFS_L_CAN1_RX0_IRQHandler (void)
this function handles usb interrupt.
void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.

Variables

usbd_core_type usb_core_dev
uint8_t usb_buffer [256]

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file project/at_start_f413/examples/usb_device/winusb/src/main.c.


AT32F413 Firmwary Library: wdt Directory Reference

  • wdt
wdt Directory Reference

Directories

wdt_reset
wdt_standby


AT32F413 Firmwary Library: wdt_reset Directory Reference

  • wdt
  • wdt_reset
wdt_reset Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • wdt
  • wdt_reset
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • wdt
  • wdt_reset
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • wdt
  • wdt_reset
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • wdt
  • wdt_reset
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • wdt
  • wdt_reset
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • wdt
  • wdt_reset
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file project/at_start_f413/examples/wdt/wdt_reset/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/wdt/wdt_reset/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • wdt
  • wdt_reset
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file project/at_start_f413/examples/wdt/wdt_reset/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • wdt
  • wdt_reset
  • src
Functions
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

int main (void)
main function.

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file project/at_start_f413/examples/wdt/wdt_reset/src/main.c.


AT32F413 Firmwary Library: wdt_standby Directory Reference

  • wdt
  • wdt_standby
wdt_standby Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • wdt
  • wdt_standby
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • wdt
  • wdt_standby
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • wdt
  • wdt_standby
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • wdt
  • wdt_standby
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • wdt
  • wdt_standby
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • wdt
  • wdt_standby
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file project/at_start_f413/examples/wdt/wdt_standby/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/wdt/wdt_standby/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • wdt
  • wdt_standby
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file project/at_start_f413/examples/wdt/wdt_standby/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • wdt
  • wdt_standby
  • src
Functions
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

int main (void)
main function.

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file project/at_start_f413/examples/wdt/wdt_standby/src/main.c.


AT32F413 Firmwary Library: wwdt Directory Reference

  • wwdt
wwdt Directory Reference

Directories

wwdt_reset


AT32F413 Firmwary Library: wwdt_reset Directory Reference

  • wwdt
  • wwdt_reset
wwdt_reset Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • wwdt
  • wwdt_reset
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • wwdt
  • wwdt_reset
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • wwdt
  • wwdt_reset
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • wwdt
  • wwdt_reset
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • wwdt
  • wwdt_reset
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • wwdt
  • wwdt_reset
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file project/at_start_f413/examples/wwdt/wwdt_reset/src/at32f413_clock.c.

Function Documentation

◆ system_clock_config()

void system_clock_config ( void )

system clock config program

Note
the system clock is configured as follow: system clock (sclk) = hext / 2 * pll_mult system clock source = pll (hext)
  • hext = HEXT_VALUE
  • sclk = 192000000
  • ahbdiv = 1
  • ahbclk = 192000000
  • apb2div = 2
  • apb2clk = 96000000
  • apb1div = 2
  • apb1clk = 96000000
  • pll_mult = 48
  • pll_range = GT72MHZ (greater than 72 mhz)
Parameters
none
Return values
none

< phase locking loop stable flag

Definition at line 47 of file project/at_start_f413/examples/wwdt/wwdt_reset/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • wwdt
  • wwdt_reset
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file project/at_start_f413/examples/wwdt/wwdt_reset/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • wwdt
  • wwdt_reset
  • src
Functions
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Functions

int main (void)
main function.

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file project/at_start_f413/examples/wwdt/wwdt_reset/src/main.c.


AT32F413 Firmwary Library: templates Directory Reference

  • templates
templates Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • templates
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • templates
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file project/at_start_f413/templates/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • templates
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file project/at_start_f413/templates/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • templates
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file project/at_start_f413/templates/inc/at32f413_int.h.


AT32F413 Firmwary Library: src Directory Reference

  • templates
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • templates
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file project/at_start_f413/templates/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • templates
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file project/at_start_f413/templates/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • templates
  • src
Macros | Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"

Go to the source code of this file.

Macros

#define | DELAY 100
#define | FAST 1
#define | SLOW 4

Functions

void | button_exint_init (void)
configure button exint
void | button_isr (void)
button handler function
void | EXINT0_IRQHandler (void)
exint0 interrupt handler
int | main (void)
main function.

Variables

uint8_t g_speed = 1

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file project/at_start_f413/templates/src/main.c.


AT32F413 Firmwary Library: utilities Directory Reference

  • utilities
utilities Directory Reference

Directories

at32f413_freertos_demo
at32f413_gen_random_number_demo
at32f413_slib_demo
at32f413_usart_iap_demo
at32f413_usb_iap_demo


AT32F413 Firmwary Library: at32f413_freertos_demo Directory Reference

  • utilities
  • at32f413_freertos_demo
at32f413_freertos_demo Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • utilities
  • at32f413_freertos_demo
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.
FreeRTOSConfig.h


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • utilities
  • at32f413_freertos_demo
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_freertos_demo/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • utilities
  • at32f413_freertos_demo
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_freertos_demo/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file utilities/at32f413_freertos_demo/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file utilities/at32f413_freertos_demo/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file utilities/at32f413_freertos_demo/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file utilities/at32f413_freertos_demo/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file utilities/at32f413_freertos_demo/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file utilities/at32f413_freertos_demo/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file utilities/at32f413_freertos_demo/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file utilities/at32f413_freertos_demo/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file utilities/at32f413_freertos_demo/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file utilities/at32f413_freertos_demo/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file utilities/at32f413_freertos_demo/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file utilities/at32f413_freertos_demo/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file utilities/at32f413_freertos_demo/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file utilities/at32f413_freertos_demo/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file utilities/at32f413_freertos_demo/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file utilities/at32f413_freertos_demo/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file utilities/at32f413_freertos_demo/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file utilities/at32f413_freertos_demo/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file utilities/at32f413_freertos_demo/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file utilities/at32f413_freertos_demo/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file utilities/at32f413_freertos_demo/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file utilities/at32f413_freertos_demo/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file utilities/at32f413_freertos_demo/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file utilities/at32f413_freertos_demo/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file utilities/at32f413_freertos_demo/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file utilities/at32f413_freertos_demo/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • utilities
  • at32f413_freertos_demo
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_freertos_demo/inc/at32f413_int.h.


AT32F413 Firmwary Library: FreeRTOSConfig.h File Reference

  • utilities
  • at32f413_freertos_demo
  • inc
Macros
FreeRTOSConfig.h File Reference

Go to the source code of this file.

Macros

#define | configUSE_PREEMPTION 1
#define | configUSE_IDLE_HOOK 0
#define | configUSE_TICK_HOOK 0
#define | configCPU_CLOCK_HZ ( ( unsigned long ) system_core_clock )
#define | configTICK_RATE_HZ ( ( TickType_t ) 1000 )
#define | configMAX_PRIORITIES ( 5 )
#define | configMINIMAL_STACK_SIZE ( ( unsigned short ) 128 )
#define | configSUPPORT_DYNAMIC_ALLOCATION 1
#define | configTOTAL_HEAP_SIZE ( ( size_t ) ( 8 * 1024 ) )
#define | configMAX_TASK_NAME_LEN ( 16 )
#define | configUSE_16_BIT_TICKS 0
#define | configIDLE_SHOULD_YIELD 1
#define | configUSE_CO_ROUTINES 0
#define | configMAX_CO_ROUTINE_PRIORITIES ( 2 )
#define | INCLUDE_vTaskPrioritySet 1
#define | INCLUDE_uxTaskPriorityGet 1
#define | INCLUDE_vTaskDelete 1
#define | INCLUDE_vTaskCleanUpResources 0
#define | INCLUDE_vTaskSuspend 1
#define | INCLUDE_vTaskDelayUntil 1
#define | INCLUDE_vTaskDelay 1
#define | INCLUDE_xTaskGetCurrentTaskHandle 1
#define | configPRIO_BITS 4 /* 15 priority levels */
#define | configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0x0f
#define | configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 0x01
#define | configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
#define | configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
#define | configASSERT(x)
#define | vPortSVCHandler SVC_Handler
#define | xPortPendSVHandler PendSV_Handler
#define | xPortSysTickHandler SysTick_Handler

Macro Definition Documentation

◆ configASSERT

#define configASSERT ( x )
Value:
if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); }

Definition at line 151 of file FreeRTOSConfig.h.

◆ configCPU_CLOCK_HZ

#define configCPU_CLOCK_HZ ( ( unsigned long ) system_core_clock )

Definition at line 98 of file FreeRTOSConfig.h.

◆ configIDLE_SHOULD_YIELD

#define configIDLE_SHOULD_YIELD 1

Definition at line 106 of file FreeRTOSConfig.h.

◆ configKERNEL_INTERRUPT_PRIORITY

#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )

Definition at line 144 of file FreeRTOSConfig.h.

◆ configLIBRARY_LOWEST_INTERRUPT_PRIORITY

#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0x0f

Definition at line 134 of file FreeRTOSConfig.h.

◆ configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY

#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 0x01

Definition at line 140 of file FreeRTOSConfig.h.

◆ configMAX_CO_ROUTINE_PRIORITIES

#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )

Definition at line 111 of file FreeRTOSConfig.h.

◆ configMAX_PRIORITIES

#define configMAX_PRIORITIES ( 5 )

Definition at line 100 of file FreeRTOSConfig.h.

◆ configMAX_SYSCALL_INTERRUPT_PRIORITY

#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )

Definition at line 147 of file FreeRTOSConfig.h.

◆ configMAX_TASK_NAME_LEN

#define configMAX_TASK_NAME_LEN ( 16 )

Definition at line 104 of file FreeRTOSConfig.h.

◆ configMINIMAL_STACK_SIZE

#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 128 )

Definition at line 101 of file FreeRTOSConfig.h.

◆ configPRIO_BITS

#define configPRIO_BITS 4 /* 15 priority levels */

Definition at line 129 of file FreeRTOSConfig.h.

◆ configSUPPORT_DYNAMIC_ALLOCATION

#define configSUPPORT_DYNAMIC_ALLOCATION 1

Definition at line 102 of file FreeRTOSConfig.h.

◆ configTICK_RATE_HZ

#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )

Definition at line 99 of file FreeRTOSConfig.h.

◆ configTOTAL_HEAP_SIZE

#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 8 * 1024 ) )

Definition at line 103 of file FreeRTOSConfig.h.

◆ configUSE_16_BIT_TICKS

#define configUSE_16_BIT_TICKS 0

Definition at line 105 of file FreeRTOSConfig.h.

◆ configUSE_CO_ROUTINES

#define configUSE_CO_ROUTINES 0

Definition at line 110 of file FreeRTOSConfig.h.

◆ configUSE_IDLE_HOOK

#define configUSE_IDLE_HOOK 0

Definition at line 96 of file FreeRTOSConfig.h.

◆ configUSE_PREEMPTION

#define configUSE_PREEMPTION 1

Definition at line 95 of file FreeRTOSConfig.h.

◆ configUSE_TICK_HOOK

#define configUSE_TICK_HOOK 0

Definition at line 97 of file FreeRTOSConfig.h.

◆ INCLUDE_uxTaskPriorityGet

#define INCLUDE_uxTaskPriorityGet 1

Definition at line 117 of file FreeRTOSConfig.h.

◆ INCLUDE_vTaskCleanUpResources

#define INCLUDE_vTaskCleanUpResources 0

Definition at line 119 of file FreeRTOSConfig.h.

◆ INCLUDE_vTaskDelay

#define INCLUDE_vTaskDelay 1

Definition at line 122 of file FreeRTOSConfig.h.

◆ INCLUDE_vTaskDelayUntil

#define INCLUDE_vTaskDelayUntil 1

Definition at line 121 of file FreeRTOSConfig.h.

◆ INCLUDE_vTaskDelete

#define INCLUDE_vTaskDelete 1

Definition at line 118 of file FreeRTOSConfig.h.

◆ INCLUDE_vTaskPrioritySet

#define INCLUDE_vTaskPrioritySet 1

Definition at line 116 of file FreeRTOSConfig.h.

◆ INCLUDE_vTaskSuspend

#define INCLUDE_vTaskSuspend 1

Definition at line 120 of file FreeRTOSConfig.h.

◆ INCLUDE_xTaskGetCurrentTaskHandle

#define INCLUDE_xTaskGetCurrentTaskHandle 1

Definition at line 123 of file FreeRTOSConfig.h.

◆ vPortSVCHandler

#define vPortSVCHandler SVC_Handler

Definition at line 155 of file FreeRTOSConfig.h.

◆ xPortPendSVHandler

#define xPortPendSVHandler PendSV_Handler

Definition at line 156 of file FreeRTOSConfig.h.

◆ xPortSysTickHandler

#define xPortSysTickHandler SysTick_Handler

Definition at line 157 of file FreeRTOSConfig.h.


AT32F413 Firmwary Library: src Directory Reference

  • utilities
  • at32f413_freertos_demo
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
include_port.c
include_port program
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • utilities
  • at32f413_freertos_demo
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_freertos_demo/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • utilities
  • at32f413_freertos_demo
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | DebugMon_Handler (void)
this function handles svcall exception.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_freertos_demo/src/at32f413_int.c.


AT32F413 Firmwary Library: include_port.c File Reference

  • utilities
  • at32f413_freertos_demo
  • src
include_port.c File Reference

include_port program More...

#include "..\..\..\middlewares\freertos\source\portable\rvds\ARM_CM4F\port.c"

Go to the source code of this file.

Detailed Description

include_port program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file include_port.c.


AT32F413 Firmwary Library: main.c File Reference

  • utilities
  • at32f413_freertos_demo
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include "FreeRTOS.h"
#include "task.h"

Go to the source code of this file.

Functions

void | led2_task_function (void *pvParameters)
void | led3_task_function (void *pvParameters)
int | main (void)
main function.

Variables

TaskHandle_t | led2_handler
TaskHandle_t | led3_handler

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_freertos_demo/src/main.c.


AT32F413 Firmwary Library: at32f413_gen_random_number_demo Directory Reference

  • utilities
  • at32f413_gen_random_number_demo
at32f413_gen_random_number_demo Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • utilities
  • at32f413_gen_random_number_demo
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.
random.h
at32f413 random header file


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • utilities
  • at32f413_gen_random_number_demo
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_gen_random_number_demo/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • utilities
  • at32f413_gen_random_number_demo
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • utilities
  • at32f413_gen_random_number_demo
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_gen_random_number_demo/inc/at32f413_int.h.


AT32F413 Firmwary Library: random.h File Reference

  • utilities
  • at32f413_gen_random_number_demo
  • inc
Macros | Functions
random.h File Reference

at32f413 random header file More...

#include "at32f413.h"

Go to the source code of this file.

Macros

#define ENABLE_RTC_ASSEED (1)

Functions

void randnum_test (void)
enable rtc as seed

Detailed Description

at32f413 random header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file random.h.


AT32F413 Firmwary Library: src Directory Reference

  • utilities
  • at32f413_gen_random_number_demo
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program
random.c
set of firmware functions to random function


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • utilities
  • at32f413_gen_random_number_demo
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_gen_random_number_demo/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • utilities
  • at32f413_gen_random_number_demo
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_gen_random_number_demo/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • utilities
  • at32f413_gen_random_number_demo
  • src
Functions
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include "stdio.h"
#include "random.h"

Go to the source code of this file.

Functions

int main (void)
main function.

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_gen_random_number_demo/src/main.c.


AT32F413 Firmwary Library: random.c File Reference

  • utilities
  • at32f413_gen_random_number_demo
  • src
Macros | Functions
random.c File Reference

set of firmware functions to random function More...

#include "at32f413_board.h"
#include "random.h"
#include "stdio.h"
#include <stdlib.h>

Go to the source code of this file.

Macros

#define DEVICE_ID_ADDR1 0x1FFFF7E8

Functions

int | get_uid_for_seed (void)
get uid value as seed
void | randnum_test (void)
enable rtc as seed

Detailed Description

set of firmware functions to random function

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file random.c.


AT32F413 Firmwary Library: at32f413_slib_demo Directory Reference

  • utilities
  • at32f413_slib_demo
at32f413_slib_demo Directory Reference

Directories

project_l0
project_l1


AT32F413 Firmwary Library: project_l0 Directory Reference

  • utilities
  • at32f413_slib_demo
  • project_l0
project_l0 Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • utilities
  • at32f413_slib_demo
  • project_l0
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.
fir_filter.h
math_helper.h


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • utilities
  • at32f413_slib_demo
  • project_l0
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_slib_demo/project_l0/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • utilities
  • at32f413_slib_demo
  • project_l0
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • utilities
  • at32f413_slib_demo
  • project_l0
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_slib_demo/project_l0/inc/at32f413_int.h.


AT32F413 Firmwary Library: fir_filter.h File Reference

  • utilities
  • at32f413_slib_demo
  • project_l0
  • inc
Functions
fir_filter.h File Reference
#include "arm_math.h"

Go to the source code of this file.

Functions

void | arm_fir_init_f32 (arm_fir_instance_f32 *S, uint16_t numTaps, const float32_t *pCoeffs, float32_t *pState, uint32_t blockSize)
Initialization function for the floating-point FIR filter.
void | arm_fir_f32 (const arm_fir_instance_f32 *S, const float32_t *pSrc, float32_t *pDst, uint32_t blockSize)
void | FIR_lowpass_filter (float32_t *pSrc, float32_t *pDst, uint32_t testlengthsamples)

Function Documentation

◆ arm_fir_f32()

void arm_fir_f32 | ( | const arm_fir_instance_f32 * | S,
 |  | const float32_t * | pSrc,
 |  | float32_t * | pDst,
 |  | uint32_t | blockSize )

Referenced by FIR_lowpass_filter().

◆ arm_fir_init_f32()

void arm_fir_init_f32 | ( | arm_fir_instance_f32 * | S,
 |  | uint16_t | numTaps,
 |  | const float32_t * | pCoeffs,
 |  | float32_t * | pState,
 |  | uint32_t | blockSize )

Initialization function for the floating-point FIR filter.

File : Step1-ST_Customer_level_n/Inc/fir_filter.h Version: V1.3.0 Date : 2021-03-18 Brief : This file contains the headers of FIR filter IP-Code.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. may be used to endorse or promote products derived from this software without specific prior written permission.

AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Parameters
[in,out] | S | points to an instance of the floating-point FIR filter structure
[in] | numTaps | number of filter coefficients in the filter
[in] | pCoeffs | points to the filter coefficients buffer
[in] | pState | points to the state buffer
[in] | blockSize | number of samples processed per call
Returns
none
Details
pCoeffs points to the array of filter coefficients stored in time reversed order:
    {b[numTaps-1], b[numTaps-2], b[N-2], ..., b[1], b[0]}
pState points to the array of state variables. pState is of length numTaps+blockSize-1 samples, where blockSize is the number of input samples processed by each call to arm_fir_f32().
Initialization of Helium version
For Helium version the array of coefficients must be a multiple of 16 even if less then 16 coefficients are used. The additional coefficients must be set to 0. It does not mean that all the coefficients will be used in the filter (numTaps is still set to its right value in the init function.) It just means that the implementation may require to read more coefficients due to the vectorization and to avoid having to manage too many different cases in the code.

Definition at line 59 of file arm_fir_init_f32.c.

Referenced by FIR_lowpass_filter().

◆ FIR_lowpass_filter()

void FIR_lowpass_filter | ( | float32_t * | pSrc,
 |  | float32_t * | pDst,
 |  | uint32_t | testlengthsamples )

Definition at line 76 of file fir_filter.c.

Referenced by main().


AT32F413 Firmwary Library: math_helper.h File Reference

  • utilities
  • at32f413_slib_demo
  • project_l0
  • inc
Functions
math_helper.h File Reference
#include "arm_math.h"

Go to the source code of this file.

Functions

float | arm_snr_f32 (float *pRef, float *pTest, uint32_t buffSize)
Caluclation of SNR.
void | arm_float_to_q12_20 (float *pIn, q31_t *pOut, uint32_t numSamples)
Converts float to fixed in q12.20 format.
void | arm_provide_guard_bits_q15 (q15_t *input_buf, uint32_t blockSize, uint32_t guard_bits)
Provide guard bits for Input buffer.
void | arm_provide_guard_bits_q31 (q31_t *input_buf, uint32_t blockSize, uint32_t guard_bits)
Provide guard bits for Input buffer.
void | arm_float_to_q14 (float *pIn, q15_t *pOut, uint32_t numSamples)
Converts float to fixed q14.
void | arm_float_to_q29 (float *pIn, q31_t *pOut, uint32_t numSamples)
Converts float to fixed q30 format.
void | arm_float_to_q28 (float *pIn, q31_t *pOut, uint32_t numSamples)
Converts float to fixed q28 format.
void | arm_float_to_q30 (float *pIn, q31_t *pOut, uint32_t numSamples)
Converts float to fixed q30 format.
uint32_t | arm_calc_guard_bits (uint32_t num_adds)
Caluclates number of guard bits.
void | arm_apply_guard_bits (float32_t *pIn, uint32_t numSamples, uint32_t guard_bits)
Apply guard bits to buffer.
uint32_t | arm_compare_fixed_q15 (q15_t *pIn, q15_t *pOut, uint32_t numSamples)
Compare MATLAB Reference Output and ARM Test output.
uint32_t | arm_compare_fixed_q31 (q31_t *pIn, q31_t *pOut, uint32_t numSamples)
Compare MATLAB Reference Output and ARM Test output.
uint32_t | arm_calc_2pow (uint32_t guard_bits)
Calculates pow(2, numShifts)

Function Documentation

◆ arm_apply_guard_bits()

void arm_apply_guard_bits | ( | float32_t * | pIn,
 |  | uint32_t | numSamples,
 |  | uint32_t | guard_bits )

Apply guard bits to buffer.

Parameters
[in,out] | pIn | pointer to input buffer
[in] | numSamples | number of samples in the input buffer
[in] | guard_bits | guard bits
Returns
none

Definition at line 294 of file project_l0/src/math_helper.c.

◆ arm_calc_2pow()

uint32_t arm_calc_2pow ( uint32_t numShifts )

Calculates pow(2, numShifts)

Parameters
[in] numShifts number of shifts
Returns
pow(2, numShifts)

Definition at line 311 of file project_l0/src/math_helper.c.

◆ arm_calc_guard_bits()

uint32_t arm_calc_guard_bits ( uint32_t num_adds )

Caluclates number of guard bits.

Parameters
[in] num_adds number of additions
Returns
guard bits The function Caluclates the number of guard bits depending on the numtaps

Definition at line 268 of file project_l0/src/math_helper.c.

◆ arm_compare_fixed_q15()

uint32_t arm_compare_fixed_q15 | ( | q15_t * | pIn,
 |  | q15_t * | pOut,
 |  | uint32_t | numSamples )

Compare MATLAB Reference Output and ARM Test output.

Parameters
[in] | pIn | Pointer to Ref buffer
[in] | pOut | Pointer to Test buffer
[in] | numSamples | number of samples in the buffer
Returns
maximum difference

Definition at line 166 of file project_l0/src/math_helper.c.

◆ arm_compare_fixed_q31()

uint32_t arm_compare_fixed_q31 | ( | q31_t * | pIn,
 |  | q31_t * | pOut,
 |  | uint32_t | numSamples )

Compare MATLAB Reference Output and ARM Test output.

Parameters
[in] | pIn | Pointer to Ref buffer
[in] | pOut | Pointer to Test buffer
[in] | numSamples | number of samples in the buffer
Returns
maximum difference

Definition at line 194 of file project_l0/src/math_helper.c.

◆ arm_float_to_q12_20()

void arm_float_to_q12_20 | ( | float * | pIn,
 |  | q31_t * | pOut,
 |  | uint32_t | numSamples )

Converts float to fixed in q12.20 format.

Parameters
[in] | pIn | pointer to input buffer
[out] | pOut | pointer to outputbuffer
[in] | numSamples | number of samples in the input buffer
Returns
none The function converts floating point values to fixed point(q12.20) values

Definition at line 140 of file project_l0/src/math_helper.c.

◆ arm_float_to_q14()

void arm_float_to_q14 | ( | float * | pIn,
 |  | q15_t * | pOut,
 |  | uint32_t | numSamples )

Converts float to fixed q14.

Parameters
[in] | pIn | pointer to input buffer
[out] | pOut | pointer to output buffer
[in] | numSamples | number of samples in the buffer
Returns
none The function converts floating point values to fixed point values

Definition at line 335 of file project_l0/src/math_helper.c.

◆ arm_float_to_q28()

void arm_float_to_q28 | ( | float * | pIn,
 |  | q31_t * | pOut,
 |  | uint32_t | numSamples )

Converts float to fixed q28 format.

Parameters
[in] | pIn | pointer to input buffer
[out] | pOut | pointer to output buffer
[in] | numSamples | number of samples in the buffer
Returns
none The function converts floating point values to fixed point values

Definition at line 420 of file project_l0/src/math_helper.c.

◆ arm_float_to_q29()

void arm_float_to_q29 | ( | float * | pIn,
 |  | q31_t * | pOut,
 |  | uint32_t | numSamples )

Converts float to fixed q30 format.

Parameters
[in] | pIn | pointer to input buffer
[out] | pOut | pointer to output buffer
[in] | numSamples | number of samples in the buffer
Returns
none The function converts floating point values to fixed point values

Definition at line 392 of file project_l0/src/math_helper.c.

◆ arm_float_to_q30()

void arm_float_to_q30 | ( | float * | pIn,
 |  | q31_t * | pOut,
 |  | uint32_t | numSamples )

Converts float to fixed q30 format.

Parameters
[in] | pIn | pointer to input buffer
[out] | pOut | pointer to output buffer
[in] | numSamples | number of samples in the buffer
Returns
none The function converts floating point values to fixed point values

Definition at line 365 of file project_l0/src/math_helper.c.

◆ arm_provide_guard_bits_q15()

void arm_provide_guard_bits_q15 | ( | q15_t * | input_buf,
 |  | uint32_t | blockSize,
 |  | uint32_t | guard_bits )

Provide guard bits for Input buffer.

Parameters
[in,out] | input_buf | Pointer to input buffer
[in] | blockSize | block Size
[in] | guard_bits | guard bits
Returns
none The function Provides the guard bits for the buffer to avoid overflow

Definition at line 120 of file project_l0/src/math_helper.c.

◆ arm_provide_guard_bits_q31()

void arm_provide_guard_bits_q31 | ( | q31_t * | input_buf,
 |  | uint32_t | blockSize,
 |  | uint32_t | guard_bits )

Provide guard bits for Input buffer.

Parameters
[in,out] | input_buf | Pointer to input buffer
[in] | blockSize | block Size
[in] | guard_bits | guard bits
Returns
none The function Provides the guard bits for the buffer to avoid overflow

Definition at line 224 of file project_l0/src/math_helper.c.

◆ arm_snr_f32()

float arm_snr_f32 | ( | float * | pRef,
 |  | float * | pTest,
 |  | uint32_t | buffSize )

Caluclation of SNR.

Parameters
[in] | pRef | Pointer to the reference buffer
[in] | pTest | Pointer to the test buffer
[in] | buffSize | total number of samples
Returns
SNR The function Caluclates signal to noise ratio for the reference output and test output

Definition at line 62 of file project_l0/src/math_helper.c.

Referenced by main().


AT32F413 Firmwary Library: src Directory Reference

  • utilities
  • at32f413_slib_demo
  • project_l0
  • src
src Directory Reference

Files

arm_fir_data.c
arm_fir_init_f32.c
at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
fir_coefficient.c
fir_filter.c
main.c
main program
math_helper.c


AT32F413 Firmwary Library: arm_fir_data.c File Reference

  • utilities
  • at32f413_slib_demo
  • project_l0
  • src
Variables
arm_fir_data.c File Reference
#include "at32f413.h"
#include "arm_math.h"

Go to the source code of this file.

Variables

float32_t | testInput_f32_1kHz_15kHz [320]
float32_t | refOutput [320]

Variable Documentation

◆ refOutput

float32_t refOutput[320]

Definition at line 96 of file project_l0/src/arm_fir_data.c.

◆ testInput_f32_1kHz_15kHz

float32_t testInput_f32_1kHz_15kHz[320]

Definition at line 48 of file project_l0/src/arm_fir_data.c.


AT32F413 Firmwary Library: arm_fir_init_f32.c File Reference

  • utilities
  • at32f413_slib_demo
  • project_l0
  • src
Functions
arm_fir_init_f32.c File Reference
#include "arm_math.h"

Go to the source code of this file.

Functions

void * | my_memset (void *s, int c, size_t n)
void | arm_fir_init_f32 (arm_fir_instance_f32 *S, uint16_t numTaps, const float32_t *pCoeffs, float32_t *pState, uint32_t blockSize)
Initialization function for the floating-point FIR filter.

Function Documentation

◆ arm_fir_init_f32()

void arm_fir_init_f32 | ( | arm_fir_instance_f32 * | S,
 |  | uint16_t | numTaps,
 |  | const float32_t * | pCoeffs,
 |  | float32_t * | pState,
 |  | uint32_t | blockSize )

Initialization function for the floating-point FIR filter.

Parameters
[in,out] | S | points to an instance of the floating-point FIR filter structure
[in] | numTaps | number of filter coefficients in the filter
[in] | pCoeffs | points to the filter coefficients buffer
[in] | pState | points to the state buffer
[in] | blockSize | number of samples processed per call
Returns
none
Details
pCoeffs points to the array of filter coefficients stored in time reversed order:
    {b[numTaps-1], b[numTaps-2], b[N-2], ..., b[1], b[0]}
pState points to the array of state variables. pState is of length numTaps+blockSize-1 samples, where blockSize is the number of input samples processed by each call to arm_fir_f32().
Initialization of Helium version
For Helium version the array of coefficients must be a multiple of 16 even if less then 16 coefficients are used. The additional coefficients must be set to 0. It does not mean that all the coefficients will be used in the filter (numTaps is still set to its right value in the init function.) It just means that the implementation may require to read more coefficients due to the vectorization and to avoid having to manage too many different cases in the code.

Definition at line 59 of file arm_fir_init_f32.c.

Referenced by FIR_lowpass_filter().

◆ my_memset()

void * my_memset | ( | void * | s,
 |  | int | c,
 |  | size_t | n )

Definition at line 79 of file arm_fir_init_f32.c.

Referenced by arm_fir_init_f32().


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • utilities
  • at32f413_slib_demo
  • project_l0
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_slib_demo/project_l0/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • utilities
  • at32f413_slib_demo
  • project_l0
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"
#include "at32f413_board.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | FLASH_IRQHandler (void)
flash handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_slib_demo/project_l0/src/at32f413_int.c.


AT32F413 Firmwary Library: fir_coefficient.c File Reference

  • utilities
  • at32f413_slib_demo
  • project_l0
  • src
Macros | Variables
fir_coefficient.c File Reference
#include "at32f413.h"
#include "arm_math.h"
#include "fir_filter.h"

Go to the source code of this file.

Macros

#define NUM_TAPS 29

Variables

const float32_t firCoeffs32 [29]

Macro Definition Documentation

◆ NUM_TAPS

#define NUM_TAPS 29

Definition at line 51 of file fir_coefficient.c.

Variable Documentation

◆ firCoeffs32

const float32_t firCoeffs32[29]
Initial value:
= {
-0.0018225230f, -0.0015879294f, +0.0000000000f, +0.0036977508f, +0.0080754303f, +0.0085302217f, -0.0000000000f, -0.0173976984f,
-0.0341458607f, -0.0333591565f, +0.0000000000f, +0.0676308395f, +0.1522061835f, +0.2229246956f, +0.2504960933f, +0.2229246956f,
+0.1522061835f, +0.0676308395f, +0.0000000000f, -0.0333591565f, -0.0341458607f, -0.0173976984f, -0.0000000000f, +0.0085302217f,
+0.0080754303f, +0.0036977508f, +0.0000000000f, -0.0015879294f, -0.0018225230f
}

Definition at line 62 of file fir_coefficient.c.

Referenced by FIR_lowpass_filter().


AT32F413 Firmwary Library: fir_filter.c File Reference

  • utilities
  • at32f413_slib_demo
  • project_l0
  • src
Macros | Functions | Variables
fir_filter.c File Reference
#include "at32f413.h"
#include "arm_math.h"
#include "fir_filter.h"

Go to the source code of this file.

Macros

#define | BLOCK_SIZE 32
#define | NUM_TAPS 29

Functions

void FIR_lowpass_filter (float32_t *pSrc, float32_t *pDst, uint32_t testlengthsamples)

Variables

const float32_t | firCoeffs32 []
static float32_t | firStateF32 [32+29 - 1]

Macro Definition Documentation

◆ BLOCK_SIZE

#define BLOCK_SIZE 32

Definition at line 53 of file fir_filter.c.

Referenced by FIR_lowpass_filter().

◆ NUM_TAPS

#define NUM_TAPS 29

Definition at line 54 of file fir_filter.c.

Referenced by FIR_lowpass_filter().

Function Documentation

◆ FIR_lowpass_filter()

void FIR_lowpass_filter | ( | float32_t * | pSrc,
 |  | float32_t * | pDst,
 |  | uint32_t | testlengthsamples )

Definition at line 76 of file fir_filter.c.

Referenced by main().

Variable Documentation

◆ firCoeffs32

const float32_t firCoeffs32[]
extern

Definition at line 62 of file fir_coefficient.c.

Referenced by FIR_lowpass_filter().

◆ firStateF32

float32_t firStateF32[32+29 - 1]
static

Definition at line 66 of file fir_filter.c.

Referenced by FIR_lowpass_filter().


AT32F413 Firmwary Library: main.c File Reference

  • utilities
  • at32f413_slib_demo
  • project_l0
  • src
Macros | Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include <stdio.h>
#include "math_helper.h"
#include "fir_filter.h"

Go to the source code of this file.

Macros

#define | USE_SLIB_FUNCTION /* define it when user want to activate slib in this project */
#define | FLASH_START_ADDR 0x08000000
#define | TEST_SLIB_PSW 0x55665566
#define | SLIB_START_ADDR 0x0800D800
#define | SLIB_DATA_ADDR 0x0800E800
#define | SLIB_END_ADDR 0x0800F000
#define | FLASH_SECTOR_SIZE 0x800
#define | SECTOR_NUM(dwAddr)
#define | SECTOR_WORD_CNT (FLASH_SECTOR_SIZE >> 2) /* words per sector */
#define | SNR_THRESHOLD_F32 140.0f
#define | TEST_LENGTH_SAMPLES 320

Functions

flash_status_type | slib_enable (void)
config slib enable and program slib area.
void | config_flash_interrupt (void)
config flash error interrupt.
int | main (void)
main function.

Variables

float32_t | testInput_f32_1kHz_15kHz []
float32_t | refOutput []
uint32_t | dw_start_sector
uint32_t | dw_data_start_sector
uint32_t | dw_end_sector
uint32_t | temp_buf [512]
static float32_t | testOutput [320]

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_slib_demo/project_l0/src/main.c.

Variable Documentation

◆ refOutput

float32_t refOutput[]
extern

Definition at line 96 of file project_l0/src/arm_fir_data.c.

Referenced by main().

◆ testInput_f32_1kHz_15kHz

float32_t testInput_f32_1kHz_15kHz[]
extern

Definition at line 48 of file project_l0/src/arm_fir_data.c.

Referenced by main().


AT32F413 Firmwary Library: math_helper.c File Reference

  • utilities
  • at32f413_slib_demo
  • project_l0
  • src
Functions
math_helper.c File Reference
#include <math.h>
#include "math_helper.h"

Go to the source code of this file.

Functions

float | arm_snr_f32 (float *pRef, float *pTest, uint32_t buffSize)
Caluclation of SNR.
void | arm_provide_guard_bits_q15 (q15_t *input_buf, uint32_t blockSize, uint32_t guard_bits)
Provide guard bits for Input buffer.
void | arm_float_to_q12_20 (float *pIn, q31_t *pOut, uint32_t numSamples)
Converts float to fixed in q12.20 format.
uint32_t | arm_compare_fixed_q15 (q15_t *pIn, q15_t *pOut, uint32_t numSamples)
Compare MATLAB Reference Output and ARM Test output.
uint32_t | arm_compare_fixed_q31 (q31_t *pIn, q31_t *pOut, uint32_t numSamples)
Compare MATLAB Reference Output and ARM Test output.
void | arm_provide_guard_bits_q31 (q31_t *input_buf, uint32_t blockSize, uint32_t guard_bits)
Provide guard bits for Input buffer.
void | arm_provide_guard_bits_q7 (q7_t *input_buf, uint32_t blockSize, uint32_t guard_bits)
Provide guard bits for Input buffer.
uint32_t | arm_calc_guard_bits (uint32_t num_adds)
Caluclates number of guard bits.
void | arm_apply_guard_bits (float32_t *pIn, uint32_t numSamples, uint32_t guard_bits)
Apply guard bits to buffer.
uint32_t | arm_calc_2pow (uint32_t numShifts)
Calculates pow(2, numShifts)
void | arm_float_to_q14 (float *pIn, q15_t *pOut, uint32_t numSamples)
Converts float to fixed q14.
void | arm_float_to_q30 (float *pIn, q31_t *pOut, uint32_t numSamples)
Converts float to fixed q30 format.
void | arm_float_to_q29 (float *pIn, q31_t *pOut, uint32_t numSamples)
Converts float to fixed q30 format.
void | arm_float_to_q28 (float *pIn, q31_t *pOut, uint32_t numSamples)
Converts float to fixed q28 format.

Function Documentation

◆ arm_apply_guard_bits()

void arm_apply_guard_bits | ( | float32_t * | pIn,
 |  | uint32_t | numSamples,
 |  | uint32_t | guard_bits )

Apply guard bits to buffer.

Parameters
[in,out] | pIn | pointer to input buffer
[in] | numSamples | number of samples in the input buffer
[in] | guard_bits | guard bits
Returns
none

Definition at line 294 of file project_l0/src/math_helper.c.

◆ arm_calc_2pow()

uint32_t arm_calc_2pow ( uint32_t numShifts )

Calculates pow(2, numShifts)

Parameters
[in] numShifts number of shifts
Returns
pow(2, numShifts)

Definition at line 311 of file project_l0/src/math_helper.c.

Referenced by arm_apply_guard_bits().

◆ arm_calc_guard_bits()

uint32_t arm_calc_guard_bits ( uint32_t num_adds )

Caluclates number of guard bits.

Parameters
[in] num_adds number of additions
Returns
guard bits The function Caluclates the number of guard bits depending on the numtaps

Definition at line 268 of file project_l0/src/math_helper.c.

◆ arm_compare_fixed_q15()

uint32_t arm_compare_fixed_q15 | ( | q15_t * | pIn,
 |  | q15_t * | pOut,
 |  | uint32_t | numSamples )

Compare MATLAB Reference Output and ARM Test output.

Parameters
[in] | pIn | Pointer to Ref buffer
[in] | pOut | Pointer to Test buffer
[in] | numSamples | number of samples in the buffer
Returns
maximum difference

Definition at line 166 of file project_l0/src/math_helper.c.

◆ arm_compare_fixed_q31()

uint32_t arm_compare_fixed_q31 | ( | q31_t * | pIn,
 |  | q31_t * | pOut,
 |  | uint32_t | numSamples )

Compare MATLAB Reference Output and ARM Test output.

Parameters
[in] | pIn | Pointer to Ref buffer
[in] | pOut | Pointer to Test buffer
[in] | numSamples | number of samples in the buffer
Returns
maximum difference

Definition at line 194 of file project_l0/src/math_helper.c.

◆ arm_float_to_q12_20()

void arm_float_to_q12_20 | ( | float * | pIn,
 |  | q31_t * | pOut,
 |  | uint32_t | numSamples )

Converts float to fixed in q12.20 format.

Parameters
[in] | pIn | pointer to input buffer
[out] | pOut | pointer to outputbuffer
[in] | numSamples | number of samples in the input buffer
Returns
none The function converts floating point values to fixed point(q12.20) values

Definition at line 140 of file project_l0/src/math_helper.c.

◆ arm_float_to_q14()

void arm_float_to_q14 | ( | float * | pIn,
 |  | q15_t * | pOut,
 |  | uint32_t | numSamples )

Converts float to fixed q14.

Parameters
[in] | pIn | pointer to input buffer
[out] | pOut | pointer to output buffer
[in] | numSamples | number of samples in the buffer
Returns
none The function converts floating point values to fixed point values

Definition at line 335 of file project_l0/src/math_helper.c.

◆ arm_float_to_q28()

void arm_float_to_q28 | ( | float * | pIn,
 |  | q31_t * | pOut,
 |  | uint32_t | numSamples )

Converts float to fixed q28 format.

Parameters
[in] | pIn | pointer to input buffer
[out] | pOut | pointer to output buffer
[in] | numSamples | number of samples in the buffer
Returns
none The function converts floating point values to fixed point values

Definition at line 420 of file project_l0/src/math_helper.c.

◆ arm_float_to_q29()

void arm_float_to_q29 | ( | float * | pIn,
 |  | q31_t * | pOut,
 |  | uint32_t | numSamples )

Converts float to fixed q30 format.

Parameters
[in] | pIn | pointer to input buffer
[out] | pOut | pointer to output buffer
[in] | numSamples | number of samples in the buffer
Returns
none The function converts floating point values to fixed point values

Definition at line 392 of file project_l0/src/math_helper.c.

◆ arm_float_to_q30()

void arm_float_to_q30 | ( | float * | pIn,
 |  | q31_t * | pOut,
 |  | uint32_t | numSamples )

Converts float to fixed q30 format.

Parameters
[in] | pIn | pointer to input buffer
[out] | pOut | pointer to output buffer
[in] | numSamples | number of samples in the buffer
Returns
none The function converts floating point values to fixed point values

Definition at line 365 of file project_l0/src/math_helper.c.

◆ arm_provide_guard_bits_q15()

void arm_provide_guard_bits_q15 | ( | q15_t * | input_buf,
 |  | uint32_t | blockSize,
 |  | uint32_t | guard_bits )

Provide guard bits for Input buffer.

Parameters
[in,out] | input_buf | Pointer to input buffer
[in] | blockSize | block Size
[in] | guard_bits | guard bits
Returns
none The function Provides the guard bits for the buffer to avoid overflow

Definition at line 120 of file project_l0/src/math_helper.c.

◆ arm_provide_guard_bits_q31()

void arm_provide_guard_bits_q31 | ( | q31_t * | input_buf,
 |  | uint32_t | blockSize,
 |  | uint32_t | guard_bits )

Provide guard bits for Input buffer.

Parameters
[in,out] | input_buf | Pointer to input buffer
[in] | blockSize | block Size
[in] | guard_bits | guard bits
Returns
none The function Provides the guard bits for the buffer to avoid overflow

Definition at line 224 of file project_l0/src/math_helper.c.

◆ arm_provide_guard_bits_q7()

void arm_provide_guard_bits_q7 | ( | q7_t * | input_buf,
 |  | uint32_t | blockSize,
 |  | uint32_t | guard_bits )

Provide guard bits for Input buffer.

Parameters
[in,out] | input_buf | Pointer to input buffer
[in] | blockSize | block Size
[in] | guard_bits | guard bits
Returns
none The function Provides the guard bits for the buffer to avoid overflow

Definition at line 246 of file project_l0/src/math_helper.c.

◆ arm_snr_f32()

float arm_snr_f32 | ( | float * | pRef,
 |  | float * | pTest,
 |  | uint32_t | buffSize )

Caluclation of SNR.

Parameters
[in] | pRef | Pointer to the reference buffer
[in] | pTest | Pointer to the test buffer
[in] | buffSize | total number of samples
Returns
SNR The function Caluclates signal to noise ratio for the reference output and test output

Definition at line 62 of file project_l0/src/math_helper.c.


AT32F413 Firmwary Library: project_l1 Directory Reference

  • utilities
  • at32f413_slib_demo
  • project_l1
project_l1 Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • utilities
  • at32f413_slib_demo
  • project_l1
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.
fir_filter.h
math_helper.h


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • utilities
  • at32f413_slib_demo
  • project_l1
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_slib_demo/project_l1/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • utilities
  • at32f413_slib_demo
  • project_l1
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • utilities
  • at32f413_slib_demo
  • project_l1
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_slib_demo/project_l1/inc/at32f413_int.h.


AT32F413 Firmwary Library: fir_filter.h File Reference

  • utilities
  • at32f413_slib_demo
  • project_l1
  • inc
Functions
fir_filter.h File Reference
#include "arm_math.h"

Go to the source code of this file.

Functions

void | arm_fir_init_f32 (arm_fir_instance_f32 *S, uint16_t numTaps, const float32_t *pCoeffs, float32_t *pState, uint32_t blockSize)
Initialization function for the floating-point FIR filter.
void | arm_fir_f32 (const arm_fir_instance_f32 *S, const float32_t *pSrc, float32_t *pDst, uint32_t blockSize)
void | FIR_lowpass_filter (float32_t *pSrc, float32_t *pDst, uint32_t testlengthsamples)

Function Documentation

◆ arm_fir_f32()

void arm_fir_f32 | ( | const arm_fir_instance_f32 * | S,
 |  | const float32_t * | pSrc,
 |  | float32_t * | pDst,
 |  | uint32_t | blockSize )

◆ arm_fir_init_f32()

void arm_fir_init_f32 | ( | arm_fir_instance_f32 * | S,
 |  | uint16_t | numTaps,
 |  | const float32_t * | pCoeffs,
 |  | float32_t * | pState,
 |  | uint32_t | blockSize )

Initialization function for the floating-point FIR filter.

File : Step1-ST_Customer_level_n/Inc/fir_filter.h Version: V1.3.0 Date : 2021-03-18 Brief : This file contains the headers of FIR filter IP-Code.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. may be used to endorse or promote products derived from this software without specific prior written permission.

AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Parameters
[in,out] | S | points to an instance of the floating-point FIR filter structure
[in] | numTaps | number of filter coefficients in the filter
[in] | pCoeffs | points to the filter coefficients buffer
[in] | pState | points to the state buffer
[in] | blockSize | number of samples processed per call
Returns
none
Details
pCoeffs points to the array of filter coefficients stored in time reversed order:
    {b[numTaps-1], b[numTaps-2], b[N-2], ..., b[1], b[0]}
pState points to the array of state variables. pState is of length numTaps+blockSize-1 samples, where blockSize is the number of input samples processed by each call to arm_fir_f32().
Initialization of Helium version
For Helium version the array of coefficients must be a multiple of 16 even if less then 16 coefficients are used. The additional coefficients must be set to 0. It does not mean that all the coefficients will be used in the filter (numTaps is still set to its right value in the init function.) It just means that the implementation may require to read more coefficients due to the vectorization and to avoid having to manage too many different cases in the code.

Definition at line 59 of file arm_fir_init_f32.c.

◆ FIR_lowpass_filter()

void FIR_lowpass_filter | ( | float32_t * | pSrc,
 |  | float32_t * | pDst,
 |  | uint32_t | testlengthsamples )

Definition at line 76 of file fir_filter.c.


AT32F413 Firmwary Library: math_helper.h File Reference

  • utilities
  • at32f413_slib_demo
  • project_l1
  • inc
Functions
math_helper.h File Reference
#include "arm_math.h"

Go to the source code of this file.

Functions

float | arm_snr_f32 (float *pRef, float *pTest, uint32_t buffSize)
Caluclation of SNR.
void | arm_float_to_q12_20 (float *pIn, q31_t *pOut, uint32_t numSamples)
Converts float to fixed in q12.20 format.
void | arm_provide_guard_bits_q15 (q15_t *input_buf, uint32_t blockSize, uint32_t guard_bits)
Provide guard bits for Input buffer.
void | arm_provide_guard_bits_q31 (q31_t *input_buf, uint32_t blockSize, uint32_t guard_bits)
Provide guard bits for Input buffer.
void | arm_float_to_q14 (float *pIn, q15_t *pOut, uint32_t numSamples)
Converts float to fixed q14.
void | arm_float_to_q29 (float *pIn, q31_t *pOut, uint32_t numSamples)
Converts float to fixed q30 format.
void | arm_float_to_q28 (float *pIn, q31_t *pOut, uint32_t numSamples)
Converts float to fixed q28 format.
void | arm_float_to_q30 (float *pIn, q31_t *pOut, uint32_t numSamples)
Converts float to fixed q30 format.
uint32_t | arm_calc_guard_bits (uint32_t num_adds)
Caluclates number of guard bits.
void | arm_apply_guard_bits (float32_t *pIn, uint32_t numSamples, uint32_t guard_bits)
Apply guard bits to buffer.
uint32_t | arm_compare_fixed_q15 (q15_t *pIn, q15_t *pOut, uint32_t numSamples)
Compare MATLAB Reference Output and ARM Test output.
uint32_t | arm_compare_fixed_q31 (q31_t *pIn, q31_t *pOut, uint32_t numSamples)
Compare MATLAB Reference Output and ARM Test output.
uint32_t | arm_calc_2pow (uint32_t guard_bits)
Calculates pow(2, numShifts)

Function Documentation

◆ arm_apply_guard_bits()

void arm_apply_guard_bits | ( | float32_t * | pIn,
 |  | uint32_t | numSamples,
 |  | uint32_t | guard_bits )

Apply guard bits to buffer.

Parameters
[in,out] | pIn | pointer to input buffer
[in] | numSamples | number of samples in the input buffer
[in] | guard_bits | guard bits
Returns
none

Definition at line 294 of file project_l0/src/math_helper.c.

◆ arm_calc_2pow()

uint32_t arm_calc_2pow ( uint32_t numShifts )

Calculates pow(2, numShifts)

Parameters
[in] numShifts number of shifts
Returns
pow(2, numShifts)

Definition at line 311 of file project_l0/src/math_helper.c.

Referenced by arm_apply_guard_bits().

◆ arm_calc_guard_bits()

uint32_t arm_calc_guard_bits ( uint32_t num_adds )

Caluclates number of guard bits.

Parameters
[in] num_adds number of additions
Returns
guard bits The function Caluclates the number of guard bits depending on the numtaps

Definition at line 268 of file project_l0/src/math_helper.c.

◆ arm_compare_fixed_q15()

uint32_t arm_compare_fixed_q15 | ( | q15_t * | pIn,
 |  | q15_t * | pOut,
 |  | uint32_t | numSamples )

Compare MATLAB Reference Output and ARM Test output.

Parameters
[in] | pIn | Pointer to Ref buffer
[in] | pOut | Pointer to Test buffer
[in] | numSamples | number of samples in the buffer
Returns
maximum difference

Definition at line 166 of file project_l0/src/math_helper.c.

◆ arm_compare_fixed_q31()

uint32_t arm_compare_fixed_q31 | ( | q31_t * | pIn,
 |  | q31_t * | pOut,
 |  | uint32_t | numSamples )

Compare MATLAB Reference Output and ARM Test output.

Parameters
[in] | pIn | Pointer to Ref buffer
[in] | pOut | Pointer to Test buffer
[in] | numSamples | number of samples in the buffer
Returns
maximum difference

Definition at line 194 of file project_l0/src/math_helper.c.

◆ arm_float_to_q12_20()

void arm_float_to_q12_20 | ( | float * | pIn,
 |  | q31_t * | pOut,
 |  | uint32_t | numSamples )

Converts float to fixed in q12.20 format.

Parameters
[in] | pIn | pointer to input buffer
[out] | pOut | pointer to outputbuffer
[in] | numSamples | number of samples in the input buffer
Returns
none The function converts floating point values to fixed point(q12.20) values

Definition at line 140 of file project_l0/src/math_helper.c.

◆ arm_float_to_q14()

void arm_float_to_q14 | ( | float * | pIn,
 |  | q15_t * | pOut,
 |  | uint32_t | numSamples )

Converts float to fixed q14.

Parameters
[in] | pIn | pointer to input buffer
[out] | pOut | pointer to output buffer
[in] | numSamples | number of samples in the buffer
Returns
none The function converts floating point values to fixed point values

Definition at line 335 of file project_l0/src/math_helper.c.

◆ arm_float_to_q28()

void arm_float_to_q28 | ( | float * | pIn,
 |  | q31_t * | pOut,
 |  | uint32_t | numSamples )

Converts float to fixed q28 format.

Parameters
[in] | pIn | pointer to input buffer
[out] | pOut | pointer to output buffer
[in] | numSamples | number of samples in the buffer
Returns
none The function converts floating point values to fixed point values

Definition at line 420 of file project_l0/src/math_helper.c.

◆ arm_float_to_q29()

void arm_float_to_q29 | ( | float * | pIn,
 |  | q31_t * | pOut,
 |  | uint32_t | numSamples )

Converts float to fixed q30 format.

Parameters
[in] | pIn | pointer to input buffer
[out] | pOut | pointer to output buffer
[in] | numSamples | number of samples in the buffer
Returns
none The function converts floating point values to fixed point values

Definition at line 392 of file project_l0/src/math_helper.c.

◆ arm_float_to_q30()

void arm_float_to_q30 | ( | float * | pIn,
 |  | q31_t * | pOut,
 |  | uint32_t | numSamples )

Converts float to fixed q30 format.

Parameters
[in] | pIn | pointer to input buffer
[out] | pOut | pointer to output buffer
[in] | numSamples | number of samples in the buffer
Returns
none The function converts floating point values to fixed point values

Definition at line 365 of file project_l0/src/math_helper.c.

◆ arm_provide_guard_bits_q15()

void arm_provide_guard_bits_q15 | ( | q15_t * | input_buf,
 |  | uint32_t | blockSize,
 |  | uint32_t | guard_bits )

Provide guard bits for Input buffer.

Parameters
[in,out] | input_buf | Pointer to input buffer
[in] | blockSize | block Size
[in] | guard_bits | guard bits
Returns
none The function Provides the guard bits for the buffer to avoid overflow

Definition at line 120 of file project_l0/src/math_helper.c.

◆ arm_provide_guard_bits_q31()

void arm_provide_guard_bits_q31 | ( | q31_t * | input_buf,
 |  | uint32_t | blockSize,
 |  | uint32_t | guard_bits )

Provide guard bits for Input buffer.

Parameters
[in,out] | input_buf | Pointer to input buffer
[in] | blockSize | block Size
[in] | guard_bits | guard bits
Returns
none The function Provides the guard bits for the buffer to avoid overflow

Definition at line 224 of file project_l0/src/math_helper.c.

◆ arm_snr_f32()

float arm_snr_f32 | ( | float * | pRef,
 |  | float * | pTest,
 |  | uint32_t | buffSize )

Caluclation of SNR.

Parameters
[in] | pRef | Pointer to the reference buffer
[in] | pTest | Pointer to the test buffer
[in] | buffSize | total number of samples
Returns
SNR The function Caluclates signal to noise ratio for the reference output and test output

Definition at line 62 of file project_l0/src/math_helper.c.


AT32F413 Firmwary Library: src Directory Reference

  • utilities
  • at32f413_slib_demo
  • project_l1
  • src
src Directory Reference

Files

arm_fir_data.c
at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
main.c
main program
math_helper.c


AT32F413 Firmwary Library: arm_fir_data.c File Reference

  • utilities
  • at32f413_slib_demo
  • project_l1
  • src
Variables
arm_fir_data.c File Reference
#include "at32f413.h"
#include "arm_math.h"

Go to the source code of this file.

Variables

float32_t | testInput_f32_1kHz_15kHz [320]
float32_t | refOutput [320]

Variable Documentation

◆ refOutput

float32_t refOutput[320]

Definition at line 96 of file project_l1/src/arm_fir_data.c.

Referenced by main().

◆ testInput_f32_1kHz_15kHz

float32_t testInput_f32_1kHz_15kHz[320]

Definition at line 48 of file project_l1/src/arm_fir_data.c.

Referenced by main().


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • utilities
  • at32f413_slib_demo
  • project_l1
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_slib_demo/project_l1/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • utilities
  • at32f413_slib_demo
  • project_l1
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"
#include "at32f413_board.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.
void | FLASH_IRQHandler (void)
flash handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_slib_demo/project_l1/src/at32f413_int.c.


AT32F413 Firmwary Library: main.c File Reference

  • utilities
  • at32f413_slib_demo
  • project_l1
  • src
Macros | Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include <stdio.h>
#include "math_helper.h"
#include "fir_filter.h"

Go to the source code of this file.

Macros

#define | SNR_THRESHOLD_F32 140.0f
#define | TEST_LENGTH_SAMPLES 320

Functions

void | config_flash_interrupt (void)
config flash error interrupt.
int | main (void)
main function.

Variables

float32_t | testInput_f32_1kHz_15kHz []
float32_t | refOutput []
static float32_t | testOutput [320]

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_slib_demo/project_l1/src/main.c.

Variable Documentation

◆ refOutput

float32_t refOutput[]
extern

Definition at line 96 of file project_l0/src/arm_fir_data.c.

Referenced by main().

◆ testInput_f32_1kHz_15kHz

float32_t testInput_f32_1kHz_15kHz[]
extern

Definition at line 48 of file project_l0/src/arm_fir_data.c.

Referenced by main().


AT32F413 Firmwary Library: math_helper.c File Reference

  • utilities
  • at32f413_slib_demo
  • project_l1
  • src
Functions
math_helper.c File Reference
#include <math.h>
#include "math_helper.h"

Go to the source code of this file.

Functions

float | arm_snr_f32 (float *pRef, float *pTest, uint32_t buffSize)
Caluclation of SNR.
void | arm_provide_guard_bits_q15 (q15_t *input_buf, uint32_t blockSize, uint32_t guard_bits)
Provide guard bits for Input buffer.
void | arm_float_to_q12_20 (float *pIn, q31_t *pOut, uint32_t numSamples)
Converts float to fixed in q12.20 format.
uint32_t | arm_compare_fixed_q15 (q15_t *pIn, q15_t *pOut, uint32_t numSamples)
Compare MATLAB Reference Output and ARM Test output.
uint32_t | arm_compare_fixed_q31 (q31_t *pIn, q31_t *pOut, uint32_t numSamples)
Compare MATLAB Reference Output and ARM Test output.
void | arm_provide_guard_bits_q31 (q31_t *input_buf, uint32_t blockSize, uint32_t guard_bits)
Provide guard bits for Input buffer.
void | arm_provide_guard_bits_q7 (q7_t *input_buf, uint32_t blockSize, uint32_t guard_bits)
Provide guard bits for Input buffer.
uint32_t | arm_calc_guard_bits (uint32_t num_adds)
Caluclates number of guard bits.
void | arm_apply_guard_bits (float32_t *pIn, uint32_t numSamples, uint32_t guard_bits)
Apply guard bits to buffer.
uint32_t | arm_calc_2pow (uint32_t numShifts)
Calculates pow(2, numShifts)
void | arm_float_to_q14 (float *pIn, q15_t *pOut, uint32_t numSamples)
Converts float to fixed q14.
void | arm_float_to_q30 (float *pIn, q31_t *pOut, uint32_t numSamples)
Converts float to fixed q30 format.
void | arm_float_to_q29 (float *pIn, q31_t *pOut, uint32_t numSamples)
Converts float to fixed q30 format.
void | arm_float_to_q28 (float *pIn, q31_t *pOut, uint32_t numSamples)
Converts float to fixed q28 format.

Function Documentation

◆ arm_apply_guard_bits()

void arm_apply_guard_bits | ( | float32_t * | pIn,
 |  | uint32_t | numSamples,
 |  | uint32_t | guard_bits )

Apply guard bits to buffer.

Parameters
[in,out] | pIn | pointer to input buffer
[in] | numSamples | number of samples in the input buffer
[in] | guard_bits | guard bits
Returns
none

Definition at line 294 of file project_l1/src/math_helper.c.

◆ arm_calc_2pow()

uint32_t arm_calc_2pow ( uint32_t numShifts )

Calculates pow(2, numShifts)

Parameters
[in] numShifts number of shifts
Returns
pow(2, numShifts)

Definition at line 311 of file project_l1/src/math_helper.c.

Referenced by arm_apply_guard_bits().

◆ arm_calc_guard_bits()

uint32_t arm_calc_guard_bits ( uint32_t num_adds )

Caluclates number of guard bits.

Parameters
[in] num_adds number of additions
Returns
guard bits The function Caluclates the number of guard bits depending on the numtaps

Definition at line 268 of file project_l1/src/math_helper.c.

◆ arm_compare_fixed_q15()

uint32_t arm_compare_fixed_q15 | ( | q15_t * | pIn,
 |  | q15_t * | pOut,
 |  | uint32_t | numSamples )

Compare MATLAB Reference Output and ARM Test output.

Parameters
[in] | pIn | Pointer to Ref buffer
[in] | pOut | Pointer to Test buffer
[in] | numSamples | number of samples in the buffer
Returns
maximum difference

Definition at line 166 of file project_l1/src/math_helper.c.

◆ arm_compare_fixed_q31()

uint32_t arm_compare_fixed_q31 | ( | q31_t * | pIn,
 |  | q31_t * | pOut,
 |  | uint32_t | numSamples )

Compare MATLAB Reference Output and ARM Test output.

Parameters
[in] | pIn | Pointer to Ref buffer
[in] | pOut | Pointer to Test buffer
[in] | numSamples | number of samples in the buffer
Returns
maximum difference

Definition at line 194 of file project_l1/src/math_helper.c.

◆ arm_float_to_q12_20()

void arm_float_to_q12_20 | ( | float * | pIn,
 |  | q31_t * | pOut,
 |  | uint32_t | numSamples )

Converts float to fixed in q12.20 format.

Parameters
[in] | pIn | pointer to input buffer
[out] | pOut | pointer to outputbuffer
[in] | numSamples | number of samples in the input buffer
Returns
none The function converts floating point values to fixed point(q12.20) values

Definition at line 140 of file project_l1/src/math_helper.c.

◆ arm_float_to_q14()

void arm_float_to_q14 | ( | float * | pIn,
 |  | q15_t * | pOut,
 |  | uint32_t | numSamples )

Converts float to fixed q14.

Parameters
[in] | pIn | pointer to input buffer
[out] | pOut | pointer to output buffer
[in] | numSamples | number of samples in the buffer
Returns
none The function converts floating point values to fixed point values

Definition at line 335 of file project_l1/src/math_helper.c.

◆ arm_float_to_q28()

void arm_float_to_q28 | ( | float * | pIn,
 |  | q31_t * | pOut,
 |  | uint32_t | numSamples )

Converts float to fixed q28 format.

Parameters
[in] | pIn | pointer to input buffer
[out] | pOut | pointer to output buffer
[in] | numSamples | number of samples in the buffer
Returns
none The function converts floating point values to fixed point values

Definition at line 420 of file project_l1/src/math_helper.c.

◆ arm_float_to_q29()

void arm_float_to_q29 | ( | float * | pIn,
 |  | q31_t * | pOut,
 |  | uint32_t | numSamples )

Converts float to fixed q30 format.

Parameters
[in] | pIn | pointer to input buffer
[out] | pOut | pointer to output buffer
[in] | numSamples | number of samples in the buffer
Returns
none The function converts floating point values to fixed point values

Definition at line 392 of file project_l1/src/math_helper.c.

◆ arm_float_to_q30()

void arm_float_to_q30 | ( | float * | pIn,
 |  | q31_t * | pOut,
 |  | uint32_t | numSamples )

Converts float to fixed q30 format.

Parameters
[in] | pIn | pointer to input buffer
[out] | pOut | pointer to output buffer
[in] | numSamples | number of samples in the buffer
Returns
none The function converts floating point values to fixed point values

Definition at line 365 of file project_l1/src/math_helper.c.

◆ arm_provide_guard_bits_q15()

void arm_provide_guard_bits_q15 | ( | q15_t * | input_buf,
 |  | uint32_t | blockSize,
 |  | uint32_t | guard_bits )

Provide guard bits for Input buffer.

Parameters
[in,out] | input_buf | Pointer to input buffer
[in] | blockSize | block Size
[in] | guard_bits | guard bits
Returns
none The function Provides the guard bits for the buffer to avoid overflow

Definition at line 120 of file project_l1/src/math_helper.c.

◆ arm_provide_guard_bits_q31()

void arm_provide_guard_bits_q31 | ( | q31_t * | input_buf,
 |  | uint32_t | blockSize,
 |  | uint32_t | guard_bits )

Provide guard bits for Input buffer.

Parameters
[in,out] | input_buf | Pointer to input buffer
[in] | blockSize | block Size
[in] | guard_bits | guard bits
Returns
none The function Provides the guard bits for the buffer to avoid overflow

Definition at line 224 of file project_l1/src/math_helper.c.

◆ arm_provide_guard_bits_q7()

void arm_provide_guard_bits_q7 | ( | q7_t * | input_buf,
 |  | uint32_t | blockSize,
 |  | uint32_t | guard_bits )

Provide guard bits for Input buffer.

Parameters
[in,out] | input_buf | Pointer to input buffer
[in] | blockSize | block Size
[in] | guard_bits | guard bits
Returns
none The function Provides the guard bits for the buffer to avoid overflow

Definition at line 246 of file project_l1/src/math_helper.c.

◆ arm_snr_f32()

float arm_snr_f32 | ( | float * | pRef,
 |  | float * | pTest,
 |  | uint32_t | buffSize )

Caluclation of SNR.

Parameters
[in] | pRef | Pointer to the reference buffer
[in] | pTest | Pointer to the test buffer
[in] | buffSize | total number of samples
Returns
SNR The function Caluclates signal to noise ratio for the reference output and test output

Definition at line 62 of file project_l1/src/math_helper.c.

Referenced by main().


AT32F413 Firmwary Library: at32f413_usart_iap_demo Directory Reference

  • utilities
  • at32f413_usart_iap_demo
at32f413_usart_iap_demo Directory Reference

Directories

source_code


AT32F413 Firmwary Library: source_code Directory Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
source_code Directory Reference

Directories

app_led3_toggle
app_led4_toggle
bootloader


AT32F413 Firmwary Library: app_led3_toggle Directory Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led3_toggle
app_led3_toggle Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led3_toggle
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.
iap.h
iap header file
tmr.h
tmr header file
usart.h
usart header file


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led3_toggle
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led3_toggle
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led3_toggle
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_int.h.


AT32F413 Firmwary Library: iap.h File Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led3_toggle
  • inc
Macros | Functions
iap.h File Reference

iap header file More...

#include "at32f413_board.h"

Go to the source code of this file.

Macros

#define | APP_START_ADDR 0x08004000
#define | IAP_UPGRADE_FLAG_ADDR (APP_START_ADDR - 0x800)
#define | IAP_UPGRADE_FLAG 0x41544B38

Functions

void | iap_command_handle (void)
iap command handle handle.
void | iap_init (void)
iap init.

Detailed Description

iap header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file app_led3_toggle/inc/iap.h.


AT32F413 Firmwary Library: tmr.h File Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led3_toggle
  • inc
Functions
tmr.h File Reference

tmr header file More...

#include "at32f413_board.h"

Go to the source code of this file.

Functions

void tmr_init (void)
init tmr.

Detailed Description

tmr header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file app_led3_toggle/inc/tmr.h.


AT32F413 Firmwary Library: usart.h File Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led3_toggle
  • inc
Macros | Functions | Variables
usart.h File Reference

usart header file More...

#include "at32f413_board.h"

Go to the source code of this file.

Macros

#define | IAP_REV_FLAG_NO 0
#define | IAP_REV_FLAG_5A 1
#define | IAP_REV_FLAG_DONE 2
#define | IAP_REV_FLAG_ERROR 3

Functions

void | uart_init (uint32_t baudrate)
init usart.
void | back_ok (void)
command response ok.
void | back_err (void)
command response error.

Variables

uint8_t iap_flag

Detailed Description

usart header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file app_led3_toggle/inc/usart.h.


AT32F413 Firmwary Library: src Directory Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led3_toggle
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
iap.c
iap program
main.c
main program
tmr.c
tmr program
usart.c
usart program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led3_toggle
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led3_toggle
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c.


AT32F413 Firmwary Library: iap.c File Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led3_toggle
  • src
Functions
iap.c File Reference

iap program More...

#include "iap.h"
#include "usart.h"
#include "tmr.h"

Go to the source code of this file.

Functions

void | iap_command_handle (void)
iap command handle handle.
void | iap_init (void)
iap init.

Detailed Description

iap program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file app_led3_toggle/src/iap.c.


AT32F413 Firmwary Library: main.c File Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led3_toggle
  • src
Functions
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include "tmr.h"
#include "usart.h"
#include "iap.h"

Go to the source code of this file.

Functions

int main (void)
main function.

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/main.c.


AT32F413 Firmwary Library: tmr.c File Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led3_toggle
  • src
Functions
tmr.c File Reference

tmr program More...

#include "at32f413_board.h"
#include "tmr.h"
#include "iap.h"

Go to the source code of this file.

Functions

void | tmr_init (void)
init tmr.
void | TMR3_GLOBAL_IRQHandler (void)
tmr3 global interrupt handler.

Detailed Description

tmr program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file app_led3_toggle/src/tmr.c.


AT32F413 Firmwary Library: usart.c File Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led3_toggle
  • src
Functions | Variables
usart.c File Reference

usart program More...

#include "usart.h"
#include "tmr.h"

Go to the source code of this file.

Functions

void | uart_init (uint32_t baudrate)
init usart.
void | USART1_IRQHandler (void)
usart1 interrupt handler.
void | back_ok (void)
command response ok.
void | back_err (void)
command response error.

Variables

uint8_t iap_flag = IAP_REV_FLAG_NO

Detailed Description

usart program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file app_led3_toggle/src/usart.c.


AT32F413 Firmwary Library: app_led4_toggle Directory Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led4_toggle
app_led4_toggle Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led4_toggle
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.
iap.h
iap header file
tmr.h
tmr header file
usart.h
usart header file


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led4_toggle
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led4_toggle
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led4_toggle
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_int.h.


AT32F413 Firmwary Library: iap.h File Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led4_toggle
  • inc
Macros | Functions
iap.h File Reference

iap header file More...

#include "at32f413_board.h"

Go to the source code of this file.

Macros

#define | APP_START_ADDR 0x08004000
#define | IAP_UPGRADE_FLAG_ADDR (APP_START_ADDR - 0x800)
#define | IAP_UPGRADE_FLAG 0x41544B38

Functions

void | iap_command_handle (void)
iap command handle handle.
void | iap_init (void)
iap init.

Detailed Description

iap header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file app_led4_toggle/inc/iap.h.


AT32F413 Firmwary Library: tmr.h File Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led4_toggle
  • inc
Functions
tmr.h File Reference

tmr header file More...

#include "at32f413_board.h"

Go to the source code of this file.

Functions

void tmr_init (void)
init tmr.

Detailed Description

tmr header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file app_led4_toggle/inc/tmr.h.


AT32F413 Firmwary Library: usart.h File Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led4_toggle
  • inc
Macros | Functions | Variables
usart.h File Reference

usart header file More...

#include "at32f413_board.h"

Go to the source code of this file.

Macros

#define | IAP_REV_FLAG_NO 0
#define | IAP_REV_FLAG_5A 1
#define | IAP_REV_FLAG_DONE 2
#define | IAP_REV_FLAG_ERROR 3

Functions

void | uart_init (uint32_t baudrate)
init usart.
void | back_ok (void)
command response ok.
void | back_err (void)
command response error.

Variables

uint8_t iap_flag

Detailed Description

usart header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file app_led4_toggle/inc/usart.h.


AT32F413 Firmwary Library: src Directory Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led4_toggle
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
iap.c
iap program
main.c
main program
tmr.c
tmr program
usart.c
usart program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led4_toggle
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led4_toggle
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c.


AT32F413 Firmwary Library: iap.c File Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led4_toggle
  • src
Functions
iap.c File Reference

iap program More...

#include "iap.h"
#include "usart.h"
#include "tmr.h"

Go to the source code of this file.

Functions

void | iap_command_handle (void)
iap command handle handle.
void | iap_init (void)
iap init.

Detailed Description

iap program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file app_led4_toggle/src/iap.c.


AT32F413 Firmwary Library: main.c File Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led4_toggle
  • src
Functions
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include "tmr.h"
#include "usart.h"
#include "iap.h"

Go to the source code of this file.

Functions

int main (void)
main function.

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/main.c.


AT32F413 Firmwary Library: tmr.c File Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led4_toggle
  • src
Functions
tmr.c File Reference

tmr program More...

#include "at32f413_board.h"
#include "tmr.h"
#include "iap.h"

Go to the source code of this file.

Functions

void | tmr_init (void)
init tmr.
void | TMR3_GLOBAL_IRQHandler (void)
tmr3 global interrupt handler.

Detailed Description

tmr program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file app_led4_toggle/src/tmr.c.


AT32F413 Firmwary Library: usart.c File Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led4_toggle
  • src
Functions | Variables
usart.c File Reference

usart program More...

#include "usart.h"
#include "tmr.h"

Go to the source code of this file.

Functions

void | uart_init (uint32_t baudrate)
init usart.
void | USART1_IRQHandler (void)
usart1 interrupt handler.
void | back_ok (void)
command response ok.
void | back_err (void)
command response error.

Variables

uint8_t iap_flag = IAP_REV_FLAG_NO

Detailed Description

usart program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file app_led4_toggle/src/usart.c.


AT32F413 Firmwary Library: bootloader Directory Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • bootloader
bootloader Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • bootloader
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.
flash.h
flash header file
iap.h
iap header file
tmr.h
tmr header file
usart.h
usart header file


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • bootloader
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • bootloader
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • bootloader
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_int.h.


AT32F413 Firmwary Library: flash.h File Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • bootloader
  • inc
Macros | Functions
flash.h File Reference

flash header file More...

#include "at32f413_board.h"

Go to the source code of this file.

Macros

#define | FLASH_SIZE (*((uint32_t*)0x1FFFF7E0)) /* read from at32 flash capacity register(unit:kbyte) */
#define | SRAM_SIZE 64 /* sram size, unit:kbyte */

Functions

void | flash_2kb_write (uint32_t write_addr, uint8_t *pbuffer)
flash erase/program operation.
flag_status | flash_upgrade_flag_read (void)
check flash upgrade flag.

Detailed Description

flash header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/flash.h.


AT32F413 Firmwary Library: iap.h File Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • bootloader
  • inc
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
iap.h File Reference

iap header file More...

#include "at32f413_board.h"

Go to the source code of this file.

Data Structures

struct cmd_data_group_type
cmd data group type More...

Macros

#define | APP_START_ADDR 0x08004000
#define | IAP_UPGRADE_FLAG_ADDR (APP_START_ADDR - 0x800)
#define | IAP_UPGRADE_FLAG 0x41544B38

Typedefs

typedef void(* iapfun) (void)

Enumerations

enum cmd_data_step_type {
CMD_DATA_IDLE , CMD_DATA_ADDR , CMD_DATA_BUF , CMD_DATA_CHACK ,
CMD_DATA_DONE , CMD_DATA_ERR
}
cmd data step type More...
enum cmd_ctr_step_type {
CMD_CTR_IDLE , CMD_CTR_INIT , CMD_CTR_DONE , CMD_CTR_ERR ,
CMD_CTR_APP
}
cmd ctr step type More...
enum update_status_type { UPDATE_PRE , UPDATE_CLEAR_FLAG , UPDATE_ING , UPDATE_DONE }
update status type More...

Functions

void | command_handle (void)
command analysis handle.
void | back_err (void)
command response error.
void | back_ok (void)
command response ok.
void | iap_upgrade_app_handle (void)
iap upgrade app handle.
void | app_load (uint32_t appxaddr)
app load.

Variables

cmd_data_group_type cmd_data_group_type_struct
cmd_data_step_type cmd_data_step
cmd_ctr_step_type cmd_ctr_step
update_status_type update_status

Detailed Description

iap header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file bootloader/inc/iap.h.


AT32F413 Firmwary Library: tmr.h File Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • bootloader
  • inc
Functions | Variables
tmr.h File Reference

tmr header file More...

#include "at32f413_board.h"

Go to the source code of this file.

Functions

void tmr_init (void)
init tmr.

Variables

uint8_t | time_ira_cnt
uint8_t | get_data_from_usart_flag

Detailed Description

tmr header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file bootloader/inc/tmr.h.


AT32F413 Firmwary Library: usart.h File Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • bootloader
  • inc
Data Structures | Macros | Functions | Variables
usart.h File Reference

usart header file More...

#include "at32f413_board.h"

Go to the source code of this file.

Data Structures

struct usart_group_type
usart group type More...

Macros

#define USART_REC_LEN 1024

Functions

void uart_init (uint32_t baudrate)
init usart.

Variables

usart_group_type usart_group_struct

Detailed Description

usart header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file bootloader/inc/usart.h.


AT32F413 Firmwary Library: src Directory Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • bootloader
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
flash.c
flash program
iap.c
iap program
main.c
main program
tmr.c
tmr program
usart.c
usart program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • bootloader
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_usart_iap_demo/source_code/bootloader/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • bootloader
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_usart_iap_demo/source_code/bootloader/src/at32f413_int.c.


AT32F413 Firmwary Library: flash.c File Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • bootloader
  • src
Functions
flash.c File Reference

flash program More...

#include "flash.h"
#include "usart.h"
#include "iap.h"

Go to the source code of this file.

Functions

void | flash_2kb_write (uint32_t write_addr, uint8_t *pbuffer)
flash erase/program operation.
flag_status | flash_upgrade_flag_read (void)
check flash upgrade flag.

Detailed Description

flash program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_usart_iap_demo/source_code/bootloader/src/flash.c.


AT32F413 Firmwary Library: iap.c File Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • bootloader
  • src
Functions | Variables
iap.c File Reference

iap program More...

#include "iap.h"
#include "usart.h"
#include "flash.h"
#include "tmr.h"

Go to the source code of this file.

Functions

void | app_load (uint32_t app_addr)
app load.
uint8_t | data_take (void)
take data from usart buf.
void | command_handle (void)
command analysis handle.
void | back_ok (void)
command response ok.
void | back_err (void)
command response error.
void | app_update_handle (void)
app update flow handle.
void | iap_upgrade_app_handle (void)
iap upgrade app handle.

Variables

cmd_data_step_type cmd_data_step = CMD_DATA_IDLE
cmd_ctr_step_type cmd_ctr_step = CMD_CTR_IDLE
cmd_data_group_type cmd_data_group_struct
update_status_type update_status = UPDATE_PRE
static uint8_t | cmd_addr_cnt = 0
static uint32_t | cmd_data_cnt = 0
iapfun jump_to_app

Detailed Description

iap program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file bootloader/src/iap.c.


AT32F413 Firmwary Library: main.c File Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • bootloader
  • src
Functions
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include "tmr.h"
#include "usart.h"
#include "flash.h"
#include "iap.h"

Go to the source code of this file.

Functions

int main (void)
main function.

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_usart_iap_demo/source_code/bootloader/src/main.c.


AT32F413 Firmwary Library: tmr.c File Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • bootloader
  • src
Functions | Variables
tmr.c File Reference

tmr program More...

#include "at32f413_board.h"
#include "tmr.h"
#include "iap.h"

Go to the source code of this file.

Functions

void | tmr_init (void)
init tmr.
void | TMR3_GLOBAL_IRQHandler (void)
tmr3 global interrupt handler.

Variables

uint8_t | time_ira_cnt =0
uint8_t | get_data_from_usart_flag = 0

Detailed Description

tmr program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file bootloader/src/tmr.c.


AT32F413 Firmwary Library: usart.c File Reference

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • bootloader
  • src
Functions | Variables
usart.c File Reference

usart program More...

#include "usart.h"
#include "tmr.h"

Go to the source code of this file.

Functions

void | uart_init (uint32_t baudrate)
init usart.
void | USART1_IRQHandler (void)
usart1 interrupt handler.

Variables

usart_group_type usart_group_struct

Detailed Description

usart program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file bootloader/src/usart.c.


AT32F413 Firmwary Library: at32f413_usb_iap_demo Directory Reference

  • utilities
  • at32f413_usb_iap_demo
at32f413_usb_iap_demo Directory Reference

Directories

source_code


AT32F413 Firmwary Library: source_code Directory Reference

  • utilities
  • at32f413_usb_iap_demo
  • source_code
source_code Directory Reference

Directories

app_led3_toggle
app_led4_toggle
bootloader


AT32F413 Firmwary Library: app_led3_toggle Directory Reference

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • app_led3_toggle
app_led3_toggle Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • app_led3_toggle
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.
hid_iap_user.h
usb config header file
usb_conf.h
usb config header file


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • app_led3_toggle
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • app_led3_toggle
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • app_led3_toggle
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_int.h.


AT32F413 Firmwary Library: hid_iap_user.h File Reference

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • app_led3_toggle
  • inc
Macros | Functions
hid_iap_user.h File Reference

usb config header file More...

#include "hid_iap_class.h"

Go to the source code of this file.

Macros

#define FLASH_APP_ADDRESS 0x08006000

Functions

void | iap_init (void)
iap init.
iap_result_type | iap_get_upgrade_flag (void)
get iap upgrade complete flag
void | app_loop (void)
iap loop

Detailed Description

usb config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file app_led3_toggle/inc/hid_iap_user.h.


AT32F413 Firmwary Library: usb_conf.h File Reference

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • app_led3_toggle
  • inc
Macros | Functions
usb_conf.h File Reference

usb config header file More...

#include "at32f413.h"
#include "at32f413_board.h"
#include "stdio.h"

Go to the source code of this file.

Macros

#define USB_EPT_AUTO_MALLOC_BUFFER
usb endpoint max num define

Functions

void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.

Detailed Description

usb config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/usb_conf.h.


AT32F413 Firmwary Library: src Directory Reference

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • app_led3_toggle
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
hid_iap_user.c
usb hid iap user file
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • app_led3_toggle
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • app_led3_toggle
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c.


AT32F413 Firmwary Library: hid_iap_user.c File Reference

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • app_led3_toggle
  • src
Functions | Variables
hid_iap_user.c File Reference

usb hid iap user file More...

#include "hid_iap_user.h"
#include "hid_iap_class.h"
#include "string.h"

Go to the source code of this file.

Functions

void | iap_clear_upgrade_flag (void)
clear iap upgrade flag
void | iap_set_upgrade_flag (void)
set iap upgrade complete flag
uint32_t | crc_cal (uint32_t addr, uint16_t nk)
crc cal
void | iap_idle (void)
iap idle function
void | iap_start (void)
iap start function
void | iap_finish (void)
void | iap_jump (void)
void | iap_respond (uint8_t *res_buf, uint16_t iap_cmd, uint16_t result)
iap_result_type | iap_get_upgrade_flag (void)
get iap upgrade complete flag
void | iap_init (void)
iap init
void | iap_get ()
iap_result_type | usbd_hid_iap_process (void *udev, uint8_t *pdata, uint16_t len)
usb device iap function
void | usbd_hid_iap_in_complete (void *udev)
usb device in transfer complete function
void | app_loop (void)
iap loop

Variables

void(* pftarget )(void)

Detailed Description

usb hid iap user file

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file app_led3_toggle/src/hid_iap_user.c.


AT32F413 Firmwary Library: main.c File Reference

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • app_led3_toggle
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include "usbd_core.h"
#include "hid_iap_class.h"
#include "hid_iap_desc.h"
#include "hid_iap_user.h"
#include "usbd_int.h"

Go to the source code of this file.

Functions

void | usb_clock48m_select (usb_clk48_s clk_s)
usb 48M clock select
void | USBFS_L_CAN1_RX0_IRQHandler (void)
this function handles usb interrupt.
void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.
int | main (void)
main function.

Variables

usbd_core_type usb_core_dev

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/main.c.


AT32F413 Firmwary Library: app_led4_toggle Directory Reference

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • app_led4_toggle
app_led4_toggle Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • app_led4_toggle
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.
hid_iap_user.h
usb config header file
usb_conf.h
usb config header file


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • app_led4_toggle
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • app_led4_toggle
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • app_led4_toggle
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_int.h.


AT32F413 Firmwary Library: hid_iap_user.h File Reference

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • app_led4_toggle
  • inc
Macros | Functions
hid_iap_user.h File Reference

usb config header file More...

#include "hid_iap_class.h"

Go to the source code of this file.

Macros

#define FLASH_APP_ADDRESS 0x08006000

Functions

void | iap_init (void)
iap init.
iap_result_type | iap_get_upgrade_flag (void)
get iap upgrade complete flag
void | app_loop (void)
iap loop

Detailed Description

usb config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file app_led4_toggle/inc/hid_iap_user.h.


AT32F413 Firmwary Library: usb_conf.h File Reference

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • app_led4_toggle
  • inc
Macros | Functions
usb_conf.h File Reference

usb config header file More...

#include "at32f413.h"
#include "at32f413_board.h"
#include "stdio.h"

Go to the source code of this file.

Macros

#define USB_EPT_AUTO_MALLOC_BUFFER
usb endpoint max num define

Functions

void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.

Detailed Description

usb config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/usb_conf.h.


AT32F413 Firmwary Library: src Directory Reference

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • app_led4_toggle
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
hid_iap_user.c
usb hid iap user file
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • app_led4_toggle
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • app_led4_toggle
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c.


AT32F413 Firmwary Library: hid_iap_user.c File Reference

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • app_led4_toggle
  • src
Functions | Variables
hid_iap_user.c File Reference

usb hid iap user file More...

#include "hid_iap_user.h"
#include "hid_iap_class.h"
#include "string.h"

Go to the source code of this file.

Functions

void | iap_clear_upgrade_flag (void)
clear iap upgrade flag
void | iap_set_upgrade_flag (void)
set iap upgrade complete flag
uint32_t | crc_cal (uint32_t addr, uint16_t nk)
crc cal
void | iap_idle (void)
iap idle function
void | iap_start (void)
iap start function
void | iap_finish (void)
void | iap_jump (void)
void | iap_respond (uint8_t *res_buf, uint16_t iap_cmd, uint16_t result)
iap_result_type | iap_get_upgrade_flag (void)
get iap upgrade complete flag
void | iap_init (void)
iap init
void | iap_get ()
iap_result_type | usbd_hid_iap_process (void *udev, uint8_t *pdata, uint16_t len)
usb device iap function
void | usbd_hid_iap_in_complete (void *udev)
usb device in transfer complete function
void | app_loop (void)
iap loop

Variables

void(* pftarget )(void)

Detailed Description

usb hid iap user file

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file app_led4_toggle/src/hid_iap_user.c.


AT32F413 Firmwary Library: main.c File Reference

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • app_led4_toggle
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include "usbd_core.h"
#include "hid_iap_class.h"
#include "hid_iap_desc.h"
#include "hid_iap_user.h"
#include "usbd_int.h"

Go to the source code of this file.

Functions

void | usb_clock48m_select (usb_clk48_s clk_s)
usb 48M clock select
void | USBFS_L_CAN1_RX0_IRQHandler (void)
this function handles usb interrupt.
void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.
int | main (void)
main function.

Variables

usbd_core_type usb_core_dev

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/main.c.


AT32F413 Firmwary Library: bootloader Directory Reference

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • bootloader
bootloader Directory Reference

Directories

inc
src


AT32F413 Firmwary Library: inc Directory Reference

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • bootloader
  • inc
inc Directory Reference

Files

at32f413_clock.h
header file of clock program
at32f413_conf.h
at32f413 config header file
at32f413_int.h
header file of main interrupt service routines.
hid_iap_user.h
usb config header file
usb_conf.h
usb config header file


AT32F413 Firmwary Library: at32f413_clock.h File Reference

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • bootloader
  • inc
Functions
at32f413_clock.h File Reference

header file of clock program More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

header file of clock program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_clock.h.


AT32F413 Firmwary Library: at32f413_conf.h File Reference

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • bootloader
  • inc
Macros
at32f413_conf.h File Reference

at32f413 config header file More...

#include "at32f413_crm.h"
#include "at32f413_tmr.h"
#include "at32f413_rtc.h"
#include "at32f413_bpr.h"
#include "at32f413_gpio.h"
#include "at32f413_i2c.h"
#include "at32f413_usart.h"
#include "at32f413_pwc.h"
#include "at32f413_can.h"
#include "at32f413_adc.h"
#include "at32f413_spi.h"
#include "at32f413_dma.h"
#include "at32f413_debug.h"
#include "at32f413_flash.h"
#include "at32f413_crc.h"
#include "at32f413_wwdt.h"
#include "at32f413_wdt.h"
#include "at32f413_exint.h"
#include "at32f413_sdio.h"
#include "at32f413_acc.h"
#include "at32f413_misc.h"
#include "at32f413_usb.h"

Go to the source code of this file.

Macros

#define | HEXT_VALUE ((uint32_t)8000000)
in the following line adjust the value of high speed external crystal (hext) used in your application
#define | HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
in the following line adjust the high speed external crystal (hext) startup timeout value
#define | HICK_VALUE ((uint32_t)8000000)
#define | LEXT_VALUE ((uint32_t)32768)
#define | CRM_MODULE_ENABLED
#define | TMR_MODULE_ENABLED
#define | RTC_MODULE_ENABLED
#define | BPR_MODULE_ENABLED
#define | GPIO_MODULE_ENABLED
#define | I2C_MODULE_ENABLED
#define | USART_MODULE_ENABLED
#define | PWC_MODULE_ENABLED
#define | CAN_MODULE_ENABLED
#define | ADC_MODULE_ENABLED
#define | SPI_MODULE_ENABLED
#define | DMA_MODULE_ENABLED
#define | DEBUG_MODULE_ENABLED
#define | FLASH_MODULE_ENABLED
#define | CRC_MODULE_ENABLED
#define | WWDT_MODULE_ENABLED
#define | WDT_MODULE_ENABLED
#define | EXINT_MODULE_ENABLED
#define | SDIO_MODULE_ENABLED
#define | USB_MODULE_ENABLED
#define | ACC_MODULE_ENABLED
#define | MISC_MODULE_ENABLED

Detailed Description

at32f413 config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

Macro Definition Documentation

◆ ACC_MODULE_ENABLED

#define ACC_MODULE_ENABLED

Definition at line 75 of file utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ ADC_MODULE_ENABLED

#define ADC_MODULE_ENABLED

Definition at line 64 of file utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ BPR_MODULE_ENABLED

#define BPR_MODULE_ENABLED

Definition at line 58 of file utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ CAN_MODULE_ENABLED

#define CAN_MODULE_ENABLED

Definition at line 63 of file utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ CRC_MODULE_ENABLED

#define CRC_MODULE_ENABLED

Definition at line 69 of file utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ CRM_MODULE_ENABLED

#define CRM_MODULE_ENABLED

Definition at line 55 of file utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ DEBUG_MODULE_ENABLED

#define DEBUG_MODULE_ENABLED

Definition at line 67 of file utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ DMA_MODULE_ENABLED

#define DMA_MODULE_ENABLED

Definition at line 66 of file utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ EXINT_MODULE_ENABLED

#define EXINT_MODULE_ENABLED

Definition at line 72 of file utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ FLASH_MODULE_ENABLED

#define FLASH_MODULE_ENABLED

Definition at line 68 of file utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ GPIO_MODULE_ENABLED

#define GPIO_MODULE_ENABLED

Definition at line 59 of file utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ HEXT_STARTUP_TIMEOUT

#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)

in the following line adjust the high speed external crystal (hext) startup timeout value

time out for hext start up

Definition at line 50 of file utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ HEXT_VALUE

#define HEXT_VALUE ((uint32_t)8000000)

in the following line adjust the value of high speed external crystal (hext) used in your application

tip: to avoid modifying this file each time you need to use different hext, you can define the hext value in your toolchain compiler preprocessor. value of the high speed external crystal in hz

Definition at line 43 of file utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ HICK_VALUE

#define HICK_VALUE ((uint32_t)8000000)

value of the high speed internal clock in hz

Definition at line 51 of file utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ I2C_MODULE_ENABLED

#define I2C_MODULE_ENABLED

Definition at line 60 of file utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ LEXT_VALUE

#define LEXT_VALUE ((uint32_t)32768)

value of the low speed external clock in hz

Definition at line 52 of file utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ MISC_MODULE_ENABLED

#define MISC_MODULE_ENABLED

Definition at line 76 of file utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ PWC_MODULE_ENABLED

#define PWC_MODULE_ENABLED

Definition at line 62 of file utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ RTC_MODULE_ENABLED

#define RTC_MODULE_ENABLED

Definition at line 57 of file utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ SDIO_MODULE_ENABLED

#define SDIO_MODULE_ENABLED

Definition at line 73 of file utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ SPI_MODULE_ENABLED

#define SPI_MODULE_ENABLED

Definition at line 65 of file utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ TMR_MODULE_ENABLED

#define TMR_MODULE_ENABLED

Definition at line 56 of file utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ USART_MODULE_ENABLED

#define USART_MODULE_ENABLED

Definition at line 61 of file utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ USB_MODULE_ENABLED

#define USB_MODULE_ENABLED

Definition at line 74 of file utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ WDT_MODULE_ENABLED

#define WDT_MODULE_ENABLED

Definition at line 71 of file utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h.

◆ WWDT_MODULE_ENABLED

#define WWDT_MODULE_ENABLED

Definition at line 70 of file utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h.


AT32F413 Firmwary Library: at32f413_int.h File Reference

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • bootloader
  • inc
Functions
at32f413_int.h File Reference

header file of main interrupt service routines. More...

#include "at32f413.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

header file of main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_int.h.


AT32F413 Firmwary Library: hid_iap_user.h File Reference

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • bootloader
  • inc
Macros | Functions
hid_iap_user.h File Reference

usb config header file More...

#include "hid_iap_class.h"

Go to the source code of this file.

Macros

#define FLASH_APP_ADDRESS 0x08006000

Functions

void | iap_init (void)
iap init.
iap_result_type | iap_get_upgrade_flag (void)
get iap upgrade complete flag
void | iap_loop (void)
iap loop
void | jump_to_app (uint32_t address)
jump to app

Detailed Description

usb config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file bootloader/inc/hid_iap_user.h.


AT32F413 Firmwary Library: usb_conf.h File Reference

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • bootloader
  • inc
Macros | Functions
usb_conf.h File Reference

usb config header file More...

#include "at32f413.h"
#include "at32f413_board.h"
#include "stdio.h"

Go to the source code of this file.

Macros

#define USB_EPT_AUTO_MALLOC_BUFFER
usb endpoint max num define

Functions

void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.

Detailed Description

usb config header file

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/usb_conf.h.


AT32F413 Firmwary Library: src Directory Reference

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • bootloader
  • src
src Directory Reference

Files

at32f413_clock.c
system clock config program
at32f413_int.c
main interrupt service routines.
hid_iap_user.c
usb hid iap user file
main.c
main program


AT32F413 Firmwary Library: at32f413_clock.c File Reference

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • bootloader
  • src
Functions
at32f413_clock.c File Reference

system clock config program More...

#include "at32f413_clock.h"

Go to the source code of this file.

Functions

void system_clock_config (void)
system clock config program

Detailed Description

system clock config program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_usb_iap_demo/source_code/bootloader/src/at32f413_clock.c.


AT32F413 Firmwary Library: at32f413_int.c File Reference

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • bootloader
  • src
Functions
at32f413_int.c File Reference

main interrupt service routines. More...

#include "at32f413_int.h"

Go to the source code of this file.

Functions

void | NMI_Handler (void)
this function handles nmi exception.
void | HardFault_Handler (void)
this function handles hard fault exception.
void | MemManage_Handler (void)
this function handles memory manage exception.
void | BusFault_Handler (void)
this function handles bus fault exception.
void | UsageFault_Handler (void)
this function handles usage fault exception.
void | SVC_Handler (void)
this function handles svcall exception.
void | DebugMon_Handler (void)
this function handles debug monitor exception.
void | PendSV_Handler (void)
this function handles pendsv_handler exception.
void | SysTick_Handler (void)
this function handles systick handler.

Detailed Description

main interrupt service routines.

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_usb_iap_demo/source_code/bootloader/src/at32f413_int.c.


AT32F413 Firmwary Library: hid_iap_user.c File Reference

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • bootloader
  • src
Functions | Variables
hid_iap_user.c File Reference

usb hid iap user file More...

#include "hid_iap_user.h"
#include "hid_iap_class.h"
#include "string.h"

Go to the source code of this file.

Functions

void | iap_clear_upgrade_flag (void)
clear iap upgrade flag
void | iap_set_upgrade_flag (void)
set iap upgrade complete flag
uint32_t | crc_cal (uint32_t addr, uint16_t nk)
crc cal
void | iap_idle (void)
iap idle function
void | iap_start (void)
iap start function
iap_result_type | iap_address (uint8_t *pdata, uint32_t len)
iap parse address
void | iap_finish (void)
iap_result_type | iap_data_write (uint8_t *pdata, uint32_t len)
void | iap_jump (void)
void | iap_respond (uint8_t *res_buf, uint16_t iap_cmd, uint16_t result)
void | jump_to_app (uint32_t address)
jump to app
iap_result_type | iap_get_upgrade_flag (void)
get iap upgrade complete flag
void | iap_erase_sector (uint32_t address)
set iap upgrade complete flag
void | iap_init (void)
iap init
void | iap_crc (uint8_t *pdata, uint32_t len)
void | iap_get ()
iap_result_type | usbd_hid_iap_process (void *udev, uint8_t *pdata, uint16_t len)
usb device iap function
void | usbd_hid_iap_in_complete (void *udev)
usb device in transfer complete function
void | iap_loop (void)
iap loop

Variables

void(* | pftarget )(void)
uint32_t | stkptr
uint32_t | jumpaddr

Detailed Description

usb hid iap user file

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file bootloader/src/hid_iap_user.c.


AT32F413 Firmwary Library: main.c File Reference

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • bootloader
  • src
Functions | Variables
main.c File Reference

main program More...

#include "at32f413_board.h"
#include "at32f413_clock.h"
#include "usbd_core.h"
#include "hid_iap_class.h"
#include "hid_iap_desc.h"
#include "hid_iap_user.h"
#include "usbd_int.h"

Go to the source code of this file.

Functions

void | usb_clock48m_select (usb_clk48_s clk_s)
usb 48M clock select
void | USBFS_L_CAN1_RX0_IRQHandler (void)
this function handles usb interrupt.
void | usb_delay_ms (uint32_t ms)
usb delay millisecond function.
void | usb_delay_us (uint32_t us)
usb delay microsecond function.
int | main (void)
main function.

Variables

usbd_core_type usb_core_dev

Detailed Description

main program

Copyright (c) 2025, Artery Technology, All rights reserved.

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 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.

Definition in file utilities/at32f413_usb_iap_demo/source_code/bootloader/src/main.c.


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- _ -

  • __AT32F413_LIBRARY_VERSION : at32f413.h
  • __AT32F413_LIBRARY_VERSION_MAJOR : at32f413.h
  • __AT32F413_LIBRARY_VERSION_MIDDLE : at32f413.h
  • __AT32F413_LIBRARY_VERSION_MINOR : at32f413.h
  • __AT32F413_LIBRARY_VERSION_RC : at32f413.h
  • __CM4_REV : at32f413.h
  • __FPU_PRESENT : at32f413.h
  • __MPU_PRESENT : at32f413.h
  • __NVIC_PRIO_BITS : at32f413.h
  • __Vendor_SysTickConfig : at32f413.h
  • _asciimap : cdc_keyboard_class.c, keyboard_class.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- a -

  • ACC : at32f413_acc.h
  • ACC_BASE : at32f413.h
  • acc_c2_value : project/at_start_f413/examples/acc/calibration/src/main.c
  • ACC_CAL_HICKCAL : at32f413_acc.h
  • ACC_CAL_HICKTRIM : at32f413_acc.h
  • acc_calibration_mode_enable() : at32f413_acc.h, at32f413_acc.c
  • ACC_CALRDY_FLAG : at32f413_acc.h
  • ACC_CALRDYIEN_INT : at32f413_acc.h
  • ACC_EIEN_INT : at32f413_acc.h
  • acc_flag_clear() : at32f413_acc.h, at32f413_acc.c
  • acc_flag_get() : at32f413_acc.h, at32f413_acc.c
  • acc_hickcal_get() : at32f413_acc.h, at32f413_acc.c
  • acc_hicktrim_get() : at32f413_acc.h, at32f413_acc.c
  • acc_interrupt_enable() : at32f413_acc.h, at32f413_acc.c
  • acc_interrupt_flag_get() : at32f413_acc.h, at32f413_acc.c
  • ACC_IRQHandler() : project/at_start_f413/examples/acc/calibration/src/main.c
  • ACC_IRQn : at32f413.h
  • ACC_MODULE_ENABLED : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • acc_read_c1() : at32f413_acc.h, at32f413_acc.c
  • acc_read_c2() : at32f413_acc.h, at32f413_acc.c
  • acc_read_c3() : at32f413_acc.h, at32f413_acc.c
  • ACC_RSLOST_FLAG : at32f413_acc.h
  • acc_step_set() : at32f413_acc.h, at32f413_acc.c
  • ACC_TRIM : project/at_start_f413/examples/acc/calibration/src/main.c
  • acc_write_c1() : at32f413_acc.h, at32f413_acc.c
  • acc_write_c2() : at32f413_acc.h, at32f413_acc.c
  • acc_write_c3() : at32f413_acc.h, at32f413_acc.c
  • ADC1 : at32f413_adc.h
  • ADC12_ORDINARY_TRIG_EXINT11_TMR8TRGOUT : at32f413_adc.h
  • ADC12_ORDINARY_TRIG_SOFTWARE : at32f413_adc.h
  • ADC12_ORDINARY_TRIG_TMR1CH1 : at32f413_adc.h
  • ADC12_ORDINARY_TRIG_TMR1CH2 : at32f413_adc.h
  • ADC12_ORDINARY_TRIG_TMR1CH3 : at32f413_adc.h
  • ADC12_ORDINARY_TRIG_TMR1TRGOUT : at32f413_adc.h
  • ADC12_ORDINARY_TRIG_TMR2CH2 : at32f413_adc.h
  • ADC12_ORDINARY_TRIG_TMR3TRGOUT : at32f413_adc.h
  • ADC12_ORDINARY_TRIG_TMR4CH4 : at32f413_adc.h
  • ADC12_ORDINARY_TRIG_TMR8CH1 : at32f413_adc.h
  • ADC12_ORDINARY_TRIG_TMR8CH2 : at32f413_adc.h
  • ADC12_PREEMPT_TRIG_EXINT15_TMR8CH4 : at32f413_adc.h
  • ADC12_PREEMPT_TRIG_SOFTWARE : at32f413_adc.h
  • ADC12_PREEMPT_TRIG_TMR1CH1 : at32f413_adc.h
  • ADC12_PREEMPT_TRIG_TMR1CH4 : at32f413_adc.h
  • ADC12_PREEMPT_TRIG_TMR1TRGOUT : at32f413_adc.h
  • ADC12_PREEMPT_TRIG_TMR2CH1 : at32f413_adc.h
  • ADC12_PREEMPT_TRIG_TMR2TRGOUT : at32f413_adc.h
  • ADC12_PREEMPT_TRIG_TMR3CH4 : at32f413_adc.h
  • ADC12_PREEMPT_TRIG_TMR4TRGOUT : at32f413_adc.h
  • ADC12_PREEMPT_TRIG_TMR8CH1 : at32f413_adc.h
  • ADC12_PREEMPT_TRIG_TMR8TRGOUT : at32f413_adc.h
  • ADC1_2_IRQHandler() : project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c, project/at_start_f413/examples/adc/voltage_monitoring/src/main.c
  • ADC1_2_IRQn : at32f413.h
  • ADC1_BASE : at32f413.h
  • ADC1_ETO_GMUX : at32f413_gpio.h
  • ADC1_ETO_MUX : at32f413_gpio.h
  • ADC1_ETP_GMUX : at32f413_gpio.h
  • ADC1_ETP_MUX : at32f413_gpio.h
  • adc1_ordinary_value : project/at_start_f413/examples/adc/current_vref_value_check/src/main.c, project/at_start_f413/examples/adc/internal_temperature_sensor/src/main.c
  • adc1_ordinary_valuetab : project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/main.c, project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/main.c, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c, project/at_start_f413/examples/adc/voltage_monitoring/src/main.c
  • adc1_preempt_valuetab : project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c
  • ADC2 : at32f413_adc.h
  • ADC2_BASE : at32f413.h
  • ADC2_ETO_GMUX : at32f413_gpio.h
  • ADC2_ETO_MUX : at32f413_gpio.h
  • ADC2_ETP_GMUX : at32f413_gpio.h
  • ADC2_ETP_MUX : at32f413_gpio.h
  • adc_base_config() : at32f413_adc.h, at32f413_adc.c
  • adc_base_default_para_init() : at32f413_adc.h, at32f413_adc.c
  • adc_calibration_init() : at32f413_adc.h, at32f413_adc.c
  • adc_calibration_init_status_get() : at32f413_adc.h, at32f413_adc.c
  • adc_calibration_start() : at32f413_adc.h, at32f413_adc.c
  • adc_calibration_status_get() : at32f413_adc.h, at32f413_adc.c
  • ADC_CCE_FLAG : at32f413_adc.h
  • ADC_CCE_INT : at32f413_adc.h
  • ADC_CHANNEL_0 : at32f413_adc.h
  • ADC_CHANNEL_1 : at32f413_adc.h
  • ADC_CHANNEL_10 : at32f413_adc.h
  • ADC_CHANNEL_11 : at32f413_adc.h
  • ADC_CHANNEL_12 : at32f413_adc.h
  • ADC_CHANNEL_13 : at32f413_adc.h
  • ADC_CHANNEL_14 : at32f413_adc.h
  • ADC_CHANNEL_15 : at32f413_adc.h
  • ADC_CHANNEL_16 : at32f413_adc.h
  • ADC_CHANNEL_17 : at32f413_adc.h
  • ADC_CHANNEL_2 : at32f413_adc.h
  • ADC_CHANNEL_3 : at32f413_adc.h
  • ADC_CHANNEL_4 : at32f413_adc.h
  • ADC_CHANNEL_5 : at32f413_adc.h
  • ADC_CHANNEL_6 : at32f413_adc.h
  • ADC_CHANNEL_7 : at32f413_adc.h
  • ADC_CHANNEL_8 : at32f413_adc.h
  • ADC_CHANNEL_9 : at32f413_adc.h
  • adc_channel_select_type : at32f413_adc.h
  • adc_combine_mode_select() : at32f413_adc.h, at32f413_adc.c
  • adc_combine_mode_type : at32f413_adc.h
  • adc_combine_ordinary_conversion_data_get() : at32f413_adc.h, at32f413_adc.c
  • adc_config() : project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/main.c, project/at_start_f413/examples/adc/current_vref_value_check/src/main.c, project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c, project/at_start_f413/examples/adc/internal_temperature_sensor/src/main.c, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/main.c, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c, project/at_start_f413/examples/adc/voltage_monitoring/src/main.c
  • adc_data_align_type : at32f413_adc.h
  • adc_dma_mode_enable() : at32f413_adc.h, at32f413_adc.c
  • adc_enable() : at32f413_adc.h, at32f413_adc.c
  • adc_flag_clear() : at32f413_adc.h, at32f413_adc.c
  • adc_flag_get() : at32f413_adc.h, at32f413_adc.c
  • ADC_INDEPENDENT_MODE : at32f413_adc.h
  • adc_interrupt_enable() : at32f413_adc.h, at32f413_adc.c
  • adc_interrupt_flag_get() : at32f413_adc.h, at32f413_adc.c
  • ADC_LEFT_ALIGNMENT : at32f413_adc.h
  • ADC_MODULE_ENABLED : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • ADC_OCCS_FLAG : at32f413_adc.h
  • adc_ordinary_channel_set() : at32f413_adc.h, at32f413_adc.c
  • adc_ordinary_conversion_data_get() : at32f413_adc.h, at32f413_adc.c
  • adc_ordinary_conversion_trigger_set() : at32f413_adc.h, at32f413_adc.c
  • ADC_ORDINARY_LONGSHIFT_ONLY_MODE : at32f413_adc.h
  • ADC_ORDINARY_LONGSHIFT_PREEMPT_SMLT_MODE : at32f413_adc.h
  • adc_ordinary_part_count_set() : at32f413_adc.h, at32f413_adc.c
  • adc_ordinary_part_mode_enable() : at32f413_adc.h, at32f413_adc.c
  • ADC_ORDINARY_SHORTSHIFT_ONLY_MODE : at32f413_adc.h
  • ADC_ORDINARY_SHORTSHIFT_PREEMPT_SMLT_MODE : at32f413_adc.h
  • ADC_ORDINARY_SMLT_ONLY_MODE : at32f413_adc.h
  • ADC_ORDINARY_SMLT_PREEMPT_INTERLTRIG_MODE : at32f413_adc.h
  • ADC_ORDINARY_SMLT_PREEMPT_SMLT_MODE : at32f413_adc.h
  • adc_ordinary_software_trigger_enable() : at32f413_adc.h, at32f413_adc.c
  • adc_ordinary_software_trigger_status_get() : at32f413_adc.h, at32f413_adc.c
  • adc_ordinary_trig_select_type : at32f413_adc.h
  • ADC_PCCE_FLAG : at32f413_adc.h
  • ADC_PCCE_INT : at32f413_adc.h
  • ADC_PCCS_FLAG : at32f413_adc.h
  • adc_preempt_auto_mode_enable() : at32f413_adc.h, at32f413_adc.c
  • ADC_PREEMPT_CHANNEL_1 : at32f413_adc.h
  • ADC_PREEMPT_CHANNEL_2 : at32f413_adc.h
  • ADC_PREEMPT_CHANNEL_3 : at32f413_adc.h
  • ADC_PREEMPT_CHANNEL_4 : at32f413_adc.h
  • adc_preempt_channel_length_set() : at32f413_adc.h, at32f413_adc.c
  • adc_preempt_channel_set() : at32f413_adc.h, at32f413_adc.c
  • adc_preempt_channel_type : at32f413_adc.h
  • adc_preempt_conversion_data_get() : at32f413_adc.h, at32f413_adc.c
  • adc_preempt_conversion_trigger_set() : at32f413_adc.h, at32f413_adc.c
  • ADC_PREEMPT_INTERLTRIG_ONLY_MODE : at32f413_adc.h
  • adc_preempt_offset_value_set() : at32f413_adc.h, at32f413_adc.c
  • adc_preempt_part_mode_enable() : at32f413_adc.h, at32f413_adc.c
  • ADC_PREEMPT_SMLT_ONLY_MODE : at32f413_adc.h
  • adc_preempt_software_trigger_enable() : at32f413_adc.h, at32f413_adc.c
  • adc_preempt_software_trigger_status_get() : at32f413_adc.h, at32f413_adc.c
  • adc_preempt_trig_select_type : at32f413_adc.h
  • adc_reset() : at32f413_adc.h, at32f413_adc.c
  • ADC_RIGHT_ALIGNMENT : at32f413_adc.h
  • ADC_SAMPLETIME_13_5 : at32f413_adc.h
  • ADC_SAMPLETIME_1_5 : at32f413_adc.h
  • ADC_SAMPLETIME_239_5 : at32f413_adc.h
  • ADC_SAMPLETIME_28_5 : at32f413_adc.h
  • ADC_SAMPLETIME_41_5 : at32f413_adc.h
  • ADC_SAMPLETIME_55_5 : at32f413_adc.h
  • ADC_SAMPLETIME_71_5 : at32f413_adc.h
  • ADC_SAMPLETIME_7_5 : at32f413_adc.h
  • adc_sampletime_select_type : at32f413_adc.h
  • ADC_TEMP_BASE : project/at_start_f413/examples/adc/internal_temperature_sensor/src/main.c
  • ADC_TEMP_SLOPE : project/at_start_f413/examples/adc/internal_temperature_sensor/src/main.c
  • adc_tempersensor_vintrv_enable() : at32f413_adc.h, at32f413_adc.c
  • ADC_VMONITOR_ALL_ORDINARY : at32f413_adc.h
  • ADC_VMONITOR_ALL_ORDINARY_PREEMPT : at32f413_adc.h
  • ADC_VMONITOR_ALL_PREEMPT : at32f413_adc.h
  • ADC_VMONITOR_NONE : at32f413_adc.h
  • ADC_VMONITOR_SINGLE_ORDINARY : at32f413_adc.h
  • ADC_VMONITOR_SINGLE_ORDINARY_PREEMPT : at32f413_adc.h
  • ADC_VMONITOR_SINGLE_PREEMPT : at32f413_adc.h
  • ADC_VMOR_FLAG : at32f413_adc.h
  • ADC_VMOR_INT : at32f413_adc.h
  • adc_voltage_monitor_enable() : at32f413_adc.h, at32f413_adc.c
  • adc_voltage_monitor_single_channel_select() : at32f413_adc.h, at32f413_adc.c
  • adc_voltage_monitor_threshold_value_set() : at32f413_adc.h, at32f413_adc.c
  • adc_voltage_monitoring_type : at32f413_adc.h
  • ADC_VREF : project/at_start_f413/examples/adc/internal_temperature_sensor/src/main.c
  • ADDRESS_OUT_OF_RANGE : cdc_msc_class.h, msc_bot_scsi.h
  • AHBPERIPH_BASE : at32f413.h
  • AIRCR_VECTKEY_MASK : at32f413_misc.c
  • alarm_init() : project/at_start_f413/examples/rtc/calendar/src/main.c
  • ALIGNED_TAIL : diskio.c, audio_desc.c, audio_hid_desc.c, cdc_desc.c, cdc_keyboard_desc.c, cdc_msc_desc.c, composite_cdc_msc/msc_bot_scsi.c, custom_hid_desc.c, hid_iap_desc.c, keyboard_desc.c, mouse_desc.c, msc/msc_bot_scsi.c, msc_desc.c, printer_class.c, printer_desc.c, winusb_desc.c
  • APB1PERIPH_BASE : at32f413.h
  • APB2PERIPH_BASE : at32f413.h
  • app_load() : bootloader/inc/iap.h, bootloader/src/iap.c
  • app_loop() : app_led3_toggle/inc/hid_iap_user.h, app_led3_toggle/src/hid_iap_user.c, app_led4_toggle/inc/hid_iap_user.h, app_led4_toggle/src/hid_iap_user.c
  • APP_START_ADDR : app_led3_toggle/inc/iap.h, app_led4_toggle/inc/iap.h, bootloader/inc/iap.h
  • app_update_handle() : bootloader/src/iap.c
  • arm_apply_guard_bits() : project_l0/inc/math_helper.h, project_l0/src/math_helper.c, project_l1/inc/math_helper.h, project_l1/src/math_helper.c
  • arm_calc_2pow() : project_l0/inc/math_helper.h, project_l0/src/math_helper.c, project_l1/inc/math_helper.h, project_l1/src/math_helper.c
  • arm_calc_guard_bits() : project_l0/inc/math_helper.h, project_l0/src/math_helper.c, project_l1/inc/math_helper.h, project_l1/src/math_helper.c
  • arm_compare_fixed_q15() : project_l0/inc/math_helper.h, project_l0/src/math_helper.c, project_l1/inc/math_helper.h, project_l1/src/math_helper.c
  • arm_compare_fixed_q31() : project_l0/inc/math_helper.h, project_l0/src/math_helper.c, project_l1/inc/math_helper.h, project_l1/src/math_helper.c
  • arm_fir_f32() : project_l0/inc/fir_filter.h, project_l1/inc/fir_filter.h
  • arm_fir_init_f32() : project_l0/inc/fir_filter.h, arm_fir_init_f32.c, project_l1/inc/fir_filter.h
  • arm_float_to_q12_20() : project_l0/inc/math_helper.h, project_l0/src/math_helper.c, project_l1/inc/math_helper.h, project_l1/src/math_helper.c
  • arm_float_to_q14() : project_l0/inc/math_helper.h, project_l0/src/math_helper.c, project_l1/inc/math_helper.h, project_l1/src/math_helper.c
  • arm_float_to_q28() : project_l0/inc/math_helper.h, project_l0/src/math_helper.c, project_l1/inc/math_helper.h, project_l1/src/math_helper.c
  • arm_float_to_q29() : project_l0/inc/math_helper.h, project_l0/src/math_helper.c, project_l1/inc/math_helper.h, project_l1/src/math_helper.c
  • arm_float_to_q30() : project_l0/inc/math_helper.h, project_l0/src/math_helper.c, project_l1/inc/math_helper.h, project_l1/src/math_helper.c
  • arm_provide_guard_bits_q15() : project_l0/inc/math_helper.h, project_l0/src/math_helper.c, project_l1/inc/math_helper.h, project_l1/src/math_helper.c
  • arm_provide_guard_bits_q31() : project_l0/inc/math_helper.h, project_l0/src/math_helper.c, project_l1/inc/math_helper.h, project_l1/src/math_helper.c
  • arm_provide_guard_bits_q7() : project_l0/src/math_helper.c, project_l1/src/math_helper.c
  • arm_snr_f32() : project_l0/inc/math_helper.h, project_l0/src/math_helper.c, project_l1/inc/math_helper.h, project_l1/src/math_helper.c
  • AT32_AUDIO_FREQ_16K : audio_desc.h, audio_hid_desc.h
  • AT32_AUDIO_FREQ_48K : audio_desc.h, audio_hid_desc.h
  • at32_board_init() : at32f413_board.c, at32f413_board.h
  • at32_button_init() : at32f413_board.c, at32f413_board.h
  • at32_button_press() : at32f413_board.c, at32f413_board.h
  • at32_button_state() : at32f413_board.c, at32f413_board.h
  • at32_led_init() : at32f413_board.c, at32f413_board.h
  • at32_led_off() : at32f413_board.c, at32f413_board.h
  • at32_led_on() : at32f413_board.c, at32f413_board.h
  • at32_led_toggle() : at32f413_board.c, at32f413_board.h
  • atr_decode_status : project/at_start_f413/examples/usart/smartcard/src/main.c
  • AUDIO_AC_DESCRIPTOR_UNDEFINED : audio_desc.h, audio_hid_desc.h
  • AUDIO_AC_EXTENSION_UNIT : audio_desc.h, audio_hid_desc.h
  • AUDIO_AC_FEATURE_UNIT : audio_desc.h, audio_hid_desc.h
  • AUDIO_AC_HEADER : audio_desc.h, audio_hid_desc.h
  • AUDIO_AC_INPUT_TERMINAL : audio_desc.h, audio_hid_desc.h
  • AUDIO_AC_MIXER_UNIT : audio_desc.h, audio_hid_desc.h
  • AUDIO_AC_OUTPUT_TERMINAL : audio_desc.h, audio_hid_desc.h
  • AUDIO_AC_PROCESSING_UNIT : audio_desc.h, audio_hid_desc.h
  • AUDIO_AC_SELECTOR_UNIT : audio_desc.h, audio_hid_desc.h
  • AUDIO_AS_DESCRIPTOR_UNDEFINED : audio_desc.h, audio_hid_desc.h
  • AUDIO_AS_FORMAT_SPECIFIC : audio_desc.h, audio_hid_desc.h
  • AUDIO_AS_FORMAT_TYPE : audio_desc.h, audio_hid_desc.h
  • AUDIO_AS_GENERAL : audio_desc.h, audio_hid_desc.h
  • AUDIO_BCD_NUM : audio_desc.h
  • AUDIO_BINTERVAL_TIME : audio_desc.h
  • AUDIO_BITW_16 : audio/audio_conf.h, audio_hid/audio_conf.h
  • audio_class_handler : audio_class.c, audio_class.h
  • audio_codec : audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • audio_codec_init() : audio/inc/audio_codec.h, audio/src/audio_codec.c, composite_audio_hid/inc/audio_codec.h, composite_audio_hid/src/audio_codec.c
  • audio_codec_loop() : audio/inc/audio_codec.h, audio/src/audio_codec.c, composite_audio_hid/inc/audio_codec.h, composite_audio_hid/src/audio_codec.c
  • audio_codec_mic_alt_setting() : audio/inc/audio_codec.h, audio/src/audio_codec.c, composite_audio_hid/inc/audio_codec.h, composite_audio_hid/src/audio_codec.c
  • audio_codec_mic_get_data() : audio/inc/audio_codec.h, audio/src/audio_codec.c, composite_audio_hid/inc/audio_codec.h, composite_audio_hid/src/audio_codec.c
  • audio_codec_modify_freq() : audio/inc/audio_codec.h, audio/src/audio_codec.c, composite_audio_hid/inc/audio_codec.h, composite_audio_hid/src/audio_codec.c
  • audio_codec_set_mic_freq() : audio/inc/audio_codec.h, audio/src/audio_codec.c, composite_audio_hid/inc/audio_codec.h, composite_audio_hid/src/audio_codec.c
  • audio_codec_set_mic_mute() : audio/inc/audio_codec.h, audio/src/audio_codec.c, composite_audio_hid/inc/audio_codec.h, composite_audio_hid/src/audio_codec.c
  • audio_codec_set_mic_volume() : audio/inc/audio_codec.h, audio/src/audio_codec.c, composite_audio_hid/inc/audio_codec.h, composite_audio_hid/src/audio_codec.c
  • audio_codec_set_spk_freq() : audio/inc/audio_codec.h, audio/src/audio_codec.c, composite_audio_hid/inc/audio_codec.h, composite_audio_hid/src/audio_codec.c
  • audio_codec_set_spk_mute() : audio/inc/audio_codec.h, audio/src/audio_codec.c, composite_audio_hid/inc/audio_codec.h, composite_audio_hid/src/audio_codec.c
  • audio_codec_set_spk_volume() : audio/inc/audio_codec.h, audio/src/audio_codec.c, composite_audio_hid/inc/audio_codec.h, composite_audio_hid/src/audio_codec.c
  • audio_codec_spk_alt_setting() : audio/inc/audio_codec.h, audio/src/audio_codec.c, composite_audio_hid/inc/audio_codec.h, composite_audio_hid/src/audio_codec.c
  • audio_codec_spk_feedback() : audio/inc/audio_codec.h, audio/src/audio_codec.c, composite_audio_hid/inc/audio_codec.h, composite_audio_hid/src/audio_codec.c
  • audio_codec_spk_fifo_write() : audio/inc/audio_codec.h, audio/src/audio_codec.c, composite_audio_hid/inc/audio_codec.h, composite_audio_hid/src/audio_codec.c
  • AUDIO_CS_CONFIGURATION : audio_desc.h, audio_hid_desc.h
  • AUDIO_CS_DEVICE : audio_desc.h, audio_hid_desc.h
  • AUDIO_CS_ENDPOINT : audio_desc.h, audio_hid_desc.h
  • AUDIO_CS_INTERFACE : audio_desc.h, audio_hid_desc.h
  • AUDIO_CS_STRING : audio_desc.h, audio_hid_desc.h
  • AUDIO_CS_UNDEFINED : audio_desc.h, audio_hid_desc.h
  • AUDIO_DEFAULT_BITW : audio/audio_conf.h, audio_hid/audio_conf.h
  • AUDIO_DEFAULT_FREQ : audio/audio_conf.h, audio_hid/audio_conf.h
  • audio_desc_handler : audio_desc.c, audio_desc.h
  • AUDIO_DESCRIPTOR_SIZE : audio_class.h, audio_hid_class.h
  • AUDIO_DESCRIPTOR_TYPE : audio_class.h, audio_hid_class.h
  • AUDIO_FEATURE_UNIT_SIZE : audio_desc.h, audio_hid_desc.h
  • AUDIO_FEEDBACK_MAXPACKET_SIZE : audio_class.h, audio_hid_class.h
  • AUDIO_FORMAT_TYPE_I : audio_desc.h, audio_hid_desc.h
  • AUDIO_FREQ_16K : audio/audio_conf.h, audio_hid/audio_conf.h
  • AUDIO_FREQ_48K : audio/audio_conf.h, audio_hid/audio_conf.h
  • AUDIO_FREQ_SET_CONTROL : audio_class.h, audio_hid_class.h
  • AUDIO_FU_BASS_CONTROL : audio_desc.h, audio_hid_desc.h
  • AUDIO_FU_CONTROL_UNDEFINED : audio_desc.h, audio_hid_desc.h
  • AUDIO_FU_MID_CONTROL : audio_desc.h, audio_hid_desc.h
  • AUDIO_FU_MUTE_CONTROL : audio_desc.h, audio_hid_desc.h
  • AUDIO_FU_TREBLE_CONTROL : audio_desc.h, audio_hid_desc.h
  • AUDIO_FU_VOLUME_CONTROL : audio_desc.h, audio_hid_desc.h
  • audio_get_interface() : audio_class.c, audio_hid_class.c
  • audio_hid_class_handler : audio_hid_class.c, audio_hid_class.h
  • audio_hid_class_send_report() : audio_hid_class.c, audio_hid_class.h
  • audio_hid_desc_handler : audio_hid_desc.c, audio_hid_desc.h
  • audio_hid_struct : audio_hid_class.c
  • AUDIO_INPUT_TERMINAL_MICROPHONE : audio_desc.h, audio_hid_desc.h
  • AUDIO_INPUT_TERMINAL_SIZE : audio_desc.h, audio_hid_desc.h
  • AUDIO_INPUT_TERMINAL_UNDEFINED : audio_desc.h, audio_hid_desc.h
  • AUDIO_INTERFACE_LEN : audio_desc.h, audio_hid_desc.h
  • AUDIO_INTERFACE_NUM : audio_desc.h, audio_hid_desc.h
  • AUDIO_MIC_BITW : audio_desc.h, audio_hid_desc.h
  • AUDIO_MIC_CHANEL_NUM : audio/audio_conf.h, audio_hid/audio_conf.h
  • AUDIO_MIC_CHR : audio_desc.h, audio_hid_desc.h
  • AUDIO_MIC_DEFAULT_BITW : audio/audio_conf.h, audio_hid/audio_conf.h
  • AUDIO_MIC_FEATURE_UNIT_ID : audio_desc.h, audio_hid_desc.h
  • AUDIO_MIC_FREQ_SIZE : audio_desc.h, audio_hid_desc.h
  • AUDIO_MIC_IN_MAXPACKET_SIZE : audio_class.h, audio_hid_class.h
  • AUDIO_MIC_INPUT_TERMINAL_ID : audio_desc.h, audio_hid_desc.h
  • AUDIO_MIC_INTERFACE : audio_desc.h, audio_hid_desc.h
  • AUDIO_MIC_INTERFACE_NUMBER : audio_desc.h, audio_hid_desc.h
  • AUDIO_MIC_OUTPUT_TERMINAL_ID : audio_desc.h, audio_hid_desc.h
  • AUDIO_MUTE_CONTROL : audio_class.h, audio_hid_class.h
  • AUDIO_OUTPUT_TERMINAL_SIZE : audio_desc.h, audio_hid_desc.h
  • AUDIO_OUTPUT_TERMINAL_SPEAKER : audio_desc.h, audio_hid_desc.h
  • AUDIO_OUTPUT_TERMINAL_UNDEFINED : audio_desc.h, audio_hid_desc.h
  • AUDIO_PROTOCOL_UNDEFINED : audio_desc.h, audio_hid_desc.h
  • AUDIO_REMAIN_SIZE : audio_class.h, audio_hid_class.h
  • AUDIO_REQ_CONTROL_ENDPOINT : audio_class.h, audio_hid_class.h
  • AUDIO_REQ_CONTROL_INTERFACE : audio_class.h, audio_hid_class.h
  • AUDIO_REQ_CONTROL_MASK : audio_class.h, audio_hid_class.h
  • AUDIO_REQ_GET_CUR : audio_desc.h, audio_hid_desc.h
  • audio_req_get_cur() : audio_class.c, audio_hid_class.c
  • AUDIO_REQ_GET_MAX : audio_desc.h, audio_hid_desc.h
  • audio_req_get_max() : audio_class.c, audio_hid_class.c
  • AUDIO_REQ_GET_MEM : audio_desc.h, audio_hid_desc.h
  • AUDIO_REQ_GET_MIN : audio_desc.h, audio_hid_desc.h
  • audio_req_get_min() : audio_class.c, audio_hid_class.c
  • AUDIO_REQ_GET_RES : audio_desc.h, audio_hid_desc.h
  • audio_req_get_res() : audio_class.c, audio_hid_class.c
  • AUDIO_REQ_GET_STAT : audio_desc.h, audio_hid_desc.h
  • AUDIO_REQ_SET_CUR : audio_desc.h, audio_hid_desc.h
  • audio_req_set_cur() : audio_class.c, audio_hid_class.c
  • AUDIO_REQ_SET_MAX : audio_desc.h, audio_hid_desc.h
  • AUDIO_REQ_SET_MEM : audio_desc.h, audio_hid_desc.h
  • AUDIO_REQ_SET_MIN : audio_desc.h, audio_hid_desc.h
  • AUDIO_REQ_SET_RES : audio_desc.h, audio_hid_desc.h
  • AUDIO_REQUEST_CODE_UNDEFINED : audio_desc.h, audio_hid_desc.h
  • AUDIO_SAMPLING_FREQ_CONTROL : audio_class.h, audio_hid_class.h
  • audio_set_interface() : audio_class.c, audio_hid_class.c
  • AUDIO_SPK_BITW : audio_desc.h, audio_hid_desc.h
  • AUDIO_SPK_CHANEL_NUM : audio/audio_conf.h, audio_hid/audio_conf.h
  • AUDIO_SPK_CHR : audio_desc.h, audio_hid_desc.h
  • AUDIO_SPK_DEFAULT_BITW : audio/audio_conf.h, audio_hid/audio_conf.h
  • AUDIO_SPK_FEATURE_UNIT_ID : audio_desc.h, audio_hid_desc.h
  • AUDIO_SPK_FREQ_SIZE : audio_desc.h, audio_hid_desc.h
  • AUDIO_SPK_INPUT_TERMINAL_ID : audio_desc.h, audio_hid_desc.h
  • AUDIO_SPK_INTERFACE : audio_desc.h, audio_hid_desc.h
  • AUDIO_SPK_INTERFACE_NUMBER : audio_desc.h, audio_hid_desc.h
  • AUDIO_SPK_OUT_MAXPACKET_SIZE : audio_class.h, audio_hid_class.h
  • AUDIO_SPK_OUTPUT_TERMINAL_ID : audio_desc.h, audio_hid_desc.h
  • audio_struct : audio_class.c
  • AUDIO_SUBCLASS_AUDIOCONTROL : audio_desc.h, audio_hid_desc.h
  • AUDIO_SUBCLASS_AUDIOSTREAMING : audio_desc.h, audio_hid_desc.h
  • AUDIO_SUBCLASS_MIDISTREMING : audio_desc.h, audio_hid_desc.h
  • AUDIO_SUBCLASS_UNDEFINED : audio_desc.h, audio_hid_desc.h
  • AUDIO_SUPPORT_FEEDBACK : audio/audio_conf.h, audio_hid/audio_conf.h
  • AUDIO_SUPPORT_FREQ : audio/audio_conf.h, audio_hid/audio_conf.h
  • AUDIO_SUPPORT_FREQ_16K : audio/audio_conf.h, audio_hid/audio_conf.h
  • AUDIO_SUPPORT_FREQ_48K : audio/audio_conf.h, audio_hid/audio_conf.h
  • AUDIO_SUPPORT_MAX_FREQ : audio/audio_conf.h, audio_hid/audio_conf.h
  • AUDIO_SUPPORT_MIC : audio/audio_conf.h, audio_hid/audio_conf.h
  • AUDIO_SUPPORT_SPK : audio/audio_conf.h, audio_hid/audio_conf.h
  • AUDIO_TERMINAL_TYPE_STREAMING : audio_desc.h, audio_hid_desc.h
  • AUDIO_TERMINAL_TYPE_UNDEFINED : audio_desc.h, audio_hid_desc.h
  • AUDIO_TERMINAL_TYPE_VENDOR : audio_desc.h, audio_hid_desc.h
  • AUDIO_VOLUME_CONTROL : audio_class.h, audio_hid_class.h
  • AUHID_BCD_NUM : audio_hid_desc.h
  • AUHID_HID_BCD_NUM : audio_hid_desc.h
  • AUHID_HID_BINTERVAL_TIME : audio_hid_desc.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- b -

  • back_err() : app_led3_toggle/inc/usart.h, app_led3_toggle/src/usart.c, app_led4_toggle/inc/usart.h, app_led4_toggle/src/usart.c, bootloader/inc/iap.h, bootloader/src/iap.c
  • back_ok() : app_led3_toggle/inc/usart.h, app_led3_toggle/src/usart.c, app_led4_toggle/inc/usart.h, app_led4_toggle/src/usart.c, bootloader/inc/iap.h, bootloader/src/iap.c
  • BLK2 : at32f413_usb.h
  • BLK32 : at32f413_usb.h
  • BLOCK_SIZE : project/at_start_f413/examples/sdio/emmc_card/src/main.c, project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c, fir_filter.c
  • BLOCKS_NUMBER : project/at_start_f413/examples/sdio/emmc_card/src/main.c, project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c
  • bot_cbw_decode() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_allow_medium_removal() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_capacity() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_check_address() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_clear_feature() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_cmd_process() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_datain_handler() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_dataout_handler() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_format_capacity() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_init() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_inquiry() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_mode_sense10() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_mode_sense6() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_read10() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_request_sense() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_reset() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_send_csw() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_send_data() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_sense_code() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_stall() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_start_stop() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_test_unit() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_verify() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_write10() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • BPR : at32f413_bpr.h
  • bpr_addr_tab : project/at_start_f413/examples/bpr/bpr_data/src/main.c, project/at_start_f413/examples/bpr/tamper/src/main.c
  • BPR_BASE : at32f413.h
  • BPR_DATA1 : at32f413_bpr.h
  • BPR_DATA10 : at32f413_bpr.h
  • BPR_DATA11 : at32f413_bpr.h
  • BPR_DATA12 : at32f413_bpr.h
  • BPR_DATA13 : at32f413_bpr.h
  • BPR_DATA14 : at32f413_bpr.h
  • BPR_DATA15 : at32f413_bpr.h
  • BPR_DATA16 : at32f413_bpr.h
  • BPR_DATA17 : at32f413_bpr.h
  • BPR_DATA18 : at32f413_bpr.h
  • BPR_DATA19 : at32f413_bpr.h
  • BPR_DATA2 : at32f413_bpr.h
  • BPR_DATA20 : at32f413_bpr.h
  • BPR_DATA21 : at32f413_bpr.h
  • BPR_DATA22 : at32f413_bpr.h
  • BPR_DATA23 : at32f413_bpr.h
  • BPR_DATA24 : at32f413_bpr.h
  • BPR_DATA25 : at32f413_bpr.h
  • BPR_DATA26 : at32f413_bpr.h
  • BPR_DATA27 : at32f413_bpr.h
  • BPR_DATA28 : at32f413_bpr.h
  • BPR_DATA29 : at32f413_bpr.h
  • BPR_DATA3 : at32f413_bpr.h
  • BPR_DATA30 : at32f413_bpr.h
  • BPR_DATA31 : at32f413_bpr.h
  • BPR_DATA32 : at32f413_bpr.h
  • BPR_DATA33 : at32f413_bpr.h
  • BPR_DATA34 : at32f413_bpr.h
  • BPR_DATA35 : at32f413_bpr.h
  • BPR_DATA36 : at32f413_bpr.h
  • BPR_DATA37 : at32f413_bpr.h
  • BPR_DATA38 : at32f413_bpr.h
  • BPR_DATA39 : at32f413_bpr.h
  • BPR_DATA4 : at32f413_bpr.h
  • BPR_DATA40 : at32f413_bpr.h
  • BPR_DATA41 : at32f413_bpr.h
  • BPR_DATA42 : at32f413_bpr.h
  • BPR_DATA5 : at32f413_bpr.h
  • BPR_DATA6 : at32f413_bpr.h
  • BPR_DATA7 : at32f413_bpr.h
  • BPR_DATA8 : at32f413_bpr.h
  • BPR_DATA9 : at32f413_bpr.h
  • bpr_data_read() : at32f413_bpr.h, at32f413_bpr.c
  • bpr_data_type : at32f413_bpr.h
  • bpr_data_write() : at32f413_bpr.h, at32f413_bpr.c
  • BPR_DR_NUMBER : project/at_start_f413/examples/bpr/bpr_data/src/main.c, project/at_start_f413/examples/bpr/tamper/src/main.c
  • bpr_flag_clear() : at32f413_bpr.h, at32f413_bpr.c
  • bpr_flag_get() : at32f413_bpr.h, at32f413_bpr.c
  • bpr_interrupt_enable() : at32f413_bpr.h, at32f413_bpr.c
  • bpr_interrupt_flag_get() : at32f413_bpr.h, at32f413_bpr.c
  • BPR_MODULE_ENABLED : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • bpr_reg_check() : project/at_start_f413/examples/bpr/bpr_data/src/main.c, project/at_start_f413/examples/bpr/tamper/src/main.c
  • bpr_reg_judge() : project/at_start_f413/examples/bpr/tamper/src/at32f413_int.c, project/at_start_f413/examples/bpr/tamper/src/main.c
  • bpr_reg_write() : project/at_start_f413/examples/bpr/bpr_data/src/main.c, project/at_start_f413/examples/bpr/tamper/src/main.c
  • bpr_reset() : at32f413_bpr.h, at32f413_bpr.c
  • bpr_rtc_clock_calibration_value_set() : at32f413_bpr.h, at32f413_bpr.c
  • BPR_RTC_OUTPUT_ALARM : at32f413_bpr.h
  • BPR_RTC_OUTPUT_CLOCK_CAL_AFTER : at32f413_bpr.h
  • BPR_RTC_OUTPUT_CLOCK_CAL_BEFORE : at32f413_bpr.h
  • BPR_RTC_OUTPUT_NONE : at32f413_bpr.h
  • BPR_RTC_OUTPUT_SECOND : at32f413_bpr.h
  • bpr_rtc_output_select() : at32f413_bpr.h, at32f413_bpr.c
  • bpr_rtc_output_type : at32f413_bpr.h
  • BPR_TAMPER_EVENT_FLAG : at32f413_bpr.h
  • BPR_TAMPER_INTERRUPT_FLAG : at32f413_bpr.h
  • BPR_TAMPER_PIN_ACTIVE_HIGH : at32f413_bpr.h
  • bpr_tamper_pin_active_level_set() : at32f413_bpr.h, at32f413_bpr.c
  • bpr_tamper_pin_active_level_type : at32f413_bpr.h
  • BPR_TAMPER_PIN_ACTIVE_LOW : at32f413_bpr.h
  • bpr_tamper_pin_enable() : at32f413_bpr.h, at32f413_bpr.c
  • BUF_SIZE : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/communication_int/src/main.c, project/at_start_f413/examples/i2c/communication_poll/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c, project/at_start_f413/examples/spi/w25q_flash/src/main.c
  • buffer : project/at_start_f413/examples/cortex_m4/fpu/src/main.c
  • buffer_ch1 : project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c
  • buffer_ch2 : project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c
  • buffer_compare() : project/at_start_f413/examples/dma/flash_to_sram/src/main.c, project/at_start_f413/examples/flash/flash_write_read/src/main.c, project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/communication_int/src/main.c, project/at_start_f413/examples/i2c/communication_poll/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c, project/at_start_f413/examples/i2s/halfduplex_dma/src/main.c, project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c, project/at_start_f413/examples/sdio/emmc_card/src/main.c, project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c, project/at_start_f413/examples/sdio/sdio_fatfs/src/main.c, project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/fullduplex_polling/src/main.c, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c, project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c, project/at_start_f413/examples/spi/w25q_flash/src/main.c, project/at_start_f413/examples/usart/half_duplex/src/main.c, project/at_start_f413/examples/usart/interrupt/src/main.c, project/at_start_f413/examples/usart/polling/src/main.c, project/at_start_f413/examples/usart/synchronous/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c
  • buffer_compare_24bits() : project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c
  • buffer_read : project/at_start_f413/examples/flash/flash_write_read/src/main.c
  • BUFFER_SIZE : project/at_start_f413/examples/crc/calculation/src/main.c, project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c, project/at_start_f413/examples/dma/flash_to_sram/src/main.c, project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/fullduplex_polling/src/main.c, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c, project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c, project/at_start_f413/examples/usart/hw_flow_control/src/main.c, project/at_start_f413/examples/usart/receiver_mute/src/main.c
  • buffer_write : project/at_start_f413/examples/flash/flash_write_read/src/main.c
  • BusFault_Handler() : project/at_start_f413/examples/acc/calibration/inc/at32f413_int.h, project/at_start_f413/examples/acc/calibration/src/at32f413_int.c, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_int.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/at32f413_int.c, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_int.h, project/at_start_f413/examples/adc/current_vref_value_check/src/at32f413_int.c, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_int.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/src/at32f413_int.c, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_int.h, project/at_start_f413/examples/adc/internal_temperature_sensor/src/at32f413_int.c, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_int.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/at32f413_int.c, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_int.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/at32f413_int.c, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_int.h, project/at_start_f413/examples/adc/voltage_monitoring/src/at32f413_int.c, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_int.h, project/at_start_f413/examples/bpr/bpr_data/src/at32f413_int.c, project/at_start_f413/examples/bpr/tamper/inc/at32f413_int.h, project/at_start_f413/examples/bpr/tamper/src/at32f413_int.c, project/at_start_f413/examples/can/communication_mode/inc/at32f413_int.h, project/at_start_f413/examples/can/communication_mode/src/at32f413_int.c, project/at_start_f413/examples/can/filter/inc/at32f413_int.h, project/at_start_f413/examples/can/filter/src/at32f413_int.c, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_int.h, project/at_start_f413/examples/can/loopback_mode/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/bit_band/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/fpu/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_int.c, project/at_start_f413/examples/crc/calculation/inc/at32f413_int.h, project/at_start_f413/examples/crc/calculation/src/at32f413_int.c, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_int.h, project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_int.c, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_int.h, project/at_start_f413/examples/crm/sysclk_switch/src/at32f413_int.c, project/at_start_f413/examples/debug/tmr1/inc/at32f413_int.h, project/at_start_f413/examples/debug/tmr1/src/at32f413_int.c, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_int.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/src/at32f413_int.c, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_int.h, project/at_start_f413/examples/dma/flash_to_sram/src/at32f413_int.c, project/at_start_f413/examples/exint/exint_config/inc/at32f413_int.h, project/at_start_f413/examples/exint/exint_config/src/at32f413_int.c, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_int.h, project/at_start_f413/examples/exint/exint_software_trigger/src/at32f413_int.c, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_int.h, project/at_start_f413/examples/flash/flash_write_read/src/at32f413_int.c, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_int.h, project/at_start_f413/examples/flash/operate_spim/src/at32f413_int.c, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_int.h, project/at_start_f413/examples/flash/run_in_spim/src/at32f413_int.c, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_int.h, project/at_start_f413/examples/gpio/io_toggle/src/at32f413_int.c, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_int.h, project/at_start_f413/examples/gpio/led_toggle/src/at32f413_int.c, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_int.h, project/at_start_f413/examples/gpio/swjtag_remap/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_poll/src/at32f413_int.c, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_int.h, project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_int.h, project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_int.h, project/at_start_f413/examples/i2s/halfduplex_dma/src/at32f413_int.c, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/src/at32f413_int.c, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_int.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/at32f413_int.c, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_int.h, project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_int.c, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_int.h, project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_int.c, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_int.c, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_int.h, project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_int.h, project/at_start_f413/examples/pwc/standby_rtc/src/at32f413_int.c, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_int.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/src/at32f413_int.c, project/at_start_f413/examples/rtc/calendar/inc/at32f413_int.h, project/at_start_f413/examples/rtc/calendar/src/at32f413_int.c, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_int.h, project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_int.h, project/at_start_f413/examples/sdio/emmc_card/src/at32f413_int.c, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_int.h, project/at_start_f413/examples/sdio/sd_mmc_card/src/at32f413_int.c, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_int.h, project/at_start_f413/examples/sdio/sdio_fatfs/src/at32f413_int.c, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/crc_transfer_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_int.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/at32f413_int.c, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/fullduplex_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_interrupt/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/at32f413_int.c, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/only_receive_mode_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_int.h, project/at_start_f413/examples/spi/w25q_flash/src/at32f413_int.c, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_int.h, project/at_start_f413/examples/tmr/6_steps/src/at32f413_int.c, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_int.h, project/at_start_f413/examples/tmr/7_pwm_output/src/at32f413_int.c, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/cascade_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_int.h, project/at_start_f413/examples/tmr/complementary_signals/src/at32f413_int.c, project/at_start_f413/examples/tmr/dma/inc/at32f413_int.h, project/at_start_f413/examples/tmr/dma/src/at32f413_int.c, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_int.h, project/at_start_f413/examples/tmr/dma_burst/src/at32f413_int.c, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/tmr/encoder_tmr2/src/at32f413_int.c, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_int.h, project/at_start_f413/examples/tmr/external_clock/src/at32f413_int.c, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/src/at32f413_int.c, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_int.h, project/at_start_f413/examples/tmr/hang_mode/src/at32f413_int.c, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_int.h, project/at_start_f413/examples/tmr/input_capture/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_high/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_low/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_int.h, project/at_start_f413/examples/tmr/one_cycle/src/at32f413_int.c, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/parallel_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_input_dma/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_int.h, project/at_start_f413/examples/tmr/timer_base/src/at32f413_int.c, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/tmr1_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_int.h, project/at_start_f413/examples/tmr/tmr2_32bit/src/at32f413_int.c, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_int.h, project/at_start_f413/examples/usart/half_duplex/src/at32f413_int.c, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_int.h, project/at_start_f413/examples/usart/hw_flow_control/src/at32f413_int.c, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_int.h, project/at_start_f413/examples/usart/idle_detection/src/at32f413_int.c, project/at_start_f413/examples/usart/interrupt/inc/at32f413_int.h, project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/irda/inc/at32f413_int.h, project/at_start_f413/examples/usart/irda/src/at32f413_int.c, project/at_start_f413/examples/usart/polling/inc/at32f413_int.h, project/at_start_f413/examples/usart/polling/src/at32f413_int.c, project/at_start_f413/examples/usart/printf/inc/at32f413_int.h, project/at_start_f413/examples/usart/printf/src/at32f413_int.c, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_int.h, project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c, project/at_start_f413/examples/usart/rs485/inc/at32f413_int.h, project/at_start_f413/examples/usart/rs485/src/at32f413_int.c, project/at_start_f413/examples/usart/smartcard/inc/at32f413_int.h, project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c, project/at_start_f413/examples/usart/synchronous/inc/at32f413_int.h, project/at_start_f413/examples/usart/synchronous/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_int.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/src/at32f413_int.c, project/at_start_f413/examples/usb_device/audio/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/audio/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_audio_hid/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/src/at32f413_int.c, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/custom_hid/src/at32f413_int.c, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/keyboard/src/at32f413_int.c, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/mouse/src/at32f413_int.c, project/at_start_f413/examples/usb_device/msc/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/msc/src/at32f413_int.c, project/at_start_f413/examples/usb_device/printer/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/printer/src/at32f413_int.c, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/vcp_loopback/src/at32f413_int.c, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/src/at32f413_int.c, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/winusb/src/at32f413_int.c, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_int.h, project/at_start_f413/examples/wdt/wdt_reset/src/at32f413_int.c, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_int.h, project/at_start_f413/examples/wdt/wdt_standby/src/at32f413_int.c, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_int.h, project/at_start_f413/examples/wwdt/wwdt_reset/src/at32f413_int.c, project/at_start_f413/templates/src/at32f413_int.c, project/at_start_f413/templates/inc/at32f413_int.h, utilities/at32f413_freertos_demo/inc/at32f413_int.h, utilities/at32f413_freertos_demo/src/at32f413_int.c, utilities/at32f413_gen_random_number_demo/inc/at32f413_int.h, utilities/at32f413_gen_random_number_demo/src/at32f413_int.c, utilities/at32f413_slib_demo/project_l0/inc/at32f413_int.h, utilities/at32f413_slib_demo/project_l0/src/at32f413_int.c, utilities/at32f413_slib_demo/project_l1/inc/at32f413_int.h, utilities/at32f413_slib_demo/project_l1/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/src/at32f413_int.c
  • BusFault_IRQn : at32f413.h
  • button_exint_init() : project/at_start_f413/examples/usb_device/keyboard/src/main.c, project/at_start_f413/examples/usb_device/mouse/src/main.c, project/at_start_f413/templates/src/main.c
  • button_isr() : project/at_start_f413/templates/src/main.c
  • BUTTON_RELEASE : mouse_class.h
  • button_type : at32f413_board.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- c -

  • calendar : rtc.h, rtc.c
  • CAN1 : at32f413_can.h
  • CAN1_BASE : at32f413.h
  • CAN1_GMUX_0010 : at32f413_gpio.h
  • CAN1_RX1_IRQn : at32f413.h
  • CAN1_SE_IRQHandler() : project/at_start_f413/examples/can/communication_mode/src/main.c, project/at_start_f413/examples/can/filter/src/main.c, project/at_start_f413/examples/can/loopback_mode/src/main.c
  • CAN1_SE_IRQn : at32f413.h
  • CAN2_BASE : at32f413.h
  • CAN2_GMUX_0001 : at32f413_gpio.h
  • CAN2_RX0_IRQn : at32f413.h
  • CAN2_RX1_IRQn : at32f413.h
  • CAN2_SE_IRQn : at32f413.h
  • CAN2_TX_IRQn : at32f413.h
  • can_base_init() : at32f413_can.h, at32f413_can.c
  • can_baudrate_default_para_init() : at32f413_can.h, at32f413_can.c
  • can_baudrate_set() : at32f413_can.h, at32f413_can.c
  • CAN_BOF_FLAG : at32f413_can.h
  • CAN_BOIEN_INT : at32f413_can.h
  • CAN_BTS1_10TQ : at32f413_can.h
  • CAN_BTS1_11TQ : at32f413_can.h
  • CAN_BTS1_12TQ : at32f413_can.h
  • CAN_BTS1_13TQ : at32f413_can.h
  • CAN_BTS1_14TQ : at32f413_can.h
  • CAN_BTS1_15TQ : at32f413_can.h
  • CAN_BTS1_16TQ : at32f413_can.h
  • CAN_BTS1_1TQ : at32f413_can.h
  • CAN_BTS1_2TQ : at32f413_can.h
  • CAN_BTS1_3TQ : at32f413_can.h
  • CAN_BTS1_4TQ : at32f413_can.h
  • CAN_BTS1_5TQ : at32f413_can.h
  • CAN_BTS1_6TQ : at32f413_can.h
  • CAN_BTS1_7TQ : at32f413_can.h
  • CAN_BTS1_8TQ : at32f413_can.h
  • CAN_BTS1_9TQ : at32f413_can.h
  • can_bts1_type : at32f413_can.h
  • CAN_BTS2_1TQ : at32f413_can.h
  • CAN_BTS2_2TQ : at32f413_can.h
  • CAN_BTS2_3TQ : at32f413_can.h
  • CAN_BTS2_4TQ : at32f413_can.h
  • CAN_BTS2_5TQ : at32f413_can.h
  • CAN_BTS2_6TQ : at32f413_can.h
  • CAN_BTS2_7TQ : at32f413_can.h
  • CAN_BTS2_8TQ : at32f413_can.h
  • can_bts2_type : at32f413_can.h
  • can_configuration() : project/at_start_f413/examples/can/communication_mode/src/main.c, project/at_start_f413/examples/can/filter/src/main.c, project/at_start_f413/examples/can/loopback_mode/src/main.c
  • can_debug_transmission_prohibit() : at32f413_can.h, at32f413_can.c
  • can_default_para_init() : at32f413_can.h, at32f413_can.c
  • CAN_DISCARDING_FIRST_RECEIVED : at32f413_can.h
  • CAN_DISCARDING_LAST_RECEIVED : at32f413_can.h
  • can_doze_mode_enter() : at32f413_can.h, at32f413_can.c
  • can_doze_mode_exit() : at32f413_can.h, at32f413_can.c
  • CAN_EAF_FLAG : at32f413_can.h
  • CAN_EAIEN_INT : at32f413_can.h
  • CAN_EDZC_FLAG : at32f413_can.h
  • CAN_EDZIEN_INT : at32f413_can.h
  • CAN_ENTER_DOZE_FAILED : at32f413_can.h
  • can_enter_doze_status_type : at32f413_can.h
  • CAN_ENTER_DOZE_SUCCESSFUL : at32f413_can.h
  • CAN_EOIEN_INT : at32f413_can.h
  • CAN_EOIF_FLAG : at32f413_can.h
  • CAN_EPF_FLAG : at32f413_can.h
  • CAN_EPIEN_INT : at32f413_can.h
  • can_error_record_type : at32f413_can.h
  • can_error_type_record_get() : at32f413_can.h, at32f413_can.c
  • CAN_ERRORRECORD_ACKERR : at32f413_can.h
  • CAN_ERRORRECORD_BITDOMINANTERR : at32f413_can.h
  • CAN_ERRORRECORD_BITRECESSIVEERR : at32f413_can.h
  • CAN_ERRORRECORD_CRCERR : at32f413_can.h
  • CAN_ERRORRECORD_FORMERR : at32f413_can.h
  • CAN_ERRORRECORD_NOERR : at32f413_can.h
  • CAN_ERRORRECORD_SOFTWARESETERR : at32f413_can.h
  • CAN_ERRORRECORD_STUFFERR : at32f413_can.h
  • CAN_ETR_FLAG : at32f413_can.h
  • CAN_ETRIEN_INT : at32f413_can.h
  • CAN_FILTER_16BIT : at32f413_can.h
  • CAN_FILTER_32BIT : at32f413_can.h
  • can_filter_bit_width_type : at32f413_can.h
  • can_filter_default_para_init() : at32f413_can.h, at32f413_can.c
  • CAN_FILTER_FIFO0 : at32f413_can.h
  • CAN_FILTER_FIFO1 : at32f413_can.h
  • can_filter_fifo_type : at32f413_can.h
  • can_filter_init() : at32f413_can.h, at32f413_can.c
  • CAN_FILTER_MODE_ID_LIST : at32f413_can.h
  • CAN_FILTER_MODE_ID_MASK : at32f413_can.h
  • can_filter_mode_type : at32f413_can.h
  • can_flag_clear() : at32f413_can.h, at32f413_can.c
  • can_flag_get() : at32f413_can.h, at32f413_can.c
  • can_gpio_config() : project/at_start_f413/examples/can/communication_mode/src/main.c, project/at_start_f413/examples/can/filter/src/main.c, project/at_start_f413/examples/can/loopback_mode/src/main.c
  • CAN_ID_EXTENDED : at32f413_can.h
  • CAN_ID_STANDARD : at32f413_can.h
  • can_identifier_type : at32f413_can.h
  • can_interrupt_enable() : at32f413_can.h, at32f413_can.c
  • can_interrupt_flag_get() : at32f413_can.h, at32f413_can.c
  • can_message_receive() : at32f413_can.h, at32f413_can.c
  • can_message_transmit() : at32f413_can.h, at32f413_can.c
  • CAN_MODE_COMMUNICATE : at32f413_can.h
  • CAN_MODE_LISTENONLY : at32f413_can.h
  • CAN_MODE_LISTENONLY_LOOPBACK : at32f413_can.h
  • CAN_MODE_LOOPBACK : at32f413_can.h
  • can_mode_type : at32f413_can.h
  • CAN_MODULE_ENABLED : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • can_msg_discarding_rule_type : at32f413_can.h
  • can_msg_sending_rule_type : at32f413_can.h
  • CAN_MSTS_EDZIF_VAL : at32f413_can.h
  • CAN_MSTS_EOIF_VAL : at32f413_can.h
  • CAN_MSTS_QDZIF_VAL : at32f413_can.h
  • CAN_MUX_10 : at32f413_gpio.h
  • can_operating_mode_set() : at32f413_can.h, at32f413_can.c
  • can_operating_mode_type : at32f413_can.h
  • CAN_OPERATINGMODE_COMMUNICATE : at32f413_can.h
  • CAN_OPERATINGMODE_DOZE : at32f413_can.h
  • CAN_OPERATINGMODE_FREEZE : at32f413_can.h
  • CAN_QDZIEN_INT : at32f413_can.h
  • CAN_QDZIF_FLAG : at32f413_can.h
  • CAN_QUIT_DOZE_FAILED : at32f413_can.h
  • can_quit_doze_status_type : at32f413_can.h
  • CAN_QUIT_DOZE_SUCCESSFUL : at32f413_can.h
  • can_receive_error_counter_get() : at32f413_can.h, at32f413_can.c
  • can_receive_fifo_release() : at32f413_can.h, at32f413_can.c
  • can_receive_message_pending_get() : at32f413_can.h, at32f413_can.c
  • can_reset() : at32f413_can.h, at32f413_can.c
  • CAN_RF0_RF0FF_VAL : at32f413_can.h
  • CAN_RF0_RF0OF_VAL : at32f413_can.h
  • CAN_RF0_RF0R_VAL : at32f413_can.h
  • CAN_RF0FF_FLAG : at32f413_can.h
  • CAN_RF0FIEN_INT : at32f413_can.h
  • CAN_RF0MIEN_INT : at32f413_can.h
  • CAN_RF0MN_FLAG : at32f413_can.h
  • CAN_RF0OF_FLAG : at32f413_can.h
  • CAN_RF0OIEN_INT : at32f413_can.h
  • CAN_RF1_RF1FF_VAL : at32f413_can.h
  • CAN_RF1_RF1OF_VAL : at32f413_can.h
  • CAN_RF1_RF1R_VAL : at32f413_can.h
  • CAN_RF1FF_FLAG : at32f413_can.h
  • CAN_RF1FIEN_INT : at32f413_can.h
  • CAN_RF1MIEN_INT : at32f413_can.h
  • CAN_RF1MN_FLAG : at32f413_can.h
  • CAN_RF1OF_FLAG : at32f413_can.h
  • CAN_RF1OIEN_INT : at32f413_can.h
  • CAN_RSAW_1TQ : at32f413_can.h
  • CAN_RSAW_2TQ : at32f413_can.h
  • CAN_RSAW_3TQ : at32f413_can.h
  • CAN_RSAW_4TQ : at32f413_can.h
  • can_rsaw_type : at32f413_can.h
  • CAN_RX_FIFO0 : at32f413_can.h
  • CAN_RX_FIFO1 : at32f413_can.h
  • can_rx_fifo_num_type : at32f413_can.h
  • CAN_SENDING_BY_ID : at32f413_can.h
  • CAN_SENDING_BY_REQUEST : at32f413_can.h
  • CAN_TCIEN_INT : at32f413_can.h
  • CAN_TFT_DATA : at32f413_can.h
  • CAN_TFT_REMOTE : at32f413_can.h
  • CAN_TM0TCF_FLAG : at32f413_can.h
  • CAN_TM1TCF_FLAG : at32f413_can.h
  • CAN_TM2TCF_FLAG : at32f413_can.h
  • CAN_TMEF_FLAG : at32f413_can.h
  • can_trans_frame_type : at32f413_can.h
  • can_transmit_cancel() : at32f413_can.h, at32f413_can.c
  • can_transmit_data() : project/at_start_f413/examples/can/communication_mode/src/main.c, project/at_start_f413/examples/can/filter/src/main.c, project/at_start_f413/examples/can/loopback_mode/src/main.c
  • can_transmit_error_counter_get() : at32f413_can.h, at32f413_can.c
  • can_transmit_status_get() : at32f413_can.h, at32f413_can.c
  • can_transmit_status_type : at32f413_can.h
  • CAN_TSTS_TM0CT_VAL : at32f413_can.h
  • CAN_TSTS_TM0TCF_VAL : at32f413_can.h
  • CAN_TSTS_TM1CT_VAL : at32f413_can.h
  • CAN_TSTS_TM1TCF_VAL : at32f413_can.h
  • CAN_TSTS_TM2CT_VAL : at32f413_can.h
  • CAN_TSTS_TM2TCF_VAL : at32f413_can.h
  • can_ttc_mode_enable() : at32f413_can.h, at32f413_can.c
  • CAN_TX_MAILBOX0 : at32f413_can.h
  • CAN_TX_MAILBOX1 : at32f413_can.h
  • CAN_TX_MAILBOX2 : at32f413_can.h
  • can_tx_mailbox_num_type : at32f413_can.h
  • CAN_TX_STATUS_FAILED : at32f413_can.h
  • CAN_TX_STATUS_NO_EMPTY : at32f413_can.h
  • CAN_TX_STATUS_PENDING : at32f413_can.h
  • CAN_TX_STATUS_SUCCESSFUL : at32f413_can.h
  • capture : project/at_start_f413/examples/tmr/input_capture/src/main.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c
  • capturenumber : project/at_start_f413/examples/tmr/input_capture/src/main.c
  • card_inserted : project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c, project/at_start_f413/examples/usart/smartcard/src/main.c
  • card_protocol : project/at_start_f413/examples/usart/smartcard/src/main.c
  • card_type : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • CBW_BMCBWFLAGS_DIR_IN : cdc_msc_class.h, msc_bot_scsi.h
  • CBW_BMCBWFLAGS_DIR_OUT : cdc_msc_class.h, msc_bot_scsi.h
  • CBW_CMD_LENGTH : cdc_msc_class.h, msc_bot_scsi.h
  • CBW_DCBWSIGNATURE : cdc_msc_class.h, msc_bot_scsi.h
  • CDC_BCD_NUM : cdc_desc.h, cdc_msc_desc.h
  • cdc_class_handler : cdc_class.c, cdc_class.h
  • cdc_class_setup_handler() : cdc_keyboard_class.c, cdc_msc_class.c
  • cdc_desc_handler : cdc_desc.c, cdc_desc.h
  • CDC_HID_BINTERVAL_TIME : cdc_desc.h, cdc_msc_desc.h
  • cdc_keyboard_class_handler : cdc_keyboard_class.c, cdc_keyboard_class.h
  • cdc_keyboard_desc_handler : cdc_keyboard_desc.c, cdc_keyboard_desc.h
  • cdc_msc_class_handler : cdc_msc_class.c, cdc_msc_class.h
  • cdc_msc_desc_handler : cdc_msc_desc.c, cdc_msc_desc.h
  • cdc_msc_struct : cdc_msc_class.c
  • cdc_struct : cdc_class.c
  • cdc_struct_init() : cdc_class.c, cdc_msc_class.c
  • ch1_val : project/at_start_f413/examples/tmr/oc_high/src/main.c, project/at_start_f413/examples/tmr/oc_low/src/main.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/main.c, project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/main.c, project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_simulate/src/main.c, project/at_start_f413/examples/tmr/pwm_output_tmr10/src/main.c, project/at_start_f413/examples/tmr/pwm_output_tmr3/src/main.c, project/at_start_f413/examples/tmr/tmr2_32bit/src/main.c
  • ch2_val : project/at_start_f413/examples/tmr/oc_high/src/main.c, project/at_start_f413/examples/tmr/oc_low/src/main.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/main.c, project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/main.c, project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_simulate/src/main.c, project/at_start_f413/examples/tmr/pwm_output_tmr3/src/main.c, project/at_start_f413/examples/tmr/tmr2_32bit/src/main.c
  • ch3_val : project/at_start_f413/examples/tmr/oc_high/src/main.c, project/at_start_f413/examples/tmr/oc_low/src/main.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/main.c, project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_simulate/src/main.c, project/at_start_f413/examples/tmr/pwm_output_tmr3/src/main.c, project/at_start_f413/examples/tmr/tmr2_32bit/src/main.c
  • ch3readvalue1 : project/at_start_f413/examples/tmr/input_capture/src/main.c
  • ch3readvalue2 : project/at_start_f413/examples/tmr/input_capture/src/main.c
  • ch4_val : project/at_start_f413/examples/tmr/oc_high/src/main.c, project/at_start_f413/examples/tmr/oc_low/src/main.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/main.c, project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_simulate/src/main.c, project/at_start_f413/examples/tmr/pwm_output_tmr3/src/main.c, project/at_start_f413/examples/tmr/tmr2_32bit/src/main.c
  • channel1_pulse : project/at_start_f413/examples/tmr/7_pwm_output/src/main.c, project/at_start_f413/examples/tmr/complementary_signals/src/main.c
  • channel2_pulse : project/at_start_f413/examples/tmr/7_pwm_output/src/main.c, project/at_start_f413/examples/tmr/complementary_signals/src/main.c
  • channel3_pulse : project/at_start_f413/examples/tmr/7_pwm_output/src/main.c, project/at_start_f413/examples/tmr/complementary_signals/src/main.c
  • channel4_pulse : project/at_start_f413/examples/tmr/7_pwm_output/src/main.c
  • check_card_programming() : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • cid_table : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • class_audio_setup_handler() : audio_hid_class.c
  • class_clear_handler() : audio_class.c, audio_hid_class.c, cdc_class.c, cdc_keyboard_class.c, cdc_msc_class.c, custom_hid_class.c, hid_iap_class.c, keyboard_class.c, mouse_class.c, msc_class.c, printer_class.c, winusb_class.c
  • class_ept0_rx_handler() : audio_class.c, audio_hid_class.c, cdc_class.c, cdc_keyboard_class.c, cdc_msc_class.c, custom_hid_class.c, hid_iap_class.c, keyboard_class.c, mouse_class.c, msc_class.c, printer_class.c, winusb_class.c
  • class_ept0_tx_handler() : audio_class.c, audio_hid_class.c, cdc_class.c, cdc_keyboard_class.c, cdc_msc_class.c, custom_hid_class.c, hid_iap_class.c, keyboard_class.c, mouse_class.c, msc_class.c, printer_class.c, winusb_class.c
  • class_event_handler() : audio_class.c, audio_hid_class.c, cdc_class.c, cdc_keyboard_class.c, cdc_msc_class.c, custom_hid_class.c, hid_iap_class.c, keyboard_class.c, mouse_class.c, msc_class.c, printer_class.c, winusb_class.c
  • class_hid_setup_handler() : audio_hid_class.c
  • class_in_handler() : audio_class.c, audio_hid_class.c, cdc_class.c, cdc_keyboard_class.c, cdc_msc_class.c, custom_hid_class.c, hid_iap_class.c, keyboard_class.c, mouse_class.c, msc_class.c, printer_class.c, winusb_class.c
  • class_init_handler() : audio_class.c, audio_hid_class.c, cdc_class.c, cdc_keyboard_class.c, cdc_msc_class.c, custom_hid_class.c, hid_iap_class.c, keyboard_class.c, mouse_class.c, msc_class.c, printer_class.c, winusb_class.c
  • class_out_handler() : audio_class.c, audio_hid_class.c, cdc_class.c, cdc_keyboard_class.c, cdc_msc_class.c, custom_hid_class.c, hid_iap_class.c, keyboard_class.c, mouse_class.c, msc_class.c, printer_class.c, winusb_class.c
  • class_setup_handler() : audio_class.c, audio_hid_class.c, cdc_class.c, cdc_keyboard_class.c, cdc_msc_class.c, custom_hid_class.c, hid_iap_class.c, keyboard_class.c, mouse_class.c, msc_class.c, printer_class.c, winusb_class.c
  • class_sof_handler() : audio_class.c, audio_hid_class.c, cdc_class.c, cdc_keyboard_class.c, cdc_msc_class.c, custom_hid_class.c, hid_iap_class.c, keyboard_class.c, mouse_class.c, msc_class.c, printer_class.c, winusb_class.c
  • clkout_config() : project/at_start_f413/examples/acc/calibration/src/main.c, project/at_start_f413/examples/crm/clock_failure_detection/src/main.c, project/at_start_f413/examples/crm/sysclk_switch/src/main.c, project/at_start_f413/examples/tmr/timer_base/src/main.c
  • clock_failure_detection_handler() : project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_int.c, project/at_start_f413/examples/crm/clock_failure_detection/src/main.c
  • cmd_addr_cnt : bootloader/src/iap.c
  • CMD_CTR_APP : bootloader/inc/iap.h
  • CMD_CTR_DONE : bootloader/inc/iap.h
  • CMD_CTR_ERR : bootloader/inc/iap.h
  • CMD_CTR_IDLE : bootloader/inc/iap.h
  • CMD_CTR_INIT : bootloader/inc/iap.h
  • cmd_ctr_step : bootloader/inc/iap.h, bootloader/src/iap.c
  • cmd_ctr_step_type : bootloader/inc/iap.h
  • CMD_DATA_ADDR : bootloader/inc/iap.h
  • CMD_DATA_BUF : bootloader/inc/iap.h
  • CMD_DATA_CHACK : bootloader/inc/iap.h
  • cmd_data_cnt : bootloader/src/iap.c
  • CMD_DATA_DONE : bootloader/inc/iap.h
  • CMD_DATA_ERR : bootloader/inc/iap.h
  • cmd_data_group_struct : bootloader/src/iap.c
  • cmd_data_group_type_struct : bootloader/inc/iap.h
  • CMD_DATA_IDLE : bootloader/inc/iap.h
  • cmd_data_step : bootloader/inc/iap.h, bootloader/src/iap.c
  • cmd_data_step_type : bootloader/inc/iap.h
  • codec_i2s_init() : audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • codec_i2s_reset() : audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • command_error() : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • command_handle() : bootloader/inc/iap.h, bootloader/src/iap.c
  • command_rsp1_error() : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • command_rsp2_error() : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • command_rsp3_error() : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • command_rsp4_error() : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • command_rsp5_error() : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • command_rsp6_error() : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • command_rsp7_error() : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • config_descriptor : audio_desc.c, audio_hid_desc.c, cdc_desc.c, cdc_keyboard_desc.c, cdc_msc_desc.c, custom_hid_desc.c, hid_iap_desc.c, keyboard_desc.c, mouse_desc.c, msc_desc.c, printer_desc.c, winusb_desc.c
  • config_flash_interrupt() : utilities/at32f413_slib_demo/project_l0/src/main.c, utilities/at32f413_slib_demo/project_l1/src/main.c
  • configASSERT : FreeRTOSConfig.h
  • configCPU_CLOCK_HZ : FreeRTOSConfig.h
  • configIDLE_SHOULD_YIELD : FreeRTOSConfig.h
  • configKERNEL_INTERRUPT_PRIORITY : FreeRTOSConfig.h
  • configLIBRARY_LOWEST_INTERRUPT_PRIORITY : FreeRTOSConfig.h
  • configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY : FreeRTOSConfig.h
  • configMAX_CO_ROUTINE_PRIORITIES : FreeRTOSConfig.h
  • configMAX_PRIORITIES : FreeRTOSConfig.h
  • configMAX_SYSCALL_INTERRUPT_PRIORITY : FreeRTOSConfig.h
  • configMAX_TASK_NAME_LEN : FreeRTOSConfig.h
  • configMINIMAL_STACK_SIZE : FreeRTOSConfig.h
  • configPRIO_BITS : FreeRTOSConfig.h
  • configSUPPORT_DYNAMIC_ALLOCATION : FreeRTOSConfig.h
  • configTICK_RATE_HZ : FreeRTOSConfig.h
  • configTOTAL_HEAP_SIZE : FreeRTOSConfig.h
  • configUSE_16_BIT_TICKS : FreeRTOSConfig.h
  • configUSE_CO_ROUTINES : FreeRTOSConfig.h
  • configUSE_IDLE_HOOK : FreeRTOSConfig.h
  • configUSE_PREEMPTION : FreeRTOSConfig.h
  • configUSE_TICK_HOOK : FreeRTOSConfig.h
  • confirm_state : at32f413.h
  • conversion_times_index : project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/main.c
  • CONVERT_ENDIAN : hid_iap_class.h
  • convert_from_bytes_to_power_of_two() : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • copy_buff() : audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • counter : project/at_start_f413/examples/debug/tmr1/src/main.c, project/at_start_f413/examples/tmr/encoder_tmr2/src/main.c, project/at_start_f413/examples/usart/smartcard/src/main.c
  • COUNTOF : project/at_start_f413/examples/usart/half_duplex/src/main.c, project/at_start_f413/examples/usart/interrupt/src/main.c, project/at_start_f413/examples/usart/polling/src/main.c, project/at_start_f413/examples/usart/synchronous/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c
  • CRC : at32f413_crc.h
  • crc1_value : project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c
  • crc2_value : project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c
  • CRC_BASE : at32f413.h
  • crc_block_calculate() : at32f413_crc.h, at32f413_crc.c
  • crc_cal() : app_led3_toggle/src/hid_iap_user.c, app_led4_toggle/src/hid_iap_user.c, bootloader/src/hid_iap_user.c
  • crc_common_data_get() : at32f413_crc.h, at32f413_crc.c
  • crc_common_data_set() : at32f413_crc.h, at32f413_crc.c
  • crc_data_get() : at32f413_crc.h, at32f413_crc.c
  • crc_data_reset() : at32f413_crc.h, at32f413_crc.c
  • crc_init_data_set() : at32f413_crc.h, at32f413_crc.c
  • CRC_MODULE_ENABLED : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • crc_one_word_calculate() : at32f413_crc.h, at32f413_crc.c
  • CRC_POLY_SIZE_16B : at32f413_crc.h
  • CRC_POLY_SIZE_32B : at32f413_crc.h
  • CRC_POLY_SIZE_7B : at32f413_crc.h
  • CRC_POLY_SIZE_8B : at32f413_crc.h
  • crc_poly_size_get() : at32f413_crc.h, at32f413_crc.c
  • crc_poly_size_set() : at32f413_crc.h, at32f413_crc.c
  • crc_poly_size_type : at32f413_crc.h
  • crc_poly_value_get() : at32f413_crc.h, at32f413_crc.c
  • crc_poly_value_set() : at32f413_crc.h, at32f413_crc.c
  • CRC_REVERSE_INPUT_BY_BYTE : at32f413_crc.h
  • CRC_REVERSE_INPUT_BY_HALFWORD : at32f413_crc.h
  • CRC_REVERSE_INPUT_BY_WORD : at32f413_crc.h
  • crc_reverse_input_data_set() : at32f413_crc.h, at32f413_crc.c
  • CRC_REVERSE_INPUT_NO_AFFECTE : at32f413_crc.h
  • crc_reverse_input_type : at32f413_crc.h
  • CRC_REVERSE_OUTPUT_DATA : at32f413_crc.h
  • crc_reverse_output_data_set() : at32f413_crc.h, at32f413_crc.c
  • CRC_REVERSE_OUTPUT_NO_AFFECTE : at32f413_crc.h
  • crc_reverse_output_type : at32f413_crc.h
  • crc_value : project/at_start_f413/examples/crc/calculation/src/main.c
  • CRM : at32f413_crm.h
  • CRM_ACC_PERIPH_CLOCK : at32f413_crm.h
  • CRM_ACC_PERIPH_RESET : at32f413_crm.h
  • CRM_ADC1_PERIPH_CLOCK : at32f413_crm.h
  • CRM_ADC1_PERIPH_RESET : at32f413_crm.h
  • CRM_ADC2_PERIPH_CLOCK : at32f413_crm.h
  • CRM_ADC2_PERIPH_RESET : at32f413_crm.h
  • crm_adc_clock_div_set() : at32f413_crm.h, at32f413_crm.c
  • CRM_ADC_DIV_12 : at32f413_crm.h
  • CRM_ADC_DIV_16 : at32f413_crm.h
  • CRM_ADC_DIV_2 : at32f413_crm.h
  • CRM_ADC_DIV_4 : at32f413_crm.h
  • CRM_ADC_DIV_6 : at32f413_crm.h
  • CRM_ADC_DIV_8 : at32f413_crm.h
  • crm_adc_div_type : at32f413_crm.h
  • CRM_AHB_DIV_1 : at32f413_crm.h
  • CRM_AHB_DIV_128 : at32f413_crm.h
  • CRM_AHB_DIV_16 : at32f413_crm.h
  • CRM_AHB_DIV_2 : at32f413_crm.h
  • CRM_AHB_DIV_256 : at32f413_crm.h
  • CRM_AHB_DIV_4 : at32f413_crm.h
  • CRM_AHB_DIV_512 : at32f413_crm.h
  • CRM_AHB_DIV_64 : at32f413_crm.h
  • CRM_AHB_DIV_8 : at32f413_crm.h
  • crm_ahb_div_set() : at32f413_crm.h, at32f413_crm.c
  • crm_ahb_div_type : at32f413_crm.h
  • CRM_ALL_RESET_FLAG : at32f413_crm.h
  • CRM_APB1_DIV_1 : at32f413_crm.h
  • CRM_APB1_DIV_16 : at32f413_crm.h
  • CRM_APB1_DIV_2 : at32f413_crm.h
  • CRM_APB1_DIV_4 : at32f413_crm.h
  • CRM_APB1_DIV_8 : at32f413_crm.h
  • crm_apb1_div_set() : at32f413_crm.h, at32f413_crm.c
  • crm_apb1_div_type : at32f413_crm.h
  • CRM_APB2_DIV_1 : at32f413_crm.h
  • CRM_APB2_DIV_16 : at32f413_crm.h
  • CRM_APB2_DIV_2 : at32f413_crm.h
  • CRM_APB2_DIV_4 : at32f413_crm.h
  • CRM_APB2_DIV_8 : at32f413_crm.h
  • crm_apb2_div_set() : at32f413_crm.h, at32f413_crm.c
  • crm_apb2_div_type : at32f413_crm.h
  • CRM_AUTO_STEP_MODE_DISABLE : at32f413_crm.h
  • CRM_AUTO_STEP_MODE_ENABLE : at32f413_crm.h
  • crm_auto_step_mode_enable() : at32f413_crm.h, at32f413_crm.c
  • crm_auto_step_mode_type : at32f413_crm.h
  • CRM_BASE : at32f413.h
  • crm_battery_powered_domain_reset() : at32f413_crm.h, at32f413_crm.c
  • CRM_BPR_PERIPH_CLOCK : at32f413_crm.h
  • CRM_BPR_PERIPH_RESET : at32f413_crm.h
  • CRM_CAN1_PERIPH_CLOCK : at32f413_crm.h
  • CRM_CAN1_PERIPH_RESET : at32f413_crm.h
  • CRM_CAN2_PERIPH_CLOCK : at32f413_crm.h
  • CRM_CAN2_PERIPH_RESET : at32f413_crm.h
  • CRM_CLKOUT_ADC : at32f413_crm.h
  • CRM_CLKOUT_DIV_1 : at32f413_crm.h
  • CRM_CLKOUT_DIV_128 : at32f413_crm.h
  • CRM_CLKOUT_DIV_16 : at32f413_crm.h
  • CRM_CLKOUT_DIV_2 : at32f413_crm.h
  • CRM_CLKOUT_DIV_256 : at32f413_crm.h
  • CRM_CLKOUT_DIV_4 : at32f413_crm.h
  • CRM_CLKOUT_DIV_512 : at32f413_crm.h
  • CRM_CLKOUT_DIV_64 : at32f413_crm.h
  • CRM_CLKOUT_DIV_8 : at32f413_crm.h
  • crm_clkout_div_set() : at32f413_crm.h, at32f413_crm.c
  • crm_clkout_div_type : at32f413_crm.h
  • CRM_CLKOUT_HEXT : at32f413_crm.h
  • CRM_CLKOUT_HICK : at32f413_crm.h
  • CRM_CLKOUT_LEXT : at32f413_crm.h
  • CRM_CLKOUT_LICK : at32f413_crm.h
  • CRM_CLKOUT_NOCLK : at32f413_crm.h
  • CRM_CLKOUT_PLL_DIV_2 : at32f413_crm.h
  • CRM_CLKOUT_PLL_DIV_4 : at32f413_crm.h
  • CRM_CLKOUT_SCLK : at32f413_crm.h
  • crm_clkout_select_type : at32f413_crm.h
  • crm_clkout_to_tmr10_enable() : at32f413_crm.h, at32f413_crm.c
  • CRM_CLKOUT_USB : at32f413_crm.h
  • crm_clock_failure_detection_enable() : at32f413_crm.h, at32f413_crm.c
  • CRM_CLOCK_FAILURE_INT : at32f413_crm.h
  • CRM_CLOCK_FAILURE_INT_FLAG : at32f413_crm.h
  • crm_clock_out_set() : at32f413_crm.h, at32f413_crm.c
  • crm_clock_source_enable() : at32f413_crm.h, at32f413_crm.c
  • CRM_CLOCK_SOURCE_HEXT : at32f413_crm.h
  • CRM_CLOCK_SOURCE_HICK : at32f413_crm.h
  • CRM_CLOCK_SOURCE_LEXT : at32f413_crm.h
  • CRM_CLOCK_SOURCE_LICK : at32f413_crm.h
  • CRM_CLOCK_SOURCE_PLL : at32f413_crm.h
  • crm_clock_source_type : at32f413_crm.h
  • crm_clocks : project/at_start_f413/examples/rtc/lick_calibration/src/main.c
  • crm_clocks_freq_get() : at32f413_crm.h, at32f413_crm.c
  • crm_clocks_freq_struct : project/at_start_f413/examples/debug/tmr1/src/main.c, project/at_start_f413/examples/tmr/6_steps/src/main.c, project/at_start_f413/examples/tmr/7_pwm_output/src/main.c, project/at_start_f413/examples/tmr/complementary_signals/src/main.c, project/at_start_f413/examples/tmr/dma/src/main.c, project/at_start_f413/examples/tmr/dma_burst/src/main.c, project/at_start_f413/examples/tmr/encoder_tmr2/src/main.c, project/at_start_f413/examples/tmr/external_clock/src/main.c, project/at_start_f413/examples/tmr/hall_xor_tmr2/src/main.c, project/at_start_f413/examples/tmr/hang_mode/src/main.c, project/at_start_f413/examples/tmr/input_capture/src/main.c, project/at_start_f413/examples/tmr/oc_high/src/main.c, project/at_start_f413/examples/tmr/timer_base/src/main.c
  • crm_configuration() : project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/main.c, project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/main.c, project/at_start_f413/examples/tmr/one_cycle/src/main.c, project/at_start_f413/examples/tmr/parallel_synchro/src/main.c, project/at_start_f413/examples/tmr/pwm_input/src/main.c, project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c, project/at_start_f413/examples/tmr/pwm_output_simulate/src/main.c, project/at_start_f413/examples/tmr/pwm_output_tmr10/src/main.c, project/at_start_f413/examples/tmr/pwm_output_tmr3/src/main.c, project/at_start_f413/examples/tmr/tmr1_synchro/src/main.c, project/at_start_f413/examples/tmr/tmr2_32bit/src/main.c
  • CRM_CRC_PERIPH_CLOCK : at32f413_crm.h
  • CRM_DMA1_PERIPH_CLOCK : at32f413_crm.h
  • CRM_DMA2_PERIPH_CLOCK : at32f413_crm.h
  • CRM_EXINT_PERIPH_RESET : at32f413_crm.h
  • crm_flag_clear() : at32f413_crm.h, at32f413_crm.c
  • crm_flag_get() : at32f413_crm.h, at32f413_crm.c
  • CRM_FLASH_PERIPH_CLOCK_SLEEP_MODE : at32f413_crm.h
  • CRM_GPIOA_PERIPH_CLOCK : at32f413_crm.h
  • CRM_GPIOA_PERIPH_RESET : at32f413_crm.h
  • CRM_GPIOB_PERIPH_CLOCK : at32f413_crm.h
  • CRM_GPIOB_PERIPH_RESET : at32f413_crm.h
  • CRM_GPIOC_PERIPH_CLOCK : at32f413_crm.h
  • CRM_GPIOC_PERIPH_RESET : at32f413_crm.h
  • CRM_GPIOD_PERIPH_CLOCK : at32f413_crm.h
  • CRM_GPIOD_PERIPH_RESET : at32f413_crm.h
  • CRM_GPIOF_PERIPH_CLOCK : at32f413_crm.h
  • CRM_GPIOF_PERIPH_RESET : at32f413_crm.h
  • crm_hext_bypass() : at32f413_crm.h, at32f413_crm.c
  • CRM_HEXT_READY_INT_FLAG : at32f413_crm.h
  • CRM_HEXT_STABLE_FLAG : at32f413_crm.h
  • CRM_HEXT_STABLE_INT : at32f413_crm.h
  • crm_hext_stable_wait() : at32f413_crm.h, at32f413_crm.c
  • CRM_HICK48_DIV6 : at32f413_crm.h
  • CRM_HICK48_NODIV : at32f413_crm.h
  • crm_hick_clock_calibration_set() : at32f413_crm.h, at32f413_crm.c
  • crm_hick_clock_trimming_set() : at32f413_crm.h, at32f413_crm.c
  • crm_hick_div_6_type : at32f413_crm.h
  • crm_hick_divider_select() : at32f413_crm.h, at32f413_crm.c
  • CRM_HICK_READY_INT_FLAG : at32f413_crm.h
  • CRM_HICK_SCLK_48MHZ : at32f413_crm.h
  • CRM_HICK_SCLK_8MHZ : at32f413_crm.h
  • crm_hick_sclk_frequency_select() : at32f413_crm.h, at32f413_crm.c
  • crm_hick_sclk_frequency_type : at32f413_crm.h
  • CRM_HICK_STABLE_FLAG : at32f413_crm.h
  • CRM_HICK_STABLE_INT : at32f413_crm.h
  • CRM_I2C1_PERIPH_CLOCK : at32f413_crm.h
  • CRM_I2C1_PERIPH_RESET : at32f413_crm.h
  • CRM_I2C2_PERIPH_CLOCK : at32f413_crm.h
  • CRM_I2C2_PERIPH_RESET : at32f413_crm.h
  • crm_interrupt_enable() : at32f413_crm.h, at32f413_crm.c
  • crm_interrupt_flag_get() : at32f413_crm.h, at32f413_crm.c
  • CRM_IOMUX_PERIPH_CLOCK : at32f413_crm.h
  • CRM_IOMUX_PERIPH_RESET : at32f413_crm.h
  • CRM_IRQn : at32f413.h
  • crm_lext_bypass() : at32f413_crm.h, at32f413_crm.c
  • CRM_LEXT_READY_INT_FLAG : at32f413_crm.h
  • CRM_LEXT_STABLE_FLAG : at32f413_crm.h
  • CRM_LEXT_STABLE_INT : at32f413_crm.h
  • CRM_LICK_READY_INT_FLAG : at32f413_crm.h
  • CRM_LICK_STABLE_FLAG : at32f413_crm.h
  • CRM_LICK_STABLE_INT : at32f413_crm.h
  • CRM_LOWPOWER_RESET_FLAG : at32f413_crm.h
  • CRM_MODULE_ENABLED : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • CRM_NRST_RESET_FLAG : at32f413_crm.h
  • crm_periph_clock_enable() : at32f413_crm.h, at32f413_crm.c
  • crm_periph_clock_sleepmd_type : at32f413_crm.h
  • crm_periph_clock_type : at32f413_crm.h
  • crm_periph_reset() : at32f413_crm.h, at32f413_crm.c
  • crm_periph_reset_type : at32f413_crm.h
  • crm_periph_sleep_mode_clock_enable() : at32f413_crm.h, at32f413_crm.c
  • crm_pll_clock_source_type : at32f413_crm.h
  • crm_pll_config() : at32f413_crm.h, at32f413_crm.c
  • CRM_PLL_MULT_10 : at32f413_crm.h
  • CRM_PLL_MULT_11 : at32f413_crm.h
  • CRM_PLL_MULT_12 : at32f413_crm.h
  • CRM_PLL_MULT_13 : at32f413_crm.h
  • CRM_PLL_MULT_14 : at32f413_crm.h
  • CRM_PLL_MULT_15 : at32f413_crm.h
  • CRM_PLL_MULT_16 : at32f413_crm.h
  • CRM_PLL_MULT_17 : at32f413_crm.h
  • CRM_PLL_MULT_18 : at32f413_crm.h
  • CRM_PLL_MULT_19 : at32f413_crm.h
  • CRM_PLL_MULT_2 : at32f413_crm.h
  • CRM_PLL_MULT_20 : at32f413_crm.h
  • CRM_PLL_MULT_21 : at32f413_crm.h
  • CRM_PLL_MULT_22 : at32f413_crm.h
  • CRM_PLL_MULT_23 : at32f413_crm.h
  • CRM_PLL_MULT_24 : at32f413_crm.h
  • CRM_PLL_MULT_25 : at32f413_crm.h
  • CRM_PLL_MULT_26 : at32f413_crm.h
  • CRM_PLL_MULT_27 : at32f413_crm.h
  • CRM_PLL_MULT_28 : at32f413_crm.h
  • CRM_PLL_MULT_29 : at32f413_crm.h
  • CRM_PLL_MULT_3 : at32f413_crm.h
  • CRM_PLL_MULT_30 : at32f413_crm.h
  • CRM_PLL_MULT_31 : at32f413_crm.h
  • CRM_PLL_MULT_32 : at32f413_crm.h
  • CRM_PLL_MULT_33 : at32f413_crm.h
  • CRM_PLL_MULT_34 : at32f413_crm.h
  • CRM_PLL_MULT_35 : at32f413_crm.h
  • CRM_PLL_MULT_36 : at32f413_crm.h
  • CRM_PLL_MULT_37 : at32f413_crm.h
  • CRM_PLL_MULT_38 : at32f413_crm.h
  • CRM_PLL_MULT_39 : at32f413_crm.h
  • CRM_PLL_MULT_4 : at32f413_crm.h
  • CRM_PLL_MULT_40 : at32f413_crm.h
  • CRM_PLL_MULT_41 : at32f413_crm.h
  • CRM_PLL_MULT_42 : at32f413_crm.h
  • CRM_PLL_MULT_43 : at32f413_crm.h
  • CRM_PLL_MULT_44 : at32f413_crm.h
  • CRM_PLL_MULT_45 : at32f413_crm.h
  • CRM_PLL_MULT_46 : at32f413_crm.h
  • CRM_PLL_MULT_47 : at32f413_crm.h
  • CRM_PLL_MULT_48 : at32f413_crm.h
  • CRM_PLL_MULT_49 : at32f413_crm.h
  • CRM_PLL_MULT_5 : at32f413_crm.h
  • CRM_PLL_MULT_50 : at32f413_crm.h
  • CRM_PLL_MULT_51 : at32f413_crm.h
  • CRM_PLL_MULT_52 : at32f413_crm.h
  • CRM_PLL_MULT_53 : at32f413_crm.h
  • CRM_PLL_MULT_54 : at32f413_crm.h
  • CRM_PLL_MULT_55 : at32f413_crm.h
  • CRM_PLL_MULT_56 : at32f413_crm.h
  • CRM_PLL_MULT_57 : at32f413_crm.h
  • CRM_PLL_MULT_58 : at32f413_crm.h
  • CRM_PLL_MULT_59 : at32f413_crm.h
  • CRM_PLL_MULT_6 : at32f413_crm.h
  • CRM_PLL_MULT_60 : at32f413_crm.h
  • CRM_PLL_MULT_61 : at32f413_crm.h
  • CRM_PLL_MULT_62 : at32f413_crm.h
  • CRM_PLL_MULT_63 : at32f413_crm.h
  • CRM_PLL_MULT_64 : at32f413_crm.h
  • CRM_PLL_MULT_7 : at32f413_crm.h
  • CRM_PLL_MULT_8 : at32f413_crm.h
  • CRM_PLL_MULT_9 : at32f413_crm.h
  • crm_pll_mult_type : at32f413_crm.h
  • CRM_PLL_OUTPUT_RANGE_GT72MHZ : at32f413_crm.h
  • CRM_PLL_OUTPUT_RANGE_LE72MHZ : at32f413_crm.h
  • crm_pll_output_range_type : at32f413_crm.h
  • CRM_PLL_READY_INT_FLAG : at32f413_crm.h
  • CRM_PLL_SOURCE_HEXT : at32f413_crm.h
  • CRM_PLL_SOURCE_HEXT_DIV : at32f413_crm.h
  • CRM_PLL_SOURCE_HICK : at32f413_crm.h
  • CRM_PLL_STABLE_FLAG : at32f413_crm.h
  • CRM_PLL_STABLE_INT : at32f413_crm.h
  • CRM_POR_RESET_FLAG : at32f413_crm.h
  • CRM_PWC_PERIPH_CLOCK : at32f413_crm.h
  • CRM_PWC_PERIPH_RESET : at32f413_crm.h
  • CRM_REG : at32f413_crm.h
  • CRM_REG_BIT : at32f413_crm.h
  • crm_reset() : at32f413_crm.h, at32f413_crm.c
  • crm_rtc_clock_enable() : at32f413_crm.h, at32f413_crm.c
  • CRM_RTC_CLOCK_HEXT_DIV : at32f413_crm.h
  • CRM_RTC_CLOCK_LEXT : at32f413_crm.h
  • CRM_RTC_CLOCK_LICK : at32f413_crm.h
  • CRM_RTC_CLOCK_NOCLK : at32f413_crm.h
  • crm_rtc_clock_select() : at32f413_crm.h, at32f413_crm.c
  • crm_rtc_clock_type : at32f413_crm.h
  • CRM_SCLK_HEXT : at32f413_crm.h
  • CRM_SCLK_HICK : at32f413_crm.h
  • CRM_SCLK_PLL : at32f413_crm.h
  • crm_sclk_type : at32f413_crm.h
  • CRM_SDIO1_PERIPH_CLOCK : at32f413_crm.h
  • CRM_SPI1_PERIPH_CLOCK : at32f413_crm.h
  • CRM_SPI1_PERIPH_RESET : at32f413_crm.h
  • CRM_SPI2_PERIPH_CLOCK : at32f413_crm.h
  • CRM_SPI2_PERIPH_RESET : at32f413_crm.h
  • CRM_SRAM_PERIPH_CLOCK_SLEEP_MODE : at32f413_crm.h
  • CRM_SW_RESET_FLAG : at32f413_crm.h
  • crm_sysclk_switch() : at32f413_crm.h, at32f413_crm.c
  • crm_sysclk_switch_status_get() : at32f413_crm.h, at32f413_crm.c
  • CRM_TMR10_PERIPH_CLOCK : at32f413_crm.h
  • CRM_TMR10_PERIPH_RESET : at32f413_crm.h
  • CRM_TMR11_PERIPH_CLOCK : at32f413_crm.h
  • CRM_TMR11_PERIPH_RESET : at32f413_crm.h
  • CRM_TMR1_PERIPH_CLOCK : at32f413_crm.h
  • CRM_TMR1_PERIPH_RESET : at32f413_crm.h
  • CRM_TMR2_PERIPH_CLOCK : at32f413_crm.h
  • CRM_TMR2_PERIPH_RESET : at32f413_crm.h
  • CRM_TMR3_PERIPH_CLOCK : at32f413_crm.h
  • CRM_TMR3_PERIPH_RESET : at32f413_crm.h
  • CRM_TMR4_PERIPH_CLOCK : at32f413_crm.h
  • CRM_TMR4_PERIPH_RESET : at32f413_crm.h
  • CRM_TMR5_PERIPH_CLOCK : at32f413_crm.h
  • CRM_TMR5_PERIPH_RESET : at32f413_crm.h
  • CRM_TMR8_PERIPH_CLOCK : at32f413_crm.h
  • CRM_TMR8_PERIPH_RESET : at32f413_crm.h
  • CRM_TMR9_PERIPH_CLOCK : at32f413_crm.h
  • CRM_TMR9_PERIPH_RESET : at32f413_crm.h
  • CRM_UART4_PERIPH_CLOCK : at32f413_crm.h
  • CRM_UART4_PERIPH_RESET : at32f413_crm.h
  • CRM_UART5_PERIPH_CLOCK : at32f413_crm.h
  • CRM_UART5_PERIPH_RESET : at32f413_crm.h
  • CRM_USART1_PERIPH_CLOCK : at32f413_crm.h
  • CRM_USART1_PERIPH_RESET : at32f413_crm.h
  • CRM_USART2_PERIPH_CLOCK : at32f413_crm.h
  • CRM_USART2_PERIPH_RESET : at32f413_crm.h
  • CRM_USART3_PERIPH_CLOCK : at32f413_crm.h
  • CRM_USART3_PERIPH_RESET : at32f413_crm.h
  • crm_usb_clock_div_set() : at32f413_crm.h, at32f413_crm.c
  • CRM_USB_CLOCK_SOURCE_HICK : at32f413_crm.h
  • CRM_USB_CLOCK_SOURCE_PLL : at32f413_crm.h
  • crm_usb_clock_source_select() : at32f413_crm.h, at32f413_crm.c
  • crm_usb_clock_source_type : at32f413_crm.h
  • CRM_USB_DIV_1 : at32f413_crm.h
  • CRM_USB_DIV_1_5 : at32f413_crm.h
  • CRM_USB_DIV_2 : at32f413_crm.h
  • CRM_USB_DIV_2_5 : at32f413_crm.h
  • CRM_USB_DIV_3 : at32f413_crm.h
  • CRM_USB_DIV_3_5 : at32f413_crm.h
  • CRM_USB_DIV_4 : at32f413_crm.h
  • crm_usb_div_type : at32f413_crm.h
  • CRM_USB_INT19_INT20 : at32f413_crm.h
  • CRM_USB_INT73_INT74 : at32f413_crm.h
  • crm_usb_int_map_type : at32f413_crm.h
  • crm_usb_interrupt_remapping_set() : at32f413_crm.h, at32f413_crm.c
  • CRM_USB_PERIPH_CLOCK : at32f413_crm.h
  • CRM_USB_PERIPH_RESET : at32f413_crm.h
  • CRM_WDT_RESET_FLAG : at32f413_crm.h
  • CRM_WWDT_PERIPH_CLOCK : at32f413_crm.h
  • CRM_WWDT_PERIPH_RESET : at32f413_crm.h
  • CRM_WWDT_RESET_FLAG : at32f413_crm.h
  • csd_table : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • CSW_BCSWSTATUS_FAILED : cdc_msc_class.h, msc_bot_scsi.h
  • CSW_BCSWSTATUS_PASS : cdc_msc_class.h, msc_bot_scsi.h
  • CSW_BCSWSTATUS_PHASE_ERR : cdc_msc_class.h, msc_bot_scsi.h
  • CSW_CMD_LENGTH : cdc_msc_class.h, msc_bot_scsi.h
  • CSW_DCSWSIGNATURE : cdc_msc_class.h, msc_bot_scsi.h
  • CUSHID_BCD_NUM : custom_hid_desc.h
  • CUSHID_BINTERVAL_TIME : custom_hid_desc.h
  • custom_hid_class_handler : custom_hid_class.c, custom_hid_class.h
  • custom_hid_class_send_report() : custom_hid_class.c, custom_hid_class.h
  • custom_hid_desc_handler : custom_hid_desc.c, custom_hid_desc.h
  • custom_hid_struct : custom_hid_class.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- d -

  • DATA1_VAL : project/at_start_f413/examples/usart/receiver_mute/src/main.c
  • DATA2_VAL : project/at_start_f413/examples/usart/receiver_mute/src/main.c
  • DATA3_VAL : project/at_start_f413/examples/usart/receiver_mute/src/main.c
  • DATA4_VAL : project/at_start_f413/examples/usart/receiver_mute/src/main.c
  • data_buffer : project/at_start_f413/examples/crc/calculation/src/main.c
  • data_count : project/at_start_f413/examples/usart/half_duplex/src/main.c, project/at_start_f413/examples/usart/hw_flow_control/src/main.c
  • data_counter_end : project/at_start_f413/examples/dma/flash_to_sram/src/main.c
  • data_take() : bootloader/src/iap.c
  • data_trans_dir : at32f413_usb.h
  • DATA_TRANS_IN : at32f413_usb.h
  • DATA_TRANS_OUT : at32f413_usb.h
  • DEBUG_BASE : at32f413.h
  • DEBUG_CAN1_PAUSE : at32f413_debug.h
  • DEBUG_CAN2_PAUSE : at32f413_debug.h
  • DEBUG_DEEPSLEEP : at32f413_debug.h
  • debug_device_id_get() : at32f413_debug.h, at32f413_debug.c
  • DEBUG_I2C1_SMBUS_TIMEOUT : at32f413_debug.h
  • DEBUG_I2C2_SMBUS_TIMEOUT : at32f413_debug.h
  • DEBUG_MODULE_ENABLED : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • debug_periph_mode_set() : at32f413_debug.h, at32f413_debug.c
  • DEBUG_SLEEP : at32f413_debug.h
  • DEBUG_STANDBY : at32f413_debug.h
  • DEBUG_TMR10_PAUSE : at32f413_debug.h
  • DEBUG_TMR11_PAUSE : at32f413_debug.h
  • DEBUG_TMR1_PAUSE : at32f413_debug.h
  • DEBUG_TMR2_PAUSE : at32f413_debug.h
  • DEBUG_TMR3_PAUSE : at32f413_debug.h
  • DEBUG_TMR4_PAUSE : at32f413_debug.h
  • DEBUG_TMR5_PAUSE : at32f413_debug.h
  • DEBUG_TMR8_PAUSE : at32f413_debug.h
  • DEBUG_TMR9_PAUSE : at32f413_debug.h
  • DEBUG_WDT_PAUSE : at32f413_debug.h
  • DEBUG_WWDT_PAUSE : at32f413_debug.h
  • DEBUGMCU : at32f413_debug.h
  • DebugMon_Handler() : project/at_start_f413/examples/acc/calibration/inc/at32f413_int.h, project/at_start_f413/examples/acc/calibration/src/at32f413_int.c, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_int.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/at32f413_int.c, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_int.h, project/at_start_f413/examples/adc/current_vref_value_check/src/at32f413_int.c, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_int.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/src/at32f413_int.c, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_int.h, project/at_start_f413/examples/adc/internal_temperature_sensor/src/at32f413_int.c, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_int.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/at32f413_int.c, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_int.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/at32f413_int.c, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_int.h, project/at_start_f413/examples/adc/voltage_monitoring/src/at32f413_int.c, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_int.h, project/at_start_f413/examples/bpr/bpr_data/src/at32f413_int.c, project/at_start_f413/examples/bpr/tamper/inc/at32f413_int.h, project/at_start_f413/examples/bpr/tamper/src/at32f413_int.c, project/at_start_f413/examples/can/communication_mode/inc/at32f413_int.h, project/at_start_f413/examples/can/communication_mode/src/at32f413_int.c, project/at_start_f413/examples/can/filter/inc/at32f413_int.h, project/at_start_f413/examples/can/filter/src/at32f413_int.c, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_int.h, project/at_start_f413/examples/can/loopback_mode/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/bit_band/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/fpu/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_int.c, project/at_start_f413/examples/crc/calculation/inc/at32f413_int.h, project/at_start_f413/examples/crc/calculation/src/at32f413_int.c, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_int.h, project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_int.c, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_int.h, project/at_start_f413/examples/crm/sysclk_switch/src/at32f413_int.c, project/at_start_f413/examples/debug/tmr1/inc/at32f413_int.h, project/at_start_f413/examples/debug/tmr1/src/at32f413_int.c, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_int.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/src/at32f413_int.c, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_int.h, project/at_start_f413/examples/dma/flash_to_sram/src/at32f413_int.c, project/at_start_f413/examples/exint/exint_config/inc/at32f413_int.h, project/at_start_f413/examples/exint/exint_config/src/at32f413_int.c, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_int.h, project/at_start_f413/examples/exint/exint_software_trigger/src/at32f413_int.c, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_int.h, project/at_start_f413/examples/flash/flash_write_read/src/at32f413_int.c, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_int.h, project/at_start_f413/examples/flash/operate_spim/src/at32f413_int.c, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_int.h, project/at_start_f413/examples/flash/run_in_spim/src/at32f413_int.c, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_int.h, project/at_start_f413/examples/gpio/io_toggle/src/at32f413_int.c, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_int.h, project/at_start_f413/examples/gpio/led_toggle/src/at32f413_int.c, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_int.h, project/at_start_f413/examples/gpio/swjtag_remap/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_poll/src/at32f413_int.c, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_int.h, project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_int.h, project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_int.h, project/at_start_f413/examples/i2s/halfduplex_dma/src/at32f413_int.c, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/src/at32f413_int.c, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_int.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/at32f413_int.c, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_int.h, project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_int.c, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_int.h, project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_int.c, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_int.c, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_int.h, project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_int.h, project/at_start_f413/examples/pwc/standby_rtc/src/at32f413_int.c, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_int.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/src/at32f413_int.c, project/at_start_f413/examples/rtc/calendar/inc/at32f413_int.h, project/at_start_f413/examples/rtc/calendar/src/at32f413_int.c, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_int.h, project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_int.h, project/at_start_f413/examples/sdio/emmc_card/src/at32f413_int.c, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_int.h, project/at_start_f413/examples/sdio/sd_mmc_card/src/at32f413_int.c, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_int.h, project/at_start_f413/examples/sdio/sdio_fatfs/src/at32f413_int.c, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/crc_transfer_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_int.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/at32f413_int.c, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/fullduplex_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_interrupt/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/at32f413_int.c, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/only_receive_mode_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_int.h, project/at_start_f413/examples/spi/w25q_flash/src/at32f413_int.c, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_int.h, project/at_start_f413/examples/tmr/6_steps/src/at32f413_int.c, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_int.h, project/at_start_f413/examples/tmr/7_pwm_output/src/at32f413_int.c, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/cascade_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_int.h, project/at_start_f413/examples/tmr/complementary_signals/src/at32f413_int.c, project/at_start_f413/examples/tmr/dma/inc/at32f413_int.h, project/at_start_f413/examples/tmr/dma/src/at32f413_int.c, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_int.h, project/at_start_f413/examples/tmr/dma_burst/src/at32f413_int.c, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/tmr/encoder_tmr2/src/at32f413_int.c, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_int.h, project/at_start_f413/examples/tmr/external_clock/src/at32f413_int.c, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/src/at32f413_int.c, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_int.h, project/at_start_f413/examples/tmr/hang_mode/src/at32f413_int.c, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_int.h, project/at_start_f413/examples/tmr/input_capture/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_high/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_low/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_int.h, project/at_start_f413/examples/tmr/one_cycle/src/at32f413_int.c, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/parallel_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_input_dma/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_int.h, project/at_start_f413/examples/tmr/timer_base/src/at32f413_int.c, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/tmr1_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_int.h, project/at_start_f413/examples/tmr/tmr2_32bit/src/at32f413_int.c, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_int.h, project/at_start_f413/examples/usart/half_duplex/src/at32f413_int.c, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_int.h, project/at_start_f413/examples/usart/hw_flow_control/src/at32f413_int.c, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_int.h, project/at_start_f413/examples/usart/idle_detection/src/at32f413_int.c, project/at_start_f413/examples/usart/interrupt/inc/at32f413_int.h, project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/irda/inc/at32f413_int.h, project/at_start_f413/examples/usart/irda/src/at32f413_int.c, project/at_start_f413/examples/usart/polling/inc/at32f413_int.h, project/at_start_f413/examples/usart/polling/src/at32f413_int.c, project/at_start_f413/examples/usart/printf/inc/at32f413_int.h, project/at_start_f413/examples/usart/printf/src/at32f413_int.c, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_int.h, project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c, project/at_start_f413/examples/usart/rs485/inc/at32f413_int.h, project/at_start_f413/examples/usart/rs485/src/at32f413_int.c, project/at_start_f413/examples/usart/smartcard/inc/at32f413_int.h, project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c, project/at_start_f413/examples/usart/synchronous/inc/at32f413_int.h, project/at_start_f413/examples/usart/synchronous/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_int.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/src/at32f413_int.c, project/at_start_f413/examples/usb_device/audio/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/audio/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_audio_hid/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/src/at32f413_int.c, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/custom_hid/src/at32f413_int.c, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/keyboard/src/at32f413_int.c, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/mouse/src/at32f413_int.c, project/at_start_f413/examples/usb_device/msc/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/msc/src/at32f413_int.c, project/at_start_f413/examples/usb_device/printer/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/printer/src/at32f413_int.c, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/vcp_loopback/src/at32f413_int.c, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/src/at32f413_int.c, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/winusb/src/at32f413_int.c, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_int.h, project/at_start_f413/examples/wdt/wdt_reset/src/at32f413_int.c, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_int.h, project/at_start_f413/examples/wdt/wdt_standby/src/at32f413_int.c, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_int.h, project/at_start_f413/examples/wwdt/wwdt_reset/src/at32f413_int.c, project/at_start_f413/templates/src/at32f413_int.c, project/at_start_f413/templates/inc/at32f413_int.h, utilities/at32f413_freertos_demo/inc/at32f413_int.h, utilities/at32f413_freertos_demo/src/at32f413_int.c, utilities/at32f413_gen_random_number_demo/inc/at32f413_int.h, utilities/at32f413_gen_random_number_demo/src/at32f413_int.c, utilities/at32f413_slib_demo/project_l0/inc/at32f413_int.h, utilities/at32f413_slib_demo/project_l0/src/at32f413_int.c, utilities/at32f413_slib_demo/project_l1/inc/at32f413_int.h, utilities/at32f413_slib_demo/project_l1/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/src/at32f413_int.c
  • DebugMonitor_IRQn : at32f413.h
  • DELAY : project/at_start_f413/examples/cortex_m4/systick_interrupt/src/main.c, project/at_start_f413/templates/src/main.c
  • delay() : project/at_start_f413/examples/tmr/encoder_tmr2/src/main.c
  • delay_init() : at32f413_board.c, at32f413_board.h
  • delay_ms() : at32f413_board.c, at32f413_board.h
  • delay_sec() : at32f413_board.c, at32f413_board.h
  • delay_us() : at32f413_board.c, at32f413_board.h
  • DEV_MMC : diskio.c
  • DEV_RAM : diskio.c
  • DEV_USB : diskio.c
  • device_descriptor : audio_desc.c, audio_hid_desc.c, cdc_desc.c, cdc_keyboard_desc.c, cdc_msc_desc.c, custom_hid_desc.c, hid_iap_desc.c, keyboard_desc.c, mouse_desc.c, msc_desc.c, printer_desc.c, winusb_desc.c
  • DEVICE_ID_ADDR1 : random.c
  • device_mode : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • disk_initialize() : diskio.c
  • disk_ioctl() : diskio.c
  • disk_read() : diskio.c
  • disk_status() : diskio.c
  • disk_write() : diskio.c
  • div_value : project/at_start_f413/examples/tmr/oc_high/src/main.c, project/at_start_f413/examples/tmr/oc_low/src/main.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/main.c, project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/main.c, project/at_start_f413/examples/tmr/one_cycle/src/main.c, project/at_start_f413/examples/tmr/pwm_output_simulate/src/main.c, project/at_start_f413/examples/tmr/pwm_output_tmr10/src/main.c, project/at_start_f413/examples/tmr/pwm_output_tmr3/src/main.c
  • DMA1 : at32f413_dma.h
  • DMA1_BASE : at32f413.h
  • DMA1_CHANNEL1 : at32f413_dma.h
  • DMA1_CHANNEL1_BASE : at32f413.h
  • DMA1_Channel1_IRQHandler() : project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/main.c, project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/main.c, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c, project/at_start_f413/examples/dma/flash_to_sram/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c
  • DMA1_Channel1_IRQn : at32f413.h
  • DMA1_CHANNEL2 : at32f413_dma.h
  • DMA1_CHANNEL2_BASE : at32f413.h
  • DMA1_Channel2_IRQHandler() : project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c
  • DMA1_Channel2_IRQn : at32f413.h
  • DMA1_CHANNEL3 : at32f413_dma.h
  • DMA1_CHANNEL3_BASE : at32f413.h
  • DMA1_Channel3_IRQHandler() : project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c, audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • DMA1_Channel3_IRQn : at32f413.h
  • DMA1_CHANNEL4 : at32f413_dma.h
  • DMA1_CHANNEL4_BASE : at32f413.h
  • DMA1_Channel4_IRQHandler() : project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c, project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c, audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • DMA1_Channel4_IRQn : at32f413.h
  • DMA1_CHANNEL5 : at32f413_dma.h
  • DMA1_CHANNEL5_BASE : at32f413.h
  • DMA1_Channel5_IRQHandler() : project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c, project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c
  • DMA1_Channel5_IRQn : at32f413.h
  • DMA1_CHANNEL6 : at32f413_dma.h
  • DMA1_CHANNEL6_BASE : at32f413.h
  • DMA1_Channel6_IRQHandler() : project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c
  • DMA1_Channel6_IRQn : at32f413.h
  • DMA1_CHANNEL7 : at32f413_dma.h
  • DMA1_CHANNEL7_BASE : at32f413.h
  • DMA1_Channel7_IRQHandler() : project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c
  • DMA1_Channel7_IRQn : at32f413.h
  • DMA1_DTERR1_FLAG : at32f413_dma.h
  • DMA1_DTERR2_FLAG : at32f413_dma.h
  • DMA1_DTERR3_FLAG : at32f413_dma.h
  • DMA1_DTERR4_FLAG : at32f413_dma.h
  • DMA1_DTERR5_FLAG : at32f413_dma.h
  • DMA1_DTERR6_FLAG : at32f413_dma.h
  • DMA1_DTERR7_FLAG : at32f413_dma.h
  • DMA1_FDT1_FLAG : at32f413_dma.h
  • DMA1_FDT2_FLAG : at32f413_dma.h
  • DMA1_FDT3_FLAG : at32f413_dma.h
  • DMA1_FDT4_FLAG : at32f413_dma.h
  • DMA1_FDT5_FLAG : at32f413_dma.h
  • DMA1_FDT6_FLAG : at32f413_dma.h
  • DMA1_FDT7_FLAG : at32f413_dma.h
  • DMA1_GL1_FLAG : at32f413_dma.h
  • DMA1_GL2_FLAG : at32f413_dma.h
  • DMA1_GL3_FLAG : at32f413_dma.h
  • DMA1_GL4_FLAG : at32f413_dma.h
  • DMA1_GL5_FLAG : at32f413_dma.h
  • DMA1_GL6_FLAG : at32f413_dma.h
  • DMA1_GL7_FLAG : at32f413_dma.h
  • DMA1_HDT1_FLAG : at32f413_dma.h
  • DMA1_HDT2_FLAG : at32f413_dma.h
  • DMA1_HDT3_FLAG : at32f413_dma.h
  • DMA1_HDT4_FLAG : at32f413_dma.h
  • DMA1_HDT5_FLAG : at32f413_dma.h
  • DMA1_HDT6_FLAG : at32f413_dma.h
  • DMA1_HDT7_FLAG : at32f413_dma.h
  • dma1_trans_complete_flag : project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/main.c
  • DMA2 : at32f413_dma.h
  • DMA2_BASE : at32f413.h
  • DMA2_CHANNEL1 : at32f413_dma.h
  • DMA2_CHANNEL1_BASE : at32f413.h
  • DMA2_Channel1_IRQHandler() : project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c
  • DMA2_Channel1_IRQn : at32f413.h
  • DMA2_CHANNEL2 : at32f413_dma.h
  • DMA2_CHANNEL2_BASE : at32f413.h
  • DMA2_Channel2_IRQn : at32f413.h
  • DMA2_CHANNEL3 : at32f413_dma.h
  • DMA2_CHANNEL3_BASE : at32f413.h
  • DMA2_Channel3_IRQn : at32f413.h
  • DMA2_CHANNEL4 : at32f413_dma.h
  • DMA2_Channel4_5_IRQn : at32f413.h
  • DMA2_CHANNEL4_BASE : at32f413.h
  • DMA2_CHANNEL5 : at32f413_dma.h
  • DMA2_CHANNEL5_BASE : at32f413.h
  • DMA2_CHANNEL6 : at32f413_dma.h
  • DMA2_Channel6_7_IRQn : at32f413.h
  • DMA2_CHANNEL6_BASE : at32f413.h
  • DMA2_CHANNEL7 : at32f413_dma.h
  • DMA2_CHANNEL7_BASE : at32f413.h
  • DMA2_DTERR1_FLAG : at32f413_dma.h
  • DMA2_DTERR2_FLAG : at32f413_dma.h
  • DMA2_DTERR3_FLAG : at32f413_dma.h
  • DMA2_DTERR4_FLAG : at32f413_dma.h
  • DMA2_DTERR5_FLAG : at32f413_dma.h
  • DMA2_DTERR6_FLAG : at32f413_dma.h
  • DMA2_DTERR7_FLAG : at32f413_dma.h
  • DMA2_FDT1_FLAG : at32f413_dma.h
  • DMA2_FDT2_FLAG : at32f413_dma.h
  • DMA2_FDT3_FLAG : at32f413_dma.h
  • DMA2_FDT4_FLAG : at32f413_dma.h
  • DMA2_FDT5_FLAG : at32f413_dma.h
  • DMA2_FDT6_FLAG : at32f413_dma.h
  • DMA2_FDT7_FLAG : at32f413_dma.h
  • DMA2_GL1_FLAG : at32f413_dma.h
  • DMA2_GL2_FLAG : at32f413_dma.h
  • DMA2_GL3_FLAG : at32f413_dma.h
  • DMA2_GL4_FLAG : at32f413_dma.h
  • DMA2_GL5_FLAG : at32f413_dma.h
  • DMA2_GL6_FLAG : at32f413_dma.h
  • DMA2_GL7_FLAG : at32f413_dma.h
  • DMA2_HDT1_FLAG : at32f413_dma.h
  • DMA2_HDT2_FLAG : at32f413_dma.h
  • DMA2_HDT3_FLAG : at32f413_dma.h
  • DMA2_HDT4_FLAG : at32f413_dma.h
  • DMA2_HDT5_FLAG : at32f413_dma.h
  • DMA2_HDT6_FLAG : at32f413_dma.h
  • DMA2_HDT7_FLAG : at32f413_dma.h
  • DMA_BUFFER_SIZE : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • dma_channel_enable() : at32f413_dma.h, at32f413_dma.c
  • dma_config() : project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/main.c, project/at_start_f413/examples/adc/current_vref_value_check/src/main.c, project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c, project/at_start_f413/examples/adc/internal_temperature_sensor/src/main.c, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/main.c, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c, project/at_start_f413/examples/adc/voltage_monitoring/src/main.c, project/at_start_f413/examples/i2s/halfduplex_dma/src/main.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c
  • dma_configuration() : project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c
  • dma_data_number_get() : at32f413_dma.h, at32f413_dma.c
  • dma_data_number_set() : at32f413_dma.h, at32f413_dma.c
  • dma_default_para_init() : at32f413_dma.h, at32f413_dma.c
  • DMA_DIR_MEMORY_TO_MEMORY : at32f413_dma.h
  • DMA_DIR_MEMORY_TO_PERIPHERAL : at32f413_dma.h
  • DMA_DIR_PERIPHERAL_TO_MEMORY : at32f413_dma.h
  • dma_dir_type : at32f413_dma.h
  • DMA_DTERR_INT : at32f413_dma.h
  • DMA_FDT_INT : at32f413_dma.h
  • dma_flag_clear() : at32f413_dma.h, at32f413_dma.c
  • dma_flag_get() : at32f413_dma.h, at32f413_dma.c
  • DMA_FLEXIBLE_ADC1 : at32f413_dma.h
  • dma_flexible_config() : at32f413_dma.h, at32f413_dma.c
  • DMA_FLEXIBLE_I2C1_RX : at32f413_dma.h
  • DMA_FLEXIBLE_I2C1_TX : at32f413_dma.h
  • DMA_FLEXIBLE_I2C2_RX : at32f413_dma.h
  • DMA_FLEXIBLE_I2C2_TX : at32f413_dma.h
  • dma_flexible_request_type : at32f413_dma.h
  • DMA_FLEXIBLE_SDIO1 : at32f413_dma.h
  • DMA_FLEXIBLE_SPI1_RX : at32f413_dma.h
  • DMA_FLEXIBLE_SPI1_TX : at32f413_dma.h
  • DMA_FLEXIBLE_SPI2_RX : at32f413_dma.h
  • DMA_FLEXIBLE_SPI2_TX : at32f413_dma.h
  • DMA_FLEXIBLE_TMR1_CH1 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR1_CH2 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR1_CH3 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR1_CH4 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR1_HALL : at32f413_dma.h
  • DMA_FLEXIBLE_TMR1_OVERFLOW : at32f413_dma.h
  • DMA_FLEXIBLE_TMR1_TRIG : at32f413_dma.h
  • DMA_FLEXIBLE_TMR2_CH1 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR2_CH2 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR2_CH3 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR2_CH4 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR2_OVERFLOW : at32f413_dma.h
  • DMA_FLEXIBLE_TMR2_TRIG : at32f413_dma.h
  • DMA_FLEXIBLE_TMR3_CH1 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR3_CH2 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR3_CH3 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR3_CH4 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR3_OVERFLOW : at32f413_dma.h
  • DMA_FLEXIBLE_TMR3_TRIG : at32f413_dma.h
  • DMA_FLEXIBLE_TMR4_CH1 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR4_CH2 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR4_CH3 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR4_CH4 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR4_OVERFLOW : at32f413_dma.h
  • DMA_FLEXIBLE_TMR4_TRIG : at32f413_dma.h
  • DMA_FLEXIBLE_TMR5_CH1 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR5_CH2 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR5_CH3 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR5_CH4 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR5_OVERFLOW : at32f413_dma.h
  • DMA_FLEXIBLE_TMR5_TRIG : at32f413_dma.h
  • DMA_FLEXIBLE_TMR8_CH1 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR8_CH2 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR8_CH3 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR8_CH4 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR8_HALL : at32f413_dma.h
  • DMA_FLEXIBLE_TMR8_OVERFLOW : at32f413_dma.h
  • DMA_FLEXIBLE_TMR8_TRIG : at32f413_dma.h
  • DMA_FLEXIBLE_UART1_RX : at32f413_dma.h
  • DMA_FLEXIBLE_UART1_TX : at32f413_dma.h
  • DMA_FLEXIBLE_UART2_RX : at32f413_dma.h
  • DMA_FLEXIBLE_UART2_TX : at32f413_dma.h
  • DMA_FLEXIBLE_UART3_RX : at32f413_dma.h
  • DMA_FLEXIBLE_UART3_TX : at32f413_dma.h
  • DMA_FLEXIBLE_UART4_RX : at32f413_dma.h
  • DMA_FLEXIBLE_UART4_TX : at32f413_dma.h
  • DMA_FLEXIBLE_UART5_RX : at32f413_dma.h
  • DMA_FLEXIBLE_UART5_TX : at32f413_dma.h
  • DMA_GET_HT_FLAG : i2c_application.c
  • DMA_GET_TC_FLAG : i2c_application.c
  • DMA_GET_TERR_FLAG : i2c_application.c
  • DMA_HDT_INT : at32f413_dma.h
  • dma_init() : at32f413_dma.h, at32f413_dma.c
  • dma_init_struct : project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c, project/at_start_f413/examples/dma/flash_to_sram/src/main.c, project/at_start_f413/examples/tmr/dma/src/main.c, project/at_start_f413/examples/tmr/dma_burst/src/main.c
  • dma_init_structure : project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c
  • dma_interrupt_enable() : at32f413_dma.h, at32f413_dma.c
  • dma_interrupt_flag_get() : at32f413_dma.h, at32f413_dma.c
  • dma_memory_data_size_type : at32f413_dma.h
  • DMA_MEMORY_DATA_WIDTH_BYTE : at32f413_dma.h
  • DMA_MEMORY_DATA_WIDTH_HALFWORD : at32f413_dma.h
  • DMA_MEMORY_DATA_WIDTH_WORD : at32f413_dma.h
  • DMA_MEMORY_INC_DISABLE : at32f413_dma.h
  • DMA_MEMORY_INC_ENABLE : at32f413_dma.h
  • dma_memory_inc_type : at32f413_dma.h
  • DMA_MODULE_ENABLED : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • dma_peripheral_data_size_type : at32f413_dma.h
  • DMA_PERIPHERAL_DATA_WIDTH_BYTE : at32f413_dma.h
  • DMA_PERIPHERAL_DATA_WIDTH_HALFWORD : at32f413_dma.h
  • DMA_PERIPHERAL_DATA_WIDTH_WORD : at32f413_dma.h
  • DMA_PERIPHERAL_INC_DISABLE : at32f413_dma.h
  • DMA_PERIPHERAL_INC_ENABLE : at32f413_dma.h
  • dma_peripheral_inc_type : at32f413_dma.h
  • DMA_PRIORITY_HIGH : at32f413_dma.h
  • dma_priority_level_type : at32f413_dma.h
  • DMA_PRIORITY_LOW : at32f413_dma.h
  • DMA_PRIORITY_MEDIUM : at32f413_dma.h
  • DMA_PRIORITY_VERY_HIGH : at32f413_dma.h
  • dma_reset() : at32f413_dma.h, at32f413_dma.c
  • dma_trans_complete_flag : project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/main.c, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c
  • DOWN_MOVE : mouse_class.h
  • dst_buffer : project/at_start_f413/examples/dma/flash_to_sram/src/main.c, project/at_start_f413/examples/usart/smartcard/src/main.c
  • DUMMY_NOP : system_at32f413.h
  • duty_cycle : project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_input/src/main.c, project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c
  • duty_result : project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c
  • dw_data_start_sector : utilities/at32f413_slib_demo/project_l0/src/main.c
  • dw_end_sector : utilities/at32f413_slib_demo/project_l0/src/main.c
  • dw_start_sector : utilities/at32f413_slib_demo/project_l0/src/main.c
  • DYMMY_BYTE : project/at_start_f413/examples/usart/synchronous/src/main.c
  • DZC_TIMEOUT : at32f413_can.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- e -

  • EE_MODE_DMA : eeprom.h
  • EE_MODE_INT : eeprom.h
  • EE_MODE_POLL : eeprom.h
  • EEPROM_BUSY_TIMEOUT : eeprom.h
  • EEPROM_I2C_ADDRESS : eeprom.h
  • eeprom_mode_type : eeprom.h
  • EEPROM_PAGE_SIZE : eeprom.h
  • eeprom_read_buffer() : eeprom.h, eeprom.c
  • eeprom_ready_check() : eeprom.c
  • eeprom_ready_wait() : eeprom.c
  • eeprom_write_buffer() : eeprom.h, eeprom.c
  • eeprom_write_page() : eeprom.c
  • ENABLE_RTC_ASSEED : random.h
  • EPT0_RX_ADDR : project/at_start_f413/examples/acc/calibration/inc/usb_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h
  • EPT0_TX_ADDR : project/at_start_f413/examples/acc/calibration/inc/usb_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h
  • EPT1_RX_ADDR : project/at_start_f413/examples/acc/calibration/inc/usb_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h
  • EPT1_TX_ADDR : project/at_start_f413/examples/acc/calibration/inc/usb_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h
  • EPT2_RX_ADDR : project/at_start_f413/examples/acc/calibration/inc/usb_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h
  • EPT2_TX_ADDR : project/at_start_f413/examples/acc/calibration/inc/usb_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h
  • EPT3_RX_ADDR : project/at_start_f413/examples/acc/calibration/inc/usb_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h
  • EPT3_TX_ADDR : project/at_start_f413/examples/acc/calibration/inc/usb_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h
  • EPT4_RX_ADDR : project/at_start_f413/examples/acc/calibration/inc/usb_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h
  • EPT4_TX_ADDR : project/at_start_f413/examples/acc/calibration/inc/usb_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h
  • EPT5_RX_ADDR : project/at_start_f413/examples/acc/calibration/inc/usb_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h
  • EPT5_TX_ADDR : project/at_start_f413/examples/acc/calibration/inc/usb_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h
  • EPT6_RX_ADDR : project/at_start_f413/examples/acc/calibration/inc/usb_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h
  • EPT6_TX_ADDR : project/at_start_f413/examples/acc/calibration/inc/usb_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h
  • EPT7_RX_ADDR : project/at_start_f413/examples/acc/calibration/inc/usb_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h
  • EPT7_TX_ADDR : project/at_start_f413/examples/acc/calibration/inc/usb_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h
  • EPT_BULK_TYPE : at32f413_usb.h
  • EPT_CONTROL_TYPE : at32f413_usb.h
  • EPT_IN : at32f413_usb.h
  • ept_inout_type : at32f413_usb.h
  • EPT_INT_TYPE : at32f413_usb.h
  • EPT_ISO_TYPE : at32f413_usb.h
  • EPT_OUT : at32f413_usb.h
  • ept_trans_type : at32f413_usb.h
  • ERASE_TIMEOUT : at32f413_flash.h
  • ERROR : at32f413.h
  • error_handler() : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/communication_int/src/main.c, project/at_start_f413/examples/i2c/communication_poll/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c
  • ERROR_ID_VAL : project/at_start_f413/examples/usart/receiver_mute/src/main.c
  • error_status : at32f413.h
  • error_times_index : project/at_start_f413/examples/adc/voltage_monitoring/src/main.c
  • EXINT : at32f413_exint.h
  • EXINT0_IRQHandler() : project/at_start_f413/examples/exint/exint_config/src/main.c, project/at_start_f413/templates/src/main.c
  • EXINT0_IRQn : at32f413.h
  • EXINT15_10_IRQn : at32f413.h
  • EXINT1_IRQn : at32f413.h
  • EXINT2_IRQn : at32f413.h
  • EXINT3_IRQn : at32f413.h
  • EXINT4_IRQHandler() : project/at_start_f413/examples/exint/exint_software_trigger/src/main.c
  • EXINT4_IRQn : at32f413.h
  • EXINT9_5_IRQHandler() : project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c
  • EXINT9_5_IRQn : at32f413.h
  • EXINT_BASE : at32f413.h
  • exint_config() : project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c
  • exint_default_para_init() : at32f413_exint.h, at32f413_exint.c
  • exint_event_enable() : at32f413_exint.h, at32f413_exint.c
  • exint_flag_clear() : at32f413_exint.h, at32f413_exint.c
  • exint_flag_get() : at32f413_exint.h, at32f413_exint.c
  • exint_init() : at32f413_exint.h, at32f413_exint.c
  • exint_interrupt_enable() : at32f413_exint.h, at32f413_exint.c
  • exint_interrupt_flag_get() : at32f413_exint.h, at32f413_exint.c
  • exint_line0_config() : project/at_start_f413/examples/exint/exint_config/src/main.c
  • exint_line4_config() : project/at_start_f413/examples/exint/exint_software_trigger/src/main.c
  • EXINT_LINE_0 : at32f413_exint.h
  • EXINT_LINE_1 : at32f413_exint.h
  • EXINT_LINE_10 : at32f413_exint.h
  • EXINT_LINE_11 : at32f413_exint.h
  • EXINT_LINE_12 : at32f413_exint.h
  • EXINT_LINE_13 : at32f413_exint.h
  • EXINT_LINE_14 : at32f413_exint.h
  • EXINT_LINE_15 : at32f413_exint.h
  • EXINT_LINE_16 : at32f413_exint.h
  • EXINT_LINE_17 : at32f413_exint.h
  • EXINT_LINE_18 : at32f413_exint.h
  • EXINT_LINE_2 : at32f413_exint.h
  • EXINT_LINE_3 : at32f413_exint.h
  • EXINT_LINE_4 : at32f413_exint.h
  • EXINT_LINE_5 : at32f413_exint.h
  • EXINT_LINE_6 : at32f413_exint.h
  • EXINT_LINE_7 : at32f413_exint.h
  • EXINT_LINE_8 : at32f413_exint.h
  • EXINT_LINE_9 : at32f413_exint.h
  • EXINT_LINE_EVENT : at32f413_exint.h
  • EXINT_LINE_INTERRUPT : at32f413_exint.h
  • EXINT_LINE_INTERRUPUT : at32f413_exint.h
  • exint_line_mode_type : at32f413_exint.h
  • EXINT_LINE_NONE : at32f413_exint.h
  • EXINT_MODULE_ENABLED : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • exint_polarity_config_type : at32f413_exint.h
  • exint_reset() : at32f413_exint.h, at32f413_exint.c
  • exint_software_interrupt_event_generate() : at32f413_exint.h, at32f413_exint.c
  • EXINT_TRIGGER_BOTH_EDGE : at32f413_exint.h
  • EXINT_TRIGGER_FALLING_EDGE : at32f413_exint.h
  • EXINT_TRIGGER_RISING_EDGE : at32f413_exint.h
  • EXT_CSD_BUS_WIDTH : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • EXT_CSD_Clear_byte : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • EXT_CSD_CMD_SET_CPSECURE : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • EXT_CSD_CMD_SET_NORMAL : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • EXT_CSD_CMD_SET_SECURE : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • EXT_CSD_Command_set : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • EXT_CSD_HS_TIMING : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • EXT_CSD_Set_bit : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • ext_csd_table : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • EXT_CSD_Write_byte : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • EXT_SPIM_EN_MUX : at32f413_gpio.h
  • EXT_SPIM_GMUX_1000 : at32f413_gpio.h
  • EXT_SPIM_GMUX_1001 : at32f413_gpio.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- f -

  • fac_ms : at32f413_board.c
  • fac_us : at32f413_board.c
  • FALSE : at32f413.h
  • FAP_RELIEVE_KEY : at32f413_flash.h
  • FAST : project/at_start_f413/templates/src/main.c
  • FAT16_BYTE_PER_SIZE : flash_fat16.h
  • FAT16_CLUSTER_SIZE : flash_fat16.c
  • FAT16_DIR_SIZE : flash_fat16.h
  • fat16_file_name : flash_fat16.c
  • FAT16_FILENAME_SIZE : flash_fat16.h
  • FAT16_FIRST_CLUSTER : flash_fat16.c
  • fat16_memory_cmp() : flash_fat16.c
  • fat16_memory_copy() : flash_fat16.c
  • fat16_memory_memset() : flash_fat16.c
  • fat16_root_dir_sector : flash_fat16.c
  • fat16_sector : flash_fat16.c
  • FAT16_SECTOR_SIZE : flash_fat16.h, flash_fat16.c
  • fat16_table_sector0 : flash_fat16.c
  • FAT16_TABLE_SIZE : flash_fat16.h
  • fatfs_test() : project/at_start_f413/examples/sdio/sdio_fatfs/src/main.c
  • FEEDBACK_REFRESH_TIME : audio_class.h, audio_hid_class.h
  • FF_CODE_PAGE : ffconf.h
  • FF_FS_EXFAT : ffconf.h
  • FF_FS_LOCK : ffconf.h
  • FF_FS_MINIMIZE : ffconf.h
  • FF_FS_NOFSINFO : ffconf.h
  • FF_FS_NORTC : ffconf.h
  • FF_FS_READONLY : ffconf.h
  • FF_FS_REENTRANT : ffconf.h
  • FF_FS_RPATH : ffconf.h
  • FF_FS_TIMEOUT : ffconf.h
  • FF_FS_TINY : ffconf.h
  • FF_LBA64 : ffconf.h
  • FF_LFN_BUF : ffconf.h
  • FF_LFN_UNICODE : ffconf.h
  • FF_MAX_LFN : ffconf.h
  • FF_MAX_SS : ffconf.h
  • FF_MIN_GPT : ffconf.h
  • FF_MIN_SS : ffconf.h
  • FF_MULTI_PARTITION : ffconf.h
  • FF_NORTC_MDAY : ffconf.h
  • FF_NORTC_MON : ffconf.h
  • FF_NORTC_YEAR : ffconf.h
  • FF_PRINT_FLOAT : ffconf.h
  • FF_PRINT_LLI : ffconf.h
  • FF_SFN_BUF : ffconf.h
  • FF_STR_VOLUME_ID : ffconf.h
  • FF_STRF_ENCODE : ffconf.h
  • FF_SYNC_t : ffconf.h
  • FF_USE_CHMOD : ffconf.h
  • FF_USE_EXPAND : ffconf.h
  • FF_USE_FASTSEEK : ffconf.h
  • FF_USE_FIND : ffconf.h
  • FF_USE_FORWARD : ffconf.h
  • FF_USE_LABEL : ffconf.h
  • FF_USE_LFN : ffconf.h
  • FF_USE_MKFS : ffconf.h
  • FF_USE_STRFUNC : ffconf.h
  • FF_USE_TRIM : ffconf.h
  • FF_VOLUME_STRS : ffconf.h
  • FF_VOLUMES : ffconf.h
  • FFCONF_DEF : ffconf.h
  • file : project/at_start_f413/examples/sdio/sdio_fatfs/src/main.c
  • file_match : flash_fat16.c
  • FILE_SUFFIX1_LEN : flash_fat16.h
  • FILE_SUFFIX1_NAME : flash_fat16.h
  • FILE_SUFFIX2_LEN : flash_fat16.h
  • FILE_SUFFIX2_NAME : flash_fat16.h
  • file_write_nr : flash_fat16.c
  • FILTER_EXT_ID1 : project/at_start_f413/examples/can/filter/src/main.c
  • FILTER_EXT_ID2 : project/at_start_f413/examples/can/filter/src/main.c
  • FILTER_EXT_ID3 : project/at_start_f413/examples/can/filter/src/main.c
  • FILTER_STD_ID1 : project/at_start_f413/examples/can/filter/src/main.c
  • FILTER_STD_ID2 : project/at_start_f413/examples/can/filter/src/main.c
  • FILTER_STD_ID3 : project/at_start_f413/examples/can/filter/src/main.c
  • FIR_lowpass_filter() : project_l0/inc/fir_filter.h, fir_filter.c, project_l1/inc/fir_filter.h
  • firCoeffs32 : fir_coefficient.c, fir_filter.c
  • firStateF32 : fir_filter.c
  • flag_status : at32f413.h
  • FLASH : at32f413_flash.h
  • flash_2kb_write() : utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/flash.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/src/flash.c
  • FLASH_APP_ADDRESS : app_led3_toggle/inc/hid_iap_user.h, app_led4_toggle/inc/hid_iap_user.h, bootloader/inc/hid_iap_user.h
  • FLASH_APP_START_ADDR : flash_fat16.h
  • FLASH_BASE : at32f413.h
  • flash_buf : project/at_start_f413/examples/flash/flash_write_read/src/flash.c
  • flash_byte_program() : at32f413_flash.h, at32f413_flash.c
  • flash_crc_calibrate() : at32f413_flash.h, at32f413_flash.c
  • flash_crc_check() : flash_fat16.c
  • FLASH_CS_HIGH : spi_flash.h
  • FLASH_CS_LOW : spi_flash.h
  • FLASH_EPP_ERROR : at32f413_flash.h
  • flash_epp_set() : at32f413_flash.h, at32f413_flash.c
  • flash_epp_status_get() : at32f413_flash.h, at32f413_flash.c
  • FLASH_EPPERR_FLAG : at32f413_flash.h
  • FLASH_ERR_INT : at32f413_flash.h
  • flash_fap_enable() : at32f413_flash.h, at32f413_flash.c
  • flash_fap_status_get() : at32f413_flash.h, at32f413_flash.c
  • FLASH_FAT16_1_ADDR : flash_fat16.h
  • FLASH_FAT16_2_ADDR : flash_fat16.h
  • flash_fat16_addr_offset() : flash_fat16.c
  • flash_fat16_boot_dir_write() : flash_fat16.c
  • FLASH_FAT16_BOOT_SECTOR_ADDR : flash_fat16.h
  • flash_fat16_clear_upgrade_flag() : flash_fat16.c
  • FLASH_FAT16_FILE_START_ADDR : flash_fat16.h
  • flash_fat16_get_upgrade_flag() : flash_fat16.h, flash_fat16.c
  • flash_fat16_init() : flash_fat16.h, flash_fat16.c
  • flash_fat16_loop_status() : flash_fat16.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c
  • flash_fat16_read() : flash_fat16.h, flash_fat16.c
  • FLASH_FAT16_ROOT_ADDR : flash_fat16.h
  • flash_fat16_sector_write() : flash_fat16.c
  • flash_fat16_set_name() : flash_fat16.h, flash_fat16.c
  • flash_fat16_set_upgrade_flag() : flash_fat16.c
  • flash_fat16_write() : flash_fat16.h, flash_fat16.c
  • flash_flag_clear() : at32f413_flash.h, at32f413_flash.c
  • flash_flag_get() : at32f413_flash.h, at32f413_flash.c
  • flash_halfword_program() : at32f413_flash.h, at32f413_flash.c
  • flash_iap : flash_fat16.h, flash_fat16.c
  • flash_internal_all_erase() : at32f413_flash.h, at32f413_flash.c
  • flash_interrupt_enable() : at32f413_flash.h, at32f413_flash.c
  • FLASH_IRQHandler() : utilities/at32f413_slib_demo/project_l0/src/at32f413_int.c, utilities/at32f413_slib_demo/project_l1/src/at32f413_int.c
  • FLASH_IRQn : at32f413.h
  • flash_lock() : at32f413_flash.h, at32f413_flash.c
  • FLASH_MODULE_ENABLED : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • FLASH_OBF_FLAG : at32f413_flash.h
  • FLASH_ODF_FLAG : at32f413_flash.h
  • FLASH_ODF_INT : at32f413_flash.h
  • FLASH_OPERATE_BUSY : at32f413_flash.h
  • FLASH_OPERATE_DONE : at32f413_flash.h
  • FLASH_OPERATE_TIMEOUT : at32f413_flash.h
  • flash_operation_status_get() : at32f413_flash.h, at32f413_flash.c
  • flash_operation_wait_for() : at32f413_flash.h, at32f413_flash.c
  • FLASH_PRGMERR_FLAG : at32f413_flash.h
  • FLASH_PROGRAM_ERROR : at32f413_flash.h
  • flash_read() : project/at_start_f413/examples/flash/flash_write_read/inc/flash.h, project/at_start_f413/examples/flash/flash_write_read/src/flash.c
  • flash_read_data() : flash_fat16.c
  • FLASH_REG_BASE : at32f413.h
  • FLASH_SECTOR_1K_ALLGNED : flash_fat16.h
  • FLASH_SECTOR_1K_SIZE : flash_fat16.h
  • FLASH_SECTOR_2K_ALLGNED : flash_fat16.h
  • FLASH_SECTOR_2K_SIZE : flash_fat16.h
  • FLASH_SECTOR_4K_ALLGNED : flash_fat16.h
  • FLASH_SECTOR_4K_SIZE : flash_fat16.h
  • flash_sector_erase() : at32f413_flash.h, at32f413_flash.c
  • FLASH_SECTOR_SIZE : utilities/at32f413_slib_demo/project_l0/src/main.c
  • FLASH_SIZE : utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/flash.h
  • FLASH_SIZE_REG : hid_iap_class.h
  • FLASH_SLIB_DATA_START_SECTOR : at32f413_flash.h
  • flash_slib_datastart_sector_get() : at32f413_flash.h, at32f413_flash.c
  • flash_slib_disable() : at32f413_flash.h, at32f413_flash.c
  • flash_slib_enable() : at32f413_flash.h, at32f413_flash.c
  • FLASH_SLIB_END_SECTOR : at32f413_flash.h
  • flash_slib_end_sector_get() : at32f413_flash.h, at32f413_flash.c
  • flash_slib_remaining_count_get() : at32f413_flash.h, at32f413_flash.c
  • FLASH_SLIB_START_SECTOR : at32f413_flash.h
  • flash_slib_start_sector_get() : at32f413_flash.h, at32f413_flash.c
  • flash_slib_state_get() : at32f413_flash.h, at32f413_flash.c
  • FLASH_SPI_DUMMY_BYTE : spi_flash.h
  • flash_spim_all_erase() : at32f413_flash.h, at32f413_flash.c
  • flash_spim_dummy_read() : at32f413_flash.h, at32f413_flash.c
  • flash_spim_encryption_range_set() : at32f413_flash.h, at32f413_flash.c
  • FLASH_SPIM_EPPERR_FLAG : at32f413_flash.h
  • FLASH_SPIM_ERR_INT : at32f413_flash.h
  • flash_spim_lock() : at32f413_flash.h, at32f413_flash.c
  • flash_spim_mass_program() : at32f413_flash.h, at32f413_flash.c
  • FLASH_SPIM_MODEL1 : at32f413_flash.h
  • FLASH_SPIM_MODEL2 : at32f413_flash.h
  • flash_spim_model_select() : at32f413_flash.h, at32f413_flash.c
  • flash_spim_model_type : at32f413_flash.h
  • FLASH_SPIM_OBF_FLAG : at32f413_flash.h
  • FLASH_SPIM_ODF_FLAG : at32f413_flash.h
  • FLASH_SPIM_ODF_INT : at32f413_flash.h
  • flash_spim_operation_status_get() : at32f413_flash.h, at32f413_flash.c
  • flash_spim_operation_wait_for() : at32f413_flash.h, at32f413_flash.c
  • FLASH_SPIM_PRGMERR_FLAG : at32f413_flash.h
  • FLASH_SPIM_START_ADDR : at32f413_flash.h
  • flash_spim_unlock() : at32f413_flash.h, at32f413_flash.c
  • flash_ssb_set() : at32f413_flash.h, at32f413_flash.c
  • flash_ssb_status_get() : at32f413_flash.h, at32f413_flash.c
  • FLASH_START_ADDR : utilities/at32f413_slib_demo/project_l0/src/main.c
  • flash_status_type : at32f413_flash.h
  • FLASH_TEST_ADDR : project/at_start_f413/examples/spi/w25q_flash/src/main.c
  • flash_unlock() : at32f413_flash.h, at32f413_flash.c
  • FLASH_UNLOCK_KEY1 : at32f413_flash.h
  • FLASH_UNLOCK_KEY2 : at32f413_flash.h
  • flash_upgrade_flag_read() : utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/flash.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/src/flash.c
  • FLASH_USDERR_FLAG : at32f413_flash.h
  • flash_user_system_data_erase() : at32f413_flash.h, at32f413_flash.c
  • flash_user_system_data_program() : at32f413_flash.h, at32f413_flash.c
  • flash_word_program() : at32f413_flash.h, at32f413_flash.c
  • flash_write() : project/at_start_f413/examples/flash/flash_write_read/inc/flash.h, project/at_start_f413/examples/flash/flash_write_read/src/flash.c
  • flash_write_data() : flash_fat16.c
  • flash_write_nocheck() : project/at_start_f413/examples/flash/flash_write_read/inc/flash.h, project/at_start_f413/examples/flash/flash_write_read/src/flash.c
  • FLEX_CHANNEL1 : at32f413_dma.h
  • FLEX_CHANNEL2 : at32f413_dma.h
  • FLEX_CHANNEL3 : at32f413_dma.h
  • FLEX_CHANNEL4 : at32f413_dma.h
  • FLEX_CHANNEL5 : at32f413_dma.h
  • FLEX_CHANNEL6 : at32f413_dma.h
  • FLEX_CHANNEL7 : at32f413_dma.h
  • fputc() : at32f413_board.c
  • freq_result : project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c
  • frequency : project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_input/src/main.c, project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c
  • fs : project/at_start_f413/examples/sdio/sdio_fatfs/src/main.c
  • FZC_TIMEOUT : at32f413_can.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- g -

  • g_audio_hid_usb_desc : audio_hid_desc.h
  • g_custom_hid_usb_desc : custom_hid_desc.h
  • g_file_attr : flash_fat16.c
  • g_hidiap_usb_desc : hid_iap_desc.h
  • g_keyboard_usb_desc : keyboard_desc.h
  • g_mouse_usb_desc : mouse_desc.h
  • g_speed : project/at_start_f413/templates/src/main.c
  • g_usb_offset_addr : at32f413_usb.c
  • g_usb_packet_address : at32f413_usb.h, at32f413_usb.c
  • g_usbd_audio_hid_report : audio_hid_desc.h
  • g_usbd_custom_hid_report : custom_hid_desc.h
  • g_usbd_hidiap_report : hid_iap_desc.h
  • g_usbd_keyboard_report : keyboard_desc.h
  • g_usbd_mouse_report : mouse_desc.h
  • g_usbd_vcpkybrd_hid_report : cdc_keyboard_desc.h
  • g_vcpkybrd_hid_usb_desc : cdc_keyboard_desc.h
  • g_winusb_rx_buffer : winusb_class.c
  • generate_julia_fpu() : julia_fpu.h, julia_fpu.c
  • get_data_from_usart_flag : bootloader/inc/tmr.h, bootloader/src/tmr.c
  • get_device_config_string() : audio_desc.c, audio_hid_desc.c, cdc_desc.c, cdc_keyboard_desc.c, cdc_msc_desc.c, custom_hid_desc.c, hid_iap_desc.c, keyboard_desc.c, mouse_desc.c, msc_desc.c, printer_desc.c, winusb_desc.c
  • get_device_configuration() : audio_desc.c, audio_hid_desc.c, cdc_desc.c, cdc_keyboard_desc.c, cdc_msc_desc.c, custom_hid_desc.c, hid_iap_desc.c, keyboard_desc.c, mouse_desc.c, msc_desc.c, printer_desc.c, winusb_desc.c
  • get_device_descriptor() : audio_desc.c, audio_hid_desc.c, cdc_desc.c, cdc_keyboard_desc.c, cdc_msc_desc.c, custom_hid_desc.c, hid_iap_desc.c, keyboard_desc.c, mouse_desc.c, msc_desc.c, printer_desc.c, winusb_desc.c
  • get_device_interface_string() : audio_desc.c, audio_hid_desc.c, cdc_desc.c, cdc_keyboard_desc.c, cdc_msc_desc.c, custom_hid_desc.c, hid_iap_desc.c, keyboard_desc.c, mouse_desc.c, msc_desc.c, printer_desc.c, winusb_desc.c
  • get_device_lang_id() : audio_desc.c, audio_hid_desc.c, cdc_desc.c, cdc_keyboard_desc.c, cdc_msc_desc.c, custom_hid_desc.c, hid_iap_desc.c, keyboard_desc.c, mouse_desc.c, msc_desc.c, printer_desc.c, winusb_desc.c
  • get_device_manufacturer_string() : audio_desc.c, audio_hid_desc.c, cdc_desc.c, cdc_keyboard_desc.c, cdc_msc_desc.c, custom_hid_desc.c, hid_iap_desc.c, keyboard_desc.c, mouse_desc.c, msc_desc.c, printer_desc.c, winusb_desc.c
  • get_device_other_speed() : audio_desc.c, audio_hid_desc.c, cdc_desc.c, cdc_keyboard_desc.c, cdc_msc_desc.c, custom_hid_desc.c, hid_iap_desc.c, keyboard_desc.c, mouse_desc.c, msc_desc.c, printer_desc.c, winusb_desc.c
  • get_device_product_string() : audio_desc.c, audio_hid_desc.c, cdc_desc.c, cdc_keyboard_desc.c, cdc_msc_desc.c, custom_hid_desc.c, hid_iap_desc.c, keyboard_desc.c, mouse_desc.c, msc_desc.c, printer_desc.c, winusb_desc.c
  • get_device_qualifier() : audio_desc.c, audio_hid_desc.c, cdc_desc.c, cdc_keyboard_desc.c, cdc_msc_desc.c, custom_hid_desc.c, hid_iap_desc.c, keyboard_desc.c, mouse_desc.c, msc_desc.c, printer_desc.c, winusb_desc.c
  • get_device_serial_string() : audio_desc.c, audio_hid_desc.c, cdc_desc.c, cdc_keyboard_desc.c, cdc_msc_desc.c, custom_hid_desc.c, hid_iap_desc.c, keyboard_desc.c, mouse_desc.c, msc_desc.c, printer_desc.c, winusb_desc.c
  • get_ext_csd() : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • get_inquiry() : composite_vcp_msc/inc/msc_diskio.h, virtual_msc_iap/inc/msc_diskio.h
  • GET_LINE_CODING : cdc_msc_class.h, msc_bot_scsi.h, usb_std.h
  • GET_RX_LEN_ADDR : at32f413_usb.h
  • get_serial_num() : audio_desc.c, audio_hid_desc.c, cdc_desc.c, cdc_keyboard_desc.c, cdc_msc_desc.c, custom_hid_desc.c, hid_iap_desc.c, keyboard_desc.c, mouse_desc.c, msc_desc.c, printer_desc.c, winusb_desc.c
  • GET_TX_LEN_ADDR : at32f413_usb.h
  • get_uid_for_seed() : random.c
  • getvar_operationcomplete() : project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c, project/at_start_f413/examples/rtc/lick_calibration/src/main.c
  • gpio_bits_reset() : at32f413_gpio.h, at32f413_gpio.c
  • gpio_bits_set() : at32f413_gpio.h, at32f413_gpio.c
  • gpio_bits_toggle() : at32f413_gpio.h, at32f413_gpio.c
  • gpio_bits_write() : at32f413_gpio.h, at32f413_gpio.c
  • gpio_config() : project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/main.c, project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/main.c, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c, project/at_start_f413/examples/adc/voltage_monitoring/src/main.c, project/at_start_f413/examples/gpio/io_toggle/src/main.c, project/at_start_f413/examples/i2s/halfduplex_dma/src/main.c, project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c, project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/fullduplex_polling/src/main.c, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c, project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c
  • gpio_configuration() : project/at_start_f413/examples/tmr/oc_high/src/main.c, project/at_start_f413/examples/tmr/oc_low/src/main.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/main.c, project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/main.c, project/at_start_f413/examples/tmr/one_cycle/src/main.c, project/at_start_f413/examples/tmr/parallel_synchro/src/main.c, project/at_start_f413/examples/tmr/pwm_input/src/main.c, project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c, project/at_start_f413/examples/tmr/pwm_output_simulate/src/main.c, project/at_start_f413/examples/tmr/pwm_output_tmr10/src/main.c, project/at_start_f413/examples/tmr/pwm_output_tmr3/src/main.c, project/at_start_f413/examples/tmr/tmr1_synchro/src/main.c, project/at_start_f413/examples/tmr/tmr2_32bit/src/main.c
  • gpio_default_para_init() : at32f413_gpio.h, at32f413_gpio.c
  • GPIO_DRIVE_STRENGTH_MAXIMUM : at32f413_gpio.h
  • GPIO_DRIVE_STRENGTH_MODERATE : at32f413_gpio.h
  • GPIO_DRIVE_STRENGTH_STRONGER : at32f413_gpio.h
  • gpio_drive_type : at32f413_gpio.h
  • gpio_event_output_config() : at32f413_gpio.h, at32f413_gpio.c
  • gpio_event_output_enable() : at32f413_gpio.h, at32f413_gpio.c
  • gpio_exint_line_config() : at32f413_gpio.h, at32f413_gpio.c
  • gpio_init() : at32f413_gpio.h, at32f413_gpio.c
  • gpio_init_struct : project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c, project/at_start_f413/examples/dma/flash_to_sram/src/main.c, project/at_start_f413/examples/tmr/6_steps/src/main.c, project/at_start_f413/examples/tmr/7_pwm_output/src/main.c, project/at_start_f413/examples/tmr/cascade_synchro/src/main.c, project/at_start_f413/examples/tmr/complementary_signals/src/main.c, project/at_start_f413/examples/tmr/dma/src/main.c, project/at_start_f413/examples/tmr/dma_burst/src/main.c, project/at_start_f413/examples/tmr/encoder_tmr2/src/main.c, project/at_start_f413/examples/tmr/external_clock/src/main.c, project/at_start_f413/examples/tmr/hall_xor_tmr2/src/main.c, project/at_start_f413/examples/tmr/hang_mode/src/main.c, project/at_start_f413/examples/tmr/input_capture/src/main.c
  • gpio_input_data_bit_read() : at32f413_gpio.h, at32f413_gpio.c
  • gpio_input_data_read() : at32f413_gpio.h, at32f413_gpio.c
  • gpio_iomux_reset() : at32f413_gpio.h, at32f413_gpio.c
  • GPIO_MODE_ANALOG : at32f413_gpio.h
  • GPIO_MODE_INPUT : at32f413_gpio.h
  • GPIO_MODE_MUX : at32f413_gpio.h
  • GPIO_MODE_OUTPUT : at32f413_gpio.h
  • gpio_mode_type : at32f413_gpio.h
  • GPIO_MODULE_ENABLED : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • gpio_output_data_bit_read() : at32f413_gpio.h, at32f413_gpio.c
  • gpio_output_data_read() : at32f413_gpio.h, at32f413_gpio.c
  • GPIO_OUTPUT_OPEN_DRAIN : at32f413_gpio.h
  • GPIO_OUTPUT_PUSH_PULL : at32f413_gpio.h
  • gpio_output_type : at32f413_gpio.h
  • gpio_pin_remap_config() : at32f413_gpio.h, at32f413_gpio.c
  • gpio_pin_wp_config() : at32f413_gpio.h, at32f413_gpio.c
  • GPIO_PINS_0 : at32f413_gpio.h
  • GPIO_PINS_1 : at32f413_gpio.h
  • GPIO_PINS_10 : at32f413_gpio.h
  • GPIO_PINS_11 : at32f413_gpio.h
  • GPIO_PINS_12 : at32f413_gpio.h
  • GPIO_PINS_13 : at32f413_gpio.h
  • GPIO_PINS_14 : at32f413_gpio.h
  • GPIO_PINS_15 : at32f413_gpio.h
  • GPIO_PINS_2 : at32f413_gpio.h
  • GPIO_PINS_3 : at32f413_gpio.h
  • GPIO_PINS_4 : at32f413_gpio.h
  • GPIO_PINS_5 : at32f413_gpio.h
  • GPIO_PINS_6 : at32f413_gpio.h
  • GPIO_PINS_7 : at32f413_gpio.h
  • GPIO_PINS_8 : at32f413_gpio.h
  • GPIO_PINS_9 : at32f413_gpio.h
  • GPIO_PINS_ALL : at32f413_gpio.h
  • GPIO_PINS_SOURCE0 : at32f413_gpio.h
  • GPIO_PINS_SOURCE1 : at32f413_gpio.h
  • GPIO_PINS_SOURCE10 : at32f413_gpio.h
  • GPIO_PINS_SOURCE11 : at32f413_gpio.h
  • GPIO_PINS_SOURCE12 : at32f413_gpio.h
  • GPIO_PINS_SOURCE13 : at32f413_gpio.h
  • GPIO_PINS_SOURCE14 : at32f413_gpio.h
  • GPIO_PINS_SOURCE15 : at32f413_gpio.h
  • GPIO_PINS_SOURCE2 : at32f413_gpio.h
  • GPIO_PINS_SOURCE3 : at32f413_gpio.h
  • GPIO_PINS_SOURCE4 : at32f413_gpio.h
  • GPIO_PINS_SOURCE5 : at32f413_gpio.h
  • GPIO_PINS_SOURCE6 : at32f413_gpio.h
  • GPIO_PINS_SOURCE7 : at32f413_gpio.h
  • GPIO_PINS_SOURCE8 : at32f413_gpio.h
  • GPIO_PINS_SOURCE9 : at32f413_gpio.h
  • gpio_pins_source_type : at32f413_gpio.h
  • gpio_pins_toggle() : project/at_start_f413/examples/gpio/swjtag_remap/src/main.c
  • GPIO_PORT_SOURCE_GPIOA : at32f413_gpio.h
  • GPIO_PORT_SOURCE_GPIOB : at32f413_gpio.h
  • GPIO_PORT_SOURCE_GPIOC : at32f413_gpio.h
  • GPIO_PORT_SOURCE_GPIOD : at32f413_gpio.h
  • GPIO_PORT_SOURCE_GPIOF : at32f413_gpio.h
  • gpio_port_source_type : at32f413_gpio.h
  • gpio_port_write() : at32f413_gpio.h, at32f413_gpio.c
  • GPIO_PULL_DOWN : at32f413_gpio.h
  • GPIO_PULL_NONE : at32f413_gpio.h
  • gpio_pull_type : at32f413_gpio.h
  • GPIO_PULL_UP : at32f413_gpio.h
  • gpio_reset() : at32f413_gpio.h, at32f413_gpio.c
  • GPIOA : at32f413_gpio.h
  • GPIOA_BASE : at32f413.h
  • GPIOB : at32f413_gpio.h
  • GPIOB_BASE : at32f413.h
  • GPIOC : at32f413_gpio.h
  • GPIOC_BASE : at32f413.h
  • GPIOD : at32f413_gpio.h
  • GPIOD_BASE : at32f413.h
  • GPIOF : at32f413_gpio.h
  • GPIOF_BASE : at32f413.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- h -

  • HardFault_Handler() : project/at_start_f413/examples/acc/calibration/inc/at32f413_int.h, project/at_start_f413/examples/acc/calibration/src/at32f413_int.c, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_int.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/at32f413_int.c, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_int.h, project/at_start_f413/examples/adc/current_vref_value_check/src/at32f413_int.c, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_int.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/src/at32f413_int.c, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_int.h, project/at_start_f413/examples/adc/internal_temperature_sensor/src/at32f413_int.c, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_int.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/at32f413_int.c, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_int.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/at32f413_int.c, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_int.h, project/at_start_f413/examples/adc/voltage_monitoring/src/at32f413_int.c, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_int.h, project/at_start_f413/examples/bpr/bpr_data/src/at32f413_int.c, project/at_start_f413/examples/bpr/tamper/inc/at32f413_int.h, project/at_start_f413/examples/bpr/tamper/src/at32f413_int.c, project/at_start_f413/examples/can/communication_mode/inc/at32f413_int.h, project/at_start_f413/examples/can/communication_mode/src/at32f413_int.c, project/at_start_f413/examples/can/filter/inc/at32f413_int.h, project/at_start_f413/examples/can/filter/src/at32f413_int.c, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_int.h, project/at_start_f413/examples/can/loopback_mode/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/bit_band/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/fpu/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_int.c, project/at_start_f413/examples/crc/calculation/inc/at32f413_int.h, project/at_start_f413/examples/crc/calculation/src/at32f413_int.c, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_int.h, project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_int.c, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_int.h, project/at_start_f413/examples/crm/sysclk_switch/src/at32f413_int.c, project/at_start_f413/examples/debug/tmr1/inc/at32f413_int.h, project/at_start_f413/examples/debug/tmr1/src/at32f413_int.c, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_int.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/src/at32f413_int.c, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_int.h, project/at_start_f413/examples/dma/flash_to_sram/src/at32f413_int.c, project/at_start_f413/examples/exint/exint_config/inc/at32f413_int.h, project/at_start_f413/examples/exint/exint_config/src/at32f413_int.c, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_int.h, project/at_start_f413/examples/exint/exint_software_trigger/src/at32f413_int.c, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_int.h, project/at_start_f413/examples/flash/flash_write_read/src/at32f413_int.c, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_int.h, project/at_start_f413/examples/flash/operate_spim/src/at32f413_int.c, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_int.h, project/at_start_f413/examples/flash/run_in_spim/src/at32f413_int.c, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_int.h, project/at_start_f413/examples/gpio/io_toggle/src/at32f413_int.c, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_int.h, project/at_start_f413/examples/gpio/led_toggle/src/at32f413_int.c, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_int.h, project/at_start_f413/examples/gpio/swjtag_remap/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_poll/src/at32f413_int.c, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_int.h, project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_int.h, project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_int.h, project/at_start_f413/examples/i2s/halfduplex_dma/src/at32f413_int.c, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/src/at32f413_int.c, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_int.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/at32f413_int.c, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_int.h, project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_int.c, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_int.h, project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_int.c, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_int.c, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_int.h, project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_int.h, project/at_start_f413/examples/pwc/standby_rtc/src/at32f413_int.c, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_int.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/src/at32f413_int.c, project/at_start_f413/examples/rtc/calendar/inc/at32f413_int.h, project/at_start_f413/examples/rtc/calendar/src/at32f413_int.c, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_int.h, project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_int.h, project/at_start_f413/examples/sdio/emmc_card/src/at32f413_int.c, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_int.h, project/at_start_f413/examples/sdio/sd_mmc_card/src/at32f413_int.c, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_int.h, project/at_start_f413/examples/sdio/sdio_fatfs/src/at32f413_int.c, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/crc_transfer_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_int.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/at32f413_int.c, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/fullduplex_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_interrupt/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/at32f413_int.c, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/only_receive_mode_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_int.h, project/at_start_f413/examples/spi/w25q_flash/src/at32f413_int.c, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_int.h, project/at_start_f413/examples/tmr/6_steps/src/at32f413_int.c, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_int.h, project/at_start_f413/examples/tmr/7_pwm_output/src/at32f413_int.c, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/cascade_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_int.h, project/at_start_f413/examples/tmr/complementary_signals/src/at32f413_int.c, project/at_start_f413/examples/tmr/dma/inc/at32f413_int.h, project/at_start_f413/examples/tmr/dma/src/at32f413_int.c, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_int.h, project/at_start_f413/examples/tmr/dma_burst/src/at32f413_int.c, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/tmr/encoder_tmr2/src/at32f413_int.c, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_int.h, project/at_start_f413/examples/tmr/external_clock/src/at32f413_int.c, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/src/at32f413_int.c, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_int.h, project/at_start_f413/examples/tmr/hang_mode/src/at32f413_int.c, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_int.h, project/at_start_f413/examples/tmr/input_capture/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_high/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_low/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_int.h, project/at_start_f413/examples/tmr/one_cycle/src/at32f413_int.c, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/parallel_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_input_dma/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_int.h, project/at_start_f413/examples/tmr/timer_base/src/at32f413_int.c, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/tmr1_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_int.h, project/at_start_f413/examples/tmr/tmr2_32bit/src/at32f413_int.c, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_int.h, project/at_start_f413/examples/usart/half_duplex/src/at32f413_int.c, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_int.h, project/at_start_f413/examples/usart/hw_flow_control/src/at32f413_int.c, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_int.h, project/at_start_f413/examples/usart/idle_detection/src/at32f413_int.c, project/at_start_f413/examples/usart/interrupt/inc/at32f413_int.h, project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/irda/inc/at32f413_int.h, project/at_start_f413/examples/usart/irda/src/at32f413_int.c, project/at_start_f413/examples/usart/polling/inc/at32f413_int.h, project/at_start_f413/examples/usart/polling/src/at32f413_int.c, project/at_start_f413/examples/usart/printf/inc/at32f413_int.h, project/at_start_f413/examples/usart/printf/src/at32f413_int.c, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_int.h, project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c, project/at_start_f413/examples/usart/rs485/inc/at32f413_int.h, project/at_start_f413/examples/usart/rs485/src/at32f413_int.c, project/at_start_f413/examples/usart/smartcard/inc/at32f413_int.h, project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c, project/at_start_f413/examples/usart/synchronous/inc/at32f413_int.h, project/at_start_f413/examples/usart/synchronous/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_int.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/src/at32f413_int.c, project/at_start_f413/examples/usb_device/audio/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/audio/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_audio_hid/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/src/at32f413_int.c, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/custom_hid/src/at32f413_int.c, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/keyboard/src/at32f413_int.c, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/mouse/src/at32f413_int.c, project/at_start_f413/examples/usb_device/msc/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/msc/src/at32f413_int.c, project/at_start_f413/examples/usb_device/printer/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/printer/src/at32f413_int.c, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/vcp_loopback/src/at32f413_int.c, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/src/at32f413_int.c, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/winusb/src/at32f413_int.c, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_int.h, project/at_start_f413/examples/wdt/wdt_reset/src/at32f413_int.c, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_int.h, project/at_start_f413/examples/wdt/wdt_standby/src/at32f413_int.c, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_int.h, project/at_start_f413/examples/wwdt/wwdt_reset/src/at32f413_int.c, project/at_start_f413/templates/src/at32f413_int.c, project/at_start_f413/templates/inc/at32f413_int.h, utilities/at32f413_freertos_demo/inc/at32f413_int.h, utilities/at32f413_freertos_demo/src/at32f413_int.c, utilities/at32f413_gen_random_number_demo/inc/at32f413_int.h, utilities/at32f413_gen_random_number_demo/src/at32f413_int.c, utilities/at32f413_slib_demo/project_l0/inc/at32f413_int.h, utilities/at32f413_slib_demo/project_l0/src/at32f413_int.c, utilities/at32f413_slib_demo/project_l1/inc/at32f413_int.h, utilities/at32f413_slib_demo/project_l1/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/src/at32f413_int.c
  • HardFault_IRQn : at32f413.h
  • HBYTE : usb_std.h
  • HEXT_STABLE_DELAY : system_at32f413.h
  • HEXT_STARTUP_TIMEOUT : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • HEXT_VALUE : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • hi2cx : project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_int/src/main.c, project/at_start_f413/examples/i2c/communication_poll/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c, project/at_start_f413/examples/i2c/memory_write/src/main.c, audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • HICK_VALUE : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • HID_CLASS_DESC_HID : audio_hid_desc.h, usb_std.h
  • HID_CLASS_DESC_PHYSICAL : audio_hid_desc.h, usb_std.h
  • HID_CLASS_DESC_REPORT : audio_hid_desc.h, usb_std.h
  • HID_DESCRIPTOR_TYPE : usb_std.h
  • HID_IAP_BUFFER_LEN : hid_iap_class.h
  • hid_iap_class_handler : hid_iap_class.c, hid_iap_class.h
  • hid_iap_desc_handler : hid_iap_desc.c, hid_iap_desc.h
  • HID_INTERFACE_NUMBER : audio_hid_desc.h
  • HID_REPORT_DESC : usb_std.h
  • HID_REPORT_ID_1 : audio_hid_desc.h, custom_hid_desc.h
  • HID_REPORT_ID_2 : audio_hid_desc.h, custom_hid_desc.h
  • HID_REPORT_ID_3 : audio_hid_desc.h, custom_hid_desc.h
  • HID_REPORT_ID_4 : audio_hid_desc.h, custom_hid_desc.h
  • HID_REPORT_ID_5 : audio_hid_desc.h, custom_hid_desc.h
  • HID_REPORT_ID_6 : audio_hid_desc.h, custom_hid_desc.h
  • HID_REQ_GET_IDLE : usb_std.h
  • HID_REQ_GET_PROTOCOL : usb_std.h
  • HID_REQ_GET_REPORT : usb_std.h
  • HID_REQ_SET_IDLE : usb_std.h
  • HID_REQ_SET_PROTOCOL : usb_std.h
  • HID_REQ_SET_REPORT : usb_std.h
  • hid_suspend_flag : project/at_start_f413/examples/usb_device/keyboard/src/main.c, project/at_start_f413/examples/usb_device/mouse/src/main.c
  • HIDIAP_BCD_NUM : hid_iap_desc.h
  • HIDIAP_BINTERVAL_TIME : hid_iap_desc.h
  • HIST_LENGTH : project/at_start_f413/examples/usart/smartcard/src/main.c
  • hw_usart_read_index : project/at_start_f413/examples/usb_device/virtual_comport/src/main.c
  • hw_usart_rx_index : project/at_start_f413/examples/usb_device/virtual_comport/src/main.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- i -

  • I2C1 : at32f413_i2c.h
  • I2C1_BASE : at32f413.h
  • I2C1_ERR_IRQHandler() : project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c
  • I2C1_ERR_IRQn : at32f413.h
  • I2C1_EVT_IRQHandler() : project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c
  • I2C1_EVT_IRQn : at32f413.h
  • I2C1_GMUX_0001 : at32f413_gpio.h
  • I2C1_GMUX_0011 : at32f413_gpio.h
  • I2C1_MUX : at32f413_gpio.h
  • I2C2 : at32f413_i2c.h
  • I2C2_BASE : at32f413.h
  • I2C2_ERR_IRQHandler() : project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c, project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c
  • I2C2_ERR_IRQn : at32f413.h
  • I2C2_EVT_IRQHandler() : project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c, project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c
  • I2C2_EVT_IRQn : at32f413.h
  • I2C2_GMUX_0001 : at32f413_gpio.h
  • I2C2_GMUX_0010 : at32f413_gpio.h
  • I2C2_GMUX_0011 : at32f413_gpio.h
  • i2c_7bit_address_send() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_ack_enable() : at32f413_i2c.h, at32f413_i2c.c
  • I2C_ACKFAIL_FLAG : at32f413_i2c.h
  • I2C_ADDR2_FLAG : at32f413_i2c.h
  • I2C_ADDR7F_FLAG : at32f413_i2c.h
  • I2C_ADDRESS_MODE_10BIT : at32f413_i2c.h
  • I2C_ADDRESS_MODE_7BIT : at32f413_i2c.h
  • i2c_address_mode_type : at32f413_i2c.h
  • I2C_ADDRHF_FLAG : at32f413_i2c.h
  • I2C_ALERTF_FLAG : at32f413_i2c.h
  • I2C_ARLOST_FLAG : at32f413_i2c.h
  • i2c_arp_mode_enable() : at32f413_i2c.h, at32f413_i2c.c
  • I2C_BUSERR_FLAG : at32f413_i2c.h
  • I2C_BUSYF_FLAG : at32f413_i2c.h
  • i2c_clock_stretch_enable() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_config() : i2c_application.c, i2c_application.h
  • I2C_DATA_INT : at32f413_i2c.h
  • i2c_data_receive() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_data_send() : at32f413_i2c.h, at32f413_i2c.c
  • I2C_DEVADDRF_FLAG : at32f413_i2c.h
  • I2C_DIRECTION_RECEIVE : at32f413_i2c.h
  • I2C_DIRECTION_TRANSMIT : at32f413_i2c.h
  • i2c_direction_type : at32f413_i2c.h
  • I2C_DIRF_FLAG : at32f413_i2c.h
  • i2c_dma_config() : i2c_application.c
  • i2c_dma_enable() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_dma_end_transfer_set() : at32f413_i2c.h, at32f413_i2c.c
  • I2C_DMA_MA_RX : i2c_application.h
  • I2C_DMA_MA_TX : i2c_application.h
  • i2c_dma_rx_irq_handler() : i2c_application.c, i2c_application.h
  • I2C_DMA_SLA_RX : i2c_application.h
  • I2C_DMA_SLA_TX : i2c_application.h
  • i2c_dma_tx_irq_handler() : i2c_application.c, i2c_application.h
  • i2c_enable() : at32f413_i2c.h, at32f413_i2c.c
  • I2C_END : i2c_application.c
  • I2C_ERR_ACKFAIL : i2c_application.h
  • I2C_ERR_ADDR : i2c_application.h
  • I2C_ERR_ADDR10 : i2c_application.h
  • I2C_ERR_INT : at32f413_i2c.h
  • I2C_ERR_INTERRUPT : i2c_application.h
  • i2c_err_irq_handler() : i2c_application.c, i2c_application.h
  • I2C_ERR_START : i2c_application.h
  • I2C_ERR_STEP_1 : i2c_application.h
  • I2C_ERR_STEP_10 : i2c_application.h
  • I2C_ERR_STEP_11 : i2c_application.h
  • I2C_ERR_STEP_12 : i2c_application.h
  • I2C_ERR_STEP_2 : i2c_application.h
  • I2C_ERR_STEP_3 : i2c_application.h
  • I2C_ERR_STEP_4 : i2c_application.h
  • I2C_ERR_STEP_5 : i2c_application.h
  • I2C_ERR_STEP_6 : i2c_application.h
  • I2C_ERR_STEP_7 : i2c_application.h
  • I2C_ERR_STEP_8 : i2c_application.h
  • I2C_ERR_STEP_9 : i2c_application.h
  • I2C_ERR_STOP : i2c_application.h
  • I2C_ERR_TIMEOUT : i2c_application.h
  • I2C_EVENT_CHECK_ACKFAIL : i2c_application.h
  • I2C_EVENT_CHECK_NONE : i2c_application.h
  • I2C_EVENT_CHECK_STOP : i2c_application.h
  • I2C_EVT_INT : at32f413_i2c.h
  • i2c_evt_irq_handler() : i2c_application.c, i2c_application.h
  • i2c_fast_mode_duty_set() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_flag_clear() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_flag_get() : at32f413_i2c.h, at32f413_i2c.c
  • I2C_FSMODE_DUTY_16_9 : at32f413_i2c.h
  • I2C_FSMODE_DUTY_2_1 : at32f413_i2c.h
  • i2c_fsmode_duty_cycle_type : at32f413_i2c.h
  • I2C_GCADDRF_FLAG : at32f413_i2c.h
  • i2c_general_call_enable() : at32f413_i2c.h, at32f413_i2c.c
  • I2C_HOSTADDRF_FLAG : at32f413_i2c.h
  • i2c_init() : at32f413_i2c.h, at32f413_i2c.c
  • I2C_INT_MA_RX : i2c_application.h
  • I2C_INT_MA_TX : i2c_application.h
  • I2C_INT_SLA_RX : i2c_application.h
  • I2C_INT_SLA_TX : i2c_application.h
  • i2c_interrupt_enable() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_interrupt_flag_get() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_lowlevel_init() : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/communication_int/src/main.c, project/at_start_f413/examples/i2c/communication_poll/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c, audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c, i2c_application.c, i2c_application.h
  • I2C_MASTER_ACK_CURRENT : at32f413_i2c.h
  • I2C_MASTER_ACK_NEXT : at32f413_i2c.h
  • i2c_master_ack_type : at32f413_i2c.h
  • i2c_master_read_addr() : i2c_application.c
  • i2c_master_receive() : i2c_application.c, i2c_application.h
  • i2c_master_receive_ack_set() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_master_receive_dma() : i2c_application.c, i2c_application.h
  • i2c_master_receive_int() : i2c_application.c, i2c_application.h
  • i2c_master_rx_isr_int() : i2c_application.c
  • i2c_master_transmit() : i2c_application.c, i2c_application.h
  • i2c_master_transmit_dma() : i2c_application.c, i2c_application.h
  • i2c_master_transmit_int() : i2c_application.c, i2c_application.h
  • i2c_master_tx_isr_dma() : i2c_application.c
  • i2c_master_tx_isr_int() : i2c_application.c
  • i2c_master_write_addr() : i2c_application.c
  • I2C_MEM_ADDR_WIDIH_16 : i2c_application.h
  • I2C_MEM_ADDR_WIDIH_8 : i2c_application.h
  • i2c_mem_address_width_type : i2c_application.h
  • i2c_memory_address_send() : i2c_application.c
  • i2c_memory_read() : i2c_application.c, i2c_application.h
  • i2c_memory_read_dma() : i2c_application.c, i2c_application.h
  • i2c_memory_read_int() : i2c_application.c, i2c_application.h
  • i2c_memory_write() : i2c_application.c, i2c_application.h
  • i2c_memory_write_dma() : i2c_application.c, i2c_application.h
  • i2c_memory_write_int() : i2c_application.c, i2c_application.h
  • i2c_mode_type : i2c_application.h
  • I2C_MODULE_ENABLED : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • I2C_OK : i2c_application.h
  • I2C_OUF_FLAG : at32f413_i2c.h
  • i2c_own_address1_set() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_own_address2_enable() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_own_address2_set() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_pec_calculate_enable() : at32f413_i2c.h, at32f413_i2c.c
  • I2C_PEC_POSITION_CURRENT : at32f413_i2c.h
  • I2C_PEC_POSITION_NEXT : at32f413_i2c.h
  • i2c_pec_position_set() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_pec_position_type : at32f413_i2c.h
  • i2c_pec_transmit_enable() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_pec_value_get() : at32f413_i2c.h, at32f413_i2c.c
  • I2C_PECERR_FLAG : at32f413_i2c.h
  • I2C_RDBF_FLAG : at32f413_i2c.h
  • i2c_reset() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_slave_receive() : i2c_application.c, i2c_application.h
  • i2c_slave_receive_dma() : i2c_application.c, i2c_application.h
  • i2c_slave_receive_int() : i2c_application.c, i2c_application.h
  • i2c_slave_rx_isr_int() : i2c_application.c
  • i2c_slave_transmit() : i2c_application.c, i2c_application.h
  • i2c_slave_transmit_dma() : i2c_application.c, i2c_application.h
  • i2c_slave_transmit_int() : i2c_application.c, i2c_application.h
  • i2c_slave_tx_isr_int() : i2c_application.c
  • i2c_slave_tx_rx_isr_dma() : i2c_application.c
  • I2C_SMBUS_ALERT_HIGH : at32f413_i2c.h
  • I2C_SMBUS_ALERT_LOW : at32f413_i2c.h
  • i2c_smbus_alert_set() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_smbus_alert_set_type : at32f413_i2c.h
  • i2c_smbus_enable() : at32f413_i2c.h, at32f413_i2c.c
  • I2C_SMBUS_MODE_DEVICE : at32f413_i2c.h
  • I2C_SMBUS_MODE_HOST : at32f413_i2c.h
  • i2c_smbus_mode_set() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_smbus_mode_set_type : at32f413_i2c.h
  • i2c_software_reset() : at32f413_i2c.h, at32f413_i2c.c
  • I2C_START : i2c_application.c
  • i2c_start_generate() : at32f413_i2c.h, at32f413_i2c.c
  • I2C_STARTF_FLAG : at32f413_i2c.h
  • i2c_status_type : i2c_application.h
  • i2c_stop_generate() : at32f413_i2c.h, at32f413_i2c.c
  • I2C_STOPF_FLAG : at32f413_i2c.h
  • I2C_TDBE_FLAG : at32f413_i2c.h
  • I2C_TDC_FLAG : at32f413_i2c.h
  • I2C_TIMEOUT : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/communication_int/src/main.c, project/at_start_f413/examples/i2c/communication_poll/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c, audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • I2C_TMOUT_FLAG : at32f413_i2c.h
  • I2C_TRMODE_FLAG : at32f413_i2c.h
  • i2c_wait_end() : i2c_application.c, i2c_application.h
  • i2c_wait_flag() : i2c_application.c, i2c_application.h
  • I2Cx_ADDRESS : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/communication_int/src/main.c, project/at_start_f413/examples/i2c/communication_poll/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c, audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • I2Cx_CLK : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/communication_int/src/main.c, project/at_start_f413/examples/i2c/communication_poll/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c, audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • I2Cx_DMA_CLK : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c
  • I2Cx_DMA_RX_CHANNEL : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c
  • I2Cx_DMA_RX_IRQHandler : project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c, project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c, project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c
  • I2Cx_DMA_RX_IRQn : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c
  • I2Cx_DMA_TX_CHANNEL : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c
  • I2Cx_DMA_TX_IRQHandler : project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c, project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c, project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c
  • I2Cx_DMA_TX_IRQn : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c
  • I2Cx_ERR_IRQHandler : project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c, project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c, project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c
  • I2Cx_ERR_IRQn : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/communication_int/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c
  • I2Cx_EVT_IRQHandler : project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c, project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c, project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c
  • I2Cx_EVT_IRQn : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/communication_int/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c
  • I2Cx_PORT : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/communication_int/src/main.c, project/at_start_f413/examples/i2c/communication_poll/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c, audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • I2Cx_SCL_GPIO_CLK : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/communication_int/src/main.c, project/at_start_f413/examples/i2c/communication_poll/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c, audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • I2Cx_SCL_GPIO_PORT : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/communication_int/src/main.c, project/at_start_f413/examples/i2c/communication_poll/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c, audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • I2Cx_SCL_PIN : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/communication_int/src/main.c, project/at_start_f413/examples/i2c/communication_poll/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c, audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • I2Cx_SDA_GPIO_CLK : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/communication_int/src/main.c, project/at_start_f413/examples/i2c/communication_poll/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c, audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • I2Cx_SDA_GPIO_PORT : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/communication_int/src/main.c, project/at_start_f413/examples/i2c/communication_poll/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c, audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • I2Cx_SDA_PIN : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/communication_int/src/main.c, project/at_start_f413/examples/i2c/communication_poll/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c, audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • I2Cx_SPEED : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/communication_int/src/main.c, project/at_start_f413/examples/i2c/communication_poll/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c, audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • i2s1_buffer_tx : project/at_start_f413/examples/i2s/halfduplex_dma/src/main.c, project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c
  • I2S1_CK_PIN : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • I2S1_DT_ADDRESS : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • I2S1_GPIO : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • I2S1_GPIO_CRM_CLK : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • I2S1_SD_PIN : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • I2S1_WS_PIN : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • i2s2_buffer_rx : project/at_start_f413/examples/i2s/halfduplex_dma/src/main.c, project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c
  • I2S2_CK_PIN : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • I2S2_DT_ADDRESS : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • I2S2_GPIO : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • I2S2_GPIO_CRM_CLK : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • I2S2_SD_PIN : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • I2S2_WS_PIN : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • I2S_ACS_FLAG : at32f413_spi.h
  • I2S_AUDIO_FREQUENCY_11_025K : at32f413_spi.h
  • I2S_AUDIO_FREQUENCY_16K : at32f413_spi.h
  • I2S_AUDIO_FREQUENCY_192K : at32f413_spi.h
  • I2S_AUDIO_FREQUENCY_22_05K : at32f413_spi.h
  • I2S_AUDIO_FREQUENCY_32K : at32f413_spi.h
  • I2S_AUDIO_FREQUENCY_44_1K : at32f413_spi.h
  • I2S_AUDIO_FREQUENCY_48K : at32f413_spi.h
  • I2S_AUDIO_FREQUENCY_8K : at32f413_spi.h
  • I2S_AUDIO_FREQUENCY_96K : at32f413_spi.h
  • I2S_AUDIO_FREQUENCY_DEFAULT : at32f413_spi.h
  • I2S_AUDIO_PROTOCOL_LSB : at32f413_spi.h
  • I2S_AUDIO_PROTOCOL_MSB : at32f413_spi.h
  • I2S_AUDIO_PROTOCOL_PCM_LONG : at32f413_spi.h
  • I2S_AUDIO_PROTOCOL_PCM_SHORT : at32f413_spi.h
  • I2S_AUDIO_PROTOCOL_PHILLIPS : at32f413_spi.h
  • i2s_audio_protocol_type : at32f413_spi.h
  • i2s_audio_sampling_freq_type : at32f413_spi.h
  • I2S_CLOCK_POLARITY_HIGH : at32f413_spi.h
  • I2S_CLOCK_POLARITY_LOW : at32f413_spi.h
  • i2s_clock_polarity_type : at32f413_spi.h
  • i2s_config() : project/at_start_f413/examples/i2s/halfduplex_dma/src/main.c, project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c
  • I2S_DATA_16BIT_CHANNEL_16BIT : at32f413_spi.h
  • I2S_DATA_16BIT_CHANNEL_32BIT : at32f413_spi.h
  • I2S_DATA_24BIT_CHANNEL_32BIT : at32f413_spi.h
  • I2S_DATA_32BIT_CHANNEL_32BIT : at32f413_spi.h
  • i2s_data_channel_format_type : at32f413_spi.h
  • i2s_default_para_init() : at32f413_spi.h, at32f413_spi.c
  • i2s_enable() : at32f413_spi.h, at32f413_spi.c
  • i2s_init() : at32f413_spi.h, at32f413_spi.c
  • I2S_MODE_MASTER_RX : at32f413_spi.h
  • I2S_MODE_MASTER_TX : at32f413_spi.h
  • I2S_MODE_SLAVE_RX : at32f413_spi.h
  • I2S_MODE_SLAVE_TX : at32f413_spi.h
  • i2s_operation_mode_type : at32f413_spi.h
  • I2S_TUERR_FLAG : at32f413_spi.h
  • IAP_ACK : hid_iap_class.h
  • iap_address() : bootloader/src/hid_iap_user.c
  • iap_clear_upgrade_flag() : app_led3_toggle/src/hid_iap_user.c, app_led4_toggle/src/hid_iap_user.c, bootloader/src/hid_iap_user.c
  • IAP_CMD_ADDR : hid_iap_class.h
  • IAP_CMD_CRC : hid_iap_class.h
  • IAP_CMD_DATA : hid_iap_class.h
  • IAP_CMD_FINISH : hid_iap_class.h
  • IAP_CMD_GET : hid_iap_class.h
  • IAP_CMD_IDLE : hid_iap_class.h
  • IAP_CMD_JMP : hid_iap_class.h
  • IAP_CMD_START : hid_iap_class.h
  • iap_command_handle() : app_led3_toggle/inc/iap.h, app_led3_toggle/src/iap.c, app_led4_toggle/inc/iap.h, app_led4_toggle/src/iap.c
  • iap_crc() : bootloader/src/hid_iap_user.c
  • iap_data_write() : bootloader/src/hid_iap_user.c
  • iap_erase_sector() : bootloader/src/hid_iap_user.c
  • IAP_FAILED : flash_fat16.h, hid_iap_class.h
  • iap_finish() : app_led3_toggle/src/hid_iap_user.c, app_led4_toggle/src/hid_iap_user.c, bootloader/src/hid_iap_user.c
  • iap_flag : app_led3_toggle/inc/usart.h, app_led3_toggle/src/usart.c, app_led4_toggle/inc/usart.h, app_led4_toggle/src/usart.c
  • iap_get() : app_led3_toggle/src/hid_iap_user.c, app_led4_toggle/src/hid_iap_user.c, bootloader/src/hid_iap_user.c
  • iap_get_upgrade_flag() : app_led3_toggle/inc/hid_iap_user.h, app_led3_toggle/src/hid_iap_user.c, app_led4_toggle/inc/hid_iap_user.h, app_led4_toggle/src/hid_iap_user.c, bootloader/inc/hid_iap_user.h, bootloader/src/hid_iap_user.c
  • iap_idle() : app_led3_toggle/src/hid_iap_user.c, app_led4_toggle/src/hid_iap_user.c, bootloader/src/hid_iap_user.c
  • iap_info : hid_iap_class.c, hid_iap_class.h
  • iap_init() : app_led3_toggle/inc/iap.h, app_led3_toggle/src/iap.c, app_led4_toggle/inc/iap.h, app_led4_toggle/src/iap.c, app_led3_toggle/inc/hid_iap_user.h, app_led3_toggle/src/hid_iap_user.c, app_led4_toggle/inc/hid_iap_user.h, app_led4_toggle/src/hid_iap_user.c, bootloader/inc/hid_iap_user.h, bootloader/src/hid_iap_user.c
  • iap_jump() : app_led3_toggle/src/hid_iap_user.c, app_led4_toggle/src/hid_iap_user.c, bootloader/src/hid_iap_user.c
  • iap_loop() : bootloader/inc/hid_iap_user.h, bootloader/src/hid_iap_user.c
  • iap_machine_state_type : hid_iap_class.h
  • IAP_NACK : hid_iap_class.h
  • iap_respond() : app_led3_toggle/src/hid_iap_user.c, app_led4_toggle/src/hid_iap_user.c, bootloader/src/hid_iap_user.c
  • iap_result_type : hid_iap_class.h
  • IAP_REV_FLAG_5A : app_led3_toggle/inc/usart.h, app_led4_toggle/inc/usart.h
  • IAP_REV_FLAG_DONE : app_led3_toggle/inc/usart.h, app_led4_toggle/inc/usart.h
  • IAP_REV_FLAG_ERROR : app_led3_toggle/inc/usart.h, app_led4_toggle/inc/usart.h
  • IAP_REV_FLAG_NO : app_led3_toggle/inc/usart.h, app_led4_toggle/inc/usart.h
  • iap_set_upgrade_flag() : app_led3_toggle/src/hid_iap_user.c, app_led4_toggle/src/hid_iap_user.c, bootloader/src/hid_iap_user.c
  • iap_start() : app_led3_toggle/src/hid_iap_user.c, app_led4_toggle/src/hid_iap_user.c, bootloader/src/hid_iap_user.c
  • IAP_STS_ADDR : hid_iap_class.h
  • IAP_STS_CRC : hid_iap_class.h
  • IAP_STS_DATA : hid_iap_class.h
  • IAP_STS_FINISH : hid_iap_class.h
  • IAP_STS_IDLE : hid_iap_class.h
  • IAP_STS_JMP : hid_iap_class.h
  • IAP_STS_JMP_WAIT : hid_iap_class.h
  • IAP_STS_START : hid_iap_class.h
  • IAP_SUCCESS : flash_fat16.h, hid_iap_class.h
  • iap_upgrade_app_handle() : bootloader/inc/iap.h, bootloader/src/iap.c
  • IAP_UPGRADE_COMPLETE_FLAG : flash_fat16.h, hid_iap_class.h
  • IAP_UPGRADE_FLAG : app_led3_toggle/inc/iap.h, app_led4_toggle/inc/iap.h, bootloader/inc/iap.h
  • IAP_UPGRADE_FLAG_ADDR : app_led3_toggle/inc/iap.h, app_led4_toggle/inc/iap.h, bootloader/inc/iap.h
  • IAP_WAIT : hid_iap_class.h
  • iapfun : bootloader/inc/iap.h
  • ic2value : project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c
  • IMG_CONSTANT : julia_fpu.h
  • INCLUDE_uxTaskPriorityGet : FreeRTOSConfig.h
  • INCLUDE_vTaskCleanUpResources : FreeRTOSConfig.h
  • INCLUDE_vTaskDelay : FreeRTOSConfig.h
  • INCLUDE_vTaskDelayUntil : FreeRTOSConfig.h
  • INCLUDE_vTaskDelete : FreeRTOSConfig.h
  • INCLUDE_vTaskPrioritySet : FreeRTOSConfig.h
  • INCLUDE_vTaskSuspend : FreeRTOSConfig.h
  • INCLUDE_xTaskGetCurrentTaskHandle : FreeRTOSConfig.h
  • incrementvar_operationcomplete() : project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c, project/at_start_f413/examples/rtc/lick_calibration/src/main.c
  • INT16 : at32f413.h
  • INT32 : at32f413.h
  • INT8 : at32f413.h
  • INTERNAL_FLASH_LUN : composite_vcp_msc/inc/msc_diskio.h, msc/inc/msc_diskio.h, virtual_msc_iap/inc/msc_diskio.h
  • INVAILD_OFFSET_ADDR : flash_fat16.h
  • INVALID_COMMAND : cdc_msc_class.h, msc_bot_scsi.h
  • INVALID_FIELD_IN_PARAMETER_LIST : cdc_msc_class.h, msc_bot_scsi.h
  • INVALID_FIELED_IN_COMMAND : cdc_msc_class.h, msc_bot_scsi.h
  • IOMUX : at32f413_gpio.h
  • IOMUX_BASE : at32f413.h
  • IOMUX_MAKE_VALUE : at32f413_gpio.h
  • IRQn : at32f413.h
  • IRQn_Type : at32f413.h
  • is_leap_year() : rtc.c
  • ITERATION : julia_fpu.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- j -

  • jump_to_app : bootloader/src/iap.c, project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c, bootloader/inc/hid_iap_user.h, bootloader/src/hid_iap_user.c
  • jumpaddr : project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c, bootloader/src/hid_iap_user.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- k -

  • KB_TO_B : hid_iap_class.h
  • KEYBOARD_BCD_NUM : keyboard_desc.h
  • KEYBOARD_BINTERVAL_TIME : keyboard_desc.h
  • keyboard_class_handler : keyboard_class.c, keyboard_class.h
  • keyboard_class_setup_handler() : cdc_keyboard_class.c
  • keyboard_desc_handler : keyboard_desc.c, keyboard_desc.h
  • keyboard_send_string() : project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/main.c, project/at_start_f413/examples/usb_device/keyboard/src/main.c
  • keyboard_struct : keyboard_class.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- l -

  • langid_descriptor : audio_desc.c, audio_hid_desc.c, cdc_desc.c, cdc_keyboard_desc.c, cdc_msc_desc.c, custom_hid_desc.c, hid_iap_desc.c, keyboard_desc.c, mouse_desc.c, msc_desc.c, printer_desc.c, winusb_desc.c
  • LBYTE : usb_std.h
  • LED2 : at32f413_board.h
  • led2_handler : utilities/at32f413_freertos_demo/src/main.c
  • led2_task_function() : utilities/at32f413_freertos_demo/src/main.c
  • LED3 : at32f413_board.h
  • led3_handler : utilities/at32f413_freertos_demo/src/main.c
  • led3_task_function() : utilities/at32f413_freertos_demo/src/main.c
  • LED4 : at32f413_board.h
  • led_gpio_crm_clk : at32f413_board.c
  • led_gpio_pin : at32f413_board.c
  • led_gpio_port : at32f413_board.c
  • LED_NUM : at32f413_board.h
  • led_type : at32f413_board.h
  • LEFT_BUTTON : mouse_class.h
  • LEFT_MOVE : mouse_class.h
  • LEXT_VALUE : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • lickfreq : project/at_start_f413/examples/rtc/lick_calibration/src/main.c
  • linecoding : project/at_start_f413/examples/usb_device/virtual_comport/src/main.c, cdc_class.c, cdc_msc_class.c
  • linecoding_vcpkybrd : cdc_keyboard_class.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- m -

  • main() : project/at_start_f413/examples/acc/calibration/src/main.c, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/main.c, project/at_start_f413/examples/adc/current_vref_value_check/src/main.c, project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c, project/at_start_f413/examples/adc/internal_temperature_sensor/src/main.c, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/main.c, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c, project/at_start_f413/examples/adc/voltage_monitoring/src/main.c, project/at_start_f413/examples/bpr/bpr_data/src/main.c, project/at_start_f413/examples/bpr/tamper/src/main.c, project/at_start_f413/examples/can/communication_mode/src/main.c, project/at_start_f413/examples/can/filter/src/main.c, project/at_start_f413/examples/can/loopback_mode/src/main.c, project/at_start_f413/examples/cortex_m4/bit_band/src/main.c, project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c, project/at_start_f413/examples/cortex_m4/fpu/src/main.c, project/at_start_f413/examples/cortex_m4/systick_interrupt/src/main.c, project/at_start_f413/examples/crc/calculation/src/main.c, project/at_start_f413/examples/crm/clock_failure_detection/src/main.c, project/at_start_f413/examples/crm/sysclk_switch/src/main.c, project/at_start_f413/examples/debug/tmr1/src/main.c, project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c, project/at_start_f413/examples/dma/flash_to_sram/src/main.c, project/at_start_f413/examples/exint/exint_config/src/main.c, project/at_start_f413/examples/exint/exint_software_trigger/src/main.c, project/at_start_f413/examples/flash/flash_write_read/src/main.c, project/at_start_f413/examples/flash/operate_spim/src/main.c, project/at_start_f413/examples/flash/run_in_spim/src/main.c, project/at_start_f413/examples/gpio/io_toggle/src/main.c, project/at_start_f413/examples/gpio/led_toggle/src/main.c, project/at_start_f413/examples/gpio/swjtag_remap/src/main.c, project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/communication_int/src/main.c, project/at_start_f413/examples/i2c/communication_poll/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c, project/at_start_f413/examples/i2s/halfduplex_dma/src/main.c, project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c, project/at_start_f413/examples/pwc/deepsleep_rtc/src/main.c, project/at_start_f413/examples/pwc/power_voltage_monitor/src/main.c, project/at_start_f413/examples/pwc/sleep_tmr2/src/main.c, project/at_start_f413/examples/pwc/sleep_usart1/src/main.c, project/at_start_f413/examples/pwc/standby_rtc/src/main.c, project/at_start_f413/examples/pwc/standby_wakeup_pin/src/main.c, project/at_start_f413/examples/rtc/calendar/src/main.c, project/at_start_f413/examples/rtc/lick_calibration/src/main.c, project/at_start_f413/examples/sdio/emmc_card/src/main.c, project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c, project/at_start_f413/examples/sdio/sdio_fatfs/src/main.c, project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/fullduplex_polling/src/main.c, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c, project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c, project/at_start_f413/examples/spi/w25q_flash/src/main.c, project/at_start_f413/examples/tmr/6_steps/src/main.c, project/at_start_f413/examples/tmr/7_pwm_output/src/main.c, project/at_start_f413/examples/tmr/cascade_synchro/src/main.c, project/at_start_f413/examples/tmr/complementary_signals/src/main.c, project/at_start_f413/examples/tmr/dma/src/main.c, project/at_start_f413/examples/tmr/dma_burst/src/main.c, project/at_start_f413/examples/tmr/encoder_tmr2/src/main.c, project/at_start_f413/examples/tmr/external_clock/src/main.c, project/at_start_f413/examples/tmr/hall_xor_tmr2/src/main.c, project/at_start_f413/examples/tmr/hang_mode/src/main.c, project/at_start_f413/examples/tmr/input_capture/src/main.c, project/at_start_f413/examples/tmr/oc_high/src/main.c, project/at_start_f413/examples/tmr/oc_low/src/main.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/main.c, project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/main.c, project/at_start_f413/examples/tmr/one_cycle/src/main.c, project/at_start_f413/examples/tmr/parallel_synchro/src/main.c, project/at_start_f413/examples/tmr/pwm_input/src/main.c, project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c, project/at_start_f413/examples/tmr/pwm_output_simulate/src/main.c, project/at_start_f413/examples/tmr/pwm_output_tmr10/src/main.c, project/at_start_f413/examples/tmr/pwm_output_tmr3/src/main.c, project/at_start_f413/examples/tmr/timer_base/src/main.c, project/at_start_f413/examples/tmr/tmr1_synchro/src/main.c, project/at_start_f413/examples/tmr/tmr2_32bit/src/main.c, project/at_start_f413/examples/usart/half_duplex/src/main.c, project/at_start_f413/examples/usart/hw_flow_control/src/main.c, project/at_start_f413/examples/usart/idle_detection/src/main.c, project/at_start_f413/examples/usart/interrupt/src/main.c, project/at_start_f413/examples/usart/irda/src/main.c, project/at_start_f413/examples/usart/polling/src/main.c, project/at_start_f413/examples/usart/printf/src/main.c, project/at_start_f413/examples/usart/receiver_mute/src/main.c, project/at_start_f413/examples/usart/rs485/src/main.c, project/at_start_f413/examples/usart/smartcard/src/main.c, project/at_start_f413/examples/usart/synchronous/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c, project/at_start_f413/examples/usb_device/audio/src/main.c, project/at_start_f413/examples/usb_device/composite_audio_hid/src/main.c, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/main.c, project/at_start_f413/examples/usb_device/composite_vcp_msc/src/main.c, project/at_start_f413/examples/usb_device/custom_hid/src/main.c, project/at_start_f413/examples/usb_device/keyboard/src/main.c, project/at_start_f413/examples/usb_device/mouse/src/main.c, project/at_start_f413/examples/usb_device/msc/src/main.c, project/at_start_f413/examples/usb_device/printer/src/main.c, project/at_start_f413/examples/usb_device/vcp_loopback/src/main.c, project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c, project/at_start_f413/examples/usb_device/winusb/src/main.c, project/at_start_f413/examples/wdt/wdt_reset/src/main.c, project/at_start_f413/examples/wdt/wdt_standby/src/main.c, project/at_start_f413/examples/wwdt/wwdt_reset/src/main.c, project/at_start_f413/templates/src/main.c, utilities/at32f413_freertos_demo/src/main.c, utilities/at32f413_gen_random_number_demo/src/main.c, utilities/at32f413_slib_demo/project_l0/src/main.c, utilities/at32f413_slib_demo/project_l1/src/main.c, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/main.c, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/main.c, utilities/at32f413_usart_iap_demo/source_code/bootloader/src/main.c, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/main.c, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/main.c, utilities/at32f413_usb_iap_demo/source_code/bootloader/src/main.c
  • MAKE_VALUE : at32f413.h
  • MASTER_BOARD : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/communication_int/src/main.c, project/at_start_f413/examples/i2c/communication_poll/src/main.c
  • MATCH_ID_VAL : project/at_start_f413/examples/usart/receiver_mute/src/main.c
  • MAX : usb_std.h
  • max_marks : project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c
  • mblock_rbuffer : project/at_start_f413/examples/sdio/emmc_card/src/main.c, project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c
  • mblock_tbuffer : project/at_start_f413/examples/sdio/emmc_card/src/main.c, project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c
  • mclk_tmr1_init() : audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • MCU_ID1 : audio_desc.h, audio_hid_desc.h, cdc_desc.h, cdc_keyboard_desc.h, cdc_msc_desc.h, custom_hid_desc.h, hid_iap_desc.h, keyboard_desc.h, mouse_desc.h, msc_desc.h, printer_desc.h, winusb_desc.h
  • MCU_ID2 : audio_desc.h, audio_hid_desc.h, cdc_desc.h, cdc_keyboard_desc.h, cdc_msc_desc.h, custom_hid_desc.h, hid_iap_desc.h, keyboard_desc.h, mouse_desc.h, msc_desc.h, printer_desc.h, winusb_desc.h
  • MCU_ID3 : audio_desc.h, audio_hid_desc.h, cdc_desc.h, cdc_keyboard_desc.h, cdc_msc_desc.h, custom_hid_desc.h, hid_iap_desc.h, keyboard_desc.h, mouse_desc.h, msc_desc.h, printer_desc.h, winusb_desc.h
  • mean : project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c
  • MEDIUM_HAVE_CHANGED : cdc_msc_class.h, msc_bot_scsi.h
  • MEDIUM_NOT_PRESENT : cdc_msc_class.h, msc_bot_scsi.h
  • MemManage_Handler() : project/at_start_f413/examples/acc/calibration/inc/at32f413_int.h, project/at_start_f413/examples/acc/calibration/src/at32f413_int.c, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_int.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/at32f413_int.c, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_int.h, project/at_start_f413/examples/adc/current_vref_value_check/src/at32f413_int.c, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_int.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/src/at32f413_int.c, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_int.h, project/at_start_f413/examples/adc/internal_temperature_sensor/src/at32f413_int.c, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_int.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/at32f413_int.c, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_int.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/at32f413_int.c, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_int.h, project/at_start_f413/examples/adc/voltage_monitoring/src/at32f413_int.c, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_int.h, project/at_start_f413/examples/bpr/bpr_data/src/at32f413_int.c, project/at_start_f413/examples/bpr/tamper/inc/at32f413_int.h, project/at_start_f413/examples/bpr/tamper/src/at32f413_int.c, project/at_start_f413/examples/can/communication_mode/inc/at32f413_int.h, project/at_start_f413/examples/can/communication_mode/src/at32f413_int.c, project/at_start_f413/examples/can/filter/inc/at32f413_int.h, project/at_start_f413/examples/can/filter/src/at32f413_int.c, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_int.h, project/at_start_f413/examples/can/loopback_mode/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/bit_band/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/fpu/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_int.c, project/at_start_f413/examples/crc/calculation/inc/at32f413_int.h, project/at_start_f413/examples/crc/calculation/src/at32f413_int.c, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_int.h, project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_int.c, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_int.h, project/at_start_f413/examples/crm/sysclk_switch/src/at32f413_int.c, project/at_start_f413/examples/debug/tmr1/inc/at32f413_int.h, project/at_start_f413/examples/debug/tmr1/src/at32f413_int.c, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_int.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/src/at32f413_int.c, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_int.h, project/at_start_f413/examples/dma/flash_to_sram/src/at32f413_int.c, project/at_start_f413/examples/exint/exint_config/inc/at32f413_int.h, project/at_start_f413/examples/exint/exint_config/src/at32f413_int.c, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_int.h, project/at_start_f413/examples/exint/exint_software_trigger/src/at32f413_int.c, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_int.h, project/at_start_f413/examples/flash/flash_write_read/src/at32f413_int.c, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_int.h, project/at_start_f413/examples/flash/operate_spim/src/at32f413_int.c, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_int.h, project/at_start_f413/examples/flash/run_in_spim/src/at32f413_int.c, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_int.h, project/at_start_f413/examples/gpio/io_toggle/src/at32f413_int.c, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_int.h, project/at_start_f413/examples/gpio/led_toggle/src/at32f413_int.c, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_int.h, project/at_start_f413/examples/gpio/swjtag_remap/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_poll/src/at32f413_int.c, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_int.h, project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_int.h, project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_int.h, project/at_start_f413/examples/i2s/halfduplex_dma/src/at32f413_int.c, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/src/at32f413_int.c, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_int.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/at32f413_int.c, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_int.h, project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_int.c, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_int.h, project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_int.c, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_int.c, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_int.h, project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_int.h, project/at_start_f413/examples/pwc/standby_rtc/src/at32f413_int.c, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_int.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/src/at32f413_int.c, project/at_start_f413/examples/rtc/calendar/inc/at32f413_int.h, project/at_start_f413/examples/rtc/calendar/src/at32f413_int.c, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_int.h, project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_int.h, project/at_start_f413/examples/sdio/emmc_card/src/at32f413_int.c, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_int.h, project/at_start_f413/examples/sdio/sd_mmc_card/src/at32f413_int.c, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_int.h, project/at_start_f413/examples/sdio/sdio_fatfs/src/at32f413_int.c, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/crc_transfer_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_int.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/at32f413_int.c, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/fullduplex_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_interrupt/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/at32f413_int.c, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/only_receive_mode_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_int.h, project/at_start_f413/examples/spi/w25q_flash/src/at32f413_int.c, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_int.h, project/at_start_f413/examples/tmr/6_steps/src/at32f413_int.c, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_int.h, project/at_start_f413/examples/tmr/7_pwm_output/src/at32f413_int.c, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/cascade_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_int.h, project/at_start_f413/examples/tmr/complementary_signals/src/at32f413_int.c, project/at_start_f413/examples/tmr/dma/inc/at32f413_int.h, project/at_start_f413/examples/tmr/dma/src/at32f413_int.c, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_int.h, project/at_start_f413/examples/tmr/dma_burst/src/at32f413_int.c, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/tmr/encoder_tmr2/src/at32f413_int.c, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_int.h, project/at_start_f413/examples/tmr/external_clock/src/at32f413_int.c, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/src/at32f413_int.c, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_int.h, project/at_start_f413/examples/tmr/hang_mode/src/at32f413_int.c, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_int.h, project/at_start_f413/examples/tmr/input_capture/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_high/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_low/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_int.h, project/at_start_f413/examples/tmr/one_cycle/src/at32f413_int.c, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/parallel_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_input_dma/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_int.h, project/at_start_f413/examples/tmr/timer_base/src/at32f413_int.c, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/tmr1_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_int.h, project/at_start_f413/examples/tmr/tmr2_32bit/src/at32f413_int.c, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_int.h, project/at_start_f413/examples/usart/half_duplex/src/at32f413_int.c, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_int.h, project/at_start_f413/examples/usart/hw_flow_control/src/at32f413_int.c, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_int.h, project/at_start_f413/examples/usart/idle_detection/src/at32f413_int.c, project/at_start_f413/examples/usart/interrupt/inc/at32f413_int.h, project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/irda/inc/at32f413_int.h, project/at_start_f413/examples/usart/irda/src/at32f413_int.c, project/at_start_f413/examples/usart/polling/inc/at32f413_int.h, project/at_start_f413/examples/usart/polling/src/at32f413_int.c, project/at_start_f413/examples/usart/printf/inc/at32f413_int.h, project/at_start_f413/examples/usart/printf/src/at32f413_int.c, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_int.h, project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c, project/at_start_f413/examples/usart/rs485/inc/at32f413_int.h, project/at_start_f413/examples/usart/rs485/src/at32f413_int.c, project/at_start_f413/examples/usart/smartcard/inc/at32f413_int.h, project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c, project/at_start_f413/examples/usart/synchronous/inc/at32f413_int.h, project/at_start_f413/examples/usart/synchronous/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_int.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/src/at32f413_int.c, project/at_start_f413/examples/usb_device/audio/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/audio/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_audio_hid/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/src/at32f413_int.c, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/custom_hid/src/at32f413_int.c, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/keyboard/src/at32f413_int.c, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/mouse/src/at32f413_int.c, project/at_start_f413/examples/usb_device/msc/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/msc/src/at32f413_int.c, project/at_start_f413/examples/usb_device/printer/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/printer/src/at32f413_int.c, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/vcp_loopback/src/at32f413_int.c, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/src/at32f413_int.c, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/winusb/src/at32f413_int.c, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_int.h, project/at_start_f413/examples/wdt/wdt_reset/src/at32f413_int.c, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_int.h, project/at_start_f413/examples/wdt/wdt_standby/src/at32f413_int.c, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_int.h, project/at_start_f413/examples/wwdt/wwdt_reset/src/at32f413_int.c, project/at_start_f413/templates/src/at32f413_int.c, project/at_start_f413/templates/inc/at32f413_int.h, utilities/at32f413_freertos_demo/inc/at32f413_int.h, utilities/at32f413_freertos_demo/src/at32f413_int.c, utilities/at32f413_gen_random_number_demo/inc/at32f413_int.h, utilities/at32f413_gen_random_number_demo/src/at32f413_int.c, utilities/at32f413_slib_demo/project_l0/inc/at32f413_int.h, utilities/at32f413_slib_demo/project_l0/src/at32f413_int.c, utilities/at32f413_slib_demo/project_l1/inc/at32f413_int.h, utilities/at32f413_slib_demo/project_l1/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/src/at32f413_int.c
  • MemoryManagement_IRQn : at32f413.h
  • memset16_buffer() : audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • MIC_BUFFER_SIZE : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • mic_dma_buffer : audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • MIN : usb_std.h
  • min_marks : project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c
  • MISC_MODULE_ENABLED : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • mmc_stream_read() : emmc_card/inc/at32_sdio.h, emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • mmc_stream_test() : project/at_start_f413/examples/sdio/emmc_card/src/main.c, project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c
  • mmc_stream_write() : emmc_card/inc/at32_sdio.h, emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • mmc_switch() : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • MMC_SWITCH_ERROR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • mon_table : rtc.c
  • MOUSE_BCD_NUM : mouse_desc.h
  • MOUSE_BINTERVAL_TIME : mouse_desc.h
  • mouse_class_handler : mouse_class.c, mouse_class.h
  • mouse_desc_handler : mouse_desc.c, mouse_desc.h
  • mouse_struct : mouse_class.c
  • MOVE_STEP : mouse_class.h
  • MS_TICK : project/at_start_f413/examples/cortex_m4/systick_interrupt/src/main.c
  • MSC_BCD_NUM : msc_desc.h
  • MSC_BOT_STATE_ERROR : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_BOT_STATE_IDLE : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_BOT_STATE_RECOVERY : cdc_msc_class.h, msc_bot_scsi.h
  • msc_class_handler : msc_class.c, msc_class.h
  • msc_class_setup_handler() : cdc_msc_class.c
  • MSC_CMD_ALLOW_MEDIUM_REMOVAL : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_CMD_FORMAT_UNIT : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_CMD_INQUIRY : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_CMD_MODE_SENSE10 : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_CMD_MODE_SENSE6 : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_CMD_READ_10 : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_CMD_READ_12 : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_CMD_READ_CAPACITY : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_CMD_READ_FORMAT_CAPACITY : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_CMD_REQUEST_SENSE : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_CMD_START_STOP : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_CMD_TEST_UNIT : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_CMD_VERIFY : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_CMD_WRITE_10 : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_CMD_WRITE_12 : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_CMD_WRITE_VERIFY : cdc_msc_class.h, msc_bot_scsi.h
  • msc_desc_handler : msc_desc.c, msc_desc.h
  • msc_disk_capacity() : composite_vcp_msc/inc/msc_diskio.h, virtual_msc_iap/inc/msc_diskio.h
  • msc_disk_read() : composite_vcp_msc/inc/msc_diskio.h, virtual_msc_iap/inc/msc_diskio.h
  • msc_disk_write() : composite_vcp_msc/inc/msc_diskio.h, virtual_msc_iap/inc/msc_diskio.h
  • msc_flash_size : composite_vcp_msc/src/msc_diskio.c, msc/src/msc_diskio.c
  • MSC_MAX_DATA_BUF_LEN : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_REQ_BO_RESET : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_REQ_GET_MAX_LUN : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_STATE_MACHINE_CMD : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_STATE_MACHINE_DATA_IN : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_STATE_MACHINE_DATA_OUT : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_STATE_MACHINE_FAILED : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_STATE_MACHINE_IDLE : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_STATE_MACHINE_LAST_DATA : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_STATE_MACHINE_SEND_DATA : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_STATE_MACHINE_STATUS : cdc_msc_class.h, msc_bot_scsi.h
  • msc_struct : msc_class.c
  • MSC_SUPPORT_MAX_LUN : cdc_msc_class.h, msc_bot_scsi.h
  • MULTI_BUFFER_SIZE : project/at_start_f413/examples/sdio/emmc_card/src/main.c, project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c
  • my_memset() : arm_fir_init_f32.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- n -

  • NMI_Handler() : project/at_start_f413/examples/acc/calibration/inc/at32f413_int.h, project/at_start_f413/examples/acc/calibration/src/at32f413_int.c, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_int.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/at32f413_int.c, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_int.h, project/at_start_f413/examples/adc/current_vref_value_check/src/at32f413_int.c, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_int.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/src/at32f413_int.c, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_int.h, project/at_start_f413/examples/adc/internal_temperature_sensor/src/at32f413_int.c, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_int.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/at32f413_int.c, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_int.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/at32f413_int.c, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_int.h, project/at_start_f413/examples/adc/voltage_monitoring/src/at32f413_int.c, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_int.h, project/at_start_f413/examples/bpr/bpr_data/src/at32f413_int.c, project/at_start_f413/examples/bpr/tamper/inc/at32f413_int.h, project/at_start_f413/examples/bpr/tamper/src/at32f413_int.c, project/at_start_f413/examples/can/communication_mode/inc/at32f413_int.h, project/at_start_f413/examples/can/communication_mode/src/at32f413_int.c, project/at_start_f413/examples/can/filter/inc/at32f413_int.h, project/at_start_f413/examples/can/filter/src/at32f413_int.c, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_int.h, project/at_start_f413/examples/can/loopback_mode/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/bit_band/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/fpu/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_int.c, project/at_start_f413/examples/crc/calculation/inc/at32f413_int.h, project/at_start_f413/examples/crc/calculation/src/at32f413_int.c, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_int.h, project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_int.c, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_int.h, project/at_start_f413/examples/crm/sysclk_switch/src/at32f413_int.c, project/at_start_f413/examples/debug/tmr1/inc/at32f413_int.h, project/at_start_f413/examples/debug/tmr1/src/at32f413_int.c, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_int.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/src/at32f413_int.c, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_int.h, project/at_start_f413/examples/dma/flash_to_sram/src/at32f413_int.c, project/at_start_f413/examples/exint/exint_config/inc/at32f413_int.h, project/at_start_f413/examples/exint/exint_config/src/at32f413_int.c, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_int.h, project/at_start_f413/examples/exint/exint_software_trigger/src/at32f413_int.c, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_int.h, project/at_start_f413/examples/flash/flash_write_read/src/at32f413_int.c, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_int.h, project/at_start_f413/examples/flash/operate_spim/src/at32f413_int.c, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_int.h, project/at_start_f413/examples/flash/run_in_spim/src/at32f413_int.c, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_int.h, project/at_start_f413/examples/gpio/io_toggle/src/at32f413_int.c, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_int.h, project/at_start_f413/examples/gpio/led_toggle/src/at32f413_int.c, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_int.h, project/at_start_f413/examples/gpio/swjtag_remap/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_poll/src/at32f413_int.c, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_int.h, project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_int.h, project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_int.h, project/at_start_f413/examples/i2s/halfduplex_dma/src/at32f413_int.c, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/src/at32f413_int.c, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_int.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/at32f413_int.c, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_int.h, project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_int.c, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_int.h, project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_int.c, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_int.c, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_int.h, project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_int.h, project/at_start_f413/examples/pwc/standby_rtc/src/at32f413_int.c, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_int.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/src/at32f413_int.c, project/at_start_f413/examples/rtc/calendar/inc/at32f413_int.h, project/at_start_f413/examples/rtc/calendar/src/at32f413_int.c, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_int.h, project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_int.h, project/at_start_f413/examples/sdio/emmc_card/src/at32f413_int.c, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_int.h, project/at_start_f413/examples/sdio/sd_mmc_card/src/at32f413_int.c, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_int.h, project/at_start_f413/examples/sdio/sdio_fatfs/src/at32f413_int.c, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/crc_transfer_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_int.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/at32f413_int.c, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/fullduplex_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_interrupt/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/at32f413_int.c, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/only_receive_mode_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_int.h, project/at_start_f413/examples/spi/w25q_flash/src/at32f413_int.c, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_int.h, project/at_start_f413/examples/tmr/6_steps/src/at32f413_int.c, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_int.h, project/at_start_f413/examples/tmr/7_pwm_output/src/at32f413_int.c, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/cascade_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_int.h, project/at_start_f413/examples/tmr/complementary_signals/src/at32f413_int.c, project/at_start_f413/examples/tmr/dma/inc/at32f413_int.h, project/at_start_f413/examples/tmr/dma/src/at32f413_int.c, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_int.h, project/at_start_f413/examples/tmr/dma_burst/src/at32f413_int.c, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/tmr/encoder_tmr2/src/at32f413_int.c, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_int.h, project/at_start_f413/examples/tmr/external_clock/src/at32f413_int.c, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/src/at32f413_int.c, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_int.h, project/at_start_f413/examples/tmr/hang_mode/src/at32f413_int.c, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_int.h, project/at_start_f413/examples/tmr/input_capture/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_high/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_low/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_int.h, project/at_start_f413/examples/tmr/one_cycle/src/at32f413_int.c, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/parallel_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_input_dma/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_int.h, project/at_start_f413/examples/tmr/timer_base/src/at32f413_int.c, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/tmr1_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_int.h, project/at_start_f413/examples/tmr/tmr2_32bit/src/at32f413_int.c, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_int.h, project/at_start_f413/examples/usart/half_duplex/src/at32f413_int.c, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_int.h, project/at_start_f413/examples/usart/hw_flow_control/src/at32f413_int.c, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_int.h, project/at_start_f413/examples/usart/idle_detection/src/at32f413_int.c, project/at_start_f413/examples/usart/interrupt/inc/at32f413_int.h, project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/irda/inc/at32f413_int.h, project/at_start_f413/examples/usart/irda/src/at32f413_int.c, project/at_start_f413/examples/usart/polling/inc/at32f413_int.h, project/at_start_f413/examples/usart/polling/src/at32f413_int.c, project/at_start_f413/examples/usart/printf/inc/at32f413_int.h, project/at_start_f413/examples/usart/printf/src/at32f413_int.c, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_int.h, project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c, project/at_start_f413/examples/usart/rs485/inc/at32f413_int.h, project/at_start_f413/examples/usart/rs485/src/at32f413_int.c, project/at_start_f413/examples/usart/smartcard/inc/at32f413_int.h, project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c, project/at_start_f413/examples/usart/synchronous/inc/at32f413_int.h, project/at_start_f413/examples/usart/synchronous/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_int.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/src/at32f413_int.c, project/at_start_f413/examples/usb_device/audio/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/audio/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_audio_hid/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/src/at32f413_int.c, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/custom_hid/src/at32f413_int.c, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/keyboard/src/at32f413_int.c, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/mouse/src/at32f413_int.c, project/at_start_f413/examples/usb_device/msc/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/msc/src/at32f413_int.c, project/at_start_f413/examples/usb_device/printer/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/printer/src/at32f413_int.c, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/vcp_loopback/src/at32f413_int.c, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/src/at32f413_int.c, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/winusb/src/at32f413_int.c, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_int.h, project/at_start_f413/examples/wdt/wdt_reset/src/at32f413_int.c, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_int.h, project/at_start_f413/examples/wdt/wdt_standby/src/at32f413_int.c, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_int.h, project/at_start_f413/examples/wwdt/wwdt_reset/src/at32f413_int.c, project/at_start_f413/templates/src/at32f413_int.c, project/at_start_f413/templates/inc/at32f413_int.h, utilities/at32f413_freertos_demo/inc/at32f413_int.h, utilities/at32f413_freertos_demo/src/at32f413_int.c, utilities/at32f413_gen_random_number_demo/inc/at32f413_int.h, utilities/at32f413_gen_random_number_demo/src/at32f413_int.c, utilities/at32f413_slib_demo/project_l0/inc/at32f413_int.h, utilities/at32f413_slib_demo/project_l0/src/at32f413_int.c, utilities/at32f413_slib_demo/project_l1/inc/at32f413_int.h, utilities/at32f413_slib_demo/project_l1/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/src/at32f413_int.c
  • NO_BUTTON : at32f413_board.h
  • NonMaskableInt_IRQn : at32f413.h
  • NULL : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • NUM_TAPS : fir_coefficient.c, fir_filter.c
  • NUMSTUDENTS : project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c
  • numStudents : project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c
  • NUMSUBJECTS : project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c
  • numSubjects : project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c
  • nvic_configuration() : project/at_start_f413/examples/rtc/lick_calibration/src/main.c, project/at_start_f413/examples/sdio/emmc_card/src/main.c, project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c, project/at_start_f413/examples/sdio/sdio_fatfs/src/main.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/main.c, project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/main.c
  • nvic_irq_disable() : at32f413_misc.h, at32f413_misc.c
  • nvic_irq_enable() : at32f413_misc.h, at32f413_misc.c
  • nvic_lowpower_mode_config() : at32f413_misc.h, at32f413_misc.c
  • nvic_lowpower_mode_type : at32f413_misc.h
  • NVIC_LP_SEVONPEND : at32f413_misc.h
  • NVIC_LP_SLEEPDEEP : at32f413_misc.h
  • NVIC_LP_SLEEPONEXIT : at32f413_misc.h
  • NVIC_PRIORITY_GROUP_0 : at32f413_misc.h
  • NVIC_PRIORITY_GROUP_1 : at32f413_misc.h
  • NVIC_PRIORITY_GROUP_2 : at32f413_misc.h
  • NVIC_PRIORITY_GROUP_3 : at32f413_misc.h
  • NVIC_PRIORITY_GROUP_4 : at32f413_misc.h
  • nvic_priority_group_config() : at32f413_misc.h, at32f413_misc.c
  • nvic_priority_group_type : at32f413_misc.h
  • nvic_system_reset() : at32f413_misc.h, at32f413_misc.c
  • nvic_vector_table_set() : at32f413_misc.h, at32f413_misc.c
  • NVIC_VECTTAB_FLASH : at32f413_misc.h
  • NVIC_VECTTAB_RAM : at32f413_misc.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- o -

  • OPERATION_TIMEOUT : at32f413_flash.h
  • operationcomplete : project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c, project/at_start_f413/examples/rtc/lick_calibration/src/main.c
  • ordinary_conversion_times_index : project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c
  • ov_cnt : project/at_start_f413/examples/usb_device/virtual_comport/src/main.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- p -

  • PARAMETER_LIST_LENGTH_ERROR : cdc_msc_class.h, msc_bot_scsi.h
  • PD01_GMUX : at32f413_gpio.h
  • PD01_MUX : at32f413_gpio.h
  • PendSV_Handler() : project/at_start_f413/examples/acc/calibration/inc/at32f413_int.h, project/at_start_f413/examples/acc/calibration/src/at32f413_int.c, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_int.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/at32f413_int.c, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_int.h, project/at_start_f413/examples/adc/current_vref_value_check/src/at32f413_int.c, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_int.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/src/at32f413_int.c, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_int.h, project/at_start_f413/examples/adc/internal_temperature_sensor/src/at32f413_int.c, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_int.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/at32f413_int.c, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_int.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/at32f413_int.c, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_int.h, project/at_start_f413/examples/adc/voltage_monitoring/src/at32f413_int.c, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_int.h, project/at_start_f413/examples/bpr/bpr_data/src/at32f413_int.c, project/at_start_f413/examples/bpr/tamper/inc/at32f413_int.h, project/at_start_f413/examples/bpr/tamper/src/at32f413_int.c, project/at_start_f413/examples/can/communication_mode/inc/at32f413_int.h, project/at_start_f413/examples/can/communication_mode/src/at32f413_int.c, project/at_start_f413/examples/can/filter/inc/at32f413_int.h, project/at_start_f413/examples/can/filter/src/at32f413_int.c, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_int.h, project/at_start_f413/examples/can/loopback_mode/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/bit_band/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/fpu/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_int.c, project/at_start_f413/examples/crc/calculation/inc/at32f413_int.h, project/at_start_f413/examples/crc/calculation/src/at32f413_int.c, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_int.h, project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_int.c, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_int.h, project/at_start_f413/examples/crm/sysclk_switch/src/at32f413_int.c, project/at_start_f413/examples/debug/tmr1/inc/at32f413_int.h, project/at_start_f413/examples/debug/tmr1/src/at32f413_int.c, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_int.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/src/at32f413_int.c, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_int.h, project/at_start_f413/examples/dma/flash_to_sram/src/at32f413_int.c, project/at_start_f413/examples/exint/exint_config/inc/at32f413_int.h, project/at_start_f413/examples/exint/exint_config/src/at32f413_int.c, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_int.h, project/at_start_f413/examples/exint/exint_software_trigger/src/at32f413_int.c, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_int.h, project/at_start_f413/examples/flash/flash_write_read/src/at32f413_int.c, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_int.h, project/at_start_f413/examples/flash/operate_spim/src/at32f413_int.c, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_int.h, project/at_start_f413/examples/flash/run_in_spim/src/at32f413_int.c, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_int.h, project/at_start_f413/examples/gpio/io_toggle/src/at32f413_int.c, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_int.h, project/at_start_f413/examples/gpio/led_toggle/src/at32f413_int.c, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_int.h, project/at_start_f413/examples/gpio/swjtag_remap/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_poll/src/at32f413_int.c, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_int.h, project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_int.h, project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_int.h, project/at_start_f413/examples/i2s/halfduplex_dma/src/at32f413_int.c, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/src/at32f413_int.c, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_int.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/at32f413_int.c, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_int.h, project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_int.c, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_int.h, project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_int.c, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_int.c, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_int.h, project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_int.h, project/at_start_f413/examples/pwc/standby_rtc/src/at32f413_int.c, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_int.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/src/at32f413_int.c, project/at_start_f413/examples/rtc/calendar/inc/at32f413_int.h, project/at_start_f413/examples/rtc/calendar/src/at32f413_int.c, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_int.h, project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_int.h, project/at_start_f413/examples/sdio/emmc_card/src/at32f413_int.c, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_int.h, project/at_start_f413/examples/sdio/sd_mmc_card/src/at32f413_int.c, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_int.h, project/at_start_f413/examples/sdio/sdio_fatfs/src/at32f413_int.c, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/crc_transfer_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_int.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/at32f413_int.c, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/fullduplex_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_interrupt/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/at32f413_int.c, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/only_receive_mode_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_int.h, project/at_start_f413/examples/spi/w25q_flash/src/at32f413_int.c, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_int.h, project/at_start_f413/examples/tmr/6_steps/src/at32f413_int.c, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_int.h, project/at_start_f413/examples/tmr/7_pwm_output/src/at32f413_int.c, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/cascade_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_int.h, project/at_start_f413/examples/tmr/complementary_signals/src/at32f413_int.c, project/at_start_f413/examples/tmr/dma/inc/at32f413_int.h, project/at_start_f413/examples/tmr/dma/src/at32f413_int.c, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_int.h, project/at_start_f413/examples/tmr/dma_burst/src/at32f413_int.c, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/tmr/encoder_tmr2/src/at32f413_int.c, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_int.h, project/at_start_f413/examples/tmr/external_clock/src/at32f413_int.c, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/src/at32f413_int.c, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_int.h, project/at_start_f413/examples/tmr/hang_mode/src/at32f413_int.c, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_int.h, project/at_start_f413/examples/tmr/input_capture/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_high/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_low/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_int.h, project/at_start_f413/examples/tmr/one_cycle/src/at32f413_int.c, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/parallel_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_input_dma/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_int.h, project/at_start_f413/examples/tmr/timer_base/src/at32f413_int.c, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/tmr1_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_int.h, project/at_start_f413/examples/tmr/tmr2_32bit/src/at32f413_int.c, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_int.h, project/at_start_f413/examples/usart/half_duplex/src/at32f413_int.c, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_int.h, project/at_start_f413/examples/usart/hw_flow_control/src/at32f413_int.c, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_int.h, project/at_start_f413/examples/usart/idle_detection/src/at32f413_int.c, project/at_start_f413/examples/usart/interrupt/inc/at32f413_int.h, project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/irda/inc/at32f413_int.h, project/at_start_f413/examples/usart/irda/src/at32f413_int.c, project/at_start_f413/examples/usart/polling/inc/at32f413_int.h, project/at_start_f413/examples/usart/polling/src/at32f413_int.c, project/at_start_f413/examples/usart/printf/inc/at32f413_int.h, project/at_start_f413/examples/usart/printf/src/at32f413_int.c, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_int.h, project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c, project/at_start_f413/examples/usart/rs485/inc/at32f413_int.h, project/at_start_f413/examples/usart/rs485/src/at32f413_int.c, project/at_start_f413/examples/usart/smartcard/inc/at32f413_int.h, project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c, project/at_start_f413/examples/usart/synchronous/inc/at32f413_int.h, project/at_start_f413/examples/usart/synchronous/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_int.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/src/at32f413_int.c, project/at_start_f413/examples/usb_device/audio/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/audio/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_audio_hid/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/src/at32f413_int.c, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/custom_hid/src/at32f413_int.c, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/keyboard/src/at32f413_int.c, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/mouse/src/at32f413_int.c, project/at_start_f413/examples/usb_device/msc/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/msc/src/at32f413_int.c, project/at_start_f413/examples/usb_device/printer/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/printer/src/at32f413_int.c, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/vcp_loopback/src/at32f413_int.c, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/src/at32f413_int.c, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/winusb/src/at32f413_int.c, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_int.h, project/at_start_f413/examples/wdt/wdt_reset/src/at32f413_int.c, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_int.h, project/at_start_f413/examples/wdt/wdt_standby/src/at32f413_int.c, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_int.h, project/at_start_f413/examples/wwdt/wwdt_reset/src/at32f413_int.c, project/at_start_f413/templates/src/at32f413_int.c, project/at_start_f413/templates/inc/at32f413_int.h, utilities/at32f413_freertos_demo/inc/at32f413_int.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_int.h, utilities/at32f413_gen_random_number_demo/src/at32f413_int.c, utilities/at32f413_slib_demo/project_l0/inc/at32f413_int.h, utilities/at32f413_slib_demo/project_l0/src/at32f413_int.c, utilities/at32f413_slib_demo/project_l1/inc/at32f413_int.h, utilities/at32f413_slib_demo/project_l1/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/src/at32f413_int.c
  • PendSV_IRQn : at32f413.h
  • periodvalue : project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c, project/at_start_f413/examples/rtc/lick_calibration/src/main.c
  • PERIPH_BASE : at32f413.h
  • PERIPH_REG : at32f413.h
  • PERIPH_REG_BIT : at32f413.h
  • PERIPHERAL_BASE : project/at_start_f413/examples/cortex_m4/bit_band/src/main.c
  • PERIPHERAL_BITBAND_BASE : project/at_start_f413/examples/cortex_m4/bit_band/src/main.c
  • PERIPHERAL_RESET_BIT : project/at_start_f413/examples/cortex_m4/bit_band/src/main.c
  • PERIPHERAL_SET_BIT : project/at_start_f413/examples/cortex_m4/bit_band/src/main.c
  • pftarget : project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c, app_led3_toggle/src/hid_iap_user.c, app_led4_toggle/src/hid_iap_user.c, bootloader/src/hid_iap_user.c
  • PLL_STABLE_DELAY : system_at32f413.h
  • preempt_conversion_count : project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c
  • preempt_conversion_times_index : project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c
  • preempt_trigger_count : project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c
  • press_mouse : project/at_start_f413/examples/usb_device/mouse/src/main.c
  • PRINT_UART : at32f413_board.h
  • PRINT_UART_CRM_CLK : at32f413_board.h
  • PRINT_UART_TX_GPIO : at32f413_board.h
  • PRINT_UART_TX_GPIO_CRM_CLK : at32f413_board.h
  • PRINT_UART_TX_PIN : at32f413_board.h
  • PRINTER_BCD_NUM : printer_desc.h
  • printer_class_handler : printer_class.c, printer_class.h
  • printer_desc_handler : printer_desc.c, printer_desc.h
  • PRINTER_DEVICE_ID_LEN : printer_class.h
  • PRINTER_PROTOCOL_1284_4 : printer_desc.h
  • PRINTER_PROTOCOL_BI_DIRECTIONAL : printer_desc.h
  • PRINTER_PROTOCOL_UNIDIRECTIONAL : printer_desc.h
  • PRINTER_PROTOCOL_VENDOR_SPECIFIC : printer_desc.h
  • PRINTER_REQ_GET_DEVICE_ID : printer_class.h
  • PRINTER_REQ_GET_PORT_STATUS : printer_class.h
  • PRINTER_REQ_GET_SOFT_RESET : printer_class.h
  • printer_req_type : printer_class.h
  • printer_struct : printer_class.c
  • PROGRAMMING_TIMEOUT : at32f413_flash.h
  • PUTCHAR_PROTOTYPE : at32f413_board.c
  • pvm_exint_config() : project/at_start_f413/examples/pwc/power_voltage_monitor/src/main.c
  • PVM_IRQHandler() : project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_int.c
  • PVM_IRQn : at32f413.h
  • PWC : at32f413_pwc.h
  • PWC_BASE : at32f413.h
  • pwc_battery_powered_domain_access() : at32f413_pwc.h, at32f413_pwc.c
  • pwc_deep_sleep_enter_type : at32f413_pwc.h
  • PWC_DEEP_SLEEP_ENTER_WFE : at32f413_pwc.h
  • PWC_DEEP_SLEEP_ENTER_WFI : at32f413_pwc.h
  • pwc_deep_sleep_mode_enter() : at32f413_pwc.h, at32f413_pwc.c
  • pwc_flag_clear() : at32f413_pwc.h, at32f413_pwc.c
  • pwc_flag_get() : at32f413_pwc.h, at32f413_pwc.c
  • PWC_MODULE_ENABLED : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • pwc_power_voltage_monitor_enable() : at32f413_pwc.h, at32f413_pwc.c
  • pwc_pvm_level_select() : at32f413_pwc.h, at32f413_pwc.c
  • PWC_PVM_OUTPUT_FLAG : at32f413_pwc.h
  • PWC_PVM_VOLTAGE_2V3 : at32f413_pwc.h
  • PWC_PVM_VOLTAGE_2V4 : at32f413_pwc.h
  • PWC_PVM_VOLTAGE_2V5 : at32f413_pwc.h
  • PWC_PVM_VOLTAGE_2V6 : at32f413_pwc.h
  • PWC_PVM_VOLTAGE_2V7 : at32f413_pwc.h
  • PWC_PVM_VOLTAGE_2V8 : at32f413_pwc.h
  • PWC_PVM_VOLTAGE_2V9 : at32f413_pwc.h
  • pwc_pvm_voltage_type : at32f413_pwc.h
  • pwc_reset() : at32f413_pwc.h, at32f413_pwc.c
  • pwc_sleep_enter_type : at32f413_pwc.h
  • PWC_SLEEP_ENTER_WFE : at32f413_pwc.h
  • PWC_SLEEP_ENTER_WFI : at32f413_pwc.h
  • pwc_sleep_mode_enter() : at32f413_pwc.h, at32f413_pwc.c
  • PWC_STANDBY_FLAG : at32f413_pwc.h
  • pwc_standby_mode_enter() : at32f413_pwc.h, at32f413_pwc.c
  • PWC_WAKEUP_FLAG : at32f413_pwc.h
  • PWC_WAKEUP_PIN_1 : at32f413_pwc.h
  • pwc_wakeup_pin_enable() : at32f413_pwc.h, at32f413_pwc.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- r -

  • RAM_BASE : project/at_start_f413/examples/cortex_m4/bit_band/src/main.c
  • RAM_BITBAND_BASE : project/at_start_f413/examples/cortex_m4/bit_band/src/main.c
  • randnum_test() : random.h, random.c
  • rca : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • read_buffer : operate_spim.c
  • REAL_CONSTANT : julia_fpu.h
  • refOutput : project_l0/src/arm_fir_data.c, utilities/at32f413_slib_demo/project_l0/src/main.c, project_l1/src/arm_fir_data.c, utilities/at32f413_slib_demo/project_l1/src/main.c
  • REG16 : at32f413.h
  • REG32 : at32f413.h
  • REG8 : at32f413.h
  • reg_addr_data : audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • report_buf : project/at_start_f413/examples/usb_device/composite_audio_hid/src/main.c, project/at_start_f413/examples/usb_device/custom_hid/src/main.c, project/at_start_f413/examples/usb_device/mouse/src/main.c
  • REQ_SENSE_STANDARD_DATA_LEN : cdc_msc_class.h, msc_bot_scsi.h
  • RESET : at32f413.h
  • Reset_IRQn : at32f413.h
  • result_error() : project/at_start_f413/examples/cortex_m4/bit_band/src/main.c
  • RIGHT_BUTTON : mouse_class.h
  • RIGHT_MOVE : mouse_class.h
  • RS485_BAUDRATE : project/at_start_f413/examples/usart/rs485/src/main.c
  • rs485_buffer_rx : project/at_start_f413/examples/usart/rs485/src/main.c
  • rs485_buffer_rx_cnt : project/at_start_f413/examples/usart/rs485/src/main.c
  • RS485_BUFFER_SIZE : project/at_start_f413/examples/usart/rs485/src/main.c
  • rs485_config() : project/at_start_f413/examples/usart/rs485/src/main.c
  • rs485_send_data() : project/at_start_f413/examples/usart/rs485/src/main.c
  • RTC : at32f413_rtc.h
  • rtc_alarm_clock_set() : rtc.h, rtc.c
  • rtc_alarm_config() : project/at_start_f413/examples/pwc/standby_rtc/src/main.c
  • rtc_alarm_set() : at32f413_rtc.h, at32f413_rtc.c
  • RTC_BASE : at32f413.h
  • RTC_CFGF_FLAG : at32f413_rtc.h
  • rtc_config() : project/at_start_f413/examples/pwc/deepsleep_rtc/src/main.c, project/at_start_f413/examples/pwc/standby_rtc/src/main.c
  • rtc_configuration() : project/at_start_f413/examples/rtc/lick_calibration/src/main.c
  • rtc_counter_get() : at32f413_rtc.h, at32f413_rtc.c
  • rtc_counter_set() : at32f413_rtc.h, at32f413_rtc.c
  • rtc_divider_get() : at32f413_rtc.h, at32f413_rtc.c
  • rtc_divider_set() : at32f413_rtc.h, at32f413_rtc.c
  • rtc_flag_clear() : at32f413_rtc.h, at32f413_rtc.c
  • rtc_flag_get() : at32f413_rtc.h, at32f413_rtc.c
  • rtc_init() : rtc.h, rtc.c
  • rtc_interrupt_enable() : at32f413_rtc.h, at32f413_rtc.c
  • rtc_interrupt_flag_get() : at32f413_rtc.h, at32f413_rtc.c
  • RTC_IRQHandler() : project/at_start_f413/examples/rtc/calendar/src/at32f413_int.c, project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c
  • RTC_IRQn : at32f413.h
  • rtc_lowlevel_counter_get() : at32f413_rtc.c
  • RTC_MODULE_ENABLED : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • RTC_OVF_FLAG : at32f413_rtc.h
  • RTC_OVF_INT : at32f413_rtc.h
  • RTC_TA_FLAG : at32f413_rtc.h
  • RTC_TA_INT : at32f413_rtc.h
  • rtc_time_get() : rtc.h, rtc.c
  • rtc_time_set() : rtc.h, rtc.c
  • RTC_TS_FLAG : at32f413_rtc.h
  • RTC_TS_INT : at32f413_rtc.h
  • RTC_UPDF_FLAG : at32f413_rtc.h
  • rtc_wait_config_finish() : at32f413_rtc.h, at32f413_rtc.c
  • rtc_wait_update_finish() : at32f413_rtc.h, at32f413_rtc.c
  • rtc_week_get() : rtc.c
  • RTCAlarm_IRQHandler() : project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_int.c
  • RTCAlarm_IRQn : at32f413.h
  • rx_buf : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/communication_int/src/main.c, project/at_start_f413/examples/i2c/communication_poll/src/main.c
  • rx_buf1 : project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c
  • rx_buf2 : project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c
  • rx_buf3 : project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c
  • rx_buffer : project/at_start_f413/examples/spi/w25q_flash/src/main.c, project/at_start_f413/examples/usart/hw_flow_control/src/main.c
  • rx_counter : project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c, project/at_start_f413/examples/usart/receiver_mute/src/main.c
  • rx_index : project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c, project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c, project/at_start_f413/examples/spi/fullduplex_polling/src/main.c, project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c, project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- s -

  • s16 : at32f413.h
  • s32 : at32f413.h
  • s8 : at32f413.h
  • SAMPLE_FREQ : audio_desc.h, audio_hid_desc.h
  • SAMPLING_NUM : project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c
  • sblock_rbuffer : project/at_start_f413/examples/sdio/emmc_card/src/main.c, project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c
  • sblock_tbuffer : project/at_start_f413/examples/sdio/emmc_card/src/main.c, project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c
  • sc16 : at32f413.h
  • sc32 : at32f413.h
  • sc8 : at32f413.h
  • SC_3_5V_CLK : smartcard_config.h
  • SC_3_5V_PIN : smartcard_config.h
  • SC_3_5V_PORT : smartcard_config.h
  • sc_a2r_struct : project/at_start_f413/examples/usart/smartcard/src/main.c
  • sc_baud_rate : project/at_start_f413/examples/usart/smartcard/src/main.c
  • sc_clock_freq : project/at_start_f413/examples/usart/smartcard/src/main.c
  • SC_CMDVCC_CLK : smartcard_config.h
  • SC_CMDVCC_PIN : smartcard_config.h
  • SC_CMDVCC_PORT : smartcard_config.h
  • SC_F_DIV_D : project/at_start_f413/examples/usart/smartcard/src/main.c
  • SC_OFF_CLK : smartcard_config.h
  • SC_OFF_EXINT : smartcard_config.h
  • SC_OFF_EXINT_IRQ : smartcard_config.h
  • SC_OFF_PIN : smartcard_config.h
  • SC_OFF_PINSOURCE : smartcard_config.h
  • SC_OFF_PORT : smartcard_config.h
  • SC_OFF_PORTSOURCE : smartcard_config.h
  • SC_RECEIVE_TIMEOUT : project/at_start_f413/examples/usart/smartcard/src/main.c
  • SC_RESET_CLK : smartcard_config.h
  • SC_RESET_PIN : smartcard_config.h
  • SC_RESET_PORT : smartcard_config.h
  • sc_response_decode() : project/at_start_f413/examples/usart/smartcard/src/main.c
  • SC_USART : smartcard_config.h
  • SC_USART_CLK : smartcard_config.h
  • SC_USART_CLK_PIN : smartcard_config.h
  • SC_USART_CLK_PORT : smartcard_config.h
  • SC_USART_DIV_VAL : project/at_start_f413/examples/usart/smartcard/src/main.c
  • SC_USART_GPIO_CLK : smartcard_config.h
  • SC_USART_IRQHandler : smartcard_config.h
  • SC_USART_IRQn : smartcard_config.h
  • SC_USART_TX_PIN : smartcard_config.h
  • SC_USART_TX_PORT : smartcard_config.h
  • sclk_192m_hick_config() : project/at_start_f413/examples/crm/clock_failure_detection/src/main.c
  • sclk_64m_hick_config() : project/at_start_f413/examples/crm/sysclk_switch/src/main.c
  • sclk_96m_hext_config() : project/at_start_f413/examples/crm/sysclk_switch/src/main.c
  • SCLK_FROM_HICK : project/at_start_f413/examples/acc/calibration/src/main.c
  • scr_find() : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • SCREEN_X_SIZE : project/at_start_f413/examples/cortex_m4/fpu/src/main.c
  • SCREEN_Y_SIZE : project/at_start_f413/examples/cortex_m4/fpu/src/main.c
  • scsi_inquiry : composite_vcp_msc/src/msc_diskio.c, msc/src/msc_diskio.c, virtual_msc_iap/src/msc_diskio.c
  • SCSI_INQUIRY_DATA_LENGTH : cdc_msc_class.h, msc_bot_scsi.h
  • SD_0TO7BITS : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_16TO23BITS : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_24TO31BITS : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_8TO15BITS : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_ADDR_MISALIGNED : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_ADDR_OUT_OF_RANGE : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_AKE_SEQ_ERROR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_ALLZERO : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_BLK_LEN_ERR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • sd_block_read() : emmc_card/inc/at32_sdio.h, emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • sd_block_write() : emmc_card/inc/at32_sdio.h, emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • sd_blocks_erase() : emmc_card/inc/at32_sdio.h, emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • sd_bus_wide_enable() : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • SD_CARD_CONTROLLER_ERR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CARD_DISCONNECTED : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CARD_ECC_DISABLED : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CARD_ECC_ERROR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CARD_ERROR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CARD_IDENTIFICATION : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • sd_card_info : emmc_card/inc/at32_sdio.h, emmc_card/src/at32_sdio.c, sd_mmc_card/inc/at32_sdio.h, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/inc/at32_sdio.h, sdio_fatfs/src/at32_sdio.c
  • sd_card_info_get() : emmc_card/inc/at32_sdio.h, emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • sd_card_init() : emmc_card/inc/at32_sdio.h, emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • SD_CARD_LOCKED : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CARD_PROGRAMMING : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h, emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CARD_READY : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CARD_RECEIVING : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h, emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CARD_SENDING : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CARD_STANDBY : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • sd_card_state_type : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CARD_TRANSFER : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CCCC_ERASE : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CCCC_LOCK_UNLOCK : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CCCC_WRITE_PROT : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CHECK_PATTERN : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CID_CSD_OVERWRITE : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_ALL_SEND_CID : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_APP_CMD : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_APP_SD_SET_BUSWIDTH : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_CLR_WRITE_PROT : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_CRC_ERROR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_ERASE : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_ERASE_GRP_END : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_ERASE_GRP_START : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_FAIL : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_FAST_IO : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_GEN_CMD : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_GO_IDLE_STATE : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_GO_INACTIVE_STATE : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_GO_IRQ_STATE : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_HS_BUSTEST_READ : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_HS_BUSTEST_WRITE : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_HS_SEND_EXT_CSD : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_HS_SWITCH : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_LOCK_UNLOCK : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_NO_CMD : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_OUT_OF_RANGE : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_PROG_CID : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_PROG_CSD : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_READ_DAT_UNTIL_STOP : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_READ_MULT_BLOCK : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_READ_SINGLE_BLOCK : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_RSP_TIMEOUT : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SD_APP_CHANGE_SECURE_AREA : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SD_APP_GET_CER_RES1 : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SD_APP_GET_CER_RN2 : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SD_APP_GET_MID : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SD_APP_GET_MKB : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SD_APP_OP_COND : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SD_APP_SECURE_ERASE : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SD_APP_SECURE_READ_MULTIPLE_BLOCK : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SD_APP_SECURE_WRITE_MKB : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SD_APP_SECURE_WRITE_MULTIPLE_BLOCK : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SD_APP_SEND_NUM_WRITE_BLOCKS : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SD_APP_SEND_SCR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SD_APP_SET_CER_RES2 : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SD_APP_SET_CER_RN1 : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SD_APP_SET_CLR_CARD_DETECT : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SD_APP_STAUS : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SD_ERASE_GRP_END : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SD_ERASE_GRP_START : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SDIO_RW_DIRECT : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SDIO_RW_EXTENDED : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SDIO_SEN_OP_COND : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SEL_DESEL_CARD : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SEND_CID : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SEND_CSD : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SEND_OP_COND : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SEND_STATUS : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SEND_WRITE_PROT : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SET_BLOCK_COUNT : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SET_BLOCKLEN : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SET_DSR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SET_REL_ADDR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SET_WRITE_PROT : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_STOP_TRANSMISSION : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_WRITE_DAT_UNTIL_STOP : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_WRITE_MULT_BLOCK : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_WRITE_SINGLE_BLOCK : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_DATA_FAIL : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_DATA_TIMEOUT : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • sd_data_transfer_mode_type : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_DATATIMEOUT : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • sd_deselect_select() : emmc_card/inc/at32_sdio.h, emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • sd_device_mode_set() : emmc_card/inc/at32_sdio.h, emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • sd_dma_config() : emmc_card/inc/at32_sdio.h, emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • SD_ERASE_RESET : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_ERASE_SEQ_ERR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_ERROR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • sd_error_status_type : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_GENERAL_UNKNOWN_ERROR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_HALFFIFO : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_HALFFIFOBYTES : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_HIGH_CAPACITY : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_ILLEGAL_CMD : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • sd_init() : emmc_card/inc/at32_sdio.h, emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • SD_INTERNAL_ERROR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_INVALID_ERASE_PARAM : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_INVALID_PARAMETER : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_INVALID_VOLTRANGE : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • sd_irq_service() : emmc_card/inc/at32_sdio.h, emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • SD_LOCK_UNLOCK_ERROR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_LUN : composite_vcp_msc/inc/msc_diskio.h, msc/inc/msc_diskio.h, virtual_msc_iap/inc/msc_diskio.h
  • SD_MAX_DATA_LENGTH : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_MAX_VOLT_TRIAL : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • sd_memory_card_type : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • sd_mult_blocks_read() : emmc_card/inc/at32_sdio.h, emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • sd_mult_blocks_write() : emmc_card/inc/at32_sdio.h, emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • sd_multiple_blocks_test() : project/at_start_f413/examples/sdio/emmc_card/src/main.c, project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c
  • SD_NOT_CONFIGURED : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_OCR_ADDR_MISALIGNED : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_OCR_ADDR_OUT_OF_RANGE : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_OCR_AKE_SEQ_ERROR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_OCR_BLK_LEN_ERR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_OCR_CARD_CONTROLLER_ERR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_OCR_CARD_ECC_DISABLED : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_OCR_CARD_ECC_ERROR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_OCR_CID_CSD_OVERWRIETE : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_OCR_CMD_CRC_ERROR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_OCR_ERASE_RESET : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_OCR_ERASE_SEQ_ERR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_OCR_ERRORBITS : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_OCR_GENERAL_UNKNOWN_ERROR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_OCR_ILLEGAL_CMD : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_OCR_INVALID_ERASE_PARAM : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_OCR_LOCK_UNLOCK_ERROR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_OCR_STREAM_RD_UNDERRUN : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_OCR_STREAM_WR_OVERRUN : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_OCR_WP_ERASE_SKIP : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_OCR_WR_PROTECT_VIOLATION : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_OK : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • sd_power_off() : emmc_card/inc/at32_sdio.h, emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • sd_power_on() : emmc_card/inc/at32_sdio.h, emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • SD_R5_ERROR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_R5_FUNCTION_NUMBER : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_R5_OUT_OF_RANGE : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_R6_CMD_CRC_ERROR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_R6_GENERAL_UNKNOWN_ERROR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_R6_ILLEGAL_CMD : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • sd_read_disk() : diskio.c
  • SD_REQ_NOT_APPLICABLE : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_REQ_PENDING : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_RX_OVERRUN : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_SDIO_DISABLED : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_SDIO_FUNC_BUSY : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_SDIO_FUNC_ERROR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_SDIO_UNKNOWN_FUNC : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • sd_single_block_test() : project/at_start_f413/examples/sdio/emmc_card/src/main.c, project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c
  • SD_SINGLE_BUS_SUPPORT : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_START_BIT_ERR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • sd_state_get() : emmc_card/inc/at32_sdio.h, emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • sd_status_send() : emmc_card/inc/at32_sdio.h, emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • SD_STD_CAPACITY : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_STREAM_RD_UNDERRUN : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_STREAM_WR_OVERRUN : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • sd_switch() : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • SD_SWITCH_ERROR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • sd_test_error() : project/at_start_f413/examples/sdio/emmc_card/src/main.c, project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c, project/at_start_f413/examples/sdio/sdio_fatfs/src/main.c
  • SD_TRANSFER_DMA_MODE : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_TRANSFER_POLLING_MODE : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_TX_UNDERRUN : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_UNSUPPORTED_FEATURE : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_UNSUPPORTED_HW : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_VOLTAGE_WINDOW_MMC : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_VOLTAGE_WINDOW_SD : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • sd_wide_bus_operation_config() : emmc_card/inc/at32_sdio.h, emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • SD_WIDE_BUS_SUPPORT : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_WP_ERASE_SKIP : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_WR_PROTECT_VIOLATION : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • sd_write_disk() : diskio.c
  • SDIO1_BASE : at32f413.h
  • SDIO1_GMUX_0100 : at32f413_gpio.h
  • SDIO1_GMUX_0101 : at32f413_gpio.h
  • SDIO1_GMUX_0110 : at32f413_gpio.h
  • SDIO1_GMUX_0111 : at32f413_gpio.h
  • SDIO1_IRQHandler() : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • SDIO1_IRQn : at32f413.h
  • SDIO2_IRQHandler() : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • sdio_block_size_type : at32f413_sdio.h
  • sdio_buffer_counter_get() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_bus_width_config() : at32f413_sdio.h, at32f413_sdio.c
  • SDIO_BUS_WIDTH_D1 : at32f413_sdio.h
  • SDIO_BUS_WIDTH_D4 : at32f413_sdio.h
  • SDIO_BUS_WIDTH_D8 : at32f413_sdio.h
  • sdio_bus_width_type : at32f413_sdio.h
  • sdio_clock_bypass() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_clock_config() : at32f413_sdio.h, at32f413_sdio.c
  • SDIO_CLOCK_EDGE_FALLING : at32f413_sdio.h
  • SDIO_CLOCK_EDGE_RISING : at32f413_sdio.h
  • sdio_clock_enable() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_clock_set() : emmc_card/inc/at32_sdio.h, emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • SDIO_CMD0TIMEOUT : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SDIO_CMDCMPL_FLAG : at32f413_sdio.h
  • SDIO_CMDCMPL_INT : at32f413_sdio.h
  • SDIO_CMDFAIL_FLAG : at32f413_sdio.h
  • SDIO_CMDFAIL_INT : at32f413_sdio.h
  • SDIO_CMDRSPCMPL_FLAG : at32f413_sdio.h
  • SDIO_CMDRSPCMPL_INT : at32f413_sdio.h
  • SDIO_CMDTIMEOUT_FLAG : at32f413_sdio.h
  • SDIO_CMDTIMEOUT_INT : at32f413_sdio.h
  • sdio_command_config() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_command_data_send() : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • sdio_command_init_struct : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • sdio_command_response_get() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_command_state_machine_enable() : at32f413_sdio.h, at32f413_sdio.c
  • SDIO_DATA_BLOCK_SIZE_1024B : at32f413_sdio.h
  • SDIO_DATA_BLOCK_SIZE_128B : at32f413_sdio.h
  • SDIO_DATA_BLOCK_SIZE_16384B : at32f413_sdio.h
  • SDIO_DATA_BLOCK_SIZE_16B : at32f413_sdio.h
  • SDIO_DATA_BLOCK_SIZE_1B : at32f413_sdio.h
  • SDIO_DATA_BLOCK_SIZE_2048B : at32f413_sdio.h
  • SDIO_DATA_BLOCK_SIZE_256B : at32f413_sdio.h
  • SDIO_DATA_BLOCK_SIZE_2B : at32f413_sdio.h
  • SDIO_DATA_BLOCK_SIZE_32B : at32f413_sdio.h
  • SDIO_DATA_BLOCK_SIZE_4096B : at32f413_sdio.h
  • SDIO_DATA_BLOCK_SIZE_4B : at32f413_sdio.h
  • SDIO_DATA_BLOCK_SIZE_512B : at32f413_sdio.h
  • SDIO_DATA_BLOCK_SIZE_64B : at32f413_sdio.h
  • SDIO_DATA_BLOCK_SIZE_8192B : at32f413_sdio.h
  • SDIO_DATA_BLOCK_SIZE_8B : at32f413_sdio.h
  • SDIO_DATA_BLOCK_TRANSFER : at32f413_sdio.h
  • sdio_data_config() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_data_counter_get() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_data_init_struct : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • sdio_data_read() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_data_state_machine_enable() : at32f413_sdio.h, at32f413_sdio.c
  • SDIO_DATA_STREAM_TRANSFER : at32f413_sdio.h
  • SDIO_DATA_TRANSFER_TO_CARD : at32f413_sdio.h
  • SDIO_DATA_TRANSFER_TO_CONTROLLER : at32f413_sdio.h
  • sdio_data_write() : at32f413_sdio.h, at32f413_sdio.c
  • SDIO_DATATIMEOUT : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • sdio_dma_enable() : at32f413_sdio.h, at32f413_sdio.c
  • SDIO_DOCMD_FLAG : at32f413_sdio.h
  • SDIO_DOCMD_INT : at32f413_sdio.h
  • SDIO_DORX_FLAG : at32f413_sdio.h
  • SDIO_DORX_INT : at32f413_sdio.h
  • SDIO_DOTX_FLAG : at32f413_sdio.h
  • SDIO_DOTX_INT : at32f413_sdio.h
  • SDIO_DTBLKCMPL_FLAG : at32f413_sdio.h
  • SDIO_DTBLKCMPL_INT : at32f413_sdio.h
  • SDIO_DTCMP_INT : at32f413_sdio.h
  • SDIO_DTCMPL_FLAG : at32f413_sdio.h
  • SDIO_DTFAIL_FLAG : at32f413_sdio.h
  • SDIO_DTFAIL_INT : at32f413_sdio.h
  • SDIO_DTTIMEOUT_FLAG : at32f413_sdio.h
  • SDIO_DTTIMEOUT_INT : at32f413_sdio.h
  • sdio_edge_phase_type : at32f413_sdio.h
  • sdio_flag_clear() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_flag_get() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_flow_control_enable() : at32f413_sdio.h, at32f413_sdio.c
  • SDIO_HIGH_CAPACITY_MMC_CARD : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SDIO_HIGH_CAPACITY_SD_CARD : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SDIO_HIGH_SPEED_MULTIMEDIA_CARD : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • sdio_interrupt_enable() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_interrupt_flag_get() : at32f413_sdio.h, at32f413_sdio.c
  • SDIO_INTR_STS_READ_MASK : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SDIO_INTR_STS_WRITE_MASK : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • sdio_io_function_enable() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_io_suspend_command_set() : at32f413_sdio.h, at32f413_sdio.c
  • SDIO_MODULE_ENABLED : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • SDIO_MULTIMEDIA_CARD : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SDIO_POWER_OFF : at32f413_sdio.h
  • SDIO_POWER_ON : at32f413_sdio.h
  • sdio_power_saving_mode_enable() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_power_set() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_power_state_type : at32f413_sdio.h
  • sdio_power_status_get() : at32f413_sdio.h, at32f413_sdio.c
  • SDIO_READ_WAIT_CONTROLLED_BY_CK : at32f413_sdio.h
  • SDIO_READ_WAIT_CONTROLLED_BY_D2 : at32f413_sdio.h
  • sdio_read_wait_mode_set() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_read_wait_mode_type : at32f413_sdio.h
  • sdio_read_wait_start() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_read_wait_stop() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_reponse_type : at32f413_sdio.h
  • sdio_reset() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_response_get() : at32f413_sdio.h, at32f413_sdio.c
  • SDIO_RESPONSE_LONG : at32f413_sdio.h
  • SDIO_RESPONSE_NO : at32f413_sdio.h
  • SDIO_RESPONSE_SHORT : at32f413_sdio.h
  • SDIO_RSP1_INDEX : at32f413_sdio.h
  • SDIO_RSP2_INDEX : at32f413_sdio.h
  • SDIO_RSP3_INDEX : at32f413_sdio.h
  • SDIO_RSP4_INDEX : at32f413_sdio.h
  • sdio_rsp_index_type : at32f413_sdio.h
  • SDIO_RXBUF_FLAG : at32f413_sdio.h
  • SDIO_RXBUF_INT : at32f413_sdio.h
  • SDIO_RXBUFE_FLAG : at32f413_sdio.h
  • SDIO_RXBUFE_INT : at32f413_sdio.h
  • SDIO_RXBUFF_FLAG : at32f413_sdio.h
  • SDIO_RXBUFF_INT : at32f413_sdio.h
  • SDIO_RXBUFH_FLAG : at32f413_sdio.h
  • SDIO_RXBUFH_INT : at32f413_sdio.h
  • SDIO_RXERRO_FLAG : at32f413_sdio.h
  • SDIO_RXERRO_INT : at32f413_sdio.h
  • SDIO_SBITERR_FLAG : at32f413_sdio.h
  • SDIO_SBITERR_INT : at32f413_sdio.h
  • SDIO_SDIO_CARD : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SDIO_SDIOIF_FLAG : at32f413_sdio.h
  • SDIO_SDIOIF_INT : at32f413_sdio.h
  • SDIO_SECURE_DIGITAL_IO_CARD : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SDIO_SECURE_DIGITAL_IO_COMBO_CARD : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SDIO_SEND_IF_COND : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SDIO_STATIC_FLAGS : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SDIO_STD_CAPACITY_SD_CARD_V1_1 : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SDIO_STD_CAPACITY_SD_CARD_V2_0 : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • sdio_transfer_direction_type : at32f413_sdio.h
  • sdio_transfer_mode_type : at32f413_sdio.h
  • SDIO_TXBUF_FLAG : at32f413_sdio.h
  • SDIO_TXBUF_INT : at32f413_sdio.h
  • SDIO_TXBUFE_FLAG : at32f413_sdio.h
  • SDIO_TXBUFE_INT : at32f413_sdio.h
  • SDIO_TXBUFF_FLAG : at32f413_sdio.h
  • SDIO_TXBUFF_INT : at32f413_sdio.h
  • SDIO_TXBUFH_FLAG : at32f413_sdio.h
  • SDIO_TXBUFH_INT : at32f413_sdio.h
  • SDIO_TXERRU_FLAG : at32f413_sdio.h
  • SDIO_TXERRU_INT : at32f413_sdio.h
  • SDIO_WAIT_FOR_INT : at32f413_sdio.h
  • SDIO_WAIT_FOR_NO : at32f413_sdio.h
  • SDIO_WAIT_FOR_PEND : at32f413_sdio.h
  • sdio_wait_type : at32f413_sdio.h
  • SDIOx : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SECTOR_NUM : utilities/at32f413_slib_demo/project_l0/src/main.c
  • sector_read() : operate_spim.c
  • SECTOR_SIZE : project/at_start_f413/examples/flash/flash_write_read/src/flash.c
  • sector_size : composite_vcp_msc/src/msc_diskio.c, msc/src/msc_diskio.c
  • SECTOR_SIZE_1K : composite_vcp_msc/inc/msc_diskio.h, msc/inc/msc_diskio.h, hid_iap_class.h
  • SECTOR_SIZE_2K : composite_vcp_msc/inc/msc_diskio.h, msc/inc/msc_diskio.h, hid_iap_class.h
  • SECTOR_SIZE_4K : composite_vcp_msc/inc/msc_diskio.h, msc/inc/msc_diskio.h, hid_iap_class.h
  • SECTOR_WORD_CNT : utilities/at32f413_slib_demo/project_l0/src/main.c
  • SENSE_KEY_ABORTED_COMMAND : cdc_msc_class.h, msc_bot_scsi.h
  • SENSE_KEY_BLANK_CHECK : cdc_msc_class.h, msc_bot_scsi.h
  • SENSE_KEY_DATA_PROTECT : cdc_msc_class.h, msc_bot_scsi.h
  • SENSE_KEY_HARDWARE_ERROR : cdc_msc_class.h, msc_bot_scsi.h
  • SENSE_KEY_ILLEGAL_REQUEST : cdc_msc_class.h, msc_bot_scsi.h
  • SENSE_KEY_MEDIUM_ERROR : cdc_msc_class.h, msc_bot_scsi.h
  • SENSE_KEY_MISCOMPARE : cdc_msc_class.h, msc_bot_scsi.h
  • SENSE_KEY_NO_SENSE : cdc_msc_class.h, msc_bot_scsi.h
  • SENSE_KEY_NOT_READY : cdc_msc_class.h, msc_bot_scsi.h
  • SENSE_KEY_RECOVERED_ERROR : cdc_msc_class.h, msc_bot_scsi.h
  • SENSE_KEY_UNIT_ATTENTION : cdc_msc_class.h, msc_bot_scsi.h
  • SENSE_KEY_VENDERO_SPECIFIC : cdc_msc_class.h, msc_bot_scsi.h
  • SENSE_KEY_VOLUME_OVERFLOW : cdc_msc_class.h, msc_bot_scsi.h
  • serial_descriptor : audio_desc.c, audio_hid_desc.c, cdc_desc.c, cdc_keyboard_desc.c, cdc_msc_desc.c, custom_hid_desc.c, hid_iap_desc.c, keyboard_desc.c, mouse_desc.c, msc_desc.c, printer_desc.c, winusb_desc.c
  • SET : at32f413.h
  • SET_LINE_CODING : cdc_msc_class.h, msc_bot_scsi.h, usb_std.h
  • SETUP_LENGTH : project/at_start_f413/examples/usart/smartcard/src/main.c
  • setvar_periodvalue() : project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c, project/at_start_f413/examples/rtc/lick_calibration/src/main.c
  • SHIFT : cdc_keyboard_class.c, keyboard_class.c
  • show_card_info() : project/at_start_f413/examples/sdio/emmc_card/src/main.c, project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c
  • SLIB_DATA_ADDR : utilities/at32f413_slib_demo/project_l0/src/main.c
  • slib_enable() : utilities/at32f413_slib_demo/project_l0/src/main.c
  • SLIB_END_ADDR : utilities/at32f413_slib_demo/project_l0/src/main.c
  • SLIB_START_ADDR : utilities/at32f413_slib_demo/project_l0/src/main.c
  • SLIB_UNLOCK_KEY : at32f413_flash.h
  • SLOW : project/at_start_f413/templates/src/main.c
  • SNR_THRESHOLD_F32 : utilities/at32f413_slib_demo/project_l0/src/main.c, utilities/at32f413_slib_demo/project_l1/src/main.c
  • speed_change() : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • SPI1 : at32f413_spi.h
  • SPI1_AS_MASTER_CS_HIGH : project/at_start_f413/examples/spi/fullduplex_polling/src/main.c
  • SPI1_AS_MASTER_CS_LOW : project/at_start_f413/examples/spi/fullduplex_polling/src/main.c
  • SPI1_BASE : at32f413.h
  • spi1_buffer_tx : project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c
  • SPI1_GMUX_0001 : at32f413_gpio.h
  • SPI1_IRQHandler() : project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c
  • SPI1_IRQn : at32f413.h
  • SPI1_MUX_01 : at32f413_gpio.h
  • spi1_rx_buffer : project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/fullduplex_polling/src/main.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c
  • spi1_tx_buffer : project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/fullduplex_polling/src/main.c, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c, project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c
  • SPI2 : at32f413_spi.h
  • SPI2_AS_MASTER_CS_HIGH : project/at_start_f413/examples/spi/fullduplex_polling/src/main.c
  • SPI2_AS_MASTER_CS_LOW : project/at_start_f413/examples/spi/fullduplex_polling/src/main.c
  • SPI2_BASE : at32f413.h
  • spi2_buffer_rx : project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c
  • SPI2_GMUX_0001 : at32f413_gpio.h
  • SPI2_IRQHandler() : project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c
  • SPI2_IRQn : at32f413.h
  • spi2_rx_buffer : project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/fullduplex_polling/src/main.c, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c, project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c, project/at_start_f413/examples/usart/synchronous/src/main.c
  • spi2_rx_counter : project/at_start_f413/examples/usart/synchronous/src/main.c
  • spi2_tx_buffer : project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/fullduplex_polling/src/main.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c, project/at_start_f413/examples/usart/synchronous/src/main.c
  • SPI2_TX_BUFFER_SIZE : project/at_start_f413/examples/usart/synchronous/src/main.c
  • spi2_tx_buffer_size : project/at_start_f413/examples/usart/synchronous/src/main.c
  • spi2_tx_counter : project/at_start_f413/examples/usart/synchronous/src/main.c
  • spi_byte_read() : spi_flash.h, spi_flash.c
  • spi_byte_write() : spi_flash.h, spi_flash.c
  • spi_bytes_read() : spi_flash.h, spi_flash.c
  • spi_bytes_write() : spi_flash.h, spi_flash.c
  • SPI_CCERR_FLAG : at32f413_spi.h
  • SPI_CLOCK_PHASE_1EDGE : at32f413_spi.h
  • SPI_CLOCK_PHASE_2EDGE : at32f413_spi.h
  • spi_clock_phase_type : at32f413_spi.h
  • SPI_CLOCK_POLARITY_HIGH : at32f413_spi.h
  • SPI_CLOCK_POLARITY_LOW : at32f413_spi.h
  • spi_clock_polarity_type : at32f413_spi.h
  • spi_config() : project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c, project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/fullduplex_polling/src/main.c, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c, project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c
  • spi_crc_direction_type : at32f413_spi.h
  • spi_crc_enable() : at32f413_spi.h, at32f413_spi.c
  • spi_crc_next_transmit() : at32f413_spi.h, at32f413_spi.c
  • spi_crc_polynomial_get() : at32f413_spi.h, at32f413_spi.c
  • spi_crc_polynomial_set() : at32f413_spi.h, at32f413_spi.c
  • SPI_CRC_RX : at32f413_spi.h
  • SPI_CRC_TX : at32f413_spi.h
  • spi_crc_value_get() : at32f413_spi.h, at32f413_spi.c
  • SPI_CS_HARDWARE_MODE : at32f413_spi.h
  • spi_cs_mode_type : at32f413_spi.h
  • SPI_CS_SOFTWARE_MODE : at32f413_spi.h
  • spi_default_para_init() : at32f413_spi.h, at32f413_spi.c
  • spi_enable() : at32f413_spi.h, at32f413_spi.c
  • SPI_FIRST_BIT_LSB : at32f413_spi.h
  • SPI_FIRST_BIT_MSB : at32f413_spi.h
  • spi_first_bit_type : at32f413_spi.h
  • SPI_FLASH_LUN : composite_vcp_msc/inc/msc_diskio.h, msc/inc/msc_diskio.h, virtual_msc_iap/inc/msc_diskio.h
  • SPI_FRAME_16BIT : at32f413_spi.h
  • SPI_FRAME_8BIT : at32f413_spi.h
  • spi_frame_bit_num_set() : at32f413_spi.h, at32f413_spi.c
  • spi_frame_bit_num_type : at32f413_spi.h
  • SPI_HALF_DUPLEX_DIRECTION_RX : at32f413_spi.h
  • spi_half_duplex_direction_set() : at32f413_spi.h, at32f413_spi.c
  • SPI_HALF_DUPLEX_DIRECTION_TX : at32f413_spi.h
  • spi_half_duplex_direction_type : at32f413_spi.h
  • spi_hardware_cs_output_enable() : at32f413_spi.h, at32f413_spi.c
  • SPI_I2S_BF_FLAG : at32f413_spi.h
  • spi_i2s_data_receive() : at32f413_spi.h, at32f413_spi.c
  • spi_i2s_data_transmit() : at32f413_spi.h, at32f413_spi.c
  • spi_i2s_dma_receiver_enable() : at32f413_spi.h, at32f413_spi.c
  • spi_i2s_dma_transmitter_enable() : at32f413_spi.h, at32f413_spi.c
  • SPI_I2S_ERROR_INT : at32f413_spi.h
  • spi_i2s_flag_clear() : at32f413_spi.h, at32f413_spi.c
  • spi_i2s_flag_get() : at32f413_spi.h, at32f413_spi.c
  • spi_i2s_interrupt_enable() : at32f413_spi.h, at32f413_spi.c
  • spi_i2s_interrupt_flag_get() : at32f413_spi.h, at32f413_spi.c
  • SPI_I2S_RDBF_FLAG : at32f413_spi.h
  • SPI_I2S_RDBF_INT : at32f413_spi.h
  • spi_i2s_reset() : at32f413_spi.h, at32f413_spi.c
  • SPI_I2S_ROERR_FLAG : at32f413_spi.h
  • SPI_I2S_TDBE_FLAG : at32f413_spi.h
  • SPI_I2S_TDBE_INT : at32f413_spi.h
  • spi_init() : at32f413_spi.h, at32f413_spi.c
  • spi_init_struct : project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/fullduplex_polling/src/main.c, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c
  • SPI_MASTER_CS_HIGH : project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c, project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c, project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c
  • SPI_MASTER_CS_LOW : project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c, project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c, project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c
  • spi_master_slave_mode_type : at32f413_spi.h
  • SPI_MCLK_DIV_1024 : at32f413_spi.h
  • SPI_MCLK_DIV_128 : at32f413_spi.h
  • SPI_MCLK_DIV_16 : at32f413_spi.h
  • SPI_MCLK_DIV_2 : at32f413_spi.h
  • SPI_MCLK_DIV_256 : at32f413_spi.h
  • SPI_MCLK_DIV_32 : at32f413_spi.h
  • SPI_MCLK_DIV_4 : at32f413_spi.h
  • SPI_MCLK_DIV_512 : at32f413_spi.h
  • SPI_MCLK_DIV_64 : at32f413_spi.h
  • SPI_MCLK_DIV_8 : at32f413_spi.h
  • spi_mclk_freq_div_type : at32f413_spi.h
  • SPI_MMERR_FLAG : at32f413_spi.h
  • SPI_MODE_MASTER : at32f413_spi.h
  • SPI_MODE_SLAVE : at32f413_spi.h
  • SPI_MODULE_ENABLED : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • spi_software_cs_internal_level_set() : at32f413_spi.h, at32f413_spi.c
  • spi_software_cs_level_type : at32f413_spi.h
  • SPI_SWCS_INTERNAL_LEVEL_HIGHT : at32f413_spi.h
  • SPI_SWCS_INTERNAL_LEVEL_LOW : at32f413_spi.h
  • SPI_TRANS_DMA : spi_flash.h
  • spi_transmission_mode_type : at32f413_spi.h
  • SPI_TRANSMIT_FULL_DUPLEX : at32f413_spi.h
  • SPI_TRANSMIT_HALF_DUPLEX_RX : at32f413_spi.h
  • SPI_TRANSMIT_HALF_DUPLEX_TX : at32f413_spi.h
  • SPI_TRANSMIT_SIMPLEX_RX : at32f413_spi.h
  • SPIF_BLOCKERASE : spi_flash.h
  • SPIF_CHIP_SIZE : spi_flash.h
  • SPIF_CHIPERASE : spi_flash.h
  • SPIF_DEVICEID : spi_flash.h
  • SPIF_FASTREADDATA : spi_flash.h
  • SPIF_FASTREADDUAL : spi_flash.h
  • SPIF_JEDECDEVICEID : spi_flash.h
  • SPIF_MANUFACTDEVICEID : spi_flash.h
  • SPIF_PAGE_SIZE : spi_flash.h
  • SPIF_PAGEPROGRAM : spi_flash.h
  • SPIF_POWERDOWN : spi_flash.h
  • SPIF_READDATA : spi_flash.h
  • SPIF_READSTATUSREG1 : spi_flash.h
  • SPIF_READSTATUSREG2 : spi_flash.h
  • SPIF_READSTATUSREG3 : spi_flash.h
  • SPIF_RELEASEPOWERDOWN : spi_flash.h
  • SPIF_SECTOR_SIZE : spi_flash.h
  • SPIF_SECTORERASE : spi_flash.h
  • SPIF_WRITEDISABLE : spi_flash.h
  • SPIF_WRITEENABLE : spi_flash.h
  • SPIF_WRITESTATUSREG1 : spi_flash.h
  • SPIF_WRITESTATUSREG2 : spi_flash.h
  • SPIF_WRITESTATUSREG3 : spi_flash.h
  • spiflash_init() : spi_flash.h, spi_flash.c
  • spiflash_page_write() : spi_flash.h, spi_flash.c
  • spiflash_read() : spi_flash.h, spi_flash.c
  • spiflash_read_id() : spi_flash.h, spi_flash.c
  • spiflash_read_sr1() : spi_flash.h, spi_flash.c
  • spiflash_sector_buf : spi_flash.c
  • spiflash_sector_erase() : spi_flash.h, spi_flash.c
  • spiflash_wait_busy() : spi_flash.h, spi_flash.c
  • spiflash_write() : spi_flash.h, spi_flash.c
  • spiflash_write_enable() : spi_flash.h, spi_flash.c
  • spiflash_write_nocheck() : spi_flash.h, spi_flash.c
  • SPIM_ERASE_TIMEOUT : at32f413_flash.h
  • SPIM_FLASH_BASE : at32f413.h
  • spim_init() : operate_spim.c, project/at_start_f413/examples/flash/run_in_spim/src/main.c
  • spim_operate() : operate_spim.h, operate_spim.c
  • SPIM_PROGRAMMING_TIMEOUT : at32f413_flash.h
  • spim_run() : run_in_spim.h
  • SPIM_SECTOR_SIZE : operate_spim.h
  • SPIM_TEST_ADDR : operate_spim.h
  • SPK_BUFFER_SIZE : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • spk_dma_buffer : audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • SPK_TX_FIFO_SIZE : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • SRAM_BASE : at32f413.h
  • SRAM_SIZE : utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/flash.h
  • src_buffer : project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c, project/at_start_f413/examples/tmr/dma/src/main.c, project/at_start_f413/examples/tmr/dma_burst/src/main.c
  • src_const_buffer : project/at_start_f413/examples/dma/flash_to_sram/src/main.c
  • std : project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c
  • step : project/at_start_f413/examples/tmr/6_steps/src/main.c
  • STEP_DELAY_MS : at32f413_board.c
  • stkptr : project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c, bootloader/src/hid_iap_user.c
  • stop_flag : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • STREAM_BUFFER_SIZE : project/at_start_f413/examples/sdio/emmc_card/src/main.c, project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c
  • stream_rbuffer : project/at_start_f413/examples/sdio/emmc_card/src/main.c, project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c
  • stream_tbuffer : project/at_start_f413/examples/sdio/emmc_card/src/main.c, project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c
  • student_num : project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c
  • sub_tmr_input_sel_type : at32f413_tmr.h
  • SUCCESS : at32f413.h
  • SVC_Handler() : project/at_start_f413/examples/acc/calibration/inc/at32f413_int.h, project/at_start_f413/examples/acc/calibration/src/at32f413_int.c, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_int.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/at32f413_int.c, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_int.h, project/at_start_f413/examples/adc/current_vref_value_check/src/at32f413_int.c, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_int.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/src/at32f413_int.c, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_int.h, project/at_start_f413/examples/adc/internal_temperature_sensor/src/at32f413_int.c, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_int.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/at32f413_int.c, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_int.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/at32f413_int.c, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_int.h, project/at_start_f413/examples/adc/voltage_monitoring/src/at32f413_int.c, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_int.h, project/at_start_f413/examples/bpr/bpr_data/src/at32f413_int.c, project/at_start_f413/examples/bpr/tamper/inc/at32f413_int.h, project/at_start_f413/examples/bpr/tamper/src/at32f413_int.c, project/at_start_f413/examples/can/communication_mode/inc/at32f413_int.h, project/at_start_f413/examples/can/communication_mode/src/at32f413_int.c, project/at_start_f413/examples/can/filter/inc/at32f413_int.h, project/at_start_f413/examples/can/filter/src/at32f413_int.c, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_int.h, project/at_start_f413/examples/can/loopback_mode/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/bit_band/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/fpu/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_int.c, project/at_start_f413/examples/crc/calculation/inc/at32f413_int.h, project/at_start_f413/examples/crc/calculation/src/at32f413_int.c, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_int.h, project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_int.c, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_int.h, project/at_start_f413/examples/crm/sysclk_switch/src/at32f413_int.c, project/at_start_f413/examples/debug/tmr1/inc/at32f413_int.h, project/at_start_f413/examples/debug/tmr1/src/at32f413_int.c, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_int.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/src/at32f413_int.c, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_int.h, project/at_start_f413/examples/dma/flash_to_sram/src/at32f413_int.c, project/at_start_f413/examples/exint/exint_config/inc/at32f413_int.h, project/at_start_f413/examples/exint/exint_config/src/at32f413_int.c, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_int.h, project/at_start_f413/examples/exint/exint_software_trigger/src/at32f413_int.c, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_int.h, project/at_start_f413/examples/flash/flash_write_read/src/at32f413_int.c, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_int.h, project/at_start_f413/examples/flash/operate_spim/src/at32f413_int.c, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_int.h, project/at_start_f413/examples/flash/run_in_spim/src/at32f413_int.c, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_int.h, project/at_start_f413/examples/gpio/io_toggle/src/at32f413_int.c, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_int.h, project/at_start_f413/examples/gpio/led_toggle/src/at32f413_int.c, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_int.h, project/at_start_f413/examples/gpio/swjtag_remap/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_poll/src/at32f413_int.c, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_int.h, project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_int.h, project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_int.h, project/at_start_f413/examples/i2s/halfduplex_dma/src/at32f413_int.c, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/src/at32f413_int.c, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_int.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/at32f413_int.c, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_int.h, project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_int.c, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_int.h, project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_int.c, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_int.c, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_int.h, project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_int.h, project/at_start_f413/examples/pwc/standby_rtc/src/at32f413_int.c, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_int.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/src/at32f413_int.c, project/at_start_f413/examples/rtc/calendar/inc/at32f413_int.h, project/at_start_f413/examples/rtc/calendar/src/at32f413_int.c, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_int.h, project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_int.h, project/at_start_f413/examples/sdio/emmc_card/src/at32f413_int.c, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_int.h, project/at_start_f413/examples/sdio/sd_mmc_card/src/at32f413_int.c, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_int.h, project/at_start_f413/examples/sdio/sdio_fatfs/src/at32f413_int.c, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/crc_transfer_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_int.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/at32f413_int.c, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/fullduplex_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_interrupt/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/at32f413_int.c, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/only_receive_mode_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_int.h, project/at_start_f413/examples/spi/w25q_flash/src/at32f413_int.c, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_int.h, project/at_start_f413/examples/tmr/6_steps/src/at32f413_int.c, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_int.h, project/at_start_f413/examples/tmr/7_pwm_output/src/at32f413_int.c, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/cascade_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_int.h, project/at_start_f413/examples/tmr/complementary_signals/src/at32f413_int.c, project/at_start_f413/examples/tmr/dma/inc/at32f413_int.h, project/at_start_f413/examples/tmr/dma/src/at32f413_int.c, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_int.h, project/at_start_f413/examples/tmr/dma_burst/src/at32f413_int.c, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/tmr/encoder_tmr2/src/at32f413_int.c, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_int.h, project/at_start_f413/examples/tmr/external_clock/src/at32f413_int.c, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/src/at32f413_int.c, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_int.h, project/at_start_f413/examples/tmr/hang_mode/src/at32f413_int.c, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_int.h, project/at_start_f413/examples/tmr/input_capture/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_high/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_low/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_int.h, project/at_start_f413/examples/tmr/one_cycle/src/at32f413_int.c, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/parallel_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_input_dma/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_int.h, project/at_start_f413/examples/tmr/timer_base/src/at32f413_int.c, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/tmr1_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_int.h, project/at_start_f413/examples/tmr/tmr2_32bit/src/at32f413_int.c, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_int.h, project/at_start_f413/examples/usart/half_duplex/src/at32f413_int.c, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_int.h, project/at_start_f413/examples/usart/hw_flow_control/src/at32f413_int.c, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_int.h, project/at_start_f413/examples/usart/idle_detection/src/at32f413_int.c, project/at_start_f413/examples/usart/interrupt/inc/at32f413_int.h, project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/irda/inc/at32f413_int.h, project/at_start_f413/examples/usart/irda/src/at32f413_int.c, project/at_start_f413/examples/usart/polling/inc/at32f413_int.h, project/at_start_f413/examples/usart/polling/src/at32f413_int.c, project/at_start_f413/examples/usart/printf/inc/at32f413_int.h, project/at_start_f413/examples/usart/printf/src/at32f413_int.c, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_int.h, project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c, project/at_start_f413/examples/usart/rs485/inc/at32f413_int.h, project/at_start_f413/examples/usart/rs485/src/at32f413_int.c, project/at_start_f413/examples/usart/smartcard/inc/at32f413_int.h, project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c, project/at_start_f413/examples/usart/synchronous/inc/at32f413_int.h, project/at_start_f413/examples/usart/synchronous/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_int.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/src/at32f413_int.c, project/at_start_f413/examples/usb_device/audio/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/audio/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_audio_hid/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/src/at32f413_int.c, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/custom_hid/src/at32f413_int.c, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/keyboard/src/at32f413_int.c, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/mouse/src/at32f413_int.c, project/at_start_f413/examples/usb_device/msc/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/msc/src/at32f413_int.c, project/at_start_f413/examples/usb_device/printer/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/printer/src/at32f413_int.c, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/vcp_loopback/src/at32f413_int.c, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/src/at32f413_int.c, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/winusb/src/at32f413_int.c, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_int.h, project/at_start_f413/examples/wdt/wdt_reset/src/at32f413_int.c, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_int.h, project/at_start_f413/examples/wdt/wdt_standby/src/at32f413_int.c, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_int.h, project/at_start_f413/examples/wwdt/wwdt_reset/src/at32f413_int.c, project/at_start_f413/templates/src/at32f413_int.c, project/at_start_f413/templates/inc/at32f413_int.h, utilities/at32f413_freertos_demo/inc/at32f413_int.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_int.h, utilities/at32f413_gen_random_number_demo/src/at32f413_int.c, utilities/at32f413_slib_demo/project_l0/inc/at32f413_int.h, utilities/at32f413_slib_demo/project_l0/src/at32f413_int.c, utilities/at32f413_slib_demo/project_l1/inc/at32f413_int.h, utilities/at32f413_slib_demo/project_l1/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/src/at32f413_int.c
  • SVCall_IRQn : at32f413.h
  • SWAPBYTE : usb_std.h
  • switch_system_clock() : project/at_start_f413/examples/crm/sysclk_switch/src/main.c
  • swj_dp_config() : project/at_start_f413/examples/gpio/swjtag_remap/src/main.c
  • SWJTAG_CONF_001 : at32f413_gpio.h
  • SWJTAG_CONF_010 : at32f413_gpio.h
  • SWJTAG_CONF_100 : at32f413_gpio.h
  • SWJTAG_GMUX_001 : at32f413_gpio.h
  • SWJTAG_GMUX_010 : at32f413_gpio.h
  • SWJTAG_GMUX_100 : at32f413_gpio.h
  • sys_counter : project/at_start_f413/examples/tmr/input_capture/src/main.c
  • system_clock_config() : project/at_start_f413/examples/acc/calibration/inc/at32f413_clock.h, project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_clock.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/at32f413_clock.c, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_clock.h, project/at_start_f413/examples/adc/current_vref_value_check/src/at32f413_clock.c, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_clock.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/src/at32f413_clock.c, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_clock.h, project/at_start_f413/examples/adc/internal_temperature_sensor/src/at32f413_clock.c, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_clock.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/at32f413_clock.c, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_clock.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/at32f413_clock.c, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_clock.h, project/at_start_f413/examples/adc/voltage_monitoring/src/at32f413_clock.c, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_clock.h, project/at_start_f413/examples/bpr/bpr_data/src/at32f413_clock.c, project/at_start_f413/examples/bpr/tamper/inc/at32f413_clock.h, project/at_start_f413/examples/bpr/tamper/src/at32f413_clock.c, project/at_start_f413/examples/can/communication_mode/inc/at32f413_clock.h, project/at_start_f413/examples/can/communication_mode/src/at32f413_clock.c, project/at_start_f413/examples/can/filter/inc/at32f413_clock.h, project/at_start_f413/examples/can/filter/src/at32f413_clock.c, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_clock.h, project/at_start_f413/examples/can/loopback_mode/src/at32f413_clock.c, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_clock.h, project/at_start_f413/examples/cortex_m4/bit_band/src/at32f413_clock.c, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_clock.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/at32f413_clock.c, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_clock.h, project/at_start_f413/examples/cortex_m4/fpu/src/at32f413_clock.c, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_clock.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_clock.c, project/at_start_f413/examples/crc/calculation/inc/at32f413_clock.h, project/at_start_f413/examples/crc/calculation/src/at32f413_clock.c, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_clock.h, project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_clock.c, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_clock.h, project/at_start_f413/examples/crm/sysclk_switch/src/at32f413_clock.c, project/at_start_f413/examples/debug/tmr1/inc/at32f413_clock.h, project/at_start_f413/examples/debug/tmr1/src/at32f413_clock.c, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_clock.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/src/at32f413_clock.c, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_clock.h, project/at_start_f413/examples/dma/flash_to_sram/src/at32f413_clock.c, project/at_start_f413/examples/exint/exint_config/inc/at32f413_clock.h, project/at_start_f413/examples/exint/exint_config/src/at32f413_clock.c, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_clock.h, project/at_start_f413/examples/exint/exint_software_trigger/src/at32f413_clock.c, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_clock.h, project/at_start_f413/examples/flash/flash_write_read/src/at32f413_clock.c, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_clock.h, project/at_start_f413/examples/flash/operate_spim/src/at32f413_clock.c, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_clock.h, project/at_start_f413/examples/flash/run_in_spim/src/at32f413_clock.c, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_clock.h, project/at_start_f413/examples/gpio/io_toggle/src/at32f413_clock.c, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_clock.h, project/at_start_f413/examples/gpio/led_toggle/src/at32f413_clock.c, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_clock.h, project/at_start_f413/examples/gpio/swjtag_remap/src/at32f413_clock.c, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_clock.h, project/at_start_f413/examples/i2c/communication_dma/src/at32f413_clock.c, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_clock.h, project/at_start_f413/examples/i2c/communication_int/src/at32f413_clock.c, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_clock.h, project/at_start_f413/examples/i2c/communication_poll/src/at32f413_clock.c, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_clock.h, project/at_start_f413/examples/i2c/eeprom/src/at32f413_clock.c, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_clock.h, project/at_start_f413/examples/i2c/memory_write/src/at32f413_clock.c, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_clock.h, project/at_start_f413/examples/i2s/halfduplex_dma/src/at32f413_clock.c, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_clock.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/src/at32f413_clock.c, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_clock.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/at32f413_clock.c, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_clock.h, project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_clock.c, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_clock.h, project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_clock.c, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_clock.h, project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_clock.c, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_clock.h, project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_clock.c, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_clock.h, project/at_start_f413/examples/pwc/standby_rtc/src/at32f413_clock.c, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_clock.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/src/at32f413_clock.c, project/at_start_f413/examples/rtc/calendar/inc/at32f413_clock.h, project/at_start_f413/examples/rtc/calendar/src/at32f413_clock.c, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_clock.h, project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_clock.c, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_clock.h, project/at_start_f413/examples/sdio/emmc_card/src/at32f413_clock.c, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_clock.h, project/at_start_f413/examples/sdio/sd_mmc_card/src/at32f413_clock.c, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_clock.h, project/at_start_f413/examples/sdio/sdio_fatfs/src/at32f413_clock.c, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_clock.h, project/at_start_f413/examples/spi/crc_transfer_polling/src/at32f413_clock.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_clock.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/at32f413_clock.c, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_clock.h, project/at_start_f413/examples/spi/fullduplex_polling/src/at32f413_clock.c, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_clock.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/at32f413_clock.c, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_clock.h, project/at_start_f413/examples/spi/halfduplex_interrupt/src/at32f413_clock.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_clock.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/at32f413_clock.c, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_clock.h, project/at_start_f413/examples/spi/only_receive_mode_polling/src/at32f413_clock.c, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_clock.h, project/at_start_f413/examples/spi/w25q_flash/src/at32f413_clock.c, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/6_steps/src/at32f413_clock.c, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/7_pwm_output/src/at32f413_clock.c, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/cascade_synchro/src/at32f413_clock.c, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/complementary_signals/src/at32f413_clock.c, project/at_start_f413/examples/tmr/dma/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/dma/src/at32f413_clock.c, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/dma_burst/src/at32f413_clock.c, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/encoder_tmr2/src/at32f413_clock.c, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/external_clock/src/at32f413_clock.c, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/src/at32f413_clock.c, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/hang_mode/src/at32f413_clock.c, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/input_capture/src/at32f413_clock.c, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/oc_high/src/at32f413_clock.c, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/oc_low/src/at32f413_clock.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_clock.c, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_clock.c, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/one_cycle/src/at32f413_clock.c, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/parallel_synchro/src/at32f413_clock.c, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/pwm_input/src/at32f413_clock.c, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/pwm_input_dma/src/at32f413_clock.c, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_clock.c, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/src/at32f413_clock.c, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/src/at32f413_clock.c, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/timer_base/src/at32f413_clock.c, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/tmr1_synchro/src/at32f413_clock.c, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/tmr2_32bit/src/at32f413_clock.c, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_clock.h, project/at_start_f413/examples/usart/half_duplex/src/at32f413_clock.c, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_clock.h, project/at_start_f413/examples/usart/hw_flow_control/src/at32f413_clock.c, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_clock.h, project/at_start_f413/examples/usart/idle_detection/src/at32f413_clock.c, project/at_start_f413/examples/usart/interrupt/inc/at32f413_clock.h, project/at_start_f413/examples/usart/interrupt/src/at32f413_clock.c, project/at_start_f413/examples/usart/irda/inc/at32f413_clock.h, project/at_start_f413/examples/usart/irda/src/at32f413_clock.c, project/at_start_f413/examples/usart/polling/inc/at32f413_clock.h, project/at_start_f413/examples/usart/polling/src/at32f413_clock.c, project/at_start_f413/examples/usart/printf/inc/at32f413_clock.h, project/at_start_f413/examples/usart/printf/src/at32f413_clock.c, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_clock.h, project/at_start_f413/examples/usart/receiver_mute/src/at32f413_clock.c, project/at_start_f413/examples/usart/rs485/inc/at32f413_clock.h, project/at_start_f413/examples/usart/rs485/src/at32f413_clock.c, project/at_start_f413/examples/usart/smartcard/inc/at32f413_clock.h, project/at_start_f413/examples/usart/smartcard/src/at32f413_clock.c, project/at_start_f413/examples/usart/synchronous/inc/at32f413_clock.h, project/at_start_f413/examples/usart/synchronous/src/at32f413_clock.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_clock.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_clock.c, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_clock.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/src/at32f413_clock.c, project/at_start_f413/examples/usb_device/audio/inc/at32f413_clock.h, project/at_start_f413/examples/usb_device/audio/src/at32f413_clock.c, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_clock.h, project/at_start_f413/examples/usb_device/composite_audio_hid/src/at32f413_clock.c, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_clock.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/at32f413_clock.c, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_clock.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/src/at32f413_clock.c, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_clock.h, project/at_start_f413/examples/usb_device/custom_hid/src/at32f413_clock.c, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_clock.h, project/at_start_f413/examples/usb_device/keyboard/src/at32f413_clock.c, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_clock.h, project/at_start_f413/examples/usb_device/mouse/src/at32f413_clock.c, project/at_start_f413/examples/usb_device/msc/inc/at32f413_clock.h, project/at_start_f413/examples/usb_device/msc/src/at32f413_clock.c, project/at_start_f413/examples/usb_device/printer/inc/at32f413_clock.h, project/at_start_f413/examples/usb_device/printer/src/at32f413_clock.c, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_clock.h, project/at_start_f413/examples/usb_device/vcp_loopback/src/at32f413_clock.c, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_clock.h, project/at_start_f413/examples/usb_device/virtual_comport/src/at32f413_clock.c, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_clock.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/src/at32f413_clock.c, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_clock.h, project/at_start_f413/examples/usb_device/winusb/src/at32f413_clock.c, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_clock.h, project/at_start_f413/examples/wdt/wdt_reset/src/at32f413_clock.c, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_clock.h, project/at_start_f413/examples/wdt/wdt_standby/src/at32f413_clock.c, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_clock.h, project/at_start_f413/examples/wwdt/wwdt_reset/src/at32f413_clock.c, project/at_start_f413/templates/src/at32f413_clock.c, project/at_start_f413/templates/inc/at32f413_clock.h, utilities/at32f413_freertos_demo/inc/at32f413_clock.h, utilities/at32f413_freertos_demo/src/at32f413_clock.c, utilities/at32f413_gen_random_number_demo/inc/at32f413_clock.h, utilities/at32f413_gen_random_number_demo/src/at32f413_clock.c, utilities/at32f413_slib_demo/project_l0/inc/at32f413_clock.h, utilities/at32f413_slib_demo/project_l0/src/at32f413_clock.c, utilities/at32f413_slib_demo/project_l1/inc/at32f413_clock.h, utilities/at32f413_slib_demo/project_l1/src/at32f413_clock.c, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_clock.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/at32f413_clock.c, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_clock.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/at32f413_clock.c, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_clock.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/src/at32f413_clock.c, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_clock.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/at32f413_clock.c, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_clock.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/at32f413_clock.c, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_clock.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/src/at32f413_clock.c
  • system_clock_config_for_acc() : project/at_start_f413/examples/acc/calibration/src/main.c
  • system_clock_recover() : project/at_start_f413/examples/pwc/deepsleep_rtc/src/main.c, project/at_start_f413/examples/usb_device/keyboard/src/main.c, project/at_start_f413/examples/usb_device/mouse/src/main.c
  • system_core_clock : system_at32f413.c, system_at32f413.h
  • system_core_clock_update() : system_at32f413.c, system_at32f413.h
  • SystemCoreClock : system_at32f413.h
  • SystemInit() : system_at32f413.c, system_at32f413.h
  • SYSTICK_CLOCK_SOURCE_AHBCLK_DIV8 : at32f413_misc.h
  • SYSTICK_CLOCK_SOURCE_AHBCLK_NODIV : at32f413_misc.h
  • systick_clock_source_config() : at32f413_misc.h, at32f413_misc.c
  • systick_clock_source_type : at32f413_misc.h
  • systick_configuration() : project/at_start_f413/examples/tmr/6_steps/src/main.c
  • SysTick_Handler() : project/at_start_f413/examples/acc/calibration/inc/at32f413_int.h, project/at_start_f413/examples/acc/calibration/src/at32f413_int.c, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_int.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/at32f413_int.c, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_int.h, project/at_start_f413/examples/adc/current_vref_value_check/src/at32f413_int.c, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_int.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/src/at32f413_int.c, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_int.h, project/at_start_f413/examples/adc/internal_temperature_sensor/src/at32f413_int.c, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_int.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/at32f413_int.c, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_int.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/at32f413_int.c, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_int.h, project/at_start_f413/examples/adc/voltage_monitoring/src/at32f413_int.c, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_int.h, project/at_start_f413/examples/bpr/bpr_data/src/at32f413_int.c, project/at_start_f413/examples/bpr/tamper/inc/at32f413_int.h, project/at_start_f413/examples/bpr/tamper/src/at32f413_int.c, project/at_start_f413/examples/can/communication_mode/inc/at32f413_int.h, project/at_start_f413/examples/can/communication_mode/src/at32f413_int.c, project/at_start_f413/examples/can/filter/inc/at32f413_int.h, project/at_start_f413/examples/can/filter/src/at32f413_int.c, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_int.h, project/at_start_f413/examples/can/loopback_mode/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/bit_band/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/fpu/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_int.c, project/at_start_f413/examples/crc/calculation/inc/at32f413_int.h, project/at_start_f413/examples/crc/calculation/src/at32f413_int.c, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_int.h, project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_int.c, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_int.h, project/at_start_f413/examples/crm/sysclk_switch/src/at32f413_int.c, project/at_start_f413/examples/debug/tmr1/inc/at32f413_int.h, project/at_start_f413/examples/debug/tmr1/src/at32f413_int.c, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_int.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/src/at32f413_int.c, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_int.h, project/at_start_f413/examples/dma/flash_to_sram/src/at32f413_int.c, project/at_start_f413/examples/exint/exint_config/inc/at32f413_int.h, project/at_start_f413/examples/exint/exint_config/src/at32f413_int.c, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_int.h, project/at_start_f413/examples/exint/exint_software_trigger/src/at32f413_int.c, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_int.h, project/at_start_f413/examples/flash/flash_write_read/src/at32f413_int.c, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_int.h, project/at_start_f413/examples/flash/operate_spim/src/at32f413_int.c, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_int.h, project/at_start_f413/examples/flash/run_in_spim/src/at32f413_int.c, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_int.h, project/at_start_f413/examples/gpio/io_toggle/src/at32f413_int.c, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_int.h, project/at_start_f413/examples/gpio/led_toggle/src/at32f413_int.c, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_int.h, project/at_start_f413/examples/gpio/swjtag_remap/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_poll/src/at32f413_int.c, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_int.h, project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_int.h, project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_int.h, project/at_start_f413/examples/i2s/halfduplex_dma/src/at32f413_int.c, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/src/at32f413_int.c, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_int.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/at32f413_int.c, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_int.h, project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_int.c, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_int.h, project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_int.c, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_int.c, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_int.h, project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_int.h, project/at_start_f413/examples/pwc/standby_rtc/src/at32f413_int.c, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_int.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/src/at32f413_int.c, project/at_start_f413/examples/rtc/calendar/inc/at32f413_int.h, project/at_start_f413/examples/rtc/calendar/src/at32f413_int.c, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_int.h, project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_int.h, project/at_start_f413/examples/sdio/emmc_card/src/at32f413_int.c, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_int.h, project/at_start_f413/examples/sdio/sd_mmc_card/src/at32f413_int.c, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_int.h, project/at_start_f413/examples/sdio/sdio_fatfs/src/at32f413_int.c, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/crc_transfer_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_int.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/at32f413_int.c, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/fullduplex_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_interrupt/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/at32f413_int.c, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/only_receive_mode_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_int.h, project/at_start_f413/examples/spi/w25q_flash/src/at32f413_int.c, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_int.h, project/at_start_f413/examples/tmr/6_steps/src/at32f413_int.c, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_int.h, project/at_start_f413/examples/tmr/7_pwm_output/src/at32f413_int.c, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/cascade_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_int.h, project/at_start_f413/examples/tmr/complementary_signals/src/at32f413_int.c, project/at_start_f413/examples/tmr/dma/inc/at32f413_int.h, project/at_start_f413/examples/tmr/dma/src/at32f413_int.c, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_int.h, project/at_start_f413/examples/tmr/dma_burst/src/at32f413_int.c, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/tmr/encoder_tmr2/src/at32f413_int.c, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_int.h, project/at_start_f413/examples/tmr/external_clock/src/at32f413_int.c, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/src/at32f413_int.c, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_int.h, project/at_start_f413/examples/tmr/hang_mode/src/at32f413_int.c, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_int.h, project/at_start_f413/examples/tmr/input_capture/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_high/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_low/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_int.h, project/at_start_f413/examples/tmr/one_cycle/src/at32f413_int.c, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/parallel_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_input_dma/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_int.h, project/at_start_f413/examples/tmr/timer_base/src/at32f413_int.c, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/tmr1_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_int.h, project/at_start_f413/examples/tmr/tmr2_32bit/src/at32f413_int.c, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_int.h, project/at_start_f413/examples/usart/half_duplex/src/at32f413_int.c, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_int.h, project/at_start_f413/examples/usart/hw_flow_control/src/at32f413_int.c, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_int.h, project/at_start_f413/examples/usart/idle_detection/src/at32f413_int.c, project/at_start_f413/examples/usart/interrupt/inc/at32f413_int.h, project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/irda/inc/at32f413_int.h, project/at_start_f413/examples/usart/irda/src/at32f413_int.c, project/at_start_f413/examples/usart/polling/inc/at32f413_int.h, project/at_start_f413/examples/usart/polling/src/at32f413_int.c, project/at_start_f413/examples/usart/printf/inc/at32f413_int.h, project/at_start_f413/examples/usart/printf/src/at32f413_int.c, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_int.h, project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c, project/at_start_f413/examples/usart/rs485/inc/at32f413_int.h, project/at_start_f413/examples/usart/rs485/src/at32f413_int.c, project/at_start_f413/examples/usart/smartcard/inc/at32f413_int.h, project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c, project/at_start_f413/examples/usart/synchronous/inc/at32f413_int.h, project/at_start_f413/examples/usart/synchronous/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_int.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/src/at32f413_int.c, project/at_start_f413/examples/usb_device/audio/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/audio/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_audio_hid/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/src/at32f413_int.c, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/custom_hid/src/at32f413_int.c, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/keyboard/src/at32f413_int.c, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/mouse/src/at32f413_int.c, project/at_start_f413/examples/usb_device/msc/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/msc/src/at32f413_int.c, project/at_start_f413/examples/usb_device/printer/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/printer/src/at32f413_int.c, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/vcp_loopback/src/at32f413_int.c, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/src/at32f413_int.c, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/winusb/src/at32f413_int.c, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_int.h, project/at_start_f413/examples/wdt/wdt_reset/src/at32f413_int.c, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_int.h, project/at_start_f413/examples/wdt/wdt_standby/src/at32f413_int.c, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_int.h, project/at_start_f413/examples/wwdt/wwdt_reset/src/at32f413_int.c, project/at_start_f413/templates/src/at32f413_int.c, project/at_start_f413/templates/inc/at32f413_int.h, utilities/at32f413_freertos_demo/inc/at32f413_int.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_int.h, utilities/at32f413_gen_random_number_demo/src/at32f413_int.c, utilities/at32f413_slib_demo/project_l0/inc/at32f413_int.h, utilities/at32f413_slib_demo/project_l0/src/at32f413_int.c, utilities/at32f413_slib_demo/project_l1/inc/at32f413_int.h, utilities/at32f413_slib_demo/project_l1/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/src/at32f413_int.c
  • systick_handler() : project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/systick_interrupt/src/main.c
  • systick_interrupt_config() : project/at_start_f413/examples/cortex_m4/systick_interrupt/src/main.c
  • SysTick_IRQn : at32f413.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- t -

  • T0_PROTOCOL : project/at_start_f413/examples/usart/smartcard/src/main.c
  • table_week : rtc.c
  • TAMPER_IRQHandler() : project/at_start_f413/examples/bpr/tamper/src/at32f413_int.c
  • TAMPER_IRQn : at32f413.h
  • temp_buf : utilities/at32f413_slib_demo/project_l0/src/main.c
  • TEST_BUFEER_SIZE : project/at_start_f413/examples/flash/flash_write_read/src/main.c
  • TEST_FAIL : project/at_start_f413/examples/sdio/emmc_card/src/main.c, project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c
  • TEST_FLASH_ADDRESS_START : project/at_start_f413/examples/flash/flash_write_read/src/main.c
  • TEST_LENGTH_SAMPLES : project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c, utilities/at32f413_slib_demo/project_l0/src/main.c, utilities/at32f413_slib_demo/project_l1/src/main.c
  • test_result : project/at_start_f413/examples/can/filter/src/main.c
  • test_result_type : project/at_start_f413/examples/sdio/emmc_card/src/main.c, project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c
  • TEST_SLIB_PSW : utilities/at32f413_slib_demo/project_l0/src/main.c
  • TEST_SUCCESS : project/at_start_f413/examples/sdio/emmc_card/src/main.c, project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c
  • testInput_f32_1kHz_15kHz : project_l0/src/arm_fir_data.c, utilities/at32f413_slib_demo/project_l0/src/main.c, project_l1/src/arm_fir_data.c, utilities/at32f413_slib_demo/project_l1/src/main.c
  • testMarks_f32 : project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c
  • testOutput : project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c, utilities/at32f413_slib_demo/project_l0/src/main.c, utilities/at32f413_slib_demo/project_l1/src/main.c
  • testUnity_f32 : project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c
  • time_cnt : project/at_start_f413/examples/usart/printf/src/main.c
  • time_ira_cnt : bootloader/inc/tmr.h, bootloader/src/tmr.c
  • timer_period : project/at_start_f413/examples/tmr/7_pwm_output/src/main.c, project/at_start_f413/examples/tmr/complementary_signals/src/main.c, project/at_start_f413/examples/tmr/dma/src/main.c, project/at_start_f413/examples/tmr/dma_burst/src/main.c
  • tmpCC4 : project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c
  • TMR1 : at32f413_tmr.h
  • TMR10_BASE : at32f413.h
  • TMR10_GMUX : at32f413_gpio.h
  • TMR11_BASE : at32f413.h
  • TMR11_GMUX : at32f413_gpio.h
  • TMR1_BASE : at32f413.h
  • TMR1_BRK_TMR9_IRQHandler() : project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c
  • TMR1_BRK_TMR9_IRQn : at32f413.h
  • TMR1_CH_IRQn : at32f413.h
  • tmr1_config() : project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c, project/at_start_f413/examples/exint/exint_software_trigger/src/main.c
  • TMR1_GMUX_0001 : at32f413_gpio.h
  • TMR1_MUX_01 : at32f413_gpio.h
  • TMR1_OVF_TMR10_IRQHandler() : project/at_start_f413/examples/debug/tmr1/src/main.c, project/at_start_f413/examples/exint/exint_software_trigger/src/main.c, project/at_start_f413/examples/tmr/timer_base/src/main.c
  • TMR1_OVF_TMR10_IRQn : at32f413.h
  • TMR1_TRG_HALL_TMR11_IRQHandler() : project/at_start_f413/examples/tmr/6_steps/src/main.c
  • TMR1_TRG_HALL_TMR11_IRQn : at32f413.h
  • TMR2 : at32f413_tmr.h
  • TMR2_BASE : at32f413.h
  • tmr2_config() : project/at_start_f413/examples/pwc/sleep_tmr2/src/main.c
  • TMR2_GLOBAL_IRQHandler() : project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_int.c, project/at_start_f413/examples/tmr/hall_xor_tmr2/src/main.c, project/at_start_f413/examples/tmr/oc_high/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_low/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c
  • TMR2_GLOBAL_IRQn : at32f413.h
  • TMR2_GMUX_001 : at32f413_gpio.h
  • TMR2_GMUX_010 : at32f413_gpio.h
  • TMR2_GMUX_011 : at32f413_gpio.h
  • TMR2_MUX_01 : at32f413_gpio.h
  • TMR2_MUX_10 : at32f413_gpio.h
  • TMR2_MUX_11 : at32f413_gpio.h
  • TMR2ITR1_GMUX : at32f413_gpio.h
  • TMR3 : at32f413_tmr.h
  • TMR3_BASE : at32f413.h
  • TMR3_GLOBAL_IRQHandler() : project/at_start_f413/examples/tmr/input_capture/src/main.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c, app_led3_toggle/src/tmr.c, app_led4_toggle/src/tmr.c, bootloader/src/tmr.c
  • TMR3_GLOBAL_IRQn : at32f413.h
  • TMR3_GMUX_0010 : at32f413_gpio.h
  • TMR3_GMUX_0011 : at32f413_gpio.h
  • TMR3_MUX_10 : at32f413_gpio.h
  • TMR3_MUX_11 : at32f413_gpio.h
  • tmr3freq : project/at_start_f413/examples/tmr/input_capture/src/main.c
  • TMR4 : at32f413_tmr.h
  • TMR4_BASE : at32f413.h
  • TMR4_GLOBAL_IRQn : at32f413.h
  • TMR5_BASE : at32f413.h
  • TMR5_GLOBAL_IRQHandler() : project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c
  • TMR5_GLOBAL_IRQn : at32f413.h
  • TMR5_GMUX_001 : at32f413_gpio.h
  • TMR5CH4_GMUX : at32f413_gpio.h
  • TMR5CH4_MUX : at32f413_gpio.h
  • TMR8_BASE : at32f413.h
  • TMR8_BRK_IRQn : at32f413.h
  • TMR8_CH_IRQn : at32f413.h
  • TMR8_OVF_IRQn : at32f413.h
  • TMR8_TRG_HALL_IRQn : at32f413.h
  • TMR9_BASE : at32f413.h
  • TMR9_GMUX : at32f413_gpio.h
  • tmr_32_bit_function_enable() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_base_init() : at32f413_tmr.h, at32f413_tmr.c
  • TMR_BRK_ADDRESS : at32f413_tmr.h
  • TMR_BRK_FLAG : at32f413_tmr.h
  • TMR_BRK_INPUT_ACTIVE_HIGH : at32f413_tmr.h
  • TMR_BRK_INPUT_ACTIVE_LOW : at32f413_tmr.h
  • TMR_BRK_INT : at32f413_tmr.h
  • tmr_brk_polarity_type : at32f413_tmr.h
  • TMR_BRK_SWTRIG : at32f413_tmr.h
  • tmr_brkdt_config() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_brkdt_config_struct : project/at_start_f413/examples/tmr/6_steps/src/main.c, project/at_start_f413/examples/tmr/complementary_signals/src/main.c
  • tmr_brkdt_default_para_init() : at32f413_tmr.h, at32f413_tmr.c
  • TMR_C1_DMA_REQUEST : at32f413_tmr.h
  • TMR_C1_FLAG : at32f413_tmr.h
  • TMR_C1_INT : at32f413_tmr.h
  • TMR_C1_RECAPTURE_FLAG : at32f413_tmr.h
  • TMR_C1_SWTRIG : at32f413_tmr.h
  • TMR_C1DT_ADDRESS : at32f413_tmr.h
  • TMR_C2_DMA_REQUEST : at32f413_tmr.h
  • TMR_C2_FLAG : at32f413_tmr.h
  • TMR_C2_INT : at32f413_tmr.h
  • TMR_C2_RECAPTURE_FLAG : at32f413_tmr.h
  • TMR_C2_SWTRIG : at32f413_tmr.h
  • TMR_C2DT_ADDRESS : at32f413_tmr.h
  • TMR_C3_DMA_REQUEST : at32f413_tmr.h
  • TMR_C3_FLAG : at32f413_tmr.h
  • TMR_C3_INT : at32f413_tmr.h
  • TMR_C3_RECAPTURE_FLAG : at32f413_tmr.h
  • TMR_C3_SWTRIG : at32f413_tmr.h
  • TMR_C3DT_ADDRESS : at32f413_tmr.h
  • TMR_C4_DMA_REQUEST : at32f413_tmr.h
  • TMR_C4_FLAG : at32f413_tmr.h
  • TMR_C4_INT : at32f413_tmr.h
  • TMR_C4_RECAPTURE_FLAG : at32f413_tmr.h
  • TMR_C4_SWTRIG : at32f413_tmr.h
  • TMR_C4DT_ADDRESS : at32f413_tmr.h
  • TMR_CC_CHANNEL_MAPPED_DIRECT : at32f413_tmr.h
  • TMR_CC_CHANNEL_MAPPED_INDIRECT : at32f413_tmr.h
  • TMR_CC_CHANNEL_MAPPED_STI : at32f413_tmr.h
  • TMR_CCTRL_ADDRESS : at32f413_tmr.h
  • TMR_CHANEL1_2_3_CONNECTED_C1IRAW_XOR : at32f413_tmr.h
  • TMR_CHANEL1_CONNECTED_C1IRAW : at32f413_tmr.h
  • tmr_channel1_input_connected_type : at32f413_tmr.h
  • tmr_channel1_input_select() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_channel_buffer_enable() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_channel_dma_select() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_channel_enable() : at32f413_tmr.h, at32f413_tmr.c
  • TMR_CHANNEL_INPUT_DIV_1 : at32f413_tmr.h
  • TMR_CHANNEL_INPUT_DIV_2 : at32f413_tmr.h
  • TMR_CHANNEL_INPUT_DIV_4 : at32f413_tmr.h
  • TMR_CHANNEL_INPUT_DIV_8 : at32f413_tmr.h
  • tmr_channel_input_divider_type : at32f413_tmr.h
  • tmr_channel_select_type : at32f413_tmr.h
  • tmr_channel_value_get() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_channel_value_set() : at32f413_tmr.h, at32f413_tmr.c
  • TMR_CLOCK_DIV1 : at32f413_tmr.h
  • TMR_CLOCK_DIV2 : at32f413_tmr.h
  • TMR_CLOCK_DIV4 : at32f413_tmr.h
  • tmr_clock_division_type : at32f413_tmr.h
  • tmr_clock_source_div_set() : at32f413_tmr.h, at32f413_tmr.c
  • TMR_CM1_ADDRESS : at32f413_tmr.h
  • TMR_CM2_ADDRESS : at32f413_tmr.h
  • tmr_cnt_dir_set() : at32f413_tmr.h, at32f413_tmr.c
  • TMR_COUNT_DOWN : at32f413_tmr.h
  • tmr_count_mode_type : at32f413_tmr.h
  • TMR_COUNT_TWO_WAY_1 : at32f413_tmr.h
  • TMR_COUNT_TWO_WAY_2 : at32f413_tmr.h
  • TMR_COUNT_TWO_WAY_3 : at32f413_tmr.h
  • TMR_COUNT_UP : at32f413_tmr.h
  • tmr_counter_enable() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_counter_value_get() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_counter_value_set() : at32f413_tmr.h, at32f413_tmr.c
  • TMR_CTRL1_ADDRESS : at32f413_tmr.h
  • TMR_CTRL2_ADDRESS : at32f413_tmr.h
  • TMR_CVAL_ADDRESS : at32f413_tmr.h
  • TMR_DIV_ADDRESS : at32f413_tmr.h
  • tmr_div_value_get() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_div_value_set() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_dma_address_type : at32f413_tmr.h
  • tmr_dma_control_config() : at32f413_tmr.h, at32f413_tmr.c
  • TMR_DMA_REQUEST_BY_CHANNEL : at32f413_tmr.h
  • TMR_DMA_REQUEST_BY_OVERFLOW : at32f413_tmr.h
  • tmr_dma_request_enable() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_dma_request_source_type : at32f413_tmr.h
  • tmr_dma_request_type : at32f413_tmr.h
  • TMR_DMA_TRANSFER_10BYTES : at32f413_tmr.h
  • TMR_DMA_TRANSFER_11BYTES : at32f413_tmr.h
  • TMR_DMA_TRANSFER_12BYTES : at32f413_tmr.h
  • TMR_DMA_TRANSFER_13BYTES : at32f413_tmr.h
  • TMR_DMA_TRANSFER_14BYTES : at32f413_tmr.h
  • TMR_DMA_TRANSFER_15BYTES : at32f413_tmr.h
  • TMR_DMA_TRANSFER_16BYTES : at32f413_tmr.h
  • TMR_DMA_TRANSFER_17BYTES : at32f413_tmr.h
  • TMR_DMA_TRANSFER_18BYTES : at32f413_tmr.h
  • TMR_DMA_TRANSFER_1BYTE : at32f413_tmr.h
  • TMR_DMA_TRANSFER_2BYTES : at32f413_tmr.h
  • TMR_DMA_TRANSFER_3BYTES : at32f413_tmr.h
  • TMR_DMA_TRANSFER_4BYTES : at32f413_tmr.h
  • TMR_DMA_TRANSFER_5BYTES : at32f413_tmr.h
  • TMR_DMA_TRANSFER_6BYTES : at32f413_tmr.h
  • TMR_DMA_TRANSFER_7BYTES : at32f413_tmr.h
  • TMR_DMA_TRANSFER_8BYTES : at32f413_tmr.h
  • TMR_DMA_TRANSFER_9BYTES : at32f413_tmr.h
  • tmr_dma_transfer_length_type : at32f413_tmr.h
  • TMR_DMACTRL_ADDRESS : at32f413_tmr.h
  • TMR_ENCODER_MODE_A : at32f413_tmr.h
  • TMR_ENCODER_MODE_B : at32f413_tmr.h
  • TMR_ENCODER_MODE_C : at32f413_tmr.h
  • tmr_encoder_mode_config() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_encoder_mode_type : at32f413_tmr.h
  • TMR_ES_FREQUENCY_DIV_1 : at32f413_tmr.h
  • TMR_ES_FREQUENCY_DIV_2 : at32f413_tmr.h
  • TMR_ES_FREQUENCY_DIV_4 : at32f413_tmr.h
  • TMR_ES_FREQUENCY_DIV_8 : at32f413_tmr.h
  • TMR_ES_POLARITY_INVERTED : at32f413_tmr.h
  • TMR_ES_POLARITY_NON_INVERTED : at32f413_tmr.h
  • tmr_event_sw_trigger() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_event_trigger_type : at32f413_tmr.h
  • tmr_external_clock_config() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_external_clock_mode1_config() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_external_clock_mode2_config() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_external_signal_divider_type : at32f413_tmr.h
  • tmr_external_signal_polarity_type : at32f413_tmr.h
  • tmr_flag_clear() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_flag_get() : at32f413_tmr.h, at32f413_tmr.c
  • TMR_FORCE_OUTPUT_HIGH : at32f413_tmr.h
  • TMR_FORCE_OUTPUT_LOW : at32f413_tmr.h
  • tmr_force_output_set() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_force_output_type : at32f413_tmr.h
  • TMR_HALL_DMA_REQUEST : at32f413_tmr.h
  • TMR_HALL_FLAG : at32f413_tmr.h
  • TMR_HALL_INT : at32f413_tmr.h
  • tmr_hall_select() : at32f413_tmr.h, at32f413_tmr.c
  • TMR_HALL_SWTRIG : at32f413_tmr.h
  • tmr_ic_init_structure : project/at_start_f413/examples/tmr/one_cycle/src/main.c, project/at_start_f413/examples/tmr/pwm_input/src/main.c, project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c
  • TMR_IDEN_ADDRESS : at32f413_tmr.h
  • tmr_init() : app_led3_toggle/inc/tmr.h, app_led3_toggle/src/tmr.c, app_led4_toggle/inc/tmr.h, app_led4_toggle/src/tmr.c, bootloader/inc/tmr.h, bootloader/src/tmr.c
  • TMR_INPUT_BOTH_EDGE : at32f413_tmr.h
  • tmr_input_channel_divider_set() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_input_channel_filter_set() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_input_channel_init() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_input_config_struct : project/at_start_f413/examples/tmr/external_clock/src/main.c, project/at_start_f413/examples/tmr/hall_xor_tmr2/src/main.c, project/at_start_f413/examples/tmr/hang_mode/src/main.c, project/at_start_f413/examples/tmr/input_capture/src/main.c
  • tmr_input_default_para_init() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_input_direction_mapped_type : at32f413_tmr.h
  • TMR_INPUT_FALLING_EDGE : at32f413_tmr.h
  • tmr_input_polarity_type : at32f413_tmr.h
  • TMR_INPUT_RISING_EDGE : at32f413_tmr.h
  • tmr_internal_clock_set() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_interrupt_enable() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_interrupt_flag_get() : at32f413_tmr.h, at32f413_tmr.c
  • TMR_ISTS_ADDRESS : at32f413_tmr.h
  • TMR_MODULE_ENABLED : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • tmr_oc_init_structure : project/at_start_f413/examples/tmr/oc_high/src/main.c, project/at_start_f413/examples/tmr/oc_low/src/main.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/main.c, project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/main.c, project/at_start_f413/examples/tmr/one_cycle/src/main.c, project/at_start_f413/examples/tmr/parallel_synchro/src/main.c, project/at_start_f413/examples/tmr/pwm_output_simulate/src/main.c, project/at_start_f413/examples/tmr/pwm_output_tmr10/src/main.c, project/at_start_f413/examples/tmr/pwm_output_tmr3/src/main.c, project/at_start_f413/examples/tmr/tmr1_synchro/src/main.c, project/at_start_f413/examples/tmr/tmr2_32bit/src/main.c
  • tmr_one_cycle_mode_enable() : at32f413_tmr.h, at32f413_tmr.c
  • TMR_OUTPUT_ACTIVE_HIGH : at32f413_tmr.h
  • TMR_OUTPUT_ACTIVE_LOW : at32f413_tmr.h
  • tmr_output_channel_buffer_enable() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_output_channel_config() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_output_channel_immediately_set() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_output_channel_mode_select() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_output_channel_polarity_set() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_output_channel_switch_set() : at32f413_tmr.h, at32f413_tmr.c
  • TMR_OUTPUT_CONTROL_FORCE_HIGH : at32f413_tmr.h
  • TMR_OUTPUT_CONTROL_FORCE_LOW : at32f413_tmr.h
  • TMR_OUTPUT_CONTROL_HIGH : at32f413_tmr.h
  • TMR_OUTPUT_CONTROL_LOW : at32f413_tmr.h
  • tmr_output_control_mode_type : at32f413_tmr.h
  • TMR_OUTPUT_CONTROL_OFF : at32f413_tmr.h
  • TMR_OUTPUT_CONTROL_PWM_MODE_A : at32f413_tmr.h
  • TMR_OUTPUT_CONTROL_PWM_MODE_B : at32f413_tmr.h
  • TMR_OUTPUT_CONTROL_SWITCH : at32f413_tmr.h
  • tmr_output_default_para_init() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_output_enable() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_output_polarity_type : at32f413_tmr.h
  • tmr_output_struct : project/at_start_f413/examples/tmr/6_steps/src/main.c, project/at_start_f413/examples/tmr/7_pwm_output/src/main.c, project/at_start_f413/examples/tmr/cascade_synchro/src/main.c, project/at_start_f413/examples/tmr/complementary_signals/src/main.c, project/at_start_f413/examples/tmr/dma/src/main.c, project/at_start_f413/examples/tmr/dma_burst/src/main.c, project/at_start_f413/examples/tmr/external_clock/src/main.c, project/at_start_f413/examples/tmr/hall_xor_tmr2/src/main.c, project/at_start_f413/examples/tmr/hang_mode/src/main.c
  • TMR_OVERFLOW_DMA_REQUEST : at32f413_tmr.h
  • tmr_overflow_event_disable() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_overflow_request_source_set() : at32f413_tmr.h, at32f413_tmr.c
  • TMR_OVERFLOW_SWTRIG : at32f413_tmr.h
  • TMR_OVF_FLAG : at32f413_tmr.h
  • TMR_OVF_INT : at32f413_tmr.h
  • tmr_period_buffer_enable() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_period_value_get() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_period_value_set() : at32f413_tmr.h, at32f413_tmr.c
  • TMR_POLARITY_ACTIVE_BOTH : at32f413_tmr.h
  • TMR_POLARITY_ACTIVE_HIGH : at32f413_tmr.h
  • TMR_POLARITY_ACTIVE_LOW : at32f413_tmr.h
  • tmr_polarity_active_type : at32f413_tmr.h
  • TMR_PR_ADDRESS : at32f413_tmr.h
  • tmr_primary_mode_select() : at32f413_tmr.h, at32f413_tmr.c
  • TMR_PRIMARY_SEL_C1ORAW : at32f413_tmr.h
  • TMR_PRIMARY_SEL_C2ORAW : at32f413_tmr.h
  • TMR_PRIMARY_SEL_C3ORAW : at32f413_tmr.h
  • TMR_PRIMARY_SEL_C4ORAW : at32f413_tmr.h
  • TMR_PRIMARY_SEL_COMPARE : at32f413_tmr.h
  • TMR_PRIMARY_SEL_ENABLE : at32f413_tmr.h
  • TMR_PRIMARY_SEL_OVERFLOW : at32f413_tmr.h
  • TMR_PRIMARY_SEL_RESET : at32f413_tmr.h
  • tmr_primary_select_type : at32f413_tmr.h
  • tmr_pwm_input_config() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_repetition_counter_set() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_reset() : at32f413_tmr.h, at32f413_tmr.c
  • TMR_RPR_ADDRESS : at32f413_tmr.h
  • TMR_SELECT_CHANNEL_1 : at32f413_tmr.h
  • TMR_SELECT_CHANNEL_1C : at32f413_tmr.h
  • TMR_SELECT_CHANNEL_2 : at32f413_tmr.h
  • TMR_SELECT_CHANNEL_2C : at32f413_tmr.h
  • TMR_SELECT_CHANNEL_3 : at32f413_tmr.h
  • TMR_SELECT_CHANNEL_3C : at32f413_tmr.h
  • TMR_SELECT_CHANNEL_4 : at32f413_tmr.h
  • TMR_STCTRL_ADDRESS : at32f413_tmr.h
  • TMR_SUB_ENCODER_MODE_A : at32f413_tmr.h
  • TMR_SUB_ENCODER_MODE_B : at32f413_tmr.h
  • TMR_SUB_ENCODER_MODE_C : at32f413_tmr.h
  • TMR_SUB_EXTERNAL_CLOCK_MODE_A : at32f413_tmr.h
  • TMR_SUB_HANG_MODE : at32f413_tmr.h
  • TMR_SUB_INPUT_SEL_C1DF1 : at32f413_tmr.h
  • TMR_SUB_INPUT_SEL_C1INC : at32f413_tmr.h
  • TMR_SUB_INPUT_SEL_C2DF2 : at32f413_tmr.h
  • TMR_SUB_INPUT_SEL_EXTIN : at32f413_tmr.h
  • TMR_SUB_INPUT_SEL_IS0 : at32f413_tmr.h
  • TMR_SUB_INPUT_SEL_IS1 : at32f413_tmr.h
  • TMR_SUB_INPUT_SEL_IS2 : at32f413_tmr.h
  • TMR_SUB_INPUT_SEL_IS3 : at32f413_tmr.h
  • TMR_SUB_MODE_DIABLE : at32f413_tmr.h
  • tmr_sub_mode_select() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_sub_mode_select_type : at32f413_tmr.h
  • TMR_SUB_RESET_MODE : at32f413_tmr.h
  • tmr_sub_sync_mode_set() : at32f413_tmr.h, at32f413_tmr.c
  • TMR_SUB_TRIGGER_MODE : at32f413_tmr.h
  • TMR_SWEVT_ADDRESS : at32f413_tmr.h
  • TMR_TRIGGER_DMA_REQUEST : at32f413_tmr.h
  • TMR_TRIGGER_FLAG : at32f413_tmr.h
  • tmr_trigger_input_select() : at32f413_tmr.h, at32f413_tmr.c
  • TMR_TRIGGER_INT : at32f413_tmr.h
  • TMR_TRIGGER_SWTRIG : at32f413_tmr.h
  • TMR_WP_LEVEL_1 : at32f413_tmr.h
  • TMR_WP_LEVEL_2 : at32f413_tmr.h
  • TMR_WP_LEVEL_3 : at32f413_tmr.h
  • tmr_wp_level_type : at32f413_tmr.h
  • TMR_WP_OFF : at32f413_tmr.h
  • transfer_end : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • transfer_error : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • transfer_status : project/at_start_f413/examples/dma/flash_to_sram/src/main.c, project/at_start_f413/examples/i2s/halfduplex_dma/src/main.c, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c, project/at_start_f413/examples/spi/w25q_flash/src/main.c
  • transfer_status1 : project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c, project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/fullduplex_polling/src/main.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c
  • transfer_status2 : project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c, project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/fullduplex_polling/src/main.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c
  • transfer_status3 : project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c, project/at_start_f413/examples/spi/fullduplex_polling/src/main.c
  • transfer_status4 : project/at_start_f413/examples/spi/fullduplex_polling/src/main.c
  • TRUE : at32f413.h
  • tx_buf : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/communication_int/src/main.c, project/at_start_f413/examples/i2c/communication_poll/src/main.c
  • tx_buf1 : project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c
  • tx_buf2 : project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c
  • tx_buf3 : project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c
  • tx_buffer : project/at_start_f413/examples/spi/w25q_flash/src/main.c
  • tx_counter : project/at_start_f413/examples/usart/receiver_mute/src/main.c
  • tx_data_fill() : project/at_start_f413/examples/spi/w25q_flash/src/main.c
  • tx_index : project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c, project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c, project/at_start_f413/examples/spi/fullduplex_polling/src/main.c, project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c, project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- u -

  • u16 : at32f413.h
  • u32 : at32f413.h
  • u8 : at32f413.h
  • UART4_BASE : at32f413.h
  • UART4_GMUX_0001 : at32f413_gpio.h
  • UART4_IRQn : at32f413.h
  • UART5_BASE : at32f413.h
  • UART5_IRQn : at32f413.h
  • uart_init() : project/at_start_f413/examples/bpr/bpr_data/src/main.c, project/at_start_f413/examples/tmr/input_capture/src/main.c, app_led3_toggle/inc/usart.h, app_led3_toggle/src/usart.c, app_led4_toggle/inc/usart.h, app_led4_toggle/src/usart.c, bootloader/inc/usart.h, bootloader/src/usart.c
  • uart_print_init() : at32f413_board.c, at32f413_board.h
  • uc16 : at32f413.h
  • uc32 : at32f413.h
  • uc8 : at32f413.h
  • UINT16 : at32f413.h
  • UINT32 : at32f413.h
  • UINT8 : at32f413.h
  • UNUSED : at32f413_def.h
  • UP_MOVE : mouse_class.h
  • UPDATE_CLEAR_FLAG : bootloader/inc/iap.h
  • UPDATE_DONE : bootloader/inc/iap.h
  • UPDATE_ING : bootloader/inc/iap.h
  • UPDATE_PRE : bootloader/inc/iap.h
  • update_status : bootloader/inc/iap.h, bootloader/src/iap.c
  • update_status_type : bootloader/inc/iap.h
  • UPGRADE_DONE : flash_fat16.h
  • UPGRADE_FAILED : flash_fat16.h
  • UPGRADE_JUMP : flash_fat16.h
  • UPGRADE_LARGE : flash_fat16.h
  • UPGRADE_READY : flash_fat16.h
  • upgrade_status_type : flash_fat16.h
  • UPGRADE_SUCCESS : flash_fat16.h
  • UPGRADE_UNKNOWN : flash_fat16.h
  • UPGRAGE_ONGOING : flash_fat16.h
  • UsageFault_Handler() : project/at_start_f413/examples/acc/calibration/inc/at32f413_int.h, project/at_start_f413/examples/acc/calibration/src/at32f413_int.c, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_int.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/at32f413_int.c, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_int.h, project/at_start_f413/examples/adc/current_vref_value_check/src/at32f413_int.c, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_int.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/src/at32f413_int.c, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_int.h, project/at_start_f413/examples/adc/internal_temperature_sensor/src/at32f413_int.c, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_int.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/at32f413_int.c, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_int.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/at32f413_int.c, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_int.h, project/at_start_f413/examples/adc/voltage_monitoring/src/at32f413_int.c, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_int.h, project/at_start_f413/examples/bpr/bpr_data/src/at32f413_int.c, project/at_start_f413/examples/bpr/tamper/inc/at32f413_int.h, project/at_start_f413/examples/bpr/tamper/src/at32f413_int.c, project/at_start_f413/examples/can/communication_mode/inc/at32f413_int.h, project/at_start_f413/examples/can/communication_mode/src/at32f413_int.c, project/at_start_f413/examples/can/filter/inc/at32f413_int.h, project/at_start_f413/examples/can/filter/src/at32f413_int.c, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_int.h, project/at_start_f413/examples/can/loopback_mode/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/bit_band/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/fpu/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_int.c, project/at_start_f413/examples/crc/calculation/inc/at32f413_int.h, project/at_start_f413/examples/crc/calculation/src/at32f413_int.c, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_int.h, project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_int.c, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_int.h, project/at_start_f413/examples/crm/sysclk_switch/src/at32f413_int.c, project/at_start_f413/examples/debug/tmr1/inc/at32f413_int.h, project/at_start_f413/examples/debug/tmr1/src/at32f413_int.c, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_int.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/src/at32f413_int.c, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_int.h, project/at_start_f413/examples/dma/flash_to_sram/src/at32f413_int.c, project/at_start_f413/examples/exint/exint_config/inc/at32f413_int.h, project/at_start_f413/examples/exint/exint_config/src/at32f413_int.c, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_int.h, project/at_start_f413/examples/exint/exint_software_trigger/src/at32f413_int.c, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_int.h, project/at_start_f413/examples/flash/flash_write_read/src/at32f413_int.c, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_int.h, project/at_start_f413/examples/flash/operate_spim/src/at32f413_int.c, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_int.h, project/at_start_f413/examples/flash/run_in_spim/src/at32f413_int.c, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_int.h, project/at_start_f413/examples/gpio/io_toggle/src/at32f413_int.c, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_int.h, project/at_start_f413/examples/gpio/led_toggle/src/at32f413_int.c, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_int.h, project/at_start_f413/examples/gpio/swjtag_remap/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_poll/src/at32f413_int.c, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_int.h, project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_int.h, project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_int.h, project/at_start_f413/examples/i2s/halfduplex_dma/src/at32f413_int.c, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/src/at32f413_int.c, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_int.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/at32f413_int.c, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_int.h, project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_int.c, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_int.h, project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_int.c, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_int.c, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_int.h, project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_int.h, project/at_start_f413/examples/pwc/standby_rtc/src/at32f413_int.c, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_int.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/src/at32f413_int.c, project/at_start_f413/examples/rtc/calendar/inc/at32f413_int.h, project/at_start_f413/examples/rtc/calendar/src/at32f413_int.c, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_int.h, project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_int.h, project/at_start_f413/examples/sdio/emmc_card/src/at32f413_int.c, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_int.h, project/at_start_f413/examples/sdio/sd_mmc_card/src/at32f413_int.c, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_int.h, project/at_start_f413/examples/sdio/sdio_fatfs/src/at32f413_int.c, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/crc_transfer_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_int.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/at32f413_int.c, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/fullduplex_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_interrupt/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/at32f413_int.c, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/only_receive_mode_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_int.h, project/at_start_f413/examples/spi/w25q_flash/src/at32f413_int.c, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_int.h, project/at_start_f413/examples/tmr/6_steps/src/at32f413_int.c, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_int.h, project/at_start_f413/examples/tmr/7_pwm_output/src/at32f413_int.c, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/cascade_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_int.h, project/at_start_f413/examples/tmr/complementary_signals/src/at32f413_int.c, project/at_start_f413/examples/tmr/dma/inc/at32f413_int.h, project/at_start_f413/examples/tmr/dma/src/at32f413_int.c, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_int.h, project/at_start_f413/examples/tmr/dma_burst/src/at32f413_int.c, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/tmr/encoder_tmr2/src/at32f413_int.c, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_int.h, project/at_start_f413/examples/tmr/external_clock/src/at32f413_int.c, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/src/at32f413_int.c, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_int.h, project/at_start_f413/examples/tmr/hang_mode/src/at32f413_int.c, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_int.h, project/at_start_f413/examples/tmr/input_capture/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_high/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_low/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_int.h, project/at_start_f413/examples/tmr/one_cycle/src/at32f413_int.c, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/parallel_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_input_dma/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_int.h, project/at_start_f413/examples/tmr/timer_base/src/at32f413_int.c, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/tmr1_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_int.h, project/at_start_f413/examples/tmr/tmr2_32bit/src/at32f413_int.c, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_int.h, project/at_start_f413/examples/usart/half_duplex/src/at32f413_int.c, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_int.h, project/at_start_f413/examples/usart/hw_flow_control/src/at32f413_int.c, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_int.h, project/at_start_f413/examples/usart/idle_detection/src/at32f413_int.c, project/at_start_f413/examples/usart/interrupt/inc/at32f413_int.h, project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/irda/inc/at32f413_int.h, project/at_start_f413/examples/usart/irda/src/at32f413_int.c, project/at_start_f413/examples/usart/polling/inc/at32f413_int.h, project/at_start_f413/examples/usart/polling/src/at32f413_int.c, project/at_start_f413/examples/usart/printf/inc/at32f413_int.h, project/at_start_f413/examples/usart/printf/src/at32f413_int.c, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_int.h, project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c, project/at_start_f413/examples/usart/rs485/inc/at32f413_int.h, project/at_start_f413/examples/usart/rs485/src/at32f413_int.c, project/at_start_f413/examples/usart/smartcard/inc/at32f413_int.h, project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c, project/at_start_f413/examples/usart/synchronous/inc/at32f413_int.h, project/at_start_f413/examples/usart/synchronous/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_int.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/src/at32f413_int.c, project/at_start_f413/examples/usb_device/audio/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/audio/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_audio_hid/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/src/at32f413_int.c, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/custom_hid/src/at32f413_int.c, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/keyboard/src/at32f413_int.c, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/mouse/src/at32f413_int.c, project/at_start_f413/examples/usb_device/msc/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/msc/src/at32f413_int.c, project/at_start_f413/examples/usb_device/printer/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/printer/src/at32f413_int.c, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/vcp_loopback/src/at32f413_int.c, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/src/at32f413_int.c, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/winusb/src/at32f413_int.c, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_int.h, project/at_start_f413/examples/wdt/wdt_reset/src/at32f413_int.c, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_int.h, project/at_start_f413/examples/wdt/wdt_standby/src/at32f413_int.c, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_int.h, project/at_start_f413/examples/wwdt/wwdt_reset/src/at32f413_int.c, project/at_start_f413/templates/src/at32f413_int.c, project/at_start_f413/templates/inc/at32f413_int.h, utilities/at32f413_freertos_demo/inc/at32f413_int.h, utilities/at32f413_freertos_demo/src/at32f413_int.c, utilities/at32f413_gen_random_number_demo/inc/at32f413_int.h, utilities/at32f413_gen_random_number_demo/src/at32f413_int.c, utilities/at32f413_slib_demo/project_l0/inc/at32f413_int.h, utilities/at32f413_slib_demo/project_l0/src/at32f413_int.c, utilities/at32f413_slib_demo/project_l1/inc/at32f413_int.h, utilities/at32f413_slib_demo/project_l1/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/src/at32f413_int.c
  • UsageFault_IRQn : at32f413.h
  • USART1 : at32f413_usart.h
  • USART1_BASE : at32f413.h
  • usart1_config() : project/at_start_f413/examples/pwc/sleep_usart1/src/main.c
  • USART1_GMUX_0001 : at32f413_gpio.h
  • usart1_index : project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c
  • USART1_IRQHandler() : project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c, app_led3_toggle/src/usart.c, app_led4_toggle/src/usart.c, bootloader/src/usart.c
  • USART1_IRQn : at32f413.h
  • USART1_MUX : at32f413_gpio.h
  • USART2 : at32f413_usart.h
  • USART2_BASE : at32f413.h
  • USART2_IRQHandler() : project/at_start_f413/examples/usart/idle_detection/src/at32f413_int.c, project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/rs485/src/main.c, project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c, project/at_start_f413/examples/usb_device/virtual_comport/src/main.c
  • USART2_IRQn : at32f413.h
  • usart2_rx_buffer : project/at_start_f413/examples/usart/half_duplex/src/main.c, project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/interrupt/src/main.c, project/at_start_f413/examples/usart/polling/src/main.c, project/at_start_f413/examples/usart/synchronous/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c
  • usart2_rx_counter : project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/interrupt/src/main.c, project/at_start_f413/examples/usart/polling/src/main.c, project/at_start_f413/examples/usart/synchronous/src/main.c
  • usart2_rx_dma_status : project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c
  • usart2_tx_buffer : project/at_start_f413/examples/usart/half_duplex/src/main.c, project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/interrupt/src/main.c, project/at_start_f413/examples/usart/polling/src/main.c, project/at_start_f413/examples/usart/receiver_mute/src/main.c, project/at_start_f413/examples/usart/synchronous/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c
  • USART2_TX_BUFFER_SIZE : project/at_start_f413/examples/usart/half_duplex/src/main.c, project/at_start_f413/examples/usart/interrupt/src/main.c, project/at_start_f413/examples/usart/polling/src/main.c, project/at_start_f413/examples/usart/synchronous/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c
  • usart2_tx_buffer_size : project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/interrupt/src/main.c, project/at_start_f413/examples/usart/polling/src/main.c, project/at_start_f413/examples/usart/synchronous/src/main.c
  • usart2_tx_counter : project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/interrupt/src/main.c, project/at_start_f413/examples/usart/polling/src/main.c, project/at_start_f413/examples/usart/synchronous/src/main.c
  • usart2_tx_dma_status : project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c
  • USART3_BASE : at32f413.h
  • USART3_GMUX_0001 : at32f413_gpio.h
  • USART3_IRQHandler() : project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c
  • USART3_IRQn : at32f413.h
  • USART3_MUX_01 : at32f413_gpio.h
  • usart3_rx_buffer : project/at_start_f413/examples/usart/half_duplex/src/main.c, project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/interrupt/src/main.c, project/at_start_f413/examples/usart/polling/src/main.c, project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c, project/at_start_f413/examples/usart/receiver_mute/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c
  • usart3_rx_counter : project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/interrupt/src/main.c, project/at_start_f413/examples/usart/polling/src/main.c
  • usart3_rx_dma_status : project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c
  • usart3_tx_buffer : project/at_start_f413/examples/usart/half_duplex/src/main.c, project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/interrupt/src/main.c, project/at_start_f413/examples/usart/polling/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c
  • USART3_TX_BUFFER_SIZE : project/at_start_f413/examples/usart/half_duplex/src/main.c, project/at_start_f413/examples/usart/interrupt/src/main.c, project/at_start_f413/examples/usart/polling/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c
  • usart3_tx_buffer_size : project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/interrupt/src/main.c, project/at_start_f413/examples/usart/polling/src/main.c
  • usart3_tx_counter : project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/interrupt/src/main.c, project/at_start_f413/examples/usart/polling/src/main.c
  • usart3_tx_dma_status : project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c
  • USART_BF_INT : at32f413_usart.h
  • USART_BFF_FLAG : at32f413_usart.h
  • USART_BREAK_10BITS : at32f413_usart.h
  • USART_BREAK_11BITS : at32f413_usart.h
  • usart_break_bit_num_set() : at32f413_usart.h, at32f413_usart.c
  • usart_break_bit_num_type : at32f413_usart.h
  • usart_break_send() : at32f413_usart.h, at32f413_usart.c
  • usart_buffer_size : project/at_start_f413/examples/usb_device/virtual_comport/src/main.c
  • usart_clock_config() : at32f413_usart.h, at32f413_usart.c
  • usart_clock_enable() : at32f413_usart.h, at32f413_usart.c
  • USART_CLOCK_LAST_BIT_NONE : at32f413_usart.h
  • USART_CLOCK_LAST_BIT_OUTPUT : at32f413_usart.h
  • USART_CLOCK_PHASE_1EDGE : at32f413_usart.h
  • USART_CLOCK_PHASE_2EDGE : at32f413_usart.h
  • usart_clock_phase_type : at32f413_usart.h
  • USART_CLOCK_POLARITY_HIGH : at32f413_usart.h
  • USART_CLOCK_POLARITY_LOW : at32f413_usart.h
  • usart_clock_polarity_type : at32f413_usart.h
  • usart_configuration() : project/at_start_f413/examples/usart/half_duplex/src/main.c, project/at_start_f413/examples/usart/hw_flow_control/src/main.c, project/at_start_f413/examples/usart/idle_detection/src/main.c, project/at_start_f413/examples/usart/interrupt/src/main.c, project/at_start_f413/examples/usart/irda/src/main.c, project/at_start_f413/examples/usart/polling/src/main.c, project/at_start_f413/examples/usart/receiver_mute/src/main.c, project/at_start_f413/examples/usart/smartcard/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c
  • USART_CTSCF_FLAG : at32f413_usart.h
  • USART_CTSCF_INT : at32f413_usart.h
  • USART_DATA_8BITS : at32f413_usart.h
  • USART_DATA_9BITS : at32f413_usart.h
  • usart_data_bit_num_type : at32f413_usart.h
  • usart_data_receive() : at32f413_usart.h, at32f413_usart.c
  • usart_data_transmit() : at32f413_usart.h, at32f413_usart.c
  • usart_dma_receiver_enable() : at32f413_usart.h, at32f413_usart.c
  • usart_dma_transmitter_enable() : at32f413_usart.h, at32f413_usart.c
  • usart_enable() : at32f413_usart.h, at32f413_usart.c
  • USART_ERR_INT : at32f413_usart.h
  • USART_FERR_FLAG : at32f413_usart.h
  • usart_flag_clear() : at32f413_usart.h, at32f413_usart.c
  • usart_flag_get() : at32f413_usart.h, at32f413_usart.c
  • usart_gpio_config() : project/at_start_f413/examples/usb_device/virtual_comport/src/main.c
  • usart_group_struct : bootloader/inc/usart.h, bootloader/src/usart.c
  • usart_hardware_flow_control_set() : at32f413_usart.h, at32f413_usart.c
  • usart_hardware_flow_control_type : at32f413_usart.h
  • USART_HARDWARE_FLOW_CTS : at32f413_usart.h
  • USART_HARDWARE_FLOW_NONE : at32f413_usart.h
  • USART_HARDWARE_FLOW_RTS : at32f413_usart.h
  • USART_HARDWARE_FLOW_RTS_CTS : at32f413_usart.h
  • USART_IDLE_INT : at32f413_usart.h
  • USART_IDLEF_FLAG : at32f413_usart.h
  • usart_init() : at32f413_usart.h, at32f413_usart.c
  • usart_interrupt_enable() : at32f413_usart.h, at32f413_usart.c
  • usart_interrupt_flag_get() : at32f413_usart.h, at32f413_usart.c
  • usart_irda_low_power_enable() : at32f413_usart.h, at32f413_usart.c
  • usart_irda_mode_enable() : at32f413_usart.h, at32f413_usart.c
  • usart_irda_smartcard_division_set() : at32f413_usart.h, at32f413_usart.c
  • usart_lbcp_type : at32f413_usart.h
  • usart_lin_mode_enable() : at32f413_usart.h, at32f413_usart.c
  • USART_MODULE_ENABLED : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • USART_NERR_FLAG : at32f413_usart.h
  • USART_PARITY_EVEN : at32f413_usart.h
  • USART_PARITY_NONE : at32f413_usart.h
  • USART_PARITY_ODD : at32f413_usart.h
  • usart_parity_selection_config() : at32f413_usart.h, at32f413_usart.c
  • usart_parity_selection_type : at32f413_usart.h
  • USART_PERR_FLAG : at32f413_usart.h
  • USART_PERR_INT : at32f413_usart.h
  • USART_RDBF_FLAG : at32f413_usart.h
  • USART_RDBF_INT : at32f413_usart.h
  • USART_REC_LEN : bootloader/inc/usart.h
  • usart_receive_data() : project/at_start_f413/examples/usb_device/virtual_comport/src/main.c
  • usart_receiver_enable() : at32f413_usart.h, at32f413_usart.c
  • usart_receiver_mute_enable() : at32f413_usart.h, at32f413_usart.c
  • usart_reset() : at32f413_usart.h, at32f413_usart.c
  • USART_ROERR_FLAG : at32f413_usart.h
  • usart_rx_buffer : project/at_start_f413/examples/usb_device/virtual_comport/src/main.c
  • usart_rx_data_len : project/at_start_f413/examples/usb_device/virtual_comport/src/main.c
  • usart_send_data() : project/at_start_f413/examples/usb_device/virtual_comport/src/main.c
  • usart_single_line_halfduplex_select() : at32f413_usart.h, at32f413_usart.c
  • usart_smartcard_guard_time_set() : at32f413_usart.h, at32f413_usart.c
  • usart_smartcard_mode_enable() : at32f413_usart.h, at32f413_usart.c
  • usart_smartcard_nack_set() : at32f413_usart.h, at32f413_usart.c
  • usart_spi_configuration() : project/at_start_f413/examples/usart/synchronous/src/main.c
  • USART_STOP_0_5_BIT : at32f413_usart.h
  • USART_STOP_1_5_BIT : at32f413_usart.h
  • USART_STOP_1_BIT : at32f413_usart.h
  • USART_STOP_2_BIT : at32f413_usart.h
  • usart_stop_bit_num_type : at32f413_usart.h
  • USART_TDBE_FLAG : at32f413_usart.h
  • USART_TDBE_INT : at32f413_usart.h
  • USART_TDC_FLAG : at32f413_usart.h
  • USART_TDC_INT : at32f413_usart.h
  • usart_transmitter_enable() : at32f413_usart.h, at32f413_usart.c
  • USART_WAKEUP_BY_IDLE_FRAME : at32f413_usart.h
  • USART_WAKEUP_BY_MATCHING_ID : at32f413_usart.h
  • usart_wakeup_id_set() : at32f413_usart.h, at32f413_usart.c
  • usart_wakeup_mode_set() : at32f413_usart.h, at32f413_usart.c
  • usart_wakeup_mode_type : at32f413_usart.h
  • USB : at32f413_usb.h
  • USB_BE_FLAG : at32f413_usb.h
  • USB_BE_INT : at32f413_usb.h
  • usb_buffer : project/at_start_f413/examples/acc/calibration/src/main.c, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/main.c, project/at_start_f413/examples/usb_device/composite_vcp_msc/src/main.c, project/at_start_f413/examples/usb_device/printer/src/main.c, project/at_start_f413/examples/usb_device/vcp_loopback/src/main.c, project/at_start_f413/examples/usb_device/virtual_comport/src/main.c, project/at_start_f413/examples/usb_device/winusb/src/main.c
  • usb_buffer_free() : at32f413_usb.h, at32f413_usb.c
  • usb_buffer_malloc() : at32f413_usb.h, at32f413_usb.c
  • USB_BUFFER_SIZE_EX : project/at_start_f413/examples/usb_device/audio/inc/usb_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/usb_conf.h
  • USB_BUFFER_TABLE_ADDRESS : at32f413_usb.h
  • USB_CLASS_CODE_AUDIO : usb_std.h
  • USB_CLASS_CODE_CCID : usb_std.h
  • USB_CLASS_CODE_CDC : usb_std.h
  • USB_CLASS_CODE_CDCDATA : usb_std.h
  • USB_CLASS_CODE_HID : usb_std.h
  • USB_CLASS_CODE_HUB : usb_std.h
  • USB_CLASS_CODE_MSC : usb_std.h
  • USB_CLASS_CODE_PRINTER : usb_std.h
  • USB_CLASS_CODE_VENDOR : usb_std.h
  • USB_CLASS_CODE_VIDEO : usb_std.h
  • USB_CLEAR_EPT_DOUBLE_BUFFER : at32f413_usb.h
  • USB_CLEAR_EXF : at32f413_usb.h
  • USB_CLEAR_RXDTS : at32f413_usb.h
  • USB_CLEAR_RXTC : at32f413_usb.h
  • USB_CLEAR_TXDTS : at32f413_usb.h
  • USB_CLEAR_TXTC : at32f413_usb.h
  • usb_clk48_s : at32f413_usb.h
  • USB_CLK_HEXT : at32f413_usb.h
  • USB_CLK_HICK : at32f413_usb.h
  • usb_clock48m_select() : project/at_start_f413/examples/acc/calibration/src/main.c, project/at_start_f413/examples/usb_device/audio/src/main.c, project/at_start_f413/examples/usb_device/composite_audio_hid/src/main.c, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/main.c, project/at_start_f413/examples/usb_device/composite_vcp_msc/src/main.c, project/at_start_f413/examples/usb_device/custom_hid/src/main.c, project/at_start_f413/examples/usb_device/keyboard/src/main.c, project/at_start_f413/examples/usb_device/mouse/src/main.c, project/at_start_f413/examples/usb_device/msc/src/main.c, project/at_start_f413/examples/usb_device/printer/src/main.c, project/at_start_f413/examples/usb_device/vcp_loopback/src/main.c, project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c, project/at_start_f413/examples/usb_device/winusb/src/main.c, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/main.c, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/main.c, utilities/at32f413_usb_iap_demo/source_code/bootloader/src/main.c
  • USB_CONF_REMOTE_WAKEUP : usb_std.h
  • USB_CONF_SELF_POWERED : usb_std.h
  • USB_CONFIG_STRING : usb_std.h
  • USB_CONN_STATE_ADDRESSED : usb_std.h
  • USB_CONN_STATE_CONFIGURED : usb_std.h
  • USB_CONN_STATE_DEFAULT : usb_std.h
  • USB_CONN_STATE_SUSPENDED : usb_std.h
  • usb_connect() : at32f413_usb.h, at32f413_usb.c
  • usb_core_dev : project/at_start_f413/examples/acc/calibration/src/main.c, project/at_start_f413/examples/usb_device/audio/src/main.c, project/at_start_f413/examples/usb_device/composite_audio_hid/src/main.c, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/main.c, project/at_start_f413/examples/usb_device/composite_vcp_msc/src/main.c, project/at_start_f413/examples/usb_device/custom_hid/src/main.c, project/at_start_f413/examples/usb_device/keyboard/src/main.c, project/at_start_f413/examples/usb_device/mouse/src/main.c, project/at_start_f413/examples/usb_device/msc/src/main.c, project/at_start_f413/examples/usb_device/printer/src/main.c, project/at_start_f413/examples/usb_device/vcp_loopback/src/main.c, project/at_start_f413/examples/usb_device/virtual_comport/src/main.c, project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c, project/at_start_f413/examples/usb_device/winusb/src/main.c, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/main.c, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/main.c, utilities/at32f413_usb_iap_demo/source_code/bootloader/src/main.c
  • USB_DBUF0_GET_LEN : at32f413_usb.h
  • USB_DBUF1_GET_LEN : at32f413_usb.h
  • usb_delay_ms() : project/at_start_f413/examples/acc/calibration/inc/usb_conf.h, project/at_start_f413/examples/usb_device/audio/inc/usb_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/usb_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/usb_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/src/main.c, project/at_start_f413/examples/usb_device/custom_hid/inc/usb_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/usb_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/usb_conf.h, project/at_start_f413/examples/usb_device/msc/inc/usb_conf.h, project/at_start_f413/examples/usb_device/printer/inc/usb_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/usb_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/usb_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/usb_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/usb_conf.h
  • usb_delay_us() : project/at_start_f413/examples/acc/calibration/inc/usb_conf.h, project/at_start_f413/examples/usb_device/audio/inc/usb_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/usb_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/usb_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/src/main.c, project/at_start_f413/examples/usb_device/custom_hid/inc/usb_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/usb_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/usb_conf.h, project/at_start_f413/examples/usb_device/msc/inc/usb_conf.h, project/at_start_f413/examples/usb_device/printer/inc/usb_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/usb_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/usb_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/usb_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/usb_conf.h
  • USB_DESCIPTOR_TYPE_CONFIGURATION : usb_std.h
  • USB_DESCIPTOR_TYPE_DEVICE : usb_std.h
  • USB_DESCIPTOR_TYPE_DEVICE_QUALIFIER : usb_std.h
  • USB_DESCIPTOR_TYPE_ENDPOINT : usb_std.h
  • USB_DESCIPTOR_TYPE_INTERFACE : usb_std.h
  • USB_DESCIPTOR_TYPE_INTERFACE_POWER : usb_std.h
  • USB_DESCIPTOR_TYPE_OTHER_SPEED : usb_std.h
  • USB_DESCIPTOR_TYPE_STRING : usb_std.h
  • usb_dev_init() : at32f413_usb.h, at32f413_usb.c
  • USB_DEVICE_CFG_DESC_LEN : usb_std.h
  • USB_DEVICE_DESC_LEN : usb_std.h
  • USB_DEVICE_EPT_LEN : usb_std.h
  • USB_DEVICE_IF_DESC_LEN : usb_std.h
  • USB_DEVICE_LANGID_STR_DESC_LEN : usb_std.h
  • USB_DEVICE_OTG_DESC_LEN : usb_std.h
  • USB_DEVICE_OTHER_SPEED_DESC_SIZ_LEN : usb_std.h
  • USB_DEVICE_QUALIFIER_DESC_LEN : usb_std.h
  • usb_disconnect() : at32f413_usb.h, at32f413_usb.c
  • USB_ENDP_DESC_TABLE_OFFSET : at32f413_usb.c
  • usb_enter_suspend() : at32f413_usb.h, at32f413_usb.c
  • USB_EPT0 : at32f413_usb.h
  • USB_EPT0_DATA_IN : usb_std.h
  • USB_EPT0_DATA_OUT : usb_std.h
  • USB_EPT0_IDLE : usb_std.h
  • USB_EPT0_SETUP : usb_std.h
  • USB_EPT0_STALL : usb_std.h
  • USB_EPT0_STATUS_IN : usb_std.h
  • USB_EPT0_STATUS_OUT : usb_std.h
  • USB_EPT1 : at32f413_usb.h
  • USB_EPT2 : at32f413_usb.h
  • USB_EPT3 : at32f413_usb.h
  • USB_EPT4 : at32f413_usb.h
  • USB_EPT5 : at32f413_usb.h
  • USB_EPT6 : at32f413_usb.h
  • USB_EPT7 : at32f413_usb.h
  • USB_EPT_AUTO_MALLOC_BUFFER : project/at_start_f413/examples/usb_device/audio/inc/usb_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/usb_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/usb_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/usb_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/usb_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/usb_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/usb_conf.h, project/at_start_f413/examples/usb_device/msc/inc/usb_conf.h, project/at_start_f413/examples/usb_device/printer/inc/usb_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/usb_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/usb_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/usb_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/usb_conf.h
  • USB_EPT_BIT_MASK : at32f413_usb.h
  • USB_EPT_BULK : at32f413_usb.h
  • usb_ept_close() : at32f413_usb.h, at32f413_usb.c
  • USB_EPT_CONTROL : at32f413_usb.h
  • USB_EPT_DESC_BULK : usb_std.h
  • USB_EPT_DESC_CONTROL : usb_std.h
  • USB_EPT_DESC_DATA_EPT : usb_std.h
  • USB_EPT_DESC_FD_EPT : usb_std.h
  • USB_EPT_DESC_FDDATA_EPT : usb_std.h
  • USB_EPT_DESC_INTERRUPT : usb_std.h
  • USB_EPT_DESC_ISO : usb_std.h
  • USB_EPT_DESC_NSYNC : usb_std.h
  • USB_EPT_INT : at32f413_usb.h
  • USB_EPT_ISO : at32f413_usb.h
  • USB_EPT_NUM_FLAG : at32f413_usb.h
  • usb_ept_number_type : at32f413_usb.h
  • usb_ept_open() : at32f413_usb.h, at32f413_usb.c
  • usb_ept_stall() : at32f413_usb.h, at32f413_usb.c
  • USB_EPTADDR : at32f413_usb.h
  • USB_ERROR : usb_std.h
  • USB_ETP_DESC_ADAPTIVE : usb_std.h
  • USB_ETP_DESC_ASYNC : usb_std.h
  • USB_ETP_DESC_SYNC : usb_std.h
  • USB_EXF : at32f413_usb.h
  • usb_exit_suspend() : at32f413_usb.h, at32f413_usb.c
  • USB_FAIL : usb_std.h
  • USB_FEATURE_EPT_HALT : usb_std.h
  • USB_FEATURE_REMOTE_WAKEUP : usb_std.h
  • USB_FEATURE_TEST_MODE : usb_std.h
  • usb_flag_clear() : at32f413_usb.h, at32f413_usb.c
  • usb_flag_get() : at32f413_usb.h, at32f413_usb.c
  • USB_FLASH_ADDR_OFFSET : composite_vcp_msc/inc/msc_diskio.h, msc/inc/msc_diskio.h, virtual_msc_iap/inc/msc_diskio.h
  • USB_FREE_DB_USER_BUFFER : at32f413_usb.h
  • USB_GET_RX_LEN : at32f413_usb.h
  • USB_GET_TX_LEN : at32f413_usb.h
  • usb_hid_buf_process() : audio_hid_class.c, custom_hid_class.c
  • usb_hid_keyboard_send_char() : keyboard_class.c, keyboard_class.h
  • usb_hid_mouse_send() : mouse_class.c, mouse_class.h
  • usb_iap_class_send_report() : hid_iap_class.c, hid_iap_class.h
  • USB_INOUT_FLAG : at32f413_usb.h
  • USB_INTERFACE_ASSOCIATION_TYPE : cdc_msc_desc.c
  • USB_INTERFACE_STRING : usb_std.h
  • usb_interrupt_enable() : at32f413_usb.h, at32f413_usb.c
  • usb_interrupt_flag_get() : at32f413_usb.h, at32f413_usb.c
  • usb_keyboard_class_send_report() : keyboard_class.c, keyboard_class.h
  • USB_LANGID_STRING : usb_std.h
  • usb_low_power_wakeup_config() : project/at_start_f413/examples/usb_device/keyboard/src/main.c, project/at_start_f413/examples/usb_device/mouse/src/main.c
  • USB_LOW_POWER_WAKUP : project/at_start_f413/examples/usb_device/keyboard/inc/usb_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/usb_conf.h
  • USB_LSOF_FLAG : at32f413_usb.h
  • USB_LSOF_INT : at32f413_usb.h
  • USB_MAX_EP0_SIZE : usb_std.h
  • USB_MFC_STRING : usb_std.h
  • USB_MODULE_ENABLED : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • usb_mouse_class_send_report() : mouse_class.c, mouse_class.h
  • USB_NOT_SUPPORT : usb_std.h
  • USB_OK : usb_std.h
  • USB_OUT_EPT_DOUBLE_BUF0 : at32f413_usb.h
  • USB_PACKET_BUFFER_ADDRESS : at32f413_usb.h
  • USB_PACKET_BUFFER_ADDRESS_EX : at32f413_usb.h
  • usb_printer_get_rxdata() : printer_class.c, printer_class.h
  • usb_printer_send_data() : printer_class.c, printer_class.h
  • USB_PRODUCT_STRING : usb_std.h
  • usb_read_packet() : at32f413_usb.h, at32f413_usb.c
  • usb_reg_type : at32f413_usb.h
  • usb_remote_wkup_clear() : at32f413_usb.h, at32f413_usb.c
  • usb_remote_wkup_set() : at32f413_usb.h, at32f413_usb.c
  • USB_REQ_DIR_DTH : usb_std.h
  • USB_REQ_DIR_HTD : usb_std.h
  • USB_REQ_RECIPIENT_DEVICE : usb_std.h
  • USB_REQ_RECIPIENT_ENDPOINT : usb_std.h
  • USB_REQ_RECIPIENT_INTERFACE : usb_std.h
  • USB_REQ_RECIPIENT_MASK : usb_std.h
  • USB_REQ_RECIPIENT_OTHER : usb_std.h
  • USB_REQ_TYPE_CLASS : usb_std.h
  • USB_REQ_TYPE_RESERVED : usb_std.h
  • USB_REQ_TYPE_STANDARD : usb_std.h
  • USB_REQ_TYPE_VENDOR : usb_std.h
  • usb_reset() : project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c
  • USB_RST_FLAG : at32f413_usb.h
  • USB_RST_INT : at32f413_usb.h
  • USB_RX_DISABLE : at32f413_usb.h
  • USB_RX_MASK : at32f413_usb.h
  • USB_RX_NAK : at32f413_usb.h
  • USB_RX_STALL : at32f413_usb.h
  • USB_RX_VALID : at32f413_usb.h
  • USB_RXDTS : at32f413_usb.h
  • USB_RXDTS0 : at32f413_usb.h
  • USB_RXDTS1 : at32f413_usb.h
  • USB_RXSTS : at32f413_usb.h
  • USB_RXTC : at32f413_usb.h
  • USB_SERIAL_STRING : usb_std.h
  • usb_set_address() : at32f413_usb.h, at32f413_usb.c
  • USB_SET_DOUBLE_BUFF0_ADDRESS : at32f413_usb.h
  • USB_SET_DOUBLE_BUFF1_ADDRESS : at32f413_usb.h
  • USB_SET_EPT_ADDRESS : at32f413_usb.h
  • USB_SET_EPT_DOUBLE_BUF0_LEN : at32f413_usb.h
  • USB_SET_EPT_DOUBLE_BUF1_LEN : at32f413_usb.h
  • USB_SET_EPT_DOUBLE_BUFFER : at32f413_usb.h
  • USB_SET_EXF : at32f413_usb.h
  • USB_SET_RX_ADDRESS : at32f413_usb.h
  • USB_SET_RXLEN : at32f413_usb.h
  • USB_SET_RXLEN_REG : at32f413_usb.h
  • USB_SET_RXSTS : at32f413_usb.h
  • USB_SET_TRANS_TYPE : at32f413_usb.h
  • USB_SET_TX_ADDRESS : at32f413_usb.h
  • USB_SET_TXLEN : at32f413_usb.h
  • USB_SET_TXSTS : at32f413_usb.h
  • USB_SETUPTC : at32f413_usb.h
  • USB_SOF_FLAG : at32f413_usb.h
  • USB_SOF_INT : at32f413_usb.h
  • USB_SP_FLAG : at32f413_usb.h
  • USB_SP_INT : at32f413_usb.h
  • USB_STD_REQ_CLEAR_FEATURE : usb_std.h
  • USB_STD_REQ_GET_CONFIGURATION : usb_std.h
  • USB_STD_REQ_GET_DESCRIPTOR : usb_std.h
  • USB_STD_REQ_GET_INTERFACE : usb_std.h
  • USB_STD_REQ_GET_STATUS : usb_std.h
  • USB_STD_REQ_SET_ADDRESS : usb_std.h
  • USB_STD_REQ_SET_CONFIGURATION : usb_std.h
  • USB_STD_REQ_SET_DESCRIPTOR : usb_std.h
  • USB_STD_REQ_SET_FEATURE : usb_std.h
  • USB_STD_REQ_SET_INTERFACE : usb_std.h
  • USB_STD_REQ_SYNCH_FRAME : usb_std.h
  • usb_sts_type : usb_std.h
  • USB_TC_FLAG : at32f413_usb.h
  • USB_TC_INT : at32f413_usb.h
  • USB_TOGGLE_RXDTS : at32f413_usb.h
  • USB_TOGGLE_TXDTS : at32f413_usb.h
  • USB_TRANS_TYPE : at32f413_usb.h
  • USB_TX_DISABLE : at32f413_usb.h
  • USB_TX_MASK : at32f413_usb.h
  • USB_TX_NAK : at32f413_usb.h
  • USB_TX_STALL : at32f413_usb.h
  • USB_TX_VALID : at32f413_usb.h
  • USB_TXDTS : at32f413_usb.h
  • USB_TXDTS0 : at32f413_usb.h
  • USB_TXDTS1 : at32f413_usb.h
  • USB_TXSTS : at32f413_usb.h
  • USB_TXTC : at32f413_usb.h
  • USB_UCFOR_FLAG : at32f413_usb.h
  • USB_UCFOR_INT : at32f413_usb.h
  • usb_usart_config() : project/at_start_f413/examples/usb_device/virtual_comport/src/main.c, cdc_class.c, cdc_msc_class.c
  • usb_usbbufs_enable() : at32f413_usb.h, at32f413_usb.c
  • usb_vcp_cmd_process() : cdc_class.c, cdc_keyboard_class.c, cdc_msc_class.c
  • usb_vcp_get_rxdata() : cdc_class.c, cdc_class.h, cdc_msc_class.c, cdc_msc_class.h
  • usb_vcp_send_data() : cdc_class.c, cdc_class.h, cdc_msc_class.c, cdc_msc_class.h
  • usb_vcpkybrd_class_send_report() : cdc_keyboard_class.c, cdc_keyboard_class.h
  • usb_vcpkybrd_keyboard_send_char() : cdc_keyboard_class.c, cdc_keyboard_class.h
  • usb_vcpkybrd_vcp_get_rxdata() : cdc_keyboard_class.c, cdc_keyboard_class.h
  • usb_vcpkybrd_vcp_send_data() : cdc_keyboard_class.c, cdc_keyboard_class.h
  • USB_VIRTUAL_COMPORT : project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h
  • USB_WAIT : usb_std.h
  • USB_WINUSB_COMPAT_ID : usb_std.h
  • usb_winusb_get_rxdata() : winusb_class.c, winusb_class.h
  • USB_WINUSB_OS_STRING : usb_std.h
  • USB_WINUSB_PROPERTIES_ID : usb_std.h
  • usb_winusb_send_data() : winusb_class.c, winusb_class.h
  • USB_WK_FLAG : at32f413_usb.h
  • USB_WK_INT : at32f413_usb.h
  • usb_write_packet() : at32f413_usb.h, at32f413_usb.c
  • USBD_AUDIO_CONFIG_DESC_SIZE : audio_desc.h
  • USBD_AUDIO_DESC_CONFIGURATION_STRING : audio_desc.h
  • USBD_AUDIO_DESC_INTERFACE_STRING : audio_desc.h
  • USBD_AUDIO_DESC_MANUFACTURER_STRING : audio_desc.h
  • USBD_AUDIO_DESC_PRODUCT_STRING : audio_desc.h
  • USBD_AUDIO_FEEDBACK_EPT : audio_class.h
  • USBD_AUDIO_MIC_IN_EPT : audio_class.h
  • USBD_AUDIO_PRODUCT_ID : audio_desc.h
  • USBD_AUDIO_SIZ_STRING_LANGID : audio_desc.h
  • USBD_AUDIO_SIZ_STRING_SERIAL : audio_desc.h
  • USBD_AUDIO_SPK_OUT_EPT : audio_class.h
  • USBD_AUDIO_VENDOR_ID : audio_desc.h
  • USBD_AUHID_AUDIO_FEEDBACK_EPT : audio_hid_class.h
  • USBD_AUHID_AUDIO_MIC_IN_EPT : audio_hid_class.h
  • USBD_AUHID_AUDIO_SPK_OUT_EPT : audio_hid_class.h
  • USBD_AUHID_CONFIG_DESC_SIZE : audio_hid_desc.h
  • USBD_AUHID_DESC_CONFIGURATION_STRING : audio_hid_desc.h
  • USBD_AUHID_DESC_INTERFACE_STRING : audio_hid_desc.h
  • USBD_AUHID_DESC_MANUFACTURER_STRING : audio_hid_desc.h
  • USBD_AUHID_DESC_PRODUCT_STRING : audio_hid_desc.h
  • USBD_AUHID_HID_DESC_SIZE : audio_hid_desc.h
  • USBD_AUHID_HID_IN_EPT : audio_hid_class.h
  • USBD_AUHID_HID_OUT_EPT : audio_hid_class.h
  • USBD_AUHID_HID_SIZ_REPORT_DESC : audio_hid_desc.h
  • USBD_AUHID_IN_MAXPACKET_SIZE : audio_hid_class.h
  • USBD_AUHID_OUT_MAXPACKET_SIZE : audio_hid_class.h
  • USBD_AUHID_PRODUCT_ID : audio_hid_desc.h
  • USBD_AUHID_SIZ_STRING_LANGID : audio_hid_desc.h
  • USBD_AUHID_SIZ_STRING_SERIAL : audio_hid_desc.h
  • USBD_AUHID_VENDOR_ID : audio_hid_desc.h
  • USBD_CDC_BULK_IN_EPT : cdc_class.h, cdc_msc_class.h
  • USBD_CDC_BULK_OUT_EPT : cdc_class.h, cdc_msc_class.h
  • USBD_CDC_CMD_MAXPACKET_SIZE : cdc_class.h, cdc_msc_class.h
  • USBD_CDC_CONFIG_DESC_SIZE : cdc_desc.h
  • USBD_CDC_CS_ENDPOINT : usb_std.h
  • USBD_CDC_CS_INTERFACE : usb_std.h
  • USBD_CDC_DESC_CONFIGURATION_STRING : cdc_desc.h, cdc_msc_desc.h
  • USBD_CDC_DESC_INTERFACE_STRING : cdc_desc.h, cdc_msc_desc.h
  • USBD_CDC_DESC_MANUFACTURER_STRING : cdc_desc.h, cdc_msc_desc.h
  • USBD_CDC_DESC_PRODUCT_STRING : cdc_desc.h, cdc_msc_desc.h
  • USBD_CDC_IN_MAXPACKET_SIZE : cdc_class.h
  • USBD_CDC_INT_EPT : cdc_class.h, cdc_msc_class.h
  • USBD_CDC_MSC_CONFIG_DESC_SIZE : cdc_msc_desc.h
  • USBD_CDC_MSC_IN_MAXPACKET_SIZE : cdc_msc_class.h
  • USBD_CDC_MSC_OUT_MAXPACKET_SIZE : cdc_msc_class.h
  • USBD_CDC_MSC_PRODUCT_ID : cdc_msc_desc.h
  • USBD_CDC_MSC_VENDOR_ID : cdc_msc_desc.h
  • USBD_CDC_OUT_MAXPACKET_SIZE : cdc_class.h
  • USBD_CDC_PRODUCT_ID : cdc_desc.h
  • USBD_CDC_SIZ_STRING_LANGID : cdc_desc.h, cdc_msc_desc.h
  • USBD_CDC_SIZ_STRING_SERIAL : cdc_desc.h, cdc_msc_desc.h
  • USBD_CDC_SUBTYPE_ACM : usb_std.h
  • USBD_CDC_SUBTYPE_CMF : usb_std.h
  • USBD_CDC_SUBTYPE_HEADER : usb_std.h
  • USBD_CDC_SUBTYPE_UFD : usb_std.h
  • USBD_CDC_VENDOR_ID : cdc_desc.h
  • usbd_clear_feature() : usbd_sdr.c
  • usbd_clear_stall() : usbd_core.h, usbd_core.c
  • usbd_conn_state : usb_std.h
  • usbd_connect() : usbd_core.h, usbd_core.c
  • usbd_connect_state_get() : usbd_core.h, usbd_core.c
  • usbd_core_in_handler() : usbd_core.h, usbd_core.c
  • usbd_core_init() : usbd_core.h, usbd_core.c
  • usbd_core_out_handler() : usbd_core.h, usbd_core.c
  • usbd_core_setup_handler() : usbd_core.h, usbd_core.c
  • usbd_ctrl_recv() : usbd_core.h, usbd_core.c
  • usbd_ctrl_recv_status() : usbd_core.h, usbd_core.c
  • usbd_ctrl_send() : usbd_core.h, usbd_core.c
  • usbd_ctrl_send_status() : usbd_core.h, usbd_core.c
  • usbd_ctrl_unsupport() : usbd_core.h, usbd_core.c
  • USBD_CUSHID_CONFIG_DESC_SIZE : custom_hid_desc.h
  • USBD_CUSHID_DESC_CONFIGURATION_STRING : custom_hid_desc.h
  • USBD_CUSHID_DESC_INTERFACE_STRING : custom_hid_desc.h
  • USBD_CUSHID_DESC_MANUFACTURER_STRING : custom_hid_desc.h
  • USBD_CUSHID_DESC_PRODUCT_STRING : custom_hid_desc.h
  • USBD_CUSHID_PRODUCT_ID : custom_hid_desc.h
  • USBD_CUSHID_SIZ_REPORT_DESC : custom_hid_desc.h
  • USBD_CUSHID_SIZ_STRING_LANGID : custom_hid_desc.h
  • USBD_CUSHID_SIZ_STRING_SERIAL : custom_hid_desc.h
  • USBD_CUSHID_VENDOR_ID : custom_hid_desc.h
  • USBD_CUSTOM_HID_IN_EPT : custom_hid_class.h
  • USBD_CUSTOM_HID_OUT_EPT : custom_hid_class.h
  • USBD_CUSTOM_IN_MAXPACKET_SIZE : custom_hid_class.h
  • USBD_CUSTOM_OUT_MAXPACKET_SIZE : custom_hid_class.h
  • usbd_device_request() : usbd_sdr.h, usbd_sdr.c
  • usbd_disconnect() : usbd_core.h, usbd_core.c
  • usbd_endpoint_request() : usbd_sdr.h, usbd_sdr.c
  • usbd_enter_suspend() : usbd_core.h, usbd_core.c
  • usbd_ept_buf_auto_define() : usbd_core.h, usbd_core.c
  • usbd_ept_buf_custom_define() : usbd_core.h, usbd_core.c
  • usbd_ept_close() : usbd_core.h, usbd_core.c
  • usbd_ept_dbuffer_enable() : usbd_core.h, usbd_core.c
  • usbd_ept_defaut_init() : usbd_core.h, usbd_core.c
  • usbd_ept_loop_handler() : usbd_int.h, usbd_int.c
  • usbd_ept_open() : usbd_core.h, usbd_core.c
  • usbd_ept_recv() : usbd_core.h, usbd_core.c
  • usbd_ept_send() : usbd_core.h, usbd_core.c
  • usbd_eptn_handler() : usbd_int.h, usbd_int.c
  • USBD_ERR_EVENT : usbd_core.h
  • usbd_event_type : usbd_core.h
  • USBD_FS_WINUSB_MAXPACKET_SIZE : winusb_class.h
  • usbd_get_configuration() : usbd_sdr.c
  • usbd_get_descriptor() : usbd_sdr.c
  • usbd_get_recv_len() : usbd_core.h, usbd_core.c
  • usbd_get_status() : usbd_sdr.c
  • usbd_hid_iap_in_complete() : hid_iap_class.h, app_led3_toggle/src/hid_iap_user.c, app_led4_toggle/src/hid_iap_user.c, bootloader/src/hid_iap_user.c
  • usbd_hid_iap_process() : hid_iap_class.h, app_led3_toggle/src/hid_iap_user.c, app_led4_toggle/src/hid_iap_user.c, bootloader/src/hid_iap_user.c
  • USBD_HIDIAP_CONFIG_DESC_SIZE : hid_iap_desc.h
  • USBD_HIDIAP_DESC_CONFIGURATION_STRING : hid_iap_desc.h
  • USBD_HIDIAP_DESC_INTERFACE_STRING : hid_iap_desc.h
  • USBD_HIDIAP_DESC_MANUFACTURER_STRING : hid_iap_desc.h
  • USBD_HIDIAP_DESC_PRODUCT_STRING : hid_iap_desc.h
  • USBD_HIDIAP_IN_EPT : hid_iap_class.h
  • USBD_HIDIAP_IN_MAXPACKET_SIZE : hid_iap_class.h
  • USBD_HIDIAP_OUT_EPT : hid_iap_class.h
  • USBD_HIDIAP_OUT_MAXPACKET_SIZE : hid_iap_class.h
  • USBD_HIDIAP_PRODUCT_ID : hid_iap_desc.h
  • USBD_HIDIAP_SIZ_REPORT_DESC : hid_iap_desc.h
  • USBD_HIDIAP_SIZ_STRING_LANGID : hid_iap_desc.h
  • USBD_HIDIAP_SIZ_STRING_SERIAL : hid_iap_desc.h
  • USBD_HIDIAP_VENDOR_ID : hid_iap_desc.h
  • USBD_IN_MAXPACKET_SIZE : msc_class.h
  • usbd_int_to_unicode() : audio_desc.c, audio_hid_desc.c, cdc_desc.c, cdc_keyboard_desc.c, cdc_msc_desc.c, custom_hid_desc.c, hid_iap_desc.c, keyboard_desc.c, mouse_desc.c, msc_desc.c, printer_desc.c, winusb_desc.c
  • usbd_interface_request() : usbd_sdr.h, usbd_sdr.c
  • usbd_irq_handler() : usbd_int.h, usbd_int.c
  • USBD_KEYBOARD_CONFIG_DESC_SIZE : keyboard_desc.h
  • USBD_KEYBOARD_DESC_CONFIGURATION_STRING : keyboard_desc.h
  • USBD_KEYBOARD_DESC_INTERFACE_STRING : keyboard_desc.h
  • USBD_KEYBOARD_DESC_MANUFACTURER_STRING : keyboard_desc.h
  • USBD_KEYBOARD_DESC_PRODUCT_STRING : keyboard_desc.h
  • USBD_KEYBOARD_IN_EPT : keyboard_class.h
  • USBD_KEYBOARD_IN_MAXPACKET_SIZE : keyboard_class.h
  • USBD_KEYBOARD_OUT_MAXPACKET_SIZE : keyboard_class.h
  • USBD_KEYBOARD_PRODUCT_ID : keyboard_desc.h
  • USBD_KEYBOARD_SIZ_REPORT_DESC : keyboard_desc.h
  • USBD_KEYBOARD_SIZ_STRING_LANGID : keyboard_desc.h
  • USBD_KEYBOARD_SIZ_STRING_SERIAL : keyboard_desc.h
  • USBD_KEYBOARD_VENDOR_ID : keyboard_desc.h
  • USBD_MOUSE_CONFIG_DESC_SIZE : mouse_desc.h
  • USBD_MOUSE_DESC_CONFIGURATION_STRING : mouse_desc.h
  • USBD_MOUSE_DESC_INTERFACE_STRING : mouse_desc.h
  • USBD_MOUSE_DESC_MANUFACTURER_STRING : mouse_desc.h
  • USBD_MOUSE_DESC_PRODUCT_STRING : mouse_desc.h
  • USBD_MOUSE_IN_EPT : mouse_class.h
  • USBD_MOUSE_IN_MAXPACKET_SIZE : mouse_class.h
  • USBD_MOUSE_PRODUCT_ID : mouse_desc.h
  • USBD_MOUSE_SIZ_REPORT_DESC : mouse_desc.h
  • USBD_MOUSE_SIZ_STRING_LANGID : mouse_desc.h
  • USBD_MOUSE_SIZ_STRING_SERIAL : mouse_desc.h
  • USBD_MOUSE_VENDOR_ID : mouse_desc.h
  • USBD_MSC_BULK_IN_EPT : cdc_msc_class.h, msc_class.h
  • USBD_MSC_BULK_OUT_EPT : cdc_msc_class.h, msc_class.h
  • USBD_MSC_CONFIG_DESC_SIZE : msc_desc.h
  • USBD_MSC_DESC_CONFIGURATION_STRING : msc_desc.h
  • USBD_MSC_DESC_INTERFACE_STRING : msc_desc.h
  • USBD_MSC_DESC_MANUFACTURER_STRING : msc_desc.h
  • USBD_MSC_DESC_PRODUCT_STRING : msc_desc.h
  • USBD_MSC_PRODUCT_ID : msc_desc.h
  • USBD_MSC_SIZ_STRING_LANGID : msc_desc.h
  • USBD_MSC_SIZ_STRING_SERIAL : msc_desc.h
  • USBD_MSC_VENDOR_ID : msc_desc.h
  • USBD_NOP_EVENT : usbd_core.h
  • USBD_OUT_MAXPACKET_SIZE : msc_class.h
  • USBD_PRINTER_BULK_IN_EPT : printer_class.h
  • USBD_PRINTER_BULK_OUT_EPT : printer_class.h
  • USBD_PRINTER_CONFIG_DESC_SIZE : printer_desc.h
  • USBD_PRINTER_DESC_CONFIGURATION_STRING : printer_desc.h
  • USBD_PRINTER_DESC_INTERFACE_STRING : printer_desc.h
  • USBD_PRINTER_DESC_MANUFACTURER_STRING : printer_desc.h
  • USBD_PRINTER_DESC_PRODUCT_STRING : printer_desc.h
  • USBD_PRINTER_IN_MAXPACKET_SIZE : printer_class.h
  • USBD_PRINTER_OUT_MAXPACKET_SIZE : printer_class.h
  • USBD_PRINTER_PRODUCT_ID : printer_desc.h
  • USBD_PRINTER_SIZ_STRING_LANGID : printer_desc.h
  • USBD_PRINTER_SIZ_STRING_SERIAL : printer_desc.h
  • USBD_PRINTER_VENDOR_ID : printer_desc.h
  • usbd_remote_wakeup() : usbd_core.h, usbd_core.c
  • USBD_RESET_EVENT : usbd_core.h
  • usbd_reset_handler() : usbd_int.h, usbd_int.c
  • usbd_set_address() : usbd_sdr.c
  • usbd_set_configuration() : usbd_sdr.c
  • usbd_set_device_addr() : usbd_core.h, usbd_core.c
  • usbd_set_feature() : usbd_sdr.c
  • usbd_set_stall() : usbd_core.h, usbd_core.c
  • usbd_setup_request_parse() : usbd_sdr.h, usbd_sdr.c
  • usbd_sof_handler() : usbd_int.h, usbd_int.c
  • USBD_SUPPORT_WINUSB : project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h
  • USBD_SUSPEND_EVENT : usbd_core.h
  • usbd_suspend_handler() : usbd_int.h, usbd_int.c
  • usbd_unicode_convert() : audio_desc.c, audio_hid_desc.c, cdc_desc.c, cdc_keyboard_desc.c, cdc_msc_desc.c, custom_hid_desc.c, hid_iap_desc.c, keyboard_desc.c, mouse_desc.c, msc_desc.c, printer_desc.c, winusb_desc.c
  • USBD_VCPKYBRD_CDC_BULK_IN_EPT : cdc_keyboard_class.h
  • USBD_VCPKYBRD_CDC_BULK_OUT_EPT : cdc_keyboard_class.h
  • USBD_VCPKYBRD_CDC_INT_EPT : cdc_keyboard_class.h
  • USBD_VCPKYBRD_CMD_MAXPACKET_SIZE : cdc_keyboard_class.h
  • USBD_VCPKYBRD_CONFIG_DESC_SIZE : cdc_keyboard_desc.h
  • USBD_VCPKYBRD_DESC_CONFIGURATION_STRING : cdc_keyboard_desc.h
  • USBD_VCPKYBRD_DESC_INTERFACE_STRING : cdc_keyboard_desc.h
  • USBD_VCPKYBRD_DESC_MANUFACTURER_STRING : cdc_keyboard_desc.h
  • USBD_VCPKYBRD_DESC_PRODUCT_STRING : cdc_keyboard_desc.h
  • USBD_VCPKYBRD_HID_IN_EPT : cdc_keyboard_class.h
  • USBD_VCPKYBRD_HID_SIZ_REPORT_DESC : cdc_keyboard_desc.h
  • USBD_VCPKYBRD_IN_MAXPACKET_SIZE : cdc_keyboard_class.h
  • USBD_VCPKYBRD_OUT_MAXPACKET_SIZE : cdc_keyboard_class.h
  • USBD_VCPKYBRD_PRODUCT_ID : cdc_keyboard_desc.h
  • USBD_VCPKYBRD_SIZ_STRING_LANGID : cdc_keyboard_desc.h
  • USBD_VCPKYBRD_SIZ_STRING_SERIAL : cdc_keyboard_desc.h
  • USBD_VCPKYBRD_VENDOR_ID : cdc_keyboard_desc.h
  • USBD_WAKEUP_EVENT : usbd_core.h
  • usbd_wakeup_handler() : usbd_int.h, usbd_int.c
  • USBD_WINUSB_BULK_IN_EPT : winusb_class.h
  • USBD_WINUSB_BULK_OUT_EPT : winusb_class.h
  • USBD_WINUSB_CONFIG_DESC_SIZE : winusb_desc.h
  • USBD_WINUSB_DESC_CONFIGURATION_STRING : winusb_desc.h
  • USBD_WINUSB_DESC_INTERFACE_STRING : winusb_desc.h
  • USBD_WINUSB_DESC_MANUFACTURER_STRING : winusb_desc.h
  • USBD_WINUSB_DESC_PRODUCT_STRING : winusb_desc.h
  • USBD_WINUSB_IN_MAXPACKET_SIZE : winusb_class.h
  • USBD_WINUSB_OUT_MAXPACKET_SIZE : winusb_class.h
  • USBD_WINUSB_PRODUCT_ID : winusb_desc.h
  • USBD_WINUSB_SIZ_STRING_LANGID : winusb_desc.h
  • USBD_WINUSB_SIZ_STRING_SERIAL : winusb_desc.h
  • USBD_WINUSB_VENDOR_ID : winusb_desc.h
  • USBFS_BASE : at32f413.h
  • USBFS_H_CAN1_TX_IRQn : at32f413.h
  • USBFS_L_CAN1_RX0_IRQHandler() : project/at_start_f413/examples/acc/calibration/src/main.c, project/at_start_f413/examples/can/communication_mode/src/main.c, project/at_start_f413/examples/can/filter/src/main.c, project/at_start_f413/examples/can/loopback_mode/src/main.c, project/at_start_f413/examples/usb_device/audio/src/main.c, project/at_start_f413/examples/usb_device/composite_audio_hid/src/main.c, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/main.c, project/at_start_f413/examples/usb_device/composite_vcp_msc/src/main.c, project/at_start_f413/examples/usb_device/custom_hid/src/main.c, project/at_start_f413/examples/usb_device/keyboard/src/main.c, project/at_start_f413/examples/usb_device/mouse/src/main.c, project/at_start_f413/examples/usb_device/msc/src/main.c, project/at_start_f413/examples/usb_device/printer/src/main.c, project/at_start_f413/examples/usb_device/vcp_loopback/src/main.c, project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c, project/at_start_f413/examples/usb_device/winusb/src/main.c, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/main.c, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/main.c, utilities/at32f413_usb_iap_demo/source_code/bootloader/src/main.c
  • USBFS_L_CAN1_RX0_IRQn : at32f413.h
  • USBFS_MAPH_IRQn : at32f413.h
  • USBFS_MAPL_IRQn : at32f413.h
  • USBFSWakeUp_IRQn : at32f413.h
  • USD : at32f413_flash.h
  • USD_BASE : at32f413.h
  • USD_DEPSLP_NO_RST : at32f413_flash.h
  • USD_DEPSLP_RST : at32f413_flash.h
  • USD_STDBY_NO_RST : at32f413_flash.h
  • USD_STDBY_RST : at32f413_flash.h
  • USD_WDT_ATO_DISABLE : at32f413_flash.h
  • USD_WDT_ATO_ENABLE : at32f413_flash.h
  • USE_SLIB_FUNCTION : utilities/at32f413_slib_demo/project_l0/src/main.c
  • USE_STATIC_INIT : project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c
  • USER_BUTTON : at32f413_board.h
  • USER_BUTTON_CRM_CLK : at32f413_board.h
  • USER_BUTTON_PIN : at32f413_board.h
  • USER_BUTTON_PORT : at32f413_board.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- v -

  • var : project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c
  • variables : project/at_start_f413/examples/cortex_m4/bit_band/src/main.c
  • variables_addr : project/at_start_f413/examples/cortex_m4/bit_band/src/main.c
  • variables_bit_val : project/at_start_f413/examples/cortex_m4/bit_band/src/main.c
  • VARIABLES_GET_BIT : project/at_start_f413/examples/cortex_m4/bit_band/src/main.c
  • VARIABLES_RESET_BIT : project/at_start_f413/examples/cortex_m4/bit_band/src/main.c
  • VARIABLES_SET_BIT : project/at_start_f413/examples/cortex_m4/bit_band/src/main.c
  • vcp_keyboard_struct : cdc_keyboard_class.c
  • VCPKYBRD_BCD_NUM : cdc_keyboard_desc.h
  • VCPKYBRD_CDC_DATA_INTERFACE : cdc_keyboard_desc.h
  • VCPKYBRD_CDC_INTERFACE : cdc_keyboard_desc.h
  • VCPKYBRD_HID_BINTERVAL_TIME : cdc_keyboard_desc.h
  • VCPKYBRD_KEYBOARD_INTERFACE : cdc_keyboard_desc.h
  • VCPMSC_CDC_DATA_INTERFACE : cdc_msc_desc.h
  • VCPMSC_CDC_INTERFACE : cdc_msc_desc.h
  • VCPMSC_MSC_INTERFACE : cdc_msc_desc.h
  • VECT_TAB_OFFSET : system_at32f413.c
  • vmor_flag_index : project/at_start_f413/examples/adc/voltage_monitoring/src/main.c
  • vp_desc : audio_desc.c, audio_hid_desc.c, cdc_desc.c, cdc_keyboard_desc.c, cdc_msc_desc.c, custom_hid_desc.c, hid_iap_desc.c, keyboard_desc.c, mouse_desc.c, msc_desc.c, printer_desc.c, winusb_desc.c
  • vPortSVCHandler : FreeRTOSConfig.h
  • vs16 : at32f413.h
  • vs32 : at32f413.h
  • vs8 : at32f413.h
  • vsc16 : at32f413.h
  • vsc32 : at32f413.h
  • vsc8 : at32f413.h
  • vu16 : at32f413.h
  • vu32 : at32f413.h
  • vu8 : at32f413.h
  • vuc16 : at32f413.h
  • vuc32 : at32f413.h
  • vuc8 : at32f413.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- w -

  • W25Q128 : spi_flash.h
  • W25Q16 : spi_flash.h
  • W25Q32 : spi_flash.h
  • W25Q64 : spi_flash.h
  • W25Q80 : spi_flash.h
  • WDT : at32f413_wdt.h
  • WDT_BASE : at32f413.h
  • WDT_CLK_DIV_128 : at32f413_wdt.h
  • WDT_CLK_DIV_16 : at32f413_wdt.h
  • WDT_CLK_DIV_256 : at32f413_wdt.h
  • WDT_CLK_DIV_32 : at32f413_wdt.h
  • WDT_CLK_DIV_4 : at32f413_wdt.h
  • WDT_CLK_DIV_64 : at32f413_wdt.h
  • WDT_CLK_DIV_8 : at32f413_wdt.h
  • WDT_CMD_ENABLE : at32f413_wdt.h
  • WDT_CMD_LOCK : at32f413_wdt.h
  • WDT_CMD_RELOAD : at32f413_wdt.h
  • WDT_CMD_UNLOCK : at32f413_wdt.h
  • wdt_cmd_value_type : at32f413_wdt.h
  • wdt_counter_reload() : at32f413_wdt.h, at32f413_wdt.c
  • WDT_DIVF_UPDATE_FLAG : at32f413_wdt.h
  • wdt_divider_set() : at32f413_wdt.h, at32f413_wdt.c
  • wdt_division_type : at32f413_wdt.h
  • wdt_enable() : at32f413_wdt.h, at32f413_wdt.c
  • wdt_flag_get() : at32f413_wdt.h, at32f413_wdt.c
  • WDT_MODULE_ENABLED : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • wdt_register_write_enable() : at32f413_wdt.h, at32f413_wdt.c
  • wdt_reload_value_set() : at32f413_wdt.h, at32f413_wdt.c
  • WDT_RLDF_UPDATE_FLAG : at32f413_wdt.h
  • weekday_table : project/at_start_f413/examples/rtc/calendar/src/main.c
  • WINUSB_BMS_VENDOR_CODE : winusb_class.h
  • winusb_class_handler : winusb_class.c, winusb_class.h
  • winusb_desc_handler : winusb_desc.c, winusb_desc.h
  • winusb_struct : winusb_class.c
  • winusb_struct_init() : winusb_class.c
  • WM8988_I2C_ADDR_CSB_HIGH : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_I2C_ADDR_CSB_LOW : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R0_LEFT_INPUT_VOLUME : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R10_LEFT_DAC_VOLUME : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R11_RIGHT_DAC_VOLUME : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R12_BASS_CONTROL : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R13_TREBLE_CONTROL : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R14_ : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R15_RESET : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R16_3D_CONTROL : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R17_ALC1 : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R18_ALC2 : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R19_ALC3 : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R1_RIGHT_INPUT_VOLUME : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R20_NOISE_GATE : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R21_LEFT_ADC_VOLUME : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R22_RIGHT_ADC_VOLUME : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R23_ADDITIONAL_1_CONTROL : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R24_ADDITIONAL_2_CONTROL : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R25_PWR_1_MGMT : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R26_PWR_2_MGMT : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R27_ADDITIONAL_3_CONTROL : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R2_LOUT1_VOLUME : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R31_ADC_INPUT_MODE : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R32_ADC_L_SIGNAL_PATH : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R33_ADC_R_SIGNAL_PATH : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R34_LEFT_OUT_MIX_1 : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R35_LEFT_OUT_MIX_2 : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R36_RIGHT_OUT_MIX_1 : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R37_RIGHT_OUT_MIX_2 : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R38_RESERVED : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R39_RESERVED : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R3_ROUT1_VOLUME : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R40_LOUT2_VOLUME : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R41_ROUT2_VOLUME : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R42_RESERVED : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R43_LOW_POWER_PALYBACK : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R4_RESERVED : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R5_ADC_DAC_CONTROL : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R6_RESERVED : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R7_AUDIO_INTERFACE : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R8_SAMPLE_RATE : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R9_RESERVED : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_REG_BITW16 : audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • WM8988_REG_FREQ16K : audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • WM8988_REG_FREQ48K : audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • work : project/at_start_f413/examples/sdio/sdio_fatfs/src/main.c
  • write_buffer : operate_spim.c
  • WWDT : at32f413_wwdt.h
  • WWDT_BASE : at32f413.h
  • wwdt_counter_set() : at32f413_wwdt.h, at32f413_wwdt.c
  • wwdt_divider_set() : at32f413_wwdt.h, at32f413_wwdt.c
  • wwdt_division_type : at32f413_wwdt.h
  • WWDT_EN_BIT : at32f413_wwdt.h
  • wwdt_enable() : at32f413_wwdt.h, at32f413_wwdt.c
  • wwdt_flag_clear() : at32f413_wwdt.h, at32f413_wwdt.c
  • wwdt_flag_get() : at32f413_wwdt.h, at32f413_wwdt.c
  • wwdt_interrupt_enable() : at32f413_wwdt.h, at32f413_wwdt.c
  • wwdt_interrupt_flag_get() : at32f413_wwdt.h, at32f413_wwdt.c
  • WWDT_IRQn : at32f413.h
  • WWDT_MODULE_ENABLED : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • WWDT_PCLK1_DIV_16384 : at32f413_wwdt.h
  • WWDT_PCLK1_DIV_32768 : at32f413_wwdt.h
  • WWDT_PCLK1_DIV_4096 : at32f413_wwdt.h
  • WWDT_PCLK1_DIV_8192 : at32f413_wwdt.h
  • wwdt_reset() : at32f413_wwdt.h, at32f413_wwdt.c
  • wwdt_window_counter_set() : at32f413_wwdt.h, at32f413_wwdt.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- x -

  • XMC_REG_BASE : at32f413.h
  • xPortPendSVHandler : FreeRTOSConfig.h
  • xPortSysTickHandler : FreeRTOSConfig.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- z -

  • ZOOM : project/at_start_f413/examples/cortex_m4/fpu/src/main.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all functions with links to the files they belong to:

- a -

  • acc_calibration_mode_enable() : at32f413_acc.h, at32f413_acc.c
  • acc_flag_clear() : at32f413_acc.h, at32f413_acc.c
  • acc_flag_get() : at32f413_acc.h, at32f413_acc.c
  • acc_hickcal_get() : at32f413_acc.h, at32f413_acc.c
  • acc_hicktrim_get() : at32f413_acc.h, at32f413_acc.c
  • acc_interrupt_enable() : at32f413_acc.h, at32f413_acc.c
  • acc_interrupt_flag_get() : at32f413_acc.h, at32f413_acc.c
  • ACC_IRQHandler() : project/at_start_f413/examples/acc/calibration/src/main.c
  • acc_read_c1() : at32f413_acc.h, at32f413_acc.c
  • acc_read_c2() : at32f413_acc.h, at32f413_acc.c
  • acc_read_c3() : at32f413_acc.h, at32f413_acc.c
  • acc_step_set() : at32f413_acc.h, at32f413_acc.c
  • acc_write_c1() : at32f413_acc.h, at32f413_acc.c
  • acc_write_c2() : at32f413_acc.h, at32f413_acc.c
  • acc_write_c3() : at32f413_acc.h, at32f413_acc.c
  • ADC1_2_IRQHandler() : project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c, project/at_start_f413/examples/adc/voltage_monitoring/src/main.c
  • adc_base_config() : at32f413_adc.h, at32f413_adc.c
  • adc_base_default_para_init() : at32f413_adc.h, at32f413_adc.c
  • adc_calibration_init() : at32f413_adc.h, at32f413_adc.c
  • adc_calibration_init_status_get() : at32f413_adc.h, at32f413_adc.c
  • adc_calibration_start() : at32f413_adc.h, at32f413_adc.c
  • adc_calibration_status_get() : at32f413_adc.h, at32f413_adc.c
  • adc_combine_mode_select() : at32f413_adc.h, at32f413_adc.c
  • adc_combine_ordinary_conversion_data_get() : at32f413_adc.h, at32f413_adc.c
  • adc_config() : project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/main.c, project/at_start_f413/examples/adc/current_vref_value_check/src/main.c, project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c, project/at_start_f413/examples/adc/internal_temperature_sensor/src/main.c, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/main.c, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c, project/at_start_f413/examples/adc/voltage_monitoring/src/main.c
  • adc_dma_mode_enable() : at32f413_adc.h, at32f413_adc.c
  • adc_enable() : at32f413_adc.h, at32f413_adc.c
  • adc_flag_clear() : at32f413_adc.h, at32f413_adc.c
  • adc_flag_get() : at32f413_adc.h, at32f413_adc.c
  • adc_interrupt_enable() : at32f413_adc.h, at32f413_adc.c
  • adc_interrupt_flag_get() : at32f413_adc.h, at32f413_adc.c
  • adc_ordinary_channel_set() : at32f413_adc.h, at32f413_adc.c
  • adc_ordinary_conversion_data_get() : at32f413_adc.h, at32f413_adc.c
  • adc_ordinary_conversion_trigger_set() : at32f413_adc.h, at32f413_adc.c
  • adc_ordinary_part_count_set() : at32f413_adc.h, at32f413_adc.c
  • adc_ordinary_part_mode_enable() : at32f413_adc.h, at32f413_adc.c
  • adc_ordinary_software_trigger_enable() : at32f413_adc.h, at32f413_adc.c
  • adc_ordinary_software_trigger_status_get() : at32f413_adc.h, at32f413_adc.c
  • adc_preempt_auto_mode_enable() : at32f413_adc.h, at32f413_adc.c
  • adc_preempt_channel_length_set() : at32f413_adc.h, at32f413_adc.c
  • adc_preempt_channel_set() : at32f413_adc.h, at32f413_adc.c
  • adc_preempt_conversion_data_get() : at32f413_adc.h, at32f413_adc.c
  • adc_preempt_conversion_trigger_set() : at32f413_adc.h, at32f413_adc.c
  • adc_preempt_offset_value_set() : at32f413_adc.h, at32f413_adc.c
  • adc_preempt_part_mode_enable() : at32f413_adc.h, at32f413_adc.c
  • adc_preempt_software_trigger_enable() : at32f413_adc.h, at32f413_adc.c
  • adc_preempt_software_trigger_status_get() : at32f413_adc.h, at32f413_adc.c
  • adc_reset() : at32f413_adc.h, at32f413_adc.c
  • adc_tempersensor_vintrv_enable() : at32f413_adc.h, at32f413_adc.c
  • adc_voltage_monitor_enable() : at32f413_adc.h, at32f413_adc.c
  • adc_voltage_monitor_single_channel_select() : at32f413_adc.h, at32f413_adc.c
  • adc_voltage_monitor_threshold_value_set() : at32f413_adc.h, at32f413_adc.c
  • alarm_init() : project/at_start_f413/examples/rtc/calendar/src/main.c
  • app_load() : bootloader/inc/iap.h, bootloader/src/iap.c
  • app_loop() : app_led3_toggle/inc/hid_iap_user.h, app_led3_toggle/src/hid_iap_user.c, app_led4_toggle/inc/hid_iap_user.h, app_led4_toggle/src/hid_iap_user.c
  • app_update_handle() : bootloader/src/iap.c
  • arm_apply_guard_bits() : project_l0/inc/math_helper.h, project_l0/src/math_helper.c, project_l1/inc/math_helper.h, project_l1/src/math_helper.c
  • arm_calc_2pow() : project_l0/inc/math_helper.h, project_l0/src/math_helper.c, project_l1/inc/math_helper.h, project_l1/src/math_helper.c
  • arm_calc_guard_bits() : project_l0/inc/math_helper.h, project_l0/src/math_helper.c, project_l1/inc/math_helper.h, project_l1/src/math_helper.c
  • arm_compare_fixed_q15() : project_l0/inc/math_helper.h, project_l0/src/math_helper.c, project_l1/inc/math_helper.h, project_l1/src/math_helper.c
  • arm_compare_fixed_q31() : project_l0/inc/math_helper.h, project_l0/src/math_helper.c, project_l1/inc/math_helper.h, project_l1/src/math_helper.c
  • arm_fir_f32() : project_l0/inc/fir_filter.h, project_l1/inc/fir_filter.h
  • arm_fir_init_f32() : project_l0/inc/fir_filter.h, arm_fir_init_f32.c, project_l1/inc/fir_filter.h
  • arm_float_to_q12_20() : project_l0/inc/math_helper.h, project_l0/src/math_helper.c, project_l1/inc/math_helper.h, project_l1/src/math_helper.c
  • arm_float_to_q14() : project_l0/inc/math_helper.h, project_l0/src/math_helper.c, project_l1/inc/math_helper.h, project_l1/src/math_helper.c
  • arm_float_to_q28() : project_l0/inc/math_helper.h, project_l0/src/math_helper.c, project_l1/inc/math_helper.h, project_l1/src/math_helper.c
  • arm_float_to_q29() : project_l0/inc/math_helper.h, project_l0/src/math_helper.c, project_l1/inc/math_helper.h, project_l1/src/math_helper.c
  • arm_float_to_q30() : project_l0/inc/math_helper.h, project_l0/src/math_helper.c, project_l1/inc/math_helper.h, project_l1/src/math_helper.c
  • arm_provide_guard_bits_q15() : project_l0/inc/math_helper.h, project_l0/src/math_helper.c, project_l1/inc/math_helper.h, project_l1/src/math_helper.c
  • arm_provide_guard_bits_q31() : project_l0/inc/math_helper.h, project_l0/src/math_helper.c, project_l1/inc/math_helper.h, project_l1/src/math_helper.c
  • arm_provide_guard_bits_q7() : project_l0/src/math_helper.c, project_l1/src/math_helper.c
  • arm_snr_f32() : project_l0/inc/math_helper.h, project_l0/src/math_helper.c, project_l1/inc/math_helper.h, project_l1/src/math_helper.c
  • at32_board_init() : at32f413_board.c, at32f413_board.h
  • at32_button_init() : at32f413_board.c, at32f413_board.h
  • at32_button_press() : at32f413_board.c, at32f413_board.h
  • at32_button_state() : at32f413_board.c, at32f413_board.h
  • at32_led_init() : at32f413_board.c, at32f413_board.h
  • at32_led_off() : at32f413_board.c, at32f413_board.h
  • at32_led_on() : at32f413_board.c, at32f413_board.h
  • at32_led_toggle() : at32f413_board.c, at32f413_board.h
  • audio_codec_init() : audio/inc/audio_codec.h, audio/src/audio_codec.c, composite_audio_hid/inc/audio_codec.h, composite_audio_hid/src/audio_codec.c
  • audio_codec_loop() : audio/inc/audio_codec.h, audio/src/audio_codec.c, composite_audio_hid/inc/audio_codec.h, composite_audio_hid/src/audio_codec.c
  • audio_codec_mic_alt_setting() : audio/inc/audio_codec.h, audio/src/audio_codec.c, composite_audio_hid/inc/audio_codec.h, composite_audio_hid/src/audio_codec.c
  • audio_codec_mic_get_data() : audio/inc/audio_codec.h, audio/src/audio_codec.c, composite_audio_hid/inc/audio_codec.h, composite_audio_hid/src/audio_codec.c
  • audio_codec_modify_freq() : audio/inc/audio_codec.h, audio/src/audio_codec.c, composite_audio_hid/inc/audio_codec.h, composite_audio_hid/src/audio_codec.c
  • audio_codec_set_mic_freq() : audio/inc/audio_codec.h, audio/src/audio_codec.c, composite_audio_hid/inc/audio_codec.h, composite_audio_hid/src/audio_codec.c
  • audio_codec_set_mic_mute() : audio/inc/audio_codec.h, audio/src/audio_codec.c, composite_audio_hid/inc/audio_codec.h, composite_audio_hid/src/audio_codec.c
  • audio_codec_set_mic_volume() : audio/inc/audio_codec.h, audio/src/audio_codec.c, composite_audio_hid/inc/audio_codec.h, composite_audio_hid/src/audio_codec.c
  • audio_codec_set_spk_freq() : audio/inc/audio_codec.h, audio/src/audio_codec.c, composite_audio_hid/inc/audio_codec.h, composite_audio_hid/src/audio_codec.c
  • audio_codec_set_spk_mute() : audio/inc/audio_codec.h, audio/src/audio_codec.c, composite_audio_hid/inc/audio_codec.h, composite_audio_hid/src/audio_codec.c
  • audio_codec_set_spk_volume() : audio/inc/audio_codec.h, audio/src/audio_codec.c, composite_audio_hid/inc/audio_codec.h, composite_audio_hid/src/audio_codec.c
  • audio_codec_spk_alt_setting() : audio/inc/audio_codec.h, audio/src/audio_codec.c, composite_audio_hid/inc/audio_codec.h, composite_audio_hid/src/audio_codec.c
  • audio_codec_spk_feedback() : audio/inc/audio_codec.h, audio/src/audio_codec.c, composite_audio_hid/inc/audio_codec.h, composite_audio_hid/src/audio_codec.c
  • audio_codec_spk_fifo_write() : audio/inc/audio_codec.h, audio/src/audio_codec.c, composite_audio_hid/inc/audio_codec.h, composite_audio_hid/src/audio_codec.c
  • audio_get_interface() : audio_class.c, audio_hid_class.c
  • audio_hid_class_send_report() : audio_hid_class.c, audio_hid_class.h
  • audio_req_get_cur() : audio_class.c, audio_hid_class.c
  • audio_req_get_max() : audio_class.c, audio_hid_class.c
  • audio_req_get_min() : audio_class.c, audio_hid_class.c
  • audio_req_get_res() : audio_class.c, audio_hid_class.c
  • audio_req_set_cur() : audio_class.c, audio_hid_class.c
  • audio_set_interface() : audio_class.c, audio_hid_class.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all functions with links to the files they belong to:

- b -

  • back_err() : app_led3_toggle/inc/usart.h, app_led3_toggle/src/usart.c, app_led4_toggle/inc/usart.h, app_led4_toggle/src/usart.c, bootloader/inc/iap.h, bootloader/src/iap.c
  • back_ok() : app_led3_toggle/inc/usart.h, app_led3_toggle/src/usart.c, app_led4_toggle/inc/usart.h, app_led4_toggle/src/usart.c, bootloader/inc/iap.h, bootloader/src/iap.c
  • bot_cbw_decode() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_allow_medium_removal() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_capacity() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_check_address() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_clear_feature() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_cmd_process() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_datain_handler() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_dataout_handler() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_format_capacity() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_init() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_inquiry() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_mode_sense10() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_mode_sense6() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_read10() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_request_sense() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_reset() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_send_csw() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_send_data() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_sense_code() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_stall() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_start_stop() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_test_unit() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_verify() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bot_scsi_write10() : cdc_msc_class.h, composite_cdc_msc/msc_bot_scsi.c, msc_bot_scsi.h
  • bpr_data_read() : at32f413_bpr.h, at32f413_bpr.c
  • bpr_data_write() : at32f413_bpr.h, at32f413_bpr.c
  • bpr_flag_clear() : at32f413_bpr.h, at32f413_bpr.c
  • bpr_flag_get() : at32f413_bpr.h, at32f413_bpr.c
  • bpr_interrupt_enable() : at32f413_bpr.h, at32f413_bpr.c
  • bpr_interrupt_flag_get() : at32f413_bpr.h, at32f413_bpr.c
  • bpr_reg_check() : project/at_start_f413/examples/bpr/bpr_data/src/main.c, project/at_start_f413/examples/bpr/tamper/src/main.c
  • bpr_reg_judge() : project/at_start_f413/examples/bpr/tamper/src/at32f413_int.c, project/at_start_f413/examples/bpr/tamper/src/main.c
  • bpr_reg_write() : project/at_start_f413/examples/bpr/bpr_data/src/main.c, project/at_start_f413/examples/bpr/tamper/src/main.c
  • bpr_reset() : at32f413_bpr.h, at32f413_bpr.c
  • bpr_rtc_clock_calibration_value_set() : at32f413_bpr.h, at32f413_bpr.c
  • bpr_rtc_output_select() : at32f413_bpr.h, at32f413_bpr.c
  • bpr_tamper_pin_active_level_set() : at32f413_bpr.h, at32f413_bpr.c
  • bpr_tamper_pin_enable() : at32f413_bpr.h, at32f413_bpr.c
  • buffer_compare() : project/at_start_f413/examples/dma/flash_to_sram/src/main.c, project/at_start_f413/examples/flash/flash_write_read/src/main.c, project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/communication_int/src/main.c, project/at_start_f413/examples/i2c/communication_poll/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c, project/at_start_f413/examples/i2s/halfduplex_dma/src/main.c, project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c, project/at_start_f413/examples/sdio/emmc_card/src/main.c, project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c, project/at_start_f413/examples/sdio/sdio_fatfs/src/main.c, project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/fullduplex_polling/src/main.c, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c, project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c, project/at_start_f413/examples/spi/w25q_flash/src/main.c, project/at_start_f413/examples/usart/half_duplex/src/main.c, project/at_start_f413/examples/usart/interrupt/src/main.c, project/at_start_f413/examples/usart/polling/src/main.c, project/at_start_f413/examples/usart/synchronous/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c
  • buffer_compare_24bits() : project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c
  • BusFault_Handler() : project/at_start_f413/examples/acc/calibration/inc/at32f413_int.h, project/at_start_f413/examples/acc/calibration/src/at32f413_int.c, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_int.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/at32f413_int.c, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_int.h, project/at_start_f413/examples/adc/current_vref_value_check/src/at32f413_int.c, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_int.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/src/at32f413_int.c, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_int.h, project/at_start_f413/examples/adc/internal_temperature_sensor/src/at32f413_int.c, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_int.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/at32f413_int.c, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_int.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/at32f413_int.c, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_int.h, project/at_start_f413/examples/adc/voltage_monitoring/src/at32f413_int.c, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_int.h, project/at_start_f413/examples/bpr/bpr_data/src/at32f413_int.c, project/at_start_f413/examples/bpr/tamper/inc/at32f413_int.h, project/at_start_f413/examples/bpr/tamper/src/at32f413_int.c, project/at_start_f413/examples/can/communication_mode/inc/at32f413_int.h, project/at_start_f413/examples/can/communication_mode/src/at32f413_int.c, project/at_start_f413/examples/can/filter/inc/at32f413_int.h, project/at_start_f413/examples/can/filter/src/at32f413_int.c, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_int.h, project/at_start_f413/examples/can/loopback_mode/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/bit_band/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/fpu/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_int.c, project/at_start_f413/examples/crc/calculation/inc/at32f413_int.h, project/at_start_f413/examples/crc/calculation/src/at32f413_int.c, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_int.h, project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_int.c, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_int.h, project/at_start_f413/examples/crm/sysclk_switch/src/at32f413_int.c, project/at_start_f413/examples/debug/tmr1/inc/at32f413_int.h, project/at_start_f413/examples/debug/tmr1/src/at32f413_int.c, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_int.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/src/at32f413_int.c, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_int.h, project/at_start_f413/examples/dma/flash_to_sram/src/at32f413_int.c, project/at_start_f413/examples/exint/exint_config/inc/at32f413_int.h, project/at_start_f413/examples/exint/exint_config/src/at32f413_int.c, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_int.h, project/at_start_f413/examples/exint/exint_software_trigger/src/at32f413_int.c, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_int.h, project/at_start_f413/examples/flash/flash_write_read/src/at32f413_int.c, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_int.h, project/at_start_f413/examples/flash/operate_spim/src/at32f413_int.c, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_int.h, project/at_start_f413/examples/flash/run_in_spim/src/at32f413_int.c, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_int.h, project/at_start_f413/examples/gpio/io_toggle/src/at32f413_int.c, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_int.h, project/at_start_f413/examples/gpio/led_toggle/src/at32f413_int.c, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_int.h, project/at_start_f413/examples/gpio/swjtag_remap/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_poll/src/at32f413_int.c, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_int.h, project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_int.h, project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_int.h, project/at_start_f413/examples/i2s/halfduplex_dma/src/at32f413_int.c, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/src/at32f413_int.c, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_int.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/at32f413_int.c, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_int.h, project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_int.c, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_int.h, project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_int.c, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_int.c, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_int.h, project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_int.h, project/at_start_f413/examples/pwc/standby_rtc/src/at32f413_int.c, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_int.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/src/at32f413_int.c, project/at_start_f413/examples/rtc/calendar/inc/at32f413_int.h, project/at_start_f413/examples/rtc/calendar/src/at32f413_int.c, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_int.h, project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_int.h, project/at_start_f413/examples/sdio/emmc_card/src/at32f413_int.c, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_int.h, project/at_start_f413/examples/sdio/sd_mmc_card/src/at32f413_int.c, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_int.h, project/at_start_f413/examples/sdio/sdio_fatfs/src/at32f413_int.c, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/crc_transfer_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_int.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/at32f413_int.c, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/fullduplex_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_interrupt/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/at32f413_int.c, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/only_receive_mode_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_int.h, project/at_start_f413/examples/spi/w25q_flash/src/at32f413_int.c, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_int.h, project/at_start_f413/examples/tmr/6_steps/src/at32f413_int.c, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_int.h, project/at_start_f413/examples/tmr/7_pwm_output/src/at32f413_int.c, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/cascade_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_int.h, project/at_start_f413/examples/tmr/complementary_signals/src/at32f413_int.c, project/at_start_f413/examples/tmr/dma/inc/at32f413_int.h, project/at_start_f413/examples/tmr/dma/src/at32f413_int.c, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_int.h, project/at_start_f413/examples/tmr/dma_burst/src/at32f413_int.c, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/tmr/encoder_tmr2/src/at32f413_int.c, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_int.h, project/at_start_f413/examples/tmr/external_clock/src/at32f413_int.c, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/src/at32f413_int.c, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_int.h, project/at_start_f413/examples/tmr/hang_mode/src/at32f413_int.c, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_int.h, project/at_start_f413/examples/tmr/input_capture/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_high/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_low/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_int.h, project/at_start_f413/examples/tmr/one_cycle/src/at32f413_int.c, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/parallel_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_input_dma/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_int.h, project/at_start_f413/examples/tmr/timer_base/src/at32f413_int.c, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/tmr1_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_int.h, project/at_start_f413/examples/tmr/tmr2_32bit/src/at32f413_int.c, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_int.h, project/at_start_f413/examples/usart/half_duplex/src/at32f413_int.c, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_int.h, project/at_start_f413/examples/usart/hw_flow_control/src/at32f413_int.c, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_int.h, project/at_start_f413/examples/usart/idle_detection/src/at32f413_int.c, project/at_start_f413/examples/usart/interrupt/inc/at32f413_int.h, project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/irda/inc/at32f413_int.h, project/at_start_f413/examples/usart/irda/src/at32f413_int.c, project/at_start_f413/examples/usart/polling/inc/at32f413_int.h, project/at_start_f413/examples/usart/polling/src/at32f413_int.c, project/at_start_f413/examples/usart/printf/inc/at32f413_int.h, project/at_start_f413/examples/usart/printf/src/at32f413_int.c, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_int.h, project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c, project/at_start_f413/examples/usart/rs485/inc/at32f413_int.h, project/at_start_f413/examples/usart/rs485/src/at32f413_int.c, project/at_start_f413/examples/usart/smartcard/inc/at32f413_int.h, project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c, project/at_start_f413/examples/usart/synchronous/inc/at32f413_int.h, project/at_start_f413/examples/usart/synchronous/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_int.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/src/at32f413_int.c, project/at_start_f413/examples/usb_device/audio/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/audio/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_audio_hid/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/src/at32f413_int.c, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/custom_hid/src/at32f413_int.c, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/keyboard/src/at32f413_int.c, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/mouse/src/at32f413_int.c, project/at_start_f413/examples/usb_device/msc/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/msc/src/at32f413_int.c, project/at_start_f413/examples/usb_device/printer/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/printer/src/at32f413_int.c, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/vcp_loopback/src/at32f413_int.c, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/src/at32f413_int.c, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/winusb/src/at32f413_int.c, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_int.h, project/at_start_f413/examples/wdt/wdt_reset/src/at32f413_int.c, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_int.h, project/at_start_f413/examples/wdt/wdt_standby/src/at32f413_int.c, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_int.h, project/at_start_f413/examples/wwdt/wwdt_reset/src/at32f413_int.c, project/at_start_f413/templates/src/at32f413_int.c, project/at_start_f413/templates/inc/at32f413_int.h, utilities/at32f413_freertos_demo/inc/at32f413_int.h, utilities/at32f413_freertos_demo/src/at32f413_int.c, utilities/at32f413_gen_random_number_demo/inc/at32f413_int.h, utilities/at32f413_gen_random_number_demo/src/at32f413_int.c, utilities/at32f413_slib_demo/project_l0/inc/at32f413_int.h, utilities/at32f413_slib_demo/project_l0/src/at32f413_int.c, utilities/at32f413_slib_demo/project_l1/inc/at32f413_int.h, utilities/at32f413_slib_demo/project_l1/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/src/at32f413_int.c
  • button_exint_init() : project/at_start_f413/examples/usb_device/keyboard/src/main.c, project/at_start_f413/examples/usb_device/mouse/src/main.c, project/at_start_f413/templates/src/main.c
  • button_isr() : project/at_start_f413/templates/src/main.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all functions with links to the files they belong to:

- c -

  • CAN1_SE_IRQHandler() : project/at_start_f413/examples/can/communication_mode/src/main.c, project/at_start_f413/examples/can/filter/src/main.c, project/at_start_f413/examples/can/loopback_mode/src/main.c
  • can_base_init() : at32f413_can.h, at32f413_can.c
  • can_baudrate_default_para_init() : at32f413_can.h, at32f413_can.c
  • can_baudrate_set() : at32f413_can.h, at32f413_can.c
  • can_configuration() : project/at_start_f413/examples/can/communication_mode/src/main.c, project/at_start_f413/examples/can/filter/src/main.c, project/at_start_f413/examples/can/loopback_mode/src/main.c
  • can_debug_transmission_prohibit() : at32f413_can.h, at32f413_can.c
  • can_default_para_init() : at32f413_can.h, at32f413_can.c
  • can_doze_mode_enter() : at32f413_can.h, at32f413_can.c
  • can_doze_mode_exit() : at32f413_can.h, at32f413_can.c
  • can_error_type_record_get() : at32f413_can.h, at32f413_can.c
  • can_filter_default_para_init() : at32f413_can.h, at32f413_can.c
  • can_filter_init() : at32f413_can.h, at32f413_can.c
  • can_flag_clear() : at32f413_can.h, at32f413_can.c
  • can_flag_get() : at32f413_can.h, at32f413_can.c
  • can_gpio_config() : project/at_start_f413/examples/can/communication_mode/src/main.c, project/at_start_f413/examples/can/filter/src/main.c, project/at_start_f413/examples/can/loopback_mode/src/main.c
  • can_interrupt_enable() : at32f413_can.h, at32f413_can.c
  • can_interrupt_flag_get() : at32f413_can.h, at32f413_can.c
  • can_message_receive() : at32f413_can.h, at32f413_can.c
  • can_message_transmit() : at32f413_can.h, at32f413_can.c
  • can_operating_mode_set() : at32f413_can.h, at32f413_can.c
  • can_receive_error_counter_get() : at32f413_can.h, at32f413_can.c
  • can_receive_fifo_release() : at32f413_can.h, at32f413_can.c
  • can_receive_message_pending_get() : at32f413_can.h, at32f413_can.c
  • can_reset() : at32f413_can.h, at32f413_can.c
  • can_transmit_cancel() : at32f413_can.h, at32f413_can.c
  • can_transmit_data() : project/at_start_f413/examples/can/communication_mode/src/main.c, project/at_start_f413/examples/can/filter/src/main.c, project/at_start_f413/examples/can/loopback_mode/src/main.c
  • can_transmit_error_counter_get() : at32f413_can.h, at32f413_can.c
  • can_transmit_status_get() : at32f413_can.h, at32f413_can.c
  • can_ttc_mode_enable() : at32f413_can.h, at32f413_can.c
  • cdc_class_setup_handler() : cdc_keyboard_class.c, cdc_msc_class.c
  • cdc_struct_init() : cdc_class.c, cdc_msc_class.c
  • check_card_programming() : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • class_audio_setup_handler() : audio_hid_class.c
  • class_clear_handler() : audio_class.c, audio_hid_class.c, cdc_class.c, cdc_keyboard_class.c, cdc_msc_class.c, custom_hid_class.c, hid_iap_class.c, keyboard_class.c, mouse_class.c, msc_class.c, printer_class.c, winusb_class.c
  • class_ept0_rx_handler() : audio_class.c, audio_hid_class.c, cdc_class.c, cdc_keyboard_class.c, cdc_msc_class.c, custom_hid_class.c, hid_iap_class.c, keyboard_class.c, mouse_class.c, msc_class.c, printer_class.c, winusb_class.c
  • class_ept0_tx_handler() : audio_class.c, audio_hid_class.c, cdc_class.c, cdc_keyboard_class.c, cdc_msc_class.c, custom_hid_class.c, hid_iap_class.c, keyboard_class.c, mouse_class.c, msc_class.c, printer_class.c, winusb_class.c
  • class_event_handler() : audio_class.c, audio_hid_class.c, cdc_class.c, cdc_keyboard_class.c, cdc_msc_class.c, custom_hid_class.c, hid_iap_class.c, keyboard_class.c, mouse_class.c, msc_class.c, printer_class.c, winusb_class.c
  • class_hid_setup_handler() : audio_hid_class.c
  • class_in_handler() : audio_class.c, audio_hid_class.c, cdc_class.c, cdc_keyboard_class.c, cdc_msc_class.c, custom_hid_class.c, hid_iap_class.c, keyboard_class.c, mouse_class.c, msc_class.c, printer_class.c, winusb_class.c
  • class_init_handler() : audio_class.c, audio_hid_class.c, cdc_class.c, cdc_keyboard_class.c, cdc_msc_class.c, custom_hid_class.c, hid_iap_class.c, keyboard_class.c, mouse_class.c, msc_class.c, printer_class.c, winusb_class.c
  • class_out_handler() : audio_class.c, audio_hid_class.c, cdc_class.c, cdc_keyboard_class.c, cdc_msc_class.c, custom_hid_class.c, hid_iap_class.c, keyboard_class.c, mouse_class.c, msc_class.c, printer_class.c, winusb_class.c
  • class_setup_handler() : audio_class.c, audio_hid_class.c, cdc_class.c, cdc_keyboard_class.c, cdc_msc_class.c, custom_hid_class.c, hid_iap_class.c, keyboard_class.c, mouse_class.c, msc_class.c, printer_class.c, winusb_class.c
  • class_sof_handler() : audio_class.c, audio_hid_class.c, cdc_class.c, cdc_keyboard_class.c, cdc_msc_class.c, custom_hid_class.c, hid_iap_class.c, keyboard_class.c, mouse_class.c, msc_class.c, printer_class.c, winusb_class.c
  • clkout_config() : project/at_start_f413/examples/acc/calibration/src/main.c, project/at_start_f413/examples/crm/clock_failure_detection/src/main.c, project/at_start_f413/examples/crm/sysclk_switch/src/main.c, project/at_start_f413/examples/tmr/timer_base/src/main.c
  • clock_failure_detection_handler() : project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_int.c, project/at_start_f413/examples/crm/clock_failure_detection/src/main.c
  • codec_i2s_init() : audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • codec_i2s_reset() : audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • command_error() : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • command_handle() : bootloader/inc/iap.h, bootloader/src/iap.c
  • command_rsp1_error() : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • command_rsp2_error() : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • command_rsp3_error() : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • command_rsp4_error() : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • command_rsp5_error() : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • command_rsp6_error() : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • command_rsp7_error() : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • config_flash_interrupt() : utilities/at32f413_slib_demo/project_l0/src/main.c, utilities/at32f413_slib_demo/project_l1/src/main.c
  • convert_from_bytes_to_power_of_two() : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • copy_buff() : audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • crc_block_calculate() : at32f413_crc.h, at32f413_crc.c
  • crc_cal() : app_led3_toggle/src/hid_iap_user.c, app_led4_toggle/src/hid_iap_user.c, bootloader/src/hid_iap_user.c
  • crc_common_data_get() : at32f413_crc.h, at32f413_crc.c
  • crc_common_data_set() : at32f413_crc.h, at32f413_crc.c
  • crc_data_get() : at32f413_crc.h, at32f413_crc.c
  • crc_data_reset() : at32f413_crc.h, at32f413_crc.c
  • crc_init_data_set() : at32f413_crc.h, at32f413_crc.c
  • crc_one_word_calculate() : at32f413_crc.h, at32f413_crc.c
  • crc_poly_size_get() : at32f413_crc.h, at32f413_crc.c
  • crc_poly_size_set() : at32f413_crc.h, at32f413_crc.c
  • crc_poly_value_get() : at32f413_crc.h, at32f413_crc.c
  • crc_poly_value_set() : at32f413_crc.h, at32f413_crc.c
  • crc_reverse_input_data_set() : at32f413_crc.h, at32f413_crc.c
  • crc_reverse_output_data_set() : at32f413_crc.h, at32f413_crc.c
  • crm_adc_clock_div_set() : at32f413_crm.h, at32f413_crm.c
  • crm_ahb_div_set() : at32f413_crm.h, at32f413_crm.c
  • crm_apb1_div_set() : at32f413_crm.h, at32f413_crm.c
  • crm_apb2_div_set() : at32f413_crm.h, at32f413_crm.c
  • crm_auto_step_mode_enable() : at32f413_crm.h, at32f413_crm.c
  • crm_battery_powered_domain_reset() : at32f413_crm.h, at32f413_crm.c
  • crm_clkout_div_set() : at32f413_crm.h, at32f413_crm.c
  • crm_clkout_to_tmr10_enable() : at32f413_crm.h, at32f413_crm.c
  • crm_clock_failure_detection_enable() : at32f413_crm.h, at32f413_crm.c
  • crm_clock_out_set() : at32f413_crm.h, at32f413_crm.c
  • crm_clock_source_enable() : at32f413_crm.h, at32f413_crm.c
  • crm_clocks_freq_get() : at32f413_crm.h, at32f413_crm.c
  • crm_configuration() : project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/main.c, project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/main.c, project/at_start_f413/examples/tmr/one_cycle/src/main.c, project/at_start_f413/examples/tmr/parallel_synchro/src/main.c, project/at_start_f413/examples/tmr/pwm_input/src/main.c, project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c, project/at_start_f413/examples/tmr/pwm_output_simulate/src/main.c, project/at_start_f413/examples/tmr/pwm_output_tmr10/src/main.c, project/at_start_f413/examples/tmr/pwm_output_tmr3/src/main.c, project/at_start_f413/examples/tmr/tmr1_synchro/src/main.c, project/at_start_f413/examples/tmr/tmr2_32bit/src/main.c
  • crm_flag_clear() : at32f413_crm.h, at32f413_crm.c
  • crm_flag_get() : at32f413_crm.h, at32f413_crm.c
  • crm_hext_bypass() : at32f413_crm.h, at32f413_crm.c
  • crm_hext_stable_wait() : at32f413_crm.h, at32f413_crm.c
  • crm_hick_clock_calibration_set() : at32f413_crm.h, at32f413_crm.c
  • crm_hick_clock_trimming_set() : at32f413_crm.h, at32f413_crm.c
  • crm_hick_divider_select() : at32f413_crm.h, at32f413_crm.c
  • crm_hick_sclk_frequency_select() : at32f413_crm.h, at32f413_crm.c
  • crm_interrupt_enable() : at32f413_crm.h, at32f413_crm.c
  • crm_interrupt_flag_get() : at32f413_crm.h, at32f413_crm.c
  • crm_lext_bypass() : at32f413_crm.h, at32f413_crm.c
  • crm_periph_clock_enable() : at32f413_crm.h, at32f413_crm.c
  • crm_periph_reset() : at32f413_crm.h, at32f413_crm.c
  • crm_periph_sleep_mode_clock_enable() : at32f413_crm.h, at32f413_crm.c
  • crm_pll_config() : at32f413_crm.h, at32f413_crm.c
  • crm_reset() : at32f413_crm.h, at32f413_crm.c
  • crm_rtc_clock_enable() : at32f413_crm.h, at32f413_crm.c
  • crm_rtc_clock_select() : at32f413_crm.h, at32f413_crm.c
  • crm_sysclk_switch() : at32f413_crm.h, at32f413_crm.c
  • crm_sysclk_switch_status_get() : at32f413_crm.h, at32f413_crm.c
  • crm_usb_clock_div_set() : at32f413_crm.h, at32f413_crm.c
  • crm_usb_clock_source_select() : at32f413_crm.h, at32f413_crm.c
  • crm_usb_interrupt_remapping_set() : at32f413_crm.h, at32f413_crm.c
  • custom_hid_class_send_report() : custom_hid_class.c, custom_hid_class.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all functions with links to the files they belong to:

- d -

  • data_take() : bootloader/src/iap.c
  • debug_device_id_get() : at32f413_debug.h, at32f413_debug.c
  • debug_periph_mode_set() : at32f413_debug.h, at32f413_debug.c
  • DebugMon_Handler() : project/at_start_f413/examples/acc/calibration/inc/at32f413_int.h, project/at_start_f413/examples/acc/calibration/src/at32f413_int.c, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_int.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/at32f413_int.c, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_int.h, project/at_start_f413/examples/adc/current_vref_value_check/src/at32f413_int.c, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_int.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/src/at32f413_int.c, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_int.h, project/at_start_f413/examples/adc/internal_temperature_sensor/src/at32f413_int.c, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_int.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/at32f413_int.c, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_int.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/at32f413_int.c, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_int.h, project/at_start_f413/examples/adc/voltage_monitoring/src/at32f413_int.c, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_int.h, project/at_start_f413/examples/bpr/bpr_data/src/at32f413_int.c, project/at_start_f413/examples/bpr/tamper/inc/at32f413_int.h, project/at_start_f413/examples/bpr/tamper/src/at32f413_int.c, project/at_start_f413/examples/can/communication_mode/inc/at32f413_int.h, project/at_start_f413/examples/can/communication_mode/src/at32f413_int.c, project/at_start_f413/examples/can/filter/inc/at32f413_int.h, project/at_start_f413/examples/can/filter/src/at32f413_int.c, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_int.h, project/at_start_f413/examples/can/loopback_mode/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/bit_band/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/fpu/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_int.c, project/at_start_f413/examples/crc/calculation/inc/at32f413_int.h, project/at_start_f413/examples/crc/calculation/src/at32f413_int.c, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_int.h, project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_int.c, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_int.h, project/at_start_f413/examples/crm/sysclk_switch/src/at32f413_int.c, project/at_start_f413/examples/debug/tmr1/inc/at32f413_int.h, project/at_start_f413/examples/debug/tmr1/src/at32f413_int.c, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_int.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/src/at32f413_int.c, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_int.h, project/at_start_f413/examples/dma/flash_to_sram/src/at32f413_int.c, project/at_start_f413/examples/exint/exint_config/inc/at32f413_int.h, project/at_start_f413/examples/exint/exint_config/src/at32f413_int.c, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_int.h, project/at_start_f413/examples/exint/exint_software_trigger/src/at32f413_int.c, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_int.h, project/at_start_f413/examples/flash/flash_write_read/src/at32f413_int.c, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_int.h, project/at_start_f413/examples/flash/operate_spim/src/at32f413_int.c, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_int.h, project/at_start_f413/examples/flash/run_in_spim/src/at32f413_int.c, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_int.h, project/at_start_f413/examples/gpio/io_toggle/src/at32f413_int.c, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_int.h, project/at_start_f413/examples/gpio/led_toggle/src/at32f413_int.c, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_int.h, project/at_start_f413/examples/gpio/swjtag_remap/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_poll/src/at32f413_int.c, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_int.h, project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_int.h, project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_int.h, project/at_start_f413/examples/i2s/halfduplex_dma/src/at32f413_int.c, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/src/at32f413_int.c, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_int.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/at32f413_int.c, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_int.h, project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_int.c, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_int.h, project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_int.c, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_int.c, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_int.h, project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_int.h, project/at_start_f413/examples/pwc/standby_rtc/src/at32f413_int.c, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_int.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/src/at32f413_int.c, project/at_start_f413/examples/rtc/calendar/inc/at32f413_int.h, project/at_start_f413/examples/rtc/calendar/src/at32f413_int.c, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_int.h, project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_int.h, project/at_start_f413/examples/sdio/emmc_card/src/at32f413_int.c, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_int.h, project/at_start_f413/examples/sdio/sd_mmc_card/src/at32f413_int.c, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_int.h, project/at_start_f413/examples/sdio/sdio_fatfs/src/at32f413_int.c, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/crc_transfer_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_int.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/at32f413_int.c, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/fullduplex_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_interrupt/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/at32f413_int.c, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/only_receive_mode_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_int.h, project/at_start_f413/examples/spi/w25q_flash/src/at32f413_int.c, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_int.h, project/at_start_f413/examples/tmr/6_steps/src/at32f413_int.c, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_int.h, project/at_start_f413/examples/tmr/7_pwm_output/src/at32f413_int.c, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/cascade_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_int.h, project/at_start_f413/examples/tmr/complementary_signals/src/at32f413_int.c, project/at_start_f413/examples/tmr/dma/inc/at32f413_int.h, project/at_start_f413/examples/tmr/dma/src/at32f413_int.c, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_int.h, project/at_start_f413/examples/tmr/dma_burst/src/at32f413_int.c, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/tmr/encoder_tmr2/src/at32f413_int.c, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_int.h, project/at_start_f413/examples/tmr/external_clock/src/at32f413_int.c, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/src/at32f413_int.c, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_int.h, project/at_start_f413/examples/tmr/hang_mode/src/at32f413_int.c, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_int.h, project/at_start_f413/examples/tmr/input_capture/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_high/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_low/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_int.h, project/at_start_f413/examples/tmr/one_cycle/src/at32f413_int.c, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/parallel_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_input_dma/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_int.h, project/at_start_f413/examples/tmr/timer_base/src/at32f413_int.c, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/tmr1_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_int.h, project/at_start_f413/examples/tmr/tmr2_32bit/src/at32f413_int.c, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_int.h, project/at_start_f413/examples/usart/half_duplex/src/at32f413_int.c, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_int.h, project/at_start_f413/examples/usart/hw_flow_control/src/at32f413_int.c, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_int.h, project/at_start_f413/examples/usart/idle_detection/src/at32f413_int.c, project/at_start_f413/examples/usart/interrupt/inc/at32f413_int.h, project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/irda/inc/at32f413_int.h, project/at_start_f413/examples/usart/irda/src/at32f413_int.c, project/at_start_f413/examples/usart/polling/inc/at32f413_int.h, project/at_start_f413/examples/usart/polling/src/at32f413_int.c, project/at_start_f413/examples/usart/printf/inc/at32f413_int.h, project/at_start_f413/examples/usart/printf/src/at32f413_int.c, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_int.h, project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c, project/at_start_f413/examples/usart/rs485/inc/at32f413_int.h, project/at_start_f413/examples/usart/rs485/src/at32f413_int.c, project/at_start_f413/examples/usart/smartcard/inc/at32f413_int.h, project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c, project/at_start_f413/examples/usart/synchronous/inc/at32f413_int.h, project/at_start_f413/examples/usart/synchronous/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_int.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/src/at32f413_int.c, project/at_start_f413/examples/usb_device/audio/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/audio/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_audio_hid/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/src/at32f413_int.c, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/custom_hid/src/at32f413_int.c, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/keyboard/src/at32f413_int.c, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/mouse/src/at32f413_int.c, project/at_start_f413/examples/usb_device/msc/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/msc/src/at32f413_int.c, project/at_start_f413/examples/usb_device/printer/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/printer/src/at32f413_int.c, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/vcp_loopback/src/at32f413_int.c, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/src/at32f413_int.c, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/winusb/src/at32f413_int.c, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_int.h, project/at_start_f413/examples/wdt/wdt_reset/src/at32f413_int.c, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_int.h, project/at_start_f413/examples/wdt/wdt_standby/src/at32f413_int.c, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_int.h, project/at_start_f413/examples/wwdt/wwdt_reset/src/at32f413_int.c, project/at_start_f413/templates/src/at32f413_int.c, project/at_start_f413/templates/inc/at32f413_int.h, utilities/at32f413_freertos_demo/inc/at32f413_int.h, utilities/at32f413_freertos_demo/src/at32f413_int.c, utilities/at32f413_gen_random_number_demo/inc/at32f413_int.h, utilities/at32f413_gen_random_number_demo/src/at32f413_int.c, utilities/at32f413_slib_demo/project_l0/inc/at32f413_int.h, utilities/at32f413_slib_demo/project_l0/src/at32f413_int.c, utilities/at32f413_slib_demo/project_l1/inc/at32f413_int.h, utilities/at32f413_slib_demo/project_l1/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/src/at32f413_int.c
  • delay() : project/at_start_f413/examples/tmr/encoder_tmr2/src/main.c
  • delay_init() : at32f413_board.c, at32f413_board.h
  • delay_ms() : at32f413_board.c, at32f413_board.h
  • delay_sec() : at32f413_board.c, at32f413_board.h
  • delay_us() : at32f413_board.c, at32f413_board.h
  • disk_initialize() : diskio.c
  • disk_ioctl() : diskio.c
  • disk_read() : diskio.c
  • disk_status() : diskio.c
  • disk_write() : diskio.c
  • DMA1_Channel1_IRQHandler() : project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/main.c, project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/main.c, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c, project/at_start_f413/examples/dma/flash_to_sram/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c
  • DMA1_Channel2_IRQHandler() : project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c
  • DMA1_Channel3_IRQHandler() : project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c, audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • DMA1_Channel4_IRQHandler() : project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c, project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c, audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • DMA1_Channel5_IRQHandler() : project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c, project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c
  • DMA1_Channel6_IRQHandler() : project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c
  • DMA1_Channel7_IRQHandler() : project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c
  • DMA2_Channel1_IRQHandler() : project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c
  • dma_channel_enable() : at32f413_dma.h, at32f413_dma.c
  • dma_config() : project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/main.c, project/at_start_f413/examples/adc/current_vref_value_check/src/main.c, project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c, project/at_start_f413/examples/adc/internal_temperature_sensor/src/main.c, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/main.c, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c, project/at_start_f413/examples/adc/voltage_monitoring/src/main.c, project/at_start_f413/examples/i2s/halfduplex_dma/src/main.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c
  • dma_configuration() : project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c
  • dma_data_number_get() : at32f413_dma.h, at32f413_dma.c
  • dma_data_number_set() : at32f413_dma.h, at32f413_dma.c
  • dma_default_para_init() : at32f413_dma.h, at32f413_dma.c
  • dma_flag_clear() : at32f413_dma.h, at32f413_dma.c
  • dma_flag_get() : at32f413_dma.h, at32f413_dma.c
  • dma_flexible_config() : at32f413_dma.h, at32f413_dma.c
  • dma_init() : at32f413_dma.h, at32f413_dma.c
  • dma_interrupt_enable() : at32f413_dma.h, at32f413_dma.c
  • dma_interrupt_flag_get() : at32f413_dma.h, at32f413_dma.c
  • dma_reset() : at32f413_dma.h, at32f413_dma.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all functions with links to the files they belong to:

- e -

  • eeprom_read_buffer() : eeprom.h, eeprom.c
  • eeprom_ready_check() : eeprom.c
  • eeprom_ready_wait() : eeprom.c
  • eeprom_write_buffer() : eeprom.h, eeprom.c
  • eeprom_write_page() : eeprom.c
  • error_handler() : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/communication_int/src/main.c, project/at_start_f413/examples/i2c/communication_poll/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c
  • EXINT0_IRQHandler() : project/at_start_f413/examples/exint/exint_config/src/main.c, project/at_start_f413/templates/src/main.c
  • EXINT4_IRQHandler() : project/at_start_f413/examples/exint/exint_software_trigger/src/main.c
  • EXINT9_5_IRQHandler() : project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c
  • exint_config() : project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c
  • exint_default_para_init() : at32f413_exint.h, at32f413_exint.c
  • exint_event_enable() : at32f413_exint.h, at32f413_exint.c
  • exint_flag_clear() : at32f413_exint.h, at32f413_exint.c
  • exint_flag_get() : at32f413_exint.h, at32f413_exint.c
  • exint_init() : at32f413_exint.h, at32f413_exint.c
  • exint_interrupt_enable() : at32f413_exint.h, at32f413_exint.c
  • exint_interrupt_flag_get() : at32f413_exint.h, at32f413_exint.c
  • exint_line0_config() : project/at_start_f413/examples/exint/exint_config/src/main.c
  • exint_line4_config() : project/at_start_f413/examples/exint/exint_software_trigger/src/main.c
  • exint_reset() : at32f413_exint.h, at32f413_exint.c
  • exint_software_interrupt_event_generate() : at32f413_exint.h, at32f413_exint.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all functions with links to the files they belong to:

- f -

  • fat16_memory_cmp() : flash_fat16.c
  • fat16_memory_copy() : flash_fat16.c
  • fat16_memory_memset() : flash_fat16.c
  • fatfs_test() : project/at_start_f413/examples/sdio/sdio_fatfs/src/main.c
  • FIR_lowpass_filter() : project_l0/inc/fir_filter.h, fir_filter.c, project_l1/inc/fir_filter.h
  • flash_2kb_write() : utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/flash.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/src/flash.c
  • flash_byte_program() : at32f413_flash.h, at32f413_flash.c
  • flash_crc_calibrate() : at32f413_flash.h, at32f413_flash.c
  • flash_crc_check() : flash_fat16.c
  • flash_epp_set() : at32f413_flash.h, at32f413_flash.c
  • flash_epp_status_get() : at32f413_flash.h, at32f413_flash.c
  • flash_fap_enable() : at32f413_flash.h, at32f413_flash.c
  • flash_fap_status_get() : at32f413_flash.h, at32f413_flash.c
  • flash_fat16_addr_offset() : flash_fat16.c
  • flash_fat16_boot_dir_write() : flash_fat16.c
  • flash_fat16_clear_upgrade_flag() : flash_fat16.c
  • flash_fat16_get_upgrade_flag() : flash_fat16.h, flash_fat16.c
  • flash_fat16_init() : flash_fat16.h, flash_fat16.c
  • flash_fat16_loop_status() : flash_fat16.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c
  • flash_fat16_read() : flash_fat16.h, flash_fat16.c
  • flash_fat16_sector_write() : flash_fat16.c
  • flash_fat16_set_name() : flash_fat16.h, flash_fat16.c
  • flash_fat16_set_upgrade_flag() : flash_fat16.c
  • flash_fat16_write() : flash_fat16.h, flash_fat16.c
  • flash_flag_clear() : at32f413_flash.h, at32f413_flash.c
  • flash_flag_get() : at32f413_flash.h, at32f413_flash.c
  • flash_halfword_program() : at32f413_flash.h, at32f413_flash.c
  • flash_internal_all_erase() : at32f413_flash.h, at32f413_flash.c
  • flash_interrupt_enable() : at32f413_flash.h, at32f413_flash.c
  • FLASH_IRQHandler() : utilities/at32f413_slib_demo/project_l0/src/at32f413_int.c, utilities/at32f413_slib_demo/project_l1/src/at32f413_int.c
  • flash_lock() : at32f413_flash.h, at32f413_flash.c
  • flash_operation_status_get() : at32f413_flash.h, at32f413_flash.c
  • flash_operation_wait_for() : at32f413_flash.h, at32f413_flash.c
  • flash_read() : project/at_start_f413/examples/flash/flash_write_read/inc/flash.h, project/at_start_f413/examples/flash/flash_write_read/src/flash.c
  • flash_read_data() : flash_fat16.c
  • flash_sector_erase() : at32f413_flash.h, at32f413_flash.c
  • flash_slib_datastart_sector_get() : at32f413_flash.h, at32f413_flash.c
  • flash_slib_disable() : at32f413_flash.h, at32f413_flash.c
  • flash_slib_enable() : at32f413_flash.h, at32f413_flash.c
  • flash_slib_end_sector_get() : at32f413_flash.h, at32f413_flash.c
  • flash_slib_remaining_count_get() : at32f413_flash.h, at32f413_flash.c
  • flash_slib_start_sector_get() : at32f413_flash.h, at32f413_flash.c
  • flash_slib_state_get() : at32f413_flash.h, at32f413_flash.c
  • flash_spim_all_erase() : at32f413_flash.h, at32f413_flash.c
  • flash_spim_dummy_read() : at32f413_flash.h, at32f413_flash.c
  • flash_spim_encryption_range_set() : at32f413_flash.h, at32f413_flash.c
  • flash_spim_lock() : at32f413_flash.h, at32f413_flash.c
  • flash_spim_mass_program() : at32f413_flash.h, at32f413_flash.c
  • flash_spim_model_select() : at32f413_flash.h, at32f413_flash.c
  • flash_spim_operation_status_get() : at32f413_flash.h, at32f413_flash.c
  • flash_spim_operation_wait_for() : at32f413_flash.h, at32f413_flash.c
  • flash_spim_unlock() : at32f413_flash.h, at32f413_flash.c
  • flash_ssb_set() : at32f413_flash.h, at32f413_flash.c
  • flash_ssb_status_get() : at32f413_flash.h, at32f413_flash.c
  • flash_unlock() : at32f413_flash.h, at32f413_flash.c
  • flash_upgrade_flag_read() : utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/flash.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/src/flash.c
  • flash_user_system_data_erase() : at32f413_flash.h, at32f413_flash.c
  • flash_user_system_data_program() : at32f413_flash.h, at32f413_flash.c
  • flash_word_program() : at32f413_flash.h, at32f413_flash.c
  • flash_write() : project/at_start_f413/examples/flash/flash_write_read/inc/flash.h, project/at_start_f413/examples/flash/flash_write_read/src/flash.c
  • flash_write_data() : flash_fat16.c
  • flash_write_nocheck() : project/at_start_f413/examples/flash/flash_write_read/inc/flash.h, project/at_start_f413/examples/flash/flash_write_read/src/flash.c
  • fputc() : at32f413_board.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all functions with links to the files they belong to:

- g -

  • generate_julia_fpu() : julia_fpu.h, julia_fpu.c
  • get_device_config_string() : audio_desc.c, audio_hid_desc.c, cdc_desc.c, cdc_keyboard_desc.c, cdc_msc_desc.c, custom_hid_desc.c, hid_iap_desc.c, keyboard_desc.c, mouse_desc.c, msc_desc.c, printer_desc.c, winusb_desc.c
  • get_device_configuration() : audio_desc.c, audio_hid_desc.c, cdc_desc.c, cdc_keyboard_desc.c, cdc_msc_desc.c, custom_hid_desc.c, hid_iap_desc.c, keyboard_desc.c, mouse_desc.c, msc_desc.c, printer_desc.c, winusb_desc.c
  • get_device_descriptor() : audio_desc.c, audio_hid_desc.c, cdc_desc.c, cdc_keyboard_desc.c, cdc_msc_desc.c, custom_hid_desc.c, hid_iap_desc.c, keyboard_desc.c, mouse_desc.c, msc_desc.c, printer_desc.c, winusb_desc.c
  • get_device_interface_string() : audio_desc.c, audio_hid_desc.c, cdc_desc.c, cdc_keyboard_desc.c, cdc_msc_desc.c, custom_hid_desc.c, hid_iap_desc.c, keyboard_desc.c, mouse_desc.c, msc_desc.c, printer_desc.c, winusb_desc.c
  • get_device_lang_id() : audio_desc.c, audio_hid_desc.c, cdc_desc.c, cdc_keyboard_desc.c, cdc_msc_desc.c, custom_hid_desc.c, hid_iap_desc.c, keyboard_desc.c, mouse_desc.c, msc_desc.c, printer_desc.c, winusb_desc.c
  • get_device_manufacturer_string() : audio_desc.c, audio_hid_desc.c, cdc_desc.c, cdc_keyboard_desc.c, cdc_msc_desc.c, custom_hid_desc.c, hid_iap_desc.c, keyboard_desc.c, mouse_desc.c, msc_desc.c, printer_desc.c, winusb_desc.c
  • get_device_other_speed() : audio_desc.c, audio_hid_desc.c, cdc_desc.c, cdc_keyboard_desc.c, cdc_msc_desc.c, custom_hid_desc.c, hid_iap_desc.c, keyboard_desc.c, mouse_desc.c, msc_desc.c, printer_desc.c, winusb_desc.c
  • get_device_product_string() : audio_desc.c, audio_hid_desc.c, cdc_desc.c, cdc_keyboard_desc.c, cdc_msc_desc.c, custom_hid_desc.c, hid_iap_desc.c, keyboard_desc.c, mouse_desc.c, msc_desc.c, printer_desc.c, winusb_desc.c
  • get_device_qualifier() : audio_desc.c, audio_hid_desc.c, cdc_desc.c, cdc_keyboard_desc.c, cdc_msc_desc.c, custom_hid_desc.c, hid_iap_desc.c, keyboard_desc.c, mouse_desc.c, msc_desc.c, printer_desc.c, winusb_desc.c
  • get_device_serial_string() : audio_desc.c, audio_hid_desc.c, cdc_desc.c, cdc_keyboard_desc.c, cdc_msc_desc.c, custom_hid_desc.c, hid_iap_desc.c, keyboard_desc.c, mouse_desc.c, msc_desc.c, printer_desc.c, winusb_desc.c
  • get_ext_csd() : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • get_inquiry() : composite_vcp_msc/inc/msc_diskio.h, virtual_msc_iap/inc/msc_diskio.h
  • get_serial_num() : audio_desc.c, audio_hid_desc.c, cdc_desc.c, cdc_keyboard_desc.c, cdc_msc_desc.c, custom_hid_desc.c, hid_iap_desc.c, keyboard_desc.c, mouse_desc.c, msc_desc.c, printer_desc.c, winusb_desc.c
  • get_uid_for_seed() : random.c
  • getvar_operationcomplete() : project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c, project/at_start_f413/examples/rtc/lick_calibration/src/main.c
  • gpio_bits_reset() : at32f413_gpio.h, at32f413_gpio.c
  • gpio_bits_set() : at32f413_gpio.h, at32f413_gpio.c
  • gpio_bits_toggle() : at32f413_gpio.h, at32f413_gpio.c
  • gpio_bits_write() : at32f413_gpio.h, at32f413_gpio.c
  • gpio_config() : project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/main.c, project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/main.c, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c, project/at_start_f413/examples/adc/voltage_monitoring/src/main.c, project/at_start_f413/examples/gpio/io_toggle/src/main.c, project/at_start_f413/examples/i2s/halfduplex_dma/src/main.c, project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c, project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/fullduplex_polling/src/main.c, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c, project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c
  • gpio_configuration() : project/at_start_f413/examples/tmr/oc_high/src/main.c, project/at_start_f413/examples/tmr/oc_low/src/main.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/main.c, project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/main.c, project/at_start_f413/examples/tmr/one_cycle/src/main.c, project/at_start_f413/examples/tmr/parallel_synchro/src/main.c, project/at_start_f413/examples/tmr/pwm_input/src/main.c, project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c, project/at_start_f413/examples/tmr/pwm_output_simulate/src/main.c, project/at_start_f413/examples/tmr/pwm_output_tmr10/src/main.c, project/at_start_f413/examples/tmr/pwm_output_tmr3/src/main.c, project/at_start_f413/examples/tmr/tmr1_synchro/src/main.c, project/at_start_f413/examples/tmr/tmr2_32bit/src/main.c
  • gpio_default_para_init() : at32f413_gpio.h, at32f413_gpio.c
  • gpio_event_output_config() : at32f413_gpio.h, at32f413_gpio.c
  • gpio_event_output_enable() : at32f413_gpio.h, at32f413_gpio.c
  • gpio_exint_line_config() : at32f413_gpio.h, at32f413_gpio.c
  • gpio_init() : at32f413_gpio.h, at32f413_gpio.c
  • gpio_input_data_bit_read() : at32f413_gpio.h, at32f413_gpio.c
  • gpio_input_data_read() : at32f413_gpio.h, at32f413_gpio.c
  • gpio_iomux_reset() : at32f413_gpio.h, at32f413_gpio.c
  • gpio_output_data_bit_read() : at32f413_gpio.h, at32f413_gpio.c
  • gpio_output_data_read() : at32f413_gpio.h, at32f413_gpio.c
  • gpio_pin_remap_config() : at32f413_gpio.h, at32f413_gpio.c
  • gpio_pin_wp_config() : at32f413_gpio.h, at32f413_gpio.c
  • gpio_pins_toggle() : project/at_start_f413/examples/gpio/swjtag_remap/src/main.c
  • gpio_port_write() : at32f413_gpio.h, at32f413_gpio.c
  • gpio_reset() : at32f413_gpio.h, at32f413_gpio.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all functions with links to the files they belong to:

- h -

  • HardFault_Handler() : project/at_start_f413/examples/acc/calibration/inc/at32f413_int.h, project/at_start_f413/examples/acc/calibration/src/at32f413_int.c, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_int.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/at32f413_int.c, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_int.h, project/at_start_f413/examples/adc/current_vref_value_check/src/at32f413_int.c, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_int.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/src/at32f413_int.c, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_int.h, project/at_start_f413/examples/adc/internal_temperature_sensor/src/at32f413_int.c, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_int.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/at32f413_int.c, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_int.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/at32f413_int.c, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_int.h, project/at_start_f413/examples/adc/voltage_monitoring/src/at32f413_int.c, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_int.h, project/at_start_f413/examples/bpr/bpr_data/src/at32f413_int.c, project/at_start_f413/examples/bpr/tamper/inc/at32f413_int.h, project/at_start_f413/examples/bpr/tamper/src/at32f413_int.c, project/at_start_f413/examples/can/communication_mode/inc/at32f413_int.h, project/at_start_f413/examples/can/communication_mode/src/at32f413_int.c, project/at_start_f413/examples/can/filter/inc/at32f413_int.h, project/at_start_f413/examples/can/filter/src/at32f413_int.c, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_int.h, project/at_start_f413/examples/can/loopback_mode/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/bit_band/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/fpu/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_int.c, project/at_start_f413/examples/crc/calculation/inc/at32f413_int.h, project/at_start_f413/examples/crc/calculation/src/at32f413_int.c, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_int.h, project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_int.c, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_int.h, project/at_start_f413/examples/crm/sysclk_switch/src/at32f413_int.c, project/at_start_f413/examples/debug/tmr1/inc/at32f413_int.h, project/at_start_f413/examples/debug/tmr1/src/at32f413_int.c, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_int.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/src/at32f413_int.c, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_int.h, project/at_start_f413/examples/dma/flash_to_sram/src/at32f413_int.c, project/at_start_f413/examples/exint/exint_config/inc/at32f413_int.h, project/at_start_f413/examples/exint/exint_config/src/at32f413_int.c, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_int.h, project/at_start_f413/examples/exint/exint_software_trigger/src/at32f413_int.c, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_int.h, project/at_start_f413/examples/flash/flash_write_read/src/at32f413_int.c, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_int.h, project/at_start_f413/examples/flash/operate_spim/src/at32f413_int.c, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_int.h, project/at_start_f413/examples/flash/run_in_spim/src/at32f413_int.c, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_int.h, project/at_start_f413/examples/gpio/io_toggle/src/at32f413_int.c, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_int.h, project/at_start_f413/examples/gpio/led_toggle/src/at32f413_int.c, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_int.h, project/at_start_f413/examples/gpio/swjtag_remap/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_poll/src/at32f413_int.c, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_int.h, project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_int.h, project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_int.h, project/at_start_f413/examples/i2s/halfduplex_dma/src/at32f413_int.c, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/src/at32f413_int.c, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_int.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/at32f413_int.c, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_int.h, project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_int.c, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_int.h, project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_int.c, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_int.c, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_int.h, project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_int.h, project/at_start_f413/examples/pwc/standby_rtc/src/at32f413_int.c, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_int.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/src/at32f413_int.c, project/at_start_f413/examples/rtc/calendar/inc/at32f413_int.h, project/at_start_f413/examples/rtc/calendar/src/at32f413_int.c, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_int.h, project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_int.h, project/at_start_f413/examples/sdio/emmc_card/src/at32f413_int.c, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_int.h, project/at_start_f413/examples/sdio/sd_mmc_card/src/at32f413_int.c, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_int.h, project/at_start_f413/examples/sdio/sdio_fatfs/src/at32f413_int.c, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/crc_transfer_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_int.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/at32f413_int.c, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/fullduplex_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_interrupt/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/at32f413_int.c, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/only_receive_mode_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_int.h, project/at_start_f413/examples/spi/w25q_flash/src/at32f413_int.c, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_int.h, project/at_start_f413/examples/tmr/6_steps/src/at32f413_int.c, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_int.h, project/at_start_f413/examples/tmr/7_pwm_output/src/at32f413_int.c, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/cascade_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_int.h, project/at_start_f413/examples/tmr/complementary_signals/src/at32f413_int.c, project/at_start_f413/examples/tmr/dma/inc/at32f413_int.h, project/at_start_f413/examples/tmr/dma/src/at32f413_int.c, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_int.h, project/at_start_f413/examples/tmr/dma_burst/src/at32f413_int.c, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/tmr/encoder_tmr2/src/at32f413_int.c, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_int.h, project/at_start_f413/examples/tmr/external_clock/src/at32f413_int.c, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/src/at32f413_int.c, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_int.h, project/at_start_f413/examples/tmr/hang_mode/src/at32f413_int.c, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_int.h, project/at_start_f413/examples/tmr/input_capture/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_high/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_low/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_int.h, project/at_start_f413/examples/tmr/one_cycle/src/at32f413_int.c, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/parallel_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_input_dma/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_int.h, project/at_start_f413/examples/tmr/timer_base/src/at32f413_int.c, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/tmr1_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_int.h, project/at_start_f413/examples/tmr/tmr2_32bit/src/at32f413_int.c, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_int.h, project/at_start_f413/examples/usart/half_duplex/src/at32f413_int.c, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_int.h, project/at_start_f413/examples/usart/hw_flow_control/src/at32f413_int.c, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_int.h, project/at_start_f413/examples/usart/idle_detection/src/at32f413_int.c, project/at_start_f413/examples/usart/interrupt/inc/at32f413_int.h, project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/irda/inc/at32f413_int.h, project/at_start_f413/examples/usart/irda/src/at32f413_int.c, project/at_start_f413/examples/usart/polling/inc/at32f413_int.h, project/at_start_f413/examples/usart/polling/src/at32f413_int.c, project/at_start_f413/examples/usart/printf/inc/at32f413_int.h, project/at_start_f413/examples/usart/printf/src/at32f413_int.c, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_int.h, project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c, project/at_start_f413/examples/usart/rs485/inc/at32f413_int.h, project/at_start_f413/examples/usart/rs485/src/at32f413_int.c, project/at_start_f413/examples/usart/smartcard/inc/at32f413_int.h, project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c, project/at_start_f413/examples/usart/synchronous/inc/at32f413_int.h, project/at_start_f413/examples/usart/synchronous/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_int.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/src/at32f413_int.c, project/at_start_f413/examples/usb_device/audio/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/audio/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_audio_hid/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/src/at32f413_int.c, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/custom_hid/src/at32f413_int.c, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/keyboard/src/at32f413_int.c, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/mouse/src/at32f413_int.c, project/at_start_f413/examples/usb_device/msc/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/msc/src/at32f413_int.c, project/at_start_f413/examples/usb_device/printer/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/printer/src/at32f413_int.c, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/vcp_loopback/src/at32f413_int.c, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/src/at32f413_int.c, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/winusb/src/at32f413_int.c, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_int.h, project/at_start_f413/examples/wdt/wdt_reset/src/at32f413_int.c, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_int.h, project/at_start_f413/examples/wdt/wdt_standby/src/at32f413_int.c, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_int.h, project/at_start_f413/examples/wwdt/wwdt_reset/src/at32f413_int.c, project/at_start_f413/templates/src/at32f413_int.c, project/at_start_f413/templates/inc/at32f413_int.h, utilities/at32f413_freertos_demo/inc/at32f413_int.h, utilities/at32f413_freertos_demo/src/at32f413_int.c, utilities/at32f413_gen_random_number_demo/inc/at32f413_int.h, utilities/at32f413_gen_random_number_demo/src/at32f413_int.c, utilities/at32f413_slib_demo/project_l0/inc/at32f413_int.h, utilities/at32f413_slib_demo/project_l0/src/at32f413_int.c, utilities/at32f413_slib_demo/project_l1/inc/at32f413_int.h, utilities/at32f413_slib_demo/project_l1/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/src/at32f413_int.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all functions with links to the files they belong to:

- i -

  • I2C1_ERR_IRQHandler() : project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c
  • I2C1_EVT_IRQHandler() : project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c
  • I2C2_ERR_IRQHandler() : project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c, project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c
  • I2C2_EVT_IRQHandler() : project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c, project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c
  • i2c_7bit_address_send() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_ack_enable() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_arp_mode_enable() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_clock_stretch_enable() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_config() : i2c_application.c, i2c_application.h
  • i2c_data_receive() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_data_send() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_dma_config() : i2c_application.c
  • i2c_dma_enable() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_dma_end_transfer_set() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_dma_rx_irq_handler() : i2c_application.c, i2c_application.h
  • i2c_dma_tx_irq_handler() : i2c_application.c, i2c_application.h
  • i2c_enable() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_err_irq_handler() : i2c_application.c, i2c_application.h
  • i2c_evt_irq_handler() : i2c_application.c, i2c_application.h
  • i2c_fast_mode_duty_set() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_flag_clear() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_flag_get() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_general_call_enable() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_init() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_interrupt_enable() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_interrupt_flag_get() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_lowlevel_init() : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/communication_int/src/main.c, project/at_start_f413/examples/i2c/communication_poll/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c, audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c, i2c_application.c, i2c_application.h
  • i2c_master_read_addr() : i2c_application.c
  • i2c_master_receive() : i2c_application.c, i2c_application.h
  • i2c_master_receive_ack_set() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_master_receive_dma() : i2c_application.c, i2c_application.h
  • i2c_master_receive_int() : i2c_application.c, i2c_application.h
  • i2c_master_rx_isr_int() : i2c_application.c
  • i2c_master_transmit() : i2c_application.c, i2c_application.h
  • i2c_master_transmit_dma() : i2c_application.c, i2c_application.h
  • i2c_master_transmit_int() : i2c_application.c, i2c_application.h
  • i2c_master_tx_isr_dma() : i2c_application.c
  • i2c_master_tx_isr_int() : i2c_application.c
  • i2c_master_write_addr() : i2c_application.c
  • i2c_memory_address_send() : i2c_application.c
  • i2c_memory_read() : i2c_application.c, i2c_application.h
  • i2c_memory_read_dma() : i2c_application.c, i2c_application.h
  • i2c_memory_read_int() : i2c_application.c, i2c_application.h
  • i2c_memory_write() : i2c_application.c, i2c_application.h
  • i2c_memory_write_dma() : i2c_application.c, i2c_application.h
  • i2c_memory_write_int() : i2c_application.c, i2c_application.h
  • i2c_own_address1_set() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_own_address2_enable() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_own_address2_set() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_pec_calculate_enable() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_pec_position_set() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_pec_transmit_enable() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_pec_value_get() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_reset() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_slave_receive() : i2c_application.c, i2c_application.h
  • i2c_slave_receive_dma() : i2c_application.c, i2c_application.h
  • i2c_slave_receive_int() : i2c_application.c, i2c_application.h
  • i2c_slave_rx_isr_int() : i2c_application.c
  • i2c_slave_transmit() : i2c_application.c, i2c_application.h
  • i2c_slave_transmit_dma() : i2c_application.c, i2c_application.h
  • i2c_slave_transmit_int() : i2c_application.c, i2c_application.h
  • i2c_slave_tx_isr_int() : i2c_application.c
  • i2c_slave_tx_rx_isr_dma() : i2c_application.c
  • i2c_smbus_alert_set() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_smbus_enable() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_smbus_mode_set() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_software_reset() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_start_generate() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_stop_generate() : at32f413_i2c.h, at32f413_i2c.c
  • i2c_wait_end() : i2c_application.c, i2c_application.h
  • i2c_wait_flag() : i2c_application.c, i2c_application.h
  • i2s_config() : project/at_start_f413/examples/i2s/halfduplex_dma/src/main.c, project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c
  • i2s_default_para_init() : at32f413_spi.h, at32f413_spi.c
  • i2s_enable() : at32f413_spi.h, at32f413_spi.c
  • i2s_init() : at32f413_spi.h, at32f413_spi.c
  • iap_address() : bootloader/src/hid_iap_user.c
  • iap_clear_upgrade_flag() : app_led3_toggle/src/hid_iap_user.c, app_led4_toggle/src/hid_iap_user.c, bootloader/src/hid_iap_user.c
  • iap_command_handle() : app_led3_toggle/inc/iap.h, app_led3_toggle/src/iap.c, app_led4_toggle/inc/iap.h, app_led4_toggle/src/iap.c
  • iap_crc() : bootloader/src/hid_iap_user.c
  • iap_data_write() : bootloader/src/hid_iap_user.c
  • iap_erase_sector() : bootloader/src/hid_iap_user.c
  • iap_finish() : app_led3_toggle/src/hid_iap_user.c, app_led4_toggle/src/hid_iap_user.c, bootloader/src/hid_iap_user.c
  • iap_get() : app_led3_toggle/src/hid_iap_user.c, app_led4_toggle/src/hid_iap_user.c, bootloader/src/hid_iap_user.c
  • iap_get_upgrade_flag() : app_led3_toggle/inc/hid_iap_user.h, app_led3_toggle/src/hid_iap_user.c, app_led4_toggle/inc/hid_iap_user.h, app_led4_toggle/src/hid_iap_user.c, bootloader/inc/hid_iap_user.h, bootloader/src/hid_iap_user.c
  • iap_idle() : app_led3_toggle/src/hid_iap_user.c, app_led4_toggle/src/hid_iap_user.c, bootloader/src/hid_iap_user.c
  • iap_init() : app_led3_toggle/inc/iap.h, app_led3_toggle/src/iap.c, app_led4_toggle/inc/iap.h, app_led4_toggle/src/iap.c, app_led3_toggle/inc/hid_iap_user.h, app_led3_toggle/src/hid_iap_user.c, app_led4_toggle/inc/hid_iap_user.h, app_led4_toggle/src/hid_iap_user.c, bootloader/inc/hid_iap_user.h, bootloader/src/hid_iap_user.c
  • iap_jump() : app_led3_toggle/src/hid_iap_user.c, app_led4_toggle/src/hid_iap_user.c, bootloader/src/hid_iap_user.c
  • iap_loop() : bootloader/inc/hid_iap_user.h, bootloader/src/hid_iap_user.c
  • iap_respond() : app_led3_toggle/src/hid_iap_user.c, app_led4_toggle/src/hid_iap_user.c, bootloader/src/hid_iap_user.c
  • iap_set_upgrade_flag() : app_led3_toggle/src/hid_iap_user.c, app_led4_toggle/src/hid_iap_user.c, bootloader/src/hid_iap_user.c
  • iap_start() : app_led3_toggle/src/hid_iap_user.c, app_led4_toggle/src/hid_iap_user.c, bootloader/src/hid_iap_user.c
  • iap_upgrade_app_handle() : bootloader/inc/iap.h, bootloader/src/iap.c
  • incrementvar_operationcomplete() : project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c, project/at_start_f413/examples/rtc/lick_calibration/src/main.c
  • is_leap_year() : rtc.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all functions with links to the files they belong to:

- j -

  • jump_to_app() : project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c, bootloader/inc/hid_iap_user.h, bootloader/src/hid_iap_user.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all functions with links to the files they belong to:

- k -

  • keyboard_class_setup_handler() : cdc_keyboard_class.c
  • keyboard_send_string() : project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/main.c, project/at_start_f413/examples/usb_device/keyboard/src/main.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all functions with links to the files they belong to:

- l -

  • led2_task_function() : utilities/at32f413_freertos_demo/src/main.c
  • led3_task_function() : utilities/at32f413_freertos_demo/src/main.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all functions with links to the files they belong to:

- m -

  • main() : project/at_start_f413/examples/acc/calibration/src/main.c, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/main.c, project/at_start_f413/examples/adc/current_vref_value_check/src/main.c, project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c, project/at_start_f413/examples/adc/internal_temperature_sensor/src/main.c, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/main.c, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c, project/at_start_f413/examples/adc/voltage_monitoring/src/main.c, project/at_start_f413/examples/bpr/bpr_data/src/main.c, project/at_start_f413/examples/bpr/tamper/src/main.c, project/at_start_f413/examples/can/communication_mode/src/main.c, project/at_start_f413/examples/can/filter/src/main.c, project/at_start_f413/examples/can/loopback_mode/src/main.c, project/at_start_f413/examples/cortex_m4/bit_band/src/main.c, project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c, project/at_start_f413/examples/cortex_m4/fpu/src/main.c, project/at_start_f413/examples/cortex_m4/systick_interrupt/src/main.c, project/at_start_f413/examples/crc/calculation/src/main.c, project/at_start_f413/examples/crm/clock_failure_detection/src/main.c, project/at_start_f413/examples/crm/sysclk_switch/src/main.c, project/at_start_f413/examples/debug/tmr1/src/main.c, project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c, project/at_start_f413/examples/dma/flash_to_sram/src/main.c, project/at_start_f413/examples/exint/exint_config/src/main.c, project/at_start_f413/examples/exint/exint_software_trigger/src/main.c, project/at_start_f413/examples/flash/flash_write_read/src/main.c, project/at_start_f413/examples/flash/operate_spim/src/main.c, project/at_start_f413/examples/flash/run_in_spim/src/main.c, project/at_start_f413/examples/gpio/io_toggle/src/main.c, project/at_start_f413/examples/gpio/led_toggle/src/main.c, project/at_start_f413/examples/gpio/swjtag_remap/src/main.c, project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/communication_int/src/main.c, project/at_start_f413/examples/i2c/communication_poll/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c, project/at_start_f413/examples/i2s/halfduplex_dma/src/main.c, project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c, project/at_start_f413/examples/pwc/deepsleep_rtc/src/main.c, project/at_start_f413/examples/pwc/power_voltage_monitor/src/main.c, project/at_start_f413/examples/pwc/sleep_tmr2/src/main.c, project/at_start_f413/examples/pwc/sleep_usart1/src/main.c, project/at_start_f413/examples/pwc/standby_rtc/src/main.c, project/at_start_f413/examples/pwc/standby_wakeup_pin/src/main.c, project/at_start_f413/examples/rtc/calendar/src/main.c, project/at_start_f413/examples/rtc/lick_calibration/src/main.c, project/at_start_f413/examples/sdio/emmc_card/src/main.c, project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c, project/at_start_f413/examples/sdio/sdio_fatfs/src/main.c, project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/fullduplex_polling/src/main.c, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c, project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c, project/at_start_f413/examples/spi/w25q_flash/src/main.c, project/at_start_f413/examples/tmr/6_steps/src/main.c, project/at_start_f413/examples/tmr/7_pwm_output/src/main.c, project/at_start_f413/examples/tmr/cascade_synchro/src/main.c, project/at_start_f413/examples/tmr/complementary_signals/src/main.c, project/at_start_f413/examples/tmr/dma/src/main.c, project/at_start_f413/examples/tmr/dma_burst/src/main.c, project/at_start_f413/examples/tmr/encoder_tmr2/src/main.c, project/at_start_f413/examples/tmr/external_clock/src/main.c, project/at_start_f413/examples/tmr/hall_xor_tmr2/src/main.c, project/at_start_f413/examples/tmr/hang_mode/src/main.c, project/at_start_f413/examples/tmr/input_capture/src/main.c, project/at_start_f413/examples/tmr/oc_high/src/main.c, project/at_start_f413/examples/tmr/oc_low/src/main.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/main.c, project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/main.c, project/at_start_f413/examples/tmr/one_cycle/src/main.c, project/at_start_f413/examples/tmr/parallel_synchro/src/main.c, project/at_start_f413/examples/tmr/pwm_input/src/main.c, project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c, project/at_start_f413/examples/tmr/pwm_output_simulate/src/main.c, project/at_start_f413/examples/tmr/pwm_output_tmr10/src/main.c, project/at_start_f413/examples/tmr/pwm_output_tmr3/src/main.c, project/at_start_f413/examples/tmr/timer_base/src/main.c, project/at_start_f413/examples/tmr/tmr1_synchro/src/main.c, project/at_start_f413/examples/tmr/tmr2_32bit/src/main.c, project/at_start_f413/examples/usart/half_duplex/src/main.c, project/at_start_f413/examples/usart/hw_flow_control/src/main.c, project/at_start_f413/examples/usart/idle_detection/src/main.c, project/at_start_f413/examples/usart/interrupt/src/main.c, project/at_start_f413/examples/usart/irda/src/main.c, project/at_start_f413/examples/usart/polling/src/main.c, project/at_start_f413/examples/usart/printf/src/main.c, project/at_start_f413/examples/usart/receiver_mute/src/main.c, project/at_start_f413/examples/usart/rs485/src/main.c, project/at_start_f413/examples/usart/smartcard/src/main.c, project/at_start_f413/examples/usart/synchronous/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c, project/at_start_f413/examples/usb_device/audio/src/main.c, project/at_start_f413/examples/usb_device/composite_audio_hid/src/main.c, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/main.c, project/at_start_f413/examples/usb_device/composite_vcp_msc/src/main.c, project/at_start_f413/examples/usb_device/custom_hid/src/main.c, project/at_start_f413/examples/usb_device/keyboard/src/main.c, project/at_start_f413/examples/usb_device/mouse/src/main.c, project/at_start_f413/examples/usb_device/msc/src/main.c, project/at_start_f413/examples/usb_device/printer/src/main.c, project/at_start_f413/examples/usb_device/vcp_loopback/src/main.c, project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c, project/at_start_f413/examples/usb_device/winusb/src/main.c, project/at_start_f413/examples/wdt/wdt_reset/src/main.c, project/at_start_f413/examples/wdt/wdt_standby/src/main.c, project/at_start_f413/examples/wwdt/wwdt_reset/src/main.c, project/at_start_f413/templates/src/main.c, utilities/at32f413_freertos_demo/src/main.c, utilities/at32f413_gen_random_number_demo/src/main.c, utilities/at32f413_slib_demo/project_l0/src/main.c, utilities/at32f413_slib_demo/project_l1/src/main.c, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/main.c, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/main.c, utilities/at32f413_usart_iap_demo/source_code/bootloader/src/main.c, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/main.c, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/main.c, utilities/at32f413_usb_iap_demo/source_code/bootloader/src/main.c
  • mclk_tmr1_init() : audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • MemManage_Handler() : project/at_start_f413/examples/acc/calibration/inc/at32f413_int.h, project/at_start_f413/examples/acc/calibration/src/at32f413_int.c, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_int.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/at32f413_int.c, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_int.h, project/at_start_f413/examples/adc/current_vref_value_check/src/at32f413_int.c, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_int.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/src/at32f413_int.c, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_int.h, project/at_start_f413/examples/adc/internal_temperature_sensor/src/at32f413_int.c, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_int.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/at32f413_int.c, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_int.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/at32f413_int.c, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_int.h, project/at_start_f413/examples/adc/voltage_monitoring/src/at32f413_int.c, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_int.h, project/at_start_f413/examples/bpr/bpr_data/src/at32f413_int.c, project/at_start_f413/examples/bpr/tamper/inc/at32f413_int.h, project/at_start_f413/examples/bpr/tamper/src/at32f413_int.c, project/at_start_f413/examples/can/communication_mode/inc/at32f413_int.h, project/at_start_f413/examples/can/communication_mode/src/at32f413_int.c, project/at_start_f413/examples/can/filter/inc/at32f413_int.h, project/at_start_f413/examples/can/filter/src/at32f413_int.c, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_int.h, project/at_start_f413/examples/can/loopback_mode/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/bit_band/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/fpu/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_int.c, project/at_start_f413/examples/crc/calculation/inc/at32f413_int.h, project/at_start_f413/examples/crc/calculation/src/at32f413_int.c, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_int.h, project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_int.c, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_int.h, project/at_start_f413/examples/crm/sysclk_switch/src/at32f413_int.c, project/at_start_f413/examples/debug/tmr1/inc/at32f413_int.h, project/at_start_f413/examples/debug/tmr1/src/at32f413_int.c, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_int.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/src/at32f413_int.c, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_int.h, project/at_start_f413/examples/dma/flash_to_sram/src/at32f413_int.c, project/at_start_f413/examples/exint/exint_config/inc/at32f413_int.h, project/at_start_f413/examples/exint/exint_config/src/at32f413_int.c, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_int.h, project/at_start_f413/examples/exint/exint_software_trigger/src/at32f413_int.c, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_int.h, project/at_start_f413/examples/flash/flash_write_read/src/at32f413_int.c, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_int.h, project/at_start_f413/examples/flash/operate_spim/src/at32f413_int.c, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_int.h, project/at_start_f413/examples/flash/run_in_spim/src/at32f413_int.c, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_int.h, project/at_start_f413/examples/gpio/io_toggle/src/at32f413_int.c, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_int.h, project/at_start_f413/examples/gpio/led_toggle/src/at32f413_int.c, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_int.h, project/at_start_f413/examples/gpio/swjtag_remap/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_poll/src/at32f413_int.c, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_int.h, project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_int.h, project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_int.h, project/at_start_f413/examples/i2s/halfduplex_dma/src/at32f413_int.c, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/src/at32f413_int.c, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_int.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/at32f413_int.c, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_int.h, project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_int.c, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_int.h, project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_int.c, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_int.c, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_int.h, project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_int.h, project/at_start_f413/examples/pwc/standby_rtc/src/at32f413_int.c, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_int.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/src/at32f413_int.c, project/at_start_f413/examples/rtc/calendar/inc/at32f413_int.h, project/at_start_f413/examples/rtc/calendar/src/at32f413_int.c, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_int.h, project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_int.h, project/at_start_f413/examples/sdio/emmc_card/src/at32f413_int.c, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_int.h, project/at_start_f413/examples/sdio/sd_mmc_card/src/at32f413_int.c, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_int.h, project/at_start_f413/examples/sdio/sdio_fatfs/src/at32f413_int.c, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/crc_transfer_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_int.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/at32f413_int.c, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/fullduplex_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_interrupt/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/at32f413_int.c, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/only_receive_mode_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_int.h, project/at_start_f413/examples/spi/w25q_flash/src/at32f413_int.c, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_int.h, project/at_start_f413/examples/tmr/6_steps/src/at32f413_int.c, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_int.h, project/at_start_f413/examples/tmr/7_pwm_output/src/at32f413_int.c, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/cascade_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_int.h, project/at_start_f413/examples/tmr/complementary_signals/src/at32f413_int.c, project/at_start_f413/examples/tmr/dma/inc/at32f413_int.h, project/at_start_f413/examples/tmr/dma/src/at32f413_int.c, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_int.h, project/at_start_f413/examples/tmr/dma_burst/src/at32f413_int.c, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/tmr/encoder_tmr2/src/at32f413_int.c, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_int.h, project/at_start_f413/examples/tmr/external_clock/src/at32f413_int.c, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/src/at32f413_int.c, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_int.h, project/at_start_f413/examples/tmr/hang_mode/src/at32f413_int.c, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_int.h, project/at_start_f413/examples/tmr/input_capture/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_high/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_low/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_int.h, project/at_start_f413/examples/tmr/one_cycle/src/at32f413_int.c, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/parallel_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_input_dma/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_int.h, project/at_start_f413/examples/tmr/timer_base/src/at32f413_int.c, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/tmr1_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_int.h, project/at_start_f413/examples/tmr/tmr2_32bit/src/at32f413_int.c, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_int.h, project/at_start_f413/examples/usart/half_duplex/src/at32f413_int.c, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_int.h, project/at_start_f413/examples/usart/hw_flow_control/src/at32f413_int.c, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_int.h, project/at_start_f413/examples/usart/idle_detection/src/at32f413_int.c, project/at_start_f413/examples/usart/interrupt/inc/at32f413_int.h, project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/irda/inc/at32f413_int.h, project/at_start_f413/examples/usart/irda/src/at32f413_int.c, project/at_start_f413/examples/usart/polling/inc/at32f413_int.h, project/at_start_f413/examples/usart/polling/src/at32f413_int.c, project/at_start_f413/examples/usart/printf/inc/at32f413_int.h, project/at_start_f413/examples/usart/printf/src/at32f413_int.c, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_int.h, project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c, project/at_start_f413/examples/usart/rs485/inc/at32f413_int.h, project/at_start_f413/examples/usart/rs485/src/at32f413_int.c, project/at_start_f413/examples/usart/smartcard/inc/at32f413_int.h, project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c, project/at_start_f413/examples/usart/synchronous/inc/at32f413_int.h, project/at_start_f413/examples/usart/synchronous/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_int.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/src/at32f413_int.c, project/at_start_f413/examples/usb_device/audio/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/audio/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_audio_hid/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/src/at32f413_int.c, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/custom_hid/src/at32f413_int.c, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/keyboard/src/at32f413_int.c, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/mouse/src/at32f413_int.c, project/at_start_f413/examples/usb_device/msc/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/msc/src/at32f413_int.c, project/at_start_f413/examples/usb_device/printer/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/printer/src/at32f413_int.c, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/vcp_loopback/src/at32f413_int.c, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/src/at32f413_int.c, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/winusb/src/at32f413_int.c, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_int.h, project/at_start_f413/examples/wdt/wdt_reset/src/at32f413_int.c, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_int.h, project/at_start_f413/examples/wdt/wdt_standby/src/at32f413_int.c, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_int.h, project/at_start_f413/examples/wwdt/wwdt_reset/src/at32f413_int.c, project/at_start_f413/templates/src/at32f413_int.c, project/at_start_f413/templates/inc/at32f413_int.h, utilities/at32f413_freertos_demo/inc/at32f413_int.h, utilities/at32f413_freertos_demo/src/at32f413_int.c, utilities/at32f413_gen_random_number_demo/inc/at32f413_int.h, utilities/at32f413_gen_random_number_demo/src/at32f413_int.c, utilities/at32f413_slib_demo/project_l0/inc/at32f413_int.h, utilities/at32f413_slib_demo/project_l0/src/at32f413_int.c, utilities/at32f413_slib_demo/project_l1/inc/at32f413_int.h, utilities/at32f413_slib_demo/project_l1/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/src/at32f413_int.c
  • memset16_buffer() : audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • mmc_stream_read() : emmc_card/inc/at32_sdio.h, emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • mmc_stream_test() : project/at_start_f413/examples/sdio/emmc_card/src/main.c, project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c
  • mmc_stream_write() : emmc_card/inc/at32_sdio.h, emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • mmc_switch() : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • msc_class_setup_handler() : cdc_msc_class.c
  • msc_disk_capacity() : composite_vcp_msc/inc/msc_diskio.h, virtual_msc_iap/inc/msc_diskio.h
  • msc_disk_read() : composite_vcp_msc/inc/msc_diskio.h, virtual_msc_iap/inc/msc_diskio.h
  • msc_disk_write() : composite_vcp_msc/inc/msc_diskio.h, virtual_msc_iap/inc/msc_diskio.h
  • my_memset() : arm_fir_init_f32.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all functions with links to the files they belong to:

- n -

  • NMI_Handler() : project/at_start_f413/examples/acc/calibration/inc/at32f413_int.h, project/at_start_f413/examples/acc/calibration/src/at32f413_int.c, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_int.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/at32f413_int.c, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_int.h, project/at_start_f413/examples/adc/current_vref_value_check/src/at32f413_int.c, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_int.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/src/at32f413_int.c, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_int.h, project/at_start_f413/examples/adc/internal_temperature_sensor/src/at32f413_int.c, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_int.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/at32f413_int.c, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_int.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/at32f413_int.c, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_int.h, project/at_start_f413/examples/adc/voltage_monitoring/src/at32f413_int.c, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_int.h, project/at_start_f413/examples/bpr/bpr_data/src/at32f413_int.c, project/at_start_f413/examples/bpr/tamper/inc/at32f413_int.h, project/at_start_f413/examples/bpr/tamper/src/at32f413_int.c, project/at_start_f413/examples/can/communication_mode/inc/at32f413_int.h, project/at_start_f413/examples/can/communication_mode/src/at32f413_int.c, project/at_start_f413/examples/can/filter/inc/at32f413_int.h, project/at_start_f413/examples/can/filter/src/at32f413_int.c, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_int.h, project/at_start_f413/examples/can/loopback_mode/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/bit_band/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/fpu/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_int.c, project/at_start_f413/examples/crc/calculation/inc/at32f413_int.h, project/at_start_f413/examples/crc/calculation/src/at32f413_int.c, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_int.h, project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_int.c, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_int.h, project/at_start_f413/examples/crm/sysclk_switch/src/at32f413_int.c, project/at_start_f413/examples/debug/tmr1/inc/at32f413_int.h, project/at_start_f413/examples/debug/tmr1/src/at32f413_int.c, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_int.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/src/at32f413_int.c, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_int.h, project/at_start_f413/examples/dma/flash_to_sram/src/at32f413_int.c, project/at_start_f413/examples/exint/exint_config/inc/at32f413_int.h, project/at_start_f413/examples/exint/exint_config/src/at32f413_int.c, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_int.h, project/at_start_f413/examples/exint/exint_software_trigger/src/at32f413_int.c, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_int.h, project/at_start_f413/examples/flash/flash_write_read/src/at32f413_int.c, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_int.h, project/at_start_f413/examples/flash/operate_spim/src/at32f413_int.c, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_int.h, project/at_start_f413/examples/flash/run_in_spim/src/at32f413_int.c, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_int.h, project/at_start_f413/examples/gpio/io_toggle/src/at32f413_int.c, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_int.h, project/at_start_f413/examples/gpio/led_toggle/src/at32f413_int.c, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_int.h, project/at_start_f413/examples/gpio/swjtag_remap/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_poll/src/at32f413_int.c, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_int.h, project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_int.h, project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_int.h, project/at_start_f413/examples/i2s/halfduplex_dma/src/at32f413_int.c, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/src/at32f413_int.c, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_int.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/at32f413_int.c, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_int.h, project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_int.c, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_int.h, project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_int.c, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_int.c, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_int.h, project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_int.h, project/at_start_f413/examples/pwc/standby_rtc/src/at32f413_int.c, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_int.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/src/at32f413_int.c, project/at_start_f413/examples/rtc/calendar/inc/at32f413_int.h, project/at_start_f413/examples/rtc/calendar/src/at32f413_int.c, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_int.h, project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_int.h, project/at_start_f413/examples/sdio/emmc_card/src/at32f413_int.c, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_int.h, project/at_start_f413/examples/sdio/sd_mmc_card/src/at32f413_int.c, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_int.h, project/at_start_f413/examples/sdio/sdio_fatfs/src/at32f413_int.c, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/crc_transfer_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_int.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/at32f413_int.c, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/fullduplex_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_interrupt/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/at32f413_int.c, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/only_receive_mode_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_int.h, project/at_start_f413/examples/spi/w25q_flash/src/at32f413_int.c, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_int.h, project/at_start_f413/examples/tmr/6_steps/src/at32f413_int.c, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_int.h, project/at_start_f413/examples/tmr/7_pwm_output/src/at32f413_int.c, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/cascade_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_int.h, project/at_start_f413/examples/tmr/complementary_signals/src/at32f413_int.c, project/at_start_f413/examples/tmr/dma/inc/at32f413_int.h, project/at_start_f413/examples/tmr/dma/src/at32f413_int.c, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_int.h, project/at_start_f413/examples/tmr/dma_burst/src/at32f413_int.c, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/tmr/encoder_tmr2/src/at32f413_int.c, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_int.h, project/at_start_f413/examples/tmr/external_clock/src/at32f413_int.c, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/src/at32f413_int.c, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_int.h, project/at_start_f413/examples/tmr/hang_mode/src/at32f413_int.c, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_int.h, project/at_start_f413/examples/tmr/input_capture/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_high/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_low/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_int.h, project/at_start_f413/examples/tmr/one_cycle/src/at32f413_int.c, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/parallel_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_input_dma/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_int.h, project/at_start_f413/examples/tmr/timer_base/src/at32f413_int.c, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/tmr1_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_int.h, project/at_start_f413/examples/tmr/tmr2_32bit/src/at32f413_int.c, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_int.h, project/at_start_f413/examples/usart/half_duplex/src/at32f413_int.c, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_int.h, project/at_start_f413/examples/usart/hw_flow_control/src/at32f413_int.c, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_int.h, project/at_start_f413/examples/usart/idle_detection/src/at32f413_int.c, project/at_start_f413/examples/usart/interrupt/inc/at32f413_int.h, project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/irda/inc/at32f413_int.h, project/at_start_f413/examples/usart/irda/src/at32f413_int.c, project/at_start_f413/examples/usart/polling/inc/at32f413_int.h, project/at_start_f413/examples/usart/polling/src/at32f413_int.c, project/at_start_f413/examples/usart/printf/inc/at32f413_int.h, project/at_start_f413/examples/usart/printf/src/at32f413_int.c, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_int.h, project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c, project/at_start_f413/examples/usart/rs485/inc/at32f413_int.h, project/at_start_f413/examples/usart/rs485/src/at32f413_int.c, project/at_start_f413/examples/usart/smartcard/inc/at32f413_int.h, project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c, project/at_start_f413/examples/usart/synchronous/inc/at32f413_int.h, project/at_start_f413/examples/usart/synchronous/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_int.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/src/at32f413_int.c, project/at_start_f413/examples/usb_device/audio/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/audio/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_audio_hid/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/src/at32f413_int.c, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/custom_hid/src/at32f413_int.c, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/keyboard/src/at32f413_int.c, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/mouse/src/at32f413_int.c, project/at_start_f413/examples/usb_device/msc/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/msc/src/at32f413_int.c, project/at_start_f413/examples/usb_device/printer/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/printer/src/at32f413_int.c, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/vcp_loopback/src/at32f413_int.c, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/src/at32f413_int.c, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/winusb/src/at32f413_int.c, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_int.h, project/at_start_f413/examples/wdt/wdt_reset/src/at32f413_int.c, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_int.h, project/at_start_f413/examples/wdt/wdt_standby/src/at32f413_int.c, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_int.h, project/at_start_f413/examples/wwdt/wwdt_reset/src/at32f413_int.c, project/at_start_f413/templates/src/at32f413_int.c, project/at_start_f413/templates/inc/at32f413_int.h, utilities/at32f413_freertos_demo/inc/at32f413_int.h, utilities/at32f413_freertos_demo/src/at32f413_int.c, utilities/at32f413_gen_random_number_demo/inc/at32f413_int.h, utilities/at32f413_gen_random_number_demo/src/at32f413_int.c, utilities/at32f413_slib_demo/project_l0/inc/at32f413_int.h, utilities/at32f413_slib_demo/project_l0/src/at32f413_int.c, utilities/at32f413_slib_demo/project_l1/inc/at32f413_int.h, utilities/at32f413_slib_demo/project_l1/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/src/at32f413_int.c
  • nvic_configuration() : project/at_start_f413/examples/rtc/lick_calibration/src/main.c, project/at_start_f413/examples/sdio/emmc_card/src/main.c, project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c, project/at_start_f413/examples/sdio/sdio_fatfs/src/main.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/main.c, project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/main.c
  • nvic_irq_disable() : at32f413_misc.h, at32f413_misc.c
  • nvic_irq_enable() : at32f413_misc.h, at32f413_misc.c
  • nvic_lowpower_mode_config() : at32f413_misc.h, at32f413_misc.c
  • nvic_priority_group_config() : at32f413_misc.h, at32f413_misc.c
  • nvic_system_reset() : at32f413_misc.h, at32f413_misc.c
  • nvic_vector_table_set() : at32f413_misc.h, at32f413_misc.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all functions with links to the files they belong to:

- p -

  • PendSV_Handler() : project/at_start_f413/examples/acc/calibration/inc/at32f413_int.h, project/at_start_f413/examples/acc/calibration/src/at32f413_int.c, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_int.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/at32f413_int.c, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_int.h, project/at_start_f413/examples/adc/current_vref_value_check/src/at32f413_int.c, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_int.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/src/at32f413_int.c, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_int.h, project/at_start_f413/examples/adc/internal_temperature_sensor/src/at32f413_int.c, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_int.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/at32f413_int.c, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_int.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/at32f413_int.c, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_int.h, project/at_start_f413/examples/adc/voltage_monitoring/src/at32f413_int.c, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_int.h, project/at_start_f413/examples/bpr/bpr_data/src/at32f413_int.c, project/at_start_f413/examples/bpr/tamper/inc/at32f413_int.h, project/at_start_f413/examples/bpr/tamper/src/at32f413_int.c, project/at_start_f413/examples/can/communication_mode/inc/at32f413_int.h, project/at_start_f413/examples/can/communication_mode/src/at32f413_int.c, project/at_start_f413/examples/can/filter/inc/at32f413_int.h, project/at_start_f413/examples/can/filter/src/at32f413_int.c, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_int.h, project/at_start_f413/examples/can/loopback_mode/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/bit_band/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/fpu/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_int.c, project/at_start_f413/examples/crc/calculation/inc/at32f413_int.h, project/at_start_f413/examples/crc/calculation/src/at32f413_int.c, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_int.h, project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_int.c, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_int.h, project/at_start_f413/examples/crm/sysclk_switch/src/at32f413_int.c, project/at_start_f413/examples/debug/tmr1/inc/at32f413_int.h, project/at_start_f413/examples/debug/tmr1/src/at32f413_int.c, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_int.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/src/at32f413_int.c, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_int.h, project/at_start_f413/examples/dma/flash_to_sram/src/at32f413_int.c, project/at_start_f413/examples/exint/exint_config/inc/at32f413_int.h, project/at_start_f413/examples/exint/exint_config/src/at32f413_int.c, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_int.h, project/at_start_f413/examples/exint/exint_software_trigger/src/at32f413_int.c, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_int.h, project/at_start_f413/examples/flash/flash_write_read/src/at32f413_int.c, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_int.h, project/at_start_f413/examples/flash/operate_spim/src/at32f413_int.c, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_int.h, project/at_start_f413/examples/flash/run_in_spim/src/at32f413_int.c, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_int.h, project/at_start_f413/examples/gpio/io_toggle/src/at32f413_int.c, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_int.h, project/at_start_f413/examples/gpio/led_toggle/src/at32f413_int.c, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_int.h, project/at_start_f413/examples/gpio/swjtag_remap/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_poll/src/at32f413_int.c, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_int.h, project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_int.h, project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_int.h, project/at_start_f413/examples/i2s/halfduplex_dma/src/at32f413_int.c, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/src/at32f413_int.c, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_int.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/at32f413_int.c, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_int.h, project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_int.c, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_int.h, project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_int.c, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_int.c, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_int.h, project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_int.h, project/at_start_f413/examples/pwc/standby_rtc/src/at32f413_int.c, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_int.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/src/at32f413_int.c, project/at_start_f413/examples/rtc/calendar/inc/at32f413_int.h, project/at_start_f413/examples/rtc/calendar/src/at32f413_int.c, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_int.h, project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_int.h, project/at_start_f413/examples/sdio/emmc_card/src/at32f413_int.c, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_int.h, project/at_start_f413/examples/sdio/sd_mmc_card/src/at32f413_int.c, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_int.h, project/at_start_f413/examples/sdio/sdio_fatfs/src/at32f413_int.c, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/crc_transfer_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_int.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/at32f413_int.c, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/fullduplex_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_interrupt/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/at32f413_int.c, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/only_receive_mode_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_int.h, project/at_start_f413/examples/spi/w25q_flash/src/at32f413_int.c, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_int.h, project/at_start_f413/examples/tmr/6_steps/src/at32f413_int.c, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_int.h, project/at_start_f413/examples/tmr/7_pwm_output/src/at32f413_int.c, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/cascade_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_int.h, project/at_start_f413/examples/tmr/complementary_signals/src/at32f413_int.c, project/at_start_f413/examples/tmr/dma/inc/at32f413_int.h, project/at_start_f413/examples/tmr/dma/src/at32f413_int.c, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_int.h, project/at_start_f413/examples/tmr/dma_burst/src/at32f413_int.c, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/tmr/encoder_tmr2/src/at32f413_int.c, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_int.h, project/at_start_f413/examples/tmr/external_clock/src/at32f413_int.c, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/src/at32f413_int.c, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_int.h, project/at_start_f413/examples/tmr/hang_mode/src/at32f413_int.c, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_int.h, project/at_start_f413/examples/tmr/input_capture/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_high/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_low/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_int.h, project/at_start_f413/examples/tmr/one_cycle/src/at32f413_int.c, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/parallel_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_input_dma/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_int.h, project/at_start_f413/examples/tmr/timer_base/src/at32f413_int.c, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/tmr1_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_int.h, project/at_start_f413/examples/tmr/tmr2_32bit/src/at32f413_int.c, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_int.h, project/at_start_f413/examples/usart/half_duplex/src/at32f413_int.c, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_int.h, project/at_start_f413/examples/usart/hw_flow_control/src/at32f413_int.c, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_int.h, project/at_start_f413/examples/usart/idle_detection/src/at32f413_int.c, project/at_start_f413/examples/usart/interrupt/inc/at32f413_int.h, project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/irda/inc/at32f413_int.h, project/at_start_f413/examples/usart/irda/src/at32f413_int.c, project/at_start_f413/examples/usart/polling/inc/at32f413_int.h, project/at_start_f413/examples/usart/polling/src/at32f413_int.c, project/at_start_f413/examples/usart/printf/inc/at32f413_int.h, project/at_start_f413/examples/usart/printf/src/at32f413_int.c, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_int.h, project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c, project/at_start_f413/examples/usart/rs485/inc/at32f413_int.h, project/at_start_f413/examples/usart/rs485/src/at32f413_int.c, project/at_start_f413/examples/usart/smartcard/inc/at32f413_int.h, project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c, project/at_start_f413/examples/usart/synchronous/inc/at32f413_int.h, project/at_start_f413/examples/usart/synchronous/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_int.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/src/at32f413_int.c, project/at_start_f413/examples/usb_device/audio/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/audio/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_audio_hid/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/src/at32f413_int.c, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/custom_hid/src/at32f413_int.c, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/keyboard/src/at32f413_int.c, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/mouse/src/at32f413_int.c, project/at_start_f413/examples/usb_device/msc/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/msc/src/at32f413_int.c, project/at_start_f413/examples/usb_device/printer/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/printer/src/at32f413_int.c, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/vcp_loopback/src/at32f413_int.c, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/src/at32f413_int.c, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/winusb/src/at32f413_int.c, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_int.h, project/at_start_f413/examples/wdt/wdt_reset/src/at32f413_int.c, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_int.h, project/at_start_f413/examples/wdt/wdt_standby/src/at32f413_int.c, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_int.h, project/at_start_f413/examples/wwdt/wwdt_reset/src/at32f413_int.c, project/at_start_f413/templates/src/at32f413_int.c, project/at_start_f413/templates/inc/at32f413_int.h, utilities/at32f413_freertos_demo/inc/at32f413_int.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_int.h, utilities/at32f413_gen_random_number_demo/src/at32f413_int.c, utilities/at32f413_slib_demo/project_l0/inc/at32f413_int.h, utilities/at32f413_slib_demo/project_l0/src/at32f413_int.c, utilities/at32f413_slib_demo/project_l1/inc/at32f413_int.h, utilities/at32f413_slib_demo/project_l1/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/src/at32f413_int.c
  • pvm_exint_config() : project/at_start_f413/examples/pwc/power_voltage_monitor/src/main.c
  • PVM_IRQHandler() : project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_int.c
  • pwc_battery_powered_domain_access() : at32f413_pwc.h, at32f413_pwc.c
  • pwc_deep_sleep_mode_enter() : at32f413_pwc.h, at32f413_pwc.c
  • pwc_flag_clear() : at32f413_pwc.h, at32f413_pwc.c
  • pwc_flag_get() : at32f413_pwc.h, at32f413_pwc.c
  • pwc_power_voltage_monitor_enable() : at32f413_pwc.h, at32f413_pwc.c
  • pwc_pvm_level_select() : at32f413_pwc.h, at32f413_pwc.c
  • pwc_reset() : at32f413_pwc.h, at32f413_pwc.c
  • pwc_sleep_mode_enter() : at32f413_pwc.h, at32f413_pwc.c
  • pwc_standby_mode_enter() : at32f413_pwc.h, at32f413_pwc.c
  • pwc_wakeup_pin_enable() : at32f413_pwc.h, at32f413_pwc.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all functions with links to the files they belong to:

- r -

  • randnum_test() : random.h, random.c
  • result_error() : project/at_start_f413/examples/cortex_m4/bit_band/src/main.c
  • rs485_config() : project/at_start_f413/examples/usart/rs485/src/main.c
  • rs485_send_data() : project/at_start_f413/examples/usart/rs485/src/main.c
  • rtc_alarm_clock_set() : rtc.h, rtc.c
  • rtc_alarm_config() : project/at_start_f413/examples/pwc/standby_rtc/src/main.c
  • rtc_alarm_set() : at32f413_rtc.h, at32f413_rtc.c
  • rtc_config() : project/at_start_f413/examples/pwc/deepsleep_rtc/src/main.c, project/at_start_f413/examples/pwc/standby_rtc/src/main.c
  • rtc_configuration() : project/at_start_f413/examples/rtc/lick_calibration/src/main.c
  • rtc_counter_get() : at32f413_rtc.h, at32f413_rtc.c
  • rtc_counter_set() : at32f413_rtc.h, at32f413_rtc.c
  • rtc_divider_get() : at32f413_rtc.h, at32f413_rtc.c
  • rtc_divider_set() : at32f413_rtc.h, at32f413_rtc.c
  • rtc_flag_clear() : at32f413_rtc.h, at32f413_rtc.c
  • rtc_flag_get() : at32f413_rtc.h, at32f413_rtc.c
  • rtc_init() : rtc.h, rtc.c
  • rtc_interrupt_enable() : at32f413_rtc.h, at32f413_rtc.c
  • rtc_interrupt_flag_get() : at32f413_rtc.h, at32f413_rtc.c
  • RTC_IRQHandler() : project/at_start_f413/examples/rtc/calendar/src/at32f413_int.c, project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c
  • rtc_lowlevel_counter_get() : at32f413_rtc.c
  • rtc_time_get() : rtc.h, rtc.c
  • rtc_time_set() : rtc.h, rtc.c
  • rtc_wait_config_finish() : at32f413_rtc.h, at32f413_rtc.c
  • rtc_wait_update_finish() : at32f413_rtc.h, at32f413_rtc.c
  • rtc_week_get() : rtc.c
  • RTCAlarm_IRQHandler() : project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_int.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all functions with links to the files they belong to:

- s -

  • sc_response_decode() : project/at_start_f413/examples/usart/smartcard/src/main.c
  • sclk_192m_hick_config() : project/at_start_f413/examples/crm/clock_failure_detection/src/main.c
  • sclk_64m_hick_config() : project/at_start_f413/examples/crm/sysclk_switch/src/main.c
  • sclk_96m_hext_config() : project/at_start_f413/examples/crm/sysclk_switch/src/main.c
  • scr_find() : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • sd_block_read() : emmc_card/inc/at32_sdio.h, emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • sd_block_write() : emmc_card/inc/at32_sdio.h, emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • sd_blocks_erase() : emmc_card/inc/at32_sdio.h, emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • sd_bus_wide_enable() : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • sd_card_info_get() : emmc_card/inc/at32_sdio.h, emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • sd_card_init() : emmc_card/inc/at32_sdio.h, emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • sd_deselect_select() : emmc_card/inc/at32_sdio.h, emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • sd_device_mode_set() : emmc_card/inc/at32_sdio.h, emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • sd_dma_config() : emmc_card/inc/at32_sdio.h, emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • sd_init() : emmc_card/inc/at32_sdio.h, emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • sd_irq_service() : emmc_card/inc/at32_sdio.h, emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • sd_mult_blocks_read() : emmc_card/inc/at32_sdio.h, emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • sd_mult_blocks_write() : emmc_card/inc/at32_sdio.h, emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • sd_multiple_blocks_test() : project/at_start_f413/examples/sdio/emmc_card/src/main.c, project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c
  • sd_power_off() : emmc_card/inc/at32_sdio.h, emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • sd_power_on() : emmc_card/inc/at32_sdio.h, emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • sd_read_disk() : diskio.c
  • sd_single_block_test() : project/at_start_f413/examples/sdio/emmc_card/src/main.c, project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c
  • sd_state_get() : emmc_card/inc/at32_sdio.h, emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • sd_status_send() : emmc_card/inc/at32_sdio.h, emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • sd_switch() : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • sd_test_error() : project/at_start_f413/examples/sdio/emmc_card/src/main.c, project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c, project/at_start_f413/examples/sdio/sdio_fatfs/src/main.c
  • sd_wide_bus_operation_config() : emmc_card/inc/at32_sdio.h, emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • sd_write_disk() : diskio.c
  • SDIO1_IRQHandler() : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • SDIO2_IRQHandler() : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • sdio_buffer_counter_get() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_bus_width_config() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_clock_bypass() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_clock_config() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_clock_enable() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_clock_set() : emmc_card/inc/at32_sdio.h, emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • sdio_command_config() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_command_data_send() : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • sdio_command_response_get() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_command_state_machine_enable() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_data_config() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_data_counter_get() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_data_read() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_data_state_machine_enable() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_data_write() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_dma_enable() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_flag_clear() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_flag_get() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_flow_control_enable() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_interrupt_enable() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_interrupt_flag_get() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_io_function_enable() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_io_suspend_command_set() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_power_saving_mode_enable() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_power_set() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_power_status_get() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_read_wait_mode_set() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_read_wait_start() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_read_wait_stop() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_reset() : at32f413_sdio.h, at32f413_sdio.c
  • sdio_response_get() : at32f413_sdio.h, at32f413_sdio.c
  • sector_read() : operate_spim.c
  • setvar_periodvalue() : project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c, project/at_start_f413/examples/rtc/lick_calibration/src/main.c
  • show_card_info() : project/at_start_f413/examples/sdio/emmc_card/src/main.c, project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c
  • slib_enable() : utilities/at32f413_slib_demo/project_l0/src/main.c
  • speed_change() : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • SPI1_IRQHandler() : project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c
  • SPI2_IRQHandler() : project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c
  • spi_byte_read() : spi_flash.h, spi_flash.c
  • spi_byte_write() : spi_flash.h, spi_flash.c
  • spi_bytes_read() : spi_flash.h, spi_flash.c
  • spi_bytes_write() : spi_flash.h, spi_flash.c
  • spi_config() : project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c, project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/fullduplex_polling/src/main.c, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c, project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c
  • spi_crc_enable() : at32f413_spi.h, at32f413_spi.c
  • spi_crc_next_transmit() : at32f413_spi.h, at32f413_spi.c
  • spi_crc_polynomial_get() : at32f413_spi.h, at32f413_spi.c
  • spi_crc_polynomial_set() : at32f413_spi.h, at32f413_spi.c
  • spi_crc_value_get() : at32f413_spi.h, at32f413_spi.c
  • spi_default_para_init() : at32f413_spi.h, at32f413_spi.c
  • spi_enable() : at32f413_spi.h, at32f413_spi.c
  • spi_frame_bit_num_set() : at32f413_spi.h, at32f413_spi.c
  • spi_half_duplex_direction_set() : at32f413_spi.h, at32f413_spi.c
  • spi_hardware_cs_output_enable() : at32f413_spi.h, at32f413_spi.c
  • spi_i2s_data_receive() : at32f413_spi.h, at32f413_spi.c
  • spi_i2s_data_transmit() : at32f413_spi.h, at32f413_spi.c
  • spi_i2s_dma_receiver_enable() : at32f413_spi.h, at32f413_spi.c
  • spi_i2s_dma_transmitter_enable() : at32f413_spi.h, at32f413_spi.c
  • spi_i2s_flag_clear() : at32f413_spi.h, at32f413_spi.c
  • spi_i2s_flag_get() : at32f413_spi.h, at32f413_spi.c
  • spi_i2s_interrupt_enable() : at32f413_spi.h, at32f413_spi.c
  • spi_i2s_interrupt_flag_get() : at32f413_spi.h, at32f413_spi.c
  • spi_i2s_reset() : at32f413_spi.h, at32f413_spi.c
  • spi_init() : at32f413_spi.h, at32f413_spi.c
  • spi_software_cs_internal_level_set() : at32f413_spi.h, at32f413_spi.c
  • spiflash_init() : spi_flash.h, spi_flash.c
  • spiflash_page_write() : spi_flash.h, spi_flash.c
  • spiflash_read() : spi_flash.h, spi_flash.c
  • spiflash_read_id() : spi_flash.h, spi_flash.c
  • spiflash_read_sr1() : spi_flash.h, spi_flash.c
  • spiflash_sector_erase() : spi_flash.h, spi_flash.c
  • spiflash_wait_busy() : spi_flash.h, spi_flash.c
  • spiflash_write() : spi_flash.h, spi_flash.c
  • spiflash_write_enable() : spi_flash.h, spi_flash.c
  • spiflash_write_nocheck() : spi_flash.h, spi_flash.c
  • spim_init() : operate_spim.c, project/at_start_f413/examples/flash/run_in_spim/src/main.c
  • spim_operate() : operate_spim.h, operate_spim.c
  • spim_run() : run_in_spim.h
  • SVC_Handler() : project/at_start_f413/examples/acc/calibration/inc/at32f413_int.h, project/at_start_f413/examples/acc/calibration/src/at32f413_int.c, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_int.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/at32f413_int.c, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_int.h, project/at_start_f413/examples/adc/current_vref_value_check/src/at32f413_int.c, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_int.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/src/at32f413_int.c, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_int.h, project/at_start_f413/examples/adc/internal_temperature_sensor/src/at32f413_int.c, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_int.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/at32f413_int.c, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_int.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/at32f413_int.c, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_int.h, project/at_start_f413/examples/adc/voltage_monitoring/src/at32f413_int.c, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_int.h, project/at_start_f413/examples/bpr/bpr_data/src/at32f413_int.c, project/at_start_f413/examples/bpr/tamper/inc/at32f413_int.h, project/at_start_f413/examples/bpr/tamper/src/at32f413_int.c, project/at_start_f413/examples/can/communication_mode/inc/at32f413_int.h, project/at_start_f413/examples/can/communication_mode/src/at32f413_int.c, project/at_start_f413/examples/can/filter/inc/at32f413_int.h, project/at_start_f413/examples/can/filter/src/at32f413_int.c, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_int.h, project/at_start_f413/examples/can/loopback_mode/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/bit_band/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/fpu/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_int.c, project/at_start_f413/examples/crc/calculation/inc/at32f413_int.h, project/at_start_f413/examples/crc/calculation/src/at32f413_int.c, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_int.h, project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_int.c, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_int.h, project/at_start_f413/examples/crm/sysclk_switch/src/at32f413_int.c, project/at_start_f413/examples/debug/tmr1/inc/at32f413_int.h, project/at_start_f413/examples/debug/tmr1/src/at32f413_int.c, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_int.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/src/at32f413_int.c, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_int.h, project/at_start_f413/examples/dma/flash_to_sram/src/at32f413_int.c, project/at_start_f413/examples/exint/exint_config/inc/at32f413_int.h, project/at_start_f413/examples/exint/exint_config/src/at32f413_int.c, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_int.h, project/at_start_f413/examples/exint/exint_software_trigger/src/at32f413_int.c, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_int.h, project/at_start_f413/examples/flash/flash_write_read/src/at32f413_int.c, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_int.h, project/at_start_f413/examples/flash/operate_spim/src/at32f413_int.c, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_int.h, project/at_start_f413/examples/flash/run_in_spim/src/at32f413_int.c, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_int.h, project/at_start_f413/examples/gpio/io_toggle/src/at32f413_int.c, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_int.h, project/at_start_f413/examples/gpio/led_toggle/src/at32f413_int.c, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_int.h, project/at_start_f413/examples/gpio/swjtag_remap/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_poll/src/at32f413_int.c, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_int.h, project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_int.h, project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_int.h, project/at_start_f413/examples/i2s/halfduplex_dma/src/at32f413_int.c, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/src/at32f413_int.c, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_int.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/at32f413_int.c, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_int.h, project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_int.c, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_int.h, project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_int.c, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_int.c, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_int.h, project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_int.h, project/at_start_f413/examples/pwc/standby_rtc/src/at32f413_int.c, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_int.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/src/at32f413_int.c, project/at_start_f413/examples/rtc/calendar/inc/at32f413_int.h, project/at_start_f413/examples/rtc/calendar/src/at32f413_int.c, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_int.h, project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_int.h, project/at_start_f413/examples/sdio/emmc_card/src/at32f413_int.c, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_int.h, project/at_start_f413/examples/sdio/sd_mmc_card/src/at32f413_int.c, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_int.h, project/at_start_f413/examples/sdio/sdio_fatfs/src/at32f413_int.c, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/crc_transfer_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_int.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/at32f413_int.c, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/fullduplex_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_interrupt/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/at32f413_int.c, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/only_receive_mode_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_int.h, project/at_start_f413/examples/spi/w25q_flash/src/at32f413_int.c, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_int.h, project/at_start_f413/examples/tmr/6_steps/src/at32f413_int.c, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_int.h, project/at_start_f413/examples/tmr/7_pwm_output/src/at32f413_int.c, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/cascade_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_int.h, project/at_start_f413/examples/tmr/complementary_signals/src/at32f413_int.c, project/at_start_f413/examples/tmr/dma/inc/at32f413_int.h, project/at_start_f413/examples/tmr/dma/src/at32f413_int.c, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_int.h, project/at_start_f413/examples/tmr/dma_burst/src/at32f413_int.c, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/tmr/encoder_tmr2/src/at32f413_int.c, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_int.h, project/at_start_f413/examples/tmr/external_clock/src/at32f413_int.c, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/src/at32f413_int.c, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_int.h, project/at_start_f413/examples/tmr/hang_mode/src/at32f413_int.c, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_int.h, project/at_start_f413/examples/tmr/input_capture/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_high/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_low/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_int.h, project/at_start_f413/examples/tmr/one_cycle/src/at32f413_int.c, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/parallel_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_input_dma/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_int.h, project/at_start_f413/examples/tmr/timer_base/src/at32f413_int.c, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/tmr1_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_int.h, project/at_start_f413/examples/tmr/tmr2_32bit/src/at32f413_int.c, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_int.h, project/at_start_f413/examples/usart/half_duplex/src/at32f413_int.c, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_int.h, project/at_start_f413/examples/usart/hw_flow_control/src/at32f413_int.c, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_int.h, project/at_start_f413/examples/usart/idle_detection/src/at32f413_int.c, project/at_start_f413/examples/usart/interrupt/inc/at32f413_int.h, project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/irda/inc/at32f413_int.h, project/at_start_f413/examples/usart/irda/src/at32f413_int.c, project/at_start_f413/examples/usart/polling/inc/at32f413_int.h, project/at_start_f413/examples/usart/polling/src/at32f413_int.c, project/at_start_f413/examples/usart/printf/inc/at32f413_int.h, project/at_start_f413/examples/usart/printf/src/at32f413_int.c, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_int.h, project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c, project/at_start_f413/examples/usart/rs485/inc/at32f413_int.h, project/at_start_f413/examples/usart/rs485/src/at32f413_int.c, project/at_start_f413/examples/usart/smartcard/inc/at32f413_int.h, project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c, project/at_start_f413/examples/usart/synchronous/inc/at32f413_int.h, project/at_start_f413/examples/usart/synchronous/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_int.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/src/at32f413_int.c, project/at_start_f413/examples/usb_device/audio/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/audio/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_audio_hid/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/src/at32f413_int.c, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/custom_hid/src/at32f413_int.c, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/keyboard/src/at32f413_int.c, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/mouse/src/at32f413_int.c, project/at_start_f413/examples/usb_device/msc/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/msc/src/at32f413_int.c, project/at_start_f413/examples/usb_device/printer/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/printer/src/at32f413_int.c, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/vcp_loopback/src/at32f413_int.c, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/src/at32f413_int.c, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/winusb/src/at32f413_int.c, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_int.h, project/at_start_f413/examples/wdt/wdt_reset/src/at32f413_int.c, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_int.h, project/at_start_f413/examples/wdt/wdt_standby/src/at32f413_int.c, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_int.h, project/at_start_f413/examples/wwdt/wwdt_reset/src/at32f413_int.c, project/at_start_f413/templates/src/at32f413_int.c, project/at_start_f413/templates/inc/at32f413_int.h, utilities/at32f413_freertos_demo/inc/at32f413_int.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_int.h, utilities/at32f413_gen_random_number_demo/src/at32f413_int.c, utilities/at32f413_slib_demo/project_l0/inc/at32f413_int.h, utilities/at32f413_slib_demo/project_l0/src/at32f413_int.c, utilities/at32f413_slib_demo/project_l1/inc/at32f413_int.h, utilities/at32f413_slib_demo/project_l1/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/src/at32f413_int.c
  • switch_system_clock() : project/at_start_f413/examples/crm/sysclk_switch/src/main.c
  • swj_dp_config() : project/at_start_f413/examples/gpio/swjtag_remap/src/main.c
  • system_clock_config() : project/at_start_f413/examples/acc/calibration/inc/at32f413_clock.h, project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_clock.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/at32f413_clock.c, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_clock.h, project/at_start_f413/examples/adc/current_vref_value_check/src/at32f413_clock.c, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_clock.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/src/at32f413_clock.c, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_clock.h, project/at_start_f413/examples/adc/internal_temperature_sensor/src/at32f413_clock.c, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_clock.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/at32f413_clock.c, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_clock.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/at32f413_clock.c, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_clock.h, project/at_start_f413/examples/adc/voltage_monitoring/src/at32f413_clock.c, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_clock.h, project/at_start_f413/examples/bpr/bpr_data/src/at32f413_clock.c, project/at_start_f413/examples/bpr/tamper/inc/at32f413_clock.h, project/at_start_f413/examples/bpr/tamper/src/at32f413_clock.c, project/at_start_f413/examples/can/communication_mode/inc/at32f413_clock.h, project/at_start_f413/examples/can/communication_mode/src/at32f413_clock.c, project/at_start_f413/examples/can/filter/inc/at32f413_clock.h, project/at_start_f413/examples/can/filter/src/at32f413_clock.c, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_clock.h, project/at_start_f413/examples/can/loopback_mode/src/at32f413_clock.c, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_clock.h, project/at_start_f413/examples/cortex_m4/bit_band/src/at32f413_clock.c, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_clock.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/at32f413_clock.c, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_clock.h, project/at_start_f413/examples/cortex_m4/fpu/src/at32f413_clock.c, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_clock.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_clock.c, project/at_start_f413/examples/crc/calculation/inc/at32f413_clock.h, project/at_start_f413/examples/crc/calculation/src/at32f413_clock.c, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_clock.h, project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_clock.c, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_clock.h, project/at_start_f413/examples/crm/sysclk_switch/src/at32f413_clock.c, project/at_start_f413/examples/debug/tmr1/inc/at32f413_clock.h, project/at_start_f413/examples/debug/tmr1/src/at32f413_clock.c, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_clock.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/src/at32f413_clock.c, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_clock.h, project/at_start_f413/examples/dma/flash_to_sram/src/at32f413_clock.c, project/at_start_f413/examples/exint/exint_config/inc/at32f413_clock.h, project/at_start_f413/examples/exint/exint_config/src/at32f413_clock.c, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_clock.h, project/at_start_f413/examples/exint/exint_software_trigger/src/at32f413_clock.c, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_clock.h, project/at_start_f413/examples/flash/flash_write_read/src/at32f413_clock.c, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_clock.h, project/at_start_f413/examples/flash/operate_spim/src/at32f413_clock.c, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_clock.h, project/at_start_f413/examples/flash/run_in_spim/src/at32f413_clock.c, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_clock.h, project/at_start_f413/examples/gpio/io_toggle/src/at32f413_clock.c, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_clock.h, project/at_start_f413/examples/gpio/led_toggle/src/at32f413_clock.c, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_clock.h, project/at_start_f413/examples/gpio/swjtag_remap/src/at32f413_clock.c, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_clock.h, project/at_start_f413/examples/i2c/communication_dma/src/at32f413_clock.c, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_clock.h, project/at_start_f413/examples/i2c/communication_int/src/at32f413_clock.c, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_clock.h, project/at_start_f413/examples/i2c/communication_poll/src/at32f413_clock.c, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_clock.h, project/at_start_f413/examples/i2c/eeprom/src/at32f413_clock.c, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_clock.h, project/at_start_f413/examples/i2c/memory_write/src/at32f413_clock.c, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_clock.h, project/at_start_f413/examples/i2s/halfduplex_dma/src/at32f413_clock.c, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_clock.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/src/at32f413_clock.c, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_clock.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/at32f413_clock.c, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_clock.h, project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_clock.c, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_clock.h, project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_clock.c, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_clock.h, project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_clock.c, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_clock.h, project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_clock.c, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_clock.h, project/at_start_f413/examples/pwc/standby_rtc/src/at32f413_clock.c, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_clock.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/src/at32f413_clock.c, project/at_start_f413/examples/rtc/calendar/inc/at32f413_clock.h, project/at_start_f413/examples/rtc/calendar/src/at32f413_clock.c, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_clock.h, project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_clock.c, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_clock.h, project/at_start_f413/examples/sdio/emmc_card/src/at32f413_clock.c, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_clock.h, project/at_start_f413/examples/sdio/sd_mmc_card/src/at32f413_clock.c, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_clock.h, project/at_start_f413/examples/sdio/sdio_fatfs/src/at32f413_clock.c, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_clock.h, project/at_start_f413/examples/spi/crc_transfer_polling/src/at32f413_clock.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_clock.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/at32f413_clock.c, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_clock.h, project/at_start_f413/examples/spi/fullduplex_polling/src/at32f413_clock.c, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_clock.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/at32f413_clock.c, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_clock.h, project/at_start_f413/examples/spi/halfduplex_interrupt/src/at32f413_clock.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_clock.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/at32f413_clock.c, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_clock.h, project/at_start_f413/examples/spi/only_receive_mode_polling/src/at32f413_clock.c, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_clock.h, project/at_start_f413/examples/spi/w25q_flash/src/at32f413_clock.c, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/6_steps/src/at32f413_clock.c, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/7_pwm_output/src/at32f413_clock.c, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/cascade_synchro/src/at32f413_clock.c, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/complementary_signals/src/at32f413_clock.c, project/at_start_f413/examples/tmr/dma/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/dma/src/at32f413_clock.c, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/dma_burst/src/at32f413_clock.c, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/encoder_tmr2/src/at32f413_clock.c, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/external_clock/src/at32f413_clock.c, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/src/at32f413_clock.c, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/hang_mode/src/at32f413_clock.c, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/input_capture/src/at32f413_clock.c, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/oc_high/src/at32f413_clock.c, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/oc_low/src/at32f413_clock.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_clock.c, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_clock.c, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/one_cycle/src/at32f413_clock.c, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/parallel_synchro/src/at32f413_clock.c, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/pwm_input/src/at32f413_clock.c, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/pwm_input_dma/src/at32f413_clock.c, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_clock.c, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/src/at32f413_clock.c, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/src/at32f413_clock.c, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/timer_base/src/at32f413_clock.c, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/tmr1_synchro/src/at32f413_clock.c, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_clock.h, project/at_start_f413/examples/tmr/tmr2_32bit/src/at32f413_clock.c, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_clock.h, project/at_start_f413/examples/usart/half_duplex/src/at32f413_clock.c, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_clock.h, project/at_start_f413/examples/usart/hw_flow_control/src/at32f413_clock.c, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_clock.h, project/at_start_f413/examples/usart/idle_detection/src/at32f413_clock.c, project/at_start_f413/examples/usart/interrupt/inc/at32f413_clock.h, project/at_start_f413/examples/usart/interrupt/src/at32f413_clock.c, project/at_start_f413/examples/usart/irda/inc/at32f413_clock.h, project/at_start_f413/examples/usart/irda/src/at32f413_clock.c, project/at_start_f413/examples/usart/polling/inc/at32f413_clock.h, project/at_start_f413/examples/usart/polling/src/at32f413_clock.c, project/at_start_f413/examples/usart/printf/inc/at32f413_clock.h, project/at_start_f413/examples/usart/printf/src/at32f413_clock.c, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_clock.h, project/at_start_f413/examples/usart/receiver_mute/src/at32f413_clock.c, project/at_start_f413/examples/usart/rs485/inc/at32f413_clock.h, project/at_start_f413/examples/usart/rs485/src/at32f413_clock.c, project/at_start_f413/examples/usart/smartcard/inc/at32f413_clock.h, project/at_start_f413/examples/usart/smartcard/src/at32f413_clock.c, project/at_start_f413/examples/usart/synchronous/inc/at32f413_clock.h, project/at_start_f413/examples/usart/synchronous/src/at32f413_clock.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_clock.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_clock.c, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_clock.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/src/at32f413_clock.c, project/at_start_f413/examples/usb_device/audio/inc/at32f413_clock.h, project/at_start_f413/examples/usb_device/audio/src/at32f413_clock.c, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_clock.h, project/at_start_f413/examples/usb_device/composite_audio_hid/src/at32f413_clock.c, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_clock.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/at32f413_clock.c, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_clock.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/src/at32f413_clock.c, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_clock.h, project/at_start_f413/examples/usb_device/custom_hid/src/at32f413_clock.c, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_clock.h, project/at_start_f413/examples/usb_device/keyboard/src/at32f413_clock.c, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_clock.h, project/at_start_f413/examples/usb_device/mouse/src/at32f413_clock.c, project/at_start_f413/examples/usb_device/msc/inc/at32f413_clock.h, project/at_start_f413/examples/usb_device/msc/src/at32f413_clock.c, project/at_start_f413/examples/usb_device/printer/inc/at32f413_clock.h, project/at_start_f413/examples/usb_device/printer/src/at32f413_clock.c, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_clock.h, project/at_start_f413/examples/usb_device/vcp_loopback/src/at32f413_clock.c, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_clock.h, project/at_start_f413/examples/usb_device/virtual_comport/src/at32f413_clock.c, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_clock.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/src/at32f413_clock.c, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_clock.h, project/at_start_f413/examples/usb_device/winusb/src/at32f413_clock.c, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_clock.h, project/at_start_f413/examples/wdt/wdt_reset/src/at32f413_clock.c, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_clock.h, project/at_start_f413/examples/wdt/wdt_standby/src/at32f413_clock.c, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_clock.h, project/at_start_f413/examples/wwdt/wwdt_reset/src/at32f413_clock.c, project/at_start_f413/templates/src/at32f413_clock.c, project/at_start_f413/templates/inc/at32f413_clock.h, utilities/at32f413_freertos_demo/inc/at32f413_clock.h, utilities/at32f413_freertos_demo/src/at32f413_clock.c, utilities/at32f413_gen_random_number_demo/inc/at32f413_clock.h, utilities/at32f413_gen_random_number_demo/src/at32f413_clock.c, utilities/at32f413_slib_demo/project_l0/inc/at32f413_clock.h, utilities/at32f413_slib_demo/project_l0/src/at32f413_clock.c, utilities/at32f413_slib_demo/project_l1/inc/at32f413_clock.h, utilities/at32f413_slib_demo/project_l1/src/at32f413_clock.c, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_clock.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/at32f413_clock.c, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_clock.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/at32f413_clock.c, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_clock.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/src/at32f413_clock.c, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_clock.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/at32f413_clock.c, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_clock.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/at32f413_clock.c, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_clock.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/src/at32f413_clock.c
  • system_clock_config_for_acc() : project/at_start_f413/examples/acc/calibration/src/main.c
  • system_clock_recover() : project/at_start_f413/examples/pwc/deepsleep_rtc/src/main.c, project/at_start_f413/examples/usb_device/keyboard/src/main.c, project/at_start_f413/examples/usb_device/mouse/src/main.c
  • system_core_clock_update() : system_at32f413.c, system_at32f413.h
  • SystemInit() : system_at32f413.c, system_at32f413.h
  • systick_clock_source_config() : at32f413_misc.h, at32f413_misc.c
  • systick_configuration() : project/at_start_f413/examples/tmr/6_steps/src/main.c
  • SysTick_Handler() : project/at_start_f413/examples/acc/calibration/inc/at32f413_int.h, project/at_start_f413/examples/acc/calibration/src/at32f413_int.c, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_int.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/at32f413_int.c, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_int.h, project/at_start_f413/examples/adc/current_vref_value_check/src/at32f413_int.c, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_int.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/src/at32f413_int.c, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_int.h, project/at_start_f413/examples/adc/internal_temperature_sensor/src/at32f413_int.c, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_int.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/at32f413_int.c, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_int.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/at32f413_int.c, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_int.h, project/at_start_f413/examples/adc/voltage_monitoring/src/at32f413_int.c, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_int.h, project/at_start_f413/examples/bpr/bpr_data/src/at32f413_int.c, project/at_start_f413/examples/bpr/tamper/inc/at32f413_int.h, project/at_start_f413/examples/bpr/tamper/src/at32f413_int.c, project/at_start_f413/examples/can/communication_mode/inc/at32f413_int.h, project/at_start_f413/examples/can/communication_mode/src/at32f413_int.c, project/at_start_f413/examples/can/filter/inc/at32f413_int.h, project/at_start_f413/examples/can/filter/src/at32f413_int.c, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_int.h, project/at_start_f413/examples/can/loopback_mode/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/bit_band/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/fpu/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_int.c, project/at_start_f413/examples/crc/calculation/inc/at32f413_int.h, project/at_start_f413/examples/crc/calculation/src/at32f413_int.c, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_int.h, project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_int.c, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_int.h, project/at_start_f413/examples/crm/sysclk_switch/src/at32f413_int.c, project/at_start_f413/examples/debug/tmr1/inc/at32f413_int.h, project/at_start_f413/examples/debug/tmr1/src/at32f413_int.c, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_int.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/src/at32f413_int.c, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_int.h, project/at_start_f413/examples/dma/flash_to_sram/src/at32f413_int.c, project/at_start_f413/examples/exint/exint_config/inc/at32f413_int.h, project/at_start_f413/examples/exint/exint_config/src/at32f413_int.c, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_int.h, project/at_start_f413/examples/exint/exint_software_trigger/src/at32f413_int.c, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_int.h, project/at_start_f413/examples/flash/flash_write_read/src/at32f413_int.c, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_int.h, project/at_start_f413/examples/flash/operate_spim/src/at32f413_int.c, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_int.h, project/at_start_f413/examples/flash/run_in_spim/src/at32f413_int.c, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_int.h, project/at_start_f413/examples/gpio/io_toggle/src/at32f413_int.c, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_int.h, project/at_start_f413/examples/gpio/led_toggle/src/at32f413_int.c, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_int.h, project/at_start_f413/examples/gpio/swjtag_remap/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_poll/src/at32f413_int.c, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_int.h, project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_int.h, project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_int.h, project/at_start_f413/examples/i2s/halfduplex_dma/src/at32f413_int.c, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/src/at32f413_int.c, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_int.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/at32f413_int.c, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_int.h, project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_int.c, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_int.h, project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_int.c, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_int.c, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_int.h, project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_int.h, project/at_start_f413/examples/pwc/standby_rtc/src/at32f413_int.c, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_int.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/src/at32f413_int.c, project/at_start_f413/examples/rtc/calendar/inc/at32f413_int.h, project/at_start_f413/examples/rtc/calendar/src/at32f413_int.c, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_int.h, project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_int.h, project/at_start_f413/examples/sdio/emmc_card/src/at32f413_int.c, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_int.h, project/at_start_f413/examples/sdio/sd_mmc_card/src/at32f413_int.c, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_int.h, project/at_start_f413/examples/sdio/sdio_fatfs/src/at32f413_int.c, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/crc_transfer_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_int.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/at32f413_int.c, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/fullduplex_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_interrupt/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/at32f413_int.c, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/only_receive_mode_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_int.h, project/at_start_f413/examples/spi/w25q_flash/src/at32f413_int.c, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_int.h, project/at_start_f413/examples/tmr/6_steps/src/at32f413_int.c, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_int.h, project/at_start_f413/examples/tmr/7_pwm_output/src/at32f413_int.c, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/cascade_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_int.h, project/at_start_f413/examples/tmr/complementary_signals/src/at32f413_int.c, project/at_start_f413/examples/tmr/dma/inc/at32f413_int.h, project/at_start_f413/examples/tmr/dma/src/at32f413_int.c, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_int.h, project/at_start_f413/examples/tmr/dma_burst/src/at32f413_int.c, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/tmr/encoder_tmr2/src/at32f413_int.c, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_int.h, project/at_start_f413/examples/tmr/external_clock/src/at32f413_int.c, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/src/at32f413_int.c, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_int.h, project/at_start_f413/examples/tmr/hang_mode/src/at32f413_int.c, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_int.h, project/at_start_f413/examples/tmr/input_capture/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_high/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_low/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_int.h, project/at_start_f413/examples/tmr/one_cycle/src/at32f413_int.c, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/parallel_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_input_dma/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_int.h, project/at_start_f413/examples/tmr/timer_base/src/at32f413_int.c, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/tmr1_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_int.h, project/at_start_f413/examples/tmr/tmr2_32bit/src/at32f413_int.c, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_int.h, project/at_start_f413/examples/usart/half_duplex/src/at32f413_int.c, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_int.h, project/at_start_f413/examples/usart/hw_flow_control/src/at32f413_int.c, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_int.h, project/at_start_f413/examples/usart/idle_detection/src/at32f413_int.c, project/at_start_f413/examples/usart/interrupt/inc/at32f413_int.h, project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/irda/inc/at32f413_int.h, project/at_start_f413/examples/usart/irda/src/at32f413_int.c, project/at_start_f413/examples/usart/polling/inc/at32f413_int.h, project/at_start_f413/examples/usart/polling/src/at32f413_int.c, project/at_start_f413/examples/usart/printf/inc/at32f413_int.h, project/at_start_f413/examples/usart/printf/src/at32f413_int.c, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_int.h, project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c, project/at_start_f413/examples/usart/rs485/inc/at32f413_int.h, project/at_start_f413/examples/usart/rs485/src/at32f413_int.c, project/at_start_f413/examples/usart/smartcard/inc/at32f413_int.h, project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c, project/at_start_f413/examples/usart/synchronous/inc/at32f413_int.h, project/at_start_f413/examples/usart/synchronous/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_int.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/src/at32f413_int.c, project/at_start_f413/examples/usb_device/audio/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/audio/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_audio_hid/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/src/at32f413_int.c, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/custom_hid/src/at32f413_int.c, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/keyboard/src/at32f413_int.c, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/mouse/src/at32f413_int.c, project/at_start_f413/examples/usb_device/msc/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/msc/src/at32f413_int.c, project/at_start_f413/examples/usb_device/printer/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/printer/src/at32f413_int.c, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/vcp_loopback/src/at32f413_int.c, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/src/at32f413_int.c, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/winusb/src/at32f413_int.c, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_int.h, project/at_start_f413/examples/wdt/wdt_reset/src/at32f413_int.c, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_int.h, project/at_start_f413/examples/wdt/wdt_standby/src/at32f413_int.c, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_int.h, project/at_start_f413/examples/wwdt/wwdt_reset/src/at32f413_int.c, project/at_start_f413/templates/src/at32f413_int.c, project/at_start_f413/templates/inc/at32f413_int.h, utilities/at32f413_freertos_demo/inc/at32f413_int.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_int.h, utilities/at32f413_gen_random_number_demo/src/at32f413_int.c, utilities/at32f413_slib_demo/project_l0/inc/at32f413_int.h, utilities/at32f413_slib_demo/project_l0/src/at32f413_int.c, utilities/at32f413_slib_demo/project_l1/inc/at32f413_int.h, utilities/at32f413_slib_demo/project_l1/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/src/at32f413_int.c
  • systick_handler() : project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/systick_interrupt/src/main.c
  • systick_interrupt_config() : project/at_start_f413/examples/cortex_m4/systick_interrupt/src/main.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all functions with links to the files they belong to:

- t -

  • TAMPER_IRQHandler() : project/at_start_f413/examples/bpr/tamper/src/at32f413_int.c
  • TMR1_BRK_TMR9_IRQHandler() : project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c
  • tmr1_config() : project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c, project/at_start_f413/examples/exint/exint_software_trigger/src/main.c
  • TMR1_OVF_TMR10_IRQHandler() : project/at_start_f413/examples/debug/tmr1/src/main.c, project/at_start_f413/examples/exint/exint_software_trigger/src/main.c, project/at_start_f413/examples/tmr/timer_base/src/main.c
  • TMR1_TRG_HALL_TMR11_IRQHandler() : project/at_start_f413/examples/tmr/6_steps/src/main.c
  • tmr2_config() : project/at_start_f413/examples/pwc/sleep_tmr2/src/main.c
  • TMR2_GLOBAL_IRQHandler() : project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_int.c, project/at_start_f413/examples/tmr/hall_xor_tmr2/src/main.c, project/at_start_f413/examples/tmr/oc_high/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_low/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c
  • TMR3_GLOBAL_IRQHandler() : project/at_start_f413/examples/tmr/input_capture/src/main.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c, app_led3_toggle/src/tmr.c, app_led4_toggle/src/tmr.c, bootloader/src/tmr.c
  • TMR5_GLOBAL_IRQHandler() : project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c
  • tmr_32_bit_function_enable() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_base_init() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_brkdt_config() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_brkdt_default_para_init() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_channel1_input_select() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_channel_buffer_enable() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_channel_dma_select() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_channel_enable() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_channel_value_get() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_channel_value_set() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_clock_source_div_set() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_cnt_dir_set() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_counter_enable() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_counter_value_get() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_counter_value_set() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_div_value_get() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_div_value_set() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_dma_control_config() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_dma_request_enable() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_encoder_mode_config() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_event_sw_trigger() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_external_clock_config() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_external_clock_mode1_config() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_external_clock_mode2_config() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_flag_clear() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_flag_get() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_force_output_set() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_hall_select() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_init() : app_led3_toggle/inc/tmr.h, app_led3_toggle/src/tmr.c, app_led4_toggle/inc/tmr.h, app_led4_toggle/src/tmr.c, bootloader/inc/tmr.h, bootloader/src/tmr.c
  • tmr_input_channel_divider_set() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_input_channel_filter_set() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_input_channel_init() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_input_default_para_init() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_internal_clock_set() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_interrupt_enable() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_interrupt_flag_get() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_one_cycle_mode_enable() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_output_channel_buffer_enable() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_output_channel_config() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_output_channel_immediately_set() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_output_channel_mode_select() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_output_channel_polarity_set() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_output_channel_switch_set() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_output_default_para_init() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_output_enable() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_overflow_event_disable() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_overflow_request_source_set() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_period_buffer_enable() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_period_value_get() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_period_value_set() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_primary_mode_select() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_pwm_input_config() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_repetition_counter_set() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_reset() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_sub_mode_select() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_sub_sync_mode_set() : at32f413_tmr.h, at32f413_tmr.c
  • tmr_trigger_input_select() : at32f413_tmr.h, at32f413_tmr.c
  • tx_data_fill() : project/at_start_f413/examples/spi/w25q_flash/src/main.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all functions with links to the files they belong to:

- u -

  • uart_init() : project/at_start_f413/examples/bpr/bpr_data/src/main.c, project/at_start_f413/examples/tmr/input_capture/src/main.c, app_led3_toggle/inc/usart.h, app_led3_toggle/src/usart.c, app_led4_toggle/inc/usart.h, app_led4_toggle/src/usart.c, bootloader/inc/usart.h, bootloader/src/usart.c
  • uart_print_init() : at32f413_board.c, at32f413_board.h
  • UsageFault_Handler() : project/at_start_f413/examples/acc/calibration/inc/at32f413_int.h, project/at_start_f413/examples/acc/calibration/src/at32f413_int.c, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_int.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/at32f413_int.c, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_int.h, project/at_start_f413/examples/adc/current_vref_value_check/src/at32f413_int.c, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_int.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/src/at32f413_int.c, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_int.h, project/at_start_f413/examples/adc/internal_temperature_sensor/src/at32f413_int.c, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_int.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/at32f413_int.c, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_int.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/at32f413_int.c, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_int.h, project/at_start_f413/examples/adc/voltage_monitoring/src/at32f413_int.c, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_int.h, project/at_start_f413/examples/bpr/bpr_data/src/at32f413_int.c, project/at_start_f413/examples/bpr/tamper/inc/at32f413_int.h, project/at_start_f413/examples/bpr/tamper/src/at32f413_int.c, project/at_start_f413/examples/can/communication_mode/inc/at32f413_int.h, project/at_start_f413/examples/can/communication_mode/src/at32f413_int.c, project/at_start_f413/examples/can/filter/inc/at32f413_int.h, project/at_start_f413/examples/can/filter/src/at32f413_int.c, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_int.h, project/at_start_f413/examples/can/loopback_mode/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/bit_band/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/fpu/src/at32f413_int.c, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_int.c, project/at_start_f413/examples/crc/calculation/inc/at32f413_int.h, project/at_start_f413/examples/crc/calculation/src/at32f413_int.c, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_int.h, project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_int.c, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_int.h, project/at_start_f413/examples/crm/sysclk_switch/src/at32f413_int.c, project/at_start_f413/examples/debug/tmr1/inc/at32f413_int.h, project/at_start_f413/examples/debug/tmr1/src/at32f413_int.c, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_int.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/src/at32f413_int.c, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_int.h, project/at_start_f413/examples/dma/flash_to_sram/src/at32f413_int.c, project/at_start_f413/examples/exint/exint_config/inc/at32f413_int.h, project/at_start_f413/examples/exint/exint_config/src/at32f413_int.c, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_int.h, project/at_start_f413/examples/exint/exint_software_trigger/src/at32f413_int.c, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_int.h, project/at_start_f413/examples/flash/flash_write_read/src/at32f413_int.c, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_int.h, project/at_start_f413/examples/flash/operate_spim/src/at32f413_int.c, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_int.h, project/at_start_f413/examples/flash/run_in_spim/src/at32f413_int.c, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_int.h, project/at_start_f413/examples/gpio/io_toggle/src/at32f413_int.c, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_int.h, project/at_start_f413/examples/gpio/led_toggle/src/at32f413_int.c, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_int.h, project/at_start_f413/examples/gpio/swjtag_remap/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_int.h, project/at_start_f413/examples/i2c/communication_poll/src/at32f413_int.c, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_int.h, project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_int.h, project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_int.h, project/at_start_f413/examples/i2s/halfduplex_dma/src/at32f413_int.c, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/src/at32f413_int.c, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_int.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/at32f413_int.c, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_int.h, project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_int.c, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_int.h, project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_int.c, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_int.c, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_int.h, project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_int.h, project/at_start_f413/examples/pwc/standby_rtc/src/at32f413_int.c, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_int.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/src/at32f413_int.c, project/at_start_f413/examples/rtc/calendar/inc/at32f413_int.h, project/at_start_f413/examples/rtc/calendar/src/at32f413_int.c, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_int.h, project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_int.h, project/at_start_f413/examples/sdio/emmc_card/src/at32f413_int.c, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_int.h, project/at_start_f413/examples/sdio/sd_mmc_card/src/at32f413_int.c, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_int.h, project/at_start_f413/examples/sdio/sdio_fatfs/src/at32f413_int.c, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/crc_transfer_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_int.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/at32f413_int.c, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/fullduplex_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_interrupt/src/at32f413_int.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_int.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/at32f413_int.c, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_int.h, project/at_start_f413/examples/spi/only_receive_mode_polling/src/at32f413_int.c, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_int.h, project/at_start_f413/examples/spi/w25q_flash/src/at32f413_int.c, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_int.h, project/at_start_f413/examples/tmr/6_steps/src/at32f413_int.c, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_int.h, project/at_start_f413/examples/tmr/7_pwm_output/src/at32f413_int.c, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/cascade_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_int.h, project/at_start_f413/examples/tmr/complementary_signals/src/at32f413_int.c, project/at_start_f413/examples/tmr/dma/inc/at32f413_int.h, project/at_start_f413/examples/tmr/dma/src/at32f413_int.c, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_int.h, project/at_start_f413/examples/tmr/dma_burst/src/at32f413_int.c, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/tmr/encoder_tmr2/src/at32f413_int.c, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_int.h, project/at_start_f413/examples/tmr/external_clock/src/at32f413_int.c, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_int.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/src/at32f413_int.c, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_int.h, project/at_start_f413/examples/tmr/hang_mode/src/at32f413_int.c, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_int.h, project/at_start_f413/examples/tmr/input_capture/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_high/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_low/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_int.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_int.h, project/at_start_f413/examples/tmr/one_cycle/src/at32f413_int.c, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/parallel_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_input_dma/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_int.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_int.h, project/at_start_f413/examples/tmr/timer_base/src/at32f413_int.c, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_int.h, project/at_start_f413/examples/tmr/tmr1_synchro/src/at32f413_int.c, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_int.h, project/at_start_f413/examples/tmr/tmr2_32bit/src/at32f413_int.c, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_int.h, project/at_start_f413/examples/usart/half_duplex/src/at32f413_int.c, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_int.h, project/at_start_f413/examples/usart/hw_flow_control/src/at32f413_int.c, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_int.h, project/at_start_f413/examples/usart/idle_detection/src/at32f413_int.c, project/at_start_f413/examples/usart/interrupt/inc/at32f413_int.h, project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/irda/inc/at32f413_int.h, project/at_start_f413/examples/usart/irda/src/at32f413_int.c, project/at_start_f413/examples/usart/polling/inc/at32f413_int.h, project/at_start_f413/examples/usart/polling/src/at32f413_int.c, project/at_start_f413/examples/usart/printf/inc/at32f413_int.h, project/at_start_f413/examples/usart/printf/src/at32f413_int.c, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_int.h, project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c, project/at_start_f413/examples/usart/rs485/inc/at32f413_int.h, project/at_start_f413/examples/usart/rs485/src/at32f413_int.c, project/at_start_f413/examples/usart/smartcard/inc/at32f413_int.h, project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c, project/at_start_f413/examples/usart/synchronous/inc/at32f413_int.h, project/at_start_f413/examples/usart/synchronous/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_int.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_int.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/src/at32f413_int.c, project/at_start_f413/examples/usb_device/audio/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/audio/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_audio_hid/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/at32f413_int.c, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/src/at32f413_int.c, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/custom_hid/src/at32f413_int.c, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/keyboard/src/at32f413_int.c, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/mouse/src/at32f413_int.c, project/at_start_f413/examples/usb_device/msc/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/msc/src/at32f413_int.c, project/at_start_f413/examples/usb_device/printer/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/printer/src/at32f413_int.c, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/vcp_loopback/src/at32f413_int.c, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/src/at32f413_int.c, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_int.h, project/at_start_f413/examples/usb_device/winusb/src/at32f413_int.c, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_int.h, project/at_start_f413/examples/wdt/wdt_reset/src/at32f413_int.c, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_int.h, project/at_start_f413/examples/wdt/wdt_standby/src/at32f413_int.c, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_int.h, project/at_start_f413/examples/wwdt/wwdt_reset/src/at32f413_int.c, project/at_start_f413/templates/src/at32f413_int.c, project/at_start_f413/templates/inc/at32f413_int.h, utilities/at32f413_freertos_demo/inc/at32f413_int.h, utilities/at32f413_freertos_demo/src/at32f413_int.c, utilities/at32f413_gen_random_number_demo/inc/at32f413_int.h, utilities/at32f413_gen_random_number_demo/src/at32f413_int.c, utilities/at32f413_slib_demo/project_l0/inc/at32f413_int.h, utilities/at32f413_slib_demo/project_l0/src/at32f413_int.c, utilities/at32f413_slib_demo/project_l1/inc/at32f413_int.h, utilities/at32f413_slib_demo/project_l1/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_int.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_int.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/src/at32f413_int.c
  • usart1_config() : project/at_start_f413/examples/pwc/sleep_usart1/src/main.c
  • USART1_IRQHandler() : project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c, app_led3_toggle/src/usart.c, app_led4_toggle/src/usart.c, bootloader/src/usart.c
  • USART2_IRQHandler() : project/at_start_f413/examples/usart/idle_detection/src/at32f413_int.c, project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/rs485/src/main.c, project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c, project/at_start_f413/examples/usb_device/virtual_comport/src/main.c
  • USART3_IRQHandler() : project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c
  • usart_break_bit_num_set() : at32f413_usart.h, at32f413_usart.c
  • usart_break_send() : at32f413_usart.h, at32f413_usart.c
  • usart_clock_config() : at32f413_usart.h, at32f413_usart.c
  • usart_clock_enable() : at32f413_usart.h, at32f413_usart.c
  • usart_configuration() : project/at_start_f413/examples/usart/half_duplex/src/main.c, project/at_start_f413/examples/usart/hw_flow_control/src/main.c, project/at_start_f413/examples/usart/idle_detection/src/main.c, project/at_start_f413/examples/usart/interrupt/src/main.c, project/at_start_f413/examples/usart/irda/src/main.c, project/at_start_f413/examples/usart/polling/src/main.c, project/at_start_f413/examples/usart/receiver_mute/src/main.c, project/at_start_f413/examples/usart/smartcard/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c
  • usart_data_receive() : at32f413_usart.h, at32f413_usart.c
  • usart_data_transmit() : at32f413_usart.h, at32f413_usart.c
  • usart_dma_receiver_enable() : at32f413_usart.h, at32f413_usart.c
  • usart_dma_transmitter_enable() : at32f413_usart.h, at32f413_usart.c
  • usart_enable() : at32f413_usart.h, at32f413_usart.c
  • usart_flag_clear() : at32f413_usart.h, at32f413_usart.c
  • usart_flag_get() : at32f413_usart.h, at32f413_usart.c
  • usart_gpio_config() : project/at_start_f413/examples/usb_device/virtual_comport/src/main.c
  • usart_hardware_flow_control_set() : at32f413_usart.h, at32f413_usart.c
  • usart_init() : at32f413_usart.h, at32f413_usart.c
  • usart_interrupt_enable() : at32f413_usart.h, at32f413_usart.c
  • usart_interrupt_flag_get() : at32f413_usart.h, at32f413_usart.c
  • usart_irda_low_power_enable() : at32f413_usart.h, at32f413_usart.c
  • usart_irda_mode_enable() : at32f413_usart.h, at32f413_usart.c
  • usart_irda_smartcard_division_set() : at32f413_usart.h, at32f413_usart.c
  • usart_lin_mode_enable() : at32f413_usart.h, at32f413_usart.c
  • usart_parity_selection_config() : at32f413_usart.h, at32f413_usart.c
  • usart_receive_data() : project/at_start_f413/examples/usb_device/virtual_comport/src/main.c
  • usart_receiver_enable() : at32f413_usart.h, at32f413_usart.c
  • usart_receiver_mute_enable() : at32f413_usart.h, at32f413_usart.c
  • usart_reset() : at32f413_usart.h, at32f413_usart.c
  • usart_send_data() : project/at_start_f413/examples/usb_device/virtual_comport/src/main.c
  • usart_single_line_halfduplex_select() : at32f413_usart.h, at32f413_usart.c
  • usart_smartcard_guard_time_set() : at32f413_usart.h, at32f413_usart.c
  • usart_smartcard_mode_enable() : at32f413_usart.h, at32f413_usart.c
  • usart_smartcard_nack_set() : at32f413_usart.h, at32f413_usart.c
  • usart_spi_configuration() : project/at_start_f413/examples/usart/synchronous/src/main.c
  • usart_transmitter_enable() : at32f413_usart.h, at32f413_usart.c
  • usart_wakeup_id_set() : at32f413_usart.h, at32f413_usart.c
  • usart_wakeup_mode_set() : at32f413_usart.h, at32f413_usart.c
  • usb_buffer_free() : at32f413_usb.h, at32f413_usb.c
  • usb_buffer_malloc() : at32f413_usb.h, at32f413_usb.c
  • usb_clock48m_select() : project/at_start_f413/examples/acc/calibration/src/main.c, project/at_start_f413/examples/usb_device/audio/src/main.c, project/at_start_f413/examples/usb_device/composite_audio_hid/src/main.c, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/main.c, project/at_start_f413/examples/usb_device/composite_vcp_msc/src/main.c, project/at_start_f413/examples/usb_device/custom_hid/src/main.c, project/at_start_f413/examples/usb_device/keyboard/src/main.c, project/at_start_f413/examples/usb_device/mouse/src/main.c, project/at_start_f413/examples/usb_device/msc/src/main.c, project/at_start_f413/examples/usb_device/printer/src/main.c, project/at_start_f413/examples/usb_device/vcp_loopback/src/main.c, project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c, project/at_start_f413/examples/usb_device/winusb/src/main.c, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/main.c, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/main.c, utilities/at32f413_usb_iap_demo/source_code/bootloader/src/main.c
  • usb_connect() : at32f413_usb.h, at32f413_usb.c
  • usb_delay_ms() : project/at_start_f413/examples/acc/calibration/inc/usb_conf.h, project/at_start_f413/examples/usb_device/audio/inc/usb_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/usb_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/usb_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/src/main.c, project/at_start_f413/examples/usb_device/custom_hid/inc/usb_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/usb_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/usb_conf.h, project/at_start_f413/examples/usb_device/msc/inc/usb_conf.h, project/at_start_f413/examples/usb_device/printer/inc/usb_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/usb_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/usb_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/usb_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/usb_conf.h
  • usb_delay_us() : project/at_start_f413/examples/acc/calibration/inc/usb_conf.h, project/at_start_f413/examples/usb_device/audio/inc/usb_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/usb_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/usb_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/src/main.c, project/at_start_f413/examples/usb_device/custom_hid/inc/usb_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/usb_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/usb_conf.h, project/at_start_f413/examples/usb_device/msc/inc/usb_conf.h, project/at_start_f413/examples/usb_device/printer/inc/usb_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/usb_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/usb_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/usb_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/usb_conf.h
  • usb_dev_init() : at32f413_usb.h, at32f413_usb.c
  • usb_disconnect() : at32f413_usb.h, at32f413_usb.c
  • usb_enter_suspend() : at32f413_usb.h, at32f413_usb.c
  • usb_ept_close() : at32f413_usb.h, at32f413_usb.c
  • usb_ept_open() : at32f413_usb.h, at32f413_usb.c
  • usb_ept_stall() : at32f413_usb.h, at32f413_usb.c
  • usb_exit_suspend() : at32f413_usb.h, at32f413_usb.c
  • usb_flag_clear() : at32f413_usb.h, at32f413_usb.c
  • usb_flag_get() : at32f413_usb.h, at32f413_usb.c
  • usb_hid_buf_process() : audio_hid_class.c, custom_hid_class.c
  • usb_hid_keyboard_send_char() : keyboard_class.c, keyboard_class.h
  • usb_hid_mouse_send() : mouse_class.c, mouse_class.h
  • usb_iap_class_send_report() : hid_iap_class.c, hid_iap_class.h
  • usb_interrupt_enable() : at32f413_usb.h, at32f413_usb.c
  • usb_interrupt_flag_get() : at32f413_usb.h, at32f413_usb.c
  • usb_keyboard_class_send_report() : keyboard_class.c, keyboard_class.h
  • usb_low_power_wakeup_config() : project/at_start_f413/examples/usb_device/keyboard/src/main.c, project/at_start_f413/examples/usb_device/mouse/src/main.c
  • usb_mouse_class_send_report() : mouse_class.c, mouse_class.h
  • usb_printer_get_rxdata() : printer_class.c, printer_class.h
  • usb_printer_send_data() : printer_class.c, printer_class.h
  • usb_read_packet() : at32f413_usb.h, at32f413_usb.c
  • usb_remote_wkup_clear() : at32f413_usb.h, at32f413_usb.c
  • usb_remote_wkup_set() : at32f413_usb.h, at32f413_usb.c
  • usb_reset() : project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c
  • usb_set_address() : at32f413_usb.h, at32f413_usb.c
  • usb_usart_config() : project/at_start_f413/examples/usb_device/virtual_comport/src/main.c, cdc_class.c, cdc_msc_class.c
  • usb_usbbufs_enable() : at32f413_usb.h, at32f413_usb.c
  • usb_vcp_cmd_process() : cdc_class.c, cdc_keyboard_class.c, cdc_msc_class.c
  • usb_vcp_get_rxdata() : cdc_class.c, cdc_class.h, cdc_msc_class.c, cdc_msc_class.h
  • usb_vcp_send_data() : cdc_class.c, cdc_class.h, cdc_msc_class.c, cdc_msc_class.h
  • usb_vcpkybrd_class_send_report() : cdc_keyboard_class.c, cdc_keyboard_class.h
  • usb_vcpkybrd_keyboard_send_char() : cdc_keyboard_class.c, cdc_keyboard_class.h
  • usb_vcpkybrd_vcp_get_rxdata() : cdc_keyboard_class.c, cdc_keyboard_class.h
  • usb_vcpkybrd_vcp_send_data() : cdc_keyboard_class.c, cdc_keyboard_class.h
  • usb_winusb_get_rxdata() : winusb_class.c, winusb_class.h
  • usb_winusb_send_data() : winusb_class.c, winusb_class.h
  • usb_write_packet() : at32f413_usb.h, at32f413_usb.c
  • usbd_clear_feature() : usbd_sdr.c
  • usbd_clear_stall() : usbd_core.h, usbd_core.c
  • usbd_connect() : usbd_core.h, usbd_core.c
  • usbd_connect_state_get() : usbd_core.h, usbd_core.c
  • usbd_core_in_handler() : usbd_core.h, usbd_core.c
  • usbd_core_init() : usbd_core.h, usbd_core.c
  • usbd_core_out_handler() : usbd_core.h, usbd_core.c
  • usbd_core_setup_handler() : usbd_core.h, usbd_core.c
  • usbd_ctrl_recv() : usbd_core.h, usbd_core.c
  • usbd_ctrl_recv_status() : usbd_core.h, usbd_core.c
  • usbd_ctrl_send() : usbd_core.h, usbd_core.c
  • usbd_ctrl_send_status() : usbd_core.h, usbd_core.c
  • usbd_ctrl_unsupport() : usbd_core.h, usbd_core.c
  • usbd_device_request() : usbd_sdr.h, usbd_sdr.c
  • usbd_disconnect() : usbd_core.h, usbd_core.c
  • usbd_endpoint_request() : usbd_sdr.h, usbd_sdr.c
  • usbd_enter_suspend() : usbd_core.h, usbd_core.c
  • usbd_ept_buf_auto_define() : usbd_core.h, usbd_core.c
  • usbd_ept_buf_custom_define() : usbd_core.h, usbd_core.c
  • usbd_ept_close() : usbd_core.h, usbd_core.c
  • usbd_ept_dbuffer_enable() : usbd_core.h, usbd_core.c
  • usbd_ept_defaut_init() : usbd_core.h, usbd_core.c
  • usbd_ept_loop_handler() : usbd_int.h, usbd_int.c
  • usbd_ept_open() : usbd_core.h, usbd_core.c
  • usbd_ept_recv() : usbd_core.h, usbd_core.c
  • usbd_ept_send() : usbd_core.h, usbd_core.c
  • usbd_eptn_handler() : usbd_int.h, usbd_int.c
  • usbd_get_configuration() : usbd_sdr.c
  • usbd_get_descriptor() : usbd_sdr.c
  • usbd_get_recv_len() : usbd_core.h, usbd_core.c
  • usbd_get_status() : usbd_sdr.c
  • usbd_hid_iap_in_complete() : hid_iap_class.h, app_led3_toggle/src/hid_iap_user.c, app_led4_toggle/src/hid_iap_user.c, bootloader/src/hid_iap_user.c
  • usbd_hid_iap_process() : hid_iap_class.h, app_led3_toggle/src/hid_iap_user.c, app_led4_toggle/src/hid_iap_user.c, bootloader/src/hid_iap_user.c
  • usbd_int_to_unicode() : audio_desc.c, audio_hid_desc.c, cdc_desc.c, cdc_keyboard_desc.c, cdc_msc_desc.c, custom_hid_desc.c, hid_iap_desc.c, keyboard_desc.c, mouse_desc.c, msc_desc.c, printer_desc.c, winusb_desc.c
  • usbd_interface_request() : usbd_sdr.h, usbd_sdr.c
  • usbd_irq_handler() : usbd_int.h, usbd_int.c
  • usbd_remote_wakeup() : usbd_core.h, usbd_core.c
  • usbd_reset_handler() : usbd_int.h, usbd_int.c
  • usbd_set_address() : usbd_sdr.c
  • usbd_set_configuration() : usbd_sdr.c
  • usbd_set_device_addr() : usbd_core.h, usbd_core.c
  • usbd_set_feature() : usbd_sdr.c
  • usbd_set_stall() : usbd_core.h, usbd_core.c
  • usbd_setup_request_parse() : usbd_sdr.h, usbd_sdr.c
  • usbd_sof_handler() : usbd_int.h, usbd_int.c
  • usbd_suspend_handler() : usbd_int.h, usbd_int.c
  • usbd_unicode_convert() : audio_desc.c, audio_hid_desc.c, cdc_desc.c, cdc_keyboard_desc.c, cdc_msc_desc.c, custom_hid_desc.c, hid_iap_desc.c, keyboard_desc.c, mouse_desc.c, msc_desc.c, printer_desc.c, winusb_desc.c
  • usbd_wakeup_handler() : usbd_int.h, usbd_int.c
  • USBFS_L_CAN1_RX0_IRQHandler() : project/at_start_f413/examples/acc/calibration/src/main.c, project/at_start_f413/examples/can/communication_mode/src/main.c, project/at_start_f413/examples/can/filter/src/main.c, project/at_start_f413/examples/can/loopback_mode/src/main.c, project/at_start_f413/examples/usb_device/audio/src/main.c, project/at_start_f413/examples/usb_device/composite_audio_hid/src/main.c, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/main.c, project/at_start_f413/examples/usb_device/composite_vcp_msc/src/main.c, project/at_start_f413/examples/usb_device/custom_hid/src/main.c, project/at_start_f413/examples/usb_device/keyboard/src/main.c, project/at_start_f413/examples/usb_device/mouse/src/main.c, project/at_start_f413/examples/usb_device/msc/src/main.c, project/at_start_f413/examples/usb_device/printer/src/main.c, project/at_start_f413/examples/usb_device/vcp_loopback/src/main.c, project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c, project/at_start_f413/examples/usb_device/winusb/src/main.c, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/main.c, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/main.c, utilities/at32f413_usb_iap_demo/source_code/bootloader/src/main.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all functions with links to the files they belong to:

- w -

  • wdt_counter_reload() : at32f413_wdt.h, at32f413_wdt.c
  • wdt_divider_set() : at32f413_wdt.h, at32f413_wdt.c
  • wdt_enable() : at32f413_wdt.h, at32f413_wdt.c
  • wdt_flag_get() : at32f413_wdt.h, at32f413_wdt.c
  • wdt_register_write_enable() : at32f413_wdt.h, at32f413_wdt.c
  • wdt_reload_value_set() : at32f413_wdt.h, at32f413_wdt.c
  • winusb_struct_init() : winusb_class.c
  • wwdt_counter_set() : at32f413_wwdt.h, at32f413_wwdt.c
  • wwdt_divider_set() : at32f413_wwdt.h, at32f413_wwdt.c
  • wwdt_enable() : at32f413_wwdt.h, at32f413_wwdt.c
  • wwdt_flag_clear() : at32f413_wwdt.h, at32f413_wwdt.c
  • wwdt_flag_get() : at32f413_wwdt.h, at32f413_wwdt.c
  • wwdt_interrupt_enable() : at32f413_wwdt.h, at32f413_wwdt.c
  • wwdt_interrupt_flag_get() : at32f413_wwdt.h, at32f413_wwdt.c
  • wwdt_reset() : at32f413_wwdt.h, at32f413_wwdt.c
  • wwdt_window_counter_set() : at32f413_wwdt.h, at32f413_wwdt.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
Here is a list of all variables with links to the files they belong to:

- _ -

  • _asciimap : cdc_keyboard_class.c, keyboard_class.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
Here is a list of all variables with links to the files they belong to:

- a -

  • acc_c2_value : project/at_start_f413/examples/acc/calibration/src/main.c
  • adc1_ordinary_value : project/at_start_f413/examples/adc/current_vref_value_check/src/main.c, project/at_start_f413/examples/adc/internal_temperature_sensor/src/main.c
  • adc1_ordinary_valuetab : project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/main.c, project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/main.c, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c, project/at_start_f413/examples/adc/voltage_monitoring/src/main.c
  • adc1_preempt_valuetab : project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c
  • ALIGNED_TAIL : diskio.c, audio_desc.c, audio_hid_desc.c, cdc_desc.c, cdc_keyboard_desc.c, cdc_msc_desc.c, composite_cdc_msc/msc_bot_scsi.c, custom_hid_desc.c, hid_iap_desc.c, keyboard_desc.c, mouse_desc.c, msc/msc_bot_scsi.c, msc_desc.c, printer_class.c, printer_desc.c, winusb_desc.c
  • atr_decode_status : project/at_start_f413/examples/usart/smartcard/src/main.c
  • audio_class_handler : audio_class.c, audio_class.h
  • audio_codec : audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • audio_desc_handler : audio_desc.c, audio_desc.h
  • audio_hid_class_handler : audio_hid_class.c, audio_hid_class.h
  • audio_hid_desc_handler : audio_hid_desc.c, audio_hid_desc.h
  • audio_hid_struct : audio_hid_class.c
  • audio_struct : audio_class.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
Here is a list of all variables with links to the files they belong to:

- b -

  • bpr_addr_tab : project/at_start_f413/examples/bpr/bpr_data/src/main.c, project/at_start_f413/examples/bpr/tamper/src/main.c
  • buffer : project/at_start_f413/examples/cortex_m4/fpu/src/main.c
  • buffer_ch1 : project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c
  • buffer_ch2 : project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c
  • buffer_read : project/at_start_f413/examples/flash/flash_write_read/src/main.c
  • buffer_write : project/at_start_f413/examples/flash/flash_write_read/src/main.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
Here is a list of all variables with links to the files they belong to:

- c -

  • calendar : rtc.h, rtc.c
  • capture : project/at_start_f413/examples/tmr/input_capture/src/main.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c
  • capturenumber : project/at_start_f413/examples/tmr/input_capture/src/main.c
  • card_inserted : project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c, project/at_start_f413/examples/usart/smartcard/src/main.c
  • card_protocol : project/at_start_f413/examples/usart/smartcard/src/main.c
  • card_type : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • cdc_class_handler : cdc_class.c, cdc_class.h
  • cdc_desc_handler : cdc_desc.c, cdc_desc.h
  • cdc_keyboard_class_handler : cdc_keyboard_class.c, cdc_keyboard_class.h
  • cdc_keyboard_desc_handler : cdc_keyboard_desc.c, cdc_keyboard_desc.h
  • cdc_msc_class_handler : cdc_msc_class.c, cdc_msc_class.h
  • cdc_msc_desc_handler : cdc_msc_desc.c, cdc_msc_desc.h
  • cdc_msc_struct : cdc_msc_class.c
  • cdc_struct : cdc_class.c
  • ch1_val : project/at_start_f413/examples/tmr/oc_high/src/main.c, project/at_start_f413/examples/tmr/oc_low/src/main.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/main.c, project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/main.c, project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_simulate/src/main.c, project/at_start_f413/examples/tmr/pwm_output_tmr10/src/main.c, project/at_start_f413/examples/tmr/pwm_output_tmr3/src/main.c, project/at_start_f413/examples/tmr/tmr2_32bit/src/main.c
  • ch2_val : project/at_start_f413/examples/tmr/oc_high/src/main.c, project/at_start_f413/examples/tmr/oc_low/src/main.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/main.c, project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/main.c, project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_simulate/src/main.c, project/at_start_f413/examples/tmr/pwm_output_tmr3/src/main.c, project/at_start_f413/examples/tmr/tmr2_32bit/src/main.c
  • ch3_val : project/at_start_f413/examples/tmr/oc_high/src/main.c, project/at_start_f413/examples/tmr/oc_low/src/main.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/main.c, project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_simulate/src/main.c, project/at_start_f413/examples/tmr/pwm_output_tmr3/src/main.c, project/at_start_f413/examples/tmr/tmr2_32bit/src/main.c
  • ch3readvalue1 : project/at_start_f413/examples/tmr/input_capture/src/main.c
  • ch3readvalue2 : project/at_start_f413/examples/tmr/input_capture/src/main.c
  • ch4_val : project/at_start_f413/examples/tmr/oc_high/src/main.c, project/at_start_f413/examples/tmr/oc_low/src/main.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/main.c, project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_output_simulate/src/main.c, project/at_start_f413/examples/tmr/pwm_output_tmr3/src/main.c, project/at_start_f413/examples/tmr/tmr2_32bit/src/main.c
  • channel1_pulse : project/at_start_f413/examples/tmr/7_pwm_output/src/main.c, project/at_start_f413/examples/tmr/complementary_signals/src/main.c
  • channel2_pulse : project/at_start_f413/examples/tmr/7_pwm_output/src/main.c, project/at_start_f413/examples/tmr/complementary_signals/src/main.c
  • channel3_pulse : project/at_start_f413/examples/tmr/7_pwm_output/src/main.c, project/at_start_f413/examples/tmr/complementary_signals/src/main.c
  • channel4_pulse : project/at_start_f413/examples/tmr/7_pwm_output/src/main.c
  • cid_table : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • cmd_addr_cnt : bootloader/src/iap.c
  • cmd_ctr_step : bootloader/inc/iap.h, bootloader/src/iap.c
  • cmd_data_cnt : bootloader/src/iap.c
  • cmd_data_group_struct : bootloader/src/iap.c
  • cmd_data_group_type_struct : bootloader/inc/iap.h
  • cmd_data_step : bootloader/inc/iap.h, bootloader/src/iap.c
  • config_descriptor : audio_desc.c, audio_hid_desc.c, cdc_desc.c, cdc_keyboard_desc.c, cdc_msc_desc.c, custom_hid_desc.c, hid_iap_desc.c, keyboard_desc.c, mouse_desc.c, msc_desc.c, printer_desc.c, winusb_desc.c
  • conversion_times_index : project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/main.c
  • counter : project/at_start_f413/examples/debug/tmr1/src/main.c, project/at_start_f413/examples/tmr/encoder_tmr2/src/main.c, project/at_start_f413/examples/usart/smartcard/src/main.c
  • crc1_value : project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c
  • crc2_value : project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c
  • crc_value : project/at_start_f413/examples/crc/calculation/src/main.c
  • crm_clocks : project/at_start_f413/examples/rtc/lick_calibration/src/main.c
  • crm_clocks_freq_struct : project/at_start_f413/examples/debug/tmr1/src/main.c, project/at_start_f413/examples/tmr/6_steps/src/main.c, project/at_start_f413/examples/tmr/7_pwm_output/src/main.c, project/at_start_f413/examples/tmr/complementary_signals/src/main.c, project/at_start_f413/examples/tmr/dma/src/main.c, project/at_start_f413/examples/tmr/dma_burst/src/main.c, project/at_start_f413/examples/tmr/encoder_tmr2/src/main.c, project/at_start_f413/examples/tmr/external_clock/src/main.c, project/at_start_f413/examples/tmr/hall_xor_tmr2/src/main.c, project/at_start_f413/examples/tmr/hang_mode/src/main.c, project/at_start_f413/examples/tmr/input_capture/src/main.c, project/at_start_f413/examples/tmr/oc_high/src/main.c, project/at_start_f413/examples/tmr/timer_base/src/main.c
  • csd_table : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • custom_hid_class_handler : custom_hid_class.c, custom_hid_class.h
  • custom_hid_desc_handler : custom_hid_desc.c, custom_hid_desc.h
  • custom_hid_struct : custom_hid_class.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
Here is a list of all variables with links to the files they belong to:

- d -

  • data_buffer : project/at_start_f413/examples/crc/calculation/src/main.c
  • data_count : project/at_start_f413/examples/usart/half_duplex/src/main.c, project/at_start_f413/examples/usart/hw_flow_control/src/main.c
  • data_counter_end : project/at_start_f413/examples/dma/flash_to_sram/src/main.c
  • device_descriptor : audio_desc.c, audio_hid_desc.c, cdc_desc.c, cdc_keyboard_desc.c, cdc_msc_desc.c, custom_hid_desc.c, hid_iap_desc.c, keyboard_desc.c, mouse_desc.c, msc_desc.c, printer_desc.c, winusb_desc.c
  • device_mode : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • div_value : project/at_start_f413/examples/tmr/oc_high/src/main.c, project/at_start_f413/examples/tmr/oc_low/src/main.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/main.c, project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/main.c, project/at_start_f413/examples/tmr/one_cycle/src/main.c, project/at_start_f413/examples/tmr/pwm_output_simulate/src/main.c, project/at_start_f413/examples/tmr/pwm_output_tmr10/src/main.c, project/at_start_f413/examples/tmr/pwm_output_tmr3/src/main.c
  • dma1_trans_complete_flag : project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/main.c
  • dma_init_struct : project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c, project/at_start_f413/examples/dma/flash_to_sram/src/main.c, project/at_start_f413/examples/tmr/dma/src/main.c, project/at_start_f413/examples/tmr/dma_burst/src/main.c
  • dma_init_structure : project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c
  • dma_trans_complete_flag : project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/main.c, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c
  • dst_buffer : project/at_start_f413/examples/dma/flash_to_sram/src/main.c, project/at_start_f413/examples/usart/smartcard/src/main.c
  • duty_cycle : project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_input/src/main.c, project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c
  • duty_result : project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c
  • dw_data_start_sector : utilities/at32f413_slib_demo/project_l0/src/main.c
  • dw_end_sector : utilities/at32f413_slib_demo/project_l0/src/main.c
  • dw_start_sector : utilities/at32f413_slib_demo/project_l0/src/main.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
Here is a list of all variables with links to the files they belong to:

- e -

  • error_times_index : project/at_start_f413/examples/adc/voltage_monitoring/src/main.c
  • ext_csd_table : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
Here is a list of all variables with links to the files they belong to:

- f -

  • fac_ms : at32f413_board.c
  • fac_us : at32f413_board.c
  • fat16_file_name : flash_fat16.c
  • fat16_root_dir_sector : flash_fat16.c
  • fat16_sector : flash_fat16.c
  • fat16_table_sector0 : flash_fat16.c
  • file : project/at_start_f413/examples/sdio/sdio_fatfs/src/main.c
  • file_match : flash_fat16.c
  • file_write_nr : flash_fat16.c
  • firCoeffs32 : fir_coefficient.c, fir_filter.c
  • firStateF32 : fir_filter.c
  • flash_buf : project/at_start_f413/examples/flash/flash_write_read/src/flash.c
  • flash_iap : flash_fat16.h, flash_fat16.c
  • freq_result : project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c
  • frequency : project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c, project/at_start_f413/examples/tmr/pwm_input/src/main.c, project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c
  • fs : project/at_start_f413/examples/sdio/sdio_fatfs/src/main.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
Here is a list of all variables with links to the files they belong to:

- g -

  • g_audio_hid_usb_desc : audio_hid_desc.h
  • g_custom_hid_usb_desc : custom_hid_desc.h
  • g_file_attr : flash_fat16.c
  • g_hidiap_usb_desc : hid_iap_desc.h
  • g_keyboard_usb_desc : keyboard_desc.h
  • g_mouse_usb_desc : mouse_desc.h
  • g_speed : project/at_start_f413/templates/src/main.c
  • g_usb_offset_addr : at32f413_usb.c
  • g_usb_packet_address : at32f413_usb.h, at32f413_usb.c
  • g_usbd_audio_hid_report : audio_hid_desc.h
  • g_usbd_custom_hid_report : custom_hid_desc.h
  • g_usbd_hidiap_report : hid_iap_desc.h
  • g_usbd_keyboard_report : keyboard_desc.h
  • g_usbd_mouse_report : mouse_desc.h
  • g_usbd_vcpkybrd_hid_report : cdc_keyboard_desc.h
  • g_vcpkybrd_hid_usb_desc : cdc_keyboard_desc.h
  • g_winusb_rx_buffer : winusb_class.c
  • get_data_from_usart_flag : bootloader/inc/tmr.h, bootloader/src/tmr.c
  • gpio_init_struct : project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c, project/at_start_f413/examples/dma/flash_to_sram/src/main.c, project/at_start_f413/examples/tmr/6_steps/src/main.c, project/at_start_f413/examples/tmr/7_pwm_output/src/main.c, project/at_start_f413/examples/tmr/cascade_synchro/src/main.c, project/at_start_f413/examples/tmr/complementary_signals/src/main.c, project/at_start_f413/examples/tmr/dma/src/main.c, project/at_start_f413/examples/tmr/dma_burst/src/main.c, project/at_start_f413/examples/tmr/encoder_tmr2/src/main.c, project/at_start_f413/examples/tmr/external_clock/src/main.c, project/at_start_f413/examples/tmr/hall_xor_tmr2/src/main.c, project/at_start_f413/examples/tmr/hang_mode/src/main.c, project/at_start_f413/examples/tmr/input_capture/src/main.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
Here is a list of all variables with links to the files they belong to:

- h -

  • hi2cx : project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_int/src/main.c, project/at_start_f413/examples/i2c/communication_poll/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c, project/at_start_f413/examples/i2c/memory_write/src/main.c, audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • hid_iap_class_handler : hid_iap_class.c, hid_iap_class.h
  • hid_iap_desc_handler : hid_iap_desc.c, hid_iap_desc.h
  • hid_suspend_flag : project/at_start_f413/examples/usb_device/keyboard/src/main.c, project/at_start_f413/examples/usb_device/mouse/src/main.c
  • hw_usart_read_index : project/at_start_f413/examples/usb_device/virtual_comport/src/main.c
  • hw_usart_rx_index : project/at_start_f413/examples/usb_device/virtual_comport/src/main.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
Here is a list of all variables with links to the files they belong to:

- i -

  • i2s1_buffer_tx : project/at_start_f413/examples/i2s/halfduplex_dma/src/main.c, project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c
  • i2s2_buffer_rx : project/at_start_f413/examples/i2s/halfduplex_dma/src/main.c, project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c
  • iap_flag : app_led3_toggle/inc/usart.h, app_led3_toggle/src/usart.c, app_led4_toggle/inc/usart.h, app_led4_toggle/src/usart.c
  • iap_info : hid_iap_class.c, hid_iap_class.h
  • ic2value : project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
Here is a list of all variables with links to the files they belong to:

- j -

  • jump_to_app : bootloader/src/iap.c
  • jumpaddr : project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c, bootloader/src/hid_iap_user.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
Here is a list of all variables with links to the files they belong to:

- k -

  • keyboard_class_handler : keyboard_class.c, keyboard_class.h
  • keyboard_desc_handler : keyboard_desc.c, keyboard_desc.h
  • keyboard_struct : keyboard_class.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
Here is a list of all variables with links to the files they belong to:

- l -

  • langid_descriptor : audio_desc.c, audio_hid_desc.c, cdc_desc.c, cdc_keyboard_desc.c, cdc_msc_desc.c, custom_hid_desc.c, hid_iap_desc.c, keyboard_desc.c, mouse_desc.c, msc_desc.c, printer_desc.c, winusb_desc.c
  • led2_handler : utilities/at32f413_freertos_demo/src/main.c
  • led3_handler : utilities/at32f413_freertos_demo/src/main.c
  • led_gpio_crm_clk : at32f413_board.c
  • led_gpio_pin : at32f413_board.c
  • led_gpio_port : at32f413_board.c
  • lickfreq : project/at_start_f413/examples/rtc/lick_calibration/src/main.c
  • linecoding : project/at_start_f413/examples/usb_device/virtual_comport/src/main.c, cdc_class.c, cdc_msc_class.c
  • linecoding_vcpkybrd : cdc_keyboard_class.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
Here is a list of all variables with links to the files they belong to:

- m -

  • max_marks : project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c
  • mblock_rbuffer : project/at_start_f413/examples/sdio/emmc_card/src/main.c, project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c
  • mblock_tbuffer : project/at_start_f413/examples/sdio/emmc_card/src/main.c, project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c
  • mean : project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c
  • mic_dma_buffer : audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • min_marks : project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c
  • mon_table : rtc.c
  • mouse_class_handler : mouse_class.c, mouse_class.h
  • mouse_desc_handler : mouse_desc.c, mouse_desc.h
  • mouse_struct : mouse_class.c
  • msc_class_handler : msc_class.c, msc_class.h
  • msc_desc_handler : msc_desc.c, msc_desc.h
  • msc_flash_size : composite_vcp_msc/src/msc_diskio.c, msc/src/msc_diskio.c
  • msc_struct : msc_class.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
Here is a list of all variables with links to the files they belong to:

- n -

  • numStudents : project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c
  • numSubjects : project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
Here is a list of all variables with links to the files they belong to:

- o -

  • operationcomplete : project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c, project/at_start_f413/examples/rtc/lick_calibration/src/main.c
  • ordinary_conversion_times_index : project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c
  • ov_cnt : project/at_start_f413/examples/usb_device/virtual_comport/src/main.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
Here is a list of all variables with links to the files they belong to:

- p -

  • periodvalue : project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c, project/at_start_f413/examples/rtc/lick_calibration/src/main.c
  • pftarget : project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c, app_led3_toggle/src/hid_iap_user.c, app_led4_toggle/src/hid_iap_user.c, bootloader/src/hid_iap_user.c
  • preempt_conversion_count : project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c
  • preempt_conversion_times_index : project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c
  • preempt_trigger_count : project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c
  • press_mouse : project/at_start_f413/examples/usb_device/mouse/src/main.c
  • printer_class_handler : printer_class.c, printer_class.h
  • printer_desc_handler : printer_desc.c, printer_desc.h
  • printer_struct : printer_class.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
Here is a list of all variables with links to the files they belong to:

- r -

  • rca : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • read_buffer : operate_spim.c
  • refOutput : project_l0/src/arm_fir_data.c, utilities/at32f413_slib_demo/project_l0/src/main.c, project_l1/src/arm_fir_data.c, utilities/at32f413_slib_demo/project_l1/src/main.c
  • reg_addr_data : audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • report_buf : project/at_start_f413/examples/usb_device/composite_audio_hid/src/main.c, project/at_start_f413/examples/usb_device/custom_hid/src/main.c, project/at_start_f413/examples/usb_device/mouse/src/main.c
  • rs485_buffer_rx : project/at_start_f413/examples/usart/rs485/src/main.c
  • rs485_buffer_rx_cnt : project/at_start_f413/examples/usart/rs485/src/main.c
  • rx_buf : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/communication_int/src/main.c, project/at_start_f413/examples/i2c/communication_poll/src/main.c
  • rx_buf1 : project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c
  • rx_buf2 : project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c
  • rx_buf3 : project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c
  • rx_buffer : project/at_start_f413/examples/spi/w25q_flash/src/main.c, project/at_start_f413/examples/usart/hw_flow_control/src/main.c
  • rx_counter : project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c, project/at_start_f413/examples/usart/receiver_mute/src/main.c
  • rx_index : project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c, project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c, project/at_start_f413/examples/spi/fullduplex_polling/src/main.c, project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c, project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
Here is a list of all variables with links to the files they belong to:

- s -

  • sblock_rbuffer : project/at_start_f413/examples/sdio/emmc_card/src/main.c, project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c
  • sblock_tbuffer : project/at_start_f413/examples/sdio/emmc_card/src/main.c, project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c
  • sc_a2r_struct : project/at_start_f413/examples/usart/smartcard/src/main.c
  • sc_baud_rate : project/at_start_f413/examples/usart/smartcard/src/main.c
  • sc_clock_freq : project/at_start_f413/examples/usart/smartcard/src/main.c
  • scsi_inquiry : composite_vcp_msc/src/msc_diskio.c, msc/src/msc_diskio.c, virtual_msc_iap/src/msc_diskio.c
  • sd_card_info : emmc_card/inc/at32_sdio.h, emmc_card/src/at32_sdio.c, sd_mmc_card/inc/at32_sdio.h, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/inc/at32_sdio.h, sdio_fatfs/src/at32_sdio.c
  • sdio_command_init_struct : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • sdio_data_init_struct : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • sector_size : composite_vcp_msc/src/msc_diskio.c, msc/src/msc_diskio.c
  • serial_descriptor : audio_desc.c, audio_hid_desc.c, cdc_desc.c, cdc_keyboard_desc.c, cdc_msc_desc.c, custom_hid_desc.c, hid_iap_desc.c, keyboard_desc.c, mouse_desc.c, msc_desc.c, printer_desc.c, winusb_desc.c
  • spi1_buffer_tx : project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c
  • spi1_rx_buffer : project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/fullduplex_polling/src/main.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c
  • spi1_tx_buffer : project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/fullduplex_polling/src/main.c, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c, project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c
  • spi2_buffer_rx : project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c
  • spi2_rx_buffer : project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/fullduplex_polling/src/main.c, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c, project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c, project/at_start_f413/examples/usart/synchronous/src/main.c
  • spi2_rx_counter : project/at_start_f413/examples/usart/synchronous/src/main.c
  • spi2_tx_buffer : project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/fullduplex_polling/src/main.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c, project/at_start_f413/examples/usart/synchronous/src/main.c
  • spi2_tx_buffer_size : project/at_start_f413/examples/usart/synchronous/src/main.c
  • spi2_tx_counter : project/at_start_f413/examples/usart/synchronous/src/main.c
  • spi_init_struct : project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/fullduplex_polling/src/main.c, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c
  • spiflash_sector_buf : spi_flash.c
  • spk_dma_buffer : audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • src_buffer : project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c, project/at_start_f413/examples/tmr/dma/src/main.c, project/at_start_f413/examples/tmr/dma_burst/src/main.c
  • src_const_buffer : project/at_start_f413/examples/dma/flash_to_sram/src/main.c
  • std : project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c
  • step : project/at_start_f413/examples/tmr/6_steps/src/main.c
  • stkptr : project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c, bootloader/src/hid_iap_user.c
  • stop_flag : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • stream_rbuffer : project/at_start_f413/examples/sdio/emmc_card/src/main.c, project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c
  • stream_tbuffer : project/at_start_f413/examples/sdio/emmc_card/src/main.c, project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c
  • student_num : project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c
  • sys_counter : project/at_start_f413/examples/tmr/input_capture/src/main.c
  • system_core_clock : system_at32f413.c, system_at32f413.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
Here is a list of all variables with links to the files they belong to:

- t -

  • table_week : rtc.c
  • temp_buf : utilities/at32f413_slib_demo/project_l0/src/main.c
  • test_result : project/at_start_f413/examples/can/filter/src/main.c
  • testInput_f32_1kHz_15kHz : project_l0/src/arm_fir_data.c, utilities/at32f413_slib_demo/project_l0/src/main.c, project_l1/src/arm_fir_data.c, utilities/at32f413_slib_demo/project_l1/src/main.c
  • testMarks_f32 : project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c
  • testOutput : project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c, utilities/at32f413_slib_demo/project_l0/src/main.c, utilities/at32f413_slib_demo/project_l1/src/main.c
  • testUnity_f32 : project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c
  • time_cnt : project/at_start_f413/examples/usart/printf/src/main.c
  • time_ira_cnt : bootloader/inc/tmr.h, bootloader/src/tmr.c
  • timer_period : project/at_start_f413/examples/tmr/7_pwm_output/src/main.c, project/at_start_f413/examples/tmr/complementary_signals/src/main.c, project/at_start_f413/examples/tmr/dma/src/main.c, project/at_start_f413/examples/tmr/dma_burst/src/main.c
  • tmpCC4 : project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c
  • tmr3freq : project/at_start_f413/examples/tmr/input_capture/src/main.c
  • tmr_brkdt_config_struct : project/at_start_f413/examples/tmr/6_steps/src/main.c, project/at_start_f413/examples/tmr/complementary_signals/src/main.c
  • tmr_ic_init_structure : project/at_start_f413/examples/tmr/one_cycle/src/main.c, project/at_start_f413/examples/tmr/pwm_input/src/main.c, project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c
  • tmr_input_config_struct : project/at_start_f413/examples/tmr/external_clock/src/main.c, project/at_start_f413/examples/tmr/hall_xor_tmr2/src/main.c, project/at_start_f413/examples/tmr/hang_mode/src/main.c, project/at_start_f413/examples/tmr/input_capture/src/main.c
  • tmr_oc_init_structure : project/at_start_f413/examples/tmr/oc_high/src/main.c, project/at_start_f413/examples/tmr/oc_low/src/main.c, project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/main.c, project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/main.c, project/at_start_f413/examples/tmr/one_cycle/src/main.c, project/at_start_f413/examples/tmr/parallel_synchro/src/main.c, project/at_start_f413/examples/tmr/pwm_output_simulate/src/main.c, project/at_start_f413/examples/tmr/pwm_output_tmr10/src/main.c, project/at_start_f413/examples/tmr/pwm_output_tmr3/src/main.c, project/at_start_f413/examples/tmr/tmr1_synchro/src/main.c, project/at_start_f413/examples/tmr/tmr2_32bit/src/main.c
  • tmr_output_struct : project/at_start_f413/examples/tmr/6_steps/src/main.c, project/at_start_f413/examples/tmr/7_pwm_output/src/main.c, project/at_start_f413/examples/tmr/cascade_synchro/src/main.c, project/at_start_f413/examples/tmr/complementary_signals/src/main.c, project/at_start_f413/examples/tmr/dma/src/main.c, project/at_start_f413/examples/tmr/dma_burst/src/main.c, project/at_start_f413/examples/tmr/external_clock/src/main.c, project/at_start_f413/examples/tmr/hall_xor_tmr2/src/main.c, project/at_start_f413/examples/tmr/hang_mode/src/main.c
  • transfer_end : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • transfer_error : emmc_card/src/at32_sdio.c, sd_mmc_card/src/at32_sdio.c, sdio_fatfs/src/at32_sdio.c
  • transfer_status : project/at_start_f413/examples/dma/flash_to_sram/src/main.c, project/at_start_f413/examples/i2s/halfduplex_dma/src/main.c, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c, project/at_start_f413/examples/spi/w25q_flash/src/main.c
  • transfer_status1 : project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c, project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/fullduplex_polling/src/main.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c
  • transfer_status2 : project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c, project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/fullduplex_polling/src/main.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c
  • transfer_status3 : project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c, project/at_start_f413/examples/spi/fullduplex_polling/src/main.c
  • transfer_status4 : project/at_start_f413/examples/spi/fullduplex_polling/src/main.c
  • tx_buf : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/communication_int/src/main.c, project/at_start_f413/examples/i2c/communication_poll/src/main.c
  • tx_buf1 : project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c
  • tx_buf2 : project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c
  • tx_buf3 : project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c
  • tx_buffer : project/at_start_f413/examples/spi/w25q_flash/src/main.c
  • tx_counter : project/at_start_f413/examples/usart/receiver_mute/src/main.c
  • tx_index : project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c, project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c, project/at_start_f413/examples/spi/fullduplex_polling/src/main.c, project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c, project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
Here is a list of all variables with links to the files they belong to:

- u -

  • update_status : bootloader/inc/iap.h, bootloader/src/iap.c
  • usart1_index : project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c
  • usart2_rx_buffer : project/at_start_f413/examples/usart/half_duplex/src/main.c, project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/interrupt/src/main.c, project/at_start_f413/examples/usart/polling/src/main.c, project/at_start_f413/examples/usart/synchronous/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c
  • usart2_rx_counter : project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/interrupt/src/main.c, project/at_start_f413/examples/usart/polling/src/main.c, project/at_start_f413/examples/usart/synchronous/src/main.c
  • usart2_rx_dma_status : project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c
  • usart2_tx_buffer : project/at_start_f413/examples/usart/half_duplex/src/main.c, project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/interrupt/src/main.c, project/at_start_f413/examples/usart/polling/src/main.c, project/at_start_f413/examples/usart/receiver_mute/src/main.c, project/at_start_f413/examples/usart/synchronous/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c
  • usart2_tx_buffer_size : project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/interrupt/src/main.c, project/at_start_f413/examples/usart/polling/src/main.c, project/at_start_f413/examples/usart/synchronous/src/main.c
  • usart2_tx_counter : project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/interrupt/src/main.c, project/at_start_f413/examples/usart/polling/src/main.c, project/at_start_f413/examples/usart/synchronous/src/main.c
  • usart2_tx_dma_status : project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c
  • usart3_rx_buffer : project/at_start_f413/examples/usart/half_duplex/src/main.c, project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/interrupt/src/main.c, project/at_start_f413/examples/usart/polling/src/main.c, project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c, project/at_start_f413/examples/usart/receiver_mute/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c
  • usart3_rx_counter : project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/interrupt/src/main.c, project/at_start_f413/examples/usart/polling/src/main.c
  • usart3_rx_dma_status : project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c
  • usart3_tx_buffer : project/at_start_f413/examples/usart/half_duplex/src/main.c, project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/interrupt/src/main.c, project/at_start_f413/examples/usart/polling/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c
  • usart3_tx_buffer_size : project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/interrupt/src/main.c, project/at_start_f413/examples/usart/polling/src/main.c
  • usart3_tx_counter : project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/interrupt/src/main.c, project/at_start_f413/examples/usart/polling/src/main.c
  • usart3_tx_dma_status : project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c
  • usart_group_struct : bootloader/inc/usart.h, bootloader/src/usart.c
  • usart_rx_buffer : project/at_start_f413/examples/usb_device/virtual_comport/src/main.c
  • usart_rx_data_len : project/at_start_f413/examples/usb_device/virtual_comport/src/main.c
  • usb_buffer : project/at_start_f413/examples/acc/calibration/src/main.c, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/main.c, project/at_start_f413/examples/usb_device/composite_vcp_msc/src/main.c, project/at_start_f413/examples/usb_device/printer/src/main.c, project/at_start_f413/examples/usb_device/vcp_loopback/src/main.c, project/at_start_f413/examples/usb_device/virtual_comport/src/main.c, project/at_start_f413/examples/usb_device/winusb/src/main.c
  • usb_core_dev : project/at_start_f413/examples/acc/calibration/src/main.c, project/at_start_f413/examples/usb_device/audio/src/main.c, project/at_start_f413/examples/usb_device/composite_audio_hid/src/main.c, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/main.c, project/at_start_f413/examples/usb_device/composite_vcp_msc/src/main.c, project/at_start_f413/examples/usb_device/custom_hid/src/main.c, project/at_start_f413/examples/usb_device/keyboard/src/main.c, project/at_start_f413/examples/usb_device/mouse/src/main.c, project/at_start_f413/examples/usb_device/msc/src/main.c, project/at_start_f413/examples/usb_device/printer/src/main.c, project/at_start_f413/examples/usb_device/vcp_loopback/src/main.c, project/at_start_f413/examples/usb_device/virtual_comport/src/main.c, project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c, project/at_start_f413/examples/usb_device/winusb/src/main.c, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/main.c, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/main.c, utilities/at32f413_usb_iap_demo/source_code/bootloader/src/main.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
Here is a list of all variables with links to the files they belong to:

- v -

  • var : project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c
  • variables : project/at_start_f413/examples/cortex_m4/bit_band/src/main.c
  • variables_addr : project/at_start_f413/examples/cortex_m4/bit_band/src/main.c
  • variables_bit_val : project/at_start_f413/examples/cortex_m4/bit_band/src/main.c
  • vcp_keyboard_struct : cdc_keyboard_class.c
  • vmor_flag_index : project/at_start_f413/examples/adc/voltage_monitoring/src/main.c
  • vp_desc : audio_desc.c, audio_hid_desc.c, cdc_desc.c, cdc_keyboard_desc.c, cdc_msc_desc.c, custom_hid_desc.c, hid_iap_desc.c, keyboard_desc.c, mouse_desc.c, msc_desc.c, printer_desc.c, winusb_desc.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
Here is a list of all variables with links to the files they belong to:

- w -

  • weekday_table : project/at_start_f413/examples/rtc/calendar/src/main.c
  • winusb_class_handler : winusb_class.c, winusb_class.h
  • winusb_desc_handler : winusb_desc.c, winusb_desc.h
  • winusb_struct : winusb_class.c
  • work : project/at_start_f413/examples/sdio/sdio_fatfs/src/main.c
  • write_buffer : operate_spim.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • i
  • s
  • u
  • v
Here is a list of all typedefs with links to the files they belong to:

- i -

  • iapfun : bootloader/inc/iap.h
  • INT16 : at32f413.h
  • INT32 : at32f413.h
  • INT8 : at32f413.h
  • IRQn_Type : at32f413.h

- s -

  • s16 : at32f413.h
  • s32 : at32f413.h
  • s8 : at32f413.h
  • sc16 : at32f413.h
  • sc32 : at32f413.h
  • sc8 : at32f413.h

- u -

  • u16 : at32f413.h
  • u32 : at32f413.h
  • u8 : at32f413.h
  • uc16 : at32f413.h
  • uc32 : at32f413.h
  • uc8 : at32f413.h
  • UINT16 : at32f413.h
  • UINT32 : at32f413.h
  • UINT8 : at32f413.h
  • usb_reg_type : at32f413_usb.h

- v -

  • vs16 : at32f413.h
  • vs32 : at32f413.h
  • vs8 : at32f413.h
  • vsc16 : at32f413.h
  • vsc32 : at32f413.h
  • vsc8 : at32f413.h
  • vu16 : at32f413.h
  • vu32 : at32f413.h
  • vu8 : at32f413.h
  • vuc16 : at32f413.h
  • vuc32 : at32f413.h
  • vuc8 : at32f413.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • i
  • l
  • n
  • p
  • s
  • t
  • u
  • w
Here is a list of all enums with links to the files they belong to:

- a -

  • adc_channel_select_type : at32f413_adc.h
  • adc_combine_mode_type : at32f413_adc.h
  • adc_data_align_type : at32f413_adc.h
  • adc_ordinary_trig_select_type : at32f413_adc.h
  • adc_preempt_channel_type : at32f413_adc.h
  • adc_preempt_trig_select_type : at32f413_adc.h
  • adc_sampletime_select_type : at32f413_adc.h
  • adc_voltage_monitoring_type : at32f413_adc.h

- b -

  • bpr_data_type : at32f413_bpr.h
  • bpr_rtc_output_type : at32f413_bpr.h
  • bpr_tamper_pin_active_level_type : at32f413_bpr.h
  • button_type : at32f413_board.h

- c -

  • can_bts1_type : at32f413_can.h
  • can_bts2_type : at32f413_can.h
  • can_enter_doze_status_type : at32f413_can.h
  • can_error_record_type : at32f413_can.h
  • can_filter_bit_width_type : at32f413_can.h
  • can_filter_fifo_type : at32f413_can.h
  • can_filter_mode_type : at32f413_can.h
  • can_identifier_type : at32f413_can.h
  • can_mode_type : at32f413_can.h
  • can_msg_discarding_rule_type : at32f413_can.h
  • can_msg_sending_rule_type : at32f413_can.h
  • can_operating_mode_type : at32f413_can.h
  • can_quit_doze_status_type : at32f413_can.h
  • can_rsaw_type : at32f413_can.h
  • can_rx_fifo_num_type : at32f413_can.h
  • can_trans_frame_type : at32f413_can.h
  • can_transmit_status_type : at32f413_can.h
  • can_tx_mailbox_num_type : at32f413_can.h
  • cmd_ctr_step_type : bootloader/inc/iap.h
  • cmd_data_step_type : bootloader/inc/iap.h
  • confirm_state : at32f413.h
  • crc_poly_size_type : at32f413_crc.h
  • crc_reverse_input_type : at32f413_crc.h
  • crc_reverse_output_type : at32f413_crc.h
  • crm_adc_div_type : at32f413_crm.h
  • crm_ahb_div_type : at32f413_crm.h
  • crm_apb1_div_type : at32f413_crm.h
  • crm_apb2_div_type : at32f413_crm.h
  • crm_auto_step_mode_type : at32f413_crm.h
  • crm_clkout_div_type : at32f413_crm.h
  • crm_clkout_select_type : at32f413_crm.h
  • crm_clock_source_type : at32f413_crm.h
  • crm_hick_div_6_type : at32f413_crm.h
  • crm_hick_sclk_frequency_type : at32f413_crm.h
  • crm_periph_clock_sleepmd_type : at32f413_crm.h
  • crm_periph_clock_type : at32f413_crm.h
  • crm_periph_reset_type : at32f413_crm.h
  • crm_pll_clock_source_type : at32f413_crm.h
  • crm_pll_mult_type : at32f413_crm.h
  • crm_pll_output_range_type : at32f413_crm.h
  • crm_rtc_clock_type : at32f413_crm.h
  • crm_sclk_type : at32f413_crm.h
  • crm_usb_clock_source_type : at32f413_crm.h
  • crm_usb_div_type : at32f413_crm.h
  • crm_usb_int_map_type : at32f413_crm.h

- d -

  • data_trans_dir : at32f413_usb.h
  • dma_dir_type : at32f413_dma.h
  • dma_flexible_request_type : at32f413_dma.h
  • dma_memory_data_size_type : at32f413_dma.h
  • dma_memory_inc_type : at32f413_dma.h
  • dma_peripheral_data_size_type : at32f413_dma.h
  • dma_peripheral_inc_type : at32f413_dma.h
  • dma_priority_level_type : at32f413_dma.h

- e -

  • eeprom_mode_type : eeprom.h
  • ept_inout_type : at32f413_usb.h
  • ept_trans_type : at32f413_usb.h
  • error_status : at32f413.h
  • exint_line_mode_type : at32f413_exint.h
  • exint_polarity_config_type : at32f413_exint.h

- f -

  • flag_status : at32f413.h
  • flash_spim_model_type : at32f413_flash.h
  • flash_status_type : at32f413_flash.h

- g -

  • gpio_drive_type : at32f413_gpio.h
  • gpio_mode_type : at32f413_gpio.h
  • gpio_output_type : at32f413_gpio.h
  • gpio_pins_source_type : at32f413_gpio.h
  • gpio_port_source_type : at32f413_gpio.h
  • gpio_pull_type : at32f413_gpio.h

- i -

  • i2c_address_mode_type : at32f413_i2c.h
  • i2c_direction_type : at32f413_i2c.h
  • i2c_fsmode_duty_cycle_type : at32f413_i2c.h
  • i2c_master_ack_type : at32f413_i2c.h
  • i2c_mem_address_width_type : i2c_application.h
  • i2c_mode_type : i2c_application.h
  • i2c_pec_position_type : at32f413_i2c.h
  • i2c_smbus_alert_set_type : at32f413_i2c.h
  • i2c_smbus_mode_set_type : at32f413_i2c.h
  • i2c_status_type : i2c_application.h
  • i2s_audio_protocol_type : at32f413_spi.h
  • i2s_audio_sampling_freq_type : at32f413_spi.h
  • i2s_clock_polarity_type : at32f413_spi.h
  • i2s_data_channel_format_type : at32f413_spi.h
  • i2s_operation_mode_type : at32f413_spi.h
  • iap_machine_state_type : hid_iap_class.h
  • iap_result_type : hid_iap_class.h
  • IRQn : at32f413.h

- l -

  • led_type : at32f413_board.h

- n -

  • nvic_lowpower_mode_type : at32f413_misc.h
  • nvic_priority_group_type : at32f413_misc.h

- p -

  • printer_req_type : printer_class.h
  • pwc_deep_sleep_enter_type : at32f413_pwc.h
  • pwc_pvm_voltage_type : at32f413_pwc.h
  • pwc_sleep_enter_type : at32f413_pwc.h

- s -

  • sd_card_state_type : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • sd_data_transfer_mode_type : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • sd_error_status_type : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • sd_memory_card_type : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • sdio_block_size_type : at32f413_sdio.h
  • sdio_bus_width_type : at32f413_sdio.h
  • sdio_edge_phase_type : at32f413_sdio.h
  • sdio_power_state_type : at32f413_sdio.h
  • sdio_read_wait_mode_type : at32f413_sdio.h
  • sdio_reponse_type : at32f413_sdio.h
  • sdio_rsp_index_type : at32f413_sdio.h
  • sdio_transfer_direction_type : at32f413_sdio.h
  • sdio_transfer_mode_type : at32f413_sdio.h
  • sdio_wait_type : at32f413_sdio.h
  • spi_clock_phase_type : at32f413_spi.h
  • spi_clock_polarity_type : at32f413_spi.h
  • spi_crc_direction_type : at32f413_spi.h
  • spi_cs_mode_type : at32f413_spi.h
  • spi_first_bit_type : at32f413_spi.h
  • spi_frame_bit_num_type : at32f413_spi.h
  • spi_half_duplex_direction_type : at32f413_spi.h
  • spi_master_slave_mode_type : at32f413_spi.h
  • spi_mclk_freq_div_type : at32f413_spi.h
  • spi_software_cs_level_type : at32f413_spi.h
  • spi_transmission_mode_type : at32f413_spi.h
  • sub_tmr_input_sel_type : at32f413_tmr.h
  • systick_clock_source_type : at32f413_misc.h

- t -

  • test_result_type : project/at_start_f413/examples/sdio/emmc_card/src/main.c, project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c
  • tmr_brk_polarity_type : at32f413_tmr.h
  • tmr_channel1_input_connected_type : at32f413_tmr.h
  • tmr_channel_input_divider_type : at32f413_tmr.h
  • tmr_channel_select_type : at32f413_tmr.h
  • tmr_clock_division_type : at32f413_tmr.h
  • tmr_count_mode_type : at32f413_tmr.h
  • tmr_dma_address_type : at32f413_tmr.h
  • tmr_dma_request_source_type : at32f413_tmr.h
  • tmr_dma_request_type : at32f413_tmr.h
  • tmr_dma_transfer_length_type : at32f413_tmr.h
  • tmr_encoder_mode_type : at32f413_tmr.h
  • tmr_event_trigger_type : at32f413_tmr.h
  • tmr_external_signal_divider_type : at32f413_tmr.h
  • tmr_external_signal_polarity_type : at32f413_tmr.h
  • tmr_force_output_type : at32f413_tmr.h
  • tmr_input_direction_mapped_type : at32f413_tmr.h
  • tmr_input_polarity_type : at32f413_tmr.h
  • tmr_output_control_mode_type : at32f413_tmr.h
  • tmr_output_polarity_type : at32f413_tmr.h
  • tmr_polarity_active_type : at32f413_tmr.h
  • tmr_primary_select_type : at32f413_tmr.h
  • tmr_sub_mode_select_type : at32f413_tmr.h
  • tmr_wp_level_type : at32f413_tmr.h

- u -

  • update_status_type : bootloader/inc/iap.h
  • upgrade_status_type : flash_fat16.h
  • usart_break_bit_num_type : at32f413_usart.h
  • usart_clock_phase_type : at32f413_usart.h
  • usart_clock_polarity_type : at32f413_usart.h
  • usart_data_bit_num_type : at32f413_usart.h
  • usart_hardware_flow_control_type : at32f413_usart.h
  • usart_lbcp_type : at32f413_usart.h
  • usart_parity_selection_type : at32f413_usart.h
  • usart_stop_bit_num_type : at32f413_usart.h
  • usart_wakeup_mode_type : at32f413_usart.h
  • usb_clk48_s : at32f413_usb.h
  • usb_ept_number_type : at32f413_usb.h
  • usb_sts_type : usb_std.h
  • usbd_conn_state : usb_std.h
  • usbd_event_type : usbd_core.h

- w -

  • wdt_cmd_value_type : at32f413_wdt.h
  • wdt_division_type : at32f413_wdt.h
  • wwdt_division_type : at32f413_wwdt.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • l
  • m
  • n
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all enum values with links to the files they belong to:

- a -

  • ACC_IRQn : at32f413.h
  • ADC12_ORDINARY_TRIG_EXINT11_TMR8TRGOUT : at32f413_adc.h
  • ADC12_ORDINARY_TRIG_SOFTWARE : at32f413_adc.h
  • ADC12_ORDINARY_TRIG_TMR1CH1 : at32f413_adc.h
  • ADC12_ORDINARY_TRIG_TMR1CH2 : at32f413_adc.h
  • ADC12_ORDINARY_TRIG_TMR1CH3 : at32f413_adc.h
  • ADC12_ORDINARY_TRIG_TMR1TRGOUT : at32f413_adc.h
  • ADC12_ORDINARY_TRIG_TMR2CH2 : at32f413_adc.h
  • ADC12_ORDINARY_TRIG_TMR3TRGOUT : at32f413_adc.h
  • ADC12_ORDINARY_TRIG_TMR4CH4 : at32f413_adc.h
  • ADC12_ORDINARY_TRIG_TMR8CH1 : at32f413_adc.h
  • ADC12_ORDINARY_TRIG_TMR8CH2 : at32f413_adc.h
  • ADC12_PREEMPT_TRIG_EXINT15_TMR8CH4 : at32f413_adc.h
  • ADC12_PREEMPT_TRIG_SOFTWARE : at32f413_adc.h
  • ADC12_PREEMPT_TRIG_TMR1CH1 : at32f413_adc.h
  • ADC12_PREEMPT_TRIG_TMR1CH4 : at32f413_adc.h
  • ADC12_PREEMPT_TRIG_TMR1TRGOUT : at32f413_adc.h
  • ADC12_PREEMPT_TRIG_TMR2CH1 : at32f413_adc.h
  • ADC12_PREEMPT_TRIG_TMR2TRGOUT : at32f413_adc.h
  • ADC12_PREEMPT_TRIG_TMR3CH4 : at32f413_adc.h
  • ADC12_PREEMPT_TRIG_TMR4TRGOUT : at32f413_adc.h
  • ADC12_PREEMPT_TRIG_TMR8CH1 : at32f413_adc.h
  • ADC12_PREEMPT_TRIG_TMR8TRGOUT : at32f413_adc.h
  • ADC1_2_IRQn : at32f413.h
  • ADC_CHANNEL_0 : at32f413_adc.h
  • ADC_CHANNEL_1 : at32f413_adc.h
  • ADC_CHANNEL_10 : at32f413_adc.h
  • ADC_CHANNEL_11 : at32f413_adc.h
  • ADC_CHANNEL_12 : at32f413_adc.h
  • ADC_CHANNEL_13 : at32f413_adc.h
  • ADC_CHANNEL_14 : at32f413_adc.h
  • ADC_CHANNEL_15 : at32f413_adc.h
  • ADC_CHANNEL_16 : at32f413_adc.h
  • ADC_CHANNEL_17 : at32f413_adc.h
  • ADC_CHANNEL_2 : at32f413_adc.h
  • ADC_CHANNEL_3 : at32f413_adc.h
  • ADC_CHANNEL_4 : at32f413_adc.h
  • ADC_CHANNEL_5 : at32f413_adc.h
  • ADC_CHANNEL_6 : at32f413_adc.h
  • ADC_CHANNEL_7 : at32f413_adc.h
  • ADC_CHANNEL_8 : at32f413_adc.h
  • ADC_CHANNEL_9 : at32f413_adc.h
  • ADC_INDEPENDENT_MODE : at32f413_adc.h
  • ADC_LEFT_ALIGNMENT : at32f413_adc.h
  • ADC_ORDINARY_LONGSHIFT_ONLY_MODE : at32f413_adc.h
  • ADC_ORDINARY_LONGSHIFT_PREEMPT_SMLT_MODE : at32f413_adc.h
  • ADC_ORDINARY_SHORTSHIFT_ONLY_MODE : at32f413_adc.h
  • ADC_ORDINARY_SHORTSHIFT_PREEMPT_SMLT_MODE : at32f413_adc.h
  • ADC_ORDINARY_SMLT_ONLY_MODE : at32f413_adc.h
  • ADC_ORDINARY_SMLT_PREEMPT_INTERLTRIG_MODE : at32f413_adc.h
  • ADC_ORDINARY_SMLT_PREEMPT_SMLT_MODE : at32f413_adc.h
  • ADC_PREEMPT_CHANNEL_1 : at32f413_adc.h
  • ADC_PREEMPT_CHANNEL_2 : at32f413_adc.h
  • ADC_PREEMPT_CHANNEL_3 : at32f413_adc.h
  • ADC_PREEMPT_CHANNEL_4 : at32f413_adc.h
  • ADC_PREEMPT_INTERLTRIG_ONLY_MODE : at32f413_adc.h
  • ADC_PREEMPT_SMLT_ONLY_MODE : at32f413_adc.h
  • ADC_RIGHT_ALIGNMENT : at32f413_adc.h
  • ADC_SAMPLETIME_13_5 : at32f413_adc.h
  • ADC_SAMPLETIME_1_5 : at32f413_adc.h
  • ADC_SAMPLETIME_239_5 : at32f413_adc.h
  • ADC_SAMPLETIME_28_5 : at32f413_adc.h
  • ADC_SAMPLETIME_41_5 : at32f413_adc.h
  • ADC_SAMPLETIME_55_5 : at32f413_adc.h
  • ADC_SAMPLETIME_71_5 : at32f413_adc.h
  • ADC_SAMPLETIME_7_5 : at32f413_adc.h
  • ADC_VMONITOR_ALL_ORDINARY : at32f413_adc.h
  • ADC_VMONITOR_ALL_ORDINARY_PREEMPT : at32f413_adc.h
  • ADC_VMONITOR_ALL_PREEMPT : at32f413_adc.h
  • ADC_VMONITOR_NONE : at32f413_adc.h
  • ADC_VMONITOR_SINGLE_ORDINARY : at32f413_adc.h
  • ADC_VMONITOR_SINGLE_ORDINARY_PREEMPT : at32f413_adc.h
  • ADC_VMONITOR_SINGLE_PREEMPT : at32f413_adc.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • l
  • m
  • n
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all enum values with links to the files they belong to:

- b -

  • BPR_DATA1 : at32f413_bpr.h
  • BPR_DATA10 : at32f413_bpr.h
  • BPR_DATA11 : at32f413_bpr.h
  • BPR_DATA12 : at32f413_bpr.h
  • BPR_DATA13 : at32f413_bpr.h
  • BPR_DATA14 : at32f413_bpr.h
  • BPR_DATA15 : at32f413_bpr.h
  • BPR_DATA16 : at32f413_bpr.h
  • BPR_DATA17 : at32f413_bpr.h
  • BPR_DATA18 : at32f413_bpr.h
  • BPR_DATA19 : at32f413_bpr.h
  • BPR_DATA2 : at32f413_bpr.h
  • BPR_DATA20 : at32f413_bpr.h
  • BPR_DATA21 : at32f413_bpr.h
  • BPR_DATA22 : at32f413_bpr.h
  • BPR_DATA23 : at32f413_bpr.h
  • BPR_DATA24 : at32f413_bpr.h
  • BPR_DATA25 : at32f413_bpr.h
  • BPR_DATA26 : at32f413_bpr.h
  • BPR_DATA27 : at32f413_bpr.h
  • BPR_DATA28 : at32f413_bpr.h
  • BPR_DATA29 : at32f413_bpr.h
  • BPR_DATA3 : at32f413_bpr.h
  • BPR_DATA30 : at32f413_bpr.h
  • BPR_DATA31 : at32f413_bpr.h
  • BPR_DATA32 : at32f413_bpr.h
  • BPR_DATA33 : at32f413_bpr.h
  • BPR_DATA34 : at32f413_bpr.h
  • BPR_DATA35 : at32f413_bpr.h
  • BPR_DATA36 : at32f413_bpr.h
  • BPR_DATA37 : at32f413_bpr.h
  • BPR_DATA38 : at32f413_bpr.h
  • BPR_DATA39 : at32f413_bpr.h
  • BPR_DATA4 : at32f413_bpr.h
  • BPR_DATA40 : at32f413_bpr.h
  • BPR_DATA41 : at32f413_bpr.h
  • BPR_DATA42 : at32f413_bpr.h
  • BPR_DATA5 : at32f413_bpr.h
  • BPR_DATA6 : at32f413_bpr.h
  • BPR_DATA7 : at32f413_bpr.h
  • BPR_DATA8 : at32f413_bpr.h
  • BPR_DATA9 : at32f413_bpr.h
  • BPR_RTC_OUTPUT_ALARM : at32f413_bpr.h
  • BPR_RTC_OUTPUT_CLOCK_CAL_AFTER : at32f413_bpr.h
  • BPR_RTC_OUTPUT_CLOCK_CAL_BEFORE : at32f413_bpr.h
  • BPR_RTC_OUTPUT_NONE : at32f413_bpr.h
  • BPR_RTC_OUTPUT_SECOND : at32f413_bpr.h
  • BPR_TAMPER_PIN_ACTIVE_HIGH : at32f413_bpr.h
  • BPR_TAMPER_PIN_ACTIVE_LOW : at32f413_bpr.h
  • BusFault_IRQn : at32f413.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • l
  • m
  • n
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all enum values with links to the files they belong to:

- c -

  • CAN1_RX1_IRQn : at32f413.h
  • CAN1_SE_IRQn : at32f413.h
  • CAN2_RX0_IRQn : at32f413.h
  • CAN2_RX1_IRQn : at32f413.h
  • CAN2_SE_IRQn : at32f413.h
  • CAN2_TX_IRQn : at32f413.h
  • CAN_BTS1_10TQ : at32f413_can.h
  • CAN_BTS1_11TQ : at32f413_can.h
  • CAN_BTS1_12TQ : at32f413_can.h
  • CAN_BTS1_13TQ : at32f413_can.h
  • CAN_BTS1_14TQ : at32f413_can.h
  • CAN_BTS1_15TQ : at32f413_can.h
  • CAN_BTS1_16TQ : at32f413_can.h
  • CAN_BTS1_1TQ : at32f413_can.h
  • CAN_BTS1_2TQ : at32f413_can.h
  • CAN_BTS1_3TQ : at32f413_can.h
  • CAN_BTS1_4TQ : at32f413_can.h
  • CAN_BTS1_5TQ : at32f413_can.h
  • CAN_BTS1_6TQ : at32f413_can.h
  • CAN_BTS1_7TQ : at32f413_can.h
  • CAN_BTS1_8TQ : at32f413_can.h
  • CAN_BTS1_9TQ : at32f413_can.h
  • CAN_BTS2_1TQ : at32f413_can.h
  • CAN_BTS2_2TQ : at32f413_can.h
  • CAN_BTS2_3TQ : at32f413_can.h
  • CAN_BTS2_4TQ : at32f413_can.h
  • CAN_BTS2_5TQ : at32f413_can.h
  • CAN_BTS2_6TQ : at32f413_can.h
  • CAN_BTS2_7TQ : at32f413_can.h
  • CAN_BTS2_8TQ : at32f413_can.h
  • CAN_DISCARDING_FIRST_RECEIVED : at32f413_can.h
  • CAN_DISCARDING_LAST_RECEIVED : at32f413_can.h
  • CAN_ENTER_DOZE_FAILED : at32f413_can.h
  • CAN_ENTER_DOZE_SUCCESSFUL : at32f413_can.h
  • CAN_ERRORRECORD_ACKERR : at32f413_can.h
  • CAN_ERRORRECORD_BITDOMINANTERR : at32f413_can.h
  • CAN_ERRORRECORD_BITRECESSIVEERR : at32f413_can.h
  • CAN_ERRORRECORD_CRCERR : at32f413_can.h
  • CAN_ERRORRECORD_FORMERR : at32f413_can.h
  • CAN_ERRORRECORD_NOERR : at32f413_can.h
  • CAN_ERRORRECORD_SOFTWARESETERR : at32f413_can.h
  • CAN_ERRORRECORD_STUFFERR : at32f413_can.h
  • CAN_FILTER_16BIT : at32f413_can.h
  • CAN_FILTER_32BIT : at32f413_can.h
  • CAN_FILTER_FIFO0 : at32f413_can.h
  • CAN_FILTER_FIFO1 : at32f413_can.h
  • CAN_FILTER_MODE_ID_LIST : at32f413_can.h
  • CAN_FILTER_MODE_ID_MASK : at32f413_can.h
  • CAN_ID_EXTENDED : at32f413_can.h
  • CAN_ID_STANDARD : at32f413_can.h
  • CAN_MODE_COMMUNICATE : at32f413_can.h
  • CAN_MODE_LISTENONLY : at32f413_can.h
  • CAN_MODE_LISTENONLY_LOOPBACK : at32f413_can.h
  • CAN_MODE_LOOPBACK : at32f413_can.h
  • CAN_OPERATINGMODE_COMMUNICATE : at32f413_can.h
  • CAN_OPERATINGMODE_DOZE : at32f413_can.h
  • CAN_OPERATINGMODE_FREEZE : at32f413_can.h
  • CAN_QUIT_DOZE_FAILED : at32f413_can.h
  • CAN_QUIT_DOZE_SUCCESSFUL : at32f413_can.h
  • CAN_RSAW_1TQ : at32f413_can.h
  • CAN_RSAW_2TQ : at32f413_can.h
  • CAN_RSAW_3TQ : at32f413_can.h
  • CAN_RSAW_4TQ : at32f413_can.h
  • CAN_RX_FIFO0 : at32f413_can.h
  • CAN_RX_FIFO1 : at32f413_can.h
  • CAN_SENDING_BY_ID : at32f413_can.h
  • CAN_SENDING_BY_REQUEST : at32f413_can.h
  • CAN_TFT_DATA : at32f413_can.h
  • CAN_TFT_REMOTE : at32f413_can.h
  • CAN_TX_MAILBOX0 : at32f413_can.h
  • CAN_TX_MAILBOX1 : at32f413_can.h
  • CAN_TX_MAILBOX2 : at32f413_can.h
  • CAN_TX_STATUS_FAILED : at32f413_can.h
  • CAN_TX_STATUS_NO_EMPTY : at32f413_can.h
  • CAN_TX_STATUS_PENDING : at32f413_can.h
  • CAN_TX_STATUS_SUCCESSFUL : at32f413_can.h
  • CMD_CTR_APP : bootloader/inc/iap.h
  • CMD_CTR_DONE : bootloader/inc/iap.h
  • CMD_CTR_ERR : bootloader/inc/iap.h
  • CMD_CTR_IDLE : bootloader/inc/iap.h
  • CMD_CTR_INIT : bootloader/inc/iap.h
  • CMD_DATA_ADDR : bootloader/inc/iap.h
  • CMD_DATA_BUF : bootloader/inc/iap.h
  • CMD_DATA_CHACK : bootloader/inc/iap.h
  • CMD_DATA_DONE : bootloader/inc/iap.h
  • CMD_DATA_ERR : bootloader/inc/iap.h
  • CMD_DATA_IDLE : bootloader/inc/iap.h
  • CRC_POLY_SIZE_16B : at32f413_crc.h
  • CRC_POLY_SIZE_32B : at32f413_crc.h
  • CRC_POLY_SIZE_7B : at32f413_crc.h
  • CRC_POLY_SIZE_8B : at32f413_crc.h
  • CRC_REVERSE_INPUT_BY_BYTE : at32f413_crc.h
  • CRC_REVERSE_INPUT_BY_HALFWORD : at32f413_crc.h
  • CRC_REVERSE_INPUT_BY_WORD : at32f413_crc.h
  • CRC_REVERSE_INPUT_NO_AFFECTE : at32f413_crc.h
  • CRC_REVERSE_OUTPUT_DATA : at32f413_crc.h
  • CRC_REVERSE_OUTPUT_NO_AFFECTE : at32f413_crc.h
  • CRM_ACC_PERIPH_CLOCK : at32f413_crm.h
  • CRM_ACC_PERIPH_RESET : at32f413_crm.h
  • CRM_ADC1_PERIPH_CLOCK : at32f413_crm.h
  • CRM_ADC1_PERIPH_RESET : at32f413_crm.h
  • CRM_ADC2_PERIPH_CLOCK : at32f413_crm.h
  • CRM_ADC2_PERIPH_RESET : at32f413_crm.h
  • CRM_ADC_DIV_12 : at32f413_crm.h
  • CRM_ADC_DIV_16 : at32f413_crm.h
  • CRM_ADC_DIV_2 : at32f413_crm.h
  • CRM_ADC_DIV_4 : at32f413_crm.h
  • CRM_ADC_DIV_6 : at32f413_crm.h
  • CRM_ADC_DIV_8 : at32f413_crm.h
  • CRM_AHB_DIV_1 : at32f413_crm.h
  • CRM_AHB_DIV_128 : at32f413_crm.h
  • CRM_AHB_DIV_16 : at32f413_crm.h
  • CRM_AHB_DIV_2 : at32f413_crm.h
  • CRM_AHB_DIV_256 : at32f413_crm.h
  • CRM_AHB_DIV_4 : at32f413_crm.h
  • CRM_AHB_DIV_512 : at32f413_crm.h
  • CRM_AHB_DIV_64 : at32f413_crm.h
  • CRM_AHB_DIV_8 : at32f413_crm.h
  • CRM_APB1_DIV_1 : at32f413_crm.h
  • CRM_APB1_DIV_16 : at32f413_crm.h
  • CRM_APB1_DIV_2 : at32f413_crm.h
  • CRM_APB1_DIV_4 : at32f413_crm.h
  • CRM_APB1_DIV_8 : at32f413_crm.h
  • CRM_APB2_DIV_1 : at32f413_crm.h
  • CRM_APB2_DIV_16 : at32f413_crm.h
  • CRM_APB2_DIV_2 : at32f413_crm.h
  • CRM_APB2_DIV_4 : at32f413_crm.h
  • CRM_APB2_DIV_8 : at32f413_crm.h
  • CRM_AUTO_STEP_MODE_DISABLE : at32f413_crm.h
  • CRM_AUTO_STEP_MODE_ENABLE : at32f413_crm.h
  • CRM_BPR_PERIPH_CLOCK : at32f413_crm.h
  • CRM_BPR_PERIPH_RESET : at32f413_crm.h
  • CRM_CAN1_PERIPH_CLOCK : at32f413_crm.h
  • CRM_CAN1_PERIPH_RESET : at32f413_crm.h
  • CRM_CAN2_PERIPH_CLOCK : at32f413_crm.h
  • CRM_CAN2_PERIPH_RESET : at32f413_crm.h
  • CRM_CLKOUT_ADC : at32f413_crm.h
  • CRM_CLKOUT_DIV_1 : at32f413_crm.h
  • CRM_CLKOUT_DIV_128 : at32f413_crm.h
  • CRM_CLKOUT_DIV_16 : at32f413_crm.h
  • CRM_CLKOUT_DIV_2 : at32f413_crm.h
  • CRM_CLKOUT_DIV_256 : at32f413_crm.h
  • CRM_CLKOUT_DIV_4 : at32f413_crm.h
  • CRM_CLKOUT_DIV_512 : at32f413_crm.h
  • CRM_CLKOUT_DIV_64 : at32f413_crm.h
  • CRM_CLKOUT_DIV_8 : at32f413_crm.h
  • CRM_CLKOUT_HEXT : at32f413_crm.h
  • CRM_CLKOUT_HICK : at32f413_crm.h
  • CRM_CLKOUT_LEXT : at32f413_crm.h
  • CRM_CLKOUT_LICK : at32f413_crm.h
  • CRM_CLKOUT_NOCLK : at32f413_crm.h
  • CRM_CLKOUT_PLL_DIV_2 : at32f413_crm.h
  • CRM_CLKOUT_PLL_DIV_4 : at32f413_crm.h
  • CRM_CLKOUT_SCLK : at32f413_crm.h
  • CRM_CLKOUT_USB : at32f413_crm.h
  • CRM_CLOCK_SOURCE_HEXT : at32f413_crm.h
  • CRM_CLOCK_SOURCE_HICK : at32f413_crm.h
  • CRM_CLOCK_SOURCE_LEXT : at32f413_crm.h
  • CRM_CLOCK_SOURCE_LICK : at32f413_crm.h
  • CRM_CLOCK_SOURCE_PLL : at32f413_crm.h
  • CRM_CRC_PERIPH_CLOCK : at32f413_crm.h
  • CRM_DMA1_PERIPH_CLOCK : at32f413_crm.h
  • CRM_DMA2_PERIPH_CLOCK : at32f413_crm.h
  • CRM_EXINT_PERIPH_RESET : at32f413_crm.h
  • CRM_FLASH_PERIPH_CLOCK_SLEEP_MODE : at32f413_crm.h
  • CRM_GPIOA_PERIPH_CLOCK : at32f413_crm.h
  • CRM_GPIOA_PERIPH_RESET : at32f413_crm.h
  • CRM_GPIOB_PERIPH_CLOCK : at32f413_crm.h
  • CRM_GPIOB_PERIPH_RESET : at32f413_crm.h
  • CRM_GPIOC_PERIPH_CLOCK : at32f413_crm.h
  • CRM_GPIOC_PERIPH_RESET : at32f413_crm.h
  • CRM_GPIOD_PERIPH_CLOCK : at32f413_crm.h
  • CRM_GPIOD_PERIPH_RESET : at32f413_crm.h
  • CRM_GPIOF_PERIPH_CLOCK : at32f413_crm.h
  • CRM_GPIOF_PERIPH_RESET : at32f413_crm.h
  • CRM_HICK48_DIV6 : at32f413_crm.h
  • CRM_HICK48_NODIV : at32f413_crm.h
  • CRM_HICK_SCLK_48MHZ : at32f413_crm.h
  • CRM_HICK_SCLK_8MHZ : at32f413_crm.h
  • CRM_I2C1_PERIPH_CLOCK : at32f413_crm.h
  • CRM_I2C1_PERIPH_RESET : at32f413_crm.h
  • CRM_I2C2_PERIPH_CLOCK : at32f413_crm.h
  • CRM_I2C2_PERIPH_RESET : at32f413_crm.h
  • CRM_IOMUX_PERIPH_CLOCK : at32f413_crm.h
  • CRM_IOMUX_PERIPH_RESET : at32f413_crm.h
  • CRM_IRQn : at32f413.h
  • CRM_PLL_MULT_10 : at32f413_crm.h
  • CRM_PLL_MULT_11 : at32f413_crm.h
  • CRM_PLL_MULT_12 : at32f413_crm.h
  • CRM_PLL_MULT_13 : at32f413_crm.h
  • CRM_PLL_MULT_14 : at32f413_crm.h
  • CRM_PLL_MULT_15 : at32f413_crm.h
  • CRM_PLL_MULT_16 : at32f413_crm.h
  • CRM_PLL_MULT_17 : at32f413_crm.h
  • CRM_PLL_MULT_18 : at32f413_crm.h
  • CRM_PLL_MULT_19 : at32f413_crm.h
  • CRM_PLL_MULT_2 : at32f413_crm.h
  • CRM_PLL_MULT_20 : at32f413_crm.h
  • CRM_PLL_MULT_21 : at32f413_crm.h
  • CRM_PLL_MULT_22 : at32f413_crm.h
  • CRM_PLL_MULT_23 : at32f413_crm.h
  • CRM_PLL_MULT_24 : at32f413_crm.h
  • CRM_PLL_MULT_25 : at32f413_crm.h
  • CRM_PLL_MULT_26 : at32f413_crm.h
  • CRM_PLL_MULT_27 : at32f413_crm.h
  • CRM_PLL_MULT_28 : at32f413_crm.h
  • CRM_PLL_MULT_29 : at32f413_crm.h
  • CRM_PLL_MULT_3 : at32f413_crm.h
  • CRM_PLL_MULT_30 : at32f413_crm.h
  • CRM_PLL_MULT_31 : at32f413_crm.h
  • CRM_PLL_MULT_32 : at32f413_crm.h
  • CRM_PLL_MULT_33 : at32f413_crm.h
  • CRM_PLL_MULT_34 : at32f413_crm.h
  • CRM_PLL_MULT_35 : at32f413_crm.h
  • CRM_PLL_MULT_36 : at32f413_crm.h
  • CRM_PLL_MULT_37 : at32f413_crm.h
  • CRM_PLL_MULT_38 : at32f413_crm.h
  • CRM_PLL_MULT_39 : at32f413_crm.h
  • CRM_PLL_MULT_4 : at32f413_crm.h
  • CRM_PLL_MULT_40 : at32f413_crm.h
  • CRM_PLL_MULT_41 : at32f413_crm.h
  • CRM_PLL_MULT_42 : at32f413_crm.h
  • CRM_PLL_MULT_43 : at32f413_crm.h
  • CRM_PLL_MULT_44 : at32f413_crm.h
  • CRM_PLL_MULT_45 : at32f413_crm.h
  • CRM_PLL_MULT_46 : at32f413_crm.h
  • CRM_PLL_MULT_47 : at32f413_crm.h
  • CRM_PLL_MULT_48 : at32f413_crm.h
  • CRM_PLL_MULT_49 : at32f413_crm.h
  • CRM_PLL_MULT_5 : at32f413_crm.h
  • CRM_PLL_MULT_50 : at32f413_crm.h
  • CRM_PLL_MULT_51 : at32f413_crm.h
  • CRM_PLL_MULT_52 : at32f413_crm.h
  • CRM_PLL_MULT_53 : at32f413_crm.h
  • CRM_PLL_MULT_54 : at32f413_crm.h
  • CRM_PLL_MULT_55 : at32f413_crm.h
  • CRM_PLL_MULT_56 : at32f413_crm.h
  • CRM_PLL_MULT_57 : at32f413_crm.h
  • CRM_PLL_MULT_58 : at32f413_crm.h
  • CRM_PLL_MULT_59 : at32f413_crm.h
  • CRM_PLL_MULT_6 : at32f413_crm.h
  • CRM_PLL_MULT_60 : at32f413_crm.h
  • CRM_PLL_MULT_61 : at32f413_crm.h
  • CRM_PLL_MULT_62 : at32f413_crm.h
  • CRM_PLL_MULT_63 : at32f413_crm.h
  • CRM_PLL_MULT_64 : at32f413_crm.h
  • CRM_PLL_MULT_7 : at32f413_crm.h
  • CRM_PLL_MULT_8 : at32f413_crm.h
  • CRM_PLL_MULT_9 : at32f413_crm.h
  • CRM_PLL_OUTPUT_RANGE_GT72MHZ : at32f413_crm.h
  • CRM_PLL_OUTPUT_RANGE_LE72MHZ : at32f413_crm.h
  • CRM_PLL_SOURCE_HEXT : at32f413_crm.h
  • CRM_PLL_SOURCE_HEXT_DIV : at32f413_crm.h
  • CRM_PLL_SOURCE_HICK : at32f413_crm.h
  • CRM_PWC_PERIPH_CLOCK : at32f413_crm.h
  • CRM_PWC_PERIPH_RESET : at32f413_crm.h
  • CRM_RTC_CLOCK_HEXT_DIV : at32f413_crm.h
  • CRM_RTC_CLOCK_LEXT : at32f413_crm.h
  • CRM_RTC_CLOCK_LICK : at32f413_crm.h
  • CRM_RTC_CLOCK_NOCLK : at32f413_crm.h
  • CRM_SCLK_HEXT : at32f413_crm.h
  • CRM_SCLK_HICK : at32f413_crm.h
  • CRM_SCLK_PLL : at32f413_crm.h
  • CRM_SDIO1_PERIPH_CLOCK : at32f413_crm.h
  • CRM_SPI1_PERIPH_CLOCK : at32f413_crm.h
  • CRM_SPI1_PERIPH_RESET : at32f413_crm.h
  • CRM_SPI2_PERIPH_CLOCK : at32f413_crm.h
  • CRM_SPI2_PERIPH_RESET : at32f413_crm.h
  • CRM_SRAM_PERIPH_CLOCK_SLEEP_MODE : at32f413_crm.h
  • CRM_TMR10_PERIPH_CLOCK : at32f413_crm.h
  • CRM_TMR10_PERIPH_RESET : at32f413_crm.h
  • CRM_TMR11_PERIPH_CLOCK : at32f413_crm.h
  • CRM_TMR11_PERIPH_RESET : at32f413_crm.h
  • CRM_TMR1_PERIPH_CLOCK : at32f413_crm.h
  • CRM_TMR1_PERIPH_RESET : at32f413_crm.h
  • CRM_TMR2_PERIPH_CLOCK : at32f413_crm.h
  • CRM_TMR2_PERIPH_RESET : at32f413_crm.h
  • CRM_TMR3_PERIPH_CLOCK : at32f413_crm.h
  • CRM_TMR3_PERIPH_RESET : at32f413_crm.h
  • CRM_TMR4_PERIPH_CLOCK : at32f413_crm.h
  • CRM_TMR4_PERIPH_RESET : at32f413_crm.h
  • CRM_TMR5_PERIPH_CLOCK : at32f413_crm.h
  • CRM_TMR5_PERIPH_RESET : at32f413_crm.h
  • CRM_TMR8_PERIPH_CLOCK : at32f413_crm.h
  • CRM_TMR8_PERIPH_RESET : at32f413_crm.h
  • CRM_TMR9_PERIPH_CLOCK : at32f413_crm.h
  • CRM_TMR9_PERIPH_RESET : at32f413_crm.h
  • CRM_UART4_PERIPH_CLOCK : at32f413_crm.h
  • CRM_UART4_PERIPH_RESET : at32f413_crm.h
  • CRM_UART5_PERIPH_CLOCK : at32f413_crm.h
  • CRM_UART5_PERIPH_RESET : at32f413_crm.h
  • CRM_USART1_PERIPH_CLOCK : at32f413_crm.h
  • CRM_USART1_PERIPH_RESET : at32f413_crm.h
  • CRM_USART2_PERIPH_CLOCK : at32f413_crm.h
  • CRM_USART2_PERIPH_RESET : at32f413_crm.h
  • CRM_USART3_PERIPH_CLOCK : at32f413_crm.h
  • CRM_USART3_PERIPH_RESET : at32f413_crm.h
  • CRM_USB_CLOCK_SOURCE_HICK : at32f413_crm.h
  • CRM_USB_CLOCK_SOURCE_PLL : at32f413_crm.h
  • CRM_USB_DIV_1 : at32f413_crm.h
  • CRM_USB_DIV_1_5 : at32f413_crm.h
  • CRM_USB_DIV_2 : at32f413_crm.h
  • CRM_USB_DIV_2_5 : at32f413_crm.h
  • CRM_USB_DIV_3 : at32f413_crm.h
  • CRM_USB_DIV_3_5 : at32f413_crm.h
  • CRM_USB_DIV_4 : at32f413_crm.h
  • CRM_USB_INT19_INT20 : at32f413_crm.h
  • CRM_USB_INT73_INT74 : at32f413_crm.h
  • CRM_USB_PERIPH_CLOCK : at32f413_crm.h
  • CRM_USB_PERIPH_RESET : at32f413_crm.h
  • CRM_WWDT_PERIPH_CLOCK : at32f413_crm.h
  • CRM_WWDT_PERIPH_RESET : at32f413_crm.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • l
  • m
  • n
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all enum values with links to the files they belong to:

- d -

  • DATA_TRANS_IN : at32f413_usb.h
  • DATA_TRANS_OUT : at32f413_usb.h
  • DebugMonitor_IRQn : at32f413.h
  • DMA1_Channel1_IRQn : at32f413.h
  • DMA1_Channel2_IRQn : at32f413.h
  • DMA1_Channel3_IRQn : at32f413.h
  • DMA1_Channel4_IRQn : at32f413.h
  • DMA1_Channel5_IRQn : at32f413.h
  • DMA1_Channel6_IRQn : at32f413.h
  • DMA1_Channel7_IRQn : at32f413.h
  • DMA2_Channel1_IRQn : at32f413.h
  • DMA2_Channel2_IRQn : at32f413.h
  • DMA2_Channel3_IRQn : at32f413.h
  • DMA2_Channel4_5_IRQn : at32f413.h
  • DMA2_Channel6_7_IRQn : at32f413.h
  • DMA_DIR_MEMORY_TO_MEMORY : at32f413_dma.h
  • DMA_DIR_MEMORY_TO_PERIPHERAL : at32f413_dma.h
  • DMA_DIR_PERIPHERAL_TO_MEMORY : at32f413_dma.h
  • DMA_FLEXIBLE_ADC1 : at32f413_dma.h
  • DMA_FLEXIBLE_I2C1_RX : at32f413_dma.h
  • DMA_FLEXIBLE_I2C1_TX : at32f413_dma.h
  • DMA_FLEXIBLE_I2C2_RX : at32f413_dma.h
  • DMA_FLEXIBLE_I2C2_TX : at32f413_dma.h
  • DMA_FLEXIBLE_SDIO1 : at32f413_dma.h
  • DMA_FLEXIBLE_SPI1_RX : at32f413_dma.h
  • DMA_FLEXIBLE_SPI1_TX : at32f413_dma.h
  • DMA_FLEXIBLE_SPI2_RX : at32f413_dma.h
  • DMA_FLEXIBLE_SPI2_TX : at32f413_dma.h
  • DMA_FLEXIBLE_TMR1_CH1 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR1_CH2 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR1_CH3 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR1_CH4 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR1_HALL : at32f413_dma.h
  • DMA_FLEXIBLE_TMR1_OVERFLOW : at32f413_dma.h
  • DMA_FLEXIBLE_TMR1_TRIG : at32f413_dma.h
  • DMA_FLEXIBLE_TMR2_CH1 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR2_CH2 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR2_CH3 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR2_CH4 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR2_OVERFLOW : at32f413_dma.h
  • DMA_FLEXIBLE_TMR2_TRIG : at32f413_dma.h
  • DMA_FLEXIBLE_TMR3_CH1 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR3_CH2 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR3_CH3 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR3_CH4 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR3_OVERFLOW : at32f413_dma.h
  • DMA_FLEXIBLE_TMR3_TRIG : at32f413_dma.h
  • DMA_FLEXIBLE_TMR4_CH1 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR4_CH2 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR4_CH3 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR4_CH4 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR4_OVERFLOW : at32f413_dma.h
  • DMA_FLEXIBLE_TMR4_TRIG : at32f413_dma.h
  • DMA_FLEXIBLE_TMR5_CH1 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR5_CH2 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR5_CH3 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR5_CH4 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR5_OVERFLOW : at32f413_dma.h
  • DMA_FLEXIBLE_TMR5_TRIG : at32f413_dma.h
  • DMA_FLEXIBLE_TMR8_CH1 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR8_CH2 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR8_CH3 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR8_CH4 : at32f413_dma.h
  • DMA_FLEXIBLE_TMR8_HALL : at32f413_dma.h
  • DMA_FLEXIBLE_TMR8_OVERFLOW : at32f413_dma.h
  • DMA_FLEXIBLE_TMR8_TRIG : at32f413_dma.h
  • DMA_FLEXIBLE_UART1_RX : at32f413_dma.h
  • DMA_FLEXIBLE_UART1_TX : at32f413_dma.h
  • DMA_FLEXIBLE_UART2_RX : at32f413_dma.h
  • DMA_FLEXIBLE_UART2_TX : at32f413_dma.h
  • DMA_FLEXIBLE_UART3_RX : at32f413_dma.h
  • DMA_FLEXIBLE_UART3_TX : at32f413_dma.h
  • DMA_FLEXIBLE_UART4_RX : at32f413_dma.h
  • DMA_FLEXIBLE_UART4_TX : at32f413_dma.h
  • DMA_FLEXIBLE_UART5_RX : at32f413_dma.h
  • DMA_FLEXIBLE_UART5_TX : at32f413_dma.h
  • DMA_MEMORY_DATA_WIDTH_BYTE : at32f413_dma.h
  • DMA_MEMORY_DATA_WIDTH_HALFWORD : at32f413_dma.h
  • DMA_MEMORY_DATA_WIDTH_WORD : at32f413_dma.h
  • DMA_MEMORY_INC_DISABLE : at32f413_dma.h
  • DMA_MEMORY_INC_ENABLE : at32f413_dma.h
  • DMA_PERIPHERAL_DATA_WIDTH_BYTE : at32f413_dma.h
  • DMA_PERIPHERAL_DATA_WIDTH_HALFWORD : at32f413_dma.h
  • DMA_PERIPHERAL_DATA_WIDTH_WORD : at32f413_dma.h
  • DMA_PERIPHERAL_INC_DISABLE : at32f413_dma.h
  • DMA_PERIPHERAL_INC_ENABLE : at32f413_dma.h
  • DMA_PRIORITY_HIGH : at32f413_dma.h
  • DMA_PRIORITY_LOW : at32f413_dma.h
  • DMA_PRIORITY_MEDIUM : at32f413_dma.h
  • DMA_PRIORITY_VERY_HIGH : at32f413_dma.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • l
  • m
  • n
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all enum values with links to the files they belong to:

- e -

  • EE_MODE_DMA : eeprom.h
  • EE_MODE_INT : eeprom.h
  • EE_MODE_POLL : eeprom.h
  • EPT_BULK_TYPE : at32f413_usb.h
  • EPT_CONTROL_TYPE : at32f413_usb.h
  • EPT_IN : at32f413_usb.h
  • EPT_INT_TYPE : at32f413_usb.h
  • EPT_ISO_TYPE : at32f413_usb.h
  • EPT_OUT : at32f413_usb.h
  • ERROR : at32f413.h
  • EXINT0_IRQn : at32f413.h
  • EXINT15_10_IRQn : at32f413.h
  • EXINT1_IRQn : at32f413.h
  • EXINT2_IRQn : at32f413.h
  • EXINT3_IRQn : at32f413.h
  • EXINT4_IRQn : at32f413.h
  • EXINT9_5_IRQn : at32f413.h
  • EXINT_LINE_EVENT : at32f413_exint.h
  • EXINT_LINE_INTERRUPT : at32f413_exint.h
  • EXINT_LINE_INTERRUPUT : at32f413_exint.h
  • EXINT_TRIGGER_BOTH_EDGE : at32f413_exint.h
  • EXINT_TRIGGER_FALLING_EDGE : at32f413_exint.h
  • EXINT_TRIGGER_RISING_EDGE : at32f413_exint.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • l
  • m
  • n
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all enum values with links to the files they belong to:

- f -

  • FALSE : at32f413.h
  • FLASH_EPP_ERROR : at32f413_flash.h
  • FLASH_IRQn : at32f413.h
  • FLASH_OPERATE_BUSY : at32f413_flash.h
  • FLASH_OPERATE_DONE : at32f413_flash.h
  • FLASH_OPERATE_TIMEOUT : at32f413_flash.h
  • FLASH_PROGRAM_ERROR : at32f413_flash.h
  • FLASH_SPIM_MODEL1 : at32f413_flash.h
  • FLASH_SPIM_MODEL2 : at32f413_flash.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • l
  • m
  • n
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all enum values with links to the files they belong to:

- g -

  • GPIO_DRIVE_STRENGTH_MAXIMUM : at32f413_gpio.h
  • GPIO_DRIVE_STRENGTH_MODERATE : at32f413_gpio.h
  • GPIO_DRIVE_STRENGTH_STRONGER : at32f413_gpio.h
  • GPIO_MODE_ANALOG : at32f413_gpio.h
  • GPIO_MODE_INPUT : at32f413_gpio.h
  • GPIO_MODE_MUX : at32f413_gpio.h
  • GPIO_MODE_OUTPUT : at32f413_gpio.h
  • GPIO_OUTPUT_OPEN_DRAIN : at32f413_gpio.h
  • GPIO_OUTPUT_PUSH_PULL : at32f413_gpio.h
  • GPIO_PINS_SOURCE0 : at32f413_gpio.h
  • GPIO_PINS_SOURCE1 : at32f413_gpio.h
  • GPIO_PINS_SOURCE10 : at32f413_gpio.h
  • GPIO_PINS_SOURCE11 : at32f413_gpio.h
  • GPIO_PINS_SOURCE12 : at32f413_gpio.h
  • GPIO_PINS_SOURCE13 : at32f413_gpio.h
  • GPIO_PINS_SOURCE14 : at32f413_gpio.h
  • GPIO_PINS_SOURCE15 : at32f413_gpio.h
  • GPIO_PINS_SOURCE2 : at32f413_gpio.h
  • GPIO_PINS_SOURCE3 : at32f413_gpio.h
  • GPIO_PINS_SOURCE4 : at32f413_gpio.h
  • GPIO_PINS_SOURCE5 : at32f413_gpio.h
  • GPIO_PINS_SOURCE6 : at32f413_gpio.h
  • GPIO_PINS_SOURCE7 : at32f413_gpio.h
  • GPIO_PINS_SOURCE8 : at32f413_gpio.h
  • GPIO_PINS_SOURCE9 : at32f413_gpio.h
  • GPIO_PORT_SOURCE_GPIOA : at32f413_gpio.h
  • GPIO_PORT_SOURCE_GPIOB : at32f413_gpio.h
  • GPIO_PORT_SOURCE_GPIOC : at32f413_gpio.h
  • GPIO_PORT_SOURCE_GPIOD : at32f413_gpio.h
  • GPIO_PORT_SOURCE_GPIOF : at32f413_gpio.h
  • GPIO_PULL_DOWN : at32f413_gpio.h
  • GPIO_PULL_NONE : at32f413_gpio.h
  • GPIO_PULL_UP : at32f413_gpio.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • l
  • m
  • n
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all enum values with links to the files they belong to:

- h -

  • HardFault_IRQn : at32f413.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • l
  • m
  • n
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all enum values with links to the files they belong to:

- i -

  • I2C1_ERR_IRQn : at32f413.h
  • I2C1_EVT_IRQn : at32f413.h
  • I2C2_ERR_IRQn : at32f413.h
  • I2C2_EVT_IRQn : at32f413.h
  • I2C_ADDRESS_MODE_10BIT : at32f413_i2c.h
  • I2C_ADDRESS_MODE_7BIT : at32f413_i2c.h
  • I2C_DIRECTION_RECEIVE : at32f413_i2c.h
  • I2C_DIRECTION_TRANSMIT : at32f413_i2c.h
  • I2C_DMA_MA_RX : i2c_application.h
  • I2C_DMA_MA_TX : i2c_application.h
  • I2C_DMA_SLA_RX : i2c_application.h
  • I2C_DMA_SLA_TX : i2c_application.h
  • I2C_ERR_ACKFAIL : i2c_application.h
  • I2C_ERR_ADDR : i2c_application.h
  • I2C_ERR_ADDR10 : i2c_application.h
  • I2C_ERR_INTERRUPT : i2c_application.h
  • I2C_ERR_START : i2c_application.h
  • I2C_ERR_STEP_1 : i2c_application.h
  • I2C_ERR_STEP_10 : i2c_application.h
  • I2C_ERR_STEP_11 : i2c_application.h
  • I2C_ERR_STEP_12 : i2c_application.h
  • I2C_ERR_STEP_2 : i2c_application.h
  • I2C_ERR_STEP_3 : i2c_application.h
  • I2C_ERR_STEP_4 : i2c_application.h
  • I2C_ERR_STEP_5 : i2c_application.h
  • I2C_ERR_STEP_6 : i2c_application.h
  • I2C_ERR_STEP_7 : i2c_application.h
  • I2C_ERR_STEP_8 : i2c_application.h
  • I2C_ERR_STEP_9 : i2c_application.h
  • I2C_ERR_STOP : i2c_application.h
  • I2C_ERR_TIMEOUT : i2c_application.h
  • I2C_FSMODE_DUTY_16_9 : at32f413_i2c.h
  • I2C_FSMODE_DUTY_2_1 : at32f413_i2c.h
  • I2C_INT_MA_RX : i2c_application.h
  • I2C_INT_MA_TX : i2c_application.h
  • I2C_INT_SLA_RX : i2c_application.h
  • I2C_INT_SLA_TX : i2c_application.h
  • I2C_MASTER_ACK_CURRENT : at32f413_i2c.h
  • I2C_MASTER_ACK_NEXT : at32f413_i2c.h
  • I2C_MEM_ADDR_WIDIH_16 : i2c_application.h
  • I2C_MEM_ADDR_WIDIH_8 : i2c_application.h
  • I2C_OK : i2c_application.h
  • I2C_PEC_POSITION_CURRENT : at32f413_i2c.h
  • I2C_PEC_POSITION_NEXT : at32f413_i2c.h
  • I2C_SMBUS_ALERT_HIGH : at32f413_i2c.h
  • I2C_SMBUS_ALERT_LOW : at32f413_i2c.h
  • I2C_SMBUS_MODE_DEVICE : at32f413_i2c.h
  • I2C_SMBUS_MODE_HOST : at32f413_i2c.h
  • I2S_AUDIO_FREQUENCY_11_025K : at32f413_spi.h
  • I2S_AUDIO_FREQUENCY_16K : at32f413_spi.h
  • I2S_AUDIO_FREQUENCY_192K : at32f413_spi.h
  • I2S_AUDIO_FREQUENCY_22_05K : at32f413_spi.h
  • I2S_AUDIO_FREQUENCY_32K : at32f413_spi.h
  • I2S_AUDIO_FREQUENCY_44_1K : at32f413_spi.h
  • I2S_AUDIO_FREQUENCY_48K : at32f413_spi.h
  • I2S_AUDIO_FREQUENCY_8K : at32f413_spi.h
  • I2S_AUDIO_FREQUENCY_96K : at32f413_spi.h
  • I2S_AUDIO_FREQUENCY_DEFAULT : at32f413_spi.h
  • I2S_AUDIO_PROTOCOL_LSB : at32f413_spi.h
  • I2S_AUDIO_PROTOCOL_MSB : at32f413_spi.h
  • I2S_AUDIO_PROTOCOL_PCM_LONG : at32f413_spi.h
  • I2S_AUDIO_PROTOCOL_PCM_SHORT : at32f413_spi.h
  • I2S_AUDIO_PROTOCOL_PHILLIPS : at32f413_spi.h
  • I2S_CLOCK_POLARITY_HIGH : at32f413_spi.h
  • I2S_CLOCK_POLARITY_LOW : at32f413_spi.h
  • I2S_DATA_16BIT_CHANNEL_16BIT : at32f413_spi.h
  • I2S_DATA_16BIT_CHANNEL_32BIT : at32f413_spi.h
  • I2S_DATA_24BIT_CHANNEL_32BIT : at32f413_spi.h
  • I2S_DATA_32BIT_CHANNEL_32BIT : at32f413_spi.h
  • I2S_MODE_MASTER_RX : at32f413_spi.h
  • I2S_MODE_MASTER_TX : at32f413_spi.h
  • I2S_MODE_SLAVE_RX : at32f413_spi.h
  • I2S_MODE_SLAVE_TX : at32f413_spi.h
  • IAP_FAILED : hid_iap_class.h
  • IAP_STS_ADDR : hid_iap_class.h
  • IAP_STS_CRC : hid_iap_class.h
  • IAP_STS_DATA : hid_iap_class.h
  • IAP_STS_FINISH : hid_iap_class.h
  • IAP_STS_IDLE : hid_iap_class.h
  • IAP_STS_JMP : hid_iap_class.h
  • IAP_STS_JMP_WAIT : hid_iap_class.h
  • IAP_STS_START : hid_iap_class.h
  • IAP_SUCCESS : hid_iap_class.h
  • IAP_WAIT : hid_iap_class.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • l
  • m
  • n
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all enum values with links to the files they belong to:

- l -

  • LED2 : at32f413_board.h
  • LED3 : at32f413_board.h
  • LED4 : at32f413_board.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • l
  • m
  • n
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all enum values with links to the files they belong to:

- m -

  • MemoryManagement_IRQn : at32f413.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • l
  • m
  • n
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all enum values with links to the files they belong to:

- n -

  • NO_BUTTON : at32f413_board.h
  • NonMaskableInt_IRQn : at32f413.h
  • NVIC_LP_SEVONPEND : at32f413_misc.h
  • NVIC_LP_SLEEPDEEP : at32f413_misc.h
  • NVIC_LP_SLEEPONEXIT : at32f413_misc.h
  • NVIC_PRIORITY_GROUP_0 : at32f413_misc.h
  • NVIC_PRIORITY_GROUP_1 : at32f413_misc.h
  • NVIC_PRIORITY_GROUP_2 : at32f413_misc.h
  • NVIC_PRIORITY_GROUP_3 : at32f413_misc.h
  • NVIC_PRIORITY_GROUP_4 : at32f413_misc.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • l
  • m
  • n
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all enum values with links to the files they belong to:

- p -

  • PendSV_IRQn : at32f413.h
  • PRINTER_REQ_GET_DEVICE_ID : printer_class.h
  • PRINTER_REQ_GET_PORT_STATUS : printer_class.h
  • PRINTER_REQ_GET_SOFT_RESET : printer_class.h
  • PVM_IRQn : at32f413.h
  • PWC_DEEP_SLEEP_ENTER_WFE : at32f413_pwc.h
  • PWC_DEEP_SLEEP_ENTER_WFI : at32f413_pwc.h
  • PWC_PVM_VOLTAGE_2V3 : at32f413_pwc.h
  • PWC_PVM_VOLTAGE_2V4 : at32f413_pwc.h
  • PWC_PVM_VOLTAGE_2V5 : at32f413_pwc.h
  • PWC_PVM_VOLTAGE_2V6 : at32f413_pwc.h
  • PWC_PVM_VOLTAGE_2V7 : at32f413_pwc.h
  • PWC_PVM_VOLTAGE_2V8 : at32f413_pwc.h
  • PWC_PVM_VOLTAGE_2V9 : at32f413_pwc.h
  • PWC_SLEEP_ENTER_WFE : at32f413_pwc.h
  • PWC_SLEEP_ENTER_WFI : at32f413_pwc.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • l
  • m
  • n
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all enum values with links to the files they belong to:

- r -

  • RESET : at32f413.h
  • Reset_IRQn : at32f413.h
  • RTC_IRQn : at32f413.h
  • RTCAlarm_IRQn : at32f413.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • l
  • m
  • n
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all enum values with links to the files they belong to:

- s -

  • SD_ADDR_MISALIGNED : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_ADDR_OUT_OF_RANGE : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_AKE_SEQ_ERROR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_BLK_LEN_ERR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CARD_CONTROLLER_ERR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CARD_DISCONNECTED : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CARD_ECC_DISABLED : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CARD_ECC_ERROR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CARD_ERROR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CARD_IDENTIFICATION : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CARD_PROGRAMMING : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CARD_READY : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CARD_RECEIVING : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CARD_SENDING : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CARD_STANDBY : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CARD_TRANSFER : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CID_CSD_OVERWRITE : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_CRC_ERROR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_FAIL : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_OUT_OF_RANGE : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_RSP_TIMEOUT : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_DATA_FAIL : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_DATA_TIMEOUT : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_ERASE_RESET : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_ERASE_SEQ_ERR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_ERROR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_GENERAL_UNKNOWN_ERROR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_ILLEGAL_CMD : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_INTERNAL_ERROR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_INVALID_ERASE_PARAM : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_INVALID_PARAMETER : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_INVALID_VOLTRANGE : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_LOCK_UNLOCK_ERROR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_NOT_CONFIGURED : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_OK : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_REQ_NOT_APPLICABLE : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_REQ_PENDING : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_RX_OVERRUN : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_SDIO_DISABLED : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_SDIO_FUNC_BUSY : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_SDIO_FUNC_ERROR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_SDIO_UNKNOWN_FUNC : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_START_BIT_ERR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_STREAM_RD_UNDERRUN : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_STREAM_WR_OVERRUN : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_SWITCH_ERROR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_TRANSFER_DMA_MODE : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_TRANSFER_POLLING_MODE : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_TX_UNDERRUN : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_UNSUPPORTED_FEATURE : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_UNSUPPORTED_HW : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_WP_ERASE_SKIP : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_WR_PROTECT_VIOLATION : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SDIO1_IRQn : at32f413.h
  • SDIO_BUS_WIDTH_D1 : at32f413_sdio.h
  • SDIO_BUS_WIDTH_D4 : at32f413_sdio.h
  • SDIO_BUS_WIDTH_D8 : at32f413_sdio.h
  • SDIO_CLOCK_EDGE_FALLING : at32f413_sdio.h
  • SDIO_CLOCK_EDGE_RISING : at32f413_sdio.h
  • SDIO_DATA_BLOCK_SIZE_1024B : at32f413_sdio.h
  • SDIO_DATA_BLOCK_SIZE_128B : at32f413_sdio.h
  • SDIO_DATA_BLOCK_SIZE_16384B : at32f413_sdio.h
  • SDIO_DATA_BLOCK_SIZE_16B : at32f413_sdio.h
  • SDIO_DATA_BLOCK_SIZE_1B : at32f413_sdio.h
  • SDIO_DATA_BLOCK_SIZE_2048B : at32f413_sdio.h
  • SDIO_DATA_BLOCK_SIZE_256B : at32f413_sdio.h
  • SDIO_DATA_BLOCK_SIZE_2B : at32f413_sdio.h
  • SDIO_DATA_BLOCK_SIZE_32B : at32f413_sdio.h
  • SDIO_DATA_BLOCK_SIZE_4096B : at32f413_sdio.h
  • SDIO_DATA_BLOCK_SIZE_4B : at32f413_sdio.h
  • SDIO_DATA_BLOCK_SIZE_512B : at32f413_sdio.h
  • SDIO_DATA_BLOCK_SIZE_64B : at32f413_sdio.h
  • SDIO_DATA_BLOCK_SIZE_8192B : at32f413_sdio.h
  • SDIO_DATA_BLOCK_SIZE_8B : at32f413_sdio.h
  • SDIO_DATA_BLOCK_TRANSFER : at32f413_sdio.h
  • SDIO_DATA_STREAM_TRANSFER : at32f413_sdio.h
  • SDIO_DATA_TRANSFER_TO_CARD : at32f413_sdio.h
  • SDIO_DATA_TRANSFER_TO_CONTROLLER : at32f413_sdio.h
  • SDIO_HIGH_CAPACITY_MMC_CARD : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SDIO_HIGH_CAPACITY_SD_CARD : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SDIO_HIGH_SPEED_MULTIMEDIA_CARD : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SDIO_MULTIMEDIA_CARD : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SDIO_POWER_OFF : at32f413_sdio.h
  • SDIO_POWER_ON : at32f413_sdio.h
  • SDIO_READ_WAIT_CONTROLLED_BY_CK : at32f413_sdio.h
  • SDIO_READ_WAIT_CONTROLLED_BY_D2 : at32f413_sdio.h
  • SDIO_RESPONSE_LONG : at32f413_sdio.h
  • SDIO_RESPONSE_NO : at32f413_sdio.h
  • SDIO_RESPONSE_SHORT : at32f413_sdio.h
  • SDIO_RSP1_INDEX : at32f413_sdio.h
  • SDIO_RSP2_INDEX : at32f413_sdio.h
  • SDIO_RSP3_INDEX : at32f413_sdio.h
  • SDIO_RSP4_INDEX : at32f413_sdio.h
  • SDIO_SDIO_CARD : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SDIO_SECURE_DIGITAL_IO_CARD : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SDIO_SECURE_DIGITAL_IO_COMBO_CARD : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SDIO_STD_CAPACITY_SD_CARD_V1_1 : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SDIO_STD_CAPACITY_SD_CARD_V2_0 : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SDIO_WAIT_FOR_INT : at32f413_sdio.h
  • SDIO_WAIT_FOR_NO : at32f413_sdio.h
  • SDIO_WAIT_FOR_PEND : at32f413_sdio.h
  • SET : at32f413.h
  • SPI1_IRQn : at32f413.h
  • SPI2_IRQn : at32f413.h
  • SPI_CLOCK_PHASE_1EDGE : at32f413_spi.h
  • SPI_CLOCK_PHASE_2EDGE : at32f413_spi.h
  • SPI_CLOCK_POLARITY_HIGH : at32f413_spi.h
  • SPI_CLOCK_POLARITY_LOW : at32f413_spi.h
  • SPI_CRC_RX : at32f413_spi.h
  • SPI_CRC_TX : at32f413_spi.h
  • SPI_CS_HARDWARE_MODE : at32f413_spi.h
  • SPI_CS_SOFTWARE_MODE : at32f413_spi.h
  • SPI_FIRST_BIT_LSB : at32f413_spi.h
  • SPI_FIRST_BIT_MSB : at32f413_spi.h
  • SPI_FRAME_16BIT : at32f413_spi.h
  • SPI_FRAME_8BIT : at32f413_spi.h
  • SPI_HALF_DUPLEX_DIRECTION_RX : at32f413_spi.h
  • SPI_HALF_DUPLEX_DIRECTION_TX : at32f413_spi.h
  • SPI_MCLK_DIV_1024 : at32f413_spi.h
  • SPI_MCLK_DIV_128 : at32f413_spi.h
  • SPI_MCLK_DIV_16 : at32f413_spi.h
  • SPI_MCLK_DIV_2 : at32f413_spi.h
  • SPI_MCLK_DIV_256 : at32f413_spi.h
  • SPI_MCLK_DIV_32 : at32f413_spi.h
  • SPI_MCLK_DIV_4 : at32f413_spi.h
  • SPI_MCLK_DIV_512 : at32f413_spi.h
  • SPI_MCLK_DIV_64 : at32f413_spi.h
  • SPI_MCLK_DIV_8 : at32f413_spi.h
  • SPI_MODE_MASTER : at32f413_spi.h
  • SPI_MODE_SLAVE : at32f413_spi.h
  • SPI_SWCS_INTERNAL_LEVEL_HIGHT : at32f413_spi.h
  • SPI_SWCS_INTERNAL_LEVEL_LOW : at32f413_spi.h
  • SPI_TRANSMIT_FULL_DUPLEX : at32f413_spi.h
  • SPI_TRANSMIT_HALF_DUPLEX_RX : at32f413_spi.h
  • SPI_TRANSMIT_HALF_DUPLEX_TX : at32f413_spi.h
  • SPI_TRANSMIT_SIMPLEX_RX : at32f413_spi.h
  • SUCCESS : at32f413.h
  • SVCall_IRQn : at32f413.h
  • SYSTICK_CLOCK_SOURCE_AHBCLK_DIV8 : at32f413_misc.h
  • SYSTICK_CLOCK_SOURCE_AHBCLK_NODIV : at32f413_misc.h
  • SysTick_IRQn : at32f413.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • l
  • m
  • n
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all enum values with links to the files they belong to:

- t -

  • TAMPER_IRQn : at32f413.h
  • TEST_FAIL : project/at_start_f413/examples/sdio/emmc_card/src/main.c, project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c
  • TEST_SUCCESS : project/at_start_f413/examples/sdio/emmc_card/src/main.c, project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c
  • TMR1_BRK_TMR9_IRQn : at32f413.h
  • TMR1_CH_IRQn : at32f413.h
  • TMR1_OVF_TMR10_IRQn : at32f413.h
  • TMR1_TRG_HALL_TMR11_IRQn : at32f413.h
  • TMR2_GLOBAL_IRQn : at32f413.h
  • TMR3_GLOBAL_IRQn : at32f413.h
  • TMR4_GLOBAL_IRQn : at32f413.h
  • TMR5_GLOBAL_IRQn : at32f413.h
  • TMR8_BRK_IRQn : at32f413.h
  • TMR8_CH_IRQn : at32f413.h
  • TMR8_OVF_IRQn : at32f413.h
  • TMR8_TRG_HALL_IRQn : at32f413.h
  • TMR_BRK_ADDRESS : at32f413_tmr.h
  • TMR_BRK_INPUT_ACTIVE_HIGH : at32f413_tmr.h
  • TMR_BRK_INPUT_ACTIVE_LOW : at32f413_tmr.h
  • TMR_BRK_SWTRIG : at32f413_tmr.h
  • TMR_C1_DMA_REQUEST : at32f413_tmr.h
  • TMR_C1_SWTRIG : at32f413_tmr.h
  • TMR_C1DT_ADDRESS : at32f413_tmr.h
  • TMR_C2_DMA_REQUEST : at32f413_tmr.h
  • TMR_C2_SWTRIG : at32f413_tmr.h
  • TMR_C2DT_ADDRESS : at32f413_tmr.h
  • TMR_C3_DMA_REQUEST : at32f413_tmr.h
  • TMR_C3_SWTRIG : at32f413_tmr.h
  • TMR_C3DT_ADDRESS : at32f413_tmr.h
  • TMR_C4_DMA_REQUEST : at32f413_tmr.h
  • TMR_C4_SWTRIG : at32f413_tmr.h
  • TMR_C4DT_ADDRESS : at32f413_tmr.h
  • TMR_CC_CHANNEL_MAPPED_DIRECT : at32f413_tmr.h
  • TMR_CC_CHANNEL_MAPPED_INDIRECT : at32f413_tmr.h
  • TMR_CC_CHANNEL_MAPPED_STI : at32f413_tmr.h
  • TMR_CCTRL_ADDRESS : at32f413_tmr.h
  • TMR_CHANEL1_2_3_CONNECTED_C1IRAW_XOR : at32f413_tmr.h
  • TMR_CHANEL1_CONNECTED_C1IRAW : at32f413_tmr.h
  • TMR_CHANNEL_INPUT_DIV_1 : at32f413_tmr.h
  • TMR_CHANNEL_INPUT_DIV_2 : at32f413_tmr.h
  • TMR_CHANNEL_INPUT_DIV_4 : at32f413_tmr.h
  • TMR_CHANNEL_INPUT_DIV_8 : at32f413_tmr.h
  • TMR_CLOCK_DIV1 : at32f413_tmr.h
  • TMR_CLOCK_DIV2 : at32f413_tmr.h
  • TMR_CLOCK_DIV4 : at32f413_tmr.h
  • TMR_CM1_ADDRESS : at32f413_tmr.h
  • TMR_CM2_ADDRESS : at32f413_tmr.h
  • TMR_COUNT_DOWN : at32f413_tmr.h
  • TMR_COUNT_TWO_WAY_1 : at32f413_tmr.h
  • TMR_COUNT_TWO_WAY_2 : at32f413_tmr.h
  • TMR_COUNT_TWO_WAY_3 : at32f413_tmr.h
  • TMR_COUNT_UP : at32f413_tmr.h
  • TMR_CTRL1_ADDRESS : at32f413_tmr.h
  • TMR_CTRL2_ADDRESS : at32f413_tmr.h
  • TMR_CVAL_ADDRESS : at32f413_tmr.h
  • TMR_DIV_ADDRESS : at32f413_tmr.h
  • TMR_DMA_REQUEST_BY_CHANNEL : at32f413_tmr.h
  • TMR_DMA_REQUEST_BY_OVERFLOW : at32f413_tmr.h
  • TMR_DMA_TRANSFER_10BYTES : at32f413_tmr.h
  • TMR_DMA_TRANSFER_11BYTES : at32f413_tmr.h
  • TMR_DMA_TRANSFER_12BYTES : at32f413_tmr.h
  • TMR_DMA_TRANSFER_13BYTES : at32f413_tmr.h
  • TMR_DMA_TRANSFER_14BYTES : at32f413_tmr.h
  • TMR_DMA_TRANSFER_15BYTES : at32f413_tmr.h
  • TMR_DMA_TRANSFER_16BYTES : at32f413_tmr.h
  • TMR_DMA_TRANSFER_17BYTES : at32f413_tmr.h
  • TMR_DMA_TRANSFER_18BYTES : at32f413_tmr.h
  • TMR_DMA_TRANSFER_1BYTE : at32f413_tmr.h
  • TMR_DMA_TRANSFER_2BYTES : at32f413_tmr.h
  • TMR_DMA_TRANSFER_3BYTES : at32f413_tmr.h
  • TMR_DMA_TRANSFER_4BYTES : at32f413_tmr.h
  • TMR_DMA_TRANSFER_5BYTES : at32f413_tmr.h
  • TMR_DMA_TRANSFER_6BYTES : at32f413_tmr.h
  • TMR_DMA_TRANSFER_7BYTES : at32f413_tmr.h
  • TMR_DMA_TRANSFER_8BYTES : at32f413_tmr.h
  • TMR_DMA_TRANSFER_9BYTES : at32f413_tmr.h
  • TMR_DMACTRL_ADDRESS : at32f413_tmr.h
  • TMR_ENCODER_MODE_A : at32f413_tmr.h
  • TMR_ENCODER_MODE_B : at32f413_tmr.h
  • TMR_ENCODER_MODE_C : at32f413_tmr.h
  • TMR_ES_FREQUENCY_DIV_1 : at32f413_tmr.h
  • TMR_ES_FREQUENCY_DIV_2 : at32f413_tmr.h
  • TMR_ES_FREQUENCY_DIV_4 : at32f413_tmr.h
  • TMR_ES_FREQUENCY_DIV_8 : at32f413_tmr.h
  • TMR_ES_POLARITY_INVERTED : at32f413_tmr.h
  • TMR_ES_POLARITY_NON_INVERTED : at32f413_tmr.h
  • TMR_FORCE_OUTPUT_HIGH : at32f413_tmr.h
  • TMR_FORCE_OUTPUT_LOW : at32f413_tmr.h
  • TMR_HALL_DMA_REQUEST : at32f413_tmr.h
  • TMR_HALL_SWTRIG : at32f413_tmr.h
  • TMR_IDEN_ADDRESS : at32f413_tmr.h
  • TMR_INPUT_BOTH_EDGE : at32f413_tmr.h
  • TMR_INPUT_FALLING_EDGE : at32f413_tmr.h
  • TMR_INPUT_RISING_EDGE : at32f413_tmr.h
  • TMR_ISTS_ADDRESS : at32f413_tmr.h
  • TMR_OUTPUT_ACTIVE_HIGH : at32f413_tmr.h
  • TMR_OUTPUT_ACTIVE_LOW : at32f413_tmr.h
  • TMR_OUTPUT_CONTROL_FORCE_HIGH : at32f413_tmr.h
  • TMR_OUTPUT_CONTROL_FORCE_LOW : at32f413_tmr.h
  • TMR_OUTPUT_CONTROL_HIGH : at32f413_tmr.h
  • TMR_OUTPUT_CONTROL_LOW : at32f413_tmr.h
  • TMR_OUTPUT_CONTROL_OFF : at32f413_tmr.h
  • TMR_OUTPUT_CONTROL_PWM_MODE_A : at32f413_tmr.h
  • TMR_OUTPUT_CONTROL_PWM_MODE_B : at32f413_tmr.h
  • TMR_OUTPUT_CONTROL_SWITCH : at32f413_tmr.h
  • TMR_OVERFLOW_DMA_REQUEST : at32f413_tmr.h
  • TMR_OVERFLOW_SWTRIG : at32f413_tmr.h
  • TMR_POLARITY_ACTIVE_BOTH : at32f413_tmr.h
  • TMR_POLARITY_ACTIVE_HIGH : at32f413_tmr.h
  • TMR_POLARITY_ACTIVE_LOW : at32f413_tmr.h
  • TMR_PR_ADDRESS : at32f413_tmr.h
  • TMR_PRIMARY_SEL_C1ORAW : at32f413_tmr.h
  • TMR_PRIMARY_SEL_C2ORAW : at32f413_tmr.h
  • TMR_PRIMARY_SEL_C3ORAW : at32f413_tmr.h
  • TMR_PRIMARY_SEL_C4ORAW : at32f413_tmr.h
  • TMR_PRIMARY_SEL_COMPARE : at32f413_tmr.h
  • TMR_PRIMARY_SEL_ENABLE : at32f413_tmr.h
  • TMR_PRIMARY_SEL_OVERFLOW : at32f413_tmr.h
  • TMR_PRIMARY_SEL_RESET : at32f413_tmr.h
  • TMR_RPR_ADDRESS : at32f413_tmr.h
  • TMR_SELECT_CHANNEL_1 : at32f413_tmr.h
  • TMR_SELECT_CHANNEL_1C : at32f413_tmr.h
  • TMR_SELECT_CHANNEL_2 : at32f413_tmr.h
  • TMR_SELECT_CHANNEL_2C : at32f413_tmr.h
  • TMR_SELECT_CHANNEL_3 : at32f413_tmr.h
  • TMR_SELECT_CHANNEL_3C : at32f413_tmr.h
  • TMR_SELECT_CHANNEL_4 : at32f413_tmr.h
  • TMR_STCTRL_ADDRESS : at32f413_tmr.h
  • TMR_SUB_ENCODER_MODE_A : at32f413_tmr.h
  • TMR_SUB_ENCODER_MODE_B : at32f413_tmr.h
  • TMR_SUB_ENCODER_MODE_C : at32f413_tmr.h
  • TMR_SUB_EXTERNAL_CLOCK_MODE_A : at32f413_tmr.h
  • TMR_SUB_HANG_MODE : at32f413_tmr.h
  • TMR_SUB_INPUT_SEL_C1DF1 : at32f413_tmr.h
  • TMR_SUB_INPUT_SEL_C1INC : at32f413_tmr.h
  • TMR_SUB_INPUT_SEL_C2DF2 : at32f413_tmr.h
  • TMR_SUB_INPUT_SEL_EXTIN : at32f413_tmr.h
  • TMR_SUB_INPUT_SEL_IS0 : at32f413_tmr.h
  • TMR_SUB_INPUT_SEL_IS1 : at32f413_tmr.h
  • TMR_SUB_INPUT_SEL_IS2 : at32f413_tmr.h
  • TMR_SUB_INPUT_SEL_IS3 : at32f413_tmr.h
  • TMR_SUB_MODE_DIABLE : at32f413_tmr.h
  • TMR_SUB_RESET_MODE : at32f413_tmr.h
  • TMR_SUB_TRIGGER_MODE : at32f413_tmr.h
  • TMR_SWEVT_ADDRESS : at32f413_tmr.h
  • TMR_TRIGGER_DMA_REQUEST : at32f413_tmr.h
  • TMR_TRIGGER_SWTRIG : at32f413_tmr.h
  • TMR_WP_LEVEL_1 : at32f413_tmr.h
  • TMR_WP_LEVEL_2 : at32f413_tmr.h
  • TMR_WP_LEVEL_3 : at32f413_tmr.h
  • TMR_WP_OFF : at32f413_tmr.h
  • TRUE : at32f413.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • l
  • m
  • n
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all enum values with links to the files they belong to:

- u -

  • UART4_IRQn : at32f413.h
  • UART5_IRQn : at32f413.h
  • UPDATE_CLEAR_FLAG : bootloader/inc/iap.h
  • UPDATE_DONE : bootloader/inc/iap.h
  • UPDATE_ING : bootloader/inc/iap.h
  • UPDATE_PRE : bootloader/inc/iap.h
  • UPGRADE_DONE : flash_fat16.h
  • UPGRADE_FAILED : flash_fat16.h
  • UPGRADE_JUMP : flash_fat16.h
  • UPGRADE_LARGE : flash_fat16.h
  • UPGRADE_READY : flash_fat16.h
  • UPGRADE_SUCCESS : flash_fat16.h
  • UPGRADE_UNKNOWN : flash_fat16.h
  • UPGRAGE_ONGOING : flash_fat16.h
  • UsageFault_IRQn : at32f413.h
  • USART1_IRQn : at32f413.h
  • USART2_IRQn : at32f413.h
  • USART3_IRQn : at32f413.h
  • USART_BREAK_10BITS : at32f413_usart.h
  • USART_BREAK_11BITS : at32f413_usart.h
  • USART_CLOCK_LAST_BIT_NONE : at32f413_usart.h
  • USART_CLOCK_LAST_BIT_OUTPUT : at32f413_usart.h
  • USART_CLOCK_PHASE_1EDGE : at32f413_usart.h
  • USART_CLOCK_PHASE_2EDGE : at32f413_usart.h
  • USART_CLOCK_POLARITY_HIGH : at32f413_usart.h
  • USART_CLOCK_POLARITY_LOW : at32f413_usart.h
  • USART_DATA_8BITS : at32f413_usart.h
  • USART_DATA_9BITS : at32f413_usart.h
  • USART_HARDWARE_FLOW_CTS : at32f413_usart.h
  • USART_HARDWARE_FLOW_NONE : at32f413_usart.h
  • USART_HARDWARE_FLOW_RTS : at32f413_usart.h
  • USART_HARDWARE_FLOW_RTS_CTS : at32f413_usart.h
  • USART_PARITY_EVEN : at32f413_usart.h
  • USART_PARITY_NONE : at32f413_usart.h
  • USART_PARITY_ODD : at32f413_usart.h
  • USART_STOP_0_5_BIT : at32f413_usart.h
  • USART_STOP_1_5_BIT : at32f413_usart.h
  • USART_STOP_1_BIT : at32f413_usart.h
  • USART_STOP_2_BIT : at32f413_usart.h
  • USART_WAKEUP_BY_IDLE_FRAME : at32f413_usart.h
  • USART_WAKEUP_BY_MATCHING_ID : at32f413_usart.h
  • USB_CLK_HEXT : at32f413_usb.h
  • USB_CLK_HICK : at32f413_usb.h
  • USB_CONN_STATE_ADDRESSED : usb_std.h
  • USB_CONN_STATE_CONFIGURED : usb_std.h
  • USB_CONN_STATE_DEFAULT : usb_std.h
  • USB_CONN_STATE_SUSPENDED : usb_std.h
  • USB_EPT0 : at32f413_usb.h
  • USB_EPT1 : at32f413_usb.h
  • USB_EPT2 : at32f413_usb.h
  • USB_EPT3 : at32f413_usb.h
  • USB_EPT4 : at32f413_usb.h
  • USB_EPT5 : at32f413_usb.h
  • USB_EPT6 : at32f413_usb.h
  • USB_EPT7 : at32f413_usb.h
  • USB_ERROR : usb_std.h
  • USB_FAIL : usb_std.h
  • USB_NOT_SUPPORT : usb_std.h
  • USB_OK : usb_std.h
  • USB_WAIT : usb_std.h
  • USBD_ERR_EVENT : usbd_core.h
  • USBD_NOP_EVENT : usbd_core.h
  • USBD_RESET_EVENT : usbd_core.h
  • USBD_SUSPEND_EVENT : usbd_core.h
  • USBD_WAKEUP_EVENT : usbd_core.h
  • USBFS_H_CAN1_TX_IRQn : at32f413.h
  • USBFS_L_CAN1_RX0_IRQn : at32f413.h
  • USBFS_MAPH_IRQn : at32f413.h
  • USBFS_MAPL_IRQn : at32f413.h
  • USBFSWakeUp_IRQn : at32f413.h
  • USER_BUTTON : at32f413_board.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • l
  • m
  • n
  • p
  • r
  • s
  • t
  • u
  • w
Here is a list of all enum values with links to the files they belong to:

- w -

  • WDT_CLK_DIV_128 : at32f413_wdt.h
  • WDT_CLK_DIV_16 : at32f413_wdt.h
  • WDT_CLK_DIV_256 : at32f413_wdt.h
  • WDT_CLK_DIV_32 : at32f413_wdt.h
  • WDT_CLK_DIV_4 : at32f413_wdt.h
  • WDT_CLK_DIV_64 : at32f413_wdt.h
  • WDT_CLK_DIV_8 : at32f413_wdt.h
  • WDT_CMD_ENABLE : at32f413_wdt.h
  • WDT_CMD_LOCK : at32f413_wdt.h
  • WDT_CMD_RELOAD : at32f413_wdt.h
  • WDT_CMD_UNLOCK : at32f413_wdt.h
  • WWDT_IRQn : at32f413.h
  • WWDT_PCLK1_DIV_16384 : at32f413_wwdt.h
  • WWDT_PCLK1_DIV_32768 : at32f413_wwdt.h
  • WWDT_PCLK1_DIV_4096 : at32f413_wwdt.h
  • WWDT_PCLK1_DIV_8192 : at32f413_wwdt.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all macros with links to the files they belong to:

- _ -

  • __AT32F413_LIBRARY_VERSION : at32f413.h
  • __AT32F413_LIBRARY_VERSION_MAJOR : at32f413.h
  • __AT32F413_LIBRARY_VERSION_MIDDLE : at32f413.h
  • __AT32F413_LIBRARY_VERSION_MINOR : at32f413.h
  • __AT32F413_LIBRARY_VERSION_RC : at32f413.h
  • __CM4_REV : at32f413.h
  • __FPU_PRESENT : at32f413.h
  • __MPU_PRESENT : at32f413.h
  • __NVIC_PRIO_BITS : at32f413.h
  • __Vendor_SysTickConfig : at32f413.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all macros with links to the files they belong to:

- a -

  • ACC : at32f413_acc.h
  • ACC_BASE : at32f413.h
  • ACC_CAL_HICKCAL : at32f413_acc.h
  • ACC_CAL_HICKTRIM : at32f413_acc.h
  • ACC_CALRDY_FLAG : at32f413_acc.h
  • ACC_CALRDYIEN_INT : at32f413_acc.h
  • ACC_EIEN_INT : at32f413_acc.h
  • ACC_MODULE_ENABLED : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • ACC_RSLOST_FLAG : at32f413_acc.h
  • ACC_TRIM : project/at_start_f413/examples/acc/calibration/src/main.c
  • ADC1 : at32f413_adc.h
  • ADC1_BASE : at32f413.h
  • ADC1_ETO_GMUX : at32f413_gpio.h
  • ADC1_ETO_MUX : at32f413_gpio.h
  • ADC1_ETP_GMUX : at32f413_gpio.h
  • ADC1_ETP_MUX : at32f413_gpio.h
  • ADC2 : at32f413_adc.h
  • ADC2_BASE : at32f413.h
  • ADC2_ETO_GMUX : at32f413_gpio.h
  • ADC2_ETO_MUX : at32f413_gpio.h
  • ADC2_ETP_GMUX : at32f413_gpio.h
  • ADC2_ETP_MUX : at32f413_gpio.h
  • ADC_CCE_FLAG : at32f413_adc.h
  • ADC_CCE_INT : at32f413_adc.h
  • ADC_MODULE_ENABLED : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • ADC_OCCS_FLAG : at32f413_adc.h
  • ADC_PCCE_FLAG : at32f413_adc.h
  • ADC_PCCE_INT : at32f413_adc.h
  • ADC_PCCS_FLAG : at32f413_adc.h
  • ADC_TEMP_BASE : project/at_start_f413/examples/adc/internal_temperature_sensor/src/main.c
  • ADC_TEMP_SLOPE : project/at_start_f413/examples/adc/internal_temperature_sensor/src/main.c
  • ADC_VMOR_FLAG : at32f413_adc.h
  • ADC_VMOR_INT : at32f413_adc.h
  • ADC_VREF : project/at_start_f413/examples/adc/internal_temperature_sensor/src/main.c
  • ADDRESS_OUT_OF_RANGE : cdc_msc_class.h, msc_bot_scsi.h
  • AHBPERIPH_BASE : at32f413.h
  • AIRCR_VECTKEY_MASK : at32f413_misc.c
  • APB1PERIPH_BASE : at32f413.h
  • APB2PERIPH_BASE : at32f413.h
  • APP_START_ADDR : app_led3_toggle/inc/iap.h, app_led4_toggle/inc/iap.h, bootloader/inc/iap.h
  • AT32_AUDIO_FREQ_16K : audio_desc.h, audio_hid_desc.h
  • AT32_AUDIO_FREQ_48K : audio_desc.h, audio_hid_desc.h
  • AUDIO_AC_DESCRIPTOR_UNDEFINED : audio_desc.h, audio_hid_desc.h
  • AUDIO_AC_EXTENSION_UNIT : audio_desc.h, audio_hid_desc.h
  • AUDIO_AC_FEATURE_UNIT : audio_desc.h, audio_hid_desc.h
  • AUDIO_AC_HEADER : audio_desc.h, audio_hid_desc.h
  • AUDIO_AC_INPUT_TERMINAL : audio_desc.h, audio_hid_desc.h
  • AUDIO_AC_MIXER_UNIT : audio_desc.h, audio_hid_desc.h
  • AUDIO_AC_OUTPUT_TERMINAL : audio_desc.h, audio_hid_desc.h
  • AUDIO_AC_PROCESSING_UNIT : audio_desc.h, audio_hid_desc.h
  • AUDIO_AC_SELECTOR_UNIT : audio_desc.h, audio_hid_desc.h
  • AUDIO_AS_DESCRIPTOR_UNDEFINED : audio_desc.h, audio_hid_desc.h
  • AUDIO_AS_FORMAT_SPECIFIC : audio_desc.h, audio_hid_desc.h
  • AUDIO_AS_FORMAT_TYPE : audio_desc.h, audio_hid_desc.h
  • AUDIO_AS_GENERAL : audio_desc.h, audio_hid_desc.h
  • AUDIO_BCD_NUM : audio_desc.h
  • AUDIO_BINTERVAL_TIME : audio_desc.h
  • AUDIO_BITW_16 : audio/audio_conf.h, audio_hid/audio_conf.h
  • AUDIO_CS_CONFIGURATION : audio_desc.h, audio_hid_desc.h
  • AUDIO_CS_DEVICE : audio_desc.h, audio_hid_desc.h
  • AUDIO_CS_ENDPOINT : audio_desc.h, audio_hid_desc.h
  • AUDIO_CS_INTERFACE : audio_desc.h, audio_hid_desc.h
  • AUDIO_CS_STRING : audio_desc.h, audio_hid_desc.h
  • AUDIO_CS_UNDEFINED : audio_desc.h, audio_hid_desc.h
  • AUDIO_DEFAULT_BITW : audio/audio_conf.h, audio_hid/audio_conf.h
  • AUDIO_DEFAULT_FREQ : audio/audio_conf.h, audio_hid/audio_conf.h
  • AUDIO_DESCRIPTOR_SIZE : audio_class.h, audio_hid_class.h
  • AUDIO_DESCRIPTOR_TYPE : audio_class.h, audio_hid_class.h
  • AUDIO_FEATURE_UNIT_SIZE : audio_desc.h, audio_hid_desc.h
  • AUDIO_FEEDBACK_MAXPACKET_SIZE : audio_class.h, audio_hid_class.h
  • AUDIO_FORMAT_TYPE_I : audio_desc.h, audio_hid_desc.h
  • AUDIO_FREQ_16K : audio/audio_conf.h, audio_hid/audio_conf.h
  • AUDIO_FREQ_48K : audio/audio_conf.h, audio_hid/audio_conf.h
  • AUDIO_FREQ_SET_CONTROL : audio_class.h, audio_hid_class.h
  • AUDIO_FU_BASS_CONTROL : audio_desc.h, audio_hid_desc.h
  • AUDIO_FU_CONTROL_UNDEFINED : audio_desc.h, audio_hid_desc.h
  • AUDIO_FU_MID_CONTROL : audio_desc.h, audio_hid_desc.h
  • AUDIO_FU_MUTE_CONTROL : audio_desc.h, audio_hid_desc.h
  • AUDIO_FU_TREBLE_CONTROL : audio_desc.h, audio_hid_desc.h
  • AUDIO_FU_VOLUME_CONTROL : audio_desc.h, audio_hid_desc.h
  • AUDIO_INPUT_TERMINAL_MICROPHONE : audio_desc.h, audio_hid_desc.h
  • AUDIO_INPUT_TERMINAL_SIZE : audio_desc.h, audio_hid_desc.h
  • AUDIO_INPUT_TERMINAL_UNDEFINED : audio_desc.h, audio_hid_desc.h
  • AUDIO_INTERFACE_LEN : audio_desc.h, audio_hid_desc.h
  • AUDIO_INTERFACE_NUM : audio_desc.h, audio_hid_desc.h
  • AUDIO_MIC_BITW : audio_desc.h, audio_hid_desc.h
  • AUDIO_MIC_CHANEL_NUM : audio/audio_conf.h, audio_hid/audio_conf.h
  • AUDIO_MIC_CHR : audio_desc.h, audio_hid_desc.h
  • AUDIO_MIC_DEFAULT_BITW : audio/audio_conf.h, audio_hid/audio_conf.h
  • AUDIO_MIC_FEATURE_UNIT_ID : audio_desc.h, audio_hid_desc.h
  • AUDIO_MIC_FREQ_SIZE : audio_desc.h, audio_hid_desc.h
  • AUDIO_MIC_IN_MAXPACKET_SIZE : audio_class.h, audio_hid_class.h
  • AUDIO_MIC_INPUT_TERMINAL_ID : audio_desc.h, audio_hid_desc.h
  • AUDIO_MIC_INTERFACE : audio_desc.h, audio_hid_desc.h
  • AUDIO_MIC_INTERFACE_NUMBER : audio_desc.h, audio_hid_desc.h
  • AUDIO_MIC_OUTPUT_TERMINAL_ID : audio_desc.h, audio_hid_desc.h
  • AUDIO_MUTE_CONTROL : audio_class.h, audio_hid_class.h
  • AUDIO_OUTPUT_TERMINAL_SIZE : audio_desc.h, audio_hid_desc.h
  • AUDIO_OUTPUT_TERMINAL_SPEAKER : audio_desc.h, audio_hid_desc.h
  • AUDIO_OUTPUT_TERMINAL_UNDEFINED : audio_desc.h, audio_hid_desc.h
  • AUDIO_PROTOCOL_UNDEFINED : audio_desc.h, audio_hid_desc.h
  • AUDIO_REMAIN_SIZE : audio_class.h, audio_hid_class.h
  • AUDIO_REQ_CONTROL_ENDPOINT : audio_class.h, audio_hid_class.h
  • AUDIO_REQ_CONTROL_INTERFACE : audio_class.h, audio_hid_class.h
  • AUDIO_REQ_CONTROL_MASK : audio_class.h, audio_hid_class.h
  • AUDIO_REQ_GET_CUR : audio_desc.h, audio_hid_desc.h
  • AUDIO_REQ_GET_MAX : audio_desc.h, audio_hid_desc.h
  • AUDIO_REQ_GET_MEM : audio_desc.h, audio_hid_desc.h
  • AUDIO_REQ_GET_MIN : audio_desc.h, audio_hid_desc.h
  • AUDIO_REQ_GET_RES : audio_desc.h, audio_hid_desc.h
  • AUDIO_REQ_GET_STAT : audio_desc.h, audio_hid_desc.h
  • AUDIO_REQ_SET_CUR : audio_desc.h, audio_hid_desc.h
  • AUDIO_REQ_SET_MAX : audio_desc.h, audio_hid_desc.h
  • AUDIO_REQ_SET_MEM : audio_desc.h, audio_hid_desc.h
  • AUDIO_REQ_SET_MIN : audio_desc.h, audio_hid_desc.h
  • AUDIO_REQ_SET_RES : audio_desc.h, audio_hid_desc.h
  • AUDIO_REQUEST_CODE_UNDEFINED : audio_desc.h, audio_hid_desc.h
  • AUDIO_SAMPLING_FREQ_CONTROL : audio_class.h, audio_hid_class.h
  • AUDIO_SPK_BITW : audio_desc.h, audio_hid_desc.h
  • AUDIO_SPK_CHANEL_NUM : audio/audio_conf.h, audio_hid/audio_conf.h
  • AUDIO_SPK_CHR : audio_desc.h, audio_hid_desc.h
  • AUDIO_SPK_DEFAULT_BITW : audio/audio_conf.h, audio_hid/audio_conf.h
  • AUDIO_SPK_FEATURE_UNIT_ID : audio_desc.h, audio_hid_desc.h
  • AUDIO_SPK_FREQ_SIZE : audio_desc.h, audio_hid_desc.h
  • AUDIO_SPK_INPUT_TERMINAL_ID : audio_desc.h, audio_hid_desc.h
  • AUDIO_SPK_INTERFACE : audio_desc.h, audio_hid_desc.h
  • AUDIO_SPK_INTERFACE_NUMBER : audio_desc.h, audio_hid_desc.h
  • AUDIO_SPK_OUT_MAXPACKET_SIZE : audio_class.h, audio_hid_class.h
  • AUDIO_SPK_OUTPUT_TERMINAL_ID : audio_desc.h, audio_hid_desc.h
  • AUDIO_SUBCLASS_AUDIOCONTROL : audio_desc.h, audio_hid_desc.h
  • AUDIO_SUBCLASS_AUDIOSTREAMING : audio_desc.h, audio_hid_desc.h
  • AUDIO_SUBCLASS_MIDISTREMING : audio_desc.h, audio_hid_desc.h
  • AUDIO_SUBCLASS_UNDEFINED : audio_desc.h, audio_hid_desc.h
  • AUDIO_SUPPORT_FEEDBACK : audio/audio_conf.h, audio_hid/audio_conf.h
  • AUDIO_SUPPORT_FREQ : audio/audio_conf.h, audio_hid/audio_conf.h
  • AUDIO_SUPPORT_FREQ_16K : audio/audio_conf.h, audio_hid/audio_conf.h
  • AUDIO_SUPPORT_FREQ_48K : audio/audio_conf.h, audio_hid/audio_conf.h
  • AUDIO_SUPPORT_MAX_FREQ : audio/audio_conf.h, audio_hid/audio_conf.h
  • AUDIO_SUPPORT_MIC : audio/audio_conf.h, audio_hid/audio_conf.h
  • AUDIO_SUPPORT_SPK : audio/audio_conf.h, audio_hid/audio_conf.h
  • AUDIO_TERMINAL_TYPE_STREAMING : audio_desc.h, audio_hid_desc.h
  • AUDIO_TERMINAL_TYPE_UNDEFINED : audio_desc.h, audio_hid_desc.h
  • AUDIO_TERMINAL_TYPE_VENDOR : audio_desc.h, audio_hid_desc.h
  • AUDIO_VOLUME_CONTROL : audio_class.h, audio_hid_class.h
  • AUHID_BCD_NUM : audio_hid_desc.h
  • AUHID_HID_BCD_NUM : audio_hid_desc.h
  • AUHID_HID_BINTERVAL_TIME : audio_hid_desc.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all macros with links to the files they belong to:

- b -

  • BLK2 : at32f413_usb.h
  • BLK32 : at32f413_usb.h
  • BLOCK_SIZE : project/at_start_f413/examples/sdio/emmc_card/src/main.c, project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c, fir_filter.c
  • BLOCKS_NUMBER : project/at_start_f413/examples/sdio/emmc_card/src/main.c, project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c
  • BPR : at32f413_bpr.h
  • BPR_BASE : at32f413.h
  • BPR_DR_NUMBER : project/at_start_f413/examples/bpr/bpr_data/src/main.c, project/at_start_f413/examples/bpr/tamper/src/main.c
  • BPR_MODULE_ENABLED : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • BPR_TAMPER_EVENT_FLAG : at32f413_bpr.h
  • BPR_TAMPER_INTERRUPT_FLAG : at32f413_bpr.h
  • BUF_SIZE : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/communication_int/src/main.c, project/at_start_f413/examples/i2c/communication_poll/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c, project/at_start_f413/examples/spi/w25q_flash/src/main.c
  • BUFFER_SIZE : project/at_start_f413/examples/crc/calculation/src/main.c, project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c, project/at_start_f413/examples/dma/flash_to_sram/src/main.c, project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/fullduplex_polling/src/main.c, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c, project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c, project/at_start_f413/examples/usart/hw_flow_control/src/main.c, project/at_start_f413/examples/usart/receiver_mute/src/main.c
  • BUTTON_RELEASE : mouse_class.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all macros with links to the files they belong to:

- c -

  • CAN1 : at32f413_can.h
  • CAN1_BASE : at32f413.h
  • CAN1_GMUX_0010 : at32f413_gpio.h
  • CAN2_BASE : at32f413.h
  • CAN2_GMUX_0001 : at32f413_gpio.h
  • CAN_BOF_FLAG : at32f413_can.h
  • CAN_BOIEN_INT : at32f413_can.h
  • CAN_EAF_FLAG : at32f413_can.h
  • CAN_EAIEN_INT : at32f413_can.h
  • CAN_EDZC_FLAG : at32f413_can.h
  • CAN_EDZIEN_INT : at32f413_can.h
  • CAN_EOIEN_INT : at32f413_can.h
  • CAN_EOIF_FLAG : at32f413_can.h
  • CAN_EPF_FLAG : at32f413_can.h
  • CAN_EPIEN_INT : at32f413_can.h
  • CAN_ETR_FLAG : at32f413_can.h
  • CAN_ETRIEN_INT : at32f413_can.h
  • CAN_MODULE_ENABLED : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • CAN_MSTS_EDZIF_VAL : at32f413_can.h
  • CAN_MSTS_EOIF_VAL : at32f413_can.h
  • CAN_MSTS_QDZIF_VAL : at32f413_can.h
  • CAN_MUX_10 : at32f413_gpio.h
  • CAN_QDZIEN_INT : at32f413_can.h
  • CAN_QDZIF_FLAG : at32f413_can.h
  • CAN_RF0_RF0FF_VAL : at32f413_can.h
  • CAN_RF0_RF0OF_VAL : at32f413_can.h
  • CAN_RF0_RF0R_VAL : at32f413_can.h
  • CAN_RF0FF_FLAG : at32f413_can.h
  • CAN_RF0FIEN_INT : at32f413_can.h
  • CAN_RF0MIEN_INT : at32f413_can.h
  • CAN_RF0MN_FLAG : at32f413_can.h
  • CAN_RF0OF_FLAG : at32f413_can.h
  • CAN_RF0OIEN_INT : at32f413_can.h
  • CAN_RF1_RF1FF_VAL : at32f413_can.h
  • CAN_RF1_RF1OF_VAL : at32f413_can.h
  • CAN_RF1_RF1R_VAL : at32f413_can.h
  • CAN_RF1FF_FLAG : at32f413_can.h
  • CAN_RF1FIEN_INT : at32f413_can.h
  • CAN_RF1MIEN_INT : at32f413_can.h
  • CAN_RF1MN_FLAG : at32f413_can.h
  • CAN_RF1OF_FLAG : at32f413_can.h
  • CAN_RF1OIEN_INT : at32f413_can.h
  • CAN_TCIEN_INT : at32f413_can.h
  • CAN_TM0TCF_FLAG : at32f413_can.h
  • CAN_TM1TCF_FLAG : at32f413_can.h
  • CAN_TM2TCF_FLAG : at32f413_can.h
  • CAN_TMEF_FLAG : at32f413_can.h
  • CAN_TSTS_TM0CT_VAL : at32f413_can.h
  • CAN_TSTS_TM0TCF_VAL : at32f413_can.h
  • CAN_TSTS_TM1CT_VAL : at32f413_can.h
  • CAN_TSTS_TM1TCF_VAL : at32f413_can.h
  • CAN_TSTS_TM2CT_VAL : at32f413_can.h
  • CAN_TSTS_TM2TCF_VAL : at32f413_can.h
  • CBW_BMCBWFLAGS_DIR_IN : cdc_msc_class.h, msc_bot_scsi.h
  • CBW_BMCBWFLAGS_DIR_OUT : cdc_msc_class.h, msc_bot_scsi.h
  • CBW_CMD_LENGTH : cdc_msc_class.h, msc_bot_scsi.h
  • CBW_DCBWSIGNATURE : cdc_msc_class.h, msc_bot_scsi.h
  • CDC_BCD_NUM : cdc_desc.h, cdc_msc_desc.h
  • CDC_HID_BINTERVAL_TIME : cdc_desc.h, cdc_msc_desc.h
  • configASSERT : FreeRTOSConfig.h
  • configCPU_CLOCK_HZ : FreeRTOSConfig.h
  • configIDLE_SHOULD_YIELD : FreeRTOSConfig.h
  • configKERNEL_INTERRUPT_PRIORITY : FreeRTOSConfig.h
  • configLIBRARY_LOWEST_INTERRUPT_PRIORITY : FreeRTOSConfig.h
  • configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY : FreeRTOSConfig.h
  • configMAX_CO_ROUTINE_PRIORITIES : FreeRTOSConfig.h
  • configMAX_PRIORITIES : FreeRTOSConfig.h
  • configMAX_SYSCALL_INTERRUPT_PRIORITY : FreeRTOSConfig.h
  • configMAX_TASK_NAME_LEN : FreeRTOSConfig.h
  • configMINIMAL_STACK_SIZE : FreeRTOSConfig.h
  • configPRIO_BITS : FreeRTOSConfig.h
  • configSUPPORT_DYNAMIC_ALLOCATION : FreeRTOSConfig.h
  • configTICK_RATE_HZ : FreeRTOSConfig.h
  • configTOTAL_HEAP_SIZE : FreeRTOSConfig.h
  • configUSE_16_BIT_TICKS : FreeRTOSConfig.h
  • configUSE_CO_ROUTINES : FreeRTOSConfig.h
  • configUSE_IDLE_HOOK : FreeRTOSConfig.h
  • configUSE_PREEMPTION : FreeRTOSConfig.h
  • configUSE_TICK_HOOK : FreeRTOSConfig.h
  • CONVERT_ENDIAN : hid_iap_class.h
  • COUNTOF : project/at_start_f413/examples/usart/half_duplex/src/main.c, project/at_start_f413/examples/usart/interrupt/src/main.c, project/at_start_f413/examples/usart/polling/src/main.c, project/at_start_f413/examples/usart/synchronous/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c
  • CRC : at32f413_crc.h
  • CRC_BASE : at32f413.h
  • CRC_MODULE_ENABLED : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • CRM : at32f413_crm.h
  • CRM_ALL_RESET_FLAG : at32f413_crm.h
  • CRM_BASE : at32f413.h
  • CRM_CLOCK_FAILURE_INT : at32f413_crm.h
  • CRM_CLOCK_FAILURE_INT_FLAG : at32f413_crm.h
  • CRM_HEXT_READY_INT_FLAG : at32f413_crm.h
  • CRM_HEXT_STABLE_FLAG : at32f413_crm.h
  • CRM_HEXT_STABLE_INT : at32f413_crm.h
  • CRM_HICK_READY_INT_FLAG : at32f413_crm.h
  • CRM_HICK_STABLE_FLAG : at32f413_crm.h
  • CRM_HICK_STABLE_INT : at32f413_crm.h
  • CRM_LEXT_READY_INT_FLAG : at32f413_crm.h
  • CRM_LEXT_STABLE_FLAG : at32f413_crm.h
  • CRM_LEXT_STABLE_INT : at32f413_crm.h
  • CRM_LICK_READY_INT_FLAG : at32f413_crm.h
  • CRM_LICK_STABLE_FLAG : at32f413_crm.h
  • CRM_LICK_STABLE_INT : at32f413_crm.h
  • CRM_LOWPOWER_RESET_FLAG : at32f413_crm.h
  • CRM_MODULE_ENABLED : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • CRM_NRST_RESET_FLAG : at32f413_crm.h
  • CRM_PLL_READY_INT_FLAG : at32f413_crm.h
  • CRM_PLL_STABLE_FLAG : at32f413_crm.h
  • CRM_PLL_STABLE_INT : at32f413_crm.h
  • CRM_POR_RESET_FLAG : at32f413_crm.h
  • CRM_REG : at32f413_crm.h
  • CRM_REG_BIT : at32f413_crm.h
  • CRM_SW_RESET_FLAG : at32f413_crm.h
  • CRM_WDT_RESET_FLAG : at32f413_crm.h
  • CRM_WWDT_RESET_FLAG : at32f413_crm.h
  • CSW_BCSWSTATUS_FAILED : cdc_msc_class.h, msc_bot_scsi.h
  • CSW_BCSWSTATUS_PASS : cdc_msc_class.h, msc_bot_scsi.h
  • CSW_BCSWSTATUS_PHASE_ERR : cdc_msc_class.h, msc_bot_scsi.h
  • CSW_CMD_LENGTH : cdc_msc_class.h, msc_bot_scsi.h
  • CSW_DCSWSIGNATURE : cdc_msc_class.h, msc_bot_scsi.h
  • CUSHID_BCD_NUM : custom_hid_desc.h
  • CUSHID_BINTERVAL_TIME : custom_hid_desc.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all macros with links to the files they belong to:

- d -

  • DATA1_VAL : project/at_start_f413/examples/usart/receiver_mute/src/main.c
  • DATA2_VAL : project/at_start_f413/examples/usart/receiver_mute/src/main.c
  • DATA3_VAL : project/at_start_f413/examples/usart/receiver_mute/src/main.c
  • DATA4_VAL : project/at_start_f413/examples/usart/receiver_mute/src/main.c
  • DEBUG_BASE : at32f413.h
  • DEBUG_CAN1_PAUSE : at32f413_debug.h
  • DEBUG_CAN2_PAUSE : at32f413_debug.h
  • DEBUG_DEEPSLEEP : at32f413_debug.h
  • DEBUG_I2C1_SMBUS_TIMEOUT : at32f413_debug.h
  • DEBUG_I2C2_SMBUS_TIMEOUT : at32f413_debug.h
  • DEBUG_MODULE_ENABLED : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • DEBUG_SLEEP : at32f413_debug.h
  • DEBUG_STANDBY : at32f413_debug.h
  • DEBUG_TMR10_PAUSE : at32f413_debug.h
  • DEBUG_TMR11_PAUSE : at32f413_debug.h
  • DEBUG_TMR1_PAUSE : at32f413_debug.h
  • DEBUG_TMR2_PAUSE : at32f413_debug.h
  • DEBUG_TMR3_PAUSE : at32f413_debug.h
  • DEBUG_TMR4_PAUSE : at32f413_debug.h
  • DEBUG_TMR5_PAUSE : at32f413_debug.h
  • DEBUG_TMR8_PAUSE : at32f413_debug.h
  • DEBUG_TMR9_PAUSE : at32f413_debug.h
  • DEBUG_WDT_PAUSE : at32f413_debug.h
  • DEBUG_WWDT_PAUSE : at32f413_debug.h
  • DEBUGMCU : at32f413_debug.h
  • DELAY : project/at_start_f413/examples/cortex_m4/systick_interrupt/src/main.c, project/at_start_f413/templates/src/main.c
  • DEV_MMC : diskio.c
  • DEV_RAM : diskio.c
  • DEV_USB : diskio.c
  • DEVICE_ID_ADDR1 : random.c
  • DMA1 : at32f413_dma.h
  • DMA1_BASE : at32f413.h
  • DMA1_CHANNEL1 : at32f413_dma.h
  • DMA1_CHANNEL1_BASE : at32f413.h
  • DMA1_CHANNEL2 : at32f413_dma.h
  • DMA1_CHANNEL2_BASE : at32f413.h
  • DMA1_CHANNEL3 : at32f413_dma.h
  • DMA1_CHANNEL3_BASE : at32f413.h
  • DMA1_CHANNEL4 : at32f413_dma.h
  • DMA1_CHANNEL4_BASE : at32f413.h
  • DMA1_CHANNEL5 : at32f413_dma.h
  • DMA1_CHANNEL5_BASE : at32f413.h
  • DMA1_CHANNEL6 : at32f413_dma.h
  • DMA1_CHANNEL6_BASE : at32f413.h
  • DMA1_CHANNEL7 : at32f413_dma.h
  • DMA1_CHANNEL7_BASE : at32f413.h
  • DMA1_DTERR1_FLAG : at32f413_dma.h
  • DMA1_DTERR2_FLAG : at32f413_dma.h
  • DMA1_DTERR3_FLAG : at32f413_dma.h
  • DMA1_DTERR4_FLAG : at32f413_dma.h
  • DMA1_DTERR5_FLAG : at32f413_dma.h
  • DMA1_DTERR6_FLAG : at32f413_dma.h
  • DMA1_DTERR7_FLAG : at32f413_dma.h
  • DMA1_FDT1_FLAG : at32f413_dma.h
  • DMA1_FDT2_FLAG : at32f413_dma.h
  • DMA1_FDT3_FLAG : at32f413_dma.h
  • DMA1_FDT4_FLAG : at32f413_dma.h
  • DMA1_FDT5_FLAG : at32f413_dma.h
  • DMA1_FDT6_FLAG : at32f413_dma.h
  • DMA1_FDT7_FLAG : at32f413_dma.h
  • DMA1_GL1_FLAG : at32f413_dma.h
  • DMA1_GL2_FLAG : at32f413_dma.h
  • DMA1_GL3_FLAG : at32f413_dma.h
  • DMA1_GL4_FLAG : at32f413_dma.h
  • DMA1_GL5_FLAG : at32f413_dma.h
  • DMA1_GL6_FLAG : at32f413_dma.h
  • DMA1_GL7_FLAG : at32f413_dma.h
  • DMA1_HDT1_FLAG : at32f413_dma.h
  • DMA1_HDT2_FLAG : at32f413_dma.h
  • DMA1_HDT3_FLAG : at32f413_dma.h
  • DMA1_HDT4_FLAG : at32f413_dma.h
  • DMA1_HDT5_FLAG : at32f413_dma.h
  • DMA1_HDT6_FLAG : at32f413_dma.h
  • DMA1_HDT7_FLAG : at32f413_dma.h
  • DMA2 : at32f413_dma.h
  • DMA2_BASE : at32f413.h
  • DMA2_CHANNEL1 : at32f413_dma.h
  • DMA2_CHANNEL1_BASE : at32f413.h
  • DMA2_CHANNEL2 : at32f413_dma.h
  • DMA2_CHANNEL2_BASE : at32f413.h
  • DMA2_CHANNEL3 : at32f413_dma.h
  • DMA2_CHANNEL3_BASE : at32f413.h
  • DMA2_CHANNEL4 : at32f413_dma.h
  • DMA2_CHANNEL4_BASE : at32f413.h
  • DMA2_CHANNEL5 : at32f413_dma.h
  • DMA2_CHANNEL5_BASE : at32f413.h
  • DMA2_CHANNEL6 : at32f413_dma.h
  • DMA2_CHANNEL6_BASE : at32f413.h
  • DMA2_CHANNEL7 : at32f413_dma.h
  • DMA2_CHANNEL7_BASE : at32f413.h
  • DMA2_DTERR1_FLAG : at32f413_dma.h
  • DMA2_DTERR2_FLAG : at32f413_dma.h
  • DMA2_DTERR3_FLAG : at32f413_dma.h
  • DMA2_DTERR4_FLAG : at32f413_dma.h
  • DMA2_DTERR5_FLAG : at32f413_dma.h
  • DMA2_DTERR6_FLAG : at32f413_dma.h
  • DMA2_DTERR7_FLAG : at32f413_dma.h
  • DMA2_FDT1_FLAG : at32f413_dma.h
  • DMA2_FDT2_FLAG : at32f413_dma.h
  • DMA2_FDT3_FLAG : at32f413_dma.h
  • DMA2_FDT4_FLAG : at32f413_dma.h
  • DMA2_FDT5_FLAG : at32f413_dma.h
  • DMA2_FDT6_FLAG : at32f413_dma.h
  • DMA2_FDT7_FLAG : at32f413_dma.h
  • DMA2_GL1_FLAG : at32f413_dma.h
  • DMA2_GL2_FLAG : at32f413_dma.h
  • DMA2_GL3_FLAG : at32f413_dma.h
  • DMA2_GL4_FLAG : at32f413_dma.h
  • DMA2_GL5_FLAG : at32f413_dma.h
  • DMA2_GL6_FLAG : at32f413_dma.h
  • DMA2_GL7_FLAG : at32f413_dma.h
  • DMA2_HDT1_FLAG : at32f413_dma.h
  • DMA2_HDT2_FLAG : at32f413_dma.h
  • DMA2_HDT3_FLAG : at32f413_dma.h
  • DMA2_HDT4_FLAG : at32f413_dma.h
  • DMA2_HDT5_FLAG : at32f413_dma.h
  • DMA2_HDT6_FLAG : at32f413_dma.h
  • DMA2_HDT7_FLAG : at32f413_dma.h
  • DMA_BUFFER_SIZE : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • DMA_DTERR_INT : at32f413_dma.h
  • DMA_FDT_INT : at32f413_dma.h
  • DMA_GET_HT_FLAG : i2c_application.c
  • DMA_GET_TC_FLAG : i2c_application.c
  • DMA_GET_TERR_FLAG : i2c_application.c
  • DMA_HDT_INT : at32f413_dma.h
  • DMA_MODULE_ENABLED : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • DOWN_MOVE : mouse_class.h
  • DUMMY_NOP : system_at32f413.h
  • DYMMY_BYTE : project/at_start_f413/examples/usart/synchronous/src/main.c
  • DZC_TIMEOUT : at32f413_can.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all macros with links to the files they belong to:

- e -

  • EEPROM_BUSY_TIMEOUT : eeprom.h
  • EEPROM_I2C_ADDRESS : eeprom.h
  • EEPROM_PAGE_SIZE : eeprom.h
  • ENABLE_RTC_ASSEED : random.h
  • EPT0_RX_ADDR : project/at_start_f413/examples/acc/calibration/inc/usb_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h
  • EPT0_TX_ADDR : project/at_start_f413/examples/acc/calibration/inc/usb_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h
  • EPT1_RX_ADDR : project/at_start_f413/examples/acc/calibration/inc/usb_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h
  • EPT1_TX_ADDR : project/at_start_f413/examples/acc/calibration/inc/usb_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h
  • EPT2_RX_ADDR : project/at_start_f413/examples/acc/calibration/inc/usb_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h
  • EPT2_TX_ADDR : project/at_start_f413/examples/acc/calibration/inc/usb_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h
  • EPT3_RX_ADDR : project/at_start_f413/examples/acc/calibration/inc/usb_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h
  • EPT3_TX_ADDR : project/at_start_f413/examples/acc/calibration/inc/usb_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h
  • EPT4_RX_ADDR : project/at_start_f413/examples/acc/calibration/inc/usb_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h
  • EPT4_TX_ADDR : project/at_start_f413/examples/acc/calibration/inc/usb_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h
  • EPT5_RX_ADDR : project/at_start_f413/examples/acc/calibration/inc/usb_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h
  • EPT5_TX_ADDR : project/at_start_f413/examples/acc/calibration/inc/usb_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h
  • EPT6_RX_ADDR : project/at_start_f413/examples/acc/calibration/inc/usb_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h
  • EPT6_TX_ADDR : project/at_start_f413/examples/acc/calibration/inc/usb_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h
  • EPT7_RX_ADDR : project/at_start_f413/examples/acc/calibration/inc/usb_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h
  • EPT7_TX_ADDR : project/at_start_f413/examples/acc/calibration/inc/usb_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h
  • ERASE_TIMEOUT : at32f413_flash.h
  • ERROR_ID_VAL : project/at_start_f413/examples/usart/receiver_mute/src/main.c
  • EXINT : at32f413_exint.h
  • EXINT_BASE : at32f413.h
  • EXINT_LINE_0 : at32f413_exint.h
  • EXINT_LINE_1 : at32f413_exint.h
  • EXINT_LINE_10 : at32f413_exint.h
  • EXINT_LINE_11 : at32f413_exint.h
  • EXINT_LINE_12 : at32f413_exint.h
  • EXINT_LINE_13 : at32f413_exint.h
  • EXINT_LINE_14 : at32f413_exint.h
  • EXINT_LINE_15 : at32f413_exint.h
  • EXINT_LINE_16 : at32f413_exint.h
  • EXINT_LINE_17 : at32f413_exint.h
  • EXINT_LINE_18 : at32f413_exint.h
  • EXINT_LINE_2 : at32f413_exint.h
  • EXINT_LINE_3 : at32f413_exint.h
  • EXINT_LINE_4 : at32f413_exint.h
  • EXINT_LINE_5 : at32f413_exint.h
  • EXINT_LINE_6 : at32f413_exint.h
  • EXINT_LINE_7 : at32f413_exint.h
  • EXINT_LINE_8 : at32f413_exint.h
  • EXINT_LINE_9 : at32f413_exint.h
  • EXINT_LINE_NONE : at32f413_exint.h
  • EXINT_MODULE_ENABLED : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • EXT_CSD_BUS_WIDTH : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • EXT_CSD_Clear_byte : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • EXT_CSD_CMD_SET_CPSECURE : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • EXT_CSD_CMD_SET_NORMAL : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • EXT_CSD_CMD_SET_SECURE : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • EXT_CSD_Command_set : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • EXT_CSD_HS_TIMING : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • EXT_CSD_Set_bit : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • EXT_CSD_Write_byte : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • EXT_SPIM_EN_MUX : at32f413_gpio.h
  • EXT_SPIM_GMUX_1000 : at32f413_gpio.h
  • EXT_SPIM_GMUX_1001 : at32f413_gpio.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all macros with links to the files they belong to:

- f -

  • FAP_RELIEVE_KEY : at32f413_flash.h
  • FAST : project/at_start_f413/templates/src/main.c
  • FAT16_BYTE_PER_SIZE : flash_fat16.h
  • FAT16_CLUSTER_SIZE : flash_fat16.c
  • FAT16_DIR_SIZE : flash_fat16.h
  • FAT16_FILENAME_SIZE : flash_fat16.h
  • FAT16_FIRST_CLUSTER : flash_fat16.c
  • FAT16_SECTOR_SIZE : flash_fat16.h, flash_fat16.c
  • FAT16_TABLE_SIZE : flash_fat16.h
  • FEEDBACK_REFRESH_TIME : audio_class.h, audio_hid_class.h
  • FF_CODE_PAGE : ffconf.h
  • FF_FS_EXFAT : ffconf.h
  • FF_FS_LOCK : ffconf.h
  • FF_FS_MINIMIZE : ffconf.h
  • FF_FS_NOFSINFO : ffconf.h
  • FF_FS_NORTC : ffconf.h
  • FF_FS_READONLY : ffconf.h
  • FF_FS_REENTRANT : ffconf.h
  • FF_FS_RPATH : ffconf.h
  • FF_FS_TIMEOUT : ffconf.h
  • FF_FS_TINY : ffconf.h
  • FF_LBA64 : ffconf.h
  • FF_LFN_BUF : ffconf.h
  • FF_LFN_UNICODE : ffconf.h
  • FF_MAX_LFN : ffconf.h
  • FF_MAX_SS : ffconf.h
  • FF_MIN_GPT : ffconf.h
  • FF_MIN_SS : ffconf.h
  • FF_MULTI_PARTITION : ffconf.h
  • FF_NORTC_MDAY : ffconf.h
  • FF_NORTC_MON : ffconf.h
  • FF_NORTC_YEAR : ffconf.h
  • FF_PRINT_FLOAT : ffconf.h
  • FF_PRINT_LLI : ffconf.h
  • FF_SFN_BUF : ffconf.h
  • FF_STR_VOLUME_ID : ffconf.h
  • FF_STRF_ENCODE : ffconf.h
  • FF_SYNC_t : ffconf.h
  • FF_USE_CHMOD : ffconf.h
  • FF_USE_EXPAND : ffconf.h
  • FF_USE_FASTSEEK : ffconf.h
  • FF_USE_FIND : ffconf.h
  • FF_USE_FORWARD : ffconf.h
  • FF_USE_LABEL : ffconf.h
  • FF_USE_LFN : ffconf.h
  • FF_USE_MKFS : ffconf.h
  • FF_USE_STRFUNC : ffconf.h
  • FF_USE_TRIM : ffconf.h
  • FF_VOLUME_STRS : ffconf.h
  • FF_VOLUMES : ffconf.h
  • FFCONF_DEF : ffconf.h
  • FILE_SUFFIX1_LEN : flash_fat16.h
  • FILE_SUFFIX1_NAME : flash_fat16.h
  • FILE_SUFFIX2_LEN : flash_fat16.h
  • FILE_SUFFIX2_NAME : flash_fat16.h
  • FILTER_EXT_ID1 : project/at_start_f413/examples/can/filter/src/main.c
  • FILTER_EXT_ID2 : project/at_start_f413/examples/can/filter/src/main.c
  • FILTER_EXT_ID3 : project/at_start_f413/examples/can/filter/src/main.c
  • FILTER_STD_ID1 : project/at_start_f413/examples/can/filter/src/main.c
  • FILTER_STD_ID2 : project/at_start_f413/examples/can/filter/src/main.c
  • FILTER_STD_ID3 : project/at_start_f413/examples/can/filter/src/main.c
  • FLASH : at32f413_flash.h
  • FLASH_APP_ADDRESS : app_led3_toggle/inc/hid_iap_user.h, app_led4_toggle/inc/hid_iap_user.h, bootloader/inc/hid_iap_user.h
  • FLASH_APP_START_ADDR : flash_fat16.h
  • FLASH_BASE : at32f413.h
  • FLASH_CS_HIGH : spi_flash.h
  • FLASH_CS_LOW : spi_flash.h
  • FLASH_EPPERR_FLAG : at32f413_flash.h
  • FLASH_ERR_INT : at32f413_flash.h
  • FLASH_FAT16_1_ADDR : flash_fat16.h
  • FLASH_FAT16_2_ADDR : flash_fat16.h
  • FLASH_FAT16_BOOT_SECTOR_ADDR : flash_fat16.h
  • FLASH_FAT16_FILE_START_ADDR : flash_fat16.h
  • FLASH_FAT16_ROOT_ADDR : flash_fat16.h
  • FLASH_MODULE_ENABLED : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • FLASH_OBF_FLAG : at32f413_flash.h
  • FLASH_ODF_FLAG : at32f413_flash.h
  • FLASH_ODF_INT : at32f413_flash.h
  • FLASH_PRGMERR_FLAG : at32f413_flash.h
  • FLASH_REG_BASE : at32f413.h
  • FLASH_SECTOR_1K_ALLGNED : flash_fat16.h
  • FLASH_SECTOR_1K_SIZE : flash_fat16.h
  • FLASH_SECTOR_2K_ALLGNED : flash_fat16.h
  • FLASH_SECTOR_2K_SIZE : flash_fat16.h
  • FLASH_SECTOR_4K_ALLGNED : flash_fat16.h
  • FLASH_SECTOR_4K_SIZE : flash_fat16.h
  • FLASH_SECTOR_SIZE : utilities/at32f413_slib_demo/project_l0/src/main.c
  • FLASH_SIZE : utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/flash.h
  • FLASH_SIZE_REG : hid_iap_class.h
  • FLASH_SLIB_DATA_START_SECTOR : at32f413_flash.h
  • FLASH_SLIB_END_SECTOR : at32f413_flash.h
  • FLASH_SLIB_START_SECTOR : at32f413_flash.h
  • FLASH_SPI_DUMMY_BYTE : spi_flash.h
  • FLASH_SPIM_EPPERR_FLAG : at32f413_flash.h
  • FLASH_SPIM_ERR_INT : at32f413_flash.h
  • FLASH_SPIM_OBF_FLAG : at32f413_flash.h
  • FLASH_SPIM_ODF_FLAG : at32f413_flash.h
  • FLASH_SPIM_ODF_INT : at32f413_flash.h
  • FLASH_SPIM_PRGMERR_FLAG : at32f413_flash.h
  • FLASH_SPIM_START_ADDR : at32f413_flash.h
  • FLASH_START_ADDR : utilities/at32f413_slib_demo/project_l0/src/main.c
  • FLASH_TEST_ADDR : project/at_start_f413/examples/spi/w25q_flash/src/main.c
  • FLASH_UNLOCK_KEY1 : at32f413_flash.h
  • FLASH_UNLOCK_KEY2 : at32f413_flash.h
  • FLASH_USDERR_FLAG : at32f413_flash.h
  • FLEX_CHANNEL1 : at32f413_dma.h
  • FLEX_CHANNEL2 : at32f413_dma.h
  • FLEX_CHANNEL3 : at32f413_dma.h
  • FLEX_CHANNEL4 : at32f413_dma.h
  • FLEX_CHANNEL5 : at32f413_dma.h
  • FLEX_CHANNEL6 : at32f413_dma.h
  • FLEX_CHANNEL7 : at32f413_dma.h
  • FZC_TIMEOUT : at32f413_can.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all macros with links to the files they belong to:

- g -

  • GET_LINE_CODING : cdc_msc_class.h, msc_bot_scsi.h, usb_std.h
  • GET_RX_LEN_ADDR : at32f413_usb.h
  • GET_TX_LEN_ADDR : at32f413_usb.h
  • GPIO_MODULE_ENABLED : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • GPIO_PINS_0 : at32f413_gpio.h
  • GPIO_PINS_1 : at32f413_gpio.h
  • GPIO_PINS_10 : at32f413_gpio.h
  • GPIO_PINS_11 : at32f413_gpio.h
  • GPIO_PINS_12 : at32f413_gpio.h
  • GPIO_PINS_13 : at32f413_gpio.h
  • GPIO_PINS_14 : at32f413_gpio.h
  • GPIO_PINS_15 : at32f413_gpio.h
  • GPIO_PINS_2 : at32f413_gpio.h
  • GPIO_PINS_3 : at32f413_gpio.h
  • GPIO_PINS_4 : at32f413_gpio.h
  • GPIO_PINS_5 : at32f413_gpio.h
  • GPIO_PINS_6 : at32f413_gpio.h
  • GPIO_PINS_7 : at32f413_gpio.h
  • GPIO_PINS_8 : at32f413_gpio.h
  • GPIO_PINS_9 : at32f413_gpio.h
  • GPIO_PINS_ALL : at32f413_gpio.h
  • GPIOA : at32f413_gpio.h
  • GPIOA_BASE : at32f413.h
  • GPIOB : at32f413_gpio.h
  • GPIOB_BASE : at32f413.h
  • GPIOC : at32f413_gpio.h
  • GPIOC_BASE : at32f413.h
  • GPIOD : at32f413_gpio.h
  • GPIOD_BASE : at32f413.h
  • GPIOF : at32f413_gpio.h
  • GPIOF_BASE : at32f413.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all macros with links to the files they belong to:

- h -

  • HBYTE : usb_std.h
  • HEXT_STABLE_DELAY : system_at32f413.h
  • HEXT_STARTUP_TIMEOUT : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • HEXT_VALUE : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • HICK_VALUE : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • HID_CLASS_DESC_HID : audio_hid_desc.h, usb_std.h
  • HID_CLASS_DESC_PHYSICAL : audio_hid_desc.h, usb_std.h
  • HID_CLASS_DESC_REPORT : audio_hid_desc.h, usb_std.h
  • HID_DESCRIPTOR_TYPE : usb_std.h
  • HID_IAP_BUFFER_LEN : hid_iap_class.h
  • HID_INTERFACE_NUMBER : audio_hid_desc.h
  • HID_REPORT_DESC : usb_std.h
  • HID_REPORT_ID_1 : audio_hid_desc.h, custom_hid_desc.h
  • HID_REPORT_ID_2 : audio_hid_desc.h, custom_hid_desc.h
  • HID_REPORT_ID_3 : audio_hid_desc.h, custom_hid_desc.h
  • HID_REPORT_ID_4 : audio_hid_desc.h, custom_hid_desc.h
  • HID_REPORT_ID_5 : audio_hid_desc.h, custom_hid_desc.h
  • HID_REPORT_ID_6 : audio_hid_desc.h, custom_hid_desc.h
  • HID_REQ_GET_IDLE : usb_std.h
  • HID_REQ_GET_PROTOCOL : usb_std.h
  • HID_REQ_GET_REPORT : usb_std.h
  • HID_REQ_SET_IDLE : usb_std.h
  • HID_REQ_SET_PROTOCOL : usb_std.h
  • HID_REQ_SET_REPORT : usb_std.h
  • HIDIAP_BCD_NUM : hid_iap_desc.h
  • HIDIAP_BINTERVAL_TIME : hid_iap_desc.h
  • HIST_LENGTH : project/at_start_f413/examples/usart/smartcard/src/main.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all macros with links to the files they belong to:

- i -

  • I2C1 : at32f413_i2c.h
  • I2C1_BASE : at32f413.h
  • I2C1_GMUX_0001 : at32f413_gpio.h
  • I2C1_GMUX_0011 : at32f413_gpio.h
  • I2C1_MUX : at32f413_gpio.h
  • I2C2 : at32f413_i2c.h
  • I2C2_BASE : at32f413.h
  • I2C2_GMUX_0001 : at32f413_gpio.h
  • I2C2_GMUX_0010 : at32f413_gpio.h
  • I2C2_GMUX_0011 : at32f413_gpio.h
  • I2C_ACKFAIL_FLAG : at32f413_i2c.h
  • I2C_ADDR2_FLAG : at32f413_i2c.h
  • I2C_ADDR7F_FLAG : at32f413_i2c.h
  • I2C_ADDRHF_FLAG : at32f413_i2c.h
  • I2C_ALERTF_FLAG : at32f413_i2c.h
  • I2C_ARLOST_FLAG : at32f413_i2c.h
  • I2C_BUSERR_FLAG : at32f413_i2c.h
  • I2C_BUSYF_FLAG : at32f413_i2c.h
  • I2C_DATA_INT : at32f413_i2c.h
  • I2C_DEVADDRF_FLAG : at32f413_i2c.h
  • I2C_DIRF_FLAG : at32f413_i2c.h
  • I2C_END : i2c_application.c
  • I2C_ERR_INT : at32f413_i2c.h
  • I2C_EVENT_CHECK_ACKFAIL : i2c_application.h
  • I2C_EVENT_CHECK_NONE : i2c_application.h
  • I2C_EVENT_CHECK_STOP : i2c_application.h
  • I2C_EVT_INT : at32f413_i2c.h
  • I2C_GCADDRF_FLAG : at32f413_i2c.h
  • I2C_HOSTADDRF_FLAG : at32f413_i2c.h
  • I2C_MODULE_ENABLED : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • I2C_OUF_FLAG : at32f413_i2c.h
  • I2C_PECERR_FLAG : at32f413_i2c.h
  • I2C_RDBF_FLAG : at32f413_i2c.h
  • I2C_START : i2c_application.c
  • I2C_STARTF_FLAG : at32f413_i2c.h
  • I2C_STOPF_FLAG : at32f413_i2c.h
  • I2C_TDBE_FLAG : at32f413_i2c.h
  • I2C_TDC_FLAG : at32f413_i2c.h
  • I2C_TIMEOUT : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/communication_int/src/main.c, project/at_start_f413/examples/i2c/communication_poll/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c, audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • I2C_TMOUT_FLAG : at32f413_i2c.h
  • I2C_TRMODE_FLAG : at32f413_i2c.h
  • I2Cx_ADDRESS : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/communication_int/src/main.c, project/at_start_f413/examples/i2c/communication_poll/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c, audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • I2Cx_CLK : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/communication_int/src/main.c, project/at_start_f413/examples/i2c/communication_poll/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c, audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • I2Cx_DMA_CLK : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c
  • I2Cx_DMA_RX_CHANNEL : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c
  • I2Cx_DMA_RX_IRQHandler : project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c, project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c, project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c
  • I2Cx_DMA_RX_IRQn : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c
  • I2Cx_DMA_TX_CHANNEL : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c
  • I2Cx_DMA_TX_IRQHandler : project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c, project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c, project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c
  • I2Cx_DMA_TX_IRQn : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c
  • I2Cx_ERR_IRQHandler : project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c, project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c, project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c
  • I2Cx_ERR_IRQn : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/communication_int/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c
  • I2Cx_EVT_IRQHandler : project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c, project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c, project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c, project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c
  • I2Cx_EVT_IRQn : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/communication_int/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c
  • I2Cx_PORT : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/communication_int/src/main.c, project/at_start_f413/examples/i2c/communication_poll/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c, audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • I2Cx_SCL_GPIO_CLK : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/communication_int/src/main.c, project/at_start_f413/examples/i2c/communication_poll/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c, audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • I2Cx_SCL_GPIO_PORT : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/communication_int/src/main.c, project/at_start_f413/examples/i2c/communication_poll/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c, audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • I2Cx_SCL_PIN : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/communication_int/src/main.c, project/at_start_f413/examples/i2c/communication_poll/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c, audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • I2Cx_SDA_GPIO_CLK : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/communication_int/src/main.c, project/at_start_f413/examples/i2c/communication_poll/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c, audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • I2Cx_SDA_GPIO_PORT : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/communication_int/src/main.c, project/at_start_f413/examples/i2c/communication_poll/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c, audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • I2Cx_SDA_PIN : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/communication_int/src/main.c, project/at_start_f413/examples/i2c/communication_poll/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c, audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • I2Cx_SPEED : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/communication_int/src/main.c, project/at_start_f413/examples/i2c/communication_poll/src/main.c, project/at_start_f413/examples/i2c/eeprom/src/main.c, project/at_start_f413/examples/i2c/memory_write/src/main.c, audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • I2S1_CK_PIN : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • I2S1_DT_ADDRESS : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • I2S1_GPIO : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • I2S1_GPIO_CRM_CLK : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • I2S1_SD_PIN : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • I2S1_WS_PIN : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • I2S2_CK_PIN : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • I2S2_DT_ADDRESS : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • I2S2_GPIO : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • I2S2_GPIO_CRM_CLK : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • I2S2_SD_PIN : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • I2S2_WS_PIN : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • I2S_ACS_FLAG : at32f413_spi.h
  • I2S_TUERR_FLAG : at32f413_spi.h
  • IAP_ACK : hid_iap_class.h
  • IAP_CMD_ADDR : hid_iap_class.h
  • IAP_CMD_CRC : hid_iap_class.h
  • IAP_CMD_DATA : hid_iap_class.h
  • IAP_CMD_FINISH : hid_iap_class.h
  • IAP_CMD_GET : hid_iap_class.h
  • IAP_CMD_IDLE : hid_iap_class.h
  • IAP_CMD_JMP : hid_iap_class.h
  • IAP_CMD_START : hid_iap_class.h
  • IAP_FAILED : flash_fat16.h
  • IAP_NACK : hid_iap_class.h
  • IAP_REV_FLAG_5A : app_led3_toggle/inc/usart.h, app_led4_toggle/inc/usart.h
  • IAP_REV_FLAG_DONE : app_led3_toggle/inc/usart.h, app_led4_toggle/inc/usart.h
  • IAP_REV_FLAG_ERROR : app_led3_toggle/inc/usart.h, app_led4_toggle/inc/usart.h
  • IAP_REV_FLAG_NO : app_led3_toggle/inc/usart.h, app_led4_toggle/inc/usart.h
  • IAP_SUCCESS : flash_fat16.h
  • IAP_UPGRADE_COMPLETE_FLAG : flash_fat16.h, hid_iap_class.h
  • IAP_UPGRADE_FLAG : app_led3_toggle/inc/iap.h, app_led4_toggle/inc/iap.h, bootloader/inc/iap.h
  • IAP_UPGRADE_FLAG_ADDR : app_led3_toggle/inc/iap.h, app_led4_toggle/inc/iap.h, bootloader/inc/iap.h
  • IMG_CONSTANT : julia_fpu.h
  • INCLUDE_uxTaskPriorityGet : FreeRTOSConfig.h
  • INCLUDE_vTaskCleanUpResources : FreeRTOSConfig.h
  • INCLUDE_vTaskDelay : FreeRTOSConfig.h
  • INCLUDE_vTaskDelayUntil : FreeRTOSConfig.h
  • INCLUDE_vTaskDelete : FreeRTOSConfig.h
  • INCLUDE_vTaskPrioritySet : FreeRTOSConfig.h
  • INCLUDE_vTaskSuspend : FreeRTOSConfig.h
  • INCLUDE_xTaskGetCurrentTaskHandle : FreeRTOSConfig.h
  • INTERNAL_FLASH_LUN : composite_vcp_msc/inc/msc_diskio.h, msc/inc/msc_diskio.h, virtual_msc_iap/inc/msc_diskio.h
  • INVAILD_OFFSET_ADDR : flash_fat16.h
  • INVALID_COMMAND : cdc_msc_class.h, msc_bot_scsi.h
  • INVALID_FIELD_IN_PARAMETER_LIST : cdc_msc_class.h, msc_bot_scsi.h
  • INVALID_FIELED_IN_COMMAND : cdc_msc_class.h, msc_bot_scsi.h
  • IOMUX : at32f413_gpio.h
  • IOMUX_BASE : at32f413.h
  • IOMUX_MAKE_VALUE : at32f413_gpio.h
  • ITERATION : julia_fpu.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all macros with links to the files they belong to:

- k -

  • KB_TO_B : hid_iap_class.h
  • KEYBOARD_BCD_NUM : keyboard_desc.h
  • KEYBOARD_BINTERVAL_TIME : keyboard_desc.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all macros with links to the files they belong to:

- l -

  • LBYTE : usb_std.h
  • LED_NUM : at32f413_board.h
  • LEFT_BUTTON : mouse_class.h
  • LEFT_MOVE : mouse_class.h
  • LEXT_VALUE : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all macros with links to the files they belong to:

- m -

  • MAKE_VALUE : at32f413.h
  • MASTER_BOARD : project/at_start_f413/examples/i2c/communication_dma/src/main.c, project/at_start_f413/examples/i2c/communication_int/src/main.c, project/at_start_f413/examples/i2c/communication_poll/src/main.c
  • MATCH_ID_VAL : project/at_start_f413/examples/usart/receiver_mute/src/main.c
  • MAX : usb_std.h
  • MCU_ID1 : audio_desc.h, audio_hid_desc.h, cdc_desc.h, cdc_keyboard_desc.h, cdc_msc_desc.h, custom_hid_desc.h, hid_iap_desc.h, keyboard_desc.h, mouse_desc.h, msc_desc.h, printer_desc.h, winusb_desc.h
  • MCU_ID2 : audio_desc.h, audio_hid_desc.h, cdc_desc.h, cdc_keyboard_desc.h, cdc_msc_desc.h, custom_hid_desc.h, hid_iap_desc.h, keyboard_desc.h, mouse_desc.h, msc_desc.h, printer_desc.h, winusb_desc.h
  • MCU_ID3 : audio_desc.h, audio_hid_desc.h, cdc_desc.h, cdc_keyboard_desc.h, cdc_msc_desc.h, custom_hid_desc.h, hid_iap_desc.h, keyboard_desc.h, mouse_desc.h, msc_desc.h, printer_desc.h, winusb_desc.h
  • MEDIUM_HAVE_CHANGED : cdc_msc_class.h, msc_bot_scsi.h
  • MEDIUM_NOT_PRESENT : cdc_msc_class.h, msc_bot_scsi.h
  • MIC_BUFFER_SIZE : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • MIN : usb_std.h
  • MISC_MODULE_ENABLED : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • MMC_SWITCH_ERROR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • MOUSE_BCD_NUM : mouse_desc.h
  • MOUSE_BINTERVAL_TIME : mouse_desc.h
  • MOVE_STEP : mouse_class.h
  • MS_TICK : project/at_start_f413/examples/cortex_m4/systick_interrupt/src/main.c
  • MSC_BCD_NUM : msc_desc.h
  • MSC_BOT_STATE_ERROR : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_BOT_STATE_IDLE : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_BOT_STATE_RECOVERY : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_CMD_ALLOW_MEDIUM_REMOVAL : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_CMD_FORMAT_UNIT : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_CMD_INQUIRY : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_CMD_MODE_SENSE10 : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_CMD_MODE_SENSE6 : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_CMD_READ_10 : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_CMD_READ_12 : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_CMD_READ_CAPACITY : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_CMD_READ_FORMAT_CAPACITY : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_CMD_REQUEST_SENSE : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_CMD_START_STOP : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_CMD_TEST_UNIT : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_CMD_VERIFY : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_CMD_WRITE_10 : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_CMD_WRITE_12 : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_CMD_WRITE_VERIFY : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_MAX_DATA_BUF_LEN : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_REQ_BO_RESET : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_REQ_GET_MAX_LUN : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_STATE_MACHINE_CMD : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_STATE_MACHINE_DATA_IN : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_STATE_MACHINE_DATA_OUT : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_STATE_MACHINE_FAILED : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_STATE_MACHINE_IDLE : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_STATE_MACHINE_LAST_DATA : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_STATE_MACHINE_SEND_DATA : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_STATE_MACHINE_STATUS : cdc_msc_class.h, msc_bot_scsi.h
  • MSC_SUPPORT_MAX_LUN : cdc_msc_class.h, msc_bot_scsi.h
  • MULTI_BUFFER_SIZE : project/at_start_f413/examples/sdio/emmc_card/src/main.c, project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all macros with links to the files they belong to:

- n -

  • NULL : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • NUM_TAPS : fir_coefficient.c, fir_filter.c
  • NUMSTUDENTS : project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c
  • NUMSUBJECTS : project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c
  • NVIC_VECTTAB_FLASH : at32f413_misc.h
  • NVIC_VECTTAB_RAM : at32f413_misc.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all macros with links to the files they belong to:

- o -

  • OPERATION_TIMEOUT : at32f413_flash.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all macros with links to the files they belong to:

- p -

  • PARAMETER_LIST_LENGTH_ERROR : cdc_msc_class.h, msc_bot_scsi.h
  • PD01_GMUX : at32f413_gpio.h
  • PD01_MUX : at32f413_gpio.h
  • PERIPH_BASE : at32f413.h
  • PERIPH_REG : at32f413.h
  • PERIPH_REG_BIT : at32f413.h
  • PERIPHERAL_BASE : project/at_start_f413/examples/cortex_m4/bit_band/src/main.c
  • PERIPHERAL_BITBAND_BASE : project/at_start_f413/examples/cortex_m4/bit_band/src/main.c
  • PERIPHERAL_RESET_BIT : project/at_start_f413/examples/cortex_m4/bit_band/src/main.c
  • PERIPHERAL_SET_BIT : project/at_start_f413/examples/cortex_m4/bit_band/src/main.c
  • PLL_STABLE_DELAY : system_at32f413.h
  • PRINT_UART : at32f413_board.h
  • PRINT_UART_CRM_CLK : at32f413_board.h
  • PRINT_UART_TX_GPIO : at32f413_board.h
  • PRINT_UART_TX_GPIO_CRM_CLK : at32f413_board.h
  • PRINT_UART_TX_PIN : at32f413_board.h
  • PRINTER_BCD_NUM : printer_desc.h
  • PRINTER_DEVICE_ID_LEN : printer_class.h
  • PRINTER_PROTOCOL_1284_4 : printer_desc.h
  • PRINTER_PROTOCOL_BI_DIRECTIONAL : printer_desc.h
  • PRINTER_PROTOCOL_UNIDIRECTIONAL : printer_desc.h
  • PRINTER_PROTOCOL_VENDOR_SPECIFIC : printer_desc.h
  • PROGRAMMING_TIMEOUT : at32f413_flash.h
  • PUTCHAR_PROTOTYPE : at32f413_board.c
  • PWC : at32f413_pwc.h
  • PWC_BASE : at32f413.h
  • PWC_MODULE_ENABLED : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • PWC_PVM_OUTPUT_FLAG : at32f413_pwc.h
  • PWC_STANDBY_FLAG : at32f413_pwc.h
  • PWC_WAKEUP_FLAG : at32f413_pwc.h
  • PWC_WAKEUP_PIN_1 : at32f413_pwc.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all macros with links to the files they belong to:

- r -

  • RAM_BASE : project/at_start_f413/examples/cortex_m4/bit_band/src/main.c
  • RAM_BITBAND_BASE : project/at_start_f413/examples/cortex_m4/bit_band/src/main.c
  • REAL_CONSTANT : julia_fpu.h
  • REG16 : at32f413.h
  • REG32 : at32f413.h
  • REG8 : at32f413.h
  • REQ_SENSE_STANDARD_DATA_LEN : cdc_msc_class.h, msc_bot_scsi.h
  • RIGHT_BUTTON : mouse_class.h
  • RIGHT_MOVE : mouse_class.h
  • RS485_BAUDRATE : project/at_start_f413/examples/usart/rs485/src/main.c
  • RS485_BUFFER_SIZE : project/at_start_f413/examples/usart/rs485/src/main.c
  • RTC : at32f413_rtc.h
  • RTC_BASE : at32f413.h
  • RTC_CFGF_FLAG : at32f413_rtc.h
  • RTC_MODULE_ENABLED : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • RTC_OVF_FLAG : at32f413_rtc.h
  • RTC_OVF_INT : at32f413_rtc.h
  • RTC_TA_FLAG : at32f413_rtc.h
  • RTC_TA_INT : at32f413_rtc.h
  • RTC_TS_FLAG : at32f413_rtc.h
  • RTC_TS_INT : at32f413_rtc.h
  • RTC_UPDF_FLAG : at32f413_rtc.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all macros with links to the files they belong to:

- s -

  • SAMPLE_FREQ : audio_desc.h, audio_hid_desc.h
  • SAMPLING_NUM : project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c
  • SC_3_5V_CLK : smartcard_config.h
  • SC_3_5V_PIN : smartcard_config.h
  • SC_3_5V_PORT : smartcard_config.h
  • SC_CMDVCC_CLK : smartcard_config.h
  • SC_CMDVCC_PIN : smartcard_config.h
  • SC_CMDVCC_PORT : smartcard_config.h
  • SC_F_DIV_D : project/at_start_f413/examples/usart/smartcard/src/main.c
  • SC_OFF_CLK : smartcard_config.h
  • SC_OFF_EXINT : smartcard_config.h
  • SC_OFF_EXINT_IRQ : smartcard_config.h
  • SC_OFF_PIN : smartcard_config.h
  • SC_OFF_PINSOURCE : smartcard_config.h
  • SC_OFF_PORT : smartcard_config.h
  • SC_OFF_PORTSOURCE : smartcard_config.h
  • SC_RECEIVE_TIMEOUT : project/at_start_f413/examples/usart/smartcard/src/main.c
  • SC_RESET_CLK : smartcard_config.h
  • SC_RESET_PIN : smartcard_config.h
  • SC_RESET_PORT : smartcard_config.h
  • SC_USART : smartcard_config.h
  • SC_USART_CLK : smartcard_config.h
  • SC_USART_CLK_PIN : smartcard_config.h
  • SC_USART_CLK_PORT : smartcard_config.h
  • SC_USART_DIV_VAL : project/at_start_f413/examples/usart/smartcard/src/main.c
  • SC_USART_GPIO_CLK : smartcard_config.h
  • SC_USART_IRQHandler : smartcard_config.h
  • SC_USART_IRQn : smartcard_config.h
  • SC_USART_TX_PIN : smartcard_config.h
  • SC_USART_TX_PORT : smartcard_config.h
  • SCLK_FROM_HICK : project/at_start_f413/examples/acc/calibration/src/main.c
  • SCREEN_X_SIZE : project/at_start_f413/examples/cortex_m4/fpu/src/main.c
  • SCREEN_Y_SIZE : project/at_start_f413/examples/cortex_m4/fpu/src/main.c
  • SCSI_INQUIRY_DATA_LENGTH : cdc_msc_class.h, msc_bot_scsi.h
  • SD_0TO7BITS : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_16TO23BITS : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_24TO31BITS : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_8TO15BITS : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_ALLZERO : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CARD_LOCKED : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CARD_PROGRAMMING : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CARD_RECEIVING : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CCCC_ERASE : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CCCC_LOCK_UNLOCK : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CCCC_WRITE_PROT : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CHECK_PATTERN : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_ALL_SEND_CID : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_APP_CMD : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_APP_SD_SET_BUSWIDTH : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_CLR_WRITE_PROT : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_ERASE : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_ERASE_GRP_END : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_ERASE_GRP_START : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_FAST_IO : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_GEN_CMD : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_GO_IDLE_STATE : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_GO_INACTIVE_STATE : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_GO_IRQ_STATE : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_HS_BUSTEST_READ : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_HS_BUSTEST_WRITE : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_HS_SEND_EXT_CSD : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_HS_SWITCH : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_LOCK_UNLOCK : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_NO_CMD : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_PROG_CID : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_PROG_CSD : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_READ_DAT_UNTIL_STOP : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_READ_MULT_BLOCK : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_READ_SINGLE_BLOCK : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SD_APP_CHANGE_SECURE_AREA : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SD_APP_GET_CER_RES1 : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SD_APP_GET_CER_RN2 : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SD_APP_GET_MID : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SD_APP_GET_MKB : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SD_APP_OP_COND : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SD_APP_SECURE_ERASE : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SD_APP_SECURE_READ_MULTIPLE_BLOCK : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SD_APP_SECURE_WRITE_MKB : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SD_APP_SECURE_WRITE_MULTIPLE_BLOCK : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SD_APP_SEND_NUM_WRITE_BLOCKS : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SD_APP_SEND_SCR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SD_APP_SET_CER_RES2 : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SD_APP_SET_CER_RN1 : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SD_APP_SET_CLR_CARD_DETECT : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SD_APP_STAUS : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SD_ERASE_GRP_END : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SD_ERASE_GRP_START : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SDIO_RW_DIRECT : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SDIO_RW_EXTENDED : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SDIO_SEN_OP_COND : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SEL_DESEL_CARD : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SEND_CID : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SEND_CSD : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SEND_OP_COND : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SEND_STATUS : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SEND_WRITE_PROT : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SET_BLOCK_COUNT : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SET_BLOCKLEN : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SET_DSR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SET_REL_ADDR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_SET_WRITE_PROT : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_STOP_TRANSMISSION : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_WRITE_DAT_UNTIL_STOP : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_WRITE_MULT_BLOCK : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_CMD_WRITE_SINGLE_BLOCK : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_DATATIMEOUT : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_HALFFIFO : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_HALFFIFOBYTES : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_HIGH_CAPACITY : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_LUN : composite_vcp_msc/inc/msc_diskio.h, msc/inc/msc_diskio.h, virtual_msc_iap/inc/msc_diskio.h
  • SD_MAX_DATA_LENGTH : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_MAX_VOLT_TRIAL : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_OCR_ADDR_MISALIGNED : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_OCR_ADDR_OUT_OF_RANGE : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_OCR_AKE_SEQ_ERROR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_OCR_BLK_LEN_ERR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_OCR_CARD_CONTROLLER_ERR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_OCR_CARD_ECC_DISABLED : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_OCR_CARD_ECC_ERROR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_OCR_CID_CSD_OVERWRIETE : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_OCR_CMD_CRC_ERROR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_OCR_ERASE_RESET : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_OCR_ERASE_SEQ_ERR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_OCR_ERRORBITS : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_OCR_GENERAL_UNKNOWN_ERROR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_OCR_ILLEGAL_CMD : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_OCR_INVALID_ERASE_PARAM : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_OCR_LOCK_UNLOCK_ERROR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_OCR_STREAM_RD_UNDERRUN : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_OCR_STREAM_WR_OVERRUN : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_OCR_WP_ERASE_SKIP : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_OCR_WR_PROTECT_VIOLATION : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_R5_ERROR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_R5_FUNCTION_NUMBER : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_R5_OUT_OF_RANGE : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_R6_CMD_CRC_ERROR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_R6_GENERAL_UNKNOWN_ERROR : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_R6_ILLEGAL_CMD : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_SINGLE_BUS_SUPPORT : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_STD_CAPACITY : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_VOLTAGE_WINDOW_MMC : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_VOLTAGE_WINDOW_SD : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SD_WIDE_BUS_SUPPORT : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SDIO1_BASE : at32f413.h
  • SDIO1_GMUX_0100 : at32f413_gpio.h
  • SDIO1_GMUX_0101 : at32f413_gpio.h
  • SDIO1_GMUX_0110 : at32f413_gpio.h
  • SDIO1_GMUX_0111 : at32f413_gpio.h
  • SDIO_CMD0TIMEOUT : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SDIO_CMDCMPL_FLAG : at32f413_sdio.h
  • SDIO_CMDCMPL_INT : at32f413_sdio.h
  • SDIO_CMDFAIL_FLAG : at32f413_sdio.h
  • SDIO_CMDFAIL_INT : at32f413_sdio.h
  • SDIO_CMDRSPCMPL_FLAG : at32f413_sdio.h
  • SDIO_CMDRSPCMPL_INT : at32f413_sdio.h
  • SDIO_CMDTIMEOUT_FLAG : at32f413_sdio.h
  • SDIO_CMDTIMEOUT_INT : at32f413_sdio.h
  • SDIO_DATATIMEOUT : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SDIO_DOCMD_FLAG : at32f413_sdio.h
  • SDIO_DOCMD_INT : at32f413_sdio.h
  • SDIO_DORX_FLAG : at32f413_sdio.h
  • SDIO_DORX_INT : at32f413_sdio.h
  • SDIO_DOTX_FLAG : at32f413_sdio.h
  • SDIO_DOTX_INT : at32f413_sdio.h
  • SDIO_DTBLKCMPL_FLAG : at32f413_sdio.h
  • SDIO_DTBLKCMPL_INT : at32f413_sdio.h
  • SDIO_DTCMP_INT : at32f413_sdio.h
  • SDIO_DTCMPL_FLAG : at32f413_sdio.h
  • SDIO_DTFAIL_FLAG : at32f413_sdio.h
  • SDIO_DTFAIL_INT : at32f413_sdio.h
  • SDIO_DTTIMEOUT_FLAG : at32f413_sdio.h
  • SDIO_DTTIMEOUT_INT : at32f413_sdio.h
  • SDIO_INTR_STS_READ_MASK : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SDIO_INTR_STS_WRITE_MASK : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SDIO_MODULE_ENABLED : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • SDIO_RXBUF_FLAG : at32f413_sdio.h
  • SDIO_RXBUF_INT : at32f413_sdio.h
  • SDIO_RXBUFE_FLAG : at32f413_sdio.h
  • SDIO_RXBUFE_INT : at32f413_sdio.h
  • SDIO_RXBUFF_FLAG : at32f413_sdio.h
  • SDIO_RXBUFF_INT : at32f413_sdio.h
  • SDIO_RXBUFH_FLAG : at32f413_sdio.h
  • SDIO_RXBUFH_INT : at32f413_sdio.h
  • SDIO_RXERRO_FLAG : at32f413_sdio.h
  • SDIO_RXERRO_INT : at32f413_sdio.h
  • SDIO_SBITERR_FLAG : at32f413_sdio.h
  • SDIO_SBITERR_INT : at32f413_sdio.h
  • SDIO_SDIOIF_FLAG : at32f413_sdio.h
  • SDIO_SDIOIF_INT : at32f413_sdio.h
  • SDIO_SEND_IF_COND : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SDIO_STATIC_FLAGS : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SDIO_TXBUF_FLAG : at32f413_sdio.h
  • SDIO_TXBUF_INT : at32f413_sdio.h
  • SDIO_TXBUFE_FLAG : at32f413_sdio.h
  • SDIO_TXBUFE_INT : at32f413_sdio.h
  • SDIO_TXBUFF_FLAG : at32f413_sdio.h
  • SDIO_TXBUFF_INT : at32f413_sdio.h
  • SDIO_TXBUFH_FLAG : at32f413_sdio.h
  • SDIO_TXBUFH_INT : at32f413_sdio.h
  • SDIO_TXERRU_FLAG : at32f413_sdio.h
  • SDIO_TXERRU_INT : at32f413_sdio.h
  • SDIOx : emmc_card/inc/at32_sdio.h, sd_mmc_card/inc/at32_sdio.h, sdio_fatfs/inc/at32_sdio.h
  • SECTOR_NUM : utilities/at32f413_slib_demo/project_l0/src/main.c
  • SECTOR_SIZE : project/at_start_f413/examples/flash/flash_write_read/src/flash.c
  • SECTOR_SIZE_1K : composite_vcp_msc/inc/msc_diskio.h, msc/inc/msc_diskio.h, hid_iap_class.h
  • SECTOR_SIZE_2K : composite_vcp_msc/inc/msc_diskio.h, msc/inc/msc_diskio.h, hid_iap_class.h
  • SECTOR_SIZE_4K : composite_vcp_msc/inc/msc_diskio.h, msc/inc/msc_diskio.h, hid_iap_class.h
  • SECTOR_WORD_CNT : utilities/at32f413_slib_demo/project_l0/src/main.c
  • SENSE_KEY_ABORTED_COMMAND : cdc_msc_class.h, msc_bot_scsi.h
  • SENSE_KEY_BLANK_CHECK : cdc_msc_class.h, msc_bot_scsi.h
  • SENSE_KEY_DATA_PROTECT : cdc_msc_class.h, msc_bot_scsi.h
  • SENSE_KEY_HARDWARE_ERROR : cdc_msc_class.h, msc_bot_scsi.h
  • SENSE_KEY_ILLEGAL_REQUEST : cdc_msc_class.h, msc_bot_scsi.h
  • SENSE_KEY_MEDIUM_ERROR : cdc_msc_class.h, msc_bot_scsi.h
  • SENSE_KEY_MISCOMPARE : cdc_msc_class.h, msc_bot_scsi.h
  • SENSE_KEY_NO_SENSE : cdc_msc_class.h, msc_bot_scsi.h
  • SENSE_KEY_NOT_READY : cdc_msc_class.h, msc_bot_scsi.h
  • SENSE_KEY_RECOVERED_ERROR : cdc_msc_class.h, msc_bot_scsi.h
  • SENSE_KEY_UNIT_ATTENTION : cdc_msc_class.h, msc_bot_scsi.h
  • SENSE_KEY_VENDERO_SPECIFIC : cdc_msc_class.h, msc_bot_scsi.h
  • SENSE_KEY_VOLUME_OVERFLOW : cdc_msc_class.h, msc_bot_scsi.h
  • SET_LINE_CODING : cdc_msc_class.h, msc_bot_scsi.h, usb_std.h
  • SETUP_LENGTH : project/at_start_f413/examples/usart/smartcard/src/main.c
  • SHIFT : cdc_keyboard_class.c, keyboard_class.c
  • SLIB_DATA_ADDR : utilities/at32f413_slib_demo/project_l0/src/main.c
  • SLIB_END_ADDR : utilities/at32f413_slib_demo/project_l0/src/main.c
  • SLIB_START_ADDR : utilities/at32f413_slib_demo/project_l0/src/main.c
  • SLIB_UNLOCK_KEY : at32f413_flash.h
  • SLOW : project/at_start_f413/templates/src/main.c
  • SNR_THRESHOLD_F32 : utilities/at32f413_slib_demo/project_l0/src/main.c, utilities/at32f413_slib_demo/project_l1/src/main.c
  • SPI1 : at32f413_spi.h
  • SPI1_AS_MASTER_CS_HIGH : project/at_start_f413/examples/spi/fullduplex_polling/src/main.c
  • SPI1_AS_MASTER_CS_LOW : project/at_start_f413/examples/spi/fullduplex_polling/src/main.c
  • SPI1_BASE : at32f413.h
  • SPI1_GMUX_0001 : at32f413_gpio.h
  • SPI1_MUX_01 : at32f413_gpio.h
  • SPI2 : at32f413_spi.h
  • SPI2_AS_MASTER_CS_HIGH : project/at_start_f413/examples/spi/fullduplex_polling/src/main.c
  • SPI2_AS_MASTER_CS_LOW : project/at_start_f413/examples/spi/fullduplex_polling/src/main.c
  • SPI2_BASE : at32f413.h
  • SPI2_GMUX_0001 : at32f413_gpio.h
  • SPI2_TX_BUFFER_SIZE : project/at_start_f413/examples/usart/synchronous/src/main.c
  • SPI_CCERR_FLAG : at32f413_spi.h
  • SPI_FLASH_LUN : composite_vcp_msc/inc/msc_diskio.h, msc/inc/msc_diskio.h, virtual_msc_iap/inc/msc_diskio.h
  • SPI_I2S_BF_FLAG : at32f413_spi.h
  • SPI_I2S_ERROR_INT : at32f413_spi.h
  • SPI_I2S_RDBF_FLAG : at32f413_spi.h
  • SPI_I2S_RDBF_INT : at32f413_spi.h
  • SPI_I2S_ROERR_FLAG : at32f413_spi.h
  • SPI_I2S_TDBE_FLAG : at32f413_spi.h
  • SPI_I2S_TDBE_INT : at32f413_spi.h
  • SPI_MASTER_CS_HIGH : project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c, project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c, project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c
  • SPI_MASTER_CS_LOW : project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c, project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c, project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c, project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c
  • SPI_MMERR_FLAG : at32f413_spi.h
  • SPI_MODULE_ENABLED : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • SPI_TRANS_DMA : spi_flash.h
  • SPIF_BLOCKERASE : spi_flash.h
  • SPIF_CHIP_SIZE : spi_flash.h
  • SPIF_CHIPERASE : spi_flash.h
  • SPIF_DEVICEID : spi_flash.h
  • SPIF_FASTREADDATA : spi_flash.h
  • SPIF_FASTREADDUAL : spi_flash.h
  • SPIF_JEDECDEVICEID : spi_flash.h
  • SPIF_MANUFACTDEVICEID : spi_flash.h
  • SPIF_PAGE_SIZE : spi_flash.h
  • SPIF_PAGEPROGRAM : spi_flash.h
  • SPIF_POWERDOWN : spi_flash.h
  • SPIF_READDATA : spi_flash.h
  • SPIF_READSTATUSREG1 : spi_flash.h
  • SPIF_READSTATUSREG2 : spi_flash.h
  • SPIF_READSTATUSREG3 : spi_flash.h
  • SPIF_RELEASEPOWERDOWN : spi_flash.h
  • SPIF_SECTOR_SIZE : spi_flash.h
  • SPIF_SECTORERASE : spi_flash.h
  • SPIF_WRITEDISABLE : spi_flash.h
  • SPIF_WRITEENABLE : spi_flash.h
  • SPIF_WRITESTATUSREG1 : spi_flash.h
  • SPIF_WRITESTATUSREG2 : spi_flash.h
  • SPIF_WRITESTATUSREG3 : spi_flash.h
  • SPIM_ERASE_TIMEOUT : at32f413_flash.h
  • SPIM_FLASH_BASE : at32f413.h
  • SPIM_PROGRAMMING_TIMEOUT : at32f413_flash.h
  • SPIM_SECTOR_SIZE : operate_spim.h
  • SPIM_TEST_ADDR : operate_spim.h
  • SPK_BUFFER_SIZE : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • SPK_TX_FIFO_SIZE : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • SRAM_BASE : at32f413.h
  • SRAM_SIZE : utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/flash.h
  • STEP_DELAY_MS : at32f413_board.c
  • STREAM_BUFFER_SIZE : project/at_start_f413/examples/sdio/emmc_card/src/main.c, project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c
  • SWAPBYTE : usb_std.h
  • SWJTAG_CONF_001 : at32f413_gpio.h
  • SWJTAG_CONF_010 : at32f413_gpio.h
  • SWJTAG_CONF_100 : at32f413_gpio.h
  • SWJTAG_GMUX_001 : at32f413_gpio.h
  • SWJTAG_GMUX_010 : at32f413_gpio.h
  • SWJTAG_GMUX_100 : at32f413_gpio.h
  • SystemCoreClock : system_at32f413.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all macros with links to the files they belong to:

- t -

  • T0_PROTOCOL : project/at_start_f413/examples/usart/smartcard/src/main.c
  • TEST_BUFEER_SIZE : project/at_start_f413/examples/flash/flash_write_read/src/main.c
  • TEST_FLASH_ADDRESS_START : project/at_start_f413/examples/flash/flash_write_read/src/main.c
  • TEST_LENGTH_SAMPLES : project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c, utilities/at32f413_slib_demo/project_l0/src/main.c, utilities/at32f413_slib_demo/project_l1/src/main.c
  • TEST_SLIB_PSW : utilities/at32f413_slib_demo/project_l0/src/main.c
  • TMR1 : at32f413_tmr.h
  • TMR10_BASE : at32f413.h
  • TMR10_GMUX : at32f413_gpio.h
  • TMR11_BASE : at32f413.h
  • TMR11_GMUX : at32f413_gpio.h
  • TMR1_BASE : at32f413.h
  • TMR1_GMUX_0001 : at32f413_gpio.h
  • TMR1_MUX_01 : at32f413_gpio.h
  • TMR2 : at32f413_tmr.h
  • TMR2_BASE : at32f413.h
  • TMR2_GMUX_001 : at32f413_gpio.h
  • TMR2_GMUX_010 : at32f413_gpio.h
  • TMR2_GMUX_011 : at32f413_gpio.h
  • TMR2_MUX_01 : at32f413_gpio.h
  • TMR2_MUX_10 : at32f413_gpio.h
  • TMR2_MUX_11 : at32f413_gpio.h
  • TMR2ITR1_GMUX : at32f413_gpio.h
  • TMR3 : at32f413_tmr.h
  • TMR3_BASE : at32f413.h
  • TMR3_GMUX_0010 : at32f413_gpio.h
  • TMR3_GMUX_0011 : at32f413_gpio.h
  • TMR3_MUX_10 : at32f413_gpio.h
  • TMR3_MUX_11 : at32f413_gpio.h
  • TMR4 : at32f413_tmr.h
  • TMR4_BASE : at32f413.h
  • TMR5_BASE : at32f413.h
  • TMR5_GMUX_001 : at32f413_gpio.h
  • TMR5CH4_GMUX : at32f413_gpio.h
  • TMR5CH4_MUX : at32f413_gpio.h
  • TMR8_BASE : at32f413.h
  • TMR9_BASE : at32f413.h
  • TMR9_GMUX : at32f413_gpio.h
  • TMR_BRK_FLAG : at32f413_tmr.h
  • TMR_BRK_INT : at32f413_tmr.h
  • TMR_C1_FLAG : at32f413_tmr.h
  • TMR_C1_INT : at32f413_tmr.h
  • TMR_C1_RECAPTURE_FLAG : at32f413_tmr.h
  • TMR_C2_FLAG : at32f413_tmr.h
  • TMR_C2_INT : at32f413_tmr.h
  • TMR_C2_RECAPTURE_FLAG : at32f413_tmr.h
  • TMR_C3_FLAG : at32f413_tmr.h
  • TMR_C3_INT : at32f413_tmr.h
  • TMR_C3_RECAPTURE_FLAG : at32f413_tmr.h
  • TMR_C4_FLAG : at32f413_tmr.h
  • TMR_C4_INT : at32f413_tmr.h
  • TMR_C4_RECAPTURE_FLAG : at32f413_tmr.h
  • TMR_HALL_FLAG : at32f413_tmr.h
  • TMR_HALL_INT : at32f413_tmr.h
  • TMR_MODULE_ENABLED : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • TMR_OVF_FLAG : at32f413_tmr.h
  • TMR_OVF_INT : at32f413_tmr.h
  • TMR_TRIGGER_FLAG : at32f413_tmr.h
  • TMR_TRIGGER_INT : at32f413_tmr.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all macros with links to the files they belong to:

- u -

  • UART4_BASE : at32f413.h
  • UART4_GMUX_0001 : at32f413_gpio.h
  • UART5_BASE : at32f413.h
  • UNUSED : at32f413_def.h
  • UP_MOVE : mouse_class.h
  • USART1 : at32f413_usart.h
  • USART1_BASE : at32f413.h
  • USART1_GMUX_0001 : at32f413_gpio.h
  • USART1_MUX : at32f413_gpio.h
  • USART2 : at32f413_usart.h
  • USART2_BASE : at32f413.h
  • USART2_TX_BUFFER_SIZE : project/at_start_f413/examples/usart/half_duplex/src/main.c, project/at_start_f413/examples/usart/interrupt/src/main.c, project/at_start_f413/examples/usart/polling/src/main.c, project/at_start_f413/examples/usart/synchronous/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c
  • USART3_BASE : at32f413.h
  • USART3_GMUX_0001 : at32f413_gpio.h
  • USART3_MUX_01 : at32f413_gpio.h
  • USART3_TX_BUFFER_SIZE : project/at_start_f413/examples/usart/half_duplex/src/main.c, project/at_start_f413/examples/usart/interrupt/src/main.c, project/at_start_f413/examples/usart/polling/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c, project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c
  • USART_BF_INT : at32f413_usart.h
  • USART_BFF_FLAG : at32f413_usart.h
  • usart_buffer_size : project/at_start_f413/examples/usb_device/virtual_comport/src/main.c
  • USART_CTSCF_FLAG : at32f413_usart.h
  • USART_CTSCF_INT : at32f413_usart.h
  • USART_ERR_INT : at32f413_usart.h
  • USART_FERR_FLAG : at32f413_usart.h
  • USART_IDLE_INT : at32f413_usart.h
  • USART_IDLEF_FLAG : at32f413_usart.h
  • USART_MODULE_ENABLED : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • USART_NERR_FLAG : at32f413_usart.h
  • USART_PERR_FLAG : at32f413_usart.h
  • USART_PERR_INT : at32f413_usart.h
  • USART_RDBF_FLAG : at32f413_usart.h
  • USART_RDBF_INT : at32f413_usart.h
  • USART_REC_LEN : bootloader/inc/usart.h
  • USART_ROERR_FLAG : at32f413_usart.h
  • USART_TDBE_FLAG : at32f413_usart.h
  • USART_TDBE_INT : at32f413_usart.h
  • USART_TDC_FLAG : at32f413_usart.h
  • USART_TDC_INT : at32f413_usart.h
  • USB : at32f413_usb.h
  • USB_BE_FLAG : at32f413_usb.h
  • USB_BE_INT : at32f413_usb.h
  • USB_BUFFER_SIZE_EX : project/at_start_f413/examples/usb_device/audio/inc/usb_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/usb_conf.h
  • USB_BUFFER_TABLE_ADDRESS : at32f413_usb.h
  • USB_CLASS_CODE_AUDIO : usb_std.h
  • USB_CLASS_CODE_CCID : usb_std.h
  • USB_CLASS_CODE_CDC : usb_std.h
  • USB_CLASS_CODE_CDCDATA : usb_std.h
  • USB_CLASS_CODE_HID : usb_std.h
  • USB_CLASS_CODE_HUB : usb_std.h
  • USB_CLASS_CODE_MSC : usb_std.h
  • USB_CLASS_CODE_PRINTER : usb_std.h
  • USB_CLASS_CODE_VENDOR : usb_std.h
  • USB_CLASS_CODE_VIDEO : usb_std.h
  • USB_CLEAR_EPT_DOUBLE_BUFFER : at32f413_usb.h
  • USB_CLEAR_EXF : at32f413_usb.h
  • USB_CLEAR_RXDTS : at32f413_usb.h
  • USB_CLEAR_RXTC : at32f413_usb.h
  • USB_CLEAR_TXDTS : at32f413_usb.h
  • USB_CLEAR_TXTC : at32f413_usb.h
  • USB_CONF_REMOTE_WAKEUP : usb_std.h
  • USB_CONF_SELF_POWERED : usb_std.h
  • USB_CONFIG_STRING : usb_std.h
  • USB_DBUF0_GET_LEN : at32f413_usb.h
  • USB_DBUF1_GET_LEN : at32f413_usb.h
  • USB_DESCIPTOR_TYPE_CONFIGURATION : usb_std.h
  • USB_DESCIPTOR_TYPE_DEVICE : usb_std.h
  • USB_DESCIPTOR_TYPE_DEVICE_QUALIFIER : usb_std.h
  • USB_DESCIPTOR_TYPE_ENDPOINT : usb_std.h
  • USB_DESCIPTOR_TYPE_INTERFACE : usb_std.h
  • USB_DESCIPTOR_TYPE_INTERFACE_POWER : usb_std.h
  • USB_DESCIPTOR_TYPE_OTHER_SPEED : usb_std.h
  • USB_DESCIPTOR_TYPE_STRING : usb_std.h
  • USB_DEVICE_CFG_DESC_LEN : usb_std.h
  • USB_DEVICE_DESC_LEN : usb_std.h
  • USB_DEVICE_EPT_LEN : usb_std.h
  • USB_DEVICE_IF_DESC_LEN : usb_std.h
  • USB_DEVICE_LANGID_STR_DESC_LEN : usb_std.h
  • USB_DEVICE_OTG_DESC_LEN : usb_std.h
  • USB_DEVICE_OTHER_SPEED_DESC_SIZ_LEN : usb_std.h
  • USB_DEVICE_QUALIFIER_DESC_LEN : usb_std.h
  • USB_ENDP_DESC_TABLE_OFFSET : at32f413_usb.c
  • USB_EPT0_DATA_IN : usb_std.h
  • USB_EPT0_DATA_OUT : usb_std.h
  • USB_EPT0_IDLE : usb_std.h
  • USB_EPT0_SETUP : usb_std.h
  • USB_EPT0_STALL : usb_std.h
  • USB_EPT0_STATUS_IN : usb_std.h
  • USB_EPT0_STATUS_OUT : usb_std.h
  • USB_EPT_AUTO_MALLOC_BUFFER : project/at_start_f413/examples/usb_device/audio/inc/usb_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/usb_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/usb_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/usb_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/usb_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/usb_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/usb_conf.h, project/at_start_f413/examples/usb_device/msc/inc/usb_conf.h, project/at_start_f413/examples/usb_device/printer/inc/usb_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/usb_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/usb_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/usb_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/usb_conf.h
  • USB_EPT_BIT_MASK : at32f413_usb.h
  • USB_EPT_BULK : at32f413_usb.h
  • USB_EPT_CONTROL : at32f413_usb.h
  • USB_EPT_DESC_BULK : usb_std.h
  • USB_EPT_DESC_CONTROL : usb_std.h
  • USB_EPT_DESC_DATA_EPT : usb_std.h
  • USB_EPT_DESC_FD_EPT : usb_std.h
  • USB_EPT_DESC_FDDATA_EPT : usb_std.h
  • USB_EPT_DESC_INTERRUPT : usb_std.h
  • USB_EPT_DESC_ISO : usb_std.h
  • USB_EPT_DESC_NSYNC : usb_std.h
  • USB_EPT_INT : at32f413_usb.h
  • USB_EPT_ISO : at32f413_usb.h
  • USB_EPT_NUM_FLAG : at32f413_usb.h
  • USB_EPTADDR : at32f413_usb.h
  • USB_ETP_DESC_ADAPTIVE : usb_std.h
  • USB_ETP_DESC_ASYNC : usb_std.h
  • USB_ETP_DESC_SYNC : usb_std.h
  • USB_EXF : at32f413_usb.h
  • USB_FEATURE_EPT_HALT : usb_std.h
  • USB_FEATURE_REMOTE_WAKEUP : usb_std.h
  • USB_FEATURE_TEST_MODE : usb_std.h
  • USB_FLASH_ADDR_OFFSET : composite_vcp_msc/inc/msc_diskio.h, msc/inc/msc_diskio.h, virtual_msc_iap/inc/msc_diskio.h
  • USB_FREE_DB_USER_BUFFER : at32f413_usb.h
  • USB_GET_RX_LEN : at32f413_usb.h
  • USB_GET_TX_LEN : at32f413_usb.h
  • USB_INOUT_FLAG : at32f413_usb.h
  • USB_INTERFACE_ASSOCIATION_TYPE : cdc_msc_desc.c
  • USB_INTERFACE_STRING : usb_std.h
  • USB_LANGID_STRING : usb_std.h
  • USB_LOW_POWER_WAKUP : project/at_start_f413/examples/usb_device/keyboard/inc/usb_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/usb_conf.h
  • USB_LSOF_FLAG : at32f413_usb.h
  • USB_LSOF_INT : at32f413_usb.h
  • USB_MAX_EP0_SIZE : usb_std.h
  • USB_MFC_STRING : usb_std.h
  • USB_MODULE_ENABLED : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • USB_OUT_EPT_DOUBLE_BUF0 : at32f413_usb.h
  • USB_PACKET_BUFFER_ADDRESS : at32f413_usb.h
  • USB_PACKET_BUFFER_ADDRESS_EX : at32f413_usb.h
  • USB_PRODUCT_STRING : usb_std.h
  • USB_REQ_DIR_DTH : usb_std.h
  • USB_REQ_DIR_HTD : usb_std.h
  • USB_REQ_RECIPIENT_DEVICE : usb_std.h
  • USB_REQ_RECIPIENT_ENDPOINT : usb_std.h
  • USB_REQ_RECIPIENT_INTERFACE : usb_std.h
  • USB_REQ_RECIPIENT_MASK : usb_std.h
  • USB_REQ_RECIPIENT_OTHER : usb_std.h
  • USB_REQ_TYPE_CLASS : usb_std.h
  • USB_REQ_TYPE_RESERVED : usb_std.h
  • USB_REQ_TYPE_STANDARD : usb_std.h
  • USB_REQ_TYPE_VENDOR : usb_std.h
  • USB_RST_FLAG : at32f413_usb.h
  • USB_RST_INT : at32f413_usb.h
  • USB_RX_DISABLE : at32f413_usb.h
  • USB_RX_MASK : at32f413_usb.h
  • USB_RX_NAK : at32f413_usb.h
  • USB_RX_STALL : at32f413_usb.h
  • USB_RX_VALID : at32f413_usb.h
  • USB_RXDTS : at32f413_usb.h
  • USB_RXDTS0 : at32f413_usb.h
  • USB_RXDTS1 : at32f413_usb.h
  • USB_RXSTS : at32f413_usb.h
  • USB_RXTC : at32f413_usb.h
  • USB_SERIAL_STRING : usb_std.h
  • USB_SET_DOUBLE_BUFF0_ADDRESS : at32f413_usb.h
  • USB_SET_DOUBLE_BUFF1_ADDRESS : at32f413_usb.h
  • USB_SET_EPT_ADDRESS : at32f413_usb.h
  • USB_SET_EPT_DOUBLE_BUF0_LEN : at32f413_usb.h
  • USB_SET_EPT_DOUBLE_BUF1_LEN : at32f413_usb.h
  • USB_SET_EPT_DOUBLE_BUFFER : at32f413_usb.h
  • USB_SET_EXF : at32f413_usb.h
  • USB_SET_RX_ADDRESS : at32f413_usb.h
  • USB_SET_RXLEN : at32f413_usb.h
  • USB_SET_RXLEN_REG : at32f413_usb.h
  • USB_SET_RXSTS : at32f413_usb.h
  • USB_SET_TRANS_TYPE : at32f413_usb.h
  • USB_SET_TX_ADDRESS : at32f413_usb.h
  • USB_SET_TXLEN : at32f413_usb.h
  • USB_SET_TXSTS : at32f413_usb.h
  • USB_SETUPTC : at32f413_usb.h
  • USB_SOF_FLAG : at32f413_usb.h
  • USB_SOF_INT : at32f413_usb.h
  • USB_SP_FLAG : at32f413_usb.h
  • USB_SP_INT : at32f413_usb.h
  • USB_STD_REQ_CLEAR_FEATURE : usb_std.h
  • USB_STD_REQ_GET_CONFIGURATION : usb_std.h
  • USB_STD_REQ_GET_DESCRIPTOR : usb_std.h
  • USB_STD_REQ_GET_INTERFACE : usb_std.h
  • USB_STD_REQ_GET_STATUS : usb_std.h
  • USB_STD_REQ_SET_ADDRESS : usb_std.h
  • USB_STD_REQ_SET_CONFIGURATION : usb_std.h
  • USB_STD_REQ_SET_DESCRIPTOR : usb_std.h
  • USB_STD_REQ_SET_FEATURE : usb_std.h
  • USB_STD_REQ_SET_INTERFACE : usb_std.h
  • USB_STD_REQ_SYNCH_FRAME : usb_std.h
  • USB_TC_FLAG : at32f413_usb.h
  • USB_TC_INT : at32f413_usb.h
  • USB_TOGGLE_RXDTS : at32f413_usb.h
  • USB_TOGGLE_TXDTS : at32f413_usb.h
  • USB_TRANS_TYPE : at32f413_usb.h
  • USB_TX_DISABLE : at32f413_usb.h
  • USB_TX_MASK : at32f413_usb.h
  • USB_TX_NAK : at32f413_usb.h
  • USB_TX_STALL : at32f413_usb.h
  • USB_TX_VALID : at32f413_usb.h
  • USB_TXDTS : at32f413_usb.h
  • USB_TXDTS0 : at32f413_usb.h
  • USB_TXDTS1 : at32f413_usb.h
  • USB_TXSTS : at32f413_usb.h
  • USB_TXTC : at32f413_usb.h
  • USB_UCFOR_FLAG : at32f413_usb.h
  • USB_UCFOR_INT : at32f413_usb.h
  • USB_VIRTUAL_COMPORT : project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h
  • USB_WINUSB_COMPAT_ID : usb_std.h
  • USB_WINUSB_OS_STRING : usb_std.h
  • USB_WINUSB_PROPERTIES_ID : usb_std.h
  • USB_WK_FLAG : at32f413_usb.h
  • USB_WK_INT : at32f413_usb.h
  • USBD_AUDIO_CONFIG_DESC_SIZE : audio_desc.h
  • USBD_AUDIO_DESC_CONFIGURATION_STRING : audio_desc.h
  • USBD_AUDIO_DESC_INTERFACE_STRING : audio_desc.h
  • USBD_AUDIO_DESC_MANUFACTURER_STRING : audio_desc.h
  • USBD_AUDIO_DESC_PRODUCT_STRING : audio_desc.h
  • USBD_AUDIO_FEEDBACK_EPT : audio_class.h
  • USBD_AUDIO_MIC_IN_EPT : audio_class.h
  • USBD_AUDIO_PRODUCT_ID : audio_desc.h
  • USBD_AUDIO_SIZ_STRING_LANGID : audio_desc.h
  • USBD_AUDIO_SIZ_STRING_SERIAL : audio_desc.h
  • USBD_AUDIO_SPK_OUT_EPT : audio_class.h
  • USBD_AUDIO_VENDOR_ID : audio_desc.h
  • USBD_AUHID_AUDIO_FEEDBACK_EPT : audio_hid_class.h
  • USBD_AUHID_AUDIO_MIC_IN_EPT : audio_hid_class.h
  • USBD_AUHID_AUDIO_SPK_OUT_EPT : audio_hid_class.h
  • USBD_AUHID_CONFIG_DESC_SIZE : audio_hid_desc.h
  • USBD_AUHID_DESC_CONFIGURATION_STRING : audio_hid_desc.h
  • USBD_AUHID_DESC_INTERFACE_STRING : audio_hid_desc.h
  • USBD_AUHID_DESC_MANUFACTURER_STRING : audio_hid_desc.h
  • USBD_AUHID_DESC_PRODUCT_STRING : audio_hid_desc.h
  • USBD_AUHID_HID_DESC_SIZE : audio_hid_desc.h
  • USBD_AUHID_HID_IN_EPT : audio_hid_class.h
  • USBD_AUHID_HID_OUT_EPT : audio_hid_class.h
  • USBD_AUHID_HID_SIZ_REPORT_DESC : audio_hid_desc.h
  • USBD_AUHID_IN_MAXPACKET_SIZE : audio_hid_class.h
  • USBD_AUHID_OUT_MAXPACKET_SIZE : audio_hid_class.h
  • USBD_AUHID_PRODUCT_ID : audio_hid_desc.h
  • USBD_AUHID_SIZ_STRING_LANGID : audio_hid_desc.h
  • USBD_AUHID_SIZ_STRING_SERIAL : audio_hid_desc.h
  • USBD_AUHID_VENDOR_ID : audio_hid_desc.h
  • USBD_CDC_BULK_IN_EPT : cdc_class.h, cdc_msc_class.h
  • USBD_CDC_BULK_OUT_EPT : cdc_class.h, cdc_msc_class.h
  • USBD_CDC_CMD_MAXPACKET_SIZE : cdc_class.h, cdc_msc_class.h
  • USBD_CDC_CONFIG_DESC_SIZE : cdc_desc.h
  • USBD_CDC_CS_ENDPOINT : usb_std.h
  • USBD_CDC_CS_INTERFACE : usb_std.h
  • USBD_CDC_DESC_CONFIGURATION_STRING : cdc_desc.h, cdc_msc_desc.h
  • USBD_CDC_DESC_INTERFACE_STRING : cdc_desc.h, cdc_msc_desc.h
  • USBD_CDC_DESC_MANUFACTURER_STRING : cdc_desc.h, cdc_msc_desc.h
  • USBD_CDC_DESC_PRODUCT_STRING : cdc_desc.h, cdc_msc_desc.h
  • USBD_CDC_IN_MAXPACKET_SIZE : cdc_class.h
  • USBD_CDC_INT_EPT : cdc_class.h, cdc_msc_class.h
  • USBD_CDC_MSC_CONFIG_DESC_SIZE : cdc_msc_desc.h
  • USBD_CDC_MSC_IN_MAXPACKET_SIZE : cdc_msc_class.h
  • USBD_CDC_MSC_OUT_MAXPACKET_SIZE : cdc_msc_class.h
  • USBD_CDC_MSC_PRODUCT_ID : cdc_msc_desc.h
  • USBD_CDC_MSC_VENDOR_ID : cdc_msc_desc.h
  • USBD_CDC_OUT_MAXPACKET_SIZE : cdc_class.h
  • USBD_CDC_PRODUCT_ID : cdc_desc.h
  • USBD_CDC_SIZ_STRING_LANGID : cdc_desc.h, cdc_msc_desc.h
  • USBD_CDC_SIZ_STRING_SERIAL : cdc_desc.h, cdc_msc_desc.h
  • USBD_CDC_SUBTYPE_ACM : usb_std.h
  • USBD_CDC_SUBTYPE_CMF : usb_std.h
  • USBD_CDC_SUBTYPE_HEADER : usb_std.h
  • USBD_CDC_SUBTYPE_UFD : usb_std.h
  • USBD_CDC_VENDOR_ID : cdc_desc.h
  • USBD_CUSHID_CONFIG_DESC_SIZE : custom_hid_desc.h
  • USBD_CUSHID_DESC_CONFIGURATION_STRING : custom_hid_desc.h
  • USBD_CUSHID_DESC_INTERFACE_STRING : custom_hid_desc.h
  • USBD_CUSHID_DESC_MANUFACTURER_STRING : custom_hid_desc.h
  • USBD_CUSHID_DESC_PRODUCT_STRING : custom_hid_desc.h
  • USBD_CUSHID_PRODUCT_ID : custom_hid_desc.h
  • USBD_CUSHID_SIZ_REPORT_DESC : custom_hid_desc.h
  • USBD_CUSHID_SIZ_STRING_LANGID : custom_hid_desc.h
  • USBD_CUSHID_SIZ_STRING_SERIAL : custom_hid_desc.h
  • USBD_CUSHID_VENDOR_ID : custom_hid_desc.h
  • USBD_CUSTOM_HID_IN_EPT : custom_hid_class.h
  • USBD_CUSTOM_HID_OUT_EPT : custom_hid_class.h
  • USBD_CUSTOM_IN_MAXPACKET_SIZE : custom_hid_class.h
  • USBD_CUSTOM_OUT_MAXPACKET_SIZE : custom_hid_class.h
  • USBD_FS_WINUSB_MAXPACKET_SIZE : winusb_class.h
  • USBD_HIDIAP_CONFIG_DESC_SIZE : hid_iap_desc.h
  • USBD_HIDIAP_DESC_CONFIGURATION_STRING : hid_iap_desc.h
  • USBD_HIDIAP_DESC_INTERFACE_STRING : hid_iap_desc.h
  • USBD_HIDIAP_DESC_MANUFACTURER_STRING : hid_iap_desc.h
  • USBD_HIDIAP_DESC_PRODUCT_STRING : hid_iap_desc.h
  • USBD_HIDIAP_IN_EPT : hid_iap_class.h
  • USBD_HIDIAP_IN_MAXPACKET_SIZE : hid_iap_class.h
  • USBD_HIDIAP_OUT_EPT : hid_iap_class.h
  • USBD_HIDIAP_OUT_MAXPACKET_SIZE : hid_iap_class.h
  • USBD_HIDIAP_PRODUCT_ID : hid_iap_desc.h
  • USBD_HIDIAP_SIZ_REPORT_DESC : hid_iap_desc.h
  • USBD_HIDIAP_SIZ_STRING_LANGID : hid_iap_desc.h
  • USBD_HIDIAP_SIZ_STRING_SERIAL : hid_iap_desc.h
  • USBD_HIDIAP_VENDOR_ID : hid_iap_desc.h
  • USBD_IN_MAXPACKET_SIZE : msc_class.h
  • USBD_KEYBOARD_CONFIG_DESC_SIZE : keyboard_desc.h
  • USBD_KEYBOARD_DESC_CONFIGURATION_STRING : keyboard_desc.h
  • USBD_KEYBOARD_DESC_INTERFACE_STRING : keyboard_desc.h
  • USBD_KEYBOARD_DESC_MANUFACTURER_STRING : keyboard_desc.h
  • USBD_KEYBOARD_DESC_PRODUCT_STRING : keyboard_desc.h
  • USBD_KEYBOARD_IN_EPT : keyboard_class.h
  • USBD_KEYBOARD_IN_MAXPACKET_SIZE : keyboard_class.h
  • USBD_KEYBOARD_OUT_MAXPACKET_SIZE : keyboard_class.h
  • USBD_KEYBOARD_PRODUCT_ID : keyboard_desc.h
  • USBD_KEYBOARD_SIZ_REPORT_DESC : keyboard_desc.h
  • USBD_KEYBOARD_SIZ_STRING_LANGID : keyboard_desc.h
  • USBD_KEYBOARD_SIZ_STRING_SERIAL : keyboard_desc.h
  • USBD_KEYBOARD_VENDOR_ID : keyboard_desc.h
  • USBD_MOUSE_CONFIG_DESC_SIZE : mouse_desc.h
  • USBD_MOUSE_DESC_CONFIGURATION_STRING : mouse_desc.h
  • USBD_MOUSE_DESC_INTERFACE_STRING : mouse_desc.h
  • USBD_MOUSE_DESC_MANUFACTURER_STRING : mouse_desc.h
  • USBD_MOUSE_DESC_PRODUCT_STRING : mouse_desc.h
  • USBD_MOUSE_IN_EPT : mouse_class.h
  • USBD_MOUSE_IN_MAXPACKET_SIZE : mouse_class.h
  • USBD_MOUSE_PRODUCT_ID : mouse_desc.h
  • USBD_MOUSE_SIZ_REPORT_DESC : mouse_desc.h
  • USBD_MOUSE_SIZ_STRING_LANGID : mouse_desc.h
  • USBD_MOUSE_SIZ_STRING_SERIAL : mouse_desc.h
  • USBD_MOUSE_VENDOR_ID : mouse_desc.h
  • USBD_MSC_BULK_IN_EPT : cdc_msc_class.h, msc_class.h
  • USBD_MSC_BULK_OUT_EPT : cdc_msc_class.h, msc_class.h
  • USBD_MSC_CONFIG_DESC_SIZE : msc_desc.h
  • USBD_MSC_DESC_CONFIGURATION_STRING : msc_desc.h
  • USBD_MSC_DESC_INTERFACE_STRING : msc_desc.h
  • USBD_MSC_DESC_MANUFACTURER_STRING : msc_desc.h
  • USBD_MSC_DESC_PRODUCT_STRING : msc_desc.h
  • USBD_MSC_PRODUCT_ID : msc_desc.h
  • USBD_MSC_SIZ_STRING_LANGID : msc_desc.h
  • USBD_MSC_SIZ_STRING_SERIAL : msc_desc.h
  • USBD_MSC_VENDOR_ID : msc_desc.h
  • USBD_OUT_MAXPACKET_SIZE : msc_class.h
  • USBD_PRINTER_BULK_IN_EPT : printer_class.h
  • USBD_PRINTER_BULK_OUT_EPT : printer_class.h
  • USBD_PRINTER_CONFIG_DESC_SIZE : printer_desc.h
  • USBD_PRINTER_DESC_CONFIGURATION_STRING : printer_desc.h
  • USBD_PRINTER_DESC_INTERFACE_STRING : printer_desc.h
  • USBD_PRINTER_DESC_MANUFACTURER_STRING : printer_desc.h
  • USBD_PRINTER_DESC_PRODUCT_STRING : printer_desc.h
  • USBD_PRINTER_IN_MAXPACKET_SIZE : printer_class.h
  • USBD_PRINTER_OUT_MAXPACKET_SIZE : printer_class.h
  • USBD_PRINTER_PRODUCT_ID : printer_desc.h
  • USBD_PRINTER_SIZ_STRING_LANGID : printer_desc.h
  • USBD_PRINTER_SIZ_STRING_SERIAL : printer_desc.h
  • USBD_PRINTER_VENDOR_ID : printer_desc.h
  • USBD_SUPPORT_WINUSB : project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h
  • USBD_VCPKYBRD_CDC_BULK_IN_EPT : cdc_keyboard_class.h
  • USBD_VCPKYBRD_CDC_BULK_OUT_EPT : cdc_keyboard_class.h
  • USBD_VCPKYBRD_CDC_INT_EPT : cdc_keyboard_class.h
  • USBD_VCPKYBRD_CMD_MAXPACKET_SIZE : cdc_keyboard_class.h
  • USBD_VCPKYBRD_CONFIG_DESC_SIZE : cdc_keyboard_desc.h
  • USBD_VCPKYBRD_DESC_CONFIGURATION_STRING : cdc_keyboard_desc.h
  • USBD_VCPKYBRD_DESC_INTERFACE_STRING : cdc_keyboard_desc.h
  • USBD_VCPKYBRD_DESC_MANUFACTURER_STRING : cdc_keyboard_desc.h
  • USBD_VCPKYBRD_DESC_PRODUCT_STRING : cdc_keyboard_desc.h
  • USBD_VCPKYBRD_HID_IN_EPT : cdc_keyboard_class.h
  • USBD_VCPKYBRD_HID_SIZ_REPORT_DESC : cdc_keyboard_desc.h
  • USBD_VCPKYBRD_IN_MAXPACKET_SIZE : cdc_keyboard_class.h
  • USBD_VCPKYBRD_OUT_MAXPACKET_SIZE : cdc_keyboard_class.h
  • USBD_VCPKYBRD_PRODUCT_ID : cdc_keyboard_desc.h
  • USBD_VCPKYBRD_SIZ_STRING_LANGID : cdc_keyboard_desc.h
  • USBD_VCPKYBRD_SIZ_STRING_SERIAL : cdc_keyboard_desc.h
  • USBD_VCPKYBRD_VENDOR_ID : cdc_keyboard_desc.h
  • USBD_WINUSB_BULK_IN_EPT : winusb_class.h
  • USBD_WINUSB_BULK_OUT_EPT : winusb_class.h
  • USBD_WINUSB_CONFIG_DESC_SIZE : winusb_desc.h
  • USBD_WINUSB_DESC_CONFIGURATION_STRING : winusb_desc.h
  • USBD_WINUSB_DESC_INTERFACE_STRING : winusb_desc.h
  • USBD_WINUSB_DESC_MANUFACTURER_STRING : winusb_desc.h
  • USBD_WINUSB_DESC_PRODUCT_STRING : winusb_desc.h
  • USBD_WINUSB_IN_MAXPACKET_SIZE : winusb_class.h
  • USBD_WINUSB_OUT_MAXPACKET_SIZE : winusb_class.h
  • USBD_WINUSB_PRODUCT_ID : winusb_desc.h
  • USBD_WINUSB_SIZ_STRING_LANGID : winusb_desc.h
  • USBD_WINUSB_SIZ_STRING_SERIAL : winusb_desc.h
  • USBD_WINUSB_VENDOR_ID : winusb_desc.h
  • USBFS_BASE : at32f413.h
  • USD : at32f413_flash.h
  • USD_BASE : at32f413.h
  • USD_DEPSLP_NO_RST : at32f413_flash.h
  • USD_DEPSLP_RST : at32f413_flash.h
  • USD_STDBY_NO_RST : at32f413_flash.h
  • USD_STDBY_RST : at32f413_flash.h
  • USD_WDT_ATO_DISABLE : at32f413_flash.h
  • USD_WDT_ATO_ENABLE : at32f413_flash.h
  • USE_SLIB_FUNCTION : utilities/at32f413_slib_demo/project_l0/src/main.c
  • USE_STATIC_INIT : project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c
  • USER_BUTTON_CRM_CLK : at32f413_board.h
  • USER_BUTTON_PIN : at32f413_board.h
  • USER_BUTTON_PORT : at32f413_board.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all macros with links to the files they belong to:

- v -

  • VARIABLES_GET_BIT : project/at_start_f413/examples/cortex_m4/bit_band/src/main.c
  • VARIABLES_RESET_BIT : project/at_start_f413/examples/cortex_m4/bit_band/src/main.c
  • VARIABLES_SET_BIT : project/at_start_f413/examples/cortex_m4/bit_band/src/main.c
  • VCPKYBRD_BCD_NUM : cdc_keyboard_desc.h
  • VCPKYBRD_CDC_DATA_INTERFACE : cdc_keyboard_desc.h
  • VCPKYBRD_CDC_INTERFACE : cdc_keyboard_desc.h
  • VCPKYBRD_HID_BINTERVAL_TIME : cdc_keyboard_desc.h
  • VCPKYBRD_KEYBOARD_INTERFACE : cdc_keyboard_desc.h
  • VCPMSC_CDC_DATA_INTERFACE : cdc_msc_desc.h
  • VCPMSC_CDC_INTERFACE : cdc_msc_desc.h
  • VCPMSC_MSC_INTERFACE : cdc_msc_desc.h
  • VECT_TAB_OFFSET : system_at32f413.c
  • vPortSVCHandler : FreeRTOSConfig.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all macros with links to the files they belong to:

- w -

  • W25Q128 : spi_flash.h
  • W25Q16 : spi_flash.h
  • W25Q32 : spi_flash.h
  • W25Q64 : spi_flash.h
  • W25Q80 : spi_flash.h
  • WDT : at32f413_wdt.h
  • WDT_BASE : at32f413.h
  • WDT_DIVF_UPDATE_FLAG : at32f413_wdt.h
  • WDT_MODULE_ENABLED : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
  • WDT_RLDF_UPDATE_FLAG : at32f413_wdt.h
  • WINUSB_BMS_VENDOR_CODE : winusb_class.h
  • WM8988_I2C_ADDR_CSB_HIGH : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_I2C_ADDR_CSB_LOW : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R0_LEFT_INPUT_VOLUME : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R10_LEFT_DAC_VOLUME : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R11_RIGHT_DAC_VOLUME : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R12_BASS_CONTROL : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R13_TREBLE_CONTROL : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R14_ : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R15_RESET : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R16_3D_CONTROL : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R17_ALC1 : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R18_ALC2 : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R19_ALC3 : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R1_RIGHT_INPUT_VOLUME : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R20_NOISE_GATE : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R21_LEFT_ADC_VOLUME : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R22_RIGHT_ADC_VOLUME : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R23_ADDITIONAL_1_CONTROL : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R24_ADDITIONAL_2_CONTROL : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R25_PWR_1_MGMT : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R26_PWR_2_MGMT : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R27_ADDITIONAL_3_CONTROL : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R2_LOUT1_VOLUME : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R31_ADC_INPUT_MODE : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R32_ADC_L_SIGNAL_PATH : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R33_ADC_R_SIGNAL_PATH : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R34_LEFT_OUT_MIX_1 : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R35_LEFT_OUT_MIX_2 : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R36_RIGHT_OUT_MIX_1 : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R37_RIGHT_OUT_MIX_2 : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R38_RESERVED : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R39_RESERVED : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R3_ROUT1_VOLUME : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R40_LOUT2_VOLUME : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R41_ROUT2_VOLUME : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R42_RESERVED : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R43_LOW_POWER_PALYBACK : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R4_RESERVED : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R5_ADC_DAC_CONTROL : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R6_RESERVED : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R7_AUDIO_INTERFACE : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R8_SAMPLE_RATE : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_R9_RESERVED : audio/inc/audio_codec.h, composite_audio_hid/inc/audio_codec.h
  • WM8988_REG_BITW16 : audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • WM8988_REG_FREQ16K : audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • WM8988_REG_FREQ48K : audio/src/audio_codec.c, composite_audio_hid/src/audio_codec.c
  • WWDT : at32f413_wwdt.h
  • WWDT_BASE : at32f413.h
  • WWDT_EN_BIT : at32f413_wwdt.h
  • WWDT_MODULE_ENABLED : project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h, project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h, project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h, project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h, project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h, project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h, project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h, project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h, project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h, project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h, project/at_start_f413/examples/can/filter/inc/at32f413_conf.h, project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h, project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h, project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h, project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h, project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h, project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h, project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h, project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h, project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h, project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h, project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h, project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h, project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h, project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h, project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h, project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h, project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h, project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h, project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h, project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h, project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h, project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h, project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h, project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h, project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h, project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h, project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h, project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h, project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h, project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h, project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h, project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h, project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h, project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h, project/at_start_f413/templates/inc/at32f413_conf.h, utilities/at32f413_freertos_demo/inc/at32f413_conf.h, utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h, utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h, utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all macros with links to the files they belong to:

- x -

  • XMC_REG_BASE : at32f413.h
  • xPortPendSVHandler : FreeRTOSConfig.h
  • xPortSysTickHandler : FreeRTOSConfig.h


AT32F413 Firmwary Library: Globals

  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Macros
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • k
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • z
Here is a list of all macros with links to the files they belong to:

- z -

  • ZOOM : project/at_start_f413/examples/cortex_m4/fpu/src/main.c


AT32F413 Firmwary Library: FreeRTOSConfig.h Source File

  • utilities
  • at32f413_freertos_demo
  • inc
FreeRTOSConfig.h
Go to the documentation of this file.
1/*
2 FreeRTOS V10.4.3 - Copyright (C) 2020 Real Time Engineers Ltd.
3 All rights reserved
4
5 VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
6
7 This file is part of the FreeRTOS distribution.
8
9 FreeRTOS is free software; you can redistribute it and/or modify it under
10 the terms of the GNU General Public License (version 2) as published by the
11 Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
12
13 ***************************************************************************
14 >>! NOTE: The modification to the GPL is included to allow you to !<<
15 >>! distribute a combined work that includes FreeRTOS without being !<<
16 >>! obliged to provide the source code for proprietary components !<<
17 >>! outside of the FreeRTOS kernel. !<<
18 ***************************************************************************
19
20 FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
21 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
22 FOR A PARTICULAR PURPOSE. Full license text is available on the following
23 link: http://www.freertos.org/a00114.html
24
25 ***************************************************************************
26 * *
27 * FreeRTOS provides completely free yet professionally developed, *
28 * robust, strictly quality controlled, supported, and cross *
29 * platform software that is more than just the market leader, it *
30 * is the industry's de facto standard. *
31 * *
32 * Help yourself get started quickly while simultaneously helping *
33 * to support the FreeRTOS project by purchasing a FreeRTOS *
34 * tutorial book, reference manual, or both: *
35 * http://www.FreeRTOS.org/Documentation *
36 * *
37 ***************************************************************************
38
39 http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
40 the FAQ page "My application does not run, what could be wrong?". Have you
41 defined configASSERT()?
42
43 http://www.FreeRTOS.org/support - In return for receiving this top quality
44 embedded software for free we request you assist our global community by
45 participating in the support forum.
46
47 http://www.FreeRTOS.org/training - Investing in training allows your team to
48 be as productive as possible as early as possible. Now you can receive
49 FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
50 Ltd, and the world's leading authority on the world's leading RTOS.
51
52 http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
53 including FreeRTOS+Trace - an indispensable productivity tool, a DOS
54 compatible FAT file system, and our tiny thread aware UDP/IP stack.
55
56 http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
57 Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
58
59 http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
60 Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
61 licenses offer ticketed support, indemnification and commercial middleware.
62
63 http://www.SafeRTOS.com - High Integrity Systems also provide a safety
64 engineered and independently SIL3 certified version for use in safety and
65 mission critical applications that require provable dependability.
66
67 1 tab == 4 spaces!
68*/
69
70#ifndef FREERTOS_CONFIG_H
71#define FREERTOS_CONFIG_H
72
73#ifdef __cplusplus
74 extern "C" {
75#endif
76
77#if defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__)
78 #include <stdint.h>
79 #include "system_at32f413.h"
80#endif
81
82
83
84/*-----------------------------------------------------------
85 * Application specific definitions.
86 *
87 * These definitions should be adjusted for your particular hardware and
88 * application requirements.
89 *
90 * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
91 * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
92 *
93 * See http://www.freertos.org/a00110.html.
94 *----------------------------------------------------------*/
95#define configUSE_PREEMPTION 1
96#define configUSE_IDLE_HOOK 0
97#define configUSE_TICK_HOOK 0
98#define configCPU_CLOCK_HZ ( ( unsigned long ) system_core_clock )
99#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
100#define configMAX_PRIORITIES ( 5 )
101#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 128 )
102#define configSUPPORT_DYNAMIC_ALLOCATION 1
103#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 8 * 1024 ) )
104#define configMAX_TASK_NAME_LEN ( 16 )
105#define configUSE_16_BIT_TICKS 0
106#define configIDLE_SHOULD_YIELD 1
107
108
109/* Co-routine definitions. */
110#define configUSE_CO_ROUTINES 0
111#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
112
113/* Set the following definitions to 1 to include the API function, or zero
114to exclude the API function. */
115
116#define INCLUDE_vTaskPrioritySet 1
117#define INCLUDE_uxTaskPriorityGet 1
118#define INCLUDE_vTaskDelete 1
119#define INCLUDE_vTaskCleanUpResources 0
120#define INCLUDE_vTaskSuspend 1
121#define INCLUDE_vTaskDelayUntil 1
122#define INCLUDE_vTaskDelay 1
123#define INCLUDE_xTaskGetCurrentTaskHandle 1
124/* Cortex-M specific definitions. */
125#ifdef __NVIC_PRIO_BITS
126 /* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */
127 #define configPRIO_BITS __NVIC_PRIO_BITS
128#else
129 #define configPRIO_BITS 4 /* 15 priority levels */
130#endif
131
132/* The lowest interrupt priority that can be used in a call to a "set priority"
133function. */
134#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0x0f
135
136/* The highest interrupt priority that can be used by any interrupt service
137routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
138INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
139PRIORITY THAN THIS! (higher priorities are lower numeric values. */
140#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 0x01
141
142/* Interrupt priorities used by the kernel port layer itself. These are generic
143to all Cortex-M ports, and do not rely on any particular library functions. */
144#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
145/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
146See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
147#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
148
149/* Normal assert() semantics without relying on the provision of an assert.h
150header file. */
151#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); }
152
153/* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS
154standard names. */
155#define vPortSVCHandler SVC_Handler
156#define xPortPendSVHandler PendSV_Handler
157#define xPortSysTickHandler SysTick_Handler
158
159#ifdef __cplusplus
160 }
161#endif
162
163#endif /* FREERTOS_CONFIG_H */
164
system_at32f413.h
cmsis cortex-m4 system header file.


AT32F413 Firmwary Library: hid_iap_user.h Source File

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • app_led3_toggle
  • inc
app_led3_toggle/inc/hid_iap_user.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __HID_IAP_USER_H
28#define __HID_IAP_USER_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "hid_iap_class.h"
35
48#define FLASH_APP_ADDRESS 0x08006000
49
58void iap_init(void);
59 iap_result_type iap_get_upgrade_flag(void);
60void app_loop(void);
61
74#ifdef __cplusplus
75}
76#endif
77
78#endif
79
iap_result_type
iap_result_type
Definition hid_iap_class.h:85
iap_init
void iap_init(void)
iap init.
Definition app_led3_toggle/src/iap.c:60
iap_get_upgrade_flag
iap_result_type iap_get_upgrade_flag(void)
get iap upgrade complete flag
Definition app_led3_toggle/src/hid_iap_user.c:78
app_loop
void app_loop(void)
iap loop
Definition app_led3_toggle/src/hid_iap_user.c:252
hid_iap_class.h
usb hid iap header file


AT32F413 Firmwary Library: iap.h Source File

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led3_toggle
  • inc
app_led3_toggle/inc/iap.h
Go to the documentation of this file.
1
26#ifndef __IAP_H__
27#define __IAP_H__
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33#include "at32f413_board.h"
34
47/* app starting address */
48#define APP_START_ADDR 0x08004000
49
50/* the previous sector of app starting address is iap upgrade flag */
51#define IAP_UPGRADE_FLAG_ADDR (APP_START_ADDR - 0x800)
52
53/* when app received cmd 0x5aa5 from pc-tool, will set up the flag,
54indicates that an app upgrade will follow, see iap application note for more details */
55#define IAP_UPGRADE_FLAG 0x41544B38
56
65void iap_command_handle(void);
66void iap_init(void);
67
80#ifdef __cplusplus
81}
82#endif
83
84#endif
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
iap_init
void iap_init(void)
iap init.
Definition app_led3_toggle/src/iap.c:60
iap_command_handle
void iap_command_handle(void)
iap command handle handle.
Definition app_led3_toggle/src/iap.c:43


AT32F413 Firmwary Library: tmr.h Source File

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led3_toggle
  • inc
app_led3_toggle/inc/tmr.h
Go to the documentation of this file.
1
26#ifndef __TMR_H
27#define __TMR_H
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33#include "at32f413_board.h"
34
47void tmr_init(void);
48
61#ifdef __cplusplus
62}
63#endif
64
65#endif
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
tmr_init
void tmr_init(void)
init tmr.
Definition app_led3_toggle/src/tmr.c:43


AT32F413 Firmwary Library: usart.h Source File

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led3_toggle
  • inc
app_led3_toggle/inc/usart.h
Go to the documentation of this file.
1
26#ifndef __USART_H
27#define __USART_H
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33#include "at32f413_board.h"
34
35extern uint8_t iap_flag;
36
49#define IAP_REV_FLAG_NO 0
50#define IAP_REV_FLAG_5A 1
51#define IAP_REV_FLAG_DONE 2
52#define IAP_REV_FLAG_ERROR 3
53
62void uart_init(uint32_t baudrate);
63void back_ok(void);
64void back_err(void);
65
78#ifdef __cplusplus
79}
80#endif
81
82#endif
83
84
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
iap_flag
uint8_t iap_flag
Definition app_led3_toggle/src/usart.c:37
uart_init
void uart_init(uint32_t baudrate)
init usart.
Definition app_led3_toggle/src/usart.c:44
back_err
void back_err(void)
command response error.
Definition app_led3_toggle/src/usart.c:119
back_ok
void back_ok(void)
command response ok.
Definition app_led3_toggle/src/usart.c:106


AT32F413 Firmwary Library: hid_iap_user.c Source File

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • app_led3_toggle
  • src
app_led3_toggle/src/hid_iap_user.c
Go to the documentation of this file.
1
26#include "hid_iap_user.h"
27#include "hid_iap_class.h"
28#include "string.h"
29
38void (*pftarget)(void);
39void iap_clear_upgrade_flag(void);
40void iap_set_upgrade_flag(void);
41uint32_t crc_cal(uint32_t addr, uint16_t nk);
42
43void iap_idle(void);
44void iap_start(void);
45void iap_finish(void);
46void iap_jump(void);
47void iap_respond(uint8_t *res_buf, uint16_t iap_cmd, uint16_t result);
48
54void iap_clear_upgrade_flag(void)
55{
56 flash_unlock();
57 flash_sector_erase(iap_info.flag_address);
58 flash_lock();
59}
60
66void iap_set_upgrade_flag(void)
67{
68 flash_unlock();
69 flash_word_program(iap_info.flag_address, IAP_UPGRADE_COMPLETE_FLAG);
70 flash_lock();
71}
72
78 iap_result_type iap_get_upgrade_flag(void)
79{
80 uint32_t flag_address = iap_info.flag_address;
81 if(*((uint32_t *)flag_address) == IAP_UPGRADE_COMPLETE_FLAG)
82 {
83 return IAP_SUCCESS;
84 }
85 else
86 {
87 return IAP_FAILED;
88 }
89}
90
96void iap_init(void)
97{
98 iap_info.flash_size = KB_TO_B(FLASH_SIZE_REG());
99 if(iap_info.flash_size < KB_TO_B(256))
100 {
101 iap_info.sector_size = SECTOR_SIZE_1K;
102 }
103 else
104 {
105 iap_info.sector_size = SECTOR_SIZE_2K;
106 }
107
108 iap_info.flash_start_address = FLASH_BASE;
109 iap_info.flash_end_address = iap_info.flash_start_address + iap_info.flash_size;
110
111 iap_info.app_address = FLASH_APP_ADDRESS;
112 iap_info.flag_address = iap_info.app_address - iap_info.sector_size;
113
114 iap_info.fifo_length = 0;
115 iap_info.iap_address = 0;
116}
117
123void iap_idle(void)
124{
125 iap_info.state = IAP_STS_JMP_WAIT;
126 iap_init();
127 iap_respond(iap_info.iap_tx, IAP_CMD_IDLE, IAP_ACK);
128}
129
135void iap_start(void)
136{
137 iap_info.state = IAP_STS_START;
138 iap_init();
139 iap_respond(iap_info.iap_tx, IAP_CMD_START, IAP_ACK);
140}
141
142/*
143 * @brief iap jump
144 * @param none
145 * @retval none
146 */
147void iap_jump()
148{
149 iap_info.state = IAP_STS_JMP_WAIT;
150 iap_respond(iap_info.iap_tx, IAP_CMD_JMP, IAP_ACK);
151}
152
153/*
154 * @brief iap get
155 * @param none
156 * @retval none
157 */
158void iap_get()
159{
160 iap_respond(iap_info.iap_tx, IAP_CMD_GET, IAP_ACK);
161 iap_info.iap_tx[4] = (uint8_t)((iap_info.app_address >> 24) & 0xFF);
162 iap_info.iap_tx[5] = (uint8_t)((iap_info.app_address >> 16) & 0xFF);
163 iap_info.iap_tx[6] = (uint8_t)((iap_info.app_address >> 8) & 0xFF);
164 iap_info.iap_tx[7] = (uint8_t)((iap_info.app_address) & 0xFF);
165}
166
167
168
169/*
170 * @brief iap respond
171 * @param res_buf: data buffer pointer.
172 * @param iap_cmd: iap command
173 * @param result: iap result
174 * @retval the result of the address parse
175 */
176void iap_respond(uint8_t *res_buf, uint16_t iap_cmd, uint16_t result)
177{
178 res_buf[0] = (uint8_t)((iap_cmd >> 8) & 0xFF);
179 res_buf[1] = (uint8_t)((iap_cmd) & 0xFF);
180 res_buf[2] = (uint8_t)((result >> 8) & 0xFF);
181 res_buf[3] = (uint8_t)((result) & 0xFF);
182
183 iap_info.respond_flag = 1;
184}
185
193 iap_result_type usbd_hid_iap_process(void *udev, uint8_t *pdata, uint16_t len)
194{
195 iap_result_type status = IAP_SUCCESS;
196 uint16_t iap_cmd;
197
198 if(len < 2)
199 {
200 return IAP_FAILED;
201 }
202
203 iap_info.respond_flag = 0;
204
205 iap_cmd = (pdata[0] << 8) | pdata[1];
206
207 switch(iap_cmd)
208 {
209 case IAP_CMD_IDLE:
210 iap_idle();
211 break;
212 case IAP_CMD_START:
213 iap_start();
214 break;
215 case IAP_CMD_JMP:
216 iap_jump();
217 break;
218 case IAP_CMD_GET:
219 iap_get();
220 break;
221 default:
222 status = IAP_FAILED;
223 break;
224 }
225
226 if(iap_info.respond_flag)
227 {
228 usb_iap_class_send_report(udev, iap_info.iap_tx, 64);
229 }
230
231 return status;
232}
233
239void usbd_hid_iap_in_complete(void *udev)
240{
241 if(iap_info.state == IAP_STS_JMP_WAIT)
242 {
243 iap_info.state = IAP_STS_JMP;
244 }
245}
246
252void app_loop(void)
253{
254 if(iap_info.state == IAP_STS_JMP)
255 {
256 iap_clear_upgrade_flag();
257 nvic_system_reset();
258 }
259}
260
SECTOR_SIZE_1K
#define SECTOR_SIZE_1K
Definition composite_vcp_msc/inc/msc_diskio.h:50
SECTOR_SIZE_2K
#define SECTOR_SIZE_2K
Definition composite_vcp_msc/inc/msc_diskio.h:51
flash_sector_erase
flash_status_type flash_sector_erase(uint32_t sector_address)
erase a specified flash sector.
Definition at32f413_flash.c:272
flash_unlock
void flash_unlock(void)
unlock the flash controller.
Definition at32f413_flash.c:228
flash_word_program
flash_status_type flash_word_program(uint32_t address, uint32_t data)
program a word at a specified address.
Definition at32f413_flash.c:414
flash_lock
void flash_lock(void)
lock the flash controller.
Definition at32f413_flash.c:251
nvic_system_reset
void nvic_system_reset(void)
system reset
Definition at32f413_misc.c:51
FLASH_BASE
#define FLASH_BASE
Definition at32f413.h:329
IAP_FAILED
#define IAP_FAILED
Definition flash_fat16.h:77
IAP_SUCCESS
#define IAP_SUCCESS
Definition flash_fat16.h:76
IAP_UPGRADE_COMPLETE_FLAG
#define IAP_UPGRADE_COMPLETE_FLAG
Definition flash_fat16.h:75
IAP_CMD_IDLE
#define IAP_CMD_IDLE
iap command
Definition hid_iap_class.h:67
IAP_CMD_GET
#define IAP_CMD_GET
Definition hid_iap_class.h:74
iap_result_type
iap_result_type
Definition hid_iap_class.h:85
IAP_ACK
#define IAP_ACK
Definition hid_iap_class.h:81
FLASH_SIZE_REG
#define FLASH_SIZE_REG()
Definition hid_iap_class.h:57
IAP_CMD_START
#define IAP_CMD_START
Definition hid_iap_class.h:68
IAP_CMD_JMP
#define IAP_CMD_JMP
Definition hid_iap_class.h:73
KB_TO_B
#define KB_TO_B(kb)
Definition hid_iap_class.h:58
IAP_STS_START
@ IAP_STS_START
Definition hid_iap_class.h:94
IAP_STS_JMP
@ IAP_STS_JMP
Definition hid_iap_class.h:100
IAP_STS_JMP_WAIT
@ IAP_STS_JMP_WAIT
Definition hid_iap_class.h:99
iap_info
iap_info_type iap_info
Definition hid_iap_class.c:53
usb_iap_class_send_report
usb_sts_type usb_iap_class_send_report(void *udev, uint8_t *report, uint16_t len)
usb device class send report
Definition hid_iap_class.c:325
iap_set_upgrade_flag
void iap_set_upgrade_flag(void)
set iap upgrade complete flag
Definition app_led3_toggle/src/hid_iap_user.c:66
iap_idle
void iap_idle(void)
iap idle function
Definition app_led3_toggle/src/hid_iap_user.c:123
iap_respond
void iap_respond(uint8_t *res_buf, uint16_t iap_cmd, uint16_t result)
Definition app_led3_toggle/src/hid_iap_user.c:176
iap_init
void iap_init(void)
iap init
Definition app_led3_toggle/src/hid_iap_user.c:96
usbd_hid_iap_process
iap_result_type usbd_hid_iap_process(void *udev, uint8_t *pdata, uint16_t len)
usb device iap function
Definition app_led3_toggle/src/hid_iap_user.c:193
crc_cal
uint32_t crc_cal(uint32_t addr, uint16_t nk)
crc cal
Definition bootloader/src/hid_iap_user.c:167
iap_get_upgrade_flag
iap_result_type iap_get_upgrade_flag(void)
get iap upgrade complete flag
Definition app_led3_toggle/src/hid_iap_user.c:78
iap_finish
void iap_finish(void)
Definition bootloader/src/hid_iap_user.c:327
iap_start
void iap_start(void)
iap start function
Definition app_led3_toggle/src/hid_iap_user.c:135
pftarget
void(* pftarget)(void)
Definition app_led3_toggle/src/hid_iap_user.c:38
iap_clear_upgrade_flag
void iap_clear_upgrade_flag(void)
clear iap upgrade flag
Definition app_led3_toggle/src/hid_iap_user.c:54
iap_get
void iap_get()
Definition app_led3_toggle/src/hid_iap_user.c:158
app_loop
void app_loop(void)
iap loop
Definition app_led3_toggle/src/hid_iap_user.c:252
iap_jump
void iap_jump(void)
Definition app_led3_toggle/src/hid_iap_user.c:147
usbd_hid_iap_in_complete
void usbd_hid_iap_in_complete(void *udev)
usb device in transfer complete function
Definition app_led3_toggle/src/hid_iap_user.c:239
FLASH_APP_ADDRESS
#define FLASH_APP_ADDRESS
Definition app_led3_toggle/inc/hid_iap_user.h:48
hid_iap_class.h
usb hid iap header file
iap_info_type::respond_flag
uint32_t respond_flag
Definition hid_iap_class.h:123
iap_info_type::flag_address
uint32_t flag_address
Definition hid_iap_class.h:115
iap_info_type::sector_size
uint32_t sector_size
Definition hid_iap_class.h:120
iap_info_type::iap_address
uint32_t iap_address
Definition hid_iap_class.h:114
iap_info_type::flash_start_address
uint32_t flash_start_address
Definition hid_iap_class.h:117
iap_info_type::flash_end_address
uint32_t flash_end_address
Definition hid_iap_class.h:118
iap_info_type::fifo_length
uint32_t fifo_length
Definition hid_iap_class.h:110
iap_info_type::flash_size
uint32_t flash_size
Definition hid_iap_class.h:121
iap_info_type::iap_tx
uint8_t iap_tx[0x40]
Definition hid_iap_class.h:108
iap_info_type::app_address
uint32_t app_address
Definition hid_iap_class.h:113
iap_info_type::state
iap_machine_state_type state
Definition hid_iap_class.h:132


AT32F413 Firmwary Library: iap.c Source File

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led3_toggle
  • src
app_led3_toggle/src/iap.c
Go to the documentation of this file.
1
26#include "iap.h"
27#include "usart.h"
28#include "tmr.h"
29
43void iap_command_handle(void)
44{
45 if(iap_flag==IAP_REV_FLAG_DONE)
46 {
47 flash_unlock();
48 flash_sector_erase(IAP_UPGRADE_FLAG_ADDR);
49 flash_word_program(IAP_UPGRADE_FLAG_ADDR, IAP_UPGRADE_FLAG);
50 flash_lock();
51 nvic_system_reset();
52 }
53}
54
60void iap_init(void)
61{
62 if((*(uint32_t*)IAP_UPGRADE_FLAG_ADDR) == IAP_UPGRADE_FLAG)
63 {
64 flash_unlock();
65 flash_sector_erase(IAP_UPGRADE_FLAG_ADDR);
66 flash_lock();
67 }
68}
69
flash_sector_erase
flash_status_type flash_sector_erase(uint32_t sector_address)
erase a specified flash sector.
Definition at32f413_flash.c:272
flash_unlock
void flash_unlock(void)
unlock the flash controller.
Definition at32f413_flash.c:228
flash_word_program
flash_status_type flash_word_program(uint32_t address, uint32_t data)
program a word at a specified address.
Definition at32f413_flash.c:414
flash_lock
void flash_lock(void)
lock the flash controller.
Definition at32f413_flash.c:251
nvic_system_reset
void nvic_system_reset(void)
system reset
Definition at32f413_misc.c:51
iap_init
void iap_init(void)
iap init.
Definition app_led3_toggle/src/iap.c:60
iap_command_handle
void iap_command_handle(void)
iap command handle handle.
Definition app_led3_toggle/src/iap.c:43
iap_flag
uint8_t iap_flag
Definition app_led3_toggle/src/usart.c:37
IAP_UPGRADE_FLAG_ADDR
#define IAP_UPGRADE_FLAG_ADDR
Definition app_led3_toggle/inc/iap.h:51
IAP_REV_FLAG_DONE
#define IAP_REV_FLAG_DONE
Definition app_led3_toggle/inc/usart.h:51
IAP_UPGRADE_FLAG
#define IAP_UPGRADE_FLAG
Definition app_led3_toggle/inc/iap.h:55


AT32F413 Firmwary Library: tmr.c Source File

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led3_toggle
  • src
app_led3_toggle/src/tmr.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "tmr.h"
28#include "iap.h"
29
43void tmr_init(void)
44{
45 crm_clocks_freq_type crm_clocks_freq_struct = {0};
46
47 crm_periph_clock_enable(CRM_TMR3_PERIPH_CLOCK, TRUE);
48
49 /* enable the tmr3 global interrupt */
50 nvic_irq_enable(TMR3_GLOBAL_IRQn, 1, 0);
51
52 /* get system clock */
53 crm_clocks_freq_get(&crm_clocks_freq_struct);
54
55 /* time base configuration */
56 tmr_base_init(TMR3, 10000, crm_clocks_freq_struct.ahb_freq / 10000);
57 tmr_cnt_dir_set(TMR3, TMR_COUNT_UP);
58
59 /* overflow interrupt enable */
60 tmr_interrupt_enable(TMR3, TMR_OVF_INT, TRUE);
61
62 /* enable tmr */
63 tmr_counter_enable(TMR3, TRUE);
64}
65
71void TMR3_GLOBAL_IRQHandler(void)
72{
73 if(tmr_interrupt_flag_get(TMR3, TMR_OVF_FLAG) == SET)
74 {
75 tmr_flag_clear(TMR3, TMR_OVF_FLAG);
76 at32_led_toggle(LED3);
77 }
78}
79
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
crm_clocks_freq_struct
crm_clocks_freq_type crm_clocks_freq_struct
Definition project/at_start_f413/examples/debug/tmr1/src/main.c:38
LED3
@ LED3
Definition at32f413_board.h:63
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_clocks_freq_get
void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
Definition at32f413_crm.c:660
CRM_TMR3_PERIPH_CLOCK
@ CRM_TMR3_PERIPH_CLOCK
Definition at32f413_crm.h:126
TMR3_GLOBAL_IRQn
@ TMR3_GLOBAL_IRQn
Definition at32f413.h:201
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
tmr_flag_clear
void tmr_flag_clear(tmr_type *tmr_x, uint32_t tmr_flag)
clear tmr flag
Definition at32f413_tmr.c:1433
tmr_counter_enable
void tmr_counter_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr counter
Definition at32f413_tmr.c:114
tmr_interrupt_flag_get
flag_status tmr_interrupt_flag_get(tmr_type *tmr_x, uint32_t tmr_flag)
get tmr interrupt flag
Definition at32f413_tmr.c:1357
tmr_base_init
void tmr_base_init(tmr_type *tmr_x, uint32_t tmr_pr, uint32_t tmr_div)
init tmr base
Definition at32f413_tmr.c:179
tmr_interrupt_enable
void tmr_interrupt_enable(tmr_type *tmr_x, uint32_t tmr_interrupt, confirm_state new_state)
enable or disable tmr interrupt
Definition at32f413_tmr.c:1327
tmr_cnt_dir_set
void tmr_cnt_dir_set(tmr_type *tmr_x, tmr_count_mode_type tmr_cnt_dir)
set tmr counter count direction
Definition at32f413_tmr.c:225
TMR_COUNT_UP
@ TMR_COUNT_UP
Definition at32f413_tmr.h:105
TMR_OVF_FLAG
#define TMR_OVF_FLAG
Definition at32f413_tmr.h:51
TMR_OVF_INT
#define TMR_OVF_INT
Definition at32f413_tmr.h:73
TMR3
#define TMR3
Definition at32f413_tmr.h:833
TMR3_GLOBAL_IRQHandler
void TMR3_GLOBAL_IRQHandler(void)
tmr3 global interrupt handler.
Definition app_led3_toggle/src/tmr.c:71
tmr_init
void tmr_init(void)
init tmr.
Definition app_led3_toggle/src/tmr.c:43
crm_clocks_freq_type
crm clocks freqency structure
Definition at32f413_crm.h:470
crm_clocks_freq_type::ahb_freq
uint32_t ahb_freq
Definition at32f413_crm.h:472


AT32F413 Firmwary Library: usart.c Source File

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led3_toggle
  • src
app_led3_toggle/src/usart.c
Go to the documentation of this file.
1
26#include "usart.h"
27#include "tmr.h"
28
37uint8_t iap_flag = IAP_REV_FLAG_NO;
38
44void uart_init(uint32_t baudrate)
45{
46 gpio_init_type gpio_init_struct;
47 /* enable the usart and it's io clock */
48 crm_periph_clock_enable(CRM_USART1_PERIPH_CLOCK, TRUE);
49 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
50
51 /* set default parameter */
52 gpio_default_para_init(&gpio_init_struct);
53
54 /* configure the usart1_tx pa9 */
55 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
56 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
57 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
58 gpio_init_struct.gpio_pins = GPIO_PINS_9;
59 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
60 gpio_init(GPIOA, &gpio_init_struct);
61
62 /* configure the usart1_rx pa10 */
63 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
64 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
65 gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
66 gpio_init_struct.gpio_pins = GPIO_PINS_10;
67 gpio_init_struct.gpio_pull = GPIO_PULL_UP;
68 gpio_init(GPIOA, &gpio_init_struct);
69
70 /*configure usart nvic interrupt */
71 nvic_irq_enable(USART1_IRQn, 0, 0);
72
73 /*configure usart param*/
74 usart_init(USART1, baudrate, USART_DATA_8BITS, USART_STOP_1_BIT);
75 usart_transmitter_enable(USART1, TRUE);
76 usart_receiver_enable(USART1, TRUE);
77 usart_interrupt_enable(USART1, USART_RDBF_INT, TRUE);
78 usart_enable(USART1, TRUE);
79}
80
86void USART1_IRQHandler(void)
87{
88 uint16_t reval;
89 if(usart_interrupt_flag_get(USART1, USART_RDBF_FLAG) != RESET)
90 {
91 reval = usart_data_receive(USART1);
92 if((reval == 0x5A) && (iap_flag == IAP_REV_FLAG_NO))
93 iap_flag = IAP_REV_FLAG_5A;
94 else if((reval == 0xA5) && (iap_flag == IAP_REV_FLAG_5A))
95 iap_flag = IAP_REV_FLAG_DONE;
96 else
97 iap_flag = IAP_REV_FLAG_NO;
98 }
99}
100
106void back_ok(void)
107{
108 usart_data_transmit(USART1, 0xCC);
109 while(usart_flag_get(USART1, USART_TDC_FLAG) == RESET);
110 usart_data_transmit(USART1, 0xDD);
111 while(usart_flag_get(USART1, USART_TDC_FLAG) == RESET);
112}
113
119void back_err(void)
120{
121 usart_data_transmit(USART1, 0xEE);
122 while(usart_flag_get(USART1, USART_TDC_FLAG) == RESET);
123 usart_data_transmit(USART1, 0xFF);
124 while(usart_flag_get(USART1, USART_TDC_FLAG) == RESET);
125}
126
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_USART1_PERIPH_CLOCK
@ CRM_USART1_PERIPH_CLOCK
Definition at32f413_crm.h:119
USART1_IRQn
@ USART1_IRQn
Definition at32f413.h:209
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_PULL_UP
@ GPIO_PULL_UP
Definition at32f413_gpio.h:244
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_10
#define GPIO_PINS_10
Definition at32f413_gpio.h:60
GPIO_PINS_9
#define GPIO_PINS_9
Definition at32f413_gpio.h:59
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
usart_data_transmit
void usart_data_transmit(usart_type *usart_x, uint16_t data)
transmit single data through the usart peripheral.
Definition at32f413_usart.c:380
usart_flag_get
flag_status usart_flag_get(usart_type *usart_x, uint32_t flag)
check whether the specified usart flag is set or not.
Definition at32f413_usart.c:565
usart_transmitter_enable
void usart_transmitter_enable(usart_type *usart_x, confirm_state new_state)
usart transmitter enable.
Definition at32f413_usart.c:185
usart_init
void usart_init(usart_type *usart_x, uint32_t baud_rate, usart_data_bit_num_type data_bit, usart_stop_bit_num_type stop_bit)
initialize the usart peripheral according to the specified parameters.
Definition at32f413_usart.c:105
usart_enable
void usart_enable(usart_type *usart_x, confirm_state new_state)
enable or disable the specified usart peripheral.
Definition at32f413_usart.c:172
usart_receiver_enable
void usart_receiver_enable(usart_type *usart_x, confirm_state new_state)
usart receiver enable.
Definition at32f413_usart.c:198
usart_interrupt_enable
void usart_interrupt_enable(usart_type *usart_x, uint32_t usart_int, confirm_state new_state)
enable or disable the specified usart interrupts.
Definition at32f413_usart.c:263
usart_data_receive
uint16_t usart_data_receive(usart_type *usart_x)
return the most recent received data by the usart peripheral.
Definition at32f413_usart.c:392
usart_interrupt_flag_get
flag_status usart_interrupt_flag_get(usart_type *usart_x, uint32_t flag)
check whether the specified usart interrupt flag is set or not.
Definition at32f413_usart.c:596
USART_STOP_1_BIT
@ USART_STOP_1_BIT
Definition at32f413_usart.h:157
USART_DATA_8BITS
@ USART_DATA_8BITS
Definition at32f413_usart.h:112
USART_TDC_FLAG
#define USART_TDC_FLAG
Definition at32f413_usart.h:57
USART_RDBF_FLAG
#define USART_RDBF_FLAG
Definition at32f413_usart.h:56
USART1_IRQHandler
void USART1_IRQHandler(void)
usart1 interrupt handler.
Definition app_led3_toggle/src/usart.c:86
uart_init
void uart_init(uint32_t baudrate)
init usart.
Definition app_led3_toggle/src/usart.c:44
iap_flag
uint8_t iap_flag
Definition app_led3_toggle/src/usart.c:37
back_err
void back_err(void)
command response error.
Definition app_led3_toggle/src/usart.c:119
back_ok
void back_ok(void)
command response ok.
Definition app_led3_toggle/src/usart.c:106
USART_RDBF_INT
#define USART_RDBF_INT
Definition at32f413_usart.h:72
USART1
#define USART1
Definition at32f413_usart.h:318
IAP_REV_FLAG_DONE
#define IAP_REV_FLAG_DONE
Definition app_led3_toggle/inc/usart.h:51
IAP_REV_FLAG_NO
#define IAP_REV_FLAG_NO
Definition app_led3_toggle/inc/usart.h:49
IAP_REV_FLAG_5A
#define IAP_REV_FLAG_5A
Definition app_led3_toggle/inc/usart.h:50
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288


AT32F413 Firmwary Library: hid_iap_user.h Source File

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • app_led4_toggle
  • inc
app_led4_toggle/inc/hid_iap_user.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __HID_IAP_USER_H
28#define __HID_IAP_USER_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "hid_iap_class.h"
35
48#define FLASH_APP_ADDRESS 0x08006000
49
58void iap_init(void);
59 iap_result_type iap_get_upgrade_flag(void);
60void app_loop(void);
61
74#ifdef __cplusplus
75}
76#endif
77
78#endif
79
iap_result_type
iap_result_type
Definition hid_iap_class.h:85
iap_init
void iap_init(void)
iap init.
Definition app_led3_toggle/src/iap.c:60
iap_get_upgrade_flag
iap_result_type iap_get_upgrade_flag(void)
get iap upgrade complete flag
Definition app_led3_toggle/src/hid_iap_user.c:78
app_loop
void app_loop(void)
iap loop
Definition app_led3_toggle/src/hid_iap_user.c:252
hid_iap_class.h
usb hid iap header file


AT32F413 Firmwary Library: iap.h Source File

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led4_toggle
  • inc
app_led4_toggle/inc/iap.h
Go to the documentation of this file.
1
26#ifndef __IAP_H__
27#define __IAP_H__
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33#include "at32f413_board.h"
34
47/* app starting address */
48#define APP_START_ADDR 0x08004000
49
50/* the previous sector of app starting address is iap upgrade flag */
51#define IAP_UPGRADE_FLAG_ADDR (APP_START_ADDR - 0x800)
52
53/* when app received cmd 0x5aa5 from pc-tool, will set up the flag,
54indicates that an app upgrade will follow, see iap application note for more details */
55#define IAP_UPGRADE_FLAG 0x41544B38
56
65void iap_command_handle(void);
66void iap_init(void);
67
80#ifdef __cplusplus
81}
82#endif
83
84#endif
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
iap_init
void iap_init(void)
iap init.
Definition app_led3_toggle/src/iap.c:60
iap_command_handle
void iap_command_handle(void)
iap command handle handle.
Definition app_led3_toggle/src/iap.c:43


AT32F413 Firmwary Library: tmr.h Source File

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led4_toggle
  • inc
app_led4_toggle/inc/tmr.h
Go to the documentation of this file.
1
26#ifndef __TMR_H
27#define __TMR_H
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33#include "at32f413_board.h"
34
47void tmr_init(void);
48
61#ifdef __cplusplus
62}
63#endif
64
65#endif
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
tmr_init
void tmr_init(void)
init tmr.
Definition app_led3_toggle/src/tmr.c:43


AT32F413 Firmwary Library: usart.h Source File

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led4_toggle
  • inc
app_led4_toggle/inc/usart.h
Go to the documentation of this file.
1
26#ifndef __USART_H
27#define __USART_H
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33#include "at32f413_board.h"
34
35extern uint8_t iap_flag;
36
49#define IAP_REV_FLAG_NO 0
50#define IAP_REV_FLAG_5A 1
51#define IAP_REV_FLAG_DONE 2
52#define IAP_REV_FLAG_ERROR 3
53
62void uart_init(uint32_t baudrate);
63void back_ok(void);
64void back_err(void);
65
78#ifdef __cplusplus
79}
80#endif
81
82#endif
83
84
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
iap_flag
uint8_t iap_flag
Definition app_led3_toggle/src/usart.c:37
uart_init
void uart_init(uint32_t baudrate)
init usart.
Definition app_led3_toggle/src/usart.c:44
back_err
void back_err(void)
command response error.
Definition app_led3_toggle/src/usart.c:119
back_ok
void back_ok(void)
command response ok.
Definition app_led3_toggle/src/usart.c:106


AT32F413 Firmwary Library: hid_iap_user.c Source File

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • app_led4_toggle
  • src
app_led4_toggle/src/hid_iap_user.c
Go to the documentation of this file.
1
26#include "hid_iap_user.h"
27#include "hid_iap_class.h"
28#include "string.h"
29
38void (*pftarget)(void);
39void iap_clear_upgrade_flag(void);
40void iap_set_upgrade_flag(void);
41uint32_t crc_cal(uint32_t addr, uint16_t nk);
42
43void iap_idle(void);
44void iap_start(void);
45void iap_finish(void);
46void iap_jump(void);
47void iap_respond(uint8_t *res_buf, uint16_t iap_cmd, uint16_t result);
48
54void iap_clear_upgrade_flag(void)
55{
56 flash_unlock();
57 flash_sector_erase(iap_info.flag_address);
58 flash_lock();
59}
60
66void iap_set_upgrade_flag(void)
67{
68 flash_unlock();
69 flash_word_program(iap_info.flag_address, IAP_UPGRADE_COMPLETE_FLAG);
70 flash_lock();
71}
72
78 iap_result_type iap_get_upgrade_flag(void)
79{
80 uint32_t flag_address = iap_info.flag_address;
81 if(*((uint32_t *)flag_address) == IAP_UPGRADE_COMPLETE_FLAG)
82 {
83 return IAP_SUCCESS;
84 }
85 else
86 {
87 return IAP_FAILED;
88 }
89}
90
96void iap_init(void)
97{
98 iap_info.flash_size = KB_TO_B(FLASH_SIZE_REG());
99 if(iap_info.flash_size < KB_TO_B(256))
100 {
101 iap_info.sector_size = SECTOR_SIZE_1K;
102 }
103 else
104 {
105 iap_info.sector_size = SECTOR_SIZE_2K;
106 }
107
108 iap_info.flash_start_address = FLASH_BASE;
109 iap_info.flash_end_address = iap_info.flash_start_address + iap_info.flash_size;
110
111 iap_info.app_address = FLASH_APP_ADDRESS;
112 iap_info.flag_address = iap_info.app_address - iap_info.sector_size;
113
114 iap_info.fifo_length = 0;
115 iap_info.iap_address = 0;
116}
117
123void iap_idle(void)
124{
125 iap_info.state = IAP_STS_JMP_WAIT;
126 iap_init();
127 iap_respond(iap_info.iap_tx, IAP_CMD_IDLE, IAP_ACK);
128}
129
135void iap_start(void)
136{
137 iap_info.state = IAP_STS_START;
138 iap_init();
139 iap_respond(iap_info.iap_tx, IAP_CMD_START, IAP_ACK);
140}
141
142/*
143 * @brief iap jump
144 * @param none
145 * @retval none
146 */
147void iap_jump()
148{
149 iap_info.state = IAP_STS_JMP_WAIT;
150 iap_respond(iap_info.iap_tx, IAP_CMD_JMP, IAP_ACK);
151}
152
153/*
154 * @brief iap get
155 * @param none
156 * @retval none
157 */
158void iap_get()
159{
160 iap_respond(iap_info.iap_tx, IAP_CMD_GET, IAP_ACK);
161 iap_info.iap_tx[4] = (uint8_t)((iap_info.app_address >> 24) & 0xFF);
162 iap_info.iap_tx[5] = (uint8_t)((iap_info.app_address >> 16) & 0xFF);
163 iap_info.iap_tx[6] = (uint8_t)((iap_info.app_address >> 8) & 0xFF);
164 iap_info.iap_tx[7] = (uint8_t)((iap_info.app_address) & 0xFF);
165}
166
167
168
169/*
170 * @brief iap respond
171 * @param res_buf: data buffer pointer.
172 * @param iap_cmd: iap command
173 * @param result: iap result
174 * @retval the result of the address parse
175 */
176void iap_respond(uint8_t *res_buf, uint16_t iap_cmd, uint16_t result)
177{
178 res_buf[0] = (uint8_t)((iap_cmd >> 8) & 0xFF);
179 res_buf[1] = (uint8_t)((iap_cmd) & 0xFF);
180 res_buf[2] = (uint8_t)((result >> 8) & 0xFF);
181 res_buf[3] = (uint8_t)((result) & 0xFF);
182
183 iap_info.respond_flag = 1;
184}
185
193 iap_result_type usbd_hid_iap_process(void *udev, uint8_t *pdata, uint16_t len)
194{
195 iap_result_type status = IAP_SUCCESS;
196 uint16_t iap_cmd;
197
198 if(len < 2)
199 {
200 return IAP_FAILED;
201 }
202
203 iap_info.respond_flag = 0;
204
205 iap_cmd = (pdata[0] << 8) | pdata[1];
206
207 switch(iap_cmd)
208 {
209 case IAP_CMD_IDLE:
210 iap_idle();
211 break;
212 case IAP_CMD_START:
213 iap_start();
214 break;
215 case IAP_CMD_JMP:
216 iap_jump();
217 break;
218 case IAP_CMD_GET:
219 iap_get();
220 break;
221 default:
222 status = IAP_FAILED;
223 break;
224 }
225
226 if(iap_info.respond_flag)
227 {
228 usb_iap_class_send_report(udev, iap_info.iap_tx, 64);
229 }
230
231 return status;
232}
233
239void usbd_hid_iap_in_complete(void *udev)
240{
241 if(iap_info.state == IAP_STS_JMP_WAIT)
242 {
243 iap_info.state = IAP_STS_JMP;
244 }
245}
246
252void app_loop(void)
253{
254 if(iap_info.state == IAP_STS_JMP)
255 {
256 iap_clear_upgrade_flag();
257 nvic_system_reset();
258 }
259}
260
SECTOR_SIZE_1K
#define SECTOR_SIZE_1K
Definition composite_vcp_msc/inc/msc_diskio.h:50
SECTOR_SIZE_2K
#define SECTOR_SIZE_2K
Definition composite_vcp_msc/inc/msc_diskio.h:51
flash_sector_erase
flash_status_type flash_sector_erase(uint32_t sector_address)
erase a specified flash sector.
Definition at32f413_flash.c:272
flash_unlock
void flash_unlock(void)
unlock the flash controller.
Definition at32f413_flash.c:228
flash_word_program
flash_status_type flash_word_program(uint32_t address, uint32_t data)
program a word at a specified address.
Definition at32f413_flash.c:414
flash_lock
void flash_lock(void)
lock the flash controller.
Definition at32f413_flash.c:251
nvic_system_reset
void nvic_system_reset(void)
system reset
Definition at32f413_misc.c:51
FLASH_BASE
#define FLASH_BASE
Definition at32f413.h:329
IAP_FAILED
#define IAP_FAILED
Definition flash_fat16.h:77
IAP_SUCCESS
#define IAP_SUCCESS
Definition flash_fat16.h:76
IAP_UPGRADE_COMPLETE_FLAG
#define IAP_UPGRADE_COMPLETE_FLAG
Definition flash_fat16.h:75
IAP_CMD_IDLE
#define IAP_CMD_IDLE
iap command
Definition hid_iap_class.h:67
IAP_CMD_GET
#define IAP_CMD_GET
Definition hid_iap_class.h:74
iap_result_type
iap_result_type
Definition hid_iap_class.h:85
IAP_ACK
#define IAP_ACK
Definition hid_iap_class.h:81
FLASH_SIZE_REG
#define FLASH_SIZE_REG()
Definition hid_iap_class.h:57
IAP_CMD_START
#define IAP_CMD_START
Definition hid_iap_class.h:68
IAP_CMD_JMP
#define IAP_CMD_JMP
Definition hid_iap_class.h:73
KB_TO_B
#define KB_TO_B(kb)
Definition hid_iap_class.h:58
IAP_STS_START
@ IAP_STS_START
Definition hid_iap_class.h:94
IAP_STS_JMP
@ IAP_STS_JMP
Definition hid_iap_class.h:100
IAP_STS_JMP_WAIT
@ IAP_STS_JMP_WAIT
Definition hid_iap_class.h:99
iap_info
iap_info_type iap_info
Definition hid_iap_class.c:53
usb_iap_class_send_report
usb_sts_type usb_iap_class_send_report(void *udev, uint8_t *report, uint16_t len)
usb device class send report
Definition hid_iap_class.c:325
iap_set_upgrade_flag
void iap_set_upgrade_flag(void)
set iap upgrade complete flag
Definition app_led4_toggle/src/hid_iap_user.c:66
iap_idle
void iap_idle(void)
iap idle function
Definition app_led4_toggle/src/hid_iap_user.c:123
iap_respond
void iap_respond(uint8_t *res_buf, uint16_t iap_cmd, uint16_t result)
Definition app_led4_toggle/src/hid_iap_user.c:176
iap_init
void iap_init(void)
iap init
Definition app_led4_toggle/src/hid_iap_user.c:96
usbd_hid_iap_process
iap_result_type usbd_hid_iap_process(void *udev, uint8_t *pdata, uint16_t len)
usb device iap function
Definition app_led4_toggle/src/hid_iap_user.c:193
crc_cal
uint32_t crc_cal(uint32_t addr, uint16_t nk)
crc cal
Definition bootloader/src/hid_iap_user.c:167
iap_get_upgrade_flag
iap_result_type iap_get_upgrade_flag(void)
get iap upgrade complete flag
Definition app_led4_toggle/src/hid_iap_user.c:78
iap_finish
void iap_finish(void)
Definition bootloader/src/hid_iap_user.c:327
iap_start
void iap_start(void)
iap start function
Definition app_led4_toggle/src/hid_iap_user.c:135
pftarget
void(* pftarget)(void)
Definition app_led4_toggle/src/hid_iap_user.c:38
iap_clear_upgrade_flag
void iap_clear_upgrade_flag(void)
clear iap upgrade flag
Definition app_led4_toggle/src/hid_iap_user.c:54
iap_get
void iap_get()
Definition app_led4_toggle/src/hid_iap_user.c:158
app_loop
void app_loop(void)
iap loop
Definition app_led4_toggle/src/hid_iap_user.c:252
iap_jump
void iap_jump(void)
Definition app_led4_toggle/src/hid_iap_user.c:147
usbd_hid_iap_in_complete
void usbd_hid_iap_in_complete(void *udev)
usb device in transfer complete function
Definition app_led4_toggle/src/hid_iap_user.c:239
FLASH_APP_ADDRESS
#define FLASH_APP_ADDRESS
Definition app_led3_toggle/inc/hid_iap_user.h:48
hid_iap_class.h
usb hid iap header file
iap_info_type::respond_flag
uint32_t respond_flag
Definition hid_iap_class.h:123
iap_info_type::flag_address
uint32_t flag_address
Definition hid_iap_class.h:115
iap_info_type::sector_size
uint32_t sector_size
Definition hid_iap_class.h:120
iap_info_type::iap_address
uint32_t iap_address
Definition hid_iap_class.h:114
iap_info_type::flash_start_address
uint32_t flash_start_address
Definition hid_iap_class.h:117
iap_info_type::flash_end_address
uint32_t flash_end_address
Definition hid_iap_class.h:118
iap_info_type::fifo_length
uint32_t fifo_length
Definition hid_iap_class.h:110
iap_info_type::flash_size
uint32_t flash_size
Definition hid_iap_class.h:121
iap_info_type::iap_tx
uint8_t iap_tx[0x40]
Definition hid_iap_class.h:108
iap_info_type::app_address
uint32_t app_address
Definition hid_iap_class.h:113
iap_info_type::state
iap_machine_state_type state
Definition hid_iap_class.h:132


AT32F413 Firmwary Library: iap.c Source File

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led4_toggle
  • src
app_led4_toggle/src/iap.c
Go to the documentation of this file.
1
26#include "iap.h"
27#include "usart.h"
28#include "tmr.h"
29
43void iap_command_handle(void)
44{
45 if(iap_flag==IAP_REV_FLAG_DONE)
46 {
47 flash_unlock();
48 flash_sector_erase(IAP_UPGRADE_FLAG_ADDR);
49 flash_word_program(IAP_UPGRADE_FLAG_ADDR, IAP_UPGRADE_FLAG);
50 flash_lock();
51 nvic_system_reset();
52 }
53}
54
60void iap_init(void)
61{
62 if((*(uint32_t*)IAP_UPGRADE_FLAG_ADDR) == IAP_UPGRADE_FLAG)
63 {
64 flash_unlock();
65 flash_sector_erase(IAP_UPGRADE_FLAG_ADDR);
66 flash_lock();
67 }
68}
69
flash_sector_erase
flash_status_type flash_sector_erase(uint32_t sector_address)
erase a specified flash sector.
Definition at32f413_flash.c:272
flash_unlock
void flash_unlock(void)
unlock the flash controller.
Definition at32f413_flash.c:228
flash_word_program
flash_status_type flash_word_program(uint32_t address, uint32_t data)
program a word at a specified address.
Definition at32f413_flash.c:414
flash_lock
void flash_lock(void)
lock the flash controller.
Definition at32f413_flash.c:251
nvic_system_reset
void nvic_system_reset(void)
system reset
Definition at32f413_misc.c:51
iap_flag
uint8_t iap_flag
Definition app_led3_toggle/src/usart.c:37
iap_init
void iap_init(void)
iap init.
Definition app_led4_toggle/src/iap.c:60
iap_command_handle
void iap_command_handle(void)
iap command handle handle.
Definition app_led4_toggle/src/iap.c:43
IAP_UPGRADE_FLAG_ADDR
#define IAP_UPGRADE_FLAG_ADDR
Definition app_led3_toggle/inc/iap.h:51
IAP_REV_FLAG_DONE
#define IAP_REV_FLAG_DONE
Definition app_led3_toggle/inc/usart.h:51
IAP_UPGRADE_FLAG
#define IAP_UPGRADE_FLAG
Definition app_led3_toggle/inc/iap.h:55


AT32F413 Firmwary Library: tmr.c Source File

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led4_toggle
  • src
app_led4_toggle/src/tmr.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "tmr.h"
28#include "iap.h"
29
43void tmr_init(void)
44{
45 crm_clocks_freq_type crm_clocks_freq_struct = {0};
46
47 crm_periph_clock_enable(CRM_TMR3_PERIPH_CLOCK, TRUE);
48
49 /* enable the tmr3 global interrupt */
50 nvic_irq_enable(TMR3_GLOBAL_IRQn, 1, 0);
51
52 /* get system clock */
53 crm_clocks_freq_get(&crm_clocks_freq_struct);
54
55 /* time base configuration */
56 tmr_base_init(TMR3, 10000, crm_clocks_freq_struct.ahb_freq / 10000);
57 tmr_cnt_dir_set(TMR3, TMR_COUNT_UP);
58
59 /* overflow interrupt enable */
60 tmr_interrupt_enable(TMR3, TMR_OVF_INT, TRUE);
61
62 /* enable tmr */
63 tmr_counter_enable(TMR3, TRUE);
64}
65
71void TMR3_GLOBAL_IRQHandler(void)
72{
73 if(tmr_interrupt_flag_get(TMR3, TMR_OVF_FLAG) == SET)
74 {
75 tmr_flag_clear(TMR3, TMR_OVF_FLAG);
76 at32_led_toggle(LED4);
77 }
78}
79
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
crm_clocks_freq_struct
crm_clocks_freq_type crm_clocks_freq_struct
Definition project/at_start_f413/examples/debug/tmr1/src/main.c:38
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_clocks_freq_get
void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
Definition at32f413_crm.c:660
CRM_TMR3_PERIPH_CLOCK
@ CRM_TMR3_PERIPH_CLOCK
Definition at32f413_crm.h:126
TMR3_GLOBAL_IRQn
@ TMR3_GLOBAL_IRQn
Definition at32f413.h:201
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
tmr_flag_clear
void tmr_flag_clear(tmr_type *tmr_x, uint32_t tmr_flag)
clear tmr flag
Definition at32f413_tmr.c:1433
tmr_counter_enable
void tmr_counter_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr counter
Definition at32f413_tmr.c:114
tmr_interrupt_flag_get
flag_status tmr_interrupt_flag_get(tmr_type *tmr_x, uint32_t tmr_flag)
get tmr interrupt flag
Definition at32f413_tmr.c:1357
tmr_base_init
void tmr_base_init(tmr_type *tmr_x, uint32_t tmr_pr, uint32_t tmr_div)
init tmr base
Definition at32f413_tmr.c:179
tmr_interrupt_enable
void tmr_interrupt_enable(tmr_type *tmr_x, uint32_t tmr_interrupt, confirm_state new_state)
enable or disable tmr interrupt
Definition at32f413_tmr.c:1327
tmr_cnt_dir_set
void tmr_cnt_dir_set(tmr_type *tmr_x, tmr_count_mode_type tmr_cnt_dir)
set tmr counter count direction
Definition at32f413_tmr.c:225
TMR_COUNT_UP
@ TMR_COUNT_UP
Definition at32f413_tmr.h:105
TMR_OVF_FLAG
#define TMR_OVF_FLAG
Definition at32f413_tmr.h:51
TMR_OVF_INT
#define TMR_OVF_INT
Definition at32f413_tmr.h:73
TMR3
#define TMR3
Definition at32f413_tmr.h:833
TMR3_GLOBAL_IRQHandler
void TMR3_GLOBAL_IRQHandler(void)
tmr3 global interrupt handler.
Definition app_led4_toggle/src/tmr.c:71
tmr_init
void tmr_init(void)
init tmr.
Definition app_led4_toggle/src/tmr.c:43
crm_clocks_freq_type
crm clocks freqency structure
Definition at32f413_crm.h:470
crm_clocks_freq_type::ahb_freq
uint32_t ahb_freq
Definition at32f413_crm.h:472


AT32F413 Firmwary Library: usart.c Source File

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led4_toggle
  • src
app_led4_toggle/src/usart.c
Go to the documentation of this file.
1
26#include "usart.h"
27#include "tmr.h"
28
37uint8_t iap_flag = IAP_REV_FLAG_NO;
38
44void uart_init(uint32_t baudrate)
45{
46 gpio_init_type gpio_init_struct;
47 /* enable the usart and it's io clock */
48 crm_periph_clock_enable(CRM_USART1_PERIPH_CLOCK, TRUE);
49 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
50
51 /* set default parameter */
52 gpio_default_para_init(&gpio_init_struct);
53
54 /* configure the usart1_tx pa9 */
55 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
56 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
57 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
58 gpio_init_struct.gpio_pins = GPIO_PINS_9;
59 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
60 gpio_init(GPIOA, &gpio_init_struct);
61
62 /* configure the usart1_rx pa10 */
63 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
64 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
65 gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
66 gpio_init_struct.gpio_pins = GPIO_PINS_10;
67 gpio_init_struct.gpio_pull = GPIO_PULL_UP;
68 gpio_init(GPIOA, &gpio_init_struct);
69
70 /*configure usart nvic interrupt */
71 nvic_irq_enable(USART1_IRQn, 0, 0);
72
73 /*configure usart param*/
74 usart_init(USART1, baudrate, USART_DATA_8BITS, USART_STOP_1_BIT);
75 usart_transmitter_enable(USART1, TRUE);
76 usart_receiver_enable(USART1, TRUE);
77 usart_interrupt_enable(USART1, USART_RDBF_INT, TRUE);
78 usart_enable(USART1, TRUE);
79}
80
86void USART1_IRQHandler(void)
87{
88 uint16_t reval;
89 if(usart_interrupt_flag_get(USART1, USART_RDBF_FLAG) != RESET)
90 {
91 reval = usart_data_receive(USART1);
92 if((reval == 0x5A) && (iap_flag == IAP_REV_FLAG_NO))
93 iap_flag = IAP_REV_FLAG_5A;
94 else if((reval == 0xA5) && (iap_flag == IAP_REV_FLAG_5A))
95 iap_flag = IAP_REV_FLAG_DONE;
96 else
97 iap_flag = IAP_REV_FLAG_NO;
98 }
99}
100
106void back_ok(void)
107{
108 usart_data_transmit(USART1, 0xCC);
109 while(usart_flag_get(USART1, USART_TDC_FLAG) == RESET);
110 usart_data_transmit(USART1, 0xDD);
111 while(usart_flag_get(USART1, USART_TDC_FLAG) == RESET);
112}
113
119void back_err(void)
120{
121 usart_data_transmit(USART1, 0xEE);
122 while(usart_flag_get(USART1, USART_TDC_FLAG) == RESET);
123 usart_data_transmit(USART1, 0xFF);
124 while(usart_flag_get(USART1, USART_TDC_FLAG) == RESET);
125}
126
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_USART1_PERIPH_CLOCK
@ CRM_USART1_PERIPH_CLOCK
Definition at32f413_crm.h:119
USART1_IRQn
@ USART1_IRQn
Definition at32f413.h:209
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_PULL_UP
@ GPIO_PULL_UP
Definition at32f413_gpio.h:244
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_10
#define GPIO_PINS_10
Definition at32f413_gpio.h:60
GPIO_PINS_9
#define GPIO_PINS_9
Definition at32f413_gpio.h:59
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
usart_data_transmit
void usart_data_transmit(usart_type *usart_x, uint16_t data)
transmit single data through the usart peripheral.
Definition at32f413_usart.c:380
usart_flag_get
flag_status usart_flag_get(usart_type *usart_x, uint32_t flag)
check whether the specified usart flag is set or not.
Definition at32f413_usart.c:565
usart_transmitter_enable
void usart_transmitter_enable(usart_type *usart_x, confirm_state new_state)
usart transmitter enable.
Definition at32f413_usart.c:185
usart_init
void usart_init(usart_type *usart_x, uint32_t baud_rate, usart_data_bit_num_type data_bit, usart_stop_bit_num_type stop_bit)
initialize the usart peripheral according to the specified parameters.
Definition at32f413_usart.c:105
usart_enable
void usart_enable(usart_type *usart_x, confirm_state new_state)
enable or disable the specified usart peripheral.
Definition at32f413_usart.c:172
usart_receiver_enable
void usart_receiver_enable(usart_type *usart_x, confirm_state new_state)
usart receiver enable.
Definition at32f413_usart.c:198
usart_interrupt_enable
void usart_interrupt_enable(usart_type *usart_x, uint32_t usart_int, confirm_state new_state)
enable or disable the specified usart interrupts.
Definition at32f413_usart.c:263
usart_data_receive
uint16_t usart_data_receive(usart_type *usart_x)
return the most recent received data by the usart peripheral.
Definition at32f413_usart.c:392
usart_interrupt_flag_get
flag_status usart_interrupt_flag_get(usart_type *usart_x, uint32_t flag)
check whether the specified usart interrupt flag is set or not.
Definition at32f413_usart.c:596
USART_STOP_1_BIT
@ USART_STOP_1_BIT
Definition at32f413_usart.h:157
USART_DATA_8BITS
@ USART_DATA_8BITS
Definition at32f413_usart.h:112
USART_TDC_FLAG
#define USART_TDC_FLAG
Definition at32f413_usart.h:57
USART_RDBF_FLAG
#define USART_RDBF_FLAG
Definition at32f413_usart.h:56
USART1_IRQHandler
void USART1_IRQHandler(void)
usart1 interrupt handler.
Definition app_led4_toggle/src/usart.c:86
uart_init
void uart_init(uint32_t baudrate)
init usart.
Definition app_led4_toggle/src/usart.c:44
iap_flag
uint8_t iap_flag
Definition app_led4_toggle/src/usart.c:37
back_err
void back_err(void)
command response error.
Definition app_led4_toggle/src/usart.c:119
back_ok
void back_ok(void)
command response ok.
Definition app_led4_toggle/src/usart.c:106
USART_RDBF_INT
#define USART_RDBF_INT
Definition at32f413_usart.h:72
USART1
#define USART1
Definition at32f413_usart.h:318
IAP_REV_FLAG_DONE
#define IAP_REV_FLAG_DONE
Definition app_led3_toggle/inc/usart.h:51
IAP_REV_FLAG_NO
#define IAP_REV_FLAG_NO
Definition app_led3_toggle/inc/usart.h:49
IAP_REV_FLAG_5A
#define IAP_REV_FLAG_5A
Definition app_led3_toggle/inc/usart.h:50
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288


AT32F413 Firmwary Library: arm_fir_init_f32.c Source File

  • utilities
  • at32f413_slib_demo
  • project_l0
  • src
arm_fir_init_f32.c
Go to the documentation of this file.
1/* ----------------------------------------------------------------------
2 * Project: CMSIS DSP Library
3 * Title: arm_fir_init_f32.c
4 * Description: Floating-point FIR filter initialization function
5 *
6 * $Date: 18. March 2019
7 * $Revision: V1.6.0
8 *
9 * Target Processor: Cortex-M cores
10 * -------------------------------------------------------------------- */
11/*
12 * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
13 *
14 * SPDX-License-Identifier: Apache-2.0
15 *
16 * Licensed under the Apache License, Version 2.0 (the License); you may
17 * not use this file except in compliance with the License.
18 * You may obtain a copy of the License at
19 *
20 * www.apache.org/licenses/LICENSE-2.0
21 *
22 * Unless required by applicable law or agreed to in writing, software
23 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
24 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25 * See the License for the specific language governing permissions and
26 * limitations under the License.
27 */
28
29#include "arm_math.h"
30
31void* my_memset(void *s, int c, size_t n);
32
59void arm_fir_init_f32(
60 arm_fir_instance_f32 * S,
61 uint16_t numTaps,
62 const float32_t * pCoeffs,
63 float32_t * pState,
64 uint32_t blockSize)
65{
66 /* Assign filter taps */
67 S->numTaps = numTaps;
68
69 /* Assign coefficient pointer */
70 S->pCoeffs = pCoeffs;
71
72 /* Clear state buffer. The size is always (blockSize + numTaps - 1) */
73 my_memset(pState, 0, (numTaps + (blockSize - 1u)) * sizeof(float32_t));
74
75 /* Assign state pointer */
76 S->pState = pState;
77}
78
79void* my_memset(void *s, int c, size_t n)
80{
81 while (n>0)
82 *( (char*)s + n-- -1 ) = (char)c;
83
84 return (s);
85}
my_memset
void * my_memset(void *s, int c, size_t n)
Definition arm_fir_init_f32.c:79
arm_fir_init_f32
void arm_fir_init_f32(arm_fir_instance_f32 *S, uint16_t numTaps, const float32_t *pCoeffs, float32_t *pState, uint32_t blockSize)
Initialization function for the floating-point FIR filter.
Definition arm_fir_init_f32.c:59


AT32F413 Firmwary Library: at32f413.h Source File

  • libraries
  • cmsis
  • cm4
  • device_support
at32f413.h
Go to the documentation of this file.
1
26#ifndef __AT32F413_H
27#define __AT32F413_H
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33#if defined (__CC_ARM)
34 #pragma anon_unions
35#endif
36
54#if !defined (AT32F413KBU7_4) && !defined (AT32F413KCU7_4) && !defined (AT32F413CBU7) && \
55 !defined (AT32F413CCU7) && !defined (AT32F413C8T7) && !defined (AT32F413CBT7) && \
56 !defined (AT32F413CCT7) && !defined (AT32F413RBT7) && !defined (AT32F413RCT7) && \
57 !defined (AT32FEBKC8T7) && !defined (AT32F413TBU7)
58
59 #error "Please select first the target device used in your application (in at32f413.h file)"
60#endif
61
62#if defined (AT32F413KBU7_4) || defined (AT32F413KCU7_4) || defined (AT32F413CBU7) || \
63 defined (AT32F413CCU7) || defined (AT32F413C8T7) || defined (AT32F413CBT7) || \
64 defined (AT32F413CCT7) || defined (AT32F413RBT7) || defined (AT32F413RCT7) || \
65 defined (AT32FEBKC8T7) || defined (AT32F413TBU7)
66
67 #define AT32F413xx
68#endif
69
73#if defined (AT32F413RBT7) || defined (AT32F413RCT7)
74
75 #define AT32F413Rx
76#endif
77
78#if defined (AT32F413CBU7) || defined (AT32F413CCU7) || defined (AT32F413C8T7) || \
79 defined (AT32F413CBT7) || defined (AT32F413CCT7)
80
81 #define AT32F413Cx
82#endif
83
84#if defined (AT32F413KBU7_4) || defined (AT32F413KCU7_4)
85
86 #define AT32F413Kx
87#endif
88
92#if defined (AT32F413C8T7) || defined (AT32FEBKC8T7)
93
94 #define AT32F413x8
95#endif
96
97#if defined (AT32F413KBU7_4) || defined (AT32F413CBU7) || defined (AT32F413CBT7) || \
98 defined (AT32F413RBT7) || defined (AT32F413TBU7)
99
100 #define AT32F413xB
101#endif
102
103#if defined (AT32F413KCU7_4) || defined (AT32F413CCU7) || defined (AT32F413CCT7) || \
104 defined (AT32F413RCT7)
105
106 #define AT32F413xC
107#endif
108
109#ifndef USE_STDPERIPH_DRIVER
115 #ifdef _RTE_
116 #include "RTE_Components.h"
117 #ifdef RTE_DEVICE_STDPERIPH_FRAMEWORK
118 #define USE_STDPERIPH_DRIVER
119 #endif
120 #endif
121#endif
122
126#define __AT32F413_LIBRARY_VERSION_MAJOR (0x02)
127#define __AT32F413_LIBRARY_VERSION_MIDDLE (0x01)
128#define __AT32F413_LIBRARY_VERSION_MINOR (0x07)
129#define __AT32F413_LIBRARY_VERSION_RC (0x00)
130#define __AT32F413_LIBRARY_VERSION ((__AT32F413_LIBRARY_VERSION_MAJOR << 24) | \
131 (__AT32F413_LIBRARY_VERSION_MIDDLE << 16) | \
132 (__AT32F413_LIBRARY_VERSION_MINOR << 8) | \
133 (__AT32F413_LIBRARY_VERSION_RC))
134
146#define __CM4_REV 0x0001U
147#define __MPU_PRESENT 1
148#define __NVIC_PRIO_BITS 4
149#define __Vendor_SysTickConfig 0
150#define __FPU_PRESENT 1U
156typedef enum IRQn
157{
158 /****** cortex-m4 processor exceptions numbers ***************************************************/
159 Reset_IRQn = -15,
160 NonMaskableInt_IRQn = -14,
161 HardFault_IRQn = -13,
162 MemoryManagement_IRQn = -12,
163 BusFault_IRQn = -11,
164 UsageFault_IRQn = -10,
165 SVCall_IRQn = -5,
166 DebugMonitor_IRQn = -4,
167 PendSV_IRQn = -2,
168 SysTick_IRQn = -1,
170 /****** at32 specific interrupt numbers *********************************************************/
171 WWDT_IRQn = 0,
172 PVM_IRQn = 1,
173 TAMPER_IRQn = 2,
174 RTC_IRQn = 3,
175 FLASH_IRQn = 4,
176 CRM_IRQn = 5,
177 EXINT0_IRQn = 6,
178 EXINT1_IRQn = 7,
179 EXINT2_IRQn = 8,
180 EXINT3_IRQn = 9,
181 EXINT4_IRQn = 10,
182 DMA1_Channel1_IRQn = 11,
183 DMA1_Channel2_IRQn = 12,
184 DMA1_Channel3_IRQn = 13,
185 DMA1_Channel4_IRQn = 14,
186 DMA1_Channel5_IRQn = 15,
187 DMA1_Channel6_IRQn = 16,
188 DMA1_Channel7_IRQn = 17,
190 ADC1_2_IRQn = 18,
191 USBFS_H_CAN1_TX_IRQn = 19,
192 USBFS_L_CAN1_RX0_IRQn = 20,
193 CAN1_RX1_IRQn = 21,
194 CAN1_SE_IRQn = 22,
195 EXINT9_5_IRQn = 23,
196 TMR1_BRK_TMR9_IRQn = 24,
197 TMR1_OVF_TMR10_IRQn = 25,
198 TMR1_TRG_HALL_TMR11_IRQn = 26,
199 TMR1_CH_IRQn = 27,
200 TMR2_GLOBAL_IRQn = 28,
201 TMR3_GLOBAL_IRQn = 29,
202 TMR4_GLOBAL_IRQn = 30,
203 I2C1_EVT_IRQn = 31,
204 I2C1_ERR_IRQn = 32,
205 I2C2_EVT_IRQn = 33,
206 I2C2_ERR_IRQn = 34,
207 SPI1_IRQn = 35,
208 SPI2_IRQn = 36,
209 USART1_IRQn = 37,
210 USART2_IRQn = 38,
211 USART3_IRQn = 39,
212 EXINT15_10_IRQn = 40,
213 RTCAlarm_IRQn = 41,
214 USBFSWakeUp_IRQn = 42,
215 TMR8_BRK_IRQn = 43,
216 TMR8_OVF_IRQn = 44,
217 TMR8_TRG_HALL_IRQn = 45,
218 TMR8_CH_IRQn = 46,
219 SDIO1_IRQn = 49,
220 TMR5_GLOBAL_IRQn = 50,
221 UART4_IRQn = 52,
222 UART5_IRQn = 53,
223 DMA2_Channel1_IRQn = 56,
224 DMA2_Channel2_IRQn = 57,
225 DMA2_Channel3_IRQn = 58,
226 DMA2_Channel4_5_IRQn = 59,
227 CAN2_TX_IRQn = 68,
228 CAN2_RX0_IRQn = 69,
229 CAN2_RX1_IRQn = 70,
230 CAN2_SE_IRQn = 71,
231 ACC_IRQn = 72,
232 USBFS_MAPH_IRQn = 73,
233 USBFS_MAPL_IRQn = 74,
234 DMA2_Channel6_7_IRQn = 75
236} IRQn_Type;
237
242#include "core_cm4.h"
243#include "system_at32f413.h"
244#include <stdint.h>
245
250typedef int32_t INT32;
251typedef int16_t INT16;
252typedef int8_t INT8;
253typedef uint32_t UINT32;
254typedef uint16_t UINT16;
255typedef uint8_t UINT8;
256
257typedef int32_t s32;
258typedef int16_t s16;
259typedef int8_t s8;
260
261typedef const int32_t sc32;
262typedef const int16_t sc16;
263typedef const int8_t sc8;
265typedef __IO int32_t vs32;
266typedef __IO int16_t vs16;
267typedef __IO int8_t vs8;
268
269typedef __I int32_t vsc32;
270typedef __I int16_t vsc16;
271typedef __I int8_t vsc8;
273typedef uint32_t u32;
274typedef uint16_t u16;
275typedef uint8_t u8;
276
277typedef const uint32_t uc32;
278typedef const uint16_t uc16;
279typedef const uint8_t uc8;
281typedef __IO uint32_t vu32;
282typedef __IO uint16_t vu16;
283typedef __IO uint8_t vu8;
284
285typedef __I uint32_t vuc32;
286typedef __I uint16_t vuc16;
287typedef __I uint8_t vuc8;
292typedef enum {RESET = 0, SET = !RESET} flag_status;
293
297typedef enum {FALSE = 0, TRUE = !FALSE} confirm_state;
298
302typedef enum {ERROR = 0, SUCCESS = !ERROR} error_status;
303
312#define REG8(addr) *(volatile uint8_t *)(addr)
313#define REG16(addr) *(volatile uint16_t *)(addr)
314#define REG32(addr) *(volatile uint32_t *)(addr)
315
316#define MAKE_VALUE(reg_offset, bit_num) (uint32_t)(((reg_offset) << 16) | (bit_num & 0x1F))
317
318#define PERIPH_REG(periph_base, value) REG32((periph_base + (value >> 16)))
319#define PERIPH_REG_BIT(value) (0x1U << (value & 0x1F))
320
329#define FLASH_BASE ((uint32_t)0x08000000)
330#define SPIM_FLASH_BASE ((uint32_t)0x08400000)
331#define USD_BASE ((uint32_t)0x1FFFF800)
332#define SRAM_BASE ((uint32_t)0x20000000)
333#define PERIPH_BASE ((uint32_t)0x40000000)
334#define XMC_REG_BASE ((uint32_t)0xA0000000)
335#define DEBUG_BASE ((uint32_t)0xE0042000)
336
337#define APB1PERIPH_BASE (PERIPH_BASE + 0x00000)
338#define APB2PERIPH_BASE (PERIPH_BASE + 0x10000)
339#define AHBPERIPH_BASE (PERIPH_BASE + 0x20000)
340
341/* apb1 bus base address */
342#define TMR2_BASE (APB1PERIPH_BASE + 0x0000)
343#define TMR3_BASE (APB1PERIPH_BASE + 0x0400)
344#define TMR4_BASE (APB1PERIPH_BASE + 0x0800)
345#define TMR5_BASE (APB1PERIPH_BASE + 0x0C00)
346#define RTC_BASE (APB1PERIPH_BASE + 0x2800)
347#define WWDT_BASE (APB1PERIPH_BASE + 0x2C00)
348#define WDT_BASE (APB1PERIPH_BASE + 0x3000)
349#define SPI2_BASE (APB1PERIPH_BASE + 0x3800)
350#define USART2_BASE (APB1PERIPH_BASE + 0x4400)
351#define USART3_BASE (APB1PERIPH_BASE + 0x4800)
352#define UART4_BASE (APB1PERIPH_BASE + 0x4C00)
353#define UART5_BASE (APB1PERIPH_BASE + 0x5000)
354#define I2C1_BASE (APB1PERIPH_BASE + 0x5400)
355#define I2C2_BASE (APB1PERIPH_BASE + 0x5800)
356#define USBFS_BASE (APB1PERIPH_BASE + 0x5C00)
357#define CAN1_BASE (APB1PERIPH_BASE + 0x6400)
358#define CAN2_BASE (APB1PERIPH_BASE + 0x6800)
359#define BPR_BASE (APB1PERIPH_BASE + 0x6C00)
360#define PWC_BASE (APB1PERIPH_BASE + 0x7000)
361/* apb2 bus base address */
362#define IOMUX_BASE (APB2PERIPH_BASE + 0x0000)
363#define EXINT_BASE (APB2PERIPH_BASE + 0x0400)
364#define GPIOA_BASE (APB2PERIPH_BASE + 0x0800)
365#define GPIOB_BASE (APB2PERIPH_BASE + 0x0C00)
366#define GPIOC_BASE (APB2PERIPH_BASE + 0x1000)
367#define GPIOD_BASE (APB2PERIPH_BASE + 0x1400)
368#define GPIOF_BASE (APB2PERIPH_BASE + 0x1C00)
369#define ADC1_BASE (APB2PERIPH_BASE + 0x2400)
370#define ADC2_BASE (APB2PERIPH_BASE + 0x2800)
371#define TMR1_BASE (APB2PERIPH_BASE + 0x2C00)
372#define SPI1_BASE (APB2PERIPH_BASE + 0x3000)
373#define TMR8_BASE (APB2PERIPH_BASE + 0x3400)
374#define USART1_BASE (APB2PERIPH_BASE + 0x3800)
375#define TMR9_BASE (APB2PERIPH_BASE + 0x4C00)
376#define TMR10_BASE (APB2PERIPH_BASE + 0x5000)
377#define TMR11_BASE (APB2PERIPH_BASE + 0x5400)
378#define ACC_BASE (APB2PERIPH_BASE + 0x5800)
379#define SDIO1_BASE (APB2PERIPH_BASE + 0x8000)
380/* ahb bus base address */
381#define DMA1_BASE (AHBPERIPH_BASE + 0x0000)
382#define DMA1_CHANNEL1_BASE (AHBPERIPH_BASE + 0x0008)
383#define DMA1_CHANNEL2_BASE (AHBPERIPH_BASE + 0x001C)
384#define DMA1_CHANNEL3_BASE (AHBPERIPH_BASE + 0x0030)
385#define DMA1_CHANNEL4_BASE (AHBPERIPH_BASE + 0x0044)
386#define DMA1_CHANNEL5_BASE (AHBPERIPH_BASE + 0x0058)
387#define DMA1_CHANNEL6_BASE (AHBPERIPH_BASE + 0x006C)
388#define DMA1_CHANNEL7_BASE (AHBPERIPH_BASE + 0x0080)
389#define DMA2_BASE (AHBPERIPH_BASE + 0x0400)
390#define DMA2_CHANNEL1_BASE (AHBPERIPH_BASE + 0x0408)
391#define DMA2_CHANNEL2_BASE (AHBPERIPH_BASE + 0x041C)
392#define DMA2_CHANNEL3_BASE (AHBPERIPH_BASE + 0x0430)
393#define DMA2_CHANNEL4_BASE (AHBPERIPH_BASE + 0x0444)
394#define DMA2_CHANNEL5_BASE (AHBPERIPH_BASE + 0x0458)
395#define DMA2_CHANNEL6_BASE (AHBPERIPH_BASE + 0x046C)
396#define DMA2_CHANNEL7_BASE (AHBPERIPH_BASE + 0x0480)
397#define CRM_BASE (AHBPERIPH_BASE + 0x1000)
398#define FLASH_REG_BASE (AHBPERIPH_BASE + 0x2000)
399#define CRC_BASE (AHBPERIPH_BASE + 0x3000)
400
413#include "at32f413_def.h"
414#include "at32f413_conf.h"
415
416#ifdef __cplusplus
417}
418#endif
419
420#endif
at32f413_def.h
at32f413 macros header file
IRQn_Type
enum IRQn IRQn_Type
at32f413 interrupt number definition, according to the selected device in Library_configuration_secti...
IRQn
IRQn
at32f413 interrupt number definition, according to the selected device in Library_configuration_secti...
Definition at32f413.h:157
PendSV_IRQn
@ PendSV_IRQn
Definition at32f413.h:167
TMR1_BRK_TMR9_IRQn
@ TMR1_BRK_TMR9_IRQn
Definition at32f413.h:196
ADC1_2_IRQn
@ ADC1_2_IRQn
Definition at32f413.h:190
DMA1_Channel2_IRQn
@ DMA1_Channel2_IRQn
Definition at32f413.h:183
TMR1_OVF_TMR10_IRQn
@ TMR1_OVF_TMR10_IRQn
Definition at32f413.h:197
TAMPER_IRQn
@ TAMPER_IRQn
Definition at32f413.h:173
TMR8_CH_IRQn
@ TMR8_CH_IRQn
Definition at32f413.h:218
MemoryManagement_IRQn
@ MemoryManagement_IRQn
Definition at32f413.h:162
DMA1_Channel1_IRQn
@ DMA1_Channel1_IRQn
Definition at32f413.h:182
DMA1_Channel3_IRQn
@ DMA1_Channel3_IRQn
Definition at32f413.h:184
USART2_IRQn
@ USART2_IRQn
Definition at32f413.h:210
DMA2_Channel6_7_IRQn
@ DMA2_Channel6_7_IRQn
Definition at32f413.h:234
CAN2_SE_IRQn
@ CAN2_SE_IRQn
Definition at32f413.h:230
TMR8_TRG_HALL_IRQn
@ TMR8_TRG_HALL_IRQn
Definition at32f413.h:217
I2C1_ERR_IRQn
@ I2C1_ERR_IRQn
Definition at32f413.h:204
SVCall_IRQn
@ SVCall_IRQn
Definition at32f413.h:165
I2C1_EVT_IRQn
@ I2C1_EVT_IRQn
Definition at32f413.h:203
SPI2_IRQn
@ SPI2_IRQn
Definition at32f413.h:208
Reset_IRQn
@ Reset_IRQn
Definition at32f413.h:159
RTCAlarm_IRQn
@ RTCAlarm_IRQn
Definition at32f413.h:213
DMA1_Channel7_IRQn
@ DMA1_Channel7_IRQn
Definition at32f413.h:188
UsageFault_IRQn
@ UsageFault_IRQn
Definition at32f413.h:164
SysTick_IRQn
@ SysTick_IRQn
Definition at32f413.h:168
EXINT9_5_IRQn
@ EXINT9_5_IRQn
Definition at32f413.h:195
EXINT1_IRQn
@ EXINT1_IRQn
Definition at32f413.h:178
CAN2_RX0_IRQn
@ CAN2_RX0_IRQn
Definition at32f413.h:228
BusFault_IRQn
@ BusFault_IRQn
Definition at32f413.h:163
WWDT_IRQn
@ WWDT_IRQn
Definition at32f413.h:171
TMR4_GLOBAL_IRQn
@ TMR4_GLOBAL_IRQn
Definition at32f413.h:202
USBFS_MAPL_IRQn
@ USBFS_MAPL_IRQn
Definition at32f413.h:233
USBFSWakeUp_IRQn
@ USBFSWakeUp_IRQn
Definition at32f413.h:214
DebugMonitor_IRQn
@ DebugMonitor_IRQn
Definition at32f413.h:166
EXINT0_IRQn
@ EXINT0_IRQn
Definition at32f413.h:177
FLASH_IRQn
@ FLASH_IRQn
Definition at32f413.h:175
CRM_IRQn
@ CRM_IRQn
Definition at32f413.h:176
PVM_IRQn
@ PVM_IRQn
Definition at32f413.h:172
TMR3_GLOBAL_IRQn
@ TMR3_GLOBAL_IRQn
Definition at32f413.h:201
SDIO1_IRQn
@ SDIO1_IRQn
Definition at32f413.h:219
TMR5_GLOBAL_IRQn
@ TMR5_GLOBAL_IRQn
Definition at32f413.h:220
USBFS_L_CAN1_RX0_IRQn
@ USBFS_L_CAN1_RX0_IRQn
Definition at32f413.h:192
EXINT3_IRQn
@ EXINT3_IRQn
Definition at32f413.h:180
DMA1_Channel6_IRQn
@ DMA1_Channel6_IRQn
Definition at32f413.h:187
SPI1_IRQn
@ SPI1_IRQn
Definition at32f413.h:207
HardFault_IRQn
@ HardFault_IRQn
Definition at32f413.h:161
CAN2_RX1_IRQn
@ CAN2_RX1_IRQn
Definition at32f413.h:229
USBFS_H_CAN1_TX_IRQn
@ USBFS_H_CAN1_TX_IRQn
Definition at32f413.h:191
EXINT15_10_IRQn
@ EXINT15_10_IRQn
Definition at32f413.h:212
DMA2_Channel1_IRQn
@ DMA2_Channel1_IRQn
Definition at32f413.h:223
DMA1_Channel5_IRQn
@ DMA1_Channel5_IRQn
Definition at32f413.h:186
UART5_IRQn
@ UART5_IRQn
Definition at32f413.h:222
DMA2_Channel2_IRQn
@ DMA2_Channel2_IRQn
Definition at32f413.h:224
TMR1_TRG_HALL_TMR11_IRQn
@ TMR1_TRG_HALL_TMR11_IRQn
Definition at32f413.h:198
TMR1_CH_IRQn
@ TMR1_CH_IRQn
Definition at32f413.h:199
USBFS_MAPH_IRQn
@ USBFS_MAPH_IRQn
Definition at32f413.h:232
EXINT4_IRQn
@ EXINT4_IRQn
Definition at32f413.h:181
I2C2_ERR_IRQn
@ I2C2_ERR_IRQn
Definition at32f413.h:206
USART1_IRQn
@ USART1_IRQn
Definition at32f413.h:209
TMR8_BRK_IRQn
@ TMR8_BRK_IRQn
Definition at32f413.h:215
DMA2_Channel3_IRQn
@ DMA2_Channel3_IRQn
Definition at32f413.h:225
RTC_IRQn
@ RTC_IRQn
Definition at32f413.h:174
DMA2_Channel4_5_IRQn
@ DMA2_Channel4_5_IRQn
Definition at32f413.h:226
CAN1_SE_IRQn
@ CAN1_SE_IRQn
Definition at32f413.h:194
NonMaskableInt_IRQn
@ NonMaskableInt_IRQn
Definition at32f413.h:160
UART4_IRQn
@ UART4_IRQn
Definition at32f413.h:221
DMA1_Channel4_IRQn
@ DMA1_Channel4_IRQn
Definition at32f413.h:185
EXINT2_IRQn
@ EXINT2_IRQn
Definition at32f413.h:179
TMR8_OVF_IRQn
@ TMR8_OVF_IRQn
Definition at32f413.h:216
I2C2_EVT_IRQn
@ I2C2_EVT_IRQn
Definition at32f413.h:205
ACC_IRQn
@ ACC_IRQn
Definition at32f413.h:231
CAN2_TX_IRQn
@ CAN2_TX_IRQn
Definition at32f413.h:227
CAN1_RX1_IRQn
@ CAN1_RX1_IRQn
Definition at32f413.h:193
TMR2_GLOBAL_IRQn
@ TMR2_GLOBAL_IRQn
Definition at32f413.h:200
USART3_IRQn
@ USART3_IRQn
Definition at32f413.h:211
vu32
__IO uint32_t vu32
Definition at32f413.h:281
INT8
int8_t INT8
Definition at32f413.h:252
vs16
__IO int16_t vs16
Definition at32f413.h:266
error_status
error_status
error status
Definition at32f413.h:302
INT32
int32_t INT32
Definition at32f413.h:250
vuc32
__I uint32_t vuc32
Definition at32f413.h:285
sc8
const int8_t sc8
Definition at32f413.h:263
vsc16
__I int16_t vsc16
Definition at32f413.h:270
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
vsc8
__I int8_t vsc8
Definition at32f413.h:271
vs32
__IO int32_t vs32
Definition at32f413.h:265
vu8
__IO uint8_t vu8
Definition at32f413.h:283
uc32
const uint32_t uc32
Definition at32f413.h:277
sc16
const int16_t sc16
Definition at32f413.h:262
vuc16
__I uint16_t vuc16
Definition at32f413.h:286
flag_status
flag_status
flag status
Definition at32f413.h:292
u8
uint8_t u8
Definition at32f413.h:275
vu16
__IO uint16_t vu16
Definition at32f413.h:282
s8
int8_t s8
Definition at32f413.h:259
vs8
__IO int8_t vs8
Definition at32f413.h:267
s16
int16_t s16
Definition at32f413.h:258
vuc8
__I uint8_t vuc8
Definition at32f413.h:287
uc16
const uint16_t uc16
Definition at32f413.h:278
uc8
const uint8_t uc8
Definition at32f413.h:279
INT16
int16_t INT16
Definition at32f413.h:251
UINT16
uint16_t UINT16
Definition at32f413.h:254
u16
uint16_t u16
Definition at32f413.h:274
sc32
const int32_t sc32
Definition at32f413.h:261
UINT32
uint32_t UINT32
Definition at32f413.h:253
s32
int32_t s32
Definition at32f413.h:257
vsc32
__I int32_t vsc32
Definition at32f413.h:269
UINT8
uint8_t UINT8
Definition at32f413.h:255
u32
uint32_t u32
Definition at32f413.h:273
ERROR
@ ERROR
Definition at32f413.h:302
SUCCESS
@ SUCCESS
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
SET
@ SET
Definition at32f413.h:292
at32f413_conf.h
at32f413 config header file
system_at32f413.h
cmsis cortex-m4 system header file.


AT32F413 Firmwary Library: at32f413_acc.c Source File

  • libraries
  • drivers
  • src
at32f413_acc.c
Go to the documentation of this file.
1
26#include "at32f413_conf.h"
27
37#ifdef ACC_MODULE_ENABLED
38
52void acc_calibration_mode_enable(uint16_t acc_trim, confirm_state new_state)
53{
54 if(acc_trim == ACC_CAL_HICKCAL)
55 {
56 ACC->ctrl1_bit.entrim = FALSE;
57 }
58 else
59 {
60 ACC->ctrl1_bit.entrim = TRUE;
61 }
62 ACC->ctrl1_bit.calon = new_state;
63}
64
70void acc_step_set(uint8_t step_value)
71{
72 ACC->ctrl1_bit.step = step_value;
73}
74
84void acc_interrupt_enable(uint16_t acc_int, confirm_state new_state)
85{
86 if(acc_int == ACC_CALRDYIEN_INT)
87 {
88 ACC->ctrl1_bit.calrdyien = new_state;
89 }
90 else
91 {
92 ACC->ctrl1_bit.eien = new_state;
93 }
94}
95
101uint8_t acc_hicktrim_get(void)
102{
103 return ((uint8_t)(ACC->ctrl2_bit.hicktrim));
104}
105
111uint8_t acc_hickcal_get(void)
112{
113 return ((uint8_t)(ACC->ctrl2_bit.hickcal));
114}
115
121void acc_write_c1(uint16_t acc_c1_value)
122{
123 ACC->c1 = acc_c1_value;
124}
125
131void acc_write_c2(uint16_t acc_c2_value)
132{
133 ACC->c2 = acc_c2_value;
134}
135
141void acc_write_c3(uint16_t acc_c3_value)
142{
143 ACC->c3 = acc_c3_value;
144}
145
151uint16_t acc_read_c1(void)
152{
153 return ((uint16_t)(ACC->c1));
154}
155
161uint16_t acc_read_c2(void)
162{
163 return ((uint16_t)(ACC->c2));
164}
165
171uint16_t acc_read_c3(void)
172{
173 return ((uint16_t)(ACC->c3));
174}
175
184 flag_status acc_flag_get(uint16_t acc_flag)
185{
186 if(acc_flag == ACC_CALRDY_FLAG)
187 return (flag_status)(ACC->sts_bit.calrdy);
188 else
189 return (flag_status)(ACC->sts_bit.rslost);
190}
191
200 flag_status acc_interrupt_flag_get(uint16_t acc_flag)
201{
202 if(acc_flag == ACC_CALRDY_FLAG)
203 return (flag_status)(ACC->sts_bit.calrdy && ACC->ctrl1_bit.calrdyien);
204 else
205 return (flag_status)(ACC->sts_bit.rslost && ACC->ctrl1_bit.eien);
206}
207
216void acc_flag_clear(uint16_t acc_flag)
217{
218 ACC->sts = ~acc_flag;
219}
220
225#endif
226
acc_c2_value
uint32_t acc_c2_value
Definition project/at_start_f413/examples/acc/calibration/src/main.c:59
ACC_CAL_HICKCAL
#define ACC_CAL_HICKCAL
Definition at32f413_acc.h:51
ACC_CALRDYIEN_INT
#define ACC_CALRDYIEN_INT
Definition at32f413_acc.h:57
ACC_CALRDY_FLAG
#define ACC_CALRDY_FLAG
Definition at32f413_acc.h:55
acc_write_c2
void acc_write_c2(uint16_t acc_c2_value)
wtire the value to acc c2 register.
Definition at32f413_acc.c:131
acc_write_c3
void acc_write_c3(uint16_t acc_c3_value)
wtire the value to acc c3 register.
Definition at32f413_acc.c:141
acc_step_set
void acc_step_set(uint8_t step_value)
store calibration step data in acc's ctrl1 register.
Definition at32f413_acc.c:70
acc_read_c2
uint16_t acc_read_c2(void)
return the current acc c2 value.
Definition at32f413_acc.c:161
acc_hickcal_get
uint8_t acc_hickcal_get(void)
return the current acc hickcal value.
Definition at32f413_acc.c:111
acc_interrupt_enable
void acc_interrupt_enable(uint16_t acc_int, confirm_state new_state)
enable or disable the specified acc interrupts.
Definition at32f413_acc.c:84
acc_read_c3
uint16_t acc_read_c3(void)
return the current acc c3 value.
Definition at32f413_acc.c:171
acc_read_c1
uint16_t acc_read_c1(void)
return the current acc c1 value.
Definition at32f413_acc.c:151
acc_interrupt_flag_get
flag_status acc_interrupt_flag_get(uint16_t acc_flag)
check whether the specified acc interrupt flag is set or not.
Definition at32f413_acc.c:200
acc_write_c1
void acc_write_c1(uint16_t acc_c1_value)
wtire the value to acc c1 register.
Definition at32f413_acc.c:121
acc_flag_get
flag_status acc_flag_get(uint16_t acc_flag)
check whether the specified acc flag is set or not.
Definition at32f413_acc.c:184
acc_flag_clear
void acc_flag_clear(uint16_t acc_flag)
clear the specified acc flag is set or not.
Definition at32f413_acc.c:216
acc_hicktrim_get
uint8_t acc_hicktrim_get(void)
return the current acc hicktrim value.
Definition at32f413_acc.c:101
acc_calibration_mode_enable
void acc_calibration_mode_enable(uint16_t acc_trim, confirm_state new_state)
enable or disable the acc calibration mode.
Definition at32f413_acc.c:52
ACC
#define ACC
Definition at32f413_acc.h:165
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
flag_status
flag_status
flag status
Definition at32f413.h:292
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
at32f413_conf.h
at32f413 config header file


AT32F413 Firmwary Library: at32f413_acc.h Source File

  • libraries
  • drivers
  • inc
at32f413_acc.h
Go to the documentation of this file.
1
26/* Define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_ACC_H
28#define __AT32F413_ACC_H
29
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
35
36/* Includes ------------------------------------------------------------------*/
37#include "at32f413.h"
38
51#define ACC_CAL_HICKCAL ((uint16_t)0x0000)
52#define ACC_CAL_HICKTRIM ((uint16_t)0x0002)
54#define ACC_RSLOST_FLAG ((uint16_t)0x0002)
55#define ACC_CALRDY_FLAG ((uint16_t)0x0001)
57#define ACC_CALRDYIEN_INT ((uint16_t)0x0020)
58#define ACC_EIEN_INT ((uint16_t)0x0010)
71typedef struct
72{
73
77 union
78 {
79 __IO uint32_t sts;
80 struct
81 {
82 __IO uint32_t calrdy : 1; /* [0] */
83 __IO uint32_t rslost : 1; /* [1] */
84 __IO uint32_t reserved1 : 30;/* [31:2] */
85 } sts_bit;
86 };
87
91 union
92 {
93 __IO uint32_t ctrl1;
94 struct
95 {
96 __IO uint32_t calon : 1; /* [0] */
97 __IO uint32_t entrim : 1; /* [1] */
98 __IO uint32_t reserved1 : 2; /* [3:2] */
99 __IO uint32_t eien : 1; /* [4] */
100 __IO uint32_t calrdyien : 1; /* [5] */
101 __IO uint32_t reserved2 : 2; /* [7:6] */
102 __IO uint32_t step : 4; /* [11:8] */
103 __IO uint32_t reserved3 : 20;/* [31:12] */
104 } ctrl1_bit;
105 };
106
110 union
111 {
112 __IO uint32_t ctrl2;
113 struct
114 {
115 __IO uint32_t hickcal : 8; /* [7:0] */
116 __IO uint32_t hicktrim : 6; /* [13:8] */
117 __IO uint32_t reserved1 : 18;/* [31:14] */
118 } ctrl2_bit;
119 };
120
124 union
125 {
126 __IO uint32_t c1;
127 struct
128 {
129 __IO uint32_t c1 : 16;/* [15:0] */
130 __IO uint32_t reserved1 : 16;/* [31:16] */
131 } c1_bit;
132 };
133
137 union
138 {
139 __IO uint32_t c2;
140 struct
141 {
142 __IO uint32_t c2 : 16;/* [15:0] */
143 __IO uint32_t reserved1 : 16;/* [31:16] */
144 } c2_bit;
145 };
146
150 union
151 {
152 __IO uint32_t c3;
153 struct
154 {
155 __IO uint32_t c3 : 16;/* [15:0] */
156 __IO uint32_t reserved1 : 16;/* [31:16] */
157 } c3_bit;
158 };
159} acc_type;
160
165#define ACC ((acc_type *) ACC_BASE)
166
171void acc_calibration_mode_enable(uint16_t acc_trim, confirm_state new_state);
172void acc_step_set(uint8_t step_value);
173void acc_interrupt_enable(uint16_t acc_int, confirm_state new_state);
174uint8_t acc_hicktrim_get(void);
175uint8_t acc_hickcal_get(void);
176void acc_write_c1(uint16_t acc_c1_value);
177void acc_write_c2(uint16_t acc_c2_value);
178void acc_write_c3(uint16_t acc_c3_value);
179uint16_t acc_read_c1(void);
180uint16_t acc_read_c2(void);
181uint16_t acc_read_c3(void);
182 flag_status acc_flag_get(uint16_t acc_flag);
183 flag_status acc_interrupt_flag_get(uint16_t acc_flag);
184void acc_flag_clear(uint16_t acc_flag);
185
198#ifdef __cplusplus
199}
200#endif
201
202#endif
at32f413.h
at32f413 header file
acc_c2_value
uint32_t acc_c2_value
Definition project/at_start_f413/examples/acc/calibration/src/main.c:59
acc_write_c2
void acc_write_c2(uint16_t acc_c2_value)
wtire the value to acc c2 register.
Definition at32f413_acc.c:131
acc_write_c3
void acc_write_c3(uint16_t acc_c3_value)
wtire the value to acc c3 register.
Definition at32f413_acc.c:141
acc_step_set
void acc_step_set(uint8_t step_value)
store calibration step data in acc's ctrl1 register.
Definition at32f413_acc.c:70
acc_read_c2
uint16_t acc_read_c2(void)
return the current acc c2 value.
Definition at32f413_acc.c:161
acc_hickcal_get
uint8_t acc_hickcal_get(void)
return the current acc hickcal value.
Definition at32f413_acc.c:111
acc_interrupt_enable
void acc_interrupt_enable(uint16_t acc_int, confirm_state new_state)
enable or disable the specified acc interrupts.
Definition at32f413_acc.c:84
acc_read_c3
uint16_t acc_read_c3(void)
return the current acc c3 value.
Definition at32f413_acc.c:171
acc_read_c1
uint16_t acc_read_c1(void)
return the current acc c1 value.
Definition at32f413_acc.c:151
acc_interrupt_flag_get
flag_status acc_interrupt_flag_get(uint16_t acc_flag)
check whether the specified acc interrupt flag is set or not.
Definition at32f413_acc.c:200
acc_write_c1
void acc_write_c1(uint16_t acc_c1_value)
wtire the value to acc c1 register.
Definition at32f413_acc.c:121
acc_flag_get
flag_status acc_flag_get(uint16_t acc_flag)
check whether the specified acc flag is set or not.
Definition at32f413_acc.c:184
acc_flag_clear
void acc_flag_clear(uint16_t acc_flag)
clear the specified acc flag is set or not.
Definition at32f413_acc.c:216
acc_hicktrim_get
uint8_t acc_hicktrim_get(void)
return the current acc hicktrim value.
Definition at32f413_acc.c:101
acc_calibration_mode_enable
void acc_calibration_mode_enable(uint16_t acc_trim, confirm_state new_state)
enable or disable the acc calibration mode.
Definition at32f413_acc.c:52
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
flag_status
flag_status
flag status
Definition at32f413.h:292
acc_type
type define acc register all
Definition at32f413_acc.h:72
acc_type::entrim
__IO uint32_t entrim
Definition at32f413_acc.h:97
acc_type::ctrl1
__IO uint32_t ctrl1
Definition at32f413_acc.h:93
acc_type::hicktrim
__IO uint32_t hicktrim
Definition at32f413_acc.h:116
acc_type::c2
__IO uint32_t c2
Definition at32f413_acc.h:139
acc_type::rslost
__IO uint32_t rslost
Definition at32f413_acc.h:83
acc_type::reserved2
__IO uint32_t reserved2
Definition at32f413_acc.h:101
acc_type::c3
__IO uint32_t c3
Definition at32f413_acc.h:152
acc_type::calrdyien
__IO uint32_t calrdyien
Definition at32f413_acc.h:100
acc_type::calon
__IO uint32_t calon
Definition at32f413_acc.h:96
acc_type::eien
__IO uint32_t eien
Definition at32f413_acc.h:99
acc_type::reserved1
__IO uint32_t reserved1
Definition at32f413_acc.h:84
acc_type::sts
__IO uint32_t sts
Definition at32f413_acc.h:79
acc_type::hickcal
__IO uint32_t hickcal
Definition at32f413_acc.h:115
acc_type::ctrl2
__IO uint32_t ctrl2
Definition at32f413_acc.h:112
acc_type::reserved3
__IO uint32_t reserved3
Definition at32f413_acc.h:103
acc_type::c1
__IO uint32_t c1
Definition at32f413_acc.h:126
acc_type::calrdy
__IO uint32_t calrdy
Definition at32f413_acc.h:82
acc_type::step
__IO uint32_t step
Definition at32f413_acc.h:102


AT32F413 Firmwary Library: at32f413_adc.c Source File

  • libraries
  • drivers
  • src
at32f413_adc.c
Go to the documentation of this file.
1
26#include "at32f413_conf.h"
27
37#ifdef ADC_MODULE_ENABLED
38
50void adc_reset(adc_type *adc_x)
51{
52 if(adc_x == ADC1)
53 {
54 crm_periph_reset(CRM_ADC1_PERIPH_RESET, TRUE);
55 crm_periph_reset(CRM_ADC1_PERIPH_RESET, FALSE);
56 }
57 else if(adc_x == ADC2)
58 {
59 crm_periph_reset(CRM_ADC2_PERIPH_RESET, TRUE);
60 crm_periph_reset(CRM_ADC2_PERIPH_RESET, FALSE);
61 }
62}
63
74void adc_enable(adc_type *adc_x, confirm_state new_state)
75{
76 adc_x->ctrl2_bit.adcen = new_state;
77}
78
96void adc_combine_mode_select(adc_combine_mode_type combine_mode)
97{
98 ADC1->ctrl1_bit.mssel = combine_mode;
99}
100
116void adc_base_default_para_init(adc_base_config_type *adc_base_struct)
117{
118 adc_base_struct->sequence_mode = FALSE;
119 adc_base_struct->repeat_mode = FALSE;
120 adc_base_struct->data_align = ADC_RIGHT_ALIGNMENT;
121 adc_base_struct->ordinary_channel_length = 1;
122}
123
142void adc_base_config(adc_type *adc_x, adc_base_config_type *adc_base_struct)
143{
144 adc_x->ctrl1_bit.sqen = adc_base_struct->sequence_mode;
145 adc_x->ctrl2_bit.rpen = adc_base_struct->repeat_mode;
146 adc_x->ctrl2_bit.dtalign = adc_base_struct->data_align;
147 adc_x->osq1_bit.oclen = adc_base_struct->ordinary_channel_length - 1;
148}
149
160void adc_dma_mode_enable(adc_type *adc_x, confirm_state new_state)
161{
162 adc_x->ctrl2_bit.ocdmaen = new_state;
163}
164
179void adc_interrupt_enable(adc_type *adc_x, uint32_t adc_int, confirm_state new_state)
180{
181 if(new_state == TRUE)
182 {
183 adc_x->ctrl1 |= adc_int;
184 }
185 else if(new_state == FALSE)
186 {
187 adc_x->ctrl1 &= ~adc_int;
188 }
189}
190
198void adc_calibration_init(adc_type *adc_x)
199{
200 adc_x->ctrl2_bit.adcalinit = TRUE;
201}
202
210 flag_status adc_calibration_init_status_get(adc_type *adc_x)
211{
212 if(adc_x->ctrl2_bit.adcalinit)
213 {
214 return SET;
215 }
216 else
217 {
218 return RESET;
219 }
220}
221
229void adc_calibration_start(adc_type *adc_x)
230{
231 adc_x->ctrl2_bit.adcal = TRUE;
232}
233
241 flag_status adc_calibration_status_get(adc_type *adc_x)
242{
243 if(adc_x->ctrl2_bit.adcal)
244 {
245 return SET;
246 }
247 else
248 {
249 return RESET;
250 }
251}
252
269void adc_voltage_monitor_enable(adc_type *adc_x, adc_voltage_monitoring_type adc_voltage_monitoring)
270{
271 adc_x->ctrl1_bit.ocvmen = FALSE;
272 adc_x->ctrl1_bit.pcvmen = FALSE;
273 adc_x->ctrl1_bit.vmsgen = FALSE;
274 adc_x->ctrl1 |= adc_voltage_monitoring;
275}
276
290void adc_voltage_monitor_threshold_value_set(adc_type *adc_x, uint16_t adc_high_threshold, uint16_t adc_low_threshold)
291{
292 adc_x->vmhb_bit.vmhb = adc_high_threshold;
293 adc_x->vmlb_bit.vmlb = adc_low_threshold;
294}
295
310void adc_voltage_monitor_single_channel_select(adc_type *adc_x, adc_channel_select_type adc_channel)
311{
312 adc_x->ctrl1_bit.vmcsel = adc_channel;
313}
314
342void adc_ordinary_channel_set(adc_type *adc_x, adc_channel_select_type adc_channel, uint8_t adc_sequence, adc_sampletime_select_type adc_sampletime)
343{
344 uint32_t tmp_reg;
345 if(adc_channel < ADC_CHANNEL_10)
346 {
347 tmp_reg = adc_x->spt2;
348 tmp_reg &= ~(0x07 << 3 * adc_channel);
349 tmp_reg |= adc_sampletime << 3 * adc_channel;
350 adc_x->spt2 = tmp_reg;
351 }
352 else
353 {
354 tmp_reg = adc_x->spt1;
355 tmp_reg &= ~(0x07 << 3 * (adc_channel - ADC_CHANNEL_10));
356 tmp_reg |= adc_sampletime << 3 * (adc_channel - ADC_CHANNEL_10);
357 adc_x->spt1 = tmp_reg;
358 }
359
360 if(adc_sequence >= 13)
361 {
362 tmp_reg = adc_x->osq1;
363 tmp_reg &= ~(0x01F << 5 * (adc_sequence - 13));
364 tmp_reg |= adc_channel << 5 * (adc_sequence - 13);
365 adc_x->osq1 = tmp_reg;
366 }
367 else if(adc_sequence >= 7)
368 {
369 tmp_reg = adc_x->osq2;
370 tmp_reg &= ~(0x01F << 5 * (adc_sequence - 7));
371 tmp_reg |= adc_channel << 5 * (adc_sequence - 7);
372 adc_x->osq2 = tmp_reg;
373 }
374 else
375 {
376 tmp_reg = adc_x->osq3;
377 tmp_reg &= ~(0x01F << 5 * (adc_sequence - 1));
378 tmp_reg |= adc_channel << 5 * (adc_sequence - 1);
379 adc_x->osq3 = tmp_reg;
380 }
381}
382
393void adc_preempt_channel_length_set(adc_type *adc_x, uint8_t adc_channel_lenght)
394{
395 adc_x->psq_bit.pclen = adc_channel_lenght - 1;
396}
397
425void adc_preempt_channel_set(adc_type *adc_x, adc_channel_select_type adc_channel, uint8_t adc_sequence, adc_sampletime_select_type adc_sampletime)
426{
427 uint32_t tmp_reg;
428 uint8_t sequence_index;
429 if(adc_channel < ADC_CHANNEL_10)
430 {
431 tmp_reg = adc_x->spt2;
432 tmp_reg &= ~(0x07 << 3 * adc_channel);
433 tmp_reg |= adc_sampletime << 3 * adc_channel;
434 adc_x->spt2 = tmp_reg;
435 }
436 else
437 {
438 tmp_reg = adc_x->spt1;
439 tmp_reg &= ~(0x07 << 3 * (adc_channel - ADC_CHANNEL_10));
440 tmp_reg |= adc_sampletime << 3 * (adc_channel - ADC_CHANNEL_10);
441 adc_x->spt1 = tmp_reg;
442 }
443
444 sequence_index = adc_sequence + 3 - adc_x->psq_bit.pclen;
445 switch(sequence_index)
446 {
447 case 1:
448 adc_x->psq_bit.psn1 = adc_channel;
449 break;
450 case 2:
451 adc_x->psq_bit.psn2 = adc_channel;
452 break;
453 case 3:
454 adc_x->psq_bit.psn3 = adc_channel;
455 break;
456 case 4:
457 adc_x->psq_bit.psn4 = adc_channel;
458 break;
459 default:
460 break;
461 }
462}
463
480void adc_ordinary_conversion_trigger_set(adc_type *adc_x, adc_ordinary_trig_select_type adc_ordinary_trig, confirm_state new_state)
481{
482 if(adc_ordinary_trig > 7)
483 {
484 adc_x->ctrl2_bit.octesel_h = 1;
485 adc_x->ctrl2_bit.octesel_l = adc_ordinary_trig & 0x7;
486 }
487 else
488 {
489 adc_x->ctrl2_bit.octesel_h = 0;
490 adc_x->ctrl2_bit.octesel_l = adc_ordinary_trig & 0x7;
491 }
492 adc_x->ctrl2_bit.octen = new_state;
493}
494
511void adc_preempt_conversion_trigger_set(adc_type *adc_x, adc_preempt_trig_select_type adc_preempt_trig, confirm_state new_state)
512{
513 if(adc_preempt_trig > 7)
514 {
515 adc_x->ctrl2_bit.pctesel_h = 1;
516 adc_x->ctrl2_bit.pctesel_l = adc_preempt_trig & 0x7;
517 }
518 else
519 {
520 adc_x->ctrl2_bit.pctesel_h = 0;
521 adc_x->ctrl2_bit.pctesel_l = adc_preempt_trig & 0x7;
522 }
523 adc_x->ctrl2_bit.pcten = new_state;
524}
525
526
543void adc_preempt_offset_value_set(adc_type *adc_x, adc_preempt_channel_type adc_preempt_channel, uint16_t adc_offset_value)
544{
545 switch(adc_preempt_channel)
546 {
547 case ADC_PREEMPT_CHANNEL_1:
548 adc_x->pcdto1_bit.pcdto1 = adc_offset_value;
549 break;
550 case ADC_PREEMPT_CHANNEL_2:
551 adc_x->pcdto2_bit.pcdto2 = adc_offset_value;
552 break;
553 case ADC_PREEMPT_CHANNEL_3:
554 adc_x->pcdto3_bit.pcdto3 = adc_offset_value;
555 break;
556 case ADC_PREEMPT_CHANNEL_4:
557 adc_x->pcdto4_bit.pcdto4 = adc_offset_value;
558 break;
559 default:
560 break;
561 }
562}
563
574void adc_ordinary_part_count_set(adc_type *adc_x, uint8_t adc_channel_count)
575{
576
577 adc_x->ctrl1_bit.ocpcnt = adc_channel_count - 1;
578}
579
589void adc_ordinary_part_mode_enable(adc_type *adc_x, confirm_state new_state)
590{
591 adc_x->ctrl1_bit.ocpen = new_state;
592}
593
603void adc_preempt_part_mode_enable(adc_type *adc_x, confirm_state new_state)
604{
605 adc_x->ctrl1_bit.pcpen = new_state;
606}
607
617void adc_preempt_auto_mode_enable(adc_type *adc_x, confirm_state new_state)
618{
619 adc_x->ctrl1_bit.pcautoen = new_state;
620}
621
629void adc_tempersensor_vintrv_enable(confirm_state new_state)
630{
631 ADC1->ctrl2_bit.itsrven = new_state;
632}
633
643void adc_ordinary_software_trigger_enable(adc_type *adc_x, confirm_state new_state)
644{
645 adc_x->ctrl2_bit.ocswtrg = new_state;
646}
647
655 flag_status adc_ordinary_software_trigger_status_get(adc_type *adc_x)
656{
657 if(adc_x->ctrl2_bit.ocswtrg)
658 {
659 return SET;
660 }
661 else
662 {
663 return RESET;
664 }
665}
666
676void adc_preempt_software_trigger_enable(adc_type *adc_x, confirm_state new_state)
677{
678 adc_x->ctrl2_bit.pcswtrg = new_state;
679}
680
688 flag_status adc_preempt_software_trigger_status_get(adc_type *adc_x)
689{
690 if(adc_x->ctrl2_bit.pcswtrg)
691 {
692 return SET;
693 }
694 else
695 {
696 return RESET;
697 }
698}
699
707uint16_t adc_ordinary_conversion_data_get(adc_type *adc_x)
708{
709 return (uint16_t)(adc_x->odt_bit.odt);
710}
711
716uint32_t adc_combine_ordinary_conversion_data_get(void)
717{
718 return (uint32_t)(ADC1->odt);
719}
720
734uint16_t adc_preempt_conversion_data_get(adc_type *adc_x, adc_preempt_channel_type adc_preempt_channel)
735{
736 uint16_t preempt_conv_data_index = 0;
737 switch(adc_preempt_channel)
738 {
739 case ADC_PREEMPT_CHANNEL_1:
740 preempt_conv_data_index = (uint16_t)(adc_x->pdt1_bit.pdt1);
741 break;
742 case ADC_PREEMPT_CHANNEL_2:
743 preempt_conv_data_index = (uint16_t)(adc_x->pdt2_bit.pdt2);
744 break;
745 case ADC_PREEMPT_CHANNEL_3:
746 preempt_conv_data_index = (uint16_t)(adc_x->pdt3_bit.pdt3);
747 break;
748 case ADC_PREEMPT_CHANNEL_4:
749 preempt_conv_data_index = (uint16_t)(adc_x->pdt4_bit.pdt4);
750 break;
751 default:
752 break;
753 }
754 return preempt_conv_data_index;
755}
756
771 flag_status adc_flag_get(adc_type *adc_x, uint8_t adc_flag)
772{
773 flag_status status = RESET;
774
775 if((adc_x->sts & adc_flag) == RESET)
776 {
777 status = RESET;
778 }
779 else
780 {
781 status = SET;
782 }
783 return status;
784}
785
798 flag_status adc_interrupt_flag_get(adc_type *adc_x, uint8_t adc_flag)
799{
800 flag_status status = RESET;
801 switch(adc_flag)
802 {
803 case ADC_VMOR_FLAG:
804 if(adc_x->sts_bit.vmor && adc_x->ctrl1_bit.vmorien)
805 {
806 status = SET;
807 }
808 break;
809 case ADC_CCE_FLAG:
810 if(adc_x->sts_bit.cce && adc_x->ctrl1_bit.cceien)
811 {
812 status = SET;
813 }
814 break;
815 case ADC_PCCE_FLAG:
816 if(adc_x->sts_bit.pcce && adc_x->ctrl1_bit.pcceien)
817 {
818 status = SET;
819 }
820 break;
821 default:
822 break;
823 }
824 return status;
825}
826
841void adc_flag_clear(adc_type *adc_x, uint32_t adc_flag)
842{
843 adc_x->sts = ~adc_flag;
844}
845
850#endif
851
adc_voltage_monitoring_type
adc_voltage_monitoring_type
adc voltage_monitoring type
Definition at32f413_adc.h:197
adc_channel_select_type
adc_channel_select_type
adc channel select type
Definition at32f413_adc.h:108
adc_sampletime_select_type
adc_sampletime_select_type
adc sampletime select type
Definition at32f413_adc.h:133
adc_preempt_trig_select_type
adc_preempt_trig_select_type
adc preempt group trigger event select type
Definition at32f413_adc.h:167
adc_combine_mode_type
adc_combine_mode_type
adc combine mode type(these options are reserved in adc2)
Definition at32f413_adc.h:82
adc_ordinary_trig_select_type
adc_ordinary_trig_select_type
adc ordinary group trigger event select type
Definition at32f413_adc.h:148
adc_preempt_channel_type
adc_preempt_channel_type
adc preempt channel type
Definition at32f413_adc.h:186
ADC_RIGHT_ALIGNMENT
@ ADC_RIGHT_ALIGNMENT
Definition at32f413_adc.h:100
ADC_CHANNEL_10
@ ADC_CHANNEL_10
Definition at32f413_adc.h:119
ADC_PREEMPT_CHANNEL_3
@ ADC_PREEMPT_CHANNEL_3
Definition at32f413_adc.h:189
ADC_PREEMPT_CHANNEL_4
@ ADC_PREEMPT_CHANNEL_4
Definition at32f413_adc.h:190
ADC_PREEMPT_CHANNEL_2
@ ADC_PREEMPT_CHANNEL_2
Definition at32f413_adc.h:188
ADC_PREEMPT_CHANNEL_1
@ ADC_PREEMPT_CHANNEL_1
Definition at32f413_adc.h:187
ADC_PCCE_FLAG
#define ADC_PCCE_FLAG
Definition at32f413_adc.h:66
ADC_VMOR_FLAG
#define ADC_VMOR_FLAG
Definition at32f413_adc.h:64
ADC_CCE_FLAG
#define ADC_CCE_FLAG
Definition at32f413_adc.h:65
adc_ordinary_software_trigger_enable
void adc_ordinary_software_trigger_enable(adc_type *adc_x, confirm_state new_state)
enable or disable ordinary software start conversion of the specified adc peripheral.
Definition at32f413_adc.c:643
adc_voltage_monitor_enable
void adc_voltage_monitor_enable(adc_type *adc_x, adc_voltage_monitoring_type adc_voltage_monitoring)
enable or disable the voltage monitoring on single/all ordinary or preempt channels of the specified ...
Definition at32f413_adc.c:269
adc_voltage_monitor_single_channel_select
void adc_voltage_monitor_single_channel_select(adc_type *adc_x, adc_channel_select_type adc_channel)
select the voltage monitoring's channel of the specified adc peripheral.
Definition at32f413_adc.c:310
adc_ordinary_conversion_data_get
uint16_t adc_ordinary_conversion_data_get(adc_type *adc_x)
return the last conversion data for ordinary channel of the specified adc peripheral.
Definition at32f413_adc.c:707
adc_preempt_offset_value_set
void adc_preempt_offset_value_set(adc_type *adc_x, adc_preempt_channel_type adc_preempt_channel, uint16_t adc_offset_value)
set preempt channel's conversion value offset of the specified adc peripheral.
Definition at32f413_adc.c:543
adc_base_config
void adc_base_config(adc_type *adc_x, adc_base_config_type *adc_base_struct)
initialize the adc peripheral according to the specified parameters.
Definition at32f413_adc.c:142
adc_ordinary_software_trigger_status_get
flag_status adc_ordinary_software_trigger_status_get(adc_type *adc_x)
get ordinary software start conversion status of the specified adc peripheral.
Definition at32f413_adc.c:655
adc_preempt_auto_mode_enable
void adc_preempt_auto_mode_enable(adc_type *adc_x, confirm_state new_state)
enable or disable automatic preempt group conversion of the specified adc peripheral.
Definition at32f413_adc.c:617
adc_tempersensor_vintrv_enable
void adc_tempersensor_vintrv_enable(confirm_state new_state)
enable or disable the temperature sensor and vintrv channel.
Definition at32f413_adc.c:629
adc_preempt_software_trigger_status_get
flag_status adc_preempt_software_trigger_status_get(adc_type *adc_x)
get preempt software start conversion status of the specified adc peripheral.
Definition at32f413_adc.c:688
adc_enable
void adc_enable(adc_type *adc_x, confirm_state new_state)
enable or disable the specified adc peripheral.
Definition at32f413_adc.c:74
adc_ordinary_part_count_set
void adc_ordinary_part_count_set(adc_type *adc_x, uint8_t adc_channel_count)
set partitioned mode channel count of the specified adc peripheral.
Definition at32f413_adc.c:574
adc_preempt_conversion_data_get
uint16_t adc_preempt_conversion_data_get(adc_type *adc_x, adc_preempt_channel_type adc_preempt_channel)
return the conversion data for selection preempt channel of the specified adc peripheral.
Definition at32f413_adc.c:734
adc_flag_clear
void adc_flag_clear(adc_type *adc_x, uint32_t adc_flag)
clear flag of the specified adc peripheral.
Definition at32f413_adc.c:841
adc_interrupt_enable
void adc_interrupt_enable(adc_type *adc_x, uint32_t adc_int, confirm_state new_state)
enable or disable the specified adc interrupts.
Definition at32f413_adc.c:179
adc_base_default_para_init
void adc_base_default_para_init(adc_base_config_type *adc_base_struct)
adc base default para init.
Definition at32f413_adc.c:116
adc_calibration_start
void adc_calibration_start(adc_type *adc_x)
start calibration process of the specified adc peripheral.
Definition at32f413_adc.c:229
adc_calibration_status_get
flag_status adc_calibration_status_get(adc_type *adc_x)
get calibration status of the specified adc peripheral.
Definition at32f413_adc.c:241
adc_interrupt_flag_get
flag_status adc_interrupt_flag_get(adc_type *adc_x, uint8_t adc_flag)
get interrupt flag of the specified adc peripheral.
Definition at32f413_adc.c:798
adc_voltage_monitor_threshold_value_set
void adc_voltage_monitor_threshold_value_set(adc_type *adc_x, uint16_t adc_high_threshold, uint16_t adc_low_threshold)
set voltage monitoring's high and low thresholds value of the specified adc peripheral.
Definition at32f413_adc.c:290
adc_preempt_part_mode_enable
void adc_preempt_part_mode_enable(adc_type *adc_x, confirm_state new_state)
enable or disable the partitioned mode on preempt channel of the specified adc peripheral.
Definition at32f413_adc.c:603
adc_ordinary_conversion_trigger_set
void adc_ordinary_conversion_trigger_set(adc_type *adc_x, adc_ordinary_trig_select_type adc_ordinary_trig, confirm_state new_state)
enable or disable the ordinary channel's external trigger and set external trigger event of the speci...
Definition at32f413_adc.c:480
adc_preempt_conversion_trigger_set
void adc_preempt_conversion_trigger_set(adc_type *adc_x, adc_preempt_trig_select_type adc_preempt_trig, confirm_state new_state)
enable or disable the preempt channel's external trigger and set external trigger event of the specif...
Definition at32f413_adc.c:511
adc_combine_ordinary_conversion_data_get
uint32_t adc_combine_ordinary_conversion_data_get(void)
return the last conversion data for ordinary channel of combine adc(adc1 and adc2).
Definition at32f413_adc.c:716
adc_flag_get
flag_status adc_flag_get(adc_type *adc_x, uint8_t adc_flag)
get flag of the specified adc peripheral.
Definition at32f413_adc.c:771
adc_calibration_init
void adc_calibration_init(adc_type *adc_x)
initialize calibration register of the specified adc peripheral.
Definition at32f413_adc.c:198
adc_preempt_channel_set
void adc_preempt_channel_set(adc_type *adc_x, adc_channel_select_type adc_channel, uint8_t adc_sequence, adc_sampletime_select_type adc_sampletime)
configure preempt channel's corresponding rank in the sequencer and sample time of the specified adc ...
Definition at32f413_adc.c:425
adc_calibration_init_status_get
flag_status adc_calibration_init_status_get(adc_type *adc_x)
get calibration register's initialize status of the specified adc peripheral.
Definition at32f413_adc.c:210
adc_ordinary_part_mode_enable
void adc_ordinary_part_mode_enable(adc_type *adc_x, confirm_state new_state)
enable or disable the partitioned mode on ordinary channel of the specified adc peripheral.
Definition at32f413_adc.c:589
adc_dma_mode_enable
void adc_dma_mode_enable(adc_type *adc_x, confirm_state new_state)
enable or disable the adc dma transfer.
Definition at32f413_adc.c:160
adc_combine_mode_select
void adc_combine_mode_select(adc_combine_mode_type combine_mode)
select combine mode of the specified adc peripheral.
Definition at32f413_adc.c:96
adc_preempt_channel_length_set
void adc_preempt_channel_length_set(adc_type *adc_x, uint8_t adc_channel_lenght)
set preempt channel lenghth of the specified adc peripheral.
Definition at32f413_adc.c:393
adc_reset
void adc_reset(adc_type *adc_x)
deinitialize the adc peripheral registers to their default reset values.
Definition at32f413_adc.c:50
adc_preempt_software_trigger_enable
void adc_preempt_software_trigger_enable(adc_type *adc_x, confirm_state new_state)
enable or disable preempt software start conversion of the specified adc peripheral.
Definition at32f413_adc.c:676
adc_ordinary_channel_set
void adc_ordinary_channel_set(adc_type *adc_x, adc_channel_select_type adc_channel, uint8_t adc_sequence, adc_sampletime_select_type adc_sampletime)
set ordinary channel's corresponding rank in the sequencer and sample time of the specified adc perip...
Definition at32f413_adc.c:342
ADC1
#define ADC1
Definition at32f413_adc.h:558
ADC2
#define ADC2
Definition at32f413_adc.h:559
crm_periph_reset
void crm_periph_reset(crm_periph_reset_type value, confirm_state new_state)
enable or disable the peripheral reset
Definition at32f413_crm.c:293
CRM_ADC2_PERIPH_RESET
@ CRM_ADC2_PERIPH_RESET
Definition at32f413_crm.h:159
CRM_ADC1_PERIPH_RESET
@ CRM_ADC1_PERIPH_RESET
Definition at32f413_crm.h:158
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
flag_status
flag_status
flag status
Definition at32f413.h:292
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
SET
@ SET
Definition at32f413.h:292
at32f413_conf.h
at32f413 config header file
adc_base_config_type
adc base config type
Definition at32f413_adc.h:211
adc_base_config_type::data_align
adc_data_align_type data_align
Definition at32f413_adc.h:214
adc_base_config_type::repeat_mode
confirm_state repeat_mode
Definition at32f413_adc.h:213
adc_base_config_type::sequence_mode
confirm_state sequence_mode
Definition at32f413_adc.h:212
adc_base_config_type::ordinary_channel_length
uint8_t ordinary_channel_length
Definition at32f413_adc.h:215
adc_type
type define adc register all
Definition at32f413_adc.h:222
adc_type::pcce
__IO uint32_t pcce
Definition at32f413_adc.h:234
adc_type::dtalign
__IO uint32_t dtalign
Definition at32f413_adc.h:282
adc_type::osq2
__IO uint32_t osq2
Definition at32f413_adc.h:439
adc_type::ocdmaen
__IO uint32_t ocdmaen
Definition at32f413_adc.h:280
adc_type::ocswtrg
__IO uint32_t ocswtrg
Definition at32f413_adc.h:289
adc_type::rpen
__IO uint32_t rpen
Definition at32f413_adc.h:276
adc_type::sqen
__IO uint32_t sqen
Definition at32f413_adc.h:253
adc_type::sts_bit
struct adc_type::@18::@58 sts_bit
adc_type::pctesel_h
__IO uint32_t pctesel_h
Definition at32f413_adc.h:291
adc_type::pdt4
__IO uint32_t pdt4
Definition at32f413_adc.h:531
adc_type::pclen
__IO uint32_t pclen
Definition at32f413_adc.h:482
adc_type::vmcsel
__IO uint32_t vmcsel
Definition at32f413_adc.h:249
adc_type::odt
__IO uint32_t odt
Definition at32f413_adc.h:544
adc_type::pcvmen
__IO uint32_t pcvmen
Definition at32f413_adc.h:261
adc_type::pcdto1_bit
struct adc_type::@28::@63 pcdto1_bit
adc_type::pcdto4
__IO uint32_t pcdto4
Definition at32f413_adc.h:383
adc_type::pdt1
__IO uint32_t pdt1
Definition at32f413_adc.h:492
adc_type::pcdto2
__IO uint32_t pcdto2
Definition at32f413_adc.h:357
adc_type::pcpen
__IO uint32_t pcpen
Definition at32f413_adc.h:257
adc_type::vmsgen
__IO uint32_t vmsgen
Definition at32f413_adc.h:254
adc_type::pcceien
__IO uint32_t pcceien
Definition at32f413_adc.h:252
adc_type::octen
__IO uint32_t octen
Definition at32f413_adc.h:287
adc_type::pdt2_bit
struct adc_type::@50::@74 pdt2_bit
adc_type::pcdto4_bit
struct adc_type::@34::@66 pcdto4_bit
adc_type::vmorien
__IO uint32_t vmorien
Definition at32f413_adc.h:251
adc_type::ocvmen
__IO uint32_t ocvmen
Definition at32f413_adc.h:262
adc_type::oclen
__IO uint32_t oclen
Definition at32f413_adc.h:429
adc_type::pcdto1
__IO uint32_t pcdto1
Definition at32f413_adc.h:344
adc_type::spt1
__IO uint32_t spt1
Definition at32f413_adc.h:302
adc_type::psn4
__IO uint32_t psn4
Definition at32f413_adc.h:481
adc_type::psq_bit
struct adc_type::@46::@72 psq_bit
adc_type::adcal
__IO uint32_t adcal
Definition at32f413_adc.h:277
adc_type::octesel_l
__IO uint32_t octesel_l
Definition at32f413_adc.h:286
adc_type::cceien
__IO uint32_t cceien
Definition at32f413_adc.h:250
adc_type::pctesel_l
__IO uint32_t pctesel_l
Definition at32f413_adc.h:283
adc_type::odt_bit
struct adc_type::@56::@77 odt_bit
adc_type::ctrl1_bit
struct adc_type::@20::@59 ctrl1_bit
adc_type::osq1_bit
struct adc_type::@40::@69 osq1_bit
adc_type::octesel_h
__IO uint32_t octesel_h
Definition at32f413_adc.h:292
adc_type::psn3
__IO uint32_t psn3
Definition at32f413_adc.h:480
adc_type::spt2
__IO uint32_t spt2
Definition at32f413_adc.h:322
adc_type::adcen
__IO uint32_t adcen
Definition at32f413_adc.h:275
adc_type::vmhb
__IO uint32_t vmhb
Definition at32f413_adc.h:396
adc_type::ocpen
__IO uint32_t ocpen
Definition at32f413_adc.h:256
adc_type::pdt1_bit
struct adc_type::@48::@73 pdt1_bit
adc_type::adcalinit
__IO uint32_t adcalinit
Definition at32f413_adc.h:278
adc_type::pdt3
__IO uint32_t pdt3
Definition at32f413_adc.h:518
adc_type::ctrl2_bit
struct adc_type::@22::@60 ctrl2_bit
adc_type::psn1
__IO uint32_t psn1
Definition at32f413_adc.h:478
adc_type::pdt3_bit
struct adc_type::@52::@75 pdt3_bit
adc_type::ctrl1
__IO uint32_t ctrl1
Definition at32f413_adc.h:246
adc_type::sts
__IO uint32_t sts
Definition at32f413_adc.h:229
adc_type::pcdto2_bit
struct adc_type::@30::@64 pcdto2_bit
adc_type::cce
__IO uint32_t cce
Definition at32f413_adc.h:233
adc_type::osq1
__IO uint32_t osq1
Definition at32f413_adc.h:422
adc_type::psn2
__IO uint32_t psn2
Definition at32f413_adc.h:479
adc_type::vmor
__IO uint32_t vmor
Definition at32f413_adc.h:232
adc_type::vmlb
__IO uint32_t vmlb
Definition at32f413_adc.h:409
adc_type::pcdto3_bit
struct adc_type::@32::@65 pcdto3_bit
adc_type::pdt2
__IO uint32_t pdt2
Definition at32f413_adc.h:505
adc_type::ocpcnt
__IO uint32_t ocpcnt
Definition at32f413_adc.h:258
adc_type::pdt4_bit
struct adc_type::@54::@76 pdt4_bit
adc_type::vmhb_bit
struct adc_type::@36::@67 vmhb_bit
adc_type::osq3
__IO uint32_t osq3
Definition at32f413_adc.h:457
adc_type::vmlb_bit
struct adc_type::@38::@68 vmlb_bit
adc_type::pcautoen
__IO uint32_t pcautoen
Definition at32f413_adc.h:255
adc_type::pcdto3
__IO uint32_t pcdto3
Definition at32f413_adc.h:370
adc_type::pcten
__IO uint32_t pcten
Definition at32f413_adc.h:284
adc_type::pcswtrg
__IO uint32_t pcswtrg
Definition at32f413_adc.h:288


AT32F413 Firmwary Library: at32f413_adc.h Source File

  • libraries
  • drivers
  • inc
at32f413_adc.h
Go to the documentation of this file.
1
26/* Define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_ADC_H
28#define __AT32F413_ADC_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34
35/* Includes ------------------------------------------------------------------*/
36#include "at32f413.h"
37
51#define ADC_CCE_INT ((uint32_t)0x00000020)
52#define ADC_VMOR_INT ((uint32_t)0x00000040)
53#define ADC_PCCE_INT ((uint32_t)0x00000080)
64#define ADC_VMOR_FLAG ((uint8_t)0x01)
65#define ADC_CCE_FLAG ((uint8_t)0x02)
66#define ADC_PCCE_FLAG ((uint8_t)0x04)
67#define ADC_PCCS_FLAG ((uint8_t)0x08)
68#define ADC_OCCS_FLAG ((uint8_t)0x10)
81typedef enum
82{
83 ADC_INDEPENDENT_MODE = 0x00,
84 ADC_ORDINARY_SMLT_PREEMPT_SMLT_MODE = 0x01,
85 ADC_ORDINARY_SMLT_PREEMPT_INTERLTRIG_MODE = 0x02,
86 ADC_ORDINARY_SHORTSHIFT_PREEMPT_SMLT_MODE = 0x03,
87 ADC_ORDINARY_LONGSHIFT_PREEMPT_SMLT_MODE = 0x04,
88 ADC_PREEMPT_SMLT_ONLY_MODE = 0x05,
89 ADC_ORDINARY_SMLT_ONLY_MODE = 0x06,
90 ADC_ORDINARY_SHORTSHIFT_ONLY_MODE = 0x07,
91 ADC_ORDINARY_LONGSHIFT_ONLY_MODE = 0x08,
92 ADC_PREEMPT_INTERLTRIG_ONLY_MODE = 0x09
93} adc_combine_mode_type;
94
98typedef enum
99{
100 ADC_RIGHT_ALIGNMENT = 0x00,
101 ADC_LEFT_ALIGNMENT = 0x01
102} adc_data_align_type;
103
107typedef enum
108{
109 ADC_CHANNEL_0 = 0x00,
110 ADC_CHANNEL_1 = 0x01,
111 ADC_CHANNEL_2 = 0x02,
112 ADC_CHANNEL_3 = 0x03,
113 ADC_CHANNEL_4 = 0x04,
114 ADC_CHANNEL_5 = 0x05,
115 ADC_CHANNEL_6 = 0x06,
116 ADC_CHANNEL_7 = 0x07,
117 ADC_CHANNEL_8 = 0x08,
118 ADC_CHANNEL_9 = 0x09,
119 ADC_CHANNEL_10 = 0x0A,
120 ADC_CHANNEL_11 = 0x0B,
121 ADC_CHANNEL_12 = 0x0C,
122 ADC_CHANNEL_13 = 0x0D,
123 ADC_CHANNEL_14 = 0x0E,
124 ADC_CHANNEL_15 = 0x0F,
125 ADC_CHANNEL_16 = 0x10,
126 ADC_CHANNEL_17 = 0x11
127} adc_channel_select_type;
128
132typedef enum
133{
134 ADC_SAMPLETIME_1_5 = 0x00,
135 ADC_SAMPLETIME_7_5 = 0x01,
136 ADC_SAMPLETIME_13_5 = 0x02,
137 ADC_SAMPLETIME_28_5 = 0x03,
138 ADC_SAMPLETIME_41_5 = 0x04,
139 ADC_SAMPLETIME_55_5 = 0x05,
140 ADC_SAMPLETIME_71_5 = 0x06,
141 ADC_SAMPLETIME_239_5 = 0x07
142} adc_sampletime_select_type;
143
147typedef enum
148{
149 /*adc1 and adc2 ordinary trigger event*/
150 ADC12_ORDINARY_TRIG_TMR1CH1 = 0x00,
151 ADC12_ORDINARY_TRIG_TMR1CH2 = 0x01,
152 ADC12_ORDINARY_TRIG_TMR1CH3 = 0x02,
153 ADC12_ORDINARY_TRIG_TMR2CH2 = 0x03,
154 ADC12_ORDINARY_TRIG_TMR3TRGOUT = 0x04,
155 ADC12_ORDINARY_TRIG_TMR4CH4 = 0x05,
156 ADC12_ORDINARY_TRIG_EXINT11_TMR8TRGOUT = 0x06,
157 ADC12_ORDINARY_TRIG_SOFTWARE = 0x07,
158 ADC12_ORDINARY_TRIG_TMR1TRGOUT = 0x0D,
159 ADC12_ORDINARY_TRIG_TMR8CH1 = 0x0E,
160 ADC12_ORDINARY_TRIG_TMR8CH2 = 0x0F,
161} adc_ordinary_trig_select_type;
162
166typedef enum
167{
168 /*adc1 and adc2 preempt trigger event*/
169 ADC12_PREEMPT_TRIG_TMR1TRGOUT = 0x00,
170 ADC12_PREEMPT_TRIG_TMR1CH4 = 0x01,
171 ADC12_PREEMPT_TRIG_TMR2TRGOUT = 0x02,
172 ADC12_PREEMPT_TRIG_TMR2CH1 = 0x03,
173 ADC12_PREEMPT_TRIG_TMR3CH4 = 0x04,
174 ADC12_PREEMPT_TRIG_TMR4TRGOUT = 0x05,
175 ADC12_PREEMPT_TRIG_EXINT15_TMR8CH4 = 0x06,
176 ADC12_PREEMPT_TRIG_SOFTWARE = 0x07,
177 ADC12_PREEMPT_TRIG_TMR1CH1 = 0x0D,
178 ADC12_PREEMPT_TRIG_TMR8CH1 = 0x0E,
179 ADC12_PREEMPT_TRIG_TMR8TRGOUT = 0x0F,
180} adc_preempt_trig_select_type;
181
185typedef enum
186{
187 ADC_PREEMPT_CHANNEL_1 = 0x00,
188 ADC_PREEMPT_CHANNEL_2 = 0x01,
189 ADC_PREEMPT_CHANNEL_3 = 0x02,
190 ADC_PREEMPT_CHANNEL_4 = 0x03
191} adc_preempt_channel_type;
192
196typedef enum
197{
198 ADC_VMONITOR_SINGLE_ORDINARY = 0x00800200,
199 ADC_VMONITOR_SINGLE_PREEMPT = 0x00400200,
200 ADC_VMONITOR_SINGLE_ORDINARY_PREEMPT = 0x00C00200,
201 ADC_VMONITOR_ALL_ORDINARY = 0x00800000,
202 ADC_VMONITOR_ALL_PREEMPT = 0x00400000,
203 ADC_VMONITOR_ALL_ORDINARY_PREEMPT = 0x00C00000,
204 ADC_VMONITOR_NONE = 0x00000000
205} adc_voltage_monitoring_type;
206
210typedef struct
211{
212 confirm_state sequence_mode;
213 confirm_state repeat_mode;
214 adc_data_align_type data_align;
215 uint8_t ordinary_channel_length;
216} adc_base_config_type;
217
221typedef struct
222{
223
227 union
228 {
229 __IO uint32_t sts;
230 struct
231 {
232 __IO uint32_t vmor : 1; /* [0] */
233 __IO uint32_t cce : 1; /* [1] */
234 __IO uint32_t pcce : 1; /* [2] */
235 __IO uint32_t pccs : 1; /* [3] */
236 __IO uint32_t occs : 1; /* [4] */
237 __IO uint32_t reserved1 : 27;/* [31:5] */
238 } sts_bit;
239 };
240
244 union
245 {
246 __IO uint32_t ctrl1;
247 struct
248 {
249 __IO uint32_t vmcsel : 5; /* [4:0] */
250 __IO uint32_t cceien : 1; /* [5] */
251 __IO uint32_t vmorien : 1; /* [6] */
252 __IO uint32_t pcceien : 1; /* [7] */
253 __IO uint32_t sqen : 1; /* [8] */
254 __IO uint32_t vmsgen : 1; /* [9] */
255 __IO uint32_t pcautoen : 1; /* [10] */
256 __IO uint32_t ocpen : 1; /* [11] */
257 __IO uint32_t pcpen : 1; /* [12] */
258 __IO uint32_t ocpcnt : 3; /* [15:13] */
259 __IO uint32_t mssel : 4; /* [19:16] */
260 __IO uint32_t reserved1 : 2; /* [21:20] */
261 __IO uint32_t pcvmen : 1; /* [22] */
262 __IO uint32_t ocvmen : 1; /* [23] */
263 __IO uint32_t reserved2 : 8; /* [31:24] */
264 } ctrl1_bit;
265 };
266
270 union
271 {
272 __IO uint32_t ctrl2;
273 struct
274 {
275 __IO uint32_t adcen : 1; /* [0] */
276 __IO uint32_t rpen : 1; /* [1] */
277 __IO uint32_t adcal : 1; /* [2] */
278 __IO uint32_t adcalinit : 1; /* [3] */
279 __IO uint32_t reserved1 : 4; /* [7:4] */
280 __IO uint32_t ocdmaen : 1; /* [8] */
281 __IO uint32_t reserved2 : 2; /* [10:9] */
282 __IO uint32_t dtalign : 1; /* [11] */
283 __IO uint32_t pctesel_l : 3; /* [14:12] */
284 __IO uint32_t pcten : 1; /* [15] */
285 __IO uint32_t reserved3 : 1; /* [16] */
286 __IO uint32_t octesel_l : 3; /* [19:17] */
287 __IO uint32_t octen : 1; /* [20] */
288 __IO uint32_t pcswtrg : 1; /* [21] */
289 __IO uint32_t ocswtrg : 1; /* [22] */
290 __IO uint32_t itsrven : 1; /* [23] */
291 __IO uint32_t pctesel_h : 1; /* [24] */
292 __IO uint32_t octesel_h : 1; /* [25] */
293 __IO uint32_t reserved4 : 6; /* [31:26] */
294 } ctrl2_bit;
295 };
296
300 union
301 {
302 __IO uint32_t spt1;
303 struct
304 {
305 __IO uint32_t cspt10 : 3; /* [2:0] */
306 __IO uint32_t cspt11 : 3; /* [5:3] */
307 __IO uint32_t cspt12 : 3; /* [8:6] */
308 __IO uint32_t cspt13 : 3; /* [11:9] */
309 __IO uint32_t cspt14 : 3; /* [14:12] */
310 __IO uint32_t cspt15 : 3; /* [17:15] */
311 __IO uint32_t cspt16 : 3; /* [20:18] */
312 __IO uint32_t cspt17 : 3; /* [23:21] */
313 __IO uint32_t reserved1 : 8;/* [31:24] */
314 } spt1_bit;
315 };
316
320 union
321 {
322 __IO uint32_t spt2;
323 struct
324 {
325 __IO uint32_t cspt0 : 3;/* [2:0] */
326 __IO uint32_t cspt1 : 3;/* [5:3] */
327 __IO uint32_t cspt2 : 3;/* [8:6] */
328 __IO uint32_t cspt3 : 3;/* [11:9] */
329 __IO uint32_t cspt4 : 3;/* [14:12] */
330 __IO uint32_t cspt5 : 3;/* [17:15] */
331 __IO uint32_t cspt6 : 3;/* [20:18] */
332 __IO uint32_t cspt7 : 3;/* [23:21] */
333 __IO uint32_t cspt8 : 3;/* [26:24] */
334 __IO uint32_t cspt9 : 3;/* [29:27] */
335 __IO uint32_t reserved1 : 2;/* [31:30] */
336 } spt2_bit;
337 };
338
342 union
343 {
344 __IO uint32_t pcdto1;
345 struct
346 {
347 __IO uint32_t pcdto1 : 12; /* [11:0] */
348 __IO uint32_t reserved1 : 20; /* [31:12] */
349 } pcdto1_bit;
350 };
351
355 union
356 {
357 __IO uint32_t pcdto2;
358 struct
359 {
360 __IO uint32_t pcdto2 : 12; /* [11:0] */
361 __IO uint32_t reserved1 : 20; /* [31:12] */
362 } pcdto2_bit;
363 };
364
368 union
369 {
370 __IO uint32_t pcdto3;
371 struct
372 {
373 __IO uint32_t pcdto3 : 12; /* [11:0] */
374 __IO uint32_t reserved1 : 20; /* [31:12] */
375 } pcdto3_bit;
376 };
377
381 union
382 {
383 __IO uint32_t pcdto4;
384 struct
385 {
386 __IO uint32_t pcdto4 : 12; /* [11:0] */
387 __IO uint32_t reserved1 : 20; /* [31:12] */
388 } pcdto4_bit;
389 };
390
394 union
395 {
396 __IO uint32_t vmhb;
397 struct
398 {
399 __IO uint32_t vmhb : 12; /* [11:0] */
400 __IO uint32_t reserved1 : 20; /* [31:12] */
401 } vmhb_bit;
402 };
403
407 union
408 {
409 __IO uint32_t vmlb;
410 struct
411 {
412 __IO uint32_t vmlb : 12; /* [11:0] */
413 __IO uint32_t reserved1 : 20; /* [31:12] */
414 } vmlb_bit;
415 };
416
420 union
421 {
422 __IO uint32_t osq1;
423 struct
424 {
425 __IO uint32_t osn13 : 5; /* [4:0] */
426 __IO uint32_t osn14 : 5; /* [9:5] */
427 __IO uint32_t osn15 : 5; /* [14:10] */
428 __IO uint32_t osn16 : 5; /* [19:15] */
429 __IO uint32_t oclen : 4; /* [23:20] */
430 __IO uint32_t reserved1 : 8; /* [31:24] */
431 } osq1_bit;
432 };
433
437 union
438 {
439 __IO uint32_t osq2;
440 struct
441 {
442 __IO uint32_t osn7 : 5; /* [4:0] */
443 __IO uint32_t osn8 : 5; /* [9:5] */
444 __IO uint32_t osn9 : 5; /* [14:10] */
445 __IO uint32_t osn10 : 5; /* [19:15] */
446 __IO uint32_t osn11 : 5; /* [24:20] */
447 __IO uint32_t osn12 : 5; /* [29:25] */
448 __IO uint32_t reserved1 : 2; /* [31:30] */
449 } osq2_bit;
450 };
451
455 union
456 {
457 __IO uint32_t osq3;
458 struct
459 {
460 __IO uint32_t osn1 : 5; /* [4:0] */
461 __IO uint32_t osn2 : 5; /* [9:5] */
462 __IO uint32_t osn3 : 5; /* [14:10] */
463 __IO uint32_t osn4 : 5; /* [19:15] */
464 __IO uint32_t osn5 : 5; /* [24:20] */
465 __IO uint32_t osn6 : 5; /* [29:25] */
466 __IO uint32_t reserved1 : 2; /* [31:30] */
467 } osq3_bit;
468 };
469
473 union
474 {
475 __IO uint32_t psq;
476 struct
477 {
478 __IO uint32_t psn1 : 5; /* [4:0] */
479 __IO uint32_t psn2 : 5; /* [9:5] */
480 __IO uint32_t psn3 : 5; /* [14:10] */
481 __IO uint32_t psn4 : 5; /* [19:15] */
482 __IO uint32_t pclen : 2; /* [21:20] */
483 __IO uint32_t reserved1 : 10;/* [31:22] */
484 } psq_bit;
485 };
486
490 union
491 {
492 __IO uint32_t pdt1;
493 struct
494 {
495 __IO uint32_t pdt1 : 16; /* [15:0] */
496 __IO uint32_t reserved1 : 16; /* [31:16] */
497 } pdt1_bit;
498 };
499
503 union
504 {
505 __IO uint32_t pdt2;
506 struct
507 {
508 __IO uint32_t pdt2 : 16; /* [15:0] */
509 __IO uint32_t reserved1 : 16; /* [31:16] */
510 } pdt2_bit;
511 };
512
516 union
517 {
518 __IO uint32_t pdt3;
519 struct
520 {
521 __IO uint32_t pdt3 : 16; /* [15:0] */
522 __IO uint32_t reserved1 : 16; /* [31:16] */
523 } pdt3_bit;
524 };
525
529 union
530 {
531 __IO uint32_t pdt4;
532 struct
533 {
534 __IO uint32_t pdt4 : 16; /* [15:0] */
535 __IO uint32_t reserved1 : 16; /* [31:16] */
536 } pdt4_bit;
537 };
538
542 union
543 {
544 __IO uint32_t odt;
545 struct
546 {
547 __IO uint32_t odt : 16; /* [15:0] */
548 __IO uint32_t adc2odt : 16; /* [31:16] */
549 } odt_bit;
550 };
551
552} adc_type;
553
558#define ADC1 ((adc_type *) ADC1_BASE)
559#define ADC2 ((adc_type *) ADC2_BASE)
560
565void adc_reset(adc_type *adc_x);
566void adc_enable(adc_type *adc_x, confirm_state new_state);
567void adc_combine_mode_select(adc_combine_mode_type combine_mode);
568void adc_base_default_para_init(adc_base_config_type *adc_base_struct);
569void adc_base_config(adc_type *adc_x, adc_base_config_type *adc_base_struct);
570void adc_dma_mode_enable(adc_type *adc_x, confirm_state new_state);
571void adc_interrupt_enable(adc_type *adc_x, uint32_t adc_int, confirm_state new_state);
572void adc_calibration_init(adc_type *adc_x);
573 flag_status adc_calibration_init_status_get(adc_type *adc_x);
574void adc_calibration_start(adc_type *adc_x);
575 flag_status adc_calibration_status_get(adc_type *adc_x);
576void adc_voltage_monitor_enable(adc_type *adc_x, adc_voltage_monitoring_type adc_voltage_monitoring);
577void adc_voltage_monitor_threshold_value_set(adc_type *adc_x, uint16_t adc_high_threshold, uint16_t adc_low_threshold);
578void adc_voltage_monitor_single_channel_select(adc_type *adc_x, adc_channel_select_type adc_channel);
579void adc_ordinary_channel_set(adc_type *adc_x, adc_channel_select_type adc_channel, uint8_t adc_sequence, adc_sampletime_select_type adc_sampletime);
580void adc_preempt_channel_length_set(adc_type *adc_x, uint8_t adc_channel_lenght);
581void adc_preempt_channel_set(adc_type *adc_x, adc_channel_select_type adc_channel, uint8_t adc_sequence, adc_sampletime_select_type adc_sampletime);
582void adc_ordinary_conversion_trigger_set(adc_type *adc_x, adc_ordinary_trig_select_type adc_ordinary_trig, confirm_state new_state);
583void adc_preempt_conversion_trigger_set(adc_type *adc_x, adc_preempt_trig_select_type adc_preempt_trig, confirm_state new_state);
584void adc_preempt_offset_value_set(adc_type *adc_x, adc_preempt_channel_type adc_preempt_channel, uint16_t adc_offset_value);
585void adc_ordinary_part_count_set(adc_type *adc_x, uint8_t adc_channel_count);
586void adc_ordinary_part_mode_enable(adc_type *adc_x, confirm_state new_state);
587void adc_preempt_part_mode_enable(adc_type *adc_x, confirm_state new_state);
588void adc_preempt_auto_mode_enable(adc_type *adc_x, confirm_state new_state);
589void adc_tempersensor_vintrv_enable(confirm_state new_state);
590void adc_ordinary_software_trigger_enable(adc_type *adc_x, confirm_state new_state);
591 flag_status adc_ordinary_software_trigger_status_get(adc_type *adc_x);
592void adc_preempt_software_trigger_enable(adc_type *adc_x, confirm_state new_state);
593 flag_status adc_preempt_software_trigger_status_get(adc_type *adc_x);
594uint16_t adc_ordinary_conversion_data_get(adc_type *adc_x);
595uint32_t adc_combine_ordinary_conversion_data_get(void);
596uint16_t adc_preempt_conversion_data_get(adc_type *adc_x, adc_preempt_channel_type adc_preempt_channel);
597 flag_status adc_flag_get(adc_type *adc_x, uint8_t adc_flag);
598 flag_status adc_interrupt_flag_get(adc_type *adc_x, uint8_t adc_flag);
599void adc_flag_clear(adc_type *adc_x, uint32_t adc_flag);
600
613#ifdef __cplusplus
614}
615#endif
616
617#endif
at32f413.h
at32f413 header file
adc_ordinary_software_trigger_enable
void adc_ordinary_software_trigger_enable(adc_type *adc_x, confirm_state new_state)
enable or disable ordinary software start conversion of the specified adc peripheral.
Definition at32f413_adc.c:643
adc_voltage_monitor_enable
void adc_voltage_monitor_enable(adc_type *adc_x, adc_voltage_monitoring_type adc_voltage_monitoring)
enable or disable the voltage monitoring on single/all ordinary or preempt channels of the specified ...
Definition at32f413_adc.c:269
adc_voltage_monitor_single_channel_select
void adc_voltage_monitor_single_channel_select(adc_type *adc_x, adc_channel_select_type adc_channel)
select the voltage monitoring's channel of the specified adc peripheral.
Definition at32f413_adc.c:310
adc_ordinary_conversion_data_get
uint16_t adc_ordinary_conversion_data_get(adc_type *adc_x)
return the last conversion data for ordinary channel of the specified adc peripheral.
Definition at32f413_adc.c:707
adc_preempt_offset_value_set
void adc_preempt_offset_value_set(adc_type *adc_x, adc_preempt_channel_type adc_preempt_channel, uint16_t adc_offset_value)
set preempt channel's conversion value offset of the specified adc peripheral.
Definition at32f413_adc.c:543
adc_base_config
void adc_base_config(adc_type *adc_x, adc_base_config_type *adc_base_struct)
initialize the adc peripheral according to the specified parameters.
Definition at32f413_adc.c:142
adc_ordinary_software_trigger_status_get
flag_status adc_ordinary_software_trigger_status_get(adc_type *adc_x)
get ordinary software start conversion status of the specified adc peripheral.
Definition at32f413_adc.c:655
adc_preempt_auto_mode_enable
void adc_preempt_auto_mode_enable(adc_type *adc_x, confirm_state new_state)
enable or disable automatic preempt group conversion of the specified adc peripheral.
Definition at32f413_adc.c:617
adc_tempersensor_vintrv_enable
void adc_tempersensor_vintrv_enable(confirm_state new_state)
enable or disable the temperature sensor and vintrv channel.
Definition at32f413_adc.c:629
adc_preempt_software_trigger_status_get
flag_status adc_preempt_software_trigger_status_get(adc_type *adc_x)
get preempt software start conversion status of the specified adc peripheral.
Definition at32f413_adc.c:688
adc_enable
void adc_enable(adc_type *adc_x, confirm_state new_state)
enable or disable the specified adc peripheral.
Definition at32f413_adc.c:74
adc_ordinary_part_count_set
void adc_ordinary_part_count_set(adc_type *adc_x, uint8_t adc_channel_count)
set partitioned mode channel count of the specified adc peripheral.
Definition at32f413_adc.c:574
adc_preempt_conversion_data_get
uint16_t adc_preempt_conversion_data_get(adc_type *adc_x, adc_preempt_channel_type adc_preempt_channel)
return the conversion data for selection preempt channel of the specified adc peripheral.
Definition at32f413_adc.c:734
adc_flag_clear
void adc_flag_clear(adc_type *adc_x, uint32_t adc_flag)
clear flag of the specified adc peripheral.
Definition at32f413_adc.c:841
adc_interrupt_enable
void adc_interrupt_enable(adc_type *adc_x, uint32_t adc_int, confirm_state new_state)
enable or disable the specified adc interrupts.
Definition at32f413_adc.c:179
adc_base_default_para_init
void adc_base_default_para_init(adc_base_config_type *adc_base_struct)
adc base default para init.
Definition at32f413_adc.c:116
adc_calibration_start
void adc_calibration_start(adc_type *adc_x)
start calibration process of the specified adc peripheral.
Definition at32f413_adc.c:229
adc_calibration_status_get
flag_status adc_calibration_status_get(adc_type *adc_x)
get calibration status of the specified adc peripheral.
Definition at32f413_adc.c:241
adc_interrupt_flag_get
flag_status adc_interrupt_flag_get(adc_type *adc_x, uint8_t adc_flag)
get interrupt flag of the specified adc peripheral.
Definition at32f413_adc.c:798
adc_voltage_monitor_threshold_value_set
void adc_voltage_monitor_threshold_value_set(adc_type *adc_x, uint16_t adc_high_threshold, uint16_t adc_low_threshold)
set voltage monitoring's high and low thresholds value of the specified adc peripheral.
Definition at32f413_adc.c:290
adc_preempt_part_mode_enable
void adc_preempt_part_mode_enable(adc_type *adc_x, confirm_state new_state)
enable or disable the partitioned mode on preempt channel of the specified adc peripheral.
Definition at32f413_adc.c:603
adc_ordinary_conversion_trigger_set
void adc_ordinary_conversion_trigger_set(adc_type *adc_x, adc_ordinary_trig_select_type adc_ordinary_trig, confirm_state new_state)
enable or disable the ordinary channel's external trigger and set external trigger event of the speci...
Definition at32f413_adc.c:480
adc_preempt_conversion_trigger_set
void adc_preempt_conversion_trigger_set(adc_type *adc_x, adc_preempt_trig_select_type adc_preempt_trig, confirm_state new_state)
enable or disable the preempt channel's external trigger and set external trigger event of the specif...
Definition at32f413_adc.c:511
adc_combine_ordinary_conversion_data_get
uint32_t adc_combine_ordinary_conversion_data_get(void)
return the last conversion data for ordinary channel of combine adc(adc1 and adc2).
Definition at32f413_adc.c:716
adc_flag_get
flag_status adc_flag_get(adc_type *adc_x, uint8_t adc_flag)
get flag of the specified adc peripheral.
Definition at32f413_adc.c:771
adc_calibration_init
void adc_calibration_init(adc_type *adc_x)
initialize calibration register of the specified adc peripheral.
Definition at32f413_adc.c:198
adc_preempt_channel_set
void adc_preempt_channel_set(adc_type *adc_x, adc_channel_select_type adc_channel, uint8_t adc_sequence, adc_sampletime_select_type adc_sampletime)
configure preempt channel's corresponding rank in the sequencer and sample time of the specified adc ...
Definition at32f413_adc.c:425
adc_calibration_init_status_get
flag_status adc_calibration_init_status_get(adc_type *adc_x)
get calibration register's initialize status of the specified adc peripheral.
Definition at32f413_adc.c:210
adc_ordinary_part_mode_enable
void adc_ordinary_part_mode_enable(adc_type *adc_x, confirm_state new_state)
enable or disable the partitioned mode on ordinary channel of the specified adc peripheral.
Definition at32f413_adc.c:589
adc_dma_mode_enable
void adc_dma_mode_enable(adc_type *adc_x, confirm_state new_state)
enable or disable the adc dma transfer.
Definition at32f413_adc.c:160
adc_combine_mode_select
void adc_combine_mode_select(adc_combine_mode_type combine_mode)
select combine mode of the specified adc peripheral.
Definition at32f413_adc.c:96
adc_preempt_channel_length_set
void adc_preempt_channel_length_set(adc_type *adc_x, uint8_t adc_channel_lenght)
set preempt channel lenghth of the specified adc peripheral.
Definition at32f413_adc.c:393
adc_reset
void adc_reset(adc_type *adc_x)
deinitialize the adc peripheral registers to their default reset values.
Definition at32f413_adc.c:50
adc_preempt_software_trigger_enable
void adc_preempt_software_trigger_enable(adc_type *adc_x, confirm_state new_state)
enable or disable preempt software start conversion of the specified adc peripheral.
Definition at32f413_adc.c:676
adc_ordinary_channel_set
void adc_ordinary_channel_set(adc_type *adc_x, adc_channel_select_type adc_channel, uint8_t adc_sequence, adc_sampletime_select_type adc_sampletime)
set ordinary channel's corresponding rank in the sequencer and sample time of the specified adc perip...
Definition at32f413_adc.c:342
adc_voltage_monitoring_type
adc_voltage_monitoring_type
adc voltage_monitoring type
Definition at32f413_adc.h:197
adc_data_align_type
adc_data_align_type
adc data align type
Definition at32f413_adc.h:99
adc_channel_select_type
adc_channel_select_type
adc channel select type
Definition at32f413_adc.h:108
adc_sampletime_select_type
adc_sampletime_select_type
adc sampletime select type
Definition at32f413_adc.h:133
adc_preempt_trig_select_type
adc_preempt_trig_select_type
adc preempt group trigger event select type
Definition at32f413_adc.h:167
adc_combine_mode_type
adc_combine_mode_type
adc combine mode type(these options are reserved in adc2)
Definition at32f413_adc.h:82
adc_ordinary_trig_select_type
adc_ordinary_trig_select_type
adc ordinary group trigger event select type
Definition at32f413_adc.h:148
adc_preempt_channel_type
adc_preempt_channel_type
adc preempt channel type
Definition at32f413_adc.h:186
ADC_VMONITOR_SINGLE_ORDINARY_PREEMPT
@ ADC_VMONITOR_SINGLE_ORDINARY_PREEMPT
Definition at32f413_adc.h:200
ADC_VMONITOR_SINGLE_ORDINARY
@ ADC_VMONITOR_SINGLE_ORDINARY
Definition at32f413_adc.h:198
ADC_VMONITOR_ALL_ORDINARY
@ ADC_VMONITOR_ALL_ORDINARY
Definition at32f413_adc.h:201
ADC_VMONITOR_ALL_PREEMPT
@ ADC_VMONITOR_ALL_PREEMPT
Definition at32f413_adc.h:202
ADC_VMONITOR_ALL_ORDINARY_PREEMPT
@ ADC_VMONITOR_ALL_ORDINARY_PREEMPT
Definition at32f413_adc.h:203
ADC_VMONITOR_NONE
@ ADC_VMONITOR_NONE
Definition at32f413_adc.h:204
ADC_VMONITOR_SINGLE_PREEMPT
@ ADC_VMONITOR_SINGLE_PREEMPT
Definition at32f413_adc.h:199
ADC_RIGHT_ALIGNMENT
@ ADC_RIGHT_ALIGNMENT
Definition at32f413_adc.h:100
ADC_LEFT_ALIGNMENT
@ ADC_LEFT_ALIGNMENT
Definition at32f413_adc.h:101
ADC_CHANNEL_9
@ ADC_CHANNEL_9
Definition at32f413_adc.h:118
ADC_CHANNEL_1
@ ADC_CHANNEL_1
Definition at32f413_adc.h:110
ADC_CHANNEL_17
@ ADC_CHANNEL_17
Definition at32f413_adc.h:126
ADC_CHANNEL_8
@ ADC_CHANNEL_8
Definition at32f413_adc.h:117
ADC_CHANNEL_4
@ ADC_CHANNEL_4
Definition at32f413_adc.h:113
ADC_CHANNEL_12
@ ADC_CHANNEL_12
Definition at32f413_adc.h:121
ADC_CHANNEL_16
@ ADC_CHANNEL_16
Definition at32f413_adc.h:125
ADC_CHANNEL_0
@ ADC_CHANNEL_0
Definition at32f413_adc.h:109
ADC_CHANNEL_3
@ ADC_CHANNEL_3
Definition at32f413_adc.h:112
ADC_CHANNEL_14
@ ADC_CHANNEL_14
Definition at32f413_adc.h:123
ADC_CHANNEL_10
@ ADC_CHANNEL_10
Definition at32f413_adc.h:119
ADC_CHANNEL_13
@ ADC_CHANNEL_13
Definition at32f413_adc.h:122
ADC_CHANNEL_2
@ ADC_CHANNEL_2
Definition at32f413_adc.h:111
ADC_CHANNEL_6
@ ADC_CHANNEL_6
Definition at32f413_adc.h:115
ADC_CHANNEL_7
@ ADC_CHANNEL_7
Definition at32f413_adc.h:116
ADC_CHANNEL_5
@ ADC_CHANNEL_5
Definition at32f413_adc.h:114
ADC_CHANNEL_11
@ ADC_CHANNEL_11
Definition at32f413_adc.h:120
ADC_CHANNEL_15
@ ADC_CHANNEL_15
Definition at32f413_adc.h:124
ADC_SAMPLETIME_41_5
@ ADC_SAMPLETIME_41_5
Definition at32f413_adc.h:138
ADC_SAMPLETIME_55_5
@ ADC_SAMPLETIME_55_5
Definition at32f413_adc.h:139
ADC_SAMPLETIME_71_5
@ ADC_SAMPLETIME_71_5
Definition at32f413_adc.h:140
ADC_SAMPLETIME_239_5
@ ADC_SAMPLETIME_239_5
Definition at32f413_adc.h:141
ADC_SAMPLETIME_1_5
@ ADC_SAMPLETIME_1_5
Definition at32f413_adc.h:134
ADC_SAMPLETIME_28_5
@ ADC_SAMPLETIME_28_5
Definition at32f413_adc.h:137
ADC_SAMPLETIME_13_5
@ ADC_SAMPLETIME_13_5
Definition at32f413_adc.h:136
ADC_SAMPLETIME_7_5
@ ADC_SAMPLETIME_7_5
Definition at32f413_adc.h:135
ADC12_PREEMPT_TRIG_TMR8CH1
@ ADC12_PREEMPT_TRIG_TMR8CH1
Definition at32f413_adc.h:178
ADC12_PREEMPT_TRIG_TMR4TRGOUT
@ ADC12_PREEMPT_TRIG_TMR4TRGOUT
Definition at32f413_adc.h:174
ADC12_PREEMPT_TRIG_TMR2TRGOUT
@ ADC12_PREEMPT_TRIG_TMR2TRGOUT
Definition at32f413_adc.h:171
ADC12_PREEMPT_TRIG_TMR1CH1
@ ADC12_PREEMPT_TRIG_TMR1CH1
Definition at32f413_adc.h:177
ADC12_PREEMPT_TRIG_TMR1CH4
@ ADC12_PREEMPT_TRIG_TMR1CH4
Definition at32f413_adc.h:170
ADC12_PREEMPT_TRIG_TMR1TRGOUT
@ ADC12_PREEMPT_TRIG_TMR1TRGOUT
Definition at32f413_adc.h:169
ADC12_PREEMPT_TRIG_TMR3CH4
@ ADC12_PREEMPT_TRIG_TMR3CH4
Definition at32f413_adc.h:173
ADC12_PREEMPT_TRIG_SOFTWARE
@ ADC12_PREEMPT_TRIG_SOFTWARE
Definition at32f413_adc.h:176
ADC12_PREEMPT_TRIG_EXINT15_TMR8CH4
@ ADC12_PREEMPT_TRIG_EXINT15_TMR8CH4
Definition at32f413_adc.h:175
ADC12_PREEMPT_TRIG_TMR8TRGOUT
@ ADC12_PREEMPT_TRIG_TMR8TRGOUT
Definition at32f413_adc.h:179
ADC12_PREEMPT_TRIG_TMR2CH1
@ ADC12_PREEMPT_TRIG_TMR2CH1
Definition at32f413_adc.h:172
ADC_PREEMPT_SMLT_ONLY_MODE
@ ADC_PREEMPT_SMLT_ONLY_MODE
Definition at32f413_adc.h:88
ADC_PREEMPT_INTERLTRIG_ONLY_MODE
@ ADC_PREEMPT_INTERLTRIG_ONLY_MODE
Definition at32f413_adc.h:92
ADC_ORDINARY_LONGSHIFT_ONLY_MODE
@ ADC_ORDINARY_LONGSHIFT_ONLY_MODE
Definition at32f413_adc.h:91
ADC_ORDINARY_SHORTSHIFT_PREEMPT_SMLT_MODE
@ ADC_ORDINARY_SHORTSHIFT_PREEMPT_SMLT_MODE
Definition at32f413_adc.h:86
ADC_ORDINARY_SMLT_ONLY_MODE
@ ADC_ORDINARY_SMLT_ONLY_MODE
Definition at32f413_adc.h:89
ADC_INDEPENDENT_MODE
@ ADC_INDEPENDENT_MODE
Definition at32f413_adc.h:83
ADC_ORDINARY_SHORTSHIFT_ONLY_MODE
@ ADC_ORDINARY_SHORTSHIFT_ONLY_MODE
Definition at32f413_adc.h:90
ADC_ORDINARY_SMLT_PREEMPT_INTERLTRIG_MODE
@ ADC_ORDINARY_SMLT_PREEMPT_INTERLTRIG_MODE
Definition at32f413_adc.h:85
ADC_ORDINARY_LONGSHIFT_PREEMPT_SMLT_MODE
@ ADC_ORDINARY_LONGSHIFT_PREEMPT_SMLT_MODE
Definition at32f413_adc.h:87
ADC_ORDINARY_SMLT_PREEMPT_SMLT_MODE
@ ADC_ORDINARY_SMLT_PREEMPT_SMLT_MODE
Definition at32f413_adc.h:84
ADC12_ORDINARY_TRIG_TMR2CH2
@ ADC12_ORDINARY_TRIG_TMR2CH2
Definition at32f413_adc.h:153
ADC12_ORDINARY_TRIG_TMR1TRGOUT
@ ADC12_ORDINARY_TRIG_TMR1TRGOUT
Definition at32f413_adc.h:158
ADC12_ORDINARY_TRIG_TMR1CH2
@ ADC12_ORDINARY_TRIG_TMR1CH2
Definition at32f413_adc.h:151
ADC12_ORDINARY_TRIG_TMR1CH1
@ ADC12_ORDINARY_TRIG_TMR1CH1
Definition at32f413_adc.h:150
ADC12_ORDINARY_TRIG_TMR8CH2
@ ADC12_ORDINARY_TRIG_TMR8CH2
Definition at32f413_adc.h:160
ADC12_ORDINARY_TRIG_TMR4CH4
@ ADC12_ORDINARY_TRIG_TMR4CH4
Definition at32f413_adc.h:155
ADC12_ORDINARY_TRIG_TMR1CH3
@ ADC12_ORDINARY_TRIG_TMR1CH3
Definition at32f413_adc.h:152
ADC12_ORDINARY_TRIG_SOFTWARE
@ ADC12_ORDINARY_TRIG_SOFTWARE
Definition at32f413_adc.h:157
ADC12_ORDINARY_TRIG_EXINT11_TMR8TRGOUT
@ ADC12_ORDINARY_TRIG_EXINT11_TMR8TRGOUT
Definition at32f413_adc.h:156
ADC12_ORDINARY_TRIG_TMR3TRGOUT
@ ADC12_ORDINARY_TRIG_TMR3TRGOUT
Definition at32f413_adc.h:154
ADC12_ORDINARY_TRIG_TMR8CH1
@ ADC12_ORDINARY_TRIG_TMR8CH1
Definition at32f413_adc.h:159
ADC_PREEMPT_CHANNEL_3
@ ADC_PREEMPT_CHANNEL_3
Definition at32f413_adc.h:189
ADC_PREEMPT_CHANNEL_4
@ ADC_PREEMPT_CHANNEL_4
Definition at32f413_adc.h:190
ADC_PREEMPT_CHANNEL_2
@ ADC_PREEMPT_CHANNEL_2
Definition at32f413_adc.h:188
ADC_PREEMPT_CHANNEL_1
@ ADC_PREEMPT_CHANNEL_1
Definition at32f413_adc.h:187
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
flag_status
flag_status
flag status
Definition at32f413.h:292
adc_base_config_type
adc base config type
Definition at32f413_adc.h:211
adc_base_config_type::data_align
adc_data_align_type data_align
Definition at32f413_adc.h:214
adc_base_config_type::repeat_mode
confirm_state repeat_mode
Definition at32f413_adc.h:213
adc_base_config_type::sequence_mode
confirm_state sequence_mode
Definition at32f413_adc.h:212
adc_base_config_type::ordinary_channel_length
uint8_t ordinary_channel_length
Definition at32f413_adc.h:215
adc_type
type define adc register all
Definition at32f413_adc.h:222
adc_type::cspt1
__IO uint32_t cspt1
Definition at32f413_adc.h:326
adc_type::pcce
__IO uint32_t pcce
Definition at32f413_adc.h:234
adc_type::adc2odt
__IO uint32_t adc2odt
Definition at32f413_adc.h:548
adc_type::dtalign
__IO uint32_t dtalign
Definition at32f413_adc.h:282
adc_type::osq2
__IO uint32_t osq2
Definition at32f413_adc.h:439
adc_type::ocdmaen
__IO uint32_t ocdmaen
Definition at32f413_adc.h:280
adc_type::ocswtrg
__IO uint32_t ocswtrg
Definition at32f413_adc.h:289
adc_type::osn14
__IO uint32_t osn14
Definition at32f413_adc.h:426
adc_type::rpen
__IO uint32_t rpen
Definition at32f413_adc.h:276
adc_type::sqen
__IO uint32_t sqen
Definition at32f413_adc.h:253
adc_type::pctesel_h
__IO uint32_t pctesel_h
Definition at32f413_adc.h:291
adc_type::pdt4
__IO uint32_t pdt4
Definition at32f413_adc.h:531
adc_type::cspt15
__IO uint32_t cspt15
Definition at32f413_adc.h:310
adc_type::pclen
__IO uint32_t pclen
Definition at32f413_adc.h:482
adc_type::vmcsel
__IO uint32_t vmcsel
Definition at32f413_adc.h:249
adc_type::cspt7
__IO uint32_t cspt7
Definition at32f413_adc.h:332
adc_type::odt
__IO uint32_t odt
Definition at32f413_adc.h:544
adc_type::pcvmen
__IO uint32_t pcvmen
Definition at32f413_adc.h:261
adc_type::osn1
__IO uint32_t osn1
Definition at32f413_adc.h:460
adc_type::pcdto4
__IO uint32_t pcdto4
Definition at32f413_adc.h:383
adc_type::pdt1
__IO uint32_t pdt1
Definition at32f413_adc.h:492
adc_type::pcdto2
__IO uint32_t pcdto2
Definition at32f413_adc.h:357
adc_type::reserved3
__IO uint32_t reserved3
Definition at32f413_adc.h:285
adc_type::cspt6
__IO uint32_t cspt6
Definition at32f413_adc.h:331
adc_type::osn6
__IO uint32_t osn6
Definition at32f413_adc.h:465
adc_type::osn8
__IO uint32_t osn8
Definition at32f413_adc.h:443
adc_type::pcpen
__IO uint32_t pcpen
Definition at32f413_adc.h:257
adc_type::osn16
__IO uint32_t osn16
Definition at32f413_adc.h:428
adc_type::cspt13
__IO uint32_t cspt13
Definition at32f413_adc.h:308
adc_type::vmsgen
__IO uint32_t vmsgen
Definition at32f413_adc.h:254
adc_type::psq
__IO uint32_t psq
Definition at32f413_adc.h:475
adc_type::osn3
__IO uint32_t osn3
Definition at32f413_adc.h:462
adc_type::pcceien
__IO uint32_t pcceien
Definition at32f413_adc.h:252
adc_type::octen
__IO uint32_t octen
Definition at32f413_adc.h:287
adc_type::vmorien
__IO uint32_t vmorien
Definition at32f413_adc.h:251
adc_type::ocvmen
__IO uint32_t ocvmen
Definition at32f413_adc.h:262
adc_type::oclen
__IO uint32_t oclen
Definition at32f413_adc.h:429
adc_type::pcdto1
__IO uint32_t pcdto1
Definition at32f413_adc.h:344
adc_type::mssel
__IO uint32_t mssel
Definition at32f413_adc.h:259
adc_type::occs
__IO uint32_t occs
Definition at32f413_adc.h:236
adc_type::osn9
__IO uint32_t osn9
Definition at32f413_adc.h:444
adc_type::cspt5
__IO uint32_t cspt5
Definition at32f413_adc.h:330
adc_type::spt1
__IO uint32_t spt1
Definition at32f413_adc.h:302
adc_type::psn4
__IO uint32_t psn4
Definition at32f413_adc.h:481
adc_type::cspt12
__IO uint32_t cspt12
Definition at32f413_adc.h:307
adc_type::adcal
__IO uint32_t adcal
Definition at32f413_adc.h:277
adc_type::cspt14
__IO uint32_t cspt14
Definition at32f413_adc.h:309
adc_type::octesel_l
__IO uint32_t octesel_l
Definition at32f413_adc.h:286
adc_type::cceien
__IO uint32_t cceien
Definition at32f413_adc.h:250
adc_type::pctesel_l
__IO uint32_t pctesel_l
Definition at32f413_adc.h:283
adc_type::octesel_h
__IO uint32_t octesel_h
Definition at32f413_adc.h:292
adc_type::psn3
__IO uint32_t psn3
Definition at32f413_adc.h:480
adc_type::itsrven
__IO uint32_t itsrven
Definition at32f413_adc.h:290
adc_type::spt2
__IO uint32_t spt2
Definition at32f413_adc.h:322
adc_type::osn4
__IO uint32_t osn4
Definition at32f413_adc.h:463
adc_type::adcen
__IO uint32_t adcen
Definition at32f413_adc.h:275
adc_type::vmhb
__IO uint32_t vmhb
Definition at32f413_adc.h:396
adc_type::ocpen
__IO uint32_t ocpen
Definition at32f413_adc.h:256
adc_type::cspt9
__IO uint32_t cspt9
Definition at32f413_adc.h:334
adc_type::adcalinit
__IO uint32_t adcalinit
Definition at32f413_adc.h:278
adc_type::pdt3
__IO uint32_t pdt3
Definition at32f413_adc.h:518
adc_type::psn1
__IO uint32_t psn1
Definition at32f413_adc.h:478
adc_type::reserved4
__IO uint32_t reserved4
Definition at32f413_adc.h:293
adc_type::cspt10
__IO uint32_t cspt10
Definition at32f413_adc.h:305
adc_type::osn10
__IO uint32_t osn10
Definition at32f413_adc.h:445
adc_type::reserved2
__IO uint32_t reserved2
Definition at32f413_adc.h:263
adc_type::osn12
__IO uint32_t osn12
Definition at32f413_adc.h:447
adc_type::ctrl1
__IO uint32_t ctrl1
Definition at32f413_adc.h:246
adc_type::sts
__IO uint32_t sts
Definition at32f413_adc.h:229
adc_type::ctrl2
__IO uint32_t ctrl2
Definition at32f413_adc.h:272
adc_type::cspt0
__IO uint32_t cspt0
Definition at32f413_adc.h:325
adc_type::reserved1
__IO uint32_t reserved1
Definition at32f413_adc.h:237
adc_type::cce
__IO uint32_t cce
Definition at32f413_adc.h:233
adc_type::osq1
__IO uint32_t osq1
Definition at32f413_adc.h:422
adc_type::cspt16
__IO uint32_t cspt16
Definition at32f413_adc.h:311
adc_type::psn2
__IO uint32_t psn2
Definition at32f413_adc.h:479
adc_type::osn2
__IO uint32_t osn2
Definition at32f413_adc.h:461
adc_type::vmor
__IO uint32_t vmor
Definition at32f413_adc.h:232
adc_type::osn15
__IO uint32_t osn15
Definition at32f413_adc.h:427
adc_type::osn11
__IO uint32_t osn11
Definition at32f413_adc.h:446
adc_type::vmlb
__IO uint32_t vmlb
Definition at32f413_adc.h:409
adc_type::osn5
__IO uint32_t osn5
Definition at32f413_adc.h:464
adc_type::pdt2
__IO uint32_t pdt2
Definition at32f413_adc.h:505
adc_type::cspt4
__IO uint32_t cspt4
Definition at32f413_adc.h:329
adc_type::ocpcnt
__IO uint32_t ocpcnt
Definition at32f413_adc.h:258
adc_type::osq3
__IO uint32_t osq3
Definition at32f413_adc.h:457
adc_type::pcautoen
__IO uint32_t pcautoen
Definition at32f413_adc.h:255
adc_type::cspt2
__IO uint32_t cspt2
Definition at32f413_adc.h:327
adc_type::cspt17
__IO uint32_t cspt17
Definition at32f413_adc.h:312
adc_type::cspt11
__IO uint32_t cspt11
Definition at32f413_adc.h:306
adc_type::pcdto3
__IO uint32_t pcdto3
Definition at32f413_adc.h:370
adc_type::cspt8
__IO uint32_t cspt8
Definition at32f413_adc.h:333
adc_type::osn7
__IO uint32_t osn7
Definition at32f413_adc.h:442
adc_type::pcten
__IO uint32_t pcten
Definition at32f413_adc.h:284
adc_type::pcswtrg
__IO uint32_t pcswtrg
Definition at32f413_adc.h:288
adc_type::osn13
__IO uint32_t osn13
Definition at32f413_adc.h:425
adc_type::cspt3
__IO uint32_t cspt3
Definition at32f413_adc.h:328
adc_type::pccs
__IO uint32_t pccs
Definition at32f413_adc.h:235


AT32F413 Firmwary Library: at32f413_board.c Source File

  • at32f413_board
at32f413_board.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27
37/* delay macros */
38#define STEP_DELAY_MS 50
39
40/* at-start led resouce array */
41 gpio_type *led_gpio_port[LED_NUM] = {LED2_GPIO, LED3_GPIO, LED4_GPIO};
42uint16_t led_gpio_pin[LED_NUM] = {LED2_PIN, LED3_PIN, LED4_PIN};
43 crm_periph_clock_type led_gpio_crm_clk[LED_NUM] = {LED2_GPIO_CRM_CLK, LED3_GPIO_CRM_CLK, LED4_GPIO_CRM_CLK};
44
45/* delay variable */
46static __IO uint32_t fac_us;
47static __IO uint32_t fac_ms;
48
49/* support printf function, usemicrolib is unnecessary */
50#if (__ARMCC_VERSION > 6000000)
51 __asm (".global __use_no_semihosting\n\t");
52 void _sys_exit(int x)
53 {
54 UNUSED(x);
55 }
56 /* __use_no_semihosting was requested, but _ttywrch was */
57 void _ttywrch(int ch)
58 {
59 UNUSED(ch);
60 }
61 FILE __stdout;
62#else
63 #ifdef __CC_ARM
64 #pragma import(__use_no_semihosting)
65 struct __FILE
66 {
67 int handle;
68 };
69 FILE __stdout;
70 void _sys_exit(int x)
71 {
72 UNUSED(x);
73 }
74 /* __use_no_semihosting was requested, but _ttywrch was */
75 void _ttywrch(int ch)
76 {
77 UNUSED(ch);
78 }
79 #endif
80#endif
81
82#if defined (__GNUC__) && !defined (__clang__)
83 #define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
84#else
85 #define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
86#endif
87
93 PUTCHAR_PROTOTYPE
94{
95#if !defined (__GNUC__) || defined (__clang__)
96 UNUSED(f);
97#endif
98 while(usart_flag_get(PRINT_UART, USART_TDBE_FLAG) == RESET);
99 usart_data_transmit(PRINT_UART, (uint16_t)ch);
100 while(usart_flag_get(PRINT_UART, USART_TDC_FLAG) == RESET);
101 return ch;
102}
103
104#if (defined (__GNUC__) && !defined (__clang__)) || (defined (__ICCARM__))
105#if defined (__GNUC__) && !defined (__clang__)
106int _write(int fd, char *pbuffer, int size)
107#elif defined ( __ICCARM__ )
108#pragma module_name = "?__write"
109int __write(int fd, char *pbuffer, int size)
110#endif
111{
112 UNUSED(fd);
113 for(int i = 0; i < size; i ++)
114 {
115 while(usart_flag_get(PRINT_UART, USART_TDBE_FLAG) == RESET);
116 usart_data_transmit(PRINT_UART, (uint16_t)(*pbuffer++));
117 while(usart_flag_get(PRINT_UART, USART_TDC_FLAG) == RESET);
118 }
119
120 return size;
121}
122#endif
123
129void uart_print_init(uint32_t baudrate)
130{
131 gpio_init_type gpio_init_struct;
132
133#if defined (__GNUC__) && !defined (__clang__)
134 setvbuf(stdout, NULL, _IONBF, 0);
135#endif
136
137 /* enable the uart and gpio clock */
138 crm_periph_clock_enable(PRINT_UART_CRM_CLK, TRUE);
139 crm_periph_clock_enable(PRINT_UART_TX_GPIO_CRM_CLK, TRUE);
140
141 gpio_default_para_init(&gpio_init_struct);
142
143 /* configure the uart tx pin */
144 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
145 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
146 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
147 gpio_init_struct.gpio_pins = PRINT_UART_TX_PIN;
148 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
149 gpio_init(PRINT_UART_TX_GPIO, &gpio_init_struct);
150
151 /* configure uart param */
152 usart_init(PRINT_UART, baudrate, USART_DATA_8BITS, USART_STOP_1_BIT);
153 usart_transmitter_enable(PRINT_UART, TRUE);
154 usart_enable(PRINT_UART, TRUE);
155}
156
162void at32_board_init()
163{
164 /* initialize delay function */
165 delay_init();
166
167 /* configure led in at_start_board */
168 at32_led_init(LED2);
169 at32_led_init(LED3);
170 at32_led_init(LED4);
171 at32_led_off(LED2);
172 at32_led_off(LED3);
173 at32_led_off(LED4);
174
175 /* configure button in at_start board */
176 at32_button_init();
177}
178
184void at32_button_init(void)
185{
186 gpio_init_type gpio_init_struct;
187
188 /* enable the button clock */
189 crm_periph_clock_enable(USER_BUTTON_CRM_CLK, TRUE);
190
191 /* set default parameter */
192 gpio_default_para_init(&gpio_init_struct);
193
194 /* configure button pin as input with pull-up/pull-down */
195 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
196 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
197 gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
198 gpio_init_struct.gpio_pins = USER_BUTTON_PIN;
199 gpio_init_struct.gpio_pull = GPIO_PULL_DOWN;
200 gpio_init(USER_BUTTON_PORT, &gpio_init_struct);
201}
202
208uint8_t at32_button_state(void)
209{
210 return gpio_input_data_bit_read(USER_BUTTON_PORT, USER_BUTTON_PIN);
211}
212
218 button_type at32_button_press()
219{
220 static uint8_t pressed = 1;
221 /* get button state in at_start board */
222 if((pressed == 1) && (at32_button_state() != RESET))
223 {
224 /* debounce */
225 pressed = 0;
226 delay_ms(10);
227 if(at32_button_state() != RESET)
228 return USER_BUTTON;
229 }
230 else if(at32_button_state() == RESET)
231 {
232 pressed = 1;
233 }
234 return NO_BUTTON;
235}
236
242void at32_led_init(led_type led)
243{
244 gpio_init_type gpio_init_struct;
245
246 /* enable the led clock */
247 crm_periph_clock_enable(led_gpio_crm_clk[led], TRUE);
248
249 /* set default parameter */
250 gpio_default_para_init(&gpio_init_struct);
251
252 /* configure the led gpio */
253 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
254 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
255 gpio_init_struct.gpio_mode = GPIO_MODE_OUTPUT;
256 gpio_init_struct.gpio_pins = led_gpio_pin[led];
257 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
258 gpio_init(led_gpio_port[led], &gpio_init_struct);
259}
260
270void at32_led_on(led_type led)
271{
272 if(led > (LED_NUM - 1))
273 return;
274 if(led_gpio_pin[led])
275 led_gpio_port[led]->clr = led_gpio_pin[led];
276}
277
287void at32_led_off(led_type led)
288{
289 if(led > (LED_NUM - 1))
290 return;
291 if(led_gpio_pin[led])
292 led_gpio_port[led]->scr = led_gpio_pin[led];
293}
294
304void at32_led_toggle(led_type led)
305{
306 if(led > (LED_NUM - 1))
307 return;
308 if(led_gpio_pin[led])
309 led_gpio_port[led]->odt ^= led_gpio_pin[led];
310}
311
317void delay_init()
318{
319 /* configure systick */
320 systick_clock_source_config(SYSTICK_CLOCK_SOURCE_AHBCLK_NODIV);
321 fac_us = system_core_clock / (1000000U);
322 fac_ms = fac_us * (1000U);
323}
324
330void delay_us(uint32_t nus)
331{
332 uint32_t temp = 0;
333 SysTick->LOAD = (uint32_t)(nus * fac_us);
334 SysTick->VAL = 0x00;
335 SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk ;
336 do
337 {
338 temp = SysTick->CTRL;
339 }while((temp & 0x01) && !(temp & (1 << 16)));
340
341 SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk;
342 SysTick->VAL = 0x00;
343}
344
350void delay_ms(uint16_t nms)
351{
352 uint32_t temp = 0;
353 while(nms)
354 {
355 if(nms > STEP_DELAY_MS)
356 {
357 SysTick->LOAD = (uint32_t)(STEP_DELAY_MS * fac_ms);
358 nms -= STEP_DELAY_MS;
359 }
360 else
361 {
362 SysTick->LOAD = (uint32_t)(nms * fac_ms);
363 nms = 0;
364 }
365 SysTick->VAL = 0x00;
366 SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
367 do
368 {
369 temp = SysTick->CTRL;
370 }while((temp & 0x01) && !(temp & (1 << 16)));
371
372 SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk;
373 SysTick->VAL = 0x00;
374 }
375}
376
382void delay_sec(uint16_t sec)
383{
384 uint16_t index;
385 for(index = 0; index < sec; index++)
386 {
387 delay_ms(500);
388 delay_ms(500);
389 }
390}
391
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
UNUSED
#define UNUSED(x)
Definition at32f413_def.h:64
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
system_core_clock
unsigned int system_core_clock
Definition system_at32f413.c:47
USER_BUTTON_PORT
#define USER_BUTTON_PORT
Definition at32f413_board.h:98
PRINT_UART_CRM_CLK
#define PRINT_UART_CRM_CLK
Definition at32f413_board.h:85
USER_BUTTON_PIN
#define USER_BUTTON_PIN
Definition at32f413_board.h:97
PRINT_UART_TX_PIN
#define PRINT_UART_TX_PIN
Definition at32f413_board.h:86
LED_NUM
#define LED_NUM
Definition at32f413_board.h:67
led_type
led_type
Definition at32f413_board.h:61
PRINT_UART
#define PRINT_UART
Definition at32f413_board.h:84
PRINT_UART_TX_GPIO
#define PRINT_UART_TX_GPIO
Definition at32f413_board.h:87
USER_BUTTON_CRM_CLK
#define USER_BUTTON_CRM_CLK
Definition at32f413_board.h:99
PRINT_UART_TX_GPIO_CRM_CLK
#define PRINT_UART_TX_GPIO_CRM_CLK
Definition at32f413_board.h:88
button_type
button_type
Definition at32f413_board.h:92
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
NO_BUTTON
@ NO_BUTTON
Definition at32f413_board.h:94
USER_BUTTON
@ USER_BUTTON
Definition at32f413_board.h:93
led_gpio_port
gpio_type * led_gpio_port[3]
Definition at32f413_board.c:41
at32_button_press
button_type at32_button_press()
returns which button have press down
Definition at32f413_board.c:218
fac_ms
static __IO uint32_t fac_ms
Definition at32f413_board.c:47
led_gpio_pin
uint16_t led_gpio_pin[3]
Definition at32f413_board.c:42
at32_led_init
void at32_led_init(led_type led)
configure led gpio
Definition at32f413_board.c:242
delay_init
void delay_init()
initialize delay function
Definition at32f413_board.c:317
at32_button_state
uint8_t at32_button_state(void)
returns the selected button state
Definition at32f413_board.c:208
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
STEP_DELAY_MS
#define STEP_DELAY_MS
Definition at32f413_board.c:38
led_gpio_crm_clk
crm_periph_clock_type led_gpio_crm_clk[3]
Definition at32f413_board.c:43
at32_led_off
void at32_led_off(led_type led)
turns selected led off.
Definition at32f413_board.c:287
uart_print_init
void uart_print_init(uint32_t baudrate)
initialize uart
Definition at32f413_board.c:129
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
PUTCHAR_PROTOTYPE
#define PUTCHAR_PROTOTYPE
Definition at32f413_board.c:85
delay_sec
void delay_sec(uint16_t sec)
inserts a delay time.
Definition at32f413_board.c:382
at32_button_init
void at32_button_init(void)
configure button gpio
Definition at32f413_board.c:184
delay_us
void delay_us(uint32_t nus)
inserts a delay time.
Definition at32f413_board.c:330
fac_us
static __IO uint32_t fac_us
Definition at32f413_board.c:46
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_periph_clock_type
crm_periph_clock_type
crm periph clock
Definition at32f413_crm.h:101
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_input_data_bit_read
flag_status gpio_input_data_bit_read(gpio_type *gpio_x, uint16_t pins)
read the specified input port pin.
Definition at32f413_gpio.c:202
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_MODE_OUTPUT
@ GPIO_MODE_OUTPUT
Definition at32f413_gpio.h:214
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_PULL_DOWN
@ GPIO_PULL_DOWN
Definition at32f413_gpio.h:245
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
systick_clock_source_config
void systick_clock_source_config(systick_clock_source_type source)
config systick clock source
Definition at32f413_misc.c:146
SYSTICK_CLOCK_SOURCE_AHBCLK_NODIV
@ SYSTICK_CLOCK_SOURCE_AHBCLK_NODIV
Definition at32f413_misc.h:89
NULL
#define NULL
Definition emmc_card/inc/at32_sdio.h:340
usart_data_transmit
void usart_data_transmit(usart_type *usart_x, uint16_t data)
transmit single data through the usart peripheral.
Definition at32f413_usart.c:380
usart_flag_get
flag_status usart_flag_get(usart_type *usart_x, uint32_t flag)
check whether the specified usart flag is set or not.
Definition at32f413_usart.c:565
usart_transmitter_enable
void usart_transmitter_enable(usart_type *usart_x, confirm_state new_state)
usart transmitter enable.
Definition at32f413_usart.c:185
usart_init
void usart_init(usart_type *usart_x, uint32_t baud_rate, usart_data_bit_num_type data_bit, usart_stop_bit_num_type stop_bit)
initialize the usart peripheral according to the specified parameters.
Definition at32f413_usart.c:105
usart_enable
void usart_enable(usart_type *usart_x, confirm_state new_state)
enable or disable the specified usart peripheral.
Definition at32f413_usart.c:172
USART_STOP_1_BIT
@ USART_STOP_1_BIT
Definition at32f413_usart.h:157
USART_DATA_8BITS
@ USART_DATA_8BITS
Definition at32f413_usart.h:112
USART_TDBE_FLAG
#define USART_TDBE_FLAG
Definition at32f413_usart.h:58
USART_TDC_FLAG
#define USART_TDC_FLAG
Definition at32f413_usart.h:57
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
gpio_type
type define gpio register all
Definition at32f413_gpio.h:299
gpio_type::scr
__IO uint32_t scr
Definition at32f413_gpio.h:415
gpio_type::odt
__IO uint32_t odt
Definition at32f413_gpio.h:387
gpio_type::clr
__IO uint32_t clr
Definition at32f413_gpio.h:458


AT32F413 Firmwary Library: at32f413_board.h Source File

  • at32f413_board
at32f413_board.h
Go to the documentation of this file.
1
27#ifndef __AT32F413_BOARD_H
28#define __AT32F413_BOARD_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "stdio.h"
35#include "at32f413.h"
36
55#if !defined (AT_START_F413_V1)
56#error "please select first the board at-start device used in your application (in at32f413_board.h file)"
57#endif
58
59/******************** define led ********************/
60typedef enum
61{
62 LED2 = 0,
63 LED3 = 1,
64 LED4 = 2
65} led_type;
66
67#define LED_NUM 3
68
69#if defined (AT_START_F413_V1)
70#define LED2_PIN GPIO_PINS_2
71#define LED2_GPIO GPIOC
72#define LED2_GPIO_CRM_CLK CRM_GPIOC_PERIPH_CLOCK
73
74#define LED3_PIN GPIO_PINS_3
75#define LED3_GPIO GPIOC
76#define LED3_GPIO_CRM_CLK CRM_GPIOC_PERIPH_CLOCK
77
78#define LED4_PIN GPIO_PINS_5
79#define LED4_GPIO GPIOC
80#define LED4_GPIO_CRM_CLK CRM_GPIOC_PERIPH_CLOCK
81#endif
82
83/**************** define print uart ******************/
84#define PRINT_UART USART1
85#define PRINT_UART_CRM_CLK CRM_USART1_PERIPH_CLOCK
86#define PRINT_UART_TX_PIN GPIO_PINS_9
87#define PRINT_UART_TX_GPIO GPIOA
88#define PRINT_UART_TX_GPIO_CRM_CLK CRM_GPIOA_PERIPH_CLOCK
89
90/******************* define button *******************/
91typedef enum
92{
93 USER_BUTTON = 0,
94 NO_BUTTON = 1
95} button_type;
96
97#define USER_BUTTON_PIN GPIO_PINS_0
98#define USER_BUTTON_PORT GPIOA
99#define USER_BUTTON_CRM_CLK CRM_GPIOA_PERIPH_CLOCK
100
109/******************** functions ********************/
110void at32_board_init(void);
111
112/* led operation function */
113void at32_led_init(led_type led);
114void at32_led_on(led_type led);
115void at32_led_off(led_type led);
116void at32_led_toggle(led_type led);
117
118/* button operation function */
119void at32_button_init(void);
120 button_type at32_button_press(void);
121uint8_t at32_button_state(void);
122
123/* delay function */
124void delay_init(void);
125void delay_us(uint32_t nus);
126void delay_ms(uint16_t nms);
127void delay_sec(uint16_t sec);
128
129/* printf uart init function */
130void uart_print_init(uint32_t baudrate);
131
144#ifdef __cplusplus
145}
146#endif
147
148#endif
149
at32f413.h
at32f413 header file
at32_board_init
void at32_board_init(void)
board initialize interface init led and button
Definition at32f413_board.c:162
at32_led_init
void at32_led_init(led_type led)
configure led gpio
Definition at32f413_board.c:242
at32_button_state
uint8_t at32_button_state(void)
returns the selected button state
Definition at32f413_board.c:208
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
at32_button_press
button_type at32_button_press(void)
returns which button have press down
Definition at32f413_board.c:218
at32_led_off
void at32_led_off(led_type led)
turns selected led off.
Definition at32f413_board.c:287
uart_print_init
void uart_print_init(uint32_t baudrate)
initialize uart
Definition at32f413_board.c:129
delay_sec
void delay_sec(uint16_t sec)
inserts a delay time.
Definition at32f413_board.c:382
at32_button_init
void at32_button_init(void)
configure button gpio
Definition at32f413_board.c:184
delay_us
void delay_us(uint32_t nus)
inserts a delay time.
Definition at32f413_board.c:330
delay_init
void delay_init(void)
initialize delay function
Definition at32f413_board.c:317
led_type
led_type
Definition at32f413_board.h:61
button_type
button_type
Definition at32f413_board.h:92
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
NO_BUTTON
@ NO_BUTTON
Definition at32f413_board.h:94
USER_BUTTON
@ USER_BUTTON
Definition at32f413_board.h:93


AT32F413 Firmwary Library: at32f413_bpr.c Source File

  • libraries
  • drivers
  • src
at32f413_bpr.c
Go to the documentation of this file.
1
26#include "at32f413_conf.h"
27
37#ifdef BPR_MODULE_ENABLED
38
48void bpr_reset(void)
49{
50 crm_battery_powered_domain_reset(TRUE);
51 crm_battery_powered_domain_reset(FALSE);
52}
53
62 flag_status bpr_flag_get(uint32_t flag)
63{
64 if(flag == BPR_TAMPER_INTERRUPT_FLAG)
65 {
66 return (flag_status)(BPR->ctrlsts_bit.tpif);
67 }
68 else
69 {
70 return (flag_status)(BPR->ctrlsts_bit.tpef);
71 }
72}
73
82 flag_status bpr_interrupt_flag_get(uint32_t flag)
83{
84 if(flag == BPR_TAMPER_INTERRUPT_FLAG)
85 {
86 return (flag_status)(BPR->ctrlsts_bit.tpif && BPR->ctrlsts_bit.tpien);
87 }
88 else
89 {
90 return (flag_status)(BPR->ctrlsts_bit.tpef && BPR->ctrlsts_bit.tpien);
91 }
92}
93
102void bpr_flag_clear(uint32_t flag)
103{
104 if(flag == BPR_TAMPER_INTERRUPT_FLAG)
105 {
106 BPR->ctrlsts_bit.tpifclr = TRUE;
107 }
108 else
109 {
110 BPR->ctrlsts_bit.tpefclr = TRUE;
111 }
112}
113
119void bpr_interrupt_enable(confirm_state new_state)
120{
121 BPR->ctrlsts_bit.tpien = new_state;
122}
123
135uint16_t bpr_data_read(bpr_data_type bpr_data)
136{
137 return (*(__IO uint16_t *)(BPR_BASE + bpr_data));
138}
139
152void bpr_data_write(bpr_data_type bpr_data, uint16_t data_value)
153{
154 (*(__IO uint32_t *)(BPR_BASE + bpr_data)) = data_value;
155}
156
168void bpr_rtc_output_select(bpr_rtc_output_type output_source)
169{
170 /* clear cco,asoe,asos,ccos,togen bits */
171 BPR->rtccal &= (uint32_t)~0x0F80;
172
173 /* set output_source value */
174 BPR->rtccal |= output_source;
175}
176
182void bpr_rtc_clock_calibration_value_set(uint8_t calibration_value)
183{
184 /* set rtc clock calibration value */
185 BPR->rtccal_bit.calval= calibration_value;
186}
187
193void bpr_tamper_pin_enable(confirm_state new_state)
194{
195 BPR->ctrl_bit.tpen = new_state;
196}
197
206void bpr_tamper_pin_active_level_set(bpr_tamper_pin_active_level_type active_level)
207{
208 BPR->ctrl_bit.tpp = active_level;
209}
210
215#endif
216
bpr_data_type
bpr_data_type
battery powered register data type
Definition at32f413_bpr.h:66
bpr_tamper_pin_active_level_type
bpr_tamper_pin_active_level_type
tamper pin active level type
Definition at32f413_bpr.h:127
bpr_rtc_output_type
bpr_rtc_output_type
bpr rtc output type
Definition at32f413_bpr.h:115
BPR_TAMPER_INTERRUPT_FLAG
#define BPR_TAMPER_INTERRUPT_FLAG
Definition at32f413_bpr.h:51
bpr_reset
void bpr_reset(void)
bpr reset by crm reset register
Definition at32f413_bpr.c:48
bpr_rtc_clock_calibration_value_set
void bpr_rtc_clock_calibration_value_set(uint8_t calibration_value)
set rtc clock calibration value
Definition at32f413_bpr.c:182
bpr_tamper_pin_enable
void bpr_tamper_pin_enable(confirm_state new_state)
enable or disable bpr tamper pin
Definition at32f413_bpr.c:193
bpr_interrupt_enable
void bpr_interrupt_enable(confirm_state new_state)
enable or disable bpr tamper interrupt
Definition at32f413_bpr.c:119
bpr_interrupt_flag_get
flag_status bpr_interrupt_flag_get(uint32_t flag)
bpr interrupt flag get
Definition at32f413_bpr.c:82
bpr_rtc_output_select
void bpr_rtc_output_select(bpr_rtc_output_type output_source)
select bpr rtc output
Definition at32f413_bpr.c:168
bpr_tamper_pin_active_level_set
void bpr_tamper_pin_active_level_set(bpr_tamper_pin_active_level_type active_level)
set bpr tamper pin active level
Definition at32f413_bpr.c:206
bpr_data_read
uint16_t bpr_data_read(bpr_data_type bpr_data)
read bpr bpr data
Definition at32f413_bpr.c:135
bpr_flag_clear
void bpr_flag_clear(uint32_t flag)
clear bpr tamper flag
Definition at32f413_bpr.c:102
bpr_data_write
void bpr_data_write(bpr_data_type bpr_data, uint16_t data_value)
write bpr data
Definition at32f413_bpr.c:152
bpr_flag_get
flag_status bpr_flag_get(uint32_t flag)
bpr event flag get, for tamper event flag
Definition at32f413_bpr.c:62
BPR
#define BPR
Definition at32f413_bpr.h:753
crm_battery_powered_domain_reset
void crm_battery_powered_domain_reset(confirm_state new_state)
battery powered domain software reset
Definition at32f413_crm.c:554
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
flag_status
flag_status
flag status
Definition at32f413.h:292
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
BPR_BASE
#define BPR_BASE
Definition at32f413.h:359
at32f413_conf.h
at32f413 config header file


AT32F413 Firmwary Library: at32f413_bpr.h Source File

  • libraries
  • drivers
  • inc
at32f413_bpr.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_BPR_H
28#define __AT32F413_BPR_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34
35/* Includes ------------------------------------------------------------------*/
36#include "at32f413.h"
37
51#define BPR_TAMPER_INTERRUPT_FLAG ((uint32_t)0x00000001)
52#define BPR_TAMPER_EVENT_FLAG ((uint32_t)0x00000002)
65typedef enum
66{
67 BPR_DATA1 = 0x04,
68 BPR_DATA2 = 0x08,
69 BPR_DATA3 = 0x0C,
70 BPR_DATA4 = 0x10,
71 BPR_DATA5 = 0x14,
72 BPR_DATA6 = 0x18,
73 BPR_DATA7 = 0x1C,
74 BPR_DATA8 = 0x20,
75 BPR_DATA9 = 0x24,
76 BPR_DATA10 = 0x28,
77 BPR_DATA11 = 0x40,
78 BPR_DATA12 = 0x44,
79 BPR_DATA13 = 0x48,
80 BPR_DATA14 = 0x4C,
81 BPR_DATA15 = 0x50,
82 BPR_DATA16 = 0x54,
83 BPR_DATA17 = 0x58,
84 BPR_DATA18 = 0x5C,
85 BPR_DATA19 = 0x60,
86 BPR_DATA20 = 0x64,
87 BPR_DATA21 = 0x68,
88 BPR_DATA22 = 0x6C,
89 BPR_DATA23 = 0x70,
90 BPR_DATA24 = 0x74,
91 BPR_DATA25 = 0x78,
92 BPR_DATA26 = 0x7C,
93 BPR_DATA27 = 0x80,
94 BPR_DATA28 = 0x84,
95 BPR_DATA29 = 0x88,
96 BPR_DATA30 = 0x8C,
97 BPR_DATA31 = 0x90,
98 BPR_DATA32 = 0x94,
99 BPR_DATA33 = 0x98,
100 BPR_DATA34 = 0x9C,
101 BPR_DATA35 = 0xA0,
102 BPR_DATA36 = 0xA4,
103 BPR_DATA37 = 0xA8,
104 BPR_DATA38 = 0xAC,
105 BPR_DATA39 = 0xB0,
106 BPR_DATA40 = 0xB4,
107 BPR_DATA41 = 0xB8,
108 BPR_DATA42 = 0xBC
109} bpr_data_type;
110
114typedef enum
115{
116 BPR_RTC_OUTPUT_NONE = 0x000,
117 BPR_RTC_OUTPUT_CLOCK_CAL_BEFORE = 0x080,
118 BPR_RTC_OUTPUT_ALARM = 0x100,
119 BPR_RTC_OUTPUT_SECOND = 0x300,
120 BPR_RTC_OUTPUT_CLOCK_CAL_AFTER = 0x480
121} bpr_rtc_output_type;
122
126typedef enum
127{
128 BPR_TAMPER_PIN_ACTIVE_HIGH = 0x00,
129 BPR_TAMPER_PIN_ACTIVE_LOW = 0x01
130} bpr_tamper_pin_active_level_type;
131
135typedef struct
136{
140 __IO uint32_t reserved1;
141
145 union
146 {
147 __IO uint32_t dt1;
148 struct
149 {
150 __IO uint32_t dt : 16;/* [15:0] */
151 __IO uint32_t reserved1 : 16;/* [31:15] */
152 } dt1_bit;
153 };
154
158 union
159 {
160 __IO uint32_t dt2;
161 struct
162 {
163 __IO uint32_t dt : 16;/* [15:0] */
164 __IO uint32_t reserved1 : 16;/* [31:15] */
165 } dt2_bit;
166 };
167
171 union
172 {
173 __IO uint32_t dt3;
174 struct
175 {
176 __IO uint32_t dt : 16;/* [15:0] */
177 __IO uint32_t reserved1 : 16;/* [31:15] */
178 } dt3_bit;
179 };
180
184 union
185 {
186 __IO uint32_t dt4;
187 struct
188 {
189 __IO uint32_t dt : 16;/* [15:0] */
190 __IO uint32_t reserved1 : 16;/* [31:15] */
191 } dt4_bit;
192 };
193
197 union
198 {
199 __IO uint32_t dt5;
200 struct
201 {
202 __IO uint32_t dt : 16;/* [15:0] */
203 __IO uint32_t reserved1 : 16;/* [31:15] */
204 } dt5_bit;
205 };
206
210 union
211 {
212 __IO uint32_t dt6;
213 struct
214 {
215 __IO uint32_t dt : 16;/* [15:0] */
216 __IO uint32_t reserved1 : 16;/* [31:15] */
217 } dt6_bit;
218 };
219
223 union
224 {
225 __IO uint32_t dt7;
226 struct
227 {
228 __IO uint32_t dt : 16;/* [15:0] */
229 __IO uint32_t reserved1 : 16;/* [31:15] */
230 } dt7_bit;
231 };
232
236 union
237 {
238 __IO uint32_t dt8;
239 struct
240 {
241 __IO uint32_t dt : 16;/* [15:0] */
242 __IO uint32_t reserved1 : 16;/* [31:15] */
243 } dt8_bit;
244 };
245
249 union
250 {
251 __IO uint32_t dt9;
252 struct
253 {
254 __IO uint32_t dt : 16;/* [15:0] */
255 __IO uint32_t reserved1 : 16;/* [31:15] */
256 } dt9_bit;
257 };
258
262 union
263 {
264 __IO uint32_t dt10;
265 struct
266 {
267 __IO uint32_t dt : 16;/* [15:0] */
268 __IO uint32_t reserved1 : 16;/* [31:15] */
269 } dt10_bit;
270 };
271
275 union
276 {
277 __IO uint32_t rtccal;
278 struct
279 {
280 __IO uint32_t calval : 7; /* [6:0] */
281 __IO uint32_t calout : 1; /* [7] */
282 __IO uint32_t outen : 1; /* [8] */
283 __IO uint32_t outsel : 1; /* [9] */
284 __IO uint32_t ccos : 1; /* [10] */
285 __IO uint32_t outm : 1; /* [11] */
286 __IO uint32_t reserved1 : 20;/* [31:12] */
287 } rtccal_bit;
288 };
289
293 union
294 {
295 __IO uint32_t ctrl;
296 struct
297 {
298 __IO uint32_t tpen : 1; /* [0] */
299 __IO uint32_t tpp : 1; /* [1] */
300 __IO uint32_t reserved1 : 30;/* [31:2] */
301 } ctrl_bit;
302 };
303
307 union
308 {
309 __IO uint32_t ctrlsts;
310 struct
311 {
312 __IO uint32_t tpefclr : 1;/* [0] */
313 __IO uint32_t tpifclr : 1;/* [1] */
314 __IO uint32_t tpien : 1;/* [2] */
315 __IO uint32_t reserved1 : 5;/* [7:3] */
316 __IO uint32_t tpef : 1;/* [8] */
317 __IO uint32_t tpif : 1;/* [9] */
318 __IO uint32_t reserved2 : 22;/* [31:10] */
319 } ctrlsts_bit;
320 };
321
325 __IO uint32_t reserved2;
326
330 __IO uint32_t reserved3;
331
335 union
336 {
337 __IO uint32_t dt11;
338 struct
339 {
340 __IO uint32_t dt : 16;/* [15:0] */
341 __IO uint32_t reserved1 : 16;/* [31:15] */
342 } dt11_bit;
343 };
344
348 union
349 {
350 __IO uint32_t dt12;
351 struct
352 {
353 __IO uint32_t dt : 16;/* [15:0] */
354 __IO uint32_t reserved1 : 16;/* [31:15] */
355 } dt12_bit;
356 };
357
361 union
362 {
363 __IO uint32_t dt13;
364 struct
365 {
366 __IO uint32_t dt : 16;/* [15:0] */
367 __IO uint32_t reserved1 : 16;/* [31:15] */
368 } dt13_bit;
369 };
370
374 union
375 {
376 __IO uint32_t dt14;
377 struct
378 {
379 __IO uint32_t dt : 16;/* [15:0] */
380 __IO uint32_t reserved1 : 16;/* [31:15] */
381 } dt14_bit;
382 };
383
387 union
388 {
389 __IO uint32_t dt15;
390 struct
391 {
392 __IO uint32_t dt : 16;/* [15:0] */
393 __IO uint32_t reserved1 : 16;/* [31:15] */
394 } dt15_bit;
395 };
396
400 union
401 {
402 __IO uint32_t dt16;
403 struct
404 {
405 __IO uint32_t dt : 16;/* [15:0] */
406 __IO uint32_t reserved1 : 16;/* [31:15] */
407 } dt16_bit;
408 };
409
413 union
414 {
415 __IO uint32_t dt17;
416 struct
417 {
418 __IO uint32_t dt : 16;/* [15:0] */
419 __IO uint32_t reserved1 : 16;/* [31:15] */
420 } dt17_bit;
421 };
422
426 union
427 {
428 __IO uint32_t dt18;
429 struct
430 {
431 __IO uint32_t dt : 16;/* [15:0] */
432 __IO uint32_t reserved1 : 16;/* [31:15] */
433 } dt18_bit;
434 };
435
439 union
440 {
441 __IO uint32_t dt19;
442 struct
443 {
444 __IO uint32_t dt : 16;/* [15:0] */
445 __IO uint32_t reserved1 : 16;/* [31:15] */
446 } dt19_bit;
447 };
448
452 union
453 {
454 __IO uint32_t dt20;
455 struct
456 {
457 __IO uint32_t dt : 16;/* [15:0] */
458 __IO uint32_t reserved1 : 16;/* [31:15] */
459 } dt20_bit;
460 };
461
465 union
466 {
467 __IO uint32_t dt21;
468 struct
469 {
470 __IO uint32_t dt : 16;/* [15:0] */
471 __IO uint32_t reserved1 : 16;/* [31:15] */
472 } dt21_bit;
473 };
474
478 union
479 {
480 __IO uint32_t dt22;
481 struct
482 {
483 __IO uint32_t dt : 16;/* [15:0] */
484 __IO uint32_t reserved1 : 16;/* [31:15] */
485 } dt22_bit;
486 };
487
491 union
492 {
493 __IO uint32_t dt23;
494 struct
495 {
496 __IO uint32_t dt : 16;/* [15:0] */
497 __IO uint32_t reserved1 : 16;/* [31:15] */
498 } dt23_bit;
499 };
500
504 union
505 {
506 __IO uint32_t dt24;
507 struct
508 {
509 __IO uint32_t dt : 16;/* [15:0] */
510 __IO uint32_t reserved1 : 16;/* [31:15] */
511 } dt24_bit;
512 };
513
517 union
518 {
519 __IO uint32_t dt25;
520 struct
521 {
522 __IO uint32_t dt : 16;/* [15:0] */
523 __IO uint32_t reserved1 : 16;/* [31:15] */
524 } dt25_bit;
525 };
526
530 union
531 {
532 __IO uint32_t dt26;
533 struct
534 {
535 __IO uint32_t dt : 16;/* [15:0] */
536 __IO uint32_t reserved1 : 16;/* [31:15] */
537 } dt26_bit;
538 };
539
543 union
544 {
545 __IO uint32_t dt27;
546 struct
547 {
548 __IO uint32_t dt : 16;/* [15:0] */
549 __IO uint32_t reserved1 : 16;/* [31:15] */
550 } dt27_bit;
551 };
552
556 union
557 {
558 __IO uint32_t dt28;
559 struct
560 {
561 __IO uint32_t dt : 16;/* [15:0] */
562 __IO uint32_t reserved1 : 16;/* [31:15] */
563 } dt28_bit;
564 };
565
569 union
570 {
571 __IO uint32_t dt29;
572 struct
573 {
574 __IO uint32_t dt : 16;/* [15:0] */
575 __IO uint32_t reserved1 : 16;/* [31:15] */
576 } dt29_bit;
577 };
578
582 union
583 {
584 __IO uint32_t dt30;
585 struct
586 {
587 __IO uint32_t dt : 16;/* [15:0] */
588 __IO uint32_t reserved1 : 16;/* [31:15] */
589 } dt30_bit;
590 };
591
595 union
596 {
597 __IO uint32_t dt31;
598 struct
599 {
600 __IO uint32_t dt : 16;/* [15:0] */
601 __IO uint32_t reserved1 : 16;/* [31:15] */
602 } dt31_bit;
603 };
604
608 union
609 {
610 __IO uint32_t dt32;
611 struct
612 {
613 __IO uint32_t dt : 16;/* [15:0] */
614 __IO uint32_t reserved1 : 16;/* [31:15] */
615 } dt32_bit;
616 };
617
621 union
622 {
623 __IO uint32_t dt33;
624 struct
625 {
626 __IO uint32_t dt : 16;/* [15:0] */
627 __IO uint32_t reserved1 : 16;/* [31:15] */
628 } dt33_bit;
629 };
630
634 union
635 {
636 __IO uint32_t dt34;
637 struct
638 {
639 __IO uint32_t dt : 16;/* [15:0] */
640 __IO uint32_t reserved1 : 16;/* [31:15] */
641 } dt34_bit;
642 };
643
647 union
648 {
649 __IO uint32_t dt35;
650 struct
651 {
652 __IO uint32_t dt : 16;/* [15:0] */
653 __IO uint32_t reserved1 : 16;/* [31:15] */
654 } dt35_bit;
655 };
656
660 union
661 {
662 __IO uint32_t dt36;
663 struct
664 {
665 __IO uint32_t dt : 16;/* [15:0] */
666 __IO uint32_t reserved1 : 16;/* [31:15] */
667 } dt36_bit;
668 };
669
673 union
674 {
675 __IO uint32_t dt37;
676 struct
677 {
678 __IO uint32_t dt : 16;/* [15:0] */
679 __IO uint32_t reserved1 : 16;/* [31:15] */
680 } dt37_bit;
681 };
682
686 union
687 {
688 __IO uint32_t dt38;
689 struct
690 {
691 __IO uint32_t dt : 16;/* [15:0] */
692 __IO uint32_t reserved1 : 16;/* [31:15] */
693 } dt38_bit;
694 };
695
699 union
700 {
701 __IO uint32_t dt39;
702 struct
703 {
704 __IO uint32_t dt : 16;/* [15:0] */
705 __IO uint32_t reserved1 : 16;/* [31:15] */
706 } dt39_bit;
707 };
708
712 union
713 {
714 __IO uint32_t dt40;
715 struct
716 {
717 __IO uint32_t dt : 16;/* [15:0] */
718 __IO uint32_t reserved1 : 16;/* [31:15] */
719 } dt40_bit;
720 };
721
725 union
726 {
727 __IO uint32_t dt41;
728 struct
729 {
730 __IO uint32_t dt : 16;/* [15:0] */
731 __IO uint32_t reserved1 : 16;/* [31:15] */
732 } dt41_bit;
733 };
734
738 union
739 {
740 __IO uint32_t dt42;
741 struct
742 {
743 __IO uint32_t dt : 16;/* [15:0] */
744 __IO uint32_t reserved1 : 16;/* [31:15] */
745 } dt42_bit;
746 };
747} bpr_type;
748
753#define BPR ((bpr_type *) BPR_BASE)
754
759void bpr_reset(void);
760 flag_status bpr_flag_get(uint32_t flag);
761 flag_status bpr_interrupt_flag_get(uint32_t flag);
762void bpr_flag_clear(uint32_t flag);
763void bpr_interrupt_enable(confirm_state new_state);
764uint16_t bpr_data_read(bpr_data_type bpr_data);
765void bpr_data_write(bpr_data_type bpr_data, uint16_t data_value);
766void bpr_rtc_output_select(bpr_rtc_output_type output_source);
767void bpr_rtc_clock_calibration_value_set(uint8_t calibration_value);
768void bpr_tamper_pin_enable(confirm_state new_state);
769void bpr_tamper_pin_active_level_set(bpr_tamper_pin_active_level_type active_level);
770
783#ifdef __cplusplus
784}
785#endif
786
787#endif
at32f413.h
at32f413 header file
bpr_reset
void bpr_reset(void)
bpr reset by crm reset register
Definition at32f413_bpr.c:48
bpr_rtc_clock_calibration_value_set
void bpr_rtc_clock_calibration_value_set(uint8_t calibration_value)
set rtc clock calibration value
Definition at32f413_bpr.c:182
bpr_tamper_pin_enable
void bpr_tamper_pin_enable(confirm_state new_state)
enable or disable bpr tamper pin
Definition at32f413_bpr.c:193
bpr_interrupt_enable
void bpr_interrupt_enable(confirm_state new_state)
enable or disable bpr tamper interrupt
Definition at32f413_bpr.c:119
bpr_interrupt_flag_get
flag_status bpr_interrupt_flag_get(uint32_t flag)
bpr interrupt flag get
Definition at32f413_bpr.c:82
bpr_rtc_output_select
void bpr_rtc_output_select(bpr_rtc_output_type output_source)
select bpr rtc output
Definition at32f413_bpr.c:168
bpr_tamper_pin_active_level_set
void bpr_tamper_pin_active_level_set(bpr_tamper_pin_active_level_type active_level)
set bpr tamper pin active level
Definition at32f413_bpr.c:206
bpr_data_read
uint16_t bpr_data_read(bpr_data_type bpr_data)
read bpr bpr data
Definition at32f413_bpr.c:135
bpr_flag_clear
void bpr_flag_clear(uint32_t flag)
clear bpr tamper flag
Definition at32f413_bpr.c:102
bpr_data_write
void bpr_data_write(bpr_data_type bpr_data, uint16_t data_value)
write bpr data
Definition at32f413_bpr.c:152
bpr_flag_get
flag_status bpr_flag_get(uint32_t flag)
bpr event flag get, for tamper event flag
Definition at32f413_bpr.c:62
bpr_data_type
bpr_data_type
battery powered register data type
Definition at32f413_bpr.h:66
bpr_tamper_pin_active_level_type
bpr_tamper_pin_active_level_type
tamper pin active level type
Definition at32f413_bpr.h:127
bpr_rtc_output_type
bpr_rtc_output_type
bpr rtc output type
Definition at32f413_bpr.h:115
BPR_DATA26
@ BPR_DATA26
Definition at32f413_bpr.h:92
BPR_DATA28
@ BPR_DATA28
Definition at32f413_bpr.h:94
BPR_DATA31
@ BPR_DATA31
Definition at32f413_bpr.h:97
BPR_DATA8
@ BPR_DATA8
Definition at32f413_bpr.h:74
BPR_DATA25
@ BPR_DATA25
Definition at32f413_bpr.h:91
BPR_DATA39
@ BPR_DATA39
Definition at32f413_bpr.h:105
BPR_DATA7
@ BPR_DATA7
Definition at32f413_bpr.h:73
BPR_DATA12
@ BPR_DATA12
Definition at32f413_bpr.h:78
BPR_DATA29
@ BPR_DATA29
Definition at32f413_bpr.h:95
BPR_DATA19
@ BPR_DATA19
Definition at32f413_bpr.h:85
BPR_DATA1
@ BPR_DATA1
Definition at32f413_bpr.h:67
BPR_DATA36
@ BPR_DATA36
Definition at32f413_bpr.h:102
BPR_DATA9
@ BPR_DATA9
Definition at32f413_bpr.h:75
BPR_DATA10
@ BPR_DATA10
Definition at32f413_bpr.h:76
BPR_DATA27
@ BPR_DATA27
Definition at32f413_bpr.h:93
BPR_DATA20
@ BPR_DATA20
Definition at32f413_bpr.h:86
BPR_DATA38
@ BPR_DATA38
Definition at32f413_bpr.h:104
BPR_DATA37
@ BPR_DATA37
Definition at32f413_bpr.h:103
BPR_DATA41
@ BPR_DATA41
Definition at32f413_bpr.h:107
BPR_DATA13
@ BPR_DATA13
Definition at32f413_bpr.h:79
BPR_DATA4
@ BPR_DATA4
Definition at32f413_bpr.h:70
BPR_DATA32
@ BPR_DATA32
Definition at32f413_bpr.h:98
BPR_DATA16
@ BPR_DATA16
Definition at32f413_bpr.h:82
BPR_DATA11
@ BPR_DATA11
Definition at32f413_bpr.h:77
BPR_DATA24
@ BPR_DATA24
Definition at32f413_bpr.h:90
BPR_DATA23
@ BPR_DATA23
Definition at32f413_bpr.h:89
BPR_DATA5
@ BPR_DATA5
Definition at32f413_bpr.h:71
BPR_DATA18
@ BPR_DATA18
Definition at32f413_bpr.h:84
BPR_DATA17
@ BPR_DATA17
Definition at32f413_bpr.h:83
BPR_DATA42
@ BPR_DATA42
Definition at32f413_bpr.h:108
BPR_DATA21
@ BPR_DATA21
Definition at32f413_bpr.h:87
BPR_DATA33
@ BPR_DATA33
Definition at32f413_bpr.h:99
BPR_DATA40
@ BPR_DATA40
Definition at32f413_bpr.h:106
BPR_DATA30
@ BPR_DATA30
Definition at32f413_bpr.h:96
BPR_DATA2
@ BPR_DATA2
Definition at32f413_bpr.h:68
BPR_DATA14
@ BPR_DATA14
Definition at32f413_bpr.h:80
BPR_DATA15
@ BPR_DATA15
Definition at32f413_bpr.h:81
BPR_DATA3
@ BPR_DATA3
Definition at32f413_bpr.h:69
BPR_DATA22
@ BPR_DATA22
Definition at32f413_bpr.h:88
BPR_DATA34
@ BPR_DATA34
Definition at32f413_bpr.h:100
BPR_DATA35
@ BPR_DATA35
Definition at32f413_bpr.h:101
BPR_DATA6
@ BPR_DATA6
Definition at32f413_bpr.h:72
BPR_TAMPER_PIN_ACTIVE_LOW
@ BPR_TAMPER_PIN_ACTIVE_LOW
Definition at32f413_bpr.h:129
BPR_TAMPER_PIN_ACTIVE_HIGH
@ BPR_TAMPER_PIN_ACTIVE_HIGH
Definition at32f413_bpr.h:128
BPR_RTC_OUTPUT_NONE
@ BPR_RTC_OUTPUT_NONE
Definition at32f413_bpr.h:116
BPR_RTC_OUTPUT_ALARM
@ BPR_RTC_OUTPUT_ALARM
Definition at32f413_bpr.h:118
BPR_RTC_OUTPUT_CLOCK_CAL_AFTER
@ BPR_RTC_OUTPUT_CLOCK_CAL_AFTER
Definition at32f413_bpr.h:120
BPR_RTC_OUTPUT_CLOCK_CAL_BEFORE
@ BPR_RTC_OUTPUT_CLOCK_CAL_BEFORE
Definition at32f413_bpr.h:117
BPR_RTC_OUTPUT_SECOND
@ BPR_RTC_OUTPUT_SECOND
Definition at32f413_bpr.h:119
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
flag_status
flag_status
flag status
Definition at32f413.h:292
bpr_type
type define bpr register all
Definition at32f413_bpr.h:136
bpr_type::dt14
__IO uint32_t dt14
Definition at32f413_bpr.h:376
bpr_type::dt32
__IO uint32_t dt32
Definition at32f413_bpr.h:610
bpr_type::dt22
__IO uint32_t dt22
Definition at32f413_bpr.h:480
bpr_type::reserved2
__IO uint32_t reserved2
reserved, offset:0x38
Definition at32f413_bpr.h:318
bpr_type::dt17
__IO uint32_t dt17
Definition at32f413_bpr.h:415
bpr_type::dt24
__IO uint32_t dt24
Definition at32f413_bpr.h:506
bpr_type::outen
__IO uint32_t outen
Definition at32f413_bpr.h:282
bpr_type::ccos
__IO uint32_t ccos
Definition at32f413_bpr.h:284
bpr_type::dt11
__IO uint32_t dt11
Definition at32f413_bpr.h:337
bpr_type::dt35
__IO uint32_t dt35
Definition at32f413_bpr.h:649
bpr_type::dt30
__IO uint32_t dt30
Definition at32f413_bpr.h:584
bpr_type::tpp
__IO uint32_t tpp
Definition at32f413_bpr.h:299
bpr_type::dt19
__IO uint32_t dt19
Definition at32f413_bpr.h:441
bpr_type::tpif
__IO uint32_t tpif
Definition at32f413_bpr.h:317
bpr_type::dt38
__IO uint32_t dt38
Definition at32f413_bpr.h:688
bpr_type::tpifclr
__IO uint32_t tpifclr
Definition at32f413_bpr.h:313
bpr_type::dt8
__IO uint32_t dt8
Definition at32f413_bpr.h:238
bpr_type::tpien
__IO uint32_t tpien
Definition at32f413_bpr.h:314
bpr_type::dt25
__IO uint32_t dt25
Definition at32f413_bpr.h:519
bpr_type::ctrl
__IO uint32_t ctrl
Definition at32f413_bpr.h:295
bpr_type::dt16
__IO uint32_t dt16
Definition at32f413_bpr.h:402
bpr_type::dt31
__IO uint32_t dt31
Definition at32f413_bpr.h:597
bpr_type::dt
__IO uint32_t dt
Definition at32f413_bpr.h:150
bpr_type::dt37
__IO uint32_t dt37
Definition at32f413_bpr.h:675
bpr_type::dt39
__IO uint32_t dt39
Definition at32f413_bpr.h:701
bpr_type::dt34
__IO uint32_t dt34
Definition at32f413_bpr.h:636
bpr_type::dt20
__IO uint32_t dt20
Definition at32f413_bpr.h:454
bpr_type::dt1
__IO uint32_t dt1
Definition at32f413_bpr.h:147
bpr_type::reserved3
__IO uint32_t reserved3
reserved, offset:0x3C
Definition at32f413_bpr.h:330
bpr_type::tpefclr
__IO uint32_t tpefclr
Definition at32f413_bpr.h:312
bpr_type::calout
__IO uint32_t calout
Definition at32f413_bpr.h:281
bpr_type::calval
__IO uint32_t calval
Definition at32f413_bpr.h:280
bpr_type::dt7
__IO uint32_t dt7
Definition at32f413_bpr.h:225
bpr_type::dt3
__IO uint32_t dt3
Definition at32f413_bpr.h:173
bpr_type::dt29
__IO uint32_t dt29
Definition at32f413_bpr.h:571
bpr_type::dt6
__IO uint32_t dt6
Definition at32f413_bpr.h:212
bpr_type::dt33
__IO uint32_t dt33
Definition at32f413_bpr.h:623
bpr_type::dt18
__IO uint32_t dt18
Definition at32f413_bpr.h:428
bpr_type::dt4
__IO uint32_t dt4
Definition at32f413_bpr.h:186
bpr_type::dt13
__IO uint32_t dt13
Definition at32f413_bpr.h:363
bpr_type::tpef
__IO uint32_t tpef
Definition at32f413_bpr.h:316
bpr_type::dt42
__IO uint32_t dt42
Definition at32f413_bpr.h:740
bpr_type::dt36
__IO uint32_t dt36
Definition at32f413_bpr.h:662
bpr_type::ctrlsts
__IO uint32_t ctrlsts
Definition at32f413_bpr.h:309
bpr_type::dt12
__IO uint32_t dt12
Definition at32f413_bpr.h:350
bpr_type::dt28
__IO uint32_t dt28
Definition at32f413_bpr.h:558
bpr_type::dt9
__IO uint32_t dt9
Definition at32f413_bpr.h:251
bpr_type::outsel
__IO uint32_t outsel
Definition at32f413_bpr.h:283
bpr_type::dt15
__IO uint32_t dt15
Definition at32f413_bpr.h:389
bpr_type::dt21
__IO uint32_t dt21
Definition at32f413_bpr.h:467
bpr_type::dt26
__IO uint32_t dt26
Definition at32f413_bpr.h:532
bpr_type::dt10
__IO uint32_t dt10
Definition at32f413_bpr.h:264
bpr_type::dt2
__IO uint32_t dt2
Definition at32f413_bpr.h:160
bpr_type::outm
__IO uint32_t outm
Definition at32f413_bpr.h:285
bpr_type::dt40
__IO uint32_t dt40
Definition at32f413_bpr.h:714
bpr_type::reserved1
__IO uint32_t reserved1
reserved, offset:0x00
Definition at32f413_bpr.h:140
bpr_type::dt5
__IO uint32_t dt5
Definition at32f413_bpr.h:199
bpr_type::tpen
__IO uint32_t tpen
Definition at32f413_bpr.h:298
bpr_type::dt27
__IO uint32_t dt27
Definition at32f413_bpr.h:545
bpr_type::rtccal
__IO uint32_t rtccal
Definition at32f413_bpr.h:277
bpr_type::dt23
__IO uint32_t dt23
Definition at32f413_bpr.h:493
bpr_type::dt41
__IO uint32_t dt41
Definition at32f413_bpr.h:727


AT32F413 Firmwary Library: at32f413_can.c Source File

  • libraries
  • drivers
  • src
at32f413_can.c
Go to the documentation of this file.
1
26#include "at32f413_conf.h"
27
37#ifdef CAN_MODULE_ENABLED
38
50void can_reset(can_type* can_x)
51{
52 if(can_x == CAN1)
53 {
54 crm_periph_reset(CRM_CAN1_PERIPH_RESET, TRUE);
55 crm_periph_reset(CRM_CAN1_PERIPH_RESET, FALSE);
56 }
57#if defined (AT32F413TBU7) || defined (AT32F413Rx) || defined (AT32F413Cx) || \
58 defined (AT32F413Kx)
59 else if(can_x == CAN2)
60 {
61 crm_periph_reset(CRM_CAN2_PERIPH_RESET, TRUE);
62 crm_periph_reset(CRM_CAN2_PERIPH_RESET, FALSE);
63 }
64#endif
65}
66
72void can_baudrate_default_para_init(can_baudrate_type* can_baudrate_struct)
73{
74 /* reset can baudrate structure parameters values */
75
76 /* baud rate division */
77 can_baudrate_struct->baudrate_div = 1;
78
79 /* resynchronization adjust width */
80 can_baudrate_struct->rsaw_size = CAN_RSAW_2TQ;
81
82 /* bit time segment 1 */
83 can_baudrate_struct->bts1_size = CAN_BTS1_4TQ;
84
85 /* bit time segment 2 */
86 can_baudrate_struct->bts2_size = CAN_BTS2_3TQ;
87}
88
101 error_status can_baudrate_set(can_type* can_x, can_baudrate_type* can_baudrate_struct)
102{
103 error_status status_index = ERROR;
104 uint32_t wait_ack_index = 0x00000000;
105 /* exit from doze mode */
106 can_x->mctrl_bit.dzen = FALSE;
107
108 /* request freeze mode */
109 can_x->mctrl_bit.fzen = TRUE;
110
111 /* wait the acknowledge */
112 while((!can_x->msts_bit.fzc) && (wait_ack_index != FZC_TIMEOUT))
113 {
114 wait_ack_index++;
115 }
116
117 /* check acknowledge */
118 if(can_x->msts_bit.fzc)
119 {
120 can_x->btmg_bit.brdiv = can_baudrate_struct->baudrate_div - 1;
121 can_x->btmg_bit.rsaw = can_baudrate_struct->rsaw_size;
122 can_x->btmg_bit.bts1 = can_baudrate_struct->bts1_size;
123 can_x->btmg_bit.bts2 = can_baudrate_struct->bts2_size;
124
125 /* request leave freeze mode */
126 can_x->mctrl_bit.fzen = FALSE;
127
128 /* wait the acknowledge */
129 wait_ack_index = 0;
130 while((can_x->msts_bit.fzc) && (wait_ack_index != FZC_TIMEOUT))
131 {
132 wait_ack_index++;
133 }
134
135 /* check acknowledged */
136 if(can_x->msts_bit.fzc)
137 {
138 status_index = ERROR;
139 }
140 else
141 {
142 status_index = SUCCESS ;
143 }
144 }
145 else
146 {
147 status_index = ERROR;
148 }
149
150 /* return the status of baudrate set */
151 return status_index;
152}
153
159void can_default_para_init(can_base_type* can_base_struct)
160{
161 /* reset can init structure parameters values */
162
163 /* initialize the time triggered communication mode */
164 can_base_struct->ttc_enable = FALSE;
165
166 /* initialize the automatic exit bus-off management */
167 can_base_struct->aebo_enable = FALSE;
168
169 /* initialize the automatic exit doze mode */
170 can_base_struct->aed_enable = FALSE;
171
172 /* initialize the prohibit retransmission when sending fails */
173 can_base_struct->prsf_enable = FALSE;
174
175 /* initialize the message discarding rule select when overflow */
176 can_base_struct->mdrsel_selection = CAN_DISCARDING_FIRST_RECEIVED;
177
178 /* initialize the multiple message sending sequence rule */
179 can_base_struct->mmssr_selection = CAN_SENDING_BY_ID;
180
181 /* initialize the can_mode */
182 can_base_struct->mode_selection = CAN_MODE_COMMUNICATE;
183}
184
196 error_status can_base_init(can_type* can_x, can_base_type* can_base_struct)
197{
198 error_status init_status_index = ERROR;
199 uint32_t wait_ack_index = 0x00000000;
200 /* exit from doze mode */
201 can_x->mctrl_bit.dzen = FALSE;
202
203 /* request freeze mode */
204 can_x->mctrl_bit.fzen = TRUE;
205
206 /* wait the acknowledge */
207 while((!can_x->msts_bit.fzc) && (wait_ack_index != FZC_TIMEOUT))
208 {
209 wait_ack_index++;
210 }
211
212 /* check acknowledge */
213 if(can_x->msts_bit.fzc)
214 {
215 /* set the time triggered communication mode */
216 can_x->mctrl_bit.ttcen = can_base_struct->ttc_enable;
217
218 /* set the automatic exit bus-off management */
219 can_x->mctrl_bit.aeboen = can_base_struct->aebo_enable;
220
221 /* set the automatic automatic exit doze mode */
222 can_x->mctrl_bit.aeden = can_base_struct->aed_enable;
223
224 /* set the prohibit retransmission when sending fails */
225 can_x->mctrl_bit.prsfen = can_base_struct->prsf_enable;
226
227 /* set the message discarding rule select when overflow */
228 can_x->mctrl_bit.mdrsel = can_base_struct->mdrsel_selection;
229
230 /* set the multiple message sending sequence rule */
231 can_x->mctrl_bit.mmssr = can_base_struct->mmssr_selection;
232
233 /* set the test mode */
234 can_x->btmg_bit.lben = can_base_struct->mode_selection & 0x01;
235 can_x->btmg_bit.loen = (can_base_struct->mode_selection >> 1) & 0x01;
236
237 /* request leave freeze mode */
238 can_x->mctrl_bit.fzen = FALSE;
239
240 /* wait the acknowledge */
241 wait_ack_index = 0;
242 while((can_x->msts_bit.fzc) && (wait_ack_index != FZC_TIMEOUT))
243 {
244 wait_ack_index++;
245 }
246
247 /* check acknowledged */
248 if(can_x->msts_bit.fzc)
249 {
250 init_status_index = ERROR;
251 }
252 else
253 {
254 init_status_index = SUCCESS ;
255 }
256 }
257 else
258 {
259 init_status_index = ERROR;
260 }
261
262 /* return the status of initialization */
263 return init_status_index;
264}
265
271void can_filter_default_para_init(can_filter_init_type* can_filter_init_struct)
272{
273 /* reset can filter init structure parameters values */
274
275 /* initialize the filter activate state */
276 can_filter_init_struct->filter_activate_enable = FALSE;
277
278 /* filter mode */
279 can_filter_init_struct->filter_mode = CAN_FILTER_MODE_ID_MASK;
280
281 /* filter relation fifo select */
282 can_filter_init_struct->filter_fifo = CAN_FILTER_FIFO0;
283
284 /* filter number select */
285 can_filter_init_struct->filter_number = 0;
286
287 /* initialize the filter bit width */
288 can_filter_init_struct->filter_bit = CAN_FILTER_16BIT;
289
290 /* initialize the filters filter data bit */
291 can_filter_init_struct->filter_id_high = 0;
292 can_filter_init_struct->filter_id_low = 0;
293 can_filter_init_struct->filter_mask_high = 0;
294 can_filter_init_struct->filter_mask_low = 0;
295}
296
306void can_filter_init(can_type* can_x, can_filter_init_type* can_filter_init_struct)
307{
308 uint32_t filter_number_bit_pos = 0;
309 filter_number_bit_pos = ((uint32_t)1) << can_filter_init_struct->filter_number;
310 /* set the filter turn into configuration condition */
311 can_x->fctrl_bit.fcs = TRUE;
312
313 /* filter activate disable */
314 can_x->facfg &= ~(uint32_t)filter_number_bit_pos;
315
316 /* filter bit width */
317 switch(can_filter_init_struct->filter_bit)
318 {
319 case CAN_FILTER_16BIT:
320 can_x->fbwcfg &= ~(uint32_t)filter_number_bit_pos;
321 /* first 16-bit identifier and first 16-bit mask or first 16-bit identifier and second 16-bit identifier */
322 can_x->ffb[can_filter_init_struct->filter_number].ffdb1 = ((0x0000FFFF & (uint32_t)can_filter_init_struct->filter_mask_low) << 16);
323 can_x->ffb[can_filter_init_struct->filter_number].ffdb1 |= (0x0000FFFF & (uint32_t)can_filter_init_struct->filter_id_low);
324
325 /* second 16-bit identifier and second 16-bit mask or third 16-bit identifier and fourth 16-bit identifier */
326 can_x->ffb[can_filter_init_struct->filter_number].ffdb2 = ((0x0000FFFF & (uint32_t)can_filter_init_struct->filter_mask_high) << 16);
327 can_x->ffb[can_filter_init_struct->filter_number].ffdb2 |= (0x0000FFFF & (uint32_t)can_filter_init_struct->filter_id_high);
328
329 break;
330 case CAN_FILTER_32BIT:
331 can_x->fbwcfg |= filter_number_bit_pos;
332 /* 32-bit identifier or first 32-bit identifier */
333 can_x->ffb[can_filter_init_struct->filter_number].ffdb1 = ((0x0000FFFF & (uint32_t)can_filter_init_struct->filter_id_high) << 16);
334 can_x->ffb[can_filter_init_struct->filter_number].ffdb1 |= (0x0000FFFF & (uint32_t)can_filter_init_struct->filter_id_low);
335
336 /* 32-bit mask or second 32-bit identifier */
337 can_x->ffb[can_filter_init_struct->filter_number].ffdb2 = ((0x0000FFFF & (uint32_t)can_filter_init_struct->filter_mask_high) << 16);
338 can_x->ffb[can_filter_init_struct->filter_number].ffdb2 |= (0x0000FFFF & (uint32_t)can_filter_init_struct->filter_mask_low);
339
340 break;
341 default:
342 break;
343 }
344
345 /* filter mode */
346 switch(can_filter_init_struct->filter_mode)
347 {
348 case CAN_FILTER_MODE_ID_MASK:
349 can_x->fmcfg &= ~(uint32_t)filter_number_bit_pos;
350 break;
351 case CAN_FILTER_MODE_ID_LIST:
352 can_x->fmcfg |= (uint32_t)filter_number_bit_pos;
353 break;
354 default:
355 break;
356 }
357
358 /* filter relation fifo select */
359 switch(can_filter_init_struct->filter_fifo)
360 {
361 case CAN_FILTER_FIFO0:
362 can_x->frf &= ~(uint32_t)filter_number_bit_pos;
363 break;
364 case CAN_FILTER_FIFO1:
365 can_x->frf |= (uint32_t)filter_number_bit_pos;
366 break;
367 default:
368 break;
369 }
370
371 /* filter activate enable */
372 switch(can_filter_init_struct->filter_activate_enable)
373 {
374 case TRUE:
375 can_x->facfg |= (uint32_t)filter_number_bit_pos;
376 break;
377 case FALSE:
378 can_x->facfg &= ~(uint32_t)filter_number_bit_pos;
379 break;
380 default:
381 break;
382 }
383
384 /* set the filter turn into working condition */
385 can_x->fctrl_bit.fcs = FALSE;
386}
387
397void can_debug_transmission_prohibit(can_type* can_x, confirm_state new_state)
398{
399 can_x->mctrl_bit.ptd = new_state;
400}
401
418void can_ttc_mode_enable(can_type* can_x, confirm_state new_state)
419{
420 /* config the ttc mode new_state */
421 can_x->mctrl_bit.ttcen = new_state;
422
423 /* config tmtsten bits new_state */
424 can_x->tx_mailbox[0].tmc_bit.tmtsten = new_state;
425 can_x->tx_mailbox[1].tmc_bit.tmtsten = new_state;
426 can_x->tx_mailbox[2].tmc_bit.tmtsten = new_state;
427}
428
442uint8_t can_message_transmit(can_type* can_x, can_tx_message_type* tx_message_struct)
443{
444 uint8_t transmit_mailbox = CAN_TX_STATUS_NO_EMPTY;
445
446 /* select one empty transmit mailbox */
447 if(can_x->tsts_bit.tm0ef)
448 {
449 transmit_mailbox = CAN_TX_MAILBOX0;
450 }
451 else if(can_x->tsts_bit.tm1ef)
452 {
453 transmit_mailbox = CAN_TX_MAILBOX1;
454 }
455 else if(can_x->tsts_bit.tm2ef)
456 {
457 transmit_mailbox = CAN_TX_MAILBOX2;
458 }
459 else
460 {
461 transmit_mailbox = CAN_TX_STATUS_NO_EMPTY;
462 }
463
464 if(transmit_mailbox != CAN_TX_STATUS_NO_EMPTY)
465 {
466 /* set up the id */
467 can_x->tx_mailbox[transmit_mailbox].tmi &= 0x00000001;
468 can_x->tx_mailbox[transmit_mailbox].tmi_bit.tmidsel = tx_message_struct->id_type;
469 switch(tx_message_struct->id_type)
470 {
471 case CAN_ID_STANDARD:
472 can_x->tx_mailbox[transmit_mailbox].tmi_bit.tmsid = tx_message_struct->standard_id;
473 break;
474 case CAN_ID_EXTENDED:
475 can_x->tx_mailbox[transmit_mailbox].tmi |= (tx_message_struct->extended_id << 3);
476 break;
477 default:
478 break;
479 }
480 can_x->tx_mailbox[transmit_mailbox].tmi_bit.tmfrsel = tx_message_struct->frame_type;
481 /* set up the dlc */
482 can_x->tx_mailbox[transmit_mailbox].tmc_bit.tmdtbl = (tx_message_struct->dlc & ((uint8_t)0x0F));
483
484 /* set up the data field */
485 can_x->tx_mailbox[transmit_mailbox].tmdtl = (((uint32_t)tx_message_struct->data[3] << 24) |
486 ((uint32_t)tx_message_struct->data[2] << 16) |
487 ((uint32_t)tx_message_struct->data[1] << 8) |
488 ((uint32_t)tx_message_struct->data[0]));
489 can_x->tx_mailbox[transmit_mailbox].tmdth = (((uint32_t)tx_message_struct->data[7] << 24) |
490 ((uint32_t)tx_message_struct->data[6] << 16) |
491 ((uint32_t)tx_message_struct->data[5] << 8) |
492 ((uint32_t)tx_message_struct->data[4]));
493
494 /* request transmission */
495 can_x->tx_mailbox[transmit_mailbox].tmi_bit.tmsr = TRUE;
496 }
497 return transmit_mailbox;
498}
499
516 can_transmit_status_type can_transmit_status_get(can_type* can_x, can_tx_mailbox_num_type transmit_mailbox)
517{
518 can_transmit_status_type state_index = CAN_TX_STATUS_FAILED;
519 switch(transmit_mailbox)
520 {
521 case CAN_TX_MAILBOX0:
522 if(can_x->tsts_bit.tm0tcf != RESET)
523 {
524 if(can_x->tsts_bit.tm0tsf != RESET)
525 {
526 state_index = CAN_TX_STATUS_SUCCESSFUL;
527 }
528 else
529 {
530 state_index = CAN_TX_STATUS_FAILED;
531 }
532 }
533 else
534 {
535 state_index = CAN_TX_STATUS_PENDING;
536 }
537 break;
538 case CAN_TX_MAILBOX1:
539 if(can_x->tsts_bit.tm1tcf != RESET)
540 {
541 if(can_x->tsts_bit.tm1tsf != RESET)
542 {
543 state_index = CAN_TX_STATUS_SUCCESSFUL;
544 }
545 else
546 {
547 state_index = CAN_TX_STATUS_FAILED;
548 }
549 }
550 else
551 {
552 state_index = CAN_TX_STATUS_PENDING;
553 }
554 break;
555 case CAN_TX_MAILBOX2:
556 if(can_x->tsts_bit.tm2tcf != RESET)
557 {
558 if(can_x->tsts_bit.tm2tsf != RESET)
559 {
560 state_index = CAN_TX_STATUS_SUCCESSFUL;
561 }
562 else
563 {
564 state_index = CAN_TX_STATUS_FAILED;
565 }
566 }
567 else
568 {
569 state_index = CAN_TX_STATUS_PENDING;
570 }
571 break;
572 default:
573 state_index = CAN_TX_STATUS_FAILED;
574 break;
575 }
576 return state_index;
577}
578
591void can_transmit_cancel(can_type* can_x, can_tx_mailbox_num_type transmit_mailbox)
592{
593 uint32_t transmit_cancel_bit = 0;
594 transmit_cancel_bit = can_x->tsts & (CAN_TSTS_TM0CT_VAL | CAN_TSTS_TM1CT_VAL | CAN_TSTS_TM2CT_VAL);
595 switch (transmit_mailbox)
596 {
597 case CAN_TX_MAILBOX0:
598 can_x->tsts = transmit_cancel_bit | CAN_TSTS_TM0CT_VAL;
599 break;
600 case CAN_TX_MAILBOX1:
601 can_x->tsts = transmit_cancel_bit | CAN_TSTS_TM1CT_VAL;
602 break;
603 case CAN_TX_MAILBOX2:
604 can_x->tsts = transmit_cancel_bit | CAN_TSTS_TM2CT_VAL;
605 break;
606 default:
607 break;
608 }
609}
610
623void can_message_receive(can_type* can_x, can_rx_fifo_num_type fifo_number, can_rx_message_type* rx_message_struct)
624{
625 /* get the id type */
626 rx_message_struct->id_type = (can_identifier_type)can_x->fifo_mailbox[fifo_number].rfi_bit.rfidi;
627 switch (rx_message_struct->id_type)
628 {
629 case CAN_ID_STANDARD:
630 rx_message_struct->standard_id = can_x->fifo_mailbox[fifo_number].rfi_bit.rfsid;
631 break;
632 case CAN_ID_EXTENDED:
633 rx_message_struct->extended_id = 0x1FFFFFFF & (can_x->fifo_mailbox[fifo_number].rfi >> 3);
634 break;
635 default:
636 break;
637 }
638 rx_message_struct->frame_type = (can_trans_frame_type)can_x->fifo_mailbox[fifo_number].rfi_bit.rffri;
639 /* get the dlc */
640 rx_message_struct->dlc = can_x->fifo_mailbox[fifo_number].rfc_bit.rfdtl;
641
642 /* get the filter match number */
643 rx_message_struct->filter_index = can_x->fifo_mailbox[fifo_number].rfc_bit.rffmn;
644
645 /* get the data field */
646 rx_message_struct->data[0] = can_x->fifo_mailbox[fifo_number].rfdtl_bit.rfdt0;
647 rx_message_struct->data[1] = can_x->fifo_mailbox[fifo_number].rfdtl_bit.rfdt1;
648 rx_message_struct->data[2] = can_x->fifo_mailbox[fifo_number].rfdtl_bit.rfdt2;
649 rx_message_struct->data[3] = can_x->fifo_mailbox[fifo_number].rfdtl_bit.rfdt3;
650 rx_message_struct->data[4] = can_x->fifo_mailbox[fifo_number].rfdth_bit.rfdt4;
651 rx_message_struct->data[5] = can_x->fifo_mailbox[fifo_number].rfdth_bit.rfdt5;
652 rx_message_struct->data[6] = can_x->fifo_mailbox[fifo_number].rfdth_bit.rfdt6;
653 rx_message_struct->data[7] = can_x->fifo_mailbox[fifo_number].rfdth_bit.rfdt7;
654
655 /* release the fifo */
656 can_receive_fifo_release(can_x, fifo_number);
657}
658
670void can_receive_fifo_release(can_type* can_x, can_rx_fifo_num_type fifo_number)
671{
672 switch (fifo_number)
673 {
674 case CAN_RX_FIFO0:
675 can_x->rf0 = CAN_RF0_RF0R_VAL;
676 break;
677 case CAN_RX_FIFO1:
678 can_x->rf1 = CAN_RF1_RF1R_VAL;
679 break;
680 default:
681 break;
682 }
683}
684
696uint8_t can_receive_message_pending_get(can_type* can_x, can_rx_fifo_num_type fifo_number)
697{
698 uint8_t message_pending = 0;
699 switch (fifo_number)
700 {
701 case CAN_RX_FIFO0:
702 message_pending = can_x->rf0_bit.rf0mn;
703 break;
704 case CAN_RX_FIFO1:
705 message_pending = can_x->rf1_bit.rf1mn;
706 break;
707 default:
708 break;
709 }
710 return message_pending;
711}
712
727 error_status can_operating_mode_set(can_type* can_x, can_operating_mode_type can_operating_mode)
728{
729 error_status status = ERROR;
730 uint32_t time_out_index = FZC_TIMEOUT;
731
732 if (can_operating_mode == CAN_OPERATINGMODE_FREEZE)
733 {
734 /* request enter freeze mode */
735 can_x->mctrl_bit.dzen = FALSE;
736 can_x->mctrl_bit.fzen = TRUE;
737
738 while(((can_x->msts_bit.dzc) || (!can_x->msts_bit.fzc)) && (time_out_index != 0))
739 {
740 time_out_index--;
741 }
742 if((can_x->msts_bit.dzc) || (!can_x->msts_bit.fzc))
743 {
744 status = ERROR;
745 }
746 else
747 {
748 status = SUCCESS;
749 }
750 }
751 else if(can_operating_mode == CAN_OPERATINGMODE_DOZE)
752 {
753 /* request enter doze mode */
754 can_x->mctrl_bit.dzen = TRUE;
755 can_x->mctrl_bit.fzen = FALSE;
756
757 while(((!can_x->msts_bit.dzc) || (can_x->msts_bit.fzc)) && (time_out_index != 0))
758 {
759 time_out_index--;
760 }
761 if((!can_x->msts_bit.dzc) || (can_x->msts_bit.fzc))
762 {
763 status = ERROR;
764 }
765 else
766 {
767 status = SUCCESS;
768 }
769 }
770 else if(can_operating_mode == CAN_OPERATINGMODE_COMMUNICATE)
771 {
772 /* request enter normal mode */
773 can_x->mctrl_bit.dzen = FALSE;
774 can_x->mctrl_bit.fzen = FALSE;
775
776 while(((can_x->msts_bit.dzc) || (can_x->msts_bit.fzc)) && (time_out_index != 0))
777 {
778 time_out_index--;
779 }
780 if((can_x->msts_bit.dzc) || (can_x->msts_bit.fzc))
781 {
782 status = ERROR;
783 }
784 else
785 {
786 status = SUCCESS;
787 }
788 }
789 else
790 {
791 status = ERROR;
792 }
793 return status;
794}
795
805 can_enter_doze_status_type can_doze_mode_enter(can_type* can_x)
806{
807 can_enter_doze_status_type status = CAN_ENTER_DOZE_FAILED;
808 uint32_t time_out_index = FZC_TIMEOUT;
809 can_x->mctrl_bit.fzen = FALSE;
810 can_x->mctrl_bit.dzen = TRUE;
811 while(((!can_x->msts_bit.dzc) || (can_x->msts_bit.fzc)) && (time_out_index != 0))
812 {
813 time_out_index--;
814 }
815 if((!can_x->msts_bit.dzc) || (can_x->msts_bit.fzc))
816 {
817 status = CAN_ENTER_DOZE_FAILED;
818 }
819 else
820 {
821 status = CAN_ENTER_DOZE_SUCCESSFUL;
822 }
823 return status;
824}
825
835 can_quit_doze_status_type can_doze_mode_exit(can_type* can_x)
836{
837 can_quit_doze_status_type status = CAN_QUIT_DOZE_FAILED;
838 uint32_t time_out_index = DZC_TIMEOUT;
839 can_x->mctrl_bit.dzen = FALSE;
840 while((can_x->msts_bit.dzc) && (time_out_index != 0))
841 {
842 time_out_index--;
843 }
844 if(!can_x->msts_bit.dzc)
845 {
846 status = CAN_QUIT_DOZE_SUCCESSFUL;
847 }
848 return status;
849}
850
867 can_error_record_type can_error_type_record_get(can_type* can_x)
868{
869 can_error_record_type error_code = CAN_ERRORRECORD_NOERR;
870
871 error_code = (can_error_record_type)can_x->ests_bit.etr;
872 return error_code;
873}
874
882uint8_t can_receive_error_counter_get(can_type* can_x)
883{
884 uint8_t counter = 0;
885 counter = can_x->ests_bit.rec;
886 return counter;
887}
888
896uint8_t can_transmit_error_counter_get(can_type* can_x)
897{
898 uint8_t counter = 0;
899 counter = can_x->ests_bit.tec;
900 return counter;
901}
902
928void can_interrupt_enable(can_type* can_x, uint32_t can_int, confirm_state new_state)
929{
930 if (new_state != FALSE)
931 {
932 can_x->inten |= can_int;
933 }
934 else
935 {
936 can_x->inten &= ~can_int;
937 }
938}
939
968 flag_status can_interrupt_flag_get(can_type* can_x, uint32_t can_flag)
969{
970 flag_status bit_status = RESET;
971 flag_status int_status = RESET;
972
973 switch(can_flag)
974 {
975 case CAN_EAF_FLAG:
976 int_status = (flag_status)(can_x->inten_bit.eoien && can_x->inten_bit.eaien);
977 break;
978 case CAN_EPF_FLAG:
979 int_status = (flag_status)(can_x->inten_bit.eoien && can_x->inten_bit.epien);
980 break;
981 case CAN_BOF_FLAG:
982 int_status = (flag_status)(can_x->inten_bit.eoien && can_x->inten_bit.boien);
983 break;
984 case CAN_ETR_FLAG:
985 int_status = (flag_status)(can_x->inten_bit.eoien && can_x->inten_bit.etrien);
986 break;
987 case CAN_EOIF_FLAG:
988 int_status = (flag_status)can_x->inten_bit.eoien;
989 break;
990 case CAN_TM0TCF_FLAG:
991 case CAN_TM1TCF_FLAG:
992 case CAN_TM2TCF_FLAG:
993 int_status = (flag_status)can_x->inten_bit.tcien;
994 break;
995 case CAN_RF0MN_FLAG:
996 int_status = (flag_status)can_x->inten_bit.rf0mien;
997 break;
998 case CAN_RF0FF_FLAG:
999 int_status = (flag_status)can_x->inten_bit.rf0fien;
1000 break;
1001 case CAN_RF0OF_FLAG:
1002 int_status = (flag_status)can_x->inten_bit.rf0oien;
1003 break;
1004 case CAN_RF1MN_FLAG:
1005 int_status = (flag_status)can_x->inten_bit.rf1mien;
1006 break;
1007 case CAN_RF1FF_FLAG:
1008 int_status = (flag_status)can_x->inten_bit.rf1fien;
1009 break;
1010 case CAN_RF1OF_FLAG:
1011 int_status = (flag_status)can_x->inten_bit.rf1oien;
1012 break;
1013 case CAN_QDZIF_FLAG:
1014 int_status = (flag_status)can_x->inten_bit.qdzien;
1015 break;
1016 case CAN_EDZC_FLAG:
1017 int_status = (flag_status)can_x->inten_bit.edzien;
1018 break;
1019 case CAN_TMEF_FLAG:
1020 int_status = (flag_status)can_x->inten_bit.tcien;
1021 break;
1022 default:
1023 int_status = RESET;
1024 break;
1025 }
1026
1027 if(int_status != SET)
1028 {
1029 return RESET;
1030 }
1031 bit_status = can_flag_get(can_x, can_flag);
1032
1033 return bit_status;
1034}
1035
1064 flag_status can_flag_get(can_type* can_x, uint32_t can_flag)
1065{
1066 flag_status bit_status = RESET;
1067 switch(can_flag)
1068 {
1069 case CAN_EAF_FLAG:
1070 bit_status = (flag_status)can_x->ests_bit.eaf;
1071 break;
1072 case CAN_EPF_FLAG:
1073 bit_status = (flag_status)can_x->ests_bit.epf;
1074 break;
1075 case CAN_BOF_FLAG:
1076 bit_status = (flag_status)can_x->ests_bit.bof;
1077 break;
1078 case CAN_ETR_FLAG:
1079 if(can_x->ests_bit.etr != 0)
1080 {
1081 bit_status = SET;
1082 }
1083 else
1084 {
1085 bit_status = RESET;
1086 }
1087 break;
1088 case CAN_EOIF_FLAG:
1089 bit_status = (flag_status)can_x->msts_bit.eoif;
1090 break;
1091 case CAN_TM0TCF_FLAG:
1092 bit_status = (flag_status)can_x->tsts_bit.tm0tcf;
1093 break;
1094 case CAN_TM1TCF_FLAG:
1095 bit_status = (flag_status)can_x->tsts_bit.tm1tcf;
1096 break;
1097 case CAN_TM2TCF_FLAG:
1098 bit_status = (flag_status)can_x->tsts_bit.tm2tcf;
1099 break;
1100 case CAN_RF0MN_FLAG:
1101 if(can_x->rf0_bit.rf0mn != 0)
1102 {
1103 bit_status = SET;
1104 }
1105 else
1106 {
1107 bit_status = RESET;
1108 }
1109 break;
1110 case CAN_RF0FF_FLAG:
1111 bit_status = (flag_status)can_x->rf0_bit.rf0ff;
1112 break;
1113 case CAN_RF0OF_FLAG:
1114 bit_status = (flag_status)can_x->rf0_bit.rf0of;
1115 break;
1116 case CAN_RF1MN_FLAG:
1117 if(can_x->rf1_bit.rf1mn != 0)
1118 {
1119 bit_status = SET;
1120 }
1121 else
1122 {
1123 bit_status = RESET;
1124 }
1125 break;
1126 case CAN_RF1FF_FLAG:
1127 bit_status = (flag_status)can_x->rf1_bit.rf1ff;
1128 break;
1129 case CAN_RF1OF_FLAG:
1130 bit_status = (flag_status)can_x->rf1_bit.rf1of;
1131 break;
1132 case CAN_QDZIF_FLAG:
1133 bit_status = (flag_status)can_x->msts_bit.qdzif;
1134 break;
1135 case CAN_EDZC_FLAG:
1136 if((can_x->msts_bit.dzc != RESET) ||(can_x->msts_bit.edzif != RESET))
1137 {
1138 bit_status = SET;
1139 }
1140 else
1141 {
1142 bit_status = RESET;
1143 }
1144 break;
1145 case CAN_TMEF_FLAG:
1146 if((can_x->tsts_bit.tm0ef != RESET) || (can_x->tsts_bit.tm1ef != RESET) || (can_x->tsts_bit.tm2ef != RESET))
1147 {
1148 bit_status = SET;
1149 }
1150 else
1151 {
1152 bit_status = RESET;
1153 }
1154 break;
1155 default:
1156 bit_status = RESET;
1157 break;
1158 }
1159 return bit_status;
1160}
1161
1188void can_flag_clear(can_type* can_x, uint32_t can_flag)
1189{
1190 switch(can_flag)
1191 {
1192 case CAN_EAF_FLAG:
1193 case CAN_EPF_FLAG:
1194 case CAN_BOF_FLAG:
1195 case CAN_EOIF_FLAG:
1196 can_x->msts = CAN_MSTS_EOIF_VAL;
1197 break;
1198 case CAN_ETR_FLAG:
1199 can_x->msts = CAN_MSTS_EOIF_VAL;
1200 can_x->ests = 0;
1201 break;
1202 case CAN_TM0TCF_FLAG:
1203 can_x->tsts = CAN_TSTS_TM0TCF_VAL;
1204 break;
1205 case CAN_TM1TCF_FLAG:
1206 can_x->tsts = CAN_TSTS_TM1TCF_VAL;
1207 break;
1208 case CAN_TM2TCF_FLAG:
1209 can_x->tsts = CAN_TSTS_TM2TCF_VAL;
1210 break;
1211 case CAN_RF0FF_FLAG:
1212 can_x->rf0 = CAN_RF0_RF0FF_VAL;
1213 break;
1214 case CAN_RF0OF_FLAG:
1215 can_x->rf0 = CAN_RF0_RF0OF_VAL;
1216 break;
1217 case CAN_RF1FF_FLAG:
1218 can_x->rf1 = CAN_RF1_RF1FF_VAL;
1219 break;
1220 case CAN_RF1OF_FLAG:
1221 can_x->rf1 = CAN_RF1_RF1OF_VAL;
1222 break;
1223 case CAN_QDZIF_FLAG:
1224 can_x->msts = CAN_MSTS_QDZIF_VAL;
1225 break;
1226 case CAN_EDZC_FLAG:
1227 can_x->msts = CAN_MSTS_EDZIF_VAL;
1228 break;
1229 case CAN_TMEF_FLAG:
1230 can_x->tsts = CAN_TSTS_TM0TCF_VAL | CAN_TSTS_TM1TCF_VAL | CAN_TSTS_TM2TCF_VAL;
1231 break;
1232 default:
1233 break;
1234 }
1235}
1236
1241#endif
1242
counter
uint16_t counter
Definition project/at_start_f413/examples/debug/tmr1/src/main.c:39
can_transmit_status_type
can_transmit_status_type
can transmit status
Definition at32f413_can.h:270
can_quit_doze_status_type
can_quit_doze_status_type
can quit doze mode status
Definition at32f413_can.h:290
can_trans_frame_type
can_trans_frame_type
can transmission frame type
Definition at32f413_can.h:242
can_error_record_type
can_error_record_type
can error type record
Definition at32f413_can.h:317
can_operating_mode_type
can_operating_mode_type
can operating mode
Definition at32f413_can.h:174
can_tx_mailbox_num_type
can_tx_mailbox_num_type
can tx mailboxes
Definition at32f413_can.h:251
can_enter_doze_status_type
can_enter_doze_status_type
can enter doze mode status
Definition at32f413_can.h:281
can_rx_fifo_num_type
can_rx_fifo_num_type
can receive fifo
Definition at32f413_can.h:261
can_identifier_type
can_identifier_type
can identifier type
Definition at32f413_can.h:233
CAN_FILTER_FIFO0
@ CAN_FILTER_FIFO0
Definition at32f413_can.h:137
CAN_FILTER_FIFO1
@ CAN_FILTER_FIFO1
Definition at32f413_can.h:138
CAN_TX_STATUS_SUCCESSFUL
@ CAN_TX_STATUS_SUCCESSFUL
Definition at32f413_can.h:272
CAN_TX_STATUS_PENDING
@ CAN_TX_STATUS_PENDING
Definition at32f413_can.h:273
CAN_TX_STATUS_NO_EMPTY
@ CAN_TX_STATUS_NO_EMPTY
Definition at32f413_can.h:274
CAN_TX_STATUS_FAILED
@ CAN_TX_STATUS_FAILED
Definition at32f413_can.h:271
CAN_DISCARDING_FIRST_RECEIVED
@ CAN_DISCARDING_FIRST_RECEIVED
Definition at32f413_can.h:300
CAN_BTS2_3TQ
@ CAN_BTS2_3TQ
Definition at32f413_can.h:221
CAN_QUIT_DOZE_FAILED
@ CAN_QUIT_DOZE_FAILED
Definition at32f413_can.h:291
CAN_QUIT_DOZE_SUCCESSFUL
@ CAN_QUIT_DOZE_SUCCESSFUL
Definition at32f413_can.h:292
CAN_BTS1_4TQ
@ CAN_BTS1_4TQ
Definition at32f413_can.h:199
CAN_ERRORRECORD_NOERR
@ CAN_ERRORRECORD_NOERR
Definition at32f413_can.h:318
CAN_FILTER_MODE_ID_LIST
@ CAN_FILTER_MODE_ID_LIST
Definition at32f413_can.h:147
CAN_FILTER_MODE_ID_MASK
@ CAN_FILTER_MODE_ID_MASK
Definition at32f413_can.h:146
CAN_OPERATINGMODE_FREEZE
@ CAN_OPERATINGMODE_FREEZE
Definition at32f413_can.h:175
CAN_OPERATINGMODE_COMMUNICATE
@ CAN_OPERATINGMODE_COMMUNICATE
Definition at32f413_can.h:177
CAN_OPERATINGMODE_DOZE
@ CAN_OPERATINGMODE_DOZE
Definition at32f413_can.h:176
CAN_SENDING_BY_ID
@ CAN_SENDING_BY_ID
Definition at32f413_can.h:309
CAN_TX_MAILBOX2
@ CAN_TX_MAILBOX2
Definition at32f413_can.h:254
CAN_TX_MAILBOX0
@ CAN_TX_MAILBOX0
Definition at32f413_can.h:252
CAN_TX_MAILBOX1
@ CAN_TX_MAILBOX1
Definition at32f413_can.h:253
CAN_FILTER_16BIT
@ CAN_FILTER_16BIT
Definition at32f413_can.h:155
CAN_FILTER_32BIT
@ CAN_FILTER_32BIT
Definition at32f413_can.h:156
CAN_ENTER_DOZE_FAILED
@ CAN_ENTER_DOZE_FAILED
Definition at32f413_can.h:282
CAN_ENTER_DOZE_SUCCESSFUL
@ CAN_ENTER_DOZE_SUCCESSFUL
Definition at32f413_can.h:283
CAN_RX_FIFO0
@ CAN_RX_FIFO0
Definition at32f413_can.h:262
CAN_RX_FIFO1
@ CAN_RX_FIFO1
Definition at32f413_can.h:263
CAN_ID_STANDARD
@ CAN_ID_STANDARD
Definition at32f413_can.h:234
CAN_ID_EXTENDED
@ CAN_ID_EXTENDED
Definition at32f413_can.h:235
CAN_MODE_COMMUNICATE
@ CAN_MODE_COMMUNICATE
Definition at32f413_can.h:164
CAN_RSAW_2TQ
@ CAN_RSAW_2TQ
Definition at32f413_can.h:186
CAN_EDZC_FLAG
#define CAN_EDZC_FLAG
Definition at32f413_can.h:78
CAN_TM1TCF_FLAG
#define CAN_TM1TCF_FLAG
Definition at32f413_can.h:69
CAN_QDZIF_FLAG
#define CAN_QDZIF_FLAG
Definition at32f413_can.h:77
CAN_TM0TCF_FLAG
#define CAN_TM0TCF_FLAG
Definition at32f413_can.h:68
CAN_RF1FF_FLAG
#define CAN_RF1FF_FLAG
Definition at32f413_can.h:75
CAN_RF0FF_FLAG
#define CAN_RF0FF_FLAG
Definition at32f413_can.h:72
CAN_RF1MN_FLAG
#define CAN_RF1MN_FLAG
Definition at32f413_can.h:74
CAN_EPF_FLAG
#define CAN_EPF_FLAG
Definition at32f413_can.h:64
CAN_RF1OF_FLAG
#define CAN_RF1OF_FLAG
Definition at32f413_can.h:76
CAN_EAF_FLAG
#define CAN_EAF_FLAG
Definition at32f413_can.h:63
CAN_RF0MN_FLAG
#define CAN_RF0MN_FLAG
Definition at32f413_can.h:71
CAN_TM2TCF_FLAG
#define CAN_TM2TCF_FLAG
Definition at32f413_can.h:70
CAN_ETR_FLAG
#define CAN_ETR_FLAG
Definition at32f413_can.h:66
CAN_RF0OF_FLAG
#define CAN_RF0OF_FLAG
Definition at32f413_can.h:73
CAN_EOIF_FLAG
#define CAN_EOIF_FLAG
Definition at32f413_can.h:67
CAN_TMEF_FLAG
#define CAN_TMEF_FLAG
Definition at32f413_can.h:79
CAN_BOF_FLAG
#define CAN_BOF_FLAG
Definition at32f413_can.h:65
can_base_init
error_status can_base_init(can_type *can_x, can_base_type *can_base_struct)
initialize the can peripheral according to the specified parameters in the can_init_struct.
Definition at32f413_can.c:196
can_reset
void can_reset(can_type *can_x)
deinitialize the can peripheral registers to their default reset values.
Definition at32f413_can.c:50
can_interrupt_flag_get
flag_status can_interrupt_flag_get(can_type *can_x, uint32_t can_flag)
get interrupt flag of the specified can peripheral.
Definition at32f413_can.c:968
can_transmit_error_counter_get
uint8_t can_transmit_error_counter_get(can_type *can_x)
return the transmit error counter of the specified can peripheral.
Definition at32f413_can.c:896
can_transmit_status_get
can_transmit_status_type can_transmit_status_get(can_type *can_x, can_tx_mailbox_num_type transmit_mailbox)
check the transmission state of the specified can peripheral.
Definition at32f413_can.c:516
can_ttc_mode_enable
void can_ttc_mode_enable(can_type *can_x, confirm_state new_state)
enable or disable time trigger operation communication mode of the specified can peripheral.
Definition at32f413_can.c:418
can_filter_default_para_init
void can_filter_default_para_init(can_filter_init_type *can_filter_init_struct)
fill each can_filter_init_struct member with its default value.
Definition at32f413_can.c:271
can_receive_fifo_release
void can_receive_fifo_release(can_type *can_x, can_rx_fifo_num_type fifo_number)
release the specified fifo of the specified can peripheral.
Definition at32f413_can.c:670
can_receive_error_counter_get
uint8_t can_receive_error_counter_get(can_type *can_x)
return the receive error counter (rec) of the specified can peripheral.
Definition at32f413_can.c:882
can_operating_mode_set
error_status can_operating_mode_set(can_type *can_x, can_operating_mode_type can_operating_mode)
set the operation mode of the specified can peripheral.
Definition at32f413_can.c:727
can_baudrate_default_para_init
void can_baudrate_default_para_init(can_baudrate_type *can_baudrate_struct)
fill each can_baudrate_struct member with its default value.
Definition at32f413_can.c:72
can_transmit_cancel
void can_transmit_cancel(can_type *can_x, can_tx_mailbox_num_type transmit_mailbox)
cancel a transmit request of the specified can peripheral.
Definition at32f413_can.c:591
can_receive_message_pending_get
uint8_t can_receive_message_pending_get(can_type *can_x, can_rx_fifo_num_type fifo_number)
return the number of pending messages of the specified can peripheral.
Definition at32f413_can.c:696
can_message_transmit
uint8_t can_message_transmit(can_type *can_x, can_tx_message_type *tx_message_struct)
fill the transmission message and transmit of the specified can peripheral.
Definition at32f413_can.c:442
can_message_receive
void can_message_receive(can_type *can_x, can_rx_fifo_num_type fifo_number, can_rx_message_type *rx_message_struct)
receive message of the specified can peripheral.
Definition at32f413_can.c:623
can_interrupt_enable
void can_interrupt_enable(can_type *can_x, uint32_t can_int, confirm_state new_state)
enable or disable the interrupt of the specified can peripheral.
Definition at32f413_can.c:928
can_flag_get
flag_status can_flag_get(can_type *can_x, uint32_t can_flag)
get flag of the specified can peripheral.
Definition at32f413_can.c:1064
can_flag_clear
void can_flag_clear(can_type *can_x, uint32_t can_flag)
clear flag of the specified can peripheral.
Definition at32f413_can.c:1188
can_baudrate_set
error_status can_baudrate_set(can_type *can_x, can_baudrate_type *can_baudrate_struct)
set the baudrate of the can peripheral
Definition at32f413_can.c:101
can_debug_transmission_prohibit
void can_debug_transmission_prohibit(can_type *can_x, confirm_state new_state)
enable or disable the debug transmission prohibit of the specified can peripheral.
Definition at32f413_can.c:397
can_error_type_record_get
can_error_record_type can_error_type_record_get(can_type *can_x)
return the error type record (etr) of the specified can peripheral.
Definition at32f413_can.c:867
can_filter_init
void can_filter_init(can_type *can_x, can_filter_init_type *can_filter_init_struct)
initialize the can peripheral according to the specified parameters in the can_filter_init_struct.
Definition at32f413_can.c:306
can_default_para_init
void can_default_para_init(can_base_type *can_base_struct)
fill each can_init_struct member with its default value.
Definition at32f413_can.c:159
can_doze_mode_exit
can_quit_doze_status_type can_doze_mode_exit(can_type *can_x)
exit the doze mode of the specified can peripheral.
Definition at32f413_can.c:835
can_doze_mode_enter
can_enter_doze_status_type can_doze_mode_enter(can_type *can_x)
enter the low power mode of the specified can peripheral.
Definition at32f413_can.c:805
DZC_TIMEOUT
#define DZC_TIMEOUT
Definition at32f413_can.h:52
FZC_TIMEOUT
#define FZC_TIMEOUT
Definition at32f413_can.h:51
CAN_RF1_RF1FF_VAL
#define CAN_RF1_RF1FF_VAL
Definition at32f413_can.h:124
CAN_RF0_RF0FF_VAL
#define CAN_RF0_RF0FF_VAL
Definition at32f413_can.h:121
CAN_TSTS_TM0TCF_VAL
#define CAN_TSTS_TM0TCF_VAL
Definition at32f413_can.h:115
CAN_TSTS_TM2CT_VAL
#define CAN_TSTS_TM2CT_VAL
Definition at32f413_can.h:120
CAN_RF1_RF1R_VAL
#define CAN_RF1_RF1R_VAL
Definition at32f413_can.h:126
CAN1
#define CAN1
Definition at32f413_can.h:937
CAN_MSTS_EOIF_VAL
#define CAN_MSTS_EOIF_VAL
can flag clear operation macro definition val
Definition at32f413_can.h:112
CAN_MSTS_QDZIF_VAL
#define CAN_MSTS_QDZIF_VAL
Definition at32f413_can.h:113
CAN_TSTS_TM2TCF_VAL
#define CAN_TSTS_TM2TCF_VAL
Definition at32f413_can.h:117
CAN_RF0_RF0OF_VAL
#define CAN_RF0_RF0OF_VAL
Definition at32f413_can.h:122
CAN_RF0_RF0R_VAL
#define CAN_RF0_RF0R_VAL
Definition at32f413_can.h:123
CAN_RF1_RF1OF_VAL
#define CAN_RF1_RF1OF_VAL
Definition at32f413_can.h:125
CAN_TSTS_TM1TCF_VAL
#define CAN_TSTS_TM1TCF_VAL
Definition at32f413_can.h:116
CAN_TSTS_TM0CT_VAL
#define CAN_TSTS_TM0CT_VAL
Definition at32f413_can.h:118
CAN_TSTS_TM1CT_VAL
#define CAN_TSTS_TM1CT_VAL
Definition at32f413_can.h:119
CAN_MSTS_EDZIF_VAL
#define CAN_MSTS_EDZIF_VAL
Definition at32f413_can.h:114
crm_periph_reset
void crm_periph_reset(crm_periph_reset_type value, confirm_state new_state)
enable or disable the peripheral reset
Definition at32f413_crm.c:293
CRM_CAN1_PERIPH_RESET
@ CRM_CAN1_PERIPH_RESET
Definition at32f413_crm.h:182
CRM_CAN2_PERIPH_RESET
@ CRM_CAN2_PERIPH_RESET
Definition at32f413_crm.h:185
error_status
error_status
error status
Definition at32f413.h:302
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
flag_status
flag_status
flag status
Definition at32f413.h:292
ERROR
@ ERROR
Definition at32f413.h:302
SUCCESS
@ SUCCESS
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
SET
@ SET
Definition at32f413.h:292
at32f413_conf.h
at32f413 config header file
can_base_type
can init structure definition
Definition at32f413_can.h:332
can_base_type::prsf_enable
confirm_state prsf_enable
Definition at32f413_can.h:341
can_base_type::mdrsel_selection
can_msg_discarding_rule_type mdrsel_selection
Definition at32f413_can.h:343
can_base_type::aed_enable
confirm_state aed_enable
Definition at32f413_can.h:339
can_base_type::mmssr_selection
can_msg_sending_rule_type mmssr_selection
Definition at32f413_can.h:345
can_base_type::ttc_enable
confirm_state ttc_enable
Definition at32f413_can.h:335
can_base_type::mode_selection
can_mode_type mode_selection
Definition at32f413_can.h:333
can_base_type::aebo_enable
confirm_state aebo_enable
Definition at32f413_can.h:337
can_baudrate_type
can baudrate structure definition
Definition at32f413_can.h:353
can_baudrate_type::baudrate_div
uint16_t baudrate_div
Definition at32f413_can.h:354
can_baudrate_type::rsaw_size
can_rsaw_type rsaw_size
Definition at32f413_can.h:356
can_baudrate_type::bts2_size
can_bts2_type bts2_size
Definition at32f413_can.h:360
can_baudrate_type::bts1_size
can_bts1_type bts1_size
Definition at32f413_can.h:358
can_fifo_mailbox_type::rfdt4
__IO uint32_t rfdt4
Definition at32f413_can.h:565
can_fifo_mailbox_type::rfi
__IO uint32_t rfi
Definition at32f413_can.h:516
can_fifo_mailbox_type::rfdt0
__IO uint32_t rfdt0
Definition at32f413_can.h:550
can_fifo_mailbox_type::rfsid
__IO uint32_t rfsid
Definition at32f413_can.h:523
can_fifo_mailbox_type::rfdt2
__IO uint32_t rfdt2
Definition at32f413_can.h:552
can_fifo_mailbox_type::rfdtl
__IO uint32_t rfdtl
Definition at32f413_can.h:535
can_fifo_mailbox_type::rfidi
__IO uint32_t rfidi
Definition at32f413_can.h:521
can_fifo_mailbox_type::rfdt1
__IO uint32_t rfdt1
Definition at32f413_can.h:551
can_fifo_mailbox_type::rfc_bit
struct can_fifo_mailbox_type::@227::@234 rfc_bit
can_fifo_mailbox_type::rfdt6
__IO uint32_t rfdt6
Definition at32f413_can.h:567
can_fifo_mailbox_type::rffri
__IO uint32_t rffri
Definition at32f413_can.h:520
can_fifo_mailbox_type::rfdtl_bit
struct can_fifo_mailbox_type::@229::@235 rfdtl_bit
can_fifo_mailbox_type::rfdt3
__IO uint32_t rfdt3
Definition at32f413_can.h:553
can_fifo_mailbox_type::rfi_bit
struct can_fifo_mailbox_type::@225::@233 rfi_bit
can_fifo_mailbox_type::rfdt5
__IO uint32_t rfdt5
Definition at32f413_can.h:566
can_fifo_mailbox_type::rfdt7
__IO uint32_t rfdt7
Definition at32f413_can.h:568
can_fifo_mailbox_type::rffmn
__IO uint32_t rffmn
Definition at32f413_can.h:537
can_fifo_mailbox_type::rfdth_bit
struct can_fifo_mailbox_type::@231::@236 rfdth_bit
can_filter_init_type
can filter init structure definition
Definition at32f413_can.h:368
can_filter_init_type::filter_mask_low
uint16_t filter_mask_low
Definition at32f413_can.h:388
can_filter_init_type::filter_number
uint8_t filter_number
Definition at32f413_can.h:375
can_filter_init_type::filter_fifo
can_filter_fifo_type filter_fifo
Definition at32f413_can.h:373
can_filter_init_type::filter_bit
can_filter_bit_width_type filter_bit
Definition at32f413_can.h:377
can_filter_init_type::filter_mode
can_filter_mode_type filter_mode
Definition at32f413_can.h:371
can_filter_init_type::filter_activate_enable
confirm_state filter_activate_enable
Definition at32f413_can.h:369
can_filter_init_type::filter_mask_high
uint16_t filter_mask_high
Definition at32f413_can.h:385
can_filter_init_type::filter_id_high
uint16_t filter_id_high
Definition at32f413_can.h:379
can_filter_init_type::filter_id_low
uint16_t filter_id_low
Definition at32f413_can.h:382
can_filter_register_type::ffdb1
__IO uint32_t ffdb1
Definition at32f413_can.h:578
can_filter_register_type::ffdb2
__IO uint32_t ffdb2
Definition at32f413_can.h:579
can_rx_message_type
can rx message structure definition
Definition at32f413_can.h:418
can_rx_message_type::standard_id
uint32_t standard_id
Definition at32f413_can.h:419
can_rx_message_type::id_type
can_identifier_type id_type
Definition at32f413_can.h:425
can_rx_message_type::frame_type
can_trans_frame_type frame_type
Definition at32f413_can.h:427
can_rx_message_type::data
uint8_t data[8]
Definition at32f413_can.h:432
can_rx_message_type::dlc
uint8_t dlc
Definition at32f413_can.h:429
can_rx_message_type::extended_id
uint32_t extended_id
Definition at32f413_can.h:422
can_rx_message_type::filter_index
uint8_t filter_index
Definition at32f413_can.h:434
can_tx_mailbox_type::tmtsten
__IO uint32_t tmtsten
Definition at32f413_can.h:469
can_tx_mailbox_type::tmi
__IO uint32_t tmi
Definition at32f413_can.h:448
can_tx_mailbox_type::tmsr
__IO uint32_t tmsr
Definition at32f413_can.h:451
can_tx_mailbox_type::tmdtl
__IO uint32_t tmdtl
Definition at32f413_can.h:480
can_tx_mailbox_type::tmdtbl
__IO uint32_t tmdtbl
Definition at32f413_can.h:467
can_tx_mailbox_type::tmfrsel
__IO uint32_t tmfrsel
Definition at32f413_can.h:452
can_tx_mailbox_type::tmsid
__IO uint32_t tmsid
Definition at32f413_can.h:455
can_tx_mailbox_type::tmi_bit
struct can_tx_mailbox_type::@213::@221 tmi_bit
can_tx_mailbox_type::tmc_bit
struct can_tx_mailbox_type::@215::@222 tmc_bit
can_tx_mailbox_type::tmdth
__IO uint32_t tmdth
Definition at32f413_can.h:495
can_tx_mailbox_type::tmidsel
__IO uint32_t tmidsel
Definition at32f413_can.h:453
can_tx_message_type
can tx message structure definition
Definition at32f413_can.h:396
can_tx_message_type::extended_id
uint32_t extended_id
Definition at32f413_can.h:400
can_tx_message_type::frame_type
can_trans_frame_type frame_type
Definition at32f413_can.h:405
can_tx_message_type::data
uint8_t data[8]
Definition at32f413_can.h:410
can_tx_message_type::dlc
uint8_t dlc
Definition at32f413_can.h:407
can_tx_message_type::id_type
can_identifier_type id_type
Definition at32f413_can.h:403
can_tx_message_type::standard_id
uint32_t standard_id
Definition at32f413_can.h:397
can_type
type define can register all
Definition at32f413_can.h:586
can_type::rf0of
__IO uint32_t rf0of
Definition at32f413_can.h:680
can_type::tm2ef
__IO uint32_t tm2ef
Definition at32f413_can.h:662
can_type::etrien
__IO uint32_t etrien
Definition at32f413_can.h:722
can_type::boien
__IO uint32_t boien
Definition at32f413_can.h:721
can_type::eoien
__IO uint32_t eoien
Definition at32f413_can.h:724
can_type::eaf
__IO uint32_t eaf
Definition at32f413_can.h:739
can_type::rf1
__IO uint32_t rf1
Definition at32f413_can.h:691
can_type::tm0tsf
__IO uint32_t tm0tsf
Definition at32f413_can.h:642
can_type::aeden
__IO uint32_t aeden
Definition at32f413_can.h:601
can_type::dzc
__IO uint32_t dzc
Definition at32f413_can.h:620
can_type::mctrl_bit
struct can_type::@237::@263 mctrl_bit
can_type::tm0tcf
__IO uint32_t tm0tcf
Definition at32f413_can.h:641
can_type::eaien
__IO uint32_t eaien
Definition at32f413_can.h:719
can_type::fctrl_bit
struct can_type::@253::@271 fctrl_bit
can_type::inten_bit
struct can_type::@247::@268 inten_bit
can_type::edzif
__IO uint32_t edzif
Definition at32f413_can.h:623
can_type::mdrsel
__IO uint32_t mdrsel
Definition at32f413_can.h:599
can_type::rf0fien
__IO uint32_t rf0fien
Definition at32f413_can.h:713
can_type::rf1ff
__IO uint32_t rf1ff
Definition at32f413_can.h:696
can_type::bof
__IO uint32_t bof
Definition at32f413_can.h:741
can_type::tec
__IO uint32_t tec
Definition at32f413_can.h:745
can_type::ttcen
__IO uint32_t ttcen
Definition at32f413_can.h:603
can_type::tx_mailbox
can_tx_mailbox_type tx_mailbox[3]
can controller area network tx mailbox register, offset:0x180~0x1AC
Definition at32f413_can.h:778
can_type::tm1tcf
__IO uint32_t tm1tcf
Definition at32f413_can.h:647
can_type::lben
__IO uint32_t lben
Definition at32f413_can.h:765
can_type::ptd
__IO uint32_t ptd
Definition at32f413_can.h:606
can_type::fzc
__IO uint32_t fzc
Definition at32f413_can.h:619
can_type::epien
__IO uint32_t epien
Definition at32f413_can.h:720
can_type::rf1oien
__IO uint32_t rf1oien
Definition at32f413_can.h:717
can_type::rf0oien
__IO uint32_t rf0oien
Definition at32f413_can.h:714
can_type::ffb
can_filter_register_type ffb[14]
can ffb register, offset:0x240~0x2AC
Definition at32f413_can.h:930
can_type::tm0ef
__IO uint32_t tm0ef
Definition at32f413_can.h:660
can_type::bts2
__IO uint32_t bts2
Definition at32f413_can.h:761
can_type::loen
__IO uint32_t loen
Definition at32f413_can.h:766
can_type::ests
__IO uint32_t ests
Definition at32f413_can.h:736
can_type::ests_bit
struct can_type::@249::@269 ests_bit
can_type::rf0_bit
struct can_type::@243::@266 rf0_bit
can_type::frf
__IO uint32_t frf
Definition at32f413_can.h:870
can_type::qdzien
__IO uint32_t qdzien
Definition at32f413_can.h:725
can_type::rsaw
__IO uint32_t rsaw
Definition at32f413_can.h:763
can_type::rf0
__IO uint32_t rf0
Definition at32f413_can.h:674
can_type::rf1mien
__IO uint32_t rf1mien
Definition at32f413_can.h:715
can_type::rf0mien
__IO uint32_t rf0mien
Definition at32f413_can.h:712
can_type::tsts_bit
struct can_type::@241::@265 tsts_bit
can_type::rf1mn
__IO uint32_t rf1mn
Definition at32f413_can.h:694
can_type::edzien
__IO uint32_t edzien
Definition at32f413_can.h:726
can_type::prsfen
__IO uint32_t prsfen
Definition at32f413_can.h:600
can_type::btmg_bit
struct can_type::@251::@270 btmg_bit
can_type::facfg
__IO uint32_t facfg
Definition at32f413_can.h:901
can_type::tm1ef
__IO uint32_t tm1ef
Definition at32f413_can.h:661
can_type::aeboen
__IO uint32_t aeboen
Definition at32f413_can.h:602
can_type::eoif
__IO uint32_t eoif
Definition at32f413_can.h:621
can_type::tm2tcf
__IO uint32_t tm2tcf
Definition at32f413_can.h:653
can_type::rf1_bit
struct can_type::@245::@267 rf1_bit
can_type::brdiv
__IO uint32_t brdiv
Definition at32f413_can.h:758
can_type::epf
__IO uint32_t epf
Definition at32f413_can.h:740
can_type::dzen
__IO uint32_t dzen
Definition at32f413_can.h:597
can_type::etr
__IO uint32_t etr
Definition at32f413_can.h:743
can_type::fifo_mailbox
can_fifo_mailbox_type fifo_mailbox[2]
can controller area network fifo mailbox register, offset:0x1B0~0x1CC
Definition at32f413_can.h:783
can_type::tsts
__IO uint32_t tsts
Definition at32f413_can.h:638
can_type::fbwcfg
__IO uint32_t fbwcfg
Definition at32f413_can.h:839
can_type::qdzif
__IO uint32_t qdzif
Definition at32f413_can.h:622
can_type::tcien
__IO uint32_t tcien
Definition at32f413_can.h:711
can_type::msts_bit
struct can_type::@239::@264 msts_bit
can_type::rf0mn
__IO uint32_t rf0mn
Definition at32f413_can.h:677
can_type::rf0ff
__IO uint32_t rf0ff
Definition at32f413_can.h:679
can_type::fcs
__IO uint32_t fcs
Definition at32f413_can.h:798
can_type::msts
__IO uint32_t msts
Definition at32f413_can.h:616
can_type::rec
__IO uint32_t rec
Definition at32f413_can.h:746
can_type::bts1
__IO uint32_t bts1
Definition at32f413_can.h:760
can_type::tm2tsf
__IO uint32_t tm2tsf
Definition at32f413_can.h:654
can_type::rf1fien
__IO uint32_t rf1fien
Definition at32f413_can.h:716
can_type::rf1of
__IO uint32_t rf1of
Definition at32f413_can.h:697
can_type::fzen
__IO uint32_t fzen
Definition at32f413_can.h:596
can_type::mmssr
__IO uint32_t mmssr
Definition at32f413_can.h:598
can_type::inten
__IO uint32_t inten
Definition at32f413_can.h:708
can_type::fmcfg
__IO uint32_t fmcfg
Definition at32f413_can.h:808
can_type::tm1tsf
__IO uint32_t tm1tsf
Definition at32f413_can.h:648


AT32F413 Firmwary Library: at32f413_can.h Source File

  • libraries
  • drivers
  • inc
at32f413_can.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CAN_H
28#define __AT32F413_CAN_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34
35/* includes ------------------------------------------------------------------*/
36#include "at32f413.h"
37
51#define FZC_TIMEOUT ((uint32_t)0x0000FFFF)
52#define DZC_TIMEOUT ((uint32_t)0x0000FFFF)
63#define CAN_EAF_FLAG ((uint32_t)0x01)
64#define CAN_EPF_FLAG ((uint32_t)0x02)
65#define CAN_BOF_FLAG ((uint32_t)0x03)
66#define CAN_ETR_FLAG ((uint32_t)0x04)
67#define CAN_EOIF_FLAG ((uint32_t)0x05)
68#define CAN_TM0TCF_FLAG ((uint32_t)0x06)
69#define CAN_TM1TCF_FLAG ((uint32_t)0x07)
70#define CAN_TM2TCF_FLAG ((uint32_t)0x08)
71#define CAN_RF0MN_FLAG ((uint32_t)0x09)
72#define CAN_RF0FF_FLAG ((uint32_t)0x0A)
73#define CAN_RF0OF_FLAG ((uint32_t)0x0B)
74#define CAN_RF1MN_FLAG ((uint32_t)0x0C)
75#define CAN_RF1FF_FLAG ((uint32_t)0x0D)
76#define CAN_RF1OF_FLAG ((uint32_t)0x0E)
77#define CAN_QDZIF_FLAG ((uint32_t)0x0F)
78#define CAN_EDZC_FLAG ((uint32_t)0x10)
79#define CAN_TMEF_FLAG ((uint32_t)0x11)
90#define CAN_TCIEN_INT ((uint32_t)0x00000001)
91#define CAN_RF0MIEN_INT ((uint32_t)0x00000002)
92#define CAN_RF0FIEN_INT ((uint32_t)0x00000004)
93#define CAN_RF0OIEN_INT ((uint32_t)0x00000008)
94#define CAN_RF1MIEN_INT ((uint32_t)0x00000010)
95#define CAN_RF1FIEN_INT ((uint32_t)0x00000020)
96#define CAN_RF1OIEN_INT ((uint32_t)0x00000040)
97#define CAN_EAIEN_INT ((uint32_t)0x00000100)
98#define CAN_EPIEN_INT ((uint32_t)0x00000200)
99#define CAN_BOIEN_INT ((uint32_t)0x00000400)
100#define CAN_ETRIEN_INT ((uint32_t)0x00000800)
101#define CAN_EOIEN_INT ((uint32_t)0x00008000)
102#define CAN_QDZIEN_INT ((uint32_t)0x00010000)
103#define CAN_EDZIEN_INT ((uint32_t)0x00020000)
112#define CAN_MSTS_EOIF_VAL ((uint32_t)0x00000004)
113#define CAN_MSTS_QDZIF_VAL ((uint32_t)0x00000008)
114#define CAN_MSTS_EDZIF_VAL ((uint32_t)0x00000010)
115#define CAN_TSTS_TM0TCF_VAL ((uint32_t)0x00000001)
116#define CAN_TSTS_TM1TCF_VAL ((uint32_t)0x00000100)
117#define CAN_TSTS_TM2TCF_VAL ((uint32_t)0x00010000)
118#define CAN_TSTS_TM0CT_VAL ((uint32_t)0x00000080)
119#define CAN_TSTS_TM1CT_VAL ((uint32_t)0x00008000)
120#define CAN_TSTS_TM2CT_VAL ((uint32_t)0x00800000)
121#define CAN_RF0_RF0FF_VAL ((uint32_t)0x00000008)
122#define CAN_RF0_RF0OF_VAL ((uint32_t)0x00000010)
123#define CAN_RF0_RF0R_VAL ((uint32_t)0x00000020)
124#define CAN_RF1_RF1FF_VAL ((uint32_t)0x00000008)
125#define CAN_RF1_RF1OF_VAL ((uint32_t)0x00000010)
126#define CAN_RF1_RF1R_VAL ((uint32_t)0x00000020)
135typedef enum
136{
137 CAN_FILTER_FIFO0 = 0x00,
138 CAN_FILTER_FIFO1 = 0x01
139} can_filter_fifo_type;
140
144typedef enum
145{
146 CAN_FILTER_MODE_ID_MASK = 0x00,
147 CAN_FILTER_MODE_ID_LIST = 0x01
148} can_filter_mode_type;
149
153typedef enum
154{
155 CAN_FILTER_16BIT = 0x00,
156 CAN_FILTER_32BIT = 0x01
157} can_filter_bit_width_type;
158
162typedef enum
163{
164 CAN_MODE_COMMUNICATE = 0x00,
165 CAN_MODE_LOOPBACK = 0x01,
166 CAN_MODE_LISTENONLY = 0x02,
167 CAN_MODE_LISTENONLY_LOOPBACK = 0x03
168} can_mode_type;
169
173typedef enum
174{
175 CAN_OPERATINGMODE_FREEZE = 0x00,
176 CAN_OPERATINGMODE_DOZE = 0x01,
177 CAN_OPERATINGMODE_COMMUNICATE = 0x02
178} can_operating_mode_type;
179
183typedef enum
184{
185 CAN_RSAW_1TQ = 0x00,
186 CAN_RSAW_2TQ = 0x01,
187 CAN_RSAW_3TQ = 0x02,
188 CAN_RSAW_4TQ = 0x03
189} can_rsaw_type;
190
194typedef enum
195{
196 CAN_BTS1_1TQ = 0x00,
197 CAN_BTS1_2TQ = 0x01,
198 CAN_BTS1_3TQ = 0x02,
199 CAN_BTS1_4TQ = 0x03,
200 CAN_BTS1_5TQ = 0x04,
201 CAN_BTS1_6TQ = 0x05,
202 CAN_BTS1_7TQ = 0x06,
203 CAN_BTS1_8TQ = 0x07,
204 CAN_BTS1_9TQ = 0x08,
205 CAN_BTS1_10TQ = 0x09,
206 CAN_BTS1_11TQ = 0x0A,
207 CAN_BTS1_12TQ = 0x0B,
208 CAN_BTS1_13TQ = 0x0C,
209 CAN_BTS1_14TQ = 0x0D,
210 CAN_BTS1_15TQ = 0x0E,
211 CAN_BTS1_16TQ = 0x0F
212} can_bts1_type;
213
217typedef enum
218{
219 CAN_BTS2_1TQ = 0x00,
220 CAN_BTS2_2TQ = 0x01,
221 CAN_BTS2_3TQ = 0x02,
222 CAN_BTS2_4TQ = 0x03,
223 CAN_BTS2_5TQ = 0x04,
224 CAN_BTS2_6TQ = 0x05,
225 CAN_BTS2_7TQ = 0x06,
226 CAN_BTS2_8TQ = 0x07
227} can_bts2_type;
228
232typedef enum
233{
234 CAN_ID_STANDARD = 0x00,
235 CAN_ID_EXTENDED = 0x01
236} can_identifier_type;
237
241typedef enum
242{
243 CAN_TFT_DATA = 0x00,
244 CAN_TFT_REMOTE = 0x01
245} can_trans_frame_type;
246
250typedef enum
251{
252 CAN_TX_MAILBOX0 = 0x00,
253 CAN_TX_MAILBOX1 = 0x01,
254 CAN_TX_MAILBOX2 = 0x02
255} can_tx_mailbox_num_type;
256
260typedef enum
261{
262 CAN_RX_FIFO0 = 0x00,
263 CAN_RX_FIFO1 = 0x01
264} can_rx_fifo_num_type;
265
269typedef enum
270{
271 CAN_TX_STATUS_FAILED = 0x00,
272 CAN_TX_STATUS_SUCCESSFUL = 0x01,
273 CAN_TX_STATUS_PENDING = 0x02,
274 CAN_TX_STATUS_NO_EMPTY = 0x04
275} can_transmit_status_type;
276
280typedef enum
281{
282 CAN_ENTER_DOZE_FAILED = 0x00,
283 CAN_ENTER_DOZE_SUCCESSFUL = 0x01
284} can_enter_doze_status_type;
285
289typedef enum
290{
291 CAN_QUIT_DOZE_FAILED = 0x00,
292 CAN_QUIT_DOZE_SUCCESSFUL = 0x01
293} can_quit_doze_status_type;
294
298typedef enum
299{
300 CAN_DISCARDING_FIRST_RECEIVED = 0x00,
301 CAN_DISCARDING_LAST_RECEIVED = 0x01
302} can_msg_discarding_rule_type;
303
307typedef enum
308{
309 CAN_SENDING_BY_ID = 0x00,
310 CAN_SENDING_BY_REQUEST = 0x01
311} can_msg_sending_rule_type;
312
316typedef enum
317{
318 CAN_ERRORRECORD_NOERR = 0x00,
319 CAN_ERRORRECORD_STUFFERR = 0x01,
320 CAN_ERRORRECORD_FORMERR = 0x02,
321 CAN_ERRORRECORD_ACKERR = 0x03,
322 CAN_ERRORRECORD_BITRECESSIVEERR = 0x04,
323 CAN_ERRORRECORD_BITDOMINANTERR = 0x05,
324 CAN_ERRORRECORD_CRCERR = 0x06,
325 CAN_ERRORRECORD_SOFTWARESETERR = 0x07
326} can_error_record_type;
327
331typedef struct
332{
333 can_mode_type mode_selection;
335 confirm_state ttc_enable;
337 confirm_state aebo_enable;
339 confirm_state aed_enable;
341 confirm_state prsf_enable;
343 can_msg_discarding_rule_type mdrsel_selection;
345 can_msg_sending_rule_type mmssr_selection;
347} can_base_type;
348
352typedef struct
353{
354 uint16_t baudrate_div;
356 can_rsaw_type rsaw_size;
358 can_bts1_type bts1_size;
360 can_bts2_type bts2_size;
362} can_baudrate_type;
363
367typedef struct
368{
369 confirm_state filter_activate_enable;
371 can_filter_mode_type filter_mode;
373 can_filter_fifo_type filter_fifo;
375 uint8_t filter_number;
377 can_filter_bit_width_type filter_bit;
379 uint16_t filter_id_high;
382 uint16_t filter_id_low;
385 uint16_t filter_mask_high;
388 uint16_t filter_mask_low;
390} can_filter_init_type;
391
395typedef struct
396{
397 uint32_t standard_id;
400 uint32_t extended_id;
403 can_identifier_type id_type;
405 can_trans_frame_type frame_type;
407 uint8_t dlc;
410 uint8_t data[8];
412} can_tx_message_type;
413
417typedef struct
418{
419 uint32_t standard_id;
422 uint32_t extended_id;
425 can_identifier_type id_type;
427 can_trans_frame_type frame_type;
429 uint8_t dlc;
432 uint8_t data[8];
434 uint8_t filter_index;
436} can_rx_message_type;
437
441typedef struct
442{
446 union
447 {
448 __IO uint32_t tmi;
449 struct
450 {
451 __IO uint32_t tmsr : 1; /* [0] */
452 __IO uint32_t tmfrsel : 1; /* [1] */
453 __IO uint32_t tmidsel : 1; /* [2] */
454 __IO uint32_t tmeid : 18;/* [20:3] */
455 __IO uint32_t tmsid : 11;/* [31:21] */
456 } tmi_bit;
457 };
458
462 union
463 {
464 __IO uint32_t tmc;
465 struct
466 {
467 __IO uint32_t tmdtbl : 4; /* [3:0] */
468 __IO uint32_t reserved1 : 4; /* [7:4] */
469 __IO uint32_t tmtsten : 1; /* [8] */
470 __IO uint32_t reserved2 : 7; /* [15:9] */
471 __IO uint32_t tmts : 16;/* [31:16] */
472 } tmc_bit;
473 };
474
478 union
479 {
480 __IO uint32_t tmdtl;
481 struct
482 {
483 __IO uint32_t tmdt0 : 8; /* [7:0] */
484 __IO uint32_t tmdt1 : 8; /* [15:8] */
485 __IO uint32_t tmdt2 : 8; /* [23:16] */
486 __IO uint32_t tmdt3 : 8; /* [31:24] */
487 } tmdtl_bit;
488 };
489
493 union
494 {
495 __IO uint32_t tmdth;
496 struct
497 {
498 __IO uint32_t tmdt4 : 8; /* [7:0] */
499 __IO uint32_t tmdt5 : 8; /* [15:8] */
500 __IO uint32_t tmdt6 : 8; /* [23:16] */
501 __IO uint32_t tmdt7 : 8; /* [31:24] */
502 } tmdth_bit;
503 };
504} can_tx_mailbox_type;
505
509typedef struct
510{
514 union
515 {
516 __IO uint32_t rfi;
517 struct
518 {
519 __IO uint32_t reserved1 : 1; /* [0] */
520 __IO uint32_t rffri : 1; /* [1] */
521 __IO uint32_t rfidi : 1; /* [2] */
522 __IO uint32_t rfeid : 18;/* [20:3] */
523 __IO uint32_t rfsid : 11;/* [31:21] */
524 } rfi_bit;
525 };
526
530 union
531 {
532 __IO uint32_t rfc;
533 struct
534 {
535 __IO uint32_t rfdtl : 4; /* [3:0] */
536 __IO uint32_t reserved1 : 4; /* [7:4] */
537 __IO uint32_t rffmn : 8; /* [15:8] */
538 __IO uint32_t rfts : 16;/* [31:16] */
539 } rfc_bit;
540 };
541
545 union
546 {
547 __IO uint32_t rfdtl;
548 struct
549 {
550 __IO uint32_t rfdt0 : 8; /* [7:0] */
551 __IO uint32_t rfdt1 : 8; /* [15:8] */
552 __IO uint32_t rfdt2 : 8; /* [23:16] */
553 __IO uint32_t rfdt3 : 8; /* [31:24] */
554 } rfdtl_bit;
555 };
556
560 union
561 {
562 __IO uint32_t rfdth;
563 struct
564 {
565 __IO uint32_t rfdt4 : 8; /* [7:0] */
566 __IO uint32_t rfdt5 : 8; /* [15:8] */
567 __IO uint32_t rfdt6 : 8; /* [23:16] */
568 __IO uint32_t rfdt7 : 8; /* [31:24] */
569 } rfdth_bit;
570 };
571} can_fifo_mailbox_type;
572
576typedef struct
577{
578 __IO uint32_t ffdb1;
579 __IO uint32_t ffdb2;
580} can_filter_register_type;
581
585typedef struct
586{
587
591 union
592 {
593 __IO uint32_t mctrl;
594 struct
595 {
596 __IO uint32_t fzen : 1; /* [0] */
597 __IO uint32_t dzen : 1; /* [1] */
598 __IO uint32_t mmssr : 1; /* [2] */
599 __IO uint32_t mdrsel : 1; /* [3] */
600 __IO uint32_t prsfen : 1; /* [4] */
601 __IO uint32_t aeden : 1; /* [5] */
602 __IO uint32_t aeboen : 1; /* [6] */
603 __IO uint32_t ttcen : 1; /* [7] */
604 __IO uint32_t reserved1 : 7; /* [14:8] */
605 __IO uint32_t sprst : 1; /* [15] */
606 __IO uint32_t ptd : 1; /* [16] */
607 __IO uint32_t reserved2 : 15;/*[31:17] */
608 } mctrl_bit;
609 };
610
614 union
615 {
616 __IO uint32_t msts;
617 struct
618 {
619 __IO uint32_t fzc : 1; /* [0] */
620 __IO uint32_t dzc : 1; /* [1] */
621 __IO uint32_t eoif : 1; /* [2] */
622 __IO uint32_t qdzif : 1; /* [3] */
623 __IO uint32_t edzif : 1; /* [4] */
624 __IO uint32_t reserved1 : 3; /* [7:5] */
625 __IO uint32_t cuss : 1; /* [8] */
626 __IO uint32_t curs : 1; /* [9] */
627 __IO uint32_t lsamprx : 1; /* [10] */
628 __IO uint32_t realrx : 1; /* [11] */
629 __IO uint32_t reserved2 : 20;/*[31:12] */
630 } msts_bit;
631 };
632
636 union
637 {
638 __IO uint32_t tsts;
639 struct
640 {
641 __IO uint32_t tm0tcf : 1; /* [0] */
642 __IO uint32_t tm0tsf : 1; /* [1] */
643 __IO uint32_t tm0alf : 1; /* [2] */
644 __IO uint32_t tm0tef : 1; /* [3] */
645 __IO uint32_t reserved1 : 3; /* [6:4] */
646 __IO uint32_t tm0ct : 1; /* [7] */
647 __IO uint32_t tm1tcf : 1; /* [8] */
648 __IO uint32_t tm1tsf : 1; /* [9] */
649 __IO uint32_t tm1alf : 1; /* [10] */
650 __IO uint32_t tm1tef : 1; /* [11] */
651 __IO uint32_t reserved2 : 3; /* [14:12] */
652 __IO uint32_t tm1ct : 1; /* [15] */
653 __IO uint32_t tm2tcf : 1; /* [16] */
654 __IO uint32_t tm2tsf : 1; /* [17] */
655 __IO uint32_t tm2alf : 1; /* [18] */
656 __IO uint32_t tm2tef : 1; /* [19] */
657 __IO uint32_t reserved3 : 3; /* [22:20] */
658 __IO uint32_t tm2ct : 1; /* [23] */
659 __IO uint32_t tmnr : 2; /* [25:24] */
660 __IO uint32_t tm0ef : 1; /* [26] */
661 __IO uint32_t tm1ef : 1; /* [27] */
662 __IO uint32_t tm2ef : 1; /* [28] */
663 __IO uint32_t tm0lpf : 1; /* [29] */
664 __IO uint32_t tm1lpf : 1; /* [30] */
665 __IO uint32_t tm2lpf : 1; /* [31] */
666 } tsts_bit;
667 };
668
672 union
673 {
674 __IO uint32_t rf0;
675 struct
676 {
677 __IO uint32_t rf0mn : 2; /* [1:0] */
678 __IO uint32_t reserved1 : 1; /* [2] */
679 __IO uint32_t rf0ff : 1; /* [3] */
680 __IO uint32_t rf0of : 1; /* [4] */
681 __IO uint32_t rf0r : 1; /* [5] */
682 __IO uint32_t reserved2 : 26;/* [31:6] */
683 } rf0_bit;
684 };
685
689 union
690 {
691 __IO uint32_t rf1;
692 struct
693 {
694 __IO uint32_t rf1mn : 2; /* [1:0] */
695 __IO uint32_t reserved1 : 1; /* [2] */
696 __IO uint32_t rf1ff : 1; /* [3] */
697 __IO uint32_t rf1of : 1; /* [4] */
698 __IO uint32_t rf1r : 1; /* [5] */
699 __IO uint32_t reserved2 : 26;/* [31:6] */
700 } rf1_bit;
701 };
702
706 union
707 {
708 __IO uint32_t inten;
709 struct
710 {
711 __IO uint32_t tcien : 1; /* [0] */
712 __IO uint32_t rf0mien : 1; /* [1] */
713 __IO uint32_t rf0fien : 1; /* [2] */
714 __IO uint32_t rf0oien : 1; /* [3] */
715 __IO uint32_t rf1mien : 1; /* [4] */
716 __IO uint32_t rf1fien : 1; /* [5] */
717 __IO uint32_t rf1oien : 1; /* [6] */
718 __IO uint32_t reserved1 : 1; /* [7] */
719 __IO uint32_t eaien : 1; /* [8] */
720 __IO uint32_t epien : 1; /* [9] */
721 __IO uint32_t boien : 1; /* [10] */
722 __IO uint32_t etrien : 1; /* [11] */
723 __IO uint32_t reserved2 : 3; /* [14:12] */
724 __IO uint32_t eoien : 1; /* [15] */
725 __IO uint32_t qdzien : 1; /* [16] */
726 __IO uint32_t edzien : 1; /* [17] */
727 __IO uint32_t reserved3 : 14;/* [31:18] */
728 } inten_bit;
729 };
730
734 union
735 {
736 __IO uint32_t ests;
737 struct
738 {
739 __IO uint32_t eaf : 1; /* [0] */
740 __IO uint32_t epf : 1; /* [1] */
741 __IO uint32_t bof : 1; /* [2] */
742 __IO uint32_t reserved1 : 1; /* [3] */
743 __IO uint32_t etr : 3; /* [6:4] */
744 __IO uint32_t reserved2 : 9; /* [15:7] */
745 __IO uint32_t tec : 8; /* [23:16] */
746 __IO uint32_t rec : 8; /* [31:24] */
747 } ests_bit;
748 };
749
753 union
754 {
755 __IO uint32_t btmg;
756 struct
757 {
758 __IO uint32_t brdiv : 12;/* [11:0] */
759 __IO uint32_t reserved1 : 4; /* [15:12] */
760 __IO uint32_t bts1 : 4; /* [19:16] */
761 __IO uint32_t bts2 : 3; /* [22:20] */
762 __IO uint32_t reserved2 : 1; /* [23] */
763 __IO uint32_t rsaw : 2; /* [25:24] */
764 __IO uint32_t reserved3 : 4; /* [29:26] */
765 __IO uint32_t lben : 1; /* [30] */
766 __IO uint32_t loen : 1; /* [31] */
767 } btmg_bit;
768 };
769
773 __IO uint32_t reserved1[88];
774
778 can_tx_mailbox_type tx_mailbox[3];
779
783 can_fifo_mailbox_type fifo_mailbox[2];
784
788 __IO uint32_t reserved2[12];
789
793 union
794 {
795 __IO uint32_t fctrl;
796 struct
797 {
798 __IO uint32_t fcs : 1; /* [0] */
799 __IO uint32_t reserved1 : 31;/* [31:1] */
800 } fctrl_bit;
801 };
802
806 union
807 {
808 __IO uint32_t fmcfg;
809 struct
810 {
811 __IO uint32_t fmsel0 : 1; /* [0] */
812 __IO uint32_t fmsel1 : 1; /* [1] */
813 __IO uint32_t fmsel2 : 1; /* [2] */
814 __IO uint32_t fmsel3 : 1; /* [3] */
815 __IO uint32_t fmsel4 : 1; /* [4] */
816 __IO uint32_t fmsel5 : 1; /* [5] */
817 __IO uint32_t fmsel6 : 1; /* [6] */
818 __IO uint32_t fmsel7 : 1; /* [7] */
819 __IO uint32_t fmsel8 : 1; /* [8] */
820 __IO uint32_t fmsel9 : 1; /* [9] */
821 __IO uint32_t fmsel10 : 1; /* [10] */
822 __IO uint32_t fmsel11 : 1; /* [11] */
823 __IO uint32_t fmsel12 : 1; /* [12] */
824 __IO uint32_t fmsel13 : 1; /* [13] */
825 __IO uint32_t reserved1 : 18;/* [31:14] */
826 } fmcfg_bit;
827 };
828
832 __IO uint32_t reserved3;
833
837 union
838 {
839 __IO uint32_t fbwcfg;
840 struct
841 {
842 __IO uint32_t fbwsel0 : 1; /* [0] */
843 __IO uint32_t fbwsel1 : 1; /* [1] */
844 __IO uint32_t fbwsel2 : 1; /* [2] */
845 __IO uint32_t fbwsel3 : 1; /* [3] */
846 __IO uint32_t fbwsel4 : 1; /* [4] */
847 __IO uint32_t fbwsel5 : 1; /* [5] */
848 __IO uint32_t fbwsel6 : 1; /* [6] */
849 __IO uint32_t fbwsel7 : 1; /* [7] */
850 __IO uint32_t fbwsel8 : 1; /* [8] */
851 __IO uint32_t fbwsel9 : 1; /* [9] */
852 __IO uint32_t fbwsel10 : 1; /* [10] */
853 __IO uint32_t fbwsel11 : 1; /* [11] */
854 __IO uint32_t fbwsel12 : 1; /* [12] */
855 __IO uint32_t fbwsel13 : 1; /* [13] */
856 __IO uint32_t reserved1 : 18;/* [31:14] */
857 } fbwcfg_bit;
858 };
859
863 __IO uint32_t reserved4;
864
868 union
869 {
870 __IO uint32_t frf;
871 struct
872 {
873 __IO uint32_t frfsel0 : 1; /* [0] */
874 __IO uint32_t frfsel1 : 1; /* [1] */
875 __IO uint32_t frfsel2 : 1; /* [2] */
876 __IO uint32_t frfsel3 : 1; /* [3] */
877 __IO uint32_t frfsel4 : 1; /* [4] */
878 __IO uint32_t frfsel5 : 1; /* [5] */
879 __IO uint32_t frfsel6 : 1; /* [6] */
880 __IO uint32_t frfsel7 : 1; /* [7] */
881 __IO uint32_t frfsel8 : 1; /* [8] */
882 __IO uint32_t frfsel9 : 1; /* [9] */
883 __IO uint32_t frfsel10 : 1; /* [10] */
884 __IO uint32_t frfsel11 : 1; /* [11] */
885 __IO uint32_t frfsel12 : 1; /* [12] */
886 __IO uint32_t frfsel13 : 1; /* [13] */
887 __IO uint32_t reserved1 : 18;/* [31:14] */
888 } frf_bit;
889 };
890
894 __IO uint32_t reserved5;
895
899 union
900 {
901 __IO uint32_t facfg;
902 struct
903 {
904 __IO uint32_t faen0 : 1; /* [0] */
905 __IO uint32_t faen1 : 1; /* [1] */
906 __IO uint32_t faen2 : 1; /* [2] */
907 __IO uint32_t faen3 : 1; /* [3] */
908 __IO uint32_t faen4 : 1; /* [4] */
909 __IO uint32_t faen5 : 1; /* [5] */
910 __IO uint32_t faen6 : 1; /* [6] */
911 __IO uint32_t faen7 : 1; /* [7] */
912 __IO uint32_t faen8 : 1; /* [8] */
913 __IO uint32_t faen9 : 1; /* [9] */
914 __IO uint32_t faen10 : 1; /* [10] */
915 __IO uint32_t faen11 : 1; /* [11] */
916 __IO uint32_t faen12 : 1; /* [12] */
917 __IO uint32_t faen13 : 1; /* [13] */
918 __IO uint32_t reserved1 : 18;/* [31:14] */
919 } facfg_bit;
920 };
921
925 __IO uint32_t reserved6[8];
926
930 can_filter_register_type ffb[14];
931} can_type;
932
937#define CAN1 ((can_type *) CAN1_BASE)
938#if defined (AT32F413TBU7) || defined (AT32F413Rx) || defined (AT32F413Cx) || \
939 defined (AT32F413Kx)
940#define CAN2 ((can_type *) CAN2_BASE)
941#endif
942
947void can_reset(can_type* can_x);
948void can_baudrate_default_para_init(can_baudrate_type* can_baudrate_struct);
949 error_status can_baudrate_set(can_type* can_x, can_baudrate_type* can_baudrate_struct);
950void can_default_para_init(can_base_type* can_base_struct);
951 error_status can_base_init(can_type* can_x, can_base_type* can_base_struct);
952void can_filter_default_para_init(can_filter_init_type* can_filter_init_struct);
953void can_filter_init(can_type* can_x, can_filter_init_type* can_filter_init_struct);
954void can_debug_transmission_prohibit(can_type* can_x, confirm_state new_state);
955void can_ttc_mode_enable(can_type* can_x, confirm_state new_state);
956uint8_t can_message_transmit(can_type* can_x, can_tx_message_type* tx_message_struct);
957 can_transmit_status_type can_transmit_status_get(can_type* can_x, can_tx_mailbox_num_type transmit_mailbox);
958void can_transmit_cancel(can_type* can_x, can_tx_mailbox_num_type transmit_mailbox);
959void can_message_receive(can_type* can_x, can_rx_fifo_num_type fifo_number, can_rx_message_type* rx_message_struct);
960void can_receive_fifo_release(can_type* can_x, can_rx_fifo_num_type fifo_number);
961uint8_t can_receive_message_pending_get(can_type* can_x, can_rx_fifo_num_type fifo_number);
962 error_status can_operating_mode_set(can_type* can_x, can_operating_mode_type can_operating_mode);
963 can_enter_doze_status_type can_doze_mode_enter(can_type* can_x);
964 can_quit_doze_status_type can_doze_mode_exit(can_type* can_x);
965 can_error_record_type can_error_type_record_get(can_type* can_x);
966uint8_t can_receive_error_counter_get(can_type* can_x);
967uint8_t can_transmit_error_counter_get(can_type* can_x);
968void can_interrupt_enable(can_type* can_x, uint32_t can_int, confirm_state new_state);
969 flag_status can_interrupt_flag_get(can_type* can_x, uint32_t can_flag);
970 flag_status can_flag_get(can_type* can_x, uint32_t can_flag);
971void can_flag_clear(can_type* can_x, uint32_t can_flag);
972
985#ifdef __cplusplus
986}
987#endif
988
989#endif
at32f413.h
at32f413 header file
can_base_init
error_status can_base_init(can_type *can_x, can_base_type *can_base_struct)
initialize the can peripheral according to the specified parameters in the can_init_struct.
Definition at32f413_can.c:196
can_reset
void can_reset(can_type *can_x)
deinitialize the can peripheral registers to their default reset values.
Definition at32f413_can.c:50
can_interrupt_flag_get
flag_status can_interrupt_flag_get(can_type *can_x, uint32_t can_flag)
get interrupt flag of the specified can peripheral.
Definition at32f413_can.c:968
can_transmit_error_counter_get
uint8_t can_transmit_error_counter_get(can_type *can_x)
return the transmit error counter of the specified can peripheral.
Definition at32f413_can.c:896
can_transmit_status_get
can_transmit_status_type can_transmit_status_get(can_type *can_x, can_tx_mailbox_num_type transmit_mailbox)
check the transmission state of the specified can peripheral.
Definition at32f413_can.c:516
can_ttc_mode_enable
void can_ttc_mode_enable(can_type *can_x, confirm_state new_state)
enable or disable time trigger operation communication mode of the specified can peripheral.
Definition at32f413_can.c:418
can_filter_default_para_init
void can_filter_default_para_init(can_filter_init_type *can_filter_init_struct)
fill each can_filter_init_struct member with its default value.
Definition at32f413_can.c:271
can_receive_fifo_release
void can_receive_fifo_release(can_type *can_x, can_rx_fifo_num_type fifo_number)
release the specified fifo of the specified can peripheral.
Definition at32f413_can.c:670
can_receive_error_counter_get
uint8_t can_receive_error_counter_get(can_type *can_x)
return the receive error counter (rec) of the specified can peripheral.
Definition at32f413_can.c:882
can_operating_mode_set
error_status can_operating_mode_set(can_type *can_x, can_operating_mode_type can_operating_mode)
set the operation mode of the specified can peripheral.
Definition at32f413_can.c:727
can_baudrate_default_para_init
void can_baudrate_default_para_init(can_baudrate_type *can_baudrate_struct)
fill each can_baudrate_struct member with its default value.
Definition at32f413_can.c:72
can_transmit_cancel
void can_transmit_cancel(can_type *can_x, can_tx_mailbox_num_type transmit_mailbox)
cancel a transmit request of the specified can peripheral.
Definition at32f413_can.c:591
can_receive_message_pending_get
uint8_t can_receive_message_pending_get(can_type *can_x, can_rx_fifo_num_type fifo_number)
return the number of pending messages of the specified can peripheral.
Definition at32f413_can.c:696
can_message_transmit
uint8_t can_message_transmit(can_type *can_x, can_tx_message_type *tx_message_struct)
fill the transmission message and transmit of the specified can peripheral.
Definition at32f413_can.c:442
can_message_receive
void can_message_receive(can_type *can_x, can_rx_fifo_num_type fifo_number, can_rx_message_type *rx_message_struct)
receive message of the specified can peripheral.
Definition at32f413_can.c:623
can_interrupt_enable
void can_interrupt_enable(can_type *can_x, uint32_t can_int, confirm_state new_state)
enable or disable the interrupt of the specified can peripheral.
Definition at32f413_can.c:928
can_flag_get
flag_status can_flag_get(can_type *can_x, uint32_t can_flag)
get flag of the specified can peripheral.
Definition at32f413_can.c:1064
can_flag_clear
void can_flag_clear(can_type *can_x, uint32_t can_flag)
clear flag of the specified can peripheral.
Definition at32f413_can.c:1188
can_baudrate_set
error_status can_baudrate_set(can_type *can_x, can_baudrate_type *can_baudrate_struct)
set the baudrate of the can peripheral
Definition at32f413_can.c:101
can_debug_transmission_prohibit
void can_debug_transmission_prohibit(can_type *can_x, confirm_state new_state)
enable or disable the debug transmission prohibit of the specified can peripheral.
Definition at32f413_can.c:397
can_error_type_record_get
can_error_record_type can_error_type_record_get(can_type *can_x)
return the error type record (etr) of the specified can peripheral.
Definition at32f413_can.c:867
can_filter_init
void can_filter_init(can_type *can_x, can_filter_init_type *can_filter_init_struct)
initialize the can peripheral according to the specified parameters in the can_filter_init_struct.
Definition at32f413_can.c:306
can_default_para_init
void can_default_para_init(can_base_type *can_base_struct)
fill each can_init_struct member with its default value.
Definition at32f413_can.c:159
can_doze_mode_exit
can_quit_doze_status_type can_doze_mode_exit(can_type *can_x)
exit the doze mode of the specified can peripheral.
Definition at32f413_can.c:835
can_doze_mode_enter
can_enter_doze_status_type can_doze_mode_enter(can_type *can_x)
enter the low power mode of the specified can peripheral.
Definition at32f413_can.c:805
can_filter_fifo_type
can_filter_fifo_type
can filter fifo
Definition at32f413_can.h:136
can_transmit_status_type
can_transmit_status_type
can transmit status
Definition at32f413_can.h:270
can_msg_discarding_rule_type
can_msg_discarding_rule_type
can message discarding rule select when overflow
Definition at32f413_can.h:299
can_bts2_type
can_bts2_type
can bit time segment 2
Definition at32f413_can.h:218
can_quit_doze_status_type
can_quit_doze_status_type
can quit doze mode status
Definition at32f413_can.h:290
can_trans_frame_type
can_trans_frame_type
can transmission frame type
Definition at32f413_can.h:242
can_bts1_type
can_bts1_type
can bit time segment 1
Definition at32f413_can.h:195
can_error_record_type
can_error_record_type
can error type record
Definition at32f413_can.h:317
can_filter_mode_type
can_filter_mode_type
can filter mode
Definition at32f413_can.h:145
can_operating_mode_type
can_operating_mode_type
can operating mode
Definition at32f413_can.h:174
can_msg_sending_rule_type
can_msg_sending_rule_type
can multiple message sending sequence rule
Definition at32f413_can.h:308
can_tx_mailbox_num_type
can_tx_mailbox_num_type
can tx mailboxes
Definition at32f413_can.h:251
can_filter_bit_width_type
can_filter_bit_width_type
can filter bit width select
Definition at32f413_can.h:154
can_enter_doze_status_type
can_enter_doze_status_type
can enter doze mode status
Definition at32f413_can.h:281
can_rx_fifo_num_type
can_rx_fifo_num_type
can receive fifo
Definition at32f413_can.h:261
can_identifier_type
can_identifier_type
can identifier type
Definition at32f413_can.h:233
can_mode_type
can_mode_type
can mode
Definition at32f413_can.h:163
can_rsaw_type
can_rsaw_type
can resynchronization adjust width
Definition at32f413_can.h:184
CAN_FILTER_FIFO0
@ CAN_FILTER_FIFO0
Definition at32f413_can.h:137
CAN_FILTER_FIFO1
@ CAN_FILTER_FIFO1
Definition at32f413_can.h:138
CAN_TX_STATUS_SUCCESSFUL
@ CAN_TX_STATUS_SUCCESSFUL
Definition at32f413_can.h:272
CAN_TX_STATUS_PENDING
@ CAN_TX_STATUS_PENDING
Definition at32f413_can.h:273
CAN_TX_STATUS_NO_EMPTY
@ CAN_TX_STATUS_NO_EMPTY
Definition at32f413_can.h:274
CAN_TX_STATUS_FAILED
@ CAN_TX_STATUS_FAILED
Definition at32f413_can.h:271
CAN_DISCARDING_FIRST_RECEIVED
@ CAN_DISCARDING_FIRST_RECEIVED
Definition at32f413_can.h:300
CAN_DISCARDING_LAST_RECEIVED
@ CAN_DISCARDING_LAST_RECEIVED
Definition at32f413_can.h:301
CAN_BTS2_4TQ
@ CAN_BTS2_4TQ
Definition at32f413_can.h:222
CAN_BTS2_2TQ
@ CAN_BTS2_2TQ
Definition at32f413_can.h:220
CAN_BTS2_5TQ
@ CAN_BTS2_5TQ
Definition at32f413_can.h:223
CAN_BTS2_6TQ
@ CAN_BTS2_6TQ
Definition at32f413_can.h:224
CAN_BTS2_7TQ
@ CAN_BTS2_7TQ
Definition at32f413_can.h:225
CAN_BTS2_8TQ
@ CAN_BTS2_8TQ
Definition at32f413_can.h:226
CAN_BTS2_3TQ
@ CAN_BTS2_3TQ
Definition at32f413_can.h:221
CAN_BTS2_1TQ
@ CAN_BTS2_1TQ
Definition at32f413_can.h:219
CAN_QUIT_DOZE_FAILED
@ CAN_QUIT_DOZE_FAILED
Definition at32f413_can.h:291
CAN_QUIT_DOZE_SUCCESSFUL
@ CAN_QUIT_DOZE_SUCCESSFUL
Definition at32f413_can.h:292
CAN_TFT_REMOTE
@ CAN_TFT_REMOTE
Definition at32f413_can.h:244
CAN_TFT_DATA
@ CAN_TFT_DATA
Definition at32f413_can.h:243
CAN_BTS1_7TQ
@ CAN_BTS1_7TQ
Definition at32f413_can.h:202
CAN_BTS1_1TQ
@ CAN_BTS1_1TQ
Definition at32f413_can.h:196
CAN_BTS1_14TQ
@ CAN_BTS1_14TQ
Definition at32f413_can.h:209
CAN_BTS1_4TQ
@ CAN_BTS1_4TQ
Definition at32f413_can.h:199
CAN_BTS1_15TQ
@ CAN_BTS1_15TQ
Definition at32f413_can.h:210
CAN_BTS1_11TQ
@ CAN_BTS1_11TQ
Definition at32f413_can.h:206
CAN_BTS1_10TQ
@ CAN_BTS1_10TQ
Definition at32f413_can.h:205
CAN_BTS1_16TQ
@ CAN_BTS1_16TQ
Definition at32f413_can.h:211
CAN_BTS1_8TQ
@ CAN_BTS1_8TQ
Definition at32f413_can.h:203
CAN_BTS1_3TQ
@ CAN_BTS1_3TQ
Definition at32f413_can.h:198
CAN_BTS1_12TQ
@ CAN_BTS1_12TQ
Definition at32f413_can.h:207
CAN_BTS1_9TQ
@ CAN_BTS1_9TQ
Definition at32f413_can.h:204
CAN_BTS1_5TQ
@ CAN_BTS1_5TQ
Definition at32f413_can.h:200
CAN_BTS1_6TQ
@ CAN_BTS1_6TQ
Definition at32f413_can.h:201
CAN_BTS1_2TQ
@ CAN_BTS1_2TQ
Definition at32f413_can.h:197
CAN_BTS1_13TQ
@ CAN_BTS1_13TQ
Definition at32f413_can.h:208
CAN_ERRORRECORD_CRCERR
@ CAN_ERRORRECORD_CRCERR
Definition at32f413_can.h:324
CAN_ERRORRECORD_FORMERR
@ CAN_ERRORRECORD_FORMERR
Definition at32f413_can.h:320
CAN_ERRORRECORD_BITDOMINANTERR
@ CAN_ERRORRECORD_BITDOMINANTERR
Definition at32f413_can.h:323
CAN_ERRORRECORD_BITRECESSIVEERR
@ CAN_ERRORRECORD_BITRECESSIVEERR
Definition at32f413_can.h:322
CAN_ERRORRECORD_NOERR
@ CAN_ERRORRECORD_NOERR
Definition at32f413_can.h:318
CAN_ERRORRECORD_STUFFERR
@ CAN_ERRORRECORD_STUFFERR
Definition at32f413_can.h:319
CAN_ERRORRECORD_SOFTWARESETERR
@ CAN_ERRORRECORD_SOFTWARESETERR
Definition at32f413_can.h:325
CAN_ERRORRECORD_ACKERR
@ CAN_ERRORRECORD_ACKERR
Definition at32f413_can.h:321
CAN_FILTER_MODE_ID_LIST
@ CAN_FILTER_MODE_ID_LIST
Definition at32f413_can.h:147
CAN_FILTER_MODE_ID_MASK
@ CAN_FILTER_MODE_ID_MASK
Definition at32f413_can.h:146
CAN_OPERATINGMODE_FREEZE
@ CAN_OPERATINGMODE_FREEZE
Definition at32f413_can.h:175
CAN_OPERATINGMODE_COMMUNICATE
@ CAN_OPERATINGMODE_COMMUNICATE
Definition at32f413_can.h:177
CAN_OPERATINGMODE_DOZE
@ CAN_OPERATINGMODE_DOZE
Definition at32f413_can.h:176
CAN_SENDING_BY_ID
@ CAN_SENDING_BY_ID
Definition at32f413_can.h:309
CAN_SENDING_BY_REQUEST
@ CAN_SENDING_BY_REQUEST
Definition at32f413_can.h:310
CAN_TX_MAILBOX2
@ CAN_TX_MAILBOX2
Definition at32f413_can.h:254
CAN_TX_MAILBOX0
@ CAN_TX_MAILBOX0
Definition at32f413_can.h:252
CAN_TX_MAILBOX1
@ CAN_TX_MAILBOX1
Definition at32f413_can.h:253
CAN_FILTER_16BIT
@ CAN_FILTER_16BIT
Definition at32f413_can.h:155
CAN_FILTER_32BIT
@ CAN_FILTER_32BIT
Definition at32f413_can.h:156
CAN_ENTER_DOZE_FAILED
@ CAN_ENTER_DOZE_FAILED
Definition at32f413_can.h:282
CAN_ENTER_DOZE_SUCCESSFUL
@ CAN_ENTER_DOZE_SUCCESSFUL
Definition at32f413_can.h:283
CAN_RX_FIFO0
@ CAN_RX_FIFO0
Definition at32f413_can.h:262
CAN_RX_FIFO1
@ CAN_RX_FIFO1
Definition at32f413_can.h:263
CAN_ID_STANDARD
@ CAN_ID_STANDARD
Definition at32f413_can.h:234
CAN_ID_EXTENDED
@ CAN_ID_EXTENDED
Definition at32f413_can.h:235
CAN_MODE_COMMUNICATE
@ CAN_MODE_COMMUNICATE
Definition at32f413_can.h:164
CAN_MODE_LISTENONLY
@ CAN_MODE_LISTENONLY
Definition at32f413_can.h:166
CAN_MODE_LISTENONLY_LOOPBACK
@ CAN_MODE_LISTENONLY_LOOPBACK
Definition at32f413_can.h:167
CAN_MODE_LOOPBACK
@ CAN_MODE_LOOPBACK
Definition at32f413_can.h:165
CAN_RSAW_1TQ
@ CAN_RSAW_1TQ
Definition at32f413_can.h:185
CAN_RSAW_4TQ
@ CAN_RSAW_4TQ
Definition at32f413_can.h:188
CAN_RSAW_3TQ
@ CAN_RSAW_3TQ
Definition at32f413_can.h:187
CAN_RSAW_2TQ
@ CAN_RSAW_2TQ
Definition at32f413_can.h:186
error_status
error_status
error status
Definition at32f413.h:302
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
flag_status
flag_status
flag status
Definition at32f413.h:292
can_base_type
can init structure definition
Definition at32f413_can.h:332
can_base_type::prsf_enable
confirm_state prsf_enable
Definition at32f413_can.h:341
can_base_type::mdrsel_selection
can_msg_discarding_rule_type mdrsel_selection
Definition at32f413_can.h:343
can_base_type::aed_enable
confirm_state aed_enable
Definition at32f413_can.h:339
can_base_type::mmssr_selection
can_msg_sending_rule_type mmssr_selection
Definition at32f413_can.h:345
can_base_type::ttc_enable
confirm_state ttc_enable
Definition at32f413_can.h:335
can_base_type::mode_selection
can_mode_type mode_selection
Definition at32f413_can.h:333
can_base_type::aebo_enable
confirm_state aebo_enable
Definition at32f413_can.h:337
can_baudrate_type
can baudrate structure definition
Definition at32f413_can.h:353
can_baudrate_type::baudrate_div
uint16_t baudrate_div
Definition at32f413_can.h:354
can_baudrate_type::rsaw_size
can_rsaw_type rsaw_size
Definition at32f413_can.h:356
can_baudrate_type::bts2_size
can_bts2_type bts2_size
Definition at32f413_can.h:360
can_baudrate_type::bts1_size
can_bts1_type bts1_size
Definition at32f413_can.h:358
can_fifo_mailbox_type
can controller area network fifo mailbox
Definition at32f413_can.h:510
can_fifo_mailbox_type::rfdt4
__IO uint32_t rfdt4
Definition at32f413_can.h:565
can_fifo_mailbox_type::rfi
__IO uint32_t rfi
Definition at32f413_can.h:516
can_fifo_mailbox_type::rfdt0
__IO uint32_t rfdt0
Definition at32f413_can.h:550
can_fifo_mailbox_type::rfsid
__IO uint32_t rfsid
Definition at32f413_can.h:523
can_fifo_mailbox_type::rfdt2
__IO uint32_t rfdt2
Definition at32f413_can.h:552
can_fifo_mailbox_type::rfdth
__IO uint32_t rfdth
Definition at32f413_can.h:562
can_fifo_mailbox_type::rfdtl
__IO uint32_t rfdtl
Definition at32f413_can.h:535
can_fifo_mailbox_type::rfidi
__IO uint32_t rfidi
Definition at32f413_can.h:521
can_fifo_mailbox_type::rfdt1
__IO uint32_t rfdt1
Definition at32f413_can.h:551
can_fifo_mailbox_type::reserved1
__IO uint32_t reserved1
Definition at32f413_can.h:519
can_fifo_mailbox_type::rfdt6
__IO uint32_t rfdt6
Definition at32f413_can.h:567
can_fifo_mailbox_type::rffri
__IO uint32_t rffri
Definition at32f413_can.h:520
can_fifo_mailbox_type::rfc
__IO uint32_t rfc
Definition at32f413_can.h:532
can_fifo_mailbox_type::rfdt3
__IO uint32_t rfdt3
Definition at32f413_can.h:553
can_fifo_mailbox_type::rfdt5
__IO uint32_t rfdt5
Definition at32f413_can.h:566
can_fifo_mailbox_type::rfdt7
__IO uint32_t rfdt7
Definition at32f413_can.h:568
can_fifo_mailbox_type::rfts
__IO uint32_t rfts
Definition at32f413_can.h:538
can_fifo_mailbox_type::rffmn
__IO uint32_t rffmn
Definition at32f413_can.h:537
can_fifo_mailbox_type::rfeid
__IO uint32_t rfeid
Definition at32f413_can.h:522
can_filter_init_type
can filter init structure definition
Definition at32f413_can.h:368
can_filter_init_type::filter_mask_low
uint16_t filter_mask_low
Definition at32f413_can.h:388
can_filter_init_type::filter_number
uint8_t filter_number
Definition at32f413_can.h:375
can_filter_init_type::filter_fifo
can_filter_fifo_type filter_fifo
Definition at32f413_can.h:373
can_filter_init_type::filter_bit
can_filter_bit_width_type filter_bit
Definition at32f413_can.h:377
can_filter_init_type::filter_mode
can_filter_mode_type filter_mode
Definition at32f413_can.h:371
can_filter_init_type::filter_activate_enable
confirm_state filter_activate_enable
Definition at32f413_can.h:369
can_filter_init_type::filter_mask_high
uint16_t filter_mask_high
Definition at32f413_can.h:385
can_filter_init_type::filter_id_high
uint16_t filter_id_high
Definition at32f413_can.h:379
can_filter_init_type::filter_id_low
uint16_t filter_id_low
Definition at32f413_can.h:382
can_filter_register_type
can controller area network filter bit register
Definition at32f413_can.h:577
can_filter_register_type::ffdb1
__IO uint32_t ffdb1
Definition at32f413_can.h:578
can_filter_register_type::ffdb2
__IO uint32_t ffdb2
Definition at32f413_can.h:579
can_rx_message_type
can rx message structure definition
Definition at32f413_can.h:418
can_rx_message_type::standard_id
uint32_t standard_id
Definition at32f413_can.h:419
can_rx_message_type::id_type
can_identifier_type id_type
Definition at32f413_can.h:425
can_rx_message_type::frame_type
can_trans_frame_type frame_type
Definition at32f413_can.h:427
can_rx_message_type::dlc
uint8_t dlc
Definition at32f413_can.h:429
can_rx_message_type::extended_id
uint32_t extended_id
Definition at32f413_can.h:422
can_rx_message_type::filter_index
uint8_t filter_index
Definition at32f413_can.h:434
can_tx_mailbox_type
can controller area network tx mailbox
Definition at32f413_can.h:442
can_tx_mailbox_type::tmdt5
__IO uint32_t tmdt5
Definition at32f413_can.h:499
can_tx_mailbox_type::tmtsten
__IO uint32_t tmtsten
Definition at32f413_can.h:469
can_tx_mailbox_type::tmi
__IO uint32_t tmi
Definition at32f413_can.h:448
can_tx_mailbox_type::tmc
__IO uint32_t tmc
Definition at32f413_can.h:464
can_tx_mailbox_type::tmts
__IO uint32_t tmts
Definition at32f413_can.h:471
can_tx_mailbox_type::tmdt0
__IO uint32_t tmdt0
Definition at32f413_can.h:483
can_tx_mailbox_type::tmsr
__IO uint32_t tmsr
Definition at32f413_can.h:451
can_tx_mailbox_type::tmdtl
__IO uint32_t tmdtl
Definition at32f413_can.h:480
can_tx_mailbox_type::tmdt2
__IO uint32_t tmdt2
Definition at32f413_can.h:485
can_tx_mailbox_type::tmdtbl
__IO uint32_t tmdtbl
Definition at32f413_can.h:467
can_tx_mailbox_type::tmdt3
__IO uint32_t tmdt3
Definition at32f413_can.h:486
can_tx_mailbox_type::tmdt1
__IO uint32_t tmdt1
Definition at32f413_can.h:484
can_tx_mailbox_type::tmdt4
__IO uint32_t tmdt4
Definition at32f413_can.h:498
can_tx_mailbox_type::tmfrsel
__IO uint32_t tmfrsel
Definition at32f413_can.h:452
can_tx_mailbox_type::tmsid
__IO uint32_t tmsid
Definition at32f413_can.h:455
can_tx_mailbox_type::tmdt6
__IO uint32_t tmdt6
Definition at32f413_can.h:500
can_tx_mailbox_type::tmdth
__IO uint32_t tmdth
Definition at32f413_can.h:495
can_tx_mailbox_type::reserved1
__IO uint32_t reserved1
Definition at32f413_can.h:468
can_tx_mailbox_type::tmidsel
__IO uint32_t tmidsel
Definition at32f413_can.h:453
can_tx_mailbox_type::tmdt7
__IO uint32_t tmdt7
Definition at32f413_can.h:501
can_tx_mailbox_type::reserved2
__IO uint32_t reserved2
Definition at32f413_can.h:470
can_tx_mailbox_type::tmeid
__IO uint32_t tmeid
Definition at32f413_can.h:454
can_tx_message_type
can tx message structure definition
Definition at32f413_can.h:396
can_tx_message_type::extended_id
uint32_t extended_id
Definition at32f413_can.h:400
can_tx_message_type::frame_type
can_trans_frame_type frame_type
Definition at32f413_can.h:405
can_tx_message_type::dlc
uint8_t dlc
Definition at32f413_can.h:407
can_tx_message_type::id_type
can_identifier_type id_type
Definition at32f413_can.h:403
can_tx_message_type::standard_id
uint32_t standard_id
Definition at32f413_can.h:397
can_type
type define can register all
Definition at32f413_can.h:586
can_type::tmnr
__IO uint32_t tmnr
Definition at32f413_can.h:659
can_type::fbwsel10
__IO uint32_t fbwsel10
Definition at32f413_can.h:852
can_type::rf0of
__IO uint32_t rf0of
Definition at32f413_can.h:680
can_type::tm1alf
__IO uint32_t tm1alf
Definition at32f413_can.h:649
can_type::tm2lpf
__IO uint32_t tm2lpf
Definition at32f413_can.h:665
can_type::fmsel13
__IO uint32_t fmsel13
Definition at32f413_can.h:824
can_type::tm2ef
__IO uint32_t tm2ef
Definition at32f413_can.h:662
can_type::tm2ct
__IO uint32_t tm2ct
Definition at32f413_can.h:658
can_type::frfsel1
__IO uint32_t frfsel1
Definition at32f413_can.h:874
can_type::frfsel12
__IO uint32_t frfsel12
Definition at32f413_can.h:885
can_type::fmsel4
__IO uint32_t fmsel4
Definition at32f413_can.h:815
can_type::etrien
__IO uint32_t etrien
Definition at32f413_can.h:722
can_type::tm1tef
__IO uint32_t tm1tef
Definition at32f413_can.h:650
can_type::fbwsel8
__IO uint32_t fbwsel8
Definition at32f413_can.h:850
can_type::boien
__IO uint32_t boien
Definition at32f413_can.h:721
can_type::eoien
__IO uint32_t eoien
Definition at32f413_can.h:724
can_type::fctrl
__IO uint32_t fctrl
Definition at32f413_can.h:795
can_type::frfsel4
__IO uint32_t frfsel4
Definition at32f413_can.h:877
can_type::tm0ct
__IO uint32_t tm0ct
Definition at32f413_can.h:646
can_type::eaf
__IO uint32_t eaf
Definition at32f413_can.h:739
can_type::rf1
__IO uint32_t rf1
Definition at32f413_can.h:691
can_type::tm0tsf
__IO uint32_t tm0tsf
Definition at32f413_can.h:642
can_type::tm0lpf
__IO uint32_t tm0lpf
Definition at32f413_can.h:663
can_type::frfsel2
__IO uint32_t frfsel2
Definition at32f413_can.h:875
can_type::aeden
__IO uint32_t aeden
Definition at32f413_can.h:601
can_type::dzc
__IO uint32_t dzc
Definition at32f413_can.h:620
can_type::fmsel0
__IO uint32_t fmsel0
Definition at32f413_can.h:811
can_type::faen4
__IO uint32_t faen4
Definition at32f413_can.h:908
can_type::tm0tcf
__IO uint32_t tm0tcf
Definition at32f413_can.h:641
can_type::fmsel12
__IO uint32_t fmsel12
Definition at32f413_can.h:823
can_type::eaien
__IO uint32_t eaien
Definition at32f413_can.h:719
can_type::fbwsel4
__IO uint32_t fbwsel4
Definition at32f413_can.h:846
can_type::fbwsel9
__IO uint32_t fbwsel9
Definition at32f413_can.h:851
can_type::reserved5
__IO uint32_t reserved5
can reserved register, offset:0x218
Definition at32f413_can.h:894
can_type::edzif
__IO uint32_t edzif
Definition at32f413_can.h:623
can_type::frfsel11
__IO uint32_t frfsel11
Definition at32f413_can.h:884
can_type::fmsel9
__IO uint32_t fmsel9
Definition at32f413_can.h:820
can_type::frfsel10
__IO uint32_t frfsel10
Definition at32f413_can.h:883
can_type::mctrl
__IO uint32_t mctrl
Definition at32f413_can.h:593
can_type::frfsel13
__IO uint32_t frfsel13
Definition at32f413_can.h:886
can_type::faen7
__IO uint32_t faen7
Definition at32f413_can.h:911
can_type::faen6
__IO uint32_t faen6
Definition at32f413_can.h:910
can_type::mdrsel
__IO uint32_t mdrsel
Definition at32f413_can.h:599
can_type::faen8
__IO uint32_t faen8
Definition at32f413_can.h:912
can_type::rf0fien
__IO uint32_t rf0fien
Definition at32f413_can.h:713
can_type::rf1ff
__IO uint32_t rf1ff
Definition at32f413_can.h:696
can_type::cuss
__IO uint32_t cuss
Definition at32f413_can.h:625
can_type::bof
__IO uint32_t bof
Definition at32f413_can.h:741
can_type::faen10
__IO uint32_t faen10
Definition at32f413_can.h:914
can_type::tec
__IO uint32_t tec
Definition at32f413_can.h:745
can_type::btmg
__IO uint32_t btmg
Definition at32f413_can.h:755
can_type::fbwsel0
__IO uint32_t fbwsel0
Definition at32f413_can.h:842
can_type::sprst
__IO uint32_t sprst
Definition at32f413_can.h:605
can_type::ttcen
__IO uint32_t ttcen
Definition at32f413_can.h:603
can_type::tm1tcf
__IO uint32_t tm1tcf
Definition at32f413_can.h:647
can_type::lben
__IO uint32_t lben
Definition at32f413_can.h:765
can_type::ptd
__IO uint32_t ptd
Definition at32f413_can.h:606
can_type::fzc
__IO uint32_t fzc
Definition at32f413_can.h:619
can_type::epien
__IO uint32_t epien
Definition at32f413_can.h:720
can_type::fbwsel11
__IO uint32_t fbwsel11
Definition at32f413_can.h:853
can_type::faen3
__IO uint32_t faen3
Definition at32f413_can.h:907
can_type::rf1oien
__IO uint32_t rf1oien
Definition at32f413_can.h:717
can_type::rf0oien
__IO uint32_t rf0oien
Definition at32f413_can.h:714
can_type::tm0ef
__IO uint32_t tm0ef
Definition at32f413_can.h:660
can_type::fbwsel1
__IO uint32_t fbwsel1
Definition at32f413_can.h:843
can_type::frfsel8
__IO uint32_t frfsel8
Definition at32f413_can.h:881
can_type::fbwsel6
__IO uint32_t fbwsel6
Definition at32f413_can.h:848
can_type::bts2
__IO uint32_t bts2
Definition at32f413_can.h:761
can_type::loen
__IO uint32_t loen
Definition at32f413_can.h:766
can_type::fbwsel7
__IO uint32_t fbwsel7
Definition at32f413_can.h:849
can_type::fmsel3
__IO uint32_t fmsel3
Definition at32f413_can.h:814
can_type::ests
__IO uint32_t ests
Definition at32f413_can.h:736
can_type::frfsel9
__IO uint32_t frfsel9
Definition at32f413_can.h:882
can_type::frf
__IO uint32_t frf
Definition at32f413_can.h:870
can_type::reserved4
__IO uint32_t reserved4
can reserved register, offset:0x210
Definition at32f413_can.h:863
can_type::qdzien
__IO uint32_t qdzien
Definition at32f413_can.h:725
can_type::fbwsel13
__IO uint32_t fbwsel13
Definition at32f413_can.h:855
can_type::reserved3
__IO uint32_t reserved3
can reserved register, offset:0x208
Definition at32f413_can.h:657
can_type::rsaw
__IO uint32_t rsaw
Definition at32f413_can.h:763
can_type::rf0r
__IO uint32_t rf0r
Definition at32f413_can.h:681
can_type::rf0
__IO uint32_t rf0
Definition at32f413_can.h:674
can_type::rf1mien
__IO uint32_t rf1mien
Definition at32f413_can.h:715
can_type::fmsel1
__IO uint32_t fmsel1
Definition at32f413_can.h:812
can_type::frfsel6
__IO uint32_t frfsel6
Definition at32f413_can.h:879
can_type::tm1ct
__IO uint32_t tm1ct
Definition at32f413_can.h:652
can_type::rf0mien
__IO uint32_t rf0mien
Definition at32f413_can.h:712
can_type::rf1mn
__IO uint32_t rf1mn
Definition at32f413_can.h:694
can_type::edzien
__IO uint32_t edzien
Definition at32f413_can.h:726
can_type::reserved1
__IO uint32_t reserved1
can reserved register, offset:0x20~0x17C
Definition at32f413_can.h:604
can_type::prsfen
__IO uint32_t prsfen
Definition at32f413_can.h:600
can_type::facfg
__IO uint32_t facfg
Definition at32f413_can.h:901
can_type::fmsel11
__IO uint32_t fmsel11
Definition at32f413_can.h:822
can_type::tm1ef
__IO uint32_t tm1ef
Definition at32f413_can.h:661
can_type::realrx
__IO uint32_t realrx
Definition at32f413_can.h:628
can_type::aeboen
__IO uint32_t aeboen
Definition at32f413_can.h:602
can_type::eoif
__IO uint32_t eoif
Definition at32f413_can.h:621
can_type::tm2tcf
__IO uint32_t tm2tcf
Definition at32f413_can.h:653
can_type::faen11
__IO uint32_t faen11
Definition at32f413_can.h:915
can_type::faen1
__IO uint32_t faen1
Definition at32f413_can.h:905
can_type::brdiv
__IO uint32_t brdiv
Definition at32f413_can.h:758
can_type::fmsel2
__IO uint32_t fmsel2
Definition at32f413_can.h:813
can_type::fbwsel3
__IO uint32_t fbwsel3
Definition at32f413_can.h:845
can_type::frfsel7
__IO uint32_t frfsel7
Definition at32f413_can.h:880
can_type::epf
__IO uint32_t epf
Definition at32f413_can.h:740
can_type::faen0
__IO uint32_t faen0
Definition at32f413_can.h:904
can_type::dzen
__IO uint32_t dzen
Definition at32f413_can.h:597
can_type::tm2alf
__IO uint32_t tm2alf
Definition at32f413_can.h:655
can_type::faen2
__IO uint32_t faen2
Definition at32f413_can.h:906
can_type::fmsel10
__IO uint32_t fmsel10
Definition at32f413_can.h:821
can_type::etr
__IO uint32_t etr
Definition at32f413_can.h:743
can_type::tsts
__IO uint32_t tsts
Definition at32f413_can.h:638
can_type::fbwsel5
__IO uint32_t fbwsel5
Definition at32f413_can.h:847
can_type::fbwcfg
__IO uint32_t fbwcfg
Definition at32f413_can.h:839
can_type::qdzif
__IO uint32_t qdzif
Definition at32f413_can.h:622
can_type::tcien
__IO uint32_t tcien
Definition at32f413_can.h:711
can_type::fbwsel2
__IO uint32_t fbwsel2
Definition at32f413_can.h:844
can_type::fmsel8
__IO uint32_t fmsel8
Definition at32f413_can.h:819
can_type::rf0mn
__IO uint32_t rf0mn
Definition at32f413_can.h:677
can_type::fmsel5
__IO uint32_t fmsel5
Definition at32f413_can.h:816
can_type::rf0ff
__IO uint32_t rf0ff
Definition at32f413_can.h:679
can_type::frfsel0
__IO uint32_t frfsel0
Definition at32f413_can.h:873
can_type::reserved2
__IO uint32_t reserved2
can reserved register, offset:0x1D0~0x1FC
Definition at32f413_can.h:607
can_type::fcs
__IO uint32_t fcs
Definition at32f413_can.h:798
can_type::msts
__IO uint32_t msts
Definition at32f413_can.h:616
can_type::lsamprx
__IO uint32_t lsamprx
Definition at32f413_can.h:627
can_type::faen13
__IO uint32_t faen13
Definition at32f413_can.h:917
can_type::tm0alf
__IO uint32_t tm0alf
Definition at32f413_can.h:643
can_type::rec
__IO uint32_t rec
Definition at32f413_can.h:746
can_type::bts1
__IO uint32_t bts1
Definition at32f413_can.h:760
can_type::fmsel7
__IO uint32_t fmsel7
Definition at32f413_can.h:818
can_type::rf1r
__IO uint32_t rf1r
Definition at32f413_can.h:698
can_type::tm1lpf
__IO uint32_t tm1lpf
Definition at32f413_can.h:664
can_type::tm2tsf
__IO uint32_t tm2tsf
Definition at32f413_can.h:654
can_type::frfsel5
__IO uint32_t frfsel5
Definition at32f413_can.h:878
can_type::faen9
__IO uint32_t faen9
Definition at32f413_can.h:913
can_type::fmsel6
__IO uint32_t fmsel6
Definition at32f413_can.h:817
can_type::rf1fien
__IO uint32_t rf1fien
Definition at32f413_can.h:716
can_type::faen5
__IO uint32_t faen5
Definition at32f413_can.h:909
can_type::rf1of
__IO uint32_t rf1of
Definition at32f413_can.h:697
can_type::fbwsel12
__IO uint32_t fbwsel12
Definition at32f413_can.h:854
can_type::tm0tef
__IO uint32_t tm0tef
Definition at32f413_can.h:644
can_type::fzen
__IO uint32_t fzen
Definition at32f413_can.h:596
can_type::mmssr
__IO uint32_t mmssr
Definition at32f413_can.h:598
can_type::faen12
__IO uint32_t faen12
Definition at32f413_can.h:916
can_type::frfsel3
__IO uint32_t frfsel3
Definition at32f413_can.h:876
can_type::tm2tef
__IO uint32_t tm2tef
Definition at32f413_can.h:656
can_type::inten
__IO uint32_t inten
Definition at32f413_can.h:708
can_type::fmcfg
__IO uint32_t fmcfg
Definition at32f413_can.h:808
can_type::tm1tsf
__IO uint32_t tm1tsf
Definition at32f413_can.h:648
can_type::curs
__IO uint32_t curs
Definition at32f413_can.h:626


AT32F413 Firmwary Library: at32f413_crc.c Source File

  • libraries
  • drivers
  • src
at32f413_crc.c
Go to the documentation of this file.
1
26#include "at32f413_conf.h"
27
37#ifdef CRC_MODULE_ENABLED
38
48void crc_data_reset(void)
49{
50 /* reset crc generator */
51 CRC->ctrl_bit.rst = 0x1;
52}
53
59uint32_t crc_one_word_calculate(uint32_t data)
60{
61 CRC->dt = data;
62 return (CRC->dt);
63}
64
71uint32_t crc_block_calculate(uint32_t *pbuffer, uint32_t length)
72{
73 uint32_t index = 0;
74
75 for(index = 0; index < length; index++)
76 {
77 CRC->dt = pbuffer[index];
78 }
79
80 return (CRC->dt);
81}
82
88uint32_t crc_data_get(void)
89{
90 return (CRC->dt);
91}
92
98void crc_common_data_set(uint8_t cdt_value)
99{
100 CRC->cdt_bit.cdt = cdt_value;
101}
102
108uint8_t crc_common_data_get(void)
109{
110 return (CRC->cdt_bit.cdt);
111}
112
118void crc_init_data_set(uint32_t value)
119{
120 CRC->idt = value;
121}
122
133void crc_reverse_input_data_set(crc_reverse_input_type value)
134{
135 CRC->ctrl_bit.revid = value;
136}
137
146void crc_reverse_output_data_set(crc_reverse_output_type value)
147{
148 CRC->ctrl_bit.revod = value;
149}
150
157void crc_poly_value_set(uint32_t value)
158{
159 CRC->poly = value;
160}
161
167uint32_t crc_poly_value_get(void)
168{
169 return (CRC->poly);
170}
171
182void crc_poly_size_set(crc_poly_size_type size)
183{
184 CRC->ctrl_bit.poly_size = size;
185}
186
192 crc_poly_size_type crc_poly_size_get(void)
193{
194 return (crc_poly_size_type)(CRC->ctrl_bit.poly_size);
195}
196
201#endif
202
crc_reverse_output_type
crc_reverse_output_type
crc reverse output data
Definition at32f413_crc.h:65
crc_reverse_input_type
crc_reverse_input_type
crc reverse input data
Definition at32f413_crc.h:54
crc_poly_size_type
crc_poly_size_type
crc polynomial size
Definition at32f413_crc.h:74
crc_poly_value_get
uint32_t crc_poly_value_get(void)
return crc polynomial value
Definition at32f413_crc.c:167
crc_reverse_input_data_set
void crc_reverse_input_data_set(crc_reverse_input_type value)
control the reversal of the bit order in the input data
Definition at32f413_crc.c:133
crc_poly_size_set
void crc_poly_size_set(crc_poly_size_type size)
config crc polynomial data size
Definition at32f413_crc.c:182
crc_poly_value_set
void crc_poly_value_set(uint32_t value)
config crc polynomial value
Definition at32f413_crc.c:157
crc_block_calculate
uint32_t crc_block_calculate(uint32_t *pbuffer, uint32_t length)
compute the 32-bit crc of a given buffer of data word(32-bit).
Definition at32f413_crc.c:71
crc_init_data_set
void crc_init_data_set(uint32_t value)
set the 32-bit initial data of crc
Definition at32f413_crc.c:118
crc_common_data_set
void crc_common_data_set(uint8_t cdt_value)
store a 8-bit data in the common data register.
Definition at32f413_crc.c:98
crc_data_reset
void crc_data_reset(void)
reset the crc data register.
Definition at32f413_crc.c:48
crc_data_get
uint32_t crc_data_get(void)
return the current crc value.
Definition at32f413_crc.c:88
crc_one_word_calculate
uint32_t crc_one_word_calculate(uint32_t data)
compute the 32-bit crc of a given data word(32-bit).
Definition at32f413_crc.c:59
crc_poly_size_get
crc_poly_size_type crc_poly_size_get(void)
return crc polynomial data size
Definition at32f413_crc.c:192
crc_reverse_output_data_set
void crc_reverse_output_data_set(crc_reverse_output_type value)
control the reversal of the bit order in the output data
Definition at32f413_crc.c:146
crc_common_data_get
uint8_t crc_common_data_get(void)
return the 8-bit data stored in the common data register
Definition at32f413_crc.c:108
CRC
#define CRC
Definition at32f413_crc.h:163
at32f413_conf.h
at32f413 config header file


AT32F413 Firmwary Library: at32f413_crc.h Source File

  • libraries
  • drivers
  • inc
at32f413_crc.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CRC_H
28#define __AT32F413_CRC_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34
35/* includes ------------------------------------------------------------------*/
36#include "at32f413.h"
37
53typedef enum
54{
55 CRC_REVERSE_INPUT_NO_AFFECTE = 0x00,
56 CRC_REVERSE_INPUT_BY_BYTE = 0x01,
57 CRC_REVERSE_INPUT_BY_HALFWORD = 0x02,
58 CRC_REVERSE_INPUT_BY_WORD = 0x03
59} crc_reverse_input_type;
60
64typedef enum
65{
66 CRC_REVERSE_OUTPUT_NO_AFFECTE = 0x00,
67 CRC_REVERSE_OUTPUT_DATA = 0x01
68} crc_reverse_output_type;
69
73typedef enum
74{
75 CRC_POLY_SIZE_32B = 0x00,
76 CRC_POLY_SIZE_16B = 0x01,
77 CRC_POLY_SIZE_8B = 0x02,
78 CRC_POLY_SIZE_7B = 0x03
79} crc_poly_size_type;
80
84typedef struct
85{
89 union
90 {
91 __IO uint32_t dt;
92 struct
93 {
94 __IO uint32_t dt : 32; /* [31:0] */
95 } dt_bit;
96 };
97
101 union
102 {
103 __IO uint32_t cdt;
104 struct
105 {
106 __IO uint32_t cdt : 8 ; /* [7:0] */
107 __IO uint32_t reserved1 : 24 ;/* [31:8] */
108 } cdt_bit;
109 };
110
114 union
115 {
116 __IO uint32_t ctrl;
117 struct
118 {
119 __IO uint32_t rst : 1 ; /* [0] */
120 __IO uint32_t reserved1 : 2 ; /* [2:1] */
121 __IO uint32_t poly_size : 2 ; /* [4:3] */
122 __IO uint32_t revid : 2 ; /* [6:5] */
123 __IO uint32_t revod : 1 ; /* [7] */
124 __IO uint32_t reserved2 : 24 ;/* [31:8] */
125 } ctrl_bit;
126 };
127
131 __IO uint32_t reserved1;
132
136 union
137 {
138 __IO uint32_t idt;
139 struct
140 {
141 __IO uint32_t idt : 32; /* [31:0] */
142 } idt_bit;
143 };
144
148 union
149 {
150 __IO uint32_t poly;
151 struct
152 {
153 __IO uint32_t poly : 32; /* [31:0] */
154 } poly_bit;
155 };
156
157} crc_type;
158
163#define CRC ((crc_type *) CRC_BASE)
164
169void crc_data_reset(void);
170uint32_t crc_one_word_calculate(uint32_t data);
171uint32_t crc_block_calculate(uint32_t *pbuffer, uint32_t length);
172uint32_t crc_data_get(void);
173void crc_common_data_set(uint8_t cdt_value);
174uint8_t crc_common_data_get(void);
175void crc_init_data_set(uint32_t value);
176void crc_reverse_input_data_set(crc_reverse_input_type value);
177void crc_reverse_output_data_set(crc_reverse_output_type value);
178void crc_poly_value_set(uint32_t value);
179uint32_t crc_poly_value_get(void);
180void crc_poly_size_set(crc_poly_size_type size);
181 crc_poly_size_type crc_poly_size_get(void);
182
195#ifdef __cplusplus
196}
197#endif
198
199#endif
at32f413.h
at32f413 header file
crc_poly_value_get
uint32_t crc_poly_value_get(void)
return crc polynomial value
Definition at32f413_crc.c:167
crc_reverse_input_data_set
void crc_reverse_input_data_set(crc_reverse_input_type value)
control the reversal of the bit order in the input data
Definition at32f413_crc.c:133
crc_poly_size_set
void crc_poly_size_set(crc_poly_size_type size)
config crc polynomial data size
Definition at32f413_crc.c:182
crc_poly_value_set
void crc_poly_value_set(uint32_t value)
config crc polynomial value
Definition at32f413_crc.c:157
crc_block_calculate
uint32_t crc_block_calculate(uint32_t *pbuffer, uint32_t length)
compute the 32-bit crc of a given buffer of data word(32-bit).
Definition at32f413_crc.c:71
crc_init_data_set
void crc_init_data_set(uint32_t value)
set the 32-bit initial data of crc
Definition at32f413_crc.c:118
crc_common_data_set
void crc_common_data_set(uint8_t cdt_value)
store a 8-bit data in the common data register.
Definition at32f413_crc.c:98
crc_data_reset
void crc_data_reset(void)
reset the crc data register.
Definition at32f413_crc.c:48
crc_data_get
uint32_t crc_data_get(void)
return the current crc value.
Definition at32f413_crc.c:88
crc_one_word_calculate
uint32_t crc_one_word_calculate(uint32_t data)
compute the 32-bit crc of a given data word(32-bit).
Definition at32f413_crc.c:59
crc_poly_size_get
crc_poly_size_type crc_poly_size_get(void)
return crc polynomial data size
Definition at32f413_crc.c:192
crc_reverse_output_data_set
void crc_reverse_output_data_set(crc_reverse_output_type value)
control the reversal of the bit order in the output data
Definition at32f413_crc.c:146
crc_common_data_get
uint8_t crc_common_data_get(void)
return the 8-bit data stored in the common data register
Definition at32f413_crc.c:108
crc_reverse_output_type
crc_reverse_output_type
crc reverse output data
Definition at32f413_crc.h:65
crc_reverse_input_type
crc_reverse_input_type
crc reverse input data
Definition at32f413_crc.h:54
crc_poly_size_type
crc_poly_size_type
crc polynomial size
Definition at32f413_crc.h:74
CRC_REVERSE_OUTPUT_DATA
@ CRC_REVERSE_OUTPUT_DATA
Definition at32f413_crc.h:67
CRC_REVERSE_OUTPUT_NO_AFFECTE
@ CRC_REVERSE_OUTPUT_NO_AFFECTE
Definition at32f413_crc.h:66
CRC_REVERSE_INPUT_BY_HALFWORD
@ CRC_REVERSE_INPUT_BY_HALFWORD
Definition at32f413_crc.h:57
CRC_REVERSE_INPUT_BY_WORD
@ CRC_REVERSE_INPUT_BY_WORD
Definition at32f413_crc.h:58
CRC_REVERSE_INPUT_BY_BYTE
@ CRC_REVERSE_INPUT_BY_BYTE
Definition at32f413_crc.h:56
CRC_REVERSE_INPUT_NO_AFFECTE
@ CRC_REVERSE_INPUT_NO_AFFECTE
Definition at32f413_crc.h:55
CRC_POLY_SIZE_8B
@ CRC_POLY_SIZE_8B
Definition at32f413_crc.h:77
CRC_POLY_SIZE_32B
@ CRC_POLY_SIZE_32B
Definition at32f413_crc.h:75
CRC_POLY_SIZE_7B
@ CRC_POLY_SIZE_7B
Definition at32f413_crc.h:78
CRC_POLY_SIZE_16B
@ CRC_POLY_SIZE_16B
Definition at32f413_crc.h:76
crc_type
type define crc register all
Definition at32f413_crc.h:85
crc_type::ctrl
__IO uint32_t ctrl
Definition at32f413_crc.h:116
crc_type::cdt
__IO uint32_t cdt
Definition at32f413_crc.h:103
crc_type::poly
__IO uint32_t poly
Definition at32f413_crc.h:150
crc_type::dt
__IO uint32_t dt
Definition at32f413_crc.h:91
crc_type::reserved2
__IO uint32_t reserved2
Definition at32f413_crc.h:124
crc_type::rst
__IO uint32_t rst
Definition at32f413_crc.h:119
crc_type::revod
__IO uint32_t revod
Definition at32f413_crc.h:123
crc_type::idt
__IO uint32_t idt
Definition at32f413_crc.h:138
crc_type::poly_size
__IO uint32_t poly_size
Definition at32f413_crc.h:121
crc_type::reserved1
__IO uint32_t reserved1
crm reserved1 register, offset:0x0C
Definition at32f413_crc.h:107
crc_type::revid
__IO uint32_t revid
Definition at32f413_crc.h:122


AT32F413 Firmwary Library: at32f413_crm.c Source File

  • libraries
  • drivers
  • src
at32f413_crm.c
Go to the documentation of this file.
1
26#include "at32f413_conf.h"
27
37#ifdef CRM_MODULE_ENABLED
38
48void crm_reset(void)
49{
50 /* reset the crm clock configuration to the default reset state(for debug purpose) */
51 /* set hicken bit */
52 CRM->ctrl_bit.hicken = TRUE;
53
54 /* wait hick stable */
55 while(CRM->ctrl_bit.hickstbl != SET);
56
57 /* hick used as system clock */
58 CRM->cfg_bit.sclksel = CRM_SCLK_HICK;
59
60 /* wait sclk switch status */
61 while(CRM->cfg_bit.sclksts != CRM_SCLK_HICK);
62
63 /* reset hexten, hextbyps, cfden and pllen bits */
64 CRM->ctrl &= ~(0x010D0000U);
65
66 /* reset cfg register, include sclk switch, ahbdiv, apb1div, apb2div, adcdiv,
67 clkout pllrcs, pllhextdiv, pllmult, usbdiv and pllrange bits */
68 CRM->cfg = 0;
69
70 /* reset clkout[3], usbbufs, hickdiv, clkoutdiv */
71 CRM->misc1 = 0;
72
73 /* disable all interrupts enable and clear pending bits */
74 CRM->clkint = 0x009F0000;
75}
76
82void crm_lext_bypass(confirm_state new_state)
83{
84 CRM->bpdc_bit.lextbyps = new_state;
85}
86
92void crm_hext_bypass(confirm_state new_state)
93{
94 CRM->ctrl_bit.hextbyps = new_state;
95}
96
121 flag_status crm_flag_get(uint32_t flag)
122{
123 flag_status status = RESET;
124 if((CRM_REG(flag) & CRM_REG_BIT(flag)) != CRM_REG_BIT(flag))
125 {
126 status = RESET;
127 }
128 else
129 {
130 status = SET;
131 }
132 return status;
133}
134
147 flag_status crm_interrupt_flag_get(uint32_t flag)
148{
149 flag_status status = RESET;
150 switch(flag)
151 {
152 case CRM_LICK_READY_INT_FLAG:
153 if(CRM->clkint_bit.lickstblf && CRM->clkint_bit.lickstblien)
154 {
155 status = SET;
156 }
157 break;
158 case CRM_LEXT_READY_INT_FLAG:
159 if(CRM->clkint_bit.lextstblf && CRM->clkint_bit.lextstblien)
160 {
161 status = SET;
162 }
163 break;
164 case CRM_HICK_READY_INT_FLAG:
165 if(CRM->clkint_bit.hickstblf && CRM->clkint_bit.hickstblien)
166 {
167 status = SET;
168 }
169 break;
170 case CRM_HEXT_READY_INT_FLAG:
171 if(CRM->clkint_bit.hextstblf && CRM->clkint_bit.hextstblien)
172 {
173 status = SET;
174 }
175 break;
176 case CRM_PLL_READY_INT_FLAG:
177 if(CRM->clkint_bit.pllstblf && CRM->clkint_bit.pllstblien)
178 {
179 status = SET;
180 }
181 break;
182 case CRM_CLOCK_FAILURE_INT_FLAG:
183 if(CRM->clkint_bit.cfdf && CRM->ctrl_bit.cfden)
184 {
185 status = SET;
186 }
187 break;
188 }
189
190 return status;
191}
192
198 error_status crm_hext_stable_wait(void)
199{
200 uint32_t stable_cnt = 0;
201 error_status status = ERROR;
202
203 while((crm_flag_get(CRM_HEXT_STABLE_FLAG) != SET) && (stable_cnt < HEXT_STARTUP_TIMEOUT))
204 {
205 stable_cnt ++;
206 }
207
208 if(crm_flag_get(CRM_HEXT_STABLE_FLAG) != SET)
209 {
210 status = ERROR;
211 }
212 else
213 {
214 status = SUCCESS;
215 }
216
217 return status;
218}
219
225void crm_hick_clock_trimming_set(uint8_t trim_value)
226{
227 CRM->ctrl_bit.hicktrim = trim_value;
228}
229
235void crm_hick_clock_calibration_set(uint8_t cali_value)
236{
237 /* enable write hick calibration */
238 CRM->misc1_bit.hickcal_key = 0x5A;
239
240 /* write hick calibration value */
241 CRM->ctrl_bit.hickcal = cali_value;
242
243 /* disable write hick calibration */
244 CRM->misc1_bit.hickcal_key = 0x0;
245}
246
263void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
264{
265 /* enable periph clock */
266 if(TRUE == new_state)
267 {
268 CRM_REG(value) |= CRM_REG_BIT(value);
269 }
270 /* disable periph clock */
271 else
272 {
273 CRM_REG(value) &= ~(CRM_REG_BIT(value));
274 }
275}
276
293void crm_periph_reset(crm_periph_reset_type value, confirm_state new_state)
294{
295 /* enable periph reset */
296 if(new_state == TRUE)
297 {
298 CRM_REG(value) |= (CRM_REG_BIT(value));
299 }
300 /* disable periph reset */
301 else
302 {
303 CRM_REG(value) &= ~(CRM_REG_BIT(value));
304 }
305}
306
316void crm_periph_sleep_mode_clock_enable(crm_periph_clock_sleepmd_type value, confirm_state new_state)
317{
318 /* enable periph clock in sleep mode */
319 if(new_state == TRUE)
320 {
321 CRM_REG(value) |= (CRM_REG_BIT(value));
322 }
323 /* disable perph clock in sleep mode */
324 else
325 {
326 CRM_REG(value) &= ~(CRM_REG_BIT(value));
327 }
328}
329
342void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
343{
344 switch(source)
345 {
346 case CRM_CLOCK_SOURCE_HICK:
347 CRM->ctrl_bit.hicken = new_state;
348 break;
349 case CRM_CLOCK_SOURCE_HEXT:
350 CRM->ctrl_bit.hexten = new_state;
351 break;
352 case CRM_CLOCK_SOURCE_PLL:
353 CRM->ctrl_bit.pllen = new_state;
354 break;
355 case CRM_CLOCK_SOURCE_LEXT:
356 CRM->bpdc_bit.lexten = new_state;
357 break;
358 case CRM_CLOCK_SOURCE_LICK:
359 CRM->ctrlsts_bit.licken = new_state;
360 break;
361 default:
362 break;
363 }
364}
365
387void crm_flag_clear(uint32_t flag)
388{
389 switch(flag)
390 {
391 case CRM_NRST_RESET_FLAG:
392 case CRM_POR_RESET_FLAG:
393 case CRM_SW_RESET_FLAG:
394 case CRM_WDT_RESET_FLAG:
395 case CRM_WWDT_RESET_FLAG:
396 case CRM_LOWPOWER_RESET_FLAG:
397 case CRM_ALL_RESET_FLAG:
398 CRM->ctrlsts_bit.rstfc = TRUE;
399 while(CRM->ctrlsts_bit.rstfc == TRUE);
400 break;
401 case CRM_LICK_READY_INT_FLAG:
402 CRM->clkint_bit.lickstblfc = TRUE;
403 break;
404 case CRM_LEXT_READY_INT_FLAG:
405 CRM->clkint_bit.lextstblfc = TRUE;
406 break;
407 case CRM_HICK_READY_INT_FLAG:
408 CRM->clkint_bit.hickstblfc = TRUE;
409 break;
410 case CRM_HEXT_READY_INT_FLAG:
411 CRM->clkint_bit.hextstblfc = TRUE;
412 break;
413 case CRM_PLL_READY_INT_FLAG:
414 CRM->clkint_bit.pllstblfc = TRUE;
415 break;
416 case CRM_CLOCK_FAILURE_INT_FLAG:
417 CRM->clkint_bit.cfdfc = TRUE;
418 break;
419 default:
420 break;
421 }
422}
423
433void crm_rtc_clock_select(crm_rtc_clock_type value)
434{
435 CRM->bpdc_bit.rtcsel = value;
436}
437
443void crm_rtc_clock_enable(confirm_state new_state)
444{
445 CRM->bpdc_bit.rtcen = new_state;
446}
447
463void crm_ahb_div_set(crm_ahb_div_type value)
464{
465 CRM->cfg_bit.ahbdiv = value;
466}
467
480void crm_apb1_div_set(crm_apb1_div_type value)
481{
482 CRM->cfg_bit.apb1div = value;
483}
484
497void crm_apb2_div_set(crm_apb2_div_type value)
498{
499 CRM->cfg_bit.apb2div = value;
500}
501
514void crm_adc_clock_div_set(crm_adc_div_type div_value)
515{
516 CRM->cfg_bit.adcdiv_l = div_value & 0x03;
517 CRM->cfg_bit.adcdiv_h = (div_value >> 2) & 0x01;
518}
519
533void crm_usb_clock_div_set(crm_usb_div_type div_value)
534{
535 CRM->cfg_bit.usbdiv_l = div_value & 0x03;
536 CRM->cfg_bit.usbdiv_h = (div_value >> 2) & 0x01;
537}
538
544void crm_clock_failure_detection_enable(confirm_state new_state)
545{
546 CRM->ctrl_bit.cfden = new_state;
547}
548
554void crm_battery_powered_domain_reset(confirm_state new_state)
555{
556 CRM->bpdc_bit.bpdrst = new_state;
557}
558
573void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
574{
575 /* config pll clock source */
576 if(clock_source == CRM_PLL_SOURCE_HICK)
577 {
578 CRM->cfg_bit.pllrcs = FALSE;
579 CRM->misc1_bit.hickdiv = CRM_HICK48_NODIV;
580 }
581 else
582 {
583 CRM->cfg_bit.pllrcs = TRUE;
584 if(CRM_PLL_SOURCE_HEXT == clock_source)
585 {
586 CRM->cfg_bit.pllhextdiv = FALSE;
587 }
588 else
589 {
590 CRM->cfg_bit.pllhextdiv = TRUE;
591 }
592 }
593
594 /* config pll multiplication factor */
595 CRM->cfg_bit.pllmult_l = (mult_value & 0x0F);
596 CRM->cfg_bit.pllmult_h = ((mult_value & 0x30) >> 4);
597
598 /* config pll output range */
599 CRM->cfg_bit.pllrange = pll_range;
600}
601
611void crm_sysclk_switch(crm_sclk_type value)
612{
613 volatile uint32_t i;
614 volatile uint8_t pwc_state;
615 if(value == CRM_SCLK_PLL)
616 {
617 pwc_state = CRM->apb1en_bit.pwcen;
618 if(pwc_state == 0)
619 crm_periph_clock_enable(CRM_PWC_PERIPH_CLOCK, TRUE);
620 *(__IO uint32_t *)0x40007020 = 0x0A;
621 for(i = 0; i < 80; i++)
622 {
623 __NOP();
624 }
625 }
626 CRM->cfg_bit.sclksel = value;
627 DUMMY_NOP();
628 if(value == CRM_SCLK_PLL)
629 {
630 *(__IO uint32_t *)0x40007020 = 0x00;
631 for(i = 0; i < 1500; i++)
632 {
633 __NOP();
634 }
635 if(pwc_state == 0)
636 crm_periph_clock_enable(CRM_PWC_PERIPH_CLOCK, FALSE);
637 }
638}
639
649 crm_sclk_type crm_sysclk_switch_status_get(void)
650{
651 return (crm_sclk_type)CRM->cfg_bit.sclksts;
652}
653
660void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct)
661{
662 uint32_t pll_mult = 0, pll_mult_h = 0, pll_clock_source = 0, temp = 0, div_value = 0;
663 crm_sclk_type sclk_source;
664
665 static const uint8_t sclk_ahb_div_table[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};
666 static const uint8_t ahb_apb1_div_table[8] = {0, 0, 0, 0, 1, 2, 3, 4};
667 static const uint8_t ahb_apb2_div_table[8] = {0, 0, 0, 0, 1, 2, 3, 4};
668 static const uint8_t adc_div_table[8] = {2, 4, 6, 8, 2, 12, 8, 16};
669
670 /* get sclk source */
671 sclk_source = crm_sysclk_switch_status_get();
672
673 switch(sclk_source)
674 {
675 case CRM_SCLK_HICK:
676 if(((CRM->misc3_bit.hick_to_sclk) != RESET) && ((CRM->misc1_bit.hickdiv) != RESET))
677 clocks_struct->sclk_freq = HICK_VALUE * 6;
678 else
679 clocks_struct->sclk_freq = HICK_VALUE;
680 break;
681 case CRM_SCLK_HEXT:
682 clocks_struct->sclk_freq = HEXT_VALUE;
683 break;
684 case CRM_SCLK_PLL:
685 pll_clock_source = CRM->cfg_bit.pllrcs;
686 /* get multiplication factor */
687 pll_mult = CRM->cfg_bit.pllmult_l;
688 pll_mult_h = CRM->cfg_bit.pllmult_h;
689
690 /* process high bits */
691 if((pll_mult_h != 0U) || (pll_mult == 15U))
692 {
693 pll_mult += ((16U * pll_mult_h) + 1U);
694 }
695 else
696 {
697 pll_mult += 2U;
698 }
699
700 if (pll_clock_source == 0x00)
701 {
702 /* hick divided by 2 selected as pll clock entry */
703 clocks_struct->sclk_freq = (HICK_VALUE >> 1) * pll_mult;
704 }
705 else
706 {
707 /* hext selected as pll clock entry */
708 if (CRM->cfg_bit.pllhextdiv != RESET)
709 {
710 /* hext clock divided by 2 */
711 clocks_struct->sclk_freq = (HEXT_VALUE / 2) * pll_mult;
712 }
713 else
714 {
715 clocks_struct->sclk_freq = HEXT_VALUE * pll_mult;
716 }
717 }
718 break;
719 default:
720 clocks_struct->sclk_freq = HICK_VALUE;
721 break;
722 }
723
724 /* compute sclk, ahbclk, abp1clk apb2clk and adcclk frequencies */
725 /* get ahb division */
726 temp = CRM->cfg_bit.ahbdiv;
727 div_value = sclk_ahb_div_table[temp];
728 /* ahbclk frequency */
729 clocks_struct->ahb_freq = clocks_struct->sclk_freq >> div_value;
730
731 /* get apb1 division */
732 temp = CRM->cfg_bit.apb1div;
733 div_value = ahb_apb1_div_table[temp];
734 /* apb1clk frequency */
735 clocks_struct->apb1_freq = clocks_struct->ahb_freq >> div_value;
736
737 /* get apb2 division */
738 temp = CRM->cfg_bit.apb2div;
739 div_value = ahb_apb2_div_table[temp];
740 /* apb2clk frequency */
741 clocks_struct->apb2_freq = clocks_struct->ahb_freq >> div_value;
742
743 /* get adc division */
744 temp = CRM->cfg_bit.adcdiv_h;
745 temp = ((temp << 2) | (CRM->cfg_bit.adcdiv_l));
746 div_value = adc_div_table[temp];
747 /* adcclk clock frequency */
748 clocks_struct->adc_freq = clocks_struct->apb2_freq / div_value;
749}
750
767void crm_clock_out_set(crm_clkout_select_type clkout)
768{
769 CRM->cfg_bit.clkout_sel = clkout & 0x7;
770 CRM->misc1_bit.clkout_sel = (clkout >> 3) & 0x1;
771}
772
785void crm_interrupt_enable(uint32_t crm_int, confirm_state new_state)
786{
787 if(new_state == TRUE)
788 CRM->clkint |= crm_int;
789 else
790 CRM->clkint &= ~crm_int;
791}
792
798void crm_auto_step_mode_enable(confirm_state new_state)
799{
800 if(new_state == TRUE)
801 CRM->misc3_bit.auto_step_en = CRM_AUTO_STEP_MODE_ENABLE;
802 else
803 CRM->misc3_bit.auto_step_en = CRM_AUTO_STEP_MODE_DISABLE;
804}
805
814void crm_usb_interrupt_remapping_set(crm_usb_int_map_type int_remap)
815{
816 CRM->intmap_bit.usbintmap = int_remap;
817}
818
827void crm_hick_divider_select(crm_hick_div_6_type value)
828{
829 CRM->misc1_bit.hickdiv = value;
830}
831
840void crm_hick_sclk_frequency_select(crm_hick_sclk_frequency_type value)
841{
842 crm_hick_divider_select(CRM_HICK48_NODIV);
843 CRM->misc3_bit.hick_to_sclk = value;
844}
845
854void crm_usb_clock_source_select(crm_usb_clock_source_type value)
855{
856 if(value == CRM_USB_CLOCK_SOURCE_HICK)
857 {
858 crm_hick_sclk_frequency_select(CRM_HICK_SCLK_48MHZ);
859 }
860 CRM->misc3_bit.hick_to_usb = value;
861}
862
868void crm_clkout_to_tmr10_enable(confirm_state new_state)
869{
870 CRM->misc2_bit.clk_to_tmr = new_state;
871}
872
888void crm_clkout_div_set(crm_clkout_div_type clkout_div)
889{
890 CRM->misc1_bit.clkoutdiv = clkout_div;
891}
892
897#endif
898
div_value
uint16_t div_value
Definition project/at_start_f413/examples/tmr/oc_high/src/main.c:43
DUMMY_NOP
#define DUMMY_NOP()
Definition system_at32f413.h:48
crm_periph_clock_type
crm_periph_clock_type
crm periph clock
Definition at32f413_crm.h:101
crm_hick_sclk_frequency_type
crm_hick_sclk_frequency_type
crm hick as system clock frequency select
Definition at32f413_crm.h:461
crm_apb1_div_type
crm_apb1_div_type
crm apb1 division
Definition at32f413_crm.h:320
crm_clock_source_type
crm_clock_source_type
crm clock source
Definition at32f413_crm.h:292
crm_usb_div_type
crm_usb_div_type
crm usb division
Definition at32f413_crm.h:357
crm_clkout_div_type
crm_clkout_div_type
crm clkout division
Definition at32f413_crm.h:418
crm_usb_clock_source_type
crm_usb_clock_source_type
crm usb 48 mhz clock source select
Definition at32f413_crm.h:452
crm_periph_clock_sleepmd_type
crm_periph_clock_sleepmd_type
crm periph clock in sleep mode
Definition at32f413_crm.h:193
crm_pll_clock_source_type
crm_pll_clock_source_type
crm pll clock source
Definition at32f413_crm.h:273
crm_pll_mult_type
crm_pll_mult_type
crm pll mult_x
Definition at32f413_crm.h:203
crm_ahb_div_type
crm_ahb_div_type
crm ahb division
Definition at32f413_crm.h:304
crm_rtc_clock_type
crm_rtc_clock_type
crm rtc clock
Definition at32f413_crm.h:371
crm_adc_div_type
crm_adc_div_type
crm adc division
Definition at32f413_crm.h:344
crm_usb_int_map_type
crm_usb_int_map_type
crm usbdev interrupt remap
Definition at32f413_crm.h:443
crm_clkout_select_type
crm_clkout_select_type
crm clkout select
Definition at32f413_crm.h:401
crm_sclk_type
crm_sclk_type
crm sclk select
Definition at32f413_crm.h:391
crm_periph_reset_type
crm_periph_reset_type
crm periph reset
Definition at32f413_crm.h:149
crm_apb2_div_type
crm_apb2_div_type
crm apb2 division
Definition at32f413_crm.h:332
crm_pll_output_range_type
crm_pll_output_range_type
crm pll clock output range
Definition at32f413_crm.h:283
crm_hick_div_6_type
crm_hick_div_6_type
crm hick 48mhz division
Definition at32f413_crm.h:382
CRM_PWC_PERIPH_CLOCK
@ CRM_PWC_PERIPH_CLOCK
Definition at32f413_crm.h:140
CRM_HICK_SCLK_48MHZ
@ CRM_HICK_SCLK_48MHZ
Definition at32f413_crm.h:463
CRM_CLOCK_SOURCE_HICK
@ CRM_CLOCK_SOURCE_HICK
Definition at32f413_crm.h:293
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_LEXT
@ CRM_CLOCK_SOURCE_LEXT
Definition at32f413_crm.h:296
CRM_CLOCK_SOURCE_LICK
@ CRM_CLOCK_SOURCE_LICK
Definition at32f413_crm.h:297
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_USB_CLOCK_SOURCE_HICK
@ CRM_USB_CLOCK_SOURCE_HICK
Definition at32f413_crm.h:454
CRM_PLL_SOURCE_HEXT
@ CRM_PLL_SOURCE_HEXT
Definition at32f413_crm.h:275
CRM_PLL_SOURCE_HICK
@ CRM_PLL_SOURCE_HICK
Definition at32f413_crm.h:274
CRM_AUTO_STEP_MODE_ENABLE
@ CRM_AUTO_STEP_MODE_ENABLE
Definition at32f413_crm.h:436
CRM_AUTO_STEP_MODE_DISABLE
@ CRM_AUTO_STEP_MODE_DISABLE
Definition at32f413_crm.h:435
CRM_SCLK_HICK
@ CRM_SCLK_HICK
Definition at32f413_crm.h:392
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_SCLK_HEXT
@ CRM_SCLK_HEXT
Definition at32f413_crm.h:393
CRM_HICK48_NODIV
@ CRM_HICK48_NODIV
Definition at32f413_crm.h:384
CRM_PLL_READY_INT_FLAG
#define CRM_PLL_READY_INT_FLAG
Definition at32f413_crm.h:70
CRM_HEXT_READY_INT_FLAG
#define CRM_HEXT_READY_INT_FLAG
Definition at32f413_crm.h:69
CRM_LOWPOWER_RESET_FLAG
#define CRM_LOWPOWER_RESET_FLAG
Definition at32f413_crm.h:65
CRM_CLOCK_FAILURE_INT_FLAG
#define CRM_CLOCK_FAILURE_INT_FLAG
Definition at32f413_crm.h:71
CRM_HICK_READY_INT_FLAG
#define CRM_HICK_READY_INT_FLAG
Definition at32f413_crm.h:68
CRM_LEXT_READY_INT_FLAG
#define CRM_LEXT_READY_INT_FLAG
Definition at32f413_crm.h:67
CRM_POR_RESET_FLAG
#define CRM_POR_RESET_FLAG
Definition at32f413_crm.h:61
CRM_HEXT_STABLE_FLAG
#define CRM_HEXT_STABLE_FLAG
Definition at32f413_crm.h:55
CRM_SW_RESET_FLAG
#define CRM_SW_RESET_FLAG
Definition at32f413_crm.h:62
CRM_NRST_RESET_FLAG
#define CRM_NRST_RESET_FLAG
Definition at32f413_crm.h:60
CRM_WWDT_RESET_FLAG
#define CRM_WWDT_RESET_FLAG
Definition at32f413_crm.h:64
CRM_LICK_READY_INT_FLAG
#define CRM_LICK_READY_INT_FLAG
Definition at32f413_crm.h:66
CRM_ALL_RESET_FLAG
#define CRM_ALL_RESET_FLAG
Definition at32f413_crm.h:59
CRM_WDT_RESET_FLAG
#define CRM_WDT_RESET_FLAG
Definition at32f413_crm.h:63
crm_periph_sleep_mode_clock_enable
void crm_periph_sleep_mode_clock_enable(crm_periph_clock_sleepmd_type value, confirm_state new_state)
enable or disable the peripheral clock in sleep mode
Definition at32f413_crm.c:316
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hick_clock_calibration_set
void crm_hick_clock_calibration_set(uint8_t cali_value)
set the crm calibration value
Definition at32f413_crm.c:235
crm_clkout_div_set
void crm_clkout_div_set(crm_clkout_div_type clkout_div)
set crm clkout division
Definition at32f413_crm.c:888
crm_rtc_clock_select
void crm_rtc_clock_select(crm_rtc_clock_type value)
select rtc clock
Definition at32f413_crm.c:433
crm_rtc_clock_enable
void crm_rtc_clock_enable(confirm_state new_state)
enable or disable rtc
Definition at32f413_crm.c:443
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_interrupt_enable
void crm_interrupt_enable(uint32_t crm_int, confirm_state new_state)
config crm interrupt
Definition at32f413_crm.c:785
crm_flag_clear
void crm_flag_clear(uint32_t flag)
clear the crm reset flags
Definition at32f413_crm.c:387
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_lext_bypass
void crm_lext_bypass(confirm_state new_state)
enable or disable crm low speed external crystal bypass
Definition at32f413_crm.c:82
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_hick_sclk_frequency_select
void crm_hick_sclk_frequency_select(crm_hick_sclk_frequency_type value)
hick as system clock frequency select
Definition at32f413_crm.c:840
crm_interrupt_flag_get
flag_status crm_interrupt_flag_get(uint32_t flag)
get crm interrupt flag status
Definition at32f413_crm.c:147
crm_hick_divider_select
void crm_hick_divider_select(crm_hick_div_6_type value)
config hick divider select
Definition at32f413_crm.c:827
crm_adc_clock_div_set
void crm_adc_clock_div_set(crm_adc_div_type div_value)
set crm adc division
Definition at32f413_crm.c:514
crm_clock_out_set
void crm_clock_out_set(crm_clkout_select_type clkout)
set crm clkout
Definition at32f413_crm.c:767
crm_clock_failure_detection_enable
void crm_clock_failure_detection_enable(confirm_state new_state)
enable or disable clock failure detection
Definition at32f413_crm.c:544
crm_periph_reset
void crm_periph_reset(crm_periph_reset_type value, confirm_state new_state)
enable or disable the peripheral reset
Definition at32f413_crm.c:293
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_clkout_to_tmr10_enable
void crm_clkout_to_tmr10_enable(confirm_state new_state)
enable or disable clkout direct to tmr10 channel 1
Definition at32f413_crm.c:868
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_usb_clock_div_set
void crm_usb_clock_div_set(crm_usb_div_type div_value)
set crm usb division
Definition at32f413_crm.c:533
crm_usb_interrupt_remapping_set
void crm_usb_interrupt_remapping_set(crm_usb_int_map_type int_remap)
usbdev interrupt remapping control
Definition at32f413_crm.c:814
crm_hick_clock_trimming_set
void crm_hick_clock_trimming_set(uint8_t trim_value)
set the hick trimming value
Definition at32f413_crm.c:225
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
crm_battery_powered_domain_reset
void crm_battery_powered_domain_reset(confirm_state new_state)
battery powered domain software reset
Definition at32f413_crm.c:554
crm_usb_clock_source_select
void crm_usb_clock_source_select(crm_usb_clock_source_type value)
usb 48 mhz clock source select
Definition at32f413_crm.c:854
crm_hext_bypass
void crm_hext_bypass(confirm_state new_state)
enable or disable crm high speed external crystal bypass
Definition at32f413_crm.c:92
crm_clocks_freq_get
void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
Definition at32f413_crm.c:660
CRM_REG_BIT
#define CRM_REG_BIT(value)
Definition at32f413_crm.h:47
CRM
#define CRM
Definition at32f413_crm.h:843
CRM_REG
#define CRM_REG(value)
Definition at32f413_crm.h:46
error_status
error_status
error status
Definition at32f413.h:302
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
flag_status
flag_status
flag status
Definition at32f413.h:292
ERROR
@ ERROR
Definition at32f413.h:302
SUCCESS
@ SUCCESS
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
SET
@ SET
Definition at32f413.h:292
HEXT_VALUE
#define HEXT_VALUE
in the following line adjust the value of high speed external crystal (hext) used in your application
Definition project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h:43
HICK_VALUE
#define HICK_VALUE
Definition project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h:51
HEXT_STARTUP_TIMEOUT
#define HEXT_STARTUP_TIMEOUT
in the following line adjust the high speed external crystal (hext) startup timeout value
Definition project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h:50
at32f413_conf.h
at32f413 config header file
crm_clocks_freq_type
crm clocks freqency structure
Definition at32f413_crm.h:470
crm_clocks_freq_type::adc_freq
uint32_t adc_freq
Definition at32f413_crm.h:475
crm_clocks_freq_type::apb1_freq
uint32_t apb1_freq
Definition at32f413_crm.h:474
crm_clocks_freq_type::apb2_freq
uint32_t apb2_freq
Definition at32f413_crm.h:473
crm_clocks_freq_type::sclk_freq
uint32_t sclk_freq
Definition at32f413_crm.h:471
crm_clocks_freq_type::ahb_freq
uint32_t ahb_freq
Definition at32f413_crm.h:472


AT32F413 Firmwary Library: at32f413_crm.h Source File

  • libraries
  • drivers
  • inc
at32f413_crm.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CRM_H
28#define __AT32F413_CRM_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34
35/* includes ------------------------------------------------------------------*/
36#include "at32f413.h"
37
46#define CRM_REG(value) PERIPH_REG(CRM_BASE, value)
47#define CRM_REG_BIT(value) PERIPH_REG_BIT(value)
48
54#define CRM_HICK_STABLE_FLAG MAKE_VALUE(0x00, 1)
55#define CRM_HEXT_STABLE_FLAG MAKE_VALUE(0x00, 17)
56#define CRM_PLL_STABLE_FLAG MAKE_VALUE(0x00, 25)
57#define CRM_LEXT_STABLE_FLAG MAKE_VALUE(0x20, 1)
58#define CRM_LICK_STABLE_FLAG MAKE_VALUE(0x24, 1)
59#define CRM_ALL_RESET_FLAG MAKE_VALUE(0x24, 24)
60#define CRM_NRST_RESET_FLAG MAKE_VALUE(0x24, 26)
61#define CRM_POR_RESET_FLAG MAKE_VALUE(0x24, 27)
62#define CRM_SW_RESET_FLAG MAKE_VALUE(0x24, 28)
63#define CRM_WDT_RESET_FLAG MAKE_VALUE(0x24, 29)
64#define CRM_WWDT_RESET_FLAG MAKE_VALUE(0x24, 30)
65#define CRM_LOWPOWER_RESET_FLAG MAKE_VALUE(0x24, 31)
66#define CRM_LICK_READY_INT_FLAG MAKE_VALUE(0x08, 0)
67#define CRM_LEXT_READY_INT_FLAG MAKE_VALUE(0x08, 1)
68#define CRM_HICK_READY_INT_FLAG MAKE_VALUE(0x08, 2)
69#define CRM_HEXT_READY_INT_FLAG MAKE_VALUE(0x08, 3)
70#define CRM_PLL_READY_INT_FLAG MAKE_VALUE(0x08, 4)
71#define CRM_CLOCK_FAILURE_INT_FLAG MAKE_VALUE(0x08, 7)
82#define CRM_LICK_STABLE_INT ((uint32_t)0x00000100)
83#define CRM_LEXT_STABLE_INT ((uint32_t)0x00000200)
84#define CRM_HICK_STABLE_INT ((uint32_t)0x00000400)
85#define CRM_HEXT_STABLE_INT ((uint32_t)0x00000800)
86#define CRM_PLL_STABLE_INT ((uint32_t)0x00001000)
87#define CRM_CLOCK_FAILURE_INT ((uint32_t)0x00800000)
100typedef enum
101{
102 /* ahb periph */
103 CRM_DMA1_PERIPH_CLOCK = MAKE_VALUE(0x14, 0),
104 CRM_DMA2_PERIPH_CLOCK = MAKE_VALUE(0x14, 1),
105 CRM_CRC_PERIPH_CLOCK = MAKE_VALUE(0x14, 6),
106 CRM_SDIO1_PERIPH_CLOCK = MAKE_VALUE(0x14, 10),
107 /* apb2 periph */
108 CRM_IOMUX_PERIPH_CLOCK = MAKE_VALUE(0x18, 0),
109 CRM_GPIOA_PERIPH_CLOCK = MAKE_VALUE(0x18, 2),
110 CRM_GPIOB_PERIPH_CLOCK = MAKE_VALUE(0x18, 3),
111 CRM_GPIOC_PERIPH_CLOCK = MAKE_VALUE(0x18, 4),
112 CRM_GPIOD_PERIPH_CLOCK = MAKE_VALUE(0x18, 5),
113 CRM_GPIOF_PERIPH_CLOCK = MAKE_VALUE(0x18, 7),
114 CRM_ADC1_PERIPH_CLOCK = MAKE_VALUE(0x18, 9),
115 CRM_ADC2_PERIPH_CLOCK = MAKE_VALUE(0x18, 10),
116 CRM_TMR1_PERIPH_CLOCK = MAKE_VALUE(0x18, 11),
117 CRM_SPI1_PERIPH_CLOCK = MAKE_VALUE(0x18, 12),
118 CRM_TMR8_PERIPH_CLOCK = MAKE_VALUE(0x18, 13),
119 CRM_USART1_PERIPH_CLOCK = MAKE_VALUE(0x18, 14),
120 CRM_TMR9_PERIPH_CLOCK = MAKE_VALUE(0x18, 19),
121 CRM_TMR10_PERIPH_CLOCK = MAKE_VALUE(0x18, 20),
122 CRM_TMR11_PERIPH_CLOCK = MAKE_VALUE(0x18, 21),
123 CRM_ACC_PERIPH_CLOCK = MAKE_VALUE(0x18, 22),
124 /* apb1 periph */
125 CRM_TMR2_PERIPH_CLOCK = MAKE_VALUE(0x1C, 0),
126 CRM_TMR3_PERIPH_CLOCK = MAKE_VALUE(0x1C, 1),
127 CRM_TMR4_PERIPH_CLOCK = MAKE_VALUE(0x1C, 2),
128 CRM_TMR5_PERIPH_CLOCK = MAKE_VALUE(0x1C, 3),
129 CRM_WWDT_PERIPH_CLOCK = MAKE_VALUE(0x1C, 11),
130 CRM_SPI2_PERIPH_CLOCK = MAKE_VALUE(0x1C, 14),
131 CRM_USART2_PERIPH_CLOCK = MAKE_VALUE(0x1C, 17),
132 CRM_USART3_PERIPH_CLOCK = MAKE_VALUE(0x1C, 18),
133 CRM_UART4_PERIPH_CLOCK = MAKE_VALUE(0x1C, 19),
134 CRM_UART5_PERIPH_CLOCK = MAKE_VALUE(0x1C, 20),
135 CRM_I2C1_PERIPH_CLOCK = MAKE_VALUE(0x1C, 21),
136 CRM_I2C2_PERIPH_CLOCK = MAKE_VALUE(0x1C, 22),
137 CRM_USB_PERIPH_CLOCK = MAKE_VALUE(0x1C, 23),
138 CRM_CAN1_PERIPH_CLOCK = MAKE_VALUE(0x1C, 25),
139 CRM_BPR_PERIPH_CLOCK = MAKE_VALUE(0x1C, 27),
140 CRM_PWC_PERIPH_CLOCK = MAKE_VALUE(0x1C, 28),
141 CRM_CAN2_PERIPH_CLOCK = MAKE_VALUE(0x1C, 31)
143} crm_periph_clock_type;
144
148typedef enum
149{
150 /* apb2 periph */
151 CRM_IOMUX_PERIPH_RESET = MAKE_VALUE(0x0C, 0),
152 CRM_EXINT_PERIPH_RESET = MAKE_VALUE(0x0C, 1),
153 CRM_GPIOA_PERIPH_RESET = MAKE_VALUE(0x0C, 2),
154 CRM_GPIOB_PERIPH_RESET = MAKE_VALUE(0x0C, 3),
155 CRM_GPIOC_PERIPH_RESET = MAKE_VALUE(0x0C, 4),
156 CRM_GPIOD_PERIPH_RESET = MAKE_VALUE(0x0C, 5),
157 CRM_GPIOF_PERIPH_RESET = MAKE_VALUE(0x0C, 7),
158 CRM_ADC1_PERIPH_RESET = MAKE_VALUE(0x0C, 9),
159 CRM_ADC2_PERIPH_RESET = MAKE_VALUE(0x0C, 10),
160 CRM_TMR1_PERIPH_RESET = MAKE_VALUE(0x0C, 11),
161 CRM_SPI1_PERIPH_RESET = MAKE_VALUE(0x0C, 12),
162 CRM_TMR8_PERIPH_RESET = MAKE_VALUE(0x0C, 13),
163 CRM_USART1_PERIPH_RESET = MAKE_VALUE(0x0C, 14),
164 CRM_TMR9_PERIPH_RESET = MAKE_VALUE(0x0C, 19),
165 CRM_TMR10_PERIPH_RESET = MAKE_VALUE(0x0C, 20),
166 CRM_TMR11_PERIPH_RESET = MAKE_VALUE(0x0C, 21),
167 CRM_ACC_PERIPH_RESET = MAKE_VALUE(0x0C, 22),
168 /* apb1 periph */
169 CRM_TMR2_PERIPH_RESET = MAKE_VALUE(0x10, 0),
170 CRM_TMR3_PERIPH_RESET = MAKE_VALUE(0x10, 1),
171 CRM_TMR4_PERIPH_RESET = MAKE_VALUE(0x10, 2),
172 CRM_TMR5_PERIPH_RESET = MAKE_VALUE(0x10, 3),
173 CRM_WWDT_PERIPH_RESET = MAKE_VALUE(0x10, 11),
174 CRM_SPI2_PERIPH_RESET = MAKE_VALUE(0x10, 14),
175 CRM_USART2_PERIPH_RESET = MAKE_VALUE(0x10, 17),
176 CRM_USART3_PERIPH_RESET = MAKE_VALUE(0x10, 18),
177 CRM_UART4_PERIPH_RESET = MAKE_VALUE(0x10, 19),
178 CRM_UART5_PERIPH_RESET = MAKE_VALUE(0x10, 20),
179 CRM_I2C1_PERIPH_RESET = MAKE_VALUE(0x10, 21),
180 CRM_I2C2_PERIPH_RESET = MAKE_VALUE(0x10, 22),
181 CRM_USB_PERIPH_RESET = MAKE_VALUE(0x10, 23),
182 CRM_CAN1_PERIPH_RESET = MAKE_VALUE(0x10, 25),
183 CRM_BPR_PERIPH_RESET = MAKE_VALUE(0x10, 27),
184 CRM_PWC_PERIPH_RESET = MAKE_VALUE(0x10, 28),
185 CRM_CAN2_PERIPH_RESET = MAKE_VALUE(0x10, 31)
187} crm_periph_reset_type;
188
192typedef enum
193{
194 /* ahb periph */
195 CRM_SRAM_PERIPH_CLOCK_SLEEP_MODE = MAKE_VALUE(0x14, 2),
196 CRM_FLASH_PERIPH_CLOCK_SLEEP_MODE = MAKE_VALUE(0x14, 4)
197} crm_periph_clock_sleepmd_type;
198
202typedef enum
203{
204 CRM_PLL_MULT_2 = 0,
205 CRM_PLL_MULT_3 = 1,
206 CRM_PLL_MULT_4 = 2,
207 CRM_PLL_MULT_5 = 3,
208 CRM_PLL_MULT_6 = 4,
209 CRM_PLL_MULT_7 = 5,
210 CRM_PLL_MULT_8 = 6,
211 CRM_PLL_MULT_9 = 7,
212 CRM_PLL_MULT_10 = 8,
213 CRM_PLL_MULT_11 = 9,
214 CRM_PLL_MULT_12 = 10,
215 CRM_PLL_MULT_13 = 11,
216 CRM_PLL_MULT_14 = 12,
217 CRM_PLL_MULT_15 = 13,
218 CRM_PLL_MULT_16 = 15,
219 CRM_PLL_MULT_17 = 16,
220 CRM_PLL_MULT_18 = 17,
221 CRM_PLL_MULT_19 = 18,
222 CRM_PLL_MULT_20 = 19,
223 CRM_PLL_MULT_21 = 20,
224 CRM_PLL_MULT_22 = 21,
225 CRM_PLL_MULT_23 = 22,
226 CRM_PLL_MULT_24 = 23,
227 CRM_PLL_MULT_25 = 24,
228 CRM_PLL_MULT_26 = 25,
229 CRM_PLL_MULT_27 = 26,
230 CRM_PLL_MULT_28 = 27,
231 CRM_PLL_MULT_29 = 28,
232 CRM_PLL_MULT_30 = 29,
233 CRM_PLL_MULT_31 = 30,
234 CRM_PLL_MULT_32 = 31,
235 CRM_PLL_MULT_33 = 32,
236 CRM_PLL_MULT_34 = 33,
237 CRM_PLL_MULT_35 = 34,
238 CRM_PLL_MULT_36 = 35,
239 CRM_PLL_MULT_37 = 36,
240 CRM_PLL_MULT_38 = 37,
241 CRM_PLL_MULT_39 = 38,
242 CRM_PLL_MULT_40 = 39,
243 CRM_PLL_MULT_41 = 40,
244 CRM_PLL_MULT_42 = 41,
245 CRM_PLL_MULT_43 = 42,
246 CRM_PLL_MULT_44 = 43,
247 CRM_PLL_MULT_45 = 44,
248 CRM_PLL_MULT_46 = 45,
249 CRM_PLL_MULT_47 = 46,
250 CRM_PLL_MULT_48 = 47,
251 CRM_PLL_MULT_49 = 48,
252 CRM_PLL_MULT_50 = 49,
253 CRM_PLL_MULT_51 = 50,
254 CRM_PLL_MULT_52 = 51,
255 CRM_PLL_MULT_53 = 52,
256 CRM_PLL_MULT_54 = 53,
257 CRM_PLL_MULT_55 = 54,
258 CRM_PLL_MULT_56 = 55,
259 CRM_PLL_MULT_57 = 56,
260 CRM_PLL_MULT_58 = 57,
261 CRM_PLL_MULT_59 = 58,
262 CRM_PLL_MULT_60 = 59,
263 CRM_PLL_MULT_61 = 60,
264 CRM_PLL_MULT_62 = 61,
265 CRM_PLL_MULT_63 = 62,
266 CRM_PLL_MULT_64 = 63
267} crm_pll_mult_type;
268
272typedef enum
273{
274 CRM_PLL_SOURCE_HICK = 0x00,
275 CRM_PLL_SOURCE_HEXT = 0x01,
276 CRM_PLL_SOURCE_HEXT_DIV = 0x02
277} crm_pll_clock_source_type;
278
282typedef enum
283{
284 CRM_PLL_OUTPUT_RANGE_LE72MHZ = 0x00,
285 CRM_PLL_OUTPUT_RANGE_GT72MHZ = 0x01
286} crm_pll_output_range_type;
287
291typedef enum
292{
293 CRM_CLOCK_SOURCE_HICK = 0x00,
294 CRM_CLOCK_SOURCE_HEXT = 0x01,
295 CRM_CLOCK_SOURCE_PLL = 0x02,
296 CRM_CLOCK_SOURCE_LEXT = 0x03,
297 CRM_CLOCK_SOURCE_LICK = 0x04
298} crm_clock_source_type;
299
303typedef enum
304{
305 CRM_AHB_DIV_1 = 0x00,
306 CRM_AHB_DIV_2 = 0x08,
307 CRM_AHB_DIV_4 = 0x09,
308 CRM_AHB_DIV_8 = 0x0A,
309 CRM_AHB_DIV_16 = 0x0B,
310 CRM_AHB_DIV_64 = 0x0C,
311 CRM_AHB_DIV_128 = 0x0D,
312 CRM_AHB_DIV_256 = 0x0E,
313 CRM_AHB_DIV_512 = 0x0F
314} crm_ahb_div_type;
315
319typedef enum
320{
321 CRM_APB1_DIV_1 = 0x00,
322 CRM_APB1_DIV_2 = 0x04,
323 CRM_APB1_DIV_4 = 0x05,
324 CRM_APB1_DIV_8 = 0x06,
325 CRM_APB1_DIV_16 = 0x07
326} crm_apb1_div_type;
327
331typedef enum
332{
333 CRM_APB2_DIV_1 = 0x00,
334 CRM_APB2_DIV_2 = 0x04,
335 CRM_APB2_DIV_4 = 0x05,
336 CRM_APB2_DIV_8 = 0x06,
337 CRM_APB2_DIV_16 = 0x07
338} crm_apb2_div_type;
339
343typedef enum
344{
345 CRM_ADC_DIV_2 = 0x00,
346 CRM_ADC_DIV_4 = 0x01,
347 CRM_ADC_DIV_6 = 0x02,
348 CRM_ADC_DIV_8 = 0x03,
349 CRM_ADC_DIV_12 = 0x05,
350 CRM_ADC_DIV_16 = 0x07
351} crm_adc_div_type;
352
356typedef enum
357{
358 CRM_USB_DIV_1_5 = 0x00,
359 CRM_USB_DIV_1 = 0x01,
360 CRM_USB_DIV_2_5 = 0x02,
361 CRM_USB_DIV_2 = 0x03,
362 CRM_USB_DIV_3_5 = 0x04,
363 CRM_USB_DIV_3 = 0x05,
364 CRM_USB_DIV_4 = 0x06
365} crm_usb_div_type;
366
370typedef enum
371{
372 CRM_RTC_CLOCK_NOCLK = 0x00,
373 CRM_RTC_CLOCK_LEXT = 0x01,
374 CRM_RTC_CLOCK_LICK = 0x02,
375 CRM_RTC_CLOCK_HEXT_DIV = 0x03
376} crm_rtc_clock_type;
377
381typedef enum
382{
383 CRM_HICK48_DIV6 = 0x00,
384 CRM_HICK48_NODIV = 0x01
385} crm_hick_div_6_type;
386
390typedef enum
391{
392 CRM_SCLK_HICK = 0x00,
393 CRM_SCLK_HEXT = 0x01,
394 CRM_SCLK_PLL = 0x02
395} crm_sclk_type;
396
400typedef enum
401{
402 CRM_CLKOUT_NOCLK = 0x00,
403 CRM_CLKOUT_LICK = 0x02,
404 CRM_CLKOUT_LEXT = 0x03,
405 CRM_CLKOUT_SCLK = 0x04,
406 CRM_CLKOUT_HICK = 0x05,
407 CRM_CLKOUT_HEXT = 0x06,
408 CRM_CLKOUT_PLL_DIV_2 = 0x07,
409 CRM_CLKOUT_PLL_DIV_4 = 0x0C,
410 CRM_CLKOUT_USB = 0x0D,
411 CRM_CLKOUT_ADC = 0x0E
412} crm_clkout_select_type;
413
417typedef enum
418{
419 CRM_CLKOUT_DIV_1 = 0x00,
420 CRM_CLKOUT_DIV_2 = 0x08,
421 CRM_CLKOUT_DIV_4 = 0x09,
422 CRM_CLKOUT_DIV_8 = 0x0A,
423 CRM_CLKOUT_DIV_16 = 0x0B,
424 CRM_CLKOUT_DIV_64 = 0x0C,
425 CRM_CLKOUT_DIV_128 = 0x0D,
426 CRM_CLKOUT_DIV_256 = 0x0E,
427 CRM_CLKOUT_DIV_512 = 0x0F
428} crm_clkout_div_type;
429
433typedef enum
434{
435 CRM_AUTO_STEP_MODE_DISABLE = 0x00,
436 CRM_AUTO_STEP_MODE_ENABLE = 0x03
437} crm_auto_step_mode_type;
438
442typedef enum
443{
444 CRM_USB_INT19_INT20 = 0x00,
445 CRM_USB_INT73_INT74 = 0x01
446} crm_usb_int_map_type;
447
451typedef enum
452{
453 CRM_USB_CLOCK_SOURCE_PLL = 0x00,
454 CRM_USB_CLOCK_SOURCE_HICK = 0x01
455} crm_usb_clock_source_type;
456
460typedef enum
461{
462 CRM_HICK_SCLK_8MHZ = 0x00,
463 CRM_HICK_SCLK_48MHZ = 0x01
464} crm_hick_sclk_frequency_type;
465
469typedef struct
470{
471 uint32_t sclk_freq;
472 uint32_t ahb_freq;
473 uint32_t apb2_freq;
474 uint32_t apb1_freq;
475 uint32_t adc_freq;
476} crm_clocks_freq_type;
477
481typedef struct
482{
486 union
487 {
488 __IO uint32_t ctrl;
489 struct
490 {
491 __IO uint32_t hicken : 1; /* [0] */
492 __IO uint32_t hickstbl : 1; /* [1] */
493 __IO uint32_t hicktrim : 6; /* [7:2] */
494 __IO uint32_t hickcal : 8; /* [15:8] */
495 __IO uint32_t hexten : 1; /* [16] */
496 __IO uint32_t hextstbl : 1; /* [17] */
497 __IO uint32_t hextbyps : 1; /* [18] */
498 __IO uint32_t cfden : 1; /* [19] */
499 __IO uint32_t reserved1 : 4; /* [23:20] */
500 __IO uint32_t pllen : 1; /* [24] */
501 __IO uint32_t pllstbl : 1; /* [25] */
502 __IO uint32_t reserved2 : 6; /* [31:26] */
503 } ctrl_bit;
504 };
505
509 union
510 {
511 __IO uint32_t cfg;
512 struct
513 {
514 __IO uint32_t sclksel : 2; /* [1:0] */
515 __IO uint32_t sclksts : 2; /* [3:2] */
516 __IO uint32_t ahbdiv : 4; /* [7:4] */
517 __IO uint32_t apb1div : 3; /* [10:8] */
518 __IO uint32_t apb2div : 3; /* [13:11] */
519 __IO uint32_t adcdiv_l : 2; /* [15:14] */
520 __IO uint32_t pllrcs : 1; /* [16] */
521 __IO uint32_t pllhextdiv : 1; /* [17] */
522 __IO uint32_t pllmult_l : 4; /* [21:18] */
523 __IO uint32_t usbdiv_l : 2; /* [23:22] */
524 __IO uint32_t clkout_sel : 3; /* [26:24] */
525 __IO uint32_t usbdiv_h : 1; /* [27] */
526 __IO uint32_t adcdiv_h : 1; /* [28] */
527 __IO uint32_t pllmult_h : 2; /* [30:29] */
528 __IO uint32_t pllrange : 1; /* [31] */
529 } cfg_bit;
530 };
531
535 union
536 {
537 __IO uint32_t clkint;
538 struct
539 {
540 __IO uint32_t lickstblf : 1; /* [0] */
541 __IO uint32_t lextstblf : 1; /* [1] */
542 __IO uint32_t hickstblf : 1; /* [2] */
543 __IO uint32_t hextstblf : 1; /* [3] */
544 __IO uint32_t pllstblf : 1; /* [4] */
545 __IO uint32_t reserved1 : 2; /* [6:5] */
546 __IO uint32_t cfdf : 1; /* [7] */
547 __IO uint32_t lickstblien : 1; /* [8] */
548 __IO uint32_t lextstblien : 1; /* [9] */
549 __IO uint32_t hickstblien : 1; /* [10] */
550 __IO uint32_t hextstblien : 1; /* [11] */
551 __IO uint32_t pllstblien : 1; /* [12] */
552 __IO uint32_t reserved2 : 3; /* [15:13] */
553 __IO uint32_t lickstblfc : 1; /* [16] */
554 __IO uint32_t lextstblfc : 1; /* [17] */
555 __IO uint32_t hickstblfc : 1; /* [18] */
556 __IO uint32_t hextstblfc : 1; /* [19] */
557 __IO uint32_t pllstblfc : 1; /* [20] */
558 __IO uint32_t reserved3 : 2; /* [22:21] */
559 __IO uint32_t cfdfc : 1; /* [23] */
560 __IO uint32_t reserved4 : 8; /* [31:24] */
561 } clkint_bit;
562 };
563
567 union
568 {
569 __IO uint32_t apb2rst;
570 struct
571 {
572 __IO uint32_t iomuxrst : 1; /* [0] */
573 __IO uint32_t exintrst : 1; /* [1] */
574 __IO uint32_t gpioarst : 1; /* [2] */
575 __IO uint32_t gpiobrst : 1; /* [3] */
576 __IO uint32_t gpiocrst : 1; /* [4] */
577 __IO uint32_t gpiodrst : 1; /* [5] */
578 __IO uint32_t reserved1 : 1; /* [6] */
579 __IO uint32_t gpioerst : 1; /* [7] */
580 __IO uint32_t reserved2 : 1; /* [8] */
581 __IO uint32_t adc1rst : 1; /* [9] */
582 __IO uint32_t adc2rst : 1; /* [10] */
583 __IO uint32_t tmr1rst : 1; /* [11] */
584 __IO uint32_t spi1rst : 1; /* [12] */
585 __IO uint32_t tmr8rst : 1; /* [13] */
586 __IO uint32_t usart1rst : 1; /* [14] */
587 __IO uint32_t reserved3 : 4; /* [18:15] */
588 __IO uint32_t tmr9rst : 1; /* [19] */
589 __IO uint32_t tmr10rst : 1; /* [20] */
590 __IO uint32_t tmr11rst : 1; /* [21] */
591 __IO uint32_t accrst : 1; /* [22] */
592 __IO uint32_t reserved4 : 9; /* [31:23] */
593 } apb2rst_bit;
594 };
595
599 union
600 {
601 __IO uint32_t apb1rst;
602 struct
603 {
604 __IO uint32_t tmr2rst : 1; /* [0] */
605 __IO uint32_t tmr3rst : 1; /* [1] */
606 __IO uint32_t tmr4rst : 1; /* [2] */
607 __IO uint32_t tmr5rst : 1; /* [3] */
608 __IO uint32_t reserved1 : 7; /* [10:4] */
609 __IO uint32_t wwdtrst : 1; /* [11] */
610 __IO uint32_t reserved2 : 2; /* [13:12] */
611 __IO uint32_t spi2rst : 1; /* [14] */
612 __IO uint32_t reserved3 : 2; /* [16:15] */
613 __IO uint32_t usart2rst : 1; /* [17] */
614 __IO uint32_t usart3rst : 1; /* [18] */
615 __IO uint32_t uart4rst : 1; /* [19] */
616 __IO uint32_t uart5rst : 1; /* [20] */
617 __IO uint32_t i2c1rst : 1; /* [21] */
618 __IO uint32_t i2c2rst : 1; /* [22] */
619 __IO uint32_t usbrst : 1; /* [23] */
620 __IO uint32_t reserved4 : 1; /* [24] */
621 __IO uint32_t can1rst : 1; /* [25] */
622 __IO uint32_t reserved5 : 1; /* [26] */
623 __IO uint32_t bprrst : 1; /* [27] */
624 __IO uint32_t pwcrst : 1; /* [28] */
625 __IO uint32_t reserved6 : 2; /* [31:30] */
626 __IO uint32_t can2rst : 1; /* [31] */
627 } apb1rst_bit;
628 };
629
633 union
634 {
635 __IO uint32_t ahben;
636 struct
637 {
638 __IO uint32_t dma1en : 1; /* [0] */
639 __IO uint32_t dma2en : 1; /* [1] */
640 __IO uint32_t sramen : 1; /* [2] */
641 __IO uint32_t reserved1 : 1; /* [3] */
642 __IO uint32_t flashen : 1; /* [4] */
643 __IO uint32_t reserved2 : 1; /* [5] */
644 __IO uint32_t crcen : 1; /* [6] */
645 __IO uint32_t reserved3 : 3; /* [9:7] */
646 __IO uint32_t sdio1en : 1; /* [10] */
647 __IO uint32_t reserved5 : 21;/* [31:11] */
648 } ahben_bit;
649 };
650
654 union
655 {
656 __IO uint32_t apb2en;
657 struct
658 {
659 __IO uint32_t iomuxen : 1; /* [0] */
660 __IO uint32_t reserved1 : 1; /* [1] */
661 __IO uint32_t gpioaen : 1; /* [2] */
662 __IO uint32_t gpioben : 1; /* [3] */
663 __IO uint32_t gpiocen : 1; /* [4] */
664 __IO uint32_t gpioden : 1; /* [5] */
665 __IO uint32_t reserved2 : 1; /* [6] */
666 __IO uint32_t gpiofen : 1; /* [7] */
667 __IO uint32_t reserved3 : 1; /* [8] */
668 __IO uint32_t adc1en : 1; /* [9] */
669 __IO uint32_t adc2en : 1; /* [10] */
670 __IO uint32_t tmr1en : 1; /* [11] */
671 __IO uint32_t spi1en : 1; /* [12] */
672 __IO uint32_t tmr8en : 1; /* [13] */
673 __IO uint32_t usart1en : 1; /* [14] */
674 __IO uint32_t reserved4 : 4; /* [18:15] */
675 __IO uint32_t tmr9en : 1; /* [19] */
676 __IO uint32_t tmr10en : 1; /* [20] */
677 __IO uint32_t tmr11en : 1; /* [21] */
678 __IO uint32_t accen : 1; /* [22] */
679 __IO uint32_t reserved5 : 9; /* [31:23] */
680 } apb2en_bit;
681 };
682
686 union
687 {
688 __IO uint32_t apb1en;
689 struct
690 {
691 __IO uint32_t tmr2en : 1; /* [0] */
692 __IO uint32_t tmr3en : 1; /* [1] */
693 __IO uint32_t tmr4en : 1; /* [2] */
694 __IO uint32_t tmr5en : 1; /* [3] */
695 __IO uint32_t reserved1 : 7; /* [10:4] */
696 __IO uint32_t wwdten : 1; /* [11] */
697 __IO uint32_t reserved2 : 2; /* [13:12] */
698 __IO uint32_t spi2en : 1; /* [14] */
699 __IO uint32_t reserved3 : 2; /* [16:15] */
700 __IO uint32_t usart2en : 1; /* [17] */
701 __IO uint32_t usart3en : 1; /* [18] */
702 __IO uint32_t uart4en : 1; /* [19] */
703 __IO uint32_t uart5en : 1; /* [20] */
704 __IO uint32_t i2c1en : 1; /* [21] */
705 __IO uint32_t i2c2en : 1; /* [22] */
706 __IO uint32_t usben : 1; /* [23] */
707 __IO uint32_t reserved4 : 1; /* [24] */
708 __IO uint32_t can1en : 1; /* [25] */
709 __IO uint32_t reserved5 : 1; /* [26] */
710 __IO uint32_t bpren : 1; /* [27] */
711 __IO uint32_t pwcen : 1; /* [28] */
712 __IO uint32_t reserved6 : 2; /* [30:29] */
713 __IO uint32_t can2en : 1; /* [31] */
714 } apb1en_bit;
715 };
716
720 union
721 {
722 __IO uint32_t bpdc;
723 struct
724 {
725 __IO uint32_t lexten : 1; /* [0] */
726 __IO uint32_t lextstbl : 1; /* [1] */
727 __IO uint32_t lextbyps : 1; /* [2] */
728 __IO uint32_t reserved1 : 5; /* [7:3] */
729 __IO uint32_t rtcsel : 2; /* [9:8] */
730 __IO uint32_t reserved2 : 5; /* [14:10] */
731 __IO uint32_t rtcen : 1; /* [15] */
732 __IO uint32_t bpdrst : 1; /* [16] */
733 __IO uint32_t reserved3 : 15;/* [31:17] */
734 } bpdc_bit;
735 };
736
740 union
741 {
742 __IO uint32_t ctrlsts;
743 struct
744 {
745 __IO uint32_t licken : 1; /* [0] */
746 __IO uint32_t lickstbl : 1; /* [1] */
747 __IO uint32_t reserved1 : 22;/* [23:2] */
748 __IO uint32_t rstfc : 1; /* [24] */
749 __IO uint32_t reserved2 : 1; /* [25] */
750 __IO uint32_t nrstf : 1; /* [26] */
751 __IO uint32_t porrstf : 1; /* [27] */
752 __IO uint32_t swrstf : 1; /* [28] */
753 __IO uint32_t wdtrstf : 1; /* [29] */
754 __IO uint32_t wwdtrstf : 1; /* [30] */
755 __IO uint32_t lprstf : 1; /* [31] */
756 } ctrlsts_bit;
757 };
758
762 __IO uint32_t reserved1[2];
763
767 union
768 {
769 __IO uint32_t misc1;
770 struct
771 {
772 __IO uint32_t hickcal_key : 8; /* [7:0] */
773 __IO uint32_t reserved1 : 8; /* [15:8] */
774 __IO uint32_t clkout_sel : 1; /* [16] */
775 __IO uint32_t reserved2 : 7; /* [23:17] */
776 __IO uint32_t usbbufs : 1; /* [24] */
777 __IO uint32_t hickdiv : 1; /* [25] */
778 __IO uint32_t reserved3 : 2; /* [27:26] */
779 __IO uint32_t clkoutdiv : 4; /* [31:28] */
780 } misc1_bit;
781 };
782
786 __IO uint32_t reserved2[7];
787
791 union
792 {
793 __IO uint32_t misc2;
794 struct
795 {
796 __IO uint32_t reserved1 : 16;/* [15:0] */
797 __IO uint32_t clk_to_tmr : 1; /* [16] */
798 __IO uint32_t reserved2 : 15;/* [31:17] */
799 } misc2_bit;
800 };
801
805 union
806 {
807 __IO uint32_t misc3;
808 struct
809 {
810 __IO uint32_t reserved1 : 4; /* [3:0] */
811 __IO uint32_t auto_step_en : 2; /* [5:4] */
812 __IO uint32_t reserved2 : 2; /* [7:6] */
813 __IO uint32_t hick_to_usb : 1; /* [8] */
814 __IO uint32_t hick_to_sclk : 1; /* [9] */
815 __IO uint32_t reserved3 : 22;/* [31:10] */
816 } misc3_bit;
817 };
818
822 __IO uint32_t reserved3;
823
827 union
828 {
829 __IO uint32_t intmap;
830 struct
831 {
832 __IO uint32_t usbintmap : 1; /* [0] */
833 __IO uint32_t reserved1 : 31;/* [31:1] */
834 } intmap_bit;
835 };
836
837} crm_type;
838
843#define CRM ((crm_type *) CRM_BASE)
844
849void crm_reset(void);
850void crm_lext_bypass(confirm_state new_state);
851void crm_hext_bypass(confirm_state new_state);
852 flag_status crm_flag_get(uint32_t flag);
853 flag_status crm_interrupt_flag_get(uint32_t flag);
854 error_status crm_hext_stable_wait(void);
855void crm_hick_clock_trimming_set(uint8_t trim_value);
856void crm_hick_clock_calibration_set(uint8_t cali_value);
857void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state);
858void crm_periph_reset(crm_periph_reset_type value, confirm_state new_state);
859void crm_periph_sleep_mode_clock_enable(crm_periph_clock_sleepmd_type value, confirm_state new_state);
860void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state);
861void crm_flag_clear(uint32_t flag);
862void crm_rtc_clock_select(crm_rtc_clock_type value);
863void crm_rtc_clock_enable(confirm_state new_state);
864void crm_ahb_div_set(crm_ahb_div_type value);
865void crm_apb1_div_set(crm_apb1_div_type value);
866void crm_apb2_div_set(crm_apb2_div_type value);
867void crm_adc_clock_div_set(crm_adc_div_type div_value);
868void crm_usb_clock_div_set(crm_usb_div_type div_value);
869void crm_clock_failure_detection_enable(confirm_state new_state);
870void crm_battery_powered_domain_reset(confirm_state new_state);
871void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range);
872void crm_sysclk_switch(crm_sclk_type value);
873 crm_sclk_type crm_sysclk_switch_status_get(void);
874void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct);
875void crm_clock_out_set(crm_clkout_select_type clkout);
876void crm_interrupt_enable(uint32_t crm_int, confirm_state new_state);
877void crm_auto_step_mode_enable(confirm_state new_state);
878void crm_usb_interrupt_remapping_set(crm_usb_int_map_type int_remap);
879void crm_hick_divider_select(crm_hick_div_6_type value);
880void crm_hick_sclk_frequency_select(crm_hick_sclk_frequency_type value);
881void crm_usb_clock_source_select(crm_usb_clock_source_type value);
882void crm_clkout_to_tmr10_enable(confirm_state new_state);
883void crm_clkout_div_set(crm_clkout_div_type clkout_div);
884
897#ifdef __cplusplus
898}
899#endif
900
901#endif
at32f413.h
at32f413 header file
div_value
uint16_t div_value
Definition project/at_start_f413/examples/tmr/oc_high/src/main.c:43
crm_periph_sleep_mode_clock_enable
void crm_periph_sleep_mode_clock_enable(crm_periph_clock_sleepmd_type value, confirm_state new_state)
enable or disable the peripheral clock in sleep mode
Definition at32f413_crm.c:316
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hick_clock_calibration_set
void crm_hick_clock_calibration_set(uint8_t cali_value)
set the crm calibration value
Definition at32f413_crm.c:235
crm_clkout_div_set
void crm_clkout_div_set(crm_clkout_div_type clkout_div)
set crm clkout division
Definition at32f413_crm.c:888
crm_rtc_clock_select
void crm_rtc_clock_select(crm_rtc_clock_type value)
select rtc clock
Definition at32f413_crm.c:433
crm_rtc_clock_enable
void crm_rtc_clock_enable(confirm_state new_state)
enable or disable rtc
Definition at32f413_crm.c:443
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_interrupt_enable
void crm_interrupt_enable(uint32_t crm_int, confirm_state new_state)
config crm interrupt
Definition at32f413_crm.c:785
crm_flag_clear
void crm_flag_clear(uint32_t flag)
clear the crm reset flags
Definition at32f413_crm.c:387
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_lext_bypass
void crm_lext_bypass(confirm_state new_state)
enable or disable crm low speed external crystal bypass
Definition at32f413_crm.c:82
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_hick_sclk_frequency_select
void crm_hick_sclk_frequency_select(crm_hick_sclk_frequency_type value)
hick as system clock frequency select
Definition at32f413_crm.c:840
crm_interrupt_flag_get
flag_status crm_interrupt_flag_get(uint32_t flag)
get crm interrupt flag status
Definition at32f413_crm.c:147
crm_hick_divider_select
void crm_hick_divider_select(crm_hick_div_6_type value)
config hick divider select
Definition at32f413_crm.c:827
crm_adc_clock_div_set
void crm_adc_clock_div_set(crm_adc_div_type div_value)
set crm adc division
Definition at32f413_crm.c:514
crm_clock_out_set
void crm_clock_out_set(crm_clkout_select_type clkout)
set crm clkout
Definition at32f413_crm.c:767
crm_clock_failure_detection_enable
void crm_clock_failure_detection_enable(confirm_state new_state)
enable or disable clock failure detection
Definition at32f413_crm.c:544
crm_periph_reset
void crm_periph_reset(crm_periph_reset_type value, confirm_state new_state)
enable or disable the peripheral reset
Definition at32f413_crm.c:293
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_clkout_to_tmr10_enable
void crm_clkout_to_tmr10_enable(confirm_state new_state)
enable or disable clkout direct to tmr10 channel 1
Definition at32f413_crm.c:868
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_usb_clock_div_set
void crm_usb_clock_div_set(crm_usb_div_type div_value)
set crm usb division
Definition at32f413_crm.c:533
crm_usb_interrupt_remapping_set
void crm_usb_interrupt_remapping_set(crm_usb_int_map_type int_remap)
usbdev interrupt remapping control
Definition at32f413_crm.c:814
crm_hick_clock_trimming_set
void crm_hick_clock_trimming_set(uint8_t trim_value)
set the hick trimming value
Definition at32f413_crm.c:225
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
crm_battery_powered_domain_reset
void crm_battery_powered_domain_reset(confirm_state new_state)
battery powered domain software reset
Definition at32f413_crm.c:554
crm_usb_clock_source_select
void crm_usb_clock_source_select(crm_usb_clock_source_type value)
usb 48 mhz clock source select
Definition at32f413_crm.c:854
crm_hext_bypass
void crm_hext_bypass(confirm_state new_state)
enable or disable crm high speed external crystal bypass
Definition at32f413_crm.c:92
crm_clocks_freq_get
void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
Definition at32f413_crm.c:660
crm_periph_clock_type
crm_periph_clock_type
crm periph clock
Definition at32f413_crm.h:101
crm_hick_sclk_frequency_type
crm_hick_sclk_frequency_type
crm hick as system clock frequency select
Definition at32f413_crm.h:461
crm_apb1_div_type
crm_apb1_div_type
crm apb1 division
Definition at32f413_crm.h:320
crm_clock_source_type
crm_clock_source_type
crm clock source
Definition at32f413_crm.h:292
crm_usb_div_type
crm_usb_div_type
crm usb division
Definition at32f413_crm.h:357
crm_clkout_div_type
crm_clkout_div_type
crm clkout division
Definition at32f413_crm.h:418
crm_usb_clock_source_type
crm_usb_clock_source_type
crm usb 48 mhz clock source select
Definition at32f413_crm.h:452
crm_periph_clock_sleepmd_type
crm_periph_clock_sleepmd_type
crm periph clock in sleep mode
Definition at32f413_crm.h:193
crm_pll_clock_source_type
crm_pll_clock_source_type
crm pll clock source
Definition at32f413_crm.h:273
crm_pll_mult_type
crm_pll_mult_type
crm pll mult_x
Definition at32f413_crm.h:203
crm_ahb_div_type
crm_ahb_div_type
crm ahb division
Definition at32f413_crm.h:304
crm_rtc_clock_type
crm_rtc_clock_type
crm rtc clock
Definition at32f413_crm.h:371
crm_adc_div_type
crm_adc_div_type
crm adc division
Definition at32f413_crm.h:344
crm_usb_int_map_type
crm_usb_int_map_type
crm usbdev interrupt remap
Definition at32f413_crm.h:443
crm_clkout_select_type
crm_clkout_select_type
crm clkout select
Definition at32f413_crm.h:401
crm_auto_step_mode_type
crm_auto_step_mode_type
crm auto step mode
Definition at32f413_crm.h:434
crm_sclk_type
crm_sclk_type
crm sclk select
Definition at32f413_crm.h:391
crm_periph_reset_type
crm_periph_reset_type
crm periph reset
Definition at32f413_crm.h:149
crm_apb2_div_type
crm_apb2_div_type
crm apb2 division
Definition at32f413_crm.h:332
crm_pll_output_range_type
crm_pll_output_range_type
crm pll clock output range
Definition at32f413_crm.h:283
crm_hick_div_6_type
crm_hick_div_6_type
crm hick 48mhz division
Definition at32f413_crm.h:382
CRM_SDIO1_PERIPH_CLOCK
@ CRM_SDIO1_PERIPH_CLOCK
Definition at32f413_crm.h:106
CRM_TMR10_PERIPH_CLOCK
@ CRM_TMR10_PERIPH_CLOCK
Definition at32f413_crm.h:121
CRM_USB_PERIPH_CLOCK
@ CRM_USB_PERIPH_CLOCK
Definition at32f413_crm.h:137
CRM_GPIOC_PERIPH_CLOCK
@ CRM_GPIOC_PERIPH_CLOCK
Definition at32f413_crm.h:111
CRM_GPIOF_PERIPH_CLOCK
@ CRM_GPIOF_PERIPH_CLOCK
Definition at32f413_crm.h:113
CRM_PWC_PERIPH_CLOCK
@ CRM_PWC_PERIPH_CLOCK
Definition at32f413_crm.h:140
CRM_UART5_PERIPH_CLOCK
@ CRM_UART5_PERIPH_CLOCK
Definition at32f413_crm.h:134
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_BPR_PERIPH_CLOCK
@ CRM_BPR_PERIPH_CLOCK
Definition at32f413_crm.h:139
CRM_TMR9_PERIPH_CLOCK
@ CRM_TMR9_PERIPH_CLOCK
Definition at32f413_crm.h:120
CRM_USART3_PERIPH_CLOCK
@ CRM_USART3_PERIPH_CLOCK
Definition at32f413_crm.h:132
CRM_TMR2_PERIPH_CLOCK
@ CRM_TMR2_PERIPH_CLOCK
Definition at32f413_crm.h:125
CRM_I2C1_PERIPH_CLOCK
@ CRM_I2C1_PERIPH_CLOCK
Definition at32f413_crm.h:135
CRM_TMR4_PERIPH_CLOCK
@ CRM_TMR4_PERIPH_CLOCK
Definition at32f413_crm.h:127
CRM_SPI2_PERIPH_CLOCK
@ CRM_SPI2_PERIPH_CLOCK
Definition at32f413_crm.h:130
CRM_ACC_PERIPH_CLOCK
@ CRM_ACC_PERIPH_CLOCK
Definition at32f413_crm.h:123
CRM_CRC_PERIPH_CLOCK
@ CRM_CRC_PERIPH_CLOCK
Definition at32f413_crm.h:105
CRM_TMR3_PERIPH_CLOCK
@ CRM_TMR3_PERIPH_CLOCK
Definition at32f413_crm.h:126
CRM_IOMUX_PERIPH_CLOCK
@ CRM_IOMUX_PERIPH_CLOCK
Definition at32f413_crm.h:108
CRM_TMR8_PERIPH_CLOCK
@ CRM_TMR8_PERIPH_CLOCK
Definition at32f413_crm.h:118
CRM_USART1_PERIPH_CLOCK
@ CRM_USART1_PERIPH_CLOCK
Definition at32f413_crm.h:119
CRM_UART4_PERIPH_CLOCK
@ CRM_UART4_PERIPH_CLOCK
Definition at32f413_crm.h:133
CRM_GPIOD_PERIPH_CLOCK
@ CRM_GPIOD_PERIPH_CLOCK
Definition at32f413_crm.h:112
CRM_SPI1_PERIPH_CLOCK
@ CRM_SPI1_PERIPH_CLOCK
Definition at32f413_crm.h:117
CRM_CAN1_PERIPH_CLOCK
@ CRM_CAN1_PERIPH_CLOCK
Definition at32f413_crm.h:138
CRM_ADC1_PERIPH_CLOCK
@ CRM_ADC1_PERIPH_CLOCK
Definition at32f413_crm.h:114
CRM_GPIOB_PERIPH_CLOCK
@ CRM_GPIOB_PERIPH_CLOCK
Definition at32f413_crm.h:110
CRM_DMA1_PERIPH_CLOCK
@ CRM_DMA1_PERIPH_CLOCK
Definition at32f413_crm.h:103
CRM_CAN2_PERIPH_CLOCK
@ CRM_CAN2_PERIPH_CLOCK
Definition at32f413_crm.h:141
CRM_I2C2_PERIPH_CLOCK
@ CRM_I2C2_PERIPH_CLOCK
Definition at32f413_crm.h:136
CRM_DMA2_PERIPH_CLOCK
@ CRM_DMA2_PERIPH_CLOCK
Definition at32f413_crm.h:104
CRM_TMR5_PERIPH_CLOCK
@ CRM_TMR5_PERIPH_CLOCK
Definition at32f413_crm.h:128
CRM_USART2_PERIPH_CLOCK
@ CRM_USART2_PERIPH_CLOCK
Definition at32f413_crm.h:131
CRM_TMR11_PERIPH_CLOCK
@ CRM_TMR11_PERIPH_CLOCK
Definition at32f413_crm.h:122
CRM_TMR1_PERIPH_CLOCK
@ CRM_TMR1_PERIPH_CLOCK
Definition at32f413_crm.h:116
CRM_WWDT_PERIPH_CLOCK
@ CRM_WWDT_PERIPH_CLOCK
Definition at32f413_crm.h:129
CRM_ADC2_PERIPH_CLOCK
@ CRM_ADC2_PERIPH_CLOCK
Definition at32f413_crm.h:115
CRM_HICK_SCLK_48MHZ
@ CRM_HICK_SCLK_48MHZ
Definition at32f413_crm.h:463
CRM_HICK_SCLK_8MHZ
@ CRM_HICK_SCLK_8MHZ
Definition at32f413_crm.h:462
CRM_APB1_DIV_8
@ CRM_APB1_DIV_8
Definition at32f413_crm.h:324
CRM_APB1_DIV_4
@ CRM_APB1_DIV_4
Definition at32f413_crm.h:323
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_APB1_DIV_16
@ CRM_APB1_DIV_16
Definition at32f413_crm.h:325
CRM_APB1_DIV_1
@ CRM_APB1_DIV_1
Definition at32f413_crm.h:321
CRM_CLOCK_SOURCE_HICK
@ CRM_CLOCK_SOURCE_HICK
Definition at32f413_crm.h:293
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_LEXT
@ CRM_CLOCK_SOURCE_LEXT
Definition at32f413_crm.h:296
CRM_CLOCK_SOURCE_LICK
@ CRM_CLOCK_SOURCE_LICK
Definition at32f413_crm.h:297
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_USB_DIV_3
@ CRM_USB_DIV_3
Definition at32f413_crm.h:363
CRM_USB_DIV_1_5
@ CRM_USB_DIV_1_5
Definition at32f413_crm.h:358
CRM_USB_DIV_4
@ CRM_USB_DIV_4
Definition at32f413_crm.h:364
CRM_USB_DIV_3_5
@ CRM_USB_DIV_3_5
Definition at32f413_crm.h:362
CRM_USB_DIV_2
@ CRM_USB_DIV_2
Definition at32f413_crm.h:361
CRM_USB_DIV_1
@ CRM_USB_DIV_1
Definition at32f413_crm.h:359
CRM_USB_DIV_2_5
@ CRM_USB_DIV_2_5
Definition at32f413_crm.h:360
CRM_CLKOUT_DIV_2
@ CRM_CLKOUT_DIV_2
Definition at32f413_crm.h:420
CRM_CLKOUT_DIV_1
@ CRM_CLKOUT_DIV_1
Definition at32f413_crm.h:419
CRM_CLKOUT_DIV_128
@ CRM_CLKOUT_DIV_128
Definition at32f413_crm.h:425
CRM_CLKOUT_DIV_64
@ CRM_CLKOUT_DIV_64
Definition at32f413_crm.h:424
CRM_CLKOUT_DIV_8
@ CRM_CLKOUT_DIV_8
Definition at32f413_crm.h:422
CRM_CLKOUT_DIV_16
@ CRM_CLKOUT_DIV_16
Definition at32f413_crm.h:423
CRM_CLKOUT_DIV_256
@ CRM_CLKOUT_DIV_256
Definition at32f413_crm.h:426
CRM_CLKOUT_DIV_4
@ CRM_CLKOUT_DIV_4
Definition at32f413_crm.h:421
CRM_CLKOUT_DIV_512
@ CRM_CLKOUT_DIV_512
Definition at32f413_crm.h:427
CRM_USB_CLOCK_SOURCE_HICK
@ CRM_USB_CLOCK_SOURCE_HICK
Definition at32f413_crm.h:454
CRM_USB_CLOCK_SOURCE_PLL
@ CRM_USB_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:453
CRM_FLASH_PERIPH_CLOCK_SLEEP_MODE
@ CRM_FLASH_PERIPH_CLOCK_SLEEP_MODE
Definition at32f413_crm.h:196
CRM_SRAM_PERIPH_CLOCK_SLEEP_MODE
@ CRM_SRAM_PERIPH_CLOCK_SLEEP_MODE
Definition at32f413_crm.h:195
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_SOURCE_HEXT
@ CRM_PLL_SOURCE_HEXT
Definition at32f413_crm.h:275
CRM_PLL_SOURCE_HICK
@ CRM_PLL_SOURCE_HICK
Definition at32f413_crm.h:274
CRM_PLL_MULT_17
@ CRM_PLL_MULT_17
Definition at32f413_crm.h:219
CRM_PLL_MULT_24
@ CRM_PLL_MULT_24
Definition at32f413_crm.h:226
CRM_PLL_MULT_53
@ CRM_PLL_MULT_53
Definition at32f413_crm.h:255
CRM_PLL_MULT_61
@ CRM_PLL_MULT_61
Definition at32f413_crm.h:263
CRM_PLL_MULT_27
@ CRM_PLL_MULT_27
Definition at32f413_crm.h:229
CRM_PLL_MULT_50
@ CRM_PLL_MULT_50
Definition at32f413_crm.h:252
CRM_PLL_MULT_41
@ CRM_PLL_MULT_41
Definition at32f413_crm.h:243
CRM_PLL_MULT_56
@ CRM_PLL_MULT_56
Definition at32f413_crm.h:258
CRM_PLL_MULT_11
@ CRM_PLL_MULT_11
Definition at32f413_crm.h:213
CRM_PLL_MULT_37
@ CRM_PLL_MULT_37
Definition at32f413_crm.h:239
CRM_PLL_MULT_63
@ CRM_PLL_MULT_63
Definition at32f413_crm.h:265
CRM_PLL_MULT_18
@ CRM_PLL_MULT_18
Definition at32f413_crm.h:220
CRM_PLL_MULT_9
@ CRM_PLL_MULT_9
Definition at32f413_crm.h:211
CRM_PLL_MULT_4
@ CRM_PLL_MULT_4
Definition at32f413_crm.h:206
CRM_PLL_MULT_35
@ CRM_PLL_MULT_35
Definition at32f413_crm.h:237
CRM_PLL_MULT_14
@ CRM_PLL_MULT_14
Definition at32f413_crm.h:216
CRM_PLL_MULT_28
@ CRM_PLL_MULT_28
Definition at32f413_crm.h:230
CRM_PLL_MULT_62
@ CRM_PLL_MULT_62
Definition at32f413_crm.h:264
CRM_PLL_MULT_20
@ CRM_PLL_MULT_20
Definition at32f413_crm.h:222
CRM_PLL_MULT_47
@ CRM_PLL_MULT_47
Definition at32f413_crm.h:249
CRM_PLL_MULT_32
@ CRM_PLL_MULT_32
Definition at32f413_crm.h:234
CRM_PLL_MULT_58
@ CRM_PLL_MULT_58
Definition at32f413_crm.h:260
CRM_PLL_MULT_10
@ CRM_PLL_MULT_10
Definition at32f413_crm.h:212
CRM_PLL_MULT_44
@ CRM_PLL_MULT_44
Definition at32f413_crm.h:246
CRM_PLL_MULT_5
@ CRM_PLL_MULT_5
Definition at32f413_crm.h:207
CRM_PLL_MULT_34
@ CRM_PLL_MULT_34
Definition at32f413_crm.h:236
CRM_PLL_MULT_15
@ CRM_PLL_MULT_15
Definition at32f413_crm.h:217
CRM_PLL_MULT_39
@ CRM_PLL_MULT_39
Definition at32f413_crm.h:241
CRM_PLL_MULT_13
@ CRM_PLL_MULT_13
Definition at32f413_crm.h:215
CRM_PLL_MULT_45
@ CRM_PLL_MULT_45
Definition at32f413_crm.h:247
CRM_PLL_MULT_12
@ CRM_PLL_MULT_12
Definition at32f413_crm.h:214
CRM_PLL_MULT_33
@ CRM_PLL_MULT_33
Definition at32f413_crm.h:235
CRM_PLL_MULT_64
@ CRM_PLL_MULT_64
Definition at32f413_crm.h:266
CRM_PLL_MULT_31
@ CRM_PLL_MULT_31
Definition at32f413_crm.h:233
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_PLL_MULT_19
@ CRM_PLL_MULT_19
Definition at32f413_crm.h:221
CRM_PLL_MULT_29
@ CRM_PLL_MULT_29
Definition at32f413_crm.h:231
CRM_PLL_MULT_49
@ CRM_PLL_MULT_49
Definition at32f413_crm.h:251
CRM_PLL_MULT_3
@ CRM_PLL_MULT_3
Definition at32f413_crm.h:205
CRM_PLL_MULT_36
@ CRM_PLL_MULT_36
Definition at32f413_crm.h:238
CRM_PLL_MULT_21
@ CRM_PLL_MULT_21
Definition at32f413_crm.h:223
CRM_PLL_MULT_40
@ CRM_PLL_MULT_40
Definition at32f413_crm.h:242
CRM_PLL_MULT_46
@ CRM_PLL_MULT_46
Definition at32f413_crm.h:248
CRM_PLL_MULT_59
@ CRM_PLL_MULT_59
Definition at32f413_crm.h:261
CRM_PLL_MULT_2
@ CRM_PLL_MULT_2
Definition at32f413_crm.h:204
CRM_PLL_MULT_54
@ CRM_PLL_MULT_54
Definition at32f413_crm.h:256
CRM_PLL_MULT_7
@ CRM_PLL_MULT_7
Definition at32f413_crm.h:209
CRM_PLL_MULT_25
@ CRM_PLL_MULT_25
Definition at32f413_crm.h:227
CRM_PLL_MULT_22
@ CRM_PLL_MULT_22
Definition at32f413_crm.h:224
CRM_PLL_MULT_51
@ CRM_PLL_MULT_51
Definition at32f413_crm.h:253
CRM_PLL_MULT_57
@ CRM_PLL_MULT_57
Definition at32f413_crm.h:259
CRM_PLL_MULT_43
@ CRM_PLL_MULT_43
Definition at32f413_crm.h:245
CRM_PLL_MULT_55
@ CRM_PLL_MULT_55
Definition at32f413_crm.h:257
CRM_PLL_MULT_42
@ CRM_PLL_MULT_42
Definition at32f413_crm.h:244
CRM_PLL_MULT_23
@ CRM_PLL_MULT_23
Definition at32f413_crm.h:225
CRM_PLL_MULT_38
@ CRM_PLL_MULT_38
Definition at32f413_crm.h:240
CRM_PLL_MULT_16
@ CRM_PLL_MULT_16
Definition at32f413_crm.h:218
CRM_PLL_MULT_30
@ CRM_PLL_MULT_30
Definition at32f413_crm.h:232
CRM_PLL_MULT_52
@ CRM_PLL_MULT_52
Definition at32f413_crm.h:254
CRM_PLL_MULT_6
@ CRM_PLL_MULT_6
Definition at32f413_crm.h:208
CRM_PLL_MULT_26
@ CRM_PLL_MULT_26
Definition at32f413_crm.h:228
CRM_PLL_MULT_8
@ CRM_PLL_MULT_8
Definition at32f413_crm.h:210
CRM_PLL_MULT_60
@ CRM_PLL_MULT_60
Definition at32f413_crm.h:262
CRM_AHB_DIV_4
@ CRM_AHB_DIV_4
Definition at32f413_crm.h:307
CRM_AHB_DIV_16
@ CRM_AHB_DIV_16
Definition at32f413_crm.h:309
CRM_AHB_DIV_64
@ CRM_AHB_DIV_64
Definition at32f413_crm.h:310
CRM_AHB_DIV_8
@ CRM_AHB_DIV_8
Definition at32f413_crm.h:308
CRM_AHB_DIV_512
@ CRM_AHB_DIV_512
Definition at32f413_crm.h:313
CRM_AHB_DIV_128
@ CRM_AHB_DIV_128
Definition at32f413_crm.h:311
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_AHB_DIV_256
@ CRM_AHB_DIV_256
Definition at32f413_crm.h:312
CRM_AHB_DIV_2
@ CRM_AHB_DIV_2
Definition at32f413_crm.h:306
CRM_RTC_CLOCK_HEXT_DIV
@ CRM_RTC_CLOCK_HEXT_DIV
Definition at32f413_crm.h:375
CRM_RTC_CLOCK_LICK
@ CRM_RTC_CLOCK_LICK
Definition at32f413_crm.h:374
CRM_RTC_CLOCK_LEXT
@ CRM_RTC_CLOCK_LEXT
Definition at32f413_crm.h:373
CRM_RTC_CLOCK_NOCLK
@ CRM_RTC_CLOCK_NOCLK
Definition at32f413_crm.h:372
CRM_ADC_DIV_6
@ CRM_ADC_DIV_6
Definition at32f413_crm.h:347
CRM_ADC_DIV_16
@ CRM_ADC_DIV_16
Definition at32f413_crm.h:350
CRM_ADC_DIV_4
@ CRM_ADC_DIV_4
Definition at32f413_crm.h:346
CRM_ADC_DIV_12
@ CRM_ADC_DIV_12
Definition at32f413_crm.h:349
CRM_ADC_DIV_2
@ CRM_ADC_DIV_2
Definition at32f413_crm.h:345
CRM_ADC_DIV_8
@ CRM_ADC_DIV_8
Definition at32f413_crm.h:348
CRM_USB_INT73_INT74
@ CRM_USB_INT73_INT74
Definition at32f413_crm.h:445
CRM_USB_INT19_INT20
@ CRM_USB_INT19_INT20
Definition at32f413_crm.h:444
CRM_CLKOUT_NOCLK
@ CRM_CLKOUT_NOCLK
Definition at32f413_crm.h:402
CRM_CLKOUT_HICK
@ CRM_CLKOUT_HICK
Definition at32f413_crm.h:406
CRM_CLKOUT_USB
@ CRM_CLKOUT_USB
Definition at32f413_crm.h:410
CRM_CLKOUT_LICK
@ CRM_CLKOUT_LICK
Definition at32f413_crm.h:403
CRM_CLKOUT_PLL_DIV_2
@ CRM_CLKOUT_PLL_DIV_2
Definition at32f413_crm.h:408
CRM_CLKOUT_ADC
@ CRM_CLKOUT_ADC
Definition at32f413_crm.h:411
CRM_CLKOUT_LEXT
@ CRM_CLKOUT_LEXT
Definition at32f413_crm.h:404
CRM_CLKOUT_SCLK
@ CRM_CLKOUT_SCLK
Definition at32f413_crm.h:405
CRM_CLKOUT_PLL_DIV_4
@ CRM_CLKOUT_PLL_DIV_4
Definition at32f413_crm.h:409
CRM_CLKOUT_HEXT
@ CRM_CLKOUT_HEXT
Definition at32f413_crm.h:407
CRM_AUTO_STEP_MODE_ENABLE
@ CRM_AUTO_STEP_MODE_ENABLE
Definition at32f413_crm.h:436
CRM_AUTO_STEP_MODE_DISABLE
@ CRM_AUTO_STEP_MODE_DISABLE
Definition at32f413_crm.h:435
CRM_SCLK_HICK
@ CRM_SCLK_HICK
Definition at32f413_crm.h:392
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_SCLK_HEXT
@ CRM_SCLK_HEXT
Definition at32f413_crm.h:393
CRM_TMR2_PERIPH_RESET
@ CRM_TMR2_PERIPH_RESET
Definition at32f413_crm.h:169
CRM_TMR4_PERIPH_RESET
@ CRM_TMR4_PERIPH_RESET
Definition at32f413_crm.h:171
CRM_SPI1_PERIPH_RESET
@ CRM_SPI1_PERIPH_RESET
Definition at32f413_crm.h:161
CRM_TMR10_PERIPH_RESET
@ CRM_TMR10_PERIPH_RESET
Definition at32f413_crm.h:165
CRM_I2C2_PERIPH_RESET
@ CRM_I2C2_PERIPH_RESET
Definition at32f413_crm.h:180
CRM_UART4_PERIPH_RESET
@ CRM_UART4_PERIPH_RESET
Definition at32f413_crm.h:177
CRM_BPR_PERIPH_RESET
@ CRM_BPR_PERIPH_RESET
Definition at32f413_crm.h:183
CRM_ADC2_PERIPH_RESET
@ CRM_ADC2_PERIPH_RESET
Definition at32f413_crm.h:159
CRM_USART1_PERIPH_RESET
@ CRM_USART1_PERIPH_RESET
Definition at32f413_crm.h:163
CRM_IOMUX_PERIPH_RESET
@ CRM_IOMUX_PERIPH_RESET
Definition at32f413_crm.h:151
CRM_CAN1_PERIPH_RESET
@ CRM_CAN1_PERIPH_RESET
Definition at32f413_crm.h:182
CRM_TMR5_PERIPH_RESET
@ CRM_TMR5_PERIPH_RESET
Definition at32f413_crm.h:172
CRM_TMR9_PERIPH_RESET
@ CRM_TMR9_PERIPH_RESET
Definition at32f413_crm.h:164
CRM_GPIOF_PERIPH_RESET
@ CRM_GPIOF_PERIPH_RESET
Definition at32f413_crm.h:157
CRM_TMR1_PERIPH_RESET
@ CRM_TMR1_PERIPH_RESET
Definition at32f413_crm.h:160
CRM_GPIOD_PERIPH_RESET
@ CRM_GPIOD_PERIPH_RESET
Definition at32f413_crm.h:156
CRM_USART2_PERIPH_RESET
@ CRM_USART2_PERIPH_RESET
Definition at32f413_crm.h:175
CRM_GPIOC_PERIPH_RESET
@ CRM_GPIOC_PERIPH_RESET
Definition at32f413_crm.h:155
CRM_CAN2_PERIPH_RESET
@ CRM_CAN2_PERIPH_RESET
Definition at32f413_crm.h:185
CRM_ACC_PERIPH_RESET
@ CRM_ACC_PERIPH_RESET
Definition at32f413_crm.h:167
CRM_TMR8_PERIPH_RESET
@ CRM_TMR8_PERIPH_RESET
Definition at32f413_crm.h:162
CRM_WWDT_PERIPH_RESET
@ CRM_WWDT_PERIPH_RESET
Definition at32f413_crm.h:173
CRM_UART5_PERIPH_RESET
@ CRM_UART5_PERIPH_RESET
Definition at32f413_crm.h:178
CRM_ADC1_PERIPH_RESET
@ CRM_ADC1_PERIPH_RESET
Definition at32f413_crm.h:158
CRM_EXINT_PERIPH_RESET
@ CRM_EXINT_PERIPH_RESET
Definition at32f413_crm.h:152
CRM_TMR3_PERIPH_RESET
@ CRM_TMR3_PERIPH_RESET
Definition at32f413_crm.h:170
CRM_USB_PERIPH_RESET
@ CRM_USB_PERIPH_RESET
Definition at32f413_crm.h:181
CRM_SPI2_PERIPH_RESET
@ CRM_SPI2_PERIPH_RESET
Definition at32f413_crm.h:174
CRM_PWC_PERIPH_RESET
@ CRM_PWC_PERIPH_RESET
Definition at32f413_crm.h:184
CRM_GPIOA_PERIPH_RESET
@ CRM_GPIOA_PERIPH_RESET
Definition at32f413_crm.h:153
CRM_TMR11_PERIPH_RESET
@ CRM_TMR11_PERIPH_RESET
Definition at32f413_crm.h:166
CRM_USART3_PERIPH_RESET
@ CRM_USART3_PERIPH_RESET
Definition at32f413_crm.h:176
CRM_GPIOB_PERIPH_RESET
@ CRM_GPIOB_PERIPH_RESET
Definition at32f413_crm.h:154
CRM_I2C1_PERIPH_RESET
@ CRM_I2C1_PERIPH_RESET
Definition at32f413_crm.h:179
CRM_APB2_DIV_4
@ CRM_APB2_DIV_4
Definition at32f413_crm.h:335
CRM_APB2_DIV_1
@ CRM_APB2_DIV_1
Definition at32f413_crm.h:333
CRM_APB2_DIV_16
@ CRM_APB2_DIV_16
Definition at32f413_crm.h:337
CRM_APB2_DIV_8
@ CRM_APB2_DIV_8
Definition at32f413_crm.h:336
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_LE72MHZ
@ CRM_PLL_OUTPUT_RANGE_LE72MHZ
Definition at32f413_crm.h:284
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_HICK48_NODIV
@ CRM_HICK48_NODIV
Definition at32f413_crm.h:384
CRM_HICK48_DIV6
@ CRM_HICK48_DIV6
Definition at32f413_crm.h:383
MAKE_VALUE
#define MAKE_VALUE(reg_offset, bit_num)
Definition at32f413.h:316
error_status
error_status
error status
Definition at32f413.h:302
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
flag_status
flag_status
flag status
Definition at32f413.h:292
crm_clocks_freq_type
crm clocks freqency structure
Definition at32f413_crm.h:470
crm_clocks_freq_type::adc_freq
uint32_t adc_freq
Definition at32f413_crm.h:475
crm_clocks_freq_type::apb1_freq
uint32_t apb1_freq
Definition at32f413_crm.h:474
crm_clocks_freq_type::apb2_freq
uint32_t apb2_freq
Definition at32f413_crm.h:473
crm_clocks_freq_type::sclk_freq
uint32_t sclk_freq
Definition at32f413_crm.h:471
crm_clocks_freq_type::ahb_freq
uint32_t ahb_freq
Definition at32f413_crm.h:472
crm_type
type define crm register all
Definition at32f413_crm.h:482
crm_type::misc1
__IO uint32_t misc1
Definition at32f413_crm.h:769
crm_type::lickstblien
__IO uint32_t lickstblien
Definition at32f413_crm.h:547
crm_type::uart4en
__IO uint32_t uart4en
Definition at32f413_crm.h:702
crm_type::auto_step_en
__IO uint32_t auto_step_en
Definition at32f413_crm.h:811
crm_type::usart1en
__IO uint32_t usart1en
Definition at32f413_crm.h:673
crm_type::ctrl
__IO uint32_t ctrl
Definition at32f413_crm.h:488
crm_type::adc2en
__IO uint32_t adc2en
Definition at32f413_crm.h:669
crm_type::apb2en
__IO uint32_t apb2en
Definition at32f413_crm.h:656
crm_type::apb1rst
__IO uint32_t apb1rst
Definition at32f413_crm.h:601
crm_type::uart4rst
__IO uint32_t uart4rst
Definition at32f413_crm.h:615
crm_type::misc2
__IO uint32_t misc2
Definition at32f413_crm.h:793
crm_type::tmr11rst
__IO uint32_t tmr11rst
Definition at32f413_crm.h:590
crm_type::accen
__IO uint32_t accen
Definition at32f413_crm.h:678
crm_type::i2c2rst
__IO uint32_t i2c2rst
Definition at32f413_crm.h:618
crm_type::apb2rst
__IO uint32_t apb2rst
Definition at32f413_crm.h:569
crm_type::adc1rst
__IO uint32_t adc1rst
Definition at32f413_crm.h:581
crm_type::adcdiv_h
__IO uint32_t adcdiv_h
Definition at32f413_crm.h:526
crm_type::cfdf
__IO uint32_t cfdf
Definition at32f413_crm.h:546
crm_type::gpioerst
__IO uint32_t gpioerst
Definition at32f413_crm.h:579
crm_type::pllmult_l
__IO uint32_t pllmult_l
Definition at32f413_crm.h:522
crm_type::reserved5
__IO uint32_t reserved5
Definition at32f413_crm.h:622
crm_type::tmr3en
__IO uint32_t tmr3en
Definition at32f413_crm.h:692
crm_type::usart2rst
__IO uint32_t usart2rst
Definition at32f413_crm.h:613
crm_type::tmr3rst
__IO uint32_t tmr3rst
Definition at32f413_crm.h:605
crm_type::hexten
__IO uint32_t hexten
Definition at32f413_crm.h:495
crm_type::gpiocrst
__IO uint32_t gpiocrst
Definition at32f413_crm.h:576
crm_type::bpdc
__IO uint32_t bpdc
Definition at32f413_crm.h:722
crm_type::dma1en
__IO uint32_t dma1en
Definition at32f413_crm.h:638
crm_type::tmr4en
__IO uint32_t tmr4en
Definition at32f413_crm.h:693
crm_type::usbrst
__IO uint32_t usbrst
Definition at32f413_crm.h:619
crm_type::tmr1en
__IO uint32_t tmr1en
Definition at32f413_crm.h:670
crm_type::hickcal_key
__IO uint32_t hickcal_key
Definition at32f413_crm.h:772
crm_type::pllstblfc
__IO uint32_t pllstblfc
Definition at32f413_crm.h:557
crm_type::clk_to_tmr
__IO uint32_t clk_to_tmr
Definition at32f413_crm.h:797
crm_type::rtcsel
__IO uint32_t rtcsel
Definition at32f413_crm.h:729
crm_type::uart5en
__IO uint32_t uart5en
Definition at32f413_crm.h:703
crm_type::hick_to_usb
__IO uint32_t hick_to_usb
Definition at32f413_crm.h:813
crm_type::pllhextdiv
__IO uint32_t pllhextdiv
Definition at32f413_crm.h:521
crm_type::lprstf
__IO uint32_t lprstf
Definition at32f413_crm.h:755
crm_type::uart5rst
__IO uint32_t uart5rst
Definition at32f413_crm.h:616
crm_type::hickcal
__IO uint32_t hickcal
Definition at32f413_crm.h:494
crm_type::sclksel
__IO uint32_t sclksel
Definition at32f413_crm.h:514
crm_type::gpioben
__IO uint32_t gpioben
Definition at32f413_crm.h:662
crm_type::tmr11en
__IO uint32_t tmr11en
Definition at32f413_crm.h:677
crm_type::gpioden
__IO uint32_t gpioden
Definition at32f413_crm.h:664
crm_type::lextstblfc
__IO uint32_t lextstblfc
Definition at32f413_crm.h:554
crm_type::reserved1
__IO uint32_t reserved1
crm reserved1 register, offset:0x28~0x2C
Definition at32f413_crm.h:499
crm_type::usbbufs
__IO uint32_t usbbufs
Definition at32f413_crm.h:776
crm_type::tmr8en
__IO uint32_t tmr8en
Definition at32f413_crm.h:672
crm_type::gpiofen
__IO uint32_t gpiofen
Definition at32f413_crm.h:666
crm_type::hextbyps
__IO uint32_t hextbyps
Definition at32f413_crm.h:497
crm_type::wdtrstf
__IO uint32_t wdtrstf
Definition at32f413_crm.h:753
crm_type::bpdrst
__IO uint32_t bpdrst
Definition at32f413_crm.h:732
crm_type::tmr10en
__IO uint32_t tmr10en
Definition at32f413_crm.h:676
crm_type::usart2en
__IO uint32_t usart2en
Definition at32f413_crm.h:700
crm_type::lickstbl
__IO uint32_t lickstbl
Definition at32f413_crm.h:746
crm_type::tmr9rst
__IO uint32_t tmr9rst
Definition at32f413_crm.h:588
crm_type::tmr8rst
__IO uint32_t tmr8rst
Definition at32f413_crm.h:585
crm_type::nrstf
__IO uint32_t nrstf
Definition at32f413_crm.h:750
crm_type::sramen
__IO uint32_t sramen
Definition at32f413_crm.h:640
crm_type::usbintmap
__IO uint32_t usbintmap
Definition at32f413_crm.h:832
crm_type::lickstblfc
__IO uint32_t lickstblfc
Definition at32f413_crm.h:553
crm_type::swrstf
__IO uint32_t swrstf
Definition at32f413_crm.h:752
crm_type::cfdfc
__IO uint32_t cfdfc
Definition at32f413_crm.h:559
crm_type::can2rst
__IO uint32_t can2rst
Definition at32f413_crm.h:626
crm_type::gpioarst
__IO uint32_t gpioarst
Definition at32f413_crm.h:574
crm_type::apb1en
__IO uint32_t apb1en
Definition at32f413_crm.h:688
crm_type::tmr10rst
__IO uint32_t tmr10rst
Definition at32f413_crm.h:589
crm_type::rstfc
__IO uint32_t rstfc
Definition at32f413_crm.h:748
crm_type::tmr1rst
__IO uint32_t tmr1rst
Definition at32f413_crm.h:583
crm_type::tmr5en
__IO uint32_t tmr5en
Definition at32f413_crm.h:694
crm_type::hextstbl
__IO uint32_t hextstbl
Definition at32f413_crm.h:496
crm_type::usart1rst
__IO uint32_t usart1rst
Definition at32f413_crm.h:586
crm_type::gpioaen
__IO uint32_t gpioaen
Definition at32f413_crm.h:661
crm_type::misc3
__IO uint32_t misc3
Definition at32f413_crm.h:807
crm_type::spi2rst
__IO uint32_t spi2rst
Definition at32f413_crm.h:611
crm_type::spi1rst
__IO uint32_t spi1rst
Definition at32f413_crm.h:584
crm_type::cfg
__IO uint32_t cfg
Definition at32f413_crm.h:511
crm_type::i2c1rst
__IO uint32_t i2c1rst
Definition at32f413_crm.h:617
crm_type::licken
__IO uint32_t licken
Definition at32f413_crm.h:745
crm_type::pllrcs
__IO uint32_t pllrcs
Definition at32f413_crm.h:520
crm_type::tmr9en
__IO uint32_t tmr9en
Definition at32f413_crm.h:675
crm_type::hickstblfc
__IO uint32_t hickstblfc
Definition at32f413_crm.h:555
crm_type::hickstblien
__IO uint32_t hickstblien
Definition at32f413_crm.h:549
crm_type::pllstblf
__IO uint32_t pllstblf
Definition at32f413_crm.h:544
crm_type::hicktrim
__IO uint32_t hicktrim
Definition at32f413_crm.h:493
crm_type::sdio1en
__IO uint32_t sdio1en
Definition at32f413_crm.h:646
crm_type::ahben
__IO uint32_t ahben
Definition at32f413_crm.h:635
crm_type::pllmult_h
__IO uint32_t pllmult_h
Definition at32f413_crm.h:527
crm_type::wwdten
__IO uint32_t wwdten
Definition at32f413_crm.h:696
crm_type::flashen
__IO uint32_t flashen
Definition at32f413_crm.h:642
crm_type::reserved6
__IO uint32_t reserved6
Definition at32f413_crm.h:625
crm_type::usart3rst
__IO uint32_t usart3rst
Definition at32f413_crm.h:614
crm_type::gpiocen
__IO uint32_t gpiocen
Definition at32f413_crm.h:663
crm_type::iomuxen
__IO uint32_t iomuxen
Definition at32f413_crm.h:659
crm_type::usben
__IO uint32_t usben
Definition at32f413_crm.h:706
crm_type::usbdiv_h
__IO uint32_t usbdiv_h
Definition at32f413_crm.h:525
crm_type::lextstblf
__IO uint32_t lextstblf
Definition at32f413_crm.h:541
crm_type::clkoutdiv
__IO uint32_t clkoutdiv
Definition at32f413_crm.h:779
crm_type::rtcen
__IO uint32_t rtcen
Definition at32f413_crm.h:731
crm_type::pwcrst
__IO uint32_t pwcrst
Definition at32f413_crm.h:624
crm_type::apb2div
__IO uint32_t apb2div
Definition at32f413_crm.h:518
crm_type::wwdtrst
__IO uint32_t wwdtrst
Definition at32f413_crm.h:609
crm_type::usart3en
__IO uint32_t usart3en
Definition at32f413_crm.h:701
crm_type::tmr2rst
__IO uint32_t tmr2rst
Definition at32f413_crm.h:604
crm_type::adc1en
__IO uint32_t adc1en
Definition at32f413_crm.h:668
crm_type::pllstbl
__IO uint32_t pllstbl
Definition at32f413_crm.h:501
crm_type::pllstblien
__IO uint32_t pllstblien
Definition at32f413_crm.h:551
crm_type::can1rst
__IO uint32_t can1rst
Definition at32f413_crm.h:621
crm_type::can1en
__IO uint32_t can1en
Definition at32f413_crm.h:708
crm_type::adc2rst
__IO uint32_t adc2rst
Definition at32f413_crm.h:582
crm_type::exintrst
__IO uint32_t exintrst
Definition at32f413_crm.h:573
crm_type::lextbyps
__IO uint32_t lextbyps
Definition at32f413_crm.h:727
crm_type::lextstbl
__IO uint32_t lextstbl
Definition at32f413_crm.h:726
crm_type::usbdiv_l
__IO uint32_t usbdiv_l
Definition at32f413_crm.h:523
crm_type::reserved3
__IO uint32_t reserved3
crm reserved3 register, offset:0x58
Definition at32f413_crm.h:558
crm_type::crcen
__IO uint32_t crcen
Definition at32f413_crm.h:644
crm_type::tmr2en
__IO uint32_t tmr2en
Definition at32f413_crm.h:691
crm_type::hick_to_sclk
__IO uint32_t hick_to_sclk
Definition at32f413_crm.h:814
crm_type::sclksts
__IO uint32_t sclksts
Definition at32f413_crm.h:515
crm_type::i2c1en
__IO uint32_t i2c1en
Definition at32f413_crm.h:704
crm_type::hextstblien
__IO uint32_t hextstblien
Definition at32f413_crm.h:550
crm_type::gpiodrst
__IO uint32_t gpiodrst
Definition at32f413_crm.h:577
crm_type::ctrlsts
__IO uint32_t ctrlsts
Definition at32f413_crm.h:742
crm_type::bpren
__IO uint32_t bpren
Definition at32f413_crm.h:710
crm_type::reserved2
__IO uint32_t reserved2
crm reserved2 register, offset:0x4C~0x34
Definition at32f413_crm.h:502
crm_type::intmap
__IO uint32_t intmap
Definition at32f413_crm.h:829
crm_type::hickdiv
__IO uint32_t hickdiv
Definition at32f413_crm.h:777
crm_type::accrst
__IO uint32_t accrst
Definition at32f413_crm.h:591
crm_type::reserved4
__IO uint32_t reserved4
Definition at32f413_crm.h:560
crm_type::wwdtrstf
__IO uint32_t wwdtrstf
Definition at32f413_crm.h:754
crm_type::porrstf
__IO uint32_t porrstf
Definition at32f413_crm.h:751
crm_type::pllrange
__IO uint32_t pllrange
Definition at32f413_crm.h:528
crm_type::hextstblfc
__IO uint32_t hextstblfc
Definition at32f413_crm.h:556
crm_type::tmr4rst
__IO uint32_t tmr4rst
Definition at32f413_crm.h:606
crm_type::bprrst
__IO uint32_t bprrst
Definition at32f413_crm.h:623
crm_type::iomuxrst
__IO uint32_t iomuxrst
Definition at32f413_crm.h:572
crm_type::cfden
__IO uint32_t cfden
Definition at32f413_crm.h:498
crm_type::adcdiv_l
__IO uint32_t adcdiv_l
Definition at32f413_crm.h:519
crm_type::apb1div
__IO uint32_t apb1div
Definition at32f413_crm.h:517
crm_type::pwcen
__IO uint32_t pwcen
Definition at32f413_crm.h:711
crm_type::lextstblien
__IO uint32_t lextstblien
Definition at32f413_crm.h:548
crm_type::lickstblf
__IO uint32_t lickstblf
Definition at32f413_crm.h:540
crm_type::clkout_sel
__IO uint32_t clkout_sel
Definition at32f413_crm.h:524
crm_type::hicken
__IO uint32_t hicken
Definition at32f413_crm.h:491
crm_type::lexten
__IO uint32_t lexten
Definition at32f413_crm.h:725
crm_type::hickstbl
__IO uint32_t hickstbl
Definition at32f413_crm.h:492
crm_type::i2c2en
__IO uint32_t i2c2en
Definition at32f413_crm.h:705
crm_type::spi1en
__IO uint32_t spi1en
Definition at32f413_crm.h:671
crm_type::dma2en
__IO uint32_t dma2en
Definition at32f413_crm.h:639
crm_type::hextstblf
__IO uint32_t hextstblf
Definition at32f413_crm.h:543
crm_type::spi2en
__IO uint32_t spi2en
Definition at32f413_crm.h:698
crm_type::gpiobrst
__IO uint32_t gpiobrst
Definition at32f413_crm.h:575
crm_type::pllen
__IO uint32_t pllen
Definition at32f413_crm.h:500
crm_type::tmr5rst
__IO uint32_t tmr5rst
Definition at32f413_crm.h:607
crm_type::can2en
__IO uint32_t can2en
Definition at32f413_crm.h:713
crm_type::hickstblf
__IO uint32_t hickstblf
Definition at32f413_crm.h:542
crm_type::clkint
__IO uint32_t clkint
Definition at32f413_crm.h:537
crm_type::ahbdiv
__IO uint32_t ahbdiv
Definition at32f413_crm.h:516


AT32F413 Firmwary Library: at32f413_debug.c Source File

  • libraries
  • drivers
  • src
at32f413_debug.c
Go to the documentation of this file.
1
26#include "at32f413_conf.h"
27
37#ifdef DEBUG_MODULE_ENABLED
38
48uint32_t debug_device_id_get(void)
49{
50 return DEBUGMCU->pid;
51}
52
78void debug_periph_mode_set(uint32_t periph_debug_mode, confirm_state new_state)
79{
80
81 if(new_state != FALSE)
82 {
83 DEBUGMCU->ctrl |= periph_debug_mode;
84 }
85 else
86 {
87 DEBUGMCU->ctrl &= ~periph_debug_mode;
88 }
89}
90
95#endif
96
debug_periph_mode_set
void debug_periph_mode_set(uint32_t periph_debug_mode, confirm_state new_state)
set periph debug mode
Definition at32f413_debug.c:78
debug_device_id_get
uint32_t debug_device_id_get(void)
get debug device id
Definition at32f413_debug.c:48
DEBUGMCU
#define DEBUGMCU
Definition at32f413_debug.h:135
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
FALSE
@ FALSE
Definition at32f413.h:297
at32f413_conf.h
at32f413 config header file


AT32F413 Firmwary Library: at32f413_debug.h Source File

  • libraries
  • drivers
  • inc
at32f413_debug.h
Go to the documentation of this file.
1
26/* Define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_DEBUG_H
28#define __AT32F413_DEBUG_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34
35/* Includes ------------------------------------------------------------------*/
36#include "at32f413.h"
37
50#define DEBUG_SLEEP 0x00000001
51#define DEBUG_DEEPSLEEP 0x00000002
52#define DEBUG_STANDBY 0x00000004
53#define DEBUG_WDT_PAUSE 0x00000100
54#define DEBUG_WWDT_PAUSE 0x00000200
55#define DEBUG_TMR1_PAUSE 0x00000400
56#define DEBUG_TMR2_PAUSE 0x00000800
57#define DEBUG_TMR3_PAUSE 0x00001000
58#define DEBUG_TMR4_PAUSE 0x00002000
59#define DEBUG_CAN1_PAUSE 0x00004000
60#define DEBUG_I2C1_SMBUS_TIMEOUT 0x00008000
61#define DEBUG_I2C2_SMBUS_TIMEOUT 0x00010000
62#define DEBUG_TMR8_PAUSE 0x00020000
63#define DEBUG_TMR5_PAUSE 0x00040000
64#define DEBUG_CAN2_PAUSE 0x00200000
65#define DEBUG_TMR9_PAUSE 0x10000000
66#define DEBUG_TMR10_PAUSE 0x20000000
67#define DEBUG_TMR11_PAUSE 0x40000000
80typedef struct
81{
85 union
86 {
87 __IO uint32_t pid;
88 struct
89 {
90 __IO uint32_t pid : 32;/* [31:0] */
91 } idcode_bit;
92 };
93
97 union
98 {
99 __IO uint32_t ctrl;
100 struct
101 {
102 __IO uint32_t sleep_debug : 1;/* [0] */
103 __IO uint32_t deepsleep_debug : 1;/* [1] */
104 __IO uint32_t standby_debug : 1;/* [2] */
105 __IO uint32_t reserved1 : 2;/* [4:3] */
106 __IO uint32_t trace_ioen : 1;/* [5] */
107 __IO uint32_t trace_mode : 2;/* [7:6] */
108 __IO uint32_t wdt_pause : 1;/* [8] */
109 __IO uint32_t wwdt_pause : 1;/* [9] */
110 __IO uint32_t tmr1_pause : 1;/* [10] */
111 __IO uint32_t tmr2_pause : 1;/* [11] */
112 __IO uint32_t tmr3_pause : 1;/* [12] */
113 __IO uint32_t tmr4_pause : 1;/* [13] */
114 __IO uint32_t can1_pause : 1;/* [14] */
115 __IO uint32_t i2c1_smbus_timeout : 1;/* [15] */
116 __IO uint32_t i2c2_smbus_timeout : 1;/* [16] */
117 __IO uint32_t tmr8_pause : 1;/* [17] */
118 __IO uint32_t tmr5_pause : 1;/* [18] */
119 __IO uint32_t reserved2 : 2;/* [20:19] */
120 __IO uint32_t can2_pause : 1;/* [21] */
121 __IO uint32_t reserved3 : 6;/* [27:22] */
122 __IO uint32_t tmr9_pause : 1;/* [28] */
123 __IO uint32_t tmr10_pause : 1;/* [29] */
124 __IO uint32_t tmr11_pause : 1;/* [30] */
125 __IO uint32_t reserved4 : 1;/* [31] */
126 } ctrl_bit;
127 };
128
129} debug_type;
130
135#define DEBUGMCU ((debug_type *) DEBUG_BASE)
136
141uint32_t debug_device_id_get(void);
142void debug_periph_mode_set(uint32_t periph_debug_mode, confirm_state new_state);
143
156#ifdef __cplusplus
157}
158#endif
159
160#endif
at32f413.h
at32f413 header file
debug_periph_mode_set
void debug_periph_mode_set(uint32_t periph_debug_mode, confirm_state new_state)
set periph debug mode
Definition at32f413_debug.c:78
debug_device_id_get
uint32_t debug_device_id_get(void)
get debug device id
Definition at32f413_debug.c:48
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
debug_type
type define debug register all
Definition at32f413_debug.h:81
debug_type::can2_pause
__IO uint32_t can2_pause
Definition at32f413_debug.h:120
debug_type::tmr11_pause
__IO uint32_t tmr11_pause
Definition at32f413_debug.h:124
debug_type::i2c2_smbus_timeout
__IO uint32_t i2c2_smbus_timeout
Definition at32f413_debug.h:116
debug_type::pid
__IO uint32_t pid
Definition at32f413_debug.h:87
debug_type::reserved2
__IO uint32_t reserved2
Definition at32f413_debug.h:119
debug_type::sleep_debug
__IO uint32_t sleep_debug
Definition at32f413_debug.h:102
debug_type::tmr8_pause
__IO uint32_t tmr8_pause
Definition at32f413_debug.h:117
debug_type::trace_ioen
__IO uint32_t trace_ioen
Definition at32f413_debug.h:106
debug_type::ctrl
__IO uint32_t ctrl
Definition at32f413_debug.h:99
debug_type::reserved3
__IO uint32_t reserved3
Definition at32f413_debug.h:121
debug_type::tmr9_pause
__IO uint32_t tmr9_pause
Definition at32f413_debug.h:122
debug_type::tmr2_pause
__IO uint32_t tmr2_pause
Definition at32f413_debug.h:111
debug_type::wdt_pause
__IO uint32_t wdt_pause
Definition at32f413_debug.h:108
debug_type::deepsleep_debug
__IO uint32_t deepsleep_debug
Definition at32f413_debug.h:103
debug_type::tmr1_pause
__IO uint32_t tmr1_pause
Definition at32f413_debug.h:110
debug_type::i2c1_smbus_timeout
__IO uint32_t i2c1_smbus_timeout
Definition at32f413_debug.h:115
debug_type::reserved4
__IO uint32_t reserved4
Definition at32f413_debug.h:125
debug_type::trace_mode
__IO uint32_t trace_mode
Definition at32f413_debug.h:107
debug_type::standby_debug
__IO uint32_t standby_debug
Definition at32f413_debug.h:104
debug_type::tmr10_pause
__IO uint32_t tmr10_pause
Definition at32f413_debug.h:123
debug_type::wwdt_pause
__IO uint32_t wwdt_pause
Definition at32f413_debug.h:109
debug_type::can1_pause
__IO uint32_t can1_pause
Definition at32f413_debug.h:114
debug_type::tmr4_pause
__IO uint32_t tmr4_pause
Definition at32f413_debug.h:113
debug_type::tmr5_pause
__IO uint32_t tmr5_pause
Definition at32f413_debug.h:118
debug_type::tmr3_pause
__IO uint32_t tmr3_pause
Definition at32f413_debug.h:112
debug_type::reserved1
__IO uint32_t reserved1
Definition at32f413_debug.h:105


AT32F413 Firmwary Library: at32f413_def.h Source File

  • libraries
  • drivers
  • inc
at32f413_def.h
Go to the documentation of this file.
1
26/* Define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_DEF_H
28#define __AT32F413_DEF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* gnu compiler */
35#if defined (__GNUC__)
36 #ifndef ALIGNED_HEAD
37 #define ALIGNED_HEAD
38 #endif
39 #ifndef ALIGNED_TAIL
40 #define ALIGNED_TAIL __attribute__ ((aligned (4)))
41 #endif
42#endif
43
44/* arm compiler */
45#if defined (__CC_ARM)
46 #ifndef ALIGNED_HEAD
47 #define ALIGNED_HEAD __align(4)
48 #endif
49 #ifndef ALIGNED_TAIL
50 #define ALIGNED_TAIL
51 #endif
52#endif
53
54/* iar compiler */
55#if defined (__ICCARM__)
56 #ifndef ALIGNED_HEAD
57 #define ALIGNED_HEAD
58 #endif
59 #ifndef ALIGNED_TAIL
60 #define ALIGNED_TAIL
61 #endif
62#endif
63
64#define UNUSED(x) (void)x /* to avoid gcc/g++ warnings */
65
66#ifdef __cplusplus
67}
68#endif
69
70#endif


AT32F413 Firmwary Library: at32f413_dma.c Source File

  • libraries
  • drivers
  • src
at32f413_dma.c
Go to the documentation of this file.
1
26#include "at32f413_conf.h"
27
37#ifdef DMA_MODULE_ENABLED
38
63void dma_reset(dma_channel_type* dmax_channely)
64{
65 uint32_t temp = 0;
66 dmax_channely->ctrl_bit.chen = FALSE;
67 dmax_channely->ctrl = 0;
68 dmax_channely->dtcnt = 0;
69 dmax_channely->paddr = 0;
70 dmax_channely->maddr = 0;
71
72 temp = (uint32_t)dmax_channely;
73
74 if((temp & 0x4ff) < 0x408)
75 {
76 /* dma1 channel */
77 DMA1->clr |= (uint32_t)(0x0f << ((((temp & 0xff) - 0x08) / 0x14) * 4));
78 }
79 else if((temp & 0x4ff) < 0x488)
80 {
81 /* dma2 channel */
82 DMA2->clr |= (uint32_t)(0x0f << ((((temp & 0xff) - 0x08) / 0x14) * 4));
83 }
84}
85
108void dma_data_number_set(dma_channel_type* dmax_channely, uint16_t data_number)
109{
110 dmax_channely->dtcnt = data_number;
111}
112
133uint16_t dma_data_number_get(dma_channel_type* dmax_channely)
134{
135 return (uint16_t)dmax_channely->dtcnt;
136}
137
164void dma_interrupt_enable(dma_channel_type* dmax_channely, uint32_t dma_int, confirm_state new_state)
165{
166 if (new_state != FALSE)
167 {
168 dmax_channely->ctrl |= dma_int;
169 }
170 else
171 {
172 dmax_channely->ctrl &= ~dma_int;
173 }
174}
175
197void dma_channel_enable(dma_channel_type* dmax_channely, confirm_state new_state)
198{
199 dmax_channely->ctrl_bit.chen = new_state;
200}
201
237void dma_flexible_config(dma_type* dma_x, uint8_t flex_channelx, dma_flexible_request_type flexible_request)
238{
239 if(dma_x->src_sel1_bit.dma_flex_en == RESET)
240 {
241 dma_x->src_sel1_bit.dma_flex_en = TRUE;
242 }
243
244 if(flex_channelx == FLEX_CHANNEL1)
245 {
246 dma_x->src_sel0_bit.ch1_src = flexible_request;
247 }
248 else if(flex_channelx == FLEX_CHANNEL2)
249 {
250 dma_x->src_sel0_bit.ch2_src = flexible_request;
251 }
252 else if(flex_channelx == FLEX_CHANNEL3)
253 {
254 dma_x->src_sel0_bit.ch3_src = flexible_request;
255 }
256 else if(flex_channelx == FLEX_CHANNEL4)
257 {
258 dma_x->src_sel0_bit.ch4_src = flexible_request;
259 }
260 else if(flex_channelx == FLEX_CHANNEL5)
261 {
262 dma_x->src_sel1_bit.ch5_src = flexible_request;
263 }
264 else if(flex_channelx == FLEX_CHANNEL6)
265 {
266 dma_x->src_sel1_bit.ch6_src = flexible_request;
267 }
268 else
269 {
270 if(flex_channelx == FLEX_CHANNEL7)
271 {
272 dma_x->src_sel1_bit.ch7_src = flexible_request;
273 }
274 }
275}
276
297 flag_status dma_interrupt_flag_get(uint32_t dmax_flag)
298{
299 flag_status status = RESET;
300 uint32_t temp = 0;
301
302 if(dmax_flag > 0x10000000)
303 {
304 temp = DMA2->sts;
305 }
306 else
307 {
308 temp = DMA1->sts;
309 }
310
311 if ((temp & dmax_flag) != (uint16_t)RESET)
312 {
313 status = SET;
314 }
315 else
316 {
317 status = RESET;
318 }
319
320 return status;
321}
322
343 flag_status dma_flag_get(uint32_t dmax_flag)
344{
345 flag_status status = RESET;
346 uint32_t temp = 0;
347
348 if(dmax_flag > 0x10000000)
349 {
350 temp = DMA2->sts;
351 }
352 else
353 {
354 temp = DMA1->sts;
355 }
356
357 if ((temp & dmax_flag) != (uint16_t)RESET)
358 {
359 status = SET;
360 }
361 else
362 {
363 status = RESET;
364 }
365
366 return status;
367}
368
389void dma_flag_clear(uint32_t dmax_flag)
390{
391 if(dmax_flag > ((uint32_t)0x10000000))
392 {
393 DMA2->clr = (uint32_t)(dmax_flag & 0x0FFFFFFF);
394 }
395 else
396 {
397 DMA1->clr = dmax_flag;
398 }
399}
400
407void dma_default_para_init(dma_init_type* dma_init_struct)
408{
409 dma_init_struct->peripheral_base_addr = 0x0;
410 dma_init_struct->memory_base_addr = 0x0;
411 dma_init_struct->direction = DMA_DIR_PERIPHERAL_TO_MEMORY;
412 dma_init_struct->buffer_size = 0x0;
413 dma_init_struct->peripheral_inc_enable = FALSE;
414 dma_init_struct->memory_inc_enable = FALSE;
415 dma_init_struct->peripheral_data_width = DMA_PERIPHERAL_DATA_WIDTH_BYTE;
416 dma_init_struct->memory_data_width = DMA_MEMORY_DATA_WIDTH_BYTE;
417 dma_init_struct->loop_mode_enable = FALSE;
418 dma_init_struct->priority = DMA_PRIORITY_LOW;
419}
420
442void dma_init(dma_channel_type* dmax_channely, dma_init_type* dma_init_struct)
443{
444 /* clear ctrl register dtd bit and m2m bit */
445 dmax_channely->ctrl &= 0xbfef;
446 dmax_channely->ctrl |= dma_init_struct->direction;
447
448 dmax_channely->ctrl_bit.chpl = dma_init_struct->priority;
449 dmax_channely->ctrl_bit.mwidth = dma_init_struct->memory_data_width;
450 dmax_channely->ctrl_bit.pwidth = dma_init_struct->peripheral_data_width;
451 dmax_channely->ctrl_bit.mincm = dma_init_struct->memory_inc_enable;
452 dmax_channely->ctrl_bit.pincm = dma_init_struct->peripheral_inc_enable;
453 dmax_channely->ctrl_bit.lm = dma_init_struct->loop_mode_enable;
454 dmax_channely->dtcnt = dma_init_struct->buffer_size;
455 dmax_channely->paddr = dma_init_struct->peripheral_base_addr;
456 dmax_channely->maddr = dma_init_struct->memory_base_addr;
457}
458
463#endif
464
dma_init_struct
dma_init_type dma_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:38
dma_flexible_request_type
dma_flexible_request_type
dma flexible request type
Definition at32f413_dma.h:150
DMA_PERIPHERAL_DATA_WIDTH_BYTE
@ DMA_PERIPHERAL_DATA_WIDTH_BYTE
Definition at32f413_dma.h:245
DMA_DIR_PERIPHERAL_TO_MEMORY
@ DMA_DIR_PERIPHERAL_TO_MEMORY
Definition at32f413_dma.h:216
DMA_MEMORY_DATA_WIDTH_BYTE
@ DMA_MEMORY_DATA_WIDTH_BYTE
Definition at32f413_dma.h:255
DMA_PRIORITY_LOW
@ DMA_PRIORITY_LOW
Definition at32f413_dma.h:265
FLEX_CHANNEL5
#define FLEX_CHANNEL5
Definition at32f413_dma.h:67
FLEX_CHANNEL7
#define FLEX_CHANNEL7
Definition at32f413_dma.h:69
FLEX_CHANNEL3
#define FLEX_CHANNEL3
Definition at32f413_dma.h:65
FLEX_CHANNEL1
#define FLEX_CHANNEL1
Definition at32f413_dma.h:63
FLEX_CHANNEL6
#define FLEX_CHANNEL6
Definition at32f413_dma.h:68
FLEX_CHANNEL4
#define FLEX_CHANNEL4
Definition at32f413_dma.h:66
FLEX_CHANNEL2
#define FLEX_CHANNEL2
Definition at32f413_dma.h:64
dma_channel_enable
void dma_channel_enable(dma_channel_type *dmax_channely, confirm_state new_state)
enable or disable dma channely
Definition at32f413_dma.c:197
dma_default_para_init
void dma_default_para_init(dma_init_type *dma_init_struct)
dma init config with its default value.
Definition at32f413_dma.c:407
dma_interrupt_flag_get
flag_status dma_interrupt_flag_get(uint32_t dmax_flag)
get dma interrupt flag
Definition at32f413_dma.c:297
dma_flexible_config
void dma_flexible_config(dma_type *dma_x, uint8_t flex_channelx, dma_flexible_request_type flexible_request)
initialize the dma_x flexible function according to the specified parameters.
Definition at32f413_dma.c:237
dma_interrupt_enable
void dma_interrupt_enable(dma_channel_type *dmax_channely, uint32_t dma_int, confirm_state new_state)
enable or disable dma interrupt
Definition at32f413_dma.c:164
dma_flag_get
flag_status dma_flag_get(uint32_t dmax_flag)
get dma flag
Definition at32f413_dma.c:343
dma_data_number_get
uint16_t dma_data_number_get(dma_channel_type *dmax_channely)
get number of data from dtcnt register
Definition at32f413_dma.c:133
dma_flag_clear
void dma_flag_clear(uint32_t dmax_flag)
clear dma flag
Definition at32f413_dma.c:389
dma_reset
void dma_reset(dma_channel_type *dmax_channely)
reset the dmax channely registers.
Definition at32f413_dma.c:63
dma_init
void dma_init(dma_channel_type *dmax_channely, dma_init_type *dma_init_struct)
dma init
Definition at32f413_dma.c:442
dma_data_number_set
void dma_data_number_set(dma_channel_type *dmax_channely, uint16_t data_number)
set the number of data to be transferred
Definition at32f413_dma.c:108
DMA2
#define DMA2
Definition at32f413_dma.h:488
DMA1
#define DMA1
Definition at32f413_dma.h:479
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
flag_status
flag_status
flag status
Definition at32f413.h:292
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
SET
@ SET
Definition at32f413.h:292
at32f413_conf.h
at32f413 config header file
dma_channel_type
type define dma channel register all
Definition at32f413_dma.h:412
dma_channel_type::dtcnt
__IO uint32_t dtcnt
Definition at32f413_dma.h:442
dma_channel_type::pwidth
__IO uint32_t pwidth
Definition at32f413_dma.h:429
dma_channel_type::paddr
__IO uint32_t paddr
Definition at32f413_dma.h:455
dma_channel_type::mincm
__IO uint32_t mincm
Definition at32f413_dma.h:428
dma_channel_type::ctrl_bit
struct dma_channel_type::@351::@359 ctrl_bit
dma_channel_type::chen
__IO uint32_t chen
Definition at32f413_dma.h:421
dma_channel_type::lm
__IO uint32_t lm
Definition at32f413_dma.h:426
dma_channel_type::mwidth
__IO uint32_t mwidth
Definition at32f413_dma.h:430
dma_channel_type::maddr
__IO uint32_t maddr
Definition at32f413_dma.h:467
dma_channel_type::pincm
__IO uint32_t pincm
Definition at32f413_dma.h:427
dma_channel_type::ctrl
__IO uint32_t ctrl
Definition at32f413_dma.h:418
dma_channel_type::chpl
__IO uint32_t chpl
Definition at32f413_dma.h:431
dma_init_type
dma init type
Definition at32f413_dma.h:275
dma_init_type::loop_mode_enable
confirm_state loop_mode_enable
Definition at32f413_dma.h:284
dma_init_type::buffer_size
uint16_t buffer_size
Definition at32f413_dma.h:279
dma_init_type::memory_data_width
dma_memory_data_size_type memory_data_width
Definition at32f413_dma.h:283
dma_init_type::priority
dma_priority_level_type priority
Definition at32f413_dma.h:285
dma_init_type::peripheral_inc_enable
confirm_state peripheral_inc_enable
Definition at32f413_dma.h:280
dma_init_type::memory_inc_enable
confirm_state memory_inc_enable
Definition at32f413_dma.h:281
dma_init_type::direction
dma_dir_type direction
Definition at32f413_dma.h:278
dma_init_type::peripheral_base_addr
uint32_t peripheral_base_addr
Definition at32f413_dma.h:276
dma_init_type::memory_base_addr
uint32_t memory_base_addr
Definition at32f413_dma.h:277
dma_init_type::peripheral_data_width
dma_peripheral_data_size_type peripheral_data_width
Definition at32f413_dma.h:282
dma_type
type define dma register
Definition at32f413_dma.h:292
dma_type::src_sel1_bit
struct dma_type::@345::@350 src_sel1_bit
dma_type::ch2_src
__IO uint32_t ch2_src
Definition at32f413_dma.h:385
dma_type::ch3_src
__IO uint32_t ch3_src
Definition at32f413_dma.h:386
dma_type::dma_flex_en
__IO uint32_t dma_flex_en
Definition at32f413_dma.h:402
dma_type::ch5_src
__IO uint32_t ch5_src
Definition at32f413_dma.h:399
dma_type::src_sel0_bit
struct dma_type::@343::@349 src_sel0_bit
dma_type::ch1_src
__IO uint32_t ch1_src
Definition at32f413_dma.h:384
dma_type::ch7_src
__IO uint32_t ch7_src
Definition at32f413_dma.h:401
dma_type::ch4_src
__IO uint32_t ch4_src
Definition at32f413_dma.h:387
dma_type::ch6_src
__IO uint32_t ch6_src
Definition at32f413_dma.h:400


AT32F413 Firmwary Library: at32f413_dma.h Source File

  • libraries
  • drivers
  • inc
at32f413_dma.h
Go to the documentation of this file.
1
26/* Define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_DMA_H
28#define __AT32F413_DMA_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34
35/* Includes ------------------------------------------------------------------*/
36#include "at32f413.h"
37
51#define DMA_FDT_INT ((uint32_t)0x00000002)
52#define DMA_HDT_INT ((uint32_t)0x00000004)
53#define DMA_DTERR_INT ((uint32_t)0x00000008)
63#define FLEX_CHANNEL1 ((uint8_t)0x01)
64#define FLEX_CHANNEL2 ((uint8_t)0x02)
65#define FLEX_CHANNEL3 ((uint8_t)0x03)
66#define FLEX_CHANNEL4 ((uint8_t)0x04)
67#define FLEX_CHANNEL5 ((uint8_t)0x05)
68#define FLEX_CHANNEL6 ((uint8_t)0x06)
69#define FLEX_CHANNEL7 ((uint8_t)0x07)
80#define DMA1_GL1_FLAG ((uint32_t)0x00000001)
81#define DMA1_FDT1_FLAG ((uint32_t)0x00000002)
82#define DMA1_HDT1_FLAG ((uint32_t)0x00000004)
83#define DMA1_DTERR1_FLAG ((uint32_t)0x00000008)
84#define DMA1_GL2_FLAG ((uint32_t)0x00000010)
85#define DMA1_FDT2_FLAG ((uint32_t)0x00000020)
86#define DMA1_HDT2_FLAG ((uint32_t)0x00000040)
87#define DMA1_DTERR2_FLAG ((uint32_t)0x00000080)
88#define DMA1_GL3_FLAG ((uint32_t)0x00000100)
89#define DMA1_FDT3_FLAG ((uint32_t)0x00000200)
90#define DMA1_HDT3_FLAG ((uint32_t)0x00000400)
91#define DMA1_DTERR3_FLAG ((uint32_t)0x00000800)
92#define DMA1_GL4_FLAG ((uint32_t)0x00001000)
93#define DMA1_FDT4_FLAG ((uint32_t)0x00002000)
94#define DMA1_HDT4_FLAG ((uint32_t)0x00004000)
95#define DMA1_DTERR4_FLAG ((uint32_t)0x00008000)
96#define DMA1_GL5_FLAG ((uint32_t)0x00010000)
97#define DMA1_FDT5_FLAG ((uint32_t)0x00020000)
98#define DMA1_HDT5_FLAG ((uint32_t)0x00040000)
99#define DMA1_DTERR5_FLAG ((uint32_t)0x00080000)
100#define DMA1_GL6_FLAG ((uint32_t)0x00100000)
101#define DMA1_FDT6_FLAG ((uint32_t)0x00200000)
102#define DMA1_HDT6_FLAG ((uint32_t)0x00400000)
103#define DMA1_DTERR6_FLAG ((uint32_t)0x00800000)
104#define DMA1_GL7_FLAG ((uint32_t)0x01000000)
105#define DMA1_FDT7_FLAG ((uint32_t)0x02000000)
106#define DMA1_HDT7_FLAG ((uint32_t)0x04000000)
107#define DMA1_DTERR7_FLAG ((uint32_t)0x08000000)
109#define DMA2_GL1_FLAG ((uint32_t)0x10000001)
110#define DMA2_FDT1_FLAG ((uint32_t)0x10000002)
111#define DMA2_HDT1_FLAG ((uint32_t)0x10000004)
112#define DMA2_DTERR1_FLAG ((uint32_t)0x10000008)
113#define DMA2_GL2_FLAG ((uint32_t)0x10000010)
114#define DMA2_FDT2_FLAG ((uint32_t)0x10000020)
115#define DMA2_HDT2_FLAG ((uint32_t)0x10000040)
116#define DMA2_DTERR2_FLAG ((uint32_t)0x10000080)
117#define DMA2_GL3_FLAG ((uint32_t)0x10000100)
118#define DMA2_FDT3_FLAG ((uint32_t)0x10000200)
119#define DMA2_HDT3_FLAG ((uint32_t)0x10000400)
120#define DMA2_DTERR3_FLAG ((uint32_t)0x10000800)
121#define DMA2_GL4_FLAG ((uint32_t)0x10001000)
122#define DMA2_FDT4_FLAG ((uint32_t)0x10002000)
123#define DMA2_HDT4_FLAG ((uint32_t)0x10004000)
124#define DMA2_DTERR4_FLAG ((uint32_t)0x10008000)
125#define DMA2_GL5_FLAG ((uint32_t)0x10010000)
126#define DMA2_FDT5_FLAG ((uint32_t)0x10020000)
127#define DMA2_HDT5_FLAG ((uint32_t)0x10040000)
128#define DMA2_DTERR5_FLAG ((uint32_t)0x10080000)
129#define DMA2_GL6_FLAG ((uint32_t)0x10100000)
130#define DMA2_FDT6_FLAG ((uint32_t)0x10200000)
131#define DMA2_HDT6_FLAG ((uint32_t)0x10400000)
132#define DMA2_DTERR6_FLAG ((uint32_t)0x10800000)
133#define DMA2_GL7_FLAG ((uint32_t)0x11000000)
134#define DMA2_FDT7_FLAG ((uint32_t)0x12000000)
135#define DMA2_HDT7_FLAG ((uint32_t)0x14000000)
136#define DMA2_DTERR7_FLAG ((uint32_t)0x18000000)
149typedef enum
150{
151 DMA_FLEXIBLE_ADC1 = 0x01,
152 DMA_FLEXIBLE_SPI1_RX = 0x09,
153 DMA_FLEXIBLE_SPI1_TX = 0x0A,
154 DMA_FLEXIBLE_SPI2_RX = 0x0B,
155 DMA_FLEXIBLE_SPI2_TX = 0x0C,
156 DMA_FLEXIBLE_UART1_RX = 0x19,
157 DMA_FLEXIBLE_UART1_TX = 0x1A,
158 DMA_FLEXIBLE_UART2_RX = 0x1B,
159 DMA_FLEXIBLE_UART2_TX = 0x1C,
160 DMA_FLEXIBLE_UART3_RX = 0x1D,
161 DMA_FLEXIBLE_UART3_TX = 0x1E,
162 DMA_FLEXIBLE_UART4_RX = 0x1F,
163 DMA_FLEXIBLE_UART4_TX = 0x20,
164 DMA_FLEXIBLE_UART5_RX = 0x21,
165 DMA_FLEXIBLE_UART5_TX = 0x22,
166 DMA_FLEXIBLE_I2C1_RX = 0x29,
167 DMA_FLEXIBLE_I2C1_TX = 0x2A,
168 DMA_FLEXIBLE_I2C2_RX = 0x2B,
169 DMA_FLEXIBLE_I2C2_TX = 0x2C,
170 DMA_FLEXIBLE_SDIO1 = 0x31,
171 DMA_FLEXIBLE_TMR1_TRIG = 0x35,
172 DMA_FLEXIBLE_TMR1_HALL = 0x36,
173 DMA_FLEXIBLE_TMR1_OVERFLOW = 0x37,
174 DMA_FLEXIBLE_TMR1_CH1 = 0x38,
175 DMA_FLEXIBLE_TMR1_CH2 = 0x39,
176 DMA_FLEXIBLE_TMR1_CH3 = 0x3A,
177 DMA_FLEXIBLE_TMR1_CH4 = 0x3B,
178 DMA_FLEXIBLE_TMR2_TRIG = 0x3D,
179 DMA_FLEXIBLE_TMR2_OVERFLOW = 0x3F,
180 DMA_FLEXIBLE_TMR2_CH1 = 0x40,
181 DMA_FLEXIBLE_TMR2_CH2 = 0x41,
182 DMA_FLEXIBLE_TMR2_CH3 = 0x42,
183 DMA_FLEXIBLE_TMR2_CH4 = 0x43,
184 DMA_FLEXIBLE_TMR3_TRIG = 0x45,
185 DMA_FLEXIBLE_TMR3_OVERFLOW = 0x47,
186 DMA_FLEXIBLE_TMR3_CH1 = 0x48,
187 DMA_FLEXIBLE_TMR3_CH2 = 0x49,
188 DMA_FLEXIBLE_TMR3_CH3 = 0x4A,
189 DMA_FLEXIBLE_TMR3_CH4 = 0x4B,
190 DMA_FLEXIBLE_TMR4_TRIG = 0x4D,
191 DMA_FLEXIBLE_TMR4_OVERFLOW = 0x4F,
192 DMA_FLEXIBLE_TMR4_CH1 = 0x50,
193 DMA_FLEXIBLE_TMR4_CH2 = 0x51,
194 DMA_FLEXIBLE_TMR4_CH3 = 0x52,
195 DMA_FLEXIBLE_TMR4_CH4 = 0x53,
196 DMA_FLEXIBLE_TMR5_TRIG = 0x55,
197 DMA_FLEXIBLE_TMR5_OVERFLOW = 0x57,
198 DMA_FLEXIBLE_TMR5_CH1 = 0x58,
199 DMA_FLEXIBLE_TMR5_CH2 = 0x59,
200 DMA_FLEXIBLE_TMR5_CH3 = 0x5A,
201 DMA_FLEXIBLE_TMR5_CH4 = 0x5B,
202 DMA_FLEXIBLE_TMR8_TRIG = 0x6D,
203 DMA_FLEXIBLE_TMR8_HALL = 0x6E,
204 DMA_FLEXIBLE_TMR8_OVERFLOW = 0x6F,
205 DMA_FLEXIBLE_TMR8_CH1 = 0x70,
206 DMA_FLEXIBLE_TMR8_CH2 = 0x71,
207 DMA_FLEXIBLE_TMR8_CH3 = 0x72,
208 DMA_FLEXIBLE_TMR8_CH4 = 0x73,
209} dma_flexible_request_type;
210
214typedef enum
215{
216 DMA_DIR_PERIPHERAL_TO_MEMORY = 0x0000,
217 DMA_DIR_MEMORY_TO_PERIPHERAL = 0x0010,
218 DMA_DIR_MEMORY_TO_MEMORY = 0x4000
220} dma_dir_type;
221
225typedef enum
226{
227 DMA_PERIPHERAL_INC_DISABLE = 0x00,
228 DMA_PERIPHERAL_INC_ENABLE = 0x01
229} dma_peripheral_inc_type;
230
234typedef enum
235{
236 DMA_MEMORY_INC_DISABLE = 0x00,
237 DMA_MEMORY_INC_ENABLE = 0x01
238} dma_memory_inc_type;
239
243typedef enum
244{
245 DMA_PERIPHERAL_DATA_WIDTH_BYTE = 0x00,
246 DMA_PERIPHERAL_DATA_WIDTH_HALFWORD = 0x01,
247 DMA_PERIPHERAL_DATA_WIDTH_WORD = 0x02
248} dma_peripheral_data_size_type;
249
253typedef enum
254{
255 DMA_MEMORY_DATA_WIDTH_BYTE = 0x00,
256 DMA_MEMORY_DATA_WIDTH_HALFWORD = 0x01,
257 DMA_MEMORY_DATA_WIDTH_WORD = 0x02
258} dma_memory_data_size_type;
259
263typedef enum
264{
265 DMA_PRIORITY_LOW = 0x00,
266 DMA_PRIORITY_MEDIUM = 0x01,
267 DMA_PRIORITY_HIGH = 0x02,
268 DMA_PRIORITY_VERY_HIGH = 0x03
269} dma_priority_level_type;
270
274typedef struct
275{
276 uint32_t peripheral_base_addr;
277 uint32_t memory_base_addr;
278 dma_dir_type direction;
279 uint16_t buffer_size;
280 confirm_state peripheral_inc_enable;
281 confirm_state memory_inc_enable;
282 dma_peripheral_data_size_type peripheral_data_width;
283 dma_memory_data_size_type memory_data_width;
284 confirm_state loop_mode_enable;
285 dma_priority_level_type priority;
286} dma_init_type;
287
291typedef struct
292{
296 union
297 {
298 __IO uint32_t sts;
299 struct
300 {
301 __IO uint32_t gf1 : 1; /* [0] */
302 __IO uint32_t fdtf1 : 1; /* [1] */
303 __IO uint32_t hdtf1 : 1; /* [2] */
304 __IO uint32_t dterrf1 : 1; /* [3] */
305 __IO uint32_t gf2 : 1; /* [4] */
306 __IO uint32_t fdtf2 : 1; /* [5] */
307 __IO uint32_t hdtf2 : 1; /* [6] */
308 __IO uint32_t dterrf2 : 1; /* [7] */
309 __IO uint32_t gf3 : 1; /* [8] */
310 __IO uint32_t fdtf3 : 1; /* [9] */
311 __IO uint32_t hdtf3 : 1; /* [10] */
312 __IO uint32_t dterrf3 : 1; /* [11] */
313 __IO uint32_t gf4 : 1; /* [12] */
314 __IO uint32_t fdtf4 : 1; /* [13] */
315 __IO uint32_t hdtf4 : 1; /* [14] */
316 __IO uint32_t dterrf4 : 1; /* [15] */
317 __IO uint32_t gf5 : 1; /* [16] */
318 __IO uint32_t fdtf5 : 1; /* [17] */
319 __IO uint32_t hdtf5 : 1; /* [18] */
320 __IO uint32_t dterrf5 : 1; /* [19] */
321 __IO uint32_t gf6 : 1; /* [20] */
322 __IO uint32_t fdtf6 : 1; /* [21] */
323 __IO uint32_t hdtf6 : 1; /* [22] */
324 __IO uint32_t dterrf6 : 1; /* [23] */
325 __IO uint32_t gf7 : 1; /* [24] */
326 __IO uint32_t fdtf7 : 1; /* [25] */
327 __IO uint32_t hdtf7 : 1; /* [26] */
328 __IO uint32_t dterrf7 : 1; /* [27] */
329 __IO uint32_t reserved1 : 4; /* [31:28] */
330 } sts_bit;
331 };
332
336 union
337 {
338 __IO uint32_t clr;
339 struct
340 {
341 __IO uint32_t gfc1 : 1; /* [0] */
342 __IO uint32_t fdtfc1 : 1; /* [1] */
343 __IO uint32_t hdtfc1 : 1; /* [2] */
344 __IO uint32_t dterrfc1 : 1; /* [3] */
345 __IO uint32_t gfc2 : 1; /* [4] */
346 __IO uint32_t fdtfc2 : 1; /* [5] */
347 __IO uint32_t hdtfc2 : 1; /* [6] */
348 __IO uint32_t dterrfc2 : 1; /* [7] */
349 __IO uint32_t gfc3 : 1; /* [8] */
350 __IO uint32_t fdtfc3 : 1; /* [9] */
351 __IO uint32_t hdtfc3 : 1; /* [10] */
352 __IO uint32_t dterrfc3 : 1; /* [11] */
353 __IO uint32_t gfc4 : 1; /* [12] */
354 __IO uint32_t fdtfc4 : 1; /* [13] */
355 __IO uint32_t hdtfc4 : 1; /* [14] */
356 __IO uint32_t dterrfc4 : 1; /* [15] */
357 __IO uint32_t gfc5 : 1; /* [16] */
358 __IO uint32_t fdtfc5 : 1; /* [17] */
359 __IO uint32_t hdtfc5 : 1; /* [18] */
360 __IO uint32_t dterrfc5 : 1; /* [19] */
361 __IO uint32_t gfc6 : 1; /* [20] */
362 __IO uint32_t fdtfc6 : 1; /* [21] */
363 __IO uint32_t hdtfc6 : 1; /* [22] */
364 __IO uint32_t dterrfc6 : 1; /* [23] */
365 __IO uint32_t gfc7 : 1; /* [24] */
366 __IO uint32_t fdtfc7 : 1; /* [25] */
367 __IO uint32_t hdtfc7 : 1; /* [26] */
368 __IO uint32_t dterrfc7 : 1; /* [27] */
369 __IO uint32_t reserved1 : 4; /* [31:28] */
370 } clr_bit;
371 };
375 __IO uint32_t reserved1[38];
379 union
380 {
381 __IO uint32_t src_sel0;
382 struct
383 {
384 __IO uint32_t ch1_src : 8; /* [7:0] */
385 __IO uint32_t ch2_src : 8; /* [15:8] */
386 __IO uint32_t ch3_src : 8; /* [23:16] */
387 __IO uint32_t ch4_src : 8; /* [31:24] */
388 } src_sel0_bit;
389 };
390
394 union
395 {
396 __IO uint32_t src_sel1;
397 struct
398 {
399 __IO uint32_t ch5_src : 8; /* [7:0] */
400 __IO uint32_t ch6_src : 8; /* [15:8] */
401 __IO uint32_t ch7_src : 8; /* [23:16] */
402 __IO uint32_t dma_flex_en : 1; /* [24] */
403 __IO uint32_t reserved1 : 7; /* [31:25] */
404 } src_sel1_bit;
405 };
406} dma_type;
407
411typedef struct
412{
416 union
417 {
418 __IO uint32_t ctrl;
419 struct
420 {
421 __IO uint32_t chen : 1; /* [0] */
422 __IO uint32_t fdtien : 1; /* [1] */
423 __IO uint32_t hdtien : 1; /* [2] */
424 __IO uint32_t dterrien : 1; /* [3] */
425 __IO uint32_t dtd : 1; /* [4] */
426 __IO uint32_t lm : 1; /* [5] */
427 __IO uint32_t pincm : 1; /* [6] */
428 __IO uint32_t mincm : 1; /* [7] */
429 __IO uint32_t pwidth : 2; /* [9:8] */
430 __IO uint32_t mwidth : 2; /* [11:10] */
431 __IO uint32_t chpl : 2; /* [13:12] */
432 __IO uint32_t m2m : 1; /* [14] */
433 __IO uint32_t reserved1 : 17;/* [31:15] */
434 } ctrl_bit;
435 };
436
440 union
441 {
442 __IO uint32_t dtcnt;
443 struct
444 {
445 __IO uint32_t cnt : 16;/* [15:0] */
446 __IO uint32_t reserved1 : 16;/* [31:16] */
447 } dtcnt_bit;
448 };
449
453 union
454 {
455 __IO uint32_t paddr;
456 struct
457 {
458 __IO uint32_t paddr : 32;/* [31:0] */
459 } paddr_bit;
460 };
461
465 union
466 {
467 __IO uint32_t maddr;
468 struct
469 {
470 __IO uint32_t maddr : 32;/* [31:0] */
471 } maddr_bit;
472 };
473} dma_channel_type;
474
479#define DMA1 ((dma_type *) DMA1_BASE)
480#define DMA1_CHANNEL1 ((dma_channel_type *) DMA1_CHANNEL1_BASE)
481#define DMA1_CHANNEL2 ((dma_channel_type *) DMA1_CHANNEL2_BASE)
482#define DMA1_CHANNEL3 ((dma_channel_type *) DMA1_CHANNEL3_BASE)
483#define DMA1_CHANNEL4 ((dma_channel_type *) DMA1_CHANNEL4_BASE)
484#define DMA1_CHANNEL5 ((dma_channel_type *) DMA1_CHANNEL5_BASE)
485#define DMA1_CHANNEL6 ((dma_channel_type *) DMA1_CHANNEL6_BASE)
486#define DMA1_CHANNEL7 ((dma_channel_type *) DMA1_CHANNEL7_BASE)
487
488#define DMA2 ((dma_type *) DMA2_BASE)
489#define DMA2_CHANNEL1 ((dma_channel_type *) DMA2_CHANNEL1_BASE)
490#define DMA2_CHANNEL2 ((dma_channel_type *) DMA2_CHANNEL2_BASE)
491#define DMA2_CHANNEL3 ((dma_channel_type *) DMA2_CHANNEL3_BASE)
492#define DMA2_CHANNEL4 ((dma_channel_type *) DMA2_CHANNEL4_BASE)
493#define DMA2_CHANNEL5 ((dma_channel_type *) DMA2_CHANNEL5_BASE)
494#define DMA2_CHANNEL6 ((dma_channel_type *) DMA2_CHANNEL6_BASE)
495#define DMA2_CHANNEL7 ((dma_channel_type *) DMA2_CHANNEL7_BASE)
496
501void dma_reset(dma_channel_type* dmax_channely);
502void dma_default_para_init(dma_init_type* dma_init_struct);
503void dma_init(dma_channel_type* dmax_channely, dma_init_type* dma_init_struct);
504void dma_channel_enable(dma_channel_type* dmax_channely, confirm_state new_state);
505void dma_flexible_config(dma_type* dma_x, uint8_t flex_channelx, dma_flexible_request_type flexible_request);
506void dma_data_number_set(dma_channel_type* dmax_channely, uint16_t data_number);
507uint16_t dma_data_number_get(dma_channel_type* dmax_channely);
508void dma_interrupt_enable(dma_channel_type* dmax_channely, uint32_t dma_int, confirm_state new_state);
509 flag_status dma_flag_get(uint32_t dmax_flag);
510 flag_status dma_interrupt_flag_get(uint32_t dmax_flag);
511void dma_flag_clear(uint32_t dmax_flag);
512
513
526#ifdef __cplusplus
527}
528#endif
529
530#endif
at32f413.h
at32f413 header file
dma_init_struct
dma_init_type dma_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:38
dma_channel_enable
void dma_channel_enable(dma_channel_type *dmax_channely, confirm_state new_state)
enable or disable dma channely
Definition at32f413_dma.c:197
dma_default_para_init
void dma_default_para_init(dma_init_type *dma_init_struct)
dma init config with its default value.
Definition at32f413_dma.c:407
dma_interrupt_flag_get
flag_status dma_interrupt_flag_get(uint32_t dmax_flag)
get dma interrupt flag
Definition at32f413_dma.c:297
dma_flexible_config
void dma_flexible_config(dma_type *dma_x, uint8_t flex_channelx, dma_flexible_request_type flexible_request)
initialize the dma_x flexible function according to the specified parameters.
Definition at32f413_dma.c:237
dma_interrupt_enable
void dma_interrupt_enable(dma_channel_type *dmax_channely, uint32_t dma_int, confirm_state new_state)
enable or disable dma interrupt
Definition at32f413_dma.c:164
dma_flag_get
flag_status dma_flag_get(uint32_t dmax_flag)
get dma flag
Definition at32f413_dma.c:343
dma_data_number_get
uint16_t dma_data_number_get(dma_channel_type *dmax_channely)
get number of data from dtcnt register
Definition at32f413_dma.c:133
dma_flag_clear
void dma_flag_clear(uint32_t dmax_flag)
clear dma flag
Definition at32f413_dma.c:389
dma_reset
void dma_reset(dma_channel_type *dmax_channely)
reset the dmax channely registers.
Definition at32f413_dma.c:63
dma_init
void dma_init(dma_channel_type *dmax_channely, dma_init_type *dma_init_struct)
dma init
Definition at32f413_dma.c:442
dma_data_number_set
void dma_data_number_set(dma_channel_type *dmax_channely, uint16_t data_number)
set the number of data to be transferred
Definition at32f413_dma.c:108
dma_peripheral_inc_type
dma_peripheral_inc_type
dma peripheral incremented type
Definition at32f413_dma.h:226
dma_peripheral_data_size_type
dma_peripheral_data_size_type
dma peripheral data size type
Definition at32f413_dma.h:244
dma_flexible_request_type
dma_flexible_request_type
dma flexible request type
Definition at32f413_dma.h:150
dma_dir_type
dma_dir_type
dma direction type
Definition at32f413_dma.h:215
dma_memory_data_size_type
dma_memory_data_size_type
dma memory data size type
Definition at32f413_dma.h:254
dma_priority_level_type
dma_priority_level_type
dma priority level type
Definition at32f413_dma.h:264
dma_memory_inc_type
dma_memory_inc_type
dma memory incremented type
Definition at32f413_dma.h:235
DMA_PERIPHERAL_INC_DISABLE
@ DMA_PERIPHERAL_INC_DISABLE
Definition at32f413_dma.h:227
DMA_PERIPHERAL_INC_ENABLE
@ DMA_PERIPHERAL_INC_ENABLE
Definition at32f413_dma.h:228
DMA_PERIPHERAL_DATA_WIDTH_HALFWORD
@ DMA_PERIPHERAL_DATA_WIDTH_HALFWORD
Definition at32f413_dma.h:246
DMA_PERIPHERAL_DATA_WIDTH_WORD
@ DMA_PERIPHERAL_DATA_WIDTH_WORD
Definition at32f413_dma.h:247
DMA_PERIPHERAL_DATA_WIDTH_BYTE
@ DMA_PERIPHERAL_DATA_WIDTH_BYTE
Definition at32f413_dma.h:245
DMA_FLEXIBLE_TMR4_OVERFLOW
@ DMA_FLEXIBLE_TMR4_OVERFLOW
Definition at32f413_dma.h:191
DMA_FLEXIBLE_TMR8_CH4
@ DMA_FLEXIBLE_TMR8_CH4
Definition at32f413_dma.h:208
DMA_FLEXIBLE_TMR4_CH4
@ DMA_FLEXIBLE_TMR4_CH4
Definition at32f413_dma.h:195
DMA_FLEXIBLE_SDIO1
@ DMA_FLEXIBLE_SDIO1
Definition at32f413_dma.h:170
DMA_FLEXIBLE_UART5_RX
@ DMA_FLEXIBLE_UART5_RX
Definition at32f413_dma.h:164
DMA_FLEXIBLE_UART3_TX
@ DMA_FLEXIBLE_UART3_TX
Definition at32f413_dma.h:161
DMA_FLEXIBLE_TMR4_CH2
@ DMA_FLEXIBLE_TMR4_CH2
Definition at32f413_dma.h:193
DMA_FLEXIBLE_I2C2_TX
@ DMA_FLEXIBLE_I2C2_TX
Definition at32f413_dma.h:169
DMA_FLEXIBLE_TMR8_HALL
@ DMA_FLEXIBLE_TMR8_HALL
Definition at32f413_dma.h:203
DMA_FLEXIBLE_TMR4_CH3
@ DMA_FLEXIBLE_TMR4_CH3
Definition at32f413_dma.h:194
DMA_FLEXIBLE_TMR5_CH3
@ DMA_FLEXIBLE_TMR5_CH3
Definition at32f413_dma.h:200
DMA_FLEXIBLE_TMR2_OVERFLOW
@ DMA_FLEXIBLE_TMR2_OVERFLOW
Definition at32f413_dma.h:179
DMA_FLEXIBLE_UART2_RX
@ DMA_FLEXIBLE_UART2_RX
Definition at32f413_dma.h:158
DMA_FLEXIBLE_TMR4_TRIG
@ DMA_FLEXIBLE_TMR4_TRIG
Definition at32f413_dma.h:190
DMA_FLEXIBLE_TMR1_HALL
@ DMA_FLEXIBLE_TMR1_HALL
Definition at32f413_dma.h:172
DMA_FLEXIBLE_TMR3_OVERFLOW
@ DMA_FLEXIBLE_TMR3_OVERFLOW
Definition at32f413_dma.h:185
DMA_FLEXIBLE_TMR3_CH2
@ DMA_FLEXIBLE_TMR3_CH2
Definition at32f413_dma.h:187
DMA_FLEXIBLE_TMR8_TRIG
@ DMA_FLEXIBLE_TMR8_TRIG
Definition at32f413_dma.h:202
DMA_FLEXIBLE_SPI2_RX
@ DMA_FLEXIBLE_SPI2_RX
Definition at32f413_dma.h:154
DMA_FLEXIBLE_UART1_TX
@ DMA_FLEXIBLE_UART1_TX
Definition at32f413_dma.h:157
DMA_FLEXIBLE_TMR2_TRIG
@ DMA_FLEXIBLE_TMR2_TRIG
Definition at32f413_dma.h:178
DMA_FLEXIBLE_TMR8_CH2
@ DMA_FLEXIBLE_TMR8_CH2
Definition at32f413_dma.h:206
DMA_FLEXIBLE_TMR3_CH1
@ DMA_FLEXIBLE_TMR3_CH1
Definition at32f413_dma.h:186
DMA_FLEXIBLE_TMR2_CH2
@ DMA_FLEXIBLE_TMR2_CH2
Definition at32f413_dma.h:181
DMA_FLEXIBLE_TMR3_CH4
@ DMA_FLEXIBLE_TMR3_CH4
Definition at32f413_dma.h:189
DMA_FLEXIBLE_TMR5_CH1
@ DMA_FLEXIBLE_TMR5_CH1
Definition at32f413_dma.h:198
DMA_FLEXIBLE_TMR2_CH1
@ DMA_FLEXIBLE_TMR2_CH1
Definition at32f413_dma.h:180
DMA_FLEXIBLE_TMR8_CH1
@ DMA_FLEXIBLE_TMR8_CH1
Definition at32f413_dma.h:205
DMA_FLEXIBLE_TMR1_CH4
@ DMA_FLEXIBLE_TMR1_CH4
Definition at32f413_dma.h:177
DMA_FLEXIBLE_I2C1_RX
@ DMA_FLEXIBLE_I2C1_RX
Definition at32f413_dma.h:166
DMA_FLEXIBLE_TMR2_CH4
@ DMA_FLEXIBLE_TMR2_CH4
Definition at32f413_dma.h:183
DMA_FLEXIBLE_TMR5_CH4
@ DMA_FLEXIBLE_TMR5_CH4
Definition at32f413_dma.h:201
DMA_FLEXIBLE_TMR1_CH1
@ DMA_FLEXIBLE_TMR1_CH1
Definition at32f413_dma.h:174
DMA_FLEXIBLE_ADC1
@ DMA_FLEXIBLE_ADC1
Definition at32f413_dma.h:151
DMA_FLEXIBLE_UART2_TX
@ DMA_FLEXIBLE_UART2_TX
Definition at32f413_dma.h:159
DMA_FLEXIBLE_UART4_TX
@ DMA_FLEXIBLE_UART4_TX
Definition at32f413_dma.h:163
DMA_FLEXIBLE_TMR4_CH1
@ DMA_FLEXIBLE_TMR4_CH1
Definition at32f413_dma.h:192
DMA_FLEXIBLE_TMR1_TRIG
@ DMA_FLEXIBLE_TMR1_TRIG
Definition at32f413_dma.h:171
DMA_FLEXIBLE_UART1_RX
@ DMA_FLEXIBLE_UART1_RX
Definition at32f413_dma.h:156
DMA_FLEXIBLE_SPI1_RX
@ DMA_FLEXIBLE_SPI1_RX
Definition at32f413_dma.h:152
DMA_FLEXIBLE_UART3_RX
@ DMA_FLEXIBLE_UART3_RX
Definition at32f413_dma.h:160
DMA_FLEXIBLE_TMR1_CH2
@ DMA_FLEXIBLE_TMR1_CH2
Definition at32f413_dma.h:175
DMA_FLEXIBLE_TMR5_OVERFLOW
@ DMA_FLEXIBLE_TMR5_OVERFLOW
Definition at32f413_dma.h:197
DMA_FLEXIBLE_TMR5_TRIG
@ DMA_FLEXIBLE_TMR5_TRIG
Definition at32f413_dma.h:196
DMA_FLEXIBLE_UART4_RX
@ DMA_FLEXIBLE_UART4_RX
Definition at32f413_dma.h:162
DMA_FLEXIBLE_TMR3_TRIG
@ DMA_FLEXIBLE_TMR3_TRIG
Definition at32f413_dma.h:184
DMA_FLEXIBLE_I2C2_RX
@ DMA_FLEXIBLE_I2C2_RX
Definition at32f413_dma.h:168
DMA_FLEXIBLE_TMR2_CH3
@ DMA_FLEXIBLE_TMR2_CH3
Definition at32f413_dma.h:182
DMA_FLEXIBLE_I2C1_TX
@ DMA_FLEXIBLE_I2C1_TX
Definition at32f413_dma.h:167
DMA_FLEXIBLE_TMR8_OVERFLOW
@ DMA_FLEXIBLE_TMR8_OVERFLOW
Definition at32f413_dma.h:204
DMA_FLEXIBLE_SPI1_TX
@ DMA_FLEXIBLE_SPI1_TX
Definition at32f413_dma.h:153
DMA_FLEXIBLE_TMR5_CH2
@ DMA_FLEXIBLE_TMR5_CH2
Definition at32f413_dma.h:199
DMA_FLEXIBLE_SPI2_TX
@ DMA_FLEXIBLE_SPI2_TX
Definition at32f413_dma.h:155
DMA_FLEXIBLE_TMR8_CH3
@ DMA_FLEXIBLE_TMR8_CH3
Definition at32f413_dma.h:207
DMA_FLEXIBLE_TMR1_OVERFLOW
@ DMA_FLEXIBLE_TMR1_OVERFLOW
Definition at32f413_dma.h:173
DMA_FLEXIBLE_TMR1_CH3
@ DMA_FLEXIBLE_TMR1_CH3
Definition at32f413_dma.h:176
DMA_FLEXIBLE_TMR3_CH3
@ DMA_FLEXIBLE_TMR3_CH3
Definition at32f413_dma.h:188
DMA_FLEXIBLE_UART5_TX
@ DMA_FLEXIBLE_UART5_TX
Definition at32f413_dma.h:165
DMA_DIR_MEMORY_TO_PERIPHERAL
@ DMA_DIR_MEMORY_TO_PERIPHERAL
Definition at32f413_dma.h:217
DMA_DIR_MEMORY_TO_MEMORY
@ DMA_DIR_MEMORY_TO_MEMORY
Definition at32f413_dma.h:218
DMA_DIR_PERIPHERAL_TO_MEMORY
@ DMA_DIR_PERIPHERAL_TO_MEMORY
Definition at32f413_dma.h:216
DMA_MEMORY_DATA_WIDTH_WORD
@ DMA_MEMORY_DATA_WIDTH_WORD
Definition at32f413_dma.h:257
DMA_MEMORY_DATA_WIDTH_BYTE
@ DMA_MEMORY_DATA_WIDTH_BYTE
Definition at32f413_dma.h:255
DMA_MEMORY_DATA_WIDTH_HALFWORD
@ DMA_MEMORY_DATA_WIDTH_HALFWORD
Definition at32f413_dma.h:256
DMA_PRIORITY_HIGH
@ DMA_PRIORITY_HIGH
Definition at32f413_dma.h:267
DMA_PRIORITY_MEDIUM
@ DMA_PRIORITY_MEDIUM
Definition at32f413_dma.h:266
DMA_PRIORITY_VERY_HIGH
@ DMA_PRIORITY_VERY_HIGH
Definition at32f413_dma.h:268
DMA_PRIORITY_LOW
@ DMA_PRIORITY_LOW
Definition at32f413_dma.h:265
DMA_MEMORY_INC_ENABLE
@ DMA_MEMORY_INC_ENABLE
Definition at32f413_dma.h:237
DMA_MEMORY_INC_DISABLE
@ DMA_MEMORY_INC_DISABLE
Definition at32f413_dma.h:236
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
flag_status
flag_status
flag status
Definition at32f413.h:292
dma_channel_type
type define dma channel register all
Definition at32f413_dma.h:412
dma_channel_type::dtcnt
__IO uint32_t dtcnt
Definition at32f413_dma.h:442
dma_channel_type::cnt
__IO uint32_t cnt
Definition at32f413_dma.h:445
dma_channel_type::pwidth
__IO uint32_t pwidth
Definition at32f413_dma.h:429
dma_channel_type::paddr
__IO uint32_t paddr
Definition at32f413_dma.h:455
dma_channel_type::mincm
__IO uint32_t mincm
Definition at32f413_dma.h:428
dma_channel_type::dterrien
__IO uint32_t dterrien
Definition at32f413_dma.h:424
dma_channel_type::chen
__IO uint32_t chen
Definition at32f413_dma.h:421
dma_channel_type::lm
__IO uint32_t lm
Definition at32f413_dma.h:426
dma_channel_type::mwidth
__IO uint32_t mwidth
Definition at32f413_dma.h:430
dma_channel_type::reserved1
__IO uint32_t reserved1
Definition at32f413_dma.h:433
dma_channel_type::dtd
__IO uint32_t dtd
Definition at32f413_dma.h:425
dma_channel_type::maddr
__IO uint32_t maddr
Definition at32f413_dma.h:467
dma_channel_type::hdtien
__IO uint32_t hdtien
Definition at32f413_dma.h:423
dma_channel_type::m2m
__IO uint32_t m2m
Definition at32f413_dma.h:432
dma_channel_type::pincm
__IO uint32_t pincm
Definition at32f413_dma.h:427
dma_channel_type::ctrl
__IO uint32_t ctrl
Definition at32f413_dma.h:418
dma_channel_type::fdtien
__IO uint32_t fdtien
Definition at32f413_dma.h:422
dma_channel_type::chpl
__IO uint32_t chpl
Definition at32f413_dma.h:431
dma_init_type
dma init type
Definition at32f413_dma.h:275
dma_init_type::loop_mode_enable
confirm_state loop_mode_enable
Definition at32f413_dma.h:284
dma_init_type::buffer_size
uint16_t buffer_size
Definition at32f413_dma.h:279
dma_init_type::memory_data_width
dma_memory_data_size_type memory_data_width
Definition at32f413_dma.h:283
dma_init_type::priority
dma_priority_level_type priority
Definition at32f413_dma.h:285
dma_init_type::peripheral_inc_enable
confirm_state peripheral_inc_enable
Definition at32f413_dma.h:280
dma_init_type::memory_inc_enable
confirm_state memory_inc_enable
Definition at32f413_dma.h:281
dma_init_type::direction
dma_dir_type direction
Definition at32f413_dma.h:278
dma_init_type::peripheral_base_addr
uint32_t peripheral_base_addr
Definition at32f413_dma.h:276
dma_init_type::memory_base_addr
uint32_t memory_base_addr
Definition at32f413_dma.h:277
dma_init_type::peripheral_data_width
dma_peripheral_data_size_type peripheral_data_width
Definition at32f413_dma.h:282
dma_type
type define dma register
Definition at32f413_dma.h:292
dma_type::gfc3
__IO uint32_t gfc3
Definition at32f413_dma.h:349
dma_type::dterrfc1
__IO uint32_t dterrfc1
Definition at32f413_dma.h:344
dma_type::ch2_src
__IO uint32_t ch2_src
Definition at32f413_dma.h:385
dma_type::gfc2
__IO uint32_t gfc2
Definition at32f413_dma.h:345
dma_type::src_sel1
__IO uint32_t src_sel1
Definition at32f413_dma.h:396
dma_type::ch3_src
__IO uint32_t ch3_src
Definition at32f413_dma.h:386
dma_type::hdtfc3
__IO uint32_t hdtfc3
Definition at32f413_dma.h:351
dma_type::fdtfc2
__IO uint32_t fdtfc2
Definition at32f413_dma.h:346
dma_type::hdtf7
__IO uint32_t hdtf7
Definition at32f413_dma.h:327
dma_type::gfc1
__IO uint32_t gfc1
Definition at32f413_dma.h:341
dma_type::gf4
__IO uint32_t gf4
Definition at32f413_dma.h:313
dma_type::hdtf2
__IO uint32_t hdtf2
Definition at32f413_dma.h:307
dma_type::hdtf3
__IO uint32_t hdtf3
Definition at32f413_dma.h:311
dma_type::dma_flex_en
__IO uint32_t dma_flex_en
Definition at32f413_dma.h:402
dma_type::fdtf7
__IO uint32_t fdtf7
Definition at32f413_dma.h:326
dma_type::reserved1
__IO uint32_t reserved1
reserved, offset:0x08~0x9C
Definition at32f413_dma.h:329
dma_type::dterrfc2
__IO uint32_t dterrfc2
Definition at32f413_dma.h:348
dma_type::dterrf4
__IO uint32_t dterrf4
Definition at32f413_dma.h:316
dma_type::gf7
__IO uint32_t gf7
Definition at32f413_dma.h:325
dma_type::fdtfc4
__IO uint32_t fdtfc4
Definition at32f413_dma.h:354
dma_type::src_sel0
__IO uint32_t src_sel0
Definition at32f413_dma.h:381
dma_type::gf2
__IO uint32_t gf2
Definition at32f413_dma.h:305
dma_type::hdtfc6
__IO uint32_t hdtfc6
Definition at32f413_dma.h:363
dma_type::dterrf5
__IO uint32_t dterrf5
Definition at32f413_dma.h:320
dma_type::hdtf5
__IO uint32_t hdtf5
Definition at32f413_dma.h:319
dma_type::fdtfc5
__IO uint32_t fdtfc5
Definition at32f413_dma.h:358
dma_type::fdtfc1
__IO uint32_t fdtfc1
Definition at32f413_dma.h:342
dma_type::hdtf4
__IO uint32_t hdtf4
Definition at32f413_dma.h:315
dma_type::ch5_src
__IO uint32_t ch5_src
Definition at32f413_dma.h:399
dma_type::fdtf1
__IO uint32_t fdtf1
Definition at32f413_dma.h:302
dma_type::gfc6
__IO uint32_t gfc6
Definition at32f413_dma.h:361
dma_type::dterrf6
__IO uint32_t dterrf6
Definition at32f413_dma.h:324
dma_type::fdtf4
__IO uint32_t fdtf4
Definition at32f413_dma.h:314
dma_type::dterrf2
__IO uint32_t dterrf2
Definition at32f413_dma.h:308
dma_type::gfc4
__IO uint32_t gfc4
Definition at32f413_dma.h:353
dma_type::dterrfc3
__IO uint32_t dterrfc3
Definition at32f413_dma.h:352
dma_type::dterrf1
__IO uint32_t dterrf1
Definition at32f413_dma.h:304
dma_type::hdtfc1
__IO uint32_t hdtfc1
Definition at32f413_dma.h:343
dma_type::sts
__IO uint32_t sts
Definition at32f413_dma.h:298
dma_type::dterrf3
__IO uint32_t dterrf3
Definition at32f413_dma.h:312
dma_type::fdtf5
__IO uint32_t fdtf5
Definition at32f413_dma.h:318
dma_type::clr
__IO uint32_t clr
Definition at32f413_dma.h:338
dma_type::fdtfc7
__IO uint32_t fdtfc7
Definition at32f413_dma.h:366
dma_type::fdtf2
__IO uint32_t fdtf2
Definition at32f413_dma.h:306
dma_type::gf1
__IO uint32_t gf1
Definition at32f413_dma.h:301
dma_type::fdtf3
__IO uint32_t fdtf3
Definition at32f413_dma.h:310
dma_type::hdtfc5
__IO uint32_t hdtfc5
Definition at32f413_dma.h:359
dma_type::gf3
__IO uint32_t gf3
Definition at32f413_dma.h:309
dma_type::dterrfc6
__IO uint32_t dterrfc6
Definition at32f413_dma.h:364
dma_type::fdtfc3
__IO uint32_t fdtfc3
Definition at32f413_dma.h:350
dma_type::hdtfc2
__IO uint32_t hdtfc2
Definition at32f413_dma.h:347
dma_type::fdtfc6
__IO uint32_t fdtfc6
Definition at32f413_dma.h:362
dma_type::ch1_src
__IO uint32_t ch1_src
Definition at32f413_dma.h:384
dma_type::dterrfc7
__IO uint32_t dterrfc7
Definition at32f413_dma.h:368
dma_type::gf6
__IO uint32_t gf6
Definition at32f413_dma.h:321
dma_type::fdtf6
__IO uint32_t fdtf6
Definition at32f413_dma.h:322
dma_type::gfc5
__IO uint32_t gfc5
Definition at32f413_dma.h:357
dma_type::hdtfc7
__IO uint32_t hdtfc7
Definition at32f413_dma.h:367
dma_type::dterrfc5
__IO uint32_t dterrfc5
Definition at32f413_dma.h:360
dma_type::gfc7
__IO uint32_t gfc7
Definition at32f413_dma.h:365
dma_type::hdtf1
__IO uint32_t hdtf1
Definition at32f413_dma.h:303
dma_type::ch7_src
__IO uint32_t ch7_src
Definition at32f413_dma.h:401
dma_type::ch4_src
__IO uint32_t ch4_src
Definition at32f413_dma.h:387
dma_type::dterrf7
__IO uint32_t dterrf7
Definition at32f413_dma.h:328
dma_type::dterrfc4
__IO uint32_t dterrfc4
Definition at32f413_dma.h:356
dma_type::gf5
__IO uint32_t gf5
Definition at32f413_dma.h:317
dma_type::hdtfc4
__IO uint32_t hdtfc4
Definition at32f413_dma.h:355
dma_type::ch6_src
__IO uint32_t ch6_src
Definition at32f413_dma.h:400
dma_type::hdtf6
__IO uint32_t hdtf6
Definition at32f413_dma.h:323


AT32F413 Firmwary Library: at32f413_exint.c Source File

  • libraries
  • drivers
  • src
at32f413_exint.c
Go to the documentation of this file.
1
26#include "at32f413_conf.h"
27
37#ifdef EXINT_MODULE_ENABLED
38
48void exint_reset(void)
49{
50 EXINT->inten = 0x00000000;
51 EXINT->polcfg1 = 0x00000000;
52 EXINT->polcfg2 = 0x00000000;
53 EXINT->evten = 0x00000000;
54 EXINT->intsts = 0x0007FFFF;
55}
56
63void exint_default_para_init(exint_init_type *exint_struct)
64{
65 exint_struct->line_enable = FALSE;
66 exint_struct->line_select = EXINT_LINE_NONE;
67 exint_struct->line_polarity = EXINT_TRIGGER_FALLING_EDGE;
68 exint_struct->line_mode = EXINT_LINE_EVENT;
69}
70
77void exint_init(exint_init_type *exint_struct)
78{
79 uint32_t line_index = 0;
80 line_index = exint_struct->line_select;
81
82 EXINT->inten &= ~line_index;
83 EXINT->evten &= ~line_index;
84
85 if(exint_struct->line_enable != FALSE)
86 {
87 if(exint_struct->line_mode == EXINT_LINE_INTERRUPT)
88 {
89 EXINT->inten |= line_index;
90 }
91 else
92 {
93 EXINT->evten |= line_index;
94 }
95
96 EXINT->polcfg1 &= ~line_index;
97 EXINT->polcfg2 &= ~line_index;
98 if(exint_struct->line_polarity == EXINT_TRIGGER_RISING_EDGE)
99 {
100 EXINT->polcfg1 |= line_index;
101 }
102 else if(exint_struct->line_polarity == EXINT_TRIGGER_FALLING_EDGE)
103 {
104 EXINT->polcfg2 |= line_index;
105 }
106 else
107 {
108 EXINT->polcfg1 |= line_index;
109 EXINT->polcfg2 |= line_index;
110 }
111 }
112}
113
125void exint_flag_clear(uint32_t exint_line)
126{
127 EXINT->intsts = exint_line;
128}
129
141 flag_status exint_flag_get(uint32_t exint_line)
142{
143 flag_status status = RESET;
144 uint32_t exint_flag =0;
145 exint_flag = EXINT->intsts & exint_line;
146 if((exint_flag != (uint16_t)RESET))
147 {
148 status = SET;
149 }
150 else
151 {
152 status = RESET;
153 }
154 return status;
155}
156
168 flag_status exint_interrupt_flag_get(uint32_t exint_line)
169{
170 flag_status status = RESET;
171 uint32_t exint_flag = 0;
172 exint_flag = EXINT->intsts & exint_line;
173 exint_flag = exint_flag & EXINT->inten;
174
175 if((exint_flag != (uint16_t)RESET))
176 {
177 status = SET;
178 }
179 else
180 {
181 status = RESET;
182 }
183 return status;
184}
185
197void exint_software_interrupt_event_generate(uint32_t exint_line)
198{
199 EXINT->swtrg |= exint_line;
200}
201
215void exint_interrupt_enable(uint32_t exint_line, confirm_state new_state)
216{
217 if(new_state == TRUE)
218 {
219 EXINT->inten |= exint_line;
220 }
221 else
222 {
223 EXINT->inten &= ~exint_line;
224 }
225}
226
240void exint_event_enable(uint32_t exint_line, confirm_state new_state)
241{
242 if(new_state == TRUE)
243 {
244 EXINT->evten |= exint_line;
245 }
246 else
247 {
248 EXINT->evten &= ~exint_line;
249 }
250}
251
256#endif
257
EXINT_LINE_INTERRUPT
@ EXINT_LINE_INTERRUPT
Definition at32f413_exint.h:84
EXINT_LINE_EVENT
@ EXINT_LINE_EVENT
Definition at32f413_exint.h:85
EXINT_TRIGGER_RISING_EDGE
@ EXINT_TRIGGER_RISING_EDGE
Definition at32f413_exint.h:93
EXINT_TRIGGER_FALLING_EDGE
@ EXINT_TRIGGER_FALLING_EDGE
Definition at32f413_exint.h:94
EXINT_LINE_NONE
#define EXINT_LINE_NONE
Definition at32f413_exint.h:50
exint_flag_get
flag_status exint_flag_get(uint32_t exint_line)
get exint flag
Definition at32f413_exint.c:141
exint_interrupt_enable
void exint_interrupt_enable(uint32_t exint_line, confirm_state new_state)
enable or disable exint interrupt
Definition at32f413_exint.c:215
exint_event_enable
void exint_event_enable(uint32_t exint_line, confirm_state new_state)
enable or disable exint event
Definition at32f413_exint.c:240
exint_flag_clear
void exint_flag_clear(uint32_t exint_line)
clear exint flag
Definition at32f413_exint.c:125
exint_default_para_init
void exint_default_para_init(exint_init_type *exint_struct)
exint default para init
Definition at32f413_exint.c:63
exint_reset
void exint_reset(void)
exint reset
Definition at32f413_exint.c:48
exint_software_interrupt_event_generate
void exint_software_interrupt_event_generate(uint32_t exint_line)
generate exint software interrupt event
Definition at32f413_exint.c:197
exint_interrupt_flag_get
flag_status exint_interrupt_flag_get(uint32_t exint_line)
get exint interrupt flag
Definition at32f413_exint.c:168
exint_init
void exint_init(exint_init_type *exint_struct)
exint init
Definition at32f413_exint.c:77
EXINT
#define EXINT
Definition at32f413_exint.h:198
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
flag_status
flag_status
flag status
Definition at32f413.h:292
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
SET
@ SET
Definition at32f413.h:292
at32f413_conf.h
at32f413 config header file
exint_init_type
exint init type
Definition at32f413_exint.h:102
exint_init_type::line_select
uint32_t line_select
Definition at32f413_exint.h:104
exint_init_type::line_enable
confirm_state line_enable
Definition at32f413_exint.h:106
exint_init_type::line_mode
exint_line_mode_type line_mode
Definition at32f413_exint.h:103
exint_init_type::line_polarity
exint_polarity_config_type line_polarity
Definition at32f413_exint.h:105


AT32F413 Firmwary Library: at32f413_exint.h Source File

  • libraries
  • drivers
  • inc
at32f413_exint.h
Go to the documentation of this file.
1
26/* Define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_EXINT_H
28#define __AT32F413_EXINT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34
35/* Includes ------------------------------------------------------------------*/
36#include "at32f413.h"
37
50#define EXINT_LINE_NONE ((uint32_t)0x000000)
51#define EXINT_LINE_0 ((uint32_t)0x000001)
52#define EXINT_LINE_1 ((uint32_t)0x000002)
53#define EXINT_LINE_2 ((uint32_t)0x000004)
54#define EXINT_LINE_3 ((uint32_t)0x000008)
55#define EXINT_LINE_4 ((uint32_t)0x000010)
56#define EXINT_LINE_5 ((uint32_t)0x000020)
57#define EXINT_LINE_6 ((uint32_t)0x000040)
58#define EXINT_LINE_7 ((uint32_t)0x000080)
59#define EXINT_LINE_8 ((uint32_t)0x000100)
60#define EXINT_LINE_9 ((uint32_t)0x000200)
61#define EXINT_LINE_10 ((uint32_t)0x000400)
62#define EXINT_LINE_11 ((uint32_t)0x000800)
63#define EXINT_LINE_12 ((uint32_t)0x001000)
64#define EXINT_LINE_13 ((uint32_t)0x002000)
65#define EXINT_LINE_14 ((uint32_t)0x004000)
66#define EXINT_LINE_15 ((uint32_t)0x008000)
67#define EXINT_LINE_16 ((uint32_t)0x010000)
68#define EXINT_LINE_17 ((uint32_t)0x020000)
69#define EXINT_LINE_18 ((uint32_t)0x040000)
81typedef enum
82{
83 EXINT_LINE_INTERRUPUT = 0x00,
84 EXINT_LINE_INTERRUPT = 0x00,
85 EXINT_LINE_EVENT = 0x01
86} exint_line_mode_type;
87
91typedef enum
92{
93 EXINT_TRIGGER_RISING_EDGE = 0x00,
94 EXINT_TRIGGER_FALLING_EDGE = 0x01,
95 EXINT_TRIGGER_BOTH_EDGE = 0x02
96} exint_polarity_config_type;
97
101typedef struct
102{
103 exint_line_mode_type line_mode;
104 uint32_t line_select;
105 exint_polarity_config_type line_polarity;
106 confirm_state line_enable;
107} exint_init_type;
108
112typedef struct
113{
114
118 union
119 {
120 __IO uint32_t inten;
121 struct
122 {
123 __IO uint32_t intenx : 23;/* [22:0] */
124 __IO uint32_t reserved1 : 9;/* [31:23] */
125 } inten_bit;
126 };
127
131 union
132 {
133 __IO uint32_t evten;
134 struct
135 {
136 __IO uint32_t evtenx : 23;/* [22:0] */
137 __IO uint32_t reserved1 : 9;/* [31:23] */
138 } evten_bit;
139 };
140
144 union
145 {
146 __IO uint32_t polcfg1;
147 struct
148 {
149 __IO uint32_t rpx : 23;/* [22:0] */
150 __IO uint32_t reserved1 : 9;/* [31:23] */
151 } polcfg1_bit;
152 };
153
157 union
158 {
159 __IO uint32_t polcfg2;
160 struct
161 {
162 __IO uint32_t fpx : 23;/* [22:0] */
163 __IO uint32_t reserved1 : 9;/* [31:23] */
164 } polcfg2_bit;
165 };
166
170 union
171 {
172 __IO uint32_t swtrg;
173 struct
174 {
175 __IO uint32_t swtx : 23;/* [22:0] */
176 __IO uint32_t reserved1 : 9;/* [31:23] */
177 } swtrg_bit;
178 };
179
183 union
184 {
185 __IO uint32_t intsts;
186 struct
187 {
188 __IO uint32_t linex : 23;/* [22:0] */
189 __IO uint32_t reserved1 : 9;/* [31:23] */
190 } intsts_bit;
191 };
192} exint_type;
193
198#define EXINT ((exint_type *) EXINT_BASE)
199
204void exint_reset(void);
205void exint_default_para_init(exint_init_type *exint_struct);
206void exint_init(exint_init_type *exint_struct);
207void exint_flag_clear(uint32_t exint_line);
208 flag_status exint_flag_get(uint32_t exint_line);
209 flag_status exint_interrupt_flag_get(uint32_t exint_line);
210void exint_software_interrupt_event_generate(uint32_t exint_line);
211void exint_interrupt_enable(uint32_t exint_line, confirm_state new_state);
212void exint_event_enable(uint32_t exint_line, confirm_state new_state);
213
226#ifdef __cplusplus
227}
228#endif
229
230#endif
at32f413.h
at32f413 header file
exint_flag_get
flag_status exint_flag_get(uint32_t exint_line)
get exint flag
Definition at32f413_exint.c:141
exint_interrupt_enable
void exint_interrupt_enable(uint32_t exint_line, confirm_state new_state)
enable or disable exint interrupt
Definition at32f413_exint.c:215
exint_event_enable
void exint_event_enable(uint32_t exint_line, confirm_state new_state)
enable or disable exint event
Definition at32f413_exint.c:240
exint_flag_clear
void exint_flag_clear(uint32_t exint_line)
clear exint flag
Definition at32f413_exint.c:125
exint_default_para_init
void exint_default_para_init(exint_init_type *exint_struct)
exint default para init
Definition at32f413_exint.c:63
exint_reset
void exint_reset(void)
exint reset
Definition at32f413_exint.c:48
exint_software_interrupt_event_generate
void exint_software_interrupt_event_generate(uint32_t exint_line)
generate exint software interrupt event
Definition at32f413_exint.c:197
exint_interrupt_flag_get
flag_status exint_interrupt_flag_get(uint32_t exint_line)
get exint interrupt flag
Definition at32f413_exint.c:168
exint_init
void exint_init(exint_init_type *exint_struct)
exint init
Definition at32f413_exint.c:77
exint_line_mode_type
exint_line_mode_type
exint line mode type
Definition at32f413_exint.h:82
exint_polarity_config_type
exint_polarity_config_type
exint polarity configuration type
Definition at32f413_exint.h:92
EXINT_LINE_INTERRUPT
@ EXINT_LINE_INTERRUPT
Definition at32f413_exint.h:84
EXINT_LINE_EVENT
@ EXINT_LINE_EVENT
Definition at32f413_exint.h:85
EXINT_LINE_INTERRUPUT
@ EXINT_LINE_INTERRUPUT
Definition at32f413_exint.h:83
EXINT_TRIGGER_RISING_EDGE
@ EXINT_TRIGGER_RISING_EDGE
Definition at32f413_exint.h:93
EXINT_TRIGGER_FALLING_EDGE
@ EXINT_TRIGGER_FALLING_EDGE
Definition at32f413_exint.h:94
EXINT_TRIGGER_BOTH_EDGE
@ EXINT_TRIGGER_BOTH_EDGE
Definition at32f413_exint.h:95
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
flag_status
flag_status
flag status
Definition at32f413.h:292
exint_init_type
exint init type
Definition at32f413_exint.h:102
exint_init_type::line_select
uint32_t line_select
Definition at32f413_exint.h:104
exint_init_type::line_enable
confirm_state line_enable
Definition at32f413_exint.h:106
exint_init_type::line_mode
exint_line_mode_type line_mode
Definition at32f413_exint.h:103
exint_init_type::line_polarity
exint_polarity_config_type line_polarity
Definition at32f413_exint.h:105
exint_type
type define exint register all
Definition at32f413_exint.h:113
exint_type::polcfg1
__IO uint32_t polcfg1
Definition at32f413_exint.h:146
exint_type::intsts
__IO uint32_t intsts
Definition at32f413_exint.h:185
exint_type::polcfg2
__IO uint32_t polcfg2
Definition at32f413_exint.h:159
exint_type::fpx
__IO uint32_t fpx
Definition at32f413_exint.h:162
exint_type::intenx
__IO uint32_t intenx
Definition at32f413_exint.h:123
exint_type::rpx
__IO uint32_t rpx
Definition at32f413_exint.h:149
exint_type::evtenx
__IO uint32_t evtenx
Definition at32f413_exint.h:136
exint_type::linex
__IO uint32_t linex
Definition at32f413_exint.h:188
exint_type::inten
__IO uint32_t inten
Definition at32f413_exint.h:120
exint_type::evten
__IO uint32_t evten
Definition at32f413_exint.h:133
exint_type::swtx
__IO uint32_t swtx
Definition at32f413_exint.h:175
exint_type::swtrg
__IO uint32_t swtrg
Definition at32f413_exint.h:172
exint_type::reserved1
__IO uint32_t reserved1
Definition at32f413_exint.h:124


AT32F413 Firmwary Library: at32f413_flash.c Source File

  • libraries
  • drivers
  • src
at32f413_flash.c
Go to the documentation of this file.
1
26#include "at32f413_conf.h"
27
37#ifdef FLASH_MODULE_ENABLED
38
58 flag_status flash_flag_get(uint32_t flash_flag)
59{
60 flag_status status = RESET;
61 uint32_t flag_position;
62 flag_position = flash_flag & 0x70000000;
63 flash_flag &= 0x8FFFFFFF;
64 switch(flag_position)
65 {
66 case 0x00000000:
67 if(FLASH->sts & flash_flag)
68 status = SET;
69 break;
70 case 0x20000000:
71 if(FLASH->sts3 & flash_flag)
72 status = SET;
73 break;
74 case 0x40000000:
75 if(FLASH->usd & flash_flag)
76 status = SET;
77 break;
78 default:
79 break;
80 }
81 /* return the new state of flash_flag (SET or RESET) */
82 return status;
83}
84
97void flash_flag_clear(uint32_t flash_flag)
98{
99 uint32_t flag_position;
100 flag_position = flash_flag & 0x70000000;
101 flash_flag &= 0x8FFFFFFF;
102 switch(flag_position)
103 {
104 case 0x00000000:
105 FLASH->sts = flash_flag;
106 break;
107 case 0x20000000:
108 FLASH->sts3 = flash_flag;
109 break;
110 default:
111 break;
112 }
113}
114
121 flash_status_type flash_operation_status_get(void)
122{
123 flash_status_type flash_status = FLASH_OPERATE_DONE;
124 if(FLASH->sts_bit.obf != RESET)
125 {
126 flash_status = FLASH_OPERATE_BUSY;
127 }
128 else if(FLASH->sts_bit.prgmerr != RESET)
129 {
130 flash_status = FLASH_PROGRAM_ERROR;
131 }
132 else if(FLASH->sts_bit.epperr != RESET)
133 {
134 flash_status = FLASH_EPP_ERROR;
135 }
136 else
137 {
138 flash_status = FLASH_OPERATE_DONE;
139 }
140 /* return the flash status */
141 return flash_status;
142}
143
150 flash_status_type flash_spim_operation_status_get(void)
151{
152 flash_status_type flash_status = FLASH_OPERATE_DONE;
153 if(FLASH->sts3_bit.obf != RESET)
154 {
155 flash_status = FLASH_OPERATE_BUSY;
156 }
157 else if(FLASH->sts3_bit.prgmerr != RESET)
158 {
159 flash_status = FLASH_PROGRAM_ERROR;
160 }
161 else if(FLASH->sts3_bit.epperr != RESET)
162 {
163 flash_status = FLASH_EPP_ERROR;
164 }
165 else
166 {
167 flash_status = FLASH_OPERATE_DONE;
168 }
169 /* return the flash status */
170 return flash_status;
171}
172
179 flash_status_type flash_operation_wait_for(uint32_t time_out)
180{
181 flash_status_type status = FLASH_OPERATE_DONE;
182 /* check for the flash status */
183 status = flash_operation_status_get();
184
185 while((status == FLASH_OPERATE_BUSY) && (time_out != 0x00))
186 {
187 status = flash_operation_status_get();
188 time_out--;
189 }
190 if(time_out == 0x00)
191 {
192 status = FLASH_OPERATE_TIMEOUT;
193 }
194 /* return the status */
195 return status;
196}
197
204 flash_status_type flash_spim_operation_wait_for(uint32_t time_out)
205{
206 flash_status_type status = FLASH_OPERATE_DONE;
207 /* check for the flash status */
208 status = flash_spim_operation_status_get();
209
210 while((status == FLASH_OPERATE_BUSY) && (time_out != 0x00))
211 {
212 status = flash_spim_operation_status_get();
213 time_out--;
214 }
215 if(time_out == 0x00)
216 {
217 status = FLASH_OPERATE_TIMEOUT;
218 }
219 /* return the operation status */
220 return status;
221}
222
228void flash_unlock(void)
229{
230 FLASH->unlock = FLASH_UNLOCK_KEY1;
231 FLASH->unlock = FLASH_UNLOCK_KEY2;
232}
233
239void flash_spim_unlock(void)
240{
241 FLASH->unlock3 = FLASH_UNLOCK_KEY1;
242 FLASH->unlock3 = FLASH_UNLOCK_KEY2;
243 UNUSED(*(__IO uint32_t*)USD_BASE);
244}
245
251void flash_lock(void)
252{
253 FLASH->ctrl_bit.oplk = TRUE;
254}
255
261void flash_spim_lock(void)
262{
263 FLASH->ctrl3_bit.oplk = TRUE;
264}
265
272 flash_status_type flash_sector_erase(uint32_t sector_address)
273{
274 flash_status_type status = FLASH_OPERATE_DONE;
275 /* spim : external flash */
276 if(sector_address >= FLASH_SPIM_START_ADDR)
277 {
278 FLASH->ctrl3_bit.secers = TRUE;
279 FLASH->addr3 = sector_address;
280 FLASH->ctrl3_bit.erstr = TRUE;
281
282 /* wait for operation to be completed */
283 status = flash_spim_operation_wait_for(SPIM_ERASE_TIMEOUT);
284
285 /* disable the secers bit */
286 FLASH->ctrl3_bit.secers = FALSE;
287
288 /* dummy read */
289 flash_spim_dummy_read();
290 }
291 else
292 {
293 FLASH->ctrl_bit.secers = TRUE;
294 FLASH->addr = sector_address;
295 FLASH->ctrl_bit.erstr = TRUE;
296
297 /* wait for operation to be completed */
298 status = flash_operation_wait_for(ERASE_TIMEOUT);
299
300 /* disable the secers bit */
301 FLASH->ctrl_bit.secers = FALSE;
302 }
303 /* return the erase status */
304 return status;
305}
306
313 flash_status_type flash_internal_all_erase(void)
314{
315 flash_status_type status = FLASH_OPERATE_DONE;
316
317 FLASH->ctrl_bit.bankers = TRUE;
318 FLASH->ctrl_bit.erstr = TRUE;
319
320 /* wait for operation to be completed */
321 status = flash_operation_wait_for(ERASE_TIMEOUT);
322
323 /* disable the bankers bit */
324 FLASH->ctrl_bit.bankers = FALSE;
325
326 /* return the erase status */
327 return status;
328}
329
336 flash_status_type flash_spim_all_erase(void)
337{
338 flash_status_type status = FLASH_OPERATE_DONE;
339
340 FLASH->ctrl3_bit.chpers = TRUE;
341 FLASH->ctrl3_bit.erstr = TRUE;
342
343 /* wait for operation to be completed */
344 status = flash_spim_operation_wait_for(SPIM_ERASE_TIMEOUT);
345
346 /* disable the chpers bit */
347 FLASH->ctrl3_bit.chpers = FALSE;
348
349 /* dummy read */
350 flash_spim_dummy_read();
351
352 /* return the erase status */
353 return status;
354}
355
363 flash_status_type flash_user_system_data_erase(void)
364{
365 flash_status_type status = FLASH_OPERATE_DONE;
366 uint16_t fap_val = FAP_RELIEVE_KEY;
367 /* get the flash access protection status */
368 if(flash_fap_status_get() != RESET)
369 {
370 fap_val = 0x0000;
371 }
372
373 /* unlock the user system data */
374 FLASH->usd_unlock = FLASH_UNLOCK_KEY1;
375 FLASH->usd_unlock = FLASH_UNLOCK_KEY2;
376 while(FLASH->ctrl_bit.usdulks == RESET);
377
378 /* erase the user system data */
379 FLASH->ctrl_bit.usders = TRUE;
380 FLASH->ctrl_bit.erstr = TRUE;
381
382 /* wait for operation to be completed */
383 status = flash_operation_wait_for(ERASE_TIMEOUT);
384
385 /* disable the usders bit */
386 FLASH->ctrl_bit.usders = FALSE;
387
388 if((status == FLASH_OPERATE_DONE) && (fap_val == FAP_RELIEVE_KEY))
389 {
390 /* enable the user system data programming operation */
391 FLASH->ctrl_bit.usdprgm = TRUE;
392
393 /* restore the last flash access protection value */
394 USD->fap = (uint16_t)fap_val;
395
396 /* wait for operation to be completed */
397 status = flash_operation_wait_for(PROGRAMMING_TIMEOUT);
398
399 /*disable the usdprgm bit */
400 FLASH->ctrl_bit.usdprgm = FALSE;
401 }
402
403 /* return the erase status */
404 return status;
405}
406
414 flash_status_type flash_word_program(uint32_t address, uint32_t data)
415{
416 flash_status_type status = FLASH_OPERATE_DONE;
417 /* spim : external flash */
418 if(address >= FLASH_SPIM_START_ADDR)
419 {
420 FLASH->ctrl3_bit.fprgm = TRUE;
421 *(__IO uint32_t*)address = data;
422 /* wait for operation to be completed */
423 status = flash_spim_operation_wait_for(SPIM_PROGRAMMING_TIMEOUT);
424
425 /* disable the fprgm bit */
426 FLASH->ctrl3_bit.fprgm = FALSE;
427
428 /* dummy read */
429 flash_spim_dummy_read();
430 }
431 else
432 {
433 FLASH->ctrl_bit.fprgm = TRUE;
434 *(__IO uint32_t*)address = data;
435 /* wait for operation to be completed */
436 status = flash_operation_wait_for(PROGRAMMING_TIMEOUT);
437
438 /* disable the fprgm bit */
439 FLASH->ctrl_bit.fprgm = FALSE;
440 }
441 /* return the program status */
442 return status;
443}
444
452 flash_status_type flash_halfword_program(uint32_t address, uint16_t data)
453{
454 flash_status_type status = FLASH_OPERATE_DONE;
455 /* spim : external flash */
456 if(address >= FLASH_SPIM_START_ADDR)
457 {
458 FLASH->ctrl3_bit.fprgm = TRUE;
459 *(__IO uint16_t*)address = data;
460 /* wait for operation to be completed */
461 status = flash_spim_operation_wait_for(SPIM_PROGRAMMING_TIMEOUT);
462
463 /* disable the fprgm bit */
464 FLASH->ctrl3_bit.fprgm = FALSE;
465
466 /* dummy read */
467 flash_spim_dummy_read();
468 }
469 else
470 {
471 FLASH->ctrl_bit.fprgm = TRUE;
472 *(__IO uint16_t*)address = data;
473 /* wait for operation to be completed */
474 status = flash_operation_wait_for(PROGRAMMING_TIMEOUT);
475
476 /* disable the fprgm bit */
477 FLASH->ctrl_bit.fprgm = FALSE;
478 }
479 /* return the program status */
480 return status;
481}
482
491 flash_status_type flash_byte_program(uint32_t address, uint8_t data)
492{
493 flash_status_type status = FLASH_OPERATE_DONE;
494
495 FLASH->ctrl_bit.fprgm = TRUE;
496 *(__IO uint8_t*)address = data;
497 /* wait for operation to be completed */
498 status = flash_operation_wait_for(PROGRAMMING_TIMEOUT);
499
500 /* disable the fprgm bit */
501 FLASH->ctrl_bit.fprgm = FALSE;
502
503 /* return the program status */
504 return status;
505}
506
514 flash_status_type flash_user_system_data_program(uint32_t address, uint8_t data)
515{
516 flash_status_type status = FLASH_OPERATE_DONE;
517
518 if(address == USD_BASE)
519 {
520 if(data != 0xA5)
521 return FLASH_OPERATE_DONE;
522 }
523
524 /* unlock the user system data */
525 FLASH->usd_unlock = FLASH_UNLOCK_KEY1;
526 FLASH->usd_unlock = FLASH_UNLOCK_KEY2;
527 while(FLASH->ctrl_bit.usdulks==RESET);
528
529 /* enable the user system data programming operation */
530 FLASH->ctrl_bit.usdprgm = TRUE;
531 *(__IO uint16_t*)address = data;
532
533 /* wait for operation to be completed */
534 status = flash_operation_wait_for(PROGRAMMING_TIMEOUT);
535
536 /* disable the usdprgm bit */
537 FLASH->ctrl_bit.usdprgm = FALSE;
538
539 /* return the user system data program status */
540 return status;
541}
542
552 flash_status_type flash_epp_set(uint32_t *sector_bits)
553{
554 uint16_t epp_data[4] = {0xFFFF,0xFFFF,0xFFFF,0xFFFF};
555 flash_status_type status = FLASH_OPERATE_DONE;
556 sector_bits[0] = (uint32_t)(~sector_bits[0]);
557 epp_data[0] = (uint16_t)((sector_bits[0] >> 0) & 0xFF);
558 epp_data[1] = (uint16_t)((sector_bits[0] >> 8) & 0xFF);
559 epp_data[2] = (uint16_t)((sector_bits[0] >> 16) & 0xFF);
560 epp_data[3] = (uint16_t)((sector_bits[0] >> 24) & 0xFF);
561
562 /* unlock the user system data */
563 FLASH->usd_unlock = FLASH_UNLOCK_KEY1;
564 FLASH->usd_unlock = FLASH_UNLOCK_KEY2;
565 while(FLASH->ctrl_bit.usdulks==RESET);
566
567 FLASH->ctrl_bit.usdprgm = TRUE;
568 USD->epp0 = epp_data[0];
569 /* wait for operation to be completed */
570 status = flash_operation_wait_for(PROGRAMMING_TIMEOUT);
571
572 if(status == FLASH_OPERATE_DONE)
573 {
574 USD->epp1 = epp_data[1];
575 /* wait for operation to be completed */
576 status = flash_operation_wait_for(PROGRAMMING_TIMEOUT);
577 }
578 if(status == FLASH_OPERATE_DONE)
579 {
580 USD->epp2 = epp_data[2];
581 /* wait for operation to be completed */
582 status = flash_operation_wait_for(PROGRAMMING_TIMEOUT);
583 }
584 if(status == FLASH_OPERATE_DONE)
585 {
586 USD->epp3 = epp_data[3];
587 /* wait for operation to be completed */
588 status = flash_operation_wait_for(PROGRAMMING_TIMEOUT);
589 }
590 /* disable the usdprgm bit */
591 FLASH->ctrl_bit.usdprgm = FALSE;
592
593 /* return the erase/program protection operation status */
594 return status;
595}
596
602void flash_epp_status_get(uint32_t *sector_bits)
603{
604 /* return the flash erase/program protection register value */
605 sector_bits[0] = (uint32_t)(FLASH->epps);
606}
607
617 flash_status_type flash_fap_enable(confirm_state new_state)
618{
619 flash_status_type status = FLASH_OPERATE_DONE;
620
621 /* unlock the user system data */
622 FLASH->usd_unlock = FLASH_UNLOCK_KEY1;
623 FLASH->usd_unlock = FLASH_UNLOCK_KEY2;
624 while(FLASH->ctrl_bit.usdulks==RESET);
625
626 FLASH->ctrl_bit.usders = TRUE;
627 FLASH->ctrl_bit.erstr = TRUE;
628 /* wait for operation to be completed */
629 status = flash_operation_wait_for(ERASE_TIMEOUT);
630
631 /* disable the usders bit */
632 FLASH->ctrl_bit.usders = FALSE;
633
634 if(status == FLASH_OPERATE_DONE)
635 {
636 if(new_state == FALSE)
637 {
638 /* enable the user system data programming operation */
639 FLASH->ctrl_bit.usdprgm = TRUE;
640 USD->fap = FAP_RELIEVE_KEY;
641
642 /* Wait for operation to be completed */
643 status = flash_operation_wait_for(ERASE_TIMEOUT);
644
645 /* disable the usdprgm bit */
646 FLASH->ctrl_bit.usdprgm = FALSE;
647 }
648 }
649
650 /* return the flash access protection operation status */
651 return status;
652}
653
659 flag_status flash_fap_status_get(void)
660{
661 return (flag_status)FLASH->usd_bit.fap;
662}
663
683 flash_status_type flash_ssb_set(uint8_t usd_ssb)
684{
685 flash_status_type status = FLASH_OPERATE_DONE;
686
687 /* unlock the user system data */
688 FLASH->usd_unlock = FLASH_UNLOCK_KEY1;
689 FLASH->usd_unlock = FLASH_UNLOCK_KEY2;
690 while(FLASH->ctrl_bit.usdulks==RESET);
691
692 /* enable the user system data programming operation */
693 FLASH->ctrl_bit.usdprgm = TRUE;
694
695 USD->ssb = usd_ssb;
696 /* wait for operation to be completed */
697 status = flash_operation_wait_for(PROGRAMMING_TIMEOUT);
698
699 /* disable the usdprgm bit */
700 FLASH->ctrl_bit.usdprgm = FALSE;
701
702 /* return the user system data program status */
703 return status;
704}
705
711uint8_t flash_ssb_status_get(void)
712{
713 /* return the system setting byte status */
714 return (uint8_t)(FLASH->usd >> 2);
715}
716
729void flash_interrupt_enable(uint32_t flash_int, confirm_state new_state)
730{
731 if(flash_int & FLASH_ERR_INT)
732 FLASH->ctrl_bit.errie = new_state;
733 if(flash_int & FLASH_ODF_INT)
734 FLASH->ctrl_bit.odfie = new_state;
735 if(flash_int & FLASH_SPIM_ERR_INT)
736 FLASH->ctrl3_bit.errie = new_state;
737 if(flash_int & FLASH_SPIM_ODF_INT)
738 FLASH->ctrl3_bit.odfie = new_state;
739}
740
746void flash_spim_model_select(flash_spim_model_type mode)
747{
748 UNUSED(*(__IO uint32_t*)USD_BASE);
749 FLASH->select = mode;
750 /* dummy read */
751 flash_spim_dummy_read();
752}
753
761void flash_spim_encryption_range_set(uint32_t decode_address)
762{
763 FLASH->da = decode_address;
764}
765
771void flash_spim_dummy_read(void)
772{
773 UNUSED(*(__IO uint32_t*)FLASH_SPIM_START_ADDR);
774 UNUSED(*(__IO uint32_t*)(FLASH_SPIM_START_ADDR + 0x1000));
775 UNUSED(*(__IO uint32_t*)(FLASH_SPIM_START_ADDR + 0x2000));
776}
777
786 flash_status_type flash_spim_mass_program(uint32_t address, uint8_t *buf, uint32_t cnt)
787{
788 flash_status_type status = FLASH_OPERATE_DONE;
789 uint32_t index, temp_offset;
790 if(address >= FLASH_SPIM_START_ADDR)
791 {
792 temp_offset = cnt % 4;
793 if((temp_offset != 0) && (temp_offset != 2))
794 return status;
795
796 FLASH->ctrl3_bit.fprgm = TRUE;
797 for(index = 0; index < cnt / 4; index++)
798 {
799 *(__IO uint32_t*)(address + index * 4) = *(uint32_t*)(buf + index * 4);
800 /* wait for operation to be completed */
801 status = flash_spim_operation_wait_for(SPIM_PROGRAMMING_TIMEOUT);
802 if(status != FLASH_OPERATE_DONE)
803 return status;
804 }
805 if(temp_offset == 2)
806 {
807 *(__IO uint16_t*)(address + index * 4) = *(uint16_t*)(buf + index * 4);
808 /* wait for operation to be completed */
809 status = flash_spim_operation_wait_for(SPIM_PROGRAMMING_TIMEOUT);
810 }
811 /* disable the fprgm bit */
812 FLASH->ctrl3_bit.fprgm = FALSE;
813
814 /* dummy read */
815 flash_spim_dummy_read();
816 }
817
818 /* return the program status */
819 return status;
820}
821
831 flash_status_type flash_slib_enable(uint32_t pwd, uint16_t start_sector, uint16_t data_start_sector, uint16_t end_sector)
832{
833 uint32_t slib_range;
834 flash_status_type status = FLASH_OPERATE_DONE;
835
836 /*check range param limits*/
837 if((start_sector>=data_start_sector) || ((data_start_sector > end_sector) && \
838 (data_start_sector != 0x7FF)) || (start_sector > end_sector))
839 return FLASH_PROGRAM_ERROR;
840
841
842 /* unlock slib cfg register */
843 FLASH->slib_unlock = SLIB_UNLOCK_KEY;
844 while(FLASH->slib_misc_sts_bit.slib_ulkf==RESET);
845
846 slib_range = ((uint32_t)(data_start_sector << 11) & FLASH_SLIB_DATA_START_SECTOR) | \
847 ((uint32_t)(end_sector << 22) & FLASH_SLIB_END_SECTOR) | \
848 (start_sector & FLASH_SLIB_START_SECTOR);
849 /* configure slib, set pwd and range */
850 FLASH->slib_set_pwd = pwd;
851 status = flash_operation_wait_for(PROGRAMMING_TIMEOUT);
852 if(status == FLASH_OPERATE_DONE)
853 {
854 FLASH->slib_set_range = slib_range;
855 status = flash_operation_wait_for(PROGRAMMING_TIMEOUT);
856 }
857
858 return status;
859}
860
866 error_status flash_slib_disable(uint32_t pwd)
867{
868 flash_status_type status = FLASH_OPERATE_DONE;
869 /* write password to disable slib */
870 FLASH->slib_pwd_clr = pwd;
871
872 status = flash_operation_wait_for(ERASE_TIMEOUT);
873 if(status == FLASH_OPERATE_DONE)
874 {
875 if(FLASH->slib_misc_sts_bit.slib_pwd_ok)
876 return SUCCESS;
877 else
878 return ERROR;
879 }
880 return ERROR;
881}
882
888uint32_t flash_slib_remaining_count_get(void)
889{
890 return (uint32_t)FLASH->slib_misc_sts_bit.slib_rcnt;
891}
892
898 flag_status flash_slib_state_get(void)
899{
900 if(FLASH->slib_sts0_bit.slib_enf)
901 return SET;
902 else
903 return RESET;
904}
905
911uint16_t flash_slib_start_sector_get(void)
912{
913 return (uint16_t)FLASH->slib_sts1_bit.slib_ss;
914}
915
921uint16_t flash_slib_datastart_sector_get(void)
922{
923 return (uint16_t)FLASH->slib_sts1_bit.slib_dat_ss;
924}
925
931uint16_t flash_slib_end_sector_get(void)
932{
933 return (uint16_t)FLASH->slib_sts1_bit.slib_es;
934}
935
942uint32_t flash_crc_calibrate(uint32_t start_sector, uint32_t sector_cnt)
943{
944 FLASH->crc_ctrl_bit.crc_ss = start_sector;
945 FLASH->crc_ctrl_bit.crc_sn = sector_cnt;
946 FLASH->crc_ctrl_bit.crc_strt = TRUE;
947 flash_operation_wait_for(OPERATION_TIMEOUT);
948 return FLASH->crc_chkr;
949}
950
955#endif
956
UNUSED
#define UNUSED(x)
Definition at32f413_def.h:64
error_status
error_status
error status
Definition at32f413.h:302
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
flag_status
flag_status
flag status
Definition at32f413.h:292
ERROR
@ ERROR
Definition at32f413.h:302
SUCCESS
@ SUCCESS
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
SET
@ SET
Definition at32f413.h:292
flash_spim_model_type
flash_spim_model_type
flash spim model type
Definition at32f413_flash.h:170
flash_status_type
flash_status_type
flash status type
Definition at32f413_flash.h:158
FLASH_OPERATE_BUSY
@ FLASH_OPERATE_BUSY
Definition at32f413_flash.h:159
FLASH_OPERATE_DONE
@ FLASH_OPERATE_DONE
Definition at32f413_flash.h:162
FLASH_OPERATE_TIMEOUT
@ FLASH_OPERATE_TIMEOUT
Definition at32f413_flash.h:163
FLASH_PROGRAM_ERROR
@ FLASH_PROGRAM_ERROR
Definition at32f413_flash.h:160
FLASH_EPP_ERROR
@ FLASH_EPP_ERROR
Definition at32f413_flash.h:161
FLASH_ERR_INT
#define FLASH_ERR_INT
Definition at32f413_flash.h:95
FLASH_SPIM_ERR_INT
#define FLASH_SPIM_ERR_INT
Definition at32f413_flash.h:97
FLASH_SPIM_ODF_INT
#define FLASH_SPIM_ODF_INT
Definition at32f413_flash.h:98
FLASH_ODF_INT
#define FLASH_ODF_INT
Definition at32f413_flash.h:96
flash_slib_state_get
flag_status flash_slib_state_get(void)
get the slib state.
Definition at32f413_flash.c:898
flash_slib_enable
flash_status_type flash_slib_enable(uint32_t pwd, uint16_t start_sector, uint16_t data_start_sector, uint16_t end_sector)
enable security library function.
Definition at32f413_flash.c:831
flash_fap_status_get
flag_status flash_fap_status_get(void)
check the flash access protection status.
Definition at32f413_flash.c:659
flash_slib_remaining_count_get
uint32_t flash_slib_remaining_count_get(void)
get remaining count of slib(range: 256~0).
Definition at32f413_flash.c:888
flash_slib_disable
error_status flash_slib_disable(uint32_t pwd)
disable slib when slib enabled.
Definition at32f413_flash.c:866
flash_sector_erase
flash_status_type flash_sector_erase(uint32_t sector_address)
erase a specified flash sector.
Definition at32f413_flash.c:272
flash_halfword_program
flash_status_type flash_halfword_program(uint32_t address, uint16_t data)
program a halfword at a specified address.
Definition at32f413_flash.c:452
flash_user_system_data_program
flash_status_type flash_user_system_data_program(uint32_t address, uint8_t data)
program a halfword at a specified user system data address.
Definition at32f413_flash.c:514
flash_spim_lock
void flash_spim_lock(void)
lock the flash spim controller.
Definition at32f413_flash.c:261
flash_byte_program
flash_status_type flash_byte_program(uint32_t address, uint8_t data)
program a byte at a specified address.
Definition at32f413_flash.c:491
flash_spim_dummy_read
void flash_spim_dummy_read(void)
operate the flash spim dummy read.
Definition at32f413_flash.c:771
flash_unlock
void flash_unlock(void)
unlock the flash controller.
Definition at32f413_flash.c:228
flash_spim_unlock
void flash_spim_unlock(void)
unlock the flash spim controller.
Definition at32f413_flash.c:239
flash_spim_mass_program
flash_status_type flash_spim_mass_program(uint32_t address, uint8_t *buf, uint32_t cnt)
mass program for flash spim.
Definition at32f413_flash.c:786
flash_operation_status_get
flash_status_type flash_operation_status_get(void)
return the flash operation status.
Definition at32f413_flash.c:121
flash_epp_set
flash_status_type flash_epp_set(uint32_t *sector_bits)
config erase/program protection for the desired sectors.
Definition at32f413_flash.c:552
flash_spim_model_select
void flash_spim_model_select(flash_spim_model_type mode)
select spim supports extended spi flash chip model.
Definition at32f413_flash.c:746
flash_ssb_set
flash_status_type flash_ssb_set(uint8_t usd_ssb)
program the flash system setting byte in usd: wdt_ato_en / depslp_rst / stdby_rst.
Definition at32f413_flash.c:683
flash_crc_calibrate
uint32_t flash_crc_calibrate(uint32_t start_sector, uint32_t sector_cnt)
flash crc calibration in main block.
Definition at32f413_flash.c:942
flash_spim_operation_wait_for
flash_status_type flash_spim_operation_wait_for(uint32_t time_out)
wait for flash spim operation complete or timeout.
Definition at32f413_flash.c:204
flash_slib_start_sector_get
uint16_t flash_slib_start_sector_get(void)
get the start sector of slib.
Definition at32f413_flash.c:911
flash_interrupt_enable
void flash_interrupt_enable(uint32_t flash_int, confirm_state new_state)
enable or disable the specified flash interrupts.
Definition at32f413_flash.c:729
flash_fap_enable
flash_status_type flash_fap_enable(confirm_state new_state)
enable or disable the flash access protection.
Definition at32f413_flash.c:617
flash_slib_end_sector_get
uint16_t flash_slib_end_sector_get(void)
get the end sector of slib.
Definition at32f413_flash.c:931
flash_word_program
flash_status_type flash_word_program(uint32_t address, uint32_t data)
program a word at a specified address.
Definition at32f413_flash.c:414
flash_slib_datastart_sector_get
uint16_t flash_slib_datastart_sector_get(void)
get the data start sector of slib.
Definition at32f413_flash.c:921
flash_lock
void flash_lock(void)
lock the flash controller.
Definition at32f413_flash.c:251
flash_spim_encryption_range_set
void flash_spim_encryption_range_set(uint32_t decode_address)
set the range of encryption in spim flash. when the address is larger than this value,...
Definition at32f413_flash.c:761
flash_flag_get
flag_status flash_flag_get(uint32_t flash_flag)
check whether the specified flash flag is set or not.
Definition at32f413_flash.c:58
flash_spim_operation_status_get
flash_status_type flash_spim_operation_status_get(void)
return the flash spim operation status.
Definition at32f413_flash.c:150
flash_user_system_data_erase
flash_status_type flash_user_system_data_erase(void)
erase the flash user system data.
Definition at32f413_flash.c:363
flash_internal_all_erase
flash_status_type flash_internal_all_erase(void)
erase flash all internal sectors.
Definition at32f413_flash.c:313
flash_operation_wait_for
flash_status_type flash_operation_wait_for(uint32_t time_out)
wait for flash operation complete or timeout.
Definition at32f413_flash.c:179
flash_ssb_status_get
uint8_t flash_ssb_status_get(void)
return the flash system setting byte status.
Definition at32f413_flash.c:711
flash_epp_status_get
void flash_epp_status_get(uint32_t *sector_bits)
return the flash erase/program protection status.
Definition at32f413_flash.c:602
flash_flag_clear
void flash_flag_clear(uint32_t flash_flag)
clear the flash flag.
Definition at32f413_flash.c:97
flash_spim_all_erase
flash_status_type flash_spim_all_erase(void)
erase flash spim sectors.
Definition at32f413_flash.c:336
FLASH_SLIB_END_SECTOR
#define FLASH_SLIB_END_SECTOR
Definition at32f413_flash.h:111
FLASH_SLIB_DATA_START_SECTOR
#define FLASH_SLIB_DATA_START_SECTOR
Definition at32f413_flash.h:110
FLASH_SLIB_START_SECTOR
#define FLASH_SLIB_START_SECTOR
Definition at32f413_flash.h:109
FLASH_SPIM_START_ADDR
#define FLASH_SPIM_START_ADDR
Definition at32f413_flash.h:65
PROGRAMMING_TIMEOUT
#define PROGRAMMING_TIMEOUT
Definition at32f413_flash.h:141
SPIM_ERASE_TIMEOUT
#define SPIM_ERASE_TIMEOUT
Definition at32f413_flash.h:142
OPERATION_TIMEOUT
#define OPERATION_TIMEOUT
Definition at32f413_flash.h:144
ERASE_TIMEOUT
#define ERASE_TIMEOUT
Definition at32f413_flash.h:140
SPIM_PROGRAMMING_TIMEOUT
#define SPIM_PROGRAMMING_TIMEOUT
Definition at32f413_flash.h:143
FAP_RELIEVE_KEY
#define FAP_RELIEVE_KEY
Definition at32f413_flash.h:54
FLASH_UNLOCK_KEY2
#define FLASH_UNLOCK_KEY2
Definition at32f413_flash.h:53
FLASH_UNLOCK_KEY1
#define FLASH_UNLOCK_KEY1
Definition at32f413_flash.h:52
SLIB_UNLOCK_KEY
#define SLIB_UNLOCK_KEY
Definition at32f413_flash.h:55
USD
#define USD
Definition at32f413_flash.h:564
FLASH
#define FLASH
Definition at32f413_flash.h:563
USD_BASE
#define USD_BASE
Definition at32f413.h:331
at32f413_conf.h
at32f413 config header file


AT32F413 Firmwary Library: at32f413_flash.h Source File

  • libraries
  • drivers
  • inc
at32f413_flash.h
Go to the documentation of this file.
1
26/* Define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_FLASH_H
28#define __AT32F413_FLASH_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34
35/* Includes ------------------------------------------------------------------*/
36#include "at32f413.h"
37
38
52#define FLASH_UNLOCK_KEY1 ((uint32_t)0x45670123)
53#define FLASH_UNLOCK_KEY2 ((uint32_t)0xCDEF89AB)
54#define FAP_RELIEVE_KEY ((uint16_t)0x00A5)
55#define SLIB_UNLOCK_KEY ((uint32_t)0xA35F6D24)
65#define FLASH_SPIM_START_ADDR ((uint32_t)0x08400000)
76#define FLASH_OBF_FLAG ((uint32_t)0x00000001)
77#define FLASH_ODF_FLAG ((uint32_t)0x00000020)
78#define FLASH_PRGMERR_FLAG ((uint32_t)0x00000004)
79#define FLASH_EPPERR_FLAG ((uint32_t)0x00000010)
80#define FLASH_SPIM_OBF_FLAG ((uint32_t)0x20000001)
81#define FLASH_SPIM_ODF_FLAG ((uint32_t)0x20000020)
82#define FLASH_SPIM_PRGMERR_FLAG ((uint32_t)0x20000004)
83#define FLASH_SPIM_EPPERR_FLAG ((uint32_t)0x20000010)
84#define FLASH_USDERR_FLAG ((uint32_t)0x40000001)
95#define FLASH_ERR_INT ((uint32_t)0x00000001)
96#define FLASH_ODF_INT ((uint32_t)0x00000002)
97#define FLASH_SPIM_ERR_INT ((uint32_t)0x00000010)
98#define FLASH_SPIM_ODF_INT ((uint32_t)0x00000020)
109#define FLASH_SLIB_START_SECTOR ((uint32_t)0x000007FF)
110#define FLASH_SLIB_DATA_START_SECTOR ((uint32_t)0x003FF800)
111#define FLASH_SLIB_END_SECTOR ((uint32_t)0xFFC00000)
122#define USD_WDT_ATO_DISABLE ((uint16_t)0x0001)
123#define USD_WDT_ATO_ENABLE ((uint16_t)0x0000)
125#define USD_DEPSLP_NO_RST ((uint16_t)0x0002)
126#define USD_DEPSLP_RST ((uint16_t)0x0000)
128#define USD_STDBY_NO_RST ((uint16_t)0x0004)
129#define USD_STDBY_RST ((uint16_t)0x0000)
140#define ERASE_TIMEOUT ((uint32_t)0x40000000)
141#define PROGRAMMING_TIMEOUT ((uint32_t)0x00100000)
142#define SPIM_ERASE_TIMEOUT ((uint32_t)0xFFFFFFFF)
143#define SPIM_PROGRAMMING_TIMEOUT ((uint32_t)0x00100000)
144#define OPERATION_TIMEOUT ((uint32_t)0x10000000)
157typedef enum
158{
159 FLASH_OPERATE_BUSY = 0x00,
160 FLASH_PROGRAM_ERROR = 0x01,
161 FLASH_EPP_ERROR = 0x02,
162 FLASH_OPERATE_DONE = 0x03,
163 FLASH_OPERATE_TIMEOUT = 0x04
164} flash_status_type;
165
169typedef enum
170{
171 FLASH_SPIM_MODEL1 = 0x01,
172 FLASH_SPIM_MODEL2 = 0x02
173} flash_spim_model_type;
174
178typedef struct
179{
183 union
184 {
185 __IO uint32_t psr;
186 struct
187 {
188 __IO uint32_t reserved1 : 32; /* [31:0] */
189 } psr_bit;
190 };
191
195 union
196 {
197 __IO uint32_t unlock;
198 struct
199 {
200 __IO uint32_t ukval : 32;/* [31:0] */
201 } unlock_bit;
202 };
203
207 union
208 {
209 __IO uint32_t usd_unlock;
210 struct
211 {
212 __IO uint32_t usd_ukval : 32;/* [31:0] */
213 } usd_unlock_bit;
214 };
215
219 union
220 {
221 __IO uint32_t sts;
222 struct
223 {
224 __IO uint32_t obf : 1; /* [0] */
225 __IO uint32_t reserved1 : 1; /* [1] */
226 __IO uint32_t prgmerr : 1; /* [2] */
227 __IO uint32_t reserved2 : 1; /* [3] */
228 __IO uint32_t epperr : 1; /* [4] */
229 __IO uint32_t odf : 1; /* [5] */
230 __IO uint32_t reserved3 : 26;/* [31:6] */
231 } sts_bit;
232 };
233
237 union
238 {
239 __IO uint32_t ctrl;
240 struct
241 {
242 __IO uint32_t fprgm : 1; /* [0] */
243 __IO uint32_t secers : 1; /* [1] */
244 __IO uint32_t bankers : 1; /* [2] */
245 __IO uint32_t reserved1 : 1; /* [3] */
246 __IO uint32_t usdprgm : 1; /* [4] */
247 __IO uint32_t usders : 1; /* [5] */
248 __IO uint32_t erstr : 1; /* [6] */
249 __IO uint32_t oplk : 1; /* [7] */
250 __IO uint32_t reserved2 : 1; /* [8] */
251 __IO uint32_t usdulks : 1; /* [9] */
252 __IO uint32_t errie : 1; /* [10] */
253 __IO uint32_t reserved3 : 1; /* [11] */
254 __IO uint32_t odfie : 1; /* [12] */
255 __IO uint32_t reserved4 : 19;/* [31:13] */
256 } ctrl_bit;
257 };
258
262 union
263 {
264 __IO uint32_t addr;
265 struct
266 {
267 __IO uint32_t fa : 32;/* [31:0] */
268 } addr_bit;
269 };
270
274 __IO uint32_t reserved1;
275
279 union
280 {
281 __IO uint32_t usd;
282 struct
283 {
284 __IO uint32_t usderr : 1; /* [0] */
285 __IO uint32_t fap : 1; /* [1] */
286 __IO uint32_t wdt_ato_en : 1; /* [2] */
287 __IO uint32_t depslp_rst : 1; /* [3] */
288 __IO uint32_t stdby_rst : 1; /* [4] */
289 __IO uint32_t reserved1 : 5; /* [9:5] */
290 __IO uint32_t user_d0 : 8; /* [17:10] */
291 __IO uint32_t user_d1 : 8; /* [25:18] */
292 __IO uint32_t reserved2 : 6; /* [31:26] */
293 } usd_bit;
294 };
295
299 union
300 {
301 __IO uint32_t epps;
302 struct
303 {
304 __IO uint32_t epps : 32;/* [31:0] */
305 } epps_bit;
306 };
307
311 __IO uint32_t reserved2[24];
312
316 union
317 {
318 __IO uint32_t unlock3;
319 struct
320 {
321 __IO uint32_t ukval : 32;/* [31:0] */
322 } unlock3_bit;
323 };
324
328 union
329 {
330 __IO uint32_t select;
331 struct
332 {
333 __IO uint32_t select : 32;/* [31:0] */
334 } select_bit;
335 };
336
340 union
341 {
342 __IO uint32_t sts3;
343 struct
344 {
345 __IO uint32_t obf : 1; /* [0] */
346 __IO uint32_t reserved1 : 1; /* [1] */
347 __IO uint32_t prgmerr : 1; /* [2] */
348 __IO uint32_t reserved2 : 1; /* [3] */
349 __IO uint32_t epperr : 1; /* [4] */
350 __IO uint32_t odf : 1; /* [5] */
351 __IO uint32_t reserved3 : 26;/* [31:6] */
352 } sts3_bit;
353 };
354
358 union
359 {
360 __IO uint32_t ctrl3;
361 struct
362 {
363 __IO uint32_t fprgm : 1; /* [0] */
364 __IO uint32_t secers : 1; /* [1] */
365 __IO uint32_t chpers : 1; /* [2] */
366 __IO uint32_t reserved1 : 3; /* [5:3] */
367 __IO uint32_t erstr : 1; /* [6] */
368 __IO uint32_t oplk : 1; /* [7] */
369 __IO uint32_t reserved2 : 2; /* [9:8] */
370 __IO uint32_t errie : 1; /* [10] */
371 __IO uint32_t reserved3 : 1; /* [11] */
372 __IO uint32_t odfie : 1; /* [12] */
373 __IO uint32_t reserved4 : 19;/* [31:13] */
374 } ctrl3_bit;
375 };
376
380 union
381 {
382 __IO uint32_t addr3;
383 struct
384 {
385 __IO uint32_t fa : 32;/* [31:0] */
386 } addr3_bit;
387 };
388
392 union
393 {
394 __IO uint32_t da;
395 struct
396 {
397 __IO uint32_t fda : 32;/* [31:0] */
398 } da_bit;
399 };
400
404 __IO uint32_t reserved5[12];
405
409 union
410 {
411 __IO uint32_t slib_sts0;
412 struct
413 {
414 __IO uint32_t reserved1 : 3; /* [2:0] */
415 __IO uint32_t slib_enf : 1; /* [3] */
416 __IO uint32_t reserved2 : 28;/* [31:4] */
417 } slib_sts0_bit;
418 };
419
423 union
424 {
425 __IO uint32_t slib_sts1;
426 struct
427 {
428 __IO uint32_t slib_ss : 11;/* [10:0] */
429 __IO uint32_t slib_dat_ss : 11;/* [21:11] */
430 __IO uint32_t slib_es : 10;/* [31:22] */
431 } slib_sts1_bit;
432 };
433
437 union
438 {
439 __IO uint32_t slib_pwd_clr;
440 struct
441 {
442 __IO uint32_t slib_pclr_val : 32;/* [31:0] */
443 } slib_pwd_clr_bit;
444 };
445
449 union
450 {
451 __IO uint32_t slib_misc_sts;
452 struct
453 {
454 __IO uint32_t slib_pwd_err : 1; /* [0] */
455 __IO uint32_t slib_pwd_ok : 1; /* [1] */
456 __IO uint32_t slib_ulkf : 1; /* [2] */
457 __IO uint32_t reserved1 : 13;/* [15:3] */
458 __IO uint32_t slib_rcnt : 9; /* [24:16] */
459 __IO uint32_t reserved2 : 7; /* [31:25] */
460 } slib_misc_sts_bit;
461 };
462
466 union
467 {
468 __IO uint32_t slib_set_pwd;
469 struct
470 {
471 __IO uint32_t slib_pset_val : 32;/* [31:0] */
472 } slib_set_pwd_bit;
473 };
474
478 union
479 {
480 __IO uint32_t slib_set_range;
481 struct
482 {
483 __IO uint32_t slib_ss_set : 11;/* [10:0] */
484 __IO uint32_t slib_dss_set : 11;/* [21:11] */
485 __IO uint32_t slib_es_set : 10;/* [31:22] */
486 } slib_set_range_bit;
487 };
488
492 __IO uint32_t reserved6[3];
493
497 union
498 {
499 __IO uint32_t slib_unlock;
500 struct
501 {
502 __IO uint32_t slib_ukval : 32;/* [31:0] */
503 } slib_unlock_bit;
504 };
505
509 union
510 {
511 __IO uint32_t crc_ctrl;
512 struct
513 {
514 __IO uint32_t crc_ss : 12;/* [11:0] */
515 __IO uint32_t crc_sn : 12;/* [23:12] */
516 __IO uint32_t reserved1 : 7; /* [30:24] */
517 __IO uint32_t crc_strt : 1; /* [31] */
518 } crc_ctrl_bit;
519 };
520
524 union
525 {
526 __IO uint32_t crc_chkr;
527 struct
528 {
529 __IO uint32_t crc_chkr : 32;/* [31:0] */
530 } crc_chkr_bit;
531 };
532
533} flash_type;
534
538typedef struct
539{
540 __IO uint16_t fap;
541 __IO uint16_t ssb;
542 __IO uint16_t data0;
543 __IO uint16_t data1;
544 __IO uint16_t epp0;
545 __IO uint16_t epp1;
546 __IO uint16_t epp2;
547 __IO uint16_t epp3;
548 __IO uint16_t eopb0;
549 __IO uint16_t reserved;
550 __IO uint16_t data2;
551 __IO uint16_t data3;
552 __IO uint16_t data4;
553 __IO uint16_t data5;
554 __IO uint16_t data6;
555 __IO uint16_t data7;
556 __IO uint16_t ext_flash_key[8];
557} usd_type;
558
563#define FLASH ((flash_type *) FLASH_REG_BASE)
564#define USD ((usd_type *) USD_BASE)
565
570 flag_status flash_flag_get(uint32_t flash_flag);
571void flash_flag_clear(uint32_t flash_flag);
572 flash_status_type flash_operation_status_get(void);
573 flash_status_type flash_spim_operation_status_get(void);
574 flash_status_type flash_operation_wait_for(uint32_t time_out);
575 flash_status_type flash_spim_operation_wait_for(uint32_t time_out);
576void flash_unlock(void);
577void flash_spim_unlock(void);
578void flash_lock(void);
579void flash_spim_lock(void);
580 flash_status_type flash_sector_erase(uint32_t sector_address);
581 flash_status_type flash_internal_all_erase(void);
582 flash_status_type flash_spim_all_erase(void);
583 flash_status_type flash_user_system_data_erase(void);
584 flash_status_type flash_word_program(uint32_t address, uint32_t data);
585 flash_status_type flash_halfword_program(uint32_t address, uint16_t data);
586 flash_status_type flash_byte_program(uint32_t address, uint8_t data);
587 flash_status_type flash_user_system_data_program(uint32_t address, uint8_t data);
588 flash_status_type flash_epp_set(uint32_t *sector_bits);
589void flash_epp_status_get(uint32_t *sector_bits);
590 flash_status_type flash_fap_enable(confirm_state new_state);
591 flag_status flash_fap_status_get(void);
592 flash_status_type flash_ssb_set(uint8_t usd_ssb);
593uint8_t flash_ssb_status_get(void);
594void flash_interrupt_enable(uint32_t flash_int, confirm_state new_state);
595void flash_spim_model_select(flash_spim_model_type mode);
596void flash_spim_encryption_range_set(uint32_t decode_address);
597void flash_spim_dummy_read(void);
598 flash_status_type flash_spim_mass_program(uint32_t address, uint8_t *buf, uint32_t cnt);
599 flash_status_type flash_slib_enable(uint32_t pwd, uint16_t start_sector, uint16_t data_start_sector, uint16_t end_sector);
600 error_status flash_slib_disable(uint32_t pwd);
601uint32_t flash_slib_remaining_count_get(void);
602 flag_status flash_slib_state_get(void);
603uint16_t flash_slib_start_sector_get(void);
604uint16_t flash_slib_datastart_sector_get(void);
605uint16_t flash_slib_end_sector_get(void);
606uint32_t flash_crc_calibrate(uint32_t start_sector, uint32_t sector_cnt);
607
620#ifdef __cplusplus
621}
622#endif
623
624#endif
at32f413.h
at32f413 header file
error_status
error_status
error status
Definition at32f413.h:302
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
flag_status
flag_status
flag status
Definition at32f413.h:292
flash_slib_state_get
flag_status flash_slib_state_get(void)
get the slib state.
Definition at32f413_flash.c:898
flash_slib_enable
flash_status_type flash_slib_enable(uint32_t pwd, uint16_t start_sector, uint16_t data_start_sector, uint16_t end_sector)
enable security library function.
Definition at32f413_flash.c:831
flash_fap_status_get
flag_status flash_fap_status_get(void)
check the flash access protection status.
Definition at32f413_flash.c:659
flash_slib_remaining_count_get
uint32_t flash_slib_remaining_count_get(void)
get remaining count of slib(range: 256~0).
Definition at32f413_flash.c:888
flash_slib_disable
error_status flash_slib_disable(uint32_t pwd)
disable slib when slib enabled.
Definition at32f413_flash.c:866
flash_sector_erase
flash_status_type flash_sector_erase(uint32_t sector_address)
erase a specified flash sector.
Definition at32f413_flash.c:272
flash_halfword_program
flash_status_type flash_halfword_program(uint32_t address, uint16_t data)
program a halfword at a specified address.
Definition at32f413_flash.c:452
flash_user_system_data_program
flash_status_type flash_user_system_data_program(uint32_t address, uint8_t data)
program a halfword at a specified user system data address.
Definition at32f413_flash.c:514
flash_spim_lock
void flash_spim_lock(void)
lock the flash spim controller.
Definition at32f413_flash.c:261
flash_byte_program
flash_status_type flash_byte_program(uint32_t address, uint8_t data)
program a byte at a specified address.
Definition at32f413_flash.c:491
flash_spim_dummy_read
void flash_spim_dummy_read(void)
operate the flash spim dummy read.
Definition at32f413_flash.c:771
flash_unlock
void flash_unlock(void)
unlock the flash controller.
Definition at32f413_flash.c:228
flash_spim_unlock
void flash_spim_unlock(void)
unlock the flash spim controller.
Definition at32f413_flash.c:239
flash_spim_mass_program
flash_status_type flash_spim_mass_program(uint32_t address, uint8_t *buf, uint32_t cnt)
mass program for flash spim.
Definition at32f413_flash.c:786
flash_operation_status_get
flash_status_type flash_operation_status_get(void)
return the flash operation status.
Definition at32f413_flash.c:121
flash_epp_set
flash_status_type flash_epp_set(uint32_t *sector_bits)
config erase/program protection for the desired sectors.
Definition at32f413_flash.c:552
flash_spim_model_select
void flash_spim_model_select(flash_spim_model_type mode)
select spim supports extended spi flash chip model.
Definition at32f413_flash.c:746
flash_ssb_set
flash_status_type flash_ssb_set(uint8_t usd_ssb)
program the flash system setting byte in usd: wdt_ato_en / depslp_rst / stdby_rst.
Definition at32f413_flash.c:683
flash_crc_calibrate
uint32_t flash_crc_calibrate(uint32_t start_sector, uint32_t sector_cnt)
flash crc calibration in main block.
Definition at32f413_flash.c:942
flash_spim_operation_wait_for
flash_status_type flash_spim_operation_wait_for(uint32_t time_out)
wait for flash spim operation complete or timeout.
Definition at32f413_flash.c:204
flash_slib_start_sector_get
uint16_t flash_slib_start_sector_get(void)
get the start sector of slib.
Definition at32f413_flash.c:911
flash_interrupt_enable
void flash_interrupt_enable(uint32_t flash_int, confirm_state new_state)
enable or disable the specified flash interrupts.
Definition at32f413_flash.c:729
flash_fap_enable
flash_status_type flash_fap_enable(confirm_state new_state)
enable or disable the flash access protection.
Definition at32f413_flash.c:617
flash_slib_end_sector_get
uint16_t flash_slib_end_sector_get(void)
get the end sector of slib.
Definition at32f413_flash.c:931
flash_word_program
flash_status_type flash_word_program(uint32_t address, uint32_t data)
program a word at a specified address.
Definition at32f413_flash.c:414
flash_slib_datastart_sector_get
uint16_t flash_slib_datastart_sector_get(void)
get the data start sector of slib.
Definition at32f413_flash.c:921
flash_lock
void flash_lock(void)
lock the flash controller.
Definition at32f413_flash.c:251
flash_spim_encryption_range_set
void flash_spim_encryption_range_set(uint32_t decode_address)
set the range of encryption in spim flash. when the address is larger than this value,...
Definition at32f413_flash.c:761
flash_flag_get
flag_status flash_flag_get(uint32_t flash_flag)
check whether the specified flash flag is set or not.
Definition at32f413_flash.c:58
flash_spim_operation_status_get
flash_status_type flash_spim_operation_status_get(void)
return the flash spim operation status.
Definition at32f413_flash.c:150
flash_user_system_data_erase
flash_status_type flash_user_system_data_erase(void)
erase the flash user system data.
Definition at32f413_flash.c:363
flash_internal_all_erase
flash_status_type flash_internal_all_erase(void)
erase flash all internal sectors.
Definition at32f413_flash.c:313
flash_operation_wait_for
flash_status_type flash_operation_wait_for(uint32_t time_out)
wait for flash operation complete or timeout.
Definition at32f413_flash.c:179
flash_ssb_status_get
uint8_t flash_ssb_status_get(void)
return the flash system setting byte status.
Definition at32f413_flash.c:711
flash_epp_status_get
void flash_epp_status_get(uint32_t *sector_bits)
return the flash erase/program protection status.
Definition at32f413_flash.c:602
flash_flag_clear
void flash_flag_clear(uint32_t flash_flag)
clear the flash flag.
Definition at32f413_flash.c:97
flash_spim_all_erase
flash_status_type flash_spim_all_erase(void)
erase flash spim sectors.
Definition at32f413_flash.c:336
flash_spim_model_type
flash_spim_model_type
flash spim model type
Definition at32f413_flash.h:170
flash_status_type
flash_status_type
flash status type
Definition at32f413_flash.h:158
FLASH_SPIM_MODEL1
@ FLASH_SPIM_MODEL1
Definition at32f413_flash.h:171
FLASH_SPIM_MODEL2
@ FLASH_SPIM_MODEL2
Definition at32f413_flash.h:172
FLASH_OPERATE_BUSY
@ FLASH_OPERATE_BUSY
Definition at32f413_flash.h:159
FLASH_OPERATE_DONE
@ FLASH_OPERATE_DONE
Definition at32f413_flash.h:162
FLASH_OPERATE_TIMEOUT
@ FLASH_OPERATE_TIMEOUT
Definition at32f413_flash.h:163
FLASH_PROGRAM_ERROR
@ FLASH_PROGRAM_ERROR
Definition at32f413_flash.h:160
FLASH_EPP_ERROR
@ FLASH_EPP_ERROR
Definition at32f413_flash.h:161
flash_type
type define flash register all
Definition at32f413_flash.h:179
flash_type::secers
__IO uint32_t secers
Definition at32f413_flash.h:243
flash_type::unlock
__IO uint32_t unlock
Definition at32f413_flash.h:197
flash_type::reserved2
__IO uint32_t reserved2
flash reserved2 register, offset:0x80~0x24
Definition at32f413_flash.h:227
flash_type::crc_sn
__IO uint32_t crc_sn
Definition at32f413_flash.h:515
flash_type::psr
__IO uint32_t psr
Definition at32f413_flash.h:185
flash_type::user_d0
__IO uint32_t user_d0
Definition at32f413_flash.h:290
flash_type::unlock3
__IO uint32_t unlock3
Definition at32f413_flash.h:318
flash_type::slib_set_pwd
__IO uint32_t slib_set_pwd
Definition at32f413_flash.h:468
flash_type::slib_pwd_err
__IO uint32_t slib_pwd_err
Definition at32f413_flash.h:454
flash_type::ukval
__IO uint32_t ukval
Definition at32f413_flash.h:200
flash_type::slib_ukval
__IO uint32_t slib_ukval
Definition at32f413_flash.h:502
flash_type::bankers
__IO uint32_t bankers
Definition at32f413_flash.h:244
flash_type::slib_set_range
__IO uint32_t slib_set_range
Definition at32f413_flash.h:480
flash_type::usd_ukval
__IO uint32_t usd_ukval
Definition at32f413_flash.h:212
flash_type::select
__IO uint32_t select
Definition at32f413_flash.h:330
flash_type::ctrl
__IO uint32_t ctrl
Definition at32f413_flash.h:239
flash_type::slib_rcnt
__IO uint32_t slib_rcnt
Definition at32f413_flash.h:458
flash_type::stdby_rst
__IO uint32_t stdby_rst
Definition at32f413_flash.h:288
flash_type::crc_strt
__IO uint32_t crc_strt
Definition at32f413_flash.h:517
flash_type::slib_dat_ss
__IO uint32_t slib_dat_ss
Definition at32f413_flash.h:429
flash_type::epps
__IO uint32_t epps
Definition at32f413_flash.h:301
flash_type::fprgm
__IO uint32_t fprgm
Definition at32f413_flash.h:242
flash_type::reserved1
__IO uint32_t reserved1
flash reserved1 register, offset:0x18
Definition at32f413_flash.h:188
flash_type::slib_sts1
__IO uint32_t slib_sts1
Definition at32f413_flash.h:425
flash_type::erstr
__IO uint32_t erstr
Definition at32f413_flash.h:248
flash_type::usderr
__IO uint32_t usderr
Definition at32f413_flash.h:284
flash_type::crc_ss
__IO uint32_t crc_ss
Definition at32f413_flash.h:514
flash_type::crc_chkr
__IO uint32_t crc_chkr
Definition at32f413_flash.h:526
flash_type::slib_misc_sts
__IO uint32_t slib_misc_sts
Definition at32f413_flash.h:451
flash_type::usdulks
__IO uint32_t usdulks
Definition at32f413_flash.h:251
flash_type::slib_pclr_val
__IO uint32_t slib_pclr_val
Definition at32f413_flash.h:442
flash_type::slib_ulkf
__IO uint32_t slib_ulkf
Definition at32f413_flash.h:456
flash_type::epperr
__IO uint32_t epperr
Definition at32f413_flash.h:228
flash_type::ctrl3
__IO uint32_t ctrl3
Definition at32f413_flash.h:360
flash_type::odfie
__IO uint32_t odfie
Definition at32f413_flash.h:254
flash_type::fda
__IO uint32_t fda
Definition at32f413_flash.h:397
flash_type::slib_ss
__IO uint32_t slib_ss
Definition at32f413_flash.h:428
flash_type::da
__IO uint32_t da
Definition at32f413_flash.h:394
flash_type::fa
__IO uint32_t fa
Definition at32f413_flash.h:267
flash_type::slib_es
__IO uint32_t slib_es
Definition at32f413_flash.h:430
flash_type::slib_ss_set
__IO uint32_t slib_ss_set
Definition at32f413_flash.h:483
flash_type::prgmerr
__IO uint32_t prgmerr
Definition at32f413_flash.h:226
flash_type::slib_unlock
__IO uint32_t slib_unlock
Definition at32f413_flash.h:499
flash_type::errie
__IO uint32_t errie
Definition at32f413_flash.h:252
flash_type::user_d1
__IO uint32_t user_d1
Definition at32f413_flash.h:291
flash_type::chpers
__IO uint32_t chpers
Definition at32f413_flash.h:365
flash_type::usd
__IO uint32_t usd
Definition at32f413_flash.h:281
flash_type::depslp_rst
__IO uint32_t depslp_rst
Definition at32f413_flash.h:287
flash_type::slib_pwd_clr
__IO uint32_t slib_pwd_clr
Definition at32f413_flash.h:439
flash_type::usd_unlock
__IO uint32_t usd_unlock
Definition at32f413_flash.h:209
flash_type::wdt_ato_en
__IO uint32_t wdt_ato_en
Definition at32f413_flash.h:286
flash_type::usdprgm
__IO uint32_t usdprgm
Definition at32f413_flash.h:246
flash_type::slib_pwd_ok
__IO uint32_t slib_pwd_ok
Definition at32f413_flash.h:455
flash_type::sts3
__IO uint32_t sts3
Definition at32f413_flash.h:342
flash_type::slib_es_set
__IO uint32_t slib_es_set
Definition at32f413_flash.h:485
flash_type::usders
__IO uint32_t usders
Definition at32f413_flash.h:247
flash_type::oplk
__IO uint32_t oplk
Definition at32f413_flash.h:249
flash_type::addr
__IO uint32_t addr
Definition at32f413_flash.h:264
flash_type::reserved4
__IO uint32_t reserved4
Definition at32f413_flash.h:255
flash_type::slib_dss_set
__IO uint32_t slib_dss_set
Definition at32f413_flash.h:484
flash_type::slib_sts0
__IO uint32_t slib_sts0
Definition at32f413_flash.h:411
flash_type::odf
__IO uint32_t odf
Definition at32f413_flash.h:229
flash_type::addr3
__IO uint32_t addr3
Definition at32f413_flash.h:382
flash_type::fap
__IO uint32_t fap
Definition at32f413_flash.h:285
flash_type::crc_ctrl
__IO uint32_t crc_ctrl
Definition at32f413_flash.h:511
flash_type::sts
__IO uint32_t sts
Definition at32f413_flash.h:221
flash_type::slib_pset_val
__IO uint32_t slib_pset_val
Definition at32f413_flash.h:471
flash_type::slib_enf
__IO uint32_t slib_enf
Definition at32f413_flash.h:415
flash_type::reserved3
__IO uint32_t reserved3
Definition at32f413_flash.h:230
flash_type::obf
__IO uint32_t obf
Definition at32f413_flash.h:224
usd_type
user system data
Definition at32f413_flash.h:539
usd_type::eopb0
__IO uint16_t eopb0
Definition at32f413_flash.h:548
usd_type::epp2
__IO uint16_t epp2
Definition at32f413_flash.h:546
usd_type::data7
__IO uint16_t data7
Definition at32f413_flash.h:555
usd_type::reserved
__IO uint16_t reserved
Definition at32f413_flash.h:549
usd_type::epp0
__IO uint16_t epp0
Definition at32f413_flash.h:544
usd_type::data3
__IO uint16_t data3
Definition at32f413_flash.h:551
usd_type::epp3
__IO uint16_t epp3
Definition at32f413_flash.h:547
usd_type::data6
__IO uint16_t data6
Definition at32f413_flash.h:554
usd_type::data2
__IO uint16_t data2
Definition at32f413_flash.h:550
usd_type::data1
__IO uint16_t data1
Definition at32f413_flash.h:543
usd_type::ssb
__IO uint16_t ssb
Definition at32f413_flash.h:541
usd_type::fap
__IO uint16_t fap
Definition at32f413_flash.h:540
usd_type::epp1
__IO uint16_t epp1
Definition at32f413_flash.h:545
usd_type::data0
__IO uint16_t data0
Definition at32f413_flash.h:542
usd_type::data4
__IO uint16_t data4
Definition at32f413_flash.h:552
usd_type::data5
__IO uint16_t data5
Definition at32f413_flash.h:553


AT32F413 Firmwary Library: at32f413_gpio.c Source File

  • libraries
  • drivers
  • src
at32f413_gpio.c
Go to the documentation of this file.
1
26#include "at32f413_conf.h"
27
37#ifdef GPIO_MODULE_ENABLED
38
50void gpio_reset(gpio_type *gpio_x)
51{
52 if(gpio_x == GPIOA)
53 {
54 crm_periph_reset(CRM_GPIOA_PERIPH_RESET, TRUE);
55 crm_periph_reset(CRM_GPIOA_PERIPH_RESET, FALSE);
56 }
57 else if(gpio_x == GPIOB)
58 {
59 crm_periph_reset(CRM_GPIOB_PERIPH_RESET, TRUE);
60 crm_periph_reset(CRM_GPIOB_PERIPH_RESET, FALSE);
61 }
62 else if(gpio_x == GPIOC)
63 {
64 crm_periph_reset(CRM_GPIOC_PERIPH_RESET, TRUE);
65 crm_periph_reset(CRM_GPIOC_PERIPH_RESET, FALSE);
66 }
67 else if(gpio_x == GPIOD)
68 {
69 crm_periph_reset(CRM_GPIOD_PERIPH_RESET, TRUE);
70 crm_periph_reset(CRM_GPIOD_PERIPH_RESET, FALSE);
71 }
72 else if(gpio_x == GPIOF)
73 {
74 crm_periph_reset(CRM_GPIOF_PERIPH_RESET, TRUE);
75 crm_periph_reset(CRM_GPIOF_PERIPH_RESET, FALSE);
76 }
77}
78
85void gpio_iomux_reset(void)
86{
87 crm_periph_reset(CRM_IOMUX_PERIPH_RESET, TRUE);
88 crm_periph_reset(CRM_IOMUX_PERIPH_RESET, FALSE);
89}
90
99void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
100{
101 uint32_t temp;
102 uint16_t pinx_value, pin_index;
103
104 pin_index = (uint16_t)gpio_init_struct->gpio_pins;
105
106 /* pinx_value indecate pin grounp bit[3:0] from modey[1:0] confy[1:0] */
107
108 /* pin input analog config */
109 if(gpio_init_struct->gpio_mode == GPIO_MODE_ANALOG)
110 {
111 pinx_value = 0x00;
112 }
113 /* pin input config */
114 else if(gpio_init_struct->gpio_mode == GPIO_MODE_INPUT)
115 {
116 pinx_value = gpio_init_struct->gpio_pull & 0x0F;
117
118 if(gpio_init_struct->gpio_pull == GPIO_PULL_UP)
119 {
120 gpio_x->scr = pin_index;
121 }
122 else if(gpio_init_struct->gpio_pull == GPIO_PULL_DOWN)
123 {
124 gpio_x->clr = pin_index;
125 }
126 }
127 else
128 {
129 pinx_value = (gpio_init_struct->gpio_mode & 0x08) | (gpio_init_struct->gpio_out_type & 0x04) | \
130 (gpio_init_struct->gpio_drive_strength & 0x03);
131 }
132
133 /* pin 0~7 config */
134 if(((uint32_t)pin_index & ((uint32_t)0x00FF)) != 0x00)
135 {
136 for(temp = 0; temp < 0x08; temp++)
137 {
138 if((1 << temp) & pin_index)
139 {
140 gpio_x->cfglr &= (uint32_t)~(0x0F << (temp * 4));
141 gpio_x->cfglr |= (uint32_t)(pinx_value << (temp * 4));
142 }
143 }
144 }
145
146 /* pin 8~15 config */
147 if(pin_index > 0x00ff)
148 {
149 pin_index = pin_index >> 8;
150
151 for(temp = 0; temp < 0x8; temp++)
152 {
153 if((1 << temp) & pin_index)
154 {
155 gpio_x->cfghr &= (uint32_t)~(0xf << (temp * 4));
156 gpio_x->cfghr |= (uint32_t)(pinx_value << (temp * 4));
157 }
158 }
159 }
160}
161
167void gpio_default_para_init(gpio_init_type *gpio_init_struct)
168{
169 /* reset gpio init structure parameters values */
170 gpio_init_struct->gpio_pins = GPIO_PINS_ALL;
171 gpio_init_struct->gpio_mode = GPIO_MODE_INPUT;
172 gpio_init_struct->gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
173 gpio_init_struct->gpio_pull = GPIO_PULL_NONE;
174 gpio_init_struct->gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
175}
176
202 flag_status gpio_input_data_bit_read(gpio_type *gpio_x, uint16_t pins)
203{
204 flag_status status = RESET;
205
206 if(pins != (pins & gpio_x->idt))
207 {
208 status = RESET;
209 }
210 else
211 {
212 status = SET;
213 }
214
215 return status;
216}
217
225uint16_t gpio_input_data_read(gpio_type *gpio_x)
226{
227 return ((uint16_t)(gpio_x->idt));
228}
229
255 flag_status gpio_output_data_bit_read(gpio_type *gpio_x, uint16_t pins)
256{
257 flag_status status = RESET;
258
259 if((gpio_x->odt & pins) != RESET)
260 {
261 status = SET;
262 }
263 else
264 {
265 status = RESET;
266 }
267
268 return status;
269}
270
278uint16_t gpio_output_data_read(gpio_type *gpio_x)
279{
280 return ((uint16_t)(gpio_x->odt));
281}
282
309void gpio_bits_set(gpio_type *gpio_x, uint16_t pins)
310{
311 gpio_x->scr = pins;
312}
313
340void gpio_bits_reset(gpio_type *gpio_x, uint16_t pins)
341{
342 gpio_x->clr = pins;
343}
344
371void gpio_bits_toggle(gpio_type *gpio_x, uint16_t pins)
372{
373 uint32_t odt = gpio_x->odt;
374
375 gpio_x->scr = ((odt & pins) << 16) | (~odt & pins);
376}
377
405void gpio_bits_write(gpio_type *gpio_x, uint16_t pins, confirm_state bit_state)
406{
407 if(bit_state != FALSE)
408 {
409 gpio_x->scr = pins;
410 }
411 else
412 {
413 gpio_x->clr = pins;
414 }
415}
416
425void gpio_port_write(gpio_type *gpio_x, uint16_t port_value)
426{
427 gpio_x->odt = port_value;
428}
429
456void gpio_pin_wp_config(gpio_type *gpio_x, uint16_t pins)
457{
458 uint32_t temp = 0x00010000;
459
460 temp |= pins;
461 /* set wpen bit */
462 gpio_x->wpr = temp;
463 /* reset wpen bit */
464 gpio_x->wpr = pins;
465 /* set wpen bit */
466 gpio_x->wpr = temp;
467 /* read wpen bit*/
468 temp = gpio_x->wpr;
469 /* read wpen bit*/
470 temp = gpio_x->wpr;
471}
472
503void gpio_event_output_config(gpio_port_source_type gpio_port_source, gpio_pins_source_type gpio_pin_source)
504{
505 uint32_t tmpreg = 0x00;
506
507 tmpreg = IOMUX->evtout;
508
509 /* clear the port[6:4] and pin[3:0] bits */
510 tmpreg &= 0x80;
511 tmpreg |= (uint32_t)gpio_port_source << 0x04;
512 tmpreg |= gpio_pin_source;
513 IOMUX->evtout = tmpreg;
514}
515
522void gpio_event_output_enable(confirm_state new_state)
523{
524 IOMUX->evtout_bit.evoen = new_state;
525}
526
549void gpio_pin_remap_config(uint32_t gpio_remap, confirm_state new_state)
550{
551 uint32_t reg_addr, remap_mask;
552 uint8_t bit_offset, bit_num, bit_val;
553
554 /* get register address, bit offset, bit number and remap value */
555 reg_addr = IOMUX_BASE + (gpio_remap >> 24);
556 bit_offset = (gpio_remap >> 16) & 0xFF;
557 bit_num = (gpio_remap >> 8) & 0xFF;
558 bit_val = gpio_remap & 0xFF;
559
560 /* get remap mask value */
561 remap_mask = 0xFFFFFFFF << (32 - bit_num - bit_offset);
562 remap_mask = remap_mask >> (32 - bit_num - bit_offset);
563 remap_mask = remap_mask >> bit_offset;
564 remap_mask = remap_mask << bit_offset;
565
566 /* clear remap value */
567 *(uint32_t*)reg_addr &= ~remap_mask;
568
569 if(new_state != FALSE)
570 {
571 /* set remap value */
572 *(uint32_t*)reg_addr |= (uint32_t)(bit_val << bit_offset);
573 }
574}
575
605void gpio_exint_line_config(gpio_port_source_type gpio_port_source, gpio_pins_source_type gpio_pin_source)
606{
607 uint32_t tmp = 0x00;
608 tmp = ((uint32_t)0x0F) << (0x04 * (gpio_pin_source & (uint8_t)0x03));
609
610 switch (gpio_pin_source >> 0x02)
611 {
612 case 0:
613 IOMUX->exintc1 &= ~tmp;
614 IOMUX->exintc1 |= (((uint32_t)gpio_port_source) << (0x04 * (gpio_pin_source & (uint8_t)0x03)));
615 break;
616 case 1:
617 IOMUX->exintc2 &= ~tmp;
618 IOMUX->exintc2 |= (((uint32_t)gpio_port_source) << (0x04 * (gpio_pin_source & (uint8_t)0x03)));
619 break;
620 case 2:
621 IOMUX->exintc3 &= ~tmp;
622 IOMUX->exintc3 |= (((uint32_t)gpio_port_source) << (0x04 * (gpio_pin_source & (uint8_t)0x03)));
623 break;
624 case 3:
625 IOMUX->exintc4 &= ~tmp;
626 IOMUX->exintc4 |= (((uint32_t)gpio_port_source) << (0x04 * (gpio_pin_source & (uint8_t)0x03)));
627 break;
628 default:
629 break;
630 }
631}
632
637#endif
638
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
crm_periph_reset
void crm_periph_reset(crm_periph_reset_type value, confirm_state new_state)
enable or disable the peripheral reset
Definition at32f413_crm.c:293
CRM_IOMUX_PERIPH_RESET
@ CRM_IOMUX_PERIPH_RESET
Definition at32f413_crm.h:151
CRM_GPIOF_PERIPH_RESET
@ CRM_GPIOF_PERIPH_RESET
Definition at32f413_crm.h:157
CRM_GPIOD_PERIPH_RESET
@ CRM_GPIOD_PERIPH_RESET
Definition at32f413_crm.h:156
CRM_GPIOC_PERIPH_RESET
@ CRM_GPIOC_PERIPH_RESET
Definition at32f413_crm.h:155
CRM_GPIOA_PERIPH_RESET
@ CRM_GPIOA_PERIPH_RESET
Definition at32f413_crm.h:153
CRM_GPIOB_PERIPH_RESET
@ CRM_GPIOB_PERIPH_RESET
Definition at32f413_crm.h:154
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
flag_status
flag_status
flag status
Definition at32f413.h:292
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
SET
@ SET
Definition at32f413.h:292
gpio_pins_source_type
gpio_pins_source_type
gpio pins source type
Definition at32f413_gpio.h:252
gpio_port_source_type
gpio_port_source_type
gpio port source type
Definition at32f413_gpio.h:275
GPIO_MODE_ANALOG
@ GPIO_MODE_ANALOG
Definition at32f413_gpio.h:216
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_PULL_DOWN
@ GPIO_PULL_DOWN
Definition at32f413_gpio.h:245
GPIO_PULL_UP
@ GPIO_PULL_UP
Definition at32f413_gpio.h:244
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_ALL
#define GPIO_PINS_ALL
Definition at32f413_gpio.h:66
gpio_iomux_reset
void gpio_iomux_reset(void)
reset the mux functions (remap, event control and exint configuration) registers to their default val...
Definition at32f413_gpio.c:85
gpio_output_data_read
uint16_t gpio_output_data_read(gpio_type *gpio_x)
read the specified gpio ouput data port.
Definition at32f413_gpio.c:278
gpio_event_output_config
void gpio_event_output_config(gpio_port_source_type gpio_port_source, gpio_pins_source_type gpio_pin_source)
select the gpio pin used as event output.
Definition at32f413_gpio.c:503
gpio_output_data_bit_read
flag_status gpio_output_data_bit_read(gpio_type *gpio_x, uint16_t pins)
read the specified output port pin.
Definition at32f413_gpio.c:255
gpio_bits_write
void gpio_bits_write(gpio_type *gpio_x, uint16_t pins, confirm_state bit_state)
set or clear the selected data port bit.
Definition at32f413_gpio.c:405
gpio_event_output_enable
void gpio_event_output_enable(confirm_state new_state)
enable or disable the event output.
Definition at32f413_gpio.c:522
gpio_bits_reset
void gpio_bits_reset(gpio_type *gpio_x, uint16_t pins)
clear the selected data port bits.
Definition at32f413_gpio.c:340
gpio_input_data_read
uint16_t gpio_input_data_read(gpio_type *gpio_x)
read the specified gpio input data port.
Definition at32f413_gpio.c:225
gpio_pin_wp_config
void gpio_pin_wp_config(gpio_type *gpio_x, uint16_t pins)
write protect gpio pins configuration registers.
Definition at32f413_gpio.c:456
gpio_port_write
void gpio_port_write(gpio_type *gpio_x, uint16_t port_value)
write data to the specified gpio data port.
Definition at32f413_gpio.c:425
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_bits_toggle
void gpio_bits_toggle(gpio_type *gpio_x, uint16_t pins)
toggle the selected data port bits.
Definition at32f413_gpio.c:371
gpio_pin_remap_config
void gpio_pin_remap_config(uint32_t gpio_remap, confirm_state new_state)
iomux remap and debug i/o configuration.
Definition at32f413_gpio.c:549
gpio_input_data_bit_read
flag_status gpio_input_data_bit_read(gpio_type *gpio_x, uint16_t pins)
read the specified input port pin.
Definition at32f413_gpio.c:202
gpio_bits_set
void gpio_bits_set(gpio_type *gpio_x, uint16_t pins)
set the selected data port bits.
Definition at32f413_gpio.c:309
gpio_exint_line_config
void gpio_exint_line_config(gpio_port_source_type gpio_port_source, gpio_pins_source_type gpio_pin_source)
select the gpio pin used as exint line.
Definition at32f413_gpio.c:605
gpio_reset
void gpio_reset(gpio_type *gpio_x)
reset the gpio register
Definition at32f413_gpio.c:50
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIOC
#define GPIOC
Definition at32f413_gpio.h:749
GPIOF
#define GPIOF
Definition at32f413_gpio.h:751
GPIOB
#define GPIOB
Definition at32f413_gpio.h:748
GPIOD
#define GPIOD
Definition at32f413_gpio.h:750
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
IOMUX
#define IOMUX
Definition at32f413_gpio.h:752
IOMUX_BASE
#define IOMUX_BASE
Definition at32f413.h:362
at32f413_conf.h
at32f413 config header file
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
gpio_type
type define gpio register all
Definition at32f413_gpio.h:299
gpio_type::scr
__IO uint32_t scr
Definition at32f413_gpio.h:415
gpio_type::odt
__IO uint32_t odt
Definition at32f413_gpio.h:387
gpio_type::clr
__IO uint32_t clr
Definition at32f413_gpio.h:458
gpio_type::cfghr
__IO uint32_t cfghr
Definition at32f413_gpio.h:332
gpio_type::cfglr
__IO uint32_t cfglr
Definition at32f413_gpio.h:305
gpio_type::idt
__IO uint32_t idt
Definition at32f413_gpio.h:359
gpio_type::wpr
__IO uint32_t wpr
Definition at32f413_gpio.h:486


AT32F413 Firmwary Library: at32f413_gpio.h Source File

  • libraries
  • drivers
  • inc
at32f413_gpio.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_GPIO_H
28#define __AT32F413_GPIO_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34
35/* includes ------------------------------------------------------------------*/
36#include "at32f413.h"
37
50#define GPIO_PINS_0 0x0001
51#define GPIO_PINS_1 0x0002
52#define GPIO_PINS_2 0x0004
53#define GPIO_PINS_3 0x0008
54#define GPIO_PINS_4 0x0010
55#define GPIO_PINS_5 0x0020
56#define GPIO_PINS_6 0x0040
57#define GPIO_PINS_7 0x0080
58#define GPIO_PINS_8 0x0100
59#define GPIO_PINS_9 0x0200
60#define GPIO_PINS_10 0x0400
61#define GPIO_PINS_11 0x0800
62#define GPIO_PINS_12 0x1000
63#define GPIO_PINS_13 0x2000
64#define GPIO_PINS_14 0x4000
65#define GPIO_PINS_15 0x8000
66#define GPIO_PINS_ALL 0xFFFF
72#define IOMUX_MAKE_VALUE(reg_offset, bit_addr ,bit_num, bit_val) \
73 (uint32_t)(((reg_offset) << 24) | ((bit_addr) << 16) | ((bit_num) << 8) | (bit_val))
74
80#define SPI1_MUX_01 SPI1_GMUX_0001
81#define I2C1_MUX I2C1_GMUX_0001
82#define USART1_MUX USART1_GMUX_0001
83#define USART3_MUX_01 USART3_GMUX_0001
84#define TMR1_MUX_01 TMR1_GMUX_0001
85#define TMR2_MUX_01 TMR2_GMUX_001
86#define TMR2_MUX_10 TMR2_GMUX_010
87#define TMR2_MUX_11 TMR2_GMUX_011
88#define TMR3_MUX_10 TMR3_GMUX_0010
89#define TMR3_MUX_11 TMR3_GMUX_0011
90#define CAN_MUX_10 CAN1_GMUX_0010
91#define PD01_MUX PD01_GMUX
92#define TMR5CH4_MUX TMR5CH4_GMUX
93#define ADC1_ETP_MUX ADC1_ETP_GMUX
94#define ADC1_ETO_MUX ADC1_ETO_GMUX
95#define ADC2_ETP_MUX ADC2_ETP_GMUX
96#define ADC2_ETO_MUX ADC2_ETO_GMUX
97#define SWJTAG_CONF_001 SWJTAG_GMUX_001
98#define SWJTAG_CONF_010 SWJTAG_GMUX_010
99#define SWJTAG_CONF_100 SWJTAG_GMUX_100
110#define EXT_SPIM_EN_MUX EXT_SPIM_GMUX_1000
121#define TMR9_GMUX IOMUX_MAKE_VALUE(0x20, 0, 4, 0x02)
122#define TMR10_GMUX IOMUX_MAKE_VALUE(0x20, 4, 4, 0x02)
123#define TMR11_GMUX IOMUX_MAKE_VALUE(0x20, 8, 4, 0x02)
134#define TMR1_GMUX_0001 IOMUX_MAKE_VALUE(0x24, 0, 4, 0x01)
135#define TMR2_GMUX_001 IOMUX_MAKE_VALUE(0x24, 4, 3, 0x01)
136#define TMR2_GMUX_010 IOMUX_MAKE_VALUE(0x24, 4, 3, 0x02)
137#define TMR2_GMUX_011 IOMUX_MAKE_VALUE(0x24, 4, 3, 0x03)
138#define TMR2ITR1_GMUX IOMUX_MAKE_VALUE(0x24, 7, 1, 0x01)
139#define TMR3_GMUX_0010 IOMUX_MAKE_VALUE(0x24, 8, 4, 0x02)
140#define TMR3_GMUX_0011 IOMUX_MAKE_VALUE(0x24, 8, 4, 0x03)
141#define TMR5_GMUX_001 IOMUX_MAKE_VALUE(0x24, 16, 3, 0x01)
142#define TMR5CH4_GMUX IOMUX_MAKE_VALUE(0x24, 19, 1, 0x01)
153#define I2C1_GMUX_0001 IOMUX_MAKE_VALUE(0x28, 4, 4, 0x01)
154#define I2C1_GMUX_0011 IOMUX_MAKE_VALUE(0x28, 4, 4, 0x03)
155#define I2C2_GMUX_0001 IOMUX_MAKE_VALUE(0x28, 8, 4, 0x01)
156#define I2C2_GMUX_0010 IOMUX_MAKE_VALUE(0x28, 8, 4, 0x02)
157#define I2C2_GMUX_0011 IOMUX_MAKE_VALUE(0x28, 8, 4, 0x03)
158#define SPI1_GMUX_0001 IOMUX_MAKE_VALUE(0x28, 16, 4, 0x01)
159#define SPI2_GMUX_0001 IOMUX_MAKE_VALUE(0x28, 20, 4, 0x01)
170#define CAN1_GMUX_0010 IOMUX_MAKE_VALUE(0x2C, 0, 4, 0x02)
171#define CAN2_GMUX_0001 IOMUX_MAKE_VALUE(0x2C, 4, 4, 0x01)
172#define SDIO1_GMUX_0100 IOMUX_MAKE_VALUE(0x2C, 8, 4, 0x04)
173#define SDIO1_GMUX_0101 IOMUX_MAKE_VALUE(0x2C, 8, 4, 0x05)
174#define SDIO1_GMUX_0110 IOMUX_MAKE_VALUE(0x2C, 8, 4, 0x06)
175#define SDIO1_GMUX_0111 IOMUX_MAKE_VALUE(0x2C, 8, 4, 0x07)
176#define USART1_GMUX_0001 IOMUX_MAKE_VALUE(0x2C, 16, 4, 0x01)
177#define USART3_GMUX_0001 IOMUX_MAKE_VALUE(0x2C, 24, 4, 0x01)
178#define UART4_GMUX_0001 IOMUX_MAKE_VALUE(0x2C, 28, 4, 0x01)
189#define EXT_SPIM_GMUX_1000 IOMUX_MAKE_VALUE(0x30, 0, 4, 0x08)
190#define EXT_SPIM_GMUX_1001 IOMUX_MAKE_VALUE(0x30, 0, 4, 0x09)
191#define ADC1_ETP_GMUX IOMUX_MAKE_VALUE(0x30, 4, 1, 0x01)
192#define ADC1_ETO_GMUX IOMUX_MAKE_VALUE(0x30, 5, 1, 0x01)
193#define ADC2_ETP_GMUX IOMUX_MAKE_VALUE(0x30, 8, 1, 0x01)
194#define ADC2_ETO_GMUX IOMUX_MAKE_VALUE(0x30, 9, 1, 0x01)
195#define SWJTAG_GMUX_001 IOMUX_MAKE_VALUE(0x30, 16, 3, 0x01)
196#define SWJTAG_GMUX_010 IOMUX_MAKE_VALUE(0x30, 16, 3, 0x02)
197#define SWJTAG_GMUX_100 IOMUX_MAKE_VALUE(0x30, 16, 3, 0x04)
198#define PD01_GMUX IOMUX_MAKE_VALUE(0x30, 20, 1, 0x01)
211typedef enum
212{
213 GPIO_MODE_INPUT = 0x00,
214 GPIO_MODE_OUTPUT = 0x10,
215 GPIO_MODE_MUX = 0x08,
216 GPIO_MODE_ANALOG = 0x03
217} gpio_mode_type;
218
222typedef enum
223{
224 GPIO_DRIVE_STRENGTH_STRONGER = 0x01,
225 GPIO_DRIVE_STRENGTH_MODERATE = 0x02,
226 GPIO_DRIVE_STRENGTH_MAXIMUM = 0x03
227} gpio_drive_type;
228
232typedef enum
233{
234 GPIO_OUTPUT_PUSH_PULL = 0x00,
235 GPIO_OUTPUT_OPEN_DRAIN = 0x04
236} gpio_output_type;
237
241typedef enum
242{
243 GPIO_PULL_NONE = 0x0004,
244 GPIO_PULL_UP = 0x0018,
245 GPIO_PULL_DOWN = 0x0028
246} gpio_pull_type;
247
251typedef enum
252{
253 GPIO_PINS_SOURCE0 = 0x00,
254 GPIO_PINS_SOURCE1 = 0x01,
255 GPIO_PINS_SOURCE2 = 0x02,
256 GPIO_PINS_SOURCE3 = 0x03,
257 GPIO_PINS_SOURCE4 = 0x04,
258 GPIO_PINS_SOURCE5 = 0x05,
259 GPIO_PINS_SOURCE6 = 0x06,
260 GPIO_PINS_SOURCE7 = 0x07,
261 GPIO_PINS_SOURCE8 = 0x08,
262 GPIO_PINS_SOURCE9 = 0x09,
263 GPIO_PINS_SOURCE10 = 0x0A,
264 GPIO_PINS_SOURCE11 = 0x0B,
265 GPIO_PINS_SOURCE12 = 0x0C,
266 GPIO_PINS_SOURCE13 = 0x0D,
267 GPIO_PINS_SOURCE14 = 0x0E,
268 GPIO_PINS_SOURCE15 = 0x0F
269} gpio_pins_source_type;
270
274typedef enum
275{
276 GPIO_PORT_SOURCE_GPIOA = 0x00,
277 GPIO_PORT_SOURCE_GPIOB = 0x01,
278 GPIO_PORT_SOURCE_GPIOC = 0x02,
279 GPIO_PORT_SOURCE_GPIOD = 0x03,
280 GPIO_PORT_SOURCE_GPIOF = 0x05,
281} gpio_port_source_type;
282
286typedef struct
287{
288 uint32_t gpio_pins;
289 gpio_output_type gpio_out_type;
290 gpio_pull_type gpio_pull;
291 gpio_mode_type gpio_mode;
292 gpio_drive_type gpio_drive_strength;
293} gpio_init_type;
294
298typedef struct
299{
303 union
304 {
305 __IO uint32_t cfglr;
306 struct
307 {
308 __IO uint32_t iomc0 : 2; /* [1:0] */
309 __IO uint32_t iofc0 : 2; /* [3:2] */
310 __IO uint32_t iomc1 : 2; /* [5:4] */
311 __IO uint32_t iofc1 : 2; /* [7:6] */
312 __IO uint32_t iomc2 : 2; /* [9:8] */
313 __IO uint32_t iofc2 : 2; /* [11:10] */
314 __IO uint32_t iomc3 : 2; /* [13:12] */
315 __IO uint32_t iofc3 : 2; /* [15:14] */
316 __IO uint32_t iomc4 : 2; /* [17:16] */
317 __IO uint32_t iofc4 : 2; /* [19:18] */
318 __IO uint32_t iomc5 : 2; /* [21:20] */
319 __IO uint32_t iofc5 : 2; /* [23:22] */
320 __IO uint32_t iomc6 : 2; /* [25:24] */
321 __IO uint32_t iofc6 : 2; /* [27:26] */
322 __IO uint32_t iomc7 : 2; /* [29:28] */
323 __IO uint32_t iofc7 : 2; /* [31:30] */
324 } cfglr_bit;
325 };
326
330 union
331 {
332 __IO uint32_t cfghr;
333 struct
334 {
335 __IO uint32_t iomc8 : 2; /* [1:0] */
336 __IO uint32_t iofc8 : 2; /* [3:2] */
337 __IO uint32_t iomc9 : 2; /* [5:4] */
338 __IO uint32_t iofc9 : 2; /* [7:6] */
339 __IO uint32_t iomc10 : 2; /* [9:8] */
340 __IO uint32_t iofc10 : 2; /* [11:10] */
341 __IO uint32_t iomc11 : 2; /* [13:12] */
342 __IO uint32_t iofc11 : 2; /* [15:14] */
343 __IO uint32_t iomc12 : 2; /* [17:16] */
344 __IO uint32_t iofc12 : 2; /* [19:18] */
345 __IO uint32_t iomc13 : 2; /* [21:20] */
346 __IO uint32_t iofc13 : 2; /* [23:22] */
347 __IO uint32_t iomc14 : 2; /* [25:24] */
348 __IO uint32_t iofc14 : 2; /* [27:26] */
349 __IO uint32_t iomc15 : 2; /* [29:28] */
350 __IO uint32_t iofc15 : 2; /* [31:30] */
351 } cfghr_bit;
352 };
353
357 union
358 {
359 __IO uint32_t idt;
360 struct
361 {
362 __IO uint32_t idt0 : 1; /* [0] */
363 __IO uint32_t idt1 : 1; /* [1] */
364 __IO uint32_t idt2 : 1; /* [2] */
365 __IO uint32_t idt3 : 1; /* [3] */
366 __IO uint32_t idt4 : 1; /* [4] */
367 __IO uint32_t idt5 : 1; /* [5] */
368 __IO uint32_t idt6 : 1; /* [6] */
369 __IO uint32_t idt7 : 1; /* [7] */
370 __IO uint32_t idt8 : 1; /* [8] */
371 __IO uint32_t idt9 : 1; /* [9] */
372 __IO uint32_t idt10 : 1; /* [10] */
373 __IO uint32_t idt11 : 1; /* [11] */
374 __IO uint32_t idt12 : 1; /* [12] */
375 __IO uint32_t idt13 : 1; /* [13] */
376 __IO uint32_t idt14 : 1; /* [14] */
377 __IO uint32_t idt15 : 1; /* [15] */
378 __IO uint32_t reserved1 : 16;/* [31:16] */
379 } idt_bit;
380 };
381
385 union
386 {
387 __IO uint32_t odt;
388 struct
389 {
390 __IO uint32_t odt0 : 1; /* [0] */
391 __IO uint32_t odt1 : 1; /* [1] */
392 __IO uint32_t odt2 : 1; /* [2] */
393 __IO uint32_t odt3 : 1; /* [3] */
394 __IO uint32_t odt4 : 1; /* [4] */
395 __IO uint32_t odt5 : 1; /* [5] */
396 __IO uint32_t odt6 : 1; /* [6] */
397 __IO uint32_t odt7 : 1; /* [7] */
398 __IO uint32_t odt8 : 1; /* [8] */
399 __IO uint32_t odt9 : 1; /* [9] */
400 __IO uint32_t odt10 : 1; /* [10] */
401 __IO uint32_t odt11 : 1; /* [11] */
402 __IO uint32_t odt12 : 1; /* [12] */
403 __IO uint32_t odt13 : 1; /* [13] */
404 __IO uint32_t odt14 : 1; /* [14] */
405 __IO uint32_t odt15 : 1; /* [15] */
406 __IO uint32_t reserved1 : 16;/* [31:16] */
407 } odt_bit;
408 };
409
413 union
414 {
415 __IO uint32_t scr;
416 struct
417 {
418 __IO uint32_t iosb0 : 1; /* [0] */
419 __IO uint32_t iosb1 : 1; /* [1] */
420 __IO uint32_t iosb2 : 1; /* [2] */
421 __IO uint32_t iosb3 : 1; /* [3] */
422 __IO uint32_t iosb4 : 1; /* [4] */
423 __IO uint32_t iosb5 : 1; /* [5] */
424 __IO uint32_t iosb6 : 1; /* [6] */
425 __IO uint32_t iosb7 : 1; /* [7] */
426 __IO uint32_t iosb8 : 1; /* [8] */
427 __IO uint32_t iosb9 : 1; /* [9] */
428 __IO uint32_t iosb10 : 1; /* [10] */
429 __IO uint32_t iosb11 : 1; /* [11] */
430 __IO uint32_t iosb12 : 1; /* [12] */
431 __IO uint32_t iosb13 : 1; /* [13] */
432 __IO uint32_t iosb14 : 1; /* [14] */
433 __IO uint32_t iosb15 : 1; /* [15] */
434 __IO uint32_t iocb0 : 1; /* [16] */
435 __IO uint32_t iocb1 : 1; /* [17] */
436 __IO uint32_t iocb2 : 1; /* [18] */
437 __IO uint32_t iocb3 : 1; /* [19] */
438 __IO uint32_t iocb4 : 1; /* [20] */
439 __IO uint32_t iocb5 : 1; /* [21] */
440 __IO uint32_t iocb6 : 1; /* [22] */
441 __IO uint32_t iocb7 : 1; /* [23] */
442 __IO uint32_t iocb8 : 1; /* [24] */
443 __IO uint32_t iocb9 : 1; /* [25] */
444 __IO uint32_t iocb10 : 1; /* [26] */
445 __IO uint32_t iocb11 : 1; /* [27] */
446 __IO uint32_t iocb12 : 1; /* [28] */
447 __IO uint32_t iocb13 : 1; /* [29] */
448 __IO uint32_t iocb14 : 1; /* [30] */
449 __IO uint32_t iocb15 : 1; /* [31] */
450 } scr_bit;
451 };
452
456 union
457 {
458 __IO uint32_t clr;
459 struct
460 {
461 __IO uint32_t iocb0 : 1; /* [0] */
462 __IO uint32_t iocb1 : 1; /* [1] */
463 __IO uint32_t iocb2 : 1; /* [2] */
464 __IO uint32_t iocb3 : 1; /* [3] */
465 __IO uint32_t iocb4 : 1; /* [4] */
466 __IO uint32_t iocb5 : 1; /* [5] */
467 __IO uint32_t iocb6 : 1; /* [6] */
468 __IO uint32_t iocb7 : 1; /* [7] */
469 __IO uint32_t iocb8 : 1; /* [8] */
470 __IO uint32_t iocb9 : 1; /* [9] */
471 __IO uint32_t iocb10 : 1; /* [10] */
472 __IO uint32_t iocb11 : 1; /* [11] */
473 __IO uint32_t iocb12 : 1; /* [12] */
474 __IO uint32_t iocb13 : 1; /* [13] */
475 __IO uint32_t iocb14 : 1; /* [14] */
476 __IO uint32_t iocb15 : 1; /* [15] */
477 __IO uint32_t reserved1 : 16;/* [31:16] */
478 } clr_bit;
479 };
480
484 union
485 {
486 __IO uint32_t wpr;
487 struct
488 {
489 __IO uint32_t wpen0 : 1; /* [0] */
490 __IO uint32_t wpen1 : 1; /* [1] */
491 __IO uint32_t wpen2 : 1; /* [2] */
492 __IO uint32_t wpen3 : 1; /* [3] */
493 __IO uint32_t wpen4 : 1; /* [4] */
494 __IO uint32_t wpen5 : 1; /* [5] */
495 __IO uint32_t wpen6 : 1; /* [6] */
496 __IO uint32_t wpen7 : 1; /* [7] */
497 __IO uint32_t wpen8 : 1; /* [8] */
498 __IO uint32_t wpen9 : 1; /* [9] */
499 __IO uint32_t wpen10 : 1; /* [10] */
500 __IO uint32_t wpen11 : 1; /* [11] */
501 __IO uint32_t wpen12 : 1; /* [12] */
502 __IO uint32_t wpen13 : 1; /* [13] */
503 __IO uint32_t wpen14 : 1; /* [14] */
504 __IO uint32_t wpen15 : 1; /* [15] */
505 __IO uint32_t wpseq : 1; /* [16] */
506 __IO uint32_t reserved1 : 15;/* [31:17] */
507 } wpr_bit;
508 };
509
510} gpio_type;
511
515typedef struct
516{
520 union
521 {
522 __IO uint32_t evtout;
523 struct
524 {
525 __IO uint32_t selpin : 4; /* [3:0] */
526 __IO uint32_t selport : 3; /* [6:4] */
527 __IO uint32_t evoen : 1; /* [7] */
528 __IO uint32_t reserved1 : 24;/* [31:8] */
529 } evtout_bit;
530 };
531
535 union
536 {
537 __IO uint32_t remap;
538 struct
539 {
540 __IO uint32_t spi1_mux_l : 1; /* [0] */
541 __IO uint32_t i2c1_mux : 1; /* [1] */
542 __IO uint32_t usart1_mux : 1; /* [2] */
543 __IO uint32_t reserved1 : 1; /* [3] */
544 __IO uint32_t usart3_mux : 2; /* [5:4] */
545 __IO uint32_t tmr1_mux : 2; /* [7:6] */
546 __IO uint32_t tmr2_mux : 2; /* [9:8] */
547 __IO uint32_t tmr3_mux : 2; /* [11:10] */
548 __IO uint32_t reserved2 : 1; /* [12] */
549 __IO uint32_t can_mux : 2; /* [14:13] */
550 __IO uint32_t pd01_mux : 1; /* [15] */
551 __IO uint32_t tmr5ch4_mux : 1; /* [16] */
552 __IO uint32_t adc1_extrgpre_mux : 1; /* [17] */
553 __IO uint32_t adc1_extrgord_mux : 1; /* [18] */
554 __IO uint32_t adc2_extrgpre_mux : 1; /* [19] */
555 __IO uint32_t adc2_extrgord_mux : 1; /* [20] */
556 __IO uint32_t reserved3 : 3; /* [23:21] */
557 __IO uint32_t swjtag_conf : 3; /* [26:24] */
558 __IO uint32_t reserved4 : 4; /* [30:27] */
559 __IO uint32_t spi1_mux_h : 1; /* [31] */
560 } remap_bit;
561 };
562
566 union
567 {
568 __IO uint32_t exintc1;
569 struct
570 {
571 __IO uint32_t exint0 : 4; /* [3:0] */
572 __IO uint32_t exint1 : 4; /* [7:4] */
573 __IO uint32_t exint2 : 4; /* [11:8] */
574 __IO uint32_t exint3 : 4; /* [15:12] */
575 __IO uint32_t reserved1 : 16;/* [31:16] */
576 } exintc1_bit;
577 };
578
582 union
583 {
584 __IO uint32_t exintc2;
585 struct
586 {
587 __IO uint32_t exint4 : 4; /* [3:0] */
588 __IO uint32_t exint5 : 4; /* [7:4] */
589 __IO uint32_t exint6 : 4; /* [11:8] */
590 __IO uint32_t exint7 : 4; /* [15:12] */
591 __IO uint32_t reserved1 : 16;/* [31:16] */
592 } exintc2_bit;
593 };
594
598 union
599 {
600 __IO uint32_t exintc3;
601 struct
602 {
603 __IO uint32_t exint8 : 4; /* [3:0] */
604 __IO uint32_t exint9 : 4; /* [7:4] */
605 __IO uint32_t exint10 : 4; /* [11:8] */
606 __IO uint32_t exint11 : 4; /* [15:12] */
607 __IO uint32_t reserved1 : 16;/* [31:16] */
608 } exintc3_bit;
609 };
610
614 union
615 {
616 __IO uint32_t exintc4;
617 struct
618 {
619 __IO uint32_t exint12 : 4; /* [3:0] */
620 __IO uint32_t exint13 : 4; /* [7:4] */
621 __IO uint32_t exint14 : 4; /* [11:8] */
622 __IO uint32_t exint15 : 4; /* [15:12] */
623 __IO uint32_t reserved1 : 16;/* [31:16] */
624 } exintc4_bit;
625 };
626
630 __IO uint32_t reserved1;
631
635 union
636 {
637 __IO uint32_t remap2;
638 struct
639 {
640 __IO uint32_t reserved1 : 21;/* [20:0] */
641 __IO uint32_t ext_spim_en_mux : 1; /* [21] */
642 __IO uint32_t reserved2 : 10;/* [31:22] */
643 } remap2_bit;
644 };
645
649 union
650 {
651 __IO uint32_t remap3;
652 struct
653 {
654 __IO uint32_t tmr9_gmux : 4; /* [3:0] */
655 __IO uint32_t tmr10_gmux : 4; /* [7:4] */
656 __IO uint32_t tmr11_gmux : 4; /* [11:8] */
657 __IO uint32_t reserved1 : 20;/* [31:12] */
658 } remap3_bit;
659 };
660
664 union
665 {
666 __IO uint32_t remap4;
667 struct
668 {
669 __IO uint32_t tmr1_gmux : 4; /* [3:0] */
670 __IO uint32_t tmr2_gmux : 3; /* [6:4] */
671 __IO uint32_t tmr2itr1_gmux : 1; /* [7] */
672 __IO uint32_t tmr3_gmux : 4; /* [11:8] */
673 __IO uint32_t reserved1 : 4; /* [15:12] */
674 __IO uint32_t tmr5_gmux : 3; /* [18:16] */
675 __IO uint32_t tmr5ch4_gmux : 1; /* [19] */
676 __IO uint32_t reserved2 : 12;/* [31:20] */
677 } remap4_bit;
678 };
679
683 union
684 {
685 __IO uint32_t remap5;
686 struct
687 {
688 __IO uint32_t reserved1 : 4; /* [3:0] */
689 __IO uint32_t i2c1_gmux : 4; /* [7:4] */
690 __IO uint32_t i2c2_gmux : 4; /* [11:8] */
691 __IO uint32_t reserved2 : 4; /* [15:12] */
692 __IO uint32_t spi1_gmux : 4; /* [19:16] */
693 __IO uint32_t spi2_gmux : 4; /* [23:20] */
694 __IO uint32_t reserved3 : 8; /* [31:24] */
695 } remap5_bit;
696 };
697
701 union
702 {
703 __IO uint32_t remap6;
704 struct
705 {
706 __IO uint32_t can1_gmux : 4; /* [3:0] */
707 __IO uint32_t can2_gmux : 4; /* [7:4] */
708 __IO uint32_t sdio1_gmux : 4; /* [11:8] */
709 __IO uint32_t reserved1 : 4; /* [15:12] */
710 __IO uint32_t usart1_gmux : 4; /* [19:16] */
711 __IO uint32_t reserved2 : 4; /* [23:20] */
712 __IO uint32_t usart3_gmux : 4; /* [27:24] */
713 __IO uint32_t uart4_gmux : 4; /* [31:28] */
714 } remap6_bit;
715 };
716
720 union
721 {
722 __IO uint32_t remap7;
723 struct
724 {
725 __IO uint32_t ext_spim_gmux : 3; /* [2:0] */
726 __IO uint32_t ext_spim_gen : 1; /* [3] */
727 __IO uint32_t adc1_etp_gmux : 1; /* [4] */
728 __IO uint32_t adc1_eto_gmux : 1; /* [5] */
729 __IO uint32_t reserved1 : 2; /* [7:6] */
730 __IO uint32_t adc2_etp_gmux : 1; /* [8] */
731 __IO uint32_t adc2_eto_gmux : 1; /* [9] */
732 __IO uint32_t reserved2 : 6; /* [15:10] */
733 __IO uint32_t swjtag_gmux : 3; /* [18:16] */
734 __IO uint32_t reserved3 : 1; /* [19] */
735 __IO uint32_t pd01_gmux : 1; /* [20] */
736 __IO uint32_t reserved4 : 11;/* [31:21] */
737
738 } remap7_bit;
739 };
740
741} iomux_type;
742
747#define GPIOA ((gpio_type *) GPIOA_BASE)
748#define GPIOB ((gpio_type *) GPIOB_BASE)
749#define GPIOC ((gpio_type *) GPIOC_BASE)
750#define GPIOD ((gpio_type *) GPIOD_BASE)
751#define GPIOF ((gpio_type *) GPIOF_BASE)
752#define IOMUX ((iomux_type *) IOMUX_BASE)
753
758void gpio_reset(gpio_type *gpio_x);
759void gpio_iomux_reset(void);
760void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct);
761void gpio_default_para_init(gpio_init_type *gpio_init_struct);
762 flag_status gpio_input_data_bit_read(gpio_type *gpio_x, uint16_t pins);
763uint16_t gpio_input_data_read(gpio_type *gpio_x);
764 flag_status gpio_output_data_bit_read(gpio_type *gpio_x, uint16_t pins);
765uint16_t gpio_output_data_read(gpio_type *gpio_x);
766void gpio_bits_set(gpio_type *gpio_x, uint16_t pins);
767void gpio_bits_reset(gpio_type *gpio_x, uint16_t pins);
768void gpio_bits_toggle(gpio_type *gpio_x, uint16_t pins);
769void gpio_bits_write(gpio_type *gpio_x, uint16_t pins, confirm_state bit_state);
770void gpio_port_write(gpio_type *gpio_x, uint16_t port_value);
771void gpio_pin_wp_config(gpio_type *gpio_x, uint16_t pins);
772void gpio_event_output_config(gpio_port_source_type gpio_port_source, gpio_pins_source_type gpio_pin_source);
773void gpio_event_output_enable(confirm_state new_state);
774void gpio_pin_remap_config(uint32_t gpio_remap, confirm_state new_state);
775void gpio_exint_line_config(gpio_port_source_type gpio_port_source, gpio_pins_source_type gpio_pin_source);
776
789#ifdef __cplusplus
790}
791#endif
792
793#endif
at32f413.h
at32f413 header file
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
flag_status
flag_status
flag status
Definition at32f413.h:292
gpio_iomux_reset
void gpio_iomux_reset(void)
reset the mux functions (remap, event control and exint configuration) registers to their default val...
Definition at32f413_gpio.c:85
gpio_output_data_read
uint16_t gpio_output_data_read(gpio_type *gpio_x)
read the specified gpio ouput data port.
Definition at32f413_gpio.c:278
gpio_event_output_config
void gpio_event_output_config(gpio_port_source_type gpio_port_source, gpio_pins_source_type gpio_pin_source)
select the gpio pin used as event output.
Definition at32f413_gpio.c:503
gpio_output_data_bit_read
flag_status gpio_output_data_bit_read(gpio_type *gpio_x, uint16_t pins)
read the specified output port pin.
Definition at32f413_gpio.c:255
gpio_bits_write
void gpio_bits_write(gpio_type *gpio_x, uint16_t pins, confirm_state bit_state)
set or clear the selected data port bit.
Definition at32f413_gpio.c:405
gpio_event_output_enable
void gpio_event_output_enable(confirm_state new_state)
enable or disable the event output.
Definition at32f413_gpio.c:522
gpio_bits_reset
void gpio_bits_reset(gpio_type *gpio_x, uint16_t pins)
clear the selected data port bits.
Definition at32f413_gpio.c:340
gpio_input_data_read
uint16_t gpio_input_data_read(gpio_type *gpio_x)
read the specified gpio input data port.
Definition at32f413_gpio.c:225
gpio_pin_wp_config
void gpio_pin_wp_config(gpio_type *gpio_x, uint16_t pins)
write protect gpio pins configuration registers.
Definition at32f413_gpio.c:456
gpio_port_write
void gpio_port_write(gpio_type *gpio_x, uint16_t port_value)
write data to the specified gpio data port.
Definition at32f413_gpio.c:425
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_bits_toggle
void gpio_bits_toggle(gpio_type *gpio_x, uint16_t pins)
toggle the selected data port bits.
Definition at32f413_gpio.c:371
gpio_pin_remap_config
void gpio_pin_remap_config(uint32_t gpio_remap, confirm_state new_state)
iomux remap and debug i/o configuration.
Definition at32f413_gpio.c:549
gpio_input_data_bit_read
flag_status gpio_input_data_bit_read(gpio_type *gpio_x, uint16_t pins)
read the specified input port pin.
Definition at32f413_gpio.c:202
gpio_bits_set
void gpio_bits_set(gpio_type *gpio_x, uint16_t pins)
set the selected data port bits.
Definition at32f413_gpio.c:309
gpio_exint_line_config
void gpio_exint_line_config(gpio_port_source_type gpio_port_source, gpio_pins_source_type gpio_pin_source)
select the gpio pin used as exint line.
Definition at32f413_gpio.c:605
gpio_reset
void gpio_reset(gpio_type *gpio_x)
reset the gpio register
Definition at32f413_gpio.c:50
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
gpio_mode_type
gpio_mode_type
gpio mode select
Definition at32f413_gpio.h:212
gpio_drive_type
gpio_drive_type
gpio output drive strength select
Definition at32f413_gpio.h:223
gpio_pins_source_type
gpio_pins_source_type
gpio pins source type
Definition at32f413_gpio.h:252
gpio_port_source_type
gpio_port_source_type
gpio port source type
Definition at32f413_gpio.h:275
gpio_pull_type
gpio_pull_type
gpio pull type
Definition at32f413_gpio.h:242
gpio_output_type
gpio_output_type
gpio output type
Definition at32f413_gpio.h:233
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_MODE_ANALOG
@ GPIO_MODE_ANALOG
Definition at32f413_gpio.h:216
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_MODE_OUTPUT
@ GPIO_MODE_OUTPUT
Definition at32f413_gpio.h:214
GPIO_DRIVE_STRENGTH_MAXIMUM
@ GPIO_DRIVE_STRENGTH_MAXIMUM
Definition at32f413_gpio.h:226
GPIO_DRIVE_STRENGTH_MODERATE
@ GPIO_DRIVE_STRENGTH_MODERATE
Definition at32f413_gpio.h:225
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PINS_SOURCE3
@ GPIO_PINS_SOURCE3
Definition at32f413_gpio.h:256
GPIO_PINS_SOURCE1
@ GPIO_PINS_SOURCE1
Definition at32f413_gpio.h:254
GPIO_PINS_SOURCE7
@ GPIO_PINS_SOURCE7
Definition at32f413_gpio.h:260
GPIO_PINS_SOURCE12
@ GPIO_PINS_SOURCE12
Definition at32f413_gpio.h:265
GPIO_PINS_SOURCE13
@ GPIO_PINS_SOURCE13
Definition at32f413_gpio.h:266
GPIO_PINS_SOURCE6
@ GPIO_PINS_SOURCE6
Definition at32f413_gpio.h:259
GPIO_PINS_SOURCE0
@ GPIO_PINS_SOURCE0
Definition at32f413_gpio.h:253
GPIO_PINS_SOURCE2
@ GPIO_PINS_SOURCE2
Definition at32f413_gpio.h:255
GPIO_PINS_SOURCE10
@ GPIO_PINS_SOURCE10
Definition at32f413_gpio.h:263
GPIO_PINS_SOURCE9
@ GPIO_PINS_SOURCE9
Definition at32f413_gpio.h:262
GPIO_PINS_SOURCE4
@ GPIO_PINS_SOURCE4
Definition at32f413_gpio.h:257
GPIO_PINS_SOURCE11
@ GPIO_PINS_SOURCE11
Definition at32f413_gpio.h:264
GPIO_PINS_SOURCE15
@ GPIO_PINS_SOURCE15
Definition at32f413_gpio.h:268
GPIO_PINS_SOURCE14
@ GPIO_PINS_SOURCE14
Definition at32f413_gpio.h:267
GPIO_PINS_SOURCE5
@ GPIO_PINS_SOURCE5
Definition at32f413_gpio.h:258
GPIO_PINS_SOURCE8
@ GPIO_PINS_SOURCE8
Definition at32f413_gpio.h:261
GPIO_PORT_SOURCE_GPIOF
@ GPIO_PORT_SOURCE_GPIOF
Definition at32f413_gpio.h:280
GPIO_PORT_SOURCE_GPIOA
@ GPIO_PORT_SOURCE_GPIOA
Definition at32f413_gpio.h:276
GPIO_PORT_SOURCE_GPIOB
@ GPIO_PORT_SOURCE_GPIOB
Definition at32f413_gpio.h:277
GPIO_PORT_SOURCE_GPIOD
@ GPIO_PORT_SOURCE_GPIOD
Definition at32f413_gpio.h:279
GPIO_PORT_SOURCE_GPIOC
@ GPIO_PORT_SOURCE_GPIOC
Definition at32f413_gpio.h:278
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_PULL_DOWN
@ GPIO_PULL_DOWN
Definition at32f413_gpio.h:245
GPIO_PULL_UP
@ GPIO_PULL_UP
Definition at32f413_gpio.h:244
GPIO_OUTPUT_OPEN_DRAIN
@ GPIO_OUTPUT_OPEN_DRAIN
Definition at32f413_gpio.h:235
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
gpio_type
type define gpio register all
Definition at32f413_gpio.h:299
gpio_type::iocb9
__IO uint32_t iocb9
Definition at32f413_gpio.h:443
gpio_type::idt4
__IO uint32_t idt4
Definition at32f413_gpio.h:366
gpio_type::iocb4
__IO uint32_t iocb4
Definition at32f413_gpio.h:438
gpio_type::iocb6
__IO uint32_t iocb6
Definition at32f413_gpio.h:440
gpio_type::iomc13
__IO uint32_t iomc13
Definition at32f413_gpio.h:345
gpio_type::odt11
__IO uint32_t odt11
Definition at32f413_gpio.h:401
gpio_type::iocb7
__IO uint32_t iocb7
Definition at32f413_gpio.h:441
gpio_type::idt3
__IO uint32_t idt3
Definition at32f413_gpio.h:365
gpio_type::idt7
__IO uint32_t idt7
Definition at32f413_gpio.h:369
gpio_type::iosb12
__IO uint32_t iosb12
Definition at32f413_gpio.h:430
gpio_type::iomc5
__IO uint32_t iomc5
Definition at32f413_gpio.h:318
gpio_type::iofc13
__IO uint32_t iofc13
Definition at32f413_gpio.h:346
gpio_type::iosb4
__IO uint32_t iosb4
Definition at32f413_gpio.h:422
gpio_type::idt1
__IO uint32_t idt1
Definition at32f413_gpio.h:363
gpio_type::idt14
__IO uint32_t idt14
Definition at32f413_gpio.h:376
gpio_type::idt6
__IO uint32_t idt6
Definition at32f413_gpio.h:368
gpio_type::iofc2
__IO uint32_t iofc2
Definition at32f413_gpio.h:313
gpio_type::scr
__IO uint32_t scr
Definition at32f413_gpio.h:415
gpio_type::odt6
__IO uint32_t odt6
Definition at32f413_gpio.h:396
gpio_type::odt
__IO uint32_t odt
Definition at32f413_gpio.h:387
gpio_type::wpen0
__IO uint32_t wpen0
Definition at32f413_gpio.h:489
gpio_type::wpen9
__IO uint32_t wpen9
Definition at32f413_gpio.h:498
gpio_type::iomc0
__IO uint32_t iomc0
Definition at32f413_gpio.h:308
gpio_type::odt5
__IO uint32_t odt5
Definition at32f413_gpio.h:395
gpio_type::reserved1
__IO uint32_t reserved1
Definition at32f413_gpio.h:378
gpio_type::odt2
__IO uint32_t odt2
Definition at32f413_gpio.h:392
gpio_type::iosb7
__IO uint32_t iosb7
Definition at32f413_gpio.h:425
gpio_type::iocb15
__IO uint32_t iocb15
Definition at32f413_gpio.h:449
gpio_type::idt12
__IO uint32_t idt12
Definition at32f413_gpio.h:374
gpio_type::idt9
__IO uint32_t idt9
Definition at32f413_gpio.h:371
gpio_type::iofc5
__IO uint32_t iofc5
Definition at32f413_gpio.h:319
gpio_type::odt14
__IO uint32_t odt14
Definition at32f413_gpio.h:404
gpio_type::iomc6
__IO uint32_t iomc6
Definition at32f413_gpio.h:320
gpio_type::wpen14
__IO uint32_t wpen14
Definition at32f413_gpio.h:503
gpio_type::idt8
__IO uint32_t idt8
Definition at32f413_gpio.h:370
gpio_type::clr
__IO uint32_t clr
Definition at32f413_gpio.h:458
gpio_type::iosb9
__IO uint32_t iosb9
Definition at32f413_gpio.h:427
gpio_type::iomc2
__IO uint32_t iomc2
Definition at32f413_gpio.h:312
gpio_type::iocb14
__IO uint32_t iocb14
Definition at32f413_gpio.h:448
gpio_type::iofc3
__IO uint32_t iofc3
Definition at32f413_gpio.h:315
gpio_type::iosb2
__IO uint32_t iosb2
Definition at32f413_gpio.h:420
gpio_type::wpen8
__IO uint32_t wpen8
Definition at32f413_gpio.h:497
gpio_type::wpen1
__IO uint32_t wpen1
Definition at32f413_gpio.h:490
gpio_type::iocb13
__IO uint32_t iocb13
Definition at32f413_gpio.h:447
gpio_type::wpen13
__IO uint32_t wpen13
Definition at32f413_gpio.h:502
gpio_type::iofc14
__IO uint32_t iofc14
Definition at32f413_gpio.h:348
gpio_type::odt15
__IO uint32_t odt15
Definition at32f413_gpio.h:405
gpio_type::iocb12
__IO uint32_t iocb12
Definition at32f413_gpio.h:446
gpio_type::iocb3
__IO uint32_t iocb3
Definition at32f413_gpio.h:437
gpio_type::iosb13
__IO uint32_t iosb13
Definition at32f413_gpio.h:431
gpio_type::odt3
__IO uint32_t odt3
Definition at32f413_gpio.h:393
gpio_type::odt9
__IO uint32_t odt9
Definition at32f413_gpio.h:399
gpio_type::iofc11
__IO uint32_t iofc11
Definition at32f413_gpio.h:342
gpio_type::idt5
__IO uint32_t idt5
Definition at32f413_gpio.h:367
gpio_type::iosb5
__IO uint32_t iosb5
Definition at32f413_gpio.h:423
gpio_type::iosb14
__IO uint32_t iosb14
Definition at32f413_gpio.h:432
gpio_type::iosb1
__IO uint32_t iosb1
Definition at32f413_gpio.h:419
gpio_type::iofc6
__IO uint32_t iofc6
Definition at32f413_gpio.h:321
gpio_type::odt12
__IO uint32_t odt12
Definition at32f413_gpio.h:402
gpio_type::wpen15
__IO uint32_t wpen15
Definition at32f413_gpio.h:504
gpio_type::iomc8
__IO uint32_t iomc8
Definition at32f413_gpio.h:335
gpio_type::wpseq
__IO uint32_t wpseq
Definition at32f413_gpio.h:505
gpio_type::idt10
__IO uint32_t idt10
Definition at32f413_gpio.h:372
gpio_type::wpen12
__IO uint32_t wpen12
Definition at32f413_gpio.h:501
gpio_type::iofc10
__IO uint32_t iofc10
Definition at32f413_gpio.h:340
gpio_type::iomc9
__IO uint32_t iomc9
Definition at32f413_gpio.h:337
gpio_type::iocb8
__IO uint32_t iocb8
Definition at32f413_gpio.h:442
gpio_type::iosb6
__IO uint32_t iosb6
Definition at32f413_gpio.h:424
gpio_type::iocb1
__IO uint32_t iocb1
Definition at32f413_gpio.h:435
gpio_type::iocb2
__IO uint32_t iocb2
Definition at32f413_gpio.h:436
gpio_type::wpen2
__IO uint32_t wpen2
Definition at32f413_gpio.h:491
gpio_type::iofc12
__IO uint32_t iofc12
Definition at32f413_gpio.h:344
gpio_type::iomc7
__IO uint32_t iomc7
Definition at32f413_gpio.h:322
gpio_type::idt13
__IO uint32_t idt13
Definition at32f413_gpio.h:375
gpio_type::odt13
__IO uint32_t odt13
Definition at32f413_gpio.h:403
gpio_type::iocb5
__IO uint32_t iocb5
Definition at32f413_gpio.h:439
gpio_type::odt7
__IO uint32_t odt7
Definition at32f413_gpio.h:397
gpio_type::odt4
__IO uint32_t odt4
Definition at32f413_gpio.h:394
gpio_type::iosb0
__IO uint32_t iosb0
Definition at32f413_gpio.h:418
gpio_type::wpen6
__IO uint32_t wpen6
Definition at32f413_gpio.h:495
gpio_type::cfghr
__IO uint32_t cfghr
Definition at32f413_gpio.h:332
gpio_type::iofc0
__IO uint32_t iofc0
Definition at32f413_gpio.h:309
gpio_type::wpen11
__IO uint32_t wpen11
Definition at32f413_gpio.h:500
gpio_type::wpen4
__IO uint32_t wpen4
Definition at32f413_gpio.h:493
gpio_type::wpen5
__IO uint32_t wpen5
Definition at32f413_gpio.h:494
gpio_type::idt11
__IO uint32_t idt11
Definition at32f413_gpio.h:373
gpio_type::idt2
__IO uint32_t idt2
Definition at32f413_gpio.h:364
gpio_type::odt1
__IO uint32_t odt1
Definition at32f413_gpio.h:391
gpio_type::cfglr
__IO uint32_t cfglr
Definition at32f413_gpio.h:305
gpio_type::wpen7
__IO uint32_t wpen7
Definition at32f413_gpio.h:496
gpio_type::iomc11
__IO uint32_t iomc11
Definition at32f413_gpio.h:341
gpio_type::iocb10
__IO uint32_t iocb10
Definition at32f413_gpio.h:444
gpio_type::iofc9
__IO uint32_t iofc9
Definition at32f413_gpio.h:338
gpio_type::iomc15
__IO uint32_t iomc15
Definition at32f413_gpio.h:349
gpio_type::iomc14
__IO uint32_t iomc14
Definition at32f413_gpio.h:347
gpio_type::iofc8
__IO uint32_t iofc8
Definition at32f413_gpio.h:336
gpio_type::iomc12
__IO uint32_t iomc12
Definition at32f413_gpio.h:343
gpio_type::iosb15
__IO uint32_t iosb15
Definition at32f413_gpio.h:433
gpio_type::odt10
__IO uint32_t odt10
Definition at32f413_gpio.h:400
gpio_type::iofc7
__IO uint32_t iofc7
Definition at32f413_gpio.h:323
gpio_type::iosb3
__IO uint32_t iosb3
Definition at32f413_gpio.h:421
gpio_type::odt0
__IO uint32_t odt0
Definition at32f413_gpio.h:390
gpio_type::wpen3
__IO uint32_t wpen3
Definition at32f413_gpio.h:492
gpio_type::idt15
__IO uint32_t idt15
Definition at32f413_gpio.h:377
gpio_type::idt
__IO uint32_t idt
Definition at32f413_gpio.h:359
gpio_type::odt8
__IO uint32_t odt8
Definition at32f413_gpio.h:398
gpio_type::iofc15
__IO uint32_t iofc15
Definition at32f413_gpio.h:350
gpio_type::iofc1
__IO uint32_t iofc1
Definition at32f413_gpio.h:311
gpio_type::idt0
__IO uint32_t idt0
Definition at32f413_gpio.h:362
gpio_type::wpr
__IO uint32_t wpr
Definition at32f413_gpio.h:486
gpio_type::iomc3
__IO uint32_t iomc3
Definition at32f413_gpio.h:314
gpio_type::iocb0
__IO uint32_t iocb0
Definition at32f413_gpio.h:434
gpio_type::iosb8
__IO uint32_t iosb8
Definition at32f413_gpio.h:426
gpio_type::iosb11
__IO uint32_t iosb11
Definition at32f413_gpio.h:429
gpio_type::iomc4
__IO uint32_t iomc4
Definition at32f413_gpio.h:316
gpio_type::iomc10
__IO uint32_t iomc10
Definition at32f413_gpio.h:339
gpio_type::iomc1
__IO uint32_t iomc1
Definition at32f413_gpio.h:310
gpio_type::iofc4
__IO uint32_t iofc4
Definition at32f413_gpio.h:317
gpio_type::wpen10
__IO uint32_t wpen10
Definition at32f413_gpio.h:499
gpio_type::iosb10
__IO uint32_t iosb10
Definition at32f413_gpio.h:428
gpio_type::iocb11
__IO uint32_t iocb11
Definition at32f413_gpio.h:445
iomux_type
type define iomux register all
Definition at32f413_gpio.h:516
iomux_type::adc1_etp_gmux
__IO uint32_t adc1_etp_gmux
Definition at32f413_gpio.h:727
iomux_type::exint1
__IO uint32_t exint1
Definition at32f413_gpio.h:572
iomux_type::remap
__IO uint32_t remap
Definition at32f413_gpio.h:537
iomux_type::tmr3_gmux
__IO uint32_t tmr3_gmux
Definition at32f413_gpio.h:672
iomux_type::reserved3
__IO uint32_t reserved3
Definition at32f413_gpio.h:556
iomux_type::exint9
__IO uint32_t exint9
Definition at32f413_gpio.h:604
iomux_type::remap2
__IO uint32_t remap2
Definition at32f413_gpio.h:637
iomux_type::tmr1_gmux
__IO uint32_t tmr1_gmux
Definition at32f413_gpio.h:669
iomux_type::tmr2_gmux
__IO uint32_t tmr2_gmux
Definition at32f413_gpio.h:670
iomux_type::adc2_eto_gmux
__IO uint32_t adc2_eto_gmux
Definition at32f413_gpio.h:731
iomux_type::exint15
__IO uint32_t exint15
Definition at32f413_gpio.h:622
iomux_type::can2_gmux
__IO uint32_t can2_gmux
Definition at32f413_gpio.h:707
iomux_type::remap6
__IO uint32_t remap6
Definition at32f413_gpio.h:703
iomux_type::exint13
__IO uint32_t exint13
Definition at32f413_gpio.h:620
iomux_type::usart1_gmux
__IO uint32_t usart1_gmux
Definition at32f413_gpio.h:710
iomux_type::remap5
__IO uint32_t remap5
Definition at32f413_gpio.h:685
iomux_type::uart4_gmux
__IO uint32_t uart4_gmux
Definition at32f413_gpio.h:713
iomux_type::ext_spim_en_mux
__IO uint32_t ext_spim_en_mux
Definition at32f413_gpio.h:641
iomux_type::exint10
__IO uint32_t exint10
Definition at32f413_gpio.h:605
iomux_type::tmr3_mux
__IO uint32_t tmr3_mux
Definition at32f413_gpio.h:547
iomux_type::tmr10_gmux
__IO uint32_t tmr10_gmux
Definition at32f413_gpio.h:655
iomux_type::adc2_extrgpre_mux
__IO uint32_t adc2_extrgpre_mux
Definition at32f413_gpio.h:554
iomux_type::reserved1
__IO uint32_t reserved1
iomux reserved1 register, offset:0x18
Definition at32f413_gpio.h:528
iomux_type::i2c1_mux
__IO uint32_t i2c1_mux
Definition at32f413_gpio.h:541
iomux_type::reserved2
__IO uint32_t reserved2
Definition at32f413_gpio.h:548
iomux_type::adc2_etp_gmux
__IO uint32_t adc2_etp_gmux
Definition at32f413_gpio.h:730
iomux_type::exint12
__IO uint32_t exint12
Definition at32f413_gpio.h:619
iomux_type::pd01_mux
__IO uint32_t pd01_mux
Definition at32f413_gpio.h:550
iomux_type::exint11
__IO uint32_t exint11
Definition at32f413_gpio.h:606
iomux_type::adc1_extrgpre_mux
__IO uint32_t adc1_extrgpre_mux
Definition at32f413_gpio.h:552
iomux_type::exint7
__IO uint32_t exint7
Definition at32f413_gpio.h:590
iomux_type::exint6
__IO uint32_t exint6
Definition at32f413_gpio.h:589
iomux_type::remap7
__IO uint32_t remap7
Definition at32f413_gpio.h:722
iomux_type::remap4
__IO uint32_t remap4
Definition at32f413_gpio.h:666
iomux_type::pd01_gmux
__IO uint32_t pd01_gmux
Definition at32f413_gpio.h:735
iomux_type::evoen
__IO uint32_t evoen
Definition at32f413_gpio.h:527
iomux_type::adc2_extrgord_mux
__IO uint32_t adc2_extrgord_mux
Definition at32f413_gpio.h:555
iomux_type::i2c2_gmux
__IO uint32_t i2c2_gmux
Definition at32f413_gpio.h:690
iomux_type::exint3
__IO uint32_t exint3
Definition at32f413_gpio.h:574
iomux_type::swjtag_conf
__IO uint32_t swjtag_conf
Definition at32f413_gpio.h:557
iomux_type::tmr1_mux
__IO uint32_t tmr1_mux
Definition at32f413_gpio.h:545
iomux_type::usart3_gmux
__IO uint32_t usart3_gmux
Definition at32f413_gpio.h:712
iomux_type::tmr11_gmux
__IO uint32_t tmr11_gmux
Definition at32f413_gpio.h:656
iomux_type::tmr9_gmux
__IO uint32_t tmr9_gmux
Definition at32f413_gpio.h:654
iomux_type::selpin
__IO uint32_t selpin
Definition at32f413_gpio.h:525
iomux_type::spi1_gmux
__IO uint32_t spi1_gmux
Definition at32f413_gpio.h:692
iomux_type::reserved4
__IO uint32_t reserved4
Definition at32f413_gpio.h:558
iomux_type::tmr2_mux
__IO uint32_t tmr2_mux
Definition at32f413_gpio.h:546
iomux_type::spi2_gmux
__IO uint32_t spi2_gmux
Definition at32f413_gpio.h:693
iomux_type::exint4
__IO uint32_t exint4
Definition at32f413_gpio.h:587
iomux_type::spi1_mux_h
__IO uint32_t spi1_mux_h
Definition at32f413_gpio.h:559
iomux_type::exint8
__IO uint32_t exint8
Definition at32f413_gpio.h:603
iomux_type::sdio1_gmux
__IO uint32_t sdio1_gmux
Definition at32f413_gpio.h:708
iomux_type::can1_gmux
__IO uint32_t can1_gmux
Definition at32f413_gpio.h:706
iomux_type::exintc4
__IO uint32_t exintc4
Definition at32f413_gpio.h:616
iomux_type::exint2
__IO uint32_t exint2
Definition at32f413_gpio.h:573
iomux_type::exint5
__IO uint32_t exint5
Definition at32f413_gpio.h:588
iomux_type::selport
__IO uint32_t selport
Definition at32f413_gpio.h:526
iomux_type::exint0
__IO uint32_t exint0
Definition at32f413_gpio.h:571
iomux_type::exint14
__IO uint32_t exint14
Definition at32f413_gpio.h:621
iomux_type::adc1_eto_gmux
__IO uint32_t adc1_eto_gmux
Definition at32f413_gpio.h:728
iomux_type::remap3
__IO uint32_t remap3
Definition at32f413_gpio.h:651
iomux_type::spi1_mux_l
__IO uint32_t spi1_mux_l
Definition at32f413_gpio.h:540
iomux_type::usart1_mux
__IO uint32_t usart1_mux
Definition at32f413_gpio.h:542
iomux_type::ext_spim_gen
__IO uint32_t ext_spim_gen
Definition at32f413_gpio.h:726
iomux_type::exintc3
__IO uint32_t exintc3
Definition at32f413_gpio.h:600
iomux_type::tmr5ch4_gmux
__IO uint32_t tmr5ch4_gmux
Definition at32f413_gpio.h:675
iomux_type::can_mux
__IO uint32_t can_mux
Definition at32f413_gpio.h:549
iomux_type::usart3_mux
__IO uint32_t usart3_mux
Definition at32f413_gpio.h:544
iomux_type::tmr5ch4_mux
__IO uint32_t tmr5ch4_mux
Definition at32f413_gpio.h:551
iomux_type::evtout
__IO uint32_t evtout
Definition at32f413_gpio.h:522
iomux_type::adc1_extrgord_mux
__IO uint32_t adc1_extrgord_mux
Definition at32f413_gpio.h:553
iomux_type::tmr5_gmux
__IO uint32_t tmr5_gmux
Definition at32f413_gpio.h:674
iomux_type::exintc2
__IO uint32_t exintc2
Definition at32f413_gpio.h:584
iomux_type::swjtag_gmux
__IO uint32_t swjtag_gmux
Definition at32f413_gpio.h:733
iomux_type::ext_spim_gmux
__IO uint32_t ext_spim_gmux
Definition at32f413_gpio.h:725
iomux_type::tmr2itr1_gmux
__IO uint32_t tmr2itr1_gmux
Definition at32f413_gpio.h:671
iomux_type::exintc1
__IO uint32_t exintc1
Definition at32f413_gpio.h:568
iomux_type::i2c1_gmux
__IO uint32_t i2c1_gmux
Definition at32f413_gpio.h:689


AT32F413 Firmwary Library: at32f413_i2c.c Source File

  • libraries
  • drivers
  • src
at32f413_i2c.c
Go to the documentation of this file.
1
26#include "at32f413_conf.h"
27
37#ifdef I2C_MODULE_ENABLED
38
50void i2c_reset(i2c_type *i2c_x)
51{
52 if(i2c_x == I2C1)
53 {
54 crm_periph_reset(CRM_I2C1_PERIPH_RESET, TRUE);
55 crm_periph_reset(CRM_I2C1_PERIPH_RESET, FALSE);
56 }
57 else if(i2c_x == I2C2)
58 {
59 crm_periph_reset(CRM_I2C2_PERIPH_RESET, TRUE);
60 crm_periph_reset(CRM_I2C2_PERIPH_RESET, FALSE);
61 }
62}
63
72void i2c_software_reset(i2c_type *i2c_x, confirm_state new_state)
73{
74 i2c_x->ctrl1_bit.reset = new_state;
75}
76
89void i2c_init(i2c_type *i2c_x, i2c_fsmode_duty_cycle_type duty, uint32_t speed)
90{
91 uint32_t apb_freq = 0;
92 uint16_t freq_mhz = 0, temp = 0;
93
94 crm_clocks_freq_type clocks;
95
96 /* disable i2c peripherals */
97 i2c_x->ctrl1_bit.i2cen = FALSE;
98
99 /* get system clock */
100 crm_clocks_freq_get(&clocks);
101
102 if((i2c_x == I2C1) || (i2c_x == I2C2))
103 {
104 apb_freq = clocks.apb1_freq;
105 }
106
107 freq_mhz = (apb_freq / 1000000);
108
109 /* set i2c input clock frequency */
110 i2c_x->ctrl2_bit.clkfreq = freq_mhz;
111
112 /* standard mode */
113 if(speed <= 100000)
114 {
115 temp = (uint16_t)(apb_freq / (speed << 1));
116
117 if (temp < 0x04)
118 {
119 temp = 0x04;
120 }
121
122 /* set scl clock */
123 i2c_x->clkctrl_bit.speed = temp;
124
125 /* disable fast mode */
126 i2c_x->clkctrl_bit.speedmode = FALSE;
127
128 /* set the maximum rise time */
129 if((freq_mhz + 1) > 0x3F)
130 {
131 i2c_x->tmrise_bit.risetime = 0x3F;
132 }
133 else
134 {
135 i2c_x->tmrise_bit.risetime = (freq_mhz + 1);
136 }
137 }
138 /* fast mode */
139 else
140 {
141 if (duty == I2C_FSMODE_DUTY_2_1)
142 {
143 temp = (uint16_t)(apb_freq / (speed * 3));
144
145 /* the ratio of high level to low level is 1:2 */
146 i2c_x->clkctrl_bit.dutymode = I2C_FSMODE_DUTY_2_1;
147 }
148 else
149 {
150 temp = (uint16_t)(apb_freq / (speed * 25));
151
152 /* the ratio of high level to low level is 9:16 */
153 i2c_x->clkctrl_bit.dutymode = I2C_FSMODE_DUTY_16_9;
154 }
155
156 if (temp == 0)
157 {
158 temp = 0x0001;
159 }
160
161 /* set scl clock*/
162 i2c_x->clkctrl_bit.speed = temp;
163
164 /* set the mode to fast mode */
165 i2c_x->clkctrl_bit.speedmode = TRUE;
166
167 /* set the maximum rise time */
168 if(speed <= 400000)
169 {
170 i2c_x->tmrise_bit.risetime = (uint16_t)(((freq_mhz * (uint16_t)300) / (uint16_t)1000) + (uint16_t)1);
171 }
172 else
173 {
174 i2c_x->tmrise_bit.risetime = (uint16_t)(((freq_mhz * (uint16_t)120) / (uint16_t)1000) + (uint16_t)1);
175 }
176 }
177}
178
191void i2c_own_address1_set(i2c_type *i2c_x, i2c_address_mode_type mode, uint16_t address)
192{
193 /* set address mode */
194 i2c_x->oaddr1_bit.addr1mode = mode;
195
196 /* set own address1 */
197 i2c_x->oaddr1_bit.addr1 = address;
198}
199
208void i2c_own_address2_set(i2c_type *i2c_x, uint8_t address)
209{
210 i2c_x->oaddr2_bit.addr2 = (address >> 1);
211}
212
221void i2c_own_address2_enable(i2c_type *i2c_x, confirm_state new_state)
222{
223 i2c_x->oaddr2_bit.addr2en = new_state;
224}
225
234void i2c_smbus_enable(i2c_type *i2c_x, confirm_state new_state)
235{
236 i2c_x->ctrl1_bit.permode = new_state;
237}
238
247void i2c_enable(i2c_type *i2c_x, confirm_state new_state)
248{
249 i2c_x->ctrl1_bit.i2cen = new_state;
250}
251
263void i2c_fast_mode_duty_set(i2c_type *i2c_x, i2c_fsmode_duty_cycle_type duty)
264{
265 i2c_x->clkctrl_bit.dutymode = duty;
266}
267
276void i2c_clock_stretch_enable(i2c_type *i2c_x, confirm_state new_state)
277{
278 i2c_x->ctrl1_bit.stretch = !new_state;
279}
280
289void i2c_ack_enable(i2c_type *i2c_x, confirm_state new_state)
290{
291 i2c_x->ctrl1_bit.acken = new_state;
292}
293
305void i2c_master_receive_ack_set(i2c_type *i2c_x, i2c_master_ack_type pos)
306{
307 i2c_x->ctrl1_bit.mackctrl = pos;
308}
309
321void i2c_pec_position_set(i2c_type *i2c_x, i2c_pec_position_type pos)
322{
323 i2c_x->ctrl1_bit.mackctrl = pos;
324}
325
334void i2c_general_call_enable(i2c_type *i2c_x, confirm_state new_state)
335{
336 i2c_x->ctrl1_bit.gcaen = new_state;
337}
338
347void i2c_arp_mode_enable(i2c_type *i2c_x, confirm_state new_state)
348{
349 i2c_x->ctrl1_bit.arpen = new_state;
350}
351
363void i2c_smbus_mode_set(i2c_type *i2c_x, i2c_smbus_mode_set_type mode)
364{
365 i2c_x->ctrl1_bit.smbmode = mode;
366}
367
379void i2c_smbus_alert_set(i2c_type *i2c_x, i2c_smbus_alert_set_type level)
380{
381 i2c_x->ctrl1_bit.smbalert = level;
382}
383
392void i2c_pec_transmit_enable(i2c_type *i2c_x, confirm_state new_state)
393{
394 i2c_x->ctrl1_bit.pecten = new_state;
395}
396
405void i2c_pec_calculate_enable(i2c_type *i2c_x, confirm_state new_state)
406{
407 i2c_x->ctrl1_bit.pecen = new_state;
408}
409
417uint8_t i2c_pec_value_get(i2c_type *i2c_x)
418{
419 return i2c_x->sts2_bit.pecval;
420}
421
430void i2c_dma_end_transfer_set(i2c_type *i2c_x, confirm_state new_state)
431{
432 i2c_x->ctrl2_bit.dmaend = new_state;
433}
434
443void i2c_dma_enable(i2c_type *i2c_x, confirm_state new_state)
444{
445 i2c_x->ctrl2_bit.dmaen = new_state;
446}
447
461void i2c_interrupt_enable(i2c_type *i2c_x, uint16_t source, confirm_state new_state)
462{
463 if (new_state != FALSE)
464 {
465 i2c_x->ctrl2 |= source;
466 }
467 else
468 {
469 i2c_x->ctrl2 &= (uint16_t)~source;
470 }
471}
472
480void i2c_start_generate(i2c_type *i2c_x)
481{
482 i2c_x->ctrl1_bit.genstart = TRUE;
483}
484
492void i2c_stop_generate(i2c_type *i2c_x)
493{
494 i2c_x->ctrl1_bit.genstop = TRUE;
495}
496
509void i2c_7bit_address_send(i2c_type *i2c_x, uint8_t address, i2c_direction_type direction)
510{
511 if(direction == I2C_DIRECTION_TRANSMIT)
512 {
513 i2c_x->dt = address & 0xFE;
514 }
515 else
516 {
517 i2c_x->dt = address | 0x01;
518 }
519}
520
529void i2c_data_send(i2c_type *i2c_x, uint8_t data)
530{
531 i2c_x->dt = data;
532}
533
541uint8_t i2c_data_receive(i2c_type *i2c_x)
542{
543 return (uint8_t)i2c_x->dt;
544}
545
576 flag_status i2c_flag_get(i2c_type *i2c_x, uint32_t flag)
577{
578 __IO uint32_t reg = 0, value = 0;
579
580 reg = flag >> 28;
581
582 flag &= (uint32_t)0x00FFFFFF;
583
584 if(reg == 0)
585 {
586 value = i2c_x->sts1;
587 }
588 else
589 {
590 flag = (uint32_t)(flag >> 16);
591
592 value = i2c_x->sts2;
593 }
594
595 if((value & flag) != (uint32_t)RESET)
596 {
597 return SET;
598 }
599 else
600 {
601 return RESET;
602 }
603}
604
628 flag_status i2c_interrupt_flag_get(i2c_type *i2c_x, uint32_t flag)
629{
630 __IO uint32_t reg = 0, value = 0, iten = 0;
631
632 switch(flag)
633 {
634 case I2C_STARTF_FLAG:
635 case I2C_ADDR7F_FLAG:
636 case I2C_TDC_FLAG:
637 case I2C_ADDRHF_FLAG:
638 case I2C_STOPF_FLAG:
639 iten = i2c_x->ctrl2_bit.evtien;
640 break;
641 case I2C_RDBF_FLAG:
642 case I2C_TDBE_FLAG:
643 iten = i2c_x->ctrl2_bit.dataien && i2c_x->ctrl2_bit.evtien;
644 break;
645 case I2C_BUSERR_FLAG:
646 case I2C_ARLOST_FLAG:
647 case I2C_ACKFAIL_FLAG:
648 case I2C_OUF_FLAG:
649 case I2C_PECERR_FLAG:
650 case I2C_TMOUT_FLAG:
651 case I2C_ALERTF_FLAG:
652 iten = i2c_x->ctrl2_bit.errien;
653 break;
654
655 default:
656 break;
657 }
658
659 reg = flag >> 28;
660
661 flag &= (uint32_t)0x00FFFFFF;
662
663 if(reg == 0)
664 {
665 value = i2c_x->sts1;
666 }
667 else
668 {
669 flag = (uint32_t)(flag >> 16);
670
671 value = i2c_x->sts2;
672 }
673
674 if(((value & flag) != (uint32_t)RESET) && (iten))
675 {
676 return SET;
677 }
678 else
679 {
680 return RESET;
681 }
682}
683
702void i2c_flag_clear(i2c_type *i2c_x, uint32_t flag)
703{
704 i2c_x->sts1 = (uint16_t)~(flag & (uint32_t)0x0000DF00);
705
706 if(flag & I2C_ADDR7F_FLAG)
707 {
708 UNUSED(i2c_x->sts1);
709 UNUSED(i2c_x->sts2);
710 }
711
712 if(flag & I2C_STOPF_FLAG)
713 {
714 UNUSED(i2c_x->sts1);
715 i2c_x->ctrl1_bit.i2cen = TRUE;
716 }
717}
718
723#endif
724
UNUSED
#define UNUSED(x)
Definition at32f413_def.h:64
crm_periph_reset
void crm_periph_reset(crm_periph_reset_type value, confirm_state new_state)
enable or disable the peripheral reset
Definition at32f413_crm.c:293
crm_clocks_freq_get
void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
Definition at32f413_crm.c:660
CRM_I2C2_PERIPH_RESET
@ CRM_I2C2_PERIPH_RESET
Definition at32f413_crm.h:180
CRM_I2C1_PERIPH_RESET
@ CRM_I2C1_PERIPH_RESET
Definition at32f413_crm.h:179
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
flag_status
flag_status
flag status
Definition at32f413.h:292
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
SET
@ SET
Definition at32f413.h:292
i2c_fsmode_duty_cycle_type
i2c_fsmode_duty_cycle_type
i2c fast mode duty cycle
Definition at32f413_i2c.h:146
i2c_smbus_mode_set_type
i2c_smbus_mode_set_type
i2c smbus mode set
Definition at32f413_i2c.h:136
i2c_direction_type
i2c_direction_type
i2c address direction
Definition at32f413_i2c.h:164
i2c_master_ack_type
i2c_master_ack_type
i2c master receiving mode acknowledge control
Definition at32f413_i2c.h:108
i2c_address_mode_type
i2c_address_mode_type
i2c address mode
Definition at32f413_i2c.h:155
i2c_smbus_alert_set_type
i2c_smbus_alert_set_type
i2c smbus alert pin set
Definition at32f413_i2c.h:127
i2c_pec_position_type
i2c_pec_position_type
i2c pec position set
Definition at32f413_i2c.h:117
I2C_FSMODE_DUTY_2_1
@ I2C_FSMODE_DUTY_2_1
Definition at32f413_i2c.h:147
I2C_FSMODE_DUTY_16_9
@ I2C_FSMODE_DUTY_16_9
Definition at32f413_i2c.h:148
I2C_DIRECTION_TRANSMIT
@ I2C_DIRECTION_TRANSMIT
Definition at32f413_i2c.h:165
i2c_pec_position_set
void i2c_pec_position_set(i2c_type *i2c_x, i2c_pec_position_type pos)
pec position set.
Definition at32f413_i2c.c:321
i2c_pec_transmit_enable
void i2c_pec_transmit_enable(i2c_type *i2c_x, confirm_state new_state)
enable or disable pec transfer.
Definition at32f413_i2c.c:392
i2c_arp_mode_enable
void i2c_arp_mode_enable(i2c_type *i2c_x, confirm_state new_state)
enable or disable arp mode.
Definition at32f413_i2c.c:347
i2c_data_receive
uint8_t i2c_data_receive(i2c_type *i2c_x)
receive a byte through the i2c periph.
Definition at32f413_i2c.c:541
i2c_reset
void i2c_reset(i2c_type *i2c_x)
reset the i2c register
Definition at32f413_i2c.c:50
i2c_smbus_alert_set
void i2c_smbus_alert_set(i2c_type *i2c_x, i2c_smbus_alert_set_type level)
drive the smbus alert pin high or low.
Definition at32f413_i2c.c:379
i2c_interrupt_flag_get
flag_status i2c_interrupt_flag_get(i2c_type *i2c_x, uint32_t flag)
get interrupt flag status
Definition at32f413_i2c.c:628
i2c_smbus_enable
void i2c_smbus_enable(i2c_type *i2c_x, confirm_state new_state)
enable or disable the smbus mode
Definition at32f413_i2c.c:234
i2c_pec_value_get
uint8_t i2c_pec_value_get(i2c_type *i2c_x)
get pec value.
Definition at32f413_i2c.c:417
i2c_software_reset
void i2c_software_reset(i2c_type *i2c_x, confirm_state new_state)
software reset.
Definition at32f413_i2c.c:72
i2c_general_call_enable
void i2c_general_call_enable(i2c_type *i2c_x, confirm_state new_state)
enable or disable general call.
Definition at32f413_i2c.c:334
i2c_ack_enable
void i2c_ack_enable(i2c_type *i2c_x, confirm_state new_state)
enable or disable acknowledge.
Definition at32f413_i2c.c:289
i2c_own_address2_set
void i2c_own_address2_set(i2c_type *i2c_x, uint8_t address)
config own address2.
Definition at32f413_i2c.c:208
i2c_7bit_address_send
void i2c_7bit_address_send(i2c_type *i2c_x, uint8_t address, i2c_direction_type direction)
transmit the slave address.
Definition at32f413_i2c.c:509
i2c_dma_end_transfer_set
void i2c_dma_end_transfer_set(i2c_type *i2c_x, confirm_state new_state)
enable or disable if the next dma transfer will be the last one.
Definition at32f413_i2c.c:430
i2c_own_address2_enable
void i2c_own_address2_enable(i2c_type *i2c_x, confirm_state new_state)
enable or disable own address2.
Definition at32f413_i2c.c:221
i2c_pec_calculate_enable
void i2c_pec_calculate_enable(i2c_type *i2c_x, confirm_state new_state)
enable or disable pec calcultetion.
Definition at32f413_i2c.c:405
i2c_stop_generate
void i2c_stop_generate(i2c_type *i2c_x)
generate stop condition.
Definition at32f413_i2c.c:492
i2c_own_address1_set
void i2c_own_address1_set(i2c_type *i2c_x, i2c_address_mode_type mode, uint16_t address)
config own address1.
Definition at32f413_i2c.c:191
i2c_enable
void i2c_enable(i2c_type *i2c_x, confirm_state new_state)
enable or disable i2c periph
Definition at32f413_i2c.c:247
i2c_fast_mode_duty_set
void i2c_fast_mode_duty_set(i2c_type *i2c_x, i2c_fsmode_duty_cycle_type duty)
config fast mode duty cycle
Definition at32f413_i2c.c:263
i2c_flag_get
flag_status i2c_flag_get(i2c_type *i2c_x, uint32_t flag)
get flag status
Definition at32f413_i2c.c:576
i2c_smbus_mode_set
void i2c_smbus_mode_set(i2c_type *i2c_x, i2c_smbus_mode_set_type mode)
config smbus host or device.
Definition at32f413_i2c.c:363
i2c_interrupt_enable
void i2c_interrupt_enable(i2c_type *i2c_x, uint16_t source, confirm_state new_state)
enable or disable interrupt
Definition at32f413_i2c.c:461
i2c_flag_clear
void i2c_flag_clear(i2c_type *i2c_x, uint32_t flag)
clear flag status
Definition at32f413_i2c.c:702
i2c_dma_enable
void i2c_dma_enable(i2c_type *i2c_x, confirm_state new_state)
enable or disable dma requests.
Definition at32f413_i2c.c:443
i2c_data_send
void i2c_data_send(i2c_type *i2c_x, uint8_t data)
send a byte through the i2c periph.
Definition at32f413_i2c.c:529
i2c_clock_stretch_enable
void i2c_clock_stretch_enable(i2c_type *i2c_x, confirm_state new_state)
enable or disable clock stretch.
Definition at32f413_i2c.c:276
i2c_init
void i2c_init(i2c_type *i2c_x, i2c_fsmode_duty_cycle_type duty, uint32_t speed)
init i2c speed and duty cycle.
Definition at32f413_i2c.c:89
i2c_master_receive_ack_set
void i2c_master_receive_ack_set(i2c_type *i2c_x, i2c_master_ack_type pos)
master receiving mode acknowledge control.
Definition at32f413_i2c.c:305
i2c_start_generate
void i2c_start_generate(i2c_type *i2c_x)
generate start condition.
Definition at32f413_i2c.c:480
I2C_STARTF_FLAG
#define I2C_STARTF_FLAG
Definition at32f413_i2c.h:51
I2C_TMOUT_FLAG
#define I2C_TMOUT_FLAG
Definition at32f413_i2c.h:63
I2C_ADDR7F_FLAG
#define I2C_ADDR7F_FLAG
Definition at32f413_i2c.h:52
I2C_ALERTF_FLAG
#define I2C_ALERTF_FLAG
Definition at32f413_i2c.h:64
I2C_BUSERR_FLAG
#define I2C_BUSERR_FLAG
Definition at32f413_i2c.h:58
I2C_ACKFAIL_FLAG
#define I2C_ACKFAIL_FLAG
Definition at32f413_i2c.h:60
I2C_OUF_FLAG
#define I2C_OUF_FLAG
Definition at32f413_i2c.h:61
I2C_ARLOST_FLAG
#define I2C_ARLOST_FLAG
Definition at32f413_i2c.h:59
I2C_STOPF_FLAG
#define I2C_STOPF_FLAG
Definition at32f413_i2c.h:55
I2C_TDC_FLAG
#define I2C_TDC_FLAG
Definition at32f413_i2c.h:53
I2C_ADDRHF_FLAG
#define I2C_ADDRHF_FLAG
Definition at32f413_i2c.h:54
I2C_TDBE_FLAG
#define I2C_TDBE_FLAG
Definition at32f413_i2c.h:57
I2C_RDBF_FLAG
#define I2C_RDBF_FLAG
Definition at32f413_i2c.h:56
I2C_PECERR_FLAG
#define I2C_PECERR_FLAG
Definition at32f413_i2c.h:62
I2C1
#define I2C1
Definition at32f413_i2c.h:346
I2C2
#define I2C2
Definition at32f413_i2c.h:347
at32f413_conf.h
at32f413 config header file
crm_clocks_freq_type
crm clocks freqency structure
Definition at32f413_crm.h:470
crm_clocks_freq_type::apb1_freq
uint32_t apb1_freq
Definition at32f413_crm.h:474
i2c_type
type define i2c register all
Definition at32f413_i2c.h:173
i2c_type::smbalert
__IO uint32_t smbalert
Definition at32f413_i2c.h:195
i2c_type::dmaend
__IO uint32_t dmaend
Definition at32f413_i2c.h:215
i2c_type::genstop
__IO uint32_t genstop
Definition at32f413_i2c.h:191
i2c_type::clkctrl_bit
struct i2c_type::@521::@532 clkctrl_bit
i2c_type::addr2en
__IO uint32_t addr2en
Definition at32f413_i2c.h:243
i2c_type::dmaen
__IO uint32_t dmaen
Definition at32f413_i2c.h:214
i2c_type::gcaen
__IO uint32_t gcaen
Definition at32f413_i2c.h:188
i2c_type::clkfreq
__IO uint32_t clkfreq
Definition at32f413_i2c.h:210
i2c_type::addr2
__IO uint32_t addr2
Definition at32f413_i2c.h:244
i2c_type::tmrise_bit
struct i2c_type::@523::@533 tmrise_bit
i2c_type::sts1
__IO uint32_t sts1
Definition at32f413_i2c.h:267
i2c_type::risetime
__IO uint32_t risetime
Definition at32f413_i2c.h:335
i2c_type::permode
__IO uint32_t permode
Definition at32f413_i2c.h:183
i2c_type::genstart
__IO uint32_t genstart
Definition at32f413_i2c.h:190
i2c_type::speedmode
__IO uint32_t speedmode
Definition at32f413_i2c.h:322
i2c_type::pecten
__IO uint32_t pecten
Definition at32f413_i2c.h:194
i2c_type::ctrl2
__IO uint32_t ctrl2
Definition at32f413_i2c.h:207
i2c_type::speed
__IO uint32_t speed
Definition at32f413_i2c.h:319
i2c_type::oaddr2_bit
struct i2c_type::@513::@528 oaddr2_bit
i2c_type::ctrl2_bit
struct i2c_type::@509::@526 ctrl2_bit
i2c_type::ctrl1_bit
struct i2c_type::@507::@525 ctrl1_bit
i2c_type::stretch
__IO uint32_t stretch
Definition at32f413_i2c.h:189
i2c_type::dutymode
__IO uint32_t dutymode
Definition at32f413_i2c.h:321
i2c_type::arpen
__IO uint32_t arpen
Definition at32f413_i2c.h:186
i2c_type::dataien
__IO uint32_t dataien
Definition at32f413_i2c.h:213
i2c_type::addr1mode
__IO uint32_t addr1mode
Definition at32f413_i2c.h:230
i2c_type::oaddr1_bit
struct i2c_type::@511::@527 oaddr1_bit
i2c_type::reset
__IO uint32_t reset
Definition at32f413_i2c.h:197
i2c_type::pecval
__IO uint32_t pecval
Definition at32f413_i2c.h:306
i2c_type::sts2_bit
struct i2c_type::@519::@531 sts2_bit
i2c_type::dt
__IO uint32_t dt
Definition at32f413_i2c.h:254
i2c_type::acken
__IO uint32_t acken
Definition at32f413_i2c.h:192
i2c_type::i2cen
__IO uint32_t i2cen
Definition at32f413_i2c.h:182
i2c_type::errien
__IO uint32_t errien
Definition at32f413_i2c.h:211
i2c_type::addr1
__IO uint32_t addr1
Definition at32f413_i2c.h:228
i2c_type::sts2
__IO uint32_t sts2
Definition at32f413_i2c.h:295
i2c_type::evtien
__IO uint32_t evtien
Definition at32f413_i2c.h:212
i2c_type::mackctrl
__IO uint32_t mackctrl
Definition at32f413_i2c.h:193
i2c_type::pecen
__IO uint32_t pecen
Definition at32f413_i2c.h:187
i2c_type::smbmode
__IO uint32_t smbmode
Definition at32f413_i2c.h:185


AT32F413 Firmwary Library: at32f413_i2c.h Source File

  • libraries
  • drivers
  • inc
at32f413_i2c.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_I2C_H
28#define __AT32F413_I2C_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34
35/* includes ------------------------------------------------------------------*/
36#include "at32f413.h"
37
51#define I2C_STARTF_FLAG ((uint32_t)0x00000001)
52#define I2C_ADDR7F_FLAG ((uint32_t)0x00000002)
53#define I2C_TDC_FLAG ((uint32_t)0x00000004)
54#define I2C_ADDRHF_FLAG ((uint32_t)0x00000008)
55#define I2C_STOPF_FLAG ((uint32_t)0x00000010)
56#define I2C_RDBF_FLAG ((uint32_t)0x00000040)
57#define I2C_TDBE_FLAG ((uint32_t)0x00000080)
58#define I2C_BUSERR_FLAG ((uint32_t)0x00000100)
59#define I2C_ARLOST_FLAG ((uint32_t)0x00000200)
60#define I2C_ACKFAIL_FLAG ((uint32_t)0x00000400)
61#define I2C_OUF_FLAG ((uint32_t)0x00000800)
62#define I2C_PECERR_FLAG ((uint32_t)0x00001000)
63#define I2C_TMOUT_FLAG ((uint32_t)0x00004000)
64#define I2C_ALERTF_FLAG ((uint32_t)0x00008000)
75#define I2C_TRMODE_FLAG ((uint32_t)0x10010000)
76#define I2C_BUSYF_FLAG ((uint32_t)0x10020000)
77#define I2C_DIRF_FLAG ((uint32_t)0x10040000)
78#define I2C_GCADDRF_FLAG ((uint32_t)0x10100000)
79#define I2C_DEVADDRF_FLAG ((uint32_t)0x10200000)
80#define I2C_HOSTADDRF_FLAG ((uint32_t)0x10400000)
81#define I2C_ADDR2_FLAG ((uint32_t)0x10800000)
92#define I2C_DATA_INT ((uint16_t)0x0400)
93#define I2C_EVT_INT ((uint16_t)0x0200)
94#define I2C_ERR_INT ((uint16_t)0x0100)
107typedef enum
108{
109 I2C_MASTER_ACK_CURRENT = 0x00,
110 I2C_MASTER_ACK_NEXT = 0x01
111} i2c_master_ack_type;
112
116typedef enum
117{
118 I2C_PEC_POSITION_CURRENT = 0x00,
119 I2C_PEC_POSITION_NEXT = 0x01
120} i2c_pec_position_type;
121
122
126typedef enum
127{
128 I2C_SMBUS_ALERT_HIGH = 0x00,
129 I2C_SMBUS_ALERT_LOW = 0x01
130} i2c_smbus_alert_set_type;
131
135typedef enum
136{
137 I2C_SMBUS_MODE_DEVICE = 0x00,
138 I2C_SMBUS_MODE_HOST = 0x01
139} i2c_smbus_mode_set_type;
140
141
145typedef enum
146{
147 I2C_FSMODE_DUTY_2_1 = 0x00,
148 I2C_FSMODE_DUTY_16_9 = 0x01
149} i2c_fsmode_duty_cycle_type;
150
154typedef enum
155{
156 I2C_ADDRESS_MODE_7BIT = 0x00,
157 I2C_ADDRESS_MODE_10BIT = 0x01
158} i2c_address_mode_type;
159
163typedef enum
164{
165 I2C_DIRECTION_TRANSMIT = 0x00,
166 I2C_DIRECTION_RECEIVE = 0x01
167} i2c_direction_type;
168
172typedef struct
173{
177 union
178 {
179 __IO uint32_t ctrl1;
180 struct
181 {
182 __IO uint32_t i2cen : 1; /* [0] */
183 __IO uint32_t permode : 1; /* [1] */
184 __IO uint32_t reserved1 : 1; /* [2] */
185 __IO uint32_t smbmode : 1; /* [3] */
186 __IO uint32_t arpen : 1; /* [4] */
187 __IO uint32_t pecen : 1; /* [5] */
188 __IO uint32_t gcaen : 1; /* [6] */
189 __IO uint32_t stretch : 1; /* [7] */
190 __IO uint32_t genstart : 1; /* [8] */
191 __IO uint32_t genstop : 1; /* [9] */
192 __IO uint32_t acken : 1; /* [10] */
193 __IO uint32_t mackctrl : 1; /* [11] */
194 __IO uint32_t pecten : 1; /* [12] */
195 __IO uint32_t smbalert : 1; /* [13] */
196 __IO uint32_t reserved2 : 1; /* [14] */
197 __IO uint32_t reset : 1; /* [15] */
198 __IO uint32_t reserved3 : 16;/* [31:16] */
199 } ctrl1_bit;
200 };
201
205 union
206 {
207 __IO uint32_t ctrl2;
208 struct
209 {
210 __IO uint32_t clkfreq : 8; /* [7:0] */
211 __IO uint32_t errien : 1; /* [8] */
212 __IO uint32_t evtien : 1; /* [9] */
213 __IO uint32_t dataien : 1; /* [10] */
214 __IO uint32_t dmaen : 1; /* [11] */
215 __IO uint32_t dmaend : 1; /* [12] */
216 __IO uint32_t reserved1 : 19;/* [31:13] */
217 } ctrl2_bit;
218 };
219
223 union
224 {
225 __IO uint32_t oaddr1;
226 struct
227 {
228 __IO uint32_t addr1 : 10;/* [9:0] */
229 __IO uint32_t reserved1 : 5; /* [14:10] */
230 __IO uint32_t addr1mode : 1; /* [15] */
231 __IO uint32_t reserved2 : 16;/* [31:16] */
232 } oaddr1_bit;
233 };
234
238 union
239 {
240 __IO uint32_t oaddr2;
241 struct
242 {
243 __IO uint32_t addr2en : 1; /* [0] */
244 __IO uint32_t addr2 : 7; /* [7:1] */
245 __IO uint32_t reserved1 : 24;/* [31:8] */
246 } oaddr2_bit;
247 };
248
252 union
253 {
254 __IO uint32_t dt;
255 struct
256 {
257 __IO uint32_t dt : 8; /* [7:0] */
258 __IO uint32_t reserved1 : 24;/* [31:8] */
259 } dt_bit;
260 };
261
265 union
266 {
267 __IO uint32_t sts1;
268 struct
269 {
270 __IO uint32_t startf : 1; /* [0] */
271 __IO uint32_t addr7f : 1; /* [1] */
272 __IO uint32_t tdc : 1; /* [2] */
273 __IO uint32_t addrhf : 1; /* [3] */
274 __IO uint32_t stopf : 1; /* [4] */
275 __IO uint32_t reserved1 : 1; /* [5] */
276 __IO uint32_t rdbf : 1; /* [6] */
277 __IO uint32_t tdbe : 1; /* [7] */
278 __IO uint32_t buserr : 1; /* [8] */
279 __IO uint32_t arlost : 1; /* [9] */
280 __IO uint32_t ackfail : 1; /* [10] */
281 __IO uint32_t ouf : 1; /* [11] */
282 __IO uint32_t pecerr : 1; /* [12] */
283 __IO uint32_t reserved2 : 1; /* [13] */
284 __IO uint32_t tmout : 1; /* [14] */
285 __IO uint32_t alertf : 1; /* [15] */
286 __IO uint32_t reserved3 : 16; /* [31:16] */
287 } sts1_bit;
288 };
289
293 union
294 {
295 __IO uint32_t sts2;
296 struct
297 {
298 __IO uint32_t trmode : 1; /* [0] */
299 __IO uint32_t busyf : 1; /* [1] */
300 __IO uint32_t dirf : 1; /* [2] */
301 __IO uint32_t reserved1 : 1; /* [3] */
302 __IO uint32_t gcaddrf : 1; /* [4] */
303 __IO uint32_t devaddrf : 1; /* [5] */
304 __IO uint32_t hostaddrf : 1; /* [6] */
305 __IO uint32_t addr2 : 1; /* [7] */
306 __IO uint32_t pecval : 8; /* [15:8] */
307 __IO uint32_t reserved2 : 16;/* [31:16] */
308 } sts2_bit;
309 };
310
314 union
315 {
316 __IO uint32_t clkctrl;
317 struct
318 {
319 __IO uint32_t speed : 12;/* [11:0] */
320 __IO uint32_t reserved1 : 2; /* [13:12] */
321 __IO uint32_t dutymode : 1; /* [14] */
322 __IO uint32_t speedmode : 1; /* [15] */
323 __IO uint32_t reserved2 : 16;/* [31:16] */
324 } clkctrl_bit;
325 };
326
330 union
331 {
332 __IO uint32_t tmrise;
333 struct
334 {
335 __IO uint32_t risetime : 6; /* [5:0] */
336 __IO uint32_t reserved1 : 26;/* [31:6] */
337 } tmrise_bit;
338 };
339
340} i2c_type;
341
346#define I2C1 ((i2c_type *) I2C1_BASE)
347#define I2C2 ((i2c_type *) I2C2_BASE)
348
353void i2c_reset(i2c_type *i2c_x);
354void i2c_software_reset(i2c_type *i2c_x, confirm_state new_state);
355void i2c_init(i2c_type *i2c_x, i2c_fsmode_duty_cycle_type duty, uint32_t speed);
356void i2c_own_address1_set(i2c_type *i2c_x, i2c_address_mode_type mode, uint16_t address);
357void i2c_own_address2_set(i2c_type *i2c_x, uint8_t address);
358void i2c_own_address2_enable(i2c_type *i2c_x, confirm_state new_state);
359void i2c_smbus_enable(i2c_type *i2c_x, confirm_state new_state);
360void i2c_enable(i2c_type *i2c_x, confirm_state new_state);
361void i2c_fast_mode_duty_set(i2c_type *i2c_x, i2c_fsmode_duty_cycle_type duty);
362void i2c_clock_stretch_enable(i2c_type *i2c_x, confirm_state new_state);
363void i2c_ack_enable(i2c_type *i2c_x, confirm_state new_state);
364void i2c_master_receive_ack_set(i2c_type *i2c_x, i2c_master_ack_type pos);
365void i2c_pec_position_set(i2c_type *i2c_x, i2c_pec_position_type pos);
366void i2c_general_call_enable(i2c_type *i2c_x, confirm_state new_state);
367void i2c_arp_mode_enable(i2c_type *i2c_x, confirm_state new_state);
368void i2c_smbus_mode_set(i2c_type *i2c_x, i2c_smbus_mode_set_type mode);
369void i2c_smbus_alert_set(i2c_type *i2c_x, i2c_smbus_alert_set_type level);
370void i2c_pec_transmit_enable(i2c_type *i2c_x, confirm_state new_state);
371void i2c_pec_calculate_enable(i2c_type *i2c_x, confirm_state new_state);
372uint8_t i2c_pec_value_get(i2c_type *i2c_x);
373void i2c_dma_end_transfer_set(i2c_type *i2c_x, confirm_state new_state);
374void i2c_dma_enable(i2c_type *i2c_x, confirm_state new_state);
375void i2c_interrupt_enable(i2c_type *i2c_x, uint16_t source, confirm_state new_state);
376void i2c_start_generate(i2c_type *i2c_x);
377void i2c_stop_generate(i2c_type *i2c_x);
378void i2c_7bit_address_send(i2c_type *i2c_x, uint8_t address, i2c_direction_type direction);
379void i2c_data_send(i2c_type *i2c_x, uint8_t data);
380uint8_t i2c_data_receive(i2c_type *i2c_x);
381 flag_status i2c_flag_get(i2c_type *i2c_x, uint32_t flag);
382 flag_status i2c_interrupt_flag_get(i2c_type *i2c_x, uint32_t flag);
383void i2c_flag_clear(i2c_type *i2c_x, uint32_t flag);
384
397#ifdef __cplusplus
398}
399#endif
400
401#endif
at32f413.h
at32f413 header file
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
flag_status
flag_status
flag status
Definition at32f413.h:292
i2c_pec_position_set
void i2c_pec_position_set(i2c_type *i2c_x, i2c_pec_position_type pos)
pec position set.
Definition at32f413_i2c.c:321
i2c_pec_transmit_enable
void i2c_pec_transmit_enable(i2c_type *i2c_x, confirm_state new_state)
enable or disable pec transfer.
Definition at32f413_i2c.c:392
i2c_arp_mode_enable
void i2c_arp_mode_enable(i2c_type *i2c_x, confirm_state new_state)
enable or disable arp mode.
Definition at32f413_i2c.c:347
i2c_data_receive
uint8_t i2c_data_receive(i2c_type *i2c_x)
receive a byte through the i2c periph.
Definition at32f413_i2c.c:541
i2c_reset
void i2c_reset(i2c_type *i2c_x)
reset the i2c register
Definition at32f413_i2c.c:50
i2c_smbus_alert_set
void i2c_smbus_alert_set(i2c_type *i2c_x, i2c_smbus_alert_set_type level)
drive the smbus alert pin high or low.
Definition at32f413_i2c.c:379
i2c_interrupt_flag_get
flag_status i2c_interrupt_flag_get(i2c_type *i2c_x, uint32_t flag)
get interrupt flag status
Definition at32f413_i2c.c:628
i2c_smbus_enable
void i2c_smbus_enable(i2c_type *i2c_x, confirm_state new_state)
enable or disable the smbus mode
Definition at32f413_i2c.c:234
i2c_pec_value_get
uint8_t i2c_pec_value_get(i2c_type *i2c_x)
get pec value.
Definition at32f413_i2c.c:417
i2c_software_reset
void i2c_software_reset(i2c_type *i2c_x, confirm_state new_state)
software reset.
Definition at32f413_i2c.c:72
i2c_general_call_enable
void i2c_general_call_enable(i2c_type *i2c_x, confirm_state new_state)
enable or disable general call.
Definition at32f413_i2c.c:334
i2c_ack_enable
void i2c_ack_enable(i2c_type *i2c_x, confirm_state new_state)
enable or disable acknowledge.
Definition at32f413_i2c.c:289
i2c_own_address2_set
void i2c_own_address2_set(i2c_type *i2c_x, uint8_t address)
config own address2.
Definition at32f413_i2c.c:208
i2c_7bit_address_send
void i2c_7bit_address_send(i2c_type *i2c_x, uint8_t address, i2c_direction_type direction)
transmit the slave address.
Definition at32f413_i2c.c:509
i2c_dma_end_transfer_set
void i2c_dma_end_transfer_set(i2c_type *i2c_x, confirm_state new_state)
enable or disable if the next dma transfer will be the last one.
Definition at32f413_i2c.c:430
i2c_own_address2_enable
void i2c_own_address2_enable(i2c_type *i2c_x, confirm_state new_state)
enable or disable own address2.
Definition at32f413_i2c.c:221
i2c_pec_calculate_enable
void i2c_pec_calculate_enable(i2c_type *i2c_x, confirm_state new_state)
enable or disable pec calcultetion.
Definition at32f413_i2c.c:405
i2c_stop_generate
void i2c_stop_generate(i2c_type *i2c_x)
generate stop condition.
Definition at32f413_i2c.c:492
i2c_own_address1_set
void i2c_own_address1_set(i2c_type *i2c_x, i2c_address_mode_type mode, uint16_t address)
config own address1.
Definition at32f413_i2c.c:191
i2c_enable
void i2c_enable(i2c_type *i2c_x, confirm_state new_state)
enable or disable i2c periph
Definition at32f413_i2c.c:247
i2c_fast_mode_duty_set
void i2c_fast_mode_duty_set(i2c_type *i2c_x, i2c_fsmode_duty_cycle_type duty)
config fast mode duty cycle
Definition at32f413_i2c.c:263
i2c_flag_get
flag_status i2c_flag_get(i2c_type *i2c_x, uint32_t flag)
get flag status
Definition at32f413_i2c.c:576
i2c_smbus_mode_set
void i2c_smbus_mode_set(i2c_type *i2c_x, i2c_smbus_mode_set_type mode)
config smbus host or device.
Definition at32f413_i2c.c:363
i2c_interrupt_enable
void i2c_interrupt_enable(i2c_type *i2c_x, uint16_t source, confirm_state new_state)
enable or disable interrupt
Definition at32f413_i2c.c:461
i2c_flag_clear
void i2c_flag_clear(i2c_type *i2c_x, uint32_t flag)
clear flag status
Definition at32f413_i2c.c:702
i2c_dma_enable
void i2c_dma_enable(i2c_type *i2c_x, confirm_state new_state)
enable or disable dma requests.
Definition at32f413_i2c.c:443
i2c_data_send
void i2c_data_send(i2c_type *i2c_x, uint8_t data)
send a byte through the i2c periph.
Definition at32f413_i2c.c:529
i2c_clock_stretch_enable
void i2c_clock_stretch_enable(i2c_type *i2c_x, confirm_state new_state)
enable or disable clock stretch.
Definition at32f413_i2c.c:276
i2c_init
void i2c_init(i2c_type *i2c_x, i2c_fsmode_duty_cycle_type duty, uint32_t speed)
init i2c speed and duty cycle.
Definition at32f413_i2c.c:89
i2c_master_receive_ack_set
void i2c_master_receive_ack_set(i2c_type *i2c_x, i2c_master_ack_type pos)
master receiving mode acknowledge control.
Definition at32f413_i2c.c:305
i2c_start_generate
void i2c_start_generate(i2c_type *i2c_x)
generate start condition.
Definition at32f413_i2c.c:480
i2c_fsmode_duty_cycle_type
i2c_fsmode_duty_cycle_type
i2c fast mode duty cycle
Definition at32f413_i2c.h:146
i2c_smbus_mode_set_type
i2c_smbus_mode_set_type
i2c smbus mode set
Definition at32f413_i2c.h:136
i2c_direction_type
i2c_direction_type
i2c address direction
Definition at32f413_i2c.h:164
i2c_master_ack_type
i2c_master_ack_type
i2c master receiving mode acknowledge control
Definition at32f413_i2c.h:108
i2c_address_mode_type
i2c_address_mode_type
i2c address mode
Definition at32f413_i2c.h:155
i2c_smbus_alert_set_type
i2c_smbus_alert_set_type
i2c smbus alert pin set
Definition at32f413_i2c.h:127
i2c_pec_position_type
i2c_pec_position_type
i2c pec position set
Definition at32f413_i2c.h:117
I2C_FSMODE_DUTY_2_1
@ I2C_FSMODE_DUTY_2_1
Definition at32f413_i2c.h:147
I2C_FSMODE_DUTY_16_9
@ I2C_FSMODE_DUTY_16_9
Definition at32f413_i2c.h:148
I2C_SMBUS_MODE_HOST
@ I2C_SMBUS_MODE_HOST
Definition at32f413_i2c.h:138
I2C_SMBUS_MODE_DEVICE
@ I2C_SMBUS_MODE_DEVICE
Definition at32f413_i2c.h:137
I2C_DIRECTION_RECEIVE
@ I2C_DIRECTION_RECEIVE
Definition at32f413_i2c.h:166
I2C_DIRECTION_TRANSMIT
@ I2C_DIRECTION_TRANSMIT
Definition at32f413_i2c.h:165
I2C_MASTER_ACK_CURRENT
@ I2C_MASTER_ACK_CURRENT
Definition at32f413_i2c.h:109
I2C_MASTER_ACK_NEXT
@ I2C_MASTER_ACK_NEXT
Definition at32f413_i2c.h:110
I2C_ADDRESS_MODE_7BIT
@ I2C_ADDRESS_MODE_7BIT
Definition at32f413_i2c.h:156
I2C_ADDRESS_MODE_10BIT
@ I2C_ADDRESS_MODE_10BIT
Definition at32f413_i2c.h:157
I2C_SMBUS_ALERT_HIGH
@ I2C_SMBUS_ALERT_HIGH
Definition at32f413_i2c.h:128
I2C_SMBUS_ALERT_LOW
@ I2C_SMBUS_ALERT_LOW
Definition at32f413_i2c.h:129
I2C_PEC_POSITION_NEXT
@ I2C_PEC_POSITION_NEXT
Definition at32f413_i2c.h:119
I2C_PEC_POSITION_CURRENT
@ I2C_PEC_POSITION_CURRENT
Definition at32f413_i2c.h:118
i2c_type
type define i2c register all
Definition at32f413_i2c.h:173
i2c_type::smbalert
__IO uint32_t smbalert
Definition at32f413_i2c.h:195
i2c_type::dmaend
__IO uint32_t dmaend
Definition at32f413_i2c.h:215
i2c_type::genstop
__IO uint32_t genstop
Definition at32f413_i2c.h:191
i2c_type::tmrise
__IO uint32_t tmrise
Definition at32f413_i2c.h:332
i2c_type::tdc
__IO uint32_t tdc
Definition at32f413_i2c.h:272
i2c_type::addr2en
__IO uint32_t addr2en
Definition at32f413_i2c.h:243
i2c_type::pecerr
__IO uint32_t pecerr
Definition at32f413_i2c.h:282
i2c_type::dmaen
__IO uint32_t dmaen
Definition at32f413_i2c.h:214
i2c_type::gcaen
__IO uint32_t gcaen
Definition at32f413_i2c.h:188
i2c_type::clkfreq
__IO uint32_t clkfreq
Definition at32f413_i2c.h:210
i2c_type::addr2
__IO uint32_t addr2
Definition at32f413_i2c.h:244
i2c_type::buserr
__IO uint32_t buserr
Definition at32f413_i2c.h:278
i2c_type::tmout
__IO uint32_t tmout
Definition at32f413_i2c.h:284
i2c_type::stopf
__IO uint32_t stopf
Definition at32f413_i2c.h:274
i2c_type::sts1
__IO uint32_t sts1
Definition at32f413_i2c.h:267
i2c_type::risetime
__IO uint32_t risetime
Definition at32f413_i2c.h:335
i2c_type::hostaddrf
__IO uint32_t hostaddrf
Definition at32f413_i2c.h:304
i2c_type::dirf
__IO uint32_t dirf
Definition at32f413_i2c.h:300
i2c_type::permode
__IO uint32_t permode
Definition at32f413_i2c.h:183
i2c_type::reserved1
__IO uint32_t reserved1
Definition at32f413_i2c.h:184
i2c_type::genstart
__IO uint32_t genstart
Definition at32f413_i2c.h:190
i2c_type::speedmode
__IO uint32_t speedmode
Definition at32f413_i2c.h:322
i2c_type::pecten
__IO uint32_t pecten
Definition at32f413_i2c.h:194
i2c_type::ctrl2
__IO uint32_t ctrl2
Definition at32f413_i2c.h:207
i2c_type::speed
__IO uint32_t speed
Definition at32f413_i2c.h:319
i2c_type::trmode
__IO uint32_t trmode
Definition at32f413_i2c.h:298
i2c_type::ouf
__IO uint32_t ouf
Definition at32f413_i2c.h:281
i2c_type::arlost
__IO uint32_t arlost
Definition at32f413_i2c.h:279
i2c_type::stretch
__IO uint32_t stretch
Definition at32f413_i2c.h:189
i2c_type::dutymode
__IO uint32_t dutymode
Definition at32f413_i2c.h:321
i2c_type::arpen
__IO uint32_t arpen
Definition at32f413_i2c.h:186
i2c_type::dataien
__IO uint32_t dataien
Definition at32f413_i2c.h:213
i2c_type::startf
__IO uint32_t startf
Definition at32f413_i2c.h:270
i2c_type::addr1mode
__IO uint32_t addr1mode
Definition at32f413_i2c.h:230
i2c_type::tdbe
__IO uint32_t tdbe
Definition at32f413_i2c.h:277
i2c_type::reserved2
__IO uint32_t reserved2
Definition at32f413_i2c.h:196
i2c_type::reserved3
__IO uint32_t reserved3
Definition at32f413_i2c.h:198
i2c_type::reset
__IO uint32_t reset
Definition at32f413_i2c.h:197
i2c_type::pecval
__IO uint32_t pecval
Definition at32f413_i2c.h:306
i2c_type::addrhf
__IO uint32_t addrhf
Definition at32f413_i2c.h:273
i2c_type::addr7f
__IO uint32_t addr7f
Definition at32f413_i2c.h:271
i2c_type::dt
__IO uint32_t dt
Definition at32f413_i2c.h:254
i2c_type::ctrl1
__IO uint32_t ctrl1
Definition at32f413_i2c.h:179
i2c_type::ackfail
__IO uint32_t ackfail
Definition at32f413_i2c.h:280
i2c_type::acken
__IO uint32_t acken
Definition at32f413_i2c.h:192
i2c_type::i2cen
__IO uint32_t i2cen
Definition at32f413_i2c.h:182
i2c_type::rdbf
__IO uint32_t rdbf
Definition at32f413_i2c.h:276
i2c_type::busyf
__IO uint32_t busyf
Definition at32f413_i2c.h:299
i2c_type::oaddr1
__IO uint32_t oaddr1
Definition at32f413_i2c.h:225
i2c_type::errien
__IO uint32_t errien
Definition at32f413_i2c.h:211
i2c_type::addr1
__IO uint32_t addr1
Definition at32f413_i2c.h:228
i2c_type::sts2
__IO uint32_t sts2
Definition at32f413_i2c.h:295
i2c_type::evtien
__IO uint32_t evtien
Definition at32f413_i2c.h:212
i2c_type::clkctrl
__IO uint32_t clkctrl
Definition at32f413_i2c.h:316
i2c_type::mackctrl
__IO uint32_t mackctrl
Definition at32f413_i2c.h:193
i2c_type::oaddr2
__IO uint32_t oaddr2
Definition at32f413_i2c.h:240
i2c_type::pecen
__IO uint32_t pecen
Definition at32f413_i2c.h:187
i2c_type::gcaddrf
__IO uint32_t gcaddrf
Definition at32f413_i2c.h:302
i2c_type::smbmode
__IO uint32_t smbmode
Definition at32f413_i2c.h:185
i2c_type::devaddrf
__IO uint32_t devaddrf
Definition at32f413_i2c.h:303
i2c_type::alertf
__IO uint32_t alertf
Definition at32f413_i2c.h:285


AT32F413 Firmwary Library: at32f413_misc.c Source File

  • libraries
  • drivers
  • src
at32f413_misc.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_conf.h"
28
38#ifdef MISC_MODULE_ENABLED
39
44#define AIRCR_VECTKEY_MASK ((uint32_t)0x05FA0000)
45
51void nvic_system_reset(void)
52{
53 NVIC_SystemReset();
54}
55
63void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
64{
65 uint32_t temp_priority = 0;
66
67 /* encode priority */
68 temp_priority = NVIC_EncodePriority(NVIC_GetPriorityGrouping(), preempt_priority, sub_priority);
69 /* set priority */
70 NVIC_SetPriority(irqn, temp_priority);
71 /* enable irqn */
72 NVIC_EnableIRQ(irqn);
73}
74
80void nvic_irq_disable(IRQn_Type irqn)
81{
82 NVIC_DisableIRQ(irqn);
83}
84
96void nvic_priority_group_config(nvic_priority_group_type priority_group)
97{
98 /* set the prigroup[10:8] bits according to nvic_prioritygroup value */
99 NVIC_SetPriorityGrouping(priority_group);
100}
101
111void nvic_vector_table_set(uint32_t base, uint32_t offset)
112{
113 SCB->VTOR = base | (offset & (uint32_t)0x1FFFFF80);
114}
115
126void nvic_lowpower_mode_config(nvic_lowpower_mode_type lp_mode, confirm_state new_state)
127{
128 if(new_state != FALSE)
129 {
130 SCB->SCR |= lp_mode;
131 }
132 else
133 {
134 SCB->SCR &= (uint32_t)(~(uint32_t)lp_mode);
135 }
136}
137
146void systick_clock_source_config(systick_clock_source_type source)
147{
148 if(source == SYSTICK_CLOCK_SOURCE_AHBCLK_NODIV)
149 {
150 SysTick->CTRL |= SYSTICK_CLOCK_SOURCE_AHBCLK_NODIV;
151 }
152 else
153 {
154 SysTick->CTRL &= ~(uint32_t)SYSTICK_CLOCK_SOURCE_AHBCLK_NODIV;
155 }
156}
157
162#endif
163
IRQn_Type
enum IRQn IRQn_Type
at32f413 interrupt number definition, according to the selected device in Library_configuration_secti...
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
FALSE
@ FALSE
Definition at32f413.h:297
nvic_lowpower_mode_type
nvic_lowpower_mode_type
nvic low power mode
Definition at32f413_misc.h:77
nvic_priority_group_type
nvic_priority_group_type
nvic interrupt priority group
Definition at32f413_misc.h:65
systick_clock_source_type
systick_clock_source_type
systick clock source
Definition at32f413_misc.h:87
SYSTICK_CLOCK_SOURCE_AHBCLK_NODIV
@ SYSTICK_CLOCK_SOURCE_AHBCLK_NODIV
Definition at32f413_misc.h:89
nvic_lowpower_mode_config
void nvic_lowpower_mode_config(nvic_lowpower_mode_type lp_mode, confirm_state new_state)
config nvic lowpower mode
Definition at32f413_misc.c:126
nvic_system_reset
void nvic_system_reset(void)
system reset
Definition at32f413_misc.c:51
nvic_vector_table_set
void nvic_vector_table_set(uint32_t base, uint32_t offset)
set the vector table location and offset.
Definition at32f413_misc.c:111
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_irq_disable
void nvic_irq_disable(IRQn_Type irqn)
disable nvic irq number
Definition at32f413_misc.c:80
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
systick_clock_source_config
void systick_clock_source_config(systick_clock_source_type source)
config systick clock source
Definition at32f413_misc.c:146
at32f413_conf.h
at32f413 config header file


AT32F413 Firmwary Library: at32f413_misc.h Source File

  • libraries
  • drivers
  • inc
at32f413_misc.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_MISC_H
28#define __AT32F413_MISC_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34
35/* includes ------------------------------------------------------------------*/
36#include "at32f413.h"
37
50#define NVIC_VECTTAB_RAM ((uint32_t)0x20000000)
51#define NVIC_VECTTAB_FLASH ((uint32_t)0x08000000)
64typedef enum
65{
66 NVIC_PRIORITY_GROUP_0 = ((uint32_t)0x7),
67 NVIC_PRIORITY_GROUP_1 = ((uint32_t)0x6),
68 NVIC_PRIORITY_GROUP_2 = ((uint32_t)0x5),
69 NVIC_PRIORITY_GROUP_3 = ((uint32_t)0x4),
70 NVIC_PRIORITY_GROUP_4 = ((uint32_t)0x3)
71} nvic_priority_group_type;
72
76typedef enum
77{
78 NVIC_LP_SLEEPONEXIT = 0x02,
79 NVIC_LP_SLEEPDEEP = 0x04,
80 NVIC_LP_SEVONPEND = 0x10
81} nvic_lowpower_mode_type;
82
86typedef enum
87{
88 SYSTICK_CLOCK_SOURCE_AHBCLK_DIV8 = ((uint32_t)0x00000000),
89 SYSTICK_CLOCK_SOURCE_AHBCLK_NODIV = ((uint32_t)0x00000004)
90} systick_clock_source_type;
91
100void nvic_system_reset(void);
101void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority);
102void nvic_irq_disable(IRQn_Type irqn);
103void nvic_priority_group_config(nvic_priority_group_type priority_group);
104void nvic_vector_table_set(uint32_t base, uint32_t offset);
105void nvic_lowpower_mode_config(nvic_lowpower_mode_type lp_mode, confirm_state new_state);
106void systick_clock_source_config(systick_clock_source_type source);
107
120#ifdef __cplusplus
121}
122#endif
123
124#endif
at32f413.h
at32f413 header file
IRQn_Type
enum IRQn IRQn_Type
at32f413 interrupt number definition, according to the selected device in Library_configuration_secti...
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
nvic_lowpower_mode_config
void nvic_lowpower_mode_config(nvic_lowpower_mode_type lp_mode, confirm_state new_state)
config nvic lowpower mode
Definition at32f413_misc.c:126
nvic_system_reset
void nvic_system_reset(void)
system reset
Definition at32f413_misc.c:51
nvic_vector_table_set
void nvic_vector_table_set(uint32_t base, uint32_t offset)
set the vector table location and offset.
Definition at32f413_misc.c:111
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_irq_disable
void nvic_irq_disable(IRQn_Type irqn)
disable nvic irq number
Definition at32f413_misc.c:80
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
systick_clock_source_config
void systick_clock_source_config(systick_clock_source_type source)
config systick clock source
Definition at32f413_misc.c:146
nvic_lowpower_mode_type
nvic_lowpower_mode_type
nvic low power mode
Definition at32f413_misc.h:77
nvic_priority_group_type
nvic_priority_group_type
nvic interrupt priority group
Definition at32f413_misc.h:65
systick_clock_source_type
systick_clock_source_type
systick clock source
Definition at32f413_misc.h:87
NVIC_LP_SEVONPEND
@ NVIC_LP_SEVONPEND
Definition at32f413_misc.h:80
NVIC_LP_SLEEPONEXIT
@ NVIC_LP_SLEEPONEXIT
Definition at32f413_misc.h:78
NVIC_LP_SLEEPDEEP
@ NVIC_LP_SLEEPDEEP
Definition at32f413_misc.h:79
NVIC_PRIORITY_GROUP_1
@ NVIC_PRIORITY_GROUP_1
Definition at32f413_misc.h:67
NVIC_PRIORITY_GROUP_3
@ NVIC_PRIORITY_GROUP_3
Definition at32f413_misc.h:69
NVIC_PRIORITY_GROUP_2
@ NVIC_PRIORITY_GROUP_2
Definition at32f413_misc.h:68
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
NVIC_PRIORITY_GROUP_0
@ NVIC_PRIORITY_GROUP_0
Definition at32f413_misc.h:66
SYSTICK_CLOCK_SOURCE_AHBCLK_DIV8
@ SYSTICK_CLOCK_SOURCE_AHBCLK_DIV8
Definition at32f413_misc.h:88
SYSTICK_CLOCK_SOURCE_AHBCLK_NODIV
@ SYSTICK_CLOCK_SOURCE_AHBCLK_NODIV
Definition at32f413_misc.h:89


AT32F413 Firmwary Library: at32f413_pwc.c Source File

  • libraries
  • drivers
  • src
at32f413_pwc.c
Go to the documentation of this file.
1
26#include "at32f413_conf.h"
27
37#ifdef PWC_MODULE_ENABLED
38
48void pwc_reset(void)
49{
50 crm_periph_reset(CRM_PWC_PERIPH_RESET, TRUE);
51 crm_periph_reset(CRM_PWC_PERIPH_RESET, FALSE);
52}
53
60void pwc_battery_powered_domain_access(confirm_state new_state)
61{
62 PWC->ctrl_bit.bpwen = new_state;
63}
64
78void pwc_pvm_level_select(pwc_pvm_voltage_type pvm_voltage)
79{
80 PWC->ctrl_bit.pvmsel = pvm_voltage;
81}
82
89void pwc_power_voltage_monitor_enable(confirm_state new_state)
90{
91 PWC->ctrl_bit.pvmen = new_state;
92}
93
105void pwc_wakeup_pin_enable(uint32_t pin_num, confirm_state new_state)
106{
107 if(new_state == TRUE)
108 {
109 PWC->ctrlsts |= pin_num;
110 }
111 else
112 {
113 PWC->ctrlsts &= ~pin_num;
114 }
115}
116
126void pwc_flag_clear(uint32_t pwc_flag)
127{
128 if(pwc_flag & PWC_STANDBY_FLAG)
129 PWC->ctrl_bit.clsef = TRUE;
130 if(pwc_flag & PWC_WAKEUP_FLAG)
131 PWC->ctrl_bit.clswef = TRUE;
132}
133
143 flag_status pwc_flag_get(uint32_t pwc_flag)
144{
145 flag_status status = RESET;
146 if ((PWC->ctrlsts & pwc_flag) == RESET)
147 {
148 status = RESET;
149 }
150 else
151 {
152 status = SET;
153 }
154 return status;
155}
156
165void pwc_sleep_mode_enter(pwc_sleep_enter_type pwc_sleep_enter)
166{
167 SCB->SCR &= (uint32_t)~0x4;
168 if(pwc_sleep_enter == PWC_SLEEP_ENTER_WFE)
169 {
170 __SEV();
171 __WFE();
172 __WFE();
173 }
174 else if(pwc_sleep_enter == PWC_SLEEP_ENTER_WFI)
175 {
176 __WFI();
177 }
178}
179
188void pwc_deep_sleep_mode_enter(pwc_deep_sleep_enter_type pwc_deep_sleep_enter)
189{
190 SCB->SCR |= 0x04;
191 if(pwc_deep_sleep_enter == PWC_DEEP_SLEEP_ENTER_WFE)
192 {
193 __SEV();
194 __WFE();
195 __WFE();
196 }
197 else if(pwc_deep_sleep_enter == PWC_DEEP_SLEEP_ENTER_WFI)
198 {
199 __WFI();
200 }
201 SCB->SCR &= (uint32_t)~0x4;
202}
203
209void pwc_standby_mode_enter(void)
210{
211 PWC->ctrl_bit.clswef = TRUE;
212 PWC->ctrl_bit.lpsel = TRUE;
213 SCB->SCR |= 0x04;
214#if defined (__CC_ARM)
215 __force_stores();
216#endif
217 while(1)
218 {
219 __WFI();
220 }
221}
222
227#endif
228
crm_periph_reset
void crm_periph_reset(crm_periph_reset_type value, confirm_state new_state)
enable or disable the peripheral reset
Definition at32f413_crm.c:293
CRM_PWC_PERIPH_RESET
@ CRM_PWC_PERIPH_RESET
Definition at32f413_crm.h:184
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
flag_status
flag_status
flag status
Definition at32f413.h:292
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
SET
@ SET
Definition at32f413.h:292
pwc_pvm_voltage_type
pwc_pvm_voltage_type
pwc pvm voltage type
Definition at32f413_pwc.h:72
pwc_deep_sleep_enter_type
pwc_deep_sleep_enter_type
pwc deep sleep enter type
Definition at32f413_pwc.h:95
pwc_sleep_enter_type
pwc_sleep_enter_type
pwc sleep enter type
Definition at32f413_pwc.h:86
PWC_DEEP_SLEEP_ENTER_WFI
@ PWC_DEEP_SLEEP_ENTER_WFI
Definition at32f413_pwc.h:96
PWC_DEEP_SLEEP_ENTER_WFE
@ PWC_DEEP_SLEEP_ENTER_WFE
Definition at32f413_pwc.h:97
PWC_SLEEP_ENTER_WFI
@ PWC_SLEEP_ENTER_WFI
Definition at32f413_pwc.h:87
PWC_SLEEP_ENTER_WFE
@ PWC_SLEEP_ENTER_WFE
Definition at32f413_pwc.h:88
PWC_STANDBY_FLAG
#define PWC_STANDBY_FLAG
Definition at32f413_pwc.h:52
PWC_WAKEUP_FLAG
#define PWC_WAKEUP_FLAG
Definition at32f413_pwc.h:51
pwc_battery_powered_domain_access
void pwc_battery_powered_domain_access(confirm_state new_state)
enable or disable access to the battery powered domain.
Definition at32f413_pwc.c:60
pwc_standby_mode_enter
void pwc_standby_mode_enter(void)
enter pwc standby mode
Definition at32f413_pwc.c:209
pwc_power_voltage_monitor_enable
void pwc_power_voltage_monitor_enable(confirm_state new_state)
enable or disable pwc power voltage monitor (pvm)
Definition at32f413_pwc.c:89
pwc_sleep_mode_enter
void pwc_sleep_mode_enter(pwc_sleep_enter_type pwc_sleep_enter)
enter pwc sleep mode
Definition at32f413_pwc.c:165
pwc_deep_sleep_mode_enter
void pwc_deep_sleep_mode_enter(pwc_deep_sleep_enter_type pwc_deep_sleep_enter)
enter pwc deep-sleep mode
Definition at32f413_pwc.c:188
pwc_flag_get
flag_status pwc_flag_get(uint32_t pwc_flag)
get flag of pwc
Definition at32f413_pwc.c:143
pwc_flag_clear
void pwc_flag_clear(uint32_t pwc_flag)
clear flag of pwc
Definition at32f413_pwc.c:126
pwc_pvm_level_select
void pwc_pvm_level_select(pwc_pvm_voltage_type pvm_voltage)
select the voltage threshold detected by the power voltage detector.
Definition at32f413_pwc.c:78
pwc_reset
void pwc_reset(void)
deinitialize the pwc peripheral registers to their default reset values.
Definition at32f413_pwc.c:48
pwc_wakeup_pin_enable
void pwc_wakeup_pin_enable(uint32_t pin_num, confirm_state new_state)
enable or disable pwc standby wakeup pin
Definition at32f413_pwc.c:105
PWC
#define PWC
Definition at32f413_pwc.h:147
at32f413_conf.h
at32f413 config header file


AT32F413 Firmwary Library: at32f413_pwc.h Source File

  • libraries
  • drivers
  • inc
at32f413_pwc.h
Go to the documentation of this file.
1
26/* Define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_PWC_H
28#define __AT32F413_PWC_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34
35/* Includes ------------------------------------------------------------------*/
36#include "at32f413.h"
37
51#define PWC_WAKEUP_FLAG ((uint32_t)0x00000001)
52#define PWC_STANDBY_FLAG ((uint32_t)0x00000002)
53#define PWC_PVM_OUTPUT_FLAG ((uint32_t)0x00000004)
62#define PWC_WAKEUP_PIN_1 ((uint32_t)0x00000100)
71typedef enum
72{
73 PWC_PVM_VOLTAGE_2V3 = 0x01,
74 PWC_PVM_VOLTAGE_2V4 = 0x02,
75 PWC_PVM_VOLTAGE_2V5 = 0x03,
76 PWC_PVM_VOLTAGE_2V6 = 0x04,
77 PWC_PVM_VOLTAGE_2V7 = 0x05,
78 PWC_PVM_VOLTAGE_2V8 = 0x06,
79 PWC_PVM_VOLTAGE_2V9 = 0x07
80} pwc_pvm_voltage_type;
81
85typedef enum
86{
87 PWC_SLEEP_ENTER_WFI = 0x00,
88 PWC_SLEEP_ENTER_WFE = 0x01
89} pwc_sleep_enter_type;
90
94typedef enum
95{
96 PWC_DEEP_SLEEP_ENTER_WFI = 0x00,
97 PWC_DEEP_SLEEP_ENTER_WFE = 0x01
98} pwc_deep_sleep_enter_type;
99
103typedef struct
104{
108 union
109 {
110 __IO uint32_t ctrl;
111 struct
112 {
113 __IO uint32_t reserved1 : 1; /* [0] */
114 __IO uint32_t lpsel : 1; /* [1] */
115 __IO uint32_t clswef : 1; /* [2] */
116 __IO uint32_t clsef : 1; /* [3] */
117 __IO uint32_t pvmen : 1; /* [4] */
118 __IO uint32_t pvmsel : 3; /* [7:5] */
119 __IO uint32_t bpwen : 1; /* [8] */
120 __IO uint32_t reserved2 : 23;/* [31:9] */
121 } ctrl_bit;
122 };
123
127 union
128 {
129 __IO uint32_t ctrlsts;
130 struct
131 {
132 __IO uint32_t swef : 1; /* [0] */
133 __IO uint32_t sef : 1; /* [1] */
134 __IO uint32_t pvmof : 1; /* [2] */
135 __IO uint32_t reserved1 : 5; /* [7:3] */
136 __IO uint32_t swpen : 1; /* [8] */
137 __IO uint32_t reserved2 : 23;/* [31:9] */
138 } ctrlsts_bit;
139 };
140
141} pwc_type;
142
147#define PWC ((pwc_type *) PWC_BASE)
148
153void pwc_reset(void);
154void pwc_battery_powered_domain_access(confirm_state new_state);
155void pwc_pvm_level_select(pwc_pvm_voltage_type pvm_voltage);
156void pwc_power_voltage_monitor_enable(confirm_state new_state);
157void pwc_wakeup_pin_enable(uint32_t pin_num, confirm_state new_state);
158void pwc_flag_clear(uint32_t pwc_flag);
159 flag_status pwc_flag_get(uint32_t pwc_flag);
160void pwc_sleep_mode_enter(pwc_sleep_enter_type pwc_sleep_enter);
161void pwc_deep_sleep_mode_enter(pwc_deep_sleep_enter_type pwc_deep_sleep_enter);
162void pwc_standby_mode_enter(void);
163
176#ifdef __cplusplus
177}
178#endif
179
180#endif
at32f413.h
at32f413 header file
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
flag_status
flag_status
flag status
Definition at32f413.h:292
pwc_battery_powered_domain_access
void pwc_battery_powered_domain_access(confirm_state new_state)
enable or disable access to the battery powered domain.
Definition at32f413_pwc.c:60
pwc_standby_mode_enter
void pwc_standby_mode_enter(void)
enter pwc standby mode
Definition at32f413_pwc.c:209
pwc_power_voltage_monitor_enable
void pwc_power_voltage_monitor_enable(confirm_state new_state)
enable or disable pwc power voltage monitor (pvm)
Definition at32f413_pwc.c:89
pwc_sleep_mode_enter
void pwc_sleep_mode_enter(pwc_sleep_enter_type pwc_sleep_enter)
enter pwc sleep mode
Definition at32f413_pwc.c:165
pwc_deep_sleep_mode_enter
void pwc_deep_sleep_mode_enter(pwc_deep_sleep_enter_type pwc_deep_sleep_enter)
enter pwc deep-sleep mode
Definition at32f413_pwc.c:188
pwc_flag_get
flag_status pwc_flag_get(uint32_t pwc_flag)
get flag of pwc
Definition at32f413_pwc.c:143
pwc_flag_clear
void pwc_flag_clear(uint32_t pwc_flag)
clear flag of pwc
Definition at32f413_pwc.c:126
pwc_pvm_level_select
void pwc_pvm_level_select(pwc_pvm_voltage_type pvm_voltage)
select the voltage threshold detected by the power voltage detector.
Definition at32f413_pwc.c:78
pwc_reset
void pwc_reset(void)
deinitialize the pwc peripheral registers to their default reset values.
Definition at32f413_pwc.c:48
pwc_wakeup_pin_enable
void pwc_wakeup_pin_enable(uint32_t pin_num, confirm_state new_state)
enable or disable pwc standby wakeup pin
Definition at32f413_pwc.c:105
pwc_pvm_voltage_type
pwc_pvm_voltage_type
pwc pvm voltage type
Definition at32f413_pwc.h:72
pwc_deep_sleep_enter_type
pwc_deep_sleep_enter_type
pwc deep sleep enter type
Definition at32f413_pwc.h:95
pwc_sleep_enter_type
pwc_sleep_enter_type
pwc sleep enter type
Definition at32f413_pwc.h:86
PWC_PVM_VOLTAGE_2V7
@ PWC_PVM_VOLTAGE_2V7
Definition at32f413_pwc.h:77
PWC_PVM_VOLTAGE_2V3
@ PWC_PVM_VOLTAGE_2V3
Definition at32f413_pwc.h:73
PWC_PVM_VOLTAGE_2V8
@ PWC_PVM_VOLTAGE_2V8
Definition at32f413_pwc.h:78
PWC_PVM_VOLTAGE_2V4
@ PWC_PVM_VOLTAGE_2V4
Definition at32f413_pwc.h:74
PWC_PVM_VOLTAGE_2V5
@ PWC_PVM_VOLTAGE_2V5
Definition at32f413_pwc.h:75
PWC_PVM_VOLTAGE_2V6
@ PWC_PVM_VOLTAGE_2V6
Definition at32f413_pwc.h:76
PWC_PVM_VOLTAGE_2V9
@ PWC_PVM_VOLTAGE_2V9
Definition at32f413_pwc.h:79
PWC_DEEP_SLEEP_ENTER_WFI
@ PWC_DEEP_SLEEP_ENTER_WFI
Definition at32f413_pwc.h:96
PWC_DEEP_SLEEP_ENTER_WFE
@ PWC_DEEP_SLEEP_ENTER_WFE
Definition at32f413_pwc.h:97
PWC_SLEEP_ENTER_WFI
@ PWC_SLEEP_ENTER_WFI
Definition at32f413_pwc.h:87
PWC_SLEEP_ENTER_WFE
@ PWC_SLEEP_ENTER_WFE
Definition at32f413_pwc.h:88
pwc_type
type define pwc register all
Definition at32f413_pwc.h:104
pwc_type::bpwen
__IO uint32_t bpwen
Definition at32f413_pwc.h:119
pwc_type::clswef
__IO uint32_t clswef
Definition at32f413_pwc.h:115
pwc_type::pvmof
__IO uint32_t pvmof
Definition at32f413_pwc.h:134
pwc_type::lpsel
__IO uint32_t lpsel
Definition at32f413_pwc.h:114
pwc_type::reserved1
__IO uint32_t reserved1
Definition at32f413_pwc.h:113
pwc_type::pvmen
__IO uint32_t pvmen
Definition at32f413_pwc.h:117
pwc_type::ctrl
__IO uint32_t ctrl
Definition at32f413_pwc.h:110
pwc_type::swef
__IO uint32_t swef
Definition at32f413_pwc.h:132
pwc_type::clsef
__IO uint32_t clsef
Definition at32f413_pwc.h:116
pwc_type::ctrlsts
__IO uint32_t ctrlsts
Definition at32f413_pwc.h:129
pwc_type::sef
__IO uint32_t sef
Definition at32f413_pwc.h:133
pwc_type::reserved2
__IO uint32_t reserved2
Definition at32f413_pwc.h:120
pwc_type::swpen
__IO uint32_t swpen
Definition at32f413_pwc.h:136
pwc_type::pvmsel
__IO uint32_t pvmsel
Definition at32f413_pwc.h:118


AT32F413 Firmwary Library: at32f413_rtc.c Source File

  • libraries
  • drivers
  • src
at32f413_rtc.c
Go to the documentation of this file.
1
26#include "at32f413_conf.h"
27
37#ifdef RTC_MODULE_ENABLED
38
48void rtc_counter_set(uint32_t counter_value)
49{
50 /* enter rtc config mode */
51 RTC->ctrll = 0x003F;
52
53 /* set rtc counter */
54 RTC->cnth_bit.cnt = (uint16_t)(counter_value >> 16);
55 RTC->cntl_bit.cnt = (uint16_t)(counter_value & 0x0000FFFF);
56
57 /* exit rtc config mode */
58 RTC->ctrll = 0x000F;
59}
60
66uint32_t rtc_lowlevel_counter_get(void)
67{
68 uint32_t cnt = 0;
69
70 cnt = RTC->cnth;
71 cnt = (cnt << 16) | RTC->cntl;
72
73 return cnt;
74}
75
81uint32_t rtc_counter_get(void)
82{
83 uint32_t cnt1 = 0;
84 uint32_t cnt2 = 0;
85
86 while(1)
87 {
88 cnt1 = rtc_lowlevel_counter_get();
89 cnt2 = rtc_lowlevel_counter_get();
90
91 if(cnt1 == cnt2)
92 {
93 return cnt1;
94 }
95 }
96}
97
103void rtc_divider_set(uint32_t div_value)
104{
105 /* enter rtc config mode */
106 RTC->ctrll = 0x003F;
107
108 /* set rtc divider */
109 RTC->divh_bit.div = (uint16_t)(div_value >> 16);
110 RTC->divl_bit.div = (uint16_t)(div_value & 0x0000FFFF);
111
112 /* exit rtc config mode */
113 RTC->ctrll = 0x000F;
114}
115
121uint32_t rtc_divider_get(void)
122{
123 uint32_t div = 0;
124
125 div = RTC->divcnth;
126 div = (div << 16) | RTC->divcntl;
127
128 return div;
129}
130
136void rtc_alarm_set(uint32_t alarm_value)
137{
138 /* enter rtc config mode */
139 RTC->ctrll = 0x003F;
140
141 /* set rtc alarm value */
142 RTC->tah_bit.ta = (uint16_t)(alarm_value >> 16);
143 RTC->tal_bit.ta = (uint16_t)(alarm_value & 0x0000FFFF);
144
145 /* exit rtc config mode */
146 RTC->ctrll = 0x000F;
147}
148
159void rtc_interrupt_enable(uint16_t source, confirm_state new_state)
160{
161 if(new_state == FALSE)
162 {
163 RTC->ctrlh &= ~source;
164 }
165 else
166 {
167 RTC->ctrlh |= source;
168 }
169}
170
182 flag_status rtc_flag_get(uint16_t flag)
183{
184 flag_status status = RESET;
185
186 if ((RTC->ctrll & flag) != (uint16_t)RESET)
187 {
188 status = SET;
189 }
190 else
191 {
192 status = RESET;
193 }
194
195 return status;
196}
197
207 flag_status rtc_interrupt_flag_get(uint16_t flag)
208{
209 flag_status status = RESET;
210
211 if (((RTC->ctrll & flag) != (uint16_t)RESET) && ((RTC->ctrlh & flag) != (uint16_t)RESET))
212 {
213 status = SET;
214 }
215 else
216 {
217 status = RESET;
218 }
219
220 return status;
221}
222
233void rtc_flag_clear(uint16_t flag)
234{
235 RTC->ctrll = ~(flag | 0x10) | (RTC->ctrll_bit.cfgen << 4);
236}
237
243void rtc_wait_config_finish(void)
244{
245 while (RTC->ctrll_bit.cfgf == 0);
246}
247
253void rtc_wait_update_finish(void)
254{
255 while (RTC->ctrll_bit.updf == 0);
256}
257
262#endif
263
div_value
uint16_t div_value
Definition project/at_start_f413/examples/tmr/oc_high/src/main.c:43
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
flag_status
flag_status
flag status
Definition at32f413.h:292
FALSE
@ FALSE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
SET
@ SET
Definition at32f413.h:292
rtc_interrupt_flag_get
flag_status rtc_interrupt_flag_get(uint16_t flag)
rtc interrupt flag get
Definition at32f413_rtc.c:207
rtc_alarm_set
void rtc_alarm_set(uint32_t alarm_value)
rtc alarm value set
Definition at32f413_rtc.c:136
rtc_divider_get
uint32_t rtc_divider_get(void)
rtc divider get
Definition at32f413_rtc.c:121
rtc_wait_config_finish
void rtc_wait_config_finish(void)
rtc wait configuration finish
Definition at32f413_rtc.c:243
rtc_flag_get
flag_status rtc_flag_get(uint16_t flag)
rtc flag get
Definition at32f413_rtc.c:182
rtc_counter_get
uint32_t rtc_counter_get(void)
rtc counter get
Definition at32f413_rtc.c:81
rtc_wait_update_finish
void rtc_wait_update_finish(void)
rtc wait update finish
Definition at32f413_rtc.c:253
rtc_lowlevel_counter_get
uint32_t rtc_lowlevel_counter_get(void)
rtc lowlevel counter get
Definition at32f413_rtc.c:66
rtc_interrupt_enable
void rtc_interrupt_enable(uint16_t source, confirm_state new_state)
rtc interrupt enable
Definition at32f413_rtc.c:159
rtc_counter_set
void rtc_counter_set(uint32_t counter_value)
rtc counter set
Definition at32f413_rtc.c:48
rtc_flag_clear
void rtc_flag_clear(uint16_t flag)
rtc flag clear
Definition at32f413_rtc.c:233
rtc_divider_set
void rtc_divider_set(uint32_t div_value)
rtc divider set
Definition at32f413_rtc.c:103
RTC
#define RTC
Definition at32f413_rtc.h:227
at32f413_conf.h
at32f413 config header file


AT32F413 Firmwary Library: at32f413_rtc.h Source File

  • libraries
  • drivers
  • inc
at32f413_rtc.h
Go to the documentation of this file.
1
26/* Define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_RTC_H
28#define __AT32F413_RTC_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34
35/* Includes ------------------------------------------------------------------*/
36#include "at32f413.h"
37
51#define RTC_TS_INT ((uint16_t)0x0001)
52#define RTC_TA_INT ((uint16_t)0x0002)
53#define RTC_OVF_INT ((uint16_t)0x0004)
64#define RTC_TS_FLAG ((uint16_t)0x0001)
65#define RTC_TA_FLAG ((uint16_t)0x0002)
66#define RTC_OVF_FLAG ((uint16_t)0x0004)
67#define RTC_UPDF_FLAG ((uint16_t)0x0008)
68#define RTC_CFGF_FLAG ((uint16_t)0x0020)
81typedef struct
82{
83
87 union
88 {
89 __IO uint32_t ctrlh;
90 struct
91 {
92 __IO uint32_t tsien : 1; /* [0] */
93 __IO uint32_t taien : 1; /* [1] */
94 __IO uint32_t ovfien : 1; /* [2] */
95 __IO uint32_t reserved1 : 29;/* [31:3] */
96 } ctrlh_bit;
97 };
98
102 union
103 {
104 __IO uint32_t ctrll;
105 struct
106 {
107 __IO uint32_t tsf : 1; /* [0] */
108 __IO uint32_t taf : 1; /* [1] */
109 __IO uint32_t ovff : 1; /* [2] */
110 __IO uint32_t updf : 1; /* [3] */
111 __IO uint32_t cfgen : 1; /* [4] */
112 __IO uint32_t cfgf : 1; /* [5] */
113 __IO uint32_t reserved1 : 26;/* [31:6] */
114 } ctrll_bit;
115 };
116
120 union
121 {
122 __IO uint32_t divh;
123 struct
124 {
125 __IO uint32_t div : 4; /* [3:0] */
126 __IO uint32_t reserved1 : 28;/* [31:4] */
127 } divh_bit;
128 };
129
133 union
134 {
135 __IO uint32_t divl;
136 struct
137 {
138 __IO uint32_t div : 16;/* [15:0] */
139 __IO uint32_t reserved1 : 16;/* [31:15] */
140 } divl_bit;
141 };
142
146 union
147 {
148 __IO uint32_t divcnth;
149 struct
150 {
151 __IO uint32_t divcnt : 4; /* [3:0] */
152 __IO uint32_t reserved1 : 28;/* [31:15] */
153 } divcnth_bit;
154 };
155
159 union
160 {
161 __IO uint32_t divcntl;
162 struct
163 {
164 __IO uint32_t divcnt : 16;/* [15:0] */
165 __IO uint32_t reserved1 : 16;/* [31:15] */
166 } divcntl_bit;
167 };
168
172 union
173 {
174 __IO uint32_t cnth;
175 struct
176 {
177 __IO uint32_t cnt : 16;/* [15:0] */
178 __IO uint32_t reserved1 : 16;/* [31:15] */
179 } cnth_bit;
180 };
181
185 union
186 {
187 __IO uint32_t cntl;
188 struct
189 {
190 __IO uint32_t cnt : 16;/* [15:0] */
191 __IO uint32_t reserved1 : 16;/* [31:15] */
192 } cntl_bit;
193 };
194
198 union
199 {
200 __IO uint32_t tah;
201 struct
202 {
203 __IO uint32_t ta : 16;/* [15:0] */
204 __IO uint32_t reserved1 : 16;/* [31:15] */
205 } tah_bit;
206 };
207
211 union
212 {
213 __IO uint32_t tal;
214 struct
215 {
216 __IO uint32_t ta : 16;/* [15:0] */
217 __IO uint32_t reserved1 : 16;/* [31:15] */
218 } tal_bit;
219 };
220
221} rtc_type;
222
227#define RTC ((rtc_type *) RTC_BASE)
228
233void rtc_counter_set(uint32_t counter_value);
234uint32_t rtc_counter_get(void);
235void rtc_divider_set(uint32_t div_value);
236uint32_t rtc_divider_get(void);
237void rtc_alarm_set(uint32_t alarm_value);
238void rtc_interrupt_enable(uint16_t source, confirm_state new_state);
239 flag_status rtc_flag_get(uint16_t flag);
240 flag_status rtc_interrupt_flag_get(uint16_t flag);
241void rtc_flag_clear(uint16_t flag);
242void rtc_wait_config_finish(void);
243void rtc_wait_update_finish(void);
244
257#ifdef __cplusplus
258}
259#endif
260
261#endif
at32f413.h
at32f413 header file
div_value
uint16_t div_value
Definition project/at_start_f413/examples/tmr/oc_high/src/main.c:43
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
flag_status
flag_status
flag status
Definition at32f413.h:292
rtc_interrupt_flag_get
flag_status rtc_interrupt_flag_get(uint16_t flag)
rtc interrupt flag get
Definition at32f413_rtc.c:207
rtc_alarm_set
void rtc_alarm_set(uint32_t alarm_value)
rtc alarm value set
Definition at32f413_rtc.c:136
rtc_divider_get
uint32_t rtc_divider_get(void)
rtc divider get
Definition at32f413_rtc.c:121
rtc_wait_config_finish
void rtc_wait_config_finish(void)
rtc wait configuration finish
Definition at32f413_rtc.c:243
rtc_flag_get
flag_status rtc_flag_get(uint16_t flag)
rtc flag get
Definition at32f413_rtc.c:182
rtc_counter_get
uint32_t rtc_counter_get(void)
rtc counter get
Definition at32f413_rtc.c:81
rtc_wait_update_finish
void rtc_wait_update_finish(void)
rtc wait update finish
Definition at32f413_rtc.c:253
rtc_interrupt_enable
void rtc_interrupt_enable(uint16_t source, confirm_state new_state)
rtc interrupt enable
Definition at32f413_rtc.c:159
rtc_counter_set
void rtc_counter_set(uint32_t counter_value)
rtc counter set
Definition at32f413_rtc.c:48
rtc_flag_clear
void rtc_flag_clear(uint16_t flag)
rtc flag clear
Definition at32f413_rtc.c:233
rtc_divider_set
void rtc_divider_set(uint32_t div_value)
rtc divider set
Definition at32f413_rtc.c:103
rtc_type
type define rtc register all
Definition at32f413_rtc.h:82
rtc_type::div
__IO uint32_t div
Definition at32f413_rtc.h:125
rtc_type::cntl
__IO uint32_t cntl
Definition at32f413_rtc.h:187
rtc_type::tsien
__IO uint32_t tsien
Definition at32f413_rtc.h:92
rtc_type::ovff
__IO uint32_t ovff
Definition at32f413_rtc.h:109
rtc_type::cfgf
__IO uint32_t cfgf
Definition at32f413_rtc.h:112
rtc_type::ovfien
__IO uint32_t ovfien
Definition at32f413_rtc.h:94
rtc_type::divl
__IO uint32_t divl
Definition at32f413_rtc.h:135
rtc_type::cnt
__IO uint32_t cnt
Definition at32f413_rtc.h:177
rtc_type::taf
__IO uint32_t taf
Definition at32f413_rtc.h:108
rtc_type::divcnth
__IO uint32_t divcnth
Definition at32f413_rtc.h:148
rtc_type::ta
__IO uint32_t ta
Definition at32f413_rtc.h:203
rtc_type::cfgen
__IO uint32_t cfgen
Definition at32f413_rtc.h:111
rtc_type::cnth
__IO uint32_t cnth
Definition at32f413_rtc.h:174
rtc_type::ctrll
__IO uint32_t ctrll
Definition at32f413_rtc.h:104
rtc_type::updf
__IO uint32_t updf
Definition at32f413_rtc.h:110
rtc_type::tsf
__IO uint32_t tsf
Definition at32f413_rtc.h:107
rtc_type::divh
__IO uint32_t divh
Definition at32f413_rtc.h:122
rtc_type::reserved1
__IO uint32_t reserved1
Definition at32f413_rtc.h:95
rtc_type::tal
__IO uint32_t tal
Definition at32f413_rtc.h:213
rtc_type::divcnt
__IO uint32_t divcnt
Definition at32f413_rtc.h:151
rtc_type::divcntl
__IO uint32_t divcntl
Definition at32f413_rtc.h:161
rtc_type::taien
__IO uint32_t taien
Definition at32f413_rtc.h:93
rtc_type::tah
__IO uint32_t tah
Definition at32f413_rtc.h:200
rtc_type::ctrlh
__IO uint32_t ctrlh
Definition at32f413_rtc.h:89


AT32F413 Firmwary Library: at32f413_sdio.c Source File

  • libraries
  • drivers
  • src
at32f413_sdio.c
Go to the documentation of this file.
1
26#include "at32f413_conf.h"
27
37#ifdef SDIO_MODULE_ENABLED
38
50void sdio_reset(sdio_type *sdio_x)
51{
52 sdio_x->pwrctrl = 0x0;
53 sdio_x->clkctrl = 0x0;
54 sdio_x->argu = 0x0;
55 sdio_x->cmdctrl = 0x0;
56 sdio_x->dttmr = 0x0;
57 sdio_x->dtlen = 0x0;
58 sdio_x->dtctrl = 0x0;
59 sdio_x->inten = 0x0;
60 sdio_x->intclr = 0x004007FF;
61}
62
74void sdio_power_set(sdio_type *sdio_x, sdio_power_state_type power_state)
75{
76 sdio_x->pwrctrl_bit.ps = power_state;
77}
78
86 sdio_power_state_type sdio_power_status_get(sdio_type *sdio_x)
87{
88 return (sdio_power_state_type)(sdio_x->pwrctrl_bit.ps);
89}
90
103void sdio_clock_config(sdio_type *sdio_x, uint16_t clk_div, sdio_edge_phase_type clk_edg)
104{
105 /* config clock edge */
106 sdio_x->clkctrl_bit.clkegs = clk_edg;
107
108 /* config clock divide [7:0] */
109 sdio_x->clkctrl_bit.clkdiv_l = (clk_div & 0xFF);
110
111 /* config clock divide [9:8] */
112 sdio_x->clkctrl_bit.clkdiv_h = ((clk_div & 0x300) >> 8);
113}
114
127void sdio_bus_width_config(sdio_type *sdio_x, sdio_bus_width_type width)
128{
129 sdio_x->clkctrl_bit.busws = width;
130}
131
140void sdio_clock_bypass(sdio_type *sdio_x, confirm_state new_state)
141{
142 sdio_x->clkctrl_bit.bypsen = new_state;
143}
144
154void sdio_power_saving_mode_enable(sdio_type *sdio_x, confirm_state new_state)
155{
156 sdio_x->clkctrl_bit.pwrsven = new_state;
157}
158
167void sdio_flow_control_enable(sdio_type *sdio_x, confirm_state new_state)
168{
169 sdio_x->clkctrl_bit.hfcen = new_state;
170}
171
180void sdio_clock_enable(sdio_type *sdio_x, confirm_state new_state)
181{
182 sdio_x->clkctrl_bit.clkoen = new_state;
183}
184
193void sdio_dma_enable(sdio_type *sdio_x, confirm_state new_state)
194{
195 sdio_x->dtctrl_bit.dmaen = new_state;
196}
197
231void sdio_interrupt_enable(sdio_type *sdio_x, uint32_t int_opt, confirm_state new_state)
232{
233 /* enable interrupt */
234 if(TRUE == new_state)
235 {
236 sdio_x->inten |= int_opt;
237 }
238 /* disable interrupt */
239 else
240 {
241 sdio_x->inten &= ~(int_opt);
242 }
243}
244
277 flag_status sdio_interrupt_flag_get(sdio_type *sdio_x, uint32_t flag)
278{
279 flag_status status = RESET;
280
281 if((sdio_x->inten & flag) && (sdio_x->sts & flag))
282 {
283 status = SET;
284 }
285
286 return status;
287}
288
321 flag_status sdio_flag_get(sdio_type *sdio_x, uint32_t flag)
322{
323 flag_status status = RESET;
324
325 if((sdio_x->sts & flag) == flag)
326 {
327 status = SET;
328 }
329 else
330 {
331 status = RESET;
332 }
333
334 return status;
335}
336
358void sdio_flag_clear(sdio_type *sdio_x, uint32_t flag)
359{
360 sdio_x->intclr = flag;
361}
362
372void sdio_command_config(sdio_type *sdio_x, sdio_command_struct_type *command_struct)
373{
374 /* disable command path state machine */
375 sdio_x->cmdctrl_bit.ccsmen = FALSE;
376
377 /* config command argument */
378 sdio_x->argu = command_struct->argument;
379
380 /* config command register */
381 sdio_x->cmdctrl_bit.cmdidx = command_struct->cmd_index;
382 sdio_x->cmdctrl_bit.rspwt = command_struct->rsp_type;
383 sdio_x->cmdctrl_bit.intwt = (command_struct->wait_type & 0x1); /* [1:0] -> [0] */
384 sdio_x->cmdctrl_bit.pndwt = (command_struct->wait_type & 0x2)>>1; /* [1:0] -> [1] */
385}
386
395void sdio_command_state_machine_enable(sdio_type *sdio_x, confirm_state new_state)
396{
397 sdio_x->cmdctrl_bit.ccsmen = new_state;
398}
399
408uint8_t sdio_command_response_get(sdio_type *sdio_x)
409{
410 return sdio_x->rspcmd_bit.rspcmd;
411}
412
426uint32_t sdio_response_get(sdio_type *sdio_x, sdio_rsp_index_type reg_index)
427{
428 uint32_t response_value = 0;
429
430 switch(reg_index)
431 {
432 case SDIO_RSP1_INDEX:
433 response_value = sdio_x->rsp1;
434 break;
435 case SDIO_RSP2_INDEX:
436 response_value = sdio_x->rsp2;
437 break;
438 case SDIO_RSP3_INDEX:
439 response_value = sdio_x->rsp3;
440 break;
441 case SDIO_RSP4_INDEX:
442 response_value = sdio_x->rsp4;
443 break;
444 default: break;
445 }
446
447 return response_value;
448}
449
459void sdio_data_config(sdio_type *sdio_x, sdio_data_struct_type *data_struct)
460{
461 /* disable data path state machine */
462 sdio_x->dtctrl_bit.tfren = FALSE;
463
464 /* config data block, transfer mode and transfer direction */
465 sdio_x->dtctrl_bit.blksize = data_struct->block_size;
466 sdio_x->dtctrl_bit.tfrdir = data_struct->transfer_direction;
467 sdio_x->dtctrl_bit.tfrmode = data_struct->transfer_mode;
468
469 /* config data length */
470 sdio_x->dtlen_bit.dtlen = data_struct->data_length;
471
472 /* config data transfer timeout */
473 sdio_x->dttmr_bit.timeout = data_struct->timeout;
474}
475
484void sdio_data_state_machine_enable(sdio_type *sdio_x, confirm_state new_state)
485{
486 sdio_x->dtctrl_bit.tfren = new_state;
487}
488
496uint32_t sdio_data_counter_get(sdio_type *sdio_x)
497{
498 return sdio_x->dtcnt;
499}
500
508uint32_t sdio_data_read(sdio_type *sdio_x)
509{
510 return sdio_x->buf;
511}
512
520uint32_t sdio_buffer_counter_get(sdio_type *sdio_x)
521{
522 return sdio_x->bufcnt;
523}
524
533void sdio_data_write(sdio_type *sdio_x, uint32_t data)
534{
535 sdio_x->buf = data;
536}
537
549void sdio_read_wait_mode_set(sdio_type *sdio_x, sdio_read_wait_mode_type mode)
550{
551 sdio_x->dtctrl_bit.rdwtmode = mode;
552}
553
562void sdio_read_wait_start(sdio_type *sdio_x, confirm_state new_state)
563{
564 sdio_x->dtctrl_bit.rdwtstart = new_state;
565}
566
575void sdio_read_wait_stop(sdio_type *sdio_x, confirm_state new_state)
576{
577 sdio_x->dtctrl_bit.rdwtstop = new_state;
578}
579
588void sdio_io_function_enable(sdio_type *sdio_x, confirm_state new_state)
589{
590 sdio_x->dtctrl_bit.ioen = new_state;
591}
592
601void sdio_io_suspend_command_set(sdio_type *sdio_x, confirm_state new_state)
602{
603 sdio_x->cmdctrl_bit.iosusp = new_state;
604}
605
610#endif
611
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
flag_status
flag_status
flag status
Definition at32f413.h:292
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
SET
@ SET
Definition at32f413.h:292
sdio_read_wait_mode_type
sdio_read_wait_mode_type
sdio read wait mode
Definition at32f413_sdio.h:219
sdio_edge_phase_type
sdio_edge_phase_type
sdio edge phase
Definition at32f413_sdio.h:129
sdio_power_state_type
sdio_power_state_type
sdio power state
Definition at32f413_sdio.h:120
sdio_bus_width_type
sdio_bus_width_type
sdio bus width
Definition at32f413_sdio.h:138
sdio_rsp_index_type
sdio_rsp_index_type
sdio response register index
Definition at32f413_sdio.h:168
SDIO_RSP3_INDEX
@ SDIO_RSP3_INDEX
Definition at32f413_sdio.h:171
SDIO_RSP2_INDEX
@ SDIO_RSP2_INDEX
Definition at32f413_sdio.h:170
SDIO_RSP4_INDEX
@ SDIO_RSP4_INDEX
Definition at32f413_sdio.h:172
SDIO_RSP1_INDEX
@ SDIO_RSP1_INDEX
Definition at32f413_sdio.h:169
sdio_command_config
void sdio_command_config(sdio_type *sdio_x, sdio_command_struct_type *command_struct)
config sdio command.
Definition at32f413_sdio.c:372
sdio_data_write
void sdio_data_write(sdio_type *sdio_x, uint32_t data)
write one word data to fifo.
Definition at32f413_sdio.c:533
sdio_io_suspend_command_set
void sdio_io_suspend_command_set(sdio_type *sdio_x, confirm_state new_state)
enable or disable sd i/o suspend command sending.
Definition at32f413_sdio.c:601
sdio_data_config
void sdio_data_config(sdio_type *sdio_x, sdio_data_struct_type *data_struct)
config sdio data.
Definition at32f413_sdio.c:459
sdio_data_read
uint32_t sdio_data_read(sdio_type *sdio_x)
read a word data from sdio fifo.
Definition at32f413_sdio.c:508
sdio_io_function_enable
void sdio_io_function_enable(sdio_type *sdio_x, confirm_state new_state)
enable or disable the sd i/o function.
Definition at32f413_sdio.c:588
sdio_command_state_machine_enable
void sdio_command_state_machine_enable(sdio_type *sdio_x, confirm_state new_state)
enable or disable command path state machine(CPSM).
Definition at32f413_sdio.c:395
sdio_clock_bypass
void sdio_clock_bypass(sdio_type *sdio_x, confirm_state new_state)
enable or disable clock divider bypss
Definition at32f413_sdio.c:140
sdio_flow_control_enable
void sdio_flow_control_enable(sdio_type *sdio_x, confirm_state new_state)
enable or disable hardware flow control.
Definition at32f413_sdio.c:167
sdio_power_set
void sdio_power_set(sdio_type *sdio_x, sdio_power_state_type power_state)
set the power status of the controller
Definition at32f413_sdio.c:74
sdio_clock_config
void sdio_clock_config(sdio_type *sdio_x, uint16_t clk_div, sdio_edge_phase_type clk_edg)
config sdio clock
Definition at32f413_sdio.c:103
sdio_bus_width_config
void sdio_bus_width_config(sdio_type *sdio_x, sdio_bus_width_type width)
config sdio bus width
Definition at32f413_sdio.c:127
sdio_read_wait_stop
void sdio_read_wait_stop(sdio_type *sdio_x, confirm_state new_state)
enable or disable to stop sd i/o read wait operation.
Definition at32f413_sdio.c:575
sdio_interrupt_enable
void sdio_interrupt_enable(sdio_type *sdio_x, uint32_t int_opt, confirm_state new_state)
config corresponding interrupt.
Definition at32f413_sdio.c:231
sdio_flag_clear
void sdio_flag_clear(sdio_type *sdio_x, uint32_t flag)
clear sdio flag.
Definition at32f413_sdio.c:358
sdio_power_status_get
sdio_power_state_type sdio_power_status_get(sdio_type *sdio_x)
get power status.
Definition at32f413_sdio.c:86
sdio_response_get
uint32_t sdio_response_get(sdio_type *sdio_x, sdio_rsp_index_type reg_index)
get response received from the card for the last command.
Definition at32f413_sdio.c:426
sdio_data_state_machine_enable
void sdio_data_state_machine_enable(sdio_type *sdio_x, confirm_state new_state)
enable or disable data path state machine(DPSM).
Definition at32f413_sdio.c:484
sdio_power_saving_mode_enable
void sdio_power_saving_mode_enable(sdio_type *sdio_x, confirm_state new_state)
enable or disable power saving mode, config sdio_ck clock output when the bus is idle.
Definition at32f413_sdio.c:154
sdio_flag_get
flag_status sdio_flag_get(sdio_type *sdio_x, uint32_t flag)
get sdio flag.
Definition at32f413_sdio.c:321
sdio_dma_enable
void sdio_dma_enable(sdio_type *sdio_x, confirm_state new_state)
enable or disable dma.
Definition at32f413_sdio.c:193
sdio_data_counter_get
uint32_t sdio_data_counter_get(sdio_type *sdio_x)
get the number of remaining data bytes to be transferred.
Definition at32f413_sdio.c:496
sdio_buffer_counter_get
uint32_t sdio_buffer_counter_get(sdio_type *sdio_x)
get the number of words left to be written to or read from fifo..
Definition at32f413_sdio.c:520
sdio_read_wait_start
void sdio_read_wait_start(sdio_type *sdio_x, confirm_state new_state)
enable or disable to start sd i/o read wait operation.
Definition at32f413_sdio.c:562
sdio_reset
void sdio_reset(sdio_type *sdio_x)
reset the sdio register
Definition at32f413_sdio.c:50
sdio_interrupt_flag_get
flag_status sdio_interrupt_flag_get(sdio_type *sdio_x, uint32_t flag)
get sdio interrupt flag.
Definition at32f413_sdio.c:277
sdio_read_wait_mode_set
void sdio_read_wait_mode_set(sdio_type *sdio_x, sdio_read_wait_mode_type mode)
set the read wait mode.
Definition at32f413_sdio.c:549
sdio_clock_enable
void sdio_clock_enable(sdio_type *sdio_x, confirm_state new_state)
enable or disable sdio_ck output.
Definition at32f413_sdio.c:180
sdio_command_response_get
uint8_t sdio_command_response_get(sdio_type *sdio_x)
get command index of last command for which response received.
Definition at32f413_sdio.c:408
at32f413_conf.h
at32f413 config header file
sdio_command_struct_type
sdio command structure
Definition at32f413_sdio.h:228
sdio_command_struct_type::cmd_index
uint8_t cmd_index
Definition at32f413_sdio.h:230
sdio_command_struct_type::argument
uint32_t argument
Definition at32f413_sdio.h:229
sdio_command_struct_type::wait_type
sdio_wait_type wait_type
Definition at32f413_sdio.h:232
sdio_command_struct_type::rsp_type
sdio_reponse_type rsp_type
Definition at32f413_sdio.h:231
sdio_data_struct_type
sdio data structure
Definition at32f413_sdio.h:239
sdio_data_struct_type::block_size
sdio_block_size_type block_size
Definition at32f413_sdio.h:242
sdio_data_struct_type::transfer_direction
sdio_transfer_direction_type transfer_direction
Definition at32f413_sdio.h:244
sdio_data_struct_type::timeout
uint32_t timeout
Definition at32f413_sdio.h:240
sdio_data_struct_type::transfer_mode
sdio_transfer_mode_type transfer_mode
Definition at32f413_sdio.h:243
sdio_data_struct_type::data_length
uint32_t data_length
Definition at32f413_sdio.h:241
sdio_type
type define sdio register all
Definition at32f413_sdio.h:251
sdio_type::ps
__IO uint32_t ps
Definition at32f413_sdio.h:260
sdio_type::dtlen_bit
struct sdio_type::@590::@616 dtlen_bit
sdio_type::dtlen
__IO uint32_t dtlen
Definition at32f413_sdio.h:393
sdio_type::intclr
__IO uint32_t intclr
Definition at32f413_sdio.h:475
sdio_type::rdwtstart
__IO uint32_t rdwtstart
Definition at32f413_sdio.h:414
sdio_type::rdwtstop
__IO uint32_t rdwtstop
Definition at32f413_sdio.h:415
sdio_type::rspwt
__IO uint32_t rspwt
Definition at32f413_sdio.h:306
sdio_type::hfcen
__IO uint32_t hfcen
Definition at32f413_sdio.h:279
sdio_type::tfrmode
__IO uint32_t tfrmode
Definition at32f413_sdio.h:411
sdio_type::clkegs
__IO uint32_t clkegs
Definition at32f413_sdio.h:278
sdio_type::tfrdir
__IO uint32_t tfrdir
Definition at32f413_sdio.h:410
sdio_type::tfren
__IO uint32_t tfren
Definition at32f413_sdio.h:409
sdio_type::dttmr
__IO uint32_t dttmr
Definition at32f413_sdio.h:381
sdio_type::clkctrl_bit
struct sdio_type::@572::@607 clkctrl_bit
sdio_type::inten
__IO uint32_t inten
Definition at32f413_sdio.h:500
sdio_type::pndwt
__IO uint32_t pndwt
Definition at32f413_sdio.h:308
sdio_type::cmdctrl
__IO uint32_t cmdctrl
Definition at32f413_sdio.h:302
sdio_type::clkoen
__IO uint32_t clkoen
Definition at32f413_sdio.h:274
sdio_type::ioen
__IO uint32_t ioen
Definition at32f413_sdio.h:417
sdio_type::bufcnt
__IO uint32_t bufcnt
Definition at32f413_sdio.h:540
sdio_type::intwt
__IO uint32_t intwt
Definition at32f413_sdio.h:307
sdio_type::rsp2
__IO uint32_t rsp2
Definition at32f413_sdio.h:345
sdio_type::dtctrl
__IO uint32_t dtctrl
Definition at32f413_sdio.h:406
sdio_type::pwrctrl_bit
struct sdio_type::@570::@606 pwrctrl_bit
sdio_type::ccsmen
__IO uint32_t ccsmen
Definition at32f413_sdio.h:309
sdio_type::pwrsven
__IO uint32_t pwrsven
Definition at32f413_sdio.h:275
sdio_type::cmdidx
__IO uint32_t cmdidx
Definition at32f413_sdio.h:305
sdio_type::pwrctrl
__IO uint32_t pwrctrl
Definition at32f413_sdio.h:257
sdio_type::dmaen
__IO uint32_t dmaen
Definition at32f413_sdio.h:412
sdio_type::sts
__IO uint32_t sts
Definition at32f413_sdio.h:440
sdio_type::blksize
__IO uint32_t blksize
Definition at32f413_sdio.h:413
sdio_type::rdwtmode
__IO uint32_t rdwtmode
Definition at32f413_sdio.h:416
sdio_type::rsp1
__IO uint32_t rsp1
Definition at32f413_sdio.h:333
sdio_type::rsp4
__IO uint32_t rsp4
Definition at32f413_sdio.h:369
sdio_type::bypsen
__IO uint32_t bypsen
Definition at32f413_sdio.h:276
sdio_type::rspcmd_bit
struct sdio_type::@578::@610 rspcmd_bit
sdio_type::buf
__IO uint32_t buf
Definition at32f413_sdio.h:558
sdio_type::dtctrl_bit
struct sdio_type::@592::@617 dtctrl_bit
sdio_type::dttmr_bit
struct sdio_type::@588::@615 dttmr_bit
sdio_type::clkdiv_l
__IO uint32_t clkdiv_l
Definition at32f413_sdio.h:273
sdio_type::cmdctrl_bit
struct sdio_type::@576::@609 cmdctrl_bit
sdio_type::rspcmd
__IO uint32_t rspcmd
Definition at32f413_sdio.h:320
sdio_type::argu
__IO uint32_t argu
Definition at32f413_sdio.h:290
sdio_type::timeout
__IO uint32_t timeout
Definition at32f413_sdio.h:384
sdio_type::busws
__IO uint32_t busws
Definition at32f413_sdio.h:277
sdio_type::dtcnt
__IO uint32_t dtcnt
Definition at32f413_sdio.h:427
sdio_type::clkdiv_h
__IO uint32_t clkdiv_h
Definition at32f413_sdio.h:280
sdio_type::iosusp
__IO uint32_t iosusp
Definition at32f413_sdio.h:310
sdio_type::clkctrl
__IO uint32_t clkctrl
Definition at32f413_sdio.h:270
sdio_type::rsp3
__IO uint32_t rsp3
Definition at32f413_sdio.h:357


AT32F413 Firmwary Library: at32f413_sdio.h Source File

  • libraries
  • drivers
  • inc
at32f413_sdio.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_SDIO_H
28#define __AT32F413_SDIO_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34
35/* includes ------------------------------------------------------------------*/
36#include "at32f413.h"
37
51#define SDIO_CMDFAIL_INT ((uint32_t)0x00000001)
52#define SDIO_DTFAIL_INT ((uint32_t)0x00000002)
53#define SDIO_CMDTIMEOUT_INT ((uint32_t)0x00000004)
54#define SDIO_DTTIMEOUT_INT ((uint32_t)0x00000008)
55#define SDIO_TXERRU_INT ((uint32_t)0x00000010)
56#define SDIO_RXERRO_INT ((uint32_t)0x00000020)
57#define SDIO_CMDRSPCMPL_INT ((uint32_t)0x00000040)
58#define SDIO_CMDCMPL_INT ((uint32_t)0x00000080)
59#define SDIO_DTCMP_INT ((uint32_t)0x00000100)
60#define SDIO_SBITERR_INT ((uint32_t)0x00000200)
61#define SDIO_DTBLKCMPL_INT ((uint32_t)0x00000400)
62#define SDIO_DOCMD_INT ((uint32_t)0x00000800)
63#define SDIO_DOTX_INT ((uint32_t)0x00001000)
64#define SDIO_DORX_INT ((uint32_t)0x00002000)
65#define SDIO_TXBUFH_INT ((uint32_t)0x00004000)
66#define SDIO_RXBUFH_INT ((uint32_t)0x00008000)
67#define SDIO_TXBUFF_INT ((uint32_t)0x00010000)
68#define SDIO_RXBUFF_INT ((uint32_t)0x00020000)
69#define SDIO_TXBUFE_INT ((uint32_t)0x00040000)
70#define SDIO_RXBUFE_INT ((uint32_t)0x00080000)
71#define SDIO_TXBUF_INT ((uint32_t)0x00100000)
72#define SDIO_RXBUF_INT ((uint32_t)0x00200000)
73#define SDIO_SDIOIF_INT ((uint32_t)0x00400000)
84#define SDIO_CMDFAIL_FLAG ((uint32_t)0x00000001)
85#define SDIO_DTFAIL_FLAG ((uint32_t)0x00000002)
86#define SDIO_CMDTIMEOUT_FLAG ((uint32_t)0x00000004)
87#define SDIO_DTTIMEOUT_FLAG ((uint32_t)0x00000008)
88#define SDIO_TXERRU_FLAG ((uint32_t)0x00000010)
89#define SDIO_RXERRO_FLAG ((uint32_t)0x00000020)
90#define SDIO_CMDRSPCMPL_FLAG ((uint32_t)0x00000040)
91#define SDIO_CMDCMPL_FLAG ((uint32_t)0x00000080)
92#define SDIO_DTCMPL_FLAG ((uint32_t)0x00000100)
93#define SDIO_SBITERR_FLAG ((uint32_t)0x00000200)
94#define SDIO_DTBLKCMPL_FLAG ((uint32_t)0x00000400)
95#define SDIO_DOCMD_FLAG ((uint32_t)0x00000800)
96#define SDIO_DOTX_FLAG ((uint32_t)0x00001000)
97#define SDIO_DORX_FLAG ((uint32_t)0x00002000)
98#define SDIO_TXBUFH_FLAG ((uint32_t)0x00004000)
99#define SDIO_RXBUFH_FLAG ((uint32_t)0x00008000)
100#define SDIO_TXBUFF_FLAG ((uint32_t)0x00010000)
101#define SDIO_RXBUFF_FLAG ((uint32_t)0x00020000)
102#define SDIO_TXBUFE_FLAG ((uint32_t)0x00040000)
103#define SDIO_RXBUFE_FLAG ((uint32_t)0x00080000)
104#define SDIO_TXBUF_FLAG ((uint32_t)0x00100000)
105#define SDIO_RXBUF_FLAG ((uint32_t)0x00200000)
106#define SDIO_SDIOIF_FLAG ((uint32_t)0x00400000)
119typedef enum
120{
121 SDIO_POWER_OFF = 0x00,
122 SDIO_POWER_ON = 0x03
123} sdio_power_state_type;
124
128typedef enum
129{
130 SDIO_CLOCK_EDGE_RISING = 0x00,
131 SDIO_CLOCK_EDGE_FALLING = 0x01
132} sdio_edge_phase_type;
133
137typedef enum
138{
139 SDIO_BUS_WIDTH_D1 = 0x00,
140 SDIO_BUS_WIDTH_D4 = 0x01,
141 SDIO_BUS_WIDTH_D8 = 0x02
142} sdio_bus_width_type;
143
147typedef enum
148{
149 SDIO_RESPONSE_NO = 0x00,
150 SDIO_RESPONSE_SHORT = 0x01,
151 SDIO_RESPONSE_LONG = 0x03
152} sdio_reponse_type;
153
157typedef enum
158{
159 SDIO_WAIT_FOR_NO = 0x00,
160 SDIO_WAIT_FOR_INT = 0x01,
161 SDIO_WAIT_FOR_PEND = 0x02
162} sdio_wait_type;
163
167typedef enum
168{
169 SDIO_RSP1_INDEX = 0x00,
170 SDIO_RSP2_INDEX = 0x01,
171 SDIO_RSP3_INDEX = 0x02,
172 SDIO_RSP4_INDEX = 0x03
173} sdio_rsp_index_type;
174
178typedef enum
179{
180 SDIO_DATA_BLOCK_SIZE_1B = 0x00,
181 SDIO_DATA_BLOCK_SIZE_2B = 0x01,
182 SDIO_DATA_BLOCK_SIZE_4B = 0x02,
183 SDIO_DATA_BLOCK_SIZE_8B = 0x03,
184 SDIO_DATA_BLOCK_SIZE_16B = 0x04,
185 SDIO_DATA_BLOCK_SIZE_32B = 0x05,
186 SDIO_DATA_BLOCK_SIZE_64B = 0x06,
187 SDIO_DATA_BLOCK_SIZE_128B = 0x07,
188 SDIO_DATA_BLOCK_SIZE_256B = 0x08,
189 SDIO_DATA_BLOCK_SIZE_512B = 0x09,
190 SDIO_DATA_BLOCK_SIZE_1024B = 0x0A,
191 SDIO_DATA_BLOCK_SIZE_2048B = 0x0B,
192 SDIO_DATA_BLOCK_SIZE_4096B = 0x0C,
193 SDIO_DATA_BLOCK_SIZE_8192B = 0x0D,
194 SDIO_DATA_BLOCK_SIZE_16384B = 0x0E
195} sdio_block_size_type;
196
200typedef enum
201{
202 SDIO_DATA_BLOCK_TRANSFER = 0x00,
203 SDIO_DATA_STREAM_TRANSFER = 0x01
204} sdio_transfer_mode_type;
205
209typedef enum
210{
211 SDIO_DATA_TRANSFER_TO_CARD = 0x00,
212 SDIO_DATA_TRANSFER_TO_CONTROLLER = 0x01
213} sdio_transfer_direction_type;
214
218typedef enum
219{
220 SDIO_READ_WAIT_CONTROLLED_BY_D2 = 0x00,
221 SDIO_READ_WAIT_CONTROLLED_BY_CK = 0x01
222} sdio_read_wait_mode_type;
223
227typedef struct
228{
229 uint32_t argument;
230 uint8_t cmd_index;
231 sdio_reponse_type rsp_type;
232 sdio_wait_type wait_type;
233} sdio_command_struct_type;
234
238typedef struct
239{
240 uint32_t timeout;
241 uint32_t data_length;
242 sdio_block_size_type block_size;
243 sdio_transfer_mode_type transfer_mode;
244 sdio_transfer_direction_type transfer_direction;
245} sdio_data_struct_type;
246
250typedef struct
251{
255 union
256 {
257 __IO uint32_t pwrctrl;
258 struct
259 {
260 __IO uint32_t ps : 2; /* [1:0] */
261 __IO uint32_t reserved1 : 30;/* [31:2] */
262 } pwrctrl_bit;
263 };
264
268 union
269 {
270 __IO uint32_t clkctrl;
271 struct
272 {
273 __IO uint32_t clkdiv_l : 8; /* [7:0] */
274 __IO uint32_t clkoen : 1; /* [8] */
275 __IO uint32_t pwrsven : 1; /* [9] */
276 __IO uint32_t bypsen : 1; /* [10] */
277 __IO uint32_t busws : 2; /* [12:11] */
278 __IO uint32_t clkegs : 1; /* [13] */
279 __IO uint32_t hfcen : 1; /* [14] */
280 __IO uint32_t clkdiv_h : 2; /* [16:15] */
281 __IO uint32_t reserved1 : 15;/* [31:17] */
282 } clkctrl_bit;
283 };
284
288 union
289 {
290 __IO uint32_t argu;
291 struct
292 {
293 __IO uint32_t argu : 32;/* [31:0] */
294 } argu_bit;
295 };
296
300 union
301 {
302 __IO uint32_t cmdctrl;
303 struct
304 {
305 __IO uint32_t cmdidx : 6; /* [5:0] */
306 __IO uint32_t rspwt : 2; /* [7:6] */
307 __IO uint32_t intwt : 1; /* [8] */
308 __IO uint32_t pndwt : 1; /* [9] */
309 __IO uint32_t ccsmen : 1; /* [10] */
310 __IO uint32_t iosusp : 1; /* [11] */
311 __IO uint32_t reserved1 : 20;/* [31:12] */
312 } cmdctrl_bit;
313 };
314
318 union
319 {
320 __IO uint32_t rspcmd;
321 struct
322 {
323 __IO uint32_t rspcmd : 6; /* [5:0] */
324 __IO uint32_t reserved1 : 26;/* [31:6] */
325 } rspcmd_bit;
326 };
327
331 union
332 {
333 __IO uint32_t rsp1;
334 struct
335 {
336 __IO uint32_t cardsts1 : 32;/* [31:0] */
337 } rsp1_bit;
338 };
339
343 union
344 {
345 __IO uint32_t rsp2;
346 struct
347 {
348 __IO uint32_t cardsts2 : 32;/* [31:0] */
349 } rsp2_bit;
350 };
351
355 union
356 {
357 __IO uint32_t rsp3;
358 struct
359 {
360 __IO uint32_t cardsts3 : 32;/* [31:0] */
361 } rsp3_bit;
362 };
363
367 union
368 {
369 __IO uint32_t rsp4;
370 struct
371 {
372 __IO uint32_t cardsts4 : 32;/* [31:0] */
373 } rsp4_bit;
374 };
375
379 union
380 {
381 __IO uint32_t dttmr;
382 struct
383 {
384 __IO uint32_t timeout : 32;/* [31:0] */
385 } dttmr_bit;
386 };
387
391 union
392 {
393 __IO uint32_t dtlen;
394 struct
395 {
396 __IO uint32_t dtlen : 25;/* [24:0] */
397 __IO uint32_t reserved1 : 7; /* [31:25] */
398 } dtlen_bit;
399 };
400
404 union
405 {
406 __IO uint32_t dtctrl;
407 struct
408 {
409 __IO uint32_t tfren : 1; /* [0] */
410 __IO uint32_t tfrdir : 1; /* [1] */
411 __IO uint32_t tfrmode : 1; /* [2] */
412 __IO uint32_t dmaen : 1; /* [3] */
413 __IO uint32_t blksize : 4; /* [7:4] */
414 __IO uint32_t rdwtstart : 1; /* [8] */
415 __IO uint32_t rdwtstop : 1; /* [9] */
416 __IO uint32_t rdwtmode : 1; /* [10] */
417 __IO uint32_t ioen : 1; /* [11] */
418 __IO uint32_t reserved1 : 20;/* [31:12] */
419 } dtctrl_bit;
420 };
421
425 union
426 {
427 __IO uint32_t dtcnt;
428 struct
429 {
430 __IO uint32_t cnt : 25;/* [24:0] */
431 __IO uint32_t reserved1 : 7; /* [31:25] */
432 } dtcnt_bit;
433 };
434
438 union
439 {
440 __IO uint32_t sts;
441 struct
442 {
443 __IO uint32_t cmdfail : 1; /* [0] */
444 __IO uint32_t dtfail : 1; /* [1] */
445 __IO uint32_t cmdtimeout : 1; /* [2] */
446 __IO uint32_t dttimeout : 1; /* [3] */
447 __IO uint32_t txerru : 1; /* [4] */
448 __IO uint32_t rxerro : 1; /* [5] */
449 __IO uint32_t cmdrspcmpl : 1; /* [6] */
450 __IO uint32_t cmdcmpl : 1; /* [7] */
451 __IO uint32_t dtcmpl : 1; /* [8] */
452 __IO uint32_t sbiterr : 1; /* [9] */
453 __IO uint32_t dtblkcmpl : 1; /* [10] */
454 __IO uint32_t docmd : 1; /* [11] */
455 __IO uint32_t dotx : 1; /* [12] */
456 __IO uint32_t dorx : 1; /* [13] */
457 __IO uint32_t txbufh : 1; /* [14] */
458 __IO uint32_t rxbufh : 1; /* [15] */
459 __IO uint32_t txbuff : 1; /* [16] */
460 __IO uint32_t rxbuff : 1; /* [17] */
461 __IO uint32_t txbufe : 1; /* [18] */
462 __IO uint32_t rxbufe : 1; /* [19] */
463 __IO uint32_t txbuf : 1; /* [20] */
464 __IO uint32_t rxbuf : 1; /* [21] */
465 __IO uint32_t ioif : 1; /* [22] */
466 __IO uint32_t reserved1 : 9; /* [31:23] */
467 } sts_bit;
468 };
469
473 union
474 {
475 __IO uint32_t intclr;
476 struct
477 {
478 __IO uint32_t cmdfail : 1; /* [0] */
479 __IO uint32_t dtfail : 1; /* [1] */
480 __IO uint32_t cmdtimeout : 1; /* [2] */
481 __IO uint32_t dttimeout : 1; /* [3] */
482 __IO uint32_t txerru : 1; /* [4] */
483 __IO uint32_t rxerro : 1; /* [5] */
484 __IO uint32_t cmdrspcmpl : 1; /* [6] */
485 __IO uint32_t cmdcmpl : 1; /* [7] */
486 __IO uint32_t dtcmpl : 1; /* [8] */
487 __IO uint32_t sbiterr : 1; /* [9] */
488 __IO uint32_t dtblkcmpl : 1; /* [10] */
489 __IO uint32_t reserved1 : 11;/* [21:11] */
490 __IO uint32_t ioif : 1; /* [22] */
491 __IO uint32_t reserved2 : 9; /* [31:23] */
492 } intclr_bit;
493 };
494
498 union
499 {
500 __IO uint32_t inten;
501 struct
502 {
503 __IO uint32_t cmdfailien : 1; /* [0] */
504 __IO uint32_t dtfailien : 1; /* [1] */
505 __IO uint32_t cmdtimeoutien : 1; /* [2] */
506 __IO uint32_t dttimeoutien : 1; /* [3] */
507 __IO uint32_t txerruien : 1; /* [4] */
508 __IO uint32_t rxerroien : 1; /* [5] */
509 __IO uint32_t cmdrspcmplien : 1; /* [6] */
510 __IO uint32_t cmdcmplien : 1; /* [7] */
511 __IO uint32_t dtcmplien : 1; /* [8] */
512 __IO uint32_t sbiterrien : 1; /* [9] */
513 __IO uint32_t dtblkcmplien : 1; /* [10] */
514 __IO uint32_t docmdien : 1; /* [11] */
515 __IO uint32_t dotxien : 1; /* [12] */
516 __IO uint32_t dorxien : 1; /* [13] */
517 __IO uint32_t txbufhien : 1; /* [14] */
518 __IO uint32_t rxbufhien : 1; /* [15] */
519 __IO uint32_t txbuffien : 1; /* [16] */
520 __IO uint32_t rxbuffien : 1; /* [17] */
521 __IO uint32_t txbufeien : 1; /* [18] */
522 __IO uint32_t rxbufeien : 1; /* [19] */
523 __IO uint32_t txbufien : 1; /* [20] */
524 __IO uint32_t rxbufien : 1; /* [21] */
525 __IO uint32_t ioifien : 1; /* [22] */
526 __IO uint32_t reserved1 : 9; /* [31:23] */
527 } inten_bit;
528 };
529
533 __IO uint32_t reserved1[2];
534
538 union
539 {
540 __IO uint32_t bufcnt;
541 struct
542 {
543 __IO uint32_t cnt : 24;/* [23:0] */
544 __IO uint32_t reserved1 : 8; /* [31:24] */
545 } bufcnt_bit;
546 };
547
551 __IO uint32_t reserved2[13];
552
556 union
557 {
558 __IO uint32_t buf;
559 struct
560 {
561 __IO uint32_t dt : 32;/* [31:0] */
562 } buf_bit;
563 };
564
565} sdio_type;
566
571#if defined (AT32F413TBU7) || defined (AT32F413Rx) || defined (AT32F413Cx) || \
572 defined (AT32F413Kx)
573#define SDIO1 ((sdio_type *) SDIO1_BASE)
574#endif
575
580void sdio_reset(sdio_type *sdio_x);
581void sdio_power_set(sdio_type *sdio_x, sdio_power_state_type power_state);
582 sdio_power_state_type sdio_power_status_get(sdio_type *sdio_x);
583void sdio_clock_config(sdio_type *sdio_x, uint16_t clk_div, sdio_edge_phase_type clk_edg);
584void sdio_bus_width_config(sdio_type *sdio_x, sdio_bus_width_type width);
585void sdio_clock_bypass(sdio_type *sdio_x, confirm_state new_state);
586void sdio_power_saving_mode_enable(sdio_type *sdio_x, confirm_state new_state);
587void sdio_flow_control_enable(sdio_type *sdio_x, confirm_state new_state);
588void sdio_clock_enable(sdio_type *sdio_x, confirm_state new_state);
589void sdio_dma_enable(sdio_type *sdio_x, confirm_state new_state);
590void sdio_interrupt_enable(sdio_type *sdio_x, uint32_t int_opt, confirm_state new_state);
591 flag_status sdio_flag_get(sdio_type *sdio_x, uint32_t flag);
592 flag_status sdio_interrupt_flag_get(sdio_type *sdio_x, uint32_t flag);
593void sdio_flag_clear(sdio_type *sdio_x, uint32_t flag);
594void sdio_command_config(sdio_type *sdio_x, sdio_command_struct_type *command_struct);
595void sdio_command_state_machine_enable(sdio_type *sdio_x, confirm_state new_state);
596uint8_t sdio_command_response_get(sdio_type *sdio_x);
597uint32_t sdio_response_get(sdio_type *sdio_x, sdio_rsp_index_type reg_index);
598void sdio_data_config(sdio_type *sdio_x, sdio_data_struct_type *data_struct);
599void sdio_data_state_machine_enable(sdio_type *sdio_x, confirm_state new_state);
600uint32_t sdio_data_counter_get(sdio_type *sdio_x);
601uint32_t sdio_data_read(sdio_type *sdio_x);
602uint32_t sdio_buffer_counter_get(sdio_type *sdio_x);
603void sdio_data_write(sdio_type *sdio_x, uint32_t data);
604void sdio_read_wait_mode_set(sdio_type *sdio_x, sdio_read_wait_mode_type mode);
605void sdio_read_wait_start(sdio_type *sdio_x, confirm_state new_state);
606void sdio_read_wait_stop(sdio_type *sdio_x, confirm_state new_state);
607void sdio_io_function_enable(sdio_type *sdio_x, confirm_state new_state);
608void sdio_io_suspend_command_set(sdio_type *sdio_x, confirm_state new_state);
609
622#ifdef __cplusplus
623}
624#endif
625
626#endif
at32f413.h
at32f413 header file
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
flag_status
flag_status
flag status
Definition at32f413.h:292
sdio_command_config
void sdio_command_config(sdio_type *sdio_x, sdio_command_struct_type *command_struct)
config sdio command.
Definition at32f413_sdio.c:372
sdio_data_write
void sdio_data_write(sdio_type *sdio_x, uint32_t data)
write one word data to fifo.
Definition at32f413_sdio.c:533
sdio_io_suspend_command_set
void sdio_io_suspend_command_set(sdio_type *sdio_x, confirm_state new_state)
enable or disable sd i/o suspend command sending.
Definition at32f413_sdio.c:601
sdio_data_config
void sdio_data_config(sdio_type *sdio_x, sdio_data_struct_type *data_struct)
config sdio data.
Definition at32f413_sdio.c:459
sdio_data_read
uint32_t sdio_data_read(sdio_type *sdio_x)
read a word data from sdio fifo.
Definition at32f413_sdio.c:508
sdio_io_function_enable
void sdio_io_function_enable(sdio_type *sdio_x, confirm_state new_state)
enable or disable the sd i/o function.
Definition at32f413_sdio.c:588
sdio_command_state_machine_enable
void sdio_command_state_machine_enable(sdio_type *sdio_x, confirm_state new_state)
enable or disable command path state machine(CPSM).
Definition at32f413_sdio.c:395
sdio_clock_bypass
void sdio_clock_bypass(sdio_type *sdio_x, confirm_state new_state)
enable or disable clock divider bypss
Definition at32f413_sdio.c:140
sdio_flow_control_enable
void sdio_flow_control_enable(sdio_type *sdio_x, confirm_state new_state)
enable or disable hardware flow control.
Definition at32f413_sdio.c:167
sdio_power_set
void sdio_power_set(sdio_type *sdio_x, sdio_power_state_type power_state)
set the power status of the controller
Definition at32f413_sdio.c:74
sdio_clock_config
void sdio_clock_config(sdio_type *sdio_x, uint16_t clk_div, sdio_edge_phase_type clk_edg)
config sdio clock
Definition at32f413_sdio.c:103
sdio_bus_width_config
void sdio_bus_width_config(sdio_type *sdio_x, sdio_bus_width_type width)
config sdio bus width
Definition at32f413_sdio.c:127
sdio_read_wait_stop
void sdio_read_wait_stop(sdio_type *sdio_x, confirm_state new_state)
enable or disable to stop sd i/o read wait operation.
Definition at32f413_sdio.c:575
sdio_interrupt_enable
void sdio_interrupt_enable(sdio_type *sdio_x, uint32_t int_opt, confirm_state new_state)
config corresponding interrupt.
Definition at32f413_sdio.c:231
sdio_flag_clear
void sdio_flag_clear(sdio_type *sdio_x, uint32_t flag)
clear sdio flag.
Definition at32f413_sdio.c:358
sdio_power_status_get
sdio_power_state_type sdio_power_status_get(sdio_type *sdio_x)
get power status.
Definition at32f413_sdio.c:86
sdio_response_get
uint32_t sdio_response_get(sdio_type *sdio_x, sdio_rsp_index_type reg_index)
get response received from the card for the last command.
Definition at32f413_sdio.c:426
sdio_data_state_machine_enable
void sdio_data_state_machine_enable(sdio_type *sdio_x, confirm_state new_state)
enable or disable data path state machine(DPSM).
Definition at32f413_sdio.c:484
sdio_power_saving_mode_enable
void sdio_power_saving_mode_enable(sdio_type *sdio_x, confirm_state new_state)
enable or disable power saving mode, config sdio_ck clock output when the bus is idle.
Definition at32f413_sdio.c:154
sdio_flag_get
flag_status sdio_flag_get(sdio_type *sdio_x, uint32_t flag)
get sdio flag.
Definition at32f413_sdio.c:321
sdio_dma_enable
void sdio_dma_enable(sdio_type *sdio_x, confirm_state new_state)
enable or disable dma.
Definition at32f413_sdio.c:193
sdio_data_counter_get
uint32_t sdio_data_counter_get(sdio_type *sdio_x)
get the number of remaining data bytes to be transferred.
Definition at32f413_sdio.c:496
sdio_buffer_counter_get
uint32_t sdio_buffer_counter_get(sdio_type *sdio_x)
get the number of words left to be written to or read from fifo..
Definition at32f413_sdio.c:520
sdio_read_wait_start
void sdio_read_wait_start(sdio_type *sdio_x, confirm_state new_state)
enable or disable to start sd i/o read wait operation.
Definition at32f413_sdio.c:562
sdio_reset
void sdio_reset(sdio_type *sdio_x)
reset the sdio register
Definition at32f413_sdio.c:50
sdio_interrupt_flag_get
flag_status sdio_interrupt_flag_get(sdio_type *sdio_x, uint32_t flag)
get sdio interrupt flag.
Definition at32f413_sdio.c:277
sdio_read_wait_mode_set
void sdio_read_wait_mode_set(sdio_type *sdio_x, sdio_read_wait_mode_type mode)
set the read wait mode.
Definition at32f413_sdio.c:549
sdio_clock_enable
void sdio_clock_enable(sdio_type *sdio_x, confirm_state new_state)
enable or disable sdio_ck output.
Definition at32f413_sdio.c:180
sdio_command_response_get
uint8_t sdio_command_response_get(sdio_type *sdio_x)
get command index of last command for which response received.
Definition at32f413_sdio.c:408
sdio_wait_type
sdio_wait_type
sdio wait type
Definition at32f413_sdio.h:158
sdio_reponse_type
sdio_reponse_type
sdio response type
Definition at32f413_sdio.h:148
sdio_read_wait_mode_type
sdio_read_wait_mode_type
sdio read wait mode
Definition at32f413_sdio.h:219
sdio_edge_phase_type
sdio_edge_phase_type
sdio edge phase
Definition at32f413_sdio.h:129
sdio_transfer_direction_type
sdio_transfer_direction_type
sdio data transfer direction
Definition at32f413_sdio.h:210
sdio_power_state_type
sdio_power_state_type
sdio power state
Definition at32f413_sdio.h:120
sdio_transfer_mode_type
sdio_transfer_mode_type
sdio data transfer mode
Definition at32f413_sdio.h:201
sdio_bus_width_type
sdio_bus_width_type
sdio bus width
Definition at32f413_sdio.h:138
sdio_rsp_index_type
sdio_rsp_index_type
sdio response register index
Definition at32f413_sdio.h:168
sdio_block_size_type
sdio_block_size_type
sdio data block size
Definition at32f413_sdio.h:179
SDIO_WAIT_FOR_NO
@ SDIO_WAIT_FOR_NO
Definition at32f413_sdio.h:159
SDIO_WAIT_FOR_PEND
@ SDIO_WAIT_FOR_PEND
Definition at32f413_sdio.h:161
SDIO_WAIT_FOR_INT
@ SDIO_WAIT_FOR_INT
Definition at32f413_sdio.h:160
SDIO_RESPONSE_LONG
@ SDIO_RESPONSE_LONG
Definition at32f413_sdio.h:151
SDIO_RESPONSE_SHORT
@ SDIO_RESPONSE_SHORT
Definition at32f413_sdio.h:150
SDIO_RESPONSE_NO
@ SDIO_RESPONSE_NO
Definition at32f413_sdio.h:149
SDIO_READ_WAIT_CONTROLLED_BY_CK
@ SDIO_READ_WAIT_CONTROLLED_BY_CK
Definition at32f413_sdio.h:221
SDIO_READ_WAIT_CONTROLLED_BY_D2
@ SDIO_READ_WAIT_CONTROLLED_BY_D2
Definition at32f413_sdio.h:220
SDIO_CLOCK_EDGE_FALLING
@ SDIO_CLOCK_EDGE_FALLING
Definition at32f413_sdio.h:131
SDIO_CLOCK_EDGE_RISING
@ SDIO_CLOCK_EDGE_RISING
Definition at32f413_sdio.h:130
SDIO_DATA_TRANSFER_TO_CARD
@ SDIO_DATA_TRANSFER_TO_CARD
Definition at32f413_sdio.h:211
SDIO_DATA_TRANSFER_TO_CONTROLLER
@ SDIO_DATA_TRANSFER_TO_CONTROLLER
Definition at32f413_sdio.h:212
SDIO_POWER_OFF
@ SDIO_POWER_OFF
Definition at32f413_sdio.h:121
SDIO_POWER_ON
@ SDIO_POWER_ON
Definition at32f413_sdio.h:122
SDIO_DATA_BLOCK_TRANSFER
@ SDIO_DATA_BLOCK_TRANSFER
Definition at32f413_sdio.h:202
SDIO_DATA_STREAM_TRANSFER
@ SDIO_DATA_STREAM_TRANSFER
Definition at32f413_sdio.h:203
SDIO_BUS_WIDTH_D8
@ SDIO_BUS_WIDTH_D8
Definition at32f413_sdio.h:141
SDIO_BUS_WIDTH_D1
@ SDIO_BUS_WIDTH_D1
Definition at32f413_sdio.h:139
SDIO_BUS_WIDTH_D4
@ SDIO_BUS_WIDTH_D4
Definition at32f413_sdio.h:140
SDIO_RSP3_INDEX
@ SDIO_RSP3_INDEX
Definition at32f413_sdio.h:171
SDIO_RSP2_INDEX
@ SDIO_RSP2_INDEX
Definition at32f413_sdio.h:170
SDIO_RSP4_INDEX
@ SDIO_RSP4_INDEX
Definition at32f413_sdio.h:172
SDIO_RSP1_INDEX
@ SDIO_RSP1_INDEX
Definition at32f413_sdio.h:169
SDIO_DATA_BLOCK_SIZE_8B
@ SDIO_DATA_BLOCK_SIZE_8B
Definition at32f413_sdio.h:183
SDIO_DATA_BLOCK_SIZE_128B
@ SDIO_DATA_BLOCK_SIZE_128B
Definition at32f413_sdio.h:187
SDIO_DATA_BLOCK_SIZE_2048B
@ SDIO_DATA_BLOCK_SIZE_2048B
Definition at32f413_sdio.h:191
SDIO_DATA_BLOCK_SIZE_4096B
@ SDIO_DATA_BLOCK_SIZE_4096B
Definition at32f413_sdio.h:192
SDIO_DATA_BLOCK_SIZE_16B
@ SDIO_DATA_BLOCK_SIZE_16B
Definition at32f413_sdio.h:184
SDIO_DATA_BLOCK_SIZE_1024B
@ SDIO_DATA_BLOCK_SIZE_1024B
Definition at32f413_sdio.h:190
SDIO_DATA_BLOCK_SIZE_64B
@ SDIO_DATA_BLOCK_SIZE_64B
Definition at32f413_sdio.h:186
SDIO_DATA_BLOCK_SIZE_32B
@ SDIO_DATA_BLOCK_SIZE_32B
Definition at32f413_sdio.h:185
SDIO_DATA_BLOCK_SIZE_8192B
@ SDIO_DATA_BLOCK_SIZE_8192B
Definition at32f413_sdio.h:193
SDIO_DATA_BLOCK_SIZE_1B
@ SDIO_DATA_BLOCK_SIZE_1B
Definition at32f413_sdio.h:180
SDIO_DATA_BLOCK_SIZE_512B
@ SDIO_DATA_BLOCK_SIZE_512B
Definition at32f413_sdio.h:189
SDIO_DATA_BLOCK_SIZE_2B
@ SDIO_DATA_BLOCK_SIZE_2B
Definition at32f413_sdio.h:181
SDIO_DATA_BLOCK_SIZE_256B
@ SDIO_DATA_BLOCK_SIZE_256B
Definition at32f413_sdio.h:188
SDIO_DATA_BLOCK_SIZE_4B
@ SDIO_DATA_BLOCK_SIZE_4B
Definition at32f413_sdio.h:182
SDIO_DATA_BLOCK_SIZE_16384B
@ SDIO_DATA_BLOCK_SIZE_16384B
Definition at32f413_sdio.h:194
sdio_command_struct_type
sdio command structure
Definition at32f413_sdio.h:228
sdio_command_struct_type::cmd_index
uint8_t cmd_index
Definition at32f413_sdio.h:230
sdio_command_struct_type::argument
uint32_t argument
Definition at32f413_sdio.h:229
sdio_command_struct_type::wait_type
sdio_wait_type wait_type
Definition at32f413_sdio.h:232
sdio_command_struct_type::rsp_type
sdio_reponse_type rsp_type
Definition at32f413_sdio.h:231
sdio_data_struct_type
sdio data structure
Definition at32f413_sdio.h:239
sdio_data_struct_type::block_size
sdio_block_size_type block_size
Definition at32f413_sdio.h:242
sdio_data_struct_type::transfer_direction
sdio_transfer_direction_type transfer_direction
Definition at32f413_sdio.h:244
sdio_data_struct_type::timeout
uint32_t timeout
Definition at32f413_sdio.h:240
sdio_data_struct_type::transfer_mode
sdio_transfer_mode_type transfer_mode
Definition at32f413_sdio.h:243
sdio_data_struct_type::data_length
uint32_t data_length
Definition at32f413_sdio.h:241
sdio_type
type define sdio register all
Definition at32f413_sdio.h:251
sdio_type::ps
__IO uint32_t ps
Definition at32f413_sdio.h:260
sdio_type::dorx
__IO uint32_t dorx
Definition at32f413_sdio.h:456
sdio_type::sbiterr
__IO uint32_t sbiterr
Definition at32f413_sdio.h:452
sdio_type::dtlen
__IO uint32_t dtlen
Definition at32f413_sdio.h:393
sdio_type::intclr
__IO uint32_t intclr
Definition at32f413_sdio.h:475
sdio_type::rdwtstart
__IO uint32_t rdwtstart
Definition at32f413_sdio.h:414
sdio_type::rdwtstop
__IO uint32_t rdwtstop
Definition at32f413_sdio.h:415
sdio_type::rspwt
__IO uint32_t rspwt
Definition at32f413_sdio.h:306
sdio_type::rxbuf
__IO uint32_t rxbuf
Definition at32f413_sdio.h:464
sdio_type::hfcen
__IO uint32_t hfcen
Definition at32f413_sdio.h:279
sdio_type::rxbufeien
__IO uint32_t rxbufeien
Definition at32f413_sdio.h:522
sdio_type::tfrmode
__IO uint32_t tfrmode
Definition at32f413_sdio.h:411
sdio_type::cmdtimeout
__IO uint32_t cmdtimeout
Definition at32f413_sdio.h:445
sdio_type::clkegs
__IO uint32_t clkegs
Definition at32f413_sdio.h:278
sdio_type::cmdcmplien
__IO uint32_t cmdcmplien
Definition at32f413_sdio.h:510
sdio_type::cmdcmpl
__IO uint32_t cmdcmpl
Definition at32f413_sdio.h:450
sdio_type::dtfailien
__IO uint32_t dtfailien
Definition at32f413_sdio.h:504
sdio_type::rxbufhien
__IO uint32_t rxbufhien
Definition at32f413_sdio.h:518
sdio_type::tfrdir
__IO uint32_t tfrdir
Definition at32f413_sdio.h:410
sdio_type::tfren
__IO uint32_t tfren
Definition at32f413_sdio.h:409
sdio_type::dttmr
__IO uint32_t dttmr
Definition at32f413_sdio.h:381
sdio_type::reserved1
__IO uint32_t reserved1
sdio reserved1 register, offset:0x40~0x44
Definition at32f413_sdio.h:261
sdio_type::cnt
__IO uint32_t cnt
Definition at32f413_sdio.h:430
sdio_type::cardsts4
__IO uint32_t cardsts4
Definition at32f413_sdio.h:372
sdio_type::cmdfail
__IO uint32_t cmdfail
Definition at32f413_sdio.h:443
sdio_type::txbufhien
__IO uint32_t txbufhien
Definition at32f413_sdio.h:517
sdio_type::txbuffien
__IO uint32_t txbuffien
Definition at32f413_sdio.h:519
sdio_type::rxbufe
__IO uint32_t rxbufe
Definition at32f413_sdio.h:462
sdio_type::dtblkcmpl
__IO uint32_t dtblkcmpl
Definition at32f413_sdio.h:453
sdio_type::inten
__IO uint32_t inten
Definition at32f413_sdio.h:500
sdio_type::dtcmpl
__IO uint32_t dtcmpl
Definition at32f413_sdio.h:451
sdio_type::docmd
__IO uint32_t docmd
Definition at32f413_sdio.h:454
sdio_type::pndwt
__IO uint32_t pndwt
Definition at32f413_sdio.h:308
sdio_type::cmdctrl
__IO uint32_t cmdctrl
Definition at32f413_sdio.h:302
sdio_type::dtcmplien
__IO uint32_t dtcmplien
Definition at32f413_sdio.h:511
sdio_type::clkoen
__IO uint32_t clkoen
Definition at32f413_sdio.h:274
sdio_type::ioen
__IO uint32_t ioen
Definition at32f413_sdio.h:417
sdio_type::bufcnt
__IO uint32_t bufcnt
Definition at32f413_sdio.h:540
sdio_type::intwt
__IO uint32_t intwt
Definition at32f413_sdio.h:307
sdio_type::rsp2
__IO uint32_t rsp2
Definition at32f413_sdio.h:345
sdio_type::dtctrl
__IO uint32_t dtctrl
Definition at32f413_sdio.h:406
sdio_type::dtfail
__IO uint32_t dtfail
Definition at32f413_sdio.h:444
sdio_type::docmdien
__IO uint32_t docmdien
Definition at32f413_sdio.h:514
sdio_type::dotxien
__IO uint32_t dotxien
Definition at32f413_sdio.h:515
sdio_type::dotx
__IO uint32_t dotx
Definition at32f413_sdio.h:455
sdio_type::rxerroien
__IO uint32_t rxerroien
Definition at32f413_sdio.h:508
sdio_type::ccsmen
__IO uint32_t ccsmen
Definition at32f413_sdio.h:309
sdio_type::txerruien
__IO uint32_t txerruien
Definition at32f413_sdio.h:507
sdio_type::dttimeoutien
__IO uint32_t dttimeoutien
Definition at32f413_sdio.h:506
sdio_type::pwrsven
__IO uint32_t pwrsven
Definition at32f413_sdio.h:275
sdio_type::cmdidx
__IO uint32_t cmdidx
Definition at32f413_sdio.h:305
sdio_type::cardsts3
__IO uint32_t cardsts3
Definition at32f413_sdio.h:360
sdio_type::cardsts1
__IO uint32_t cardsts1
Definition at32f413_sdio.h:336
sdio_type::pwrctrl
__IO uint32_t pwrctrl
Definition at32f413_sdio.h:257
sdio_type::ioifien
__IO uint32_t ioifien
Definition at32f413_sdio.h:525
sdio_type::dmaen
__IO uint32_t dmaen
Definition at32f413_sdio.h:412
sdio_type::reserved2
__IO uint32_t reserved2
sdio reserved2 register, offset:0x4C~0x7C
Definition at32f413_sdio.h:491
sdio_type::dtblkcmplien
__IO uint32_t dtblkcmplien
Definition at32f413_sdio.h:513
sdio_type::rxbuffien
__IO uint32_t rxbuffien
Definition at32f413_sdio.h:520
sdio_type::txbufh
__IO uint32_t txbufh
Definition at32f413_sdio.h:457
sdio_type::sts
__IO uint32_t sts
Definition at32f413_sdio.h:440
sdio_type::blksize
__IO uint32_t blksize
Definition at32f413_sdio.h:413
sdio_type::cardsts2
__IO uint32_t cardsts2
Definition at32f413_sdio.h:348
sdio_type::rdwtmode
__IO uint32_t rdwtmode
Definition at32f413_sdio.h:416
sdio_type::txbufeien
__IO uint32_t txbufeien
Definition at32f413_sdio.h:521
sdio_type::ioif
__IO uint32_t ioif
Definition at32f413_sdio.h:465
sdio_type::cmdrspcmplien
__IO uint32_t cmdrspcmplien
Definition at32f413_sdio.h:509
sdio_type::rxbufien
__IO uint32_t rxbufien
Definition at32f413_sdio.h:524
sdio_type::dttimeout
__IO uint32_t dttimeout
Definition at32f413_sdio.h:446
sdio_type::rxbufh
__IO uint32_t rxbufh
Definition at32f413_sdio.h:458
sdio_type::txbufien
__IO uint32_t txbufien
Definition at32f413_sdio.h:523
sdio_type::rsp1
__IO uint32_t rsp1
Definition at32f413_sdio.h:333
sdio_type::rxbuff
__IO uint32_t rxbuff
Definition at32f413_sdio.h:460
sdio_type::rsp4
__IO uint32_t rsp4
Definition at32f413_sdio.h:369
sdio_type::bypsen
__IO uint32_t bypsen
Definition at32f413_sdio.h:276
sdio_type::txbufe
__IO uint32_t txbufe
Definition at32f413_sdio.h:461
sdio_type::cmdfailien
__IO uint32_t cmdfailien
Definition at32f413_sdio.h:503
sdio_type::buf
__IO uint32_t buf
Definition at32f413_sdio.h:558
sdio_type::clkdiv_l
__IO uint32_t clkdiv_l
Definition at32f413_sdio.h:273
sdio_type::txerru
__IO uint32_t txerru
Definition at32f413_sdio.h:447
sdio_type::dorxien
__IO uint32_t dorxien
Definition at32f413_sdio.h:516
sdio_type::dt
__IO uint32_t dt
Definition at32f413_sdio.h:561
sdio_type::rspcmd
__IO uint32_t rspcmd
Definition at32f413_sdio.h:320
sdio_type::argu
__IO uint32_t argu
Definition at32f413_sdio.h:290
sdio_type::timeout
__IO uint32_t timeout
Definition at32f413_sdio.h:384
sdio_type::cmdtimeoutien
__IO uint32_t cmdtimeoutien
Definition at32f413_sdio.h:505
sdio_type::busws
__IO uint32_t busws
Definition at32f413_sdio.h:277
sdio_type::dtcnt
__IO uint32_t dtcnt
Definition at32f413_sdio.h:427
sdio_type::clkdiv_h
__IO uint32_t clkdiv_h
Definition at32f413_sdio.h:280
sdio_type::iosusp
__IO uint32_t iosusp
Definition at32f413_sdio.h:310
sdio_type::txbuff
__IO uint32_t txbuff
Definition at32f413_sdio.h:459
sdio_type::cmdrspcmpl
__IO uint32_t cmdrspcmpl
Definition at32f413_sdio.h:449
sdio_type::txbuf
__IO uint32_t txbuf
Definition at32f413_sdio.h:463
sdio_type::clkctrl
__IO uint32_t clkctrl
Definition at32f413_sdio.h:270
sdio_type::sbiterrien
__IO uint32_t sbiterrien
Definition at32f413_sdio.h:512
sdio_type::rsp3
__IO uint32_t rsp3
Definition at32f413_sdio.h:357
sdio_type::rxerro
__IO uint32_t rxerro
Definition at32f413_sdio.h:448


AT32F413 Firmwary Library: at32f413_spi.c Source File

  • libraries
  • drivers
  • src
at32f413_spi.c
Go to the documentation of this file.
1
26#include "at32f413_conf.h"
27
37#ifdef SPI_MODULE_ENABLED
38
50void spi_i2s_reset(spi_type *spi_x)
51{
52 if(spi_x == SPI1)
53 {
54 crm_periph_reset(CRM_SPI1_PERIPH_RESET, TRUE);
55 crm_periph_reset(CRM_SPI1_PERIPH_RESET, FALSE);
56 }
57 else if(spi_x == SPI2)
58 {
59 crm_periph_reset(CRM_SPI2_PERIPH_RESET, TRUE);
60 crm_periph_reset(CRM_SPI2_PERIPH_RESET, FALSE);
61 }
62}
63
70void spi_default_para_init(spi_init_type* spi_init_struct)
71{
72 spi_init_struct->transmission_mode = SPI_TRANSMIT_FULL_DUPLEX;
73 spi_init_struct->master_slave_mode = SPI_MODE_SLAVE;
74 spi_init_struct->mclk_freq_division = SPI_MCLK_DIV_2;
75 spi_init_struct->first_bit_transmission = SPI_FIRST_BIT_MSB;
76 spi_init_struct->frame_bit_num = SPI_FRAME_8BIT;
77 spi_init_struct->clock_polarity = SPI_CLOCK_POLARITY_LOW;
78 spi_init_struct->clock_phase = SPI_CLOCK_PHASE_1EDGE;
79 spi_init_struct->cs_mode_selection = SPI_CS_SOFTWARE_MODE;
80}
81
90void spi_init(spi_type* spi_x, spi_init_type* spi_init_struct)
91{
92 spi_x->i2sctrl_bit.i2smsel = FALSE;
93 if(spi_init_struct->transmission_mode == SPI_TRANSMIT_FULL_DUPLEX)
94 {
95 spi_x->ctrl1_bit.slben = FALSE;
96 spi_x->ctrl1_bit.slbtd = FALSE;
97 spi_x->ctrl1_bit.ora = FALSE;
98 }
99 else if(spi_init_struct->transmission_mode == SPI_TRANSMIT_SIMPLEX_RX)
100 {
101 spi_x->ctrl1_bit.slben = FALSE;
102 spi_x->ctrl1_bit.slbtd = FALSE;
103 spi_x->ctrl1_bit.ora = TRUE;
104 }
105 else if(spi_init_struct->transmission_mode == SPI_TRANSMIT_HALF_DUPLEX_RX)
106 {
107 spi_x->ctrl1_bit.slben = TRUE;
108 spi_x->ctrl1_bit.slbtd = FALSE;
109 spi_x->ctrl1_bit.ora = FALSE;
110 }
111 else if(spi_init_struct->transmission_mode == SPI_TRANSMIT_HALF_DUPLEX_TX)
112 {
113 spi_x->ctrl1_bit.slben = TRUE;
114 spi_x->ctrl1_bit.slbtd = TRUE;
115 spi_x->ctrl1_bit.ora = FALSE;
116 }
117
118 spi_x->ctrl1_bit.swcsen = spi_init_struct->cs_mode_selection;
119 if((spi_init_struct->master_slave_mode == SPI_MODE_MASTER) && (spi_init_struct->cs_mode_selection == SPI_CS_SOFTWARE_MODE))
120 {
121 spi_x->ctrl1_bit.swcsil = TRUE;
122 }
123 else
124 {
125 spi_x->ctrl1_bit.swcsil = FALSE;
126 }
127 spi_x->ctrl1_bit.msten = spi_init_struct->master_slave_mode;
128 if(spi_init_struct->mclk_freq_division > SPI_MCLK_DIV_256)
129 {
130 spi_x->ctrl2_bit.mdiv_h = 1;
131 spi_x->ctrl1_bit.mdiv_l = spi_init_struct->mclk_freq_division & 0x7;
132 }
133 else
134 {
135 spi_x->ctrl2_bit.mdiv_h = 0;
136 spi_x->ctrl1_bit.mdiv_l = spi_init_struct->mclk_freq_division;
137 }
138 spi_x->ctrl1_bit.ltf = spi_init_struct->first_bit_transmission;
139 spi_x->ctrl1_bit.fbn = spi_init_struct->frame_bit_num;
140 spi_x->ctrl1_bit.clkpol = spi_init_struct->clock_polarity;
141 spi_x->ctrl1_bit.clkpha = spi_init_struct->clock_phase;
142}
143
151void spi_crc_next_transmit(spi_type* spi_x)
152{
153 spi_x->ctrl1_bit.ntc = TRUE;
154}
155
164void spi_crc_polynomial_set(spi_type* spi_x, uint16_t crc_poly)
165{
166 spi_x->cpoly_bit.cpoly = crc_poly;
167}
168
176uint16_t spi_crc_polynomial_get(spi_type* spi_x)
177{
178 return spi_x->cpoly_bit.cpoly;
179}
180
190void spi_crc_enable(spi_type* spi_x, confirm_state new_state)
191{
192 spi_x->ctrl1_bit.ccen = new_state;
193}
194
205uint16_t spi_crc_value_get(spi_type* spi_x, spi_crc_direction_type crc_direction)
206{
207 if(crc_direction == SPI_CRC_RX)
208 return spi_x->rcrc_bit.rcrc;
209 else
210 return spi_x->tcrc_bit.tcrc;
211}
212
223void spi_hardware_cs_output_enable(spi_type* spi_x, confirm_state new_state)
224{
225 spi_x->ctrl2_bit.hwcsoe = new_state;
226}
227
241void spi_software_cs_internal_level_set(spi_type* spi_x, spi_software_cs_level_type level)
242{
243 spi_x->ctrl1_bit.swcsil = level;
244}
245
256void spi_frame_bit_num_set(spi_type* spi_x, spi_frame_bit_num_type bit_num)
257{
258 spi_x->ctrl1_bit.fbn = bit_num;
259}
260
272void spi_half_duplex_direction_set(spi_type* spi_x, spi_half_duplex_direction_type direction)
273{
274 spi_x->ctrl1_bit.slbtd = direction;
275}
276
286void spi_enable(spi_type* spi_x, confirm_state new_state)
287{
288 spi_x->ctrl1_bit.spien = new_state;
289}
290
297void i2s_default_para_init(i2s_init_type* i2s_init_struct)
298{
299 i2s_init_struct->operation_mode = I2S_MODE_SLAVE_TX;
300 i2s_init_struct->audio_protocol = I2S_AUDIO_PROTOCOL_PHILLIPS;
301 i2s_init_struct->audio_sampling_freq = I2S_AUDIO_FREQUENCY_DEFAULT;
302 i2s_init_struct->data_channel_format = I2S_DATA_16BIT_CHANNEL_16BIT;
303 i2s_init_struct->clock_polarity = I2S_CLOCK_POLARITY_LOW;
304 i2s_init_struct->mclk_output_enable = FALSE;
305}
306
315void i2s_init(spi_type* spi_x, i2s_init_type* i2s_init_struct)
316{
317 crm_clocks_freq_type clocks_freq;
318 uint32_t i2s_sclk_index = 0;
319 uint32_t i2sdiv_index = 2, i2sodd_index = 0, frequency_index = 0;
320
321 /* i2s audio frequency config */
322 if(i2s_init_struct->audio_sampling_freq == I2S_AUDIO_FREQUENCY_DEFAULT)
323 {
324 i2sodd_index = 0;
325 i2sdiv_index = 2;
326 }
327 else
328 {
329 crm_clocks_freq_get(&clocks_freq);
330 i2s_sclk_index = clocks_freq.sclk_freq;
331 if((i2s_init_struct->audio_protocol == I2S_AUDIO_PROTOCOL_PCM_SHORT) || (i2s_init_struct->audio_protocol == I2S_AUDIO_PROTOCOL_PCM_LONG))
332 {
333 if(i2s_init_struct->mclk_output_enable == TRUE)
334 {
335 frequency_index = (((i2s_sclk_index / 128) * 10) / i2s_init_struct->audio_sampling_freq) + 5;
336 }
337 else
338 {
339 if(i2s_init_struct->data_channel_format == I2S_DATA_16BIT_CHANNEL_16BIT)
340 frequency_index = (((i2s_sclk_index / 16) * 10) / i2s_init_struct->audio_sampling_freq) + 5;
341 else
342 frequency_index = (((i2s_sclk_index / 32) * 10) / i2s_init_struct->audio_sampling_freq) + 5;
343 }
344 }
345 else
346 {
347 if(i2s_init_struct->mclk_output_enable == TRUE)
348 {
349 frequency_index = (((i2s_sclk_index / 256) * 10) / i2s_init_struct->audio_sampling_freq) + 5;
350 }
351 else
352 {
353 if(i2s_init_struct->data_channel_format == I2S_DATA_16BIT_CHANNEL_16BIT)
354 frequency_index = (((i2s_sclk_index / 32) * 10) / i2s_init_struct->audio_sampling_freq) + 5;
355 else
356 frequency_index = (((i2s_sclk_index / 64) * 10) / i2s_init_struct->audio_sampling_freq) + 5;
357 }
358 }
359 }
360 frequency_index = frequency_index / 10;
361 i2sodd_index = frequency_index & (uint16_t)0x0001;
362 i2sdiv_index = (frequency_index - i2sodd_index) / 2;
363 if((i2sdiv_index < 2) || (i2sdiv_index > 0x03FF))
364 {
365 i2sodd_index = 0;
366 i2sdiv_index = 2;
367 }
368 spi_x->i2sclk_bit.i2sodd = i2sodd_index;
369 if(i2sdiv_index > 0x00FF)
370 {
371 spi_x->i2sclk_bit.i2sdiv_h = (i2sdiv_index >> 8) & 0x0003;
372 spi_x->i2sclk_bit.i2sdiv_l = i2sdiv_index & 0x00FF;
373 }
374 else
375 {
376 spi_x->i2sclk_bit.i2sdiv_h = 0;
377 spi_x->i2sclk_bit.i2sdiv_l = i2sdiv_index;
378 }
379
380 /* i2s audio_protocol set*/
381 if(i2s_init_struct->audio_protocol == I2S_AUDIO_PROTOCOL_PCM_LONG)
382 {
383 spi_x->i2sctrl_bit.pcmfssel = 1;
384 spi_x->i2sctrl_bit.stdsel = 3;
385 }
386 else if(i2s_init_struct->audio_protocol == I2S_AUDIO_PROTOCOL_PCM_SHORT)
387 {
388 spi_x->i2sctrl_bit.pcmfssel = 0;
389 spi_x->i2sctrl_bit.stdsel = 3;
390 }
391 else if(i2s_init_struct->audio_protocol == I2S_AUDIO_PROTOCOL_LSB)
392 {
393 spi_x->i2sctrl_bit.pcmfssel = 0;
394 spi_x->i2sctrl_bit.stdsel = 2;
395 }
396 else if(i2s_init_struct->audio_protocol == I2S_AUDIO_PROTOCOL_MSB)
397 {
398 spi_x->i2sctrl_bit.pcmfssel = 0;
399 spi_x->i2sctrl_bit.stdsel = 1;
400 }
401 else if(i2s_init_struct->audio_protocol == I2S_AUDIO_PROTOCOL_PHILLIPS)
402 {
403 spi_x->i2sctrl_bit.pcmfssel = 0;
404 spi_x->i2sctrl_bit.stdsel = 0;
405 }
406
407 /* i2s data_channel_format set*/
408 if(i2s_init_struct->data_channel_format == I2S_DATA_16BIT_CHANNEL_16BIT)
409 {
410 spi_x->i2sctrl_bit.i2scbn = 0;
411 spi_x->i2sctrl_bit.i2sdbn = 0;
412 }
413 else if(i2s_init_struct->data_channel_format == I2S_DATA_16BIT_CHANNEL_32BIT)
414 {
415 spi_x->i2sctrl_bit.i2scbn = 1;
416 spi_x->i2sctrl_bit.i2sdbn = 0;
417 }
418 else if(i2s_init_struct->data_channel_format == I2S_DATA_24BIT_CHANNEL_32BIT)
419 {
420 spi_x->i2sctrl_bit.i2scbn = 1;
421 spi_x->i2sctrl_bit.i2sdbn = 1;
422 }
423 else if(i2s_init_struct->data_channel_format == I2S_DATA_32BIT_CHANNEL_32BIT)
424 {
425 spi_x->i2sctrl_bit.i2scbn = 1;
426 spi_x->i2sctrl_bit.i2sdbn = 2;
427 }
428
429 spi_x->i2sctrl_bit.i2sclkpol = i2s_init_struct->clock_polarity;
430 spi_x->i2sclk_bit.i2smclkoe = i2s_init_struct->mclk_output_enable;
431 spi_x->i2sctrl_bit.opersel = i2s_init_struct->operation_mode;
432 spi_x->i2sctrl_bit.i2smsel = TRUE;
433}
434
444void i2s_enable(spi_type* spi_x, confirm_state new_state)
445{
446 spi_x->i2sctrl_bit.i2sen = new_state;
447}
448
463void spi_i2s_interrupt_enable(spi_type* spi_x, uint32_t spi_i2s_int, confirm_state new_state)
464{
465 if(new_state != FALSE)
466 {
467 spi_x->ctrl2 |= spi_i2s_int;
468 }
469 else
470 {
471 spi_x->ctrl2 &= ~spi_i2s_int;
472 }
473}
474
484void spi_i2s_dma_transmitter_enable(spi_type* spi_x, confirm_state new_state)
485{
486 spi_x->ctrl2_bit.dmaten = new_state;
487}
488
498void spi_i2s_dma_receiver_enable(spi_type* spi_x, confirm_state new_state)
499{
500 spi_x->ctrl2_bit.dmaren = new_state;
501}
502
513void spi_i2s_data_transmit(spi_type* spi_x, uint16_t tx_data)
514{
515 spi_x->dt = tx_data;
516}
517
525uint16_t spi_i2s_data_receive(spi_type* spi_x)
526{
527 return (uint16_t)spi_x->dt;
528}
529
547 flag_status spi_i2s_flag_get(spi_type* spi_x, uint32_t spi_i2s_flag)
548{
549 flag_status status = RESET;
550 if ((spi_x->sts & spi_i2s_flag) == RESET)
551 {
552 status = RESET;
553 }
554 else
555 {
556 status = SET;
557 }
558 return status;
559}
560
576 flag_status spi_i2s_interrupt_flag_get(spi_type* spi_x, uint32_t spi_i2s_flag)
577{
578 flag_status status = RESET;
579
580 switch(spi_i2s_flag)
581 {
582 case SPI_I2S_RDBF_FLAG:
583 if(spi_x->sts_bit.rdbf && spi_x->ctrl2_bit.rdbfie)
584 {
585 status = SET;
586 }
587 break;
588 case SPI_I2S_TDBE_FLAG:
589 if(spi_x->sts_bit.tdbe && spi_x->ctrl2_bit.tdbeie)
590 {
591 status = SET;
592 }
593 break;
594 case I2S_TUERR_FLAG:
595 if(spi_x->sts_bit.tuerr && spi_x->ctrl2_bit.errie)
596 {
597 status = SET;
598 }
599 break;
600 case SPI_CCERR_FLAG:
601 if(spi_x->sts_bit.ccerr && spi_x->ctrl2_bit.errie)
602 {
603 status = SET;
604 }
605 break;
606 case SPI_MMERR_FLAG:
607 if(spi_x->sts_bit.mmerr && spi_x->ctrl2_bit.errie)
608 {
609 status = SET;
610 }
611 break;
612 case SPI_I2S_ROERR_FLAG:
613 if(spi_x->sts_bit.roerr && spi_x->ctrl2_bit.errie)
614 {
615 status = SET;
616 }
617 break;
618 default:
619 break;
620 };
621 return status;
622}
623
642void spi_i2s_flag_clear(spi_type* spi_x, uint32_t spi_i2s_flag)
643{
644 if(spi_i2s_flag == SPI_CCERR_FLAG)
645 spi_x->sts = ~SPI_CCERR_FLAG;
646 else if(spi_i2s_flag == SPI_I2S_RDBF_FLAG)
647 UNUSED(spi_x->dt);
648 else if(spi_i2s_flag == I2S_TUERR_FLAG)
649 UNUSED(spi_x->sts);
650 else if(spi_i2s_flag == SPI_MMERR_FLAG)
651 {
652 UNUSED(spi_x->sts);
653 spi_x->ctrl1 = spi_x->ctrl1;
654 }
655 else if(spi_i2s_flag == SPI_I2S_ROERR_FLAG)
656 {
657 UNUSED(spi_x->dt);
658 UNUSED(spi_x->sts);
659 }
660}
661
666#endif
667
UNUSED
#define UNUSED(x)
Definition at32f413_def.h:64
spi_init_struct
spi_init_type spi_init_struct
Definition project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c:41
crm_periph_reset
void crm_periph_reset(crm_periph_reset_type value, confirm_state new_state)
enable or disable the peripheral reset
Definition at32f413_crm.c:293
crm_clocks_freq_get
void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
Definition at32f413_crm.c:660
CRM_SPI1_PERIPH_RESET
@ CRM_SPI1_PERIPH_RESET
Definition at32f413_crm.h:161
CRM_SPI2_PERIPH_RESET
@ CRM_SPI2_PERIPH_RESET
Definition at32f413_crm.h:174
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
flag_status
flag_status
flag status
Definition at32f413.h:292
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
SET
@ SET
Definition at32f413.h:292
I2S_TUERR_FLAG
#define I2S_TUERR_FLAG
Definition at32f413_spi.h:55
SPI_CCERR_FLAG
#define SPI_CCERR_FLAG
Definition at32f413_spi.h:56
SPI_I2S_TDBE_FLAG
#define SPI_I2S_TDBE_FLAG
Definition at32f413_spi.h:53
SPI_I2S_RDBF_FLAG
#define SPI_I2S_RDBF_FLAG
Definition at32f413_spi.h:52
SPI_MMERR_FLAG
#define SPI_MMERR_FLAG
Definition at32f413_spi.h:57
SPI_I2S_ROERR_FLAG
#define SPI_I2S_ROERR_FLAG
Definition at32f413_spi.h:58
spi_software_cs_level_type
spi_software_cs_level_type
spi software cs internal level type
Definition at32f413_spi.h:187
spi_half_duplex_direction_type
spi_half_duplex_direction_type
spi single line bidirectional direction type
Definition at32f413_spi.h:178
spi_frame_bit_num_type
spi_frame_bit_num_type
spi frame bit num type
Definition at32f413_spi.h:87
spi_crc_direction_type
spi_crc_direction_type
spi crc direction type
Definition at32f413_spi.h:169
I2S_CLOCK_POLARITY_LOW
@ I2S_CLOCK_POLARITY_LOW
Definition at32f413_spi.h:248
SPI_MODE_SLAVE
@ SPI_MODE_SLAVE
Definition at32f413_spi.h:97
SPI_MODE_MASTER
@ SPI_MODE_MASTER
Definition at32f413_spi.h:98
I2S_DATA_16BIT_CHANNEL_16BIT
@ I2S_DATA_16BIT_CHANNEL_16BIT
Definition at32f413_spi.h:226
I2S_DATA_24BIT_CHANNEL_32BIT
@ I2S_DATA_24BIT_CHANNEL_32BIT
Definition at32f413_spi.h:228
I2S_DATA_32BIT_CHANNEL_32BIT
@ I2S_DATA_32BIT_CHANNEL_32BIT
Definition at32f413_spi.h:229
I2S_DATA_16BIT_CHANNEL_32BIT
@ I2S_DATA_16BIT_CHANNEL_32BIT
Definition at32f413_spi.h:227
SPI_CLOCK_PHASE_1EDGE
@ SPI_CLOCK_PHASE_1EDGE
Definition at32f413_spi.h:115
I2S_AUDIO_FREQUENCY_DEFAULT
@ I2S_AUDIO_FREQUENCY_DEFAULT
Definition at32f413_spi.h:209
SPI_CS_SOFTWARE_MODE
@ SPI_CS_SOFTWARE_MODE
Definition at32f413_spi.h:125
SPI_FIRST_BIT_MSB
@ SPI_FIRST_BIT_MSB
Definition at32f413_spi.h:150
SPI_CLOCK_POLARITY_LOW
@ SPI_CLOCK_POLARITY_LOW
Definition at32f413_spi.h:106
SPI_TRANSMIT_HALF_DUPLEX_RX
@ SPI_TRANSMIT_HALF_DUPLEX_RX
Definition at32f413_spi.h:161
SPI_TRANSMIT_FULL_DUPLEX
@ SPI_TRANSMIT_FULL_DUPLEX
Definition at32f413_spi.h:159
SPI_TRANSMIT_HALF_DUPLEX_TX
@ SPI_TRANSMIT_HALF_DUPLEX_TX
Definition at32f413_spi.h:162
SPI_TRANSMIT_SIMPLEX_RX
@ SPI_TRANSMIT_SIMPLEX_RX
Definition at32f413_spi.h:160
I2S_AUDIO_PROTOCOL_PCM_LONG
@ I2S_AUDIO_PROTOCOL_PCM_LONG
Definition at32f413_spi.h:201
I2S_AUDIO_PROTOCOL_LSB
@ I2S_AUDIO_PROTOCOL_LSB
Definition at32f413_spi.h:199
I2S_AUDIO_PROTOCOL_MSB
@ I2S_AUDIO_PROTOCOL_MSB
Definition at32f413_spi.h:198
I2S_AUDIO_PROTOCOL_PHILLIPS
@ I2S_AUDIO_PROTOCOL_PHILLIPS
Definition at32f413_spi.h:197
I2S_AUDIO_PROTOCOL_PCM_SHORT
@ I2S_AUDIO_PROTOCOL_PCM_SHORT
Definition at32f413_spi.h:200
SPI_MCLK_DIV_2
@ SPI_MCLK_DIV_2
Definition at32f413_spi.h:133
SPI_MCLK_DIV_256
@ SPI_MCLK_DIV_256
Definition at32f413_spi.h:140
SPI_FRAME_8BIT
@ SPI_FRAME_8BIT
Definition at32f413_spi.h:88
SPI_CRC_RX
@ SPI_CRC_RX
Definition at32f413_spi.h:170
I2S_MODE_SLAVE_TX
@ I2S_MODE_SLAVE_TX
Definition at32f413_spi.h:237
spi_i2s_interrupt_enable
void spi_i2s_interrupt_enable(spi_type *spi_x, uint32_t spi_i2s_int, confirm_state new_state)
enable or disable the specified spi/i2s interrupts.
Definition at32f413_spi.c:463
i2s_init
void i2s_init(spi_type *spi_x, i2s_init_type *i2s_init_struct)
i2s init config with its setting value.
Definition at32f413_spi.c:315
spi_i2s_data_transmit
void spi_i2s_data_transmit(spi_type *spi_x, uint16_t tx_data)
spi/i2s data transmit
Definition at32f413_spi.c:513
spi_crc_enable
void spi_crc_enable(spi_type *spi_x, confirm_state new_state)
enable or disable the hardware crc calculation for the spi peripheral.
Definition at32f413_spi.c:190
spi_i2s_dma_receiver_enable
void spi_i2s_dma_receiver_enable(spi_type *spi_x, confirm_state new_state)
enable or disable the spi/i2s dma receiver mode.
Definition at32f413_spi.c:498
spi_i2s_flag_get
flag_status spi_i2s_flag_get(spi_type *spi_x, uint32_t spi_i2s_flag)
get flag of the specified spi/i2s peripheral.
Definition at32f413_spi.c:547
i2s_enable
void i2s_enable(spi_type *spi_x, confirm_state new_state)
enable or disable i2s.
Definition at32f413_spi.c:444
spi_crc_polynomial_get
uint16_t spi_crc_polynomial_get(spi_type *spi_x)
return the crc polynomial register value for the spi peripheral.
Definition at32f413_spi.c:176
spi_crc_next_transmit
void spi_crc_next_transmit(spi_type *spi_x)
spi next transmit crc for the spi peripheral.
Definition at32f413_spi.c:151
spi_init
void spi_init(spi_type *spi_x, spi_init_type *spi_init_struct)
spi init config with its setting value.
Definition at32f413_spi.c:90
spi_default_para_init
void spi_default_para_init(spi_init_type *spi_init_struct)
spi init config with its default value.
Definition at32f413_spi.c:70
spi_crc_polynomial_set
void spi_crc_polynomial_set(spi_type *spi_x, uint16_t crc_poly)
set the crc polynomial value for the spi peripheral.
Definition at32f413_spi.c:164
spi_i2s_data_receive
uint16_t spi_i2s_data_receive(spi_type *spi_x)
spi/i2s data receive
Definition at32f413_spi.c:525
spi_crc_value_get
uint16_t spi_crc_value_get(spi_type *spi_x, spi_crc_direction_type crc_direction)
return the transmit or the receive crc value for the spi peripheral.
Definition at32f413_spi.c:205
spi_i2s_reset
void spi_i2s_reset(spi_type *spi_x)
spi reset by crm reset register
Definition at32f413_spi.c:50
spi_half_duplex_direction_set
void spi_half_duplex_direction_set(spi_type *spi_x, spi_half_duplex_direction_type direction)
set the data transmission direction in single line bidirectiona half duplex mode of the spi periphera...
Definition at32f413_spi.c:272
spi_hardware_cs_output_enable
void spi_hardware_cs_output_enable(spi_type *spi_x, confirm_state new_state)
enable or disable the hardware cs output for the spi peripheral.
Definition at32f413_spi.c:223
spi_i2s_interrupt_flag_get
flag_status spi_i2s_interrupt_flag_get(spi_type *spi_x, uint32_t spi_i2s_flag)
get interrupt flag of the specified spi/i2s peripheral.
Definition at32f413_spi.c:576
spi_i2s_flag_clear
void spi_i2s_flag_clear(spi_type *spi_x, uint32_t spi_i2s_flag)
clear flag of the specified spi/i2s peripheral.
Definition at32f413_spi.c:642
i2s_default_para_init
void i2s_default_para_init(i2s_init_type *i2s_init_struct)
i2s init config with its default value.
Definition at32f413_spi.c:297
spi_enable
void spi_enable(spi_type *spi_x, confirm_state new_state)
enable or disable spi.
Definition at32f413_spi.c:286
spi_i2s_dma_transmitter_enable
void spi_i2s_dma_transmitter_enable(spi_type *spi_x, confirm_state new_state)
enable or disable the spi/i2s dma transmitter mode.
Definition at32f413_spi.c:484
spi_frame_bit_num_set
void spi_frame_bit_num_set(spi_type *spi_x, spi_frame_bit_num_type bit_num)
set the data frame bit num for the spi peripheral.
Definition at32f413_spi.c:256
spi_software_cs_internal_level_set
void spi_software_cs_internal_level_set(spi_type *spi_x, spi_software_cs_level_type level)
set the software cs internal level for the spi peripheral.
Definition at32f413_spi.c:241
SPI1
#define SPI1
Definition at32f413_spi.h:447
SPI2
#define SPI2
Definition at32f413_spi.h:448
at32f413_conf.h
at32f413 config header file
crm_clocks_freq_type
crm clocks freqency structure
Definition at32f413_crm.h:470
crm_clocks_freq_type::sclk_freq
uint32_t sclk_freq
Definition at32f413_crm.h:471
i2s_init_type
i2s init type
Definition at32f413_spi.h:271
i2s_init_type::audio_sampling_freq
i2s_audio_sampling_freq_type audio_sampling_freq
Definition at32f413_spi.h:274
i2s_init_type::data_channel_format
i2s_data_channel_format_type data_channel_format
Definition at32f413_spi.h:275
i2s_init_type::mclk_output_enable
confirm_state mclk_output_enable
Definition at32f413_spi.h:277
i2s_init_type::audio_protocol
i2s_audio_protocol_type audio_protocol
Definition at32f413_spi.h:273
i2s_init_type::operation_mode
i2s_operation_mode_type operation_mode
Definition at32f413_spi.h:272
i2s_init_type::clock_polarity
i2s_clock_polarity_type clock_polarity
Definition at32f413_spi.h:276
spi_init_type
spi init type
Definition at32f413_spi.h:256
spi_init_type::master_slave_mode
spi_master_slave_mode_type master_slave_mode
Definition at32f413_spi.h:258
spi_init_type::first_bit_transmission
spi_first_bit_type first_bit_transmission
Definition at32f413_spi.h:260
spi_init_type::frame_bit_num
spi_frame_bit_num_type frame_bit_num
Definition at32f413_spi.h:261
spi_init_type::clock_polarity
spi_clock_polarity_type clock_polarity
Definition at32f413_spi.h:262
spi_init_type::cs_mode_selection
spi_cs_mode_type cs_mode_selection
Definition at32f413_spi.h:264
spi_init_type::mclk_freq_division
spi_mclk_freq_div_type mclk_freq_division
Definition at32f413_spi.h:259
spi_init_type::transmission_mode
spi_transmission_mode_type transmission_mode
Definition at32f413_spi.h:257
spi_init_type::clock_phase
spi_clock_phase_type clock_phase
Definition at32f413_spi.h:263
spi_type
type define spi register all
Definition at32f413_spi.h:284
spi_type::i2sctrl_bit
struct spi_type::@638::@649 i2sctrl_bit
spi_type::tdbe
__IO uint32_t tdbe
Definition at32f413_spi.h:341
spi_type::clkpha
__IO uint32_t clkpha
Definition at32f413_spi.h:294
spi_type::hwcsoe
__IO uint32_t hwcsoe
Definition at32f413_spi.h:322
spi_type::slben
__IO uint32_t slben
Definition at32f413_spi.h:307
spi_type::ntc
__IO uint32_t ntc
Definition at32f413_spi.h:304
spi_type::mdiv_h
__IO uint32_t mdiv_h
Definition at32f413_spi.h:327
spi_type::ctrl2_bit
struct spi_type::@626::@643 ctrl2_bit
spi_type::rdbfie
__IO uint32_t rdbfie
Definition at32f413_spi.h:325
spi_type::mmerr
__IO uint32_t mmerr
Definition at32f413_spi.h:345
spi_type::dmaren
__IO uint32_t dmaren
Definition at32f413_spi.h:320
spi_type::i2sdbn
__IO uint32_t i2sdbn
Definition at32f413_spi.h:413
spi_type::ctrl1_bit
struct spi_type::@624::@642 ctrl1_bit
spi_type::rcrc
__IO uint32_t rcrc
Definition at32f413_spi.h:383
spi_type::errie
__IO uint32_t errie
Definition at32f413_spi.h:324
spi_type::i2scbn
__IO uint32_t i2scbn
Definition at32f413_spi.h:412
spi_type::i2sclkpol
__IO uint32_t i2sclkpol
Definition at32f413_spi.h:414
spi_type::cpoly
__IO uint32_t cpoly
Definition at32f413_spi.h:370
spi_type::ctrl1
__IO uint32_t ctrl1
Definition at32f413_spi.h:291
spi_type::i2sodd
__IO uint32_t i2sodd
Definition at32f413_spi.h:434
spi_type::swcsil
__IO uint32_t swcsil
Definition at32f413_spi.h:300
spi_type::tcrc
__IO uint32_t tcrc
Definition at32f413_spi.h:396
spi_type::i2smclkoe
__IO uint32_t i2smclkoe
Definition at32f413_spi.h:435
spi_type::ltf
__IO uint32_t ltf
Definition at32f413_spi.h:299
spi_type::i2sclk_bit
struct spi_type::@640::@650 i2sclk_bit
spi_type::clkpol
__IO uint32_t clkpol
Definition at32f413_spi.h:295
spi_type::slbtd
__IO uint32_t slbtd
Definition at32f413_spi.h:306
spi_type::tcrc_bit
struct spi_type::@636::@648 tcrc_bit
spi_type::dmaten
__IO uint32_t dmaten
Definition at32f413_spi.h:321
spi_type::ccen
__IO uint32_t ccen
Definition at32f413_spi.h:305
spi_type::fbn
__IO uint32_t fbn
Definition at32f413_spi.h:303
spi_type::dt
__IO uint32_t dt
Definition at32f413_spi.h:357
spi_type::msten
__IO uint32_t msten
Definition at32f413_spi.h:296
spi_type::ccerr
__IO uint32_t ccerr
Definition at32f413_spi.h:344
spi_type::sts
__IO uint32_t sts
Definition at32f413_spi.h:337
spi_type::cpoly_bit
struct spi_type::@632::@646 cpoly_bit
spi_type::i2sdiv_h
__IO uint32_t i2sdiv_h
Definition at32f413_spi.h:436
spi_type::opersel
__IO uint32_t opersel
Definition at32f413_spi.h:418
spi_type::i2sdiv_l
__IO uint32_t i2sdiv_l
Definition at32f413_spi.h:433
spi_type::i2smsel
__IO uint32_t i2smsel
Definition at32f413_spi.h:420
spi_type::pcmfssel
__IO uint32_t pcmfssel
Definition at32f413_spi.h:417
spi_type::ctrl2
__IO uint32_t ctrl2
Definition at32f413_spi.h:317
spi_type::roerr
__IO uint32_t roerr
Definition at32f413_spi.h:346
spi_type::rcrc_bit
struct spi_type::@634::@647 rcrc_bit
spi_type::stdsel
__IO uint32_t stdsel
Definition at32f413_spi.h:415
spi_type::rdbf
__IO uint32_t rdbf
Definition at32f413_spi.h:340
spi_type::tuerr
__IO uint32_t tuerr
Definition at32f413_spi.h:343
spi_type::mdiv_l
__IO uint32_t mdiv_l
Definition at32f413_spi.h:297
spi_type::spien
__IO uint32_t spien
Definition at32f413_spi.h:298
spi_type::swcsen
__IO uint32_t swcsen
Definition at32f413_spi.h:301
spi_type::sts_bit
struct spi_type::@628::@644 sts_bit
spi_type::ora
__IO uint32_t ora
Definition at32f413_spi.h:302
spi_type::i2sen
__IO uint32_t i2sen
Definition at32f413_spi.h:419
spi_type::tdbeie
__IO uint32_t tdbeie
Definition at32f413_spi.h:326


AT32F413 Firmwary Library: at32f413_spi.h Source File

  • libraries
  • drivers
  • inc
at32f413_spi.h
Go to the documentation of this file.
1
26/* Define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_SPI_H
28#define __AT32F413_SPI_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34
35/* Includes ------------------------------------------------------------------*/
36#include "at32f413.h"
37
52#define SPI_I2S_RDBF_FLAG 0x0001
53#define SPI_I2S_TDBE_FLAG 0x0002
54#define I2S_ACS_FLAG 0x0004
55#define I2S_TUERR_FLAG 0x0008
56#define SPI_CCERR_FLAG 0x0010
57#define SPI_MMERR_FLAG 0x0020
58#define SPI_I2S_ROERR_FLAG 0x0040
59#define SPI_I2S_BF_FLAG 0x0080
71#define SPI_I2S_ERROR_INT 0x0020
72#define SPI_I2S_RDBF_INT 0x0040
73#define SPI_I2S_TDBE_INT 0x0080
86typedef enum
87{
88 SPI_FRAME_8BIT = 0x00,
89 SPI_FRAME_16BIT = 0x01
90} spi_frame_bit_num_type;
91
95typedef enum
96{
97 SPI_MODE_SLAVE = 0x00,
98 SPI_MODE_MASTER = 0x01
99} spi_master_slave_mode_type;
100
104typedef enum
105{
106 SPI_CLOCK_POLARITY_LOW = 0x00,
107 SPI_CLOCK_POLARITY_HIGH = 0x01
108} spi_clock_polarity_type;
109
113typedef enum
114{
115 SPI_CLOCK_PHASE_1EDGE = 0x00,
116 SPI_CLOCK_PHASE_2EDGE = 0x01
117} spi_clock_phase_type;
118
122typedef enum
123{
124 SPI_CS_HARDWARE_MODE = 0x00,
125 SPI_CS_SOFTWARE_MODE = 0x01
126} spi_cs_mode_type;
127
131typedef enum
132{
133 SPI_MCLK_DIV_2 = 0x00,
134 SPI_MCLK_DIV_4 = 0x01,
135 SPI_MCLK_DIV_8 = 0x02,
136 SPI_MCLK_DIV_16 = 0x03,
137 SPI_MCLK_DIV_32 = 0x04,
138 SPI_MCLK_DIV_64 = 0x05,
139 SPI_MCLK_DIV_128 = 0x06,
140 SPI_MCLK_DIV_256 = 0x07,
141 SPI_MCLK_DIV_512 = 0x08,
142 SPI_MCLK_DIV_1024 = 0x09
143} spi_mclk_freq_div_type;
144
148typedef enum
149{
150 SPI_FIRST_BIT_MSB = 0x00,
151 SPI_FIRST_BIT_LSB = 0x01
152} spi_first_bit_type;
153
157typedef enum
158{
159 SPI_TRANSMIT_FULL_DUPLEX = 0x00,
160 SPI_TRANSMIT_SIMPLEX_RX = 0x01,
161 SPI_TRANSMIT_HALF_DUPLEX_RX = 0x02,
162 SPI_TRANSMIT_HALF_DUPLEX_TX = 0x03
163} spi_transmission_mode_type;
164
168typedef enum
169{
170 SPI_CRC_RX = 0x0014,
171 SPI_CRC_TX = 0x0018
172} spi_crc_direction_type;
173
177typedef enum
178{
179 SPI_HALF_DUPLEX_DIRECTION_RX = 0x00,
180 SPI_HALF_DUPLEX_DIRECTION_TX = 0x01
181} spi_half_duplex_direction_type;
182
186typedef enum
187{
188 SPI_SWCS_INTERNAL_LEVEL_LOW = 0x00,
189 SPI_SWCS_INTERNAL_LEVEL_HIGHT = 0x01
190} spi_software_cs_level_type;
191
195typedef enum
196{
197 I2S_AUDIO_PROTOCOL_PHILLIPS = 0x00,
198 I2S_AUDIO_PROTOCOL_MSB = 0x01,
199 I2S_AUDIO_PROTOCOL_LSB = 0x02,
200 I2S_AUDIO_PROTOCOL_PCM_SHORT = 0x03,
201 I2S_AUDIO_PROTOCOL_PCM_LONG = 0x04
202} i2s_audio_protocol_type;
203
207typedef enum
208{
209 I2S_AUDIO_FREQUENCY_DEFAULT = 2,
210 I2S_AUDIO_FREQUENCY_8K = 8000,
211 I2S_AUDIO_FREQUENCY_11_025K = 11025,
212 I2S_AUDIO_FREQUENCY_16K = 16000,
213 I2S_AUDIO_FREQUENCY_22_05K = 22050,
214 I2S_AUDIO_FREQUENCY_32K = 32000,
215 I2S_AUDIO_FREQUENCY_44_1K = 44100,
216 I2S_AUDIO_FREQUENCY_48K = 48000,
217 I2S_AUDIO_FREQUENCY_96K = 96000,
218 I2S_AUDIO_FREQUENCY_192K = 192000
219} i2s_audio_sampling_freq_type;
220
224typedef enum
225{
226 I2S_DATA_16BIT_CHANNEL_16BIT = 0x01,
227 I2S_DATA_16BIT_CHANNEL_32BIT = 0x02,
228 I2S_DATA_24BIT_CHANNEL_32BIT = 0x03,
229 I2S_DATA_32BIT_CHANNEL_32BIT = 0x04
230} i2s_data_channel_format_type;
231
235typedef enum
236{
237 I2S_MODE_SLAVE_TX = 0x00,
238 I2S_MODE_SLAVE_RX = 0x01,
239 I2S_MODE_MASTER_TX = 0x02,
240 I2S_MODE_MASTER_RX = 0x03
241} i2s_operation_mode_type;
242
246typedef enum
247{
248 I2S_CLOCK_POLARITY_LOW = 0x00,
249 I2S_CLOCK_POLARITY_HIGH = 0x01
250} i2s_clock_polarity_type;
251
255typedef struct
256{
257 spi_transmission_mode_type transmission_mode;
258 spi_master_slave_mode_type master_slave_mode;
259 spi_mclk_freq_div_type mclk_freq_division;
260 spi_first_bit_type first_bit_transmission;
261 spi_frame_bit_num_type frame_bit_num;
262 spi_clock_polarity_type clock_polarity;
263 spi_clock_phase_type clock_phase;
264 spi_cs_mode_type cs_mode_selection;
265} spi_init_type;
266
270typedef struct
271{
272 i2s_operation_mode_type operation_mode;
273 i2s_audio_protocol_type audio_protocol;
274 i2s_audio_sampling_freq_type audio_sampling_freq;
275 i2s_data_channel_format_type data_channel_format;
276 i2s_clock_polarity_type clock_polarity;
277 confirm_state mclk_output_enable;
278} i2s_init_type;
279
283typedef struct
284{
285
289 union
290 {
291 __IO uint32_t ctrl1;
292 struct
293 {
294 __IO uint32_t clkpha : 1; /* [0] */
295 __IO uint32_t clkpol : 1; /* [1] */
296 __IO uint32_t msten : 1; /* [2] */
297 __IO uint32_t mdiv_l : 3; /* [5:3] */
298 __IO uint32_t spien : 1; /* [6] */
299 __IO uint32_t ltf : 1; /* [7] */
300 __IO uint32_t swcsil : 1; /* [8] */
301 __IO uint32_t swcsen : 1; /* [9] */
302 __IO uint32_t ora : 1; /* [10] */
303 __IO uint32_t fbn : 1; /* [11] */
304 __IO uint32_t ntc : 1; /* [12] */
305 __IO uint32_t ccen : 1; /* [13] */
306 __IO uint32_t slbtd : 1; /* [14] */
307 __IO uint32_t slben : 1; /* [15] */
308 __IO uint32_t reserved1 : 16;/* [31:16] */
309 } ctrl1_bit;
310 };
311
315 union
316 {
317 __IO uint32_t ctrl2;
318 struct
319 {
320 __IO uint32_t dmaren : 1; /* [0] */
321 __IO uint32_t dmaten : 1; /* [1] */
322 __IO uint32_t hwcsoe : 1; /* [2] */
323 __IO uint32_t reserved1 : 2; /* [4:3] */
324 __IO uint32_t errie : 1; /* [5] */
325 __IO uint32_t rdbfie : 1; /* [6] */
326 __IO uint32_t tdbeie : 1; /* [7] */
327 __IO uint32_t mdiv_h : 1; /* [8] */
328 __IO uint32_t reserved2 : 23;/* [31:9] */
329 } ctrl2_bit;
330 };
331
335 union
336 {
337 __IO uint32_t sts;
338 struct
339 {
340 __IO uint32_t rdbf : 1; /* [0] */
341 __IO uint32_t tdbe : 1; /* [1] */
342 __IO uint32_t acs : 1; /* [2] */
343 __IO uint32_t tuerr : 1; /* [3] */
344 __IO uint32_t ccerr : 1; /* [4] */
345 __IO uint32_t mmerr : 1; /* [5] */
346 __IO uint32_t roerr : 1; /* [6] */
347 __IO uint32_t bf : 1; /* [7] */
348 __IO uint32_t reserved1 : 24;/* [31:8] */
349 } sts_bit;
350 };
351
355 union
356 {
357 __IO uint32_t dt;
358 struct
359 {
360 __IO uint32_t dt : 16;/* [15:0] */
361 __IO uint32_t reserved1 : 16;/* [31:16] */
362 } dt_bit;
363 };
364
368 union
369 {
370 __IO uint32_t cpoly;
371 struct
372 {
373 __IO uint32_t cpoly : 16;/* [15:0] */
374 __IO uint32_t reserved1 : 16;/* [31:16] */
375 } cpoly_bit;
376 };
377
381 union
382 {
383 __IO uint32_t rcrc;
384 struct
385 {
386 __IO uint32_t rcrc : 16;/* [15:0] */
387 __IO uint32_t reserved1 : 16;/* [31:16] */
388 } rcrc_bit;
389 };
390
394 union
395 {
396 __IO uint32_t tcrc;
397 struct
398 {
399 __IO uint32_t tcrc : 16;/* [15:0] */
400 __IO uint32_t reserved1 : 16;/* [31:16] */
401 } tcrc_bit;
402 };
403
407 union
408 {
409 __IO uint32_t i2sctrl;
410 struct
411 {
412 __IO uint32_t i2scbn : 1; /* [0] */
413 __IO uint32_t i2sdbn : 2; /* [2:1] */
414 __IO uint32_t i2sclkpol : 1; /* [3] */
415 __IO uint32_t stdsel : 2; /* [5:4] */
416 __IO uint32_t reserved1 : 1; /* [6] */
417 __IO uint32_t pcmfssel : 1; /* [7] */
418 __IO uint32_t opersel : 2; /* [9:8] */
419 __IO uint32_t i2sen : 1; /* [10] */
420 __IO uint32_t i2smsel : 1; /* [11] */
421 __IO uint32_t reserved2 : 20;/* [31:12] */
422 } i2sctrl_bit;
423 };
424
428 union
429 {
430 __IO uint32_t i2sclk;
431 struct
432 {
433 __IO uint32_t i2sdiv_l : 8; /* [7:0] */
434 __IO uint32_t i2sodd : 1; /* [8] */
435 __IO uint32_t i2smclkoe : 1; /* [9] */
436 __IO uint32_t i2sdiv_h : 2; /* [11:10] */
437 __IO uint32_t reserved1 : 20;/* [31:12] */
438 } i2sclk_bit;
439 };
440
441} spi_type;
442
447#define SPI1 ((spi_type *) SPI1_BASE)
448#define SPI2 ((spi_type *) SPI2_BASE)
449
450
455void spi_i2s_reset(spi_type *spi_x);
456void spi_default_para_init(spi_init_type* spi_init_struct);
457void spi_init(spi_type* spi_x, spi_init_type* spi_init_struct);
458void spi_crc_next_transmit(spi_type* spi_x);
459void spi_crc_polynomial_set(spi_type* spi_x, uint16_t crc_poly);
460uint16_t spi_crc_polynomial_get(spi_type* spi_x);
461void spi_crc_enable(spi_type* spi_x, confirm_state new_state);
462uint16_t spi_crc_value_get(spi_type* spi_x, spi_crc_direction_type crc_direction);
463void spi_hardware_cs_output_enable(spi_type* spi_x, confirm_state new_state);
464void spi_software_cs_internal_level_set(spi_type* spi_x, spi_software_cs_level_type level);
465void spi_frame_bit_num_set(spi_type* spi_x, spi_frame_bit_num_type bit_num);
466void spi_half_duplex_direction_set(spi_type* spi_x, spi_half_duplex_direction_type direction);
467void spi_enable(spi_type* spi_x, confirm_state new_state);
468void i2s_default_para_init(i2s_init_type* i2s_init_struct);
469void i2s_init(spi_type* spi_x, i2s_init_type* i2s_init_struct);
470void i2s_enable(spi_type* spi_x, confirm_state new_state);
471void spi_i2s_interrupt_enable(spi_type* spi_x, uint32_t spi_i2s_int, confirm_state new_state);
472void spi_i2s_dma_transmitter_enable(spi_type* spi_x, confirm_state new_state);
473void spi_i2s_dma_receiver_enable(spi_type* spi_x, confirm_state new_state);
474void spi_i2s_data_transmit(spi_type* spi_x, uint16_t tx_data);
475uint16_t spi_i2s_data_receive(spi_type* spi_x);
476 flag_status spi_i2s_flag_get(spi_type* spi_x, uint32_t spi_i2s_flag);
477 flag_status spi_i2s_interrupt_flag_get(spi_type* spi_x, uint32_t spi_i2s_flag);
478void spi_i2s_flag_clear(spi_type* spi_x, uint32_t spi_i2s_flag);
479
492#ifdef __cplusplus
493}
494#endif
495
496#endif
at32f413.h
at32f413 header file
spi_init_struct
spi_init_type spi_init_struct
Definition project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c:41
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
flag_status
flag_status
flag status
Definition at32f413.h:292
spi_i2s_interrupt_enable
void spi_i2s_interrupt_enable(spi_type *spi_x, uint32_t spi_i2s_int, confirm_state new_state)
enable or disable the specified spi/i2s interrupts.
Definition at32f413_spi.c:463
i2s_init
void i2s_init(spi_type *spi_x, i2s_init_type *i2s_init_struct)
i2s init config with its setting value.
Definition at32f413_spi.c:315
spi_i2s_data_transmit
void spi_i2s_data_transmit(spi_type *spi_x, uint16_t tx_data)
spi/i2s data transmit
Definition at32f413_spi.c:513
spi_crc_enable
void spi_crc_enable(spi_type *spi_x, confirm_state new_state)
enable or disable the hardware crc calculation for the spi peripheral.
Definition at32f413_spi.c:190
spi_i2s_dma_receiver_enable
void spi_i2s_dma_receiver_enable(spi_type *spi_x, confirm_state new_state)
enable or disable the spi/i2s dma receiver mode.
Definition at32f413_spi.c:498
spi_i2s_flag_get
flag_status spi_i2s_flag_get(spi_type *spi_x, uint32_t spi_i2s_flag)
get flag of the specified spi/i2s peripheral.
Definition at32f413_spi.c:547
i2s_enable
void i2s_enable(spi_type *spi_x, confirm_state new_state)
enable or disable i2s.
Definition at32f413_spi.c:444
spi_crc_polynomial_get
uint16_t spi_crc_polynomial_get(spi_type *spi_x)
return the crc polynomial register value for the spi peripheral.
Definition at32f413_spi.c:176
spi_crc_next_transmit
void spi_crc_next_transmit(spi_type *spi_x)
spi next transmit crc for the spi peripheral.
Definition at32f413_spi.c:151
spi_init
void spi_init(spi_type *spi_x, spi_init_type *spi_init_struct)
spi init config with its setting value.
Definition at32f413_spi.c:90
spi_default_para_init
void spi_default_para_init(spi_init_type *spi_init_struct)
spi init config with its default value.
Definition at32f413_spi.c:70
spi_crc_polynomial_set
void spi_crc_polynomial_set(spi_type *spi_x, uint16_t crc_poly)
set the crc polynomial value for the spi peripheral.
Definition at32f413_spi.c:164
spi_i2s_data_receive
uint16_t spi_i2s_data_receive(spi_type *spi_x)
spi/i2s data receive
Definition at32f413_spi.c:525
spi_crc_value_get
uint16_t spi_crc_value_get(spi_type *spi_x, spi_crc_direction_type crc_direction)
return the transmit or the receive crc value for the spi peripheral.
Definition at32f413_spi.c:205
spi_i2s_reset
void spi_i2s_reset(spi_type *spi_x)
spi reset by crm reset register
Definition at32f413_spi.c:50
spi_half_duplex_direction_set
void spi_half_duplex_direction_set(spi_type *spi_x, spi_half_duplex_direction_type direction)
set the data transmission direction in single line bidirectiona half duplex mode of the spi periphera...
Definition at32f413_spi.c:272
spi_hardware_cs_output_enable
void spi_hardware_cs_output_enable(spi_type *spi_x, confirm_state new_state)
enable or disable the hardware cs output for the spi peripheral.
Definition at32f413_spi.c:223
spi_i2s_interrupt_flag_get
flag_status spi_i2s_interrupt_flag_get(spi_type *spi_x, uint32_t spi_i2s_flag)
get interrupt flag of the specified spi/i2s peripheral.
Definition at32f413_spi.c:576
spi_i2s_flag_clear
void spi_i2s_flag_clear(spi_type *spi_x, uint32_t spi_i2s_flag)
clear flag of the specified spi/i2s peripheral.
Definition at32f413_spi.c:642
i2s_default_para_init
void i2s_default_para_init(i2s_init_type *i2s_init_struct)
i2s init config with its default value.
Definition at32f413_spi.c:297
spi_enable
void spi_enable(spi_type *spi_x, confirm_state new_state)
enable or disable spi.
Definition at32f413_spi.c:286
spi_i2s_dma_transmitter_enable
void spi_i2s_dma_transmitter_enable(spi_type *spi_x, confirm_state new_state)
enable or disable the spi/i2s dma transmitter mode.
Definition at32f413_spi.c:484
spi_frame_bit_num_set
void spi_frame_bit_num_set(spi_type *spi_x, spi_frame_bit_num_type bit_num)
set the data frame bit num for the spi peripheral.
Definition at32f413_spi.c:256
spi_software_cs_internal_level_set
void spi_software_cs_internal_level_set(spi_type *spi_x, spi_software_cs_level_type level)
set the software cs internal level for the spi peripheral.
Definition at32f413_spi.c:241
i2s_clock_polarity_type
i2s_clock_polarity_type
i2s clock polarity type
Definition at32f413_spi.h:247
spi_master_slave_mode_type
spi_master_slave_mode_type
spi master/slave mode type
Definition at32f413_spi.h:96
spi_software_cs_level_type
spi_software_cs_level_type
spi software cs internal level type
Definition at32f413_spi.h:187
i2s_data_channel_format_type
i2s_data_channel_format_type
i2s data bit num and channel bit num type
Definition at32f413_spi.h:225
spi_clock_phase_type
spi_clock_phase_type
spi clock phase (clkpha) type
Definition at32f413_spi.h:114
i2s_audio_sampling_freq_type
i2s_audio_sampling_freq_type
i2s audio frequency type
Definition at32f413_spi.h:208
spi_cs_mode_type
spi_cs_mode_type
spi cs mode type
Definition at32f413_spi.h:123
spi_first_bit_type
spi_first_bit_type
spi transmit first bit (lsb/msb) type
Definition at32f413_spi.h:149
spi_clock_polarity_type
spi_clock_polarity_type
spi clock polarity (clkpol) type
Definition at32f413_spi.h:105
spi_half_duplex_direction_type
spi_half_duplex_direction_type
spi single line bidirectional direction type
Definition at32f413_spi.h:178
spi_transmission_mode_type
spi_transmission_mode_type
spi transmission mode type
Definition at32f413_spi.h:158
i2s_audio_protocol_type
i2s_audio_protocol_type
i2s audio protocol type
Definition at32f413_spi.h:196
spi_mclk_freq_div_type
spi_mclk_freq_div_type
spi master clock frequency division type
Definition at32f413_spi.h:132
spi_frame_bit_num_type
spi_frame_bit_num_type
spi frame bit num type
Definition at32f413_spi.h:87
spi_crc_direction_type
spi_crc_direction_type
spi crc direction type
Definition at32f413_spi.h:169
i2s_operation_mode_type
i2s_operation_mode_type
i2s operation mode type
Definition at32f413_spi.h:236
I2S_CLOCK_POLARITY_LOW
@ I2S_CLOCK_POLARITY_LOW
Definition at32f413_spi.h:248
I2S_CLOCK_POLARITY_HIGH
@ I2S_CLOCK_POLARITY_HIGH
Definition at32f413_spi.h:249
SPI_MODE_SLAVE
@ SPI_MODE_SLAVE
Definition at32f413_spi.h:97
SPI_MODE_MASTER
@ SPI_MODE_MASTER
Definition at32f413_spi.h:98
SPI_SWCS_INTERNAL_LEVEL_LOW
@ SPI_SWCS_INTERNAL_LEVEL_LOW
Definition at32f413_spi.h:188
SPI_SWCS_INTERNAL_LEVEL_HIGHT
@ SPI_SWCS_INTERNAL_LEVEL_HIGHT
Definition at32f413_spi.h:189
I2S_DATA_16BIT_CHANNEL_16BIT
@ I2S_DATA_16BIT_CHANNEL_16BIT
Definition at32f413_spi.h:226
I2S_DATA_24BIT_CHANNEL_32BIT
@ I2S_DATA_24BIT_CHANNEL_32BIT
Definition at32f413_spi.h:228
I2S_DATA_32BIT_CHANNEL_32BIT
@ I2S_DATA_32BIT_CHANNEL_32BIT
Definition at32f413_spi.h:229
I2S_DATA_16BIT_CHANNEL_32BIT
@ I2S_DATA_16BIT_CHANNEL_32BIT
Definition at32f413_spi.h:227
SPI_CLOCK_PHASE_2EDGE
@ SPI_CLOCK_PHASE_2EDGE
Definition at32f413_spi.h:116
SPI_CLOCK_PHASE_1EDGE
@ SPI_CLOCK_PHASE_1EDGE
Definition at32f413_spi.h:115
I2S_AUDIO_FREQUENCY_44_1K
@ I2S_AUDIO_FREQUENCY_44_1K
Definition at32f413_spi.h:215
I2S_AUDIO_FREQUENCY_11_025K
@ I2S_AUDIO_FREQUENCY_11_025K
Definition at32f413_spi.h:211
I2S_AUDIO_FREQUENCY_48K
@ I2S_AUDIO_FREQUENCY_48K
Definition at32f413_spi.h:216
I2S_AUDIO_FREQUENCY_DEFAULT
@ I2S_AUDIO_FREQUENCY_DEFAULT
Definition at32f413_spi.h:209
I2S_AUDIO_FREQUENCY_8K
@ I2S_AUDIO_FREQUENCY_8K
Definition at32f413_spi.h:210
I2S_AUDIO_FREQUENCY_32K
@ I2S_AUDIO_FREQUENCY_32K
Definition at32f413_spi.h:214
I2S_AUDIO_FREQUENCY_192K
@ I2S_AUDIO_FREQUENCY_192K
Definition at32f413_spi.h:218
I2S_AUDIO_FREQUENCY_96K
@ I2S_AUDIO_FREQUENCY_96K
Definition at32f413_spi.h:217
I2S_AUDIO_FREQUENCY_22_05K
@ I2S_AUDIO_FREQUENCY_22_05K
Definition at32f413_spi.h:213
I2S_AUDIO_FREQUENCY_16K
@ I2S_AUDIO_FREQUENCY_16K
Definition at32f413_spi.h:212
SPI_CS_SOFTWARE_MODE
@ SPI_CS_SOFTWARE_MODE
Definition at32f413_spi.h:125
SPI_CS_HARDWARE_MODE
@ SPI_CS_HARDWARE_MODE
Definition at32f413_spi.h:124
SPI_FIRST_BIT_LSB
@ SPI_FIRST_BIT_LSB
Definition at32f413_spi.h:151
SPI_FIRST_BIT_MSB
@ SPI_FIRST_BIT_MSB
Definition at32f413_spi.h:150
SPI_CLOCK_POLARITY_HIGH
@ SPI_CLOCK_POLARITY_HIGH
Definition at32f413_spi.h:107
SPI_CLOCK_POLARITY_LOW
@ SPI_CLOCK_POLARITY_LOW
Definition at32f413_spi.h:106
SPI_HALF_DUPLEX_DIRECTION_TX
@ SPI_HALF_DUPLEX_DIRECTION_TX
Definition at32f413_spi.h:180
SPI_HALF_DUPLEX_DIRECTION_RX
@ SPI_HALF_DUPLEX_DIRECTION_RX
Definition at32f413_spi.h:179
SPI_TRANSMIT_HALF_DUPLEX_RX
@ SPI_TRANSMIT_HALF_DUPLEX_RX
Definition at32f413_spi.h:161
SPI_TRANSMIT_FULL_DUPLEX
@ SPI_TRANSMIT_FULL_DUPLEX
Definition at32f413_spi.h:159
SPI_TRANSMIT_HALF_DUPLEX_TX
@ SPI_TRANSMIT_HALF_DUPLEX_TX
Definition at32f413_spi.h:162
SPI_TRANSMIT_SIMPLEX_RX
@ SPI_TRANSMIT_SIMPLEX_RX
Definition at32f413_spi.h:160
I2S_AUDIO_PROTOCOL_PCM_LONG
@ I2S_AUDIO_PROTOCOL_PCM_LONG
Definition at32f413_spi.h:201
I2S_AUDIO_PROTOCOL_LSB
@ I2S_AUDIO_PROTOCOL_LSB
Definition at32f413_spi.h:199
I2S_AUDIO_PROTOCOL_MSB
@ I2S_AUDIO_PROTOCOL_MSB
Definition at32f413_spi.h:198
I2S_AUDIO_PROTOCOL_PHILLIPS
@ I2S_AUDIO_PROTOCOL_PHILLIPS
Definition at32f413_spi.h:197
I2S_AUDIO_PROTOCOL_PCM_SHORT
@ I2S_AUDIO_PROTOCOL_PCM_SHORT
Definition at32f413_spi.h:200
SPI_MCLK_DIV_16
@ SPI_MCLK_DIV_16
Definition at32f413_spi.h:136
SPI_MCLK_DIV_64
@ SPI_MCLK_DIV_64
Definition at32f413_spi.h:138
SPI_MCLK_DIV_128
@ SPI_MCLK_DIV_128
Definition at32f413_spi.h:139
SPI_MCLK_DIV_4
@ SPI_MCLK_DIV_4
Definition at32f413_spi.h:134
SPI_MCLK_DIV_512
@ SPI_MCLK_DIV_512
Definition at32f413_spi.h:141
SPI_MCLK_DIV_32
@ SPI_MCLK_DIV_32
Definition at32f413_spi.h:137
SPI_MCLK_DIV_2
@ SPI_MCLK_DIV_2
Definition at32f413_spi.h:133
SPI_MCLK_DIV_1024
@ SPI_MCLK_DIV_1024
Definition at32f413_spi.h:142
SPI_MCLK_DIV_256
@ SPI_MCLK_DIV_256
Definition at32f413_spi.h:140
SPI_MCLK_DIV_8
@ SPI_MCLK_DIV_8
Definition at32f413_spi.h:135
SPI_FRAME_8BIT
@ SPI_FRAME_8BIT
Definition at32f413_spi.h:88
SPI_FRAME_16BIT
@ SPI_FRAME_16BIT
Definition at32f413_spi.h:89
SPI_CRC_RX
@ SPI_CRC_RX
Definition at32f413_spi.h:170
SPI_CRC_TX
@ SPI_CRC_TX
Definition at32f413_spi.h:171
I2S_MODE_MASTER_TX
@ I2S_MODE_MASTER_TX
Definition at32f413_spi.h:239
I2S_MODE_MASTER_RX
@ I2S_MODE_MASTER_RX
Definition at32f413_spi.h:240
I2S_MODE_SLAVE_RX
@ I2S_MODE_SLAVE_RX
Definition at32f413_spi.h:238
I2S_MODE_SLAVE_TX
@ I2S_MODE_SLAVE_TX
Definition at32f413_spi.h:237
i2s_init_type
i2s init type
Definition at32f413_spi.h:271
i2s_init_type::audio_sampling_freq
i2s_audio_sampling_freq_type audio_sampling_freq
Definition at32f413_spi.h:274
i2s_init_type::data_channel_format
i2s_data_channel_format_type data_channel_format
Definition at32f413_spi.h:275
i2s_init_type::mclk_output_enable
confirm_state mclk_output_enable
Definition at32f413_spi.h:277
i2s_init_type::audio_protocol
i2s_audio_protocol_type audio_protocol
Definition at32f413_spi.h:273
i2s_init_type::operation_mode
i2s_operation_mode_type operation_mode
Definition at32f413_spi.h:272
i2s_init_type::clock_polarity
i2s_clock_polarity_type clock_polarity
Definition at32f413_spi.h:276
spi_init_type
spi init type
Definition at32f413_spi.h:256
spi_init_type::master_slave_mode
spi_master_slave_mode_type master_slave_mode
Definition at32f413_spi.h:258
spi_init_type::first_bit_transmission
spi_first_bit_type first_bit_transmission
Definition at32f413_spi.h:260
spi_init_type::frame_bit_num
spi_frame_bit_num_type frame_bit_num
Definition at32f413_spi.h:261
spi_init_type::clock_polarity
spi_clock_polarity_type clock_polarity
Definition at32f413_spi.h:262
spi_init_type::cs_mode_selection
spi_cs_mode_type cs_mode_selection
Definition at32f413_spi.h:264
spi_init_type::mclk_freq_division
spi_mclk_freq_div_type mclk_freq_division
Definition at32f413_spi.h:259
spi_init_type::transmission_mode
spi_transmission_mode_type transmission_mode
Definition at32f413_spi.h:257
spi_init_type::clock_phase
spi_clock_phase_type clock_phase
Definition at32f413_spi.h:263
spi_type
type define spi register all
Definition at32f413_spi.h:284
spi_type::tdbe
__IO uint32_t tdbe
Definition at32f413_spi.h:341
spi_type::clkpha
__IO uint32_t clkpha
Definition at32f413_spi.h:294
spi_type::hwcsoe
__IO uint32_t hwcsoe
Definition at32f413_spi.h:322
spi_type::slben
__IO uint32_t slben
Definition at32f413_spi.h:307
spi_type::ntc
__IO uint32_t ntc
Definition at32f413_spi.h:304
spi_type::mdiv_h
__IO uint32_t mdiv_h
Definition at32f413_spi.h:327
spi_type::rdbfie
__IO uint32_t rdbfie
Definition at32f413_spi.h:325
spi_type::mmerr
__IO uint32_t mmerr
Definition at32f413_spi.h:345
spi_type::dmaren
__IO uint32_t dmaren
Definition at32f413_spi.h:320
spi_type::reserved2
__IO uint32_t reserved2
Definition at32f413_spi.h:328
spi_type::bf
__IO uint32_t bf
Definition at32f413_spi.h:347
spi_type::i2sdbn
__IO uint32_t i2sdbn
Definition at32f413_spi.h:413
spi_type::rcrc
__IO uint32_t rcrc
Definition at32f413_spi.h:383
spi_type::errie
__IO uint32_t errie
Definition at32f413_spi.h:324
spi_type::i2scbn
__IO uint32_t i2scbn
Definition at32f413_spi.h:412
spi_type::i2sclkpol
__IO uint32_t i2sclkpol
Definition at32f413_spi.h:414
spi_type::cpoly
__IO uint32_t cpoly
Definition at32f413_spi.h:370
spi_type::ctrl1
__IO uint32_t ctrl1
Definition at32f413_spi.h:291
spi_type::i2sodd
__IO uint32_t i2sodd
Definition at32f413_spi.h:434
spi_type::swcsil
__IO uint32_t swcsil
Definition at32f413_spi.h:300
spi_type::i2sclk
__IO uint32_t i2sclk
Definition at32f413_spi.h:430
spi_type::tcrc
__IO uint32_t tcrc
Definition at32f413_spi.h:396
spi_type::acs
__IO uint32_t acs
Definition at32f413_spi.h:342
spi_type::i2smclkoe
__IO uint32_t i2smclkoe
Definition at32f413_spi.h:435
spi_type::ltf
__IO uint32_t ltf
Definition at32f413_spi.h:299
spi_type::clkpol
__IO uint32_t clkpol
Definition at32f413_spi.h:295
spi_type::slbtd
__IO uint32_t slbtd
Definition at32f413_spi.h:306
spi_type::dmaten
__IO uint32_t dmaten
Definition at32f413_spi.h:321
spi_type::ccen
__IO uint32_t ccen
Definition at32f413_spi.h:305
spi_type::fbn
__IO uint32_t fbn
Definition at32f413_spi.h:303
spi_type::dt
__IO uint32_t dt
Definition at32f413_spi.h:357
spi_type::msten
__IO uint32_t msten
Definition at32f413_spi.h:296
spi_type::ccerr
__IO uint32_t ccerr
Definition at32f413_spi.h:344
spi_type::sts
__IO uint32_t sts
Definition at32f413_spi.h:337
spi_type::reserved1
__IO uint32_t reserved1
Definition at32f413_spi.h:308
spi_type::i2sdiv_h
__IO uint32_t i2sdiv_h
Definition at32f413_spi.h:436
spi_type::opersel
__IO uint32_t opersel
Definition at32f413_spi.h:418
spi_type::i2sdiv_l
__IO uint32_t i2sdiv_l
Definition at32f413_spi.h:433
spi_type::i2smsel
__IO uint32_t i2smsel
Definition at32f413_spi.h:420
spi_type::pcmfssel
__IO uint32_t pcmfssel
Definition at32f413_spi.h:417
spi_type::ctrl2
__IO uint32_t ctrl2
Definition at32f413_spi.h:317
spi_type::roerr
__IO uint32_t roerr
Definition at32f413_spi.h:346
spi_type::i2sctrl
__IO uint32_t i2sctrl
Definition at32f413_spi.h:409
spi_type::stdsel
__IO uint32_t stdsel
Definition at32f413_spi.h:415
spi_type::rdbf
__IO uint32_t rdbf
Definition at32f413_spi.h:340
spi_type::tuerr
__IO uint32_t tuerr
Definition at32f413_spi.h:343
spi_type::mdiv_l
__IO uint32_t mdiv_l
Definition at32f413_spi.h:297
spi_type::spien
__IO uint32_t spien
Definition at32f413_spi.h:298
spi_type::swcsen
__IO uint32_t swcsen
Definition at32f413_spi.h:301
spi_type::ora
__IO uint32_t ora
Definition at32f413_spi.h:302
spi_type::i2sen
__IO uint32_t i2sen
Definition at32f413_spi.h:419
spi_type::tdbeie
__IO uint32_t tdbeie
Definition at32f413_spi.h:326


AT32F413 Firmwary Library: at32f413_tmr.c Source File

  • libraries
  • drivers
  • src
at32f413_tmr.c
Go to the documentation of this file.
1
26#include "at32f413_conf.h"
27
37#ifdef TMR_MODULE_ENABLED
38
51void tmr_reset(tmr_type *tmr_x)
52{
53 if(tmr_x == TMR1)
54 {
55 crm_periph_reset(CRM_TMR1_PERIPH_RESET, TRUE);
56 crm_periph_reset(CRM_TMR1_PERIPH_RESET, FALSE);
57 }
58 else if(tmr_x == TMR2)
59 {
60 crm_periph_reset(CRM_TMR2_PERIPH_RESET, TRUE);
61 crm_periph_reset(CRM_TMR2_PERIPH_RESET, FALSE);
62 }
63 else if(tmr_x == TMR3)
64 {
65 crm_periph_reset(CRM_TMR3_PERIPH_RESET, TRUE);
66 crm_periph_reset(CRM_TMR3_PERIPH_RESET, FALSE);
67 }
68 else if(tmr_x == TMR4)
69 {
70 crm_periph_reset(CRM_TMR4_PERIPH_RESET, TRUE);
71 crm_periph_reset(CRM_TMR4_PERIPH_RESET, FALSE);
72 }
73#if defined (AT32F413TBU7) || defined (AT32F413Rx) || defined (AT32F413Cx) || \
74 defined (AT32F413Kx)
75 else if(tmr_x == TMR5)
76 {
77 crm_periph_reset(CRM_TMR5_PERIPH_RESET, TRUE);
78 crm_periph_reset(CRM_TMR5_PERIPH_RESET, FALSE);
79 }
80#if defined (AT32F413CCU7) || defined (AT32F413CCT7) || defined (AT32F413RCT7)
81 else if(tmr_x == TMR8)
82 {
83 crm_periph_reset(CRM_TMR8_PERIPH_RESET, TRUE);
84 crm_periph_reset(CRM_TMR8_PERIPH_RESET, FALSE);
85 }
86#endif
87 else if(tmr_x == TMR9)
88 {
89 crm_periph_reset(CRM_TMR9_PERIPH_RESET, TRUE);
90 crm_periph_reset(CRM_TMR9_PERIPH_RESET, FALSE);
91 }
92 else if(tmr_x == TMR10)
93 {
94 crm_periph_reset(CRM_TMR10_PERIPH_RESET, TRUE);
95 crm_periph_reset(CRM_TMR10_PERIPH_RESET, FALSE);
96 }
97 else if(tmr_x == TMR11)
98 {
99 crm_periph_reset(CRM_TMR11_PERIPH_RESET, TRUE);
100 crm_periph_reset(CRM_TMR11_PERIPH_RESET, FALSE);
101 }
102#endif
103}
104
114void tmr_counter_enable(tmr_type *tmr_x, confirm_state new_state)
115{
116 /* tmr counter enable */
117 tmr_x->ctrl1_bit.tmren = new_state;
118}
119
126void tmr_output_default_para_init(tmr_output_config_type *tmr_output_struct)
127{
128 tmr_output_struct->oc_mode = TMR_OUTPUT_CONTROL_OFF;
129 tmr_output_struct->oc_idle_state = FALSE;
130 tmr_output_struct->occ_idle_state = FALSE;
131 tmr_output_struct->oc_polarity = TMR_OUTPUT_ACTIVE_HIGH;
132 tmr_output_struct->occ_polarity = TMR_OUTPUT_ACTIVE_HIGH;
133 tmr_output_struct->oc_output_state = FALSE;
134 tmr_output_struct->occ_output_state = FALSE;
135}
136
143void tmr_input_default_para_init(tmr_input_config_type *tmr_input_struct)
144{
145 tmr_input_struct->input_channel_select = TMR_SELECT_CHANNEL_1;
146 tmr_input_struct->input_polarity_select = TMR_INPUT_RISING_EDGE;
147 tmr_input_struct->input_mapped_select = TMR_CC_CHANNEL_MAPPED_DIRECT;
148 tmr_input_struct->input_filter_value = 0x0;
149}
150
157void tmr_brkdt_default_para_init(tmr_brkdt_config_type *tmr_brkdt_struct)
158{
159 tmr_brkdt_struct->deadtime = 0x0;
160 tmr_brkdt_struct->brk_polarity = TMR_BRK_INPUT_ACTIVE_LOW;
161 tmr_brkdt_struct->wp_level = TMR_WP_OFF;
162 tmr_brkdt_struct->auto_output_enable = FALSE ;
163 tmr_brkdt_struct->fcsoen_state = FALSE ;
164 tmr_brkdt_struct->fcsodis_state = FALSE ;
165 tmr_brkdt_struct->brk_enable = FALSE ;
166}
167
179void tmr_base_init(tmr_type* tmr_x, uint32_t tmr_pr, uint32_t tmr_div)
180{
181 /* set the pr value */
182 tmr_x->pr = tmr_pr;
183
184 /* set the div value */
185 tmr_x->div = tmr_div;
186
187 /* trigger the overflow event to immediately reload pr value and div value */
188 tmr_x->swevt_bit.ovfswtr = TRUE;
189}
190
204void tmr_clock_source_div_set(tmr_type *tmr_x, tmr_clock_division_type tmr_clock_div)
205{
206 /* set tmr clock source division */
207 tmr_x->ctrl1_bit.clkdiv = tmr_clock_div;
208}
209
225void tmr_cnt_dir_set(tmr_type *tmr_x, tmr_count_mode_type tmr_cnt_dir)
226{
227 /* set the cnt direct */
228 tmr_x->ctrl1_bit.cnt_dir = tmr_cnt_dir;
229}
230
239void tmr_repetition_counter_set(tmr_type *tmr_x, uint8_t tmr_rpr_value)
240{
241 /* set the repetition counter value */
242 tmr_x->rpr_bit.rpr = tmr_rpr_value;
243}
244
255void tmr_counter_value_set(tmr_type *tmr_x, uint32_t tmr_cnt_value)
256{
257 /* set the tmr counter value */
258 tmr_x->cval = tmr_cnt_value;
259}
260
269uint32_t tmr_counter_value_get(tmr_type *tmr_x)
270{
271 return tmr_x->cval;
272}
273
283void tmr_div_value_set(tmr_type *tmr_x, uint32_t tmr_div_value)
284{
285 /* set the tmr div value */
286 tmr_x->div = tmr_div_value;
287}
288
297uint32_t tmr_div_value_get(tmr_type *tmr_x)
298{
299 return tmr_x->div;
300}
301
318void tmr_output_channel_config(tmr_type *tmr_x, tmr_channel_select_type tmr_channel,
319 tmr_output_config_type *tmr_output_struct)
320{
321 uint16_t channel_index = 0, channel_c_index = 0, channel = 0, chx_offset, chcx_offset;
322
323 chx_offset = (8 + tmr_channel);
324 chcx_offset = (9 + tmr_channel);
325
326 /* get channel idle state bit position in ctrl2 register */
327 channel_index = (uint16_t)(tmr_output_struct->oc_idle_state << chx_offset);
328
329 /* get channel complementary idle state bit position in ctrl2 register */
330 channel_c_index = (uint16_t)(tmr_output_struct->occ_idle_state << chcx_offset);
331
332 /* set output channel complementary idle state */
333 tmr_x->ctrl2 &= ~(1<<chcx_offset);
334 tmr_x->ctrl2 |= channel_c_index;
335
336 /* set output channel idle state */
337 tmr_x->ctrl2 &= ~(1<<chx_offset);
338 tmr_x->ctrl2 |= channel_index;
339
340 /* set channel output mode */
341 channel = tmr_channel;
342
343 /* reset output channel(complementary) enable bit */
344 chx_offset = (tmr_channel * 2);
345 chcx_offset = ((tmr_channel * 2) + 2);
346 tmr_x->cctrl &= ~(1<<chcx_offset);
347 tmr_x->cctrl &= ~(1<<chx_offset);
348
349 switch(channel)
350 {
351 case TMR_SELECT_CHANNEL_1:
352 tmr_x->cm1_output_bit.c1c = FALSE;
353 tmr_x->cm1_output_bit.c1octrl = tmr_output_struct->oc_mode;
354 break;
355
356 case TMR_SELECT_CHANNEL_2:
357 tmr_x->cm1_output_bit.c2c = FALSE;
358 tmr_x->cm1_output_bit.c2octrl = tmr_output_struct->oc_mode;
359 break;
360
361 case TMR_SELECT_CHANNEL_3:
362 tmr_x->cm2_output_bit.c3c = FALSE;
363 tmr_x->cm2_output_bit.c3octrl = tmr_output_struct->oc_mode;
364 break;
365
366 case TMR_SELECT_CHANNEL_4:
367 tmr_x->cm2_output_bit.c4c = FALSE;
368 tmr_x->cm2_output_bit.c4octrl = tmr_output_struct->oc_mode;
369 break;
370
371 default:
372 break;
373 }
374
375 chx_offset = ((tmr_channel * 2) + 1);
376 chcx_offset = ((tmr_channel * 2) + 3);
377
378 /* get channel polarity bit position in cctrl register */
379 channel_index = (uint16_t)(tmr_output_struct->oc_polarity << chx_offset);
380
381 /* get channel complementary polarity bit position in cctrl register */
382 channel_c_index = (uint16_t)(tmr_output_struct->occ_polarity << chcx_offset);
383
384 /* set output channel complementary polarity */
385 tmr_x->cctrl &= ~(1<<chcx_offset);
386 tmr_x->cctrl |= channel_c_index;
387
388 /* set output channel polarity */
389 tmr_x->cctrl &= ~(1<<chx_offset);
390 tmr_x->cctrl |= channel_index;
391
392 /* get channel enable bit position in cctrl register */
393 channel_index = (uint16_t)(tmr_output_struct->oc_output_state << (tmr_channel * 2));
394
395 /* get channel complementary enable bit position in cctrl register */
396 channel_c_index = (uint16_t)(tmr_output_struct->occ_output_state << ((tmr_channel * 2) + 2));
397
398 /* set output channel complementary enable bit */
399 tmr_x->cctrl |= channel_c_index;
400
401 /* set output channel enable bit */
402 tmr_x->cctrl |= channel_index;
403}
404
429void tmr_output_channel_mode_select(tmr_type *tmr_x, tmr_channel_select_type tmr_channel,
430 tmr_output_control_mode_type oc_mode)
431{
432 uint16_t channel;
433
434 channel = tmr_channel;
435
436 switch(channel)
437 {
438 case TMR_SELECT_CHANNEL_1:
439 tmr_x->cm1_output_bit.c1octrl = oc_mode;
440 break;
441
442 case TMR_SELECT_CHANNEL_2:
443 tmr_x->cm1_output_bit.c2octrl = oc_mode;
444 break;
445
446 case TMR_SELECT_CHANNEL_3:
447 tmr_x->cm2_output_bit.c3octrl = oc_mode;
448 break;
449
450 case TMR_SELECT_CHANNEL_4:
451 tmr_x->cm2_output_bit.c4octrl = oc_mode;
452 break;
453
454 default:
455 break;
456 }
457}
469void tmr_period_value_set(tmr_type *tmr_x, uint32_t tmr_pr_value)
470{
471 /* set tmr period value */
472 tmr_x->pr = tmr_pr_value;
473}
474
485uint32_t tmr_period_value_get(tmr_type *tmr_x)
486{
487 return tmr_x->pr;
488}
489
506void tmr_channel_value_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel,
507 uint32_t tmr_channel_value)
508{
509 uint16_t channel;
510
511 channel = tmr_channel;
512
513 /* set tmr channel value */
514 switch(channel)
515 {
516 case TMR_SELECT_CHANNEL_1:
517 tmr_x->c1dt = tmr_channel_value;
518 break;
519
520 case TMR_SELECT_CHANNEL_2:
521 tmr_x->c2dt = tmr_channel_value;
522 break;
523
524 case TMR_SELECT_CHANNEL_3:
525 tmr_x->c3dt = tmr_channel_value;
526 break;
527
528 case TMR_SELECT_CHANNEL_4:
529 tmr_x->c4dt = tmr_channel_value;
530 break;
531
532 default:
533 break;
534 }
535}
536
551uint32_t tmr_channel_value_get(tmr_type *tmr_x, tmr_channel_select_type tmr_channel)
552{
553 uint32_t cc_value_get = 0;
554 uint16_t channel;
555
556 channel = tmr_channel;
557
558 /* get tmr channel value */
559 switch(channel)
560 {
561 case TMR_SELECT_CHANNEL_1:
562 cc_value_get = tmr_x->c1dt;
563 break;
564
565 case TMR_SELECT_CHANNEL_2:
566 cc_value_get = tmr_x->c2dt;
567 break;
568
569 case TMR_SELECT_CHANNEL_3:
570 cc_value_get = tmr_x->c3dt;
571 break;
572
573 case TMR_SELECT_CHANNEL_4:
574 cc_value_get = tmr_x->c4dt;
575 break;
576
577 default:
578 break;
579 }
580
581 return cc_value_get;
582}
592void tmr_period_buffer_enable(tmr_type *tmr_x, confirm_state new_state)
593{
594 /* tmr period buffer set */
595 tmr_x->ctrl1_bit.prben = new_state;
596}
597
613void tmr_output_channel_buffer_enable(tmr_type *tmr_x, tmr_channel_select_type tmr_channel,
614 confirm_state new_state)
615{
616 uint16_t channel;
617
618 channel = tmr_channel;
619
620 /* get tmr channel value */
621 switch(channel)
622 {
623 case TMR_SELECT_CHANNEL_1:
624 tmr_x->cm1_output_bit.c1oben = new_state;
625 break;
626
627 case TMR_SELECT_CHANNEL_2:
628 tmr_x->cm1_output_bit.c2oben = new_state;
629 break;
630
631 case TMR_SELECT_CHANNEL_3:
632 tmr_x->cm2_output_bit.c3oben = new_state;
633 break;
634
635 case TMR_SELECT_CHANNEL_4:
636 tmr_x->cm2_output_bit.c4oben = new_state;
637 break;
638
639 default:
640 break;
641 }
642}
643
659void tmr_output_channel_immediately_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel,
660 confirm_state new_state)
661{
662 uint16_t channel;
663
664 channel = tmr_channel;
665
666 /* get tmr channel value */
667 switch(channel)
668 {
669 case TMR_SELECT_CHANNEL_1:
670 tmr_x->cm1_output_bit.c1oien = new_state;
671 break;
672
673 case TMR_SELECT_CHANNEL_2:
674 tmr_x->cm1_output_bit.c2oien = new_state;
675 break;
676
677 case TMR_SELECT_CHANNEL_3:
678 tmr_x->cm2_output_bit.c3oien = new_state;
679 break;
680
681 case TMR_SELECT_CHANNEL_4:
682 tmr_x->cm2_output_bit.c4oien = new_state;
683 break;
684
685 default:
686 break;
687 }
688}
689
705void tmr_output_channel_switch_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel,
706 confirm_state new_state)
707{
708 uint16_t channel;
709
710 channel = tmr_channel;
711
712 /* get tmr channel value */
713 switch(channel)
714 {
715 case TMR_SELECT_CHANNEL_1:
716 tmr_x->cm1_output_bit.c1osen = new_state;
717 break;
718
719 case TMR_SELECT_CHANNEL_2:
720 tmr_x->cm1_output_bit.c2osen = new_state;
721 break;
722
723 case TMR_SELECT_CHANNEL_3:
724 tmr_x->cm2_output_bit.c3osen = new_state;
725 break;
726
727 case TMR_SELECT_CHANNEL_4:
728 tmr_x->cm2_output_bit.c4osen = new_state;
729 break;
730
731 default:
732 break;
733 }
734}
735
744void tmr_one_cycle_mode_enable(tmr_type *tmr_x, confirm_state new_state)
745{
746 /* tmr one cycle mode enable */
747 tmr_x->ctrl1_bit.ocmen = new_state;
748}
749
758void tmr_32_bit_function_enable (tmr_type *tmr_x, confirm_state new_state)
759{
760 /* tmr 32 bit function(plus mode) enable,only for TMR2/TMR5 */
761 if((tmr_x == TMR2)
762#if defined (AT32F413TBU7) || defined (AT32F413Rx) || defined (AT32F413Cx) || \
763 defined (AT32F413Kx)
764 || (tmr_x == TMR5)
765#endif
766 )
767 {
768 tmr_x->ctrl1_bit.pmen = new_state;
769 }
770}
771
781void tmr_overflow_request_source_set(tmr_type *tmr_x, confirm_state new_state)
782{
783 tmr_x->ctrl1_bit.ovfs = new_state;
784}
785
795void tmr_overflow_event_disable(tmr_type *tmr_x, confirm_state new_state)
796{
797 tmr_x->ctrl1_bit.ovfen = new_state;
798}
799
816void tmr_input_channel_init(tmr_type *tmr_x, tmr_input_config_type *input_struct,
817 tmr_channel_input_divider_type divider_factor)
818{
819 uint16_t channel = 0;
820
821 /* get channel selected */
822 channel = input_struct->input_channel_select;
823
824 switch(channel)
825 {
826 case TMR_SELECT_CHANNEL_1:
827 tmr_x->cctrl_bit.c1en = FALSE;
828 tmr_x->cctrl_bit.c1p = (uint32_t)input_struct->input_polarity_select;
829 tmr_x->cctrl_bit.c1cp = (input_struct->input_polarity_select & 0x2) >> 1;
830 tmr_x->cm1_input_bit.c1c = input_struct->input_mapped_select;
831 tmr_x->cm1_input_bit.c1df = input_struct->input_filter_value;
832 tmr_x->cm1_input_bit.c1idiv = divider_factor;
833 tmr_x->cctrl_bit.c1en = TRUE;
834 break;
835
836 case TMR_SELECT_CHANNEL_2:
837 tmr_x->cctrl_bit.c2en = FALSE;
838 tmr_x->cctrl_bit.c2p = (uint32_t)input_struct->input_polarity_select;
839 tmr_x->cctrl_bit.c2cp = (input_struct->input_polarity_select & 0x2) >> 1;
840 tmr_x->cm1_input_bit.c2c = input_struct->input_mapped_select;
841 tmr_x->cm1_input_bit.c2df = input_struct->input_filter_value;
842 tmr_x->cm1_input_bit.c2idiv = divider_factor;
843 tmr_x->cctrl_bit.c2en = TRUE;
844 break;
845
846 case TMR_SELECT_CHANNEL_3:
847 tmr_x->cctrl_bit.c3en = FALSE;
848 tmr_x->cctrl_bit.c3p = (uint32_t)input_struct->input_polarity_select;
849 tmr_x->cctrl_bit.c3cp = (input_struct->input_polarity_select & 0x2) >> 1;
850 tmr_x->cm2_input_bit.c3c = input_struct->input_mapped_select;
851 tmr_x->cm2_input_bit.c3df = input_struct->input_filter_value;
852 tmr_x->cm2_input_bit.c3idiv = divider_factor;
853 tmr_x->cctrl_bit.c3en = TRUE;
854 break;
855
856 case TMR_SELECT_CHANNEL_4:
857 tmr_x->cctrl_bit.c4en = FALSE;
858 tmr_x->cctrl_bit.c4p = (uint32_t)input_struct->input_polarity_select;
859 tmr_x->cm2_input_bit.c4c = input_struct->input_mapped_select;
860 tmr_x->cm2_input_bit.c4df = input_struct->input_filter_value;
861 tmr_x->cm2_input_bit.c4idiv = divider_factor;
862 tmr_x->cctrl_bit.c4en = TRUE;
863 break;
864
865 default:
866 break;
867 }
868}
869
888void tmr_channel_enable(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, confirm_state new_state)
889{
890 uint16_t channel;
891
892 channel = tmr_channel;
893
894 switch(channel)
895 {
896 case TMR_SELECT_CHANNEL_1:
897 tmr_x->cctrl_bit.c1en = new_state;
898 break;
899
900 case TMR_SELECT_CHANNEL_1C:
901 tmr_x->cctrl_bit.c1cen = new_state;
902 break;
903
904 case TMR_SELECT_CHANNEL_2:
905 tmr_x->cctrl_bit.c2en = new_state;
906 break;
907
908 case TMR_SELECT_CHANNEL_2C:
909 tmr_x->cctrl_bit.c2cen = new_state;
910 break;
911
912 case TMR_SELECT_CHANNEL_3:
913 tmr_x->cctrl_bit.c3en = new_state;
914 break;
915
916 case TMR_SELECT_CHANNEL_3C:
917 tmr_x->cctrl_bit.c3cen = new_state;
918 break;
919
920 case TMR_SELECT_CHANNEL_4:
921 tmr_x->cctrl_bit.c4en = new_state;
922 break;
923
924 default:
925 break;
926 }
927}
928
944void tmr_input_channel_filter_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel,
945 uint16_t filter_value)
946{
947 uint16_t channel;
948
949 channel = tmr_channel;
950
951 switch(channel)
952 {
953 case TMR_SELECT_CHANNEL_1:
954 tmr_x->cm1_input_bit.c1df = filter_value;
955 break;
956
957 case TMR_SELECT_CHANNEL_2:
958 tmr_x->cm1_input_bit.c2df = filter_value;
959 break;
960
961 case TMR_SELECT_CHANNEL_3:
962 tmr_x->cm2_input_bit.c3df = filter_value;
963 break;
964
965 case TMR_SELECT_CHANNEL_4:
966 tmr_x->cm2_input_bit.c4df = filter_value;
967 break;
968
969 default:
970 break;
971 }
972}
973
990void tmr_pwm_input_config(tmr_type *tmr_x, tmr_input_config_type *input_struct,
991 tmr_channel_input_divider_type divider_factor)
992{
993 uint16_t channel = 0;
994
995 /* get channel selected */
996 channel = input_struct->input_channel_select;
997
998 switch(channel)
999 {
1000 case TMR_SELECT_CHANNEL_1:
1001 tmr_x->cctrl_bit.c1en = FALSE;
1002 tmr_x->cctrl_bit.c2en = FALSE;
1003 if(input_struct->input_polarity_select == TMR_INPUT_RISING_EDGE)
1004 {
1005 /* set channel polarity */
1006 tmr_x->cctrl_bit.c1p = TMR_INPUT_RISING_EDGE;
1007 tmr_x->cctrl_bit.c2p = TMR_INPUT_FALLING_EDGE;
1008 }
1009 else if(input_struct->input_polarity_select == TMR_INPUT_FALLING_EDGE)
1010 {
1011 /* set channel polarity */
1012 tmr_x->cctrl_bit.c1p = TMR_INPUT_FALLING_EDGE;
1013 tmr_x->cctrl_bit.c2p = TMR_INPUT_RISING_EDGE;
1014 }
1015
1016 if(input_struct->input_mapped_select == TMR_CC_CHANNEL_MAPPED_DIRECT)
1017 {
1018 /* ic1 is mapped on ti1 */
1019 tmr_x->cm1_input_bit.c1c = TMR_CC_CHANNEL_MAPPED_DIRECT;
1020
1021 /* ic1 is mapped on ti2 */
1022 tmr_x->cm1_input_bit.c2c = TMR_CC_CHANNEL_MAPPED_INDIRECT;
1023 }
1024 else if(input_struct->input_mapped_select == TMR_CC_CHANNEL_MAPPED_INDIRECT)
1025 {
1026 /* ic1 is mapped on ti1 */
1027 tmr_x->cm1_input_bit.c1c = TMR_CC_CHANNEL_MAPPED_INDIRECT;
1028
1029 /* ic1 is mapped on ti2 */
1030 tmr_x->cm1_input_bit.c2c = TMR_CC_CHANNEL_MAPPED_DIRECT;
1031 }
1032
1033 /* set input ch1 and ch2 filter value*/
1034 tmr_x->cm1_input_bit.c1df = input_struct->input_filter_value;
1035 tmr_x->cm1_input_bit.c2df = input_struct->input_filter_value;
1036
1037 /*set input ch1 and ch2 divider value*/
1038 tmr_x->cm1_input_bit.c1idiv = divider_factor;
1039 tmr_x->cm1_input_bit.c2idiv = divider_factor;
1040
1041 tmr_x->cctrl_bit.c1en = TRUE;
1042 tmr_x->cctrl_bit.c2en = TRUE;
1043 break;
1044
1045 case TMR_SELECT_CHANNEL_2:
1046 tmr_x->cctrl_bit.c1en = FALSE;
1047 tmr_x->cctrl_bit.c2en = FALSE;
1048 if(input_struct->input_polarity_select == TMR_INPUT_RISING_EDGE)
1049 {
1050 /* set channel polarity */
1051 tmr_x->cctrl_bit.c2p = TMR_INPUT_RISING_EDGE;
1052 tmr_x->cctrl_bit.c1p = TMR_INPUT_FALLING_EDGE;
1053 }
1054 else if(input_struct->input_polarity_select == TMR_INPUT_FALLING_EDGE)
1055 {
1056 /* set channel polarity */
1057 tmr_x->cctrl_bit.c2p = TMR_INPUT_FALLING_EDGE;
1058 tmr_x->cctrl_bit.c1p = TMR_INPUT_RISING_EDGE;
1059 }
1060
1061 if(input_struct->input_mapped_select == TMR_CC_CHANNEL_MAPPED_DIRECT)
1062 {
1063 /* set mapped direct */
1064 tmr_x->cm1_input_bit.c2c = TMR_CC_CHANNEL_MAPPED_DIRECT;
1065 tmr_x->cm1_input_bit.c1c = TMR_CC_CHANNEL_MAPPED_INDIRECT;
1066 }
1067 else if(input_struct->input_mapped_select == TMR_CC_CHANNEL_MAPPED_INDIRECT)
1068 {
1069 /* set mapped direct */
1070 tmr_x->cm1_input_bit.c2c = TMR_CC_CHANNEL_MAPPED_INDIRECT;
1071 tmr_x->cm1_input_bit.c1c = TMR_CC_CHANNEL_MAPPED_DIRECT;
1072 }
1073
1074 /* set input ch1 and ch2 filter value*/
1075 tmr_x->cm1_input_bit.c1df = input_struct->input_filter_value;
1076 tmr_x->cm1_input_bit.c2df = input_struct->input_filter_value;
1077
1078 /*set input ch1 and ch2 divider value*/
1079 tmr_x->cm1_input_bit.c1idiv = divider_factor;
1080 tmr_x->cm1_input_bit.c2idiv = divider_factor;
1081
1082 tmr_x->cctrl_bit.c1en = TRUE;
1083 tmr_x->cctrl_bit.c2en = TRUE;
1084 break;
1085
1086 default:
1087 break;
1088 }
1089}
1090
1102void tmr_channel1_input_select(tmr_type *tmr_x, tmr_channel1_input_connected_type ch1_connect)
1103{
1104 tmr_x->ctrl2_bit.c1insel = ch1_connect;
1105}
1106
1127void tmr_input_channel_divider_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel,
1128 tmr_channel_input_divider_type divider_factor)
1129{
1130 uint16_t channel;
1131
1132 channel = tmr_channel;
1133
1134 switch(channel)
1135 {
1136 case TMR_SELECT_CHANNEL_1:
1137 tmr_x->cm1_input_bit.c1idiv = divider_factor;
1138 break;
1139
1140 case TMR_SELECT_CHANNEL_2:
1141 tmr_x->cm1_input_bit.c2idiv = divider_factor;
1142 break;
1143
1144 case TMR_SELECT_CHANNEL_3:
1145 tmr_x->cm2_input_bit.c3idiv = divider_factor;
1146 break;
1147
1148 case TMR_SELECT_CHANNEL_4:
1149 tmr_x->cm2_input_bit.c4idiv = divider_factor;
1150 break;
1151
1152 default:
1153 break;
1154 }
1155}
1156
1174void tmr_primary_mode_select(tmr_type *tmr_x, tmr_primary_select_type primary_mode)
1175{
1176 tmr_x->ctrl2_bit.ptos = primary_mode;
1177}
1178
1196void tmr_sub_mode_select(tmr_type *tmr_x, tmr_sub_mode_select_type sub_mode)
1197{
1198 tmr_x->stctrl_bit.smsel = sub_mode;
1199}
1200
1212void tmr_channel_dma_select(tmr_type *tmr_x, tmr_dma_request_source_type cc_dma_select)
1213{
1214 tmr_x->ctrl2_bit.drs = cc_dma_select;
1215}
1216
1225void tmr_hall_select(tmr_type *tmr_x, confirm_state new_state)
1226{
1227 tmr_x->ctrl2_bit.ccfs = new_state;
1228}
1229
1238void tmr_channel_buffer_enable(tmr_type *tmr_x, confirm_state new_state)
1239{
1240 tmr_x->ctrl2_bit.cbctrl = new_state;
1241}
1242
1260void tmr_trigger_input_select(tmr_type *tmr_x, sub_tmr_input_sel_type trigger_select)
1261{
1262 tmr_x->stctrl_bit.stis = trigger_select;
1263}
1264
1273void tmr_sub_sync_mode_set(tmr_type *tmr_x, confirm_state new_state)
1274{
1275 tmr_x->stctrl_bit.sts = new_state;
1276}
1277
1296void tmr_dma_request_enable(tmr_type *tmr_x, tmr_dma_request_type dma_request, confirm_state new_state)
1297{
1298 if(new_state == TRUE)
1299 {
1300 tmr_x->iden |= dma_request;
1301 }
1302 else if(new_state == FALSE)
1303 {
1304 tmr_x->iden &= ~dma_request;
1305 }
1306}
1307
1327void tmr_interrupt_enable(tmr_type *tmr_x, uint32_t tmr_interrupt, confirm_state new_state)
1328{
1329 if(new_state == TRUE)
1330 {
1331 tmr_x->iden |= tmr_interrupt;
1332 }
1333 else if(new_state == FALSE)
1334 {
1335 tmr_x->iden &= ~tmr_interrupt;
1336 }
1337}
1338
1357 flag_status tmr_interrupt_flag_get(tmr_type *tmr_x, uint32_t tmr_flag)
1358{
1359 flag_status status = RESET;
1360
1361 if((tmr_x->ists & tmr_flag) && (tmr_x->iden & tmr_flag))
1362 {
1363 status = SET;
1364 }
1365 else
1366 {
1367 status = RESET;
1368 }
1369
1370 return status;
1371}
1372
1395 flag_status tmr_flag_get(tmr_type *tmr_x, uint32_t tmr_flag)
1396{
1397 flag_status status = RESET;
1398
1399 if((tmr_x->ists & tmr_flag) != RESET)
1400 {
1401 status = SET;
1402 }
1403 else
1404 {
1405 status = RESET;
1406 }
1407
1408 return status;
1409}
1410
1433void tmr_flag_clear(tmr_type *tmr_x, uint32_t tmr_flag)
1434{
1435 tmr_x->ists = ~tmr_flag;
1436}
1437
1456void tmr_event_sw_trigger(tmr_type *tmr_x, tmr_event_trigger_type tmr_event)
1457{
1458 tmr_x->swevt |= tmr_event;
1459}
1460
1469void tmr_output_enable(tmr_type *tmr_x, confirm_state new_state)
1470{
1471 tmr_x->brk_bit.oen = new_state;
1472}
1473
1481void tmr_internal_clock_set(tmr_type *tmr_x)
1482{
1483 tmr_x->stctrl_bit.smsel = TMR_SUB_MODE_DIABLE;
1484}
1485
1507void tmr_output_channel_polarity_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel,
1508 tmr_polarity_active_type oc_polarity)
1509{
1510 uint16_t channel;
1511
1512 channel = tmr_channel;
1513
1514 switch(channel)
1515 {
1516 case TMR_SELECT_CHANNEL_1:
1517 tmr_x->cctrl_bit.c1p = (uint32_t)oc_polarity;
1518 break;
1519
1520 case TMR_SELECT_CHANNEL_2:
1521 tmr_x->cctrl_bit.c2p = (uint32_t)oc_polarity;
1522 break;
1523
1524 case TMR_SELECT_CHANNEL_3:
1525 tmr_x->cctrl_bit.c3p = (uint32_t)oc_polarity;
1526 break;
1527
1528 case TMR_SELECT_CHANNEL_4:
1529 tmr_x->cctrl_bit.c4p = (uint32_t)oc_polarity;
1530 break;
1531
1532 case TMR_SELECT_CHANNEL_1C:
1533 tmr_x->cctrl_bit.c1cp = (uint32_t)oc_polarity;
1534 break;
1535
1536 case TMR_SELECT_CHANNEL_2C:
1537 tmr_x->cctrl_bit.c2cp = (uint32_t)oc_polarity;
1538 break;
1539
1540 case TMR_SELECT_CHANNEL_3C:
1541 tmr_x->cctrl_bit.c3cp = (uint32_t)oc_polarity;
1542 break;
1543
1544 default:
1545 break;
1546 }
1547}
1548
1567void tmr_external_clock_config(tmr_type *tmr_x, tmr_external_signal_divider_type es_divide,
1568 tmr_external_signal_polarity_type es_polarity, uint16_t es_filter)
1569{
1570 tmr_x->stctrl_bit.esdiv = es_divide;
1571 tmr_x->stctrl_bit.esp = es_polarity;
1572 tmr_x->stctrl_bit.esf = es_filter;
1573}
1574
1593void tmr_external_clock_mode1_config(tmr_type *tmr_x, tmr_external_signal_divider_type es_divide,
1594 tmr_external_signal_polarity_type es_polarity, uint16_t es_filter)
1595{
1596 tmr_external_clock_config(tmr_x, es_divide, es_polarity, es_filter);
1597 tmr_x->stctrl_bit.smsel = TMR_SUB_EXTERNAL_CLOCK_MODE_A;
1598 tmr_x->stctrl_bit.stis = TMR_SUB_INPUT_SEL_EXTIN;
1599}
1600
1619void tmr_external_clock_mode2_config(tmr_type *tmr_x, tmr_external_signal_divider_type es_divide,
1620 tmr_external_signal_polarity_type es_polarity, uint16_t es_filter)
1621{
1622 tmr_external_clock_config(tmr_x, es_divide, es_polarity, es_filter);
1623 tmr_x->stctrl_bit.ecmben = TRUE;
1624}
1625
1648void tmr_encoder_mode_config(tmr_type *tmr_x, tmr_encoder_mode_type encoder_mode, tmr_input_polarity_type
1649 ic1_polarity, tmr_input_polarity_type ic2_polarity)
1650{
1651 tmr_x->stctrl_bit.smsel = encoder_mode;
1652
1653 tmr_x->cctrl_bit.c1en = FALSE;
1654 tmr_x->cctrl_bit.c2en = FALSE;
1655
1656 /* set ic1 polarity */
1657 tmr_x->cctrl_bit.c1p = (ic1_polarity & 0x1);
1658 tmr_x->cctrl_bit.c1cp = (ic1_polarity >> 1);
1659 /* set ic1 as input channel */
1660 tmr_x->cm1_input_bit.c1c = TMR_CC_CHANNEL_MAPPED_DIRECT;
1661
1662 /* set ic2 polarity */
1663 tmr_x->cctrl_bit.c2p = (ic2_polarity & 0x1);
1664 tmr_x->cctrl_bit.c2cp = (ic2_polarity >> 1);
1665 /* set ic2 as input channel */
1666 tmr_x->cm1_input_bit.c2c = TMR_CC_CHANNEL_MAPPED_DIRECT;
1667}
1668
1687void tmr_force_output_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel,
1688 tmr_force_output_type force_output)
1689{
1690 uint16_t channel;
1691
1692 channel = tmr_channel;
1693
1694 switch(channel)
1695 {
1696 case TMR_SELECT_CHANNEL_1:
1697 tmr_x->cm1_output_bit.c1octrl = force_output;
1698 break;
1699
1700 case TMR_SELECT_CHANNEL_2:
1701 tmr_x->cm1_output_bit.c2octrl = force_output;
1702 break;
1703
1704 case TMR_SELECT_CHANNEL_3:
1705 tmr_x->cm2_output_bit.c3octrl = force_output;
1706 break;
1707
1708 case TMR_SELECT_CHANNEL_4:
1709 tmr_x->cm2_output_bit.c4octrl = force_output;
1710 break;
1711
1712 default:
1713 break;
1714 }
1715}
1716
1753void tmr_dma_control_config(tmr_type *tmr_x, tmr_dma_transfer_length_type dma_length,
1754 tmr_dma_address_type dma_base_address)
1755{
1756 tmr_x->dmactrl_bit.dtb = dma_length;
1757 tmr_x->dmactrl_bit.addr = dma_base_address;
1758}
1759
1769void tmr_brkdt_config(tmr_type *tmr_x, tmr_brkdt_config_type *brkdt_struct)
1770{
1771 tmr_x->brk_bit.brken = brkdt_struct->brk_enable;
1772 tmr_x->brk_bit.dtc = brkdt_struct->deadtime;
1773 tmr_x->brk_bit.fcsodis = brkdt_struct->fcsodis_state;
1774 tmr_x->brk_bit.fcsoen = brkdt_struct->fcsoen_state;
1775 tmr_x->brk_bit.brkv = brkdt_struct->brk_polarity;
1776 tmr_x->brk_bit.aoen = brkdt_struct->auto_output_enable;
1777 tmr_x->brk_bit.wpc = brkdt_struct->wp_level;
1778}
1779
1784#endif
1785
tmr_output_struct
tmr_output_config_type tmr_output_struct
Definition project/at_start_f413/examples/tmr/6_steps/src/main.c:38
crm_periph_reset
void crm_periph_reset(crm_periph_reset_type value, confirm_state new_state)
enable or disable the peripheral reset
Definition at32f413_crm.c:293
CRM_TMR2_PERIPH_RESET
@ CRM_TMR2_PERIPH_RESET
Definition at32f413_crm.h:169
CRM_TMR4_PERIPH_RESET
@ CRM_TMR4_PERIPH_RESET
Definition at32f413_crm.h:171
CRM_TMR10_PERIPH_RESET
@ CRM_TMR10_PERIPH_RESET
Definition at32f413_crm.h:165
CRM_TMR5_PERIPH_RESET
@ CRM_TMR5_PERIPH_RESET
Definition at32f413_crm.h:172
CRM_TMR9_PERIPH_RESET
@ CRM_TMR9_PERIPH_RESET
Definition at32f413_crm.h:164
CRM_TMR1_PERIPH_RESET
@ CRM_TMR1_PERIPH_RESET
Definition at32f413_crm.h:160
CRM_TMR8_PERIPH_RESET
@ CRM_TMR8_PERIPH_RESET
Definition at32f413_crm.h:162
CRM_TMR3_PERIPH_RESET
@ CRM_TMR3_PERIPH_RESET
Definition at32f413_crm.h:170
CRM_TMR11_PERIPH_RESET
@ CRM_TMR11_PERIPH_RESET
Definition at32f413_crm.h:166
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
flag_status
flag_status
flag status
Definition at32f413.h:292
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
SET
@ SET
Definition at32f413.h:292
tmr_dma_request_type
tmr_dma_request_type
tmr dma request type
Definition at32f413_tmr.h:267
tmr_external_signal_divider_type
tmr_external_signal_divider_type
tmr external signal divider type
Definition at32f413_tmr.h:306
tmr_polarity_active_type
tmr_polarity_active_type
tmr polarity active type
Definition at32f413_tmr.h:296
tmr_count_mode_type
tmr_count_mode_type
tmr counter mode type
Definition at32f413_tmr.h:104
tmr_input_polarity_type
tmr_input_polarity_type
tmr input channel polarity type
Definition at32f413_tmr.h:204
tmr_dma_request_source_type
tmr_dma_request_source_type
tmr dma request source select type
Definition at32f413_tmr.h:258
tmr_channel_select_type
tmr_channel_select_type
tmr channel select type
Definition at32f413_tmr.h:214
tmr_external_signal_polarity_type
tmr_external_signal_polarity_type
tmr external signal polarity type
Definition at32f413_tmr.h:317
tmr_dma_address_type
tmr_dma_address_type
tmr dma base address type
Definition at32f413_tmr.h:351
tmr_channel1_input_connected_type
tmr_channel1_input_connected_type
tmr channel1 input connected type
Definition at32f413_tmr.h:228
tmr_clock_division_type
tmr_clock_division_type
tmr clock division type
Definition at32f413_tmr.h:94
tmr_event_trigger_type
tmr_event_trigger_type
tmr event triggered by software type
Definition at32f413_tmr.h:281
tmr_output_control_mode_type
tmr_output_control_mode_type
tmr output control mode type
Definition at32f413_tmr.h:171
tmr_dma_transfer_length_type
tmr_dma_transfer_length_type
tmr dma transfer length type
Definition at32f413_tmr.h:326
sub_tmr_input_sel_type
sub_tmr_input_sel_type
tmr subordinate mode input select type
Definition at32f413_tmr.h:131
tmr_force_output_type
tmr_force_output_type
tmr force output type
Definition at32f413_tmr.h:186
tmr_sub_mode_select_type
tmr_sub_mode_select_type
tmr subordinate mode select type
Definition at32f413_tmr.h:146
tmr_primary_select_type
tmr_primary_select_type
tmr primary mode select type
Definition at32f413_tmr.h:116
tmr_encoder_mode_type
tmr_encoder_mode_type
tmr encoder mode type
Definition at32f413_tmr.h:161
tmr_channel_input_divider_type
tmr_channel_input_divider_type
tmr input divider type
Definition at32f413_tmr.h:247
TMR_INPUT_FALLING_EDGE
@ TMR_INPUT_FALLING_EDGE
Definition at32f413_tmr.h:206
TMR_INPUT_RISING_EDGE
@ TMR_INPUT_RISING_EDGE
Definition at32f413_tmr.h:205
TMR_SELECT_CHANNEL_1C
@ TMR_SELECT_CHANNEL_1C
Definition at32f413_tmr.h:216
TMR_SELECT_CHANNEL_3
@ TMR_SELECT_CHANNEL_3
Definition at32f413_tmr.h:219
TMR_SELECT_CHANNEL_1
@ TMR_SELECT_CHANNEL_1
Definition at32f413_tmr.h:215
TMR_SELECT_CHANNEL_2C
@ TMR_SELECT_CHANNEL_2C
Definition at32f413_tmr.h:218
TMR_SELECT_CHANNEL_4
@ TMR_SELECT_CHANNEL_4
Definition at32f413_tmr.h:221
TMR_SELECT_CHANNEL_2
@ TMR_SELECT_CHANNEL_2
Definition at32f413_tmr.h:217
TMR_SELECT_CHANNEL_3C
@ TMR_SELECT_CHANNEL_3C
Definition at32f413_tmr.h:220
TMR_WP_OFF
@ TMR_WP_OFF
Definition at32f413_tmr.h:387
TMR_CC_CHANNEL_MAPPED_DIRECT
@ TMR_CC_CHANNEL_MAPPED_DIRECT
Definition at32f413_tmr.h:238
TMR_CC_CHANNEL_MAPPED_INDIRECT
@ TMR_CC_CHANNEL_MAPPED_INDIRECT
Definition at32f413_tmr.h:239
TMR_BRK_INPUT_ACTIVE_LOW
@ TMR_BRK_INPUT_ACTIVE_LOW
Definition at32f413_tmr.h:378
TMR_OUTPUT_CONTROL_OFF
@ TMR_OUTPUT_CONTROL_OFF
Definition at32f413_tmr.h:172
TMR_OUTPUT_ACTIVE_HIGH
@ TMR_OUTPUT_ACTIVE_HIGH
Definition at32f413_tmr.h:196
TMR_SUB_INPUT_SEL_EXTIN
@ TMR_SUB_INPUT_SEL_EXTIN
Definition at32f413_tmr.h:139
TMR_SUB_EXTERNAL_CLOCK_MODE_A
@ TMR_SUB_EXTERNAL_CLOCK_MODE_A
Definition at32f413_tmr.h:154
TMR_SUB_MODE_DIABLE
@ TMR_SUB_MODE_DIABLE
Definition at32f413_tmr.h:147
tmr_dma_control_config
void tmr_dma_control_config(tmr_type *tmr_x, tmr_dma_transfer_length_type dma_length, tmr_dma_address_type dma_base_address)
config tmr dma control
Definition at32f413_tmr.c:1753
tmr_channel_value_get
uint32_t tmr_channel_value_get(tmr_type *tmr_x, tmr_channel_select_type tmr_channel)
get tmr channel value
Definition at32f413_tmr.c:551
tmr_flag_clear
void tmr_flag_clear(tmr_type *tmr_x, uint32_t tmr_flag)
clear tmr flag
Definition at32f413_tmr.c:1433
tmr_period_value_get
uint32_t tmr_period_value_get(tmr_type *tmr_x)
get tmr period value
Definition at32f413_tmr.c:485
tmr_channel_buffer_enable
void tmr_channel_buffer_enable(tmr_type *tmr_x, confirm_state new_state)
enable tmr channel buffer
Definition at32f413_tmr.c:1238
tmr_overflow_request_source_set
void tmr_overflow_request_source_set(tmr_type *tmr_x, confirm_state new_state)
select tmr the overflow event sources
Definition at32f413_tmr.c:781
tmr_output_channel_mode_select
void tmr_output_channel_mode_select(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_output_control_mode_type oc_mode)
select tmr output channel mode
Definition at32f413_tmr.c:429
tmr_input_channel_divider_set
void tmr_input_channel_divider_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_channel_input_divider_type divider_factor)
set tmr input channel divider
Definition at32f413_tmr.c:1127
tmr_dma_request_enable
void tmr_dma_request_enable(tmr_type *tmr_x, tmr_dma_request_type dma_request, confirm_state new_state)
enable or disable tmr dma request
Definition at32f413_tmr.c:1296
tmr_external_clock_config
void tmr_external_clock_config(tmr_type *tmr_x, tmr_external_signal_divider_type es_divide, tmr_external_signal_polarity_type es_polarity, uint16_t es_filter)
config tmr external clock
Definition at32f413_tmr.c:1567
tmr_repetition_counter_set
void tmr_repetition_counter_set(tmr_type *tmr_x, uint8_t tmr_rpr_value)
set the repetition counter register(rpr) value
Definition at32f413_tmr.c:239
tmr_period_buffer_enable
void tmr_period_buffer_enable(tmr_type *tmr_x, confirm_state new_state)
enable tmr period buffer
Definition at32f413_tmr.c:592
tmr_counter_enable
void tmr_counter_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr counter
Definition at32f413_tmr.c:114
tmr_internal_clock_set
void tmr_internal_clock_set(tmr_type *tmr_x)
set tmr select internal clock
Definition at32f413_tmr.c:1481
tmr_output_channel_config
void tmr_output_channel_config(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_output_config_type *tmr_output_struct)
config tmr output channel
Definition at32f413_tmr.c:318
tmr_brkdt_default_para_init
void tmr_brkdt_default_para_init(tmr_brkdt_config_type *tmr_brkdt_struct)
init tmr brkdt default para
Definition at32f413_tmr.c:157
tmr_force_output_set
void tmr_force_output_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_force_output_type force_output)
set tmr force output
Definition at32f413_tmr.c:1687
tmr_interrupt_flag_get
flag_status tmr_interrupt_flag_get(tmr_type *tmr_x, uint32_t tmr_flag)
get tmr interrupt flag
Definition at32f413_tmr.c:1357
tmr_counter_value_set
void tmr_counter_value_set(tmr_type *tmr_x, uint32_t tmr_cnt_value)
set tmr counter value
Definition at32f413_tmr.c:255
tmr_div_value_get
uint32_t tmr_div_value_get(tmr_type *tmr_x)
get tmr div value
Definition at32f413_tmr.c:297
tmr_input_channel_init
void tmr_input_channel_init(tmr_type *tmr_x, tmr_input_config_type *input_struct, tmr_channel_input_divider_type divider_factor)
init tmr input channel
Definition at32f413_tmr.c:816
tmr_input_channel_filter_set
void tmr_input_channel_filter_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, uint16_t filter_value)
set tmr input channel filter
Definition at32f413_tmr.c:944
tmr_period_value_set
void tmr_period_value_set(tmr_type *tmr_x, uint32_t tmr_pr_value)
set tmr period value
Definition at32f413_tmr.c:469
tmr_clock_source_div_set
void tmr_clock_source_div_set(tmr_type *tmr_x, tmr_clock_division_type tmr_clock_div)
set tmr clock source division
Definition at32f413_tmr.c:204
tmr_sub_mode_select
void tmr_sub_mode_select(tmr_type *tmr_x, tmr_sub_mode_select_type sub_mode)
select tmr subordinate mode
Definition at32f413_tmr.c:1196
tmr_counter_value_get
uint32_t tmr_counter_value_get(tmr_type *tmr_x)
get tmr counter value
Definition at32f413_tmr.c:269
tmr_brkdt_config
void tmr_brkdt_config(tmr_type *tmr_x, tmr_brkdt_config_type *brkdt_struct)
config tmr brake mode and dead-time
Definition at32f413_tmr.c:1769
tmr_flag_get
flag_status tmr_flag_get(tmr_type *tmr_x, uint32_t tmr_flag)
get tmr flag
Definition at32f413_tmr.c:1395
tmr_external_clock_mode2_config
void tmr_external_clock_mode2_config(tmr_type *tmr_x, tmr_external_signal_divider_type es_divide, tmr_external_signal_polarity_type es_polarity, uint16_t es_filter)
config tmr external clock mode2
Definition at32f413_tmr.c:1619
tmr_input_default_para_init
void tmr_input_default_para_init(tmr_input_config_type *tmr_input_struct)
init tmr input default para
Definition at32f413_tmr.c:143
tmr_div_value_set
void tmr_div_value_set(tmr_type *tmr_x, uint32_t tmr_div_value)
set tmr div value
Definition at32f413_tmr.c:283
tmr_output_default_para_init
void tmr_output_default_para_init(tmr_output_config_type *tmr_output_struct)
init tmr output default para
Definition at32f413_tmr.c:126
tmr_event_sw_trigger
void tmr_event_sw_trigger(tmr_type *tmr_x, tmr_event_trigger_type tmr_event)
generate tmr event
Definition at32f413_tmr.c:1456
tmr_output_enable
void tmr_output_enable(tmr_type *tmr_x, confirm_state new_state)
tmr output enable(oen),this function is important for advtm output enable
Definition at32f413_tmr.c:1469
tmr_sub_sync_mode_set
void tmr_sub_sync_mode_set(tmr_type *tmr_x, confirm_state new_state)
set tmr subordinate synchronization mode
Definition at32f413_tmr.c:1273
tmr_base_init
void tmr_base_init(tmr_type *tmr_x, uint32_t tmr_pr, uint32_t tmr_div)
init tmr base
Definition at32f413_tmr.c:179
tmr_hall_select
void tmr_hall_select(tmr_type *tmr_x, confirm_state new_state)
select tmr hall
Definition at32f413_tmr.c:1225
tmr_channel1_input_select
void tmr_channel1_input_select(tmr_type *tmr_x, tmr_channel1_input_connected_type ch1_connect)
select tmr channel1 input
Definition at32f413_tmr.c:1102
tmr_32_bit_function_enable
void tmr_32_bit_function_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr 32 bit function(plus mode)
Definition at32f413_tmr.c:758
tmr_external_clock_mode1_config
void tmr_external_clock_mode1_config(tmr_type *tmr_x, tmr_external_signal_divider_type es_divide, tmr_external_signal_polarity_type es_polarity, uint16_t es_filter)
config tmr external clock mode1
Definition at32f413_tmr.c:1593
tmr_pwm_input_config
void tmr_pwm_input_config(tmr_type *tmr_x, tmr_input_config_type *input_struct, tmr_channel_input_divider_type divider_factor)
config tmr pwm input
Definition at32f413_tmr.c:990
tmr_trigger_input_select
void tmr_trigger_input_select(tmr_type *tmr_x, sub_tmr_input_sel_type trigger_select)
select tmr sub-trigger
Definition at32f413_tmr.c:1260
tmr_output_channel_buffer_enable
void tmr_output_channel_buffer_enable(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, confirm_state new_state)
enable tmr output channel buffer
Definition at32f413_tmr.c:613
tmr_interrupt_enable
void tmr_interrupt_enable(tmr_type *tmr_x, uint32_t tmr_interrupt, confirm_state new_state)
enable or disable tmr interrupt
Definition at32f413_tmr.c:1327
tmr_primary_mode_select
void tmr_primary_mode_select(tmr_type *tmr_x, tmr_primary_select_type primary_mode)
select tmr primary mode
Definition at32f413_tmr.c:1174
tmr_overflow_event_disable
void tmr_overflow_event_disable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr overflow event generation
Definition at32f413_tmr.c:795
tmr_channel_dma_select
void tmr_channel_dma_select(tmr_type *tmr_x, tmr_dma_request_source_type cc_dma_select)
select tmr channel dma
Definition at32f413_tmr.c:1212
tmr_cnt_dir_set
void tmr_cnt_dir_set(tmr_type *tmr_x, tmr_count_mode_type tmr_cnt_dir)
set tmr counter count direction
Definition at32f413_tmr.c:225
tmr_output_channel_immediately_set
void tmr_output_channel_immediately_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, confirm_state new_state)
set tmr output channel immediately
Definition at32f413_tmr.c:659
tmr_encoder_mode_config
void tmr_encoder_mode_config(tmr_type *tmr_x, tmr_encoder_mode_type encoder_mode, tmr_input_polarity_type ic1_polarity, tmr_input_polarity_type ic2_polarity)
config tmr encoder mode
Definition at32f413_tmr.c:1648
tmr_channel_enable
void tmr_channel_enable(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, confirm_state new_state)
tmr channel enable
Definition at32f413_tmr.c:888
tmr_output_channel_switch_set
void tmr_output_channel_switch_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, confirm_state new_state)
set tmr output channel switch
Definition at32f413_tmr.c:705
tmr_reset
void tmr_reset(tmr_type *tmr_x)
tmr reset by crm reset register
Definition at32f413_tmr.c:51
tmr_output_channel_polarity_set
void tmr_output_channel_polarity_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_polarity_active_type oc_polarity)
set tmr output channel polarity
Definition at32f413_tmr.c:1507
tmr_one_cycle_mode_enable
void tmr_one_cycle_mode_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr one cycle mode
Definition at32f413_tmr.c:744
tmr_channel_value_set
void tmr_channel_value_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, uint32_t tmr_channel_value)
set tmr channel value
Definition at32f413_tmr.c:506
TMR3
#define TMR3
Definition at32f413_tmr.h:833
TMR1
#define TMR1
Definition at32f413_tmr.h:831
TMR2
#define TMR2
Definition at32f413_tmr.h:832
TMR4
#define TMR4
Definition at32f413_tmr.h:834
at32f413_conf.h
at32f413 config header file
tmr_brkdt_config_type
tmr brkdt config type
Definition at32f413_tmr.h:422
tmr_brkdt_config_type::brk_enable
confirm_state brk_enable
Definition at32f413_tmr.h:429
tmr_brkdt_config_type::deadtime
uint8_t deadtime
Definition at32f413_tmr.h:423
tmr_brkdt_config_type::auto_output_enable
confirm_state auto_output_enable
Definition at32f413_tmr.h:426
tmr_brkdt_config_type::wp_level
tmr_wp_level_type wp_level
Definition at32f413_tmr.h:425
tmr_brkdt_config_type::fcsoen_state
confirm_state fcsoen_state
Definition at32f413_tmr.h:427
tmr_brkdt_config_type::fcsodis_state
confirm_state fcsodis_state
Definition at32f413_tmr.h:428
tmr_brkdt_config_type::brk_polarity
tmr_brk_polarity_type brk_polarity
Definition at32f413_tmr.h:424
tmr_input_config_type
tmr input capture config type
Definition at32f413_tmr.h:411
tmr_input_config_type::input_mapped_select
tmr_input_direction_mapped_type input_mapped_select
Definition at32f413_tmr.h:414
tmr_input_config_type::input_filter_value
uint8_t input_filter_value
Definition at32f413_tmr.h:415
tmr_input_config_type::input_polarity_select
tmr_input_polarity_type input_polarity_select
Definition at32f413_tmr.h:413
tmr_input_config_type::input_channel_select
tmr_channel_select_type input_channel_select
Definition at32f413_tmr.h:412
tmr_output_config_type
tmr output config type
Definition at32f413_tmr.h:397
tmr_output_config_type::occ_output_state
confirm_state occ_output_state
Definition at32f413_tmr.h:404
tmr_output_config_type::oc_idle_state
confirm_state oc_idle_state
Definition at32f413_tmr.h:399
tmr_output_config_type::oc_output_state
confirm_state oc_output_state
Definition at32f413_tmr.h:403
tmr_output_config_type::oc_mode
tmr_output_control_mode_type oc_mode
Definition at32f413_tmr.h:398
tmr_output_config_type::occ_polarity
tmr_output_polarity_type occ_polarity
Definition at32f413_tmr.h:402
tmr_output_config_type::occ_idle_state
confirm_state occ_idle_state
Definition at32f413_tmr.h:400
tmr_output_config_type::oc_polarity
tmr_output_polarity_type oc_polarity
Definition at32f413_tmr.h:401
tmr_type
type define tmr register all
Definition at32f413_tmr.h:436
tmr_type::swevt_bit
struct tmr_type::@661::@696 swevt_bit
tmr_type::c1cen
__IO uint32_t c1cen
Definition at32f413_tmr.h:664
tmr_type::pmen
__IO uint32_t pmen
Definition at32f413_tmr.h:452
tmr_type::brken
__IO uint32_t brken
Definition at32f413_tmr.h:790
tmr_type::c1idiv
__IO uint32_t c1idiv
Definition at32f413_tmr.h:605
tmr_type::dtc
__IO uint32_t dtc
Definition at32f413_tmr.h:786
tmr_type::c1en
__IO uint32_t c1en
Definition at32f413_tmr.h:662
tmr_type::c4df
__IO uint32_t c4df
Definition at32f413_tmr.h:649
tmr_type::c3octrl
__IO uint32_t c3octrl
Definition at32f413_tmr.h:629
tmr_type::c2osen
__IO uint32_t c2osen
Definition at32f413_tmr.h:595
tmr_type::swevt
__IO uint32_t swevt
Definition at32f413_tmr.h:559
tmr_type::c2en
__IO uint32_t c2en
Definition at32f413_tmr.h:666
tmr_type::c3df
__IO uint32_t c3df
Definition at32f413_tmr.h:646
tmr_type::wpc
__IO uint32_t wpc
Definition at32f413_tmr.h:787
tmr_type::c3oben
__IO uint32_t c3oben
Definition at32f413_tmr.h:628
tmr_type::cnt_dir
__IO uint32_t cnt_dir
Definition at32f413_tmr.h:449
tmr_type::rpr_bit
struct tmr_type::@675::@705 rpr_bit
tmr_type::c4octrl
__IO uint32_t c4octrl
Definition at32f413_tmr.h:634
tmr_type::c1insel
__IO uint32_t c1insel
Definition at32f413_tmr.h:470
tmr_type::div
__IO uint32_t div
Definition at32f413_tmr.h:697
tmr_type::esf
__IO uint32_t esf
Definition at32f413_tmr.h:494
tmr_type::cm2_input_bit
struct tmr_type::@665::@700 cm2_input_bit
input capture mode
tmr_type::c1osen
__IO uint32_t c1osen
Definition at32f413_tmr.h:590
tmr_type::c2cen
__IO uint32_t c2cen
Definition at32f413_tmr.h:668
tmr_type::cm2_output_bit
struct tmr_type::@665::@699 cm2_output_bit
channel mode
tmr_type::drs
__IO uint32_t drs
Definition at32f413_tmr.h:468
tmr_type::iden
__IO uint32_t iden
Definition at32f413_tmr.h:507
tmr_type::c1oben
__IO uint32_t c1oben
Definition at32f413_tmr.h:588
tmr_type::ists
__IO uint32_t ists
Definition at32f413_tmr.h:534
tmr_type::c1c
__IO uint32_t c1c
Definition at32f413_tmr.h:586
tmr_type::c3cen
__IO uint32_t c3cen
Definition at32f413_tmr.h:672
tmr_type::c4p
__IO uint32_t c4p
Definition at32f413_tmr.h:675
tmr_type::brkv
__IO uint32_t brkv
Definition at32f413_tmr.h:791
tmr_type::ctrl1_bit
struct tmr_type::@651::@691 ctrl1_bit
tmr_type::stis
__IO uint32_t stis
Definition at32f413_tmr.h:492
tmr_type::ovfswtr
__IO uint32_t ovfswtr
Definition at32f413_tmr.h:562
tmr_type::c3idiv
__IO uint32_t c3idiv
Definition at32f413_tmr.h:645
tmr_type::c4osen
__IO uint32_t c4osen
Definition at32f413_tmr.h:635
tmr_type::c1octrl
__IO uint32_t c1octrl
Definition at32f413_tmr.h:589
tmr_type::tmren
__IO uint32_t tmren
Definition at32f413_tmr.h:445
tmr_type::oen
__IO uint32_t oen
Definition at32f413_tmr.h:793
tmr_type::sts
__IO uint32_t sts
Definition at32f413_tmr.h:493
tmr_type::c2idiv
__IO uint32_t c2idiv
Definition at32f413_tmr.h:608
tmr_type::c1p
__IO uint32_t c1p
Definition at32f413_tmr.h:663
tmr_type::c1oien
__IO uint32_t c1oien
Definition at32f413_tmr.h:587
tmr_type::pr
__IO uint32_t pr
Definition at32f413_tmr.h:710
tmr_type::c3oien
__IO uint32_t c3oien
Definition at32f413_tmr.h:627
tmr_type::c1dt
uint32_t c1dt
Definition at32f413_tmr.h:735
tmr_type::c2oben
__IO uint32_t c2oben
Definition at32f413_tmr.h:593
tmr_type::ctrl2_bit
struct tmr_type::@653::@692 ctrl2_bit
tmr_type::cm1_output_bit
struct tmr_type::@663::@697 cm1_output_bit
channel mode
tmr_type::c2octrl
__IO uint32_t c2octrl
Definition at32f413_tmr.h:594
tmr_type::smsel
__IO uint32_t smsel
Definition at32f413_tmr.h:490
tmr_type::c3p
__IO uint32_t c3p
Definition at32f413_tmr.h:671
tmr_type::c1cp
__IO uint32_t c1cp
Definition at32f413_tmr.h:665
tmr_type::c3c
__IO uint32_t c3c
Definition at32f413_tmr.h:626
tmr_type::clkdiv
__IO uint32_t clkdiv
Definition at32f413_tmr.h:451
tmr_type::ovfs
__IO uint32_t ovfs
Definition at32f413_tmr.h:447
tmr_type::dmactrl_bit
struct tmr_type::@687::@711 dmactrl_bit
tmr_type::cbctrl
__IO uint32_t cbctrl
Definition at32f413_tmr.h:465
tmr_type::dtb
__IO uint32_t dtb
Definition at32f413_tmr.h:807
tmr_type::prben
__IO uint32_t prben
Definition at32f413_tmr.h:450
tmr_type::ccfs
__IO uint32_t ccfs
Definition at32f413_tmr.h:467
tmr_type::ecmben
__IO uint32_t ecmben
Definition at32f413_tmr.h:496
tmr_type::ovfen
__IO uint32_t ovfen
Definition at32f413_tmr.h:446
tmr_type::c4en
__IO uint32_t c4en
Definition at32f413_tmr.h:674
tmr_type::fcsoen
__IO uint32_t fcsoen
Definition at32f413_tmr.h:789
tmr_type::esdiv
__IO uint32_t esdiv
Definition at32f413_tmr.h:495
tmr_type::c3en
__IO uint32_t c3en
Definition at32f413_tmr.h:670
tmr_type::c2p
__IO uint32_t c2p
Definition at32f413_tmr.h:667
tmr_type::ocmen
__IO uint32_t ocmen
Definition at32f413_tmr.h:448
tmr_type::c4oien
__IO uint32_t c4oien
Definition at32f413_tmr.h:632
tmr_type::c2dt
uint32_t c2dt
Definition at32f413_tmr.h:747
tmr_type::addr
__IO uint32_t addr
Definition at32f413_tmr.h:805
tmr_type::c3cp
__IO uint32_t c3cp
Definition at32f413_tmr.h:673
tmr_type::c2df
__IO uint32_t c2df
Definition at32f413_tmr.h:609
tmr_type::c4idiv
__IO uint32_t c4idiv
Definition at32f413_tmr.h:648
tmr_type::c3osen
__IO uint32_t c3osen
Definition at32f413_tmr.h:630
tmr_type::rpr
__IO uint32_t rpr
Definition at32f413_tmr.h:722
tmr_type::c2c
__IO uint32_t c2c
Definition at32f413_tmr.h:591
tmr_type::c1df
__IO uint32_t c1df
Definition at32f413_tmr.h:606
tmr_type::c2oien
__IO uint32_t c2oien
Definition at32f413_tmr.h:592
tmr_type::c4dt
__IO uint32_t c4dt
Definition at32f413_tmr.h:771
tmr_type::ctrl2
__IO uint32_t ctrl2
Definition at32f413_tmr.h:462
tmr_type::stctrl_bit
struct tmr_type::@655::@693 stctrl_bit
tmr_type::c3dt
__IO uint32_t c3dt
Definition at32f413_tmr.h:759
tmr_type::c2cp
__IO uint32_t c2cp
Definition at32f413_tmr.h:669
tmr_type::cctrl
uint32_t cctrl
Definition at32f413_tmr.h:659
tmr_type::c4c
__IO uint32_t c4c
Definition at32f413_tmr.h:631
tmr_type::c4oben
__IO uint32_t c4oben
Definition at32f413_tmr.h:633
tmr_type::fcsodis
__IO uint32_t fcsodis
Definition at32f413_tmr.h:788
tmr_type::cctrl_bit
struct tmr_type::@667::@701 cctrl_bit
tmr_type::cval
__IO uint32_t cval
Definition at32f413_tmr.h:685
tmr_type::cm1_input_bit
struct tmr_type::@663::@698 cm1_input_bit
input capture mode
tmr_type::brk_bit
struct tmr_type::@685::@710 brk_bit
tmr_type::esp
__IO uint32_t esp
Definition at32f413_tmr.h:497
tmr_type::ptos
__IO uint32_t ptos
Definition at32f413_tmr.h:469
tmr_type::aoen
__IO uint32_t aoen
Definition at32f413_tmr.h:792


AT32F413 Firmwary Library: at32f413_tmr.h Source File

  • libraries
  • drivers
  • inc
at32f413_tmr.h
Go to the documentation of this file.
1
26/* Define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_TMR_H
28#define __AT32F413_TMR_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34
35/* Includes ------------------------------------------------------------------*/
36#include "at32f413.h"
37
51#define TMR_OVF_FLAG ((uint32_t)0x000001)
52#define TMR_C1_FLAG ((uint32_t)0x000002)
53#define TMR_C2_FLAG ((uint32_t)0x000004)
54#define TMR_C3_FLAG ((uint32_t)0x000008)
55#define TMR_C4_FLAG ((uint32_t)0x000010)
56#define TMR_HALL_FLAG ((uint32_t)0x000020)
57#define TMR_TRIGGER_FLAG ((uint32_t)0x000040)
58#define TMR_BRK_FLAG ((uint32_t)0x000080)
59#define TMR_C1_RECAPTURE_FLAG ((uint32_t)0x000200)
60#define TMR_C2_RECAPTURE_FLAG ((uint32_t)0x000400)
61#define TMR_C3_RECAPTURE_FLAG ((uint32_t)0x000800)
62#define TMR_C4_RECAPTURE_FLAG ((uint32_t)0x001000)
73#define TMR_OVF_INT ((uint32_t)0x000001)
74#define TMR_C1_INT ((uint32_t)0x000002)
75#define TMR_C2_INT ((uint32_t)0x000004)
76#define TMR_C3_INT ((uint32_t)0x000008)
77#define TMR_C4_INT ((uint32_t)0x000010)
78#define TMR_HALL_INT ((uint32_t)0x000020)
79#define TMR_TRIGGER_INT ((uint32_t)0x000040)
80#define TMR_BRK_INT ((uint32_t)0x000080)
93typedef enum
94{
95 TMR_CLOCK_DIV1 = 0x00,
96 TMR_CLOCK_DIV2 = 0x01,
97 TMR_CLOCK_DIV4 = 0x02
98} tmr_clock_division_type;
99
103typedef enum
104{
105 TMR_COUNT_UP = 0x00,
106 TMR_COUNT_DOWN = 0x01,
107 TMR_COUNT_TWO_WAY_1 = 0x02,
108 TMR_COUNT_TWO_WAY_2 = 0x04,
109 TMR_COUNT_TWO_WAY_3 = 0x06
110} tmr_count_mode_type;
111
115typedef enum
116{
117 TMR_PRIMARY_SEL_RESET = 0x00,
118 TMR_PRIMARY_SEL_ENABLE = 0x01,
119 TMR_PRIMARY_SEL_OVERFLOW = 0x02,
120 TMR_PRIMARY_SEL_COMPARE = 0x03,
121 TMR_PRIMARY_SEL_C1ORAW = 0x04,
122 TMR_PRIMARY_SEL_C2ORAW = 0x05,
123 TMR_PRIMARY_SEL_C3ORAW = 0x06,
124 TMR_PRIMARY_SEL_C4ORAW = 0x07
125} tmr_primary_select_type;
126
130typedef enum
131{
132 TMR_SUB_INPUT_SEL_IS0 = 0x00,
133 TMR_SUB_INPUT_SEL_IS1 = 0x01,
134 TMR_SUB_INPUT_SEL_IS2 = 0x02,
135 TMR_SUB_INPUT_SEL_IS3 = 0x03,
136 TMR_SUB_INPUT_SEL_C1INC = 0x04,
137 TMR_SUB_INPUT_SEL_C1DF1 = 0x05,
138 TMR_SUB_INPUT_SEL_C2DF2 = 0x06,
139 TMR_SUB_INPUT_SEL_EXTIN = 0x07
140} sub_tmr_input_sel_type;
141
145typedef enum
146{
147 TMR_SUB_MODE_DIABLE = 0x00,
148 TMR_SUB_ENCODER_MODE_A = 0x01,
149 TMR_SUB_ENCODER_MODE_B = 0x02,
150 TMR_SUB_ENCODER_MODE_C = 0x03,
151 TMR_SUB_RESET_MODE = 0x04,
152 TMR_SUB_HANG_MODE = 0x05,
153 TMR_SUB_TRIGGER_MODE = 0x06,
154 TMR_SUB_EXTERNAL_CLOCK_MODE_A = 0x07
155} tmr_sub_mode_select_type;
156
160typedef enum
161{
162 TMR_ENCODER_MODE_A = TMR_SUB_ENCODER_MODE_A,
163 TMR_ENCODER_MODE_B = TMR_SUB_ENCODER_MODE_B,
164 TMR_ENCODER_MODE_C = TMR_SUB_ENCODER_MODE_C
165} tmr_encoder_mode_type;
166
170typedef enum
171{
172 TMR_OUTPUT_CONTROL_OFF = 0x00,
173 TMR_OUTPUT_CONTROL_HIGH = 0x01,
174 TMR_OUTPUT_CONTROL_LOW = 0x02,
175 TMR_OUTPUT_CONTROL_SWITCH = 0x03,
176 TMR_OUTPUT_CONTROL_FORCE_LOW = 0x04,
177 TMR_OUTPUT_CONTROL_FORCE_HIGH = 0x05,
178 TMR_OUTPUT_CONTROL_PWM_MODE_A = 0x06,
179 TMR_OUTPUT_CONTROL_PWM_MODE_B = 0x07
180} tmr_output_control_mode_type;
181
185typedef enum
186{
187 TMR_FORCE_OUTPUT_HIGH = TMR_OUTPUT_CONTROL_FORCE_HIGH,
188 TMR_FORCE_OUTPUT_LOW = TMR_OUTPUT_CONTROL_FORCE_LOW
189} tmr_force_output_type;
190
194typedef enum
195{
196 TMR_OUTPUT_ACTIVE_HIGH = 0x00,
197 TMR_OUTPUT_ACTIVE_LOW = 0x01
198} tmr_output_polarity_type;
199
203typedef enum
204{
205 TMR_INPUT_RISING_EDGE = 0x00,
206 TMR_INPUT_FALLING_EDGE = 0x01,
207 TMR_INPUT_BOTH_EDGE = 0x03
208} tmr_input_polarity_type;
209
213typedef enum
214{
215 TMR_SELECT_CHANNEL_1 = 0x00,
216 TMR_SELECT_CHANNEL_1C = 0x01,
217 TMR_SELECT_CHANNEL_2 = 0x02,
218 TMR_SELECT_CHANNEL_2C = 0x03,
219 TMR_SELECT_CHANNEL_3 = 0x04,
220 TMR_SELECT_CHANNEL_3C = 0x05,
221 TMR_SELECT_CHANNEL_4 = 0x06
222} tmr_channel_select_type;
223
227typedef enum
228{
229 TMR_CHANEL1_CONNECTED_C1IRAW = 0x00,
230 TMR_CHANEL1_2_3_CONNECTED_C1IRAW_XOR = 0x01
231} tmr_channel1_input_connected_type;
232
236typedef enum
237{
238 TMR_CC_CHANNEL_MAPPED_DIRECT = 0x01,
239 TMR_CC_CHANNEL_MAPPED_INDIRECT = 0x02,
240 TMR_CC_CHANNEL_MAPPED_STI = 0x03
241} tmr_input_direction_mapped_type;
242
246typedef enum
247{
248 TMR_CHANNEL_INPUT_DIV_1 = 0x00,
249 TMR_CHANNEL_INPUT_DIV_2 = 0x01,
250 TMR_CHANNEL_INPUT_DIV_4 = 0x02,
251 TMR_CHANNEL_INPUT_DIV_8 = 0x03
252} tmr_channel_input_divider_type;
253
257typedef enum
258{
259 TMR_DMA_REQUEST_BY_CHANNEL = 0x00,
260 TMR_DMA_REQUEST_BY_OVERFLOW = 0x01
261} tmr_dma_request_source_type;
262
266typedef enum
267{
268 TMR_OVERFLOW_DMA_REQUEST = 0x00000100,
269 TMR_C1_DMA_REQUEST = 0x00000200,
270 TMR_C2_DMA_REQUEST = 0x00000400,
271 TMR_C3_DMA_REQUEST = 0x00000800,
272 TMR_C4_DMA_REQUEST = 0x00001000,
273 TMR_HALL_DMA_REQUEST = 0x00002000,
274 TMR_TRIGGER_DMA_REQUEST = 0x00004000
275} tmr_dma_request_type;
276
280typedef enum
281{
282 TMR_OVERFLOW_SWTRIG = 0x00000001,
283 TMR_C1_SWTRIG = 0x00000002,
284 TMR_C2_SWTRIG = 0x00000004,
285 TMR_C3_SWTRIG = 0x00000008,
286 TMR_C4_SWTRIG = 0x00000010,
287 TMR_HALL_SWTRIG = 0x00000020,
288 TMR_TRIGGER_SWTRIG = 0x00000040,
289 TMR_BRK_SWTRIG = 0x00000080
290}tmr_event_trigger_type;
291
295typedef enum
296{
297 TMR_POLARITY_ACTIVE_HIGH = 0x00,
298 TMR_POLARITY_ACTIVE_LOW = 0x01,
299 TMR_POLARITY_ACTIVE_BOTH = 0x02
300}tmr_polarity_active_type;
301
305typedef enum
306{
307 TMR_ES_FREQUENCY_DIV_1 = 0x00,
308 TMR_ES_FREQUENCY_DIV_2 = 0x01,
309 TMR_ES_FREQUENCY_DIV_4 = 0x02,
310 TMR_ES_FREQUENCY_DIV_8 = 0x03
311}tmr_external_signal_divider_type;
312
316typedef enum
317{
318 TMR_ES_POLARITY_NON_INVERTED = 0x00,
319 TMR_ES_POLARITY_INVERTED = 0x01
320}tmr_external_signal_polarity_type;
321
325typedef enum
326{
327 TMR_DMA_TRANSFER_1BYTE = 0x00,
328 TMR_DMA_TRANSFER_2BYTES = 0x01,
329 TMR_DMA_TRANSFER_3BYTES = 0x02,
330 TMR_DMA_TRANSFER_4BYTES = 0x03,
331 TMR_DMA_TRANSFER_5BYTES = 0x04,
332 TMR_DMA_TRANSFER_6BYTES = 0x05,
333 TMR_DMA_TRANSFER_7BYTES = 0x06,
334 TMR_DMA_TRANSFER_8BYTES = 0x07,
335 TMR_DMA_TRANSFER_9BYTES = 0x08,
336 TMR_DMA_TRANSFER_10BYTES = 0x09,
337 TMR_DMA_TRANSFER_11BYTES = 0x0A,
338 TMR_DMA_TRANSFER_12BYTES = 0x0B,
339 TMR_DMA_TRANSFER_13BYTES = 0x0C,
340 TMR_DMA_TRANSFER_14BYTES = 0x0D,
341 TMR_DMA_TRANSFER_15BYTES = 0x0E,
342 TMR_DMA_TRANSFER_16BYTES = 0x0F,
343 TMR_DMA_TRANSFER_17BYTES = 0x10,
344 TMR_DMA_TRANSFER_18BYTES = 0x11
345}tmr_dma_transfer_length_type;
346
350typedef enum
351{
352 TMR_CTRL1_ADDRESS = 0x0000,
353 TMR_CTRL2_ADDRESS = 0x0001,
354 TMR_STCTRL_ADDRESS = 0x0002,
355 TMR_IDEN_ADDRESS = 0x0003,
356 TMR_ISTS_ADDRESS = 0x0004,
357 TMR_SWEVT_ADDRESS = 0x0005,
358 TMR_CM1_ADDRESS = 0x0006,
359 TMR_CM2_ADDRESS = 0x0007,
360 TMR_CCTRL_ADDRESS = 0x0008,
361 TMR_CVAL_ADDRESS = 0x0009,
362 TMR_DIV_ADDRESS = 0x000A,
363 TMR_PR_ADDRESS = 0x000B,
364 TMR_RPR_ADDRESS = 0x000C,
365 TMR_C1DT_ADDRESS = 0x000D,
366 TMR_C2DT_ADDRESS = 0x000E,
367 TMR_C3DT_ADDRESS = 0x000F,
368 TMR_C4DT_ADDRESS = 0x0010,
369 TMR_BRK_ADDRESS = 0x0011,
370 TMR_DMACTRL_ADDRESS = 0x0012
371}tmr_dma_address_type;
372
376typedef enum
377{
378 TMR_BRK_INPUT_ACTIVE_LOW = 0x00,
379 TMR_BRK_INPUT_ACTIVE_HIGH = 0x01
380}tmr_brk_polarity_type;
381
385typedef enum
386{
387 TMR_WP_OFF = 0x00,
388 TMR_WP_LEVEL_3 = 0x01,
389 TMR_WP_LEVEL_2 = 0x02,
390 TMR_WP_LEVEL_1 = 0x03
391}tmr_wp_level_type;
392
396typedef struct
397{
398 tmr_output_control_mode_type oc_mode;
399 confirm_state oc_idle_state;
400 confirm_state occ_idle_state;
401 tmr_output_polarity_type oc_polarity;
402 tmr_output_polarity_type occ_polarity;
403 confirm_state oc_output_state;
404 confirm_state occ_output_state;
405} tmr_output_config_type;
406
410typedef struct
411{
412 tmr_channel_select_type input_channel_select;
413 tmr_input_polarity_type input_polarity_select;
414 tmr_input_direction_mapped_type input_mapped_select;
415 uint8_t input_filter_value;
416} tmr_input_config_type;
417
421typedef struct
422{
423 uint8_t deadtime;
424 tmr_brk_polarity_type brk_polarity;
425 tmr_wp_level_type wp_level;
426 confirm_state auto_output_enable;
427 confirm_state fcsoen_state;
428 confirm_state fcsodis_state;
429 confirm_state brk_enable;
430} tmr_brkdt_config_type;
431
435typedef struct
436{
440 union
441 {
442 __IO uint32_t ctrl1;
443 struct
444 {
445 __IO uint32_t tmren : 1; /* [0] */
446 __IO uint32_t ovfen : 1; /* [1] */
447 __IO uint32_t ovfs : 1; /* [2] */
448 __IO uint32_t ocmen : 1; /* [3] */
449 __IO uint32_t cnt_dir : 3; /* [6:4] */
450 __IO uint32_t prben : 1; /* [7] */
451 __IO uint32_t clkdiv : 2; /* [9:8] */
452 __IO uint32_t pmen : 1; /* [10] */
453 __IO uint32_t reserved1 : 21;/* [31:11] */
454 } ctrl1_bit;
455 };
456
460 union
461 {
462 __IO uint32_t ctrl2;
463 struct
464 {
465 __IO uint32_t cbctrl : 1; /* [0] */
466 __IO uint32_t reserved1 : 1; /* [1] */
467 __IO uint32_t ccfs : 1; /* [2] */
468 __IO uint32_t drs : 1; /* [3] */
469 __IO uint32_t ptos : 3; /* [6:4] */
470 __IO uint32_t c1insel : 1; /* [7] */
471 __IO uint32_t c1ios : 1; /* [8] */
472 __IO uint32_t c1cios : 1; /* [9] */
473 __IO uint32_t c2ios : 1; /* [10] */
474 __IO uint32_t c2cios : 1; /* [11] */
475 __IO uint32_t c3ios : 1; /* [12] */
476 __IO uint32_t c3cios : 1; /* [13] */
477 __IO uint32_t c4ios : 1; /* [14] */
478 __IO uint32_t reserved2 : 17;/* [31:15] */
479 } ctrl2_bit;
480 };
481
485 union
486 {
487 __IO uint32_t stctrl;
488 struct
489 {
490 __IO uint32_t smsel : 3; /* [2:0] */
491 __IO uint32_t reserved1 : 1; /* [3] */
492 __IO uint32_t stis : 3; /* [6:4] */
493 __IO uint32_t sts : 1; /* [7] */
494 __IO uint32_t esf : 4; /* [11:8] */
495 __IO uint32_t esdiv : 2; /* [13:12] */
496 __IO uint32_t ecmben : 1; /* [14] */
497 __IO uint32_t esp : 1; /* [15] */
498 __IO uint32_t reserved2 : 16;/* [31:16] */
499 } stctrl_bit;
500 };
501
505 union
506 {
507 __IO uint32_t iden;
508 struct
509 {
510 __IO uint32_t ovfien : 1; /* [0] */
511 __IO uint32_t c1ien : 1; /* [1] */
512 __IO uint32_t c2ien : 1; /* [2] */
513 __IO uint32_t c3ien : 1; /* [3] */
514 __IO uint32_t c4ien : 1; /* [4] */
515 __IO uint32_t hallien : 1; /* [5] */
516 __IO uint32_t tien : 1; /* [6] */
517 __IO uint32_t brkie : 1; /* [7] */
518 __IO uint32_t ovfden : 1; /* [8] */
519 __IO uint32_t c1den : 1; /* [9] */
520 __IO uint32_t c2den : 1; /* [10] */
521 __IO uint32_t c3den : 1; /* [11] */
522 __IO uint32_t c4den : 1; /* [12] */
523 __IO uint32_t hallde : 1; /* [13] */
524 __IO uint32_t tden : 1; /* [14] */
525 __IO uint32_t reserved1 : 17;/* [31:15] */
526 } iden_bit;
527 };
528
532 union
533 {
534 __IO uint32_t ists;
535 struct
536 {
537 __IO uint32_t ovfif : 1; /* [0] */
538 __IO uint32_t c1if : 1; /* [1] */
539 __IO uint32_t c2if : 1; /* [2] */
540 __IO uint32_t c3if : 1; /* [3] */
541 __IO uint32_t c4if : 1; /* [4] */
542 __IO uint32_t hallif : 1; /* [5] */
543 __IO uint32_t trgif : 1; /* [6] */
544 __IO uint32_t brkif : 1; /* [7] */
545 __IO uint32_t reserved1 : 1; /* [8] */
546 __IO uint32_t c1rf : 1; /* [9] */
547 __IO uint32_t c2rf : 1; /* [10] */
548 __IO uint32_t c3rf : 1; /* [11] */
549 __IO uint32_t c4rf : 1; /* [12] */
550 __IO uint32_t reserved2 : 19;/* [31:13] */
551 } ists_bit;
552 };
553
557 union
558 {
559 __IO uint32_t swevt;
560 struct
561 {
562 __IO uint32_t ovfswtr : 1; /* [0] */
563 __IO uint32_t c1swtr : 1; /* [1] */
564 __IO uint32_t c2swtr : 1; /* [2] */
565 __IO uint32_t c3swtr : 1; /* [3] */
566 __IO uint32_t c4swtr : 1; /* [4] */
567 __IO uint32_t hallswtr : 1; /* [5] */
568 __IO uint32_t trgswtr : 1; /* [6] */
569 __IO uint32_t brkswtr : 1; /* [7] */
570 __IO uint32_t reserved : 24;/* [31:8] */
571 } swevt_bit;
572 };
573
577 union
578 {
579 __IO uint32_t cm1;
580
584 struct
585 {
586 __IO uint32_t c1c : 2; /* [1:0] */
587 __IO uint32_t c1oien : 1; /* [2] */
588 __IO uint32_t c1oben : 1; /* [3] */
589 __IO uint32_t c1octrl : 3; /* [6:4] */
590 __IO uint32_t c1osen : 1; /* [7] */
591 __IO uint32_t c2c : 2; /* [9:8] */
592 __IO uint32_t c2oien : 1; /* [10] */
593 __IO uint32_t c2oben : 1; /* [11] */
594 __IO uint32_t c2octrl : 3; /* [14:12] */
595 __IO uint32_t c2osen : 1; /* [15] */
596 __IO uint32_t reserved1 : 16;/* [31:16] */
597 } cm1_output_bit;
598
602 struct
603 {
604 __IO uint32_t c1c : 2; /* [1:0] */
605 __IO uint32_t c1idiv : 2; /* [3:2] */
606 __IO uint32_t c1df : 4; /* [7:4] */
607 __IO uint32_t c2c : 2; /* [9:8] */
608 __IO uint32_t c2idiv : 2; /* [11:10] */
609 __IO uint32_t c2df : 4; /* [15:12] */
610 __IO uint32_t reserved1 : 16;/* [31:16] */
611 } cm1_input_bit;
612 };
613
617 union
618 {
619 __IO uint32_t cm2;
620
624 struct
625 {
626 __IO uint32_t c3c : 2; /* [1:0] */
627 __IO uint32_t c3oien : 1; /* [2] */
628 __IO uint32_t c3oben : 1; /* [3] */
629 __IO uint32_t c3octrl : 3; /* [6:4] */
630 __IO uint32_t c3osen : 1; /* [7] */
631 __IO uint32_t c4c : 2; /* [9:8] */
632 __IO uint32_t c4oien : 1; /* [10] */
633 __IO uint32_t c4oben : 1; /* [11] */
634 __IO uint32_t c4octrl : 3; /* [14:12] */
635 __IO uint32_t c4osen : 1; /* [15] */
636 __IO uint32_t reserved1 : 16;/* [31:16] */
637 } cm2_output_bit;
638
642 struct
643 {
644 __IO uint32_t c3c : 2; /* [1:0] */
645 __IO uint32_t c3idiv : 2; /* [3:2] */
646 __IO uint32_t c3df : 4; /* [7:4] */
647 __IO uint32_t c4c : 2; /* [9:8] */
648 __IO uint32_t c4idiv : 2; /* [11:10] */
649 __IO uint32_t c4df : 4; /* [15:12] */
650 __IO uint32_t reserved1 : 16;/* [31:16] */
651 } cm2_input_bit;
652 };
653
657 union
658 {
659 uint32_t cctrl;
660 struct
661 {
662 __IO uint32_t c1en : 1; /* [0] */
663 __IO uint32_t c1p : 1; /* [1] */
664 __IO uint32_t c1cen : 1; /* [2] */
665 __IO uint32_t c1cp : 1; /* [3] */
666 __IO uint32_t c2en : 1; /* [4] */
667 __IO uint32_t c2p : 1; /* [5] */
668 __IO uint32_t c2cen : 1; /* [6] */
669 __IO uint32_t c2cp : 1; /* [7] */
670 __IO uint32_t c3en : 1; /* [8] */
671 __IO uint32_t c3p : 1; /* [9] */
672 __IO uint32_t c3cen : 1; /* [10] */
673 __IO uint32_t c3cp : 1; /* [11] */
674 __IO uint32_t c4en : 1; /* [12] */
675 __IO uint32_t c4p : 1; /* [13] */
676 __IO uint32_t reserved1 : 18;/* [31:14] */
677 } cctrl_bit;
678 };
679
683 union
684 {
685 __IO uint32_t cval;
686 struct
687 {
688 __IO uint32_t cval : 32;/* [31:0] */
689 } cval_bit;
690 };
691
695 union
696 {
697 __IO uint32_t div;
698 struct
699 {
700 __IO uint32_t div : 16;/* [15:0] */
701 __IO uint32_t reserved1 : 16;/* [31:16] */
702 } div_bit;
703 };
704
708 union
709 {
710 __IO uint32_t pr;
711 struct
712 {
713 __IO uint32_t pr : 32;/* [31:0] */
714 } pr_bit;
715 };
716
720 union
721 {
722 __IO uint32_t rpr;
723 struct
724 {
725 __IO uint32_t rpr : 8; /* [7:0] */
726 __IO uint32_t reserved1 : 24;/* [31:8] */
727 } rpr_bit;
728 };
729
733 union
734 {
735 uint32_t c1dt;
736 struct
737 {
738 __IO uint32_t c1dt : 32;/* [31:0] */
739 } c1dt_bit;
740 };
741
745 union
746 {
747 uint32_t c2dt;
748 struct
749 {
750 __IO uint32_t c2dt : 32;/* [31:0] */
751 } c2dt_bit;
752 };
753
757 union
758 {
759 __IO uint32_t c3dt;
760 struct
761 {
762 __IO uint32_t c3dt : 32;/* [31:0] */
763 } c3dt_bit;
764 };
765
769 union
770 {
771 __IO uint32_t c4dt;
772 struct
773 {
774 __IO uint32_t c4dt : 32;/* [31:0] */
775 } c4dt_bit;
776 };
777
781 union
782 {
783 __IO uint32_t brk;
784 struct
785 {
786 __IO uint32_t dtc : 8; /* [7:0] */
787 __IO uint32_t wpc : 2; /* [9:8] */
788 __IO uint32_t fcsodis : 1; /* [10] */
789 __IO uint32_t fcsoen : 1; /* [11] */
790 __IO uint32_t brken : 1; /* [12] */
791 __IO uint32_t brkv : 1; /* [13] */
792 __IO uint32_t aoen : 1; /* [14] */
793 __IO uint32_t oen : 1; /* [15] */
794 __IO uint32_t reserved1 : 16; /* [31:16] */
795 } brk_bit;
796 };
800 union
801 {
802 __IO uint32_t dmactrl;
803 struct
804 {
805 __IO uint32_t addr : 5; /* [4:0] */
806 __IO uint32_t reserved1 : 3; /* [7:5] */
807 __IO uint32_t dtb : 5; /* [12:8] */
808 __IO uint32_t reserved2 : 19;/* [31:13] */
809 } dmactrl_bit;
810 };
811
815 union
816 {
817 __IO uint32_t dmadt;
818 struct
819 {
820 __IO uint32_t dmadt : 16;/* [15:0] */
821 __IO uint32_t reserved1 : 16;/* [31:16] */
822 } dmadt_bit;
823 };
824
825} tmr_type;
826
831#define TMR1 ((tmr_type *) TMR1_BASE)
832#define TMR2 ((tmr_type *) TMR2_BASE)
833#define TMR3 ((tmr_type *) TMR3_BASE)
834#define TMR4 ((tmr_type *) TMR4_BASE)
835#if defined (AT32F413TBU7) || defined (AT32F413Rx) || defined (AT32F413Cx) || \
836 defined (AT32F413Kx)
837#define TMR5 ((tmr_type *) TMR5_BASE)
838#if defined (AT32F413CCU7) || defined (AT32F413CCT7) || defined (AT32F413RCT7)
839#define TMR8 ((tmr_type *) TMR8_BASE)
840#endif
841#define TMR9 ((tmr_type *) TMR9_BASE)
842#define TMR10 ((tmr_type *) TMR10_BASE)
843#define TMR11 ((tmr_type *) TMR11_BASE)
844#endif
845
850void tmr_reset(tmr_type *tmr_x);
851void tmr_counter_enable(tmr_type *tmr_x, confirm_state new_state);
852void tmr_output_default_para_init(tmr_output_config_type *tmr_output_struct);
853void tmr_input_default_para_init(tmr_input_config_type *tmr_input_struct);
854void tmr_brkdt_default_para_init(tmr_brkdt_config_type *tmr_brkdt_struct);
855void tmr_base_init(tmr_type* tmr_x, uint32_t tmr_pr, uint32_t tmr_div);
856void tmr_clock_source_div_set(tmr_type *tmr_x, tmr_clock_division_type tmr_clock_div);
857void tmr_cnt_dir_set(tmr_type *tmr_x, tmr_count_mode_type tmr_cnt_dir);
858void tmr_repetition_counter_set(tmr_type *tmr_x, uint8_t tmr_rpr_value);
859void tmr_counter_value_set(tmr_type *tmr_x, uint32_t tmr_cnt_value);
860uint32_t tmr_counter_value_get(tmr_type *tmr_x);
861void tmr_div_value_set(tmr_type *tmr_x, uint32_t tmr_div_value);
862uint32_t tmr_div_value_get(tmr_type *tmr_x);
863void tmr_output_channel_config(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, \
864 tmr_output_config_type *tmr_output_struct);
865void tmr_output_channel_mode_select(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, \
866 tmr_output_control_mode_type oc_mode);
867void tmr_period_value_set(tmr_type *tmr_x, uint32_t tmr_pr_value);
868uint32_t tmr_period_value_get(tmr_type *tmr_x);
869void tmr_channel_value_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, \
870 uint32_t tmr_channel_value);
871uint32_t tmr_channel_value_get(tmr_type *tmr_x, tmr_channel_select_type tmr_channel);
872void tmr_period_buffer_enable(tmr_type *tmr_x, confirm_state new_state);
873void tmr_output_channel_buffer_enable(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, \
874 confirm_state new_state);
875void tmr_output_channel_immediately_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, \
876 confirm_state new_state);
877void tmr_output_channel_switch_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, \
878 confirm_state new_state);
879void tmr_one_cycle_mode_enable(tmr_type *tmr_x, confirm_state new_state);
880void tmr_32_bit_function_enable (tmr_type *tmr_x, confirm_state new_state);
881void tmr_overflow_request_source_set(tmr_type *tmr_x, confirm_state new_state);
882void tmr_overflow_event_disable(tmr_type *tmr_x, confirm_state new_state);
883void tmr_input_channel_init(tmr_type *tmr_x, tmr_input_config_type *input_struct, \
884 tmr_channel_input_divider_type divider_factor);
885void tmr_channel_enable(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, confirm_state new_state);
886void tmr_input_channel_filter_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, \
887 uint16_t filter_value);
888void tmr_pwm_input_config(tmr_type *tmr_x, tmr_input_config_type *input_struct, \
889 tmr_channel_input_divider_type divider_factor);
890void tmr_channel1_input_select(tmr_type *tmr_x, tmr_channel1_input_connected_type ch1_connect);
891void tmr_input_channel_divider_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, \
892 tmr_channel_input_divider_type divider_factor);
893void tmr_primary_mode_select(tmr_type *tmr_x, tmr_primary_select_type primary_mode);
894void tmr_sub_mode_select(tmr_type *tmr_x, tmr_sub_mode_select_type sub_mode);
895void tmr_channel_dma_select(tmr_type *tmr_x, tmr_dma_request_source_type cc_dma_select);
896void tmr_hall_select(tmr_type *tmr_x, confirm_state new_state);
897void tmr_channel_buffer_enable(tmr_type *tmr_x, confirm_state new_state);
898void tmr_trigger_input_select(tmr_type *tmr_x, sub_tmr_input_sel_type trigger_select);
899void tmr_sub_sync_mode_set(tmr_type *tmr_x, confirm_state new_state);
900void tmr_dma_request_enable(tmr_type *tmr_x, tmr_dma_request_type dma_request, confirm_state new_state);
901void tmr_interrupt_enable(tmr_type *tmr_x, uint32_t tmr_interrupt, confirm_state new_state);
902 flag_status tmr_interrupt_flag_get(tmr_type *tmr_x, uint32_t tmr_flag);
903 flag_status tmr_flag_get(tmr_type *tmr_x, uint32_t tmr_flag);
904void tmr_flag_clear(tmr_type *tmr_x, uint32_t tmr_flag);
905void tmr_event_sw_trigger(tmr_type *tmr_x, tmr_event_trigger_type tmr_event);
906void tmr_output_enable(tmr_type *tmr_x, confirm_state new_state);
907void tmr_internal_clock_set(tmr_type *tmr_x);
908
909void tmr_output_channel_polarity_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, \
910 tmr_polarity_active_type oc_polarity);
911void tmr_external_clock_config(tmr_type *tmr_x, tmr_external_signal_divider_type es_divide, \
912 tmr_external_signal_polarity_type es_polarity, uint16_t es_filter);
913void tmr_external_clock_mode1_config(tmr_type *tmr_x, tmr_external_signal_divider_type es_divide, \
914 tmr_external_signal_polarity_type es_polarity, uint16_t es_filter);
915void tmr_external_clock_mode2_config(tmr_type *tmr_x, tmr_external_signal_divider_type es_divide, \
916 tmr_external_signal_polarity_type es_polarity, uint16_t es_filter);
917void tmr_encoder_mode_config(tmr_type *tmr_x, tmr_encoder_mode_type encoder_mode, tmr_input_polarity_type \
918 ic1_polarity, tmr_input_polarity_type ic2_polarity);
919void tmr_force_output_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, \
920 tmr_force_output_type force_output);
921void tmr_dma_control_config(tmr_type *tmr_x, tmr_dma_transfer_length_type dma_length, \
922 tmr_dma_address_type dma_base_address);
923void tmr_brkdt_config(tmr_type *tmr_x, tmr_brkdt_config_type *brkdt_struct);
924
937#ifdef __cplusplus
938}
939#endif
940
941#endif
at32f413.h
at32f413 header file
tmr_output_struct
tmr_output_config_type tmr_output_struct
Definition project/at_start_f413/examples/tmr/6_steps/src/main.c:38
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
flag_status
flag_status
flag status
Definition at32f413.h:292
tmr_dma_control_config
void tmr_dma_control_config(tmr_type *tmr_x, tmr_dma_transfer_length_type dma_length, tmr_dma_address_type dma_base_address)
config tmr dma control
Definition at32f413_tmr.c:1753
tmr_channel_value_get
uint32_t tmr_channel_value_get(tmr_type *tmr_x, tmr_channel_select_type tmr_channel)
get tmr channel value
Definition at32f413_tmr.c:551
tmr_flag_clear
void tmr_flag_clear(tmr_type *tmr_x, uint32_t tmr_flag)
clear tmr flag
Definition at32f413_tmr.c:1433
tmr_period_value_get
uint32_t tmr_period_value_get(tmr_type *tmr_x)
get tmr period value
Definition at32f413_tmr.c:485
tmr_channel_buffer_enable
void tmr_channel_buffer_enable(tmr_type *tmr_x, confirm_state new_state)
enable tmr channel buffer
Definition at32f413_tmr.c:1238
tmr_overflow_request_source_set
void tmr_overflow_request_source_set(tmr_type *tmr_x, confirm_state new_state)
select tmr the overflow event sources
Definition at32f413_tmr.c:781
tmr_output_channel_mode_select
void tmr_output_channel_mode_select(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_output_control_mode_type oc_mode)
select tmr output channel mode
Definition at32f413_tmr.c:429
tmr_input_channel_divider_set
void tmr_input_channel_divider_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_channel_input_divider_type divider_factor)
set tmr input channel divider
Definition at32f413_tmr.c:1127
tmr_dma_request_enable
void tmr_dma_request_enable(tmr_type *tmr_x, tmr_dma_request_type dma_request, confirm_state new_state)
enable or disable tmr dma request
Definition at32f413_tmr.c:1296
tmr_external_clock_config
void tmr_external_clock_config(tmr_type *tmr_x, tmr_external_signal_divider_type es_divide, tmr_external_signal_polarity_type es_polarity, uint16_t es_filter)
config tmr external clock
Definition at32f413_tmr.c:1567
tmr_repetition_counter_set
void tmr_repetition_counter_set(tmr_type *tmr_x, uint8_t tmr_rpr_value)
set the repetition counter register(rpr) value
Definition at32f413_tmr.c:239
tmr_period_buffer_enable
void tmr_period_buffer_enable(tmr_type *tmr_x, confirm_state new_state)
enable tmr period buffer
Definition at32f413_tmr.c:592
tmr_counter_enable
void tmr_counter_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr counter
Definition at32f413_tmr.c:114
tmr_internal_clock_set
void tmr_internal_clock_set(tmr_type *tmr_x)
set tmr select internal clock
Definition at32f413_tmr.c:1481
tmr_output_channel_config
void tmr_output_channel_config(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_output_config_type *tmr_output_struct)
config tmr output channel
Definition at32f413_tmr.c:318
tmr_brkdt_default_para_init
void tmr_brkdt_default_para_init(tmr_brkdt_config_type *tmr_brkdt_struct)
init tmr brkdt default para
Definition at32f413_tmr.c:157
tmr_force_output_set
void tmr_force_output_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_force_output_type force_output)
set tmr force output
Definition at32f413_tmr.c:1687
tmr_interrupt_flag_get
flag_status tmr_interrupt_flag_get(tmr_type *tmr_x, uint32_t tmr_flag)
get tmr interrupt flag
Definition at32f413_tmr.c:1357
tmr_counter_value_set
void tmr_counter_value_set(tmr_type *tmr_x, uint32_t tmr_cnt_value)
set tmr counter value
Definition at32f413_tmr.c:255
tmr_div_value_get
uint32_t tmr_div_value_get(tmr_type *tmr_x)
get tmr div value
Definition at32f413_tmr.c:297
tmr_input_channel_init
void tmr_input_channel_init(tmr_type *tmr_x, tmr_input_config_type *input_struct, tmr_channel_input_divider_type divider_factor)
init tmr input channel
Definition at32f413_tmr.c:816
tmr_input_channel_filter_set
void tmr_input_channel_filter_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, uint16_t filter_value)
set tmr input channel filter
Definition at32f413_tmr.c:944
tmr_period_value_set
void tmr_period_value_set(tmr_type *tmr_x, uint32_t tmr_pr_value)
set tmr period value
Definition at32f413_tmr.c:469
tmr_clock_source_div_set
void tmr_clock_source_div_set(tmr_type *tmr_x, tmr_clock_division_type tmr_clock_div)
set tmr clock source division
Definition at32f413_tmr.c:204
tmr_sub_mode_select
void tmr_sub_mode_select(tmr_type *tmr_x, tmr_sub_mode_select_type sub_mode)
select tmr subordinate mode
Definition at32f413_tmr.c:1196
tmr_counter_value_get
uint32_t tmr_counter_value_get(tmr_type *tmr_x)
get tmr counter value
Definition at32f413_tmr.c:269
tmr_brkdt_config
void tmr_brkdt_config(tmr_type *tmr_x, tmr_brkdt_config_type *brkdt_struct)
config tmr brake mode and dead-time
Definition at32f413_tmr.c:1769
tmr_flag_get
flag_status tmr_flag_get(tmr_type *tmr_x, uint32_t tmr_flag)
get tmr flag
Definition at32f413_tmr.c:1395
tmr_external_clock_mode2_config
void tmr_external_clock_mode2_config(tmr_type *tmr_x, tmr_external_signal_divider_type es_divide, tmr_external_signal_polarity_type es_polarity, uint16_t es_filter)
config tmr external clock mode2
Definition at32f413_tmr.c:1619
tmr_input_default_para_init
void tmr_input_default_para_init(tmr_input_config_type *tmr_input_struct)
init tmr input default para
Definition at32f413_tmr.c:143
tmr_div_value_set
void tmr_div_value_set(tmr_type *tmr_x, uint32_t tmr_div_value)
set tmr div value
Definition at32f413_tmr.c:283
tmr_output_default_para_init
void tmr_output_default_para_init(tmr_output_config_type *tmr_output_struct)
init tmr output default para
Definition at32f413_tmr.c:126
tmr_event_sw_trigger
void tmr_event_sw_trigger(tmr_type *tmr_x, tmr_event_trigger_type tmr_event)
generate tmr event
Definition at32f413_tmr.c:1456
tmr_output_enable
void tmr_output_enable(tmr_type *tmr_x, confirm_state new_state)
tmr output enable(oen),this function is important for advtm output enable
Definition at32f413_tmr.c:1469
tmr_sub_sync_mode_set
void tmr_sub_sync_mode_set(tmr_type *tmr_x, confirm_state new_state)
set tmr subordinate synchronization mode
Definition at32f413_tmr.c:1273
tmr_base_init
void tmr_base_init(tmr_type *tmr_x, uint32_t tmr_pr, uint32_t tmr_div)
init tmr base
Definition at32f413_tmr.c:179
tmr_hall_select
void tmr_hall_select(tmr_type *tmr_x, confirm_state new_state)
select tmr hall
Definition at32f413_tmr.c:1225
tmr_channel1_input_select
void tmr_channel1_input_select(tmr_type *tmr_x, tmr_channel1_input_connected_type ch1_connect)
select tmr channel1 input
Definition at32f413_tmr.c:1102
tmr_32_bit_function_enable
void tmr_32_bit_function_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr 32 bit function(plus mode)
Definition at32f413_tmr.c:758
tmr_external_clock_mode1_config
void tmr_external_clock_mode1_config(tmr_type *tmr_x, tmr_external_signal_divider_type es_divide, tmr_external_signal_polarity_type es_polarity, uint16_t es_filter)
config tmr external clock mode1
Definition at32f413_tmr.c:1593
tmr_pwm_input_config
void tmr_pwm_input_config(tmr_type *tmr_x, tmr_input_config_type *input_struct, tmr_channel_input_divider_type divider_factor)
config tmr pwm input
Definition at32f413_tmr.c:990
tmr_trigger_input_select
void tmr_trigger_input_select(tmr_type *tmr_x, sub_tmr_input_sel_type trigger_select)
select tmr sub-trigger
Definition at32f413_tmr.c:1260
tmr_output_channel_buffer_enable
void tmr_output_channel_buffer_enable(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, confirm_state new_state)
enable tmr output channel buffer
Definition at32f413_tmr.c:613
tmr_interrupt_enable
void tmr_interrupt_enable(tmr_type *tmr_x, uint32_t tmr_interrupt, confirm_state new_state)
enable or disable tmr interrupt
Definition at32f413_tmr.c:1327
tmr_primary_mode_select
void tmr_primary_mode_select(tmr_type *tmr_x, tmr_primary_select_type primary_mode)
select tmr primary mode
Definition at32f413_tmr.c:1174
tmr_overflow_event_disable
void tmr_overflow_event_disable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr overflow event generation
Definition at32f413_tmr.c:795
tmr_channel_dma_select
void tmr_channel_dma_select(tmr_type *tmr_x, tmr_dma_request_source_type cc_dma_select)
select tmr channel dma
Definition at32f413_tmr.c:1212
tmr_cnt_dir_set
void tmr_cnt_dir_set(tmr_type *tmr_x, tmr_count_mode_type tmr_cnt_dir)
set tmr counter count direction
Definition at32f413_tmr.c:225
tmr_output_channel_immediately_set
void tmr_output_channel_immediately_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, confirm_state new_state)
set tmr output channel immediately
Definition at32f413_tmr.c:659
tmr_encoder_mode_config
void tmr_encoder_mode_config(tmr_type *tmr_x, tmr_encoder_mode_type encoder_mode, tmr_input_polarity_type ic1_polarity, tmr_input_polarity_type ic2_polarity)
config tmr encoder mode
Definition at32f413_tmr.c:1648
tmr_channel_enable
void tmr_channel_enable(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, confirm_state new_state)
tmr channel enable
Definition at32f413_tmr.c:888
tmr_output_channel_switch_set
void tmr_output_channel_switch_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, confirm_state new_state)
set tmr output channel switch
Definition at32f413_tmr.c:705
tmr_reset
void tmr_reset(tmr_type *tmr_x)
tmr reset by crm reset register
Definition at32f413_tmr.c:51
tmr_output_channel_polarity_set
void tmr_output_channel_polarity_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_polarity_active_type oc_polarity)
set tmr output channel polarity
Definition at32f413_tmr.c:1507
tmr_one_cycle_mode_enable
void tmr_one_cycle_mode_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr one cycle mode
Definition at32f413_tmr.c:744
tmr_channel_value_set
void tmr_channel_value_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, uint32_t tmr_channel_value)
set tmr channel value
Definition at32f413_tmr.c:506
tmr_dma_request_type
tmr_dma_request_type
tmr dma request type
Definition at32f413_tmr.h:267
tmr_external_signal_divider_type
tmr_external_signal_divider_type
tmr external signal divider type
Definition at32f413_tmr.h:306
tmr_polarity_active_type
tmr_polarity_active_type
tmr polarity active type
Definition at32f413_tmr.h:296
tmr_count_mode_type
tmr_count_mode_type
tmr counter mode type
Definition at32f413_tmr.h:104
tmr_input_polarity_type
tmr_input_polarity_type
tmr input channel polarity type
Definition at32f413_tmr.h:204
tmr_dma_request_source_type
tmr_dma_request_source_type
tmr dma request source select type
Definition at32f413_tmr.h:258
tmr_channel_select_type
tmr_channel_select_type
tmr channel select type
Definition at32f413_tmr.h:214
tmr_external_signal_polarity_type
tmr_external_signal_polarity_type
tmr external signal polarity type
Definition at32f413_tmr.h:317
tmr_dma_address_type
tmr_dma_address_type
tmr dma base address type
Definition at32f413_tmr.h:351
tmr_wp_level_type
tmr_wp_level_type
tmr write protect level type
Definition at32f413_tmr.h:386
tmr_channel1_input_connected_type
tmr_channel1_input_connected_type
tmr channel1 input connected type
Definition at32f413_tmr.h:228
tmr_input_direction_mapped_type
tmr_input_direction_mapped_type
tmr input channel mapped type channel direction
Definition at32f413_tmr.h:237
tmr_clock_division_type
tmr_clock_division_type
tmr clock division type
Definition at32f413_tmr.h:94
tmr_event_trigger_type
tmr_event_trigger_type
tmr event triggered by software type
Definition at32f413_tmr.h:281
tmr_brk_polarity_type
tmr_brk_polarity_type
tmr brk polarity type
Definition at32f413_tmr.h:377
tmr_output_control_mode_type
tmr_output_control_mode_type
tmr output control mode type
Definition at32f413_tmr.h:171
tmr_output_polarity_type
tmr_output_polarity_type
tmr output channel polarity type
Definition at32f413_tmr.h:195
tmr_dma_transfer_length_type
tmr_dma_transfer_length_type
tmr dma transfer length type
Definition at32f413_tmr.h:326
sub_tmr_input_sel_type
sub_tmr_input_sel_type
tmr subordinate mode input select type
Definition at32f413_tmr.h:131
tmr_force_output_type
tmr_force_output_type
tmr force output type
Definition at32f413_tmr.h:186
tmr_sub_mode_select_type
tmr_sub_mode_select_type
tmr subordinate mode select type
Definition at32f413_tmr.h:146
tmr_primary_select_type
tmr_primary_select_type
tmr primary mode select type
Definition at32f413_tmr.h:116
tmr_encoder_mode_type
tmr_encoder_mode_type
tmr encoder mode type
Definition at32f413_tmr.h:161
tmr_channel_input_divider_type
tmr_channel_input_divider_type
tmr input divider type
Definition at32f413_tmr.h:247
TMR_OVERFLOW_DMA_REQUEST
@ TMR_OVERFLOW_DMA_REQUEST
Definition at32f413_tmr.h:268
TMR_HALL_DMA_REQUEST
@ TMR_HALL_DMA_REQUEST
Definition at32f413_tmr.h:273
TMR_C1_DMA_REQUEST
@ TMR_C1_DMA_REQUEST
Definition at32f413_tmr.h:269
TMR_C2_DMA_REQUEST
@ TMR_C2_DMA_REQUEST
Definition at32f413_tmr.h:270
TMR_C3_DMA_REQUEST
@ TMR_C3_DMA_REQUEST
Definition at32f413_tmr.h:271
TMR_TRIGGER_DMA_REQUEST
@ TMR_TRIGGER_DMA_REQUEST
Definition at32f413_tmr.h:274
TMR_C4_DMA_REQUEST
@ TMR_C4_DMA_REQUEST
Definition at32f413_tmr.h:272
TMR_ES_FREQUENCY_DIV_1
@ TMR_ES_FREQUENCY_DIV_1
Definition at32f413_tmr.h:307
TMR_ES_FREQUENCY_DIV_8
@ TMR_ES_FREQUENCY_DIV_8
Definition at32f413_tmr.h:310
TMR_ES_FREQUENCY_DIV_4
@ TMR_ES_FREQUENCY_DIV_4
Definition at32f413_tmr.h:309
TMR_ES_FREQUENCY_DIV_2
@ TMR_ES_FREQUENCY_DIV_2
Definition at32f413_tmr.h:308
TMR_POLARITY_ACTIVE_HIGH
@ TMR_POLARITY_ACTIVE_HIGH
Definition at32f413_tmr.h:297
TMR_POLARITY_ACTIVE_LOW
@ TMR_POLARITY_ACTIVE_LOW
Definition at32f413_tmr.h:298
TMR_POLARITY_ACTIVE_BOTH
@ TMR_POLARITY_ACTIVE_BOTH
Definition at32f413_tmr.h:299
TMR_COUNT_DOWN
@ TMR_COUNT_DOWN
Definition at32f413_tmr.h:106
TMR_COUNT_TWO_WAY_2
@ TMR_COUNT_TWO_WAY_2
Definition at32f413_tmr.h:108
TMR_COUNT_UP
@ TMR_COUNT_UP
Definition at32f413_tmr.h:105
TMR_COUNT_TWO_WAY_3
@ TMR_COUNT_TWO_WAY_3
Definition at32f413_tmr.h:109
TMR_COUNT_TWO_WAY_1
@ TMR_COUNT_TWO_WAY_1
Definition at32f413_tmr.h:107
TMR_INPUT_BOTH_EDGE
@ TMR_INPUT_BOTH_EDGE
Definition at32f413_tmr.h:207
TMR_INPUT_FALLING_EDGE
@ TMR_INPUT_FALLING_EDGE
Definition at32f413_tmr.h:206
TMR_INPUT_RISING_EDGE
@ TMR_INPUT_RISING_EDGE
Definition at32f413_tmr.h:205
TMR_DMA_REQUEST_BY_CHANNEL
@ TMR_DMA_REQUEST_BY_CHANNEL
Definition at32f413_tmr.h:259
TMR_DMA_REQUEST_BY_OVERFLOW
@ TMR_DMA_REQUEST_BY_OVERFLOW
Definition at32f413_tmr.h:260
TMR_SELECT_CHANNEL_1C
@ TMR_SELECT_CHANNEL_1C
Definition at32f413_tmr.h:216
TMR_SELECT_CHANNEL_3
@ TMR_SELECT_CHANNEL_3
Definition at32f413_tmr.h:219
TMR_SELECT_CHANNEL_1
@ TMR_SELECT_CHANNEL_1
Definition at32f413_tmr.h:215
TMR_SELECT_CHANNEL_2C
@ TMR_SELECT_CHANNEL_2C
Definition at32f413_tmr.h:218
TMR_SELECT_CHANNEL_4
@ TMR_SELECT_CHANNEL_4
Definition at32f413_tmr.h:221
TMR_SELECT_CHANNEL_2
@ TMR_SELECT_CHANNEL_2
Definition at32f413_tmr.h:217
TMR_SELECT_CHANNEL_3C
@ TMR_SELECT_CHANNEL_3C
Definition at32f413_tmr.h:220
TMR_ES_POLARITY_INVERTED
@ TMR_ES_POLARITY_INVERTED
Definition at32f413_tmr.h:319
TMR_ES_POLARITY_NON_INVERTED
@ TMR_ES_POLARITY_NON_INVERTED
Definition at32f413_tmr.h:318
TMR_C2DT_ADDRESS
@ TMR_C2DT_ADDRESS
Definition at32f413_tmr.h:366
TMR_C1DT_ADDRESS
@ TMR_C1DT_ADDRESS
Definition at32f413_tmr.h:365
TMR_STCTRL_ADDRESS
@ TMR_STCTRL_ADDRESS
Definition at32f413_tmr.h:354
TMR_BRK_ADDRESS
@ TMR_BRK_ADDRESS
Definition at32f413_tmr.h:369
TMR_CTRL2_ADDRESS
@ TMR_CTRL2_ADDRESS
Definition at32f413_tmr.h:353
TMR_PR_ADDRESS
@ TMR_PR_ADDRESS
Definition at32f413_tmr.h:363
TMR_CVAL_ADDRESS
@ TMR_CVAL_ADDRESS
Definition at32f413_tmr.h:361
TMR_CM1_ADDRESS
@ TMR_CM1_ADDRESS
Definition at32f413_tmr.h:358
TMR_IDEN_ADDRESS
@ TMR_IDEN_ADDRESS
Definition at32f413_tmr.h:355
TMR_DMACTRL_ADDRESS
@ TMR_DMACTRL_ADDRESS
Definition at32f413_tmr.h:370
TMR_CCTRL_ADDRESS
@ TMR_CCTRL_ADDRESS
Definition at32f413_tmr.h:360
TMR_RPR_ADDRESS
@ TMR_RPR_ADDRESS
Definition at32f413_tmr.h:364
TMR_ISTS_ADDRESS
@ TMR_ISTS_ADDRESS
Definition at32f413_tmr.h:356
TMR_C4DT_ADDRESS
@ TMR_C4DT_ADDRESS
Definition at32f413_tmr.h:368
TMR_DIV_ADDRESS
@ TMR_DIV_ADDRESS
Definition at32f413_tmr.h:362
TMR_SWEVT_ADDRESS
@ TMR_SWEVT_ADDRESS
Definition at32f413_tmr.h:357
TMR_CM2_ADDRESS
@ TMR_CM2_ADDRESS
Definition at32f413_tmr.h:359
TMR_C3DT_ADDRESS
@ TMR_C3DT_ADDRESS
Definition at32f413_tmr.h:367
TMR_CTRL1_ADDRESS
@ TMR_CTRL1_ADDRESS
Definition at32f413_tmr.h:352
TMR_WP_LEVEL_3
@ TMR_WP_LEVEL_3
Definition at32f413_tmr.h:388
TMR_WP_LEVEL_2
@ TMR_WP_LEVEL_2
Definition at32f413_tmr.h:389
TMR_WP_OFF
@ TMR_WP_OFF
Definition at32f413_tmr.h:387
TMR_WP_LEVEL_1
@ TMR_WP_LEVEL_1
Definition at32f413_tmr.h:390
TMR_CHANEL1_2_3_CONNECTED_C1IRAW_XOR
@ TMR_CHANEL1_2_3_CONNECTED_C1IRAW_XOR
Definition at32f413_tmr.h:230
TMR_CHANEL1_CONNECTED_C1IRAW
@ TMR_CHANEL1_CONNECTED_C1IRAW
Definition at32f413_tmr.h:229
TMR_CC_CHANNEL_MAPPED_STI
@ TMR_CC_CHANNEL_MAPPED_STI
Definition at32f413_tmr.h:240
TMR_CC_CHANNEL_MAPPED_DIRECT
@ TMR_CC_CHANNEL_MAPPED_DIRECT
Definition at32f413_tmr.h:238
TMR_CC_CHANNEL_MAPPED_INDIRECT
@ TMR_CC_CHANNEL_MAPPED_INDIRECT
Definition at32f413_tmr.h:239
TMR_CLOCK_DIV2
@ TMR_CLOCK_DIV2
Definition at32f413_tmr.h:96
TMR_CLOCK_DIV4
@ TMR_CLOCK_DIV4
Definition at32f413_tmr.h:97
TMR_CLOCK_DIV1
@ TMR_CLOCK_DIV1
Definition at32f413_tmr.h:95
TMR_C1_SWTRIG
@ TMR_C1_SWTRIG
Definition at32f413_tmr.h:283
TMR_C3_SWTRIG
@ TMR_C3_SWTRIG
Definition at32f413_tmr.h:285
TMR_C2_SWTRIG
@ TMR_C2_SWTRIG
Definition at32f413_tmr.h:284
TMR_C4_SWTRIG
@ TMR_C4_SWTRIG
Definition at32f413_tmr.h:286
TMR_BRK_SWTRIG
@ TMR_BRK_SWTRIG
Definition at32f413_tmr.h:289
TMR_HALL_SWTRIG
@ TMR_HALL_SWTRIG
Definition at32f413_tmr.h:287
TMR_TRIGGER_SWTRIG
@ TMR_TRIGGER_SWTRIG
Definition at32f413_tmr.h:288
TMR_OVERFLOW_SWTRIG
@ TMR_OVERFLOW_SWTRIG
Definition at32f413_tmr.h:282
TMR_BRK_INPUT_ACTIVE_HIGH
@ TMR_BRK_INPUT_ACTIVE_HIGH
Definition at32f413_tmr.h:379
TMR_BRK_INPUT_ACTIVE_LOW
@ TMR_BRK_INPUT_ACTIVE_LOW
Definition at32f413_tmr.h:378
TMR_OUTPUT_CONTROL_PWM_MODE_B
@ TMR_OUTPUT_CONTROL_PWM_MODE_B
Definition at32f413_tmr.h:179
TMR_OUTPUT_CONTROL_FORCE_HIGH
@ TMR_OUTPUT_CONTROL_FORCE_HIGH
Definition at32f413_tmr.h:177
TMR_OUTPUT_CONTROL_SWITCH
@ TMR_OUTPUT_CONTROL_SWITCH
Definition at32f413_tmr.h:175
TMR_OUTPUT_CONTROL_OFF
@ TMR_OUTPUT_CONTROL_OFF
Definition at32f413_tmr.h:172
TMR_OUTPUT_CONTROL_LOW
@ TMR_OUTPUT_CONTROL_LOW
Definition at32f413_tmr.h:174
TMR_OUTPUT_CONTROL_FORCE_LOW
@ TMR_OUTPUT_CONTROL_FORCE_LOW
Definition at32f413_tmr.h:176
TMR_OUTPUT_CONTROL_PWM_MODE_A
@ TMR_OUTPUT_CONTROL_PWM_MODE_A
Definition at32f413_tmr.h:178
TMR_OUTPUT_CONTROL_HIGH
@ TMR_OUTPUT_CONTROL_HIGH
Definition at32f413_tmr.h:173
TMR_OUTPUT_ACTIVE_HIGH
@ TMR_OUTPUT_ACTIVE_HIGH
Definition at32f413_tmr.h:196
TMR_OUTPUT_ACTIVE_LOW
@ TMR_OUTPUT_ACTIVE_LOW
Definition at32f413_tmr.h:197
TMR_DMA_TRANSFER_15BYTES
@ TMR_DMA_TRANSFER_15BYTES
Definition at32f413_tmr.h:341
TMR_DMA_TRANSFER_11BYTES
@ TMR_DMA_TRANSFER_11BYTES
Definition at32f413_tmr.h:337
TMR_DMA_TRANSFER_13BYTES
@ TMR_DMA_TRANSFER_13BYTES
Definition at32f413_tmr.h:339
TMR_DMA_TRANSFER_14BYTES
@ TMR_DMA_TRANSFER_14BYTES
Definition at32f413_tmr.h:340
TMR_DMA_TRANSFER_2BYTES
@ TMR_DMA_TRANSFER_2BYTES
Definition at32f413_tmr.h:328
TMR_DMA_TRANSFER_18BYTES
@ TMR_DMA_TRANSFER_18BYTES
Definition at32f413_tmr.h:344
TMR_DMA_TRANSFER_9BYTES
@ TMR_DMA_TRANSFER_9BYTES
Definition at32f413_tmr.h:335
TMR_DMA_TRANSFER_12BYTES
@ TMR_DMA_TRANSFER_12BYTES
Definition at32f413_tmr.h:338
TMR_DMA_TRANSFER_7BYTES
@ TMR_DMA_TRANSFER_7BYTES
Definition at32f413_tmr.h:333
TMR_DMA_TRANSFER_17BYTES
@ TMR_DMA_TRANSFER_17BYTES
Definition at32f413_tmr.h:343
TMR_DMA_TRANSFER_16BYTES
@ TMR_DMA_TRANSFER_16BYTES
Definition at32f413_tmr.h:342
TMR_DMA_TRANSFER_5BYTES
@ TMR_DMA_TRANSFER_5BYTES
Definition at32f413_tmr.h:331
TMR_DMA_TRANSFER_10BYTES
@ TMR_DMA_TRANSFER_10BYTES
Definition at32f413_tmr.h:336
TMR_DMA_TRANSFER_1BYTE
@ TMR_DMA_TRANSFER_1BYTE
Definition at32f413_tmr.h:327
TMR_DMA_TRANSFER_6BYTES
@ TMR_DMA_TRANSFER_6BYTES
Definition at32f413_tmr.h:332
TMR_DMA_TRANSFER_4BYTES
@ TMR_DMA_TRANSFER_4BYTES
Definition at32f413_tmr.h:330
TMR_DMA_TRANSFER_8BYTES
@ TMR_DMA_TRANSFER_8BYTES
Definition at32f413_tmr.h:334
TMR_DMA_TRANSFER_3BYTES
@ TMR_DMA_TRANSFER_3BYTES
Definition at32f413_tmr.h:329
TMR_SUB_INPUT_SEL_IS2
@ TMR_SUB_INPUT_SEL_IS2
Definition at32f413_tmr.h:134
TMR_SUB_INPUT_SEL_IS0
@ TMR_SUB_INPUT_SEL_IS0
Definition at32f413_tmr.h:132
TMR_SUB_INPUT_SEL_C2DF2
@ TMR_SUB_INPUT_SEL_C2DF2
Definition at32f413_tmr.h:138
TMR_SUB_INPUT_SEL_EXTIN
@ TMR_SUB_INPUT_SEL_EXTIN
Definition at32f413_tmr.h:139
TMR_SUB_INPUT_SEL_IS3
@ TMR_SUB_INPUT_SEL_IS3
Definition at32f413_tmr.h:135
TMR_SUB_INPUT_SEL_C1DF1
@ TMR_SUB_INPUT_SEL_C1DF1
Definition at32f413_tmr.h:137
TMR_SUB_INPUT_SEL_C1INC
@ TMR_SUB_INPUT_SEL_C1INC
Definition at32f413_tmr.h:136
TMR_SUB_INPUT_SEL_IS1
@ TMR_SUB_INPUT_SEL_IS1
Definition at32f413_tmr.h:133
TMR_FORCE_OUTPUT_HIGH
@ TMR_FORCE_OUTPUT_HIGH
Definition at32f413_tmr.h:187
TMR_FORCE_OUTPUT_LOW
@ TMR_FORCE_OUTPUT_LOW
Definition at32f413_tmr.h:188
TMR_SUB_ENCODER_MODE_A
@ TMR_SUB_ENCODER_MODE_A
Definition at32f413_tmr.h:148
TMR_SUB_EXTERNAL_CLOCK_MODE_A
@ TMR_SUB_EXTERNAL_CLOCK_MODE_A
Definition at32f413_tmr.h:154
TMR_SUB_ENCODER_MODE_C
@ TMR_SUB_ENCODER_MODE_C
Definition at32f413_tmr.h:150
TMR_SUB_MODE_DIABLE
@ TMR_SUB_MODE_DIABLE
Definition at32f413_tmr.h:147
TMR_SUB_RESET_MODE
@ TMR_SUB_RESET_MODE
Definition at32f413_tmr.h:151
TMR_SUB_ENCODER_MODE_B
@ TMR_SUB_ENCODER_MODE_B
Definition at32f413_tmr.h:149
TMR_SUB_HANG_MODE
@ TMR_SUB_HANG_MODE
Definition at32f413_tmr.h:152
TMR_SUB_TRIGGER_MODE
@ TMR_SUB_TRIGGER_MODE
Definition at32f413_tmr.h:153
TMR_PRIMARY_SEL_RESET
@ TMR_PRIMARY_SEL_RESET
Definition at32f413_tmr.h:117
TMR_PRIMARY_SEL_C2ORAW
@ TMR_PRIMARY_SEL_C2ORAW
Definition at32f413_tmr.h:122
TMR_PRIMARY_SEL_C1ORAW
@ TMR_PRIMARY_SEL_C1ORAW
Definition at32f413_tmr.h:121
TMR_PRIMARY_SEL_C4ORAW
@ TMR_PRIMARY_SEL_C4ORAW
Definition at32f413_tmr.h:124
TMR_PRIMARY_SEL_COMPARE
@ TMR_PRIMARY_SEL_COMPARE
Definition at32f413_tmr.h:120
TMR_PRIMARY_SEL_ENABLE
@ TMR_PRIMARY_SEL_ENABLE
Definition at32f413_tmr.h:118
TMR_PRIMARY_SEL_OVERFLOW
@ TMR_PRIMARY_SEL_OVERFLOW
Definition at32f413_tmr.h:119
TMR_PRIMARY_SEL_C3ORAW
@ TMR_PRIMARY_SEL_C3ORAW
Definition at32f413_tmr.h:123
TMR_ENCODER_MODE_C
@ TMR_ENCODER_MODE_C
Definition at32f413_tmr.h:164
TMR_ENCODER_MODE_A
@ TMR_ENCODER_MODE_A
Definition at32f413_tmr.h:162
TMR_ENCODER_MODE_B
@ TMR_ENCODER_MODE_B
Definition at32f413_tmr.h:163
TMR_CHANNEL_INPUT_DIV_4
@ TMR_CHANNEL_INPUT_DIV_4
Definition at32f413_tmr.h:250
TMR_CHANNEL_INPUT_DIV_2
@ TMR_CHANNEL_INPUT_DIV_2
Definition at32f413_tmr.h:249
TMR_CHANNEL_INPUT_DIV_8
@ TMR_CHANNEL_INPUT_DIV_8
Definition at32f413_tmr.h:251
TMR_CHANNEL_INPUT_DIV_1
@ TMR_CHANNEL_INPUT_DIV_1
Definition at32f413_tmr.h:248
tmr_brkdt_config_type
tmr brkdt config type
Definition at32f413_tmr.h:422
tmr_brkdt_config_type::brk_enable
confirm_state brk_enable
Definition at32f413_tmr.h:429
tmr_brkdt_config_type::deadtime
uint8_t deadtime
Definition at32f413_tmr.h:423
tmr_brkdt_config_type::auto_output_enable
confirm_state auto_output_enable
Definition at32f413_tmr.h:426
tmr_brkdt_config_type::wp_level
tmr_wp_level_type wp_level
Definition at32f413_tmr.h:425
tmr_brkdt_config_type::fcsoen_state
confirm_state fcsoen_state
Definition at32f413_tmr.h:427
tmr_brkdt_config_type::fcsodis_state
confirm_state fcsodis_state
Definition at32f413_tmr.h:428
tmr_brkdt_config_type::brk_polarity
tmr_brk_polarity_type brk_polarity
Definition at32f413_tmr.h:424
tmr_input_config_type
tmr input capture config type
Definition at32f413_tmr.h:411
tmr_input_config_type::input_mapped_select
tmr_input_direction_mapped_type input_mapped_select
Definition at32f413_tmr.h:414
tmr_input_config_type::input_filter_value
uint8_t input_filter_value
Definition at32f413_tmr.h:415
tmr_input_config_type::input_polarity_select
tmr_input_polarity_type input_polarity_select
Definition at32f413_tmr.h:413
tmr_input_config_type::input_channel_select
tmr_channel_select_type input_channel_select
Definition at32f413_tmr.h:412
tmr_output_config_type
tmr output config type
Definition at32f413_tmr.h:397
tmr_output_config_type::occ_output_state
confirm_state occ_output_state
Definition at32f413_tmr.h:404
tmr_output_config_type::oc_idle_state
confirm_state oc_idle_state
Definition at32f413_tmr.h:399
tmr_output_config_type::oc_output_state
confirm_state oc_output_state
Definition at32f413_tmr.h:403
tmr_output_config_type::oc_mode
tmr_output_control_mode_type oc_mode
Definition at32f413_tmr.h:398
tmr_output_config_type::occ_polarity
tmr_output_polarity_type occ_polarity
Definition at32f413_tmr.h:402
tmr_output_config_type::occ_idle_state
confirm_state occ_idle_state
Definition at32f413_tmr.h:400
tmr_output_config_type::oc_polarity
tmr_output_polarity_type oc_polarity
Definition at32f413_tmr.h:401
tmr_type
type define tmr register all
Definition at32f413_tmr.h:436
tmr_type::ovfif
__IO uint32_t ovfif
Definition at32f413_tmr.h:537
tmr_type::c1cen
__IO uint32_t c1cen
Definition at32f413_tmr.h:664
tmr_type::pmen
__IO uint32_t pmen
Definition at32f413_tmr.h:452
tmr_type::trgif
__IO uint32_t trgif
Definition at32f413_tmr.h:543
tmr_type::brken
__IO uint32_t brken
Definition at32f413_tmr.h:790
tmr_type::c1idiv
__IO uint32_t c1idiv
Definition at32f413_tmr.h:605
tmr_type::dmactrl
__IO uint32_t dmactrl
Definition at32f413_tmr.h:802
tmr_type::dtc
__IO uint32_t dtc
Definition at32f413_tmr.h:786
tmr_type::c1en
__IO uint32_t c1en
Definition at32f413_tmr.h:662
tmr_type::c4df
__IO uint32_t c4df
Definition at32f413_tmr.h:649
tmr_type::c3octrl
__IO uint32_t c3octrl
Definition at32f413_tmr.h:629
tmr_type::brkif
__IO uint32_t brkif
Definition at32f413_tmr.h:544
tmr_type::c2osen
__IO uint32_t c2osen
Definition at32f413_tmr.h:595
tmr_type::swevt
__IO uint32_t swevt
Definition at32f413_tmr.h:559
tmr_type::ovfden
__IO uint32_t ovfden
Definition at32f413_tmr.h:518
tmr_type::c2en
__IO uint32_t c2en
Definition at32f413_tmr.h:666
tmr_type::stctrl
__IO uint32_t stctrl
Definition at32f413_tmr.h:487
tmr_type::c3df
__IO uint32_t c3df
Definition at32f413_tmr.h:646
tmr_type::wpc
__IO uint32_t wpc
Definition at32f413_tmr.h:787
tmr_type::c3oben
__IO uint32_t c3oben
Definition at32f413_tmr.h:628
tmr_type::cnt_dir
__IO uint32_t cnt_dir
Definition at32f413_tmr.h:449
tmr_type::c2if
__IO uint32_t c2if
Definition at32f413_tmr.h:539
tmr_type::c3if
__IO uint32_t c3if
Definition at32f413_tmr.h:540
tmr_type::c4octrl
__IO uint32_t c4octrl
Definition at32f413_tmr.h:634
tmr_type::hallif
__IO uint32_t hallif
Definition at32f413_tmr.h:542
tmr_type::c1insel
__IO uint32_t c1insel
Definition at32f413_tmr.h:470
tmr_type::c2cios
__IO uint32_t c2cios
Definition at32f413_tmr.h:474
tmr_type::div
__IO uint32_t div
Definition at32f413_tmr.h:697
tmr_type::hallswtr
__IO uint32_t hallswtr
Definition at32f413_tmr.h:567
tmr_type::esf
__IO uint32_t esf
Definition at32f413_tmr.h:494
tmr_type::c1osen
__IO uint32_t c1osen
Definition at32f413_tmr.h:590
tmr_type::c2cen
__IO uint32_t c2cen
Definition at32f413_tmr.h:668
tmr_type::c2ien
__IO uint32_t c2ien
Definition at32f413_tmr.h:512
tmr_type::drs
__IO uint32_t drs
Definition at32f413_tmr.h:468
tmr_type::iden
__IO uint32_t iden
Definition at32f413_tmr.h:507
tmr_type::c1oben
__IO uint32_t c1oben
Definition at32f413_tmr.h:588
tmr_type::ists
__IO uint32_t ists
Definition at32f413_tmr.h:534
tmr_type::c1c
__IO uint32_t c1c
Definition at32f413_tmr.h:586
tmr_type::c3cen
__IO uint32_t c3cen
Definition at32f413_tmr.h:672
tmr_type::c4p
__IO uint32_t c4p
Definition at32f413_tmr.h:675
tmr_type::brkv
__IO uint32_t brkv
Definition at32f413_tmr.h:791
tmr_type::brk
__IO uint32_t brk
Definition at32f413_tmr.h:783
tmr_type::stis
__IO uint32_t stis
Definition at32f413_tmr.h:492
tmr_type::ovfswtr
__IO uint32_t ovfswtr
Definition at32f413_tmr.h:562
tmr_type::c3idiv
__IO uint32_t c3idiv
Definition at32f413_tmr.h:645
tmr_type::c4osen
__IO uint32_t c4osen
Definition at32f413_tmr.h:635
tmr_type::c1ien
__IO uint32_t c1ien
Definition at32f413_tmr.h:511
tmr_type::c1octrl
__IO uint32_t c1octrl
Definition at32f413_tmr.h:589
tmr_type::hallien
__IO uint32_t hallien
Definition at32f413_tmr.h:515
tmr_type::tmren
__IO uint32_t tmren
Definition at32f413_tmr.h:445
tmr_type::oen
__IO uint32_t oen
Definition at32f413_tmr.h:793
tmr_type::sts
__IO uint32_t sts
Definition at32f413_tmr.h:493
tmr_type::brkie
__IO uint32_t brkie
Definition at32f413_tmr.h:517
tmr_type::c2idiv
__IO uint32_t c2idiv
Definition at32f413_tmr.h:608
tmr_type::c1p
__IO uint32_t c1p
Definition at32f413_tmr.h:663
tmr_type::brkswtr
__IO uint32_t brkswtr
Definition at32f413_tmr.h:569
tmr_type::c1rf
__IO uint32_t c1rf
Definition at32f413_tmr.h:546
tmr_type::ovfien
__IO uint32_t ovfien
Definition at32f413_tmr.h:510
tmr_type::c1oien
__IO uint32_t c1oien
Definition at32f413_tmr.h:587
tmr_type::pr
__IO uint32_t pr
Definition at32f413_tmr.h:710
tmr_type::c3oien
__IO uint32_t c3oien
Definition at32f413_tmr.h:627
tmr_type::c2swtr
__IO uint32_t c2swtr
Definition at32f413_tmr.h:564
tmr_type::c1dt
uint32_t c1dt
Definition at32f413_tmr.h:735
tmr_type::c2oben
__IO uint32_t c2oben
Definition at32f413_tmr.h:593
tmr_type::c1den
__IO uint32_t c1den
Definition at32f413_tmr.h:519
tmr_type::cm2
__IO uint32_t cm2
Definition at32f413_tmr.h:619
tmr_type::c2octrl
__IO uint32_t c2octrl
Definition at32f413_tmr.h:594
tmr_type::smsel
__IO uint32_t smsel
Definition at32f413_tmr.h:490
tmr_type::c3p
__IO uint32_t c3p
Definition at32f413_tmr.h:671
tmr_type::c2dt
__IO uint32_t c2dt
Definition at32f413_tmr.h:750
tmr_type::dmadt
__IO uint32_t dmadt
Definition at32f413_tmr.h:817
tmr_type::c1if
__IO uint32_t c1if
Definition at32f413_tmr.h:538
tmr_type::c1cp
__IO uint32_t c1cp
Definition at32f413_tmr.h:665
tmr_type::c3c
__IO uint32_t c3c
Definition at32f413_tmr.h:626
tmr_type::c4rf
__IO uint32_t c4rf
Definition at32f413_tmr.h:549
tmr_type::c3cios
__IO uint32_t c3cios
Definition at32f413_tmr.h:476
tmr_type::clkdiv
__IO uint32_t clkdiv
Definition at32f413_tmr.h:451
tmr_type::tden
__IO uint32_t tden
Definition at32f413_tmr.h:524
tmr_type::ovfs
__IO uint32_t ovfs
Definition at32f413_tmr.h:447
tmr_type::c1dt
__IO uint32_t c1dt
Definition at32f413_tmr.h:738
tmr_type::c3swtr
__IO uint32_t c3swtr
Definition at32f413_tmr.h:565
tmr_type::cbctrl
__IO uint32_t cbctrl
Definition at32f413_tmr.h:465
tmr_type::dtb
__IO uint32_t dtb
Definition at32f413_tmr.h:807
tmr_type::c4ios
__IO uint32_t c4ios
Definition at32f413_tmr.h:477
tmr_type::c4swtr
__IO uint32_t c4swtr
Definition at32f413_tmr.h:566
tmr_type::prben
__IO uint32_t prben
Definition at32f413_tmr.h:450
tmr_type::tien
__IO uint32_t tien
Definition at32f413_tmr.h:516
tmr_type::ccfs
__IO uint32_t ccfs
Definition at32f413_tmr.h:467
tmr_type::ecmben
__IO uint32_t ecmben
Definition at32f413_tmr.h:496
tmr_type::ovfen
__IO uint32_t ovfen
Definition at32f413_tmr.h:446
tmr_type::reserved2
__IO uint32_t reserved2
Definition at32f413_tmr.h:478
tmr_type::cm1
__IO uint32_t cm1
Definition at32f413_tmr.h:579
tmr_type::c2den
__IO uint32_t c2den
Definition at32f413_tmr.h:520
tmr_type::c4en
__IO uint32_t c4en
Definition at32f413_tmr.h:674
tmr_type::reserved
__IO uint32_t reserved
Definition at32f413_tmr.h:570
tmr_type::trgswtr
__IO uint32_t trgswtr
Definition at32f413_tmr.h:568
tmr_type::fcsoen
__IO uint32_t fcsoen
Definition at32f413_tmr.h:789
tmr_type::esdiv
__IO uint32_t esdiv
Definition at32f413_tmr.h:495
tmr_type::c3en
__IO uint32_t c3en
Definition at32f413_tmr.h:670
tmr_type::c2p
__IO uint32_t c2p
Definition at32f413_tmr.h:667
tmr_type::c3ios
__IO uint32_t c3ios
Definition at32f413_tmr.h:475
tmr_type::ocmen
__IO uint32_t ocmen
Definition at32f413_tmr.h:448
tmr_type::hallde
__IO uint32_t hallde
Definition at32f413_tmr.h:523
tmr_type::c1swtr
__IO uint32_t c1swtr
Definition at32f413_tmr.h:563
tmr_type::c3rf
__IO uint32_t c3rf
Definition at32f413_tmr.h:548
tmr_type::c3den
__IO uint32_t c3den
Definition at32f413_tmr.h:521
tmr_type::c4oien
__IO uint32_t c4oien
Definition at32f413_tmr.h:632
tmr_type::c2dt
uint32_t c2dt
Definition at32f413_tmr.h:747
tmr_type::addr
__IO uint32_t addr
Definition at32f413_tmr.h:805
tmr_type::c3cp
__IO uint32_t c3cp
Definition at32f413_tmr.h:673
tmr_type::c2df
__IO uint32_t c2df
Definition at32f413_tmr.h:609
tmr_type::c4idiv
__IO uint32_t c4idiv
Definition at32f413_tmr.h:648
tmr_type::c2ios
__IO uint32_t c2ios
Definition at32f413_tmr.h:473
tmr_type::c3osen
__IO uint32_t c3osen
Definition at32f413_tmr.h:630
tmr_type::reserved1
__IO uint32_t reserved1
Definition at32f413_tmr.h:453
tmr_type::rpr
__IO uint32_t rpr
Definition at32f413_tmr.h:722
tmr_type::c2c
__IO uint32_t c2c
Definition at32f413_tmr.h:591
tmr_type::c1ios
__IO uint32_t c1ios
Definition at32f413_tmr.h:471
tmr_type::ctrl1
__IO uint32_t ctrl1
Definition at32f413_tmr.h:442
tmr_type::c4den
__IO uint32_t c4den
Definition at32f413_tmr.h:522
tmr_type::c1df
__IO uint32_t c1df
Definition at32f413_tmr.h:606
tmr_type::c2oien
__IO uint32_t c2oien
Definition at32f413_tmr.h:592
tmr_type::c4dt
__IO uint32_t c4dt
Definition at32f413_tmr.h:771
tmr_type::c4if
__IO uint32_t c4if
Definition at32f413_tmr.h:541
tmr_type::c3ien
__IO uint32_t c3ien
Definition at32f413_tmr.h:513
tmr_type::ctrl2
__IO uint32_t ctrl2
Definition at32f413_tmr.h:462
tmr_type::c3dt
__IO uint32_t c3dt
Definition at32f413_tmr.h:759
tmr_type::c2cp
__IO uint32_t c2cp
Definition at32f413_tmr.h:669
tmr_type::cctrl
uint32_t cctrl
Definition at32f413_tmr.h:659
tmr_type::c4c
__IO uint32_t c4c
Definition at32f413_tmr.h:631
tmr_type::c4oben
__IO uint32_t c4oben
Definition at32f413_tmr.h:633
tmr_type::fcsodis
__IO uint32_t fcsodis
Definition at32f413_tmr.h:788
tmr_type::cval
__IO uint32_t cval
Definition at32f413_tmr.h:685
tmr_type::c4ien
__IO uint32_t c4ien
Definition at32f413_tmr.h:514
tmr_type::esp
__IO uint32_t esp
Definition at32f413_tmr.h:497
tmr_type::ptos
__IO uint32_t ptos
Definition at32f413_tmr.h:469
tmr_type::c1cios
__IO uint32_t c1cios
Definition at32f413_tmr.h:472
tmr_type::aoen
__IO uint32_t aoen
Definition at32f413_tmr.h:792
tmr_type::c2rf
__IO uint32_t c2rf
Definition at32f413_tmr.h:547


AT32F413 Firmwary Library: at32f413_usart.c Source File

  • libraries
  • drivers
  • src
at32f413_usart.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_conf.h"
28
38#ifdef USART_MODULE_ENABLED
39
51void usart_reset(usart_type* usart_x)
52{
53 if(usart_x == USART1)
54 {
55 crm_periph_reset(CRM_USART1_PERIPH_RESET, TRUE);
56 crm_periph_reset(CRM_USART1_PERIPH_RESET, FALSE);
57 }
58 else if(usart_x == USART2)
59 {
60 crm_periph_reset(CRM_USART2_PERIPH_RESET, TRUE);
61 crm_periph_reset(CRM_USART2_PERIPH_RESET, FALSE);
62 }
63#if defined (AT32F413Rx) || defined (AT32F413Cx) || defined (AT32FEBKC8T7)
64 else if(usart_x == USART3)
65 {
66 crm_periph_reset(CRM_USART3_PERIPH_RESET, TRUE);
67 crm_periph_reset(CRM_USART3_PERIPH_RESET, FALSE);
68 }
69#endif
70#if defined (AT32F413Rx)
71 else if(usart_x == UART4)
72 {
73 crm_periph_reset(CRM_UART4_PERIPH_RESET, TRUE);
74 crm_periph_reset(CRM_UART4_PERIPH_RESET, FALSE);
75 }
76 else if(usart_x == UART5)
77 {
78 crm_periph_reset(CRM_UART5_PERIPH_RESET, TRUE);
79 crm_periph_reset(CRM_UART5_PERIPH_RESET, FALSE);
80 }
81#endif
82}
83
105void usart_init(usart_type* usart_x, uint32_t baud_rate, usart_data_bit_num_type data_bit, usart_stop_bit_num_type stop_bit)
106{
107 crm_clocks_freq_type clocks_freq;
108 uint32_t apb_clock, temp_val;
109 crm_clocks_freq_get(&clocks_freq);
110 if(usart_x == USART1)
111 {
112 apb_clock = clocks_freq.apb2_freq;
113 }
114 else
115 {
116 apb_clock = clocks_freq.apb1_freq;
117 }
118 temp_val = (apb_clock * 10 / baud_rate);
119 if((temp_val % 10) < 5)
120 {
121 temp_val = (temp_val / 10);
122 }
123 else
124 {
125 temp_val = (temp_val / 10) + 1;
126 }
127 usart_x->baudr_bit.div = temp_val;
128 usart_x->ctrl1_bit.dbn = data_bit;
129 usart_x->ctrl2_bit.stopbn = stop_bit;
130}
131
144void usart_parity_selection_config(usart_type* usart_x, usart_parity_selection_type parity)
145{
146 if(parity == USART_PARITY_NONE)
147 {
148 usart_x->ctrl1_bit.psel = FALSE;
149 usart_x->ctrl1_bit.pen = FALSE;
150 }
151 else if(parity == USART_PARITY_EVEN)
152 {
153 usart_x->ctrl1_bit.psel = FALSE;
154 usart_x->ctrl1_bit.pen = TRUE;
155 }
156 else if(parity == USART_PARITY_ODD)
157 {
158 usart_x->ctrl1_bit.psel = TRUE;
159 usart_x->ctrl1_bit.pen = TRUE;
160 }
161}
162
172void usart_enable(usart_type* usart_x, confirm_state new_state)
173{
174 usart_x->ctrl1_bit.uen = new_state;
175}
176
185void usart_transmitter_enable(usart_type* usart_x, confirm_state new_state)
186{
187 usart_x->ctrl1_bit.ten = new_state;
188}
189
198void usart_receiver_enable(usart_type* usart_x, confirm_state new_state)
199{
200 usart_x->ctrl1_bit.ren = new_state;
201}
202
223void usart_clock_config(usart_type* usart_x, usart_clock_polarity_type clk_pol, usart_clock_phase_type clk_pha, usart_lbcp_type clk_lb)
224{
225 usart_x->ctrl2_bit.clkpol = clk_pol;
226 usart_x->ctrl2_bit.clkpha = clk_pha;
227 usart_x->ctrl2_bit.lbcp = clk_lb;
228}
229
239void usart_clock_enable(usart_type* usart_x, confirm_state new_state)
240{
241 usart_x->ctrl2_bit.clken = new_state;
242}
243
263void usart_interrupt_enable(usart_type* usart_x, uint32_t usart_int, confirm_state new_state)
264{
265 if(new_state == TRUE)
266 PERIPH_REG((uint32_t)usart_x, usart_int) |= PERIPH_REG_BIT(usart_int);
267 else
268 PERIPH_REG((uint32_t)usart_x, usart_int) &= ~PERIPH_REG_BIT(usart_int);
269}
270
280void usart_dma_transmitter_enable(usart_type* usart_x, confirm_state new_state)
281{
282 usart_x->ctrl3_bit.dmaten = new_state;
283}
284
294void usart_dma_receiver_enable(usart_type* usart_x, confirm_state new_state)
295{
296 usart_x->ctrl3_bit.dmaren = new_state;
297}
298
307void usart_wakeup_id_set(usart_type* usart_x, uint8_t usart_id)
308{
309 usart_x->ctrl2_bit.id = usart_id;
310}
311
323void usart_wakeup_mode_set(usart_type* usart_x, usart_wakeup_mode_type wakeup_mode)
324{
325 usart_x->ctrl1_bit.wum = wakeup_mode;
326}
327
337void usart_receiver_mute_enable(usart_type* usart_x, confirm_state new_state)
338{
339 usart_x->ctrl1_bit.rm = new_state;
340}
341
353void usart_break_bit_num_set(usart_type* usart_x, usart_break_bit_num_type break_bit)
354{
355 usart_x->ctrl2_bit.bfbn = break_bit;
356}
357
367void usart_lin_mode_enable(usart_type* usart_x, confirm_state new_state)
368{
369 usart_x->ctrl2_bit.linen = new_state;
370}
371
380void usart_data_transmit(usart_type* usart_x, uint16_t data)
381{
382 usart_x->dt = (data & 0x01FF);
383}
384
392uint16_t usart_data_receive(usart_type* usart_x)
393{
394 return (uint16_t)(usart_x->dt);
395}
396
404void usart_break_send(usart_type* usart_x)
405{
406 usart_x->ctrl1_bit.sbf = TRUE;
407}
408
418void usart_smartcard_guard_time_set(usart_type* usart_x, uint8_t guard_time_val)
419{
420 usart_x->gdiv_bit.scgt = guard_time_val;
421}
422
432void usart_irda_smartcard_division_set(usart_type* usart_x, uint8_t div_val)
433{
434 usart_x->gdiv_bit.isdiv = div_val;
435}
436
447void usart_smartcard_mode_enable(usart_type* usart_x, confirm_state new_state)
448{
449 usart_x->ctrl3_bit.scmen = new_state;
450}
451
462void usart_smartcard_nack_set(usart_type* usart_x, confirm_state new_state)
463{
464 usart_x->ctrl3_bit.scnacken = new_state;
465}
466
476void usart_single_line_halfduplex_select(usart_type* usart_x, confirm_state new_state)
477{
478 usart_x->ctrl3_bit.slben = new_state;
479}
480
490void usart_irda_mode_enable(usart_type* usart_x, confirm_state new_state)
491{
492 usart_x->ctrl3_bit.irdaen = new_state;
493}
494
504void usart_irda_low_power_enable(usart_type* usart_x, confirm_state new_state)
505{
506 usart_x->ctrl3_bit.irdalp = new_state;
507}
508
522void usart_hardware_flow_control_set(usart_type* usart_x,usart_hardware_flow_control_type flow_state)
523{
524 if(flow_state == USART_HARDWARE_FLOW_NONE)
525 {
526 usart_x->ctrl3_bit.rtsen = FALSE;
527 usart_x->ctrl3_bit.ctsen = FALSE;
528 }
529 else if(flow_state == USART_HARDWARE_FLOW_RTS)
530 {
531 usart_x->ctrl3_bit.rtsen = TRUE;
532 usart_x->ctrl3_bit.ctsen = FALSE;
533 }
534 else if(flow_state == USART_HARDWARE_FLOW_CTS)
535 {
536 usart_x->ctrl3_bit.rtsen = FALSE;
537 usart_x->ctrl3_bit.ctsen = TRUE;
538 }
539 else if(flow_state == USART_HARDWARE_FLOW_RTS_CTS)
540 {
541 usart_x->ctrl3_bit.rtsen = TRUE;
542 usart_x->ctrl3_bit.ctsen = TRUE;
543 }
544}
545
565 flag_status usart_flag_get(usart_type* usart_x, uint32_t flag)
566{
567 if(usart_x->sts & flag)
568 {
569 return SET;
570 }
571 else
572 {
573 return RESET;
574 }
575}
576
596 flag_status usart_interrupt_flag_get(usart_type* usart_x, uint32_t flag)
597{
598 flag_status int_status = RESET;
599
600 switch(flag)
601 {
602 case USART_CTSCF_FLAG:
603 int_status = (flag_status)usart_x->ctrl3_bit.ctscfien;
604 break;
605 case USART_BFF_FLAG:
606 int_status = (flag_status)usart_x->ctrl2_bit.bfien;
607 break;
608 case USART_TDBE_FLAG:
609 int_status = (flag_status)usart_x->ctrl1_bit.tdbeien;
610 break;
611 case USART_TDC_FLAG:
612 int_status = (flag_status)usart_x->ctrl1_bit.tdcien;
613 break;
614 case USART_RDBF_FLAG:
615 int_status = (flag_status)usart_x->ctrl1_bit.rdbfien;
616 break;
617 case USART_ROERR_FLAG:
618 int_status = (flag_status)(usart_x->ctrl1_bit.rdbfien || usart_x->ctrl3_bit.errien);
619 break;
620 case USART_IDLEF_FLAG:
621 int_status = (flag_status)usart_x->ctrl1_bit.idleien;
622 break;
623 case USART_NERR_FLAG:
624 case USART_FERR_FLAG:
625 int_status = (flag_status)usart_x->ctrl3_bit.errien;
626 break;
627 case USART_PERR_FLAG:
628 int_status = (flag_status)usart_x->ctrl1_bit.perrien;
629 break;
630 default:
631 int_status = RESET;
632 break;
633 }
634
635 if(int_status != SET)
636 {
637 return RESET;
638 }
639
640 if(usart_x->sts & flag)
641 {
642 return SET;
643 }
644 else
645 {
646 return RESET;
647 }
648}
649
675void usart_flag_clear(usart_type* usart_x, uint32_t flag)
676{
677 if(flag & (USART_PERR_FLAG | USART_FERR_FLAG | USART_NERR_FLAG | USART_ROERR_FLAG | USART_IDLEF_FLAG | USART_RDBF_FLAG))
678 {
679 UNUSED(usart_x->sts);
680 UNUSED(usart_x->dt);
681 }
682 else
683 {
684 usart_x->sts = ~flag;
685 }
686}
687
692#endif
693
UNUSED
#define UNUSED(x)
Definition at32f413_def.h:64
crm_periph_reset
void crm_periph_reset(crm_periph_reset_type value, confirm_state new_state)
enable or disable the peripheral reset
Definition at32f413_crm.c:293
crm_clocks_freq_get
void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
Definition at32f413_crm.c:660
CRM_UART4_PERIPH_RESET
@ CRM_UART4_PERIPH_RESET
Definition at32f413_crm.h:177
CRM_USART1_PERIPH_RESET
@ CRM_USART1_PERIPH_RESET
Definition at32f413_crm.h:163
CRM_USART2_PERIPH_RESET
@ CRM_USART2_PERIPH_RESET
Definition at32f413_crm.h:175
CRM_UART5_PERIPH_RESET
@ CRM_UART5_PERIPH_RESET
Definition at32f413_crm.h:178
CRM_USART3_PERIPH_RESET
@ CRM_USART3_PERIPH_RESET
Definition at32f413_crm.h:176
PERIPH_REG
#define PERIPH_REG(periph_base, value)
Definition at32f413.h:318
PERIPH_REG_BIT
#define PERIPH_REG_BIT(value)
Definition at32f413.h:319
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
flag_status
flag_status
flag status
Definition at32f413.h:292
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
SET
@ SET
Definition at32f413.h:292
usart_break_bit_num_type
usart_break_bit_num_type
usart break frame bit num type
Definition at32f413_usart.h:120
usart_clock_polarity_type
usart_clock_polarity_type
usart polarity of the clock type
Definition at32f413_usart.h:138
usart_hardware_flow_control_type
usart_hardware_flow_control_type
usart hardware flow control type
Definition at32f413_usart.h:167
usart_stop_bit_num_type
usart_stop_bit_num_type
usart stop bit num type
Definition at32f413_usart.h:156
usart_data_bit_num_type
usart_data_bit_num_type
usart data bit num type
Definition at32f413_usart.h:111
usart_parity_selection_type
usart_parity_selection_type
usart parity selection type
Definition at32f413_usart.h:92
usart_lbcp_type
usart_lbcp_type
usart last bit clock pulse type
Definition at32f413_usart.h:147
usart_wakeup_mode_type
usart_wakeup_mode_type
usart wakeup mode type
Definition at32f413_usart.h:102
usart_clock_phase_type
usart_clock_phase_type
usart phase of the clock type
Definition at32f413_usart.h:129
USART_HARDWARE_FLOW_CTS
@ USART_HARDWARE_FLOW_CTS
Definition at32f413_usart.h:170
USART_HARDWARE_FLOW_RTS
@ USART_HARDWARE_FLOW_RTS
Definition at32f413_usart.h:169
USART_HARDWARE_FLOW_NONE
@ USART_HARDWARE_FLOW_NONE
Definition at32f413_usart.h:168
USART_HARDWARE_FLOW_RTS_CTS
@ USART_HARDWARE_FLOW_RTS_CTS
Definition at32f413_usart.h:171
USART_PARITY_ODD
@ USART_PARITY_ODD
Definition at32f413_usart.h:95
USART_PARITY_EVEN
@ USART_PARITY_EVEN
Definition at32f413_usart.h:94
USART_PARITY_NONE
@ USART_PARITY_NONE
Definition at32f413_usart.h:93
USART_CTSCF_FLAG
#define USART_CTSCF_FLAG
Definition at32f413_usart.h:60
USART_NERR_FLAG
#define USART_NERR_FLAG
Definition at32f413_usart.h:53
USART_FERR_FLAG
#define USART_FERR_FLAG
Definition at32f413_usart.h:52
USART_IDLEF_FLAG
#define USART_IDLEF_FLAG
Definition at32f413_usart.h:55
USART_ROERR_FLAG
#define USART_ROERR_FLAG
Definition at32f413_usart.h:54
USART_TDBE_FLAG
#define USART_TDBE_FLAG
Definition at32f413_usart.h:58
USART_TDC_FLAG
#define USART_TDC_FLAG
Definition at32f413_usart.h:57
USART_PERR_FLAG
#define USART_PERR_FLAG
Definition at32f413_usart.h:51
USART_RDBF_FLAG
#define USART_RDBF_FLAG
Definition at32f413_usart.h:56
USART_BFF_FLAG
#define USART_BFF_FLAG
Definition at32f413_usart.h:59
usart_clock_enable
void usart_clock_enable(usart_type *usart_x, confirm_state new_state)
usart enable the ck pin.
Definition at32f413_usart.c:239
usart_smartcard_nack_set
void usart_smartcard_nack_set(usart_type *usart_x, confirm_state new_state)
enable or disable nack transmission in smartcard mode.
Definition at32f413_usart.c:462
usart_clock_config
void usart_clock_config(usart_type *usart_x, usart_clock_polarity_type clk_pol, usart_clock_phase_type clk_pha, usart_lbcp_type clk_lb)
usart clock config.
Definition at32f413_usart.c:223
usart_data_transmit
void usart_data_transmit(usart_type *usart_x, uint16_t data)
transmit single data through the usart peripheral.
Definition at32f413_usart.c:380
usart_parity_selection_config
void usart_parity_selection_config(usart_type *usart_x, usart_parity_selection_type parity)
usart parity selection config.
Definition at32f413_usart.c:144
usart_flag_get
flag_status usart_flag_get(usart_type *usart_x, uint32_t flag)
check whether the specified usart flag is set or not.
Definition at32f413_usart.c:565
usart_wakeup_id_set
void usart_wakeup_id_set(usart_type *usart_x, uint8_t usart_id)
set the wakeup id of the usart.
Definition at32f413_usart.c:307
usart_reset
void usart_reset(usart_type *usart_x)
deinitialize the usart peripheral registers to their default reset values.
Definition at32f413_usart.c:51
usart_lin_mode_enable
void usart_lin_mode_enable(usart_type *usart_x, confirm_state new_state)
enable or disable the usart lin mode.
Definition at32f413_usart.c:367
usart_transmitter_enable
void usart_transmitter_enable(usart_type *usart_x, confirm_state new_state)
usart transmitter enable.
Definition at32f413_usart.c:185
usart_dma_receiver_enable
void usart_dma_receiver_enable(usart_type *usart_x, confirm_state new_state)
enable or disable the usart's dma receiver interface.
Definition at32f413_usart.c:294
usart_irda_low_power_enable
void usart_irda_low_power_enable(usart_type *usart_x, confirm_state new_state)
configure the usart's irda low power.
Definition at32f413_usart.c:504
usart_break_send
void usart_break_send(usart_type *usart_x)
transmit break characters.
Definition at32f413_usart.c:404
usart_init
void usart_init(usart_type *usart_x, uint32_t baud_rate, usart_data_bit_num_type data_bit, usart_stop_bit_num_type stop_bit)
initialize the usart peripheral according to the specified parameters.
Definition at32f413_usart.c:105
usart_irda_smartcard_division_set
void usart_irda_smartcard_division_set(usart_type *usart_x, uint8_t div_val)
config the irda/smartcard division.
Definition at32f413_usart.c:432
usart_enable
void usart_enable(usart_type *usart_x, confirm_state new_state)
enable or disable the specified usart peripheral.
Definition at32f413_usart.c:172
usart_receiver_enable
void usart_receiver_enable(usart_type *usart_x, confirm_state new_state)
usart receiver enable.
Definition at32f413_usart.c:198
usart_smartcard_guard_time_set
void usart_smartcard_guard_time_set(usart_type *usart_x, uint8_t guard_time_val)
config the specified usart smartcard guard time.
Definition at32f413_usart.c:418
usart_flag_clear
void usart_flag_clear(usart_type *usart_x, uint32_t flag)
clear the usart's pending flags.
Definition at32f413_usart.c:675
usart_wakeup_mode_set
void usart_wakeup_mode_set(usart_type *usart_x, usart_wakeup_mode_type wakeup_mode)
select the usart wakeup method in multi-processor communication.
Definition at32f413_usart.c:323
usart_irda_mode_enable
void usart_irda_mode_enable(usart_type *usart_x, confirm_state new_state)
enable or disable the usart's irda interface.
Definition at32f413_usart.c:490
usart_break_bit_num_set
void usart_break_bit_num_set(usart_type *usart_x, usart_break_bit_num_type break_bit)
set the usart break frame bit num.
Definition at32f413_usart.c:353
usart_hardware_flow_control_set
void usart_hardware_flow_control_set(usart_type *usart_x, usart_hardware_flow_control_type flow_state)
configure the usart's hardware flow control.
Definition at32f413_usart.c:522
usart_interrupt_enable
void usart_interrupt_enable(usart_type *usart_x, uint32_t usart_int, confirm_state new_state)
enable or disable the specified usart interrupts.
Definition at32f413_usart.c:263
usart_data_receive
uint16_t usart_data_receive(usart_type *usart_x)
return the most recent received data by the usart peripheral.
Definition at32f413_usart.c:392
usart_single_line_halfduplex_select
void usart_single_line_halfduplex_select(usart_type *usart_x, confirm_state new_state)
enable or disable the usart single line bidirectional half-duplex communication.
Definition at32f413_usart.c:476
usart_dma_transmitter_enable
void usart_dma_transmitter_enable(usart_type *usart_x, confirm_state new_state)
enable or disable the usart's dma transmitter interface.
Definition at32f413_usart.c:280
usart_interrupt_flag_get
flag_status usart_interrupt_flag_get(usart_type *usart_x, uint32_t flag)
check whether the specified usart interrupt flag is set or not.
Definition at32f413_usart.c:596
usart_smartcard_mode_enable
void usart_smartcard_mode_enable(usart_type *usart_x, confirm_state new_state)
enable or disable the usart smart card mode.
Definition at32f413_usart.c:447
usart_receiver_mute_enable
void usart_receiver_mute_enable(usart_type *usart_x, confirm_state new_state)
config the usart in mute mode in multi-processor communication.
Definition at32f413_usart.c:337
USART1
#define USART1
Definition at32f413_usart.h:318
USART2
#define USART2
Definition at32f413_usart.h:319
at32f413_conf.h
at32f413 config header file
crm_clocks_freq_type
crm clocks freqency structure
Definition at32f413_crm.h:470
crm_clocks_freq_type::apb1_freq
uint32_t apb1_freq
Definition at32f413_crm.h:474
crm_clocks_freq_type::apb2_freq
uint32_t apb2_freq
Definition at32f413_crm.h:473
usart_type
type define usart register all
Definition at32f413_usart.h:178
usart_type::scmen
__IO uint32_t scmen
Definition at32f413_usart.h:289
usart_type::tdcien
__IO uint32_t tdcien
Definition at32f413_usart.h:241
usart_type::scgt
__IO uint32_t scgt
Definition at32f413_usart.h:308
usart_type::clken
__IO uint32_t clken
Definition at32f413_usart.h:269
usart_type::linen
__IO uint32_t linen
Definition at32f413_usart.h:271
usart_type::psel
__IO uint32_t psel
Definition at32f413_usart.h:244
usart_type::rdbfien
__IO uint32_t rdbfien
Definition at32f413_usart.h:240
usart_type::sbf
__IO uint32_t sbf
Definition at32f413_usart.h:235
usart_type::slben
__IO uint32_t slben
Definition at32f413_usart.h:287
usart_type::tdbeien
__IO uint32_t tdbeien
Definition at32f413_usart.h:242
usart_type::gdiv_bit
struct usart_type::@725::@733 gdiv_bit
usart_type::isdiv
__IO uint32_t isdiv
Definition at32f413_usart.h:307
usart_type::id
__IO uint32_t id
Definition at32f413_usart.h:261
usart_type::ctrl3_bit
struct usart_type::@723::@732 ctrl3_bit
usart_type::wum
__IO uint32_t wum
Definition at32f413_usart.h:246
usart_type::ctrl1_bit
struct usart_type::@719::@730 ctrl1_bit
usart_type::pen
__IO uint32_t pen
Definition at32f413_usart.h:245
usart_type::scnacken
__IO uint32_t scnacken
Definition at32f413_usart.h:288
usart_type::ctscfien
__IO uint32_t ctscfien
Definition at32f413_usart.h:294
usart_type::ctsen
__IO uint32_t ctsen
Definition at32f413_usart.h:293
usart_type::baudr_bit
struct usart_type::@717::@729 baudr_bit
usart_type::uen
__IO uint32_t uen
Definition at32f413_usart.h:248
usart_type::dbn
__IO uint32_t dbn
Definition at32f413_usart.h:247
usart_type::rm
__IO uint32_t rm
Definition at32f413_usart.h:236
usart_type::clkpha
__IO uint32_t clkpha
Definition at32f413_usart.h:267
usart_type::clkpol
__IO uint32_t clkpol
Definition at32f413_usart.h:268
usart_type::rtsen
__IO uint32_t rtsen
Definition at32f413_usart.h:292
usart_type::dmaren
__IO uint32_t dmaren
Definition at32f413_usart.h:290
usart_type::lbcp
__IO uint32_t lbcp
Definition at32f413_usart.h:266
usart_type::dmaten
__IO uint32_t dmaten
Definition at32f413_usart.h:291
usart_type::sts
__IO uint32_t sts
Definition at32f413_usart.h:184
usart_type::ren
__IO uint32_t ren
Definition at32f413_usart.h:237
usart_type::errien
__IO uint32_t errien
Definition at32f413_usart.h:284
usart_type::irdaen
__IO uint32_t irdaen
Definition at32f413_usart.h:285
usart_type::ten
__IO uint32_t ten
Definition at32f413_usart.h:238
usart_type::div
__IO uint32_t div
Definition at32f413_usart.h:222
usart_type::stopbn
__IO uint32_t stopbn
Definition at32f413_usart.h:270
usart_type::irdalp
__IO uint32_t irdalp
Definition at32f413_usart.h:286
usart_type::dt
__IO uint32_t dt
Definition at32f413_usart.h:206
usart_type::perrien
__IO uint32_t perrien
Definition at32f413_usart.h:243
usart_type::bfien
__IO uint32_t bfien
Definition at32f413_usart.h:264
usart_type::bfbn
__IO uint32_t bfbn
Definition at32f413_usart.h:263
usart_type::idleien
__IO uint32_t idleien
Definition at32f413_usart.h:239
usart_type::ctrl2_bit
struct usart_type::@721::@731 ctrl2_bit


AT32F413 Firmwary Library: at32f413_usart.h Source File

  • libraries
  • drivers
  • inc
at32f413_usart.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_USART_H
28#define __AT32F413_USART_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34
35/* includes ------------------------------------------------------------------*/
36#include "at32f413.h"
37
51#define USART_PERR_FLAG ((uint32_t)0x00000001)
52#define USART_FERR_FLAG ((uint32_t)0x00000002)
53#define USART_NERR_FLAG ((uint32_t)0x00000004)
54#define USART_ROERR_FLAG ((uint32_t)0x00000008)
55#define USART_IDLEF_FLAG ((uint32_t)0x00000010)
56#define USART_RDBF_FLAG ((uint32_t)0x00000020)
57#define USART_TDC_FLAG ((uint32_t)0x00000040)
58#define USART_TDBE_FLAG ((uint32_t)0x00000080)
59#define USART_BFF_FLAG ((uint32_t)0x00000100)
60#define USART_CTSCF_FLAG ((uint32_t)0x00000200)
71#define USART_IDLE_INT MAKE_VALUE(0x0C,0x04)
72#define USART_RDBF_INT MAKE_VALUE(0x0C,0x05)
73#define USART_TDC_INT MAKE_VALUE(0x0C,0x06)
74#define USART_TDBE_INT MAKE_VALUE(0x0C,0x07)
75#define USART_PERR_INT MAKE_VALUE(0x0C,0x08)
76#define USART_BF_INT MAKE_VALUE(0x10,0x06)
77#define USART_ERR_INT MAKE_VALUE(0x14,0x00)
78#define USART_CTSCF_INT MAKE_VALUE(0x14,0x0A)
91typedef enum
92{
93 USART_PARITY_NONE = 0x00,
94 USART_PARITY_EVEN = 0x01,
95 USART_PARITY_ODD = 0x02
96} usart_parity_selection_type;
97
101typedef enum
102{
103 USART_WAKEUP_BY_IDLE_FRAME = 0x00,
104 USART_WAKEUP_BY_MATCHING_ID = 0x01
105} usart_wakeup_mode_type;
106
110typedef enum
111{
112 USART_DATA_8BITS = 0x00,
113 USART_DATA_9BITS = 0x01
114} usart_data_bit_num_type;
115
119typedef enum
120{
121 USART_BREAK_10BITS = 0x00,
122 USART_BREAK_11BITS = 0x01
123} usart_break_bit_num_type;
124
128typedef enum
129{
130 USART_CLOCK_PHASE_1EDGE = 0x00,
131 USART_CLOCK_PHASE_2EDGE = 0x01
132} usart_clock_phase_type;
133
137typedef enum
138{
139 USART_CLOCK_POLARITY_LOW = 0x00,
140 USART_CLOCK_POLARITY_HIGH = 0x01
141} usart_clock_polarity_type;
142
146typedef enum
147{
148 USART_CLOCK_LAST_BIT_NONE = 0x00,
149 USART_CLOCK_LAST_BIT_OUTPUT = 0x01
150} usart_lbcp_type;
151
155typedef enum
156{
157 USART_STOP_1_BIT = 0x00,
158 USART_STOP_0_5_BIT = 0x01,
159 USART_STOP_2_BIT = 0x02,
160 USART_STOP_1_5_BIT = 0x03
161} usart_stop_bit_num_type;
162
166typedef enum
167{
168 USART_HARDWARE_FLOW_NONE = 0x00,
169 USART_HARDWARE_FLOW_RTS = 0x01,
170 USART_HARDWARE_FLOW_CTS = 0x02,
171 USART_HARDWARE_FLOW_RTS_CTS = 0x03
172} usart_hardware_flow_control_type;
173
177typedef struct
178{
182 union
183 {
184 __IO uint32_t sts;
185 struct
186 {
187 __IO uint32_t perr : 1; /* [0] */
188 __IO uint32_t ferr : 1; /* [1] */
189 __IO uint32_t nerr : 1; /* [2] */
190 __IO uint32_t roerr : 1; /* [3] */
191 __IO uint32_t idlef : 1; /* [4] */
192 __IO uint32_t rdbf : 1; /* [5] */
193 __IO uint32_t tdc : 1; /* [6] */
194 __IO uint32_t tdbe : 1; /* [7] */
195 __IO uint32_t bff : 1; /* [8] */
196 __IO uint32_t ctscf : 1; /* [9] */
197 __IO uint32_t reserved1 : 22;/* [31:10] */
198 } sts_bit;
199 };
200
204 union
205 {
206 __IO uint32_t dt;
207 struct
208 {
209 __IO uint32_t dt : 9; /* [8:0] */
210 __IO uint32_t reserved1 : 23;/* [31:9] */
211 } dt_bit;
212 };
213
217 union
218 {
219 __IO uint32_t baudr;
220 struct
221 {
222 __IO uint32_t div : 16;/* [15:0] */
223 __IO uint32_t reserved1 : 16;/* [31:16] */
224 } baudr_bit;
225 };
226
230 union
231 {
232 __IO uint32_t ctrl1;
233 struct
234 {
235 __IO uint32_t sbf : 1; /* [0] */
236 __IO uint32_t rm : 1; /* [1] */
237 __IO uint32_t ren : 1; /* [2] */
238 __IO uint32_t ten : 1; /* [3] */
239 __IO uint32_t idleien : 1; /* [4] */
240 __IO uint32_t rdbfien : 1; /* [5] */
241 __IO uint32_t tdcien : 1; /* [6] */
242 __IO uint32_t tdbeien : 1; /* [7] */
243 __IO uint32_t perrien : 1; /* [8] */
244 __IO uint32_t psel : 1; /* [9] */
245 __IO uint32_t pen : 1; /* [10] */
246 __IO uint32_t wum : 1; /* [11] */
247 __IO uint32_t dbn : 1; /* [12] */
248 __IO uint32_t uen : 1; /* [13] */
249 __IO uint32_t reserved1 : 18;/* [31:14] */
250 } ctrl1_bit;
251 };
252
256 union
257 {
258 __IO uint32_t ctrl2;
259 struct
260 {
261 __IO uint32_t id : 4; /* [3:0] */
262 __IO uint32_t reserved1 : 1; /* [4] */
263 __IO uint32_t bfbn : 1; /* [5] */
264 __IO uint32_t bfien : 1; /* [6] */
265 __IO uint32_t reserved2 : 1; /* [7] */
266 __IO uint32_t lbcp : 1; /* [8] */
267 __IO uint32_t clkpha : 1; /* [9] */
268 __IO uint32_t clkpol : 1; /* [10] */
269 __IO uint32_t clken : 1; /* [11] */
270 __IO uint32_t stopbn : 2; /* [13:12] */
271 __IO uint32_t linen : 1; /* [14] */
272 __IO uint32_t reserved3 : 17;/* [31:15] */
273 } ctrl2_bit;
274 };
275
279 union
280 {
281 __IO uint32_t ctrl3;
282 struct
283 {
284 __IO uint32_t errien : 1; /* [0] */
285 __IO uint32_t irdaen : 1; /* [1] */
286 __IO uint32_t irdalp : 1; /* [2] */
287 __IO uint32_t slben : 1; /* [3] */
288 __IO uint32_t scnacken : 1; /* [4] */
289 __IO uint32_t scmen : 1; /* [5] */
290 __IO uint32_t dmaren : 1; /* [6] */
291 __IO uint32_t dmaten : 1; /* [7] */
292 __IO uint32_t rtsen : 1; /* [8] */
293 __IO uint32_t ctsen : 1; /* [9] */
294 __IO uint32_t ctscfien : 1; /* [10] */
295 __IO uint32_t reserved1 : 21;/* [31:11] */
296 } ctrl3_bit;
297 };
298
302 union
303 {
304 __IO uint32_t gdiv;
305 struct
306 {
307 __IO uint32_t isdiv : 8; /* [7:0] */
308 __IO uint32_t scgt : 8; /* [15:8] */
309 __IO uint32_t reserved1 : 16;/* [31:16] */
310 } gdiv_bit;
311 };
312} usart_type;
313
318#define USART1 ((usart_type *) USART1_BASE)
319#define USART2 ((usart_type *) USART2_BASE)
320#if defined (AT32F413Rx) || defined (AT32F413Cx) || defined (AT32FEBKC8T7)
321#define USART3 ((usart_type *) USART3_BASE)
322#endif
323#if defined (AT32F413Rx)
324#define UART4 ((usart_type *) UART4_BASE)
325#define UART5 ((usart_type *) UART5_BASE)
326#endif
327
332void usart_reset(usart_type* usart_x);
333void usart_init(usart_type* usart_x, uint32_t baud_rate, usart_data_bit_num_type data_bit, usart_stop_bit_num_type stop_bit);
334void usart_parity_selection_config(usart_type* usart_x, usart_parity_selection_type parity);
335void usart_enable(usart_type* usart_x, confirm_state new_state);
336void usart_transmitter_enable(usart_type* usart_x, confirm_state new_state);
337void usart_receiver_enable(usart_type* usart_x, confirm_state new_state);
338void usart_clock_config(usart_type* usart_x, usart_clock_polarity_type clk_pol, usart_clock_phase_type clk_pha, usart_lbcp_type clk_lb);
339void usart_clock_enable(usart_type* usart_x, confirm_state new_state);
340void usart_interrupt_enable(usart_type* usart_x, uint32_t usart_int, confirm_state new_state);
341void usart_dma_transmitter_enable(usart_type* usart_x, confirm_state new_state);
342void usart_dma_receiver_enable(usart_type* usart_x, confirm_state new_state);
343void usart_wakeup_id_set(usart_type* usart_x, uint8_t usart_id);
344void usart_wakeup_mode_set(usart_type* usart_x, usart_wakeup_mode_type wakeup_mode);
345void usart_receiver_mute_enable(usart_type* usart_x, confirm_state new_state);
346void usart_break_bit_num_set(usart_type* usart_x, usart_break_bit_num_type break_bit);
347void usart_lin_mode_enable(usart_type* usart_x, confirm_state new_state);
348void usart_data_transmit(usart_type* usart_x, uint16_t data);
349uint16_t usart_data_receive(usart_type* usart_x);
350void usart_break_send(usart_type* usart_x);
351void usart_smartcard_guard_time_set(usart_type* usart_x, uint8_t guard_time_val);
352void usart_irda_smartcard_division_set(usart_type* usart_x, uint8_t div_val);
353void usart_smartcard_mode_enable(usart_type* usart_x, confirm_state new_state);
354void usart_smartcard_nack_set(usart_type* usart_x, confirm_state new_state);
355void usart_single_line_halfduplex_select(usart_type* usart_x, confirm_state new_state);
356void usart_irda_mode_enable(usart_type* usart_x, confirm_state new_state);
357void usart_irda_low_power_enable(usart_type* usart_x, confirm_state new_state);
358void usart_hardware_flow_control_set(usart_type* usart_x,usart_hardware_flow_control_type flow_state);
359 flag_status usart_flag_get(usart_type* usart_x, uint32_t flag);
360 flag_status usart_interrupt_flag_get(usart_type* usart_x, uint32_t flag);
361void usart_flag_clear(usart_type* usart_x, uint32_t flag);
362
375#ifdef __cplusplus
376}
377#endif
378
379#endif
at32f413.h
at32f413 header file
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
flag_status
flag_status
flag status
Definition at32f413.h:292
usart_clock_enable
void usart_clock_enable(usart_type *usart_x, confirm_state new_state)
usart enable the ck pin.
Definition at32f413_usart.c:239
usart_smartcard_nack_set
void usart_smartcard_nack_set(usart_type *usart_x, confirm_state new_state)
enable or disable nack transmission in smartcard mode.
Definition at32f413_usart.c:462
usart_clock_config
void usart_clock_config(usart_type *usart_x, usart_clock_polarity_type clk_pol, usart_clock_phase_type clk_pha, usart_lbcp_type clk_lb)
usart clock config.
Definition at32f413_usart.c:223
usart_data_transmit
void usart_data_transmit(usart_type *usart_x, uint16_t data)
transmit single data through the usart peripheral.
Definition at32f413_usart.c:380
usart_parity_selection_config
void usart_parity_selection_config(usart_type *usart_x, usart_parity_selection_type parity)
usart parity selection config.
Definition at32f413_usart.c:144
usart_flag_get
flag_status usart_flag_get(usart_type *usart_x, uint32_t flag)
check whether the specified usart flag is set or not.
Definition at32f413_usart.c:565
usart_wakeup_id_set
void usart_wakeup_id_set(usart_type *usart_x, uint8_t usart_id)
set the wakeup id of the usart.
Definition at32f413_usart.c:307
usart_reset
void usart_reset(usart_type *usart_x)
deinitialize the usart peripheral registers to their default reset values.
Definition at32f413_usart.c:51
usart_lin_mode_enable
void usart_lin_mode_enable(usart_type *usart_x, confirm_state new_state)
enable or disable the usart lin mode.
Definition at32f413_usart.c:367
usart_transmitter_enable
void usart_transmitter_enable(usart_type *usart_x, confirm_state new_state)
usart transmitter enable.
Definition at32f413_usart.c:185
usart_dma_receiver_enable
void usart_dma_receiver_enable(usart_type *usart_x, confirm_state new_state)
enable or disable the usart's dma receiver interface.
Definition at32f413_usart.c:294
usart_irda_low_power_enable
void usart_irda_low_power_enable(usart_type *usart_x, confirm_state new_state)
configure the usart's irda low power.
Definition at32f413_usart.c:504
usart_break_send
void usart_break_send(usart_type *usart_x)
transmit break characters.
Definition at32f413_usart.c:404
usart_init
void usart_init(usart_type *usart_x, uint32_t baud_rate, usart_data_bit_num_type data_bit, usart_stop_bit_num_type stop_bit)
initialize the usart peripheral according to the specified parameters.
Definition at32f413_usart.c:105
usart_irda_smartcard_division_set
void usart_irda_smartcard_division_set(usart_type *usart_x, uint8_t div_val)
config the irda/smartcard division.
Definition at32f413_usart.c:432
usart_enable
void usart_enable(usart_type *usart_x, confirm_state new_state)
enable or disable the specified usart peripheral.
Definition at32f413_usart.c:172
usart_receiver_enable
void usart_receiver_enable(usart_type *usart_x, confirm_state new_state)
usart receiver enable.
Definition at32f413_usart.c:198
usart_smartcard_guard_time_set
void usart_smartcard_guard_time_set(usart_type *usart_x, uint8_t guard_time_val)
config the specified usart smartcard guard time.
Definition at32f413_usart.c:418
usart_flag_clear
void usart_flag_clear(usart_type *usart_x, uint32_t flag)
clear the usart's pending flags.
Definition at32f413_usart.c:675
usart_wakeup_mode_set
void usart_wakeup_mode_set(usart_type *usart_x, usart_wakeup_mode_type wakeup_mode)
select the usart wakeup method in multi-processor communication.
Definition at32f413_usart.c:323
usart_irda_mode_enable
void usart_irda_mode_enable(usart_type *usart_x, confirm_state new_state)
enable or disable the usart's irda interface.
Definition at32f413_usart.c:490
usart_break_bit_num_set
void usart_break_bit_num_set(usart_type *usart_x, usart_break_bit_num_type break_bit)
set the usart break frame bit num.
Definition at32f413_usart.c:353
usart_hardware_flow_control_set
void usart_hardware_flow_control_set(usart_type *usart_x, usart_hardware_flow_control_type flow_state)
configure the usart's hardware flow control.
Definition at32f413_usart.c:522
usart_interrupt_enable
void usart_interrupt_enable(usart_type *usart_x, uint32_t usart_int, confirm_state new_state)
enable or disable the specified usart interrupts.
Definition at32f413_usart.c:263
usart_data_receive
uint16_t usart_data_receive(usart_type *usart_x)
return the most recent received data by the usart peripheral.
Definition at32f413_usart.c:392
usart_single_line_halfduplex_select
void usart_single_line_halfduplex_select(usart_type *usart_x, confirm_state new_state)
enable or disable the usart single line bidirectional half-duplex communication.
Definition at32f413_usart.c:476
usart_dma_transmitter_enable
void usart_dma_transmitter_enable(usart_type *usart_x, confirm_state new_state)
enable or disable the usart's dma transmitter interface.
Definition at32f413_usart.c:280
usart_interrupt_flag_get
flag_status usart_interrupt_flag_get(usart_type *usart_x, uint32_t flag)
check whether the specified usart interrupt flag is set or not.
Definition at32f413_usart.c:596
usart_smartcard_mode_enable
void usart_smartcard_mode_enable(usart_type *usart_x, confirm_state new_state)
enable or disable the usart smart card mode.
Definition at32f413_usart.c:447
usart_receiver_mute_enable
void usart_receiver_mute_enable(usart_type *usart_x, confirm_state new_state)
config the usart in mute mode in multi-processor communication.
Definition at32f413_usart.c:337
usart_break_bit_num_type
usart_break_bit_num_type
usart break frame bit num type
Definition at32f413_usart.h:120
usart_clock_polarity_type
usart_clock_polarity_type
usart polarity of the clock type
Definition at32f413_usart.h:138
usart_hardware_flow_control_type
usart_hardware_flow_control_type
usart hardware flow control type
Definition at32f413_usart.h:167
usart_stop_bit_num_type
usart_stop_bit_num_type
usart stop bit num type
Definition at32f413_usart.h:156
usart_data_bit_num_type
usart_data_bit_num_type
usart data bit num type
Definition at32f413_usart.h:111
usart_parity_selection_type
usart_parity_selection_type
usart parity selection type
Definition at32f413_usart.h:92
usart_lbcp_type
usart_lbcp_type
usart last bit clock pulse type
Definition at32f413_usart.h:147
usart_wakeup_mode_type
usart_wakeup_mode_type
usart wakeup mode type
Definition at32f413_usart.h:102
usart_clock_phase_type
usart_clock_phase_type
usart phase of the clock type
Definition at32f413_usart.h:129
USART_BREAK_11BITS
@ USART_BREAK_11BITS
Definition at32f413_usart.h:122
USART_BREAK_10BITS
@ USART_BREAK_10BITS
Definition at32f413_usart.h:121
USART_CLOCK_POLARITY_HIGH
@ USART_CLOCK_POLARITY_HIGH
Definition at32f413_usart.h:140
USART_CLOCK_POLARITY_LOW
@ USART_CLOCK_POLARITY_LOW
Definition at32f413_usart.h:139
USART_HARDWARE_FLOW_CTS
@ USART_HARDWARE_FLOW_CTS
Definition at32f413_usart.h:170
USART_HARDWARE_FLOW_RTS
@ USART_HARDWARE_FLOW_RTS
Definition at32f413_usart.h:169
USART_HARDWARE_FLOW_NONE
@ USART_HARDWARE_FLOW_NONE
Definition at32f413_usart.h:168
USART_HARDWARE_FLOW_RTS_CTS
@ USART_HARDWARE_FLOW_RTS_CTS
Definition at32f413_usart.h:171
USART_STOP_1_5_BIT
@ USART_STOP_1_5_BIT
Definition at32f413_usart.h:160
USART_STOP_1_BIT
@ USART_STOP_1_BIT
Definition at32f413_usart.h:157
USART_STOP_0_5_BIT
@ USART_STOP_0_5_BIT
Definition at32f413_usart.h:158
USART_STOP_2_BIT
@ USART_STOP_2_BIT
Definition at32f413_usart.h:159
USART_DATA_9BITS
@ USART_DATA_9BITS
Definition at32f413_usart.h:113
USART_DATA_8BITS
@ USART_DATA_8BITS
Definition at32f413_usart.h:112
USART_PARITY_ODD
@ USART_PARITY_ODD
Definition at32f413_usart.h:95
USART_PARITY_EVEN
@ USART_PARITY_EVEN
Definition at32f413_usart.h:94
USART_PARITY_NONE
@ USART_PARITY_NONE
Definition at32f413_usart.h:93
USART_CLOCK_LAST_BIT_OUTPUT
@ USART_CLOCK_LAST_BIT_OUTPUT
Definition at32f413_usart.h:149
USART_CLOCK_LAST_BIT_NONE
@ USART_CLOCK_LAST_BIT_NONE
Definition at32f413_usart.h:148
USART_WAKEUP_BY_MATCHING_ID
@ USART_WAKEUP_BY_MATCHING_ID
Definition at32f413_usart.h:104
USART_WAKEUP_BY_IDLE_FRAME
@ USART_WAKEUP_BY_IDLE_FRAME
Definition at32f413_usart.h:103
USART_CLOCK_PHASE_1EDGE
@ USART_CLOCK_PHASE_1EDGE
Definition at32f413_usart.h:130
USART_CLOCK_PHASE_2EDGE
@ USART_CLOCK_PHASE_2EDGE
Definition at32f413_usart.h:131
usart_type
type define usart register all
Definition at32f413_usart.h:178
usart_type::scmen
__IO uint32_t scmen
Definition at32f413_usart.h:289
usart_type::ctrl2
__IO uint32_t ctrl2
Definition at32f413_usart.h:258
usart_type::tdcien
__IO uint32_t tdcien
Definition at32f413_usart.h:241
usart_type::reserved1
__IO uint32_t reserved1
Definition at32f413_usart.h:197
usart_type::ctrl3
__IO uint32_t ctrl3
Definition at32f413_usart.h:281
usart_type::scgt
__IO uint32_t scgt
Definition at32f413_usart.h:308
usart_type::clken
__IO uint32_t clken
Definition at32f413_usart.h:269
usart_type::linen
__IO uint32_t linen
Definition at32f413_usart.h:271
usart_type::rdbf
__IO uint32_t rdbf
Definition at32f413_usart.h:192
usart_type::psel
__IO uint32_t psel
Definition at32f413_usart.h:244
usart_type::rdbfien
__IO uint32_t rdbfien
Definition at32f413_usart.h:240
usart_type::sbf
__IO uint32_t sbf
Definition at32f413_usart.h:235
usart_type::slben
__IO uint32_t slben
Definition at32f413_usart.h:287
usart_type::tdbeien
__IO uint32_t tdbeien
Definition at32f413_usart.h:242
usart_type::isdiv
__IO uint32_t isdiv
Definition at32f413_usart.h:307
usart_type::baudr
__IO uint32_t baudr
Definition at32f413_usart.h:219
usart_type::ferr
__IO uint32_t ferr
Definition at32f413_usart.h:188
usart_type::id
__IO uint32_t id
Definition at32f413_usart.h:261
usart_type::wum
__IO uint32_t wum
Definition at32f413_usart.h:246
usart_type::pen
__IO uint32_t pen
Definition at32f413_usart.h:245
usart_type::scnacken
__IO uint32_t scnacken
Definition at32f413_usart.h:288
usart_type::roerr
__IO uint32_t roerr
Definition at32f413_usart.h:190
usart_type::ctscfien
__IO uint32_t ctscfien
Definition at32f413_usart.h:294
usart_type::gdiv
__IO uint32_t gdiv
Definition at32f413_usart.h:304
usart_type::ctrl1
__IO uint32_t ctrl1
Definition at32f413_usart.h:232
usart_type::ctsen
__IO uint32_t ctsen
Definition at32f413_usart.h:293
usart_type::uen
__IO uint32_t uen
Definition at32f413_usart.h:248
usart_type::idlef
__IO uint32_t idlef
Definition at32f413_usart.h:191
usart_type::dbn
__IO uint32_t dbn
Definition at32f413_usart.h:247
usart_type::rm
__IO uint32_t rm
Definition at32f413_usart.h:236
usart_type::tdbe
__IO uint32_t tdbe
Definition at32f413_usart.h:194
usart_type::clkpha
__IO uint32_t clkpha
Definition at32f413_usart.h:267
usart_type::clkpol
__IO uint32_t clkpol
Definition at32f413_usart.h:268
usart_type::perr
__IO uint32_t perr
Definition at32f413_usart.h:187
usart_type::rtsen
__IO uint32_t rtsen
Definition at32f413_usart.h:292
usart_type::reserved3
__IO uint32_t reserved3
Definition at32f413_usart.h:272
usart_type::dmaren
__IO uint32_t dmaren
Definition at32f413_usart.h:290
usart_type::tdc
__IO uint32_t tdc
Definition at32f413_usart.h:193
usart_type::lbcp
__IO uint32_t lbcp
Definition at32f413_usart.h:266
usart_type::dmaten
__IO uint32_t dmaten
Definition at32f413_usart.h:291
usart_type::sts
__IO uint32_t sts
Definition at32f413_usart.h:184
usart_type::ren
__IO uint32_t ren
Definition at32f413_usart.h:237
usart_type::errien
__IO uint32_t errien
Definition at32f413_usart.h:284
usart_type::bff
__IO uint32_t bff
Definition at32f413_usart.h:195
usart_type::irdaen
__IO uint32_t irdaen
Definition at32f413_usart.h:285
usart_type::ten
__IO uint32_t ten
Definition at32f413_usart.h:238
usart_type::div
__IO uint32_t div
Definition at32f413_usart.h:222
usart_type::ctscf
__IO uint32_t ctscf
Definition at32f413_usart.h:196
usart_type::nerr
__IO uint32_t nerr
Definition at32f413_usart.h:189
usart_type::stopbn
__IO uint32_t stopbn
Definition at32f413_usart.h:270
usart_type::irdalp
__IO uint32_t irdalp
Definition at32f413_usart.h:286
usart_type::dt
__IO uint32_t dt
Definition at32f413_usart.h:206
usart_type::perrien
__IO uint32_t perrien
Definition at32f413_usart.h:243
usart_type::reserved2
__IO uint32_t reserved2
Definition at32f413_usart.h:265
usart_type::bfien
__IO uint32_t bfien
Definition at32f413_usart.h:264
usart_type::bfbn
__IO uint32_t bfbn
Definition at32f413_usart.h:263
usart_type::idleien
__IO uint32_t idleien
Definition at32f413_usart.h:239


AT32F413 Firmwary Library: at32f413_usb.c Source File

  • libraries
  • drivers
  • src
at32f413_usb.c
Go to the documentation of this file.
1
35#include "at32f413_conf.h"
36
37
38#ifdef USB_MODULE_ENABLED
39
47#define USB_ENDP_DESC_TABLE_OFFSET 0x40
48uint32_t g_usb_packet_address = USB_PACKET_BUFFER_ADDRESS;
49static uint16_t g_usb_offset_addr = USB_ENDP_DESC_TABLE_OFFSET;
50
57void usb_dev_init(usbd_type *usbx)
58{
59 /* clear usb core reset */
60 usbx->ctrl_bit.csrst = 0;
61
62 /* clear usb interrupt status */
63 usbx->intsts = 0;
64
65 /* set usb packet buffer descirption table address */
66 usbx->buftbl = USB_BUFFER_TABLE_ADDRESS;
67
68 /* enable usb core and set device address to 0 */
69 usbx->devaddr = 0x80;
70
71 usb_interrupt_enable(usbx, USB_SOF_INT | USB_RST_INT | USB_SP_INT | USB_WK_INT | USB_TC_INT, TRUE);
72}
73
80void usb_connect(usbd_type *usbx)
81{
82 /* enable usb phy */
83 usbx->ctrl_bit.disusb = 0;
84}
85
92void usb_disconnect(usbd_type *usbx)
93{
94 /* disable usb phy */
95 usbx->ctrl_bit.disusb = TRUE;
96}
97
98
115void usb_usbbufs_enable(usbd_type *usbx, confirm_state state)
116{
117 if(state == TRUE)
118 {
119 /* enable usbbufs */
120 g_usb_packet_address = USB_PACKET_BUFFER_ADDRESS_EX;
121 CRM->misc1_bit.usbbufs = TRUE;
122 }
123 else
124 {
125 /* disable usbbufs */
126 g_usb_packet_address = USB_PACKET_BUFFER_ADDRESS;
127 CRM->misc1_bit.usbbufs = FALSE;
128 }
129 UNUSED(usbx);
130}
131
139void usb_ept_open(usbd_type *usbx, usb_ept_info *ept_info)
140{
141 uint16_t type = 0;
142
143 /* set endpoint address */
144 USB_SET_EPT_ADDRESS(ept_info->eptn, ept_info->ept_address);
145
146 /* select endpoint transfer type */
147 if(ept_info->trans_type == EPT_CONTROL_TYPE)
148 {
149 type = USB_EPT_CONTROL;
150 }
151 else if(ept_info->trans_type == EPT_BULK_TYPE)
152 {
153 type = USB_EPT_BULK;
154 }
155 else if(ept_info->trans_type == EPT_INT_TYPE)
156 {
157 type = USB_EPT_INT;
158 }
159 else if(ept_info->trans_type == EPT_ISO_TYPE)
160 {
161 type = USB_EPT_ISO;
162 ept_info->is_double_buffer = TRUE;
163 }
164
165 /* configure endpoint transfer type (control, bulk, interrupt, isochronous) */
166 USB_SET_TRANS_TYPE(ept_info->eptn, type);
167
168 /* endpoint is in transfer */
169 if(ept_info->inout == DATA_TRANS_IN)
170 {
171 if(ept_info->is_double_buffer == 0)
172 {
173 /* set in endpoint tx offset address */
174 USB_SET_TX_ADDRESS(ept_info->eptn, ept_info->tx_addr);
175
176 /* clear in endpoint data toggle */
177 USB_CLEAR_TXDTS(ept_info->eptn);
178
179 /* set endpoint transmission status: nak */
180 USB_SET_TXSTS(ept_info->eptn, USB_TX_NAK);
181 }
182 else
183 {
184 /* set double buffer endpoint*/
185 USB_SET_EPT_DOUBLE_BUFFER(ept_info->eptn);
186
187 /* set in endpoint offset address0 and address1 */
188 USB_SET_DOUBLE_BUFF0_ADDRESS(ept_info->eptn, ept_info->tx_addr);
189 USB_SET_DOUBLE_BUFF1_ADDRESS(ept_info->eptn, ept_info->rx_addr);
190
191 /* clear in and out data toggle */
192 USB_CLEAR_TXDTS(ept_info->eptn);
193 USB_CLEAR_RXDTS(ept_info->eptn);
194
195 /* toggle rx data toggle flag */
196 USB_TOGGLE_RXDTS(ept_info->eptn);
197
198 /* set endpoint reception status: disable */
199 USB_SET_RXSTS(ept_info->eptn, USB_RX_DISABLE);
200
201 if(ept_info->trans_type == EPT_ISO_TYPE)
202 {
203 /* set endpoint transmision status: disable */
204 USB_SET_TXSTS(ept_info->eptn, USB_TX_DISABLE);
205 }
206 else
207 {
208 /* set endpoint transmision status: nak */
209 USB_SET_TXSTS(ept_info->eptn, USB_TX_NAK);
210 }
211 }
212 }
213 else
214 {
215 if(ept_info->is_double_buffer == 0)
216 {
217 /* set out endpoint rx offset address */
218 USB_SET_RX_ADDRESS(ept_info->eptn, ept_info->rx_addr);
219
220 /* clear out endpoint data toggle */
221 USB_CLEAR_RXDTS(ept_info->eptn);
222
223 /* set out endpoint max reception buffer size */
224 USB_SET_RXLEN(ept_info->eptn, ept_info->maxpacket);
225
226 /* set endpoint reception status: valid */
227 USB_SET_RXSTS(ept_info->eptn, USB_RX_VALID);
228 }
229 else
230 {
231 /* set double buffer endpoint */
232 USB_SET_EPT_DOUBLE_BUFFER(ept_info->eptn);
233
234 /* set out endpoint offset address0 and address1 */
235 USB_SET_DOUBLE_BUFF0_ADDRESS(ept_info->eptn, ept_info->tx_addr);
236 USB_SET_DOUBLE_BUFF1_ADDRESS(ept_info->eptn, ept_info->rx_addr);
237
238 /* set out endpoint max reception buffer size */
239 USB_SET_EPT_DOUBLE_BUF0_LEN(ept_info->eptn, ept_info->maxpacket, DATA_TRANS_OUT);
240 USB_SET_EPT_DOUBLE_BUF1_LEN(ept_info->eptn, ept_info->maxpacket, DATA_TRANS_OUT);
241
242 /* clear in and out data toggle */
243 USB_CLEAR_TXDTS(ept_info->eptn);
244 USB_CLEAR_RXDTS(ept_info->eptn);
245
246 /* toggle tx data toggle flag */
247 USB_TOGGLE_TXDTS(ept_info->eptn);
248
249 /* set endpoint reception status: valid */
250 USB_SET_RXSTS(ept_info->eptn, USB_RX_VALID);
251
252 /* set endpoint transmision status: disable */
253 USB_SET_TXSTS(ept_info->eptn, USB_TX_DISABLE);
254 }
255 }
256 UNUSED(usbx);
257}
258
259
267void usb_ept_close(usbd_type *usbx, usb_ept_info *ept_info)
268{
269 if(ept_info->is_double_buffer == 0)
270 {
271 if(ept_info->inout == DATA_TRANS_IN)
272 {
273 /*clear tx data toggle */
274 USB_CLEAR_TXDTS(ept_info->eptn);
275
276 /* set tx status: disable */
277 USB_SET_TXSTS(ept_info->eptn, USB_TX_DISABLE);
278 }
279 else
280 {
281 /*clear rx data toggle */
282 USB_CLEAR_RXDTS(ept_info->eptn);
283
284 /* set rx status: disable */
285 USB_SET_RXSTS(ept_info->eptn, USB_RX_DISABLE);
286
287 }
288 }
289 else
290 {
291 /* double buffer */
292
293 /*clear rx and tx data toggle */
294 USB_CLEAR_TXDTS(ept_info->eptn);
295 USB_CLEAR_RXDTS(ept_info->eptn);
296
297 if(ept_info->inout == DATA_TRANS_IN)
298 {
299 /* toggle tx */
300 USB_TOGGLE_TXDTS(ept_info->eptn);
301
302 /* set tx and rx status: disable */
303 USB_SET_TXSTS(ept_info->eptn, USB_TX_DISABLE);
304 USB_SET_RXSTS(ept_info->eptn, USB_RX_DISABLE);
305 }
306 else
307 {
308 /* toggle rx */
309 USB_TOGGLE_RXDTS(ept_info->eptn);
310
311 /* set tx and rx status: disable */
312 USB_SET_TXSTS(ept_info->eptn, USB_TX_DISABLE);
313 USB_SET_RXSTS(ept_info->eptn, USB_RX_DISABLE);
314 }
315 }
316 UNUSED(usbx);
317}
318
326void usb_write_packet(uint8_t *pusr_buf, uint16_t offset_addr, uint16_t nbytes)
327{
328 /* endpoint tx buffer address */
329 __IO uint16_t *d_addr = (__IO uint16_t *)(offset_addr * 2 + g_usb_packet_address);
330
331 uint32_t nhbytes = (nbytes + 1) >> 1;
332 uint32_t n_index;
333 uint16_t *pbuf = (uint16_t *)pusr_buf;
334 for(n_index = 0; n_index < nhbytes; n_index ++)
335 {
336#if defined (__ICCARM__) && (__VER__ < 7000000)
337 *d_addr++ = *(__packed uint16_t *)pbuf;
338#else
339 *d_addr++ = __UNALIGNED_UINT16_READ(pbuf);
340#endif
341 d_addr ++;
342 pbuf ++;
343 }
344}
345
353void usb_read_packet(uint8_t *pusr_buf, uint16_t offset_addr, uint16_t nbytes)
354{
355 __IO uint16_t *s_addr = (__IO uint16_t *)(offset_addr * 2 + g_usb_packet_address);
356 uint32_t nhbytes = (nbytes + 1) >> 1;
357 uint32_t n_index;
358 uint16_t *pbuf = (uint16_t *)pusr_buf;
359 for(n_index = 0; n_index < nhbytes; n_index ++)
360 {
361#if defined (__ICCARM__) && (__VER__ < 7000000)
362 *(__packed uint16_t *)pbuf = *(__IO uint16_t *)s_addr ++;
363#else
364 __UNALIGNED_UINT16_WRITE(pbuf, *(__IO uint16_t *)s_addr ++);
365#endif
366 s_addr ++;
367 pbuf ++;
368 }
369}
370
371
389void usb_interrupt_enable(usbd_type *usbx, uint16_t interrupt, confirm_state new_state)
390{
391 if(new_state == TRUE)
392 {
393 usbx->ctrl |= interrupt;
394 }
395 else
396 {
397 usbx->ctrl &= ~interrupt;
398 }
399}
400
408void usb_set_address(usbd_type *usbx, uint8_t address)
409{
410 usbx->devaddr_bit.addr = address;
411 usbx->devaddr_bit.cen = TRUE;
412}
413
421void usb_ept_stall(usbd_type *usbx, usb_ept_info *ept_info)
422{
423 if(ept_info->inout == DATA_TRANS_IN)
424 {
425 USB_SET_TXSTS(ept_info->eptn, USB_TX_STALL)
426 }
427 else
428 {
429 USB_SET_RXSTS(ept_info->eptn, USB_RX_STALL)
430 }
431 UNUSED(usbx);
432}
433
440void usb_enter_suspend(usbd_type *usbx)
441{
442 usbx->ctrl_bit.ssp = TRUE;
443 usbx->ctrl_bit.lpm = TRUE;
444}
445
452void usb_exit_suspend(usbd_type *usbx)
453{
454 usbx->ctrl_bit.ssp = FALSE;
455 usbx->ctrl_bit.lpm = FALSE;
456}
457
464void usb_remote_wkup_set(usbd_type *usbx)
465{
466 usbx->ctrl_bit.gresume = TRUE;
467}
468
475void usb_remote_wkup_clear(usbd_type *usbx)
476{
477 usbx->ctrl_bit.gresume = FALSE;
478}
479
485uint16_t usb_buffer_malloc(uint16_t maxpacket)
486{
487 uint16_t offset = g_usb_offset_addr;
488 g_usb_offset_addr += maxpacket;
489 return offset;
490}
491
497void usb_buffer_free(void)
498{
499 g_usb_offset_addr = USB_ENDP_DESC_TABLE_OFFSET;
500}
501
518 flag_status usb_flag_get(usbd_type *usbx, uint16_t flag)
519{
520 flag_status status = RESET;
521
522 if((usbx->intsts & flag) == RESET)
523 {
524 status = RESET;
525 }
526 else
527 {
528 status = SET;
529 }
530 return status;
531}
532
548 flag_status usb_interrupt_flag_get(usbd_type *usbx, uint16_t flag)
549{
550 flag_status status = RESET;
551
552 if(flag == USB_TC_FLAG)
553 {
554 if(usbx->intsts & USB_TC_FLAG)
555 status = SET;
556 }
557 else
558 {
559 if((usbx->intsts & flag) && (usbx->ctrl & flag))
560 {
561 status = SET;
562 }
563 }
564 return status;
565}
566
583void usb_flag_clear(usbd_type *usbx, uint16_t flag)
584{
585 usbx->intsts = ~flag;
586}
587
592#endif
593
UNUSED
#define UNUSED(x)
Definition at32f413_def.h:64
CRM
#define CRM
Definition at32f413_crm.h:843
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
flag_status
flag_status
flag status
Definition at32f413.h:292
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
SET
@ SET
Definition at32f413.h:292
USB_BUFFER_TABLE_ADDRESS
#define USB_BUFFER_TABLE_ADDRESS
Definition at32f413_usb.h:154
USB_EPT_CONTROL
#define USB_EPT_CONTROL
Definition at32f413_usb.h:140
USB_EPT_INT
#define USB_EPT_INT
Definition at32f413_usb.h:142
USB_EPT_BULK
#define USB_EPT_BULK
Definition at32f413_usb.h:141
USB_EPT_ISO
#define USB_EPT_ISO
Definition at32f413_usb.h:143
USB_RX_STALL
#define USB_RX_STALL
Definition at32f413_usb.h:124
USB_RX_DISABLE
#define USB_RX_DISABLE
Definition at32f413_usb.h:123
USB_TX_NAK
#define USB_TX_NAK
Definition at32f413_usb.h:117
USB_TX_STALL
#define USB_TX_STALL
Definition at32f413_usb.h:116
USB_TX_DISABLE
#define USB_TX_DISABLE
Definition at32f413_usb.h:115
USB_RX_VALID
#define USB_RX_VALID
Definition at32f413_usb.h:126
DATA_TRANS_OUT
@ DATA_TRANS_OUT
Definition at32f413_usb.h:222
DATA_TRANS_IN
@ DATA_TRANS_IN
Definition at32f413_usb.h:223
EPT_ISO_TYPE
@ EPT_ISO_TYPE
Definition at32f413_usb.h:203
EPT_INT_TYPE
@ EPT_INT_TYPE
Definition at32f413_usb.h:205
EPT_CONTROL_TYPE
@ EPT_CONTROL_TYPE
Definition at32f413_usb.h:202
EPT_BULK_TYPE
@ EPT_BULK_TYPE
Definition at32f413_usb.h:204
USB_TC_FLAG
#define USB_TC_FLAG
Definition at32f413_usb.h:80
USB_SP_INT
#define USB_SP_INT
Definition at32f413_usb.h:56
USB_TC_INT
#define USB_TC_INT
Definition at32f413_usb.h:60
USB_RST_INT
#define USB_RST_INT
Definition at32f413_usb.h:55
USB_WK_INT
#define USB_WK_INT
Definition at32f413_usb.h:57
USB_SOF_INT
#define USB_SOF_INT
Definition at32f413_usb.h:54
USB_CLEAR_TXDTS
#define USB_CLEAR_TXDTS(eptn)
clear usb tx/rx toggle
Definition at32f413_usb.h:418
USB_SET_EPT_DOUBLE_BUF1_LEN
#define USB_SET_EPT_DOUBLE_BUF1_LEN(eptn, len, dir)
double buffer mode set endpoint buf1 length
Definition at32f413_usb.h:376
USB_SET_RXLEN
#define USB_SET_RXLEN(eptn, len)
Definition at32f413_usb.h:335
USB_SET_RXSTS
#define USB_SET_RXSTS(ept_num, new_sts)
set usb endpoint rx status
Definition at32f413_usb.h:263
USB_SET_EPT_DOUBLE_BUFFER
#define USB_SET_EPT_DOUBLE_BUFFER(eptn)
set/clear endpoint double buffer mode
Definition at32f413_usb.h:485
USB_CLEAR_RXDTS
#define USB_CLEAR_RXDTS(eptn)
Definition at32f413_usb.h:422
USB_TOGGLE_RXDTS
#define USB_TOGGLE_RXDTS(eptn)
Definition at32f413_usb.h:411
USB_SET_EPT_ADDRESS
#define USB_SET_EPT_ADDRESS(eptn, address)
set usb device address
Definition at32f413_usb.h:453
USB_SET_TRANS_TYPE
#define USB_SET_TRANS_TYPE(eptn, type)
set usb endpoint type
Definition at32f413_usb.h:437
USB_SET_DOUBLE_BUFF1_ADDRESS
#define USB_SET_DOUBLE_BUFF1_ADDRESS(eptn, address)
Definition at32f413_usb.h:403
USB_SET_TXSTS
#define USB_SET_TXSTS(ept_num, new_sts)
set usb endpoint tx status
Definition at32f413_usb.h:248
USB_SET_TX_ADDRESS
#define USB_SET_TX_ADDRESS(eptn, address)
set usb endpoint tx/rx fifo address
Definition at32f413_usb.h:393
USB_TOGGLE_TXDTS
#define USB_TOGGLE_TXDTS(eptn)
set usb tx/rx toggle
Definition at32f413_usb.h:410
USB_SET_EPT_DOUBLE_BUF0_LEN
#define USB_SET_EPT_DOUBLE_BUF0_LEN(eptn, len, dir)
double buffer mode set endpoint buf0 length
Definition at32f413_usb.h:358
USB_SET_RX_ADDRESS
#define USB_SET_RX_ADDRESS(eptn, address)
Definition at32f413_usb.h:394
USB_SET_DOUBLE_BUFF0_ADDRESS
#define USB_SET_DOUBLE_BUFF0_ADDRESS(eptn, address)
set double buffer mode usb endpoint buf0/buf1 fifo address
Definition at32f413_usb.h:402
USB_PACKET_BUFFER_ADDRESS
#define USB_PACKET_BUFFER_ADDRESS
Definition at32f413_usb.h:165
USB_PACKET_BUFFER_ADDRESS_EX
#define USB_PACKET_BUFFER_ADDRESS_EX
Definition at32f413_usb.h:166
usb_flag_get
flag_status usb_flag_get(usbd_type *usbx, uint16_t flag)
get flag of usb.
Definition at32f413_usb.c:518
usb_exit_suspend
void usb_exit_suspend(usbd_type *usbx)
usb device exit suspend mode
Definition at32f413_usb.c:452
usb_buffer_free
void usb_buffer_free(void)
free usb endpoint buffer
Definition at32f413_usb.c:497
usb_flag_clear
void usb_flag_clear(usbd_type *usbx, uint16_t flag)
clear flag of usb.
Definition at32f413_usb.c:583
usb_write_packet
void usb_write_packet(uint8_t *pusr_buf, uint16_t offset_addr, uint16_t nbytes)
write data from user memory to usb buffer
Definition at32f413_usb.c:326
usb_read_packet
void usb_read_packet(uint8_t *pusr_buf, uint16_t offset_addr, uint16_t nbytes)
read data from usb buffer to user buffer
Definition at32f413_usb.c:353
g_usb_packet_address
uint32_t g_usb_packet_address
Definition at32f413_usb.c:48
usb_disconnect
void usb_disconnect(usbd_type *usbx)
disconnect usb device
Definition at32f413_usb.c:92
USB_ENDP_DESC_TABLE_OFFSET
#define USB_ENDP_DESC_TABLE_OFFSET
usb packet buffer start address
Definition at32f413_usb.c:47
usb_interrupt_flag_get
flag_status usb_interrupt_flag_get(usbd_type *usbx, uint16_t flag)
get interrupt flag of usb.
Definition at32f413_usb.c:548
usb_enter_suspend
void usb_enter_suspend(usbd_type *usbx)
usb device enter suspend mode
Definition at32f413_usb.c:440
usb_interrupt_enable
void usb_interrupt_enable(usbd_type *usbx, uint16_t interrupt, confirm_state new_state)
usb interrupt enable
Definition at32f413_usb.c:389
usb_remote_wkup_clear
void usb_remote_wkup_clear(usbd_type *usbx)
usb remote wakeup clear
Definition at32f413_usb.c:475
usb_usbbufs_enable
void usb_usbbufs_enable(usbd_type *usbx, confirm_state state)
mapping usb packet buffer area two mapping intervals are available for packet buffer area,...
Definition at32f413_usb.c:115
usb_ept_stall
void usb_ept_stall(usbd_type *usbx, usb_ept_info *ept_info)
set endpoint tx or rx status to stall
Definition at32f413_usb.c:421
usb_set_address
void usb_set_address(usbd_type *usbx, uint8_t address)
set the host assignment address
Definition at32f413_usb.c:408
g_usb_offset_addr
static uint16_t g_usb_offset_addr
Definition at32f413_usb.c:49
usb_buffer_malloc
uint16_t usb_buffer_malloc(uint16_t maxpacket)
usb auto malloc endpoint buffer
Definition at32f413_usb.c:485
usb_remote_wkup_set
void usb_remote_wkup_set(usbd_type *usbx)
usb remote wakeup set
Definition at32f413_usb.c:464
usb_connect
void usb_connect(usbd_type *usbx)
connect usb device
Definition at32f413_usb.c:80
usb_ept_open
void usb_ept_open(usbd_type *usbx, usb_ept_info *ept_info)
open usb endpoint
Definition at32f413_usb.c:139
usb_dev_init
void usb_dev_init(usbd_type *usbx)
initialize usb peripheral controller register
Definition at32f413_usb.c:57
usb_ept_close
void usb_ept_close(usbd_type *usbx, usb_ept_info *ept_info)
close usb endpoint
Definition at32f413_usb.c:267
at32f413_conf.h
at32f413 config header file
usb_ept_info
usb endpoint infomation structure definition
Definition at32f413_usb.h:500
usb_ept_info::ept_address
uint8_t ept_address
Definition at32f413_usb.h:502
usb_ept_info::inout
uint8_t inout
Definition at32f413_usb.h:503
usb_ept_info::maxpacket
uint16_t maxpacket
Definition at32f413_usb.h:508
usb_ept_info::rx_addr
uint16_t rx_addr
Definition at32f413_usb.h:507
usb_ept_info::is_double_buffer
uint8_t is_double_buffer
Definition at32f413_usb.h:509
usb_ept_info::tx_addr
uint16_t tx_addr
Definition at32f413_usb.h:506
usb_ept_info::eptn
uint8_t eptn
Definition at32f413_usb.h:501
usb_ept_info::trans_type
uint8_t trans_type
Definition at32f413_usb.h:504
usbd_type
type define usb register all
Definition at32f413_usb.h:527
usbd_type::devaddr
__IO uint32_t devaddr
Definition at32f413_usb.h:623
usbd_type::intsts
__IO uint32_t intsts
Definition at32f413_usb.h:583
usbd_type::cen
__IO uint32_t cen
Definition at32f413_usb.h:627
usbd_type::buftbl
__IO uint32_t buftbl
Definition at32f413_usb.h:637
usbd_type::ssp
__IO uint32_t ssp
Definition at32f413_usb.h:563
usbd_type::devaddr_bit
struct usbd_type::@742::@752 devaddr_bit
usbd_type::csrst
__IO uint32_t csrst
Definition at32f413_usb.h:560
usbd_type::lpm
__IO uint32_t lpm
Definition at32f413_usb.h:562
usbd_type::ctrl
__IO uint32_t ctrl
Definition at32f413_usb.h:557
usbd_type::gresume
__IO uint32_t gresume
Definition at32f413_usb.h:564
usbd_type::disusb
__IO uint32_t disusb
Definition at32f413_usb.h:561
usbd_type::addr
__IO uint32_t addr
Definition at32f413_usb.h:626
usbd_type::ctrl_bit
struct usbd_type::@736::@749 ctrl_bit


AT32F413 Firmwary Library: at32f413_usb.h Source File

  • libraries
  • drivers
  • inc
at32f413_usb.h
Go to the documentation of this file.
1
34/* define to prevent recursive inclusion -------------------------------------*/
35#ifndef __AT32F413_USB_H
36#define __AT32F413_USB_H
37
38#ifdef __cplusplus
39extern "C" {
40#endif
41
42
43/* includes ------------------------------------------------------------------*/
44#include "at32f413.h"
45
46
47
53#define USB_LSOF_INT ((uint32_t)0x00000100)
54#define USB_SOF_INT ((uint32_t)0x00000200)
55#define USB_RST_INT ((uint32_t)0x00000400)
56#define USB_SP_INT ((uint32_t)0x00000800)
57#define USB_WK_INT ((uint32_t)0x00001000)
58#define USB_BE_INT ((uint32_t)0x00002000)
59#define USB_UCFOR_INT ((uint32_t)0x00004000)
60#define USB_TC_INT ((uint32_t)0x00008000)
71#define USB_EPT_NUM_FLAG ((uint32_t)0x0000000F)
72#define USB_INOUT_FLAG ((uint32_t)0x00000010)
73#define USB_LSOF_FLAG ((uint32_t)0x00000100)
74#define USB_SOF_FLAG ((uint32_t)0x00000200)
75#define USB_RST_FLAG ((uint32_t)0x00000400)
76#define USB_SP_FLAG ((uint32_t)0x00000800)
77#define USB_WK_FLAG ((uint32_t)0x00001000)
78#define USB_BE_FLAG ((uint32_t)0x00002000)
79#define USB_UCFOR_FLAG ((uint32_t)0x00004000)
80#define USB_TC_FLAG ((uint32_t)0x00008000)
91#define USB_EPTADDR ((uint32_t)0x0000000F)
92#define USB_TXSTS ((uint32_t)0x00000030)
93#define USB_TXDTS ((uint32_t)0x00000040)
94#define USB_TXTC ((uint32_t)0x00000080)
95#define USB_EXF ((uint32_t)0x00000100)
96#define USB_TRANS_TYPE ((uint32_t)0x00000600)
97#define USB_SETUPTC ((uint32_t)0x00000800)
98#define USB_RXSTS ((uint32_t)0x00003000)
99#define USB_RXDTS ((uint32_t)0x00004000)
100#define USB_RXTC ((uint32_t)0x00008000)
102#define USB_EPT_BIT_MASK (uint32_t)(USB_TXTC | USB_SETUPTC | USB_EPTADDR | USB_EXF | USB_RXTC | USB_TRANS_TYPE)
103#define USB_TX_MASK (USB_TXSTS | USB_EPT_BIT_MASK)
104#define USB_RX_MASK (USB_RXSTS | USB_EPT_BIT_MASK)
115#define USB_TX_DISABLE ((uint32_t)0x00000000)
116#define USB_TX_STALL ((uint32_t)0x00000010)
117#define USB_TX_NAK ((uint32_t)0x00000020)
118#define USB_TX_VALID ((uint32_t)0x00000030)
120#define USB_TXDTS0 ((uint32_t)0x00000010)
121#define USB_TXDTS1 ((uint32_t)0x00000020)
123#define USB_RX_DISABLE ((uint32_t)0x00000000)
124#define USB_RX_STALL ((uint32_t)0x00001000)
125#define USB_RX_NAK ((uint32_t)0x00002000)
126#define USB_RX_VALID ((uint32_t)0x00003000)
128#define USB_RXDTS0 ((uint32_t)0x00001000)
129#define USB_RXDTS1 ((uint32_t)0x00002000)
140#define USB_EPT_CONTROL ((uint32_t)0x00000200)
141#define USB_EPT_BULK ((uint32_t)0x00000000)
142#define USB_EPT_INT ((uint32_t)0x00000600)
143#define USB_EPT_ISO ((uint32_t)0x00000400)
154#define USB_BUFFER_TABLE_ADDRESS 0x0000
165#define USB_PACKET_BUFFER_ADDRESS 0x40006000
166#define USB_PACKET_BUFFER_ADDRESS_EX 0x40007800
179typedef enum
180{
181 USB_EPT0 = 0x00,
182 USB_EPT1 = 0x01,
183 USB_EPT2 = 0x02,
184 USB_EPT3 = 0x03,
185 USB_EPT4 = 0x04,
186 USB_EPT5 = 0x05,
187 USB_EPT6 = 0x06,
188 USB_EPT7 = 0x07
189} usb_ept_number_type;
190
194#ifndef USB_EPT_MAX_NUM
195#define USB_EPT_MAX_NUM 8
196#endif
200typedef enum
201{
202 EPT_CONTROL_TYPE = 0x00,
203 EPT_ISO_TYPE = 0x01,
204 EPT_BULK_TYPE = 0x02,
205 EPT_INT_TYPE = 0x03
206}ept_trans_type;
207
211typedef enum
212{
213 EPT_IN = 0x00,
214 EPT_OUT = 0x01
215}ept_inout_type;
216
220typedef enum
221{
222 DATA_TRANS_OUT = 0x00,
223 DATA_TRANS_IN = 0x01
224}data_trans_dir;
225
229typedef enum
230{
231 USB_CLK_HICK,
232 USB_CLK_HEXT
233}usb_clk48_s;
248#define USB_SET_TXSTS(ept_num, new_sts) { \
249 register uint16_t epsts = (USB->ept[ept_num]) & USB_TX_MASK; \
250 if((new_sts & USB_TXDTS0) != 0) \
251 epsts ^= USB_TXDTS0; \
252 if((new_sts & USB_TXDTS1) != 0) \
253 epsts ^= USB_TXDTS1; \
254 USB->ept[ept_num] = epsts | USB_RXTC | USB_TXTC; \
255}
256
263#define USB_SET_RXSTS(ept_num, new_sts) { \
264 register uint16_t epsts = (USB->ept[ept_num]) & USB_RX_MASK; \
265 if((new_sts & USB_RXDTS0) != 0) \
266 epsts ^= USB_RXDTS0; \
267 if((new_sts & USB_RXDTS1) != 0) \
268 epsts ^= USB_RXDTS1; \
269 USB->ept[ept_num] = epsts | USB_RXTC | USB_TXTC; \
270}
271
277#define GET_TX_LEN_ADDR(eptn) (uint32_t *)((USB->buftbl + eptn * 8 + 2) * 2 + g_usb_packet_address)
278#define GET_RX_LEN_ADDR(eptn) (uint32_t *)((USB->buftbl + eptn * 8 + 6) * 2 + g_usb_packet_address)
279
285#define USB_GET_TX_LEN(eptn) ((uint16_t)(*GET_TX_LEN_ADDR(eptn)) & 0x3ff)
286#define USB_GET_RX_LEN(eptn) ((uint16_t)(*GET_RX_LEN_ADDR(eptn)) & 0x3ff)
287
293#define USB_DBUF0_GET_LEN(eptn) USB_GET_TX_LEN(eptn)
294#define USB_DBUF1_GET_LEN(eptn) USB_GET_RX_LEN(eptn)
295
302#define BLK32(reg, len, blks) { \
303 blks = (len) >> 5; \
304 if(((len) & 0x1F) == 0) \
305 blks --; \
306 *reg = ((uint16_t)((blks) << 10) | 0x8000); \
307}
308
309#define BLK2(reg, len, blks) { \
310 blks = (len) >> 1; \
311 if(((len) & 0x1) == 0) \
312 blks ++; \
313 *reg = (uint16_t)((blks) << 10); \
314}
315
316#define USB_SET_RXLEN_REG(reg, len) { \
317 uint16_t blks; \
318 if(len > 62) \
319 { \
320 BLK32(reg, len, blks); \
321 } \
322 else \
323 { \
324 BLK2(reg, len, blks); \
325 } \
326}
327
334#define USB_SET_TXLEN(eptn, len) (*(GET_TX_LEN_ADDR(eptn)) = (len))
335#define USB_SET_RXLEN(eptn, len) { \
336 uint32_t *rx_reg = GET_RX_LEN_ADDR(eptn); \
337 USB_SET_RXLEN_REG(rx_reg, (len)); \
338}
339
346#define USB_OUT_EPT_DOUBLE_BUF0(eptn, len) { \
347 uint32_t *rx_reg = GET_TX_LEN_ADDR(eptn); \
348 USB_SET_RXLEN_REG(rx_reg, (len)); \
349}
350
358#define USB_SET_EPT_DOUBLE_BUF0_LEN(eptn, len, dir) { \
359 if(dir == DATA_TRANS_OUT) \
360 { \
361 USB_OUT_EPT_DOUBLE_BUF0(eptn, len); \
362 } \
363 else \
364 { \
365 *(GET_TX_LEN_ADDR(eptn)) = (len); \
366 } \
367}
368
376#define USB_SET_EPT_DOUBLE_BUF1_LEN(eptn, len, dir) { \
377 if(dir == DATA_TRANS_OUT) \
378 { \
379 USB_SET_RXLEN(eptn, len); \
380 } \
381 else \
382 { \
383 *(GET_RX_LEN_ADDR(eptn)) = (len); \
384 } \
385}
386
393#define USB_SET_TX_ADDRESS(eptn, address) (*(uint32_t *)((USB->buftbl + eptn * 8) * 2 + g_usb_packet_address) = address)
394#define USB_SET_RX_ADDRESS(eptn, address) (*(uint32_t *)((USB->buftbl + eptn * 8 + 4) * 2 + g_usb_packet_address) = address)
395
402#define USB_SET_DOUBLE_BUFF0_ADDRESS(eptn, address) (USB_SET_TX_ADDRESS(eptn, address))
403#define USB_SET_DOUBLE_BUFF1_ADDRESS(eptn, address) (USB_SET_RX_ADDRESS(eptn, address))
404
410#define USB_TOGGLE_TXDTS(eptn) (USB->ept[eptn] = ((USB->ept[eptn] & USB_EPT_BIT_MASK) | USB_TXDTS | USB_RXTC | USB_TXTC))
411#define USB_TOGGLE_RXDTS(eptn) (USB->ept[eptn] = ((USB->ept[eptn] & USB_EPT_BIT_MASK) | USB_RXDTS | USB_RXTC | USB_TXTC))
412
418#define USB_CLEAR_TXDTS(eptn) { \
419 if(USB->ept_bit[eptn].txdts != 0) \
420 USB_TOGGLE_TXDTS(eptn); \
421}
422#define USB_CLEAR_RXDTS(eptn) { \
423 if(USB->ept_bit[eptn].rxdts != 0) \
424 USB_TOGGLE_RXDTS(eptn); \
425}
426
437#define USB_SET_TRANS_TYPE(eptn, type) (USB->ept[eptn] = (USB->ept[eptn] & USB_EPT_BIT_MASK & (~USB_TRANS_TYPE)) | type)
438
444#define USB_SET_EXF(eptn) (USB->ept[eptn] = USB_TXTC | USB_RXTC | ((USB->ept[eptn] | USB_EXF) & USB_EPT_BIT_MASK))
445#define USB_CLEAR_EXF(eptn) (USB->ept[eptn] = USB_TXTC | USB_RXTC | (USB->ept[eptn] & ((~USB_EXF) & USB_EPT_BIT_MASK)))
446
453#define USB_SET_EPT_ADDRESS(eptn, address) (USB->ept[eptn] = ((USB->ept[eptn] & USB_EPT_BIT_MASK & (~USB_EPTADDR)) | address))
454
461#define USB_FREE_DB_USER_BUFFER(eptn, inout) { \
462 if(inout == DATA_TRANS_IN) \
463 { \
464 USB_TOGGLE_RXDTS(eptn); \
465 } \
466 else \
467 { \
468 USB_TOGGLE_TXDTS(eptn); \
469 } \
470}
471
477#define USB_CLEAR_TXTC(eptn) (USB->ept[eptn] &= 0xFF7F & USB_EPT_BIT_MASK)
478#define USB_CLEAR_RXTC(eptn) (USB->ept[eptn] &= 0x7FFF & USB_EPT_BIT_MASK)
479
485#define USB_SET_EPT_DOUBLE_BUFFER(eptn) USB_SET_EXF(eptn)
486#define USB_CLEAR_EPT_DOUBLE_BUFFER(eptn) USB_CLEAR_EXF(eptn)
487
499typedef struct
500{
501 uint8_t eptn;
502 uint8_t ept_address;
503 uint8_t inout;
504 uint8_t trans_type;
506 uint16_t tx_addr;
507 uint16_t rx_addr;
508 uint16_t maxpacket;
509 uint8_t is_double_buffer;
510 uint8_t stall;
511 uint16_t status;
513 /* transmission buffer and count */
514 uint16_t total_len;
515 uint16_t trans_len;
516 uint8_t *trans_buf;
518 uint16_t last_len;
519 uint16_t rem0_len;
520 uint16_t ept0_slen;
521}usb_ept_info;
522
526typedef struct
527{
531 union
532 {
533 __IO uint32_t ept[8];
534 struct
535 {
536 __IO uint32_t eptaddr : 4; /* [3:0] */
537 __IO uint32_t txsts : 2; /* [5:4] */
538 __IO uint32_t txdts : 1; /* [6] */
539 __IO uint32_t txtc : 1; /* [7] */
540 __IO uint32_t exf : 1; /* [8] */
541 __IO uint32_t trans_type : 2; /* [10:9] */
542 __IO uint32_t setuptc : 1; /* [11] */
543 __IO uint32_t rxsts : 2; /* [13:12] */
544 __IO uint32_t rxdts : 1; /* [14] */
545 __IO uint32_t rxtc : 1; /* [15] */
546 __IO uint32_t reserved1 : 16; /* [31:16] */
547 } ept_bit[8];
548 };
549
550 __IO uint32_t reserved1[8];
551
555 union
556 {
557 __IO uint32_t ctrl;
558 struct
559 {
560 __IO uint32_t csrst : 1; /* [0] */
561 __IO uint32_t disusb : 1; /* [1] */
562 __IO uint32_t lpm : 1; /* [2] */
563 __IO uint32_t ssp : 1; /* [3] */
564 __IO uint32_t gresume : 1; /* [4] */
565 __IO uint32_t reserved1 : 3; /* [7:5] */
566 __IO uint32_t lsofien : 1; /* [8] */
567 __IO uint32_t sofien : 1; /* [9] */
568 __IO uint32_t rstien : 1; /* [10] */
569 __IO uint32_t spien : 1; /* [11] */
570 __IO uint32_t wkien : 1; /* [12] */
571 __IO uint32_t beien : 1; /* [13] */
572 __IO uint32_t ucforien : 1; /* [14] */
573 __IO uint32_t tcien : 1; /* [15] */
574 __IO uint32_t reserved2 : 16; /* [31:16] */
575 } ctrl_bit;
576 };
577
581 union
582 {
583 __IO uint32_t intsts;
584 struct
585 {
586 __IO uint32_t ept_num : 4; /* [3:0] */
587 __IO uint32_t inout : 1; /* [4] */
588 __IO uint32_t reserved1 : 3; /* [7:5] */
589 __IO uint32_t lsof : 1; /* [8] */
590 __IO uint32_t sof : 1; /* [9] */
591 __IO uint32_t rst : 1; /* [10] */
592 __IO uint32_t sp : 1; /* [11] */
593 __IO uint32_t wk : 1; /* [12] */
594 __IO uint32_t be : 1; /* [13] */
595 __IO uint32_t ucfor : 1; /* [14] */
596 __IO uint32_t tc : 1; /* [15] */
597 __IO uint32_t reserved2 : 16; /* [31:16] */
598 } intsts_bit;
599 };
600
604 union
605 {
606 __IO uint32_t sofrnum;
607 struct
608 {
609 __IO uint32_t sofnum : 11; /* [10:0] */
610 __IO uint32_t lsofnum : 2; /* [12:11] */
611 __IO uint32_t clck : 1; /* [13] */
612 __IO uint32_t dmsts : 1; /* [14] */
613 __IO uint32_t dpsts : 1; /* [15] */
614 __IO uint32_t reserved1 : 16; /* [31:16] */
615 } sofrnum_bit;
616 };
617
621 union
622 {
623 __IO uint32_t devaddr;
624 struct
625 {
626 __IO uint32_t addr : 7; /* [6:0] */
627 __IO uint32_t cen : 1; /* [7] */
628 __IO uint32_t reserved1 : 24; /* [31:8] */
629 } devaddr_bit;
630 };
631
635 union
636 {
637 __IO uint32_t buftbl;
638 struct
639 {
640 __IO uint32_t reserved1 : 3; /* [2:0] */
641 __IO uint32_t btaddr : 13; /* [15:3] */
642 __IO uint32_t reserved2 : 16; /* [31:16] */
643 } buftbl_bit;
644 };
645 __IO uint32_t reserved2[3];
649 union
650 {
651 __IO uint32_t cfg;
652 struct
653 {
654 __IO uint32_t sofouten : 1; /* [0] */
655 __IO uint32_t reserved1 : 31; /* [31:1] */
656 } cfg_bit;
657 };
658
659} usbd_type;
660
665#define USB ((usbd_type *) USBFS_BASE)
666
667typedef usbd_type usb_reg_type;
668extern uint32_t g_usb_packet_address;
669
674void usb_dev_init(usbd_type *usbx);
675void usb_connect(usbd_type *usbx);
676void usb_disconnect(usbd_type *usbx);
677void usb_usbbufs_enable(usbd_type *usbx, confirm_state state);
678void usb_ept_open(usbd_type *usbx, usb_ept_info *ept_info);
679void usb_ept_close(usbd_type *usbx, usb_ept_info *ept_info);
680void usb_write_packet(uint8_t *pusr_buf, uint16_t offset_addr, uint16_t nbytes);
681void usb_read_packet(uint8_t *pusr_buf, uint16_t offset_addr, uint16_t nbytes);
682void usb_interrupt_enable(usbd_type *usbx, uint16_t interrupt, confirm_state new_state);
683void usb_set_address(usbd_type *usbx, uint8_t address);
684void usb_ept_stall(usbd_type *usbx, usb_ept_info *ept_info);
685void usb_enter_suspend(usbd_type *usbx);
686void usb_exit_suspend(usbd_type *usbx);
687void usb_remote_wkup_set(usbd_type *usbx);
688void usb_remote_wkup_clear(usbd_type *usbx);
689uint16_t usb_buffer_malloc(uint16_t maxpacket);
690void usb_buffer_free(void);
691 flag_status usb_flag_get(usbd_type *usbx, uint16_t flag);
692 flag_status usb_interrupt_flag_get(usbd_type *usbx, uint16_t flag);
693void usb_flag_clear(usbd_type *usbx, uint16_t flag);
694
695
696#ifdef __cplusplus
697}
698#endif
699
700#endif
at32f413.h
at32f413 header file
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
flag_status
flag_status
flag status
Definition at32f413.h:292
data_trans_dir
data_trans_dir
data transfer direction
Definition at32f413_usb.h:221
usb_clk48_s
usb_clk48_s
usb clock select
Definition at32f413_usb.h:230
ept_inout_type
ept_inout_type
endpoint endpoint direction define
Definition at32f413_usb.h:212
usb_ept_number_type
usb_ept_number_type
usb endpoint number define
Definition at32f413_usb.h:180
ept_trans_type
ept_trans_type
usb endpoint max num define
Definition at32f413_usb.h:201
DATA_TRANS_OUT
@ DATA_TRANS_OUT
Definition at32f413_usb.h:222
DATA_TRANS_IN
@ DATA_TRANS_IN
Definition at32f413_usb.h:223
USB_CLK_HEXT
@ USB_CLK_HEXT
Definition at32f413_usb.h:232
USB_CLK_HICK
@ USB_CLK_HICK
Definition at32f413_usb.h:231
EPT_IN
@ EPT_IN
Definition at32f413_usb.h:213
EPT_OUT
@ EPT_OUT
Definition at32f413_usb.h:214
USB_EPT4
@ USB_EPT4
Definition at32f413_usb.h:185
USB_EPT6
@ USB_EPT6
Definition at32f413_usb.h:187
USB_EPT5
@ USB_EPT5
Definition at32f413_usb.h:186
USB_EPT7
@ USB_EPT7
Definition at32f413_usb.h:188
USB_EPT0
@ USB_EPT0
Definition at32f413_usb.h:181
USB_EPT2
@ USB_EPT2
Definition at32f413_usb.h:183
USB_EPT1
@ USB_EPT1
Definition at32f413_usb.h:182
USB_EPT3
@ USB_EPT3
Definition at32f413_usb.h:184
EPT_ISO_TYPE
@ EPT_ISO_TYPE
Definition at32f413_usb.h:203
EPT_INT_TYPE
@ EPT_INT_TYPE
Definition at32f413_usb.h:205
EPT_CONTROL_TYPE
@ EPT_CONTROL_TYPE
Definition at32f413_usb.h:202
EPT_BULK_TYPE
@ EPT_BULK_TYPE
Definition at32f413_usb.h:204
usb_flag_get
flag_status usb_flag_get(usbd_type *usbx, uint16_t flag)
get flag of usb.
Definition at32f413_usb.c:518
usb_exit_suspend
void usb_exit_suspend(usbd_type *usbx)
usb device exit suspend mode
Definition at32f413_usb.c:452
usb_buffer_free
void usb_buffer_free(void)
free usb endpoint buffer
Definition at32f413_usb.c:497
usb_flag_clear
void usb_flag_clear(usbd_type *usbx, uint16_t flag)
clear flag of usb.
Definition at32f413_usb.c:583
usb_write_packet
void usb_write_packet(uint8_t *pusr_buf, uint16_t offset_addr, uint16_t nbytes)
write data from user memory to usb buffer
Definition at32f413_usb.c:326
usb_read_packet
void usb_read_packet(uint8_t *pusr_buf, uint16_t offset_addr, uint16_t nbytes)
read data from usb buffer to user buffer
Definition at32f413_usb.c:353
usb_disconnect
void usb_disconnect(usbd_type *usbx)
disconnect usb device
Definition at32f413_usb.c:92
usb_interrupt_flag_get
flag_status usb_interrupt_flag_get(usbd_type *usbx, uint16_t flag)
get interrupt flag of usb.
Definition at32f413_usb.c:548
usb_enter_suspend
void usb_enter_suspend(usbd_type *usbx)
usb device enter suspend mode
Definition at32f413_usb.c:440
usb_interrupt_enable
void usb_interrupt_enable(usbd_type *usbx, uint16_t interrupt, confirm_state new_state)
usb interrupt enable
Definition at32f413_usb.c:389
usb_remote_wkup_clear
void usb_remote_wkup_clear(usbd_type *usbx)
usb remote wakeup clear
Definition at32f413_usb.c:475
usb_usbbufs_enable
void usb_usbbufs_enable(usbd_type *usbx, confirm_state state)
mapping usb packet buffer area two mapping intervals are available for packet buffer area,...
Definition at32f413_usb.c:115
usb_ept_stall
void usb_ept_stall(usbd_type *usbx, usb_ept_info *ept_info)
set endpoint tx or rx status to stall
Definition at32f413_usb.c:421
usb_set_address
void usb_set_address(usbd_type *usbx, uint8_t address)
set the host assignment address
Definition at32f413_usb.c:408
usb_buffer_malloc
uint16_t usb_buffer_malloc(uint16_t maxpacket)
usb auto malloc endpoint buffer
Definition at32f413_usb.c:485
usb_remote_wkup_set
void usb_remote_wkup_set(usbd_type *usbx)
usb remote wakeup set
Definition at32f413_usb.c:464
usb_connect
void usb_connect(usbd_type *usbx)
connect usb device
Definition at32f413_usb.c:80
usb_ept_open
void usb_ept_open(usbd_type *usbx, usb_ept_info *ept_info)
open usb endpoint
Definition at32f413_usb.c:139
usb_dev_init
void usb_dev_init(usbd_type *usbx)
initialize usb peripheral controller register
Definition at32f413_usb.c:57
usb_ept_close
void usb_ept_close(usbd_type *usbx, usb_ept_info *ept_info)
close usb endpoint
Definition at32f413_usb.c:267
usb_reg_type
usbd_type usb_reg_type
Definition at32f413_usb.h:667
g_usb_packet_address
uint32_t g_usb_packet_address
Definition at32f413_usb.c:48
usb_ept_info
usb endpoint infomation structure definition
Definition at32f413_usb.h:500
usb_ept_info::total_len
uint16_t total_len
Definition at32f413_usb.h:514
usb_ept_info::ept_address
uint8_t ept_address
Definition at32f413_usb.h:502
usb_ept_info::trans_len
uint16_t trans_len
Definition at32f413_usb.h:515
usb_ept_info::inout
uint8_t inout
Definition at32f413_usb.h:503
usb_ept_info::maxpacket
uint16_t maxpacket
Definition at32f413_usb.h:508
usb_ept_info::ept0_slen
uint16_t ept0_slen
Definition at32f413_usb.h:520
usb_ept_info::rx_addr
uint16_t rx_addr
Definition at32f413_usb.h:507
usb_ept_info::trans_buf
uint8_t * trans_buf
Definition at32f413_usb.h:516
usb_ept_info::stall
uint8_t stall
Definition at32f413_usb.h:510
usb_ept_info::is_double_buffer
uint8_t is_double_buffer
Definition at32f413_usb.h:509
usb_ept_info::last_len
uint16_t last_len
Definition at32f413_usb.h:518
usb_ept_info::status
uint16_t status
Definition at32f413_usb.h:511
usb_ept_info::rem0_len
uint16_t rem0_len
Definition at32f413_usb.h:519
usb_ept_info::tx_addr
uint16_t tx_addr
Definition at32f413_usb.h:506
usb_ept_info::eptn
uint8_t eptn
Definition at32f413_usb.h:501
usb_ept_info::trans_type
uint8_t trans_type
Definition at32f413_usb.h:504
usbd_type
type define usb register all
Definition at32f413_usb.h:527
usbd_type::rxtc
__IO uint32_t rxtc
Definition at32f413_usb.h:545
usbd_type::sofien
__IO uint32_t sofien
Definition at32f413_usb.h:567
usbd_type::devaddr
__IO uint32_t devaddr
Definition at32f413_usb.h:623
usbd_type::intsts
__IO uint32_t intsts
Definition at32f413_usb.h:583
usbd_type::txtc
__IO uint32_t txtc
Definition at32f413_usb.h:539
usbd_type::lsofien
__IO uint32_t lsofien
Definition at32f413_usb.h:566
usbd_type::cen
__IO uint32_t cen
Definition at32f413_usb.h:627
usbd_type::rstien
__IO uint32_t rstien
Definition at32f413_usb.h:568
usbd_type::sofnum
__IO uint32_t sofnum
Definition at32f413_usb.h:609
usbd_type::dpsts
__IO uint32_t dpsts
Definition at32f413_usb.h:613
usbd_type::btaddr
__IO uint32_t btaddr
Definition at32f413_usb.h:641
usbd_type::be
__IO uint32_t be
Definition at32f413_usb.h:594
usbd_type::exf
__IO uint32_t exf
Definition at32f413_usb.h:540
usbd_type::dmsts
__IO uint32_t dmsts
Definition at32f413_usb.h:612
usbd_type::lsofnum
__IO uint32_t lsofnum
Definition at32f413_usb.h:610
usbd_type::sofouten
__IO uint32_t sofouten
Definition at32f413_usb.h:654
usbd_type::inout
__IO uint32_t inout
Definition at32f413_usb.h:587
usbd_type::rxdts
__IO uint32_t rxdts
Definition at32f413_usb.h:544
usbd_type::rst
__IO uint32_t rst
Definition at32f413_usb.h:591
usbd_type::txdts
__IO uint32_t txdts
Definition at32f413_usb.h:538
usbd_type::setuptc
__IO uint32_t setuptc
Definition at32f413_usb.h:542
usbd_type::buftbl
__IO uint32_t buftbl
Definition at32f413_usb.h:637
usbd_type::wk
__IO uint32_t wk
Definition at32f413_usb.h:593
usbd_type::ssp
__IO uint32_t ssp
Definition at32f413_usb.h:563
usbd_type::wkien
__IO uint32_t wkien
Definition at32f413_usb.h:570
usbd_type::txsts
__IO uint32_t txsts
Definition at32f413_usb.h:537
usbd_type::clck
__IO uint32_t clck
Definition at32f413_usb.h:611
usbd_type::sofrnum
__IO uint32_t sofrnum
Definition at32f413_usb.h:606
usbd_type::ucfor
__IO uint32_t ucfor
Definition at32f413_usb.h:595
usbd_type::spien
__IO uint32_t spien
Definition at32f413_usb.h:569
usbd_type::csrst
__IO uint32_t csrst
Definition at32f413_usb.h:560
usbd_type::lpm
__IO uint32_t lpm
Definition at32f413_usb.h:562
usbd_type::ctrl
__IO uint32_t ctrl
Definition at32f413_usb.h:557
usbd_type::trans_type
__IO uint32_t trans_type
Definition at32f413_usb.h:541
usbd_type::ucforien
__IO uint32_t ucforien
Definition at32f413_usb.h:572
usbd_type::gresume
__IO uint32_t gresume
Definition at32f413_usb.h:564
usbd_type::lsof
__IO uint32_t lsof
Definition at32f413_usb.h:589
usbd_type::sof
__IO uint32_t sof
Definition at32f413_usb.h:590
usbd_type::sp
__IO uint32_t sp
Definition at32f413_usb.h:592
usbd_type::tcien
__IO uint32_t tcien
Definition at32f413_usb.h:573
usbd_type::disusb
__IO uint32_t disusb
Definition at32f413_usb.h:561
usbd_type::eptaddr
__IO uint32_t eptaddr
Definition at32f413_usb.h:536
usbd_type::reserved1
__IO uint32_t reserved1
Definition at32f413_usb.h:546
usbd_type::tc
__IO uint32_t tc
Definition at32f413_usb.h:596
usbd_type::addr
__IO uint32_t addr
Definition at32f413_usb.h:626
usbd_type::cfg
__IO uint32_t cfg
Definition at32f413_usb.h:651
usbd_type::reserved2
__IO uint32_t reserved2
Definition at32f413_usb.h:574
usbd_type::ept_num
__IO uint32_t ept_num
Definition at32f413_usb.h:586
usbd_type::rxsts
__IO uint32_t rxsts
Definition at32f413_usb.h:543
usbd_type::beien
__IO uint32_t beien
Definition at32f413_usb.h:571


AT32F413 Firmwary Library: at32f413_wdt.c Source File

  • libraries
  • drivers
  • src
at32f413_wdt.c
Go to the documentation of this file.
1
26#include "at32f413_conf.h"
27
37#ifdef WDT_MODULE_ENABLED
38
48void wdt_enable(void)
49{
50 WDT->cmd = WDT_CMD_ENABLE;
51}
52
58void wdt_counter_reload(void)
59{
60 WDT->cmd = WDT_CMD_RELOAD;
61}
62
68void wdt_reload_value_set(uint16_t reload_value)
69{
70 WDT->rld = reload_value;
71}
72
86void wdt_divider_set(wdt_division_type division)
87{
88 WDT->div_bit.div = division;
89}
90
96void wdt_register_write_enable( confirm_state new_state)
97{
98 if(new_state == FALSE)
99 {
100 WDT->cmd = WDT_CMD_LOCK;
101 }
102 else
103 {
104 WDT->cmd = WDT_CMD_UNLOCK;
105 }
106}
107
116 flag_status wdt_flag_get(uint16_t wdt_flag)
117{
118 flag_status status = RESET;
119
120 if ((WDT->sts & wdt_flag) != (uint16_t)RESET)
121 {
122 status = SET;
123 }
124 else
125 {
126 status = RESET;
127 }
128
129 return status;
130}
131
136#endif
137
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
flag_status
flag_status
flag status
Definition at32f413.h:292
FALSE
@ FALSE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
SET
@ SET
Definition at32f413.h:292
wdt_division_type
wdt_division_type
wdt division value type
Definition at32f413_wdt.h:67
WDT_CMD_ENABLE
@ WDT_CMD_ENABLE
Definition at32f413_wdt.h:84
WDT_CMD_UNLOCK
@ WDT_CMD_UNLOCK
Definition at32f413_wdt.h:83
WDT_CMD_RELOAD
@ WDT_CMD_RELOAD
Definition at32f413_wdt.h:85
WDT_CMD_LOCK
@ WDT_CMD_LOCK
Definition at32f413_wdt.h:82
wdt_register_write_enable
void wdt_register_write_enable(confirm_state new_state)
enable or disable wdt cmd register write
Definition at32f413_wdt.c:96
wdt_enable
void wdt_enable(void)
wdt enable ,the reload value will be sent to the counter
Definition at32f413_wdt.c:48
wdt_flag_get
flag_status wdt_flag_get(uint16_t wdt_flag)
get wdt flag
Definition at32f413_wdt.c:116
wdt_counter_reload
void wdt_counter_reload(void)
reload wdt counter
Definition at32f413_wdt.c:58
wdt_reload_value_set
void wdt_reload_value_set(uint16_t reload_value)
set wdt counter reload value
Definition at32f413_wdt.c:68
wdt_divider_set
void wdt_divider_set(wdt_division_type division)
set wdt division divider
Definition at32f413_wdt.c:86
WDT
#define WDT
Definition at32f413_wdt.h:153
at32f413_conf.h
at32f413 config header file


AT32F413 Firmwary Library: at32f413_wdt.h Source File

  • libraries
  • drivers
  • inc
at32f413_wdt.h
Go to the documentation of this file.
1
26/* Define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_WDT_H
28#define __AT32F413_WDT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34
35/* Includes ------------------------------------------------------------------*/
36#include "at32f413.h"
37
52#define WDT_DIVF_UPDATE_FLAG ((uint16_t)0x0001)
53#define WDT_RLDF_UPDATE_FLAG ((uint16_t)0x0002)
66typedef enum
67{
68 WDT_CLK_DIV_4 = 0x00,
69 WDT_CLK_DIV_8 = 0x01,
70 WDT_CLK_DIV_16 = 0x02,
71 WDT_CLK_DIV_32 = 0x03,
72 WDT_CLK_DIV_64 = 0x04,
73 WDT_CLK_DIV_128 = 0x05,
74 WDT_CLK_DIV_256 = 0x06
75} wdt_division_type;
76
80typedef enum
81{
82 WDT_CMD_LOCK = 0x0000,
83 WDT_CMD_UNLOCK = 0x5555,
84 WDT_CMD_ENABLE = 0xCCCC,
85 WDT_CMD_RELOAD = 0xAAAA
86} wdt_cmd_value_type;
87
91typedef struct
92{
93
97 union
98 {
99 __IO uint32_t cmd;
100 struct
101 {
102 __IO uint32_t cmd : 16;/* [15:0] */
103 __IO uint32_t reserved1 : 16;/* [31:16] */
104 } cmd_bit;
105 };
106
110 union
111 {
112 __IO uint32_t div;
113 struct
114 {
115 __IO uint32_t div : 3; /* [2:0] */
116 __IO uint32_t reserved1 : 29;/* [31:3] */
117 } div_bit;
118 };
119
123 union
124 {
125 __IO uint32_t rld;
126 struct
127 {
128 __IO uint32_t rld : 12;/* [11:0] */
129 __IO uint32_t reserved1 : 20;/* [31:12] */
130 } rld_bit;
131 };
132
136 union
137 {
138 __IO uint32_t sts;
139 struct
140 {
141 __IO uint32_t divf : 1; /* [0] */
142 __IO uint32_t rldf : 1; /* [1] */
143 __IO uint32_t reserved1 : 30;/* [31:2] */
144 } sts_bit;
145 };
146
147} wdt_type;
148
153#define WDT ((wdt_type *) WDT_BASE)
154
159void wdt_enable(void);
160void wdt_counter_reload(void);
161void wdt_reload_value_set(uint16_t reload_value);
162void wdt_divider_set(wdt_division_type division);
163void wdt_register_write_enable( confirm_state new_state);
164 flag_status wdt_flag_get(uint16_t wdt_flag);
165
178#ifdef __cplusplus
179}
180#endif
181
182#endif
at32f413.h
at32f413 header file
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
flag_status
flag_status
flag status
Definition at32f413.h:292
wdt_register_write_enable
void wdt_register_write_enable(confirm_state new_state)
enable or disable wdt cmd register write
Definition at32f413_wdt.c:96
wdt_enable
void wdt_enable(void)
wdt enable ,the reload value will be sent to the counter
Definition at32f413_wdt.c:48
wdt_flag_get
flag_status wdt_flag_get(uint16_t wdt_flag)
get wdt flag
Definition at32f413_wdt.c:116
wdt_counter_reload
void wdt_counter_reload(void)
reload wdt counter
Definition at32f413_wdt.c:58
wdt_reload_value_set
void wdt_reload_value_set(uint16_t reload_value)
set wdt counter reload value
Definition at32f413_wdt.c:68
wdt_divider_set
void wdt_divider_set(wdt_division_type division)
set wdt division divider
Definition at32f413_wdt.c:86
wdt_cmd_value_type
wdt_cmd_value_type
wdt cmd value type
Definition at32f413_wdt.h:81
wdt_division_type
wdt_division_type
wdt division value type
Definition at32f413_wdt.h:67
WDT_CMD_ENABLE
@ WDT_CMD_ENABLE
Definition at32f413_wdt.h:84
WDT_CMD_UNLOCK
@ WDT_CMD_UNLOCK
Definition at32f413_wdt.h:83
WDT_CMD_RELOAD
@ WDT_CMD_RELOAD
Definition at32f413_wdt.h:85
WDT_CMD_LOCK
@ WDT_CMD_LOCK
Definition at32f413_wdt.h:82
WDT_CLK_DIV_64
@ WDT_CLK_DIV_64
Definition at32f413_wdt.h:72
WDT_CLK_DIV_8
@ WDT_CLK_DIV_8
Definition at32f413_wdt.h:69
WDT_CLK_DIV_256
@ WDT_CLK_DIV_256
Definition at32f413_wdt.h:74
WDT_CLK_DIV_4
@ WDT_CLK_DIV_4
Definition at32f413_wdt.h:68
WDT_CLK_DIV_16
@ WDT_CLK_DIV_16
Definition at32f413_wdt.h:70
WDT_CLK_DIV_32
@ WDT_CLK_DIV_32
Definition at32f413_wdt.h:71
WDT_CLK_DIV_128
@ WDT_CLK_DIV_128
Definition at32f413_wdt.h:73
wdt_type
type define wdt register all
Definition at32f413_wdt.h:92
wdt_type::reserved1
__IO uint32_t reserved1
Definition at32f413_wdt.h:103
wdt_type::div
__IO uint32_t div
Definition at32f413_wdt.h:112
wdt_type::divf
__IO uint32_t divf
Definition at32f413_wdt.h:141
wdt_type::rld
__IO uint32_t rld
Definition at32f413_wdt.h:125
wdt_type::rldf
__IO uint32_t rldf
Definition at32f413_wdt.h:142
wdt_type::sts
__IO uint32_t sts
Definition at32f413_wdt.h:138
wdt_type::cmd
__IO uint32_t cmd
Definition at32f413_wdt.h:99


AT32F413 Firmwary Library: at32f413_wwdt.c Source File

  • libraries
  • drivers
  • src
at32f413_wwdt.c
Go to the documentation of this file.
1
26#include "at32f413_conf.h"
27
37#ifdef WWDT_MODULE_ENABLED
38
47void wwdt_reset(void)
48{
49 crm_periph_reset(CRM_WWDT_PERIPH_RESET, TRUE);
50 crm_periph_reset(CRM_WWDT_PERIPH_RESET, FALSE);
51}
52
63void wwdt_divider_set(wwdt_division_type division)
64{
65 WWDT->cfg_bit.div = division;
66}
67
73void wwdt_flag_clear(void)
74{
75 WWDT->sts = 0;
76}
77
83void wwdt_enable(uint8_t wwdt_cnt)
84{
85 WWDT->ctrl = wwdt_cnt | WWDT_EN_BIT;
86}
87
93void wwdt_interrupt_enable(void)
94{
95 WWDT->cfg_bit.rldien = TRUE;
96}
97
103 flag_status wwdt_flag_get(void)
104{
105 return (flag_status)WWDT->sts_bit.rldf;
106}
107
113 flag_status wwdt_interrupt_flag_get(void)
114{
115 return (flag_status)(WWDT->sts_bit.rldf && WWDT->cfg_bit.rldien);
116}
117
123void wwdt_counter_set(uint8_t wwdt_cnt)
124{
125 WWDT->ctrl_bit.cnt = wwdt_cnt;
126}
127
133void wwdt_window_counter_set(uint8_t window_cnt)
134{
135 WWDT->cfg_bit.win = window_cnt;
136}
137
142#endif
143
crm_periph_reset
void crm_periph_reset(crm_periph_reset_type value, confirm_state new_state)
enable or disable the peripheral reset
Definition at32f413_crm.c:293
CRM_WWDT_PERIPH_RESET
@ CRM_WWDT_PERIPH_RESET
Definition at32f413_crm.h:173
flag_status
flag_status
flag status
Definition at32f413.h:292
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
WWDT_EN_BIT
#define WWDT_EN_BIT
Definition at32f413_wwdt.h:51
wwdt_division_type
wwdt_division_type
wwdt division type
Definition at32f413_wwdt.h:65
wwdt_counter_set
void wwdt_counter_set(uint8_t wwdt_cnt)
wwdt counter value set
Definition at32f413_wwdt.c:123
wwdt_interrupt_flag_get
flag_status wwdt_interrupt_flag_get(void)
wwdt reload counter interrupt flag get
Definition at32f413_wwdt.c:113
wwdt_flag_clear
void wwdt_flag_clear(void)
wwdt reload counter interrupt flag clear
Definition at32f413_wwdt.c:73
wwdt_interrupt_enable
void wwdt_interrupt_enable(void)
wwdt reload counter interrupt enable
Definition at32f413_wwdt.c:93
wwdt_divider_set
void wwdt_divider_set(wwdt_division_type division)
wwdt division set
Definition at32f413_wwdt.c:63
wwdt_reset
void wwdt_reset(void)
wwdt reset by crm reset register
Definition at32f413_wwdt.c:47
wwdt_window_counter_set
void wwdt_window_counter_set(uint8_t window_cnt)
wwdt window counter value set
Definition at32f413_wwdt.c:133
wwdt_flag_get
flag_status wwdt_flag_get(void)
wwdt reload counter interrupt flag get
Definition at32f413_wwdt.c:103
wwdt_enable
void wwdt_enable(uint8_t wwdt_cnt)
wwdt enable and the counter value load
Definition at32f413_wwdt.c:83
WWDT
#define WWDT
Definition at32f413_wwdt.h:126
at32f413_conf.h
at32f413 config header file


AT32F413 Firmwary Library: at32f413_wwdt.h Source File

  • libraries
  • drivers
  • inc
at32f413_wwdt.h
Go to the documentation of this file.
1
26/* Define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_WWDT_H
28#define __AT32F413_WWDT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34
35/* Includes ------------------------------------------------------------------*/
36#include "at32f413.h"
37
51#define WWDT_EN_BIT ((uint32_t)0x00000080)
64typedef enum
65{
66 WWDT_PCLK1_DIV_4096 = 0x00,
67 WWDT_PCLK1_DIV_8192 = 0x01,
68 WWDT_PCLK1_DIV_16384 = 0x02,
69 WWDT_PCLK1_DIV_32768 = 0x03
70} wwdt_division_type;
71
75typedef struct
76{
77
81 union
82 {
83 __IO uint32_t ctrl;
84 struct
85 {
86 __IO uint32_t cnt : 7; /* [6:0] */
87 __IO uint32_t wwdten : 1; /* [7] */
88 __IO uint32_t reserved1 : 24;/* [31:8] */
89 } ctrl_bit;
90 };
91
95 union
96 {
97 __IO uint32_t cfg;
98 struct
99 {
100 __IO uint32_t win : 7; /* [6:0] */
101 __IO uint32_t div : 2; /* [8:7] */
102 __IO uint32_t rldien : 1; /* [9] */
103 __IO uint32_t reserved1 : 22;/* [31:10] */
104 } cfg_bit;
105 };
106
110 union
111 {
112 __IO uint32_t sts;
113 struct
114 {
115 __IO uint32_t rldf : 1; /* [0] */
116 __IO uint32_t reserved1 : 31;/* [31:1] */
117 } sts_bit;
118 };
119
120} wwdt_type;
121
126#define WWDT ((wwdt_type *) WWDT_BASE)
127
132void wwdt_reset(void);
133void wwdt_divider_set(wwdt_division_type division);
134void wwdt_flag_clear(void);
135void wwdt_enable(uint8_t wwdt_cnt);
136void wwdt_interrupt_enable(void);
137 flag_status wwdt_flag_get(void);
138 flag_status wwdt_interrupt_flag_get(void);
139void wwdt_counter_set(uint8_t wwdt_cnt);
140void wwdt_window_counter_set(uint8_t window_cnt);
141
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413.h
at32f413 header file
flag_status
flag_status
flag status
Definition at32f413.h:292
wwdt_counter_set
void wwdt_counter_set(uint8_t wwdt_cnt)
wwdt counter value set
Definition at32f413_wwdt.c:123
wwdt_interrupt_flag_get
flag_status wwdt_interrupt_flag_get(void)
wwdt reload counter interrupt flag get
Definition at32f413_wwdt.c:113
wwdt_flag_clear
void wwdt_flag_clear(void)
wwdt reload counter interrupt flag clear
Definition at32f413_wwdt.c:73
wwdt_interrupt_enable
void wwdt_interrupt_enable(void)
wwdt reload counter interrupt enable
Definition at32f413_wwdt.c:93
wwdt_divider_set
void wwdt_divider_set(wwdt_division_type division)
wwdt division set
Definition at32f413_wwdt.c:63
wwdt_reset
void wwdt_reset(void)
wwdt reset by crm reset register
Definition at32f413_wwdt.c:47
wwdt_window_counter_set
void wwdt_window_counter_set(uint8_t window_cnt)
wwdt window counter value set
Definition at32f413_wwdt.c:133
wwdt_flag_get
flag_status wwdt_flag_get(void)
wwdt reload counter interrupt flag get
Definition at32f413_wwdt.c:103
wwdt_enable
void wwdt_enable(uint8_t wwdt_cnt)
wwdt enable and the counter value load
Definition at32f413_wwdt.c:83
wwdt_division_type
wwdt_division_type
wwdt division type
Definition at32f413_wwdt.h:65
WWDT_PCLK1_DIV_16384
@ WWDT_PCLK1_DIV_16384
Definition at32f413_wwdt.h:68
WWDT_PCLK1_DIV_8192
@ WWDT_PCLK1_DIV_8192
Definition at32f413_wwdt.h:67
WWDT_PCLK1_DIV_32768
@ WWDT_PCLK1_DIV_32768
Definition at32f413_wwdt.h:69
WWDT_PCLK1_DIV_4096
@ WWDT_PCLK1_DIV_4096
Definition at32f413_wwdt.h:66
wwdt_type
type define wwdt register all
Definition at32f413_wwdt.h:76
wwdt_type::div
__IO uint32_t div
Definition at32f413_wwdt.h:101
wwdt_type::win
__IO uint32_t win
Definition at32f413_wwdt.h:100
wwdt_type::cfg
__IO uint32_t cfg
Definition at32f413_wwdt.h:97
wwdt_type::cnt
__IO uint32_t cnt
Definition at32f413_wwdt.h:86
wwdt_type::wwdten
__IO uint32_t wwdten
Definition at32f413_wwdt.h:87
wwdt_type::sts
__IO uint32_t sts
Definition at32f413_wwdt.h:112
wwdt_type::ctrl
__IO uint32_t ctrl
Definition at32f413_wwdt.h:83
wwdt_type::reserved1
__IO uint32_t reserved1
Definition at32f413_wwdt.h:88
wwdt_type::rldien
__IO uint32_t rldien
Definition at32f413_wwdt.h:102
wwdt_type::rldf
__IO uint32_t rldf
Definition at32f413_wwdt.h:115


AT32F413 Firmwary Library: audio_conf.h Source File

  • middlewares
  • usbd_class
  • audio
audio/audio_conf.h
Go to the documentation of this file.
1
26 /* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AUDIO_CONF_H
28#define __AUDIO_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34
46#define AUDIO_SUPPORT_SPK 1
47#define AUDIO_SUPPORT_MIC 1
48#define AUDIO_SUPPORT_FEEDBACK 1
49
50#define AUDIO_SUPPORT_FREQ_16K 1
51#define AUDIO_SUPPORT_FREQ_48K 1
52
53
54#define AUDIO_SUPPORT_FREQ (AUDIO_SUPPORT_FREQ_16K + \
55 AUDIO_SUPPORT_FREQ_48K \
56 )
57
58#define AUDIO_FREQ_16K 16000
59#define AUDIO_FREQ_48K 48000
60#define AUDIO_BITW_16 16
61
62#define AUDIO_MIC_CHANEL_NUM 2
63#define AUDIO_MIC_DEFAULT_BITW AUDIO_BITW_16
64
65#define AUDIO_SPK_CHANEL_NUM 2
66#define AUDIO_SPK_DEFAULT_BITW AUDIO_BITW_16
67
68
69#define AUDIO_SUPPORT_MAX_FREQ 48
70#define AUDIO_DEFAULT_FREQ AUDIO_FREQ_48K
71#define AUDIO_DEFAULT_BITW AUDIO_BITW_16
72
84#ifdef __cplusplus
85}
86#endif
87
88#endif
89
90
91


AT32F413 Firmwary Library: audio_codec.h Source File

  • usb_device
  • audio
  • inc
audio/inc/audio_codec.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AUDIO_CODEC_H
28#define __AUDIO_CODEC_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34
43/* includes ------------------------------------------------------------------*/
44#include "at32f413.h"
45
49#define WM8988_R0_LEFT_INPUT_VOLUME 0x00 /*Left channel PGA control*/
50#define WM8988_R1_RIGHT_INPUT_VOLUME 0x01 /*Right channel PGA control*/
51#define WM8988_R2_LOUT1_VOLUME 0x02
52#define WM8988_R3_ROUT1_VOLUME 0x03
53#define WM8988_R4_RESERVED 0x04
54#define WM8988_R5_ADC_DAC_CONTROL 0x05
55#define WM8988_R6_RESERVED 0x06
56#define WM8988_R7_AUDIO_INTERFACE 0x07
57#define WM8988_R8_SAMPLE_RATE 0x08
58#define WM8988_R9_RESERVED 0x09
59#define WM8988_R10_LEFT_DAC_VOLUME 0x0A
60#define WM8988_R11_RIGHT_DAC_VOLUME 0x0B
61#define WM8988_R12_BASS_CONTROL 0x0C
62#define WM8988_R13_TREBLE_CONTROL 0x0D
63#define WM8988_R14_
64#define WM8988_R15_RESET 0x0F
65#define WM8988_R16_3D_CONTROL 0x10
66#define WM8988_R17_ALC1 0x11
67#define WM8988_R18_ALC2 0x12
68#define WM8988_R19_ALC3 0x13
69#define WM8988_R20_NOISE_GATE 0x14
70#define WM8988_R21_LEFT_ADC_VOLUME 0x15
71#define WM8988_R22_RIGHT_ADC_VOLUME 0x16
72#define WM8988_R23_ADDITIONAL_1_CONTROL 0x17
73#define WM8988_R24_ADDITIONAL_2_CONTROL 0x18
74#define WM8988_R25_PWR_1_MGMT 0x19
75#define WM8988_R26_PWR_2_MGMT 0x1A
76#define WM8988_R27_ADDITIONAL_3_CONTROL 0x1B
77
78#define WM8988_R31_ADC_INPUT_MODE 0x1F
79#define WM8988_R32_ADC_L_SIGNAL_PATH 0x20
80#define WM8988_R33_ADC_R_SIGNAL_PATH 0x21
81#define WM8988_R34_LEFT_OUT_MIX_1 0x22
82#define WM8988_R35_LEFT_OUT_MIX_2 0x23
83#define WM8988_R36_RIGHT_OUT_MIX_1 0x24
84#define WM8988_R37_RIGHT_OUT_MIX_2 0x25
85#define WM8988_R38_RESERVED
86#define WM8988_R39_RESERVED
87#define WM8988_R40_LOUT2_VOLUME 0x28
88#define WM8988_R41_ROUT2_VOLUME 0x29
89#define WM8988_R42_RESERVED
90#define WM8988_R43_LOW_POWER_PALYBACK 0x43
91
92#define WM8988_I2C_ADDR_CSB_LOW 0x34
93#define WM8988_I2C_ADDR_CSB_HIGH 0x36
94
102#define I2S1_WS_PIN GPIO_PINS_4
103#define I2S1_CK_PIN GPIO_PINS_5
104#define I2S1_SD_PIN GPIO_PINS_7
105#define I2S1_GPIO GPIOA
106#define I2S1_GPIO_CRM_CLK CRM_GPIOA_PERIPH_CLOCK
107#define I2S1_DT_ADDRESS (&(SPI1->dt))
108
109/*I2S2 Pin*/
110#define I2S2_WS_PIN GPIO_PINS_12
111#define I2S2_CK_PIN GPIO_PINS_13
112#define I2S2_SD_PIN GPIO_PINS_15
113#define I2S2_GPIO GPIOB
114#define I2S2_GPIO_CRM_CLK CRM_GPIOB_PERIPH_CLOCK
115#define I2S2_DT_ADDRESS (&(SPI2->dt))
116
117#define SPK_TX_FIFO_SIZE (1024 * 4)
118
126#define MIC_BUFFER_SIZE 1024
127#define SPK_BUFFER_SIZE 4096
128#define DMA_BUFFER_SIZE 288
129
130typedef struct
131{
132 uint32_t audio_freq;
133 uint32_t audio_bitw;
134 //spk part
135 uint16_t spk_buffer[SPK_BUFFER_SIZE];
136 uint16_t *spk_roff;
137 uint16_t *spk_woff;
138 uint16_t *spk_rend;
139 uint32_t spk_freq;
140 uint32_t spk_wtotal;
141 uint32_t spk_rtotal;
142 uint16_t spk_threshold;
143 uint16_t spk_calc;
144 uint8_t spk_stage;
145
146 //mic part
147 uint16_t mic_buffer[MIC_BUFFER_SIZE];
148 uint16_t *mic_roff;
149 uint16_t *mic_woff;
150 uint16_t *mic_wend;
151 uint32_t mic_wtotal;
152 uint32_t mic_rtotal;
153 uint32_t mic_delta;
154 uint16_t mic_calc;
155 uint16_t mic_adj_count;
156 uint8_t mic_adj_stage;
157 uint8_t mic_stage;
158
159 uint8_t mic_mute;
160 uint8_t spk_mute;
161
162 uint16_t mic_volume;
163 uint16_t spk_volume;
164
165 uint32_t spk_tx_size;
166 uint32_t mic_rx_size;
167
168 uint32_t spk_enable;
169 uint32_t mic_enable;
170
171}audio_codec_type;
172
173 error_status audio_codec_init(void);
174 error_status audio_codec_loop(void);
175void audio_codec_modify_freq(uint32_t freq);
176
180void audio_codec_spk_fifo_write(uint8_t *data, uint32_t len);
181uint32_t audio_codec_mic_get_data(uint8_t *buffer);
182uint8_t audio_codec_spk_feedback(uint8_t *feedback);
183void audio_codec_spk_alt_setting(uint32_t alt_seting);
184void audio_codec_mic_alt_setting(uint32_t alt_seting);
185void audio_codec_set_mic_mute(uint8_t mute);
186void audio_codec_set_spk_mute(uint8_t mute);
187void audio_codec_set_mic_volume(uint16_t volume);
188void audio_codec_set_spk_volume(uint16_t volume);
189void audio_codec_set_mic_freq(uint32_t freq);
190void audio_codec_set_spk_freq(uint32_t freq);
201#ifdef __cplusplus
202}
203#endif
204
205#endif
206
at32f413.h
at32f413 header file
buffer
uint8_t buffer[((uint16_t) 160) *((uint16_t) 120)]
Definition project/at_start_f413/examples/cortex_m4/fpu/src/main.c:42
error_status
error_status
error status
Definition at32f413.h:302
audio_codec_mic_alt_setting
void audio_codec_mic_alt_setting(uint32_t alt_seting)
audio codec microphone alt setting config
Definition audio/src/audio_codec.c:168
audio_codec_set_spk_volume
void audio_codec_set_spk_volume(uint16_t volume)
audio codec set speaker volume
Definition audio/src/audio_codec.c:220
audio_codec_set_spk_mute
void audio_codec_set_spk_mute(uint8_t mute)
audio codec set speaker mute
Definition audio/src/audio_codec.c:194
MIC_BUFFER_SIZE
#define MIC_BUFFER_SIZE
Definition audio/inc/audio_codec.h:126
audio_codec_set_mic_freq
void audio_codec_set_mic_freq(uint32_t freq)
audio codec set microphone freq
Definition audio/src/audio_codec.c:120
audio_codec_mic_get_data
uint32_t audio_codec_mic_get_data(uint8_t *buffer)
codec microphone get data
Definition audio/src/audio_codec.c:285
audio_codec_loop
error_status audio_codec_loop(void)
audio codec loop
Definition audio/src/audio_codec.c:856
SPK_BUFFER_SIZE
#define SPK_BUFFER_SIZE
Definition audio/inc/audio_codec.h:127
audio_codec_set_mic_mute
void audio_codec_set_mic_mute(uint8_t mute)
audio codec set microphone mute
Definition audio/src/audio_codec.c:183
audio_codec_spk_fifo_write
void audio_codec_spk_fifo_write(uint8_t *data, uint32_t len)
audio codec interface
Definition audio/src/audio_codec.c:247
audio_codec_spk_feedback
uint8_t audio_codec_spk_feedback(uint8_t *feedback)
codec speaker feedback
Definition audio/src/audio_codec.c:231
audio_codec_modify_freq
void audio_codec_modify_freq(uint32_t freq)
audio codec modify freq
Definition audio/src/audio_codec.c:345
audio_codec_set_mic_volume
void audio_codec_set_mic_volume(uint16_t volume)
audio codec set microphone volume
Definition audio/src/audio_codec.c:205
audio_codec_spk_alt_setting
void audio_codec_spk_alt_setting(uint32_t alt_seting)
audio codec speaker alt setting config
Definition audio/src/audio_codec.c:153
audio_codec_init
error_status audio_codec_init(void)
audio codec init
Definition audio/src/audio_codec.c:797
audio_codec_set_spk_freq
void audio_codec_set_spk_freq(uint32_t freq)
audio codec set speaker freq
Definition audio/src/audio_codec.c:136
audio_codec_type
Definition audio/inc/audio_codec.h:131
audio_codec_type::spk_mute
uint8_t spk_mute
Definition audio/inc/audio_codec.h:160
audio_codec_type::spk_threshold
uint16_t spk_threshold
Definition audio/inc/audio_codec.h:142
audio_codec_type::mic_enable
uint32_t mic_enable
Definition audio/inc/audio_codec.h:169
audio_codec_type::spk_stage
uint8_t spk_stage
Definition audio/inc/audio_codec.h:144
audio_codec_type::mic_roff
uint16_t * mic_roff
Definition audio/inc/audio_codec.h:148
audio_codec_type::mic_volume
uint16_t mic_volume
Definition audio/inc/audio_codec.h:162
audio_codec_type::spk_roff
uint16_t * spk_roff
Definition audio/inc/audio_codec.h:136
audio_codec_type::spk_rtotal
uint32_t spk_rtotal
Definition audio/inc/audio_codec.h:141
audio_codec_type::mic_delta
uint32_t mic_delta
Definition audio/inc/audio_codec.h:153
audio_codec_type::spk_calc
uint16_t spk_calc
Definition audio/inc/audio_codec.h:143
audio_codec_type::mic_woff
uint16_t * mic_woff
Definition audio/inc/audio_codec.h:149
audio_codec_type::mic_stage
uint8_t mic_stage
Definition audio/inc/audio_codec.h:157
audio_codec_type::mic_adj_count
uint16_t mic_adj_count
Definition audio/inc/audio_codec.h:155
audio_codec_type::spk_freq
uint32_t spk_freq
Definition audio/inc/audio_codec.h:139
audio_codec_type::audio_bitw
uint32_t audio_bitw
Definition audio/inc/audio_codec.h:133
audio_codec_type::mic_wend
uint16_t * mic_wend
Definition audio/inc/audio_codec.h:150
audio_codec_type::spk_rend
uint16_t * spk_rend
Definition audio/inc/audio_codec.h:138
audio_codec_type::mic_wtotal
uint32_t mic_wtotal
Definition audio/inc/audio_codec.h:151
audio_codec_type::spk_enable
uint32_t spk_enable
Definition audio/inc/audio_codec.h:168
audio_codec_type::mic_rtotal
uint32_t mic_rtotal
Definition audio/inc/audio_codec.h:152
audio_codec_type::audio_freq
uint32_t audio_freq
Definition audio/inc/audio_codec.h:132
audio_codec_type::mic_mute
uint8_t mic_mute
Definition audio/inc/audio_codec.h:159
audio_codec_type::spk_volume
uint16_t spk_volume
Definition audio/inc/audio_codec.h:163
audio_codec_type::mic_calc
uint16_t mic_calc
Definition audio/inc/audio_codec.h:154
audio_codec_type::spk_wtotal
uint32_t spk_wtotal
Definition audio/inc/audio_codec.h:140
audio_codec_type::mic_adj_stage
uint8_t mic_adj_stage
Definition audio/inc/audio_codec.h:156
audio_codec_type::spk_tx_size
uint32_t spk_tx_size
Definition audio/inc/audio_codec.h:165
audio_codec_type::mic_rx_size
uint32_t mic_rx_size
Definition audio/inc/audio_codec.h:166
audio_codec_type::spk_woff
uint16_t * spk_woff
Definition audio/inc/audio_codec.h:137


AT32F413 Firmwary Library: audio_codec.c Source File

  • usb_device
  • audio
  • src
audio/src/audio_codec.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "audio_codec.h"
28#include "i2c_application.h"
29#include "audio_conf.h"
30#include <string.h>
31
40#define I2C_TIMEOUT 0xFFFFFFFF
41
42#define I2Cx_SPEED 100000
43#define I2Cx_ADDRESS 0x00
44
45#define I2Cx_PORT I2C1
46#define I2Cx_CLK CRM_I2C1_PERIPH_CLOCK
47
48#define I2Cx_SCL_PIN GPIO_PINS_8
49#define I2Cx_SCL_GPIO_PORT GPIOB
50#define I2Cx_SCL_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
51
52#define I2Cx_SDA_PIN GPIO_PINS_9
53#define I2Cx_SDA_GPIO_PORT GPIOB
54#define I2Cx_SDA_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
55
59#define WM8988_REG_FREQ48K ((WM8988_R8_SAMPLE_RATE << 9) | 0x0081)
60#define WM8988_REG_FREQ16K ((WM8988_R8_SAMPLE_RATE << 9) | 0x0095)
61
65#define WM8988_REG_BITW16 ((WM8988_R7_AUDIO_INTERFACE << 9) | 0x0042)
66
70uint16_t reg_addr_data[] =
71{
72 (WM8988_R0_LEFT_INPUT_VOLUME << 9) | 0x012F, /*Left Input Channel Volume*/
73 (WM8988_R1_RIGHT_INPUT_VOLUME << 9) | 0x012F, /*Right Input Channel Volume*/
74 (WM8988_R2_LOUT1_VOLUME << 9) | 0x0179, /*Left Output Channel Volume*/
75 (WM8988_R3_ROUT1_VOLUME << 9) | 0x0179, /*Right Output Channel Volume*/
76 (WM8988_R5_ADC_DAC_CONTROL << 9) | 0x0006, /*De-emphasis Control and Digital soft mute*/
77 (WM8988_REG_BITW16),
78 (WM8988_REG_FREQ16K),
79 (WM8988_R10_LEFT_DAC_VOLUME << 9) | 0x01FF, /*Left Digital DAC Volume Control*/
80 (WM8988_R11_RIGHT_DAC_VOLUME << 9) | 0x01FF, /*Right Digital DAC Volume Control*/
81 (WM8988_R12_BASS_CONTROL << 9) | 0x000F, /*Bass Control*/
82 (WM8988_R13_TREBLE_CONTROL << 9) | 0x000F, /*Treble Control*/
83 (WM8988_R16_3D_CONTROL << 9) | 0x0000, /*3D stereo Enhancment*/
84 (WM8988_R21_LEFT_ADC_VOLUME << 9) | 0x01C3, /*Left ADC Digital Volume*/
85 (WM8988_R22_RIGHT_ADC_VOLUME << 9) | 0x01C3, /*Right ADC Digital Volume*/
86 (WM8988_R23_ADDITIONAL_1_CONTROL << 9) | 0x00C2, /*Additional Control 1*/
87 (WM8988_R24_ADDITIONAL_2_CONTROL << 9) | 0x0000, /*Additional Control 2*/
88 (WM8988_R27_ADDITIONAL_3_CONTROL << 9) | 0x0000, /*Additional Control 3*/
89 (WM8988_R31_ADC_INPUT_MODE << 9) | 0x0000, /*ADC input mode*/
90 (WM8988_R32_ADC_L_SIGNAL_PATH << 9) | 0x0000, /*ADC Signal Path Control left*/
91 (WM8988_R33_ADC_R_SIGNAL_PATH << 9) | 0x0000, /*ADC Signal Path Control right*/
92 (WM8988_R34_LEFT_OUT_MIX_1 << 9) | 0x0152, /*Left DAC mixer Control*/
93 (WM8988_R35_LEFT_OUT_MIX_2 << 9) | 0x0050, /*Left DAC mixer Control*/
94 (WM8988_R36_RIGHT_OUT_MIX_1 << 9) | 0x0052, /*Right DAC mixer Control*/
95 (WM8988_R37_RIGHT_OUT_MIX_2 << 9) | 0x0150, /*Right DAC mixer Control*/
96 (WM8988_R40_LOUT2_VOLUME << 9) | 0x01FF, /*Output left channel volume*/
97 (WM8988_R41_ROUT2_VOLUME << 9) | 0x01FF, /*Output left channel volume*/
98 (WM8988_R43_LOW_POWER_PALYBACK << 9) | 0x0008, /*Output left channel volume*/
99 (WM8988_R25_PWR_1_MGMT << 9) | 0x017C, /*Power Management1*/
100 (WM8988_R26_PWR_2_MGMT << 9) | 0x01F8, /*Power Management2*/
101};
102
103 i2c_handle_type hi2cx;
104
105 audio_codec_type audio_codec;
106uint16_t spk_dma_buffer[DMA_BUFFER_SIZE];
107uint16_t mic_dma_buffer[DMA_BUFFER_SIZE];
108
109void memset16_buffer(uint16_t *buffer, uint32_t set, uint32_t len);
110void codec_i2s_reset(void);
111void codec_i2s_init(audio_codec_type *param);
112void mclk_tmr1_init(void);
113void copy_buff(uint16_t *dest, uint16_t *src, uint32_t len);
114
120void audio_codec_set_mic_freq(uint32_t freq)
121{
122 if(audio_codec.audio_freq != freq)
123 {
124 audio_codec.audio_freq = freq;
125 codec_i2s_reset();
126 audio_codec_modify_freq(freq);
127 codec_i2s_init(&audio_codec);
128 }
129}
130
136void audio_codec_set_spk_freq(uint32_t freq)
137{
138 if(audio_codec.audio_freq != freq)
139 {
140 audio_codec.audio_freq = freq;
141 codec_i2s_reset();
142 audio_codec_modify_freq(freq);
143 codec_i2s_init(&audio_codec);
144 }
145}
146
147
153void audio_codec_spk_alt_setting(uint32_t alt_seting)
154{
155 if(alt_seting == 0)
156 {
157 }
158 else
159 {
160 }
161}
162
168void audio_codec_mic_alt_setting(uint32_t alt_seting)
169{
170 if(alt_seting == 0)
171 {
172 }
173 else
174 {
175 }
176}
177
183void audio_codec_set_mic_mute(uint8_t mute)
184{
185 audio_codec.mic_mute = mute;
186}
187
188
194void audio_codec_set_spk_mute(uint8_t mute)
195{
196 audio_codec.spk_mute = mute;
197}
198
199
205void audio_codec_set_mic_volume(uint16_t volume)
206{
207 /* wm8988 adc have 256 steps */
208 audio_codec.mic_volume = volume;
209 if(audio_codec.mic_volume > 0xFF)
210 {
211 audio_codec.mic_volume = 0xFF;
212 }
213}
214
220void audio_codec_set_spk_volume(uint16_t volume)
221{
222 /* wm8988 dac have 80 steps */
223 audio_codec.spk_volume = (volume * 0x50) / 0x64 + 0x30 - 1;
224}
225
231uint8_t audio_codec_spk_feedback(uint8_t *feedback)
232{
233 uint32_t feedback_value = (audio_codec.spk_freq);
234 feedback_value = ((feedback_value/1000)<<14)|((feedback_value%1000)<<4);
235 feedback[0] = (uint8_t)(feedback_value);
236 feedback[1] = (uint8_t)(feedback_value >> 8);
237 feedback[2] = (uint8_t)(feedback_value >> 16);
238 return 3;
239}
240
247void audio_codec_spk_fifo_write(uint8_t *data, uint32_t len)
248{
249 uint16_t ulen = len / 2, i;
250 uint16_t *u16data = (uint16_t *)data;
251
252 switch(audio_codec.spk_stage)
253 {
254 case 0:
255 audio_codec.spk_woff = audio_codec.spk_roff = audio_codec.spk_buffer;
256 audio_codec.spk_wtotal = audio_codec.spk_rtotal = 0;
257 audio_codec.spk_stage = 1;
258 audio_codec.spk_threshold = SPK_BUFFER_SIZE/2;
259 break;
260 case 1:
261 if( audio_codec.spk_wtotal >= SPK_BUFFER_SIZE/2 )
262 {
263 audio_codec.spk_stage = 2;
264 }
265 break;
266 case 2:
267 break;
268 }
269 for( i = 0; i < ulen; ++i )
270 {
271 *audio_codec.spk_woff++ = *u16data++;
272 if( audio_codec.spk_woff >= audio_codec.spk_rend )
273 {
274 audio_codec.spk_woff = audio_codec.spk_buffer;
275 }
276 }
277 audio_codec.spk_wtotal += ulen;
278}
279
285uint32_t audio_codec_mic_get_data(uint8_t *buffer)
286{
287 //copy_buff((uint16_t *)buffer, audio_codec.mic_buffer + audio_codec.mic_hf_status, audio_codec.mic_rx_size);
288 uint16_t len = audio_codec.mic_rx_size << 1;
289 uint16_t i;
290 uint16_t* u16buf = (uint16_t*)buffer;
291 switch(audio_codec.mic_stage)
292 {
293 case 0:
294 audio_codec.mic_stage = 1;
295 memset( buffer, 0, len );
296 return len;
297 case 1:
298 if( audio_codec.mic_wtotal - audio_codec.mic_rtotal >= MIC_BUFFER_SIZE/2 )
299 {
300 audio_codec.mic_stage = 2;
301 }
302 return len;
303 }
304 switch( audio_codec.mic_adj_stage )
305 {
306 case 0:
307 break;
308 case 1:
309 if( audio_codec.mic_adj_count >= 4 ){
310 len += 4;
311 audio_codec.mic_adj_count -= 4;
312 }
313 break;
314 case 2:
315 if( audio_codec.mic_adj_count >= 4 ){
316 len -= 4;
317 audio_codec.mic_adj_count -= 4;
318 }
319 break;
320 }
321
322 for( i = 0; i < len/2; ++i )
323 {
324 *u16buf++ = *audio_codec.mic_roff++;
325 if( audio_codec.mic_roff >= audio_codec.mic_wend )
326 {
327 audio_codec.mic_roff = audio_codec.mic_buffer;
328 }
329 }
330 if( audio_codec.mic_wtotal <= audio_codec.mic_rtotal )
331 { //should not happen
332 while(1);
333 }
334
335 audio_codec.mic_rtotal += len/2;
336 audio_codec.mic_delta += len/2;
337 return len;
338}
339
345void audio_codec_modify_freq(uint32_t freq)
346{
347 uint16_t codec_cmd;
348 uint8_t i2c_cmd[2];
349 if(freq == AUDIO_FREQ_16K)
350 {
351 codec_cmd = WM8988_REG_FREQ16K;
352 }
353 else if(freq == AUDIO_FREQ_48K)
354 {
355 codec_cmd = WM8988_REG_FREQ48K;
356 }
357 i2c_cmd[0] = (uint8_t)(codec_cmd >> 8);
358 i2c_cmd[1] = (uint8_t)codec_cmd & 0xFF;
359 if(i2c_master_transmit(&hi2cx, WM8988_I2C_ADDR_CSB_LOW, (uint8_t *)i2c_cmd, 2, 0xFFFF) != I2C_OK)
360 {
361 while(1);
362 }
363}
364
372void memset16_buffer(uint16_t *buffer, uint32_t set, uint32_t len)
373{
374 uint32_t i_index = 0;
375 for(i_index = 0; i_index < len; i_index ++)
376 {
377 buffer[i_index] = (uint16_t)set;
378 }
379}
380
388void copy_buff(uint16_t *dest, uint16_t *src, uint32_t len)
389{
390 uint16_t i_index;
391 for(i_index = 0; i_index < len; i_index ++)
392 {
393 dest[i_index] = src[i_index];
394 }
395}
396
402void i2c_lowlevel_init(i2c_handle_type* hi2c)
403{
404 gpio_init_type gpio_initstructure;
405
406 if(hi2c->i2cx == I2Cx_PORT)
407 {
408 /* i2c periph clock enable */
409 crm_periph_clock_enable(I2Cx_CLK, TRUE);
410 crm_periph_clock_enable(CRM_IOMUX_PERIPH_CLOCK, TRUE);
411 gpio_pin_remap_config(I2C1_MUX, TRUE);
412 crm_periph_clock_enable(I2Cx_SCL_GPIO_CLK, TRUE);
413 crm_periph_clock_enable(I2Cx_SDA_GPIO_CLK, TRUE);
414
415 /* gpio configuration */
416 gpio_initstructure.gpio_out_type = GPIO_OUTPUT_OPEN_DRAIN;
417 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
418 gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
419 gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_MODERATE;
420
421 /* configure i2c pins: scl */
422 gpio_initstructure.gpio_pins = I2Cx_SCL_PIN;
423 gpio_init(I2Cx_SCL_GPIO_PORT, &gpio_initstructure);
424
425 /* configure i2c pins: sda */
426 gpio_initstructure.gpio_pins = I2Cx_SDA_PIN;
427 gpio_init(I2Cx_SDA_GPIO_PORT, &gpio_initstructure);
428
429 i2c_init(hi2c->i2cx, I2C_FSMODE_DUTY_2_1, I2Cx_SPEED);
430
431 i2c_own_address1_set(hi2c->i2cx, I2C_ADDRESS_MODE_7BIT, I2Cx_ADDRESS);
432 }
433}
434
440void mclk_tmr1_init(void)
441{
442 gpio_init_type gpio_init_struct;
443 tmr_output_config_type tmr_oc_init_structure;
444 uint16_t prescaler_value = (uint16_t)(system_core_clock / 24000000) - 1;
445
446 crm_periph_clock_enable(CRM_TMR1_PERIPH_CLOCK, TRUE);
447 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
448 crm_periph_clock_enable(CRM_IOMUX_PERIPH_CLOCK, TRUE);
449
450 gpio_default_para_init(&gpio_init_struct);
451
452 gpio_init_struct.gpio_pins = GPIO_PINS_8;
453 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
454 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_MODERATE;
455 gpio_init(GPIOA, &gpio_init_struct);
456
457 tmr_base_init(TMR1, 1, prescaler_value);
458 tmr_cnt_dir_set(TMR1, TMR_COUNT_UP);
459 tmr_clock_source_div_set(TMR1, TMR_CLOCK_DIV1);
460
461 tmr_output_default_para_init(&tmr_oc_init_structure);
462 tmr_oc_init_structure.oc_mode = TMR_OUTPUT_CONTROL_PWM_MODE_A;
463 tmr_oc_init_structure.oc_idle_state = FALSE;
464 tmr_oc_init_structure.oc_polarity = TMR_OUTPUT_ACTIVE_HIGH;
465 tmr_oc_init_structure.oc_output_state = TRUE;
466 tmr_output_channel_config(TMR1, TMR_SELECT_CHANNEL_1, &tmr_oc_init_structure);
467 tmr_channel_value_set(TMR1, TMR_SELECT_CHANNEL_1, 1);
468 tmr_output_channel_buffer_enable(TMR1, TMR_SELECT_CHANNEL_1, TRUE);
469
470 /* tmr enable counter */
471 tmr_counter_enable(TMR1, TRUE);
472 tmr_output_enable(TMR1, TRUE);
473}
474
475
481void codec_i2s_reset(void)
482{
483 i2s_enable(SPI1, FALSE);
484 i2s_enable(SPI2, FALSE);
485 dma_channel_enable(DMA1_CHANNEL3, FALSE);
486 dma_channel_enable(DMA1_CHANNEL4, FALSE);
487}
488
495void codec_i2s_init(audio_codec_type *param)
496{
497 gpio_init_type gpio_init_struct;
498 dma_init_type dma_init_struct;
499 i2s_init_type i2s_init_struct;
500 i2s_data_channel_format_type format = I2S_DATA_16BIT_CHANNEL_16BIT;
501
502 crm_periph_clock_enable(I2S1_GPIO_CRM_CLK, TRUE);
503 crm_periph_clock_enable(I2S2_GPIO_CRM_CLK, TRUE);
504 crm_periph_clock_enable(CRM_DMA1_PERIPH_CLOCK, TRUE);
505 crm_periph_clock_enable(CRM_SPI1_PERIPH_CLOCK, TRUE);
506 crm_periph_clock_enable(CRM_SPI2_PERIPH_CLOCK, TRUE);
507
508 param->spk_freq = param->audio_freq;
509
510 param->spk_tx_size = (param->audio_freq / 1000) * (param->audio_bitw / 8) * AUDIO_SPK_CHANEL_NUM / 2;
511 param->mic_rx_size = (param->audio_freq / 1000) * (param->audio_bitw / 8) * AUDIO_MIC_CHANEL_NUM / 2;
512
513 memset(param->spk_buffer, 0, SPK_BUFFER_SIZE*sizeof(uint16_t));
514 memset(param->mic_buffer, 0, MIC_BUFFER_SIZE*sizeof(uint16_t));
515
516 param->mic_wend = param->mic_woff = param->mic_roff = param->mic_buffer;
517 param->spk_rend = param->spk_woff = param->spk_roff = param->spk_buffer;
518
519 while(param->mic_wend < param->mic_buffer+MIC_BUFFER_SIZE)
520 {
521 param->mic_wend += param->mic_rx_size;
522 }
523 param->mic_wend -= param->mic_rx_size;
524 while(param->spk_rend < param->spk_buffer+SPK_BUFFER_SIZE)
525 {
526 param->spk_rend += param->spk_tx_size;
527 }
528 param->spk_rend -= param->spk_tx_size;
529 if(param->audio_bitw == 16)
530 {
531 format = I2S_DATA_16BIT_CHANNEL_16BIT;
532 }
533 else
534 {
535 format = I2S_DATA_24BIT_CHANNEL_32BIT;
536 }
537 gpio_default_para_init(&gpio_init_struct);
538
539 /* i2s1 ws pins */
540 gpio_init_struct.gpio_pull = GPIO_PULL_UP;
541 gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
542 gpio_init_struct.gpio_pins = I2S1_WS_PIN;
543 gpio_init(I2S1_GPIO, &gpio_init_struct);
544
545 /* i2s1 ck pins */
546 gpio_init_struct.gpio_pull = GPIO_PULL_DOWN;
547 gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
548 gpio_init_struct.gpio_pins = I2S1_CK_PIN;
549 gpio_init(I2S1_GPIO, &gpio_init_struct);
550
551 /* i2s1 sd pins slave tx */
552 gpio_init_struct.gpio_pull = GPIO_PULL_UP;
553 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
554 gpio_init_struct.gpio_pins = I2S1_SD_PIN;
555 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_MODERATE;
556 gpio_init(I2S1_GPIO, &gpio_init_struct);
557
558 /* i2s2 ws pins */
559 gpio_init_struct.gpio_pull = GPIO_PULL_UP;
560 gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
561 gpio_init_struct.gpio_pins = I2S2_WS_PIN;
562 gpio_init(I2S2_GPIO, &gpio_init_struct);
563
564 /* i2s2 ck pins */
565 gpio_init_struct.gpio_pull = GPIO_PULL_DOWN;
566 gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
567 gpio_init_struct.gpio_pins = I2S2_CK_PIN;
568 gpio_init(I2S2_GPIO, &gpio_init_struct);
569
570 /* i2s2 sd pins slave rx */
571 gpio_init_struct.gpio_pull = GPIO_PULL_UP;
572 gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
573 gpio_init_struct.gpio_pins = I2S2_SD_PIN;
574 gpio_init(I2S2_GPIO, &gpio_init_struct);
575
576 /* dma config */
577 dma_reset(DMA1_CHANNEL3);
578 dma_reset(DMA1_CHANNEL4);
579
580 /* dma1 channel3: speaker i2s1 tx */
581 dma_default_para_init(&dma_init_struct);
582 dma_init_struct.buffer_size = param->spk_tx_size << 1;
583 dma_init_struct.direction = DMA_DIR_MEMORY_TO_PERIPHERAL;
584 dma_init_struct.memory_base_addr = (uint32_t)spk_dma_buffer;
585 dma_init_struct.memory_data_width = DMA_MEMORY_DATA_WIDTH_HALFWORD;
586 dma_init_struct.memory_inc_enable = TRUE;
587 dma_init_struct.peripheral_base_addr = (uint32_t)I2S1_DT_ADDRESS;
588 dma_init_struct.peripheral_data_width = DMA_PERIPHERAL_DATA_WIDTH_HALFWORD;
589 dma_init_struct.peripheral_inc_enable = FALSE;
590 dma_init_struct.priority = DMA_PRIORITY_HIGH;
591 dma_init_struct.loop_mode_enable = TRUE;
592 dma_init(DMA1_CHANNEL3, &dma_init_struct);
593 dma_interrupt_enable(DMA1_CHANNEL3, DMA_FDT_INT, TRUE);
594 dma_interrupt_enable(DMA1_CHANNEL3, DMA_HDT_INT, TRUE);
595 nvic_irq_enable(DMA1_Channel3_IRQn, 1, 0);
596
597 /* dma1 channel4: microphone i2s2 rx */
598 dma_default_para_init(&dma_init_struct);
599 dma_init_struct.buffer_size = param->mic_rx_size << 1;
600 dma_init_struct.direction = DMA_DIR_PERIPHERAL_TO_MEMORY;
601 dma_init_struct.memory_base_addr = (uint32_t)mic_dma_buffer;
602 dma_init_struct.memory_data_width = DMA_MEMORY_DATA_WIDTH_HALFWORD;
603 dma_init_struct.memory_inc_enable = TRUE;
604 dma_init_struct.peripheral_base_addr = (uint32_t)I2S2_DT_ADDRESS;
605 dma_init_struct.peripheral_data_width = DMA_PERIPHERAL_DATA_WIDTH_HALFWORD;
606 dma_init_struct.peripheral_inc_enable = FALSE;
607 dma_init_struct.priority = DMA_PRIORITY_HIGH;
608 dma_init_struct.loop_mode_enable = TRUE;
609 dma_init(DMA1_CHANNEL4, &dma_init_struct);
610 dma_interrupt_enable(DMA1_CHANNEL4, DMA_FDT_INT, TRUE);
611 dma_interrupt_enable(DMA1_CHANNEL4, DMA_HDT_INT, TRUE);
612 nvic_irq_enable(DMA1_Channel4_IRQn, 2, 0);
613
614 /* i2s1 tx init */
615 spi_i2s_reset(SPI1);
616 i2s_default_para_init(&i2s_init_struct);
617 i2s_init_struct.audio_protocol = I2S_AUDIO_PROTOCOL_PHILLIPS;
618 i2s_init_struct.data_channel_format = format;
619 i2s_init_struct.mclk_output_enable = FALSE;
620 i2s_init_struct.audio_sampling_freq = (i2s_audio_sampling_freq_type)param->audio_freq;
621 i2s_init_struct.clock_polarity = I2S_CLOCK_POLARITY_LOW;
622 i2s_init_struct.operation_mode = I2S_MODE_SLAVE_TX;
623 i2s_init(SPI1, &i2s_init_struct);
624
625 /* i2s2 rx init */
626 spi_i2s_reset(SPI2);
627 i2s_default_para_init(&i2s_init_struct);
628 i2s_init_struct.audio_protocol = I2S_AUDIO_PROTOCOL_PHILLIPS;
629 i2s_init_struct.data_channel_format = format;
630 i2s_init_struct.mclk_output_enable = FALSE;
631 i2s_init_struct.audio_sampling_freq = (i2s_audio_sampling_freq_type)param->audio_freq;
632 i2s_init_struct.clock_polarity = I2S_CLOCK_POLARITY_LOW;
633 i2s_init_struct.operation_mode = I2S_MODE_SLAVE_RX;
634 i2s_init(SPI2, &i2s_init_struct);
635
636
637 spi_i2s_dma_transmitter_enable(SPI1, TRUE);
638 spi_i2s_dma_receiver_enable(SPI2, TRUE);
639 i2s_enable(SPI1, TRUE);
640 i2s_enable(SPI2, TRUE);
641
642 dma_channel_enable(DMA1_CHANNEL3, TRUE);
643 dma_channel_enable(DMA1_CHANNEL4, TRUE);
644
645}
646
652void DMA1_Channel3_IRQHandler(void)
653{
654 uint16_t half_size = audio_codec.spk_tx_size;
655 uint16_t *pdst;
656
657 if(dma_interrupt_flag_get(DMA1_HDT3_FLAG) == SET)
658 {
659 //copy_buff(audio_codec.spk_buffer, audio_codec.spk_tx_fifo + audio_codec.r_pos, half_size);
660 pdst = spk_dma_buffer;
661 dma_flag_clear(DMA1_HDT3_FLAG);
662 }
663 else if(dma_interrupt_flag_get(DMA1_FDT3_FLAG) == SET)
664 {
665 //copy_buff(&audio_codec.spk_buffer[half_size], audio_codec.spk_tx_fifo + audio_codec.r_pos, half_size);
666 pdst = spk_dma_buffer + half_size;
667 dma_flag_clear(DMA1_FDT3_FLAG);
668 }
669
670 switch( audio_codec.spk_stage )
671 {
672 case 0:
673 case 1:
674 memset( pdst, 0, half_size << 1);
675 break;
676 case 2:
677 if( audio_codec.spk_wtotal >= audio_codec.spk_rtotal + SPK_BUFFER_SIZE )
678 {
679 while(1);//should not happen;
680 }
681 if( audio_codec.spk_rtotal >= audio_codec.spk_wtotal )
682 {
683 audio_codec.spk_stage = 0;
684 audio_codec.spk_woff = audio_codec.spk_roff = audio_codec.spk_buffer;
685 audio_codec.spk_rtotal = audio_codec.spk_wtotal = 0;
686 }
687 else
688 {
689 memcpy( pdst, audio_codec.spk_roff, half_size << 1 );
690 audio_codec.spk_roff += half_size;
691 audio_codec.spk_rtotal += half_size;
692 if( audio_codec.spk_roff >= audio_codec.spk_rend )
693 {
694 audio_codec.spk_roff = audio_codec.spk_buffer;
695 }
696 if( ++audio_codec.spk_calc == 256 )
697 {
698 uint16_t delta = audio_codec.spk_wtotal - audio_codec.spk_rtotal;
699 audio_codec.spk_calc = 0;
700 if( delta < audio_codec.spk_threshold - half_size )
701 {
702 audio_codec.spk_threshold -= half_size;
703 audio_codec.spk_freq += audio_codec.audio_freq/1024;
704 }
705 else if( delta > audio_codec.spk_threshold + half_size )
706 {
707 audio_codec.spk_threshold += half_size;
708 audio_codec.spk_freq -= audio_codec.audio_freq/1024;
709 }
710 if(audio_codec.spk_rtotal > 0x20000000)
711 {
712 audio_codec.spk_rtotal -= 0x10000000;
713 audio_codec.spk_wtotal -= 0x10000000;
714 }
715 }
716 }
717 break;
718 }
719
720}
721
727void DMA1_Channel4_IRQHandler(void)
728{
729 uint16_t *psrc;
730 uint16_t len = audio_codec.mic_rx_size << 1;
731
732 if(dma_interrupt_flag_get(DMA1_HDT4_FLAG) == SET)
733 {
734 dma_flag_clear(DMA1_HDT4_FLAG);
735 psrc = mic_dma_buffer;
736 }
737 else if(dma_interrupt_flag_get(DMA1_FDT4_FLAG) == SET)
738 {
739 psrc = mic_dma_buffer + audio_codec.mic_rx_size;
740 dma_flag_clear(DMA1_FDT4_FLAG);
741 }
742 if( audio_codec.mic_stage )
743 {
744 memcpy( audio_codec.mic_woff, psrc, len );
745 audio_codec.mic_woff += len/2;
746 audio_codec.mic_wtotal += len/2;
747 if( audio_codec.mic_woff >= audio_codec.mic_wend )
748 {
749 audio_codec.mic_woff = audio_codec.mic_buffer;
750 }
751 if( audio_codec.mic_stage == 2 )
752 {
753 if( 1024 == ++audio_codec.mic_calc )
754 {
755 uint32_t size_estimate = 1024*audio_codec.mic_rx_size;
756 audio_codec.mic_calc = 0;
757 if( audio_codec.mic_delta > size_estimate )
758 {
759 audio_codec.mic_adj_count = audio_codec.mic_delta - size_estimate;
760 audio_codec.mic_adj_stage = 2;
761 }
762 else if( audio_codec.mic_delta < size_estimate )
763 {
764 audio_codec.mic_adj_count = size_estimate - audio_codec.mic_delta;
765 audio_codec.mic_adj_stage = 1;
766 }
767 else
768 {
769 audio_codec.mic_adj_count = 0;
770 audio_codec.mic_adj_stage = 0;
771 }
772 audio_codec.mic_delta = 0;
773 if( audio_codec.mic_rtotal >= 0x80000000 )
774 {
775 audio_codec.mic_rtotal -= 0x80000000;
776 audio_codec.mic_wtotal -= 0x80000000;
777 }
778 }
779 if( audio_codec.mic_wtotal >= audio_codec.mic_rtotal + MIC_BUFFER_SIZE )
780 {
781 audio_codec.mic_delta = audio_codec.mic_wtotal = audio_codec.mic_rtotal = 0;
782 audio_codec.mic_woff = audio_codec.mic_roff = audio_codec.mic_buffer;
783 audio_codec.mic_stage = 0;
784 audio_codec.mic_adj_stage = 0;
785 audio_codec.mic_adj_count = 0;
786 audio_codec.mic_calc = 0;
787 }
788 }
789 }
790}
791
797 error_status audio_codec_init(void)
798{
799 uint32_t reg_len = sizeof(reg_addr_data) / sizeof(uint16_t);
800 uint32_t i_index = 0;
801 uint8_t i2c_cmd[2];
802
803 if(AUDIO_DEFAULT_FREQ == AUDIO_FREQ_16K)
804 {
805 reg_addr_data[6] = WM8988_REG_FREQ16K;
806 audio_codec.audio_freq = AUDIO_FREQ_16K;
807 }
808 else if(AUDIO_DEFAULT_FREQ == AUDIO_FREQ_48K)
809 {
810 reg_addr_data[6] = WM8988_REG_FREQ48K;
811 audio_codec.audio_freq = AUDIO_FREQ_48K;
812 }
813 else
814 {
815 return ERROR;
816 }
817
818 if(AUDIO_DEFAULT_BITW == AUDIO_BITW_16)
819 {
820 reg_addr_data[5] = WM8988_REG_BITW16;
821 audio_codec.audio_bitw = AUDIO_BITW_16;
822 }
823 else
824 {
825 return ERROR;
826 }
827
828 /* i2c init */
829 hi2cx.i2cx = I2Cx_PORT;
830
831 i2c_config(&hi2cx);
832
833 for(i_index = 0; i_index < reg_len; i_index ++)
834 {
835 i2c_cmd[0] = (uint8_t)(reg_addr_data[i_index] >> 8);
836 i2c_cmd[1] = (uint8_t)reg_addr_data[i_index] & 0xFF;
837 if(i2c_master_transmit(&hi2cx, WM8988_I2C_ADDR_CSB_LOW, (uint8_t *)i2c_cmd, 2, 0xFFFF) != I2C_OK)
838 {
839 return ERROR;
840 }
841 }
842
843 /* timer init */
844 mclk_tmr1_init();
845
846 codec_i2s_init(&audio_codec);
847
848 return SUCCESS;
849}
850
856 error_status audio_codec_loop(void)
857{
858 static uint8_t mic_mute = 0;
859 static uint16_t mic_volume = 0;
860 static uint8_t spk_mute = 0;
861 static uint16_t spk_volume = 0;
862 uint16_t audio_ctrl_l;
863 uint16_t audio_ctrl_r;
864 uint8_t i2c_cmd[2];
865
866 if(mic_mute != audio_codec.mic_mute)
867 {
868 mic_mute = audio_codec.mic_mute;
869 audio_ctrl_l = WM8988_R21_LEFT_ADC_VOLUME << 9 | 0x100;
870 audio_ctrl_r = WM8988_R22_RIGHT_ADC_VOLUME << 9 | 0x100;
871 if(audio_codec.mic_mute == 0)
872 {
873 audio_ctrl_l |= audio_codec.mic_volume;
874 audio_ctrl_r |= audio_codec.mic_volume;
875 }
876 i2c_cmd[0] = (uint8_t)(audio_ctrl_l >> 8);
877 i2c_cmd[1] = (uint8_t)audio_ctrl_l & 0xFF;
878 if(i2c_master_transmit(&hi2cx, WM8988_I2C_ADDR_CSB_LOW, (uint8_t *)i2c_cmd, 2, 0xFFFF) != I2C_OK)
879 {
880 return ERROR;
881 }
882 i2c_cmd[0] = (uint8_t)(audio_ctrl_r >> 8);
883 i2c_cmd[1] = (uint8_t)audio_ctrl_r & 0xFF;
884 if(i2c_master_transmit(&hi2cx, WM8988_I2C_ADDR_CSB_LOW, (uint8_t *)i2c_cmd, 2, 0xFFFF) != I2C_OK)
885 {
886 return ERROR;
887 }
888 }
889
890 if(mic_volume != audio_codec.mic_volume)
891 {
892 mic_volume = audio_codec.mic_volume;
893 audio_ctrl_l = WM8988_R21_LEFT_ADC_VOLUME << 9 | 0x100;
894 audio_ctrl_r = WM8988_R22_RIGHT_ADC_VOLUME << 9 | 0x100;
895 audio_ctrl_l |= audio_codec.mic_volume;
896 audio_ctrl_r |= audio_codec.mic_volume;
897 i2c_cmd[0] = (uint8_t)(audio_ctrl_l >> 8);
898 i2c_cmd[1] = (uint8_t)audio_ctrl_l & 0xFF;
899 if(i2c_master_transmit(&hi2cx, WM8988_I2C_ADDR_CSB_LOW, (uint8_t *)i2c_cmd, 2, 0xFFFF) != I2C_OK)
900 {
901 return ERROR;
902 }
903 i2c_cmd[0] = (uint8_t)(audio_ctrl_r >> 8);
904 i2c_cmd[1] = (uint8_t)audio_ctrl_r & 0xFF;
905 if(i2c_master_transmit(&hi2cx, WM8988_I2C_ADDR_CSB_LOW, (uint8_t *)i2c_cmd, 2, 0xFFFF) != I2C_OK)
906 {
907 return ERROR;
908 }
909 }
910
911 if(spk_mute != audio_codec.spk_mute)
912 {
913 spk_mute = audio_codec.spk_mute;
914 audio_ctrl_l = (WM8988_R5_ADC_DAC_CONTROL << 9) | 0x0006 | (audio_codec.spk_mute << 3);
915 i2c_cmd[0] = (uint8_t)(audio_ctrl_l >> 8);
916 i2c_cmd[1] = (uint8_t)audio_ctrl_l & 0xFF;
917 if(i2c_master_transmit(&hi2cx, WM8988_I2C_ADDR_CSB_LOW, (uint8_t *)i2c_cmd, 2, 0xFFFF) != I2C_OK)
918 {
919 return ERROR;
920 }
921 }
922
923 if(spk_volume != audio_codec.spk_volume)
924 {
925 spk_volume = audio_codec.spk_volume;
926 audio_ctrl_l = WM8988_R2_LOUT1_VOLUME << 9 | 0x100;
927 audio_ctrl_r = WM8988_R3_ROUT1_VOLUME << 9 | 0x100;
928 audio_ctrl_l |= audio_codec.spk_volume;
929 audio_ctrl_r |= audio_codec.spk_volume;
930
931 i2c_cmd[0] = (uint8_t)(audio_ctrl_l >> 8);
932 i2c_cmd[1] = (uint8_t)audio_ctrl_l & 0xFF;
933
934 if(i2c_master_transmit(&hi2cx, WM8988_I2C_ADDR_CSB_LOW, (uint8_t *)i2c_cmd, 2, 0xFFFF) != I2C_OK)
935 {
936 return ERROR;
937 }
938 i2c_cmd[0] = (uint8_t)(audio_ctrl_r >> 8);
939 i2c_cmd[1] = (uint8_t)audio_ctrl_r & 0xFF;
940 if(i2c_master_transmit(&hi2cx, WM8988_I2C_ADDR_CSB_LOW, (uint8_t *)i2c_cmd, 2, 0xFFFF) != I2C_OK)
941 {
942 return ERROR;
943 }
944 }
945 return SUCCESS;
946}
947
buffer
uint8_t buffer[((uint16_t) 160) *((uint16_t) 120)]
Definition project/at_start_f413/examples/cortex_m4/fpu/src/main.c:42
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
dma_init_struct
dma_init_type dma_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:38
tmr_oc_init_structure
tmr_output_config_type tmr_oc_init_structure
Definition project/at_start_f413/examples/tmr/oc_high/src/main.c:37
reg_addr_data
uint16_t reg_addr_data[]
wm8988 register default value
Definition audio/src/audio_codec.c:70
audio_codec_mic_alt_setting
void audio_codec_mic_alt_setting(uint32_t alt_seting)
audio codec microphone alt setting config
Definition audio/src/audio_codec.c:168
codec_i2s_reset
void codec_i2s_reset(void)
audio codec i2s reset
Definition audio/src/audio_codec.c:481
spk_dma_buffer
uint16_t spk_dma_buffer[DMA_BUFFER_SIZE]
Definition audio/src/audio_codec.c:106
audio_codec_set_spk_volume
void audio_codec_set_spk_volume(uint16_t volume)
audio codec set speaker volume
Definition audio/src/audio_codec.c:220
audio_codec_set_spk_mute
void audio_codec_set_spk_mute(uint8_t mute)
audio codec set speaker mute
Definition audio/src/audio_codec.c:194
WM8988_REG_FREQ48K
#define WM8988_REG_FREQ48K
wm8988 freq
Definition audio/src/audio_codec.c:59
audio_codec_set_mic_freq
void audio_codec_set_mic_freq(uint32_t freq)
audio codec set microphone freq
Definition audio/src/audio_codec.c:120
I2Cx_ADDRESS
#define I2Cx_ADDRESS
Definition audio/src/audio_codec.c:43
I2Cx_CLK
#define I2Cx_CLK
Definition audio/src/audio_codec.c:46
audio_codec_mic_get_data
uint32_t audio_codec_mic_get_data(uint8_t *buffer)
codec microphone get data
Definition audio/src/audio_codec.c:285
WM8988_REG_BITW16
#define WM8988_REG_BITW16
wm8988 bit width
Definition audio/src/audio_codec.c:65
audio_codec_loop
error_status audio_codec_loop(void)
audio codec loop
Definition audio/src/audio_codec.c:856
codec_i2s_init
void codec_i2s_init(audio_codec_type *param)
audio codec i2s init
Definition audio/src/audio_codec.c:495
audio_codec_set_mic_mute
void audio_codec_set_mic_mute(uint8_t mute)
audio codec set microphone mute
Definition audio/src/audio_codec.c:183
audio_codec_spk_fifo_write
void audio_codec_spk_fifo_write(uint8_t *data, uint32_t len)
codec speaker write fifo
Definition audio/src/audio_codec.c:247
I2Cx_SDA_PIN
#define I2Cx_SDA_PIN
Definition audio/src/audio_codec.c:52
I2Cx_SCL_PIN
#define I2Cx_SCL_PIN
Definition audio/src/audio_codec.c:48
mic_dma_buffer
uint16_t mic_dma_buffer[DMA_BUFFER_SIZE]
Definition audio/src/audio_codec.c:107
audio_codec_spk_feedback
uint8_t audio_codec_spk_feedback(uint8_t *feedback)
codec speaker feedback
Definition audio/src/audio_codec.c:231
hi2cx
i2c_handle_type hi2cx
Definition audio/src/audio_codec.c:103
DMA1_Channel4_IRQHandler
void DMA1_Channel4_IRQHandler(void)
this function handles dma1 channel4 interrupt.
Definition audio/src/audio_codec.c:727
audio_codec_modify_freq
void audio_codec_modify_freq(uint32_t freq)
audio codec modify freq
Definition audio/src/audio_codec.c:345
I2Cx_SDA_GPIO_PORT
#define I2Cx_SDA_GPIO_PORT
Definition audio/src/audio_codec.c:53
audio_codec_set_mic_volume
void audio_codec_set_mic_volume(uint16_t volume)
audio codec set microphone volume
Definition audio/src/audio_codec.c:205
mclk_tmr1_init
void mclk_tmr1_init(void)
mclk clock conifg
Definition audio/src/audio_codec.c:440
DMA1_Channel3_IRQHandler
void DMA1_Channel3_IRQHandler(void)
this function handles dma1 channel3 interrupt.
Definition audio/src/audio_codec.c:652
I2Cx_SDA_GPIO_CLK
#define I2Cx_SDA_GPIO_CLK
Definition audio/src/audio_codec.c:54
audio_codec
audio_codec_type audio_codec
Definition audio/src/audio_codec.c:105
audio_codec_spk_alt_setting
void audio_codec_spk_alt_setting(uint32_t alt_seting)
audio codec speaker alt setting config
Definition audio/src/audio_codec.c:153
i2c_lowlevel_init
void i2c_lowlevel_init(i2c_handle_type *hi2c)
initializes peripherals used by the i2c.
Definition audio/src/audio_codec.c:402
I2Cx_SPEED
#define I2Cx_SPEED
Definition audio/src/audio_codec.c:42
audio_codec_init
error_status audio_codec_init(void)
audio codec init
Definition audio/src/audio_codec.c:797
WM8988_REG_FREQ16K
#define WM8988_REG_FREQ16K
Definition audio/src/audio_codec.c:60
copy_buff
void copy_buff(uint16_t *dest, uint16_t *src, uint32_t len)
copy buffer
Definition audio/src/audio_codec.c:388
memset16_buffer
void memset16_buffer(uint16_t *buffer, uint32_t set, uint32_t len)
buffer memset
Definition audio/src/audio_codec.c:372
I2Cx_PORT
#define I2Cx_PORT
Definition audio/src/audio_codec.c:45
audio_codec_set_spk_freq
void audio_codec_set_spk_freq(uint32_t freq)
audio codec set speaker freq
Definition audio/src/audio_codec.c:136
I2Cx_SCL_GPIO_CLK
#define I2Cx_SCL_GPIO_CLK
Definition audio/src/audio_codec.c:50
I2Cx_SCL_GPIO_PORT
#define I2Cx_SCL_GPIO_PORT
Definition audio/src/audio_codec.c:49
i2c_config
void i2c_config(i2c_handle_type *hi2c)
i2c peripheral initialization.
Definition i2c_application.c:111
i2c_master_transmit
i2c_status_type i2c_master_transmit(i2c_handle_type *hi2c, uint16_t address, uint8_t *pdata, uint16_t size, uint32_t timeout)
the master transmits data through polling mode.
Definition i2c_application.c:421
system_core_clock
unsigned int system_core_clock
Definition system_at32f413.c:47
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_SPI2_PERIPH_CLOCK
@ CRM_SPI2_PERIPH_CLOCK
Definition at32f413_crm.h:130
CRM_IOMUX_PERIPH_CLOCK
@ CRM_IOMUX_PERIPH_CLOCK
Definition at32f413_crm.h:108
CRM_SPI1_PERIPH_CLOCK
@ CRM_SPI1_PERIPH_CLOCK
Definition at32f413_crm.h:117
CRM_DMA1_PERIPH_CLOCK
@ CRM_DMA1_PERIPH_CLOCK
Definition at32f413_crm.h:103
CRM_TMR1_PERIPH_CLOCK
@ CRM_TMR1_PERIPH_CLOCK
Definition at32f413_crm.h:116
DMA1_Channel3_IRQn
@ DMA1_Channel3_IRQn
Definition at32f413.h:184
DMA1_Channel4_IRQn
@ DMA1_Channel4_IRQn
Definition at32f413.h:185
dma_channel_enable
void dma_channel_enable(dma_channel_type *dmax_channely, confirm_state new_state)
enable or disable dma channely
Definition at32f413_dma.c:197
dma_default_para_init
void dma_default_para_init(dma_init_type *dma_init_struct)
dma init config with its default value.
Definition at32f413_dma.c:407
dma_interrupt_flag_get
flag_status dma_interrupt_flag_get(uint32_t dmax_flag)
get dma interrupt flag
Definition at32f413_dma.c:297
dma_interrupt_enable
void dma_interrupt_enable(dma_channel_type *dmax_channely, uint32_t dma_int, confirm_state new_state)
enable or disable dma interrupt
Definition at32f413_dma.c:164
dma_flag_clear
void dma_flag_clear(uint32_t dmax_flag)
clear dma flag
Definition at32f413_dma.c:389
dma_reset
void dma_reset(dma_channel_type *dmax_channely)
reset the dmax channely registers.
Definition at32f413_dma.c:63
dma_init
void dma_init(dma_channel_type *dmax_channely, dma_init_type *dma_init_struct)
dma init
Definition at32f413_dma.c:442
DMA_PERIPHERAL_DATA_WIDTH_HALFWORD
@ DMA_PERIPHERAL_DATA_WIDTH_HALFWORD
Definition at32f413_dma.h:246
DMA_DIR_MEMORY_TO_PERIPHERAL
@ DMA_DIR_MEMORY_TO_PERIPHERAL
Definition at32f413_dma.h:217
DMA_DIR_PERIPHERAL_TO_MEMORY
@ DMA_DIR_PERIPHERAL_TO_MEMORY
Definition at32f413_dma.h:216
DMA_MEMORY_DATA_WIDTH_HALFWORD
@ DMA_MEMORY_DATA_WIDTH_HALFWORD
Definition at32f413_dma.h:256
DMA_PRIORITY_HIGH
@ DMA_PRIORITY_HIGH
Definition at32f413_dma.h:267
DMA1_HDT4_FLAG
#define DMA1_HDT4_FLAG
Definition at32f413_dma.h:94
DMA1_HDT3_FLAG
#define DMA1_HDT3_FLAG
Definition at32f413_dma.h:90
DMA1_FDT4_FLAG
#define DMA1_FDT4_FLAG
Definition at32f413_dma.h:93
DMA1_FDT3_FLAG
#define DMA1_FDT3_FLAG
Definition at32f413_dma.h:89
DMA_FDT_INT
#define DMA_FDT_INT
Definition at32f413_dma.h:51
DMA_HDT_INT
#define DMA_HDT_INT
Definition at32f413_dma.h:52
DMA1_CHANNEL3
#define DMA1_CHANNEL3
Definition at32f413_dma.h:482
DMA1_CHANNEL4
#define DMA1_CHANNEL4
Definition at32f413_dma.h:483
error_status
error_status
error status
Definition at32f413.h:302
ERROR
@ ERROR
Definition at32f413.h:302
SUCCESS
@ SUCCESS
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_pin_remap_config
void gpio_pin_remap_config(uint32_t gpio_remap, confirm_state new_state)
iomux remap and debug i/o configuration.
Definition at32f413_gpio.c:549
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_DRIVE_STRENGTH_MODERATE
@ GPIO_DRIVE_STRENGTH_MODERATE
Definition at32f413_gpio.h:225
GPIO_PULL_DOWN
@ GPIO_PULL_DOWN
Definition at32f413_gpio.h:245
GPIO_PULL_UP
@ GPIO_PULL_UP
Definition at32f413_gpio.h:244
GPIO_OUTPUT_OPEN_DRAIN
@ GPIO_OUTPUT_OPEN_DRAIN
Definition at32f413_gpio.h:235
GPIO_PINS_8
#define GPIO_PINS_8
Definition at32f413_gpio.h:58
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
i2c_own_address1_set
void i2c_own_address1_set(i2c_type *i2c_x, i2c_address_mode_type mode, uint16_t address)
config own address1.
Definition at32f413_i2c.c:191
i2c_init
void i2c_init(i2c_type *i2c_x, i2c_fsmode_duty_cycle_type duty, uint32_t speed)
init i2c speed and duty cycle.
Definition at32f413_i2c.c:89
I2C_FSMODE_DUTY_2_1
@ I2C_FSMODE_DUTY_2_1
Definition at32f413_i2c.h:147
I2C_ADDRESS_MODE_7BIT
@ I2C_ADDRESS_MODE_7BIT
Definition at32f413_i2c.h:156
I2C_OK
@ I2C_OK
Definition i2c_application.h:95
I2C1_MUX
#define I2C1_MUX
Definition at32f413_gpio.h:81
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
i2s_init
void i2s_init(spi_type *spi_x, i2s_init_type *i2s_init_struct)
i2s init config with its setting value.
Definition at32f413_spi.c:315
spi_i2s_dma_receiver_enable
void spi_i2s_dma_receiver_enable(spi_type *spi_x, confirm_state new_state)
enable or disable the spi/i2s dma receiver mode.
Definition at32f413_spi.c:498
i2s_enable
void i2s_enable(spi_type *spi_x, confirm_state new_state)
enable or disable i2s.
Definition at32f413_spi.c:444
spi_i2s_reset
void spi_i2s_reset(spi_type *spi_x)
spi reset by crm reset register
Definition at32f413_spi.c:50
i2s_default_para_init
void i2s_default_para_init(i2s_init_type *i2s_init_struct)
i2s init config with its default value.
Definition at32f413_spi.c:297
spi_i2s_dma_transmitter_enable
void spi_i2s_dma_transmitter_enable(spi_type *spi_x, confirm_state new_state)
enable or disable the spi/i2s dma transmitter mode.
Definition at32f413_spi.c:484
i2s_data_channel_format_type
i2s_data_channel_format_type
i2s data bit num and channel bit num type
Definition at32f413_spi.h:225
i2s_audio_sampling_freq_type
i2s_audio_sampling_freq_type
i2s audio frequency type
Definition at32f413_spi.h:208
I2S_CLOCK_POLARITY_LOW
@ I2S_CLOCK_POLARITY_LOW
Definition at32f413_spi.h:248
I2S_DATA_16BIT_CHANNEL_16BIT
@ I2S_DATA_16BIT_CHANNEL_16BIT
Definition at32f413_spi.h:226
I2S_DATA_24BIT_CHANNEL_32BIT
@ I2S_DATA_24BIT_CHANNEL_32BIT
Definition at32f413_spi.h:228
I2S_AUDIO_PROTOCOL_PHILLIPS
@ I2S_AUDIO_PROTOCOL_PHILLIPS
Definition at32f413_spi.h:197
I2S_MODE_SLAVE_RX
@ I2S_MODE_SLAVE_RX
Definition at32f413_spi.h:238
I2S_MODE_SLAVE_TX
@ I2S_MODE_SLAVE_TX
Definition at32f413_spi.h:237
SPI1
#define SPI1
Definition at32f413_spi.h:447
SPI2
#define SPI2
Definition at32f413_spi.h:448
tmr_counter_enable
void tmr_counter_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr counter
Definition at32f413_tmr.c:114
tmr_output_channel_config
void tmr_output_channel_config(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_output_config_type *tmr_output_struct)
config tmr output channel
Definition at32f413_tmr.c:318
tmr_clock_source_div_set
void tmr_clock_source_div_set(tmr_type *tmr_x, tmr_clock_division_type tmr_clock_div)
set tmr clock source division
Definition at32f413_tmr.c:204
tmr_output_default_para_init
void tmr_output_default_para_init(tmr_output_config_type *tmr_output_struct)
init tmr output default para
Definition at32f413_tmr.c:126
tmr_output_enable
void tmr_output_enable(tmr_type *tmr_x, confirm_state new_state)
tmr output enable(oen),this function is important for advtm output enable
Definition at32f413_tmr.c:1469
tmr_base_init
void tmr_base_init(tmr_type *tmr_x, uint32_t tmr_pr, uint32_t tmr_div)
init tmr base
Definition at32f413_tmr.c:179
tmr_output_channel_buffer_enable
void tmr_output_channel_buffer_enable(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, confirm_state new_state)
enable tmr output channel buffer
Definition at32f413_tmr.c:613
tmr_cnt_dir_set
void tmr_cnt_dir_set(tmr_type *tmr_x, tmr_count_mode_type tmr_cnt_dir)
set tmr counter count direction
Definition at32f413_tmr.c:225
tmr_channel_value_set
void tmr_channel_value_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, uint32_t tmr_channel_value)
set tmr channel value
Definition at32f413_tmr.c:506
TMR_COUNT_UP
@ TMR_COUNT_UP
Definition at32f413_tmr.h:105
TMR_SELECT_CHANNEL_1
@ TMR_SELECT_CHANNEL_1
Definition at32f413_tmr.h:215
TMR_CLOCK_DIV1
@ TMR_CLOCK_DIV1
Definition at32f413_tmr.h:95
TMR_OUTPUT_CONTROL_PWM_MODE_A
@ TMR_OUTPUT_CONTROL_PWM_MODE_A
Definition at32f413_tmr.h:178
TMR_OUTPUT_ACTIVE_HIGH
@ TMR_OUTPUT_ACTIVE_HIGH
Definition at32f413_tmr.h:196
TMR1
#define TMR1
Definition at32f413_tmr.h:831
MIC_BUFFER_SIZE
#define MIC_BUFFER_SIZE
Definition audio/inc/audio_codec.h:126
SPK_BUFFER_SIZE
#define SPK_BUFFER_SIZE
Definition audio/inc/audio_codec.h:127
DMA_BUFFER_SIZE
#define DMA_BUFFER_SIZE
Definition audio/inc/audio_codec.h:128
I2S2_DT_ADDRESS
#define I2S2_DT_ADDRESS
Definition audio/inc/audio_codec.h:115
I2S1_SD_PIN
#define I2S1_SD_PIN
Definition audio/inc/audio_codec.h:104
I2S1_CK_PIN
#define I2S1_CK_PIN
Definition audio/inc/audio_codec.h:103
I2S2_GPIO
#define I2S2_GPIO
Definition audio/inc/audio_codec.h:113
I2S2_SD_PIN
#define I2S2_SD_PIN
Definition audio/inc/audio_codec.h:112
I2S2_WS_PIN
#define I2S2_WS_PIN
Definition audio/inc/audio_codec.h:110
I2S2_GPIO_CRM_CLK
#define I2S2_GPIO_CRM_CLK
Definition audio/inc/audio_codec.h:114
I2S1_DT_ADDRESS
#define I2S1_DT_ADDRESS
Definition audio/inc/audio_codec.h:107
I2S1_GPIO_CRM_CLK
#define I2S1_GPIO_CRM_CLK
Definition audio/inc/audio_codec.h:106
I2S1_WS_PIN
#define I2S1_WS_PIN
Definition audio/inc/audio_codec.h:102
I2S1_GPIO
#define I2S1_GPIO
Definition audio/inc/audio_codec.h:105
I2S2_CK_PIN
#define I2S2_CK_PIN
Definition audio/inc/audio_codec.h:111
WM8988_R27_ADDITIONAL_3_CONTROL
#define WM8988_R27_ADDITIONAL_3_CONTROL
Definition audio/inc/audio_codec.h:76
WM8988_I2C_ADDR_CSB_LOW
#define WM8988_I2C_ADDR_CSB_LOW
Definition audio/inc/audio_codec.h:92
WM8988_R10_LEFT_DAC_VOLUME
#define WM8988_R10_LEFT_DAC_VOLUME
Definition audio/inc/audio_codec.h:59
WM8988_R1_RIGHT_INPUT_VOLUME
#define WM8988_R1_RIGHT_INPUT_VOLUME
Definition audio/inc/audio_codec.h:50
WM8988_R3_ROUT1_VOLUME
#define WM8988_R3_ROUT1_VOLUME
Definition audio/inc/audio_codec.h:52
WM8988_R36_RIGHT_OUT_MIX_1
#define WM8988_R36_RIGHT_OUT_MIX_1
Definition audio/inc/audio_codec.h:83
WM8988_R21_LEFT_ADC_VOLUME
#define WM8988_R21_LEFT_ADC_VOLUME
Definition audio/inc/audio_codec.h:70
WM8988_R31_ADC_INPUT_MODE
#define WM8988_R31_ADC_INPUT_MODE
Definition audio/inc/audio_codec.h:78
WM8988_R13_TREBLE_CONTROL
#define WM8988_R13_TREBLE_CONTROL
Definition audio/inc/audio_codec.h:62
WM8988_R16_3D_CONTROL
#define WM8988_R16_3D_CONTROL
Definition audio/inc/audio_codec.h:65
WM8988_R22_RIGHT_ADC_VOLUME
#define WM8988_R22_RIGHT_ADC_VOLUME
Definition audio/inc/audio_codec.h:71
WM8988_R0_LEFT_INPUT_VOLUME
#define WM8988_R0_LEFT_INPUT_VOLUME
Definition audio/inc/audio_codec.h:49
WM8988_R23_ADDITIONAL_1_CONTROL
#define WM8988_R23_ADDITIONAL_1_CONTROL
Definition audio/inc/audio_codec.h:72
WM8988_R35_LEFT_OUT_MIX_2
#define WM8988_R35_LEFT_OUT_MIX_2
Definition audio/inc/audio_codec.h:82
WM8988_R43_LOW_POWER_PALYBACK
#define WM8988_R43_LOW_POWER_PALYBACK
Definition audio/inc/audio_codec.h:90
WM8988_R32_ADC_L_SIGNAL_PATH
#define WM8988_R32_ADC_L_SIGNAL_PATH
Definition audio/inc/audio_codec.h:79
WM8988_R26_PWR_2_MGMT
#define WM8988_R26_PWR_2_MGMT
Definition audio/inc/audio_codec.h:75
WM8988_R11_RIGHT_DAC_VOLUME
#define WM8988_R11_RIGHT_DAC_VOLUME
Definition audio/inc/audio_codec.h:60
WM8988_R24_ADDITIONAL_2_CONTROL
#define WM8988_R24_ADDITIONAL_2_CONTROL
Definition audio/inc/audio_codec.h:73
WM8988_R40_LOUT2_VOLUME
#define WM8988_R40_LOUT2_VOLUME
Definition audio/inc/audio_codec.h:87
WM8988_R34_LEFT_OUT_MIX_1
#define WM8988_R34_LEFT_OUT_MIX_1
Definition audio/inc/audio_codec.h:81
WM8988_R5_ADC_DAC_CONTROL
#define WM8988_R5_ADC_DAC_CONTROL
Definition audio/inc/audio_codec.h:54
WM8988_R25_PWR_1_MGMT
#define WM8988_R25_PWR_1_MGMT
Definition audio/inc/audio_codec.h:74
WM8988_R41_ROUT2_VOLUME
#define WM8988_R41_ROUT2_VOLUME
Definition audio/inc/audio_codec.h:88
WM8988_R2_LOUT1_VOLUME
#define WM8988_R2_LOUT1_VOLUME
Definition audio/inc/audio_codec.h:51
WM8988_R37_RIGHT_OUT_MIX_2
#define WM8988_R37_RIGHT_OUT_MIX_2
Definition audio/inc/audio_codec.h:84
WM8988_R33_ADC_R_SIGNAL_PATH
#define WM8988_R33_ADC_R_SIGNAL_PATH
Definition audio/inc/audio_codec.h:80
WM8988_R12_BASS_CONTROL
#define WM8988_R12_BASS_CONTROL
Definition audio/inc/audio_codec.h:61
AUDIO_BITW_16
#define AUDIO_BITW_16
Definition audio/audio_conf.h:60
AUDIO_MIC_CHANEL_NUM
#define AUDIO_MIC_CHANEL_NUM
Definition audio/audio_conf.h:62
AUDIO_DEFAULT_FREQ
#define AUDIO_DEFAULT_FREQ
Definition audio/audio_conf.h:70
AUDIO_FREQ_16K
#define AUDIO_FREQ_16K
Definition audio/audio_conf.h:58
AUDIO_SPK_CHANEL_NUM
#define AUDIO_SPK_CHANEL_NUM
Definition audio/audio_conf.h:65
AUDIO_DEFAULT_BITW
#define AUDIO_DEFAULT_BITW
Definition audio/audio_conf.h:71
AUDIO_FREQ_48K
#define AUDIO_FREQ_48K
Definition audio/audio_conf.h:59
i2c_application.h
i2c application libray header file
audio_codec_type
Definition audio/inc/audio_codec.h:131
audio_codec_type::spk_mute
uint8_t spk_mute
Definition audio/inc/audio_codec.h:160
audio_codec_type::spk_threshold
uint16_t spk_threshold
Definition audio/inc/audio_codec.h:142
audio_codec_type::spk_stage
uint8_t spk_stage
Definition audio/inc/audio_codec.h:144
audio_codec_type::mic_roff
uint16_t * mic_roff
Definition audio/inc/audio_codec.h:148
audio_codec_type::spk_buffer
uint16_t spk_buffer[4096]
Definition audio/inc/audio_codec.h:135
audio_codec_type::mic_volume
uint16_t mic_volume
Definition audio/inc/audio_codec.h:162
audio_codec_type::spk_roff
uint16_t * spk_roff
Definition audio/inc/audio_codec.h:136
audio_codec_type::spk_rtotal
uint32_t spk_rtotal
Definition audio/inc/audio_codec.h:141
audio_codec_type::mic_delta
uint32_t mic_delta
Definition audio/inc/audio_codec.h:153
audio_codec_type::spk_calc
uint16_t spk_calc
Definition audio/inc/audio_codec.h:143
audio_codec_type::mic_woff
uint16_t * mic_woff
Definition audio/inc/audio_codec.h:149
audio_codec_type::mic_stage
uint8_t mic_stage
Definition audio/inc/audio_codec.h:157
audio_codec_type::mic_adj_count
uint16_t mic_adj_count
Definition audio/inc/audio_codec.h:155
audio_codec_type::spk_freq
uint32_t spk_freq
Definition audio/inc/audio_codec.h:139
audio_codec_type::audio_bitw
uint32_t audio_bitw
Definition audio/inc/audio_codec.h:133
audio_codec_type::mic_wend
uint16_t * mic_wend
Definition audio/inc/audio_codec.h:150
audio_codec_type::spk_rend
uint16_t * spk_rend
Definition audio/inc/audio_codec.h:138
audio_codec_type::mic_wtotal
uint32_t mic_wtotal
Definition audio/inc/audio_codec.h:151
audio_codec_type::mic_rtotal
uint32_t mic_rtotal
Definition audio/inc/audio_codec.h:152
audio_codec_type::audio_freq
uint32_t audio_freq
Definition audio/inc/audio_codec.h:132
audio_codec_type::mic_mute
uint8_t mic_mute
Definition audio/inc/audio_codec.h:159
audio_codec_type::spk_volume
uint16_t spk_volume
Definition audio/inc/audio_codec.h:163
audio_codec_type::mic_calc
uint16_t mic_calc
Definition audio/inc/audio_codec.h:154
audio_codec_type::spk_wtotal
uint32_t spk_wtotal
Definition audio/inc/audio_codec.h:140
audio_codec_type::mic_adj_stage
uint8_t mic_adj_stage
Definition audio/inc/audio_codec.h:156
audio_codec_type::spk_tx_size
uint32_t spk_tx_size
Definition audio/inc/audio_codec.h:165
audio_codec_type::mic_rx_size
uint32_t mic_rx_size
Definition audio/inc/audio_codec.h:166
audio_codec_type::spk_woff
uint16_t * spk_woff
Definition audio/inc/audio_codec.h:137
audio_codec_type::mic_buffer
uint16_t mic_buffer[1024]
Definition audio/inc/audio_codec.h:147
dma_init_type
dma init type
Definition at32f413_dma.h:275
dma_init_type::loop_mode_enable
confirm_state loop_mode_enable
Definition at32f413_dma.h:284
dma_init_type::buffer_size
uint16_t buffer_size
Definition at32f413_dma.h:279
dma_init_type::memory_data_width
dma_memory_data_size_type memory_data_width
Definition at32f413_dma.h:283
dma_init_type::priority
dma_priority_level_type priority
Definition at32f413_dma.h:285
dma_init_type::peripheral_inc_enable
confirm_state peripheral_inc_enable
Definition at32f413_dma.h:280
dma_init_type::memory_inc_enable
confirm_state memory_inc_enable
Definition at32f413_dma.h:281
dma_init_type::direction
dma_dir_type direction
Definition at32f413_dma.h:278
dma_init_type::peripheral_base_addr
uint32_t peripheral_base_addr
Definition at32f413_dma.h:276
dma_init_type::memory_base_addr
uint32_t memory_base_addr
Definition at32f413_dma.h:277
dma_init_type::peripheral_data_width
dma_peripheral_data_size_type peripheral_data_width
Definition at32f413_dma.h:282
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
i2c_handle_type
Definition i2c_application.h:127
i2c_handle_type::i2cx
i2c_type * i2cx
Definition i2c_application.h:128
i2s_init_type
i2s init type
Definition at32f413_spi.h:271
i2s_init_type::audio_sampling_freq
i2s_audio_sampling_freq_type audio_sampling_freq
Definition at32f413_spi.h:274
i2s_init_type::data_channel_format
i2s_data_channel_format_type data_channel_format
Definition at32f413_spi.h:275
i2s_init_type::mclk_output_enable
confirm_state mclk_output_enable
Definition at32f413_spi.h:277
i2s_init_type::audio_protocol
i2s_audio_protocol_type audio_protocol
Definition at32f413_spi.h:273
i2s_init_type::operation_mode
i2s_operation_mode_type operation_mode
Definition at32f413_spi.h:272
i2s_init_type::clock_polarity
i2s_clock_polarity_type clock_polarity
Definition at32f413_spi.h:276
tmr_output_config_type
tmr output config type
Definition at32f413_tmr.h:397
tmr_output_config_type::oc_idle_state
confirm_state oc_idle_state
Definition at32f413_tmr.h:399
tmr_output_config_type::oc_output_state
confirm_state oc_output_state
Definition at32f413_tmr.h:403
tmr_output_config_type::oc_mode
tmr_output_control_mode_type oc_mode
Definition at32f413_tmr.h:398
tmr_output_config_type::oc_polarity
tmr_output_polarity_type oc_polarity
Definition at32f413_tmr.h:401


AT32F413 Firmwary Library: audio_class.c Source File

  • middlewares
  • usbd_class
  • audio
audio_class.c
Go to the documentation of this file.
1
25#include "usbd_core.h"
26#include "audio_class.h"
27#include "audio_desc.h"
28#include "audio_codec.h"
29
43static usb_sts_type class_init_handler(void *udev);
44static usb_sts_type class_clear_handler(void *udev);
45static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup);
46static usb_sts_type class_ept0_tx_handler(void *udev);
47static usb_sts_type class_ept0_rx_handler(void *udev);
48static usb_sts_type class_in_handler(void *udev, uint8_t ept_num);
49static usb_sts_type class_out_handler(void *udev, uint8_t ept_num);
50static usb_sts_type class_sof_handler(void *udev);
51static usb_sts_type class_event_handler(void *udev, usbd_event_type event);
52
53static void audio_req_get_cur(void *udev, usb_setup_type *setup);
54static void audio_req_set_cur(void *udev, usb_setup_type *setup);
55static void audio_req_get_min(void *udev, usb_setup_type *setup);
56static void audio_req_get_max(void *udev, usb_setup_type *setup);
57static void audio_req_get_res(void *udev, usb_setup_type *setup);
58static void audio_get_interface(void *udev, usb_setup_type *setup);
59static void audio_set_interface(void *udev, usb_setup_type *setup);
60
61 usb_audio_type audio_struct = {0, 0, 0, 0, 0, 0x1400, 0, 0, 0, {0x0000, 0x1400, 0x33}, {0x0000, 0x1400, 0x33}, 0, 0};
62
63/* usb device class handler */
64 usbd_class_handler audio_class_handler =
65{
66 class_init_handler,
67 class_clear_handler,
68 class_setup_handler,
69 class_ept0_tx_handler,
70 class_ept0_rx_handler,
71 class_in_handler,
72 class_out_handler,
73 class_sof_handler,
74 class_event_handler,
75 &audio_struct
76};
77
83static usb_sts_type class_init_handler(void *udev)
84{
85 usb_sts_type status = USB_OK;
86 usbd_core_type *pudev = (usbd_core_type *)udev;
87 usb_audio_type *paudio = (usb_audio_type *)pudev->class_handler->pdata;
88 /* enable microphone in endpoint double buffer mode */
89 usbd_ept_dbuffer_enable(pudev, USBD_AUDIO_MIC_IN_EPT);
90
91 /* open microphone in endpoint */
92 usbd_ept_open(pudev, USBD_AUDIO_MIC_IN_EPT, EPT_ISO_TYPE, AUDIO_MIC_IN_MAXPACKET_SIZE);
93
94 /* enable speaker out endpoint double buffer mode */
95 usbd_ept_dbuffer_enable(pudev, USBD_AUDIO_SPK_OUT_EPT);
96
97 /* open speaker out endpoint */
98 usbd_ept_open(pudev, USBD_AUDIO_SPK_OUT_EPT, EPT_ISO_TYPE, AUDIO_SPK_OUT_MAXPACKET_SIZE);
99
100 /* enable speaker feedback endpoint double buffer mode */
101 usbd_ept_dbuffer_enable(pudev, USBD_AUDIO_FEEDBACK_EPT);
102
103 /* open speaker feedback endpoint */
104 usbd_ept_open(pudev, USBD_AUDIO_FEEDBACK_EPT, EPT_ISO_TYPE, AUDIO_FEEDBACK_MAXPACKET_SIZE);
105
106 /* start receive speaker out data */
107 usbd_ept_recv(pudev, USBD_AUDIO_SPK_OUT_EPT, paudio->audio_spk_data, AUDIO_SPK_OUT_MAXPACKET_SIZE);
108
109 return status;
110}
111
117static usb_sts_type class_clear_handler(void *udev)
118{
119 usb_sts_type status = USB_OK;
120 usbd_core_type *pudev = (usbd_core_type *)udev;
121
122 /* close in endpoint */
123 usbd_ept_close(pudev, USBD_AUDIO_MIC_IN_EPT);
124
125 /* close in endpoint */
126 usbd_ept_close(pudev, USBD_AUDIO_FEEDBACK_EPT);
127
128 /* close out endpoint */
129 usbd_ept_close(pudev, USBD_AUDIO_SPK_OUT_EPT);
130
131 return status;
132}
133
140static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
141{
142 usb_sts_type status = USB_OK;
143 usbd_core_type *pudev = (usbd_core_type *)udev;
144 uint16_t len;
145
146 switch(setup->bmRequestType & USB_REQ_TYPE_RESERVED)
147 {
148 /* class request */
149 case USB_REQ_TYPE_CLASS:
150 switch(setup->bRequest)
151 {
152 case AUDIO_REQ_GET_CUR:
153 audio_req_get_cur(pudev, setup);
154 break;
155
156 case AUDIO_REQ_SET_CUR:
157 audio_req_set_cur(pudev, setup);
158 break;
159
160 case AUDIO_REQ_GET_MIN:
161 audio_req_get_min(pudev, setup);
162 break;
163
164 case AUDIO_REQ_GET_MAX:
165 audio_req_get_max(pudev, setup);
166 break;
167
168 case AUDIO_REQ_GET_RES:
169 audio_req_get_res(pudev, setup);
170 break;
171
172 default:
173 usbd_ctrl_unsupport(pudev);
174 break;
175 }
176 break;
177 /* standard request */
178 case USB_REQ_TYPE_STANDARD:
179 switch(setup->bRequest)
180 {
181 case USB_STD_REQ_GET_DESCRIPTOR:
182 if((setup->wValue >> 8) == AUDIO_DESCRIPTOR_TYPE)
183 {
184 usbd_desc_t *config = pudev->desc_handler->get_device_configuration();
185 len = MIN(AUDIO_DESCRIPTOR_SIZE, setup->wLength);
186 usbd_ctrl_send(pudev, config->descriptor + 18, len);
187 }
188 else
189 {
190 usbd_ctrl_unsupport(pudev);
191 }
192 break;
193 case USB_STD_REQ_GET_INTERFACE:
194 audio_get_interface(udev, setup);
195 break;
196
197 case USB_STD_REQ_SET_INTERFACE:
198 audio_set_interface(udev, setup);
199 usbd_ctrl_send_status(pudev);
200 break;
201 case USB_STD_REQ_CLEAR_FEATURE:
202 break;
203 case USB_STD_REQ_SET_FEATURE:
204 break;
205 default:
206 usbd_ctrl_unsupport(pudev);
207 break;
208 }
209 break;
210
211 default:
212 usbd_ctrl_unsupport(pudev);
213 break;
214 }
215 return status;
216}
217
223static usb_sts_type class_ept0_tx_handler(void *udev)
224{
225 usb_sts_type status = USB_OK;
226
227 /* ...user code... */
228
229 return status;
230}
231
237static usb_sts_type class_ept0_rx_handler(void *udev)
238{
239 usb_sts_type status = USB_OK;
240 usbd_core_type *pudev = (usbd_core_type *)udev;
241 usb_audio_type *paudio = (usb_audio_type *)pudev->class_handler->pdata;
242 uint32_t recv_len = usbd_get_recv_len(pudev, 0);
243 /* ...user code... */
244 if( paudio->audio_cmd == AUDIO_REQ_SET_CUR)
245 {
246 /* class process */
247 switch( paudio->request_no)
248 {
249 case AUDIO_VOLUME_CONTROL:
250 if( paudio->interface == AUDIO_SPK_FEATURE_UNIT_ID)
251 {
252 paudio->spk_volume = (uint16_t)( paudio->g_audio_cur[0] |
253 ( paudio->g_audio_cur[1] << 8));
254 /* set volume */
255 audio_codec_set_spk_volume(paudio->spk_volume*100/paudio->spk_volume_limits[1]);
256 }
257 else
258 {
259 paudio->mic_volume = (uint16_t)(paudio->g_audio_cur[0] |
260 (paudio->g_audio_cur[1] << 8));
261
262 audio_codec_set_mic_volume(paudio->mic_volume*256/paudio->mic_volume_limits[1]);
263 }
264 break;
265 case AUDIO_MUTE_CONTROL:
266 if(paudio->interface == AUDIO_SPK_FEATURE_UNIT_ID)
267 {
268 paudio->spk_mute = paudio->g_audio_cur[0];
269 audio_codec_set_spk_mute(paudio->spk_mute);
270 }
271 else
272 {
273 paudio->mic_mute = paudio->g_audio_cur[0];
274 audio_codec_set_mic_mute(paudio->mic_mute);
275 }
276
277 break;
278 case AUDIO_FREQ_SET_CONTROL:
279 if(paudio->enpd == USBD_AUDIO_MIC_IN_EPT)
280 {
281 paudio->mic_freq = (paudio->g_audio_cur[0] |
282 (paudio->g_audio_cur[1] << 8) |
283 (paudio->g_audio_cur[2] << 16));
284 audio_codec_set_mic_freq(paudio->mic_freq);
285 }
286 else
287 {
288 paudio->spk_freq = (paudio->g_audio_cur[0] |
289 (paudio->g_audio_cur[1] << 8) |
290 (paudio->g_audio_cur[2] << 16));
291 audio_codec_set_spk_freq(paudio->spk_freq);
292 }
293 break;
294 default:
295 break;
296 }
297 }
298
299 return status;
300}
301
308static usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
309{
310 usb_sts_type status = USB_OK;
311 usbd_core_type *pudev = (usbd_core_type *)udev;
312 usb_audio_type *paudio = (usb_audio_type *)pudev->class_handler->pdata;
313 uint32_t len = 0;
314
315 /* ...user code...
316 trans next packet data
317 */
318 if((ept_num & 0x7F) == (USBD_AUDIO_MIC_IN_EPT & 0x7F))
319 {
320 len = audio_codec_mic_get_data(paudio->audio_mic_data);
321 usbd_ept_send(udev, USBD_AUDIO_MIC_IN_EPT, paudio->audio_mic_data, len);
322 }
323
324 else if((ept_num & 0x7F) == (USBD_AUDIO_FEEDBACK_EPT & 0x7F))
325 {
326 len = audio_codec_spk_feedback(paudio->audio_feed_back);
327 usbd_ept_send(udev, USBD_AUDIO_FEEDBACK_EPT, paudio->audio_feed_back, len);
328 }
329
330 return status;
331}
332
339static usb_sts_type class_out_handler(void *udev, uint8_t ept_num)
340{
341 usb_sts_type status = USB_OK;
342 usbd_core_type *pudev = (usbd_core_type *)udev;
343 usb_audio_type *paudio = (usb_audio_type *)pudev->class_handler->pdata;
344 uint16_t g_rxlen;
345
346 /* get endpoint receive data length */
347 g_rxlen = usbd_get_recv_len(pudev, ept_num);
348
349 if((ept_num & 0x7F) == (USBD_AUDIO_SPK_OUT_EPT & 0x7F))
350 {
351 /* speaker data*/
352 audio_codec_spk_fifo_write(paudio->audio_spk_data, g_rxlen);
353
354 /* get next data */
355 usbd_ept_recv(pudev, USBD_AUDIO_SPK_OUT_EPT, paudio->audio_spk_data, AUDIO_SPK_OUT_MAXPACKET_SIZE);
356 }
357
358 return status;
359}
360
366static usb_sts_type class_sof_handler(void *udev)
367{
368 usb_sts_type status = USB_OK;
369
370 /* ...user code... */
371
372 return status;
373}
374
381 usb_sts_type class_event_handler(void *udev, usbd_event_type event)
382{
383 usb_sts_type status = USB_OK;
384 usbd_core_type *pudev = (usbd_core_type *)udev;
385 usb_audio_type *paudio = (usb_audio_type *)pudev->class_handler->pdata;
386 switch(event)
387 {
388 case USBD_RESET_EVENT:
389
390 /* ...user code... */
391
392 break;
393 case USBD_SUSPEND_EVENT:
394 paudio->spk_alt_setting = 0;
395 audio_codec_spk_alt_setting(paudio->spk_alt_setting);
396 paudio->mic_alt_setting = 0;
397 audio_codec_mic_alt_setting(paudio->spk_alt_setting);
398 /* ...user code... */
399
400 break;
401 case USBD_WAKEUP_EVENT:
402 /* ...user code... */
403
404 break;
405 default:
406 break;
407 }
408 return status;
409}
410
417static void audio_req_get_cur(void *udev, usb_setup_type *setup)
418{
419 usbd_core_type *pudev = (usbd_core_type *)udev;
420 usb_audio_type *paudio = (usb_audio_type *)pudev->class_handler->pdata;
421
422 switch(setup->bmRequestType & AUDIO_REQ_CONTROL_MASK)
423 {
424 case AUDIO_REQ_CONTROL_INTERFACE:
425 if(HBYTE(setup->wIndex) == AUDIO_SPK_FEATURE_UNIT_ID)
426 {
427 if(HBYTE(setup->wValue) == AUDIO_MUTE_CONTROL)
428 {
429 paudio->g_audio_cur[0] = paudio->spk_mute;
430 usbd_ctrl_send(pudev, paudio->g_audio_cur, setup->wLength);
431 }
432 else if(HBYTE(setup->wValue) == AUDIO_VOLUME_CONTROL)
433 {
434 *((uint16_t *)paudio->g_audio_cur) = paudio->spk_volume;
435 usbd_ctrl_send(pudev, paudio->g_audio_cur, setup->wLength);
436 }
437 else
438 {
439 usbd_ctrl_unsupport(pudev);
440 }
441 }
442 else if(HBYTE(setup->wIndex) == AUDIO_MIC_FEATURE_UNIT_ID)
443 {
444 if(HBYTE(setup->wValue) == AUDIO_MUTE_CONTROL)
445 {
446 paudio->g_audio_cur[0] = paudio->mic_mute;
447 usbd_ctrl_send(pudev, paudio->g_audio_cur, setup->wLength);
448 }
449 else if(HBYTE(setup->wValue) == AUDIO_VOLUME_CONTROL)
450 {
451 *((uint16_t *)paudio->g_audio_cur) = paudio->mic_volume;
452 usbd_ctrl_send(pudev, paudio->g_audio_cur, setup->wLength);
453 }
454 else
455 {
456 usbd_ctrl_unsupport(pudev);
457 }
458 }
459 else
460 {
461 usbd_ctrl_unsupport(pudev);
462 }
463 break;
464 case AUDIO_REQ_CONTROL_ENDPOINT:
465 if(HBYTE(setup->wValue) == AUDIO_SAMPLING_FREQ_CONTROL)
466 {
467 if(setup->wIndex == USBD_AUDIO_MIC_IN_EPT)
468 {
469 *((uint32_t *)paudio->g_audio_cur) = paudio->mic_freq;
470 usbd_ctrl_send(pudev, paudio->g_audio_cur, setup->wLength);
471 }
472 else if(setup->wIndex == USBD_AUDIO_SPK_OUT_EPT)
473 {
474 *((uint32_t *)paudio->g_audio_cur) = paudio->spk_freq;
475 usbd_ctrl_send(pudev, paudio->g_audio_cur, setup->wLength);
476 }
477 else
478 {
479 usbd_ctrl_unsupport(pudev);
480 }
481 }
482 else
483 {
484 usbd_ctrl_unsupport(pudev);
485 }
486 break;
487 default:
488 usbd_ctrl_unsupport(pudev);
489 break;
490 }
491}
492
499static void audio_req_set_cur(void *udev, usb_setup_type *setup)
500{
501 usbd_core_type *pudev = (usbd_core_type *)udev;
502 usb_audio_type *paudio = (usb_audio_type *)pudev->class_handler->pdata;
503 if(setup->wLength > 0)
504 {
505 usbd_ctrl_recv(pudev, paudio->g_audio_cur, setup->wLength);
506
507 paudio->audio_cmd = AUDIO_REQ_SET_CUR;
508 paudio->audio_cmd_len = setup->wLength;
509
510 switch(setup->bmRequestType & AUDIO_REQ_CONTROL_MASK)
511 {
512 case AUDIO_REQ_CONTROL_INTERFACE:
513 paudio->interface = HBYTE(setup->wIndex);
514 if(HBYTE(setup->wValue) == AUDIO_MUTE_CONTROL)
515 {
516 paudio->request_no = AUDIO_MUTE_CONTROL;
517 }
518 else if(HBYTE(setup->wValue) == AUDIO_VOLUME_CONTROL)
519 {
520 paudio->request_no = AUDIO_VOLUME_CONTROL;
521 }
522 else
523 {
524 usbd_ctrl_unsupport(pudev);
525 }
526 break;
527 case AUDIO_REQ_CONTROL_ENDPOINT:
528 if(HBYTE(setup->wValue) == AUDIO_SAMPLING_FREQ_CONTROL)
529 {
530 paudio->enpd = setup->wIndex;
531 paudio->request_no = AUDIO_FREQ_SET_CONTROL;
532 }
533 else
534 {
535 usbd_ctrl_unsupport(pudev);
536 }
537 break;
538 default:
539 usbd_ctrl_unsupport(pudev);
540 break;
541 }
542 }
543 else
544 {
545 usbd_ctrl_unsupport(pudev);
546 }
547}
548
555static void audio_req_get_min(void *udev, usb_setup_type *setup)
556{
557 usbd_core_type *pudev = (usbd_core_type *)udev;
558 usb_audio_type *paudio = (usb_audio_type *)pudev->class_handler->pdata;
559
560 switch(setup->bmRequestType & AUDIO_REQ_CONTROL_MASK)
561 {
562 case AUDIO_REQ_CONTROL_INTERFACE:
563 if(HBYTE(setup->wIndex) == AUDIO_SPK_FEATURE_UNIT_ID)
564 {
565 *((uint16_t *)paudio->g_audio_cur) = paudio->spk_volume_limits[0];
566 usbd_ctrl_send(pudev, paudio->g_audio_cur, setup->wLength);
567 }
568 else if(HBYTE(setup->wIndex) == AUDIO_MIC_FEATURE_UNIT_ID)
569 {
570 *((uint16_t *)paudio->g_audio_cur) = paudio->mic_volume_limits[0];
571 usbd_ctrl_send(pudev, paudio->g_audio_cur, setup->wLength);
572 }
573 else
574 {
575 usbd_ctrl_unsupport(pudev);
576 }
577 break;
578 case AUDIO_REQ_CONTROL_ENDPOINT:
579 usbd_ctrl_unsupport(pudev);
580 break;
581 default:
582 usbd_ctrl_unsupport(pudev);
583 break;
584 }
585}
586
593static void audio_req_get_max(void *udev, usb_setup_type *setup)
594{
595 usbd_core_type *pudev = (usbd_core_type *)udev;
596 usb_audio_type *paudio = (usb_audio_type *)pudev->class_handler->pdata;
597
598 switch(setup->bmRequestType & AUDIO_REQ_CONTROL_MASK)
599 {
600 case AUDIO_REQ_CONTROL_INTERFACE:
601 if(HBYTE(setup->wIndex) == AUDIO_SPK_FEATURE_UNIT_ID)
602 {
603 *((uint16_t *)paudio->g_audio_cur) = paudio->spk_volume_limits[1];
604 usbd_ctrl_send(pudev, paudio->g_audio_cur, setup->wLength);
605 }
606 else if(HBYTE(setup->wIndex) == AUDIO_MIC_FEATURE_UNIT_ID)
607 {
608 *((uint16_t *)paudio->g_audio_cur) = paudio->mic_volume_limits[1];
609 usbd_ctrl_send(pudev, paudio->g_audio_cur, setup->wLength);
610 }
611 else
612 {
613 usbd_ctrl_unsupport(pudev);
614 }
615 break;
616 case AUDIO_REQ_CONTROL_ENDPOINT:
617 usbd_ctrl_unsupport(pudev);
618 break;
619 default:
620 usbd_ctrl_unsupport(pudev);
621 break;
622 }
623}
624
631static void audio_req_get_res(void *udev, usb_setup_type *setup)
632{
633 usbd_core_type *pudev = (usbd_core_type *)udev;
634 usb_audio_type *paudio = (usb_audio_type *)pudev->class_handler->pdata;
635 switch(setup->bmRequestType & AUDIO_REQ_CONTROL_MASK)
636 {
637 case AUDIO_REQ_CONTROL_INTERFACE:
638 if(HBYTE(setup->wIndex) == AUDIO_SPK_FEATURE_UNIT_ID)
639 {
640 *((uint16_t *)paudio->g_audio_cur) = paudio->spk_volume_limits[2];
641 usbd_ctrl_send(pudev, paudio->g_audio_cur, setup->wLength);
642 }
643 else if(HBYTE(setup->wIndex) == AUDIO_MIC_FEATURE_UNIT_ID)
644 {
645 *((uint16_t *)paudio->g_audio_cur) = paudio->mic_volume_limits[2];
646 usbd_ctrl_send(pudev, paudio->g_audio_cur, setup->wLength);
647 }
648 else
649 {
650 usbd_ctrl_unsupport(pudev);
651 }
652 break;
653 case AUDIO_REQ_CONTROL_ENDPOINT:
654 usbd_ctrl_unsupport(pudev);
655 break;
656 default:
657 usbd_ctrl_unsupport(pudev);
658 break;
659 }
660}
661
668static void audio_set_interface(void *udev, usb_setup_type *setup)
669{
670 uint32_t len;
671 usbd_core_type *pudev = (usbd_core_type *)udev;
672 usb_audio_type *paudio = (usb_audio_type *)pudev->class_handler->pdata;
673 if(LBYTE(setup->wIndex) == AUDIO_SPK_INTERFACE_NUMBER)
674 {
675 paudio->spk_alt_setting = setup->wValue;
676 audio_codec_spk_alt_setting(paudio->spk_alt_setting);
677 if(paudio->spk_alt_setting )
678 {
679 int len = audio_codec_spk_feedback(paudio->audio_feed_back);
680 usbd_ept_recv(pudev, USBD_AUDIO_SPK_OUT_EPT, paudio->audio_spk_data, AUDIO_SPK_OUT_MAXPACKET_SIZE);
681 usbd_ept_send(pudev, USBD_AUDIO_FEEDBACK_EPT, paudio->audio_feed_back, len);
682 }
683
684 }
685 else if(LBYTE(setup->wIndex) == AUDIO_MIC_INTERFACE_NUMBER)
686 {
687 paudio->mic_alt_setting = setup->wValue;
688 audio_codec_mic_alt_setting(paudio->mic_alt_setting);
689 if(paudio->mic_alt_setting)
690 {
691 len = audio_codec_mic_get_data(paudio->audio_mic_data);
692 usbd_ept_send(pudev, USBD_AUDIO_MIC_IN_EPT, paudio->audio_mic_data, len);
693 }
694 }
695
696}
697
698
705static void audio_get_interface(void *udev, usb_setup_type *setup)
706{
707 usbd_core_type *pudev = (usbd_core_type *)udev;
708 usb_audio_type *paudio = (usb_audio_type *)pudev->class_handler->pdata;
709 if(LBYTE(setup->wIndex) == AUDIO_SPK_INTERFACE_NUMBER)
710 {
711 usbd_ctrl_send(pudev, (uint8_t *)&paudio->spk_alt_setting, 1);
712 }
713 else if(LBYTE(setup->wIndex) == AUDIO_MIC_INTERFACE_NUMBER)
714 {
715 usbd_ctrl_send(pudev, (uint8_t *)&paudio->mic_alt_setting, 1);
716 }
717 else
718 {
719 usbd_ctrl_unsupport(pudev);
720 }
721}
722
723
audio_class.h
usb audio class file
audio_desc.h
usb audio descriptor header file
AUDIO_DESCRIPTOR_TYPE
#define AUDIO_DESCRIPTOR_TYPE
audio descriptor type
Definition audio_class.h:83
AUDIO_MIC_IN_MAXPACKET_SIZE
#define AUDIO_MIC_IN_MAXPACKET_SIZE
Definition audio_class.h:61
AUDIO_MUTE_CONTROL
#define AUDIO_MUTE_CONTROL
audio set cur type define
Definition audio_class.h:75
AUDIO_REQ_CONTROL_INTERFACE
#define AUDIO_REQ_CONTROL_INTERFACE
request type define
Definition audio_class.h:68
AUDIO_SAMPLING_FREQ_CONTROL
#define AUDIO_SAMPLING_FREQ_CONTROL
Definition audio_class.h:78
AUDIO_SPK_OUT_MAXPACKET_SIZE
#define AUDIO_SPK_OUT_MAXPACKET_SIZE
Definition audio_class.h:62
AUDIO_VOLUME_CONTROL
#define AUDIO_VOLUME_CONTROL
Definition audio_class.h:76
AUDIO_FREQ_SET_CONTROL
#define AUDIO_FREQ_SET_CONTROL
Definition audio_class.h:77
AUDIO_REQ_CONTROL_ENDPOINT
#define AUDIO_REQ_CONTROL_ENDPOINT
Definition audio_class.h:69
AUDIO_REQ_CONTROL_MASK
#define AUDIO_REQ_CONTROL_MASK
Definition audio_class.h:70
USBD_AUDIO_SPK_OUT_EPT
#define USBD_AUDIO_SPK_OUT_EPT
Definition audio_class.h:54
USBD_AUDIO_MIC_IN_EPT
#define USBD_AUDIO_MIC_IN_EPT
endpoint define
Definition audio_class.h:53
AUDIO_DESCRIPTOR_SIZE
#define AUDIO_DESCRIPTOR_SIZE
Definition audio_class.h:84
USBD_AUDIO_FEEDBACK_EPT
#define USBD_AUDIO_FEEDBACK_EPT
Definition audio_class.h:55
AUDIO_FEEDBACK_MAXPACKET_SIZE
#define AUDIO_FEEDBACK_MAXPACKET_SIZE
Definition audio_class.h:63
class_sof_handler
static usb_sts_type class_sof_handler(void *udev)
usb device sof handler
Definition audio_class.c:366
class_in_handler
static usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
usb device transmision complete handler
Definition audio_class.c:308
class_clear_handler
static usb_sts_type class_clear_handler(void *udev)
clear endpoint or other state
Definition audio_class.c:117
class_setup_handler
static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
usb device class setup request handler
Definition audio_class.c:140
class_ept0_tx_handler
static usb_sts_type class_ept0_tx_handler(void *udev)
usb device endpoint 0 in status stage complete
Definition audio_class.c:223
class_event_handler
static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
usb device event handler
Definition audio_class.c:381
audio_class_handler
usbd_class_handler audio_class_handler
Definition audio_class.c:64
class_ept0_rx_handler
static usb_sts_type class_ept0_rx_handler(void *udev)
usb device endpoint 0 out status stage complete
Definition audio_class.c:237
audio_req_get_res
static void audio_req_get_res(void *udev, usb_setup_type *setup)
usb audio request get res
Definition audio_class.c:631
audio_get_interface
static void audio_get_interface(void *udev, usb_setup_type *setup)
usb audio get interface
Definition audio_class.c:705
audio_req_set_cur
static void audio_req_set_cur(void *udev, usb_setup_type *setup)
usb audio request set cur
Definition audio_class.c:499
audio_struct
usb_audio_type audio_struct
Definition audio_class.c:61
audio_req_get_max
static void audio_req_get_max(void *udev, usb_setup_type *setup)
usb audio request get max
Definition audio_class.c:593
audio_req_get_min
static void audio_req_get_min(void *udev, usb_setup_type *setup)
usb audio request get min
Definition audio_class.c:555
class_init_handler
static usb_sts_type class_init_handler(void *udev)
initialize usb custom hid endpoint
Definition audio_class.c:83
class_out_handler
static usb_sts_type class_out_handler(void *udev, uint8_t ept_num)
usb device endpoint receive data
Definition audio_class.c:339
audio_req_get_cur
static void audio_req_get_cur(void *udev, usb_setup_type *setup)
usb audio request get cur
Definition audio_class.c:417
audio_set_interface
static void audio_set_interface(void *udev, usb_setup_type *setup)
usb audio set interface
Definition audio_class.c:668
AUDIO_MIC_FEATURE_UNIT_ID
#define AUDIO_MIC_FEATURE_UNIT_ID
Definition audio_desc.h:168
AUDIO_REQ_GET_CUR
#define AUDIO_REQ_GET_CUR
Definition audio_desc.h:112
AUDIO_SPK_INTERFACE_NUMBER
#define AUDIO_SPK_INTERFACE_NUMBER
Definition audio_desc.h:179
AUDIO_MIC_INTERFACE_NUMBER
#define AUDIO_MIC_INTERFACE_NUMBER
audio interface number
Definition audio_desc.h:177
AUDIO_REQ_GET_MAX
#define AUDIO_REQ_GET_MAX
Definition audio_desc.h:116
AUDIO_REQ_GET_MIN
#define AUDIO_REQ_GET_MIN
Definition audio_desc.h:114
AUDIO_SPK_FEATURE_UNIT_ID
#define AUDIO_SPK_FEATURE_UNIT_ID
Definition audio_desc.h:171
AUDIO_REQ_GET_RES
#define AUDIO_REQ_GET_RES
Definition audio_desc.h:118
AUDIO_REQ_SET_CUR
#define AUDIO_REQ_SET_CUR
Definition audio_desc.h:111
audio_codec_mic_alt_setting
void audio_codec_mic_alt_setting(uint32_t alt_seting)
audio codec microphone alt setting config
Definition audio/src/audio_codec.c:168
audio_codec_set_spk_volume
void audio_codec_set_spk_volume(uint16_t volume)
audio codec set speaker volume
Definition audio/src/audio_codec.c:220
audio_codec_set_spk_mute
void audio_codec_set_spk_mute(uint8_t mute)
audio codec set speaker mute
Definition audio/src/audio_codec.c:194
audio_codec_set_mic_freq
void audio_codec_set_mic_freq(uint32_t freq)
audio codec set microphone freq
Definition audio/src/audio_codec.c:120
audio_codec_mic_get_data
uint32_t audio_codec_mic_get_data(uint8_t *buffer)
codec microphone get data
Definition audio/src/audio_codec.c:285
audio_codec_set_mic_mute
void audio_codec_set_mic_mute(uint8_t mute)
audio codec set microphone mute
Definition audio/src/audio_codec.c:183
audio_codec_spk_fifo_write
void audio_codec_spk_fifo_write(uint8_t *data, uint32_t len)
audio codec interface
Definition audio/src/audio_codec.c:247
audio_codec_spk_feedback
uint8_t audio_codec_spk_feedback(uint8_t *feedback)
codec speaker feedback
Definition audio/src/audio_codec.c:231
audio_codec_set_mic_volume
void audio_codec_set_mic_volume(uint16_t volume)
audio codec set microphone volume
Definition audio/src/audio_codec.c:205
audio_codec_spk_alt_setting
void audio_codec_spk_alt_setting(uint32_t alt_seting)
audio codec speaker alt setting config
Definition audio/src/audio_codec.c:153
audio_codec_set_spk_freq
void audio_codec_set_spk_freq(uint32_t freq)
audio codec set speaker freq
Definition audio/src/audio_codec.c:136
EPT_ISO_TYPE
@ EPT_ISO_TYPE
Definition at32f413_usb.h:203
USB_STD_REQ_CLEAR_FEATURE
#define USB_STD_REQ_CLEAR_FEATURE
Definition usb_std.h:77
HBYTE
#define HBYTE(x)
Definition usb_std.h:271
MIN
#define MIN(a, b)
min and max define
Definition usb_std.h:260
USB_REQ_TYPE_STANDARD
#define USB_REQ_TYPE_STANDARD
usb request type
Definition usb_std.h:62
USB_STD_REQ_GET_DESCRIPTOR
#define USB_STD_REQ_GET_DESCRIPTOR
Definition usb_std.h:80
LBYTE
#define LBYTE(x)
low byte and high byte define
Definition usb_std.h:270
USB_STD_REQ_SET_FEATURE
#define USB_STD_REQ_SET_FEATURE
Definition usb_std.h:78
USB_STD_REQ_SET_INTERFACE
#define USB_STD_REQ_SET_INTERFACE
Definition usb_std.h:85
USB_REQ_TYPE_RESERVED
#define USB_REQ_TYPE_RESERVED
Definition usb_std.h:65
USB_STD_REQ_GET_INTERFACE
#define USB_STD_REQ_GET_INTERFACE
Definition usb_std.h:84
USB_REQ_TYPE_CLASS
#define USB_REQ_TYPE_CLASS
Definition usb_std.h:63
usb_sts_type
usb_sts_type
usb return status
Definition usb_std.h:285
USB_OK
@ USB_OK
Definition usb_std.h:286
usbd_ept_dbuffer_enable
void usbd_ept_dbuffer_enable(usbd_core_type *udev, uint8_t ept_addr)
enable endpoint double buffer.
Definition usbd_core.c:409
usbd_ept_close
void usbd_ept_close(usbd_core_type *udev, uint8_t ept_addr)
usb close endpoint
Definition usbd_core.c:541
usbd_ept_recv
void usbd_ept_recv(usbd_core_type *udev, uint8_t ept_num, uint8_t *buffer, uint16_t len)
usb endpoint receive data
Definition usbd_core.c:364
usbd_ctrl_send_status
void usbd_ctrl_send_status(usbd_core_type *udev)
usb control endpoint send in status
Definition usbd_core.c:210
usbd_ept_open
void usbd_ept_open(usbd_core_type *udev, uint8_t ept_addr, uint8_t ept_type, uint16_t maxpacket)
usb open endpoint
Definition usbd_core.c:506
usbd_ctrl_send
void usbd_ctrl_send(usbd_core_type *udev, uint8_t *buffer, uint16_t len)
usb control endpoint send data
Definition usbd_core.c:175
usbd_get_recv_len
uint32_t usbd_get_recv_len(usbd_core_type *udev, uint8_t ept_addr)
usb endpoint get receive data length
Definition usbd_core.c:397
usbd_ctrl_recv
void usbd_ctrl_recv(usbd_core_type *udev, uint8_t *buffer, uint16_t len)
usb control endpoint receive data
Definition usbd_core.c:194
usbd_ctrl_unsupport
void usbd_ctrl_unsupport(usbd_core_type *udev)
un-support device request
Definition usbd_core.c:289
usbd_ept_send
void usbd_ept_send(usbd_core_type *udev, uint8_t ept_num, uint8_t *buffer, uint16_t len)
usb endpoint send data
Definition usbd_core.c:304
usbd_event_type
usbd_event_type
usb device event
Definition usbd_core.h:54
USBD_SUSPEND_EVENT
@ USBD_SUSPEND_EVENT
Definition usbd_core.h:57
USBD_RESET_EVENT
@ USBD_RESET_EVENT
Definition usbd_core.h:56
USBD_WAKEUP_EVENT
@ USBD_WAKEUP_EVENT
Definition usbd_core.h:58
usb_audio_type
usb audio control struct
Definition audio_class.h:90
usb_audio_type::mic_alt_setting
uint32_t mic_alt_setting
Definition audio_class.h:106
usb_audio_type::enpd
uint8_t enpd
Definition audio_class.h:91
usb_audio_type::mic_freq
uint32_t mic_freq
Definition audio_class.h:99
usb_audio_type::spk_volume_limits
uint16_t spk_volume_limits[3]
Definition audio_class.h:100
usb_audio_type::mic_volume_limits
uint16_t mic_volume_limits[3]
Definition audio_class.h:101
usb_audio_type::interface
uint8_t interface
Definition audio_class.h:92
usb_audio_type::audio_spk_data
uint8_t audio_spk_data[(48 *2 *(16/8)+40)]
Definition audio_class.h:108
usb_audio_type::audio_cmd_len
uint32_t audio_cmd_len
Definition audio_class.h:104
usb_audio_type::spk_alt_setting
uint32_t spk_alt_setting
Definition audio_class.h:105
usb_audio_type::audio_mic_data
uint8_t audio_mic_data[(48 *2 *(16/8)+40)]
Definition audio_class.h:109
usb_audio_type::spk_volume
uint16_t spk_volume
Definition audio_class.h:96
usb_audio_type::mic_volume
uint16_t mic_volume
Definition audio_class.h:97
usb_audio_type::spk_freq
uint32_t spk_freq
Definition audio_class.h:98
usb_audio_type::g_audio_cur
uint8_t g_audio_cur[64]
Definition audio_class.h:107
usb_audio_type::spk_mute
uint8_t spk_mute
Definition audio_class.h:94
usb_audio_type::request_no
uint8_t request_no
Definition audio_class.h:93
usb_audio_type::audio_cmd
uint8_t audio_cmd
Definition audio_class.h:103
usb_audio_type::audio_feed_back
uint8_t audio_feed_back[0x3+1]
Definition audio_class.h:110
usb_audio_type::mic_mute
uint8_t mic_mute
Definition audio_class.h:95
usb_setup_type
format of usb setup data
Definition usb_std.h:297
usb_setup_type::wValue
uint16_t wValue
Definition usb_std.h:300
usb_setup_type::wLength
uint16_t wLength
Definition usb_std.h:303
usb_setup_type::bmRequestType
uint8_t bmRequestType
Definition usb_std.h:298
usb_setup_type::wIndex
uint16_t wIndex
Definition usb_std.h:301
usb_setup_type::bRequest
uint8_t bRequest
Definition usb_std.h:299
usbd_class_handler
usb device class handler
Definition usbd_core.h:97
usbd_class_handler::pdata
void * pdata
Definition usbd_core.h:107
usbd_core_type
usb device core struct type
Definition usbd_core.h:114
usbd_core_type::class_handler
usbd_class_handler * class_handler
Definition usbd_core.h:117
usbd_core_type::desc_handler
usbd_desc_handler * desc_handler
Definition usbd_core.h:118
usbd_desc_handler::get_device_configuration
usbd_desc_t *(* get_device_configuration)(void)
Definition usbd_core.h:78
usbd_desc_t
usb device descriptor struct
Definition usbd_core.h:66
usbd_desc_t::descriptor
uint8_t * descriptor
Definition usbd_core.h:68
usbd_core.h
usb device core header file


AT32F413 Firmwary Library: audio_class.h Source File

  • middlewares
  • usbd_class
  • audio
audio_class.h
Go to the documentation of this file.
1
26 /* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AUDIO_CLASS_H
28#define __AUDIO_CLASS_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "usb_std.h"
35#include "usbd_core.h"
36#include "audio_conf.h"
37
53#define USBD_AUDIO_MIC_IN_EPT 0x81
54#define USBD_AUDIO_SPK_OUT_EPT 0x02
55#define USBD_AUDIO_FEEDBACK_EPT 0x83
56
60#define AUDIO_REMAIN_SIZE 40
61#define AUDIO_MIC_IN_MAXPACKET_SIZE (AUDIO_SUPPORT_MAX_FREQ * AUDIO_MIC_CHANEL_NUM * (AUDIO_MIC_DEFAULT_BITW / 8) + AUDIO_REMAIN_SIZE)
62#define AUDIO_SPK_OUT_MAXPACKET_SIZE (AUDIO_SUPPORT_MAX_FREQ * AUDIO_SPK_CHANEL_NUM * (AUDIO_SPK_DEFAULT_BITW / 8) + AUDIO_REMAIN_SIZE)
63#define AUDIO_FEEDBACK_MAXPACKET_SIZE 0x3
64#define FEEDBACK_REFRESH_TIME 0x8
68#define AUDIO_REQ_CONTROL_INTERFACE 0x01
69#define AUDIO_REQ_CONTROL_ENDPOINT 0x02
70#define AUDIO_REQ_CONTROL_MASK 0x03
71
75#define AUDIO_MUTE_CONTROL 0x01
76#define AUDIO_VOLUME_CONTROL 0x02
77#define AUDIO_FREQ_SET_CONTROL 0x03
78#define AUDIO_SAMPLING_FREQ_CONTROL 0x01
79
83#define AUDIO_DESCRIPTOR_TYPE 0x21
84#define AUDIO_DESCRIPTOR_SIZE 0x09
85
89typedef struct
90{
91 uint8_t enpd;
92 uint8_t interface;
93 uint8_t request_no;
94 uint8_t spk_mute;
95 uint8_t mic_mute;
96 uint16_t spk_volume;
97 uint16_t mic_volume;
98 uint32_t spk_freq;
99 uint32_t mic_freq;
100 uint16_t spk_volume_limits[3]; /*[0] is mininum value, [1] is maxnum value, [2] is volume resolution */
101 uint16_t mic_volume_limits[3]; /*[0] is mininum value, [1] is maxnum value, [2] is volume resolution */
102
103 uint8_t audio_cmd;
104 uint32_t audio_cmd_len;
105 uint32_t spk_alt_setting;
106 uint32_t mic_alt_setting;
107 uint8_t g_audio_cur[64];
108 uint8_t audio_spk_data[AUDIO_SPK_OUT_MAXPACKET_SIZE];
109 uint8_t audio_mic_data[AUDIO_MIC_IN_MAXPACKET_SIZE];
110 uint8_t audio_feed_back[AUDIO_FEEDBACK_MAXPACKET_SIZE+1];
111}usb_audio_type;
112
113extern usbd_class_handler audio_class_handler;
114
127#ifdef __cplusplus
128}
129#endif
130
131#endif
132
audio_conf.h
usb audio config
AUDIO_MIC_IN_MAXPACKET_SIZE
#define AUDIO_MIC_IN_MAXPACKET_SIZE
Definition audio_class.h:61
audio_class_handler
usbd_class_handler audio_class_handler
Definition audio_class.c:64
AUDIO_SPK_OUT_MAXPACKET_SIZE
#define AUDIO_SPK_OUT_MAXPACKET_SIZE
Definition audio_class.h:62
AUDIO_FEEDBACK_MAXPACKET_SIZE
#define AUDIO_FEEDBACK_MAXPACKET_SIZE
Definition audio_class.h:63
usb_audio_type
usb audio control struct
Definition audio_class.h:90
usb_audio_type::mic_alt_setting
uint32_t mic_alt_setting
Definition audio_class.h:106
usb_audio_type::enpd
uint8_t enpd
Definition audio_class.h:91
usb_audio_type::mic_freq
uint32_t mic_freq
Definition audio_class.h:99
usb_audio_type::interface
uint8_t interface
Definition audio_class.h:92
usb_audio_type::audio_cmd_len
uint32_t audio_cmd_len
Definition audio_class.h:104
usb_audio_type::spk_alt_setting
uint32_t spk_alt_setting
Definition audio_class.h:105
usb_audio_type::spk_volume
uint16_t spk_volume
Definition audio_class.h:96
usb_audio_type::mic_volume
uint16_t mic_volume
Definition audio_class.h:97
usb_audio_type::spk_freq
uint32_t spk_freq
Definition audio_class.h:98
usb_audio_type::spk_mute
uint8_t spk_mute
Definition audio_class.h:94
usb_audio_type::request_no
uint8_t request_no
Definition audio_class.h:93
usb_audio_type::audio_cmd
uint8_t audio_cmd
Definition audio_class.h:103
usb_audio_type::mic_mute
uint8_t mic_mute
Definition audio_class.h:95
usbd_class_handler
usb device class handler
Definition usbd_core.h:97
usb_std.h
usb standard header file
usbd_core.h
usb device core header file


AT32F413 Firmwary Library: audio_desc.c Source File

  • middlewares
  • usbd_class
  • audio
audio_desc.c
Go to the documentation of this file.
1
25#include "usb_std.h"
26#include "usbd_sdr.h"
27#include "usbd_core.h"
28#include "audio_desc.h"
29
42static usbd_desc_t *get_device_descriptor(void);
43static usbd_desc_t *get_device_qualifier(void);
44static usbd_desc_t *get_device_configuration(void);
45static usbd_desc_t *get_device_other_speed(void);
46static usbd_desc_t *get_device_lang_id(void);
47static usbd_desc_t *get_device_manufacturer_string(void);
48static usbd_desc_t *get_device_product_string(void);
49static usbd_desc_t *get_device_serial_string(void);
50static usbd_desc_t *get_device_interface_string(void);
51static usbd_desc_t *get_device_config_string(void);
52
53static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf);
54static void usbd_int_to_unicode (uint32_t value , uint8_t *pbuf , uint8_t len);
55static void get_serial_num(void);
56#if defined ( __ICCARM__ ) /* iar compiler */
57 #pragma data_alignment=4
58#endif
59ALIGNED_HEAD static uint8_t g_usbd_desc_buffer[256] ALIGNED_TAIL;
60
64 usbd_desc_handler audio_desc_handler =
65{
66 get_device_descriptor,
67 get_device_qualifier,
68 get_device_configuration,
69 get_device_other_speed,
70 get_device_lang_id,
71 get_device_manufacturer_string,
72 get_device_product_string,
73 get_device_serial_string,
74 get_device_interface_string,
75 get_device_config_string,
76};
77
81#if defined ( __ICCARM__ ) /* iar compiler */
82 #pragma data_alignment=4
83#endif
84ALIGNED_HEAD static uint8_t g_usbd_descriptor[USB_DEVICE_DESC_LEN] ALIGNED_TAIL =
85{
86 USB_DEVICE_DESC_LEN, /* bLength */
87 USB_DESCIPTOR_TYPE_DEVICE, /* bDescriptorType */
88 0x00, /* bcdUSB */
89 0x02,
90 0x00, /* bDeviceClass */
91 0x00, /* bDeviceSubClass */
92 0x00, /* bDeviceProtocol */
93 USB_MAX_EP0_SIZE, /* bMaxPacketSize */
94 LBYTE(USBD_AUDIO_VENDOR_ID), /* idVendor */
95 HBYTE(USBD_AUDIO_VENDOR_ID), /* idVendor */
96 LBYTE(USBD_AUDIO_PRODUCT_ID), /* idProduct */
97 HBYTE(USBD_AUDIO_PRODUCT_ID), /* idProduct */
98 0x00, /* bcdDevice rel. 2.00 */
99 0x02,
100 USB_MFC_STRING, /* Index of manufacturer string */
101 USB_PRODUCT_STRING, /* Index of product string */
102 USB_SERIAL_STRING, /* Index of serial number string */
103 0x01 /* bNumConfigurations */
104};
105
109#if defined ( __ICCARM__ ) /* iar compiler */
110 #pragma data_alignment=4
111#endif
112ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_AUDIO_CONFIG_DESC_SIZE] ALIGNED_TAIL =
113{
114 USB_DEVICE_CFG_DESC_LEN, /* bLength: configuration descriptor size */
115 USB_DESCIPTOR_TYPE_CONFIGURATION, /* bDescriptorType: configuration */
116 LBYTE(USBD_AUDIO_CONFIG_DESC_SIZE), /* wTotalLength: bytes returned */
117 HBYTE(USBD_AUDIO_CONFIG_DESC_SIZE), /* wTotalLength: bytes returned */
118 0x1 + AUDIO_INTERFACE_NUM, /* bNumInterfaces: n interface */
119 0x01, /* bConfigurationValue: configuration value */
120 0x00, /* iConfiguration: index of string descriptor describing
121 the configuration */
122 0xC0, /* bmAttributes: self powered */
123 0x32, /* MaxPower 100 mA: this current is used for detecting vbus */
124
125 USB_DEVICE_IF_DESC_LEN, /* bLength: interface descriptor size */
126 USB_DESCIPTOR_TYPE_INTERFACE, /* bDescriptorType: interface descriptor type */
127 0x00, /* bInterfaceNumber: number of interface */
128 0x00, /* bAlternateSetting: alternate set */
129 0x00, /* bNumEndpoints: number of endpoints */
130 USB_CLASS_CODE_AUDIO, /* bInterfaceClass: audio class code */
131 AUDIO_SUBCLASS_AUDIOCONTROL, /* bInterfaceSubClass: audio control */
132 AUDIO_PROTOCOL_UNDEFINED, /* bInterfaceProtocol: undefined */
133 0x00, /* iInterface: index of string descriptor */
134
135 0x08+AUDIO_INTERFACE_NUM, /* bLength: size of this descriptor, in bytes 8+n */
136 AUDIO_CS_INTERFACE, /* bDescriptorType: cs interface descriptor type */
137 AUDIO_AC_HEADER, /* bDescriptorSubtype: Header function Descriptor*/
138 LBYTE(AUDIO_BCD_NUM),
139 HBYTE(AUDIO_BCD_NUM), /* bcdCDC: audio device class specification release number */
140 LBYTE(AUDIO_INTERFACE_LEN),
141 HBYTE(AUDIO_INTERFACE_LEN), /* wTotalLength: total number of bytes returned for the class-specific audio control interface */
142 AUDIO_INTERFACE_NUM, /* bInClollection: the number of audio streaming */
143#if (AUDIO_INTERFACE_NUM == 2) /* two interface */
144 0x02,
145 0x01,
146#else
147 0x01,
148#endif
149
150 /* usb microphone config */
151#if (AUDIO_SUPPORT_MIC == 1)
152 AUDIO_INPUT_TERMINAL_SIZE, /* bLength: descriptor size */
153 AUDIO_CS_INTERFACE, /* bDescriptorType: configuration */
154 AUDIO_AC_INPUT_TERMINAL, /* bDescriptorSubtype: input_terminal type*/
155 AUDIO_MIC_INPUT_TERMINAL_ID, /* bTerminalID: id of this input terminal*/
156 LBYTE(AUDIO_INPUT_TERMINAL_MICROPHONE),
157 HBYTE(AUDIO_INPUT_TERMINAL_MICROPHONE),/* wTerminalType: terminal is microphone */
158 0x00, /* bAssocTerminal: no association */
159 AUDIO_MIC_CHR, /* bNrChannels: two channel */
160#if (AUDIO_MIC_CHR == 2)
161 0x03, /* wChannelConfig: left front and right front */
162#endif
163#if (AUDIO_MIC_CHR == 1)
164 0x00, /* wChannelConfig */
165#endif
166 0x00, /* wChannelConfig */
167 0x00, /* iChannelNames: unused */
168 0x00, /* iTerminal: unused */
169
170 AUDIO_FEATURE_UNIT_SIZE, /* bLength: descriptor size */
171 AUDIO_CS_INTERFACE, /* bDescriptorType: configuration */
172 AUDIO_AC_FEATURE_UNIT, /* bDescriptorSubtype: feature unit type*/
173 AUDIO_MIC_FEATURE_UNIT_ID, /* bUnitID: id of this feature unit */
174 AUDIO_MIC_INPUT_TERMINAL_ID, /* bSourceID: from input terminal */
175 0x02, /* bControlSize: 2 byte */
176 0x03, /* bmaControls0: mute & volume*/
177 0x00,
178 0x00, /* bmaControls1 */
179 0x00,
180 0x00, /* bmaControls2 */
181 0x00,
182 0x00, /* iFeature: unused */
183
184 AUDIO_OUTPUT_TERMINAL_SIZE, /* bLength: descriptor size */
185 AUDIO_CS_INTERFACE, /* bDescriptorType: configuration */
186 AUDIO_AC_OUTPUT_TERMINAL, /* bDescriptorSubtype: output_terminal type*/
187 AUDIO_MIC_OUTPUT_TERMINAL_ID, /* bTerminalID: id of this output terminal*/
188 LBYTE(AUDIO_TERMINAL_TYPE_STREAMING),
189 HBYTE(AUDIO_TERMINAL_TYPE_STREAMING), /* wTerminalType: usb streaming */
190 0x00, /* bAssocTerminal: unused */
191 AUDIO_MIC_FEATURE_UNIT_ID, /* bSourceID: from feature unit terminal */
192 0x00, /* iTerminal: unused */
193#endif
194
195#if (AUDIO_SUPPORT_SPK == 1)
196 /* speaker config */
197 AUDIO_INPUT_TERMINAL_SIZE, /* bLength: descriptor size */
198 AUDIO_CS_INTERFACE, /* bDescriptorType: configuration */
199 AUDIO_AC_INPUT_TERMINAL, /* bDescriptorSubtype: input_terminal type*/
200 AUDIO_SPK_INPUT_TERMINAL_ID, /* bTerminalID: id of this input terminal*/
201 LBYTE(AUDIO_TERMINAL_TYPE_STREAMING), /* wTerminalType: usb streaming */
202 HBYTE(AUDIO_TERMINAL_TYPE_STREAMING), /* wTerminalType: usb streaming */
203 0x00, /* bAssocTerminal: no association */
204 AUDIO_SPK_CHR, /* bNrChannels: two channel */
205#if (AUDIO_SPK_CHR == 2)
206 0x03, /* wChannelConfig: left front and right front */
207#endif
208#if (AUDIO_SPK_CHR == 1)
209 0x00, /* wChannelConfig */
210#endif
211 0x00, /* wChannelConfig */
212 0x00, /* iChannelNames: unused */
213 0x00, /* iTerminal: unused */
214
215 AUDIO_FEATURE_UNIT_SIZE, /* bLength: descriptor size */
216 AUDIO_CS_INTERFACE, /* bDescriptorType: configuration */
217 AUDIO_AC_FEATURE_UNIT, /* bDescriptorSubtype: feature unit type*/
218 AUDIO_SPK_FEATURE_UNIT_ID, /* bUnitID: id of this feature unit */
219 AUDIO_SPK_INPUT_TERMINAL_ID, /* bSourceID: from input terminal */
220 0x02, /* bControlSize: 2 byte */
221 0x03, /* bmaControls0: mute & volume*/
222 0x00,
223 0x00, /* bmaControls1: 0x0000 */
224 0x00,
225 0x00, /* bmaControls2: 0x0000 */
226 0x00,
227 0x00, /* iFeature: unused */
228
229 AUDIO_OUTPUT_TERMINAL_SIZE, /* bLength: descriptor size */
230 AUDIO_CS_INTERFACE, /* bDescriptorType: configuration */
231 AUDIO_AC_OUTPUT_TERMINAL, /* bDescriptorSubtype: output_terminal type*/
232 AUDIO_SPK_OUTPUT_TERMINAL_ID, /* bTerminalID: id of this output terminal*/
233 LBYTE(AUDIO_OUTPUT_TERMINAL_SPEAKER), /* wTerminalType: usb speaker */
234 HBYTE(AUDIO_OUTPUT_TERMINAL_SPEAKER), /* wTerminalType: usb speaker */
235 0x00, /* bAssocTerminal: unused */
236 AUDIO_SPK_FEATURE_UNIT_ID, /* bSourceID: from feature unit terminal */
237 0x00, /* iTerminal: unused */
238#endif
239
240#if (AUDIO_SUPPORT_MIC == 1)
241 /* microphone interface */
242 0x09, /* bLength: descriptor size */
243 USB_DESCIPTOR_TYPE_INTERFACE, /* bDescriptorType: interface descriptor type */
244 AUDIO_MIC_INTERFACE_NUMBER, /* bInterfaceNumber: index of this interface */
245 0x00, /* bAlternateSetting: index of this setting */
246 0x00, /* bNumEndpoints: 0 endpoints */
247 USB_CLASS_CODE_AUDIO, /* bInterfaceClass: audio */
248 AUDIO_SUBCLASS_AUDIOSTREAMING, /* bInterfaceSubclass: audio streaming */
249 0x00, /* bInterfaceProtocol: unused */
250 0x00, /* iInterface: unused */
251
252 0x09, /* bLength: descriptor size */
253 USB_DESCIPTOR_TYPE_INTERFACE, /* bDescriptorType: interface descriptor type */
254 AUDIO_MIC_INTERFACE_NUMBER, /* bInterfaceNumber: index of this interface */
255 0x01, /* bAlternateSetting: index of this setting */
256 0x01, /* bNumEndpoints: 1 endpoints */
257 USB_CLASS_CODE_AUDIO, /* bInterfaceClass: audio */
258 AUDIO_SUBCLASS_AUDIOSTREAMING, /* bInterfaceSubclass: audio streaming */
259 0x00, /* bInterfaceProtocol: unused */
260 0x00, /* iInterface: unused */
261
262 0x07, /* bLength: configuration descriptor size */
263 AUDIO_CS_INTERFACE, /* bDescriptorType: interface descriptor type */
264 AUDIO_AS_GENERAL, /* bDescriptorSubtype: general sub type*/
265 AUDIO_MIC_OUTPUT_TERMINAL_ID, /* bTerminalLink: unit id of the output terminal */
266 0x01, /* bDelay: interface delay */
267 0x01, /* wFormatTag: pcm format*/
268 0x00, /* wFormatTag: pcm format*/
269
270 0x08 + AUDIO_MIC_FREQ_SIZE * 3, /* bLength: descriptor size */
271 AUDIO_CS_INTERFACE, /* bDescriptorType: interface descriptor type */
272 AUDIO_AS_FORMAT_TYPE, /* bDescriptorSubtype: format subtype */
273 AUDIO_FORMAT_TYPE_I, /* bFormatType: format type 1 */
274 AUDIO_MIC_CHR, /* bNrChannels: channel number */
275 AUDIO_MIC_BITW / 8, /* bSubFrameSize: per audio subframe */
276 AUDIO_MIC_BITW, /* bBitResolution: n bits per sample */
277 AUDIO_MIC_FREQ_SIZE, /* bSamFreqType: n frequency supported */
278#if (AUDIO_SUPPORT_FREQ_16K == 1)
279 SAMPLE_FREQ(AT32_AUDIO_FREQ_16K), /* tSamFreq: 16000hz */
280#endif
281#if (AUDIO_SUPPORT_FREQ_48K == 1)
282 SAMPLE_FREQ(AT32_AUDIO_FREQ_48K), /* tSamFreq: 48000hz */
283#endif
284
285 0x09, /* bLength: size of endpoint descriptor in bytes */
286 USB_DESCIPTOR_TYPE_ENDPOINT, /* bDescriptorType: endpoint descriptor type */
287 USBD_AUDIO_MIC_IN_EPT, /* bEndpointAddress: the address of endpoint on usb device described by this descriptor */
288 USB_EPT_DESC_ISO | USB_ETP_DESC_ASYNC, /* bmAttributes: endpoint attributes */
289 LBYTE(AUDIO_MIC_IN_MAXPACKET_SIZE),
290 HBYTE(AUDIO_MIC_IN_MAXPACKET_SIZE), /* wMaxPacketSize: maximum packe size this endpoint */
291 AUDIO_BINTERVAL_TIME, /* bInterval: interval for polling endpoint for data transfers */
292 0x00, /* bRefresh: unused */
293 0x00, /* bSynchAddress: unused */
294
295 0x07, /* bLength: size of endpoint descriptor in bytes */
296 AUDIO_CS_ENDPOINT, /* bDescriptorType: cs endpoint descriptor type */
297 0x01, /* bDescriptorSubtype: general subtype */
298 0x01, /* bmAttributes */
299 0x00, /* bLockDelayUnits: unused */
300 0x00, /* wLockDelay: unused */
301 0x00, /* wLockDelay: unused */
302#endif
303
304#if (AUDIO_SUPPORT_SPK == 1)
305 /* speaker interface */
306 0x09, /* bLength: descriptor size */
307 USB_DESCIPTOR_TYPE_INTERFACE, /* bDescriptorType: interface descriptor type */
308 AUDIO_SPK_INTERFACE_NUMBER, /* bInterfaceNumber: index of this interface */
309 0x00, /* bAlternateSetting: index of this setting */
310 0x00, /* bNumEndpoints: 0 endpoints */
311 USB_CLASS_CODE_AUDIO, /* bInterfaceClass: audio */
312 AUDIO_SUBCLASS_AUDIOSTREAMING, /* bInterfaceSubclass: audio streaming */
313 0x00, /* bInterfaceProtocol: unused */
314 0x00, /* iInterface: unused */
315
316 0x09, /* bLength: descriptor size */
317 USB_DESCIPTOR_TYPE_INTERFACE, /* bDescriptorType: interface descriptor type */
318 AUDIO_SPK_INTERFACE_NUMBER, /* bInterfaceNumber: index of this interface */
319 0x01, /* bAlternateSetting: index of this setting */
320 0x01 + AUDIO_SUPPORT_FEEDBACK, /* bNumEndpoints: endpoints */
321 USB_CLASS_CODE_AUDIO, /* bInterfaceClass: audio */
322 AUDIO_SUBCLASS_AUDIOSTREAMING, /* bInterfaceSubclass: audio streaming */
323 0x00, /* bInterfaceProtocol: unused */
324 0x00, /* iInterface: unused */
325
326 0x07, /* bLength: configuration descriptor size */
327 AUDIO_CS_INTERFACE, /* bDescriptorType: interface descriptor type */
328 AUDIO_AS_GENERAL, /* bDescriptorSubtype: general sub type*/
329 AUDIO_SPK_INPUT_TERMINAL_ID, /* bTerminalLink: unit id of the input terminal */
330 0x01, /* bDelay: interface delay */
331 0x01, /* wFormatTag: pcm format*/
332 0x00, /* wFormatTag: pcm format*/
333
334 0x08 + AUDIO_SPK_FREQ_SIZE * 3, /* bLength: descriptor size */
335 AUDIO_CS_INTERFACE, /* bDescriptorType: interface descriptor type */
336 AUDIO_AS_FORMAT_TYPE, /* bDescriptorSubtype: format subtype */
337 AUDIO_FORMAT_TYPE_I, /* bFormatType: format type 1 */
338 AUDIO_SPK_CHR, /* bNrChannels: channel number */
339 AUDIO_SPK_BITW / 8, /* bSubFrameSize: per audio subframe */
340 AUDIO_SPK_BITW, /* bBitResolution: n bits per sample */
341 AUDIO_SPK_FREQ_SIZE, /* bSamFreqType: n frequency supported */
342#if (AUDIO_SUPPORT_FREQ_16K == 1)
343 SAMPLE_FREQ(AT32_AUDIO_FREQ_16K), /* tSamFreq: 16000hz */
344#endif
345#if (AUDIO_SUPPORT_FREQ_48K == 1)
346 SAMPLE_FREQ(AT32_AUDIO_FREQ_48K), /* tSamFreq: 48000hz */
347#endif
348
349 0x09, /* bLength: size of endpoint descriptor in bytes */
350 USB_DESCIPTOR_TYPE_ENDPOINT, /* bDescriptorType: endpoint descriptor type */
351 USBD_AUDIO_SPK_OUT_EPT, /* bEndpointAddress: the address of endpoint on usb device described by this descriptor */
352 USB_EPT_DESC_ISO | USB_ETP_DESC_ASYNC, /* bmAttributes: endpoint attributes */
353 LBYTE(AUDIO_SPK_OUT_MAXPACKET_SIZE),
354 HBYTE(AUDIO_SPK_OUT_MAXPACKET_SIZE), /* wMaxPacketSize: maximum packe size this endpoint */
355 AUDIO_BINTERVAL_TIME, /* bInterval: interval for polling endpoint for data transfers */
356 0x00, /* bRefresh: unused */
357#if (AUDIO_SUPPORT_FEEDBACK == 1)
358 USBD_AUDIO_FEEDBACK_EPT, /* bSynchAddress: feedback endpoint */
359#else
360 0x00, /* bSynchAddress: unused */
361#endif
362
363 0x07, /* bLength: size of endpoint descriptor in bytes */
364 AUDIO_CS_ENDPOINT, /* bDescriptorType: cs endpoint descriptor type */
365 0x01, /* bDescriptorSubtype: general subtype */
366 0x01, /* bmAttributes */
367 0x00, /* bLockDelayUnits: unused */
368 0x00, /* wLockDelay: unused */
369 0x00, /* wLockDelay: unused */
370
371#if (AUDIO_SUPPORT_FEEDBACK == 1)
372 0x09, /* bLength: size of endpoint descriptor in bytes */
373 USB_DESCIPTOR_TYPE_ENDPOINT, /* bDescriptorType: endpoint descriptor type */
374 USBD_AUDIO_FEEDBACK_EPT, /* bEndpointAddress: the address of endpoint on usb device described by this descriptor */
375 0x11, /* bmAttributes: endpoint attributes */
376 LBYTE(AUDIO_FEEDBACK_MAXPACKET_SIZE), /* wMaxPacketSize: maximum packe size this endpoint */
377 HBYTE(AUDIO_FEEDBACK_MAXPACKET_SIZE), /* wMaxPacketSize: maximum packe size this endpoint */
378 1, /* bInterval: interval for polling endpoint for data transfers */
379 FEEDBACK_REFRESH_TIME, /* bRefresh: this field indicates the rate at which an iso syncronization
380 pipe provides new syncronization feedback data. this rate must be a power of
381 2, therefore only the power is reported back and the range of this field is from
382 1(2ms) to 9(512ms) */
383 0x00 /* bSynchAddress: 0x00*/
384#endif
385
386#endif
387};
388
392#if defined ( __ICCARM__ ) /* iar compiler */
393 #pragma data_alignment=4
394#endif
395ALIGNED_HEAD static uint8_t g_string_lang_id[USBD_AUDIO_SIZ_STRING_LANGID] ALIGNED_TAIL =
396{
397 USBD_AUDIO_SIZ_STRING_LANGID,
398 USB_DESCIPTOR_TYPE_STRING,
399 0x09,
400 0x04,
401};
402
406#if defined ( __ICCARM__ ) /* iar compiler */
407 #pragma data_alignment=4
408#endif
409ALIGNED_HEAD static uint8_t g_string_serial[USBD_AUDIO_SIZ_STRING_SERIAL] ALIGNED_TAIL =
410{
411 USBD_AUDIO_SIZ_STRING_SERIAL,
412 USB_DESCIPTOR_TYPE_STRING,
413};
414
415
416/* device descriptor */
417static usbd_desc_t device_descriptor =
418{
419 USB_DEVICE_DESC_LEN,
420 g_usbd_descriptor
421};
422
423/* config descriptor */
424static usbd_desc_t config_descriptor =
425{
426 USBD_AUDIO_CONFIG_DESC_SIZE,
427 g_usbd_configuration
428};
429
430/* langid descriptor */
431static usbd_desc_t langid_descriptor =
432{
433 USBD_AUDIO_SIZ_STRING_LANGID,
434 g_string_lang_id
435};
436
437/* serial descriptor */
438static usbd_desc_t serial_descriptor =
439{
440 USBD_AUDIO_SIZ_STRING_SERIAL,
441 g_string_serial
442};
443
444static usbd_desc_t vp_desc;
445
452static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf)
453{
454 uint16_t str_len = 0, id_pos = 2;
455 uint8_t *tmp_str = string;
456
457 while(*tmp_str != '\0')
458 {
459 str_len ++;
460 unicode_buf[id_pos ++] = *tmp_str ++;
461 unicode_buf[id_pos ++] = 0x00;
462 }
463
464 str_len = str_len * 2 + 2;
465 unicode_buf[0] = str_len;
466 unicode_buf[1] = USB_DESCIPTOR_TYPE_STRING;
467
468 return str_len;
469}
470
478static void usbd_int_to_unicode (uint32_t value , uint8_t *pbuf , uint8_t len)
479{
480 uint8_t idx = 0;
481
482 for( idx = 0 ; idx < len ; idx ++)
483 {
484 if( ((value >> 28)) < 0xA )
485 {
486 pbuf[2 * idx] = (value >> 28) + '0';
487 }
488 else
489 {
490 pbuf[2 * idx] = (value >> 28) + 'A' - 10;
491 }
492
493 value = value << 4;
494
495 pbuf[2 * idx + 1] = 0;
496 }
497}
498
504static void get_serial_num(void)
505{
506 uint32_t serial0, serial1, serial2;
507
508 serial0 = *(uint32_t*)MCU_ID1;
509 serial1 = *(uint32_t*)MCU_ID2;
510 serial2 = *(uint32_t*)MCU_ID3;
511
512 serial0 += serial2;
513
514 if (serial0 != 0)
515 {
516 usbd_int_to_unicode (serial0, &g_string_serial[2] ,8);
517 usbd_int_to_unicode (serial1, &g_string_serial[18] ,4);
518 }
519}
520
526static usbd_desc_t *get_device_descriptor(void)
527{
528 return &device_descriptor;
529}
530
536static usbd_desc_t * get_device_qualifier(void)
537{
538 return NULL;
539}
540
546static usbd_desc_t *get_device_configuration(void)
547{
548 return &config_descriptor;
549}
550
556static usbd_desc_t *get_device_other_speed(void)
557{
558 return NULL;
559}
560
566static usbd_desc_t *get_device_lang_id(void)
567{
568 return &langid_descriptor;
569}
570
571
577static usbd_desc_t *get_device_manufacturer_string(void)
578{
579 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_AUDIO_DESC_MANUFACTURER_STRING, g_usbd_desc_buffer);
580 vp_desc.descriptor = g_usbd_desc_buffer;
581 return &vp_desc;
582}
583
589static usbd_desc_t *get_device_product_string(void)
590{
591 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_AUDIO_DESC_PRODUCT_STRING, g_usbd_desc_buffer);
592 vp_desc.descriptor = g_usbd_desc_buffer;
593 return &vp_desc;
594}
595
601static usbd_desc_t *get_device_serial_string(void)
602{
603 get_serial_num();
604 return &serial_descriptor;
605}
606
612static usbd_desc_t *get_device_interface_string(void)
613{
614 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_AUDIO_DESC_INTERFACE_STRING, g_usbd_desc_buffer);
615 vp_desc.descriptor = g_usbd_desc_buffer;
616 return &vp_desc;
617}
618
624static usbd_desc_t *get_device_config_string(void)
625{
626 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_AUDIO_DESC_CONFIGURATION_STRING, g_usbd_desc_buffer);
627 vp_desc.descriptor = g_usbd_desc_buffer;
628 return &vp_desc;
629}
630
audio_desc.h
usb audio descriptor header file
NULL
#define NULL
Definition emmc_card/inc/at32_sdio.h:340
AUDIO_MIC_IN_MAXPACKET_SIZE
#define AUDIO_MIC_IN_MAXPACKET_SIZE
Definition audio_class.h:61
AUDIO_SPK_OUT_MAXPACKET_SIZE
#define AUDIO_SPK_OUT_MAXPACKET_SIZE
Definition audio_class.h:62
FEEDBACK_REFRESH_TIME
#define FEEDBACK_REFRESH_TIME
Definition audio_class.h:64
USBD_AUDIO_SPK_OUT_EPT
#define USBD_AUDIO_SPK_OUT_EPT
Definition audio_class.h:54
USBD_AUDIO_MIC_IN_EPT
#define USBD_AUDIO_MIC_IN_EPT
endpoint define
Definition audio_class.h:53
USBD_AUDIO_FEEDBACK_EPT
#define USBD_AUDIO_FEEDBACK_EPT
Definition audio_class.h:55
AUDIO_FEEDBACK_MAXPACKET_SIZE
#define AUDIO_FEEDBACK_MAXPACKET_SIZE
Definition audio_class.h:63
AUDIO_MIC_FEATURE_UNIT_ID
#define AUDIO_MIC_FEATURE_UNIT_ID
Definition audio_desc.h:168
AUDIO_CS_ENDPOINT
#define AUDIO_CS_ENDPOINT
Definition audio_desc.h:75
AUDIO_AC_HEADER
#define AUDIO_AC_HEADER
Definition audio_desc.h:90
AUDIO_SUBCLASS_AUDIOCONTROL
#define AUDIO_SUBCLASS_AUDIOCONTROL
Definition audio_desc.h:67
AUDIO_INPUT_TERMINAL_SIZE
#define AUDIO_INPUT_TERMINAL_SIZE
audio interface descriptor size define
Definition audio_desc.h:160
AUDIO_TERMINAL_TYPE_STREAMING
#define AUDIO_TERMINAL_TYPE_STREAMING
Definition audio_desc.h:137
AUDIO_SPK_CHR
#define AUDIO_SPK_CHR
Definition audio_desc.h:201
USBD_AUDIO_DESC_PRODUCT_STRING
#define USBD_AUDIO_DESC_PRODUCT_STRING
Definition audio_desc.h:59
AUDIO_SPK_INTERFACE_NUMBER
#define AUDIO_SPK_INTERFACE_NUMBER
Definition audio_desc.h:179
AUDIO_MIC_OUTPUT_TERMINAL_ID
#define AUDIO_MIC_OUTPUT_TERMINAL_ID
Definition audio_desc.h:169
AUDIO_MIC_INTERFACE_NUMBER
#define AUDIO_MIC_INTERFACE_NUMBER
audio interface number
Definition audio_desc.h:177
USBD_AUDIO_PRODUCT_ID
#define USBD_AUDIO_PRODUCT_ID
Definition audio_desc.h:53
USBD_AUDIO_CONFIG_DESC_SIZE
#define USBD_AUDIO_CONFIG_DESC_SIZE
Definition audio_desc.h:207
AUDIO_BCD_NUM
#define AUDIO_BCD_NUM
Definition audio_desc.h:50
SAMPLE_FREQ
#define SAMPLE_FREQ(frq)
Definition audio_desc.h:212
AUDIO_MIC_FREQ_SIZE
#define AUDIO_MIC_FREQ_SIZE
audio microphone freq and channel config
Definition audio_desc.h:193
AUDIO_SPK_FREQ_SIZE
#define AUDIO_SPK_FREQ_SIZE
audio speaker freq and channel config
Definition audio_desc.h:200
AT32_AUDIO_FREQ_48K
#define AT32_AUDIO_FREQ_48K
Definition audio_desc.h:188
AUDIO_FORMAT_TYPE_I
#define AUDIO_FORMAT_TYPE_I
audio format type 1
Definition audio_desc.h:147
MCU_ID1
#define MCU_ID1
Definition audio_desc.h:214
AUDIO_AS_GENERAL
#define AUDIO_AS_GENERAL
Definition audio_desc.h:103
USBD_AUDIO_DESC_CONFIGURATION_STRING
#define USBD_AUDIO_DESC_CONFIGURATION_STRING
Definition audio_desc.h:60
USBD_AUDIO_DESC_INTERFACE_STRING
#define USBD_AUDIO_DESC_INTERFACE_STRING
Definition audio_desc.h:61
AUDIO_INTERFACE_NUM
#define AUDIO_INTERFACE_NUM
audio interface config
Definition audio_desc.h:152
AUDIO_CS_INTERFACE
#define AUDIO_CS_INTERFACE
audio class-specific descriptor types
Definition audio_desc.h:74
USBD_AUDIO_SIZ_STRING_SERIAL
#define USBD_AUDIO_SIZ_STRING_SERIAL
Definition audio_desc.h:56
AUDIO_SPK_FEATURE_UNIT_ID
#define AUDIO_SPK_FEATURE_UNIT_ID
Definition audio_desc.h:171
USBD_AUDIO_SIZ_STRING_LANGID
#define USBD_AUDIO_SIZ_STRING_LANGID
Definition audio_desc.h:55
AUDIO_OUTPUT_TERMINAL_SIZE
#define AUDIO_OUTPUT_TERMINAL_SIZE
Definition audio_desc.h:161
AUDIO_SPK_OUTPUT_TERMINAL_ID
#define AUDIO_SPK_OUTPUT_TERMINAL_ID
Definition audio_desc.h:172
AUDIO_AC_INPUT_TERMINAL
#define AUDIO_AC_INPUT_TERMINAL
Definition audio_desc.h:91
AUDIO_MIC_CHR
#define AUDIO_MIC_CHR
Definition audio_desc.h:194
AUDIO_OUTPUT_TERMINAL_SPEAKER
#define AUDIO_OUTPUT_TERMINAL_SPEAKER
Definition audio_desc.h:142
MCU_ID2
#define MCU_ID2
Definition audio_desc.h:215
AT32_AUDIO_FREQ_16K
#define AT32_AUDIO_FREQ_16K
audio support freq
Definition audio_desc.h:187
AUDIO_AS_FORMAT_TYPE
#define AUDIO_AS_FORMAT_TYPE
Definition audio_desc.h:104
AUDIO_MIC_INPUT_TERMINAL_ID
#define AUDIO_MIC_INPUT_TERMINAL_ID
audio terminal id define
Definition audio_desc.h:167
AUDIO_SPK_BITW
#define AUDIO_SPK_BITW
Definition audio_desc.h:202
MCU_ID3
#define MCU_ID3
Definition audio_desc.h:216
AUDIO_FEATURE_UNIT_SIZE
#define AUDIO_FEATURE_UNIT_SIZE
Definition audio_desc.h:162
AUDIO_PROTOCOL_UNDEFINED
#define AUDIO_PROTOCOL_UNDEFINED
audio interface protocol codes
Definition audio_desc.h:84
AUDIO_MIC_BITW
#define AUDIO_MIC_BITW
Definition audio_desc.h:195
USBD_AUDIO_VENDOR_ID
#define USBD_AUDIO_VENDOR_ID
Definition audio_desc.h:52
AUDIO_AC_FEATURE_UNIT
#define AUDIO_AC_FEATURE_UNIT
Definition audio_desc.h:95
AUDIO_SPK_INPUT_TERMINAL_ID
#define AUDIO_SPK_INPUT_TERMINAL_ID
Definition audio_desc.h:170
AUDIO_BINTERVAL_TIME
#define AUDIO_BINTERVAL_TIME
Definition audio_desc.h:204
AUDIO_INTERFACE_LEN
#define AUDIO_INTERFACE_LEN
Definition audio_desc.h:153
AUDIO_SUBCLASS_AUDIOSTREAMING
#define AUDIO_SUBCLASS_AUDIOSTREAMING
Definition audio_desc.h:68
USBD_AUDIO_DESC_MANUFACTURER_STRING
#define USBD_AUDIO_DESC_MANUFACTURER_STRING
Definition audio_desc.h:58
AUDIO_AC_OUTPUT_TERMINAL
#define AUDIO_AC_OUTPUT_TERMINAL
Definition audio_desc.h:92
AUDIO_INPUT_TERMINAL_MICROPHONE
#define AUDIO_INPUT_TERMINAL_MICROPHONE
Definition audio_desc.h:140
serial_descriptor
static usbd_desc_t serial_descriptor
Definition audio_desc.c:438
device_descriptor
static usbd_desc_t device_descriptor
Definition audio_desc.c:417
get_device_configuration
static usbd_desc_t * get_device_configuration(void)
get config descriptor
Definition audio_desc.c:546
langid_descriptor
static usbd_desc_t langid_descriptor
Definition audio_desc.c:431
get_device_descriptor
static usbd_desc_t * get_device_descriptor(void)
get device descriptor
Definition audio_desc.c:526
get_device_manufacturer_string
static usbd_desc_t * get_device_manufacturer_string(void)
get manufacturer descriptor
Definition audio_desc.c:577
get_device_qualifier
static usbd_desc_t * get_device_qualifier(void)
get device qualifier
Definition audio_desc.c:536
get_device_interface_string
static usbd_desc_t * get_device_interface_string(void)
get interface descriptor
Definition audio_desc.c:612
vp_desc
static usbd_desc_t vp_desc
Definition audio_desc.c:444
get_device_other_speed
static usbd_desc_t * get_device_other_speed(void)
get other speed descriptor
Definition audio_desc.c:556
ALIGNED_TAIL
static ALIGNED_HEAD uint8_t g_usbd_desc_buffer[256] ALIGNED_TAIL
usb device standard descriptor
Definition audio_desc.c:59
get_device_product_string
static usbd_desc_t * get_device_product_string(void)
get product descriptor
Definition audio_desc.c:589
get_device_config_string
static usbd_desc_t * get_device_config_string(void)
get device config descriptor
Definition audio_desc.c:624
usbd_unicode_convert
static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf)
standard usb unicode convert
Definition audio_desc.c:452
get_device_lang_id
static usbd_desc_t * get_device_lang_id(void)
get lang id descriptor
Definition audio_desc.c:566
get_serial_num
static void get_serial_num(void)
usb get serial number
Definition audio_desc.c:504
config_descriptor
static usbd_desc_t config_descriptor
Definition audio_desc.c:424
get_device_serial_string
static usbd_desc_t * get_device_serial_string(void)
get serial descriptor
Definition audio_desc.c:601
audio_desc_handler
usbd_desc_handler audio_desc_handler
device descriptor handler structure
Definition audio_desc.c:64
usbd_int_to_unicode
static void usbd_int_to_unicode(uint32_t value, uint8_t *pbuf, uint8_t len)
usb int convert to unicode
Definition audio_desc.c:478
AUDIO_SUPPORT_FEEDBACK
#define AUDIO_SUPPORT_FEEDBACK
Definition audio/audio_conf.h:48
HBYTE
#define HBYTE(x)
Definition usb_std.h:271
USB_EPT_DESC_ISO
#define USB_EPT_DESC_ISO
Definition usb_std.h:182
USB_MAX_EP0_SIZE
#define USB_MAX_EP0_SIZE
endpoint 0 max size
Definition usb_std.h:248
USB_PRODUCT_STRING
#define USB_PRODUCT_STRING
Definition usb_std.h:105
USB_DESCIPTOR_TYPE_CONFIGURATION
#define USB_DESCIPTOR_TYPE_CONFIGURATION
Definition usb_std.h:92
LBYTE
#define LBYTE(x)
low byte and high byte define
Definition usb_std.h:270
USB_DESCIPTOR_TYPE_ENDPOINT
#define USB_DESCIPTOR_TYPE_ENDPOINT
Definition usb_std.h:95
USB_DEVICE_DESC_LEN
#define USB_DEVICE_DESC_LEN
Definition usb_std.h:156
USB_MFC_STRING
#define USB_MFC_STRING
Definition usb_std.h:104
USB_DEVICE_IF_DESC_LEN
#define USB_DEVICE_IF_DESC_LEN
Definition usb_std.h:158
USB_DEVICE_CFG_DESC_LEN
#define USB_DEVICE_CFG_DESC_LEN
Definition usb_std.h:157
USB_SERIAL_STRING
#define USB_SERIAL_STRING
Definition usb_std.h:106
USB_DESCIPTOR_TYPE_DEVICE
#define USB_DESCIPTOR_TYPE_DEVICE
usb standard device type
Definition usb_std.h:91
USB_DESCIPTOR_TYPE_STRING
#define USB_DESCIPTOR_TYPE_STRING
Definition usb_std.h:93
USB_CLASS_CODE_AUDIO
#define USB_CLASS_CODE_AUDIO
usb class code
Definition usb_std.h:167
USB_DESCIPTOR_TYPE_INTERFACE
#define USB_DESCIPTOR_TYPE_INTERFACE
Definition usb_std.h:94
USB_ETP_DESC_ASYNC
#define USB_ETP_DESC_ASYNC
Definition usb_std.h:187
usbd_desc_handler
usb device descriptor handler
Definition usbd_core.h:75
usbd_desc_t
usb device descriptor struct
Definition usbd_core.h:66
usbd_desc_t::length
uint16_t length
Definition usbd_core.h:67
usbd_desc_t::descriptor
uint8_t * descriptor
Definition usbd_core.h:68
usb_std.h
usb standard header file
usbd_core.h
usb device core header file
usbd_sdr.h
usb standard request header file


AT32F413 Firmwary Library: audio_desc.h Source File

  • middlewares
  • usbd_class
  • audio
audio_desc.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AUDIO_DESC_H
28#define __AUDIO_DESC_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "audio_class.h"
35#include "usbd_core.h"
36#include "audio_conf.h"
37
50#define AUDIO_BCD_NUM 0x0100
51
52#define USBD_AUDIO_VENDOR_ID 0x2E3C
53#define USBD_AUDIO_PRODUCT_ID 0x5730
54
55#define USBD_AUDIO_SIZ_STRING_LANGID 4
56#define USBD_AUDIO_SIZ_STRING_SERIAL 0x1A
57
58#define USBD_AUDIO_DESC_MANUFACTURER_STRING "Artery"
59#define USBD_AUDIO_DESC_PRODUCT_STRING "AT32 Audio"
60#define USBD_AUDIO_DESC_CONFIGURATION_STRING "Audio Config"
61#define USBD_AUDIO_DESC_INTERFACE_STRING "Audio Interface"
62
66#define AUDIO_SUBCLASS_UNDEFINED 0x00
67#define AUDIO_SUBCLASS_AUDIOCONTROL 0x01
68#define AUDIO_SUBCLASS_AUDIOSTREAMING 0x02
69#define AUDIO_SUBCLASS_MIDISTREMING 0x03
70
74#define AUDIO_CS_INTERFACE 0x24
75#define AUDIO_CS_ENDPOINT 0x25
76#define AUDIO_CS_STRING 0x23
77#define AUDIO_CS_CONFIGURATION 0x22
78#define AUDIO_CS_DEVICE 0x21
79#define AUDIO_CS_UNDEFINED 0x20
80
84#define AUDIO_PROTOCOL_UNDEFINED 0x00
85
89#define AUDIO_AC_DESCRIPTOR_UNDEFINED 0x00
90#define AUDIO_AC_HEADER 0x01
91#define AUDIO_AC_INPUT_TERMINAL 0x02
92#define AUDIO_AC_OUTPUT_TERMINAL 0x03
93#define AUDIO_AC_MIXER_UNIT 0x04
94#define AUDIO_AC_SELECTOR_UNIT 0x05
95#define AUDIO_AC_FEATURE_UNIT 0x06
96#define AUDIO_AC_PROCESSING_UNIT 0x07
97#define AUDIO_AC_EXTENSION_UNIT 0x08
98
102#define AUDIO_AS_DESCRIPTOR_UNDEFINED 0x00
103#define AUDIO_AS_GENERAL 0x01
104#define AUDIO_AS_FORMAT_TYPE 0x02
105#define AUDIO_AS_FORMAT_SPECIFIC 0x03
106
110#define AUDIO_REQUEST_CODE_UNDEFINED 0x00
111#define AUDIO_REQ_SET_CUR 0x01
112#define AUDIO_REQ_GET_CUR 0x81
113#define AUDIO_REQ_SET_MIN 0x02
114#define AUDIO_REQ_GET_MIN 0x82
115#define AUDIO_REQ_SET_MAX 0x03
116#define AUDIO_REQ_GET_MAX 0x83
117#define AUDIO_REQ_SET_RES 0x04
118#define AUDIO_REQ_GET_RES 0x84
119#define AUDIO_REQ_SET_MEM 0x05
120#define AUDIO_REQ_GET_MEM 0x85
121#define AUDIO_REQ_GET_STAT 0xFF
122
126#define AUDIO_FU_CONTROL_UNDEFINED 0x00
127#define AUDIO_FU_MUTE_CONTROL 0x01
128#define AUDIO_FU_VOLUME_CONTROL 0x02
129#define AUDIO_FU_BASS_CONTROL 0x03
130#define AUDIO_FU_MID_CONTROL 0x04
131#define AUDIO_FU_TREBLE_CONTROL 0x05
132
136#define AUDIO_TERMINAL_TYPE_UNDEFINED 0x0100
137#define AUDIO_TERMINAL_TYPE_STREAMING 0x0101
138#define AUDIO_TERMINAL_TYPE_VENDOR 0x01FF
139#define AUDIO_INPUT_TERMINAL_UNDEFINED 0x0200
140#define AUDIO_INPUT_TERMINAL_MICROPHONE 0x0201
141#define AUDIO_OUTPUT_TERMINAL_UNDEFINED 0x0300
142#define AUDIO_OUTPUT_TERMINAL_SPEAKER 0x0301
143
147#define AUDIO_FORMAT_TYPE_I 0x01
148
152#define AUDIO_INTERFACE_NUM (AUDIO_SUPPORT_SPK + AUDIO_SUPPORT_MIC)
153#define AUDIO_INTERFACE_LEN ((0x08 + AUDIO_INTERFACE_NUM) + AUDIO_INTERFACE_NUM * 0x22)
154#define AUDIO_MIC_INTERFACE 0x01
155#define AUDIO_SPK_INTERFACE 0x02
156
160#define AUDIO_INPUT_TERMINAL_SIZE 0x0C
161#define AUDIO_OUTPUT_TERMINAL_SIZE 0x09
162#define AUDIO_FEATURE_UNIT_SIZE 0x0D
163
167#define AUDIO_MIC_INPUT_TERMINAL_ID 0x01
168#define AUDIO_MIC_FEATURE_UNIT_ID 0x02
169#define AUDIO_MIC_OUTPUT_TERMINAL_ID 0x03
170#define AUDIO_SPK_INPUT_TERMINAL_ID 0x04
171#define AUDIO_SPK_FEATURE_UNIT_ID 0x05
172#define AUDIO_SPK_OUTPUT_TERMINAL_ID 0x06
173
177#define AUDIO_MIC_INTERFACE_NUMBER 0x01
178#if (AUDIO_SUPPORT_MIC == 1)
179#define AUDIO_SPK_INTERFACE_NUMBER 0x02
180#else
181#define AUDIO_SPK_INTERFACE_NUMBER 0x01
182#endif
183
187#define AT32_AUDIO_FREQ_16K 16000
188#define AT32_AUDIO_FREQ_48K 48000
189
193#define AUDIO_MIC_FREQ_SIZE (AUDIO_SUPPORT_FREQ)
194#define AUDIO_MIC_CHR AUDIO_MIC_CHANEL_NUM
195#define AUDIO_MIC_BITW (AUDIO_MIC_DEFAULT_BITW)
196
200#define AUDIO_SPK_FREQ_SIZE (AUDIO_SUPPORT_FREQ)
201#define AUDIO_SPK_CHR AUDIO_SPK_CHANEL_NUM
202#define AUDIO_SPK_BITW (AUDIO_SPK_DEFAULT_BITW)
203
204#define AUDIO_BINTERVAL_TIME 0x01
205
206
207#define USBD_AUDIO_CONFIG_DESC_SIZE ( 0x12 + AUDIO_INTERFACE_LEN + \
208 + (0x31 + AUDIO_SPK_FREQ_SIZE * 3) \
209 + (0x31 + AUDIO_MIC_FREQ_SIZE * 3) \
210 + (9 * AUDIO_SUPPORT_FEEDBACK) \
211 )
212#define SAMPLE_FREQ(frq) (uint8_t)(frq), (uint8_t)((frq >> 8)), (uint8_t)((frq >> 16))
213
214#define MCU_ID1 (0x1FFFF7E8)
215#define MCU_ID2 (0x1FFFF7EC)
216#define MCU_ID3 (0x1FFFF7F0)
217
218extern usbd_desc_handler audio_desc_handler;
219
231#ifdef __cplusplus
232}
233#endif
234
235#endif
236
audio_conf.h
usb audio config
audio_class.h
usb audio class file
audio_desc_handler
usbd_desc_handler audio_desc_handler
device descriptor handler structure
Definition audio_desc.c:64
usbd_desc_handler
usb device descriptor handler
Definition usbd_core.h:75
usbd_core.h
usb device core header file


AT32F413 Firmwary Library: audio_conf.h Source File

  • middlewares
  • usbd_class
  • audio_hid
audio_hid/audio_conf.h
Go to the documentation of this file.
1
26 /* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AUDIO_CONF_H
28#define __AUDIO_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34
46#define AUDIO_SUPPORT_SPK 1
47#define AUDIO_SUPPORT_MIC 1
48#define AUDIO_SUPPORT_FEEDBACK 1
49
50#define AUDIO_SUPPORT_FREQ_16K 0
51#define AUDIO_SUPPORT_FREQ_48K 1
52
53
54#define AUDIO_SUPPORT_FREQ (AUDIO_SUPPORT_FREQ_16K + \
55 AUDIO_SUPPORT_FREQ_48K \
56 )
57
58#define AUDIO_FREQ_16K 16000
59#define AUDIO_FREQ_48K 48000
60#define AUDIO_BITW_16 16
61
62#define AUDIO_MIC_CHANEL_NUM 2
63#define AUDIO_MIC_DEFAULT_BITW AUDIO_BITW_16
64
65#define AUDIO_SPK_CHANEL_NUM 2
66#define AUDIO_SPK_DEFAULT_BITW AUDIO_BITW_16
67
68
69#define AUDIO_SUPPORT_MAX_FREQ 48
70#define AUDIO_DEFAULT_FREQ AUDIO_FREQ_48K
71#define AUDIO_DEFAULT_BITW AUDIO_BITW_16
72
84#ifdef __cplusplus
85}
86#endif
87
88#endif
89
90
91


AT32F413 Firmwary Library: audio_hid_class.c Source File

  • middlewares
  • usbd_class
  • audio_hid
audio_hid_class.c
Go to the documentation of this file.
1
25#include "usbd_core.h"
26#include "audio_hid_class.h"
27#include "audio_hid_desc.h"
28#include "audio_codec.h"
29
43static usb_sts_type class_init_handler(void *udev);
44static usb_sts_type class_clear_handler(void *udev);
45static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup);
46static usb_sts_type class_ept0_tx_handler(void *udev);
47static usb_sts_type class_ept0_rx_handler(void *udev);
48static usb_sts_type class_in_handler(void *udev, uint8_t ept_num);
49static usb_sts_type class_out_handler(void *udev, uint8_t ept_num);
50static usb_sts_type class_sof_handler(void *udev);
51static usb_sts_type class_event_handler(void *udev, usbd_event_type event);
52
53static void audio_req_get_cur(void *udev, usb_setup_type *setup);
54static void audio_req_set_cur(void *udev, usb_setup_type *setup);
55static void audio_req_get_min(void *udev, usb_setup_type *setup);
56static void audio_req_get_max(void *udev, usb_setup_type *setup);
57static void audio_req_get_res(void *udev, usb_setup_type *setup);
58static void audio_get_interface(void *udev, usb_setup_type *setup);
59static void audio_set_interface(void *udev, usb_setup_type *setup);
60static void usb_hid_buf_process(void *udev, uint8_t *report, uint16_t len);
61 usb_audio_hid_type audio_hid_struct = {0, 0, 0, 0, 0, 0x1400, 0, 0, 0, {0x0000, 0x1400, 0x33}, {0x0000, 0x1400, 0x33}, 0, 0};
62
63 usbd_class_handler audio_hid_class_handler =
64{
65 class_init_handler,
66 class_clear_handler,
67 class_setup_handler,
68 class_ept0_tx_handler,
69 class_ept0_rx_handler,
70 class_in_handler,
71 class_out_handler,
72 class_sof_handler,
73 class_event_handler,
74 &audio_hid_struct
75};
76
82static usb_sts_type class_init_handler(void *udev)
83{
84 usb_sts_type status = USB_OK;
85 usbd_core_type *pudev = (usbd_core_type *)udev;
86 usb_audio_hid_type *paudio_hid = (usb_audio_hid_type *)pudev->class_handler->pdata;
87 /* enable microphone in endpoint double buffer mode */
88 usbd_ept_dbuffer_enable(pudev, USBD_AUHID_AUDIO_MIC_IN_EPT);
89
90 /* open microphone in endpoint */
91 usbd_ept_open(pudev, USBD_AUHID_AUDIO_MIC_IN_EPT, EPT_ISO_TYPE, AUDIO_MIC_IN_MAXPACKET_SIZE);
92
93 /* enable speaker out endpoint double buffer mode */
94 usbd_ept_dbuffer_enable(pudev, USBD_AUHID_AUDIO_SPK_OUT_EPT);
95
96 /* open speaker out endpoint */
97 usbd_ept_open(pudev, USBD_AUHID_AUDIO_SPK_OUT_EPT, EPT_ISO_TYPE, AUDIO_SPK_OUT_MAXPACKET_SIZE);
98#if AUDIO_SUPPORT_FEEDBACK
99 /* enable speaker feedback endpoint double buffer mode */
100 usbd_ept_dbuffer_enable(pudev, USBD_AUHID_AUDIO_FEEDBACK_EPT);
101
102 /* open speaker feedback endpoint */
103 usbd_ept_open(pudev, USBD_AUHID_AUDIO_FEEDBACK_EPT, EPT_ISO_TYPE, AUDIO_FEEDBACK_MAXPACKET_SIZE);
104#endif
105 /* start receive speaker out data */
106 usbd_ept_recv(pudev, USBD_AUHID_AUDIO_SPK_OUT_EPT, paudio_hid->audio_spk_data, AUDIO_SPK_OUT_MAXPACKET_SIZE);
107
108 /*open hid endpoint */
109
110 /* open custom hid in endpoint */
111 usbd_ept_open(pudev, USBD_AUHID_HID_IN_EPT, EPT_INT_TYPE, USBD_AUHID_IN_MAXPACKET_SIZE);
112
113 /* open custom hid out endpoint */
114 usbd_ept_open(pudev, USBD_AUHID_HID_OUT_EPT, EPT_INT_TYPE, USBD_AUHID_OUT_MAXPACKET_SIZE);
115
116 /* set out endpoint to receive status */
117 usbd_ept_recv(pudev, USBD_AUHID_HID_OUT_EPT, paudio_hid->g_rxhid_buff, USBD_AUHID_OUT_MAXPACKET_SIZE);
118
119 return status;
120}
121
127static usb_sts_type class_clear_handler(void *udev)
128{
129 usb_sts_type status = USB_OK;
130 usbd_core_type *pudev = (usbd_core_type *)udev;
131
132 /* close in endpoint */
133 usbd_ept_close(pudev, USBD_AUHID_AUDIO_MIC_IN_EPT);
134
135#if AUDIO_SUPPORT_FEEDBACK
136 /* close in endpoint */
137 usbd_ept_close(pudev, USBD_AUHID_AUDIO_FEEDBACK_EPT);
138#endif
139
140 /* close out endpoint */
141 usbd_ept_close(pudev, USBD_AUHID_AUDIO_SPK_OUT_EPT);
142
143 /* close custom hid in endpoint */
144 usbd_ept_close(pudev, USBD_AUHID_HID_IN_EPT);
145
146 /* close custom hid out endpoint */
147 usbd_ept_close(pudev, USBD_AUHID_HID_OUT_EPT);
148
149 return status;
150}
151
158 usb_sts_type class_audio_setup_handler(void *udev, usb_setup_type *setup)
159{
160 usb_sts_type status = USB_OK;
161 usbd_core_type *pudev = (usbd_core_type *)udev;
162 uint16_t len;
163
164 switch(setup->bmRequestType & USB_REQ_TYPE_RESERVED)
165 {
166 /* class request */
167 case USB_REQ_TYPE_CLASS:
168 switch(setup->bRequest)
169 {
170 case AUDIO_REQ_GET_CUR:
171 audio_req_get_cur(pudev, setup);
172 break;
173
174 case AUDIO_REQ_SET_CUR:
175 audio_req_set_cur(pudev, setup);
176 break;
177
178 case AUDIO_REQ_GET_MIN:
179 audio_req_get_min(pudev, setup);
180 break;
181
182 case AUDIO_REQ_GET_MAX:
183 audio_req_get_max(pudev, setup);
184 break;
185
186 case AUDIO_REQ_GET_RES:
187 audio_req_get_res(pudev, setup);
188 break;
189
190 default:
191 usbd_ctrl_unsupport(pudev);
192 break;
193 }
194 break;
195 /* standard request */
196 case USB_REQ_TYPE_STANDARD:
197 switch(setup->bRequest)
198 {
199 case USB_STD_REQ_GET_DESCRIPTOR:
200 if((setup->wValue >> 8) == AUDIO_DESCRIPTOR_TYPE)
201 {
202 usbd_desc_t *config = pudev->desc_handler->get_device_configuration();
203 len = MIN(AUDIO_DESCRIPTOR_SIZE, setup->wLength);
204 usbd_ctrl_send(pudev, config->descriptor + 18, len);
205 }
206 else
207 {
208 usbd_ctrl_unsupport(pudev);
209 }
210 break;
211 case USB_STD_REQ_GET_INTERFACE:
212 audio_get_interface(udev, setup);
213 break;
214
215 case USB_STD_REQ_SET_INTERFACE:
216 audio_set_interface(udev, setup);
217 usbd_ctrl_send_status(pudev);
218 break;
219
220 case USB_STD_REQ_CLEAR_FEATURE:
221 break;
222 case USB_STD_REQ_SET_FEATURE:
223 break;
224 default:
225 usbd_ctrl_unsupport(pudev);
226 break;
227 }
228 break;
229
230 default:
231 usbd_ctrl_unsupport(pudev);
232 break;
233 }
234 return status;
235
236}
237
244 usb_sts_type class_hid_setup_handler(void *udev, usb_setup_type *setup)
245{
246 usb_sts_type status = USB_OK;
247 usbd_core_type *pudev = (usbd_core_type *)udev;
248 usb_audio_hid_type *paudio_hid = (usb_audio_hid_type *)pudev->class_handler->pdata;
249 uint16_t len;
250 uint8_t *buf;
251
252 switch(setup->bmRequestType & USB_REQ_TYPE_RESERVED)
253 {
254 /* class request */
255 case USB_REQ_TYPE_CLASS:
256 switch(setup->bRequest)
257 {
258 case HID_REQ_SET_PROTOCOL:
259 paudio_hid->hid_protocol = (uint8_t)setup->wValue;
260 break;
261 case HID_REQ_GET_PROTOCOL:
262 usbd_ctrl_send(pudev, (uint8_t *)&paudio_hid->hid_protocol, 1);
263 break;
264 case HID_REQ_SET_IDLE:
265 paudio_hid->hid_set_idle = (uint8_t)(setup->wValue >> 8);
266 break;
267 case HID_REQ_GET_IDLE:
268 usbd_ctrl_send(pudev, (uint8_t *)&paudio_hid->hid_set_idle, 1);
269 break;
270 case HID_REQ_SET_REPORT:
271 paudio_hid->hid_state = HID_REQ_SET_REPORT;
272 usbd_ctrl_recv(pudev, paudio_hid->hid_set_report, setup->wLength);
273 break;
274 default:
275 usbd_ctrl_unsupport(pudev);
276 break;
277 }
278 break;
279 /* standard request */
280 case USB_REQ_TYPE_STANDARD:
281 switch(setup->bRequest)
282 {
283 case USB_STD_REQ_GET_DESCRIPTOR:
284 if(setup->wValue >> 8 == HID_REPORT_DESC)
285 {
286 len = MIN(USBD_AUHID_HID_SIZ_REPORT_DESC, setup->wLength);
287 buf = (uint8_t *)g_usbd_audio_hid_report;
288 usbd_ctrl_send(pudev, (uint8_t *)buf, len);
289 }
290 else if(setup->wValue >> 8 == HID_DESCRIPTOR_TYPE)
291 {
292 len = MIN(9, setup->wLength);
293 buf = (uint8_t *)g_audio_hid_usb_desc;
294 usbd_ctrl_send(pudev, (uint8_t *)buf, len);
295 }
296 else
297 {
298 usbd_ctrl_unsupport(pudev);
299 }
300 break;
301 case USB_STD_REQ_GET_INTERFACE:
302 usbd_ctrl_send(pudev, (uint8_t *)&paudio_hid->alt_setting, 1);
303 break;
304 case USB_STD_REQ_SET_INTERFACE:
305 paudio_hid->alt_setting = setup->wValue;
306 break;
307 case USB_STD_REQ_CLEAR_FEATURE:
308 break;
309 case USB_STD_REQ_SET_FEATURE:
310 break;
311 default:
312 usbd_ctrl_unsupport(pudev);
313 break;
314 }
315 break;
316 default:
317 usbd_ctrl_unsupport(pudev);
318 break;
319 }
320 return status;
321}
328 usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
329{
330 usb_sts_type status = USB_OK;
331 usbd_core_type *pudev = (usbd_core_type *)udev;
332 switch(setup->bmRequestType & USB_REQ_RECIPIENT_MASK)
333 {
334 case USB_REQ_RECIPIENT_INTERFACE:
335 if(setup->wIndex == HID_INTERFACE_NUMBER)
336 {
337 class_hid_setup_handler(udev, setup);
338 }
339 else
340 {
341 class_audio_setup_handler(pudev, setup);
342 }
343 break;
344 case USB_REQ_RECIPIENT_ENDPOINT:
345 class_audio_setup_handler(pudev, setup);
346 break;
347
348 }
349 return status;
350
351
352}
353
359 usb_sts_type class_ept0_tx_handler(void *udev)
360{
361 usb_sts_type status = USB_OK;
362
363 /* ...user code... */
364
365 return status;
366}
367
373static usb_sts_type class_ept0_rx_handler(void *udev)
374{
375 usb_sts_type status = USB_OK;
376 usbd_core_type *pudev = (usbd_core_type *)udev;
377 usb_audio_hid_type *paudio_hid = (usb_audio_hid_type *)pudev->class_handler->pdata;
378 usb_setup_type *setup = &pudev->setup;
379 uint32_t recv_len = usbd_get_recv_len(pudev, 0);
380
381 /* ...user code... */
382 if(setup->wIndex == HID_INTERFACE_NUMBER)
383 {
384 if( paudio_hid->hid_state == HID_REQ_SET_REPORT)
385 {
386 /* hid buffer process */
387 usb_hid_buf_process(udev, paudio_hid->hid_set_report, recv_len);
388 paudio_hid->hid_state = 0;
389 }
390 }
391 else
392 {
393 /* ...user code... */
394 if( paudio_hid->audio_cmd == AUDIO_REQ_SET_CUR)
395 {
396 /* class process */
397 switch(paudio_hid->request_no)
398 {
399 case AUDIO_VOLUME_CONTROL:
400 if(paudio_hid->interface == AUDIO_SPK_FEATURE_UNIT_ID)
401 {
402 paudio_hid->spk_volume = (uint16_t)(paudio_hid->g_audio_cur[0] |
403 (paudio_hid->g_audio_cur[1] << 8));
404 /* set volume */
405 audio_codec_set_spk_volume(paudio_hid->spk_volume*100/paudio_hid->spk_volume_limits[1]);
406 }
407 else
408 {
409 paudio_hid->mic_volume = (uint16_t)(paudio_hid->g_audio_cur[0] |
410 (paudio_hid->g_audio_cur[1] << 8));
411
412 audio_codec_set_mic_volume(paudio_hid->mic_volume*256/paudio_hid->mic_volume_limits[1]);
413 }
414 break;
415 case AUDIO_MUTE_CONTROL:
416 if(paudio_hid->interface == AUDIO_SPK_FEATURE_UNIT_ID)
417 {
418 paudio_hid->spk_mute = paudio_hid->g_audio_cur[0];
419 audio_codec_set_spk_mute(paudio_hid->spk_mute);
420 }
421 else
422 {
423 paudio_hid->mic_mute = paudio_hid->g_audio_cur[0];
424 audio_codec_set_mic_mute(paudio_hid->mic_mute);
425 }
426
427 break;
428 case AUDIO_FREQ_SET_CONTROL:
429 if(paudio_hid->enpd == USBD_AUHID_AUDIO_MIC_IN_EPT)
430 {
431 paudio_hid->mic_freq = (paudio_hid->g_audio_cur[0] |
432 (paudio_hid->g_audio_cur[1] << 8) |
433 (paudio_hid->g_audio_cur[2] << 16));
434 audio_codec_set_mic_freq(paudio_hid->mic_freq);
435 }
436 else
437 {
438 paudio_hid->spk_freq = (paudio_hid->g_audio_cur[0] |
439 (paudio_hid->g_audio_cur[1] << 8) |
440 (paudio_hid->g_audio_cur[2] << 16));
441 audio_codec_set_spk_freq(paudio_hid->spk_freq);
442 }
443 break;
444 default:
445 break;
446 }
447 }
448 }
449
450 return status;
451}
452
459 usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
460{
461 usb_sts_type status = USB_OK;
462 usbd_core_type *pudev = (usbd_core_type *)udev;
463 usb_audio_hid_type *paudio_hid = (usb_audio_hid_type *)pudev->class_handler->pdata;
464 uint32_t len = 0;
465
466 /* ...user code...
467 trans next packet data
468 */
469 if((ept_num & 0x7F) == (USBD_AUHID_AUDIO_MIC_IN_EPT & 0x7F))
470 {
471 len = audio_codec_mic_get_data(paudio_hid->audio_mic_data);
472 usbd_ept_send(udev, USBD_AUHID_AUDIO_MIC_IN_EPT, paudio_hid->audio_mic_data, len);
473 }
474#if AUDIO_SUPPORT_FEEDBACK
475 else if((ept_num & 0x7F) == (USBD_AUHID_AUDIO_FEEDBACK_EPT & 0x7F))
476 {
477 len = audio_codec_spk_feedback(paudio_hid->audio_feed_back);
478 usbd_ept_send(udev, USBD_AUHID_AUDIO_FEEDBACK_EPT, paudio_hid->audio_feed_back, len);
479 }
480#endif
481 else if((ept_num & 0x7F) == (USBD_AUHID_HID_IN_EPT & 0x7F))
482 {
483
484 }
485
486 return status;
487}
488
495static usb_sts_type class_out_handler(void *udev, uint8_t ept_num)
496{
497 usb_sts_type status = USB_OK;
498 usbd_core_type *pudev = (usbd_core_type *)udev;
499 usb_audio_hid_type *paudio_hid = (usb_audio_hid_type *)pudev->class_handler->pdata;
500 uint16_t g_rxlen;
501
502 /* get endpoint receive data length */
503 g_rxlen = usbd_get_recv_len(pudev, ept_num);
504
505 if((ept_num & 0x7F) == (USBD_AUHID_AUDIO_SPK_OUT_EPT & 0x7F))
506 {
507 /* speaker data*/
508 audio_codec_spk_fifo_write(paudio_hid->audio_spk_data, g_rxlen);
509
510 /* get next data */
511 usbd_ept_recv(pudev, USBD_AUHID_AUDIO_SPK_OUT_EPT, paudio_hid->audio_spk_data, AUDIO_SPK_OUT_MAXPACKET_SIZE);
512 }
513 else if((ept_num & 0x7F) == (USBD_AUHID_HID_OUT_EPT & 0x7F))
514 {
515 /* hid buffer process */
516 usb_hid_buf_process(udev, paudio_hid->g_rxhid_buff, g_rxlen);
517
518 /* start receive next packet */
519 usbd_ept_recv(pudev, USBD_AUHID_HID_OUT_EPT, paudio_hid->g_rxhid_buff, USBD_AUHID_OUT_MAXPACKET_SIZE);
520 }
521 return status;
522}
523
529static usb_sts_type class_sof_handler(void *udev)
530{
531 usb_sts_type status = USB_OK;
532
533 /* ...user code... */
534
535 return status;
536}
537
544static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
545{
546 usb_sts_type status = USB_OK;
547 usbd_core_type *pudev = (usbd_core_type *)udev;
548 usb_audio_hid_type *paudio_hid = (usb_audio_hid_type *)pudev->class_handler->pdata;
549 switch(event)
550 {
551 case USBD_RESET_EVENT:
552
553 /* ...user code... */
554
555 break;
556 case USBD_SUSPEND_EVENT:
557 paudio_hid->spk_alt_setting = 0;
558 audio_codec_spk_alt_setting(paudio_hid->spk_alt_setting);
559 paudio_hid->mic_alt_setting = 0;
560 audio_codec_mic_alt_setting(paudio_hid->spk_alt_setting);
561 /* ...user code... */
562
563 break;
564 case USBD_WAKEUP_EVENT:
565 /* ...user code... */
566
567 break;
568 default:
569 break;
570 }
571 return status;
572}
573
580static void audio_req_get_cur(void *udev, usb_setup_type *setup)
581{
582 usbd_core_type *pudev = (usbd_core_type *)udev;
583 usb_audio_hid_type *paudio_hid = (usb_audio_hid_type *)pudev->class_handler->pdata;
584
585 switch(setup->bmRequestType & AUDIO_REQ_CONTROL_MASK)
586 {
587 case AUDIO_REQ_CONTROL_INTERFACE:
588 if(HBYTE(setup->wIndex) == AUDIO_SPK_FEATURE_UNIT_ID)
589 {
590 if(HBYTE(setup->wValue) == AUDIO_MUTE_CONTROL)
591 {
592 paudio_hid->g_audio_cur[0] = paudio_hid->spk_mute;
593 usbd_ctrl_send(pudev, paudio_hid->g_audio_cur, setup->wLength);
594 }
595 else if(HBYTE(setup->wValue) == AUDIO_VOLUME_CONTROL)
596 {
597 *((uint16_t *)paudio_hid->g_audio_cur) = paudio_hid->spk_volume;
598 usbd_ctrl_send(pudev, paudio_hid->g_audio_cur, setup->wLength);
599 }
600 else
601 {
602 usbd_ctrl_unsupport(pudev);
603 }
604 }
605 else if(HBYTE(setup->wIndex) == AUDIO_MIC_FEATURE_UNIT_ID)
606 {
607 if(HBYTE(setup->wValue) == AUDIO_MUTE_CONTROL)
608 {
609 paudio_hid->g_audio_cur[0] = paudio_hid->mic_mute;
610 usbd_ctrl_send(pudev, paudio_hid->g_audio_cur, setup->wLength);
611 }
612 else if(HBYTE(setup->wValue) == AUDIO_VOLUME_CONTROL)
613 {
614 *((uint16_t *)paudio_hid->g_audio_cur) = paudio_hid->mic_volume;
615 usbd_ctrl_send(pudev, paudio_hid->g_audio_cur, setup->wLength);
616 }
617 else
618 {
619 usbd_ctrl_unsupport(pudev);
620 }
621 }
622 else
623 {
624 usbd_ctrl_unsupport(pudev);
625 }
626 break;
627 case AUDIO_REQ_CONTROL_ENDPOINT:
628 if(HBYTE(setup->wValue) == AUDIO_SAMPLING_FREQ_CONTROL)
629 {
630 if(setup->wIndex == USBD_AUHID_AUDIO_MIC_IN_EPT)
631 {
632 *((uint32_t *)paudio_hid->g_audio_cur) = paudio_hid->mic_freq;
633 usbd_ctrl_send(pudev, paudio_hid->g_audio_cur, setup->wLength);
634 }
635 else if(setup->wIndex == USBD_AUHID_AUDIO_SPK_OUT_EPT)
636 {
637 *((uint32_t *)paudio_hid->g_audio_cur) = paudio_hid->spk_freq;
638 usbd_ctrl_send(pudev, paudio_hid->g_audio_cur, setup->wLength);
639 }
640 else
641 {
642 usbd_ctrl_unsupport(pudev);
643 }
644 }
645 else
646 {
647 usbd_ctrl_unsupport(pudev);
648 }
649 break;
650 default:
651 usbd_ctrl_unsupport(pudev);
652 break;
653 }
654}
655
662static void audio_req_set_cur(void *udev, usb_setup_type *setup)
663{
664 usbd_core_type *pudev = (usbd_core_type *)udev;
665 usb_audio_hid_type *paudio_hid = (usb_audio_hid_type *)pudev->class_handler->pdata;
666
667 if(setup->wLength > 0)
668 {
669 usbd_ctrl_recv(pudev, paudio_hid->g_audio_cur, setup->wLength);
670
671 paudio_hid->audio_cmd = AUDIO_REQ_SET_CUR;
672 paudio_hid->audio_cmd_len = setup->wLength;
673
674 switch(setup->bmRequestType & AUDIO_REQ_CONTROL_MASK)
675 {
676 case AUDIO_REQ_CONTROL_INTERFACE:
677 paudio_hid->interface = HBYTE(setup->wIndex);
678 if(HBYTE(setup->wValue) == AUDIO_MUTE_CONTROL)
679 {
680 paudio_hid->request_no = AUDIO_MUTE_CONTROL;
681 }
682 else if(HBYTE(setup->wValue) == AUDIO_VOLUME_CONTROL)
683 {
684 paudio_hid->request_no = AUDIO_VOLUME_CONTROL;
685 }
686 else
687 {
688 usbd_ctrl_unsupport(pudev);
689 }
690 break;
691 case AUDIO_REQ_CONTROL_ENDPOINT:
692 if(HBYTE(setup->wValue) == AUDIO_SAMPLING_FREQ_CONTROL)
693 {
694 paudio_hid->enpd = setup->wIndex;
695 paudio_hid->request_no = AUDIO_FREQ_SET_CONTROL;
696 }
697 else
698 {
699 usbd_ctrl_unsupport(pudev);
700 }
701 break;
702 default:
703 usbd_ctrl_unsupport(pudev);
704 break;
705 }
706 }
707 else
708 {
709 usbd_ctrl_unsupport(pudev);
710 }
711}
712
719static void audio_req_get_min(void *udev, usb_setup_type *setup)
720{
721 usbd_core_type *pudev = (usbd_core_type *)udev;
722 usb_audio_hid_type *paudio_hid = (usb_audio_hid_type *)pudev->class_handler->pdata;
723
724 switch(setup->bmRequestType & AUDIO_REQ_CONTROL_MASK)
725 {
726 case AUDIO_REQ_CONTROL_INTERFACE:
727 if(HBYTE(setup->wIndex) == AUDIO_SPK_FEATURE_UNIT_ID)
728 {
729 *((uint16_t *)paudio_hid->g_audio_cur) = paudio_hid->spk_volume_limits[0];
730 usbd_ctrl_send(pudev, paudio_hid->g_audio_cur, setup->wLength);
731 }
732 else if(HBYTE(setup->wIndex) == AUDIO_MIC_FEATURE_UNIT_ID)
733 {
734 *((uint16_t *)paudio_hid->g_audio_cur) = paudio_hid->mic_volume_limits[0];
735 usbd_ctrl_send(pudev, paudio_hid->g_audio_cur, setup->wLength);
736 }
737 else
738 {
739 usbd_ctrl_unsupport(pudev);
740 }
741 break;
742 case AUDIO_REQ_CONTROL_ENDPOINT:
743 usbd_ctrl_unsupport(pudev);
744 break;
745 default:
746 usbd_ctrl_unsupport(pudev);
747 break;
748 }
749}
750
757static void audio_req_get_max(void *udev, usb_setup_type *setup)
758{
759 usbd_core_type *pudev = (usbd_core_type *)udev;
760 usb_audio_hid_type *paudio_hid = (usb_audio_hid_type *)pudev->class_handler->pdata;
761
762 switch(setup->bmRequestType & AUDIO_REQ_CONTROL_MASK)
763 {
764 case AUDIO_REQ_CONTROL_INTERFACE:
765 if(HBYTE(setup->wIndex) == AUDIO_SPK_FEATURE_UNIT_ID)
766 {
767 *((uint16_t *)paudio_hid->g_audio_cur) = paudio_hid->spk_volume_limits[1];
768 usbd_ctrl_send(pudev, paudio_hid->g_audio_cur, setup->wLength);
769 }
770 else if(HBYTE(setup->wIndex) == AUDIO_MIC_FEATURE_UNIT_ID)
771 {
772 *((uint16_t *)paudio_hid->g_audio_cur) = paudio_hid->mic_volume_limits[1];
773 usbd_ctrl_send(pudev, paudio_hid->g_audio_cur, setup->wLength);
774 }
775 else
776 {
777 usbd_ctrl_unsupport(pudev);
778 }
779 break;
780 case AUDIO_REQ_CONTROL_ENDPOINT:
781 usbd_ctrl_unsupport(pudev);
782 break;
783 default:
784 usbd_ctrl_unsupport(pudev);
785 break;
786 }
787}
788
795static void audio_req_get_res(void *udev, usb_setup_type *setup)
796{
797 usbd_core_type *pudev = (usbd_core_type *)udev;
798 usb_audio_hid_type *paudio_hid = (usb_audio_hid_type *)pudev->class_handler->pdata;
799
800 switch(setup->bmRequestType & AUDIO_REQ_CONTROL_MASK)
801 {
802 case AUDIO_REQ_CONTROL_INTERFACE:
803 if(HBYTE(setup->wIndex) == AUDIO_SPK_FEATURE_UNIT_ID)
804 {
805 *((uint16_t *)paudio_hid->g_audio_cur) = paudio_hid->spk_volume_limits[2];
806 usbd_ctrl_send(pudev, paudio_hid->g_audio_cur, setup->wLength);
807 }
808 else if(HBYTE(setup->wIndex) == AUDIO_MIC_FEATURE_UNIT_ID)
809 {
810 *((uint16_t *)paudio_hid->g_audio_cur) = paudio_hid->mic_volume_limits[2];
811 usbd_ctrl_send(pudev, paudio_hid->g_audio_cur, setup->wLength);
812 }
813 else
814 {
815 usbd_ctrl_unsupport(pudev);
816 }
817 break;
818 case AUDIO_REQ_CONTROL_ENDPOINT:
819 usbd_ctrl_unsupport(pudev);
820 break;
821 default:
822 usbd_ctrl_unsupport(pudev);
823 break;
824 }
825}
826
833static void audio_set_interface(void *udev, usb_setup_type *setup)
834{
835 uint32_t len;
836 usbd_core_type *pudev = (usbd_core_type *)udev;
837 usb_audio_hid_type *paudio_hid = (usb_audio_hid_type *)pudev->class_handler->pdata;
838 if(LBYTE(setup->wIndex) == AUDIO_SPK_INTERFACE_NUMBER)
839 {
840 paudio_hid->spk_alt_setting = setup->wValue;
841 audio_codec_spk_alt_setting(paudio_hid->spk_alt_setting);
842 if(paudio_hid->spk_alt_setting )
843 {
844 int len = audio_codec_spk_feedback(paudio_hid->audio_feed_back);
845 usbd_ept_recv(pudev, USBD_AUHID_AUDIO_SPK_OUT_EPT, paudio_hid->audio_spk_data, AUDIO_SPK_OUT_MAXPACKET_SIZE);
846 usbd_ept_send(pudev, USBD_AUHID_AUDIO_FEEDBACK_EPT, paudio_hid->audio_feed_back, len);
847 }
848
849 }
850 else if(LBYTE(setup->wIndex) == AUDIO_MIC_INTERFACE_NUMBER)
851 {
852 paudio_hid->mic_alt_setting = setup->wValue;
853 audio_codec_mic_alt_setting(paudio_hid->mic_alt_setting);
854 if(paudio_hid->mic_alt_setting)
855 {
856 len = audio_codec_mic_get_data(paudio_hid->audio_mic_data);
857 usbd_ept_send(pudev, USBD_AUHID_AUDIO_MIC_IN_EPT, paudio_hid->audio_mic_data, len);
858 }
859 }
860
861}
862
863
870static void audio_get_interface(void *udev, usb_setup_type *setup)
871{
872 usbd_core_type *pudev = (usbd_core_type *)udev;
873 usb_audio_hid_type *paudio_hid = (usb_audio_hid_type *)pudev->class_handler->pdata;
874 if(LBYTE(setup->wIndex) == AUDIO_SPK_INTERFACE_NUMBER)
875 {
876 usbd_ctrl_send(pudev, (uint8_t *)&paudio_hid->spk_alt_setting, 1);
877 }
878 else if(LBYTE(setup->wIndex) == AUDIO_MIC_INTERFACE_NUMBER)
879 {
880 usbd_ctrl_send(pudev, (uint8_t *)&paudio_hid->mic_alt_setting, 1);
881 }
882 else
883 {
884 usbd_ctrl_unsupport(pudev);
885 }
886}
887
895 usb_sts_type audio_hid_class_send_report(void *udev, uint8_t *report, uint16_t len)
896{
897 usb_sts_type status = USB_OK;
898 usbd_core_type *pudev = (usbd_core_type *)udev;
899
900 if(usbd_connect_state_get(pudev) == USB_CONN_STATE_CONFIGURED)
901 usbd_ept_send(pudev, USBD_AUHID_HID_IN_EPT, report, len);
902
903 return status;
904}
905
906
914static void usb_hid_buf_process(void *udev, uint8_t *report, uint16_t len)
915{
916 uint32_t i_index;
917 usbd_core_type *pudev = (usbd_core_type *)udev;
918 usb_audio_hid_type *paudio_hid = (usb_audio_hid_type *)pudev->class_handler->pdata;
919
920 switch(report[0])
921 {
922 case HID_REPORT_ID_2:
923 if(paudio_hid->g_rxhid_buff[1] == 0)
924 {
925 at32_led_off(LED2);
926 }
927 else
928 {
929 at32_led_on(LED2);
930 }
931 break;
932 case HID_REPORT_ID_3:
933 if(paudio_hid->g_rxhid_buff[1] == 0)
934 {
935 at32_led_off(LED3);
936 }
937 else
938 {
939 at32_led_on(LED3);
940 }
941 break;
942 case HID_REPORT_ID_4:
943 if(paudio_hid->g_rxhid_buff[1] == 0)
944 {
945 at32_led_off(LED4);
946 }
947 else
948 {
949 at32_led_on(LED4);
950 }
951 break;
952 case HID_REPORT_ID_6:
953 for(i_index = 0; i_index < len; i_index ++)
954 {
955 paudio_hid->g_txhid_buff[i_index] = report[i_index];
956 }
957 usbd_ept_send(pudev, USBD_AUHID_HID_IN_EPT, paudio_hid->g_txhid_buff, len);
958 break;
959 default:
960 break;
961 }
962
963}
964
965
audio_hid_class.h
audio_hid_desc.h
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
at32_led_off
void at32_led_off(led_type led)
turns selected led off.
Definition at32f413_board.c:287
AUDIO_DESCRIPTOR_TYPE
#define AUDIO_DESCRIPTOR_TYPE
audio descriptor type
Definition audio_class.h:83
AUDIO_MIC_IN_MAXPACKET_SIZE
#define AUDIO_MIC_IN_MAXPACKET_SIZE
Definition audio_class.h:61
AUDIO_MUTE_CONTROL
#define AUDIO_MUTE_CONTROL
audio set cur type define
Definition audio_class.h:75
AUDIO_REQ_CONTROL_INTERFACE
#define AUDIO_REQ_CONTROL_INTERFACE
request type define
Definition audio_class.h:68
AUDIO_SAMPLING_FREQ_CONTROL
#define AUDIO_SAMPLING_FREQ_CONTROL
Definition audio_class.h:78
AUDIO_SPK_OUT_MAXPACKET_SIZE
#define AUDIO_SPK_OUT_MAXPACKET_SIZE
Definition audio_class.h:62
AUDIO_VOLUME_CONTROL
#define AUDIO_VOLUME_CONTROL
Definition audio_class.h:76
AUDIO_FREQ_SET_CONTROL
#define AUDIO_FREQ_SET_CONTROL
Definition audio_class.h:77
AUDIO_REQ_CONTROL_ENDPOINT
#define AUDIO_REQ_CONTROL_ENDPOINT
Definition audio_class.h:69
AUDIO_REQ_CONTROL_MASK
#define AUDIO_REQ_CONTROL_MASK
Definition audio_class.h:70
AUDIO_DESCRIPTOR_SIZE
#define AUDIO_DESCRIPTOR_SIZE
Definition audio_class.h:84
AUDIO_FEEDBACK_MAXPACKET_SIZE
#define AUDIO_FEEDBACK_MAXPACKET_SIZE
Definition audio_class.h:63
AUDIO_MIC_FEATURE_UNIT_ID
#define AUDIO_MIC_FEATURE_UNIT_ID
Definition audio_desc.h:168
AUDIO_REQ_GET_CUR
#define AUDIO_REQ_GET_CUR
Definition audio_desc.h:112
AUDIO_SPK_INTERFACE_NUMBER
#define AUDIO_SPK_INTERFACE_NUMBER
Definition audio_desc.h:179
AUDIO_MIC_INTERFACE_NUMBER
#define AUDIO_MIC_INTERFACE_NUMBER
audio interface number
Definition audio_desc.h:177
AUDIO_REQ_GET_MAX
#define AUDIO_REQ_GET_MAX
Definition audio_desc.h:116
AUDIO_REQ_GET_MIN
#define AUDIO_REQ_GET_MIN
Definition audio_desc.h:114
AUDIO_SPK_FEATURE_UNIT_ID
#define AUDIO_SPK_FEATURE_UNIT_ID
Definition audio_desc.h:171
AUDIO_REQ_GET_RES
#define AUDIO_REQ_GET_RES
Definition audio_desc.h:118
AUDIO_REQ_SET_CUR
#define AUDIO_REQ_SET_CUR
Definition audio_desc.h:111
USBD_AUHID_AUDIO_MIC_IN_EPT
#define USBD_AUHID_AUDIO_MIC_IN_EPT
endpoint define
Definition audio_hid_class.h:53
USBD_AUHID_HID_IN_EPT
#define USBD_AUHID_HID_IN_EPT
usb custom hid use endpoint define
Definition audio_hid_class.h:60
USBD_AUHID_HID_OUT_EPT
#define USBD_AUHID_HID_OUT_EPT
Definition audio_hid_class.h:61
USBD_AUHID_AUDIO_FEEDBACK_EPT
#define USBD_AUHID_AUDIO_FEEDBACK_EPT
Definition audio_hid_class.h:55
USBD_AUHID_OUT_MAXPACKET_SIZE
#define USBD_AUHID_OUT_MAXPACKET_SIZE
Definition audio_hid_class.h:67
USBD_AUHID_AUDIO_SPK_OUT_EPT
#define USBD_AUHID_AUDIO_SPK_OUT_EPT
Definition audio_hid_class.h:54
USBD_AUHID_IN_MAXPACKET_SIZE
#define USBD_AUHID_IN_MAXPACKET_SIZE
usb custom hid in and out max packet size define
Definition audio_hid_class.h:66
class_sof_handler
static usb_sts_type class_sof_handler(void *udev)
usb device sof handler
Definition audio_hid_class.c:529
audio_hid_class_send_report
usb_sts_type audio_hid_class_send_report(void *udev, uint8_t *report, uint16_t len)
usb device class send report
Definition audio_hid_class.c:895
class_clear_handler
static usb_sts_type class_clear_handler(void *udev)
clear endpoint or other state
Definition audio_hid_class.c:127
audio_hid_class_handler
usbd_class_handler audio_hid_class_handler
Definition audio_hid_class.c:63
class_ept0_rx_handler
static usb_sts_type class_ept0_rx_handler(void *udev)
usb device endpoint 0 out status stage complete
Definition audio_hid_class.c:373
audio_req_get_res
static void audio_req_get_res(void *udev, usb_setup_type *setup)
usb audio request get res
Definition audio_hid_class.c:795
audio_get_interface
static void audio_get_interface(void *udev, usb_setup_type *setup)
usb audio get interface
Definition audio_hid_class.c:870
class_hid_setup_handler
usb_sts_type class_hid_setup_handler(void *udev, usb_setup_type *setup)
usb device class setup request handler
Definition audio_hid_class.c:244
audio_req_set_cur
static void audio_req_set_cur(void *udev, usb_setup_type *setup)
usb audio request set cur
Definition audio_hid_class.c:662
class_event_handler
static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
usb device event handler
Definition audio_hid_class.c:544
audio_req_get_max
static void audio_req_get_max(void *udev, usb_setup_type *setup)
usb audio request get max
Definition audio_hid_class.c:757
class_setup_handler
static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
usb device class setup request handler
Definition audio_hid_class.c:328
usb_hid_buf_process
static void usb_hid_buf_process(void *udev, uint8_t *report, uint16_t len)
usb device report function
Definition audio_hid_class.c:914
audio_req_get_min
static void audio_req_get_min(void *udev, usb_setup_type *setup)
usb audio request get min
Definition audio_hid_class.c:719
class_init_handler
static usb_sts_type class_init_handler(void *udev)
initialize usb custom hid endpoint
Definition audio_hid_class.c:82
audio_hid_struct
usb_audio_hid_type audio_hid_struct
Definition audio_hid_class.c:61
class_ept0_tx_handler
static usb_sts_type class_ept0_tx_handler(void *udev)
usb device endpoint 0 in status stage complete
Definition audio_hid_class.c:359
class_out_handler
static usb_sts_type class_out_handler(void *udev, uint8_t ept_num)
usb device endpoint receive data
Definition audio_hid_class.c:495
audio_req_get_cur
static void audio_req_get_cur(void *udev, usb_setup_type *setup)
usb audio request get cur
Definition audio_hid_class.c:580
class_in_handler
static usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
usb device transmision complete handler
Definition audio_hid_class.c:459
audio_set_interface
static void audio_set_interface(void *udev, usb_setup_type *setup)
usb audio set interface
Definition audio_hid_class.c:833
class_audio_setup_handler
usb_sts_type class_audio_setup_handler(void *udev, usb_setup_type *setup)
usb device class setup request handler
Definition audio_hid_class.c:158
USBD_AUHID_HID_SIZ_REPORT_DESC
#define USBD_AUHID_HID_SIZ_REPORT_DESC
Definition audio_hid_desc.h:235
HID_REPORT_ID_2
#define HID_REPORT_ID_2
Definition audio_hid_desc.h:222
HID_REPORT_ID_4
#define HID_REPORT_ID_4
Definition audio_hid_desc.h:224
HID_REPORT_ID_6
#define HID_REPORT_ID_6
Definition audio_hid_desc.h:226
g_usbd_audio_hid_report
uint8_t g_usbd_audio_hid_report[126]
g_audio_hid_usb_desc
uint8_t g_audio_hid_usb_desc[9]
HID_REPORT_ID_3
#define HID_REPORT_ID_3
Definition audio_hid_desc.h:223
HID_INTERFACE_NUMBER
#define HID_INTERFACE_NUMBER
Definition audio_hid_desc.h:182
audio_codec_mic_alt_setting
void audio_codec_mic_alt_setting(uint32_t alt_seting)
audio codec microphone alt setting config
Definition audio/src/audio_codec.c:168
audio_codec_set_spk_volume
void audio_codec_set_spk_volume(uint16_t volume)
audio codec set speaker volume
Definition audio/src/audio_codec.c:220
audio_codec_set_spk_mute
void audio_codec_set_spk_mute(uint8_t mute)
audio codec set speaker mute
Definition audio/src/audio_codec.c:194
audio_codec_set_mic_freq
void audio_codec_set_mic_freq(uint32_t freq)
audio codec set microphone freq
Definition audio/src/audio_codec.c:120
audio_codec_mic_get_data
uint32_t audio_codec_mic_get_data(uint8_t *buffer)
codec microphone get data
Definition audio/src/audio_codec.c:285
audio_codec_set_mic_mute
void audio_codec_set_mic_mute(uint8_t mute)
audio codec set microphone mute
Definition audio/src/audio_codec.c:183
audio_codec_spk_fifo_write
void audio_codec_spk_fifo_write(uint8_t *data, uint32_t len)
audio codec interface
Definition audio/src/audio_codec.c:247
audio_codec_spk_feedback
uint8_t audio_codec_spk_feedback(uint8_t *feedback)
codec speaker feedback
Definition audio/src/audio_codec.c:231
audio_codec_set_mic_volume
void audio_codec_set_mic_volume(uint16_t volume)
audio codec set microphone volume
Definition audio/src/audio_codec.c:205
audio_codec_spk_alt_setting
void audio_codec_spk_alt_setting(uint32_t alt_seting)
audio codec speaker alt setting config
Definition audio/src/audio_codec.c:153
audio_codec_set_spk_freq
void audio_codec_set_spk_freq(uint32_t freq)
audio codec set speaker freq
Definition audio/src/audio_codec.c:136
EPT_ISO_TYPE
@ EPT_ISO_TYPE
Definition at32f413_usb.h:203
EPT_INT_TYPE
@ EPT_INT_TYPE
Definition at32f413_usb.h:205
USB_STD_REQ_CLEAR_FEATURE
#define USB_STD_REQ_CLEAR_FEATURE
Definition usb_std.h:77
HID_DESCRIPTOR_TYPE
#define HID_DESCRIPTOR_TYPE
Definition usb_std.h:242
HBYTE
#define HBYTE(x)
Definition usb_std.h:271
HID_REQ_GET_PROTOCOL
#define HID_REQ_GET_PROTOCOL
Definition usb_std.h:237
MIN
#define MIN(a, b)
min and max define
Definition usb_std.h:260
USB_REQ_TYPE_STANDARD
#define USB_REQ_TYPE_STANDARD
usb request type
Definition usb_std.h:62
USB_STD_REQ_GET_DESCRIPTOR
#define USB_STD_REQ_GET_DESCRIPTOR
Definition usb_std.h:80
HID_REQ_SET_PROTOCOL
#define HID_REQ_SET_PROTOCOL
usb hid class request code define
Definition usb_std.h:236
HID_REPORT_DESC
#define HID_REPORT_DESC
Definition usb_std.h:243
LBYTE
#define LBYTE(x)
low byte and high byte define
Definition usb_std.h:270
USB_STD_REQ_SET_FEATURE
#define USB_STD_REQ_SET_FEATURE
Definition usb_std.h:78
HID_REQ_SET_IDLE
#define HID_REQ_SET_IDLE
Definition usb_std.h:238
HID_REQ_GET_IDLE
#define HID_REQ_GET_IDLE
Definition usb_std.h:239
HID_REQ_SET_REPORT
#define HID_REQ_SET_REPORT
Definition usb_std.h:240
USB_REQ_RECIPIENT_MASK
#define USB_REQ_RECIPIENT_MASK
Definition usb_std.h:57
USB_STD_REQ_SET_INTERFACE
#define USB_STD_REQ_SET_INTERFACE
Definition usb_std.h:85
USB_REQ_TYPE_RESERVED
#define USB_REQ_TYPE_RESERVED
Definition usb_std.h:65
USB_STD_REQ_GET_INTERFACE
#define USB_STD_REQ_GET_INTERFACE
Definition usb_std.h:84
USB_REQ_RECIPIENT_ENDPOINT
#define USB_REQ_RECIPIENT_ENDPOINT
Definition usb_std.h:55
USB_REQ_RECIPIENT_INTERFACE
#define USB_REQ_RECIPIENT_INTERFACE
Definition usb_std.h:54
USB_REQ_TYPE_CLASS
#define USB_REQ_TYPE_CLASS
Definition usb_std.h:63
USB_CONN_STATE_CONFIGURED
@ USB_CONN_STATE_CONFIGURED
Definition usb_std.h:137
usb_sts_type
usb_sts_type
usb return status
Definition usb_std.h:285
USB_OK
@ USB_OK
Definition usb_std.h:286
usbd_connect_state_get
usbd_conn_state usbd_connect_state_get(usbd_core_type *udev)
get usb connect state
Definition usbd_core.c:595
usbd_ept_dbuffer_enable
void usbd_ept_dbuffer_enable(usbd_core_type *udev, uint8_t ept_addr)
enable endpoint double buffer.
Definition usbd_core.c:409
usbd_ept_close
void usbd_ept_close(usbd_core_type *udev, uint8_t ept_addr)
usb close endpoint
Definition usbd_core.c:541
usbd_ept_recv
void usbd_ept_recv(usbd_core_type *udev, uint8_t ept_num, uint8_t *buffer, uint16_t len)
usb endpoint receive data
Definition usbd_core.c:364
usbd_ctrl_send_status
void usbd_ctrl_send_status(usbd_core_type *udev)
usb control endpoint send in status
Definition usbd_core.c:210
usbd_ept_open
void usbd_ept_open(usbd_core_type *udev, uint8_t ept_addr, uint8_t ept_type, uint16_t maxpacket)
usb open endpoint
Definition usbd_core.c:506
usbd_ctrl_send
void usbd_ctrl_send(usbd_core_type *udev, uint8_t *buffer, uint16_t len)
usb control endpoint send data
Definition usbd_core.c:175
usbd_get_recv_len
uint32_t usbd_get_recv_len(usbd_core_type *udev, uint8_t ept_addr)
usb endpoint get receive data length
Definition usbd_core.c:397
usbd_ctrl_recv
void usbd_ctrl_recv(usbd_core_type *udev, uint8_t *buffer, uint16_t len)
usb control endpoint receive data
Definition usbd_core.c:194
usbd_ctrl_unsupport
void usbd_ctrl_unsupport(usbd_core_type *udev)
un-support device request
Definition usbd_core.c:289
usbd_ept_send
void usbd_ept_send(usbd_core_type *udev, uint8_t ept_num, uint8_t *buffer, uint16_t len)
usb endpoint send data
Definition usbd_core.c:304
usbd_event_type
usbd_event_type
usb device event
Definition usbd_core.h:54
USBD_SUSPEND_EVENT
@ USBD_SUSPEND_EVENT
Definition usbd_core.h:57
USBD_RESET_EVENT
@ USBD_RESET_EVENT
Definition usbd_core.h:56
USBD_WAKEUP_EVENT
@ USBD_WAKEUP_EVENT
Definition usbd_core.h:58
usb_audio_hid_type
usb audio control struct
Definition audio_hid_class.h:113
usb_audio_hid_type::spk_volume_limits
uint16_t spk_volume_limits[3]
Definition audio_hid_class.h:123
usb_audio_hid_type::audio_cmd
uint8_t audio_cmd
Definition audio_hid_class.h:126
usb_audio_hid_type::request_no
uint8_t request_no
Definition audio_hid_class.h:116
usb_audio_hid_type::g_txhid_buff
uint8_t g_txhid_buff[0x40]
Definition audio_hid_class.h:142
usb_audio_hid_type::mic_freq
uint32_t mic_freq
Definition audio_hid_class.h:122
usb_audio_hid_type::audio_mic_data
uint8_t audio_mic_data[(48 *2 *(16/8)+40)]
Definition audio_hid_class.h:132
usb_audio_hid_type::interface
uint8_t interface
Definition audio_hid_class.h:115
usb_audio_hid_type::spk_volume
uint16_t spk_volume
Definition audio_hid_class.h:119
usb_audio_hid_type::mic_alt_setting
uint32_t mic_alt_setting
Definition audio_hid_class.h:129
usb_audio_hid_type::mic_volume
uint16_t mic_volume
Definition audio_hid_class.h:120
usb_audio_hid_type::audio_spk_data
uint8_t audio_spk_data[(48 *2 *(16/8)+40)]
Definition audio_hid_class.h:131
usb_audio_hid_type::alt_setting
uint32_t alt_setting
Definition audio_hid_class.h:139
usb_audio_hid_type::spk_alt_setting
uint32_t spk_alt_setting
Definition audio_hid_class.h:128
usb_audio_hid_type::enpd
uint8_t enpd
Definition audio_hid_class.h:114
usb_audio_hid_type::hid_state
uint8_t hid_state
Definition audio_hid_class.h:143
usb_audio_hid_type::mic_mute
uint8_t mic_mute
Definition audio_hid_class.h:118
usb_audio_hid_type::hid_set_idle
uint32_t hid_set_idle
Definition audio_hid_class.h:138
usb_audio_hid_type::mic_volume_limits
uint16_t mic_volume_limits[3]
Definition audio_hid_class.h:124
usb_audio_hid_type::audio_feed_back
uint8_t audio_feed_back[0x3+1]
Definition audio_hid_class.h:133
usb_audio_hid_type::audio_cmd_len
uint32_t audio_cmd_len
Definition audio_hid_class.h:127
usb_audio_hid_type::g_rxhid_buff
uint8_t g_rxhid_buff[0x40]
Definition audio_hid_class.h:141
usb_audio_hid_type::spk_freq
uint32_t spk_freq
Definition audio_hid_class.h:121
usb_audio_hid_type::hid_set_report
uint8_t hid_set_report[64]
Definition audio_hid_class.h:140
usb_audio_hid_type::g_audio_cur
uint8_t g_audio_cur[64]
Definition audio_hid_class.h:130
usb_audio_hid_type::hid_protocol
uint32_t hid_protocol
Definition audio_hid_class.h:137
usb_audio_hid_type::spk_mute
uint8_t spk_mute
Definition audio_hid_class.h:117
usb_setup_type
format of usb setup data
Definition usb_std.h:297
usb_setup_type::wValue
uint16_t wValue
Definition usb_std.h:300
usb_setup_type::wLength
uint16_t wLength
Definition usb_std.h:303
usb_setup_type::bmRequestType
uint8_t bmRequestType
Definition usb_std.h:298
usb_setup_type::wIndex
uint16_t wIndex
Definition usb_std.h:301
usb_setup_type::bRequest
uint8_t bRequest
Definition usb_std.h:299
usbd_class_handler
usb device class handler
Definition usbd_core.h:97
usbd_class_handler::pdata
void * pdata
Definition usbd_core.h:107
usbd_core_type
usb device core struct type
Definition usbd_core.h:114
usbd_core_type::class_handler
usbd_class_handler * class_handler
Definition usbd_core.h:117
usbd_core_type::setup
usb_setup_type setup
Definition usbd_core.h:123
usbd_core_type::desc_handler
usbd_desc_handler * desc_handler
Definition usbd_core.h:118
usbd_desc_handler::get_device_configuration
usbd_desc_t *(* get_device_configuration)(void)
Definition usbd_core.h:78
usbd_desc_t
usb device descriptor struct
Definition usbd_core.h:66
usbd_desc_t::descriptor
uint8_t * descriptor
Definition usbd_core.h:68
usbd_core.h
usb device core header file


AT32F413 Firmwary Library: audio_hid_class.h Source File

  • middlewares
  • usbd_class
  • audio_hid
audio_hid_class.h
Go to the documentation of this file.
1
26 /* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AUDIO_HID_CLASS_H
28#define __AUDIO_HID_CLASS_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "usb_std.h"
35#include "usbd_core.h"
36#include "audio_conf.h"
37
53#define USBD_AUHID_AUDIO_MIC_IN_EPT 0x81
54#define USBD_AUHID_AUDIO_SPK_OUT_EPT 0x02
55#define USBD_AUHID_AUDIO_FEEDBACK_EPT 0x83
56
60#define USBD_AUHID_HID_IN_EPT 0x84
61#define USBD_AUHID_HID_OUT_EPT 0x05
62
66#define USBD_AUHID_IN_MAXPACKET_SIZE 0x40
67#define USBD_AUHID_OUT_MAXPACKET_SIZE 0x40
68
72#define AUDIO_REMAIN_SIZE 40
73#define AUDIO_MIC_IN_MAXPACKET_SIZE (AUDIO_SUPPORT_MAX_FREQ * AUDIO_MIC_CHANEL_NUM * (AUDIO_MIC_DEFAULT_BITW / 8) + AUDIO_REMAIN_SIZE)
74#define AUDIO_SPK_OUT_MAXPACKET_SIZE (AUDIO_SUPPORT_MAX_FREQ * AUDIO_SPK_CHANEL_NUM * (AUDIO_SPK_DEFAULT_BITW / 8) + AUDIO_REMAIN_SIZE)
75#define AUDIO_FEEDBACK_MAXPACKET_SIZE 0x3
76#define FEEDBACK_REFRESH_TIME 0x8
80#define AUDIO_REQ_CONTROL_INTERFACE 0x01
81#define AUDIO_REQ_CONTROL_ENDPOINT 0x02
82#define AUDIO_REQ_CONTROL_MASK 0x03
83
87#define AUDIO_MUTE_CONTROL 0x01
88#define AUDIO_VOLUME_CONTROL 0x02
89#define AUDIO_FREQ_SET_CONTROL 0x03
90#define AUDIO_SAMPLING_FREQ_CONTROL 0x01
91
99#define AUDIO_MUTE_CONTROL 0x01
100#define AUDIO_VOLUME_CONTROL 0x02
101#define AUDIO_FREQ_SET_CONTROL 0x03
102
106#define AUDIO_DESCRIPTOR_TYPE 0x21
107#define AUDIO_DESCRIPTOR_SIZE 0x09
108
112typedef struct
113{
114 uint8_t enpd;
115 uint8_t interface;
116 uint8_t request_no;
117 uint8_t spk_mute;
118 uint8_t mic_mute;
119 uint16_t spk_volume;
120 uint16_t mic_volume;
121 uint32_t spk_freq;
122 uint32_t mic_freq;
123 uint16_t spk_volume_limits[3]; /*[0] is mininum value, [1] is maxnum value, [2] is volume resolution */
124 uint16_t mic_volume_limits[3]; /*[0] is mininum value, [1] is maxnum value, [2] is volume resolution */
125
126 uint8_t audio_cmd;
127 uint32_t audio_cmd_len;
128 uint32_t spk_alt_setting;
129 uint32_t mic_alt_setting;
130 uint8_t g_audio_cur[64];
131 uint8_t audio_spk_data[AUDIO_SPK_OUT_MAXPACKET_SIZE];
132 uint8_t audio_mic_data[AUDIO_MIC_IN_MAXPACKET_SIZE];
133 uint8_t audio_feed_back[AUDIO_FEEDBACK_MAXPACKET_SIZE+1];
134
135
136 /* hid */
137 uint32_t hid_protocol;
138 uint32_t hid_set_idle;
139 uint32_t alt_setting;
140 uint8_t hid_set_report[64];
141 uint8_t g_rxhid_buff[USBD_AUHID_OUT_MAXPACKET_SIZE];
142 uint8_t g_txhid_buff[USBD_AUHID_IN_MAXPACKET_SIZE];
143 uint8_t hid_state;
144}usb_audio_hid_type;
145
146extern usbd_class_handler audio_hid_class_handler;
147
148 usb_sts_type audio_hid_class_send_report(void *udev, uint8_t *report, uint16_t len);
149
162#ifdef __cplusplus
163}
164#endif
165
166#endif
167
audio_conf.h
usb audio config
audio_hid_class_send_report
usb_sts_type audio_hid_class_send_report(void *udev, uint8_t *report, uint16_t len)
usb device class send report
Definition audio_hid_class.c:895
AUDIO_MIC_IN_MAXPACKET_SIZE
#define AUDIO_MIC_IN_MAXPACKET_SIZE
Definition audio_hid_class.h:73
audio_hid_class_handler
usbd_class_handler audio_hid_class_handler
Definition audio_hid_class.c:63
AUDIO_SPK_OUT_MAXPACKET_SIZE
#define AUDIO_SPK_OUT_MAXPACKET_SIZE
Definition audio_hid_class.h:74
USBD_AUHID_OUT_MAXPACKET_SIZE
#define USBD_AUHID_OUT_MAXPACKET_SIZE
Definition audio_hid_class.h:67
USBD_AUHID_IN_MAXPACKET_SIZE
#define USBD_AUHID_IN_MAXPACKET_SIZE
usb custom hid in and out max packet size define
Definition audio_hid_class.h:66
AUDIO_FEEDBACK_MAXPACKET_SIZE
#define AUDIO_FEEDBACK_MAXPACKET_SIZE
Definition audio_hid_class.h:75
usb_sts_type
usb_sts_type
usb return status
Definition usb_std.h:285
usb_audio_hid_type
usb audio control struct
Definition audio_hid_class.h:113
usb_audio_hid_type::audio_cmd
uint8_t audio_cmd
Definition audio_hid_class.h:126
usb_audio_hid_type::request_no
uint8_t request_no
Definition audio_hid_class.h:116
usb_audio_hid_type::mic_freq
uint32_t mic_freq
Definition audio_hid_class.h:122
usb_audio_hid_type::interface
uint8_t interface
Definition audio_hid_class.h:115
usb_audio_hid_type::spk_volume
uint16_t spk_volume
Definition audio_hid_class.h:119
usb_audio_hid_type::mic_alt_setting
uint32_t mic_alt_setting
Definition audio_hid_class.h:129
usb_audio_hid_type::mic_volume
uint16_t mic_volume
Definition audio_hid_class.h:120
usb_audio_hid_type::alt_setting
uint32_t alt_setting
Definition audio_hid_class.h:139
usb_audio_hid_type::spk_alt_setting
uint32_t spk_alt_setting
Definition audio_hid_class.h:128
usb_audio_hid_type::enpd
uint8_t enpd
Definition audio_hid_class.h:114
usb_audio_hid_type::hid_state
uint8_t hid_state
Definition audio_hid_class.h:143
usb_audio_hid_type::mic_mute
uint8_t mic_mute
Definition audio_hid_class.h:118
usb_audio_hid_type::hid_set_idle
uint32_t hid_set_idle
Definition audio_hid_class.h:138
usb_audio_hid_type::audio_cmd_len
uint32_t audio_cmd_len
Definition audio_hid_class.h:127
usb_audio_hid_type::spk_freq
uint32_t spk_freq
Definition audio_hid_class.h:121
usb_audio_hid_type::hid_protocol
uint32_t hid_protocol
Definition audio_hid_class.h:137
usb_audio_hid_type::spk_mute
uint8_t spk_mute
Definition audio_hid_class.h:117
usbd_class_handler
usb device class handler
Definition usbd_core.h:97
usb_std.h
usb standard header file
usbd_core.h
usb device core header file


AT32F413 Firmwary Library: audio_hid_desc.c Source File

  • middlewares
  • usbd_class
  • audio_hid
audio_hid_desc.c
Go to the documentation of this file.
1
25#include "usb_std.h"
26#include "usbd_sdr.h"
27#include "usbd_core.h"
28#include "audio_hid_desc.h"
29
44static usbd_desc_t *get_device_descriptor(void);
45static usbd_desc_t *get_device_qualifier(void);
46static usbd_desc_t *get_device_configuration(void);
47static usbd_desc_t *get_device_other_speed(void);
48static usbd_desc_t *get_device_lang_id(void);
49static usbd_desc_t *get_device_manufacturer_string(void);
50static usbd_desc_t *get_device_product_string(void);
51static usbd_desc_t *get_device_serial_string(void);
52static usbd_desc_t *get_device_interface_string(void);
53static usbd_desc_t *get_device_config_string(void);
54
55static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf);
56static void usbd_int_to_unicode (uint32_t value , uint8_t *pbuf , uint8_t len);
57static void get_serial_num(void);
58#if defined ( __ICCARM__ ) /* iar compiler */
59 #pragma data_alignment=4
60#endif
61ALIGNED_HEAD static uint8_t g_usbd_desc_buffer[256] ALIGNED_TAIL;
62
66 usbd_desc_handler audio_hid_desc_handler =
67{
68 get_device_descriptor,
69 get_device_qualifier,
70 get_device_configuration,
71 get_device_other_speed,
72 get_device_lang_id,
73 get_device_manufacturer_string,
74 get_device_product_string,
75 get_device_serial_string,
76 get_device_interface_string,
77 get_device_config_string,
78};
79
83#if defined ( __ICCARM__ ) /* iar compiler */
84 #pragma data_alignment=4
85#endif
86ALIGNED_HEAD static uint8_t g_usbd_descriptor[USB_DEVICE_DESC_LEN] ALIGNED_TAIL =
87{
88 USB_DEVICE_DESC_LEN, /* bLength */
89 USB_DESCIPTOR_TYPE_DEVICE, /* bDescriptorType */
90 0x00, /* bcdUSB */
91 0x02,
92 0x00, /* bDeviceClass */
93 0x00, /* bDeviceSubClass */
94 0x00, /* bDeviceProtocol */
95 USB_MAX_EP0_SIZE, /* bMaxPacketSize */
96 LBYTE(USBD_AUHID_VENDOR_ID), /* idVendor */
97 HBYTE(USBD_AUHID_VENDOR_ID), /* idVendor */
98 LBYTE(USBD_AUHID_PRODUCT_ID), /* idProduct */
99 HBYTE(USBD_AUHID_PRODUCT_ID), /* idProduct */
100 0x00, /* bcdDevice rel. 2.00 */
101 0x02,
102 USB_MFC_STRING, /* Index of manufacturer string */
103 USB_PRODUCT_STRING, /* Index of product string */
104 USB_SERIAL_STRING, /* Index of serial number string */
105 0x01 /* bNumConfigurations */
106};
107
111#if defined ( __ICCARM__ ) /* iar compiler */
112 #pragma data_alignment=4
113#endif
114ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_AUHID_CONFIG_DESC_SIZE] ALIGNED_TAIL =
115{
116 USB_DEVICE_CFG_DESC_LEN, /* bLength: configuration descriptor size */
117 USB_DESCIPTOR_TYPE_CONFIGURATION, /* bDescriptorType: configuration */
118 LBYTE(USBD_AUHID_CONFIG_DESC_SIZE), /* wTotalLength: bytes returned */
119 HBYTE(USBD_AUHID_CONFIG_DESC_SIZE), /* wTotalLength: bytes returned */
120 0x1 + AUDIO_INTERFACE_NUM + 0x1, /* bNumInterfaces: n interface */
121 0x01, /* bConfigurationValue: configuration value */
122 0x00, /* iConfiguration: index of string descriptor describing
123 the configuration */
124 0xC0, /* bmAttributes: self powered */
125 0x32, /* MaxPower 100 mA: this current is used for detecting vbus */
126
127 USB_DEVICE_IF_DESC_LEN, /* bLength: interface descriptor size */
128 USB_DESCIPTOR_TYPE_INTERFACE, /* bDescriptorType: interface descriptor type */
129 0x00, /* bInterfaceNumber: number of interface */
130 0x00, /* bAlternateSetting: alternate set */
131 0x00, /* bNumEndpoints: number of endpoints */
132 USB_CLASS_CODE_AUDIO, /* bInterfaceClass: audio class code */
133 AUDIO_SUBCLASS_AUDIOCONTROL, /* bInterfaceSubClass: audio control */
134 AUDIO_PROTOCOL_UNDEFINED, /* bInterfaceProtocol: undefined */
135 0x00, /* iInterface: index of string descriptor */
136
137 0x08+AUDIO_INTERFACE_NUM, /* bLength: size of this descriptor, in bytes 8+n */
138 AUDIO_CS_INTERFACE, /* bDescriptorType: cs interface descriptor type */
139 AUDIO_AC_HEADER, /* bDescriptorSubtype: Header function Descriptor*/
140 LBYTE(AUHID_BCD_NUM),
141 HBYTE(AUHID_BCD_NUM), /* bcdCDC: audio device class specification release number */
142 LBYTE(AUDIO_INTERFACE_LEN),
143 HBYTE(AUDIO_INTERFACE_LEN), /* wTotalLength: total number of bytes returned for the class-specific audio control interface */
144 AUDIO_INTERFACE_NUM, /* bInClollection: the number of audio streaming */
145#if (AUDIO_INTERFACE_NUM == 2) /* two interface */
146 0x02,
147 0x01,
148#else
149 0x01,
150#endif
151
152 /* usb microphone config */
153#if (AUDIO_SUPPORT_MIC == 1)
154 AUDIO_INPUT_TERMINAL_SIZE, /* bLength: descriptor size */
155 AUDIO_CS_INTERFACE, /* bDescriptorType: configuration */
156 AUDIO_AC_INPUT_TERMINAL, /* bDescriptorSubtype: input_terminal type*/
157 AUDIO_MIC_INPUT_TERMINAL_ID, /* bTerminalID: id of this input terminal*/
158 LBYTE(AUDIO_INPUT_TERMINAL_MICROPHONE),
159 HBYTE(AUDIO_INPUT_TERMINAL_MICROPHONE),/* wTerminalType: terminal is microphone */
160 0x00, /* bAssocTerminal: no association */
161 AUDIO_MIC_CHR, /* bNrChannels: two channel */
162#if (AUDIO_MIC_CHR == 2)
163 0x03, /* wChannelConfig: left front and right front */
164#endif
165#if (AUDIO_MIC_CHR == 1)
166 0x00, /* wChannelConfig */
167#endif
168 0x00, /* wChannelConfig */
169 0x00, /* iChannelNames: unused */
170 0x00, /* iTerminal: unused */
171
172 AUDIO_FEATURE_UNIT_SIZE, /* bLength: descriptor size */
173 AUDIO_CS_INTERFACE, /* bDescriptorType: configuration */
174 AUDIO_AC_FEATURE_UNIT, /* bDescriptorSubtype: feature unit type*/
175 AUDIO_MIC_FEATURE_UNIT_ID, /* bUnitID: id of this feature unit */
176 AUDIO_MIC_INPUT_TERMINAL_ID, /* bSourceID: from input terminal */
177 0x02, /* bControlSize: 2 byte */
178 0x03, /* bmaControls0: mute & volume*/
179 0x00,
180 0x00, /* bmaControls1 */
181 0x00,
182 0x00, /* bmaControls2 */
183 0x00,
184 0x00, /* iFeature: unused */
185
186 AUDIO_OUTPUT_TERMINAL_SIZE, /* bLength: descriptor size */
187 AUDIO_CS_INTERFACE, /* bDescriptorType: configuration */
188 AUDIO_AC_OUTPUT_TERMINAL, /* bDescriptorSubtype: output_terminal type*/
189 AUDIO_MIC_OUTPUT_TERMINAL_ID, /* bTerminalID: id of this output terminal*/
190 LBYTE(AUDIO_TERMINAL_TYPE_STREAMING),
191 HBYTE(AUDIO_TERMINAL_TYPE_STREAMING), /* wTerminalType: usb streaming */
192 0x00, /* bAssocTerminal: unused */
193 AUDIO_MIC_FEATURE_UNIT_ID, /* bSourceID: from feature unit terminal */
194 0x00, /* iTerminal: unused */
195#endif
196
197#if (AUDIO_SUPPORT_SPK == 1)
198 /* speaker config */
199 AUDIO_INPUT_TERMINAL_SIZE, /* bLength: descriptor size */
200 AUDIO_CS_INTERFACE, /* bDescriptorType: configuration */
201 AUDIO_AC_INPUT_TERMINAL, /* bDescriptorSubtype: input_terminal type*/
202 AUDIO_SPK_INPUT_TERMINAL_ID, /* bTerminalID: id of this input terminal*/
203 LBYTE(AUDIO_TERMINAL_TYPE_STREAMING), /* wTerminalType: usb streaming */
204 HBYTE(AUDIO_TERMINAL_TYPE_STREAMING), /* wTerminalType: usb streaming */
205 0x00, /* bAssocTerminal: no association */
206 AUDIO_SPK_CHR, /* bNrChannels: two channel */
207#if (AUDIO_SPK_CHR == 2)
208 0x03, /* wChannelConfig: left front and right front */
209#endif
210#if (AUDIO_SPK_CHR == 1)
211 0x00, /* wChannelConfig */
212#endif
213 0x00, /* wChannelConfig */
214 0x00, /* iChannelNames: unused */
215 0x00, /* iTerminal: unused */
216
217 AUDIO_FEATURE_UNIT_SIZE, /* bLength: descriptor size */
218 AUDIO_CS_INTERFACE, /* bDescriptorType: configuration */
219 AUDIO_AC_FEATURE_UNIT, /* bDescriptorSubtype: feature unit type*/
220 AUDIO_SPK_FEATURE_UNIT_ID, /* bUnitID: id of this feature unit */
221 AUDIO_SPK_INPUT_TERMINAL_ID, /* bSourceID: from input terminal */
222 0x02, /* bControlSize: 2 byte */
223 0x03, /* bmaControls0: mute & volume*/
224 0x00,
225 0x00, /* bmaControls1: 0x0000 */
226 0x00,
227 0x00, /* bmaControls2: 0x0000 */
228 0x00,
229 0x00, /* iFeature: unused */
230
231 AUDIO_OUTPUT_TERMINAL_SIZE, /* bLength: descriptor size */
232 AUDIO_CS_INTERFACE, /* bDescriptorType: configuration */
233 AUDIO_AC_OUTPUT_TERMINAL, /* bDescriptorSubtype: output_terminal type*/
234 AUDIO_SPK_OUTPUT_TERMINAL_ID, /* bTerminalID: id of this output terminal*/
235 LBYTE(AUDIO_OUTPUT_TERMINAL_SPEAKER), /* wTerminalType: usb speaker */
236 HBYTE(AUDIO_OUTPUT_TERMINAL_SPEAKER), /* wTerminalType: usb speaker */
237 0x00, /* bAssocTerminal: unused */
238 AUDIO_SPK_FEATURE_UNIT_ID, /* bSourceID: from feature unit terminal */
239 0x00, /* iTerminal: unused */
240#endif
241
242#if (AUDIO_SUPPORT_MIC == 1)
243 /* microphone interface */
244 0x09, /* bLength: descriptor size */
245 USB_DESCIPTOR_TYPE_INTERFACE, /* bDescriptorType: interface descriptor type */
246 AUDIO_MIC_INTERFACE_NUMBER, /* bInterfaceNumber: index of this interface */
247 0x00, /* bAlternateSetting: index of this setting */
248 0x00, /* bNumEndpoints: 0 endpoints */
249 USB_CLASS_CODE_AUDIO, /* bInterfaceClass: audio */
250 AUDIO_SUBCLASS_AUDIOSTREAMING, /* bInterfaceSubclass: audio streaming */
251 0x00, /* bInterfaceProtocol: unused */
252 0x00, /* iInterface: unused */
253
254 0x09, /* bLength: descriptor size */
255 USB_DESCIPTOR_TYPE_INTERFACE, /* bDescriptorType: interface descriptor type */
256 AUDIO_MIC_INTERFACE_NUMBER, /* bInterfaceNumber: index of this interface */
257 0x01, /* bAlternateSetting: index of this setting */
258 0x01, /* bNumEndpoints: 1 endpoints */
259 USB_CLASS_CODE_AUDIO, /* bInterfaceClass: audio */
260 AUDIO_SUBCLASS_AUDIOSTREAMING, /* bInterfaceSubclass: audio streaming */
261 0x00, /* bInterfaceProtocol: unused */
262 0x00, /* iInterface: unused */
263
264 0x07, /* bLength: configuration descriptor size */
265 AUDIO_CS_INTERFACE, /* bDescriptorType: interface descriptor type */
266 AUDIO_AS_GENERAL, /* bDescriptorSubtype: general sub type*/
267 AUDIO_MIC_OUTPUT_TERMINAL_ID, /* bTerminalLink: unit id of the output terminal */
268 0x01, /* bDelay: interface delay */
269 0x01, /* wFormatTag: pcm format*/
270 0x00, /* wFormatTag: pcm format*/
271
272 0x08 + AUDIO_MIC_FREQ_SIZE * 3, /* bLength: descriptor size */
273 AUDIO_CS_INTERFACE, /* bDescriptorType: interface descriptor type */
274 AUDIO_AS_FORMAT_TYPE, /* bDescriptorSubtype: format subtype */
275 AUDIO_FORMAT_TYPE_I, /* bFormatType: format type 1 */
276 AUDIO_MIC_CHR, /* bNrChannels: channel number */
277 AUDIO_MIC_BITW / 8, /* bSubFrameSize: per audio subframe */
278 AUDIO_MIC_BITW, /* bBitResolution: n bits per sample */
279 AUDIO_MIC_FREQ_SIZE, /* bSamFreqType: n frequency supported */
280#if (AUDIO_SUPPORT_FREQ_16K == 1)
281 SAMPLE_FREQ(AT32_AUDIO_FREQ_16K), /* tSamFreq: 16000hz */
282#endif
283#if (AUDIO_SUPPORT_FREQ_48K == 1)
284 SAMPLE_FREQ(AT32_AUDIO_FREQ_48K), /* tSamFreq: 48000hz */
285#endif
286
287 0x09, /* bLength: size of endpoint descriptor in bytes */
288 USB_DESCIPTOR_TYPE_ENDPOINT, /* bDescriptorType: endpoint descriptor type */
289 USBD_AUHID_AUDIO_MIC_IN_EPT, /* bEndpointAddress: the address of endpoint on usb device described by this descriptor */
290 USB_EPT_DESC_ISO | USB_ETP_DESC_ASYNC, /* bmAttributes: endpoint attributes */
291 LBYTE(AUDIO_MIC_IN_MAXPACKET_SIZE),
292 HBYTE(AUDIO_MIC_IN_MAXPACKET_SIZE), /* wMaxPacketSize: maximum packe size this endpoint */
293 AUHID_HID_BINTERVAL_TIME, /* bInterval: interval for polling endpoint for data transfers */
294 0x00, /* bRefresh: unused */
295 0x00, /* bSynchAddress: unused */
296
297 0x07, /* bLength: size of endpoint descriptor in bytes */
298 AUDIO_CS_ENDPOINT, /* bDescriptorType: cs endpoint descriptor type */
299 0x01, /* bDescriptorSubtype: general subtype */
300 0x01, /* bmAttributes */
301 0x00, /* bLockDelayUnits: unused */
302 0x00, /* wLockDelay: unused */
303 0x00, /* wLockDelay: unused */
304#endif
305
306#if (AUDIO_SUPPORT_SPK == 1)
307 /* speaker interface */
308 0x09, /* bLength: descriptor size */
309 USB_DESCIPTOR_TYPE_INTERFACE, /* bDescriptorType: interface descriptor type */
310 AUDIO_SPK_INTERFACE_NUMBER, /* bInterfaceNumber: index of this interface */
311 0x00, /* bAlternateSetting: index of this setting */
312 0x00, /* bNumEndpoints: 0 endpoints */
313 USB_CLASS_CODE_AUDIO, /* bInterfaceClass: audio */
314 AUDIO_SUBCLASS_AUDIOSTREAMING, /* bInterfaceSubclass: audio streaming */
315 0x00, /* bInterfaceProtocol: unused */
316 0x00, /* iInterface: unused */
317
318 0x09, /* bLength: descriptor size */
319 USB_DESCIPTOR_TYPE_INTERFACE, /* bDescriptorType: interface descriptor type */
320 AUDIO_SPK_INTERFACE_NUMBER, /* bInterfaceNumber: index of this interface */
321 0x01, /* bAlternateSetting: index of this setting */
322 0x01 + AUDIO_SUPPORT_FEEDBACK, /* bNumEndpoints: endpoints */
323 USB_CLASS_CODE_AUDIO, /* bInterfaceClass: audio */
324 AUDIO_SUBCLASS_AUDIOSTREAMING, /* bInterfaceSubclass: audio streaming */
325 0x00, /* bInterfaceProtocol: unused */
326 0x00, /* iInterface: unused */
327
328 0x07, /* bLength: configuration descriptor size */
329 AUDIO_CS_INTERFACE, /* bDescriptorType: interface descriptor type */
330 AUDIO_AS_GENERAL, /* bDescriptorSubtype: general sub type*/
331 AUDIO_SPK_INPUT_TERMINAL_ID, /* bTerminalLink: unit id of the input terminal */
332 0x01, /* bDelay: interface delay */
333 0x01, /* wFormatTag: pcm format*/
334 0x00, /* wFormatTag: pcm format*/
335
336 0x08 + AUDIO_SPK_FREQ_SIZE * 3, /* bLength: descriptor size */
337 AUDIO_CS_INTERFACE, /* bDescriptorType: interface descriptor type */
338 AUDIO_AS_FORMAT_TYPE, /* bDescriptorSubtype: format subtype */
339 AUDIO_FORMAT_TYPE_I, /* bFormatType: format type 1 */
340 AUDIO_SPK_CHR, /* bNrChannels: channel number */
341 AUDIO_SPK_BITW / 8, /* bSubFrameSize: per audio subframe */
342 AUDIO_SPK_BITW, /* bBitResolution: n bits per sample */
343 AUDIO_SPK_FREQ_SIZE, /* bSamFreqType: n frequency supported */
344#if (AUDIO_SUPPORT_FREQ_16K == 1)
345 SAMPLE_FREQ(AT32_AUDIO_FREQ_16K), /* tSamFreq: 16000hz */
346#endif
347#if (AUDIO_SUPPORT_FREQ_48K == 1)
348 SAMPLE_FREQ(AT32_AUDIO_FREQ_48K), /* tSamFreq: 48000hz */
349#endif
350
351 0x09, /* bLength: size of endpoint descriptor in bytes */
352 USB_DESCIPTOR_TYPE_ENDPOINT, /* bDescriptorType: endpoint descriptor type */
353 USBD_AUHID_AUDIO_SPK_OUT_EPT, /* bEndpointAddress: the address of endpoint on usb device described by this descriptor */
354 USB_EPT_DESC_ISO | USB_ETP_DESC_ASYNC, /* bmAttributes: endpoint attributes */
355 LBYTE(AUDIO_SPK_OUT_MAXPACKET_SIZE),
356 HBYTE(AUDIO_SPK_OUT_MAXPACKET_SIZE), /* wMaxPacketSize: maximum packe size this endpoint */
357 AUHID_HID_BINTERVAL_TIME, /* bInterval: interval for polling endpoint for data transfers */
358 0x00, /* bRefresh: unused */
359#if (AUDIO_SUPPORT_FEEDBACK == 1)
360 USBD_AUHID_AUDIO_FEEDBACK_EPT, /* bSynchAddress: feedback endpoint */
361#else
362 0x00, /* bSynchAddress: unused */
363#endif
364
365 0x07, /* bLength: size of endpoint descriptor in bytes */
366 AUDIO_CS_ENDPOINT, /* bDescriptorType: cs endpoint descriptor type */
367 0x01, /* bDescriptorSubtype: general subtype */
368 0x01, /* bmAttributes */
369 0x00, /* bLockDelayUnits: unused */
370 0x00, /* wLockDelay: unused */
371 0x00, /* wLockDelay: unused */
372
373#if (AUDIO_SUPPORT_FEEDBACK == 1)
374 0x09, /* bLength: size of endpoint descriptor in bytes */
375 USB_DESCIPTOR_TYPE_ENDPOINT, /* bDescriptorType: endpoint descriptor type */
376 USBD_AUHID_AUDIO_FEEDBACK_EPT, /* bEndpointAddress: the address of endpoint on usb device described by this descriptor */
377 0x11, /* bmAttributes: endpoint attributes */
378 LBYTE(AUDIO_FEEDBACK_MAXPACKET_SIZE), /* wMaxPacketSize: maximum packe size this endpoint */
379 HBYTE(AUDIO_FEEDBACK_MAXPACKET_SIZE), /* wMaxPacketSize: maximum packe size this endpoint */
380 1, /* bInterval: interval for polling endpoint for data transfers */
381 FEEDBACK_REFRESH_TIME, /* bRefresh: this field indicates the rate at which an iso syncronization
382 pipe provides new syncronization feedback data. this rate must be a power of
383 2, therefore only the power is reported back and the range of this field is from
384 1(2ms) to 9(512ms) */
385 0x00, /* bSynchAddress: 0x00*/
386#endif
387
388#endif
389
390 USB_DEVICE_IF_DESC_LEN, /* bLength: interface descriptor size */
391 USB_DESCIPTOR_TYPE_INTERFACE, /* bDescriptorType: interface descriptor type */
392 HID_INTERFACE_NUMBER, /* bInterfaceNumber: number of interface */
393 0x00, /* bAlternateSetting: alternate set */
394 0x02, /* bNumEndpoints: number of endpoints */
395 USB_CLASS_CODE_HID, /* bInterfaceClass: class code hid */
396 0x00, /* bInterfaceSubClass: subclass code */
397 0x00, /* bInterfaceProtocol: protocol code */
398 0x00, /* iInterface: index of string descriptor */
399
400 0x09, /* bLength: size of HID descriptor in bytes */
401 HID_CLASS_DESC_HID, /* bDescriptorType: HID descriptor type */
402 LBYTE(AUHID_HID_BCD_NUM),
403 HBYTE(AUHID_HID_BCD_NUM), /* bcdHID: HID class specification release number */
404 0x00, /* bCountryCode: hardware target conutry */
405 0x01, /* bNumDescriptors: number of HID class descriptor to follow */
406 HID_CLASS_DESC_REPORT, /* bDescriptorType: report descriptor type */
407 LBYTE(sizeof(g_usbd_audio_hid_report)),
408 HBYTE(sizeof(g_usbd_audio_hid_report)), /* wDescriptorLength: total length of reprot descriptor */
409
410 USB_DEVICE_EPT_LEN, /* bLength: size of endpoint descriptor in bytes */
411 USB_DESCIPTOR_TYPE_ENDPOINT, /* bDescriptorType: endpoint descriptor type */
412 USBD_AUHID_HID_IN_EPT, /* bEndpointAddress: the address of endpoint on usb device described by this descriptor */
413 USB_EPT_DESC_INTERRUPT, /* bmAttributes: endpoint attributes */
414 LBYTE(USBD_AUHID_IN_MAXPACKET_SIZE),
415 HBYTE(USBD_AUHID_IN_MAXPACKET_SIZE), /* wMaxPacketSize: maximum packe size this endpoint */
416 AUHID_HID_BINTERVAL_TIME, /* bInterval: interval for polling endpoint for data transfers */
417
418 USB_DEVICE_EPT_LEN, /* bLength: size of endpoint descriptor in bytes */
419 USB_DESCIPTOR_TYPE_ENDPOINT, /* bDescriptorType: endpoint descriptor type */
420 USBD_AUHID_HID_OUT_EPT, /* bEndpointAddress: the address of endpoint on usb device described by this descriptor */
421 USB_EPT_DESC_INTERRUPT, /* bmAttributes: endpoint attributes */
422 LBYTE(USBD_AUHID_OUT_MAXPACKET_SIZE),
423 HBYTE(USBD_AUHID_OUT_MAXPACKET_SIZE), /* wMaxPacketSize: maximum packe size this endpoint */
424 AUHID_HID_BINTERVAL_TIME, /* bInterval: interval for polling endpoint for data transfers */
425};
426
430#if defined ( __ICCARM__ ) /* iar compiler */
431 #pragma data_alignment=4
432#endif
433ALIGNED_HEAD uint8_t g_usbd_audio_hid_report[USBD_AUHID_HID_SIZ_REPORT_DESC] ALIGNED_TAIL =
434{
435 0x06, 0xFF, 0x00, /* USAGE_PAGE(Vendor Page:0xFF00) */
436 0x09, 0x01, /* USAGE (Demo Kit) */
437 0xa1, 0x01, /* COLLECTION (Application) */
438 /* 7 */
439
440 /* Led 2 */
441 0x85, HID_REPORT_ID_2, /* REPORT_ID 2 */
442 0x09, 0x02, /* USAGE (LED 2) */
443 0x15, 0x00, /* LOGICAL_MINIMUM (0) */
444 0x25, 0x01, /* LOGICAL_MAXIMUM (1) */
445 0x75, 0x08, /* REPORT_SIZE (8) */
446 0x95, 0x3F, /* REPORT_COUNT (1) */
447 0xB1, 0x82, /* FEATURE (Data,Var,Abs,Vol) */
448
449 0x85, 0x02, /* REPORT_ID (2) */
450 0x09, 0x02, /* USAGE (LED 2) */
451 0x91, 0x82, /* OUTPUT (Data,Var,Abs,Vol) */
452 /* 27 */
453
454 /* Led 3 */
455 0x85, HID_REPORT_ID_3, /* REPORT_ID (3) */
456 0x09, 0x03, /* USAGE (LED 3) */
457 0x15, 0x00, /* LOGICAL_MINIMUM (0) */
458 0x25, 0x01, /* LOGICAL_MAXIMUM (1) */
459 0x75, 0x08, /* REPORT_SIZE (8) */
460 0x95, 0x3F, /* REPORT_COUNT (1) */
461 0xB1, 0x82, /* FEATURE (Data,Var,Abs,Vol) */
462
463 0x85, 0x03, /* REPORT_ID (3) */
464 0x09, 0x03, /* USAGE (LED 3) */
465 0x91, 0x82, /* OUTPUT (Data,Var,Abs,Vol) */
466 /* 47 */
467
468 /* Led 4 */
469 0x85, HID_REPORT_ID_4, /* REPORT_ID 4) */
470 0x09, 0x04, /* USAGE (LED 4) */
471 0x15, 0x00, /* LOGICAL_MINIMUM (0) */
472 0x25, 0x01, /* LOGICAL_MAXIMUM (1) */
473 0x75, 0x08, /* REPORT_SIZE (8) */
474 0x95, 0x3F, /* REPORT_COUNT (1) */
475 0xB1, 0x82, /* FEATURE (Data,Var,Abs,Vol) */
476
477 0x85, 0x04, /* REPORT_ID (4) */
478 0x09, 0x04, /* USAGE (LED 4) */
479 0x91, 0x82, /* OUTPUT (Data,Var,Abs,Vol) */
480 /* 67 */
481
482 /* key Push Button */
483 0x85, HID_REPORT_ID_5, /* REPORT_ID (5) */
484 0x09, 0x05, /* USAGE (Push Button) */
485 0x15, 0x00, /* LOGICAL_MINIMUM (0) */
486 0x25, 0x01, /* LOGICAL_MAXIMUM (1) */
487 0x75, 0x01, /* REPORT_SIZE (1) */
488 0x81, 0x82, /* INPUT (Data,Var,Abs,Vol) */
489
490 0x09, 0x05, /* USAGE (Push Button) */
491 0x75, 0x01, /* REPORT_SIZE (1) */
492 0xb1, 0x82, /* FEATURE (Data,Var,Abs,Vol) */
493
494 0x75, 0x07, /* REPORT_SIZE (7) */
495 0x81, 0x83, /* INPUT (Cnst,Var,Abs,Vol) */
496 0x85, 0x05, /* REPORT_ID (5) */
497
498 0x75, 0x07, /* REPORT_SIZE (7) */
499 0xb1, 0x83, /* FEATURE (Cnst,Var,Abs,Vol) */
500 /* 95 */
501
502 /* Data OUT */
503 0x85, HID_REPORT_ID_6, /* REPORT_ID (0xF0) */
504 0x09, 0x06, /* USAGE */
505 0x15, 0x00, /* LOGICAL_MINIMUM (0) */
506 0x26, 0xFF,0x00, /* LOGICAL_MAXIMUM (255) */
507 0x75, 0x08, /* REPORT_SIZE (8) */
508 0x95, 0x3F, /* REPORT_COUNT (64) */
509 0x91, 0x02, /* OUTPUT(Data,Var,Abs,Vol) */
510 /* 110 */
511
512 /* Data IN */
513 0x85, HID_REPORT_ID_6, /* REPORT_ID (0xF0) */
514 0x09, 0x07, /* USAGE */
515 0x15, 0x00, /* LOGICAL_MINIMUM (0) */
516 0x26, 0xFF,0x00, /* LOGICAL_MAXIMUM (255) */
517 0x75, 0x08, /* REPORT_SIZE (8) */
518 0x95, 0x3F, /* REPORT_COUNT (64) */
519 0x81, 0x82, /* INPUT(Data,Var,Abs,Vol) */
520
521 /* 125 */
522 0xc0 /* END_COLLECTION */
523};
524
528#if defined ( __ICCARM__ ) /* iar compiler */
529 #pragma data_alignment=4
530#endif
531ALIGNED_HEAD uint8_t g_audio_hid_usb_desc[9] ALIGNED_TAIL =
532{
533 0x09, /* bLength: size of HID descriptor in bytes */
534 HID_CLASS_DESC_HID, /* bDescriptorType: HID descriptor type */
535 LBYTE(AUHID_HID_BCD_NUM),
536 HBYTE(AUHID_HID_BCD_NUM), /* bcdHID: HID class specification release number */
537 0x00, /* bCountryCode: hardware target conutry */
538 0x01, /* bNumDescriptors: number of HID class descriptor to follow */
539 HID_CLASS_DESC_REPORT, /* bDescriptorType: report descriptor type */
540 LBYTE(sizeof(g_usbd_audio_hid_report)),
541 HBYTE(sizeof(g_usbd_audio_hid_report)), /* wDescriptorLength: total length of reprot descriptor */
542};
543
547#if defined ( __ICCARM__ ) /* iar compiler */
548 #pragma data_alignment=4
549#endif
550ALIGNED_HEAD static uint8_t g_string_lang_id[USBD_AUHID_SIZ_STRING_LANGID] ALIGNED_TAIL =
551{
552 USBD_AUHID_SIZ_STRING_LANGID,
553 USB_DESCIPTOR_TYPE_STRING,
554 0x09,
555 0x04,
556};
557
561#if defined ( __ICCARM__ ) /* iar compiler */
562 #pragma data_alignment=4
563#endif
564ALIGNED_HEAD static uint8_t g_string_serial[USBD_AUHID_SIZ_STRING_SERIAL] ALIGNED_TAIL =
565{
566 USBD_AUHID_SIZ_STRING_SERIAL,
567 USB_DESCIPTOR_TYPE_STRING,
568};
569
570
571/* device descriptor */
572static usbd_desc_t device_descriptor =
573{
574 USB_DEVICE_DESC_LEN,
575 g_usbd_descriptor
576};
577
578/* config descriptor */
579static usbd_desc_t config_descriptor =
580{
581 USBD_AUHID_CONFIG_DESC_SIZE,
582 g_usbd_configuration
583};
584
585/* langid descriptor */
586static usbd_desc_t langid_descriptor =
587{
588 USBD_AUHID_SIZ_STRING_LANGID,
589 g_string_lang_id
590};
591
592/* serial descriptor */
593static usbd_desc_t serial_descriptor =
594{
595 USBD_AUHID_SIZ_STRING_SERIAL,
596 g_string_serial
597};
598
599static usbd_desc_t vp_desc;
600
607static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf)
608{
609 uint16_t str_len = 0, id_pos = 2;
610 uint8_t *tmp_str = string;
611
612 while(*tmp_str != '\0')
613 {
614 str_len ++;
615 unicode_buf[id_pos ++] = *tmp_str ++;
616 unicode_buf[id_pos ++] = 0x00;
617 }
618
619 str_len = str_len * 2 + 2;
620 unicode_buf[0] = str_len;
621 unicode_buf[1] = USB_DESCIPTOR_TYPE_STRING;
622
623 return str_len;
624}
625
633static void usbd_int_to_unicode (uint32_t value , uint8_t *pbuf , uint8_t len)
634{
635 uint8_t idx = 0;
636
637 for( idx = 0 ; idx < len ; idx ++)
638 {
639 if( ((value >> 28)) < 0xA )
640 {
641 pbuf[2 * idx] = (value >> 28) + '0';
642 }
643 else
644 {
645 pbuf[2 * idx] = (value >> 28) + 'A' - 10;
646 }
647
648 value = value << 4;
649
650 pbuf[2 * idx + 1] = 0;
651 }
652}
653
659static void get_serial_num(void)
660{
661 uint32_t serial0, serial1, serial2;
662
663 serial0 = *(uint32_t*)MCU_ID1;
664 serial1 = *(uint32_t*)MCU_ID2;
665 serial2 = *(uint32_t*)MCU_ID3;
666
667 serial0 += serial2;
668
669 if (serial0 != 0)
670 {
671 usbd_int_to_unicode (serial0, &g_string_serial[2] ,8);
672 usbd_int_to_unicode (serial1, &g_string_serial[18] ,4);
673 }
674}
675
681static usbd_desc_t *get_device_descriptor(void)
682{
683 return &device_descriptor;
684}
685
691static usbd_desc_t * get_device_qualifier(void)
692{
693 return NULL;
694}
695
701static usbd_desc_t *get_device_configuration(void)
702{
703 return &config_descriptor;
704}
705
711static usbd_desc_t *get_device_other_speed(void)
712{
713 return NULL;
714}
715
721static usbd_desc_t *get_device_lang_id(void)
722{
723 return &langid_descriptor;
724}
725
726
732static usbd_desc_t *get_device_manufacturer_string(void)
733{
734 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_AUHID_DESC_MANUFACTURER_STRING, g_usbd_desc_buffer);
735 vp_desc.descriptor = g_usbd_desc_buffer;
736 return &vp_desc;
737}
738
744static usbd_desc_t *get_device_product_string(void)
745{
746 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_AUHID_DESC_PRODUCT_STRING, g_usbd_desc_buffer);
747 vp_desc.descriptor = g_usbd_desc_buffer;
748 return &vp_desc;
749}
750
756static usbd_desc_t *get_device_serial_string(void)
757{
758 get_serial_num();
759 return &serial_descriptor;
760}
761
767static usbd_desc_t *get_device_interface_string(void)
768{
769 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_AUHID_DESC_INTERFACE_STRING, g_usbd_desc_buffer);
770 vp_desc.descriptor = g_usbd_desc_buffer;
771 return &vp_desc;
772}
773
779static usbd_desc_t *get_device_config_string(void)
780{
781 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_AUHID_DESC_CONFIGURATION_STRING, g_usbd_desc_buffer);
782 vp_desc.descriptor = g_usbd_desc_buffer;
783 return &vp_desc;
784}
785
audio_hid_desc.h
NULL
#define NULL
Definition emmc_card/inc/at32_sdio.h:340
AUDIO_MIC_IN_MAXPACKET_SIZE
#define AUDIO_MIC_IN_MAXPACKET_SIZE
Definition audio_class.h:61
AUDIO_SPK_OUT_MAXPACKET_SIZE
#define AUDIO_SPK_OUT_MAXPACKET_SIZE
Definition audio_class.h:62
FEEDBACK_REFRESH_TIME
#define FEEDBACK_REFRESH_TIME
Definition audio_class.h:64
AUDIO_FEEDBACK_MAXPACKET_SIZE
#define AUDIO_FEEDBACK_MAXPACKET_SIZE
Definition audio_class.h:63
AUDIO_MIC_FEATURE_UNIT_ID
#define AUDIO_MIC_FEATURE_UNIT_ID
Definition audio_desc.h:168
AUDIO_CS_ENDPOINT
#define AUDIO_CS_ENDPOINT
Definition audio_desc.h:75
AUDIO_AC_HEADER
#define AUDIO_AC_HEADER
Definition audio_desc.h:90
AUDIO_SUBCLASS_AUDIOCONTROL
#define AUDIO_SUBCLASS_AUDIOCONTROL
Definition audio_desc.h:67
AUDIO_INPUT_TERMINAL_SIZE
#define AUDIO_INPUT_TERMINAL_SIZE
audio interface descriptor size define
Definition audio_desc.h:160
AUDIO_TERMINAL_TYPE_STREAMING
#define AUDIO_TERMINAL_TYPE_STREAMING
Definition audio_desc.h:137
AUDIO_SPK_CHR
#define AUDIO_SPK_CHR
Definition audio_desc.h:201
AUDIO_SPK_INTERFACE_NUMBER
#define AUDIO_SPK_INTERFACE_NUMBER
Definition audio_desc.h:179
AUDIO_MIC_OUTPUT_TERMINAL_ID
#define AUDIO_MIC_OUTPUT_TERMINAL_ID
Definition audio_desc.h:169
AUDIO_MIC_INTERFACE_NUMBER
#define AUDIO_MIC_INTERFACE_NUMBER
audio interface number
Definition audio_desc.h:177
SAMPLE_FREQ
#define SAMPLE_FREQ(frq)
Definition audio_desc.h:212
AUDIO_MIC_FREQ_SIZE
#define AUDIO_MIC_FREQ_SIZE
audio microphone freq and channel config
Definition audio_desc.h:193
AUDIO_SPK_FREQ_SIZE
#define AUDIO_SPK_FREQ_SIZE
audio speaker freq and channel config
Definition audio_desc.h:200
AT32_AUDIO_FREQ_48K
#define AT32_AUDIO_FREQ_48K
Definition audio_desc.h:188
AUDIO_FORMAT_TYPE_I
#define AUDIO_FORMAT_TYPE_I
audio format type 1
Definition audio_desc.h:147
MCU_ID1
#define MCU_ID1
Definition audio_desc.h:214
AUDIO_AS_GENERAL
#define AUDIO_AS_GENERAL
Definition audio_desc.h:103
AUDIO_INTERFACE_NUM
#define AUDIO_INTERFACE_NUM
audio interface config
Definition audio_desc.h:152
AUDIO_CS_INTERFACE
#define AUDIO_CS_INTERFACE
audio class-specific descriptor types
Definition audio_desc.h:74
AUDIO_SPK_FEATURE_UNIT_ID
#define AUDIO_SPK_FEATURE_UNIT_ID
Definition audio_desc.h:171
AUDIO_OUTPUT_TERMINAL_SIZE
#define AUDIO_OUTPUT_TERMINAL_SIZE
Definition audio_desc.h:161
AUDIO_SPK_OUTPUT_TERMINAL_ID
#define AUDIO_SPK_OUTPUT_TERMINAL_ID
Definition audio_desc.h:172
AUDIO_AC_INPUT_TERMINAL
#define AUDIO_AC_INPUT_TERMINAL
Definition audio_desc.h:91
AUDIO_MIC_CHR
#define AUDIO_MIC_CHR
Definition audio_desc.h:194
AUDIO_OUTPUT_TERMINAL_SPEAKER
#define AUDIO_OUTPUT_TERMINAL_SPEAKER
Definition audio_desc.h:142
MCU_ID2
#define MCU_ID2
Definition audio_desc.h:215
AT32_AUDIO_FREQ_16K
#define AT32_AUDIO_FREQ_16K
audio support freq
Definition audio_desc.h:187
AUDIO_AS_FORMAT_TYPE
#define AUDIO_AS_FORMAT_TYPE
Definition audio_desc.h:104
AUDIO_MIC_INPUT_TERMINAL_ID
#define AUDIO_MIC_INPUT_TERMINAL_ID
audio terminal id define
Definition audio_desc.h:167
AUDIO_SPK_BITW
#define AUDIO_SPK_BITW
Definition audio_desc.h:202
MCU_ID3
#define MCU_ID3
Definition audio_desc.h:216
AUDIO_FEATURE_UNIT_SIZE
#define AUDIO_FEATURE_UNIT_SIZE
Definition audio_desc.h:162
AUDIO_PROTOCOL_UNDEFINED
#define AUDIO_PROTOCOL_UNDEFINED
audio interface protocol codes
Definition audio_desc.h:84
AUDIO_MIC_BITW
#define AUDIO_MIC_BITW
Definition audio_desc.h:195
AUDIO_AC_FEATURE_UNIT
#define AUDIO_AC_FEATURE_UNIT
Definition audio_desc.h:95
AUDIO_SPK_INPUT_TERMINAL_ID
#define AUDIO_SPK_INPUT_TERMINAL_ID
Definition audio_desc.h:170
AUDIO_INTERFACE_LEN
#define AUDIO_INTERFACE_LEN
Definition audio_desc.h:153
AUDIO_SUBCLASS_AUDIOSTREAMING
#define AUDIO_SUBCLASS_AUDIOSTREAMING
Definition audio_desc.h:68
AUDIO_AC_OUTPUT_TERMINAL
#define AUDIO_AC_OUTPUT_TERMINAL
Definition audio_desc.h:92
AUDIO_INPUT_TERMINAL_MICROPHONE
#define AUDIO_INPUT_TERMINAL_MICROPHONE
Definition audio_desc.h:140
USBD_AUHID_AUDIO_MIC_IN_EPT
#define USBD_AUHID_AUDIO_MIC_IN_EPT
endpoint define
Definition audio_hid_class.h:53
USBD_AUHID_HID_IN_EPT
#define USBD_AUHID_HID_IN_EPT
usb custom hid use endpoint define
Definition audio_hid_class.h:60
USBD_AUHID_HID_OUT_EPT
#define USBD_AUHID_HID_OUT_EPT
Definition audio_hid_class.h:61
USBD_AUHID_AUDIO_FEEDBACK_EPT
#define USBD_AUHID_AUDIO_FEEDBACK_EPT
Definition audio_hid_class.h:55
USBD_AUHID_OUT_MAXPACKET_SIZE
#define USBD_AUHID_OUT_MAXPACKET_SIZE
Definition audio_hid_class.h:67
USBD_AUHID_AUDIO_SPK_OUT_EPT
#define USBD_AUHID_AUDIO_SPK_OUT_EPT
Definition audio_hid_class.h:54
USBD_AUHID_IN_MAXPACKET_SIZE
#define USBD_AUHID_IN_MAXPACKET_SIZE
usb custom hid in and out max packet size define
Definition audio_hid_class.h:66
USBD_AUHID_DESC_CONFIGURATION_STRING
#define USBD_AUHID_DESC_CONFIGURATION_STRING
Definition audio_hid_desc.h:60
USBD_AUHID_DESC_MANUFACTURER_STRING
#define USBD_AUHID_DESC_MANUFACTURER_STRING
Definition audio_hid_desc.h:58
USBD_AUHID_HID_SIZ_REPORT_DESC
#define USBD_AUHID_HID_SIZ_REPORT_DESC
Definition audio_hid_desc.h:235
AUHID_BCD_NUM
#define AUHID_BCD_NUM
Definition audio_hid_desc.h:50
HID_REPORT_ID_2
#define HID_REPORT_ID_2
Definition audio_hid_desc.h:222
HID_REPORT_ID_4
#define HID_REPORT_ID_4
Definition audio_hid_desc.h:224
HID_CLASS_DESC_HID
#define HID_CLASS_DESC_HID
usb hid class descriptor define
Definition audio_hid_desc.h:214
AUHID_HID_BINTERVAL_TIME
#define AUHID_HID_BINTERVAL_TIME
Definition audio_hid_desc.h:204
HID_CLASS_DESC_REPORT
#define HID_CLASS_DESC_REPORT
Definition audio_hid_desc.h:215
HID_REPORT_ID_6
#define HID_REPORT_ID_6
Definition audio_hid_desc.h:226
USBD_AUHID_SIZ_STRING_LANGID
#define USBD_AUHID_SIZ_STRING_LANGID
Definition audio_hid_desc.h:55
AUHID_HID_BCD_NUM
#define AUHID_HID_BCD_NUM
usb bcd number define
Definition audio_hid_desc.h:209
g_usbd_audio_hid_report
uint8_t g_usbd_audio_hid_report[126]
USBD_AUHID_PRODUCT_ID
#define USBD_AUHID_PRODUCT_ID
Definition audio_hid_desc.h:53
g_audio_hid_usb_desc
uint8_t g_audio_hid_usb_desc[9]
USBD_AUHID_CONFIG_DESC_SIZE
#define USBD_AUHID_CONFIG_DESC_SIZE
Definition audio_hid_desc.h:237
USBD_AUHID_DESC_INTERFACE_STRING
#define USBD_AUHID_DESC_INTERFACE_STRING
Definition audio_hid_desc.h:61
USBD_AUHID_DESC_PRODUCT_STRING
#define USBD_AUHID_DESC_PRODUCT_STRING
Definition audio_hid_desc.h:59
USBD_AUHID_SIZ_STRING_SERIAL
#define USBD_AUHID_SIZ_STRING_SERIAL
Definition audio_hid_desc.h:56
HID_REPORT_ID_3
#define HID_REPORT_ID_3
Definition audio_hid_desc.h:223
USBD_AUHID_VENDOR_ID
#define USBD_AUHID_VENDOR_ID
Definition audio_hid_desc.h:52
HID_REPORT_ID_5
#define HID_REPORT_ID_5
Definition audio_hid_desc.h:225
HID_INTERFACE_NUMBER
#define HID_INTERFACE_NUMBER
Definition audio_hid_desc.h:182
serial_descriptor
static usbd_desc_t serial_descriptor
Definition audio_hid_desc.c:593
device_descriptor
static usbd_desc_t device_descriptor
Definition audio_hid_desc.c:572
get_device_configuration
static usbd_desc_t * get_device_configuration(void)
get config descriptor
Definition audio_hid_desc.c:701
langid_descriptor
static usbd_desc_t langid_descriptor
Definition audio_hid_desc.c:586
get_device_descriptor
static usbd_desc_t * get_device_descriptor(void)
get device descriptor
Definition audio_hid_desc.c:681
get_device_manufacturer_string
static usbd_desc_t * get_device_manufacturer_string(void)
get manufacturer descriptor
Definition audio_hid_desc.c:732
get_device_qualifier
static usbd_desc_t * get_device_qualifier(void)
get device qualifier
Definition audio_hid_desc.c:691
get_device_interface_string
static usbd_desc_t * get_device_interface_string(void)
get interface descriptor
Definition audio_hid_desc.c:767
vp_desc
static usbd_desc_t vp_desc
Definition audio_hid_desc.c:599
audio_hid_desc_handler
usbd_desc_handler audio_hid_desc_handler
device descriptor handler structure
Definition audio_hid_desc.c:66
get_device_other_speed
static usbd_desc_t * get_device_other_speed(void)
get other speed descriptor
Definition audio_hid_desc.c:711
ALIGNED_TAIL
static ALIGNED_HEAD uint8_t g_usbd_desc_buffer[256] ALIGNED_TAIL
usb device standard descriptor
Definition audio_hid_desc.c:61
get_device_product_string
static usbd_desc_t * get_device_product_string(void)
get product descriptor
Definition audio_hid_desc.c:744
get_device_config_string
static usbd_desc_t * get_device_config_string(void)
get device config descriptor
Definition audio_hid_desc.c:779
usbd_unicode_convert
static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf)
standard usb unicode convert
Definition audio_hid_desc.c:607
get_device_lang_id
static usbd_desc_t * get_device_lang_id(void)
get lang id descriptor
Definition audio_hid_desc.c:721
get_serial_num
static void get_serial_num(void)
usb get serial number
Definition audio_hid_desc.c:659
config_descriptor
static usbd_desc_t config_descriptor
Definition audio_hid_desc.c:579
get_device_serial_string
static usbd_desc_t * get_device_serial_string(void)
get serial descriptor
Definition audio_hid_desc.c:756
usbd_int_to_unicode
static void usbd_int_to_unicode(uint32_t value, uint8_t *pbuf, uint8_t len)
usb int convert to unicode
Definition audio_hid_desc.c:633
AUDIO_SUPPORT_FEEDBACK
#define AUDIO_SUPPORT_FEEDBACK
Definition audio/audio_conf.h:48
HBYTE
#define HBYTE(x)
Definition usb_std.h:271
USB_DEVICE_EPT_LEN
#define USB_DEVICE_EPT_LEN
Definition usb_std.h:159
USB_EPT_DESC_ISO
#define USB_EPT_DESC_ISO
Definition usb_std.h:182
USB_MAX_EP0_SIZE
#define USB_MAX_EP0_SIZE
endpoint 0 max size
Definition usb_std.h:248
USB_PRODUCT_STRING
#define USB_PRODUCT_STRING
Definition usb_std.h:105
USB_DESCIPTOR_TYPE_CONFIGURATION
#define USB_DESCIPTOR_TYPE_CONFIGURATION
Definition usb_std.h:92
LBYTE
#define LBYTE(x)
low byte and high byte define
Definition usb_std.h:270
USB_DESCIPTOR_TYPE_ENDPOINT
#define USB_DESCIPTOR_TYPE_ENDPOINT
Definition usb_std.h:95
USB_DEVICE_DESC_LEN
#define USB_DEVICE_DESC_LEN
Definition usb_std.h:156
USB_MFC_STRING
#define USB_MFC_STRING
Definition usb_std.h:104
USB_DEVICE_IF_DESC_LEN
#define USB_DEVICE_IF_DESC_LEN
Definition usb_std.h:158
USB_DEVICE_CFG_DESC_LEN
#define USB_DEVICE_CFG_DESC_LEN
Definition usb_std.h:157
USB_EPT_DESC_INTERRUPT
#define USB_EPT_DESC_INTERRUPT
Definition usb_std.h:184
USB_SERIAL_STRING
#define USB_SERIAL_STRING
Definition usb_std.h:106
USB_DESCIPTOR_TYPE_DEVICE
#define USB_DESCIPTOR_TYPE_DEVICE
usb standard device type
Definition usb_std.h:91
USB_DESCIPTOR_TYPE_STRING
#define USB_DESCIPTOR_TYPE_STRING
Definition usb_std.h:93
USB_CLASS_CODE_AUDIO
#define USB_CLASS_CODE_AUDIO
usb class code
Definition usb_std.h:167
USB_DESCIPTOR_TYPE_INTERFACE
#define USB_DESCIPTOR_TYPE_INTERFACE
Definition usb_std.h:94
USB_ETP_DESC_ASYNC
#define USB_ETP_DESC_ASYNC
Definition usb_std.h:187
USB_CLASS_CODE_HID
#define USB_CLASS_CODE_HID
Definition usb_std.h:169
usbd_desc_handler
usb device descriptor handler
Definition usbd_core.h:75
usbd_desc_t
usb device descriptor struct
Definition usbd_core.h:66
usbd_desc_t::length
uint16_t length
Definition usbd_core.h:67
usbd_desc_t::descriptor
uint8_t * descriptor
Definition usbd_core.h:68
usb_std.h
usb standard header file
usbd_core.h
usb device core header file
usbd_sdr.h
usb standard request header file


AT32F413 Firmwary Library: audio_hid_desc.h Source File

  • middlewares
  • usbd_class
  • audio_hid
audio_hid_desc.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AUDIO_HID_DESC_H
28#define __AUDIO_HID_DESC_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "audio_hid_class.h"
35#include "usbd_core.h"
36#include "audio_conf.h"
37
50#define AUHID_BCD_NUM 0x0100
51
52#define USBD_AUHID_VENDOR_ID 0x2E3C
53#define USBD_AUHID_PRODUCT_ID 0x5555
54
55#define USBD_AUHID_SIZ_STRING_LANGID 4
56#define USBD_AUHID_SIZ_STRING_SERIAL 0x1A
57
58#define USBD_AUHID_DESC_MANUFACTURER_STRING "Artery"
59#define USBD_AUHID_DESC_PRODUCT_STRING "AT32 Audio"
60#define USBD_AUHID_DESC_CONFIGURATION_STRING "Audio Config"
61#define USBD_AUHID_DESC_INTERFACE_STRING "Audio Interface"
65#define AUDIO_SUBCLASS_UNDEFINED 0x00
66#define AUDIO_SUBCLASS_AUDIOCONTROL 0x01
67#define AUDIO_SUBCLASS_AUDIOSTREAMING 0x02
68#define AUDIO_SUBCLASS_MIDISTREMING 0x03
69
73#define AUDIO_CS_INTERFACE 0x24
74#define AUDIO_CS_ENDPOINT 0x25
75#define AUDIO_CS_STRING 0x23
76#define AUDIO_CS_CONFIGURATION 0x22
77#define AUDIO_CS_DEVICE 0x21
78#define AUDIO_CS_UNDEFINED 0x20
79
83#define AUDIO_PROTOCOL_UNDEFINED 0x00
84
88#define AUDIO_AC_DESCRIPTOR_UNDEFINED 0x00
89#define AUDIO_AC_HEADER 0x01
90#define AUDIO_AC_INPUT_TERMINAL 0x02
91#define AUDIO_AC_OUTPUT_TERMINAL 0x03
92#define AUDIO_AC_MIXER_UNIT 0x04
93#define AUDIO_AC_SELECTOR_UNIT 0x05
94#define AUDIO_AC_FEATURE_UNIT 0x06
95#define AUDIO_AC_PROCESSING_UNIT 0x07
96#define AUDIO_AC_EXTENSION_UNIT 0x08
97
101#define AUDIO_AS_DESCRIPTOR_UNDEFINED 0x00
102#define AUDIO_AS_GENERAL 0x01
103#define AUDIO_AS_FORMAT_TYPE 0x02
104#define AUDIO_AS_FORMAT_SPECIFIC 0x03
105
109#define AUDIO_REQUEST_CODE_UNDEFINED 0x00
110#define AUDIO_REQ_SET_CUR 0x01
111#define AUDIO_REQ_GET_CUR 0x81
112#define AUDIO_REQ_SET_MIN 0x02
113#define AUDIO_REQ_GET_MIN 0x82
114#define AUDIO_REQ_SET_MAX 0x03
115#define AUDIO_REQ_GET_MAX 0x83
116#define AUDIO_REQ_SET_RES 0x04
117#define AUDIO_REQ_GET_RES 0x84
118#define AUDIO_REQ_SET_MEM 0x05
119#define AUDIO_REQ_GET_MEM 0x85
120#define AUDIO_REQ_GET_STAT 0xFF
121
125#define AUDIO_FU_CONTROL_UNDEFINED 0x00
126#define AUDIO_FU_MUTE_CONTROL 0x01
127#define AUDIO_FU_VOLUME_CONTROL 0x02
128#define AUDIO_FU_BASS_CONTROL 0x03
129#define AUDIO_FU_MID_CONTROL 0x04
130#define AUDIO_FU_TREBLE_CONTROL 0x05
131
135#define AUDIO_TERMINAL_TYPE_UNDEFINED 0x0100
136#define AUDIO_TERMINAL_TYPE_STREAMING 0x0101
137#define AUDIO_TERMINAL_TYPE_VENDOR 0x01FF
138#define AUDIO_INPUT_TERMINAL_UNDEFINED 0x0200
139#define AUDIO_INPUT_TERMINAL_MICROPHONE 0x0201
140#define AUDIO_OUTPUT_TERMINAL_UNDEFINED 0x0300
141#define AUDIO_OUTPUT_TERMINAL_SPEAKER 0x0301
142
146#define AUDIO_FORMAT_TYPE_I 0x01
147
151#define AUDIO_INTERFACE_NUM (AUDIO_SUPPORT_SPK + AUDIO_SUPPORT_MIC)
152#define AUDIO_INTERFACE_LEN ((0x08 + AUDIO_INTERFACE_NUM) + AUDIO_INTERFACE_NUM * 0x22)
153#define AUDIO_MIC_INTERFACE 0x01
154#define AUDIO_SPK_INTERFACE 0x02
155
159#define AUDIO_INPUT_TERMINAL_SIZE 0x0C
160#define AUDIO_OUTPUT_TERMINAL_SIZE 0x09
161#define AUDIO_FEATURE_UNIT_SIZE 0x0D
162
166#define AUDIO_MIC_INPUT_TERMINAL_ID 0x01
167#define AUDIO_MIC_FEATURE_UNIT_ID 0x02
168#define AUDIO_MIC_OUTPUT_TERMINAL_ID 0x03
169#define AUDIO_SPK_INPUT_TERMINAL_ID 0x04
170#define AUDIO_SPK_FEATURE_UNIT_ID 0x05
171#define AUDIO_SPK_OUTPUT_TERMINAL_ID 0x06
172
176#define AUDIO_MIC_INTERFACE_NUMBER 0x01
177#if (AUDIO_SUPPORT_MIC == 1)
178#define AUDIO_SPK_INTERFACE_NUMBER 0x02
179#else
180#define AUDIO_SPK_INTERFACE_NUMBER 0x01
181#endif
182#define HID_INTERFACE_NUMBER 0x03
183
187#define AT32_AUDIO_FREQ_16K 16000
188#define AT32_AUDIO_FREQ_48K 48000
189
193#define AUDIO_MIC_FREQ_SIZE (AUDIO_SUPPORT_FREQ)
194#define AUDIO_MIC_CHR AUDIO_MIC_CHANEL_NUM
195#define AUDIO_MIC_BITW (AUDIO_MIC_DEFAULT_BITW)
196
200#define AUDIO_SPK_FREQ_SIZE (AUDIO_SUPPORT_FREQ)
201#define AUDIO_SPK_CHR AUDIO_SPK_CHANEL_NUM
202#define AUDIO_SPK_BITW (AUDIO_SPK_DEFAULT_BITW)
203
204#define AUHID_HID_BINTERVAL_TIME 0x01
205
209#define AUHID_HID_BCD_NUM 0x0110
210
214#define HID_CLASS_DESC_HID 0x21
215#define HID_CLASS_DESC_REPORT 0x22
216#define HID_CLASS_DESC_PHYSICAL 0x23
217
221#define HID_REPORT_ID_1 0x01
222#define HID_REPORT_ID_2 0x02
223#define HID_REPORT_ID_3 0x03
224#define HID_REPORT_ID_4 0x04
225#define HID_REPORT_ID_5 0x05
226#define HID_REPORT_ID_6 0xF0
227
228#define MCU_ID1 (0x1FFFF7E8)
229#define MCU_ID2 (0x1FFFF7EC)
230#define MCU_ID3 (0x1FFFF7F0)
231
232
233#define SAMPLE_FREQ(frq) (uint8_t)(frq), (uint8_t)((frq >> 8)), (uint8_t)((frq >> 16))
234
235#define USBD_AUHID_HID_SIZ_REPORT_DESC 126
236#define USBD_AUHID_HID_DESC_SIZE 32
237#define USBD_AUHID_CONFIG_DESC_SIZE ( 0x12 + AUDIO_INTERFACE_LEN + \
238 + (0x31 + AUDIO_SPK_FREQ_SIZE * 3) \
239 + (0x31 + AUDIO_MIC_FREQ_SIZE * 3) \
240 + (9 * AUDIO_SUPPORT_FEEDBACK) \
241 + USBD_AUHID_HID_DESC_SIZE)
242
243extern uint8_t g_usbd_audio_hid_report[USBD_AUHID_HID_SIZ_REPORT_DESC];
244extern uint8_t g_audio_hid_usb_desc[9];
245
246extern usbd_desc_handler audio_hid_desc_handler;
247
259#ifdef __cplusplus
260}
261#endif
262
263#endif
264
audio_conf.h
usb audio config
audio_hid_class.h
USBD_AUHID_HID_SIZ_REPORT_DESC
#define USBD_AUHID_HID_SIZ_REPORT_DESC
Definition audio_hid_desc.h:235
audio_hid_desc_handler
usbd_desc_handler audio_hid_desc_handler
device descriptor handler structure
Definition audio_hid_desc.c:66
g_usbd_audio_hid_report
uint8_t g_usbd_audio_hid_report[126]
g_audio_hid_usb_desc
uint8_t g_audio_hid_usb_desc[9]
usbd_desc_handler
usb device descriptor handler
Definition usbd_core.h:75
usbd_core.h
usb device core header file


AT32F413 Firmwary Library: hid_iap_user.h Source File

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • bootloader
  • inc
bootloader/inc/hid_iap_user.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __HID_IAP_USER_H
28#define __HID_IAP_USER_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "hid_iap_class.h"
35
48#define FLASH_APP_ADDRESS 0x08006000
49
58void iap_init(void);
59 iap_result_type iap_get_upgrade_flag(void);
60void iap_loop(void);
61void jump_to_app(uint32_t address);
62
75#ifdef __cplusplus
76}
77#endif
78
79#endif
80
81
jump_to_app
iapfun jump_to_app
Definition bootloader/src/iap.c:45
iap_result_type
iap_result_type
Definition hid_iap_class.h:85
iap_init
void iap_init(void)
iap init.
Definition app_led3_toggle/src/iap.c:60
iap_get_upgrade_flag
iap_result_type iap_get_upgrade_flag(void)
get iap upgrade complete flag
Definition app_led3_toggle/src/hid_iap_user.c:78
iap_loop
void iap_loop(void)
iap loop
Definition bootloader/src/hid_iap_user.c:485
hid_iap_class.h
usb hid iap header file


AT32F413 Firmwary Library: iap.h Source File

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • bootloader
  • inc
bootloader/inc/iap.h
Go to the documentation of this file.
1
26#ifndef __IAP_H__
27#define __IAP_H__
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33#include "at32f413_board.h"
34
47/* app starting address */
48#define APP_START_ADDR 0x08004000
49
50/* the previous sector of app starting address is iap upgrade flag */
51#define IAP_UPGRADE_FLAG_ADDR (APP_START_ADDR - 0x800)
52
53/* when app received cmd 0x5aa5 from pc-tool, will set up the flag,
54indicates that an app upgrade will follow, see iap application note for more details */
55#define IAP_UPGRADE_FLAG 0x41544B38
56
68typedef struct
69{
70 uint8_t cmd_head;
71 uint8_t cmd_addr[4];
72 uint8_t cmd_buf[0x800];
73 uint8_t cmd_check;
74} cmd_data_group_type;
75
79typedef enum
80{
81 CMD_DATA_IDLE,
82 CMD_DATA_ADDR,
83 CMD_DATA_BUF,
84 CMD_DATA_CHACK,
85 CMD_DATA_DONE,
86 CMD_DATA_ERR,
87} cmd_data_step_type;
88
92typedef enum
93{
94 CMD_CTR_IDLE,
95 CMD_CTR_INIT,
96 CMD_CTR_DONE,
97 CMD_CTR_ERR,
98 CMD_CTR_APP,
99} cmd_ctr_step_type;
100
104typedef enum
105{
106 UPDATE_PRE,
107 UPDATE_CLEAR_FLAG,
108 UPDATE_ING,
109 UPDATE_DONE,
110} update_status_type;
111
112typedef void (*iapfun)(void);
113
118extern cmd_data_group_type cmd_data_group_type_struct;
119extern cmd_data_step_type cmd_data_step;
120extern cmd_ctr_step_type cmd_ctr_step;
121extern update_status_type update_status;
122
127void command_handle(void);
128void back_err(void);
129void back_ok(void);
130void iap_upgrade_app_handle(void);
131void app_load(uint32_t appxaddr);
132
145#ifdef __cplusplus
146}
147#endif
148
149#endif
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
update_status
update_status_type update_status
Definition bootloader/src/iap.c:42
cmd_data_group_type_struct
cmd_data_group_type cmd_data_group_type_struct
cmd_data_step
cmd_data_step_type cmd_data_step
Definition bootloader/src/iap.c:39
cmd_ctr_step
cmd_ctr_step_type cmd_ctr_step
Definition bootloader/src/iap.c:40
command_handle
void command_handle(void)
command analysis handle.
Definition bootloader/src/iap.c:112
iap_upgrade_app_handle
void iap_upgrade_app_handle(void)
iap upgrade app handle.
Definition bootloader/src/iap.c:350
app_load
void app_load(uint32_t appxaddr)
app load.
Definition bootloader/src/iap.c:66
back_err
void back_err(void)
command response error.
Definition app_led3_toggle/src/usart.c:119
back_ok
void back_ok(void)
command response ok.
Definition app_led3_toggle/src/usart.c:106
iapfun
void(* iapfun)(void)
Definition bootloader/inc/iap.h:112
update_status_type
update_status_type
update status type
Definition bootloader/inc/iap.h:105
cmd_ctr_step_type
cmd_ctr_step_type
cmd ctr step type
Definition bootloader/inc/iap.h:93
cmd_data_step_type
cmd_data_step_type
cmd data step type
Definition bootloader/inc/iap.h:80
UPDATE_PRE
@ UPDATE_PRE
Definition bootloader/inc/iap.h:106
UPDATE_DONE
@ UPDATE_DONE
Definition bootloader/inc/iap.h:109
UPDATE_ING
@ UPDATE_ING
Definition bootloader/inc/iap.h:108
UPDATE_CLEAR_FLAG
@ UPDATE_CLEAR_FLAG
Definition bootloader/inc/iap.h:107
CMD_CTR_ERR
@ CMD_CTR_ERR
Definition bootloader/inc/iap.h:97
CMD_CTR_DONE
@ CMD_CTR_DONE
Definition bootloader/inc/iap.h:96
CMD_CTR_INIT
@ CMD_CTR_INIT
Definition bootloader/inc/iap.h:95
CMD_CTR_APP
@ CMD_CTR_APP
Definition bootloader/inc/iap.h:98
CMD_CTR_IDLE
@ CMD_CTR_IDLE
Definition bootloader/inc/iap.h:94
CMD_DATA_DONE
@ CMD_DATA_DONE
Definition bootloader/inc/iap.h:85
CMD_DATA_ERR
@ CMD_DATA_ERR
Definition bootloader/inc/iap.h:86
CMD_DATA_BUF
@ CMD_DATA_BUF
Definition bootloader/inc/iap.h:83
CMD_DATA_IDLE
@ CMD_DATA_IDLE
Definition bootloader/inc/iap.h:81
CMD_DATA_CHACK
@ CMD_DATA_CHACK
Definition bootloader/inc/iap.h:84
CMD_DATA_ADDR
@ CMD_DATA_ADDR
Definition bootloader/inc/iap.h:82
cmd_data_group_type
cmd data group type
Definition bootloader/inc/iap.h:69
cmd_data_group_type::cmd_head
uint8_t cmd_head
Definition bootloader/inc/iap.h:70
cmd_data_group_type::cmd_check
uint8_t cmd_check
Definition bootloader/inc/iap.h:73


AT32F413 Firmwary Library: tmr.h Source File

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • bootloader
  • inc
bootloader/inc/tmr.h
Go to the documentation of this file.
1
26#ifndef __TMR_H
27#define __TMR_H
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33#include "at32f413_board.h"
34
35extern uint8_t time_ira_cnt;
36extern uint8_t get_data_from_usart_flag;
37
50void tmr_init(void);
51
64#ifdef __cplusplus
65}
66#endif
67
68#endif
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
time_ira_cnt
uint8_t time_ira_cnt
Definition bootloader/src/tmr.c:38
get_data_from_usart_flag
uint8_t get_data_from_usart_flag
Definition bootloader/src/tmr.c:39
tmr_init
void tmr_init(void)
init tmr.
Definition app_led3_toggle/src/tmr.c:43


AT32F413 Firmwary Library: usart.h Source File

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • bootloader
  • inc
bootloader/inc/usart.h
Go to the documentation of this file.
1
26#ifndef __USART_H
27#define __USART_H
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33#include "at32f413_board.h"
34
47#define USART_REC_LEN 1024
48
60typedef struct
61{
62 uint16_t buf[USART_REC_LEN];
63 uint16_t head;
64 uint16_t tail;
65 uint16_t count;
66} usart_group_type;
67
72extern usart_group_type usart_group_struct;
73
78void uart_init(uint32_t baudrate);
79
92#ifdef __cplusplus
93}
94#endif
95
96#endif
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
usart_group_struct
usart_group_type usart_group_struct
Definition bootloader/src/usart.c:37
USART_REC_LEN
#define USART_REC_LEN
Definition bootloader/inc/usart.h:47
uart_init
void uart_init(uint32_t baudrate)
init usart.
Definition app_led3_toggle/src/usart.c:44
usart_group_type
usart group type
Definition bootloader/inc/usart.h:61
usart_group_type::tail
uint16_t tail
Definition bootloader/inc/usart.h:64
usart_group_type::count
uint16_t count
Definition bootloader/inc/usart.h:65
usart_group_type::head
uint16_t head
Definition bootloader/inc/usart.h:63


AT32F413 Firmwary Library: hid_iap_user.c Source File

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • bootloader
  • src
bootloader/src/hid_iap_user.c
Go to the documentation of this file.
1
26#include "hid_iap_user.h"
27#include "hid_iap_class.h"
28#include "string.h"
29
38void (*pftarget)(void);
39void iap_clear_upgrade_flag(void);
40void iap_set_upgrade_flag(void);
41uint32_t crc_cal(uint32_t addr, uint16_t nk);
42
43void iap_idle(void);
44void iap_start(void);
45 iap_result_type iap_address(uint8_t *pdata, uint32_t len);
46void iap_finish(void);
47 iap_result_type iap_data_write(uint8_t *pdata, uint32_t len);
48void iap_jump(void);
49void iap_respond(uint8_t *res_buf, uint16_t iap_cmd, uint16_t result);
50uint32_t stkptr, jumpaddr;
51
52/* app_load don't optimize */
53#if defined (__ARMCC_VERSION)
54 #if (__ARMCC_VERSION >= 6010050)
55 __attribute__((optnone))
56 #else
57 #pragma O0
58 #endif
59#elif defined (__ICCARM__)
60 #pragma optimize=s none
61#elif defined (__GNUC__)
62 __attribute__((optimize("O0")))
63#endif
64
70void jump_to_app(uint32_t address)
71{
72 stkptr = *(uint32_t *)address;
73 jumpaddr = *(uint32_t *)(address + sizeof(uint32_t));
74
75 /* disable nvic irq and periph clock, clear pending */
76 nvic_irq_disable(USBFS_L_CAN1_RX0_IRQn);
77 __NVIC_ClearPendingIRQ(USBFS_L_CAN1_RX0_IRQn);
78 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, FALSE);
79 crm_periph_clock_enable(CRM_USB_PERIPH_CLOCK, FALSE);
80
81 crm_periph_reset(CRM_USB_PERIPH_RESET, TRUE);
82 crm_periph_reset(CRM_USB_PERIPH_RESET, FALSE);
83
84 __set_MSP(stkptr);
85 pftarget = (void (*) (void))jumpaddr;
86 pftarget();
87}
88
94void iap_clear_upgrade_flag(void)
95{
96 flash_unlock();
97 flash_sector_erase(iap_info.flag_address);
98 flash_lock();
99}
100
106void iap_set_upgrade_flag(void)
107{
108 flash_unlock();
109 flash_word_program(iap_info.flag_address, IAP_UPGRADE_COMPLETE_FLAG);
110 flash_lock();
111}
112
118 iap_result_type iap_get_upgrade_flag(void)
119{
120 uint32_t flag_address = iap_info.flag_address;
121 if(*((uint32_t *)flag_address) == IAP_UPGRADE_COMPLETE_FLAG)
122 {
123 return IAP_SUCCESS;
124 }
125 else
126 {
127 return IAP_FAILED;
128 }
129}
130
136void iap_erase_sector(uint32_t address)
137{
138 flash_unlock();
139 if(iap_info.sector_size == SECTOR_SIZE_1K)
140 {
141 flash_sector_erase(address);
142 }
143 else if(iap_info.sector_size == SECTOR_SIZE_2K)
144 {
145 /* check the address is sector align */
146 if((address & (SECTOR_SIZE_2K-1)) == 0)
147 {
148 flash_sector_erase(address);
149 }
150 }
151 else if(iap_info.sector_size == SECTOR_SIZE_4K)
152 {
153 if((address & (SECTOR_SIZE_4K-1)) == 0)
154 {
155 flash_sector_erase(address);
156 }
157 }
158 flash_lock();
159}
160
167uint32_t crc_cal(uint32_t addr, uint16_t nk)
168{
169 uint32_t *paddr = (uint32_t *)addr;
170 uint32_t wlen = nk * 1024 / sizeof(uint32_t);
171 uint32_t value, i_index = 0;
172 crm_periph_clock_enable(CRM_CRC_PERIPH_CLOCK, TRUE);
173 crc_data_reset();
174
175 for(i_index = 0; i_index < wlen; i_index ++)
176 {
177 value = *paddr;
178 crc_one_word_calculate(CONVERT_ENDIAN(value));
179 paddr ++;
180 }
181 return crc_data_get();
182}
183
189void iap_init(void)
190{
191 iap_info.flash_size = KB_TO_B(FLASH_SIZE_REG());
192 if(iap_info.flash_size < KB_TO_B(256))
193 {
194 iap_info.sector_size = SECTOR_SIZE_1K;
195 }
196 else
197 {
198 iap_info.sector_size = SECTOR_SIZE_2K;
199 }
200
201 iap_info.flash_start_address = FLASH_BASE;
202 iap_info.flash_end_address = iap_info.flash_start_address + iap_info.flash_size;
203
204 iap_info.app_address = FLASH_APP_ADDRESS;
205 iap_info.flag_address = iap_info.app_address - iap_info.sector_size;
206
207 iap_info.fifo_length = 0;
208 iap_info.iap_address = 0;
209}
210
216void iap_idle(void)
217{
218 iap_info.state = IAP_STS_START;
219 iap_init();
220 iap_respond(iap_info.iap_tx, IAP_CMD_IDLE, IAP_ACK);
221}
222
228void iap_start(void)
229{
230 iap_info.state = IAP_STS_START;
231 iap_init();
232 iap_respond(iap_info.iap_tx, IAP_CMD_START, IAP_ACK);
233}
234
241 iap_result_type iap_address(uint8_t *pdata, uint32_t len)
242{
243 iap_result_type status = IAP_SUCCESS;
244 uint16_t result = IAP_ACK;
245 uint8_t *paddr = pdata + 2; /* skip iap cmd */
246 uint32_t address;
247
248 address = (paddr[0] << 24) |
249 (paddr[1] << 16) |
250 (paddr[2] << 8) |
251 paddr[3];
252
253 /* check the address is valid */
254 if(address < iap_info.app_address || address > iap_info.flash_end_address)
255 {
256 status = IAP_FAILED;
257 result = IAP_NACK;
258 }
259 else
260 {
261 iap_info.iap_address = address;
262
263 if(iap_info.state == IAP_STS_START)
264 {
265 iap_clear_upgrade_flag();
266 }
267 iap_erase_sector(iap_info.iap_address);
268 }
269
270 iap_info.state = IAP_STS_ADDR;
271
272 iap_respond(iap_info.iap_tx, IAP_CMD_ADDR, result);
273
274 return status;
275}
276/*
277 * @brief iap data write
278 * @param pdata: data buffer pointer.
279 * @param len: buffer length
280 * @retval the result of the address parse
281 */
282 iap_result_type iap_data_write(uint8_t *pdata, uint32_t len)
283{
284 uint32_t data_len = (pdata[2] << 8 | pdata[3]);
285 uint8_t *valid_data = pdata + 4;
286 uint32_t *pbuf;
287 uint32_t i_index = 0;
288
289 if(iap_info.state == IAP_STS_ADDR)
290 {
291 if(data_len + iap_info.fifo_length <= HID_IAP_BUFFER_LEN)
292 {
293 for(i_index = 0; i_index < data_len; i_index ++)
294 {
295 iap_info.iap_fifo[iap_info.fifo_length ++] = valid_data[i_index];
296 }
297 }
298 /* buffer full */
299 if(iap_info.fifo_length == HID_IAP_BUFFER_LEN)
300 {
301 flash_unlock();
302 pbuf = (uint32_t *)iap_info.iap_fifo;
303 for(i_index = 0; i_index < iap_info.fifo_length / sizeof(uint32_t); i_index ++)
304 {
305 flash_word_program(iap_info.iap_address, *pbuf ++);
306 iap_info.iap_address += 4;
307 }
308 flash_lock();
309
310 iap_info.fifo_length = 0;
311 iap_info.iap_address = 0;
312 iap_respond(iap_info.iap_tx, IAP_CMD_DATA, IAP_ACK);
313 }
314 }
315 else
316 {
317 iap_respond(iap_info.iap_tx, IAP_CMD_DATA, IAP_NACK);
318 }
319 return IAP_SUCCESS;
320}
321
322/*
323 * @brief iap finish
324 * @param none
325 * @retval none
326 */
327void iap_finish()
328{
329 iap_info.state = IAP_STS_FINISH;
330 iap_set_upgrade_flag();
331 iap_respond(iap_info.iap_tx, IAP_CMD_FINISH, IAP_ACK);
332}
333
334/*
335 * @brief iap crc
336 * @param pdata: data buffer pointer.
337 * @param len: buffer length
338 * @retval the result of the address parse
339 */
340void iap_crc(uint8_t *pdata, uint32_t len)
341{
342 uint8_t *paddr = pdata + 2; /* skip iap cmd */
343 uint16_t crc_nk;
344 uint32_t crc_value;
345 uint32_t address = (paddr[0] << 24) |
346 (paddr[1] << 16) |
347 (paddr[2] << 8) |
348 paddr[3];
349 paddr = pdata + 6;
350
351 crc_nk = (paddr[0] << 16) | paddr[1];
352
353 crc_value = crc_cal(address, crc_nk);
354
355 iap_respond(iap_info.iap_tx, IAP_CMD_CRC, IAP_ACK);
356 iap_info.iap_tx[4] = (uint8_t)((crc_value >> 24) & 0xFF);
357 iap_info.iap_tx[5] = (uint8_t)((crc_value >> 16) & 0xFF);
358 iap_info.iap_tx[6] = (uint8_t)((crc_value >> 8) & 0xFF);
359 iap_info.iap_tx[7] = (uint8_t)((crc_value) & 0xFF);
360
361}
362
363/*
364 * @brief iap jump
365 * @param none
366 * @retval none
367 */
368void iap_jump()
369{
370 iap_info.state = IAP_STS_JMP_WAIT;
371 iap_respond(iap_info.iap_tx, IAP_CMD_JMP, IAP_ACK);
372}
373
374/*
375 * @brief iap get
376 * @param none
377 * @retval none
378 */
379void iap_get()
380{
381 iap_respond(iap_info.iap_tx, IAP_CMD_GET, IAP_ACK);
382 iap_info.iap_tx[4] = (uint8_t)((iap_info.app_address >> 24) & 0xFF);
383 iap_info.iap_tx[5] = (uint8_t)((iap_info.app_address >> 16) & 0xFF);
384 iap_info.iap_tx[6] = (uint8_t)((iap_info.app_address >> 8) & 0xFF);
385 iap_info.iap_tx[7] = (uint8_t)((iap_info.app_address) & 0xFF);
386}
387
388
389
390/*
391 * @brief iap respond
392 * @param res_buf: data buffer pointer.
393 * @param iap_cmd: iap command
394 * @param result: iap result
395 * @retval the result of the address parse
396 */
397void iap_respond(uint8_t *res_buf, uint16_t iap_cmd, uint16_t result)
398{
399 res_buf[0] = (uint8_t)((iap_cmd >> 8) & 0xFF);
400 res_buf[1] = (uint8_t)((iap_cmd) & 0xFF);
401 res_buf[2] = (uint8_t)((result >> 8) & 0xFF);
402 res_buf[3] = (uint8_t)((result) & 0xFF);
403
404 iap_info.respond_flag = 1;
405}
406
414 iap_result_type usbd_hid_iap_process(void *udev, uint8_t *pdata, uint16_t len)
415{
416 iap_result_type status = IAP_SUCCESS;
417 uint16_t iap_cmd;
418
419 if(len < 2)
420 {
421 return IAP_FAILED;
422 }
423
424 iap_info.respond_flag = 0;
425
426 iap_cmd = (pdata[0] << 8) | pdata[1];
427
428 switch(iap_cmd)
429 {
430 case IAP_CMD_IDLE:
431 iap_idle();
432 break;
433 case IAP_CMD_START:
434 iap_start();
435 break;
436 case IAP_CMD_ADDR:
437 iap_address(pdata, len);
438 break;
439 case IAP_CMD_DATA:
440 iap_data_write(pdata, len);
441 break;
442 case IAP_CMD_FINISH:
443 iap_finish();
444 break;
445 case IAP_CMD_CRC:
446 iap_crc(pdata, len);
447 break;
448 case IAP_CMD_JMP:
449 iap_jump();
450 break;
451 case IAP_CMD_GET:
452 iap_get();
453 break;
454 default:
455 status = IAP_FAILED;
456 break;
457 }
458
459 if(iap_info.respond_flag)
460 {
461 usb_iap_class_send_report(udev, iap_info.iap_tx, 64);
462 }
463
464 return status;
465}
466
472void usbd_hid_iap_in_complete(void *udev)
473{
474 if(iap_info.state == IAP_STS_JMP_WAIT)
475 {
476 iap_info.state = IAP_STS_JMP;
477 }
478}
479
485void iap_loop(void)
486{
487 if(iap_info.state == IAP_STS_JMP)
488 {
489 delay_ms(100);
490 jump_to_app(iap_info.app_address);
491 }
492}
493
crc_value
__IO uint32_t crc_value
Definition project/at_start_f413/examples/crc/calculation/src/main.c:63
SECTOR_SIZE_1K
#define SECTOR_SIZE_1K
Definition composite_vcp_msc/inc/msc_diskio.h:50
SECTOR_SIZE_2K
#define SECTOR_SIZE_2K
Definition composite_vcp_msc/inc/msc_diskio.h:51
SECTOR_SIZE_4K
#define SECTOR_SIZE_4K
Definition composite_vcp_msc/inc/msc_diskio.h:52
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
crc_data_reset
void crc_data_reset(void)
reset the crc data register.
Definition at32f413_crc.c:48
crc_data_get
uint32_t crc_data_get(void)
return the current crc value.
Definition at32f413_crc.c:88
crc_one_word_calculate
uint32_t crc_one_word_calculate(uint32_t data)
compute the 32-bit crc of a given data word(32-bit).
Definition at32f413_crc.c:59
crm_periph_reset
void crm_periph_reset(crm_periph_reset_type value, confirm_state new_state)
enable or disable the peripheral reset
Definition at32f413_crm.c:293
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_USB_PERIPH_CLOCK
@ CRM_USB_PERIPH_CLOCK
Definition at32f413_crm.h:137
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_CRC_PERIPH_CLOCK
@ CRM_CRC_PERIPH_CLOCK
Definition at32f413_crm.h:105
CRM_USB_PERIPH_RESET
@ CRM_USB_PERIPH_RESET
Definition at32f413_crm.h:181
USBFS_L_CAN1_RX0_IRQn
@ USBFS_L_CAN1_RX0_IRQn
Definition at32f413.h:192
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
flash_sector_erase
flash_status_type flash_sector_erase(uint32_t sector_address)
erase a specified flash sector.
Definition at32f413_flash.c:272
flash_unlock
void flash_unlock(void)
unlock the flash controller.
Definition at32f413_flash.c:228
flash_word_program
flash_status_type flash_word_program(uint32_t address, uint32_t data)
program a word at a specified address.
Definition at32f413_flash.c:414
flash_lock
void flash_lock(void)
lock the flash controller.
Definition at32f413_flash.c:251
nvic_irq_disable
void nvic_irq_disable(IRQn_Type irqn)
disable nvic irq number
Definition at32f413_misc.c:80
FLASH_BASE
#define FLASH_BASE
Definition at32f413.h:329
jump_to_app
iapfun jump_to_app
Definition bootloader/src/iap.c:45
IAP_FAILED
#define IAP_FAILED
Definition flash_fat16.h:77
IAP_SUCCESS
#define IAP_SUCCESS
Definition flash_fat16.h:76
IAP_UPGRADE_COMPLETE_FLAG
#define IAP_UPGRADE_COMPLETE_FLAG
Definition flash_fat16.h:75
HID_IAP_BUFFER_LEN
#define HID_IAP_BUFFER_LEN
Definition hid_iap_class.h:76
IAP_CMD_DATA
#define IAP_CMD_DATA
Definition hid_iap_class.h:70
IAP_CMD_FINISH
#define IAP_CMD_FINISH
Definition hid_iap_class.h:71
IAP_CMD_IDLE
#define IAP_CMD_IDLE
iap command
Definition hid_iap_class.h:67
IAP_CMD_GET
#define IAP_CMD_GET
Definition hid_iap_class.h:74
iap_result_type
iap_result_type
Definition hid_iap_class.h:85
IAP_NACK
#define IAP_NACK
Definition hid_iap_class.h:82
IAP_ACK
#define IAP_ACK
Definition hid_iap_class.h:81
IAP_CMD_CRC
#define IAP_CMD_CRC
Definition hid_iap_class.h:72
CONVERT_ENDIAN
#define CONVERT_ENDIAN(dwValue)
Definition hid_iap_class.h:78
IAP_CMD_ADDR
#define IAP_CMD_ADDR
Definition hid_iap_class.h:69
FLASH_SIZE_REG
#define FLASH_SIZE_REG()
Definition hid_iap_class.h:57
IAP_CMD_START
#define IAP_CMD_START
Definition hid_iap_class.h:68
IAP_CMD_JMP
#define IAP_CMD_JMP
Definition hid_iap_class.h:73
KB_TO_B
#define KB_TO_B(kb)
Definition hid_iap_class.h:58
IAP_STS_START
@ IAP_STS_START
Definition hid_iap_class.h:94
IAP_STS_JMP
@ IAP_STS_JMP
Definition hid_iap_class.h:100
IAP_STS_JMP_WAIT
@ IAP_STS_JMP_WAIT
Definition hid_iap_class.h:99
IAP_STS_FINISH
@ IAP_STS_FINISH
Definition hid_iap_class.h:97
IAP_STS_ADDR
@ IAP_STS_ADDR
Definition hid_iap_class.h:95
iap_info
iap_info_type iap_info
Definition hid_iap_class.c:53
usb_iap_class_send_report
usb_sts_type usb_iap_class_send_report(void *udev, uint8_t *report, uint16_t len)
usb device class send report
Definition hid_iap_class.c:325
stkptr
uint32_t stkptr
Definition bootloader/src/hid_iap_user.c:50
iap_set_upgrade_flag
void iap_set_upgrade_flag(void)
set iap upgrade complete flag
Definition bootloader/src/hid_iap_user.c:106
iap_idle
void iap_idle(void)
iap idle function
Definition bootloader/src/hid_iap_user.c:216
iap_respond
void iap_respond(uint8_t *res_buf, uint16_t iap_cmd, uint16_t result)
Definition bootloader/src/hid_iap_user.c:397
iap_data_write
iap_result_type iap_data_write(uint8_t *pdata, uint32_t len)
Definition bootloader/src/hid_iap_user.c:282
iap_init
void iap_init(void)
iap init
Definition bootloader/src/hid_iap_user.c:189
usbd_hid_iap_process
iap_result_type usbd_hid_iap_process(void *udev, uint8_t *pdata, uint16_t len)
usb device iap function
Definition bootloader/src/hid_iap_user.c:414
crc_cal
uint32_t crc_cal(uint32_t addr, uint16_t nk)
crc cal
Definition bootloader/src/hid_iap_user.c:167
iap_get_upgrade_flag
iap_result_type iap_get_upgrade_flag(void)
get iap upgrade complete flag
Definition bootloader/src/hid_iap_user.c:118
iap_address
iap_result_type iap_address(uint8_t *pdata, uint32_t len)
iap parse address
Definition bootloader/src/hid_iap_user.c:241
iap_finish
void iap_finish(void)
Definition bootloader/src/hid_iap_user.c:327
iap_loop
void iap_loop(void)
iap loop
Definition bootloader/src/hid_iap_user.c:485
iap_start
void iap_start(void)
iap start function
Definition bootloader/src/hid_iap_user.c:228
iap_crc
void iap_crc(uint8_t *pdata, uint32_t len)
Definition bootloader/src/hid_iap_user.c:340
pftarget
void(* pftarget)(void)
Definition bootloader/src/hid_iap_user.c:38
iap_erase_sector
void iap_erase_sector(uint32_t address)
set iap upgrade complete flag
Definition bootloader/src/hid_iap_user.c:136
iap_clear_upgrade_flag
void iap_clear_upgrade_flag(void)
clear iap upgrade flag
Definition bootloader/src/hid_iap_user.c:94
iap_get
void iap_get()
Definition bootloader/src/hid_iap_user.c:379
jumpaddr
uint32_t jumpaddr
Definition bootloader/src/hid_iap_user.c:50
iap_jump
void iap_jump(void)
Definition bootloader/src/hid_iap_user.c:368
usbd_hid_iap_in_complete
void usbd_hid_iap_in_complete(void *udev)
usb device in transfer complete function
Definition bootloader/src/hid_iap_user.c:472
FLASH_APP_ADDRESS
#define FLASH_APP_ADDRESS
Definition app_led3_toggle/inc/hid_iap_user.h:48
hid_iap_class.h
usb hid iap header file
iap_info_type::respond_flag
uint32_t respond_flag
Definition hid_iap_class.h:123
iap_info_type::flag_address
uint32_t flag_address
Definition hid_iap_class.h:115
iap_info_type::sector_size
uint32_t sector_size
Definition hid_iap_class.h:120
iap_info_type::iap_address
uint32_t iap_address
Definition hid_iap_class.h:114
iap_info_type::flash_start_address
uint32_t flash_start_address
Definition hid_iap_class.h:117
iap_info_type::flash_end_address
uint32_t flash_end_address
Definition hid_iap_class.h:118
iap_info_type::fifo_length
uint32_t fifo_length
Definition hid_iap_class.h:110
iap_info_type::iap_fifo
uint8_t iap_fifo[1024]
Definition hid_iap_class.h:106
iap_info_type::flash_size
uint32_t flash_size
Definition hid_iap_class.h:121
iap_info_type::iap_tx
uint8_t iap_tx[0x40]
Definition hid_iap_class.h:108
iap_info_type::app_address
uint32_t app_address
Definition hid_iap_class.h:113
iap_info_type::state
iap_machine_state_type state
Definition hid_iap_class.h:132


AT32F413 Firmwary Library: iap.c Source File

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • bootloader
  • src
bootloader/src/iap.c
Go to the documentation of this file.
1
26#include "iap.h"
27#include "usart.h"
28#include "flash.h"
29#include "tmr.h"
30
39 cmd_data_step_type cmd_data_step = CMD_DATA_IDLE;
40 cmd_ctr_step_type cmd_ctr_step = CMD_CTR_IDLE;
41 cmd_data_group_type cmd_data_group_struct;
42 update_status_type update_status = UPDATE_PRE;
43static uint8_t cmd_addr_cnt = 0;
44static uint32_t cmd_data_cnt = 0;
45 iapfun jump_to_app;
46
47/* app_load don't optimize */
48#if defined (__ARMCC_VERSION)
49 #if (__ARMCC_VERSION >= 6010050)
50 __attribute__((optnone))
51 #else
52 #pragma O0
53 #endif
54#elif defined (__ICCARM__)
55 #pragma optimize=s none
56#elif defined (__GNUC__)
57 __attribute__((optimize("O0")))
58#endif
59
66void app_load(uint32_t app_addr)
67{
68 /* check the address of stack */
69 if(((*(uint32_t*)app_addr) - 0x20000000) <= (SRAM_SIZE * 1024))
70 {
71 /* disable periph clock */
72 crm_periph_clock_enable(CRM_TMR3_PERIPH_CLOCK, FALSE);
73 crm_periph_clock_enable(CRM_USART1_PERIPH_CLOCK, FALSE);
74 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, FALSE);
75
76 /* disable nvic irq and clear pending */
77 nvic_irq_disable(USART1_IRQn);
78 nvic_irq_disable(TMR3_GLOBAL_IRQn);
79 __NVIC_ClearPendingIRQ(USART1_IRQn);
80 __NVIC_ClearPendingIRQ(TMR3_GLOBAL_IRQn);
81
82 jump_to_app = (iapfun)*(uint32_t*)(app_addr + 4); /* code second word is reset address */
83 __set_MSP(*(uint32_t*)app_addr); /* init app stack pointer(code first word is stack address) */
84 jump_to_app(); /* jump to user app */
85 }
86}
87
95uint8_t data_take(void)
96{
97 uint8_t val;
98 usart_interrupt_enable(USART1, USART_RDBF_INT, FALSE);
99 usart_group_struct.count--;
100 usart_interrupt_enable(USART1, USART_RDBF_INT, TRUE);
101 val = usart_group_struct.buf[usart_group_struct.tail++];
102 if(usart_group_struct.tail > (USART_REC_LEN-1))
103 usart_group_struct.tail = 0;
104 return val;
105}
106
112void command_handle(void)
113{
114 uint8_t val, checksum;
115 uint16_t index;
116 /* check whether received usart data */
117 if(usart_group_struct.count > 0)
118 val = data_take();
119 else
120 return;
121
122 if(update_status == UPDATE_PRE)
123 {
124 if(cmd_ctr_step == CMD_CTR_IDLE)
125 {
126 if(val == 0x5A)
127 cmd_ctr_step = CMD_CTR_INIT;
128 }
129 else if(cmd_ctr_step == CMD_CTR_INIT)
130 {
131 if(val == 0x01)
132 {
133 cmd_ctr_step = CMD_CTR_DONE;
134 }
135 else if(val == 0xA5)
136 {
137 cmd_ctr_step = CMD_CTR_APP;
138 }
139 else
140 {
141 cmd_ctr_step = CMD_CTR_ERR;
142 }
143 }
144 }
145 else if(update_status == UPDATE_ING)
146 {
147 switch(cmd_data_step)
148 {
149 case CMD_DATA_IDLE:
150 if(val == 0x31)
151 {
152 cmd_data_step = CMD_DATA_ADDR;
153 cmd_addr_cnt = 0;
154 cmd_data_cnt = 0;
155 }
156 if(val == 0x5A)
157 {
158 if(cmd_ctr_step == CMD_CTR_IDLE)
159 {
160 cmd_ctr_step = CMD_CTR_INIT;
161 update_status = UPDATE_DONE;
162 }
163 }
164 break;
165 case CMD_DATA_ADDR:
166 cmd_data_group_struct.cmd_addr[cmd_addr_cnt] = val;
167 cmd_addr_cnt++;
168 if(cmd_addr_cnt >= 4)
169 {
170 cmd_addr_cnt = 0;
171 cmd_data_step = CMD_DATA_BUF;
172 }
173 break;
174 case CMD_DATA_BUF:
175 cmd_data_group_struct.cmd_buf[cmd_data_cnt] = val;
176 cmd_data_cnt++;
177 if(cmd_data_cnt >= 2048)
178 {
179 cmd_data_cnt = 0;
180 cmd_data_step = CMD_DATA_CHACK;
181 }
182 break;
183 case CMD_DATA_CHACK:
184 checksum = 0;
185 for(index = 0;index < 4;index++)
186 {
187 checksum += cmd_data_group_struct.cmd_addr[index];
188 }
189 for(index = 0;index < 0x800; index++)
190 {
191 checksum += cmd_data_group_struct.cmd_buf[index];
192 }
193 if(checksum == val)
194 {
195 cmd_data_step = CMD_DATA_DONE;
196 }
197 else
198 {
199 cmd_data_step = CMD_DATA_ERR;
200 }
201 break;
202 default:
203 break;
204 }
205 }
206 else if(update_status == UPDATE_DONE)
207 {
208 if(cmd_ctr_step == CMD_CTR_IDLE)
209 {
210 if(val == 0x5A)
211 {
212 cmd_ctr_step = CMD_CTR_INIT;
213 }
214 }
215 else if(cmd_ctr_step == CMD_CTR_INIT)
216 {
217 if(val == 0x02)
218 {
219 cmd_ctr_step = CMD_CTR_DONE;
220 }
221 else
222 {
223 cmd_ctr_step = CMD_CTR_ERR;
224 }
225 }
226 }
227}
228
234void back_ok(void)
235{
236 usart_data_transmit(USART1, 0xCC);
237 while(usart_flag_get(USART1, USART_TDC_FLAG) == RESET);
238 usart_data_transmit(USART1, 0xDD);
239 while(usart_flag_get(USART1, USART_TDC_FLAG) == RESET);
240}
241
247void back_err(void)
248{
249 usart_data_transmit(USART1, 0xEE);
250 while(usart_flag_get(USART1, USART_TDC_FLAG) == RESET);
251 usart_data_transmit(USART1, 0xFF);
252 while(usart_flag_get(USART1, USART_TDC_FLAG) == RESET);
253 /* reset state machine of udgrade flow */
254 cmd_data_step = CMD_DATA_IDLE;
255 cmd_ctr_step = CMD_CTR_IDLE;
256 update_status = UPDATE_PRE;
257 cmd_addr_cnt = 0;
258 cmd_data_cnt = 0;
259 time_ira_cnt = 0;
260 get_data_from_usart_flag = 0;
261}
262
268void app_update_handle(void)
269{
270 uint32_t write_addr=0;
271 if(update_status == UPDATE_PRE)
272 {
273 if(cmd_ctr_step == CMD_CTR_DONE)
274 {
275 cmd_ctr_step = CMD_CTR_IDLE;
276 update_status = UPDATE_CLEAR_FLAG;
277 }
278 else if(cmd_ctr_step == CMD_CTR_APP)
279 {
280 cmd_ctr_step = CMD_CTR_IDLE;
281 back_ok();
282 }
283 else if(cmd_ctr_step == CMD_CTR_ERR)
284 {
285 cmd_ctr_step = CMD_CTR_IDLE;
286 back_err();
287 }
288 }
289 else if(update_status == UPDATE_CLEAR_FLAG)
290 {
291 get_data_from_usart_flag = 1;
292 update_status = UPDATE_ING;
293 back_ok();
294 }
295 else if(update_status == UPDATE_ING)
296 {
297 if(cmd_data_step == CMD_DATA_DONE)
298 {
299 write_addr = (cmd_data_group_struct.cmd_addr[0] << 24) + (cmd_data_group_struct.cmd_addr[1] << 16) + \
300 (cmd_data_group_struct.cmd_addr[2] << 8) + cmd_data_group_struct.cmd_addr[3];
301 if((write_addr >= APP_START_ADDR) && (write_addr < FLASH_BASE + 1024 * FLASH_SIZE))
302 {
303 flash_2kb_write(write_addr, cmd_data_group_struct.cmd_buf);
304 cmd_data_step = CMD_DATA_IDLE;
305 back_ok();
306 }
307 else
308 {
309 cmd_data_step = CMD_DATA_IDLE;
310 back_err();
311 }
312 }
313 else if(cmd_data_step == CMD_DATA_ERR)
314 {
315 cmd_data_step = CMD_DATA_IDLE;
316 back_err();
317 }
318 }
319 else if(update_status == UPDATE_DONE)
320 {
321 if(cmd_ctr_step == CMD_CTR_DONE)
322 {
323 cmd_ctr_step = CMD_CTR_IDLE;
324 back_ok();
325 /* check app starting address whether 0x08xxxxxx */
326 if(((*(uint32_t*)(APP_START_ADDR + 4)) & 0xFF000000) == 0x08000000)
327 {
328 crm_reset();
329 /* jump and run in app */
330 app_load(APP_START_ADDR);
331 }
332 else
333 {
334 cmd_ctr_step = CMD_CTR_ERR;
335 }
336 }
337 else if(cmd_ctr_step == CMD_CTR_ERR)
338 {
339 cmd_ctr_step = CMD_CTR_IDLE;
340 back_err();
341 }
342 }
343}
344
350void iap_upgrade_app_handle(void)
351{
352 command_handle();
353 app_update_handle();
354}
355
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_TMR3_PERIPH_CLOCK
@ CRM_TMR3_PERIPH_CLOCK
Definition at32f413_crm.h:126
CRM_USART1_PERIPH_CLOCK
@ CRM_USART1_PERIPH_CLOCK
Definition at32f413_crm.h:119
TMR3_GLOBAL_IRQn
@ TMR3_GLOBAL_IRQn
Definition at32f413.h:201
USART1_IRQn
@ USART1_IRQn
Definition at32f413.h:209
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
nvic_irq_disable
void nvic_irq_disable(IRQn_Type irqn)
disable nvic irq number
Definition at32f413_misc.c:80
FLASH_BASE
#define FLASH_BASE
Definition at32f413.h:329
usart_data_transmit
void usart_data_transmit(usart_type *usart_x, uint16_t data)
transmit single data through the usart peripheral.
Definition at32f413_usart.c:380
usart_flag_get
flag_status usart_flag_get(usart_type *usart_x, uint32_t flag)
check whether the specified usart flag is set or not.
Definition at32f413_usart.c:565
usart_interrupt_enable
void usart_interrupt_enable(usart_type *usart_x, uint32_t usart_int, confirm_state new_state)
enable or disable the specified usart interrupts.
Definition at32f413_usart.c:263
USART_TDC_FLAG
#define USART_TDC_FLAG
Definition at32f413_usart.h:57
cmd_addr_cnt
static uint8_t cmd_addr_cnt
Definition bootloader/src/iap.c:43
app_update_handle
void app_update_handle(void)
app update flow handle.
Definition bootloader/src/iap.c:268
data_take
uint8_t data_take(void)
take data from usart buf.
Definition bootloader/src/iap.c:95
command_handle
void command_handle(void)
command analysis handle.
Definition bootloader/src/iap.c:112
update_status
update_status_type update_status
Definition bootloader/src/iap.c:42
iap_upgrade_app_handle
void iap_upgrade_app_handle(void)
iap upgrade app handle.
Definition bootloader/src/iap.c:350
cmd_data_group_struct
cmd_data_group_type cmd_data_group_struct
Definition bootloader/src/iap.c:41
time_ira_cnt
uint8_t time_ira_cnt
Definition bootloader/src/tmr.c:38
jump_to_app
iapfun jump_to_app
Definition bootloader/src/iap.c:45
cmd_data_cnt
static uint32_t cmd_data_cnt
Definition bootloader/src/iap.c:44
get_data_from_usart_flag
uint8_t get_data_from_usart_flag
Definition bootloader/src/tmr.c:39
cmd_data_step
cmd_data_step_type cmd_data_step
Definition bootloader/src/iap.c:39
app_load
void app_load(uint32_t app_addr)
app load.
Definition bootloader/src/iap.c:66
cmd_ctr_step
cmd_ctr_step_type cmd_ctr_step
Definition bootloader/src/iap.c:40
back_err
void back_err(void)
command response error.
Definition bootloader/src/iap.c:247
usart_group_struct
usart_group_type usart_group_struct
Definition bootloader/src/usart.c:37
back_ok
void back_ok(void)
command response ok.
Definition bootloader/src/iap.c:234
USART_RDBF_INT
#define USART_RDBF_INT
Definition at32f413_usart.h:72
USART1
#define USART1
Definition at32f413_usart.h:318
APP_START_ADDR
#define APP_START_ADDR
Definition app_led3_toggle/inc/iap.h:48
SRAM_SIZE
#define SRAM_SIZE
Definition utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/flash.h:48
USART_REC_LEN
#define USART_REC_LEN
Definition bootloader/inc/usart.h:47
FLASH_SIZE
#define FLASH_SIZE
Definition utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/flash.h:47
flash_2kb_write
void flash_2kb_write(uint32_t write_addr, uint8_t *pbuffer)
flash erase/program operation.
Definition utilities/at32f413_usart_iap_demo/source_code/bootloader/src/flash.c:44
iapfun
void(* iapfun)(void)
Definition bootloader/inc/iap.h:112
update_status_type
update_status_type
update status type
Definition bootloader/inc/iap.h:105
cmd_ctr_step_type
cmd_ctr_step_type
cmd ctr step type
Definition bootloader/inc/iap.h:93
cmd_data_step_type
cmd_data_step_type
cmd data step type
Definition bootloader/inc/iap.h:80
UPDATE_PRE
@ UPDATE_PRE
Definition bootloader/inc/iap.h:106
UPDATE_DONE
@ UPDATE_DONE
Definition bootloader/inc/iap.h:109
UPDATE_ING
@ UPDATE_ING
Definition bootloader/inc/iap.h:108
UPDATE_CLEAR_FLAG
@ UPDATE_CLEAR_FLAG
Definition bootloader/inc/iap.h:107
CMD_CTR_ERR
@ CMD_CTR_ERR
Definition bootloader/inc/iap.h:97
CMD_CTR_DONE
@ CMD_CTR_DONE
Definition bootloader/inc/iap.h:96
CMD_CTR_INIT
@ CMD_CTR_INIT
Definition bootloader/inc/iap.h:95
CMD_CTR_APP
@ CMD_CTR_APP
Definition bootloader/inc/iap.h:98
CMD_CTR_IDLE
@ CMD_CTR_IDLE
Definition bootloader/inc/iap.h:94
CMD_DATA_DONE
@ CMD_DATA_DONE
Definition bootloader/inc/iap.h:85
CMD_DATA_ERR
@ CMD_DATA_ERR
Definition bootloader/inc/iap.h:86
CMD_DATA_BUF
@ CMD_DATA_BUF
Definition bootloader/inc/iap.h:83
CMD_DATA_IDLE
@ CMD_DATA_IDLE
Definition bootloader/inc/iap.h:81
CMD_DATA_CHACK
@ CMD_DATA_CHACK
Definition bootloader/inc/iap.h:84
CMD_DATA_ADDR
@ CMD_DATA_ADDR
Definition bootloader/inc/iap.h:82
cmd_data_group_type
cmd data group type
Definition bootloader/inc/iap.h:69
cmd_data_group_type::cmd_addr
uint8_t cmd_addr[4]
Definition bootloader/inc/iap.h:71
cmd_data_group_type::cmd_buf
uint8_t cmd_buf[0x800]
Definition bootloader/inc/iap.h:72
usart_group_type::tail
uint16_t tail
Definition bootloader/inc/usart.h:64
usart_group_type::buf
uint16_t buf[1024]
Definition bootloader/inc/usart.h:62
usart_group_type::count
uint16_t count
Definition bootloader/inc/usart.h:65


AT32F413 Firmwary Library: tmr.c Source File

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • bootloader
  • src
bootloader/src/tmr.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "tmr.h"
28#include "iap.h"
29
38uint8_t time_ira_cnt=0;
39uint8_t get_data_from_usart_flag = 0; /* flag for timer out in upgrade flow */
40
46void tmr_init(void)
47{
48 crm_clocks_freq_type crm_clocks_freq_struct = {0};
49
50 crm_periph_clock_enable(CRM_TMR3_PERIPH_CLOCK, TRUE);
51
52 /* enable the tmr3 global interrupt */
53 nvic_irq_enable(TMR3_GLOBAL_IRQn, 1, 0);
54
55 /* get system clock */
56 crm_clocks_freq_get(&crm_clocks_freq_struct);
57
58 /* time base configuration */
59 tmr_base_init(TMR3, 10000, crm_clocks_freq_struct.ahb_freq / 10000);
60 tmr_cnt_dir_set(TMR3, TMR_COUNT_UP);
61
62 /* overflow interrupt enable */
63 tmr_interrupt_enable(TMR3, TMR_OVF_INT, TRUE);
64
65 /* enable tmr */
66 tmr_counter_enable(TMR3, TRUE);
67}
68
74void TMR3_GLOBAL_IRQHandler(void)
75{
76 if(tmr_interrupt_flag_get(TMR3, TMR_OVF_FLAG) == SET)
77 {
78 tmr_flag_clear(TMR3, TMR_OVF_FLAG);
79 at32_led_toggle(LED2);
80 if(get_data_from_usart_flag)
81 {
82 if((++time_ira_cnt) == 0x00)
83 time_ira_cnt = 0xFF;
84 if(time_ira_cnt > 2)
85 back_err();
86 if(time_ira_cnt > 5)
87 crm_periph_clock_enable(LED2_GPIO_CRM_CLK, FALSE);
88 }
89 }
90}
91
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
crm_clocks_freq_struct
crm_clocks_freq_type crm_clocks_freq_struct
Definition project/at_start_f413/examples/debug/tmr1/src/main.c:38
LED2
@ LED2
Definition at32f413_board.h:62
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_clocks_freq_get
void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
Definition at32f413_crm.c:660
CRM_TMR3_PERIPH_CLOCK
@ CRM_TMR3_PERIPH_CLOCK
Definition at32f413_crm.h:126
TMR3_GLOBAL_IRQn
@ TMR3_GLOBAL_IRQn
Definition at32f413.h:201
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
tmr_flag_clear
void tmr_flag_clear(tmr_type *tmr_x, uint32_t tmr_flag)
clear tmr flag
Definition at32f413_tmr.c:1433
tmr_counter_enable
void tmr_counter_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr counter
Definition at32f413_tmr.c:114
tmr_interrupt_flag_get
flag_status tmr_interrupt_flag_get(tmr_type *tmr_x, uint32_t tmr_flag)
get tmr interrupt flag
Definition at32f413_tmr.c:1357
tmr_base_init
void tmr_base_init(tmr_type *tmr_x, uint32_t tmr_pr, uint32_t tmr_div)
init tmr base
Definition at32f413_tmr.c:179
tmr_interrupt_enable
void tmr_interrupt_enable(tmr_type *tmr_x, uint32_t tmr_interrupt, confirm_state new_state)
enable or disable tmr interrupt
Definition at32f413_tmr.c:1327
tmr_cnt_dir_set
void tmr_cnt_dir_set(tmr_type *tmr_x, tmr_count_mode_type tmr_cnt_dir)
set tmr counter count direction
Definition at32f413_tmr.c:225
TMR_COUNT_UP
@ TMR_COUNT_UP
Definition at32f413_tmr.h:105
TMR_OVF_FLAG
#define TMR_OVF_FLAG
Definition at32f413_tmr.h:51
TMR_OVF_INT
#define TMR_OVF_INT
Definition at32f413_tmr.h:73
TMR3
#define TMR3
Definition at32f413_tmr.h:833
time_ira_cnt
uint8_t time_ira_cnt
Definition bootloader/src/tmr.c:38
TMR3_GLOBAL_IRQHandler
void TMR3_GLOBAL_IRQHandler(void)
tmr3 global interrupt handler.
Definition bootloader/src/tmr.c:74
tmr_init
void tmr_init(void)
init tmr.
Definition bootloader/src/tmr.c:46
get_data_from_usart_flag
uint8_t get_data_from_usart_flag
Definition bootloader/src/tmr.c:39
back_err
void back_err(void)
command response error.
Definition app_led3_toggle/src/usart.c:119
crm_clocks_freq_type
crm clocks freqency structure
Definition at32f413_crm.h:470
crm_clocks_freq_type::ahb_freq
uint32_t ahb_freq
Definition at32f413_crm.h:472


AT32F413 Firmwary Library: usart.c Source File

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • bootloader
  • src
bootloader/src/usart.c
Go to the documentation of this file.
1
26#include "usart.h"
27#include "tmr.h"
28
37 usart_group_type usart_group_struct;
38
44void uart_init(uint32_t baudrate)
45{
46 gpio_init_type gpio_init_struct;
47 /* enable the usart and it's io clock */
48 crm_periph_clock_enable(CRM_USART1_PERIPH_CLOCK, TRUE);
49 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
50
51 /* set default parameter */
52 gpio_default_para_init(&gpio_init_struct);
53
54 /* configure the usart1_tx pa9 */
55 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
56 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
57 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
58 gpio_init_struct.gpio_pins = GPIO_PINS_9;
59 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
60 gpio_init(GPIOA, &gpio_init_struct);
61
62 /* configure the usart1_rx pa10 */
63 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
64 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
65 gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
66 gpio_init_struct.gpio_pins = GPIO_PINS_10;
67 gpio_init_struct.gpio_pull = GPIO_PULL_UP;
68 gpio_init(GPIOA, &gpio_init_struct);
69
70 /*configure usart nvic interrupt */
71 nvic_irq_enable(USART1_IRQn, 0, 0);
72
73 /*configure usart param*/
74 usart_init(USART1, baudrate, USART_DATA_8BITS, USART_STOP_1_BIT);
75 usart_transmitter_enable(USART1, TRUE);
76 usart_receiver_enable(USART1, TRUE);
77 usart_interrupt_enable(USART1, USART_RDBF_INT, TRUE);
78 usart_enable(USART1, TRUE);
79}
80
86void USART1_IRQHandler(void)
87{
88 uint16_t reval;
89 time_ira_cnt = 0; /* clear upgrade time out flag */
90 if(usart_interrupt_flag_get(USART1, USART_RDBF_FLAG) != RESET)
91 {
92 reval = usart_data_receive(USART1);
93 if(usart_group_struct.count > (USART_REC_LEN - 1))
94 {
95 usart_group_struct.count = 0;
96 usart_group_struct.head = 0;
97 usart_group_struct.tail = 0;
98 }
99 else
100 {
101 usart_group_struct.count++;
102 usart_group_struct.buf[usart_group_struct.head++] = reval;
103 if(usart_group_struct.head > (USART_REC_LEN - 1))
104 {
105 usart_group_struct.head = 0;
106 }
107 }
108 }
109}
110
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_USART1_PERIPH_CLOCK
@ CRM_USART1_PERIPH_CLOCK
Definition at32f413_crm.h:119
USART1_IRQn
@ USART1_IRQn
Definition at32f413.h:209
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_PULL_UP
@ GPIO_PULL_UP
Definition at32f413_gpio.h:244
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_10
#define GPIO_PINS_10
Definition at32f413_gpio.h:60
GPIO_PINS_9
#define GPIO_PINS_9
Definition at32f413_gpio.h:59
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
usart_transmitter_enable
void usart_transmitter_enable(usart_type *usart_x, confirm_state new_state)
usart transmitter enable.
Definition at32f413_usart.c:185
usart_init
void usart_init(usart_type *usart_x, uint32_t baud_rate, usart_data_bit_num_type data_bit, usart_stop_bit_num_type stop_bit)
initialize the usart peripheral according to the specified parameters.
Definition at32f413_usart.c:105
usart_enable
void usart_enable(usart_type *usart_x, confirm_state new_state)
enable or disable the specified usart peripheral.
Definition at32f413_usart.c:172
usart_receiver_enable
void usart_receiver_enable(usart_type *usart_x, confirm_state new_state)
usart receiver enable.
Definition at32f413_usart.c:198
usart_interrupt_enable
void usart_interrupt_enable(usart_type *usart_x, uint32_t usart_int, confirm_state new_state)
enable or disable the specified usart interrupts.
Definition at32f413_usart.c:263
usart_data_receive
uint16_t usart_data_receive(usart_type *usart_x)
return the most recent received data by the usart peripheral.
Definition at32f413_usart.c:392
usart_interrupt_flag_get
flag_status usart_interrupt_flag_get(usart_type *usart_x, uint32_t flag)
check whether the specified usart interrupt flag is set or not.
Definition at32f413_usart.c:596
USART_STOP_1_BIT
@ USART_STOP_1_BIT
Definition at32f413_usart.h:157
USART_DATA_8BITS
@ USART_DATA_8BITS
Definition at32f413_usart.h:112
USART_RDBF_FLAG
#define USART_RDBF_FLAG
Definition at32f413_usart.h:56
time_ira_cnt
uint8_t time_ira_cnt
Definition bootloader/src/tmr.c:38
USART1_IRQHandler
void USART1_IRQHandler(void)
usart1 interrupt handler.
Definition bootloader/src/usart.c:86
uart_init
void uart_init(uint32_t baudrate)
init usart.
Definition bootloader/src/usart.c:44
usart_group_struct
usart_group_type usart_group_struct
Definition bootloader/src/usart.c:37
USART_RDBF_INT
#define USART_RDBF_INT
Definition at32f413_usart.h:72
USART1
#define USART1
Definition at32f413_usart.h:318
USART_REC_LEN
#define USART_REC_LEN
Definition bootloader/inc/usart.h:47
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
usart_group_type
usart group type
Definition bootloader/inc/usart.h:61
usart_group_type::tail
uint16_t tail
Definition bootloader/inc/usart.h:64
usart_group_type::buf
uint16_t buf[1024]
Definition bootloader/inc/usart.h:62
usart_group_type::count
uint16_t count
Definition bootloader/inc/usart.h:65
usart_group_type::head
uint16_t head
Definition bootloader/inc/usart.h:63


AT32F413 Firmwary Library: cdc_class.c Source File

  • middlewares
  • usbd_class
  • cdc
cdc_class.c
Go to the documentation of this file.
1
25#include "usbd_core.h"
26#include "cdc_class.h"
27#include "cdc_desc.h"
28
42static usb_sts_type class_init_handler(void *udev);
43static usb_sts_type class_clear_handler(void *udev);
44static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup);
45static usb_sts_type class_ept0_tx_handler(void *udev);
46static usb_sts_type class_ept0_rx_handler(void *udev);
47static usb_sts_type class_in_handler(void *udev, uint8_t ept_num);
48static usb_sts_type class_out_handler(void *udev, uint8_t ept_num);
49static usb_sts_type class_sof_handler(void *udev);
50static usb_sts_type class_event_handler(void *udev, usbd_event_type event);
51
52static usb_sts_type cdc_struct_init(cdc_struct_type *pcdc);
53extern void usb_usart_config( linecoding_type linecoding);
54static void usb_vcp_cmd_process(void *udev, uint8_t cmd, uint8_t *buff, uint16_t len);
55
56 linecoding_type linecoding =
57{
58 115200,
59 0,
60 0,
61 8
62};
63
64/* cdc data struct */
65 cdc_struct_type cdc_struct;
66
67/* usb device class handler */
68 usbd_class_handler cdc_class_handler =
69{
70 class_init_handler,
71 class_clear_handler,
72 class_setup_handler,
73 class_ept0_tx_handler,
74 class_ept0_rx_handler,
75 class_in_handler,
76 class_out_handler,
77 class_sof_handler,
78 class_event_handler,
79 &cdc_struct
80};
81
87static usb_sts_type class_init_handler(void *udev)
88{
89 usb_sts_type status = USB_OK;
90 usbd_core_type *pudev = (usbd_core_type *)udev;
91 cdc_struct_type *pcdc = (cdc_struct_type *)pudev->class_handler->pdata;
92
93#ifndef USB_EPT_AUTO_MALLOC_BUFFER
94 /* use user define buffer address */
95 usbd_ept_buf_custom_define(pudev, USBD_CDC_INT_EPT, EPT2_TX_ADDR);
96 usbd_ept_buf_custom_define(pudev, USBD_CDC_BULK_IN_EPT, EPT1_TX_ADDR);
97 usbd_ept_buf_custom_define(pudev, USBD_CDC_BULK_OUT_EPT, EPT1_RX_ADDR);
98#endif
99
100 /* open in endpoint */
101 usbd_ept_open(pudev, USBD_CDC_INT_EPT, EPT_INT_TYPE, USBD_CDC_CMD_MAXPACKET_SIZE);
102
103 /* open in endpoint */
104 usbd_ept_open(pudev, USBD_CDC_BULK_IN_EPT, EPT_BULK_TYPE, USBD_CDC_IN_MAXPACKET_SIZE);
105
106 /* open out endpoint */
107 usbd_ept_open(pudev, USBD_CDC_BULK_OUT_EPT, EPT_BULK_TYPE, USBD_CDC_OUT_MAXPACKET_SIZE);
108
109 /* set out endpoint to receive status */
110 usbd_ept_recv(pudev, USBD_CDC_BULK_OUT_EPT, pcdc->g_rx_buff, USBD_CDC_OUT_MAXPACKET_SIZE);
111
112 cdc_struct_init(pcdc);
113
114 return status;
115}
116
122static usb_sts_type class_clear_handler(void *udev)
123{
124 usb_sts_type status = USB_OK;
125 usbd_core_type *pudev = (usbd_core_type *)udev;
126
127 /* close in endpoint */
128 usbd_ept_close(pudev, USBD_CDC_INT_EPT);
129
130 /* close in endpoint */
131 usbd_ept_close(pudev, USBD_CDC_BULK_IN_EPT);
132
133 /* close out endpoint */
134 usbd_ept_close(pudev, USBD_CDC_BULK_OUT_EPT);
135
136 return status;
137}
138
145static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
146{
147 usb_sts_type status = USB_OK;
148 usbd_core_type *pudev = (usbd_core_type *)udev;
149 cdc_struct_type *pcdc = (cdc_struct_type *)pudev->class_handler->pdata;
150
151 switch(setup->bmRequestType & USB_REQ_TYPE_RESERVED)
152 {
153 /* class request */
154 case USB_REQ_TYPE_CLASS:
155 if(setup->wLength)
156 {
157 if(setup->bmRequestType & USB_REQ_DIR_DTH)
158 {
159 usb_vcp_cmd_process(udev, setup->bRequest, pcdc->g_cmd, setup->wLength);
160 usbd_ctrl_send(pudev, pcdc->g_cmd, setup->wLength);
161 }
162 else
163 {
164 pcdc->g_req = setup->bRequest;
165 pcdc->g_len = setup->wLength;
166 usbd_ctrl_recv(pudev, pcdc->g_cmd, pcdc->g_len);
167
168 }
169 }
170 break;
171 /* standard request */
172 case USB_REQ_TYPE_STANDARD:
173 switch(setup->bRequest)
174 {
175 case USB_STD_REQ_GET_DESCRIPTOR:
176 usbd_ctrl_unsupport(pudev);
177 break;
178 case USB_STD_REQ_GET_INTERFACE:
179 usbd_ctrl_send(pudev, (uint8_t *)&pcdc->alt_setting, 1);
180 break;
181 case USB_STD_REQ_SET_INTERFACE:
182 pcdc->alt_setting = setup->wValue;
183 break;
184 case USB_STD_REQ_CLEAR_FEATURE:
185 break;
186 case USB_STD_REQ_SET_FEATURE:
187 break;
188 default:
189 usbd_ctrl_unsupport(pudev);
190 break;
191 }
192 break;
193 default:
194 usbd_ctrl_unsupport(pudev);
195 break;
196 }
197 return status;
198}
199
205static usb_sts_type class_ept0_tx_handler(void *udev)
206{
207 usb_sts_type status = USB_OK;
208
209 /* ...user code... */
210
211 return status;
212}
213
219static usb_sts_type class_ept0_rx_handler(void *udev)
220{
221 usb_sts_type status = USB_OK;
222 usbd_core_type *pudev = (usbd_core_type *)udev;
223 cdc_struct_type *pcdc = (cdc_struct_type *)pudev->class_handler->pdata;
224 uint32_t recv_len = usbd_get_recv_len(pudev, 0);
225 /* ...user code... */
226 if( pcdc->g_req == SET_LINE_CODING)
227 {
228 /* class process */
229 usb_vcp_cmd_process(udev, pcdc->g_req, pcdc->g_cmd, recv_len);
230 }
231
232 return status;
233}
234
241static usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
242{
243 usbd_core_type *pudev = (usbd_core_type *)udev;
244 cdc_struct_type *pcdc = (cdc_struct_type *)pudev->class_handler->pdata;
245 usb_sts_type status = USB_OK;
246
247 /* ...user code...
248 trans next packet data
249 */
250 pcdc->g_tx_completed = 1;
251
252 return status;
253}
254
261static usb_sts_type class_out_handler(void *udev, uint8_t ept_num)
262{
263 usb_sts_type status = USB_OK;
264 usbd_core_type *pudev = (usbd_core_type *)udev;
265 cdc_struct_type *pcdc = (cdc_struct_type *)pudev->class_handler->pdata;
266
267 /* get endpoint receive data length */
268 pcdc->g_rxlen = usbd_get_recv_len(pudev, ept_num);
269
270 /*set recv flag*/
271 pcdc->g_rx_completed = 1;
272
273 return status;
274}
275
281static usb_sts_type class_sof_handler(void *udev)
282{
283 usb_sts_type status = USB_OK;
284
285 /* ...user code... */
286
287 return status;
288}
289
296static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
297{
298 usb_sts_type status = USB_OK;
299 switch(event)
300 {
301 case USBD_RESET_EVENT:
302
303 /* ...user code... */
304
305 break;
306 case USBD_SUSPEND_EVENT:
307
308 /* ...user code... */
309
310 break;
311 case USBD_WAKEUP_EVENT:
312 /* ...user code... */
313
314 break;
315 default:
316 break;
317 }
318 return status;
319}
320
326static usb_sts_type cdc_struct_init(cdc_struct_type *pcdc)
327{
328 pcdc->g_tx_completed = 1;
329 pcdc->g_rx_completed = 0;
330 pcdc->alt_setting = 0;
331 pcdc->linecoding.bitrate = linecoding.bitrate;
332 pcdc->linecoding.data = linecoding.data;
333 pcdc->linecoding.format = linecoding.format;
334 pcdc->linecoding.parity = linecoding.parity;
335 return USB_OK;
336}
337
344uint16_t usb_vcp_get_rxdata(void *udev, uint8_t *recv_data)
345{
346 uint16_t i_index = 0;
347 uint16_t tmp_len = 0;
348 usbd_core_type *pudev = (usbd_core_type *)udev;
349 cdc_struct_type *pcdc = (cdc_struct_type *)pudev->class_handler->pdata;
350
351 if(pcdc->g_rx_completed == 0)
352 {
353 return 0;
354 }
355 pcdc->g_rx_completed = 0;
356 tmp_len = pcdc->g_rxlen;
357 for(i_index = 0; i_index < pcdc->g_rxlen; i_index ++)
358 {
359 recv_data[i_index] = pcdc->g_rx_buff[i_index];
360 }
361
362 usbd_ept_recv(pudev, USBD_CDC_BULK_OUT_EPT, pcdc->g_rx_buff, USBD_CDC_OUT_MAXPACKET_SIZE);
363
364 return tmp_len;
365}
366
374 error_status usb_vcp_send_data(void *udev, uint8_t *send_data, uint16_t len)
375{
376 error_status status = SUCCESS;
377 usbd_core_type *pudev = (usbd_core_type *)udev;
378 cdc_struct_type *pcdc = (cdc_struct_type *)pudev->class_handler->pdata;
379 if(pcdc->g_tx_completed)
380 {
381 pcdc->g_tx_completed = 0;
382 usbd_ept_send(pudev, USBD_CDC_BULK_IN_EPT, send_data, len);
383 }
384 else
385 {
386 status = ERROR;
387 }
388 return status;
389}
390
391
400static void usb_vcp_cmd_process(void *udev, uint8_t cmd, uint8_t *buff, uint16_t len)
401{
402 usbd_core_type *pudev = (usbd_core_type *)udev;
403 cdc_struct_type *pcdc = (cdc_struct_type *)pudev->class_handler->pdata;
404 switch(cmd)
405 {
406 case SET_LINE_CODING:
407 pcdc->linecoding.bitrate = (uint32_t)(buff[0] | (buff[1] << 8) | (buff[2] << 16) | (buff[3] <<24));
408 pcdc->linecoding.format = buff[4];
409 pcdc->linecoding.parity = buff[5];
410 pcdc->linecoding.data = buff[6];
411#ifdef USB_VIRTUAL_COMPORT
412 /* set hardware usart */
413 usb_usart_config(pcdc->linecoding);
414#endif
415 break;
416
417 case GET_LINE_CODING:
418 buff[0] = (uint8_t)pcdc->linecoding.bitrate;
419 buff[1] = (uint8_t)(pcdc->linecoding.bitrate >> 8);
420 buff[2] = (uint8_t)(pcdc->linecoding.bitrate >> 16);
421 buff[3] = (uint8_t)(pcdc->linecoding.bitrate >> 24);
422 buff[4] = (uint8_t)(pcdc->linecoding.format);
423 buff[5] = (uint8_t)(pcdc->linecoding.parity);
424 buff[6] = (uint8_t)(pcdc->linecoding.data);
425 break;
426
427 default:
428 break;
429 }
430}
431
cdc_class.h
usb cdc class file
cdc_desc.h
usb cdc descriptor header file
EPT1_RX_ADDR
#define EPT1_RX_ADDR
Definition project/at_start_f413/examples/acc/calibration/inc/usb_conf.h:77
EPT1_TX_ADDR
#define EPT1_TX_ADDR
Definition project/at_start_f413/examples/acc/calibration/inc/usb_conf.h:76
EPT2_TX_ADDR
#define EPT2_TX_ADDR
Definition project/at_start_f413/examples/acc/calibration/inc/usb_conf.h:79
error_status
error_status
error status
Definition at32f413.h:302
ERROR
@ ERROR
Definition at32f413.h:302
SUCCESS
@ SUCCESS
Definition at32f413.h:302
USBD_CDC_CMD_MAXPACKET_SIZE
#define USBD_CDC_CMD_MAXPACKET_SIZE
Definition cdc_class.h:61
USBD_CDC_BULK_OUT_EPT
#define USBD_CDC_BULK_OUT_EPT
Definition cdc_class.h:54
USBD_CDC_INT_EPT
#define USBD_CDC_INT_EPT
usb cdc use endpoint define
Definition cdc_class.h:52
USBD_CDC_BULK_IN_EPT
#define USBD_CDC_BULK_IN_EPT
Definition cdc_class.h:53
USBD_CDC_OUT_MAXPACKET_SIZE
#define USBD_CDC_OUT_MAXPACKET_SIZE
Definition cdc_class.h:60
USBD_CDC_IN_MAXPACKET_SIZE
#define USBD_CDC_IN_MAXPACKET_SIZE
usb cdc in and out max packet size define
Definition cdc_class.h:59
class_sof_handler
static usb_sts_type class_sof_handler(void *udev)
usb device class sof handler
Definition cdc_class.c:281
class_in_handler
static usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
usb device class transmision complete handler
Definition cdc_class.c:241
class_clear_handler
static usb_sts_type class_clear_handler(void *udev)
clear endpoint or other state
Definition cdc_class.c:122
class_setup_handler
static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
usb device class setup request handler
Definition cdc_class.c:145
usb_usart_config
void usb_usart_config(linecoding_type linecoding)
this function handles usart2 and linecoding config.
Definition project/at_start_f413/examples/usb_device/virtual_comport/src/main.c:301
linecoding
linecoding_type linecoding
Definition cdc_class.c:56
class_ept0_tx_handler
static usb_sts_type class_ept0_tx_handler(void *udev)
usb device class endpoint 0 in status stage complete
Definition cdc_class.c:205
usb_vcp_get_rxdata
uint16_t usb_vcp_get_rxdata(void *udev, uint8_t *recv_data)
usb device class rx data process
Definition cdc_class.c:344
class_ept0_rx_handler
static usb_sts_type class_ept0_rx_handler(void *udev)
usb device class endpoint 0 out status stage complete
Definition cdc_class.c:219
cdc_struct_init
static usb_sts_type cdc_struct_init(cdc_struct_type *pcdc)
usb device cdc init
Definition cdc_class.c:326
class_event_handler
static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
usb device class event handler
Definition cdc_class.c:296
usb_vcp_cmd_process
static void usb_vcp_cmd_process(void *udev, uint8_t cmd, uint8_t *buff, uint16_t len)
usb device class request function
Definition cdc_class.c:400
usb_vcp_send_data
error_status usb_vcp_send_data(void *udev, uint8_t *send_data, uint16_t len)
usb device class send data
Definition cdc_class.c:374
class_init_handler
static usb_sts_type class_init_handler(void *udev)
initialize usb endpoint
Definition cdc_class.c:87
class_out_handler
static usb_sts_type class_out_handler(void *udev, uint8_t ept_num)
usb device class endpoint receive data
Definition cdc_class.c:261
cdc_struct
cdc_struct_type cdc_struct
Definition cdc_class.c:65
cdc_class_handler
usbd_class_handler cdc_class_handler
Definition cdc_class.c:68
EPT_INT_TYPE
@ EPT_INT_TYPE
Definition at32f413_usb.h:205
EPT_BULK_TYPE
@ EPT_BULK_TYPE
Definition at32f413_usb.h:204
GET_LINE_CODING
#define GET_LINE_CODING
Definition cdc_msc_class.h:106
SET_LINE_CODING
#define SET_LINE_CODING
Definition cdc_msc_class.h:105
USB_STD_REQ_CLEAR_FEATURE
#define USB_STD_REQ_CLEAR_FEATURE
Definition usb_std.h:77
USB_REQ_TYPE_STANDARD
#define USB_REQ_TYPE_STANDARD
usb request type
Definition usb_std.h:62
USB_STD_REQ_GET_DESCRIPTOR
#define USB_STD_REQ_GET_DESCRIPTOR
Definition usb_std.h:80
USB_STD_REQ_SET_FEATURE
#define USB_STD_REQ_SET_FEATURE
Definition usb_std.h:78
USB_REQ_DIR_DTH
#define USB_REQ_DIR_DTH
Definition usb_std.h:71
USB_STD_REQ_SET_INTERFACE
#define USB_STD_REQ_SET_INTERFACE
Definition usb_std.h:85
USB_REQ_TYPE_RESERVED
#define USB_REQ_TYPE_RESERVED
Definition usb_std.h:65
USB_STD_REQ_GET_INTERFACE
#define USB_STD_REQ_GET_INTERFACE
Definition usb_std.h:84
USB_REQ_TYPE_CLASS
#define USB_REQ_TYPE_CLASS
Definition usb_std.h:63
usb_sts_type
usb_sts_type
usb return status
Definition usb_std.h:285
USB_OK
@ USB_OK
Definition usb_std.h:286
usbd_ept_close
void usbd_ept_close(usbd_core_type *udev, uint8_t ept_addr)
usb close endpoint
Definition usbd_core.c:541
usbd_ept_recv
void usbd_ept_recv(usbd_core_type *udev, uint8_t ept_num, uint8_t *buffer, uint16_t len)
usb endpoint receive data
Definition usbd_core.c:364
usbd_ept_buf_custom_define
void usbd_ept_buf_custom_define(usbd_core_type *udev, uint8_t ept_addr, uint32_t addr)
usb custom define endpoint buffer
Definition usbd_core.c:464
usbd_ept_open
void usbd_ept_open(usbd_core_type *udev, uint8_t ept_addr, uint8_t ept_type, uint16_t maxpacket)
usb open endpoint
Definition usbd_core.c:506
usbd_ctrl_send
void usbd_ctrl_send(usbd_core_type *udev, uint8_t *buffer, uint16_t len)
usb control endpoint send data
Definition usbd_core.c:175
usbd_get_recv_len
uint32_t usbd_get_recv_len(usbd_core_type *udev, uint8_t ept_addr)
usb endpoint get receive data length
Definition usbd_core.c:397
usbd_ctrl_recv
void usbd_ctrl_recv(usbd_core_type *udev, uint8_t *buffer, uint16_t len)
usb control endpoint receive data
Definition usbd_core.c:194
usbd_ctrl_unsupport
void usbd_ctrl_unsupport(usbd_core_type *udev)
un-support device request
Definition usbd_core.c:289
usbd_ept_send
void usbd_ept_send(usbd_core_type *udev, uint8_t ept_num, uint8_t *buffer, uint16_t len)
usb endpoint send data
Definition usbd_core.c:304
usbd_event_type
usbd_event_type
usb device event
Definition usbd_core.h:54
USBD_SUSPEND_EVENT
@ USBD_SUSPEND_EVENT
Definition usbd_core.h:57
USBD_RESET_EVENT
@ USBD_RESET_EVENT
Definition usbd_core.h:56
USBD_WAKEUP_EVENT
@ USBD_WAKEUP_EVENT
Definition usbd_core.h:58
cdc_struct_type
usb cdc class struct
Definition cdc_class.h:75
cdc_struct_type::alt_setting
uint32_t alt_setting
Definition cdc_class.h:76
cdc_struct_type::g_req
uint8_t g_req
Definition cdc_class.h:79
cdc_struct_type::g_rxlen
uint16_t g_rxlen
Definition cdc_class.h:80
cdc_struct_type::g_tx_completed
__IO uint8_t g_tx_completed
Definition cdc_class.h:81
cdc_struct_type::linecoding
linecoding_type linecoding
Definition cdc_class.h:82
cdc_struct_type::g_rx_completed
__IO uint8_t g_rx_completed
Definition cdc_class.h:81
cdc_struct_type::g_cmd
uint8_t g_cmd[0x08]
Definition cdc_class.h:78
cdc_struct_type::g_rx_buff
uint8_t g_rx_buff[0x40]
Definition cdc_class.h:77
cdc_struct_type::g_len
uint16_t g_len
Definition cdc_class.h:80
linecoding_type
usb cdc class set line coding struct
Definition usb_std.h:219
linecoding_type::bitrate
uint32_t bitrate
Definition usb_std.h:220
linecoding_type::data
uint8_t data
Definition usb_std.h:223
linecoding_type::parity
uint8_t parity
Definition usb_std.h:222
linecoding_type::format
uint8_t format
Definition usb_std.h:221
usb_setup_type
format of usb setup data
Definition usb_std.h:297
usb_setup_type::wValue
uint16_t wValue
Definition usb_std.h:300
usb_setup_type::wLength
uint16_t wLength
Definition usb_std.h:303
usb_setup_type::bmRequestType
uint8_t bmRequestType
Definition usb_std.h:298
usb_setup_type::bRequest
uint8_t bRequest
Definition usb_std.h:299
usbd_class_handler
usb device class handler
Definition usbd_core.h:97
usbd_class_handler::pdata
void * pdata
Definition usbd_core.h:107
usbd_core_type
usb device core struct type
Definition usbd_core.h:114
usbd_core_type::class_handler
usbd_class_handler * class_handler
Definition usbd_core.h:117
usbd_core.h
usb device core header file


AT32F413 Firmwary Library: cdc_class.h Source File

  • middlewares
  • usbd_class
  • cdc
cdc_class.h
Go to the documentation of this file.
1
26 /* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __CDC_CLASS_H
28#define __CDC_CLASS_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "usb_std.h"
35#include "usbd_core.h"
36
52#define USBD_CDC_INT_EPT 0x82
53#define USBD_CDC_BULK_IN_EPT 0x81
54#define USBD_CDC_BULK_OUT_EPT 0x01
55
59#define USBD_CDC_IN_MAXPACKET_SIZE 0x40
60#define USBD_CDC_OUT_MAXPACKET_SIZE 0x40
61#define USBD_CDC_CMD_MAXPACKET_SIZE 0x08
62
74typedef struct
75{
76 uint32_t alt_setting;
77 uint8_t g_rx_buff[USBD_CDC_OUT_MAXPACKET_SIZE];
78 uint8_t g_cmd[USBD_CDC_CMD_MAXPACKET_SIZE];
79 uint8_t g_req;
80 uint16_t g_len, g_rxlen;
81 __IO uint8_t g_tx_completed, g_rx_completed;
82 linecoding_type linecoding;
83}cdc_struct_type;
84
85
93extern usbd_class_handler cdc_class_handler;
94uint16_t usb_vcp_get_rxdata(void *udev, uint8_t *recv_data);
95 error_status usb_vcp_send_data(void *udev, uint8_t *send_data, uint16_t len);
96
109#ifdef __cplusplus
110}
111#endif
112
113#endif
114
115
116
error_status
error_status
error status
Definition at32f413.h:302
USBD_CDC_CMD_MAXPACKET_SIZE
#define USBD_CDC_CMD_MAXPACKET_SIZE
Definition cdc_class.h:61
USBD_CDC_OUT_MAXPACKET_SIZE
#define USBD_CDC_OUT_MAXPACKET_SIZE
Definition cdc_class.h:60
usb_vcp_get_rxdata
uint16_t usb_vcp_get_rxdata(void *udev, uint8_t *recv_data)
usb device class rx data process
Definition cdc_class.c:344
usb_vcp_send_data
error_status usb_vcp_send_data(void *udev, uint8_t *send_data, uint16_t len)
usb device class send data
Definition cdc_class.c:374
cdc_class_handler
usbd_class_handler cdc_class_handler
Definition cdc_class.c:68
cdc_struct_type
usb cdc class struct
Definition cdc_class.h:75
cdc_struct_type::alt_setting
uint32_t alt_setting
Definition cdc_class.h:76
cdc_struct_type::g_req
uint8_t g_req
Definition cdc_class.h:79
cdc_struct_type::linecoding
linecoding_type linecoding
Definition cdc_class.h:82
cdc_struct_type::g_rx_completed
__IO uint8_t g_rx_completed
Definition cdc_class.h:81
cdc_struct_type::g_len
uint16_t g_len
Definition cdc_class.h:80
linecoding_type
usb cdc class set line coding struct
Definition usb_std.h:219
usbd_class_handler
usb device class handler
Definition usbd_core.h:97
usb_std.h
usb standard header file
usbd_core.h
usb device core header file


AT32F413 Firmwary Library: cdc_desc.c Source File

  • middlewares
  • usbd_class
  • cdc
cdc_desc.c
Go to the documentation of this file.
1
25#include "usb_std.h"
26#include "usbd_sdr.h"
27#include "usbd_core.h"
28#include "cdc_desc.h"
29
43static usbd_desc_t *get_device_descriptor(void);
44static usbd_desc_t *get_device_qualifier(void);
45static usbd_desc_t *get_device_configuration(void);
46static usbd_desc_t *get_device_other_speed(void);
47static usbd_desc_t *get_device_lang_id(void);
48static usbd_desc_t *get_device_manufacturer_string(void);
49static usbd_desc_t *get_device_product_string(void);
50static usbd_desc_t *get_device_serial_string(void);
51static usbd_desc_t *get_device_interface_string(void);
52static usbd_desc_t *get_device_config_string(void);
53
54static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf);
55static void usbd_int_to_unicode (uint32_t value , uint8_t *pbuf , uint8_t len);
56static void get_serial_num(void);
57#if defined ( __ICCARM__ ) /* iar compiler */
58 #pragma data_alignment=4
59#endif
60ALIGNED_HEAD static uint8_t g_usbd_desc_buffer[256] ALIGNED_TAIL;
61
65 usbd_desc_handler cdc_desc_handler =
66{
67 get_device_descriptor,
68 get_device_qualifier,
69 get_device_configuration,
70 get_device_other_speed,
71 get_device_lang_id,
72 get_device_manufacturer_string,
73 get_device_product_string,
74 get_device_serial_string,
75 get_device_interface_string,
76 get_device_config_string,
77};
78
82#if defined ( __ICCARM__ ) /* iar compiler */
83 #pragma data_alignment=4
84#endif
85ALIGNED_HEAD static uint8_t g_usbd_descriptor[USB_DEVICE_DESC_LEN] ALIGNED_TAIL =
86{
87 USB_DEVICE_DESC_LEN, /* bLength */
88 USB_DESCIPTOR_TYPE_DEVICE, /* bDescriptorType */
89 0x00, /* bcdUSB */
90 0x02,
91 0x02, /* bDeviceClass */
92 0x00, /* bDeviceSubClass */
93 0x00, /* bDeviceProtocol */
94 USB_MAX_EP0_SIZE, /* bMaxPacketSize */
95 LBYTE(USBD_CDC_VENDOR_ID), /* idVendor */
96 HBYTE(USBD_CDC_VENDOR_ID), /* idVendor */
97 LBYTE(USBD_CDC_PRODUCT_ID), /* idProduct */
98 HBYTE(USBD_CDC_PRODUCT_ID), /* idProduct */
99 0x00, /* bcdDevice rel. 2.00 */
100 0x02,
101 USB_MFC_STRING, /* Index of manufacturer string */
102 USB_PRODUCT_STRING, /* Index of product string */
103 USB_SERIAL_STRING, /* Index of serial number string */
104 1 /* bNumConfigurations */
105};
106
110#if defined ( __ICCARM__ ) /* iar compiler */
111 #pragma data_alignment=4
112#endif
113ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_CDC_CONFIG_DESC_SIZE] ALIGNED_TAIL =
114{
115 USB_DEVICE_CFG_DESC_LEN, /* bLength: configuration descriptor size */
116 USB_DESCIPTOR_TYPE_CONFIGURATION, /* bDescriptorType: configuration */
117 LBYTE(USBD_CDC_CONFIG_DESC_SIZE), /* wTotalLength: bytes returned */
118 HBYTE(USBD_CDC_CONFIG_DESC_SIZE), /* wTotalLength: bytes returned */
119 0x02, /* bNumInterfaces: 2 interface */
120 0x01, /* bConfigurationValue: configuration value */
121 0x00, /* iConfiguration: index of string descriptor describing
122 the configuration */
123 0xC0, /* bmAttributes: self powered */
124 0x32, /* MaxPower 100 mA: this current is used for detecting vbus */
125
126 USB_DEVICE_IF_DESC_LEN, /* bLength: interface descriptor size */
127 USB_DESCIPTOR_TYPE_INTERFACE, /* bDescriptorType: interface descriptor type */
128 0x00, /* bInterfaceNumber: number of interface */
129 0x00, /* bAlternateSetting: alternate set */
130 0x01, /* bNumEndpoints: number of endpoints */
131 USB_CLASS_CODE_CDC, /* bInterfaceClass: CDC class code */
132 0x02, /* bInterfaceSubClass: subclass code, Abstract Control Model*/
133 0x01, /* bInterfaceProtocol: protocol code, AT Command */
134 0x00, /* iInterface: index of string descriptor */
135
136 0x05, /* bFunctionLength: size of this descriptor in bytes */
137 USBD_CDC_CS_INTERFACE, /* bDescriptorType: CDC interface descriptor type */
138 USBD_CDC_SUBTYPE_HEADER, /* bDescriptorSubtype: Header function Descriptor 0x00*/
139 LBYTE(CDC_BCD_NUM),
140 HBYTE(CDC_BCD_NUM), /* bcdCDC: USB class definitions for communications */
141
142 0x05, /* bFunctionLength: size of this descriptor in bytes */
143 USBD_CDC_CS_INTERFACE, /* bDescriptorType: CDC interface descriptor type */
144 USBD_CDC_SUBTYPE_CMF, /* bDescriptorSubtype: Call Management function descriptor subtype 0x01 */
145 0x00, /* bmCapabilities: 0x00*/
146 0x01, /* bDataInterface: interface number of data class interface optionally used for call management */
147
148 0x04, /* bFunctionLength: size of this descriptor in bytes */
149 USBD_CDC_CS_INTERFACE, /* bDescriptorType: CDC interface descriptor type */
150 USBD_CDC_SUBTYPE_ACM, /* bDescriptorSubtype: Abstract Control Management functional descriptor subtype 0x02 */
151 0x02, /* bmCapabilities: Support Set_Line_Coding and Get_Line_Coding 0x02 */
152
153 0x05, /* bFunctionLength: size of this descriptor in bytes */
154 USBD_CDC_CS_INTERFACE, /* bDescriptorType: CDC interface descriptor type */
155 USBD_CDC_SUBTYPE_UFD, /* bDescriptorSubtype: Union Function Descriptor subtype 0x06 */
156 0x00, /* bControlInterface: The interface number of the communications or data class interface 0x00 */
157 0x01, /* bSubordinateInterface0: interface number of first subordinate interface in the union */
158
159 USB_DEVICE_EPT_LEN, /* bLength: size of endpoint descriptor in bytes */
160 USB_DESCIPTOR_TYPE_ENDPOINT, /* bDescriptorType: endpoint descriptor type */
161 USBD_CDC_INT_EPT, /* bEndpointAddress: the address of endpoint on usb device described by this descriptor */
162 USB_EPT_DESC_INTERRUPT, /* bmAttributes: endpoint attributes */
163 LBYTE(USBD_CDC_CMD_MAXPACKET_SIZE),
164 HBYTE(USBD_CDC_CMD_MAXPACKET_SIZE), /* wMaxPacketSize: maximum packe size this endpoint */
165 CDC_HID_BINTERVAL_TIME, /* bInterval: interval for polling endpoint for data transfers */
166
167
168 USB_DEVICE_IF_DESC_LEN, /* bLength: interface descriptor size */
169 USB_DESCIPTOR_TYPE_INTERFACE, /* bDescriptorType: interface descriptor type */
170 0x01, /* bInterfaceNumber: number of interface */
171 0x00, /* bAlternateSetting: alternate set */
172 0x02, /* bNumEndpoints: number of endpoints */
173 USB_CLASS_CODE_CDCDATA, /* bInterfaceClass: CDC-data class code */
174 0x00, /* bInterfaceSubClass: Data interface subclass code 0x00*/
175 0x00, /* bInterfaceProtocol: data class protocol code 0x00 */
176 0x00, /* iInterface: index of string descriptor */
177
178 USB_DEVICE_EPT_LEN, /* bLength: size of endpoint descriptor in bytes */
179 USB_DESCIPTOR_TYPE_ENDPOINT, /* bDescriptorType: endpoint descriptor type */
180 USBD_CDC_BULK_IN_EPT, /* bEndpointAddress: the address of endpoint on usb device described by this descriptor */
181 USB_EPT_DESC_BULK, /* bmAttributes: endpoint attributes */
182 LBYTE(USBD_CDC_IN_MAXPACKET_SIZE),
183 HBYTE(USBD_CDC_IN_MAXPACKET_SIZE), /* wMaxPacketSize: maximum packe size this endpoint */
184 0x00, /* bInterval: interval for polling endpoint for data transfers */
185
186 USB_DEVICE_EPT_LEN, /* bLength: size of endpoint descriptor in bytes */
187 USB_DESCIPTOR_TYPE_ENDPOINT, /* bDescriptorType: endpoint descriptor type */
188 USBD_CDC_BULK_OUT_EPT, /* bEndpointAddress: the address of endpoint on usb device described by this descriptor */
189 USB_EPT_DESC_BULK, /* bmAttributes: endpoint attributes */
190 LBYTE(USBD_CDC_OUT_MAXPACKET_SIZE),
191 HBYTE(USBD_CDC_OUT_MAXPACKET_SIZE), /* wMaxPacketSize: maximum packe size this endpoint */
192 0x00, /* bInterval: interval for polling endpoint for data transfers */
193};
194
198#if defined ( __ICCARM__ ) /* iar compiler */
199 #pragma data_alignment=4
200#endif
201ALIGNED_HEAD static uint8_t g_string_lang_id[USBD_CDC_SIZ_STRING_LANGID] ALIGNED_TAIL =
202{
203 USBD_CDC_SIZ_STRING_LANGID,
204 USB_DESCIPTOR_TYPE_STRING,
205 0x09,
206 0x04,
207};
208
212#if defined ( __ICCARM__ ) /* iar compiler */
213 #pragma data_alignment=4
214#endif
215ALIGNED_HEAD static uint8_t g_string_serial[USBD_CDC_SIZ_STRING_SERIAL] ALIGNED_TAIL =
216{
217 USBD_CDC_SIZ_STRING_SERIAL,
218 USB_DESCIPTOR_TYPE_STRING,
219};
220
221
222/* device descriptor */
223static usbd_desc_t device_descriptor =
224{
225 USB_DEVICE_DESC_LEN,
226 g_usbd_descriptor
227};
228
229/* config descriptor */
230static usbd_desc_t config_descriptor =
231{
232 USBD_CDC_CONFIG_DESC_SIZE,
233 g_usbd_configuration
234};
235
236/* langid descriptor */
237static usbd_desc_t langid_descriptor =
238{
239 USBD_CDC_SIZ_STRING_LANGID,
240 g_string_lang_id
241};
242
243/* serial descriptor */
244static usbd_desc_t serial_descriptor =
245{
246 USBD_CDC_SIZ_STRING_SERIAL,
247 g_string_serial
248};
249
250static usbd_desc_t vp_desc;
251
258static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf)
259{
260 uint16_t str_len = 0, id_pos = 2;
261 uint8_t *tmp_str = string;
262
263 while(*tmp_str != '\0')
264 {
265 str_len ++;
266 unicode_buf[id_pos ++] = *tmp_str ++;
267 unicode_buf[id_pos ++] = 0x00;
268 }
269
270 str_len = str_len * 2 + 2;
271 unicode_buf[0] = (uint8_t)str_len;
272 unicode_buf[1] = USB_DESCIPTOR_TYPE_STRING;
273
274 return str_len;
275}
276
284static void usbd_int_to_unicode (uint32_t value , uint8_t *pbuf , uint8_t len)
285{
286 uint8_t idx = 0;
287
288 for( idx = 0 ; idx < len ; idx ++)
289 {
290 if( ((value >> 28)) < 0xA )
291 {
292 pbuf[ 2 * idx] = (value >> 28) + '0';
293 }
294 else
295 {
296 pbuf[2 * idx] = (value >> 28) + 'A' - 10;
297 }
298
299 value = value << 4;
300
301 pbuf[2 * idx + 1] = 0;
302 }
303}
304
310static void get_serial_num(void)
311{
312 uint32_t serial0, serial1, serial2;
313
314 serial0 = *(uint32_t*)MCU_ID1;
315 serial1 = *(uint32_t*)MCU_ID2;
316 serial2 = *(uint32_t*)MCU_ID3;
317
318 serial0 += serial2;
319
320 if (serial0 != 0)
321 {
322 usbd_int_to_unicode (serial0, &g_string_serial[2] ,8);
323 usbd_int_to_unicode (serial1, &g_string_serial[18] ,4);
324 }
325}
326
332static usbd_desc_t *get_device_descriptor(void)
333{
334 return &device_descriptor;
335}
336
342static usbd_desc_t * get_device_qualifier(void)
343{
344 return NULL;
345}
346
352static usbd_desc_t *get_device_configuration(void)
353{
354 return &config_descriptor;
355}
356
362static usbd_desc_t *get_device_other_speed(void)
363{
364 return NULL;
365}
366
372static usbd_desc_t *get_device_lang_id(void)
373{
374 return &langid_descriptor;
375}
376
377
383static usbd_desc_t *get_device_manufacturer_string(void)
384{
385 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_CDC_DESC_MANUFACTURER_STRING, g_usbd_desc_buffer);
386 vp_desc.descriptor = g_usbd_desc_buffer;
387 return &vp_desc;
388}
389
395static usbd_desc_t *get_device_product_string(void)
396{
397 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_CDC_DESC_PRODUCT_STRING, g_usbd_desc_buffer);
398 vp_desc.descriptor = g_usbd_desc_buffer;
399 return &vp_desc;
400}
401
407static usbd_desc_t *get_device_serial_string(void)
408{
409 get_serial_num();
410 return &serial_descriptor;
411}
412
418static usbd_desc_t *get_device_interface_string(void)
419{
420 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_CDC_DESC_INTERFACE_STRING, g_usbd_desc_buffer);
421 vp_desc.descriptor = g_usbd_desc_buffer;
422 return &vp_desc;
423}
424
430static usbd_desc_t *get_device_config_string(void)
431{
432 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_CDC_DESC_CONFIGURATION_STRING, g_usbd_desc_buffer);
433 vp_desc.descriptor = g_usbd_desc_buffer;
434 return &vp_desc;
435}
436
cdc_desc.h
usb cdc descriptor header file
NULL
#define NULL
Definition emmc_card/inc/at32_sdio.h:340
MCU_ID1
#define MCU_ID1
Definition audio_desc.h:214
MCU_ID2
#define MCU_ID2
Definition audio_desc.h:215
MCU_ID3
#define MCU_ID3
Definition audio_desc.h:216
USBD_CDC_CMD_MAXPACKET_SIZE
#define USBD_CDC_CMD_MAXPACKET_SIZE
Definition cdc_class.h:61
USBD_CDC_BULK_OUT_EPT
#define USBD_CDC_BULK_OUT_EPT
Definition cdc_class.h:54
USBD_CDC_INT_EPT
#define USBD_CDC_INT_EPT
usb cdc use endpoint define
Definition cdc_class.h:52
USBD_CDC_BULK_IN_EPT
#define USBD_CDC_BULK_IN_EPT
Definition cdc_class.h:53
USBD_CDC_OUT_MAXPACKET_SIZE
#define USBD_CDC_OUT_MAXPACKET_SIZE
Definition cdc_class.h:60
USBD_CDC_IN_MAXPACKET_SIZE
#define USBD_CDC_IN_MAXPACKET_SIZE
usb cdc in and out max packet size define
Definition cdc_class.h:59
CDC_BCD_NUM
#define CDC_BCD_NUM
usb bcd number define
Definition cdc_desc.h:51
USBD_CDC_DESC_MANUFACTURER_STRING
#define USBD_CDC_DESC_MANUFACTURER_STRING
usb string define(vendor, product configuration, interface)
Definition cdc_desc.h:69
USBD_CDC_DESC_CONFIGURATION_STRING
#define USBD_CDC_DESC_CONFIGURATION_STRING
Definition cdc_desc.h:71
USBD_CDC_SIZ_STRING_LANGID
#define USBD_CDC_SIZ_STRING_LANGID
Definition cdc_desc.h:63
USBD_CDC_PRODUCT_ID
#define USBD_CDC_PRODUCT_ID
Definition cdc_desc.h:57
USBD_CDC_DESC_PRODUCT_STRING
#define USBD_CDC_DESC_PRODUCT_STRING
Definition cdc_desc.h:70
USBD_CDC_VENDOR_ID
#define USBD_CDC_VENDOR_ID
usb vendor id and product id define
Definition cdc_desc.h:56
CDC_HID_BINTERVAL_TIME
#define CDC_HID_BINTERVAL_TIME
usb endpoint interval define
Definition cdc_desc.h:77
USBD_CDC_CONFIG_DESC_SIZE
#define USBD_CDC_CONFIG_DESC_SIZE
usb descriptor size define
Definition cdc_desc.h:62
USBD_CDC_SIZ_STRING_SERIAL
#define USBD_CDC_SIZ_STRING_SERIAL
Definition cdc_desc.h:64
USBD_CDC_DESC_INTERFACE_STRING
#define USBD_CDC_DESC_INTERFACE_STRING
Definition cdc_desc.h:72
serial_descriptor
static usbd_desc_t serial_descriptor
Definition cdc_desc.c:244
device_descriptor
static usbd_desc_t device_descriptor
Definition cdc_desc.c:223
get_device_configuration
static usbd_desc_t * get_device_configuration(void)
get config descriptor
Definition cdc_desc.c:352
langid_descriptor
static usbd_desc_t langid_descriptor
Definition cdc_desc.c:237
get_device_descriptor
static usbd_desc_t * get_device_descriptor(void)
get device descriptor
Definition cdc_desc.c:332
get_device_manufacturer_string
static usbd_desc_t * get_device_manufacturer_string(void)
get manufacturer descriptor
Definition cdc_desc.c:383
get_device_qualifier
static usbd_desc_t * get_device_qualifier(void)
get device qualifier
Definition cdc_desc.c:342
get_device_interface_string
static usbd_desc_t * get_device_interface_string(void)
get interface descriptor
Definition cdc_desc.c:418
vp_desc
static usbd_desc_t vp_desc
Definition cdc_desc.c:250
get_device_other_speed
static usbd_desc_t * get_device_other_speed(void)
get other speed descriptor
Definition cdc_desc.c:362
ALIGNED_TAIL
static ALIGNED_HEAD uint8_t g_usbd_desc_buffer[256] ALIGNED_TAIL
usb device standard descriptor
Definition cdc_desc.c:60
get_device_product_string
static usbd_desc_t * get_device_product_string(void)
get product descriptor
Definition cdc_desc.c:395
cdc_desc_handler
usbd_desc_handler cdc_desc_handler
device descriptor handler structure
Definition cdc_desc.c:65
get_device_config_string
static usbd_desc_t * get_device_config_string(void)
get device config descriptor
Definition cdc_desc.c:430
usbd_unicode_convert
static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf)
standard usb unicode convert
Definition cdc_desc.c:258
get_device_lang_id
static usbd_desc_t * get_device_lang_id(void)
get lang id descriptor
Definition cdc_desc.c:372
get_serial_num
static void get_serial_num(void)
usb get serial number
Definition cdc_desc.c:310
config_descriptor
static usbd_desc_t config_descriptor
Definition cdc_desc.c:230
get_device_serial_string
static usbd_desc_t * get_device_serial_string(void)
get serial descriptor
Definition cdc_desc.c:407
usbd_int_to_unicode
static void usbd_int_to_unicode(uint32_t value, uint8_t *pbuf, uint8_t len)
usb int convert to unicode
Definition cdc_desc.c:284
HBYTE
#define HBYTE(x)
Definition usb_std.h:271
USB_DEVICE_EPT_LEN
#define USB_DEVICE_EPT_LEN
Definition usb_std.h:159
USB_MAX_EP0_SIZE
#define USB_MAX_EP0_SIZE
endpoint 0 max size
Definition usb_std.h:248
USB_PRODUCT_STRING
#define USB_PRODUCT_STRING
Definition usb_std.h:105
USB_DESCIPTOR_TYPE_CONFIGURATION
#define USB_DESCIPTOR_TYPE_CONFIGURATION
Definition usb_std.h:92
LBYTE
#define LBYTE(x)
low byte and high byte define
Definition usb_std.h:270
USB_DESCIPTOR_TYPE_ENDPOINT
#define USB_DESCIPTOR_TYPE_ENDPOINT
Definition usb_std.h:95
USBD_CDC_SUBTYPE_CMF
#define USBD_CDC_SUBTYPE_CMF
Definition usb_std.h:205
USB_DEVICE_DESC_LEN
#define USB_DEVICE_DESC_LEN
Definition usb_std.h:156
USB_MFC_STRING
#define USB_MFC_STRING
Definition usb_std.h:104
USB_EPT_DESC_BULK
#define USB_EPT_DESC_BULK
Definition usb_std.h:183
USBD_CDC_SUBTYPE_HEADER
#define USBD_CDC_SUBTYPE_HEADER
usb cdc class sub-type define
Definition usb_std.h:204
USB_DEVICE_IF_DESC_LEN
#define USB_DEVICE_IF_DESC_LEN
Definition usb_std.h:158
USB_DEVICE_CFG_DESC_LEN
#define USB_DEVICE_CFG_DESC_LEN
Definition usb_std.h:157
USBD_CDC_CS_INTERFACE
#define USBD_CDC_CS_INTERFACE
usb cdc class descriptor define
Definition usb_std.h:198
USB_EPT_DESC_INTERRUPT
#define USB_EPT_DESC_INTERRUPT
Definition usb_std.h:184
USB_SERIAL_STRING
#define USB_SERIAL_STRING
Definition usb_std.h:106
USB_DESCIPTOR_TYPE_DEVICE
#define USB_DESCIPTOR_TYPE_DEVICE
usb standard device type
Definition usb_std.h:91
USB_CLASS_CODE_CDCDATA
#define USB_CLASS_CODE_CDCDATA
Definition usb_std.h:173
USB_DESCIPTOR_TYPE_STRING
#define USB_DESCIPTOR_TYPE_STRING
Definition usb_std.h:93
USB_DESCIPTOR_TYPE_INTERFACE
#define USB_DESCIPTOR_TYPE_INTERFACE
Definition usb_std.h:94
USB_CLASS_CODE_CDC
#define USB_CLASS_CODE_CDC
Definition usb_std.h:168
USBD_CDC_SUBTYPE_UFD
#define USBD_CDC_SUBTYPE_UFD
Definition usb_std.h:207
USBD_CDC_SUBTYPE_ACM
#define USBD_CDC_SUBTYPE_ACM
Definition usb_std.h:206
usbd_desc_handler
usb device descriptor handler
Definition usbd_core.h:75
usbd_desc_t
usb device descriptor struct
Definition usbd_core.h:66
usbd_desc_t::length
uint16_t length
Definition usbd_core.h:67
usbd_desc_t::descriptor
uint8_t * descriptor
Definition usbd_core.h:68
usb_std.h
usb standard header file
usbd_core.h
usb device core header file
usbd_sdr.h
usb standard request header file


AT32F413 Firmwary Library: cdc_desc.h Source File

  • middlewares
  • usbd_class
  • cdc
cdc_desc.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __CDC_DESC_H
28#define __CDC_DESC_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "cdc_class.h"
35#include "usbd_core.h"
36
51#define CDC_BCD_NUM 0x0110
52
56#define USBD_CDC_VENDOR_ID 0x2E3C
57#define USBD_CDC_PRODUCT_ID 0x5740
58
62#define USBD_CDC_CONFIG_DESC_SIZE 67
63#define USBD_CDC_SIZ_STRING_LANGID 4
64#define USBD_CDC_SIZ_STRING_SERIAL 0x1A
65
69#define USBD_CDC_DESC_MANUFACTURER_STRING "Artery"
70#define USBD_CDC_DESC_PRODUCT_STRING "AT32 Virtual Com Port "
71#define USBD_CDC_DESC_CONFIGURATION_STRING "Virtual ComPort Config"
72#define USBD_CDC_DESC_INTERFACE_STRING "Virtual ComPort Interface"
73
77#define CDC_HID_BINTERVAL_TIME 0xFF
78
82#define MCU_ID1 (0x1FFFF7E8)
83#define MCU_ID2 (0x1FFFF7EC)
84#define MCU_ID3 (0x1FFFF7F0)
89extern usbd_desc_handler cdc_desc_handler;
90
91
99#ifdef __cplusplus
100}
101#endif
102
103#endif
cdc_class.h
usb cdc class file
cdc_desc_handler
usbd_desc_handler cdc_desc_handler
device descriptor handler structure
Definition cdc_desc.c:65
usbd_desc_handler
usb device descriptor handler
Definition usbd_core.h:75
usbd_core.h
usb device core header file


AT32F413 Firmwary Library: cdc_keyboard_class.c Source File

  • middlewares
  • usbd_class
  • composite_cdc_keyboard
cdc_keyboard_class.c
Go to the documentation of this file.
1
25#include "usbd_core.h"
26#include "cdc_keyboard_class.h"
27#include "cdc_keyboard_desc.h"
28
42static usb_sts_type class_init_handler(void *udev);
43static usb_sts_type class_clear_handler(void *udev);
44static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup);
45static usb_sts_type class_ept0_tx_handler(void *udev);
46static usb_sts_type class_ept0_rx_handler(void *udev);
47static usb_sts_type class_in_handler(void *udev, uint8_t ept_num);
48static usb_sts_type class_out_handler(void *udev, uint8_t ept_num);
49static usb_sts_type class_sof_handler(void *udev);
50static usb_sts_type class_event_handler(void *udev, usbd_event_type event);
51static usb_sts_type cdc_class_setup_handler(void *udev, usb_setup_type *setup);
52static usb_sts_type keyboard_class_setup_handler(void *udev, usb_setup_type *setup);
53
54static void usb_vcp_cmd_process(void *udev, uint8_t cmd, uint8_t *buff, uint16_t len);
55
56 vcp_keyboard_type vcp_keyboard_struct;
57
58#define SHIFT 0x80
59const static unsigned char _asciimap[128] =
60{
61 0x00,// NUL
62 0x00,// SOH
63 0x00,// STX
64 0x00,// ETX
65 0x00,// EOT
66 0x00,// ENQ
67 0x00,// ACK
68 0x00,// BEL
69 0x2A,// BS Backspace
70 0x2B,// TAB Tab
71 0x28,// LF Enter
72 0x00,// VT
73 0x00,// FF
74 0x00,// CR
75 0x00,// SO
76 0x00,// SI
77 0x00,// DEL
78 0x00,// DC1
79 0x00,// DC2
80 0x00,// DC3
81 0x00,// DC4
82 0x00,// NAK
83 0x00,// SYN
84 0x00,// ETB
85 0x00,// CAN
86 0x00,// EM
87 0x00,// SUB
88 0x00,// ESC
89 0x00,// FS
90 0x00,// GS
91 0x00,// RS
92 0x00,// US
93
94 0x2C,// ' '
95 0x1E|SHIFT,// !
96 0x34|SHIFT,// "
97 0x20|SHIFT,// #
98 0x21|SHIFT,// $
99 0x22|SHIFT,// %
100 0x24|SHIFT,// &
101 0x34, // '
102 0x26|SHIFT,// (
103 0x27|SHIFT,// )
104 0x25|SHIFT,// *
105 0x2E|SHIFT,// +
106 0x36,// ,
107 0x2D,// -
108 0x37,// .
109 0x38,// /
110 0x27,// 0
111 0x1E,// 1
112 0x1F,// 2
113 0x20,// 3
114 0x21,// 4
115 0x22,// 5
116 0x23,// 6
117 0x24,// 7
118 0x25,// 8
119 0x26,// 9
120 0x33|SHIFT,// :
121 0x33, // ;
122 0x36|SHIFT,// <
123 0x2E, // =
124 0x37|SHIFT,// >
125 0x38|SHIFT,// ?
126 0x1F|SHIFT,// @
127 0x04|SHIFT,// A
128 0x05|SHIFT,// B
129 0x06|SHIFT,// C
130 0x07|SHIFT,// D
131 0x08|SHIFT,// E
132 0x09|SHIFT,// F
133 0x0A|SHIFT,// G
134 0x0B|SHIFT,// H
135 0x0C|SHIFT,// I
136 0x0D|SHIFT,// J
137 0x0E|SHIFT,// K
138 0x0F|SHIFT,// L
139 0x10|SHIFT,// M
140 0x11|SHIFT,// N
141 0x12|SHIFT,// O
142 0x13|SHIFT,// P
143 0x14|SHIFT,// Q
144 0x15|SHIFT,// R
145 0x16|SHIFT,// S
146 0x17|SHIFT,// T
147 0x18|SHIFT,// U
148 0x19|SHIFT,// V
149 0x1A|SHIFT,// W
150 0x1B|SHIFT,// X
151 0x1C|SHIFT,// Y
152 0x1D|SHIFT,// Z
153 0x2F, // [
154 0x31, // bslash
155 0x30, // ]
156 0x23|SHIFT,// ^
157 0x2D|SHIFT,// _
158 0x35, // `
159 0x04, // a
160 0x05, // b
161 0x06, // c
162 0x07, // d
163 0x08, // e
164 0x09, // f
165 0x0A, // g
166 0x0B, // h
167 0x0C, // i
168 0x0D, // j
169 0x0E, // k
170 0x0F, // l
171 0x10, // m
172 0x11, // n
173 0x12, // o
174 0x13, // p
175 0x14, // q
176 0x15, // r
177 0x16, // s
178 0x17, // t
179 0x18, // u
180 0x19, // v
181 0x1A, // w
182 0x1B, // x
183 0x1C, // y
184 0x1D, // z
185 0x2f|SHIFT,//
186 0x31|SHIFT,// |
187 0x30|SHIFT,// }
188 0x35|SHIFT,// ~
189 0 // DEL
190};
191
192 linecoding_type linecoding_vcpkybrd =
193{
194 115200,
195 0x00,
196 0x00,
197 0x08
198};
199
200/* static variable */
201
202
203/* usb device class handler */
204 usbd_class_handler cdc_keyboard_class_handler =
205{
206 class_init_handler,
207 class_clear_handler,
208 class_setup_handler,
209 class_ept0_tx_handler,
210 class_ept0_rx_handler,
211 class_in_handler,
212 class_out_handler,
213 class_sof_handler,
214 class_event_handler,
215 &vcp_keyboard_struct
216};
217
223static usb_sts_type class_init_handler(void *udev)
224{
225 usb_sts_type status = USB_OK;
226 usbd_core_type *pudev = (usbd_core_type *)udev;
227 vcp_keyboard_type *vcpkybrd = (vcp_keyboard_type *)pudev->class_handler->pdata;
228#ifndef USB_EPT_AUTO_MALLOC_BUFFER
229 /* use user define buffer address */
230 usbd_ept_buf_custom_define(pudev, USBD_VCPKYBRD_CDC_INT_EPT, EPT2_TX_ADDR);
231 usbd_ept_buf_custom_define(pudev, USBD_VCPKYBRD_CDC_BULK_IN_EPT, EPT1_TX_ADDR);
232 usbd_ept_buf_custom_define(pudev, USBD_VCPKYBRD_CDC_BULK_OUT_EPT, EPT1_RX_ADDR);
233 usbd_ept_buf_custom_define(pudev, USBD_VCPKYBRD_HID_IN_EPT, EPT3_TX_ADDR);
234#endif
235
236 /* open in endpoint */
237 usbd_ept_open(pudev, USBD_VCPKYBRD_CDC_INT_EPT, EPT_INT_TYPE, USBD_VCPKYBRD_CMD_MAXPACKET_SIZE);
238
239 /* open in endpoint */
240 usbd_ept_open(pudev, USBD_VCPKYBRD_CDC_BULK_IN_EPT, EPT_BULK_TYPE, USBD_VCPKYBRD_IN_MAXPACKET_SIZE);
241
242 /* open out endpoint */
243 usbd_ept_open(pudev, USBD_VCPKYBRD_CDC_BULK_OUT_EPT, EPT_BULK_TYPE, USBD_VCPKYBRD_OUT_MAXPACKET_SIZE);
244
245 /* open hid in endpoint */
246 usbd_ept_open(pudev, USBD_VCPKYBRD_HID_IN_EPT, EPT_INT_TYPE, USBD_VCPKYBRD_IN_MAXPACKET_SIZE);
247
248 /* set out endpoint to receive status */
249 usbd_ept_recv(pudev, USBD_VCPKYBRD_CDC_BULK_OUT_EPT, vcpkybrd->g_rx_buff, USBD_VCPKYBRD_OUT_MAXPACKET_SIZE);
250
251 vcpkybrd->g_tx_completed = 1;
252 vcpkybrd->g_keyboard_tx_completed = 1;
253
254 vcpkybrd->linecoding.bitrate = linecoding_vcpkybrd.bitrate;
255 vcpkybrd->linecoding.data = linecoding_vcpkybrd.data;
256 vcpkybrd->linecoding.format = linecoding_vcpkybrd.format;
257 vcpkybrd->linecoding.parity = linecoding_vcpkybrd.parity;
258 return status;
259}
260
266static usb_sts_type class_clear_handler(void *udev)
267{
268 usb_sts_type status = USB_OK;
269 usbd_core_type *pudev = (usbd_core_type *)udev;
270
271 /* close in endpoint */
272 usbd_ept_close(pudev, USBD_VCPKYBRD_CDC_INT_EPT);
273
274 /* close in endpoint */
275 usbd_ept_close(pudev, USBD_VCPKYBRD_CDC_BULK_IN_EPT);
276
277 /* close out endpoint */
278 usbd_ept_close(pudev, USBD_VCPKYBRD_CDC_BULK_OUT_EPT);
279
280 /* close in endpoint */
281 usbd_ept_close(pudev, USBD_VCPKYBRD_HID_IN_EPT);
282
283 return status;
284}
285
292static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
293{
294 usb_sts_type status = USB_OK;
295 usbd_core_type *pudev = (usbd_core_type *)udev;
296 switch(setup->bmRequestType & USB_REQ_RECIPIENT_MASK)
297 {
298 case USB_REQ_RECIPIENT_INTERFACE:
299 if(setup->wIndex == VCPKYBRD_KEYBOARD_INTERFACE)
300 {
301 keyboard_class_setup_handler(pudev, setup);
302 }
303 else
304 {
305 cdc_class_setup_handler(pudev, setup);
306 }
307 break;
308 case USB_REQ_RECIPIENT_ENDPOINT:
309 break;
310
311 }
312 return status;
313}
314
321static usb_sts_type cdc_class_setup_handler(void *udev, usb_setup_type *setup)
322{
323 usb_sts_type status = USB_OK;
324 usbd_core_type *pudev = (usbd_core_type *)udev;
325 vcp_keyboard_type *vcpkybrd = (vcp_keyboard_type *)pudev->class_handler->pdata;
326
327 switch(setup->bmRequestType & USB_REQ_TYPE_RESERVED)
328 {
329 /* class request */
330 case USB_REQ_TYPE_CLASS:
331 if(setup->wLength)
332 {
333 if(setup->bmRequestType & USB_REQ_DIR_DTH)
334 {
335 usb_vcp_cmd_process(udev, setup->bRequest, vcpkybrd->g_cmd, setup->wLength);
336 usbd_ctrl_send(pudev, vcpkybrd->g_cmd, setup->wLength);
337 }
338 else
339 {
340 vcpkybrd->g_req = setup->bRequest;
341 vcpkybrd->g_len = setup->wLength;
342 usbd_ctrl_recv(pudev, vcpkybrd->g_cmd, vcpkybrd->g_len);
343
344 }
345 }
346 break;
347 /* standard request */
348 case USB_REQ_TYPE_STANDARD:
349 switch(setup->bRequest)
350 {
351 case USB_STD_REQ_GET_DESCRIPTOR:
352 usbd_ctrl_unsupport(pudev);
353 break;
354 case USB_STD_REQ_GET_INTERFACE:
355 usbd_ctrl_send(pudev, (uint8_t *)&vcpkybrd->alt_setting, 1);
356 break;
357 case USB_STD_REQ_SET_INTERFACE:
358 vcpkybrd->alt_setting = setup->wValue;
359 break;
360 case USB_STD_REQ_CLEAR_FEATURE:
361 break;
362 case USB_STD_REQ_SET_FEATURE:
363 break;
364 default:
365 usbd_ctrl_unsupport(pudev);
366 break;
367 }
368 break;
369 default:
370 usbd_ctrl_unsupport(pudev);
371 break;
372 }
373 return status;
374}
375
382static usb_sts_type keyboard_class_setup_handler(void *udev, usb_setup_type *setup)
383{
384 usb_sts_type status = USB_OK;
385 usbd_core_type *pudev = (usbd_core_type *)udev;
386 vcp_keyboard_type *vcpkybrd = (vcp_keyboard_type *)pudev->class_handler->pdata;
387 uint16_t len;
388 uint8_t *buf;
389
390 switch(setup->bmRequestType & USB_REQ_TYPE_RESERVED)
391 {
392 /* class request */
393 case USB_REQ_TYPE_CLASS:
394 switch(setup->bRequest)
395 {
396 case HID_REQ_SET_PROTOCOL:
397 vcpkybrd->hid_protocol = (uint8_t)setup->wValue;
398 break;
399 case HID_REQ_GET_PROTOCOL:
400 usbd_ctrl_send(pudev, (uint8_t *)&vcpkybrd->hid_protocol, 1);
401 break;
402 case HID_REQ_SET_IDLE:
403 vcpkybrd->hid_set_idle = (uint8_t)(setup->wValue >> 8);
404 break;
405 case HID_REQ_GET_IDLE:
406 usbd_ctrl_send(pudev, (uint8_t *)&vcpkybrd->hid_set_idle, 1);
407 break;
408 case HID_REQ_SET_REPORT:
409 vcpkybrd->hid_state = HID_REQ_SET_REPORT;
410 usbd_ctrl_recv(pudev, vcpkybrd->hid_set_report, setup->wLength);
411 break;
412 default:
413 usbd_ctrl_unsupport(pudev);
414 break;
415 }
416 break;
417 /* standard request */
418 case USB_REQ_TYPE_STANDARD:
419 switch(setup->bRequest)
420 {
421 case USB_STD_REQ_GET_DESCRIPTOR:
422 if(setup->wValue >> 8 == HID_REPORT_DESC)
423 {
424 len = MIN(USBD_VCPKYBRD_HID_SIZ_REPORT_DESC, setup->wLength);
425 buf = (uint8_t *)g_usbd_vcpkybrd_hid_report;
426 usbd_ctrl_send(pudev, (uint8_t *)buf, len);
427 }
428 else if(setup->wValue >> 8 == HID_DESCRIPTOR_TYPE)
429 {
430 len = MIN(9, setup->wLength);
431 buf = (uint8_t *)g_vcpkybrd_hid_usb_desc;
432 usbd_ctrl_send(pudev, (uint8_t *)buf, len);
433 }
434 else
435 {
436 usbd_ctrl_unsupport(pudev);
437 }
438 break;
439 case USB_STD_REQ_GET_INTERFACE:
440 usbd_ctrl_send(pudev, (uint8_t *)&vcpkybrd->alt_setting, 1);
441 break;
442 case USB_STD_REQ_SET_INTERFACE:
443 vcpkybrd->alt_setting = setup->wValue;
444 break;
445 case USB_STD_REQ_CLEAR_FEATURE:
446 break;
447 case USB_STD_REQ_SET_FEATURE:
448 break;
449 default:
450 usbd_ctrl_unsupport(pudev);
451 break;
452 }
453 break;
454 default:
455 usbd_ctrl_unsupport(pudev);
456 break;
457 }
458 return status;
459}
460
466static usb_sts_type class_ept0_tx_handler(void *udev)
467{
468 usb_sts_type status = USB_OK;
469
470 /* ...user code... */
471
472 return status;
473}
474
480static usb_sts_type class_ept0_rx_handler(void *udev)
481{
482 usb_sts_type status = USB_OK;
483 usbd_core_type *pudev = (usbd_core_type *)udev;
484 vcp_keyboard_type *vcpkybrd = (vcp_keyboard_type *)pudev->class_handler->pdata;
485 uint32_t recv_len = usbd_get_recv_len(pudev, 0);
486 /* ...user code... */
487 if( vcpkybrd->g_req == SET_LINE_CODING)
488 {
489 /* class process */
490 usb_vcp_cmd_process(udev, vcpkybrd->g_req, vcpkybrd->g_cmd, recv_len);
491 }
492
493 if( vcpkybrd->hid_state == HID_REQ_SET_REPORT)
494 {
495 /* hid buffer process */
496 vcpkybrd->hid_state = 0;
497 }
498 return status;
499}
500
507static usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
508{
509 usb_sts_type status = USB_OK;
510 usbd_core_type *pudev = (usbd_core_type *)udev;
511 vcp_keyboard_type *vcpkybrd = (vcp_keyboard_type *)pudev->class_handler->pdata;
512
513 /* ...user code...
514 trans next packet data
515 */
516 if((ept_num & 0x7F) == (USBD_VCPKYBRD_CDC_BULK_IN_EPT & 0x7F))
517 {
518 vcpkybrd->g_tx_completed = 1;
519 }
520 if((ept_num & 0x7F) == (USBD_VCPKYBRD_HID_IN_EPT & 0x7F))
521 {
522 vcpkybrd->g_keyboard_tx_completed = 1;
523 }
524
525
526 return status;
527}
528
535static usb_sts_type class_out_handler(void *udev, uint8_t ept_num)
536{
537 usb_sts_type status = USB_OK;
538 usbd_core_type *pudev = (usbd_core_type *)udev;
539 vcp_keyboard_type *vcpkybrd = (vcp_keyboard_type *)pudev->class_handler->pdata;
540
541 /* get endpoint receive data length */
542 vcpkybrd->g_rxlen = usbd_get_recv_len(pudev, ept_num);
543
544 /*set recv flag*/
545 vcpkybrd->g_rx_completed = 1;
546
547 return status;
548}
549
555static usb_sts_type class_sof_handler(void *udev)
556{
557 usb_sts_type status = USB_OK;
558
559 /* ...user code... */
560
561 return status;
562}
563
570static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
571{
572 usb_sts_type status = USB_OK;
573 switch(event)
574 {
575 case USBD_RESET_EVENT:
576
577 /* ...user code... */
578
579 break;
580 case USBD_SUSPEND_EVENT:
581
582 /* ...user code... */
583
584 break;
585 case USBD_WAKEUP_EVENT:
586 /* ...user code... */
587
588 break;
589 default:
590 break;
591 }
592 return status;
593}
594
601uint16_t usb_vcpkybrd_vcp_get_rxdata(void *udev, uint8_t *recv_data)
602{
603 uint16_t i_index = 0;
604 usbd_core_type *pudev = (usbd_core_type *)udev;
605 vcp_keyboard_type *vcpkybrd = (vcp_keyboard_type *)pudev->class_handler->pdata;
606 uint16_t tmp_len = 0;
607
608 if(vcpkybrd->g_rx_completed == 0)
609 {
610 return 0;
611 }
612 vcpkybrd->g_rx_completed = 0;
613
614 tmp_len = vcpkybrd->g_rxlen;
615 for(i_index = 0; i_index < vcpkybrd->g_rxlen; i_index ++)
616 {
617 recv_data[i_index] = vcpkybrd->g_rx_buff[i_index];
618 }
619
620 usbd_ept_recv(pudev, USBD_VCPKYBRD_CDC_BULK_OUT_EPT, vcpkybrd->g_rx_buff, USBD_VCPKYBRD_OUT_MAXPACKET_SIZE);
621
622 return tmp_len;
623}
624
632 error_status usb_vcpkybrd_vcp_send_data(void *udev, uint8_t *send_data, uint16_t len)
633{
634 error_status status = SUCCESS;
635 usbd_core_type *pudev = (usbd_core_type *)udev;
636 vcp_keyboard_type *vcpkybrd = (vcp_keyboard_type *)pudev->class_handler->pdata;
637 if(vcpkybrd->g_tx_completed)
638 {
639 vcpkybrd->g_tx_completed = 0;
640 usbd_ept_send(pudev, USBD_VCPKYBRD_CDC_BULK_IN_EPT, send_data, len);
641 }
642 else
643 {
644 status = ERROR;
645 }
646 return status;
647}
648
649
658static void usb_vcp_cmd_process(void *udev, uint8_t cmd, uint8_t *buff, uint16_t len)
659{
660 usbd_core_type *pudev = (usbd_core_type *)udev;
661 vcp_keyboard_type *vcpkybrd = (vcp_keyboard_type *)pudev->class_handler->pdata;
662 switch(cmd)
663 {
664 case SET_LINE_CODING:
665 vcpkybrd->linecoding.bitrate = (uint32_t)(buff[0] | (buff[1] << 8) | (buff[2] << 16) | (buff[3] <<24));
666 vcpkybrd->linecoding.format = buff[4];
667 vcpkybrd->linecoding.parity = buff[5];
668 vcpkybrd->linecoding.data = buff[6];
669 break;
670
671 case GET_LINE_CODING:
672 buff[0] = (uint8_t)vcpkybrd->linecoding.bitrate;
673 buff[1] = (uint8_t)(vcpkybrd->linecoding.bitrate >> 8);
674 buff[2] = (uint8_t)(vcpkybrd->linecoding.bitrate >> 16);
675 buff[3] = (uint8_t)(vcpkybrd->linecoding.bitrate >> 24);
676 buff[4] = (uint8_t)(vcpkybrd->linecoding.format);
677 buff[5] = (uint8_t)(vcpkybrd->linecoding.parity);
678 buff[6] = (uint8_t)(vcpkybrd->linecoding.data);
679 break;
680
681 default:
682 break;
683 }
684}
685
693 usb_sts_type usb_vcpkybrd_class_send_report(void *udev, uint8_t *report, uint16_t len)
694{
695 usb_sts_type status = USB_OK;
696 usbd_core_type *pudev = (usbd_core_type *)udev;
697
698 if(usbd_connect_state_get(pudev) == USB_CONN_STATE_CONFIGURED)
699 usbd_ept_send(pudev, USBD_VCPKYBRD_HID_IN_EPT, report, len);
700
701 return status;
702}
703
704
711void usb_vcpkybrd_keyboard_send_char(void *udev, uint8_t ascii_code)
712{
713 uint8_t key_data = 0;
714 static uint8_t temp = 0;
715 static uint8_t keyboard_buf[8] = {0, 0, 6, 0, 0, 0, 0, 0};
716
717 if(ascii_code > 128)
718 {
719 ascii_code = 0;
720 }
721 else
722 {
723 ascii_code = _asciimap[ascii_code];
724 if(!ascii_code)
725 {
726 ascii_code = 0;
727 }
728
729 if(ascii_code & SHIFT)
730 {
731 key_data = 0x2;
732 ascii_code &= 0x7F;
733 }
734 }
735
736 if((temp == ascii_code) && (ascii_code != 0))
737 {
738 keyboard_buf[0] = 0;
739 keyboard_buf[2] = 0;
740 usb_vcpkybrd_class_send_report(udev, keyboard_buf, 8);
741 }
742 else
743 {
744 keyboard_buf[0] = key_data;
745 keyboard_buf[2] = ascii_code;
746 usb_vcpkybrd_class_send_report(udev, keyboard_buf, 8);
747 }
748}
749
cdc_keyboard_class.h
usb cdc and keyboard class file
cdc_keyboard_desc.h
usb cdc and keyboard descriptor header file
EPT3_TX_ADDR
#define EPT3_TX_ADDR
Definition project/at_start_f413/examples/acc/calibration/inc/usb_conf.h:82
EPT1_RX_ADDR
#define EPT1_RX_ADDR
Definition project/at_start_f413/examples/acc/calibration/inc/usb_conf.h:77
EPT1_TX_ADDR
#define EPT1_TX_ADDR
Definition project/at_start_f413/examples/acc/calibration/inc/usb_conf.h:76
EPT2_TX_ADDR
#define EPT2_TX_ADDR
Definition project/at_start_f413/examples/acc/calibration/inc/usb_conf.h:79
error_status
error_status
error status
Definition at32f413.h:302
ERROR
@ ERROR
Definition at32f413.h:302
SUCCESS
@ SUCCESS
Definition at32f413.h:302
USBD_VCPKYBRD_CMD_MAXPACKET_SIZE
#define USBD_VCPKYBRD_CMD_MAXPACKET_SIZE
Definition cdc_keyboard_class.h:62
USBD_VCPKYBRD_HID_IN_EPT
#define USBD_VCPKYBRD_HID_IN_EPT
Definition cdc_keyboard_class.h:55
USBD_VCPKYBRD_IN_MAXPACKET_SIZE
#define USBD_VCPKYBRD_IN_MAXPACKET_SIZE
usb in and out max packet size define
Definition cdc_keyboard_class.h:60
USBD_VCPKYBRD_OUT_MAXPACKET_SIZE
#define USBD_VCPKYBRD_OUT_MAXPACKET_SIZE
Definition cdc_keyboard_class.h:61
USBD_VCPKYBRD_CDC_INT_EPT
#define USBD_VCPKYBRD_CDC_INT_EPT
usb use endpoint define
Definition cdc_keyboard_class.h:52
USBD_VCPKYBRD_CDC_BULK_IN_EPT
#define USBD_VCPKYBRD_CDC_BULK_IN_EPT
Definition cdc_keyboard_class.h:53
USBD_VCPKYBRD_CDC_BULK_OUT_EPT
#define USBD_VCPKYBRD_CDC_BULK_OUT_EPT
Definition cdc_keyboard_class.h:54
class_sof_handler
static usb_sts_type class_sof_handler(void *udev)
usb device class sof handler
Definition cdc_keyboard_class.c:555
usb_vcpkybrd_vcp_send_data
error_status usb_vcpkybrd_vcp_send_data(void *udev, uint8_t *send_data, uint16_t len)
usb device class send data
Definition cdc_keyboard_class.c:632
class_in_handler
static usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
usb device class transmision complete handler
Definition cdc_keyboard_class.c:507
usb_vcpkybrd_keyboard_send_char
void usb_vcpkybrd_keyboard_send_char(void *udev, uint8_t ascii_code)
usb keyoard send char
Definition cdc_keyboard_class.c:711
usb_vcpkybrd_class_send_report
usb_sts_type usb_vcpkybrd_class_send_report(void *udev, uint8_t *report, uint16_t len)
usb device class send report
Definition cdc_keyboard_class.c:693
_asciimap
static const unsigned char _asciimap[128]
Definition cdc_keyboard_class.c:59
class_clear_handler
static usb_sts_type class_clear_handler(void *udev)
clear endpoint or other state
Definition cdc_keyboard_class.c:266
class_setup_handler
static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
usb device class setup request handler
Definition cdc_keyboard_class.c:292
class_ept0_tx_handler
static usb_sts_type class_ept0_tx_handler(void *udev)
usb device class endpoint 0 in status stage complete
Definition cdc_keyboard_class.c:466
class_ept0_rx_handler
static usb_sts_type class_ept0_rx_handler(void *udev)
usb device class endpoint 0 out status stage complete
Definition cdc_keyboard_class.c:480
cdc_keyboard_class_handler
usbd_class_handler cdc_keyboard_class_handler
Definition cdc_keyboard_class.c:204
class_event_handler
static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
usb device class event handler
Definition cdc_keyboard_class.c:570
usb_vcp_cmd_process
static void usb_vcp_cmd_process(void *udev, uint8_t cmd, uint8_t *buff, uint16_t len)
usb device class request function
Definition cdc_keyboard_class.c:658
class_init_handler
static usb_sts_type class_init_handler(void *udev)
initialize usb endpoint
Definition cdc_keyboard_class.c:223
cdc_class_setup_handler
static usb_sts_type cdc_class_setup_handler(void *udev, usb_setup_type *setup)
usb device class setup request handler
Definition cdc_keyboard_class.c:321
class_out_handler
static usb_sts_type class_out_handler(void *udev, uint8_t ept_num)
usb device class endpoint receive data
Definition cdc_keyboard_class.c:535
SHIFT
#define SHIFT
Definition cdc_keyboard_class.c:58
usb_vcpkybrd_vcp_get_rxdata
uint16_t usb_vcpkybrd_vcp_get_rxdata(void *udev, uint8_t *recv_data)
usb device class rx data process
Definition cdc_keyboard_class.c:601
vcp_keyboard_struct
vcp_keyboard_type vcp_keyboard_struct
Definition cdc_keyboard_class.c:56
keyboard_class_setup_handler
static usb_sts_type keyboard_class_setup_handler(void *udev, usb_setup_type *setup)
usb device class setup request handler
Definition cdc_keyboard_class.c:382
linecoding_vcpkybrd
linecoding_type linecoding_vcpkybrd
Definition cdc_keyboard_class.c:192
VCPKYBRD_KEYBOARD_INTERFACE
#define VCPKYBRD_KEYBOARD_INTERFACE
Definition cdc_keyboard_desc.h:87
USBD_VCPKYBRD_HID_SIZ_REPORT_DESC
#define USBD_VCPKYBRD_HID_SIZ_REPORT_DESC
Definition cdc_keyboard_desc.h:65
g_usbd_vcpkybrd_hid_report
uint8_t g_usbd_vcpkybrd_hid_report[63]
g_vcpkybrd_hid_usb_desc
uint8_t g_vcpkybrd_hid_usb_desc[9]
EPT_INT_TYPE
@ EPT_INT_TYPE
Definition at32f413_usb.h:205
EPT_BULK_TYPE
@ EPT_BULK_TYPE
Definition at32f413_usb.h:204
GET_LINE_CODING
#define GET_LINE_CODING
Definition cdc_msc_class.h:106
SET_LINE_CODING
#define SET_LINE_CODING
Definition cdc_msc_class.h:105
USB_STD_REQ_CLEAR_FEATURE
#define USB_STD_REQ_CLEAR_FEATURE
Definition usb_std.h:77
HID_DESCRIPTOR_TYPE
#define HID_DESCRIPTOR_TYPE
Definition usb_std.h:242
HID_REQ_GET_PROTOCOL
#define HID_REQ_GET_PROTOCOL
Definition usb_std.h:237
MIN
#define MIN(a, b)
min and max define
Definition usb_std.h:260
USB_REQ_TYPE_STANDARD
#define USB_REQ_TYPE_STANDARD
usb request type
Definition usb_std.h:62
USB_STD_REQ_GET_DESCRIPTOR
#define USB_STD_REQ_GET_DESCRIPTOR
Definition usb_std.h:80
HID_REQ_SET_PROTOCOL
#define HID_REQ_SET_PROTOCOL
usb hid class request code define
Definition usb_std.h:236
HID_REPORT_DESC
#define HID_REPORT_DESC
Definition usb_std.h:243
USB_STD_REQ_SET_FEATURE
#define USB_STD_REQ_SET_FEATURE
Definition usb_std.h:78
HID_REQ_SET_IDLE
#define HID_REQ_SET_IDLE
Definition usb_std.h:238
HID_REQ_GET_IDLE
#define HID_REQ_GET_IDLE
Definition usb_std.h:239
USB_REQ_DIR_DTH
#define USB_REQ_DIR_DTH
Definition usb_std.h:71
HID_REQ_SET_REPORT
#define HID_REQ_SET_REPORT
Definition usb_std.h:240
USB_REQ_RECIPIENT_MASK
#define USB_REQ_RECIPIENT_MASK
Definition usb_std.h:57
USB_STD_REQ_SET_INTERFACE
#define USB_STD_REQ_SET_INTERFACE
Definition usb_std.h:85
USB_REQ_TYPE_RESERVED
#define USB_REQ_TYPE_RESERVED
Definition usb_std.h:65
USB_STD_REQ_GET_INTERFACE
#define USB_STD_REQ_GET_INTERFACE
Definition usb_std.h:84
USB_REQ_RECIPIENT_ENDPOINT
#define USB_REQ_RECIPIENT_ENDPOINT
Definition usb_std.h:55
USB_REQ_RECIPIENT_INTERFACE
#define USB_REQ_RECIPIENT_INTERFACE
Definition usb_std.h:54
USB_REQ_TYPE_CLASS
#define USB_REQ_TYPE_CLASS
Definition usb_std.h:63
USB_CONN_STATE_CONFIGURED
@ USB_CONN_STATE_CONFIGURED
Definition usb_std.h:137
usb_sts_type
usb_sts_type
usb return status
Definition usb_std.h:285
USB_OK
@ USB_OK
Definition usb_std.h:286
usbd_connect_state_get
usbd_conn_state usbd_connect_state_get(usbd_core_type *udev)
get usb connect state
Definition usbd_core.c:595
usbd_ept_close
void usbd_ept_close(usbd_core_type *udev, uint8_t ept_addr)
usb close endpoint
Definition usbd_core.c:541
usbd_ept_recv
void usbd_ept_recv(usbd_core_type *udev, uint8_t ept_num, uint8_t *buffer, uint16_t len)
usb endpoint receive data
Definition usbd_core.c:364
usbd_ept_buf_custom_define
void usbd_ept_buf_custom_define(usbd_core_type *udev, uint8_t ept_addr, uint32_t addr)
usb custom define endpoint buffer
Definition usbd_core.c:464
usbd_ept_open
void usbd_ept_open(usbd_core_type *udev, uint8_t ept_addr, uint8_t ept_type, uint16_t maxpacket)
usb open endpoint
Definition usbd_core.c:506
usbd_ctrl_send
void usbd_ctrl_send(usbd_core_type *udev, uint8_t *buffer, uint16_t len)
usb control endpoint send data
Definition usbd_core.c:175
usbd_get_recv_len
uint32_t usbd_get_recv_len(usbd_core_type *udev, uint8_t ept_addr)
usb endpoint get receive data length
Definition usbd_core.c:397
usbd_ctrl_recv
void usbd_ctrl_recv(usbd_core_type *udev, uint8_t *buffer, uint16_t len)
usb control endpoint receive data
Definition usbd_core.c:194
usbd_ctrl_unsupport
void usbd_ctrl_unsupport(usbd_core_type *udev)
un-support device request
Definition usbd_core.c:289
usbd_ept_send
void usbd_ept_send(usbd_core_type *udev, uint8_t ept_num, uint8_t *buffer, uint16_t len)
usb endpoint send data
Definition usbd_core.c:304
usbd_event_type
usbd_event_type
usb device event
Definition usbd_core.h:54
USBD_SUSPEND_EVENT
@ USBD_SUSPEND_EVENT
Definition usbd_core.h:57
USBD_RESET_EVENT
@ USBD_RESET_EVENT
Definition usbd_core.h:56
USBD_WAKEUP_EVENT
@ USBD_WAKEUP_EVENT
Definition usbd_core.h:58
linecoding_type
usb cdc class set line coding struct
Definition usb_std.h:219
linecoding_type::bitrate
uint32_t bitrate
Definition usb_std.h:220
linecoding_type::data
uint8_t data
Definition usb_std.h:223
linecoding_type::parity
uint8_t parity
Definition usb_std.h:222
linecoding_type::format
uint8_t format
Definition usb_std.h:221
usb_setup_type
format of usb setup data
Definition usb_std.h:297
usb_setup_type::wValue
uint16_t wValue
Definition usb_std.h:300
usb_setup_type::wLength
uint16_t wLength
Definition usb_std.h:303
usb_setup_type::bmRequestType
uint8_t bmRequestType
Definition usb_std.h:298
usb_setup_type::wIndex
uint16_t wIndex
Definition usb_std.h:301
usb_setup_type::bRequest
uint8_t bRequest
Definition usb_std.h:299
usbd_class_handler
usb device class handler
Definition usbd_core.h:97
usbd_class_handler::pdata
void * pdata
Definition usbd_core.h:107
usbd_core_type
usb device core struct type
Definition usbd_core.h:114
usbd_core_type::class_handler
usbd_class_handler * class_handler
Definition usbd_core.h:117
vcp_keyboard_type
Definition cdc_keyboard_class.h:74
vcp_keyboard_type::g_cmd
uint8_t g_cmd[0x08]
Definition cdc_keyboard_class.h:81
vcp_keyboard_type::g_len
uint16_t g_len
Definition cdc_keyboard_class.h:84
vcp_keyboard_type::hid_state
uint8_t hid_state
Definition cdc_keyboard_class.h:83
vcp_keyboard_type::hid_set_idle
uint32_t hid_set_idle
Definition cdc_keyboard_class.h:77
vcp_keyboard_type::alt_setting
uint32_t alt_setting
Definition cdc_keyboard_class.h:75
vcp_keyboard_type::g_keyboard_tx_completed
__IO uint8_t g_keyboard_tx_completed
Definition cdc_keyboard_class.h:87
vcp_keyboard_type::g_rxlen
uint16_t g_rxlen
Definition cdc_keyboard_class.h:84
vcp_keyboard_type::g_tx_completed
__IO uint8_t g_tx_completed
Definition cdc_keyboard_class.h:85
vcp_keyboard_type::g_rx_buff
uint8_t g_rx_buff[0x40]
Definition cdc_keyboard_class.h:80
vcp_keyboard_type::g_req
uint8_t g_req
Definition cdc_keyboard_class.h:82
vcp_keyboard_type::hid_set_report
uint8_t hid_set_report[64]
Definition cdc_keyboard_class.h:79
vcp_keyboard_type::g_rx_completed
__IO uint8_t g_rx_completed
Definition cdc_keyboard_class.h:86
vcp_keyboard_type::hid_protocol
uint32_t hid_protocol
Definition cdc_keyboard_class.h:76
vcp_keyboard_type::linecoding
linecoding_type linecoding
Definition cdc_keyboard_class.h:89
usbd_core.h
usb device core header file


AT32F413 Firmwary Library: cdc_keyboard_class.h Source File

  • middlewares
  • usbd_class
  • composite_cdc_keyboard
cdc_keyboard_class.h
Go to the documentation of this file.
1
26 /* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __CDC_KEYBOARD_CLASS_H
28#define __CDC_KEYBOARD_CLASS_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "usb_std.h"
35#include "usbd_core.h"
36
52#define USBD_VCPKYBRD_CDC_INT_EPT 0x82
53#define USBD_VCPKYBRD_CDC_BULK_IN_EPT 0x81
54#define USBD_VCPKYBRD_CDC_BULK_OUT_EPT 0x01
55#define USBD_VCPKYBRD_HID_IN_EPT 0x83
56
60#define USBD_VCPKYBRD_IN_MAXPACKET_SIZE 0x40
61#define USBD_VCPKYBRD_OUT_MAXPACKET_SIZE 0x40
62#define USBD_VCPKYBRD_CMD_MAXPACKET_SIZE 0x08
63
64
73typedef struct
74{
75 uint32_t alt_setting;
76 uint32_t hid_protocol;
77 uint32_t hid_set_idle;
78
79 uint8_t hid_set_report[64];
80 uint8_t g_rx_buff[USBD_VCPKYBRD_OUT_MAXPACKET_SIZE];
81 uint8_t g_cmd[USBD_VCPKYBRD_CMD_MAXPACKET_SIZE];
82 uint8_t g_req;
83 uint8_t hid_state;
84 uint16_t g_len, g_rxlen;
85 __IO uint8_t g_tx_completed;
86 __IO uint8_t g_rx_completed;
87 __IO uint8_t g_keyboard_tx_completed;
88
89 linecoding_type linecoding;
90}vcp_keyboard_type;
91
99extern usbd_class_handler cdc_keyboard_class_handler;
100uint16_t usb_vcpkybrd_vcp_get_rxdata(void *udev, uint8_t *recv_data);
101 error_status usb_vcpkybrd_vcp_send_data(void *udev, uint8_t *send_data, uint16_t len);
102 usb_sts_type usb_vcpkybrd_class_send_report(void *udev, uint8_t *report, uint16_t len);
103void usb_vcpkybrd_keyboard_send_char(void *udev, uint8_t ascii_code);
104
116#ifdef __cplusplus
117}
118#endif
119
120#endif
121
122
123
124
error_status
error_status
error status
Definition at32f413.h:302
usb_vcpkybrd_vcp_send_data
error_status usb_vcpkybrd_vcp_send_data(void *udev, uint8_t *send_data, uint16_t len)
usb device class send data
Definition cdc_keyboard_class.c:632
usb_vcpkybrd_keyboard_send_char
void usb_vcpkybrd_keyboard_send_char(void *udev, uint8_t ascii_code)
usb keyoard send char
Definition cdc_keyboard_class.c:711
usb_vcpkybrd_class_send_report
usb_sts_type usb_vcpkybrd_class_send_report(void *udev, uint8_t *report, uint16_t len)
usb device class send report
Definition cdc_keyboard_class.c:693
cdc_keyboard_class_handler
usbd_class_handler cdc_keyboard_class_handler
Definition cdc_keyboard_class.c:204
usb_vcpkybrd_vcp_get_rxdata
uint16_t usb_vcpkybrd_vcp_get_rxdata(void *udev, uint8_t *recv_data)
usb device class rx data process
Definition cdc_keyboard_class.c:601
USBD_VCPKYBRD_CMD_MAXPACKET_SIZE
#define USBD_VCPKYBRD_CMD_MAXPACKET_SIZE
Definition cdc_keyboard_class.h:62
USBD_VCPKYBRD_OUT_MAXPACKET_SIZE
#define USBD_VCPKYBRD_OUT_MAXPACKET_SIZE
Definition cdc_keyboard_class.h:61
usb_sts_type
usb_sts_type
usb return status
Definition usb_std.h:285
linecoding_type
usb cdc class set line coding struct
Definition usb_std.h:219
usbd_class_handler
usb device class handler
Definition usbd_core.h:97
vcp_keyboard_type
Definition cdc_keyboard_class.h:74
vcp_keyboard_type::g_len
uint16_t g_len
Definition cdc_keyboard_class.h:84
vcp_keyboard_type::hid_state
uint8_t hid_state
Definition cdc_keyboard_class.h:83
vcp_keyboard_type::hid_set_idle
uint32_t hid_set_idle
Definition cdc_keyboard_class.h:77
vcp_keyboard_type::alt_setting
uint32_t alt_setting
Definition cdc_keyboard_class.h:75
vcp_keyboard_type::g_keyboard_tx_completed
__IO uint8_t g_keyboard_tx_completed
Definition cdc_keyboard_class.h:87
vcp_keyboard_type::g_tx_completed
__IO uint8_t g_tx_completed
Definition cdc_keyboard_class.h:85
vcp_keyboard_type::g_req
uint8_t g_req
Definition cdc_keyboard_class.h:82
vcp_keyboard_type::g_rx_completed
__IO uint8_t g_rx_completed
Definition cdc_keyboard_class.h:86
vcp_keyboard_type::hid_protocol
uint32_t hid_protocol
Definition cdc_keyboard_class.h:76
vcp_keyboard_type::linecoding
linecoding_type linecoding
Definition cdc_keyboard_class.h:89
usb_std.h
usb standard header file
usbd_core.h
usb device core header file


AT32F413 Firmwary Library: cdc_keyboard_desc.c Source File

  • middlewares
  • usbd_class
  • composite_cdc_keyboard
cdc_keyboard_desc.c
Go to the documentation of this file.
1
25#include "usb_std.h"
26#include "usbd_sdr.h"
27#include "usbd_core.h"
28#include "cdc_keyboard_desc.h"
42static usbd_desc_t *get_device_descriptor(void);
43static usbd_desc_t *get_device_qualifier(void);
44static usbd_desc_t *get_device_configuration(void);
45static usbd_desc_t *get_device_other_speed(void);
46static usbd_desc_t *get_device_lang_id(void);
47static usbd_desc_t *get_device_manufacturer_string(void);
48static usbd_desc_t *get_device_product_string(void);
49static usbd_desc_t *get_device_serial_string(void);
50static usbd_desc_t *get_device_interface_string(void);
51static usbd_desc_t *get_device_config_string(void);
52
53static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf);
54static void usbd_int_to_unicode (uint32_t value , uint8_t *pbuf , uint8_t len);
55static void get_serial_num(void);
56#if defined ( __ICCARM__ ) /* iar compiler */
57 #pragma data_alignment=4
58#endif
59ALIGNED_HEAD static uint8_t g_usbd_desc_buffer[256] ALIGNED_TAIL;
60
64 usbd_desc_handler cdc_keyboard_desc_handler =
65{
66 get_device_descriptor,
67 get_device_qualifier,
68 get_device_configuration,
69 get_device_other_speed,
70 get_device_lang_id,
71 get_device_manufacturer_string,
72 get_device_product_string,
73 get_device_serial_string,
74 get_device_interface_string,
75 get_device_config_string,
76};
77
81#if defined ( __ICCARM__ ) /* iar compiler */
82 #pragma data_alignment=4
83#endif
84ALIGNED_HEAD static uint8_t g_usbd_descriptor[USB_DEVICE_DESC_LEN] ALIGNED_TAIL =
85{
86 USB_DEVICE_DESC_LEN, /* bLength */
87 USB_DESCIPTOR_TYPE_DEVICE, /* bDescriptorType */
88 0x00, /* bcdUSB */
89 0x02,
90 0xEF, /* bDeviceClass */
91 0x02, /* bDeviceSubClass */
92 0x01, /* bDeviceProtocol */
93 USB_MAX_EP0_SIZE, /* bMaxPacketSize */
94 LBYTE(USBD_VCPKYBRD_VENDOR_ID), /* idVendor */
95 HBYTE(USBD_VCPKYBRD_VENDOR_ID), /* idVendor */
96 LBYTE(USBD_VCPKYBRD_PRODUCT_ID), /* idProduct */
97 HBYTE(USBD_VCPKYBRD_PRODUCT_ID), /* idProduct */
98 0x00, /* bcdDevice rel. 2.00 */
99 0x02,
100 USB_MFC_STRING, /* Index of manufacturer string */
101 USB_PRODUCT_STRING, /* Index of product string */
102 USB_SERIAL_STRING, /* Index of serial number string */
103 1 /* bNumConfigurations */
104};
105
109#if defined ( __ICCARM__ ) /* iar compiler */
110 #pragma data_alignment=4
111#endif
112ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_VCPKYBRD_CONFIG_DESC_SIZE] ALIGNED_TAIL =
113{
114 USB_DEVICE_CFG_DESC_LEN, /* bLength: configuration descriptor size */
115 USB_DESCIPTOR_TYPE_CONFIGURATION, /* bDescriptorType: configuration */
116 LBYTE(USBD_VCPKYBRD_CONFIG_DESC_SIZE), /* wTotalLength: bytes returned */
117 HBYTE(USBD_VCPKYBRD_CONFIG_DESC_SIZE), /* wTotalLength: bytes returned */
118 0x03, /* bNumInterfaces: 2 interface */
119 0x01, /* bConfigurationValue: configuration value */
120 0x00, /* iConfiguration: index of string descriptor describing
121 the configuration */
122 0xC0, /* bmAttributes: self powered */
123 0x32, /* MaxPower 100 mA: this current is used for detecting vbus */
124
125 0x08, /* bLength */
126 0x0B, /* bDescriptorType */
127 0x00, /* bFirstInterface */
128 0x02, /* bInterfaceCount */
129 0x02, /* bFunctionClass */
130 0x02, /* bFunctionSubClass */
131 0x01, /* bFunctionProtocol */
132 0x00, /* iFunction (Index of string descriptor describing this function) */
133
134 USB_DEVICE_IF_DESC_LEN, /* bLength: interface descriptor size */
135 USB_DESCIPTOR_TYPE_INTERFACE, /* bDescriptorType: interface descriptor type */
136 VCPKYBRD_CDC_INTERFACE, /* bInterfaceNumber: number of interface */
137 0x00, /* bAlternateSetting: alternate set */
138 0x01, /* bNumEndpoints: number of endpoints */
139 USB_CLASS_CODE_CDC, /* bInterfaceClass: CDC class code */
140 0x02, /* bInterfaceSubClass: subclass code, Abstract Control Model*/
141 0x01, /* bInterfaceProtocol: protocol code, AT Command */
142 0x00, /* iInterface: index of string descriptor */
143
144 0x05, /* bFunctionLength: size of this descriptor in bytes */
145 USBD_CDC_CS_INTERFACE, /* bDescriptorType: CDC interface descriptor type */
146 USBD_CDC_SUBTYPE_HEADER, /* bDescriptorSubtype: Header function Descriptor 0x00*/
147 LBYTE(VCPKYBRD_BCD_NUM),
148 HBYTE(VCPKYBRD_BCD_NUM), /* bcdCDC: USB class definitions for communications */
149
150 0x05, /* bFunctionLength: size of this descriptor in bytes */
151 USBD_CDC_CS_INTERFACE, /* bDescriptorType: CDC interface descriptor type */
152 USBD_CDC_SUBTYPE_CMF, /* bDescriptorSubtype: Call Management function descriptor subtype 0x01 */
153 0x00, /* bmCapabilities: 0x00*/
154 0x01, /* bDataInterface: interface number of data class interface optionally used for call management */
155
156 0x04, /* bFunctionLength: size of this descriptor in bytes */
157 USBD_CDC_CS_INTERFACE, /* bDescriptorType: CDC interface descriptor type */
158 USBD_CDC_SUBTYPE_ACM, /* bDescriptorSubtype: Abstract Control Management functional descriptor subtype 0x02 */
159 0x02, /* bmCapabilities: Support Set_Line_Coding and Get_Line_Coding 0x02 */
160
161 0x05, /* bFunctionLength: size of this descriptor in bytes */
162 USBD_CDC_CS_INTERFACE, /* bDescriptorType: CDC interface descriptor type */
163 USBD_CDC_SUBTYPE_UFD, /* bDescriptorSubtype: Union Function Descriptor subtype 0x06 */
164 0x00, /* bControlInterface: The interface number of the communications or data class interface 0x00 */
165 0x01, /* bSubordinateInterface0: interface number of first subordinate interface in the union */
166
167 USB_DEVICE_EPT_LEN, /* bLength: size of endpoint descriptor in bytes */
168 USB_DESCIPTOR_TYPE_ENDPOINT, /* bDescriptorType: endpoint descriptor type */
169 USBD_VCPKYBRD_CDC_INT_EPT, /* bEndpointAddress: the address of endpoint on usb device described by this descriptor */
170 USB_EPT_DESC_INTERRUPT, /* bmAttributes: endpoint attributes */
171 LBYTE(USBD_VCPKYBRD_CMD_MAXPACKET_SIZE),
172 HBYTE(USBD_VCPKYBRD_CMD_MAXPACKET_SIZE), /* wMaxPacketSize: maximum packe size this endpoint */
173 VCPKYBRD_HID_BINTERVAL_TIME, /* bInterval: interval for polling endpoint for data transfers */
174
175
176 USB_DEVICE_IF_DESC_LEN, /* bLength: interface descriptor size */
177 USB_DESCIPTOR_TYPE_INTERFACE, /* bDescriptorType: interface descriptor type */
178 VCPKYBRD_CDC_DATA_INTERFACE, /* bInterfaceNumber: number of interface */
179 0x00, /* bAlternateSetting: alternate set */
180 0x02, /* bNumEndpoints: number of endpoints */
181 USB_CLASS_CODE_CDCDATA, /* bInterfaceClass: CDC-data class code */
182 0x00, /* bInterfaceSubClass: Data interface subclass code 0x00*/
183 0x00, /* bInterfaceProtocol: data class protocol code 0x00 */
184 0x00, /* iInterface: index of string descriptor */
185
186 USB_DEVICE_EPT_LEN, /* bLength: size of endpoint descriptor in bytes */
187 USB_DESCIPTOR_TYPE_ENDPOINT, /* bDescriptorType: endpoint descriptor type */
188 USBD_VCPKYBRD_CDC_BULK_IN_EPT, /* bEndpointAddress: the address of endpoint on usb device described by this descriptor */
189 USB_EPT_DESC_BULK, /* bmAttributes: endpoint attributes */
190 LBYTE(USBD_VCPKYBRD_IN_MAXPACKET_SIZE),
191 HBYTE(USBD_VCPKYBRD_IN_MAXPACKET_SIZE), /* wMaxPacketSize: maximum packe size this endpoint */
192 0x00, /* bInterval: interval for polling endpoint for data transfers */
193
194 USB_DEVICE_EPT_LEN, /* bLength: size of endpoint descriptor in bytes */
195 USB_DESCIPTOR_TYPE_ENDPOINT, /* bDescriptorType: endpoint descriptor type */
196 USBD_VCPKYBRD_CDC_BULK_OUT_EPT, /* bEndpointAddress: the address of endpoint on usb device described by this descriptor */
197 USB_EPT_DESC_BULK, /* bmAttributes: endpoint attributes */
198 LBYTE(USBD_VCPKYBRD_OUT_MAXPACKET_SIZE),
199 HBYTE(USBD_VCPKYBRD_OUT_MAXPACKET_SIZE),/* wMaxPacketSize: maximum packe size this endpoint */
200 0x00, /* bInterval: interval for polling endpoint for data transfers */
201
202 0x08, /* bLength */
203 0x0B, /* bDescriptorType */
204 0x02, /* bFirstInterface */
205 0x01, /* bInterfaceCount */
206 0x03, /* bFunctionClass */
207 0x00, /* bFunctionSubClass */
208 0x01, /* bFunctionProtocol */
209 0x00, /* iFunction (Index of string descriptor describing this function) */
210
211 USB_DEVICE_IF_DESC_LEN, /* bLength: interface descriptor size */
212 USB_DESCIPTOR_TYPE_INTERFACE, /* bDescriptorType: interface descriptor type */
213 VCPKYBRD_KEYBOARD_INTERFACE, /* bInterfaceNumber: number of interface */
214 0x00, /* bAlternateSetting: alternate set */
215 0x01, /* bNumEndpoints: number of endpoints */
216 USB_CLASS_CODE_HID, /* bInterfaceClass: class code hid */
217 0x01, /* bInterfaceSubClass: subclass code */
218 0x01, /* bInterfaceProtocol: protocol code */
219 0x00, /* iInterface: index of string descriptor */
220
221 0x09, /* bLength: size of HID descriptor in bytes */
222 HID_CLASS_DESC_HID, /* bDescriptorType: HID descriptor type */
223 LBYTE(VCPKYBRD_BCD_NUM),
224 HBYTE(VCPKYBRD_BCD_NUM), /* bcdHID: HID class specification release number */
225 0x00, /* bCountryCode: hardware target conutry */
226 0x01, /* bNumDescriptors: number of HID class descriptor to follow */
227 HID_CLASS_DESC_REPORT, /* bDescriptorType: report descriptor type */
228 LBYTE(sizeof(g_usbd_vcpkybrd_hid_report)),
229 HBYTE(sizeof(g_usbd_vcpkybrd_hid_report)), /* wDescriptorLength: total length of reprot descriptor */
230
231 USB_DEVICE_EPT_LEN, /* bLength: size of endpoint descriptor in bytes */
232 USB_DESCIPTOR_TYPE_ENDPOINT, /* bDescriptorType: endpoint descriptor type */
233 USBD_VCPKYBRD_HID_IN_EPT, /* bEndpointAddress: the address of endpoint on usb device described by this descriptor */
234 USB_EPT_DESC_INTERRUPT, /* bmAttributes: endpoint attributes */
235 LBYTE(USBD_VCPKYBRD_IN_MAXPACKET_SIZE),
236 HBYTE(USBD_VCPKYBRD_IN_MAXPACKET_SIZE),/* wMaxPacketSize: maximum packe size this endpoint */
237 VCPKYBRD_HID_BINTERVAL_TIME, /* bInterval: interval for polling endpoint for data transfers */
238};
239
243#if defined ( __ICCARM__ ) /* iar compiler */
244 #pragma data_alignment=4
245#endif
246ALIGNED_HEAD uint8_t g_vcpkybrd_hid_usb_desc[9] ALIGNED_TAIL =
247{
248 0x09, /* bLength: size of HID descriptor in bytes */
249 HID_CLASS_DESC_HID, /* bDescriptorType: HID descriptor type */
250 LBYTE(VCPKYBRD_BCD_NUM),
251 HBYTE(VCPKYBRD_BCD_NUM), /* bcdHID: HID class specification release number */
252 0x00, /* bCountryCode: hardware target conutry */
253 0x01, /* bNumDescriptors: number of HID class descriptor to follow */
254 HID_CLASS_DESC_REPORT, /* bDescriptorType: report descriptor type */
255 LBYTE(sizeof(g_usbd_vcpkybrd_hid_report)),
256 HBYTE(sizeof(g_usbd_vcpkybrd_hid_report)), /* wDescriptorLength: total length of reprot descriptor */
257};
258
262#if defined ( __ICCARM__ ) /* iar compiler */
263 #pragma data_alignment=4
264#endif
265ALIGNED_HEAD uint8_t g_usbd_vcpkybrd_hid_report[USBD_VCPKYBRD_HID_SIZ_REPORT_DESC] ALIGNED_TAIL =
266{
267 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
268 0x09, 0x06, // USAGE (Keyboard)
269 0xa1, 0x01, // COLLECTION (Application)
270 0x05, 0x07, // USAGE_PAGE (Keyboard)
271 0x19, 0xe0, // USAGE_MINIMUM (Keyboard LeftControl)
272 0x29, 0xe7, // USAGE_MAXIMUM (Keyboard Right GUI)
273 0x15, 0x00, // LOGICAL_MINIMUM (0)
274 0x25, 0x01, // LOGICAL_MAXIMUM (1)
275 0x75, 0x01, // REPORT_SIZE (1)
276 0x95, 0x08, // REPORT_COUNT (8)
277 0x81, 0x02, // INPUT (Data,Var,Abs)
278 0x95, 0x01, // REPORT_COUNT (1)
279 0x75, 0x08, // REPORT_SIZE (8)
280 0x81, 0x03, // INPUT (Cnst,Var,Abs)
281 0x95, 0x05, // REPORT_COUNT (5)
282 0x75, 0x01, // REPORT_SIZE (1)
283 0x05, 0x08, // USAGE_PAGE (LEDs)
284 0x19, 0x01, // USAGE_MINIMUM (Num Lock)
285 0x29, 0x05, // USAGE_MAXIMUM (Kana)
286 0x91, 0x02, // OUTPUT (Data,Var,Abs)
287 0x95, 0x01, // REPORT_COUNT (1)
288 0x75, 0x03, // REPORT_SIZE (3)
289 0x91, 0x03, // OUTPUT (Cnst,Var,Abs)
290 0x95, 0x06, // REPORT_COUNT (6)
291 0x75, 0x08, // REPORT_SIZE (8)
292 0x15, 0x00, // LOGICAL_MINIMUM (0)
293 0x25, 0xFF, // LOGICAL_MAXIMUM (255)
294 0x05, 0x07, // USAGE_PAGE (Keyboard)
295 0x19, 0x00, // USAGE_MINIMUM (Reserved (no event indicated))
296 0x29, 0x65, // USAGE_MAXIMUM (Keyboard Application)
297 0x81, 0x00, // INPUT (Data,Ary,Abs)
298 0xc0 // END_COLLECTION
299};
303#if defined ( __ICCARM__ ) /* iar compiler */
304 #pragma data_alignment=4
305#endif
306ALIGNED_HEAD static uint8_t g_string_lang_id[USBD_VCPKYBRD_SIZ_STRING_LANGID] ALIGNED_TAIL =
307{
308 USBD_VCPKYBRD_SIZ_STRING_LANGID,
309 USB_DESCIPTOR_TYPE_STRING,
310 0x09,
311 0x04,
312};
313
317#if defined ( __ICCARM__ ) /* iar compiler */
318 #pragma data_alignment=4
319#endif
320ALIGNED_HEAD static uint8_t g_string_serial[USBD_VCPKYBRD_SIZ_STRING_SERIAL] ALIGNED_TAIL =
321{
322 USBD_VCPKYBRD_SIZ_STRING_SERIAL,
323 USB_DESCIPTOR_TYPE_STRING,
324};
325
326
327/* device descriptor */
328static usbd_desc_t device_descriptor =
329{
330 USB_DEVICE_DESC_LEN,
331 g_usbd_descriptor
332};
333
334/* config descriptor */
335static usbd_desc_t config_descriptor =
336{
337 USBD_VCPKYBRD_CONFIG_DESC_SIZE,
338 g_usbd_configuration
339};
340
341/* langid descriptor */
342static usbd_desc_t langid_descriptor =
343{
344 USBD_VCPKYBRD_SIZ_STRING_LANGID,
345 g_string_lang_id
346};
347
348/* serial descriptor */
349static usbd_desc_t serial_descriptor =
350{
351 USBD_VCPKYBRD_SIZ_STRING_SERIAL,
352 g_string_serial
353};
354
355static usbd_desc_t vp_desc;
356
363static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf)
364{
365 uint16_t str_len = 0, id_pos = 2;
366 uint8_t *tmp_str = string;
367
368 while(*tmp_str != '\0')
369 {
370 str_len ++;
371 unicode_buf[id_pos ++] = *tmp_str ++;
372 unicode_buf[id_pos ++] = 0x00;
373 }
374
375 str_len = str_len * 2 + 2;
376 unicode_buf[0] = str_len;
377 unicode_buf[1] = USB_DESCIPTOR_TYPE_STRING;
378
379 return str_len;
380}
381
389static void usbd_int_to_unicode (uint32_t value , uint8_t *pbuf , uint8_t len)
390{
391 uint8_t idx = 0;
392
393 for( idx = 0 ; idx < len ; idx ++)
394 {
395 if( ((value >> 28)) < 0xA )
396 {
397 pbuf[ 2 * idx] = (value >> 28) + '0';
398 }
399 else
400 {
401 pbuf[2 * idx] = (value >> 28) + 'A' - 10;
402 }
403
404 value = value << 4;
405
406 pbuf[2 * idx + 1] = 0;
407 }
408}
409
415static void get_serial_num(void)
416{
417 uint32_t serial0, serial1, serial2;
418
419 serial0 = *(uint32_t*)MCU_ID1;
420 serial1 = *(uint32_t*)MCU_ID2;
421 serial2 = *(uint32_t*)MCU_ID3;
422
423 serial0 += serial2;
424
425 if (serial0 != 0)
426 {
427 usbd_int_to_unicode (serial0, &g_string_serial[2] ,8);
428 usbd_int_to_unicode (serial1, &g_string_serial[18] ,4);
429 }
430}
431
437static usbd_desc_t *get_device_descriptor(void)
438{
439 return &device_descriptor;
440}
441
447static usbd_desc_t * get_device_qualifier(void)
448{
449 return NULL;
450}
451
457static usbd_desc_t *get_device_configuration(void)
458{
459 return &config_descriptor;
460}
461
467static usbd_desc_t *get_device_other_speed(void)
468{
469 return NULL;
470}
471
477static usbd_desc_t *get_device_lang_id(void)
478{
479 return &langid_descriptor;
480}
481
482
488static usbd_desc_t *get_device_manufacturer_string(void)
489{
490 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_VCPKYBRD_DESC_MANUFACTURER_STRING, g_usbd_desc_buffer);
491 vp_desc.descriptor = g_usbd_desc_buffer;
492 return &vp_desc;
493}
494
500static usbd_desc_t *get_device_product_string(void)
501{
502 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_VCPKYBRD_DESC_PRODUCT_STRING, g_usbd_desc_buffer);
503 vp_desc.descriptor = g_usbd_desc_buffer;
504 return &vp_desc;
505}
506
512static usbd_desc_t *get_device_serial_string(void)
513{
514 get_serial_num();
515 return &serial_descriptor;
516}
517
523static usbd_desc_t *get_device_interface_string(void)
524{
525 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_VCPKYBRD_DESC_INTERFACE_STRING, g_usbd_desc_buffer);
526 vp_desc.descriptor = g_usbd_desc_buffer;
527 return &vp_desc;
528}
529
535static usbd_desc_t *get_device_config_string(void)
536{
537 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_VCPKYBRD_DESC_CONFIGURATION_STRING, g_usbd_desc_buffer);
538 vp_desc.descriptor = g_usbd_desc_buffer;
539 return &vp_desc;
540}
541
cdc_keyboard_desc.h
usb cdc and keyboard descriptor header file
NULL
#define NULL
Definition emmc_card/inc/at32_sdio.h:340
MCU_ID1
#define MCU_ID1
Definition audio_desc.h:214
MCU_ID2
#define MCU_ID2
Definition audio_desc.h:215
MCU_ID3
#define MCU_ID3
Definition audio_desc.h:216
HID_CLASS_DESC_HID
#define HID_CLASS_DESC_HID
usb hid class descriptor define
Definition audio_hid_desc.h:214
HID_CLASS_DESC_REPORT
#define HID_CLASS_DESC_REPORT
Definition audio_hid_desc.h:215
USBD_VCPKYBRD_CMD_MAXPACKET_SIZE
#define USBD_VCPKYBRD_CMD_MAXPACKET_SIZE
Definition cdc_keyboard_class.h:62
USBD_VCPKYBRD_HID_IN_EPT
#define USBD_VCPKYBRD_HID_IN_EPT
Definition cdc_keyboard_class.h:55
USBD_VCPKYBRD_IN_MAXPACKET_SIZE
#define USBD_VCPKYBRD_IN_MAXPACKET_SIZE
usb in and out max packet size define
Definition cdc_keyboard_class.h:60
USBD_VCPKYBRD_OUT_MAXPACKET_SIZE
#define USBD_VCPKYBRD_OUT_MAXPACKET_SIZE
Definition cdc_keyboard_class.h:61
USBD_VCPKYBRD_CDC_INT_EPT
#define USBD_VCPKYBRD_CDC_INT_EPT
usb use endpoint define
Definition cdc_keyboard_class.h:52
USBD_VCPKYBRD_CDC_BULK_IN_EPT
#define USBD_VCPKYBRD_CDC_BULK_IN_EPT
Definition cdc_keyboard_class.h:53
USBD_VCPKYBRD_CDC_BULK_OUT_EPT
#define USBD_VCPKYBRD_CDC_BULK_OUT_EPT
Definition cdc_keyboard_class.h:54
USBD_VCPKYBRD_DESC_INTERFACE_STRING
#define USBD_VCPKYBRD_DESC_INTERFACE_STRING
Definition cdc_keyboard_desc.h:75
VCPKYBRD_CDC_INTERFACE
#define VCPKYBRD_CDC_INTERFACE
usb interface define
Definition cdc_keyboard_desc.h:85
VCPKYBRD_KEYBOARD_INTERFACE
#define VCPKYBRD_KEYBOARD_INTERFACE
Definition cdc_keyboard_desc.h:87
USBD_VCPKYBRD_HID_SIZ_REPORT_DESC
#define USBD_VCPKYBRD_HID_SIZ_REPORT_DESC
Definition cdc_keyboard_desc.h:65
USBD_VCPKYBRD_DESC_MANUFACTURER_STRING
#define USBD_VCPKYBRD_DESC_MANUFACTURER_STRING
usb string define(vendor, product configuration, interface)
Definition cdc_keyboard_desc.h:72
USBD_VCPKYBRD_PRODUCT_ID
#define USBD_VCPKYBRD_PRODUCT_ID
Definition cdc_keyboard_desc.h:58
VCPKYBRD_BCD_NUM
#define VCPKYBRD_BCD_NUM
usb bcd number define
Definition cdc_keyboard_desc.h:52
VCPKYBRD_CDC_DATA_INTERFACE
#define VCPKYBRD_CDC_DATA_INTERFACE
Definition cdc_keyboard_desc.h:86
USBD_VCPKYBRD_DESC_CONFIGURATION_STRING
#define USBD_VCPKYBRD_DESC_CONFIGURATION_STRING
Definition cdc_keyboard_desc.h:74
USBD_VCPKYBRD_CONFIG_DESC_SIZE
#define USBD_VCPKYBRD_CONFIG_DESC_SIZE
usb descriptor size define
Definition cdc_keyboard_desc.h:64
VCPKYBRD_HID_BINTERVAL_TIME
#define VCPKYBRD_HID_BINTERVAL_TIME
usb endpoint interval define
Definition cdc_keyboard_desc.h:80
USBD_VCPKYBRD_SIZ_STRING_SERIAL
#define USBD_VCPKYBRD_SIZ_STRING_SERIAL
Definition cdc_keyboard_desc.h:67
USBD_VCPKYBRD_VENDOR_ID
#define USBD_VCPKYBRD_VENDOR_ID
usb vendor id and product id define
Definition cdc_keyboard_desc.h:57
USBD_VCPKYBRD_SIZ_STRING_LANGID
#define USBD_VCPKYBRD_SIZ_STRING_LANGID
Definition cdc_keyboard_desc.h:66
USBD_VCPKYBRD_DESC_PRODUCT_STRING
#define USBD_VCPKYBRD_DESC_PRODUCT_STRING
Definition cdc_keyboard_desc.h:73
serial_descriptor
static usbd_desc_t serial_descriptor
Definition cdc_keyboard_desc.c:349
device_descriptor
static usbd_desc_t device_descriptor
Definition cdc_keyboard_desc.c:328
get_device_configuration
static usbd_desc_t * get_device_configuration(void)
get config descriptor
Definition cdc_keyboard_desc.c:457
langid_descriptor
static usbd_desc_t langid_descriptor
Definition cdc_keyboard_desc.c:342
get_device_descriptor
static usbd_desc_t * get_device_descriptor(void)
get device descriptor
Definition cdc_keyboard_desc.c:437
get_device_manufacturer_string
static usbd_desc_t * get_device_manufacturer_string(void)
get manufacturer descriptor
Definition cdc_keyboard_desc.c:488
get_device_qualifier
static usbd_desc_t * get_device_qualifier(void)
get device qualifier
Definition cdc_keyboard_desc.c:447
get_device_interface_string
static usbd_desc_t * get_device_interface_string(void)
get interface descriptor
Definition cdc_keyboard_desc.c:523
vp_desc
static usbd_desc_t vp_desc
Definition cdc_keyboard_desc.c:355
get_device_other_speed
static usbd_desc_t * get_device_other_speed(void)
get other speed descriptor
Definition cdc_keyboard_desc.c:467
ALIGNED_TAIL
static ALIGNED_HEAD uint8_t g_usbd_desc_buffer[256] ALIGNED_TAIL
usb device standard descriptor
Definition cdc_keyboard_desc.c:59
get_device_product_string
static usbd_desc_t * get_device_product_string(void)
get product descriptor
Definition cdc_keyboard_desc.c:500
get_device_config_string
static usbd_desc_t * get_device_config_string(void)
get device config descriptor
Definition cdc_keyboard_desc.c:535
usbd_unicode_convert
static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf)
standard usb unicode convert
Definition cdc_keyboard_desc.c:363
cdc_keyboard_desc_handler
usbd_desc_handler cdc_keyboard_desc_handler
device descriptor handler structure
Definition cdc_keyboard_desc.c:64
get_device_lang_id
static usbd_desc_t * get_device_lang_id(void)
get lang id descriptor
Definition cdc_keyboard_desc.c:477
get_serial_num
static void get_serial_num(void)
usb get serial number
Definition cdc_keyboard_desc.c:415
config_descriptor
static usbd_desc_t config_descriptor
Definition cdc_keyboard_desc.c:335
get_device_serial_string
static usbd_desc_t * get_device_serial_string(void)
get serial descriptor
Definition cdc_keyboard_desc.c:512
usbd_int_to_unicode
static void usbd_int_to_unicode(uint32_t value, uint8_t *pbuf, uint8_t len)
usb int convert to unicode
Definition cdc_keyboard_desc.c:389
g_usbd_vcpkybrd_hid_report
uint8_t g_usbd_vcpkybrd_hid_report[63]
g_vcpkybrd_hid_usb_desc
uint8_t g_vcpkybrd_hid_usb_desc[9]
HBYTE
#define HBYTE(x)
Definition usb_std.h:271
USB_DEVICE_EPT_LEN
#define USB_DEVICE_EPT_LEN
Definition usb_std.h:159
USB_MAX_EP0_SIZE
#define USB_MAX_EP0_SIZE
endpoint 0 max size
Definition usb_std.h:248
USB_PRODUCT_STRING
#define USB_PRODUCT_STRING
Definition usb_std.h:105
USB_DESCIPTOR_TYPE_CONFIGURATION
#define USB_DESCIPTOR_TYPE_CONFIGURATION
Definition usb_std.h:92
LBYTE
#define LBYTE(x)
low byte and high byte define
Definition usb_std.h:270
USB_DESCIPTOR_TYPE_ENDPOINT
#define USB_DESCIPTOR_TYPE_ENDPOINT
Definition usb_std.h:95
USBD_CDC_SUBTYPE_CMF
#define USBD_CDC_SUBTYPE_CMF
Definition usb_std.h:205
USB_DEVICE_DESC_LEN
#define USB_DEVICE_DESC_LEN
Definition usb_std.h:156
USB_MFC_STRING
#define USB_MFC_STRING
Definition usb_std.h:104
USB_EPT_DESC_BULK
#define USB_EPT_DESC_BULK
Definition usb_std.h:183
USBD_CDC_SUBTYPE_HEADER
#define USBD_CDC_SUBTYPE_HEADER
usb cdc class sub-type define
Definition usb_std.h:204
USB_DEVICE_IF_DESC_LEN
#define USB_DEVICE_IF_DESC_LEN
Definition usb_std.h:158
USB_DEVICE_CFG_DESC_LEN
#define USB_DEVICE_CFG_DESC_LEN
Definition usb_std.h:157
USBD_CDC_CS_INTERFACE
#define USBD_CDC_CS_INTERFACE
usb cdc class descriptor define
Definition usb_std.h:198
USB_EPT_DESC_INTERRUPT
#define USB_EPT_DESC_INTERRUPT
Definition usb_std.h:184
USB_SERIAL_STRING
#define USB_SERIAL_STRING
Definition usb_std.h:106
USB_DESCIPTOR_TYPE_DEVICE
#define USB_DESCIPTOR_TYPE_DEVICE
usb standard device type
Definition usb_std.h:91
USB_CLASS_CODE_CDCDATA
#define USB_CLASS_CODE_CDCDATA
Definition usb_std.h:173
USB_DESCIPTOR_TYPE_STRING
#define USB_DESCIPTOR_TYPE_STRING
Definition usb_std.h:93
USB_DESCIPTOR_TYPE_INTERFACE
#define USB_DESCIPTOR_TYPE_INTERFACE
Definition usb_std.h:94
USB_CLASS_CODE_CDC
#define USB_CLASS_CODE_CDC
Definition usb_std.h:168
USB_CLASS_CODE_HID
#define USB_CLASS_CODE_HID
Definition usb_std.h:169
USBD_CDC_SUBTYPE_UFD
#define USBD_CDC_SUBTYPE_UFD
Definition usb_std.h:207
USBD_CDC_SUBTYPE_ACM
#define USBD_CDC_SUBTYPE_ACM
Definition usb_std.h:206
usbd_desc_handler
usb device descriptor handler
Definition usbd_core.h:75
usbd_desc_t
usb device descriptor struct
Definition usbd_core.h:66
usbd_desc_t::length
uint16_t length
Definition usbd_core.h:67
usbd_desc_t::descriptor
uint8_t * descriptor
Definition usbd_core.h:68
usb_std.h
usb standard header file
usbd_core.h
usb device core header file
usbd_sdr.h
usb standard request header file


AT32F413 Firmwary Library: cdc_keyboard_desc.h Source File

  • middlewares
  • usbd_class
  • composite_cdc_keyboard
cdc_keyboard_desc.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __CDC_KEYBOARD_DESC_H
28#define __CDC_KEYBOARD_DESC_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "cdc_keyboard_class.h"
35#include "usbd_core.h"
36
52#define VCPKYBRD_BCD_NUM 0x0110
53
57#define USBD_VCPKYBRD_VENDOR_ID 0x2E3C
58#define USBD_VCPKYBRD_PRODUCT_ID 0x5750
59
60
64#define USBD_VCPKYBRD_CONFIG_DESC_SIZE 108
65#define USBD_VCPKYBRD_HID_SIZ_REPORT_DESC 63
66#define USBD_VCPKYBRD_SIZ_STRING_LANGID 4
67#define USBD_VCPKYBRD_SIZ_STRING_SERIAL 0x1A
68
72#define USBD_VCPKYBRD_DESC_MANUFACTURER_STRING "Artery"
73#define USBD_VCPKYBRD_DESC_PRODUCT_STRING "AT32 Composite VCP and Keyboard"
74#define USBD_VCPKYBRD_DESC_CONFIGURATION_STRING "Composite VCP and Keyboard Config"
75#define USBD_VCPKYBRD_DESC_INTERFACE_STRING "Composite VCP and Keyboard Interface"
76
80#define VCPKYBRD_HID_BINTERVAL_TIME 0x0A
81
85#define VCPKYBRD_CDC_INTERFACE 0x00
86#define VCPKYBRD_CDC_DATA_INTERFACE 0x01
87#define VCPKYBRD_KEYBOARD_INTERFACE 0x02
88
92#define MCU_ID1 (0x1FFFF7E8)
93#define MCU_ID2 (0x1FFFF7EC)
94#define MCU_ID3 (0x1FFFF7F0)
95
99extern uint8_t g_usbd_vcpkybrd_hid_report[USBD_VCPKYBRD_HID_SIZ_REPORT_DESC];
100extern uint8_t g_vcpkybrd_hid_usb_desc[9];
101extern usbd_desc_handler cdc_keyboard_desc_handler;
102
103
111#ifdef __cplusplus
112}
113#endif
114
115#endif
cdc_keyboard_class.h
usb cdc and keyboard class file
USBD_VCPKYBRD_HID_SIZ_REPORT_DESC
#define USBD_VCPKYBRD_HID_SIZ_REPORT_DESC
Definition cdc_keyboard_desc.h:65
g_usbd_vcpkybrd_hid_report
uint8_t g_usbd_vcpkybrd_hid_report[63]
g_vcpkybrd_hid_usb_desc
uint8_t g_vcpkybrd_hid_usb_desc[9]
cdc_keyboard_desc_handler
usbd_desc_handler cdc_keyboard_desc_handler
device descriptor handler structure
Definition cdc_keyboard_desc.c:64
usbd_desc_handler
usb device descriptor handler
Definition usbd_core.h:75
usbd_core.h
usb device core header file


AT32F413 Firmwary Library: cdc_msc_class.c Source File

  • middlewares
  • usbd_class
  • composite_cdc_msc
cdc_msc_class.c
Go to the documentation of this file.
1
25#include "usbd_core.h"
26#include "cdc_msc_class.h"
27#include "cdc_msc_desc.h"
28
42static usb_sts_type class_init_handler(void *udev);
43static usb_sts_type class_clear_handler(void *udev);
44static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup);
45static usb_sts_type class_ept0_tx_handler(void *udev);
46static usb_sts_type class_ept0_rx_handler(void *udev);
47static usb_sts_type class_in_handler(void *udev, uint8_t ept_num);
48static usb_sts_type class_out_handler(void *udev, uint8_t ept_num);
49static usb_sts_type class_sof_handler(void *udev);
50static usb_sts_type class_event_handler(void *udev, usbd_event_type event);
51
52static usb_sts_type cdc_struct_init(cdc_msc_struct_type *pcdc);
53extern void usb_usart_config( linecoding_type linecoding);
54static void usb_vcp_cmd_process(void *udev, uint8_t cmd, uint8_t *buff, uint16_t len);
55
56static usb_sts_type cdc_class_setup_handler(void *udev, usb_setup_type *setup);
57static usb_sts_type msc_class_setup_handler(void *udev, usb_setup_type *setup);
58
59 linecoding_type linecoding =
60{
61 115200,
62 0,
63 0,
64 8
65};
66
67/* cdc data struct */
68 cdc_msc_struct_type cdc_msc_struct;
69
70/* usb device class handler */
71 usbd_class_handler cdc_msc_class_handler =
72{
73 class_init_handler,
74 class_clear_handler,
75 class_setup_handler,
76 class_ept0_tx_handler,
77 class_ept0_rx_handler,
78 class_in_handler,
79 class_out_handler,
80 class_sof_handler,
81 class_event_handler,
82 &cdc_msc_struct //cdc_struct
83};
89static usb_sts_type class_init_handler(void *udev)
90{
91 usb_sts_type status = USB_OK;
92 usbd_core_type *pudev = (usbd_core_type *)udev;
93 cdc_msc_struct_type *pcdcmsc = (cdc_msc_struct_type *)pudev->class_handler->pdata;
94
95 /* init cdc struct */
96 cdc_struct_init(pcdcmsc);
97
98 /* open in endpoint */
99 usbd_ept_open(pudev, USBD_CDC_INT_EPT, EPT_INT_TYPE, USBD_CDC_CMD_MAXPACKET_SIZE);
100
101 /* open in endpoint */
102 usbd_ept_open(pudev, USBD_CDC_BULK_IN_EPT, EPT_BULK_TYPE, USBD_CDC_MSC_IN_MAXPACKET_SIZE);
103
104 /* open out endpoint */
105 usbd_ept_open(pudev, USBD_CDC_BULK_OUT_EPT, EPT_BULK_TYPE, USBD_CDC_MSC_OUT_MAXPACKET_SIZE);
106
107 /* set out endpoint to receive status */
108 usbd_ept_recv(pudev, USBD_CDC_BULK_OUT_EPT, pcdcmsc->g_rx_buff, USBD_CDC_MSC_OUT_MAXPACKET_SIZE);
109
110 /* open in endpoint */
111 usbd_ept_open(pudev, USBD_MSC_BULK_IN_EPT, EPT_BULK_TYPE, USBD_CDC_MSC_IN_MAXPACKET_SIZE);
112
113 /* open out endpoint */
114 usbd_ept_open(pudev, USBD_MSC_BULK_OUT_EPT, EPT_BULK_TYPE, USBD_CDC_MSC_OUT_MAXPACKET_SIZE);
115
116 bot_scsi_init(udev);
117
118 return status;
119}
120
126static usb_sts_type class_clear_handler(void *udev)
127{
128 usb_sts_type status = USB_OK;
129 usbd_core_type *pudev = (usbd_core_type *)udev;
130
131 /* close in endpoint */
132 usbd_ept_close(pudev, USBD_CDC_INT_EPT);
133
134 /* close in endpoint */
135 usbd_ept_close(pudev, USBD_CDC_BULK_IN_EPT);
136
137 /* close out endpoint */
138 usbd_ept_close(pudev, USBD_CDC_BULK_OUT_EPT);
139
140 /* close in endpoint */
141 usbd_ept_close(pudev, USBD_MSC_BULK_IN_EPT);
142
143 /* close out endpoint */
144 usbd_ept_close(pudev, USBD_MSC_BULK_OUT_EPT);
145
146 return status;
147}
148
155static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
156{
157 usb_sts_type status = USB_OK;
158 usbd_core_type *pudev = (usbd_core_type *)udev;
159 switch(setup->bmRequestType & USB_REQ_RECIPIENT_MASK)
160 {
161 case USB_REQ_RECIPIENT_INTERFACE:
162 if(setup->wIndex == VCPMSC_MSC_INTERFACE)
163 {
164 msc_class_setup_handler(udev, setup);
165 }
166 else
167 {
168 cdc_class_setup_handler(pudev, setup);
169 }
170 break;
171 case USB_REQ_RECIPIENT_ENDPOINT:
172 if(setup->wIndex == (USBD_MSC_BULK_IN_EPT | USBD_MSC_BULK_OUT_EPT))
173 {
174 msc_class_setup_handler(udev, setup);
175 }
176 else
177 {
178 cdc_class_setup_handler(pudev, setup);
179 }
180 break;
181
182 }
183 return status;
184}
185
192static usb_sts_type cdc_class_setup_handler(void *udev, usb_setup_type *setup)
193{
194 usb_sts_type status = USB_OK;
195 usbd_core_type *pudev = (usbd_core_type *)udev;
196 cdc_msc_struct_type *pcdc = (cdc_msc_struct_type *)pudev->class_handler->pdata;
197
198 switch(setup->bmRequestType & USB_REQ_TYPE_RESERVED)
199 {
200 /* class request */
201 case USB_REQ_TYPE_CLASS:
202 if(setup->wLength)
203 {
204 if(setup->bmRequestType & USB_REQ_DIR_DTH)
205 {
206 usb_vcp_cmd_process(udev, setup->bRequest, pcdc->g_cmd, setup->wLength);
207 usbd_ctrl_send(pudev, pcdc->g_cmd, setup->wLength);
208 }
209 else
210 {
211 pcdc->g_req = setup->bRequest;
212 pcdc->g_len = setup->wLength;
213 usbd_ctrl_recv(pudev, pcdc->g_cmd, pcdc->g_len);
214
215 }
216 }
217 break;
218 /* standard request */
219 case USB_REQ_TYPE_STANDARD:
220 switch(setup->bRequest)
221 {
222 case USB_STD_REQ_GET_DESCRIPTOR:
223 usbd_ctrl_unsupport(pudev);
224 break;
225 case USB_STD_REQ_GET_INTERFACE:
226 usbd_ctrl_send(pudev, (uint8_t *)&pcdc->alt_setting, 1);
227 break;
228 case USB_STD_REQ_SET_INTERFACE:
229 pcdc->alt_setting = setup->wValue;
230 break;
231 case USB_STD_REQ_CLEAR_FEATURE:
232 break;
233 case USB_STD_REQ_SET_FEATURE:
234 break;
235 default:
236 usbd_ctrl_unsupport(pudev);
237 break;
238 }
239 break;
240 default:
241 usbd_ctrl_unsupport(pudev);
242 break;
243 }
244 return status;
245}
246
253static usb_sts_type msc_class_setup_handler(void *udev, usb_setup_type *setup)
254{
255 usb_sts_type status = USB_OK;
256 usbd_core_type *pudev = (usbd_core_type *)udev;
257 cdc_msc_struct_type *pmsc = (cdc_msc_struct_type *)pudev->class_handler->pdata;
258 switch(setup->bmRequestType & USB_REQ_TYPE_RESERVED)
259 {
260 /* class request */
261 case USB_REQ_TYPE_CLASS:
262
263 switch(setup->bRequest)
264 {
265 case MSC_REQ_GET_MAX_LUN:
266 usbd_ctrl_send(pudev, (uint8_t *)&cdc_msc_struct.max_lun, 1);
267 break;
268 case MSC_REQ_BO_RESET:
269 bot_scsi_reset(udev);
270 usbd_ctrl_send_status(pudev);
271 break;
272 default:
273 usbd_ctrl_unsupport(pudev);
274 break;
275
276 }
277 break;
278 /* standard request */
279 case USB_REQ_TYPE_STANDARD:
280
281 switch(setup->bRequest)
282 {
283 case USB_STD_REQ_GET_DESCRIPTOR:
284 usbd_ctrl_unsupport(pudev);
285 break;
286 case USB_STD_REQ_GET_INTERFACE:
287 usbd_ctrl_send(pudev, (uint8_t *)&pmsc->alt_setting, 1);
288 break;
289 case USB_STD_REQ_SET_INTERFACE:
290 pmsc->alt_setting = setup->wValue;
291 break;
292 case USB_STD_REQ_CLEAR_FEATURE:
293 usbd_ept_close(pudev, (uint8_t)setup->wIndex);
294
295 if((setup->wIndex & 0x80) == 0x80)
296 {
297 usbd_ept_open(pudev, (uint8_t)setup->wIndex, EPT_BULK_TYPE, USBD_CDC_MSC_IN_MAXPACKET_SIZE);
298 }
299 else
300 {
301 usbd_ept_open(pudev, (uint8_t)setup->wIndex, EPT_BULK_TYPE, USBD_CDC_MSC_OUT_MAXPACKET_SIZE);
302 }
303 bot_scsi_clear_feature(udev, setup->wIndex);
304 break;
305 case USB_STD_REQ_SET_FEATURE:
306 break;
307 default:
308 usbd_ctrl_unsupport(pudev);
309 break;
310 }
311 break;
312 default:
313 usbd_ctrl_unsupport(pudev);
314 break;
315 }
316 return status;
317}
318
324static usb_sts_type class_ept0_tx_handler(void *udev)
325{
326 usb_sts_type status = USB_OK;
327
328 /* ...user code... */
329
330 return status;
331}
332
338static usb_sts_type class_ept0_rx_handler(void *udev)
339{
340 usb_sts_type status = USB_OK;
341 usbd_core_type *pudev = (usbd_core_type *)udev;
342 cdc_msc_struct_type *pcdc = (cdc_msc_struct_type *)pudev->class_handler->pdata;
343 uint32_t recv_len = usbd_get_recv_len(pudev, 0);
344 /* ...user code... */
345 if( pcdc->g_req == SET_LINE_CODING)
346 {
347 /* class process */
348 usb_vcp_cmd_process(udev, pcdc->g_req, pcdc->g_cmd, recv_len);
349 }
350
351 return status;
352}
353
360static usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
361{
362 usbd_core_type *pudev = (usbd_core_type *)udev;
363 cdc_msc_struct_type *pcdcmsc = (cdc_msc_struct_type *)pudev->class_handler->pdata;
364 usb_sts_type status = USB_OK;
365
366 /* ...user code...
367 trans next packet data
368 */
369
370 if((ept_num & 0x7F) == (USBD_CDC_BULK_IN_EPT & 0x7F))
371 {
372 pcdcmsc->g_tx_completed = 1;
373 }
374 if((ept_num & 0x7F) == (USBD_MSC_BULK_IN_EPT & 0x7F))
375 {
376 bot_scsi_datain_handler(udev, ept_num);
377 }
378
379 return status;
380}
381
388static usb_sts_type class_out_handler(void *udev, uint8_t ept_num)
389{
390 usb_sts_type status = USB_OK;
391 usbd_core_type *pudev = (usbd_core_type *)udev;
392 cdc_msc_struct_type *pcdcmsc = (cdc_msc_struct_type *)pudev->class_handler->pdata;
393
394
395
396 if((ept_num & 0x7F) == (USBD_CDC_BULK_OUT_EPT & 0x7F))
397 {
398 /* get endpoint receive data length */
399 pcdcmsc->g_rxlen = usbd_get_recv_len(pudev, ept_num);
400
401 /*set recv flag*/
402 pcdcmsc->g_rx_completed = 1;
403 }
404 if((ept_num & 0x7F) == (USBD_MSC_BULK_OUT_EPT & 0x7F))
405 {
406 bot_scsi_dataout_handler(udev, ept_num);
407 }
408
409 return status;
410}
411
417static usb_sts_type class_sof_handler(void *udev)
418{
419 usb_sts_type status = USB_OK;
420
421 /* ...user code... */
422
423 return status;
424}
425
432static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
433{
434 usb_sts_type status = USB_OK;
435 switch(event)
436 {
437 case USBD_RESET_EVENT:
438
439 /* ...user code... */
440
441 break;
442 case USBD_SUSPEND_EVENT:
443
444 /* ...user code... */
445
446 break;
447 case USBD_WAKEUP_EVENT:
448 /* ...user code... */
449
450 break;
451 default:
452 break;
453 }
454 return status;
455}
456
462static usb_sts_type cdc_struct_init(cdc_msc_struct_type *pcdc)
463{
464 pcdc->g_tx_completed = 1;
465 pcdc->g_rx_completed = 0;
466 pcdc->alt_setting = 0;
467 pcdc->linecoding.bitrate = linecoding.bitrate;
468 pcdc->linecoding.data = linecoding.data;
469 pcdc->linecoding.format = linecoding.format;
470 pcdc->linecoding.parity = linecoding.parity;
471 return USB_OK;
472}
473
480uint16_t usb_vcp_get_rxdata(void *udev, uint8_t *recv_data)
481{
482 uint16_t i_index = 0;
483 uint16_t tmp_len = 0;
484 usbd_core_type *pudev = (usbd_core_type *)udev;
485 cdc_msc_struct_type *pcdc = (cdc_msc_struct_type *)pudev->class_handler->pdata;
486
487 if(pcdc->g_rx_completed == 0)
488 {
489 return 0;
490 }
491 pcdc->g_rx_completed = 0;
492 tmp_len = pcdc->g_rxlen;
493 for(i_index = 0; i_index < pcdc->g_rxlen; i_index ++)
494 {
495 recv_data[i_index] = pcdc->g_rx_buff[i_index];
496 }
497
498 usbd_ept_recv(pudev, USBD_CDC_BULK_OUT_EPT, pcdc->g_rx_buff, USBD_CDC_MSC_OUT_MAXPACKET_SIZE);
499
500 return tmp_len;
501}
502
510 error_status usb_vcp_send_data(void *udev, uint8_t *send_data, uint16_t len)
511{
512 error_status status = SUCCESS;
513 usbd_core_type *pudev = (usbd_core_type *)udev;
514 cdc_msc_struct_type *pcdc = (cdc_msc_struct_type *)pudev->class_handler->pdata;
515 if(pcdc->g_tx_completed)
516 {
517 pcdc->g_tx_completed = 0;
518 usbd_ept_send(pudev, USBD_CDC_BULK_IN_EPT, send_data, len);
519 }
520 else
521 {
522 status = ERROR;
523 }
524 return status;
525}
526
535static void usb_vcp_cmd_process(void *udev, uint8_t cmd, uint8_t *buff, uint16_t len)
536{
537 usbd_core_type *pudev = (usbd_core_type *)udev;
538 cdc_msc_struct_type *pcdc = (cdc_msc_struct_type *)pudev->class_handler->pdata;
539 switch(cmd)
540 {
541 case SET_LINE_CODING:
542 pcdc->linecoding.bitrate = (uint32_t)(buff[0] | (buff[1] << 8) | (buff[2] << 16) | (buff[3] <<24));
543 pcdc->linecoding.format = buff[4];
544 pcdc->linecoding.parity = buff[5];
545 pcdc->linecoding.data = buff[6];
546#ifdef USB_VIRTUAL_COMPORT
547 /* set hardware usart */
548 usb_usart_config(pcdc->linecoding);
549#endif
550 break;
551
552 case GET_LINE_CODING:
553 buff[0] = (uint8_t)pcdc->linecoding.bitrate;
554 buff[1] = (uint8_t)(pcdc->linecoding.bitrate >> 8);
555 buff[2] = (uint8_t)(pcdc->linecoding.bitrate >> 16);
556 buff[3] = (uint8_t)(pcdc->linecoding.bitrate >> 24);
557 buff[4] = (uint8_t)(pcdc->linecoding.format);
558 buff[5] = (uint8_t)(pcdc->linecoding.parity);
559 buff[6] = (uint8_t)(pcdc->linecoding.data);
560 break;
561
562 default:
563 break;
564 }
565}
566
cdc_msc_class.h
usb cdc class file
cdc_msc_desc.h
usb cdc descriptor header file
cdc_msc_struct_type::g_tx_completed
__IO uint8_t g_tx_completed
Definition cdc_msc_class.h:259
cdc_msc_struct_type::g_req
uint8_t g_req
Definition cdc_msc_class.h:257
cdc_msc_struct_type::alt_setting
uint32_t alt_setting
Definition cdc_msc_class.h:254
cdc_msc_struct_type::linecoding
linecoding_type linecoding
Definition cdc_msc_class.h:260
cdc_msc_struct_type::g_rx_buff
uint8_t g_rx_buff[0x40]
Definition cdc_msc_class.h:255
cdc_msc_struct_type::g_len
uint16_t g_len
Definition cdc_msc_class.h:258
cdc_msc_struct_type::max_lun
uint32_t max_lun
Definition cdc_msc_class.h:265
cdc_msc_struct_type::g_cmd
uint8_t g_cmd[0x08]
Definition cdc_msc_class.h:256
cdc_msc_struct_type::g_rx_completed
__IO uint8_t g_rx_completed
Definition cdc_msc_class.h:259
cdc_msc_struct_type::g_rxlen
uint16_t g_rxlen
Definition cdc_msc_class.h:258
error_status
error_status
error status
Definition at32f413.h:302
ERROR
@ ERROR
Definition at32f413.h:302
SUCCESS
@ SUCCESS
Definition at32f413.h:302
USBD_CDC_CMD_MAXPACKET_SIZE
#define USBD_CDC_CMD_MAXPACKET_SIZE
Definition cdc_class.h:61
USBD_CDC_MSC_OUT_MAXPACKET_SIZE
#define USBD_CDC_MSC_OUT_MAXPACKET_SIZE
Definition cdc_msc_class.h:64
USBD_CDC_BULK_OUT_EPT
#define USBD_CDC_BULK_OUT_EPT
Definition cdc_class.h:54
USBD_CDC_MSC_IN_MAXPACKET_SIZE
#define USBD_CDC_MSC_IN_MAXPACKET_SIZE
usb cdc in and out max packet size define
Definition cdc_msc_class.h:62
USBD_CDC_INT_EPT
#define USBD_CDC_INT_EPT
usb cdc use endpoint define
Definition cdc_class.h:52
USBD_CDC_BULK_IN_EPT
#define USBD_CDC_BULK_IN_EPT
Definition cdc_class.h:53
USBD_MSC_BULK_IN_EPT
#define USBD_MSC_BULK_IN_EPT
Definition cdc_msc_class.h:56
USBD_MSC_BULK_OUT_EPT
#define USBD_MSC_BULK_OUT_EPT
Definition cdc_msc_class.h:57
VCPMSC_MSC_INTERFACE
#define VCPMSC_MSC_INTERFACE
usb interface define
Definition cdc_msc_desc.h:83
bot_scsi_dataout_handler
void bot_scsi_dataout_handler(void *pudev, uint8_t ept_num)
bulk-only transport data out handler
Definition composite_cdc_msc/msc_bot_scsi.c:172
bot_scsi_reset
void bot_scsi_reset(void *udev)
reset bulk-only transport and scsi
Definition composite_cdc_msc/msc_bot_scsi.c:125
bot_scsi_init
void bot_scsi_init(void *udev)
initialize bulk-only transport and scsi
Definition composite_cdc_msc/msc_bot_scsi.c:103
bot_scsi_datain_handler
void bot_scsi_datain_handler(void *pudev, uint8_t ept_num)
bulk-only transport data in handler
Definition composite_cdc_msc/msc_bot_scsi.c:143
bot_scsi_clear_feature
void bot_scsi_clear_feature(void *udev, uint8_t ept_num)
clear feature
Definition composite_cdc_msc/msc_bot_scsi.c:729
class_sof_handler
static usb_sts_type class_sof_handler(void *udev)
usb device sof handler
Definition cdc_msc_class.c:417
cdc_msc_struct
cdc_msc_struct_type cdc_msc_struct
Definition cdc_msc_class.c:68
class_in_handler
static usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
usb device transmision complete handler
Definition cdc_msc_class.c:360
cdc_struct_init
static usb_sts_type cdc_struct_init(cdc_msc_struct_type *pcdc)
usb device cdc init
Definition cdc_msc_class.c:462
msc_class_setup_handler
static usb_sts_type msc_class_setup_handler(void *udev, usb_setup_type *setup)
usb device class setup request handler
Definition cdc_msc_class.c:253
class_clear_handler
static usb_sts_type class_clear_handler(void *udev)
clear endpoint or other state
Definition cdc_msc_class.c:126
class_setup_handler
static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
usb device class setup request handler
Definition cdc_msc_class.c:155
usb_usart_config
void usb_usart_config(linecoding_type linecoding)
this function handles usart2 and linecoding config.
Definition project/at_start_f413/examples/usb_device/virtual_comport/src/main.c:301
linecoding
linecoding_type linecoding
Definition cdc_msc_class.c:59
class_ept0_tx_handler
static usb_sts_type class_ept0_tx_handler(void *udev)
usb device endpoint 0 in status stage complete
Definition cdc_msc_class.c:324
usb_vcp_get_rxdata
uint16_t usb_vcp_get_rxdata(void *udev, uint8_t *recv_data)
usb device class rx data process
Definition cdc_msc_class.c:480
class_ept0_rx_handler
static usb_sts_type class_ept0_rx_handler(void *udev)
usb device endpoint 0 out status stage complete
Definition cdc_msc_class.c:338
class_event_handler
static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
usb device event handler
Definition cdc_msc_class.c:432
usb_vcp_cmd_process
static void usb_vcp_cmd_process(void *udev, uint8_t cmd, uint8_t *buff, uint16_t len)
usb device function
Definition cdc_msc_class.c:535
usb_vcp_send_data
error_status usb_vcp_send_data(void *udev, uint8_t *send_data, uint16_t len)
usb device class send data
Definition cdc_msc_class.c:510
class_init_handler
static usb_sts_type class_init_handler(void *udev)
initialize usb custom hid endpoint
Definition cdc_msc_class.c:89
cdc_class_setup_handler
static usb_sts_type cdc_class_setup_handler(void *udev, usb_setup_type *setup)
usb device class setup request handler
Definition cdc_msc_class.c:192
class_out_handler
static usb_sts_type class_out_handler(void *udev, uint8_t ept_num)
usb device endpoint receive data
Definition cdc_msc_class.c:388
cdc_msc_class_handler
usbd_class_handler cdc_msc_class_handler
Definition cdc_msc_class.c:71
EPT_INT_TYPE
@ EPT_INT_TYPE
Definition at32f413_usb.h:205
EPT_BULK_TYPE
@ EPT_BULK_TYPE
Definition at32f413_usb.h:204
MSC_REQ_BO_RESET
#define MSC_REQ_BO_RESET
Definition cdc_msc_class.h:103
GET_LINE_CODING
#define GET_LINE_CODING
Definition cdc_msc_class.h:106
SET_LINE_CODING
#define SET_LINE_CODING
Definition cdc_msc_class.h:105
MSC_REQ_GET_MAX_LUN
#define MSC_REQ_GET_MAX_LUN
Definition cdc_msc_class.h:102
USB_STD_REQ_CLEAR_FEATURE
#define USB_STD_REQ_CLEAR_FEATURE
Definition usb_std.h:77
USB_REQ_TYPE_STANDARD
#define USB_REQ_TYPE_STANDARD
usb request type
Definition usb_std.h:62
USB_STD_REQ_GET_DESCRIPTOR
#define USB_STD_REQ_GET_DESCRIPTOR
Definition usb_std.h:80
USB_STD_REQ_SET_FEATURE
#define USB_STD_REQ_SET_FEATURE
Definition usb_std.h:78
USB_REQ_DIR_DTH
#define USB_REQ_DIR_DTH
Definition usb_std.h:71
USB_REQ_RECIPIENT_MASK
#define USB_REQ_RECIPIENT_MASK
Definition usb_std.h:57
USB_STD_REQ_SET_INTERFACE
#define USB_STD_REQ_SET_INTERFACE
Definition usb_std.h:85
USB_REQ_TYPE_RESERVED
#define USB_REQ_TYPE_RESERVED
Definition usb_std.h:65
USB_STD_REQ_GET_INTERFACE
#define USB_STD_REQ_GET_INTERFACE
Definition usb_std.h:84
USB_REQ_RECIPIENT_ENDPOINT
#define USB_REQ_RECIPIENT_ENDPOINT
Definition usb_std.h:55
USB_REQ_RECIPIENT_INTERFACE
#define USB_REQ_RECIPIENT_INTERFACE
Definition usb_std.h:54
USB_REQ_TYPE_CLASS
#define USB_REQ_TYPE_CLASS
Definition usb_std.h:63
usb_sts_type
usb_sts_type
usb return status
Definition usb_std.h:285
USB_OK
@ USB_OK
Definition usb_std.h:286
usbd_ept_close
void usbd_ept_close(usbd_core_type *udev, uint8_t ept_addr)
usb close endpoint
Definition usbd_core.c:541
usbd_ept_recv
void usbd_ept_recv(usbd_core_type *udev, uint8_t ept_num, uint8_t *buffer, uint16_t len)
usb endpoint receive data
Definition usbd_core.c:364
usbd_ctrl_send_status
void usbd_ctrl_send_status(usbd_core_type *udev)
usb control endpoint send in status
Definition usbd_core.c:210
usbd_ept_open
void usbd_ept_open(usbd_core_type *udev, uint8_t ept_addr, uint8_t ept_type, uint16_t maxpacket)
usb open endpoint
Definition usbd_core.c:506
usbd_ctrl_send
void usbd_ctrl_send(usbd_core_type *udev, uint8_t *buffer, uint16_t len)
usb control endpoint send data
Definition usbd_core.c:175
usbd_get_recv_len
uint32_t usbd_get_recv_len(usbd_core_type *udev, uint8_t ept_addr)
usb endpoint get receive data length
Definition usbd_core.c:397
usbd_ctrl_recv
void usbd_ctrl_recv(usbd_core_type *udev, uint8_t *buffer, uint16_t len)
usb control endpoint receive data
Definition usbd_core.c:194
usbd_ctrl_unsupport
void usbd_ctrl_unsupport(usbd_core_type *udev)
un-support device request
Definition usbd_core.c:289
usbd_ept_send
void usbd_ept_send(usbd_core_type *udev, uint8_t ept_num, uint8_t *buffer, uint16_t len)
usb endpoint send data
Definition usbd_core.c:304
usbd_event_type
usbd_event_type
usb device event
Definition usbd_core.h:54
USBD_SUSPEND_EVENT
@ USBD_SUSPEND_EVENT
Definition usbd_core.h:57
USBD_RESET_EVENT
@ USBD_RESET_EVENT
Definition usbd_core.h:56
USBD_WAKEUP_EVENT
@ USBD_WAKEUP_EVENT
Definition usbd_core.h:58
cdc_msc_struct_type
usb cdc class struct
Definition cdc_msc_class.h:252
linecoding_type
usb cdc class set line coding struct
Definition usb_std.h:219
linecoding_type::bitrate
uint32_t bitrate
Definition usb_std.h:220
linecoding_type::data
uint8_t data
Definition usb_std.h:223
linecoding_type::parity
uint8_t parity
Definition usb_std.h:222
linecoding_type::format
uint8_t format
Definition usb_std.h:221
usb_setup_type
format of usb setup data
Definition usb_std.h:297
usb_setup_type::wValue
uint16_t wValue
Definition usb_std.h:300
usb_setup_type::wLength
uint16_t wLength
Definition usb_std.h:303
usb_setup_type::bmRequestType
uint8_t bmRequestType
Definition usb_std.h:298
usb_setup_type::wIndex
uint16_t wIndex
Definition usb_std.h:301
usb_setup_type::bRequest
uint8_t bRequest
Definition usb_std.h:299
usbd_class_handler
usb device class handler
Definition usbd_core.h:97
usbd_class_handler::pdata
void * pdata
Definition usbd_core.h:107
usbd_core_type
usb device core struct type
Definition usbd_core.h:114
usbd_core_type::class_handler
usbd_class_handler * class_handler
Definition usbd_core.h:117
usbd_core.h
usb device core header file


AT32F413 Firmwary Library: cdc_msc_class.h Source File

  • middlewares
  • usbd_class
  • composite_cdc_msc
cdc_msc_class.h
Go to the documentation of this file.
1
26 /* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __CDC_MSC_CLASS_H
28#define __CDC_MSC_CLASS_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "usb_std.h"
35#include "usbd_core.h"
36
52#define USBD_CDC_INT_EPT 0x82
53#define USBD_CDC_BULK_IN_EPT 0x83
54#define USBD_CDC_BULK_OUT_EPT 0x02
55
56#define USBD_MSC_BULK_IN_EPT 0x81
57#define USBD_MSC_BULK_OUT_EPT 0x01
58
62#define USBD_CDC_MSC_IN_MAXPACKET_SIZE 0x40
63
64#define USBD_CDC_MSC_OUT_MAXPACKET_SIZE 0x40
65#define USBD_CDC_CMD_MAXPACKET_SIZE 0x08
66
67
68
69
82#define MSC_SUPPORT_MAX_LUN 1
83#define MSC_MAX_DATA_BUF_LEN 4096
84
85#define MSC_CMD_FORMAT_UNIT 0x04
86#define MSC_CMD_INQUIRY 0x12
87#define MSC_CMD_START_STOP 0x1B
88#define MSC_CMD_MODE_SENSE6 0x1A
89#define MSC_CMD_MODE_SENSE10 0x5A
90#define MSC_CMD_ALLOW_MEDIUM_REMOVAL 0x1E
91#define MSC_CMD_READ_10 0x28
92#define MSC_CMD_READ_12 0xA8
93#define MSC_CMD_READ_CAPACITY 0x25
94#define MSC_CMD_READ_FORMAT_CAPACITY 0x23
95#define MSC_CMD_REQUEST_SENSE 0x03
96#define MSC_CMD_TEST_UNIT 0x00
97#define MSC_CMD_VERIFY 0x2F
98#define MSC_CMD_WRITE_10 0x2A
99#define MSC_CMD_WRITE_12 0xAA
100#define MSC_CMD_WRITE_VERIFY 0x2E
101
102#define MSC_REQ_GET_MAX_LUN 0xFE
103#define MSC_REQ_BO_RESET 0xFF
105#define SET_LINE_CODING 0x20
106#define GET_LINE_CODING 0x21
107
108#define CBW_CMD_LENGTH 31
109#define CBW_DCBWSIGNATURE 0x43425355
110#define CBW_BMCBWFLAGS_DIR_OUT 0x00
111#define CBW_BMCBWFLAGS_DIR_IN 0x80
112
113#define CSW_CMD_LENGTH 13
114#define CSW_DCSWSIGNATURE 0x53425355
115#define CSW_BCSWSTATUS_PASS 0x00
116#define CSW_BCSWSTATUS_FAILED 0x01
117#define CSW_BCSWSTATUS_PHASE_ERR 0x02
118
119#define MSC_STATE_MACHINE_CMD 0x00
120#define MSC_STATE_MACHINE_DATA_IN 0x01
121#define MSC_STATE_MACHINE_DATA_OUT 0x02
122#define MSC_STATE_MACHINE_SEND_DATA 0x03
123#define MSC_STATE_MACHINE_LAST_DATA 0x04
124#define MSC_STATE_MACHINE_STATUS 0x05
125#define MSC_STATE_MACHINE_FAILED 0x06
126#define MSC_STATE_MACHINE_IDLE 0x07
127
128#define MSC_BOT_STATE_IDLE 0x00
129#define MSC_BOT_STATE_RECOVERY 0x01
130#define MSC_BOT_STATE_ERROR 0x02
131
132#define REQ_SENSE_STANDARD_DATA_LEN 0x12
133#define SENSE_KEY_NO_SENSE 0x00
134#define SENSE_KEY_RECOVERED_ERROR 0x01
135#define SENSE_KEY_NOT_READY 0x02
136#define SENSE_KEY_MEDIUM_ERROR 0x03
137#define SENSE_KEY_HARDWARE_ERROR 0x04
138#define SENSE_KEY_ILLEGAL_REQUEST 0x05
139#define SENSE_KEY_UNIT_ATTENTION 0x06
140#define SENSE_KEY_DATA_PROTECT 0x07
141#define SENSE_KEY_BLANK_CHECK 0x08
142#define SENSE_KEY_VENDERO_SPECIFIC 0x09
143#define SENSE_KEY_ABORTED_COMMAND 0x0B
144#define SENSE_KEY_VOLUME_OVERFLOW 0x0D
145#define SENSE_KEY_MISCOMPARE 0x0E
146
147
148#define INVALID_COMMAND 0x20
149#define INVALID_FIELED_IN_COMMAND 0x24
150#define PARAMETER_LIST_LENGTH_ERROR 0x1A
151#define INVALID_FIELD_IN_PARAMETER_LIST 0x26
152#define ADDRESS_OUT_OF_RANGE 0x21
153#define MEDIUM_NOT_PRESENT 0x3A
154#define MEDIUM_HAVE_CHANGED 0x28
155
156#define SCSI_INQUIRY_DATA_LENGTH 36
157
161typedef struct
162{
163 uint8_t opcode;
164 uint8_t lun;
165 uint32_t address;
166 uint8_t reserved1;
167 uint32_t alloc_length;
168 uint16_t reserved2;
169}cbd_typical_type;
170
174typedef struct
175{
176 uint8_t opcode;
177 uint8_t lun;
178 uint32_t address;
179 uint8_t reserved1;
180 uint32_t alloc_length;
181 uint16_t reserved2;
182}cbd_extended_type;
183
187typedef struct
188{
189 uint32_t dCBWSignature;
190 uint32_t dCBWTage;
191 uint32_t dCBWDataTransferLength;
192 uint8_t bmCBWFlags;
193 uint8_t bCBWLUN;
194 uint8_t bCBWCBLength;
195 uint8_t CBWCB[16];
196}cbw_type;
197
201typedef struct
202{
203 uint32_t dCSWSignature;
204 uint32_t dCSWTag;
205 uint32_t dCSWDataResidue;
206 uint32_t bCSWStatus;
207}csw_type;
208
212typedef struct
213{
214 uint8_t err_code;
215 uint8_t reserved1;
216 uint8_t sense_key;
217 uint32_t information;
218 uint8_t as_length;
219 uint32_t reserved2;
220 uint8_t asc;
221 uint8_t ascq;
222 uint32_t reserved3;
223}sense_type;
224
225
226typedef struct
227{
228 uint8_t msc_state;
229 uint8_t bot_status;
230 uint32_t max_lun;
231
232 uint32_t blk_nbr[MSC_SUPPORT_MAX_LUN];
233 uint32_t blk_size[MSC_SUPPORT_MAX_LUN];
234
235 uint32_t blk_addr;
236 uint32_t blk_len;
237
238 uint32_t data_len;
239 uint8_t data[MSC_MAX_DATA_BUF_LEN];
240
241 uint32_t alt_setting;
242
243 cbw_type cbw_struct;
244 csw_type csw_struct;
245
246}msc_type;
247
251typedef struct
252{
253 //used for CDC
254 uint32_t alt_setting;
255 uint8_t g_rx_buff[USBD_CDC_MSC_OUT_MAXPACKET_SIZE];
256 uint8_t g_cmd[USBD_CDC_CMD_MAXPACKET_SIZE];
257 uint8_t g_req;
258 uint16_t g_len, g_rxlen;
259 __IO uint8_t g_tx_completed, g_rx_completed;
260 linecoding_type linecoding;
261
262 //used for MSC
263 uint8_t msc_state;
264 uint8_t bot_status;
265 uint32_t max_lun;
266
267 uint32_t blk_nbr[MSC_SUPPORT_MAX_LUN];
268 uint32_t blk_size[MSC_SUPPORT_MAX_LUN];
269
270 uint64_t blk_addr;
271 uint32_t blk_len;
272
273 uint32_t data_len;
274 uint8_t data[MSC_MAX_DATA_BUF_LEN];
275
276 cbw_type cbw_struct;
277 csw_type csw_struct;
278}cdc_msc_struct_type; //cdc_struct_type;
279
280
288extern usbd_class_handler cdc_msc_class_handler; //cdc_class_handler;
289uint16_t usb_vcp_get_rxdata(void *udev, uint8_t *recv_data);
290 error_status usb_vcp_send_data(void *udev, uint8_t *send_data, uint16_t len);
291
292void bot_scsi_init(void *udev);
293void bot_scsi_reset(void *udev);
294void bot_scsi_datain_handler(void *pudev, uint8_t ept_num);
295void bot_scsi_dataout_handler(void *pudev, uint8_t ept_num);
296void bot_cbw_decode(void *udev);
297void bot_scsi_send_data(void *udev, uint8_t *buffer, uint32_t len);
298void bot_scsi_send_csw(void *udev, uint8_t status);
299void bot_scsi_sense_code(void *udev, uint8_t sense_key, uint8_t asc);
300 usb_sts_type bot_scsi_check_address(void *udev, uint8_t lun, uint32_t blk_offset, uint32_t blk_count);
301void bot_scsi_stall(void *udev);
302 usb_sts_type bot_scsi_cmd_process(void *udev);
303
304 usb_sts_type bot_scsi_test_unit(void *udev, uint8_t lun);
305 usb_sts_type bot_scsi_inquiry(void *udev, uint8_t lun);
306 usb_sts_type bot_scsi_start_stop(void *udev, uint8_t lun);
307 usb_sts_type bot_scsi_allow_medium_removal(void *udev, uint8_t lun);
308 usb_sts_type bot_scsi_mode_sense6(void *udev, uint8_t lun);
309 usb_sts_type bot_scsi_mode_sense10(void *udev, uint8_t lun);
310 usb_sts_type bot_scsi_read10(void *udev, uint8_t lun);
311 usb_sts_type bot_scsi_capacity(void *udev, uint8_t lun);
312 usb_sts_type bot_scsi_format_capacity(void *udev, uint8_t lun);
313 usb_sts_type bot_scsi_request_sense(void *udev, uint8_t lun);
314 usb_sts_type bot_scsi_verify(void *udev, uint8_t lun);
315 usb_sts_type bot_scsi_write10(void *udev, uint8_t lun);
316void bot_scsi_clear_feature(void *udev, uint8_t ept_num);
317
329#ifdef __cplusplus
330}
331#endif
332
333#endif
334
335
336
337
buffer
uint8_t buffer[((uint16_t) 160) *((uint16_t) 120)]
Definition project/at_start_f413/examples/cortex_m4/fpu/src/main.c:42
cdc_msc_struct_type::cbw_struct
cbw_type cbw_struct
Definition cdc_msc_class.h:276
cbd_typical_type::opcode
uint8_t opcode
Definition cdc_msc_class.h:163
cbd_typical_type::address
uint32_t address
Definition cdc_msc_class.h:165
cbd_typical_type::alloc_length
uint32_t alloc_length
Definition cdc_msc_class.h:167
cbw_type::bCBWLUN
uint8_t bCBWLUN
Definition cdc_msc_class.h:193
msc_type::cbw_struct
cbw_type cbw_struct
Definition cdc_msc_class.h:243
sense_type::err_code
uint8_t err_code
Definition cdc_msc_class.h:214
cdc_msc_struct_type::g_req
uint8_t g_req
Definition cdc_msc_class.h:257
sense_type::ascq
uint8_t ascq
Definition cdc_msc_class.h:221
cbw_type::bCBWCBLength
uint8_t bCBWCBLength
Definition cdc_msc_class.h:194
cdc_msc_struct_type::alt_setting
uint32_t alt_setting
Definition cdc_msc_class.h:254
cdc_msc_struct_type::msc_state
uint8_t msc_state
Definition cdc_msc_class.h:263
csw_type::dCSWSignature
uint32_t dCSWSignature
Definition cdc_msc_class.h:203
cbd_typical_type::reserved1
uint8_t reserved1
Definition cdc_msc_class.h:166
sense_type::reserved3
uint32_t reserved3
Definition cdc_msc_class.h:222
cbd_extended_type::alloc_length
uint32_t alloc_length
Definition cdc_msc_class.h:180
csw_type::bCSWStatus
uint32_t bCSWStatus
Definition cdc_msc_class.h:206
cdc_msc_struct_type::blk_len
uint32_t blk_len
Definition cdc_msc_class.h:271
sense_type::asc
uint8_t asc
Definition cdc_msc_class.h:220
csw_type::dCSWTag
uint32_t dCSWTag
Definition cdc_msc_class.h:204
cbd_extended_type::opcode
uint8_t opcode
Definition cdc_msc_class.h:176
csw_type::dCSWDataResidue
uint32_t dCSWDataResidue
Definition cdc_msc_class.h:205
cbd_extended_type::address
uint32_t address
Definition cdc_msc_class.h:178
cdc_msc_struct_type::csw_struct
csw_type csw_struct
Definition cdc_msc_class.h:277
msc_type::csw_struct
csw_type csw_struct
Definition cdc_msc_class.h:244
msc_type::blk_len
uint32_t blk_len
Definition cdc_msc_class.h:236
sense_type::as_length
uint8_t as_length
Definition cdc_msc_class.h:218
sense_type::reserved2
uint32_t reserved2
Definition cdc_msc_class.h:219
cdc_msc_struct_type::blk_addr
uint64_t blk_addr
Definition cdc_msc_class.h:270
msc_type::blk_addr
uint32_t blk_addr
Definition cdc_msc_class.h:235
cbd_extended_type::reserved1
uint8_t reserved1
Definition cdc_msc_class.h:179
cbd_extended_type::reserved2
uint16_t reserved2
Definition cdc_msc_class.h:181
cdc_msc_struct_type::data_len
uint32_t data_len
Definition cdc_msc_class.h:273
cdc_msc_struct_type::linecoding
linecoding_type linecoding
Definition cdc_msc_class.h:260
sense_type::sense_key
uint8_t sense_key
Definition cdc_msc_class.h:216
cbd_typical_type::lun
uint8_t lun
Definition cdc_msc_class.h:164
cbd_typical_type::reserved2
uint16_t reserved2
Definition cdc_msc_class.h:168
msc_type::max_lun
uint32_t max_lun
Definition cdc_msc_class.h:230
msc_type::bot_status
uint8_t bot_status
Definition cdc_msc_class.h:229
cbd_extended_type::lun
uint8_t lun
Definition cdc_msc_class.h:177
msc_type::msc_state
uint8_t msc_state
Definition cdc_msc_class.h:228
sense_type::reserved1
uint8_t reserved1
Definition cdc_msc_class.h:215
msc_type::alt_setting
uint32_t alt_setting
Definition cdc_msc_class.h:241
cdc_msc_struct_type::g_len
uint16_t g_len
Definition cdc_msc_class.h:258
cbw_type::dCBWDataTransferLength
uint32_t dCBWDataTransferLength
Definition cdc_msc_class.h:191
sense_type::information
uint32_t information
Definition cdc_msc_class.h:217
msc_type::data_len
uint32_t data_len
Definition cdc_msc_class.h:238
cdc_msc_struct_type::max_lun
uint32_t max_lun
Definition cdc_msc_class.h:265
cbw_type::dCBWTage
uint32_t dCBWTage
Definition cdc_msc_class.h:190
cbw_type::dCBWSignature
uint32_t dCBWSignature
Definition cdc_msc_class.h:189
cdc_msc_struct_type::bot_status
uint8_t bot_status
Definition cdc_msc_class.h:264
cdc_msc_struct_type::g_rx_completed
__IO uint8_t g_rx_completed
Definition cdc_msc_class.h:259
cbw_type::bmCBWFlags
uint8_t bmCBWFlags
Definition cdc_msc_class.h:192
error_status
error_status
error status
Definition at32f413.h:302
USBD_CDC_CMD_MAXPACKET_SIZE
#define USBD_CDC_CMD_MAXPACKET_SIZE
Definition cdc_msc_class.h:65
USBD_CDC_MSC_OUT_MAXPACKET_SIZE
#define USBD_CDC_MSC_OUT_MAXPACKET_SIZE
Definition cdc_msc_class.h:64
bot_scsi_format_capacity
usb_sts_type bot_scsi_format_capacity(void *udev, uint8_t lun)
bulk-only transport scsi command format capacity
Definition composite_cdc_msc/msc_bot_scsi.c:504
bot_scsi_start_stop
usb_sts_type bot_scsi_start_stop(void *udev, uint8_t lun)
bulk-only transport scsi command start stop
Definition composite_cdc_msc/msc_bot_scsi.c:409
bot_scsi_request_sense
usb_sts_type bot_scsi_request_sense(void *udev, uint8_t lun)
bulk-only transport scsi command request sense
Definition composite_cdc_msc/msc_bot_scsi.c:539
bot_scsi_dataout_handler
void bot_scsi_dataout_handler(void *pudev, uint8_t ept_num)
bulk-only transport data out handler
Definition composite_cdc_msc/msc_bot_scsi.c:172
usb_vcp_get_rxdata
uint16_t usb_vcp_get_rxdata(void *udev, uint8_t *recv_data)
usb device class rx data process
Definition cdc_class.c:344
bot_scsi_read10
usb_sts_type bot_scsi_read10(void *udev, uint8_t lun)
bulk-only transport scsi command read10
Definition composite_cdc_msc/msc_bot_scsi.c:598
bot_scsi_check_address
usb_sts_type bot_scsi_check_address(void *udev, uint8_t lun, uint32_t blk_offset, uint32_t blk_count)
check address
Definition composite_cdc_msc/msc_bot_scsi.c:303
bot_scsi_write10
usb_sts_type bot_scsi_write10(void *udev, uint8_t lun)
bulk-only transport scsi command write10
Definition composite_cdc_msc/msc_bot_scsi.c:659
bot_scsi_reset
void bot_scsi_reset(void *udev)
reset bulk-only transport and scsi
Definition composite_cdc_msc/msc_bot_scsi.c:125
bot_scsi_mode_sense10
usb_sts_type bot_scsi_mode_sense10(void *udev, uint8_t lun)
bulk-only transport scsi command mode sense10
Definition composite_cdc_msc/msc_bot_scsi.c:457
bot_scsi_sense_code
void bot_scsi_sense_code(void *udev, uint8_t sense_key, uint8_t asc)
send scsi sense code
Definition composite_cdc_msc/msc_bot_scsi.c:288
bot_cbw_decode
void bot_cbw_decode(void *udev)
bulk-only cbw decode
Definition composite_cdc_msc/msc_bot_scsi.c:196
bot_scsi_verify
usb_sts_type bot_scsi_verify(void *udev, uint8_t lun)
bulk-only transport scsi command verify
Definition composite_cdc_msc/msc_bot_scsi.c:570
bot_scsi_allow_medium_removal
usb_sts_type bot_scsi_allow_medium_removal(void *udev, uint8_t lun)
bulk-only transport scsi command meidum removal
Definition composite_cdc_msc/msc_bot_scsi.c:423
usb_vcp_send_data
error_status usb_vcp_send_data(void *udev, uint8_t *send_data, uint16_t len)
usb device class send data
Definition cdc_class.c:374
bot_scsi_init
void bot_scsi_init(void *udev)
initialize bulk-only transport and scsi
Definition composite_cdc_msc/msc_bot_scsi.c:103
bot_scsi_cmd_process
usb_sts_type bot_scsi_cmd_process(void *udev)
bulk-only transport scsi command process
Definition composite_cdc_msc/msc_bot_scsi.c:749
bot_scsi_datain_handler
void bot_scsi_datain_handler(void *pudev, uint8_t ept_num)
bulk-only transport data in handler
Definition composite_cdc_msc/msc_bot_scsi.c:143
bot_scsi_mode_sense6
usb_sts_type bot_scsi_mode_sense6(void *udev, uint8_t lun)
bulk-only transport scsi command mode sense6
Definition composite_cdc_msc/msc_bot_scsi.c:437
bot_scsi_stall
void bot_scsi_stall(void *udev)
bot endpoint stall
Definition composite_cdc_msc/msc_bot_scsi.c:320
bot_scsi_send_data
void bot_scsi_send_data(void *udev, uint8_t *buffer, uint32_t len)
send bot data
Definition composite_cdc_msc/msc_bot_scsi.c:243
bot_scsi_test_unit
usb_sts_type bot_scsi_test_unit(void *udev, uint8_t lun)
bulk-only transport scsi command test unit
Definition composite_cdc_msc/msc_bot_scsi.c:346
bot_scsi_inquiry
usb_sts_type bot_scsi_inquiry(void *udev, uint8_t lun)
bulk-only transport scsi command inquiry
Definition composite_cdc_msc/msc_bot_scsi.c:368
bot_scsi_capacity
usb_sts_type bot_scsi_capacity(void *udev, uint8_t lun)
bulk-only transport scsi command capacity
Definition composite_cdc_msc/msc_bot_scsi.c:477
cdc_msc_class_handler
usbd_class_handler cdc_msc_class_handler
Definition cdc_msc_class.c:71
bot_scsi_clear_feature
void bot_scsi_clear_feature(void *udev, uint8_t ept_num)
clear feature
Definition composite_cdc_msc/msc_bot_scsi.c:729
bot_scsi_send_csw
void bot_scsi_send_csw(void *udev, uint8_t status)
send command status
Definition composite_cdc_msc/msc_bot_scsi.c:264
MSC_MAX_DATA_BUF_LEN
#define MSC_MAX_DATA_BUF_LEN
Definition cdc_msc_class.h:83
MSC_SUPPORT_MAX_LUN
#define MSC_SUPPORT_MAX_LUN
Definition cdc_msc_class.h:82
usb_sts_type
usb_sts_type
usb return status
Definition usb_std.h:285
cbd_extended_type
extended command block description
Definition cdc_msc_class.h:175
cbd_typical_type
typical command block description
Definition cdc_msc_class.h:162
cbw_type
command block wrapper
Definition cdc_msc_class.h:188
cdc_msc_struct_type
usb cdc class struct
Definition cdc_msc_class.h:252
csw_type
command block wrapper
Definition cdc_msc_class.h:202
linecoding_type
usb cdc class set line coding struct
Definition usb_std.h:219
msc_type
Definition cdc_msc_class.h:227
sense_type
request sense standard data
Definition cdc_msc_class.h:213
usbd_class_handler
usb device class handler
Definition usbd_core.h:97
usb_std.h
usb standard header file
usbd_core.h
usb device core header file


AT32F413 Firmwary Library: cdc_msc_desc.c Source File

  • middlewares
  • usbd_class
  • composite_cdc_msc
cdc_msc_desc.c
Go to the documentation of this file.
1
25#include "stdio.h"
26#include "usb_std.h"
27#include "usbd_sdr.h"
28#include "usbd_core.h"
29#include "cdc_msc_desc.h"
30
44#define USB_INTERFACE_ASSOCIATION_TYPE 0x0B
45
46static usbd_desc_t *get_device_descriptor(void);
47static usbd_desc_t *get_device_qualifier(void);
48static usbd_desc_t *get_device_configuration(void);
49static usbd_desc_t *get_device_other_speed(void);
50static usbd_desc_t *get_device_lang_id(void);
51static usbd_desc_t *get_device_manufacturer_string(void);
52static usbd_desc_t *get_device_product_string(void);
53static usbd_desc_t *get_device_serial_string(void);
54static usbd_desc_t *get_device_interface_string(void);
55static usbd_desc_t *get_device_config_string(void);
56
57static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf);
58static void usbd_int_to_unicode (uint32_t value , uint8_t *pbuf , uint8_t len);
59static void get_serial_num(void);
60#if defined ( __ICCARM__ ) /* iar compiler */
61 #pragma data_alignment=4
62#endif
63ALIGNED_HEAD static uint8_t g_usbd_desc_buffer[256] ALIGNED_TAIL;
64
68 usbd_desc_handler cdc_msc_desc_handler =
69{
70 get_device_descriptor,
71 get_device_qualifier,
72 get_device_configuration,
73 get_device_other_speed,
74 get_device_lang_id,
75 get_device_manufacturer_string,
76 get_device_product_string,
77 get_device_serial_string,
78 get_device_interface_string,
79 get_device_config_string,
80};
81
85#if defined ( __ICCARM__ ) /* iar compiler */
86 #pragma data_alignment=4
87#endif
88ALIGNED_HEAD static uint8_t g_usbd_descriptor[USB_DEVICE_DESC_LEN] ALIGNED_TAIL =
89{
90 USB_DEVICE_DESC_LEN, /* bLength */
91 USB_DESCIPTOR_TYPE_DEVICE, /* bDescriptorType */
92 0x00, /* bcdUSB */
93 0x02,
94 0xEF, /* bDeviceClass */
95 0x02, /* bDeviceSubClass */
96 0x01, /* bDeviceProtocol */
97 USB_MAX_EP0_SIZE, /* bMaxPacketSize */
98 LBYTE(USBD_CDC_MSC_VENDOR_ID), /* idVendor */
99 HBYTE(USBD_CDC_MSC_VENDOR_ID), /* idVendor */
100 LBYTE(USBD_CDC_MSC_PRODUCT_ID), /* idProduct */
101 HBYTE(USBD_CDC_MSC_PRODUCT_ID), /* idProduct */
102 0x00, /* bcdDevice rel. 2.00 */
103 0x02,
104 USB_MFC_STRING, /* Index of manufacturer string */
105 USB_PRODUCT_STRING, /* Index of product string */
106 USB_SERIAL_STRING, /* Index of serial number string */
107 1 /* bNumConfigurations */
108};
109
113#if defined ( __ICCARM__ ) /* iar compiler */
114 #pragma data_alignment=4
115#endif
116ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_CDC_MSC_CONFIG_DESC_SIZE] ALIGNED_TAIL =
117{
118 USB_DEVICE_CFG_DESC_LEN, /* bLength: configuration descriptor size */
119 USB_DESCIPTOR_TYPE_CONFIGURATION, /* bDescriptorType: configuration */
120 LBYTE(USBD_CDC_MSC_CONFIG_DESC_SIZE), /* wTotalLength: bytes returned */
121 HBYTE(USBD_CDC_MSC_CONFIG_DESC_SIZE), /* wTotalLength: bytes returned */
122 0x03, /* bNumInterfaces: 3 interface */
123 0x01, /* bConfigurationValue: configuration value */
124 0x00, /* iConfiguration: index of string descriptor describing
125 the configuration */
126 0xC0, /* bmAttributes: self powered */
127 0x32, /* MaxPower 100 mA: this current is used for detecting vbus */
128
129 // IAD (Interface Association Descriptor) for MSC
130 0x08, /* bLength */
131 USB_INTERFACE_ASSOCIATION_TYPE, /* bDescriptorType */
132 0x00, /* bFirstInterface */
133 0x01, /* bInterfaceCount */
134 0x08, /* bFunctionClass */
135 0x06, /* bFunctionSubClass */
136 0x50, /* bFunctionProtocol */
137 0x00, /* iFunction (Index of string descriptor describing this function) */
138
139 // Configuration Descriptor for MSC
140 USB_DEVICE_IF_DESC_LEN, /* bLength: interface descriptor size */
141 USB_DESCIPTOR_TYPE_INTERFACE, /* bDescriptorType: interface descriptor type */
142 VCPMSC_MSC_INTERFACE, /* bInterfaceNumber: number of interface */
143 0x00, /* bAlternateSetting: alternate set */
144 0x02, /* bNumEndpoints: number of endpoints */
145 USB_CLASS_CODE_MSC, /* bInterfaceClass: msc class code */
146 0x06, /* bInterfaceSubClass: subclass code scsi */
147 0x50, /* bInterfaceProtocol: protocol code BBB */
148 0x00, /* iInterface: index of string descriptor */
149
150 USB_DEVICE_EPT_LEN, /* bLength: size of endpoint descriptor in bytes */
151 USB_DESCIPTOR_TYPE_ENDPOINT, /* bDescriptorType: endpoint descriptor type */
152 USBD_MSC_BULK_IN_EPT, /* bEndpointAddress: the address of endpoint on usb device described by this descriptor */
153 USB_EPT_DESC_BULK, /* bmAttributes: endpoint attributes */
154 LBYTE(USBD_CDC_MSC_IN_MAXPACKET_SIZE),
155 HBYTE(USBD_CDC_MSC_IN_MAXPACKET_SIZE), /* wMaxPacketSize: maximum packe size this endpoint */
156 0x00, /* bInterval: interval for polling endpoint for data transfers */
157
158 USB_DEVICE_EPT_LEN, /* bLength: size of endpoint descriptor in bytes */
159 USB_DESCIPTOR_TYPE_ENDPOINT, /* bDescriptorType: endpoint descriptor type */
160 USBD_MSC_BULK_OUT_EPT, /* bEndpointAddress: the address of endpoint on usb device described by this descriptor */
161 USB_EPT_DESC_BULK, /* bmAttributes: endpoint attributes */
162 LBYTE(USBD_CDC_MSC_OUT_MAXPACKET_SIZE),
163 HBYTE(USBD_CDC_MSC_OUT_MAXPACKET_SIZE), /* wMaxPacketSize: maximum packe size this endpoint */
164 0x00, /* bInterval: interval for polling endpoint for data transfers */
165
166 // IAD (Interface Association Descriptor) for CDC
167 0x08, /* bLength */
168 USB_INTERFACE_ASSOCIATION_TYPE, /* bDescriptorType */
169 0x01, /* bFirstInterface */
170 0x02, /* bInterfaceCount */
171 USB_CLASS_CODE_CDC, /* bFunctionClass */
172 0x02, /* bFunctionSubClass */
173 0x01, /* bFunctionProtocol */
174 0x00, /* iFunction (Index of string descriptor describing this function) */
175
176 // Configuration Descriptor for CDC
177 USB_DEVICE_IF_DESC_LEN, /* bLength: interface descriptor size */
178 USB_DESCIPTOR_TYPE_INTERFACE, /* bDescriptorType: interface descriptor type */
179 VCPMSC_CDC_INTERFACE, /* bInterfaceNumber: number of interface */
180 0x00, /* bAlternateSetting: alternate set */
181 0x01, /* bNumEndpoints: number of endpoints */
182 USB_CLASS_CODE_CDC, /* bInterfaceClass: CDC class code */
183 0x02, /* bInterfaceSubClass: subclass code, Abstract Control Model*/
184 0x01, /* bInterfaceProtocol: protocol code, AT Command */
185 0x00, /* iInterface: index of string descriptor */
186
187 0x05, /* bFunctionLength: size of this descriptor in bytes */
188 USBD_CDC_CS_INTERFACE, /* bDescriptorType: CDC interface descriptor type */
189 USBD_CDC_SUBTYPE_HEADER, /* bDescriptorSubtype: Header function Descriptor 0x00*/
190 LBYTE(CDC_BCD_NUM),
191 HBYTE(CDC_BCD_NUM), /* bcdCDC: USB class definitions for communications */
192
193 0x05, /* bFunctionLength: size of this descriptor in bytes */
194 USBD_CDC_CS_INTERFACE, /* bDescriptorType: CDC interface descriptor type */
195 USBD_CDC_SUBTYPE_CMF, /* bDescriptorSubtype: Call Management function descriptor subtype 0x01 */
196 0x00, /* bmCapabilities: 0x00*/
197 0x01, /* bDataInterface: interface number of data class interface optionally used for call management */
198
199 0x04, /* bFunctionLength: size of this descriptor in bytes */
200 USBD_CDC_CS_INTERFACE, /* bDescriptorType: CDC interface descriptor type */
201 USBD_CDC_SUBTYPE_ACM, /* bDescriptorSubtype: Abstract Control Management functional descriptor subtype 0x02 */
202 0x02, /* bmCapabilities: Support Set_Line_Coding and Get_Line_Coding 0x02 */
203
204 0x05, /* bFunctionLength: size of this descriptor in bytes */
205 USBD_CDC_CS_INTERFACE, /* bDescriptorType: CDC interface descriptor type */
206 USBD_CDC_SUBTYPE_UFD, /* bDescriptorSubtype: Union Function Descriptor subtype 0x06 */
207 0x01, /* bControlInterface: The interface number of the communications or data class interface 0x00 */
208 0x02, /* bSubordinateInterface0: interface number of first subordinate interface in the union */
209
210 USB_DEVICE_EPT_LEN, /* bLength: size of endpoint descriptor in bytes */
211 USB_DESCIPTOR_TYPE_ENDPOINT, /* bDescriptorType: endpoint descriptor type */
212 USBD_CDC_INT_EPT, /* bEndpointAddress: the address of endpoint on usb device described by this descriptor */
213 USB_EPT_DESC_INTERRUPT, /* bmAttributes: endpoint attributes */
214 LBYTE(USBD_CDC_CMD_MAXPACKET_SIZE),
215 HBYTE(USBD_CDC_CMD_MAXPACKET_SIZE), /* wMaxPacketSize: maximum packe size this endpoint */
216 CDC_HID_BINTERVAL_TIME, /* bInterval: interval for polling endpoint for data transfers */
217
218
219 USB_DEVICE_IF_DESC_LEN, /* bLength: interface descriptor size */
220 USB_DESCIPTOR_TYPE_INTERFACE, /* bDescriptorType: interface descriptor type */
221 VCPMSC_CDC_DATA_INTERFACE, /* bInterfaceNumber: number of interface */
222 0x00, /* bAlternateSetting: alternate set */
223 0x02, /* bNumEndpoints: number of endpoints */
224 USB_CLASS_CODE_CDCDATA, /* bInterfaceClass: CDC-data class code */
225 0x00, /* bInterfaceSubClass: Data interface subclass code 0x00*/
226 0x00, /* bInterfaceProtocol: data class protocol code 0x00 */
227 0x00, /* iInterface: index of string descriptor */
228
229 USB_DEVICE_EPT_LEN, /* bLength: size of endpoint descriptor in bytes */
230 USB_DESCIPTOR_TYPE_ENDPOINT, /* bDescriptorType: endpoint descriptor type */
231 USBD_CDC_BULK_IN_EPT, /* bEndpointAddress: the address of endpoint on usb device described by this descriptor */
232 USB_EPT_DESC_BULK, /* bmAttributes: endpoint attributes */
233 LBYTE(USBD_CDC_MSC_IN_MAXPACKET_SIZE),
234 HBYTE(USBD_CDC_MSC_IN_MAXPACKET_SIZE), /* wMaxPacketSize: maximum packe size this endpoint */
235 0x00, /* bInterval: interval for polling endpoint for data transfers */
236
237 USB_DEVICE_EPT_LEN, /* bLength: size of endpoint descriptor in bytes */
238 USB_DESCIPTOR_TYPE_ENDPOINT, /* bDescriptorType: endpoint descriptor type */
239 USBD_CDC_BULK_OUT_EPT, /* bEndpointAddress: the address of endpoint on usb device described by this descriptor */
240 USB_EPT_DESC_BULK, /* bmAttributes: endpoint attributes */
241 LBYTE(USBD_CDC_MSC_OUT_MAXPACKET_SIZE),
242 HBYTE(USBD_CDC_MSC_OUT_MAXPACKET_SIZE),/* wMaxPacketSize: maximum packe size this endpoint */
243 0x00, /* bInterval: interval for polling endpoint for data transfers */
244
245
246};
247
251#if defined ( __ICCARM__ ) /* iar compiler */
252 #pragma data_alignment=4
253#endif
254ALIGNED_HEAD static uint8_t g_string_lang_id[USBD_CDC_SIZ_STRING_LANGID] ALIGNED_TAIL =
255{
256 USBD_CDC_SIZ_STRING_LANGID,
257 USB_DESCIPTOR_TYPE_STRING,
258 0x09,
259 0x04,
260};
261
265#if defined ( __ICCARM__ ) /* iar compiler */
266 #pragma data_alignment=4
267#endif
268ALIGNED_HEAD static uint8_t g_string_serial[USBD_CDC_SIZ_STRING_SERIAL] ALIGNED_TAIL =
269{
270 USBD_CDC_SIZ_STRING_SERIAL,
271 USB_DESCIPTOR_TYPE_STRING,
272};
273
274
275/* device descriptor */
276static usbd_desc_t device_descriptor =
277{
278 USB_DEVICE_DESC_LEN,
279 g_usbd_descriptor
280};
281
282/* config descriptor */
283static usbd_desc_t config_descriptor =
284{
285 USBD_CDC_MSC_CONFIG_DESC_SIZE,
286 g_usbd_configuration
287};
288
289/* langid descriptor */
290static usbd_desc_t langid_descriptor =
291{
292 USBD_CDC_SIZ_STRING_LANGID,
293 g_string_lang_id
294};
295
296/* serial descriptor */
297static usbd_desc_t serial_descriptor =
298{
299 USBD_CDC_SIZ_STRING_SERIAL,
300 g_string_serial
301};
302
303static usbd_desc_t vp_desc;
304
311static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf)
312{
313 uint16_t str_len = 0, id_pos = 2;
314 uint8_t *tmp_str = string;
315
316 while(*tmp_str != '\0')
317 {
318 str_len ++;
319 unicode_buf[id_pos ++] = *tmp_str ++;
320 unicode_buf[id_pos ++] = 0x00;
321 }
322
323 str_len = str_len * 2 + 2;
324 unicode_buf[0] = (uint8_t)str_len;
325 unicode_buf[1] = USB_DESCIPTOR_TYPE_STRING;
326
327 return str_len;
328}
329
337static void usbd_int_to_unicode (uint32_t value , uint8_t *pbuf , uint8_t len)
338{
339 uint8_t idx = 0;
340
341 for( idx = 0 ; idx < len ; idx ++)
342 {
343 if( ((value >> 28)) < 0xA )
344 {
345 pbuf[ 2 * idx] = (value >> 28) + '0';
346 }
347 else
348 {
349 pbuf[2 * idx] = (value >> 28) + 'A' - 10;
350 }
351
352 value = value << 4;
353
354 pbuf[2 * idx + 1] = 0;
355 }
356}
357
363static void get_serial_num(void)
364{
365 uint32_t serial0, serial1, serial2;
366
367 serial0 = *(uint32_t*)MCU_ID1;
368 serial1 = *(uint32_t*)MCU_ID2;
369 serial2 = *(uint32_t*)MCU_ID3;
370
371 serial0 += serial2;
372
373 if (serial0 != 0)
374 {
375 usbd_int_to_unicode (serial0, &g_string_serial[2] ,8);
376 usbd_int_to_unicode (serial1, &g_string_serial[18] ,4);
377 }
378}
379
385static usbd_desc_t *get_device_descriptor(void)
386{
387 return &device_descriptor;
388}
389
395static usbd_desc_t * get_device_qualifier(void)
396{
397 return NULL;
398}
399
405static usbd_desc_t *get_device_configuration(void)
406{
407 return &config_descriptor;
408}
409
415static usbd_desc_t *get_device_other_speed(void)
416{
417 return NULL;
418}
419
425static usbd_desc_t *get_device_lang_id(void)
426{
427 return &langid_descriptor;
428}
429
430
436static usbd_desc_t *get_device_manufacturer_string(void)
437{
438 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_CDC_DESC_MANUFACTURER_STRING, g_usbd_desc_buffer);
439 vp_desc.descriptor = g_usbd_desc_buffer;
440 return &vp_desc;
441}
442
448static usbd_desc_t *get_device_product_string(void)
449{
450 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_CDC_DESC_PRODUCT_STRING, g_usbd_desc_buffer);
451 vp_desc.descriptor = g_usbd_desc_buffer;
452 return &vp_desc;
453}
454
460static usbd_desc_t *get_device_serial_string(void)
461{
462 get_serial_num();
463 return &serial_descriptor;
464}
465
471static usbd_desc_t *get_device_interface_string(void)
472{
473 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_CDC_DESC_INTERFACE_STRING, g_usbd_desc_buffer);
474 vp_desc.descriptor = g_usbd_desc_buffer;
475 return &vp_desc;
476}
477
483static usbd_desc_t *get_device_config_string(void)
484{
485 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_CDC_DESC_CONFIGURATION_STRING, g_usbd_desc_buffer);
486 vp_desc.descriptor = g_usbd_desc_buffer;
487 return &vp_desc;
488}
489
cdc_msc_desc.h
usb cdc descriptor header file
NULL
#define NULL
Definition emmc_card/inc/at32_sdio.h:340
MCU_ID1
#define MCU_ID1
Definition audio_desc.h:214
MCU_ID2
#define MCU_ID2
Definition audio_desc.h:215
MCU_ID3
#define MCU_ID3
Definition audio_desc.h:216
USBD_CDC_CMD_MAXPACKET_SIZE
#define USBD_CDC_CMD_MAXPACKET_SIZE
Definition cdc_class.h:61
USBD_CDC_MSC_OUT_MAXPACKET_SIZE
#define USBD_CDC_MSC_OUT_MAXPACKET_SIZE
Definition cdc_msc_class.h:64
USBD_CDC_BULK_OUT_EPT
#define USBD_CDC_BULK_OUT_EPT
Definition cdc_class.h:54
USBD_CDC_MSC_IN_MAXPACKET_SIZE
#define USBD_CDC_MSC_IN_MAXPACKET_SIZE
usb cdc in and out max packet size define
Definition cdc_msc_class.h:62
USBD_CDC_INT_EPT
#define USBD_CDC_INT_EPT
usb cdc use endpoint define
Definition cdc_class.h:52
USBD_CDC_BULK_IN_EPT
#define USBD_CDC_BULK_IN_EPT
Definition cdc_class.h:53
USBD_MSC_BULK_IN_EPT
#define USBD_MSC_BULK_IN_EPT
Definition cdc_msc_class.h:56
USBD_MSC_BULK_OUT_EPT
#define USBD_MSC_BULK_OUT_EPT
Definition cdc_msc_class.h:57
CDC_BCD_NUM
#define CDC_BCD_NUM
usb bcd number define
Definition cdc_desc.h:51
USBD_CDC_DESC_MANUFACTURER_STRING
#define USBD_CDC_DESC_MANUFACTURER_STRING
usb string define(vendor, product configuration, interface)
Definition cdc_desc.h:69
USBD_CDC_DESC_CONFIGURATION_STRING
#define USBD_CDC_DESC_CONFIGURATION_STRING
Definition cdc_desc.h:71
USBD_CDC_SIZ_STRING_LANGID
#define USBD_CDC_SIZ_STRING_LANGID
Definition cdc_desc.h:63
USBD_CDC_DESC_PRODUCT_STRING
#define USBD_CDC_DESC_PRODUCT_STRING
Definition cdc_desc.h:70
VCPMSC_MSC_INTERFACE
#define VCPMSC_MSC_INTERFACE
usb interface define
Definition cdc_msc_desc.h:83
USBD_CDC_MSC_CONFIG_DESC_SIZE
#define USBD_CDC_MSC_CONFIG_DESC_SIZE
usb descriptor size define
Definition cdc_msc_desc.h:63
CDC_HID_BINTERVAL_TIME
#define CDC_HID_BINTERVAL_TIME
usb endpoint interval define
Definition cdc_desc.h:77
VCPMSC_CDC_INTERFACE
#define VCPMSC_CDC_INTERFACE
Definition cdc_msc_desc.h:84
USBD_CDC_SIZ_STRING_SERIAL
#define USBD_CDC_SIZ_STRING_SERIAL
Definition cdc_desc.h:64
USBD_CDC_DESC_INTERFACE_STRING
#define USBD_CDC_DESC_INTERFACE_STRING
Definition cdc_desc.h:72
USBD_CDC_MSC_PRODUCT_ID
#define USBD_CDC_MSC_PRODUCT_ID
Definition cdc_msc_desc.h:57
VCPMSC_CDC_DATA_INTERFACE
#define VCPMSC_CDC_DATA_INTERFACE
Definition cdc_msc_desc.h:85
USBD_CDC_MSC_VENDOR_ID
#define USBD_CDC_MSC_VENDOR_ID
usb vendor id and product id define
Definition cdc_msc_desc.h:56
serial_descriptor
static usbd_desc_t serial_descriptor
Definition cdc_msc_desc.c:297
cdc_msc_desc_handler
usbd_desc_handler cdc_msc_desc_handler
device descriptor handler structure
Definition cdc_msc_desc.c:68
USB_INTERFACE_ASSOCIATION_TYPE
#define USB_INTERFACE_ASSOCIATION_TYPE
Definition cdc_msc_desc.c:44
device_descriptor
static usbd_desc_t device_descriptor
Definition cdc_msc_desc.c:276
get_device_configuration
static usbd_desc_t * get_device_configuration(void)
get config descriptor
Definition cdc_msc_desc.c:405
langid_descriptor
static usbd_desc_t langid_descriptor
Definition cdc_msc_desc.c:290
get_device_descriptor
static usbd_desc_t * get_device_descriptor(void)
get device descriptor
Definition cdc_msc_desc.c:385
get_device_manufacturer_string
static usbd_desc_t * get_device_manufacturer_string(void)
get manufacturer descriptor
Definition cdc_msc_desc.c:436
get_device_qualifier
static usbd_desc_t * get_device_qualifier(void)
get device qualifier
Definition cdc_msc_desc.c:395
get_device_interface_string
static usbd_desc_t * get_device_interface_string(void)
get interface descriptor
Definition cdc_msc_desc.c:471
vp_desc
static usbd_desc_t vp_desc
Definition cdc_msc_desc.c:303
get_device_other_speed
static usbd_desc_t * get_device_other_speed(void)
get other speed descriptor
Definition cdc_msc_desc.c:415
ALIGNED_TAIL
static ALIGNED_HEAD uint8_t g_usbd_desc_buffer[256] ALIGNED_TAIL
usb device standard descriptor
Definition cdc_msc_desc.c:63
get_device_product_string
static usbd_desc_t * get_device_product_string(void)
get product descriptor
Definition cdc_msc_desc.c:448
get_device_config_string
static usbd_desc_t * get_device_config_string(void)
get device config descriptor
Definition cdc_msc_desc.c:483
usbd_unicode_convert
static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf)
standard usb unicode convert
Definition cdc_msc_desc.c:311
get_device_lang_id
static usbd_desc_t * get_device_lang_id(void)
get lang id descriptor
Definition cdc_msc_desc.c:425
get_serial_num
static void get_serial_num(void)
usb get serial number
Definition cdc_msc_desc.c:363
config_descriptor
static usbd_desc_t config_descriptor
Definition cdc_msc_desc.c:283
get_device_serial_string
static usbd_desc_t * get_device_serial_string(void)
get serial descriptor
Definition cdc_msc_desc.c:460
usbd_int_to_unicode
static void usbd_int_to_unicode(uint32_t value, uint8_t *pbuf, uint8_t len)
usb int convert to unicode
Definition cdc_msc_desc.c:337
HBYTE
#define HBYTE(x)
Definition usb_std.h:271
USB_DEVICE_EPT_LEN
#define USB_DEVICE_EPT_LEN
Definition usb_std.h:159
USB_MAX_EP0_SIZE
#define USB_MAX_EP0_SIZE
endpoint 0 max size
Definition usb_std.h:248
USB_PRODUCT_STRING
#define USB_PRODUCT_STRING
Definition usb_std.h:105
USB_DESCIPTOR_TYPE_CONFIGURATION
#define USB_DESCIPTOR_TYPE_CONFIGURATION
Definition usb_std.h:92
USB_CLASS_CODE_MSC
#define USB_CLASS_CODE_MSC
Definition usb_std.h:171
LBYTE
#define LBYTE(x)
low byte and high byte define
Definition usb_std.h:270
USB_DESCIPTOR_TYPE_ENDPOINT
#define USB_DESCIPTOR_TYPE_ENDPOINT
Definition usb_std.h:95
USBD_CDC_SUBTYPE_CMF
#define USBD_CDC_SUBTYPE_CMF
Definition usb_std.h:205
USB_DEVICE_DESC_LEN
#define USB_DEVICE_DESC_LEN
Definition usb_std.h:156
USB_MFC_STRING
#define USB_MFC_STRING
Definition usb_std.h:104
USB_EPT_DESC_BULK
#define USB_EPT_DESC_BULK
Definition usb_std.h:183
USBD_CDC_SUBTYPE_HEADER
#define USBD_CDC_SUBTYPE_HEADER
usb cdc class sub-type define
Definition usb_std.h:204
USB_DEVICE_IF_DESC_LEN
#define USB_DEVICE_IF_DESC_LEN
Definition usb_std.h:158
USB_DEVICE_CFG_DESC_LEN
#define USB_DEVICE_CFG_DESC_LEN
Definition usb_std.h:157
USBD_CDC_CS_INTERFACE
#define USBD_CDC_CS_INTERFACE
usb cdc class descriptor define
Definition usb_std.h:198
USB_EPT_DESC_INTERRUPT
#define USB_EPT_DESC_INTERRUPT
Definition usb_std.h:184
USB_SERIAL_STRING
#define USB_SERIAL_STRING
Definition usb_std.h:106
USB_DESCIPTOR_TYPE_DEVICE
#define USB_DESCIPTOR_TYPE_DEVICE
usb standard device type
Definition usb_std.h:91
USB_CLASS_CODE_CDCDATA
#define USB_CLASS_CODE_CDCDATA
Definition usb_std.h:173
USB_DESCIPTOR_TYPE_STRING
#define USB_DESCIPTOR_TYPE_STRING
Definition usb_std.h:93
USB_DESCIPTOR_TYPE_INTERFACE
#define USB_DESCIPTOR_TYPE_INTERFACE
Definition usb_std.h:94
USB_CLASS_CODE_CDC
#define USB_CLASS_CODE_CDC
Definition usb_std.h:168
USBD_CDC_SUBTYPE_UFD
#define USBD_CDC_SUBTYPE_UFD
Definition usb_std.h:207
USBD_CDC_SUBTYPE_ACM
#define USBD_CDC_SUBTYPE_ACM
Definition usb_std.h:206
usbd_desc_handler
usb device descriptor handler
Definition usbd_core.h:75
usbd_desc_t
usb device descriptor struct
Definition usbd_core.h:66
usbd_desc_t::length
uint16_t length
Definition usbd_core.h:67
usbd_desc_t::descriptor
uint8_t * descriptor
Definition usbd_core.h:68
usb_std.h
usb standard header file
usbd_core.h
usb device core header file
usbd_sdr.h
usb standard request header file


AT32F413 Firmwary Library: cdc_msc_desc.h Source File

  • middlewares
  • usbd_class
  • composite_cdc_msc
cdc_msc_desc.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __CDC_MSC_DESC_H
28#define __CDC_MSC_DESC_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "cdc_msc_class.h"
35#include "usbd_core.h"
36
51#define CDC_BCD_NUM 0x0110
52
56#define USBD_CDC_MSC_VENDOR_ID 0x2E3C
57#define USBD_CDC_MSC_PRODUCT_ID 0x5760
58
63#define USBD_CDC_MSC_CONFIG_DESC_SIZE 106
64#define USBD_CDC_SIZ_STRING_LANGID 4
65#define USBD_CDC_SIZ_STRING_SERIAL 0x1A
66
70#define USBD_CDC_DESC_MANUFACTURER_STRING "Artery"
71#define USBD_CDC_DESC_PRODUCT_STRING "AT32 Composite VCP and MSC "
72#define USBD_CDC_DESC_CONFIGURATION_STRING "Composite VCP and MSC Config"
73#define USBD_CDC_DESC_INTERFACE_STRING "Composite VCP and MSC Interface"
74
78#define CDC_HID_BINTERVAL_TIME 0xFF
79
83#define VCPMSC_MSC_INTERFACE 0x00
84#define VCPMSC_CDC_INTERFACE 0x01
85#define VCPMSC_CDC_DATA_INTERFACE 0x02
86
87
91#define MCU_ID1 (0x1FFFF7E8)
92#define MCU_ID2 (0x1FFFF7EC)
93#define MCU_ID3 (0x1FFFF7F0)
98extern usbd_desc_handler cdc_msc_desc_handler;
99
100
108#ifdef __cplusplus
109}
110#endif
111
112#endif
cdc_msc_class.h
usb cdc class file
cdc_msc_desc_handler
usbd_desc_handler cdc_msc_desc_handler
device descriptor handler structure
Definition cdc_msc_desc.c:68
usbd_desc_handler
usb device descriptor handler
Definition usbd_core.h:75
usbd_core.h
usb device core header file


AT32F413 Firmwary Library: audio_codec.h Source File

  • usb_device
  • composite_audio_hid
  • inc
composite_audio_hid/inc/audio_codec.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AUDIO_CODEC_H
28#define __AUDIO_CODEC_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34
43/* includes ------------------------------------------------------------------*/
44#include "at32f413.h"
45
49#define WM8988_R0_LEFT_INPUT_VOLUME 0x00 /*Left channel PGA control*/
50#define WM8988_R1_RIGHT_INPUT_VOLUME 0x01 /*Right channel PGA control*/
51#define WM8988_R2_LOUT1_VOLUME 0x02
52#define WM8988_R3_ROUT1_VOLUME 0x03
53#define WM8988_R4_RESERVED 0x04
54#define WM8988_R5_ADC_DAC_CONTROL 0x05
55#define WM8988_R6_RESERVED 0x06
56#define WM8988_R7_AUDIO_INTERFACE 0x07
57#define WM8988_R8_SAMPLE_RATE 0x08
58#define WM8988_R9_RESERVED 0x09
59#define WM8988_R10_LEFT_DAC_VOLUME 0x0A
60#define WM8988_R11_RIGHT_DAC_VOLUME 0x0B
61#define WM8988_R12_BASS_CONTROL 0x0C
62#define WM8988_R13_TREBLE_CONTROL 0x0D
63#define WM8988_R14_
64#define WM8988_R15_RESET 0x0F
65#define WM8988_R16_3D_CONTROL 0x10
66#define WM8988_R17_ALC1 0x11
67#define WM8988_R18_ALC2 0x12
68#define WM8988_R19_ALC3 0x13
69#define WM8988_R20_NOISE_GATE 0x14
70#define WM8988_R21_LEFT_ADC_VOLUME 0x15
71#define WM8988_R22_RIGHT_ADC_VOLUME 0x16
72#define WM8988_R23_ADDITIONAL_1_CONTROL 0x17
73#define WM8988_R24_ADDITIONAL_2_CONTROL 0x18
74#define WM8988_R25_PWR_1_MGMT 0x19
75#define WM8988_R26_PWR_2_MGMT 0x1A
76#define WM8988_R27_ADDITIONAL_3_CONTROL 0x1B
77
78#define WM8988_R31_ADC_INPUT_MODE 0x1F
79#define WM8988_R32_ADC_L_SIGNAL_PATH 0x20
80#define WM8988_R33_ADC_R_SIGNAL_PATH 0x21
81#define WM8988_R34_LEFT_OUT_MIX_1 0x22
82#define WM8988_R35_LEFT_OUT_MIX_2 0x23
83#define WM8988_R36_RIGHT_OUT_MIX_1 0x24
84#define WM8988_R37_RIGHT_OUT_MIX_2 0x25
85#define WM8988_R38_RESERVED
86#define WM8988_R39_RESERVED
87#define WM8988_R40_LOUT2_VOLUME 0x28
88#define WM8988_R41_ROUT2_VOLUME 0x29
89#define WM8988_R42_RESERVED
90#define WM8988_R43_LOW_POWER_PALYBACK 0x43
91
92#define WM8988_I2C_ADDR_CSB_LOW 0x34
93#define WM8988_I2C_ADDR_CSB_HIGH 0x36
94
102#define I2S1_WS_PIN GPIO_PINS_4
103#define I2S1_CK_PIN GPIO_PINS_5
104#define I2S1_SD_PIN GPIO_PINS_7
105
106#define I2S1_GPIO GPIOA
107#define I2S1_GPIO_CRM_CLK CRM_GPIOA_PERIPH_CLOCK
108#define I2S1_DT_ADDRESS (&(SPI1->dt))
109
110/*I2S2 Pin*/
111#define I2S2_WS_PIN GPIO_PINS_12
112#define I2S2_CK_PIN GPIO_PINS_13
113#define I2S2_SD_PIN GPIO_PINS_15
114
115
116#define I2S2_GPIO GPIOB
117#define I2S2_GPIO_CRM_CLK CRM_GPIOB_PERIPH_CLOCK
118#define I2S2_DT_ADDRESS (&(SPI2->dt))
119
120#define SPK_TX_FIFO_SIZE (1024 * 4)
121
129#define MIC_BUFFER_SIZE 1024
130#define SPK_BUFFER_SIZE 4096
131#define DMA_BUFFER_SIZE 288
132
133typedef struct
134{
135 uint32_t audio_freq;
136 uint32_t audio_bitw;
137 //spk part
138 uint16_t spk_buffer[SPK_BUFFER_SIZE];
139 uint16_t *spk_roff;
140 uint16_t *spk_woff;
141 uint16_t *spk_rend;
142 uint32_t spk_freq;
143 uint32_t spk_wtotal;
144 uint32_t spk_rtotal;
145 uint16_t spk_threshold;
146 uint16_t spk_calc;
147 uint8_t spk_stage;
148
149 //mic part
150 uint16_t mic_buffer[MIC_BUFFER_SIZE];
151 uint16_t *mic_roff;
152 uint16_t *mic_woff;
153 uint16_t *mic_wend;
154 uint32_t mic_wtotal;
155 uint32_t mic_rtotal;
156 uint32_t mic_delta;
157 uint16_t mic_calc;
158 uint16_t mic_adj_count;
159 uint8_t mic_adj_stage;
160 uint8_t mic_stage;
161
162 uint8_t mic_mute;
163 uint8_t spk_mute;
164
165 uint16_t mic_volume;
166 uint16_t spk_volume;
167
168 uint32_t spk_tx_size;
169 uint32_t mic_rx_size;
170
171 uint32_t spk_enable;
172 uint32_t mic_enable;
173
174}audio_codec_type;
175
176 error_status audio_codec_init(void);
177 error_status audio_codec_loop(void);
178void audio_codec_modify_freq(uint32_t freq);
179
183void audio_codec_spk_fifo_write(uint8_t *data, uint32_t len);
184uint32_t audio_codec_mic_get_data(uint8_t *buffer);
185uint8_t audio_codec_spk_feedback(uint8_t *feedback);
186void audio_codec_spk_alt_setting(uint32_t alt_seting);
187void audio_codec_mic_alt_setting(uint32_t alt_seting);
188void audio_codec_set_mic_mute(uint8_t mute);
189void audio_codec_set_spk_mute(uint8_t mute);
190void audio_codec_set_mic_volume(uint16_t volume);
191void audio_codec_set_spk_volume(uint16_t volume);
192void audio_codec_set_mic_freq(uint32_t freq);
193void audio_codec_set_spk_freq(uint32_t freq);
194
206#ifdef __cplusplus
207}
208#endif
209
210#endif
211
at32f413.h
at32f413 header file
buffer
uint8_t buffer[((uint16_t) 160) *((uint16_t) 120)]
Definition project/at_start_f413/examples/cortex_m4/fpu/src/main.c:42
error_status
error_status
error status
Definition at32f413.h:302
audio_codec_mic_alt_setting
void audio_codec_mic_alt_setting(uint32_t alt_seting)
audio codec microphone alt setting config
Definition audio/src/audio_codec.c:168
audio_codec_set_spk_volume
void audio_codec_set_spk_volume(uint16_t volume)
audio codec set speaker volume
Definition audio/src/audio_codec.c:220
audio_codec_set_spk_mute
void audio_codec_set_spk_mute(uint8_t mute)
audio codec set speaker mute
Definition audio/src/audio_codec.c:194
MIC_BUFFER_SIZE
#define MIC_BUFFER_SIZE
Definition composite_audio_hid/inc/audio_codec.h:129
audio_codec_set_mic_freq
void audio_codec_set_mic_freq(uint32_t freq)
audio codec set microphone freq
Definition audio/src/audio_codec.c:120
audio_codec_mic_get_data
uint32_t audio_codec_mic_get_data(uint8_t *buffer)
codec microphone get data
Definition audio/src/audio_codec.c:285
audio_codec_loop
error_status audio_codec_loop(void)
audio codec loop
Definition audio/src/audio_codec.c:856
SPK_BUFFER_SIZE
#define SPK_BUFFER_SIZE
Definition composite_audio_hid/inc/audio_codec.h:130
audio_codec_set_mic_mute
void audio_codec_set_mic_mute(uint8_t mute)
audio codec set microphone mute
Definition audio/src/audio_codec.c:183
audio_codec_spk_fifo_write
void audio_codec_spk_fifo_write(uint8_t *data, uint32_t len)
audio codec interface
Definition audio/src/audio_codec.c:247
audio_codec_spk_feedback
uint8_t audio_codec_spk_feedback(uint8_t *feedback)
codec speaker feedback
Definition audio/src/audio_codec.c:231
audio_codec_modify_freq
void audio_codec_modify_freq(uint32_t freq)
audio codec modify freq
Definition audio/src/audio_codec.c:345
audio_codec_set_mic_volume
void audio_codec_set_mic_volume(uint16_t volume)
audio codec set microphone volume
Definition audio/src/audio_codec.c:205
audio_codec_spk_alt_setting
void audio_codec_spk_alt_setting(uint32_t alt_seting)
audio codec speaker alt setting config
Definition audio/src/audio_codec.c:153
audio_codec_init
error_status audio_codec_init(void)
audio codec init
Definition audio/src/audio_codec.c:797
audio_codec_set_spk_freq
void audio_codec_set_spk_freq(uint32_t freq)
audio codec set speaker freq
Definition audio/src/audio_codec.c:136
audio_codec_type
Definition audio/inc/audio_codec.h:131


AT32F413 Firmwary Library: audio_codec.c Source File

  • usb_device
  • composite_audio_hid
  • src
composite_audio_hid/src/audio_codec.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "audio_codec.h"
28#include "i2c_application.h"
29#include "audio_conf.h"
30#include <string.h>
31
40#define I2C_TIMEOUT 0xFFFFFFFF
41
42#define I2Cx_SPEED 200000
43#define I2Cx_ADDRESS 0x00
44
45#define I2Cx_PORT I2C1
46#define I2Cx_CLK CRM_I2C1_PERIPH_CLOCK
47
48#define I2Cx_SCL_PIN GPIO_PINS_8
49#define I2Cx_SCL_GPIO_PORT GPIOB
50#define I2Cx_SCL_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
51
52#define I2Cx_SDA_PIN GPIO_PINS_9
53#define I2Cx_SDA_GPIO_PORT GPIOB
54#define I2Cx_SDA_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
55
59#define WM8988_REG_FREQ48K ((WM8988_R8_SAMPLE_RATE << 9) | 0x0081)
60#define WM8988_REG_FREQ16K ((WM8988_R8_SAMPLE_RATE << 9) | 0x0095)
61
65#define WM8988_REG_BITW16 ((WM8988_R7_AUDIO_INTERFACE << 9) | 0x0042)
66
70uint16_t reg_addr_data[] =
71{
72 (WM8988_R0_LEFT_INPUT_VOLUME << 9) | 0x012F, /*Left Input Channel Volume*/
73 (WM8988_R1_RIGHT_INPUT_VOLUME << 9) | 0x012F, /*Right Input Channel Volume*/
74 (WM8988_R2_LOUT1_VOLUME << 9) | 0x0179, /*Left Output Channel Volume*/
75 (WM8988_R3_ROUT1_VOLUME << 9) | 0x0179, /*Right Output Channel Volume*/
76 (WM8988_R5_ADC_DAC_CONTROL << 9) | 0x0006, /*De-emphasis Control and Digital soft mute*/
77 (WM8988_REG_BITW16),
78 (WM8988_REG_FREQ16K),
79 (WM8988_R10_LEFT_DAC_VOLUME << 9) | 0x01FF, /*Left Digital DAC Volume Control*/
80 (WM8988_R11_RIGHT_DAC_VOLUME << 9) | 0x01FF, /*Right Digital DAC Volume Control*/
81 (WM8988_R12_BASS_CONTROL << 9) | 0x000F, /*Bass Control*/
82 (WM8988_R13_TREBLE_CONTROL << 9) | 0x000F, /*Treble Control*/
83 (WM8988_R16_3D_CONTROL << 9) | 0x0000, /*3D stereo Enhancment*/
84 (WM8988_R21_LEFT_ADC_VOLUME << 9) | 0x01C3, /*Left ADC Digital Volume*/
85 (WM8988_R22_RIGHT_ADC_VOLUME << 9) | 0x01C3, /*Right ADC Digital Volume*/
86 (WM8988_R23_ADDITIONAL_1_CONTROL << 9) | 0x00C2, /*Additional Control 1*/
87 (WM8988_R24_ADDITIONAL_2_CONTROL << 9) | 0x0000, /*Additional Control 2*/
88 (WM8988_R27_ADDITIONAL_3_CONTROL << 9) | 0x0000, /*Additional Control 3*/
89 (WM8988_R31_ADC_INPUT_MODE << 9) | 0x0000, /*ADC input mode*/
90 (WM8988_R32_ADC_L_SIGNAL_PATH << 9) | 0x0000, /*ADC Signal Path Control left*/
91 (WM8988_R33_ADC_R_SIGNAL_PATH << 9) | 0x0000, /*ADC Signal Path Control right*/
92 (WM8988_R34_LEFT_OUT_MIX_1 << 9) | 0x0152, /*Left DAC mixer Control*/
93 (WM8988_R35_LEFT_OUT_MIX_2 << 9) | 0x0050, /*Left DAC mixer Control*/
94 (WM8988_R36_RIGHT_OUT_MIX_1 << 9) | 0x0052, /*Right DAC mixer Control*/
95 (WM8988_R37_RIGHT_OUT_MIX_2 << 9) | 0x0150, /*Right DAC mixer Control*/
96 (WM8988_R40_LOUT2_VOLUME << 9) | 0x01FF, /*Output left channel volume*/
97 (WM8988_R41_ROUT2_VOLUME << 9) | 0x01FF, /*Output left channel volume*/
98 (WM8988_R43_LOW_POWER_PALYBACK << 9) | 0x0008, /*Output left channel volume*/
99 (WM8988_R25_PWR_1_MGMT << 9) | 0x017C, /*Power Management1*/
100 (WM8988_R26_PWR_2_MGMT << 9) | 0x01F8, /*Power Management2*/
101};
102
103 i2c_handle_type hi2cx;
104
105 audio_codec_type audio_codec;
106uint16_t spk_dma_buffer[DMA_BUFFER_SIZE];
107uint16_t mic_dma_buffer[DMA_BUFFER_SIZE];
108
109void memset16_buffer(uint16_t *buffer, uint32_t set, uint32_t len);
110void codec_i2s_reset(void);
111void codec_i2s_init(audio_codec_type *param);
112void mclk_tmr1_init(void);
113void copy_buff(uint16_t *dest, uint16_t *src, uint32_t len);
114
120void audio_codec_set_mic_freq(uint32_t freq)
121{
122 if(audio_codec.audio_freq != freq)
123 {
124 audio_codec.audio_freq = freq;
125 codec_i2s_reset();
126 audio_codec_modify_freq(freq);
127 codec_i2s_init(&audio_codec);
128 }
129}
130
136void audio_codec_set_spk_freq(uint32_t freq)
137{
138 if(audio_codec.audio_freq != freq)
139 {
140 audio_codec.audio_freq = freq;
141 codec_i2s_reset();
142 audio_codec_modify_freq(freq);
143 codec_i2s_init(&audio_codec);
144 }
145}
146
147
153void audio_codec_spk_alt_setting(uint32_t alt_seting)
154{
155 if(alt_seting == 0)
156 {
157 }
158 else
159 {
160 }
161}
162
168void audio_codec_mic_alt_setting(uint32_t alt_seting)
169{
170 if(alt_seting == 0)
171 {
172 }
173 else
174 {
175 }
176}
177
183void audio_codec_set_mic_mute(uint8_t mute)
184{
185 audio_codec.mic_mute = mute;
186}
187
188
194void audio_codec_set_spk_mute(uint8_t mute)
195{
196 audio_codec.spk_mute = mute;
197}
198
199
205void audio_codec_set_mic_volume(uint16_t volume)
206{
207 /* wm8988 adc have 256 steps */
208 audio_codec.mic_volume = volume;
209 if(audio_codec.mic_volume > 0xFF)
210 {
211 audio_codec.mic_volume = 0xFF;
212 }
213}
214
220void audio_codec_set_spk_volume(uint16_t volume)
221{
222 /* wm8988 dac have 80 steps */
223 audio_codec.spk_volume = (volume * 0x50) / 0x64 + 0x30 - 1;
224}
225
231uint8_t audio_codec_spk_feedback(uint8_t *feedback)
232{
233 uint32_t feedback_value = (audio_codec.spk_freq);
234 feedback_value = ((feedback_value/1000)<<14)|((feedback_value%1000)<<4);
235 feedback[0] = (uint8_t)(feedback_value);
236 feedback[1] = (uint8_t)(feedback_value >> 8);
237 feedback[2] = (uint8_t)(feedback_value >> 16);
238 return 3;
239}
240
247void audio_codec_spk_fifo_write(uint8_t *data, uint32_t len)
248{
249 uint16_t ulen = len / 2, i;
250 uint16_t *u16data = (uint16_t *)data;
251
252 switch(audio_codec.spk_stage)
253 {
254 case 0:
255 audio_codec.spk_woff = audio_codec.spk_roff = audio_codec.spk_buffer;
256 audio_codec.spk_wtotal = audio_codec.spk_rtotal = 0;
257 audio_codec.spk_stage = 1;
258 audio_codec.spk_threshold = SPK_BUFFER_SIZE/2;
259 break;
260 case 1:
261 if( audio_codec.spk_wtotal >= SPK_BUFFER_SIZE/2 )
262 {
263 audio_codec.spk_stage = 2;
264 }
265 break;
266 case 2:
267 break;
268 }
269 for( i = 0; i < ulen; ++i )
270 {
271 *audio_codec.spk_woff++ = *u16data++;
272 if( audio_codec.spk_woff >= audio_codec.spk_rend )
273 {
274 audio_codec.spk_woff = audio_codec.spk_buffer;
275 }
276 }
277 audio_codec.spk_wtotal += ulen;
278}
279
285uint32_t audio_codec_mic_get_data(uint8_t *buffer)
286{
287 //copy_buff((uint16_t *)buffer, audio_codec.mic_buffer + audio_codec.mic_hf_status, audio_codec.mic_rx_size);
288 uint16_t len = audio_codec.mic_rx_size << 1;
289 uint16_t i;
290 uint16_t* u16buf = (uint16_t*)buffer;
291 switch(audio_codec.mic_stage)
292 {
293 case 0:
294 audio_codec.mic_stage = 1;
295 memset( buffer, 0, len );
296 return len;
297 case 1:
298 if( audio_codec.mic_wtotal - audio_codec.mic_rtotal >= MIC_BUFFER_SIZE/2 )
299 {
300 audio_codec.mic_stage = 2;
301 }
302 return len;
303 }
304 switch( audio_codec.mic_adj_stage )
305 {
306 case 0:
307 break;
308 case 1:
309 if( audio_codec.mic_adj_count >= 4 ){
310 len += 4;
311 audio_codec.mic_adj_count -= 4;
312 }
313 break;
314 case 2:
315 if( audio_codec.mic_adj_count >= 4 ){
316 len -= 4;
317 audio_codec.mic_adj_count -= 4;
318 }
319 break;
320 }
321
322 for( i = 0; i < len/2; ++i )
323 {
324 *u16buf++ = *audio_codec.mic_roff++;
325 if( audio_codec.mic_roff >= audio_codec.mic_wend )
326 {
327 audio_codec.mic_roff = audio_codec.mic_buffer;
328 }
329 }
330 if( audio_codec.mic_wtotal <= audio_codec.mic_rtotal )
331 { //should not happen
332 while(1);
333 }
334
335 audio_codec.mic_rtotal += len/2;
336 audio_codec.mic_delta += len/2;
337 return len;
338}
339
345void audio_codec_modify_freq(uint32_t freq)
346{
347 uint16_t codec_cmd;
348 uint8_t i2c_cmd[2];
349 if(freq == AUDIO_FREQ_16K)
350 {
351 codec_cmd = WM8988_REG_FREQ16K;
352 }
353 else if(freq == AUDIO_FREQ_48K)
354 {
355 codec_cmd = WM8988_REG_FREQ48K;
356 }
357 i2c_cmd[0] = (uint8_t)(codec_cmd >> 8);
358 i2c_cmd[1] = (uint8_t)codec_cmd & 0xFF;
359 if(i2c_master_transmit(&hi2cx, WM8988_I2C_ADDR_CSB_LOW, (uint8_t *)i2c_cmd, 2, 0xFFFF) != I2C_OK)
360 {
361 while(1);
362 }
363}
364
372void memset16_buffer(uint16_t *buffer, uint32_t set, uint32_t len)
373{
374 uint32_t i_index = 0;
375 for(i_index = 0; i_index < len; i_index ++)
376 {
377 buffer[i_index] = (uint16_t)set;
378 }
379}
380
388void copy_buff(uint16_t *dest, uint16_t *src, uint32_t len)
389{
390 uint16_t i_index;
391 for(i_index = 0; i_index < len; i_index ++)
392 {
393 dest[i_index] = src[i_index];
394 }
395}
396
402void i2c_lowlevel_init(i2c_handle_type* hi2c)
403{
404 gpio_init_type gpio_initstructure;
405
406 if(hi2c->i2cx == I2Cx_PORT)
407 {
408 /* i2c periph clock enable */
409 crm_periph_clock_enable(I2Cx_CLK, TRUE);
410 crm_periph_clock_enable(CRM_IOMUX_PERIPH_CLOCK, TRUE);
411 gpio_pin_remap_config(I2C1_MUX, TRUE);
412 crm_periph_clock_enable(I2Cx_SCL_GPIO_CLK, TRUE);
413 crm_periph_clock_enable(I2Cx_SDA_GPIO_CLK, TRUE);
414
415 /* gpio configuration */
416 gpio_initstructure.gpio_out_type = GPIO_OUTPUT_OPEN_DRAIN;
417 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
418 gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
419 gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_MODERATE;
420
421 /* configure i2c pins: scl */
422 gpio_initstructure.gpio_pins = I2Cx_SCL_PIN;
423 gpio_init(I2Cx_SCL_GPIO_PORT, &gpio_initstructure);
424
425 /* configure i2c pins: sda */
426 gpio_initstructure.gpio_pins = I2Cx_SDA_PIN;
427 gpio_init(I2Cx_SDA_GPIO_PORT, &gpio_initstructure);
428
429 i2c_init(hi2c->i2cx, I2C_FSMODE_DUTY_2_1, I2Cx_SPEED);
430
431 i2c_own_address1_set(hi2c->i2cx, I2C_ADDRESS_MODE_7BIT, I2Cx_ADDRESS);
432 }
433}
434
440void mclk_tmr1_init(void)
441{
442 gpio_init_type gpio_init_struct;
443 tmr_output_config_type tmr_oc_init_structure;
444 uint16_t prescaler_value = (uint16_t)(system_core_clock / 24000000) - 1;
445
446 crm_periph_clock_enable(CRM_TMR1_PERIPH_CLOCK, TRUE);
447 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
448 crm_periph_clock_enable(CRM_IOMUX_PERIPH_CLOCK, TRUE);
449
450 gpio_default_para_init(&gpio_init_struct);
451
452
453 gpio_init_struct.gpio_pins = GPIO_PINS_8;
454 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
455 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_MODERATE;
456 gpio_init(GPIOA, &gpio_init_struct);
457
458 tmr_base_init(TMR1, 1, prescaler_value);
459 tmr_cnt_dir_set(TMR1, TMR_COUNT_UP);
460 tmr_clock_source_div_set(TMR1, TMR_CLOCK_DIV1);
461
462 tmr_output_default_para_init(&tmr_oc_init_structure);
463 tmr_oc_init_structure.oc_mode = TMR_OUTPUT_CONTROL_PWM_MODE_A;
464 tmr_oc_init_structure.oc_idle_state = FALSE;
465 tmr_oc_init_structure.oc_polarity = TMR_OUTPUT_ACTIVE_HIGH;
466 tmr_oc_init_structure.oc_output_state = TRUE;
467 tmr_output_channel_config(TMR1, TMR_SELECT_CHANNEL_1, &tmr_oc_init_structure);
468 tmr_channel_value_set(TMR1, TMR_SELECT_CHANNEL_1, 1);
469 tmr_output_channel_buffer_enable(TMR1, TMR_SELECT_CHANNEL_1, TRUE);
470
471 /* tmr enable counter */
472 tmr_counter_enable(TMR1, TRUE);
473 tmr_output_enable(TMR1, TRUE);
474}
475
476
482void codec_i2s_reset(void)
483{
484 i2s_enable(SPI1, FALSE);
485 i2s_enable(SPI2, FALSE);
486 dma_channel_enable(DMA1_CHANNEL3, FALSE);
487 dma_channel_enable(DMA1_CHANNEL4, FALSE);
488}
489
496void codec_i2s_init(audio_codec_type *param)
497{
498 gpio_init_type gpio_init_struct;
499 dma_init_type dma_init_struct;
500 i2s_init_type i2s_init_struct;
501 i2s_data_channel_format_type format = I2S_DATA_16BIT_CHANNEL_16BIT;
502
503 crm_periph_clock_enable(I2S1_GPIO_CRM_CLK, TRUE);
504 crm_periph_clock_enable(I2S2_GPIO_CRM_CLK, TRUE);
505 crm_periph_clock_enable(CRM_DMA1_PERIPH_CLOCK, TRUE);
506 crm_periph_clock_enable(CRM_SPI1_PERIPH_CLOCK, TRUE);
507 crm_periph_clock_enable(CRM_SPI2_PERIPH_CLOCK, TRUE);
508
509 param->spk_freq = param->audio_freq;
510
511 param->spk_tx_size = (param->audio_freq / 1000) * (param->audio_bitw / 8) * AUDIO_SPK_CHANEL_NUM / 2;
512 param->mic_rx_size = (param->audio_freq / 1000) * (param->audio_bitw / 8) * AUDIO_MIC_CHANEL_NUM / 2;
513
514 memset(param->spk_buffer, 0, SPK_BUFFER_SIZE*sizeof(uint16_t));
515 memset(param->mic_buffer, 0, MIC_BUFFER_SIZE*sizeof(uint16_t));
516
517 param->mic_wend = param->mic_woff = param->mic_roff = param->mic_buffer;
518 param->spk_rend = param->spk_woff = param->spk_roff = param->spk_buffer;
519
520 while(param->mic_wend < param->mic_buffer+MIC_BUFFER_SIZE)
521 {
522 param->mic_wend += param->mic_rx_size;
523 }
524 param->mic_wend -= param->mic_rx_size;
525 while(param->spk_rend < param->spk_buffer+SPK_BUFFER_SIZE)
526 {
527 param->spk_rend += param->spk_tx_size;
528 }
529 param->spk_rend -= param->spk_tx_size;
530 if(param->audio_bitw == 16)
531 {
532 format = I2S_DATA_16BIT_CHANNEL_16BIT;
533 }
534 else
535 {
536 format = I2S_DATA_24BIT_CHANNEL_32BIT;
537 }
538
539 gpio_default_para_init(&gpio_init_struct);
540
541 /* i2s1 ws pins */
542 gpio_init_struct.gpio_pull = GPIO_PULL_UP;
543 gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
544 gpio_init_struct.gpio_pins = I2S1_WS_PIN;
545 gpio_init(I2S1_GPIO, &gpio_init_struct);
546
547 /* i2s1 ck pins */
548 gpio_init_struct.gpio_pull = GPIO_PULL_DOWN;
549 gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
550 gpio_init_struct.gpio_pins = I2S1_CK_PIN;
551 gpio_init(I2S1_GPIO, &gpio_init_struct);
552
553 /* i2s1 sd pins slave tx */
554 gpio_init_struct.gpio_pull = GPIO_PULL_UP;
555 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
556 gpio_init_struct.gpio_pins = I2S1_SD_PIN;
557 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_MODERATE;
558 gpio_init(I2S1_GPIO, &gpio_init_struct);
559
560 /* i2s2 ws pins */
561 gpio_init_struct.gpio_pull = GPIO_PULL_UP;
562 gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
563 gpio_init_struct.gpio_pins = I2S2_WS_PIN;
564 gpio_init(I2S2_GPIO, &gpio_init_struct);
565
566 /* i2s2 ck pins */
567 gpio_init_struct.gpio_pull = GPIO_PULL_DOWN;
568 gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
569 gpio_init_struct.gpio_pins = I2S2_CK_PIN;
570 gpio_init(I2S2_GPIO, &gpio_init_struct);
571
572 /* i2s2 sd pins slave rx */
573 gpio_init_struct.gpio_pull = GPIO_PULL_UP;
574 gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
575 gpio_init_struct.gpio_pins = I2S2_SD_PIN;
576 gpio_init(I2S2_GPIO, &gpio_init_struct);
577
578 /* dma config */
579 dma_reset(DMA1_CHANNEL3);
580 dma_reset(DMA1_CHANNEL4);
581
582 /* dma1 channel3: speaker i2s1 tx */
583 dma_default_para_init(&dma_init_struct);
584 dma_init_struct.buffer_size = param->spk_tx_size << 1;
585 dma_init_struct.direction = DMA_DIR_MEMORY_TO_PERIPHERAL;
586 dma_init_struct.memory_base_addr = (uint32_t)spk_dma_buffer;
587 dma_init_struct.memory_data_width = DMA_MEMORY_DATA_WIDTH_HALFWORD;
588 dma_init_struct.memory_inc_enable = TRUE;
589 dma_init_struct.peripheral_base_addr = (uint32_t)I2S1_DT_ADDRESS;
590 dma_init_struct.peripheral_data_width = DMA_PERIPHERAL_DATA_WIDTH_HALFWORD;
591 dma_init_struct.peripheral_inc_enable = FALSE;
592 dma_init_struct.priority = DMA_PRIORITY_HIGH;
593 dma_init_struct.loop_mode_enable = TRUE;
594 dma_init(DMA1_CHANNEL3, &dma_init_struct);
595 dma_interrupt_enable(DMA1_CHANNEL3, DMA_FDT_INT, TRUE);
596 dma_interrupt_enable(DMA1_CHANNEL3, DMA_HDT_INT, TRUE);
597 nvic_irq_enable(DMA1_Channel3_IRQn, 1, 0);
598
599 /* dma1 channel4: microphone i2s2 rx */
600 dma_default_para_init(&dma_init_struct);
601 dma_init_struct.buffer_size = param->mic_rx_size << 1;
602 dma_init_struct.direction = DMA_DIR_PERIPHERAL_TO_MEMORY;
603 dma_init_struct.memory_base_addr = (uint32_t)mic_dma_buffer;
604 dma_init_struct.memory_data_width = DMA_MEMORY_DATA_WIDTH_HALFWORD;
605 dma_init_struct.memory_inc_enable = TRUE;
606 dma_init_struct.peripheral_base_addr = (uint32_t)I2S2_DT_ADDRESS;
607 dma_init_struct.peripheral_data_width = DMA_PERIPHERAL_DATA_WIDTH_HALFWORD;
608 dma_init_struct.peripheral_inc_enable = FALSE;
609 dma_init_struct.priority = DMA_PRIORITY_HIGH;
610 dma_init_struct.loop_mode_enable = TRUE;
611 dma_init(DMA1_CHANNEL4, &dma_init_struct);
612 dma_interrupt_enable(DMA1_CHANNEL4, DMA_FDT_INT, TRUE);
613 dma_interrupt_enable(DMA1_CHANNEL4, DMA_HDT_INT, TRUE);
614 nvic_irq_enable(DMA1_Channel4_IRQn, 2, 0);
615
616 /* i2s1 tx init */
617 spi_i2s_reset(SPI1);
618 i2s_default_para_init(&i2s_init_struct);
619 i2s_init_struct.audio_protocol = I2S_AUDIO_PROTOCOL_PHILLIPS;
620 i2s_init_struct.data_channel_format = format;
621 i2s_init_struct.mclk_output_enable = FALSE;
622 i2s_init_struct.audio_sampling_freq = (i2s_audio_sampling_freq_type)param->audio_freq;
623 i2s_init_struct.clock_polarity = I2S_CLOCK_POLARITY_LOW;
624 i2s_init_struct.operation_mode = I2S_MODE_SLAVE_TX;
625 i2s_init(SPI1, &i2s_init_struct);
626
627 /* i2s2 rx init */
628 spi_i2s_reset(SPI2);
629 i2s_default_para_init(&i2s_init_struct);
630 i2s_init_struct.audio_protocol = I2S_AUDIO_PROTOCOL_PHILLIPS;
631 i2s_init_struct.data_channel_format = format;
632 i2s_init_struct.mclk_output_enable = FALSE;
633 i2s_init_struct.audio_sampling_freq = (i2s_audio_sampling_freq_type)param->audio_freq;
634 i2s_init_struct.clock_polarity = I2S_CLOCK_POLARITY_LOW;
635 i2s_init_struct.operation_mode = I2S_MODE_SLAVE_RX;
636 i2s_init(SPI2, &i2s_init_struct);
637
638
639 spi_i2s_dma_transmitter_enable(SPI1, TRUE);
640 spi_i2s_dma_receiver_enable(SPI2, TRUE);
641 i2s_enable(SPI1, TRUE);
642 i2s_enable(SPI2, TRUE);
643
644 dma_channel_enable(DMA1_CHANNEL3, TRUE);
645 dma_channel_enable(DMA1_CHANNEL4, TRUE);
646
647}
648
654void DMA1_Channel3_IRQHandler(void)
655{
656 uint16_t half_size = audio_codec.spk_tx_size;
657 uint16_t *pdst;
658
659 if(dma_interrupt_flag_get(DMA1_HDT3_FLAG) == SET)
660 {
661 //copy_buff(audio_codec.spk_buffer, audio_codec.spk_tx_fifo + audio_codec.r_pos, half_size);
662 pdst = spk_dma_buffer;
663 dma_flag_clear(DMA1_HDT3_FLAG);
664 }
665 else if(dma_interrupt_flag_get(DMA1_FDT3_FLAG) == SET)
666 {
667 //copy_buff(&audio_codec.spk_buffer[half_size], audio_codec.spk_tx_fifo + audio_codec.r_pos, half_size);
668 pdst = spk_dma_buffer + half_size;
669 dma_flag_clear(DMA1_FDT3_FLAG);
670 }
671
672 switch( audio_codec.spk_stage )
673 {
674 case 0:
675 case 1:
676 memset( pdst, 0, half_size << 1);
677 break;
678 case 2:
679 if( audio_codec.spk_wtotal >= audio_codec.spk_rtotal + SPK_BUFFER_SIZE )
680 {
681 while(1);//should not happen;
682 }
683 if( audio_codec.spk_rtotal >= audio_codec.spk_wtotal )
684 {
685 audio_codec.spk_stage = 0;
686 audio_codec.spk_woff = audio_codec.spk_roff = audio_codec.spk_buffer;
687 audio_codec.spk_rtotal = audio_codec.spk_wtotal = 0;
688 }
689 else
690 {
691 memcpy( pdst, audio_codec.spk_roff, half_size << 1 );
692 audio_codec.spk_roff += half_size;
693 audio_codec.spk_rtotal += half_size;
694 if( audio_codec.spk_roff >= audio_codec.spk_rend )
695 {
696 audio_codec.spk_roff = audio_codec.spk_buffer;
697 }
698 if( ++audio_codec.spk_calc == 256 )
699 {
700 uint16_t delta = audio_codec.spk_wtotal - audio_codec.spk_rtotal;
701 audio_codec.spk_calc = 0;
702 if( delta < audio_codec.spk_threshold - half_size )
703 {
704 audio_codec.spk_threshold -= half_size;
705 audio_codec.spk_freq += audio_codec.audio_freq/1024;
706 }
707 else if( delta > audio_codec.spk_threshold + half_size )
708 {
709 audio_codec.spk_threshold += half_size;
710 audio_codec.spk_freq -= audio_codec.audio_freq/1024;
711 }
712 if(audio_codec.spk_rtotal > 0x20000000)
713 {
714 audio_codec.spk_rtotal -= 0x10000000;
715 audio_codec.spk_wtotal -= 0x10000000;
716 }
717 }
718 }
719 break;
720 }
721
722}
723
729void DMA1_Channel4_IRQHandler(void)
730{
731 uint16_t *psrc;
732 uint16_t len = audio_codec.mic_rx_size << 1;
733
734 if(dma_interrupt_flag_get(DMA1_HDT4_FLAG) == SET)
735 {
736 dma_flag_clear(DMA1_HDT4_FLAG);
737 psrc = mic_dma_buffer;
738 }
739 else if(dma_interrupt_flag_get(DMA1_FDT4_FLAG) == SET)
740 {
741 psrc = mic_dma_buffer + audio_codec.mic_rx_size;
742 dma_flag_clear(DMA1_FDT4_FLAG);
743 }
744 if( audio_codec.mic_stage )
745 {
746 memcpy( audio_codec.mic_woff, psrc, len );
747 audio_codec.mic_woff += len/2;
748 audio_codec.mic_wtotal += len/2;
749 if( audio_codec.mic_woff >= audio_codec.mic_wend )
750 {
751 audio_codec.mic_woff = audio_codec.mic_buffer;
752 }
753 if( audio_codec.mic_stage == 2 )
754 {
755 if( 1024 == ++audio_codec.mic_calc )
756 {
757 uint32_t size_estimate = 1024*audio_codec.mic_rx_size;
758 audio_codec.mic_calc = 0;
759 if( audio_codec.mic_delta > size_estimate )
760 {
761 audio_codec.mic_adj_count = audio_codec.mic_delta - size_estimate;
762 audio_codec.mic_adj_stage = 2;
763 }
764 else if( audio_codec.mic_delta < size_estimate )
765 {
766 audio_codec.mic_adj_count = size_estimate - audio_codec.mic_delta;
767 audio_codec.mic_adj_stage = 1;
768 }
769 else
770 {
771 audio_codec.mic_adj_count = 0;
772 audio_codec.mic_adj_stage = 0;
773 }
774 audio_codec.mic_delta = 0;
775 if( audio_codec.mic_rtotal >= 0x80000000 )
776 {
777 audio_codec.mic_rtotal -= 0x80000000;
778 audio_codec.mic_wtotal -= 0x80000000;
779 }
780 }
781 if( audio_codec.mic_wtotal >= audio_codec.mic_rtotal + MIC_BUFFER_SIZE )
782 {
783 audio_codec.mic_delta = audio_codec.mic_wtotal = audio_codec.mic_rtotal = 0;
784 audio_codec.mic_woff = audio_codec.mic_roff = audio_codec.mic_buffer;
785 audio_codec.mic_stage = 0;
786 audio_codec.mic_adj_stage = 0;
787 audio_codec.mic_adj_count = 0;
788 audio_codec.mic_calc = 0;
789 }
790 }
791 }
792}
793
799 error_status audio_codec_init(void)
800{
801 uint32_t reg_len = sizeof(reg_addr_data) / sizeof(uint16_t);
802 uint32_t i_index = 0;
803 uint8_t i2c_cmd[2];
804
805 if(AUDIO_DEFAULT_FREQ == AUDIO_FREQ_16K)
806 {
807 reg_addr_data[6] = WM8988_REG_FREQ16K;
808 audio_codec.audio_freq = AUDIO_FREQ_16K;
809 }
810 else if(AUDIO_DEFAULT_FREQ == AUDIO_FREQ_48K)
811 {
812 reg_addr_data[6] = WM8988_REG_FREQ48K;
813 audio_codec.audio_freq = AUDIO_FREQ_48K;
814 }
815 else
816 {
817 return ERROR;
818 }
819
820 if(AUDIO_DEFAULT_BITW == AUDIO_BITW_16)
821 {
822 reg_addr_data[5] = WM8988_REG_BITW16;
823 audio_codec.audio_bitw = AUDIO_BITW_16;
824 }
825 else
826 {
827 return ERROR;
828 }
829
830 /* i2c init */
831 hi2cx.i2cx = I2Cx_PORT;
832
833 i2c_config(&hi2cx);
834
835 for(i_index = 0; i_index < reg_len; i_index ++)
836 {
837 i2c_cmd[0] = (uint8_t)(reg_addr_data[i_index] >> 8);
838 i2c_cmd[1] = (uint8_t)reg_addr_data[i_index] & 0xFF;
839 if(i2c_master_transmit(&hi2cx, WM8988_I2C_ADDR_CSB_LOW, (uint8_t *)i2c_cmd, 2, 0xFFFF) != I2C_OK)
840 {
841 return ERROR;
842 }
843 }
844
845 /* timer init */
846 mclk_tmr1_init();
847
848 codec_i2s_init(&audio_codec);
849
850 return SUCCESS;
851}
852
858 error_status audio_codec_loop(void)
859{
860 static uint8_t mic_mute = 0;
861 static uint16_t mic_volume = 0;
862 static uint8_t spk_mute = 0;
863 static uint16_t spk_volume = 0;
864 uint16_t audio_ctrl_l;
865 uint16_t audio_ctrl_r;
866 uint8_t i2c_cmd[2];
867
868 if(mic_mute != audio_codec.mic_mute)
869 {
870 mic_mute = audio_codec.mic_mute;
871 audio_ctrl_l = WM8988_R21_LEFT_ADC_VOLUME << 9 | 0x100;
872 audio_ctrl_r = WM8988_R22_RIGHT_ADC_VOLUME << 9 | 0x100;
873 if(audio_codec.mic_mute == 0)
874 {
875 audio_ctrl_l |= audio_codec.mic_volume;
876 audio_ctrl_r |= audio_codec.mic_volume;
877 }
878 i2c_cmd[0] = (uint8_t)(audio_ctrl_l >> 8);
879 i2c_cmd[1] = (uint8_t)audio_ctrl_l & 0xFF;
880 if(i2c_master_transmit(&hi2cx, WM8988_I2C_ADDR_CSB_LOW, (uint8_t *)i2c_cmd, 2, 0xFFFF) != I2C_OK)
881 {
882 return ERROR;
883 }
884 i2c_cmd[0] = (uint8_t)(audio_ctrl_r >> 8);
885 i2c_cmd[1] = (uint8_t)audio_ctrl_r & 0xFF;
886 if(i2c_master_transmit(&hi2cx, WM8988_I2C_ADDR_CSB_LOW, (uint8_t *)i2c_cmd, 2, 0xFFFF) != I2C_OK)
887 {
888 return ERROR;
889 }
890 }
891
892 if(mic_volume != audio_codec.mic_volume)
893 {
894 mic_volume = audio_codec.mic_volume;
895 audio_ctrl_l = WM8988_R21_LEFT_ADC_VOLUME << 9 | 0x100;
896 audio_ctrl_r = WM8988_R22_RIGHT_ADC_VOLUME << 9 | 0x100;
897 audio_ctrl_l |= audio_codec.mic_volume;
898 audio_ctrl_r |= audio_codec.mic_volume;
899 i2c_cmd[0] = (uint8_t)(audio_ctrl_l >> 8);
900 i2c_cmd[1] = (uint8_t)audio_ctrl_l & 0xFF;
901 if(i2c_master_transmit(&hi2cx, WM8988_I2C_ADDR_CSB_LOW, (uint8_t *)i2c_cmd, 2, 0xFFFF) != I2C_OK)
902 {
903 return ERROR;
904 }
905 i2c_cmd[0] = (uint8_t)(audio_ctrl_r >> 8);
906 i2c_cmd[1] = (uint8_t)audio_ctrl_r & 0xFF;
907 if(i2c_master_transmit(&hi2cx, WM8988_I2C_ADDR_CSB_LOW, (uint8_t *)i2c_cmd, 2, 0xFFFF) != I2C_OK)
908 {
909 return ERROR;
910 }
911 }
912
913 if(spk_mute != audio_codec.spk_mute)
914 {
915 spk_mute = audio_codec.spk_mute;
916 audio_ctrl_l = (WM8988_R5_ADC_DAC_CONTROL << 9) | 0x0006 | (audio_codec.spk_mute << 3);
917 i2c_cmd[0] = (uint8_t)(audio_ctrl_l >> 8);
918 i2c_cmd[1] = (uint8_t)audio_ctrl_l & 0xFF;
919 if(i2c_master_transmit(&hi2cx, WM8988_I2C_ADDR_CSB_LOW, (uint8_t *)i2c_cmd, 2, 0xFFFF) != I2C_OK)
920 {
921 return ERROR;
922 }
923 }
924
925 if(spk_volume != audio_codec.spk_volume)
926 {
927 spk_volume = audio_codec.spk_volume;
928 audio_ctrl_l = WM8988_R2_LOUT1_VOLUME << 9 | 0x100;
929 audio_ctrl_r = WM8988_R3_ROUT1_VOLUME << 9 | 0x100;
930 audio_ctrl_l |= audio_codec.spk_volume;
931 audio_ctrl_r |= audio_codec.spk_volume;
932
933 i2c_cmd[0] = (uint8_t)(audio_ctrl_l >> 8);
934 i2c_cmd[1] = (uint8_t)audio_ctrl_l & 0xFF;
935
936 if(i2c_master_transmit(&hi2cx, WM8988_I2C_ADDR_CSB_LOW, (uint8_t *)i2c_cmd, 2, 0xFFFF) != I2C_OK)
937 {
938 return ERROR;
939 }
940 i2c_cmd[0] = (uint8_t)(audio_ctrl_r >> 8);
941 i2c_cmd[1] = (uint8_t)audio_ctrl_r & 0xFF;
942 if(i2c_master_transmit(&hi2cx, WM8988_I2C_ADDR_CSB_LOW, (uint8_t *)i2c_cmd, 2, 0xFFFF) != I2C_OK)
943 {
944 return ERROR;
945 }
946 }
947 return SUCCESS;
948}
949
buffer
uint8_t buffer[((uint16_t) 160) *((uint16_t) 120)]
Definition project/at_start_f413/examples/cortex_m4/fpu/src/main.c:42
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
dma_init_struct
dma_init_type dma_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:38
tmr_oc_init_structure
tmr_output_config_type tmr_oc_init_structure
Definition project/at_start_f413/examples/tmr/oc_high/src/main.c:37
reg_addr_data
uint16_t reg_addr_data[]
wm8988 register default value
Definition composite_audio_hid/src/audio_codec.c:70
audio_codec_mic_alt_setting
void audio_codec_mic_alt_setting(uint32_t alt_seting)
audio codec microphone alt setting config
Definition composite_audio_hid/src/audio_codec.c:168
codec_i2s_reset
void codec_i2s_reset(void)
audio codec i2s reset
Definition composite_audio_hid/src/audio_codec.c:482
spk_dma_buffer
uint16_t spk_dma_buffer[DMA_BUFFER_SIZE]
Definition composite_audio_hid/src/audio_codec.c:106
audio_codec_set_spk_volume
void audio_codec_set_spk_volume(uint16_t volume)
audio codec set speaker volume
Definition composite_audio_hid/src/audio_codec.c:220
audio_codec_set_spk_mute
void audio_codec_set_spk_mute(uint8_t mute)
audio codec set speaker mute
Definition composite_audio_hid/src/audio_codec.c:194
WM8988_REG_FREQ48K
#define WM8988_REG_FREQ48K
wm8988 freq
Definition composite_audio_hid/src/audio_codec.c:59
audio_codec_set_mic_freq
void audio_codec_set_mic_freq(uint32_t freq)
audio codec set microphone freq
Definition composite_audio_hid/src/audio_codec.c:120
I2Cx_ADDRESS
#define I2Cx_ADDRESS
Definition composite_audio_hid/src/audio_codec.c:43
I2Cx_CLK
#define I2Cx_CLK
Definition composite_audio_hid/src/audio_codec.c:46
audio_codec_mic_get_data
uint32_t audio_codec_mic_get_data(uint8_t *buffer)
codec microphone get data
Definition composite_audio_hid/src/audio_codec.c:285
WM8988_REG_BITW16
#define WM8988_REG_BITW16
wm8988 bit width
Definition composite_audio_hid/src/audio_codec.c:65
audio_codec_loop
error_status audio_codec_loop(void)
audio codec loop
Definition composite_audio_hid/src/audio_codec.c:858
codec_i2s_init
void codec_i2s_init(audio_codec_type *param)
audio codec i2s init
Definition composite_audio_hid/src/audio_codec.c:496
audio_codec_set_mic_mute
void audio_codec_set_mic_mute(uint8_t mute)
audio codec set microphone mute
Definition composite_audio_hid/src/audio_codec.c:183
audio_codec_spk_fifo_write
void audio_codec_spk_fifo_write(uint8_t *data, uint32_t len)
codec speaker write fifo
Definition composite_audio_hid/src/audio_codec.c:247
I2Cx_SDA_PIN
#define I2Cx_SDA_PIN
Definition composite_audio_hid/src/audio_codec.c:52
I2Cx_SCL_PIN
#define I2Cx_SCL_PIN
Definition composite_audio_hid/src/audio_codec.c:48
mic_dma_buffer
uint16_t mic_dma_buffer[DMA_BUFFER_SIZE]
Definition composite_audio_hid/src/audio_codec.c:107
audio_codec_spk_feedback
uint8_t audio_codec_spk_feedback(uint8_t *feedback)
codec speaker feedback
Definition composite_audio_hid/src/audio_codec.c:231
hi2cx
i2c_handle_type hi2cx
Definition composite_audio_hid/src/audio_codec.c:103
DMA1_Channel4_IRQHandler
void DMA1_Channel4_IRQHandler(void)
this function handles dma1 channel4 interrupt.
Definition composite_audio_hid/src/audio_codec.c:729
audio_codec_modify_freq
void audio_codec_modify_freq(uint32_t freq)
audio codec modify freq
Definition composite_audio_hid/src/audio_codec.c:345
I2Cx_SDA_GPIO_PORT
#define I2Cx_SDA_GPIO_PORT
Definition composite_audio_hid/src/audio_codec.c:53
audio_codec_set_mic_volume
void audio_codec_set_mic_volume(uint16_t volume)
audio codec set microphone volume
Definition composite_audio_hid/src/audio_codec.c:205
mclk_tmr1_init
void mclk_tmr1_init(void)
mclk clock conifg
Definition composite_audio_hid/src/audio_codec.c:440
DMA1_Channel3_IRQHandler
void DMA1_Channel3_IRQHandler(void)
this function handles dma1 channel3 interrupt.
Definition composite_audio_hid/src/audio_codec.c:654
I2Cx_SDA_GPIO_CLK
#define I2Cx_SDA_GPIO_CLK
Definition composite_audio_hid/src/audio_codec.c:54
audio_codec
audio_codec_type audio_codec
Definition composite_audio_hid/src/audio_codec.c:105
audio_codec_spk_alt_setting
void audio_codec_spk_alt_setting(uint32_t alt_seting)
audio codec speaker alt setting config
Definition composite_audio_hid/src/audio_codec.c:153
i2c_lowlevel_init
void i2c_lowlevel_init(i2c_handle_type *hi2c)
initializes peripherals used by the i2c.
Definition composite_audio_hid/src/audio_codec.c:402
I2Cx_SPEED
#define I2Cx_SPEED
Definition composite_audio_hid/src/audio_codec.c:42
audio_codec_init
error_status audio_codec_init(void)
audio codec init
Definition composite_audio_hid/src/audio_codec.c:799
WM8988_REG_FREQ16K
#define WM8988_REG_FREQ16K
Definition composite_audio_hid/src/audio_codec.c:60
copy_buff
void copy_buff(uint16_t *dest, uint16_t *src, uint32_t len)
copy buffer
Definition composite_audio_hid/src/audio_codec.c:388
memset16_buffer
void memset16_buffer(uint16_t *buffer, uint32_t set, uint32_t len)
buffer memset
Definition composite_audio_hid/src/audio_codec.c:372
I2Cx_PORT
#define I2Cx_PORT
Definition composite_audio_hid/src/audio_codec.c:45
audio_codec_set_spk_freq
void audio_codec_set_spk_freq(uint32_t freq)
audio codec set speaker freq
Definition composite_audio_hid/src/audio_codec.c:136
I2Cx_SCL_GPIO_CLK
#define I2Cx_SCL_GPIO_CLK
Definition composite_audio_hid/src/audio_codec.c:50
I2Cx_SCL_GPIO_PORT
#define I2Cx_SCL_GPIO_PORT
Definition composite_audio_hid/src/audio_codec.c:49
i2c_config
void i2c_config(i2c_handle_type *hi2c)
i2c peripheral initialization.
Definition i2c_application.c:111
i2c_master_transmit
i2c_status_type i2c_master_transmit(i2c_handle_type *hi2c, uint16_t address, uint8_t *pdata, uint16_t size, uint32_t timeout)
the master transmits data through polling mode.
Definition i2c_application.c:421
system_core_clock
unsigned int system_core_clock
Definition system_at32f413.c:47
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_SPI2_PERIPH_CLOCK
@ CRM_SPI2_PERIPH_CLOCK
Definition at32f413_crm.h:130
CRM_IOMUX_PERIPH_CLOCK
@ CRM_IOMUX_PERIPH_CLOCK
Definition at32f413_crm.h:108
CRM_SPI1_PERIPH_CLOCK
@ CRM_SPI1_PERIPH_CLOCK
Definition at32f413_crm.h:117
CRM_DMA1_PERIPH_CLOCK
@ CRM_DMA1_PERIPH_CLOCK
Definition at32f413_crm.h:103
CRM_TMR1_PERIPH_CLOCK
@ CRM_TMR1_PERIPH_CLOCK
Definition at32f413_crm.h:116
DMA1_Channel3_IRQn
@ DMA1_Channel3_IRQn
Definition at32f413.h:184
DMA1_Channel4_IRQn
@ DMA1_Channel4_IRQn
Definition at32f413.h:185
dma_channel_enable
void dma_channel_enable(dma_channel_type *dmax_channely, confirm_state new_state)
enable or disable dma channely
Definition at32f413_dma.c:197
dma_default_para_init
void dma_default_para_init(dma_init_type *dma_init_struct)
dma init config with its default value.
Definition at32f413_dma.c:407
dma_interrupt_flag_get
flag_status dma_interrupt_flag_get(uint32_t dmax_flag)
get dma interrupt flag
Definition at32f413_dma.c:297
dma_interrupt_enable
void dma_interrupt_enable(dma_channel_type *dmax_channely, uint32_t dma_int, confirm_state new_state)
enable or disable dma interrupt
Definition at32f413_dma.c:164
dma_flag_clear
void dma_flag_clear(uint32_t dmax_flag)
clear dma flag
Definition at32f413_dma.c:389
dma_reset
void dma_reset(dma_channel_type *dmax_channely)
reset the dmax channely registers.
Definition at32f413_dma.c:63
dma_init
void dma_init(dma_channel_type *dmax_channely, dma_init_type *dma_init_struct)
dma init
Definition at32f413_dma.c:442
DMA_PERIPHERAL_DATA_WIDTH_HALFWORD
@ DMA_PERIPHERAL_DATA_WIDTH_HALFWORD
Definition at32f413_dma.h:246
DMA_DIR_MEMORY_TO_PERIPHERAL
@ DMA_DIR_MEMORY_TO_PERIPHERAL
Definition at32f413_dma.h:217
DMA_DIR_PERIPHERAL_TO_MEMORY
@ DMA_DIR_PERIPHERAL_TO_MEMORY
Definition at32f413_dma.h:216
DMA_MEMORY_DATA_WIDTH_HALFWORD
@ DMA_MEMORY_DATA_WIDTH_HALFWORD
Definition at32f413_dma.h:256
DMA_PRIORITY_HIGH
@ DMA_PRIORITY_HIGH
Definition at32f413_dma.h:267
DMA1_HDT4_FLAG
#define DMA1_HDT4_FLAG
Definition at32f413_dma.h:94
DMA1_HDT3_FLAG
#define DMA1_HDT3_FLAG
Definition at32f413_dma.h:90
DMA1_FDT4_FLAG
#define DMA1_FDT4_FLAG
Definition at32f413_dma.h:93
DMA1_FDT3_FLAG
#define DMA1_FDT3_FLAG
Definition at32f413_dma.h:89
DMA_FDT_INT
#define DMA_FDT_INT
Definition at32f413_dma.h:51
DMA_HDT_INT
#define DMA_HDT_INT
Definition at32f413_dma.h:52
DMA1_CHANNEL3
#define DMA1_CHANNEL3
Definition at32f413_dma.h:482
DMA1_CHANNEL4
#define DMA1_CHANNEL4
Definition at32f413_dma.h:483
error_status
error_status
error status
Definition at32f413.h:302
ERROR
@ ERROR
Definition at32f413.h:302
SUCCESS
@ SUCCESS
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_pin_remap_config
void gpio_pin_remap_config(uint32_t gpio_remap, confirm_state new_state)
iomux remap and debug i/o configuration.
Definition at32f413_gpio.c:549
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_DRIVE_STRENGTH_MODERATE
@ GPIO_DRIVE_STRENGTH_MODERATE
Definition at32f413_gpio.h:225
GPIO_PULL_DOWN
@ GPIO_PULL_DOWN
Definition at32f413_gpio.h:245
GPIO_PULL_UP
@ GPIO_PULL_UP
Definition at32f413_gpio.h:244
GPIO_OUTPUT_OPEN_DRAIN
@ GPIO_OUTPUT_OPEN_DRAIN
Definition at32f413_gpio.h:235
GPIO_PINS_8
#define GPIO_PINS_8
Definition at32f413_gpio.h:58
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
i2c_own_address1_set
void i2c_own_address1_set(i2c_type *i2c_x, i2c_address_mode_type mode, uint16_t address)
config own address1.
Definition at32f413_i2c.c:191
i2c_init
void i2c_init(i2c_type *i2c_x, i2c_fsmode_duty_cycle_type duty, uint32_t speed)
init i2c speed and duty cycle.
Definition at32f413_i2c.c:89
I2C_FSMODE_DUTY_2_1
@ I2C_FSMODE_DUTY_2_1
Definition at32f413_i2c.h:147
I2C_ADDRESS_MODE_7BIT
@ I2C_ADDRESS_MODE_7BIT
Definition at32f413_i2c.h:156
I2C_OK
@ I2C_OK
Definition i2c_application.h:95
I2C1_MUX
#define I2C1_MUX
Definition at32f413_gpio.h:81
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
i2s_init
void i2s_init(spi_type *spi_x, i2s_init_type *i2s_init_struct)
i2s init config with its setting value.
Definition at32f413_spi.c:315
spi_i2s_dma_receiver_enable
void spi_i2s_dma_receiver_enable(spi_type *spi_x, confirm_state new_state)
enable or disable the spi/i2s dma receiver mode.
Definition at32f413_spi.c:498
i2s_enable
void i2s_enable(spi_type *spi_x, confirm_state new_state)
enable or disable i2s.
Definition at32f413_spi.c:444
spi_i2s_reset
void spi_i2s_reset(spi_type *spi_x)
spi reset by crm reset register
Definition at32f413_spi.c:50
i2s_default_para_init
void i2s_default_para_init(i2s_init_type *i2s_init_struct)
i2s init config with its default value.
Definition at32f413_spi.c:297
spi_i2s_dma_transmitter_enable
void spi_i2s_dma_transmitter_enable(spi_type *spi_x, confirm_state new_state)
enable or disable the spi/i2s dma transmitter mode.
Definition at32f413_spi.c:484
i2s_data_channel_format_type
i2s_data_channel_format_type
i2s data bit num and channel bit num type
Definition at32f413_spi.h:225
i2s_audio_sampling_freq_type
i2s_audio_sampling_freq_type
i2s audio frequency type
Definition at32f413_spi.h:208
I2S_CLOCK_POLARITY_LOW
@ I2S_CLOCK_POLARITY_LOW
Definition at32f413_spi.h:248
I2S_DATA_16BIT_CHANNEL_16BIT
@ I2S_DATA_16BIT_CHANNEL_16BIT
Definition at32f413_spi.h:226
I2S_DATA_24BIT_CHANNEL_32BIT
@ I2S_DATA_24BIT_CHANNEL_32BIT
Definition at32f413_spi.h:228
I2S_AUDIO_PROTOCOL_PHILLIPS
@ I2S_AUDIO_PROTOCOL_PHILLIPS
Definition at32f413_spi.h:197
I2S_MODE_SLAVE_RX
@ I2S_MODE_SLAVE_RX
Definition at32f413_spi.h:238
I2S_MODE_SLAVE_TX
@ I2S_MODE_SLAVE_TX
Definition at32f413_spi.h:237
SPI1
#define SPI1
Definition at32f413_spi.h:447
SPI2
#define SPI2
Definition at32f413_spi.h:448
tmr_counter_enable
void tmr_counter_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr counter
Definition at32f413_tmr.c:114
tmr_output_channel_config
void tmr_output_channel_config(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_output_config_type *tmr_output_struct)
config tmr output channel
Definition at32f413_tmr.c:318
tmr_clock_source_div_set
void tmr_clock_source_div_set(tmr_type *tmr_x, tmr_clock_division_type tmr_clock_div)
set tmr clock source division
Definition at32f413_tmr.c:204
tmr_output_default_para_init
void tmr_output_default_para_init(tmr_output_config_type *tmr_output_struct)
init tmr output default para
Definition at32f413_tmr.c:126
tmr_output_enable
void tmr_output_enable(tmr_type *tmr_x, confirm_state new_state)
tmr output enable(oen),this function is important for advtm output enable
Definition at32f413_tmr.c:1469
tmr_base_init
void tmr_base_init(tmr_type *tmr_x, uint32_t tmr_pr, uint32_t tmr_div)
init tmr base
Definition at32f413_tmr.c:179
tmr_output_channel_buffer_enable
void tmr_output_channel_buffer_enable(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, confirm_state new_state)
enable tmr output channel buffer
Definition at32f413_tmr.c:613
tmr_cnt_dir_set
void tmr_cnt_dir_set(tmr_type *tmr_x, tmr_count_mode_type tmr_cnt_dir)
set tmr counter count direction
Definition at32f413_tmr.c:225
tmr_channel_value_set
void tmr_channel_value_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, uint32_t tmr_channel_value)
set tmr channel value
Definition at32f413_tmr.c:506
TMR_COUNT_UP
@ TMR_COUNT_UP
Definition at32f413_tmr.h:105
TMR_SELECT_CHANNEL_1
@ TMR_SELECT_CHANNEL_1
Definition at32f413_tmr.h:215
TMR_CLOCK_DIV1
@ TMR_CLOCK_DIV1
Definition at32f413_tmr.h:95
TMR_OUTPUT_CONTROL_PWM_MODE_A
@ TMR_OUTPUT_CONTROL_PWM_MODE_A
Definition at32f413_tmr.h:178
TMR_OUTPUT_ACTIVE_HIGH
@ TMR_OUTPUT_ACTIVE_HIGH
Definition at32f413_tmr.h:196
TMR1
#define TMR1
Definition at32f413_tmr.h:831
MIC_BUFFER_SIZE
#define MIC_BUFFER_SIZE
Definition audio/inc/audio_codec.h:126
SPK_BUFFER_SIZE
#define SPK_BUFFER_SIZE
Definition audio/inc/audio_codec.h:127
DMA_BUFFER_SIZE
#define DMA_BUFFER_SIZE
Definition audio/inc/audio_codec.h:128
I2S2_DT_ADDRESS
#define I2S2_DT_ADDRESS
Definition audio/inc/audio_codec.h:115
I2S1_SD_PIN
#define I2S1_SD_PIN
Definition audio/inc/audio_codec.h:104
I2S1_CK_PIN
#define I2S1_CK_PIN
Definition audio/inc/audio_codec.h:103
I2S2_GPIO
#define I2S2_GPIO
Definition audio/inc/audio_codec.h:113
I2S2_SD_PIN
#define I2S2_SD_PIN
Definition audio/inc/audio_codec.h:112
I2S2_WS_PIN
#define I2S2_WS_PIN
Definition audio/inc/audio_codec.h:110
I2S2_GPIO_CRM_CLK
#define I2S2_GPIO_CRM_CLK
Definition audio/inc/audio_codec.h:114
I2S1_DT_ADDRESS
#define I2S1_DT_ADDRESS
Definition audio/inc/audio_codec.h:107
I2S1_GPIO_CRM_CLK
#define I2S1_GPIO_CRM_CLK
Definition audio/inc/audio_codec.h:106
I2S1_WS_PIN
#define I2S1_WS_PIN
Definition audio/inc/audio_codec.h:102
I2S1_GPIO
#define I2S1_GPIO
Definition audio/inc/audio_codec.h:105
I2S2_CK_PIN
#define I2S2_CK_PIN
Definition audio/inc/audio_codec.h:111
WM8988_R27_ADDITIONAL_3_CONTROL
#define WM8988_R27_ADDITIONAL_3_CONTROL
Definition audio/inc/audio_codec.h:76
WM8988_I2C_ADDR_CSB_LOW
#define WM8988_I2C_ADDR_CSB_LOW
Definition audio/inc/audio_codec.h:92
WM8988_R10_LEFT_DAC_VOLUME
#define WM8988_R10_LEFT_DAC_VOLUME
Definition audio/inc/audio_codec.h:59
WM8988_R1_RIGHT_INPUT_VOLUME
#define WM8988_R1_RIGHT_INPUT_VOLUME
Definition audio/inc/audio_codec.h:50
WM8988_R3_ROUT1_VOLUME
#define WM8988_R3_ROUT1_VOLUME
Definition audio/inc/audio_codec.h:52
WM8988_R36_RIGHT_OUT_MIX_1
#define WM8988_R36_RIGHT_OUT_MIX_1
Definition audio/inc/audio_codec.h:83
WM8988_R21_LEFT_ADC_VOLUME
#define WM8988_R21_LEFT_ADC_VOLUME
Definition audio/inc/audio_codec.h:70
WM8988_R31_ADC_INPUT_MODE
#define WM8988_R31_ADC_INPUT_MODE
Definition audio/inc/audio_codec.h:78
WM8988_R13_TREBLE_CONTROL
#define WM8988_R13_TREBLE_CONTROL
Definition audio/inc/audio_codec.h:62
WM8988_R16_3D_CONTROL
#define WM8988_R16_3D_CONTROL
Definition audio/inc/audio_codec.h:65
WM8988_R22_RIGHT_ADC_VOLUME
#define WM8988_R22_RIGHT_ADC_VOLUME
Definition audio/inc/audio_codec.h:71
WM8988_R0_LEFT_INPUT_VOLUME
#define WM8988_R0_LEFT_INPUT_VOLUME
Definition audio/inc/audio_codec.h:49
WM8988_R23_ADDITIONAL_1_CONTROL
#define WM8988_R23_ADDITIONAL_1_CONTROL
Definition audio/inc/audio_codec.h:72
WM8988_R35_LEFT_OUT_MIX_2
#define WM8988_R35_LEFT_OUT_MIX_2
Definition audio/inc/audio_codec.h:82
WM8988_R43_LOW_POWER_PALYBACK
#define WM8988_R43_LOW_POWER_PALYBACK
Definition audio/inc/audio_codec.h:90
WM8988_R32_ADC_L_SIGNAL_PATH
#define WM8988_R32_ADC_L_SIGNAL_PATH
Definition audio/inc/audio_codec.h:79
WM8988_R26_PWR_2_MGMT
#define WM8988_R26_PWR_2_MGMT
Definition audio/inc/audio_codec.h:75
WM8988_R11_RIGHT_DAC_VOLUME
#define WM8988_R11_RIGHT_DAC_VOLUME
Definition audio/inc/audio_codec.h:60
WM8988_R24_ADDITIONAL_2_CONTROL
#define WM8988_R24_ADDITIONAL_2_CONTROL
Definition audio/inc/audio_codec.h:73
WM8988_R40_LOUT2_VOLUME
#define WM8988_R40_LOUT2_VOLUME
Definition audio/inc/audio_codec.h:87
WM8988_R34_LEFT_OUT_MIX_1
#define WM8988_R34_LEFT_OUT_MIX_1
Definition audio/inc/audio_codec.h:81
WM8988_R5_ADC_DAC_CONTROL
#define WM8988_R5_ADC_DAC_CONTROL
Definition audio/inc/audio_codec.h:54
WM8988_R25_PWR_1_MGMT
#define WM8988_R25_PWR_1_MGMT
Definition audio/inc/audio_codec.h:74
WM8988_R41_ROUT2_VOLUME
#define WM8988_R41_ROUT2_VOLUME
Definition audio/inc/audio_codec.h:88
WM8988_R2_LOUT1_VOLUME
#define WM8988_R2_LOUT1_VOLUME
Definition audio/inc/audio_codec.h:51
WM8988_R37_RIGHT_OUT_MIX_2
#define WM8988_R37_RIGHT_OUT_MIX_2
Definition audio/inc/audio_codec.h:84
WM8988_R33_ADC_R_SIGNAL_PATH
#define WM8988_R33_ADC_R_SIGNAL_PATH
Definition audio/inc/audio_codec.h:80
WM8988_R12_BASS_CONTROL
#define WM8988_R12_BASS_CONTROL
Definition audio/inc/audio_codec.h:61
AUDIO_BITW_16
#define AUDIO_BITW_16
Definition audio/audio_conf.h:60
AUDIO_MIC_CHANEL_NUM
#define AUDIO_MIC_CHANEL_NUM
Definition audio/audio_conf.h:62
AUDIO_DEFAULT_FREQ
#define AUDIO_DEFAULT_FREQ
Definition audio/audio_conf.h:70
AUDIO_FREQ_16K
#define AUDIO_FREQ_16K
Definition audio/audio_conf.h:58
AUDIO_SPK_CHANEL_NUM
#define AUDIO_SPK_CHANEL_NUM
Definition audio/audio_conf.h:65
AUDIO_DEFAULT_BITW
#define AUDIO_DEFAULT_BITW
Definition audio/audio_conf.h:71
AUDIO_FREQ_48K
#define AUDIO_FREQ_48K
Definition audio/audio_conf.h:59
i2c_application.h
i2c application libray header file
audio_codec_type
Definition audio/inc/audio_codec.h:131
audio_codec_type::spk_mute
uint8_t spk_mute
Definition audio/inc/audio_codec.h:160
audio_codec_type::spk_threshold
uint16_t spk_threshold
Definition audio/inc/audio_codec.h:142
audio_codec_type::spk_stage
uint8_t spk_stage
Definition audio/inc/audio_codec.h:144
audio_codec_type::mic_roff
uint16_t * mic_roff
Definition audio/inc/audio_codec.h:148
audio_codec_type::spk_buffer
uint16_t spk_buffer[4096]
Definition audio/inc/audio_codec.h:135
audio_codec_type::mic_volume
uint16_t mic_volume
Definition audio/inc/audio_codec.h:162
audio_codec_type::spk_roff
uint16_t * spk_roff
Definition audio/inc/audio_codec.h:136
audio_codec_type::spk_rtotal
uint32_t spk_rtotal
Definition audio/inc/audio_codec.h:141
audio_codec_type::mic_delta
uint32_t mic_delta
Definition audio/inc/audio_codec.h:153
audio_codec_type::spk_calc
uint16_t spk_calc
Definition audio/inc/audio_codec.h:143
audio_codec_type::mic_woff
uint16_t * mic_woff
Definition audio/inc/audio_codec.h:149
audio_codec_type::mic_stage
uint8_t mic_stage
Definition audio/inc/audio_codec.h:157
audio_codec_type::mic_adj_count
uint16_t mic_adj_count
Definition audio/inc/audio_codec.h:155
audio_codec_type::spk_freq
uint32_t spk_freq
Definition audio/inc/audio_codec.h:139
audio_codec_type::audio_bitw
uint32_t audio_bitw
Definition audio/inc/audio_codec.h:133
audio_codec_type::mic_wend
uint16_t * mic_wend
Definition audio/inc/audio_codec.h:150
audio_codec_type::spk_rend
uint16_t * spk_rend
Definition audio/inc/audio_codec.h:138
audio_codec_type::mic_wtotal
uint32_t mic_wtotal
Definition audio/inc/audio_codec.h:151
audio_codec_type::mic_rtotal
uint32_t mic_rtotal
Definition audio/inc/audio_codec.h:152
audio_codec_type::audio_freq
uint32_t audio_freq
Definition audio/inc/audio_codec.h:132
audio_codec_type::mic_mute
uint8_t mic_mute
Definition audio/inc/audio_codec.h:159
audio_codec_type::spk_volume
uint16_t spk_volume
Definition audio/inc/audio_codec.h:163
audio_codec_type::mic_calc
uint16_t mic_calc
Definition audio/inc/audio_codec.h:154
audio_codec_type::spk_wtotal
uint32_t spk_wtotal
Definition audio/inc/audio_codec.h:140
audio_codec_type::mic_adj_stage
uint8_t mic_adj_stage
Definition audio/inc/audio_codec.h:156
audio_codec_type::spk_tx_size
uint32_t spk_tx_size
Definition audio/inc/audio_codec.h:165
audio_codec_type::mic_rx_size
uint32_t mic_rx_size
Definition audio/inc/audio_codec.h:166
audio_codec_type::spk_woff
uint16_t * spk_woff
Definition audio/inc/audio_codec.h:137
audio_codec_type::mic_buffer
uint16_t mic_buffer[1024]
Definition audio/inc/audio_codec.h:147
dma_init_type
dma init type
Definition at32f413_dma.h:275
dma_init_type::loop_mode_enable
confirm_state loop_mode_enable
Definition at32f413_dma.h:284
dma_init_type::buffer_size
uint16_t buffer_size
Definition at32f413_dma.h:279
dma_init_type::memory_data_width
dma_memory_data_size_type memory_data_width
Definition at32f413_dma.h:283
dma_init_type::priority
dma_priority_level_type priority
Definition at32f413_dma.h:285
dma_init_type::peripheral_inc_enable
confirm_state peripheral_inc_enable
Definition at32f413_dma.h:280
dma_init_type::memory_inc_enable
confirm_state memory_inc_enable
Definition at32f413_dma.h:281
dma_init_type::direction
dma_dir_type direction
Definition at32f413_dma.h:278
dma_init_type::peripheral_base_addr
uint32_t peripheral_base_addr
Definition at32f413_dma.h:276
dma_init_type::memory_base_addr
uint32_t memory_base_addr
Definition at32f413_dma.h:277
dma_init_type::peripheral_data_width
dma_peripheral_data_size_type peripheral_data_width
Definition at32f413_dma.h:282
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
i2c_handle_type
Definition i2c_application.h:127
i2c_handle_type::i2cx
i2c_type * i2cx
Definition i2c_application.h:128
i2s_init_type
i2s init type
Definition at32f413_spi.h:271
i2s_init_type::audio_sampling_freq
i2s_audio_sampling_freq_type audio_sampling_freq
Definition at32f413_spi.h:274
i2s_init_type::data_channel_format
i2s_data_channel_format_type data_channel_format
Definition at32f413_spi.h:275
i2s_init_type::mclk_output_enable
confirm_state mclk_output_enable
Definition at32f413_spi.h:277
i2s_init_type::audio_protocol
i2s_audio_protocol_type audio_protocol
Definition at32f413_spi.h:273
i2s_init_type::operation_mode
i2s_operation_mode_type operation_mode
Definition at32f413_spi.h:272
i2s_init_type::clock_polarity
i2s_clock_polarity_type clock_polarity
Definition at32f413_spi.h:276
tmr_output_config_type
tmr output config type
Definition at32f413_tmr.h:397
tmr_output_config_type::oc_idle_state
confirm_state oc_idle_state
Definition at32f413_tmr.h:399
tmr_output_config_type::oc_output_state
confirm_state oc_output_state
Definition at32f413_tmr.h:403
tmr_output_config_type::oc_mode
tmr_output_control_mode_type oc_mode
Definition at32f413_tmr.h:398
tmr_output_config_type::oc_polarity
tmr_output_polarity_type oc_polarity
Definition at32f413_tmr.h:401


AT32F413 Firmwary Library: msc_bot_scsi.c Source File

  • middlewares
  • usbd_class
  • composite_cdc_msc
composite_cdc_msc/msc_bot_scsi.c
Go to the documentation of this file.
1
25#include "cdc_msc_class.h"
26#include "msc_diskio.h"
27
42#if defined ( __ICCARM__ ) /* iar compiler */
43 #pragma data_alignment=4
44#endif
45ALIGNED_HEAD uint8_t page00_inquiry_data[] ALIGNED_TAIL = {
46 0x00,
47 0x00,
48 0x00,
49 0x00,
50 0x00,
51
52};
53#if defined ( __ICCARM__ ) /* iar compiler */
54 #pragma data_alignment=4
55#endif
56ALIGNED_HEAD sense_type sense_data ALIGNED_TAIL =
57{
58 0x70,
59 0x00,
60 SENSE_KEY_ILLEGAL_REQUEST,
61 0x00000000,
62 0x0A,
63 0x00000000,
64 0x20,
65 0x00,
66 0x00000000
67};
68
69#if defined ( __ICCARM__ ) /* iar compiler */
70 #pragma data_alignment=4
71#endif
72ALIGNED_HEAD uint8_t mode_sense6_data[8] ALIGNED_TAIL =
73{
74 0x00,
75 0x00,
76 0x00,
77 0x00,
78 0x00,
79 0x00,
80 0x00,
81 0x00
82};
83
84#if defined ( __ICCARM__ ) /* iar compiler */
85 #pragma data_alignment=4
86#endif
87ALIGNED_HEAD uint8_t mode_sense10_data[8] ALIGNED_TAIL =
88{
89 0x00,
90 0x06,
91 0x00,
92 0x00,
93 0x00,
94 0x00,
95 0x00,
96 0x00
97};
103void bot_scsi_init(void *udev)
104{
105 usbd_core_type *pudev = (usbd_core_type *)udev;
106 cdc_msc_struct_type *pmsc = (cdc_msc_struct_type *)pudev->class_handler->pdata;
107 pmsc->msc_state = MSC_STATE_MACHINE_IDLE;
108 pmsc->bot_status = MSC_BOT_STATE_IDLE;
109 pmsc->max_lun = MSC_SUPPORT_MAX_LUN - 1;
110
111 pmsc->csw_struct.dCSWSignature = CSW_DCSWSIGNATURE;
112 pmsc->csw_struct.dCSWDataResidue = 0;
113 pmsc->csw_struct.dCSWSignature = 0;
114 pmsc->csw_struct.dCSWTag = CSW_BCSWSTATUS_PASS;
115
116 /* set out endpoint to receive status */
117 usbd_ept_recv(pudev, USBD_MSC_BULK_OUT_EPT, (uint8_t *)&pmsc->cbw_struct, CBW_CMD_LENGTH);
118}
119
125void bot_scsi_reset(void *udev)
126{
127 usbd_core_type *pudev = (usbd_core_type *)udev;
128 cdc_msc_struct_type *pmsc = (cdc_msc_struct_type *)pudev->class_handler->pdata;
129 pmsc->msc_state = MSC_STATE_MACHINE_IDLE;
130 pmsc->bot_status = MSC_BOT_STATE_RECOVERY;
131 pmsc->max_lun = MSC_SUPPORT_MAX_LUN - 1;
132
133 /* set out endpoint to receive status */
134 usbd_ept_recv(pudev, USBD_MSC_BULK_OUT_EPT, (uint8_t *)&pmsc->cbw_struct, CBW_CMD_LENGTH);
135}
136
143void bot_scsi_datain_handler(void *udev, uint8_t ept_num)
144{
145 usbd_core_type *pudev = (usbd_core_type *)udev;
146 cdc_msc_struct_type *pmsc = (cdc_msc_struct_type *)pudev->class_handler->pdata;
147 switch(pmsc->msc_state)
148 {
149 case MSC_STATE_MACHINE_DATA_IN:
150 if(bot_scsi_cmd_process(udev) != USB_OK)
151 {
152 bot_scsi_send_csw(udev, CSW_BCSWSTATUS_FAILED);
153 }
154 break;
155
156 case MSC_STATE_MACHINE_LAST_DATA:
157 case MSC_STATE_MACHINE_SEND_DATA:
158 bot_scsi_send_csw(udev, CSW_BCSWSTATUS_PASS);
159 break;
160
161 default:
162 break;
163 }
164}
165
172void bot_scsi_dataout_handler(void *udev, uint8_t ept_num)
173{
174 usbd_core_type *pudev = (usbd_core_type *)udev;
175 cdc_msc_struct_type *pmsc = (cdc_msc_struct_type *)pudev->class_handler->pdata;
176 switch(pmsc->msc_state)
177 {
178 case MSC_STATE_MACHINE_IDLE:
179 bot_cbw_decode(udev);
180 break;
181
182 case MSC_STATE_MACHINE_DATA_OUT:
183 if(bot_scsi_cmd_process(udev) != USB_OK)
184 {
185 bot_scsi_send_csw(udev, CSW_BCSWSTATUS_FAILED);
186 }
187 break;
188 }
189}
190
196void bot_cbw_decode(void *udev)
197{
198 usbd_core_type *pudev = (usbd_core_type *)udev;
199 cdc_msc_struct_type *pmsc = (cdc_msc_struct_type *)pudev->class_handler->pdata;
200
201 pmsc->csw_struct.dCSWTag = pmsc->cbw_struct.dCBWTage;
202 pmsc->csw_struct.dCSWDataResidue = pmsc->cbw_struct.dCBWDataTransferLength;
203
204 /* check param */
205 if((pmsc->cbw_struct.dCBWSignature != CBW_DCBWSIGNATURE) ||
206 (usbd_get_recv_len(pudev, USBD_MSC_BULK_OUT_EPT) != CBW_CMD_LENGTH)
207 || (pmsc->cbw_struct.bCBWLUN > MSC_SUPPORT_MAX_LUN) ||
208 (pmsc->cbw_struct.bCBWCBLength < 1) || (pmsc->cbw_struct.bCBWCBLength > 16))
209 {
210 bot_scsi_sense_code(udev, SENSE_KEY_ILLEGAL_REQUEST, INVALID_COMMAND);
211 pmsc->bot_status = MSC_BOT_STATE_ERROR;
212 bot_scsi_stall(udev);
213 }
214 else
215 {
216 if(bot_scsi_cmd_process(udev) != USB_OK)
217 {
218 bot_scsi_stall(udev);
219 }
220 else if((pmsc->msc_state != MSC_STATE_MACHINE_DATA_IN) &&
221 (pmsc->msc_state != MSC_STATE_MACHINE_DATA_OUT) &&
222 (pmsc->msc_state != MSC_STATE_MACHINE_LAST_DATA))
223 {
224 if(pmsc->data_len == 0)
225 {
226 bot_scsi_send_csw(udev, CSW_BCSWSTATUS_PASS);
227 }
228 else if(pmsc->data_len > 0)
229 {
230 bot_scsi_send_data(udev, pmsc->data, pmsc->data_len);
231 }
232 }
233 }
234}
235
243void bot_scsi_send_data(void *udev, uint8_t *buffer, uint32_t len)
244{
245 usbd_core_type *pudev = (usbd_core_type *)udev;
246 cdc_msc_struct_type *pmsc = (cdc_msc_struct_type *)pudev->class_handler->pdata;
247 uint32_t data_len = MIN(len, pmsc->cbw_struct.dCBWDataTransferLength);
248
249 pmsc->csw_struct.dCSWDataResidue -= data_len;
250 pmsc->csw_struct.bCSWStatus = CSW_BCSWSTATUS_PASS;
251
252 pmsc->msc_state = MSC_STATE_MACHINE_SEND_DATA;
253
254 usbd_ept_send(pudev, USBD_MSC_BULK_IN_EPT,
255 buffer, data_len);
256}
257
264void bot_scsi_send_csw(void *udev, uint8_t status)
265{
266 usbd_core_type *pudev = (usbd_core_type *)udev;
267 cdc_msc_struct_type *pmsc = (cdc_msc_struct_type *)pudev->class_handler->pdata;
268
269 pmsc->csw_struct.bCSWStatus = status;
270 pmsc->csw_struct.dCSWSignature = CSW_DCSWSIGNATURE;
271 pmsc->msc_state = MSC_STATE_MACHINE_IDLE;
272
273 usbd_ept_send(pudev, USBD_MSC_BULK_IN_EPT,
274 (uint8_t *)&pmsc->csw_struct, CSW_CMD_LENGTH);
275
276 usbd_ept_recv(pudev, USBD_MSC_BULK_OUT_EPT,
277 (uint8_t *)&pmsc->cbw_struct, CBW_CMD_LENGTH);
278}
279
280
288void bot_scsi_sense_code(void *udev, uint8_t sense_key, uint8_t asc)
289{
290 sense_data.sense_key = sense_key;
291 sense_data.asc = asc;
292}
293
294
303 usb_sts_type bot_scsi_check_address(void *udev, uint8_t lun, uint32_t blk_offset, uint32_t blk_count)
304{
305 usbd_core_type *pudev = (usbd_core_type *)udev;
306 cdc_msc_struct_type *pmsc = (cdc_msc_struct_type *)pudev->class_handler->pdata;
307 if((blk_offset + blk_count) > pmsc->blk_nbr[lun])
308 {
309 bot_scsi_sense_code(udev, SENSE_KEY_ILLEGAL_REQUEST, ADDRESS_OUT_OF_RANGE);
310 return USB_FAIL;
311 }
312 return USB_OK;
313}
314
320void bot_scsi_stall(void *udev)
321{
322 usbd_core_type *pudev = (usbd_core_type *)udev;
323 cdc_msc_struct_type *pmsc = (cdc_msc_struct_type *)pudev->class_handler->pdata;
324
325 if((pmsc->cbw_struct.dCBWDataTransferLength != 0) &&
326 (pmsc->cbw_struct.bmCBWFlags == 0) &&
327 pmsc->bot_status == MSC_BOT_STATE_IDLE)
328 {
329 usbd_set_stall(pudev, USBD_MSC_BULK_OUT_EPT);
330 }
331 usbd_set_stall(pudev, USBD_MSC_BULK_IN_EPT);
332
333 if(pmsc->bot_status == MSC_BOT_STATE_ERROR)
334 {
335 usbd_ept_recv(pudev, USBD_MSC_BULK_OUT_EPT,
336 (uint8_t *)&pmsc->cbw_struct, CBW_CMD_LENGTH);
337 }
338}
339
346 usb_sts_type bot_scsi_test_unit(void *udev, uint8_t lun)
347{
348 usb_sts_type status = USB_OK;
349 usbd_core_type *pudev = (usbd_core_type *)udev;
350 cdc_msc_struct_type *pmsc = (cdc_msc_struct_type *)pudev->class_handler->pdata;
351
352 if(pmsc->cbw_struct.dCBWDataTransferLength != 0)
353 {
354 bot_scsi_sense_code(udev, SENSE_KEY_ILLEGAL_REQUEST, INVALID_COMMAND);
355 return USB_FAIL;
356 }
357
358 pmsc->data_len = 0;
359 return status;
360}
361
368 usb_sts_type bot_scsi_inquiry(void *udev, uint8_t lun)
369{
370 uint8_t *pdata;
371 uint32_t trans_len = 0;
372 usb_sts_type status = USB_OK;
373 usbd_core_type *pudev = (usbd_core_type *)udev;
374 cdc_msc_struct_type *pmsc = (cdc_msc_struct_type *)pudev->class_handler->pdata;
375
376 if(pmsc->cbw_struct.CBWCB[1] & 0x01)
377 {
378 pdata = page00_inquiry_data;
379 trans_len = 5;
380 }
381 else
382 {
383 pdata = get_inquiry(lun);
384 if(pmsc->cbw_struct.dCBWDataTransferLength < SCSI_INQUIRY_DATA_LENGTH)
385 {
386 trans_len = pmsc->cbw_struct.dCBWDataTransferLength;
387 }
388 else
389 {
390 trans_len = SCSI_INQUIRY_DATA_LENGTH;
391 }
392 }
393
394 pmsc->data_len = trans_len;
395 while(trans_len)
396 {
397 trans_len --;
398 pmsc->data[trans_len] = pdata[trans_len];
399 }
400 return status;
401}
402
409 usb_sts_type bot_scsi_start_stop(void *udev, uint8_t lun)
410{
411 usbd_core_type *pudev = (usbd_core_type *)udev;
412 cdc_msc_struct_type *pmsc = (cdc_msc_struct_type *)pudev->class_handler->pdata;
413 pmsc->data_len = 0;
414 return USB_OK;
415}
416
423 usb_sts_type bot_scsi_allow_medium_removal(void *udev, uint8_t lun)
424{
425 usbd_core_type *pudev = (usbd_core_type *)udev;
426 cdc_msc_struct_type *pmsc = (cdc_msc_struct_type *)pudev->class_handler->pdata;
427 pmsc->data_len = 0;
428 return USB_OK;
429}
430
437 usb_sts_type bot_scsi_mode_sense6(void *udev, uint8_t lun)
438{
439 uint8_t data_len = 8;
440 usbd_core_type *pudev = (usbd_core_type *)udev;
441 cdc_msc_struct_type *pmsc = (cdc_msc_struct_type *)pudev->class_handler->pdata;
442 pmsc->data_len = 8;
443 while(data_len)
444 {
445 data_len --;
446 pmsc->data[data_len] = mode_sense6_data[data_len];
447 };
448 return USB_OK;
449}
450
457 usb_sts_type bot_scsi_mode_sense10(void *udev, uint8_t lun)
458{
459 uint8_t data_len = 8;
460 usbd_core_type *pudev = (usbd_core_type *)udev;
461 cdc_msc_struct_type *pmsc = (cdc_msc_struct_type *)pudev->class_handler->pdata;
462 pmsc->data_len = 8;
463 while(data_len)
464 {
465 data_len --;
466 pmsc->data[data_len] = mode_sense10_data[data_len];
467 };
468 return USB_OK;
469}
470
477 usb_sts_type bot_scsi_capacity(void *udev, uint8_t lun)
478{
479 usbd_core_type *pudev = (usbd_core_type *)udev;
480 cdc_msc_struct_type *pmsc = (cdc_msc_struct_type *)pudev->class_handler->pdata;
481 uint8_t *pdata = pmsc->data;
482 msc_disk_capacity(lun, &pmsc->blk_nbr[lun], &pmsc->blk_size[lun]);
483
484 pdata[0] = (uint8_t)((pmsc->blk_nbr[lun] - 1) >> 24);
485 pdata[1] = (uint8_t)((pmsc->blk_nbr[lun] - 1) >> 16);
486 pdata[2] = (uint8_t)((pmsc->blk_nbr[lun] - 1) >> 8);
487 pdata[3] = (uint8_t)((pmsc->blk_nbr[lun] - 1));
488
489 pdata[4] = (uint8_t)((pmsc->blk_size[lun]) >> 24);
490 pdata[5] = (uint8_t)((pmsc->blk_size[lun]) >> 16);
491 pdata[6] = (uint8_t)((pmsc->blk_size[lun]) >> 8);
492 pdata[7] = (uint8_t)((pmsc->blk_size[lun]));
493
494 pmsc->data_len = 8;
495 return USB_OK;
496}
497
504 usb_sts_type bot_scsi_format_capacity(void *udev, uint8_t lun)
505{
506 usbd_core_type *pudev = (usbd_core_type *)udev;
507 cdc_msc_struct_type *pmsc = (cdc_msc_struct_type *)pudev->class_handler->pdata;
508 uint8_t *pdata = pmsc->data;
509
510 pdata[0] = 0;
511 pdata[1] = 0;
512 pdata[2] = 0;
513 pdata[3] = 0x08;
514
515 msc_disk_capacity(lun, &pmsc->blk_nbr[lun], &pmsc->blk_size[lun]);
516
517 pdata[4] = (uint8_t)((pmsc->blk_nbr[lun] - 1) >> 24);
518 pdata[5] = (uint8_t)((pmsc->blk_nbr[lun] - 1) >> 16);
519 pdata[6] = (uint8_t)((pmsc->blk_nbr[lun] - 1) >> 8);
520 pdata[7] = (uint8_t)((pmsc->blk_nbr[lun] - 1));
521
522 pdata[8] = 0x02;
523
524 pdata[9] = (uint8_t)((pmsc->blk_size[lun]) >> 16);
525 pdata[10] = (uint8_t)((pmsc->blk_size[lun]) >> 8);
526 pdata[11] = (uint8_t)((pmsc->blk_size[lun]));
527
528 pmsc->data_len = 12;
529
530 return USB_OK;
531}
532
539 usb_sts_type bot_scsi_request_sense(void *udev, uint8_t lun)
540{
541 uint32_t trans_len = 0x12;
542 usbd_core_type *pudev = (usbd_core_type *)udev;
543 cdc_msc_struct_type *pmsc = (cdc_msc_struct_type *)pudev->class_handler->pdata;
544 uint8_t *pdata = pmsc->data;
545 uint8_t *sdata = (uint8_t *)&sense_data;
546
547 while(trans_len)
548 {
549 trans_len --;
550 pdata[trans_len] = sdata[trans_len];
551 }
552
553 if(pmsc->cbw_struct.dCBWDataTransferLength < REQ_SENSE_STANDARD_DATA_LEN)
554 {
555 pmsc->data_len = pmsc->cbw_struct.dCBWDataTransferLength;
556 }
557 else
558 {
559 pmsc->data_len = REQ_SENSE_STANDARD_DATA_LEN;
560 }
561 return USB_OK;
562}
563
570 usb_sts_type bot_scsi_verify(void *udev, uint8_t lun)
571{
572 usbd_core_type *pudev = (usbd_core_type *)udev;
573 cdc_msc_struct_type *pmsc = (cdc_msc_struct_type *)pudev->class_handler->pdata;
574 uint8_t *cmd = pmsc->cbw_struct.CBWCB;
575 if((pmsc->cbw_struct.CBWCB[1] & 0x02) == 0x02)
576 {
577 bot_scsi_sense_code(udev, SENSE_KEY_ILLEGAL_REQUEST, INVALID_FIELED_IN_COMMAND);
578 return USB_FAIL;
579 }
580
581 pmsc->blk_addr = cmd[2] << 24 | cmd[3] << 16 | cmd[4] << 8 | cmd[5];
582 pmsc->blk_len = cmd[7] << 8 | cmd[8];
583
584 if(bot_scsi_check_address(udev, lun, pmsc->blk_addr, pmsc->blk_len) != USB_OK)
585 {
586 return USB_FAIL;
587 }
588 pmsc->data_len = 0;
589 return USB_OK;
590}
591
598 usb_sts_type bot_scsi_read10(void *udev, uint8_t lun)
599{
600 usbd_core_type *pudev = (usbd_core_type *)udev;
601 cdc_msc_struct_type *pmsc = (cdc_msc_struct_type *)pudev->class_handler->pdata;
602 uint8_t *cmd = pmsc->cbw_struct.CBWCB;
603 uint32_t len;
604
605 if(pmsc->msc_state == MSC_STATE_MACHINE_IDLE)
606 {
607 if((pmsc->cbw_struct.bmCBWFlags & 0x80) != 0x80)
608 {
609 bot_scsi_sense_code(udev, SENSE_KEY_ILLEGAL_REQUEST, INVALID_COMMAND);
610 return USB_FAIL;
611 }
612
613 pmsc->blk_addr = cmd[2] << 24 | cmd[3] << 16 | cmd[4] << 8 | cmd[5];
614 pmsc->blk_len = cmd[7] << 8 | cmd[8];
615
616 if(bot_scsi_check_address(udev, lun, pmsc->blk_addr, pmsc->blk_len) != USB_OK)
617 {
618 return USB_FAIL;
619 }
620
621 pmsc->blk_addr *= pmsc->blk_size[lun];
622 pmsc->blk_len *= pmsc->blk_size[lun];
623
624 if(pmsc->cbw_struct.dCBWDataTransferLength != pmsc->blk_len)
625 {
626 bot_scsi_sense_code(udev, SENSE_KEY_ILLEGAL_REQUEST, INVALID_COMMAND);
627 return USB_FAIL;
628 }
629 pmsc->msc_state = MSC_STATE_MACHINE_DATA_IN;
630 }
631 pmsc->data_len = MSC_MAX_DATA_BUF_LEN;
632
633 len = MIN(pmsc->blk_len, MSC_MAX_DATA_BUF_LEN);
634 if( msc_disk_read(lun, pmsc->blk_addr, pmsc->data, len) != USB_OK)
635 {
636 bot_scsi_sense_code(udev, SENSE_KEY_HARDWARE_ERROR, MEDIUM_NOT_PRESENT);
637 return USB_FAIL;
638 }
639 usbd_ept_send(pudev, USBD_MSC_BULK_IN_EPT, pmsc->data, len);
640 pmsc->blk_addr += len;
641 pmsc->blk_len -= len;
642
643 pmsc->csw_struct.dCSWDataResidue -= len;
644 if(pmsc->blk_len == 0)
645 {
646 pmsc->msc_state = MSC_STATE_MACHINE_LAST_DATA;
647 }
648
649 return USB_OK;
650}
651
652
659 usb_sts_type bot_scsi_write10(void *udev, uint8_t lun)
660{
661 usbd_core_type *pudev = (usbd_core_type *)udev;
662 cdc_msc_struct_type *pmsc = (cdc_msc_struct_type *)pudev->class_handler->pdata;
663 uint8_t *cmd = pmsc->cbw_struct.CBWCB;
664 uint32_t len;
665
666 if(pmsc->msc_state == MSC_STATE_MACHINE_IDLE)
667 {
668 if((pmsc->cbw_struct.bmCBWFlags & 0x80) == 0x80)
669 {
670 bot_scsi_sense_code(udev, SENSE_KEY_ILLEGAL_REQUEST, INVALID_COMMAND);
671 return USB_FAIL;
672 }
673
674 pmsc->blk_addr = cmd[2] << 24 | cmd[3] << 16 | cmd[4] << 8 | cmd[5];
675 pmsc->blk_len = cmd[7] << 8 | cmd[8];
676
677 if(bot_scsi_check_address(udev, lun, pmsc->blk_addr, pmsc->blk_len) != USB_OK)
678 {
679 return USB_FAIL;
680 }
681
682 pmsc->blk_addr *= pmsc->blk_size[lun];
683 pmsc->blk_len *= pmsc->blk_size[lun];
684
685 if(pmsc->cbw_struct.dCBWDataTransferLength != pmsc->blk_len)
686 {
687 bot_scsi_sense_code(udev, SENSE_KEY_ILLEGAL_REQUEST, INVALID_COMMAND);
688 return USB_FAIL;
689 }
690
691 pmsc->msc_state = MSC_STATE_MACHINE_DATA_OUT;
692 len = MIN(pmsc->blk_len, MSC_MAX_DATA_BUF_LEN);
693 usbd_ept_recv(pudev, USBD_MSC_BULK_OUT_EPT, (uint8_t *)pmsc->data, len);
694
695 }
696 else
697 {
698 len = MIN(pmsc->blk_len, MSC_MAX_DATA_BUF_LEN);
699 if(msc_disk_write(lun, pmsc->blk_addr, pmsc->data, len) != USB_OK)
700 {
701 bot_scsi_sense_code(udev, SENSE_KEY_HARDWARE_ERROR, MEDIUM_NOT_PRESENT);
702 return USB_FAIL;
703 }
704
705 pmsc->blk_addr += len;
706 pmsc->blk_len -= len;
707
708 pmsc->csw_struct.dCSWDataResidue -= len;
709
710 if(pmsc->blk_len == 0)
711 {
712 bot_scsi_send_csw(udev, CSW_BCSWSTATUS_PASS);
713 }
714 else
715 {
716 len = MIN(pmsc->blk_len, MSC_MAX_DATA_BUF_LEN);
717 usbd_ept_recv(pudev, USBD_MSC_BULK_OUT_EPT, (uint8_t *)pmsc->data, len);
718 }
719 }
720 return USB_OK;
721}
722
729void bot_scsi_clear_feature(void *udev, uint8_t ept_num)
730{
731 usbd_core_type *pudev = (usbd_core_type *)udev;
732 cdc_msc_struct_type *pmsc = (cdc_msc_struct_type *)pudev->class_handler->pdata;
733 if(pmsc->bot_status == MSC_BOT_STATE_ERROR)
734 {
735 usbd_set_stall(pudev, USBD_MSC_BULK_IN_EPT);
736 pmsc->bot_status = MSC_BOT_STATE_IDLE;
737 }
738 else if(((ept_num & 0x80) == 0x80) && (pmsc->bot_status != MSC_BOT_STATE_RECOVERY))
739 {
740 bot_scsi_send_csw(udev, CSW_BCSWSTATUS_FAILED);
741 }
742}
743
749 usb_sts_type bot_scsi_cmd_process(void *udev)
750{
751 usb_sts_type status = USB_FAIL;
752 usbd_core_type *pudev = (usbd_core_type *)udev;
753 cdc_msc_struct_type *pmsc = (cdc_msc_struct_type *)pudev->class_handler->pdata;
754 switch(pmsc->cbw_struct.CBWCB[0])
755 {
756 case MSC_CMD_INQUIRY:
757 status = bot_scsi_inquiry(udev, pmsc->cbw_struct.bCBWLUN);
758 break;
759
760 case MSC_CMD_START_STOP:
761 status = bot_scsi_start_stop(udev, pmsc->cbw_struct.bCBWLUN);
762 break;
763
764 case MSC_CMD_MODE_SENSE6:
765 status = bot_scsi_mode_sense6(udev, pmsc->cbw_struct.bCBWLUN);
766 break;
767
768 case MSC_CMD_MODE_SENSE10:
769 status = bot_scsi_mode_sense10(udev, pmsc->cbw_struct.bCBWLUN);
770 break;
771
772 case MSC_CMD_ALLOW_MEDIUM_REMOVAL:
773 status = bot_scsi_allow_medium_removal(udev, pmsc->cbw_struct.bCBWLUN);
774 break;
775
776 case MSC_CMD_READ_10:
777 status = bot_scsi_read10(udev, pmsc->cbw_struct.bCBWLUN);
778 break;
779
780 case MSC_CMD_READ_CAPACITY:
781 status = bot_scsi_capacity(udev, pmsc->cbw_struct.bCBWLUN);
782 break;
783
784 case MSC_CMD_REQUEST_SENSE:
785 status = bot_scsi_request_sense(udev, pmsc->cbw_struct.bCBWLUN);
786 break;
787
788 case MSC_CMD_TEST_UNIT:
789 status = bot_scsi_test_unit(udev, pmsc->cbw_struct.bCBWLUN);
790 break;
791
792 case MSC_CMD_VERIFY:
793 status = bot_scsi_verify(udev, pmsc->cbw_struct.bCBWLUN);
794 break;
795
796 case MSC_CMD_WRITE_10:
797 status = bot_scsi_write10(udev, pmsc->cbw_struct.bCBWLUN);
798 break;
799
800 case MSC_CMD_READ_FORMAT_CAPACITY:
801 status = bot_scsi_format_capacity(udev, pmsc->cbw_struct.bCBWLUN);
802 break;
803
804 default:
805 bot_scsi_sense_code(udev, SENSE_KEY_ILLEGAL_REQUEST, INVALID_COMMAND);
806 status = USB_FAIL;
807 break;
808 }
809 return status;
810}
811
cdc_msc_class.h
usb cdc class file
buffer
uint8_t buffer[((uint16_t) 160) *((uint16_t) 120)]
Definition project/at_start_f413/examples/cortex_m4/fpu/src/main.c:42
msc_disk_capacity
usb_sts_type msc_disk_capacity(uint8_t lun, uint32_t *blk_nbr, uint32_t *blk_size)
disk capacity
Definition composite_vcp_msc/src/msc_diskio.c:135
get_inquiry
uint8_t * get_inquiry(uint8_t lun)
get disk inquiry
Definition composite_vcp_msc/src/msc_diskio.c:58
msc_disk_read
usb_sts_type msc_disk_read(uint8_t lun, uint64_t addr, uint8_t *read_buf, uint32_t len)
disk read
Definition composite_vcp_msc/src/msc_diskio.c:74
msc_disk_write
usb_sts_type msc_disk_write(uint8_t lun, uint64_t addr, uint8_t *buf, uint32_t len)
disk write
Definition composite_vcp_msc/src/msc_diskio.c:101
cdc_msc_struct_type::cbw_struct
cbw_type cbw_struct
Definition cdc_msc_class.h:276
cdc_msc_struct_type::data
uint8_t data[4096]
Definition cdc_msc_class.h:274
cbw_type::bCBWLUN
uint8_t bCBWLUN
Definition cdc_msc_class.h:193
cbw_type::bCBWCBLength
uint8_t bCBWCBLength
Definition cdc_msc_class.h:194
cdc_msc_struct_type::msc_state
uint8_t msc_state
Definition cdc_msc_class.h:263
csw_type::dCSWSignature
uint32_t dCSWSignature
Definition cdc_msc_class.h:203
cbw_type::CBWCB
uint8_t CBWCB[16]
Definition cdc_msc_class.h:195
csw_type::bCSWStatus
uint32_t bCSWStatus
Definition cdc_msc_class.h:206
cdc_msc_struct_type::blk_len
uint32_t blk_len
Definition cdc_msc_class.h:271
csw_type::dCSWTag
uint32_t dCSWTag
Definition cdc_msc_class.h:204
csw_type::dCSWDataResidue
uint32_t dCSWDataResidue
Definition cdc_msc_class.h:205
cdc_msc_struct_type::blk_size
uint32_t blk_size[1]
Definition cdc_msc_class.h:268
cdc_msc_struct_type::csw_struct
csw_type csw_struct
Definition cdc_msc_class.h:277
cdc_msc_struct_type::blk_addr
uint64_t blk_addr
Definition cdc_msc_class.h:270
cdc_msc_struct_type::data_len
uint32_t data_len
Definition cdc_msc_class.h:273
cdc_msc_struct_type::blk_nbr
uint32_t blk_nbr[1]
Definition cdc_msc_class.h:267
cbw_type::dCBWDataTransferLength
uint32_t dCBWDataTransferLength
Definition cdc_msc_class.h:191
cdc_msc_struct_type::max_lun
uint32_t max_lun
Definition cdc_msc_class.h:265
cbw_type::dCBWTage
uint32_t dCBWTage
Definition cdc_msc_class.h:190
cbw_type::dCBWSignature
uint32_t dCBWSignature
Definition cdc_msc_class.h:189
cdc_msc_struct_type::bot_status
uint8_t bot_status
Definition cdc_msc_class.h:264
cbw_type::bmCBWFlags
uint8_t bmCBWFlags
Definition cdc_msc_class.h:192
USBD_MSC_BULK_IN_EPT
#define USBD_MSC_BULK_IN_EPT
Definition cdc_msc_class.h:56
USBD_MSC_BULK_OUT_EPT
#define USBD_MSC_BULK_OUT_EPT
Definition cdc_msc_class.h:57
bot_scsi_format_capacity
usb_sts_type bot_scsi_format_capacity(void *udev, uint8_t lun)
bulk-only transport scsi command format capacity
Definition composite_cdc_msc/msc_bot_scsi.c:504
bot_scsi_datain_handler
void bot_scsi_datain_handler(void *udev, uint8_t ept_num)
bulk-only transport data in handler
Definition composite_cdc_msc/msc_bot_scsi.c:143
bot_scsi_start_stop
usb_sts_type bot_scsi_start_stop(void *udev, uint8_t lun)
bulk-only transport scsi command start stop
Definition composite_cdc_msc/msc_bot_scsi.c:409
bot_scsi_request_sense
usb_sts_type bot_scsi_request_sense(void *udev, uint8_t lun)
bulk-only transport scsi command request sense
Definition composite_cdc_msc/msc_bot_scsi.c:539
bot_scsi_read10
usb_sts_type bot_scsi_read10(void *udev, uint8_t lun)
bulk-only transport scsi command read10
Definition composite_cdc_msc/msc_bot_scsi.c:598
bot_scsi_check_address
usb_sts_type bot_scsi_check_address(void *udev, uint8_t lun, uint32_t blk_offset, uint32_t blk_count)
check address
Definition composite_cdc_msc/msc_bot_scsi.c:303
bot_scsi_write10
usb_sts_type bot_scsi_write10(void *udev, uint8_t lun)
bulk-only transport scsi command write10
Definition composite_cdc_msc/msc_bot_scsi.c:659
bot_scsi_reset
void bot_scsi_reset(void *udev)
reset bulk-only transport and scsi
Definition composite_cdc_msc/msc_bot_scsi.c:125
bot_scsi_mode_sense10
usb_sts_type bot_scsi_mode_sense10(void *udev, uint8_t lun)
bulk-only transport scsi command mode sense10
Definition composite_cdc_msc/msc_bot_scsi.c:457
bot_scsi_sense_code
void bot_scsi_sense_code(void *udev, uint8_t sense_key, uint8_t asc)
send scsi sense code
Definition composite_cdc_msc/msc_bot_scsi.c:288
bot_cbw_decode
void bot_cbw_decode(void *udev)
bulk-only cbw decode
Definition composite_cdc_msc/msc_bot_scsi.c:196
bot_scsi_verify
usb_sts_type bot_scsi_verify(void *udev, uint8_t lun)
bulk-only transport scsi command verify
Definition composite_cdc_msc/msc_bot_scsi.c:570
bot_scsi_allow_medium_removal
usb_sts_type bot_scsi_allow_medium_removal(void *udev, uint8_t lun)
bulk-only transport scsi command meidum removal
Definition composite_cdc_msc/msc_bot_scsi.c:423
ALIGNED_TAIL
ALIGNED_HEAD uint8_t page00_inquiry_data[] ALIGNED_TAIL
Definition composite_cdc_msc/msc_bot_scsi.c:45
bot_scsi_init
void bot_scsi_init(void *udev)
initialize bulk-only transport and scsi
Definition composite_cdc_msc/msc_bot_scsi.c:103
bot_scsi_cmd_process
usb_sts_type bot_scsi_cmd_process(void *udev)
bulk-only transport scsi command process
Definition composite_cdc_msc/msc_bot_scsi.c:749
bot_scsi_dataout_handler
void bot_scsi_dataout_handler(void *udev, uint8_t ept_num)
bulk-only transport data out handler
Definition composite_cdc_msc/msc_bot_scsi.c:172
bot_scsi_mode_sense6
usb_sts_type bot_scsi_mode_sense6(void *udev, uint8_t lun)
bulk-only transport scsi command mode sense6
Definition composite_cdc_msc/msc_bot_scsi.c:437
bot_scsi_stall
void bot_scsi_stall(void *udev)
bot endpoint stall
Definition composite_cdc_msc/msc_bot_scsi.c:320
bot_scsi_send_data
void bot_scsi_send_data(void *udev, uint8_t *buffer, uint32_t len)
send bot data
Definition composite_cdc_msc/msc_bot_scsi.c:243
bot_scsi_test_unit
usb_sts_type bot_scsi_test_unit(void *udev, uint8_t lun)
bulk-only transport scsi command test unit
Definition composite_cdc_msc/msc_bot_scsi.c:346
bot_scsi_inquiry
usb_sts_type bot_scsi_inquiry(void *udev, uint8_t lun)
bulk-only transport scsi command inquiry
Definition composite_cdc_msc/msc_bot_scsi.c:368
bot_scsi_capacity
usb_sts_type bot_scsi_capacity(void *udev, uint8_t lun)
bulk-only transport scsi command capacity
Definition composite_cdc_msc/msc_bot_scsi.c:477
bot_scsi_clear_feature
void bot_scsi_clear_feature(void *udev, uint8_t ept_num)
clear feature
Definition composite_cdc_msc/msc_bot_scsi.c:729
bot_scsi_send_csw
void bot_scsi_send_csw(void *udev, uint8_t status)
send command status
Definition composite_cdc_msc/msc_bot_scsi.c:264
MSC_STATE_MACHINE_DATA_IN
#define MSC_STATE_MACHINE_DATA_IN
Definition cdc_msc_class.h:120
MSC_CMD_START_STOP
#define MSC_CMD_START_STOP
Definition cdc_msc_class.h:87
MSC_CMD_VERIFY
#define MSC_CMD_VERIFY
Definition cdc_msc_class.h:97
ADDRESS_OUT_OF_RANGE
#define ADDRESS_OUT_OF_RANGE
Definition cdc_msc_class.h:152
SENSE_KEY_HARDWARE_ERROR
#define SENSE_KEY_HARDWARE_ERROR
Definition cdc_msc_class.h:137
MEDIUM_NOT_PRESENT
#define MEDIUM_NOT_PRESENT
Definition cdc_msc_class.h:153
MSC_CMD_MODE_SENSE6
#define MSC_CMD_MODE_SENSE6
Definition cdc_msc_class.h:88
SCSI_INQUIRY_DATA_LENGTH
#define SCSI_INQUIRY_DATA_LENGTH
Definition cdc_msc_class.h:156
MSC_CMD_ALLOW_MEDIUM_REMOVAL
#define MSC_CMD_ALLOW_MEDIUM_REMOVAL
Definition cdc_msc_class.h:90
CSW_CMD_LENGTH
#define CSW_CMD_LENGTH
Definition cdc_msc_class.h:113
MSC_BOT_STATE_IDLE
#define MSC_BOT_STATE_IDLE
Definition cdc_msc_class.h:128
MSC_MAX_DATA_BUF_LEN
#define MSC_MAX_DATA_BUF_LEN
Definition cdc_msc_class.h:83
CSW_DCSWSIGNATURE
#define CSW_DCSWSIGNATURE
Definition cdc_msc_class.h:114
MSC_CMD_INQUIRY
#define MSC_CMD_INQUIRY
Definition cdc_msc_class.h:86
MSC_SUPPORT_MAX_LUN
#define MSC_SUPPORT_MAX_LUN
Definition cdc_msc_class.h:82
INVALID_COMMAND
#define INVALID_COMMAND
Definition cdc_msc_class.h:148
MSC_CMD_WRITE_10
#define MSC_CMD_WRITE_10
Definition cdc_msc_class.h:98
MSC_STATE_MACHINE_IDLE
#define MSC_STATE_MACHINE_IDLE
Definition cdc_msc_class.h:126
MSC_CMD_READ_FORMAT_CAPACITY
#define MSC_CMD_READ_FORMAT_CAPACITY
Definition cdc_msc_class.h:94
MSC_CMD_MODE_SENSE10
#define MSC_CMD_MODE_SENSE10
Definition cdc_msc_class.h:89
SENSE_KEY_ILLEGAL_REQUEST
#define SENSE_KEY_ILLEGAL_REQUEST
Definition cdc_msc_class.h:138
MSC_STATE_MACHINE_DATA_OUT
#define MSC_STATE_MACHINE_DATA_OUT
Definition cdc_msc_class.h:121
CSW_BCSWSTATUS_PASS
#define CSW_BCSWSTATUS_PASS
Definition cdc_msc_class.h:115
INVALID_FIELED_IN_COMMAND
#define INVALID_FIELED_IN_COMMAND
Definition cdc_msc_class.h:149
REQ_SENSE_STANDARD_DATA_LEN
#define REQ_SENSE_STANDARD_DATA_LEN
Definition cdc_msc_class.h:132
MSC_STATE_MACHINE_SEND_DATA
#define MSC_STATE_MACHINE_SEND_DATA
Definition cdc_msc_class.h:122
CBW_DCBWSIGNATURE
#define CBW_DCBWSIGNATURE
Definition cdc_msc_class.h:109
MSC_CMD_READ_10
#define MSC_CMD_READ_10
Definition cdc_msc_class.h:91
MSC_BOT_STATE_RECOVERY
#define MSC_BOT_STATE_RECOVERY
Definition cdc_msc_class.h:129
CBW_CMD_LENGTH
#define CBW_CMD_LENGTH
Definition cdc_msc_class.h:108
MSC_STATE_MACHINE_LAST_DATA
#define MSC_STATE_MACHINE_LAST_DATA
Definition cdc_msc_class.h:123
MSC_CMD_TEST_UNIT
#define MSC_CMD_TEST_UNIT
Definition cdc_msc_class.h:96
CSW_BCSWSTATUS_FAILED
#define CSW_BCSWSTATUS_FAILED
Definition cdc_msc_class.h:116
MSC_CMD_READ_CAPACITY
#define MSC_CMD_READ_CAPACITY
Definition cdc_msc_class.h:93
MSC_BOT_STATE_ERROR
#define MSC_BOT_STATE_ERROR
Definition cdc_msc_class.h:130
MSC_CMD_REQUEST_SENSE
#define MSC_CMD_REQUEST_SENSE
Definition cdc_msc_class.h:95
MIN
#define MIN(a, b)
min and max define
Definition usb_std.h:260
usb_sts_type
usb_sts_type
usb return status
Definition usb_std.h:285
USB_OK
@ USB_OK
Definition usb_std.h:286
USB_FAIL
@ USB_FAIL
Definition usb_std.h:287
usbd_set_stall
void usbd_set_stall(usbd_core_type *udev, uint8_t ept_addr)
usb set endpoint to stall.
Definition usbd_core.c:264
usbd_ept_recv
void usbd_ept_recv(usbd_core_type *udev, uint8_t ept_num, uint8_t *buffer, uint16_t len)
usb endpoint receive data
Definition usbd_core.c:364
usbd_get_recv_len
uint32_t usbd_get_recv_len(usbd_core_type *udev, uint8_t ept_addr)
usb endpoint get receive data length
Definition usbd_core.c:397
usbd_ept_send
void usbd_ept_send(usbd_core_type *udev, uint8_t ept_num, uint8_t *buffer, uint16_t len)
usb endpoint send data
Definition usbd_core.c:304
cdc_msc_struct_type
usb cdc class struct
Definition cdc_msc_class.h:252
sense_type
request sense standard data
Definition cdc_msc_class.h:213
usbd_class_handler::pdata
void * pdata
Definition usbd_core.h:107
usbd_core_type
usb device core struct type
Definition usbd_core.h:114
usbd_core_type::class_handler
usbd_class_handler * class_handler
Definition usbd_core.h:117


AT32F413 Firmwary Library: msc_diskio.h Source File

  • usb_device
  • composite_vcp_msc
  • inc
composite_vcp_msc/inc/msc_diskio.h
Go to the documentation of this file.
1
25/* Define to prevent recursive inclusion -------------------------------------*/
26#ifndef __MSC_DISKIO_H
27#define __MSC_DISKIO_H
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33
34#include "usb_conf.h"
35#include "usb_std.h"
36
44#define INTERNAL_FLASH_LUN 0
45#define SPI_FLASH_LUN 1
46#define SD_LUN 2
47
48#define USB_FLASH_ADDR_OFFSET 0x08005000
49
50#define SECTOR_SIZE_1K 1024
51#define SECTOR_SIZE_2K 2048
52#define SECTOR_SIZE_4K 4096
53
54uint8_t *get_inquiry(uint8_t lun);
55 usb_sts_type msc_disk_read(uint8_t lun, uint64_t addr, uint8_t *read_buf, uint32_t len);
56 usb_sts_type msc_disk_write(uint8_t lun, uint64_t addr, uint8_t *buf, uint32_t len);
57 usb_sts_type msc_disk_capacity(uint8_t lun, uint32_t *blk_nbr, uint32_t *blk_size);
58
67#ifdef __cplusplus
68}
69#endif
70
71#endif
72
73
msc_disk_capacity
usb_sts_type msc_disk_capacity(uint8_t lun, uint32_t *blk_nbr, uint32_t *blk_size)
disk capacity
Definition composite_vcp_msc/src/msc_diskio.c:135
get_inquiry
uint8_t * get_inquiry(uint8_t lun)
get disk inquiry
Definition composite_vcp_msc/src/msc_diskio.c:58
msc_disk_read
usb_sts_type msc_disk_read(uint8_t lun, uint64_t addr, uint8_t *read_buf, uint32_t len)
disk read
Definition composite_vcp_msc/src/msc_diskio.c:74
msc_disk_write
usb_sts_type msc_disk_write(uint8_t lun, uint64_t addr, uint8_t *buf, uint32_t len)
disk write
Definition composite_vcp_msc/src/msc_diskio.c:101
usb_sts_type
usb_sts_type
usb return status
Definition usb_std.h:285
usb_conf.h
usb config header file
usb_std.h
usb standard header file


AT32F413 Firmwary Library: msc_diskio.c Source File

  • usb_device
  • composite_vcp_msc
  • src
composite_vcp_msc/src/msc_diskio.c
Go to the documentation of this file.
1
25#include "msc_diskio.h"
26#include "cdc_msc_class.h"
27
35uint32_t sector_size = 2048;
36uint32_t msc_flash_size;
37uint8_t scsi_inquiry[MSC_SUPPORT_MAX_LUN][SCSI_INQUIRY_DATA_LENGTH] =
38{
39 /* lun = 0 */
40 {
41 0x00, /* peripheral device type (direct-access device) */
42 0x80, /* removable media bit */
43 0x00, /* ansi version, ecma version, iso version */
44 0x01, /* respond data format */
45 SCSI_INQUIRY_DATA_LENGTH - 5, /* additional length */
46 0x00, 0x00, 0x00, /* reserved */
47 'A', 'T', '3', '2', ' ', ' ', ' ', ' ', /* vendor information "AT32" */
48 'D', 'i', 's', 'k', '0', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', /* Product identification "Disk" */
49 '2', '.', '0', '0' /* product revision level */
50 }
51};
52
58uint8_t *get_inquiry(uint8_t lun)
59{
60 if(lun < MSC_SUPPORT_MAX_LUN)
61 return (uint8_t *)scsi_inquiry[lun];
62 else
63 return NULL;
64}
65
74 usb_sts_type msc_disk_read(uint8_t lun, uint64_t addr, uint8_t *read_buf, uint32_t len)
75{
76 uint32_t i = 0;
77 uint32_t flash_addr = (uint32_t)addr + USB_FLASH_ADDR_OFFSET;
78 switch(lun)
79 {
80 case 0:
81 for(i = 0; i < len; i ++)
82 {
83 read_buf[i] = *((uint8_t *)flash_addr);
84 flash_addr += 1;
85 }
86 break;
87 case 1:
88 break;
89 }
90 return USB_OK;
91}
92
101 usb_sts_type msc_disk_write(uint8_t lun, uint64_t addr, uint8_t *buf, uint32_t len)
102{
103 uint32_t flash_addr = (uint32_t)addr + USB_FLASH_ADDR_OFFSET;
104 uint32_t i = 0, page_len = 2048, tolen = len;
105 uint32_t erase_addr = flash_addr;
106 switch(lun)
107 {
108 case 0:
109 flash_unlock();
110 while(tolen >= page_len)
111 {
112 flash_sector_erase(erase_addr);
113 tolen -= page_len;
114 erase_addr += page_len;
115 }
116 for(i = 0; i < len; i ++)
117 {
118 flash_byte_program(flash_addr+i, buf[i]);
119 }
120 flash_lock();
121 break;
122 case 1:
123 break;
124 }
125 return USB_OK;
126}
127
135 usb_sts_type msc_disk_capacity(uint8_t lun, uint32_t *blk_nbr, uint32_t *blk_size)
136{
137 uint32_t flash_s = *((uint32_t *)0x1FFFF7E0);
138 msc_flash_size = (flash_s << 10) - (USB_FLASH_ADDR_OFFSET - FLASH_BASE);
139
140 if(flash_s < 256)
141 {
142 sector_size = SECTOR_SIZE_1K;
143 }
144 else
145 {
146 sector_size = SECTOR_SIZE_2K;
147 }
148
149 switch(lun)
150 {
151 case INTERNAL_FLASH_LUN:
152 *blk_nbr = msc_flash_size / sector_size;
153 *blk_size = sector_size;
154 break;
155 case SPI_FLASH_LUN:
156 break;
157 case SD_LUN:
158 break;
159 default:
160 break;
161 }
162 return USB_OK;
163}
164
cdc_msc_class.h
usb cdc class file
USB_FLASH_ADDR_OFFSET
#define USB_FLASH_ADDR_OFFSET
Definition composite_vcp_msc/inc/msc_diskio.h:48
INTERNAL_FLASH_LUN
#define INTERNAL_FLASH_LUN
Definition composite_vcp_msc/inc/msc_diskio.h:44
msc_disk_capacity
usb_sts_type msc_disk_capacity(uint8_t lun, uint32_t *blk_nbr, uint32_t *blk_size)
disk capacity
Definition composite_vcp_msc/src/msc_diskio.c:135
SECTOR_SIZE_1K
#define SECTOR_SIZE_1K
Definition composite_vcp_msc/inc/msc_diskio.h:50
msc_flash_size
uint32_t msc_flash_size
Definition composite_vcp_msc/src/msc_diskio.c:36
sector_size
uint32_t sector_size
Definition composite_vcp_msc/src/msc_diskio.c:35
SECTOR_SIZE_2K
#define SECTOR_SIZE_2K
Definition composite_vcp_msc/inc/msc_diskio.h:51
SD_LUN
#define SD_LUN
Definition composite_vcp_msc/inc/msc_diskio.h:46
scsi_inquiry
uint8_t scsi_inquiry[MSC_SUPPORT_MAX_LUN][SCSI_INQUIRY_DATA_LENGTH]
Definition composite_vcp_msc/src/msc_diskio.c:37
SPI_FLASH_LUN
#define SPI_FLASH_LUN
Definition composite_vcp_msc/inc/msc_diskio.h:45
get_inquiry
uint8_t * get_inquiry(uint8_t lun)
get disk inquiry
Definition composite_vcp_msc/src/msc_diskio.c:58
msc_disk_read
usb_sts_type msc_disk_read(uint8_t lun, uint64_t addr, uint8_t *read_buf, uint32_t len)
disk read
Definition composite_vcp_msc/src/msc_diskio.c:74
msc_disk_write
usb_sts_type msc_disk_write(uint8_t lun, uint64_t addr, uint8_t *buf, uint32_t len)
disk write
Definition composite_vcp_msc/src/msc_diskio.c:101
flash_sector_erase
flash_status_type flash_sector_erase(uint32_t sector_address)
erase a specified flash sector.
Definition at32f413_flash.c:272
flash_byte_program
flash_status_type flash_byte_program(uint32_t address, uint8_t data)
program a byte at a specified address.
Definition at32f413_flash.c:491
flash_unlock
void flash_unlock(void)
unlock the flash controller.
Definition at32f413_flash.c:228
flash_lock
void flash_lock(void)
lock the flash controller.
Definition at32f413_flash.c:251
FLASH_BASE
#define FLASH_BASE
Definition at32f413.h:329
NULL
#define NULL
Definition emmc_card/inc/at32_sdio.h:340
SCSI_INQUIRY_DATA_LENGTH
#define SCSI_INQUIRY_DATA_LENGTH
Definition cdc_msc_class.h:156
MSC_SUPPORT_MAX_LUN
#define MSC_SUPPORT_MAX_LUN
Definition cdc_msc_class.h:82
usb_sts_type
usb_sts_type
usb return status
Definition usb_std.h:285
USB_OK
@ USB_OK
Definition usb_std.h:286


AT32F413 Firmwary Library: custom_hid_class.c Source File

  • middlewares
  • usbd_class
  • custom_hid
custom_hid_class.c
Go to the documentation of this file.
1
25#include "usbd_core.h"
26#include "custom_hid_class.h"
27#include "custom_hid_desc.h"
28
42static usb_sts_type class_init_handler(void *udev);
43static usb_sts_type class_clear_handler(void *udev);
44static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup);
45static usb_sts_type class_ept0_tx_handler(void *udev);
46static usb_sts_type class_ept0_rx_handler(void *udev);
47static usb_sts_type class_in_handler(void *udev, uint8_t ept_num);
48static usb_sts_type class_out_handler(void *udev, uint8_t ept_num);
49static usb_sts_type class_sof_handler(void *udev);
50static usb_sts_type class_event_handler(void *udev, usbd_event_type event);
51
52static void usb_hid_buf_process(void *udev, uint8_t *report, uint16_t len);
53 custom_hid_type custom_hid_struct;
54
55/* usb device class handler */
56 usbd_class_handler custom_hid_class_handler =
57{
58 class_init_handler,
59 class_clear_handler,
60 class_setup_handler,
61 class_ept0_tx_handler,
62 class_ept0_rx_handler,
63 class_in_handler,
64 class_out_handler,
65 class_sof_handler,
66 class_event_handler,
67 &custom_hid_struct
68};
69
75static usb_sts_type class_init_handler(void *udev)
76{
77 usb_sts_type status = USB_OK;
78 usbd_core_type *pudev = (usbd_core_type *)udev;
79 custom_hid_type *pcshid = (custom_hid_type *)pudev->class_handler->pdata;
80#ifndef USB_EPT_AUTO_MALLOC_BUFFER
81 /* use user define buffer address */
82 usbd_ept_buf_custom_define(pudev, USBD_CUSTOM_HID_IN_EPT, EPT1_TX_ADDR);
83 usbd_ept_buf_custom_define(pudev, USBD_CUSTOM_HID_OUT_EPT, EPT1_RX_ADDR);
84#endif
85
86 /* open custom hid in endpoint */
87 usbd_ept_open(pudev, USBD_CUSTOM_HID_IN_EPT, EPT_INT_TYPE, USBD_CUSTOM_IN_MAXPACKET_SIZE);
88
89 /* open custom hid out endpoint */
90 usbd_ept_open(pudev, USBD_CUSTOM_HID_OUT_EPT, EPT_INT_TYPE, USBD_CUSTOM_OUT_MAXPACKET_SIZE);
91
92 /* set out endpoint to receive status */
93 usbd_ept_recv(pudev, USBD_CUSTOM_HID_OUT_EPT, pcshid->g_rxhid_buff, USBD_CUSTOM_OUT_MAXPACKET_SIZE);
94
95 pcshid->send_state = 0;
96
97 return status;
98}
99
105static usb_sts_type class_clear_handler(void *udev)
106{
107 usb_sts_type status = USB_OK;
108 usbd_core_type *pudev = (usbd_core_type *)udev;
109
110 /* close custom hid in endpoint */
111 usbd_ept_close(pudev, USBD_CUSTOM_HID_IN_EPT);
112
113 /* close custom hid out endpoint */
114 usbd_ept_close(pudev, USBD_CUSTOM_HID_OUT_EPT);
115
116 return status;
117}
118
125static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
126{
127 usb_sts_type status = USB_OK;
128 usbd_core_type *pudev = (usbd_core_type *)udev;
129 custom_hid_type *pcshid = (custom_hid_type *)pudev->class_handler->pdata;
130 uint16_t len;
131 uint8_t *buf;
132
133 switch(setup->bmRequestType & USB_REQ_TYPE_RESERVED)
134 {
135 /* class request */
136 case USB_REQ_TYPE_CLASS:
137 switch(setup->bRequest)
138 {
139 case HID_REQ_SET_PROTOCOL:
140 pcshid->hid_protocol = (uint8_t)setup->wValue;
141 break;
142 case HID_REQ_GET_PROTOCOL:
143 usbd_ctrl_send(pudev, (uint8_t *)&pcshid->hid_protocol, 1);
144 break;
145 case HID_REQ_SET_IDLE:
146 pcshid->hid_set_idle = (uint8_t)(setup->wValue >> 8);
147 break;
148 case HID_REQ_GET_IDLE:
149 usbd_ctrl_send(pudev, (uint8_t *)&pcshid->hid_set_idle, 1);
150 break;
151 case HID_REQ_SET_REPORT:
152 pcshid->hid_state = HID_REQ_SET_REPORT;
153 usbd_ctrl_recv(pudev, pcshid->hid_set_report, setup->wLength);
154 break;
155 case HID_REQ_GET_REPORT:
156 usbd_ctrl_send(pudev, pcshid->hid_get_report, setup->wLength);
157 break;
158 default:
159 usbd_ctrl_unsupport(pudev);
160 break;
161 }
162 break;
163 /* standard request */
164 case USB_REQ_TYPE_STANDARD:
165 switch(setup->bRequest)
166 {
167 case USB_STD_REQ_GET_DESCRIPTOR:
168 if(setup->wValue >> 8 == HID_REPORT_DESC)
169 {
170 len = MIN(USBD_CUSHID_SIZ_REPORT_DESC, setup->wLength);
171 buf = (uint8_t *)g_usbd_custom_hid_report;
172 usbd_ctrl_send(pudev, (uint8_t *)buf, len);
173 }
174 else if(setup->wValue >> 8 == HID_DESCRIPTOR_TYPE)
175 {
176 len = MIN(9, setup->wLength);
177 buf = (uint8_t *)g_custom_hid_usb_desc;
178 usbd_ctrl_send(pudev, (uint8_t *)buf, len);
179 }
180 else
181 {
182 usbd_ctrl_unsupport(pudev);
183 }
184 break;
185 case USB_STD_REQ_GET_INTERFACE:
186 usbd_ctrl_send(pudev, (uint8_t *)&pcshid->alt_setting, 1);
187 break;
188 case USB_STD_REQ_SET_INTERFACE:
189 pcshid->alt_setting = setup->wValue;
190 break;
191 case USB_STD_REQ_CLEAR_FEATURE:
192 break;
193 case USB_STD_REQ_SET_FEATURE:
194 break;
195 default:
196 usbd_ctrl_unsupport(pudev);
197 break;
198 }
199 break;
200 default:
201 usbd_ctrl_unsupport(pudev);
202 break;
203 }
204 return status;
205}
206
212static usb_sts_type class_ept0_tx_handler(void *udev)
213{
214 usb_sts_type status = USB_OK;
215
216 /* ...user code... */
217
218 return status;
219}
220
226static usb_sts_type class_ept0_rx_handler(void *udev)
227{
228 usb_sts_type status = USB_OK;
229 usbd_core_type *pudev = (usbd_core_type *)udev;
230 custom_hid_type *pcshid = (custom_hid_type *)pudev->class_handler->pdata;
231 uint32_t recv_len = usbd_get_recv_len(pudev, 0);
232 /* ...user code... */
233 if( pcshid->hid_state == HID_REQ_SET_REPORT)
234 {
235 /* hid buffer process */
236 usb_hid_buf_process(udev, pcshid->hid_set_report, recv_len);
237 pcshid->hid_state = 0;
238 }
239
240 return status;
241}
242
249static usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
250{
251 usb_sts_type status = USB_OK;
252 usbd_core_type *pudev = (usbd_core_type *)udev;
253 custom_hid_type *pcshid = (custom_hid_type *)pudev->class_handler->pdata;
254
255 pcshid->send_state = 0;
256 /* ...user code...
257 trans next packet data
258 */
259
260 return status;
261}
262
269static usb_sts_type class_out_handler(void *udev, uint8_t ept_num)
270{
271 usb_sts_type status = USB_OK;
272 usbd_core_type *pudev = (usbd_core_type *)udev;
273 custom_hid_type *pcshid = (custom_hid_type *)pudev->class_handler->pdata;
274
275 /* get endpoint receive data length */
276 uint32_t recv_len = usbd_get_recv_len(pudev, ept_num);
277
278 /* hid buffer process */
279 usb_hid_buf_process(udev, pcshid->g_rxhid_buff, recv_len);
280
281 /* start receive next packet */
282 usbd_ept_recv(pudev, USBD_CUSTOM_HID_OUT_EPT, pcshid->g_rxhid_buff, recv_len);
283
284 return status;
285}
286
292static usb_sts_type class_sof_handler(void *udev)
293{
294 usb_sts_type status = USB_OK;
295
296 /* ...user code... */
297
298 return status;
299}
300
307static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
308{
309 usb_sts_type status = USB_OK;
310 switch(event)
311 {
312 case USBD_RESET_EVENT:
313
314 /* ...user code... */
315
316 break;
317 case USBD_SUSPEND_EVENT:
318
319 /* ...user code... */
320
321 break;
322 case USBD_WAKEUP_EVENT:
323 /* ...user code... */
324
325 break;
326 default:
327 break;
328 }
329 return status;
330}
331
339 usb_sts_type custom_hid_class_send_report(void *udev, uint8_t *report, uint16_t len)
340{
341 usb_sts_type status = USB_FAIL;
342 usbd_core_type *pudev = (usbd_core_type *)udev;
343 custom_hid_type *pcshid = (custom_hid_type *)pudev->class_handler->pdata;
344
345 if(usbd_connect_state_get(pudev) == USB_CONN_STATE_CONFIGURED && pcshid->send_state == 0)
346 {
347 pcshid->send_state = 1;
348 usbd_ept_send(pudev, USBD_CUSTOM_HID_IN_EPT, report, len);
349 status = USB_OK;
350 }
351 return status;
352}
353
361static void usb_hid_buf_process(void *udev, uint8_t *report, uint16_t len)
362{
363 uint32_t i_index;
364 usbd_core_type *pudev = (usbd_core_type *)udev;
365 custom_hid_type *pcshid = (custom_hid_type *)pudev->class_handler->pdata;
366
367 switch(report[0])
368 {
369 case HID_REPORT_ID_2:
370 if(pcshid->g_rxhid_buff[1] == 0)
371 {
372 at32_led_off(LED2);
373 }
374 else
375 {
376 at32_led_on(LED2);
377 }
378 break;
379 case HID_REPORT_ID_3:
380 if(pcshid->g_rxhid_buff[1] == 0)
381 {
382 at32_led_off(LED3);
383 }
384 else
385 {
386 at32_led_on(LED3);
387 }
388 break;
389 case HID_REPORT_ID_4:
390 if(pcshid->g_rxhid_buff[1] == 0)
391 {
392 at32_led_off(LED4);
393 }
394 else
395 {
396 at32_led_on(LED4);
397 }
398 break;
399 case HID_REPORT_ID_6:
400 for(i_index = 0; i_index < len; i_index ++)
401 {
402 pcshid->g_txhid_buff[i_index] = report[i_index];
403 }
404 custom_hid_class_send_report(pudev, pcshid->g_txhid_buff, len);
405 break;
406 default:
407 break;
408 }
409
410}
411
custom_hid_class.h
usb custom hid header file
custom_hid_desc.h
usb custom hid descriptor header file
EPT1_RX_ADDR
#define EPT1_RX_ADDR
Definition project/at_start_f413/examples/acc/calibration/inc/usb_conf.h:77
EPT1_TX_ADDR
#define EPT1_TX_ADDR
Definition project/at_start_f413/examples/acc/calibration/inc/usb_conf.h:76
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
at32_led_off
void at32_led_off(led_type led)
turns selected led off.
Definition at32f413_board.c:287
HID_REPORT_ID_2
#define HID_REPORT_ID_2
Definition audio_hid_desc.h:222
HID_REPORT_ID_4
#define HID_REPORT_ID_4
Definition audio_hid_desc.h:224
HID_REPORT_ID_6
#define HID_REPORT_ID_6
Definition audio_hid_desc.h:226
HID_REPORT_ID_3
#define HID_REPORT_ID_3
Definition audio_hid_desc.h:223
USBD_CUSTOM_IN_MAXPACKET_SIZE
#define USBD_CUSTOM_IN_MAXPACKET_SIZE
usb custom hid in and out max packet size define
Definition custom_hid_class.h:58
USBD_CUSTOM_HID_IN_EPT
#define USBD_CUSTOM_HID_IN_EPT
usb custom hid use endpoint define
Definition custom_hid_class.h:52
USBD_CUSTOM_OUT_MAXPACKET_SIZE
#define USBD_CUSTOM_OUT_MAXPACKET_SIZE
Definition custom_hid_class.h:59
USBD_CUSTOM_HID_OUT_EPT
#define USBD_CUSTOM_HID_OUT_EPT
Definition custom_hid_class.h:53
class_sof_handler
static usb_sts_type class_sof_handler(void *udev)
usb device class sof handler
Definition custom_hid_class.c:292
class_in_handler
static usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
usb device class transmision complete handler
Definition custom_hid_class.c:249
class_clear_handler
static usb_sts_type class_clear_handler(void *udev)
clear endpoint or other state
Definition custom_hid_class.c:105
class_setup_handler
static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
usb device class setup request handler
Definition custom_hid_class.c:125
class_ept0_tx_handler
static usb_sts_type class_ept0_tx_handler(void *udev)
usb device class endpoint 0 in status stage complete
Definition custom_hid_class.c:212
custom_hid_class_send_report
usb_sts_type custom_hid_class_send_report(void *udev, uint8_t *report, uint16_t len)
usb device class send report
Definition custom_hid_class.c:339
class_ept0_rx_handler
static usb_sts_type class_ept0_rx_handler(void *udev)
usb device class endpoint 0 out status stage complete
Definition custom_hid_class.c:226
class_event_handler
static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
usb device class event handler
Definition custom_hid_class.c:307
usb_hid_buf_process
static void usb_hid_buf_process(void *udev, uint8_t *report, uint16_t len)
usb device class report function
Definition custom_hid_class.c:361
class_init_handler
static usb_sts_type class_init_handler(void *udev)
initialize usb endpoint
Definition custom_hid_class.c:75
class_out_handler
static usb_sts_type class_out_handler(void *udev, uint8_t ept_num)
usb device class endpoint receive data
Definition custom_hid_class.c:269
custom_hid_class_handler
usbd_class_handler custom_hid_class_handler
Definition custom_hid_class.c:56
custom_hid_struct
custom_hid_type custom_hid_struct
Definition custom_hid_class.c:53
USBD_CUSHID_SIZ_REPORT_DESC
#define USBD_CUSHID_SIZ_REPORT_DESC
Definition custom_hid_desc.h:65
g_usbd_custom_hid_report
uint8_t g_usbd_custom_hid_report[126]
g_custom_hid_usb_desc
uint8_t g_custom_hid_usb_desc[9]
EPT_INT_TYPE
@ EPT_INT_TYPE
Definition at32f413_usb.h:205
USB_STD_REQ_CLEAR_FEATURE
#define USB_STD_REQ_CLEAR_FEATURE
Definition usb_std.h:77
HID_REQ_GET_REPORT
#define HID_REQ_GET_REPORT
Definition usb_std.h:241
HID_DESCRIPTOR_TYPE
#define HID_DESCRIPTOR_TYPE
Definition usb_std.h:242
HID_REQ_GET_PROTOCOL
#define HID_REQ_GET_PROTOCOL
Definition usb_std.h:237
MIN
#define MIN(a, b)
min and max define
Definition usb_std.h:260
USB_REQ_TYPE_STANDARD
#define USB_REQ_TYPE_STANDARD
usb request type
Definition usb_std.h:62
USB_STD_REQ_GET_DESCRIPTOR
#define USB_STD_REQ_GET_DESCRIPTOR
Definition usb_std.h:80
HID_REQ_SET_PROTOCOL
#define HID_REQ_SET_PROTOCOL
usb hid class request code define
Definition usb_std.h:236
HID_REPORT_DESC
#define HID_REPORT_DESC
Definition usb_std.h:243
USB_STD_REQ_SET_FEATURE
#define USB_STD_REQ_SET_FEATURE
Definition usb_std.h:78
HID_REQ_SET_IDLE
#define HID_REQ_SET_IDLE
Definition usb_std.h:238
HID_REQ_GET_IDLE
#define HID_REQ_GET_IDLE
Definition usb_std.h:239
HID_REQ_SET_REPORT
#define HID_REQ_SET_REPORT
Definition usb_std.h:240
USB_STD_REQ_SET_INTERFACE
#define USB_STD_REQ_SET_INTERFACE
Definition usb_std.h:85
USB_REQ_TYPE_RESERVED
#define USB_REQ_TYPE_RESERVED
Definition usb_std.h:65
USB_STD_REQ_GET_INTERFACE
#define USB_STD_REQ_GET_INTERFACE
Definition usb_std.h:84
USB_REQ_TYPE_CLASS
#define USB_REQ_TYPE_CLASS
Definition usb_std.h:63
USB_CONN_STATE_CONFIGURED
@ USB_CONN_STATE_CONFIGURED
Definition usb_std.h:137
usb_sts_type
usb_sts_type
usb return status
Definition usb_std.h:285
USB_OK
@ USB_OK
Definition usb_std.h:286
USB_FAIL
@ USB_FAIL
Definition usb_std.h:287
usbd_connect_state_get
usbd_conn_state usbd_connect_state_get(usbd_core_type *udev)
get usb connect state
Definition usbd_core.c:595
usbd_ept_close
void usbd_ept_close(usbd_core_type *udev, uint8_t ept_addr)
usb close endpoint
Definition usbd_core.c:541
usbd_ept_recv
void usbd_ept_recv(usbd_core_type *udev, uint8_t ept_num, uint8_t *buffer, uint16_t len)
usb endpoint receive data
Definition usbd_core.c:364
usbd_ept_buf_custom_define
void usbd_ept_buf_custom_define(usbd_core_type *udev, uint8_t ept_addr, uint32_t addr)
usb custom define endpoint buffer
Definition usbd_core.c:464
usbd_ept_open
void usbd_ept_open(usbd_core_type *udev, uint8_t ept_addr, uint8_t ept_type, uint16_t maxpacket)
usb open endpoint
Definition usbd_core.c:506
usbd_ctrl_send
void usbd_ctrl_send(usbd_core_type *udev, uint8_t *buffer, uint16_t len)
usb control endpoint send data
Definition usbd_core.c:175
usbd_get_recv_len
uint32_t usbd_get_recv_len(usbd_core_type *udev, uint8_t ept_addr)
usb endpoint get receive data length
Definition usbd_core.c:397
usbd_ctrl_recv
void usbd_ctrl_recv(usbd_core_type *udev, uint8_t *buffer, uint16_t len)
usb control endpoint receive data
Definition usbd_core.c:194
usbd_ctrl_unsupport
void usbd_ctrl_unsupport(usbd_core_type *udev)
un-support device request
Definition usbd_core.c:289
usbd_ept_send
void usbd_ept_send(usbd_core_type *udev, uint8_t ept_num, uint8_t *buffer, uint16_t len)
usb endpoint send data
Definition usbd_core.c:304
usbd_event_type
usbd_event_type
usb device event
Definition usbd_core.h:54
USBD_SUSPEND_EVENT
@ USBD_SUSPEND_EVENT
Definition usbd_core.h:57
USBD_RESET_EVENT
@ USBD_RESET_EVENT
Definition usbd_core.h:56
USBD_WAKEUP_EVENT
@ USBD_WAKEUP_EVENT
Definition usbd_core.h:58
custom_hid_type
Definition custom_hid_class.h:70
custom_hid_type::g_txhid_buff
uint8_t g_txhid_buff[0x40]
Definition custom_hid_class.h:72
custom_hid_type::alt_setting
uint32_t alt_setting
Definition custom_hid_class.h:76
custom_hid_type::hid_set_report
uint8_t hid_set_report[64]
Definition custom_hid_class.h:78
custom_hid_type::g_rxhid_buff
uint8_t g_rxhid_buff[0x40]
Definition custom_hid_class.h:71
custom_hid_type::hid_set_idle
uint32_t hid_set_idle
Definition custom_hid_class.h:75
custom_hid_type::hid_protocol
uint32_t hid_protocol
Definition custom_hid_class.h:74
custom_hid_type::hid_state
uint8_t hid_state
Definition custom_hid_class.h:80
custom_hid_type::send_state
uint8_t send_state
Definition custom_hid_class.h:81
custom_hid_type::hid_get_report
uint8_t hid_get_report[64]
Definition custom_hid_class.h:79
usb_setup_type
format of usb setup data
Definition usb_std.h:297
usb_setup_type::wValue
uint16_t wValue
Definition usb_std.h:300
usb_setup_type::wLength
uint16_t wLength
Definition usb_std.h:303
usb_setup_type::bmRequestType
uint8_t bmRequestType
Definition usb_std.h:298
usb_setup_type::bRequest
uint8_t bRequest
Definition usb_std.h:299
usbd_class_handler
usb device class handler
Definition usbd_core.h:97
usbd_class_handler::pdata
void * pdata
Definition usbd_core.h:107
usbd_core_type
usb device core struct type
Definition usbd_core.h:114
usbd_core_type::class_handler
usbd_class_handler * class_handler
Definition usbd_core.h:117
usbd_core.h
usb device core header file


AT32F413 Firmwary Library: custom_hid_class.h Source File

  • middlewares
  • usbd_class
  • custom_hid
custom_hid_class.h
Go to the documentation of this file.
1
26 /* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __CUSTOM_HID_CLASS_H
28#define __CUSTOM_HID_CLASS_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "usb_std.h"
35#include "usbd_core.h"
36
52#define USBD_CUSTOM_HID_IN_EPT 0x81
53#define USBD_CUSTOM_HID_OUT_EPT 0x01
54
58#define USBD_CUSTOM_IN_MAXPACKET_SIZE 0x40
59#define USBD_CUSTOM_OUT_MAXPACKET_SIZE 0x40
60
69typedef struct
70{
71 uint8_t g_rxhid_buff[USBD_CUSTOM_OUT_MAXPACKET_SIZE];
72 uint8_t g_txhid_buff[USBD_CUSTOM_IN_MAXPACKET_SIZE];
73
74 uint32_t hid_protocol;
75 uint32_t hid_set_idle;
76 uint32_t alt_setting;
77
78 uint8_t hid_set_report[64];
79 uint8_t hid_get_report[64];
80 uint8_t hid_state;
81 uint8_t send_state;
82}custom_hid_type;
83
91extern usbd_class_handler custom_hid_class_handler;
92 usb_sts_type custom_hid_class_send_report(void *udev, uint8_t *report, uint16_t len);
104#ifdef __cplusplus
105}
106#endif
107
108#endif
USBD_CUSTOM_IN_MAXPACKET_SIZE
#define USBD_CUSTOM_IN_MAXPACKET_SIZE
usb custom hid in and out max packet size define
Definition custom_hid_class.h:58
USBD_CUSTOM_OUT_MAXPACKET_SIZE
#define USBD_CUSTOM_OUT_MAXPACKET_SIZE
Definition custom_hid_class.h:59
custom_hid_class_send_report
usb_sts_type custom_hid_class_send_report(void *udev, uint8_t *report, uint16_t len)
usb device class send report
Definition custom_hid_class.c:339
custom_hid_class_handler
usbd_class_handler custom_hid_class_handler
Definition custom_hid_class.c:56
usb_sts_type
usb_sts_type
usb return status
Definition usb_std.h:285
custom_hid_type
Definition custom_hid_class.h:70
custom_hid_type::alt_setting
uint32_t alt_setting
Definition custom_hid_class.h:76
custom_hid_type::hid_set_idle
uint32_t hid_set_idle
Definition custom_hid_class.h:75
custom_hid_type::hid_protocol
uint32_t hid_protocol
Definition custom_hid_class.h:74
custom_hid_type::hid_state
uint8_t hid_state
Definition custom_hid_class.h:80
custom_hid_type::send_state
uint8_t send_state
Definition custom_hid_class.h:81
usbd_class_handler
usb device class handler
Definition usbd_core.h:97
usb_std.h
usb standard header file
usbd_core.h
usb device core header file


AT32F413 Firmwary Library: custom_hid_desc.c Source File

  • middlewares
  • usbd_class
  • custom_hid
custom_hid_desc.c
Go to the documentation of this file.
1
25#include "usb_std.h"
26#include "usbd_sdr.h"
27#include "usbd_core.h"
28#include "custom_hid_desc.h"
29
42static usbd_desc_t *get_device_descriptor(void);
43static usbd_desc_t *get_device_qualifier(void);
44static usbd_desc_t *get_device_configuration(void);
45static usbd_desc_t *get_device_other_speed(void);
46static usbd_desc_t *get_device_lang_id(void);
47static usbd_desc_t *get_device_manufacturer_string(void);
48static usbd_desc_t *get_device_product_string(void);
49static usbd_desc_t *get_device_serial_string(void);
50static usbd_desc_t *get_device_interface_string(void);
51static usbd_desc_t *get_device_config_string(void);
52
53static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf);
54static void usbd_int_to_unicode (uint32_t value , uint8_t *pbuf , uint8_t len);
55static void get_serial_num(void);
56#if defined ( __ICCARM__ ) /* iar compiler */
57 #pragma data_alignment=4
58#endif
59ALIGNED_HEAD static uint8_t g_usbd_desc_buffer[256] ALIGNED_TAIL;
60
64 usbd_desc_handler custom_hid_desc_handler =
65{
66 get_device_descriptor,
67 get_device_qualifier,
68 get_device_configuration,
69 get_device_other_speed,
70 get_device_lang_id,
71 get_device_manufacturer_string,
72 get_device_product_string,
73 get_device_serial_string,
74 get_device_interface_string,
75 get_device_config_string,
76};
77
81#if defined ( __ICCARM__ ) /* iar compiler */
82 #pragma data_alignment=4
83#endif
84ALIGNED_HEAD static uint8_t g_usbd_descriptor[USB_DEVICE_DESC_LEN] ALIGNED_TAIL =
85{
86 USB_DEVICE_DESC_LEN, /* bLength */
87 USB_DESCIPTOR_TYPE_DEVICE, /* bDescriptorType */
88 0x00, /* bcdUSB */
89 0x02,
90 0x00, /* bDeviceClass */
91 0x00, /* bDeviceSubClass */
92 0x00, /* bDeviceProtocol */
93 USB_MAX_EP0_SIZE, /* bMaxPacketSize */
94 LBYTE(USBD_CUSHID_VENDOR_ID), /* idVendor */
95 HBYTE(USBD_CUSHID_VENDOR_ID), /* idVendor */
96 LBYTE(USBD_CUSHID_PRODUCT_ID), /* idProduct */
97 HBYTE(USBD_CUSHID_PRODUCT_ID), /* idProduct */
98 0x00, /* bcdDevice rel. 2.00 */
99 0x02,
100 USB_MFC_STRING, /* Index of manufacturer string */
101 USB_PRODUCT_STRING, /* Index of product string */
102 USB_SERIAL_STRING, /* Index of serial number string */
103 1 /* bNumConfigurations */
104};
105
109#if defined ( __ICCARM__ ) /* iar compiler */
110 #pragma data_alignment=4
111#endif
112ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_CUSHID_CONFIG_DESC_SIZE] ALIGNED_TAIL =
113{
114 USB_DEVICE_CFG_DESC_LEN, /* bLength: configuration descriptor size */
115 USB_DESCIPTOR_TYPE_CONFIGURATION, /* bDescriptorType: configuration */
116 LBYTE(USBD_CUSHID_CONFIG_DESC_SIZE), /* wTotalLength: bytes returned */
117 HBYTE(USBD_CUSHID_CONFIG_DESC_SIZE), /* wTotalLength: bytes returned */
118 0x01, /* bNumInterfaces: 1 interface */
119 0x01, /* bConfigurationValue: configuration value */
120 0x00, /* iConfiguration: index of string descriptor describing
121 the configuration */
122 0xC0, /* bmAttributes: self powered */
123 0x32, /* MaxPower 100 mA: this current is used for detecting vbus */
124
125 USB_DEVICE_IF_DESC_LEN, /* bLength: interface descriptor size */
126 USB_DESCIPTOR_TYPE_INTERFACE, /* bDescriptorType: interface descriptor type */
127 0x00, /* bInterfaceNumber: number of interface */
128 0x00, /* bAlternateSetting: alternate set */
129 0x02, /* bNumEndpoints: number of endpoints */
130 USB_CLASS_CODE_HID, /* bInterfaceClass: class code hid */
131 0x00, /* bInterfaceSubClass: subclass code */
132 0x00, /* bInterfaceProtocol: protocol code */
133 0x00, /* iInterface: index of string descriptor */
134
135 0x09, /* bLength: size of HID descriptor in bytes */
136 HID_CLASS_DESC_HID, /* bDescriptorType: HID descriptor type */
137 LBYTE(CUSHID_BCD_NUM),
138 HBYTE(CUSHID_BCD_NUM), /* bcdHID: HID class specification release number */
139 0x00, /* bCountryCode: hardware target conutry */
140 0x01, /* bNumDescriptors: number of HID class descriptor to follow */
141 HID_CLASS_DESC_REPORT, /* bDescriptorType: report descriptor type */
142 LBYTE(sizeof(g_usbd_custom_hid_report)),
143 HBYTE(sizeof(g_usbd_custom_hid_report)), /* wDescriptorLength: total length of reprot descriptor */
144
145 USB_DEVICE_EPT_LEN, /* bLength: size of endpoint descriptor in bytes */
146 USB_DESCIPTOR_TYPE_ENDPOINT, /* bDescriptorType: endpoint descriptor type */
147 USBD_CUSTOM_HID_IN_EPT, /* bEndpointAddress: the address of endpoint on usb device described by this descriptor */
148 USB_EPT_DESC_INTERRUPT, /* bmAttributes: endpoint attributes */
149 LBYTE(USBD_CUSTOM_IN_MAXPACKET_SIZE),
150 HBYTE(USBD_CUSTOM_IN_MAXPACKET_SIZE), /* wMaxPacketSize: maximum packe size this endpoint */
151 CUSHID_BINTERVAL_TIME, /* bInterval: interval for polling endpoint for data transfers */
152
153 USB_DEVICE_EPT_LEN, /* bLength: size of endpoint descriptor in bytes */
154 USB_DESCIPTOR_TYPE_ENDPOINT, /* bDescriptorType: endpoint descriptor type */
155 USBD_CUSTOM_HID_OUT_EPT, /* bEndpointAddress: the address of endpoint on usb device described by this descriptor */
156 USB_EPT_DESC_INTERRUPT, /* bmAttributes: endpoint attributes */
157 LBYTE(USBD_CUSTOM_OUT_MAXPACKET_SIZE),
158 HBYTE(USBD_CUSTOM_OUT_MAXPACKET_SIZE), /* wMaxPacketSize: maximum packe size this endpoint */
159 CUSHID_BINTERVAL_TIME, /* bInterval: interval for polling endpoint for data transfers */
160};
161
165#if defined ( __ICCARM__ ) /* iar compiler */
166 #pragma data_alignment=4
167#endif
168ALIGNED_HEAD uint8_t g_usbd_custom_hid_report[USBD_CUSHID_SIZ_REPORT_DESC] ALIGNED_TAIL =
169{
170 0x06, 0xFF, 0x00, /* USAGE_PAGE(Vendor Page:0xFF00) */
171 0x09, 0x01, /* USAGE (Demo Kit) */
172 0xa1, 0x01, /* COLLECTION (Application) */
173 /* 7 */
174
175 /* Led 2 */
176 0x85, HID_REPORT_ID_2, /* REPORT_ID 2 */
177 0x09, 0x02, /* USAGE (LED 2) */
178 0x15, 0x00, /* LOGICAL_MINIMUM (0) */
179 0x25, 0x01, /* LOGICAL_MAXIMUM (1) */
180 0x75, 0x08, /* REPORT_SIZE (8) */
181 0x95, 0x3F, /* REPORT_COUNT (1) */
182 0xB1, 0x82, /* FEATURE (Data,Var,Abs,Vol) */
183
184 0x85, 0x02, /* REPORT_ID (2) */
185 0x09, 0x02, /* USAGE (LED 2) */
186 0x91, 0x82, /* OUTPUT (Data,Var,Abs,Vol) */
187 /* 27 */
188
189 /* Led 3 */
190 0x85, HID_REPORT_ID_3, /* REPORT_ID (3) */
191 0x09, 0x03, /* USAGE (LED 3) */
192 0x15, 0x00, /* LOGICAL_MINIMUM (0) */
193 0x25, 0x01, /* LOGICAL_MAXIMUM (1) */
194 0x75, 0x08, /* REPORT_SIZE (8) */
195 0x95, 0x3F, /* REPORT_COUNT (1) */
196 0xB1, 0x82, /* FEATURE (Data,Var,Abs,Vol) */
197
198 0x85, 0x03, /* REPORT_ID (3) */
199 0x09, 0x03, /* USAGE (LED 3) */
200 0x91, 0x82, /* OUTPUT (Data,Var,Abs,Vol) */
201 /* 47 */
202
203 /* Led 4 */
204 0x85, HID_REPORT_ID_4, /* REPORT_ID 4) */
205 0x09, 0x04, /* USAGE (LED 4) */
206 0x15, 0x00, /* LOGICAL_MINIMUM (0) */
207 0x25, 0x01, /* LOGICAL_MAXIMUM (1) */
208 0x75, 0x08, /* REPORT_SIZE (8) */
209 0x95, 0x3F, /* REPORT_COUNT (1) */
210 0xB1, 0x82, /* FEATURE (Data,Var,Abs,Vol) */
211
212 0x85, 0x04, /* REPORT_ID (4) */
213 0x09, 0x04, /* USAGE (LED 4) */
214 0x91, 0x82, /* OUTPUT (Data,Var,Abs,Vol) */
215 /* 67 */
216
217 /* key Push Button */
218 0x85, HID_REPORT_ID_5, /* REPORT_ID (5) */
219 0x09, 0x05, /* USAGE (Push Button) */
220 0x15, 0x00, /* LOGICAL_MINIMUM (0) */
221 0x25, 0x01, /* LOGICAL_MAXIMUM (1) */
222 0x75, 0x01, /* REPORT_SIZE (1) */
223 0x81, 0x82, /* INPUT (Data,Var,Abs,Vol) */
224
225 0x09, 0x05, /* USAGE (Push Button) */
226 0x75, 0x01, /* REPORT_SIZE (1) */
227 0xb1, 0x82, /* FEATURE (Data,Var,Abs,Vol) */
228
229 0x75, 0x07, /* REPORT_SIZE (7) */
230 0x81, 0x83, /* INPUT (Cnst,Var,Abs,Vol) */
231 0x85, 0x05, /* REPORT_ID (5) */
232
233 0x75, 0x07, /* REPORT_SIZE (7) */
234 0xb1, 0x83, /* FEATURE (Cnst,Var,Abs,Vol) */
235 /* 95 */
236
237 /* Data OUT */
238 0x85, HID_REPORT_ID_6, /* REPORT_ID (0xF0) */
239 0x09, 0x06, /* USAGE */
240 0x15, 0x00, /* LOGICAL_MINIMUM (0) */
241 0x26, 0xFF,0x00, /* LOGICAL_MAXIMUM (255) */
242 0x75, 0x08, /* REPORT_SIZE (8) */
243 0x95, 0x3F, /* REPORT_COUNT (64) */
244 0x91, 0x02, /* OUTPUT(Data,Var,Abs,Vol) */
245 /* 110 */
246
247 /* Data IN */
248 0x85, HID_REPORT_ID_6, /* REPORT_ID (0xF0) */
249 0x09, 0x07, /* USAGE */
250 0x15, 0x00, /* LOGICAL_MINIMUM (0) */
251 0x26, 0xFF,0x00, /* LOGICAL_MAXIMUM (255) */
252 0x75, 0x08, /* REPORT_SIZE (8) */
253 0x95, 0x3F, /* REPORT_COUNT (64) */
254 0x81, 0x82, /* INPUT(Data,Var,Abs,Vol) */
255
256 /* 125 */
257 0xc0 /* END_COLLECTION */
258};
259
263#if defined ( __ICCARM__ ) /* iar compiler */
264 #pragma data_alignment=4
265#endif
266ALIGNED_HEAD uint8_t g_custom_hid_usb_desc[9] ALIGNED_TAIL =
267{
268 0x09, /* bLength: size of HID descriptor in bytes */
269 HID_CLASS_DESC_HID, /* bDescriptorType: HID descriptor type */
270 LBYTE(CUSHID_BCD_NUM),
271 HBYTE(CUSHID_BCD_NUM), /* bcdHID: HID class specification release number */
272 0x00, /* bCountryCode: hardware target conutry */
273 0x01, /* bNumDescriptors: number of HID class descriptor to follow */
274 HID_CLASS_DESC_REPORT, /* bDescriptorType: report descriptor type */
275 LBYTE(sizeof(g_usbd_custom_hid_report)),
276 HBYTE(sizeof(g_usbd_custom_hid_report)), /* wDescriptorLength: total length of reprot descriptor */
277};
278
279
283#if defined ( __ICCARM__ ) /* iar compiler */
284 #pragma data_alignment=4
285#endif
286ALIGNED_HEAD static uint8_t g_string_lang_id[USBD_CUSHID_SIZ_STRING_LANGID] ALIGNED_TAIL =
287{
288 USBD_CUSHID_SIZ_STRING_LANGID,
289 USB_DESCIPTOR_TYPE_STRING,
290 0x09,
291 0x04,
292};
293
297#if defined ( __ICCARM__ ) /* iar compiler */
298 #pragma data_alignment=4
299#endif
300ALIGNED_HEAD static uint8_t g_string_serial[USBD_CUSHID_SIZ_STRING_SERIAL] ALIGNED_TAIL =
301{
302 USBD_CUSHID_SIZ_STRING_SERIAL,
303 USB_DESCIPTOR_TYPE_STRING,
304};
305
306
307/* device descriptor */
308static usbd_desc_t device_descriptor =
309{
310 USB_DEVICE_DESC_LEN,
311 g_usbd_descriptor
312};
313
314/* config descriptor */
315static usbd_desc_t config_descriptor =
316{
317 USBD_CUSHID_CONFIG_DESC_SIZE,
318 g_usbd_configuration
319};
320
321/* langid descriptor */
322static usbd_desc_t langid_descriptor =
323{
324 USBD_CUSHID_SIZ_STRING_LANGID,
325 g_string_lang_id
326};
327
328/* serial descriptor */
329static usbd_desc_t serial_descriptor =
330{
331 USBD_CUSHID_SIZ_STRING_SERIAL,
332 g_string_serial
333};
334
335static usbd_desc_t vp_desc;
336
343static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf)
344{
345 uint16_t str_len = 0, id_pos = 2;
346 uint8_t *tmp_str = string;
347
348 while(*tmp_str != '\0')
349 {
350 str_len ++;
351 unicode_buf[id_pos ++] = *tmp_str ++;
352 unicode_buf[id_pos ++] = 0x00;
353 }
354
355 str_len = str_len * 2 + 2;
356 unicode_buf[0] = str_len;
357 unicode_buf[1] = USB_DESCIPTOR_TYPE_STRING;
358
359 return str_len;
360}
361
369static void usbd_int_to_unicode (uint32_t value , uint8_t *pbuf , uint8_t len)
370{
371 uint8_t idx = 0;
372
373 for( idx = 0 ; idx < len ; idx ++)
374 {
375 if( ((value >> 28)) < 0xA )
376 {
377 pbuf[ 2 * idx] = (value >> 28) + '0';
378 }
379 else
380 {
381 pbuf[2 * idx] = (value >> 28) + 'A' - 10;
382 }
383
384 value = value << 4;
385
386 pbuf[2 * idx + 1] = 0;
387 }
388}
389
395static void get_serial_num(void)
396{
397 uint32_t serial0, serial1, serial2;
398
399 serial0 = *(uint32_t*)MCU_ID1;
400 serial1 = *(uint32_t*)MCU_ID2;
401 serial2 = *(uint32_t*)MCU_ID3;
402
403 serial0 += serial2;
404
405 if (serial0 != 0)
406 {
407 usbd_int_to_unicode (serial0, &g_string_serial[2] ,8);
408 usbd_int_to_unicode (serial1, &g_string_serial[18] ,4);
409 }
410}
411
417static usbd_desc_t *get_device_descriptor(void)
418{
419 return &device_descriptor;
420}
421
427static usbd_desc_t * get_device_qualifier(void)
428{
429 return NULL;
430}
431
437static usbd_desc_t *get_device_configuration(void)
438{
439 return &config_descriptor;
440}
441
447static usbd_desc_t *get_device_other_speed(void)
448{
449 return NULL;
450}
451
457static usbd_desc_t *get_device_lang_id(void)
458{
459 return &langid_descriptor;
460}
461
462
468static usbd_desc_t *get_device_manufacturer_string(void)
469{
470 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_CUSHID_DESC_MANUFACTURER_STRING, g_usbd_desc_buffer);
471 vp_desc.descriptor = g_usbd_desc_buffer;
472 return &vp_desc;
473}
474
480static usbd_desc_t *get_device_product_string(void)
481{
482 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_CUSHID_DESC_PRODUCT_STRING, g_usbd_desc_buffer);
483 vp_desc.descriptor = g_usbd_desc_buffer;
484 return &vp_desc;
485}
486
492static usbd_desc_t *get_device_serial_string(void)
493{
494 get_serial_num();
495 return &serial_descriptor;
496}
497
503static usbd_desc_t *get_device_interface_string(void)
504{
505 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_CUSHID_DESC_INTERFACE_STRING, g_usbd_desc_buffer);
506 vp_desc.descriptor = g_usbd_desc_buffer;
507 return &vp_desc;
508}
509
515static usbd_desc_t *get_device_config_string(void)
516{
517 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_CUSHID_DESC_CONFIGURATION_STRING, g_usbd_desc_buffer);
518 vp_desc.descriptor = g_usbd_desc_buffer;
519 return &vp_desc;
520}
521
custom_hid_desc.h
usb custom hid descriptor header file
NULL
#define NULL
Definition emmc_card/inc/at32_sdio.h:340
MCU_ID1
#define MCU_ID1
Definition audio_desc.h:214
MCU_ID2
#define MCU_ID2
Definition audio_desc.h:215
MCU_ID3
#define MCU_ID3
Definition audio_desc.h:216
HID_REPORT_ID_2
#define HID_REPORT_ID_2
Definition audio_hid_desc.h:222
HID_REPORT_ID_4
#define HID_REPORT_ID_4
Definition audio_hid_desc.h:224
HID_CLASS_DESC_HID
#define HID_CLASS_DESC_HID
usb hid class descriptor define
Definition audio_hid_desc.h:214
HID_CLASS_DESC_REPORT
#define HID_CLASS_DESC_REPORT
Definition audio_hid_desc.h:215
HID_REPORT_ID_6
#define HID_REPORT_ID_6
Definition audio_hid_desc.h:226
HID_REPORT_ID_3
#define HID_REPORT_ID_3
Definition audio_hid_desc.h:223
HID_REPORT_ID_5
#define HID_REPORT_ID_5
Definition audio_hid_desc.h:225
USBD_CUSTOM_IN_MAXPACKET_SIZE
#define USBD_CUSTOM_IN_MAXPACKET_SIZE
usb custom hid in and out max packet size define
Definition custom_hid_class.h:58
USBD_CUSTOM_HID_IN_EPT
#define USBD_CUSTOM_HID_IN_EPT
usb custom hid use endpoint define
Definition custom_hid_class.h:52
USBD_CUSTOM_OUT_MAXPACKET_SIZE
#define USBD_CUSTOM_OUT_MAXPACKET_SIZE
Definition custom_hid_class.h:59
USBD_CUSTOM_HID_OUT_EPT
#define USBD_CUSTOM_HID_OUT_EPT
Definition custom_hid_class.h:53
USBD_CUSHID_SIZ_STRING_SERIAL
#define USBD_CUSHID_SIZ_STRING_SERIAL
Definition custom_hid_desc.h:67
USBD_CUSHID_VENDOR_ID
#define USBD_CUSHID_VENDOR_ID
usb vendor id and product id define
Definition custom_hid_desc.h:58
USBD_CUSHID_DESC_CONFIGURATION_STRING
#define USBD_CUSHID_DESC_CONFIGURATION_STRING
Definition custom_hid_desc.h:74
USBD_CUSHID_SIZ_REPORT_DESC
#define USBD_CUSHID_SIZ_REPORT_DESC
Definition custom_hid_desc.h:65
CUSHID_BINTERVAL_TIME
#define CUSHID_BINTERVAL_TIME
Definition custom_hid_desc.h:77
USBD_CUSHID_DESC_MANUFACTURER_STRING
#define USBD_CUSHID_DESC_MANUFACTURER_STRING
usb string define(vendor, product configuration, interface)
Definition custom_hid_desc.h:72
USBD_CUSHID_CONFIG_DESC_SIZE
#define USBD_CUSHID_CONFIG_DESC_SIZE
usb descriptor size define
Definition custom_hid_desc.h:64
USBD_CUSHID_DESC_INTERFACE_STRING
#define USBD_CUSHID_DESC_INTERFACE_STRING
Definition custom_hid_desc.h:75
USBD_CUSHID_PRODUCT_ID
#define USBD_CUSHID_PRODUCT_ID
Definition custom_hid_desc.h:59
USBD_CUSHID_SIZ_STRING_LANGID
#define USBD_CUSHID_SIZ_STRING_LANGID
Definition custom_hid_desc.h:66
USBD_CUSHID_DESC_PRODUCT_STRING
#define USBD_CUSHID_DESC_PRODUCT_STRING
Definition custom_hid_desc.h:73
CUSHID_BCD_NUM
#define CUSHID_BCD_NUM
usb bcd number define
Definition custom_hid_desc.h:53
serial_descriptor
static usbd_desc_t serial_descriptor
Definition custom_hid_desc.c:329
device_descriptor
static usbd_desc_t device_descriptor
Definition custom_hid_desc.c:308
get_device_configuration
static usbd_desc_t * get_device_configuration(void)
get config descriptor
Definition custom_hid_desc.c:437
langid_descriptor
static usbd_desc_t langid_descriptor
Definition custom_hid_desc.c:322
get_device_descriptor
static usbd_desc_t * get_device_descriptor(void)
get device descriptor
Definition custom_hid_desc.c:417
get_device_manufacturer_string
static usbd_desc_t * get_device_manufacturer_string(void)
get manufacturer descriptor
Definition custom_hid_desc.c:468
get_device_qualifier
static usbd_desc_t * get_device_qualifier(void)
get device qualifier
Definition custom_hid_desc.c:427
get_device_interface_string
static usbd_desc_t * get_device_interface_string(void)
get interface descriptor
Definition custom_hid_desc.c:503
vp_desc
static usbd_desc_t vp_desc
Definition custom_hid_desc.c:335
get_device_other_speed
static usbd_desc_t * get_device_other_speed(void)
get other speed descriptor
Definition custom_hid_desc.c:447
ALIGNED_TAIL
static ALIGNED_HEAD uint8_t g_usbd_desc_buffer[256] ALIGNED_TAIL
usb device standard descriptor
Definition custom_hid_desc.c:59
get_device_product_string
static usbd_desc_t * get_device_product_string(void)
get product descriptor
Definition custom_hid_desc.c:480
custom_hid_desc_handler
usbd_desc_handler custom_hid_desc_handler
custom hid device descriptor handler structure
Definition custom_hid_desc.c:64
get_device_config_string
static usbd_desc_t * get_device_config_string(void)
get device config descriptor
Definition custom_hid_desc.c:515
usbd_unicode_convert
static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf)
standard usb unicode convert
Definition custom_hid_desc.c:343
get_device_lang_id
static usbd_desc_t * get_device_lang_id(void)
get lang id descriptor
Definition custom_hid_desc.c:457
get_serial_num
static void get_serial_num(void)
usb get serial number
Definition custom_hid_desc.c:395
config_descriptor
static usbd_desc_t config_descriptor
Definition custom_hid_desc.c:315
get_device_serial_string
static usbd_desc_t * get_device_serial_string(void)
get serial descriptor
Definition custom_hid_desc.c:492
usbd_int_to_unicode
static void usbd_int_to_unicode(uint32_t value, uint8_t *pbuf, uint8_t len)
usb int convert to unicode
Definition custom_hid_desc.c:369
g_usbd_custom_hid_report
uint8_t g_usbd_custom_hid_report[126]
g_custom_hid_usb_desc
uint8_t g_custom_hid_usb_desc[9]
HBYTE
#define HBYTE(x)
Definition usb_std.h:271
USB_DEVICE_EPT_LEN
#define USB_DEVICE_EPT_LEN
Definition usb_std.h:159
USB_MAX_EP0_SIZE
#define USB_MAX_EP0_SIZE
endpoint 0 max size
Definition usb_std.h:248
USB_PRODUCT_STRING
#define USB_PRODUCT_STRING
Definition usb_std.h:105
USB_DESCIPTOR_TYPE_CONFIGURATION
#define USB_DESCIPTOR_TYPE_CONFIGURATION
Definition usb_std.h:92
LBYTE
#define LBYTE(x)
low byte and high byte define
Definition usb_std.h:270
USB_DESCIPTOR_TYPE_ENDPOINT
#define USB_DESCIPTOR_TYPE_ENDPOINT
Definition usb_std.h:95
USB_DEVICE_DESC_LEN
#define USB_DEVICE_DESC_LEN
Definition usb_std.h:156
USB_MFC_STRING
#define USB_MFC_STRING
Definition usb_std.h:104
USB_DEVICE_IF_DESC_LEN
#define USB_DEVICE_IF_DESC_LEN
Definition usb_std.h:158
USB_DEVICE_CFG_DESC_LEN
#define USB_DEVICE_CFG_DESC_LEN
Definition usb_std.h:157
USB_EPT_DESC_INTERRUPT
#define USB_EPT_DESC_INTERRUPT
Definition usb_std.h:184
USB_SERIAL_STRING
#define USB_SERIAL_STRING
Definition usb_std.h:106
USB_DESCIPTOR_TYPE_DEVICE
#define USB_DESCIPTOR_TYPE_DEVICE
usb standard device type
Definition usb_std.h:91
USB_DESCIPTOR_TYPE_STRING
#define USB_DESCIPTOR_TYPE_STRING
Definition usb_std.h:93
USB_DESCIPTOR_TYPE_INTERFACE
#define USB_DESCIPTOR_TYPE_INTERFACE
Definition usb_std.h:94
USB_CLASS_CODE_HID
#define USB_CLASS_CODE_HID
Definition usb_std.h:169
usbd_desc_handler
usb device descriptor handler
Definition usbd_core.h:75
usbd_desc_t
usb device descriptor struct
Definition usbd_core.h:66
usbd_desc_t::length
uint16_t length
Definition usbd_core.h:67
usbd_desc_t::descriptor
uint8_t * descriptor
Definition usbd_core.h:68
usb_std.h
usb standard header file
usbd_core.h
usb device core header file
usbd_sdr.h
usb standard request header file


AT32F413 Firmwary Library: custom_hid_desc.h Source File

  • middlewares
  • usbd_class
  • custom_hid
custom_hid_desc.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __CUSTOM_HID_DESC_H
28#define __CUSTOM_HID_DESC_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "custom_hid_class.h"
35#include "usbd_core.h"
36
53#define CUSHID_BCD_NUM 0x0110
54
58#define USBD_CUSHID_VENDOR_ID 0x2E3C
59#define USBD_CUSHID_PRODUCT_ID 0x5745
60
64#define USBD_CUSHID_CONFIG_DESC_SIZE 41
65#define USBD_CUSHID_SIZ_REPORT_DESC 126
66#define USBD_CUSHID_SIZ_STRING_LANGID 4
67#define USBD_CUSHID_SIZ_STRING_SERIAL 0x1A
68
72#define USBD_CUSHID_DESC_MANUFACTURER_STRING "Artery"
73#define USBD_CUSHID_DESC_PRODUCT_STRING "Custom HID"
74#define USBD_CUSHID_DESC_CONFIGURATION_STRING "Custom HID Config"
75#define USBD_CUSHID_DESC_INTERFACE_STRING "Custom HID Interface"
76
77#define CUSHID_BINTERVAL_TIME 0x0A
78
85#define HID_REPORT_ID_1 0x01
86#define HID_REPORT_ID_2 0x02
87#define HID_REPORT_ID_3 0x03
88#define HID_REPORT_ID_4 0x04
89#define HID_REPORT_ID_5 0x05
90#define HID_REPORT_ID_6 0xF0
91
95#define MCU_ID1 (0x1FFFF7E8)
96#define MCU_ID2 (0x1FFFF7EC)
97#define MCU_ID3 (0x1FFFF7F0)
98
102extern uint8_t g_usbd_custom_hid_report[USBD_CUSHID_SIZ_REPORT_DESC];
103extern uint8_t g_custom_hid_usb_desc[9];
104extern usbd_desc_handler custom_hid_desc_handler;
105
113#ifdef __cplusplus
114}
115#endif
116
117#endif
118
119
custom_hid_class.h
usb custom hid header file
USBD_CUSHID_SIZ_REPORT_DESC
#define USBD_CUSHID_SIZ_REPORT_DESC
Definition custom_hid_desc.h:65
custom_hid_desc_handler
usbd_desc_handler custom_hid_desc_handler
custom hid device descriptor handler structure
Definition custom_hid_desc.c:64
g_usbd_custom_hid_report
uint8_t g_usbd_custom_hid_report[126]
g_custom_hid_usb_desc
uint8_t g_custom_hid_usb_desc[9]
usbd_desc_handler
usb device descriptor handler
Definition usbd_core.h:75
usbd_core.h
usb device core header file


AT32F413 Firmwary Library: diskio.c Source File

  • sdio
  • sdio_fatfs
  • src
diskio.c
Go to the documentation of this file.
1/*-----------------------------------------------------------------------*/
2/* Low level disk I/O module SKELETON for FatFs (C)ChaN, 2019 */
3/*-----------------------------------------------------------------------*/
4/* If a working storage control module is available, it should be */
5/* attached to the FatFs via a glue function rather than modifying it. */
6/* This is an example of glue functions to attach various exsisting */
7/* storage control modules to the FatFs module with a defined API. */
8/*-----------------------------------------------------------------------*/
9
10
11#include "ff.h" /* Obtains integer types */
12#include "diskio.h" /* Declarations of disk functions */
13
14#include <string.h>
15#include "at32_sdio.h" /* Example: Header file of existing MMC/SDC contorl module */
16
17/* Definitions of physical drive number for each drive */
18#define DEV_RAM 0 /* Example: Map Ramdisk to physical drive 0 */
19#define DEV_MMC 1 /* Example: Map MMC/SD card to physical drive 1 */
20#define DEV_USB 2 /* Example: Map USB MSD to physical drive 2 */
21
22#if defined ( __ICCARM__ ) /* iar compiler */
23 #pragma data_alignment=4
24#endif
25ALIGNED_HEAD uint8_t sdio_data_buffer[512] ALIGNED_TAIL; /* buf for sd_read_disk/sd_write_disk function used. */
26
27 sd_error_status_type sd_read_disk(uint8_t *buf, uint32_t sector, uint8_t cnt);
28 sd_error_status_type sd_write_disk(const uint8_t *buf, uint32_t sector, uint8_t cnt);
29
37 sd_error_status_type sd_read_disk(uint8_t *buf, uint32_t sector, uint8_t cnt)
38{
39 sd_error_status_type sta = SD_OK;
40 long long lsector = sector;
41 uint8_t n;
42
43 /* data address is in block (512 byte) units. */
44 lsector <<= 9;
45
46 if((uint32_t)buf % 4 != 0)
47 {
48 for(n = 0; n < cnt; n++)
49 {
50 sta = sd_block_read(sdio_data_buffer, lsector + 512 * n, 512);
51 memcpy(buf, sdio_data_buffer, 512);
52 buf += 512;
53 }
54 }
55 else
56 {
57 if(cnt == 1)
58 {
59 sta = sd_block_read(buf, lsector, 512);
60 }
61 else
62 {
63 sta = sd_mult_blocks_read(buf, lsector, 512, cnt);
64 }
65 }
66
67 return sta;
68}
69
77 sd_error_status_type sd_write_disk(const uint8_t *buf, uint32_t sector, uint8_t cnt)
78{
79 sd_error_status_type sta = SD_OK;
80 uint8_t n;
81 long long lsector = sector;
82
83 /* data address is in block (512 byte) units. */
84 lsector <<= 9;
85
86 if((uint32_t)buf % 4 != 0)
87 {
88 for(n = 0; n < cnt; n++)
89 {
90 memcpy(sdio_data_buffer, buf, 512);
91 sta = sd_block_write(sdio_data_buffer, lsector + 512*n, 512);
92 buf += 512;
93 }
94 }
95 else
96 {
97 if(cnt == 1)
98 {
99 sta = sd_block_write(buf, lsector, 512);
100 }
101 else
102 {
103 sta = sd_mult_blocks_write(buf, lsector, 512, cnt);
104 }
105 }
106
107 return sta;
108}
109
110/*-----------------------------------------------------------------------*/
111/* Get Drive Status */
112/*-----------------------------------------------------------------------*/
113DSTATUS disk_status (
114 BYTE pdrv /* Physical drive nmuber to identify the drive */
115)
116{
117 DSTATUS stat;
118 int result;
119
120 switch (pdrv) {
121 case DEV_RAM :
122 result = 1;
123 stat = (DSTATUS)result;
124 return stat;
125
126 case DEV_MMC :
127 result = 0;
128 stat = (DSTATUS)result;
129 return stat;
130
131 case DEV_USB :
132 result = 1;
133 stat = (DSTATUS)result;
134 return stat;
135 }
136 return STA_NOINIT;
137}
138
139
140
141/*-----------------------------------------------------------------------*/
142/* Inidialize a Drive */
143/*-----------------------------------------------------------------------*/
144DSTATUS disk_initialize (
145 BYTE pdrv /* Physical drive nmuber to identify the drive */
146)
147{
148 DSTATUS stat;
149 int result;
150
151 switch (pdrv) {
152 case DEV_RAM :
153 result = 1;
154 stat = (DSTATUS)result;
155 return stat;
156
157 case DEV_MMC :
158 result = sd_init();
159 stat = (DSTATUS)result;
160 return stat;
161
162 case DEV_USB :
163 result = 1;
164 stat = (DSTATUS)result;
165 return stat;
166 }
167 return STA_NOINIT;
168}
169
170
171
172/*-----------------------------------------------------------------------*/
173/* Read Sector(s) */
174/*-----------------------------------------------------------------------*/
175DRESULT disk_read (
176 BYTE pdrv, /* Physical drive nmuber to identify the drive */
177 BYTE *buff, /* Data buffer to store read data */
178 LBA_t sector, /* Start sector in LBA */
179 UINT count /* Number of sectors to read */
180)
181{
182 DRESULT res;
183 int result;
184
185 switch (pdrv) {
186 case DEV_RAM :
187 result = 1;
188 res = (DRESULT)result;
189 return res;
190
191 case DEV_MMC :
192 result = sd_read_disk(buff, sector, count);
193 res = (DRESULT)result;
194 return res;
195
196 case DEV_USB :
197 result = 1;
198 res = (DRESULT)result;
199 return res;
200 }
201
202 return RES_PARERR;
203}
204
205
206
207/*-----------------------------------------------------------------------*/
208/* Write Sector(s) */
209/*-----------------------------------------------------------------------*/
210#if FF_FS_READONLY == 0
211
212DRESULT disk_write (
213 BYTE pdrv, /* Physical drive nmuber to identify the drive */
214 const BYTE *buff, /* Data to be written */
215 LBA_t sector, /* Start sector in LBA */
216 UINT count /* Number of sectors to write */
217)
218{
219 DRESULT res;
220 int result;
221
222 switch (pdrv) {
223 case DEV_RAM :
224 result = 1;
225 res = (DRESULT)result;
226 return res;
227
228 case DEV_MMC :
229 result = sd_write_disk(buff, sector, count);
230 res = (DRESULT)result;
231 return res;
232
233 case DEV_USB :
234 result = 1;
235 res = (DRESULT)result;
236 return res;
237 }
238
239 return RES_PARERR;
240}
241
242#endif
243
244
245/*-----------------------------------------------------------------------*/
246/* Miscellaneous Functions */
247/*-----------------------------------------------------------------------*/
248DRESULT disk_ioctl (
249 BYTE pdrv, /* Physical drive nmuber (0..) */
250 BYTE cmd, /* Control code */
251 void *buff /* Buffer to send/receive control data */
252)
253{
254 DRESULT res;
255 int result;
256
257 switch (pdrv) {
258 case DEV_RAM :
259 result = 1;
260 res = (DRESULT)result;
261 return res;
262
263 case DEV_MMC :
264 switch(cmd){
265 case CTRL_SYNC:
266 result = RES_OK;
267 break;
268 case GET_SECTOR_SIZE:
269 *(DWORD*)buff = 512;
270 result = RES_OK;
271 break;
272 case GET_SECTOR_COUNT:
273 *(DWORD*)buff = sd_card_info.card_capacity/512;
274 result = RES_OK;
275 break;
276 case GET_BLOCK_SIZE:
277 *(DWORD*)buff = sd_card_info.card_blk_size;
278 result = RES_OK;
279 break;
280 default:
281 result = RES_PARERR;
282 break;
283 }
284 res = (DRESULT)result;
285 return res;
286
287 case DEV_USB :
288 result = 1;
289 res = (DRESULT)result;
290 return res;
291 }
292
293 return RES_PARERR;
294}
disk_read
DRESULT disk_read(BYTE pdrv, BYTE *buff, LBA_t sector, UINT count)
Definition diskio.c:175
disk_initialize
DSTATUS disk_initialize(BYTE pdrv)
Definition diskio.c:144
DEV_USB
#define DEV_USB
Definition diskio.c:20
DEV_RAM
#define DEV_RAM
Definition diskio.c:18
disk_status
DSTATUS disk_status(BYTE pdrv)
Definition diskio.c:113
disk_ioctl
DRESULT disk_ioctl(BYTE pdrv, BYTE cmd, void *buff)
Definition diskio.c:248
disk_write
DRESULT disk_write(BYTE pdrv, const BYTE *buff, LBA_t sector, UINT count)
Definition diskio.c:212
sd_read_disk
sd_error_status_type sd_read_disk(uint8_t *buf, uint32_t sector, uint8_t cnt)
read sd card sector
Definition diskio.c:37
DEV_MMC
#define DEV_MMC
Definition diskio.c:19
sd_write_disk
sd_error_status_type sd_write_disk(const uint8_t *buf, uint32_t sector, uint8_t cnt)
write sd card sector
Definition diskio.c:77
sd_block_read
sd_error_status_type sd_block_read(uint8_t *buf, long long addr, uint16_t blk_size)
allows to read one block from a specified address in a card. the data transfer can be managed by dma ...
Definition emmc_card/src/at32_sdio.c:1210
sd_mult_blocks_write
sd_error_status_type sd_mult_blocks_write(const uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks)
allows to write blocks starting from a specified address in a card. the data transfer can be managed ...
Definition emmc_card/src/at32_sdio.c:1511
sd_block_write
sd_error_status_type sd_block_write(const uint8_t *buf, long long addr, uint16_t blk_size)
allows to write one block starting from a specified address in a card. the data transfer can be manag...
Definition emmc_card/src/at32_sdio.c:1389
sd_init
sd_error_status_type sd_init(void)
initializes the sd card and put it into standby state (ready for data transfer).
Definition emmc_card/src/at32_sdio.c:73
sd_mult_blocks_read
sd_error_status_type sd_mult_blocks_read(uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks)
allows to read blocks from a specified address in a card. the data transfer can be managed by dma mod...
Definition emmc_card/src/at32_sdio.c:1299
sd_card_info
sd_card_info_struct_type sd_card_info
Definition emmc_card/src/at32_sdio.c:48
sd_error_status_type
sd_error_status_type
Definition emmc_card/inc/at32_sdio.h:73
SD_OK
@ SD_OK
Definition emmc_card/inc/at32_sdio.h:118
ALIGNED_TAIL
ALIGNED_HEAD uint8_t sdio_data_buffer[512] ALIGNED_TAIL
Definition diskio.c:25
sd_card_info_struct_type::card_capacity
long long card_capacity
Definition emmc_card/inc/at32_sdio.h:240
sd_card_info_struct_type::card_blk_size
uint32_t card_blk_size
Definition emmc_card/inc/at32_sdio.h:241


AT32F413 Firmwary Library: eeprom.c Source File

  • i2c
  • eeprom
  • src
eeprom.c
Go to the documentation of this file.
1
25#include "eeprom.h"
26
34 i2c_status_type eeprom_ready_check(i2c_handle_type* hi2c, uint16_t address, uint32_t timeout)
35{
36 /* wait for the busy flag to be reset */
37 if (i2c_wait_flag(hi2c, I2C_BUSYF_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
38 {
39 return I2C_ERR_STEP_1;
40 }
41
42 /* ack acts on the current byte */
43 i2c_master_receive_ack_set(hi2c->i2cx, I2C_MASTER_ACK_CURRENT);
44
45 /* generate start condtion */
46 i2c_start_generate(hi2c->i2cx);
47
48 /* wait for the start flag to be set */
49 if(i2c_wait_flag(hi2c, I2C_STARTF_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
50 {
51 /* generate stop condtion */
52 i2c_stop_generate(hi2c->i2cx);
53
54 return I2C_ERR_STEP_2;
55 }
56
57 /* send slave address */
58 i2c_7bit_address_send(hi2c->i2cx, address, I2C_DIRECTION_TRANSMIT);
59
60 /* wait for the addr7 flag to be set */
61 if(i2c_wait_flag(hi2c, I2C_ADDR7F_FLAG, I2C_EVENT_CHECK_ACKFAIL, timeout) != I2C_OK)
62 {
63 return I2C_ERR_STEP_3;
64 }
65
66 /* clear addr flag */
67 i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
68
69 /* generate stop condtion */
70 i2c_stop_generate(hi2c->i2cx);
71
72 /* wait for the busy flag to be reset */
73 if(i2c_wait_flag(hi2c, I2C_BUSYF_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
74 {
75 return I2C_ERR_STEP_4;
76 }
77
78 return I2C_OK;
79}
80
88 i2c_status_type eeprom_ready_wait(i2c_handle_type* hi2c, uint16_t address, uint32_t timeout)
89{
90 uint32_t i = 0;
91
92 for(i = 0; i < EEPROM_BUSY_TIMEOUT; i++)
93 {
94 if(eeprom_ready_check(hi2c, address, timeout) == I2C_OK)
95 {
96 return I2C_OK;
97 }
98 }
99
100 return I2C_ERR_TIMEOUT;
101}
102
103
123 i2c_status_type eeprom_write_page(i2c_handle_type* hi2c, eeprom_mode_type mode, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t* pdata, uint16_t size, uint32_t timeout)
124{
125 i2c_status_type status;
126
127 /* write data to eeprom */
128 if(mode == EE_MODE_POLL)
129 {
130 return i2c_memory_write(hi2c, mem_address_width, address, mem_address, pdata, size, timeout);
131 }
132 else if(mode == EE_MODE_INT)
133 {
134 status = i2c_memory_write_int(hi2c, mem_address_width, address, mem_address, pdata, size, timeout);
135
136 if(status != I2C_OK)
137 {
138 return status;
139 }
140
141 /* wait for the communication to end */
142 return i2c_wait_end(hi2c, timeout);
143 }
144 else
145 {
146 status = i2c_memory_write_dma(hi2c, mem_address_width, address, mem_address, pdata, size, timeout);
147
148 if(status != I2C_OK)
149 {
150 return status;
151 }
152
153 /* wait for the communication to end */
154 return i2c_wait_end(hi2c, timeout);
155 }
156}
157
177 i2c_status_type eeprom_read_buffer(i2c_handle_type* hi2c, eeprom_mode_type mode, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t* pdata, uint16_t size, uint32_t timeout)
178{
179 i2c_status_type status;
180
181 /* write data to eeprom */
182 if(mode == EE_MODE_POLL)
183 {
184 return i2c_memory_read(hi2c, mem_address_width, address, mem_address, pdata, size, timeout);
185 }
186 else if(mode == EE_MODE_INT)
187 {
188 status = i2c_memory_read_int(hi2c, mem_address_width, address, mem_address, pdata, size, timeout);
189
190 if(status != I2C_OK)
191 {
192 return status;
193 }
194
195 /* wait for the communication to end */
196 return i2c_wait_end(hi2c, timeout);
197 }
198 else
199 {
200 status = i2c_memory_read_dma(hi2c, mem_address_width, address, mem_address, pdata, size, timeout);
201
202 if(status != I2C_OK)
203 {
204 return status;
205 }
206
207 /* wait for the communication to end */
208 return i2c_wait_end(hi2c, timeout);
209 }
210}
211
231 i2c_status_type eeprom_write_buffer(i2c_handle_type* hi2c, eeprom_mode_type mode, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t* pdata, uint16_t size, uint32_t timeout)
232{
233 uint16_t page_number = 0;
234 uint16_t page_last = 0;
235 uint16_t single_write = 0;
236 uint16_t write_address = 0;
237 i2c_status_type status;
238
239 /* calculate the number of data programred for the first time, and the subsequent program address will be aligned */
240 single_write = mem_address / EEPROM_PAGE_SIZE * EEPROM_PAGE_SIZE + EEPROM_PAGE_SIZE - mem_address;
241
242 /* first program address */
243 write_address = mem_address;
244
245 if (size < single_write)
246 {
247 single_write = size;
248 }
249
250 /* write data to eeprom */
251 status = eeprom_write_page(hi2c, mode, mem_address_width, address, write_address, pdata, single_write, timeout);
252
253 if(status != I2C_OK)
254 {
255 return status;
256 }
257
258 /* wait for eeprom device to be ready */
259 if(eeprom_ready_wait(hi2c, address, timeout) != I2C_OK)
260 {
261 return I2C_ERR_TIMEOUT;
262 }
263
264 /* address increase */
265 write_address += single_write;
266
267 /* subtract the number of data programed for the first time */
268 size -= single_write;
269
270 /* pointer increase */
271 pdata += single_write;
272
273 /* if the remaining quantity is 0, it means the program is complete */
274 if (size == 0)
275 {
276 return I2C_OK;
277 }
278
279 /* calculate the number of bytes in less than one page */
280 page_last = size % EEPROM_PAGE_SIZE;
281
282 /* calculate the number of full page */
283 page_number = size / EEPROM_PAGE_SIZE;
284
285 /* program an integer number of pages of data */
286 while(page_number > 0)
287 {
288 /* write data to eeprom */
289 status = eeprom_write_page(hi2c, mode, mem_address_width, address, write_address, pdata, EEPROM_PAGE_SIZE, timeout);
290
291 if(status != I2C_OK)
292 {
293 return status;
294 }
295
296 /* wait for eeprom device to be ready */
297 if(eeprom_ready_wait(hi2c, address, timeout) != I2C_OK)
298 {
299 return I2C_ERR_TIMEOUT;
300 }
301
302 /* page number subtract */
303 page_number--;
304
305 /* address increase */
306 write_address += EEPROM_PAGE_SIZE;
307
308 /* pointer increase */
309 pdata += EEPROM_PAGE_SIZE;
310 }
311
312 /* programring less than one page of data */
313 if (page_last)
314 {
315 /* write data to eeprom */
316 status = eeprom_write_page(hi2c, mode, mem_address_width, address, write_address, pdata, page_last, timeout);
317
318 if(status != I2C_OK)
319 {
320 return status;
321 }
322
323 /* wait for eeprom device to be ready */
324 if(eeprom_ready_wait(hi2c, address, timeout) != I2C_OK)
325 {
326 return I2C_ERR_TIMEOUT;
327 }
328 }
329
330 return I2C_OK;
331}
eeprom_read_buffer
i2c_status_type eeprom_read_buffer(i2c_handle_type *hi2c, eeprom_mode_type mode, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
read data from eeprom.
Definition eeprom.c:177
eeprom_ready_wait
i2c_status_type eeprom_ready_wait(i2c_handle_type *hi2c, uint16_t address, uint32_t timeout)
wait for eeprom device to be ready
Definition eeprom.c:88
eeprom_ready_check
i2c_status_type eeprom_ready_check(i2c_handle_type *hi2c, uint16_t address, uint32_t timeout)
check if the eeprom device is ready
Definition eeprom.c:34
eeprom_write_page
i2c_status_type eeprom_write_page(i2c_handle_type *hi2c, eeprom_mode_type mode, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
write data to the eeprom page.
Definition eeprom.c:123
eeprom_write_buffer
i2c_status_type eeprom_write_buffer(i2c_handle_type *hi2c, eeprom_mode_type mode, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
write data to the eeprom device.
Definition eeprom.c:231
eeprom.h
i2c eeprom libray header file
EEPROM_BUSY_TIMEOUT
#define EEPROM_BUSY_TIMEOUT
Definition eeprom.h:31
eeprom_mode_type
eeprom_mode_type
Definition eeprom.h:36
EE_MODE_INT
@ EE_MODE_INT
Definition eeprom.h:38
EE_MODE_POLL
@ EE_MODE_POLL
Definition eeprom.h:37
EEPROM_PAGE_SIZE
#define EEPROM_PAGE_SIZE
Definition eeprom.h:32
i2c_wait_flag
i2c_status_type i2c_wait_flag(i2c_handle_type *hi2c, uint32_t flag, uint32_t event_check, uint32_t timeout)
wait for the flag to be set or reset, only BUSYF flag is waiting to be reset, and other flags are wai...
Definition i2c_application.c:185
i2c_memory_read_dma
i2c_status_type i2c_memory_read_dma(i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
read data from memory device through polling mode.
Definition i2c_application.c:1878
i2c_wait_end
i2c_status_type i2c_wait_end(i2c_handle_type *hi2c, uint32_t timeout)
wait for the transfer to end.
Definition i2c_application.c:129
i2c_memory_write_dma
i2c_status_type i2c_memory_write_dma(i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
write data to the memory device through dma mode.
Definition i2c_application.c:1795
i2c_memory_write_int
i2c_status_type i2c_memory_write_int(i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
write data to the memory device through interrupt mode.
Definition i2c_application.c:1601
i2c_memory_write
i2c_status_type i2c_memory_write(i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
write data to the memory device through polling mode.
Definition i2c_application.c:1299
i2c_memory_read
i2c_status_type i2c_memory_read(i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
read data from memory device through polling mode.
Definition i2c_application.c:1388
i2c_memory_read_int
i2c_status_type i2c_memory_read_int(i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
read data from memory device through interrupt mode.
Definition i2c_application.c:1678
i2c_7bit_address_send
void i2c_7bit_address_send(i2c_type *i2c_x, uint8_t address, i2c_direction_type direction)
transmit the slave address.
Definition at32f413_i2c.c:509
i2c_stop_generate
void i2c_stop_generate(i2c_type *i2c_x)
generate stop condition.
Definition at32f413_i2c.c:492
i2c_flag_clear
void i2c_flag_clear(i2c_type *i2c_x, uint32_t flag)
clear flag status
Definition at32f413_i2c.c:702
i2c_master_receive_ack_set
void i2c_master_receive_ack_set(i2c_type *i2c_x, i2c_master_ack_type pos)
master receiving mode acknowledge control.
Definition at32f413_i2c.c:305
i2c_start_generate
void i2c_start_generate(i2c_type *i2c_x)
generate start condition.
Definition at32f413_i2c.c:480
I2C_DIRECTION_TRANSMIT
@ I2C_DIRECTION_TRANSMIT
Definition at32f413_i2c.h:165
I2C_MASTER_ACK_CURRENT
@ I2C_MASTER_ACK_CURRENT
Definition at32f413_i2c.h:109
I2C_EVENT_CHECK_NONE
#define I2C_EVENT_CHECK_NONE
Definition i2c_application.h:46
I2C_EVENT_CHECK_ACKFAIL
#define I2C_EVENT_CHECK_ACKFAIL
Definition i2c_application.h:47
i2c_mem_address_width_type
i2c_mem_address_width_type
Definition i2c_application.h:59
i2c_status_type
i2c_status_type
Definition i2c_application.h:94
I2C_ERR_STEP_1
@ I2C_ERR_STEP_1
Definition i2c_application.h:96
I2C_ERR_TIMEOUT
@ I2C_ERR_TIMEOUT
Definition i2c_application.h:113
I2C_ERR_STEP_3
@ I2C_ERR_STEP_3
Definition i2c_application.h:98
I2C_ERR_STEP_2
@ I2C_ERR_STEP_2
Definition i2c_application.h:97
I2C_OK
@ I2C_OK
Definition i2c_application.h:95
I2C_ERR_STEP_4
@ I2C_ERR_STEP_4
Definition i2c_application.h:99
I2C_STARTF_FLAG
#define I2C_STARTF_FLAG
Definition at32f413_i2c.h:51
I2C_ADDR7F_FLAG
#define I2C_ADDR7F_FLAG
Definition at32f413_i2c.h:52
I2C_BUSYF_FLAG
#define I2C_BUSYF_FLAG
Definition at32f413_i2c.h:76
i2c_handle_type
Definition i2c_application.h:127
i2c_handle_type::i2cx
i2c_type * i2cx
Definition i2c_application.h:128


AT32F413 Firmwary Library: eeprom.h Source File

  • i2c
  • eeprom
  • inc
eeprom.h
Go to the documentation of this file.
1
26#ifndef __EERPOM_H
27#define __EERPOM_H
28
29#include "i2c_application.h"
30
31#define EEPROM_BUSY_TIMEOUT 1000
32#define EEPROM_PAGE_SIZE 8
33#define EEPROM_I2C_ADDRESS 0xA0
35typedef enum
36{
37 EE_MODE_POLL = 0x01,
38 EE_MODE_INT = 0x02,
39 EE_MODE_DMA = 0x03,
40} eeprom_mode_type;
41
42 i2c_status_type eeprom_write_buffer(i2c_handle_type* hi2c, eeprom_mode_type mode, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t* pdata, uint16_t size, uint32_t timeout);
43 i2c_status_type eeprom_read_buffer (i2c_handle_type* hi2c, eeprom_mode_type mode, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t* pdata, uint16_t size, uint32_t timeout);
44
45#endif
eeprom_read_buffer
i2c_status_type eeprom_read_buffer(i2c_handle_type *hi2c, eeprom_mode_type mode, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
read data from eeprom.
Definition eeprom.c:177
eeprom_mode_type
eeprom_mode_type
Definition eeprom.h:36
EE_MODE_DMA
@ EE_MODE_DMA
Definition eeprom.h:39
EE_MODE_INT
@ EE_MODE_INT
Definition eeprom.h:38
EE_MODE_POLL
@ EE_MODE_POLL
Definition eeprom.h:37
eeprom_write_buffer
i2c_status_type eeprom_write_buffer(i2c_handle_type *hi2c, eeprom_mode_type mode, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
write data to the eeprom device.
Definition eeprom.c:231
i2c_mem_address_width_type
i2c_mem_address_width_type
Definition i2c_application.h:59
i2c_status_type
i2c_status_type
Definition i2c_application.h:94
i2c_application.h
i2c application libray header file
i2c_handle_type
Definition i2c_application.h:127


AT32F413 Firmwary Library: at32_sdio.h Source File

  • sdio
  • emmc_card
  • inc
emmc_card/inc/at32_sdio.h
Go to the documentation of this file.
1
27/* define to prevent recursive inclusion -------------------------------------*/
28#ifndef __AT32_SDIO_H
29#define __AT32_SDIO_H
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
35/* includes ------------------------------------------------------------------*/
36#include "at32f413.h"
37
50#define SDIOx SDIO1
51
63typedef enum
64{
65 SD_TRANSFER_POLLING_MODE = 0,
66 SD_TRANSFER_DMA_MODE = 1
67} sd_data_transfer_mode_type;
68
72typedef enum
73{
74 /* sdio specific error defines ------------------------------------------*/
75 SD_CMD_FAIL = 1,
76 SD_DATA_FAIL = 2,
77 SD_CMD_RSP_TIMEOUT = 3,
78 SD_DATA_TIMEOUT = 4,
79 SD_TX_UNDERRUN = 5,
80 SD_RX_OVERRUN = 6,
81 SD_START_BIT_ERR = 7,
82 SD_CMD_OUT_OF_RANGE = 8,
83 SD_ADDR_MISALIGNED = 9,
84 SD_BLK_LEN_ERR = 10,
85 SD_ERASE_SEQ_ERR = 11,
86 SD_INVALID_ERASE_PARAM = 12,
87 SD_WR_PROTECT_VIOLATION = 13,
88 SD_LOCK_UNLOCK_ERROR = 14,
89 SD_CMD_CRC_ERROR = 15,
90 SD_ILLEGAL_CMD = 16,
91 SD_CARD_ECC_ERROR = 17,
92 SD_CARD_CONTROLLER_ERR = 18,
93 SD_GENERAL_UNKNOWN_ERROR = 19,
94 SD_STREAM_RD_UNDERRUN = 20,
95 SD_STREAM_WR_OVERRUN = 21,
96 SD_CID_CSD_OVERWRITE = 22,
97 SD_WP_ERASE_SKIP = 23,
98 SD_CARD_ECC_DISABLED = 24,
99 SD_ERASE_RESET = 25,
100 SD_AKE_SEQ_ERROR = 26,
101 SD_INVALID_VOLTRANGE = 27,
102 SD_ADDR_OUT_OF_RANGE = 28,
103 SD_SWITCH_ERROR = 29,
104 SD_SDIO_DISABLED = 30,
105 SD_SDIO_FUNC_BUSY = 31,
106 SD_SDIO_FUNC_ERROR = 32,
107 SD_SDIO_UNKNOWN_FUNC = 33,
109 /* standard error defines --------------------------------------------*/
110 SD_INTERNAL_ERROR,
111 SD_NOT_CONFIGURED,
112 SD_REQ_PENDING,
113 SD_REQ_NOT_APPLICABLE,
114 SD_INVALID_PARAMETER,
115 SD_UNSUPPORTED_FEATURE,
116 SD_UNSUPPORTED_HW,
117 SD_ERROR,
118 SD_OK = 0
119} sd_error_status_type;
120
124typedef struct
125{
126 uint8_t csd_struct;
127 uint8_t spec_version;
128 uint8_t reserved1;
129 uint8_t taac;
130 uint8_t nsac;
131 uint8_t max_bus_clk_freq;
132 uint16_t card_cmd_classes;
133 uint8_t max_read_blk_length;
134 uint8_t part_blk_read;
135 uint8_t write_blk_misalign;
136 uint8_t read_blk_misalign;
137 uint8_t dsr_implemented;
138 uint8_t reserved2;
139 uint32_t device_size;
140 uint8_t max_read_current_vdd_min;
141 uint8_t max_read_current_vdd_max;
142 uint8_t max_write_current_vdd_min;
143 uint8_t max_write_current_vdd_max;
144 uint8_t device_size_mult;
145 uint8_t erase_group_size;
146 uint8_t erase_group_size_mult;
147 uint8_t write_protect_group_size;
148 uint8_t write_protect_group_enable;
149 uint8_t manufacturer_default_ecc;
150 uint8_t write_speed_factor;
151 uint8_t max_write_blk_length;
152 uint8_t part_blk_write;
153 uint8_t reserved3;
154 uint8_t content_protect_app;
155 uint8_t file_format_group;
156 uint8_t copy_flag;
157 uint8_t permanent_write_protect;
158 uint8_t temp_write_protect;
159 uint8_t file_formart;
160 uint8_t ecc_code;
161 uint8_t csd_crc;
162 uint8_t reserved4;
163} sd_csd_struct_type;
164
168typedef struct
169{
170 uint8_t manufacturer_id;
171 uint16_t oem_app_id;
172 uint32_t product_name1;
173 uint8_t product_name2;
174 uint8_t product_reversion;
175 uint32_t product_sn;
176 uint8_t reserved1;
177 uint16_t manufact_date;
178 uint8_t cid_crc;
179 uint8_t reserved2;
180} sd_cid_struct_type;
181
185typedef enum
186{
187 SD_CARD_READY = ((uint32_t)0x00000001),
188 SD_CARD_IDENTIFICATION = ((uint32_t)0x00000002),
189 SD_CARD_STANDBY = ((uint32_t)0x00000003),
190 SD_CARD_TRANSFER = ((uint32_t)0x00000004),
191 SD_CARD_SENDING = ((uint32_t)0x00000005),
192 SD_CARD_RECEIVING = ((uint32_t)0x00000006),
193 SD_CARD_PROGRAMMING = ((uint32_t)0x00000007),
194 SD_CARD_DISCONNECTED = ((uint32_t)0x00000008),
195 SD_CARD_ERROR = ((uint32_t)0x000000FF)
196} sd_card_state_type;
197
201typedef enum
202{
203 SDIO_STD_CAPACITY_SD_CARD_V1_1 = 0,
204 SDIO_STD_CAPACITY_SD_CARD_V2_0 = 1,
205 SDIO_HIGH_CAPACITY_SD_CARD = 2,
206 SDIO_MULTIMEDIA_CARD = 3,
207 SDIO_SECURE_DIGITAL_IO_CARD = 4,
208 SDIO_HIGH_SPEED_MULTIMEDIA_CARD = 5,
209 SDIO_SECURE_DIGITAL_IO_COMBO_CARD = 6,
210 SDIO_HIGH_CAPACITY_MMC_CARD = 7,
211 SDIO_SDIO_CARD = 8
212} sd_memory_card_type;
213
217typedef struct
218{
219 uint32_t sd_spec :4; /* [59:56] */
220 uint32_t scr_structure :4; /* [60:63] */
221 uint32_t sd_bus_width :4; /* [51:48] */
222 uint32_t sd_security :3; /* [52:54] */
223 uint32_t data_stat_after_erase :1; /* [55:55] */
224 uint32_t reserved1 :7; /* [46:40] */
225 uint32_t sd_spec3 :1; /* [47:47] */
226 uint32_t cmd20_support :1; /* [32:32] */
227 uint32_t cmd23_support :1; /* [33:33] */
228 uint32_t reserverd2 :6; /* [34:39] */
229 uint32_t reserverd3; /* [31:0] */
230} sd_scr_struct_type;
231
235typedef struct
236{
237 sd_csd_struct_type sd_csd_reg;
238 sd_cid_struct_type sd_cid_reg;
239 sd_scr_struct_type sd_scr_reg;
240 long long card_capacity;
241 uint32_t card_blk_size;
242 uint16_t rca;
243 uint8_t card_type;
244} sd_card_info_struct_type;
245
246extern sd_card_info_struct_type sd_card_info;
247
259#define SD_CMD_GO_IDLE_STATE ((uint8_t)0)
260#define SD_CMD_SEND_OP_COND ((uint8_t)1)
261#define SD_CMD_ALL_SEND_CID ((uint8_t)2)
262#define SD_CMD_SET_REL_ADDR ((uint8_t)3)
263#define SD_CMD_SET_DSR ((uint8_t)4)
264#define SD_CMD_SDIO_SEN_OP_COND ((uint8_t)5)
265#define SD_CMD_HS_SWITCH ((uint8_t)6)
266#define SD_CMD_SEL_DESEL_CARD ((uint8_t)7)
267#define SD_CMD_HS_SEND_EXT_CSD ((uint8_t)8)
268#define SD_CMD_SEND_CSD ((uint8_t)9)
269#define SD_CMD_SEND_CID ((uint8_t)10)
270#define SD_CMD_READ_DAT_UNTIL_STOP ((uint8_t)11)
271#define SD_CMD_STOP_TRANSMISSION ((uint8_t)12)
272#define SD_CMD_SEND_STATUS ((uint8_t)13)
273#define SD_CMD_HS_BUSTEST_READ ((uint8_t)14)
274#define SD_CMD_GO_INACTIVE_STATE ((uint8_t)15)
275#define SD_CMD_SET_BLOCKLEN ((uint8_t)16)
276#define SD_CMD_READ_SINGLE_BLOCK ((uint8_t)17)
277#define SD_CMD_READ_MULT_BLOCK ((uint8_t)18)
278#define SD_CMD_HS_BUSTEST_WRITE ((uint8_t)19)
279#define SD_CMD_WRITE_DAT_UNTIL_STOP ((uint8_t)20)
280#define SD_CMD_SET_BLOCK_COUNT ((uint8_t)23)
281#define SD_CMD_WRITE_SINGLE_BLOCK ((uint8_t)24)
282#define SD_CMD_WRITE_MULT_BLOCK ((uint8_t)25)
283#define SD_CMD_PROG_CID ((uint8_t)26)
284#define SD_CMD_PROG_CSD ((uint8_t)27)
285#define SD_CMD_SET_WRITE_PROT ((uint8_t)28)
286#define SD_CMD_CLR_WRITE_PROT ((uint8_t)29)
287#define SD_CMD_SEND_WRITE_PROT ((uint8_t)30)
288#define SD_CMD_SD_ERASE_GRP_START ((uint8_t)32)
289#define SD_CMD_SD_ERASE_GRP_END ((uint8_t)33)
290#define SD_CMD_ERASE_GRP_START ((uint8_t)35)
291#define SD_CMD_ERASE_GRP_END ((uint8_t)36)
292#define SD_CMD_ERASE ((uint8_t)38)
293#define SD_CMD_FAST_IO ((uint8_t)39)
294#define SD_CMD_GO_IRQ_STATE ((uint8_t)40)
295#define SD_CMD_LOCK_UNLOCK ((uint8_t)42)
296#define SD_CMD_APP_CMD ((uint8_t)55)
297#define SD_CMD_GEN_CMD ((uint8_t)56)
298#define SD_CMD_NO_CMD ((uint8_t)64)
299
304#define SD_CMD_APP_SD_SET_BUSWIDTH ((uint8_t)6)
305#define SD_CMD_SD_APP_STAUS ((uint8_t)13)
306#define SD_CMD_SD_APP_SEND_NUM_WRITE_BLOCKS ((uint8_t)22)
307#define SD_CMD_SD_APP_OP_COND ((uint8_t)41)
308#define SD_CMD_SD_APP_SET_CLR_CARD_DETECT ((uint8_t)42)
309#define SD_CMD_SD_APP_SEND_SCR ((uint8_t)51)
310#define SD_CMD_SDIO_RW_DIRECT ((uint8_t)52)
311#define SD_CMD_SDIO_RW_EXTENDED ((uint8_t)53)
312
317#define SD_CMD_SD_APP_GET_MKB ((uint8_t)43)
318#define SD_CMD_SD_APP_GET_MID ((uint8_t)44)
319#define SD_CMD_SD_APP_SET_CER_RN1 ((uint8_t)45)
320#define SD_CMD_SD_APP_GET_CER_RN2 ((uint8_t)46)
321#define SD_CMD_SD_APP_SET_CER_RES2 ((uint8_t)47)
322#define SD_CMD_SD_APP_GET_CER_RES1 ((uint8_t)48)
323#define SD_CMD_SD_APP_SECURE_READ_MULTIPLE_BLOCK ((uint8_t)18)
324#define SD_CMD_SD_APP_SECURE_WRITE_MULTIPLE_BLOCK ((uint8_t)25)
325#define SD_CMD_SD_APP_SECURE_ERASE ((uint8_t)38)
326#define SD_CMD_SD_APP_CHANGE_SECURE_AREA ((uint8_t)49)
327#define SD_CMD_SD_APP_SECURE_WRITE_MKB ((uint8_t)48)
328
340#define NULL 0
341#define SDIO_STATIC_FLAGS ((uint32_t)0x000005FF)
342#define SDIO_CMD0TIMEOUT ((uint32_t)0x00010000)
343#define SDIO_DATATIMEOUT ((uint32_t)0xFFFFFFFF)
344
356#define SD_OCR_ADDR_OUT_OF_RANGE ((uint32_t)0x80000000)
357#define SD_OCR_ADDR_MISALIGNED ((uint32_t)0x40000000)
358#define SD_OCR_BLK_LEN_ERR ((uint32_t)0x20000000)
359#define SD_OCR_ERASE_SEQ_ERR ((uint32_t)0x10000000)
360#define SD_OCR_INVALID_ERASE_PARAM ((uint32_t)0x08000000)
361#define SD_OCR_WR_PROTECT_VIOLATION ((uint32_t)0x04000000)
362#define SD_OCR_LOCK_UNLOCK_ERROR ((uint32_t)0x01000000)
363#define SD_OCR_CMD_CRC_ERROR ((uint32_t)0x00800000)
364#define SD_OCR_ILLEGAL_CMD ((uint32_t)0x00400000)
365#define SD_OCR_CARD_ECC_ERROR ((uint32_t)0x00200000)
366#define SD_OCR_CARD_CONTROLLER_ERR ((uint32_t)0x00100000)
367#define SD_OCR_GENERAL_UNKNOWN_ERROR ((uint32_t)0x00080000)
368#define SD_OCR_STREAM_RD_UNDERRUN ((uint32_t)0x00040000)
369#define SD_OCR_STREAM_WR_OVERRUN ((uint32_t)0x00020000)
370#define SD_OCR_CID_CSD_OVERWRIETE ((uint32_t)0x00010000)
371#define SD_OCR_WP_ERASE_SKIP ((uint32_t)0x00008000)
372#define SD_OCR_CARD_ECC_DISABLED ((uint32_t)0x00004000)
373#define SD_OCR_ERASE_RESET ((uint32_t)0x00002000)
374#define MMC_SWITCH_ERROR ((uint32_t)0x00000080)
375#define SD_OCR_AKE_SEQ_ERROR ((uint32_t)0x00000008)
376#define SD_OCR_ERRORBITS ((uint32_t)0xFDFFE008)
377
381#define SD_R5_OUT_OF_RANGE ((uint32_t)0x00000100)
382#define SD_R5_FUNCTION_NUMBER ((uint32_t)0x00000200)
383#define SD_R5_ERROR ((uint32_t)0x00000800)
384
388#define SD_R6_GENERAL_UNKNOWN_ERROR ((uint32_t)0x00002000)
389#define SD_R6_ILLEGAL_CMD ((uint32_t)0x00004000)
390#define SD_R6_CMD_CRC_ERROR ((uint32_t)0x00008000)
391#define SD_VOLTAGE_WINDOW_SD ((uint32_t)0x80100000)
392#define SD_HIGH_CAPACITY ((uint32_t)0x40000000)
393#define SD_STD_CAPACITY ((uint32_t)0x00000000)
394#define SD_CHECK_PATTERN ((uint32_t)0x000001AA)
395#define SD_VOLTAGE_WINDOW_MMC ((uint32_t)0x40FF8000)
396#define SD_MAX_VOLT_TRIAL ((uint32_t)0x000000FF)
397#define SD_ALLZERO ((uint32_t)0x00000000)
398#define SD_WIDE_BUS_SUPPORT ((uint32_t)0x00040000)
399#define SD_SINGLE_BUS_SUPPORT ((uint32_t)0x00010000)
400#define SD_CARD_LOCKED ((uint32_t)0x02000000)
401#define SD_CARD_PROGRAMMING ((uint32_t)0x00000007)
402#define SD_CARD_RECEIVING ((uint32_t)0x00000006)
403#define SD_DATATIMEOUT ((uint32_t)0xFFFFFFFF)
404#define SD_0TO7BITS ((uint32_t)0x000000FF)
405#define SD_8TO15BITS ((uint32_t)0x0000FF00)
406#define SD_16TO23BITS ((uint32_t)0x00FF0000)
407#define SD_24TO31BITS ((uint32_t)0xFF000000)
408#define SD_MAX_DATA_LENGTH ((uint32_t)0x01FFFFFF)
409#define SD_HALFFIFO ((uint32_t)0x00000008)
410#define SD_HALFFIFOBYTES ((uint32_t)0x00000020)
411
423#define SD_CCCC_LOCK_UNLOCK ((uint32_t)0x00000080)
424#define SD_CCCC_WRITE_PROT ((uint32_t)0x00000040)
425#define SD_CCCC_ERASE ((uint32_t)0x00000020)
426
438#define SDIO_SEND_IF_COND ((uint32_t)0x00000008)
439
451#define EXT_CSD_Command_set 0x0
452#define EXT_CSD_Set_bit 0x1
453#define EXT_CSD_Clear_byte 0x2
454#define EXT_CSD_Write_byte 0x3
455
456#define EXT_CSD_CMD_SET_NORMAL (1<<0)
457#define EXT_CSD_CMD_SET_SECURE (1<<1)
458#define EXT_CSD_CMD_SET_CPSECURE (1<<2)
459
463#define EXT_CSD_BUS_WIDTH 183
464#define EXT_CSD_HS_TIMING 185
465
474#define SDIO_INTR_STS_WRITE_MASK (SDIO_DTFAIL_FLAG | SDIO_DTTIMEOUT_FLAG | SDIO_TXERRU_FLAG | \
475 SDIO_DTCMPL_FLAG | SDIO_SBITERR_FLAG)
476#define SDIO_INTR_STS_READ_MASK (SDIO_DTFAIL_FLAG | SDIO_DTTIMEOUT_FLAG | SDIO_RXERRO_FLAG | \
477 SDIO_DTCMPL_FLAG | SDIO_SBITERR_FLAG)
486/* sd exported functions ----------------------------------------*/
487 sd_error_status_type sd_init(void);
488void sdio_clock_set(uint32_t clkdiv);
489 sd_error_status_type sd_power_on(void);
490 sd_error_status_type sd_power_off(void);
491 sd_error_status_type sd_card_init(void);
492 sd_error_status_type sd_card_info_get(sd_card_info_struct_type *card_info);
493 sd_error_status_type sd_wide_bus_operation_config(sdio_bus_width_type mode);
494 sd_error_status_type sd_device_mode_set(uint32_t mode);
495 sd_error_status_type sd_deselect_select(uint32_t addr);
496 sd_error_status_type sd_status_send(uint32_t *p_card_status);
497 sd_card_state_type sd_state_get(void);
498 sd_error_status_type sd_blocks_erase(long long addr, uint32_t nblks);
499 sd_error_status_type sd_block_read(uint8_t *buf, long long addr, uint16_t blk_size);
500 sd_error_status_type sd_mult_blocks_read(uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks);
501 sd_error_status_type sd_block_write(const uint8_t *buf, long long addr, uint16_t blk_size);
502 sd_error_status_type sd_mult_blocks_write(const uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks);
503 sd_error_status_type mmc_stream_read(uint8_t *buf, long long addr, uint32_t len);
504 sd_error_status_type mmc_stream_write(uint8_t *buf, long long addr, uint32_t len);
505 sd_error_status_type sd_irq_service(void);
506void sd_dma_config(uint32_t *mbuf, uint32_t buf_size, dma_dir_type dir);
507
520#ifdef __cplusplus
521}
522#endif
523
524#endif /* __AT32_SDIO_H */
at32f413.h
at32f413 header file
dma_dir_type
dma_dir_type
dma direction type
Definition at32f413_dma.h:215
sd_power_off
sd_error_status_type sd_power_off(void)
turns the sdio output signals off.
Definition emmc_card/src/at32_sdio.c:425
sd_irq_service
sd_error_status_type sd_irq_service(void)
allows to process all the interrupts that are high.
Definition emmc_card/src/at32_sdio.c:1811
sd_device_mode_set
sd_error_status_type sd_device_mode_set(uint32_t mode)
set sdio work mode.
Definition emmc_card/src/at32_sdio.c:808
sd_card_info_get
sd_error_status_type sd_card_info_get(sd_card_info_struct_type *card_info)
returns information about specific card.
Definition emmc_card/src/at32_sdio.c:554
mmc_stream_write
sd_error_status_type mmc_stream_write(uint8_t *buf, long long addr, uint32_t len)
write mmc card data stream.
Definition emmc_card/src/at32_sdio.c:1722
sd_card_init
sd_error_status_type sd_card_init(void)
intialises all cards or single card as the case may be card(s) come into standby state.
Definition emmc_card/src/at32_sdio.c:439
sd_block_read
sd_error_status_type sd_block_read(uint8_t *buf, long long addr, uint16_t blk_size)
allows to read one block from a specified address in a card. the data transfer can be managed by dma ...
Definition emmc_card/src/at32_sdio.c:1210
sd_deselect_select
sd_error_status_type sd_deselect_select(uint32_t addr)
selects od deselects the corresponding card.
Definition emmc_card/src/at32_sdio.c:829
sdio_clock_set
void sdio_clock_set(uint32_t clkdiv)
set sdio clock devision factor.
Definition emmc_card/src/at32_sdio.c:209
sd_blocks_erase
sd_error_status_type sd_blocks_erase(long long addr, uint32_t nblks)
erase continuous data block
Definition emmc_card/src/at32_sdio.c:1052
sd_mult_blocks_write
sd_error_status_type sd_mult_blocks_write(const uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks)
allows to write blocks starting from a specified address in a card. the data transfer can be managed ...
Definition emmc_card/src/at32_sdio.c:1511
sd_state_get
sd_card_state_type sd_state_get(void)
returns information about sd card.
Definition emmc_card/src/at32_sdio.c:2511
sd_dma_config
void sd_dma_config(uint32_t *mbuf, uint32_t buf_size, dma_dir_type dir)
set dma configuation for sdio
Definition emmc_card/src/at32_sdio.c:2799
sd_block_write
sd_error_status_type sd_block_write(const uint8_t *buf, long long addr, uint16_t blk_size)
allows to write one block starting from a specified address in a card. the data transfer can be manag...
Definition emmc_card/src/at32_sdio.c:1389
sd_status_send
sd_error_status_type sd_status_send(uint32_t *p_card_status)
read current card status.
Definition emmc_card/src/at32_sdio.c:2474
sd_init
sd_error_status_type sd_init(void)
initializes the sd card and put it into standby state (ready for data transfer).
Definition emmc_card/src/at32_sdio.c:73
mmc_stream_read
sd_error_status_type mmc_stream_read(uint8_t *buf, long long addr, uint32_t len)
read mmc card data stream.
Definition emmc_card/src/at32_sdio.c:1675
sd_power_on
sd_error_status_type sd_power_on(void)
enquires cards about their operating voltage and configures clock controls.
Definition emmc_card/src/at32_sdio.c:224
sd_mult_blocks_read
sd_error_status_type sd_mult_blocks_read(uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks)
allows to read blocks from a specified address in a card. the data transfer can be managed by dma mod...
Definition emmc_card/src/at32_sdio.c:1299
sd_wide_bus_operation_config
sd_error_status_type sd_wide_bus_operation_config(sdio_bus_width_type mode)
enable wide bus opeartion for the requeseted card if supported by card.
Definition emmc_card/src/at32_sdio.c:765
sd_card_info
sd_card_info_struct_type sd_card_info
Definition emmc_card/src/at32_sdio.c:48
sd_data_transfer_mode_type
sd_data_transfer_mode_type
Definition emmc_card/inc/at32_sdio.h:64
sd_error_status_type
sd_error_status_type
Definition emmc_card/inc/at32_sdio.h:73
sd_card_state_type
sd_card_state_type
Definition emmc_card/inc/at32_sdio.h:186
sdio_bus_width_type
sdio_bus_width_type
sdio bus width
Definition at32f413_sdio.h:138
sd_memory_card_type
sd_memory_card_type
Definition emmc_card/inc/at32_sdio.h:202
SD_TRANSFER_DMA_MODE
@ SD_TRANSFER_DMA_MODE
Definition emmc_card/inc/at32_sdio.h:66
SD_TRANSFER_POLLING_MODE
@ SD_TRANSFER_POLLING_MODE
Definition emmc_card/inc/at32_sdio.h:65
SD_ERROR
@ SD_ERROR
Definition emmc_card/inc/at32_sdio.h:117
SD_WP_ERASE_SKIP
@ SD_WP_ERASE_SKIP
Definition emmc_card/inc/at32_sdio.h:97
SD_SDIO_UNKNOWN_FUNC
@ SD_SDIO_UNKNOWN_FUNC
Definition emmc_card/inc/at32_sdio.h:107
SD_DATA_FAIL
@ SD_DATA_FAIL
Definition emmc_card/inc/at32_sdio.h:76
SD_STREAM_WR_OVERRUN
@ SD_STREAM_WR_OVERRUN
Definition emmc_card/inc/at32_sdio.h:95
SD_INVALID_PARAMETER
@ SD_INVALID_PARAMETER
Definition emmc_card/inc/at32_sdio.h:114
SD_CMD_FAIL
@ SD_CMD_FAIL
Definition emmc_card/inc/at32_sdio.h:75
SD_CMD_OUT_OF_RANGE
@ SD_CMD_OUT_OF_RANGE
Definition emmc_card/inc/at32_sdio.h:82
SD_UNSUPPORTED_HW
@ SD_UNSUPPORTED_HW
Definition emmc_card/inc/at32_sdio.h:116
SD_SDIO_FUNC_ERROR
@ SD_SDIO_FUNC_ERROR
Definition emmc_card/inc/at32_sdio.h:106
SD_INTERNAL_ERROR
@ SD_INTERNAL_ERROR
Definition emmc_card/inc/at32_sdio.h:110
SD_INVALID_ERASE_PARAM
@ SD_INVALID_ERASE_PARAM
Definition emmc_card/inc/at32_sdio.h:86
SD_GENERAL_UNKNOWN_ERROR
@ SD_GENERAL_UNKNOWN_ERROR
Definition emmc_card/inc/at32_sdio.h:93
SD_CARD_ECC_DISABLED
@ SD_CARD_ECC_DISABLED
Definition emmc_card/inc/at32_sdio.h:98
SD_CARD_CONTROLLER_ERR
@ SD_CARD_CONTROLLER_ERR
Definition emmc_card/inc/at32_sdio.h:92
SD_ERASE_RESET
@ SD_ERASE_RESET
Definition emmc_card/inc/at32_sdio.h:99
SD_CARD_ECC_ERROR
@ SD_CARD_ECC_ERROR
Definition emmc_card/inc/at32_sdio.h:91
SD_STREAM_RD_UNDERRUN
@ SD_STREAM_RD_UNDERRUN
Definition emmc_card/inc/at32_sdio.h:94
SD_UNSUPPORTED_FEATURE
@ SD_UNSUPPORTED_FEATURE
Definition emmc_card/inc/at32_sdio.h:115
SD_TX_UNDERRUN
@ SD_TX_UNDERRUN
Definition emmc_card/inc/at32_sdio.h:79
SD_ILLEGAL_CMD
@ SD_ILLEGAL_CMD
Definition emmc_card/inc/at32_sdio.h:90
SD_SDIO_FUNC_BUSY
@ SD_SDIO_FUNC_BUSY
Definition emmc_card/inc/at32_sdio.h:105
SD_CMD_CRC_ERROR
@ SD_CMD_CRC_ERROR
Definition emmc_card/inc/at32_sdio.h:89
SD_ADDR_OUT_OF_RANGE
@ SD_ADDR_OUT_OF_RANGE
Definition emmc_card/inc/at32_sdio.h:102
SD_RX_OVERRUN
@ SD_RX_OVERRUN
Definition emmc_card/inc/at32_sdio.h:80
SD_REQ_PENDING
@ SD_REQ_PENDING
Definition emmc_card/inc/at32_sdio.h:112
SD_REQ_NOT_APPLICABLE
@ SD_REQ_NOT_APPLICABLE
Definition emmc_card/inc/at32_sdio.h:113
SD_SWITCH_ERROR
@ SD_SWITCH_ERROR
Definition emmc_card/inc/at32_sdio.h:103
SD_INVALID_VOLTRANGE
@ SD_INVALID_VOLTRANGE
Definition emmc_card/inc/at32_sdio.h:101
SD_SDIO_DISABLED
@ SD_SDIO_DISABLED
Definition emmc_card/inc/at32_sdio.h:104
SD_DATA_TIMEOUT
@ SD_DATA_TIMEOUT
Definition emmc_card/inc/at32_sdio.h:78
SD_ADDR_MISALIGNED
@ SD_ADDR_MISALIGNED
Definition emmc_card/inc/at32_sdio.h:83
SD_START_BIT_ERR
@ SD_START_BIT_ERR
Definition emmc_card/inc/at32_sdio.h:81
SD_LOCK_UNLOCK_ERROR
@ SD_LOCK_UNLOCK_ERROR
Definition emmc_card/inc/at32_sdio.h:88
SD_NOT_CONFIGURED
@ SD_NOT_CONFIGURED
Definition emmc_card/inc/at32_sdio.h:111
SD_CID_CSD_OVERWRITE
@ SD_CID_CSD_OVERWRITE
Definition emmc_card/inc/at32_sdio.h:96
SD_WR_PROTECT_VIOLATION
@ SD_WR_PROTECT_VIOLATION
Definition emmc_card/inc/at32_sdio.h:87
SD_CMD_RSP_TIMEOUT
@ SD_CMD_RSP_TIMEOUT
Definition emmc_card/inc/at32_sdio.h:77
SD_BLK_LEN_ERR
@ SD_BLK_LEN_ERR
Definition emmc_card/inc/at32_sdio.h:84
SD_OK
@ SD_OK
Definition emmc_card/inc/at32_sdio.h:118
SD_ERASE_SEQ_ERR
@ SD_ERASE_SEQ_ERR
Definition emmc_card/inc/at32_sdio.h:85
SD_AKE_SEQ_ERROR
@ SD_AKE_SEQ_ERROR
Definition emmc_card/inc/at32_sdio.h:100
SD_CARD_TRANSFER
@ SD_CARD_TRANSFER
Definition emmc_card/inc/at32_sdio.h:190
SD_CARD_IDENTIFICATION
@ SD_CARD_IDENTIFICATION
Definition emmc_card/inc/at32_sdio.h:188
SD_CARD_SENDING
@ SD_CARD_SENDING
Definition emmc_card/inc/at32_sdio.h:191
SD_CARD_STANDBY
@ SD_CARD_STANDBY
Definition emmc_card/inc/at32_sdio.h:189
SD_CARD_READY
@ SD_CARD_READY
Definition emmc_card/inc/at32_sdio.h:187
SD_CARD_DISCONNECTED
@ SD_CARD_DISCONNECTED
Definition emmc_card/inc/at32_sdio.h:194
SD_CARD_ERROR
@ SD_CARD_ERROR
Definition emmc_card/inc/at32_sdio.h:195
SDIO_SDIO_CARD
@ SDIO_SDIO_CARD
Definition emmc_card/inc/at32_sdio.h:211
SDIO_HIGH_CAPACITY_SD_CARD
@ SDIO_HIGH_CAPACITY_SD_CARD
Definition emmc_card/inc/at32_sdio.h:205
SDIO_SECURE_DIGITAL_IO_COMBO_CARD
@ SDIO_SECURE_DIGITAL_IO_COMBO_CARD
Definition emmc_card/inc/at32_sdio.h:209
SDIO_HIGH_SPEED_MULTIMEDIA_CARD
@ SDIO_HIGH_SPEED_MULTIMEDIA_CARD
Definition emmc_card/inc/at32_sdio.h:208
SDIO_STD_CAPACITY_SD_CARD_V1_1
@ SDIO_STD_CAPACITY_SD_CARD_V1_1
Definition emmc_card/inc/at32_sdio.h:203
SDIO_SECURE_DIGITAL_IO_CARD
@ SDIO_SECURE_DIGITAL_IO_CARD
Definition emmc_card/inc/at32_sdio.h:207
SDIO_STD_CAPACITY_SD_CARD_V2_0
@ SDIO_STD_CAPACITY_SD_CARD_V2_0
Definition emmc_card/inc/at32_sdio.h:204
SDIO_MULTIMEDIA_CARD
@ SDIO_MULTIMEDIA_CARD
Definition emmc_card/inc/at32_sdio.h:206
SDIO_HIGH_CAPACITY_MMC_CARD
@ SDIO_HIGH_CAPACITY_MMC_CARD
Definition emmc_card/inc/at32_sdio.h:210
SD_CARD_RECEIVING
#define SD_CARD_RECEIVING
Definition emmc_card/inc/at32_sdio.h:402
SD_CARD_PROGRAMMING
#define SD_CARD_PROGRAMMING
Definition emmc_card/inc/at32_sdio.h:401
sd_card_info_struct_type
Definition emmc_card/inc/at32_sdio.h:236
sd_card_info_struct_type::sd_scr_reg
sd_scr_struct_type sd_scr_reg
Definition emmc_card/inc/at32_sdio.h:239
sd_card_info_struct_type::card_capacity
long long card_capacity
Definition emmc_card/inc/at32_sdio.h:240
sd_card_info_struct_type::sd_cid_reg
sd_cid_struct_type sd_cid_reg
Definition emmc_card/inc/at32_sdio.h:238
sd_card_info_struct_type::sd_csd_reg
sd_csd_struct_type sd_csd_reg
Definition emmc_card/inc/at32_sdio.h:237
sd_card_info_struct_type::card_blk_size
uint32_t card_blk_size
Definition emmc_card/inc/at32_sdio.h:241
sd_card_info_struct_type::rca
uint16_t rca
Definition emmc_card/inc/at32_sdio.h:242
sd_card_info_struct_type::card_type
uint8_t card_type
Definition emmc_card/inc/at32_sdio.h:243
sd_cid_struct_type
Definition emmc_card/inc/at32_sdio.h:169
sd_cid_struct_type::reserved1
uint8_t reserved1
Definition emmc_card/inc/at32_sdio.h:176
sd_cid_struct_type::product_name2
uint8_t product_name2
Definition emmc_card/inc/at32_sdio.h:173
sd_cid_struct_type::manufact_date
uint16_t manufact_date
Definition emmc_card/inc/at32_sdio.h:177
sd_cid_struct_type::cid_crc
uint8_t cid_crc
Definition emmc_card/inc/at32_sdio.h:178
sd_cid_struct_type::product_reversion
uint8_t product_reversion
Definition emmc_card/inc/at32_sdio.h:174
sd_cid_struct_type::manufacturer_id
uint8_t manufacturer_id
Definition emmc_card/inc/at32_sdio.h:170
sd_cid_struct_type::product_sn
uint32_t product_sn
Definition emmc_card/inc/at32_sdio.h:175
sd_cid_struct_type::product_name1
uint32_t product_name1
Definition emmc_card/inc/at32_sdio.h:172
sd_cid_struct_type::reserved2
uint8_t reserved2
Definition emmc_card/inc/at32_sdio.h:179
sd_cid_struct_type::oem_app_id
uint16_t oem_app_id
Definition emmc_card/inc/at32_sdio.h:171
sd_csd_struct_type
Definition emmc_card/inc/at32_sdio.h:125
sd_csd_struct_type::spec_version
uint8_t spec_version
Definition emmc_card/inc/at32_sdio.h:127
sd_csd_struct_type::max_write_current_vdd_max
uint8_t max_write_current_vdd_max
Definition emmc_card/inc/at32_sdio.h:143
sd_csd_struct_type::nsac
uint8_t nsac
Definition emmc_card/inc/at32_sdio.h:130
sd_csd_struct_type::card_cmd_classes
uint16_t card_cmd_classes
Definition emmc_card/inc/at32_sdio.h:132
sd_csd_struct_type::part_blk_read
uint8_t part_blk_read
Definition emmc_card/inc/at32_sdio.h:134
sd_csd_struct_type::read_blk_misalign
uint8_t read_blk_misalign
Definition emmc_card/inc/at32_sdio.h:136
sd_csd_struct_type::content_protect_app
uint8_t content_protect_app
Definition emmc_card/inc/at32_sdio.h:154
sd_csd_struct_type::write_speed_factor
uint8_t write_speed_factor
Definition emmc_card/inc/at32_sdio.h:150
sd_csd_struct_type::max_read_blk_length
uint8_t max_read_blk_length
Definition emmc_card/inc/at32_sdio.h:133
sd_csd_struct_type::max_bus_clk_freq
uint8_t max_bus_clk_freq
Definition emmc_card/inc/at32_sdio.h:131
sd_csd_struct_type::ecc_code
uint8_t ecc_code
Definition emmc_card/inc/at32_sdio.h:160
sd_csd_struct_type::reserved4
uint8_t reserved4
Definition emmc_card/inc/at32_sdio.h:162
sd_csd_struct_type::dsr_implemented
uint8_t dsr_implemented
Definition emmc_card/inc/at32_sdio.h:137
sd_csd_struct_type::max_read_current_vdd_min
uint8_t max_read_current_vdd_min
Definition emmc_card/inc/at32_sdio.h:140
sd_csd_struct_type::reserved2
uint8_t reserved2
Definition emmc_card/inc/at32_sdio.h:138
sd_csd_struct_type::erase_group_size_mult
uint8_t erase_group_size_mult
Definition emmc_card/inc/at32_sdio.h:146
sd_csd_struct_type::file_formart
uint8_t file_formart
Definition emmc_card/inc/at32_sdio.h:159
sd_csd_struct_type::temp_write_protect
uint8_t temp_write_protect
Definition emmc_card/inc/at32_sdio.h:158
sd_csd_struct_type::permanent_write_protect
uint8_t permanent_write_protect
Definition emmc_card/inc/at32_sdio.h:157
sd_csd_struct_type::max_read_current_vdd_max
uint8_t max_read_current_vdd_max
Definition emmc_card/inc/at32_sdio.h:141
sd_csd_struct_type::file_format_group
uint8_t file_format_group
Definition emmc_card/inc/at32_sdio.h:155
sd_csd_struct_type::device_size
uint32_t device_size
Definition emmc_card/inc/at32_sdio.h:139
sd_csd_struct_type::write_blk_misalign
uint8_t write_blk_misalign
Definition emmc_card/inc/at32_sdio.h:135
sd_csd_struct_type::csd_struct
uint8_t csd_struct
Definition emmc_card/inc/at32_sdio.h:126
sd_csd_struct_type::write_protect_group_enable
uint8_t write_protect_group_enable
Definition emmc_card/inc/at32_sdio.h:148
sd_csd_struct_type::max_write_current_vdd_min
uint8_t max_write_current_vdd_min
Definition emmc_card/inc/at32_sdio.h:142
sd_csd_struct_type::reserved1
uint8_t reserved1
Definition emmc_card/inc/at32_sdio.h:128
sd_csd_struct_type::max_write_blk_length
uint8_t max_write_blk_length
Definition emmc_card/inc/at32_sdio.h:151
sd_csd_struct_type::csd_crc
uint8_t csd_crc
Definition emmc_card/inc/at32_sdio.h:161
sd_csd_struct_type::write_protect_group_size
uint8_t write_protect_group_size
Definition emmc_card/inc/at32_sdio.h:147
sd_csd_struct_type::reserved3
uint8_t reserved3
Definition emmc_card/inc/at32_sdio.h:153
sd_csd_struct_type::taac
uint8_t taac
Definition emmc_card/inc/at32_sdio.h:129
sd_csd_struct_type::manufacturer_default_ecc
uint8_t manufacturer_default_ecc
Definition emmc_card/inc/at32_sdio.h:149
sd_csd_struct_type::part_blk_write
uint8_t part_blk_write
Definition emmc_card/inc/at32_sdio.h:152
sd_csd_struct_type::copy_flag
uint8_t copy_flag
Definition emmc_card/inc/at32_sdio.h:156
sd_csd_struct_type::erase_group_size
uint8_t erase_group_size
Definition emmc_card/inc/at32_sdio.h:145
sd_csd_struct_type::device_size_mult
uint8_t device_size_mult
Definition emmc_card/inc/at32_sdio.h:144
sd_scr_struct_type
Definition emmc_card/inc/at32_sdio.h:218
sd_scr_struct_type::cmd20_support
uint32_t cmd20_support
Definition emmc_card/inc/at32_sdio.h:226
sd_scr_struct_type::sd_bus_width
uint32_t sd_bus_width
Definition emmc_card/inc/at32_sdio.h:221
sd_scr_struct_type::reserverd3
uint32_t reserverd3
Definition emmc_card/inc/at32_sdio.h:229
sd_scr_struct_type::cmd23_support
uint32_t cmd23_support
Definition emmc_card/inc/at32_sdio.h:227
sd_scr_struct_type::sd_spec3
uint32_t sd_spec3
Definition emmc_card/inc/at32_sdio.h:225
sd_scr_struct_type::data_stat_after_erase
uint32_t data_stat_after_erase
Definition emmc_card/inc/at32_sdio.h:223
sd_scr_struct_type::reserved1
uint32_t reserved1
Definition emmc_card/inc/at32_sdio.h:224
sd_scr_struct_type::scr_structure
uint32_t scr_structure
Definition emmc_card/inc/at32_sdio.h:220
sd_scr_struct_type::sd_security
uint32_t sd_security
Definition emmc_card/inc/at32_sdio.h:222
sd_scr_struct_type::sd_spec
uint32_t sd_spec
Definition emmc_card/inc/at32_sdio.h:219
sd_scr_struct_type::reserverd2
uint32_t reserverd2
Definition emmc_card/inc/at32_sdio.h:228


AT32F413 Firmwary Library: at32_sdio.c Source File

  • sdio
  • emmc_card
  • src
emmc_card/src/at32_sdio.c
Go to the documentation of this file.
1
27#include "at32_sdio.h"
28#include "at32f413_board.h"
29
38 sdio_command_struct_type sdio_command_init_struct;
39 sdio_data_struct_type sdio_data_init_struct;
40
41static sd_memory_card_type card_type = SDIO_STD_CAPACITY_SD_CARD_V1_1; /* sd card type */
42static uint32_t csd_table[4], cid_table[4], rca = 0; /* csd, sid, rca */
43static uint32_t ext_csd_table[128];
44static sd_data_transfer_mode_type device_mode = SD_TRANSFER_POLLING_MODE; /* working mode */
45static uint8_t stop_flag = 0; /* transmit stop flag */
46volatile sd_error_status_type transfer_error = SD_OK; /* transmit error flag */
47volatile uint8_t transfer_end = 0; /* transmit end flag */
48 sd_card_info_struct_type sd_card_info; /* sd card information */
49
50 sd_error_status_type command_error(void);
51 sd_error_status_type command_rsp1_error(uint8_t cmd);
52 sd_error_status_type command_rsp2_error(void);
53 sd_error_status_type command_rsp3_error(void);
54 sd_error_status_type command_rsp4_error(uint8_t cmd);
55 sd_error_status_type command_rsp5_error(uint8_t cmd);
56 sd_error_status_type command_rsp6_error(uint8_t cmd, uint16_t *p_rca);
57 sd_error_status_type command_rsp7_error(void);
58 sd_error_status_type sd_bus_wide_enable(confirm_state new_state);
59 sd_error_status_type mmc_switch(uint8_t set, uint8_t index, uint8_t value);
60 sd_error_status_type sd_switch(uint32_t mode, uint32_t group, uint8_t value, uint8_t *rsp);
61 sd_error_status_type check_card_programming(uint8_t *p_status);
62 sd_error_status_type speed_change(uint8_t speed);
63 sd_error_status_type get_ext_csd(void);
64 sd_error_status_type scr_find(void);
65uint8_t convert_from_bytes_to_power_of_two(uint16_t number_of_bytes);
66
73 sd_error_status_type sd_init(void)
74{
75 uint16_t clkdiv = 0;
76 sd_error_status_type status = SD_OK;
77 gpio_init_type gpio_init_struct = {0};
78 uint8_t retry = 0;
79
80 /* gpioc and gpiod periph clock enable */
81 crm_periph_clock_enable(CRM_GPIOC_PERIPH_CLOCK, TRUE);
82 crm_periph_clock_enable(CRM_GPIOD_PERIPH_CLOCK, TRUE);
83
84 /* sdio periph clock enable */
85 crm_periph_clock_enable(CRM_SDIO1_PERIPH_CLOCK, TRUE);
86
87 /* configure pc.08, pc.09, pc.10, pc.11, pc.12 pin: d0, d1, d2, d3, clk pin */
88 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
89 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
90 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
91 gpio_init_struct.gpio_pins = GPIO_PINS_8 | GPIO_PINS_9 | GPIO_PINS_10 | GPIO_PINS_11 | GPIO_PINS_12;
92 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
93 gpio_init(GPIOC, &gpio_init_struct);
94
95 /* configure pd.02 cmd line */
96 gpio_init_struct.gpio_pins = GPIO_PINS_2;
97 gpio_init(GPIOD, &gpio_init_struct);
98
99 retry = 3;
100 while(retry--){
101 /* reset sdio */
102 sdio_reset(SDIOx);
103 /* power on */
104 status = sd_power_on();
105
106 if(status == SD_OK)
107 break;
108 }
109
110 if(status == SD_OK)
111 {
112 /* sdio card initialize */
113 status = sd_card_init();
114 }
115
116 if(status == SD_OK)
117 {
118 /* get card information*/
119 status = sd_card_info_get(&sd_card_info);
120 }
121
122 if((SDIO_MULTIMEDIA_CARD == card_type) && (sd_card_info.sd_csd_reg.spec_version >= 4))
123 {
124 card_type = SDIO_HIGH_SPEED_MULTIMEDIA_CARD;
125 sd_card_info.card_type = (uint8_t)card_type;
126 }
127
128 if(status == SD_OK)
129 {
130 /* select card */
131 status = sd_deselect_select((uint32_t)(sd_card_info.rca << 16));
132 }
133
134 if(status == SD_OK)
135 {
136 if(SDIO_HIGH_SPEED_MULTIMEDIA_CARD == card_type)
137 {
138 if(sd_card_info.sd_csd_reg.device_size == 0xFFF)
139 {
140 uint32_t sec_count;
141 /* get ext_csd function for support emmc card. */
142 status = get_ext_csd();
143 if(status == SD_OK)
144 {
145 card_type = SDIO_HIGH_CAPACITY_MMC_CARD;
146 sd_card_info.card_type = (uint8_t)card_type;
147 sec_count = ext_csd_table[212/4];
148 sd_card_info.card_capacity = (uint64_t)sec_count*512;
149 }
150 }
151 }
152 }
153
154 if(status == SD_OK && ((SDIO_STD_CAPACITY_SD_CARD_V1_1 == card_type) || (SDIO_STD_CAPACITY_SD_CARD_V2_0 == card_type) || \
155 (SDIO_SECURE_DIGITAL_IO_COMBO_CARD == card_type) || (SDIO_HIGH_CAPACITY_SD_CARD == card_type)))
156 {
157 status = scr_find();
158 }
159
160 if(status == SD_OK)
161 {
162 /* set normal speed */
163 status = speed_change(0);
164 }
165
166 if((status == SD_OK) || (card_type == SDIO_MULTIMEDIA_CARD))
167 {
168 if(sd_card_info.card_type == SDIO_STD_CAPACITY_SD_CARD_V1_1 || sd_card_info.card_type == SDIO_STD_CAPACITY_SD_CARD_V2_0)
169 {
170 /* set sdio_ck to 12mhz */
171 clkdiv = system_core_clock / 12000000;
172
173 if(clkdiv >= 2)
174 {
175 clkdiv -= 2;
176 }
177 }
178 else
179 {
180 /* set sdio_ck to 25mhz */
181 clkdiv = system_core_clock / 25000000;
182
183 if(clkdiv >= 2)
184 {
185 clkdiv -= 2;
186 }
187 }
188 /* set sdio clock divider */
189 sdio_clock_set(clkdiv);
190
191 /* set transfer mode */
192 status = sd_device_mode_set(SD_TRANSFER_DMA_MODE);
193 }
194
195 if(status == SD_OK)
196 {
197 /* Set data width */
198 status = sd_wide_bus_operation_config(SDIO_BUS_WIDTH_D4);
199 }
200
201 return status;
202}
203
209void sdio_clock_set(uint32_t clk_div)
210{
211 /* config clock divide [7:0] */
212 SDIOx->clkctrl_bit.clkdiv_l = (clk_div & 0xFF);
213
214 /* config clock divide [9:8] */
215 SDIOx->clkctrl_bit.clkdiv_h = ((clk_div & 0x300) >> 8);
216}
217
224 sd_error_status_type sd_power_on(void)
225{
226 uint8_t retry = 0;
227 sd_error_status_type status = SD_OK;
228 uint32_t response = 0, count = 0, valid_voltage = 0, clk_psc;
229 uint32_t sd_type = SD_STD_CAPACITY;
230
231 /* sdio_ck is less than 400KHz in initialization stage, set to 200KHz */
232 clk_psc = (system_core_clock / 200000) - 2;
233
234 if(clk_psc > 0x3FF)
235 {
236 clk_psc = 0x3FF;
237 }
238
239 /* config sdio clock divide and edge phase */
240 sdio_clock_config(SDIOx, clk_psc, SDIO_CLOCK_EDGE_FALLING);
241 /* config sdio bus width */
242 sdio_bus_width_config(SDIOx, SDIO_BUS_WIDTH_D1);
243 /* disable flow control */
244 sdio_flow_control_enable(SDIOx, FALSE);
245 /* disable clock bypass */
246 sdio_clock_bypass(SDIOx, FALSE);
247 /* disable power saving mode */
248 sdio_power_saving_mode_enable(SDIOx, FALSE);
249
250 /* sdio power on */
251 sdio_power_set(SDIOx, SDIO_POWER_ON);
252 /* enable to output sdio_ck */
253 sdio_clock_enable(SDIOx, TRUE);
254 delay_ms(10);
255
256 for(retry = 0; retry < 5; retry++)
257 {
258 /* send cmd0, get in idle stage */
259 sdio_command_init_struct.argument = 0x0;
260 sdio_command_init_struct.cmd_index = SD_CMD_GO_IDLE_STATE;
261 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_NO;
262 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
263
264 /* sdio command config */
265 sdio_command_config(SDIOx, &sdio_command_init_struct);
266 /* enable ccsm */
267 sdio_command_state_machine_enable(SDIOx, TRUE);
268
269 /* get command status */
270 status = command_error();
271 }
272
273 /* send cmd8, check card interface feature */
274 sdio_command_init_struct.argument = SD_CHECK_PATTERN;
275 sdio_command_init_struct.cmd_index = SDIO_SEND_IF_COND;
276 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
277 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
278
279 /* sdio command config */
280 sdio_command_config(SDIOx, &sdio_command_init_struct);
281 /* enable ccsm */
282 sdio_command_state_machine_enable(SDIOx, TRUE);
283
284 /* waiting R7 */
285 status = command_rsp7_error();
286
287 if(status == SD_OK)
288 {
289 /* set card type and sd type */
290 card_type = SDIO_STD_CAPACITY_SD_CARD_V2_0;
291 sd_type = SD_HIGH_CAPACITY;
292 }
293
294 /* send cmd55, check sd version */
295 sdio_command_init_struct.argument = 0x00;
296 sdio_command_init_struct.cmd_index = SD_CMD_APP_CMD;
297 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
298 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
299
300 /* sdio command config */
301 sdio_command_config(SDIOx, &sdio_command_init_struct);
302 /* enable ccsm */
303 sdio_command_state_machine_enable(SDIOx, TRUE);
304
305 /* waiting R1 */
306 status = command_rsp1_error(SD_CMD_APP_CMD);
307
308 /* check sd card or mmc card */
309 if(SD_OK == status)
310 {
311 /* send acmd41, check voltage operation range */
312 while((!valid_voltage) && (count < SD_MAX_VOLT_TRIAL))
313 {
314 delay_ms(10);
315
316 /* send cmd55 before acmd41 */
317 sdio_command_init_struct.argument = 0x00;
318 sdio_command_init_struct.cmd_index = SD_CMD_APP_CMD;
319 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
320 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
321
322 /* sdio command config */
323 sdio_command_config(SDIOx, &sdio_command_init_struct);
324 /* enable ccsm */
325 sdio_command_state_machine_enable(SDIOx, TRUE);
326
327 /* waiting R1 */
328 status = command_rsp1_error(SD_CMD_APP_CMD);
329
330 /* if any errors occured, return status */
331 if(status != SD_OK)
332 {
333 return status;
334 }
335
336 /* send acmd41 */
337 sdio_command_init_struct.argument = SD_VOLTAGE_WINDOW_SD | sd_type;
338 sdio_command_init_struct.cmd_index = SD_CMD_SD_APP_OP_COND;
339 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
340 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
341
342 /* sdio command config */
343 sdio_command_config(SDIOx, &sdio_command_init_struct);
344 /* enable ccsm */
345 sdio_command_state_machine_enable(SDIOx, TRUE);
346
347 /* waiting R3 */
348 status = command_rsp3_error();
349
350 /* if any errors occured, return status */
351 if(status != SD_OK)
352 {
353 return status;
354 }
355
356 /* get response1 */
357 response = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
358
359 /* check sd card power on stage is success or not */
360 valid_voltage = (((response >> 31) == 1) ? 1 : 0);
361 count++;
362 }
363
364 if(count >= SD_MAX_VOLT_TRIAL)
365 {
366 status = SD_INVALID_VOLTRANGE;
367 return status;
368 }
369
370 if(response &= SD_HIGH_CAPACITY)
371 {
372 card_type = SDIO_HIGH_CAPACITY_SD_CARD;
373 }
374 }
375 /* mmc card */
376 else
377 {
378 /* send cmd1 */
379 while((!valid_voltage) && (count < SD_MAX_VOLT_TRIAL))
380 {
381 delay_ms(10);
382
383 sdio_command_init_struct.argument = SD_VOLTAGE_WINDOW_MMC;
384 sdio_command_init_struct.cmd_index = SD_CMD_SEND_OP_COND;
385 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
386 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
387
388 /* sdio command config */
389 sdio_command_config(SDIOx, &sdio_command_init_struct);
390 /* enable ccsm */
391 sdio_command_state_machine_enable(SDIOx, TRUE);
392
393 /* waiting R3 */
394 status = command_rsp3_error();
395
396 if(status != SD_OK)
397 {
398 return status;
399 }
400
401 /* get response1 */
402 response = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
403
404 valid_voltage = (((response >> 31) == 1) ? 1 : 0);
405 count++;
406 }
407
408 if(count >= SD_MAX_VOLT_TRIAL)
409 {
410 status = SD_INVALID_VOLTRANGE;
411 return status;
412 }
413
414 card_type = SDIO_MULTIMEDIA_CARD;
415 }
416
417 return(status);
418}
419
425 sd_error_status_type sd_power_off(void)
426{
427 /* sdio power off */
428 sdio_power_set(SDIOx, SDIO_POWER_OFF);
429
430 return SD_OK;
431}
432
439 sd_error_status_type sd_card_init(void)
440{
441 sd_error_status_type status = SD_OK;
442 uint16_t rca_temp = 0x01;
443
444 /* check power status */
445 if(SDIO_POWER_OFF == sdio_power_status_get(SDIOx))
446 {
447 return SD_REQ_NOT_APPLICABLE;
448 }
449
450 /* check is secure_digital_io_card or not */
451 if(SDIO_SECURE_DIGITAL_IO_CARD != card_type)
452 {
453 /* send cmd2, get cid register */
454 sdio_command_init_struct.argument = 0x0;
455 sdio_command_init_struct.cmd_index = SD_CMD_ALL_SEND_CID;
456 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_LONG;
457 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
458
459 /* sdio command config */
460 sdio_command_config(SDIOx, &sdio_command_init_struct);
461 /* enable ccsm */
462 sdio_command_state_machine_enable(SDIOx, TRUE);
463
464 status = command_rsp2_error();
465 if(status != SD_OK)
466 {
467 return status;
468 }
469
470 cid_table[0] = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
471 cid_table[1] = sdio_response_get(SDIOx, SDIO_RSP2_INDEX);
472 cid_table[2] = sdio_response_get(SDIOx, SDIO_RSP3_INDEX);
473 cid_table[3] = sdio_response_get(SDIOx, SDIO_RSP4_INDEX);
474 }
475
476 /* check card type */
477 if((card_type == SDIO_STD_CAPACITY_SD_CARD_V1_1) || (card_type == SDIO_STD_CAPACITY_SD_CARD_V2_0) || \
478 (card_type == SDIO_SECURE_DIGITAL_IO_COMBO_CARD) || (card_type == SDIO_HIGH_CAPACITY_SD_CARD))
479 {
480 /* send cmd3, get rca */
481 sdio_command_init_struct.argument = 0x00;
482 sdio_command_init_struct.cmd_index = SD_CMD_SET_REL_ADDR;
483 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
484 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
485
486 /* sdio command config */
487 sdio_command_config(SDIOx, &sdio_command_init_struct);
488 /* enable ccsm */
489 sdio_command_state_machine_enable(SDIOx, TRUE);
490
491 status = command_rsp6_error(SD_CMD_SET_REL_ADDR, &rca_temp);
492 if(status != SD_OK)
493 {
494 return status;
495 }
496 }
497
498 /* mmc card */
499 if(card_type == SDIO_MULTIMEDIA_CARD)
500 {
501 /* send cmd3 */
502 sdio_command_init_struct.argument = (uint32_t)(rca_temp << 16);
503 sdio_command_init_struct.cmd_index = SD_CMD_SET_REL_ADDR;
504 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
505 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
506
507 /* sdio command config */
508 sdio_command_config(SDIOx, &sdio_command_init_struct);
509 /* enable ccsm */
510 sdio_command_state_machine_enable(SDIOx, TRUE);
511
512 status = command_rsp2_error();
513 if(status != SD_OK)
514 {
515 return status;
516 }
517 }
518
519 /* check is secure_digital_io_card or not */
520 if(card_type != SDIO_SECURE_DIGITAL_IO_CARD)
521 {
522 rca = rca_temp;
523 sdio_command_init_struct.argument = (uint32_t)(rca << 16);
524 sdio_command_init_struct.cmd_index = SD_CMD_SEND_CSD;
525 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_LONG;
526 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
527
528 /* sdio command config */
529 sdio_command_config(SDIOx, &sdio_command_init_struct);
530 /* enable ccsm */
531 sdio_command_state_machine_enable(SDIOx, TRUE);
532
533 status = command_rsp2_error();
534 if(status != SD_OK)
535 {
536 return status;
537 }
538
539 csd_table[0] = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
540 csd_table[1] = sdio_response_get(SDIOx, SDIO_RSP2_INDEX);
541 csd_table[2] = sdio_response_get(SDIOx, SDIO_RSP3_INDEX);
542 csd_table[3] = sdio_response_get(SDIOx, SDIO_RSP4_INDEX);
543 }
544
545 return SD_OK;
546}
547
554 sd_error_status_type sd_card_info_get(sd_card_info_struct_type *card_info)
555{
556 sd_error_status_type status = SD_OK;
557 uint8_t tmp = 0;
558
559 card_info->card_type = (uint8_t)card_type;
560 card_info->rca = (uint16_t)rca;
561
562 /* byte 0 */
563 tmp = (uint8_t)((csd_table[0] & 0xFF000000) >> 24);
564 card_info->sd_csd_reg.csd_struct = (tmp & 0xC0) >> 6;
565 card_info->sd_csd_reg.spec_version = (tmp & 0x3C) >> 2;
566 card_info->sd_csd_reg.reserved1 = tmp & 0x03;
567
568 /* byte 1 */
569 tmp = (uint8_t)((csd_table[0] & 0x00FF0000) >> 16);
570 card_info->sd_csd_reg.taac = tmp;
571
572 /* byte 2 */
573 tmp = (uint8_t)((csd_table[0] & 0x0000FF00) >> 8);
574 card_info->sd_csd_reg.nsac = tmp;
575
576 /* byte 3 */
577 tmp = (uint8_t)(csd_table[0] & 0x000000FF);
578 card_info->sd_csd_reg.max_bus_clk_freq = tmp;
579
580 /* byte 4 */
581 tmp = (uint8_t)((csd_table[1] & 0xFF000000) >> 24);
582 card_info->sd_csd_reg.card_cmd_classes = tmp << 4;
583
584 /* byte 5 */
585 tmp = (uint8_t)((csd_table[1] & 0x00FF0000) >> 16);
586 card_info->sd_csd_reg.card_cmd_classes |= (tmp & 0xF0) >> 4;
587 card_info->sd_csd_reg.max_read_blk_length = tmp & 0x0F;
588
589 /* byte 6 */
590 tmp = (uint8_t)((csd_table[1] & 0x0000FF00) >> 8);
591 card_info->sd_csd_reg.part_blk_read = (tmp & 0x80) >> 7;
592 card_info->sd_csd_reg.write_blk_misalign = (tmp & 0x40) >> 6;
593 card_info->sd_csd_reg.read_blk_misalign = (tmp & 0x20) >> 5;
594 card_info->sd_csd_reg.dsr_implemented = (tmp & 0x10) >> 4;
595 card_info->sd_csd_reg.reserved2 = 0; /* reserved */
596
597 if((card_type == SDIO_STD_CAPACITY_SD_CARD_V1_1) || (card_type == SDIO_STD_CAPACITY_SD_CARD_V2_0) || (card_type == SDIO_MULTIMEDIA_CARD))
598 {
599 card_info->sd_csd_reg.device_size = (tmp & 0x03) << 10;
600
601 /* byte 7 */
602 tmp = (uint8_t)(csd_table[1] & 0x000000FF);
603 card_info->sd_csd_reg.device_size |= (tmp) << 2;
604
605 /* byte 8 */
606 tmp = (uint8_t)((csd_table[2] & 0xFF000000) >> 24);
607 card_info->sd_csd_reg.device_size |= (tmp & 0xC0) >> 6;
608
609 card_info->sd_csd_reg.max_read_current_vdd_min = (tmp & 0x38) >> 3;
610 card_info->sd_csd_reg.max_read_current_vdd_max = (tmp & 0x07);
611
612 /* byte 9 */
613 tmp = (uint8_t)((csd_table[2] & 0x00FF0000) >> 16);
614 card_info->sd_csd_reg.max_write_current_vdd_min = (tmp & 0xE0) >> 5;
615 card_info->sd_csd_reg.max_write_current_vdd_max = (tmp & 0x1C) >> 2;
616 card_info->sd_csd_reg.device_size_mult = (tmp & 0x03) << 1;
617 /* byte 10 */
618 tmp = (uint8_t)((csd_table[2] & 0x0000FF00) >> 8);
619 card_info->sd_csd_reg.device_size_mult |= (tmp & 0x80) >> 7;
620
621 card_info->card_capacity = (card_info->sd_csd_reg.device_size + 1) ;
622 card_info->card_capacity *= (1 << (card_info->sd_csd_reg.device_size_mult + 2));
623 card_info->card_blk_size = 1 << (card_info->sd_csd_reg.max_read_blk_length);
624 card_info->card_capacity *= card_info->card_blk_size;
625 }
626 else if(card_type == SDIO_HIGH_CAPACITY_SD_CARD)
627 {
628 /* byte 7 */
629 tmp = (uint8_t)(csd_table[1] & 0x000000FF);
630 card_info->sd_csd_reg.device_size = (tmp & 0x3F) << 16;
631
632 /* byte 8 */
633 tmp = (uint8_t)((csd_table[2] & 0xFF000000) >> 24);
634
635 card_info->sd_csd_reg.device_size |= (tmp << 8);
636
637 /* byte 9 */
638 tmp = (uint8_t)((csd_table[2] & 0x00FF0000) >> 16);
639
640 card_info->sd_csd_reg.device_size |= (tmp);
641
642 /* byte 10 */
643 tmp = (uint8_t)((csd_table[2] & 0x0000FF00) >> 8);
644
645 card_info->card_capacity = (uint64_t)(card_info->sd_csd_reg.device_size + 1) * 512 * 1024;
646 card_info->card_blk_size = 512;
647 }
648
649
650 card_info->sd_csd_reg.erase_group_size = (tmp & 0x40) >> 6;
651 card_info->sd_csd_reg.erase_group_size_mult = (tmp & 0x3F) << 1;
652
653 /* byte 11 */
654 tmp = (uint8_t)(csd_table[2] & 0x000000FF);
655 card_info->sd_csd_reg.erase_group_size_mult |= (tmp & 0x80) >> 7;
656 card_info->sd_csd_reg.write_protect_group_size = (tmp & 0x7F);
657
658 /* byte 12 */
659 tmp = (uint8_t)((csd_table[3] & 0xFF000000) >> 24);
660 card_info->sd_csd_reg.write_protect_group_enable = (tmp & 0x80) >> 7;
661 card_info->sd_csd_reg.manufacturer_default_ecc = (tmp & 0x60) >> 5;
662 card_info->sd_csd_reg.write_speed_factor = (tmp & 0x1C) >> 2;
663 card_info->sd_csd_reg.max_write_blk_length = (tmp & 0x03) << 2;
664
665 /* byte 13 */
666 tmp = (uint8_t)((csd_table[3] & 0x00FF0000) >> 16);
667 card_info->sd_csd_reg.max_write_blk_length |= (tmp & 0xC0) >> 6;
668 card_info->sd_csd_reg.part_blk_write = (tmp & 0x20) >> 5;
669 card_info->sd_csd_reg.reserved3 = 0;
670 card_info->sd_csd_reg.content_protect_app = (tmp & 0x01);
671
672 /* byte 14 */
673 tmp = (uint8_t)((csd_table[3] & 0x0000FF00) >> 8);
674 card_info->sd_csd_reg.file_format_group = (tmp & 0x80) >> 7;
675 card_info->sd_csd_reg.copy_flag = (tmp & 0x40) >> 6;
676 card_info->sd_csd_reg.permanent_write_protect = (tmp & 0x20) >> 5;
677 card_info->sd_csd_reg.temp_write_protect = (tmp & 0x10) >> 4;
678 card_info->sd_csd_reg.file_formart = (tmp & 0x0C) >> 2;
679 card_info->sd_csd_reg.ecc_code = (tmp & 0x03);
680
681 /* byte 15 */
682 tmp = (uint8_t)(csd_table[3] & 0x000000FF);
683 card_info->sd_csd_reg.csd_crc = (tmp & 0xFE) >> 1;
684 card_info->sd_csd_reg.reserved4 = 1;
685
686 /* byte 0 */
687 tmp = (uint8_t)((cid_table[0] & 0xFF000000) >> 24);
688 card_info->sd_cid_reg.manufacturer_id = tmp;
689
690 /* byte 1 */
691 tmp = (uint8_t)((cid_table[0] & 0x00FF0000) >> 16);
692 card_info->sd_cid_reg.oem_app_id = tmp << 8;
693
694 /* byte 2 */
695 tmp = (uint8_t)((cid_table[0] & 0x000000FF00) >> 8);
696 card_info->sd_cid_reg.oem_app_id |= tmp;
697
698 /* byte 3 */
699 tmp = (uint8_t)(cid_table[0] & 0x000000FF);
700 card_info->sd_cid_reg.product_name1 = tmp << 24;
701
702 /* byte 4 */
703 tmp = (uint8_t)((cid_table[1] & 0xFF000000) >> 24);
704 card_info->sd_cid_reg.product_name1 |= tmp << 16;
705
706 /* byte 5 */
707 tmp = (uint8_t)((cid_table[1] & 0x00FF0000) >> 16);
708 card_info->sd_cid_reg.product_name1 |= tmp << 8;
709
710 /* byte 6 */
711 tmp = (uint8_t)((cid_table[1] & 0x0000FF00) >> 8);
712 card_info->sd_cid_reg.product_name1 |= tmp;
713
714 /* byte 7 */
715 tmp = (uint8_t)(cid_table[1] & 0x000000FF);
716 card_info->sd_cid_reg.product_name2 = tmp;
717
718 /* byte 8 */
719 tmp = (uint8_t)((cid_table[2] & 0xFF000000) >> 24);
720 card_info->sd_cid_reg.product_reversion = tmp;
721
722 /* byte 9 */
723 tmp = (uint8_t)((cid_table[2] & 0x00FF0000) >> 16);
724 card_info->sd_cid_reg.product_sn = tmp << 24;
725
726 /* byte 10 */
727 tmp = (uint8_t)((cid_table[2] & 0x0000FF00) >> 8);
728 card_info->sd_cid_reg.product_sn |= tmp << 16;
729
730 /* byte 11 */
731 tmp = (uint8_t)(cid_table[2] & 0x000000FF);
732 card_info->sd_cid_reg.product_sn |= tmp << 8;
733
734 /* byte 12 */
735 tmp = (uint8_t)((cid_table[3] & 0xFF000000) >> 24);
736 card_info->sd_cid_reg.product_sn |= tmp;
737
738 /* byte 13 */
739 tmp = (uint8_t)((cid_table[3] & 0x00FF0000) >> 16);
740 card_info->sd_cid_reg.reserved1 |= (tmp & 0xF0) >> 4;
741 card_info->sd_cid_reg.manufact_date = (tmp & 0x0F) << 8;
742
743 /* byte 14 */
744 tmp = (uint8_t)((cid_table[3] & 0x0000FF00) >> 8);
745 card_info->sd_cid_reg.manufact_date |= tmp;
746
747 /* byte 15 */
748 tmp = (uint8_t)(cid_table[3] & 0x000000FF);
749 card_info->sd_cid_reg.cid_crc = (tmp & 0xFE) >> 1;
750 card_info->sd_cid_reg.reserved2 = 1;
751
752 return(status);
753}
754
765 sd_error_status_type sd_wide_bus_operation_config(sdio_bus_width_type mode)
766{
767 sd_error_status_type status = SD_OK;
768
769 if(card_type == SDIO_MULTIMEDIA_CARD || card_type == SDIO_HIGH_SPEED_MULTIMEDIA_CARD || card_type == SDIO_HIGH_CAPACITY_MMC_CARD)
770 {
771 status = mmc_switch(EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BUS_WIDTH, (uint8_t)mode);
772 }
773 else if((card_type == SDIO_STD_CAPACITY_SD_CARD_V1_1) || (card_type == SDIO_STD_CAPACITY_SD_CARD_V2_0) || \
774 (card_type == SDIO_HIGH_CAPACITY_SD_CARD))
775 {
776 if(mode >= 2)
777 {
778 /* not support D8 mode */
779 return SD_UNSUPPORTED_FEATURE;
780 }
781
782 if(SDIO_BUS_WIDTH_D4 == mode)
783 {
784 status = sd_bus_wide_enable(TRUE);
785 }
786 else
787 {
788 status = sd_bus_wide_enable(FALSE);
789 }
790 }
791
792 if(status == SD_OK)
793 {
794 sdio_bus_width_config(SDIOx, mode);
795 }
796
797 return status;
798}
799
808 sd_error_status_type sd_device_mode_set(uint32_t mode)
809{
810 sd_error_status_type status = SD_OK;
811
812 if((mode == SD_TRANSFER_DMA_MODE) || (mode == SD_TRANSFER_POLLING_MODE))
813 {
814 device_mode = (sd_data_transfer_mode_type)mode;
815 }
816 else
817 {
818 status = SD_INVALID_PARAMETER;
819 }
820
821 return status;
822}
823
829 sd_error_status_type sd_deselect_select(uint32_t addr)
830{
831 /* send cmd7, select card */
832 sdio_command_init_struct.argument = addr;
833 sdio_command_init_struct.cmd_index = SD_CMD_SEL_DESEL_CARD;
834 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
835 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
836
837 /* sdio command config */
838 sdio_command_config(SDIOx, &sdio_command_init_struct);
839 /* enable ccsm */
840 sdio_command_state_machine_enable(SDIOx, TRUE);
841
842 return command_rsp1_error(SD_CMD_SEL_DESEL_CARD);
843}
844
852 sd_error_status_type sdio_command_data_send(sdio_command_struct_type *sdio_cmd_init_t, \
853 sdio_data_struct_type* sdio_data_init_t, uint32_t *buf)
854{
855 sd_error_status_type status = SD_OK;
856 uint32_t count = 0;
857 uint32_t timeout = SDIO_DATATIMEOUT;
858 uint32_t length = 0;
859
860 if(buf == NULL)
861 {
862 return SD_INVALID_PARAMETER;
863 }
864 /* clear dtctrl register */
865 SDIOx->dtcnt = 0x0;
866
867 /* sdio command config */
868 sdio_data_config(SDIOx, sdio_data_init_t);
869 /* enable dcsm */
870 sdio_data_state_machine_enable(SDIOx, TRUE);
871
872 length = sdio_data_init_t->data_length;
873
874 if(device_mode == SD_TRANSFER_DMA_MODE)
875 {
876 if(sdio_data_init_t->transfer_direction == SDIO_DATA_TRANSFER_TO_CONTROLLER)
877 {
878 transfer_error = SD_OK;
879 transfer_end = 0;
880 sd_dma_config(buf, length, DMA_DIR_PERIPHERAL_TO_MEMORY);
881 SDIOx->inten |= SDIO_INTR_STS_READ_MASK;
882 sdio_dma_enable(SDIOx, TRUE);
883 }
884 }
885
886 /* sdio command config */
887 sdio_command_config(SDIOx, sdio_cmd_init_t);
888 /* enable ccsm */
889 sdio_command_state_machine_enable(SDIOx, TRUE);
890
891 status = command_rsp1_error(sdio_cmd_init_t->cmd_index);
892 if(status != SD_OK)
893 {
894 return status;
895 }
896
897 /* polling mode */
898 if(device_mode == SD_TRANSFER_POLLING_MODE)
899 {
900 if(SDIO_DATA_TRANSFER_TO_CONTROLLER == sdio_data_init_t->transfer_direction)
901 {
902 while(!(SDIOx->sts & (SDIO_INTR_STS_READ_MASK)))
903 {
904 if(sdio_flag_get(SDIOx, SDIO_RXBUFH_FLAG) != RESET)
905 {
906 for(count = 0; count < 8; count++, buf++)
907 {
908 *buf = sdio_data_read(SDIOx);
909 }
910
911 timeout = 0x7FFFFF;
912 }
913 else
914 {
915 if(0 == timeout)
916 {
917 sd_init();
918 return SD_DATA_TIMEOUT;
919 }
920
921 timeout--;
922 }
923 }
924
925 while(sdio_flag_get(SDIOx, SDIO_RXBUF_FLAG) != RESET)
926 {
927 *buf = sdio_data_read(SDIOx);
928 buf++;
929 }
930 }
931 else
932 {
933 while(!(SDIOx->sts & SDIO_INTR_STS_WRITE_MASK))
934 {
935 if(sdio_flag_get(SDIOx, SDIO_TXBUFH_FLAG) != RESET)
936 {
937 for(count = 0; count < 8 && length > 0; count++, buf++, length -= 4)
938 {
939 sdio_data_write(SDIOx, *buf);
940 }
941
942 timeout = 0x3FFFFFFF;
943 }
944 else
945 {
946 if(timeout == 0)
947 {
948 sd_init();
949 return SD_DATA_TIMEOUT;
950 }
951
952 timeout--;
953 }
954 }
955 }
956 /* data timeout */
957 if(sdio_flag_get(SDIOx, SDIO_DTTIMEOUT_FLAG) != RESET)
958 {
959 sdio_flag_clear(SDIOx, SDIO_DTTIMEOUT_FLAG);
960 return SD_DATA_TIMEOUT;
961 }
962 /* crc error */
963 else if(sdio_flag_get(SDIOx, SDIO_DTFAIL_FLAG) != RESET)
964 {
965 sdio_flag_clear(SDIOx, SDIO_DTFAIL_FLAG);
966 return SD_DATA_FAIL;
967 }
968 /* over run error */
969 else if(sdio_flag_get(SDIOx, SDIO_RXERRO_FLAG) != RESET)
970 {
971 sdio_flag_clear(SDIOx, SDIO_RXERRO_FLAG);
972 return SD_RX_OVERRUN;
973 }
974 /* under run error */
975 else if(sdio_flag_get(SDIOx, SDIO_TXERRU_FLAG) != RESET)
976 {
977 sdio_flag_clear(SDIOx, SDIO_TXERRU_FLAG);
978 return SD_TX_UNDERRUN;
979 }
980 /* start bit error */
981 else if(sdio_flag_get(SDIOx, SDIO_SBITERR_FLAG) != RESET)
982 {
983 sdio_flag_clear(SDIOx, SDIO_SBITERR_FLAG);
984 return SD_START_BIT_ERR;
985 }
986 /* data transfer complete */
987 if((stop_flag == 1) && (sdio_flag_get(SDIOx, SDIO_DTCMPL_FLAG) != RESET))
988 {
989 /* send cmd12, stop transmission */
990 sdio_cmd_init_t->argument = 0;
991 sdio_cmd_init_t->cmd_index = SD_CMD_STOP_TRANSMISSION;
992 sdio_cmd_init_t->rsp_type = SDIO_RESPONSE_SHORT;
993 sdio_cmd_init_t->wait_type = SDIO_WAIT_FOR_NO;
994
995 /* sdio command config */
996 sdio_command_config(SDIOx, sdio_cmd_init_t);
997 /* enable ccsm */
998 sdio_command_state_machine_enable(SDIOx, TRUE);
999
1000 status = command_rsp1_error(SD_CMD_STOP_TRANSMISSION);
1001
1002 if(status != SD_OK)
1003 {
1004 return status;
1005 }
1006 }
1007
1008 sdio_flag_clear(SDIOx, SDIO_STATIC_FLAGS);
1009 }
1010 else if(device_mode == SD_TRANSFER_DMA_MODE)
1011 {
1012 if(sdio_data_init_t->transfer_direction == SDIO_DATA_TRANSFER_TO_CARD)
1013 {
1014 transfer_error = SD_OK;
1015 transfer_end = 0;
1016 sd_dma_config(buf, length, DMA_DIR_MEMORY_TO_PERIPHERAL);
1017 SDIOx->inten |= SDIO_INTR_STS_WRITE_MASK;
1018 sdio_dma_enable(SDIOx, TRUE);
1019 }
1020
1021 while(!(SDIOx->sts & SDIOx->inten) && timeout)
1022 {
1023 timeout--;
1024
1025 if(transfer_end)
1026 {
1027 break;
1028 }
1029 }
1030
1031 if(timeout == 0)
1032 {
1033 sd_init();
1034 return SD_DATA_TIMEOUT;
1035 }
1036
1037 if(transfer_error != SD_OK)
1038 {
1039 status = transfer_error;
1040 }
1041 }
1042
1043 return status;
1044}
1045
1052 sd_error_status_type sd_blocks_erase(long long addr, uint32_t nblks)
1053{
1054 sd_error_status_type status = SD_OK;
1055 uint32_t start_addr = 0, end_addr = 0, response = 0;
1056 uint8_t card_state;
1057
1058 /* high capacity sd card */
1059 if(card_type == SDIO_HIGH_CAPACITY_SD_CARD)
1060 {
1061 start_addr = addr >> 9;
1062 end_addr = start_addr + nblks - 1;
1063 }
1064 else
1065 {
1066 start_addr = addr;
1067 end_addr = start_addr + (nblks - 1) * 512;
1068 }
1069
1070 /* clear dcsm configuration */
1071 sdio_data_init_struct.block_size = SDIO_DATA_BLOCK_SIZE_1B;
1072 sdio_data_init_struct.data_length = 0 ;
1073 sdio_data_init_struct.timeout = SD_DATATIMEOUT ;
1074 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CARD;
1075 sdio_data_init_struct.transfer_mode = SDIO_DATA_BLOCK_TRANSFER;
1076
1077 sdio_data_config(SDIOx, &sdio_data_init_struct);
1078 sdio_data_state_machine_enable(SDIOx, FALSE);
1079
1080 response = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
1081
1082 /* check card locked */
1083 if(response & SD_CARD_LOCKED)
1084 {
1085 return SD_LOCK_UNLOCK_ERROR;
1086 }
1087
1088 if(card_type == SDIO_MULTIMEDIA_CARD || card_type == SDIO_HIGH_SPEED_MULTIMEDIA_CARD || card_type == SDIO_HIGH_CAPACITY_MMC_CARD)
1089 {
1090 /* send cmd35, set erase group start */
1091 sdio_command_init_struct.argument = start_addr;
1092 sdio_command_init_struct.cmd_index = SD_CMD_ERASE_GRP_START;
1093 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1094 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1095
1096 /* sdio command config */
1097 sdio_command_config(SDIOx, &sdio_command_init_struct);
1098 /* enable ccsm */
1099 sdio_command_state_machine_enable(SDIOx, TRUE);
1100
1101 status = command_rsp1_error(SD_CMD_ERASE_GRP_START);
1102
1103 if(status != SD_OK)
1104 {
1105 return status;
1106 }
1107
1108 /* send cmd36, set erase group end */
1109 sdio_command_init_struct.argument = end_addr;
1110 sdio_command_init_struct.cmd_index = SD_CMD_ERASE_GRP_END;
1111
1112 /* sdio command config */
1113 sdio_command_config(SDIOx, &sdio_command_init_struct);
1114 /* enable ccsm */
1115 sdio_command_state_machine_enable(SDIOx, TRUE);
1116
1117 status = command_rsp1_error(SD_CMD_ERASE_GRP_END);
1118
1119 if(status != SD_OK)
1120 {
1121 return status;
1122 }
1123
1124 /* send cmd38, start erase gourp */
1125 sdio_command_init_struct.argument = 0;
1126 sdio_command_init_struct.cmd_index = SD_CMD_ERASE;
1127
1128 /* sdio command config */
1129 sdio_command_config(SDIOx, &sdio_command_init_struct);
1130 /* enable ccsm */
1131 sdio_command_state_machine_enable(SDIOx, TRUE);
1132
1133 status = command_rsp1_error(SD_CMD_ERASE);
1134
1135 if(status != SD_OK)
1136 {
1137 return status;
1138 }
1139 }
1140 else
1141 {
1142 /* send cmd32, set erase block start */
1143 sdio_command_init_struct.argument = start_addr;
1144 sdio_command_init_struct.cmd_index = SD_CMD_SD_ERASE_GRP_START;
1145 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1146 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1147
1148 /* sdio command config */
1149 sdio_command_config(SDIOx, &sdio_command_init_struct);
1150 /* enable ccsm */
1151 sdio_command_state_machine_enable(SDIOx, TRUE);
1152
1153 status = command_rsp1_error(SD_CMD_SD_ERASE_GRP_START);
1154
1155 if(status != SD_OK)
1156 {
1157 return status;
1158 }
1159
1160 /* send cmd33, set erase block end */
1161 sdio_command_init_struct.argument = end_addr;
1162 sdio_command_init_struct.cmd_index = SD_CMD_SD_ERASE_GRP_END;
1163
1164 /* sdio command config */
1165 sdio_command_config(SDIOx, &sdio_command_init_struct);
1166 /* enable ccsm */
1167 sdio_command_state_machine_enable(SDIOx, TRUE);
1168
1169 if(status != SD_OK)
1170 {
1171 return status;
1172 }
1173
1174 /* send cmd38, start erase block */
1175 sdio_command_init_struct.argument = 0;
1176 sdio_command_init_struct.cmd_index = SD_CMD_ERASE;
1177
1178 /* sdio command config */
1179 sdio_command_config(SDIOx, &sdio_command_init_struct);
1180 /* enable ccsm */
1181 sdio_command_state_machine_enable(SDIOx, TRUE);
1182
1183 status = command_rsp1_error(SD_CMD_ERASE);
1184
1185 if(status != SD_OK)
1186 {
1187 return status;
1188 }
1189 }
1190
1191 status = check_card_programming(&card_state);
1192
1193 while((status == SD_OK) && ((card_state == SD_CARD_PROGRAMMING) || \
1194 (card_state == SD_CARD_RECEIVING)))
1195 {
1196 status = check_card_programming(&card_state);
1197 }
1198
1199 return status;
1200}
1201
1210 sd_error_status_type sd_block_read(uint8_t *buf, long long addr, uint16_t blk_size)
1211{
1212 sd_error_status_type status = SD_OK;
1213 uint32_t response = 0;
1214 uint8_t power;
1215
1216 if(NULL == buf)
1217 {
1218 return SD_INVALID_PARAMETER;
1219 }
1220
1221 SDIOx->dtctrl = 0x0;
1222
1223 if((card_type == SDIO_HIGH_CAPACITY_SD_CARD) || (card_type == SDIO_HIGH_CAPACITY_MMC_CARD))
1224 {
1225 blk_size = 512;
1226 addr >>= 9;
1227 }
1228
1229 /* clear dcsm configuration */
1230 sdio_data_init_struct.block_size = SDIO_DATA_BLOCK_SIZE_1B;
1231 sdio_data_init_struct.data_length = 0;
1232 sdio_data_init_struct.timeout = SD_DATATIMEOUT;
1233 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CARD;
1234 sdio_data_init_struct.transfer_mode = SDIO_DATA_BLOCK_TRANSFER;
1235
1236 sdio_data_config(SDIOx, &sdio_data_init_struct);
1237 sdio_data_state_machine_enable(SDIOx, FALSE);
1238
1239 response = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
1240
1241 /* check card locked */
1242 if(response & SD_CARD_LOCKED)
1243 {
1244 return SD_LOCK_UNLOCK_ERROR;
1245 }
1246
1247 if((blk_size > 0) && (blk_size <= 2048) && ((blk_size & (blk_size - 1)) == 0))
1248 {
1249 power = convert_from_bytes_to_power_of_two(blk_size);
1250
1251 /* send cmd16, set block size */
1252 sdio_command_init_struct.argument = blk_size;
1253 sdio_command_init_struct.cmd_index = SD_CMD_SET_BLOCKLEN;
1254 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1255 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1256
1257 /* sdio command config */
1258 sdio_command_config(SDIOx, &sdio_command_init_struct);
1259 /* enable ccsm */
1260 sdio_command_state_machine_enable(SDIOx, TRUE);
1261
1262 status = command_rsp1_error(SD_CMD_SET_BLOCKLEN);
1263
1264 if(status != SD_OK)
1265 {
1266 return status;
1267 }
1268 }
1269 else
1270 {
1271 return SD_INVALID_PARAMETER;
1272 }
1273
1274 sdio_data_init_struct.block_size = (sdio_block_size_type)(power);
1275 sdio_data_init_struct.data_length = blk_size ;
1276 sdio_data_init_struct.timeout = SD_DATATIMEOUT ;
1277 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CONTROLLER;
1278 sdio_data_init_struct.transfer_mode = SDIO_DATA_BLOCK_TRANSFER;
1279
1280 sdio_command_init_struct.argument = addr;
1281 sdio_command_init_struct.cmd_index = SD_CMD_READ_SINGLE_BLOCK;
1282 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1283 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1284
1285 stop_flag = 0;
1286
1287 return sdio_command_data_send(&sdio_command_init_struct, &sdio_data_init_struct, (uint32_t *)buf);
1288}
1289
1299 sd_error_status_type sd_mult_blocks_read(uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks)
1300{
1301 sd_error_status_type status = SD_OK;
1302 uint32_t response = 0;
1303 uint8_t power;
1304
1305 SDIOx->dtctrl = 0x0;
1306
1307 if((card_type == SDIO_HIGH_CAPACITY_SD_CARD) || (card_type == SDIO_HIGH_CAPACITY_MMC_CARD))
1308 {
1309 blk_size = 512;
1310 addr >>= 9;
1311 }
1312
1313 /* clear dcsm configuration */
1314 sdio_data_init_struct.block_size = (sdio_block_size_type)0;
1315 sdio_data_init_struct.data_length = 0;
1316 sdio_data_init_struct.timeout = SD_DATATIMEOUT;
1317 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CARD;
1318 sdio_data_init_struct.transfer_mode = SDIO_DATA_BLOCK_TRANSFER;
1319
1320 sdio_data_config(SDIOx, &sdio_data_init_struct);
1321 sdio_data_state_machine_enable(SDIOx, FALSE);
1322
1323 response = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
1324
1325 /* check card locked */
1326 if(response & SD_CARD_LOCKED)
1327 {
1328 return SD_LOCK_UNLOCK_ERROR;
1329 }
1330
1331 if((blk_size > 0) && (blk_size <= 2048) && ((blk_size & (blk_size - 1)) == 0))
1332 {
1333 power = convert_from_bytes_to_power_of_two(blk_size);
1334
1335 /* send cmd16, set block size */
1336 sdio_command_init_struct.argument = blk_size;
1337 sdio_command_init_struct.cmd_index = SD_CMD_SET_BLOCKLEN;
1338 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1339 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1340
1341 /* sdio command config */
1342 sdio_command_config(SDIOx, &sdio_command_init_struct);
1343 /* enable ccsm */
1344 sdio_command_state_machine_enable(SDIOx, TRUE);
1345
1346 status = command_rsp1_error(SD_CMD_SET_BLOCKLEN);
1347
1348 if(status != SD_OK)
1349 {
1350 return status;
1351 }
1352 }
1353 else
1354 {
1355 return SD_INVALID_PARAMETER;
1356 }
1357
1358 /* check max receive length */
1359 if(nblks * blk_size > SD_MAX_DATA_LENGTH)
1360 {
1361 return SD_INVALID_PARAMETER;
1362 }
1363
1364 sdio_data_init_struct.block_size = (sdio_block_size_type)(power);
1365 sdio_data_init_struct.data_length = nblks * blk_size ;
1366 sdio_data_init_struct.timeout = SD_DATATIMEOUT ;
1367 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CONTROLLER;
1368 sdio_data_init_struct.transfer_mode = SDIO_DATA_BLOCK_TRANSFER;
1369
1370 /* send cmd18, read block data */
1371 sdio_command_init_struct.argument = addr;
1372 sdio_command_init_struct.cmd_index = SD_CMD_READ_MULT_BLOCK;
1373 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1374 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1375
1376 stop_flag = 1;
1377
1378 return sdio_command_data_send(&sdio_command_init_struct, &sdio_data_init_struct, (uint32_t *)buf);
1379}
1380
1389 sd_error_status_type sd_block_write(const uint8_t *buf, long long addr, uint16_t blk_size)
1390{
1391 sd_error_status_type status = SD_OK;
1392 uint8_t power = 0, card_state = 0;
1393 uint32_t timeout = 0, card_status = 0, response = 0;
1394
1395 if(buf == NULL)
1396 {
1397 return SD_INVALID_PARAMETER;
1398 }
1399
1400 SDIOx->dtctrl = 0x0;
1401
1402 /* clear dcsm configuration */
1403 sdio_data_init_struct.block_size = (sdio_block_size_type)0;
1404 sdio_data_init_struct.data_length = 0;
1405 sdio_data_init_struct.timeout = SD_DATATIMEOUT;
1406 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CARD;
1407 sdio_data_init_struct.transfer_mode = SDIO_DATA_BLOCK_TRANSFER;
1408
1409 sdio_data_config(SDIOx, &sdio_data_init_struct);
1410 sdio_data_state_machine_enable(SDIOx, FALSE);
1411
1412 response = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
1413
1414 /* check card locked */
1415 if(response & SD_CARD_LOCKED)
1416 {
1417 return SD_LOCK_UNLOCK_ERROR;
1418 }
1419
1420 if((card_type == SDIO_HIGH_CAPACITY_SD_CARD) || (card_type == SDIO_HIGH_CAPACITY_MMC_CARD))
1421 {
1422 blk_size = 512;
1423 addr >>= 9;
1424 }
1425
1426 if((blk_size > 0) && (blk_size <= 2048) && ((blk_size & (blk_size - 1)) == 0))
1427 {
1428 power = convert_from_bytes_to_power_of_two(blk_size);
1429
1430 /* send cmd16, set block size */
1431 sdio_command_init_struct.argument = blk_size;
1432 sdio_command_init_struct.cmd_index = SD_CMD_SET_BLOCKLEN;
1433 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1434 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1435
1436 /* sdio command config */
1437 sdio_command_config(SDIOx, &sdio_command_init_struct);
1438 /* enable ccsm */
1439 sdio_command_state_machine_enable(SDIOx, TRUE);
1440
1441 status = command_rsp1_error(SD_CMD_SET_BLOCKLEN);
1442
1443 if(status != SD_OK)
1444 {
1445 return status;
1446 }
1447 }
1448 else
1449 {
1450 return SD_INVALID_PARAMETER;
1451 }
1452
1453 timeout = SD_DATATIMEOUT;
1454
1455 do
1456 {
1457 timeout--;
1458 status = sd_status_send(&card_status);
1459 }
1460 /* check ready_for_data flag */
1461 while(((card_status & 0x00000100) == 0) && (timeout > 0));
1462
1463 if(timeout == 0)
1464 {
1465 return SD_ERROR;
1466 }
1467
1468 /* send cmd24, write single block */
1469 sdio_command_init_struct.argument = addr;
1470 sdio_command_init_struct.cmd_index = SD_CMD_WRITE_SINGLE_BLOCK;
1471 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1472 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1473
1474 sdio_data_init_struct.block_size = (sdio_block_size_type)(power);
1475 sdio_data_init_struct.data_length = blk_size;
1476 sdio_data_init_struct.timeout = SD_DATATIMEOUT;
1477 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CARD;
1478 sdio_data_init_struct.transfer_mode = SDIO_DATA_BLOCK_TRANSFER;
1479
1480 stop_flag = 0;
1481
1482 /* single block, stop command is unnecessary */
1483 status = sdio_command_data_send(&sdio_command_init_struct, &sdio_data_init_struct, (uint32_t *)buf);
1484
1485 if(status != SD_OK)
1486 {
1487 return status;
1488 }
1489
1490 sdio_flag_clear(SDIOx, SDIO_STATIC_FLAGS);
1491
1492 status = check_card_programming(&card_state);
1493
1494 while((status == SD_OK) && ((card_state == SD_CARD_PROGRAMMING) || (card_state == SD_CARD_RECEIVING)))
1495 {
1496 status = check_card_programming(&card_state);
1497 }
1498
1499 return status;
1500}
1501
1511 sd_error_status_type sd_mult_blocks_write(const uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks)
1512{
1513 sd_error_status_type status = SD_OK;
1514 uint8_t power = 0, card_state = 0;
1515 uint32_t timeout = 0, card_status = 0, response = 0;;
1516
1517 if(buf == NULL)
1518 {
1519 return SD_INVALID_PARAMETER;
1520 }
1521
1522 SDIOx->dtctrl = 0x0;
1523
1524 /* clear dcsm configuration */
1525 sdio_data_init_struct.block_size = (sdio_block_size_type)0;
1526 sdio_data_init_struct.data_length = 0;
1527 sdio_data_init_struct.timeout = SD_DATATIMEOUT;
1528 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CARD;
1529 sdio_data_init_struct.transfer_mode = SDIO_DATA_BLOCK_TRANSFER;
1530
1531 sdio_data_config(SDIOx, &sdio_data_init_struct);
1532 sdio_data_state_machine_enable(SDIOx, FALSE);
1533
1534 response = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
1535
1536 /* check card locked */
1537 if(response & SD_CARD_LOCKED)
1538 {
1539 return SD_LOCK_UNLOCK_ERROR;
1540 }
1541
1542 if((card_type == SDIO_HIGH_CAPACITY_SD_CARD) || (card_type == SDIO_HIGH_CAPACITY_MMC_CARD))
1543 {
1544 blk_size = 512;
1545 addr >>= 9;
1546 }
1547
1548 if((blk_size > 0) && (blk_size <= 2048) && ((blk_size & (blk_size - 1)) == 0))
1549 {
1550 power = convert_from_bytes_to_power_of_two(blk_size);
1551
1552 /* send cmd16, set block size */
1553 sdio_command_init_struct.argument = blk_size;
1554 sdio_command_init_struct.cmd_index = SD_CMD_SET_BLOCKLEN;
1555 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1556 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1557
1558 /* sdio command config */
1559 sdio_command_config(SDIOx, &sdio_command_init_struct);
1560 /* enable ccsm */
1561 sdio_command_state_machine_enable(SDIOx, TRUE);
1562
1563 status = command_rsp1_error(SD_CMD_SET_BLOCKLEN);
1564
1565 if(status != SD_OK)
1566 {
1567 return status;
1568 }
1569 }
1570 else
1571 {
1572 return SD_INVALID_PARAMETER;
1573 }
1574
1575 if((nblks * blk_size) > SD_MAX_DATA_LENGTH)
1576 {
1577 return SD_INVALID_PARAMETER;
1578 }
1579
1580 timeout = SD_DATATIMEOUT;
1581
1582 do
1583 {
1584 timeout--;
1585 status = sd_status_send(&card_status);
1586 }
1587 /* check ready_for_data flag */
1588 while(((card_status & 0x00000100) == 0) && (timeout > 0));
1589
1590 if(timeout == 0)
1591 {
1592 return SD_ERROR;
1593 }
1594
1595 if((card_type == SDIO_STD_CAPACITY_SD_CARD_V1_1) || (card_type == SDIO_STD_CAPACITY_SD_CARD_V2_0) || \
1596 (card_type == SDIO_HIGH_CAPACITY_SD_CARD))
1597 {
1598 /* send cmd55 */
1599 sdio_command_init_struct.argument = (uint32_t)rca << 16;
1600 sdio_command_init_struct.cmd_index = SD_CMD_APP_CMD;
1601 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1602 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1603
1604 /* sdio command config */
1605 sdio_command_config(SDIOx, &sdio_command_init_struct);
1606 /* enable ccsm */
1607 sdio_command_state_machine_enable(SDIOx, TRUE);
1608
1609 status = command_rsp1_error(SD_CMD_APP_CMD);
1610
1611 if(status != SD_OK)
1612 {
1613 return status;
1614 }
1615
1616 /* send cmd23, set block count */
1617 sdio_command_init_struct.argument = blk_size;
1618 sdio_command_init_struct.cmd_index = SD_CMD_SET_BLOCK_COUNT;
1619 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1620 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1621
1622 /* sdio command config */
1623 sdio_command_config(SDIOx, &sdio_command_init_struct);
1624 /* enable ccsm */
1625 sdio_command_state_machine_enable(SDIOx, TRUE);
1626
1627 status = command_rsp1_error(SD_CMD_SET_BLOCK_COUNT);
1628
1629 if(status != SD_OK)
1630 {
1631 return status;
1632 }
1633 }
1634
1635 /* send cmd25, write mult blocks */
1636 sdio_command_init_struct.argument = addr;
1637 sdio_command_init_struct.cmd_index = SD_CMD_WRITE_MULT_BLOCK;
1638 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1639 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1640
1641 sdio_data_init_struct.block_size = (sdio_block_size_type)(power);
1642 sdio_data_init_struct.data_length = nblks * blk_size ;
1643 sdio_data_init_struct.timeout = SD_DATATIMEOUT ;
1644 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CARD;
1645 sdio_data_init_struct.transfer_mode = SDIO_DATA_BLOCK_TRANSFER;
1646
1647 stop_flag = 1;
1648 /* cmd12 is needed */
1649 status = sdio_command_data_send(&sdio_command_init_struct, &sdio_data_init_struct, (uint32_t *)buf);
1650
1651 if(status != SD_OK)
1652 {
1653 return status;
1654 }
1655
1656 sdio_flag_clear(SDIOx, SDIO_STATIC_FLAGS);
1657
1658 status = check_card_programming(&card_state);
1659
1660 while((status == SD_OK) && ((card_state == SD_CARD_PROGRAMMING) || (card_state == SD_CARD_RECEIVING)))
1661 {
1662 status = check_card_programming(&card_state);
1663 }
1664
1665 return status;
1666}
1667
1675 sd_error_status_type mmc_stream_read(uint8_t *buf, long long addr, uint32_t len)
1676{
1677 uint32_t response = 0;
1678
1679 SDIOx->dtctrl = 0x0;
1680
1681 /* clear dcsm configuration */
1682 sdio_data_init_struct.block_size = SDIO_DATA_BLOCK_SIZE_1B;
1683 sdio_data_init_struct.data_length = 0;
1684 sdio_data_init_struct.timeout = SD_DATATIMEOUT ;
1685 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CARD;
1686 sdio_data_init_struct.transfer_mode = SDIO_DATA_STREAM_TRANSFER;
1687
1688 sdio_data_config(SDIOx, &sdio_data_init_struct);
1689 sdio_data_state_machine_enable(SDIOx, FALSE);
1690
1691 response = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
1692
1693 /* check card locked */
1694 if(response & SD_CARD_LOCKED)
1695 {
1696 return SD_LOCK_UNLOCK_ERROR;
1697 }
1698 /* send cmd11, read data */
1699 sdio_command_init_struct.argument = addr;
1700 sdio_command_init_struct.cmd_index = SD_CMD_READ_DAT_UNTIL_STOP;
1701 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1702 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1703
1704 sdio_data_init_struct.block_size = SDIO_DATA_BLOCK_SIZE_1B;
1705 sdio_data_init_struct.data_length = len;
1706 sdio_data_init_struct.timeout = SD_DATATIMEOUT ;
1707 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CONTROLLER;
1708 sdio_data_init_struct.transfer_mode = SDIO_DATA_STREAM_TRANSFER;
1709
1710 stop_flag = 1;
1711 /* cmd12 is needed */
1712 return sdio_command_data_send(&sdio_command_init_struct, &sdio_data_init_struct, (uint32_t *)buf);
1713}
1714
1722 sd_error_status_type mmc_stream_write(uint8_t *buf, long long addr, uint32_t len)
1723{
1724 sd_error_status_type status = SD_OK;
1725 uint32_t response = 0;
1726 uint8_t card_state = 0;
1727
1728 if(buf == NULL)
1729 {
1730 return SD_INVALID_PARAMETER;
1731 }
1732
1733 SDIOx->dtctrl = 0x0;
1734
1735 /* clear dcsm configuration */
1736 sdio_data_init_struct.block_size = SDIO_DATA_BLOCK_SIZE_1B;
1737 sdio_data_init_struct.data_length = 0;
1738 sdio_data_init_struct.timeout = SD_DATATIMEOUT;
1739 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CARD;
1740 sdio_data_init_struct.transfer_mode = SDIO_DATA_STREAM_TRANSFER;
1741
1742 sdio_data_config(SDIOx, &sdio_data_init_struct);
1743 sdio_data_state_machine_enable(SDIOx, FALSE);
1744
1745 response = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
1746
1747 /* check card locked */
1748 if(response & SD_CARD_LOCKED)
1749 {
1750 return SD_LOCK_UNLOCK_ERROR;
1751 }
1752 /* send cmd20, write data */
1753 sdio_command_init_struct.argument = addr;
1754 sdio_command_init_struct.cmd_index = SD_CMD_WRITE_DAT_UNTIL_STOP;
1755 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1756 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1757
1758
1759 sdio_data_init_struct.block_size = SDIO_DATA_BLOCK_SIZE_1B;
1760 sdio_data_init_struct.data_length = len;
1761 sdio_data_init_struct.timeout = SD_DATATIMEOUT ;
1762 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CARD;
1763 sdio_data_init_struct.transfer_mode = SDIO_DATA_STREAM_TRANSFER;
1764
1765 stop_flag = 1;
1766 /* cmd12 is needed */
1767 status = sdio_command_data_send(&sdio_command_init_struct, &sdio_data_init_struct, (uint32_t *)buf);
1768
1769 if(status != SD_OK)
1770 {
1771 return status;
1772 }
1773
1774 sdio_flag_clear(SDIOx, SDIO_STATIC_FLAGS);
1775
1776 status = check_card_programming(&card_state);
1777
1778 while((status == SD_OK) && ((card_state == SD_CARD_PROGRAMMING) || (card_state == SD_CARD_RECEIVING)))
1779 {
1780 status = check_card_programming(&card_state);
1781 }
1782
1783 return status;
1784}
1785
1791void SDIO1_IRQHandler(void)
1792{
1793 sd_irq_service();
1794}
1795
1801void SDIO2_IRQHandler(void)
1802{
1803 sd_irq_service();
1804}
1805
1811 sd_error_status_type sd_irq_service(void)
1812{
1813 if(sdio_interrupt_flag_get(SDIOx, SDIO_DTCMPL_FLAG) != RESET)
1814 {
1815 if(stop_flag == 1)
1816 {
1817 /* send cmd12, stop transmission */
1818 sdio_command_init_struct.argument = 0;
1819 sdio_command_init_struct.cmd_index = SD_CMD_STOP_TRANSMISSION;
1820 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1821 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1822 /* sdio command config */
1823 sdio_command_config(SDIOx, &sdio_command_init_struct);
1824 /* enable ccsm */
1825 sdio_command_state_machine_enable(SDIOx, TRUE);
1826 transfer_error = command_rsp1_error(SD_CMD_STOP_TRANSMISSION);
1827 }
1828 else
1829 {
1830 transfer_error = SD_OK;
1831 }
1832 /* clear flag */
1833 sdio_flag_clear(SDIOx, SDIO_DTCMPL_FLAG);
1834 transfer_end = 1;
1835 return transfer_error;
1836 }
1837
1838 if(sdio_interrupt_flag_get(SDIOx, SDIO_DTFAIL_FLAG) != RESET)
1839 {
1840 /* clear flag */
1841 sdio_flag_clear(SDIOx, SDIO_DTFAIL_FLAG);
1842 transfer_error = SD_DATA_FAIL;
1843 transfer_end = 1;
1844 return transfer_error;
1845 }
1846
1847 if(sdio_interrupt_flag_get(SDIOx, SDIO_DTTIMEOUT_FLAG) != RESET)
1848 {
1849 /* clear flag */
1850 sdio_flag_clear(SDIOx, SDIO_DTTIMEOUT_FLAG);
1851 transfer_error = SD_DATA_TIMEOUT;
1852 transfer_end = 1;
1853 return transfer_error;
1854 }
1855
1856 if(sdio_interrupt_flag_get(SDIOx, SDIO_RXERRO_FLAG) != RESET)
1857 {
1858 /* clear flag */
1859 sdio_flag_clear(SDIOx, SDIO_RXERRO_FLAG);
1860 transfer_error = SD_RX_OVERRUN;
1861 transfer_end = 1;
1862 return(SD_RX_OVERRUN);
1863 }
1864
1865 if(sdio_interrupt_flag_get(SDIOx, SDIO_TXERRU_FLAG) != RESET)
1866 {
1867 /* clear flag */
1868 sdio_flag_clear(SDIOx, SDIO_TXERRU_FLAG);
1869 transfer_error = SD_TX_UNDERRUN;
1870 transfer_end = 1;
1871 return(SD_TX_UNDERRUN);
1872 }
1873
1874 if(sdio_interrupt_flag_get(SDIOx, SDIO_SBITERR_FLAG) != RESET)
1875 {
1876 /* clear flag */
1877 sdio_flag_clear(SDIOx, SDIO_SBITERR_FLAG);
1878 transfer_error = SD_START_BIT_ERR;
1879 transfer_end = 1;
1880 return(SD_START_BIT_ERR);
1881 }
1882
1883 /* disable interrupt */
1884 sdio_interrupt_enable(SDIOx, (SDIO_DTFAIL_INT | SDIO_DTTIMEOUT_INT | \
1885 SDIO_DTCMP_INT | SDIO_TXBUFH_INT | SDIO_RXBUFH_INT | \
1886 SDIO_TXERRU_INT| SDIO_RXERRO_INT | SDIO_SBITERR_INT), FALSE);
1887 return(SD_OK);
1888}
1889
1895 sd_error_status_type command_error(void)
1896{
1897 sd_error_status_type status = SD_OK;
1898 uint32_t timeout = SDIO_CMD0TIMEOUT;
1899
1900 while(timeout--)
1901 {
1902 if(sdio_flag_get(SDIOx, SDIO_CMDCMPL_FLAG) != RESET)
1903 {
1904 break;
1905 }
1906 }
1907
1908 if(timeout == 0)
1909 {
1910 return SD_CMD_RSP_TIMEOUT;
1911 }
1912
1913 sdio_flag_clear(SDIOx, SDIO_STATIC_FLAGS);
1914 return status;
1915}
1916
1922 sd_error_status_type command_rsp7_error(void)
1923{
1924 sd_error_status_type status = SD_OK;
1925 uint32_t sts_reg = 0;
1926 uint32_t timeout = SDIO_CMD0TIMEOUT;
1927
1928 while(timeout--)
1929 {
1930 sts_reg = SDIOx->sts;
1931
1932 if(sts_reg & (SDIO_CMDFAIL_FLAG | SDIO_CMDTIMEOUT_FLAG | SDIO_CMDRSPCMPL_FLAG))
1933 {
1934 break;
1935 }
1936 }
1937
1938 if((timeout == 0) || (sts_reg & SDIO_CMDTIMEOUT_FLAG))
1939 {
1940 status = SD_CMD_RSP_TIMEOUT;
1941 sdio_flag_clear(SDIOx, SDIO_CMDTIMEOUT_FLAG);
1942 return status;
1943 }
1944
1945 if(sts_reg & SDIO_CMDRSPCMPL_FLAG)
1946 {
1947 status = SD_OK;
1948 sdio_flag_clear(SDIOx, SDIO_CMDRSPCMPL_FLAG);
1949 }
1950
1951 return status;
1952}
1953
1959 sd_error_status_type command_rsp1_error(uint8_t cmd)
1960{
1961 uint32_t sts_reg = 0;
1962 uint32_t rsp_cmd = 0;
1963
1964 while(1)
1965 {
1966 sts_reg = SDIOx->sts;
1967
1968 if(sts_reg & (SDIO_CMDFAIL_FLAG | SDIO_CMDTIMEOUT_FLAG | SDIO_CMDRSPCMPL_FLAG))
1969 {
1970 break;
1971 }
1972 }
1973
1974 if(sdio_flag_get(SDIOx, SDIO_CMDTIMEOUT_FLAG) != RESET)
1975 {
1976 sdio_flag_clear(SDIOx, SDIO_CMDTIMEOUT_FLAG);
1977 return SD_CMD_RSP_TIMEOUT;
1978 }
1979
1980 if(sdio_flag_get(SDIOx, SDIO_CMDFAIL_FLAG) != RESET)
1981 {
1982 sdio_flag_clear(SDIOx, SDIO_CMDFAIL_FLAG);
1983 return SD_CMD_FAIL;
1984 }
1985
1986 rsp_cmd = sdio_command_response_get(SDIOx);
1987 if(rsp_cmd != cmd)
1988 {
1989 return SD_ILLEGAL_CMD;
1990 }
1991
1992 sdio_flag_clear(SDIOx, SDIO_STATIC_FLAGS);
1993
1994 return (sd_error_status_type)(sdio_response_get(SDIOx, SDIO_RSP1_INDEX) & SD_OCR_ERRORBITS);
1995}
1996
2002 sd_error_status_type command_rsp3_error(void)
2003{
2004 uint32_t sts_reg = 0;;
2005
2006 while(1)
2007 {
2008 sts_reg = SDIOx->sts;
2009
2010 if(sts_reg & (SDIO_CMDFAIL_FLAG | SDIO_CMDTIMEOUT_FLAG | SDIO_CMDRSPCMPL_FLAG))
2011 {
2012 break;
2013 }
2014 }
2015
2016 if(sdio_flag_get(SDIOx, SDIO_CMDTIMEOUT_FLAG) != RESET)
2017 {
2018 sdio_flag_clear(SDIOx, SDIO_CMDTIMEOUT_FLAG);
2019 return SD_CMD_RSP_TIMEOUT;
2020 }
2021
2022 sdio_flag_clear(SDIOx, SDIO_STATIC_FLAGS);
2023
2024 return SD_OK;
2025}
2026
2032 sd_error_status_type command_rsp2_error(void)
2033{
2034 sd_error_status_type status = SD_OK;
2035 uint32_t sts_reg;
2036 uint32_t timeout = SDIO_CMD0TIMEOUT;
2037
2038 while(timeout--)
2039 {
2040 sts_reg = SDIOx->sts;
2041
2042 if(sts_reg & (SDIO_CMDFAIL_FLAG | SDIO_CMDTIMEOUT_FLAG | SDIO_CMDRSPCMPL_FLAG))
2043 {
2044 break;
2045 }
2046 }
2047
2048 if((timeout == 0) || sdio_flag_get(SDIOx, SDIO_CMDTIMEOUT_FLAG) != RESET)
2049 {
2050 status = SD_CMD_RSP_TIMEOUT;
2051 sdio_flag_clear(SDIOx, SDIO_CMDTIMEOUT_FLAG);
2052
2053 return status;
2054 }
2055
2056 if(sdio_flag_get(SDIOx, SDIO_CMDFAIL_FLAG) != RESET)
2057 {
2058 status = SD_CMD_FAIL;
2059 sdio_flag_clear(SDIOx, SDIO_CMDFAIL_FLAG);
2060 }
2061
2062 sdio_flag_clear(SDIOx, SDIO_STATIC_FLAGS);
2063
2064 return status;
2065}
2066
2072 sd_error_status_type command_rsp4_error(uint8_t cmd)
2073{
2074 uint32_t sts_reg = 0, rsp_cmd = 0;
2075
2076 while(1)
2077 {
2078 sts_reg = SDIOx->sts;
2079
2080 if(sts_reg & (SDIO_CMDFAIL_FLAG | SDIO_CMDTIMEOUT_FLAG | SDIO_CMDRSPCMPL_FLAG))
2081 {
2082 break;
2083 }
2084 }
2085
2086 if(sdio_flag_get(SDIOx, SDIO_CMDTIMEOUT_FLAG) != RESET)
2087 {
2088 sdio_flag_clear(SDIOx, SDIO_CMDTIMEOUT_FLAG);
2089 return SD_CMD_RSP_TIMEOUT;
2090 }
2091
2092 if(sdio_flag_get(SDIOx, SDIO_CMDFAIL_FLAG) != RESET)
2093 {
2094 sdio_flag_clear(SDIOx, SDIO_CMDFAIL_FLAG);
2095
2096 return SD_CMD_FAIL;
2097 }
2098
2099 rsp_cmd = sdio_command_response_get(SDIOx);
2100 if(rsp_cmd != cmd)
2101 {
2102 return SD_ILLEGAL_CMD;
2103 }
2104
2105 sdio_flag_clear(SDIOx, SDIO_STATIC_FLAGS);
2106
2107 return SD_OK;
2108}
2109
2115 sd_error_status_type command_rsp5_error(uint8_t cmd)
2116{
2117 uint32_t sts_reg = 0, rsp_cmd = 0, response = 0;
2118
2119 while(1)
2120 {
2121 sts_reg = SDIOx->sts;
2122
2123 if(sts_reg & (SDIO_CMDFAIL_FLAG | SDIO_CMDTIMEOUT_FLAG | SDIO_CMDRSPCMPL_FLAG))
2124 {
2125 break;
2126 }
2127 }
2128
2129 if(sdio_flag_get(SDIOx, SDIO_CMDTIMEOUT_FLAG) != RESET)
2130 {
2131 sdio_flag_clear(SDIOx, SDIO_CMDTIMEOUT_FLAG);
2132
2133 return SD_CMD_RSP_TIMEOUT;
2134 }
2135
2136 if(sdio_flag_get(SDIOx, SDIO_CMDFAIL_FLAG) != RESET)
2137 {
2138 sdio_flag_clear(SDIOx, SDIO_CMDFAIL_FLAG);
2139
2140 return SD_CMD_FAIL;
2141 }
2142
2143 rsp_cmd = sdio_command_response_get(SDIOx);
2144 if(rsp_cmd != cmd)
2145 {
2146 return SD_ILLEGAL_CMD;
2147 }
2148
2149 sdio_flag_clear(SDIOx, SDIO_STATIC_FLAGS);
2150
2151 response = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
2152
2153 if(response & SD_R5_OUT_OF_RANGE)
2154 {
2155 return SD_CMD_OUT_OF_RANGE;
2156 }
2157
2158 if(response & SD_R5_FUNCTION_NUMBER)
2159 {
2160 return SD_SDIO_UNKNOWN_FUNC;
2161 }
2162
2163 if(response & SD_R5_ERROR)
2164 {
2165 return SD_GENERAL_UNKNOWN_ERROR;
2166 }
2167
2168 return SD_OK;
2169}
2170
2178 sd_error_status_type command_rsp6_error(uint8_t cmd, uint16_t *prca)
2179{
2180 sd_error_status_type status = SD_OK;
2181 uint32_t sts_reg, rsp_cmd = 0, response = 0;
2182
2183 while(1)
2184 {
2185 sts_reg = SDIOx->sts;
2186
2187 if(sts_reg & (SDIO_CMDFAIL_FLAG | SDIO_CMDTIMEOUT_FLAG | SDIO_CMDRSPCMPL_FLAG))
2188 {
2189 break;
2190 }
2191 }
2192
2193 if(sdio_flag_get(SDIOx, SDIO_CMDTIMEOUT_FLAG) != RESET)
2194 {
2195 sdio_flag_clear(SDIOx, SDIO_CMDTIMEOUT_FLAG);
2196 return SD_CMD_RSP_TIMEOUT;
2197 }
2198
2199 if(sdio_flag_get(SDIOx, SDIO_CMDFAIL_FLAG) != RESET)
2200 {
2201 sdio_flag_clear(SDIOx, SDIO_CMDFAIL_FLAG);
2202 return SD_CMD_FAIL;
2203 }
2204
2205 rsp_cmd = sdio_command_response_get(SDIOx);
2206 if(rsp_cmd != cmd)
2207 {
2208 return SD_ILLEGAL_CMD;
2209 }
2210
2211 sdio_flag_clear(SDIOx, SDIO_STATIC_FLAGS);
2212
2213 response = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
2214
2215 if(SD_ALLZERO == (response & (SD_R6_GENERAL_UNKNOWN_ERROR | SD_R6_ILLEGAL_CMD | SD_R6_CMD_CRC_ERROR)))
2216 {
2217 *prca = (uint16_t)(response >> 16);
2218 return status;
2219 }
2220
2221 if(response & SD_R6_GENERAL_UNKNOWN_ERROR)
2222 {
2223 return SD_GENERAL_UNKNOWN_ERROR;
2224 }
2225
2226 if(response & SD_R6_ILLEGAL_CMD)
2227 {
2228 return SD_ILLEGAL_CMD;
2229 }
2230
2231 if(response & SD_R6_CMD_CRC_ERROR)
2232 {
2233 return SD_CMD_CRC_ERROR;
2234 }
2235
2236 return status;
2237}
2238
2244 sd_error_status_type sd_bus_wide_enable(confirm_state new_state)
2245{
2246 sd_error_status_type status = SD_OK;
2247 uint32_t response = 0;
2248 uint8_t arg = 0x00;
2249
2250 if(new_state == TRUE)
2251 {
2252 arg = 0x02;
2253 }
2254 else
2255 {
2256 arg = 0x00;
2257 }
2258
2259 /* get response1 */
2260 response = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
2261
2262 /* check card locked or not */
2263 if(response & SD_CARD_LOCKED)
2264 {
2265 return SD_LOCK_UNLOCK_ERROR;
2266 }
2267
2268 if(sd_card_info.sd_scr_reg.sd_bus_width)
2269 {
2270 sdio_command_init_struct.argument = (uint32_t)(sd_card_info.rca << 16);
2271 sdio_command_init_struct.cmd_index = SD_CMD_APP_CMD;
2272 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
2273 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
2274
2275 /* sdio command config */
2276 sdio_command_config(SDIOx, &sdio_command_init_struct);
2277 /* enable ccsm */
2278 sdio_command_state_machine_enable(SDIOx, TRUE);
2279
2280 status = command_rsp1_error(SD_CMD_APP_CMD);
2281
2282 if(status != SD_OK)
2283 {
2284 return status;
2285 }
2286
2287 sdio_command_init_struct.argument = arg;
2288 sdio_command_init_struct.cmd_index = SD_CMD_APP_SD_SET_BUSWIDTH;
2289 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
2290 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
2291
2292 /* sdio command config */
2293 sdio_command_config(SDIOx, &sdio_command_init_struct);
2294 /* enable ccsm */
2295 sdio_command_state_machine_enable(SDIOx, TRUE);
2296
2297 status = command_rsp1_error(SD_CMD_APP_SD_SET_BUSWIDTH);
2298 return status;
2299 }
2300 else
2301 {
2302 return SD_REQ_NOT_APPLICABLE;
2303 }
2304}
2305
2313 sd_error_status_type mmc_switch(uint8_t set, uint8_t index, uint8_t value)
2314{
2315 sd_error_status_type status = SD_OK;
2316 uint32_t card_status = 0, timeout = 0;
2317
2318 sdio_command_init_struct.argument = (EXT_CSD_Write_byte << 24) | (index << 16) | (value << 8) | set;
2319 sdio_command_init_struct.cmd_index = SD_CMD_HS_SWITCH;
2320 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
2321 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
2322
2323 /* sdio command config */
2324 sdio_command_config(SDIOx, &sdio_command_init_struct);
2325 /* enable ccsm */
2326 sdio_command_state_machine_enable(SDIOx, TRUE);
2327
2328 status = command_rsp1_error(SD_CMD_HS_SWITCH);
2329 if(status != SD_OK)
2330 {
2331 return status;
2332 }
2333
2334 card_status = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
2335 if(card_status & MMC_SWITCH_ERROR)
2336 {
2337 return SD_SWITCH_ERROR;
2338 }
2339
2340 timeout = SD_DATATIMEOUT;
2341 do
2342 {
2343 timeout--;
2344 status = sd_status_send(&card_status);
2345 } /* check ready_for_data flag */
2346 while(((card_status & 0x00000100) == 0) && (timeout > 0));
2347
2348 if(timeout == 0)
2349 {
2350 return SD_ERROR;
2351 }
2352
2353 return status;
2354}
2355
2364 sd_error_status_type sd_switch(uint32_t mode, uint32_t group, uint8_t value, uint8_t *rsp)
2365{
2366 sd_error_status_type status = SD_OK;
2367 uint8_t power;
2368 uint16_t blk_size;
2369
2370 if(rsp == NULL)
2371 {
2372 return SD_INVALID_PARAMETER;
2373 }
2374
2375 SDIOx->dtctrl = 0x0;
2376
2377 blk_size = 64;
2378 power = convert_from_bytes_to_power_of_two(blk_size);
2379
2380 sdio_command_init_struct.argument = blk_size;
2381 sdio_command_init_struct.cmd_index = SD_CMD_SET_BLOCKLEN;
2382 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
2383 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
2384
2385 /* sdio command config */
2386 sdio_command_config(SDIOx, &sdio_command_init_struct);
2387 /* enable ccsm */
2388 sdio_command_state_machine_enable(SDIOx, TRUE);
2389
2390 status = command_rsp1_error(SD_CMD_SET_BLOCKLEN);
2391
2392 if(status != SD_OK)
2393 {
2394 return status;
2395 }
2396
2397 sdio_data_init_struct.block_size = (sdio_block_size_type)(power);
2398 sdio_data_init_struct.data_length = blk_size ;
2399 sdio_data_init_struct.timeout = SD_DATATIMEOUT ;
2400 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CONTROLLER;
2401 sdio_data_init_struct.transfer_mode = SDIO_DATA_BLOCK_TRANSFER;
2402
2403 sdio_command_init_struct.argument = (mode << 31) | 0x00FFFFFF;
2404 sdio_command_init_struct.argument &= ~(0xF << (group * 4));
2405 sdio_command_init_struct.argument |= value << (group * 4);
2406 sdio_command_init_struct.cmd_index = SD_CMD_HS_SWITCH;
2407 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
2408 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
2409
2410 stop_flag = 0;
2411
2412 return sdio_command_data_send(&sdio_command_init_struct, &sdio_data_init_struct, (uint32_t *)rsp);
2413}
2414
2420 sd_error_status_type check_card_programming(uint8_t *p_status)
2421{
2422 volatile uint32_t response = 0, sts_reg = 0, rsp_cmd = 0;
2423
2424 /* send cmd13 */
2425 sdio_command_init_struct.argument = (uint32_t)(rca << 16);
2426 sdio_command_init_struct.cmd_index = SD_CMD_SEND_STATUS;
2427 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
2428 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
2429
2430 /* sdio command config */
2431 sdio_command_config(SDIOx, &sdio_command_init_struct);
2432 /* enable ccsm */
2433 sdio_command_state_machine_enable(SDIOx, TRUE);
2434
2435 sts_reg = SDIOx->sts;
2436
2437 while(!(sts_reg & (SDIO_CMDFAIL_FLAG | SDIO_CMDTIMEOUT_FLAG | SDIO_CMDRSPCMPL_FLAG)))
2438 {
2439 sts_reg = SDIOx->sts;
2440 }
2441
2442 if(sdio_flag_get(SDIOx, SDIO_CMDFAIL_FLAG) != RESET)
2443 {
2444 sdio_flag_clear(SDIOx, SDIO_CMDFAIL_FLAG);
2445 return SD_CMD_FAIL;
2446 }
2447
2448 if(sdio_flag_get(SDIOx, SDIO_CMDTIMEOUT_FLAG) != RESET)
2449 {
2450 sdio_flag_clear(SDIOx, SDIO_CMDTIMEOUT_FLAG);
2451 return SD_CMD_RSP_TIMEOUT;
2452 }
2453
2454 rsp_cmd = sdio_command_response_get(SDIOx);
2455 if(rsp_cmd!= SD_CMD_SEND_STATUS)
2456 {
2457 return SD_ILLEGAL_CMD;
2458 }
2459
2460 sdio_flag_clear(SDIOx, SDIO_STATIC_FLAGS);
2461
2462 response = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
2463
2464 *p_status = (uint8_t)((response >> 9) & 0x0000000F);
2465
2466 return SD_OK;
2467}
2468
2474 sd_error_status_type sd_status_send(uint32_t *p_card_status)
2475{
2476 sd_error_status_type status = SD_OK;
2477
2478 if(p_card_status == NULL)
2479 {
2480 status = SD_INVALID_PARAMETER;
2481 return status;
2482 }
2483
2484 sdio_command_init_struct.argument = (uint32_t)(rca << 16);
2485 sdio_command_init_struct.cmd_index = SD_CMD_SEND_STATUS;
2486 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
2487 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
2488
2489 /* sdio command config */
2490 sdio_command_config(SDIOx, &sdio_command_init_struct);
2491 /* enable ccsm */
2492 sdio_command_state_machine_enable(SDIOx, TRUE);
2493
2494 status = command_rsp1_error(SD_CMD_SEND_STATUS);
2495
2496 if(status != SD_OK)
2497 {
2498 return status;
2499 }
2500
2501 *p_card_status = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
2502
2503 return status;
2504}
2505
2511 sd_card_state_type sd_state_get(void)
2512{
2513 uint32_t response = 0;
2514
2515 if(sd_status_send(&response) != SD_OK)
2516 {
2517 return SD_CARD_ERROR;
2518 }
2519 else
2520 {
2521 return (sd_card_state_type)((response >> 9) & 0x0F);
2522 }
2523}
2524
2529 sd_error_status_type get_ext_csd(void)
2530{
2531 uint32_t index = 0, sts_reg = 0;
2532 sd_error_status_type status = SD_OK;
2533 uint32_t *tmp_ext_csd = ext_csd_table;
2534
2535 sdio_data_init_struct.block_size = SDIO_DATA_BLOCK_SIZE_512B;
2536 sdio_data_init_struct.data_length = 512;
2537 sdio_data_init_struct.timeout = SD_DATATIMEOUT;
2538 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CONTROLLER;
2539 sdio_data_init_struct.transfer_mode = SDIO_DATA_BLOCK_TRANSFER;
2540
2541 sdio_data_config(SDIOx, &sdio_data_init_struct);
2542 sdio_data_state_machine_enable(SDIOx, TRUE);
2543
2544 /* send cmd8 */
2545 sdio_command_init_struct.argument = 0x0;
2546 sdio_command_init_struct.cmd_index = SD_CMD_HS_SEND_EXT_CSD;
2547 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
2548 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
2549 /* sdio command config */
2550 sdio_command_config(SDIOx, &sdio_command_init_struct);
2551 /* enable ccsm */
2552 sdio_command_state_machine_enable(SDIOx, TRUE);
2553 status = command_rsp1_error(SD_CMD_HS_SEND_EXT_CSD);
2554 if(status != SD_OK)
2555 {
2556 return status;
2557 }
2558
2559 sts_reg = SDIOx->sts;
2560
2561 while(!(sts_reg & (SDIO_RXERRO_FLAG | SDIO_DTFAIL_FLAG | SDIO_DTTIMEOUT_FLAG | SDIO_DTBLKCMPL_FLAG | SDIO_SBITERR_FLAG)))
2562 {
2563 if(sdio_flag_get(SDIOx, SDIO_RXBUF_FLAG) != RESET)
2564 {
2565 *(tmp_ext_csd + index) = sdio_data_read(SDIOx);
2566 index++;
2567 }
2568 sts_reg = SDIOx->sts;
2569 }
2570 if(sdio_flag_get(SDIOx, SDIO_DTTIMEOUT_FLAG) != RESET)
2571 {
2572 sdio_flag_clear(SDIOx, SDIO_DTTIMEOUT_FLAG);
2573 return SD_DATA_TIMEOUT;
2574 }
2575 else if(sdio_flag_get(SDIOx, SDIO_DTFAIL_FLAG) != RESET)
2576 {
2577 sdio_flag_clear(SDIOx, SDIO_DTFAIL_FLAG);
2578 return SD_DATA_FAIL;
2579 }
2580 else if(sdio_flag_get(SDIOx, SDIO_RXERRO_FLAG) != RESET)
2581 {
2582 sdio_flag_clear(SDIOx, SDIO_RXERRO_FLAG);
2583 return SD_RX_OVERRUN;
2584 }
2585 else if(sdio_flag_get(SDIOx, SDIO_SBITERR_FLAG) != RESET)
2586 {
2587 sdio_flag_clear(SDIOx, SDIO_SBITERR_FLAG);
2588 return SD_START_BIT_ERR;
2589 }
2590
2591 sdio_flag_clear(SDIOx, SDIO_STATIC_FLAGS);
2592
2593 return status;
2594}
2595
2600 sd_error_status_type scr_find(void)
2601{
2602 uint32_t index = 0, sts_reg = 0;
2603 sd_error_status_type status = SD_OK;
2604 uint32_t *tempscr;
2605
2606 tempscr = (uint32_t *) &(sd_card_info.sd_scr_reg);
2607
2608 /* send cmd16, set block length */
2609 sdio_command_init_struct.argument = (uint32_t)8;
2610 sdio_command_init_struct.cmd_index = SD_CMD_SET_BLOCKLEN;
2611 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
2612 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
2613
2614 /* sdio command config */
2615 sdio_command_config(SDIOx, &sdio_command_init_struct);
2616 /* enable ccsm */
2617 sdio_command_state_machine_enable(SDIOx, TRUE);
2618
2619 status = command_rsp1_error(SD_CMD_SET_BLOCKLEN);
2620
2621 if(status != SD_OK)
2622 {
2623 return status;
2624 }
2625
2626 /* send cmd55 */
2627 sdio_command_init_struct.argument = (uint32_t)(sd_card_info.rca << 16);
2628 sdio_command_init_struct.cmd_index = SD_CMD_APP_CMD;
2629 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
2630 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
2631
2632 /* sdio command config */
2633 sdio_command_config(SDIOx, &sdio_command_init_struct);
2634 /* enable ccsm */
2635 sdio_command_state_machine_enable(SDIOx, TRUE);
2636
2637 status = command_rsp1_error(SD_CMD_APP_CMD);
2638
2639 if(status != SD_OK)
2640 {
2641 return status;
2642 }
2643
2644 sdio_data_init_struct.block_size = SDIO_DATA_BLOCK_SIZE_8B;
2645 sdio_data_init_struct.data_length = 8;
2646 sdio_data_init_struct.timeout = SD_DATATIMEOUT;
2647 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CONTROLLER;
2648 sdio_data_init_struct.transfer_mode = SDIO_DATA_BLOCK_TRANSFER;
2649
2650 sdio_data_config(SDIOx, &sdio_data_init_struct);
2651 sdio_data_state_machine_enable(SDIOx, TRUE);
2652
2653 /* send cmd51 */
2654 sdio_command_init_struct.argument = 0x0;
2655 sdio_command_init_struct.cmd_index = SD_CMD_SD_APP_SEND_SCR;
2656 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
2657 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
2658
2659 /* sdio command config */
2660 sdio_command_config(SDIOx, &sdio_command_init_struct);
2661 /* enable ccsm */
2662 sdio_command_state_machine_enable(SDIOx, TRUE);
2663
2664 status = command_rsp1_error(SD_CMD_SD_APP_SEND_SCR);
2665
2666 if(status != SD_OK)
2667 {
2668 return status;
2669 }
2670
2671 sts_reg = SDIOx->sts;
2672
2673 while(!(sts_reg & (SDIO_RXERRO_FLAG | SDIO_DTFAIL_FLAG | SDIO_DTTIMEOUT_FLAG | SDIO_DTBLKCMPL_FLAG | SDIO_SBITERR_FLAG)))
2674 {
2675 if(sdio_flag_get(SDIOx, SDIO_RXBUF_FLAG) != RESET)
2676 {
2677 *(tempscr + index) = sdio_data_read(SDIOx);
2678 index++;
2679 }
2680 sts_reg = SDIOx->sts;
2681 }
2682
2683 if(sdio_flag_get(SDIOx, SDIO_DTTIMEOUT_FLAG) != RESET)
2684 {
2685 sdio_flag_clear(SDIOx, SDIO_DTTIMEOUT_FLAG);
2686 return SD_DATA_TIMEOUT;
2687 }
2688 else if(sdio_flag_get(SDIOx, SDIO_DTFAIL_FLAG) != RESET)
2689 {
2690 sdio_flag_clear(SDIOx, SDIO_DTFAIL_FLAG);
2691 return SD_DATA_FAIL;
2692 }
2693 else if(sdio_flag_get(SDIOx, SDIO_RXERRO_FLAG) != RESET)
2694 {
2695 sdio_flag_clear(SDIOx, SDIO_RXERRO_FLAG);
2696 return SD_RX_OVERRUN;
2697 }
2698 else if(sdio_flag_get(SDIOx, SDIO_SBITERR_FLAG) != RESET)
2699 {
2700 sdio_flag_clear(SDIOx, SDIO_SBITERR_FLAG);
2701 return SD_START_BIT_ERR;
2702 }
2703
2704 sdio_flag_clear(SDIOx, SDIO_STATIC_FLAGS);
2705
2706 return status;
2707}
2708
2714 sd_error_status_type speed_change(uint8_t speed)
2715{
2716 sd_error_status_type status = SD_OK;
2717 uint8_t switch_sts[64];
2718
2719 if(speed > 1)
2720 {
2721 return SD_ERROR;
2722 }
2723
2724 /* check card type */
2725 if((SDIO_STD_CAPACITY_SD_CARD_V1_1 == card_type) || (SDIO_STD_CAPACITY_SD_CARD_V2_0 == card_type) || \
2726 (SDIO_HIGH_CAPACITY_SD_CARD == card_type))
2727 {
2728 /* version 1.01 card does not support cmd6 */
2729 if(sd_card_info.sd_scr_reg.sd_spec == 0)
2730 {
2731 return SD_ERROR;
2732 }
2733
2734 /* check group 1 function support speed */
2735 status = sd_switch(0, 0, speed, switch_sts);
2736
2737 if(status != 0)
2738 {
2739 return status;
2740 }
2741
2742 if((switch_sts[13] & (1 << speed)) == 0)
2743 {
2744 return SD_ERROR;
2745 }
2746
2747 status = sd_switch(1, 0, speed, switch_sts);
2748
2749 if(status != 0)
2750 {
2751 return status;
2752 }
2753
2754 /* read it back for confirmation */
2755 if((switch_sts[16] & 0xF) != speed)
2756 {
2757 return SD_ERROR;
2758 }
2759 }
2760 else if(card_type == SDIO_HIGH_SPEED_MULTIMEDIA_CARD || card_type == SDIO_HIGH_CAPACITY_MMC_CARD)
2761 {
2762 status = mmc_switch(EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BUS_WIDTH, (uint8_t)speed);
2763
2764 if(status != 0)
2765 {
2766 return status;
2767 }
2768 }
2769
2770 return status;
2771}
2772
2778uint8_t convert_from_bytes_to_power_of_two(uint16_t number_of_bytes)
2779{
2780 uint8_t count = 0;
2781
2782 while(number_of_bytes != 1)
2783 {
2784 number_of_bytes >>= 1;
2785 count++;
2786 }
2787
2788 return count;
2789}
2790
2799void sd_dma_config(uint32_t *mbuf, uint32_t buf_size, dma_dir_type dir)
2800{
2801 dma_init_type dma_init_struct;
2802 dma_default_para_init(&dma_init_struct);
2803
2804 crm_periph_clock_enable(CRM_DMA2_PERIPH_CLOCK, TRUE);
2805
2806 dma_reset(DMA2_CHANNEL4);
2807 dma_channel_enable(DMA2_CHANNEL4, FALSE);
2808
2809 dma_init_struct.peripheral_base_addr = (uint32_t)&SDIOx->buf;
2810 dma_init_struct.memory_base_addr = (uint32_t)mbuf;
2811 dma_init_struct.direction = dir;
2812 dma_init_struct.buffer_size = buf_size / 4;
2813 dma_init_struct.peripheral_inc_enable = FALSE;
2814 dma_init_struct.memory_inc_enable = TRUE;
2815 dma_init_struct.peripheral_data_width = DMA_PERIPHERAL_DATA_WIDTH_WORD;
2816 dma_init_struct.memory_data_width = DMA_MEMORY_DATA_WIDTH_WORD;
2817 dma_init_struct.loop_mode_enable = FALSE;
2818 dma_init_struct.priority = DMA_PRIORITY_HIGH;
2819 dma_init(DMA2_CHANNEL4, &dma_init_struct);
2820
2821 dma_channel_enable(DMA2_CHANNEL4, TRUE);
2822}
2823
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
dma_init_struct
dma_init_type dma_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:38
sd_card_info
sd_card_info_struct_type sd_card_info
Definition emmc_card/src/at32_sdio.c:48
sd_switch
sd_error_status_type sd_switch(uint32_t mode, uint32_t group, uint8_t value, uint8_t *rsp)
switch sd card speed to high speed
Definition emmc_card/src/at32_sdio.c:2364
command_rsp5_error
sd_error_status_type command_rsp5_error(uint8_t cmd)
checks for error conditions for r5 response.
Definition emmc_card/src/at32_sdio.c:2115
speed_change
sd_error_status_type speed_change(uint8_t speed)
set bus speed
Definition emmc_card/src/at32_sdio.c:2714
sd_power_off
sd_error_status_type sd_power_off(void)
turns the sdio output signals off.
Definition emmc_card/src/at32_sdio.c:425
sdio_data_init_struct
sdio_data_struct_type sdio_data_init_struct
Definition emmc_card/src/at32_sdio.c:39
sd_irq_service
sd_error_status_type sd_irq_service(void)
allows to process all the interrupts that are high.
Definition emmc_card/src/at32_sdio.c:1811
transfer_end
volatile uint8_t transfer_end
Definition emmc_card/src/at32_sdio.c:47
command_rsp7_error
sd_error_status_type command_rsp7_error(void)
checks for error conditions for R7 response.
Definition emmc_card/src/at32_sdio.c:1922
sd_device_mode_set
sd_error_status_type sd_device_mode_set(uint32_t mode)
set sdio work mode.
Definition emmc_card/src/at32_sdio.c:808
card_type
static sd_memory_card_type card_type
Definition emmc_card/src/at32_sdio.c:41
convert_from_bytes_to_power_of_two
uint8_t convert_from_bytes_to_power_of_two(uint16_t number_of_bytes)
converts the number of bytes in power of two and returns the power.
Definition emmc_card/src/at32_sdio.c:2778
sd_card_info_get
sd_error_status_type sd_card_info_get(sd_card_info_struct_type *card_info)
returns information about specific card.
Definition emmc_card/src/at32_sdio.c:554
sdio_command_init_struct
sdio_command_struct_type sdio_command_init_struct
Definition emmc_card/src/at32_sdio.c:38
mmc_stream_write
sd_error_status_type mmc_stream_write(uint8_t *buf, long long addr, uint32_t len)
write mmc card data stream.
Definition emmc_card/src/at32_sdio.c:1722
sd_card_init
sd_error_status_type sd_card_init(void)
intialises all cards or single card as the case may be card(s) come into standby state.
Definition emmc_card/src/at32_sdio.c:439
sd_block_read
sd_error_status_type sd_block_read(uint8_t *buf, long long addr, uint16_t blk_size)
allows to read one block from a specified address in a card. the data transfer can be managed by dma ...
Definition emmc_card/src/at32_sdio.c:1210
sd_deselect_select
sd_error_status_type sd_deselect_select(uint32_t addr)
selects od deselects the corresponding card.
Definition emmc_card/src/at32_sdio.c:829
command_rsp6_error
sd_error_status_type command_rsp6_error(uint8_t cmd, uint16_t *p_rca)
checks for error conditions for r6 (rca) response.
Definition emmc_card/src/at32_sdio.c:2178
SDIO1_IRQHandler
void SDIO1_IRQHandler(void)
sdio1 isr.
Definition emmc_card/src/at32_sdio.c:1791
stop_flag
static uint8_t stop_flag
Definition emmc_card/src/at32_sdio.c:45
mmc_switch
sd_error_status_type mmc_switch(uint8_t set, uint8_t index, uint8_t value)
switch mmc card speed to high speed
Definition emmc_card/src/at32_sdio.c:2313
sd_blocks_erase
sd_error_status_type sd_blocks_erase(long long addr, uint32_t nblks)
erase continuous data block
Definition emmc_card/src/at32_sdio.c:1052
get_ext_csd
sd_error_status_type get_ext_csd(void)
find the sd card ext csd register value.
Definition emmc_card/src/at32_sdio.c:2529
check_card_programming
sd_error_status_type check_card_programming(uint8_t *p_status)
checks if the sd card is in programming state.
Definition emmc_card/src/at32_sdio.c:2420
transfer_error
volatile sd_error_status_type transfer_error
Definition emmc_card/src/at32_sdio.c:46
sd_bus_wide_enable
sd_error_status_type sd_bus_wide_enable(confirm_state new_state)
enable or disable the sdio wide bus mode.
Definition emmc_card/src/at32_sdio.c:2244
ext_csd_table
static uint32_t ext_csd_table[128]
Definition emmc_card/src/at32_sdio.c:43
command_rsp1_error
sd_error_status_type command_rsp1_error(uint8_t cmd)
checks for error conditions for R1 response.
Definition emmc_card/src/at32_sdio.c:1959
SDIO2_IRQHandler
void SDIO2_IRQHandler(void)
sdio2 isr.
Definition emmc_card/src/at32_sdio.c:1801
sd_mult_blocks_write
sd_error_status_type sd_mult_blocks_write(const uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks)
allows to write blocks starting from a specified address in a card. the data transfer can be managed ...
Definition emmc_card/src/at32_sdio.c:1511
csd_table
static uint32_t csd_table[4]
Definition emmc_card/src/at32_sdio.c:42
sdio_clock_set
void sdio_clock_set(uint32_t clk_div)
set sdio clock devision factor.
Definition emmc_card/src/at32_sdio.c:209
sd_state_get
sd_card_state_type sd_state_get(void)
returns information about sd card.
Definition emmc_card/src/at32_sdio.c:2511
cid_table
static uint32_t cid_table[4]
Definition emmc_card/src/at32_sdio.c:42
sd_dma_config
void sd_dma_config(uint32_t *mbuf, uint32_t buf_size, dma_dir_type dir)
set dma configuation for sdio
Definition emmc_card/src/at32_sdio.c:2799
sd_block_write
sd_error_status_type sd_block_write(const uint8_t *buf, long long addr, uint16_t blk_size)
allows to write one block starting from a specified address in a card. the data transfer can be manag...
Definition emmc_card/src/at32_sdio.c:1389
device_mode
static sd_data_transfer_mode_type device_mode
Definition emmc_card/src/at32_sdio.c:44
sd_status_send
sd_error_status_type sd_status_send(uint32_t *p_card_status)
read current card status.
Definition emmc_card/src/at32_sdio.c:2474
sdio_command_data_send
sd_error_status_type sdio_command_data_send(sdio_command_struct_type *sdio_cmd_init_t, sdio_data_struct_type *sdio_data_init_t, uint32_t *buf)
read data from or write data to sd card.
Definition emmc_card/src/at32_sdio.c:852
command_rsp2_error
sd_error_status_type command_rsp2_error(void)
checks for error conditions for R2 (cid or csd) response.
Definition emmc_card/src/at32_sdio.c:2032
sd_init
sd_error_status_type sd_init(void)
initializes the sd card and put it into standby state (ready for data transfer).
Definition emmc_card/src/at32_sdio.c:73
mmc_stream_read
sd_error_status_type mmc_stream_read(uint8_t *buf, long long addr, uint32_t len)
read mmc card data stream.
Definition emmc_card/src/at32_sdio.c:1675
scr_find
sd_error_status_type scr_find(void)
find the sd card scr register value.
Definition emmc_card/src/at32_sdio.c:2600
sd_power_on
sd_error_status_type sd_power_on(void)
enquires cards about their operating voltage and configures clock controls.
Definition emmc_card/src/at32_sdio.c:224
command_rsp4_error
sd_error_status_type command_rsp4_error(uint8_t cmd)
checks for error conditions for r4 response.
Definition emmc_card/src/at32_sdio.c:2072
sd_mult_blocks_read
sd_error_status_type sd_mult_blocks_read(uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks)
allows to read blocks from a specified address in a card. the data transfer can be managed by dma mod...
Definition emmc_card/src/at32_sdio.c:1299
sd_wide_bus_operation_config
sd_error_status_type sd_wide_bus_operation_config(sdio_bus_width_type mode)
enable wide bus opeartion for the requeseted card if supported by card.
Definition emmc_card/src/at32_sdio.c:765
rca
static uint32_t rca
Definition emmc_card/src/at32_sdio.c:42
command_rsp3_error
sd_error_status_type command_rsp3_error(void)
checks for error conditions for R3 (ocr) response.
Definition emmc_card/src/at32_sdio.c:2002
command_error
sd_error_status_type command_error(void)
checks for error conditions for cmd0.
Definition emmc_card/src/at32_sdio.c:1895
system_core_clock
unsigned int system_core_clock
Definition system_at32f413.c:47
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_SDIO1_PERIPH_CLOCK
@ CRM_SDIO1_PERIPH_CLOCK
Definition at32f413_crm.h:106
CRM_GPIOC_PERIPH_CLOCK
@ CRM_GPIOC_PERIPH_CLOCK
Definition at32f413_crm.h:111
CRM_GPIOD_PERIPH_CLOCK
@ CRM_GPIOD_PERIPH_CLOCK
Definition at32f413_crm.h:112
CRM_DMA2_PERIPH_CLOCK
@ CRM_DMA2_PERIPH_CLOCK
Definition at32f413_crm.h:104
dma_channel_enable
void dma_channel_enable(dma_channel_type *dmax_channely, confirm_state new_state)
enable or disable dma channely
Definition at32f413_dma.c:197
dma_default_para_init
void dma_default_para_init(dma_init_type *dma_init_struct)
dma init config with its default value.
Definition at32f413_dma.c:407
dma_reset
void dma_reset(dma_channel_type *dmax_channely)
reset the dmax channely registers.
Definition at32f413_dma.c:63
dma_init
void dma_init(dma_channel_type *dmax_channely, dma_init_type *dma_init_struct)
dma init
Definition at32f413_dma.c:442
dma_dir_type
dma_dir_type
dma direction type
Definition at32f413_dma.h:215
DMA_PERIPHERAL_DATA_WIDTH_WORD
@ DMA_PERIPHERAL_DATA_WIDTH_WORD
Definition at32f413_dma.h:247
DMA_DIR_MEMORY_TO_PERIPHERAL
@ DMA_DIR_MEMORY_TO_PERIPHERAL
Definition at32f413_dma.h:217
DMA_DIR_PERIPHERAL_TO_MEMORY
@ DMA_DIR_PERIPHERAL_TO_MEMORY
Definition at32f413_dma.h:216
DMA_MEMORY_DATA_WIDTH_WORD
@ DMA_MEMORY_DATA_WIDTH_WORD
Definition at32f413_dma.h:257
DMA_PRIORITY_HIGH
@ DMA_PRIORITY_HIGH
Definition at32f413_dma.h:267
DMA2_CHANNEL4
#define DMA2_CHANNEL4
Definition at32f413_dma.h:492
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_10
#define GPIO_PINS_10
Definition at32f413_gpio.h:60
GPIO_PINS_11
#define GPIO_PINS_11
Definition at32f413_gpio.h:61
GPIO_PINS_2
#define GPIO_PINS_2
Definition at32f413_gpio.h:52
GPIO_PINS_12
#define GPIO_PINS_12
Definition at32f413_gpio.h:62
GPIO_PINS_9
#define GPIO_PINS_9
Definition at32f413_gpio.h:59
GPIO_PINS_8
#define GPIO_PINS_8
Definition at32f413_gpio.h:58
GPIOC
#define GPIOC
Definition at32f413_gpio.h:749
GPIOD
#define GPIOD
Definition at32f413_gpio.h:750
SDIO_SEND_IF_COND
#define SDIO_SEND_IF_COND
Definition emmc_card/inc/at32_sdio.h:438
SD_CMD_SD_APP_SEND_SCR
#define SD_CMD_SD_APP_SEND_SCR
Definition emmc_card/inc/at32_sdio.h:309
SD_CMD_ERASE
#define SD_CMD_ERASE
Definition emmc_card/inc/at32_sdio.h:292
SD_CMD_APP_SD_SET_BUSWIDTH
#define SD_CMD_APP_SD_SET_BUSWIDTH
Definition emmc_card/inc/at32_sdio.h:304
SD_CMD_WRITE_SINGLE_BLOCK
#define SD_CMD_WRITE_SINGLE_BLOCK
Definition emmc_card/inc/at32_sdio.h:281
SD_CMD_SD_ERASE_GRP_START
#define SD_CMD_SD_ERASE_GRP_START
Definition emmc_card/inc/at32_sdio.h:288
SD_CMD_APP_CMD
#define SD_CMD_APP_CMD
Definition emmc_card/inc/at32_sdio.h:296
SD_CMD_ALL_SEND_CID
#define SD_CMD_ALL_SEND_CID
Definition emmc_card/inc/at32_sdio.h:261
SD_CMD_STOP_TRANSMISSION
#define SD_CMD_STOP_TRANSMISSION
Definition emmc_card/inc/at32_sdio.h:271
SD_CMD_SEND_STATUS
#define SD_CMD_SEND_STATUS
Definition emmc_card/inc/at32_sdio.h:272
SD_CMD_SET_BLOCK_COUNT
#define SD_CMD_SET_BLOCK_COUNT
Definition emmc_card/inc/at32_sdio.h:280
SD_CMD_WRITE_DAT_UNTIL_STOP
#define SD_CMD_WRITE_DAT_UNTIL_STOP
Definition emmc_card/inc/at32_sdio.h:279
SD_CMD_SEND_OP_COND
#define SD_CMD_SEND_OP_COND
Definition emmc_card/inc/at32_sdio.h:260
SD_CMD_SET_BLOCKLEN
#define SD_CMD_SET_BLOCKLEN
Definition emmc_card/inc/at32_sdio.h:275
SD_CMD_HS_SWITCH
#define SD_CMD_HS_SWITCH
Definition emmc_card/inc/at32_sdio.h:265
SD_CMD_READ_SINGLE_BLOCK
#define SD_CMD_READ_SINGLE_BLOCK
Definition emmc_card/inc/at32_sdio.h:276
SD_CMD_SD_APP_OP_COND
#define SD_CMD_SD_APP_OP_COND
Definition emmc_card/inc/at32_sdio.h:307
SD_CMD_GO_IDLE_STATE
#define SD_CMD_GO_IDLE_STATE
Definition emmc_card/inc/at32_sdio.h:259
SD_CMD_SET_REL_ADDR
#define SD_CMD_SET_REL_ADDR
Definition emmc_card/inc/at32_sdio.h:262
SD_CMD_ERASE_GRP_END
#define SD_CMD_ERASE_GRP_END
Definition emmc_card/inc/at32_sdio.h:291
SD_CMD_READ_DAT_UNTIL_STOP
#define SD_CMD_READ_DAT_UNTIL_STOP
Definition emmc_card/inc/at32_sdio.h:270
SD_CMD_SD_ERASE_GRP_END
#define SD_CMD_SD_ERASE_GRP_END
Definition emmc_card/inc/at32_sdio.h:289
SD_CMD_ERASE_GRP_START
#define SD_CMD_ERASE_GRP_START
Definition emmc_card/inc/at32_sdio.h:290
SD_CMD_HS_SEND_EXT_CSD
#define SD_CMD_HS_SEND_EXT_CSD
Definition emmc_card/inc/at32_sdio.h:267
SD_CMD_SEL_DESEL_CARD
#define SD_CMD_SEL_DESEL_CARD
Definition emmc_card/inc/at32_sdio.h:266
SD_CMD_WRITE_MULT_BLOCK
#define SD_CMD_WRITE_MULT_BLOCK
Definition emmc_card/inc/at32_sdio.h:282
SD_CMD_READ_MULT_BLOCK
#define SD_CMD_READ_MULT_BLOCK
Definition emmc_card/inc/at32_sdio.h:277
SD_CMD_SEND_CSD
#define SD_CMD_SEND_CSD
Definition emmc_card/inc/at32_sdio.h:268
sdio_command_config
void sdio_command_config(sdio_type *sdio_x, sdio_command_struct_type *command_struct)
config sdio command.
Definition at32f413_sdio.c:372
sdio_data_write
void sdio_data_write(sdio_type *sdio_x, uint32_t data)
write one word data to fifo.
Definition at32f413_sdio.c:533
sdio_data_config
void sdio_data_config(sdio_type *sdio_x, sdio_data_struct_type *data_struct)
config sdio data.
Definition at32f413_sdio.c:459
sdio_data_read
uint32_t sdio_data_read(sdio_type *sdio_x)
read a word data from sdio fifo.
Definition at32f413_sdio.c:508
sdio_command_state_machine_enable
void sdio_command_state_machine_enable(sdio_type *sdio_x, confirm_state new_state)
enable or disable command path state machine(CPSM).
Definition at32f413_sdio.c:395
sdio_clock_bypass
void sdio_clock_bypass(sdio_type *sdio_x, confirm_state new_state)
enable or disable clock divider bypss
Definition at32f413_sdio.c:140
sdio_flow_control_enable
void sdio_flow_control_enable(sdio_type *sdio_x, confirm_state new_state)
enable or disable hardware flow control.
Definition at32f413_sdio.c:167
sdio_power_set
void sdio_power_set(sdio_type *sdio_x, sdio_power_state_type power_state)
set the power status of the controller
Definition at32f413_sdio.c:74
sdio_clock_config
void sdio_clock_config(sdio_type *sdio_x, uint16_t clk_div, sdio_edge_phase_type clk_edg)
config sdio clock
Definition at32f413_sdio.c:103
sdio_bus_width_config
void sdio_bus_width_config(sdio_type *sdio_x, sdio_bus_width_type width)
config sdio bus width
Definition at32f413_sdio.c:127
sdio_interrupt_enable
void sdio_interrupt_enable(sdio_type *sdio_x, uint32_t int_opt, confirm_state new_state)
config corresponding interrupt.
Definition at32f413_sdio.c:231
sdio_flag_clear
void sdio_flag_clear(sdio_type *sdio_x, uint32_t flag)
clear sdio flag.
Definition at32f413_sdio.c:358
sdio_power_status_get
sdio_power_state_type sdio_power_status_get(sdio_type *sdio_x)
get power status.
Definition at32f413_sdio.c:86
sdio_response_get
uint32_t sdio_response_get(sdio_type *sdio_x, sdio_rsp_index_type reg_index)
get response received from the card for the last command.
Definition at32f413_sdio.c:426
sdio_data_state_machine_enable
void sdio_data_state_machine_enable(sdio_type *sdio_x, confirm_state new_state)
enable or disable data path state machine(DPSM).
Definition at32f413_sdio.c:484
sdio_power_saving_mode_enable
void sdio_power_saving_mode_enable(sdio_type *sdio_x, confirm_state new_state)
enable or disable power saving mode, config sdio_ck clock output when the bus is idle.
Definition at32f413_sdio.c:154
sdio_flag_get
flag_status sdio_flag_get(sdio_type *sdio_x, uint32_t flag)
get sdio flag.
Definition at32f413_sdio.c:321
sdio_dma_enable
void sdio_dma_enable(sdio_type *sdio_x, confirm_state new_state)
enable or disable dma.
Definition at32f413_sdio.c:193
sdio_reset
void sdio_reset(sdio_type *sdio_x)
reset the sdio register
Definition at32f413_sdio.c:50
sdio_interrupt_flag_get
flag_status sdio_interrupt_flag_get(sdio_type *sdio_x, uint32_t flag)
get sdio interrupt flag.
Definition at32f413_sdio.c:277
sdio_clock_enable
void sdio_clock_enable(sdio_type *sdio_x, confirm_state new_state)
enable or disable sdio_ck output.
Definition at32f413_sdio.c:180
sdio_command_response_get
uint8_t sdio_command_response_get(sdio_type *sdio_x)
get command index of last command for which response received.
Definition at32f413_sdio.c:408
sd_data_transfer_mode_type
sd_data_transfer_mode_type
Definition emmc_card/inc/at32_sdio.h:64
sd_error_status_type
sd_error_status_type
Definition emmc_card/inc/at32_sdio.h:73
sd_card_state_type
sd_card_state_type
Definition emmc_card/inc/at32_sdio.h:186
sdio_bus_width_type
sdio_bus_width_type
sdio bus width
Definition at32f413_sdio.h:138
sd_memory_card_type
sd_memory_card_type
Definition emmc_card/inc/at32_sdio.h:202
sdio_block_size_type
sdio_block_size_type
sdio data block size
Definition at32f413_sdio.h:179
SDIO_WAIT_FOR_NO
@ SDIO_WAIT_FOR_NO
Definition at32f413_sdio.h:159
SDIO_RESPONSE_LONG
@ SDIO_RESPONSE_LONG
Definition at32f413_sdio.h:151
SDIO_RESPONSE_SHORT
@ SDIO_RESPONSE_SHORT
Definition at32f413_sdio.h:150
SDIO_RESPONSE_NO
@ SDIO_RESPONSE_NO
Definition at32f413_sdio.h:149
SD_TRANSFER_DMA_MODE
@ SD_TRANSFER_DMA_MODE
Definition emmc_card/inc/at32_sdio.h:66
SD_TRANSFER_POLLING_MODE
@ SD_TRANSFER_POLLING_MODE
Definition emmc_card/inc/at32_sdio.h:65
SD_ERROR
@ SD_ERROR
Definition emmc_card/inc/at32_sdio.h:117
SD_SDIO_UNKNOWN_FUNC
@ SD_SDIO_UNKNOWN_FUNC
Definition emmc_card/inc/at32_sdio.h:107
SD_DATA_FAIL
@ SD_DATA_FAIL
Definition emmc_card/inc/at32_sdio.h:76
SD_INVALID_PARAMETER
@ SD_INVALID_PARAMETER
Definition emmc_card/inc/at32_sdio.h:114
SD_CMD_FAIL
@ SD_CMD_FAIL
Definition emmc_card/inc/at32_sdio.h:75
SD_CMD_OUT_OF_RANGE
@ SD_CMD_OUT_OF_RANGE
Definition emmc_card/inc/at32_sdio.h:82
SD_GENERAL_UNKNOWN_ERROR
@ SD_GENERAL_UNKNOWN_ERROR
Definition emmc_card/inc/at32_sdio.h:93
SD_UNSUPPORTED_FEATURE
@ SD_UNSUPPORTED_FEATURE
Definition emmc_card/inc/at32_sdio.h:115
SD_TX_UNDERRUN
@ SD_TX_UNDERRUN
Definition emmc_card/inc/at32_sdio.h:79
SD_ILLEGAL_CMD
@ SD_ILLEGAL_CMD
Definition emmc_card/inc/at32_sdio.h:90
SD_CMD_CRC_ERROR
@ SD_CMD_CRC_ERROR
Definition emmc_card/inc/at32_sdio.h:89
SD_RX_OVERRUN
@ SD_RX_OVERRUN
Definition emmc_card/inc/at32_sdio.h:80
SD_REQ_NOT_APPLICABLE
@ SD_REQ_NOT_APPLICABLE
Definition emmc_card/inc/at32_sdio.h:113
SD_SWITCH_ERROR
@ SD_SWITCH_ERROR
Definition emmc_card/inc/at32_sdio.h:103
SD_INVALID_VOLTRANGE
@ SD_INVALID_VOLTRANGE
Definition emmc_card/inc/at32_sdio.h:101
SD_DATA_TIMEOUT
@ SD_DATA_TIMEOUT
Definition emmc_card/inc/at32_sdio.h:78
SD_START_BIT_ERR
@ SD_START_BIT_ERR
Definition emmc_card/inc/at32_sdio.h:81
SD_LOCK_UNLOCK_ERROR
@ SD_LOCK_UNLOCK_ERROR
Definition emmc_card/inc/at32_sdio.h:88
SD_CMD_RSP_TIMEOUT
@ SD_CMD_RSP_TIMEOUT
Definition emmc_card/inc/at32_sdio.h:77
SD_OK
@ SD_OK
Definition emmc_card/inc/at32_sdio.h:118
SDIO_CLOCK_EDGE_FALLING
@ SDIO_CLOCK_EDGE_FALLING
Definition at32f413_sdio.h:131
SDIO_DATA_TRANSFER_TO_CARD
@ SDIO_DATA_TRANSFER_TO_CARD
Definition at32f413_sdio.h:211
SDIO_DATA_TRANSFER_TO_CONTROLLER
@ SDIO_DATA_TRANSFER_TO_CONTROLLER
Definition at32f413_sdio.h:212
SDIO_POWER_OFF
@ SDIO_POWER_OFF
Definition at32f413_sdio.h:121
SDIO_POWER_ON
@ SDIO_POWER_ON
Definition at32f413_sdio.h:122
SD_CARD_ERROR
@ SD_CARD_ERROR
Definition emmc_card/inc/at32_sdio.h:195
SDIO_DATA_BLOCK_TRANSFER
@ SDIO_DATA_BLOCK_TRANSFER
Definition at32f413_sdio.h:202
SDIO_DATA_STREAM_TRANSFER
@ SDIO_DATA_STREAM_TRANSFER
Definition at32f413_sdio.h:203
SDIO_BUS_WIDTH_D1
@ SDIO_BUS_WIDTH_D1
Definition at32f413_sdio.h:139
SDIO_BUS_WIDTH_D4
@ SDIO_BUS_WIDTH_D4
Definition at32f413_sdio.h:140
SDIO_RSP3_INDEX
@ SDIO_RSP3_INDEX
Definition at32f413_sdio.h:171
SDIO_RSP2_INDEX
@ SDIO_RSP2_INDEX
Definition at32f413_sdio.h:170
SDIO_RSP4_INDEX
@ SDIO_RSP4_INDEX
Definition at32f413_sdio.h:172
SDIO_RSP1_INDEX
@ SDIO_RSP1_INDEX
Definition at32f413_sdio.h:169
SDIO_HIGH_CAPACITY_SD_CARD
@ SDIO_HIGH_CAPACITY_SD_CARD
Definition emmc_card/inc/at32_sdio.h:205
SDIO_SECURE_DIGITAL_IO_COMBO_CARD
@ SDIO_SECURE_DIGITAL_IO_COMBO_CARD
Definition emmc_card/inc/at32_sdio.h:209
SDIO_HIGH_SPEED_MULTIMEDIA_CARD
@ SDIO_HIGH_SPEED_MULTIMEDIA_CARD
Definition emmc_card/inc/at32_sdio.h:208
SDIO_STD_CAPACITY_SD_CARD_V1_1
@ SDIO_STD_CAPACITY_SD_CARD_V1_1
Definition emmc_card/inc/at32_sdio.h:203
SDIO_SECURE_DIGITAL_IO_CARD
@ SDIO_SECURE_DIGITAL_IO_CARD
Definition emmc_card/inc/at32_sdio.h:207
SDIO_STD_CAPACITY_SD_CARD_V2_0
@ SDIO_STD_CAPACITY_SD_CARD_V2_0
Definition emmc_card/inc/at32_sdio.h:204
SDIO_MULTIMEDIA_CARD
@ SDIO_MULTIMEDIA_CARD
Definition emmc_card/inc/at32_sdio.h:206
SDIO_HIGH_CAPACITY_MMC_CARD
@ SDIO_HIGH_CAPACITY_MMC_CARD
Definition emmc_card/inc/at32_sdio.h:210
SDIO_DATA_BLOCK_SIZE_8B
@ SDIO_DATA_BLOCK_SIZE_8B
Definition at32f413_sdio.h:183
SDIO_DATA_BLOCK_SIZE_1B
@ SDIO_DATA_BLOCK_SIZE_1B
Definition at32f413_sdio.h:180
SDIO_DATA_BLOCK_SIZE_512B
@ SDIO_DATA_BLOCK_SIZE_512B
Definition at32f413_sdio.h:189
SDIO_CMDTIMEOUT_FLAG
#define SDIO_CMDTIMEOUT_FLAG
Definition at32f413_sdio.h:86
SDIO_TXBUFH_FLAG
#define SDIO_TXBUFH_FLAG
Definition at32f413_sdio.h:98
SDIO_CMDCMPL_FLAG
#define SDIO_CMDCMPL_FLAG
Definition at32f413_sdio.h:91
SDIO_DTFAIL_FLAG
#define SDIO_DTFAIL_FLAG
Definition at32f413_sdio.h:85
SDIO_RXERRO_FLAG
#define SDIO_RXERRO_FLAG
Definition at32f413_sdio.h:89
SDIO_RXBUFH_FLAG
#define SDIO_RXBUFH_FLAG
Definition at32f413_sdio.h:99
SDIO_RXBUF_FLAG
#define SDIO_RXBUF_FLAG
Definition at32f413_sdio.h:105
SDIO_CMDFAIL_FLAG
#define SDIO_CMDFAIL_FLAG
Definition at32f413_sdio.h:84
SDIO_CMDRSPCMPL_FLAG
#define SDIO_CMDRSPCMPL_FLAG
Definition at32f413_sdio.h:90
SDIO_DTBLKCMPL_FLAG
#define SDIO_DTBLKCMPL_FLAG
Definition at32f413_sdio.h:94
SDIO_DTTIMEOUT_FLAG
#define SDIO_DTTIMEOUT_FLAG
Definition at32f413_sdio.h:87
SDIO_SBITERR_FLAG
#define SDIO_SBITERR_FLAG
Definition at32f413_sdio.h:93
SDIO_DTCMPL_FLAG
#define SDIO_DTCMPL_FLAG
Definition at32f413_sdio.h:92
SDIO_TXERRU_FLAG
#define SDIO_TXERRU_FLAG
Definition at32f413_sdio.h:88
SDIOx
#define SDIOx
Definition emmc_card/inc/at32_sdio.h:50
SDIO_INTR_STS_WRITE_MASK
#define SDIO_INTR_STS_WRITE_MASK
Definition emmc_card/inc/at32_sdio.h:474
SDIO_INTR_STS_READ_MASK
#define SDIO_INTR_STS_READ_MASK
Definition emmc_card/inc/at32_sdio.h:476
SDIO_SBITERR_INT
#define SDIO_SBITERR_INT
Definition at32f413_sdio.h:60
SDIO_RXBUFH_INT
#define SDIO_RXBUFH_INT
Definition at32f413_sdio.h:66
SDIO_DTTIMEOUT_INT
#define SDIO_DTTIMEOUT_INT
Definition at32f413_sdio.h:54
SDIO_TXERRU_INT
#define SDIO_TXERRU_INT
Definition at32f413_sdio.h:55
SDIO_RXERRO_INT
#define SDIO_RXERRO_INT
Definition at32f413_sdio.h:56
SDIO_DTFAIL_INT
#define SDIO_DTFAIL_INT
Definition at32f413_sdio.h:52
SDIO_TXBUFH_INT
#define SDIO_TXBUFH_INT
Definition at32f413_sdio.h:65
SDIO_DTCMP_INT
#define SDIO_DTCMP_INT
Definition at32f413_sdio.h:59
EXT_CSD_BUS_WIDTH
#define EXT_CSD_BUS_WIDTH
Definition emmc_card/inc/at32_sdio.h:463
EXT_CSD_CMD_SET_NORMAL
#define EXT_CSD_CMD_SET_NORMAL
Definition emmc_card/inc/at32_sdio.h:456
EXT_CSD_Write_byte
#define EXT_CSD_Write_byte
Definition emmc_card/inc/at32_sdio.h:454
NULL
#define NULL
Definition emmc_card/inc/at32_sdio.h:340
SDIO_DATATIMEOUT
#define SDIO_DATATIMEOUT
Definition emmc_card/inc/at32_sdio.h:343
SDIO_CMD0TIMEOUT
#define SDIO_CMD0TIMEOUT
Definition emmc_card/inc/at32_sdio.h:342
SDIO_STATIC_FLAGS
#define SDIO_STATIC_FLAGS
Definition emmc_card/inc/at32_sdio.h:341
SD_CARD_LOCKED
#define SD_CARD_LOCKED
Definition emmc_card/inc/at32_sdio.h:400
SD_VOLTAGE_WINDOW_SD
#define SD_VOLTAGE_WINDOW_SD
Definition emmc_card/inc/at32_sdio.h:391
SD_R5_ERROR
#define SD_R5_ERROR
Definition emmc_card/inc/at32_sdio.h:383
SD_CARD_RECEIVING
#define SD_CARD_RECEIVING
Definition emmc_card/inc/at32_sdio.h:402
SD_R5_OUT_OF_RANGE
#define SD_R5_OUT_OF_RANGE
Definition emmc_card/inc/at32_sdio.h:381
SD_MAX_DATA_LENGTH
#define SD_MAX_DATA_LENGTH
Definition emmc_card/inc/at32_sdio.h:408
SD_STD_CAPACITY
#define SD_STD_CAPACITY
Definition emmc_card/inc/at32_sdio.h:393
SD_R5_FUNCTION_NUMBER
#define SD_R5_FUNCTION_NUMBER
Definition emmc_card/inc/at32_sdio.h:382
SD_R6_ILLEGAL_CMD
#define SD_R6_ILLEGAL_CMD
Definition emmc_card/inc/at32_sdio.h:389
SD_R6_GENERAL_UNKNOWN_ERROR
#define SD_R6_GENERAL_UNKNOWN_ERROR
Definition emmc_card/inc/at32_sdio.h:388
SD_MAX_VOLT_TRIAL
#define SD_MAX_VOLT_TRIAL
Definition emmc_card/inc/at32_sdio.h:396
SD_DATATIMEOUT
#define SD_DATATIMEOUT
Definition emmc_card/inc/at32_sdio.h:403
SD_ALLZERO
#define SD_ALLZERO
Definition emmc_card/inc/at32_sdio.h:397
SD_R6_CMD_CRC_ERROR
#define SD_R6_CMD_CRC_ERROR
Definition emmc_card/inc/at32_sdio.h:390
MMC_SWITCH_ERROR
#define MMC_SWITCH_ERROR
Definition emmc_card/inc/at32_sdio.h:374
SD_VOLTAGE_WINDOW_MMC
#define SD_VOLTAGE_WINDOW_MMC
Definition emmc_card/inc/at32_sdio.h:395
SD_CHECK_PATTERN
#define SD_CHECK_PATTERN
Definition emmc_card/inc/at32_sdio.h:394
SD_OCR_ERRORBITS
#define SD_OCR_ERRORBITS
Definition emmc_card/inc/at32_sdio.h:376
SD_CARD_PROGRAMMING
#define SD_CARD_PROGRAMMING
Definition emmc_card/inc/at32_sdio.h:401
SD_HIGH_CAPACITY
#define SD_HIGH_CAPACITY
Definition emmc_card/inc/at32_sdio.h:392
dma_init_type
dma init type
Definition at32f413_dma.h:275
dma_init_type::loop_mode_enable
confirm_state loop_mode_enable
Definition at32f413_dma.h:284
dma_init_type::buffer_size
uint16_t buffer_size
Definition at32f413_dma.h:279
dma_init_type::memory_data_width
dma_memory_data_size_type memory_data_width
Definition at32f413_dma.h:283
dma_init_type::priority
dma_priority_level_type priority
Definition at32f413_dma.h:285
dma_init_type::peripheral_inc_enable
confirm_state peripheral_inc_enable
Definition at32f413_dma.h:280
dma_init_type::memory_inc_enable
confirm_state memory_inc_enable
Definition at32f413_dma.h:281
dma_init_type::direction
dma_dir_type direction
Definition at32f413_dma.h:278
dma_init_type::peripheral_base_addr
uint32_t peripheral_base_addr
Definition at32f413_dma.h:276
dma_init_type::memory_base_addr
uint32_t memory_base_addr
Definition at32f413_dma.h:277
dma_init_type::peripheral_data_width
dma_peripheral_data_size_type peripheral_data_width
Definition at32f413_dma.h:282
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
sd_card_info_struct_type
Definition emmc_card/inc/at32_sdio.h:236
sd_card_info_struct_type::sd_scr_reg
sd_scr_struct_type sd_scr_reg
Definition emmc_card/inc/at32_sdio.h:239
sd_card_info_struct_type::card_capacity
long long card_capacity
Definition emmc_card/inc/at32_sdio.h:240
sd_card_info_struct_type::sd_cid_reg
sd_cid_struct_type sd_cid_reg
Definition emmc_card/inc/at32_sdio.h:238
sd_card_info_struct_type::sd_csd_reg
sd_csd_struct_type sd_csd_reg
Definition emmc_card/inc/at32_sdio.h:237
sd_card_info_struct_type::card_blk_size
uint32_t card_blk_size
Definition emmc_card/inc/at32_sdio.h:241
sd_card_info_struct_type::rca
uint16_t rca
Definition emmc_card/inc/at32_sdio.h:242
sd_card_info_struct_type::card_type
uint8_t card_type
Definition emmc_card/inc/at32_sdio.h:243
sd_cid_struct_type::reserved1
uint8_t reserved1
Definition emmc_card/inc/at32_sdio.h:176
sd_cid_struct_type::product_name2
uint8_t product_name2
Definition emmc_card/inc/at32_sdio.h:173
sd_cid_struct_type::manufact_date
uint16_t manufact_date
Definition emmc_card/inc/at32_sdio.h:177
sd_cid_struct_type::cid_crc
uint8_t cid_crc
Definition emmc_card/inc/at32_sdio.h:178
sd_cid_struct_type::product_reversion
uint8_t product_reversion
Definition emmc_card/inc/at32_sdio.h:174
sd_cid_struct_type::manufacturer_id
uint8_t manufacturer_id
Definition emmc_card/inc/at32_sdio.h:170
sd_cid_struct_type::product_sn
uint32_t product_sn
Definition emmc_card/inc/at32_sdio.h:175
sd_cid_struct_type::product_name1
uint32_t product_name1
Definition emmc_card/inc/at32_sdio.h:172
sd_cid_struct_type::reserved2
uint8_t reserved2
Definition emmc_card/inc/at32_sdio.h:179
sd_cid_struct_type::oem_app_id
uint16_t oem_app_id
Definition emmc_card/inc/at32_sdio.h:171
sd_csd_struct_type::spec_version
uint8_t spec_version
Definition emmc_card/inc/at32_sdio.h:127
sd_csd_struct_type::max_write_current_vdd_max
uint8_t max_write_current_vdd_max
Definition emmc_card/inc/at32_sdio.h:143
sd_csd_struct_type::nsac
uint8_t nsac
Definition emmc_card/inc/at32_sdio.h:130
sd_csd_struct_type::card_cmd_classes
uint16_t card_cmd_classes
Definition emmc_card/inc/at32_sdio.h:132
sd_csd_struct_type::part_blk_read
uint8_t part_blk_read
Definition emmc_card/inc/at32_sdio.h:134
sd_csd_struct_type::read_blk_misalign
uint8_t read_blk_misalign
Definition emmc_card/inc/at32_sdio.h:136
sd_csd_struct_type::content_protect_app
uint8_t content_protect_app
Definition emmc_card/inc/at32_sdio.h:154
sd_csd_struct_type::write_speed_factor
uint8_t write_speed_factor
Definition emmc_card/inc/at32_sdio.h:150
sd_csd_struct_type::max_read_blk_length
uint8_t max_read_blk_length
Definition emmc_card/inc/at32_sdio.h:133
sd_csd_struct_type::max_bus_clk_freq
uint8_t max_bus_clk_freq
Definition emmc_card/inc/at32_sdio.h:131
sd_csd_struct_type::ecc_code
uint8_t ecc_code
Definition emmc_card/inc/at32_sdio.h:160
sd_csd_struct_type::reserved4
uint8_t reserved4
Definition emmc_card/inc/at32_sdio.h:162
sd_csd_struct_type::dsr_implemented
uint8_t dsr_implemented
Definition emmc_card/inc/at32_sdio.h:137
sd_csd_struct_type::max_read_current_vdd_min
uint8_t max_read_current_vdd_min
Definition emmc_card/inc/at32_sdio.h:140
sd_csd_struct_type::reserved2
uint8_t reserved2
Definition emmc_card/inc/at32_sdio.h:138
sd_csd_struct_type::erase_group_size_mult
uint8_t erase_group_size_mult
Definition emmc_card/inc/at32_sdio.h:146
sd_csd_struct_type::file_formart
uint8_t file_formart
Definition emmc_card/inc/at32_sdio.h:159
sd_csd_struct_type::temp_write_protect
uint8_t temp_write_protect
Definition emmc_card/inc/at32_sdio.h:158
sd_csd_struct_type::permanent_write_protect
uint8_t permanent_write_protect
Definition emmc_card/inc/at32_sdio.h:157
sd_csd_struct_type::max_read_current_vdd_max
uint8_t max_read_current_vdd_max
Definition emmc_card/inc/at32_sdio.h:141
sd_csd_struct_type::file_format_group
uint8_t file_format_group
Definition emmc_card/inc/at32_sdio.h:155
sd_csd_struct_type::device_size
uint32_t device_size
Definition emmc_card/inc/at32_sdio.h:139
sd_csd_struct_type::write_blk_misalign
uint8_t write_blk_misalign
Definition emmc_card/inc/at32_sdio.h:135
sd_csd_struct_type::csd_struct
uint8_t csd_struct
Definition emmc_card/inc/at32_sdio.h:126
sd_csd_struct_type::write_protect_group_enable
uint8_t write_protect_group_enable
Definition emmc_card/inc/at32_sdio.h:148
sd_csd_struct_type::max_write_current_vdd_min
uint8_t max_write_current_vdd_min
Definition emmc_card/inc/at32_sdio.h:142
sd_csd_struct_type::reserved1
uint8_t reserved1
Definition emmc_card/inc/at32_sdio.h:128
sd_csd_struct_type::max_write_blk_length
uint8_t max_write_blk_length
Definition emmc_card/inc/at32_sdio.h:151
sd_csd_struct_type::csd_crc
uint8_t csd_crc
Definition emmc_card/inc/at32_sdio.h:161
sd_csd_struct_type::write_protect_group_size
uint8_t write_protect_group_size
Definition emmc_card/inc/at32_sdio.h:147
sd_csd_struct_type::reserved3
uint8_t reserved3
Definition emmc_card/inc/at32_sdio.h:153
sd_csd_struct_type::taac
uint8_t taac
Definition emmc_card/inc/at32_sdio.h:129
sd_csd_struct_type::manufacturer_default_ecc
uint8_t manufacturer_default_ecc
Definition emmc_card/inc/at32_sdio.h:149
sd_csd_struct_type::part_blk_write
uint8_t part_blk_write
Definition emmc_card/inc/at32_sdio.h:152
sd_csd_struct_type::copy_flag
uint8_t copy_flag
Definition emmc_card/inc/at32_sdio.h:156
sd_csd_struct_type::erase_group_size
uint8_t erase_group_size
Definition emmc_card/inc/at32_sdio.h:145
sd_csd_struct_type::device_size_mult
uint8_t device_size_mult
Definition emmc_card/inc/at32_sdio.h:144
sd_scr_struct_type::sd_bus_width
uint32_t sd_bus_width
Definition emmc_card/inc/at32_sdio.h:221
sd_scr_struct_type::sd_spec
uint32_t sd_spec
Definition emmc_card/inc/at32_sdio.h:219
sdio_command_struct_type
sdio command structure
Definition at32f413_sdio.h:228
sdio_command_struct_type::cmd_index
uint8_t cmd_index
Definition at32f413_sdio.h:230
sdio_command_struct_type::argument
uint32_t argument
Definition at32f413_sdio.h:229
sdio_command_struct_type::wait_type
sdio_wait_type wait_type
Definition at32f413_sdio.h:232
sdio_command_struct_type::rsp_type
sdio_reponse_type rsp_type
Definition at32f413_sdio.h:231
sdio_data_struct_type
sdio data structure
Definition at32f413_sdio.h:239
sdio_data_struct_type::block_size
sdio_block_size_type block_size
Definition at32f413_sdio.h:242
sdio_data_struct_type::transfer_direction
sdio_transfer_direction_type transfer_direction
Definition at32f413_sdio.h:244
sdio_data_struct_type::timeout
uint32_t timeout
Definition at32f413_sdio.h:240
sdio_data_struct_type::transfer_mode
sdio_transfer_mode_type transfer_mode
Definition at32f413_sdio.h:243
sdio_data_struct_type::data_length
uint32_t data_length
Definition at32f413_sdio.h:241


AT32F413 Firmwary Library: ffconf.h Source File

  • sdio
  • sdio_fatfs
  • inc
ffconf.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------------/
2/ FatFs Functional Configurations
3/---------------------------------------------------------------------------*/
4
5#define FFCONF_DEF 86631 /* Revision ID */
6
7/*---------------------------------------------------------------------------/
8/ Function Configurations
9/---------------------------------------------------------------------------*/
10
11#define FF_FS_READONLY 0
12/* This option switches read-only configuration. (0:Read/Write or 1:Read-only)
13/ Read-only configuration removes writing API functions, f_write(), f_sync(),
14/ f_unlink(), f_mkdir(), f_chmod(), f_rename(), f_truncate(), f_getfree()
15/ and optional writing functions as well. */
16
17
18#define FF_FS_MINIMIZE 0
19/* This option defines minimization level to remove some basic API functions.
20/
21/ 0: Basic functions are fully enabled.
22/ 1: f_stat(), f_getfree(), f_unlink(), f_mkdir(), f_truncate() and f_rename()
23/ are removed.
24/ 2: f_opendir(), f_readdir() and f_closedir() are removed in addition to 1.
25/ 3: f_lseek() function is removed in addition to 2. */
26
27
28#define FF_USE_FIND 0
29/* This option switches filtered directory read functions, f_findfirst() and
30/ f_findnext(). (0:Disable, 1:Enable 2:Enable with matching altname[] too) */
31
32
33#define FF_USE_MKFS 1//0
34/* This option switches f_mkfs() function. (0:Disable or 1:Enable) */
35
36
37#define FF_USE_FASTSEEK 1//0
38/* This option switches fast seek function. (0:Disable or 1:Enable) */
39
40
41#define FF_USE_EXPAND 0
42/* This option switches f_expand function. (0:Disable or 1:Enable) */
43
44
45#define FF_USE_CHMOD 0
46/* This option switches attribute manipulation functions, f_chmod() and f_utime().
47/ (0:Disable or 1:Enable) Also FF_FS_READONLY needs to be 0 to enable this option. */
48
49
50#define FF_USE_LABEL 0
51/* This option switches volume label functions, f_getlabel() and f_setlabel().
52/ (0:Disable or 1:Enable) */
53
54
55#define FF_USE_FORWARD 0
56/* This option switches f_forward() function. (0:Disable or 1:Enable) */
57
58
59#define FF_USE_STRFUNC 0
60#define FF_PRINT_LLI 0
61#define FF_PRINT_FLOAT 0
62#define FF_STRF_ENCODE 0
63/* FF_USE_STRFUNC switches string functions, f_gets(), f_putc(), f_puts() and
64/ f_printf().
65/
66/ 0: Disable. FF_PRINT_LLI, FF_PRINT_FLOAT and FF_STRF_ENCODE have no effect.
67/ 1: Enable without LF-CRLF conversion.
68/ 2: Enable with LF-CRLF conversion.
69/
70/ FF_PRINT_LLI = 1 makes f_printf() support long long argument and FF_PRINT_FLOAT = 1/2
71 makes f_printf() support floating point argument. These features want C99 or later.
72/ When FF_LFN_UNICODE >= 1 with LFN enabled, string functions convert the character
73/ encoding in it. FF_STRF_ENCODE selects assumption of character encoding ON THE FILE
74/ to be read/written via those functions.
75/
76/ 0: ANSI/OEM in current CP
77/ 1: Unicode in UTF-16LE
78/ 2: Unicode in UTF-16BE
79/ 3: Unicode in UTF-8
80*/
81
82
83/*---------------------------------------------------------------------------/
84/ Locale and Namespace Configurations
85/---------------------------------------------------------------------------*/
86
87#define FF_CODE_PAGE 932
88/* This option specifies the OEM code page to be used on the target system.
89/ Incorrect code page setting can cause a file open failure.
90/
91/ 437 - U.S.
92/ 720 - Arabic
93/ 737 - Greek
94/ 771 - KBL
95/ 775 - Baltic
96/ 850 - Latin 1
97/ 852 - Latin 2
98/ 855 - Cyrillic
99/ 857 - Turkish
100/ 860 - Portuguese
101/ 861 - Icelandic
102/ 862 - Hebrew
103/ 863 - Canadian French
104/ 864 - Arabic
105/ 865 - Nordic
106/ 866 - Russian
107/ 869 - Greek 2
108/ 932 - Japanese (DBCS)
109/ 936 - Simplified Chinese (DBCS)
110/ 949 - Korean (DBCS)
111/ 950 - Traditional Chinese (DBCS)
112/ 0 - Include all code pages above and configured by f_setcp()
113*/
114
115
116#define FF_USE_LFN 0
117#define FF_MAX_LFN 255
118/* The FF_USE_LFN switches the support for LFN (long file name).
119/
120/ 0: Disable LFN. FF_MAX_LFN has no effect.
121/ 1: Enable LFN with static working buffer on the BSS. Always NOT thread-safe.
122/ 2: Enable LFN with dynamic working buffer on the STACK.
123/ 3: Enable LFN with dynamic working buffer on the HEAP.
124/
125/ To enable the LFN, ffunicode.c needs to be added to the project. The LFN function
126/ requiers certain internal working buffer occupies (FF_MAX_LFN + 1) * 2 bytes and
127/ additional (FF_MAX_LFN + 44) / 15 * 32 bytes when exFAT is enabled.
128/ The FF_MAX_LFN defines size of the working buffer in UTF-16 code unit and it can
129/ be in range of 12 to 255. It is recommended to be set it 255 to fully support LFN
130/ specification.
131/ When use stack for the working buffer, take care on stack overflow. When use heap
132/ memory for the working buffer, memory management functions, ff_memalloc() and
133/ ff_memfree() exemplified in ffsystem.c, need to be added to the project. */
134
135
136#define FF_LFN_UNICODE 0
137/* This option switches the character encoding on the API when LFN is enabled.
138/
139/ 0: ANSI/OEM in current CP (TCHAR = char)
140/ 1: Unicode in UTF-16 (TCHAR = WCHAR)
141/ 2: Unicode in UTF-8 (TCHAR = char)
142/ 3: Unicode in UTF-32 (TCHAR = DWORD)
143/
144/ Also behavior of string I/O functions will be affected by this option.
145/ When LFN is not enabled, this option has no effect. */
146
147
148#define FF_LFN_BUF 255
149#define FF_SFN_BUF 12
150/* This set of options defines size of file name members in the FILINFO structure
151/ which is used to read out directory items. These values should be suffcient for
152/ the file names to read. The maximum possible length of the read file name depends
153/ on character encoding. When LFN is not enabled, these options have no effect. */
154
155
156#define FF_FS_RPATH 0
157/* This option configures support for relative path.
158/
159/ 0: Disable relative path and remove related functions.
160/ 1: Enable relative path. f_chdir() and f_chdrive() are available.
161/ 2: f_getcwd() function is available in addition to 1.
162*/
163
164
165/*---------------------------------------------------------------------------/
166/ Drive/Volume Configurations
167/---------------------------------------------------------------------------*/
168
169#define FF_VOLUMES 3//1
170/* Number of volumes (logical drives) to be used. (1-10) */
171
172
173#define FF_STR_VOLUME_ID 0
174#define FF_VOLUME_STRS "RAM","NAND","CF","SD","SD2","USB","USB2","USB3"
175/* FF_STR_VOLUME_ID switches support for volume ID in arbitrary strings.
176/ When FF_STR_VOLUME_ID is set to 1 or 2, arbitrary strings can be used as drive
177/ number in the path name. FF_VOLUME_STRS defines the volume ID strings for each
178/ logical drives. Number of items must not be less than FF_VOLUMES. Valid
179/ characters for the volume ID strings are A-Z, a-z and 0-9, however, they are
180/ compared in case-insensitive. If FF_STR_VOLUME_ID >= 1 and FF_VOLUME_STRS is
181/ not defined, a user defined volume string table needs to be defined as:
182/
183/ const char* VolumeStr[FF_VOLUMES] = {"ram","flash","sd","usb",...
184*/
185
186
187#define FF_MULTI_PARTITION 0
188/* This option switches support for multiple volumes on the physical drive.
189/ By default (0), each logical drive number is bound to the same physical drive
190/ number and only an FAT volume found on the physical drive will be mounted.
191/ When this function is enabled (1), each logical drive number can be bound to
192/ arbitrary physical drive and partition listed in the VolToPart[]. Also f_fdisk()
193/ funciton will be available. */
194
195
196#define FF_MIN_SS 512
197#define FF_MAX_SS 512
198/* This set of options configures the range of sector size to be supported. (512,
199/ 1024, 2048 or 4096) Always set both 512 for most systems, generic memory card and
200/ harddisk, but a larger value may be required for on-board flash memory and some
201/ type of optical media. When FF_MAX_SS is larger than FF_MIN_SS, FatFs is configured
202/ for variable sector size mode and disk_ioctl() function needs to implement
203/ GET_SECTOR_SIZE command. */
204
205
206#define FF_LBA64 0
207/* This option switches support for 64-bit LBA. (0:Disable or 1:Enable)
208/ To enable the 64-bit LBA, also exFAT needs to be enabled. (FF_FS_EXFAT == 1) */
209
210
211#define FF_MIN_GPT 0x10000000
212/* Minimum number of sectors to switch GPT as partitioning format in f_mkfs and
213/ f_fdisk function. 0x100000000 max. This option has no effect when FF_LBA64 == 0. */
214
215
216#define FF_USE_TRIM 0
217/* This option switches support for ATA-TRIM. (0:Disable or 1:Enable)
218/ To enable Trim function, also CTRL_TRIM command should be implemented to the
219/ disk_ioctl() function. */
220
221
222
223/*---------------------------------------------------------------------------/
224/ System Configurations
225/---------------------------------------------------------------------------*/
226
227#define FF_FS_TINY 0
228/* This option switches tiny buffer configuration. (0:Normal or 1:Tiny)
229/ At the tiny configuration, size of file object (FIL) is shrinked FF_MAX_SS bytes.
230/ Instead of private sector buffer eliminated from the file object, common sector
231/ buffer in the filesystem object (FATFS) is used for the file data transfer. */
232
233
234#define FF_FS_EXFAT 0
235/* This option switches support for exFAT filesystem. (0:Disable or 1:Enable)
236/ To enable exFAT, also LFN needs to be enabled. (FF_USE_LFN >= 1)
237/ Note that enabling exFAT discards ANSI C (C89) compatibility. */
238
239
240#define FF_FS_NORTC 1//0
241#define FF_NORTC_MON 1
242#define FF_NORTC_MDAY 1
243#define FF_NORTC_YEAR 2020
244/* The option FF_FS_NORTC switches timestamp functiton. If the system does not have
245/ any RTC function or valid timestamp is not needed, set FF_FS_NORTC = 1 to disable
246/ the timestamp function. Every object modified by FatFs will have a fixed timestamp
247/ defined by FF_NORTC_MON, FF_NORTC_MDAY and FF_NORTC_YEAR in local time.
248/ To enable timestamp function (FF_FS_NORTC = 0), get_fattime() function need to be
249/ added to the project to read current time form real-time clock. FF_NORTC_MON,
250/ FF_NORTC_MDAY and FF_NORTC_YEAR have no effect.
251/ These options have no effect in read-only configuration (FF_FS_READONLY = 1). */
252
253
254#define FF_FS_NOFSINFO 0
255/* If you need to know correct free space on the FAT32 volume, set bit 0 of this
256/ option, and f_getfree() function at first time after volume mount will force
257/ a full FAT scan. Bit 1 controls the use of last allocated cluster number.
258/
259/ bit0=0: Use free cluster count in the FSINFO if available.
260/ bit0=1: Do not trust free cluster count in the FSINFO.
261/ bit1=0: Use last allocated cluster number in the FSINFO if available.
262/ bit1=1: Do not trust last allocated cluster number in the FSINFO.
263*/
264
265
266#define FF_FS_LOCK 0
267/* The option FF_FS_LOCK switches file lock function to control duplicated file open
268/ and illegal operation to open objects. This option must be 0 when FF_FS_READONLY
269/ is 1.
270/
271/ 0: Disable file lock function. To avoid volume corruption, application program
272/ should avoid illegal open, remove and rename to the open objects.
273/ >0: Enable file lock function. The value defines how many files/sub-directories
274/ can be opened simultaneously under file lock control. Note that the file
275/ lock control is independent of re-entrancy. */
276
277
278/* #include <somertos.h> // O/S definitions */
279#define FF_FS_REENTRANT 0
280#define FF_FS_TIMEOUT 1000
281#define FF_SYNC_t HANDLE
282/* The option FF_FS_REENTRANT switches the re-entrancy (thread safe) of the FatFs
283/ module itself. Note that regardless of this option, file access to different
284/ volume is always re-entrant and volume control functions, f_mount(), f_mkfs()
285/ and f_fdisk() function, are always not re-entrant. Only file/directory access
286/ to the same volume is under control of this function.
287/
288/ 0: Disable re-entrancy. FF_FS_TIMEOUT and FF_SYNC_t have no effect.
289/ 1: Enable re-entrancy. Also user provided synchronization handlers,
290/ ff_req_grant(), ff_rel_grant(), ff_del_syncobj() and ff_cre_syncobj()
291/ function, must be added to the project. Samples are available in
292/ option/syscall.c.
293/
294/ The FF_FS_TIMEOUT defines timeout period in unit of time tick.
295/ The FF_SYNC_t defines O/S dependent sync object type. e.g. HANDLE, ID, OS_EVENT*,
296/ SemaphoreHandle_t and etc. A header file for O/S definitions needs to be
297/ included somewhere in the scope of ff.h. */
298
299
300
301/*--- End of configuration options ---*/


AT32F413 Firmwary Library: fir_coefficient.c Source File

  • utilities
  • at32f413_slib_demo
  • project_l0
  • src
fir_coefficient.c
Go to the documentation of this file.
1/* ----------------------------------------------------------------------
2 * Copyright (C) 2010-2012 ARM Limited. All rights reserved.
3 *
4* $Date: 17. January 2013
5* $Revision: V1.4.0
6*
7* Project: CMSIS DSP Library
8 * Title: arm_fir_example_f32.c
9 *
10 * Description: Example code demonstrating how an FIR filter can be used
11 * as a low pass filter.
12 *
13 * Target Processor: Cortex-M4/Cortex-M3
14 *
15* Redistribution and use in source and binary forms, with or without
16* modification, are permitted provided that the following conditions
17* are met:
18* - Redistributions of source code must retain the above copyright
19* notice, this list of conditions and the following disclaimer.
20* - Redistributions in binary form must reproduce the above copyright
21* notice, this list of conditions and the following disclaimer in
22* the documentation and/or other materials provided with the
23* distribution.
24* - Neither the name of ARM LIMITED nor the names of its contributors
25* may be used to endorse or promote products derived from this
26* software without specific prior written permission.
27*
28* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39* POSSIBILITY OF SUCH DAMAGE.
40* -------------------------------------------------------------------- */
41/* ----------------------------------------------------------------------
42** Include Files
43** ------------------------------------------------------------------- */
44#include "at32f413.h"
45#include "arm_math.h"
46#include "fir_filter.h"
47/* ----------------------------------------------------------------------
48** Macro Defines
49** ------------------------------------------------------------------- */
50
51#define NUM_TAPS 29
52
53/* ----------------------------------------------------------------------
54** FIR Coefficients buffer generated using fir1() MATLAB function.
55** fir1(28, 6/24)
56** ------------------------------------------------------------------- */
57//#if defined ( __ICCARM__ )
58//const float32_t firCoeffs32[NUM_TAPS] @ 0x08002000 ={
59//#elif defined ( __CC_ARM )
60//const float32_t firCoeffs32[NUM_TAPS] __attribute__((at(0x08002000))) = {
61//#endif
62const float32_t firCoeffs32[NUM_TAPS] = {
63 -0.0018225230f, -0.0015879294f, +0.0000000000f, +0.0036977508f, +0.0080754303f, +0.0085302217f, -0.0000000000f, -0.0173976984f,
64 -0.0341458607f, -0.0333591565f, +0.0000000000f, +0.0676308395f, +0.1522061835f, +0.2229246956f, +0.2504960933f, +0.2229246956f,
65 +0.1522061835f, +0.0676308395f, +0.0000000000f, -0.0333591565f, -0.0341458607f, -0.0173976984f, -0.0000000000f, +0.0085302217f,
66 +0.0080754303f, +0.0036977508f, +0.0000000000f, -0.0015879294f, -0.0018225230f
67};
68
at32f413.h
at32f413 header file
firCoeffs32
const float32_t firCoeffs32[29]
Definition fir_coefficient.c:62
NUM_TAPS
#define NUM_TAPS
Definition fir_coefficient.c:51


AT32F413 Firmwary Library: fir_filter.c Source File

  • utilities
  • at32f413_slib_demo
  • project_l0
  • src
fir_filter.c
Go to the documentation of this file.
1/* ----------------------------------------------------------------------
2 * Copyright (C) 2010-2012 ARM Limited. All rights reserved.
3 *
4* $Date: 17. January 2013
5* $Revision: V1.4.0
6*
7* Project: CMSIS DSP Library
8 * Title: arm_fir_example_f32.c
9 *
10 * Description: Example code demonstrating how an FIR filter can be used
11 * as a low pass filter.
12 *
13 * Target Processor: Cortex-M4/Cortex-M3
14 *
15* Redistribution and use in source and binary forms, with or without
16* modification, are permitted provided that the following conditions
17* are met:
18* - Redistributions of source code must retain the above copyright
19* notice, this list of conditions and the following disclaimer.
20* - Redistributions in binary form must reproduce the above copyright
21* notice, this list of conditions and the following disclaimer in
22* the documentation and/or other materials provided with the
23* distribution.
24* - Neither the name of ARM LIMITED nor the names of its contributors
25* may be used to endorse or promote products derived from this
26* software without specific prior written permission.
27*
28* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39* POSSIBILITY OF SUCH DAMAGE.
40* -------------------------------------------------------------------- */
41/* ----------------------------------------------------------------------
42** Include Files
43** ------------------------------------------------------------------- */
44#include "at32f413.h"
45#include "arm_math.h"
46#include "fir_filter.h"
47
48extern const float32_t firCoeffs32[];
49
50/* ----------------------------------------------------------------------
51** Macro Defines
52** ------------------------------------------------------------------- */
53#define BLOCK_SIZE 32
54#define NUM_TAPS 29
55
56/* -------------------------------------------------------------------
57 * Declare State buffer of size (numTaps + blockSize - 1)
58 * ------------------------------------------------------------------- */
59
60
61//#if defined ( __ICCARM__ )
62//static float32_t firStateF32[BLOCK_SIZE + NUM_TAPS - 1] @ 0x20017000 ;
63//#elif defined ( __CC_ARM )
64//static float32_t firStateF32[BLOCK_SIZE + NUM_TAPS - 1] __attribute__((at(0x20017000)));
65//#endif
66static float32_t firStateF32[BLOCK_SIZE + NUM_TAPS - 1] ;
67
68/* ----------------------------------------------------------------------
69** FIR Coefficients buffer generated using fir1() MATLAB function.
70** fir1(28, 6/24)
71** ------------------------------------------------------------------- */
72
73/* ----------------------------------------------------------------------
74 * FIR LPF Example
75 * ------------------------------------------------------------------- */
76void FIR_lowpass_filter(float32_t * pSrc, float32_t * pDst, uint32_t testlengthsamples)
77{
78 uint32_t i;
79 uint32_t blockSize = BLOCK_SIZE;
80 uint32_t numBlocks = testlengthsamples/BLOCK_SIZE;
81 arm_fir_instance_f32 S;
82
83
84 /* Call FIR init function to initialize the instance structure. */
85 arm_fir_init_f32(&S, NUM_TAPS, (float32_t *)&firCoeffs32[0], &firStateF32[0], blockSize);
86 /* ----------------------------------------------------------------------
87 ** Call the FIR process function for every blockSize samples
88 ** ------------------------------------------------------------------- */
89 for(i=0; i < numBlocks; i++)
90 {
91 arm_fir_f32(&S, pSrc + (i * blockSize), pDst + (i * blockSize), blockSize);
92 }
93
94}
at32f413.h
at32f413 header file
firCoeffs32
const float32_t firCoeffs32[]
Definition fir_coefficient.c:62
NUM_TAPS
#define NUM_TAPS
Definition fir_filter.c:54
firStateF32
static float32_t firStateF32[32+29 - 1]
Definition fir_filter.c:66
BLOCK_SIZE
#define BLOCK_SIZE
Definition fir_filter.c:53
FIR_lowpass_filter
void FIR_lowpass_filter(float32_t *pSrc, float32_t *pDst, uint32_t testlengthsamples)
Definition fir_filter.c:76
arm_fir_f32
void arm_fir_f32(const arm_fir_instance_f32 *S, const float32_t *pSrc, float32_t *pDst, uint32_t blockSize)
arm_fir_init_f32
void arm_fir_init_f32(arm_fir_instance_f32 *S, uint16_t numTaps, const float32_t *pCoeffs, float32_t *pState, uint32_t blockSize)
Initialization function for the floating-point FIR filter.
Definition arm_fir_init_f32.c:59


AT32F413 Firmwary Library: flash_fat16.c Source File

  • usb_device
  • virtual_msc_iap
  • src
flash_fat16.c
Go to the documentation of this file.
1
25#include "flash_fat16.h"
26#include "usb_conf.h"
27
35#define FAT16_SECTOR_SIZE 62
36#define FAT16_CLUSTER_SIZE (4 * 0x800)
37#define FAT16_FIRST_CLUSTER (8 * 0x800)
38static uint8_t fat16_sector[FAT16_SECTOR_SIZE] =
39{
40 0xEB, /*0*/
41 0x3C, /*1*/
42 0x90, /*2*/
43 0x4D, /*3*/
44 0x53, /*4*/
45 0x44, /*5*/
46 0x4F, /*6*/
47 0x53, /*7*/
48 0x35, /*8*/
49 0x2E, /*9*/
50 0x30, /*10*/
51 0x00, /*11*/
52 0x08, /*12*/ //2K
53 0x04, /*13*/
54 0x06, /*14*/
55 0x00, /*15*/
56
57 0x02, /*16*/
58 0x00, /*17*/
59 0x02, /*18*/
60 0xFF, /*19*/
61 0x0F, /*20*/
62 0xF8, /*21*/
63 0x01, /*22*/
64 0x00, /*23*/
65 0x01, /*24*/
66 0x00, /*25*/
67 0x01, /*26*/
68 0x00, /*27*/
69 0x00, /*28*/
70 0x00, /*29*/
71 0x00, /*30*/
72 0x00, /*31*/
73
74 0x00, /*32*/
75 0x00, /*33*/
76 0x00, /*34*/
77 0x00, /*35*/
78 0x00, /*36*/
79 0x00, /*37*/
80 0x29, /*38*/
81 0x96, /*39*/
82 0x16, /*40*/
83 0x66, /*41*/
84 0xD3, /*42*/
85 0x20, /*43*/
86 0x20, /*44*/
87 0x20, /*45*/
88 0x20, /*46*/
89 0x20, /*47*/
90
91 0x20, /*48*/
92 0x20, /*49*/
93 0x20, /*50*/
94 0x20, /*51*/
95 0x20, /*52*/
96 0x20, /*53*/
97 0x46, /*54*/
98 0x41, /*55*/
99 0x54, /*56*/
100 0x31, /*57*/
101 0x36, /*58*/
102 0x20, /*59*/
103 0x20, /*60*/
104 0x20 /*61*/
105};
106
107
108
109const uint8_t fat16_root_dir_sector[FAT16_DIR_SIZE]=
110{
111 0x20, /*11 - Archive Attribute set */
112 0x00, /*12 - Reserved */
113 0x4B, /*13 - Create Time Tenth */
114 0x9C, /*14 - Create Time */
115 0x42, /*15 - Create Time */
116 0x92, /*16 - Create Date */
117 0x38, /*17 - Create Date */
118 0x92, /*18 - Last Access Date */
119 0x38, /*19 - Last Access Date */
120 0x00, /*20 - Not used in FAT16 */
121 0x00, /*21 - Not used in FAT16 */
122 0x9D, /*22 - Write Time */
123 0x42, /*23 - Write Time */
124 0x92, /*24 - Write Date */
125 0x38, /*25 - Write Date */
126 0x00, /*26 - First Cluster (none, because file is empty) */
127 0x00, /*27 - First Cluster (none, because file is empty) */
128 0x00, /*28 - File Size */
129 0x00, /*29 - File Size */
130 0x00, /*30 - File Size */
131 0x00, /*31 - File Size */
132 'A','T','3','2',' ','I','A','P',' ',' ',' ', /*32-42 - Volume label */
133 0x08, /*43 - File attribute = Volume label */
134 0x00, /*44 - Reserved */
135 0x00, /*45 - Create Time Tenth */
136 0x00, /*46 - Create Time */
137 0x00, /*47 - Create Time */
138 0x00, /*48 - Create Date */
139 0x00, /*49 - Create Date */
140 0x00, /*50 - Last Access Date */
141 0x00, /*51 - Last Access Date */
142 0x00, /*52 - Not used in FAT16 */
143 0x00, /*53 - Not used in FAT16 */
144 0x9D, /*54 - Write Time */
145 0x42, /*55 - Write Time */
146 0x92, /*56 - Write Date */
147 0x38, /*57 - Write Date */
148};
149
150const uint8_t fat16_table_sector0[FAT16_TABLE_SIZE] =
151{
152 0xF8,
153 0xFF,
154 0xFF,
155 0xFF
156};
157
158uint8_t fat16_file_name[FAT16_FILENAME_SIZE] =
159{
160 'R',
161 'e',
162 'a',
163 'd',
164 'y',
165 ' ',
166 ' ',
167 ' ',
168 'T',
169 'X',
170 'T'
171};
172
173 fat_dir_type g_file_attr;
174 flash_iap_type flash_iap;
175uint32_t file_write_nr = 0;
176uint8_t file_match = 0;
177
178uint32_t flash_fat16_boot_dir_write(uint32_t fat_lbk, uint8_t *data, uint32_t len);
179uint32_t flash_fat16_sector_write(uint32_t fat_lbk, uint8_t *data, uint32_t len);
180uint32_t fat16_memory_copy(uint8_t *dst, const uint8_t *src, uint32_t len);
181uint32_t fat16_memory_memset(uint8_t *dst, uint32_t set, uint32_t len);
182uint32_t flash_write_data(uint32_t address, uint8_t *data, uint32_t len);
183uint32_t flash_read_data(uint32_t address, uint8_t *data, uint32_t len);
184uint32_t fat16_memory_cmp(uint8_t *dst, uint8_t *src, uint32_t len);
185uint32_t flash_crc_check(uint32_t address, uint8_t *data, uint32_t len);
186void flash_fat16_clear_upgrade_flag(void);
187void flash_fat16_set_upgrade_flag(void);
188
196uint32_t fat16_memory_copy(uint8_t *dst, const uint8_t *src, uint32_t len)
197{
198 uint32_t i_index;
199 for(i_index = 0; i_index < len; i_index ++)
200 {
201 dst[i_index] = src[i_index];
202 }
203 return i_index;
204}
205
213uint32_t fat16_memory_memset(uint8_t *dst, uint32_t set, uint32_t len)
214{
215 uint32_t i_index;
216 for(i_index = 0; i_index < len; i_index ++)
217 {
218 dst[i_index] = (uint8_t)set;
219 }
220 return i_index;
221}
222
230uint32_t fat16_memory_cmp(uint8_t *dst, uint8_t *src, uint32_t len)
231{
232 uint32_t i_index;
233 for(i_index = 0; i_index < len; i_index ++)
234 {
235 if(dst[i_index] != src[i_index])
236 return 1;
237 }
238 return 0;
239}
240
246void flash_fat16_clear_upgrade_flag(void)
247{
248 flash_unlock();
249 flash_sector_erase(flash_iap.flash_app_addr - flash_iap.sector_size);
250 flash_lock();
251}
252
258void flash_fat16_set_upgrade_flag(void)
259{
260 flash_unlock();
261 flash_word_program(flash_iap.flash_app_addr - flash_iap.sector_size,
262 IAP_UPGRADE_COMPLETE_FLAG);
263 flash_lock();
264}
265
271uint8_t flash_fat16_get_upgrade_flag(void)
272{
273 uint32_t flag_address = flash_iap.flash_app_addr - flash_iap.sector_size;
274 if(*((uint32_t *)flag_address) == IAP_UPGRADE_COMPLETE_FLAG)
275 {
276 return IAP_SUCCESS;
277 }
278 else
279 {
280 return IAP_FAILED;
281 }
282}
283
291uint32_t flash_fat16_read(uint32_t fat_lbk, uint8_t *data, uint32_t len)
292{
293 uint32_t i_index = 0;
294 switch(fat_lbk)
295 {
296 case FLASH_FAT16_BOOT_SECTOR_ADDR:
297 i_index += fat16_memory_copy(data, fat16_sector, FAT16_SECTOR_SIZE);
298 i_index += 2;
299
300 fat16_memory_memset(data+i_index, 0, FAT16_BYTE_PER_SIZE-i_index);
301 data[510] = 0x55;
302 data[511] = 0xAA;
303
304 break;
305 case FLASH_FAT16_1_ADDR:
306 case FLASH_FAT16_2_ADDR:
307 i_index += fat16_memory_copy(data, fat16_table_sector0, FAT16_TABLE_SIZE);
308
309 fat16_memory_memset(data+i_index, 0, FAT16_BYTE_PER_SIZE-i_index);
310 break;
311 case FLASH_FAT16_ROOT_ADDR:
312 i_index += fat16_memory_copy(data, fat16_file_name, FAT16_FILENAME_SIZE);
313 i_index += fat16_memory_copy(data + i_index, fat16_root_dir_sector, FAT16_DIR_SIZE);
314
315 fat16_memory_memset(data+i_index, 0, FAT16_BYTE_PER_SIZE-i_index);
316 break;
317 default:
318 i_index = 0;
319 fat16_memory_memset(data+i_index, 0, FAT16_BYTE_PER_SIZE-i_index);
320 break;
321 }
322 return FAT16_BYTE_PER_SIZE;
323}
324
332uint32_t flash_fat16_write(uint32_t fat_lbk, uint8_t *data, uint32_t len)
333{
334 switch(fat_lbk)
335 {
336 case FLASH_FAT16_BOOT_SECTOR_ADDR:
337 case FLASH_FAT16_1_ADDR:
338 case FLASH_FAT16_2_ADDR:
339 break;
340 case FLASH_FAT16_ROOT_ADDR:
341 flash_fat16_boot_dir_write(fat_lbk, data, len);
342 break;
343 default:
344 if(fat_lbk >= FLASH_FAT16_FILE_START_ADDR)
345 {
346 flash_fat16_sector_write(fat_lbk, data, len);
347 }
348 break;
349
350 }
351 return len;
352}
353
360uint32_t flash_fat16_set_name(const uint8_t *file_name, uint8_t len)
361{
362 uint8_t i_index = 0;
363 for(i_index = 0; i_index < len && i_index < 8; i_index ++)
364 {
365 fat16_file_name[i_index] = file_name[i_index];
366 }
367
368 for(; i_index < 8; i_index ++)
369 {
370 fat16_file_name[i_index] = ' ';
371 }
372 return i_index;
373}
374
382uint32_t flash_fat16_boot_dir_write(uint32_t fat_lbk, uint8_t *data, uint32_t len)
383{
384 fat_dir_type *pdir = (fat_dir_type *)data;
385 uint32_t i_index = 2, loop_len = 0;
386
387 pdir ++;
388 pdir ++;
389 loop_len += 64;
390
391 while(i_index ++ < 512 && loop_len < len)
392 {
393 if((pdir->attr == 0x20) && ((pdir + 1)->attr == 0x00))
394 {
395 break;
396 }
397 else
398 {
399 pdir ++;
400 }
401 loop_len += 32;
402 }
403
404 if(i_index <= 512 && loop_len < len)
405 {
406 fat16_memory_copy((uint8_t *)&g_file_attr, (const uint8_t *)pdir, 32);
407
408 if(file_match == 1)
409 {
410 file_match = 0;
411 if(g_file_attr.file_size > 0)
412 {
413 if(flash_iap.file_write_nr >= g_file_attr.file_size)
414 {
415 /* upgrade finish */
416 flash_iap.file_write_nr = 0;
417 flash_iap.msc_up_status = UPGRADE_SUCCESS;
418
419 /* set the upgrade done flag to flash */
420 flash_fat16_set_upgrade_flag();
421 }
422 }
423 }
424 g_file_attr.write_data = 0;
425 g_file_attr.write_time = 0;
426 flash_iap.file_write_nr = 0;
427 }
428 else
429 {
430 fat16_memory_memset((uint8_t *)&g_file_attr, 0, 32);
431 }
432 return len;
433}
434
440uint32_t flash_fat16_addr_offset(uint8_t *file_name)
441{
442 uint8_t i_index = 0, offset_shift = 20;
443 uint32_t offset = 0;
444 uint8_t *pfile = file_name;
445
446 if(*pfile != 'A')
447 {
448 return INVAILD_OFFSET_ADDR;
449 }
450 pfile += 1;
451
452 for(i_index = 0; i_index < 6; i_index ++)
453 {
454 if(*pfile >= '0' && *pfile <= '9')
455 {
456 offset |= (*pfile - '0') << offset_shift;
457 }
458 else if(*pfile >= 'A' && *pfile <= 'F')
459 {
460 offset |= (*pfile - 'A' + 0xA) << offset_shift;
461 }
462 else if(*pfile >= 'a' && *pfile <= 'f')
463 {
464 offset |= (*pfile - 'a' + 0xA) << offset_shift;
465 }
466 else
467 {
468 return INVAILD_OFFSET_ADDR;
469 }
470 pfile ++;
471 offset_shift -= 4;
472 }
473
474 if((offset < (flash_iap.flash_app_addr - flash_iap.flash_base_addr)) ||
475 (offset > flash_iap.flash_size ))
476 {
477 return INVAILD_OFFSET_ADDR;
478 }
479 return offset;
480}
481
489uint32_t flash_fat16_sector_write(uint32_t fat_lbk, uint8_t *data, uint32_t len)
490{
491 uint32_t file_size = g_file_attr.file_size;
492 uint32_t flash_offset = 0;
493 uint32_t status;
494 static uint32_t s_bin_sp = 0;
495 static uint32_t s_bin_pc = 0;
496 static uint32_t file_offset_lbk = 0;
497
498 if(s_bin_sp == 0 && s_bin_pc == 0)
499 {
500 s_bin_sp = *(uint32_t *)data;
501 s_bin_pc = *(uint32_t *)(data+4);
502 }
503
504 /* check the suffix is .bin or .BIN*/
505 if((fat16_memory_cmp((uint8_t *)&g_file_attr.file_name[8],
506 (uint8_t *)FILE_SUFFIX1_NAME, FILE_SUFFIX1_LEN) == 0) ||
507 (fat16_memory_cmp((uint8_t *)&g_file_attr.file_name[8],
508 (uint8_t *)FILE_SUFFIX2_NAME, FILE_SUFFIX2_LEN) == 0)
509 ||
510 ((s_bin_sp & 0xF0000000) == 0x20000000 && (s_bin_pc & 0xFF000000) == 0x08000000))
511 {
512 /* check the upgrade status */
513 if(flash_iap.msc_up_status == UPGRADE_DONE || flash_iap.msc_up_status == UPGRADE_SUCCESS)
514 {
515 return 0;
516 }
517
518 if(g_file_attr.file_size == 0)
519 {
520 g_file_attr.file_size = flash_iap.flash_app_size;
521 }
522 file_match = 1;
523
524 file_size = g_file_attr.file_size;
525
526 if(flash_iap.msc_up_status == UPGRADE_READY)
527 {
528 /* get offset address from filename */
529 flash_offset = flash_fat16_addr_offset(g_file_attr.file_name);
530
531 if(flash_offset == INVAILD_OFFSET_ADDR)
532 {
533 /* use default app address */
534 flash_iap.write_addr = FLASH_APP_START_ADDR;
535 }
536 else
537 {
538 flash_iap.write_addr = flash_offset + flash_iap.flash_base_addr;
539 }
540 if( FAT16_FIRST_CLUSTER + (g_file_attr.clus_low * FAT16_CLUSTER_SIZE) == fat_lbk)
541 {
542 file_offset_lbk = FAT16_FIRST_CLUSTER + (g_file_attr.clus_low * FAT16_CLUSTER_SIZE);
543 }
544 else
545 {
546 file_offset_lbk = fat_lbk;
547 }
548
549 /* clear upgrade flag */
550 flash_fat16_clear_upgrade_flag();
551
552 flash_iap.msc_up_status = UPGRAGE_ONGOING;
553 }
554
555 if(flash_iap.flash_app_size >= g_file_attr.file_size)
556 {
557 if(fat_lbk >= file_offset_lbk)
558 {
559 /* write data to flash and check crc */
560 status = flash_write_data(flash_iap.write_addr + fat_lbk - file_offset_lbk, data, len);
561 flash_iap.file_write_nr += len;
562 }
563 else
564 {
565 /* lbk address is invalid */
566 status = 1;
567 }
568
569 if(status == 0)
570 {
571 if(flash_iap.file_write_nr >= file_size * 2)
572 {
573 /* upgrade finish */
574 flash_iap.file_write_nr = 0;
575 flash_iap.msc_up_status = UPGRADE_SUCCESS;
576 s_bin_sp = 0;
577 s_bin_pc = 0;
578 /* set the upgrade done flag to flash */
579 flash_fat16_set_upgrade_flag();
580 }
581 }
582 else
583 {
584 /* upgrade failed */
585 flash_iap.file_write_nr = 0;
586 flash_iap.msc_up_status = UPGRADE_FAILED;
587 }
588 }
589 else
590 {
591 /* upgrade file is large than flash size */
592 flash_iap.msc_up_status = UPGRADE_LARGE;
593 }
594
595 }
596 else if((fat16_memory_cmp((uint8_t *)&g_file_attr.file_name[0],
597 (uint8_t *)"JUMP", 4) == 0))
598 {
599 /* receive jump command file */
600 flash_iap.msc_up_status = UPGRADE_JUMP;
601 }
602 else
603 {
604 /* unkonw upgrade status */
605 }
606
607 return len;
608}
609
617uint32_t flash_crc_check(uint32_t address, uint8_t *data, uint32_t len)
618{
619 uint32_t flash_crc = 0;
620 uint32_t data_crc = 0;
621 uint32_t i_index = 0;
622 uint32_t wlen = len / sizeof(uint32_t);
623 uint32_t remain_len = len % sizeof(uint32_t);
624 uint32_t *u32data = (uint32_t *)data;
625 uint32_t *flash_addr = (uint32_t *)address;
626
627 /* enable crc clock */
628 crm_periph_clock_enable(CRM_CRC_PERIPH_CLOCK, TRUE);
629
630 if(remain_len)
631 {
632 wlen += 1;
633 for(i_index = 0; i_index < (4 - remain_len); i_index ++)
634 {
635 data[len+i_index] = 0xFF;
636 }
637 }
638
639 /* calculate write buffer */
640 crc_data_reset();
641 for(i_index = 0; i_index < wlen; i_index ++)
642 {
643 data_crc = crc_one_word_calculate(u32data[i_index]);
644 }
645
646 /* calculate flash data */
647 crc_data_reset();
648 for(i_index = 0; i_index < wlen; i_index ++)
649 {
650 flash_crc = crc_one_word_calculate(*flash_addr++);
651 }
652 crm_periph_clock_enable(CRM_CRC_PERIPH_CLOCK, FALSE);
653
654 if(data_crc != flash_crc)
655 return 1;
656
657 return 0;
658
659}
660
668uint32_t flash_read_data(uint32_t address, uint8_t *data, uint32_t len)
669{
670 uint32_t i_index;
671 for(i_index = 0; i_index < len; i_index ++)
672 {
673 data[i_index] = *(uint8_t *)address;
674 address += 1;
675 }
676 return i_index;
677}
678
679
687uint32_t flash_write_data(uint32_t address, uint8_t *data, uint32_t len)
688{
689 uint32_t waddr = address;
690 uint32_t wlength = len;
691 uint32_t i_index = 0;
692 if((address + len) > flash_iap.flash_base_addr + flash_iap.flash_size)
693 {
694 return 1;
695 }
696
697 if((waddr & flash_iap.sector_mask) == 0)
698 {
699 flash_unlock();
700 if(len > flash_iap.sector_size)
701 {
702 for(; wlength >= flash_iap.sector_size; wlength -= flash_iap.sector_size)
703 {
704 flash_sector_erase(waddr);
705 waddr += flash_iap.sector_size;
706 }
707 if(wlength > 0)
708 {
709 flash_sector_erase(waddr);
710 }
711 }
712 else
713 {
714 flash_sector_erase(waddr);
715 }
716
717 flash_lock();
718 }
719
720 waddr = address;
721 flash_unlock();
722 for(i_index = 0; i_index < len; i_index ++)
723 {
724 flash_byte_program(waddr+i_index, data[i_index]);
725 }
726 flash_lock();
727
728 return flash_crc_check(address, data, len);
729}
730
736void flash_fat16_init(void)
737{
738 uint32_t flash_size = *(uint32_t *)0x1FFFF7E0;
739 flash_iap.flash_base_addr = FLASH_BASE;
740 flash_iap.flash_app_addr = FLASH_APP_START_ADDR;
741 flash_iap.write_addr = FLASH_APP_START_ADDR;
742 flash_iap.flash_size = flash_size << 10;
743
744 flash_iap.flash_app_size = flash_iap.flash_size -
745 (flash_iap.flash_app_addr -
746 flash_iap.flash_base_addr);
747
748 if(flash_size < 0x100)
749 {
750 flash_iap.sector_size = FLASH_SECTOR_1K_SIZE;
751 flash_iap.sector_mask = FLASH_SECTOR_1K_ALLGNED;
752 }
753 else
754 {
755 flash_iap.sector_size = FLASH_SECTOR_2K_SIZE;
756 flash_iap.sector_mask = FLASH_SECTOR_2K_ALLGNED;
757 }
758
759}
760
761
762
flash_fat16.h
fat16 file system header file
fat16_table_sector0
const uint8_t fat16_table_sector0[4]
Definition flash_fat16.c:150
flash_fat16_set_name
uint32_t flash_fat16_set_name(const uint8_t *file_name, uint8_t len)
set file name
Definition flash_fat16.c:360
FAT16_SECTOR_SIZE
#define FAT16_SECTOR_SIZE
Definition flash_fat16.c:35
g_file_attr
fat_dir_type g_file_attr
Definition flash_fat16.c:173
fat16_sector
static uint8_t fat16_sector[62]
Definition flash_fat16.c:38
flash_read_data
uint32_t flash_read_data(uint32_t address, uint8_t *data, uint32_t len)
read data from flash
Definition flash_fat16.c:668
file_match
uint8_t file_match
Definition flash_fat16.c:176
file_write_nr
uint32_t file_write_nr
Definition flash_fat16.c:175
fat16_root_dir_sector
const uint8_t fat16_root_dir_sector[47]
Definition flash_fat16.c:109
flash_fat16_addr_offset
uint32_t flash_fat16_addr_offset(uint8_t *file_name)
get offset address
Definition flash_fat16.c:440
flash_fat16_clear_upgrade_flag
void flash_fat16_clear_upgrade_flag(void)
clear iap upgrade flag
Definition flash_fat16.c:246
flash_fat16_get_upgrade_flag
uint8_t flash_fat16_get_upgrade_flag(void)
get iap upgrade complete flag
Definition flash_fat16.c:271
fat16_memory_memset
uint32_t fat16_memory_memset(uint8_t *dst, uint32_t set, uint32_t len)
memset function
Definition flash_fat16.c:213
FAT16_CLUSTER_SIZE
#define FAT16_CLUSTER_SIZE
Definition flash_fat16.c:36
fat16_file_name
uint8_t fat16_file_name[11]
Definition flash_fat16.c:158
flash_iap
flash_iap_type flash_iap
Definition flash_fat16.c:174
flash_crc_check
uint32_t flash_crc_check(uint32_t address, uint8_t *data, uint32_t len)
crc check
Definition flash_fat16.c:617
flash_fat16_write
uint32_t flash_fat16_write(uint32_t fat_lbk, uint8_t *data, uint32_t len)
write a logical block address
Definition flash_fat16.c:332
fat16_memory_cmp
uint32_t fat16_memory_cmp(uint8_t *dst, uint8_t *src, uint32_t len)
memory compare function
Definition flash_fat16.c:230
flash_fat16_sector_write
uint32_t flash_fat16_sector_write(uint32_t fat_lbk, uint8_t *data, uint32_t len)
write sector
Definition flash_fat16.c:489
flash_fat16_set_upgrade_flag
void flash_fat16_set_upgrade_flag(void)
set iap upgrade complete flag
Definition flash_fat16.c:258
flash_write_data
uint32_t flash_write_data(uint32_t address, uint8_t *data, uint32_t len)
write data to flash
Definition flash_fat16.c:687
fat16_memory_copy
uint32_t fat16_memory_copy(uint8_t *dst, const uint8_t *src, uint32_t len)
memory copy function
Definition flash_fat16.c:196
flash_fat16_init
void flash_fat16_init(void)
flash fat16 iap init
Definition flash_fat16.c:736
flash_fat16_boot_dir_write
uint32_t flash_fat16_boot_dir_write(uint32_t fat_lbk, uint8_t *data, uint32_t len)
boot dir write
Definition flash_fat16.c:382
flash_fat16_read
uint32_t flash_fat16_read(uint32_t fat_lbk, uint8_t *data, uint32_t len)
read a logical block address
Definition flash_fat16.c:291
FAT16_FIRST_CLUSTER
#define FAT16_FIRST_CLUSTER
Definition flash_fat16.c:37
crc_data_reset
void crc_data_reset(void)
reset the crc data register.
Definition at32f413_crc.c:48
crc_one_word_calculate
uint32_t crc_one_word_calculate(uint32_t data)
compute the 32-bit crc of a given data word(32-bit).
Definition at32f413_crc.c:59
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_CRC_PERIPH_CLOCK
@ CRM_CRC_PERIPH_CLOCK
Definition at32f413_crm.h:105
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
flash_sector_erase
flash_status_type flash_sector_erase(uint32_t sector_address)
erase a specified flash sector.
Definition at32f413_flash.c:272
flash_byte_program
flash_status_type flash_byte_program(uint32_t address, uint8_t data)
program a byte at a specified address.
Definition at32f413_flash.c:491
flash_unlock
void flash_unlock(void)
unlock the flash controller.
Definition at32f413_flash.c:228
flash_word_program
flash_status_type flash_word_program(uint32_t address, uint32_t data)
program a word at a specified address.
Definition at32f413_flash.c:414
flash_lock
void flash_lock(void)
lock the flash controller.
Definition at32f413_flash.c:251
FLASH_BASE
#define FLASH_BASE
Definition at32f413.h:329
FLASH_APP_START_ADDR
#define FLASH_APP_START_ADDR
Definition flash_fat16.h:59
FLASH_SECTOR_1K_ALLGNED
#define FLASH_SECTOR_1K_ALLGNED
Definition flash_fat16.h:65
FAT16_TABLE_SIZE
#define FAT16_TABLE_SIZE
Definition flash_fat16.h:48
INVAILD_OFFSET_ADDR
#define INVAILD_OFFSET_ADDR
Definition flash_fat16.h:74
FLASH_FAT16_2_ADDR
#define FLASH_FAT16_2_ADDR
Definition flash_fat16.h:55
FLASH_FAT16_1_ADDR
#define FLASH_FAT16_1_ADDR
Definition flash_fat16.h:54
IAP_FAILED
#define IAP_FAILED
Definition flash_fat16.h:77
FLASH_FAT16_ROOT_ADDR
#define FLASH_FAT16_ROOT_ADDR
Definition flash_fat16.h:56
FAT16_DIR_SIZE
#define FAT16_DIR_SIZE
Definition flash_fat16.h:51
FLASH_SECTOR_2K_SIZE
#define FLASH_SECTOR_2K_SIZE
Definition flash_fat16.h:62
FILE_SUFFIX1_NAME
#define FILE_SUFFIX1_NAME
Definition flash_fat16.h:71
IAP_SUCCESS
#define IAP_SUCCESS
Definition flash_fat16.h:76
FLASH_FAT16_FILE_START_ADDR
#define FLASH_FAT16_FILE_START_ADDR
Definition flash_fat16.h:57
FILE_SUFFIX2_LEN
#define FILE_SUFFIX2_LEN
Definition flash_fat16.h:70
FLASH_SECTOR_2K_ALLGNED
#define FLASH_SECTOR_2K_ALLGNED
Definition flash_fat16.h:66
FLASH_FAT16_BOOT_SECTOR_ADDR
#define FLASH_FAT16_BOOT_SECTOR_ADDR
Definition flash_fat16.h:53
FILE_SUFFIX1_LEN
#define FILE_SUFFIX1_LEN
Definition flash_fat16.h:69
FAT16_BYTE_PER_SIZE
#define FAT16_BYTE_PER_SIZE
Definition flash_fat16.h:49
IAP_UPGRADE_COMPLETE_FLAG
#define IAP_UPGRADE_COMPLETE_FLAG
Definition flash_fat16.h:75
FILE_SUFFIX2_NAME
#define FILE_SUFFIX2_NAME
Definition flash_fat16.h:72
FAT16_FILENAME_SIZE
#define FAT16_FILENAME_SIZE
Definition flash_fat16.h:50
FLASH_SECTOR_1K_SIZE
#define FLASH_SECTOR_1K_SIZE
Definition flash_fat16.h:61
UPGRADE_LARGE
@ UPGRADE_LARGE
Definition flash_fat16.h:85
UPGRADE_JUMP
@ UPGRADE_JUMP
Definition flash_fat16.h:88
UPGRADE_FAILED
@ UPGRADE_FAILED
Definition flash_fat16.h:84
UPGRADE_SUCCESS
@ UPGRADE_SUCCESS
Definition flash_fat16.h:83
UPGRADE_READY
@ UPGRADE_READY
Definition flash_fat16.h:81
UPGRAGE_ONGOING
@ UPGRAGE_ONGOING
Definition flash_fat16.h:82
UPGRADE_DONE
@ UPGRADE_DONE
Definition flash_fat16.h:87
fat_dir_type
Definition flash_fat16.h:92
fat_dir_type::clus_low
uint16_t clus_low
Definition flash_fat16.h:103
fat_dir_type::write_data
uint16_t write_data
Definition flash_fat16.h:102
fat_dir_type::file_size
uint32_t file_size
Definition flash_fat16.h:104
fat_dir_type::write_time
uint16_t write_time
Definition flash_fat16.h:101
fat_dir_type::file_name
uint8_t file_name[11]
Definition flash_fat16.h:93
fat_dir_type::attr
uint8_t attr
Definition flash_fat16.h:94
flash_iap_type
Definition flash_fat16.h:108
flash_iap_type::flash_size
uint32_t flash_size
Definition flash_fat16.h:111
flash_iap_type::msc_up_status
upgrade_status_type msc_up_status
Definition flash_fat16.h:121
flash_iap_type::flash_base_addr
uint32_t flash_base_addr
Definition flash_fat16.h:109
flash_iap_type::sector_size
uint32_t sector_size
Definition flash_fat16.h:113
flash_iap_type::sector_mask
uint32_t sector_mask
Definition flash_fat16.h:114
flash_iap_type::file_write_nr
uint32_t file_write_nr
Definition flash_fat16.h:120
flash_iap_type::flash_app_size
uint32_t flash_app_size
Definition flash_fat16.h:112
flash_iap_type::write_addr
uint32_t write_addr
Definition flash_fat16.h:119
flash_iap_type::flash_app_addr
uint32_t flash_app_addr
Definition flash_fat16.h:110


AT32F413 Firmwary Library: flash_fat16.h Source File

  • usb_device
  • virtual_msc_iap
  • inc
flash_fat16.h
Go to the documentation of this file.
1
25/* Define to prevent recursive inclusion -------------------------------------*/
26#ifndef __FLASH_FAT16_H
27#define __FLASH_FAT16_H
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33
34#include "usb_conf.h"
35
47#define FAT16_SECTOR_SIZE 62
48#define FAT16_TABLE_SIZE 4
49#define FAT16_BYTE_PER_SIZE 2048
50#define FAT16_FILENAME_SIZE 11
51#define FAT16_DIR_SIZE 47
52
53#define FLASH_FAT16_BOOT_SECTOR_ADDR 0x00
54#define FLASH_FAT16_1_ADDR 0x3000
55#define FLASH_FAT16_2_ADDR 0x3800
56#define FLASH_FAT16_ROOT_ADDR 0x4000
57#define FLASH_FAT16_FILE_START_ADDR 0x8800
58
59#define FLASH_APP_START_ADDR 0x08005000
60
61#define FLASH_SECTOR_1K_SIZE 0x400
62#define FLASH_SECTOR_2K_SIZE 0x800
63#define FLASH_SECTOR_4K_SIZE 0x1000
64
65#define FLASH_SECTOR_1K_ALLGNED 0x3FF
66#define FLASH_SECTOR_2K_ALLGNED 0x7FF
67#define FLASH_SECTOR_4K_ALLGNED 0xFFF
68
69#define FILE_SUFFIX1_LEN 3
70#define FILE_SUFFIX2_LEN 3
71#define FILE_SUFFIX1_NAME "BIN"
72#define FILE_SUFFIX2_NAME "bin"
73
74#define INVAILD_OFFSET_ADDR 0xFFFFFFFF
75#define IAP_UPGRADE_COMPLETE_FLAG 0x41544B38
76#define IAP_SUCCESS 0
77#define IAP_FAILED 1
78
79typedef enum
80{
81 UPGRADE_READY = 0,
82 UPGRAGE_ONGOING,
83 UPGRADE_SUCCESS,
84 UPGRADE_FAILED,
85 UPGRADE_LARGE,
86 UPGRADE_UNKNOWN,
87 UPGRADE_DONE,
88 UPGRADE_JUMP
89}upgrade_status_type;
90
91typedef struct
92{
93 uint8_t file_name[11];
94 uint8_t attr;
95 uint8_t res;
96 uint8_t create_time_tenth;
97 uint16_t create_time;
98 uint16_t create_data;
99 uint16_t last_access_data;
100 uint16_t clus_high;
101 uint16_t write_time;
102 uint16_t write_data;
103 uint16_t clus_low;
104 uint32_t file_size;
105}fat_dir_type;
106
107typedef struct
108{
109 uint32_t flash_base_addr;
110 uint32_t flash_app_addr;
111 uint32_t flash_size;
112 uint32_t flash_app_size;
113 uint32_t sector_size;
114 uint32_t sector_mask;
115 uint32_t firmware_length;
116 uint32_t write_crc;
117 uint32_t read_crc;
118
119 uint32_t write_addr;
120 uint32_t file_write_nr;
121 upgrade_status_type msc_up_status;
122}flash_iap_type;
123
124extern flash_iap_type flash_iap;
125
126uint32_t flash_fat16_write(uint32_t fat_lbk, uint8_t *data, uint32_t len);
127uint32_t flash_fat16_read(uint32_t fat_lbk, uint8_t *data, uint32_t len);
128
129void flash_fat16_init(void);
130void flash_fat16_loop_status(void);
131uint32_t flash_fat16_set_name(const uint8_t *file_name, uint8_t len);
132uint8_t flash_fat16_get_upgrade_flag(void);
133
146#ifdef __cplusplus
147}
148#endif
149
150#endif
151
upgrade_status_type
upgrade_status_type
Definition flash_fat16.h:80
flash_fat16_set_name
uint32_t flash_fat16_set_name(const uint8_t *file_name, uint8_t len)
set file name
Definition flash_fat16.c:360
flash_fat16_get_upgrade_flag
uint8_t flash_fat16_get_upgrade_flag(void)
get iap upgrade complete flag
Definition flash_fat16.c:271
flash_fat16_loop_status
void flash_fat16_loop_status(void)
loop status
Definition project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c:182
flash_iap
flash_iap_type flash_iap
Definition flash_fat16.c:174
flash_fat16_write
uint32_t flash_fat16_write(uint32_t fat_lbk, uint8_t *data, uint32_t len)
write a logical block address
Definition flash_fat16.c:332
flash_fat16_init
void flash_fat16_init(void)
flash fat16 iap init
Definition flash_fat16.c:736
flash_fat16_read
uint32_t flash_fat16_read(uint32_t fat_lbk, uint8_t *data, uint32_t len)
read a logical block address
Definition flash_fat16.c:291
UPGRADE_LARGE
@ UPGRADE_LARGE
Definition flash_fat16.h:85
UPGRADE_UNKNOWN
@ UPGRADE_UNKNOWN
Definition flash_fat16.h:86
UPGRADE_JUMP
@ UPGRADE_JUMP
Definition flash_fat16.h:88
UPGRADE_FAILED
@ UPGRADE_FAILED
Definition flash_fat16.h:84
UPGRADE_SUCCESS
@ UPGRADE_SUCCESS
Definition flash_fat16.h:83
UPGRADE_READY
@ UPGRADE_READY
Definition flash_fat16.h:81
UPGRAGE_ONGOING
@ UPGRAGE_ONGOING
Definition flash_fat16.h:82
UPGRADE_DONE
@ UPGRADE_DONE
Definition flash_fat16.h:87
usb_conf.h
usb config header file
fat_dir_type
Definition flash_fat16.h:92
fat_dir_type::clus_low
uint16_t clus_low
Definition flash_fat16.h:103
fat_dir_type::write_data
uint16_t write_data
Definition flash_fat16.h:102
fat_dir_type::file_size
uint32_t file_size
Definition flash_fat16.h:104
fat_dir_type::last_access_data
uint16_t last_access_data
Definition flash_fat16.h:99
fat_dir_type::write_time
uint16_t write_time
Definition flash_fat16.h:101
fat_dir_type::create_time
uint16_t create_time
Definition flash_fat16.h:97
fat_dir_type::create_time_tenth
uint8_t create_time_tenth
Definition flash_fat16.h:96
fat_dir_type::create_data
uint16_t create_data
Definition flash_fat16.h:98
fat_dir_type::clus_high
uint16_t clus_high
Definition flash_fat16.h:100
fat_dir_type::res
uint8_t res
Definition flash_fat16.h:95
fat_dir_type::attr
uint8_t attr
Definition flash_fat16.h:94
flash_iap_type
Definition flash_fat16.h:108
flash_iap_type::flash_size
uint32_t flash_size
Definition flash_fat16.h:111
flash_iap_type::read_crc
uint32_t read_crc
Definition flash_fat16.h:117
flash_iap_type::msc_up_status
upgrade_status_type msc_up_status
Definition flash_fat16.h:121
flash_iap_type::flash_base_addr
uint32_t flash_base_addr
Definition flash_fat16.h:109
flash_iap_type::write_crc
uint32_t write_crc
Definition flash_fat16.h:116
flash_iap_type::sector_size
uint32_t sector_size
Definition flash_fat16.h:113
flash_iap_type::firmware_length
uint32_t firmware_length
Definition flash_fat16.h:115
flash_iap_type::sector_mask
uint32_t sector_mask
Definition flash_fat16.h:114
flash_iap_type::file_write_nr
uint32_t file_write_nr
Definition flash_fat16.h:120
flash_iap_type::flash_app_size
uint32_t flash_app_size
Definition flash_fat16.h:112
flash_iap_type::write_addr
uint32_t write_addr
Definition flash_fat16.h:119
flash_iap_type::flash_app_addr
uint32_t flash_app_addr
Definition flash_fat16.h:110


AT32F413 Firmwary Library: hid_iap_class.c Source File

  • middlewares
  • usbd_class
  • hid_iap
hid_iap_class.c
Go to the documentation of this file.
1
25#include "usbd_core.h"
26#include "hid_iap_class.h"
27#include "hid_iap_desc.h"
28
43static usb_sts_type class_init_handler(void *udev);
44static usb_sts_type class_clear_handler(void *udev);
45static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup);
46static usb_sts_type class_ept0_tx_handler(void *udev);
47static usb_sts_type class_ept0_rx_handler(void *udev);
48static usb_sts_type class_in_handler(void *udev, uint8_t ept_num);
49static usb_sts_type class_out_handler(void *udev, uint8_t ept_num);
50static usb_sts_type class_sof_handler(void *udev);
51static usb_sts_type class_event_handler(void *udev, usbd_event_type event);
52
53 iap_info_type iap_info;
54
55/* usb device class handler */
56 usbd_class_handler hid_iap_class_handler =
57{
58 class_init_handler,
59 class_clear_handler,
60 class_setup_handler,
61 class_ept0_tx_handler,
62 class_ept0_rx_handler,
63 class_in_handler,
64 class_out_handler,
65 class_sof_handler,
66 class_event_handler,
67 &iap_info
68};
69
75static usb_sts_type class_init_handler(void *udev)
76{
77 usb_sts_type status = USB_OK;
78 usbd_core_type *pudev = (usbd_core_type *)udev;
79 iap_info_type *piap = (iap_info_type *)pudev->class_handler->pdata;
80 /* open hid iap in endpoint */
81 usbd_ept_open(pudev, USBD_HIDIAP_IN_EPT, EPT_INT_TYPE, USBD_HIDIAP_IN_MAXPACKET_SIZE);
82
83 /* open hid iap out endpoint */
84 usbd_ept_open(pudev, USBD_HIDIAP_OUT_EPT, EPT_INT_TYPE, USBD_HIDIAP_OUT_MAXPACKET_SIZE);
85
86 /* set out endpoint to receive status */
87 usbd_ept_recv(pudev, USBD_HIDIAP_OUT_EPT, piap->g_rxhid_buff, USBD_HIDIAP_OUT_MAXPACKET_SIZE);
88
89 return status;
90}
91
97static usb_sts_type class_clear_handler(void *udev)
98{
99 usb_sts_type status = USB_OK;
100 usbd_core_type *pudev = (usbd_core_type *)udev;
101
102 /* close hid iap in endpoint */
103 usbd_ept_close(pudev, USBD_HIDIAP_IN_EPT);
104
105 /* close hid iap out endpoint */
106 usbd_ept_close(pudev, USBD_HIDIAP_OUT_EPT);
107
108 return status;
109}
110
117static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
118{
119 usb_sts_type status = USB_OK;
120 usbd_core_type *pudev = (usbd_core_type *)udev;
121 iap_info_type *piap = (iap_info_type *)pudev->class_handler->pdata;
122 uint16_t len;
123 uint8_t *buf;
124
125 switch(setup->bmRequestType & USB_REQ_TYPE_RESERVED)
126 {
127 /* class request */
128 case USB_REQ_TYPE_CLASS:
129 switch(setup->bRequest)
130 {
131 case HID_REQ_SET_PROTOCOL:
132 piap->hid_protocol = (uint8_t)setup->wValue;
133 break;
134 case HID_REQ_GET_PROTOCOL:
135 usbd_ctrl_send(pudev, (uint8_t *)&piap->hid_protocol, 1);
136 break;
137 case HID_REQ_SET_IDLE:
138 piap->hid_set_idle = (uint8_t)(setup->wValue >> 8);
139 break;
140 case HID_REQ_GET_IDLE:
141 usbd_ctrl_send(pudev, (uint8_t *)&piap->hid_set_idle, 1);
142 break;
143 case HID_REQ_SET_REPORT:
144 piap->hid_state = HID_REQ_SET_REPORT;
145 usbd_ctrl_recv(pudev, piap->hid_set_report, setup->wLength);
146 break;
147 default:
148 usbd_ctrl_unsupport(pudev);
149 break;
150 }
151 break;
152 /* standard request */
153 case USB_REQ_TYPE_STANDARD:
154 switch(setup->bRequest)
155 {
156 case USB_STD_REQ_GET_DESCRIPTOR:
157 if(setup->wValue >> 8 == HID_REPORT_DESC)
158 {
159 len = MIN(USBD_HIDIAP_SIZ_REPORT_DESC, setup->wLength);
160 buf = (uint8_t *)g_usbd_hidiap_report;
161 usbd_ctrl_send(pudev, (uint8_t *)buf, len);
162 }
163 else if(setup->wValue >> 8 == HID_DESCRIPTOR_TYPE)
164 {
165 len = MIN(9, setup->wLength);
166 buf = (uint8_t *)g_hidiap_usb_desc;
167 usbd_ctrl_send(pudev, (uint8_t *)buf, len);
168 }
169 else
170 {
171 usbd_ctrl_unsupport(pudev);
172 }
173 break;
174 case USB_STD_REQ_GET_INTERFACE:
175 usbd_ctrl_send(pudev, (uint8_t *)&piap->alt_setting, 1);
176 break;
177 case USB_STD_REQ_SET_INTERFACE:
178 piap->alt_setting = setup->wValue;
179 break;
180 case USB_STD_REQ_CLEAR_FEATURE:
181 break;
182 case USB_STD_REQ_SET_FEATURE:
183 break;
184 default:
185 usbd_ctrl_unsupport(pudev);
186 break;
187 }
188 break;
189 default:
190 usbd_ctrl_unsupport(pudev);
191 break;
192 }
193 return status;
194}
195
201static usb_sts_type class_ept0_tx_handler(void *udev)
202{
203 usb_sts_type status = USB_OK;
204
205 /* ...user code... */
206
207 return status;
208}
209
215static usb_sts_type class_ept0_rx_handler(void *udev)
216{
217 usb_sts_type status = USB_OK;
218 usbd_core_type *pudev = (usbd_core_type *)udev;
219 iap_info_type *piap = (iap_info_type *)pudev->class_handler->pdata;
220 uint32_t recv_len = usbd_get_recv_len(pudev, 0);
221 /* ...user code... */
222 if( piap->hid_state == HID_REQ_SET_REPORT)
223 {
224 /* hid buffer process */
225 piap->hid_state = 0;
226 }
227
228 return status;
229}
230
237static usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
238{
239 usb_sts_type status = USB_OK;
240
241 /* ...user code...
242 trans next packet data
243 */
244 usbd_hid_iap_in_complete(udev);
245
246 return status;
247}
248
255static usb_sts_type class_out_handler(void *udev, uint8_t ept_num)
256{
257 usb_sts_type status = USB_OK;
258 usbd_core_type *pudev = (usbd_core_type *)udev;
259 iap_info_type *piap = (iap_info_type *)pudev->class_handler->pdata;
260
261 /* get endpoint receive data length */
262 uint32_t recv_len = usbd_get_recv_len(pudev, ept_num);
263
264 /* hid iap process */
265 usbd_hid_iap_process(udev, piap->g_rxhid_buff, recv_len);
266
267 /* start receive next packet */
268 usbd_ept_recv(pudev, USBD_HIDIAP_OUT_EPT, piap->g_rxhid_buff, USBD_HIDIAP_OUT_MAXPACKET_SIZE);
269
270 return status;
271}
272
278static usb_sts_type class_sof_handler(void *udev)
279{
280 usb_sts_type status = USB_OK;
281
282 /* ...user code... */
283
284 return status;
285}
286
293static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
294{
295 usb_sts_type status = USB_OK;
296 switch(event)
297 {
298 case USBD_RESET_EVENT:
299
300 /* ...user code... */
301
302 break;
303 case USBD_SUSPEND_EVENT:
304
305 /* ...user code... */
306
307 break;
308 case USBD_WAKEUP_EVENT:
309 /* ...user code... */
310
311 break;
312 default:
313 break;
314 }
315 return status;
316}
317
325 usb_sts_type usb_iap_class_send_report(void *udev, uint8_t *report, uint16_t len)
326{
327 usb_sts_type status = USB_OK;
328 usbd_core_type *pudev = (usbd_core_type *)udev;
329
330 if(usbd_connect_state_get(pudev) == USB_CONN_STATE_CONFIGURED)
331 usbd_ept_send(pudev, USBD_HIDIAP_IN_EPT, report, len);
332
333 return status;
334}
335
EPT_INT_TYPE
@ EPT_INT_TYPE
Definition at32f413_usb.h:205
USBD_HIDIAP_OUT_MAXPACKET_SIZE
#define USBD_HIDIAP_OUT_MAXPACKET_SIZE
Definition hid_iap_class.h:55
usbd_hid_iap_process
iap_result_type usbd_hid_iap_process(void *udev, uint8_t *report, uint16_t len)
usb device iap function
Definition app_led3_toggle/src/hid_iap_user.c:193
USBD_HIDIAP_IN_EPT
#define USBD_HIDIAP_IN_EPT
Definition hid_iap_class.h:51
USBD_HIDIAP_OUT_EPT
#define USBD_HIDIAP_OUT_EPT
Definition hid_iap_class.h:52
USBD_HIDIAP_IN_MAXPACKET_SIZE
#define USBD_HIDIAP_IN_MAXPACKET_SIZE
Definition hid_iap_class.h:54
usbd_hid_iap_in_complete
void usbd_hid_iap_in_complete(void *udev)
usb device in transfer complete function
Definition app_led3_toggle/src/hid_iap_user.c:239
class_sof_handler
static usb_sts_type class_sof_handler(void *udev)
usb device sof handler
Definition hid_iap_class.c:278
iap_info
iap_info_type iap_info
Definition hid_iap_class.c:53
class_in_handler
static usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
usb device transmision complete handler
Definition hid_iap_class.c:237
class_clear_handler
static usb_sts_type class_clear_handler(void *udev)
clear endpoint or other state
Definition hid_iap_class.c:97
class_setup_handler
static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
usb device class setup request handler
Definition hid_iap_class.c:117
usb_iap_class_send_report
usb_sts_type usb_iap_class_send_report(void *udev, uint8_t *report, uint16_t len)
usb device class send report
Definition hid_iap_class.c:325
class_ept0_tx_handler
static usb_sts_type class_ept0_tx_handler(void *udev)
usb device endpoint 0 in status stage complete
Definition hid_iap_class.c:201
class_ept0_rx_handler
static usb_sts_type class_ept0_rx_handler(void *udev)
usb device endpoint 0 out status stage complete
Definition hid_iap_class.c:215
class_event_handler
static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
usb device event handler
Definition hid_iap_class.c:293
hid_iap_class_handler
usbd_class_handler hid_iap_class_handler
Definition hid_iap_class.c:56
class_init_handler
static usb_sts_type class_init_handler(void *udev)
initialize usb custom hid endpoint
Definition hid_iap_class.c:75
class_out_handler
static usb_sts_type class_out_handler(void *udev, uint8_t ept_num)
usb device endpoint receive data
Definition hid_iap_class.c:255
g_usbd_hidiap_report
uint8_t g_usbd_hidiap_report[32]
g_hidiap_usb_desc
uint8_t g_hidiap_usb_desc[9]
USBD_HIDIAP_SIZ_REPORT_DESC
#define USBD_HIDIAP_SIZ_REPORT_DESC
Definition hid_iap_desc.h:56
USB_STD_REQ_CLEAR_FEATURE
#define USB_STD_REQ_CLEAR_FEATURE
Definition usb_std.h:77
HID_DESCRIPTOR_TYPE
#define HID_DESCRIPTOR_TYPE
Definition usb_std.h:242
HID_REQ_GET_PROTOCOL
#define HID_REQ_GET_PROTOCOL
Definition usb_std.h:237
MIN
#define MIN(a, b)
min and max define
Definition usb_std.h:260
USB_REQ_TYPE_STANDARD
#define USB_REQ_TYPE_STANDARD
usb request type
Definition usb_std.h:62
USB_STD_REQ_GET_DESCRIPTOR
#define USB_STD_REQ_GET_DESCRIPTOR
Definition usb_std.h:80
HID_REQ_SET_PROTOCOL
#define HID_REQ_SET_PROTOCOL
usb hid class request code define
Definition usb_std.h:236
HID_REPORT_DESC
#define HID_REPORT_DESC
Definition usb_std.h:243
USB_STD_REQ_SET_FEATURE
#define USB_STD_REQ_SET_FEATURE
Definition usb_std.h:78
HID_REQ_SET_IDLE
#define HID_REQ_SET_IDLE
Definition usb_std.h:238
HID_REQ_GET_IDLE
#define HID_REQ_GET_IDLE
Definition usb_std.h:239
HID_REQ_SET_REPORT
#define HID_REQ_SET_REPORT
Definition usb_std.h:240
USB_STD_REQ_SET_INTERFACE
#define USB_STD_REQ_SET_INTERFACE
Definition usb_std.h:85
USB_REQ_TYPE_RESERVED
#define USB_REQ_TYPE_RESERVED
Definition usb_std.h:65
USB_STD_REQ_GET_INTERFACE
#define USB_STD_REQ_GET_INTERFACE
Definition usb_std.h:84
USB_REQ_TYPE_CLASS
#define USB_REQ_TYPE_CLASS
Definition usb_std.h:63
USB_CONN_STATE_CONFIGURED
@ USB_CONN_STATE_CONFIGURED
Definition usb_std.h:137
usb_sts_type
usb_sts_type
usb return status
Definition usb_std.h:285
USB_OK
@ USB_OK
Definition usb_std.h:286
usbd_connect_state_get
usbd_conn_state usbd_connect_state_get(usbd_core_type *udev)
get usb connect state
Definition usbd_core.c:595
usbd_ept_close
void usbd_ept_close(usbd_core_type *udev, uint8_t ept_addr)
usb close endpoint
Definition usbd_core.c:541
usbd_ept_recv
void usbd_ept_recv(usbd_core_type *udev, uint8_t ept_num, uint8_t *buffer, uint16_t len)
usb endpoint receive data
Definition usbd_core.c:364
usbd_ept_open
void usbd_ept_open(usbd_core_type *udev, uint8_t ept_addr, uint8_t ept_type, uint16_t maxpacket)
usb open endpoint
Definition usbd_core.c:506
usbd_ctrl_send
void usbd_ctrl_send(usbd_core_type *udev, uint8_t *buffer, uint16_t len)
usb control endpoint send data
Definition usbd_core.c:175
usbd_get_recv_len
uint32_t usbd_get_recv_len(usbd_core_type *udev, uint8_t ept_addr)
usb endpoint get receive data length
Definition usbd_core.c:397
usbd_ctrl_recv
void usbd_ctrl_recv(usbd_core_type *udev, uint8_t *buffer, uint16_t len)
usb control endpoint receive data
Definition usbd_core.c:194
usbd_ctrl_unsupport
void usbd_ctrl_unsupport(usbd_core_type *udev)
un-support device request
Definition usbd_core.c:289
usbd_ept_send
void usbd_ept_send(usbd_core_type *udev, uint8_t ept_num, uint8_t *buffer, uint16_t len)
usb endpoint send data
Definition usbd_core.c:304
usbd_event_type
usbd_event_type
usb device event
Definition usbd_core.h:54
USBD_SUSPEND_EVENT
@ USBD_SUSPEND_EVENT
Definition usbd_core.h:57
USBD_RESET_EVENT
@ USBD_RESET_EVENT
Definition usbd_core.h:56
USBD_WAKEUP_EVENT
@ USBD_WAKEUP_EVENT
Definition usbd_core.h:58
hid_iap_class.h
usb hid iap header file
hid_iap_desc.h
usb hid descriptor header file
iap_info_type
Definition hid_iap_class.h:104
iap_info_type::hid_state
uint32_t hid_state
Definition hid_iap_class.h:129
iap_info_type::hid_set_idle
uint32_t hid_set_idle
Definition hid_iap_class.h:127
iap_info_type::hid_protocol
uint32_t hid_protocol
Definition hid_iap_class.h:126
iap_info_type::hid_set_report
uint8_t hid_set_report[64]
Definition hid_iap_class.h:130
iap_info_type::alt_setting
uint32_t alt_setting
Definition hid_iap_class.h:128
iap_info_type::g_rxhid_buff
uint8_t g_rxhid_buff[0x40]
Definition hid_iap_class.h:125
usb_setup_type
format of usb setup data
Definition usb_std.h:297
usb_setup_type::wValue
uint16_t wValue
Definition usb_std.h:300
usb_setup_type::wLength
uint16_t wLength
Definition usb_std.h:303
usb_setup_type::bmRequestType
uint8_t bmRequestType
Definition usb_std.h:298
usb_setup_type::bRequest
uint8_t bRequest
Definition usb_std.h:299
usbd_class_handler
usb device class handler
Definition usbd_core.h:97
usbd_class_handler::pdata
void * pdata
Definition usbd_core.h:107
usbd_core_type
usb device core struct type
Definition usbd_core.h:114
usbd_core_type::class_handler
usbd_class_handler * class_handler
Definition usbd_core.h:117
usbd_core.h
usb device core header file


AT32F413 Firmwary Library: hid_iap_class.h Source File

  • middlewares
  • usbd_class
  • hid_iap
hid_iap_class.h
Go to the documentation of this file.
1
26 /* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __HID_IAP_CLASS_H
28#define __HID_IAP_CLASS_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "usb_std.h"
35#include "usbd_core.h"
36
37
51#define USBD_HIDIAP_IN_EPT 0x81
52#define USBD_HIDIAP_OUT_EPT 0x01
53
54#define USBD_HIDIAP_IN_MAXPACKET_SIZE 0x40
55#define USBD_HIDIAP_OUT_MAXPACKET_SIZE 0x40
56
57#define FLASH_SIZE_REG() ((*(uint32_t *)0x1FFFF7E0) & 0xFFFF) /*Get Flash size*/
58#define KB_TO_B(kb) ((kb) << 10)
59
60#define SECTOR_SIZE_1K 0x400
61#define SECTOR_SIZE_2K 0x800
62#define SECTOR_SIZE_4K 0x1000
63
67#define IAP_CMD_IDLE 0x5AA0
68#define IAP_CMD_START 0x5AA1
69#define IAP_CMD_ADDR 0x5AA2
70#define IAP_CMD_DATA 0x5AA3
71#define IAP_CMD_FINISH 0x5AA4
72#define IAP_CMD_CRC 0x5AA5
73#define IAP_CMD_JMP 0x5AA6
74#define IAP_CMD_GET 0x5AA7
75
76#define HID_IAP_BUFFER_LEN 1024
77#define IAP_UPGRADE_COMPLETE_FLAG 0x41544B38
78#define CONVERT_ENDIAN(dwValue) ((dwValue >> 24) | ((dwValue >> 8) & 0xFF00) | \
79 ((dwValue << 8) & 0xFF0000) | (dwValue << 24) )
80
81#define IAP_ACK 0xFF00
82#define IAP_NACK 0x00FF
83
84typedef enum
85{
86 IAP_SUCCESS,
87 IAP_WAIT,
88 IAP_FAILED
89}iap_result_type;
90
91typedef enum
92{
93 IAP_STS_IDLE,
94 IAP_STS_START,
95 IAP_STS_ADDR,
96 IAP_STS_DATA,
97 IAP_STS_FINISH,
98 IAP_STS_CRC,
99 IAP_STS_JMP_WAIT,
100 IAP_STS_JMP,
101}iap_machine_state_type;
102
103typedef struct
104{
105
106 uint8_t iap_fifo[HID_IAP_BUFFER_LEN];
107 uint8_t iap_rx[USBD_HIDIAP_OUT_MAXPACKET_SIZE];
108 uint8_t iap_tx[USBD_HIDIAP_IN_MAXPACKET_SIZE];
109
110 uint32_t fifo_length;
111 uint32_t tx_length;
112
113 uint32_t app_address;
114 uint32_t iap_address;
115 uint32_t flag_address;
116
117 uint32_t flash_start_address;
118 uint32_t flash_end_address;
119
120 uint32_t sector_size;
121 uint32_t flash_size;
122
123 uint32_t respond_flag;
124
125 uint8_t g_rxhid_buff[USBD_HIDIAP_OUT_MAXPACKET_SIZE];
126 uint32_t hid_protocol;
127 uint32_t hid_set_idle;
128 uint32_t alt_setting;
129 uint32_t hid_state;
130 uint8_t hid_set_report[64];
131
132 iap_machine_state_type state;
133}iap_info_type;
134
135extern usbd_class_handler hid_iap_class_handler;
136extern iap_info_type iap_info;
137 usb_sts_type usb_iap_class_send_report(void *udev, uint8_t *report, uint16_t len);
138 iap_result_type usbd_hid_iap_process(void *udev, uint8_t *report, uint16_t len);
139void usbd_hid_iap_in_complete(void *udev);
140
152#ifdef __cplusplus
153}
154#endif
155
156#endif
157
158
iap_info
iap_info_type iap_info
Definition hid_iap_class.c:53
HID_IAP_BUFFER_LEN
#define HID_IAP_BUFFER_LEN
Definition hid_iap_class.h:76
USBD_HIDIAP_OUT_MAXPACKET_SIZE
#define USBD_HIDIAP_OUT_MAXPACKET_SIZE
Definition hid_iap_class.h:55
usb_iap_class_send_report
usb_sts_type usb_iap_class_send_report(void *udev, uint8_t *report, uint16_t len)
usb device class send report
Definition hid_iap_class.c:325
iap_result_type
iap_result_type
Definition hid_iap_class.h:85
usbd_hid_iap_process
iap_result_type usbd_hid_iap_process(void *udev, uint8_t *report, uint16_t len)
usb device iap function
Definition app_led3_toggle/src/hid_iap_user.c:193
hid_iap_class_handler
usbd_class_handler hid_iap_class_handler
Definition hid_iap_class.c:56
iap_machine_state_type
iap_machine_state_type
Definition hid_iap_class.h:92
USBD_HIDIAP_IN_MAXPACKET_SIZE
#define USBD_HIDIAP_IN_MAXPACKET_SIZE
Definition hid_iap_class.h:54
usbd_hid_iap_in_complete
void usbd_hid_iap_in_complete(void *udev)
usb device in transfer complete function
Definition app_led3_toggle/src/hid_iap_user.c:239
IAP_WAIT
@ IAP_WAIT
Definition hid_iap_class.h:87
IAP_FAILED
@ IAP_FAILED
Definition hid_iap_class.h:88
IAP_SUCCESS
@ IAP_SUCCESS
Definition hid_iap_class.h:86
IAP_STS_START
@ IAP_STS_START
Definition hid_iap_class.h:94
IAP_STS_JMP
@ IAP_STS_JMP
Definition hid_iap_class.h:100
IAP_STS_DATA
@ IAP_STS_DATA
Definition hid_iap_class.h:96
IAP_STS_JMP_WAIT
@ IAP_STS_JMP_WAIT
Definition hid_iap_class.h:99
IAP_STS_IDLE
@ IAP_STS_IDLE
Definition hid_iap_class.h:93
IAP_STS_FINISH
@ IAP_STS_FINISH
Definition hid_iap_class.h:97
IAP_STS_ADDR
@ IAP_STS_ADDR
Definition hid_iap_class.h:95
IAP_STS_CRC
@ IAP_STS_CRC
Definition hid_iap_class.h:98
usb_sts_type
usb_sts_type
usb return status
Definition usb_std.h:285
iap_info_type
Definition hid_iap_class.h:104
iap_info_type::respond_flag
uint32_t respond_flag
Definition hid_iap_class.h:123
iap_info_type::hid_state
uint32_t hid_state
Definition hid_iap_class.h:129
iap_info_type::flag_address
uint32_t flag_address
Definition hid_iap_class.h:115
iap_info_type::sector_size
uint32_t sector_size
Definition hid_iap_class.h:120
iap_info_type::iap_address
uint32_t iap_address
Definition hid_iap_class.h:114
iap_info_type::flash_start_address
uint32_t flash_start_address
Definition hid_iap_class.h:117
iap_info_type::flash_end_address
uint32_t flash_end_address
Definition hid_iap_class.h:118
iap_info_type::fifo_length
uint32_t fifo_length
Definition hid_iap_class.h:110
iap_info_type::hid_set_idle
uint32_t hid_set_idle
Definition hid_iap_class.h:127
iap_info_type::hid_protocol
uint32_t hid_protocol
Definition hid_iap_class.h:126
iap_info_type::tx_length
uint32_t tx_length
Definition hid_iap_class.h:111
iap_info_type::flash_size
uint32_t flash_size
Definition hid_iap_class.h:121
iap_info_type::app_address
uint32_t app_address
Definition hid_iap_class.h:113
iap_info_type::alt_setting
uint32_t alt_setting
Definition hid_iap_class.h:128
iap_info_type::state
iap_machine_state_type state
Definition hid_iap_class.h:132
usbd_class_handler
usb device class handler
Definition usbd_core.h:97
usb_std.h
usb standard header file
usbd_core.h
usb device core header file


AT32F413 Firmwary Library: hid_iap_desc.c Source File

  • middlewares
  • usbd_class
  • hid_iap
hid_iap_desc.c
Go to the documentation of this file.
1
25#include "usb_std.h"
26#include "usbd_sdr.h"
27#include "usbd_core.h"
28#include "hid_iap_desc.h"
29
30
45static usbd_desc_t *get_device_descriptor(void);
46static usbd_desc_t *get_device_qualifier(void);
47static usbd_desc_t *get_device_configuration(void);
48static usbd_desc_t *get_device_other_speed(void);
49static usbd_desc_t *get_device_lang_id(void);
50static usbd_desc_t *get_device_manufacturer_string(void);
51static usbd_desc_t *get_device_product_string(void);
52static usbd_desc_t *get_device_serial_string(void);
53static usbd_desc_t *get_device_interface_string(void);
54static usbd_desc_t *get_device_config_string(void);
55
56static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf);
57static void usbd_int_to_unicode (uint32_t value , uint8_t *pbuf , uint8_t len);
58static void get_serial_num(void);
59#if defined ( __ICCARM__ ) /* iar compiler */
60 #pragma data_alignment=4
61#endif
62ALIGNED_HEAD static uint8_t g_usbd_desc_buffer[256] ALIGNED_TAIL;
63
67 usbd_desc_handler hid_iap_desc_handler =
68{
69 get_device_descriptor,
70 get_device_qualifier,
71 get_device_configuration,
72 get_device_other_speed,
73 get_device_lang_id,
74 get_device_manufacturer_string,
75 get_device_product_string,
76 get_device_serial_string,
77 get_device_interface_string,
78 get_device_config_string,
79};
80
84#if defined ( __ICCARM__ ) /* iar compiler */
85 #pragma data_alignment=4
86#endif
87ALIGNED_HEAD static uint8_t g_usbd_descriptor[USB_DEVICE_DESC_LEN] ALIGNED_TAIL =
88{
89 USB_DEVICE_DESC_LEN, /* bLength */
90 USB_DESCIPTOR_TYPE_DEVICE, /* bDescriptorType */
91 0x00, /* bcdUSB */
92 0x02,
93 0x00, /* bDeviceClass */
94 0x00, /* bDeviceSubClass */
95 0x00, /* bDeviceProtocol */
96 USB_MAX_EP0_SIZE, /* bMaxPacketSize */
97 LBYTE(USBD_HIDIAP_VENDOR_ID), /* idVendor */
98 HBYTE(USBD_HIDIAP_VENDOR_ID), /* idVendor */
99 LBYTE(USBD_HIDIAP_PRODUCT_ID), /* idProduct */
100 HBYTE(USBD_HIDIAP_PRODUCT_ID), /* idProduct */
101 0x00, /* bcdDevice rel. 2.00 */
102 0x02,
103 USB_MFC_STRING, /* Index of manufacturer string */
104 USB_PRODUCT_STRING, /* Index of product string */
105 USB_SERIAL_STRING, /* Index of serial number string */
106 1 /* bNumConfigurations */
107};
108
112#if defined ( __ICCARM__ ) /* iar compiler */
113 #pragma data_alignment=4
114#endif
115ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_HIDIAP_CONFIG_DESC_SIZE] ALIGNED_TAIL =
116{
117 USB_DEVICE_CFG_DESC_LEN, /* bLength: configuration descriptor size */
118 USB_DESCIPTOR_TYPE_CONFIGURATION, /* bDescriptorType: configuration */
119 LBYTE(USBD_HIDIAP_CONFIG_DESC_SIZE), /* wTotalLength: bytes returned */
120 HBYTE(USBD_HIDIAP_CONFIG_DESC_SIZE), /* wTotalLength: bytes returned */
121 0x01, /* bNumInterfaces: 1 interface */
122 0x01, /* bConfigurationValue: configuration value */
123 0x00, /* iConfiguration: index of string descriptor describing
124 the configuration */
125 0xC0, /* bmAttributes: self powered */
126 0x32, /* MaxPower 100 mA: this current is used for detecting vbus */
127
128 USB_DEVICE_IF_DESC_LEN, /* bLength: interface descriptor size */
129 USB_DESCIPTOR_TYPE_INTERFACE, /* bDescriptorType: interface descriptor type */
130 0x00, /* bInterfaceNumber: number of interface */
131 0x00, /* bAlternateSetting: alternate set */
132 0x02, /* bNumEndpoints: number of endpoints */
133 USB_CLASS_CODE_HID, /* bInterfaceClass: class code hid */
134 0x00, /* bInterfaceSubClass: subclass code */
135 0x00, /* bInterfaceProtocol: protocol code */
136 0x00, /* iInterface: index of string descriptor */
137
138 0x09, /* bLength: size of HID descriptor in bytes */
139 HID_CLASS_DESC_HID, /* bDescriptorType: HID descriptor type */
140 LBYTE(HIDIAP_BCD_NUM),
141 HBYTE(HIDIAP_BCD_NUM), /* bcdHID: HID class specification release number */
142 0x00, /* bCountryCode: hardware target conutry */
143 0x01, /* bNumDescriptors: number of HID class descriptor to follow */
144 HID_CLASS_DESC_REPORT, /* bDescriptorType: report descriptor type */
145 LBYTE(sizeof(g_usbd_hidiap_report)),
146 HBYTE(sizeof(g_usbd_hidiap_report)), /* wDescriptorLength: total length of reprot descriptor */
147
148 USB_DEVICE_EPT_LEN, /* bLength: size of endpoint descriptor in bytes */
149 USB_DESCIPTOR_TYPE_ENDPOINT, /* bDescriptorType: endpoint descriptor type */
150 USBD_HIDIAP_IN_EPT, /* bEndpointAddress: the address of endpoint on usb device described by this descriptor */
151 USB_EPT_DESC_INTERRUPT, /* bmAttributes: endpoint attributes */
152 LBYTE(USBD_HIDIAP_IN_MAXPACKET_SIZE),
153 HBYTE(USBD_HIDIAP_IN_MAXPACKET_SIZE), /* wMaxPacketSize: maximum packe size this endpoint */
154 HIDIAP_BINTERVAL_TIME, /* bInterval: interval for polling endpoint for data transfers */
155
156 USB_DEVICE_EPT_LEN, /* bLength: size of endpoint descriptor in bytes */
157 USB_DESCIPTOR_TYPE_ENDPOINT, /* bDescriptorType: endpoint descriptor type */
158 USBD_HIDIAP_OUT_EPT, /* bEndpointAddress: the address of endpoint on usb device described by this descriptor */
159 USB_EPT_DESC_INTERRUPT, /* bmAttributes: endpoint attributes */
160 LBYTE(USBD_HIDIAP_OUT_MAXPACKET_SIZE),
161 HBYTE(USBD_HIDIAP_OUT_MAXPACKET_SIZE), /* wMaxPacketSize: maximum packe size this endpoint */
162 HIDIAP_BINTERVAL_TIME, /* bInterval: interval for polling endpoint for data transfers */
163};
164
168#if defined ( __ICCARM__ ) /* iar compiler */
169 #pragma data_alignment=4
170#endif
171ALIGNED_HEAD uint8_t g_usbd_hidiap_report[USBD_HIDIAP_SIZ_REPORT_DESC] ALIGNED_TAIL =
172{
173 0x06, 0xFF, 0x00, /* USAGE_PAGE(Vendor Page:0xFF00) */
174 0x09, 0x01, /* USAGE (Demo Kit) */
175 0xa1, 0x01, /* COLLECTION (Application) */
176
177 /* 6 */
178 0x15, 0x00, /* LOGICAL_MINIMUM (0) */
179 0x25, 0xFF, /* LOGICAL_MAXIMUM (255) */
180 0x75, 0x08, /* REPORT_SIZE (8) */
181 0x95, 0x40, /* REPORT_COUNT (64) */
182
183 0x09, 0x01,
184 0x81, 0x02,
185 0x95, 0x40,
186
187 0x09, 0x01,
188 0x91, 0x02,
189 0x95, 0x01,
190
191 0x09, 0x01,
192 0xB1, 0x02,
193 0xC0
194};
195
199#if defined ( __ICCARM__ ) /* iar compiler */
200 #pragma data_alignment=4
201#endif
202ALIGNED_HEAD uint8_t g_hidiap_usb_desc[9] ALIGNED_TAIL =
203{
204 0x09, /* bLength: size of HID descriptor in bytes */
205 HID_CLASS_DESC_HID, /* bDescriptorType: HID descriptor type */
206 LBYTE(HIDIAP_BCD_NUM),
207 HBYTE(HIDIAP_BCD_NUM), /* bcdHID: HID class specification release number */
208 0x00, /* bCountryCode: hardware target conutry */
209 0x01, /* bNumDescriptors: number of HID class descriptor to follow */
210 HID_CLASS_DESC_REPORT, /* bDescriptorType: report descriptor type */
211 LBYTE(sizeof(g_usbd_hidiap_report)),
212 HBYTE(sizeof(g_usbd_hidiap_report)), /* wDescriptorLength: total length of reprot descriptor */
213};
214
215
219#if defined ( __ICCARM__ ) /* iar compiler */
220 #pragma data_alignment=4
221#endif
222ALIGNED_HEAD static uint8_t g_string_lang_id[USBD_HIDIAP_SIZ_STRING_LANGID] ALIGNED_TAIL =
223{
224 USBD_HIDIAP_SIZ_STRING_LANGID,
225 USB_DESCIPTOR_TYPE_STRING,
226 0x09,
227 0x04,
228};
229
233#if defined ( __ICCARM__ ) /* iar compiler */
234 #pragma data_alignment=4
235#endif
236ALIGNED_HEAD static uint8_t g_string_serial[USBD_HIDIAP_SIZ_STRING_SERIAL] ALIGNED_TAIL =
237{
238 USBD_HIDIAP_SIZ_STRING_SERIAL,
239 USB_DESCIPTOR_TYPE_STRING,
240};
241
242
243/* device descriptor */
244static usbd_desc_t device_descriptor =
245{
246 USB_DEVICE_DESC_LEN,
247 g_usbd_descriptor
248};
249
250/* config descriptor */
251static usbd_desc_t config_descriptor =
252{
253 USBD_HIDIAP_CONFIG_DESC_SIZE,
254 g_usbd_configuration
255};
256
257/* langid descriptor */
258static usbd_desc_t langid_descriptor =
259{
260 USBD_HIDIAP_SIZ_STRING_LANGID,
261 g_string_lang_id
262};
263
264/* serial descriptor */
265static usbd_desc_t serial_descriptor =
266{
267 USBD_HIDIAP_SIZ_STRING_SERIAL,
268 g_string_serial
269};
270
271static usbd_desc_t vp_desc;
272
279static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf)
280{
281 uint16_t str_len = 0, id_pos = 2;
282 uint8_t *tmp_str = string;
283
284 while(*tmp_str != '\0')
285 {
286 str_len ++;
287 unicode_buf[id_pos ++] = *tmp_str ++;
288 unicode_buf[id_pos ++] = 0x00;
289 }
290
291 str_len = str_len * 2 + 2;
292 unicode_buf[0] = str_len;
293 unicode_buf[1] = USB_DESCIPTOR_TYPE_STRING;
294
295 return str_len;
296}
297
305static void usbd_int_to_unicode (uint32_t value , uint8_t *pbuf , uint8_t len)
306{
307 uint8_t idx = 0;
308
309 for( idx = 0 ; idx < len ; idx ++)
310 {
311 if( ((value >> 28)) < 0xA )
312 {
313 pbuf[ 2 * idx] = (value >> 28) + '0';
314 }
315 else
316 {
317 pbuf[2 * idx] = (value >> 28) + 'A' - 10;
318 }
319
320 value = value << 4;
321
322 pbuf[2 * idx + 1] = 0;
323 }
324}
325
331static void get_serial_num(void)
332{
333 uint32_t serial0, serial1, serial2;
334
335 serial0 = *(uint32_t*)MCU_ID1;
336 serial1 = *(uint32_t*)MCU_ID2;
337 serial2 = *(uint32_t*)MCU_ID3;
338
339 serial0 += serial2;
340
341 if (serial0 != 0)
342 {
343 usbd_int_to_unicode (serial0, &g_string_serial[2] ,8);
344 usbd_int_to_unicode (serial1, &g_string_serial[18] ,4);
345 }
346}
347
353static usbd_desc_t *get_device_descriptor(void)
354{
355 return &device_descriptor;
356}
357
363static usbd_desc_t * get_device_qualifier(void)
364{
365 return NULL;
366}
367
373static usbd_desc_t *get_device_configuration(void)
374{
375 return &config_descriptor;
376}
377
383static usbd_desc_t *get_device_other_speed(void)
384{
385 return NULL;
386}
387
393static usbd_desc_t *get_device_lang_id(void)
394{
395 return &langid_descriptor;
396}
397
398
404static usbd_desc_t *get_device_manufacturer_string(void)
405{
406 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_HIDIAP_DESC_MANUFACTURER_STRING, g_usbd_desc_buffer);
407 vp_desc.descriptor = g_usbd_desc_buffer;
408 return &vp_desc;
409}
410
416static usbd_desc_t *get_device_product_string(void)
417{
418 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_HIDIAP_DESC_PRODUCT_STRING, g_usbd_desc_buffer);
419 vp_desc.descriptor = g_usbd_desc_buffer;
420 return &vp_desc;
421}
422
428static usbd_desc_t *get_device_serial_string(void)
429{
430 get_serial_num();
431 return &serial_descriptor;
432}
433
439static usbd_desc_t *get_device_interface_string(void)
440{
441 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_HIDIAP_DESC_INTERFACE_STRING, g_usbd_desc_buffer);
442 vp_desc.descriptor = g_usbd_desc_buffer;
443 return &vp_desc;
444}
445
451static usbd_desc_t *get_device_config_string(void)
452{
453 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_HIDIAP_DESC_CONFIGURATION_STRING, g_usbd_desc_buffer);
454 vp_desc.descriptor = g_usbd_desc_buffer;
455 return &vp_desc;
456}
457
NULL
#define NULL
Definition emmc_card/inc/at32_sdio.h:340
MCU_ID1
#define MCU_ID1
Definition audio_desc.h:214
MCU_ID2
#define MCU_ID2
Definition audio_desc.h:215
MCU_ID3
#define MCU_ID3
Definition audio_desc.h:216
HID_CLASS_DESC_HID
#define HID_CLASS_DESC_HID
usb hid class descriptor define
Definition audio_hid_desc.h:214
HID_CLASS_DESC_REPORT
#define HID_CLASS_DESC_REPORT
Definition audio_hid_desc.h:215
USBD_HIDIAP_OUT_MAXPACKET_SIZE
#define USBD_HIDIAP_OUT_MAXPACKET_SIZE
Definition hid_iap_class.h:55
USBD_HIDIAP_IN_EPT
#define USBD_HIDIAP_IN_EPT
Definition hid_iap_class.h:51
USBD_HIDIAP_OUT_EPT
#define USBD_HIDIAP_OUT_EPT
Definition hid_iap_class.h:52
USBD_HIDIAP_IN_MAXPACKET_SIZE
#define USBD_HIDIAP_IN_MAXPACKET_SIZE
Definition hid_iap_class.h:54
g_usbd_hidiap_report
uint8_t g_usbd_hidiap_report[32]
USBD_HIDIAP_SIZ_STRING_LANGID
#define USBD_HIDIAP_SIZ_STRING_LANGID
Definition hid_iap_desc.h:57
USBD_HIDIAP_SIZ_STRING_SERIAL
#define USBD_HIDIAP_SIZ_STRING_SERIAL
Definition hid_iap_desc.h:58
g_hidiap_usb_desc
uint8_t g_hidiap_usb_desc[9]
USBD_HIDIAP_VENDOR_ID
#define USBD_HIDIAP_VENDOR_ID
Definition hid_iap_desc.h:52
HIDIAP_BCD_NUM
#define HIDIAP_BCD_NUM
Definition hid_iap_desc.h:50
USBD_HIDIAP_SIZ_REPORT_DESC
#define USBD_HIDIAP_SIZ_REPORT_DESC
Definition hid_iap_desc.h:56
USBD_HIDIAP_DESC_INTERFACE_STRING
#define USBD_HIDIAP_DESC_INTERFACE_STRING
Definition hid_iap_desc.h:63
HIDIAP_BINTERVAL_TIME
#define HIDIAP_BINTERVAL_TIME
Definition hid_iap_desc.h:65
USBD_HIDIAP_DESC_CONFIGURATION_STRING
#define USBD_HIDIAP_DESC_CONFIGURATION_STRING
Definition hid_iap_desc.h:62
USBD_HIDIAP_DESC_MANUFACTURER_STRING
#define USBD_HIDIAP_DESC_MANUFACTURER_STRING
Definition hid_iap_desc.h:60
USBD_HIDIAP_DESC_PRODUCT_STRING
#define USBD_HIDIAP_DESC_PRODUCT_STRING
Definition hid_iap_desc.h:61
USBD_HIDIAP_CONFIG_DESC_SIZE
#define USBD_HIDIAP_CONFIG_DESC_SIZE
Definition hid_iap_desc.h:55
USBD_HIDIAP_PRODUCT_ID
#define USBD_HIDIAP_PRODUCT_ID
Definition hid_iap_desc.h:53
serial_descriptor
static usbd_desc_t serial_descriptor
Definition hid_iap_desc.c:265
device_descriptor
static usbd_desc_t device_descriptor
Definition hid_iap_desc.c:244
get_device_configuration
static usbd_desc_t * get_device_configuration(void)
get config descriptor
Definition hid_iap_desc.c:373
langid_descriptor
static usbd_desc_t langid_descriptor
Definition hid_iap_desc.c:258
get_device_descriptor
static usbd_desc_t * get_device_descriptor(void)
get device descriptor
Definition hid_iap_desc.c:353
get_device_manufacturer_string
static usbd_desc_t * get_device_manufacturer_string(void)
get manufacturer descriptor
Definition hid_iap_desc.c:404
get_device_qualifier
static usbd_desc_t * get_device_qualifier(void)
get device qualifier
Definition hid_iap_desc.c:363
get_device_interface_string
static usbd_desc_t * get_device_interface_string(void)
get interface descriptor
Definition hid_iap_desc.c:439
vp_desc
static usbd_desc_t vp_desc
Definition hid_iap_desc.c:271
get_device_other_speed
static usbd_desc_t * get_device_other_speed(void)
get other speed descriptor
Definition hid_iap_desc.c:383
ALIGNED_TAIL
static ALIGNED_HEAD uint8_t g_usbd_desc_buffer[256] ALIGNED_TAIL
usb device standard descriptor
Definition hid_iap_desc.c:62
get_device_product_string
static usbd_desc_t * get_device_product_string(void)
get product descriptor
Definition hid_iap_desc.c:416
get_device_config_string
static usbd_desc_t * get_device_config_string(void)
get device config descriptor
Definition hid_iap_desc.c:451
hid_iap_desc_handler
usbd_desc_handler hid_iap_desc_handler
hid device descriptor handler structure
Definition hid_iap_desc.c:67
usbd_unicode_convert
static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf)
standard usb unicode convert
Definition hid_iap_desc.c:279
get_device_lang_id
static usbd_desc_t * get_device_lang_id(void)
get lang id descriptor
Definition hid_iap_desc.c:393
get_serial_num
static void get_serial_num(void)
usb get serial number
Definition hid_iap_desc.c:331
config_descriptor
static usbd_desc_t config_descriptor
Definition hid_iap_desc.c:251
get_device_serial_string
static usbd_desc_t * get_device_serial_string(void)
get serial descriptor
Definition hid_iap_desc.c:428
usbd_int_to_unicode
static void usbd_int_to_unicode(uint32_t value, uint8_t *pbuf, uint8_t len)
usb int convert to unicode
Definition hid_iap_desc.c:305
HBYTE
#define HBYTE(x)
Definition usb_std.h:271
USB_DEVICE_EPT_LEN
#define USB_DEVICE_EPT_LEN
Definition usb_std.h:159
USB_MAX_EP0_SIZE
#define USB_MAX_EP0_SIZE
endpoint 0 max size
Definition usb_std.h:248
USB_PRODUCT_STRING
#define USB_PRODUCT_STRING
Definition usb_std.h:105
USB_DESCIPTOR_TYPE_CONFIGURATION
#define USB_DESCIPTOR_TYPE_CONFIGURATION
Definition usb_std.h:92
LBYTE
#define LBYTE(x)
low byte and high byte define
Definition usb_std.h:270
USB_DESCIPTOR_TYPE_ENDPOINT
#define USB_DESCIPTOR_TYPE_ENDPOINT
Definition usb_std.h:95
USB_DEVICE_DESC_LEN
#define USB_DEVICE_DESC_LEN
Definition usb_std.h:156
USB_MFC_STRING
#define USB_MFC_STRING
Definition usb_std.h:104
USB_DEVICE_IF_DESC_LEN
#define USB_DEVICE_IF_DESC_LEN
Definition usb_std.h:158
USB_DEVICE_CFG_DESC_LEN
#define USB_DEVICE_CFG_DESC_LEN
Definition usb_std.h:157
USB_EPT_DESC_INTERRUPT
#define USB_EPT_DESC_INTERRUPT
Definition usb_std.h:184
USB_SERIAL_STRING
#define USB_SERIAL_STRING
Definition usb_std.h:106
USB_DESCIPTOR_TYPE_DEVICE
#define USB_DESCIPTOR_TYPE_DEVICE
usb standard device type
Definition usb_std.h:91
USB_DESCIPTOR_TYPE_STRING
#define USB_DESCIPTOR_TYPE_STRING
Definition usb_std.h:93
USB_DESCIPTOR_TYPE_INTERFACE
#define USB_DESCIPTOR_TYPE_INTERFACE
Definition usb_std.h:94
USB_CLASS_CODE_HID
#define USB_CLASS_CODE_HID
Definition usb_std.h:169
hid_iap_desc.h
usb hid descriptor header file
usbd_desc_handler
usb device descriptor handler
Definition usbd_core.h:75
usbd_desc_t
usb device descriptor struct
Definition usbd_core.h:66
usbd_desc_t::length
uint16_t length
Definition usbd_core.h:67
usbd_desc_t::descriptor
uint8_t * descriptor
Definition usbd_core.h:68
usb_std.h
usb standard header file
usbd_core.h
usb device core header file
usbd_sdr.h
usb standard request header file


AT32F413 Firmwary Library: hid_iap_desc.h Source File

  • middlewares
  • usbd_class
  • hid_iap
hid_iap_desc.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __HID_IAP_DESC_H
28#define __HID_IAP_DESC_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "hid_iap_class.h"
35#include "usbd_core.h"
36
50#define HIDIAP_BCD_NUM 0x0110
51
52#define USBD_HIDIAP_VENDOR_ID 0x2E3C
53#define USBD_HIDIAP_PRODUCT_ID 0xAF01
54
55#define USBD_HIDIAP_CONFIG_DESC_SIZE 41
56#define USBD_HIDIAP_SIZ_REPORT_DESC 32
57#define USBD_HIDIAP_SIZ_STRING_LANGID 4
58#define USBD_HIDIAP_SIZ_STRING_SERIAL 0x1A
59
60#define USBD_HIDIAP_DESC_MANUFACTURER_STRING "Artery"
61#define USBD_HIDIAP_DESC_PRODUCT_STRING "HID IAP"
62#define USBD_HIDIAP_DESC_CONFIGURATION_STRING "HID IAP Config"
63#define USBD_HIDIAP_DESC_INTERFACE_STRING "HID IAP Interface"
64
65#define HIDIAP_BINTERVAL_TIME 0x01
66
67#define MCU_ID1 (0x1FFFF7E8)
68#define MCU_ID2 (0x1FFFF7EC)
69#define MCU_ID3 (0x1FFFF7F0)
70extern uint8_t g_usbd_hidiap_report[USBD_HIDIAP_SIZ_REPORT_DESC];
71extern uint8_t g_hidiap_usb_desc[9];
72
73extern usbd_desc_handler hid_iap_desc_handler;
74
75
88#ifdef __cplusplus
89}
90#endif
91
92#endif
93
g_usbd_hidiap_report
uint8_t g_usbd_hidiap_report[32]
g_hidiap_usb_desc
uint8_t g_hidiap_usb_desc[9]
USBD_HIDIAP_SIZ_REPORT_DESC
#define USBD_HIDIAP_SIZ_REPORT_DESC
Definition hid_iap_desc.h:56
hid_iap_desc_handler
usbd_desc_handler hid_iap_desc_handler
hid device descriptor handler structure
Definition hid_iap_desc.c:67
hid_iap_class.h
usb hid iap header file
usbd_desc_handler
usb device descriptor handler
Definition usbd_core.h:75
usbd_core.h
usb device core header file


AT32F413 Firmwary Library: i2c_application.c Source File

  • middlewares
  • i2c_application_library
i2c_application.c
Go to the documentation of this file.
1
26#include "i2c_application.h"
27
36#define DMA_GET_TC_FLAG(DMA_CHANNEL) \
37(((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA1_CHANNEL1))? DMA1_FDT1_FLAG : \
38 ((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA1_CHANNEL2))? DMA1_FDT2_FLAG : \
39 ((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA1_CHANNEL3))? DMA1_FDT3_FLAG : \
40 ((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA1_CHANNEL4))? DMA1_FDT4_FLAG : \
41 ((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA1_CHANNEL5))? DMA1_FDT5_FLAG : \
42 ((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA1_CHANNEL6))? DMA1_FDT6_FLAG : \
43 ((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA1_CHANNEL7))? DMA1_FDT7_FLAG : \
44 ((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA2_CHANNEL1))? DMA2_FDT1_FLAG : \
45 ((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA2_CHANNEL2))? DMA2_FDT2_FLAG : \
46 ((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA2_CHANNEL3))? DMA2_FDT3_FLAG : \
47 ((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA2_CHANNEL4))? DMA2_FDT4_FLAG : \
48 ((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA2_CHANNEL5))? DMA2_FDT5_FLAG : \
49 ((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA2_CHANNEL6))? DMA2_FDT6_FLAG : \
50 DMA2_FDT7_FLAG)
51
55#define DMA_GET_HT_FLAG(DMA_CHANNEL) \
56(((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA1_CHANNEL1))? DMA1_HDT1_FLAG : \
57 ((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA1_CHANNEL2))? DMA1_HDT2_FLAG : \
58 ((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA1_CHANNEL3))? DMA1_HDT3_FLAG : \
59 ((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA1_CHANNEL4))? DMA1_HDT4_FLAG : \
60 ((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA1_CHANNEL5))? DMA1_HDT5_FLAG : \
61 ((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA1_CHANNEL6))? DMA1_HDT6_FLAG : \
62 ((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA1_CHANNEL7))? DMA1_HDT7_FLAG : \
63 ((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA2_CHANNEL1))? DMA2_HDT1_FLAG : \
64 ((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA2_CHANNEL2))? DMA2_HDT2_FLAG : \
65 ((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA2_CHANNEL3))? DMA2_HDT3_FLAG : \
66 ((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA2_CHANNEL4))? DMA2_HDT4_FLAG : \
67 ((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA2_CHANNEL5))? DMA2_HDT5_FLAG : \
68 ((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA2_CHANNEL6))? DMA2_HDT6_FLAG : \
69 DMA2_HDT7_FLAG)
70
74#define DMA_GET_TERR_FLAG(DMA_CHANNEL) \
75(((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA1_CHANNEL1))? DMA1_DTERR1_FLAG : \
76 ((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA1_CHANNEL2))? DMA1_DTERR2_FLAG : \
77 ((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA1_CHANNEL3))? DMA1_DTERR3_FLAG : \
78 ((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA1_CHANNEL4))? DMA1_DTERR4_FLAG : \
79 ((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA1_CHANNEL5))? DMA1_DTERR5_FLAG : \
80 ((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA1_CHANNEL6))? DMA1_DTERR6_FLAG : \
81 ((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA1_CHANNEL7))? DMA1_DTERR7_FLAG : \
82 ((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA2_CHANNEL1))? DMA2_DTERR1_FLAG : \
83 ((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA2_CHANNEL2))? DMA2_DTERR2_FLAG : \
84 ((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA2_CHANNEL3))? DMA2_DTERR3_FLAG : \
85 ((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA2_CHANNEL4))? DMA2_DTERR4_FLAG : \
86 ((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA2_CHANNEL5))? DMA2_DTERR5_FLAG : \
87 ((uint32_t)(DMA_CHANNEL) == ((uint32_t)DMA2_CHANNEL6))? DMA2_DTERR6_FLAG : \
88 DMA2_DTERR7_FLAG)
89
93#define I2C_START 0
94#define I2C_END 1
95
101__WEAK void i2c_lowlevel_init(i2c_handle_type* hi2c)
102{
103
104}
105
111void i2c_config(i2c_handle_type* hi2c)
112{
113 /* reset i2c peripheral */
114 i2c_reset(hi2c->i2cx);
115
116 /* i2c peripheral initialization */
117 i2c_lowlevel_init(hi2c);
118
119 /* i2c peripheral enable */
120 i2c_enable(hi2c->i2cx, TRUE);
121}
122
129 i2c_status_type i2c_wait_end(i2c_handle_type* hi2c, uint32_t timeout)
130{
131 while(hi2c->status != I2C_END)
132 {
133 /* check timeout */
134 if((timeout--) == 0)
135 {
136 return I2C_ERR_TIMEOUT;
137 }
138 }
139
140 if(hi2c->error_code != I2C_OK)
141 {
142 return hi2c->error_code;
143 }
144 else
145 {
146 return I2C_OK;
147 }
148}
149
185 i2c_status_type i2c_wait_flag(i2c_handle_type* hi2c, uint32_t flag, uint32_t event_check, uint32_t timeout)
186{
187 if(flag == I2C_BUSYF_FLAG)
188 {
189 while(i2c_flag_get(hi2c->i2cx, flag) != RESET)
190 {
191 /* check timeout */
192 if((timeout--) == 0)
193 {
194 hi2c->error_code = I2C_ERR_TIMEOUT;
195
196 return I2C_ERR_TIMEOUT;
197 }
198 }
199 }
200 else
201 {
202 while(i2c_flag_get(hi2c->i2cx, flag) == RESET)
203 {
204 /* check the ack fail flag */
205 if(event_check & I2C_EVENT_CHECK_ACKFAIL)
206 {
207 if(i2c_flag_get(hi2c->i2cx, I2C_ACKFAIL_FLAG) != RESET)
208 {
209 /* generate stop condtion */
210 i2c_stop_generate(hi2c->i2cx);
211
212 /* clear ack fail flag */
213 i2c_flag_clear(hi2c->i2cx, I2C_ACKFAIL_FLAG);
214
215 hi2c->error_code = I2C_ERR_ACKFAIL;
216
217 return I2C_ERR_ACKFAIL;
218 }
219 }
220
221 /* check the stop flag */
222 if(event_check & I2C_EVENT_CHECK_STOP)
223 {
224 if(i2c_flag_get(hi2c->i2cx, I2C_STOPF_FLAG) != RESET)
225 {
226 /* clear stop flag */
227 i2c_flag_clear(hi2c->i2cx, I2C_STOPF_FLAG);
228
229 hi2c->error_code = I2C_ERR_STOP;
230
231 return I2C_ERR_STOP;
232 }
233 }
234
235 /* check timeout */
236 if((timeout--) == 0)
237 {
238 hi2c->error_code = I2C_ERR_TIMEOUT;
239
240 return I2C_ERR_TIMEOUT;
241 }
242 }
243 }
244
245 return I2C_OK;
246}
247
256void i2c_dma_config(i2c_handle_type* hi2c, dma_channel_type* dma_channelx, uint8_t* pdata, uint16_t size)
257{
258 /* disable the dma channel */
259 dma_channel_enable(dma_channelx, FALSE);
260
261 /* disable the transfer complete interrupt */
262 dma_interrupt_enable(dma_channelx, DMA_FDT_INT , FALSE);
263
264 /* configure buffer address and buffer size */
265 hi2c->dma_init_struct.memory_base_addr = (uint32_t)pdata;
266 hi2c->dma_init_struct.direction = (dma_channelx == hi2c->dma_tx_channel) ? DMA_DIR_MEMORY_TO_PERIPHERAL : DMA_DIR_PERIPHERAL_TO_MEMORY;
267 hi2c->dma_init_struct.peripheral_base_addr = (uint32_t)&hi2c->i2cx->dt;
268 hi2c->dma_init_struct.buffer_size = (uint32_t)size;
269 dma_init(dma_channelx, &hi2c->dma_init_struct);
270
271 /* enable the transfer complete interrupt */
272 dma_interrupt_enable(dma_channelx, DMA_FDT_INT , TRUE);
273
274 /* enable the dma channel */
275 dma_channel_enable(dma_channelx, TRUE);
276}
277
285 i2c_status_type i2c_master_write_addr(i2c_handle_type *hi2c, uint16_t address, uint32_t timeout)
286{
287 /* generate start condtion */
288 i2c_start_generate(hi2c->i2cx);
289
290 /* wait for the start flag to be set */
291 if(i2c_wait_flag(hi2c, I2C_STARTF_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
292 {
293 hi2c->error_code = I2C_ERR_START;
294
295 return I2C_ERR_START;
296 }
297
298 if(hi2c->i2cx->oaddr1_bit.addr1mode == I2C_ADDRESS_MODE_7BIT)
299 {
300 /* send slave address */
301 i2c_7bit_address_send(hi2c->i2cx, address, I2C_DIRECTION_TRANSMIT);
302 }
303 else
304 {
305 /* send slave 10-bit address header */
306 i2c_data_send(hi2c->i2cx, (uint8_t)((address & 0x0300) >> 7) | 0xF0);
307
308 /* wait for the addrh flag to be set */
309 if(i2c_wait_flag(hi2c, I2C_ADDRHF_FLAG, I2C_EVENT_CHECK_ACKFAIL, timeout) != I2C_OK)
310 {
311 hi2c->error_code = I2C_ERR_ADDR10;
312
313 return I2C_ERR_ADDR10;
314 }
315
316 /* send slave address */
317 i2c_data_send(hi2c->i2cx, (uint8_t)(address & 0x00FF));
318 }
319
320 /* wait for the addr7 flag to be set */
321 if(i2c_wait_flag(hi2c, I2C_ADDR7F_FLAG, I2C_EVENT_CHECK_ACKFAIL, timeout) != I2C_OK)
322 {
323 hi2c->error_code = I2C_ERR_ADDR;
324
325 return I2C_ERR_ADDR;
326 }
327
328 return I2C_OK;
329}
330
338 i2c_status_type i2c_master_read_addr(i2c_handle_type *hi2c, uint16_t address, uint32_t timeout)
339{
340 /* enable ack */
341 i2c_ack_enable(hi2c->i2cx, TRUE);
342
343 /* generate start condtion */
344 i2c_start_generate(hi2c->i2cx);
345
346 /* wait for the start flag to be set */
347 if(i2c_wait_flag(hi2c, I2C_STARTF_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
348 {
349 hi2c->error_code = I2C_ERR_START;
350
351 return I2C_ERR_START;
352 }
353
354 if(hi2c->i2cx->oaddr1_bit.addr1mode == I2C_ADDRESS_MODE_7BIT)
355 {
356 /* send slave address */
357 i2c_7bit_address_send(hi2c->i2cx, address, I2C_DIRECTION_RECEIVE);
358 }
359 else
360 {
361 /* send slave 10-bit address header */
362 i2c_data_send(hi2c->i2cx, (uint8_t)((address & 0x0300) >> 7) | 0xF0);
363
364 /* wait for the addrh flag to be set */
365 if(i2c_wait_flag(hi2c, I2C_ADDRHF_FLAG, I2C_EVENT_CHECK_ACKFAIL, timeout) != I2C_OK)
366 {
367 hi2c->error_code = I2C_ERR_ADDR10;
368
369 return I2C_ERR_ADDR10;
370 }
371
372 /* send slave address */
373 i2c_data_send(hi2c->i2cx, (uint8_t)(address & 0x00FF));
374
375 /* wait for the addr7 flag to be set */
376 if(i2c_wait_flag(hi2c, I2C_ADDR7F_FLAG, I2C_EVENT_CHECK_ACKFAIL, timeout) != I2C_OK)
377 {
378 hi2c->error_code = I2C_ERR_ADDR;
379
380 return I2C_ERR_ADDR;
381 }
382
383 /* clear addr flag */
384 i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
385
386 /* generate restart condtion */
387 i2c_start_generate(hi2c->i2cx);
388
389 /* wait for the start flag to be set */
390 if(i2c_wait_flag(hi2c, I2C_STARTF_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
391 {
392 hi2c->error_code = I2C_ERR_START;
393
394 return I2C_ERR_START;
395 }
396
397 /* send slave 10-bit address header */
398 i2c_data_send(hi2c->i2cx, (uint8_t)((address & 0x0300) >> 7) | 0xF1);
399 }
400
401 /* wait for the addr7 flag to be set */
402 if(i2c_wait_flag(hi2c, I2C_ADDR7F_FLAG, I2C_EVENT_CHECK_ACKFAIL, timeout) != I2C_OK)
403 {
404 hi2c->error_code = I2C_ERR_ADDR;
405
406 return I2C_ERR_ADDR;
407 }
408
409 return I2C_OK;
410}
411
421 i2c_status_type i2c_master_transmit(i2c_handle_type* hi2c, uint16_t address, uint8_t* pdata, uint16_t size, uint32_t timeout)
422{
423 /* initialization parameters */
424 hi2c->pbuff = pdata;
425 hi2c->pcount = size;
426
427 hi2c->error_code = I2C_OK;
428
429 /* wait for the busy flag to be reset */
430 if(i2c_wait_flag(hi2c, I2C_BUSYF_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
431 {
432 return I2C_ERR_STEP_1;
433 }
434
435 /* ack acts on the current byte */
436 i2c_master_receive_ack_set(hi2c->i2cx, I2C_MASTER_ACK_CURRENT);
437
438 /* send slave address */
439 if(i2c_master_write_addr(hi2c, address, timeout) != I2C_OK)
440 {
441 /* generate stop condtion */
442 i2c_stop_generate(hi2c->i2cx);
443
444 return I2C_ERR_STEP_2;
445 }
446
447 /* clear addr flag */
448 i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
449
450 while(size > 0)
451 {
452 /* wait for the tdbe flag to be set */
453 if(i2c_wait_flag(hi2c, I2C_TDBE_FLAG, I2C_EVENT_CHECK_ACKFAIL, timeout) != I2C_OK)
454 {
455 /* generate stop condtion */
456 i2c_stop_generate(hi2c->i2cx);
457
458 return I2C_ERR_STEP_3;
459 }
460
461 /* write data */
462 i2c_data_send(hi2c->i2cx, (*pdata++));
463 size--;
464 }
465
466 /* wait for the tdc flag to be set */
467 if(i2c_wait_flag(hi2c, I2C_TDC_FLAG, I2C_EVENT_CHECK_ACKFAIL, timeout) != I2C_OK)
468 {
469 /* generate stop condtion */
470 i2c_stop_generate(hi2c->i2cx);
471
472 return I2C_ERR_STEP_4;
473 }
474
475 /* generate stop condtion */
476 i2c_stop_generate(hi2c->i2cx);
477
478 return I2C_OK;
479}
480
489 i2c_status_type i2c_slave_receive(i2c_handle_type* hi2c, uint8_t* pdata, uint16_t size, uint32_t timeout)
490{
491 /* initialization parameters */
492 hi2c->pbuff = pdata;
493 hi2c->pcount = size;
494
495 hi2c->error_code = I2C_OK;
496
497 /* wait for the busy flag to be reset */
498 if(i2c_wait_flag(hi2c, I2C_BUSYF_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
499 {
500 return I2C_ERR_STEP_1;
501 }
502
503 /* ack acts on the current byte */
504 i2c_master_receive_ack_set(hi2c->i2cx, I2C_MASTER_ACK_CURRENT);
505
506 /* enable ack */
507 i2c_ack_enable(hi2c->i2cx, TRUE);
508
509 /* wait for the addr7 flag to be set */
510 if(i2c_wait_flag(hi2c, I2C_ADDR7F_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
511 {
512 /* disable ack */
513 i2c_ack_enable(hi2c->i2cx, FALSE);
514
515 return I2C_ERR_STEP_2;
516 }
517
518 /* clear addr flag */
519 i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
520
521 while(size > 0)
522 {
523 /* wait for the rdbf flag to be set */
524 if(i2c_wait_flag(hi2c, I2C_RDBF_FLAG, I2C_EVENT_CHECK_STOP, timeout) != I2C_OK)
525 {
526 /* disable ack */
527 i2c_ack_enable(hi2c->i2cx, FALSE);
528
529 return I2C_ERR_STEP_3;
530 }
531
532 /* read data */
533 (*pdata++) = i2c_data_receive(hi2c->i2cx);
534 size--;
535 }
536
537 /* wait for the stop flag to be set */
538 if(i2c_wait_flag(hi2c, I2C_STOPF_FLAG, I2C_EVENT_CHECK_ACKFAIL, timeout) != I2C_OK)
539 {
540 /* disable ack */
541 i2c_ack_enable(hi2c->i2cx, FALSE);
542
543 return I2C_ERR_STEP_4;
544 }
545
546 /* clear stop flag */
547 i2c_flag_clear(hi2c->i2cx, I2C_STOPF_FLAG);
548
549 /* disable ack */
550 i2c_ack_enable(hi2c->i2cx, FALSE);
551
552 return I2C_OK;
553}
554
564 i2c_status_type i2c_master_receive(i2c_handle_type* hi2c, uint16_t address, uint8_t* pdata, uint16_t size, uint32_t timeout)
565{
566 /* initialization parameters */
567 hi2c->pbuff = pdata;
568 hi2c->pcount = size;
569
570 hi2c->error_code = I2C_OK;
571
572 /* wait for the busy flag to be reset */
573 if(i2c_wait_flag(hi2c, I2C_BUSYF_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
574 {
575 return I2C_ERR_STEP_1;
576 }
577
578 /* ack acts on the current byte */
579 i2c_master_receive_ack_set(hi2c->i2cx, I2C_MASTER_ACK_CURRENT);
580
581 /* enable ack */
582 i2c_ack_enable(hi2c->i2cx, TRUE);
583
584 /* send slave address */
585 if(i2c_master_read_addr(hi2c, address, timeout) != I2C_OK)
586 {
587 /* generate stop condtion */
588 i2c_stop_generate(hi2c->i2cx);
589
590 return I2C_ERR_STEP_2;
591 }
592
593 if(size == 1)
594 {
595 /* disable ack */
596 i2c_ack_enable(hi2c->i2cx, FALSE);
597
598 /* clear addr flag */
599 i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
600
601 /* generate stop condtion */
602 i2c_stop_generate(hi2c->i2cx);
603 }
604 else if(size == 2)
605 {
606 /* ack acts on the next byte */
607 i2c_master_receive_ack_set(hi2c->i2cx, I2C_MASTER_ACK_NEXT);
608
609 /* disable ack */
610 i2c_ack_enable(hi2c->i2cx, FALSE);
611
612 /* clear addr flag */
613 i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
614 }
615 else
616 {
617 /* enable ack */
618 i2c_ack_enable(hi2c->i2cx, TRUE);
619
620 /* clear addr flag */
621 i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
622 }
623
624 while(size > 0)
625 {
626 if(size <= 3)
627 {
628 /* 1 byte */
629 if(size == 1)
630 {
631 /* wait for the rdbf flag to be set */
632 if(i2c_wait_flag(hi2c, I2C_RDBF_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
633 {
634 /* generate stop condtion */
635 i2c_stop_generate(hi2c->i2cx);
636
637 return I2C_ERR_STEP_3;
638 }
639
640 /* read data */
641 (*pdata++) = i2c_data_receive(hi2c->i2cx);
642 size--;
643 }
644 /* 2 bytes */
645 else if(size == 2)
646 {
647 /* wait for the tdc flag to be set */
648 if(i2c_wait_flag(hi2c, I2C_TDC_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
649 {
650 /* generate stop condtion */
651 i2c_stop_generate(hi2c->i2cx);
652
653 return I2C_ERR_STEP_4;
654 }
655
656 /* generate stop condtion */
657 i2c_stop_generate(hi2c->i2cx);
658
659 /* read data */
660 (*pdata++) = i2c_data_receive(hi2c->i2cx);
661 size--;
662
663 /* read data */
664 (*pdata++) = i2c_data_receive(hi2c->i2cx);
665 size--;
666 }
667 /* 3 last bytes */
668 else
669 {
670 /* wait for the tdc flag to be set */
671 if(i2c_wait_flag(hi2c, I2C_TDC_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
672 {
673 /* generate stop condtion */
674 i2c_stop_generate(hi2c->i2cx);
675
676 return I2C_ERR_STEP_5;
677 }
678
679 /* disable ack */
680 i2c_ack_enable(hi2c->i2cx, FALSE);
681
682 /* read data */
683 (*pdata++) = i2c_data_receive(hi2c->i2cx);
684 size--;
685
686 /* wait for the tdc flag to be set */
687 if(i2c_wait_flag(hi2c, I2C_TDC_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
688 {
689 /* generate stop condtion */
690 i2c_stop_generate(hi2c->i2cx);
691
692 return I2C_ERR_STEP_6;
693 }
694
695 /* generate stop condtion */
696 i2c_stop_generate(hi2c->i2cx);
697
698 /* read data */
699 (*pdata++) = i2c_data_receive(hi2c->i2cx);
700 size--;
701
702 /* read data */
703 (*pdata++) = i2c_data_receive(hi2c->i2cx);
704 size--;
705 }
706 }
707 else
708 {
709 /* wait for the rdbf flag to be set */
710 if(i2c_wait_flag(hi2c, I2C_RDBF_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
711 {
712 /* generate stop condtion */
713 i2c_stop_generate(hi2c->i2cx);
714
715 return I2C_ERR_STEP_7;
716 }
717
718 /* read data */
719 (*pdata++) = i2c_data_receive(hi2c->i2cx);
720 size--;
721 }
722 }
723
724 return I2C_OK;
725}
726
735 i2c_status_type i2c_slave_transmit(i2c_handle_type* hi2c, uint8_t* pdata, uint16_t size, uint32_t timeout)
736{
737 /* initialization parameters */
738 hi2c->pbuff = pdata;
739 hi2c->pcount = size;
740
741 hi2c->error_code = I2C_OK;
742
743 /* wait for the busy flag to be reset */
744 if(i2c_wait_flag(hi2c, I2C_BUSYF_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
745 {
746 return I2C_ERR_STEP_1;
747 }
748
749 /* ack acts on the current byte */
750 i2c_master_receive_ack_set(hi2c->i2cx, I2C_MASTER_ACK_CURRENT);
751
752 /* enable ack */
753 i2c_ack_enable(hi2c->i2cx, TRUE);
754
755 /* wait for the addr7 flag to be set */
756 if(i2c_wait_flag(hi2c, I2C_ADDR7F_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
757 {
758 /* disable ack */
759 i2c_ack_enable(hi2c->i2cx, FALSE);
760
761 return I2C_ERR_STEP_2;
762 }
763
764 /* clear addr flag */
765 i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
766
767 if(hi2c->i2cx->oaddr1_bit.addr1mode == I2C_ADDRESS_MODE_10BIT)
768 {
769 /* wait for the addr7 flag to be set */
770 if(i2c_wait_flag(hi2c, I2C_ADDR7F_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
771 {
772 /* disable ack */
773 i2c_ack_enable(hi2c->i2cx, FALSE);
774
775 return I2C_ERR_STEP_3;
776 }
777
778 /* clear addr flag */
779 i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
780 }
781
782 while(size > 0)
783 {
784 /* wait for the tdbe flag to be set */
785 if(i2c_wait_flag(hi2c, I2C_TDBE_FLAG, I2C_EVENT_CHECK_ACKFAIL, timeout) != I2C_OK)
786 {
787 /* disable ack */
788 i2c_ack_enable(hi2c->i2cx, FALSE);
789
790 return I2C_ERR_STEP_4;
791 }
792
793 /* write data */
794 i2c_data_send(hi2c->i2cx, *pdata++);
795 size--;
796 }
797
798 /* wait for the ackfail flag to be set */
799 if(i2c_wait_flag(hi2c, I2C_ACKFAIL_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
800 {
801 return I2C_ERR_STEP_5;
802 }
803
804 /* clear ackfail flag */
805 i2c_flag_clear(hi2c->i2cx, I2C_ACKFAIL_FLAG);
806
807 /* disable ack */
808 i2c_ack_enable(hi2c->i2cx, FALSE);
809
810 return I2C_OK;
811}
812
822 i2c_status_type i2c_master_transmit_int(i2c_handle_type* hi2c, uint16_t address, uint8_t* pdata, uint16_t size, uint32_t timeout)
823{
824 /* initialization parameters */
825 hi2c->mode = I2C_INT_MA_TX;
826 hi2c->status = I2C_START;
827
828 hi2c->pbuff = pdata;
829 hi2c->pcount = size;
830
831 hi2c->timeout = timeout;
832 hi2c->error_code = I2C_OK;
833
834 /* wait for the busy flag to be reset */
835 if(i2c_wait_flag(hi2c, I2C_BUSYF_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
836 {
837 return I2C_ERR_STEP_1;
838 }
839
840 /* ack acts on the current byte */
841 i2c_master_receive_ack_set(hi2c->i2cx, I2C_MASTER_ACK_CURRENT);
842
843 /* send slave address */
844 if(i2c_master_write_addr(hi2c, address, timeout) != I2C_OK)
845 {
846 /* generate stop condtion */
847 i2c_stop_generate(hi2c->i2cx);
848
849 return I2C_ERR_STEP_2;
850 }
851
852 /* clear addr flag */
853 i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
854
855 /* enable interrupt */
856 i2c_interrupt_enable(hi2c->i2cx, I2C_EVT_INT | I2C_DATA_INT | I2C_ERR_INT, TRUE);
857
858 return I2C_OK;
859}
860
869 i2c_status_type i2c_slave_receive_int(i2c_handle_type* hi2c, uint8_t* pdata, uint16_t size, uint32_t timeout)
870{
871 /* initialization parameters */
872 hi2c->mode = I2C_INT_SLA_RX;
873 hi2c->status = I2C_START;
874
875 hi2c->pbuff = pdata;
876 hi2c->pcount = size;
877
878 hi2c->timeout = timeout;
879 hi2c->error_code = I2C_OK;
880
881 /* wait for the busy flag to be reset */
882 if(i2c_wait_flag(hi2c, I2C_BUSYF_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
883 {
884 return I2C_ERR_STEP_1;
885 }
886
887 /* ack acts on the current byte */
888 i2c_master_receive_ack_set(hi2c->i2cx, I2C_MASTER_ACK_CURRENT);
889
890 /* enable ack */
891 i2c_ack_enable(hi2c->i2cx, TRUE);
892
893 /* enable interrupt */
894 i2c_interrupt_enable(hi2c->i2cx, I2C_EVT_INT | I2C_DATA_INT | I2C_ERR_INT, TRUE);
895
896 return I2C_OK;
897}
898
908 i2c_status_type i2c_master_receive_int(i2c_handle_type* hi2c, uint16_t address, uint8_t* pdata, uint16_t size, uint32_t timeout)
909{
910 /* initialization parameters */
911 hi2c->mode = I2C_INT_MA_RX;
912 hi2c->status = I2C_START;
913
914 hi2c->pbuff = pdata;
915 hi2c->pcount = size;
916
917 hi2c->timeout = timeout;
918 hi2c->error_code = I2C_OK;
919
920 /* wait for the busy flag to be reset */
921 if(i2c_wait_flag(hi2c, I2C_BUSYF_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
922 {
923 return I2C_ERR_STEP_1;
924 }
925
926 /* ack acts on the current byte */
927 i2c_master_receive_ack_set(hi2c->i2cx, I2C_MASTER_ACK_CURRENT);
928
929 /* enable ack */
930 i2c_ack_enable(hi2c->i2cx, TRUE);
931
932 /* send slave address */
933 if(i2c_master_read_addr(hi2c, address, timeout) != I2C_OK)
934 {
935 /* generate stop condtion */
936 i2c_stop_generate(hi2c->i2cx);
937
938 return I2C_ERR_STEP_2;
939 }
940
941 if(hi2c->pcount == 1)
942 {
943 /* disable ack */
944 i2c_ack_enable(hi2c->i2cx, FALSE);
945
946 /* clear addr flag */
947 i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
948
949 /* generate stop condtion */
950 i2c_stop_generate(hi2c->i2cx);
951 }
952 else if(hi2c->pcount == 2)
953 {
954 /* ack acts on the next byte */
955 i2c_master_receive_ack_set(hi2c->i2cx, I2C_MASTER_ACK_NEXT);
956
957 /* clear addr flag */
958 i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
959
960 /* disable ack */
961 i2c_ack_enable(hi2c->i2cx, FALSE);
962 }
963 else
964 {
965 /* enable ack */
966 i2c_ack_enable(hi2c->i2cx, TRUE);
967
968 /* clear addr flag */
969 i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
970 }
971
972 /* enable interrupt */
973 i2c_interrupt_enable(hi2c->i2cx, I2C_EVT_INT | I2C_DATA_INT | I2C_ERR_INT, TRUE);
974
975 return I2C_OK;
976}
977
986 i2c_status_type i2c_slave_transmit_int(i2c_handle_type* hi2c, uint8_t* pdata, uint16_t size, uint32_t timeout)
987{
988 /* initialization parameters */
989 hi2c->mode = I2C_INT_SLA_TX;
990 hi2c->status = I2C_START;
991
992 hi2c->pbuff = pdata;
993 hi2c->pcount = size;
994
995 hi2c->timeout = timeout;
996 hi2c->error_code = I2C_OK;
997
998 /* wait for the busy flag to be reset */
999 if(i2c_wait_flag(hi2c, I2C_BUSYF_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
1000 {
1001 return I2C_ERR_STEP_1;
1002 }
1003
1004 /* ack acts on the current byte */
1005 i2c_master_receive_ack_set(hi2c->i2cx, I2C_MASTER_ACK_CURRENT);
1006
1007 /* enable ack */
1008 i2c_ack_enable(hi2c->i2cx, TRUE);
1009
1010 /* enable interrupt */
1011 i2c_interrupt_enable(hi2c->i2cx, I2C_EVT_INT | I2C_DATA_INT | I2C_ERR_INT, TRUE);
1012
1013 return I2C_OK;
1014}
1015
1025 i2c_status_type i2c_master_transmit_dma(i2c_handle_type* hi2c, uint16_t address, uint8_t* pdata, uint16_t size, uint32_t timeout)
1026{
1027 /* initialization parameters */
1028 hi2c->mode = I2C_DMA_MA_TX;
1029 hi2c->status = I2C_START;
1030
1031 hi2c->pbuff = pdata;
1032 hi2c->pcount = size;
1033
1034 hi2c->timeout = timeout;
1035 hi2c->error_code = I2C_OK;
1036
1037 /* wait for the busy flag to be reset */
1038 if(i2c_wait_flag(hi2c, I2C_BUSYF_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
1039 {
1040 return I2C_ERR_STEP_1;
1041 }
1042
1043 /* ack acts on the current byte */
1044 i2c_master_receive_ack_set(hi2c->i2cx, I2C_MASTER_ACK_CURRENT);
1045
1046 /* disable dma request */
1047 i2c_dma_enable(hi2c->i2cx, FALSE);
1048
1049 /* configure the dma channel */
1050 i2c_dma_config(hi2c, hi2c->dma_tx_channel, pdata, size);
1051
1052 /* send slave address */
1053 if(i2c_master_write_addr(hi2c, address, timeout) != I2C_OK)
1054 {
1055 /* generate stop condtion */
1056 i2c_stop_generate(hi2c->i2cx);
1057
1058 return I2C_ERR_STEP_2;
1059 }
1060
1061 /* clear addr flag */
1062 i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
1063
1064 /* enable dma request */
1065 i2c_dma_enable(hi2c->i2cx, TRUE);
1066
1067 return I2C_OK;
1068}
1069
1078 i2c_status_type i2c_slave_receive_dma(i2c_handle_type* hi2c, uint8_t* pdata, uint16_t size, uint32_t timeout)
1079{
1080 /* initialization parameters */
1081 hi2c->mode = I2C_DMA_SLA_RX;
1082 hi2c->status = I2C_START;
1083
1084 hi2c->pbuff = pdata;
1085 hi2c->pcount = size;
1086
1087 hi2c->timeout = timeout;
1088 hi2c->error_code = I2C_OK;
1089
1090 /* wait for the busy flag to be reset */
1091 if(i2c_wait_flag(hi2c, I2C_BUSYF_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
1092 {
1093 return I2C_ERR_STEP_1;
1094 }
1095
1096 /* ack acts on the current byte */
1097 i2c_master_receive_ack_set(hi2c->i2cx, I2C_MASTER_ACK_CURRENT);
1098
1099 /* enable ack */
1100 i2c_ack_enable(hi2c->i2cx, TRUE);
1101
1102 /* disable dma request */
1103 i2c_dma_enable(hi2c->i2cx, FALSE);
1104
1105 /* configure the dma channel */
1106 i2c_dma_config(hi2c, hi2c->dma_rx_channel, pdata, size);
1107
1108 /* enable dma request */
1109 i2c_dma_enable(hi2c->i2cx, TRUE);
1110
1111 /* enable address interrupt */
1112 i2c_interrupt_enable(hi2c->i2cx, I2C_EVT_INT, TRUE);
1113
1114 return I2C_OK;
1115}
1116
1126 i2c_status_type i2c_master_receive_dma(i2c_handle_type* hi2c, uint16_t address, uint8_t* pdata, uint16_t size, uint32_t timeout)
1127{
1128 /* initialization parameters */
1129 hi2c->mode = I2C_DMA_MA_RX;
1130 hi2c->status = I2C_START;
1131
1132 hi2c->pbuff = pdata;
1133 hi2c->pcount = size;
1134
1135 hi2c->timeout = timeout;
1136 hi2c->error_code = I2C_OK;
1137
1138 /* wait for the busy flag to be reset */
1139 if(i2c_wait_flag(hi2c, I2C_BUSYF_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
1140 {
1141 return I2C_ERR_STEP_1;
1142 }
1143
1144 /* ack acts on the current byte */
1145 i2c_master_receive_ack_set(hi2c->i2cx, I2C_MASTER_ACK_CURRENT);
1146
1147 /* enable ack */
1148 i2c_ack_enable(hi2c->i2cx, TRUE);
1149
1150 /* disable dma request */
1151 i2c_dma_enable(hi2c->i2cx, FALSE);
1152
1153 /* configure the dma channel */
1154 i2c_dma_config(hi2c, hi2c->dma_rx_channel, pdata, size);
1155
1156 /* send slave address */
1157 if(i2c_master_read_addr(hi2c, address, timeout) != I2C_OK)
1158 {
1159 /* generate stop condtion */
1160 i2c_stop_generate(hi2c->i2cx);
1161
1162 return I2C_ERR_STEP_2;
1163 }
1164
1165 if(size == 1)
1166 {
1167 /* clear addr flag */
1168 i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
1169
1170 /* disable ack */
1171 i2c_ack_enable(hi2c->i2cx, FALSE);
1172
1173 /* generate stop condtion */
1174 i2c_stop_generate(hi2c->i2cx);
1175
1176 /* enable dma request */
1177 i2c_dma_enable(hi2c->i2cx, TRUE);
1178 }
1179 else
1180 {
1181 /* enable dma end transfer */
1182 i2c_dma_end_transfer_set(hi2c->i2cx, TRUE);
1183
1184 /* enable dma request */
1185 i2c_dma_enable(hi2c->i2cx, TRUE);
1186
1187 /* clear addr flag */
1188 i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
1189 }
1190
1191 return I2C_OK;
1192}
1193
1202 i2c_status_type i2c_slave_transmit_dma(i2c_handle_type* hi2c, uint8_t* pdata, uint16_t size, uint32_t timeout)
1203{
1204 /* initialization parameters */
1205 hi2c->mode = I2C_DMA_SLA_TX;
1206 hi2c->status = I2C_START;
1207
1208 hi2c->pbuff = pdata;
1209 hi2c->pcount = size;
1210
1211 hi2c->timeout = timeout;
1212 hi2c->error_code = I2C_OK;
1213
1214 /* wait for the busy flag to be reset */
1215 if(i2c_wait_flag(hi2c, I2C_BUSYF_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
1216 {
1217 return I2C_ERR_STEP_1;
1218 }
1219
1220 /* ack acts on the current byte */
1221 i2c_master_receive_ack_set(hi2c->i2cx, I2C_MASTER_ACK_CURRENT);
1222
1223 /* enable ack */
1224 i2c_ack_enable(hi2c->i2cx, TRUE);
1225
1226 /* disable dma request */
1227 i2c_dma_enable(hi2c->i2cx, FALSE);
1228
1229 /* configure the dma channel */
1230 i2c_dma_config(hi2c, hi2c->dma_tx_channel, pdata, size);
1231
1232 /* enable dma request */
1233 i2c_dma_enable(hi2c->i2cx, TRUE);
1234
1235 /* enable address interrupt */
1236 i2c_interrupt_enable(hi2c->i2cx, I2C_EVT_INT, TRUE);
1237
1238 return I2C_OK;
1239}
1240
1253 i2c_status_type i2c_memory_address_send(i2c_handle_type* hi2c, i2c_mem_address_width_type mem_address_width, uint16_t mem_address, int32_t timeout)
1254{
1255 i2c_status_type err_code;
1256
1257 if(mem_address_width == I2C_MEM_ADDR_WIDIH_8)
1258 {
1259 /* send memory address */
1260 i2c_data_send(hi2c->i2cx, mem_address & 0xFF);
1261 }
1262 else
1263 {
1264 /* send memory address */
1265 i2c_data_send(hi2c->i2cx, (mem_address >> 8) & 0xFF);
1266
1267 /* wait for the tdbe flag to be set */
1268 err_code = i2c_wait_flag(hi2c, I2C_TDBE_FLAG, I2C_EVENT_CHECK_ACKFAIL, timeout);
1269
1270 if(err_code != I2C_OK)
1271 {
1272 /* generate stop condtion */
1273 i2c_stop_generate(hi2c->i2cx);
1274
1275 return err_code;
1276 }
1277
1278 /* send memory address */
1279 i2c_data_send(hi2c->i2cx, mem_address & 0xFF);
1280 }
1281
1282 return I2C_OK;
1283}
1284
1299 i2c_status_type i2c_memory_write(i2c_handle_type* hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t* pdata, uint16_t size, uint32_t timeout)
1300{
1301 /* initialization parameters */
1302 hi2c->pbuff = pdata;
1303 hi2c->pcount = size;
1304
1305 hi2c->error_code = I2C_OK;
1306
1307 /* wait for the busy flag to be reset */
1308 if(i2c_wait_flag(hi2c, I2C_BUSYF_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
1309 {
1310 return I2C_ERR_STEP_1;
1311 }
1312
1313 /* ack acts on the current byte */
1314 i2c_master_receive_ack_set(hi2c->i2cx, I2C_MASTER_ACK_CURRENT);
1315
1316 /* send slave address */
1317 if(i2c_master_write_addr(hi2c, address, timeout) != I2C_OK)
1318 {
1319 /* generate stop condtion */
1320 i2c_stop_generate(hi2c->i2cx);
1321
1322 return I2C_ERR_STEP_2;
1323 }
1324
1325 /* clear addr flag */
1326 i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
1327
1328 /* wait for the tdbe flag to be set */
1329 if(i2c_wait_flag(hi2c, I2C_TDBE_FLAG, I2C_EVENT_CHECK_ACKFAIL, timeout) != I2C_OK)
1330 {
1331 /* generate stop condtion */
1332 i2c_stop_generate(hi2c->i2cx);
1333
1334 return I2C_ERR_STEP_3;
1335 }
1336
1337 /* send memory address */
1338 if(i2c_memory_address_send(hi2c, mem_address_width, mem_address, timeout) != I2C_OK)
1339 {
1340 return I2C_ERR_STEP_4;
1341 }
1342
1343 while(size > 0)
1344 {
1345 /* wait for the tdbe flag to be set */
1346 if(i2c_wait_flag(hi2c, I2C_TDBE_FLAG, I2C_EVENT_CHECK_ACKFAIL, timeout) != I2C_OK)
1347 {
1348 /* generate stop condtion */
1349 i2c_stop_generate(hi2c->i2cx);
1350
1351 return I2C_ERR_STEP_5;
1352 }
1353
1354 /* write data */
1355 i2c_data_send(hi2c->i2cx, (*pdata++));
1356 size--;
1357 }
1358
1359 /* wait for the tdc flag to be set */
1360 if(i2c_wait_flag(hi2c, I2C_TDC_FLAG, I2C_EVENT_CHECK_ACKFAIL, timeout) != I2C_OK)
1361 {
1362 /* generate stop condtion */
1363 i2c_stop_generate(hi2c->i2cx);
1364
1365 return I2C_ERR_STEP_6;
1366 }
1367
1368 /* generate stop condtion */
1369 i2c_stop_generate(hi2c->i2cx);
1370
1371 return I2C_OK;
1372}
1373
1388 i2c_status_type i2c_memory_read(i2c_handle_type* hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t* pdata, uint16_t size, uint32_t timeout)
1389{
1390 /* initialization parameters */
1391 hi2c->pbuff = pdata;
1392 hi2c->pcount = size;
1393
1394 hi2c->error_code = I2C_OK;
1395
1396 /* wait for the busy flag to be reset */
1397 if(i2c_wait_flag(hi2c, I2C_BUSYF_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
1398 {
1399 return I2C_ERR_STEP_1;
1400 }
1401
1402 /* ack acts on the current byte */
1403 i2c_master_receive_ack_set(hi2c->i2cx, I2C_MASTER_ACK_CURRENT);
1404
1405 /* enable ack */
1406 i2c_ack_enable(hi2c->i2cx, TRUE);
1407
1408 /* send slave address */
1409 if(i2c_master_write_addr(hi2c, address, timeout) != I2C_OK)
1410 {
1411 /* generate stop condtion */
1412 i2c_stop_generate(hi2c->i2cx);
1413
1414 return I2C_ERR_STEP_2;
1415 }
1416
1417 /* clear addr flag */
1418 i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
1419
1420 /* wait for the tdbe flag to be set */
1421 if(i2c_wait_flag(hi2c, I2C_TDBE_FLAG, I2C_EVENT_CHECK_ACKFAIL, timeout) != I2C_OK)
1422 {
1423 /* generate stop condtion */
1424 i2c_stop_generate(hi2c->i2cx);
1425
1426 return I2C_ERR_STEP_3;
1427 }
1428
1429 /* send memory address */
1430 if(i2c_memory_address_send(hi2c, mem_address_width, mem_address, timeout) != I2C_OK)
1431 {
1432 return I2C_ERR_STEP_4;
1433 }
1434
1435 /* wait for the tdbe flag to be set */
1436 if(i2c_wait_flag(hi2c, I2C_TDBE_FLAG, I2C_EVENT_CHECK_ACKFAIL, timeout) != I2C_OK)
1437 {
1438 /* generate stop condtion */
1439 i2c_stop_generate(hi2c->i2cx);
1440
1441 return I2C_ERR_STEP_5;
1442 }
1443
1444 /* send slave address */
1445 if(i2c_master_read_addr(hi2c, address, timeout) != I2C_OK)
1446 {
1447 /* generate stop condtion */
1448 i2c_stop_generate(hi2c->i2cx);
1449
1450 return I2C_ERR_STEP_6;
1451 }
1452
1453 if(size == 1)
1454 {
1455 /* disable ack */
1456 i2c_ack_enable(hi2c->i2cx, FALSE);
1457
1458 /* clear addr flag */
1459 i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
1460
1461 /* generate stop condtion */
1462 i2c_stop_generate(hi2c->i2cx);
1463 }
1464 else if(size == 2)
1465 {
1466 /* ack acts on the next byte */
1467 i2c_master_receive_ack_set(hi2c->i2cx, I2C_MASTER_ACK_NEXT);
1468
1469 /* clear addr flag */
1470 i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
1471
1472 /* disable ack */
1473 i2c_ack_enable(hi2c->i2cx, FALSE);
1474 }
1475 else
1476 {
1477 /* enable ack */
1478 i2c_ack_enable(hi2c->i2cx, TRUE);
1479
1480 /* clear addr flag */
1481 i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
1482 }
1483
1484 while(size > 0)
1485 {
1486 if(size <= 3)
1487 {
1488 /* 1 byte */
1489 if(size == 1)
1490 {
1491 /* wait for the rdbf flag to be set */
1492 if(i2c_wait_flag(hi2c, I2C_RDBF_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
1493 {
1494 /* generate stop condtion */
1495 i2c_stop_generate(hi2c->i2cx);
1496
1497 return I2C_ERR_STEP_7;
1498 }
1499
1500 /* read data */
1501 (*pdata++) = i2c_data_receive(hi2c->i2cx);
1502 size--;
1503 }
1504 /* 2 bytes */
1505 else if(size == 2)
1506 {
1507 /* wait for the tdc flag to be set */
1508 if(i2c_wait_flag(hi2c, I2C_TDC_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
1509 {
1510 /* generate stop condtion */
1511 i2c_stop_generate(hi2c->i2cx);
1512
1513 return I2C_ERR_STEP_8;
1514 }
1515
1516 /* generate stop condtion */
1517 i2c_stop_generate(hi2c->i2cx);
1518
1519 /* read data */
1520 (*pdata++) = i2c_data_receive(hi2c->i2cx);
1521 size--;
1522
1523 /* read data */
1524 (*pdata++) = i2c_data_receive(hi2c->i2cx);
1525 size--;
1526 }
1527 /* 3 last bytes */
1528 else
1529 {
1530 /* wait for the tdc flag to be set */
1531 if(i2c_wait_flag(hi2c, I2C_TDC_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
1532 {
1533 /* generate stop condtion */
1534 i2c_stop_generate(hi2c->i2cx);
1535
1536 return I2C_ERR_STEP_9;
1537 }
1538
1539 /* disable ack */
1540 i2c_ack_enable(hi2c->i2cx, FALSE);
1541
1542 /* read data */
1543 (*pdata++) = i2c_data_receive(hi2c->i2cx);
1544 size--;
1545
1546 /* wait for the tdc flag to be set */
1547 if(i2c_wait_flag(hi2c, I2C_TDC_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
1548 {
1549 /* generate stop condtion */
1550 i2c_stop_generate(hi2c->i2cx);
1551
1552 return I2C_ERR_STEP_10;
1553 }
1554
1555 /* generate stop condtion */
1556 i2c_stop_generate(hi2c->i2cx);
1557
1558 /* read data */
1559 (*pdata++) = i2c_data_receive(hi2c->i2cx);
1560 size--;
1561
1562 /* read data */
1563 (*pdata++) = i2c_data_receive(hi2c->i2cx);
1564 size--;
1565 }
1566 }
1567 else
1568 {
1569 /* wait for the rdbf flag to be set */
1570 if(i2c_wait_flag(hi2c, I2C_RDBF_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
1571 {
1572 /* generate stop condtion */
1573 i2c_stop_generate(hi2c->i2cx);
1574
1575 return I2C_ERR_STEP_11;
1576 }
1577
1578 /* read data */
1579 (*pdata++) = i2c_data_receive(hi2c->i2cx);
1580 size--;
1581 }
1582 }
1583
1584 return I2C_OK;
1585}
1586
1601 i2c_status_type i2c_memory_write_int(i2c_handle_type* hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t* pdata, uint16_t size, uint32_t timeout)
1602{
1603 /* initialization parameters */
1604 hi2c->mode = I2C_INT_MA_TX;
1605 hi2c->status = I2C_START;
1606
1607 hi2c->pbuff = pdata;
1608 hi2c->pcount = size;
1609
1610 hi2c->timeout = timeout;
1611 hi2c->error_code = I2C_OK;
1612
1613 /* wait for the busy flag to be reset */
1614 if(i2c_wait_flag(hi2c, I2C_BUSYF_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
1615 {
1616 return I2C_ERR_STEP_1;
1617 }
1618
1619 /* ack acts on the current byte */
1620 i2c_master_receive_ack_set(hi2c->i2cx, I2C_MASTER_ACK_CURRENT);
1621
1622 /* send slave address */
1623 if(i2c_master_write_addr(hi2c, address, timeout) != I2C_OK)
1624 {
1625 /* generate stop condtion */
1626 i2c_stop_generate(hi2c->i2cx);
1627
1628 return I2C_ERR_STEP_2;
1629 }
1630
1631 /* clear addr flag */
1632 i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
1633
1634 /* wait for the tdbe flag to be set */
1635 if(i2c_wait_flag(hi2c, I2C_TDBE_FLAG, I2C_EVENT_CHECK_ACKFAIL, timeout) != I2C_OK)
1636 {
1637 /* generate stop condtion */
1638 i2c_stop_generate(hi2c->i2cx);
1639
1640 return I2C_ERR_STEP_3;
1641 }
1642
1643 /* send memory address */
1644 if(i2c_memory_address_send(hi2c, mem_address_width, mem_address, timeout) != I2C_OK)
1645 {
1646 return I2C_ERR_STEP_4;
1647 }
1648
1649 /* wait for the tdbe flag to be set */
1650 if(i2c_wait_flag(hi2c, I2C_TDBE_FLAG, I2C_EVENT_CHECK_ACKFAIL, timeout) != I2C_OK)
1651 {
1652 /* generate stop condtion */
1653 i2c_stop_generate(hi2c->i2cx);
1654
1655 return I2C_ERR_STEP_5;
1656 }
1657
1658 /* enable interrupt */
1659 i2c_interrupt_enable(hi2c->i2cx, I2C_EVT_INT | I2C_DATA_INT | I2C_ERR_INT, TRUE);
1660
1661 return I2C_OK;
1662}
1663
1678 i2c_status_type i2c_memory_read_int(i2c_handle_type* hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t* pdata, uint16_t size, uint32_t timeout)
1679{
1680 /* initialization parameters */
1681 hi2c->mode = I2C_INT_MA_RX;
1682 hi2c->status = I2C_START;
1683
1684 hi2c->pbuff = pdata;
1685 hi2c->pcount = size;
1686
1687 hi2c->timeout = timeout;
1688 hi2c->error_code = I2C_OK;
1689
1690 /* wait for the busy flag to be reset */
1691 if(i2c_wait_flag(hi2c, I2C_BUSYF_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
1692 {
1693 return I2C_ERR_STEP_1;
1694 }
1695
1696 /* ack acts on the current byte */
1697 i2c_master_receive_ack_set(hi2c->i2cx, I2C_MASTER_ACK_CURRENT);
1698
1699 /* send slave address */
1700 if(i2c_master_write_addr(hi2c, address, timeout) != I2C_OK)
1701 {
1702 /* generate stop condtion */
1703 i2c_stop_generate(hi2c->i2cx);
1704
1705 return I2C_ERR_STEP_2;
1706 }
1707
1708 /* clear addr flag */
1709 i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
1710
1711 /* wait for the tdbe flag to be set */
1712 if(i2c_wait_flag(hi2c, I2C_TDBE_FLAG, I2C_EVENT_CHECK_ACKFAIL, timeout) != I2C_OK)
1713 {
1714 /* generate stop condtion */
1715 i2c_stop_generate(hi2c->i2cx);
1716
1717 return I2C_ERR_STEP_3;
1718 }
1719
1720 /* send memory address */
1721 if(i2c_memory_address_send(hi2c, mem_address_width, mem_address, timeout) != I2C_OK)
1722 {
1723 return I2C_ERR_STEP_4;
1724 }
1725
1726 /* wait for the tdbe flag to be set */
1727 if(i2c_wait_flag(hi2c, I2C_TDBE_FLAG, I2C_EVENT_CHECK_ACKFAIL, timeout) != I2C_OK)
1728 {
1729 /* generate stop condtion */
1730 i2c_stop_generate(hi2c->i2cx);
1731
1732 return I2C_ERR_STEP_5;
1733 }
1734
1735 /* send slave address */
1736 if(i2c_master_read_addr(hi2c, address, timeout) != I2C_OK)
1737 {
1738 /* generate stop condtion */
1739 i2c_stop_generate(hi2c->i2cx);
1740
1741 return I2C_ERR_STEP_6;
1742 }
1743
1744 if(hi2c->pcount == 1)
1745 {
1746 /* disable ack */
1747 i2c_ack_enable(hi2c->i2cx, FALSE);
1748
1749 /* clear addr flag */
1750 i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
1751
1752 /* generate stop condtion */
1753 i2c_stop_generate(hi2c->i2cx);
1754 }
1755 else if(hi2c->pcount == 2)
1756 {
1757 /* ack acts on the next byte */
1758 i2c_master_receive_ack_set(hi2c->i2cx, I2C_MASTER_ACK_NEXT);
1759
1760 /* clear addr flag */
1761 i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
1762
1763 /* disable ack */
1764 i2c_ack_enable(hi2c->i2cx, FALSE);
1765 }
1766 else
1767 {
1768 /* enable ack */
1769 i2c_ack_enable(hi2c->i2cx, TRUE);
1770
1771 /* clear addr flag */
1772 i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
1773 }
1774
1775 /* enable interrupt */
1776 i2c_interrupt_enable(hi2c->i2cx, I2C_EVT_INT | I2C_DATA_INT | I2C_ERR_INT, TRUE);
1777
1778 return I2C_OK;
1779}
1780
1795 i2c_status_type i2c_memory_write_dma(i2c_handle_type* hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t* pdata, uint16_t size, uint32_t timeout)
1796{
1797 /* initialization parameters */
1798 hi2c->mode = I2C_DMA_MA_TX;
1799 hi2c->status = I2C_START;
1800
1801 hi2c->pbuff = pdata;
1802 hi2c->pcount = size;
1803
1804 hi2c->timeout = timeout;
1805 hi2c->error_code = I2C_OK;
1806
1807 /* wait for the busy flag to be reset */
1808 if(i2c_wait_flag(hi2c, I2C_BUSYF_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
1809 {
1810 return I2C_ERR_STEP_1;
1811 }
1812
1813 /* ack acts on the current byte */
1814 i2c_master_receive_ack_set(hi2c->i2cx, I2C_MASTER_ACK_CURRENT);
1815
1816 /* disable dma request */
1817 i2c_dma_enable(hi2c->i2cx, FALSE);
1818
1819 /* configure the dma channel */
1820 i2c_dma_config(hi2c, hi2c->dma_tx_channel, pdata, size);
1821
1822 /* send slave address */
1823 if(i2c_master_write_addr(hi2c, address, timeout) != I2C_OK)
1824 {
1825 /* generate stop condtion */
1826 i2c_stop_generate(hi2c->i2cx);
1827
1828 return I2C_ERR_STEP_2;
1829 }
1830
1831 /* clear addr flag */
1832 i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
1833
1834 /* wait for the tdbe flag to be set */
1835 if(i2c_wait_flag(hi2c, I2C_TDBE_FLAG, I2C_EVENT_CHECK_ACKFAIL, timeout) != I2C_OK)
1836 {
1837 /* generate stop condtion */
1838 i2c_stop_generate(hi2c->i2cx);
1839
1840 return I2C_ERR_STEP_3;
1841 }
1842
1843 /* send memory address */
1844 if(i2c_memory_address_send(hi2c, mem_address_width, mem_address, timeout) != I2C_OK)
1845 {
1846 return I2C_ERR_STEP_4;
1847 }
1848
1849 /* wait for the tdbe flag to be set */
1850 if(i2c_wait_flag(hi2c, I2C_TDBE_FLAG, I2C_EVENT_CHECK_ACKFAIL, timeout) != I2C_OK)
1851 {
1852 /* generate stop condtion */
1853 i2c_stop_generate(hi2c->i2cx);
1854
1855 return I2C_ERR_STEP_5;
1856 }
1857
1858 /* enable dma request */
1859 i2c_dma_enable(hi2c->i2cx, TRUE);
1860
1861 return I2C_OK;
1862}
1863
1878 i2c_status_type i2c_memory_read_dma(i2c_handle_type* hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t* pdata, uint16_t size, uint32_t timeout)
1879{
1880 /* initialization parameters */
1881 hi2c->mode = I2C_DMA_MA_RX;
1882 hi2c->status = I2C_START;
1883
1884 hi2c->pbuff = pdata;
1885 hi2c->pcount = size;
1886
1887 hi2c->timeout = timeout;
1888 hi2c->error_code = I2C_OK;
1889
1890 /* wait for the busy flag to be reset */
1891 if(i2c_wait_flag(hi2c, I2C_BUSYF_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
1892 {
1893 return I2C_ERR_STEP_1;
1894 }
1895
1896 /* ack acts on the current byte */
1897 i2c_master_receive_ack_set(hi2c->i2cx, I2C_MASTER_ACK_CURRENT);
1898
1899 /* enable ack */
1900 i2c_ack_enable(hi2c->i2cx, TRUE);
1901
1902 /* disable dma request */
1903 i2c_dma_enable(hi2c->i2cx, FALSE);
1904
1905 /* configure the dma channel */
1906 i2c_dma_config(hi2c, hi2c->dma_rx_channel, pdata, size);
1907
1908 /* send slave address */
1909 if(i2c_master_write_addr(hi2c, address, timeout) != I2C_OK)
1910 {
1911 /* generate stop condtion */
1912 i2c_stop_generate(hi2c->i2cx);
1913
1914 return I2C_ERR_STEP_2;
1915 }
1916
1917 /* clear addr flag */
1918 i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
1919
1920 /* wait for the tdbe flag to be set */
1921 if(i2c_wait_flag(hi2c, I2C_TDBE_FLAG, I2C_EVENT_CHECK_ACKFAIL, timeout) != I2C_OK)
1922 {
1923 /* generate stop condtion */
1924 i2c_stop_generate(hi2c->i2cx);
1925
1926 return I2C_ERR_STEP_3;
1927 }
1928
1929 /* send memory address */
1930 if(i2c_memory_address_send(hi2c, mem_address_width, mem_address, timeout) != I2C_OK)
1931 {
1932 return I2C_ERR_STEP_4;
1933 }
1934
1935 /* wait for the tdbe flag to be set */
1936 if(i2c_wait_flag(hi2c, I2C_TDBE_FLAG, I2C_EVENT_CHECK_ACKFAIL, timeout) != I2C_OK)
1937 {
1938 /* generate stop condtion */
1939 i2c_stop_generate(hi2c->i2cx);
1940
1941 return I2C_ERR_STEP_5;
1942 }
1943
1944 /* send slave address */
1945 if(i2c_master_read_addr(hi2c, address, timeout) != I2C_OK)
1946 {
1947 /* generate stop condtion */
1948 i2c_stop_generate(hi2c->i2cx);
1949
1950 return I2C_ERR_STEP_6;
1951 }
1952
1953 if(size == 1)
1954 {
1955 /* clear addr flag */
1956 i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
1957
1958 /* disable ack */
1959 i2c_ack_enable(hi2c->i2cx, FALSE);
1960
1961 /* generate stop condtion */
1962 i2c_stop_generate(hi2c->i2cx);
1963
1964 /* enable dma request */
1965 i2c_dma_enable(hi2c->i2cx, TRUE);
1966 }
1967 else
1968 {
1969 /* enable dma end transfer */
1970 i2c_dma_end_transfer_set(hi2c->i2cx, TRUE);
1971
1972 /* enable dma request */
1973 i2c_dma_enable(hi2c->i2cx, TRUE);
1974
1975 /* clear addr flag */
1976 i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
1977 }
1978
1979 return I2C_OK;
1980}
1981
1987void i2c_master_tx_isr_int(i2c_handle_type* hi2c)
1988{
1989 /* step 1: transfer data */
1990 if(i2c_flag_get(hi2c->i2cx, I2C_TDBE_FLAG) != RESET)
1991 {
1992 if(hi2c->pcount == 0)
1993 {
1994 /* transfer complete */
1995 hi2c->status = I2C_END;
1996
1997 /* disable interrupt */
1998 i2c_interrupt_enable(hi2c->i2cx, I2C_EVT_INT | I2C_DATA_INT | I2C_ERR_INT, FALSE);
1999
2000 /* generate stop condtion */
2001 i2c_stop_generate(hi2c->i2cx);
2002 }
2003 else
2004 {
2005 /* write data */
2006 i2c_data_send(hi2c->i2cx, *hi2c->pbuff++);
2007 hi2c->pcount--;
2008 }
2009 }
2010}
2011
2017void i2c_master_rx_isr_int(i2c_handle_type* hi2c)
2018{
2019 if(i2c_flag_get(hi2c->i2cx, I2C_TDC_FLAG) != RESET)
2020 {
2021 if(hi2c->pcount == 3)
2022 {
2023 /* disable ack */
2024 i2c_ack_enable(hi2c->i2cx, FALSE);
2025
2026 /* read data */
2027 (*hi2c->pbuff++) = i2c_data_receive(hi2c->i2cx);
2028 hi2c->pcount--;
2029 }
2030 else if(hi2c->pcount == 2)
2031 {
2032 /* generate stop condtion */
2033 i2c_stop_generate(hi2c->i2cx);
2034
2035 /* read data */
2036 (*hi2c->pbuff++) = i2c_data_receive(hi2c->i2cx);
2037 hi2c->pcount--;
2038
2039 /* read data */
2040 (*hi2c->pbuff++) = i2c_data_receive(hi2c->i2cx);
2041 hi2c->pcount--;
2042
2043 /* transfer complete */
2044 hi2c->status = I2C_END;
2045
2046 /* disable interrupt */
2047 i2c_interrupt_enable(hi2c->i2cx, I2C_EVT_INT | I2C_DATA_INT | I2C_ERR_INT, FALSE);
2048 }
2049 else
2050 {
2051 /* read data */
2052 (*hi2c->pbuff++) = i2c_data_receive(hi2c->i2cx);
2053 hi2c->pcount--;
2054 }
2055 }
2056
2057 else if(i2c_flag_get(hi2c->i2cx, I2C_RDBF_FLAG) != RESET)
2058 {
2059 if(hi2c->pcount > 3)
2060 {
2061 /* read data */
2062 (*hi2c->pbuff++) = i2c_data_receive(hi2c->i2cx);
2063 hi2c->pcount--;
2064 }
2065 else if((hi2c->pcount == 3) || (hi2c->pcount == 2))
2066 {
2067 /* disable rdbf interrupt */
2068 i2c_interrupt_enable(hi2c->i2cx, I2C_DATA_INT, FALSE);
2069 }
2070 else
2071 {
2072 /* read data */
2073 (*hi2c->pbuff++) = i2c_data_receive(hi2c->i2cx);
2074 hi2c->pcount--;
2075
2076 /* transfer complete */
2077 hi2c->status = I2C_END;
2078
2079 /* disable interrupt */
2080 i2c_interrupt_enable(hi2c->i2cx, I2C_EVT_INT | I2C_DATA_INT | I2C_ERR_INT, FALSE);
2081 }
2082 }
2083}
2084
2090void i2c_slave_tx_isr_int(i2c_handle_type* hi2c)
2091{
2092 /* step 1: receive slave address */
2093 if(i2c_flag_get(hi2c->i2cx, I2C_ADDR7F_FLAG) != RESET)
2094 {
2095 /* clear addr flag */
2096 i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
2097 }
2098
2099 /* step 2: transfer data */
2100 else if(i2c_flag_get(hi2c->i2cx, I2C_TDBE_FLAG) != RESET)
2101 {
2102 if(hi2c->pcount)
2103 {
2104 /* send data */
2105 i2c_data_send(hi2c->i2cx, (*hi2c->pbuff++));
2106 hi2c->pcount--;
2107
2108 if(hi2c->pcount == 0)
2109 {
2110 /* disable interrupt */
2111 i2c_interrupt_enable(hi2c->i2cx, I2C_DATA_INT | I2C_EVT_INT | I2C_ERR_INT, FALSE);
2112
2113 /* wait for the ackfail flag to be set */
2114 hi2c->status = i2c_wait_flag(hi2c, I2C_ACKFAIL_FLAG, I2C_EVENT_CHECK_NONE, hi2c->timeout);
2115
2116 /* clear ackfail flag */
2117 i2c_flag_clear(hi2c->i2cx, I2C_ACKFAIL_FLAG);
2118
2119 /* transfer complete */
2120 hi2c->status = I2C_END;
2121 }
2122 }
2123 }
2124}
2125
2131void i2c_slave_rx_isr_int(i2c_handle_type* hi2c)
2132{
2133 /* step 1: receive slave address */
2134 if(i2c_flag_get(hi2c->i2cx, I2C_ADDR7F_FLAG) != RESET)
2135 {
2136 /* clear addr flag */
2137 i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
2138 }
2139
2140 /* step 2: receive data */
2141 else if(i2c_flag_get(hi2c->i2cx, I2C_RDBF_FLAG) != RESET)
2142 {
2143 if(hi2c->pcount)
2144 {
2145 /* read data */
2146 (*hi2c->pbuff++) = i2c_data_receive(hi2c->i2cx);
2147
2148 hi2c->pcount--;
2149 }
2150 }
2151
2152 /* step 3: stop conditon is received, transfer ends */
2153 else if(i2c_flag_get(hi2c->i2cx, I2C_STOPF_FLAG) != RESET)
2154 {
2155 /* clear stop flag */
2156 i2c_flag_clear(hi2c->i2cx, I2C_STOPF_FLAG);
2157
2158 /* transfer complete */
2159 hi2c->status = I2C_END;
2160
2161 /* disable interrupt */
2162 i2c_interrupt_enable(hi2c->i2cx, I2C_EVT_INT | I2C_DATA_INT | I2C_ERR_INT, FALSE);
2163 }
2164}
2165
2171void i2c_master_tx_isr_dma(i2c_handle_type* hi2c)
2172{
2173 /* tdc interrupt */
2174 if(i2c_flag_get(hi2c->i2cx, I2C_TDC_FLAG) != RESET)
2175 {
2176 /* generate stop condtion */
2177 i2c_stop_generate(hi2c->i2cx);
2178
2179 /* disable evt interrupt */
2180 i2c_interrupt_enable(hi2c->i2cx, I2C_EVT_INT, FALSE);
2181
2182 /* transfer complete */
2183 hi2c->status = I2C_END;
2184 }
2185}
2186
2192void i2c_slave_tx_rx_isr_dma(i2c_handle_type* hi2c)
2193{
2194 /* receive slave address */
2195 if(i2c_flag_get(hi2c->i2cx, I2C_ADDR7F_FLAG) != RESET)
2196 {
2197 /* clear addr flag */
2198 i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
2199 }
2200
2201 /* wait for the stop flag to be set, trasnfer end */
2202 if(i2c_flag_get(hi2c->i2cx, I2C_STOPF_FLAG) != RESET)
2203 {
2204 /* clear stop flag */
2205 i2c_flag_clear(hi2c->i2cx, I2C_STOPF_FLAG);
2206
2207 /* disable evt interrupt */
2208 i2c_interrupt_enable(hi2c->i2cx, I2C_EVT_INT, FALSE);
2209
2210 /* disable ack */
2211 i2c_ack_enable(hi2c->i2cx, TRUE);
2212
2213 /* transfer complete */
2214 hi2c->status = I2C_END;
2215 }
2216}
2217
2223void i2c_evt_irq_handler(i2c_handle_type* hi2c)
2224{
2225 switch(hi2c->mode)
2226 {
2227 case I2C_INT_MA_TX:
2228 i2c_master_tx_isr_int(hi2c);
2229 break;
2230 case I2C_INT_MA_RX:
2231 i2c_master_rx_isr_int(hi2c);
2232 break;
2233 case I2C_INT_SLA_TX:
2234 i2c_slave_tx_isr_int(hi2c);
2235 break;
2236 case I2C_INT_SLA_RX:
2237 i2c_slave_rx_isr_int(hi2c);
2238 break;
2239 case I2C_DMA_MA_TX:
2240 i2c_master_tx_isr_dma(hi2c);
2241 break;
2242 case I2C_DMA_SLA_TX:
2243 case I2C_DMA_SLA_RX:
2244 i2c_slave_tx_rx_isr_dma(hi2c);
2245 break;
2246 default:
2247 break;
2248 }
2249}
2250
2256void i2c_dma_tx_irq_handler(i2c_handle_type* hi2c)
2257{
2258 /* transfer complete */
2259 if(dma_flag_get(DMA_GET_TC_FLAG(hi2c->dma_tx_channel)) != RESET)
2260 {
2261 /* disable the transfer complete interrupt */
2262 dma_interrupt_enable(hi2c->dma_tx_channel, DMA_FDT_INT, FALSE);
2263
2264 /* clear the transfer complete flag */
2265 dma_flag_clear(DMA_GET_TC_FLAG(hi2c->dma_tx_channel));
2266
2267 /* disable dma request */
2268 i2c_dma_enable(hi2c->i2cx, FALSE);
2269
2270 hi2c->pcount = 0;
2271
2272 switch(hi2c->mode)
2273 {
2274 case I2C_DMA_MA_TX:
2275 /* enable tdc interrupt, generate stop condition in tdc interrupt */
2276 i2c_interrupt_enable(hi2c->i2cx, I2C_EVT_INT, TRUE);
2277 break;
2278 case I2C_DMA_SLA_TX:
2279 /* enable ackfail interrupt, generate stop condition in ackfail interrupt */
2280 i2c_interrupt_enable(hi2c->i2cx, I2C_ERR_INT, TRUE);
2281 break;
2282 default:
2283 break;
2284 }
2285 }
2286}
2287
2293void i2c_dma_rx_irq_handler(i2c_handle_type* hi2c)
2294{
2295 /* transfer complete */
2296 if(dma_flag_get(DMA_GET_TC_FLAG(hi2c->dma_rx_channel)) != RESET)
2297 {
2298 /* disable the transfer complete interrupt */
2299 dma_interrupt_enable(hi2c->dma_rx_channel, DMA_FDT_INT, FALSE);
2300
2301 /* clear the transfer complete flag */
2302 dma_flag_clear(DMA_GET_TC_FLAG(hi2c->dma_rx_channel));
2303
2304 /* disable dma request */
2305 i2c_dma_enable(hi2c->i2cx, FALSE);
2306
2307 hi2c->pcount = 0;
2308
2309 switch(hi2c->mode)
2310 {
2311 case I2C_DMA_MA_RX:
2312 /* clear ackfail flag */
2313 i2c_flag_clear(hi2c->i2cx, I2C_ACKFAIL_FLAG);
2314
2315 if(hi2c->pcount != 1)
2316 {
2317 /* generate stop condtion */
2318 i2c_stop_generate(hi2c->i2cx);
2319 }
2320
2321 /* transfer complete */
2322 hi2c->status = I2C_END;
2323 break;
2324 case I2C_DMA_SLA_RX:
2325 /* enable stop interrupt, wait for the stop flag to be set */
2326 i2c_interrupt_enable(hi2c->i2cx, I2C_EVT_INT, TRUE);
2327 break;
2328 default:
2329 break;
2330 }
2331 }
2332}
2333
2339void i2c_err_irq_handler(i2c_handle_type* hi2c)
2340{
2341 /* buserr */
2342 if(i2c_flag_get(hi2c->i2cx, I2C_BUSERR_FLAG) != RESET)
2343 {
2344 i2c_flag_clear(hi2c->i2cx, I2C_BUSERR_FLAG);
2345
2346 hi2c->error_code = I2C_ERR_INTERRUPT;
2347 }
2348
2349 /* arlost */
2350 if(i2c_flag_get(hi2c->i2cx, I2C_ARLOST_FLAG) != RESET)
2351 {
2352 i2c_flag_clear(hi2c->i2cx, I2C_ARLOST_FLAG);
2353
2354 hi2c->error_code = I2C_ERR_INTERRUPT;
2355 }
2356
2357 /* ackfail */
2358 if(i2c_flag_get(hi2c->i2cx, I2C_ACKFAIL_FLAG) != RESET)
2359 {
2360 i2c_flag_clear(hi2c->i2cx, I2C_ACKFAIL_FLAG);
2361
2362 switch(hi2c->mode)
2363 {
2364 case I2C_DMA_SLA_TX:
2365 /* disable ack */
2366 i2c_ack_enable(hi2c->i2cx, FALSE);
2367
2368 /* disable evt interrupt */
2369 i2c_interrupt_enable(hi2c->i2cx, I2C_EVT_INT, FALSE);
2370
2371 /* transfer complete */
2372 hi2c->status = I2C_END;
2373 break;
2374 default:
2375 hi2c->error_code = I2C_ERR_INTERRUPT;
2376 break;
2377 }
2378 }
2379
2380 /* ouf */
2381 if(i2c_flag_get(hi2c->i2cx, I2C_OUF_FLAG) != RESET)
2382 {
2383 i2c_flag_clear(hi2c->i2cx, I2C_OUF_FLAG);
2384
2385 hi2c->error_code = I2C_ERR_INTERRUPT;
2386 }
2387
2388 /* pecerr */
2389 if(i2c_flag_get(hi2c->i2cx, I2C_PECERR_FLAG) != RESET)
2390 {
2391 i2c_flag_clear(hi2c->i2cx, I2C_PECERR_FLAG);
2392
2393 hi2c->error_code = I2C_ERR_INTERRUPT;
2394 }
2395
2396 /* tmout */
2397 if(i2c_flag_get(hi2c->i2cx, I2C_TMOUT_FLAG) != RESET)
2398 {
2399 i2c_flag_clear(hi2c->i2cx, I2C_TMOUT_FLAG);
2400
2401 hi2c->error_code = I2C_ERR_INTERRUPT;
2402 }
2403
2404 /* alertf */
2405 if(i2c_flag_get(hi2c->i2cx, I2C_ALERTF_FLAG) != RESET)
2406 {
2407 i2c_flag_clear(hi2c->i2cx, I2C_ALERTF_FLAG);
2408
2409 hi2c->error_code = I2C_ERR_INTERRUPT;
2410 }
2411
2412 /* disable all interrupts */
2413 i2c_interrupt_enable(hi2c->i2cx, I2C_ERR_INT, FALSE);
2414}
2415
i2c_wait_flag
i2c_status_type i2c_wait_flag(i2c_handle_type *hi2c, uint32_t flag, uint32_t event_check, uint32_t timeout)
wait for the flag to be set or reset, only BUSYF flag is waiting to be reset, and other flags are wai...
Definition i2c_application.c:185
i2c_master_rx_isr_int
void i2c_master_rx_isr_int(i2c_handle_type *hi2c)
master receive mode interrupt procession function
Definition i2c_application.c:2017
i2c_memory_read_dma
i2c_status_type i2c_memory_read_dma(i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
read data from memory device through polling mode.
Definition i2c_application.c:1878
i2c_slave_rx_isr_int
void i2c_slave_rx_isr_int(i2c_handle_type *hi2c)
slave receive mode interrupt procession function
Definition i2c_application.c:2131
i2c_wait_end
i2c_status_type i2c_wait_end(i2c_handle_type *hi2c, uint32_t timeout)
wait for the transfer to end.
Definition i2c_application.c:129
i2c_memory_write_dma
i2c_status_type i2c_memory_write_dma(i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
write data to the memory device through dma mode.
Definition i2c_application.c:1795
i2c_slave_tx_rx_isr_dma
void i2c_slave_tx_rx_isr_dma(i2c_handle_type *hi2c)
slave interrupt processing function in dma mode.
Definition i2c_application.c:2192
i2c_evt_irq_handler
void i2c_evt_irq_handler(i2c_handle_type *hi2c)
interrupt procession function.
Definition i2c_application.c:2223
i2c_memory_write_int
i2c_status_type i2c_memory_write_int(i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
write data to the memory device through interrupt mode.
Definition i2c_application.c:1601
i2c_master_tx_isr_int
void i2c_master_tx_isr_int(i2c_handle_type *hi2c)
master transfer mode interrupt procession function
Definition i2c_application.c:1987
i2c_slave_transmit_int
i2c_status_type i2c_slave_transmit_int(i2c_handle_type *hi2c, uint8_t *pdata, uint16_t size, uint32_t timeout)
the slave transmits data through interrupt mode.
Definition i2c_application.c:986
i2c_err_irq_handler
void i2c_err_irq_handler(i2c_handle_type *hi2c)
i2c error interrupt function.
Definition i2c_application.c:2339
i2c_dma_rx_irq_handler
void i2c_dma_rx_irq_handler(i2c_handle_type *hi2c)
dma reveive complete interrupt function.
Definition i2c_application.c:2293
i2c_master_write_addr
i2c_status_type i2c_master_write_addr(i2c_handle_type *hi2c, uint16_t address, uint32_t timeout)
send address in master transmits mode.
Definition i2c_application.c:285
i2c_lowlevel_init
__WEAK void i2c_lowlevel_init(i2c_handle_type *hi2c)
initializes peripherals used by the i2c.
Definition i2c_application.c:101
I2C_START
#define I2C_START
i2c transmission status
Definition i2c_application.c:93
i2c_slave_receive
i2c_status_type i2c_slave_receive(i2c_handle_type *hi2c, uint8_t *pdata, uint16_t size, uint32_t timeout)
the slave receive data through polling mode.
Definition i2c_application.c:489
i2c_slave_transmit_dma
i2c_status_type i2c_slave_transmit_dma(i2c_handle_type *hi2c, uint8_t *pdata, uint16_t size, uint32_t timeout)
the slave transmits data through dma mode.
Definition i2c_application.c:1202
i2c_master_receive_int
i2c_status_type i2c_master_receive_int(i2c_handle_type *hi2c, uint16_t address, uint8_t *pdata, uint16_t size, uint32_t timeout)
the master receive data through interrupt mode.
Definition i2c_application.c:908
i2c_slave_tx_isr_int
void i2c_slave_tx_isr_int(i2c_handle_type *hi2c)
slave transfer mode interrupt procession function
Definition i2c_application.c:2090
i2c_memory_write
i2c_status_type i2c_memory_write(i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
write data to the memory device through polling mode.
Definition i2c_application.c:1299
i2c_master_read_addr
i2c_status_type i2c_master_read_addr(i2c_handle_type *hi2c, uint16_t address, uint32_t timeout)
send address in master receive mode.
Definition i2c_application.c:338
I2C_END
#define I2C_END
Definition i2c_application.c:94
i2c_master_transmit_dma
i2c_status_type i2c_master_transmit_dma(i2c_handle_type *hi2c, uint16_t address, uint8_t *pdata, uint16_t size, uint32_t timeout)
the master transmits data through dma mode.
Definition i2c_application.c:1025
i2c_config
void i2c_config(i2c_handle_type *hi2c)
i2c peripheral initialization.
Definition i2c_application.c:111
i2c_master_tx_isr_dma
void i2c_master_tx_isr_dma(i2c_handle_type *hi2c)
master interrupt processing function in dma mode.
Definition i2c_application.c:2171
i2c_memory_read
i2c_status_type i2c_memory_read(i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
read data from memory device through polling mode.
Definition i2c_application.c:1388
i2c_memory_read_int
i2c_status_type i2c_memory_read_int(i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
read data from memory device through interrupt mode.
Definition i2c_application.c:1678
i2c_memory_address_send
i2c_status_type i2c_memory_address_send(i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t mem_address, int32_t timeout)
send memory address.
Definition i2c_application.c:1253
DMA_GET_TC_FLAG
#define DMA_GET_TC_FLAG(DMA_CHANNEL)
get the dma transfer complete flag through the channel
Definition i2c_application.c:36
i2c_dma_config
void i2c_dma_config(i2c_handle_type *hi2c, dma_channel_type *dma_channelx, uint8_t *pdata, uint16_t size)
dma transfer cofiguration.
Definition i2c_application.c:256
i2c_dma_tx_irq_handler
void i2c_dma_tx_irq_handler(i2c_handle_type *hi2c)
dma transmission complete interrupt function.
Definition i2c_application.c:2256
i2c_slave_receive_dma
i2c_status_type i2c_slave_receive_dma(i2c_handle_type *hi2c, uint8_t *pdata, uint16_t size, uint32_t timeout)
the slave receive data through dma mode.
Definition i2c_application.c:1078
i2c_master_transmit_int
i2c_status_type i2c_master_transmit_int(i2c_handle_type *hi2c, uint16_t address, uint8_t *pdata, uint16_t size, uint32_t timeout)
the master transmits data through interrupt mode.
Definition i2c_application.c:822
i2c_master_receive
i2c_status_type i2c_master_receive(i2c_handle_type *hi2c, uint16_t address, uint8_t *pdata, uint16_t size, uint32_t timeout)
the master receive data through polling mode.
Definition i2c_application.c:564
i2c_master_receive_dma
i2c_status_type i2c_master_receive_dma(i2c_handle_type *hi2c, uint16_t address, uint8_t *pdata, uint16_t size, uint32_t timeout)
the master receive data through dma mode.
Definition i2c_application.c:1126
i2c_slave_receive_int
i2c_status_type i2c_slave_receive_int(i2c_handle_type *hi2c, uint8_t *pdata, uint16_t size, uint32_t timeout)
the slave receive data through interrupt mode.
Definition i2c_application.c:869
i2c_master_transmit
i2c_status_type i2c_master_transmit(i2c_handle_type *hi2c, uint16_t address, uint8_t *pdata, uint16_t size, uint32_t timeout)
the master transmits data through polling mode.
Definition i2c_application.c:421
i2c_slave_transmit
i2c_status_type i2c_slave_transmit(i2c_handle_type *hi2c, uint8_t *pdata, uint16_t size, uint32_t timeout)
the slave transmits data through polling mode.
Definition i2c_application.c:735
dma_channel_enable
void dma_channel_enable(dma_channel_type *dmax_channely, confirm_state new_state)
enable or disable dma channely
Definition at32f413_dma.c:197
dma_interrupt_enable
void dma_interrupt_enable(dma_channel_type *dmax_channely, uint32_t dma_int, confirm_state new_state)
enable or disable dma interrupt
Definition at32f413_dma.c:164
dma_flag_get
flag_status dma_flag_get(uint32_t dmax_flag)
get dma flag
Definition at32f413_dma.c:343
dma_flag_clear
void dma_flag_clear(uint32_t dmax_flag)
clear dma flag
Definition at32f413_dma.c:389
dma_init
void dma_init(dma_channel_type *dmax_channely, dma_init_type *dma_init_struct)
dma init
Definition at32f413_dma.c:442
DMA_DIR_MEMORY_TO_PERIPHERAL
@ DMA_DIR_MEMORY_TO_PERIPHERAL
Definition at32f413_dma.h:217
DMA_DIR_PERIPHERAL_TO_MEMORY
@ DMA_DIR_PERIPHERAL_TO_MEMORY
Definition at32f413_dma.h:216
DMA_FDT_INT
#define DMA_FDT_INT
Definition at32f413_dma.h:51
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
i2c_data_receive
uint8_t i2c_data_receive(i2c_type *i2c_x)
receive a byte through the i2c periph.
Definition at32f413_i2c.c:541
i2c_reset
void i2c_reset(i2c_type *i2c_x)
reset the i2c register
Definition at32f413_i2c.c:50
i2c_ack_enable
void i2c_ack_enable(i2c_type *i2c_x, confirm_state new_state)
enable or disable acknowledge.
Definition at32f413_i2c.c:289
i2c_7bit_address_send
void i2c_7bit_address_send(i2c_type *i2c_x, uint8_t address, i2c_direction_type direction)
transmit the slave address.
Definition at32f413_i2c.c:509
i2c_dma_end_transfer_set
void i2c_dma_end_transfer_set(i2c_type *i2c_x, confirm_state new_state)
enable or disable if the next dma transfer will be the last one.
Definition at32f413_i2c.c:430
i2c_stop_generate
void i2c_stop_generate(i2c_type *i2c_x)
generate stop condition.
Definition at32f413_i2c.c:492
i2c_enable
void i2c_enable(i2c_type *i2c_x, confirm_state new_state)
enable or disable i2c periph
Definition at32f413_i2c.c:247
i2c_flag_get
flag_status i2c_flag_get(i2c_type *i2c_x, uint32_t flag)
get flag status
Definition at32f413_i2c.c:576
i2c_interrupt_enable
void i2c_interrupt_enable(i2c_type *i2c_x, uint16_t source, confirm_state new_state)
enable or disable interrupt
Definition at32f413_i2c.c:461
i2c_flag_clear
void i2c_flag_clear(i2c_type *i2c_x, uint32_t flag)
clear flag status
Definition at32f413_i2c.c:702
i2c_dma_enable
void i2c_dma_enable(i2c_type *i2c_x, confirm_state new_state)
enable or disable dma requests.
Definition at32f413_i2c.c:443
i2c_data_send
void i2c_data_send(i2c_type *i2c_x, uint8_t data)
send a byte through the i2c periph.
Definition at32f413_i2c.c:529
i2c_master_receive_ack_set
void i2c_master_receive_ack_set(i2c_type *i2c_x, i2c_master_ack_type pos)
master receiving mode acknowledge control.
Definition at32f413_i2c.c:305
i2c_start_generate
void i2c_start_generate(i2c_type *i2c_x)
generate start condition.
Definition at32f413_i2c.c:480
I2C_DIRECTION_RECEIVE
@ I2C_DIRECTION_RECEIVE
Definition at32f413_i2c.h:166
I2C_DIRECTION_TRANSMIT
@ I2C_DIRECTION_TRANSMIT
Definition at32f413_i2c.h:165
I2C_MASTER_ACK_CURRENT
@ I2C_MASTER_ACK_CURRENT
Definition at32f413_i2c.h:109
I2C_MASTER_ACK_NEXT
@ I2C_MASTER_ACK_NEXT
Definition at32f413_i2c.h:110
I2C_ADDRESS_MODE_7BIT
@ I2C_ADDRESS_MODE_7BIT
Definition at32f413_i2c.h:156
I2C_ADDRESS_MODE_10BIT
@ I2C_ADDRESS_MODE_10BIT
Definition at32f413_i2c.h:157
I2C_EVT_INT
#define I2C_EVT_INT
Definition at32f413_i2c.h:93
I2C_ERR_INT
#define I2C_ERR_INT
Definition at32f413_i2c.h:94
I2C_DATA_INT
#define I2C_DATA_INT
Definition at32f413_i2c.h:92
I2C_EVENT_CHECK_STOP
#define I2C_EVENT_CHECK_STOP
Definition i2c_application.h:48
I2C_EVENT_CHECK_NONE
#define I2C_EVENT_CHECK_NONE
Definition i2c_application.h:46
I2C_EVENT_CHECK_ACKFAIL
#define I2C_EVENT_CHECK_ACKFAIL
Definition i2c_application.h:47
i2c_mem_address_width_type
i2c_mem_address_width_type
Definition i2c_application.h:59
I2C_MEM_ADDR_WIDIH_8
@ I2C_MEM_ADDR_WIDIH_8
Definition i2c_application.h:60
i2c_status_type
i2c_status_type
Definition i2c_application.h:94
I2C_ERR_STEP_1
@ I2C_ERR_STEP_1
Definition i2c_application.h:96
I2C_ERR_TIMEOUT
@ I2C_ERR_TIMEOUT
Definition i2c_application.h:113
I2C_ERR_ADDR10
@ I2C_ERR_ADDR10
Definition i2c_application.h:109
I2C_ERR_START
@ I2C_ERR_START
Definition i2c_application.h:108
I2C_ERR_STEP_11
@ I2C_ERR_STEP_11
Definition i2c_application.h:106
I2C_ERR_INTERRUPT
@ I2C_ERR_INTERRUPT
Definition i2c_application.h:114
I2C_ERR_STEP_3
@ I2C_ERR_STEP_3
Definition i2c_application.h:98
I2C_ERR_STEP_6
@ I2C_ERR_STEP_6
Definition i2c_application.h:101
I2C_ERR_STEP_5
@ I2C_ERR_STEP_5
Definition i2c_application.h:100
I2C_ERR_STEP_9
@ I2C_ERR_STEP_9
Definition i2c_application.h:104
I2C_ERR_STEP_7
@ I2C_ERR_STEP_7
Definition i2c_application.h:102
I2C_ERR_STOP
@ I2C_ERR_STOP
Definition i2c_application.h:111
I2C_ERR_STEP_8
@ I2C_ERR_STEP_8
Definition i2c_application.h:103
I2C_ERR_ACKFAIL
@ I2C_ERR_ACKFAIL
Definition i2c_application.h:112
I2C_ERR_ADDR
@ I2C_ERR_ADDR
Definition i2c_application.h:110
I2C_ERR_STEP_2
@ I2C_ERR_STEP_2
Definition i2c_application.h:97
I2C_OK
@ I2C_OK
Definition i2c_application.h:95
I2C_ERR_STEP_10
@ I2C_ERR_STEP_10
Definition i2c_application.h:105
I2C_ERR_STEP_4
@ I2C_ERR_STEP_4
Definition i2c_application.h:99
I2C_DMA_MA_RX
@ I2C_DMA_MA_RX
Definition i2c_application.h:79
I2C_DMA_SLA_RX
@ I2C_DMA_SLA_RX
Definition i2c_application.h:81
I2C_INT_SLA_RX
@ I2C_INT_SLA_RX
Definition i2c_application.h:77
I2C_DMA_MA_TX
@ I2C_DMA_MA_TX
Definition i2c_application.h:78
I2C_INT_MA_RX
@ I2C_INT_MA_RX
Definition i2c_application.h:75
I2C_INT_SLA_TX
@ I2C_INT_SLA_TX
Definition i2c_application.h:76
I2C_INT_MA_TX
@ I2C_INT_MA_TX
Definition i2c_application.h:74
I2C_DMA_SLA_TX
@ I2C_DMA_SLA_TX
Definition i2c_application.h:80
I2C_STARTF_FLAG
#define I2C_STARTF_FLAG
Definition at32f413_i2c.h:51
I2C_TMOUT_FLAG
#define I2C_TMOUT_FLAG
Definition at32f413_i2c.h:63
I2C_ADDR7F_FLAG
#define I2C_ADDR7F_FLAG
Definition at32f413_i2c.h:52
I2C_ALERTF_FLAG
#define I2C_ALERTF_FLAG
Definition at32f413_i2c.h:64
I2C_BUSERR_FLAG
#define I2C_BUSERR_FLAG
Definition at32f413_i2c.h:58
I2C_ACKFAIL_FLAG
#define I2C_ACKFAIL_FLAG
Definition at32f413_i2c.h:60
I2C_OUF_FLAG
#define I2C_OUF_FLAG
Definition at32f413_i2c.h:61
I2C_ARLOST_FLAG
#define I2C_ARLOST_FLAG
Definition at32f413_i2c.h:59
I2C_STOPF_FLAG
#define I2C_STOPF_FLAG
Definition at32f413_i2c.h:55
I2C_TDC_FLAG
#define I2C_TDC_FLAG
Definition at32f413_i2c.h:53
I2C_ADDRHF_FLAG
#define I2C_ADDRHF_FLAG
Definition at32f413_i2c.h:54
I2C_TDBE_FLAG
#define I2C_TDBE_FLAG
Definition at32f413_i2c.h:57
I2C_RDBF_FLAG
#define I2C_RDBF_FLAG
Definition at32f413_i2c.h:56
I2C_PECERR_FLAG
#define I2C_PECERR_FLAG
Definition at32f413_i2c.h:62
I2C_BUSYF_FLAG
#define I2C_BUSYF_FLAG
Definition at32f413_i2c.h:76
i2c_application.h
i2c application libray header file
dma_channel_type
type define dma channel register all
Definition at32f413_dma.h:412
dma_init_type::buffer_size
uint16_t buffer_size
Definition at32f413_dma.h:279
dma_init_type::direction
dma_dir_type direction
Definition at32f413_dma.h:278
dma_init_type::peripheral_base_addr
uint32_t peripheral_base_addr
Definition at32f413_dma.h:276
dma_init_type::memory_base_addr
uint32_t memory_base_addr
Definition at32f413_dma.h:277
i2c_handle_type
Definition i2c_application.h:127
i2c_handle_type::dma_rx_channel
dma_channel_type * dma_rx_channel
Definition i2c_application.h:136
i2c_handle_type::i2cx
i2c_type * i2cx
Definition i2c_application.h:128
i2c_handle_type::status
__IO uint32_t status
Definition i2c_application.h:133
i2c_handle_type::pbuff
uint8_t * pbuff
Definition i2c_application.h:129
i2c_handle_type::mode
__IO uint32_t mode
Definition i2c_application.h:131
i2c_handle_type::timeout
__IO uint32_t timeout
Definition i2c_application.h:132
i2c_handle_type::dma_init_struct
dma_init_type dma_init_struct
Definition i2c_application.h:137
i2c_handle_type::error_code
__IO i2c_status_type error_code
Definition i2c_application.h:134
i2c_handle_type::dma_tx_channel
dma_channel_type * dma_tx_channel
Definition i2c_application.h:135
i2c_handle_type::pcount
__IO uint16_t pcount
Definition i2c_application.h:130
i2c_type::addr1mode
__IO uint32_t addr1mode
Definition at32f413_i2c.h:230
i2c_type::oaddr1_bit
struct i2c_type::@511::@527 oaddr1_bit
i2c_type::dt
__IO uint32_t dt
Definition at32f413_i2c.h:254


AT32F413 Firmwary Library: i2c_application.h Source File

  • middlewares
  • i2c_application_library
i2c_application.h
Go to the documentation of this file.
1
27#ifndef __I2C_APPLICATION_H
28#define __I2C_APPLICATION_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
46#define I2C_EVENT_CHECK_NONE ((uint32_t)0x00000000)
47#define I2C_EVENT_CHECK_ACKFAIL ((uint32_t)0x00000001)
48#define I2C_EVENT_CHECK_STOP ((uint32_t)0x00000002)
58typedef enum
59{
60 I2C_MEM_ADDR_WIDIH_8 = 0x01,
61 I2C_MEM_ADDR_WIDIH_16 = 0x02,
62} i2c_mem_address_width_type;
63
72typedef enum
73{
74 I2C_INT_MA_TX = 0,
75 I2C_INT_MA_RX,
76 I2C_INT_SLA_TX,
77 I2C_INT_SLA_RX,
78 I2C_DMA_MA_TX,
79 I2C_DMA_MA_RX,
80 I2C_DMA_SLA_TX,
81 I2C_DMA_SLA_RX,
82} i2c_mode_type;
83
84
93typedef enum
94{
95 I2C_OK = 0,
96 I2C_ERR_STEP_1,
97 I2C_ERR_STEP_2,
98 I2C_ERR_STEP_3,
99 I2C_ERR_STEP_4,
100 I2C_ERR_STEP_5,
101 I2C_ERR_STEP_6,
102 I2C_ERR_STEP_7,
103 I2C_ERR_STEP_8,
104 I2C_ERR_STEP_9,
105 I2C_ERR_STEP_10,
106 I2C_ERR_STEP_11,
107 I2C_ERR_STEP_12,
108 I2C_ERR_START,
109 I2C_ERR_ADDR10,
110 I2C_ERR_ADDR,
111 I2C_ERR_STOP,
112 I2C_ERR_ACKFAIL,
113 I2C_ERR_TIMEOUT,
114 I2C_ERR_INTERRUPT,
116} i2c_status_type;
117
126typedef struct
127{
128 i2c_type *i2cx;
129 uint8_t *pbuff;
130 __IO uint16_t pcount;
131 __IO uint32_t mode;
132 __IO uint32_t timeout;
133 __IO uint32_t status;
134 __IO i2c_status_type error_code;
135 dma_channel_type *dma_tx_channel;
136 dma_channel_type *dma_rx_channel;
137 dma_init_type dma_init_struct;
138} i2c_handle_type;
139
148void i2c_config (i2c_handle_type* hi2c);
149void i2c_lowlevel_init (i2c_handle_type* hi2c);
150 i2c_status_type i2c_wait_end (i2c_handle_type* hi2c, uint32_t timeout);
151 i2c_status_type i2c_wait_flag (i2c_handle_type* hi2c, uint32_t flag, uint32_t event_check, uint32_t timeout);
152
153 i2c_status_type i2c_master_transmit (i2c_handle_type* hi2c, uint16_t address, uint8_t* pdata, uint16_t size, uint32_t timeout);
154 i2c_status_type i2c_master_receive (i2c_handle_type* hi2c, uint16_t address, uint8_t* pdata, uint16_t size, uint32_t timeout);
155 i2c_status_type i2c_slave_transmit (i2c_handle_type* hi2c, uint8_t* pdata, uint16_t size, uint32_t timeout);
156 i2c_status_type i2c_slave_receive (i2c_handle_type* hi2c, uint8_t* pdata, uint16_t size, uint32_t timeout);
157
158 i2c_status_type i2c_master_transmit_int (i2c_handle_type* hi2c, uint16_t address, uint8_t* pdata, uint16_t size, uint32_t timeout);
159 i2c_status_type i2c_master_receive_int (i2c_handle_type* hi2c, uint16_t address, uint8_t* pdata, uint16_t size, uint32_t timeout);
160 i2c_status_type i2c_slave_transmit_int (i2c_handle_type* hi2c, uint8_t* pdata, uint16_t size, uint32_t timeout);
161 i2c_status_type i2c_slave_receive_int (i2c_handle_type* hi2c, uint8_t* pdata, uint16_t size, uint32_t timeout);
162
163 i2c_status_type i2c_master_transmit_dma (i2c_handle_type* hi2c, uint16_t address, uint8_t* pdata, uint16_t size, uint32_t timeout);
164 i2c_status_type i2c_master_receive_dma (i2c_handle_type* hi2c, uint16_t address, uint8_t* pdata, uint16_t size, uint32_t timeout);
165 i2c_status_type i2c_slave_transmit_dma (i2c_handle_type* hi2c, uint8_t* pdata, uint16_t size, uint32_t timeout);
166 i2c_status_type i2c_slave_receive_dma (i2c_handle_type* hi2c, uint8_t* pdata, uint16_t size, uint32_t timeout);
167
168 i2c_status_type i2c_memory_write (i2c_handle_type* hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t* pdata, uint16_t size, uint32_t timeout);
169 i2c_status_type i2c_memory_write_int (i2c_handle_type* hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t* pdata, uint16_t size, uint32_t timeout);
170 i2c_status_type i2c_memory_write_dma (i2c_handle_type* hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t* pdata, uint16_t size, uint32_t timeout);
171 i2c_status_type i2c_memory_read (i2c_handle_type* hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t* pdata, uint16_t size, uint32_t timeout);
172 i2c_status_type i2c_memory_read_int (i2c_handle_type* hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t* pdata, uint16_t size, uint32_t timeout);
173 i2c_status_type i2c_memory_read_dma (i2c_handle_type* hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t* pdata, uint16_t size, uint32_t timeout);
174
175void i2c_evt_irq_handler (i2c_handle_type* hi2c);
176void i2c_err_irq_handler (i2c_handle_type* hi2c);
177void i2c_dma_tx_irq_handler (i2c_handle_type* hi2c);
178void i2c_dma_rx_irq_handler (i2c_handle_type* hi2c);
179
188#ifdef __cplusplus
189}
190#endif
191
192#endif
at32f413.h
at32f413 header file
i2c_wait_flag
i2c_status_type i2c_wait_flag(i2c_handle_type *hi2c, uint32_t flag, uint32_t event_check, uint32_t timeout)
wait for the flag to be set or reset, only BUSYF flag is waiting to be reset, and other flags are wai...
Definition i2c_application.c:185
i2c_memory_read_dma
i2c_status_type i2c_memory_read_dma(i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
read data from memory device through polling mode.
Definition i2c_application.c:1878
i2c_wait_end
i2c_status_type i2c_wait_end(i2c_handle_type *hi2c, uint32_t timeout)
wait for the transfer to end.
Definition i2c_application.c:129
i2c_memory_write_dma
i2c_status_type i2c_memory_write_dma(i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
write data to the memory device through dma mode.
Definition i2c_application.c:1795
i2c_evt_irq_handler
void i2c_evt_irq_handler(i2c_handle_type *hi2c)
interrupt procession function.
Definition i2c_application.c:2223
i2c_memory_write_int
i2c_status_type i2c_memory_write_int(i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
write data to the memory device through interrupt mode.
Definition i2c_application.c:1601
i2c_slave_transmit_int
i2c_status_type i2c_slave_transmit_int(i2c_handle_type *hi2c, uint8_t *pdata, uint16_t size, uint32_t timeout)
the slave transmits data through interrupt mode.
Definition i2c_application.c:986
i2c_err_irq_handler
void i2c_err_irq_handler(i2c_handle_type *hi2c)
i2c error interrupt function.
Definition i2c_application.c:2339
i2c_dma_rx_irq_handler
void i2c_dma_rx_irq_handler(i2c_handle_type *hi2c)
dma reveive complete interrupt function.
Definition i2c_application.c:2293
i2c_slave_receive
i2c_status_type i2c_slave_receive(i2c_handle_type *hi2c, uint8_t *pdata, uint16_t size, uint32_t timeout)
the slave receive data through polling mode.
Definition i2c_application.c:489
i2c_slave_transmit_dma
i2c_status_type i2c_slave_transmit_dma(i2c_handle_type *hi2c, uint8_t *pdata, uint16_t size, uint32_t timeout)
the slave transmits data through dma mode.
Definition i2c_application.c:1202
i2c_master_receive_int
i2c_status_type i2c_master_receive_int(i2c_handle_type *hi2c, uint16_t address, uint8_t *pdata, uint16_t size, uint32_t timeout)
the master receive data through interrupt mode.
Definition i2c_application.c:908
i2c_memory_write
i2c_status_type i2c_memory_write(i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
write data to the memory device through polling mode.
Definition i2c_application.c:1299
i2c_master_transmit_dma
i2c_status_type i2c_master_transmit_dma(i2c_handle_type *hi2c, uint16_t address, uint8_t *pdata, uint16_t size, uint32_t timeout)
the master transmits data through dma mode.
Definition i2c_application.c:1025
i2c_config
void i2c_config(i2c_handle_type *hi2c)
i2c peripheral initialization.
Definition i2c_application.c:111
i2c_memory_read
i2c_status_type i2c_memory_read(i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
read data from memory device through polling mode.
Definition i2c_application.c:1388
i2c_memory_read_int
i2c_status_type i2c_memory_read_int(i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
read data from memory device through interrupt mode.
Definition i2c_application.c:1678
i2c_dma_tx_irq_handler
void i2c_dma_tx_irq_handler(i2c_handle_type *hi2c)
dma transmission complete interrupt function.
Definition i2c_application.c:2256
i2c_lowlevel_init
void i2c_lowlevel_init(i2c_handle_type *hi2c)
initializes peripherals used by the i2c.
Definition project/at_start_f413/examples/i2c/communication_dma/src/main.c:116
i2c_slave_receive_dma
i2c_status_type i2c_slave_receive_dma(i2c_handle_type *hi2c, uint8_t *pdata, uint16_t size, uint32_t timeout)
the slave receive data through dma mode.
Definition i2c_application.c:1078
i2c_master_transmit_int
i2c_status_type i2c_master_transmit_int(i2c_handle_type *hi2c, uint16_t address, uint8_t *pdata, uint16_t size, uint32_t timeout)
the master transmits data through interrupt mode.
Definition i2c_application.c:822
i2c_master_receive
i2c_status_type i2c_master_receive(i2c_handle_type *hi2c, uint16_t address, uint8_t *pdata, uint16_t size, uint32_t timeout)
the master receive data through polling mode.
Definition i2c_application.c:564
i2c_master_receive_dma
i2c_status_type i2c_master_receive_dma(i2c_handle_type *hi2c, uint16_t address, uint8_t *pdata, uint16_t size, uint32_t timeout)
the master receive data through dma mode.
Definition i2c_application.c:1126
i2c_slave_receive_int
i2c_status_type i2c_slave_receive_int(i2c_handle_type *hi2c, uint8_t *pdata, uint16_t size, uint32_t timeout)
the slave receive data through interrupt mode.
Definition i2c_application.c:869
i2c_master_transmit
i2c_status_type i2c_master_transmit(i2c_handle_type *hi2c, uint16_t address, uint8_t *pdata, uint16_t size, uint32_t timeout)
the master transmits data through polling mode.
Definition i2c_application.c:421
i2c_slave_transmit
i2c_status_type i2c_slave_transmit(i2c_handle_type *hi2c, uint8_t *pdata, uint16_t size, uint32_t timeout)
the slave transmits data through polling mode.
Definition i2c_application.c:735
i2c_mem_address_width_type
i2c_mem_address_width_type
Definition i2c_application.h:59
I2C_MEM_ADDR_WIDIH_8
@ I2C_MEM_ADDR_WIDIH_8
Definition i2c_application.h:60
I2C_MEM_ADDR_WIDIH_16
@ I2C_MEM_ADDR_WIDIH_16
Definition i2c_application.h:61
i2c_status_type
i2c_status_type
Definition i2c_application.h:94
I2C_ERR_STEP_1
@ I2C_ERR_STEP_1
Definition i2c_application.h:96
I2C_ERR_TIMEOUT
@ I2C_ERR_TIMEOUT
Definition i2c_application.h:113
I2C_ERR_ADDR10
@ I2C_ERR_ADDR10
Definition i2c_application.h:109
I2C_ERR_START
@ I2C_ERR_START
Definition i2c_application.h:108
I2C_ERR_STEP_11
@ I2C_ERR_STEP_11
Definition i2c_application.h:106
I2C_ERR_INTERRUPT
@ I2C_ERR_INTERRUPT
Definition i2c_application.h:114
I2C_ERR_STEP_3
@ I2C_ERR_STEP_3
Definition i2c_application.h:98
I2C_ERR_STEP_6
@ I2C_ERR_STEP_6
Definition i2c_application.h:101
I2C_ERR_STEP_5
@ I2C_ERR_STEP_5
Definition i2c_application.h:100
I2C_ERR_STEP_9
@ I2C_ERR_STEP_9
Definition i2c_application.h:104
I2C_ERR_STEP_7
@ I2C_ERR_STEP_7
Definition i2c_application.h:102
I2C_ERR_STOP
@ I2C_ERR_STOP
Definition i2c_application.h:111
I2C_ERR_STEP_8
@ I2C_ERR_STEP_8
Definition i2c_application.h:103
I2C_ERR_ACKFAIL
@ I2C_ERR_ACKFAIL
Definition i2c_application.h:112
I2C_ERR_ADDR
@ I2C_ERR_ADDR
Definition i2c_application.h:110
I2C_ERR_STEP_12
@ I2C_ERR_STEP_12
Definition i2c_application.h:107
I2C_ERR_STEP_2
@ I2C_ERR_STEP_2
Definition i2c_application.h:97
I2C_OK
@ I2C_OK
Definition i2c_application.h:95
I2C_ERR_STEP_10
@ I2C_ERR_STEP_10
Definition i2c_application.h:105
I2C_ERR_STEP_4
@ I2C_ERR_STEP_4
Definition i2c_application.h:99
i2c_mode_type
i2c_mode_type
Definition i2c_application.h:73
I2C_DMA_MA_RX
@ I2C_DMA_MA_RX
Definition i2c_application.h:79
I2C_DMA_SLA_RX
@ I2C_DMA_SLA_RX
Definition i2c_application.h:81
I2C_INT_SLA_RX
@ I2C_INT_SLA_RX
Definition i2c_application.h:77
I2C_DMA_MA_TX
@ I2C_DMA_MA_TX
Definition i2c_application.h:78
I2C_INT_MA_RX
@ I2C_INT_MA_RX
Definition i2c_application.h:75
I2C_INT_SLA_TX
@ I2C_INT_SLA_TX
Definition i2c_application.h:76
I2C_INT_MA_TX
@ I2C_INT_MA_TX
Definition i2c_application.h:74
I2C_DMA_SLA_TX
@ I2C_DMA_SLA_TX
Definition i2c_application.h:80
dma_channel_type
type define dma channel register all
Definition at32f413_dma.h:412
dma_init_type
dma init type
Definition at32f413_dma.h:275
i2c_handle_type
Definition i2c_application.h:127
i2c_handle_type::dma_rx_channel
dma_channel_type * dma_rx_channel
Definition i2c_application.h:136
i2c_handle_type::i2cx
i2c_type * i2cx
Definition i2c_application.h:128
i2c_handle_type::status
__IO uint32_t status
Definition i2c_application.h:133
i2c_handle_type::pbuff
uint8_t * pbuff
Definition i2c_application.h:129
i2c_handle_type::mode
__IO uint32_t mode
Definition i2c_application.h:131
i2c_handle_type::timeout
__IO uint32_t timeout
Definition i2c_application.h:132
i2c_handle_type::dma_init_struct
dma_init_type dma_init_struct
Definition i2c_application.h:137
i2c_handle_type::error_code
__IO i2c_status_type error_code
Definition i2c_application.h:134
i2c_handle_type::dma_tx_channel
dma_channel_type * dma_tx_channel
Definition i2c_application.h:135
i2c_handle_type::pcount
__IO uint16_t pcount
Definition i2c_application.h:130
i2c_type
type define i2c register all
Definition at32f413_i2c.h:173


AT32F413 Firmwary Library: include_port.c Source File

  • utilities
  • at32f413_freertos_demo
  • src
include_port.c
Go to the documentation of this file.
1
34/* support ac5 and ac6 compiler */
35#if (__ARMCC_VERSION > 6000000)
36
37#include "..\..\..\middlewares\freertos\source\portable\GCC\ARM_CM4F\port.c"
38
39#else
40
41#include "..\..\..\middlewares\freertos\source\portable\rvds\ARM_CM4F\port.c"
42
43#endif
44


AT32F413 Firmwary Library: julia_fpu.c Source File

  • cortex_m4
  • fpu
  • src
julia_fpu.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "julia_fpu.h"
28
47void generate_julia_fpu(uint16_t size_x, uint16_t size_y, uint16_t offset_x, uint16_t offset_y, uint16_t zoom, uint8_t * buffer)
48{
49 float tmp1, tmp2;
50 float num_real, num_img;
51 float rayon;
52 uint16_t i;
53 uint16_t x, y;
54 for (y = 0; y < size_y; y++)
55 {
56 for (x = 0; x < size_x; x++)
57 {
58 num_real = y - offset_y;
59 num_real = num_real / zoom;
60 num_img = x - offset_x;
61 num_img = num_img / zoom;
62 i = 0;
63 rayon = 0;
64 while((i < ITERATION - 1) && (rayon < 4))
65 {
66 tmp1 = num_real * num_real;
67 tmp2 = num_img * num_img;
68 num_img = 2 * num_real * num_img + IMG_CONSTANT;
69 num_real = tmp1 - tmp2 + REAL_CONSTANT;
70 rayon = tmp1 + tmp2;
71 i++;
72 }
73 /* store the value in the buffer */
74 buffer[x + y * size_x] = i;
75 }
76 }
77}
78
IMG_CONSTANT
#define IMG_CONSTANT
Definition julia_fpu.h:46
generate_julia_fpu
void generate_julia_fpu(uint16_t size_x, uint16_t size_y, uint16_t offset_x, uint16_t offset_y, uint16_t zoom, uint8_t *buffer)
julia calculation test with fpu option enable or disable
Definition julia_fpu.c:47
REAL_CONSTANT
#define REAL_CONSTANT
Definition julia_fpu.h:45
ITERATION
#define ITERATION
Definition julia_fpu.h:44
buffer
uint8_t buffer[((uint16_t) 160) *((uint16_t) 120)]
Definition project/at_start_f413/examples/cortex_m4/fpu/src/main.c:42
julia_fpu.h
julia_fpu header file


AT32F413 Firmwary Library: julia_fpu.h Source File

  • cortex_m4
  • fpu
  • inc
julia_fpu.h
Go to the documentation of this file.
1
26#ifndef __JULIA_FPU_H
27#define __JULIA_FPU_H
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33/* includes ------------------------------------------------------------------*/
34#include "at32f413.h"
35
44#define ITERATION 200
45#define REAL_CONSTANT (0.285f)
46#define IMG_CONSTANT (0.01f)
47
52void generate_julia_fpu(uint16_t size_x, uint16_t size_y, uint16_t offset_x, uint16_t offset_y, uint16_t zoom, uint8_t * buffer);
53
66#ifdef __cplusplus
67}
68#endif
69
70#endif
71
at32f413.h
at32f413 header file
buffer
uint8_t buffer[((uint16_t) 160) *((uint16_t) 120)]
Definition project/at_start_f413/examples/cortex_m4/fpu/src/main.c:42
generate_julia_fpu
void generate_julia_fpu(uint16_t size_x, uint16_t size_y, uint16_t offset_x, uint16_t offset_y, uint16_t zoom, uint8_t *buffer)
julia calculation test with fpu option enable or disable
Definition julia_fpu.c:47


AT32F413 Firmwary Library: keyboard_class.c Source File

  • middlewares
  • usbd_class
  • keyboard
keyboard_class.c
Go to the documentation of this file.
1
25#include "usbd_core.h"
26#include "keyboard_class.h"
27#include "keyboard_desc.h"
28
42static usb_sts_type class_init_handler(void *udev);
43static usb_sts_type class_clear_handler(void *udev);
44static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup);
45static usb_sts_type class_ept0_tx_handler(void *udev);
46static usb_sts_type class_ept0_rx_handler(void *udev);
47static usb_sts_type class_in_handler(void *udev, uint8_t ept_num);
48static usb_sts_type class_out_handler(void *udev, uint8_t ept_num);
49static usb_sts_type class_sof_handler(void *udev);
50static usb_sts_type class_event_handler(void *udev, usbd_event_type event);
51
52 keyboard_type keyboard_struct;
53#define SHIFT 0x80
54const static unsigned char _asciimap[128] =
55{
56 0x00,// NUL
57 0x00,// SOH
58 0x00,// STX
59 0x00,// ETX
60 0x00,// EOT
61 0x00,// ENQ
62 0x00,// ACK
63 0x00,// BEL
64 0x2A,// BS Backspace
65 0x2B,// TAB Tab
66 0x28,// LF Enter
67 0x00,// VT
68 0x00,// FF
69 0x00,// CR
70 0x00,// SO
71 0x00,// SI
72 0x00,// DEL
73 0x00,// DC1
74 0x00,// DC2
75 0x00,// DC3
76 0x00,// DC4
77 0x00,// NAK
78 0x00,// SYN
79 0x00,// ETB
80 0x00,// CAN
81 0x00,// EM
82 0x00,// SUB
83 0x00,// ESC
84 0x00,// FS
85 0x00,// GS
86 0x00,// RS
87 0x00,// US
88
89 0x2C,// ' '
90 0x1E|SHIFT,// !
91 0x34|SHIFT,// "
92 0x20|SHIFT,// #
93 0x21|SHIFT,// $
94 0x22|SHIFT,// %
95 0x24|SHIFT,// &
96 0x34, // '
97 0x26|SHIFT,// (
98 0x27|SHIFT,// )
99 0x25|SHIFT,// *
100 0x2E|SHIFT,// +
101 0x36,// ,
102 0x2D,// -
103 0x37,// .
104 0x38,// /
105 0x27,// 0
106 0x1E,// 1
107 0x1F,// 2
108 0x20,// 3
109 0x21,// 4
110 0x22,// 5
111 0x23,// 6
112 0x24,// 7
113 0x25,// 8
114 0x26,// 9
115 0x33|SHIFT,// :
116 0x33, // ;
117 0x36|SHIFT,// <
118 0x2E, // =
119 0x37|SHIFT,// >
120 0x38|SHIFT,// ?
121 0x1F|SHIFT,// @
122 0x04|SHIFT,// A
123 0x05|SHIFT,// B
124 0x06|SHIFT,// C
125 0x07|SHIFT,// D
126 0x08|SHIFT,// E
127 0x09|SHIFT,// F
128 0x0A|SHIFT,// G
129 0x0B|SHIFT,// H
130 0x0C|SHIFT,// I
131 0x0D|SHIFT,// J
132 0x0E|SHIFT,// K
133 0x0F|SHIFT,// L
134 0x10|SHIFT,// M
135 0x11|SHIFT,// N
136 0x12|SHIFT,// O
137 0x13|SHIFT,// P
138 0x14|SHIFT,// Q
139 0x15|SHIFT,// R
140 0x16|SHIFT,// S
141 0x17|SHIFT,// T
142 0x18|SHIFT,// U
143 0x19|SHIFT,// V
144 0x1A|SHIFT,// W
145 0x1B|SHIFT,// X
146 0x1C|SHIFT,// Y
147 0x1D|SHIFT,// Z
148 0x2F, // [
149 0x31, // bslash
150 0x30, // ]
151 0x23|SHIFT,// ^
152 0x2D|SHIFT,// _
153 0x35, // `
154 0x04, // a
155 0x05, // b
156 0x06, // c
157 0x07, // d
158 0x08, // e
159 0x09, // f
160 0x0A, // g
161 0x0B, // h
162 0x0C, // i
163 0x0D, // j
164 0x0E, // k
165 0x0F, // l
166 0x10, // m
167 0x11, // n
168 0x12, // o
169 0x13, // p
170 0x14, // q
171 0x15, // r
172 0x16, // s
173 0x17, // t
174 0x18, // u
175 0x19, // v
176 0x1A, // w
177 0x1B, // x
178 0x1C, // y
179 0x1D, // z
180 0x2f|SHIFT,//
181 0x31|SHIFT,// |
182 0x30|SHIFT,// }
183 0x35|SHIFT,// ~
184 0 // DEL
185};
186
187/* usb device class handler */
188 usbd_class_handler keyboard_class_handler =
189{
190 class_init_handler,
191 class_clear_handler,
192 class_setup_handler,
193 class_ept0_tx_handler,
194 class_ept0_rx_handler,
195 class_in_handler,
196 class_out_handler,
197 class_sof_handler,
198 class_event_handler,
199 &keyboard_struct
200};
201
207static usb_sts_type class_init_handler(void *udev)
208{
209 usb_sts_type status = USB_OK;
210 usbd_core_type *pudev = (usbd_core_type *)udev;
211 keyboard_type *pkeyboard = (keyboard_type *)pudev->class_handler->pdata;
212#ifndef USB_EPT_AUTO_MALLOC_BUFFER
213 /* use user define buffer address */
214 usbd_ept_buf_custom_define(pudev, USBD_KEYBOARD_IN_EPT, EPT1_TX_ADDR);
215#endif
216
217 /* open hid in endpoint */
218 usbd_ept_open(pudev, USBD_KEYBOARD_IN_EPT, EPT_INT_TYPE, USBD_KEYBOARD_IN_MAXPACKET_SIZE);
219
220 pkeyboard->g_u8tx_completed = 1;
221 pkeyboard->send_state = 0;
222
223 return status;
224}
225
231static usb_sts_type class_clear_handler(void *udev)
232{
233 usb_sts_type status = USB_OK;
234 usbd_core_type *pudev = (usbd_core_type *)udev;
235
236 /* close hid in endpoint */
237 usbd_ept_close(pudev, USBD_KEYBOARD_IN_EPT);
238
239 return status;
240}
241
248static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
249{
250 usb_sts_type status = USB_OK;
251 usbd_core_type *pudev = (usbd_core_type *)udev;
252 keyboard_type *pkeyboard = (keyboard_type *)pudev->class_handler->pdata;
253 uint16_t len;
254 uint8_t *buf;
255
256 switch(setup->bmRequestType & USB_REQ_TYPE_RESERVED)
257 {
258 /* class request */
259 case USB_REQ_TYPE_CLASS:
260 switch(setup->bRequest)
261 {
262 case HID_REQ_SET_PROTOCOL:
263 pkeyboard->hid_protocol = (uint8_t)setup->wValue;
264 break;
265 case HID_REQ_GET_PROTOCOL:
266 usbd_ctrl_send(pudev, (uint8_t *)&pkeyboard->hid_protocol, 1);
267 break;
268 case HID_REQ_SET_IDLE:
269 pkeyboard->hid_set_idle = (uint8_t)(setup->wValue >> 8);
270 break;
271 case HID_REQ_GET_IDLE:
272 usbd_ctrl_send(pudev, (uint8_t *)&pkeyboard->hid_set_idle, 1);
273 break;
274 case HID_REQ_SET_REPORT:
275 pkeyboard->hid_state = HID_REQ_SET_REPORT;
276 usbd_ctrl_recv(pudev, pkeyboard->hid_set_report, setup->wLength);
277 break;
278 default:
279 usbd_ctrl_unsupport(pudev);
280 break;
281 }
282 break;
283 /* standard request */
284 case USB_REQ_TYPE_STANDARD:
285 switch(setup->bRequest)
286 {
287 case USB_STD_REQ_GET_DESCRIPTOR:
288 if(setup->wValue >> 8 == HID_REPORT_DESC)
289 {
290 len = MIN(USBD_KEYBOARD_SIZ_REPORT_DESC, setup->wLength);
291 buf = (uint8_t *)g_usbd_keyboard_report;
292 usbd_ctrl_send(pudev, (uint8_t *)buf, len);
293 }
294 else if(setup->wValue >> 8 == HID_DESCRIPTOR_TYPE)
295 {
296 len = MIN(9, setup->wLength);
297 buf = (uint8_t *)g_keyboard_usb_desc;
298 usbd_ctrl_send(pudev, (uint8_t *)buf, len);
299 }
300 else
301 {
302 usbd_ctrl_unsupport(pudev);
303 }
304 break;
305 case USB_STD_REQ_GET_INTERFACE:
306 usbd_ctrl_send(pudev, (uint8_t *)&pkeyboard->alt_setting, 1);
307 break;
308 case USB_STD_REQ_SET_INTERFACE:
309 pkeyboard->alt_setting = setup->wValue;
310 break;
311 case USB_STD_REQ_CLEAR_FEATURE:
312 break;
313 case USB_STD_REQ_SET_FEATURE:
314 break;
315 default:
316 usbd_ctrl_unsupport(pudev);
317 break;
318 }
319 break;
320 default:
321 usbd_ctrl_unsupport(pudev);
322 break;
323 }
324 return status;
325}
326
332static usb_sts_type class_ept0_tx_handler(void *udev)
333{
334 usb_sts_type status = USB_OK;
335
336 /* ...user code... */
337
338 return status;
339}
340
346static usb_sts_type class_ept0_rx_handler(void *udev)
347{
348 usb_sts_type status = USB_OK;
349 usbd_core_type *pudev = (usbd_core_type *)udev;
350 keyboard_type *pkeyboard = (keyboard_type *)pudev->class_handler->pdata;
351 uint32_t recv_len = usbd_get_recv_len(pudev, 0);
352 /* ...user code... */
353 if( pkeyboard->hid_state == HID_REQ_SET_REPORT)
354 {
355 /* hid buffer process */
356 pkeyboard->hid_state = 0;
357 }
358
359 return status;
360}
361
368static usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
369{
370 usb_sts_type status = USB_OK;
371 usbd_core_type *pudev = (usbd_core_type *)udev;
372 keyboard_type *pkeyboard = (keyboard_type *)pudev->class_handler->pdata;
373
374 /* ...user code...
375 trans next packet data
376 */
377 pkeyboard->g_u8tx_completed = 1;
378 pkeyboard->send_state = 0;
379
380 return status;
381}
382
389static usb_sts_type class_out_handler(void *udev, uint8_t ept_num)
390{
391 usb_sts_type status = USB_OK;
392
393 return status;
394}
395
401static usb_sts_type class_sof_handler(void *udev)
402{
403 usb_sts_type status = USB_OK;
404
405 /* ...user code... */
406
407 return status;
408}
409
416static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
417{
418 usb_sts_type status = USB_OK;
419 usbd_core_type *pudev = (usbd_core_type *)udev;
420 keyboard_type *pkeyboard = (keyboard_type *)pudev->class_handler->pdata;
421 switch(event)
422 {
423 case USBD_RESET_EVENT:
424
425 /* ...user code... */
426
427 break;
428 case USBD_SUSPEND_EVENT:
429 pkeyboard->hid_suspend_flag = 1;
430 /* ...user code... */
431
432 break;
433 case USBD_WAKEUP_EVENT:
434 /* ...user code... */
435
436 break;
437 default:
438 break;
439 }
440 return status;
441}
442
450 usb_sts_type usb_keyboard_class_send_report(void *udev, uint8_t *report, uint16_t len)
451{
452 usb_sts_type status = USB_FAIL;
453 usbd_core_type *pudev = (usbd_core_type *)udev;
454 keyboard_type *pkeyboard = (keyboard_type *)pudev->class_handler->pdata;
455
456 if(usbd_connect_state_get(pudev) == USB_CONN_STATE_CONFIGURED && pkeyboard->send_state == 0)
457 {
458 pkeyboard->send_state = 1;
459 usbd_ept_send(pudev, USBD_KEYBOARD_IN_EPT, report, len);
460 status = USB_OK;
461 }
462
463 return status;
464}
465
466
473void usb_hid_keyboard_send_char(void *udev, uint8_t ascii_code)
474{
475 uint8_t key_data = 0;
476 usbd_core_type *pudev = (usbd_core_type *)udev;
477 keyboard_type *pkeyboard = (keyboard_type *)pudev->class_handler->pdata;
478
479 if(ascii_code > 128)
480 {
481 ascii_code = 0;
482 }
483 else
484 {
485 ascii_code = _asciimap[ascii_code];
486 if(!ascii_code)
487 {
488 ascii_code = 0;
489 }
490
491 if(ascii_code & SHIFT)
492 {
493 key_data = 0x2;
494 ascii_code &= 0x7F;
495 }
496 }
497
498 if((pkeyboard->temp == ascii_code) && (ascii_code != 0))
499 {
500 pkeyboard->keyboard_buf[0] = 0;
501 pkeyboard->keyboard_buf[2] = 0;
502 usb_keyboard_class_send_report(udev, pkeyboard->keyboard_buf, 8);
503 }
504 else
505 {
506 pkeyboard->keyboard_buf[0] = key_data;
507 pkeyboard->keyboard_buf[2] = ascii_code;
508 usb_keyboard_class_send_report(udev, pkeyboard->keyboard_buf, 8);
509 }
510}
511
512
EPT1_TX_ADDR
#define EPT1_TX_ADDR
Definition project/at_start_f413/examples/acc/calibration/inc/usb_conf.h:76
EPT_INT_TYPE
@ EPT_INT_TYPE
Definition at32f413_usb.h:205
USBD_KEYBOARD_IN_MAXPACKET_SIZE
#define USBD_KEYBOARD_IN_MAXPACKET_SIZE
usb hid in and out max packet size define
Definition keyboard_class.h:57
USBD_KEYBOARD_IN_EPT
#define USBD_KEYBOARD_IN_EPT
usb hid use endpoint define
Definition keyboard_class.h:52
class_sof_handler
static usb_sts_type class_sof_handler(void *udev)
usb device class sof handler
Definition keyboard_class.c:401
class_in_handler
static usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
usb device class transmision complete handler
Definition keyboard_class.c:368
keyboard_struct
keyboard_type keyboard_struct
Definition keyboard_class.c:52
_asciimap
static const unsigned char _asciimap[128]
Definition keyboard_class.c:54
class_clear_handler
static usb_sts_type class_clear_handler(void *udev)
clear endpoint or other state
Definition keyboard_class.c:231
class_setup_handler
static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
usb device class setup request handler
Definition keyboard_class.c:248
class_ept0_tx_handler
static usb_sts_type class_ept0_tx_handler(void *udev)
usb device class endpoint 0 in status stage complete
Definition keyboard_class.c:332
usb_hid_keyboard_send_char
void usb_hid_keyboard_send_char(void *udev, uint8_t ascii_code)
usb device class report function
Definition keyboard_class.c:473
class_ept0_rx_handler
static usb_sts_type class_ept0_rx_handler(void *udev)
usb device class endpoint 0 out status stage complete
Definition keyboard_class.c:346
class_event_handler
static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
usb device class event handler
Definition keyboard_class.c:416
class_init_handler
static usb_sts_type class_init_handler(void *udev)
initialize usb endpoint
Definition keyboard_class.c:207
usb_keyboard_class_send_report
usb_sts_type usb_keyboard_class_send_report(void *udev, uint8_t *report, uint16_t len)
usb device class send report
Definition keyboard_class.c:450
keyboard_class_handler
usbd_class_handler keyboard_class_handler
Definition keyboard_class.c:188
class_out_handler
static usb_sts_type class_out_handler(void *udev, uint8_t ept_num)
usb device class endpoint receive data
Definition keyboard_class.c:389
SHIFT
#define SHIFT
Definition keyboard_class.c:53
USBD_KEYBOARD_SIZ_REPORT_DESC
#define USBD_KEYBOARD_SIZ_REPORT_DESC
Definition keyboard_desc.h:64
g_keyboard_usb_desc
uint8_t g_keyboard_usb_desc[9]
g_usbd_keyboard_report
uint8_t g_usbd_keyboard_report[63]
USB_STD_REQ_CLEAR_FEATURE
#define USB_STD_REQ_CLEAR_FEATURE
Definition usb_std.h:77
HID_DESCRIPTOR_TYPE
#define HID_DESCRIPTOR_TYPE
Definition usb_std.h:242
HID_REQ_GET_PROTOCOL
#define HID_REQ_GET_PROTOCOL
Definition usb_std.h:237
MIN
#define MIN(a, b)
min and max define
Definition usb_std.h:260
USB_REQ_TYPE_STANDARD
#define USB_REQ_TYPE_STANDARD
usb request type
Definition usb_std.h:62
USB_STD_REQ_GET_DESCRIPTOR
#define USB_STD_REQ_GET_DESCRIPTOR
Definition usb_std.h:80
HID_REQ_SET_PROTOCOL
#define HID_REQ_SET_PROTOCOL
usb hid class request code define
Definition usb_std.h:236
HID_REPORT_DESC
#define HID_REPORT_DESC
Definition usb_std.h:243
USB_STD_REQ_SET_FEATURE
#define USB_STD_REQ_SET_FEATURE
Definition usb_std.h:78
HID_REQ_SET_IDLE
#define HID_REQ_SET_IDLE
Definition usb_std.h:238
HID_REQ_GET_IDLE
#define HID_REQ_GET_IDLE
Definition usb_std.h:239
HID_REQ_SET_REPORT
#define HID_REQ_SET_REPORT
Definition usb_std.h:240
USB_STD_REQ_SET_INTERFACE
#define USB_STD_REQ_SET_INTERFACE
Definition usb_std.h:85
USB_REQ_TYPE_RESERVED
#define USB_REQ_TYPE_RESERVED
Definition usb_std.h:65
USB_STD_REQ_GET_INTERFACE
#define USB_STD_REQ_GET_INTERFACE
Definition usb_std.h:84
USB_REQ_TYPE_CLASS
#define USB_REQ_TYPE_CLASS
Definition usb_std.h:63
USB_CONN_STATE_CONFIGURED
@ USB_CONN_STATE_CONFIGURED
Definition usb_std.h:137
usb_sts_type
usb_sts_type
usb return status
Definition usb_std.h:285
USB_OK
@ USB_OK
Definition usb_std.h:286
USB_FAIL
@ USB_FAIL
Definition usb_std.h:287
usbd_connect_state_get
usbd_conn_state usbd_connect_state_get(usbd_core_type *udev)
get usb connect state
Definition usbd_core.c:595
usbd_ept_close
void usbd_ept_close(usbd_core_type *udev, uint8_t ept_addr)
usb close endpoint
Definition usbd_core.c:541
usbd_ept_buf_custom_define
void usbd_ept_buf_custom_define(usbd_core_type *udev, uint8_t ept_addr, uint32_t addr)
usb custom define endpoint buffer
Definition usbd_core.c:464
usbd_ept_open
void usbd_ept_open(usbd_core_type *udev, uint8_t ept_addr, uint8_t ept_type, uint16_t maxpacket)
usb open endpoint
Definition usbd_core.c:506
usbd_ctrl_send
void usbd_ctrl_send(usbd_core_type *udev, uint8_t *buffer, uint16_t len)
usb control endpoint send data
Definition usbd_core.c:175
usbd_get_recv_len
uint32_t usbd_get_recv_len(usbd_core_type *udev, uint8_t ept_addr)
usb endpoint get receive data length
Definition usbd_core.c:397
usbd_ctrl_recv
void usbd_ctrl_recv(usbd_core_type *udev, uint8_t *buffer, uint16_t len)
usb control endpoint receive data
Definition usbd_core.c:194
usbd_ctrl_unsupport
void usbd_ctrl_unsupport(usbd_core_type *udev)
un-support device request
Definition usbd_core.c:289
usbd_ept_send
void usbd_ept_send(usbd_core_type *udev, uint8_t ept_num, uint8_t *buffer, uint16_t len)
usb endpoint send data
Definition usbd_core.c:304
usbd_event_type
usbd_event_type
usb device event
Definition usbd_core.h:54
USBD_SUSPEND_EVENT
@ USBD_SUSPEND_EVENT
Definition usbd_core.h:57
USBD_RESET_EVENT
@ USBD_RESET_EVENT
Definition usbd_core.h:56
USBD_WAKEUP_EVENT
@ USBD_WAKEUP_EVENT
Definition usbd_core.h:58
keyboard_class.h
usb hid keyboard header file
keyboard_desc.h
usb keyboard descriptor header file
keyboard_type
Definition keyboard_class.h:66
keyboard_type::keyboard_buf
uint8_t keyboard_buf[8]
Definition keyboard_class.h:71
keyboard_type::hid_set_report
uint8_t hid_set_report[64]
Definition keyboard_class.h:70
keyboard_type::hid_set_idle
uint32_t hid_set_idle
Definition keyboard_class.h:68
keyboard_type::send_state
uint8_t send_state
Definition keyboard_class.h:75
keyboard_type::alt_setting
uint32_t alt_setting
Definition keyboard_class.h:69
keyboard_type::temp
uint8_t temp
Definition keyboard_class.h:77
keyboard_type::hid_state
uint8_t hid_state
Definition keyboard_class.h:76
keyboard_type::g_u8tx_completed
__IO uint8_t g_u8tx_completed
Definition keyboard_class.h:74
keyboard_type::hid_protocol
uint32_t hid_protocol
Definition keyboard_class.h:67
keyboard_type::hid_suspend_flag
__IO uint8_t hid_suspend_flag
Definition keyboard_class.h:73
usb_setup_type
format of usb setup data
Definition usb_std.h:297
usb_setup_type::wValue
uint16_t wValue
Definition usb_std.h:300
usb_setup_type::wLength
uint16_t wLength
Definition usb_std.h:303
usb_setup_type::bmRequestType
uint8_t bmRequestType
Definition usb_std.h:298
usb_setup_type::bRequest
uint8_t bRequest
Definition usb_std.h:299
usbd_class_handler
usb device class handler
Definition usbd_core.h:97
usbd_class_handler::pdata
void * pdata
Definition usbd_core.h:107
usbd_core_type
usb device core struct type
Definition usbd_core.h:114
usbd_core_type::class_handler
usbd_class_handler * class_handler
Definition usbd_core.h:117
usbd_core.h
usb device core header file


AT32F413 Firmwary Library: keyboard_class.h Source File

  • middlewares
  • usbd_class
  • keyboard
keyboard_class.h
Go to the documentation of this file.
1
26 /* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __KEYBOARD_CLASS_H
28#define __KEYBOARD_CLASS_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "usb_std.h"
35#include "usbd_core.h"
36
52#define USBD_KEYBOARD_IN_EPT 0x81
53
57#define USBD_KEYBOARD_IN_MAXPACKET_SIZE 0x40
58#define USBD_KEYBOARD_OUT_MAXPACKET_SIZE 0x40
59
65typedef struct
66{
67 uint32_t hid_protocol;
68 uint32_t hid_set_idle;
69 uint32_t alt_setting;
70 uint8_t hid_set_report[64];
71 uint8_t keyboard_buf[8];
72
73 __IO uint8_t hid_suspend_flag;
74 __IO uint8_t g_u8tx_completed;
75 uint8_t send_state;
76 uint8_t hid_state;
77 uint8_t temp;
78
79}keyboard_type;
80
84extern usbd_class_handler keyboard_class_handler;
85
86 usb_sts_type usb_keyboard_class_send_report(void *udev, uint8_t *report, uint16_t len);
87void usb_hid_keyboard_send_char(void *udev, uint8_t ascii_code);
99#ifdef __cplusplus
100}
101#endif
102
103#endif
usb_hid_keyboard_send_char
void usb_hid_keyboard_send_char(void *udev, uint8_t ascii_code)
usb device class report function
Definition keyboard_class.c:473
usb_keyboard_class_send_report
usb_sts_type usb_keyboard_class_send_report(void *udev, uint8_t *report, uint16_t len)
usb device class send report
Definition keyboard_class.c:450
keyboard_class_handler
usbd_class_handler keyboard_class_handler
Definition keyboard_class.c:188
usb_sts_type
usb_sts_type
usb return status
Definition usb_std.h:285
keyboard_type
Definition keyboard_class.h:66
keyboard_type::hid_set_idle
uint32_t hid_set_idle
Definition keyboard_class.h:68
keyboard_type::send_state
uint8_t send_state
Definition keyboard_class.h:75
keyboard_type::alt_setting
uint32_t alt_setting
Definition keyboard_class.h:69
keyboard_type::temp
uint8_t temp
Definition keyboard_class.h:77
keyboard_type::hid_state
uint8_t hid_state
Definition keyboard_class.h:76
keyboard_type::g_u8tx_completed
__IO uint8_t g_u8tx_completed
Definition keyboard_class.h:74
keyboard_type::hid_protocol
uint32_t hid_protocol
Definition keyboard_class.h:67
keyboard_type::hid_suspend_flag
__IO uint8_t hid_suspend_flag
Definition keyboard_class.h:73
usbd_class_handler
usb device class handler
Definition usbd_core.h:97
usb_std.h
usb standard header file
usbd_core.h
usb device core header file


AT32F413 Firmwary Library: keyboard_desc.c Source File

  • middlewares
  • usbd_class
  • keyboard
keyboard_desc.c
Go to the documentation of this file.
1
25#include "usb_std.h"
26#include "usbd_sdr.h"
27#include "usbd_core.h"
28#include "keyboard_desc.h"
29
43static usbd_desc_t *get_device_descriptor(void);
44static usbd_desc_t *get_device_qualifier(void);
45static usbd_desc_t *get_device_configuration(void);
46static usbd_desc_t *get_device_other_speed(void);
47static usbd_desc_t *get_device_lang_id(void);
48static usbd_desc_t *get_device_manufacturer_string(void);
49static usbd_desc_t *get_device_product_string(void);
50static usbd_desc_t *get_device_serial_string(void);
51static usbd_desc_t *get_device_interface_string(void);
52static usbd_desc_t *get_device_config_string(void);
53
54static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf);
55static void usbd_int_to_unicode (uint32_t value , uint8_t *pbuf , uint8_t len);
56static void get_serial_num(void);
57#if defined ( __ICCARM__ ) /* iar compiler */
58 #pragma data_alignment=4
59#endif
60ALIGNED_HEAD static uint8_t g_usbd_desc_buffer[256] ALIGNED_TAIL;
61
65 usbd_desc_handler keyboard_desc_handler =
66{
67 get_device_descriptor,
68 get_device_qualifier,
69 get_device_configuration,
70 get_device_other_speed,
71 get_device_lang_id,
72 get_device_manufacturer_string,
73 get_device_product_string,
74 get_device_serial_string,
75 get_device_interface_string,
76 get_device_config_string,
77};
78
82#if defined ( __ICCARM__ ) /* iar compiler */
83 #pragma data_alignment=4
84#endif
85ALIGNED_HEAD static uint8_t g_usbd_descriptor[USB_DEVICE_DESC_LEN] ALIGNED_TAIL =
86{
87 USB_DEVICE_DESC_LEN, /* bLength */
88 USB_DESCIPTOR_TYPE_DEVICE, /* bDescriptorType */
89 0x00, /* bcdUSB */
90 0x02,
91 0x00, /* bDeviceClass */
92 0x00, /* bDeviceSubClass */
93 0x00, /* bDeviceProtocol */
94 USB_MAX_EP0_SIZE, /* bMaxPacketSize */
95 LBYTE(USBD_KEYBOARD_VENDOR_ID), /* idVendor */
96 HBYTE(USBD_KEYBOARD_VENDOR_ID), /* idVendor */
97 LBYTE(USBD_KEYBOARD_PRODUCT_ID), /* idProduct */
98 HBYTE(USBD_KEYBOARD_PRODUCT_ID), /* idProduct */
99 0x00, /* bcdDevice rel. 2.00 */
100 0x02,
101 USB_MFC_STRING, /* Index of manufacturer string */
102 USB_PRODUCT_STRING, /* Index of product string */
103 USB_SERIAL_STRING, /* Index of serial number string */
104 1 /* bNumConfigurations */
105};
106
110#if defined ( __ICCARM__ ) /* iar compiler */
111 #pragma data_alignment=4
112#endif
113ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_KEYBOARD_CONFIG_DESC_SIZE] ALIGNED_TAIL =
114{
115 USB_DEVICE_CFG_DESC_LEN, /* bLength: configuration descriptor size */
116 USB_DESCIPTOR_TYPE_CONFIGURATION, /* bDescriptorType: configuration */
117 LBYTE(USBD_KEYBOARD_CONFIG_DESC_SIZE), /* wTotalLength: bytes returned */
118 HBYTE(USBD_KEYBOARD_CONFIG_DESC_SIZE), /* wTotalLength: bytes returned */
119 0x01, /* bNumInterfaces: 1 interface */
120 0x01, /* bConfigurationValue: configuration value */
121 0x00, /* iConfiguration: index of string descriptor describing
122 the configuration */
123 0xE0, /* bmAttributes: self powered and support remote wakeup*/
124 0x32, /* MaxPower 100 mA: this current is used for detecting vbus */
125
126 USB_DEVICE_IF_DESC_LEN, /* bLength: interface descriptor size */
127 USB_DESCIPTOR_TYPE_INTERFACE, /* bDescriptorType: interface descriptor type */
128 0x00, /* bInterfaceNumber: number of interface */
129 0x00, /* bAlternateSetting: alternate set */
130 0x01, /* bNumEndpoints: number of endpoints */
131 USB_CLASS_CODE_HID, /* bInterfaceClass: class code hid */
132 0x01, /* bInterfaceSubClass: subclass code */
133 0x01, /* bInterfaceProtocol: protocol code */
134 0x00, /* iInterface: index of string descriptor */
135
136 0x09, /* bLength: size of HID descriptor in bytes */
137 HID_CLASS_DESC_HID, /* bDescriptorType: HID descriptor type */
138 LBYTE(KEYBOARD_BCD_NUM),
139 HBYTE(KEYBOARD_BCD_NUM), /* bcdHID: HID class specification release number */
140 0x00, /* bCountryCode: hardware target conutry */
141 0x01, /* bNumDescriptors: number of HID class descriptor to follow */
142 HID_CLASS_DESC_REPORT, /* bDescriptorType: report descriptor type */
143 LBYTE(sizeof(g_usbd_keyboard_report)),
144 HBYTE(sizeof(g_usbd_keyboard_report)), /* wDescriptorLength: total length of reprot descriptor */
145
146 USB_DEVICE_EPT_LEN, /* bLength: size of endpoint descriptor in bytes */
147 USB_DESCIPTOR_TYPE_ENDPOINT, /* bDescriptorType: endpoint descriptor type */
148 USBD_KEYBOARD_IN_EPT, /* bEndpointAddress: the address of endpoint on usb device described by this descriptor */
149 USB_EPT_DESC_INTERRUPT, /* bmAttributes: endpoint attributes */
150 LBYTE(USBD_KEYBOARD_IN_MAXPACKET_SIZE),
151 HBYTE(USBD_KEYBOARD_IN_MAXPACKET_SIZE), /* wMaxPacketSize: maximum packe size this endpoint */
152 KEYBOARD_BINTERVAL_TIME, /* bInterval: interval for polling endpoint for data transfers */
153};
154
158#if defined ( __ICCARM__ ) /* iar compiler */
159 #pragma data_alignment=4
160#endif
161ALIGNED_HEAD uint8_t g_usbd_keyboard_report[USBD_KEYBOARD_SIZ_REPORT_DESC] ALIGNED_TAIL =
162{
163 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
164 0x09, 0x06, // USAGE (Keyboard)
165 0xa1, 0x01, // COLLECTION (Application)
166 0x05, 0x07, // USAGE_PAGE (Keyboard)
167 0x19, 0xe0, // USAGE_MINIMUM (Keyboard LeftControl)
168 0x29, 0xe7, // USAGE_MAXIMUM (Keyboard Right GUI)
169 0x15, 0x00, // LOGICAL_MINIMUM (0)
170 0x25, 0x01, // LOGICAL_MAXIMUM (1)
171 0x75, 0x01, // REPORT_SIZE (1)
172 0x95, 0x08, // REPORT_COUNT (8)
173 0x81, 0x02, // INPUT (Data,Var,Abs)
174 0x95, 0x01, // REPORT_COUNT (1)
175 0x75, 0x08, // REPORT_SIZE (8)
176 0x81, 0x03, // INPUT (Cnst,Var,Abs)
177 0x95, 0x05, // REPORT_COUNT (5)
178 0x75, 0x01, // REPORT_SIZE (1)
179 0x05, 0x08, // USAGE_PAGE (LEDs)
180 0x19, 0x01, // USAGE_MINIMUM (Num Lock)
181 0x29, 0x05, // USAGE_MAXIMUM (Kana)
182 0x91, 0x02, // OUTPUT (Data,Var,Abs)
183 0x95, 0x01, // REPORT_COUNT (1)
184 0x75, 0x03, // REPORT_SIZE (3)
185 0x91, 0x03, // OUTPUT (Cnst,Var,Abs)
186 0x95, 0x06, // REPORT_COUNT (6)
187 0x75, 0x08, // REPORT_SIZE (8)
188 0x15, 0x00, // LOGICAL_MINIMUM (0)
189 0x25, 0xFF, // LOGICAL_MAXIMUM (255)
190 0x05, 0x07, // USAGE_PAGE (Keyboard)
191 0x19, 0x00, // USAGE_MINIMUM (Reserved (no event indicated))
192 0x29, 0x65, // USAGE_MAXIMUM (Keyboard Application)
193 0x81, 0x00, // INPUT (Data,Ary,Abs)
194 0xc0 // END_COLLECTION
195};
196
200#if defined ( __ICCARM__ ) /* iar compiler */
201 #pragma data_alignment=4
202#endif
203ALIGNED_HEAD uint8_t g_keyboard_usb_desc[9] ALIGNED_TAIL =
204{
205 0x09, /* bLength: size of HID descriptor in bytes */
206 HID_CLASS_DESC_HID, /* bDescriptorType: HID descriptor type */
207 LBYTE(KEYBOARD_BCD_NUM),
208 HBYTE(KEYBOARD_BCD_NUM), /* bcdHID: HID class specification release number */
209 0x00, /* bCountryCode: hardware target conutry */
210 0x01, /* bNumDescriptors: number of HID class descriptor to follow */
211 HID_CLASS_DESC_REPORT, /* bDescriptorType: report descriptor type */
212 LBYTE(sizeof(g_usbd_keyboard_report)),
213 HBYTE(sizeof(g_usbd_keyboard_report)), /* wDescriptorLength: total length of reprot descriptor */
214};
215
216
220#if defined ( __ICCARM__ ) /* iar compiler */
221 #pragma data_alignment=4
222#endif
223ALIGNED_HEAD static uint8_t g_string_lang_id[USBD_KEYBOARD_SIZ_STRING_LANGID] ALIGNED_TAIL =
224{
225 USBD_KEYBOARD_SIZ_STRING_LANGID,
226 USB_DESCIPTOR_TYPE_STRING,
227 0x09,
228 0x04,
229};
230
234#if defined ( __ICCARM__ ) /* iar compiler */
235 #pragma data_alignment=4
236#endif
237ALIGNED_HEAD static uint8_t g_string_serial[USBD_KEYBOARD_SIZ_STRING_SERIAL] ALIGNED_TAIL =
238{
239 USBD_KEYBOARD_SIZ_STRING_SERIAL,
240 USB_DESCIPTOR_TYPE_STRING,
241};
242
243
244/* device descriptor */
245static usbd_desc_t device_descriptor =
246{
247 USB_DEVICE_DESC_LEN,
248 g_usbd_descriptor
249};
250
251/* config descriptor */
252static usbd_desc_t config_descriptor =
253{
254 USBD_KEYBOARD_CONFIG_DESC_SIZE,
255 g_usbd_configuration
256};
257
258/* langid descriptor */
259static usbd_desc_t langid_descriptor =
260{
261 USBD_KEYBOARD_SIZ_STRING_LANGID,
262 g_string_lang_id
263};
264
265/* serial descriptor */
266static usbd_desc_t serial_descriptor =
267{
268 USBD_KEYBOARD_SIZ_STRING_SERIAL,
269 g_string_serial
270};
271
272static usbd_desc_t vp_desc;
273
280static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf)
281{
282 uint16_t str_len = 0, id_pos = 2;
283 uint8_t *tmp_str = string;
284
285 while(*tmp_str != '\0')
286 {
287 str_len ++;
288 unicode_buf[id_pos ++] = *tmp_str ++;
289 unicode_buf[id_pos ++] = 0x00;
290 }
291
292 str_len = str_len * 2 + 2;
293 unicode_buf[0] = str_len;
294 unicode_buf[1] = USB_DESCIPTOR_TYPE_STRING;
295
296 return str_len;
297}
298
306static void usbd_int_to_unicode (uint32_t value , uint8_t *pbuf , uint8_t len)
307{
308 uint8_t idx = 0;
309
310 for( idx = 0 ; idx < len ; idx ++)
311 {
312 if( ((value >> 28)) < 0xA )
313 {
314 pbuf[ 2 * idx] = (value >> 28) + '0';
315 }
316 else
317 {
318 pbuf[2 * idx] = (value >> 28) + 'A' - 10;
319 }
320
321 value = value << 4;
322
323 pbuf[2 * idx + 1] = 0;
324 }
325}
326
332static void get_serial_num(void)
333{
334 uint32_t serial0, serial1, serial2;
335
336 serial0 = *(uint32_t*)MCU_ID1;
337 serial1 = *(uint32_t*)MCU_ID2;
338 serial2 = *(uint32_t*)MCU_ID3;
339
340 serial0 += serial2;
341
342 if (serial0 != 0)
343 {
344 usbd_int_to_unicode (serial0, &g_string_serial[2] ,8);
345 usbd_int_to_unicode (serial1, &g_string_serial[18] ,4);
346 }
347}
348
354static usbd_desc_t *get_device_descriptor(void)
355{
356 return &device_descriptor;
357}
358
364static usbd_desc_t * get_device_qualifier(void)
365{
366 return NULL;
367}
368
374static usbd_desc_t *get_device_configuration(void)
375{
376 return &config_descriptor;
377}
378
384static usbd_desc_t *get_device_other_speed(void)
385{
386 return NULL;
387}
388
394static usbd_desc_t *get_device_lang_id(void)
395{
396 return &langid_descriptor;
397}
398
399
405static usbd_desc_t *get_device_manufacturer_string(void)
406{
407 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_KEYBOARD_DESC_MANUFACTURER_STRING, g_usbd_desc_buffer);
408 vp_desc.descriptor = g_usbd_desc_buffer;
409 return &vp_desc;
410}
411
417static usbd_desc_t *get_device_product_string(void)
418{
419 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_KEYBOARD_DESC_PRODUCT_STRING, g_usbd_desc_buffer);
420 vp_desc.descriptor = g_usbd_desc_buffer;
421 return &vp_desc;
422}
423
429static usbd_desc_t *get_device_serial_string(void)
430{
431 get_serial_num();
432 return &serial_descriptor;
433}
434
440static usbd_desc_t *get_device_interface_string(void)
441{
442 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_KEYBOARD_DESC_INTERFACE_STRING, g_usbd_desc_buffer);
443 vp_desc.descriptor = g_usbd_desc_buffer;
444 return &vp_desc;
445}
446
452static usbd_desc_t *get_device_config_string(void)
453{
454 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_KEYBOARD_DESC_CONFIGURATION_STRING, g_usbd_desc_buffer);
455 vp_desc.descriptor = g_usbd_desc_buffer;
456 return &vp_desc;
457}
458
NULL
#define NULL
Definition emmc_card/inc/at32_sdio.h:340
MCU_ID1
#define MCU_ID1
Definition audio_desc.h:214
MCU_ID2
#define MCU_ID2
Definition audio_desc.h:215
MCU_ID3
#define MCU_ID3
Definition audio_desc.h:216
HID_CLASS_DESC_HID
#define HID_CLASS_DESC_HID
usb hid class descriptor define
Definition audio_hid_desc.h:214
HID_CLASS_DESC_REPORT
#define HID_CLASS_DESC_REPORT
Definition audio_hid_desc.h:215
USBD_KEYBOARD_IN_MAXPACKET_SIZE
#define USBD_KEYBOARD_IN_MAXPACKET_SIZE
usb hid in and out max packet size define
Definition keyboard_class.h:57
USBD_KEYBOARD_IN_EPT
#define USBD_KEYBOARD_IN_EPT
usb hid use endpoint define
Definition keyboard_class.h:52
USBD_KEYBOARD_VENDOR_ID
#define USBD_KEYBOARD_VENDOR_ID
usb vendor id and product id define
Definition keyboard_desc.h:57
USBD_KEYBOARD_DESC_CONFIGURATION_STRING
#define USBD_KEYBOARD_DESC_CONFIGURATION_STRING
Definition keyboard_desc.h:73
USBD_KEYBOARD_CONFIG_DESC_SIZE
#define USBD_KEYBOARD_CONFIG_DESC_SIZE
usb descriptor size define
Definition keyboard_desc.h:63
USBD_KEYBOARD_SIZ_STRING_LANGID
#define USBD_KEYBOARD_SIZ_STRING_LANGID
Definition keyboard_desc.h:65
USBD_KEYBOARD_DESC_MANUFACTURER_STRING
#define USBD_KEYBOARD_DESC_MANUFACTURER_STRING
usb string define(vendor, product configuration, interface)
Definition keyboard_desc.h:71
USBD_KEYBOARD_SIZ_REPORT_DESC
#define USBD_KEYBOARD_SIZ_REPORT_DESC
Definition keyboard_desc.h:64
KEYBOARD_BCD_NUM
#define KEYBOARD_BCD_NUM
usb bcd number define
Definition keyboard_desc.h:52
KEYBOARD_BINTERVAL_TIME
#define KEYBOARD_BINTERVAL_TIME
usb hid endpoint interval define
Definition keyboard_desc.h:79
USBD_KEYBOARD_DESC_PRODUCT_STRING
#define USBD_KEYBOARD_DESC_PRODUCT_STRING
Definition keyboard_desc.h:72
USBD_KEYBOARD_SIZ_STRING_SERIAL
#define USBD_KEYBOARD_SIZ_STRING_SERIAL
Definition keyboard_desc.h:66
USBD_KEYBOARD_PRODUCT_ID
#define USBD_KEYBOARD_PRODUCT_ID
Definition keyboard_desc.h:58
USBD_KEYBOARD_DESC_INTERFACE_STRING
#define USBD_KEYBOARD_DESC_INTERFACE_STRING
Definition keyboard_desc.h:74
serial_descriptor
static usbd_desc_t serial_descriptor
Definition keyboard_desc.c:266
device_descriptor
static usbd_desc_t device_descriptor
Definition keyboard_desc.c:245
get_device_configuration
static usbd_desc_t * get_device_configuration(void)
get config descriptor
Definition keyboard_desc.c:374
langid_descriptor
static usbd_desc_t langid_descriptor
Definition keyboard_desc.c:259
get_device_descriptor
static usbd_desc_t * get_device_descriptor(void)
get device descriptor
Definition keyboard_desc.c:354
get_device_manufacturer_string
static usbd_desc_t * get_device_manufacturer_string(void)
get manufacturer descriptor
Definition keyboard_desc.c:405
get_device_qualifier
static usbd_desc_t * get_device_qualifier(void)
get device qualifier
Definition keyboard_desc.c:364
get_device_interface_string
static usbd_desc_t * get_device_interface_string(void)
get interface descriptor
Definition keyboard_desc.c:440
vp_desc
static usbd_desc_t vp_desc
Definition keyboard_desc.c:272
get_device_other_speed
static usbd_desc_t * get_device_other_speed(void)
get other speed descriptor
Definition keyboard_desc.c:384
ALIGNED_TAIL
static ALIGNED_HEAD uint8_t g_usbd_desc_buffer[256] ALIGNED_TAIL
usb device standard descriptor
Definition keyboard_desc.c:60
get_device_product_string
static usbd_desc_t * get_device_product_string(void)
get product descriptor
Definition keyboard_desc.c:417
keyboard_desc_handler
usbd_desc_handler keyboard_desc_handler
keyboard device descriptor handler structure
Definition keyboard_desc.c:65
get_device_config_string
static usbd_desc_t * get_device_config_string(void)
get device config descriptor
Definition keyboard_desc.c:452
usbd_unicode_convert
static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf)
standard usb unicode convert
Definition keyboard_desc.c:280
get_device_lang_id
static usbd_desc_t * get_device_lang_id(void)
get lang id descriptor
Definition keyboard_desc.c:394
get_serial_num
static void get_serial_num(void)
usb get serial number
Definition keyboard_desc.c:332
config_descriptor
static usbd_desc_t config_descriptor
Definition keyboard_desc.c:252
get_device_serial_string
static usbd_desc_t * get_device_serial_string(void)
get serial descriptor
Definition keyboard_desc.c:429
usbd_int_to_unicode
static void usbd_int_to_unicode(uint32_t value, uint8_t *pbuf, uint8_t len)
usb int convert to unicode
Definition keyboard_desc.c:306
g_keyboard_usb_desc
uint8_t g_keyboard_usb_desc[9]
g_usbd_keyboard_report
uint8_t g_usbd_keyboard_report[63]
HBYTE
#define HBYTE(x)
Definition usb_std.h:271
USB_DEVICE_EPT_LEN
#define USB_DEVICE_EPT_LEN
Definition usb_std.h:159
USB_MAX_EP0_SIZE
#define USB_MAX_EP0_SIZE
endpoint 0 max size
Definition usb_std.h:248
USB_PRODUCT_STRING
#define USB_PRODUCT_STRING
Definition usb_std.h:105
USB_DESCIPTOR_TYPE_CONFIGURATION
#define USB_DESCIPTOR_TYPE_CONFIGURATION
Definition usb_std.h:92
LBYTE
#define LBYTE(x)
low byte and high byte define
Definition usb_std.h:270
USB_DESCIPTOR_TYPE_ENDPOINT
#define USB_DESCIPTOR_TYPE_ENDPOINT
Definition usb_std.h:95
USB_DEVICE_DESC_LEN
#define USB_DEVICE_DESC_LEN
Definition usb_std.h:156
USB_MFC_STRING
#define USB_MFC_STRING
Definition usb_std.h:104
USB_DEVICE_IF_DESC_LEN
#define USB_DEVICE_IF_DESC_LEN
Definition usb_std.h:158
USB_DEVICE_CFG_DESC_LEN
#define USB_DEVICE_CFG_DESC_LEN
Definition usb_std.h:157
USB_EPT_DESC_INTERRUPT
#define USB_EPT_DESC_INTERRUPT
Definition usb_std.h:184
USB_SERIAL_STRING
#define USB_SERIAL_STRING
Definition usb_std.h:106
USB_DESCIPTOR_TYPE_DEVICE
#define USB_DESCIPTOR_TYPE_DEVICE
usb standard device type
Definition usb_std.h:91
USB_DESCIPTOR_TYPE_STRING
#define USB_DESCIPTOR_TYPE_STRING
Definition usb_std.h:93
USB_DESCIPTOR_TYPE_INTERFACE
#define USB_DESCIPTOR_TYPE_INTERFACE
Definition usb_std.h:94
USB_CLASS_CODE_HID
#define USB_CLASS_CODE_HID
Definition usb_std.h:169
keyboard_desc.h
usb keyboard descriptor header file
usbd_desc_handler
usb device descriptor handler
Definition usbd_core.h:75
usbd_desc_t
usb device descriptor struct
Definition usbd_core.h:66
usbd_desc_t::length
uint16_t length
Definition usbd_core.h:67
usbd_desc_t::descriptor
uint8_t * descriptor
Definition usbd_core.h:68
usb_std.h
usb standard header file
usbd_core.h
usb device core header file
usbd_sdr.h
usb standard request header file


AT32F413 Firmwary Library: keyboard_desc.h Source File

  • middlewares
  • usbd_class
  • keyboard
keyboard_desc.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __KEYBOARD_DESC_H
28#define __KEYBOARD_DESC_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "keyboard_class.h"
35#include "usbd_core.h"
36
52#define KEYBOARD_BCD_NUM 0x0110
53
57#define USBD_KEYBOARD_VENDOR_ID 0x2E3C
58#define USBD_KEYBOARD_PRODUCT_ID 0x6040
59
63#define USBD_KEYBOARD_CONFIG_DESC_SIZE 34
64#define USBD_KEYBOARD_SIZ_REPORT_DESC 63
65#define USBD_KEYBOARD_SIZ_STRING_LANGID 4
66#define USBD_KEYBOARD_SIZ_STRING_SERIAL 0x1A
67
71#define USBD_KEYBOARD_DESC_MANUFACTURER_STRING "Artery"
72#define USBD_KEYBOARD_DESC_PRODUCT_STRING "Keyboard"
73#define USBD_KEYBOARD_DESC_CONFIGURATION_STRING "Keyboard Config"
74#define USBD_KEYBOARD_DESC_INTERFACE_STRING "Keyboard Interface"
75
79#define KEYBOARD_BINTERVAL_TIME 0x0A
80
84#define MCU_ID1 (0x1FFFF7E8)
85#define MCU_ID2 (0x1FFFF7EC)
86#define MCU_ID3 (0x1FFFF7F0)
87
91extern uint8_t g_usbd_keyboard_report[USBD_KEYBOARD_SIZ_REPORT_DESC];
92extern uint8_t g_keyboard_usb_desc[9];
93extern usbd_desc_handler keyboard_desc_handler;
94
102#ifdef __cplusplus
103}
104#endif
105
106#endif
107
108
USBD_KEYBOARD_SIZ_REPORT_DESC
#define USBD_KEYBOARD_SIZ_REPORT_DESC
Definition keyboard_desc.h:64
keyboard_desc_handler
usbd_desc_handler keyboard_desc_handler
keyboard device descriptor handler structure
Definition keyboard_desc.c:65
g_keyboard_usb_desc
uint8_t g_keyboard_usb_desc[9]
g_usbd_keyboard_report
uint8_t g_usbd_keyboard_report[63]
keyboard_class.h
usb hid keyboard header file
usbd_desc_handler
usb device descriptor handler
Definition usbd_core.h:75
usbd_core.h
usb device core header file


AT32F413 Firmwary Library: main_page.h Source File

  • main_page
main_page.h
Go to the documentation of this file.
1


AT32F413 Firmwary Library: mouse_class.c Source File

  • middlewares
  • usbd_class
  • mouse
mouse_class.c
Go to the documentation of this file.
1
25#include "usbd_core.h"
26#include "mouse_class.h"
27#include "mouse_desc.h"
28
42static usb_sts_type class_init_handler(void *udev);
43static usb_sts_type class_clear_handler(void *udev);
44static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup);
45static usb_sts_type class_ept0_tx_handler(void *udev);
46static usb_sts_type class_ept0_rx_handler(void *udev);
47static usb_sts_type class_in_handler(void *udev, uint8_t ept_num);
48static usb_sts_type class_out_handler(void *udev, uint8_t ept_num);
49static usb_sts_type class_sof_handler(void *udev);
50static usb_sts_type class_event_handler(void *udev, usbd_event_type event);
51
52 mouse_type mouse_struct;
53
54/* usb device class handler */
55 usbd_class_handler mouse_class_handler =
56{
57 class_init_handler,
58 class_clear_handler,
59 class_setup_handler,
60 class_ept0_tx_handler,
61 class_ept0_rx_handler,
62 class_in_handler,
63 class_out_handler,
64 class_sof_handler,
65 class_event_handler,
66 &mouse_struct
67};
68
74static usb_sts_type class_init_handler(void *udev)
75{
76 usb_sts_type status = USB_OK;
77 usbd_core_type *pudev = (usbd_core_type *)udev;
78 mouse_type *pmouse = (mouse_type *)pudev->class_handler->pdata;
79
80#ifndef USB_EPT_AUTO_MALLOC_BUFFER
81 /* use user define buffer address */
82 usbd_ept_buf_custom_define(pudev, USBD_MOUSE_IN_EPT, EPT1_TX_ADDR);
83#endif
84
85 /* open hid in endpoint */
86 usbd_ept_open(pudev, USBD_MOUSE_IN_EPT, EPT_INT_TYPE, USBD_MOUSE_IN_MAXPACKET_SIZE);
87
88 pmouse->send_state = 0;
89
90 return status;
91}
92
98static usb_sts_type class_clear_handler(void *udev)
99{
100 usb_sts_type status = USB_OK;
101 usbd_core_type *pudev = (usbd_core_type *)udev;
102
103 /* close hid in endpoint */
104 usbd_ept_close(pudev, USBD_MOUSE_IN_EPT);
105
106 return status;
107}
108
115static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
116{
117 usb_sts_type status = USB_OK;
118 usbd_core_type *pudev = (usbd_core_type *)udev;
119 mouse_type *pmouse = (mouse_type *)pudev->class_handler->pdata;
120 uint16_t len;
121 uint8_t *buf;
122
123 switch(setup->bmRequestType & USB_REQ_TYPE_RESERVED)
124 {
125 /* class request */
126 case USB_REQ_TYPE_CLASS:
127 switch(setup->bRequest)
128 {
129 case HID_REQ_SET_PROTOCOL:
130 pmouse->hid_protocol = (uint8_t)setup->wValue;
131 break;
132 case HID_REQ_GET_PROTOCOL:
133 usbd_ctrl_send(pudev, (uint8_t *)&pmouse->hid_protocol, 1);
134 break;
135 case HID_REQ_SET_IDLE:
136 pmouse->hid_set_idle = (uint8_t)(setup->wValue >> 8);
137 break;
138 case HID_REQ_GET_IDLE:
139 usbd_ctrl_send(pudev, (uint8_t *)&pmouse->hid_set_idle, 1);
140 break;
141 case HID_REQ_SET_REPORT:
142 pmouse->hid_state = HID_REQ_SET_REPORT;
143 usbd_ctrl_recv(pudev, pmouse->hid_set_report, setup->wLength);
144 break;
145 default:
146 usbd_ctrl_unsupport(pudev);
147 break;
148 }
149 break;
150 /* standard request */
151 case USB_REQ_TYPE_STANDARD:
152 switch(setup->bRequest)
153 {
154 case USB_STD_REQ_GET_DESCRIPTOR:
155 if(setup->wValue >> 8 == HID_REPORT_DESC)
156 {
157 len = MIN(USBD_MOUSE_SIZ_REPORT_DESC, setup->wLength);
158 buf = (uint8_t *)g_usbd_mouse_report;
159 usbd_ctrl_send(pudev, (uint8_t *)buf, len);
160 }
161 else if(setup->wValue >> 8 == HID_DESCRIPTOR_TYPE)
162 {
163 len = MIN(9, setup->wLength);
164 buf = (uint8_t *)g_mouse_usb_desc;
165 usbd_ctrl_send(pudev, (uint8_t *)buf, len);
166 }
167 else
168 {
169 usbd_ctrl_unsupport(pudev);
170 }
171 break;
172 case USB_STD_REQ_GET_INTERFACE:
173 usbd_ctrl_send(pudev, (uint8_t *)&pmouse->alt_setting, 1);
174 break;
175 case USB_STD_REQ_SET_INTERFACE:
176 pmouse->alt_setting = setup->wValue;
177 break;
178 case USB_STD_REQ_CLEAR_FEATURE:
179 break;
180 case USB_STD_REQ_SET_FEATURE:
181 break;
182 default:
183 usbd_ctrl_unsupport(pudev);
184 break;
185 }
186 break;
187 default:
188 usbd_ctrl_unsupport(pudev);
189 break;
190 }
191 return status;
192}
193
199static usb_sts_type class_ept0_tx_handler(void *udev)
200{
201 usb_sts_type status = USB_OK;
202
203 /* ...user code... */
204
205 return status;
206}
207
213static usb_sts_type class_ept0_rx_handler(void *udev)
214{
215 usb_sts_type status = USB_OK;
216 usbd_core_type *pudev = (usbd_core_type *)udev;
217 mouse_type *pmouse = (mouse_type *)pudev->class_handler->pdata;
218 uint32_t recv_len = usbd_get_recv_len(pudev, 0);
219 /* ...user code... */
220 if( pmouse->hid_state == HID_REQ_SET_REPORT)
221 {
222 /* hid buffer process */
223 pmouse->hid_state = 0;
224 }
225
226 return status;
227}
228
235static usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
236{
237 usb_sts_type status = USB_OK;
238 usbd_core_type *pudev = (usbd_core_type *)udev;
239 mouse_type *pmouse = (mouse_type *)pudev->class_handler->pdata;
240
241 /* ...user code...
242 trans next packet data
243 */
244 pmouse->send_state = 0;
245 return status;
246}
247
254static usb_sts_type class_out_handler(void *udev, uint8_t ept_num)
255{
256 usb_sts_type status = USB_OK;
257
258 return status;
259}
260
266static usb_sts_type class_sof_handler(void *udev)
267{
268 usb_sts_type status = USB_OK;
269
270 /* ...user code... */
271
272 return status;
273}
274
281static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
282{
283 usb_sts_type status = USB_OK;
284 usbd_core_type *pudev = (usbd_core_type *)udev;
285 mouse_type *pmouse = (mouse_type *)pudev->class_handler->pdata;
286 switch(event)
287 {
288 case USBD_RESET_EVENT:
289
290 /* ...user code... */
291
292 break;
293 case USBD_SUSPEND_EVENT:
294 pmouse->hid_suspend_flag = 1;
295 /* ...user code... */
296
297 break;
298 case USBD_WAKEUP_EVENT:
299 /* ...user code... */
300
301 break;
302 default:
303 break;
304 }
305 return status;
306}
307
315 usb_sts_type usb_mouse_class_send_report(void *udev, uint8_t *report, uint16_t len)
316{
317 usb_sts_type status = USB_FAIL;
318 usbd_core_type *pudev = (usbd_core_type *)udev;
319 mouse_type *pmouse = (mouse_type *)pudev->class_handler->pdata;
320
321 if(usbd_connect_state_get(pudev) == USB_CONN_STATE_CONFIGURED && pmouse->send_state == 0)
322 {
323 pmouse->send_state = 1;
324 usbd_ept_send(pudev, USBD_MOUSE_IN_EPT, report, len);
325 status = USB_OK;
326 }
327
328 return status;
329}
330
337void usb_hid_mouse_send(void *udev, uint8_t op)
338{
339 usbd_core_type *pudev = (usbd_core_type *)udev;
340 mouse_type *pmouse = (mouse_type *)pudev->class_handler->pdata;
341 int8_t posx = 0, posy = 0, button = 0;
342 switch(op)
343 {
344 case LEFT_BUTTON:
345 button = 0x01;
346 break;
347
348 case RIGHT_BUTTON:
349 button = 0x2;
350 break;
351
352 case UP_MOVE:
353 posy -= MOVE_STEP;
354 break;
355
356 case DOWN_MOVE:
357 posy += MOVE_STEP;
358 break;
359
360 case LEFT_MOVE:
361 posx -= MOVE_STEP;
362 break;
363
364 case RIGHT_MOVE:
365 posx += MOVE_STEP;
366 break;
367
368 default:
369 break;
370 }
371 pmouse->mouse_buffer[0] = button;
372 pmouse->mouse_buffer[1] = posx;
373 pmouse->mouse_buffer[2] = posy;
374
375 usb_mouse_class_send_report(udev, pmouse->mouse_buffer, 4);
376}
377
EPT1_TX_ADDR
#define EPT1_TX_ADDR
Definition project/at_start_f413/examples/acc/calibration/inc/usb_conf.h:76
EPT_INT_TYPE
@ EPT_INT_TYPE
Definition at32f413_usb.h:205
USBD_MOUSE_IN_EPT
#define USBD_MOUSE_IN_EPT
usb hid use endpoint define
Definition mouse_class.h:52
USBD_MOUSE_IN_MAXPACKET_SIZE
#define USBD_MOUSE_IN_MAXPACKET_SIZE
usb hid in and out max packet size define
Definition mouse_class.h:57
class_sof_handler
static usb_sts_type class_sof_handler(void *udev)
usb device class sof handler
Definition mouse_class.c:266
class_in_handler
static usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
usb device class transmision complete handler
Definition mouse_class.c:235
class_clear_handler
static usb_sts_type class_clear_handler(void *udev)
clear endpoint or other state
Definition mouse_class.c:98
class_setup_handler
static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
usb device class setup request handler
Definition mouse_class.c:115
class_ept0_tx_handler
static usb_sts_type class_ept0_tx_handler(void *udev)
usb device class endpoint 0 in status stage complete
Definition mouse_class.c:199
usb_mouse_class_send_report
usb_sts_type usb_mouse_class_send_report(void *udev, uint8_t *report, uint16_t len)
usb device class send report
Definition mouse_class.c:315
class_ept0_rx_handler
static usb_sts_type class_ept0_rx_handler(void *udev)
usb device class endpoint 0 out status stage complete
Definition mouse_class.c:213
mouse_struct
mouse_type mouse_struct
Definition mouse_class.c:52
class_event_handler
static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
usb device class event handler
Definition mouse_class.c:281
class_init_handler
static usb_sts_type class_init_handler(void *udev)
initialize usb endpoint
Definition mouse_class.c:74
class_out_handler
static usb_sts_type class_out_handler(void *udev, uint8_t ept_num)
usb device class endpoint receive data
Definition mouse_class.c:254
mouse_class_handler
usbd_class_handler mouse_class_handler
Definition mouse_class.c:55
usb_hid_mouse_send
void usb_hid_mouse_send(void *udev, uint8_t op)
usb device class report function
Definition mouse_class.c:337
MOVE_STEP
#define MOVE_STEP
usb hid mouse operation
Definition mouse_class.h:71
LEFT_MOVE
#define LEFT_MOVE
Definition mouse_class.h:76
DOWN_MOVE
#define DOWN_MOVE
Definition mouse_class.h:79
RIGHT_MOVE
#define RIGHT_MOVE
Definition mouse_class.h:77
LEFT_BUTTON
#define LEFT_BUTTON
Definition mouse_class.h:74
RIGHT_BUTTON
#define RIGHT_BUTTON
Definition mouse_class.h:75
UP_MOVE
#define UP_MOVE
Definition mouse_class.h:78
USBD_MOUSE_SIZ_REPORT_DESC
#define USBD_MOUSE_SIZ_REPORT_DESC
Definition mouse_desc.h:64
g_usbd_mouse_report
uint8_t g_usbd_mouse_report[74]
g_mouse_usb_desc
uint8_t g_mouse_usb_desc[9]
USB_STD_REQ_CLEAR_FEATURE
#define USB_STD_REQ_CLEAR_FEATURE
Definition usb_std.h:77
HID_DESCRIPTOR_TYPE
#define HID_DESCRIPTOR_TYPE
Definition usb_std.h:242
HID_REQ_GET_PROTOCOL
#define HID_REQ_GET_PROTOCOL
Definition usb_std.h:237
MIN
#define MIN(a, b)
min and max define
Definition usb_std.h:260
USB_REQ_TYPE_STANDARD
#define USB_REQ_TYPE_STANDARD
usb request type
Definition usb_std.h:62
USB_STD_REQ_GET_DESCRIPTOR
#define USB_STD_REQ_GET_DESCRIPTOR
Definition usb_std.h:80
HID_REQ_SET_PROTOCOL
#define HID_REQ_SET_PROTOCOL
usb hid class request code define
Definition usb_std.h:236
HID_REPORT_DESC
#define HID_REPORT_DESC
Definition usb_std.h:243
USB_STD_REQ_SET_FEATURE
#define USB_STD_REQ_SET_FEATURE
Definition usb_std.h:78
HID_REQ_SET_IDLE
#define HID_REQ_SET_IDLE
Definition usb_std.h:238
HID_REQ_GET_IDLE
#define HID_REQ_GET_IDLE
Definition usb_std.h:239
HID_REQ_SET_REPORT
#define HID_REQ_SET_REPORT
Definition usb_std.h:240
USB_STD_REQ_SET_INTERFACE
#define USB_STD_REQ_SET_INTERFACE
Definition usb_std.h:85
USB_REQ_TYPE_RESERVED
#define USB_REQ_TYPE_RESERVED
Definition usb_std.h:65
USB_STD_REQ_GET_INTERFACE
#define USB_STD_REQ_GET_INTERFACE
Definition usb_std.h:84
USB_REQ_TYPE_CLASS
#define USB_REQ_TYPE_CLASS
Definition usb_std.h:63
USB_CONN_STATE_CONFIGURED
@ USB_CONN_STATE_CONFIGURED
Definition usb_std.h:137
usb_sts_type
usb_sts_type
usb return status
Definition usb_std.h:285
USB_OK
@ USB_OK
Definition usb_std.h:286
USB_FAIL
@ USB_FAIL
Definition usb_std.h:287
usbd_connect_state_get
usbd_conn_state usbd_connect_state_get(usbd_core_type *udev)
get usb connect state
Definition usbd_core.c:595
usbd_ept_close
void usbd_ept_close(usbd_core_type *udev, uint8_t ept_addr)
usb close endpoint
Definition usbd_core.c:541
usbd_ept_buf_custom_define
void usbd_ept_buf_custom_define(usbd_core_type *udev, uint8_t ept_addr, uint32_t addr)
usb custom define endpoint buffer
Definition usbd_core.c:464
usbd_ept_open
void usbd_ept_open(usbd_core_type *udev, uint8_t ept_addr, uint8_t ept_type, uint16_t maxpacket)
usb open endpoint
Definition usbd_core.c:506
usbd_ctrl_send
void usbd_ctrl_send(usbd_core_type *udev, uint8_t *buffer, uint16_t len)
usb control endpoint send data
Definition usbd_core.c:175
usbd_get_recv_len
uint32_t usbd_get_recv_len(usbd_core_type *udev, uint8_t ept_addr)
usb endpoint get receive data length
Definition usbd_core.c:397
usbd_ctrl_recv
void usbd_ctrl_recv(usbd_core_type *udev, uint8_t *buffer, uint16_t len)
usb control endpoint receive data
Definition usbd_core.c:194
usbd_ctrl_unsupport
void usbd_ctrl_unsupport(usbd_core_type *udev)
un-support device request
Definition usbd_core.c:289
usbd_ept_send
void usbd_ept_send(usbd_core_type *udev, uint8_t ept_num, uint8_t *buffer, uint16_t len)
usb endpoint send data
Definition usbd_core.c:304
usbd_event_type
usbd_event_type
usb device event
Definition usbd_core.h:54
USBD_SUSPEND_EVENT
@ USBD_SUSPEND_EVENT
Definition usbd_core.h:57
USBD_RESET_EVENT
@ USBD_RESET_EVENT
Definition usbd_core.h:56
USBD_WAKEUP_EVENT
@ USBD_WAKEUP_EVENT
Definition usbd_core.h:58
mouse_class.h
usb hid mouse header file
mouse_desc.h
usb mouse descriptor header file
mouse_type
Definition mouse_class.h:82
mouse_type::hid_suspend_flag
__IO uint8_t hid_suspend_flag
Definition mouse_class.h:90
mouse_type::hid_protocol
uint32_t hid_protocol
Definition mouse_class.h:83
mouse_type::hid_set_idle
uint32_t hid_set_idle
Definition mouse_class.h:84
mouse_type::send_state
uint8_t send_state
Definition mouse_class.h:91
mouse_type::mouse_buffer
uint8_t mouse_buffer[4]
Definition mouse_class.h:88
mouse_type::hid_set_report
uint8_t hid_set_report[64]
Definition mouse_class.h:87
mouse_type::alt_setting
uint32_t alt_setting
Definition mouse_class.h:85
mouse_type::hid_state
uint8_t hid_state
Definition mouse_class.h:89
usb_setup_type
format of usb setup data
Definition usb_std.h:297
usb_setup_type::wValue
uint16_t wValue
Definition usb_std.h:300
usb_setup_type::wLength
uint16_t wLength
Definition usb_std.h:303
usb_setup_type::bmRequestType
uint8_t bmRequestType
Definition usb_std.h:298
usb_setup_type::bRequest
uint8_t bRequest
Definition usb_std.h:299
usbd_class_handler
usb device class handler
Definition usbd_core.h:97
usbd_class_handler::pdata
void * pdata
Definition usbd_core.h:107
usbd_core_type
usb device core struct type
Definition usbd_core.h:114
usbd_core_type::class_handler
usbd_class_handler * class_handler
Definition usbd_core.h:117
usbd_core.h
usb device core header file


AT32F413 Firmwary Library: mouse_class.h Source File

  • middlewares
  • usbd_class
  • mouse
mouse_class.h
Go to the documentation of this file.
1
26 /* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __MOUSE_CLASS_H
28#define __MOUSE_CLASS_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "usb_std.h"
35#include "usbd_core.h"
36
52#define USBD_MOUSE_IN_EPT 0x81
53
57#define USBD_MOUSE_IN_MAXPACKET_SIZE 0x40
58
71#define MOVE_STEP 20
72
73#define BUTTON_RELEASE 0
74#define LEFT_BUTTON 1
75#define RIGHT_BUTTON 2
76#define LEFT_MOVE 3
77#define RIGHT_MOVE 4
78#define UP_MOVE 5
79#define DOWN_MOVE 6
80
81typedef struct
82{
83 uint32_t hid_protocol;
84 uint32_t hid_set_idle;
85 uint32_t alt_setting;
86
87 uint8_t hid_set_report[64];
88 uint8_t mouse_buffer[4];
89 uint8_t hid_state;
90 __IO uint8_t hid_suspend_flag;
91 uint8_t send_state;
92}mouse_type;
93
101extern usbd_class_handler mouse_class_handler;
102 usb_sts_type usb_mouse_class_send_report(void *udev, uint8_t *report, uint16_t len);
103void usb_hid_mouse_send(void *udev, uint8_t op);
115#ifdef __cplusplus
116}
117#endif
118
119#endif
usb_mouse_class_send_report
usb_sts_type usb_mouse_class_send_report(void *udev, uint8_t *report, uint16_t len)
usb device class send report
Definition mouse_class.c:315
mouse_class_handler
usbd_class_handler mouse_class_handler
Definition mouse_class.c:55
usb_hid_mouse_send
void usb_hid_mouse_send(void *udev, uint8_t op)
usb device class report function
Definition mouse_class.c:337
usb_sts_type
usb_sts_type
usb return status
Definition usb_std.h:285
mouse_type
Definition mouse_class.h:82
mouse_type::hid_suspend_flag
__IO uint8_t hid_suspend_flag
Definition mouse_class.h:90
mouse_type::hid_protocol
uint32_t hid_protocol
Definition mouse_class.h:83
mouse_type::hid_set_idle
uint32_t hid_set_idle
Definition mouse_class.h:84
mouse_type::send_state
uint8_t send_state
Definition mouse_class.h:91
mouse_type::alt_setting
uint32_t alt_setting
Definition mouse_class.h:85
mouse_type::hid_state
uint8_t hid_state
Definition mouse_class.h:89
usbd_class_handler
usb device class handler
Definition usbd_core.h:97
usb_std.h
usb standard header file
usbd_core.h
usb device core header file


AT32F413 Firmwary Library: mouse_desc.c Source File

  • middlewares
  • usbd_class
  • mouse
mouse_desc.c
Go to the documentation of this file.
1
25#include "usb_std.h"
26#include "usbd_sdr.h"
27#include "usbd_core.h"
28#include "mouse_desc.h"
29
43static usbd_desc_t *get_device_descriptor(void);
44static usbd_desc_t *get_device_qualifier(void);
45static usbd_desc_t *get_device_configuration(void);
46static usbd_desc_t *get_device_other_speed(void);
47static usbd_desc_t *get_device_lang_id(void);
48static usbd_desc_t *get_device_manufacturer_string(void);
49static usbd_desc_t *get_device_product_string(void);
50static usbd_desc_t *get_device_serial_string(void);
51static usbd_desc_t *get_device_interface_string(void);
52static usbd_desc_t *get_device_config_string(void);
53
54static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf);
55static void usbd_int_to_unicode (uint32_t value , uint8_t *pbuf , uint8_t len);
56static void get_serial_num(void);
57#if defined ( __ICCARM__ ) /* iar compiler */
58 #pragma data_alignment=4
59#endif
60ALIGNED_HEAD static uint8_t g_usbd_desc_buffer[256] ALIGNED_TAIL;
61
65 usbd_desc_handler mouse_desc_handler =
66{
67 get_device_descriptor,
68 get_device_qualifier,
69 get_device_configuration,
70 get_device_other_speed,
71 get_device_lang_id,
72 get_device_manufacturer_string,
73 get_device_product_string,
74 get_device_serial_string,
75 get_device_interface_string,
76 get_device_config_string,
77};
78
82#if defined ( __ICCARM__ ) /* iar compiler */
83 #pragma data_alignment=4
84#endif
85ALIGNED_HEAD static uint8_t g_usbd_descriptor[USB_DEVICE_DESC_LEN] ALIGNED_TAIL =
86{
87 USB_DEVICE_DESC_LEN, /* bLength */
88 USB_DESCIPTOR_TYPE_DEVICE, /* bDescriptorType */
89 0x00, /* bcdUSB */
90 0x02,
91 0x00, /* bDeviceClass */
92 0x00, /* bDeviceSubClass */
93 0x00, /* bDeviceProtocol */
94 USB_MAX_EP0_SIZE, /* bMaxPacketSize */
95 LBYTE(USBD_MOUSE_VENDOR_ID), /* idVendor */
96 HBYTE(USBD_MOUSE_VENDOR_ID), /* idVendor */
97 LBYTE(USBD_MOUSE_PRODUCT_ID), /* idProduct */
98 HBYTE(USBD_MOUSE_PRODUCT_ID), /* idProduct */
99 0x00, /* bcdDevice rel. 2.00 */
100 0x02,
101 USB_MFC_STRING, /* Index of manufacturer string */
102 USB_PRODUCT_STRING, /* Index of product string */
103 USB_SERIAL_STRING, /* Index of serial number string */
104 1 /* bNumConfigurations */
105};
106
110#if defined ( __ICCARM__ ) /* iar compiler */
111 #pragma data_alignment=4
112#endif
113ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_MOUSE_CONFIG_DESC_SIZE] ALIGNED_TAIL =
114{
115 USB_DEVICE_CFG_DESC_LEN, /* bLength: configuration descriptor size */
116 USB_DESCIPTOR_TYPE_CONFIGURATION, /* bDescriptorType: configuration */
117 LBYTE(USBD_MOUSE_CONFIG_DESC_SIZE), /* wTotalLength: bytes returned */
118 HBYTE(USBD_MOUSE_CONFIG_DESC_SIZE), /* wTotalLength: bytes returned */
119 0x01, /* bNumInterfaces: 1 interface */
120 0x01, /* bConfigurationValue: configuration value */
121 0x00, /* iConfiguration: index of string descriptor describing
122 the configuration */
123 0xE0, /* bmAttributes: self powered and support remote wakeup*/
124 0x32, /* MaxPower 100 mA: this current is used for detecting vbus */
125
126 USB_DEVICE_IF_DESC_LEN, /* bLength: interface descriptor size */
127 USB_DESCIPTOR_TYPE_INTERFACE, /* bDescriptorType: interface descriptor type */
128 0x00, /* bInterfaceNumber: number of interface */
129 0x00, /* bAlternateSetting: alternate set */
130 0x01, /* bNumEndpoints: number of endpoints */
131 USB_CLASS_CODE_HID, /* bInterfaceClass: class code hid */
132 0x01, /* bInterfaceSubClass: subclass code */
133 0x02, /* bInterfaceProtocol: protocol code */
134 0x00, /* iInterface: index of string descriptor */
135
136 0x09, /* bLength: size of HID descriptor in bytes */
137 HID_CLASS_DESC_HID, /* bDescriptorType: HID descriptor type */
138 LBYTE(MOUSE_BCD_NUM),
139 HBYTE(MOUSE_BCD_NUM), /* bcdHID: HID class specification release number */
140 0x00, /* bCountryCode: hardware target conutry */
141 0x01, /* bNumDescriptors: number of HID class descriptor to follow */
142 HID_CLASS_DESC_REPORT, /* bDescriptorType: report descriptor type */
143 LBYTE(sizeof(g_usbd_mouse_report)),
144 HBYTE(sizeof(g_usbd_mouse_report)), /* wDescriptorLength: total length of reprot descriptor */
145
146 USB_DEVICE_EPT_LEN, /* bLength: size of endpoint descriptor in bytes */
147 USB_DESCIPTOR_TYPE_ENDPOINT, /* bDescriptorType: endpoint descriptor type */
148 USBD_MOUSE_IN_EPT, /* bEndpointAddress: the address of endpoint on usb device described by this descriptor */
149 USB_EPT_DESC_INTERRUPT, /* bmAttributes: endpoint attributes */
150 LBYTE(USBD_MOUSE_IN_MAXPACKET_SIZE),
151 HBYTE(USBD_MOUSE_IN_MAXPACKET_SIZE), /* wMaxPacketSize: maximum packe size this endpoint */
152 MOUSE_BINTERVAL_TIME, /* bInterval: interval for polling endpoint for data transfers */
153};
154
158#if defined ( __ICCARM__ ) /* iar compiler */
159 #pragma data_alignment=4
160#endif
161ALIGNED_HEAD uint8_t g_usbd_mouse_report[USBD_MOUSE_SIZ_REPORT_DESC] ALIGNED_TAIL =
162{
163 0x05,0x01,
164 0x09,0x02,
165 0xA1,0x01,
166 0x09,0x01,
167
168 0xA1,0x00,
169 0x05,0x09,
170 0x19,0x01,
171 0x29,0x03,
172
173 0x15,0x00,
174 0x25,0x01,
175 0x95,0x03,
176 0x75,0x01,
177
178 0x81,0x02,
179 0x95,0x01,
180 0x75,0x05,
181 0x81,0x01,
182
183 0x05,0x01,
184 0x09,0x30,
185 0x09,0x31,
186 0x09,0x38,
187
188 0x15,0x81,
189 0x25,0x7F,
190 0x75,0x08,
191 0x95,0x03,
192
193 0x81,0x06,
194 0xC0,0x09,
195 0x3c,0x05,
196 0xff,0x09,
197
198 0x01,0x15,
199 0x00,0x25,
200 0x01,0x75,
201 0x01,0x95,
202
203 0x02,0xb1,
204 0x22,0x75,
205 0x06,0x95,
206 0x01,0xb1,
207
208 0x01,0xc0
209};
210
214#if defined ( __ICCARM__ ) /* iar compiler */
215 #pragma data_alignment=4
216#endif
217ALIGNED_HEAD uint8_t g_mouse_usb_desc[9] ALIGNED_TAIL =
218{
219 0x09, /* bLength: size of HID descriptor in bytes */
220 HID_CLASS_DESC_HID, /* bDescriptorType: HID descriptor type */
221 LBYTE(MOUSE_BCD_NUM),
222 HBYTE(MOUSE_BCD_NUM), /* bcdHID: HID class specification release number */
223 0x00, /* bCountryCode: hardware target conutry */
224 0x01, /* bNumDescriptors: number of HID class descriptor to follow */
225 HID_CLASS_DESC_REPORT, /* bDescriptorType: report descriptor type */
226 LBYTE(sizeof(g_usbd_mouse_report)),
227 HBYTE(sizeof(g_usbd_mouse_report)), /* wDescriptorLength: total length of reprot descriptor */
228};
229
230
234#if defined ( __ICCARM__ ) /* iar compiler */
235 #pragma data_alignment=4
236#endif
237ALIGNED_HEAD static uint8_t g_string_lang_id[USBD_MOUSE_SIZ_STRING_LANGID] ALIGNED_TAIL =
238{
239 USBD_MOUSE_SIZ_STRING_LANGID,
240 USB_DESCIPTOR_TYPE_STRING,
241 0x09,
242 0x04,
243};
244
248#if defined ( __ICCARM__ ) /* iar compiler */
249 #pragma data_alignment=4
250#endif
251ALIGNED_HEAD static uint8_t g_string_serial[USBD_MOUSE_SIZ_STRING_SERIAL] ALIGNED_TAIL =
252{
253 USBD_MOUSE_SIZ_STRING_SERIAL,
254 USB_DESCIPTOR_TYPE_STRING,
255};
256
257
258/* device descriptor */
259static usbd_desc_t device_descriptor =
260{
261 USB_DEVICE_DESC_LEN,
262 g_usbd_descriptor
263};
264
265/* config descriptor */
266static usbd_desc_t config_descriptor =
267{
268 USBD_MOUSE_CONFIG_DESC_SIZE,
269 g_usbd_configuration
270};
271
272/* langid descriptor */
273static usbd_desc_t langid_descriptor =
274{
275 USBD_MOUSE_SIZ_STRING_LANGID,
276 g_string_lang_id
277};
278
279/* serial descriptor */
280static usbd_desc_t serial_descriptor =
281{
282 USBD_MOUSE_SIZ_STRING_SERIAL,
283 g_string_serial
284};
285
286static usbd_desc_t vp_desc;
287
294static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf)
295{
296 uint16_t str_len = 0, id_pos = 2;
297 uint8_t *tmp_str = string;
298
299 while(*tmp_str != '\0')
300 {
301 str_len ++;
302 unicode_buf[id_pos ++] = *tmp_str ++;
303 unicode_buf[id_pos ++] = 0x00;
304 }
305
306 str_len = str_len * 2 + 2;
307 unicode_buf[0] = str_len;
308 unicode_buf[1] = USB_DESCIPTOR_TYPE_STRING;
309
310 return str_len;
311}
312
320static void usbd_int_to_unicode (uint32_t value , uint8_t *pbuf , uint8_t len)
321{
322 uint8_t idx = 0;
323
324 for( idx = 0 ; idx < len ; idx ++)
325 {
326 if( ((value >> 28)) < 0xA )
327 {
328 pbuf[ 2 * idx] = (value >> 28) + '0';
329 }
330 else
331 {
332 pbuf[2 * idx] = (value >> 28) + 'A' - 10;
333 }
334
335 value = value << 4;
336
337 pbuf[2 * idx + 1] = 0;
338 }
339}
340
346static void get_serial_num(void)
347{
348 uint32_t serial0, serial1, serial2;
349
350 serial0 = *(uint32_t*)MCU_ID1;
351 serial1 = *(uint32_t*)MCU_ID2;
352 serial2 = *(uint32_t*)MCU_ID3;
353
354 serial0 += serial2;
355
356 if (serial0 != 0)
357 {
358 usbd_int_to_unicode (serial0, &g_string_serial[2] ,8);
359 usbd_int_to_unicode (serial1, &g_string_serial[18] ,4);
360 }
361}
362
368static usbd_desc_t *get_device_descriptor(void)
369{
370 return &device_descriptor;
371}
372
378static usbd_desc_t * get_device_qualifier(void)
379{
380 return NULL;
381}
382
388static usbd_desc_t *get_device_configuration(void)
389{
390 return &config_descriptor;
391}
392
398static usbd_desc_t *get_device_other_speed(void)
399{
400 return NULL;
401}
402
408static usbd_desc_t *get_device_lang_id(void)
409{
410 return &langid_descriptor;
411}
412
413
419static usbd_desc_t *get_device_manufacturer_string(void)
420{
421 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_MOUSE_DESC_MANUFACTURER_STRING, g_usbd_desc_buffer);
422 vp_desc.descriptor = g_usbd_desc_buffer;
423 return &vp_desc;
424}
425
431static usbd_desc_t *get_device_product_string(void)
432{
433 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_MOUSE_DESC_PRODUCT_STRING, g_usbd_desc_buffer);
434 vp_desc.descriptor = g_usbd_desc_buffer;
435 return &vp_desc;
436}
437
443static usbd_desc_t *get_device_serial_string(void)
444{
445 get_serial_num();
446 return &serial_descriptor;
447}
448
454static usbd_desc_t *get_device_interface_string(void)
455{
456 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_MOUSE_DESC_INTERFACE_STRING, g_usbd_desc_buffer);
457 vp_desc.descriptor = g_usbd_desc_buffer;
458 return &vp_desc;
459}
460
466static usbd_desc_t *get_device_config_string(void)
467{
468 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_MOUSE_DESC_CONFIGURATION_STRING, g_usbd_desc_buffer);
469 vp_desc.descriptor = g_usbd_desc_buffer;
470 return &vp_desc;
471}
472
NULL
#define NULL
Definition emmc_card/inc/at32_sdio.h:340
MCU_ID1
#define MCU_ID1
Definition audio_desc.h:214
MCU_ID2
#define MCU_ID2
Definition audio_desc.h:215
MCU_ID3
#define MCU_ID3
Definition audio_desc.h:216
HID_CLASS_DESC_HID
#define HID_CLASS_DESC_HID
usb hid class descriptor define
Definition audio_hid_desc.h:214
HID_CLASS_DESC_REPORT
#define HID_CLASS_DESC_REPORT
Definition audio_hid_desc.h:215
USBD_MOUSE_IN_EPT
#define USBD_MOUSE_IN_EPT
usb hid use endpoint define
Definition mouse_class.h:52
USBD_MOUSE_IN_MAXPACKET_SIZE
#define USBD_MOUSE_IN_MAXPACKET_SIZE
usb hid in and out max packet size define
Definition mouse_class.h:57
USBD_MOUSE_DESC_INTERFACE_STRING
#define USBD_MOUSE_DESC_INTERFACE_STRING
Definition mouse_desc.h:74
USBD_MOUSE_SIZ_REPORT_DESC
#define USBD_MOUSE_SIZ_REPORT_DESC
Definition mouse_desc.h:64
USBD_MOUSE_DESC_CONFIGURATION_STRING
#define USBD_MOUSE_DESC_CONFIGURATION_STRING
Definition mouse_desc.h:73
USBD_MOUSE_SIZ_STRING_LANGID
#define USBD_MOUSE_SIZ_STRING_LANGID
Definition mouse_desc.h:65
USBD_MOUSE_VENDOR_ID
#define USBD_MOUSE_VENDOR_ID
usb vendor id and product id define
Definition mouse_desc.h:57
USBD_MOUSE_CONFIG_DESC_SIZE
#define USBD_MOUSE_CONFIG_DESC_SIZE
usb descriptor size define
Definition mouse_desc.h:63
MOUSE_BINTERVAL_TIME
#define MOUSE_BINTERVAL_TIME
usb hid endpoint interval define
Definition mouse_desc.h:79
USBD_MOUSE_PRODUCT_ID
#define USBD_MOUSE_PRODUCT_ID
Definition mouse_desc.h:58
USBD_MOUSE_DESC_PRODUCT_STRING
#define USBD_MOUSE_DESC_PRODUCT_STRING
Definition mouse_desc.h:72
USBD_MOUSE_SIZ_STRING_SERIAL
#define USBD_MOUSE_SIZ_STRING_SERIAL
Definition mouse_desc.h:66
USBD_MOUSE_DESC_MANUFACTURER_STRING
#define USBD_MOUSE_DESC_MANUFACTURER_STRING
usb string define(vendor, product configuration, interface)
Definition mouse_desc.h:71
MOUSE_BCD_NUM
#define MOUSE_BCD_NUM
usb bcd number define
Definition mouse_desc.h:52
serial_descriptor
static usbd_desc_t serial_descriptor
Definition mouse_desc.c:280
device_descriptor
static usbd_desc_t device_descriptor
Definition mouse_desc.c:259
get_device_configuration
static usbd_desc_t * get_device_configuration(void)
get config descriptor
Definition mouse_desc.c:388
mouse_desc_handler
usbd_desc_handler mouse_desc_handler
mouse device descriptor handler structure
Definition mouse_desc.c:65
langid_descriptor
static usbd_desc_t langid_descriptor
Definition mouse_desc.c:273
get_device_descriptor
static usbd_desc_t * get_device_descriptor(void)
get device descriptor
Definition mouse_desc.c:368
get_device_manufacturer_string
static usbd_desc_t * get_device_manufacturer_string(void)
get manufacturer descriptor
Definition mouse_desc.c:419
get_device_qualifier
static usbd_desc_t * get_device_qualifier(void)
get device qualifier
Definition mouse_desc.c:378
get_device_interface_string
static usbd_desc_t * get_device_interface_string(void)
get interface descriptor
Definition mouse_desc.c:454
vp_desc
static usbd_desc_t vp_desc
Definition mouse_desc.c:286
get_device_other_speed
static usbd_desc_t * get_device_other_speed(void)
get other speed descriptor
Definition mouse_desc.c:398
ALIGNED_TAIL
static ALIGNED_HEAD uint8_t g_usbd_desc_buffer[256] ALIGNED_TAIL
usb device standard descriptor
Definition mouse_desc.c:60
get_device_product_string
static usbd_desc_t * get_device_product_string(void)
get product descriptor
Definition mouse_desc.c:431
get_device_config_string
static usbd_desc_t * get_device_config_string(void)
get device config descriptor
Definition mouse_desc.c:466
usbd_unicode_convert
static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf)
standard usb unicode convert
Definition mouse_desc.c:294
get_device_lang_id
static usbd_desc_t * get_device_lang_id(void)
get lang id descriptor
Definition mouse_desc.c:408
get_serial_num
static void get_serial_num(void)
usb get serial number
Definition mouse_desc.c:346
config_descriptor
static usbd_desc_t config_descriptor
Definition mouse_desc.c:266
get_device_serial_string
static usbd_desc_t * get_device_serial_string(void)
get serial descriptor
Definition mouse_desc.c:443
usbd_int_to_unicode
static void usbd_int_to_unicode(uint32_t value, uint8_t *pbuf, uint8_t len)
usb int convert to unicode
Definition mouse_desc.c:320
g_usbd_mouse_report
uint8_t g_usbd_mouse_report[74]
g_mouse_usb_desc
uint8_t g_mouse_usb_desc[9]
HBYTE
#define HBYTE(x)
Definition usb_std.h:271
USB_DEVICE_EPT_LEN
#define USB_DEVICE_EPT_LEN
Definition usb_std.h:159
USB_MAX_EP0_SIZE
#define USB_MAX_EP0_SIZE
endpoint 0 max size
Definition usb_std.h:248
USB_PRODUCT_STRING
#define USB_PRODUCT_STRING
Definition usb_std.h:105
USB_DESCIPTOR_TYPE_CONFIGURATION
#define USB_DESCIPTOR_TYPE_CONFIGURATION
Definition usb_std.h:92
LBYTE
#define LBYTE(x)
low byte and high byte define
Definition usb_std.h:270
USB_DESCIPTOR_TYPE_ENDPOINT
#define USB_DESCIPTOR_TYPE_ENDPOINT
Definition usb_std.h:95
USB_DEVICE_DESC_LEN
#define USB_DEVICE_DESC_LEN
Definition usb_std.h:156
USB_MFC_STRING
#define USB_MFC_STRING
Definition usb_std.h:104
USB_DEVICE_IF_DESC_LEN
#define USB_DEVICE_IF_DESC_LEN
Definition usb_std.h:158
USB_DEVICE_CFG_DESC_LEN
#define USB_DEVICE_CFG_DESC_LEN
Definition usb_std.h:157
USB_EPT_DESC_INTERRUPT
#define USB_EPT_DESC_INTERRUPT
Definition usb_std.h:184
USB_SERIAL_STRING
#define USB_SERIAL_STRING
Definition usb_std.h:106
USB_DESCIPTOR_TYPE_DEVICE
#define USB_DESCIPTOR_TYPE_DEVICE
usb standard device type
Definition usb_std.h:91
USB_DESCIPTOR_TYPE_STRING
#define USB_DESCIPTOR_TYPE_STRING
Definition usb_std.h:93
USB_DESCIPTOR_TYPE_INTERFACE
#define USB_DESCIPTOR_TYPE_INTERFACE
Definition usb_std.h:94
USB_CLASS_CODE_HID
#define USB_CLASS_CODE_HID
Definition usb_std.h:169
mouse_desc.h
usb mouse descriptor header file
usbd_desc_handler
usb device descriptor handler
Definition usbd_core.h:75
usbd_desc_t
usb device descriptor struct
Definition usbd_core.h:66
usbd_desc_t::length
uint16_t length
Definition usbd_core.h:67
usbd_desc_t::descriptor
uint8_t * descriptor
Definition usbd_core.h:68
usb_std.h
usb standard header file
usbd_core.h
usb device core header file
usbd_sdr.h
usb standard request header file


AT32F413 Firmwary Library: mouse_desc.h Source File

  • middlewares
  • usbd_class
  • mouse
mouse_desc.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __MOUSE_DESC_H
28#define __MOUSE_DESC_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "mouse_class.h"
35#include "usbd_core.h"
36
52#define MOUSE_BCD_NUM 0x0110
53
57#define USBD_MOUSE_VENDOR_ID 0x2E3C
58#define USBD_MOUSE_PRODUCT_ID 0x5710
59
63#define USBD_MOUSE_CONFIG_DESC_SIZE 34
64#define USBD_MOUSE_SIZ_REPORT_DESC 74
65#define USBD_MOUSE_SIZ_STRING_LANGID 4
66#define USBD_MOUSE_SIZ_STRING_SERIAL 0x1A
67
71#define USBD_MOUSE_DESC_MANUFACTURER_STRING "Artery"
72#define USBD_MOUSE_DESC_PRODUCT_STRING "Mouse"
73#define USBD_MOUSE_DESC_CONFIGURATION_STRING "Mouse Config"
74#define USBD_MOUSE_DESC_INTERFACE_STRING "Mouse Interface"
75
79#define MOUSE_BINTERVAL_TIME 0x0A
80
84#define MCU_ID1 (0x1FFFF7E8)
85#define MCU_ID2 (0x1FFFF7EC)
86#define MCU_ID3 (0x1FFFF7F0)
87
91extern uint8_t g_usbd_mouse_report[USBD_MOUSE_SIZ_REPORT_DESC];
92extern uint8_t g_mouse_usb_desc[9];
93extern usbd_desc_handler mouse_desc_handler;
94
102#ifdef __cplusplus
103}
104#endif
105
106#endif
107
108
USBD_MOUSE_SIZ_REPORT_DESC
#define USBD_MOUSE_SIZ_REPORT_DESC
Definition mouse_desc.h:64
mouse_desc_handler
usbd_desc_handler mouse_desc_handler
mouse device descriptor handler structure
Definition mouse_desc.c:65
g_usbd_mouse_report
uint8_t g_usbd_mouse_report[74]
g_mouse_usb_desc
uint8_t g_mouse_usb_desc[9]
mouse_class.h
usb hid mouse header file
usbd_desc_handler
usb device descriptor handler
Definition usbd_core.h:75
usbd_core.h
usb device core header file


AT32F413 Firmwary Library: msc_diskio.h Source File

  • usb_device
  • msc
  • inc
msc/inc/msc_diskio.h
Go to the documentation of this file.
1
25/* Define to prevent recursive inclusion -------------------------------------*/
26#ifndef __MSC_DISKIO_H
27#define __MSC_DISKIO_H
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33
34#include "usb_conf.h"
35#include "usb_std.h"
36
44#define INTERNAL_FLASH_LUN 0
45#define SPI_FLASH_LUN 1
46#define SD_LUN 2
47
48#define USB_FLASH_ADDR_OFFSET 0x08008000
49
50#define SECTOR_SIZE_1K 1024
51#define SECTOR_SIZE_2K 2048
52#define SECTOR_SIZE_4K 4096
53
54uint8_t *get_inquiry(uint8_t lun);
55 usb_sts_type msc_disk_read(uint8_t lun, uint64_t addr, uint8_t *read_buf, uint32_t len);
56 usb_sts_type msc_disk_write(uint8_t lun, uint64_t addr, uint8_t *buf, uint32_t len);
57 usb_sts_type msc_disk_capacity(uint8_t lun, uint32_t *blk_nbr, uint32_t *blk_size);
58
67#ifdef __cplusplus
68}
69#endif
70
71#endif
72
73
msc_disk_capacity
usb_sts_type msc_disk_capacity(uint8_t lun, uint32_t *blk_nbr, uint32_t *blk_size)
disk capacity
Definition composite_vcp_msc/src/msc_diskio.c:135
get_inquiry
uint8_t * get_inquiry(uint8_t lun)
get disk inquiry
Definition composite_vcp_msc/src/msc_diskio.c:58
msc_disk_read
usb_sts_type msc_disk_read(uint8_t lun, uint64_t addr, uint8_t *read_buf, uint32_t len)
disk read
Definition composite_vcp_msc/src/msc_diskio.c:74
msc_disk_write
usb_sts_type msc_disk_write(uint8_t lun, uint64_t addr, uint8_t *buf, uint32_t len)
disk write
Definition composite_vcp_msc/src/msc_diskio.c:101
usb_sts_type
usb_sts_type
usb return status
Definition usb_std.h:285
usb_conf.h
usb config header file
usb_std.h
usb standard header file


AT32F413 Firmwary Library: msc_bot_scsi.c Source File

  • middlewares
  • usbd_class
  • msc
msc/msc_bot_scsi.c
Go to the documentation of this file.
1
25#include "msc_bot_scsi.h"
26#include "msc_diskio.h"
27
42#if defined ( __ICCARM__ ) /* iar compiler */
43 #pragma data_alignment=4
44#endif
45ALIGNED_HEAD uint8_t page00_inquiry_data[] ALIGNED_TAIL = {
46 0x00,
47 0x00,
48 0x00,
49 0x00,
50 0x00,
51
52};
53#if defined ( __ICCARM__ ) /* iar compiler */
54 #pragma data_alignment=4
55#endif
56ALIGNED_HEAD sense_type sense_data ALIGNED_TAIL =
57{
58 0x70,
59 0x00,
60 SENSE_KEY_ILLEGAL_REQUEST,
61 0x00000000,
62 0x0A,
63 0x00000000,
64 0x20,
65 0x00,
66 0x00000000
67};
68
69#if defined ( __ICCARM__ ) /* iar compiler */
70 #pragma data_alignment=4
71#endif
72ALIGNED_HEAD uint8_t mode_sense6_data[8] ALIGNED_TAIL =
73{
74 0x00,
75 0x00,
76 0x00,
77 0x00,
78 0x00,
79 0x00,
80 0x00,
81 0x00
82};
83
84#if defined ( __ICCARM__ ) /* iar compiler */
85 #pragma data_alignment=4
86#endif
87ALIGNED_HEAD uint8_t mode_sense10_data[8] ALIGNED_TAIL =
88{
89 0x00,
90 0x06,
91 0x00,
92 0x00,
93 0x00,
94 0x00,
95 0x00,
96 0x00
97};
103void bot_scsi_init(void *udev)
104{
105 usbd_core_type *pudev = (usbd_core_type *)udev;
106 msc_type *pmsc = (msc_type *)pudev->class_handler->pdata;
107 pmsc->msc_state = MSC_STATE_MACHINE_IDLE;
108 pmsc->bot_status = MSC_BOT_STATE_IDLE;
109 pmsc->max_lun = MSC_SUPPORT_MAX_LUN - 1;
110
111 pmsc->csw_struct.dCSWSignature = CSW_DCSWSIGNATURE;
112 pmsc->csw_struct.dCSWDataResidue = 0;
113 pmsc->csw_struct.dCSWSignature = 0;
114 pmsc->csw_struct.dCSWTag = CSW_BCSWSTATUS_PASS;
115
116
117 /* set out endpoint to receive status */
118 usbd_ept_recv(pudev, USBD_MSC_BULK_OUT_EPT, (uint8_t *)&pmsc->cbw_struct, CBW_CMD_LENGTH);
119}
120
126void bot_scsi_reset(void *udev)
127{
128 usbd_core_type *pudev = (usbd_core_type *)udev;
129 msc_type *pmsc = (msc_type *)pudev->class_handler->pdata;
130 pmsc->msc_state = MSC_STATE_MACHINE_IDLE;
131 pmsc->bot_status = MSC_BOT_STATE_RECOVERY;
132 pmsc->max_lun = MSC_SUPPORT_MAX_LUN - 1;
133
134 /* set out endpoint to receive status */
135 usbd_ept_recv(pudev, USBD_MSC_BULK_OUT_EPT, (uint8_t *)&pmsc->cbw_struct, CBW_CMD_LENGTH);
136}
137
144void bot_scsi_datain_handler(void *udev, uint8_t ept_num)
145{
146 usbd_core_type *pudev = (usbd_core_type *)udev;
147 msc_type *pmsc = (msc_type *)pudev->class_handler->pdata;
148 switch(pmsc->msc_state)
149 {
150 case MSC_STATE_MACHINE_DATA_IN:
151 if(bot_scsi_cmd_process(udev) != USB_OK)
152 {
153 bot_scsi_send_csw(udev, CSW_BCSWSTATUS_FAILED);
154 }
155 break;
156
157 case MSC_STATE_MACHINE_LAST_DATA:
158 case MSC_STATE_MACHINE_SEND_DATA:
159 bot_scsi_send_csw(udev, CSW_BCSWSTATUS_PASS);
160 break;
161
162 default:
163 break;
164 }
165}
166
173void bot_scsi_dataout_handler(void *udev, uint8_t ept_num)
174{
175 usbd_core_type *pudev = (usbd_core_type *)udev;
176 msc_type *pmsc = (msc_type *)pudev->class_handler->pdata;
177 switch(pmsc->msc_state)
178 {
179 case MSC_STATE_MACHINE_IDLE:
180 bot_cbw_decode(udev);
181 break;
182
183 case MSC_STATE_MACHINE_DATA_OUT:
184 if(bot_scsi_cmd_process(udev) != USB_OK)
185 {
186 bot_scsi_send_csw(udev, CSW_BCSWSTATUS_FAILED);
187 }
188 break;
189 }
190}
191
197void bot_cbw_decode(void *udev)
198{
199 usbd_core_type *pudev = (usbd_core_type *)udev;
200 msc_type *pmsc = (msc_type *)pudev->class_handler->pdata;
201
202 pmsc->csw_struct.dCSWTag = pmsc->cbw_struct.dCBWTage;
203 pmsc->csw_struct.dCSWDataResidue = pmsc->cbw_struct.dCBWDataTransferLength;
204
205 /* check param */
206 if((pmsc->cbw_struct.dCBWSignature != CBW_DCBWSIGNATURE) ||
207 (usbd_get_recv_len(pudev, USBD_MSC_BULK_OUT_EPT) != CBW_CMD_LENGTH)
208 || (pmsc->cbw_struct.bCBWLUN > MSC_SUPPORT_MAX_LUN) ||
209 (pmsc->cbw_struct.bCBWCBLength < 1) || (pmsc->cbw_struct.bCBWCBLength > 16))
210 {
211 bot_scsi_sense_code(udev, SENSE_KEY_ILLEGAL_REQUEST, INVALID_COMMAND);
212 pmsc->bot_status = MSC_BOT_STATE_ERROR;
213 bot_scsi_stall(udev);
214 }
215 else
216 {
217 if(bot_scsi_cmd_process(udev) != USB_OK)
218 {
219 bot_scsi_stall(udev);
220 }
221 else if((pmsc->msc_state != MSC_STATE_MACHINE_DATA_IN) &&
222 (pmsc->msc_state != MSC_STATE_MACHINE_DATA_OUT) &&
223 (pmsc->msc_state != MSC_STATE_MACHINE_LAST_DATA))
224 {
225 if(pmsc->data_len == 0)
226 {
227 bot_scsi_send_csw(udev, CSW_BCSWSTATUS_PASS);
228 }
229 else if(pmsc->data_len > 0)
230 {
231 bot_scsi_send_data(udev, pmsc->data, pmsc->data_len);
232 }
233 }
234 }
235}
236
244void bot_scsi_send_data(void *udev, uint8_t *buffer, uint32_t len)
245{
246 usbd_core_type *pudev = (usbd_core_type *)udev;
247 msc_type *pmsc = (msc_type *)pudev->class_handler->pdata;
248 uint32_t data_len = MIN(len, pmsc->cbw_struct.dCBWDataTransferLength);
249
250 pmsc->csw_struct.dCSWDataResidue -= data_len;
251 pmsc->csw_struct.bCSWStatus = CSW_BCSWSTATUS_PASS;
252
253 pmsc->msc_state = MSC_STATE_MACHINE_SEND_DATA;
254
255 usbd_ept_send(pudev, USBD_MSC_BULK_IN_EPT,
256 buffer, data_len);
257}
258
265void bot_scsi_send_csw(void *udev, uint8_t status)
266{
267 usbd_core_type *pudev = (usbd_core_type *)udev;
268 msc_type *pmsc = (msc_type *)pudev->class_handler->pdata;
269
270 pmsc->csw_struct.bCSWStatus = status;
271 pmsc->csw_struct.dCSWSignature = CSW_DCSWSIGNATURE;
272 pmsc->msc_state = MSC_STATE_MACHINE_IDLE;
273
274 usbd_ept_send(pudev, USBD_MSC_BULK_IN_EPT,
275 (uint8_t *)&pmsc->csw_struct, CSW_CMD_LENGTH);
276
277 usbd_ept_recv(pudev, USBD_MSC_BULK_OUT_EPT,
278 (uint8_t *)&pmsc->cbw_struct, CBW_CMD_LENGTH);
279}
280
281
289void bot_scsi_sense_code(void *udev, uint8_t sense_key, uint8_t asc)
290{
291 sense_data.sense_key = sense_key;
292 sense_data.asc = asc;
293}
294
295
304 usb_sts_type bot_scsi_check_address(void *udev, uint8_t lun, uint32_t blk_offset, uint32_t blk_count)
305{
306 usbd_core_type *pudev = (usbd_core_type *)udev;
307 msc_type *pmsc = (msc_type *)pudev->class_handler->pdata;
308 if((blk_offset + blk_count) > pmsc->blk_nbr[lun])
309 {
310 bot_scsi_sense_code(udev, SENSE_KEY_ILLEGAL_REQUEST, ADDRESS_OUT_OF_RANGE);
311 return USB_FAIL;
312 }
313 return USB_OK;
314}
315
321void bot_scsi_stall(void *udev)
322{
323 usbd_core_type *pudev = (usbd_core_type *)udev;
324 msc_type *pmsc = (msc_type *)pudev->class_handler->pdata;
325
326 if((pmsc->cbw_struct.dCBWDataTransferLength != 0) &&
327 (pmsc->cbw_struct.bmCBWFlags == 0) &&
328 pmsc->bot_status == MSC_BOT_STATE_IDLE)
329 {
330 usbd_set_stall(pudev, USBD_MSC_BULK_OUT_EPT);
331 }
332 usbd_set_stall(pudev, USBD_MSC_BULK_IN_EPT);
333
334 if(pmsc->bot_status == MSC_BOT_STATE_ERROR)
335 {
336 usbd_ept_recv(pudev, USBD_MSC_BULK_OUT_EPT,
337 (uint8_t *)&pmsc->cbw_struct, CBW_CMD_LENGTH);
338 }
339}
340
347 usb_sts_type bot_scsi_test_unit(void *udev, uint8_t lun)
348{
349 usb_sts_type status = USB_OK;
350 usbd_core_type *pudev = (usbd_core_type *)udev;
351 msc_type *pmsc = (msc_type *)pudev->class_handler->pdata;
352
353 if(pmsc->cbw_struct.dCBWDataTransferLength != 0)
354 {
355 bot_scsi_sense_code(udev, SENSE_KEY_ILLEGAL_REQUEST, INVALID_COMMAND);
356 return USB_FAIL;
357 }
358
359 pmsc->data_len = 0;
360 return status;
361}
362
369 usb_sts_type bot_scsi_inquiry(void *udev, uint8_t lun)
370{
371 uint8_t *pdata;
372 uint32_t trans_len = 0;
373 usb_sts_type status = USB_OK;
374 usbd_core_type *pudev = (usbd_core_type *)udev;
375 msc_type *pmsc = (msc_type *)pudev->class_handler->pdata;
376
377 if(pmsc->cbw_struct.CBWCB[1] & 0x01)
378 {
379 pdata = page00_inquiry_data;
380 trans_len = 5;
381 }
382 else
383 {
384 pdata = get_inquiry(lun);
385 if(pmsc->cbw_struct.dCBWDataTransferLength < SCSI_INQUIRY_DATA_LENGTH)
386 {
387 trans_len = pmsc->cbw_struct.dCBWDataTransferLength;
388 }
389 else
390 {
391 trans_len = SCSI_INQUIRY_DATA_LENGTH;
392 }
393 }
394
395 pmsc->data_len = trans_len;
396 while(trans_len)
397 {
398 trans_len --;
399 pmsc->data[trans_len] = pdata[trans_len];
400 }
401 return status;
402}
403
410 usb_sts_type bot_scsi_start_stop(void *udev, uint8_t lun)
411{
412 usbd_core_type *pudev = (usbd_core_type *)udev;
413 msc_type *pmsc = (msc_type *)pudev->class_handler->pdata;
414 pmsc->data_len = 0;
415 return USB_OK;
416}
417
424 usb_sts_type bot_scsi_allow_medium_removal(void *udev, uint8_t lun)
425{
426 usbd_core_type *pudev = (usbd_core_type *)udev;
427 msc_type *pmsc = (msc_type *)pudev->class_handler->pdata;
428 pmsc->data_len = 0;
429 return USB_OK;
430}
431
438 usb_sts_type bot_scsi_mode_sense6(void *udev, uint8_t lun)
439{
440 uint8_t data_len = 8;
441 usbd_core_type *pudev = (usbd_core_type *)udev;
442 msc_type *pmsc = (msc_type *)pudev->class_handler->pdata;
443 pmsc->data_len = 8;
444 while(data_len)
445 {
446 data_len --;
447 pmsc->data[data_len] = mode_sense6_data[data_len];
448 };
449 return USB_OK;
450}
451
458 usb_sts_type bot_scsi_mode_sense10(void *udev, uint8_t lun)
459{
460 uint8_t data_len = 8;
461 usbd_core_type *pudev = (usbd_core_type *)udev;
462 msc_type *pmsc = (msc_type *)pudev->class_handler->pdata;
463 pmsc->data_len = 8;
464 while(data_len)
465 {
466 data_len --;
467 pmsc->data[data_len] = mode_sense10_data[data_len];
468 };
469 return USB_OK;
470}
471
478 usb_sts_type bot_scsi_capacity(void *udev, uint8_t lun)
479{
480 usbd_core_type *pudev = (usbd_core_type *)udev;
481 msc_type *pmsc = (msc_type *)pudev->class_handler->pdata;
482 uint8_t *pdata = pmsc->data;
483 msc_disk_capacity(lun, &pmsc->blk_nbr[lun], &pmsc->blk_size[lun]);
484
485 pdata[0] = (uint8_t)((pmsc->blk_nbr[lun] - 1) >> 24);
486 pdata[1] = (uint8_t)((pmsc->blk_nbr[lun] - 1) >> 16);
487 pdata[2] = (uint8_t)((pmsc->blk_nbr[lun] - 1) >> 8);
488 pdata[3] = (uint8_t)((pmsc->blk_nbr[lun] - 1));
489
490 pdata[4] = (uint8_t)((pmsc->blk_size[lun]) >> 24);
491 pdata[5] = (uint8_t)((pmsc->blk_size[lun]) >> 16);
492 pdata[6] = (uint8_t)((pmsc->blk_size[lun]) >> 8);
493 pdata[7] = (uint8_t)((pmsc->blk_size[lun]));
494
495 pmsc->data_len = 8;
496 return USB_OK;
497}
498
505 usb_sts_type bot_scsi_format_capacity(void *udev, uint8_t lun)
506{
507 usbd_core_type *pudev = (usbd_core_type *)udev;
508 msc_type *pmsc = (msc_type *)pudev->class_handler->pdata;
509 uint8_t *pdata = pmsc->data;
510
511 pdata[0] = 0;
512 pdata[1] = 0;
513 pdata[2] = 0;
514 pdata[3] = 0x08;
515
516 msc_disk_capacity(lun, &pmsc->blk_nbr[lun], &pmsc->blk_size[lun]);
517
518 pdata[4] = (uint8_t)((pmsc->blk_nbr[lun] - 1) >> 24);
519 pdata[5] = (uint8_t)((pmsc->blk_nbr[lun] - 1) >> 16);
520 pdata[6] = (uint8_t)((pmsc->blk_nbr[lun] - 1) >> 8);
521 pdata[7] = (uint8_t)((pmsc->blk_nbr[lun] - 1));
522
523 pdata[8] = 0x02;
524
525 pdata[9] = (uint8_t)((pmsc->blk_size[lun]) >> 16);
526 pdata[10] = (uint8_t)((pmsc->blk_size[lun]) >> 8);
527 pdata[11] = (uint8_t)((pmsc->blk_size[lun]));
528
529 pmsc->data_len = 12;
530
531 return USB_OK;
532}
533
540 usb_sts_type bot_scsi_request_sense(void *udev, uint8_t lun)
541{
542 uint32_t trans_len = 0x12;
543 usbd_core_type *pudev = (usbd_core_type *)udev;
544 msc_type *pmsc = (msc_type *)pudev->class_handler->pdata;
545 uint8_t *pdata = pmsc->data;
546 uint8_t *sdata = (uint8_t *)&sense_data;
547
548 while(trans_len)
549 {
550 trans_len --;
551 pdata[trans_len] = sdata[trans_len];
552 }
553
554 if(pmsc->cbw_struct.dCBWDataTransferLength < REQ_SENSE_STANDARD_DATA_LEN)
555 {
556 pmsc->data_len = pmsc->cbw_struct.dCBWDataTransferLength;
557 }
558 else
559 {
560 pmsc->data_len = REQ_SENSE_STANDARD_DATA_LEN;
561 }
562 return USB_OK;
563}
564
571 usb_sts_type bot_scsi_verify(void *udev, uint8_t lun)
572{
573 usbd_core_type *pudev = (usbd_core_type *)udev;
574 msc_type *pmsc = (msc_type *)pudev->class_handler->pdata;
575 uint8_t *cmd = pmsc->cbw_struct.CBWCB;
576 if((pmsc->cbw_struct.CBWCB[1] & 0x02) == 0x02)
577 {
578 bot_scsi_sense_code(udev, SENSE_KEY_ILLEGAL_REQUEST, INVALID_FIELED_IN_COMMAND);
579 return USB_FAIL;
580 }
581
582 pmsc->blk_addr = cmd[2] << 24 | cmd[3] << 16 | cmd[4] << 8 | cmd[5];
583 pmsc->blk_len = cmd[7] << 8 | cmd[8];
584
585 if(bot_scsi_check_address(udev, lun, pmsc->blk_addr, pmsc->blk_len) != USB_OK)
586 {
587 return USB_FAIL;
588 }
589 pmsc->data_len = 0;
590 return USB_OK;
591}
592
599 usb_sts_type bot_scsi_read10(void *udev, uint8_t lun)
600{
601 usbd_core_type *pudev = (usbd_core_type *)udev;
602 msc_type *pmsc = (msc_type *)pudev->class_handler->pdata;
603 uint8_t *cmd = pmsc->cbw_struct.CBWCB;
604 uint32_t len;
605
606 if(pmsc->msc_state == MSC_STATE_MACHINE_IDLE)
607 {
608 if((pmsc->cbw_struct.bmCBWFlags & 0x80) != 0x80)
609 {
610 bot_scsi_sense_code(udev, SENSE_KEY_ILLEGAL_REQUEST, INVALID_COMMAND);
611 return USB_FAIL;
612 }
613
614 pmsc->blk_addr = cmd[2] << 24 | cmd[3] << 16 | cmd[4] << 8 | cmd[5];
615 pmsc->blk_len = cmd[7] << 8 | cmd[8];
616
617 if(bot_scsi_check_address(udev, lun, pmsc->blk_addr, pmsc->blk_len) != USB_OK)
618 {
619 return USB_FAIL;
620 }
621
622 pmsc->blk_addr *= pmsc->blk_size[lun];
623 pmsc->blk_len *= pmsc->blk_size[lun];
624
625 if(pmsc->cbw_struct.dCBWDataTransferLength != pmsc->blk_len)
626 {
627 bot_scsi_sense_code(udev, SENSE_KEY_ILLEGAL_REQUEST, INVALID_COMMAND);
628 return USB_FAIL;
629 }
630 pmsc->msc_state = MSC_STATE_MACHINE_DATA_IN;
631 }
632 pmsc->data_len = MSC_MAX_DATA_BUF_LEN;
633
634 len = MIN(pmsc->blk_len, MSC_MAX_DATA_BUF_LEN);
635 if( msc_disk_read(lun, pmsc->blk_addr, pmsc->data, len) != USB_OK)
636 {
637 bot_scsi_sense_code(udev, SENSE_KEY_HARDWARE_ERROR, MEDIUM_NOT_PRESENT);
638 return USB_FAIL;
639 }
640 usbd_ept_send(pudev, USBD_MSC_BULK_IN_EPT, pmsc->data, len);
641 pmsc->blk_addr += len;
642 pmsc->blk_len -= len;
643
644 pmsc->csw_struct.dCSWDataResidue -= len;
645 if(pmsc->blk_len == 0)
646 {
647 pmsc->msc_state = MSC_STATE_MACHINE_LAST_DATA;
648 }
649
650 return USB_OK;
651}
652
653
660 usb_sts_type bot_scsi_write10(void *udev, uint8_t lun)
661{
662 usbd_core_type *pudev = (usbd_core_type *)udev;
663 msc_type *pmsc = (msc_type *)pudev->class_handler->pdata;
664 uint8_t *cmd = pmsc->cbw_struct.CBWCB;
665 uint32_t len;
666
667 if(pmsc->msc_state == MSC_STATE_MACHINE_IDLE)
668 {
669 if((pmsc->cbw_struct.bmCBWFlags & 0x80) == 0x80)
670 {
671 bot_scsi_sense_code(udev, SENSE_KEY_ILLEGAL_REQUEST, INVALID_COMMAND);
672 return USB_FAIL;
673 }
674
675 pmsc->blk_addr = cmd[2] << 24 | cmd[3] << 16 | cmd[4] << 8 | cmd[5];
676 pmsc->blk_len = cmd[7] << 8 | cmd[8];
677
678 if(bot_scsi_check_address(udev, lun, pmsc->blk_addr, pmsc->blk_len) != USB_OK)
679 {
680 return USB_FAIL;
681 }
682
683 pmsc->blk_addr *= pmsc->blk_size[lun];
684 pmsc->blk_len *= pmsc->blk_size[lun];
685
686 if(pmsc->cbw_struct.dCBWDataTransferLength != pmsc->blk_len)
687 {
688 bot_scsi_sense_code(udev, SENSE_KEY_ILLEGAL_REQUEST, INVALID_COMMAND);
689 return USB_FAIL;
690 }
691
692 pmsc->msc_state = MSC_STATE_MACHINE_DATA_OUT;
693 len = MIN(pmsc->blk_len, MSC_MAX_DATA_BUF_LEN);
694 usbd_ept_recv(pudev, USBD_MSC_BULK_OUT_EPT, (uint8_t *)pmsc->data, len);
695
696 }
697 else
698 {
699 len = MIN(pmsc->blk_len, MSC_MAX_DATA_BUF_LEN);
700 if(msc_disk_write(lun, pmsc->blk_addr, pmsc->data, len) != USB_OK)
701 {
702 bot_scsi_sense_code(udev, SENSE_KEY_HARDWARE_ERROR, MEDIUM_NOT_PRESENT);
703 return USB_FAIL;
704 }
705
706 pmsc->blk_addr += len;
707 pmsc->blk_len -= len;
708
709 pmsc->csw_struct.dCSWDataResidue -= len;
710
711 if(pmsc->blk_len == 0)
712 {
713 bot_scsi_send_csw(udev, CSW_BCSWSTATUS_PASS);
714 }
715 else
716 {
717 len = MIN(pmsc->blk_len, MSC_MAX_DATA_BUF_LEN);
718 usbd_ept_recv(pudev, USBD_MSC_BULK_OUT_EPT, (uint8_t *)pmsc->data, len);
719 }
720 }
721 return USB_OK;
722}
723
730void bot_scsi_clear_feature(void *udev, uint8_t ept_num)
731{
732 usbd_core_type *pudev = (usbd_core_type *)udev;
733 msc_type *pmsc = (msc_type *)pudev->class_handler->pdata;
734 if(pmsc->bot_status == MSC_BOT_STATE_ERROR)
735 {
736 usbd_set_stall(pudev, USBD_MSC_BULK_IN_EPT);
737 pmsc->bot_status = MSC_BOT_STATE_IDLE;
738 }
739 else if(((ept_num & 0x80) == 0x80) && (pmsc->bot_status != MSC_BOT_STATE_RECOVERY))
740 {
741 bot_scsi_send_csw(udev, CSW_BCSWSTATUS_FAILED);
742 }
743}
744
750 usb_sts_type bot_scsi_cmd_process(void *udev)
751{
752 usb_sts_type status = USB_FAIL;
753 usbd_core_type *pudev = (usbd_core_type *)udev;
754 msc_type *pmsc = (msc_type *)pudev->class_handler->pdata;
755 switch(pmsc->cbw_struct.CBWCB[0])
756 {
757 case MSC_CMD_INQUIRY:
758 status = bot_scsi_inquiry(udev, pmsc->cbw_struct.bCBWLUN);
759 break;
760
761 case MSC_CMD_START_STOP:
762 status = bot_scsi_start_stop(udev, pmsc->cbw_struct.bCBWLUN);
763 break;
764
765 case MSC_CMD_MODE_SENSE6:
766 status = bot_scsi_mode_sense6(udev, pmsc->cbw_struct.bCBWLUN);
767 break;
768
769 case MSC_CMD_MODE_SENSE10:
770 status = bot_scsi_mode_sense10(udev, pmsc->cbw_struct.bCBWLUN);
771 break;
772
773 case MSC_CMD_ALLOW_MEDIUM_REMOVAL:
774 status = bot_scsi_allow_medium_removal(udev, pmsc->cbw_struct.bCBWLUN);
775 break;
776
777 case MSC_CMD_READ_10:
778 status = bot_scsi_read10(udev, pmsc->cbw_struct.bCBWLUN);
779 break;
780
781 case MSC_CMD_READ_CAPACITY:
782 status = bot_scsi_capacity(udev, pmsc->cbw_struct.bCBWLUN);
783 break;
784
785 case MSC_CMD_REQUEST_SENSE:
786 status = bot_scsi_request_sense(udev, pmsc->cbw_struct.bCBWLUN);
787 break;
788
789 case MSC_CMD_TEST_UNIT:
790 status = bot_scsi_test_unit(udev, pmsc->cbw_struct.bCBWLUN);
791 break;
792
793 case MSC_CMD_VERIFY:
794 status = bot_scsi_verify(udev, pmsc->cbw_struct.bCBWLUN);
795 break;
796
797 case MSC_CMD_WRITE_10:
798 status = bot_scsi_write10(udev, pmsc->cbw_struct.bCBWLUN);
799 break;
800
801 case MSC_CMD_READ_FORMAT_CAPACITY:
802 status = bot_scsi_format_capacity(udev, pmsc->cbw_struct.bCBWLUN);
803 break;
804
805 default:
806 bot_scsi_sense_code(udev, SENSE_KEY_ILLEGAL_REQUEST, INVALID_COMMAND);
807 status = USB_FAIL;
808 break;
809 }
810 return status;
811}
812
buffer
uint8_t buffer[((uint16_t) 160) *((uint16_t) 120)]
Definition project/at_start_f413/examples/cortex_m4/fpu/src/main.c:42
msc_disk_capacity
usb_sts_type msc_disk_capacity(uint8_t lun, uint32_t *blk_nbr, uint32_t *blk_size)
disk capacity
Definition composite_vcp_msc/src/msc_diskio.c:135
get_inquiry
uint8_t * get_inquiry(uint8_t lun)
get disk inquiry
Definition composite_vcp_msc/src/msc_diskio.c:58
msc_disk_read
usb_sts_type msc_disk_read(uint8_t lun, uint64_t addr, uint8_t *read_buf, uint32_t len)
disk read
Definition composite_vcp_msc/src/msc_diskio.c:74
msc_disk_write
usb_sts_type msc_disk_write(uint8_t lun, uint64_t addr, uint8_t *buf, uint32_t len)
disk write
Definition composite_vcp_msc/src/msc_diskio.c:101
USBD_MSC_BULK_IN_EPT
#define USBD_MSC_BULK_IN_EPT
Definition cdc_msc_class.h:56
USBD_MSC_BULK_OUT_EPT
#define USBD_MSC_BULK_OUT_EPT
Definition cdc_msc_class.h:57
bot_scsi_format_capacity
usb_sts_type bot_scsi_format_capacity(void *udev, uint8_t lun)
bulk-only transport scsi command format capacity
Definition composite_cdc_msc/msc_bot_scsi.c:504
bot_scsi_start_stop
usb_sts_type bot_scsi_start_stop(void *udev, uint8_t lun)
bulk-only transport scsi command start stop
Definition composite_cdc_msc/msc_bot_scsi.c:409
bot_scsi_request_sense
usb_sts_type bot_scsi_request_sense(void *udev, uint8_t lun)
bulk-only transport scsi command request sense
Definition composite_cdc_msc/msc_bot_scsi.c:539
bot_scsi_dataout_handler
void bot_scsi_dataout_handler(void *pudev, uint8_t ept_num)
bulk-only transport data out handler
Definition composite_cdc_msc/msc_bot_scsi.c:172
bot_scsi_read10
usb_sts_type bot_scsi_read10(void *udev, uint8_t lun)
bulk-only transport scsi command read10
Definition composite_cdc_msc/msc_bot_scsi.c:598
bot_scsi_check_address
usb_sts_type bot_scsi_check_address(void *udev, uint8_t lun, uint32_t blk_offset, uint32_t blk_count)
check address
Definition composite_cdc_msc/msc_bot_scsi.c:303
bot_scsi_write10
usb_sts_type bot_scsi_write10(void *udev, uint8_t lun)
bulk-only transport scsi command write10
Definition composite_cdc_msc/msc_bot_scsi.c:659
bot_scsi_reset
void bot_scsi_reset(void *udev)
reset bulk-only transport and scsi
Definition composite_cdc_msc/msc_bot_scsi.c:125
bot_scsi_mode_sense10
usb_sts_type bot_scsi_mode_sense10(void *udev, uint8_t lun)
bulk-only transport scsi command mode sense10
Definition composite_cdc_msc/msc_bot_scsi.c:457
bot_scsi_sense_code
void bot_scsi_sense_code(void *udev, uint8_t sense_key, uint8_t asc)
send scsi sense code
Definition composite_cdc_msc/msc_bot_scsi.c:288
bot_cbw_decode
void bot_cbw_decode(void *udev)
bulk-only cbw decode
Definition composite_cdc_msc/msc_bot_scsi.c:196
bot_scsi_verify
usb_sts_type bot_scsi_verify(void *udev, uint8_t lun)
bulk-only transport scsi command verify
Definition composite_cdc_msc/msc_bot_scsi.c:570
bot_scsi_allow_medium_removal
usb_sts_type bot_scsi_allow_medium_removal(void *udev, uint8_t lun)
bulk-only transport scsi command meidum removal
Definition composite_cdc_msc/msc_bot_scsi.c:423
bot_scsi_init
void bot_scsi_init(void *udev)
initialize bulk-only transport and scsi
Definition composite_cdc_msc/msc_bot_scsi.c:103
bot_scsi_cmd_process
usb_sts_type bot_scsi_cmd_process(void *udev)
bulk-only transport scsi command process
Definition composite_cdc_msc/msc_bot_scsi.c:749
bot_scsi_datain_handler
void bot_scsi_datain_handler(void *pudev, uint8_t ept_num)
bulk-only transport data in handler
Definition composite_cdc_msc/msc_bot_scsi.c:143
bot_scsi_mode_sense6
usb_sts_type bot_scsi_mode_sense6(void *udev, uint8_t lun)
bulk-only transport scsi command mode sense6
Definition composite_cdc_msc/msc_bot_scsi.c:437
bot_scsi_stall
void bot_scsi_stall(void *udev)
bot endpoint stall
Definition composite_cdc_msc/msc_bot_scsi.c:320
bot_scsi_send_data
void bot_scsi_send_data(void *udev, uint8_t *buffer, uint32_t len)
send bot data
Definition composite_cdc_msc/msc_bot_scsi.c:243
bot_scsi_test_unit
usb_sts_type bot_scsi_test_unit(void *udev, uint8_t lun)
bulk-only transport scsi command test unit
Definition composite_cdc_msc/msc_bot_scsi.c:346
bot_scsi_inquiry
usb_sts_type bot_scsi_inquiry(void *udev, uint8_t lun)
bulk-only transport scsi command inquiry
Definition composite_cdc_msc/msc_bot_scsi.c:368
bot_scsi_capacity
usb_sts_type bot_scsi_capacity(void *udev, uint8_t lun)
bulk-only transport scsi command capacity
Definition composite_cdc_msc/msc_bot_scsi.c:477
bot_scsi_clear_feature
void bot_scsi_clear_feature(void *udev, uint8_t ept_num)
clear feature
Definition composite_cdc_msc/msc_bot_scsi.c:729
bot_scsi_send_csw
void bot_scsi_send_csw(void *udev, uint8_t status)
send command status
Definition composite_cdc_msc/msc_bot_scsi.c:264
ALIGNED_TAIL
ALIGNED_HEAD uint8_t page00_inquiry_data[] ALIGNED_TAIL
Definition msc/msc_bot_scsi.c:45
MSC_STATE_MACHINE_DATA_IN
#define MSC_STATE_MACHINE_DATA_IN
Definition cdc_msc_class.h:120
MSC_CMD_START_STOP
#define MSC_CMD_START_STOP
Definition cdc_msc_class.h:87
MSC_CMD_VERIFY
#define MSC_CMD_VERIFY
Definition cdc_msc_class.h:97
ADDRESS_OUT_OF_RANGE
#define ADDRESS_OUT_OF_RANGE
Definition cdc_msc_class.h:152
SENSE_KEY_HARDWARE_ERROR
#define SENSE_KEY_HARDWARE_ERROR
Definition cdc_msc_class.h:137
MEDIUM_NOT_PRESENT
#define MEDIUM_NOT_PRESENT
Definition cdc_msc_class.h:153
MSC_CMD_MODE_SENSE6
#define MSC_CMD_MODE_SENSE6
Definition cdc_msc_class.h:88
SCSI_INQUIRY_DATA_LENGTH
#define SCSI_INQUIRY_DATA_LENGTH
Definition cdc_msc_class.h:156
MSC_CMD_ALLOW_MEDIUM_REMOVAL
#define MSC_CMD_ALLOW_MEDIUM_REMOVAL
Definition cdc_msc_class.h:90
CSW_CMD_LENGTH
#define CSW_CMD_LENGTH
Definition cdc_msc_class.h:113
MSC_BOT_STATE_IDLE
#define MSC_BOT_STATE_IDLE
Definition cdc_msc_class.h:128
MSC_MAX_DATA_BUF_LEN
#define MSC_MAX_DATA_BUF_LEN
Definition cdc_msc_class.h:83
CSW_DCSWSIGNATURE
#define CSW_DCSWSIGNATURE
Definition cdc_msc_class.h:114
MSC_CMD_INQUIRY
#define MSC_CMD_INQUIRY
Definition cdc_msc_class.h:86
MSC_SUPPORT_MAX_LUN
#define MSC_SUPPORT_MAX_LUN
Definition cdc_msc_class.h:82
INVALID_COMMAND
#define INVALID_COMMAND
Definition cdc_msc_class.h:148
MSC_CMD_WRITE_10
#define MSC_CMD_WRITE_10
Definition cdc_msc_class.h:98
MSC_STATE_MACHINE_IDLE
#define MSC_STATE_MACHINE_IDLE
Definition cdc_msc_class.h:126
MSC_CMD_READ_FORMAT_CAPACITY
#define MSC_CMD_READ_FORMAT_CAPACITY
Definition cdc_msc_class.h:94
MSC_CMD_MODE_SENSE10
#define MSC_CMD_MODE_SENSE10
Definition cdc_msc_class.h:89
SENSE_KEY_ILLEGAL_REQUEST
#define SENSE_KEY_ILLEGAL_REQUEST
Definition cdc_msc_class.h:138
MSC_STATE_MACHINE_DATA_OUT
#define MSC_STATE_MACHINE_DATA_OUT
Definition cdc_msc_class.h:121
CSW_BCSWSTATUS_PASS
#define CSW_BCSWSTATUS_PASS
Definition cdc_msc_class.h:115
INVALID_FIELED_IN_COMMAND
#define INVALID_FIELED_IN_COMMAND
Definition cdc_msc_class.h:149
REQ_SENSE_STANDARD_DATA_LEN
#define REQ_SENSE_STANDARD_DATA_LEN
Definition cdc_msc_class.h:132
MSC_STATE_MACHINE_SEND_DATA
#define MSC_STATE_MACHINE_SEND_DATA
Definition cdc_msc_class.h:122
CBW_DCBWSIGNATURE
#define CBW_DCBWSIGNATURE
Definition cdc_msc_class.h:109
MSC_CMD_READ_10
#define MSC_CMD_READ_10
Definition cdc_msc_class.h:91
MSC_BOT_STATE_RECOVERY
#define MSC_BOT_STATE_RECOVERY
Definition cdc_msc_class.h:129
CBW_CMD_LENGTH
#define CBW_CMD_LENGTH
Definition cdc_msc_class.h:108
MSC_STATE_MACHINE_LAST_DATA
#define MSC_STATE_MACHINE_LAST_DATA
Definition cdc_msc_class.h:123
MSC_CMD_TEST_UNIT
#define MSC_CMD_TEST_UNIT
Definition cdc_msc_class.h:96
CSW_BCSWSTATUS_FAILED
#define CSW_BCSWSTATUS_FAILED
Definition cdc_msc_class.h:116
MSC_CMD_READ_CAPACITY
#define MSC_CMD_READ_CAPACITY
Definition cdc_msc_class.h:93
MSC_BOT_STATE_ERROR
#define MSC_BOT_STATE_ERROR
Definition cdc_msc_class.h:130
MSC_CMD_REQUEST_SENSE
#define MSC_CMD_REQUEST_SENSE
Definition cdc_msc_class.h:95
MIN
#define MIN(a, b)
min and max define
Definition usb_std.h:260
usb_sts_type
usb_sts_type
usb return status
Definition usb_std.h:285
USB_OK
@ USB_OK
Definition usb_std.h:286
USB_FAIL
@ USB_FAIL
Definition usb_std.h:287
usbd_set_stall
void usbd_set_stall(usbd_core_type *udev, uint8_t ept_addr)
usb set endpoint to stall.
Definition usbd_core.c:264
usbd_ept_recv
void usbd_ept_recv(usbd_core_type *udev, uint8_t ept_num, uint8_t *buffer, uint16_t len)
usb endpoint receive data
Definition usbd_core.c:364
usbd_get_recv_len
uint32_t usbd_get_recv_len(usbd_core_type *udev, uint8_t ept_addr)
usb endpoint get receive data length
Definition usbd_core.c:397
usbd_ept_send
void usbd_ept_send(usbd_core_type *udev, uint8_t ept_num, uint8_t *buffer, uint16_t len)
usb endpoint send data
Definition usbd_core.c:304
msc_bot_scsi.h
usb mass storage bulk-only transport and scsi command header file
msc_type
Definition cdc_msc_class.h:227
sense_type
request sense standard data
Definition cdc_msc_class.h:213
usbd_class_handler::pdata
void * pdata
Definition usbd_core.h:107
usbd_core_type
usb device core struct type
Definition usbd_core.h:114
usbd_core_type::class_handler
usbd_class_handler * class_handler
Definition usbd_core.h:117


AT32F413 Firmwary Library: msc_diskio.c Source File

  • usb_device
  • msc
  • src
msc/src/msc_diskio.c
Go to the documentation of this file.
1
25#include "msc_diskio.h"
26#include "msc_bot_scsi.h"
27
35uint32_t sector_size = 2048;
36uint32_t msc_flash_size;
37uint8_t scsi_inquiry[MSC_SUPPORT_MAX_LUN][SCSI_INQUIRY_DATA_LENGTH] =
38{
39 /* lun = 0 */
40 {
41 0x00, /* peripheral device type (direct-access device) */
42 0x80, /* removable media bit */
43 0x00, /* ansi version, ecma version, iso version */
44 0x01, /* respond data format */
45 SCSI_INQUIRY_DATA_LENGTH - 5, /* additional length */
46 0x00, 0x00, 0x00, /* reserved */
47 'A', 'T', '3', '2', ' ', ' ', ' ', ' ', /* vendor information "AT32" */
48 'D', 'i', 's', 'k', '0', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', /* Product identification "Disk" */
49 '2', '.', '0', '0' /* product revision level */
50 }
51};
52
58uint8_t *get_inquiry(uint8_t lun)
59{
60 if(lun < MSC_SUPPORT_MAX_LUN)
61 return (uint8_t *)scsi_inquiry[lun];
62 else
63 return NULL;
64}
65
74 usb_sts_type msc_disk_read(uint8_t lun, uint64_t addr, uint8_t *read_buf, uint32_t len)
75{
76 uint32_t i = 0;
77 uint32_t flash_addr = (uint32_t)addr + USB_FLASH_ADDR_OFFSET;
78 switch(lun)
79 {
80 case 0:
81 for(i = 0; i < len; i ++)
82 {
83 read_buf[i] = *((uint8_t *)flash_addr);
84 flash_addr += 1;
85 }
86 break;
87 case 1:
88 break;
89 }
90 return USB_OK;
91}
92
101 usb_sts_type msc_disk_write(uint8_t lun, uint64_t addr, uint8_t *buf, uint32_t len)
102{
103 uint32_t flash_addr = (uint32_t)addr + USB_FLASH_ADDR_OFFSET;
104 uint32_t i = 0, page_len = 2048, tolen = len;
105 uint32_t erase_addr = flash_addr;
106 switch(lun)
107 {
108 case 0:
109 flash_unlock();
110 while(tolen >= page_len)
111 {
112 flash_sector_erase(erase_addr);
113 tolen -= page_len;
114 erase_addr += page_len;
115 }
116 for(i = 0; i < len; i ++)
117 {
118 flash_byte_program(flash_addr+i, buf[i]);
119 }
120 flash_lock();
121 break;
122 case 1:
123 break;
124 }
125 return USB_OK;
126}
127
135 usb_sts_type msc_disk_capacity(uint8_t lun, uint32_t *blk_nbr, uint32_t *blk_size)
136{
137 uint32_t flash_s = *((uint32_t *)0x1FFFF7E0);
138 msc_flash_size = (flash_s << 10) - (USB_FLASH_ADDR_OFFSET - FLASH_BASE);
139
140 if(flash_s < 256)
141 {
142 sector_size = SECTOR_SIZE_1K;
143 }
144 else
145 {
146 sector_size = SECTOR_SIZE_2K;
147 }
148
149 switch(lun)
150 {
151 case INTERNAL_FLASH_LUN:
152 *blk_nbr = msc_flash_size / sector_size;
153 *blk_size = sector_size;
154 break;
155 case SPI_FLASH_LUN:
156 break;
157 case SD_LUN:
158 break;
159 default:
160 break;
161 }
162 return USB_OK;
163}
164
USB_FLASH_ADDR_OFFSET
#define USB_FLASH_ADDR_OFFSET
Definition composite_vcp_msc/inc/msc_diskio.h:48
INTERNAL_FLASH_LUN
#define INTERNAL_FLASH_LUN
Definition composite_vcp_msc/inc/msc_diskio.h:44
msc_disk_capacity
usb_sts_type msc_disk_capacity(uint8_t lun, uint32_t *blk_nbr, uint32_t *blk_size)
disk capacity
Definition composite_vcp_msc/src/msc_diskio.c:135
SECTOR_SIZE_1K
#define SECTOR_SIZE_1K
Definition composite_vcp_msc/inc/msc_diskio.h:50
msc_flash_size
uint32_t msc_flash_size
Definition msc/src/msc_diskio.c:36
sector_size
uint32_t sector_size
Definition msc/src/msc_diskio.c:35
SECTOR_SIZE_2K
#define SECTOR_SIZE_2K
Definition composite_vcp_msc/inc/msc_diskio.h:51
SD_LUN
#define SD_LUN
Definition composite_vcp_msc/inc/msc_diskio.h:46
scsi_inquiry
uint8_t scsi_inquiry[1][36]
Definition msc/src/msc_diskio.c:37
SPI_FLASH_LUN
#define SPI_FLASH_LUN
Definition composite_vcp_msc/inc/msc_diskio.h:45
get_inquiry
uint8_t * get_inquiry(uint8_t lun)
get disk inquiry
Definition composite_vcp_msc/src/msc_diskio.c:58
msc_disk_read
usb_sts_type msc_disk_read(uint8_t lun, uint64_t addr, uint8_t *read_buf, uint32_t len)
disk read
Definition composite_vcp_msc/src/msc_diskio.c:74
msc_disk_write
usb_sts_type msc_disk_write(uint8_t lun, uint64_t addr, uint8_t *buf, uint32_t len)
disk write
Definition composite_vcp_msc/src/msc_diskio.c:101
flash_sector_erase
flash_status_type flash_sector_erase(uint32_t sector_address)
erase a specified flash sector.
Definition at32f413_flash.c:272
flash_byte_program
flash_status_type flash_byte_program(uint32_t address, uint8_t data)
program a byte at a specified address.
Definition at32f413_flash.c:491
flash_unlock
void flash_unlock(void)
unlock the flash controller.
Definition at32f413_flash.c:228
flash_lock
void flash_lock(void)
lock the flash controller.
Definition at32f413_flash.c:251
FLASH_BASE
#define FLASH_BASE
Definition at32f413.h:329
NULL
#define NULL
Definition emmc_card/inc/at32_sdio.h:340
SCSI_INQUIRY_DATA_LENGTH
#define SCSI_INQUIRY_DATA_LENGTH
Definition cdc_msc_class.h:156
MSC_SUPPORT_MAX_LUN
#define MSC_SUPPORT_MAX_LUN
Definition cdc_msc_class.h:82
usb_sts_type
usb_sts_type
usb return status
Definition usb_std.h:285
USB_OK
@ USB_OK
Definition usb_std.h:286
msc_bot_scsi.h
usb mass storage bulk-only transport and scsi command header file


AT32F413 Firmwary Library: msc_bot_scsi.h Source File

  • middlewares
  • usbd_class
  • msc
msc_bot_scsi.h
Go to the documentation of this file.
1
25/* define to prevent recursive inclusion -------------------------------------*/
26#ifndef __MSC_BOT_SCSI_H
27#define __MSC_BOT_SCSI_H
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33#include "msc_class.h"
34#include "usbd_core.h"
35
48#define MSC_SUPPORT_MAX_LUN 1
49#define MSC_MAX_DATA_BUF_LEN 4096
50
51#define MSC_CMD_FORMAT_UNIT 0x04
52#define MSC_CMD_INQUIRY 0x12
53#define MSC_CMD_START_STOP 0x1B
54#define MSC_CMD_MODE_SENSE6 0x1A
55#define MSC_CMD_MODE_SENSE10 0x5A
56#define MSC_CMD_ALLOW_MEDIUM_REMOVAL 0x1E
57#define MSC_CMD_READ_10 0x28
58#define MSC_CMD_READ_12 0xA8
59#define MSC_CMD_READ_CAPACITY 0x25
60#define MSC_CMD_READ_FORMAT_CAPACITY 0x23
61#define MSC_CMD_REQUEST_SENSE 0x03
62#define MSC_CMD_TEST_UNIT 0x00
63#define MSC_CMD_VERIFY 0x2F
64#define MSC_CMD_WRITE_10 0x2A
65#define MSC_CMD_WRITE_12 0xAA
66#define MSC_CMD_WRITE_VERIFY 0x2E
67
68#define MSC_REQ_GET_MAX_LUN 0xFE
69#define MSC_REQ_BO_RESET 0xFF
71#define SET_LINE_CODING 0x20
72#define GET_LINE_CODING 0x21
73
74#define CBW_CMD_LENGTH 31
75#define CBW_DCBWSIGNATURE 0x43425355
76#define CBW_BMCBWFLAGS_DIR_OUT 0x00
77#define CBW_BMCBWFLAGS_DIR_IN 0x80
78
79#define CSW_CMD_LENGTH 13
80#define CSW_DCSWSIGNATURE 0x53425355
81#define CSW_BCSWSTATUS_PASS 0x00
82#define CSW_BCSWSTATUS_FAILED 0x01
83#define CSW_BCSWSTATUS_PHASE_ERR 0x02
84
85#define MSC_STATE_MACHINE_CMD 0x00
86#define MSC_STATE_MACHINE_DATA_IN 0x01
87#define MSC_STATE_MACHINE_DATA_OUT 0x02
88#define MSC_STATE_MACHINE_SEND_DATA 0x03
89#define MSC_STATE_MACHINE_LAST_DATA 0x04
90#define MSC_STATE_MACHINE_STATUS 0x05
91#define MSC_STATE_MACHINE_FAILED 0x06
92#define MSC_STATE_MACHINE_IDLE 0x07
93
94#define MSC_BOT_STATE_IDLE 0x00
95#define MSC_BOT_STATE_RECOVERY 0x01
96#define MSC_BOT_STATE_ERROR 0x02
97
98#define REQ_SENSE_STANDARD_DATA_LEN 0x12
99#define SENSE_KEY_NO_SENSE 0x00
100#define SENSE_KEY_RECOVERED_ERROR 0x01
101#define SENSE_KEY_NOT_READY 0x02
102#define SENSE_KEY_MEDIUM_ERROR 0x03
103#define SENSE_KEY_HARDWARE_ERROR 0x04
104#define SENSE_KEY_ILLEGAL_REQUEST 0x05
105#define SENSE_KEY_UNIT_ATTENTION 0x06
106#define SENSE_KEY_DATA_PROTECT 0x07
107#define SENSE_KEY_BLANK_CHECK 0x08
108#define SENSE_KEY_VENDERO_SPECIFIC 0x09
109#define SENSE_KEY_ABORTED_COMMAND 0x0B
110#define SENSE_KEY_VOLUME_OVERFLOW 0x0D
111#define SENSE_KEY_MISCOMPARE 0x0E
112
113
114#define INVALID_COMMAND 0x20
115#define INVALID_FIELED_IN_COMMAND 0x24
116#define PARAMETER_LIST_LENGTH_ERROR 0x1A
117#define INVALID_FIELD_IN_PARAMETER_LIST 0x26
118#define ADDRESS_OUT_OF_RANGE 0x21
119#define MEDIUM_NOT_PRESENT 0x3A
120#define MEDIUM_HAVE_CHANGED 0x28
121
122#define SCSI_INQUIRY_DATA_LENGTH 36
123
127typedef struct
128{
129 uint8_t opcode;
130 uint8_t lun;
131 uint32_t address;
132 uint8_t reserved1;
133 uint32_t alloc_length;
134 uint16_t reserved2;
135}cbd_typical_type;
136
140typedef struct
141{
142 uint8_t opcode;
143 uint8_t lun;
144 uint32_t address;
145 uint8_t reserved1;
146 uint32_t alloc_length;
147 uint16_t reserved2;
148}cbd_extended_type;
149
153typedef struct
154{
155 uint32_t dCBWSignature;
156 uint32_t dCBWTage;
157 uint32_t dCBWDataTransferLength;
158 uint8_t bmCBWFlags;
159 uint8_t bCBWLUN;
160 uint8_t bCBWCBLength;
161 uint8_t CBWCB[16];
162}cbw_type;
163
167typedef struct
168{
169 uint32_t dCSWSignature;
170 uint32_t dCSWTag;
171 uint32_t dCSWDataResidue;
172 uint32_t bCSWStatus;
173}csw_type;
174
178typedef struct
179{
180 uint8_t err_code;
181 uint8_t reserved1;
182 uint8_t sense_key;
183 uint32_t information;
184 uint8_t as_length;
185 uint32_t reserved2;
186 uint8_t asc;
187 uint8_t ascq;
188 uint32_t reserved3;
189}sense_type;
190
191
192typedef struct
193{
194 uint8_t msc_state;
195 uint8_t bot_status;
196 uint32_t max_lun;
197
198 uint32_t blk_nbr[MSC_SUPPORT_MAX_LUN];
199 uint32_t blk_size[MSC_SUPPORT_MAX_LUN];
200
201 uint64_t blk_addr;
202 uint32_t blk_len;
203
204 uint32_t data_len;
205 uint8_t data[MSC_MAX_DATA_BUF_LEN];
206
207 uint32_t alt_setting;
208
209 cbw_type cbw_struct;
210 csw_type csw_struct;
211
212}msc_type;
213
214void bot_scsi_init(void *udev);
215void bot_scsi_reset(void *udev);
216void bot_scsi_datain_handler(void *pudev, uint8_t ept_num);
217void bot_scsi_dataout_handler(void *pudev, uint8_t ept_num);
218void bot_cbw_decode(void *udev);
219void bot_scsi_send_data(void *udev, uint8_t *buffer, uint32_t len);
220void bot_scsi_send_csw(void *udev, uint8_t status);
221void bot_scsi_sense_code(void *udev, uint8_t sense_key, uint8_t asc);
222 usb_sts_type bot_scsi_check_address(void *udev, uint8_t lun, uint32_t blk_offset, uint32_t blk_count);
223void bot_scsi_stall(void *udev);
224 usb_sts_type bot_scsi_cmd_process(void *udev);
225
226 usb_sts_type bot_scsi_test_unit(void *udev, uint8_t lun);
227 usb_sts_type bot_scsi_inquiry(void *udev, uint8_t lun);
228 usb_sts_type bot_scsi_start_stop(void *udev, uint8_t lun);
229 usb_sts_type bot_scsi_allow_medium_removal(void *udev, uint8_t lun);
230 usb_sts_type bot_scsi_mode_sense6(void *udev, uint8_t lun);
231 usb_sts_type bot_scsi_mode_sense10(void *udev, uint8_t lun);
232 usb_sts_type bot_scsi_read10(void *udev, uint8_t lun);
233 usb_sts_type bot_scsi_capacity(void *udev, uint8_t lun);
234 usb_sts_type bot_scsi_format_capacity(void *udev, uint8_t lun);
235 usb_sts_type bot_scsi_request_sense(void *udev, uint8_t lun);
236 usb_sts_type bot_scsi_verify(void *udev, uint8_t lun);
237 usb_sts_type bot_scsi_write10(void *udev, uint8_t lun);
238void bot_scsi_clear_feature(void *udev, uint8_t ept_num);
239
251#ifdef __cplusplus
252}
253#endif
254
255#endif
buffer
uint8_t buffer[((uint16_t) 160) *((uint16_t) 120)]
Definition project/at_start_f413/examples/cortex_m4/fpu/src/main.c:42
bot_scsi_format_capacity
usb_sts_type bot_scsi_format_capacity(void *udev, uint8_t lun)
bulk-only transport scsi command format capacity
Definition composite_cdc_msc/msc_bot_scsi.c:504
bot_scsi_start_stop
usb_sts_type bot_scsi_start_stop(void *udev, uint8_t lun)
bulk-only transport scsi command start stop
Definition composite_cdc_msc/msc_bot_scsi.c:409
bot_scsi_request_sense
usb_sts_type bot_scsi_request_sense(void *udev, uint8_t lun)
bulk-only transport scsi command request sense
Definition composite_cdc_msc/msc_bot_scsi.c:539
bot_scsi_dataout_handler
void bot_scsi_dataout_handler(void *pudev, uint8_t ept_num)
bulk-only transport data out handler
Definition composite_cdc_msc/msc_bot_scsi.c:172
MSC_MAX_DATA_BUF_LEN
#define MSC_MAX_DATA_BUF_LEN
Definition msc_bot_scsi.h:49
bot_scsi_read10
usb_sts_type bot_scsi_read10(void *udev, uint8_t lun)
bulk-only transport scsi command read10
Definition composite_cdc_msc/msc_bot_scsi.c:598
bot_scsi_check_address
usb_sts_type bot_scsi_check_address(void *udev, uint8_t lun, uint32_t blk_offset, uint32_t blk_count)
check address
Definition composite_cdc_msc/msc_bot_scsi.c:303
MSC_SUPPORT_MAX_LUN
#define MSC_SUPPORT_MAX_LUN
Definition msc_bot_scsi.h:48
bot_scsi_write10
usb_sts_type bot_scsi_write10(void *udev, uint8_t lun)
bulk-only transport scsi command write10
Definition composite_cdc_msc/msc_bot_scsi.c:659
bot_scsi_reset
void bot_scsi_reset(void *udev)
reset bulk-only transport and scsi
Definition composite_cdc_msc/msc_bot_scsi.c:125
bot_scsi_mode_sense10
usb_sts_type bot_scsi_mode_sense10(void *udev, uint8_t lun)
bulk-only transport scsi command mode sense10
Definition composite_cdc_msc/msc_bot_scsi.c:457
bot_scsi_sense_code
void bot_scsi_sense_code(void *udev, uint8_t sense_key, uint8_t asc)
send scsi sense code
Definition composite_cdc_msc/msc_bot_scsi.c:288
bot_cbw_decode
void bot_cbw_decode(void *udev)
bulk-only cbw decode
Definition composite_cdc_msc/msc_bot_scsi.c:196
bot_scsi_verify
usb_sts_type bot_scsi_verify(void *udev, uint8_t lun)
bulk-only transport scsi command verify
Definition composite_cdc_msc/msc_bot_scsi.c:570
bot_scsi_allow_medium_removal
usb_sts_type bot_scsi_allow_medium_removal(void *udev, uint8_t lun)
bulk-only transport scsi command meidum removal
Definition composite_cdc_msc/msc_bot_scsi.c:423
bot_scsi_init
void bot_scsi_init(void *udev)
initialize bulk-only transport and scsi
Definition composite_cdc_msc/msc_bot_scsi.c:103
bot_scsi_cmd_process
usb_sts_type bot_scsi_cmd_process(void *udev)
bulk-only transport scsi command process
Definition composite_cdc_msc/msc_bot_scsi.c:749
bot_scsi_datain_handler
void bot_scsi_datain_handler(void *pudev, uint8_t ept_num)
bulk-only transport data in handler
Definition composite_cdc_msc/msc_bot_scsi.c:143
bot_scsi_mode_sense6
usb_sts_type bot_scsi_mode_sense6(void *udev, uint8_t lun)
bulk-only transport scsi command mode sense6
Definition composite_cdc_msc/msc_bot_scsi.c:437
bot_scsi_stall
void bot_scsi_stall(void *udev)
bot endpoint stall
Definition composite_cdc_msc/msc_bot_scsi.c:320
bot_scsi_send_data
void bot_scsi_send_data(void *udev, uint8_t *buffer, uint32_t len)
send bot data
Definition composite_cdc_msc/msc_bot_scsi.c:243
bot_scsi_test_unit
usb_sts_type bot_scsi_test_unit(void *udev, uint8_t lun)
bulk-only transport scsi command test unit
Definition composite_cdc_msc/msc_bot_scsi.c:346
bot_scsi_inquiry
usb_sts_type bot_scsi_inquiry(void *udev, uint8_t lun)
bulk-only transport scsi command inquiry
Definition composite_cdc_msc/msc_bot_scsi.c:368
bot_scsi_capacity
usb_sts_type bot_scsi_capacity(void *udev, uint8_t lun)
bulk-only transport scsi command capacity
Definition composite_cdc_msc/msc_bot_scsi.c:477
bot_scsi_clear_feature
void bot_scsi_clear_feature(void *udev, uint8_t ept_num)
clear feature
Definition composite_cdc_msc/msc_bot_scsi.c:729
bot_scsi_send_csw
void bot_scsi_send_csw(void *udev, uint8_t status)
send command status
Definition composite_cdc_msc/msc_bot_scsi.c:264
usb_sts_type
usb_sts_type
usb return status
Definition usb_std.h:285
msc_class.h
usb msc class file
cbd_extended_type
extended command block description
Definition cdc_msc_class.h:175
cbd_typical_type
typical command block description
Definition cdc_msc_class.h:162
cbw_type
command block wrapper
Definition cdc_msc_class.h:188
csw_type
command block wrapper
Definition cdc_msc_class.h:202
msc_type
Definition cdc_msc_class.h:227
msc_type::blk_addr
uint64_t blk_addr
Definition msc_bot_scsi.h:201
sense_type
request sense standard data
Definition cdc_msc_class.h:213
usbd_core.h
usb device core header file


AT32F413 Firmwary Library: msc_class.c Source File

  • middlewares
  • usbd_class
  • msc
msc_class.c
Go to the documentation of this file.
1
25#include "usbd_core.h"
26#include "msc_class.h"
27#include "msc_desc.h"
28#include "msc_bot_scsi.h"
29
43static usb_sts_type class_init_handler(void *udev);
44static usb_sts_type class_clear_handler(void *udev);
45static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup);
46static usb_sts_type class_ept0_tx_handler(void *udev);
47static usb_sts_type class_ept0_rx_handler(void *udev);
48static usb_sts_type class_in_handler(void *udev, uint8_t ept_num);
49static usb_sts_type class_out_handler(void *udev, uint8_t ept_num);
50static usb_sts_type class_sof_handler(void *udev);
51static usb_sts_type class_event_handler(void *udev, usbd_event_type event);
52
53 msc_type msc_struct;
54
55/* usb device class handler */
56 usbd_class_handler msc_class_handler =
57{
58 class_init_handler,
59 class_clear_handler,
60 class_setup_handler,
61 class_ept0_tx_handler,
62 class_ept0_rx_handler,
63 class_in_handler,
64 class_out_handler,
65 class_sof_handler,
66 class_event_handler,
67 &msc_struct
68};
69
75static usb_sts_type class_init_handler(void *udev)
76{
77 usb_sts_type status = USB_OK;
78 usbd_core_type *pudev = (usbd_core_type *)udev;
79
80 /* open in endpoint */
81 usbd_ept_open(pudev, USBD_MSC_BULK_IN_EPT, EPT_BULK_TYPE, USBD_OUT_MAXPACKET_SIZE);
82
83 /* open out endpoint */
84 usbd_ept_open(pudev, USBD_MSC_BULK_OUT_EPT, EPT_BULK_TYPE, USBD_OUT_MAXPACKET_SIZE);
85
86 bot_scsi_init(udev);
87
88 return status;
89}
90
96static usb_sts_type class_clear_handler(void *udev)
97{
98 usb_sts_type status = USB_OK;
99 usbd_core_type *pudev = (usbd_core_type *)udev;
100
101 /* close in endpoint */
102 usbd_ept_close(pudev, USBD_MSC_BULK_IN_EPT);
103
104 /* close out endpoint */
105 usbd_ept_close(pudev, USBD_MSC_BULK_OUT_EPT);
106
107 return status;
108}
109
116static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
117{
118 usb_sts_type status = USB_OK;
119 usbd_core_type *pudev = (usbd_core_type *)udev;
120 msc_type *pmsc = (msc_type *)pudev->class_handler->pdata;
121 switch(setup->bmRequestType & USB_REQ_TYPE_RESERVED)
122 {
123 /* class request */
124 case USB_REQ_TYPE_CLASS:
125
126 switch(setup->bRequest)
127 {
128 case MSC_REQ_GET_MAX_LUN:
129 usbd_ctrl_send(pudev, (uint8_t *)&pmsc->max_lun, 1);
130 break;
131 case MSC_REQ_BO_RESET:
132 bot_scsi_reset(udev);
133 usbd_ctrl_send_status(pudev);
134 break;
135 default:
136 usbd_ctrl_unsupport(pudev);
137 break;
138
139 }
140 break;
141 /* standard request */
142 case USB_REQ_TYPE_STANDARD:
143
144 switch(setup->bRequest)
145 {
146 case USB_STD_REQ_GET_DESCRIPTOR:
147 usbd_ctrl_unsupport(pudev);
148 break;
149 case USB_STD_REQ_GET_INTERFACE:
150 usbd_ctrl_send(pudev, (uint8_t *)&pmsc->alt_setting, 1);
151 break;
152 case USB_STD_REQ_SET_INTERFACE:
153 pmsc->alt_setting = setup->wValue;
154 break;
155 case USB_STD_REQ_CLEAR_FEATURE:
156 usbd_ept_close(pudev, (uint8_t)setup->wIndex);
157
158 if((setup->wIndex & 0x80) == 0x80)
159 {
160 usbd_ept_open(pudev, (uint8_t)setup->wIndex, EPT_BULK_TYPE, USBD_IN_MAXPACKET_SIZE);
161 }
162 else
163 {
164 usbd_ept_open(pudev, (uint8_t)setup->wIndex, EPT_BULK_TYPE, USBD_OUT_MAXPACKET_SIZE);
165 }
166 bot_scsi_clear_feature(udev, setup->wIndex);
167 break;
168 case USB_STD_REQ_SET_FEATURE:
169 break;
170 default:
171 usbd_ctrl_unsupport(pudev);
172 break;
173 }
174 break;
175 default:
176 usbd_ctrl_unsupport(pudev);
177 break;
178 }
179 return status;
180}
181
187static usb_sts_type class_ept0_tx_handler(void *udev)
188{
189 usb_sts_type status = USB_OK;
190
191 /* ...user code... */
192
193 return status;
194}
195
201static usb_sts_type class_ept0_rx_handler(void *udev)
202{
203 usb_sts_type status = USB_OK;
204 usbd_core_type *pudev = (usbd_core_type *)udev;
205 uint32_t recv_len = usbd_get_recv_len(pudev, 0);
206 /* ...user code... */
207 return status;
208}
209
216static usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
217{
218 usb_sts_type status = USB_OK;
219
220 bot_scsi_datain_handler(udev, ept_num);
221 return status;
222}
223
230static usb_sts_type class_out_handler(void *udev, uint8_t ept_num)
231{
232 usb_sts_type status = USB_OK;
233 bot_scsi_dataout_handler(udev, ept_num);
234 return status;
235}
236
242static usb_sts_type class_sof_handler(void *udev)
243{
244 usb_sts_type status = USB_OK;
245
246 /* ...user code... */
247
248 return status;
249}
250
257static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
258{
259 usb_sts_type status = USB_OK;
260 switch(event)
261 {
262 case USBD_RESET_EVENT:
263
264 /* ...user code... */
265
266 break;
267 case USBD_SUSPEND_EVENT:
268
269 /* ...user code... */
270
271 break;
272 case USBD_WAKEUP_EVENT:
273 /* ...user code... */
274
275 break;
276
277 default:
278 break;
279 }
280 return status;
281}
msc_type::max_lun
uint32_t max_lun
Definition cdc_msc_class.h:230
msc_type::alt_setting
uint32_t alt_setting
Definition cdc_msc_class.h:241
USBD_MSC_BULK_IN_EPT
#define USBD_MSC_BULK_IN_EPT
Definition cdc_msc_class.h:56
USBD_MSC_BULK_OUT_EPT
#define USBD_MSC_BULK_OUT_EPT
Definition cdc_msc_class.h:57
bot_scsi_dataout_handler
void bot_scsi_dataout_handler(void *pudev, uint8_t ept_num)
bulk-only transport data out handler
Definition composite_cdc_msc/msc_bot_scsi.c:172
bot_scsi_reset
void bot_scsi_reset(void *udev)
reset bulk-only transport and scsi
Definition composite_cdc_msc/msc_bot_scsi.c:125
bot_scsi_init
void bot_scsi_init(void *udev)
initialize bulk-only transport and scsi
Definition composite_cdc_msc/msc_bot_scsi.c:103
bot_scsi_datain_handler
void bot_scsi_datain_handler(void *pudev, uint8_t ept_num)
bulk-only transport data in handler
Definition composite_cdc_msc/msc_bot_scsi.c:143
bot_scsi_clear_feature
void bot_scsi_clear_feature(void *udev, uint8_t ept_num)
clear feature
Definition composite_cdc_msc/msc_bot_scsi.c:729
EPT_BULK_TYPE
@ EPT_BULK_TYPE
Definition at32f413_usb.h:204
MSC_REQ_BO_RESET
#define MSC_REQ_BO_RESET
Definition cdc_msc_class.h:103
MSC_REQ_GET_MAX_LUN
#define MSC_REQ_GET_MAX_LUN
Definition cdc_msc_class.h:102
USBD_OUT_MAXPACKET_SIZE
#define USBD_OUT_MAXPACKET_SIZE
Definition msc_class.h:52
USBD_IN_MAXPACKET_SIZE
#define USBD_IN_MAXPACKET_SIZE
Definition msc_class.h:51
class_sof_handler
static usb_sts_type class_sof_handler(void *udev)
usb device sof handler
Definition msc_class.c:242
class_in_handler
static usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
usb device transmision complete handler
Definition msc_class.c:216
msc_struct
msc_type msc_struct
Definition msc_class.c:53
class_clear_handler
static usb_sts_type class_clear_handler(void *udev)
clear endpoint or other state
Definition msc_class.c:96
class_setup_handler
static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
usb device class setup request handler
Definition msc_class.c:116
class_ept0_tx_handler
static usb_sts_type class_ept0_tx_handler(void *udev)
usb device endpoint 0 in status stage complete
Definition msc_class.c:187
class_ept0_rx_handler
static usb_sts_type class_ept0_rx_handler(void *udev)
usb device endpoint 0 out status stage complete
Definition msc_class.c:201
class_event_handler
static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
usb device event handler
Definition msc_class.c:257
class_init_handler
static usb_sts_type class_init_handler(void *udev)
initialize usb endpoint
Definition msc_class.c:75
msc_class_handler
usbd_class_handler msc_class_handler
Definition msc_class.c:56
class_out_handler
static usb_sts_type class_out_handler(void *udev, uint8_t ept_num)
usb device endpoint receive data
Definition msc_class.c:230
USB_STD_REQ_CLEAR_FEATURE
#define USB_STD_REQ_CLEAR_FEATURE
Definition usb_std.h:77
USB_REQ_TYPE_STANDARD
#define USB_REQ_TYPE_STANDARD
usb request type
Definition usb_std.h:62
USB_STD_REQ_GET_DESCRIPTOR
#define USB_STD_REQ_GET_DESCRIPTOR
Definition usb_std.h:80
USB_STD_REQ_SET_FEATURE
#define USB_STD_REQ_SET_FEATURE
Definition usb_std.h:78
USB_STD_REQ_SET_INTERFACE
#define USB_STD_REQ_SET_INTERFACE
Definition usb_std.h:85
USB_REQ_TYPE_RESERVED
#define USB_REQ_TYPE_RESERVED
Definition usb_std.h:65
USB_STD_REQ_GET_INTERFACE
#define USB_STD_REQ_GET_INTERFACE
Definition usb_std.h:84
USB_REQ_TYPE_CLASS
#define USB_REQ_TYPE_CLASS
Definition usb_std.h:63
usb_sts_type
usb_sts_type
usb return status
Definition usb_std.h:285
USB_OK
@ USB_OK
Definition usb_std.h:286
usbd_ept_close
void usbd_ept_close(usbd_core_type *udev, uint8_t ept_addr)
usb close endpoint
Definition usbd_core.c:541
usbd_ctrl_send_status
void usbd_ctrl_send_status(usbd_core_type *udev)
usb control endpoint send in status
Definition usbd_core.c:210
usbd_ept_open
void usbd_ept_open(usbd_core_type *udev, uint8_t ept_addr, uint8_t ept_type, uint16_t maxpacket)
usb open endpoint
Definition usbd_core.c:506
usbd_ctrl_send
void usbd_ctrl_send(usbd_core_type *udev, uint8_t *buffer, uint16_t len)
usb control endpoint send data
Definition usbd_core.c:175
usbd_get_recv_len
uint32_t usbd_get_recv_len(usbd_core_type *udev, uint8_t ept_addr)
usb endpoint get receive data length
Definition usbd_core.c:397
usbd_ctrl_unsupport
void usbd_ctrl_unsupport(usbd_core_type *udev)
un-support device request
Definition usbd_core.c:289
usbd_event_type
usbd_event_type
usb device event
Definition usbd_core.h:54
USBD_SUSPEND_EVENT
@ USBD_SUSPEND_EVENT
Definition usbd_core.h:57
USBD_RESET_EVENT
@ USBD_RESET_EVENT
Definition usbd_core.h:56
USBD_WAKEUP_EVENT
@ USBD_WAKEUP_EVENT
Definition usbd_core.h:58
msc_bot_scsi.h
usb mass storage bulk-only transport and scsi command header file
msc_class.h
usb msc class file
msc_desc.h
usb msc descriptor header file
msc_type
Definition cdc_msc_class.h:227
usb_setup_type
format of usb setup data
Definition usb_std.h:297
usb_setup_type::wValue
uint16_t wValue
Definition usb_std.h:300
usb_setup_type::bmRequestType
uint8_t bmRequestType
Definition usb_std.h:298
usb_setup_type::wIndex
uint16_t wIndex
Definition usb_std.h:301
usb_setup_type::bRequest
uint8_t bRequest
Definition usb_std.h:299
usbd_class_handler
usb device class handler
Definition usbd_core.h:97
usbd_class_handler::pdata
void * pdata
Definition usbd_core.h:107
usbd_core_type
usb device core struct type
Definition usbd_core.h:114
usbd_core_type::class_handler
usbd_class_handler * class_handler
Definition usbd_core.h:117
usbd_core.h
usb device core header file


AT32F413 Firmwary Library: msc_class.h Source File

  • middlewares
  • usbd_class
  • msc
msc_class.h
Go to the documentation of this file.
1
25 /* define to prevent recursive inclusion -------------------------------------*/
26#ifndef __MSC_CLASS_H
27#define __MSC_CLASS_H
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33#include "usb_std.h"
34#include "usbd_core.h"
35
48#define USBD_MSC_BULK_IN_EPT 0x81
49#define USBD_MSC_BULK_OUT_EPT 0x01
50
51#define USBD_IN_MAXPACKET_SIZE 0x40
52#define USBD_OUT_MAXPACKET_SIZE 0x40
53
54
55extern usbd_class_handler msc_class_handler;
67#ifdef __cplusplus
68}
69#endif
70
71#endif
msc_class_handler
usbd_class_handler msc_class_handler
Definition msc_class.c:56
usbd_class_handler
usb device class handler
Definition usbd_core.h:97
usb_std.h
usb standard header file
usbd_core.h
usb device core header file


AT32F413 Firmwary Library: msc_desc.c Source File

  • middlewares
  • usbd_class
  • msc
msc_desc.c
Go to the documentation of this file.
1
25#include "stdio.h"
26#include "usb_std.h"
27#include "usbd_sdr.h"
28#include "usbd_core.h"
29#include "msc_desc.h"
30
44static usbd_desc_t *get_device_descriptor(void);
45static usbd_desc_t *get_device_qualifier(void);
46static usbd_desc_t *get_device_configuration(void);
47static usbd_desc_t *get_device_other_speed(void);
48static usbd_desc_t *get_device_lang_id(void);
49static usbd_desc_t *get_device_manufacturer_string(void);
50static usbd_desc_t *get_device_product_string(void);
51static usbd_desc_t *get_device_serial_string(void);
52static usbd_desc_t *get_device_interface_string(void);
53static usbd_desc_t *get_device_config_string(void);
54
55static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf);
56static void usbd_int_to_unicode (uint32_t value , uint8_t *pbuf , uint8_t len);
57static void get_serial_num(void);
58#if defined ( __ICCARM__ ) /* iar compiler */
59 #pragma data_alignment=4
60#endif
61ALIGNED_HEAD static uint8_t g_usbd_desc_buffer[256] ALIGNED_TAIL;
62
66 usbd_desc_handler msc_desc_handler =
67{
68 get_device_descriptor,
69 get_device_qualifier,
70 get_device_configuration,
71 get_device_other_speed,
72 get_device_lang_id,
73 get_device_manufacturer_string,
74 get_device_product_string,
75 get_device_serial_string,
76 get_device_interface_string,
77 get_device_config_string,
78};
79
83#if defined ( __ICCARM__ ) /* iar compiler */
84 #pragma data_alignment=4
85#endif
86ALIGNED_HEAD static uint8_t g_usbd_descriptor[USB_DEVICE_DESC_LEN] ALIGNED_TAIL =
87{
88 USB_DEVICE_DESC_LEN, /* bLength */
89 USB_DESCIPTOR_TYPE_DEVICE, /* bDescriptorType */
90 0x00, /* bcdUSB */
91 0x02,
92 0x00, /* bDeviceClass */
93 0x00, /* bDeviceSubClass */
94 0x00, /* bDeviceProtocol */
95 USB_MAX_EP0_SIZE, /* bMaxPacketSize */
96 LBYTE(USBD_MSC_VENDOR_ID), /* idVendor */
97 HBYTE(USBD_MSC_VENDOR_ID), /* idVendor */
98 LBYTE(USBD_MSC_PRODUCT_ID), /* idProduct */
99 HBYTE(USBD_MSC_PRODUCT_ID), /* idProduct */
100 0x00, /* bcdDevice rel. 2.00 */
101 0x02,
102 USB_MFC_STRING, /* Index of manufacturer string */
103 USB_PRODUCT_STRING, /* Index of product string */
104 USB_SERIAL_STRING, /* Index of serial number string */
105 1 /* bNumConfigurations */
106};
107
111#if defined ( __ICCARM__ ) /* iar compiler */
112 #pragma data_alignment=4
113#endif
114ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_MSC_CONFIG_DESC_SIZE] ALIGNED_TAIL =
115{
116 USB_DEVICE_CFG_DESC_LEN, /* bLength: configuration descriptor size */
117 USB_DESCIPTOR_TYPE_CONFIGURATION, /* bDescriptorType: configuration */
118 LBYTE(USBD_MSC_CONFIG_DESC_SIZE), /* wTotalLength: bytes returned */
119 HBYTE(USBD_MSC_CONFIG_DESC_SIZE), /* wTotalLength: bytes returned */
120 0x01, /* bNumInterfaces: 2 interface */
121 0x01, /* bConfigurationValue: configuration value */
122 0x04, /* iConfiguration: index of string descriptor describing
123 the configuration */
124 0xC0, /* bmAttributes: self powered */
125 0x32, /* MaxPower 100 mA: this current is used for detecting vbus */
126
127 USB_DEVICE_IF_DESC_LEN, /* bLength: interface descriptor size */
128 USB_DESCIPTOR_TYPE_INTERFACE, /* bDescriptorType: interface descriptor type */
129 0x00, /* bInterfaceNumber: number of interface */
130 0x00, /* bAlternateSetting: alternate set */
131 0x02, /* bNumEndpoints: number of endpoints */
132 USB_CLASS_CODE_MSC, /* bInterfaceClass: msc class code */
133 0x06, /* bInterfaceSubClass: subclass code scsi */
134 0x50, /* bInterfaceProtocol: protocol code BBB */
135 0x05, /* iInterface: index of string descriptor */
136
137 USB_DEVICE_EPT_LEN, /* bLength: size of endpoint descriptor in bytes */
138 USB_DESCIPTOR_TYPE_ENDPOINT, /* bDescriptorType: endpoint descriptor type */
139 USBD_MSC_BULK_IN_EPT, /* bEndpointAddress: the address of endpoint on usb device described by this descriptor */
140 USB_EPT_DESC_BULK, /* bmAttributes: endpoint attributes */
141 LBYTE(USBD_IN_MAXPACKET_SIZE),
142 HBYTE(USBD_IN_MAXPACKET_SIZE), /* wMaxPacketSize: maximum packe size this endpoint */
143 0x00, /* bInterval: interval for polling endpoint for data transfers */
144
145 USB_DEVICE_EPT_LEN, /* bLength: size of endpoint descriptor in bytes */
146 USB_DESCIPTOR_TYPE_ENDPOINT, /* bDescriptorType: endpoint descriptor type */
147 USBD_MSC_BULK_OUT_EPT, /* bEndpointAddress: the address of endpoint on usb device described by this descriptor */
148 USB_EPT_DESC_BULK, /* bmAttributes: endpoint attributes */
149 LBYTE(USBD_OUT_MAXPACKET_SIZE),
150 HBYTE(USBD_OUT_MAXPACKET_SIZE), /* wMaxPacketSize: maximum packe size this endpoint */
151 0x00, /* bInterval: interval for polling endpoint for data transfers */
152};
153
157#if defined ( __ICCARM__ ) /* iar compiler */
158 #pragma data_alignment=4
159#endif
160ALIGNED_HEAD static uint8_t g_string_lang_id[USBD_MSC_SIZ_STRING_LANGID] ALIGNED_TAIL =
161{
162 USBD_MSC_SIZ_STRING_LANGID,
163 USB_DESCIPTOR_TYPE_STRING,
164 0x09,
165 0x04,
166};
167
171#if defined ( __ICCARM__ ) /* iar compiler */
172 #pragma data_alignment=4
173#endif
174ALIGNED_HEAD static uint8_t g_string_serial[USBD_MSC_SIZ_STRING_SERIAL] ALIGNED_TAIL =
175{
176 USBD_MSC_SIZ_STRING_SERIAL,
177 USB_DESCIPTOR_TYPE_STRING,
178};
179
180
181/* device descriptor */
182static usbd_desc_t device_descriptor =
183{
184 USB_DEVICE_DESC_LEN,
185 g_usbd_descriptor
186};
187
188/* config descriptor */
189static usbd_desc_t config_descriptor =
190{
191 USBD_MSC_CONFIG_DESC_SIZE,
192 g_usbd_configuration
193};
194
195/* langid descriptor */
196static usbd_desc_t langid_descriptor =
197{
198 USBD_MSC_SIZ_STRING_LANGID,
199 g_string_lang_id
200};
201
202/* serial descriptor */
203static usbd_desc_t serial_descriptor =
204{
205 USBD_MSC_SIZ_STRING_SERIAL,
206 g_string_serial
207};
208
209static usbd_desc_t vp_desc;
210
217static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf)
218{
219 uint16_t str_len = 0, id_pos = 2;
220 uint8_t *tmp_str = string;
221
222 while(*tmp_str != '\0')
223 {
224 str_len ++;
225 unicode_buf[id_pos ++] = *tmp_str ++;
226 unicode_buf[id_pos ++] = 0x00;
227 }
228
229 str_len = str_len * 2 + 2;
230 unicode_buf[0] = (uint8_t)str_len;
231 unicode_buf[1] = USB_DESCIPTOR_TYPE_STRING;
232
233 return str_len;
234}
235
243static void usbd_int_to_unicode (uint32_t value , uint8_t *pbuf , uint8_t len)
244{
245 uint8_t idx = 0;
246
247 for( idx = 0 ; idx < len ; idx ++)
248 {
249 if( ((value >> 28)) < 0xA )
250 {
251 pbuf[ 2 * idx] = (value >> 28) + '0';
252 }
253 else
254 {
255 pbuf[2 * idx] = (value >> 28) + 'A' - 10;
256 }
257
258 value = value << 4;
259
260 pbuf[2 * idx + 1] = 0;
261 }
262}
263
269static void get_serial_num(void)
270{
271 uint32_t serial0, serial1, serial2;
272
273 serial0 = *(uint32_t*)MCU_ID1;
274 serial1 = *(uint32_t*)MCU_ID2;
275 serial2 = *(uint32_t*)MCU_ID3;
276
277 serial0 += serial2;
278
279 if (serial0 != 0)
280 {
281 usbd_int_to_unicode (serial0, &g_string_serial[2] ,8);
282 usbd_int_to_unicode (serial1, &g_string_serial[18] ,4);
283 }
284}
285
291static usbd_desc_t *get_device_descriptor(void)
292{
293 return &device_descriptor;
294}
295
301static usbd_desc_t * get_device_qualifier(void)
302{
303 return NULL;
304}
305
311static usbd_desc_t *get_device_configuration(void)
312{
313 return &config_descriptor;
314}
315
321static usbd_desc_t *get_device_other_speed(void)
322{
323 return NULL;
324}
325
331static usbd_desc_t *get_device_lang_id(void)
332{
333 return &langid_descriptor;
334}
335
336
342static usbd_desc_t *get_device_manufacturer_string(void)
343{
344 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_MSC_DESC_MANUFACTURER_STRING, g_usbd_desc_buffer);
345 vp_desc.descriptor = g_usbd_desc_buffer;
346 return &vp_desc;
347}
348
354static usbd_desc_t *get_device_product_string(void)
355{
356 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_MSC_DESC_PRODUCT_STRING, g_usbd_desc_buffer);
357 vp_desc.descriptor = g_usbd_desc_buffer;
358 return &vp_desc;
359}
360
366static usbd_desc_t *get_device_serial_string(void)
367{
368 get_serial_num();
369 return &serial_descriptor;
370}
371
377static usbd_desc_t *get_device_interface_string(void)
378{
379 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_MSC_DESC_INTERFACE_STRING, g_usbd_desc_buffer);
380 vp_desc.descriptor = g_usbd_desc_buffer;
381 return &vp_desc;
382}
383
389static usbd_desc_t *get_device_config_string(void)
390{
391 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_MSC_DESC_CONFIGURATION_STRING, g_usbd_desc_buffer);
392 vp_desc.descriptor = g_usbd_desc_buffer;
393 return &vp_desc;
394}
395
NULL
#define NULL
Definition emmc_card/inc/at32_sdio.h:340
MCU_ID1
#define MCU_ID1
Definition audio_desc.h:214
MCU_ID2
#define MCU_ID2
Definition audio_desc.h:215
MCU_ID3
#define MCU_ID3
Definition audio_desc.h:216
USBD_MSC_BULK_IN_EPT
#define USBD_MSC_BULK_IN_EPT
Definition cdc_msc_class.h:56
USBD_MSC_BULK_OUT_EPT
#define USBD_MSC_BULK_OUT_EPT
Definition cdc_msc_class.h:57
USBD_OUT_MAXPACKET_SIZE
#define USBD_OUT_MAXPACKET_SIZE
Definition msc_class.h:52
USBD_IN_MAXPACKET_SIZE
#define USBD_IN_MAXPACKET_SIZE
Definition msc_class.h:51
USBD_MSC_SIZ_STRING_SERIAL
#define USBD_MSC_SIZ_STRING_SERIAL
Definition msc_desc.h:56
USBD_MSC_DESC_PRODUCT_STRING
#define USBD_MSC_DESC_PRODUCT_STRING
Definition msc_desc.h:59
USBD_MSC_DESC_CONFIGURATION_STRING
#define USBD_MSC_DESC_CONFIGURATION_STRING
Definition msc_desc.h:60
USBD_MSC_DESC_INTERFACE_STRING
#define USBD_MSC_DESC_INTERFACE_STRING
Definition msc_desc.h:61
USBD_MSC_CONFIG_DESC_SIZE
#define USBD_MSC_CONFIG_DESC_SIZE
Definition msc_desc.h:54
USBD_MSC_PRODUCT_ID
#define USBD_MSC_PRODUCT_ID
Definition msc_desc.h:52
USBD_MSC_SIZ_STRING_LANGID
#define USBD_MSC_SIZ_STRING_LANGID
Definition msc_desc.h:55
USBD_MSC_VENDOR_ID
#define USBD_MSC_VENDOR_ID
Definition msc_desc.h:51
USBD_MSC_DESC_MANUFACTURER_STRING
#define USBD_MSC_DESC_MANUFACTURER_STRING
Definition msc_desc.h:58
serial_descriptor
static usbd_desc_t serial_descriptor
Definition msc_desc.c:203
device_descriptor
static usbd_desc_t device_descriptor
Definition msc_desc.c:182
get_device_configuration
static usbd_desc_t * get_device_configuration(void)
get config descriptor
Definition msc_desc.c:311
langid_descriptor
static usbd_desc_t langid_descriptor
Definition msc_desc.c:196
get_device_descriptor
static usbd_desc_t * get_device_descriptor(void)
get device descriptor
Definition msc_desc.c:291
get_device_manufacturer_string
static usbd_desc_t * get_device_manufacturer_string(void)
get manufacturer descriptor
Definition msc_desc.c:342
get_device_qualifier
static usbd_desc_t * get_device_qualifier(void)
get device qualifier
Definition msc_desc.c:301
get_device_interface_string
static usbd_desc_t * get_device_interface_string(void)
get interface descriptor
Definition msc_desc.c:377
vp_desc
static usbd_desc_t vp_desc
Definition msc_desc.c:209
get_device_other_speed
static usbd_desc_t * get_device_other_speed(void)
get other speed descriptor
Definition msc_desc.c:321
ALIGNED_TAIL
static ALIGNED_HEAD uint8_t g_usbd_desc_buffer[256] ALIGNED_TAIL
usb device standard descriptor
Definition msc_desc.c:61
get_device_product_string
static usbd_desc_t * get_device_product_string(void)
get product descriptor
Definition msc_desc.c:354
get_device_config_string
static usbd_desc_t * get_device_config_string(void)
get device config descriptor
Definition msc_desc.c:389
usbd_unicode_convert
static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf)
standard usb unicode convert
Definition msc_desc.c:217
get_device_lang_id
static usbd_desc_t * get_device_lang_id(void)
get lang id descriptor
Definition msc_desc.c:331
get_serial_num
static void get_serial_num(void)
usb get serial number
Definition msc_desc.c:269
config_descriptor
static usbd_desc_t config_descriptor
Definition msc_desc.c:189
msc_desc_handler
usbd_desc_handler msc_desc_handler
device descriptor handler structure
Definition msc_desc.c:66
get_device_serial_string
static usbd_desc_t * get_device_serial_string(void)
get serial descriptor
Definition msc_desc.c:366
usbd_int_to_unicode
static void usbd_int_to_unicode(uint32_t value, uint8_t *pbuf, uint8_t len)
usb int convert to unicode
Definition msc_desc.c:243
HBYTE
#define HBYTE(x)
Definition usb_std.h:271
USB_DEVICE_EPT_LEN
#define USB_DEVICE_EPT_LEN
Definition usb_std.h:159
USB_MAX_EP0_SIZE
#define USB_MAX_EP0_SIZE
endpoint 0 max size
Definition usb_std.h:248
USB_PRODUCT_STRING
#define USB_PRODUCT_STRING
Definition usb_std.h:105
USB_DESCIPTOR_TYPE_CONFIGURATION
#define USB_DESCIPTOR_TYPE_CONFIGURATION
Definition usb_std.h:92
USB_CLASS_CODE_MSC
#define USB_CLASS_CODE_MSC
Definition usb_std.h:171
LBYTE
#define LBYTE(x)
low byte and high byte define
Definition usb_std.h:270
USB_DESCIPTOR_TYPE_ENDPOINT
#define USB_DESCIPTOR_TYPE_ENDPOINT
Definition usb_std.h:95
USB_DEVICE_DESC_LEN
#define USB_DEVICE_DESC_LEN
Definition usb_std.h:156
USB_MFC_STRING
#define USB_MFC_STRING
Definition usb_std.h:104
USB_EPT_DESC_BULK
#define USB_EPT_DESC_BULK
Definition usb_std.h:183
USB_DEVICE_IF_DESC_LEN
#define USB_DEVICE_IF_DESC_LEN
Definition usb_std.h:158
USB_DEVICE_CFG_DESC_LEN
#define USB_DEVICE_CFG_DESC_LEN
Definition usb_std.h:157
USB_SERIAL_STRING
#define USB_SERIAL_STRING
Definition usb_std.h:106
USB_DESCIPTOR_TYPE_DEVICE
#define USB_DESCIPTOR_TYPE_DEVICE
usb standard device type
Definition usb_std.h:91
USB_DESCIPTOR_TYPE_STRING
#define USB_DESCIPTOR_TYPE_STRING
Definition usb_std.h:93
USB_DESCIPTOR_TYPE_INTERFACE
#define USB_DESCIPTOR_TYPE_INTERFACE
Definition usb_std.h:94
msc_desc.h
usb msc descriptor header file
usbd_desc_handler
usb device descriptor handler
Definition usbd_core.h:75
usbd_desc_t
usb device descriptor struct
Definition usbd_core.h:66
usbd_desc_t::length
uint16_t length
Definition usbd_core.h:67
usbd_desc_t::descriptor
uint8_t * descriptor
Definition usbd_core.h:68
usb_std.h
usb standard header file
usbd_core.h
usb device core header file
usbd_sdr.h
usb standard request header file


AT32F413 Firmwary Library: msc_desc.h Source File

  • middlewares
  • usbd_class
  • msc
msc_desc.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __MSC_DESC_H
28#define __MSC_DESC_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "msc_class.h"
35#include "usbd_core.h"
36
49#define MSC_BCD_NUM 0x0110
50
51#define USBD_MSC_VENDOR_ID 0x2E3C
52#define USBD_MSC_PRODUCT_ID 0x5720
53
54#define USBD_MSC_CONFIG_DESC_SIZE 32
55#define USBD_MSC_SIZ_STRING_LANGID 4
56#define USBD_MSC_SIZ_STRING_SERIAL 0x1A
57
58#define USBD_MSC_DESC_MANUFACTURER_STRING "Artery"
59#define USBD_MSC_DESC_PRODUCT_STRING "AT32 Mass Storage"
60#define USBD_MSC_DESC_CONFIGURATION_STRING "Mass Storage Config"
61#define USBD_MSC_DESC_INTERFACE_STRING "Mass Storage Interface"
62
63#define MCU_ID1 (0x1FFFF7E8)
64#define MCU_ID2 (0x1FFFF7EC)
65#define MCU_ID3 (0x1FFFF7F0)
66
67extern usbd_desc_handler msc_desc_handler;
68
80#ifdef __cplusplus
81}
82#endif
83
84#endif
msc_desc_handler
usbd_desc_handler msc_desc_handler
device descriptor handler structure
Definition msc_desc.c:66
msc_class.h
usb msc class file
usbd_desc_handler
usb device descriptor handler
Definition usbd_core.h:75
usbd_core.h
usb device core header file


AT32F413 Firmwary Library: operate_spim.c Source File

  • flash
  • operate_spim
  • src
operate_spim.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "operate_spim.h"
28#include <string.h>
29
30
40uint8_t write_buffer[4096]; /* the content writed to spim flash */
41uint8_t read_buffer[4096]; /* the content read from spim flash */
42
48void spim_init(void)
49{
50 gpio_init_type gpio_init_struct;
51
52 /* enable the clock */
53 crm_periph_clock_enable(CRM_IOMUX_PERIPH_CLOCK, TRUE);
54 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
55 crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
56
57 /* init spim io */
58 gpio_default_para_init(&gpio_init_struct);
59 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
60 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
61 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
62 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
63 gpio_init_struct.gpio_pins = GPIO_PINS_8;
64 gpio_init(GPIOA, &gpio_init_struct);
65 gpio_init_struct.gpio_pins = GPIO_PINS_1 | GPIO_PINS_6 | GPIO_PINS_7 | GPIO_PINS_10 | GPIO_PINS_11;
66 gpio_init(GPIOB, &gpio_init_struct);
67
68 /* enable spim, and select pb10, pb11 as spim io */
69 gpio_pin_remap_config(EXT_SPIM_GMUX_1001, TRUE);
70
71 /* in this example, use on-board en25qh128a as spim flash */
72 flash_spim_model_select(FLASH_SPIM_MODEL2);
73
74 /* for model 1 flash, a delay needs to be added */
75 delay_ms(20);
76
77 /* unlock the spim flash program erase controller */
78 while(flash_flag_get(FLASH_SPIM_OBF_FLAG));
79 flash_spim_unlock();
80 while(FLASH->ctrl3_bit.oplk);
81
82 /* if the data written to spim flash need to be scrambled, please specify the scrambled range */
83 flash_spim_encryption_range_set(0);
84
85 return;
86}
87
95void sector_read(uint32_t address, uint32_t sector_size, uint8_t *buf)
96{
97 while(sector_size)
98 {
99 *(uint32_t *)buf = *(uint32_t *)address;
100 sector_size -= sizeof(uint32_t);
101 address += sizeof(uint32_t);
102 buf += sizeof(uint32_t);
103 }
104}
105
111void spim_operate(void)
112{
113 uint16_t i = 0;
114 flash_status_type status = FLASH_OPERATE_DONE;
115
116 /* configures the spim flash */
117 spim_init();
118
119 /* fill the content to be writed to spim flash */
120 for(i = 0; i < SPIM_SECTOR_SIZE; i++)
121 {
122 write_buffer[i] = i % 256;
123 }
124
125 /* wait for operation to be completed */
126 status = flash_operation_wait_for(ERASE_TIMEOUT);
127
128 if((status == FLASH_PROGRAM_ERROR) || (status == FLASH_EPP_ERROR))
129 flash_flag_clear(FLASH_PRGMERR_FLAG | FLASH_EPPERR_FLAG);
130 else if(status == FLASH_OPERATE_TIMEOUT)
131 {
132 /* test spim fail */
133 return;
134 }
135 /* erase an spim flash sector */
136 if(flash_sector_erase(SPIM_TEST_ADDR) != FLASH_OPERATE_DONE)
137 {
138 /* test spim fail */
139 return;
140 }
141
142 /* read an spim flash sector */
143 memset(read_buffer, 0, SPIM_SECTOR_SIZE);
144 sector_read(SPIM_TEST_ADDR, SPIM_SECTOR_SIZE, read_buffer);
145
146 /* check if the desired sector are erased */
147 for(i = 0; i < SPIM_SECTOR_SIZE; i++)
148 {
149 if(read_buffer[i] != 0xff)
150 {
151 /* test spim fail */
152 return;
153 }
154 }
155
156 /* program an spim flash sector */
157 i = 0;
158 while(i < SPIM_SECTOR_SIZE)
159 {
160 status = flash_word_program(SPIM_TEST_ADDR + i, *(uint32_t *)(write_buffer + i));
161 if(status != FLASH_OPERATE_DONE)
162 {
163 /* test spim fail */
164 return;
165 }
166 i = i + 4;
167 }
168
169 /* read an spim flash sector */
170 memset(read_buffer, 0, SPIM_SECTOR_SIZE);
171 sector_read(SPIM_TEST_ADDR, SPIM_SECTOR_SIZE, read_buffer);
172
173 /* check if reading result and writing content are the same */
174 for(i = 0; i < SPIM_SECTOR_SIZE; i++)
175 {
176 if(read_buffer[i] != write_buffer[i])
177 {
178 /* test spim fail */
179 return;
180 }
181 }
182
183 while(1)
184 {
185 /* toggle led */
186 at32_led_toggle(LED2);
187 delay_ms(100);
188 at32_led_toggle(LED3);
189 delay_ms(100);
190 at32_led_toggle(LED4);
191 delay_ms(100);
192 }
193}
194
195
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
write_buffer
uint8_t write_buffer[4096]
Definition operate_spim.c:40
SPIM_SECTOR_SIZE
#define SPIM_SECTOR_SIZE
Definition operate_spim.h:42
sector_read
void sector_read(uint32_t address, uint32_t sector_size, uint8_t *buf)
read one sector from a specified address in spim flash
Definition operate_spim.c:95
spim_init
void spim_init(void)
init the spim flash
Definition operate_spim.c:48
read_buffer
uint8_t read_buffer[4096]
Definition operate_spim.c:41
SPIM_TEST_ADDR
#define SPIM_TEST_ADDR
Definition operate_spim.h:43
spim_operate
void spim_operate(void)
operate spim flash
Definition operate_spim.c:111
sector_size
uint32_t sector_size
Definition composite_vcp_msc/src/msc_diskio.c:35
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_IOMUX_PERIPH_CLOCK
@ CRM_IOMUX_PERIPH_CLOCK
Definition at32f413_crm.h:108
CRM_GPIOB_PERIPH_CLOCK
@ CRM_GPIOB_PERIPH_CLOCK
Definition at32f413_crm.h:110
TRUE
@ TRUE
Definition at32f413.h:297
flash_sector_erase
flash_status_type flash_sector_erase(uint32_t sector_address)
erase a specified flash sector.
Definition at32f413_flash.c:272
flash_spim_unlock
void flash_spim_unlock(void)
unlock the flash spim controller.
Definition at32f413_flash.c:239
flash_spim_model_select
void flash_spim_model_select(flash_spim_model_type mode)
select spim supports extended spi flash chip model.
Definition at32f413_flash.c:746
flash_word_program
flash_status_type flash_word_program(uint32_t address, uint32_t data)
program a word at a specified address.
Definition at32f413_flash.c:414
flash_spim_encryption_range_set
void flash_spim_encryption_range_set(uint32_t decode_address)
set the range of encryption in spim flash. when the address is larger than this value,...
Definition at32f413_flash.c:761
flash_flag_get
flag_status flash_flag_get(uint32_t flash_flag)
check whether the specified flash flag is set or not.
Definition at32f413_flash.c:58
flash_operation_wait_for
flash_status_type flash_operation_wait_for(uint32_t time_out)
wait for flash operation complete or timeout.
Definition at32f413_flash.c:179
flash_flag_clear
void flash_flag_clear(uint32_t flash_flag)
clear the flash flag.
Definition at32f413_flash.c:97
flash_status_type
flash_status_type
flash status type
Definition at32f413_flash.h:158
FLASH_SPIM_MODEL2
@ FLASH_SPIM_MODEL2
Definition at32f413_flash.h:172
FLASH_OPERATE_DONE
@ FLASH_OPERATE_DONE
Definition at32f413_flash.h:162
FLASH_OPERATE_TIMEOUT
@ FLASH_OPERATE_TIMEOUT
Definition at32f413_flash.h:163
FLASH_PROGRAM_ERROR
@ FLASH_PROGRAM_ERROR
Definition at32f413_flash.h:160
FLASH_EPP_ERROR
@ FLASH_EPP_ERROR
Definition at32f413_flash.h:161
FLASH_SPIM_OBF_FLAG
#define FLASH_SPIM_OBF_FLAG
Definition at32f413_flash.h:80
FLASH_PRGMERR_FLAG
#define FLASH_PRGMERR_FLAG
Definition at32f413_flash.h:78
FLASH_EPPERR_FLAG
#define FLASH_EPPERR_FLAG
Definition at32f413_flash.h:79
ERASE_TIMEOUT
#define ERASE_TIMEOUT
Definition at32f413_flash.h:140
FLASH
#define FLASH
Definition at32f413_flash.h:563
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_pin_remap_config
void gpio_pin_remap_config(uint32_t gpio_remap, confirm_state new_state)
iomux remap and debug i/o configuration.
Definition at32f413_gpio.c:549
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_10
#define GPIO_PINS_10
Definition at32f413_gpio.h:60
GPIO_PINS_6
#define GPIO_PINS_6
Definition at32f413_gpio.h:56
GPIO_PINS_11
#define GPIO_PINS_11
Definition at32f413_gpio.h:61
GPIO_PINS_7
#define GPIO_PINS_7
Definition at32f413_gpio.h:57
GPIO_PINS_8
#define GPIO_PINS_8
Definition at32f413_gpio.h:58
GPIO_PINS_1
#define GPIO_PINS_1
Definition at32f413_gpio.h:51
GPIOB
#define GPIOB
Definition at32f413_gpio.h:748
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
EXT_SPIM_GMUX_1001
#define EXT_SPIM_GMUX_1001
Definition at32f413_gpio.h:190
operate_spim.h
operate_spim header file
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288


AT32F413 Firmwary Library: operate_spim.h Source File

  • flash
  • operate_spim
  • inc
operate_spim.h
Go to the documentation of this file.
1
26/* Define to prevent recursive inclusion -------------------------------------*/
27#ifndef __OPERATE_SPIM_H
28#define __OPERATE_SPIM_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#define SPIM_SECTOR_SIZE 4096
43#define SPIM_TEST_ADDR 0x08400000
44
49void spim_operate(void);
50
64#ifdef __cplusplus
65}
66#endif
67
68#endif /* __OPERATE_SPIM_H */
spim_operate
void spim_operate(void)
operate spim flash
Definition operate_spim.c:111


AT32F413 Firmwary Library: printer_class.c Source File

  • middlewares
  • usbd_class
  • printer
printer_class.c
Go to the documentation of this file.
1
25#include "usbd_core.h"
26#include "printer_class.h"
27#include "printer_desc.h"
28
42static usb_sts_type class_init_handler(void *udev);
43static usb_sts_type class_clear_handler(void *udev);
44static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup);
45static usb_sts_type class_ept0_tx_handler(void *udev);
46static usb_sts_type class_ept0_rx_handler(void *udev);
47static usb_sts_type class_in_handler(void *udev, uint8_t ept_num);
48static usb_sts_type class_out_handler(void *udev, uint8_t ept_num);
49static usb_sts_type class_sof_handler(void *udev);
50static usb_sts_type class_event_handler(void *udev, usbd_event_type event);
51
52ALIGNED_HEAD static uint8_t printer_device_id[PRINTER_DEVICE_ID_LEN] ALIGNED_TAIL=
53{
54 0x00, 0x16,
55 'M', 'F', 'G',':','A','r','t','e', 'r', 'y' ,' ',
56 'C','M', 'D', ':', 'E', 'S', 'C', 'P', 'O', 'S',' ',
57};
58
59/* static variable */
60 printer_type printer_struct;
61
62/* usb device class handler */
63 usbd_class_handler printer_class_handler =
64{
65 class_init_handler,
66 class_clear_handler,
67 class_setup_handler,
68 class_ept0_tx_handler,
69 class_ept0_rx_handler,
70 class_in_handler,
71 class_out_handler,
72 class_sof_handler,
73 class_event_handler,
74 &printer_struct
75};
76
82static usb_sts_type class_init_handler(void *udev)
83{
84 usb_sts_type status = USB_OK;
85 usbd_core_type *pudev = (usbd_core_type *)udev;
86 printer_type *pprter = (printer_type *)pudev->class_handler->pdata;
87
88 /* open in endpoint */
89 usbd_ept_open(pudev, USBD_PRINTER_BULK_IN_EPT, EPT_BULK_TYPE, USBD_PRINTER_IN_MAXPACKET_SIZE);
90
91 /* open out endpoint */
92 usbd_ept_open(pudev, USBD_PRINTER_BULK_OUT_EPT, EPT_BULK_TYPE, USBD_PRINTER_OUT_MAXPACKET_SIZE);
93
94 /* set out endpoint to receive status */
95 usbd_ept_recv(pudev, USBD_PRINTER_BULK_OUT_EPT, pprter->g_rx_buff, USBD_PRINTER_OUT_MAXPACKET_SIZE);
96
97 pprter->g_tx_completed = 1;
98 pprter->g_printer_port_status = 0x18;
99
100 return status;
101}
102
108static usb_sts_type class_clear_handler(void *udev)
109{
110 usb_sts_type status = USB_OK;
111 usbd_core_type *pudev = (usbd_core_type *)udev;
112
113 /* close in endpoint */
114 usbd_ept_close(pudev, USBD_PRINTER_BULK_IN_EPT);
115
116 /* close out endpoint */
117 usbd_ept_close(pudev, USBD_PRINTER_BULK_OUT_EPT);
118
119 return status;
120}
121
128static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
129{
130 usb_sts_type status = USB_OK;
131 usbd_core_type *pudev = (usbd_core_type *)udev;
132 printer_type *pprter = (printer_type *)pudev->class_handler->pdata;
133
134 switch(setup->bmRequestType & USB_REQ_TYPE_RESERVED)
135 {
136 /* class request */
137 case USB_REQ_TYPE_CLASS:
138 switch(setup->bRequest)
139 {
140 case PRINTER_REQ_GET_DEVICE_ID:
141 usbd_ctrl_send(pudev, printer_device_id, PRINTER_DEVICE_ID_LEN);
142 break;
143 case PRINTER_REQ_GET_PORT_STATUS:
144 usbd_ctrl_send(pudev, (uint8_t *)&pprter->g_printer_port_status, 1);
145 break;
146 case PRINTER_REQ_GET_SOFT_RESET:
147 usbd_ctrl_recv(pudev, pprter->g_printer_data, USBD_PRINTER_OUT_MAXPACKET_SIZE);
148 break;
149 default:
150 usbd_ctrl_unsupport(pudev);
151 break;
152 }
153 break;
154 /* standard request */
155 case USB_REQ_TYPE_STANDARD:
156 switch(setup->bRequest)
157 {
158 case USB_STD_REQ_GET_DESCRIPTOR:
159 usbd_ctrl_unsupport(pudev);
160 break;
161 case USB_STD_REQ_GET_INTERFACE:
162 usbd_ctrl_send(pudev, (uint8_t *)&pprter->alt_setting, 1);
163 break;
164 case USB_STD_REQ_SET_INTERFACE:
165 pprter->alt_setting = setup->wValue;
166 break;
167 case USB_STD_REQ_CLEAR_FEATURE:
168 break;
169 case USB_STD_REQ_SET_FEATURE:
170 break;
171 default:
172 usbd_ctrl_unsupport(pudev);
173 break;
174 }
175 break;
176 default:
177 usbd_ctrl_unsupport(pudev);
178 break;
179 }
180 return status;
181}
182
188static usb_sts_type class_ept0_tx_handler(void *udev)
189{
190 usb_sts_type status = USB_OK;
191
192 /* ...user code... */
193
194 return status;
195}
196
202static usb_sts_type class_ept0_rx_handler(void *udev)
203{
204 usb_sts_type status = USB_OK;
205
206 /* ...user code... */
207
208 return status;
209}
210
217static usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
218{
219 usbd_core_type *pudev = (usbd_core_type *)udev;
220 printer_type *pprter = (printer_type *)pudev->class_handler->pdata;
221 usb_sts_type status = USB_OK;
222
223 /* ...user code...
224 trans next packet data
225 */
226 pprter->g_tx_completed = 1;
227
228 return status;
229}
230
237static usb_sts_type class_out_handler(void *udev, uint8_t ept_num)
238{
239 usb_sts_type status = USB_OK;
240 usbd_core_type *pudev = (usbd_core_type *)udev;
241 printer_type *pprter = (printer_type *)pudev->class_handler->pdata;
242 /* get endpoint receive data length */
243 pprter->g_rxlen = usbd_get_recv_len(pudev, ept_num);
244
245 /*set recv flag*/
246 pprter->g_rx_completed = 1;
247
248 return status;
249}
250
256static usb_sts_type class_sof_handler(void *udev)
257{
258 usb_sts_type status = USB_OK;
259
260 /* ...user code... */
261
262 return status;
263}
264
271static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
272{
273 usb_sts_type status = USB_OK;
274 switch(event)
275 {
276 case USBD_RESET_EVENT:
277
278 /* ...user code... */
279
280 break;
281 case USBD_SUSPEND_EVENT:
282
283 /* ...user code... */
284
285 break;
286 case USBD_WAKEUP_EVENT:
287 /* ...user code... */
288
289 break;
290
291 default:
292 break;
293 }
294 return status;
295}
296
303uint16_t usb_printer_get_rxdata(void *udev, uint8_t *recv_data)
304{
305 uint16_t i_index = 0;
306 usbd_core_type *pudev = (usbd_core_type *)udev;
307 printer_type *pprter = (printer_type *)pudev->class_handler->pdata;
308 uint16_t tmp_len = 0;
309
310 if(pprter->g_rx_completed == 0)
311 {
312 return 0;
313 }
314 pprter->g_rx_completed = 0;
315 tmp_len = pprter->g_rxlen;
316 for(i_index = 0; i_index < pprter->g_rxlen; i_index ++)
317 {
318 recv_data[i_index] = pprter->g_rx_buff[i_index];
319 }
320
321 usbd_ept_recv(pudev, USBD_PRINTER_BULK_OUT_EPT, pprter->g_rx_buff, USBD_PRINTER_OUT_MAXPACKET_SIZE);
322
323 return tmp_len;
324}
325
333 error_status usb_printer_send_data(void *udev, uint8_t *send_data, uint16_t len)
334{
335 error_status status = SUCCESS;
336 usbd_core_type *pudev = (usbd_core_type *)udev;
337 printer_type *pprter = (printer_type *)pudev->class_handler->pdata;
338 if(pprter->g_tx_completed)
339 {
340 pprter->g_tx_completed = 0;
341 usbd_ept_send(pudev, USBD_PRINTER_BULK_IN_EPT, send_data, len);
342 }
343 else
344 {
345 status = ERROR;
346 }
347 return status;
348}
349
350
error_status
error_status
error status
Definition at32f413.h:302
ERROR
@ ERROR
Definition at32f413.h:302
SUCCESS
@ SUCCESS
Definition at32f413.h:302
EPT_BULK_TYPE
@ EPT_BULK_TYPE
Definition at32f413_usb.h:204
USBD_PRINTER_OUT_MAXPACKET_SIZE
#define USBD_PRINTER_OUT_MAXPACKET_SIZE
Definition printer_class.h:54
USBD_PRINTER_IN_MAXPACKET_SIZE
#define USBD_PRINTER_IN_MAXPACKET_SIZE
Definition printer_class.h:53
PRINTER_DEVICE_ID_LEN
#define PRINTER_DEVICE_ID_LEN
Definition printer_class.h:56
USBD_PRINTER_BULK_OUT_EPT
#define USBD_PRINTER_BULK_OUT_EPT
Definition printer_class.h:50
USBD_PRINTER_BULK_IN_EPT
#define USBD_PRINTER_BULK_IN_EPT
Definition printer_class.h:49
PRINTER_REQ_GET_SOFT_RESET
@ PRINTER_REQ_GET_SOFT_RESET
Definition printer_class.h:62
PRINTER_REQ_GET_PORT_STATUS
@ PRINTER_REQ_GET_PORT_STATUS
Definition printer_class.h:61
PRINTER_REQ_GET_DEVICE_ID
@ PRINTER_REQ_GET_DEVICE_ID
Definition printer_class.h:60
class_sof_handler
static usb_sts_type class_sof_handler(void *udev)
usb device sof handler
Definition printer_class.c:256
class_in_handler
static usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
usb device transmision complete handler
Definition printer_class.c:217
class_clear_handler
static usb_sts_type class_clear_handler(void *udev)
clear endpoint or other state
Definition printer_class.c:108
class_setup_handler
static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
usb device class setup request handler
Definition printer_class.c:128
usb_printer_get_rxdata
uint16_t usb_printer_get_rxdata(void *udev, uint8_t *recv_data)
usb device class rx data process
Definition printer_class.c:303
class_ept0_tx_handler
static usb_sts_type class_ept0_tx_handler(void *udev)
usb device endpoint 0 in status stage complete
Definition printer_class.c:188
printer_class_handler
usbd_class_handler printer_class_handler
Definition printer_class.c:63
class_ept0_rx_handler
static usb_sts_type class_ept0_rx_handler(void *udev)
usb device endpoint 0 out status stage complete
Definition printer_class.c:202
class_event_handler
static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
usb device event handler
Definition printer_class.c:271
usb_printer_send_data
error_status usb_printer_send_data(void *udev, uint8_t *send_data, uint16_t len)
usb device class send data
Definition printer_class.c:333
class_init_handler
static usb_sts_type class_init_handler(void *udev)
initialize usb custom hid endpoint
Definition printer_class.c:82
class_out_handler
static usb_sts_type class_out_handler(void *udev, uint8_t ept_num)
usb device endpoint receive data
Definition printer_class.c:237
ALIGNED_TAIL
static ALIGNED_HEAD uint8_t printer_device_id[24] ALIGNED_TAIL
Definition printer_class.c:52
printer_struct
printer_type printer_struct
Definition printer_class.c:60
USB_STD_REQ_CLEAR_FEATURE
#define USB_STD_REQ_CLEAR_FEATURE
Definition usb_std.h:77
USB_REQ_TYPE_STANDARD
#define USB_REQ_TYPE_STANDARD
usb request type
Definition usb_std.h:62
USB_STD_REQ_GET_DESCRIPTOR
#define USB_STD_REQ_GET_DESCRIPTOR
Definition usb_std.h:80
USB_STD_REQ_SET_FEATURE
#define USB_STD_REQ_SET_FEATURE
Definition usb_std.h:78
USB_STD_REQ_SET_INTERFACE
#define USB_STD_REQ_SET_INTERFACE
Definition usb_std.h:85
USB_REQ_TYPE_RESERVED
#define USB_REQ_TYPE_RESERVED
Definition usb_std.h:65
USB_STD_REQ_GET_INTERFACE
#define USB_STD_REQ_GET_INTERFACE
Definition usb_std.h:84
USB_REQ_TYPE_CLASS
#define USB_REQ_TYPE_CLASS
Definition usb_std.h:63
usb_sts_type
usb_sts_type
usb return status
Definition usb_std.h:285
USB_OK
@ USB_OK
Definition usb_std.h:286
usbd_ept_close
void usbd_ept_close(usbd_core_type *udev, uint8_t ept_addr)
usb close endpoint
Definition usbd_core.c:541
usbd_ept_recv
void usbd_ept_recv(usbd_core_type *udev, uint8_t ept_num, uint8_t *buffer, uint16_t len)
usb endpoint receive data
Definition usbd_core.c:364
usbd_ept_open
void usbd_ept_open(usbd_core_type *udev, uint8_t ept_addr, uint8_t ept_type, uint16_t maxpacket)
usb open endpoint
Definition usbd_core.c:506
usbd_ctrl_send
void usbd_ctrl_send(usbd_core_type *udev, uint8_t *buffer, uint16_t len)
usb control endpoint send data
Definition usbd_core.c:175
usbd_get_recv_len
uint32_t usbd_get_recv_len(usbd_core_type *udev, uint8_t ept_addr)
usb endpoint get receive data length
Definition usbd_core.c:397
usbd_ctrl_recv
void usbd_ctrl_recv(usbd_core_type *udev, uint8_t *buffer, uint16_t len)
usb control endpoint receive data
Definition usbd_core.c:194
usbd_ctrl_unsupport
void usbd_ctrl_unsupport(usbd_core_type *udev)
un-support device request
Definition usbd_core.c:289
usbd_ept_send
void usbd_ept_send(usbd_core_type *udev, uint8_t ept_num, uint8_t *buffer, uint16_t len)
usb endpoint send data
Definition usbd_core.c:304
usbd_event_type
usbd_event_type
usb device event
Definition usbd_core.h:54
USBD_SUSPEND_EVENT
@ USBD_SUSPEND_EVENT
Definition usbd_core.h:57
USBD_RESET_EVENT
@ USBD_RESET_EVENT
Definition usbd_core.h:56
USBD_WAKEUP_EVENT
@ USBD_WAKEUP_EVENT
Definition usbd_core.h:58
printer_class.h
usb printer class file
printer_desc.h
usb printer descriptor header file
printer_type
Definition printer_class.h:67
printer_type::g_printer_data
uint8_t g_printer_data[0x40]
Definition printer_class.h:71
printer_type::g_rxlen
uint32_t g_rxlen
Definition printer_class.h:74
printer_type::g_rx_completed
__IO uint8_t g_rx_completed
Definition printer_class.h:73
printer_type::g_printer_port_status
uint32_t g_printer_port_status
Definition printer_class.h:69
printer_type::g_rx_buff
uint8_t g_rx_buff[0x40]
Definition printer_class.h:70
printer_type::g_tx_completed
__IO uint8_t g_tx_completed
Definition printer_class.h:72
printer_type::alt_setting
uint32_t alt_setting
Definition printer_class.h:68
usb_setup_type
format of usb setup data
Definition usb_std.h:297
usb_setup_type::wValue
uint16_t wValue
Definition usb_std.h:300
usb_setup_type::bmRequestType
uint8_t bmRequestType
Definition usb_std.h:298
usb_setup_type::bRequest
uint8_t bRequest
Definition usb_std.h:299
usbd_class_handler
usb device class handler
Definition usbd_core.h:97
usbd_class_handler::pdata
void * pdata
Definition usbd_core.h:107
usbd_core_type
usb device core struct type
Definition usbd_core.h:114
usbd_core_type::class_handler
usbd_class_handler * class_handler
Definition usbd_core.h:117
usbd_core.h
usb device core header file


AT32F413 Firmwary Library: printer_class.h Source File

  • middlewares
  • usbd_class
  • printer
printer_class.h
Go to the documentation of this file.
1
26 /* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __PRINTER_CLASS_H
28#define __PRINTER_CLASS_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "usb_std.h"
35#include "usbd_core.h"
36
49#define USBD_PRINTER_BULK_IN_EPT 0x81
50#define USBD_PRINTER_BULK_OUT_EPT 0x01
51
52
53#define USBD_PRINTER_IN_MAXPACKET_SIZE 0x40
54#define USBD_PRINTER_OUT_MAXPACKET_SIZE 0x40
55
56#define PRINTER_DEVICE_ID_LEN 24
57
58typedef enum
59{
60 PRINTER_REQ_GET_DEVICE_ID = 0x00,
61 PRINTER_REQ_GET_PORT_STATUS = 0x01,
62 PRINTER_REQ_GET_SOFT_RESET = 0x02
63}printer_req_type;
64
65
66typedef struct
67{
68 uint32_t alt_setting;
69 uint32_t g_printer_port_status;
70 uint8_t g_rx_buff[USBD_PRINTER_OUT_MAXPACKET_SIZE];
71 uint8_t g_printer_data[USBD_PRINTER_OUT_MAXPACKET_SIZE];
72 __IO uint8_t g_tx_completed;
73 __IO uint8_t g_rx_completed;
74 uint32_t g_rxlen;
75}printer_type;
76
77extern usbd_class_handler printer_class_handler;
78uint16_t usb_printer_get_rxdata(void *udev, uint8_t *recv_data);
79 error_status usb_printer_send_data(void *udev, uint8_t *send_data, uint16_t len);
91#ifdef __cplusplus
92}
93#endif
94
95#endif
96
error_status
error_status
error status
Definition at32f413.h:302
printer_req_type
printer_req_type
Definition printer_class.h:59
USBD_PRINTER_OUT_MAXPACKET_SIZE
#define USBD_PRINTER_OUT_MAXPACKET_SIZE
Definition printer_class.h:54
usb_printer_get_rxdata
uint16_t usb_printer_get_rxdata(void *udev, uint8_t *recv_data)
usb device class rx data process
Definition printer_class.c:303
printer_class_handler
usbd_class_handler printer_class_handler
Definition printer_class.c:63
usb_printer_send_data
error_status usb_printer_send_data(void *udev, uint8_t *send_data, uint16_t len)
usb device class send data
Definition printer_class.c:333
PRINTER_REQ_GET_SOFT_RESET
@ PRINTER_REQ_GET_SOFT_RESET
Definition printer_class.h:62
PRINTER_REQ_GET_PORT_STATUS
@ PRINTER_REQ_GET_PORT_STATUS
Definition printer_class.h:61
PRINTER_REQ_GET_DEVICE_ID
@ PRINTER_REQ_GET_DEVICE_ID
Definition printer_class.h:60
printer_type
Definition printer_class.h:67
printer_type::g_rxlen
uint32_t g_rxlen
Definition printer_class.h:74
printer_type::g_rx_completed
__IO uint8_t g_rx_completed
Definition printer_class.h:73
printer_type::g_printer_port_status
uint32_t g_printer_port_status
Definition printer_class.h:69
printer_type::g_tx_completed
__IO uint8_t g_tx_completed
Definition printer_class.h:72
printer_type::alt_setting
uint32_t alt_setting
Definition printer_class.h:68
usbd_class_handler
usb device class handler
Definition usbd_core.h:97
usb_std.h
usb standard header file
usbd_core.h
usb device core header file


AT32F413 Firmwary Library: printer_desc.c Source File

  • middlewares
  • usbd_class
  • printer
printer_desc.c
Go to the documentation of this file.
1
25#include "stdio.h"
26#include "usb_std.h"
27#include "usbd_sdr.h"
28#include "usbd_core.h"
29#include "printer_desc.h"
30
44static usbd_desc_t *get_device_descriptor(void);
45static usbd_desc_t *get_device_qualifier(void);
46static usbd_desc_t *get_device_configuration(void);
47static usbd_desc_t *get_device_other_speed(void);
48static usbd_desc_t *get_device_lang_id(void);
49static usbd_desc_t *get_device_manufacturer_string(void);
50static usbd_desc_t *get_device_product_string(void);
51static usbd_desc_t *get_device_serial_string(void);
52static usbd_desc_t *get_device_interface_string(void);
53static usbd_desc_t *get_device_config_string(void);
54
55static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf);
56static void usbd_int_to_unicode (uint32_t value , uint8_t *pbuf , uint8_t len);
57static void get_serial_num(void);
58#if defined ( __ICCARM__ ) /* iar compiler */
59 #pragma data_alignment=4
60#endif
61ALIGNED_HEAD static uint8_t g_usbd_desc_buffer[256] ALIGNED_TAIL;
62
66 usbd_desc_handler printer_desc_handler =
67{
68 get_device_descriptor,
69 get_device_qualifier,
70 get_device_configuration,
71 get_device_other_speed,
72 get_device_lang_id,
73 get_device_manufacturer_string,
74 get_device_product_string,
75 get_device_serial_string,
76 get_device_interface_string,
77 get_device_config_string,
78};
79
83#if defined ( __ICCARM__ ) /* iar compiler */
84 #pragma data_alignment=4
85#endif
86ALIGNED_HEAD static uint8_t g_usbd_descriptor[USB_DEVICE_DESC_LEN] ALIGNED_TAIL =
87{
88 USB_DEVICE_DESC_LEN, /* bLength */
89 USB_DESCIPTOR_TYPE_DEVICE, /* bDescriptorType */
90 0x00, /* bcdUSB */
91 0x02,
92 0x00, /* bDeviceClass */
93 0x00, /* bDeviceSubClass */
94 0x00, /* bDeviceProtocol */
95 USB_MAX_EP0_SIZE, /* bMaxPacketSize */
96 LBYTE(USBD_PRINTER_VENDOR_ID), /* idVendor */
97 HBYTE(USBD_PRINTER_VENDOR_ID), /* idVendor */
98 LBYTE(USBD_PRINTER_PRODUCT_ID), /* idProduct */
99 HBYTE(USBD_PRINTER_PRODUCT_ID), /* idProduct */
100 0x00, /* bcdDevice rel. 2.00 */
101 0x02,
102 USB_MFC_STRING, /* Index of manufacturer string */
103 USB_PRODUCT_STRING, /* Index of product string */
104 USB_SERIAL_STRING, /* Index of serial number string */
105 1 /* bNumConfigurations */
106};
107
111#if defined ( __ICCARM__ ) /* iar compiler */
112 #pragma data_alignment=4
113#endif
114ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_PRINTER_CONFIG_DESC_SIZE] ALIGNED_TAIL =
115{
116 USB_DEVICE_CFG_DESC_LEN, /* bLength: configuration descriptor size */
117 USB_DESCIPTOR_TYPE_CONFIGURATION, /* bDescriptorType: configuration */
118 LBYTE(USBD_PRINTER_CONFIG_DESC_SIZE), /* wTotalLength: bytes returned */
119 HBYTE(USBD_PRINTER_CONFIG_DESC_SIZE), /* wTotalLength: bytes returned */
120 0x01, /* bNumInterfaces: 1 interface */
121 0x01, /* bConfigurationValue: configuration value */
122 0x00, /* iConfiguration: index of string descriptor describing
123 the configuration */
124 0xC0, /* bmAttributes: self powered */
125 0x32, /* MaxPower 100 mA: this current is used for detecting vbus */
126
127 USB_DEVICE_IF_DESC_LEN, /* bLength: interface descriptor size */
128 USB_DESCIPTOR_TYPE_INTERFACE, /* bDescriptorType: interface descriptor type */
129 0x00, /* bInterfaceNumber: number of interface */
130 0x00, /* bAlternateSetting: alternate set */
131 0x02, /* bNumEndpoints: number of endpoints */
132 USB_CLASS_CODE_PRINTER, /* bInterfaceClass: printer class code */
133 0x01, /* bInterfaceSubClass: subclass code*/
134 PRINTER_PROTOCOL_BI_DIRECTIONAL, /* bInterfaceProtocol: printer interface type */
135 0x00, /* iInterface: index of string descriptor */
136
137 USB_DEVICE_EPT_LEN, /* bLength: size of endpoint descriptor in bytes */
138 USB_DESCIPTOR_TYPE_ENDPOINT, /* bDescriptorType: endpoint descriptor type */
139 USBD_PRINTER_BULK_IN_EPT, /* bEndpointAddress: the address of endpoint on usb device described by this descriptor */
140 USB_EPT_DESC_BULK, /* bmAttributes: endpoint attributes */
141 LBYTE(USBD_PRINTER_IN_MAXPACKET_SIZE),
142 HBYTE(USBD_PRINTER_IN_MAXPACKET_SIZE), /* wMaxPacketSize: maximum packe size this endpoint */
143 0x00, /* bInterval: interval for polling endpoint for data transfers */
144
145 USB_DEVICE_EPT_LEN, /* bLength: size of endpoint descriptor in bytes */
146 USB_DESCIPTOR_TYPE_ENDPOINT, /* bDescriptorType: endpoint descriptor type */
147 USBD_PRINTER_BULK_OUT_EPT, /* bEndpointAddress: the address of endpoint on usb device described by this descriptor */
148 USB_EPT_DESC_BULK, /* bmAttributes: endpoint attributes */
149 LBYTE(USBD_PRINTER_OUT_MAXPACKET_SIZE),
150 HBYTE(USBD_PRINTER_OUT_MAXPACKET_SIZE),/* wMaxPacketSize: maximum packe size this endpoint */
151 0x00, /* bInterval: interval for polling endpoint for data transfers */
152};
153
157#if defined ( __ICCARM__ ) /* iar compiler */
158 #pragma data_alignment=4
159#endif
160ALIGNED_HEAD static uint8_t g_string_lang_id[USBD_PRINTER_SIZ_STRING_LANGID] ALIGNED_TAIL =
161{
162 USBD_PRINTER_SIZ_STRING_LANGID,
163 USB_DESCIPTOR_TYPE_STRING,
164 0x09,
165 0x04,
166};
167
171#if defined ( __ICCARM__ ) /* iar compiler */
172 #pragma data_alignment=4
173#endif
174ALIGNED_HEAD static uint8_t g_string_serial[USBD_PRINTER_SIZ_STRING_SERIAL] ALIGNED_TAIL =
175{
176 USBD_PRINTER_SIZ_STRING_SERIAL,
177 USB_DESCIPTOR_TYPE_STRING,
178};
179
180
181/* device descriptor */
182static usbd_desc_t device_descriptor =
183{
184 USB_DEVICE_DESC_LEN,
185 g_usbd_descriptor
186};
187
188/* config descriptor */
189static usbd_desc_t config_descriptor =
190{
191 USBD_PRINTER_CONFIG_DESC_SIZE,
192 g_usbd_configuration
193};
194
195/* langid descriptor */
196static usbd_desc_t langid_descriptor =
197{
198 USBD_PRINTER_SIZ_STRING_LANGID,
199 g_string_lang_id
200};
201
202/* serial descriptor */
203static usbd_desc_t serial_descriptor =
204{
205 USBD_PRINTER_SIZ_STRING_SERIAL,
206 g_string_serial
207};
208
209static usbd_desc_t vp_desc;
210
217static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf)
218{
219 uint16_t str_len = 0, id_pos = 2;
220 uint8_t *tmp_str = string;
221
222 while(*tmp_str != '\0')
223 {
224 str_len ++;
225 unicode_buf[id_pos ++] = *tmp_str ++;
226 unicode_buf[id_pos ++] = 0x00;
227 }
228
229 str_len = str_len * 2 + 2;
230 unicode_buf[0] = (uint8_t)str_len;
231 unicode_buf[1] = USB_DESCIPTOR_TYPE_STRING;
232
233 return str_len;
234}
235
243static void usbd_int_to_unicode (uint32_t value , uint8_t *pbuf , uint8_t len)
244{
245 uint8_t idx = 0;
246
247 for( idx = 0 ; idx < len ; idx ++)
248 {
249 if( ((value >> 28)) < 0xA )
250 {
251 pbuf[ 2 * idx] = (value >> 28) + '0';
252 }
253 else
254 {
255 pbuf[2 * idx] = (value >> 28) + 'A' - 10;
256 }
257
258 value = value << 4;
259
260 pbuf[2 * idx + 1] = 0;
261 }
262}
263
269static void get_serial_num(void)
270{
271 uint32_t serial0, serial1, serial2;
272
273 serial0 = *(uint32_t*)MCU_ID1;
274 serial1 = *(uint32_t*)MCU_ID2;
275 serial2 = *(uint32_t*)MCU_ID3;
276
277 serial0 += serial2;
278
279 if (serial0 != 0)
280 {
281 usbd_int_to_unicode (serial0, &g_string_serial[2] ,8);
282 usbd_int_to_unicode (serial1, &g_string_serial[18] ,4);
283 }
284}
285
291static usbd_desc_t *get_device_descriptor(void)
292{
293 return &device_descriptor;
294}
295
301static usbd_desc_t * get_device_qualifier(void)
302{
303 return NULL;
304}
305
311static usbd_desc_t *get_device_configuration(void)
312{
313 return &config_descriptor;
314}
315
321static usbd_desc_t *get_device_other_speed(void)
322{
323 return NULL;
324}
325
331static usbd_desc_t *get_device_lang_id(void)
332{
333 return &langid_descriptor;
334}
335
336
342static usbd_desc_t *get_device_manufacturer_string(void)
343{
344 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_PRINTER_DESC_MANUFACTURER_STRING, g_usbd_desc_buffer);
345 vp_desc.descriptor = g_usbd_desc_buffer;
346 return &vp_desc;
347}
348
354static usbd_desc_t *get_device_product_string(void)
355{
356 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_PRINTER_DESC_PRODUCT_STRING, g_usbd_desc_buffer);
357 vp_desc.descriptor = g_usbd_desc_buffer;
358 return &vp_desc;
359}
360
366static usbd_desc_t *get_device_serial_string(void)
367{
368 get_serial_num();
369 return &serial_descriptor;
370}
371
377static usbd_desc_t *get_device_interface_string(void)
378{
379 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_PRINTER_DESC_INTERFACE_STRING, g_usbd_desc_buffer);
380 vp_desc.descriptor = g_usbd_desc_buffer;
381 return &vp_desc;
382}
383
389static usbd_desc_t *get_device_config_string(void)
390{
391 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_PRINTER_DESC_CONFIGURATION_STRING, g_usbd_desc_buffer);
392 vp_desc.descriptor = g_usbd_desc_buffer;
393 return &vp_desc;
394}
395
NULL
#define NULL
Definition emmc_card/inc/at32_sdio.h:340
MCU_ID1
#define MCU_ID1
Definition audio_desc.h:214
MCU_ID2
#define MCU_ID2
Definition audio_desc.h:215
MCU_ID3
#define MCU_ID3
Definition audio_desc.h:216
USBD_PRINTER_OUT_MAXPACKET_SIZE
#define USBD_PRINTER_OUT_MAXPACKET_SIZE
Definition printer_class.h:54
USBD_PRINTER_IN_MAXPACKET_SIZE
#define USBD_PRINTER_IN_MAXPACKET_SIZE
Definition printer_class.h:53
USBD_PRINTER_BULK_OUT_EPT
#define USBD_PRINTER_BULK_OUT_EPT
Definition printer_class.h:50
USBD_PRINTER_BULK_IN_EPT
#define USBD_PRINTER_BULK_IN_EPT
Definition printer_class.h:49
USBD_PRINTER_DESC_PRODUCT_STRING
#define USBD_PRINTER_DESC_PRODUCT_STRING
Definition printer_desc.h:59
USBD_PRINTER_CONFIG_DESC_SIZE
#define USBD_PRINTER_CONFIG_DESC_SIZE
Definition printer_desc.h:54
USBD_PRINTER_DESC_CONFIGURATION_STRING
#define USBD_PRINTER_DESC_CONFIGURATION_STRING
Definition printer_desc.h:60
PRINTER_PROTOCOL_BI_DIRECTIONAL
#define PRINTER_PROTOCOL_BI_DIRECTIONAL
Definition printer_desc.h:64
USBD_PRINTER_DESC_INTERFACE_STRING
#define USBD_PRINTER_DESC_INTERFACE_STRING
Definition printer_desc.h:61
USBD_PRINTER_DESC_MANUFACTURER_STRING
#define USBD_PRINTER_DESC_MANUFACTURER_STRING
Definition printer_desc.h:58
USBD_PRINTER_PRODUCT_ID
#define USBD_PRINTER_PRODUCT_ID
Definition printer_desc.h:52
USBD_PRINTER_SIZ_STRING_SERIAL
#define USBD_PRINTER_SIZ_STRING_SERIAL
Definition printer_desc.h:56
USBD_PRINTER_SIZ_STRING_LANGID
#define USBD_PRINTER_SIZ_STRING_LANGID
Definition printer_desc.h:55
USBD_PRINTER_VENDOR_ID
#define USBD_PRINTER_VENDOR_ID
Definition printer_desc.h:51
serial_descriptor
static usbd_desc_t serial_descriptor
Definition printer_desc.c:203
device_descriptor
static usbd_desc_t device_descriptor
Definition printer_desc.c:182
get_device_configuration
static usbd_desc_t * get_device_configuration(void)
get config descriptor
Definition printer_desc.c:311
langid_descriptor
static usbd_desc_t langid_descriptor
Definition printer_desc.c:196
get_device_descriptor
static usbd_desc_t * get_device_descriptor(void)
get device descriptor
Definition printer_desc.c:291
get_device_manufacturer_string
static usbd_desc_t * get_device_manufacturer_string(void)
get manufacturer descriptor
Definition printer_desc.c:342
get_device_qualifier
static usbd_desc_t * get_device_qualifier(void)
get device qualifier
Definition printer_desc.c:301
get_device_interface_string
static usbd_desc_t * get_device_interface_string(void)
get interface descriptor
Definition printer_desc.c:377
vp_desc
static usbd_desc_t vp_desc
Definition printer_desc.c:209
get_device_other_speed
static usbd_desc_t * get_device_other_speed(void)
get other speed descriptor
Definition printer_desc.c:321
ALIGNED_TAIL
static ALIGNED_HEAD uint8_t g_usbd_desc_buffer[256] ALIGNED_TAIL
usb device standard descriptor
Definition printer_desc.c:61
get_device_product_string
static usbd_desc_t * get_device_product_string(void)
get product descriptor
Definition printer_desc.c:354
get_device_config_string
static usbd_desc_t * get_device_config_string(void)
get device config descriptor
Definition printer_desc.c:389
usbd_unicode_convert
static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf)
standard usb unicode convert
Definition printer_desc.c:217
printer_desc_handler
usbd_desc_handler printer_desc_handler
device descriptor handler structure
Definition printer_desc.c:66
get_device_lang_id
static usbd_desc_t * get_device_lang_id(void)
get lang id descriptor
Definition printer_desc.c:331
get_serial_num
static void get_serial_num(void)
usb get serial number
Definition printer_desc.c:269
config_descriptor
static usbd_desc_t config_descriptor
Definition printer_desc.c:189
get_device_serial_string
static usbd_desc_t * get_device_serial_string(void)
get serial descriptor
Definition printer_desc.c:366
usbd_int_to_unicode
static void usbd_int_to_unicode(uint32_t value, uint8_t *pbuf, uint8_t len)
usb int convert to unicode
Definition printer_desc.c:243
USB_CLASS_CODE_PRINTER
#define USB_CLASS_CODE_PRINTER
Definition usb_std.h:170
HBYTE
#define HBYTE(x)
Definition usb_std.h:271
USB_DEVICE_EPT_LEN
#define USB_DEVICE_EPT_LEN
Definition usb_std.h:159
USB_MAX_EP0_SIZE
#define USB_MAX_EP0_SIZE
endpoint 0 max size
Definition usb_std.h:248
USB_PRODUCT_STRING
#define USB_PRODUCT_STRING
Definition usb_std.h:105
USB_DESCIPTOR_TYPE_CONFIGURATION
#define USB_DESCIPTOR_TYPE_CONFIGURATION
Definition usb_std.h:92
LBYTE
#define LBYTE(x)
low byte and high byte define
Definition usb_std.h:270
USB_DESCIPTOR_TYPE_ENDPOINT
#define USB_DESCIPTOR_TYPE_ENDPOINT
Definition usb_std.h:95
USB_DEVICE_DESC_LEN
#define USB_DEVICE_DESC_LEN
Definition usb_std.h:156
USB_MFC_STRING
#define USB_MFC_STRING
Definition usb_std.h:104
USB_EPT_DESC_BULK
#define USB_EPT_DESC_BULK
Definition usb_std.h:183
USB_DEVICE_IF_DESC_LEN
#define USB_DEVICE_IF_DESC_LEN
Definition usb_std.h:158
USB_DEVICE_CFG_DESC_LEN
#define USB_DEVICE_CFG_DESC_LEN
Definition usb_std.h:157
USB_SERIAL_STRING
#define USB_SERIAL_STRING
Definition usb_std.h:106
USB_DESCIPTOR_TYPE_DEVICE
#define USB_DESCIPTOR_TYPE_DEVICE
usb standard device type
Definition usb_std.h:91
USB_DESCIPTOR_TYPE_STRING
#define USB_DESCIPTOR_TYPE_STRING
Definition usb_std.h:93
USB_DESCIPTOR_TYPE_INTERFACE
#define USB_DESCIPTOR_TYPE_INTERFACE
Definition usb_std.h:94
printer_desc.h
usb printer descriptor header file
usbd_desc_handler
usb device descriptor handler
Definition usbd_core.h:75
usbd_desc_t
usb device descriptor struct
Definition usbd_core.h:66
usbd_desc_t::length
uint16_t length
Definition usbd_core.h:67
usbd_desc_t::descriptor
uint8_t * descriptor
Definition usbd_core.h:68
usb_std.h
usb standard header file
usbd_core.h
usb device core header file
usbd_sdr.h
usb standard request header file


AT32F413 Firmwary Library: printer_desc.h Source File

  • middlewares
  • usbd_class
  • printer
printer_desc.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __PRINTER_DESC_H
28#define __PRINTER_DESC_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "printer_class.h"
35#include "usbd_core.h"
36
49#define PRINTER_BCD_NUM 0x0110
50
51#define USBD_PRINTER_VENDOR_ID 0x2E3C
52#define USBD_PRINTER_PRODUCT_ID 0x57FF
53
54#define USBD_PRINTER_CONFIG_DESC_SIZE 32
55#define USBD_PRINTER_SIZ_STRING_LANGID 4
56#define USBD_PRINTER_SIZ_STRING_SERIAL 0x1A
57
58#define USBD_PRINTER_DESC_MANUFACTURER_STRING "Artery"
59#define USBD_PRINTER_DESC_PRODUCT_STRING "AT32 Printer"
60#define USBD_PRINTER_DESC_CONFIGURATION_STRING "Printer Config"
61#define USBD_PRINTER_DESC_INTERFACE_STRING "Printer Interface"
62
63#define PRINTER_PROTOCOL_UNIDIRECTIONAL 0x01
64#define PRINTER_PROTOCOL_BI_DIRECTIONAL 0x02
65#define PRINTER_PROTOCOL_1284_4 0x03
66#define PRINTER_PROTOCOL_VENDOR_SPECIFIC 0xFF
67
68
69#define MCU_ID1 (0x1FFFF7E8)
70#define MCU_ID2 (0x1FFFF7EC)
71#define MCU_ID3 (0x1FFFF7F0)
72
73
74extern usbd_desc_handler printer_desc_handler;
75
87#ifdef __cplusplus
88}
89#endif
90
91#endif
printer_desc_handler
usbd_desc_handler printer_desc_handler
device descriptor handler structure
Definition printer_desc.c:66
printer_class.h
usb printer class file
usbd_desc_handler
usb device descriptor handler
Definition usbd_core.h:75
usbd_core.h
usb device core header file


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • acc
  • calibration
  • inc
project/at_start_f413/examples/acc/calibration/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • acc
  • calibration
  • inc
project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • acc
  • calibration
  • inc
project/at_start_f413/examples/acc/calibration/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/usb_device/virtual_comport/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/usb_device/virtual_comport/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/usb_device/virtual_comport/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/usb_device/virtual_comport/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/usb_device/virtual_comport/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/usb_device/virtual_comport/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/usb_device/virtual_comport/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/usb_device/virtual_comport/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/usb_device/virtual_comport/src/at32f413_int.c:112


AT32F413 Firmwary Library: usb_conf.h Source File

  • acc
  • calibration
  • inc
project/at_start_f413/examples/acc/calibration/inc/usb_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __USB_CONF_H
28#define __USB_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "at32f413.h"
35#include "at32f413_board.h"
36#include "stdio.h"
37
49#ifndef USB_EPT_MAX_NUM
50#define USB_EPT_MAX_NUM 8
51#endif
52
56//#define USB_BUFFER_SIZE_EX
57
58
62//#define USB_EPT_AUTO_MALLOC_BUFFER
63
64
65#ifndef USB_EPT_AUTO_MALLOC_BUFFER
71/* ept0 tx start address 0x40, size 0x40,
72 so rx start address is 0x40 + 0x40 = 0x80 */
73#define EPT0_TX_ADDR 0x40
74#define EPT0_RX_ADDR 0x80
75
76#define EPT1_TX_ADDR 0xC0
77#define EPT1_RX_ADDR 0x100
78
79#define EPT2_TX_ADDR 0x140
80#define EPT2_RX_ADDR 0x180
81
82#define EPT3_TX_ADDR 0x00
83#define EPT3_RX_ADDR 0x00
84
85#define EPT4_TX_ADDR 0x00
86#define EPT4_RX_ADDR 0x00
87
88#define EPT5_TX_ADDR 0x00
89#define EPT5_RX_ADDR 0x00
90
91#define EPT6_TX_ADDR 0x00
92#define EPT6_RX_ADDR 0x00
93
94#define EPT7_TX_ADDR 0x00
95#define EPT7_RX_ADDR 0x00
96
97#endif
98void usb_delay_ms(uint32_t ms);
99void usb_delay_us(uint32_t us);
100
108#ifdef __cplusplus
109}
110#endif
111
112#endif
at32f413.h
at32f413 header file
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
usb_delay_ms
void usb_delay_ms(uint32_t ms)
usb delay millisecond function.
Definition project/at_start_f413/examples/acc/calibration/src/main.c:244
usb_delay_us
void usb_delay_us(uint32_t us)
usb delay microsecond function.
Definition project/at_start_f413/examples/acc/calibration/src/main.c:255


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • acc
  • calibration
  • src
project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • acc
  • calibration
  • src
project/at_start_f413/examples/acc/calibration/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
29
43void NMI_Handler(void)
44{
45}
46
52void HardFault_Handler(void)
53{
54 /* go to infinite loop when hard fault exception occurs */
55 while(1)
56 {
57 }
58}
59
65void MemManage_Handler(void)
66{
67 /* go to infinite loop when memory manage exception occurs */
68 while(1)
69 {
70 }
71}
72
78void BusFault_Handler(void)
79{
80 /* go to infinite loop when bus fault exception occurs */
81 while(1)
82 {
83 }
84}
85
91void UsageFault_Handler(void)
92{
93 /* go to infinite loop when usage fault exception occurs */
94 while(1)
95 {
96 }
97}
98
104void SVC_Handler(void)
105{
106}
107
113void DebugMon_Handler(void)
114{
115}
116
122void PendSV_Handler(void)
123{
124}
125
131void SysTick_Handler(void)
132{
133}
134
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • acc
  • calibration
  • src
project/at_start_f413/examples/acc/calibration/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include "usbd_core.h"
29#include "cdc_class.h"
30#include "cdc_desc.h"
31#include "usbd_int.h"
32
33
34
43 usbd_core_type usb_core_dev;
44uint8_t usb_buffer[256];
45
46/* select system clock source from hext or hick */
47//#define SCLK_FROM_HEXT
48#define SCLK_FROM_HICK
49
50/* ACC_CAL : the step is incremented or decremented by one, the hickcal will be incremented or decremented by 40khz */
51/* ACC_TRIM : the step is incremented or decremented by one, the hicktrim will be incremented or decremented by 20khz */
52/* define ACC_TRIM in order to get higher calibration accuracy */
53//#define ACC_CAL
54#define ACC_TRIM
55
56void system_clock_config_for_acc(void);
57void clkout_config(void);
58
59uint32_t acc_c2_value = 0;
60
61
67void usb_clock48m_select(usb_clk48_s clk_s)
68{
69 if(clk_s == USB_CLK_HICK)
70 {
71 crm_usb_clock_source_select(CRM_USB_CLOCK_SOURCE_HICK);
72 }
73 else
74 {
75 switch(system_core_clock)
76 {
77 /* 48MHz */
78 case 48000000:
79 crm_usb_clock_div_set(CRM_USB_DIV_1);
80 break;
81
82 /* 72MHz */
83 case 72000000:
84 crm_usb_clock_div_set(CRM_USB_DIV_1_5);
85 break;
86
87 /* 96MHz */
88 case 96000000:
89 crm_usb_clock_div_set(CRM_USB_DIV_2);
90 break;
91
92 /* 120MHz */
93 case 120000000:
94 crm_usb_clock_div_set(CRM_USB_DIV_2_5);
95 break;
96
97 /* 144MHz */
98 case 144000000:
99 crm_usb_clock_div_set(CRM_USB_DIV_3);
100 break;
101
102 /* 168MHz */
103 case 168000000:
104 crm_usb_clock_div_set(CRM_USB_DIV_3_5);
105 break;
106
107 /* 192MHz */
108 case 192000000:
109 crm_usb_clock_div_set(CRM_USB_DIV_4);
110 break;
111
112 default:
113 crm_usb_clock_source_select(CRM_USB_CLOCK_SOURCE_HICK);
114 break;
115 }
116 }
117}
118
124void USBFS_L_CAN1_RX0_IRQHandler(void)
125{
126 usbd_irq_handler(&usb_core_dev);
127}
128
134void ACC_IRQHandler(void)
135{
136 if(acc_interrupt_flag_get(ACC_CALRDY_FLAG) != RESET)
137 {
138 at32_led_toggle(LED2);
139
140 /* clear acc calibration ready flag */
141 acc_flag_clear(ACC_CALRDY_FLAG);
142 }
143 if(acc_interrupt_flag_get(ACC_RSLOST_FLAG) != RESET)
144 {
145 at32_led_toggle(LED3);
146
147 /* clear acc reference signal lost flag */
148 acc_flag_clear(ACC_RSLOST_FLAG);
149 }
150}
151
157void system_clock_config_for_acc(void)
158{
159 /* reset crm */
160 crm_reset();
161
162 crm_clock_source_enable(CRM_CLOCK_SOURCE_HICK, TRUE);
163
164 /* wait till hick is ready */
165 while(SET != crm_flag_get(CRM_HICK_STABLE_FLAG))
166 {
167 }
168
169 /* config pll clock resource */
170 crm_pll_config(CRM_PLL_SOURCE_HICK, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
171
172 /* enable pll */
173 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
174
175 /* wait till pll is ready */
176 while(SET != crm_flag_get(CRM_PLL_STABLE_FLAG))
177 {
178 }
179
180 /* config ahbclk */
181 crm_ahb_div_set(CRM_AHB_DIV_1);
182
183 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
184 crm_apb2_div_set(CRM_APB2_DIV_2);
185
186 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
187 crm_apb1_div_set(CRM_APB1_DIV_2);
188
189 /* enable auto step mode */
190 crm_auto_step_mode_enable(TRUE);
191
192 /* select pll as system clock source */
193 crm_sysclk_switch(CRM_SCLK_PLL);
194
195 /* wait till pll is used as system clock source */
196 while(CRM_SCLK_PLL != crm_sysclk_switch_status_get())
197 {
198 }
199
200 /* disable auto step mode */
201 crm_auto_step_mode_enable(FALSE);
202
203 /* update system_core_clock global variable */
204 system_core_clock_update();
205
206 /* pa8 output usb clk */
207 clkout_config();
208}
209
215void clkout_config(void)
216{
217 gpio_init_type gpio_init_struct;
218
219 /* enable gpio port clock */
220 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
221
222 /* set default parameter */
223 gpio_default_para_init(&gpio_init_struct);
224
225 /* clkout gpio init */
226 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
227 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
228 gpio_init_struct.gpio_pins = GPIO_PINS_8;
229 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
230 gpio_init(GPIOA, &gpio_init_struct);
231
232 /* config clkout division */
233 crm_clkout_div_set(CRM_CLKOUT_DIV_1);
234
235 /* config clkout clock */
236 crm_clock_out_set(CRM_CLKOUT_USB);
237}
238
244void usb_delay_ms(uint32_t ms)
245{
246 /* user can define self delay function */
247 delay_ms(ms);
248}
249
255void usb_delay_us(uint32_t us)
256{
257 delay_us(us);
258}
259
265int main(void)
266{
267 uint16_t data_len;
268
269 uint32_t timeout;
270
271 uint8_t send_zero_packet = 0;
272
273 /* config nvic priority group */
274 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
275
276 /* sclk = 240mhz from hick */
277 system_clock_config_for_acc();
278
279 at32_board_init();
280
281 usb_clock48m_select(USB_CLK_HICK);
282
283 crm_periph_clock_enable(CRM_USB_PERIPH_CLOCK, TRUE);
284
285 nvic_irq_enable(USBFS_L_CAN1_RX0_IRQn, 1, 0);
286
287 usbd_core_init(&usb_core_dev, USB, &cdc_class_handler, &cdc_desc_handler, 0);
288
289 usbd_connect(&usb_core_dev);
290
291 /* acc config */
292 crm_periph_clock_enable(CRM_ACC_PERIPH_CLOCK, TRUE);
293
294 /* enable the acc calibration ready interrupt */
295 acc_interrupt_enable(ACC_CALRDYIEN_INT, TRUE);
296
297 /* enable the acc reference signal lost interrupt */
298 acc_interrupt_enable(ACC_EIEN_INT, TRUE);
299
300 /* config nvic for acc int */
301 nvic_irq_enable(ACC_IRQn, 2, 0);
302
303 /* update the c1\c2\c3 value */
304 acc_c2_value = 8000;
305 #ifdef ACC_CAL
306 acc_write_c1(acc_c2_value - 20);
307 acc_write_c2(acc_c2_value);
308 acc_write_c3(acc_c2_value + 20);
309 #else
310 acc_write_c1(acc_c2_value - 10);
311 acc_write_c2(acc_c2_value);
312 acc_write_c3(acc_c2_value + 10);
313 #endif
314
315 /* open acc calibration */
316 #if defined(ACC_CAL)
317 acc_calibration_mode_enable(ACC_CAL_HICKCAL, TRUE);
318 #elif defined(ACC_TRIM)
319 acc_calibration_mode_enable(ACC_CAL_HICKTRIM, TRUE);
320 #endif
321
322 while(1)
323 {
324 /* get usb vcp receive data */
325 data_len = usb_vcp_get_rxdata(&usb_core_dev, usb_buffer);
326
327 if(data_len > 0 || send_zero_packet == 1)
328 {
329
330 /* bulk transfer is complete when the endpoint does one of the following
331 1 has transferred exactly the amount of data expected
332 2 transfers a packet with a payload size less than wMaxPacketSize or transfers a zero-length packet
333 */
334 if(data_len > 0)
335 send_zero_packet = 1;
336
337 if(data_len == 0)
338 send_zero_packet = 0;
339
340 timeout = 5000000;
341 do
342 {
343 /* send data to host */
344 if(usb_vcp_send_data(&usb_core_dev, usb_buffer, data_len) == SUCCESS)
345 {
346 break;
347 }
348 }while(timeout --);
349 }
350 }
351}
352
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
cdc_class.h
usb cdc class file
cdc_desc.h
usb cdc descriptor header file
clkout_config
void clkout_config(void)
clkout configuration
Definition project/at_start_f413/examples/acc/calibration/src/main.c:215
usb_clock48m_select
void usb_clock48m_select(usb_clk48_s clk_s)
usb 48M clock select
Definition project/at_start_f413/examples/acc/calibration/src/main.c:67
system_clock_config_for_acc
void system_clock_config_for_acc(void)
system clock config for acc
Definition project/at_start_f413/examples/acc/calibration/src/main.c:157
ACC_IRQHandler
void ACC_IRQHandler(void)
acc interrupt handler
Definition project/at_start_f413/examples/acc/calibration/src/main.c:134
main
int main(void)
main function.
Definition project/at_start_f413/examples/acc/calibration/src/main.c:265
USBFS_L_CAN1_RX0_IRQHandler
void USBFS_L_CAN1_RX0_IRQHandler(void)
usbfs_l_can1_rx0 interrupt handler
Definition project/at_start_f413/examples/acc/calibration/src/main.c:124
usb_delay_ms
void usb_delay_ms(uint32_t ms)
usb delay millisecond function.
Definition project/at_start_f413/examples/acc/calibration/src/main.c:244
usb_delay_us
void usb_delay_us(uint32_t us)
usb delay microsecond function.
Definition project/at_start_f413/examples/acc/calibration/src/main.c:255
usb_buffer
uint8_t usb_buffer[256]
Definition project/at_start_f413/examples/acc/calibration/src/main.c:44
acc_c2_value
uint32_t acc_c2_value
Definition project/at_start_f413/examples/acc/calibration/src/main.c:59
usb_core_dev
usbd_core_type usb_core_dev
Definition project/at_start_f413/examples/acc/calibration/src/main.c:43
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
ACC_CAL_HICKCAL
#define ACC_CAL_HICKCAL
Definition at32f413_acc.h:51
ACC_RSLOST_FLAG
#define ACC_RSLOST_FLAG
Definition at32f413_acc.h:54
ACC_EIEN_INT
#define ACC_EIEN_INT
Definition at32f413_acc.h:58
ACC_CAL_HICKTRIM
#define ACC_CAL_HICKTRIM
Definition at32f413_acc.h:52
ACC_CALRDYIEN_INT
#define ACC_CALRDYIEN_INT
Definition at32f413_acc.h:57
ACC_CALRDY_FLAG
#define ACC_CALRDY_FLAG
Definition at32f413_acc.h:55
acc_write_c2
void acc_write_c2(uint16_t acc_c2_value)
wtire the value to acc c2 register.
Definition at32f413_acc.c:131
acc_write_c3
void acc_write_c3(uint16_t acc_c3_value)
wtire the value to acc c3 register.
Definition at32f413_acc.c:141
acc_interrupt_enable
void acc_interrupt_enable(uint16_t acc_int, confirm_state new_state)
enable or disable the specified acc interrupts.
Definition at32f413_acc.c:84
acc_interrupt_flag_get
flag_status acc_interrupt_flag_get(uint16_t acc_flag)
check whether the specified acc interrupt flag is set or not.
Definition at32f413_acc.c:200
acc_write_c1
void acc_write_c1(uint16_t acc_c1_value)
wtire the value to acc c1 register.
Definition at32f413_acc.c:121
acc_flag_clear
void acc_flag_clear(uint16_t acc_flag)
clear the specified acc flag is set or not.
Definition at32f413_acc.c:216
acc_calibration_mode_enable
void acc_calibration_mode_enable(uint16_t acc_trim, confirm_state new_state)
enable or disable the acc calibration mode.
Definition at32f413_acc.c:52
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
system_core_clock
unsigned int system_core_clock
Definition system_at32f413.c:47
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
delay_us
void delay_us(uint32_t nus)
inserts a delay time.
Definition at32f413_board.c:330
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_clkout_div_set
void crm_clkout_div_set(crm_clkout_div_type clkout_div)
set crm clkout division
Definition at32f413_crm.c:888
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_clock_out_set
void crm_clock_out_set(crm_clkout_select_type clkout)
set crm clkout
Definition at32f413_crm.c:767
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_usb_clock_div_set
void crm_usb_clock_div_set(crm_usb_div_type div_value)
set crm usb division
Definition at32f413_crm.c:533
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
crm_usb_clock_source_select
void crm_usb_clock_source_select(crm_usb_clock_source_type value)
usb 48 mhz clock source select
Definition at32f413_crm.c:854
CRM_USB_PERIPH_CLOCK
@ CRM_USB_PERIPH_CLOCK
Definition at32f413_crm.h:137
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_ACC_PERIPH_CLOCK
@ CRM_ACC_PERIPH_CLOCK
Definition at32f413_crm.h:123
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_HICK
@ CRM_CLOCK_SOURCE_HICK
Definition at32f413_crm.h:293
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_USB_DIV_3
@ CRM_USB_DIV_3
Definition at32f413_crm.h:363
CRM_USB_DIV_1_5
@ CRM_USB_DIV_1_5
Definition at32f413_crm.h:358
CRM_USB_DIV_4
@ CRM_USB_DIV_4
Definition at32f413_crm.h:364
CRM_USB_DIV_3_5
@ CRM_USB_DIV_3_5
Definition at32f413_crm.h:362
CRM_USB_DIV_2
@ CRM_USB_DIV_2
Definition at32f413_crm.h:361
CRM_USB_DIV_1
@ CRM_USB_DIV_1
Definition at32f413_crm.h:359
CRM_USB_DIV_2_5
@ CRM_USB_DIV_2_5
Definition at32f413_crm.h:360
CRM_CLKOUT_DIV_1
@ CRM_CLKOUT_DIV_1
Definition at32f413_crm.h:419
CRM_USB_CLOCK_SOURCE_HICK
@ CRM_USB_CLOCK_SOURCE_HICK
Definition at32f413_crm.h:454
CRM_PLL_SOURCE_HICK
@ CRM_PLL_SOURCE_HICK
Definition at32f413_crm.h:274
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_CLKOUT_USB
@ CRM_CLKOUT_USB
Definition at32f413_crm.h:410
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
CRM_HICK_STABLE_FLAG
#define CRM_HICK_STABLE_FLAG
Definition at32f413_crm.h:54
USBFS_L_CAN1_RX0_IRQn
@ USBFS_L_CAN1_RX0_IRQn
Definition at32f413.h:192
ACC_IRQn
@ ACC_IRQn
Definition at32f413.h:231
SUCCESS
@ SUCCESS
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
SET
@ SET
Definition at32f413.h:292
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_PINS_8
#define GPIO_PINS_8
Definition at32f413_gpio.h:58
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
usb_vcp_get_rxdata
uint16_t usb_vcp_get_rxdata(void *udev, uint8_t *recv_data)
usb device class rx data process
Definition cdc_class.c:344
usb_vcp_send_data
error_status usb_vcp_send_data(void *udev, uint8_t *send_data, uint16_t len)
usb device class send data
Definition cdc_class.c:374
cdc_class_handler
usbd_class_handler cdc_class_handler
Definition cdc_class.c:68
cdc_desc_handler
usbd_desc_handler cdc_desc_handler
device descriptor handler structure
Definition cdc_desc.c:65
usb_clk48_s
usb_clk48_s
usb clock select
Definition at32f413_usb.h:230
USB_CLK_HICK
@ USB_CLK_HICK
Definition at32f413_usb.h:231
usbd_core_init
void usbd_core_init(usbd_core_type *udev, usb_reg_type *usb_reg, usbd_class_handler *dev_handler, usbd_desc_handler *desc_handler, uint8_t core_id)
initializes the usb core
Definition usbd_core.c:675
usbd_connect
void usbd_connect(usbd_core_type *udev)
usb device connect to host
Definition usbd_core.c:564
usbd_irq_handler
void usbd_irq_handler(usbd_core_type *udev)
usb device interrput request handler.
Definition usbd_int.c:45
USB
#define USB
Definition at32f413_usb.h:665
at32f413_clock.h
header file of clock program
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
usbd_core_type
usb device core struct type
Definition usbd_core.h:114
usbd_core.h
usb device core header file
usbd_int.h


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • adc
  • combine_mode_ordinary_simult
  • inc
project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • adc
  • combine_mode_ordinary_simult
  • inc
project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • adc
  • combine_mode_ordinary_simult
  • inc
project/at_start_f413/examples/adc/combine_mode_ordinary_simult/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • adc
  • combine_mode_ordinary_simult
  • src
project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • adc
  • combine_mode_ordinary_simult
  • src
project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • adc
  • combine_mode_ordinary_simult
  • src
project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37__IO uint32_t adc1_ordinary_valuetab[3];
38__IO uint32_t dma1_trans_complete_flag = 0;
39__IO uint32_t conversion_times_index = 0;
40
46static void gpio_config(void)
47{
48 gpio_init_type gpio_initstructure;
49 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
50 crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
51
52 gpio_default_para_init(&gpio_initstructure);
53 gpio_initstructure.gpio_mode = GPIO_MODE_ANALOG;
54 gpio_initstructure.gpio_pins = GPIO_PINS_4 | GPIO_PINS_5 | GPIO_PINS_6 | GPIO_PINS_7;
55 gpio_init(GPIOA, &gpio_initstructure);
56
57 gpio_initstructure.gpio_mode = GPIO_MODE_ANALOG;
58 gpio_initstructure.gpio_pins = GPIO_PINS_0 | GPIO_PINS_1;
59 gpio_init(GPIOB, &gpio_initstructure);
60}
61
67static void dma_config(void)
68{
69 dma_init_type dma_init_struct;
70 crm_periph_clock_enable(CRM_DMA1_PERIPH_CLOCK, TRUE);
71 nvic_irq_enable(DMA1_Channel1_IRQn, 0, 0);
72 dma_reset(DMA1_CHANNEL1);
73 dma_default_para_init(&dma_init_struct);
74 dma_init_struct.buffer_size = 3;
75 dma_init_struct.direction = DMA_DIR_PERIPHERAL_TO_MEMORY;
76 dma_init_struct.memory_base_addr = (uint32_t)adc1_ordinary_valuetab;
77 dma_init_struct.memory_data_width = DMA_MEMORY_DATA_WIDTH_WORD;
78 dma_init_struct.memory_inc_enable = TRUE;
79 dma_init_struct.peripheral_base_addr = (uint32_t)&(ADC1->odt);
80 dma_init_struct.peripheral_data_width = DMA_PERIPHERAL_DATA_WIDTH_WORD;
81 dma_init_struct.peripheral_inc_enable = FALSE;
82 dma_init_struct.priority = DMA_PRIORITY_HIGH;
83 dma_init_struct.loop_mode_enable = TRUE;
84 dma_init(DMA1_CHANNEL1, &dma_init_struct);
85
86 dma_interrupt_enable(DMA1_CHANNEL1, DMA_FDT_INT, TRUE);
87}
88
94static void adc_config(void)
95{
96 adc_base_config_type adc_base_struct;
97 crm_periph_clock_enable(CRM_ADC1_PERIPH_CLOCK, TRUE);
98 crm_periph_clock_enable(CRM_ADC2_PERIPH_CLOCK, TRUE);
99 adc_reset(ADC1);
100 adc_reset(ADC2);
101 crm_adc_clock_div_set(CRM_ADC_DIV_6);
102 adc_base_default_para_init(&adc_base_struct);
103
104 /* select combine mode */
105 adc_combine_mode_select(ADC_ORDINARY_SMLT_ONLY_MODE);
106
107 /* ADC1 config */
108 adc_base_struct.sequence_mode = TRUE;
109 adc_base_struct.repeat_mode = FALSE;
110 adc_base_struct.data_align = ADC_RIGHT_ALIGNMENT;
111 adc_base_struct.ordinary_channel_length = 3;
112 adc_base_config(ADC1, &adc_base_struct);
113 adc_ordinary_channel_set(ADC1, ADC_CHANNEL_4, 1, ADC_SAMPLETIME_239_5);
114 adc_ordinary_channel_set(ADC1, ADC_CHANNEL_5, 2, ADC_SAMPLETIME_239_5);
115 adc_ordinary_channel_set(ADC1, ADC_CHANNEL_6, 3, ADC_SAMPLETIME_239_5);
116 adc_ordinary_conversion_trigger_set(ADC1, ADC12_ORDINARY_TRIG_SOFTWARE, TRUE);
117 adc_dma_mode_enable(ADC1, TRUE);
118
119 /* ADC2 config */
120 adc_base_config(ADC2, &adc_base_struct);
121 adc_ordinary_channel_set(ADC2, ADC_CHANNEL_7, 1, ADC_SAMPLETIME_239_5);
122 adc_ordinary_channel_set(ADC2, ADC_CHANNEL_8, 2, ADC_SAMPLETIME_239_5);
123 adc_ordinary_channel_set(ADC2, ADC_CHANNEL_9, 3, ADC_SAMPLETIME_239_5);
124 adc_ordinary_conversion_trigger_set(ADC2, ADC12_ORDINARY_TRIG_SOFTWARE, TRUE);
125
126 adc_enable(ADC1, TRUE);
127 adc_enable(ADC2, TRUE);
128
129 /* ADC calibration */
130 adc_calibration_init(ADC1);
131 while(adc_calibration_init_status_get(ADC1));
132 adc_calibration_start(ADC1);
133 while(adc_calibration_status_get(ADC1));
134 adc_calibration_init(ADC2);
135 while(adc_calibration_init_status_get(ADC2));
136 adc_calibration_start(ADC2);
137 while(adc_calibration_status_get(ADC2));
138}
139
145void DMA1_Channel1_IRQHandler(void)
146{
147 if(dma_interrupt_flag_get(DMA1_FDT1_FLAG) != RESET)
148 {
149 dma_flag_clear(DMA1_FDT1_FLAG);
150 dma1_trans_complete_flag++;
151 }
152}
153
159int main(void)
160{
161 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
162 system_clock_config();
163 at32_board_init();
164 at32_led_off(LED2);
165 at32_led_off(LED3);
166 at32_led_off(LED4);
167 uart_print_init(115200);
168 gpio_config();
169 dma_config();
170 adc_config();
171
172 /* enable DMA after ADC activation */
173 dma_channel_enable(DMA1_CHANNEL1, TRUE);
174
175 printf("combine_mode_ordinary_simult \r\n");
176 while(1)
177 {
178 /* ordinary software start conversion */
179 adc_ordinary_software_trigger_enable(ADC1, TRUE);
180
181 /* wait conversion end */
182 while(conversion_times_index == dma1_trans_complete_flag)
183 {
184 }
185 conversion_times_index = dma1_trans_complete_flag;
186 printf("conversion_times_index = %d\r\n",conversion_times_index);
187 printf("adc1_ordinary_channel4 = 0x%x\r\n", adc1_ordinary_valuetab[0] & 0xFFFF);
188 printf("adc1_ordinary_channel5 = 0x%x\r\n", adc1_ordinary_valuetab[1] & 0xFFFF);
189 printf("adc1_ordinary_channel6 = 0x%x\r\n", adc1_ordinary_valuetab[2] & 0xFFFF);
190 printf("adc2_ordinary_channel7 = 0x%x\r\n", (adc1_ordinary_valuetab[0] >> 16) & 0xFFFF);
191 printf("adc2_ordinary_channel8 = 0x%x\r\n", (adc1_ordinary_valuetab[1] >> 16) & 0xFFFF);
192 printf("adc2_ordinary_channel9 = 0x%x\r\n", (adc1_ordinary_valuetab[2] >> 16) & 0xFFFF);
193 printf("\r\n");
194 at32_led_toggle(LED2);
195 delay_sec(1);
196 }
197}
198
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
conversion_times_index
__IO uint32_t conversion_times_index
Definition project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/main.c:39
dma_config
static void dma_config(void)
dma configuration.
Definition project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/main.c:67
adc_config
static void adc_config(void)
adc configuration.
Definition project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/main.c:94
adc1_ordinary_valuetab
__IO uint32_t adc1_ordinary_valuetab[3]
Definition project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/main.c:37
dma1_trans_complete_flag
__IO uint32_t dma1_trans_complete_flag
Definition project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/main.c:38
DMA1_Channel1_IRQHandler
void DMA1_Channel1_IRQHandler(void)
this function handles dma1_channel1 handler.
Definition project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/main.c:145
main
int main(void)
main function.
Definition project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/main.c:159
gpio_config
static void gpio_config(void)
gpio configuration.
Definition project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/main.c:46
dma_init_struct
dma_init_type dma_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:38
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
adc_ordinary_software_trigger_enable
void adc_ordinary_software_trigger_enable(adc_type *adc_x, confirm_state new_state)
enable or disable ordinary software start conversion of the specified adc peripheral.
Definition at32f413_adc.c:643
adc_base_config
void adc_base_config(adc_type *adc_x, adc_base_config_type *adc_base_struct)
initialize the adc peripheral according to the specified parameters.
Definition at32f413_adc.c:142
adc_enable
void adc_enable(adc_type *adc_x, confirm_state new_state)
enable or disable the specified adc peripheral.
Definition at32f413_adc.c:74
adc_base_default_para_init
void adc_base_default_para_init(adc_base_config_type *adc_base_struct)
adc base default para init.
Definition at32f413_adc.c:116
adc_calibration_start
void adc_calibration_start(adc_type *adc_x)
start calibration process of the specified adc peripheral.
Definition at32f413_adc.c:229
adc_calibration_status_get
flag_status adc_calibration_status_get(adc_type *adc_x)
get calibration status of the specified adc peripheral.
Definition at32f413_adc.c:241
adc_ordinary_conversion_trigger_set
void adc_ordinary_conversion_trigger_set(adc_type *adc_x, adc_ordinary_trig_select_type adc_ordinary_trig, confirm_state new_state)
enable or disable the ordinary channel's external trigger and set external trigger event of the speci...
Definition at32f413_adc.c:480
adc_calibration_init
void adc_calibration_init(adc_type *adc_x)
initialize calibration register of the specified adc peripheral.
Definition at32f413_adc.c:198
adc_calibration_init_status_get
flag_status adc_calibration_init_status_get(adc_type *adc_x)
get calibration register's initialize status of the specified adc peripheral.
Definition at32f413_adc.c:210
adc_dma_mode_enable
void adc_dma_mode_enable(adc_type *adc_x, confirm_state new_state)
enable or disable the adc dma transfer.
Definition at32f413_adc.c:160
adc_combine_mode_select
void adc_combine_mode_select(adc_combine_mode_type combine_mode)
select combine mode of the specified adc peripheral.
Definition at32f413_adc.c:96
adc_reset
void adc_reset(adc_type *adc_x)
deinitialize the adc peripheral registers to their default reset values.
Definition at32f413_adc.c:50
adc_ordinary_channel_set
void adc_ordinary_channel_set(adc_type *adc_x, adc_channel_select_type adc_channel, uint8_t adc_sequence, adc_sampletime_select_type adc_sampletime)
set ordinary channel's corresponding rank in the sequencer and sample time of the specified adc perip...
Definition at32f413_adc.c:342
ADC_RIGHT_ALIGNMENT
@ ADC_RIGHT_ALIGNMENT
Definition at32f413_adc.h:100
ADC_CHANNEL_9
@ ADC_CHANNEL_9
Definition at32f413_adc.h:118
ADC_CHANNEL_8
@ ADC_CHANNEL_8
Definition at32f413_adc.h:117
ADC_CHANNEL_4
@ ADC_CHANNEL_4
Definition at32f413_adc.h:113
ADC_CHANNEL_6
@ ADC_CHANNEL_6
Definition at32f413_adc.h:115
ADC_CHANNEL_7
@ ADC_CHANNEL_7
Definition at32f413_adc.h:116
ADC_CHANNEL_5
@ ADC_CHANNEL_5
Definition at32f413_adc.h:114
ADC_SAMPLETIME_239_5
@ ADC_SAMPLETIME_239_5
Definition at32f413_adc.h:141
ADC_ORDINARY_SMLT_ONLY_MODE
@ ADC_ORDINARY_SMLT_ONLY_MODE
Definition at32f413_adc.h:89
ADC12_ORDINARY_TRIG_SOFTWARE
@ ADC12_ORDINARY_TRIG_SOFTWARE
Definition at32f413_adc.h:157
ADC1
#define ADC1
Definition at32f413_adc.h:558
ADC2
#define ADC2
Definition at32f413_adc.h:559
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
at32_led_off
void at32_led_off(led_type led)
turns selected led off.
Definition at32f413_board.c:287
uart_print_init
void uart_print_init(uint32_t baudrate)
initialize uart
Definition at32f413_board.c:129
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
delay_sec
void delay_sec(uint16_t sec)
inserts a delay time.
Definition at32f413_board.c:382
crm_adc_clock_div_set
void crm_adc_clock_div_set(crm_adc_div_type div_value)
set crm adc division
Definition at32f413_crm.c:514
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_ADC1_PERIPH_CLOCK
@ CRM_ADC1_PERIPH_CLOCK
Definition at32f413_crm.h:114
CRM_GPIOB_PERIPH_CLOCK
@ CRM_GPIOB_PERIPH_CLOCK
Definition at32f413_crm.h:110
CRM_DMA1_PERIPH_CLOCK
@ CRM_DMA1_PERIPH_CLOCK
Definition at32f413_crm.h:103
CRM_ADC2_PERIPH_CLOCK
@ CRM_ADC2_PERIPH_CLOCK
Definition at32f413_crm.h:115
CRM_ADC_DIV_6
@ CRM_ADC_DIV_6
Definition at32f413_crm.h:347
DMA1_Channel1_IRQn
@ DMA1_Channel1_IRQn
Definition at32f413.h:182
dma_channel_enable
void dma_channel_enable(dma_channel_type *dmax_channely, confirm_state new_state)
enable or disable dma channely
Definition at32f413_dma.c:197
dma_default_para_init
void dma_default_para_init(dma_init_type *dma_init_struct)
dma init config with its default value.
Definition at32f413_dma.c:407
dma_interrupt_flag_get
flag_status dma_interrupt_flag_get(uint32_t dmax_flag)
get dma interrupt flag
Definition at32f413_dma.c:297
dma_interrupt_enable
void dma_interrupt_enable(dma_channel_type *dmax_channely, uint32_t dma_int, confirm_state new_state)
enable or disable dma interrupt
Definition at32f413_dma.c:164
dma_flag_clear
void dma_flag_clear(uint32_t dmax_flag)
clear dma flag
Definition at32f413_dma.c:389
dma_reset
void dma_reset(dma_channel_type *dmax_channely)
reset the dmax channely registers.
Definition at32f413_dma.c:63
dma_init
void dma_init(dma_channel_type *dmax_channely, dma_init_type *dma_init_struct)
dma init
Definition at32f413_dma.c:442
DMA_PERIPHERAL_DATA_WIDTH_WORD
@ DMA_PERIPHERAL_DATA_WIDTH_WORD
Definition at32f413_dma.h:247
DMA_DIR_PERIPHERAL_TO_MEMORY
@ DMA_DIR_PERIPHERAL_TO_MEMORY
Definition at32f413_dma.h:216
DMA_MEMORY_DATA_WIDTH_WORD
@ DMA_MEMORY_DATA_WIDTH_WORD
Definition at32f413_dma.h:257
DMA_PRIORITY_HIGH
@ DMA_PRIORITY_HIGH
Definition at32f413_dma.h:267
DMA1_FDT1_FLAG
#define DMA1_FDT1_FLAG
Definition at32f413_dma.h:81
DMA_FDT_INT
#define DMA_FDT_INT
Definition at32f413_dma.h:51
DMA1_CHANNEL1
#define DMA1_CHANNEL1
Definition at32f413_dma.h:480
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_ANALOG
@ GPIO_MODE_ANALOG
Definition at32f413_gpio.h:216
GPIO_PINS_6
#define GPIO_PINS_6
Definition at32f413_gpio.h:56
GPIO_PINS_0
#define GPIO_PINS_0
Definition at32f413_gpio.h:50
GPIO_PINS_7
#define GPIO_PINS_7
Definition at32f413_gpio.h:57
GPIO_PINS_4
#define GPIO_PINS_4
Definition at32f413_gpio.h:54
GPIO_PINS_1
#define GPIO_PINS_1
Definition at32f413_gpio.h:51
GPIO_PINS_5
#define GPIO_PINS_5
Definition at32f413_gpio.h:55
GPIOB
#define GPIOB
Definition at32f413_gpio.h:748
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
at32f413_clock.h
header file of clock program
adc_base_config_type
adc base config type
Definition at32f413_adc.h:211
adc_base_config_type::data_align
adc_data_align_type data_align
Definition at32f413_adc.h:214
adc_base_config_type::repeat_mode
confirm_state repeat_mode
Definition at32f413_adc.h:213
adc_base_config_type::sequence_mode
confirm_state sequence_mode
Definition at32f413_adc.h:212
adc_base_config_type::ordinary_channel_length
uint8_t ordinary_channel_length
Definition at32f413_adc.h:215
dma_init_type
dma init type
Definition at32f413_dma.h:275
dma_init_type::loop_mode_enable
confirm_state loop_mode_enable
Definition at32f413_dma.h:284
dma_init_type::buffer_size
uint16_t buffer_size
Definition at32f413_dma.h:279
dma_init_type::memory_data_width
dma_memory_data_size_type memory_data_width
Definition at32f413_dma.h:283
dma_init_type::priority
dma_priority_level_type priority
Definition at32f413_dma.h:285
dma_init_type::peripheral_inc_enable
confirm_state peripheral_inc_enable
Definition at32f413_dma.h:280
dma_init_type::memory_inc_enable
confirm_state memory_inc_enable
Definition at32f413_dma.h:281
dma_init_type::direction
dma_dir_type direction
Definition at32f413_dma.h:278
dma_init_type::peripheral_base_addr
uint32_t peripheral_base_addr
Definition at32f413_dma.h:276
dma_init_type::memory_base_addr
uint32_t memory_base_addr
Definition at32f413_dma.h:277
dma_init_type::peripheral_data_width
dma_peripheral_data_size_type peripheral_data_width
Definition at32f413_dma.h:282
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • adc
  • current_vref_value_check
  • inc
project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • adc
  • current_vref_value_check
  • inc
project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • adc
  • current_vref_value_check
  • inc
project/at_start_f413/examples/adc/current_vref_value_check/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • adc
  • current_vref_value_check
  • src
project/at_start_f413/examples/adc/current_vref_value_check/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/adc/current_vref_value_check/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • adc
  • current_vref_value_check
  • src
project/at_start_f413/examples/adc/current_vref_value_check/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
134
135
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/adc/current_vref_value_check/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/adc/current_vref_value_check/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/adc/current_vref_value_check/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/adc/current_vref_value_check/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/adc/current_vref_value_check/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/adc/current_vref_value_check/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/adc/current_vref_value_check/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/adc/current_vref_value_check/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/adc/current_vref_value_check/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • adc
  • current_vref_value_check
  • src
project/at_start_f413/examples/adc/current_vref_value_check/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37__IO uint16_t adc1_ordinary_value = 0;
38
44static void dma_config(void)
45{
46 dma_init_type dma_init_struct;
47 crm_periph_clock_enable(CRM_DMA1_PERIPH_CLOCK, TRUE);
48 dma_reset(DMA1_CHANNEL1);
49 dma_default_para_init(&dma_init_struct);
50 dma_init_struct.buffer_size = 1;
51 dma_init_struct.direction = DMA_DIR_PERIPHERAL_TO_MEMORY;
52 dma_init_struct.memory_base_addr = (uint32_t)&adc1_ordinary_value;
53 dma_init_struct.memory_data_width = DMA_MEMORY_DATA_WIDTH_HALFWORD;
54 dma_init_struct.memory_inc_enable = FALSE;
55 dma_init_struct.peripheral_base_addr = (uint32_t)&(ADC1->odt);
56 dma_init_struct.peripheral_data_width = DMA_PERIPHERAL_DATA_WIDTH_HALFWORD;
57 dma_init_struct.peripheral_inc_enable = FALSE;
58 dma_init_struct.priority = DMA_PRIORITY_HIGH;
59 dma_init_struct.loop_mode_enable = TRUE;
60 dma_init(DMA1_CHANNEL1, &dma_init_struct);
61}
62
68static void adc_config(void)
69{
70 adc_base_config_type adc_base_struct;
71 crm_periph_clock_enable(CRM_ADC1_PERIPH_CLOCK, TRUE);
72 adc_reset(ADC1);
73 crm_adc_clock_div_set(CRM_ADC_DIV_6);
74
75 /* select combine mode */
76 adc_combine_mode_select(ADC_INDEPENDENT_MODE);
77
78 /* ADC1 config */
79 adc_base_default_para_init(&adc_base_struct);
80 adc_base_struct.sequence_mode = FALSE;
81 adc_base_struct.repeat_mode = FALSE;
82 adc_base_struct.data_align = ADC_RIGHT_ALIGNMENT;
83 adc_base_struct.ordinary_channel_length = 1;
84 adc_base_config(ADC1, &adc_base_struct);
85 adc_ordinary_channel_set(ADC1, ADC_CHANNEL_17, 1, ADC_SAMPLETIME_239_5);
86 adc_ordinary_conversion_trigger_set(ADC1, ADC12_ORDINARY_TRIG_SOFTWARE, TRUE);
87 adc_dma_mode_enable(ADC1, TRUE);
88 adc_tempersensor_vintrv_enable(TRUE);
89
90 adc_enable(ADC1, TRUE);
91
92 /* ADC calibration */
93 adc_calibration_init(ADC1);
94 while(adc_calibration_init_status_get(ADC1));
95 adc_calibration_start(ADC1);
96 while(adc_calibration_status_get(ADC1));
97}
98
104int main(void)
105{
106 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
107 system_clock_config();
108 at32_board_init();
109 at32_led_off(LED2);
110 at32_led_off(LED3);
111 at32_led_off(LED4);
112 uart_print_init(115200);
113 dma_config();
114 adc_config();
115
116 /* enable DMA after ADC activation */
117 dma_channel_enable(DMA1_CHANNEL1, TRUE);
118
119 printf("adc1_vref_check \r\n");
120 while(1)
121 {
122 at32_led_on(LED2);
123 delay_sec(1);
124
125 /* ordinary software start conversion */
126 adc_ordinary_software_trigger_enable(ADC1, TRUE);
127
128 /* wait conversion end */
129 while(dma_flag_get(DMA1_FDT1_FLAG) == RESET);
130
131 dma_flag_clear(DMA1_FDT1_FLAG);
132 printf("vref_value = %f V\r\n", ((double)1.2 * 4095) / adc1_ordinary_value);
133 }
134}
135
136
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
dma_config
static void dma_config(void)
dma configuration.
Definition project/at_start_f413/examples/adc/current_vref_value_check/src/main.c:44
adc1_ordinary_value
__IO uint16_t adc1_ordinary_value
Definition project/at_start_f413/examples/adc/current_vref_value_check/src/main.c:37
adc_config
static void adc_config(void)
adc configuration.
Definition project/at_start_f413/examples/adc/current_vref_value_check/src/main.c:68
main
int main(void)
main function.
Definition project/at_start_f413/examples/adc/current_vref_value_check/src/main.c:104
dma_init_struct
dma_init_type dma_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:38
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
adc_ordinary_software_trigger_enable
void adc_ordinary_software_trigger_enable(adc_type *adc_x, confirm_state new_state)
enable or disable ordinary software start conversion of the specified adc peripheral.
Definition at32f413_adc.c:643
adc_base_config
void adc_base_config(adc_type *adc_x, adc_base_config_type *adc_base_struct)
initialize the adc peripheral according to the specified parameters.
Definition at32f413_adc.c:142
adc_tempersensor_vintrv_enable
void adc_tempersensor_vintrv_enable(confirm_state new_state)
enable or disable the temperature sensor and vintrv channel.
Definition at32f413_adc.c:629
adc_enable
void adc_enable(adc_type *adc_x, confirm_state new_state)
enable or disable the specified adc peripheral.
Definition at32f413_adc.c:74
adc_base_default_para_init
void adc_base_default_para_init(adc_base_config_type *adc_base_struct)
adc base default para init.
Definition at32f413_adc.c:116
adc_calibration_start
void adc_calibration_start(adc_type *adc_x)
start calibration process of the specified adc peripheral.
Definition at32f413_adc.c:229
adc_calibration_status_get
flag_status adc_calibration_status_get(adc_type *adc_x)
get calibration status of the specified adc peripheral.
Definition at32f413_adc.c:241
adc_ordinary_conversion_trigger_set
void adc_ordinary_conversion_trigger_set(adc_type *adc_x, adc_ordinary_trig_select_type adc_ordinary_trig, confirm_state new_state)
enable or disable the ordinary channel's external trigger and set external trigger event of the speci...
Definition at32f413_adc.c:480
adc_calibration_init
void adc_calibration_init(adc_type *adc_x)
initialize calibration register of the specified adc peripheral.
Definition at32f413_adc.c:198
adc_calibration_init_status_get
flag_status adc_calibration_init_status_get(adc_type *adc_x)
get calibration register's initialize status of the specified adc peripheral.
Definition at32f413_adc.c:210
adc_dma_mode_enable
void adc_dma_mode_enable(adc_type *adc_x, confirm_state new_state)
enable or disable the adc dma transfer.
Definition at32f413_adc.c:160
adc_combine_mode_select
void adc_combine_mode_select(adc_combine_mode_type combine_mode)
select combine mode of the specified adc peripheral.
Definition at32f413_adc.c:96
adc_reset
void adc_reset(adc_type *adc_x)
deinitialize the adc peripheral registers to their default reset values.
Definition at32f413_adc.c:50
adc_ordinary_channel_set
void adc_ordinary_channel_set(adc_type *adc_x, adc_channel_select_type adc_channel, uint8_t adc_sequence, adc_sampletime_select_type adc_sampletime)
set ordinary channel's corresponding rank in the sequencer and sample time of the specified adc perip...
Definition at32f413_adc.c:342
ADC_RIGHT_ALIGNMENT
@ ADC_RIGHT_ALIGNMENT
Definition at32f413_adc.h:100
ADC_CHANNEL_17
@ ADC_CHANNEL_17
Definition at32f413_adc.h:126
ADC_SAMPLETIME_239_5
@ ADC_SAMPLETIME_239_5
Definition at32f413_adc.h:141
ADC_INDEPENDENT_MODE
@ ADC_INDEPENDENT_MODE
Definition at32f413_adc.h:83
ADC12_ORDINARY_TRIG_SOFTWARE
@ ADC12_ORDINARY_TRIG_SOFTWARE
Definition at32f413_adc.h:157
ADC1
#define ADC1
Definition at32f413_adc.h:558
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
at32_led_off
void at32_led_off(led_type led)
turns selected led off.
Definition at32f413_board.c:287
uart_print_init
void uart_print_init(uint32_t baudrate)
initialize uart
Definition at32f413_board.c:129
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
delay_sec
void delay_sec(uint16_t sec)
inserts a delay time.
Definition at32f413_board.c:382
crm_adc_clock_div_set
void crm_adc_clock_div_set(crm_adc_div_type div_value)
set crm adc division
Definition at32f413_crm.c:514
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_ADC1_PERIPH_CLOCK
@ CRM_ADC1_PERIPH_CLOCK
Definition at32f413_crm.h:114
CRM_DMA1_PERIPH_CLOCK
@ CRM_DMA1_PERIPH_CLOCK
Definition at32f413_crm.h:103
CRM_ADC_DIV_6
@ CRM_ADC_DIV_6
Definition at32f413_crm.h:347
dma_channel_enable
void dma_channel_enable(dma_channel_type *dmax_channely, confirm_state new_state)
enable or disable dma channely
Definition at32f413_dma.c:197
dma_default_para_init
void dma_default_para_init(dma_init_type *dma_init_struct)
dma init config with its default value.
Definition at32f413_dma.c:407
dma_flag_get
flag_status dma_flag_get(uint32_t dmax_flag)
get dma flag
Definition at32f413_dma.c:343
dma_flag_clear
void dma_flag_clear(uint32_t dmax_flag)
clear dma flag
Definition at32f413_dma.c:389
dma_reset
void dma_reset(dma_channel_type *dmax_channely)
reset the dmax channely registers.
Definition at32f413_dma.c:63
dma_init
void dma_init(dma_channel_type *dmax_channely, dma_init_type *dma_init_struct)
dma init
Definition at32f413_dma.c:442
DMA_PERIPHERAL_DATA_WIDTH_HALFWORD
@ DMA_PERIPHERAL_DATA_WIDTH_HALFWORD
Definition at32f413_dma.h:246
DMA_DIR_PERIPHERAL_TO_MEMORY
@ DMA_DIR_PERIPHERAL_TO_MEMORY
Definition at32f413_dma.h:216
DMA_MEMORY_DATA_WIDTH_HALFWORD
@ DMA_MEMORY_DATA_WIDTH_HALFWORD
Definition at32f413_dma.h:256
DMA_PRIORITY_HIGH
@ DMA_PRIORITY_HIGH
Definition at32f413_dma.h:267
DMA1_FDT1_FLAG
#define DMA1_FDT1_FLAG
Definition at32f413_dma.h:81
DMA1_CHANNEL1
#define DMA1_CHANNEL1
Definition at32f413_dma.h:480
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
at32f413_clock.h
header file of clock program
adc_base_config_type
adc base config type
Definition at32f413_adc.h:211
adc_base_config_type::data_align
adc_data_align_type data_align
Definition at32f413_adc.h:214
adc_base_config_type::repeat_mode
confirm_state repeat_mode
Definition at32f413_adc.h:213
adc_base_config_type::sequence_mode
confirm_state sequence_mode
Definition at32f413_adc.h:212
adc_base_config_type::ordinary_channel_length
uint8_t ordinary_channel_length
Definition at32f413_adc.h:215
dma_init_type
dma init type
Definition at32f413_dma.h:275
dma_init_type::loop_mode_enable
confirm_state loop_mode_enable
Definition at32f413_dma.h:284
dma_init_type::buffer_size
uint16_t buffer_size
Definition at32f413_dma.h:279
dma_init_type::memory_data_width
dma_memory_data_size_type memory_data_width
Definition at32f413_dma.h:283
dma_init_type::priority
dma_priority_level_type priority
Definition at32f413_dma.h:285
dma_init_type::peripheral_inc_enable
confirm_state peripheral_inc_enable
Definition at32f413_dma.h:280
dma_init_type::memory_inc_enable
confirm_state memory_inc_enable
Definition at32f413_dma.h:281
dma_init_type::direction
dma_dir_type direction
Definition at32f413_dma.h:278
dma_init_type::peripheral_base_addr
uint32_t peripheral_base_addr
Definition at32f413_dma.h:276
dma_init_type::memory_base_addr
uint32_t memory_base_addr
Definition at32f413_dma.h:277
dma_init_type::peripheral_data_width
dma_peripheral_data_size_type peripheral_data_width
Definition at32f413_dma.h:282


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • adc
  • exint_trigger_partitioned
  • inc
project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • adc
  • exint_trigger_partitioned
  • inc
project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • adc
  • exint_trigger_partitioned
  • inc
project/at_start_f413/examples/adc/exint_trigger_partitioned/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • adc
  • exint_trigger_partitioned
  • src
project/at_start_f413/examples/adc/exint_trigger_partitioned/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/adc/exint_trigger_partitioned/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • adc
  • exint_trigger_partitioned
  • src
project/at_start_f413/examples/adc/exint_trigger_partitioned/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/adc/exint_trigger_partitioned/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/adc/exint_trigger_partitioned/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/adc/exint_trigger_partitioned/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/adc/exint_trigger_partitioned/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/adc/exint_trigger_partitioned/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/adc/exint_trigger_partitioned/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/adc/exint_trigger_partitioned/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/adc/exint_trigger_partitioned/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/adc/exint_trigger_partitioned/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • adc
  • exint_trigger_partitioned
  • src
project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
38__IO uint16_t adc1_ordinary_valuetab[3] = {0};
39__IO uint16_t adc1_preempt_valuetab[3] = {0};
40__IO uint16_t dma_trans_complete_flag = 0;
41__IO uint16_t ordinary_conversion_times_index = 0;
42__IO uint16_t preempt_trigger_count = 0;
43__IO uint16_t preempt_conversion_times_index = 0;
44
50static void gpio_config(void)
51{
52 gpio_init_type gpio_initstructure;
53 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
54 crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
55
56 gpio_default_para_init(&gpio_initstructure);
57 gpio_initstructure.gpio_mode = GPIO_MODE_ANALOG;
58 gpio_initstructure.gpio_pins = GPIO_PINS_4 | GPIO_PINS_5 | GPIO_PINS_6 | GPIO_PINS_7;
59 gpio_init(GPIOA, &gpio_initstructure);
60
61 gpio_initstructure.gpio_mode = GPIO_MODE_ANALOG;
62 gpio_initstructure.gpio_pins = GPIO_PINS_0 | GPIO_PINS_1;
63 gpio_init(GPIOB, &gpio_initstructure);
64}
65
71static void exint_config(void)
72{
73 gpio_init_type gpio_initstructure;
74 exint_init_type exint_init_struct;
75
76 crm_periph_clock_enable(CRM_IOMUX_PERIPH_CLOCK, TRUE);
77 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
78 crm_periph_clock_enable(CRM_GPIOC_PERIPH_CLOCK, TRUE);
79
80 gpio_exint_line_config(GPIO_PORT_SOURCE_GPIOC, GPIO_PINS_SOURCE11);
81 gpio_exint_line_config(GPIO_PORT_SOURCE_GPIOA, GPIO_PINS_SOURCE15);
82
83 gpio_default_para_init(&gpio_initstructure);
84 gpio_initstructure.gpio_pull = GPIO_PULL_DOWN;
85 gpio_initstructure.gpio_mode = GPIO_MODE_INPUT;
86 gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
87 gpio_initstructure.gpio_pins = GPIO_PINS_11;
88 gpio_init(GPIOC, &gpio_initstructure);
89 gpio_initstructure.gpio_pull = GPIO_PULL_DOWN;
90 gpio_initstructure.gpio_mode = GPIO_MODE_INPUT;
91 gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
92 gpio_initstructure.gpio_pins = GPIO_PINS_15;
93 gpio_init(GPIOA, &gpio_initstructure);
94
95 exint_default_para_init(&exint_init_struct);
96 exint_init_struct.line_enable = TRUE;
97 exint_init_struct.line_mode = EXINT_LINE_EVENT;
98 exint_init_struct.line_select = EXINT_LINE_11;
99 exint_init_struct.line_polarity = EXINT_TRIGGER_RISING_EDGE;
100 exint_init(&exint_init_struct);
101
102 exint_init_struct.line_select = EXINT_LINE_15;
103 exint_init(&exint_init_struct);
104}
105
111static void dma_config(void)
112{
113 dma_init_type dma_init_struct;
114 crm_periph_clock_enable(CRM_DMA1_PERIPH_CLOCK, TRUE);
115 nvic_irq_enable(DMA1_Channel1_IRQn, 0, 0);
116 dma_reset(DMA1_CHANNEL1);
117 dma_default_para_init(&dma_init_struct);
118 dma_init_struct.buffer_size = 3;
119 dma_init_struct.direction = DMA_DIR_PERIPHERAL_TO_MEMORY;
120 dma_init_struct.memory_base_addr = (uint32_t)adc1_ordinary_valuetab;
121 dma_init_struct.memory_data_width = DMA_MEMORY_DATA_WIDTH_HALFWORD;
122 dma_init_struct.memory_inc_enable = TRUE;
123 dma_init_struct.peripheral_base_addr = (uint32_t)&(ADC1->odt);
124 dma_init_struct.peripheral_data_width = DMA_PERIPHERAL_DATA_WIDTH_HALFWORD;
125 dma_init_struct.peripheral_inc_enable = FALSE;
126 dma_init_struct.priority = DMA_PRIORITY_HIGH;
127 dma_init_struct.loop_mode_enable = TRUE;
128 dma_init(DMA1_CHANNEL1, &dma_init_struct);
129
130 dma_interrupt_enable(DMA1_CHANNEL1, DMA_FDT_INT, TRUE);
131}
132
138static void adc_config(void)
139{
140 adc_base_config_type adc_base_struct;
141 crm_periph_clock_enable(CRM_ADC1_PERIPH_CLOCK, TRUE);
142 adc_reset(ADC1);
143 crm_adc_clock_div_set(CRM_ADC_DIV_6);
144 nvic_irq_enable(ADC1_2_IRQn, 0, 0);
145 adc_base_default_para_init(&adc_base_struct);
146
147 /* select combine mode */
148 adc_combine_mode_select(ADC_INDEPENDENT_MODE);
149
150 /* ADC1 config */
151 adc_base_struct.sequence_mode = TRUE;
152 adc_base_struct.repeat_mode = FALSE;
153 adc_base_struct.data_align = ADC_RIGHT_ALIGNMENT;
154 adc_base_struct.ordinary_channel_length = 3;
155 adc_base_config(ADC1, &adc_base_struct);
156 adc_ordinary_channel_set(ADC1, ADC_CHANNEL_4, 1, ADC_SAMPLETIME_239_5);
157 adc_ordinary_channel_set(ADC1, ADC_CHANNEL_5, 2, ADC_SAMPLETIME_239_5);
158 adc_ordinary_channel_set(ADC1, ADC_CHANNEL_6, 3, ADC_SAMPLETIME_239_5);
159 adc_ordinary_conversion_trigger_set(ADC1, ADC12_ORDINARY_TRIG_EXINT11_TMR8TRGOUT, TRUE);
160 adc_dma_mode_enable(ADC1, TRUE);
161 adc_ordinary_part_count_set(ADC1, 1);
162 adc_ordinary_part_mode_enable(ADC1, TRUE);
163
164 adc_preempt_channel_length_set(ADC1, 3);
165 adc_preempt_channel_set(ADC1, ADC_CHANNEL_7, 1, ADC_SAMPLETIME_239_5);
166 adc_preempt_channel_set(ADC1, ADC_CHANNEL_8, 2, ADC_SAMPLETIME_239_5);
167 adc_preempt_channel_set(ADC1, ADC_CHANNEL_9, 3, ADC_SAMPLETIME_239_5);
168 adc_preempt_conversion_trigger_set(ADC1, ADC12_PREEMPT_TRIG_EXINT15_TMR8CH4, TRUE);
169 adc_interrupt_enable(ADC1, ADC_PCCE_INT, TRUE);
170
171 adc_enable(ADC1, TRUE);
172
173 /* ADC calibration */
174 adc_calibration_init(ADC1);
175 while(adc_calibration_init_status_get(ADC1));
176 adc_calibration_start(ADC1);
177 while(adc_calibration_status_get(ADC1));
178}
179
185void DMA1_Channel1_IRQHandler(void)
186{
187 if(dma_interrupt_flag_get(DMA1_FDT1_FLAG) != RESET)
188 {
189 dma_flag_clear(DMA1_FDT1_FLAG);
190 dma_trans_complete_flag++;
191 }
192}
193
199void ADC1_2_IRQHandler(void)
200{
201 if(adc_interrupt_flag_get(ADC1, ADC_PCCE_FLAG) != RESET)
202 {
203 adc_flag_clear(ADC1, ADC_PCCE_FLAG);
204 adc1_preempt_valuetab[0] = adc_preempt_conversion_data_get(ADC1, ADC_PREEMPT_CHANNEL_1);
205 adc1_preempt_valuetab[1] = adc_preempt_conversion_data_get(ADC1, ADC_PREEMPT_CHANNEL_2);
206 adc1_preempt_valuetab[2] = adc_preempt_conversion_data_get(ADC1, ADC_PREEMPT_CHANNEL_3);
207 preempt_trigger_count++;
208 }
209}
210
216int main(void)
217{
218 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
219 system_clock_config();
220 at32_board_init();
221 at32_led_off(LED2);
222 at32_led_off(LED3);
223 at32_led_off(LED4);
224 uart_print_init(115200);
225 gpio_config();
226 exint_config();
227 dma_config();
228 adc_config();
229
230 /* enable DMA after ADC activation */
231 dma_channel_enable(DMA1_CHANNEL1, TRUE);
232
233 printf("exint_trigger_partitioned \r\n");
234 while(1)
235 {
236 /* wait ordinary conversion end */
237 if(ordinary_conversion_times_index != dma_trans_complete_flag)
238 {
239 ordinary_conversion_times_index = dma_trans_complete_flag;
240 printf("ordinary_conversion_times_index = %d\r\n",ordinary_conversion_times_index);
241 printf("adc1_ordinary_valuetab[0] = 0x%x\r\n", adc1_ordinary_valuetab[0]);
242 printf("adc1_ordinary_valuetab[1] = 0x%x\r\n", adc1_ordinary_valuetab[1]);
243 printf("adc1_ordinary_valuetab[2] = 0x%x\r\n", adc1_ordinary_valuetab[2]);
244 printf("\r\n");
245 at32_led_toggle(LED2);
246 }
247
248 /* wait preempt conversion end */
249 if(preempt_conversion_times_index != preempt_trigger_count)
250 {
251 preempt_conversion_times_index = preempt_trigger_count;
252 printf("preempt_conversion_times_index = %d\r\n",preempt_conversion_times_index);
253 printf("adc1_preempt_valuetab[0] = 0x%x\r\n", adc1_preempt_valuetab[0]);
254 printf("adc1_preempt_valuetab[1] = 0x%x\r\n", adc1_preempt_valuetab[1]);
255 printf("adc1_preempt_valuetab[2] = 0x%x\r\n", adc1_preempt_valuetab[2]);
256 printf("\r\n");
257 at32_led_toggle(LED3);
258 }
259 }
260}
261
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
preempt_conversion_times_index
__IO uint16_t preempt_conversion_times_index
Definition project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c:43
dma_trans_complete_flag
__IO uint16_t dma_trans_complete_flag
Definition project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c:40
dma_config
static void dma_config(void)
dma configuration.
Definition project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c:111
exint_config
static void exint_config(void)
exint configuration.
Definition project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c:71
ADC1_2_IRQHandler
void ADC1_2_IRQHandler(void)
this function handles adc1_2 handler.
Definition project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c:199
adc_config
static void adc_config(void)
adc configuration.
Definition project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c:138
adc1_preempt_valuetab
__IO uint16_t adc1_preempt_valuetab[3]
Definition project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c:39
preempt_trigger_count
__IO uint16_t preempt_trigger_count
Definition project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c:42
DMA1_Channel1_IRQHandler
void DMA1_Channel1_IRQHandler(void)
this function handles dma1_channel1 handler.
Definition project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c:185
ordinary_conversion_times_index
__IO uint16_t ordinary_conversion_times_index
Definition project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c:41
main
int main(void)
main function.
Definition project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c:216
adc1_ordinary_valuetab
__IO uint16_t adc1_ordinary_valuetab[3]
Definition project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c:38
gpio_config
static void gpio_config(void)
gpio configuration.
Definition project/at_start_f413/examples/adc/exint_trigger_partitioned/src/main.c:50
dma_init_struct
dma_init_type dma_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:38
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
adc_base_config
void adc_base_config(adc_type *adc_x, adc_base_config_type *adc_base_struct)
initialize the adc peripheral according to the specified parameters.
Definition at32f413_adc.c:142
adc_enable
void adc_enable(adc_type *adc_x, confirm_state new_state)
enable or disable the specified adc peripheral.
Definition at32f413_adc.c:74
adc_ordinary_part_count_set
void adc_ordinary_part_count_set(adc_type *adc_x, uint8_t adc_channel_count)
set partitioned mode channel count of the specified adc peripheral.
Definition at32f413_adc.c:574
adc_preempt_conversion_data_get
uint16_t adc_preempt_conversion_data_get(adc_type *adc_x, adc_preempt_channel_type adc_preempt_channel)
return the conversion data for selection preempt channel of the specified adc peripheral.
Definition at32f413_adc.c:734
adc_flag_clear
void adc_flag_clear(adc_type *adc_x, uint32_t adc_flag)
clear flag of the specified adc peripheral.
Definition at32f413_adc.c:841
adc_interrupt_enable
void adc_interrupt_enable(adc_type *adc_x, uint32_t adc_int, confirm_state new_state)
enable or disable the specified adc interrupts.
Definition at32f413_adc.c:179
adc_base_default_para_init
void adc_base_default_para_init(adc_base_config_type *adc_base_struct)
adc base default para init.
Definition at32f413_adc.c:116
adc_calibration_start
void adc_calibration_start(adc_type *adc_x)
start calibration process of the specified adc peripheral.
Definition at32f413_adc.c:229
adc_calibration_status_get
flag_status adc_calibration_status_get(adc_type *adc_x)
get calibration status of the specified adc peripheral.
Definition at32f413_adc.c:241
adc_interrupt_flag_get
flag_status adc_interrupt_flag_get(adc_type *adc_x, uint8_t adc_flag)
get interrupt flag of the specified adc peripheral.
Definition at32f413_adc.c:798
adc_ordinary_conversion_trigger_set
void adc_ordinary_conversion_trigger_set(adc_type *adc_x, adc_ordinary_trig_select_type adc_ordinary_trig, confirm_state new_state)
enable or disable the ordinary channel's external trigger and set external trigger event of the speci...
Definition at32f413_adc.c:480
adc_preempt_conversion_trigger_set
void adc_preempt_conversion_trigger_set(adc_type *adc_x, adc_preempt_trig_select_type adc_preempt_trig, confirm_state new_state)
enable or disable the preempt channel's external trigger and set external trigger event of the specif...
Definition at32f413_adc.c:511
adc_calibration_init
void adc_calibration_init(adc_type *adc_x)
initialize calibration register of the specified adc peripheral.
Definition at32f413_adc.c:198
adc_preempt_channel_set
void adc_preempt_channel_set(adc_type *adc_x, adc_channel_select_type adc_channel, uint8_t adc_sequence, adc_sampletime_select_type adc_sampletime)
configure preempt channel's corresponding rank in the sequencer and sample time of the specified adc ...
Definition at32f413_adc.c:425
adc_calibration_init_status_get
flag_status adc_calibration_init_status_get(adc_type *adc_x)
get calibration register's initialize status of the specified adc peripheral.
Definition at32f413_adc.c:210
adc_ordinary_part_mode_enable
void adc_ordinary_part_mode_enable(adc_type *adc_x, confirm_state new_state)
enable or disable the partitioned mode on ordinary channel of the specified adc peripheral.
Definition at32f413_adc.c:589
adc_dma_mode_enable
void adc_dma_mode_enable(adc_type *adc_x, confirm_state new_state)
enable or disable the adc dma transfer.
Definition at32f413_adc.c:160
adc_combine_mode_select
void adc_combine_mode_select(adc_combine_mode_type combine_mode)
select combine mode of the specified adc peripheral.
Definition at32f413_adc.c:96
adc_preempt_channel_length_set
void adc_preempt_channel_length_set(adc_type *adc_x, uint8_t adc_channel_lenght)
set preempt channel lenghth of the specified adc peripheral.
Definition at32f413_adc.c:393
adc_reset
void adc_reset(adc_type *adc_x)
deinitialize the adc peripheral registers to their default reset values.
Definition at32f413_adc.c:50
adc_ordinary_channel_set
void adc_ordinary_channel_set(adc_type *adc_x, adc_channel_select_type adc_channel, uint8_t adc_sequence, adc_sampletime_select_type adc_sampletime)
set ordinary channel's corresponding rank in the sequencer and sample time of the specified adc perip...
Definition at32f413_adc.c:342
ADC_RIGHT_ALIGNMENT
@ ADC_RIGHT_ALIGNMENT
Definition at32f413_adc.h:100
ADC_CHANNEL_9
@ ADC_CHANNEL_9
Definition at32f413_adc.h:118
ADC_CHANNEL_8
@ ADC_CHANNEL_8
Definition at32f413_adc.h:117
ADC_CHANNEL_4
@ ADC_CHANNEL_4
Definition at32f413_adc.h:113
ADC_CHANNEL_6
@ ADC_CHANNEL_6
Definition at32f413_adc.h:115
ADC_CHANNEL_7
@ ADC_CHANNEL_7
Definition at32f413_adc.h:116
ADC_CHANNEL_5
@ ADC_CHANNEL_5
Definition at32f413_adc.h:114
ADC_SAMPLETIME_239_5
@ ADC_SAMPLETIME_239_5
Definition at32f413_adc.h:141
ADC12_PREEMPT_TRIG_EXINT15_TMR8CH4
@ ADC12_PREEMPT_TRIG_EXINT15_TMR8CH4
Definition at32f413_adc.h:175
ADC_INDEPENDENT_MODE
@ ADC_INDEPENDENT_MODE
Definition at32f413_adc.h:83
ADC12_ORDINARY_TRIG_EXINT11_TMR8TRGOUT
@ ADC12_ORDINARY_TRIG_EXINT11_TMR8TRGOUT
Definition at32f413_adc.h:156
ADC_PREEMPT_CHANNEL_3
@ ADC_PREEMPT_CHANNEL_3
Definition at32f413_adc.h:189
ADC_PREEMPT_CHANNEL_2
@ ADC_PREEMPT_CHANNEL_2
Definition at32f413_adc.h:188
ADC_PREEMPT_CHANNEL_1
@ ADC_PREEMPT_CHANNEL_1
Definition at32f413_adc.h:187
ADC_PCCE_FLAG
#define ADC_PCCE_FLAG
Definition at32f413_adc.h:66
ADC_PCCE_INT
#define ADC_PCCE_INT
Definition at32f413_adc.h:53
ADC1
#define ADC1
Definition at32f413_adc.h:558
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
at32_led_off
void at32_led_off(led_type led)
turns selected led off.
Definition at32f413_board.c:287
uart_print_init
void uart_print_init(uint32_t baudrate)
initialize uart
Definition at32f413_board.c:129
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_adc_clock_div_set
void crm_adc_clock_div_set(crm_adc_div_type div_value)
set crm adc division
Definition at32f413_crm.c:514
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOC_PERIPH_CLOCK
@ CRM_GPIOC_PERIPH_CLOCK
Definition at32f413_crm.h:111
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_IOMUX_PERIPH_CLOCK
@ CRM_IOMUX_PERIPH_CLOCK
Definition at32f413_crm.h:108
CRM_ADC1_PERIPH_CLOCK
@ CRM_ADC1_PERIPH_CLOCK
Definition at32f413_crm.h:114
CRM_GPIOB_PERIPH_CLOCK
@ CRM_GPIOB_PERIPH_CLOCK
Definition at32f413_crm.h:110
CRM_DMA1_PERIPH_CLOCK
@ CRM_DMA1_PERIPH_CLOCK
Definition at32f413_crm.h:103
CRM_ADC_DIV_6
@ CRM_ADC_DIV_6
Definition at32f413_crm.h:347
ADC1_2_IRQn
@ ADC1_2_IRQn
Definition at32f413.h:190
DMA1_Channel1_IRQn
@ DMA1_Channel1_IRQn
Definition at32f413.h:182
dma_channel_enable
void dma_channel_enable(dma_channel_type *dmax_channely, confirm_state new_state)
enable or disable dma channely
Definition at32f413_dma.c:197
dma_default_para_init
void dma_default_para_init(dma_init_type *dma_init_struct)
dma init config with its default value.
Definition at32f413_dma.c:407
dma_interrupt_flag_get
flag_status dma_interrupt_flag_get(uint32_t dmax_flag)
get dma interrupt flag
Definition at32f413_dma.c:297
dma_interrupt_enable
void dma_interrupt_enable(dma_channel_type *dmax_channely, uint32_t dma_int, confirm_state new_state)
enable or disable dma interrupt
Definition at32f413_dma.c:164
dma_flag_clear
void dma_flag_clear(uint32_t dmax_flag)
clear dma flag
Definition at32f413_dma.c:389
dma_reset
void dma_reset(dma_channel_type *dmax_channely)
reset the dmax channely registers.
Definition at32f413_dma.c:63
dma_init
void dma_init(dma_channel_type *dmax_channely, dma_init_type *dma_init_struct)
dma init
Definition at32f413_dma.c:442
DMA_PERIPHERAL_DATA_WIDTH_HALFWORD
@ DMA_PERIPHERAL_DATA_WIDTH_HALFWORD
Definition at32f413_dma.h:246
DMA_DIR_PERIPHERAL_TO_MEMORY
@ DMA_DIR_PERIPHERAL_TO_MEMORY
Definition at32f413_dma.h:216
DMA_MEMORY_DATA_WIDTH_HALFWORD
@ DMA_MEMORY_DATA_WIDTH_HALFWORD
Definition at32f413_dma.h:256
DMA_PRIORITY_HIGH
@ DMA_PRIORITY_HIGH
Definition at32f413_dma.h:267
DMA1_FDT1_FLAG
#define DMA1_FDT1_FLAG
Definition at32f413_dma.h:81
DMA_FDT_INT
#define DMA_FDT_INT
Definition at32f413_dma.h:51
DMA1_CHANNEL1
#define DMA1_CHANNEL1
Definition at32f413_dma.h:480
exint_default_para_init
void exint_default_para_init(exint_init_type *exint_struct)
exint default para init
Definition at32f413_exint.c:63
exint_init
void exint_init(exint_init_type *exint_struct)
exint init
Definition at32f413_exint.c:77
EXINT_LINE_EVENT
@ EXINT_LINE_EVENT
Definition at32f413_exint.h:85
EXINT_TRIGGER_RISING_EDGE
@ EXINT_TRIGGER_RISING_EDGE
Definition at32f413_exint.h:93
EXINT_LINE_15
#define EXINT_LINE_15
Definition at32f413_exint.h:66
EXINT_LINE_11
#define EXINT_LINE_11
Definition at32f413_exint.h:62
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_exint_line_config
void gpio_exint_line_config(gpio_port_source_type gpio_port_source, gpio_pins_source_type gpio_pin_source)
select the gpio pin used as exint line.
Definition at32f413_gpio.c:605
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_ANALOG
@ GPIO_MODE_ANALOG
Definition at32f413_gpio.h:216
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PINS_SOURCE11
@ GPIO_PINS_SOURCE11
Definition at32f413_gpio.h:264
GPIO_PINS_SOURCE15
@ GPIO_PINS_SOURCE15
Definition at32f413_gpio.h:268
GPIO_PORT_SOURCE_GPIOA
@ GPIO_PORT_SOURCE_GPIOA
Definition at32f413_gpio.h:276
GPIO_PORT_SOURCE_GPIOC
@ GPIO_PORT_SOURCE_GPIOC
Definition at32f413_gpio.h:278
GPIO_PULL_DOWN
@ GPIO_PULL_DOWN
Definition at32f413_gpio.h:245
GPIO_PINS_6
#define GPIO_PINS_6
Definition at32f413_gpio.h:56
GPIO_PINS_0
#define GPIO_PINS_0
Definition at32f413_gpio.h:50
GPIO_PINS_11
#define GPIO_PINS_11
Definition at32f413_gpio.h:61
GPIO_PINS_7
#define GPIO_PINS_7
Definition at32f413_gpio.h:57
GPIO_PINS_4
#define GPIO_PINS_4
Definition at32f413_gpio.h:54
GPIO_PINS_1
#define GPIO_PINS_1
Definition at32f413_gpio.h:51
GPIO_PINS_15
#define GPIO_PINS_15
Definition at32f413_gpio.h:65
GPIO_PINS_5
#define GPIO_PINS_5
Definition at32f413_gpio.h:55
GPIOC
#define GPIOC
Definition at32f413_gpio.h:749
GPIOB
#define GPIOB
Definition at32f413_gpio.h:748
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
at32f413_clock.h
header file of clock program
adc_base_config_type
adc base config type
Definition at32f413_adc.h:211
adc_base_config_type::data_align
adc_data_align_type data_align
Definition at32f413_adc.h:214
adc_base_config_type::repeat_mode
confirm_state repeat_mode
Definition at32f413_adc.h:213
adc_base_config_type::sequence_mode
confirm_state sequence_mode
Definition at32f413_adc.h:212
adc_base_config_type::ordinary_channel_length
uint8_t ordinary_channel_length
Definition at32f413_adc.h:215
dma_init_type
dma init type
Definition at32f413_dma.h:275
dma_init_type::loop_mode_enable
confirm_state loop_mode_enable
Definition at32f413_dma.h:284
dma_init_type::buffer_size
uint16_t buffer_size
Definition at32f413_dma.h:279
dma_init_type::memory_data_width
dma_memory_data_size_type memory_data_width
Definition at32f413_dma.h:283
dma_init_type::priority
dma_priority_level_type priority
Definition at32f413_dma.h:285
dma_init_type::peripheral_inc_enable
confirm_state peripheral_inc_enable
Definition at32f413_dma.h:280
dma_init_type::memory_inc_enable
confirm_state memory_inc_enable
Definition at32f413_dma.h:281
dma_init_type::direction
dma_dir_type direction
Definition at32f413_dma.h:278
dma_init_type::peripheral_base_addr
uint32_t peripheral_base_addr
Definition at32f413_dma.h:276
dma_init_type::memory_base_addr
uint32_t memory_base_addr
Definition at32f413_dma.h:277
dma_init_type::peripheral_data_width
dma_peripheral_data_size_type peripheral_data_width
Definition at32f413_dma.h:282
exint_init_type
exint init type
Definition at32f413_exint.h:102
exint_init_type::line_select
uint32_t line_select
Definition at32f413_exint.h:104
exint_init_type::line_enable
confirm_state line_enable
Definition at32f413_exint.h:106
exint_init_type::line_mode
exint_line_mode_type line_mode
Definition at32f413_exint.h:103
exint_init_type::line_polarity
exint_polarity_config_type line_polarity
Definition at32f413_exint.h:105
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • adc
  • internal_temperature_sensor
  • inc
project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • adc
  • internal_temperature_sensor
  • inc
project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • adc
  • internal_temperature_sensor
  • inc
project/at_start_f413/examples/adc/internal_temperature_sensor/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • adc
  • internal_temperature_sensor
  • src
project/at_start_f413/examples/adc/internal_temperature_sensor/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/adc/internal_temperature_sensor/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • adc
  • internal_temperature_sensor
  • src
project/at_start_f413/examples/adc/internal_temperature_sensor/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
43void NMI_Handler(void)
44{
45}
46
52void HardFault_Handler(void)
53{
54 /* go to infinite loop when hard fault exception occurs */
55 while(1)
56 {
57 }
58}
59
65void MemManage_Handler(void)
66{
67 /* go to infinite loop when memory manage exception occurs */
68 while(1)
69 {
70 }
71}
72
78void BusFault_Handler(void)
79{
80 /* go to infinite loop when bus fault exception occurs */
81 while(1)
82 {
83 }
84}
85
91void UsageFault_Handler(void)
92{
93 /* go to infinite loop when usage fault exception occurs */
94 while(1)
95 {
96 }
97}
98
104void SVC_Handler(void)
105{
106}
107
113void DebugMon_Handler(void)
114{
115}
116
122void PendSV_Handler(void)
123{
124}
125
131void SysTick_Handler(void)
132{
133}
134
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/adc/internal_temperature_sensor/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/adc/internal_temperature_sensor/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/adc/internal_temperature_sensor/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/adc/internal_temperature_sensor/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/adc/internal_temperature_sensor/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/adc/internal_temperature_sensor/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/adc/internal_temperature_sensor/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/adc/internal_temperature_sensor/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/adc/internal_temperature_sensor/src/at32f413_int.c:113
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • adc
  • internal_temperature_sensor
  • src
project/at_start_f413/examples/adc/internal_temperature_sensor/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
38#define ADC_VREF (3.3)
39#define ADC_TEMP_BASE (1.28)
40#define ADC_TEMP_SLOPE (-0.00420)
41
42__IO uint16_t adc1_ordinary_value = 0;
43
49static void dma_config(void)
50{
51 dma_init_type dma_init_struct;
52 crm_periph_clock_enable(CRM_DMA1_PERIPH_CLOCK, TRUE);
53 dma_reset(DMA1_CHANNEL1);
54 dma_default_para_init(&dma_init_struct);
55 dma_init_struct.buffer_size = 1;
56 dma_init_struct.direction = DMA_DIR_PERIPHERAL_TO_MEMORY;
57 dma_init_struct.memory_base_addr = (uint32_t)&adc1_ordinary_value;
58 dma_init_struct.memory_data_width = DMA_MEMORY_DATA_WIDTH_HALFWORD;
59 dma_init_struct.memory_inc_enable = FALSE;
60 dma_init_struct.peripheral_base_addr = (uint32_t)&(ADC1->odt);
61 dma_init_struct.peripheral_data_width = DMA_PERIPHERAL_DATA_WIDTH_HALFWORD;
62 dma_init_struct.peripheral_inc_enable = FALSE;
63 dma_init_struct.priority = DMA_PRIORITY_HIGH;
64 dma_init_struct.loop_mode_enable = TRUE;
65 dma_init(DMA1_CHANNEL1, &dma_init_struct);
66}
67
73static void adc_config(void)
74{
75 adc_base_config_type adc_base_struct;
76 crm_periph_clock_enable(CRM_ADC1_PERIPH_CLOCK, TRUE);
77 adc_reset(ADC1);
78 crm_adc_clock_div_set(CRM_ADC_DIV_6);
79 adc_base_default_para_init(&adc_base_struct);
80
81 /* select combine mode */
82 adc_combine_mode_select(ADC_INDEPENDENT_MODE);
83
84 /* ADC1 config */
85 adc_base_struct.sequence_mode = FALSE;
86 adc_base_struct.repeat_mode = FALSE;
87 adc_base_struct.data_align = ADC_RIGHT_ALIGNMENT;
88 adc_base_struct.ordinary_channel_length = 1;
89 adc_base_config(ADC1, &adc_base_struct);
90 adc_ordinary_channel_set(ADC1, ADC_CHANNEL_16, 1, ADC_SAMPLETIME_239_5);
91 adc_ordinary_conversion_trigger_set(ADC1, ADC12_ORDINARY_TRIG_SOFTWARE, TRUE);
92 adc_dma_mode_enable(ADC1, TRUE);
93 adc_tempersensor_vintrv_enable(TRUE);
94
95 adc_enable(ADC1, TRUE);
96
97 /* ADC calibration */
98 adc_calibration_init(ADC1);
99 while(adc_calibration_init_status_get(ADC1));
100 adc_calibration_start(ADC1);
101 while(adc_calibration_status_get(ADC1));
102}
103
109int main(void)
110{
111 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
112 system_clock_config();
113 at32_board_init();
114 at32_led_off(LED2);
115 at32_led_off(LED3);
116 at32_led_off(LED4);
117 uart_print_init(115200);
118 dma_config();
119 adc_config();
120
121 /* enable DMA after ADC activation */
122 dma_channel_enable(DMA1_CHANNEL1, TRUE);
123
124 printf("internal_temperature_sensor \r\n");
125 while(1)
126 {
127 /* ordinary software start conversion */
128 adc_ordinary_software_trigger_enable(ADC1, TRUE);
129
130 /* wait conversion end */
131 while(dma_flag_get(DMA1_FDT1_FLAG) == RESET)
132 {
133 }
134 dma_flag_clear(DMA1_FDT1_FLAG);
135 printf("internal_temperature = %f deg C\r\n",(ADC_TEMP_BASE - (double)adc1_ordinary_value * ADC_VREF / 4095) / ADC_TEMP_SLOPE + 25);
136 at32_led_on(LED2);
137 delay_sec(1);
138 }
139}
140
141
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
dma_config
static void dma_config(void)
dma configuration.
Definition project/at_start_f413/examples/adc/internal_temperature_sensor/src/main.c:49
adc1_ordinary_value
__IO uint16_t adc1_ordinary_value
Definition project/at_start_f413/examples/adc/internal_temperature_sensor/src/main.c:42
adc_config
static void adc_config(void)
adc configuration.
Definition project/at_start_f413/examples/adc/internal_temperature_sensor/src/main.c:73
ADC_VREF
#define ADC_VREF
Definition project/at_start_f413/examples/adc/internal_temperature_sensor/src/main.c:38
main
int main(void)
main function.
Definition project/at_start_f413/examples/adc/internal_temperature_sensor/src/main.c:109
ADC_TEMP_SLOPE
#define ADC_TEMP_SLOPE
Definition project/at_start_f413/examples/adc/internal_temperature_sensor/src/main.c:40
ADC_TEMP_BASE
#define ADC_TEMP_BASE
Definition project/at_start_f413/examples/adc/internal_temperature_sensor/src/main.c:39
dma_init_struct
dma_init_type dma_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:38
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
adc_ordinary_software_trigger_enable
void adc_ordinary_software_trigger_enable(adc_type *adc_x, confirm_state new_state)
enable or disable ordinary software start conversion of the specified adc peripheral.
Definition at32f413_adc.c:643
adc_base_config
void adc_base_config(adc_type *adc_x, adc_base_config_type *adc_base_struct)
initialize the adc peripheral according to the specified parameters.
Definition at32f413_adc.c:142
adc_tempersensor_vintrv_enable
void adc_tempersensor_vintrv_enable(confirm_state new_state)
enable or disable the temperature sensor and vintrv channel.
Definition at32f413_adc.c:629
adc_enable
void adc_enable(adc_type *adc_x, confirm_state new_state)
enable or disable the specified adc peripheral.
Definition at32f413_adc.c:74
adc_base_default_para_init
void adc_base_default_para_init(adc_base_config_type *adc_base_struct)
adc base default para init.
Definition at32f413_adc.c:116
adc_calibration_start
void adc_calibration_start(adc_type *adc_x)
start calibration process of the specified adc peripheral.
Definition at32f413_adc.c:229
adc_calibration_status_get
flag_status adc_calibration_status_get(adc_type *adc_x)
get calibration status of the specified adc peripheral.
Definition at32f413_adc.c:241
adc_ordinary_conversion_trigger_set
void adc_ordinary_conversion_trigger_set(adc_type *adc_x, adc_ordinary_trig_select_type adc_ordinary_trig, confirm_state new_state)
enable or disable the ordinary channel's external trigger and set external trigger event of the speci...
Definition at32f413_adc.c:480
adc_calibration_init
void adc_calibration_init(adc_type *adc_x)
initialize calibration register of the specified adc peripheral.
Definition at32f413_adc.c:198
adc_calibration_init_status_get
flag_status adc_calibration_init_status_get(adc_type *adc_x)
get calibration register's initialize status of the specified adc peripheral.
Definition at32f413_adc.c:210
adc_dma_mode_enable
void adc_dma_mode_enable(adc_type *adc_x, confirm_state new_state)
enable or disable the adc dma transfer.
Definition at32f413_adc.c:160
adc_combine_mode_select
void adc_combine_mode_select(adc_combine_mode_type combine_mode)
select combine mode of the specified adc peripheral.
Definition at32f413_adc.c:96
adc_reset
void adc_reset(adc_type *adc_x)
deinitialize the adc peripheral registers to their default reset values.
Definition at32f413_adc.c:50
adc_ordinary_channel_set
void adc_ordinary_channel_set(adc_type *adc_x, adc_channel_select_type adc_channel, uint8_t adc_sequence, adc_sampletime_select_type adc_sampletime)
set ordinary channel's corresponding rank in the sequencer and sample time of the specified adc perip...
Definition at32f413_adc.c:342
ADC_RIGHT_ALIGNMENT
@ ADC_RIGHT_ALIGNMENT
Definition at32f413_adc.h:100
ADC_CHANNEL_16
@ ADC_CHANNEL_16
Definition at32f413_adc.h:125
ADC_SAMPLETIME_239_5
@ ADC_SAMPLETIME_239_5
Definition at32f413_adc.h:141
ADC_INDEPENDENT_MODE
@ ADC_INDEPENDENT_MODE
Definition at32f413_adc.h:83
ADC12_ORDINARY_TRIG_SOFTWARE
@ ADC12_ORDINARY_TRIG_SOFTWARE
Definition at32f413_adc.h:157
ADC1
#define ADC1
Definition at32f413_adc.h:558
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
at32_led_off
void at32_led_off(led_type led)
turns selected led off.
Definition at32f413_board.c:287
uart_print_init
void uart_print_init(uint32_t baudrate)
initialize uart
Definition at32f413_board.c:129
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
delay_sec
void delay_sec(uint16_t sec)
inserts a delay time.
Definition at32f413_board.c:382
crm_adc_clock_div_set
void crm_adc_clock_div_set(crm_adc_div_type div_value)
set crm adc division
Definition at32f413_crm.c:514
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_ADC1_PERIPH_CLOCK
@ CRM_ADC1_PERIPH_CLOCK
Definition at32f413_crm.h:114
CRM_DMA1_PERIPH_CLOCK
@ CRM_DMA1_PERIPH_CLOCK
Definition at32f413_crm.h:103
CRM_ADC_DIV_6
@ CRM_ADC_DIV_6
Definition at32f413_crm.h:347
dma_channel_enable
void dma_channel_enable(dma_channel_type *dmax_channely, confirm_state new_state)
enable or disable dma channely
Definition at32f413_dma.c:197
dma_default_para_init
void dma_default_para_init(dma_init_type *dma_init_struct)
dma init config with its default value.
Definition at32f413_dma.c:407
dma_flag_get
flag_status dma_flag_get(uint32_t dmax_flag)
get dma flag
Definition at32f413_dma.c:343
dma_flag_clear
void dma_flag_clear(uint32_t dmax_flag)
clear dma flag
Definition at32f413_dma.c:389
dma_reset
void dma_reset(dma_channel_type *dmax_channely)
reset the dmax channely registers.
Definition at32f413_dma.c:63
dma_init
void dma_init(dma_channel_type *dmax_channely, dma_init_type *dma_init_struct)
dma init
Definition at32f413_dma.c:442
DMA_PERIPHERAL_DATA_WIDTH_HALFWORD
@ DMA_PERIPHERAL_DATA_WIDTH_HALFWORD
Definition at32f413_dma.h:246
DMA_DIR_PERIPHERAL_TO_MEMORY
@ DMA_DIR_PERIPHERAL_TO_MEMORY
Definition at32f413_dma.h:216
DMA_MEMORY_DATA_WIDTH_HALFWORD
@ DMA_MEMORY_DATA_WIDTH_HALFWORD
Definition at32f413_dma.h:256
DMA_PRIORITY_HIGH
@ DMA_PRIORITY_HIGH
Definition at32f413_dma.h:267
DMA1_FDT1_FLAG
#define DMA1_FDT1_FLAG
Definition at32f413_dma.h:81
DMA1_CHANNEL1
#define DMA1_CHANNEL1
Definition at32f413_dma.h:480
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
at32f413_clock.h
header file of clock program
adc_base_config_type
adc base config type
Definition at32f413_adc.h:211
adc_base_config_type::data_align
adc_data_align_type data_align
Definition at32f413_adc.h:214
adc_base_config_type::repeat_mode
confirm_state repeat_mode
Definition at32f413_adc.h:213
adc_base_config_type::sequence_mode
confirm_state sequence_mode
Definition at32f413_adc.h:212
adc_base_config_type::ordinary_channel_length
uint8_t ordinary_channel_length
Definition at32f413_adc.h:215
dma_init_type
dma init type
Definition at32f413_dma.h:275
dma_init_type::loop_mode_enable
confirm_state loop_mode_enable
Definition at32f413_dma.h:284
dma_init_type::buffer_size
uint16_t buffer_size
Definition at32f413_dma.h:279
dma_init_type::memory_data_width
dma_memory_data_size_type memory_data_width
Definition at32f413_dma.h:283
dma_init_type::priority
dma_priority_level_type priority
Definition at32f413_dma.h:285
dma_init_type::peripheral_inc_enable
confirm_state peripheral_inc_enable
Definition at32f413_dma.h:280
dma_init_type::memory_inc_enable
confirm_state memory_inc_enable
Definition at32f413_dma.h:281
dma_init_type::direction
dma_dir_type direction
Definition at32f413_dma.h:278
dma_init_type::peripheral_base_addr
uint32_t peripheral_base_addr
Definition at32f413_dma.h:276
dma_init_type::memory_base_addr
uint32_t memory_base_addr
Definition at32f413_dma.h:277
dma_init_type::peripheral_data_width
dma_peripheral_data_size_type peripheral_data_width
Definition at32f413_dma.h:282


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • adc
  • repeat_conversion_loop_transfer
  • inc
project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • adc
  • repeat_conversion_loop_transfer
  • inc
project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • adc
  • repeat_conversion_loop_transfer
  • inc
project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • adc
  • repeat_conversion_loop_transfer
  • src
project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • adc
  • repeat_conversion_loop_transfer
  • src
project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • adc
  • repeat_conversion_loop_transfer
  • src
project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37__IO uint16_t adc1_ordinary_valuetab[3] = {0};
38__IO uint16_t dma_trans_complete_flag = 0;
39
45static void gpio_config(void)
46{
47 gpio_init_type gpio_initstructure;
48 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
49
50 gpio_default_para_init(&gpio_initstructure);
51 gpio_initstructure.gpio_mode = GPIO_MODE_ANALOG;
52 gpio_initstructure.gpio_pins = GPIO_PINS_4 | GPIO_PINS_5 | GPIO_PINS_6;
53 gpio_init(GPIOA, &gpio_initstructure);
54}
55
61static void dma_config(void)
62{
63 dma_init_type dma_init_struct;
64 crm_periph_clock_enable(CRM_DMA1_PERIPH_CLOCK, TRUE);
65 nvic_irq_enable(DMA1_Channel1_IRQn, 0, 0);
66 dma_reset(DMA1_CHANNEL1);
67 dma_default_para_init(&dma_init_struct);
68 dma_init_struct.buffer_size = 3;
69 dma_init_struct.direction = DMA_DIR_PERIPHERAL_TO_MEMORY;
70 dma_init_struct.memory_base_addr = (uint32_t)adc1_ordinary_valuetab;
71 dma_init_struct.memory_data_width = DMA_MEMORY_DATA_WIDTH_HALFWORD;
72 dma_init_struct.memory_inc_enable = TRUE;
73 dma_init_struct.peripheral_base_addr = (uint32_t)&(ADC1->odt);
74 dma_init_struct.peripheral_data_width = DMA_PERIPHERAL_DATA_WIDTH_HALFWORD;
75 dma_init_struct.peripheral_inc_enable = FALSE;
76 dma_init_struct.priority = DMA_PRIORITY_HIGH;
77 dma_init_struct.loop_mode_enable = TRUE;
78 dma_init(DMA1_CHANNEL1, &dma_init_struct);
79
80 dma_interrupt_enable(DMA1_CHANNEL1, DMA_FDT_INT, TRUE);
81}
82
88static void adc_config(void)
89{
90 adc_base_config_type adc_base_struct;
91 crm_periph_clock_enable(CRM_ADC1_PERIPH_CLOCK, TRUE);
92 adc_reset(ADC1);
93 crm_adc_clock_div_set(CRM_ADC_DIV_6);
94 adc_base_default_para_init(&adc_base_struct);
95
96 /* select combine mode */
97 adc_combine_mode_select(ADC_INDEPENDENT_MODE);
98
99 /* ADC1 config */
100 adc_base_struct.sequence_mode = TRUE;
101 adc_base_struct.repeat_mode = TRUE;
102 adc_base_struct.data_align = ADC_RIGHT_ALIGNMENT;
103 adc_base_struct.ordinary_channel_length = 3;
104 adc_base_config(ADC1, &adc_base_struct);
105 adc_ordinary_channel_set(ADC1, ADC_CHANNEL_4, 1, ADC_SAMPLETIME_239_5);
106 adc_ordinary_channel_set(ADC1, ADC_CHANNEL_5, 2, ADC_SAMPLETIME_239_5);
107 adc_ordinary_channel_set(ADC1, ADC_CHANNEL_6, 3, ADC_SAMPLETIME_239_5);
108 adc_ordinary_conversion_trigger_set(ADC1, ADC12_ORDINARY_TRIG_SOFTWARE, TRUE);
109 adc_dma_mode_enable(ADC1, TRUE);
110
111 adc_enable(ADC1, TRUE);
112
113 /* ADC calibration */
114 adc_calibration_init(ADC1);
115 while(adc_calibration_init_status_get(ADC1));
116 adc_calibration_start(ADC1);
117 while(adc_calibration_status_get(ADC1));
118}
119
125void DMA1_Channel1_IRQHandler(void)
126{
127 if(dma_interrupt_flag_get(DMA1_FDT1_FLAG) != RESET)
128 {
129 dma_flag_clear(DMA1_FDT1_FLAG);
130 dma_trans_complete_flag++;
131 }
132}
133
139int main(void)
140{
141 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
142 system_clock_config();
143 at32_board_init();
144 at32_led_off(LED2);
145 at32_led_off(LED3);
146 at32_led_off(LED4);
147 uart_print_init(115200);
148 gpio_config();
149 dma_config();
150 adc_config();
151
152 /* enable DMA after ADC activation */
153 dma_channel_enable(DMA1_CHANNEL1, TRUE);
154
155 printf("repeat_conversion_loop_transfer \r\n");
156 printf("please_debug_check_data_and_conversion_times \r\n");
157
158 /* ordinary software start conversion */
159 adc_ordinary_software_trigger_enable(ADC1, TRUE);
160 at32_led_on(LED2);
161 while(1)
162 {
163 }
164}
165
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
dma_trans_complete_flag
__IO uint16_t dma_trans_complete_flag
Definition project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/main.c:38
dma_config
static void dma_config(void)
dma configuration.
Definition project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/main.c:61
adc_config
static void adc_config(void)
adc configuration.
Definition project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/main.c:88
DMA1_Channel1_IRQHandler
void DMA1_Channel1_IRQHandler(void)
this function handles dma1_channel1 handler.
Definition project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/main.c:125
main
int main(void)
main function.
Definition project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/main.c:139
adc1_ordinary_valuetab
__IO uint16_t adc1_ordinary_valuetab[3]
Definition project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/main.c:37
gpio_config
static void gpio_config(void)
gpio configuration.
Definition project/at_start_f413/examples/adc/repeat_conversion_loop_transfer/src/main.c:45
dma_init_struct
dma_init_type dma_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:38
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
adc_ordinary_software_trigger_enable
void adc_ordinary_software_trigger_enable(adc_type *adc_x, confirm_state new_state)
enable or disable ordinary software start conversion of the specified adc peripheral.
Definition at32f413_adc.c:643
adc_base_config
void adc_base_config(adc_type *adc_x, adc_base_config_type *adc_base_struct)
initialize the adc peripheral according to the specified parameters.
Definition at32f413_adc.c:142
adc_enable
void adc_enable(adc_type *adc_x, confirm_state new_state)
enable or disable the specified adc peripheral.
Definition at32f413_adc.c:74
adc_base_default_para_init
void adc_base_default_para_init(adc_base_config_type *adc_base_struct)
adc base default para init.
Definition at32f413_adc.c:116
adc_calibration_start
void adc_calibration_start(adc_type *adc_x)
start calibration process of the specified adc peripheral.
Definition at32f413_adc.c:229
adc_calibration_status_get
flag_status adc_calibration_status_get(adc_type *adc_x)
get calibration status of the specified adc peripheral.
Definition at32f413_adc.c:241
adc_ordinary_conversion_trigger_set
void adc_ordinary_conversion_trigger_set(adc_type *adc_x, adc_ordinary_trig_select_type adc_ordinary_trig, confirm_state new_state)
enable or disable the ordinary channel's external trigger and set external trigger event of the speci...
Definition at32f413_adc.c:480
adc_calibration_init
void adc_calibration_init(adc_type *adc_x)
initialize calibration register of the specified adc peripheral.
Definition at32f413_adc.c:198
adc_calibration_init_status_get
flag_status adc_calibration_init_status_get(adc_type *adc_x)
get calibration register's initialize status of the specified adc peripheral.
Definition at32f413_adc.c:210
adc_dma_mode_enable
void adc_dma_mode_enable(adc_type *adc_x, confirm_state new_state)
enable or disable the adc dma transfer.
Definition at32f413_adc.c:160
adc_combine_mode_select
void adc_combine_mode_select(adc_combine_mode_type combine_mode)
select combine mode of the specified adc peripheral.
Definition at32f413_adc.c:96
adc_reset
void adc_reset(adc_type *adc_x)
deinitialize the adc peripheral registers to their default reset values.
Definition at32f413_adc.c:50
adc_ordinary_channel_set
void adc_ordinary_channel_set(adc_type *adc_x, adc_channel_select_type adc_channel, uint8_t adc_sequence, adc_sampletime_select_type adc_sampletime)
set ordinary channel's corresponding rank in the sequencer and sample time of the specified adc perip...
Definition at32f413_adc.c:342
ADC_RIGHT_ALIGNMENT
@ ADC_RIGHT_ALIGNMENT
Definition at32f413_adc.h:100
ADC_CHANNEL_4
@ ADC_CHANNEL_4
Definition at32f413_adc.h:113
ADC_CHANNEL_6
@ ADC_CHANNEL_6
Definition at32f413_adc.h:115
ADC_CHANNEL_5
@ ADC_CHANNEL_5
Definition at32f413_adc.h:114
ADC_SAMPLETIME_239_5
@ ADC_SAMPLETIME_239_5
Definition at32f413_adc.h:141
ADC_INDEPENDENT_MODE
@ ADC_INDEPENDENT_MODE
Definition at32f413_adc.h:83
ADC12_ORDINARY_TRIG_SOFTWARE
@ ADC12_ORDINARY_TRIG_SOFTWARE
Definition at32f413_adc.h:157
ADC1
#define ADC1
Definition at32f413_adc.h:558
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
at32_led_off
void at32_led_off(led_type led)
turns selected led off.
Definition at32f413_board.c:287
uart_print_init
void uart_print_init(uint32_t baudrate)
initialize uart
Definition at32f413_board.c:129
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_adc_clock_div_set
void crm_adc_clock_div_set(crm_adc_div_type div_value)
set crm adc division
Definition at32f413_crm.c:514
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_ADC1_PERIPH_CLOCK
@ CRM_ADC1_PERIPH_CLOCK
Definition at32f413_crm.h:114
CRM_DMA1_PERIPH_CLOCK
@ CRM_DMA1_PERIPH_CLOCK
Definition at32f413_crm.h:103
CRM_ADC_DIV_6
@ CRM_ADC_DIV_6
Definition at32f413_crm.h:347
DMA1_Channel1_IRQn
@ DMA1_Channel1_IRQn
Definition at32f413.h:182
dma_channel_enable
void dma_channel_enable(dma_channel_type *dmax_channely, confirm_state new_state)
enable or disable dma channely
Definition at32f413_dma.c:197
dma_default_para_init
void dma_default_para_init(dma_init_type *dma_init_struct)
dma init config with its default value.
Definition at32f413_dma.c:407
dma_interrupt_flag_get
flag_status dma_interrupt_flag_get(uint32_t dmax_flag)
get dma interrupt flag
Definition at32f413_dma.c:297
dma_interrupt_enable
void dma_interrupt_enable(dma_channel_type *dmax_channely, uint32_t dma_int, confirm_state new_state)
enable or disable dma interrupt
Definition at32f413_dma.c:164
dma_flag_clear
void dma_flag_clear(uint32_t dmax_flag)
clear dma flag
Definition at32f413_dma.c:389
dma_reset
void dma_reset(dma_channel_type *dmax_channely)
reset the dmax channely registers.
Definition at32f413_dma.c:63
dma_init
void dma_init(dma_channel_type *dmax_channely, dma_init_type *dma_init_struct)
dma init
Definition at32f413_dma.c:442
DMA_PERIPHERAL_DATA_WIDTH_HALFWORD
@ DMA_PERIPHERAL_DATA_WIDTH_HALFWORD
Definition at32f413_dma.h:246
DMA_DIR_PERIPHERAL_TO_MEMORY
@ DMA_DIR_PERIPHERAL_TO_MEMORY
Definition at32f413_dma.h:216
DMA_MEMORY_DATA_WIDTH_HALFWORD
@ DMA_MEMORY_DATA_WIDTH_HALFWORD
Definition at32f413_dma.h:256
DMA_PRIORITY_HIGH
@ DMA_PRIORITY_HIGH
Definition at32f413_dma.h:267
DMA1_FDT1_FLAG
#define DMA1_FDT1_FLAG
Definition at32f413_dma.h:81
DMA_FDT_INT
#define DMA_FDT_INT
Definition at32f413_dma.h:51
DMA1_CHANNEL1
#define DMA1_CHANNEL1
Definition at32f413_dma.h:480
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_ANALOG
@ GPIO_MODE_ANALOG
Definition at32f413_gpio.h:216
GPIO_PINS_6
#define GPIO_PINS_6
Definition at32f413_gpio.h:56
GPIO_PINS_4
#define GPIO_PINS_4
Definition at32f413_gpio.h:54
GPIO_PINS_5
#define GPIO_PINS_5
Definition at32f413_gpio.h:55
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
at32f413_clock.h
header file of clock program
adc_base_config_type
adc base config type
Definition at32f413_adc.h:211
adc_base_config_type::data_align
adc_data_align_type data_align
Definition at32f413_adc.h:214
adc_base_config_type::repeat_mode
confirm_state repeat_mode
Definition at32f413_adc.h:213
adc_base_config_type::sequence_mode
confirm_state sequence_mode
Definition at32f413_adc.h:212
adc_base_config_type::ordinary_channel_length
uint8_t ordinary_channel_length
Definition at32f413_adc.h:215
dma_init_type
dma init type
Definition at32f413_dma.h:275
dma_init_type::loop_mode_enable
confirm_state loop_mode_enable
Definition at32f413_dma.h:284
dma_init_type::buffer_size
uint16_t buffer_size
Definition at32f413_dma.h:279
dma_init_type::memory_data_width
dma_memory_data_size_type memory_data_width
Definition at32f413_dma.h:283
dma_init_type::priority
dma_priority_level_type priority
Definition at32f413_dma.h:285
dma_init_type::peripheral_inc_enable
confirm_state peripheral_inc_enable
Definition at32f413_dma.h:280
dma_init_type::memory_inc_enable
confirm_state memory_inc_enable
Definition at32f413_dma.h:281
dma_init_type::direction
dma_dir_type direction
Definition at32f413_dma.h:278
dma_init_type::peripheral_base_addr
uint32_t peripheral_base_addr
Definition at32f413_dma.h:276
dma_init_type::memory_base_addr
uint32_t memory_base_addr
Definition at32f413_dma.h:277
dma_init_type::peripheral_data_width
dma_peripheral_data_size_type peripheral_data_width
Definition at32f413_dma.h:282
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • adc
  • tmr_trigger_automatic_preempted
  • inc
project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • adc
  • tmr_trigger_automatic_preempted
  • inc
project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • adc
  • tmr_trigger_automatic_preempted
  • inc
project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • adc
  • tmr_trigger_automatic_preempted
  • src
project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • adc
  • tmr_trigger_automatic_preempted
  • src
project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • adc
  • tmr_trigger_automatic_preempted
  • src
project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37__IO uint16_t adc1_ordinary_valuetab[3] = {0};
38__IO uint16_t adc1_preempt_valuetab[3] = {0};
39__IO uint16_t dma_trans_complete_flag = 0;
40__IO uint16_t ordinary_conversion_times_index = 0;
41__IO uint16_t preempt_conversion_count = 0;
42__IO uint16_t preempt_conversion_times_index = 0;
43
49static void gpio_config(void)
50{
51 gpio_init_type gpio_initstructure;
52 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
53 crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
54
55 gpio_default_para_init(&gpio_initstructure);
56 gpio_initstructure.gpio_mode = GPIO_MODE_ANALOG;
57 gpio_initstructure.gpio_pins = GPIO_PINS_4 | GPIO_PINS_5 | GPIO_PINS_6 | GPIO_PINS_7;
58 gpio_init(GPIOA, &gpio_initstructure);
59
60 gpio_initstructure.gpio_mode = GPIO_MODE_ANALOG;
61 gpio_initstructure.gpio_pins = GPIO_PINS_0 | GPIO_PINS_1;
62 gpio_init(GPIOB, &gpio_initstructure);
63}
64
70static void dma_config(void)
71{
72 dma_init_type dma_init_struct;
73 crm_periph_clock_enable(CRM_DMA1_PERIPH_CLOCK, TRUE);
74 nvic_irq_enable(DMA1_Channel1_IRQn, 0, 0);
75 dma_reset(DMA1_CHANNEL1);
76 dma_default_para_init(&dma_init_struct);
77 dma_init_struct.buffer_size = 3;
78 dma_init_struct.direction = DMA_DIR_PERIPHERAL_TO_MEMORY;
79 dma_init_struct.memory_base_addr = (uint32_t)adc1_ordinary_valuetab;
80 dma_init_struct.memory_data_width = DMA_MEMORY_DATA_WIDTH_HALFWORD;
81 dma_init_struct.memory_inc_enable = TRUE;
82 dma_init_struct.peripheral_base_addr = (uint32_t)&(ADC1->odt);
83 dma_init_struct.peripheral_data_width = DMA_PERIPHERAL_DATA_WIDTH_HALFWORD;
84 dma_init_struct.peripheral_inc_enable = FALSE;
85 dma_init_struct.priority = DMA_PRIORITY_HIGH;
86 dma_init_struct.loop_mode_enable = TRUE;
87 dma_init(DMA1_CHANNEL1, &dma_init_struct);
88
89 dma_interrupt_enable(DMA1_CHANNEL1, DMA_FDT_INT, TRUE);
90}
91
97static void tmr1_config(void)
98{
99 gpio_init_type gpio_initstructure;
100 tmr_output_config_type tmr_oc_init_structure;
101 crm_clocks_freq_type crm_clocks_freq_struct = {0};
102 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
103
104 gpio_default_para_init(&gpio_initstructure);
105 gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
106 gpio_initstructure.gpio_pins = GPIO_PINS_8;
107 gpio_initstructure.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
108 gpio_initstructure.gpio_pull = GPIO_PULL_NONE;
109 gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
110 gpio_init(GPIOA, &gpio_initstructure);
111
112 /* get system clock */
113 crm_clocks_freq_get(&crm_clocks_freq_struct);
114
115 crm_periph_clock_enable(CRM_TMR1_PERIPH_CLOCK, TRUE);
116
117 /* (systemclock/(systemclock/10000))/10000 = 1Hz(1s) */
118 tmr_base_init(TMR1, 9999, (crm_clocks_freq_struct.sclk_freq/10000 - 1));
119 tmr_cnt_dir_set(TMR1, TMR_COUNT_UP);
120 tmr_clock_source_div_set(TMR1, TMR_CLOCK_DIV1);
121
122 tmr_output_default_para_init(&tmr_oc_init_structure);
123 tmr_oc_init_structure.oc_mode = TMR_OUTPUT_CONTROL_PWM_MODE_A;
124 tmr_oc_init_structure.oc_polarity = TMR_OUTPUT_ACTIVE_LOW;
125 tmr_oc_init_structure.oc_output_state = TRUE;
126 tmr_oc_init_structure.oc_idle_state = FALSE;
127 tmr_output_channel_config(TMR1, TMR_SELECT_CHANNEL_1, &tmr_oc_init_structure);
128 tmr_channel_value_set(TMR1, TMR_SELECT_CHANNEL_1, 5000);
129}
130
136static void adc_config(void)
137{
138 adc_base_config_type adc_base_struct;
139 crm_periph_clock_enable(CRM_ADC1_PERIPH_CLOCK, TRUE);
140 adc_reset(ADC1);
141 nvic_irq_enable(ADC1_2_IRQn, 0, 0);
142 crm_adc_clock_div_set(CRM_ADC_DIV_6);
143 adc_base_default_para_init(&adc_base_struct);
144
145 /* select combine mode */
146 adc_combine_mode_select(ADC_INDEPENDENT_MODE);
147
148 /* ADC1 config */
149 adc_base_struct.sequence_mode = TRUE;
150 adc_base_struct.repeat_mode = FALSE;
151 adc_base_struct.data_align = ADC_RIGHT_ALIGNMENT;
152 adc_base_struct.ordinary_channel_length = 3;
153 adc_base_config(ADC1, &adc_base_struct);
154 adc_ordinary_channel_set(ADC1, ADC_CHANNEL_4, 1, ADC_SAMPLETIME_239_5);
155 adc_ordinary_channel_set(ADC1, ADC_CHANNEL_5, 2, ADC_SAMPLETIME_239_5);
156 adc_ordinary_channel_set(ADC1, ADC_CHANNEL_6, 3, ADC_SAMPLETIME_239_5);
157 adc_ordinary_conversion_trigger_set(ADC1, ADC12_ORDINARY_TRIG_TMR1CH1, TRUE);
158 adc_dma_mode_enable(ADC1, TRUE);
159
160 adc_preempt_channel_length_set(ADC1, 3);
161 adc_preempt_channel_set(ADC1, ADC_CHANNEL_7, 1, ADC_SAMPLETIME_239_5);
162 adc_preempt_channel_set(ADC1, ADC_CHANNEL_8, 2, ADC_SAMPLETIME_239_5);
163 adc_preempt_channel_set(ADC1, ADC_CHANNEL_9, 3, ADC_SAMPLETIME_239_5);
164 adc_preempt_conversion_trigger_set(ADC1, ADC12_PREEMPT_TRIG_SOFTWARE, TRUE);
165 adc_preempt_auto_mode_enable(ADC1, TRUE);
166 adc_interrupt_enable(ADC1, ADC_PCCE_INT, TRUE);
167
168 adc_enable(ADC1, TRUE);
169
170 /* ADC calibration */
171 adc_calibration_init(ADC1);
172 while(adc_calibration_init_status_get(ADC1));
173 adc_calibration_start(ADC1);
174 while(adc_calibration_status_get(ADC1));
175}
176
182void DMA1_Channel1_IRQHandler(void)
183{
184 if(dma_interrupt_flag_get(DMA1_FDT1_FLAG) != RESET)
185 {
186 dma_flag_clear(DMA1_FDT1_FLAG);
187 dma_trans_complete_flag++;
188 }
189}
190
196void ADC1_2_IRQHandler(void)
197{
198 if(adc_interrupt_flag_get(ADC1, ADC_PCCE_FLAG) != RESET)
199 {
200 adc_flag_clear(ADC1, ADC_PCCE_FLAG);
201 adc1_preempt_valuetab[0] = adc_preempt_conversion_data_get(ADC1, ADC_PREEMPT_CHANNEL_1);
202 adc1_preempt_valuetab[1] = adc_preempt_conversion_data_get(ADC1, ADC_PREEMPT_CHANNEL_2);
203 adc1_preempt_valuetab[2] = adc_preempt_conversion_data_get(ADC1, ADC_PREEMPT_CHANNEL_3);
204 preempt_conversion_count++;
205 at32_led_toggle(LED3);
206 }
207}
208
214int main(void)
215{
216 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
217 system_clock_config();
218 at32_board_init();
219 at32_led_off(LED2);
220 at32_led_off(LED3);
221 at32_led_off(LED4);
222 uart_print_init(115200);
223 gpio_config();
224 tmr1_config();
225 dma_config();
226 adc_config();
227
228 /* enable DMA after ADC activation */
229 dma_channel_enable(DMA1_CHANNEL1, TRUE);
230
231 printf("tmr_trigger_automatic_preempted \r\n");
232 tmr_counter_enable(TMR1, TRUE);
233 tmr_channel_enable(TMR1, TMR_SELECT_CHANNEL_1, TRUE);
234 tmr_output_enable(TMR1, TRUE);
235 while(1)
236 {
237 /* wait ordinary conversion end */
238 if(ordinary_conversion_times_index != dma_trans_complete_flag)
239 {
240 ordinary_conversion_times_index = dma_trans_complete_flag;
241 printf("ordinary_conversion_times_index = %d\r\n",ordinary_conversion_times_index);
242 printf("adc1_ordinary_valuetab[0] = 0x%x\r\n", adc1_ordinary_valuetab[0]);
243 printf("adc1_ordinary_valuetab[1] = 0x%x\r\n", adc1_ordinary_valuetab[1]);
244 printf("adc1_ordinary_valuetab[2] = 0x%x\r\n", adc1_ordinary_valuetab[2]);
245 printf("\r\n");
246 at32_led_toggle(LED2);
247 }
248
249 /* wait preempt conversion end */
250 if(preempt_conversion_times_index != preempt_conversion_count)
251 {
252 preempt_conversion_times_index = preempt_conversion_count;
253 printf("preempt_conversion_times_index = %d\r\n",preempt_conversion_times_index);
254 printf("adc1_preempt_valuetab[0] = 0x%x\r\n", adc1_preempt_valuetab[0]);
255 printf("adc1_preempt_valuetab[1] = 0x%x\r\n", adc1_preempt_valuetab[1]);
256 printf("adc1_preempt_valuetab[2] = 0x%x\r\n", adc1_preempt_valuetab[2]);
257 printf("\r\n");
258 at32_led_toggle(LED3);
259 }
260 }
261}
262
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
preempt_conversion_times_index
__IO uint16_t preempt_conversion_times_index
Definition project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c:42
dma_trans_complete_flag
__IO uint16_t dma_trans_complete_flag
Definition project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c:39
dma_config
static void dma_config(void)
dma configuration.
Definition project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c:70
ADC1_2_IRQHandler
void ADC1_2_IRQHandler(void)
this function handles adc1_2 handler.
Definition project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c:196
adc_config
static void adc_config(void)
adc configuration.
Definition project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c:136
adc1_preempt_valuetab
__IO uint16_t adc1_preempt_valuetab[3]
Definition project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c:38
DMA1_Channel1_IRQHandler
void DMA1_Channel1_IRQHandler(void)
this function handles dma1_channel1 handler.
Definition project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c:182
ordinary_conversion_times_index
__IO uint16_t ordinary_conversion_times_index
Definition project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c:40
main
int main(void)
main function.
Definition project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c:214
adc1_ordinary_valuetab
__IO uint16_t adc1_ordinary_valuetab[3]
Definition project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c:37
tmr1_config
static void tmr1_config(void)
tmr1 configuration.
Definition project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c:97
preempt_conversion_count
__IO uint16_t preempt_conversion_count
Definition project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c:41
gpio_config
static void gpio_config(void)
gpio configuration.
Definition project/at_start_f413/examples/adc/tmr_trigger_automatic_preempted/src/main.c:49
crm_clocks_freq_struct
crm_clocks_freq_type crm_clocks_freq_struct
Definition project/at_start_f413/examples/debug/tmr1/src/main.c:38
dma_init_struct
dma_init_type dma_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:38
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
tmr_oc_init_structure
tmr_output_config_type tmr_oc_init_structure
Definition project/at_start_f413/examples/tmr/oc_high/src/main.c:37
adc_base_config
void adc_base_config(adc_type *adc_x, adc_base_config_type *adc_base_struct)
initialize the adc peripheral according to the specified parameters.
Definition at32f413_adc.c:142
adc_preempt_auto_mode_enable
void adc_preempt_auto_mode_enable(adc_type *adc_x, confirm_state new_state)
enable or disable automatic preempt group conversion of the specified adc peripheral.
Definition at32f413_adc.c:617
adc_enable
void adc_enable(adc_type *adc_x, confirm_state new_state)
enable or disable the specified adc peripheral.
Definition at32f413_adc.c:74
adc_preempt_conversion_data_get
uint16_t adc_preempt_conversion_data_get(adc_type *adc_x, adc_preempt_channel_type adc_preempt_channel)
return the conversion data for selection preempt channel of the specified adc peripheral.
Definition at32f413_adc.c:734
adc_flag_clear
void adc_flag_clear(adc_type *adc_x, uint32_t adc_flag)
clear flag of the specified adc peripheral.
Definition at32f413_adc.c:841
adc_interrupt_enable
void adc_interrupt_enable(adc_type *adc_x, uint32_t adc_int, confirm_state new_state)
enable or disable the specified adc interrupts.
Definition at32f413_adc.c:179
adc_base_default_para_init
void adc_base_default_para_init(adc_base_config_type *adc_base_struct)
adc base default para init.
Definition at32f413_adc.c:116
adc_calibration_start
void adc_calibration_start(adc_type *adc_x)
start calibration process of the specified adc peripheral.
Definition at32f413_adc.c:229
adc_calibration_status_get
flag_status adc_calibration_status_get(adc_type *adc_x)
get calibration status of the specified adc peripheral.
Definition at32f413_adc.c:241
adc_interrupt_flag_get
flag_status adc_interrupt_flag_get(adc_type *adc_x, uint8_t adc_flag)
get interrupt flag of the specified adc peripheral.
Definition at32f413_adc.c:798
adc_ordinary_conversion_trigger_set
void adc_ordinary_conversion_trigger_set(adc_type *adc_x, adc_ordinary_trig_select_type adc_ordinary_trig, confirm_state new_state)
enable or disable the ordinary channel's external trigger and set external trigger event of the speci...
Definition at32f413_adc.c:480
adc_preempt_conversion_trigger_set
void adc_preempt_conversion_trigger_set(adc_type *adc_x, adc_preempt_trig_select_type adc_preempt_trig, confirm_state new_state)
enable or disable the preempt channel's external trigger and set external trigger event of the specif...
Definition at32f413_adc.c:511
adc_calibration_init
void adc_calibration_init(adc_type *adc_x)
initialize calibration register of the specified adc peripheral.
Definition at32f413_adc.c:198
adc_preempt_channel_set
void adc_preempt_channel_set(adc_type *adc_x, adc_channel_select_type adc_channel, uint8_t adc_sequence, adc_sampletime_select_type adc_sampletime)
configure preempt channel's corresponding rank in the sequencer and sample time of the specified adc ...
Definition at32f413_adc.c:425
adc_calibration_init_status_get
flag_status adc_calibration_init_status_get(adc_type *adc_x)
get calibration register's initialize status of the specified adc peripheral.
Definition at32f413_adc.c:210
adc_dma_mode_enable
void adc_dma_mode_enable(adc_type *adc_x, confirm_state new_state)
enable or disable the adc dma transfer.
Definition at32f413_adc.c:160
adc_combine_mode_select
void adc_combine_mode_select(adc_combine_mode_type combine_mode)
select combine mode of the specified adc peripheral.
Definition at32f413_adc.c:96
adc_preempt_channel_length_set
void adc_preempt_channel_length_set(adc_type *adc_x, uint8_t adc_channel_lenght)
set preempt channel lenghth of the specified adc peripheral.
Definition at32f413_adc.c:393
adc_reset
void adc_reset(adc_type *adc_x)
deinitialize the adc peripheral registers to their default reset values.
Definition at32f413_adc.c:50
adc_ordinary_channel_set
void adc_ordinary_channel_set(adc_type *adc_x, adc_channel_select_type adc_channel, uint8_t adc_sequence, adc_sampletime_select_type adc_sampletime)
set ordinary channel's corresponding rank in the sequencer and sample time of the specified adc perip...
Definition at32f413_adc.c:342
ADC_RIGHT_ALIGNMENT
@ ADC_RIGHT_ALIGNMENT
Definition at32f413_adc.h:100
ADC_CHANNEL_9
@ ADC_CHANNEL_9
Definition at32f413_adc.h:118
ADC_CHANNEL_8
@ ADC_CHANNEL_8
Definition at32f413_adc.h:117
ADC_CHANNEL_4
@ ADC_CHANNEL_4
Definition at32f413_adc.h:113
ADC_CHANNEL_6
@ ADC_CHANNEL_6
Definition at32f413_adc.h:115
ADC_CHANNEL_7
@ ADC_CHANNEL_7
Definition at32f413_adc.h:116
ADC_CHANNEL_5
@ ADC_CHANNEL_5
Definition at32f413_adc.h:114
ADC_SAMPLETIME_239_5
@ ADC_SAMPLETIME_239_5
Definition at32f413_adc.h:141
ADC12_PREEMPT_TRIG_SOFTWARE
@ ADC12_PREEMPT_TRIG_SOFTWARE
Definition at32f413_adc.h:176
ADC_INDEPENDENT_MODE
@ ADC_INDEPENDENT_MODE
Definition at32f413_adc.h:83
ADC12_ORDINARY_TRIG_TMR1CH1
@ ADC12_ORDINARY_TRIG_TMR1CH1
Definition at32f413_adc.h:150
ADC_PREEMPT_CHANNEL_3
@ ADC_PREEMPT_CHANNEL_3
Definition at32f413_adc.h:189
ADC_PREEMPT_CHANNEL_2
@ ADC_PREEMPT_CHANNEL_2
Definition at32f413_adc.h:188
ADC_PREEMPT_CHANNEL_1
@ ADC_PREEMPT_CHANNEL_1
Definition at32f413_adc.h:187
ADC_PCCE_FLAG
#define ADC_PCCE_FLAG
Definition at32f413_adc.h:66
ADC_PCCE_INT
#define ADC_PCCE_INT
Definition at32f413_adc.h:53
ADC1
#define ADC1
Definition at32f413_adc.h:558
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
at32_led_off
void at32_led_off(led_type led)
turns selected led off.
Definition at32f413_board.c:287
uart_print_init
void uart_print_init(uint32_t baudrate)
initialize uart
Definition at32f413_board.c:129
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_adc_clock_div_set
void crm_adc_clock_div_set(crm_adc_div_type div_value)
set crm adc division
Definition at32f413_crm.c:514
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_clocks_freq_get
void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
Definition at32f413_crm.c:660
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_ADC1_PERIPH_CLOCK
@ CRM_ADC1_PERIPH_CLOCK
Definition at32f413_crm.h:114
CRM_GPIOB_PERIPH_CLOCK
@ CRM_GPIOB_PERIPH_CLOCK
Definition at32f413_crm.h:110
CRM_DMA1_PERIPH_CLOCK
@ CRM_DMA1_PERIPH_CLOCK
Definition at32f413_crm.h:103
CRM_TMR1_PERIPH_CLOCK
@ CRM_TMR1_PERIPH_CLOCK
Definition at32f413_crm.h:116
CRM_ADC_DIV_6
@ CRM_ADC_DIV_6
Definition at32f413_crm.h:347
ADC1_2_IRQn
@ ADC1_2_IRQn
Definition at32f413.h:190
DMA1_Channel1_IRQn
@ DMA1_Channel1_IRQn
Definition at32f413.h:182
dma_channel_enable
void dma_channel_enable(dma_channel_type *dmax_channely, confirm_state new_state)
enable or disable dma channely
Definition at32f413_dma.c:197
dma_default_para_init
void dma_default_para_init(dma_init_type *dma_init_struct)
dma init config with its default value.
Definition at32f413_dma.c:407
dma_interrupt_flag_get
flag_status dma_interrupt_flag_get(uint32_t dmax_flag)
get dma interrupt flag
Definition at32f413_dma.c:297
dma_interrupt_enable
void dma_interrupt_enable(dma_channel_type *dmax_channely, uint32_t dma_int, confirm_state new_state)
enable or disable dma interrupt
Definition at32f413_dma.c:164
dma_flag_clear
void dma_flag_clear(uint32_t dmax_flag)
clear dma flag
Definition at32f413_dma.c:389
dma_reset
void dma_reset(dma_channel_type *dmax_channely)
reset the dmax channely registers.
Definition at32f413_dma.c:63
dma_init
void dma_init(dma_channel_type *dmax_channely, dma_init_type *dma_init_struct)
dma init
Definition at32f413_dma.c:442
DMA_PERIPHERAL_DATA_WIDTH_HALFWORD
@ DMA_PERIPHERAL_DATA_WIDTH_HALFWORD
Definition at32f413_dma.h:246
DMA_DIR_PERIPHERAL_TO_MEMORY
@ DMA_DIR_PERIPHERAL_TO_MEMORY
Definition at32f413_dma.h:216
DMA_MEMORY_DATA_WIDTH_HALFWORD
@ DMA_MEMORY_DATA_WIDTH_HALFWORD
Definition at32f413_dma.h:256
DMA_PRIORITY_HIGH
@ DMA_PRIORITY_HIGH
Definition at32f413_dma.h:267
DMA1_FDT1_FLAG
#define DMA1_FDT1_FLAG
Definition at32f413_dma.h:81
DMA_FDT_INT
#define DMA_FDT_INT
Definition at32f413_dma.h:51
DMA1_CHANNEL1
#define DMA1_CHANNEL1
Definition at32f413_dma.h:480
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_MODE_ANALOG
@ GPIO_MODE_ANALOG
Definition at32f413_gpio.h:216
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_6
#define GPIO_PINS_6
Definition at32f413_gpio.h:56
GPIO_PINS_0
#define GPIO_PINS_0
Definition at32f413_gpio.h:50
GPIO_PINS_7
#define GPIO_PINS_7
Definition at32f413_gpio.h:57
GPIO_PINS_4
#define GPIO_PINS_4
Definition at32f413_gpio.h:54
GPIO_PINS_8
#define GPIO_PINS_8
Definition at32f413_gpio.h:58
GPIO_PINS_1
#define GPIO_PINS_1
Definition at32f413_gpio.h:51
GPIO_PINS_5
#define GPIO_PINS_5
Definition at32f413_gpio.h:55
GPIOB
#define GPIOB
Definition at32f413_gpio.h:748
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
tmr_counter_enable
void tmr_counter_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr counter
Definition at32f413_tmr.c:114
tmr_output_channel_config
void tmr_output_channel_config(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_output_config_type *tmr_output_struct)
config tmr output channel
Definition at32f413_tmr.c:318
tmr_clock_source_div_set
void tmr_clock_source_div_set(tmr_type *tmr_x, tmr_clock_division_type tmr_clock_div)
set tmr clock source division
Definition at32f413_tmr.c:204
tmr_output_default_para_init
void tmr_output_default_para_init(tmr_output_config_type *tmr_output_struct)
init tmr output default para
Definition at32f413_tmr.c:126
tmr_output_enable
void tmr_output_enable(tmr_type *tmr_x, confirm_state new_state)
tmr output enable(oen),this function is important for advtm output enable
Definition at32f413_tmr.c:1469
tmr_base_init
void tmr_base_init(tmr_type *tmr_x, uint32_t tmr_pr, uint32_t tmr_div)
init tmr base
Definition at32f413_tmr.c:179
tmr_cnt_dir_set
void tmr_cnt_dir_set(tmr_type *tmr_x, tmr_count_mode_type tmr_cnt_dir)
set tmr counter count direction
Definition at32f413_tmr.c:225
tmr_channel_enable
void tmr_channel_enable(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, confirm_state new_state)
tmr channel enable
Definition at32f413_tmr.c:888
tmr_channel_value_set
void tmr_channel_value_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, uint32_t tmr_channel_value)
set tmr channel value
Definition at32f413_tmr.c:506
TMR_COUNT_UP
@ TMR_COUNT_UP
Definition at32f413_tmr.h:105
TMR_SELECT_CHANNEL_1
@ TMR_SELECT_CHANNEL_1
Definition at32f413_tmr.h:215
TMR_CLOCK_DIV1
@ TMR_CLOCK_DIV1
Definition at32f413_tmr.h:95
TMR_OUTPUT_CONTROL_PWM_MODE_A
@ TMR_OUTPUT_CONTROL_PWM_MODE_A
Definition at32f413_tmr.h:178
TMR_OUTPUT_ACTIVE_LOW
@ TMR_OUTPUT_ACTIVE_LOW
Definition at32f413_tmr.h:197
TMR1
#define TMR1
Definition at32f413_tmr.h:831
at32f413_clock.h
header file of clock program
adc_base_config_type
adc base config type
Definition at32f413_adc.h:211
adc_base_config_type::data_align
adc_data_align_type data_align
Definition at32f413_adc.h:214
adc_base_config_type::repeat_mode
confirm_state repeat_mode
Definition at32f413_adc.h:213
adc_base_config_type::sequence_mode
confirm_state sequence_mode
Definition at32f413_adc.h:212
adc_base_config_type::ordinary_channel_length
uint8_t ordinary_channel_length
Definition at32f413_adc.h:215
crm_clocks_freq_type
crm clocks freqency structure
Definition at32f413_crm.h:470
crm_clocks_freq_type::sclk_freq
uint32_t sclk_freq
Definition at32f413_crm.h:471
dma_init_type
dma init type
Definition at32f413_dma.h:275
dma_init_type::loop_mode_enable
confirm_state loop_mode_enable
Definition at32f413_dma.h:284
dma_init_type::buffer_size
uint16_t buffer_size
Definition at32f413_dma.h:279
dma_init_type::memory_data_width
dma_memory_data_size_type memory_data_width
Definition at32f413_dma.h:283
dma_init_type::priority
dma_priority_level_type priority
Definition at32f413_dma.h:285
dma_init_type::peripheral_inc_enable
confirm_state peripheral_inc_enable
Definition at32f413_dma.h:280
dma_init_type::memory_inc_enable
confirm_state memory_inc_enable
Definition at32f413_dma.h:281
dma_init_type::direction
dma_dir_type direction
Definition at32f413_dma.h:278
dma_init_type::peripheral_base_addr
uint32_t peripheral_base_addr
Definition at32f413_dma.h:276
dma_init_type::memory_base_addr
uint32_t memory_base_addr
Definition at32f413_dma.h:277
dma_init_type::peripheral_data_width
dma_peripheral_data_size_type peripheral_data_width
Definition at32f413_dma.h:282
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
tmr_output_config_type
tmr output config type
Definition at32f413_tmr.h:397
tmr_output_config_type::oc_idle_state
confirm_state oc_idle_state
Definition at32f413_tmr.h:399
tmr_output_config_type::oc_output_state
confirm_state oc_output_state
Definition at32f413_tmr.h:403
tmr_output_config_type::oc_mode
tmr_output_control_mode_type oc_mode
Definition at32f413_tmr.h:398
tmr_output_config_type::oc_polarity
tmr_output_polarity_type oc_polarity
Definition at32f413_tmr.h:401


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • adc
  • voltage_monitoring
  • inc
project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • adc
  • voltage_monitoring
  • inc
project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • adc
  • voltage_monitoring
  • inc
project/at_start_f413/examples/adc/voltage_monitoring/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • adc
  • voltage_monitoring
  • src
project/at_start_f413/examples/adc/voltage_monitoring/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/adc/voltage_monitoring/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • adc
  • voltage_monitoring
  • src
project/at_start_f413/examples/adc/voltage_monitoring/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
43void NMI_Handler(void)
44{
45}
46
52void HardFault_Handler(void)
53{
54 /* go to infinite loop when hard fault exception occurs */
55 while(1)
56 {
57 }
58}
59
65void MemManage_Handler(void)
66{
67 /* go to infinite loop when memory manage exception occurs */
68 while(1)
69 {
70 }
71}
72
78void BusFault_Handler(void)
79{
80 /* go to infinite loop when bus fault exception occurs */
81 while(1)
82 {
83 }
84}
85
91void UsageFault_Handler(void)
92{
93 /* go to infinite loop when usage fault exception occurs */
94 while(1)
95 {
96 }
97}
98
104void SVC_Handler(void)
105{
106}
107
113void DebugMon_Handler(void)
114{
115}
116
122void PendSV_Handler(void)
123{
124}
125
131void SysTick_Handler(void)
132{
133}
134
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/adc/voltage_monitoring/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/adc/voltage_monitoring/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/adc/voltage_monitoring/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/adc/voltage_monitoring/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/adc/voltage_monitoring/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/adc/voltage_monitoring/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/adc/voltage_monitoring/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/adc/voltage_monitoring/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/adc/voltage_monitoring/src/at32f413_int.c:113
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • adc
  • voltage_monitoring
  • src
project/at_start_f413/examples/adc/voltage_monitoring/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37__IO uint16_t adc1_ordinary_valuetab[3] = {0};
38__IO uint16_t vmor_flag_index = 0;
39__IO uint16_t error_times_index = 0;
40
46static void gpio_config(void)
47{
48 gpio_init_type gpio_initstructure;
49 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
50
51 gpio_default_para_init(&gpio_initstructure);
52 gpio_initstructure.gpio_mode = GPIO_MODE_ANALOG;
53 gpio_initstructure.gpio_pins = GPIO_PINS_4 | GPIO_PINS_5 | GPIO_PINS_6;
54 gpio_init(GPIOA, &gpio_initstructure);
55}
56
62static void dma_config(void)
63{
64 dma_init_type dma_init_struct;
65 crm_periph_clock_enable(CRM_DMA1_PERIPH_CLOCK, TRUE);
66 dma_reset(DMA1_CHANNEL1);
67 dma_default_para_init(&dma_init_struct);
68 dma_init_struct.buffer_size = 3;
69 dma_init_struct.direction = DMA_DIR_PERIPHERAL_TO_MEMORY;
70 dma_init_struct.memory_base_addr = (uint32_t)adc1_ordinary_valuetab;
71 dma_init_struct.memory_data_width = DMA_MEMORY_DATA_WIDTH_HALFWORD;
72 dma_init_struct.memory_inc_enable = TRUE;
73 dma_init_struct.peripheral_base_addr = (uint32_t)&(ADC1->odt);
74 dma_init_struct.peripheral_data_width = DMA_PERIPHERAL_DATA_WIDTH_HALFWORD;
75 dma_init_struct.peripheral_inc_enable = FALSE;
76 dma_init_struct.priority = DMA_PRIORITY_HIGH;
77 dma_init_struct.loop_mode_enable = TRUE;
78 dma_init(DMA1_CHANNEL1, &dma_init_struct);
79}
80
86static void adc_config(void)
87{
88 adc_base_config_type adc_base_struct;
89 crm_periph_clock_enable(CRM_ADC1_PERIPH_CLOCK, TRUE);
90 adc_reset(ADC1);
91 nvic_irq_enable(ADC1_2_IRQn, 0, 0);
92 crm_adc_clock_div_set(CRM_ADC_DIV_6);
93 adc_base_default_para_init(&adc_base_struct);
94
95 /* select combine mode */
96 adc_combine_mode_select(ADC_INDEPENDENT_MODE);
97
98 /* ADC1 config */
99 adc_base_struct.sequence_mode = TRUE;
100 adc_base_struct.repeat_mode = FALSE;
101 adc_base_struct.data_align = ADC_RIGHT_ALIGNMENT;
102 adc_base_struct.ordinary_channel_length = 3;
103 adc_base_config(ADC1, &adc_base_struct);
104 adc_ordinary_channel_set(ADC1, ADC_CHANNEL_4, 1, ADC_SAMPLETIME_239_5);
105 adc_ordinary_channel_set(ADC1, ADC_CHANNEL_5, 2, ADC_SAMPLETIME_239_5);
106 adc_ordinary_channel_set(ADC1, ADC_CHANNEL_6, 3, ADC_SAMPLETIME_239_5);
107 adc_ordinary_conversion_trigger_set(ADC1, ADC12_ORDINARY_TRIG_SOFTWARE, TRUE);
108 adc_dma_mode_enable(ADC1, TRUE);
109 adc_voltage_monitor_enable(ADC1, ADC_VMONITOR_SINGLE_ORDINARY);
110 adc_voltage_monitor_threshold_value_set(ADC1, 0xBBB, 0xAAA);
111 adc_voltage_monitor_single_channel_select(ADC1, ADC_CHANNEL_5);
112 adc_interrupt_enable(ADC1, ADC_VMOR_INT, TRUE);
113
114 adc_enable(ADC1, TRUE);
115
116 /* ADC calibration */
117 adc_calibration_init(ADC1);
118 while(adc_calibration_init_status_get(ADC1));
119 adc_calibration_start(ADC1);
120 while(adc_calibration_status_get(ADC1));
121}
122
128void ADC1_2_IRQHandler(void)
129{
130 if(adc_interrupt_flag_get(ADC1, ADC_VMOR_FLAG) != RESET)
131 {
132 at32_led_toggle(LED3);
133 adc_flag_clear(ADC1, ADC_VMOR_FLAG);
134 vmor_flag_index++;
135 }
136}
137
143int main(void)
144{
145 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
146 system_clock_config();
147 at32_board_init();
148 at32_led_off(LED2);
149 at32_led_off(LED3);
150 at32_led_off(LED4);
151 uart_print_init(115200);
152 gpio_config();
153 dma_config();
154 adc_config();
155
156 /* enable DMA after ADC activation */
157 dma_channel_enable(DMA1_CHANNEL1, TRUE);
158
159 printf("voltage_monitoring \r\n");
160 while(1)
161 {
162 at32_led_toggle(LED2);
163 delay_sec(1);
164 if(error_times_index != vmor_flag_index)
165 {
166 error_times_index = vmor_flag_index;
167 printf("error_times_index = %d\r\n",error_times_index);
168 printf("out of range:adc1_channel_5 value is = %x!\r\n", adc1_ordinary_valuetab[1]);
169 }
170 adc_ordinary_software_trigger_enable(ADC1, TRUE);
171 }
172}
173
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
dma_config
static void dma_config(void)
dma configuration.
Definition project/at_start_f413/examples/adc/voltage_monitoring/src/main.c:62
ADC1_2_IRQHandler
void ADC1_2_IRQHandler(void)
this function handles adc1_2 handler.
Definition project/at_start_f413/examples/adc/voltage_monitoring/src/main.c:128
adc_config
static void adc_config(void)
adc configuration.
Definition project/at_start_f413/examples/adc/voltage_monitoring/src/main.c:86
main
int main(void)
main function.
Definition project/at_start_f413/examples/adc/voltage_monitoring/src/main.c:143
adc1_ordinary_valuetab
__IO uint16_t adc1_ordinary_valuetab[3]
Definition project/at_start_f413/examples/adc/voltage_monitoring/src/main.c:37
error_times_index
__IO uint16_t error_times_index
Definition project/at_start_f413/examples/adc/voltage_monitoring/src/main.c:39
vmor_flag_index
__IO uint16_t vmor_flag_index
Definition project/at_start_f413/examples/adc/voltage_monitoring/src/main.c:38
gpio_config
static void gpio_config(void)
gpio configuration.
Definition project/at_start_f413/examples/adc/voltage_monitoring/src/main.c:46
dma_init_struct
dma_init_type dma_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:38
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
adc_ordinary_software_trigger_enable
void adc_ordinary_software_trigger_enable(adc_type *adc_x, confirm_state new_state)
enable or disable ordinary software start conversion of the specified adc peripheral.
Definition at32f413_adc.c:643
adc_voltage_monitor_enable
void adc_voltage_monitor_enable(adc_type *adc_x, adc_voltage_monitoring_type adc_voltage_monitoring)
enable or disable the voltage monitoring on single/all ordinary or preempt channels of the specified ...
Definition at32f413_adc.c:269
adc_voltage_monitor_single_channel_select
void adc_voltage_monitor_single_channel_select(adc_type *adc_x, adc_channel_select_type adc_channel)
select the voltage monitoring's channel of the specified adc peripheral.
Definition at32f413_adc.c:310
adc_base_config
void adc_base_config(adc_type *adc_x, adc_base_config_type *adc_base_struct)
initialize the adc peripheral according to the specified parameters.
Definition at32f413_adc.c:142
adc_enable
void adc_enable(adc_type *adc_x, confirm_state new_state)
enable or disable the specified adc peripheral.
Definition at32f413_adc.c:74
adc_flag_clear
void adc_flag_clear(adc_type *adc_x, uint32_t adc_flag)
clear flag of the specified adc peripheral.
Definition at32f413_adc.c:841
adc_interrupt_enable
void adc_interrupt_enable(adc_type *adc_x, uint32_t adc_int, confirm_state new_state)
enable or disable the specified adc interrupts.
Definition at32f413_adc.c:179
adc_base_default_para_init
void adc_base_default_para_init(adc_base_config_type *adc_base_struct)
adc base default para init.
Definition at32f413_adc.c:116
adc_calibration_start
void adc_calibration_start(adc_type *adc_x)
start calibration process of the specified adc peripheral.
Definition at32f413_adc.c:229
adc_calibration_status_get
flag_status adc_calibration_status_get(adc_type *adc_x)
get calibration status of the specified adc peripheral.
Definition at32f413_adc.c:241
adc_interrupt_flag_get
flag_status adc_interrupt_flag_get(adc_type *adc_x, uint8_t adc_flag)
get interrupt flag of the specified adc peripheral.
Definition at32f413_adc.c:798
adc_voltage_monitor_threshold_value_set
void adc_voltage_monitor_threshold_value_set(adc_type *adc_x, uint16_t adc_high_threshold, uint16_t adc_low_threshold)
set voltage monitoring's high and low thresholds value of the specified adc peripheral.
Definition at32f413_adc.c:290
adc_ordinary_conversion_trigger_set
void adc_ordinary_conversion_trigger_set(adc_type *adc_x, adc_ordinary_trig_select_type adc_ordinary_trig, confirm_state new_state)
enable or disable the ordinary channel's external trigger and set external trigger event of the speci...
Definition at32f413_adc.c:480
adc_calibration_init
void adc_calibration_init(adc_type *adc_x)
initialize calibration register of the specified adc peripheral.
Definition at32f413_adc.c:198
adc_calibration_init_status_get
flag_status adc_calibration_init_status_get(adc_type *adc_x)
get calibration register's initialize status of the specified adc peripheral.
Definition at32f413_adc.c:210
adc_dma_mode_enable
void adc_dma_mode_enable(adc_type *adc_x, confirm_state new_state)
enable or disable the adc dma transfer.
Definition at32f413_adc.c:160
adc_combine_mode_select
void adc_combine_mode_select(adc_combine_mode_type combine_mode)
select combine mode of the specified adc peripheral.
Definition at32f413_adc.c:96
adc_reset
void adc_reset(adc_type *adc_x)
deinitialize the adc peripheral registers to their default reset values.
Definition at32f413_adc.c:50
adc_ordinary_channel_set
void adc_ordinary_channel_set(adc_type *adc_x, adc_channel_select_type adc_channel, uint8_t adc_sequence, adc_sampletime_select_type adc_sampletime)
set ordinary channel's corresponding rank in the sequencer and sample time of the specified adc perip...
Definition at32f413_adc.c:342
ADC_VMONITOR_SINGLE_ORDINARY
@ ADC_VMONITOR_SINGLE_ORDINARY
Definition at32f413_adc.h:198
ADC_RIGHT_ALIGNMENT
@ ADC_RIGHT_ALIGNMENT
Definition at32f413_adc.h:100
ADC_CHANNEL_4
@ ADC_CHANNEL_4
Definition at32f413_adc.h:113
ADC_CHANNEL_6
@ ADC_CHANNEL_6
Definition at32f413_adc.h:115
ADC_CHANNEL_5
@ ADC_CHANNEL_5
Definition at32f413_adc.h:114
ADC_SAMPLETIME_239_5
@ ADC_SAMPLETIME_239_5
Definition at32f413_adc.h:141
ADC_INDEPENDENT_MODE
@ ADC_INDEPENDENT_MODE
Definition at32f413_adc.h:83
ADC12_ORDINARY_TRIG_SOFTWARE
@ ADC12_ORDINARY_TRIG_SOFTWARE
Definition at32f413_adc.h:157
ADC_VMOR_FLAG
#define ADC_VMOR_FLAG
Definition at32f413_adc.h:64
ADC_VMOR_INT
#define ADC_VMOR_INT
Definition at32f413_adc.h:52
ADC1
#define ADC1
Definition at32f413_adc.h:558
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
at32_led_off
void at32_led_off(led_type led)
turns selected led off.
Definition at32f413_board.c:287
uart_print_init
void uart_print_init(uint32_t baudrate)
initialize uart
Definition at32f413_board.c:129
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
delay_sec
void delay_sec(uint16_t sec)
inserts a delay time.
Definition at32f413_board.c:382
crm_adc_clock_div_set
void crm_adc_clock_div_set(crm_adc_div_type div_value)
set crm adc division
Definition at32f413_crm.c:514
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_ADC1_PERIPH_CLOCK
@ CRM_ADC1_PERIPH_CLOCK
Definition at32f413_crm.h:114
CRM_DMA1_PERIPH_CLOCK
@ CRM_DMA1_PERIPH_CLOCK
Definition at32f413_crm.h:103
CRM_ADC_DIV_6
@ CRM_ADC_DIV_6
Definition at32f413_crm.h:347
ADC1_2_IRQn
@ ADC1_2_IRQn
Definition at32f413.h:190
dma_channel_enable
void dma_channel_enable(dma_channel_type *dmax_channely, confirm_state new_state)
enable or disable dma channely
Definition at32f413_dma.c:197
dma_default_para_init
void dma_default_para_init(dma_init_type *dma_init_struct)
dma init config with its default value.
Definition at32f413_dma.c:407
dma_reset
void dma_reset(dma_channel_type *dmax_channely)
reset the dmax channely registers.
Definition at32f413_dma.c:63
dma_init
void dma_init(dma_channel_type *dmax_channely, dma_init_type *dma_init_struct)
dma init
Definition at32f413_dma.c:442
DMA_PERIPHERAL_DATA_WIDTH_HALFWORD
@ DMA_PERIPHERAL_DATA_WIDTH_HALFWORD
Definition at32f413_dma.h:246
DMA_DIR_PERIPHERAL_TO_MEMORY
@ DMA_DIR_PERIPHERAL_TO_MEMORY
Definition at32f413_dma.h:216
DMA_MEMORY_DATA_WIDTH_HALFWORD
@ DMA_MEMORY_DATA_WIDTH_HALFWORD
Definition at32f413_dma.h:256
DMA_PRIORITY_HIGH
@ DMA_PRIORITY_HIGH
Definition at32f413_dma.h:267
DMA1_CHANNEL1
#define DMA1_CHANNEL1
Definition at32f413_dma.h:480
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_ANALOG
@ GPIO_MODE_ANALOG
Definition at32f413_gpio.h:216
GPIO_PINS_6
#define GPIO_PINS_6
Definition at32f413_gpio.h:56
GPIO_PINS_4
#define GPIO_PINS_4
Definition at32f413_gpio.h:54
GPIO_PINS_5
#define GPIO_PINS_5
Definition at32f413_gpio.h:55
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
at32f413_clock.h
header file of clock program
adc_base_config_type
adc base config type
Definition at32f413_adc.h:211
adc_base_config_type::data_align
adc_data_align_type data_align
Definition at32f413_adc.h:214
adc_base_config_type::repeat_mode
confirm_state repeat_mode
Definition at32f413_adc.h:213
adc_base_config_type::sequence_mode
confirm_state sequence_mode
Definition at32f413_adc.h:212
adc_base_config_type::ordinary_channel_length
uint8_t ordinary_channel_length
Definition at32f413_adc.h:215
dma_init_type
dma init type
Definition at32f413_dma.h:275
dma_init_type::loop_mode_enable
confirm_state loop_mode_enable
Definition at32f413_dma.h:284
dma_init_type::buffer_size
uint16_t buffer_size
Definition at32f413_dma.h:279
dma_init_type::memory_data_width
dma_memory_data_size_type memory_data_width
Definition at32f413_dma.h:283
dma_init_type::priority
dma_priority_level_type priority
Definition at32f413_dma.h:285
dma_init_type::peripheral_inc_enable
confirm_state peripheral_inc_enable
Definition at32f413_dma.h:280
dma_init_type::memory_inc_enable
confirm_state memory_inc_enable
Definition at32f413_dma.h:281
dma_init_type::direction
dma_dir_type direction
Definition at32f413_dma.h:278
dma_init_type::peripheral_base_addr
uint32_t peripheral_base_addr
Definition at32f413_dma.h:276
dma_init_type::memory_base_addr
uint32_t memory_base_addr
Definition at32f413_dma.h:277
dma_init_type::peripheral_data_width
dma_peripheral_data_size_type peripheral_data_width
Definition at32f413_dma.h:282
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • bpr
  • bpr_data
  • inc
project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • bpr
  • bpr_data
  • inc
project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • bpr
  • bpr_data
  • inc
project/at_start_f413/examples/bpr/bpr_data/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • bpr
  • bpr_data
  • src
project/at_start_f413/examples/bpr/bpr_data/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/bpr/bpr_data/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • bpr
  • bpr_data
  • src
project/at_start_f413/examples/bpr/bpr_data/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
29
43void NMI_Handler(void)
44{
45}
46
52void HardFault_Handler(void)
53{
54 /* go to infinite loop when hard fault exception occurs */
55 while(1)
56 {
57 }
58}
59
65void MemManage_Handler(void)
66{
67 /* go to infinite loop when memory manage exception occurs */
68 while(1)
69 {
70 }
71}
72
78void BusFault_Handler(void)
79{
80 /* go to infinite loop when bus fault exception occurs */
81 while(1)
82 {
83 }
84}
85
91void UsageFault_Handler(void)
92{
93 /* go to infinite loop when usage fault exception occurs */
94 while(1)
95 {
96 }
97}
98
104void SVC_Handler(void)
105{
106}
107
113void DebugMon_Handler(void)
114{
115}
116
122void PendSV_Handler(void)
123{
124}
125
131void SysTick_Handler(void)
132{
133}
134
135
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/bpr/bpr_data/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/bpr/bpr_data/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/bpr/bpr_data/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/bpr/bpr_data/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/bpr/bpr_data/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/bpr/bpr_data/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/bpr/bpr_data/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/bpr/bpr_data/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/bpr/bpr_data/src/at32f413_int.c:113
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • bpr
  • bpr_data
  • src
project/at_start_f413/examples/bpr/bpr_data/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37#define BPR_DR_NUMBER 42
38
39 bpr_data_type bpr_addr_tab[BPR_DR_NUMBER] =
40{
41 BPR_DATA1, BPR_DATA2, BPR_DATA3, BPR_DATA4, BPR_DATA5,
42 BPR_DATA6, BPR_DATA7, BPR_DATA8, BPR_DATA9, BPR_DATA10,
43 BPR_DATA11, BPR_DATA12, BPR_DATA13, BPR_DATA14, BPR_DATA15,
44 BPR_DATA16, BPR_DATA17, BPR_DATA18, BPR_DATA19, BPR_DATA20,
45 BPR_DATA21, BPR_DATA22, BPR_DATA23, BPR_DATA24, BPR_DATA25,
46 BPR_DATA26, BPR_DATA27, BPR_DATA28, BPR_DATA29, BPR_DATA30,
47 BPR_DATA31, BPR_DATA32, BPR_DATA33, BPR_DATA34, BPR_DATA35,
48 BPR_DATA36, BPR_DATA37, BPR_DATA38, BPR_DATA39, BPR_DATA40,
49 BPR_DATA41, BPR_DATA42
50};
51
52void bpr_reg_write(void);
53uint8_t bpr_reg_check(void);
54void uart_init(uint32_t baudrate);
55
61void bpr_reg_write(void)
62{
63 uint32_t index = 0;
64
65 for(index = 0; index < BPR_DR_NUMBER; index++)
66 {
67 bpr_data_write(bpr_addr_tab[index], 0x5A00 | bpr_addr_tab[index]);
68 }
69}
70
79uint8_t bpr_reg_check(void)
80{
81 uint32_t index = 0;
82
83 for(index = 0; index < BPR_DR_NUMBER; index++)
84 {
85 if(bpr_data_read(bpr_addr_tab[index]) != (0x5A00 | bpr_addr_tab[index]))
86 {
87 return FALSE;
88 }
89 }
90
91 return TRUE;
92}
93
99int main(void)
100{
101 system_clock_config();
102
103 uart_print_init(115200);
104
105 /* enable pwc and bpr clock */
106 crm_periph_clock_enable(CRM_PWC_PERIPH_CLOCK, TRUE);
107 crm_periph_clock_enable(CRM_BPR_PERIPH_CLOCK, TRUE);
108
109 /* enable write access to bpr domain */
110 pwc_battery_powered_domain_access(TRUE);
111
112 /* clear tamper pin event pending flag */
113 bpr_flag_clear(BPR_TAMPER_EVENT_FLAG);
114
115 /* check data from bpr dt register */
116 if(bpr_reg_check() == TRUE)
117 {
118 printf("bpr reg => none reset\r\n");
119 }
120 else
121 {
122 printf("bpr reg => reset\r\n");
123 }
124
125 /* reset bpr domain */
126 bpr_reset();
127
128 /* write data to bpr dt register */
129 bpr_reg_write();
130
131 /* check if the written data are correct */
132 if(bpr_reg_check() == TRUE)
133 {
134 printf("write bpr reg ok\r\n");
135 }
136 else
137 {
138 printf("write bpr reg fail\r\n");
139 }
140
141 /* disable pwc and bpr clock for power saving */
142 crm_periph_clock_enable(CRM_PWC_PERIPH_CLOCK, FALSE);
143 crm_periph_clock_enable(CRM_BPR_PERIPH_CLOCK, FALSE);
144
145 while(1)
146 {
147 }
148}
149
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
bpr_addr_tab
bpr_data_type bpr_addr_tab[42]
Definition project/at_start_f413/examples/bpr/bpr_data/src/main.c:39
BPR_DR_NUMBER
#define BPR_DR_NUMBER
Definition project/at_start_f413/examples/bpr/bpr_data/src/main.c:37
bpr_reg_write
void bpr_reg_write(void)
write data to bpr dt register.
Definition project/at_start_f413/examples/bpr/bpr_data/src/main.c:61
main
int main(void)
main function.
Definition project/at_start_f413/examples/bpr/bpr_data/src/main.c:99
uart_init
void uart_init(uint32_t baudrate)
init usart.
Definition app_led3_toggle/src/usart.c:44
bpr_reg_check
uint8_t bpr_reg_check(void)
checks if the bpr dt register values are correct or not.
Definition project/at_start_f413/examples/bpr/bpr_data/src/main.c:79
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
uart_print_init
void uart_print_init(uint32_t baudrate)
initialize uart
Definition at32f413_board.c:129
bpr_reset
void bpr_reset(void)
bpr reset by crm reset register
Definition at32f413_bpr.c:48
bpr_data_read
uint16_t bpr_data_read(bpr_data_type bpr_data)
read bpr bpr data
Definition at32f413_bpr.c:135
bpr_flag_clear
void bpr_flag_clear(uint32_t flag)
clear bpr tamper flag
Definition at32f413_bpr.c:102
bpr_data_write
void bpr_data_write(bpr_data_type bpr_data, uint16_t data_value)
write bpr data
Definition at32f413_bpr.c:152
bpr_data_type
bpr_data_type
battery powered register data type
Definition at32f413_bpr.h:66
BPR_DATA26
@ BPR_DATA26
Definition at32f413_bpr.h:92
BPR_DATA28
@ BPR_DATA28
Definition at32f413_bpr.h:94
BPR_DATA31
@ BPR_DATA31
Definition at32f413_bpr.h:97
BPR_DATA8
@ BPR_DATA8
Definition at32f413_bpr.h:74
BPR_DATA25
@ BPR_DATA25
Definition at32f413_bpr.h:91
BPR_DATA39
@ BPR_DATA39
Definition at32f413_bpr.h:105
BPR_DATA7
@ BPR_DATA7
Definition at32f413_bpr.h:73
BPR_DATA12
@ BPR_DATA12
Definition at32f413_bpr.h:78
BPR_DATA29
@ BPR_DATA29
Definition at32f413_bpr.h:95
BPR_DATA19
@ BPR_DATA19
Definition at32f413_bpr.h:85
BPR_DATA1
@ BPR_DATA1
Definition at32f413_bpr.h:67
BPR_DATA36
@ BPR_DATA36
Definition at32f413_bpr.h:102
BPR_DATA9
@ BPR_DATA9
Definition at32f413_bpr.h:75
BPR_DATA10
@ BPR_DATA10
Definition at32f413_bpr.h:76
BPR_DATA27
@ BPR_DATA27
Definition at32f413_bpr.h:93
BPR_DATA20
@ BPR_DATA20
Definition at32f413_bpr.h:86
BPR_DATA38
@ BPR_DATA38
Definition at32f413_bpr.h:104
BPR_DATA37
@ BPR_DATA37
Definition at32f413_bpr.h:103
BPR_DATA41
@ BPR_DATA41
Definition at32f413_bpr.h:107
BPR_DATA13
@ BPR_DATA13
Definition at32f413_bpr.h:79
BPR_DATA4
@ BPR_DATA4
Definition at32f413_bpr.h:70
BPR_DATA32
@ BPR_DATA32
Definition at32f413_bpr.h:98
BPR_DATA16
@ BPR_DATA16
Definition at32f413_bpr.h:82
BPR_DATA11
@ BPR_DATA11
Definition at32f413_bpr.h:77
BPR_DATA24
@ BPR_DATA24
Definition at32f413_bpr.h:90
BPR_DATA23
@ BPR_DATA23
Definition at32f413_bpr.h:89
BPR_DATA5
@ BPR_DATA5
Definition at32f413_bpr.h:71
BPR_DATA18
@ BPR_DATA18
Definition at32f413_bpr.h:84
BPR_DATA17
@ BPR_DATA17
Definition at32f413_bpr.h:83
BPR_DATA42
@ BPR_DATA42
Definition at32f413_bpr.h:108
BPR_DATA21
@ BPR_DATA21
Definition at32f413_bpr.h:87
BPR_DATA33
@ BPR_DATA33
Definition at32f413_bpr.h:99
BPR_DATA40
@ BPR_DATA40
Definition at32f413_bpr.h:106
BPR_DATA30
@ BPR_DATA30
Definition at32f413_bpr.h:96
BPR_DATA2
@ BPR_DATA2
Definition at32f413_bpr.h:68
BPR_DATA14
@ BPR_DATA14
Definition at32f413_bpr.h:80
BPR_DATA15
@ BPR_DATA15
Definition at32f413_bpr.h:81
BPR_DATA3
@ BPR_DATA3
Definition at32f413_bpr.h:69
BPR_DATA22
@ BPR_DATA22
Definition at32f413_bpr.h:88
BPR_DATA34
@ BPR_DATA34
Definition at32f413_bpr.h:100
BPR_DATA35
@ BPR_DATA35
Definition at32f413_bpr.h:101
BPR_DATA6
@ BPR_DATA6
Definition at32f413_bpr.h:72
BPR_TAMPER_EVENT_FLAG
#define BPR_TAMPER_EVENT_FLAG
Definition at32f413_bpr.h:52
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_PWC_PERIPH_CLOCK
@ CRM_PWC_PERIPH_CLOCK
Definition at32f413_crm.h:140
CRM_BPR_PERIPH_CLOCK
@ CRM_BPR_PERIPH_CLOCK
Definition at32f413_crm.h:139
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
pwc_battery_powered_domain_access
void pwc_battery_powered_domain_access(confirm_state new_state)
enable or disable access to the battery powered domain.
Definition at32f413_pwc.c:60
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • bpr
  • tamper
  • inc
project/at_start_f413/examples/bpr/tamper/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • bpr
  • tamper
  • inc
project/at_start_f413/examples/bpr/tamper/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • bpr
  • tamper
  • inc
project/at_start_f413/examples/bpr/tamper/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • bpr
  • tamper
  • src
project/at_start_f413/examples/bpr/tamper/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/bpr/tamper/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • bpr
  • tamper
  • src
project/at_start_f413/examples/bpr/tamper/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28#include "at32f413_board.h"
29
30extern uint32_t bpr_reg_judge(void);
31
45void NMI_Handler(void)
46{
47}
48
54void HardFault_Handler(void)
55{
56 /* go to infinite loop when hard fault exception occurs */
57 while(1)
58 {
59 }
60}
61
67void MemManage_Handler(void)
68{
69 /* go to infinite loop when memory manage exception occurs */
70 while(1)
71 {
72 }
73}
74
80void BusFault_Handler(void)
81{
82 /* go to infinite loop when bus fault exception occurs */
83 while(1)
84 {
85 }
86}
87
93void UsageFault_Handler(void)
94{
95 /* go to infinite loop when usage fault exception occurs */
96 while(1)
97 {
98 }
99}
100
106void SVC_Handler(void)
107{
108}
109
115void DebugMon_Handler(void)
116{
117}
118
124void PendSV_Handler(void)
125{
126}
127
133void SysTick_Handler(void)
134{
135}
136
142void TAMPER_IRQHandler(void)
143{
144 if(bpr_interrupt_flag_get(BPR_TAMPER_INTERRUPT_FLAG) != RESET)
145 {
146 /* check if bpr registers are cleared */
147 if(bpr_reg_judge() == 0)
148 {
149 /* ok, bpr registers are reset as expected */
150 at32_led_on(LED3);
151 }
152 else
153 {
154 /* bpr registers are not reset */
155 at32_led_off(LED3);
156 }
157
158 /* clear tamper pin interrupt pending bit */
159 bpr_flag_clear(BPR_TAMPER_INTERRUPT_FLAG);
160
161 /* clear tamper pin event(te) pending flag */
162 bpr_flag_clear(BPR_TAMPER_EVENT_FLAG);
163
164 /* disable tamper pin */
165 bpr_tamper_pin_enable(FALSE);
166
167 /* enable tamper pin */
168 bpr_tamper_pin_enable(TRUE);
169 }
170}
171
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/bpr/tamper/src/at32f413_int.c:93
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/bpr/tamper/src/at32f413_int.c:54
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/bpr/tamper/src/at32f413_int.c:67
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/bpr/tamper/src/at32f413_int.c:106
bpr_reg_judge
uint32_t bpr_reg_judge(void)
checks if the bpr dt registers are reset or not.
Definition project/at_start_f413/examples/bpr/tamper/src/main.c:102
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/bpr/tamper/src/at32f413_int.c:124
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/bpr/tamper/src/at32f413_int.c:45
TAMPER_IRQHandler
void TAMPER_IRQHandler(void)
this function handles tamper interrupt request.
Definition project/at_start_f413/examples/bpr/tamper/src/at32f413_int.c:142
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/bpr/tamper/src/at32f413_int.c:80
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/bpr/tamper/src/at32f413_int.c:133
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/bpr/tamper/src/at32f413_int.c:115
LED3
@ LED3
Definition at32f413_board.h:63
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
at32_led_off
void at32_led_off(led_type led)
turns selected led off.
Definition at32f413_board.c:287
bpr_tamper_pin_enable
void bpr_tamper_pin_enable(confirm_state new_state)
enable or disable bpr tamper pin
Definition at32f413_bpr.c:193
bpr_interrupt_flag_get
flag_status bpr_interrupt_flag_get(uint32_t flag)
bpr interrupt flag get
Definition at32f413_bpr.c:82
bpr_flag_clear
void bpr_flag_clear(uint32_t flag)
clear bpr tamper flag
Definition at32f413_bpr.c:102
BPR_TAMPER_EVENT_FLAG
#define BPR_TAMPER_EVENT_FLAG
Definition at32f413_bpr.h:52
BPR_TAMPER_INTERRUPT_FLAG
#define BPR_TAMPER_INTERRUPT_FLAG
Definition at32f413_bpr.h:51
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • bpr
  • tamper
  • src
project/at_start_f413/examples/bpr/tamper/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37#define BPR_DR_NUMBER 42
38
39 bpr_data_type bpr_addr_tab[BPR_DR_NUMBER] =
40{
41 BPR_DATA1, BPR_DATA2, BPR_DATA3, BPR_DATA4, BPR_DATA5,
42 BPR_DATA6, BPR_DATA7, BPR_DATA8, BPR_DATA9, BPR_DATA10,
43 BPR_DATA11, BPR_DATA12, BPR_DATA13, BPR_DATA14, BPR_DATA15,
44 BPR_DATA16, BPR_DATA17, BPR_DATA18, BPR_DATA19, BPR_DATA20,
45 BPR_DATA21, BPR_DATA22, BPR_DATA23, BPR_DATA24, BPR_DATA25,
46 BPR_DATA26, BPR_DATA27, BPR_DATA28, BPR_DATA29, BPR_DATA30,
47 BPR_DATA31, BPR_DATA32, BPR_DATA33, BPR_DATA34, BPR_DATA35,
48 BPR_DATA36, BPR_DATA37, BPR_DATA38, BPR_DATA39, BPR_DATA40,
49 BPR_DATA41, BPR_DATA42
50};
51
52void bpr_reg_write(void);
53uint8_t bpr_reg_check(void);
54uint32_t bpr_reg_judge(void);
55
61void bpr_reg_write(void)
62{
63 uint32_t index = 0;
64
65 for(index = 0; index < BPR_DR_NUMBER; index++)
66 {
67 bpr_data_write(bpr_addr_tab[index], 0x5A00 | bpr_addr_tab[index]);
68 }
69}
70
79uint8_t bpr_reg_check(void)
80{
81 uint32_t index = 0;
82
83 for(index = 0; index < BPR_DR_NUMBER; index++)
84 {
85 if(bpr_data_read(bpr_addr_tab[index]) != (0x5A00 | bpr_addr_tab[index]))
86 {
87 return FALSE;
88 }
89 }
90
91 return TRUE;
92}
93
102uint32_t bpr_reg_judge(void)
103{
104 uint32_t index = 0;
105
106 for(index = 0; index < BPR_DR_NUMBER; index++)
107 {
108 if(bpr_data_read(bpr_addr_tab[index]) != 0x0000)
109 {
110 return (index + 1);
111 }
112 }
113
114 return 0;
115}
116
122int main(void)
123{
124 /* config nvic priority group */
125 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
126
127 system_clock_config();
128
129 at32_board_init();
130
131 /* nvic configuration */
132 nvic_irq_enable(TAMPER_IRQn, 0, 0);
133
134 /* enable pwc and bpr clock */
135 crm_periph_clock_enable(CRM_PWC_PERIPH_CLOCK, TRUE);
136 crm_periph_clock_enable(CRM_BPR_PERIPH_CLOCK, TRUE);
137
138 /* enable write access to bpr domain */
139 pwc_battery_powered_domain_access(TRUE);
140
141 /* disable tamper pin */
142 bpr_tamper_pin_enable(FALSE);
143
144 /* disable tamper interrupt */
145 bpr_interrupt_enable(FALSE);
146
147 /* tamper pin active on low level */
148 bpr_tamper_pin_active_level_set(BPR_TAMPER_PIN_ACTIVE_LOW);
149
150 /* clear tamper pin event pending flag */
151 bpr_flag_clear(BPR_TAMPER_EVENT_FLAG);
152
153 /* write data to bpr dt registers */
154 bpr_reg_write();
155
156 /* enable tamper interrupt */
157 bpr_interrupt_enable(TRUE);
158
159 /* enable tamper pin */
160 bpr_tamper_pin_enable(TRUE);
161
162 /* check if the written data are correct */
163 if(bpr_reg_check() == TRUE)
164 {
165 at32_led_on(LED2);
166 }
167 else
168 {
169 at32_led_off(LED2);
170 }
171
172 while(1)
173 {
174 }
175}
176
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
bpr_addr_tab
bpr_data_type bpr_addr_tab[42]
Definition project/at_start_f413/examples/bpr/tamper/src/main.c:39
BPR_DR_NUMBER
#define BPR_DR_NUMBER
Definition project/at_start_f413/examples/bpr/tamper/src/main.c:37
bpr_reg_judge
uint32_t bpr_reg_judge(void)
checks if the bpr dt registers are reset or not.
Definition project/at_start_f413/examples/bpr/tamper/src/main.c:102
bpr_reg_write
void bpr_reg_write(void)
write data to bpr dt registers.
Definition project/at_start_f413/examples/bpr/tamper/src/main.c:61
main
int main(void)
main function.
Definition project/at_start_f413/examples/bpr/tamper/src/main.c:122
bpr_reg_check
uint8_t bpr_reg_check(void)
checks if the bpr dt registers values are correct or not.
Definition project/at_start_f413/examples/bpr/tamper/src/main.c:79
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
LED2
@ LED2
Definition at32f413_board.h:62
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
at32_led_off
void at32_led_off(led_type led)
turns selected led off.
Definition at32f413_board.c:287
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
bpr_tamper_pin_enable
void bpr_tamper_pin_enable(confirm_state new_state)
enable or disable bpr tamper pin
Definition at32f413_bpr.c:193
bpr_interrupt_enable
void bpr_interrupt_enable(confirm_state new_state)
enable or disable bpr tamper interrupt
Definition at32f413_bpr.c:119
bpr_tamper_pin_active_level_set
void bpr_tamper_pin_active_level_set(bpr_tamper_pin_active_level_type active_level)
set bpr tamper pin active level
Definition at32f413_bpr.c:206
bpr_data_read
uint16_t bpr_data_read(bpr_data_type bpr_data)
read bpr bpr data
Definition at32f413_bpr.c:135
bpr_flag_clear
void bpr_flag_clear(uint32_t flag)
clear bpr tamper flag
Definition at32f413_bpr.c:102
bpr_data_write
void bpr_data_write(bpr_data_type bpr_data, uint16_t data_value)
write bpr data
Definition at32f413_bpr.c:152
bpr_data_type
bpr_data_type
battery powered register data type
Definition at32f413_bpr.h:66
BPR_DATA26
@ BPR_DATA26
Definition at32f413_bpr.h:92
BPR_DATA28
@ BPR_DATA28
Definition at32f413_bpr.h:94
BPR_DATA31
@ BPR_DATA31
Definition at32f413_bpr.h:97
BPR_DATA8
@ BPR_DATA8
Definition at32f413_bpr.h:74
BPR_DATA25
@ BPR_DATA25
Definition at32f413_bpr.h:91
BPR_DATA39
@ BPR_DATA39
Definition at32f413_bpr.h:105
BPR_DATA7
@ BPR_DATA7
Definition at32f413_bpr.h:73
BPR_DATA12
@ BPR_DATA12
Definition at32f413_bpr.h:78
BPR_DATA29
@ BPR_DATA29
Definition at32f413_bpr.h:95
BPR_DATA19
@ BPR_DATA19
Definition at32f413_bpr.h:85
BPR_DATA1
@ BPR_DATA1
Definition at32f413_bpr.h:67
BPR_DATA36
@ BPR_DATA36
Definition at32f413_bpr.h:102
BPR_DATA9
@ BPR_DATA9
Definition at32f413_bpr.h:75
BPR_DATA10
@ BPR_DATA10
Definition at32f413_bpr.h:76
BPR_DATA27
@ BPR_DATA27
Definition at32f413_bpr.h:93
BPR_DATA20
@ BPR_DATA20
Definition at32f413_bpr.h:86
BPR_DATA38
@ BPR_DATA38
Definition at32f413_bpr.h:104
BPR_DATA37
@ BPR_DATA37
Definition at32f413_bpr.h:103
BPR_DATA41
@ BPR_DATA41
Definition at32f413_bpr.h:107
BPR_DATA13
@ BPR_DATA13
Definition at32f413_bpr.h:79
BPR_DATA4
@ BPR_DATA4
Definition at32f413_bpr.h:70
BPR_DATA32
@ BPR_DATA32
Definition at32f413_bpr.h:98
BPR_DATA16
@ BPR_DATA16
Definition at32f413_bpr.h:82
BPR_DATA11
@ BPR_DATA11
Definition at32f413_bpr.h:77
BPR_DATA24
@ BPR_DATA24
Definition at32f413_bpr.h:90
BPR_DATA23
@ BPR_DATA23
Definition at32f413_bpr.h:89
BPR_DATA5
@ BPR_DATA5
Definition at32f413_bpr.h:71
BPR_DATA18
@ BPR_DATA18
Definition at32f413_bpr.h:84
BPR_DATA17
@ BPR_DATA17
Definition at32f413_bpr.h:83
BPR_DATA42
@ BPR_DATA42
Definition at32f413_bpr.h:108
BPR_DATA21
@ BPR_DATA21
Definition at32f413_bpr.h:87
BPR_DATA33
@ BPR_DATA33
Definition at32f413_bpr.h:99
BPR_DATA40
@ BPR_DATA40
Definition at32f413_bpr.h:106
BPR_DATA30
@ BPR_DATA30
Definition at32f413_bpr.h:96
BPR_DATA2
@ BPR_DATA2
Definition at32f413_bpr.h:68
BPR_DATA14
@ BPR_DATA14
Definition at32f413_bpr.h:80
BPR_DATA15
@ BPR_DATA15
Definition at32f413_bpr.h:81
BPR_DATA3
@ BPR_DATA3
Definition at32f413_bpr.h:69
BPR_DATA22
@ BPR_DATA22
Definition at32f413_bpr.h:88
BPR_DATA34
@ BPR_DATA34
Definition at32f413_bpr.h:100
BPR_DATA35
@ BPR_DATA35
Definition at32f413_bpr.h:101
BPR_DATA6
@ BPR_DATA6
Definition at32f413_bpr.h:72
BPR_TAMPER_PIN_ACTIVE_LOW
@ BPR_TAMPER_PIN_ACTIVE_LOW
Definition at32f413_bpr.h:129
BPR_TAMPER_EVENT_FLAG
#define BPR_TAMPER_EVENT_FLAG
Definition at32f413_bpr.h:52
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_PWC_PERIPH_CLOCK
@ CRM_PWC_PERIPH_CLOCK
Definition at32f413_crm.h:140
CRM_BPR_PERIPH_CLOCK
@ CRM_BPR_PERIPH_CLOCK
Definition at32f413_crm.h:139
TAMPER_IRQn
@ TAMPER_IRQn
Definition at32f413.h:173
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
pwc_battery_powered_domain_access
void pwc_battery_powered_domain_access(confirm_state new_state)
enable or disable access to the battery powered domain.
Definition at32f413_pwc.c:60
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • can
  • communication_mode
  • inc
project/at_start_f413/examples/can/communication_mode/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • can
  • communication_mode
  • inc
project/at_start_f413/examples/can/communication_mode/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • can
  • communication_mode
  • inc
project/at_start_f413/examples/can/communication_mode/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • can
  • communication_mode
  • src
project/at_start_f413/examples/can/communication_mode/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/can/communication_mode/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • can
  • communication_mode
  • src
project/at_start_f413/examples/can/communication_mode/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
43void NMI_Handler(void)
44{
45}
46
52void HardFault_Handler(void)
53{
54 /* go to infinite loop when hard fault exception occurs */
55 while(1)
56 {
57 }
58}
59
65void MemManage_Handler(void)
66{
67 /* go to infinite loop when memory manage exception occurs */
68 while(1)
69 {
70 }
71}
72
78void BusFault_Handler(void)
79{
80 /* go to infinite loop when bus fault exception occurs */
81 while(1)
82 {
83 }
84}
85
91void UsageFault_Handler(void)
92{
93 /* go to infinite loop when usage fault exception occurs */
94 while(1)
95 {
96 }
97}
98
104void SVC_Handler(void)
105{
106}
107
113void DebugMon_Handler(void)
114{
115}
116
122void PendSV_Handler(void)
123{
124}
125
131void SysTick_Handler(void)
132{
133}
134
135
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/can/communication_mode/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/can/communication_mode/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/can/communication_mode/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/can/communication_mode/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/can/communication_mode/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/can/communication_mode/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/can/communication_mode/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/can/communication_mode/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/can/communication_mode/src/at32f413_int.c:113
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • can
  • communication_mode
  • src
project/at_start_f413/examples/can/communication_mode/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
42static void can_gpio_config(void)
43{
44 gpio_init_type gpio_init_struct;
45
46 crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
47 crm_periph_clock_enable(CRM_IOMUX_PERIPH_CLOCK, TRUE);
48 gpio_pin_remap_config(CAN1_GMUX_0010,TRUE);
49
50 gpio_default_para_init(&gpio_init_struct);
51 /* can tx pin */
52 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
53 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
54 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
55 gpio_init_struct.gpio_pins = GPIO_PINS_9;
56 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
57 gpio_init(GPIOB, &gpio_init_struct);
58 /* can rx pin */
59 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
60 gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
61 gpio_init_struct.gpio_pins = GPIO_PINS_8;
62 gpio_init_struct.gpio_pull = GPIO_PULL_UP;
63 gpio_init(GPIOB, &gpio_init_struct);
64}
65
73 error_status can_configuration(void)
74{
75 can_base_type can_base_struct;
76 can_baudrate_type can_baudrate_struct;
77 can_filter_init_type can_filter_init_struct;
78
79 /* as specified in CAN protocol, the maximum allowable oscillator tolerance is 1.58%.
80 The HICK accuracy does not meet the clock requirements in CAN protocol. to guarantee normal
81 communication, it is recommended to use HEXT as the system clock source. */
82 if(crm_flag_get(CRM_HEXT_STABLE_FLAG) != SET)
83 {
84 return ERROR;
85 }
86
87 crm_periph_clock_enable(CRM_CAN1_PERIPH_CLOCK, TRUE);
88 /* can base init */
89 can_default_para_init(&can_base_struct);
90 can_base_struct.mode_selection = CAN_MODE_COMMUNICATE;
91 can_base_struct.ttc_enable = FALSE;
92 can_base_struct.aebo_enable = TRUE;
93 can_base_struct.aed_enable = TRUE;
94 can_base_struct.prsf_enable = FALSE;
95 can_base_struct.mdrsel_selection = CAN_DISCARDING_FIRST_RECEIVED;
96 can_base_struct.mmssr_selection = CAN_SENDING_BY_ID;
97 can_base_init(CAN1, &can_base_struct);
98
99 /* can baudrate, set baudrate = pclk/(baudrate_div *(1 + bts1_size + bts2_size)) */
100 can_baudrate_struct.baudrate_div = 8;
101 can_baudrate_struct.rsaw_size = CAN_RSAW_3TQ;
102 can_baudrate_struct.bts1_size = CAN_BTS1_8TQ;
103 can_baudrate_struct.bts2_size = CAN_BTS2_3TQ;
104 if(can_baudrate_set(CAN1, &can_baudrate_struct) != SUCCESS)
105 {
106 return ERROR;
107 }
108
109 /* can filter init */
110 can_filter_init_struct.filter_activate_enable = TRUE;
111 can_filter_init_struct.filter_mode = CAN_FILTER_MODE_ID_MASK;
112 can_filter_init_struct.filter_fifo = CAN_FILTER_FIFO0;
113 can_filter_init_struct.filter_number = 0;
114 can_filter_init_struct.filter_bit = CAN_FILTER_32BIT;
115 can_filter_init_struct.filter_id_high = 0;
116 can_filter_init_struct.filter_id_low = 0;
117 can_filter_init_struct.filter_mask_high = 0;
118 can_filter_init_struct.filter_mask_low = 0;
119 can_filter_init(CAN1, &can_filter_init_struct);
120
121 /* can interrupt config */
122 nvic_irq_enable(CAN1_SE_IRQn, 0x00, 0x00);
123 nvic_irq_enable(USBFS_L_CAN1_RX0_IRQn, 0x00, 0x00);
124 can_interrupt_enable(CAN1, CAN_RF0MIEN_INT, TRUE);
125
126 /* error interrupt enable */
127 can_interrupt_enable(CAN1, CAN_ETRIEN_INT, TRUE);
128 can_interrupt_enable(CAN1, CAN_EOIEN_INT, TRUE);
129
130 return SUCCESS;
131}
132
138static void can_transmit_data(void)
139{
140 uint8_t transmit_mailbox;
141 can_tx_message_type tx_message_struct;
142 tx_message_struct.standard_id = 0x400;
143 tx_message_struct.extended_id = 0;
144 tx_message_struct.id_type = CAN_ID_STANDARD;
145 tx_message_struct.frame_type = CAN_TFT_DATA;
146 tx_message_struct.dlc = 8;
147 tx_message_struct.data[0] = 0x11;
148 tx_message_struct.data[1] = 0x22;
149 tx_message_struct.data[2] = 0x33;
150 tx_message_struct.data[3] = 0x44;
151 tx_message_struct.data[4] = 0x55;
152 tx_message_struct.data[5] = 0x66;
153 tx_message_struct.data[6] = 0x77;
154 tx_message_struct.data[7] = 0x88;
155 transmit_mailbox = can_message_transmit(CAN1, &tx_message_struct);
156 while(can_transmit_status_get(CAN1, (can_tx_mailbox_num_type)transmit_mailbox) != CAN_TX_STATUS_SUCCESSFUL);
157}
158
164void USBFS_L_CAN1_RX0_IRQHandler (void)
165{
166 can_rx_message_type rx_message_struct;
167 if(can_interrupt_flag_get(CAN1,CAN_RF0MN_FLAG) != RESET)
168 {
169 can_message_receive(CAN1, CAN_RX_FIFO0, &rx_message_struct);
170 if(rx_message_struct.standard_id == 0x400)
171 at32_led_toggle(LED2);
172 else
173 at32_led_toggle(LED3);
174 }
175}
176
182void CAN1_SE_IRQHandler(void)
183{
184 __IO uint32_t err_index = 0;
185 if(can_interrupt_flag_get(CAN1,CAN_ETR_FLAG) != RESET)
186 {
187 err_index = CAN1->ests & 0x70;
188 can_flag_clear(CAN1, CAN_ETR_FLAG);
189 /* error type is stuff error */
190 if(err_index == 0x00000010)
191 {
192 /* when stuff error occur: in order to ensure communication normally,
193 user must restart can or send a frame of highest priority message here */
194 }
195 }
196}
197
203int main(void)
204{
205 system_clock_config();
206 at32_board_init();
207 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
208 can_gpio_config();
209 if(can_configuration() == ERROR)
210 {
211 /* CAN clock initialization error */
212 while(1)
213 {
214 }
215 }
216 while(1)
217 {
218 can_transmit_data();
219 at32_led_toggle(LED4);
220 delay_sec(1);
221 }
222}
223
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
CAN1_SE_IRQHandler
void CAN1_SE_IRQHandler(void)
can1 interrupt function se
Definition project/at_start_f413/examples/can/communication_mode/src/main.c:182
can_transmit_data
static void can_transmit_data(void)
can transmit data
Definition project/at_start_f413/examples/can/communication_mode/src/main.c:138
main
int main(void)
main function.
Definition project/at_start_f413/examples/can/communication_mode/src/main.c:203
USBFS_L_CAN1_RX0_IRQHandler
void USBFS_L_CAN1_RX0_IRQHandler(void)
can1 interrupt function rx0
Definition project/at_start_f413/examples/can/communication_mode/src/main.c:164
can_configuration
error_status can_configuration(void)
can configiguration.
Definition project/at_start_f413/examples/can/communication_mode/src/main.c:73
can_gpio_config
static void can_gpio_config(void)
can gpio config
Definition project/at_start_f413/examples/can/communication_mode/src/main.c:42
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
delay_sec
void delay_sec(uint16_t sec)
inserts a delay time.
Definition at32f413_board.c:382
can_base_init
error_status can_base_init(can_type *can_x, can_base_type *can_base_struct)
initialize the can peripheral according to the specified parameters in the can_init_struct.
Definition at32f413_can.c:196
can_interrupt_flag_get
flag_status can_interrupt_flag_get(can_type *can_x, uint32_t can_flag)
get interrupt flag of the specified can peripheral.
Definition at32f413_can.c:968
can_transmit_status_get
can_transmit_status_type can_transmit_status_get(can_type *can_x, can_tx_mailbox_num_type transmit_mailbox)
check the transmission state of the specified can peripheral.
Definition at32f413_can.c:516
can_message_transmit
uint8_t can_message_transmit(can_type *can_x, can_tx_message_type *tx_message_struct)
fill the transmission message and transmit of the specified can peripheral.
Definition at32f413_can.c:442
can_message_receive
void can_message_receive(can_type *can_x, can_rx_fifo_num_type fifo_number, can_rx_message_type *rx_message_struct)
receive message of the specified can peripheral.
Definition at32f413_can.c:623
can_interrupt_enable
void can_interrupt_enable(can_type *can_x, uint32_t can_int, confirm_state new_state)
enable or disable the interrupt of the specified can peripheral.
Definition at32f413_can.c:928
can_flag_clear
void can_flag_clear(can_type *can_x, uint32_t can_flag)
clear flag of the specified can peripheral.
Definition at32f413_can.c:1188
can_baudrate_set
error_status can_baudrate_set(can_type *can_x, can_baudrate_type *can_baudrate_struct)
set the baudrate of the can peripheral
Definition at32f413_can.c:101
can_filter_init
void can_filter_init(can_type *can_x, can_filter_init_type *can_filter_init_struct)
initialize the can peripheral according to the specified parameters in the can_filter_init_struct.
Definition at32f413_can.c:306
can_default_para_init
void can_default_para_init(can_base_type *can_base_struct)
fill each can_init_struct member with its default value.
Definition at32f413_can.c:159
can_tx_mailbox_num_type
can_tx_mailbox_num_type
can tx mailboxes
Definition at32f413_can.h:251
CAN_FILTER_FIFO0
@ CAN_FILTER_FIFO0
Definition at32f413_can.h:137
CAN_TX_STATUS_SUCCESSFUL
@ CAN_TX_STATUS_SUCCESSFUL
Definition at32f413_can.h:272
CAN_DISCARDING_FIRST_RECEIVED
@ CAN_DISCARDING_FIRST_RECEIVED
Definition at32f413_can.h:300
CAN_BTS2_3TQ
@ CAN_BTS2_3TQ
Definition at32f413_can.h:221
CAN_TFT_DATA
@ CAN_TFT_DATA
Definition at32f413_can.h:243
CAN_BTS1_8TQ
@ CAN_BTS1_8TQ
Definition at32f413_can.h:203
CAN_FILTER_MODE_ID_MASK
@ CAN_FILTER_MODE_ID_MASK
Definition at32f413_can.h:146
CAN_SENDING_BY_ID
@ CAN_SENDING_BY_ID
Definition at32f413_can.h:309
CAN_FILTER_32BIT
@ CAN_FILTER_32BIT
Definition at32f413_can.h:156
CAN_RX_FIFO0
@ CAN_RX_FIFO0
Definition at32f413_can.h:262
CAN_ID_STANDARD
@ CAN_ID_STANDARD
Definition at32f413_can.h:234
CAN_MODE_COMMUNICATE
@ CAN_MODE_COMMUNICATE
Definition at32f413_can.h:164
CAN_RSAW_3TQ
@ CAN_RSAW_3TQ
Definition at32f413_can.h:187
CAN_RF0MN_FLAG
#define CAN_RF0MN_FLAG
Definition at32f413_can.h:71
CAN_ETR_FLAG
#define CAN_ETR_FLAG
Definition at32f413_can.h:66
CAN_RF0MIEN_INT
#define CAN_RF0MIEN_INT
Definition at32f413_can.h:91
CAN_EOIEN_INT
#define CAN_EOIEN_INT
Definition at32f413_can.h:101
CAN_ETRIEN_INT
#define CAN_ETRIEN_INT
Definition at32f413_can.h:100
CAN1
#define CAN1
Definition at32f413_can.h:937
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_IOMUX_PERIPH_CLOCK
@ CRM_IOMUX_PERIPH_CLOCK
Definition at32f413_crm.h:108
CRM_CAN1_PERIPH_CLOCK
@ CRM_CAN1_PERIPH_CLOCK
Definition at32f413_crm.h:138
CRM_GPIOB_PERIPH_CLOCK
@ CRM_GPIOB_PERIPH_CLOCK
Definition at32f413_crm.h:110
CRM_HEXT_STABLE_FLAG
#define CRM_HEXT_STABLE_FLAG
Definition at32f413_crm.h:55
USBFS_L_CAN1_RX0_IRQn
@ USBFS_L_CAN1_RX0_IRQn
Definition at32f413.h:192
CAN1_SE_IRQn
@ CAN1_SE_IRQn
Definition at32f413.h:194
error_status
error_status
error status
Definition at32f413.h:302
ERROR
@ ERROR
Definition at32f413.h:302
SUCCESS
@ SUCCESS
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
SET
@ SET
Definition at32f413.h:292
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_pin_remap_config
void gpio_pin_remap_config(uint32_t gpio_remap, confirm_state new_state)
iomux remap and debug i/o configuration.
Definition at32f413_gpio.c:549
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_PULL_UP
@ GPIO_PULL_UP
Definition at32f413_gpio.h:244
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_9
#define GPIO_PINS_9
Definition at32f413_gpio.h:59
GPIO_PINS_8
#define GPIO_PINS_8
Definition at32f413_gpio.h:58
GPIOB
#define GPIOB
Definition at32f413_gpio.h:748
CAN1_GMUX_0010
#define CAN1_GMUX_0010
Definition at32f413_gpio.h:170
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
at32f413_clock.h
header file of clock program
can_base_type
can init structure definition
Definition at32f413_can.h:332
can_base_type::prsf_enable
confirm_state prsf_enable
Definition at32f413_can.h:341
can_base_type::mdrsel_selection
can_msg_discarding_rule_type mdrsel_selection
Definition at32f413_can.h:343
can_base_type::aed_enable
confirm_state aed_enable
Definition at32f413_can.h:339
can_base_type::mmssr_selection
can_msg_sending_rule_type mmssr_selection
Definition at32f413_can.h:345
can_base_type::ttc_enable
confirm_state ttc_enable
Definition at32f413_can.h:335
can_base_type::mode_selection
can_mode_type mode_selection
Definition at32f413_can.h:333
can_base_type::aebo_enable
confirm_state aebo_enable
Definition at32f413_can.h:337
can_baudrate_type
can baudrate structure definition
Definition at32f413_can.h:353
can_baudrate_type::baudrate_div
uint16_t baudrate_div
Definition at32f413_can.h:354
can_baudrate_type::rsaw_size
can_rsaw_type rsaw_size
Definition at32f413_can.h:356
can_baudrate_type::bts2_size
can_bts2_type bts2_size
Definition at32f413_can.h:360
can_baudrate_type::bts1_size
can_bts1_type bts1_size
Definition at32f413_can.h:358
can_filter_init_type
can filter init structure definition
Definition at32f413_can.h:368
can_filter_init_type::filter_mask_low
uint16_t filter_mask_low
Definition at32f413_can.h:388
can_filter_init_type::filter_number
uint8_t filter_number
Definition at32f413_can.h:375
can_filter_init_type::filter_fifo
can_filter_fifo_type filter_fifo
Definition at32f413_can.h:373
can_filter_init_type::filter_bit
can_filter_bit_width_type filter_bit
Definition at32f413_can.h:377
can_filter_init_type::filter_mode
can_filter_mode_type filter_mode
Definition at32f413_can.h:371
can_filter_init_type::filter_activate_enable
confirm_state filter_activate_enable
Definition at32f413_can.h:369
can_filter_init_type::filter_mask_high
uint16_t filter_mask_high
Definition at32f413_can.h:385
can_filter_init_type::filter_id_high
uint16_t filter_id_high
Definition at32f413_can.h:379
can_filter_init_type::filter_id_low
uint16_t filter_id_low
Definition at32f413_can.h:382
can_rx_message_type
can rx message structure definition
Definition at32f413_can.h:418
can_rx_message_type::standard_id
uint32_t standard_id
Definition at32f413_can.h:419
can_tx_message_type
can tx message structure definition
Definition at32f413_can.h:396
can_tx_message_type::extended_id
uint32_t extended_id
Definition at32f413_can.h:400
can_tx_message_type::frame_type
can_trans_frame_type frame_type
Definition at32f413_can.h:405
can_tx_message_type::data
uint8_t data[8]
Definition at32f413_can.h:410
can_tx_message_type::dlc
uint8_t dlc
Definition at32f413_can.h:407
can_tx_message_type::id_type
can_identifier_type id_type
Definition at32f413_can.h:403
can_tx_message_type::standard_id
uint32_t standard_id
Definition at32f413_can.h:397
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • can
  • filter
  • inc
project/at_start_f413/examples/can/filter/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • can
  • filter
  • inc
project/at_start_f413/examples/can/filter/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • can
  • filter
  • inc
project/at_start_f413/examples/can/filter/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • can
  • filter
  • src
project/at_start_f413/examples/can/filter/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/can/filter/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • can
  • filter
  • src
project/at_start_f413/examples/can/filter/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
43void NMI_Handler(void)
44{
45}
46
52void HardFault_Handler(void)
53{
54 /* go to infinite loop when hard fault exception occurs */
55 while(1)
56 {
57 }
58}
59
65void MemManage_Handler(void)
66{
67 /* go to infinite loop when memory manage exception occurs */
68 while(1)
69 {
70 }
71}
72
78void BusFault_Handler(void)
79{
80 /* go to infinite loop when bus fault exception occurs */
81 while(1)
82 {
83 }
84}
85
91void UsageFault_Handler(void)
92{
93 /* go to infinite loop when usage fault exception occurs */
94 while(1)
95 {
96 }
97}
98
104void SVC_Handler(void)
105{
106}
107
113void DebugMon_Handler(void)
114{
115}
116
122void PendSV_Handler(void)
123{
124}
125
131void SysTick_Handler(void)
132{
133}
134
135
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/can/filter/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/can/filter/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/can/filter/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/can/filter/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/can/filter/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/can/filter/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/can/filter/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/can/filter/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/can/filter/src/at32f413_int.c:113
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • can
  • filter
  • src
project/at_start_f413/examples/can/filter/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37/* extended identifier */
38#define FILTER_EXT_ID1 ((uint32_t)0x18F5F100)
39#define FILTER_EXT_ID2 ((uint32_t)0x18F5F200)
40#define FILTER_EXT_ID3 ((uint32_t)0x18F5F300)
41
42/* standard identifier */
43#define FILTER_STD_ID1 ((uint16_t)0x04F6)
44#define FILTER_STD_ID2 ((uint16_t)0x04F7)
45#define FILTER_STD_ID3 ((uint16_t)0x04F8)
46
47uint8_t test_result = 0;
53static void can_gpio_config(void)
54{
55 gpio_init_type gpio_init_struct;
56
57 crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
58 crm_periph_clock_enable(CRM_IOMUX_PERIPH_CLOCK, TRUE);
59 gpio_pin_remap_config(CAN1_GMUX_0010,TRUE);
60
61 gpio_default_para_init(&gpio_init_struct);
62
63 /* can tx pin */
64 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
65 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
66 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
67 gpio_init_struct.gpio_pins = GPIO_PINS_9;
68 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
69 gpio_init(GPIOB, &gpio_init_struct);
70
71 /* can rx pin */
72 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
73 gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
74 gpio_init_struct.gpio_pins = GPIO_PINS_8;
75 gpio_init_struct.gpio_pull = GPIO_PULL_UP;
76 gpio_init(GPIOB, &gpio_init_struct);
77}
78
86 error_status can_configuration(void)
87{
88 can_base_type can_base_struct;
89 can_baudrate_type can_baudrate_struct;
90 can_filter_init_type can_filter_init_struct;
91
92 /* as specified in CAN protocol, the maximum allowable oscillator tolerance is 1.58%.
93 The HICK accuracy does not meet the clock requirements in CAN protocol. to guarantee normal
94 communication, it is recommended to use HEXT as the system clock source. */
95 if(crm_flag_get(CRM_HEXT_STABLE_FLAG) != SET)
96 {
97 return ERROR;
98 }
99
100 crm_periph_clock_enable(CRM_CAN1_PERIPH_CLOCK, TRUE);
101 /* can base init */
102 can_default_para_init(&can_base_struct);
103 can_base_struct.mode_selection = CAN_MODE_COMMUNICATE;
104 can_base_struct.ttc_enable = FALSE;
105 can_base_struct.aebo_enable = TRUE;
106 can_base_struct.aed_enable = TRUE;
107 can_base_struct.prsf_enable = FALSE;
108 can_base_struct.mdrsel_selection = CAN_DISCARDING_FIRST_RECEIVED;
109 can_base_struct.mmssr_selection = CAN_SENDING_BY_ID;
110 can_base_init(CAN1, &can_base_struct);
111
112 /* can baudrate, set baudrate = pclk/(baudrate_div *(1 + bts1_size + bts2_size)) */
113 can_baudrate_struct.baudrate_div = 8;
114 can_baudrate_struct.rsaw_size = CAN_RSAW_3TQ;
115 can_baudrate_struct.bts1_size = CAN_BTS1_8TQ;
116 can_baudrate_struct.bts2_size = CAN_BTS2_3TQ;
117 if(can_baudrate_set(CAN1, &can_baudrate_struct) != SUCCESS)
118 {
119 return ERROR;
120 }
121
122 /* can filter 0 config */
123 can_filter_init_struct.filter_activate_enable = TRUE;
124 can_filter_init_struct.filter_mode = CAN_FILTER_MODE_ID_LIST;
125 can_filter_init_struct.filter_fifo = CAN_FILTER_FIFO0;
126 can_filter_init_struct.filter_number = 0;
127 can_filter_init_struct.filter_bit = CAN_FILTER_32BIT;
128 can_filter_init_struct.filter_id_high = (((FILTER_EXT_ID1 << 3) >> 16) & 0xFFFF); /* extended identifier is 29 bit */
129 can_filter_init_struct.filter_id_low = ((FILTER_EXT_ID1 << 3) & 0xFFFF) | 0x04;
130 can_filter_init_struct.filter_mask_high = ((FILTER_EXT_ID2 << 3) >> 16) & 0xFFFF; /* extended identifier is 29 bit */
131 can_filter_init_struct.filter_mask_low = ((FILTER_EXT_ID2 << 3) & 0xFFFF) | 0x04;
132 can_filter_init(CAN1, &can_filter_init_struct);
133
134 /* can filter 1 config */
135 can_filter_init_struct.filter_activate_enable = TRUE;
136 can_filter_init_struct.filter_mode = CAN_FILTER_MODE_ID_LIST;
137 can_filter_init_struct.filter_fifo = CAN_FILTER_FIFO0;
138 can_filter_init_struct.filter_number = 1;
139 can_filter_init_struct.filter_bit = CAN_FILTER_32BIT;
140 can_filter_init_struct.filter_id_high = FILTER_STD_ID1 << 5; /* standard identifier is 11 bit */
141 can_filter_init_struct.filter_id_low = 0;
142 can_filter_init_struct.filter_mask_high = FILTER_STD_ID2 << 5;/* standard identifier is 11 bit */
143 can_filter_init_struct.filter_mask_low = 0;
144 can_filter_init(CAN1, &can_filter_init_struct);
145
146 /* can interrupt config */
147 nvic_irq_enable(CAN1_SE_IRQn, 0x00, 0x00);
148 nvic_irq_enable(USBFS_L_CAN1_RX0_IRQn, 0x00, 0x00);
149 can_interrupt_enable(CAN1, CAN_RF0MIEN_INT, TRUE);
150
151 /* error interrupt enable */
152 can_interrupt_enable(CAN1, CAN_ETRIEN_INT, TRUE);
153 can_interrupt_enable(CAN1, CAN_EOIEN_INT, TRUE);
154
155 return SUCCESS;
156}
157
163static void can_transmit_data(void)
164{
165 uint8_t transmit_mailbox;
166 can_tx_message_type tx_message_struct;
167
168 /* transmit FILTER_STD_ID1 */
169 tx_message_struct.standard_id = FILTER_STD_ID1;
170 tx_message_struct.extended_id = 0;
171 tx_message_struct.id_type = CAN_ID_STANDARD;
172 tx_message_struct.frame_type = CAN_TFT_DATA;
173 tx_message_struct.dlc = 8;
174 tx_message_struct.data[0] = 0x11;
175 tx_message_struct.data[1] = 0x22;
176 tx_message_struct.data[2] = 0x33;
177 tx_message_struct.data[3] = 0x44;
178 tx_message_struct.data[4] = 0x55;
179 tx_message_struct.data[5] = 0x66;
180 tx_message_struct.data[6] = 0x77;
181 tx_message_struct.data[7] = 0x88;
182 transmit_mailbox = can_message_transmit(CAN1, &tx_message_struct);
183 while(can_transmit_status_get(CAN1, (can_tx_mailbox_num_type)transmit_mailbox) != CAN_TX_STATUS_SUCCESSFUL);
184
185 /* transmit FILTER_STD_ID2 */
186 tx_message_struct.standard_id = FILTER_STD_ID2;
187 tx_message_struct.extended_id = 0;
188 tx_message_struct.id_type = CAN_ID_STANDARD;
189 tx_message_struct.frame_type = CAN_TFT_DATA;
190 tx_message_struct.dlc = 8;
191 tx_message_struct.data[0] = 0x11;
192 tx_message_struct.data[1] = 0x22;
193 tx_message_struct.data[2] = 0x33;
194 tx_message_struct.data[3] = 0x44;
195 tx_message_struct.data[4] = 0x55;
196 tx_message_struct.data[5] = 0x66;
197 tx_message_struct.data[6] = 0x77;
198 tx_message_struct.data[7] = 0x88;
199 transmit_mailbox = can_message_transmit(CAN1, &tx_message_struct);
200 while(can_transmit_status_get(CAN1, (can_tx_mailbox_num_type)transmit_mailbox) != CAN_TX_STATUS_SUCCESSFUL);
201
202 /* transmit FILTER_STD_ID3 */
203 tx_message_struct.standard_id = FILTER_STD_ID3;
204 tx_message_struct.extended_id = 0;
205 tx_message_struct.id_type = CAN_ID_STANDARD;
206 tx_message_struct.frame_type = CAN_TFT_DATA;
207 tx_message_struct.dlc = 8;
208 tx_message_struct.data[0] = 0x11;
209 tx_message_struct.data[1] = 0x22;
210 tx_message_struct.data[2] = 0x33;
211 tx_message_struct.data[3] = 0x44;
212 tx_message_struct.data[4] = 0x55;
213 tx_message_struct.data[5] = 0x66;
214 tx_message_struct.data[6] = 0x77;
215 tx_message_struct.data[7] = 0x88;
216 transmit_mailbox = can_message_transmit(CAN1, &tx_message_struct);
217 while(can_transmit_status_get(CAN1, (can_tx_mailbox_num_type)transmit_mailbox) != CAN_TX_STATUS_SUCCESSFUL);
218
219 /* transmit FILTER_EXT_ID1 */
220 tx_message_struct.standard_id = 0;
221 tx_message_struct.extended_id = FILTER_EXT_ID1;
222 tx_message_struct.id_type = CAN_ID_EXTENDED;
223 tx_message_struct.frame_type = CAN_TFT_DATA;
224 tx_message_struct.dlc = 8;
225 tx_message_struct.data[0] = 0x11;
226 tx_message_struct.data[1] = 0x22;
227 tx_message_struct.data[2] = 0x33;
228 tx_message_struct.data[3] = 0x44;
229 tx_message_struct.data[4] = 0x55;
230 tx_message_struct.data[5] = 0x66;
231 tx_message_struct.data[6] = 0x77;
232 tx_message_struct.data[7] = 0x88;
233 transmit_mailbox = can_message_transmit(CAN1, &tx_message_struct);
234 while(can_transmit_status_get(CAN1, (can_tx_mailbox_num_type)transmit_mailbox) != CAN_TX_STATUS_SUCCESSFUL);
235
236 /* transmit FILTER_EXT_ID2 */
237 tx_message_struct.standard_id = 0;
238 tx_message_struct.extended_id = FILTER_EXT_ID2;
239 tx_message_struct.id_type = CAN_ID_EXTENDED;
240 tx_message_struct.frame_type = CAN_TFT_DATA;
241 tx_message_struct.dlc = 8;
242 tx_message_struct.data[0] = 0x11;
243 tx_message_struct.data[1] = 0x22;
244 tx_message_struct.data[2] = 0x33;
245 tx_message_struct.data[3] = 0x44;
246 tx_message_struct.data[4] = 0x55;
247 tx_message_struct.data[5] = 0x66;
248 tx_message_struct.data[6] = 0x77;
249 tx_message_struct.data[7] = 0x88;
250 transmit_mailbox = can_message_transmit(CAN1, &tx_message_struct);
251 while(can_transmit_status_get(CAN1, (can_tx_mailbox_num_type)transmit_mailbox) != CAN_TX_STATUS_SUCCESSFUL);
252
253 /* transmit FILTER_EXT_ID3 */
254 tx_message_struct.standard_id = 0;
255 tx_message_struct.extended_id = FILTER_EXT_ID3;
256 tx_message_struct.id_type = CAN_ID_EXTENDED;
257 tx_message_struct.frame_type = CAN_TFT_DATA;
258 tx_message_struct.dlc = 8;
259 tx_message_struct.data[0] = 0x11;
260 tx_message_struct.data[1] = 0x22;
261 tx_message_struct.data[2] = 0x33;
262 tx_message_struct.data[3] = 0x44;
263 tx_message_struct.data[4] = 0x55;
264 tx_message_struct.data[5] = 0x66;
265 tx_message_struct.data[6] = 0x77;
266 tx_message_struct.data[7] = 0x88;
267 transmit_mailbox = can_message_transmit(CAN1, &tx_message_struct);
268 while(can_transmit_status_get(CAN1, (can_tx_mailbox_num_type)transmit_mailbox) != CAN_TX_STATUS_SUCCESSFUL);
269}
270
276void USBFS_L_CAN1_RX0_IRQHandler (void)
277{
278 can_rx_message_type rx_message_struct;
279 if(can_interrupt_flag_get(CAN1,CAN_RF0MN_FLAG) != RESET)
280 {
281 if(test_result == 4)
282 {
283 test_result = 0;
284 }
285
286 can_message_receive(CAN1, CAN_RX_FIFO0, &rx_message_struct);
287
288 if((rx_message_struct.id_type == CAN_ID_STANDARD) && (rx_message_struct.standard_id == FILTER_STD_ID1))
289 test_result++;
290 else if((rx_message_struct.id_type == CAN_ID_STANDARD) && (rx_message_struct.standard_id == FILTER_STD_ID2))
291 test_result++;
292 else if((rx_message_struct.id_type == CAN_ID_EXTENDED) && (rx_message_struct.extended_id == FILTER_EXT_ID1))
293 test_result++;
294 else if((rx_message_struct.id_type == CAN_ID_EXTENDED) && (rx_message_struct.extended_id == FILTER_EXT_ID2))
295 test_result++;
296 }
297}
298
304void CAN1_SE_IRQHandler(void)
305{
306 __IO uint32_t err_index = 0;
307 if(can_interrupt_flag_get(CAN1,CAN_ETR_FLAG) != RESET)
308 {
309 err_index = CAN1->ests & 0x70;
310 can_flag_clear(CAN1, CAN_ETR_FLAG);
311 /* error type is stuff error */
312 if(err_index == 0x00000010)
313 {
314 /* when stuff error occur: in order to ensure communication normally,
315 user must restart can or send a frame of highest priority message here */
316 }
317 }
318}
319
325int main(void)
326{
327 system_clock_config();
328 at32_board_init();
329 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
330 can_gpio_config();
331 if(can_configuration() == ERROR)
332 {
333 /* CAN clock initialization error */
334 while(1)
335 {
336 }
337 }
338 can_transmit_data();
339 while(1)
340 {
341 if(test_result == 4)
342 {
343 at32_led_toggle(LED2);
344 at32_led_toggle(LED3);
345 at32_led_toggle(LED4);
346 delay_sec(1);
347 }
348 }
349}
350
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
CAN1_SE_IRQHandler
void CAN1_SE_IRQHandler(void)
can1 interrupt function se
Definition project/at_start_f413/examples/can/filter/src/main.c:304
FILTER_EXT_ID3
#define FILTER_EXT_ID3
Definition project/at_start_f413/examples/can/filter/src/main.c:40
FILTER_EXT_ID1
#define FILTER_EXT_ID1
Definition project/at_start_f413/examples/can/filter/src/main.c:38
FILTER_STD_ID2
#define FILTER_STD_ID2
Definition project/at_start_f413/examples/can/filter/src/main.c:44
can_transmit_data
static void can_transmit_data(void)
can transmit data
Definition project/at_start_f413/examples/can/filter/src/main.c:163
main
int main(void)
main function.
Definition project/at_start_f413/examples/can/filter/src/main.c:325
USBFS_L_CAN1_RX0_IRQHandler
void USBFS_L_CAN1_RX0_IRQHandler(void)
can1 interrupt function rx0
Definition project/at_start_f413/examples/can/filter/src/main.c:276
FILTER_EXT_ID2
#define FILTER_EXT_ID2
Definition project/at_start_f413/examples/can/filter/src/main.c:39
FILTER_STD_ID3
#define FILTER_STD_ID3
Definition project/at_start_f413/examples/can/filter/src/main.c:45
can_configuration
error_status can_configuration(void)
can configiguration.
Definition project/at_start_f413/examples/can/filter/src/main.c:86
FILTER_STD_ID1
#define FILTER_STD_ID1
Definition project/at_start_f413/examples/can/filter/src/main.c:43
can_gpio_config
static void can_gpio_config(void)
can gpio config
Definition project/at_start_f413/examples/can/filter/src/main.c:53
test_result
uint8_t test_result
Definition project/at_start_f413/examples/can/filter/src/main.c:47
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
delay_sec
void delay_sec(uint16_t sec)
inserts a delay time.
Definition at32f413_board.c:382
can_base_init
error_status can_base_init(can_type *can_x, can_base_type *can_base_struct)
initialize the can peripheral according to the specified parameters in the can_init_struct.
Definition at32f413_can.c:196
can_interrupt_flag_get
flag_status can_interrupt_flag_get(can_type *can_x, uint32_t can_flag)
get interrupt flag of the specified can peripheral.
Definition at32f413_can.c:968
can_transmit_status_get
can_transmit_status_type can_transmit_status_get(can_type *can_x, can_tx_mailbox_num_type transmit_mailbox)
check the transmission state of the specified can peripheral.
Definition at32f413_can.c:516
can_message_transmit
uint8_t can_message_transmit(can_type *can_x, can_tx_message_type *tx_message_struct)
fill the transmission message and transmit of the specified can peripheral.
Definition at32f413_can.c:442
can_message_receive
void can_message_receive(can_type *can_x, can_rx_fifo_num_type fifo_number, can_rx_message_type *rx_message_struct)
receive message of the specified can peripheral.
Definition at32f413_can.c:623
can_interrupt_enable
void can_interrupt_enable(can_type *can_x, uint32_t can_int, confirm_state new_state)
enable or disable the interrupt of the specified can peripheral.
Definition at32f413_can.c:928
can_flag_clear
void can_flag_clear(can_type *can_x, uint32_t can_flag)
clear flag of the specified can peripheral.
Definition at32f413_can.c:1188
can_baudrate_set
error_status can_baudrate_set(can_type *can_x, can_baudrate_type *can_baudrate_struct)
set the baudrate of the can peripheral
Definition at32f413_can.c:101
can_filter_init
void can_filter_init(can_type *can_x, can_filter_init_type *can_filter_init_struct)
initialize the can peripheral according to the specified parameters in the can_filter_init_struct.
Definition at32f413_can.c:306
can_default_para_init
void can_default_para_init(can_base_type *can_base_struct)
fill each can_init_struct member with its default value.
Definition at32f413_can.c:159
can_tx_mailbox_num_type
can_tx_mailbox_num_type
can tx mailboxes
Definition at32f413_can.h:251
CAN_FILTER_FIFO0
@ CAN_FILTER_FIFO0
Definition at32f413_can.h:137
CAN_TX_STATUS_SUCCESSFUL
@ CAN_TX_STATUS_SUCCESSFUL
Definition at32f413_can.h:272
CAN_DISCARDING_FIRST_RECEIVED
@ CAN_DISCARDING_FIRST_RECEIVED
Definition at32f413_can.h:300
CAN_BTS2_3TQ
@ CAN_BTS2_3TQ
Definition at32f413_can.h:221
CAN_TFT_DATA
@ CAN_TFT_DATA
Definition at32f413_can.h:243
CAN_BTS1_8TQ
@ CAN_BTS1_8TQ
Definition at32f413_can.h:203
CAN_FILTER_MODE_ID_LIST
@ CAN_FILTER_MODE_ID_LIST
Definition at32f413_can.h:147
CAN_SENDING_BY_ID
@ CAN_SENDING_BY_ID
Definition at32f413_can.h:309
CAN_FILTER_32BIT
@ CAN_FILTER_32BIT
Definition at32f413_can.h:156
CAN_RX_FIFO0
@ CAN_RX_FIFO0
Definition at32f413_can.h:262
CAN_ID_STANDARD
@ CAN_ID_STANDARD
Definition at32f413_can.h:234
CAN_ID_EXTENDED
@ CAN_ID_EXTENDED
Definition at32f413_can.h:235
CAN_MODE_COMMUNICATE
@ CAN_MODE_COMMUNICATE
Definition at32f413_can.h:164
CAN_RSAW_3TQ
@ CAN_RSAW_3TQ
Definition at32f413_can.h:187
CAN_RF0MN_FLAG
#define CAN_RF0MN_FLAG
Definition at32f413_can.h:71
CAN_ETR_FLAG
#define CAN_ETR_FLAG
Definition at32f413_can.h:66
CAN_RF0MIEN_INT
#define CAN_RF0MIEN_INT
Definition at32f413_can.h:91
CAN_EOIEN_INT
#define CAN_EOIEN_INT
Definition at32f413_can.h:101
CAN_ETRIEN_INT
#define CAN_ETRIEN_INT
Definition at32f413_can.h:100
CAN1
#define CAN1
Definition at32f413_can.h:937
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_IOMUX_PERIPH_CLOCK
@ CRM_IOMUX_PERIPH_CLOCK
Definition at32f413_crm.h:108
CRM_CAN1_PERIPH_CLOCK
@ CRM_CAN1_PERIPH_CLOCK
Definition at32f413_crm.h:138
CRM_GPIOB_PERIPH_CLOCK
@ CRM_GPIOB_PERIPH_CLOCK
Definition at32f413_crm.h:110
CRM_HEXT_STABLE_FLAG
#define CRM_HEXT_STABLE_FLAG
Definition at32f413_crm.h:55
USBFS_L_CAN1_RX0_IRQn
@ USBFS_L_CAN1_RX0_IRQn
Definition at32f413.h:192
CAN1_SE_IRQn
@ CAN1_SE_IRQn
Definition at32f413.h:194
error_status
error_status
error status
Definition at32f413.h:302
ERROR
@ ERROR
Definition at32f413.h:302
SUCCESS
@ SUCCESS
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
SET
@ SET
Definition at32f413.h:292
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_pin_remap_config
void gpio_pin_remap_config(uint32_t gpio_remap, confirm_state new_state)
iomux remap and debug i/o configuration.
Definition at32f413_gpio.c:549
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_PULL_UP
@ GPIO_PULL_UP
Definition at32f413_gpio.h:244
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_9
#define GPIO_PINS_9
Definition at32f413_gpio.h:59
GPIO_PINS_8
#define GPIO_PINS_8
Definition at32f413_gpio.h:58
GPIOB
#define GPIOB
Definition at32f413_gpio.h:748
CAN1_GMUX_0010
#define CAN1_GMUX_0010
Definition at32f413_gpio.h:170
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
at32f413_clock.h
header file of clock program
can_base_type
can init structure definition
Definition at32f413_can.h:332
can_base_type::prsf_enable
confirm_state prsf_enable
Definition at32f413_can.h:341
can_base_type::mdrsel_selection
can_msg_discarding_rule_type mdrsel_selection
Definition at32f413_can.h:343
can_base_type::aed_enable
confirm_state aed_enable
Definition at32f413_can.h:339
can_base_type::mmssr_selection
can_msg_sending_rule_type mmssr_selection
Definition at32f413_can.h:345
can_base_type::ttc_enable
confirm_state ttc_enable
Definition at32f413_can.h:335
can_base_type::mode_selection
can_mode_type mode_selection
Definition at32f413_can.h:333
can_base_type::aebo_enable
confirm_state aebo_enable
Definition at32f413_can.h:337
can_baudrate_type
can baudrate structure definition
Definition at32f413_can.h:353
can_baudrate_type::baudrate_div
uint16_t baudrate_div
Definition at32f413_can.h:354
can_baudrate_type::rsaw_size
can_rsaw_type rsaw_size
Definition at32f413_can.h:356
can_baudrate_type::bts2_size
can_bts2_type bts2_size
Definition at32f413_can.h:360
can_baudrate_type::bts1_size
can_bts1_type bts1_size
Definition at32f413_can.h:358
can_filter_init_type
can filter init structure definition
Definition at32f413_can.h:368
can_filter_init_type::filter_mask_low
uint16_t filter_mask_low
Definition at32f413_can.h:388
can_filter_init_type::filter_number
uint8_t filter_number
Definition at32f413_can.h:375
can_filter_init_type::filter_fifo
can_filter_fifo_type filter_fifo
Definition at32f413_can.h:373
can_filter_init_type::filter_bit
can_filter_bit_width_type filter_bit
Definition at32f413_can.h:377
can_filter_init_type::filter_mode
can_filter_mode_type filter_mode
Definition at32f413_can.h:371
can_filter_init_type::filter_activate_enable
confirm_state filter_activate_enable
Definition at32f413_can.h:369
can_filter_init_type::filter_mask_high
uint16_t filter_mask_high
Definition at32f413_can.h:385
can_filter_init_type::filter_id_high
uint16_t filter_id_high
Definition at32f413_can.h:379
can_filter_init_type::filter_id_low
uint16_t filter_id_low
Definition at32f413_can.h:382
can_rx_message_type
can rx message structure definition
Definition at32f413_can.h:418
can_rx_message_type::standard_id
uint32_t standard_id
Definition at32f413_can.h:419
can_rx_message_type::id_type
can_identifier_type id_type
Definition at32f413_can.h:425
can_rx_message_type::extended_id
uint32_t extended_id
Definition at32f413_can.h:422
can_tx_message_type
can tx message structure definition
Definition at32f413_can.h:396
can_tx_message_type::extended_id
uint32_t extended_id
Definition at32f413_can.h:400
can_tx_message_type::frame_type
can_trans_frame_type frame_type
Definition at32f413_can.h:405
can_tx_message_type::data
uint8_t data[8]
Definition at32f413_can.h:410
can_tx_message_type::dlc
uint8_t dlc
Definition at32f413_can.h:407
can_tx_message_type::id_type
can_identifier_type id_type
Definition at32f413_can.h:403
can_tx_message_type::standard_id
uint32_t standard_id
Definition at32f413_can.h:397
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • can
  • loopback_mode
  • inc
project/at_start_f413/examples/can/loopback_mode/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • can
  • loopback_mode
  • inc
project/at_start_f413/examples/can/loopback_mode/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • can
  • loopback_mode
  • inc
project/at_start_f413/examples/can/loopback_mode/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • can
  • loopback_mode
  • src
project/at_start_f413/examples/can/loopback_mode/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/can/loopback_mode/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • can
  • loopback_mode
  • src
project/at_start_f413/examples/can/loopback_mode/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
43void NMI_Handler(void)
44{
45}
46
52void HardFault_Handler(void)
53{
54 /* go to infinite loop when hard fault exception occurs */
55 while(1)
56 {
57 }
58}
59
65void MemManage_Handler(void)
66{
67 /* go to infinite loop when memory manage exception occurs */
68 while(1)
69 {
70 }
71}
72
78void BusFault_Handler(void)
79{
80 /* go to infinite loop when bus fault exception occurs */
81 while(1)
82 {
83 }
84}
85
91void UsageFault_Handler(void)
92{
93 /* go to infinite loop when usage fault exception occurs */
94 while(1)
95 {
96 }
97}
98
104void SVC_Handler(void)
105{
106}
107
113void DebugMon_Handler(void)
114{
115}
116
122void PendSV_Handler(void)
123{
124}
125
131void SysTick_Handler(void)
132{
133}
134
135
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/can/loopback_mode/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/can/loopback_mode/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/can/loopback_mode/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/can/loopback_mode/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/can/loopback_mode/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/can/loopback_mode/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/can/loopback_mode/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/can/loopback_mode/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/can/loopback_mode/src/at32f413_int.c:113
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • can
  • loopback_mode
  • src
project/at_start_f413/examples/can/loopback_mode/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
42static void can_gpio_config(void)
43{
44 gpio_init_type gpio_init_struct;
45
46 crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
47 crm_periph_clock_enable(CRM_IOMUX_PERIPH_CLOCK, TRUE);
48 gpio_pin_remap_config(CAN1_GMUX_0010,TRUE);
49
50 gpio_default_para_init(&gpio_init_struct);
51 /* can tx pin */
52 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
53 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
54 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
55 gpio_init_struct.gpio_pins = GPIO_PINS_9;
56 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
57 gpio_init(GPIOB, &gpio_init_struct);
58 /* can rx pin */
59 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
60 gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
61 gpio_init_struct.gpio_pins = GPIO_PINS_8;
62 gpio_init_struct.gpio_pull = GPIO_PULL_UP;
63 gpio_init(GPIOB, &gpio_init_struct);
64}
65
73 error_status can_configuration(void)
74{
75 can_base_type can_base_struct;
76 can_baudrate_type can_baudrate_struct;
77 can_filter_init_type can_filter_init_struct;
78
79 /* as specified in CAN protocol, the maximum allowable oscillator tolerance is 1.58%.
80 The HICK accuracy does not meet the clock requirements in CAN protocol. to guarantee normal
81 communication, it is recommended to use HEXT as the system clock source. */
82 if(crm_flag_get(CRM_HEXT_STABLE_FLAG) != SET)
83 {
84 return ERROR;
85 }
86
87 crm_periph_clock_enable(CRM_CAN1_PERIPH_CLOCK, TRUE);
88 /* can base init */
89 can_default_para_init(&can_base_struct);
90 can_base_struct.mode_selection = CAN_MODE_LOOPBACK;
91 can_base_struct.ttc_enable = FALSE;
92 can_base_struct.aebo_enable = TRUE;
93 can_base_struct.aed_enable = TRUE;
94 can_base_struct.prsf_enable = FALSE;
95 can_base_struct.mdrsel_selection = CAN_DISCARDING_FIRST_RECEIVED;
96 can_base_struct.mmssr_selection = CAN_SENDING_BY_ID;
97 can_base_init(CAN1, &can_base_struct);
98
99 /* can baudrate, set baudrate = pclk/(baudrate_div *(1 + bts1_size + bts2_size)) */
100 can_baudrate_struct.baudrate_div = 8;
101 can_baudrate_struct.rsaw_size = CAN_RSAW_3TQ;
102 can_baudrate_struct.bts1_size = CAN_BTS1_8TQ;
103 can_baudrate_struct.bts2_size = CAN_BTS2_3TQ;
104 if(can_baudrate_set(CAN1, &can_baudrate_struct) != SUCCESS)
105 {
106 return ERROR;
107 }
108
109 /* can filter init */
110 can_filter_init_struct.filter_activate_enable = TRUE;
111 can_filter_init_struct.filter_mode = CAN_FILTER_MODE_ID_MASK;
112 can_filter_init_struct.filter_fifo = CAN_FILTER_FIFO0;
113 can_filter_init_struct.filter_number = 0;
114 can_filter_init_struct.filter_bit = CAN_FILTER_32BIT;
115 can_filter_init_struct.filter_id_high = 0;
116 can_filter_init_struct.filter_id_low = 0;
117 can_filter_init_struct.filter_mask_high = 0;
118 can_filter_init_struct.filter_mask_low = 0;
119 can_filter_init(CAN1, &can_filter_init_struct);
120
121 /* can interrupt config */
122 nvic_irq_enable(CAN1_SE_IRQn, 0x00, 0x00);
123 nvic_irq_enable(USBFS_L_CAN1_RX0_IRQn, 0x00, 0x00);
124 can_interrupt_enable(CAN1, CAN_RF0MIEN_INT, TRUE);
125
126 /* error interrupt enable */
127 can_interrupt_enable(CAN1, CAN_ETRIEN_INT, TRUE);
128 can_interrupt_enable(CAN1, CAN_EOIEN_INT, TRUE);
129
130 return SUCCESS;
131}
132
138static void can_transmit_data(void)
139{
140 uint8_t transmit_mailbox;
141 can_tx_message_type tx_message_struct;
142 tx_message_struct.standard_id = 0x400;
143 tx_message_struct.extended_id = 0;
144 tx_message_struct.id_type = CAN_ID_STANDARD;
145 tx_message_struct.frame_type = CAN_TFT_DATA;
146 tx_message_struct.dlc = 8;
147 tx_message_struct.data[0] = 0x11;
148 tx_message_struct.data[1] = 0x22;
149 tx_message_struct.data[2] = 0x33;
150 tx_message_struct.data[3] = 0x44;
151 tx_message_struct.data[4] = 0x55;
152 tx_message_struct.data[5] = 0x66;
153 tx_message_struct.data[6] = 0x77;
154 tx_message_struct.data[7] = 0x88;
155 transmit_mailbox = can_message_transmit(CAN1, &tx_message_struct);
156 while(can_transmit_status_get(CAN1, (can_tx_mailbox_num_type)transmit_mailbox) != CAN_TX_STATUS_SUCCESSFUL);
157}
158
164void USBFS_L_CAN1_RX0_IRQHandler (void)
165{
166 can_rx_message_type rx_message_struct;
167 if(can_interrupt_flag_get(CAN1,CAN_RF0MN_FLAG) != RESET)
168 {
169 can_message_receive(CAN1, CAN_RX_FIFO0, &rx_message_struct);
170 if(rx_message_struct.standard_id == 0x400)
171 at32_led_toggle(LED2);
172 }
173}
174
180void CAN1_SE_IRQHandler(void)
181{
182 __IO uint32_t err_index = 0;
183 if(can_interrupt_flag_get(CAN1,CAN_ETR_FLAG) != RESET)
184 {
185 err_index = CAN1->ests & 0x70;
186 can_flag_clear(CAN1, CAN_ETR_FLAG);
187 /* error type is stuff error */
188 if(err_index == 0x00000010)
189 {
190 /* when stuff error occur: in order to ensure communication normally,
191 user must restart can or send a frame of highest priority message here */
192 }
193 }
194}
195
201int main(void)
202{
203 system_clock_config();
204 at32_board_init();
205 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
206 can_gpio_config();
207 if(can_configuration() == ERROR)
208 {
209 /* CAN clock initialization error */
210 while(1)
211 {
212 }
213 }
214 while(1)
215 {
216 can_transmit_data();
217 at32_led_toggle(LED4);
218 delay_sec(1);
219 }
220}
221
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
CAN1_SE_IRQHandler
void CAN1_SE_IRQHandler(void)
can1 interrupt function se
Definition project/at_start_f413/examples/can/loopback_mode/src/main.c:180
can_transmit_data
static void can_transmit_data(void)
can transmit data
Definition project/at_start_f413/examples/can/loopback_mode/src/main.c:138
main
int main(void)
main function.
Definition project/at_start_f413/examples/can/loopback_mode/src/main.c:201
USBFS_L_CAN1_RX0_IRQHandler
void USBFS_L_CAN1_RX0_IRQHandler(void)
can1 interrupt function rx0
Definition project/at_start_f413/examples/can/loopback_mode/src/main.c:164
can_configuration
error_status can_configuration(void)
can configiguration.
Definition project/at_start_f413/examples/can/loopback_mode/src/main.c:73
can_gpio_config
static void can_gpio_config(void)
can gpio config
Definition project/at_start_f413/examples/can/loopback_mode/src/main.c:42
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
delay_sec
void delay_sec(uint16_t sec)
inserts a delay time.
Definition at32f413_board.c:382
can_base_init
error_status can_base_init(can_type *can_x, can_base_type *can_base_struct)
initialize the can peripheral according to the specified parameters in the can_init_struct.
Definition at32f413_can.c:196
can_interrupt_flag_get
flag_status can_interrupt_flag_get(can_type *can_x, uint32_t can_flag)
get interrupt flag of the specified can peripheral.
Definition at32f413_can.c:968
can_transmit_status_get
can_transmit_status_type can_transmit_status_get(can_type *can_x, can_tx_mailbox_num_type transmit_mailbox)
check the transmission state of the specified can peripheral.
Definition at32f413_can.c:516
can_message_transmit
uint8_t can_message_transmit(can_type *can_x, can_tx_message_type *tx_message_struct)
fill the transmission message and transmit of the specified can peripheral.
Definition at32f413_can.c:442
can_message_receive
void can_message_receive(can_type *can_x, can_rx_fifo_num_type fifo_number, can_rx_message_type *rx_message_struct)
receive message of the specified can peripheral.
Definition at32f413_can.c:623
can_interrupt_enable
void can_interrupt_enable(can_type *can_x, uint32_t can_int, confirm_state new_state)
enable or disable the interrupt of the specified can peripheral.
Definition at32f413_can.c:928
can_flag_clear
void can_flag_clear(can_type *can_x, uint32_t can_flag)
clear flag of the specified can peripheral.
Definition at32f413_can.c:1188
can_baudrate_set
error_status can_baudrate_set(can_type *can_x, can_baudrate_type *can_baudrate_struct)
set the baudrate of the can peripheral
Definition at32f413_can.c:101
can_filter_init
void can_filter_init(can_type *can_x, can_filter_init_type *can_filter_init_struct)
initialize the can peripheral according to the specified parameters in the can_filter_init_struct.
Definition at32f413_can.c:306
can_default_para_init
void can_default_para_init(can_base_type *can_base_struct)
fill each can_init_struct member with its default value.
Definition at32f413_can.c:159
can_tx_mailbox_num_type
can_tx_mailbox_num_type
can tx mailboxes
Definition at32f413_can.h:251
CAN_FILTER_FIFO0
@ CAN_FILTER_FIFO0
Definition at32f413_can.h:137
CAN_TX_STATUS_SUCCESSFUL
@ CAN_TX_STATUS_SUCCESSFUL
Definition at32f413_can.h:272
CAN_DISCARDING_FIRST_RECEIVED
@ CAN_DISCARDING_FIRST_RECEIVED
Definition at32f413_can.h:300
CAN_BTS2_3TQ
@ CAN_BTS2_3TQ
Definition at32f413_can.h:221
CAN_TFT_DATA
@ CAN_TFT_DATA
Definition at32f413_can.h:243
CAN_BTS1_8TQ
@ CAN_BTS1_8TQ
Definition at32f413_can.h:203
CAN_FILTER_MODE_ID_MASK
@ CAN_FILTER_MODE_ID_MASK
Definition at32f413_can.h:146
CAN_SENDING_BY_ID
@ CAN_SENDING_BY_ID
Definition at32f413_can.h:309
CAN_FILTER_32BIT
@ CAN_FILTER_32BIT
Definition at32f413_can.h:156
CAN_RX_FIFO0
@ CAN_RX_FIFO0
Definition at32f413_can.h:262
CAN_ID_STANDARD
@ CAN_ID_STANDARD
Definition at32f413_can.h:234
CAN_MODE_LOOPBACK
@ CAN_MODE_LOOPBACK
Definition at32f413_can.h:165
CAN_RSAW_3TQ
@ CAN_RSAW_3TQ
Definition at32f413_can.h:187
CAN_RF0MN_FLAG
#define CAN_RF0MN_FLAG
Definition at32f413_can.h:71
CAN_ETR_FLAG
#define CAN_ETR_FLAG
Definition at32f413_can.h:66
CAN_RF0MIEN_INT
#define CAN_RF0MIEN_INT
Definition at32f413_can.h:91
CAN_EOIEN_INT
#define CAN_EOIEN_INT
Definition at32f413_can.h:101
CAN_ETRIEN_INT
#define CAN_ETRIEN_INT
Definition at32f413_can.h:100
CAN1
#define CAN1
Definition at32f413_can.h:937
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_IOMUX_PERIPH_CLOCK
@ CRM_IOMUX_PERIPH_CLOCK
Definition at32f413_crm.h:108
CRM_CAN1_PERIPH_CLOCK
@ CRM_CAN1_PERIPH_CLOCK
Definition at32f413_crm.h:138
CRM_GPIOB_PERIPH_CLOCK
@ CRM_GPIOB_PERIPH_CLOCK
Definition at32f413_crm.h:110
CRM_HEXT_STABLE_FLAG
#define CRM_HEXT_STABLE_FLAG
Definition at32f413_crm.h:55
USBFS_L_CAN1_RX0_IRQn
@ USBFS_L_CAN1_RX0_IRQn
Definition at32f413.h:192
CAN1_SE_IRQn
@ CAN1_SE_IRQn
Definition at32f413.h:194
error_status
error_status
error status
Definition at32f413.h:302
ERROR
@ ERROR
Definition at32f413.h:302
SUCCESS
@ SUCCESS
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
SET
@ SET
Definition at32f413.h:292
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_pin_remap_config
void gpio_pin_remap_config(uint32_t gpio_remap, confirm_state new_state)
iomux remap and debug i/o configuration.
Definition at32f413_gpio.c:549
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_PULL_UP
@ GPIO_PULL_UP
Definition at32f413_gpio.h:244
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_9
#define GPIO_PINS_9
Definition at32f413_gpio.h:59
GPIO_PINS_8
#define GPIO_PINS_8
Definition at32f413_gpio.h:58
GPIOB
#define GPIOB
Definition at32f413_gpio.h:748
CAN1_GMUX_0010
#define CAN1_GMUX_0010
Definition at32f413_gpio.h:170
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
at32f413_clock.h
header file of clock program
can_base_type
can init structure definition
Definition at32f413_can.h:332
can_base_type::prsf_enable
confirm_state prsf_enable
Definition at32f413_can.h:341
can_base_type::mdrsel_selection
can_msg_discarding_rule_type mdrsel_selection
Definition at32f413_can.h:343
can_base_type::aed_enable
confirm_state aed_enable
Definition at32f413_can.h:339
can_base_type::mmssr_selection
can_msg_sending_rule_type mmssr_selection
Definition at32f413_can.h:345
can_base_type::ttc_enable
confirm_state ttc_enable
Definition at32f413_can.h:335
can_base_type::mode_selection
can_mode_type mode_selection
Definition at32f413_can.h:333
can_base_type::aebo_enable
confirm_state aebo_enable
Definition at32f413_can.h:337
can_baudrate_type
can baudrate structure definition
Definition at32f413_can.h:353
can_baudrate_type::baudrate_div
uint16_t baudrate_div
Definition at32f413_can.h:354
can_baudrate_type::rsaw_size
can_rsaw_type rsaw_size
Definition at32f413_can.h:356
can_baudrate_type::bts2_size
can_bts2_type bts2_size
Definition at32f413_can.h:360
can_baudrate_type::bts1_size
can_bts1_type bts1_size
Definition at32f413_can.h:358
can_filter_init_type
can filter init structure definition
Definition at32f413_can.h:368
can_filter_init_type::filter_mask_low
uint16_t filter_mask_low
Definition at32f413_can.h:388
can_filter_init_type::filter_number
uint8_t filter_number
Definition at32f413_can.h:375
can_filter_init_type::filter_fifo
can_filter_fifo_type filter_fifo
Definition at32f413_can.h:373
can_filter_init_type::filter_bit
can_filter_bit_width_type filter_bit
Definition at32f413_can.h:377
can_filter_init_type::filter_mode
can_filter_mode_type filter_mode
Definition at32f413_can.h:371
can_filter_init_type::filter_activate_enable
confirm_state filter_activate_enable
Definition at32f413_can.h:369
can_filter_init_type::filter_mask_high
uint16_t filter_mask_high
Definition at32f413_can.h:385
can_filter_init_type::filter_id_high
uint16_t filter_id_high
Definition at32f413_can.h:379
can_filter_init_type::filter_id_low
uint16_t filter_id_low
Definition at32f413_can.h:382
can_rx_message_type
can rx message structure definition
Definition at32f413_can.h:418
can_rx_message_type::standard_id
uint32_t standard_id
Definition at32f413_can.h:419
can_tx_message_type
can tx message structure definition
Definition at32f413_can.h:396
can_tx_message_type::extended_id
uint32_t extended_id
Definition at32f413_can.h:400
can_tx_message_type::frame_type
can_trans_frame_type frame_type
Definition at32f413_can.h:405
can_tx_message_type::data
uint8_t data[8]
Definition at32f413_can.h:410
can_tx_message_type::dlc
uint8_t dlc
Definition at32f413_can.h:407
can_tx_message_type::id_type
can_identifier_type id_type
Definition at32f413_can.h:403
can_tx_message_type::standard_id
uint32_t standard_id
Definition at32f413_can.h:397
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • cortex_m4
  • bit_band
  • inc
project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • cortex_m4
  • bit_band
  • inc
project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • cortex_m4
  • bit_band
  • inc
project/at_start_f413/examples/cortex_m4/bit_band/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • cortex_m4
  • bit_band
  • src
project/at_start_f413/examples/cortex_m4/bit_band/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/cortex_m4/bit_band/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • cortex_m4
  • bit_band
  • src
project/at_start_f413/examples/cortex_m4/bit_band/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
43void NMI_Handler(void)
44{
45}
46
52void HardFault_Handler(void)
53{
54 /* go to infinite loop when hard fault exception occurs */
55 while(1)
56 {
57 }
58}
59
65void MemManage_Handler(void)
66{
67 /* go to infinite loop when memory manage exception occurs */
68 while(1)
69 {
70 }
71}
72
78void BusFault_Handler(void)
79{
80 /* go to infinite loop when bus fault exception occurs */
81 while(1)
82 {
83 }
84}
85
91void UsageFault_Handler(void)
92{
93 /* go to infinite loop when usage fault exception occurs */
94 while(1)
95 {
96 }
97}
98
104void SVC_Handler(void)
105{
106}
107
113void DebugMon_Handler(void)
114{
115}
116
122void PendSV_Handler(void)
123{
124}
125
131void SysTick_Handler(void)
132{
133}
134
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/cortex_m4/bit_band/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/cortex_m4/bit_band/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/cortex_m4/bit_band/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/cortex_m4/bit_band/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/cortex_m4/bit_band/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/cortex_m4/bit_band/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/cortex_m4/bit_band/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/cortex_m4/bit_band/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/cortex_m4/bit_band/src/at32f413_int.c:113
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • cortex_m4
  • bit_band
  • src
project/at_start_f413/examples/cortex_m4/bit_band/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
38/* bit band for sram */
39#define RAM_BASE 0x20000000
40#define RAM_BITBAND_BASE 0x22000000
41
42#define VARIABLES_RESET_BIT(variables_addr, bit_number) \
43 (*(uint32_t *)(RAM_BITBAND_BASE + ((variables_addr - RAM_BASE) * 32) + ((bit_number) * 4)) = 0)
44
45#define VARIABLES_SET_BIT(variables_addr, bit_number) \
46 (*(uint32_t *)(RAM_BITBAND_BASE + ((variables_addr - RAM_BASE) * 32) + ((bit_number) * 4)) = 1)
47
48#define VARIABLES_GET_BIT(variables_addr, bit_number) \
49 (*(uint32_t *)(RAM_BITBAND_BASE + ((variables_addr - RAM_BASE) * 32) + ((bit_number) * 4)))
50
51/* bit band for peripheral */
52#define PERIPHERAL_BASE 0x40000000
53#define PERIPHERAL_BITBAND_BASE 0x42000000
54
55#define PERIPHERAL_RESET_BIT(peripheral_addr, bit_number) \
56 (*(uint32_t *)(PERIPHERAL_BITBAND_BASE + ((peripheral_addr - PERIPHERAL_BASE) * 32) + ((bit_number) * 4)) = 0)
57
58#define PERIPHERAL_SET_BIT(peripheral_addr, bit_number) \
59 (*(uint32_t *)(PERIPHERAL_BITBAND_BASE + ((peripheral_addr - PERIPHERAL_BASE) * 32) + ((bit_number) * 4)) = 1)
60
61__IO uint32_t variables, variables_addr = 0, variables_bit_val = 0;
62
68void result_error(void)
69{
70 while(1)
71 {
72 at32_led_toggle(LED4);
73 delay_sec(1);
74 }
75}
76
82int main(void)
83{
84 system_clock_config();
85 at32_board_init();
86 variables = 0xA5A5A5A5;
87
88 /* get the variables address */
89 variables_addr = (uint32_t)&variables;
90
91 /* modify variables bit0 and check result */
92 VARIABLES_RESET_BIT(variables_addr, 0);
93 if((variables != 0xA5A5A5A4) || (VARIABLES_GET_BIT(variables_addr, 0) != 0))
94 {
95 result_error();
96 }
97
98 /* modify variables bit0 and check result */
99 VARIABLES_SET_BIT(variables_addr, 0);
100 if((variables != 0xA5A5A5A5) || (VARIABLES_GET_BIT(variables_addr, 0) != 1))
101 {
102 result_error();
103 }
104
105 /* modify variables bit16 and check result */
106 VARIABLES_RESET_BIT(variables_addr, 16);
107 if((variables != 0xA5A4A5A5) || (VARIABLES_GET_BIT(variables_addr, 16) != 0))
108 {
109 result_error();
110 }
111
112 /* modify variables bit16 and check result */
113 VARIABLES_SET_BIT(variables_addr, 16);
114 if((variables != 0xA5A5A5A5) || (VARIABLES_GET_BIT(variables_addr, 16) != 1))
115 {
116 result_error();
117 }
118
119 /* modify variables bit31 and check result */
120 VARIABLES_RESET_BIT(variables_addr, 31);
121 if((variables != 0x25A5A5A5) || (VARIABLES_GET_BIT(variables_addr, 31) != 0))
122 {
123 result_error();
124 }
125
126 /* modify variables bit31 and check result */
127 VARIABLES_SET_BIT(variables_addr, 31);
128 if((variables != 0xA5A5A5A5) || (VARIABLES_GET_BIT(variables_addr, 31) != 1))
129 {
130 result_error();
131 }
132
133 while(1)
134 {
135 /* led2 toggle */
136 PERIPHERAL_RESET_BIT((uint32_t)&LED2_GPIO->odt, 2);
137 delay_ms(500);
138 PERIPHERAL_SET_BIT((uint32_t)&LED2_GPIO->odt, 2);
139 delay_ms(500);
140 }
141}
142
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
variables
__IO uint32_t variables
Definition project/at_start_f413/examples/cortex_m4/bit_band/src/main.c:61
variables_addr
__IO uint32_t variables_addr
Definition project/at_start_f413/examples/cortex_m4/bit_band/src/main.c:61
variables_bit_val
__IO uint32_t variables_bit_val
Definition project/at_start_f413/examples/cortex_m4/bit_band/src/main.c:61
PERIPHERAL_SET_BIT
#define PERIPHERAL_SET_BIT(peripheral_addr, bit_number)
Definition project/at_start_f413/examples/cortex_m4/bit_band/src/main.c:58
main
int main(void)
main function.
Definition project/at_start_f413/examples/cortex_m4/bit_band/src/main.c:82
result_error
void result_error(void)
led4 flick for error.
Definition project/at_start_f413/examples/cortex_m4/bit_band/src/main.c:68
VARIABLES_SET_BIT
#define VARIABLES_SET_BIT(variables_addr, bit_number)
Definition project/at_start_f413/examples/cortex_m4/bit_band/src/main.c:45
PERIPHERAL_RESET_BIT
#define PERIPHERAL_RESET_BIT(peripheral_addr, bit_number)
Definition project/at_start_f413/examples/cortex_m4/bit_band/src/main.c:55
VARIABLES_RESET_BIT
#define VARIABLES_RESET_BIT(variables_addr, bit_number)
Definition project/at_start_f413/examples/cortex_m4/bit_band/src/main.c:42
VARIABLES_GET_BIT
#define VARIABLES_GET_BIT(variables_addr, bit_number)
Definition project/at_start_f413/examples/cortex_m4/bit_band/src/main.c:48
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
LED4
@ LED4
Definition at32f413_board.h:64
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
delay_sec
void delay_sec(uint16_t sec)
inserts a delay time.
Definition at32f413_board.c:382
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • cortex_m4
  • cmsis_dsp
  • inc
project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • cortex_m4
  • cmsis_dsp
  • inc
project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • cortex_m4
  • cmsis_dsp
  • inc
project/at_start_f413/examples/cortex_m4/cmsis_dsp/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • cortex_m4
  • cmsis_dsp
  • src
project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • cortex_m4
  • cmsis_dsp
  • src
project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
43void NMI_Handler(void)
44{
45}
46
52void HardFault_Handler(void)
53{
54 /* go to infinite loop when hard fault exception occurs */
55 while(1)
56 {
57 }
58}
59
65void MemManage_Handler(void)
66{
67 /* go to infinite loop when memory manage exception occurs */
68 while(1)
69 {
70 }
71}
72
78void BusFault_Handler(void)
79{
80 /* go to infinite loop when bus fault exception occurs */
81 while(1)
82 {
83 }
84}
85
91void UsageFault_Handler(void)
92{
93 /* go to infinite loop when usage fault exception occurs */
94 while(1)
95 {
96 }
97}
98
104void SVC_Handler(void)
105{
106}
107
113void DebugMon_Handler(void)
114{
115}
116
122void PendSV_Handler(void)
123{
124}
125
131void SysTick_Handler(void)
132{
133}
134
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/at32f413_int.c:113
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • cortex_m4
  • cmsis_dsp
  • src
project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include "arm_math.h"
29
38#define USE_STATIC_INIT
39
40 /* Global defines */
41
42#define TEST_LENGTH_SAMPLES (20*4)
43
44/* List of Marks scored by 20 students for 4 subjects */
45const float32_t testMarks_f32[TEST_LENGTH_SAMPLES] =
46{
47 42.000000, 37.000000, 81.000000, 28.000000,
48 83.000000, 72.000000, 36.000000, 38.000000,
49 32.000000, 51.000000, 63.000000, 64.000000,
50 97.000000, 82.000000, 95.000000, 90.000000,
51 66.000000, 51.000000, 54.000000, 42.000000,
52 67.000000, 56.000000, 45.000000, 57.000000,
53 67.000000, 69.000000, 35.000000, 52.000000,
54 29.000000, 81.000000, 58.000000, 47.000000,
55 38.000000, 76.000000, 100.000000, 29.000000,
56 33.000000, 47.000000, 29.000000, 50.000000,
57 34.000000, 41.000000, 61.000000, 46.000000,
58 52.000000, 50.000000, 48.000000, 36.000000,
59 47.000000, 55.000000, 44.000000, 40.000000,
60 100.000000, 94.000000, 84.000000, 37.000000,
61 32.000000, 71.000000, 47.000000, 77.000000,
62 31.000000, 50.000000, 49.000000, 35.000000,
63 63.000000, 67.000000, 40.000000, 31.000000,
64 29.000000, 68.000000, 61.000000, 38.000000,
65 31.000000, 28.000000, 28.000000, 76.000000,
66 55.000000, 33.000000, 29.000000, 39.000000
67};
68
69
70/* Number of subjects X 1 */
71const float32_t testUnity_f32[4] =
72{
73 1.000, 1.000, 1.000, 1.000
74};
75
76
77/* f32 Output buffer */
78static float32_t testOutput[TEST_LENGTH_SAMPLES];
79
80
81/* Global defines */
82#define NUMSTUDENTS 20
83#define NUMSUBJECTS 4
84
85/* Global variables */
86
87uint32_t numStudents = 20;
88uint32_t numSubjects = 4;
89float32_t max_marks, min_marks, mean, std, var;
90uint32_t student_num;
91
97int32_t main()
98{
99#ifndef USE_STATIC_INIT
100 arm_matrix_instance_f32 srcA;
101 arm_matrix_instance_f32 srcB;
102 arm_matrix_instance_f32 dstC;
103
104 /* Input and output matrices initializations */
105 arm_mat_init_f32(&srcA, numStudents, numSubjects, (float32_t *)testMarks_f32);
106 arm_mat_init_f32(&srcB, numSubjects, 1, (float32_t *)testUnity_f32);
107 arm_mat_init_f32(&dstC, numStudents, 1, testOutput);
108#else
109 /* Static Initializations of Input and output matrix sizes and array */
110 arm_matrix_instance_f32 srcA = {NUMSTUDENTS, NUMSUBJECTS, (float32_t *)testMarks_f32};
111 arm_matrix_instance_f32 srcB = {NUMSUBJECTS, 1, (float32_t *)testUnity_f32};
112 arm_matrix_instance_f32 dstC = {NUMSTUDENTS, 1, testOutput};
113#endif
114 system_clock_config();
115
116 uart_print_init(115200);
117
118 /* Call the Matrix multiplication process function */
119 arm_mat_mult_f32(&srcA, &srcB, &dstC);
120
121 /* Call the Max function to calculate max marks among numStudents */
122 arm_max_f32(testOutput, numStudents, &max_marks, &student_num);
123
124 /* Call the Min function to calculate min marks among numStudents */
125 arm_min_f32(testOutput, numStudents, &min_marks, &student_num);
126
127 /* Call the Mean function to calculate mean */
128 arm_mean_f32(testOutput, numStudents, &mean);
129
130 /* Call the std function to calculate standard deviation */
131 arm_std_f32(testOutput, numStudents, &std);
132
133 /* Call the var function to calculate variance */
134 arm_var_f32(testOutput, numStudents, &var);
135
136 printf("max_marks = %f, min_marks = %f, mean = %f, std = %f, var = %f\n", max_marks, min_marks, mean, std, var);
137
138 while (1);
139}
140
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
testMarks_f32
const float32_t testMarks_f32[(20 *4)]
Definition project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c:45
std
float32_t std
Definition project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c:89
main
int32_t main()
main function.
Definition project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c:97
var
float32_t var
Definition project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c:89
numSubjects
uint32_t numSubjects
Definition project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c:88
student_num
uint32_t student_num
Definition project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c:90
NUMSUBJECTS
#define NUMSUBJECTS
Definition project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c:83
testUnity_f32
const float32_t testUnity_f32[4]
Definition project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c:71
NUMSTUDENTS
#define NUMSTUDENTS
Definition project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c:82
max_marks
float32_t max_marks
Definition project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c:89
numStudents
uint32_t numStudents
Definition project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c:87
min_marks
float32_t min_marks
Definition project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c:89
TEST_LENGTH_SAMPLES
#define TEST_LENGTH_SAMPLES
Definition project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c:42
mean
float32_t mean
Definition project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c:89
testOutput
static float32_t testOutput[(20 *4)]
Definition project/at_start_f413/examples/cortex_m4/cmsis_dsp/src/main.c:78
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
uart_print_init
void uart_print_init(uint32_t baudrate)
initialize uart
Definition at32f413_board.c:129
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • cortex_m4
  • fpu
  • inc
project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • cortex_m4
  • fpu
  • inc
project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • cortex_m4
  • fpu
  • inc
project/at_start_f413/examples/cortex_m4/fpu/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • cortex_m4
  • fpu
  • src
project/at_start_f413/examples/cortex_m4/fpu/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/cortex_m4/fpu/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • cortex_m4
  • fpu
  • src
project/at_start_f413/examples/cortex_m4/fpu/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
29
44void NMI_Handler(void)
45{
46}
47
53void HardFault_Handler(void)
54{
55 /* go to infinite loop when hard fault exception occurs */
56 while(1)
57 {
58 }
59}
60
66void MemManage_Handler(void)
67{
68 /* go to infinite loop when memory manage exception occurs */
69 while(1)
70 {
71 }
72}
73
79void BusFault_Handler(void)
80{
81 /* go to infinite loop when bus fault exception occurs */
82 while(1)
83 {
84 }
85}
86
92void UsageFault_Handler(void)
93{
94 /* go to infinite loop when usage fault exception occurs */
95 while(1)
96 {
97 }
98}
99
105void SVC_Handler(void)
106{
107}
108
114void DebugMon_Handler(void)
115{
116}
117
123void PendSV_Handler(void)
124{
125}
126
132void SysTick_Handler(void)
133{
134}
135
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/cortex_m4/fpu/src/at32f413_int.c:92
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/cortex_m4/fpu/src/at32f413_int.c:53
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/cortex_m4/fpu/src/at32f413_int.c:66
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/cortex_m4/fpu/src/at32f413_int.c:105
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/cortex_m4/fpu/src/at32f413_int.c:123
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/cortex_m4/fpu/src/at32f413_int.c:44
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/cortex_m4/fpu/src/at32f413_int.c:79
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/cortex_m4/fpu/src/at32f413_int.c:132
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/cortex_m4/fpu/src/at32f413_int.c:114
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • cortex_m4
  • fpu
  • src
project/at_start_f413/examples/cortex_m4/fpu/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include "julia_fpu.h"
29
38#define SCREEN_X_SIZE ((uint16_t)160)
39#define SCREEN_Y_SIZE ((uint16_t)120)
40#define ZOOM ((uint16_t)100)
41
42uint8_t buffer[SCREEN_X_SIZE * SCREEN_Y_SIZE];
43
49int main(void)
50{
51 system_clock_config();
52
53 at32_board_init();
54
55 while(1)
56 {
57 at32_led_toggle(LED4);
58
59 generate_julia_fpu(SCREEN_X_SIZE, SCREEN_Y_SIZE, SCREEN_X_SIZE / 2, SCREEN_Y_SIZE / 2, ZOOM, buffer);
60 }
61}
62
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
SCREEN_X_SIZE
#define SCREEN_X_SIZE
Definition project/at_start_f413/examples/cortex_m4/fpu/src/main.c:38
main
int main(void)
main function.
Definition project/at_start_f413/examples/cortex_m4/fpu/src/main.c:49
ZOOM
#define ZOOM
Definition project/at_start_f413/examples/cortex_m4/fpu/src/main.c:40
SCREEN_Y_SIZE
#define SCREEN_Y_SIZE
Definition project/at_start_f413/examples/cortex_m4/fpu/src/main.c:39
buffer
uint8_t buffer[((uint16_t) 160) *((uint16_t) 120)]
Definition project/at_start_f413/examples/cortex_m4/fpu/src/main.c:42
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
generate_julia_fpu
void generate_julia_fpu(uint16_t size_x, uint16_t size_y, uint16_t offset_x, uint16_t offset_y, uint16_t zoom, uint8_t *buffer)
julia calculation test with fpu option enable or disable
Definition julia_fpu.c:47
julia_fpu.h
julia_fpu header file
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • cortex_m4
  • systick_interrupt
  • inc
project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • cortex_m4
  • systick_interrupt
  • inc
project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • cortex_m4
  • systick_interrupt
  • inc
project/at_start_f413/examples/cortex_m4/systick_interrupt/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • cortex_m4
  • systick_interrupt
  • src
project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • cortex_m4
  • systick_interrupt
  • src
project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
29extern void systick_handler(void);
30
44void NMI_Handler(void)
45{
46}
47
53void HardFault_Handler(void)
54{
55 /* go to infinite loop when hard fault exception occurs */
56 while(1)
57 {
58 }
59}
60
66void MemManage_Handler(void)
67{
68 /* go to infinite loop when memory manage exception occurs */
69 while(1)
70 {
71 }
72}
73
79void BusFault_Handler(void)
80{
81 /* go to infinite loop when bus fault exception occurs */
82 while(1)
83 {
84 }
85}
86
92void UsageFault_Handler(void)
93{
94 /* go to infinite loop when usage fault exception occurs */
95 while(1)
96 {
97 }
98}
99
105void SVC_Handler(void)
106{
107}
108
114void DebugMon_Handler(void)
115{
116}
117
123void PendSV_Handler(void)
124{
125}
126
132void SysTick_Handler(void)
133{
134 systick_handler();
135}
136
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_int.c:92
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_int.c:53
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_int.c:66
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_int.c:105
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_int.c:123
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_int.c:44
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_int.c:79
systick_handler
void systick_handler(void)
systick interrupt handler.
Definition project/at_start_f413/examples/cortex_m4/systick_interrupt/src/main.c:45
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_int.c:132
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/cortex_m4/systick_interrupt/src/at32f413_int.c:114
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • cortex_m4
  • systick_interrupt
  • src
project/at_start_f413/examples/cortex_m4/systick_interrupt/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37#define MS_TICK (system_core_clock / 1000U)
38#define DELAY 200 /* 200 ms ticks */
39
45void systick_handler(void)
46{
47 static uint32_t ticks = 0;
48
49 ticks ++;
50
51 /* toggle led */
52 if(ticks >= DELAY)
53 {
54 at32_led_toggle(LED2);
55 ticks = 0;
56 }
57}
58
64static uint32_t systick_interrupt_config(uint32_t ticks)
65{
66 if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
67 {
68 return (1UL);
69 }
70
71 SysTick->LOAD = (uint32_t)(ticks - 1UL);
72 NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL);
73 SysTick->VAL = 0UL;
74 SysTick->CTRL |= SysTick_CTRL_TICKINT_Msk |
75 SysTick_CTRL_ENABLE_Msk;
76 return (0UL);
77}
78
84int main(void)
85{
86 system_clock_config();
87
88 /* config systick clock source */
89 systick_clock_source_config(SYSTICK_CLOCK_SOURCE_AHBCLK_NODIV);
90
91 /* config systick reload value and enable interrupt */
92 systick_interrupt_config(MS_TICK);
93
94 /* configure led */
95 at32_led_init(LED2);
96
97 while(1)
98 {
99 }
100}
101
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
MS_TICK
#define MS_TICK
Definition project/at_start_f413/examples/cortex_m4/systick_interrupt/src/main.c:37
DELAY
#define DELAY
Definition project/at_start_f413/examples/cortex_m4/systick_interrupt/src/main.c:38
main
int main(void)
main function.
Definition project/at_start_f413/examples/cortex_m4/systick_interrupt/src/main.c:84
systick_handler
void systick_handler(void)
systick interrupt handler.
Definition project/at_start_f413/examples/cortex_m4/systick_interrupt/src/main.c:45
systick_interrupt_config
static uint32_t systick_interrupt_config(uint32_t ticks)
config systick and enable interrupt.
Definition project/at_start_f413/examples/cortex_m4/systick_interrupt/src/main.c:64
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
LED2
@ LED2
Definition at32f413_board.h:62
at32_led_init
void at32_led_init(led_type led)
configure led gpio
Definition at32f413_board.c:242
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
__NVIC_PRIO_BITS
#define __NVIC_PRIO_BITS
Definition at32f413.h:148
SysTick_IRQn
@ SysTick_IRQn
Definition at32f413.h:168
systick_clock_source_config
void systick_clock_source_config(systick_clock_source_type source)
config systick clock source
Definition at32f413_misc.c:146
SYSTICK_CLOCK_SOURCE_AHBCLK_NODIV
@ SYSTICK_CLOCK_SOURCE_AHBCLK_NODIV
Definition at32f413_misc.h:89
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • crc
  • calculation
  • inc
project/at_start_f413/examples/crc/calculation/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • crc
  • calculation
  • inc
project/at_start_f413/examples/crc/calculation/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • crc
  • calculation
  • inc
project/at_start_f413/examples/crc/calculation/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • crc
  • calculation
  • src
project/at_start_f413/examples/crc/calculation/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/crc/calculation/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • crc
  • calculation
  • src
project/at_start_f413/examples/crc/calculation/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/crc/calculation/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/crc/calculation/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/crc/calculation/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/crc/calculation/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/crc/calculation/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/crc/calculation/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/crc/calculation/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/crc/calculation/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/crc/calculation/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • crc
  • calculation
  • src
project/at_start_f413/examples/crc/calculation/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37#define BUFFER_SIZE 120
38
39static const uint32_t data_buffer[BUFFER_SIZE] =
40{
41 0xc33dd31c, 0xe37ff35e, 0x129022f3, 0x32d24235, 0x52146277, 0x7256b5ea,
42 0x4a755a54, 0x6a377a16, 0x0af11ad0, 0x2ab33a92, 0xed0fdd6c, 0xcd4dbdaa,
43 0xbb3bab1a, 0x6ca67c87, 0x5cc52c22, 0x3c030c60, 0x1c41edae, 0xfd8fcdec,
44 0xad8b9de8, 0x8dc97c26, 0x5c644c45, 0x3ca22c83, 0x1ce00cc1, 0xef1fff3e,
45 0x95a88589, 0xf56ee54f, 0xd52cc50d, 0x34e224c3, 0x04817466, 0x64475424,
46 0x78066827, 0x18c008e1, 0x28a3cb7d, 0xdb5ceb3f, 0xfb1e8bf9, 0x9bd8abbb,
47 0xdf7caf9b, 0xbfba8fd9, 0x9ff86e17, 0x7e364e55, 0x2e933eb2, 0x0ed11ef0,
48 0xa35ad3bd, 0xc39cf3ff, 0xe3de2462, 0x34430420, 0x64e674c7, 0x44a45485,
49 0xad2abd0b, 0x8d689d49, 0x7e976eb6, 0x5ed54ef4, 0x2e321e51, 0x0e70ff9f,
50 0xefbedfdd, 0xcffcbf1b, 0x9f598f78, 0x918881a9, 0xb1caa1eb, 0xd10cc12d,
51 0xe16f1080, 0x00a130c2, 0x20e35004, 0x40257046, 0x83b99398, 0xa3fbb3da,
52 0x00001021, 0x20423063, 0x408450a5, 0x60c670e7, 0x9129a14a, 0xb16bc18c,
53 0x569546b4, 0xb75ba77a, 0x97198738, 0xf7dfe7fe, 0xc7bc48c4, 0x58e56886,
54 0x4405a7db, 0xb7fa8799, 0xe75ff77e, 0xc71dd73c, 0x26d336f2, 0x069116b0,
55 0x76764615, 0x5634d94c, 0xc96df90e, 0xe92f99c8, 0xb98aa9ab, 0x58444865,
56 0x78a70840, 0x18612802, 0xc9ccd9ed, 0xe98ef9af, 0x89489969, 0xa90ab92b,
57 0xd1ade1ce, 0xf1ef1231, 0x32732252, 0x52b54294, 0x72f762d6, 0x93398318,
58 0xa56ab54b, 0x85289509, 0xf5cfc5ac, 0xd58d3653, 0x26721611, 0x063076d7,
59 0x8d689d49, 0xf7dfe7fe, 0xe98ef9af, 0x063076d7, 0x93398318, 0xb98aa9ab,
60 0x4ad47ab7, 0x6a961a71, 0x0a503a33, 0x2a12dbfd, 0xfbbfeb9e, 0x9b798b58
61};
62
63__IO uint32_t crc_value = 0;
64
70int main(void)
71{
72 system_clock_config();
73
74 at32_board_init();
75
76 /* enable crc clock */
77 crm_periph_clock_enable(CRM_CRC_PERIPH_CLOCK, TRUE);
78
79 crc_data_reset();
80
81 /* compute the crc of "data_buffer" */
82 crc_value = crc_block_calculate((uint32_t *)data_buffer, BUFFER_SIZE);
83
84 if(crc_value == 0xE5DFCF6D)
85 {
86 /* turn on led3 */
87 at32_led_on(LED3);
88 }
89 else
90 {
91 /* turn on led4 */
92 at32_led_on(LED4);
93 }
94
95 while(1)
96 {
97 }
98}
99
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
BUFFER_SIZE
#define BUFFER_SIZE
Definition project/at_start_f413/examples/crc/calculation/src/main.c:37
data_buffer
static const uint32_t data_buffer[120]
Definition project/at_start_f413/examples/crc/calculation/src/main.c:39
main
int main(void)
main function.
Definition project/at_start_f413/examples/crc/calculation/src/main.c:70
crc_value
__IO uint32_t crc_value
Definition project/at_start_f413/examples/crc/calculation/src/main.c:63
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
LED3
@ LED3
Definition at32f413_board.h:63
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crc_block_calculate
uint32_t crc_block_calculate(uint32_t *pbuffer, uint32_t length)
compute the 32-bit crc of a given buffer of data word(32-bit).
Definition at32f413_crc.c:71
crc_data_reset
void crc_data_reset(void)
reset the crc data register.
Definition at32f413_crc.c:48
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_CRC_PERIPH_CLOCK
@ CRM_CRC_PERIPH_CLOCK
Definition at32f413_crm.h:105
TRUE
@ TRUE
Definition at32f413.h:297
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • crm
  • clock_failure_detection
  • inc
project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • crm
  • clock_failure_detection
  • inc
project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • crm
  • clock_failure_detection
  • inc
project/at_start_f413/examples/crm/clock_failure_detection/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • crm
  • clock_failure_detection
  • src
project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • crm
  • clock_failure_detection
  • src
project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
29extern void clock_failure_detection_handler(void);
30
44void NMI_Handler(void)
45{
46 clock_failure_detection_handler();
47}
48
54void HardFault_Handler(void)
55{
56 /* go to infinite loop when hard fault exception occurs */
57 while(1)
58 {
59 }
60}
61
67void MemManage_Handler(void)
68{
69 /* go to infinite loop when memory manage exception occurs */
70 while(1)
71 {
72 }
73}
74
80void BusFault_Handler(void)
81{
82 /* go to infinite loop when bus fault exception occurs */
83 while(1)
84 {
85 }
86}
87
93void UsageFault_Handler(void)
94{
95 /* go to infinite loop when usage fault exception occurs */
96 while(1)
97 {
98 }
99}
100
106void SVC_Handler(void)
107{
108}
109
115void DebugMon_Handler(void)
116{
117}
118
124void PendSV_Handler(void)
125{
126}
127
133void SysTick_Handler(void)
134{
135}
136
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_int.c:93
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_int.c:54
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_int.c:67
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_int.c:106
clock_failure_detection_handler
void clock_failure_detection_handler(void)
clock failure detection handler.
Definition project/at_start_f413/examples/crm/clock_failure_detection/src/main.c:75
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_int.c:124
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_int.c:44
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_int.c:80
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_int.c:133
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/crm/clock_failure_detection/src/at32f413_int.c:115
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • crm
  • clock_failure_detection
  • src
project/at_start_f413/examples/crm/clock_failure_detection/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37static void clkout_config(void);
38static void sclk_192m_hick_config(void);
39void clock_failure_detection_handler(void);
40
46static void clkout_config(void)
47{
48 gpio_init_type gpio_init_struct;
49
50 /* enable gpio port clock */
51 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
52
53 /* set default parameter */
54 gpio_default_para_init(&gpio_init_struct);
55
56 /* clkout gpio init */
57 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
58 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
59 gpio_init_struct.gpio_pins = GPIO_PINS_8;
60 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
61 gpio_init(GPIOA, &gpio_init_struct);
62
63 /* config clkout division */
64 crm_clkout_div_set(CRM_CLKOUT_DIV_1);
65
66 /* config clkout clock */
67 crm_clock_out_set(CRM_CLKOUT_PLL_DIV_4);
68}
69
75void clock_failure_detection_handler(void)
76{
77 /* check clock failure detection flag */
78 if(crm_flag_get(CRM_CLOCK_FAILURE_INT_FLAG) != RESET)
79 {
80 /* disable clock failure detection */
81 crm_clock_failure_detection_enable(FALSE);
82
83 /* config system clock */
84 sclk_192m_hick_config();
85
86 /* clear clock failure detection flag */
87 crm_flag_clear(CRM_CLOCK_FAILURE_INT_FLAG);
88 }
89}
90
109static void sclk_192m_hick_config(void)
110{
111 /* reset crm */
112 crm_reset();
113
114 crm_clock_source_enable(CRM_CLOCK_SOURCE_HICK, TRUE);
115
116 /* wait till hick is ready */
117 while(crm_flag_get(CRM_HICK_STABLE_FLAG) != SET)
118 {
119 }
120
121 /* config pll clock resource */
122 crm_pll_config(CRM_PLL_SOURCE_HICK, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
123
124 /* enable pll */
125 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
126
127 /* wait till pll is ready */
128 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
129 {
130 }
131
132 /* config ahbclk */
133 crm_ahb_div_set(CRM_AHB_DIV_1);
134
135 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
136 crm_apb2_div_set(CRM_APB2_DIV_2);
137
138 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
139 crm_apb1_div_set(CRM_APB1_DIV_2);
140
141 /* enable auto step mode */
142 crm_auto_step_mode_enable(TRUE);
143
144 /* select pll as system clock source */
145 crm_sysclk_switch(CRM_SCLK_PLL);
146
147 /* wait till pll is used as system clock source */
148 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
149 {
150 }
151
152 /* disable auto step mode */
153 crm_auto_step_mode_enable(FALSE);
154
155 /* update system_core_clock global variable */
156 system_core_clock_update();
157
158 /* config systick delay */
159 delay_init();
160
161 /* config clkout */
162 clkout_config();
163}
164
170int main(void)
171{
172 system_clock_config();
173
174 at32_board_init();
175
176 /* clkout config */
177 clkout_config();
178
179 /* enable clock failure detection */
180 crm_clock_failure_detection_enable(TRUE);
181
182 while(1)
183 {
184 at32_led_toggle(LED2);
185 delay_ms(200);
186 }
187}
188
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
clkout_config
static void clkout_config(void)
clkout configuration.
Definition project/at_start_f413/examples/crm/clock_failure_detection/src/main.c:46
clock_failure_detection_handler
void clock_failure_detection_handler(void)
clock failure detection handler.
Definition project/at_start_f413/examples/crm/clock_failure_detection/src/main.c:75
main
int main(void)
main function.
Definition project/at_start_f413/examples/crm/clock_failure_detection/src/main.c:170
sclk_192m_hick_config
static void sclk_192m_hick_config(void)
config sclk 192 mhz with hick clock source.
Definition project/at_start_f413/examples/crm/clock_failure_detection/src/main.c:109
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
LED2
@ LED2
Definition at32f413_board.h:62
delay_init
void delay_init()
initialize delay function
Definition at32f413_board.c:317
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_clkout_div_set
void crm_clkout_div_set(crm_clkout_div_type clkout_div)
set crm clkout division
Definition at32f413_crm.c:888
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_flag_clear
void crm_flag_clear(uint32_t flag)
clear the crm reset flags
Definition at32f413_crm.c:387
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_clock_out_set
void crm_clock_out_set(crm_clkout_select_type clkout)
set crm clkout
Definition at32f413_crm.c:767
crm_clock_failure_detection_enable
void crm_clock_failure_detection_enable(confirm_state new_state)
enable or disable clock failure detection
Definition at32f413_crm.c:544
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_HICK
@ CRM_CLOCK_SOURCE_HICK
Definition at32f413_crm.h:293
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLKOUT_DIV_1
@ CRM_CLKOUT_DIV_1
Definition at32f413_crm.h:419
CRM_PLL_SOURCE_HICK
@ CRM_PLL_SOURCE_HICK
Definition at32f413_crm.h:274
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_CLKOUT_PLL_DIV_4
@ CRM_CLKOUT_PLL_DIV_4
Definition at32f413_crm.h:409
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
CRM_CLOCK_FAILURE_INT_FLAG
#define CRM_CLOCK_FAILURE_INT_FLAG
Definition at32f413_crm.h:71
CRM_HICK_STABLE_FLAG
#define CRM_HICK_STABLE_FLAG
Definition at32f413_crm.h:54
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
SET
@ SET
Definition at32f413.h:292
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_PINS_8
#define GPIO_PINS_8
Definition at32f413_gpio.h:58
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
at32f413_clock.h
header file of clock program
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • crm
  • sysclk_switch
  • inc
project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • crm
  • sysclk_switch
  • inc
project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • crm
  • sysclk_switch
  • inc
project/at_start_f413/examples/crm/sysclk_switch/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • crm
  • sysclk_switch
  • src
project/at_start_f413/examples/crm/sysclk_switch/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/crm/sysclk_switch/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • crm
  • sysclk_switch
  • src
project/at_start_f413/examples/crm/sysclk_switch/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/crm/sysclk_switch/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/crm/sysclk_switch/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/crm/sysclk_switch/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/crm/sysclk_switch/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/crm/sysclk_switch/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/crm/sysclk_switch/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/crm/sysclk_switch/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/crm/sysclk_switch/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/crm/sysclk_switch/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • crm
  • sysclk_switch
  • src
project/at_start_f413/examples/crm/sysclk_switch/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37static void clkout_config(void);
38static void sclk_64m_hick_config(void);
39static void sclk_96m_hext_config(void);
40static void switch_system_clock(void);
41
47void clkout_config(void)
48{
49 gpio_init_type gpio_init_struct;
50
51 /* enable gpio port clock */
52 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
53
54 /* set default parameter */
55 gpio_default_para_init(&gpio_init_struct);
56
57 /* clkout gpio init */
58 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
59 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
60 gpio_init_struct.gpio_pins = GPIO_PINS_8;
61 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
62 gpio_init(GPIOA, &gpio_init_struct);
63
64 /* config clkout division */
65 crm_clkout_div_set(CRM_CLKOUT_DIV_1);
66
67 /* config clkout clock */
68 crm_clock_out_set(CRM_CLKOUT_PLL_DIV_4);
69}
70
76static void switch_system_clock(void)
77{
78 if(CRM->cfg_bit.pllrcs == RESET)
79 {
80 sclk_96m_hext_config();
81 }
82 else
83 {
84 sclk_64m_hick_config();
85 }
86}
87
106static void sclk_64m_hick_config(void)
107{
108 /* reset crm */
109 crm_reset();
110
111 crm_clock_source_enable(CRM_CLOCK_SOURCE_HICK, TRUE);
112
113 /* wait till hick is ready */
114 while(crm_flag_get(CRM_HICK_STABLE_FLAG) != SET)
115 {
116 }
117
118 /* config pll clock resource */
119 crm_pll_config(CRM_PLL_SOURCE_HICK, CRM_PLL_MULT_16, CRM_PLL_OUTPUT_RANGE_LE72MHZ);
120
121 /* enable pll */
122 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
123
124 /* wait till pll is ready */
125 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
126 {
127 }
128
129 /* config ahbclk */
130 crm_ahb_div_set(CRM_AHB_DIV_1);
131
132 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
133 crm_apb2_div_set(CRM_APB2_DIV_2);
134
135 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
136 crm_apb1_div_set(CRM_APB1_DIV_2);
137
138 /* enable auto step mode */
139 crm_auto_step_mode_enable(TRUE);
140
141 /* select pll as system clock source */
142 crm_sysclk_switch(CRM_SCLK_PLL);
143
144 /* wait till pll is used as system clock source */
145 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
146 {
147 }
148
149 /* disable auto step mode */
150 crm_auto_step_mode_enable(FALSE);
151
152 /* update system_core_clock global variable */
153 system_core_clock_update();
154
155 /* config systick delay */
156 delay_init();
157
158 /* config clkout */
159 clkout_config();
160}
161
180static void sclk_96m_hext_config(void)
181{
182 /* reset crm */
183 crm_reset();
184
185 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
186
187 /* wait till hext is ready */
188 while(crm_hext_stable_wait() == ERROR)
189 {
190 }
191
192 /* config pll clock resource */
193 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_24, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
194
195 /* enable pll */
196 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
197
198 /* wait till pll is ready */
199 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
200 {
201 }
202
203 /* config ahbclk */
204 crm_ahb_div_set(CRM_AHB_DIV_1);
205
206 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
207 crm_apb2_div_set(CRM_APB2_DIV_2);
208
209 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
210 crm_apb1_div_set(CRM_APB1_DIV_2);
211
212 /* enable auto step mode */
213 crm_auto_step_mode_enable(TRUE);
214
215 /* select pll as system clock source */
216 crm_sysclk_switch(CRM_SCLK_PLL);
217
218 /* wait till pll is used as system clock source */
219 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
220 {
221 }
222
223 /* disable auto step mode */
224 crm_auto_step_mode_enable(FALSE);
225
226 /* update system_core_clock global variable */
227 system_core_clock_update();
228
229 /* config systick delay */
230 delay_init();
231
232 /* config clkout */
233 clkout_config();
234}
235
241int main(void)
242{
243 system_clock_config();
244
245 at32_board_init();
246
247 clkout_config();
248
249 while(1)
250 {
251 if(at32_button_press() == USER_BUTTON)
252 {
253 switch_system_clock();
254 at32_led_toggle(LED4);
255 }
256 at32_led_toggle(LED2);
257 delay_ms(100);
258 }
259}
260
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
clkout_config
static void clkout_config(void)
clkout configuration.
Definition project/at_start_f413/examples/crm/sysclk_switch/src/main.c:47
sclk_96m_hext_config
static void sclk_96m_hext_config(void)
config sclk 96 mhz with hext clock source.
Definition project/at_start_f413/examples/crm/sysclk_switch/src/main.c:180
main
int main(void)
main function.
Definition project/at_start_f413/examples/crm/sysclk_switch/src/main.c:241
sclk_64m_hick_config
static void sclk_64m_hick_config(void)
config sclk 64 mhz with hick clock source.
Definition project/at_start_f413/examples/crm/sysclk_switch/src/main.c:106
switch_system_clock
static void switch_system_clock(void)
sclk switch function.
Definition project/at_start_f413/examples/crm/sysclk_switch/src/main.c:76
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
USER_BUTTON
@ USER_BUTTON
Definition at32f413_board.h:93
at32_button_press
button_type at32_button_press()
returns which button have press down
Definition at32f413_board.c:218
delay_init
void delay_init()
initialize delay function
Definition at32f413_board.c:317
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_clkout_div_set
void crm_clkout_div_set(crm_clkout_div_type clkout_div)
set crm clkout division
Definition at32f413_crm.c:888
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_clock_out_set
void crm_clock_out_set(crm_clkout_select_type clkout)
set crm clkout
Definition at32f413_crm.c:767
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_HICK
@ CRM_CLOCK_SOURCE_HICK
Definition at32f413_crm.h:293
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_CLKOUT_DIV_1
@ CRM_CLKOUT_DIV_1
Definition at32f413_crm.h:419
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_SOURCE_HICK
@ CRM_PLL_SOURCE_HICK
Definition at32f413_crm.h:274
CRM_PLL_MULT_24
@ CRM_PLL_MULT_24
Definition at32f413_crm.h:226
CRM_PLL_MULT_16
@ CRM_PLL_MULT_16
Definition at32f413_crm.h:218
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_CLKOUT_PLL_DIV_4
@ CRM_CLKOUT_PLL_DIV_4
Definition at32f413_crm.h:409
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_LE72MHZ
@ CRM_PLL_OUTPUT_RANGE_LE72MHZ
Definition at32f413_crm.h:284
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
CRM_HICK_STABLE_FLAG
#define CRM_HICK_STABLE_FLAG
Definition at32f413_crm.h:54
CRM
#define CRM
Definition at32f413_crm.h:843
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
SET
@ SET
Definition at32f413.h:292
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_PINS_8
#define GPIO_PINS_8
Definition at32f413_gpio.h:58
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
at32f413_clock.h
header file of clock program
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • debug
  • tmr1
  • inc
project/at_start_f413/examples/debug/tmr1/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • debug
  • tmr1
  • inc
project/at_start_f413/examples/debug/tmr1/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • debug
  • tmr1
  • inc
project/at_start_f413/examples/debug/tmr1/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • debug
  • tmr1
  • src
project/at_start_f413/examples/debug/tmr1/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/debug/tmr1/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • debug
  • tmr1
  • src
project/at_start_f413/examples/debug/tmr1/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
134
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/debug/tmr1/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/debug/tmr1/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/debug/tmr1/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/debug/tmr1/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/debug/tmr1/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/debug/tmr1/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/debug/tmr1/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/debug/tmr1/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/debug/tmr1/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • debug
  • tmr1
  • src
project/at_start_f413/examples/debug/tmr1/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
29
38 crm_clocks_freq_type crm_clocks_freq_struct = {0};
39uint16_t counter = 0;
40
46void TMR1_OVF_TMR10_IRQHandler(void)
47{
48 if(tmr_interrupt_flag_get(TMR1, TMR_OVF_FLAG) != RESET)
49 {
50 /* add user code... */
51 at32_led_toggle(LED3);
52 tmr_flag_clear(TMR1, TMR_OVF_FLAG);
53 }
54}
55
61int main(void)
62{
63 system_clock_config();
64
65 at32_board_init();
66
67 /* get system clock */
68 crm_clocks_freq_get(&crm_clocks_freq_struct);
69
70 /* turn led2/led3/led4 on */
71 at32_led_on(LED2);
72 at32_led_on(LED3);
73 at32_led_on(LED4);
74
75 /* enable tmr1 clock */
76 crm_periph_clock_enable(CRM_TMR1_PERIPH_CLOCK, TRUE);
77
78 /* enable tmr1 debug mode */
79 debug_periph_mode_set(DEBUG_TMR1_PAUSE, TRUE);
80
81 /* tmr1 configuration */
82 tmr_base_init(TMR1, 10000, 0);
83 tmr_cnt_dir_set(TMR1, TMR_COUNT_UP);
84
85 /* overflow interrupt enable */
86 tmr_interrupt_enable(TMR1, TMR_OVF_INT, TRUE);
87
88 /* tmr1 interrupt nvic init */
89 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
90 nvic_irq_enable(TMR1_OVF_TMR10_IRQn, 1, 0);
91
92 /* enable tmr1 */
93 tmr_counter_enable(TMR1, TRUE);
94
95 while(1)
96 {
97 /* in debug mode,tmr1 counter will pause */
98 counter = tmr_counter_value_get(TMR1);
99 counter = tmr_counter_value_get(TMR1);
100 counter = tmr_counter_value_get(TMR1);
101 counter = tmr_counter_value_get(TMR1);
102 counter = tmr_counter_value_get(TMR1);
103 }
104}
105
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
main
int main(void)
main function.
Definition project/at_start_f413/examples/debug/tmr1/src/main.c:61
crm_clocks_freq_struct
crm_clocks_freq_type crm_clocks_freq_struct
Definition project/at_start_f413/examples/debug/tmr1/src/main.c:38
TMR1_OVF_TMR10_IRQHandler
void TMR1_OVF_TMR10_IRQHandler(void)
this function handles tmr1 overflow handler.
Definition project/at_start_f413/examples/debug/tmr1/src/main.c:46
counter
uint16_t counter
Definition project/at_start_f413/examples/debug/tmr1/src/main.c:39
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_clocks_freq_get
void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
Definition at32f413_crm.c:660
CRM_TMR1_PERIPH_CLOCK
@ CRM_TMR1_PERIPH_CLOCK
Definition at32f413_crm.h:116
TMR1_OVF_TMR10_IRQn
@ TMR1_OVF_TMR10_IRQn
Definition at32f413.h:197
debug_periph_mode_set
void debug_periph_mode_set(uint32_t periph_debug_mode, confirm_state new_state)
set periph debug mode
Definition at32f413_debug.c:78
DEBUG_TMR1_PAUSE
#define DEBUG_TMR1_PAUSE
Definition at32f413_debug.h:55
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
tmr_flag_clear
void tmr_flag_clear(tmr_type *tmr_x, uint32_t tmr_flag)
clear tmr flag
Definition at32f413_tmr.c:1433
tmr_counter_enable
void tmr_counter_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr counter
Definition at32f413_tmr.c:114
tmr_interrupt_flag_get
flag_status tmr_interrupt_flag_get(tmr_type *tmr_x, uint32_t tmr_flag)
get tmr interrupt flag
Definition at32f413_tmr.c:1357
tmr_counter_value_get
uint32_t tmr_counter_value_get(tmr_type *tmr_x)
get tmr counter value
Definition at32f413_tmr.c:269
tmr_base_init
void tmr_base_init(tmr_type *tmr_x, uint32_t tmr_pr, uint32_t tmr_div)
init tmr base
Definition at32f413_tmr.c:179
tmr_interrupt_enable
void tmr_interrupt_enable(tmr_type *tmr_x, uint32_t tmr_interrupt, confirm_state new_state)
enable or disable tmr interrupt
Definition at32f413_tmr.c:1327
tmr_cnt_dir_set
void tmr_cnt_dir_set(tmr_type *tmr_x, tmr_count_mode_type tmr_cnt_dir)
set tmr counter count direction
Definition at32f413_tmr.c:225
TMR_COUNT_UP
@ TMR_COUNT_UP
Definition at32f413_tmr.h:105
TMR_OVF_FLAG
#define TMR_OVF_FLAG
Definition at32f413_tmr.h:51
TMR_OVF_INT
#define TMR_OVF_INT
Definition at32f413_tmr.h:73
TMR1
#define TMR1
Definition at32f413_tmr.h:831
at32f413_clock.h
header file of clock program
crm_clocks_freq_type
crm clocks freqency structure
Definition at32f413_crm.h:470


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • dma
  • data_to_gpio_flexible
  • inc
project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • dma
  • data_to_gpio_flexible
  • inc
project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • dma
  • data_to_gpio_flexible
  • inc
project/at_start_f413/examples/dma/data_to_gpio_flexible/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • dma
  • data_to_gpio_flexible
  • src
project/at_start_f413/examples/dma/data_to_gpio_flexible/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • dma
  • data_to_gpio_flexible
  • src
project/at_start_f413/examples/dma/data_to_gpio_flexible/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • dma
  • data_to_gpio_flexible
  • src
project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37 gpio_init_type gpio_init_struct = {0};
38 dma_init_type dma_init_struct = {0};
39
40#define BUFFER_SIZE 16
41uint16_t src_buffer[BUFFER_SIZE] = {0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008,
42 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, 0x0010};
43
49void DMA2_Channel1_IRQHandler(void)
50{
51 if(dma_interrupt_flag_get(DMA2_FDT1_FLAG) != RESET)
52 {
53 /* turn led2/led3/led4 on */
54 at32_led_on(LED2);
55 at32_led_on(LED3);
56 at32_led_on(LED4);
57 dma_flag_clear(DMA2_FDT1_FLAG);
58 }
59}
60
66int main(void)
67{
68 system_clock_config();
69
70 at32_board_init();
71
72 /* enable dma2/gpiob/tmr2 clock */
73 crm_periph_clock_enable(CRM_DMA2_PERIPH_CLOCK, TRUE);
74 crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
75 crm_periph_clock_enable(CRM_TMR2_PERIPH_CLOCK, TRUE);
76 crm_periph_clock_enable(CRM_IOMUX_PERIPH_CLOCK, TRUE);
77 gpio_pin_remap_config(SWJTAG_CONF_010, TRUE);
78 /* config gpioc pin for output mode */
79 gpio_init_struct.gpio_pins = GPIO_PINS_ALL;
80 gpio_init_struct.gpio_mode = GPIO_MODE_OUTPUT;
81 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
82 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
83 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
84 gpio_init(GPIOB, &gpio_init_struct);
85
86 tmr_base_init(TMR2, 0xFF, 0);
87 tmr_cnt_dir_set(TMR2, TMR_COUNT_UP);
88
89 /* enable tmr2 overflow dma request */
90 tmr_dma_request_enable(TMR2, TMR_OVERFLOW_DMA_REQUEST, TRUE);
91
92 /* dma2 channel1 configuration */
93 dma_reset(DMA2_CHANNEL1);
94 dma_init_struct.buffer_size = BUFFER_SIZE;
95 dma_init_struct.direction = DMA_DIR_MEMORY_TO_PERIPHERAL;
96 dma_init_struct.memory_base_addr = (uint32_t)src_buffer;
97 dma_init_struct.memory_data_width = DMA_MEMORY_DATA_WIDTH_HALFWORD;
98 dma_init_struct.memory_inc_enable = TRUE;
99 dma_init_struct.peripheral_base_addr = (uint32_t)&GPIOB->odt;
100 dma_init_struct.peripheral_data_width = DMA_PERIPHERAL_DATA_WIDTH_HALFWORD;
101 dma_init_struct.peripheral_inc_enable = FALSE;
102 dma_init_struct.priority = DMA_PRIORITY_MEDIUM;
103 dma_init_struct.loop_mode_enable = FALSE;
104 dma_init(DMA2_CHANNEL1, &dma_init_struct);
105
106 /* enable transfer full data interrupt */
107 dma_interrupt_enable(DMA2_CHANNEL1, DMA_FDT_INT, TRUE);
108
109 /* dma2 channel1 interrupt nvic init */
110 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
111 nvic_irq_enable(DMA2_Channel1_IRQn, 1, 0);
112
113 /* tmr2 flexible function enable */
114 dma_flexible_config(DMA2, FLEX_CHANNEL1, DMA_FLEXIBLE_TMR2_OVERFLOW);
115
116 /* enable dma channel */
117 dma_channel_enable(DMA2_CHANNEL1, TRUE);
118
119 /* enable tmr2 */
120 tmr_counter_enable(TMR2, TRUE);
121
122 while(1)
123 {
124 }
125}
126
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
dma_init_struct
dma_init_type dma_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:38
DMA2_Channel1_IRQHandler
void DMA2_Channel1_IRQHandler(void)
this function handles DMA2 channel1 handler.
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:49
BUFFER_SIZE
#define BUFFER_SIZE
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:40
main
int main(void)
main function.
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:66
src_buffer
uint16_t src_buffer[16]
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:41
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_TMR2_PERIPH_CLOCK
@ CRM_TMR2_PERIPH_CLOCK
Definition at32f413_crm.h:125
CRM_IOMUX_PERIPH_CLOCK
@ CRM_IOMUX_PERIPH_CLOCK
Definition at32f413_crm.h:108
CRM_GPIOB_PERIPH_CLOCK
@ CRM_GPIOB_PERIPH_CLOCK
Definition at32f413_crm.h:110
CRM_DMA2_PERIPH_CLOCK
@ CRM_DMA2_PERIPH_CLOCK
Definition at32f413_crm.h:104
DMA2_Channel1_IRQn
@ DMA2_Channel1_IRQn
Definition at32f413.h:223
dma_channel_enable
void dma_channel_enable(dma_channel_type *dmax_channely, confirm_state new_state)
enable or disable dma channely
Definition at32f413_dma.c:197
dma_interrupt_flag_get
flag_status dma_interrupt_flag_get(uint32_t dmax_flag)
get dma interrupt flag
Definition at32f413_dma.c:297
dma_flexible_config
void dma_flexible_config(dma_type *dma_x, uint8_t flex_channelx, dma_flexible_request_type flexible_request)
initialize the dma_x flexible function according to the specified parameters.
Definition at32f413_dma.c:237
dma_interrupt_enable
void dma_interrupt_enable(dma_channel_type *dmax_channely, uint32_t dma_int, confirm_state new_state)
enable or disable dma interrupt
Definition at32f413_dma.c:164
dma_flag_clear
void dma_flag_clear(uint32_t dmax_flag)
clear dma flag
Definition at32f413_dma.c:389
dma_reset
void dma_reset(dma_channel_type *dmax_channely)
reset the dmax channely registers.
Definition at32f413_dma.c:63
dma_init
void dma_init(dma_channel_type *dmax_channely, dma_init_type *dma_init_struct)
dma init
Definition at32f413_dma.c:442
DMA_PERIPHERAL_DATA_WIDTH_HALFWORD
@ DMA_PERIPHERAL_DATA_WIDTH_HALFWORD
Definition at32f413_dma.h:246
DMA_FLEXIBLE_TMR2_OVERFLOW
@ DMA_FLEXIBLE_TMR2_OVERFLOW
Definition at32f413_dma.h:179
DMA_DIR_MEMORY_TO_PERIPHERAL
@ DMA_DIR_MEMORY_TO_PERIPHERAL
Definition at32f413_dma.h:217
DMA_MEMORY_DATA_WIDTH_HALFWORD
@ DMA_MEMORY_DATA_WIDTH_HALFWORD
Definition at32f413_dma.h:256
DMA_PRIORITY_MEDIUM
@ DMA_PRIORITY_MEDIUM
Definition at32f413_dma.h:266
DMA2_FDT1_FLAG
#define DMA2_FDT1_FLAG
Definition at32f413_dma.h:110
FLEX_CHANNEL1
#define FLEX_CHANNEL1
Definition at32f413_dma.h:63
DMA_FDT_INT
#define DMA_FDT_INT
Definition at32f413_dma.h:51
DMA2
#define DMA2
Definition at32f413_dma.h:488
DMA2_CHANNEL1
#define DMA2_CHANNEL1
Definition at32f413_dma.h:489
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_pin_remap_config
void gpio_pin_remap_config(uint32_t gpio_remap, confirm_state new_state)
iomux remap and debug i/o configuration.
Definition at32f413_gpio.c:549
GPIO_MODE_OUTPUT
@ GPIO_MODE_OUTPUT
Definition at32f413_gpio.h:214
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_ALL
#define GPIO_PINS_ALL
Definition at32f413_gpio.h:66
GPIOB
#define GPIOB
Definition at32f413_gpio.h:748
SWJTAG_CONF_010
#define SWJTAG_CONF_010
Definition at32f413_gpio.h:98
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
tmr_dma_request_enable
void tmr_dma_request_enable(tmr_type *tmr_x, tmr_dma_request_type dma_request, confirm_state new_state)
enable or disable tmr dma request
Definition at32f413_tmr.c:1296
tmr_counter_enable
void tmr_counter_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr counter
Definition at32f413_tmr.c:114
tmr_base_init
void tmr_base_init(tmr_type *tmr_x, uint32_t tmr_pr, uint32_t tmr_div)
init tmr base
Definition at32f413_tmr.c:179
tmr_cnt_dir_set
void tmr_cnt_dir_set(tmr_type *tmr_x, tmr_count_mode_type tmr_cnt_dir)
set tmr counter count direction
Definition at32f413_tmr.c:225
TMR_OVERFLOW_DMA_REQUEST
@ TMR_OVERFLOW_DMA_REQUEST
Definition at32f413_tmr.h:268
TMR_COUNT_UP
@ TMR_COUNT_UP
Definition at32f413_tmr.h:105
TMR2
#define TMR2
Definition at32f413_tmr.h:832
at32f413_clock.h
header file of clock program
dma_init_type
dma init type
Definition at32f413_dma.h:275
dma_init_type::loop_mode_enable
confirm_state loop_mode_enable
Definition at32f413_dma.h:284
dma_init_type::buffer_size
uint16_t buffer_size
Definition at32f413_dma.h:279
dma_init_type::memory_data_width
dma_memory_data_size_type memory_data_width
Definition at32f413_dma.h:283
dma_init_type::priority
dma_priority_level_type priority
Definition at32f413_dma.h:285
dma_init_type::peripheral_inc_enable
confirm_state peripheral_inc_enable
Definition at32f413_dma.h:280
dma_init_type::memory_inc_enable
confirm_state memory_inc_enable
Definition at32f413_dma.h:281
dma_init_type::direction
dma_dir_type direction
Definition at32f413_dma.h:278
dma_init_type::peripheral_base_addr
uint32_t peripheral_base_addr
Definition at32f413_dma.h:276
dma_init_type::memory_base_addr
uint32_t memory_base_addr
Definition at32f413_dma.h:277
dma_init_type::peripheral_data_width
dma_peripheral_data_size_type peripheral_data_width
Definition at32f413_dma.h:282
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • dma
  • flash_to_sram
  • inc
project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • dma
  • flash_to_sram
  • inc
project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • dma
  • flash_to_sram
  • inc
project/at_start_f413/examples/dma/flash_to_sram/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • dma
  • flash_to_sram
  • src
project/at_start_f413/examples/dma/flash_to_sram/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/dma/flash_to_sram/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • dma
  • flash_to_sram
  • src
project/at_start_f413/examples/dma/flash_to_sram/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
29
44void NMI_Handler(void)
45{
46}
47
53void HardFault_Handler(void)
54{
55 /* go to infinite loop when hard fault exception occurs */
56 while(1)
57 {
58 }
59}
60
66void MemManage_Handler(void)
67{
68 /* go to infinite loop when memory manage exception occurs */
69 while(1)
70 {
71 }
72}
73
79void BusFault_Handler(void)
80{
81 /* go to infinite loop when bus fault exception occurs */
82 while(1)
83 {
84 }
85}
86
92void UsageFault_Handler(void)
93{
94 /* go to infinite loop when usage fault exception occurs */
95 while(1)
96 {
97 }
98}
99
105void SVC_Handler(void)
106{
107}
108
114void DebugMon_Handler(void)
115{
116}
117
123void PendSV_Handler(void)
124{
125}
126
132void SysTick_Handler(void)
133{
134}
135
136
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/dma/flash_to_sram/src/at32f413_int.c:92
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/dma/flash_to_sram/src/at32f413_int.c:53
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/dma/flash_to_sram/src/at32f413_int.c:66
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/dma/flash_to_sram/src/at32f413_int.c:105
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/dma/flash_to_sram/src/at32f413_int.c:123
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/dma/flash_to_sram/src/at32f413_int.c:44
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/dma/flash_to_sram/src/at32f413_int.c:79
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/dma/flash_to_sram/src/at32f413_int.c:132
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/dma/flash_to_sram/src/at32f413_int.c:114
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • dma
  • flash_to_sram
  • src
project/at_start_f413/examples/dma/flash_to_sram/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
38#define BUFFER_SIZE 32
39
40const uint32_t src_const_buffer[BUFFER_SIZE]= {0x01020304, 0x05060708, 0x090A0B0C, 0x0D0E0F10,
41 0x11121314, 0x15161718, 0x191A1B1C, 0x1D1E1F20,
42 0x21222324, 0x25262728, 0x292A2B2C, 0x2D2E2F30,
43 0x31323334, 0x35363738, 0x393A3B3C, 0x3D3E3F40,
44 0x41424344, 0x45464748, 0x494A4B4C, 0x4D4E4F50,
45 0x51525354, 0x55565758, 0x595A5B5C, 0x5D5E5F60,
46 0x61626364, 0x65666768, 0x696A6B6C, 0x6D6E6F70,
47 0x71727374, 0x75767778, 0x797A7B7C, 0x7D7E7F80};
48uint32_t dst_buffer[BUFFER_SIZE];
49 gpio_init_type gpio_init_struct = {0};
50 dma_init_type dma_init_struct = {0};
51__IO uint32_t data_counter_end = 0x01; /* this variable should not be initialized to 0 */
52 error_status transfer_status = ERROR;
53
54 error_status buffer_compare(const uint32_t* pbuffer, uint32_t* pbuffer1, uint16_t buffer_length);
55
61void DMA1_Channel1_IRQHandler(void)
62{
63 if(dma_interrupt_flag_get(DMA1_FDT1_FLAG) != RESET)
64 {
65 data_counter_end = 0;
66 dma_flag_clear(DMA1_FDT1_FLAG);
67 }
68}
69
77 error_status buffer_compare(const uint32_t* pbuffer, uint32_t* pbuffer1, uint16_t buffer_length)
78{
79 while(buffer_length--)
80 {
81 if(*pbuffer != *pbuffer1)
82 {
83 return ERROR;
84 }
85
86 pbuffer++;
87 pbuffer1++;
88 }
89
90 return SUCCESS;
91}
92
98int main(void)
99{
100 system_clock_config();
101
102 at32_board_init();
103
104 /* enable dma1 clock */
105 crm_periph_clock_enable(CRM_DMA1_PERIPH_CLOCK, TRUE);
106
107 /* dma1 channel1 configuration */
108 dma_reset(DMA1_CHANNEL1);
109 dma_init_struct.buffer_size = BUFFER_SIZE;
110 dma_init_struct.direction = DMA_DIR_MEMORY_TO_MEMORY;
111 dma_init_struct.memory_base_addr = (uint32_t)dst_buffer;
112 dma_init_struct.memory_data_width = DMA_MEMORY_DATA_WIDTH_WORD;
113 dma_init_struct.memory_inc_enable = TRUE;
114 dma_init_struct.peripheral_base_addr = (uint32_t)src_const_buffer;
115 dma_init_struct.peripheral_data_width = DMA_PERIPHERAL_DATA_WIDTH_WORD;
116 dma_init_struct.peripheral_inc_enable = TRUE;
117 dma_init_struct.priority = DMA_PRIORITY_MEDIUM;
118 dma_init_struct.loop_mode_enable = FALSE;
119 dma_init(DMA1_CHANNEL1, &dma_init_struct);
120
121 /* enable transfer full data interrupt */
122 dma_interrupt_enable(DMA1_CHANNEL1, DMA_FDT_INT, TRUE);
123
124 /* dma1 channel1 interrupt nvic init */
125 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
126 nvic_irq_enable(DMA1_Channel1_IRQn, 1, 0);
127
128 dma_channel_enable(DMA1_CHANNEL1, TRUE);
129
130 /* wait the end of transmission */
131 while(data_counter_end != 0)
132 {
133 }
134
135 /* check if the transmitted and received data are equal */
136 transfer_status = buffer_compare(src_const_buffer, dst_buffer, BUFFER_SIZE);
137
138 /* transfer_status = passed, if the transmitted and received data are the same
139 transfer_status = failed, if the transmitted and received data are different */
140 if(transfer_status == SUCCESS)
141 {
142 /* turn led2/led3/led4 on */
143 at32_led_on(LED2);
144 at32_led_on(LED3);
145 at32_led_on(LED4);
146 }
147
148 while(1)
149 {
150 }
151}
152
153
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/flash_to_sram/src/main.c:49
dma_init_struct
dma_init_type dma_init_struct
Definition project/at_start_f413/examples/dma/flash_to_sram/src/main.c:50
src_const_buffer
const uint32_t src_const_buffer[32]
Definition project/at_start_f413/examples/dma/flash_to_sram/src/main.c:40
data_counter_end
__IO uint32_t data_counter_end
Definition project/at_start_f413/examples/dma/flash_to_sram/src/main.c:51
BUFFER_SIZE
#define BUFFER_SIZE
Definition project/at_start_f413/examples/dma/flash_to_sram/src/main.c:38
DMA1_Channel1_IRQHandler
void DMA1_Channel1_IRQHandler(void)
this function handles dma1 channel1 handler.
Definition project/at_start_f413/examples/dma/flash_to_sram/src/main.c:61
main
int main(void)
main function.
Definition project/at_start_f413/examples/dma/flash_to_sram/src/main.c:98
dst_buffer
uint32_t dst_buffer[32]
Definition project/at_start_f413/examples/dma/flash_to_sram/src/main.c:48
buffer_compare
error_status buffer_compare(const uint32_t *pbuffer, uint32_t *pbuffer1, uint16_t buffer_length)
compares two buffers.
Definition project/at_start_f413/examples/dma/flash_to_sram/src/main.c:77
transfer_status
error_status transfer_status
Definition project/at_start_f413/examples/dma/flash_to_sram/src/main.c:52
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_DMA1_PERIPH_CLOCK
@ CRM_DMA1_PERIPH_CLOCK
Definition at32f413_crm.h:103
DMA1_Channel1_IRQn
@ DMA1_Channel1_IRQn
Definition at32f413.h:182
dma_channel_enable
void dma_channel_enable(dma_channel_type *dmax_channely, confirm_state new_state)
enable or disable dma channely
Definition at32f413_dma.c:197
dma_interrupt_flag_get
flag_status dma_interrupt_flag_get(uint32_t dmax_flag)
get dma interrupt flag
Definition at32f413_dma.c:297
dma_interrupt_enable
void dma_interrupt_enable(dma_channel_type *dmax_channely, uint32_t dma_int, confirm_state new_state)
enable or disable dma interrupt
Definition at32f413_dma.c:164
dma_flag_clear
void dma_flag_clear(uint32_t dmax_flag)
clear dma flag
Definition at32f413_dma.c:389
dma_reset
void dma_reset(dma_channel_type *dmax_channely)
reset the dmax channely registers.
Definition at32f413_dma.c:63
dma_init
void dma_init(dma_channel_type *dmax_channely, dma_init_type *dma_init_struct)
dma init
Definition at32f413_dma.c:442
DMA_PERIPHERAL_DATA_WIDTH_WORD
@ DMA_PERIPHERAL_DATA_WIDTH_WORD
Definition at32f413_dma.h:247
DMA_DIR_MEMORY_TO_MEMORY
@ DMA_DIR_MEMORY_TO_MEMORY
Definition at32f413_dma.h:218
DMA_MEMORY_DATA_WIDTH_WORD
@ DMA_MEMORY_DATA_WIDTH_WORD
Definition at32f413_dma.h:257
DMA_PRIORITY_MEDIUM
@ DMA_PRIORITY_MEDIUM
Definition at32f413_dma.h:266
DMA1_FDT1_FLAG
#define DMA1_FDT1_FLAG
Definition at32f413_dma.h:81
DMA_FDT_INT
#define DMA_FDT_INT
Definition at32f413_dma.h:51
DMA1_CHANNEL1
#define DMA1_CHANNEL1
Definition at32f413_dma.h:480
error_status
error_status
error status
Definition at32f413.h:302
ERROR
@ ERROR
Definition at32f413.h:302
SUCCESS
@ SUCCESS
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
at32f413_clock.h
header file of clock program
dma_init_type
dma init type
Definition at32f413_dma.h:275
dma_init_type::loop_mode_enable
confirm_state loop_mode_enable
Definition at32f413_dma.h:284
dma_init_type::buffer_size
uint16_t buffer_size
Definition at32f413_dma.h:279
dma_init_type::memory_data_width
dma_memory_data_size_type memory_data_width
Definition at32f413_dma.h:283
dma_init_type::priority
dma_priority_level_type priority
Definition at32f413_dma.h:285
dma_init_type::peripheral_inc_enable
confirm_state peripheral_inc_enable
Definition at32f413_dma.h:280
dma_init_type::memory_inc_enable
confirm_state memory_inc_enable
Definition at32f413_dma.h:281
dma_init_type::direction
dma_dir_type direction
Definition at32f413_dma.h:278
dma_init_type::peripheral_base_addr
uint32_t peripheral_base_addr
Definition at32f413_dma.h:276
dma_init_type::memory_base_addr
uint32_t memory_base_addr
Definition at32f413_dma.h:277
dma_init_type::peripheral_data_width
dma_peripheral_data_size_type peripheral_data_width
Definition at32f413_dma.h:282
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • exint
  • exint_config
  • inc
project/at_start_f413/examples/exint/exint_config/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • exint
  • exint_config
  • inc
project/at_start_f413/examples/exint/exint_config/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • exint
  • exint_config
  • inc
project/at_start_f413/examples/exint/exint_config/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • exint
  • exint_config
  • src
project/at_start_f413/examples/exint/exint_config/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/exint/exint_config/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • exint
  • exint_config
  • src
project/at_start_f413/examples/exint/exint_config/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/exint/exint_config/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/exint/exint_config/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/exint/exint_config/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/exint/exint_config/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/exint/exint_config/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/exint/exint_config/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/exint/exint_config/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/exint/exint_config/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/exint/exint_config/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • exint
  • exint_config
  • src
project/at_start_f413/examples/exint/exint_config/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
29
39void exint_line0_config(void);
40
46int main(void)
47{
48 system_clock_config();
49
50 at32_board_init();
51
52 /* turn led2/led3/led4 on */
53 at32_led_on(LED2);
54 at32_led_on(LED3);
55 at32_led_on(LED4);
56
57 /* configure pa0 in interrupt mode */
58 exint_line0_config();
59
60 while(1)
61 {
62 }
63}
64
70void exint_line0_config(void)
71{
72 exint_init_type exint_init_struct;
73
74 crm_periph_clock_enable(CRM_IOMUX_PERIPH_CLOCK, TRUE);
75 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
76
77 gpio_exint_line_config(GPIO_PORT_SOURCE_GPIOA, GPIO_PINS_SOURCE0);
78
79 exint_default_para_init(&exint_init_struct);
80 exint_init_struct.line_enable = TRUE;
81 exint_init_struct.line_mode = EXINT_LINE_INTERRUPT;
82 exint_init_struct.line_select = EXINT_LINE_0;
83 exint_init_struct.line_polarity = EXINT_TRIGGER_RISING_EDGE;
84 exint_init(&exint_init_struct);
85
86 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
87 nvic_irq_enable(EXINT0_IRQn, 1, 0);
88}
89
95void EXINT0_IRQHandler(void)
96{
97 if(exint_interrupt_flag_get(EXINT_LINE_0) != RESET)
98 {
99 at32_led_toggle(LED2);
100 at32_led_toggle(LED3);
101 at32_led_toggle(LED4);
102 exint_flag_clear(EXINT_LINE_0);
103 }
104}
105
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
main
int main(void)
main function.
Definition project/at_start_f413/examples/exint/exint_config/src/main.c:46
EXINT0_IRQHandler
void EXINT0_IRQHandler(void)
exint0 interrupt handler
Definition project/at_start_f413/examples/exint/exint_config/src/main.c:95
exint_line0_config
void exint_line0_config(void)
exint line0 config. configure pa0 in interrupt mode
Definition project/at_start_f413/examples/exint/exint_config/src/main.c:70
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_IOMUX_PERIPH_CLOCK
@ CRM_IOMUX_PERIPH_CLOCK
Definition at32f413_crm.h:108
EXINT0_IRQn
@ EXINT0_IRQn
Definition at32f413.h:177
exint_flag_clear
void exint_flag_clear(uint32_t exint_line)
clear exint flag
Definition at32f413_exint.c:125
exint_default_para_init
void exint_default_para_init(exint_init_type *exint_struct)
exint default para init
Definition at32f413_exint.c:63
exint_interrupt_flag_get
flag_status exint_interrupt_flag_get(uint32_t exint_line)
get exint interrupt flag
Definition at32f413_exint.c:168
exint_init
void exint_init(exint_init_type *exint_struct)
exint init
Definition at32f413_exint.c:77
EXINT_LINE_INTERRUPT
@ EXINT_LINE_INTERRUPT
Definition at32f413_exint.h:84
EXINT_TRIGGER_RISING_EDGE
@ EXINT_TRIGGER_RISING_EDGE
Definition at32f413_exint.h:93
EXINT_LINE_0
#define EXINT_LINE_0
Definition at32f413_exint.h:51
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
gpio_exint_line_config
void gpio_exint_line_config(gpio_port_source_type gpio_port_source, gpio_pins_source_type gpio_pin_source)
select the gpio pin used as exint line.
Definition at32f413_gpio.c:605
GPIO_PINS_SOURCE0
@ GPIO_PINS_SOURCE0
Definition at32f413_gpio.h:253
GPIO_PORT_SOURCE_GPIOA
@ GPIO_PORT_SOURCE_GPIOA
Definition at32f413_gpio.h:276
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
at32f413_clock.h
header file of clock program
exint_init_type
exint init type
Definition at32f413_exint.h:102
exint_init_type::line_select
uint32_t line_select
Definition at32f413_exint.h:104
exint_init_type::line_enable
confirm_state line_enable
Definition at32f413_exint.h:106
exint_init_type::line_mode
exint_line_mode_type line_mode
Definition at32f413_exint.h:103
exint_init_type::line_polarity
exint_polarity_config_type line_polarity
Definition at32f413_exint.h:105


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • exint
  • exint_software_trigger
  • inc
project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • exint
  • exint_software_trigger
  • inc
project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • exint
  • exint_software_trigger
  • inc
project/at_start_f413/examples/exint/exint_software_trigger/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • exint
  • exint_software_trigger
  • src
project/at_start_f413/examples/exint/exint_software_trigger/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/exint/exint_software_trigger/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • exint
  • exint_software_trigger
  • src
project/at_start_f413/examples/exint/exint_software_trigger/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/exint/exint_software_trigger/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/exint/exint_software_trigger/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/exint/exint_software_trigger/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/exint/exint_software_trigger/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/exint/exint_software_trigger/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/exint/exint_software_trigger/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/exint/exint_software_trigger/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/exint/exint_software_trigger/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/exint/exint_software_trigger/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • exint
  • exint_software_trigger
  • src
project/at_start_f413/examples/exint/exint_software_trigger/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
29
39void exint_line4_config(void);
40static void tmr1_config(void);
41
47void exint_line4_config(void)
48{
49 exint_init_type exint_init_struct;
50
51 crm_periph_clock_enable(CRM_IOMUX_PERIPH_CLOCK, TRUE);
52
53 exint_default_para_init(&exint_init_struct);
54 exint_init_struct.line_enable = TRUE;
55 exint_init_struct.line_mode = EXINT_LINE_INTERRUPT;
56 exint_init_struct.line_select = EXINT_LINE_4;
57 exint_init_struct.line_polarity = EXINT_TRIGGER_RISING_EDGE;
58 exint_init(&exint_init_struct);
59
60 nvic_irq_enable(EXINT4_IRQn, 1, 0);
61}
62
68static void tmr1_config(void)
69{
70 crm_clocks_freq_type crm_clocks_freq_struct = {0};
71
72 /* get system clock */
73 crm_clocks_freq_get(&crm_clocks_freq_struct);
74
75 crm_periph_clock_enable(CRM_TMR1_PERIPH_CLOCK, TRUE);
76
77 /* (systemclock / (system_core_clock/10000)) / 10000 = 1Hz(1s) */
78 tmr_base_init(TMR1, 10000-1, system_core_clock/10000-1);
79 tmr_cnt_dir_set(TMR1, TMR_COUNT_UP);
80 tmr_clock_source_div_set(TMR1, TMR_CLOCK_DIV1);
81 tmr_interrupt_enable(TMR1, TMR_OVF_INT, TRUE);
82 nvic_irq_enable(TMR1_OVF_TMR10_IRQn, 0, 0);
83}
84
90void TMR1_OVF_TMR10_IRQHandler(void)
91{
92 if(tmr_interrupt_flag_get(TMR1,TMR_OVF_FLAG) != RESET)
93 {
94 at32_led_toggle(LED2);
95 exint_software_interrupt_event_generate(EXINT_LINE_4);
96 tmr_flag_clear(TMR1,TMR_OVF_FLAG);
97 }
98}
99
105void EXINT4_IRQHandler(void)
106{
107 if(exint_interrupt_flag_get(EXINT_LINE_4) != RESET)
108 {
109 at32_led_toggle(LED3);
110 at32_led_toggle(LED4);
111 exint_flag_clear(EXINT_LINE_4);
112 }
113}
114
120int main(void)
121{
122 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
123 system_clock_config();
124
125 at32_board_init();
126
127 /* turn led2/led3/led4 on */
128 at32_led_on(LED2);
129 at32_led_on(LED3);
130 at32_led_on(LED4);
131 tmr1_config();
132 exint_line4_config();
133 tmr_counter_enable(TMR1, TRUE);
134 while(1)
135 {
136 }
137}
138
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
crm_clocks_freq_struct
crm_clocks_freq_type crm_clocks_freq_struct
Definition project/at_start_f413/examples/debug/tmr1/src/main.c:38
exint_line4_config
void exint_line4_config(void)
exint line4 config. configure pa0 in interrupt mode
Definition project/at_start_f413/examples/exint/exint_software_trigger/src/main.c:47
main
int main(void)
main function.
Definition project/at_start_f413/examples/exint/exint_software_trigger/src/main.c:120
tmr1_config
static void tmr1_config(void)
tmr1 configuration.
Definition project/at_start_f413/examples/exint/exint_software_trigger/src/main.c:68
EXINT4_IRQHandler
void EXINT4_IRQHandler(void)
exint4 interrupt handler
Definition project/at_start_f413/examples/exint/exint_software_trigger/src/main.c:105
TMR1_OVF_TMR10_IRQHandler
void TMR1_OVF_TMR10_IRQHandler(void)
tmr1 interrupt handler
Definition project/at_start_f413/examples/exint/exint_software_trigger/src/main.c:90
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
system_core_clock
unsigned int system_core_clock
Definition system_at32f413.c:47
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_clocks_freq_get
void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
Definition at32f413_crm.c:660
CRM_IOMUX_PERIPH_CLOCK
@ CRM_IOMUX_PERIPH_CLOCK
Definition at32f413_crm.h:108
CRM_TMR1_PERIPH_CLOCK
@ CRM_TMR1_PERIPH_CLOCK
Definition at32f413_crm.h:116
TMR1_OVF_TMR10_IRQn
@ TMR1_OVF_TMR10_IRQn
Definition at32f413.h:197
EXINT4_IRQn
@ EXINT4_IRQn
Definition at32f413.h:181
exint_flag_clear
void exint_flag_clear(uint32_t exint_line)
clear exint flag
Definition at32f413_exint.c:125
exint_default_para_init
void exint_default_para_init(exint_init_type *exint_struct)
exint default para init
Definition at32f413_exint.c:63
exint_software_interrupt_event_generate
void exint_software_interrupt_event_generate(uint32_t exint_line)
generate exint software interrupt event
Definition at32f413_exint.c:197
exint_interrupt_flag_get
flag_status exint_interrupt_flag_get(uint32_t exint_line)
get exint interrupt flag
Definition at32f413_exint.c:168
exint_init
void exint_init(exint_init_type *exint_struct)
exint init
Definition at32f413_exint.c:77
EXINT_LINE_INTERRUPT
@ EXINT_LINE_INTERRUPT
Definition at32f413_exint.h:84
EXINT_TRIGGER_RISING_EDGE
@ EXINT_TRIGGER_RISING_EDGE
Definition at32f413_exint.h:93
EXINT_LINE_4
#define EXINT_LINE_4
Definition at32f413_exint.h:55
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
tmr_flag_clear
void tmr_flag_clear(tmr_type *tmr_x, uint32_t tmr_flag)
clear tmr flag
Definition at32f413_tmr.c:1433
tmr_counter_enable
void tmr_counter_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr counter
Definition at32f413_tmr.c:114
tmr_interrupt_flag_get
flag_status tmr_interrupt_flag_get(tmr_type *tmr_x, uint32_t tmr_flag)
get tmr interrupt flag
Definition at32f413_tmr.c:1357
tmr_clock_source_div_set
void tmr_clock_source_div_set(tmr_type *tmr_x, tmr_clock_division_type tmr_clock_div)
set tmr clock source division
Definition at32f413_tmr.c:204
tmr_base_init
void tmr_base_init(tmr_type *tmr_x, uint32_t tmr_pr, uint32_t tmr_div)
init tmr base
Definition at32f413_tmr.c:179
tmr_interrupt_enable
void tmr_interrupt_enable(tmr_type *tmr_x, uint32_t tmr_interrupt, confirm_state new_state)
enable or disable tmr interrupt
Definition at32f413_tmr.c:1327
tmr_cnt_dir_set
void tmr_cnt_dir_set(tmr_type *tmr_x, tmr_count_mode_type tmr_cnt_dir)
set tmr counter count direction
Definition at32f413_tmr.c:225
TMR_COUNT_UP
@ TMR_COUNT_UP
Definition at32f413_tmr.h:105
TMR_CLOCK_DIV1
@ TMR_CLOCK_DIV1
Definition at32f413_tmr.h:95
TMR_OVF_FLAG
#define TMR_OVF_FLAG
Definition at32f413_tmr.h:51
TMR_OVF_INT
#define TMR_OVF_INT
Definition at32f413_tmr.h:73
TMR1
#define TMR1
Definition at32f413_tmr.h:831
at32f413_clock.h
header file of clock program
crm_clocks_freq_type
crm clocks freqency structure
Definition at32f413_crm.h:470
exint_init_type
exint init type
Definition at32f413_exint.h:102
exint_init_type::line_select
uint32_t line_select
Definition at32f413_exint.h:104
exint_init_type::line_enable
confirm_state line_enable
Definition at32f413_exint.h:106
exint_init_type::line_mode
exint_line_mode_type line_mode
Definition at32f413_exint.h:103
exint_init_type::line_polarity
exint_polarity_config_type line_polarity
Definition at32f413_exint.h:105


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • flash
  • flash_write_read
  • inc
project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • flash
  • flash_write_read
  • inc
project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • flash
  • flash_write_read
  • inc
project/at_start_f413/examples/flash/flash_write_read/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: flash.h Source File

  • flash
  • flash_write_read
  • inc
project/at_start_f413/examples/flash/flash_write_read/inc/flash.h
Go to the documentation of this file.
1
26/* Define to prevent recursive inclusion -------------------------------------*/
27#ifndef __FLASH_H__
28#define __FLASH_H__
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "at32f413_board.h"
35
49void flash_read(uint32_t read_addr, uint16_t *p_buffer, uint16_t num_read);
50 error_status flash_write_nocheck(uint32_t write_addr, uint16_t *p_buffer, uint16_t num_write);
51 error_status flash_write(uint32_t write_addr,uint16_t *p_Buffer, uint16_t num_write);
52
65#ifdef __cplusplus
66}
67#endif
68
69#endif
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
error_status
error_status
error status
Definition at32f413.h:302
flash_write
error_status flash_write(uint32_t write_addr, uint16_t *p_Buffer, uint16_t num_write)
write data using halfword mode with checking
Definition project/at_start_f413/examples/flash/flash_write_read/src/flash.c:90
flash_read
void flash_read(uint32_t read_addr, uint16_t *p_buffer, uint16_t num_read)
read data using halfword mode
Definition project/at_start_f413/examples/flash/flash_write_read/src/flash.c:52
flash_write_nocheck
error_status flash_write_nocheck(uint32_t write_addr, uint16_t *p_buffer, uint16_t num_write)
write data using halfword mode without checking
Definition project/at_start_f413/examples/flash/flash_write_read/src/flash.c:69


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • flash
  • flash_write_read
  • src
project/at_start_f413/examples/flash/flash_write_read/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/flash/flash_write_read/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • flash
  • flash_write_read
  • src
project/at_start_f413/examples/flash/flash_write_read/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/flash/flash_write_read/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/flash/flash_write_read/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/flash/flash_write_read/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/flash/flash_write_read/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/flash/flash_write_read/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/flash/flash_write_read/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/flash/flash_write_read/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/flash/flash_write_read/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/flash/flash_write_read/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: flash.c Source File

  • flash
  • flash_write_read
  • src
project/at_start_f413/examples/flash/flash_write_read/src/flash.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "flash.h"
28
37#if defined (AT32F413xC)
38#define SECTOR_SIZE 2048 /* this parameter depends on the specific model of the chip */
39#else
40#define SECTOR_SIZE 1024 /* this parameter depends on the specific model of the chip */
41#endif
42
43uint16_t flash_buf[SECTOR_SIZE / 2];
44
52void flash_read(uint32_t read_addr, uint16_t *p_buffer, uint16_t num_read)
53{
54 uint16_t i;
55 for(i = 0; i < num_read; i++)
56 {
57 p_buffer[i] = *(uint16_t*)(read_addr);
58 read_addr += 2;
59 }
60}
61
69 error_status flash_write_nocheck(uint32_t write_addr, uint16_t *p_buffer, uint16_t num_write)
70{
71 uint16_t i;
72 flash_status_type status = FLASH_OPERATE_DONE;
73 for(i = 0; i < num_write; i++)
74 {
75 status = flash_halfword_program(write_addr, p_buffer[i]);
76 if(status != FLASH_OPERATE_DONE)
77 return ERROR;
78 write_addr += 2;
79 }
80 return SUCCESS;
81}
82
90 error_status flash_write(uint32_t write_addr, uint16_t *p_buffer, uint16_t num_write)
91{
92 uint32_t offset_addr;
93 uint32_t sector_position;
94 uint16_t sector_offset;
95 uint16_t sector_remain;
96 uint16_t i;
97 flash_status_type status = FLASH_OPERATE_DONE;
98
99 flash_unlock();
100 offset_addr = write_addr - FLASH_BASE;
101 sector_position = offset_addr / SECTOR_SIZE;
102 sector_offset = (offset_addr % SECTOR_SIZE) / 2;
103 sector_remain = SECTOR_SIZE / 2 - sector_offset;
104 if(num_write <= sector_remain)
105 sector_remain = num_write;
106 while(1)
107 {
108 flash_read(sector_position * SECTOR_SIZE + FLASH_BASE, flash_buf, SECTOR_SIZE / 2);
109 for(i = 0; i < sector_remain; i++)
110 {
111 if(flash_buf[sector_offset + i] != 0xFFFF)
112 break;
113 }
114 if(i < sector_remain)
115 {
116 /* wait for operation to be completed */
117 status = flash_operation_wait_for(ERASE_TIMEOUT);
118
119 if((status == FLASH_PROGRAM_ERROR) || (status == FLASH_EPP_ERROR))
120 flash_flag_clear(FLASH_PRGMERR_FLAG | FLASH_EPPERR_FLAG);
121 else if(status == FLASH_OPERATE_TIMEOUT)
122 return ERROR;
123 status = flash_sector_erase(sector_position * SECTOR_SIZE + FLASH_BASE);
124 if(status != FLASH_OPERATE_DONE)
125 return ERROR;
126 for(i = 0; i < sector_remain; i++)
127 {
128 flash_buf[i + sector_offset] = p_buffer[i];
129 }
130 if(flash_write_nocheck(sector_position * SECTOR_SIZE + FLASH_BASE, flash_buf, SECTOR_SIZE / 2) != SUCCESS)
131 return ERROR;
132 }
133 else
134 {
135 if(flash_write_nocheck(write_addr, p_buffer, sector_remain) != SUCCESS)
136 return ERROR;
137 }
138 if(num_write == sector_remain)
139 break;
140 else
141 {
142 sector_position++;
143 sector_offset = 0;
144 p_buffer += sector_remain;
145 write_addr += (sector_remain * 2);
146 num_write -= sector_remain;
147 if(num_write > (SECTOR_SIZE / 2))
148 sector_remain = SECTOR_SIZE / 2;
149 else
150 sector_remain = num_write;
151 }
152 }
153 flash_lock();
154 return SUCCESS;
155}
156
157
158
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
flash_buf
uint16_t flash_buf[1024/2]
Definition project/at_start_f413/examples/flash/flash_write_read/src/flash.c:43
flash_write
error_status flash_write(uint32_t write_addr, uint16_t *p_buffer, uint16_t num_write)
write data using halfword mode with checking
Definition project/at_start_f413/examples/flash/flash_write_read/src/flash.c:90
SECTOR_SIZE
#define SECTOR_SIZE
Definition project/at_start_f413/examples/flash/flash_write_read/src/flash.c:40
flash_read
void flash_read(uint32_t read_addr, uint16_t *p_buffer, uint16_t num_read)
read data using halfword mode
Definition project/at_start_f413/examples/flash/flash_write_read/src/flash.c:52
flash_write_nocheck
error_status flash_write_nocheck(uint32_t write_addr, uint16_t *p_buffer, uint16_t num_write)
write data using halfword mode without checking
Definition project/at_start_f413/examples/flash/flash_write_read/src/flash.c:69
error_status
error_status
error status
Definition at32f413.h:302
ERROR
@ ERROR
Definition at32f413.h:302
SUCCESS
@ SUCCESS
Definition at32f413.h:302
flash_sector_erase
flash_status_type flash_sector_erase(uint32_t sector_address)
erase a specified flash sector.
Definition at32f413_flash.c:272
flash_halfword_program
flash_status_type flash_halfword_program(uint32_t address, uint16_t data)
program a halfword at a specified address.
Definition at32f413_flash.c:452
flash_unlock
void flash_unlock(void)
unlock the flash controller.
Definition at32f413_flash.c:228
flash_lock
void flash_lock(void)
lock the flash controller.
Definition at32f413_flash.c:251
flash_operation_wait_for
flash_status_type flash_operation_wait_for(uint32_t time_out)
wait for flash operation complete or timeout.
Definition at32f413_flash.c:179
flash_flag_clear
void flash_flag_clear(uint32_t flash_flag)
clear the flash flag.
Definition at32f413_flash.c:97
flash_status_type
flash_status_type
flash status type
Definition at32f413_flash.h:158
FLASH_OPERATE_DONE
@ FLASH_OPERATE_DONE
Definition at32f413_flash.h:162
FLASH_OPERATE_TIMEOUT
@ FLASH_OPERATE_TIMEOUT
Definition at32f413_flash.h:163
FLASH_PROGRAM_ERROR
@ FLASH_PROGRAM_ERROR
Definition at32f413_flash.h:160
FLASH_EPP_ERROR
@ FLASH_EPP_ERROR
Definition at32f413_flash.h:161
FLASH_PRGMERR_FLAG
#define FLASH_PRGMERR_FLAG
Definition at32f413_flash.h:78
FLASH_EPPERR_FLAG
#define FLASH_EPPERR_FLAG
Definition at32f413_flash.h:79
ERASE_TIMEOUT
#define ERASE_TIMEOUT
Definition at32f413_flash.h:140
FLASH_BASE
#define FLASH_BASE
Definition at32f413.h:329


AT32F413 Firmwary Library: main.c Source File

  • flash
  • flash_write_read
  • src
project/at_start_f413/examples/flash/flash_write_read/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include "flash.h"
29
38#define TEST_BUFEER_SIZE 3000
39#define TEST_FLASH_ADDRESS_START (0x08000000 + 1024 * 10)
40
41uint16_t buffer_write[TEST_BUFEER_SIZE];
42uint16_t buffer_read[TEST_BUFEER_SIZE];
43
44 error_status buffer_compare(uint16_t* p_buffer1, uint16_t* p_buffer2, uint16_t buffer_length);
45
53 error_status buffer_compare(uint16_t* p_buffer1, uint16_t* p_buffer2, uint16_t buffer_length)
54{
55 while(buffer_length--)
56 {
57 if(*p_buffer1 != *p_buffer2)
58 {
59 return ERROR;
60 }
61 p_buffer1++;
62 p_buffer2++;
63 }
64 return SUCCESS;
65}
66
72int main(void)
73{
74 uint32_t index=0;
75 error_status err_status;
76 system_clock_config();
77 at32_board_init();
78 /* fill buffer_write data to test */
79 for(index = 0; index < TEST_BUFEER_SIZE; index++)
80 {
81 buffer_write[index] = index;
82 }
83
84 /* write data to flash */
85 err_status = flash_write(TEST_FLASH_ADDRESS_START, buffer_write, TEST_BUFEER_SIZE);
86
87 /* read data from flash */
88 flash_read(TEST_FLASH_ADDRESS_START, buffer_read, TEST_BUFEER_SIZE);
89
90 /* compare the buffer */
91 if((buffer_compare(buffer_write, buffer_read, TEST_BUFEER_SIZE) == SUCCESS) && (err_status == SUCCESS))
92 {
93 at32_led_on(LED2);
94 at32_led_on(LED3);
95 at32_led_on(LED4);
96 }
97
98 while(1)
99 {
100 }
101}
102
103
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
TEST_BUFEER_SIZE
#define TEST_BUFEER_SIZE
Definition project/at_start_f413/examples/flash/flash_write_read/src/main.c:38
buffer_read
uint16_t buffer_read[3000]
Definition project/at_start_f413/examples/flash/flash_write_read/src/main.c:42
TEST_FLASH_ADDRESS_START
#define TEST_FLASH_ADDRESS_START
Definition project/at_start_f413/examples/flash/flash_write_read/src/main.c:39
buffer_compare
error_status buffer_compare(uint16_t *p_buffer1, uint16_t *p_buffer2, uint16_t buffer_length)
compares two buffers.
Definition project/at_start_f413/examples/flash/flash_write_read/src/main.c:53
main
int main(void)
main function.
Definition project/at_start_f413/examples/flash/flash_write_read/src/main.c:72
buffer_write
uint16_t buffer_write[3000]
Definition project/at_start_f413/examples/flash/flash_write_read/src/main.c:41
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
error_status
error_status
error status
Definition at32f413.h:302
ERROR
@ ERROR
Definition at32f413.h:302
SUCCESS
@ SUCCESS
Definition at32f413.h:302
flash_write
error_status flash_write(uint32_t write_addr, uint16_t *p_Buffer, uint16_t num_write)
write data using halfword mode with checking
Definition project/at_start_f413/examples/flash/flash_write_read/src/flash.c:90
flash_read
void flash_read(uint32_t read_addr, uint16_t *p_buffer, uint16_t num_read)
read data using halfword mode
Definition project/at_start_f413/examples/flash/flash_write_read/src/flash.c:52
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • flash
  • operate_spim
  • inc
project/at_start_f413/examples/flash/operate_spim/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • flash
  • operate_spim
  • inc
project/at_start_f413/examples/flash/operate_spim/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • flash
  • operate_spim
  • inc
project/at_start_f413/examples/flash/operate_spim/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • flash
  • operate_spim
  • src
project/at_start_f413/examples/flash/operate_spim/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_30, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_30
@ CRM_PLL_MULT_30
Definition at32f413_crm.h:232
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/flash/operate_spim/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • flash
  • operate_spim
  • src
project/at_start_f413/examples/flash/operate_spim/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
43void NMI_Handler(void)
44{
45}
46
52void HardFault_Handler(void)
53{
54 /* go to infinite loop when hard fault exception occurs */
55 while(1)
56 {
57 }
58}
59
65void MemManage_Handler(void)
66{
67 /* go to infinite loop when memory manage exception occurs */
68 while(1)
69 {
70 }
71}
72
78void BusFault_Handler(void)
79{
80 /* go to infinite loop when bus fault exception occurs */
81 while(1)
82 {
83 }
84}
85
91void UsageFault_Handler(void)
92{
93 /* go to infinite loop when usage fault exception occurs */
94 while(1)
95 {
96 }
97}
98
104void SVC_Handler(void)
105{
106}
107
113void DebugMon_Handler(void)
114{
115}
116
122void PendSV_Handler(void)
123{
124}
125
131void SysTick_Handler(void)
132{
133}
134
135
136
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/flash/operate_spim/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/flash/operate_spim/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/flash/operate_spim/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/flash/operate_spim/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/flash/operate_spim/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/flash/operate_spim/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/flash/operate_spim/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/flash/operate_spim/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/flash/operate_spim/src/at32f413_int.c:113
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • flash
  • operate_spim
  • src
project/at_start_f413/examples/flash/operate_spim/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include "operate_spim.h"
29
30
44int main(void)
45{
46 system_clock_config();
47
48 at32_board_init();
49
50 /* operate spim flash */
51 spim_operate();
52
53 while(1)
54 {
55
56 }
57}
58
59
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
main
int main(void)
main function.
Definition project/at_start_f413/examples/flash/operate_spim/src/main.c:44
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
spim_operate
void spim_operate(void)
operate spim flash
Definition operate_spim.c:111
operate_spim.h
operate_spim header file
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • flash
  • run_in_spim
  • inc
project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • flash
  • run_in_spim
  • inc
project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • flash
  • run_in_spim
  • inc
project/at_start_f413/examples/flash/run_in_spim/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • flash
  • run_in_spim
  • src
project/at_start_f413/examples/flash/run_in_spim/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_30, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_30
@ CRM_PLL_MULT_30
Definition at32f413_crm.h:232
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/flash/run_in_spim/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • flash
  • run_in_spim
  • src
project/at_start_f413/examples/flash/run_in_spim/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
29
44void NMI_Handler(void)
45{
46}
47
53void HardFault_Handler(void)
54{
55 /* go to infinite loop when hard fault exception occurs */
56 while(1)
57 {
58 }
59}
60
66void MemManage_Handler(void)
67{
68 /* go to infinite loop when memory manage exception occurs */
69 while(1)
70 {
71 }
72}
73
79void BusFault_Handler(void)
80{
81 /* go to infinite loop when bus fault exception occurs */
82 while(1)
83 {
84 }
85}
86
92void UsageFault_Handler(void)
93{
94 /* go to infinite loop when usage fault exception occurs */
95 while(1)
96 {
97 }
98}
99
105void SVC_Handler(void)
106{
107}
108
114void DebugMon_Handler(void)
115{
116}
117
123void PendSV_Handler(void)
124{
125}
126
132void SysTick_Handler(void)
133{
134}
135
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/flash/run_in_spim/src/at32f413_int.c:92
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/flash/run_in_spim/src/at32f413_int.c:53
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/flash/run_in_spim/src/at32f413_int.c:66
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/flash/run_in_spim/src/at32f413_int.c:105
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/flash/run_in_spim/src/at32f413_int.c:123
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/flash/run_in_spim/src/at32f413_int.c:44
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/flash/run_in_spim/src/at32f413_int.c:79
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/flash/run_in_spim/src/at32f413_int.c:132
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/flash/run_in_spim/src/at32f413_int.c:114
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • flash
  • run_in_spim
  • src
project/at_start_f413/examples/flash/run_in_spim/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include "run_in_spim.h"
29
30
44void spim_init(void)
45{
46 gpio_init_type gpio_init_struct;
47
48 /* enable the clock */
49 crm_periph_clock_enable(CRM_IOMUX_PERIPH_CLOCK, TRUE);
50 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
51 crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
52
53 /* init spim io */
54 gpio_default_para_init(&gpio_init_struct);
55 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
56 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
57 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
58 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
59 gpio_init_struct.gpio_pins = GPIO_PINS_8;
60 gpio_init(GPIOA, &gpio_init_struct);
61 gpio_init_struct.gpio_pins = GPIO_PINS_1 | GPIO_PINS_6 | GPIO_PINS_7 | GPIO_PINS_10 | GPIO_PINS_11;
62 gpio_init(GPIOB, &gpio_init_struct);
63
64 /* enable spim, and select pb10, pb11 as spim io */
65 gpio_pin_remap_config(EXT_SPIM_GMUX_1001, TRUE);
66
67 /* in this example, use on-board en25qh128a as spim flash */
68 flash_spim_model_select(FLASH_SPIM_MODEL2);
69
70 /* for model 1 flash, a delay needs to be added */
71 delay_ms(20);
72
73 /* unlock the spim flash program erase controller */
74 while(flash_flag_get(FLASH_SPIM_OBF_FLAG));
75 flash_spim_unlock();
76 while(FLASH->ctrl3_bit.oplk);
77
78 /* if the data written to spim flash need to be scrambled, please specify the scrambled range */
79 flash_spim_encryption_range_set(0);
80
81 return;
82}
83
89int main(void)
90{
91 system_clock_config();
92 at32_board_init();
93
94 /* configures the spim flash */
95 spim_init();
96
97 /* check the led toggle in spim */
98 spim_run();
99
100 while(1)
101 {
102 }
103}
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
spim_run
void spim_run(void)
check the led toggle in spim
Definition run_in_spim.c:44
main
int main(void)
main function.
Definition project/at_start_f413/examples/flash/run_in_spim/src/main.c:89
spim_init
void spim_init(void)
init the spim flash
Definition project/at_start_f413/examples/flash/run_in_spim/src/main.c:44
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_IOMUX_PERIPH_CLOCK
@ CRM_IOMUX_PERIPH_CLOCK
Definition at32f413_crm.h:108
CRM_GPIOB_PERIPH_CLOCK
@ CRM_GPIOB_PERIPH_CLOCK
Definition at32f413_crm.h:110
TRUE
@ TRUE
Definition at32f413.h:297
flash_spim_unlock
void flash_spim_unlock(void)
unlock the flash spim controller.
Definition at32f413_flash.c:239
flash_spim_model_select
void flash_spim_model_select(flash_spim_model_type mode)
select spim supports extended spi flash chip model.
Definition at32f413_flash.c:746
flash_spim_encryption_range_set
void flash_spim_encryption_range_set(uint32_t decode_address)
set the range of encryption in spim flash. when the address is larger than this value,...
Definition at32f413_flash.c:761
flash_flag_get
flag_status flash_flag_get(uint32_t flash_flag)
check whether the specified flash flag is set or not.
Definition at32f413_flash.c:58
FLASH_SPIM_MODEL2
@ FLASH_SPIM_MODEL2
Definition at32f413_flash.h:172
FLASH_SPIM_OBF_FLAG
#define FLASH_SPIM_OBF_FLAG
Definition at32f413_flash.h:80
FLASH
#define FLASH
Definition at32f413_flash.h:563
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_pin_remap_config
void gpio_pin_remap_config(uint32_t gpio_remap, confirm_state new_state)
iomux remap and debug i/o configuration.
Definition at32f413_gpio.c:549
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_10
#define GPIO_PINS_10
Definition at32f413_gpio.h:60
GPIO_PINS_6
#define GPIO_PINS_6
Definition at32f413_gpio.h:56
GPIO_PINS_11
#define GPIO_PINS_11
Definition at32f413_gpio.h:61
GPIO_PINS_7
#define GPIO_PINS_7
Definition at32f413_gpio.h:57
GPIO_PINS_8
#define GPIO_PINS_8
Definition at32f413_gpio.h:58
GPIO_PINS_1
#define GPIO_PINS_1
Definition at32f413_gpio.h:51
GPIOB
#define GPIOB
Definition at32f413_gpio.h:748
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
EXT_SPIM_GMUX_1001
#define EXT_SPIM_GMUX_1001
Definition at32f413_gpio.h:190
at32f413_clock.h
header file of clock program
run_in_spim.h
run_in_spim header file
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • gpio
  • io_toggle
  • inc
project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • gpio
  • io_toggle
  • inc
project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • gpio
  • io_toggle
  • inc
project/at_start_f413/examples/gpio/io_toggle/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • gpio
  • io_toggle
  • src
project/at_start_f413/examples/gpio/io_toggle/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/gpio/io_toggle/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • gpio
  • io_toggle
  • src
project/at_start_f413/examples/gpio/io_toggle/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
134
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/gpio/io_toggle/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/gpio/io_toggle/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/gpio/io_toggle/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/gpio/io_toggle/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/gpio/io_toggle/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/gpio/io_toggle/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/gpio/io_toggle/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/gpio/io_toggle/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/gpio/io_toggle/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • gpio
  • io_toggle
  • src
project/at_start_f413/examples/gpio/io_toggle/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
29
43void gpio_config(void)
44{
45 gpio_init_type gpio_init_struct;
46
47 /* enable the gpioa clock */
48 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
49
50 /* set default parameter */
51 gpio_default_para_init(&gpio_init_struct);
52
53 /* configure the gpio */
54 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
55 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
56 gpio_init_struct.gpio_mode = GPIO_MODE_OUTPUT;
57 gpio_init_struct.gpio_pins = GPIO_PINS_1;
58 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
59 gpio_init(GPIOA, &gpio_init_struct);
60}
61
67int main(void)
68{
69 system_clock_config();
70
71 gpio_config();
72
73 while(1)
74 {
75 /* set pa.01 */
76 GPIOA->scr = GPIO_PINS_1;
77 /* reset pa.01 */
78 GPIOA->clr = GPIO_PINS_1;
79
80 /* set pa.01 */
81 GPIOA->scr = GPIO_PINS_1;
82 /* reset pa.01 */
83 GPIOA->clr = GPIO_PINS_1;
84
85 /* set pa.01 */
86 GPIOA->scr = GPIO_PINS_1;
87 /* reset pa.01 */
88 GPIOA->clr = GPIO_PINS_1;
89
90 /* set pa.01 */
91 GPIOA->scr = GPIO_PINS_1;
92 /* reset pa.01 */
93 GPIOA->clr = GPIO_PINS_1;
94
95 /* set pa.01 */
96 GPIOA->scr = GPIO_PINS_1;
97 /* reset pa.01 */
98 GPIOA->clr = GPIO_PINS_1;
99
100 /* set pa.01 */
101 GPIOA->scr = GPIO_PINS_1;
102 /* reset pa.01 */
103 GPIOA->clr = GPIO_PINS_1;
104 }
105}
106
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
gpio_config
void gpio_config(void)
pa.01 gpio configuration.
Definition project/at_start_f413/examples/gpio/io_toggle/src/main.c:43
main
int main(void)
main function.
Definition project/at_start_f413/examples/gpio/io_toggle/src/main.c:67
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
TRUE
@ TRUE
Definition at32f413.h:297
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_OUTPUT
@ GPIO_MODE_OUTPUT
Definition at32f413_gpio.h:214
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_1
#define GPIO_PINS_1
Definition at32f413_gpio.h:51
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
at32f413_clock.h
header file of clock program
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • gpio
  • led_toggle
  • inc
project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • gpio
  • led_toggle
  • inc
project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • gpio
  • led_toggle
  • inc
project/at_start_f413/examples/gpio/led_toggle/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • gpio
  • led_toggle
  • src
project/at_start_f413/examples/gpio/led_toggle/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/gpio/led_toggle/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • gpio
  • led_toggle
  • src
project/at_start_f413/examples/gpio/led_toggle/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
134
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/gpio/led_toggle/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/gpio/led_toggle/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/gpio/led_toggle/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/gpio/led_toggle/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/gpio/led_toggle/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/gpio/led_toggle/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/gpio/led_toggle/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/gpio/led_toggle/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/gpio/led_toggle/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • gpio
  • led_toggle
  • src
project/at_start_f413/examples/gpio/led_toggle/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
29
43int main(void)
44{
45 system_clock_config();
46
47 at32_board_init();
48
49 while(1)
50 {
51 at32_led_toggle(LED2);
52 delay_ms(200);
53 at32_led_toggle(LED3);
54 delay_ms(200);
55 at32_led_toggle(LED4);
56 delay_ms(200);
57 }
58}
59
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
main
int main(void)
main function.
Definition project/at_start_f413/examples/gpio/led_toggle/src/main.c:43
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • gpio
  • swjtag_remap
  • inc
project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • gpio
  • swjtag_remap
  • inc
project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • gpio
  • swjtag_remap
  • inc
project/at_start_f413/examples/gpio/swjtag_remap/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • gpio
  • swjtag_remap
  • src
project/at_start_f413/examples/gpio/swjtag_remap/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/gpio/swjtag_remap/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • gpio
  • swjtag_remap
  • src
project/at_start_f413/examples/gpio/swjtag_remap/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
43void NMI_Handler(void)
44{
45}
46
52void HardFault_Handler(void)
53{
54 /* go to infinite loop when hard fault exception occurs */
55 while(1)
56 {
57 }
58}
59
65void MemManage_Handler(void)
66{
67 /* go to infinite loop when memory manage exception occurs */
68 while(1)
69 {
70 }
71}
72
78void BusFault_Handler(void)
79{
80 /* go to infinite loop when bus fault exception occurs */
81 while(1)
82 {
83 }
84}
85
91void UsageFault_Handler(void)
92{
93 /* go to infinite loop when usage fault exception occurs */
94 while(1)
95 {
96 }
97}
98
104void SVC_Handler(void)
105{
106}
107
113void DebugMon_Handler(void)
114{
115}
116
122void PendSV_Handler(void)
123{
124}
125
131void SysTick_Handler(void)
132{
133}
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/gpio/swjtag_remap/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/gpio/swjtag_remap/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/gpio/swjtag_remap/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/gpio/swjtag_remap/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/gpio/swjtag_remap/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/gpio/swjtag_remap/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/gpio/swjtag_remap/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/gpio/swjtag_remap/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/gpio/swjtag_remap/src/at32f413_int.c:113
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • gpio
  • swjtag_remap
  • src
project/at_start_f413/examples/gpio/swjtag_remap/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
29
38void swj_dp_config(void);
39void gpio_pins_toggle(gpio_type* gpio_x, uint16_t gpio_pin);
40
46void swj_dp_config(void)
47{
48 gpio_init_type gpio_init_struct;
49
50 /* configure pa13 (jtms/swdat), pa14 (jtck/swclk) and pa15 (jtdi) as output push-pull */
51 gpio_init_struct.gpio_pins = GPIO_PINS_13 | GPIO_PINS_14 | GPIO_PINS_15;
52 gpio_init_struct.gpio_mode = GPIO_MODE_OUTPUT;
53 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
54 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
55 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
56 gpio_init(GPIOA, &gpio_init_struct);
57
58 /* configure pb3 (jtdo) and pb4 (jtrst) as output push-pull */
59 gpio_init_struct.gpio_pins = GPIO_PINS_3 | GPIO_PINS_4;
60 gpio_init(GPIOB, &gpio_init_struct);
61}
62
69void gpio_pins_toggle(gpio_type* gpio_x, uint16_t gpio_pin)
70{
71 gpio_x->odt ^= gpio_pin;
72}
73
79int main(void)
80{
81 system_clock_config();
82
83 at32_board_init();
84
85 crm_periph_clock_enable(CRM_IOMUX_PERIPH_CLOCK, TRUE);
86 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
87 crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
88
89 swj_dp_config();
90
91 while(1)
92 {
93 if(USER_BUTTON == at32_button_press())
94 {
95 /* disable the serial wire jtag debug port swj-dp */
96 gpio_pin_remap_config(SWJTAG_CONF_100, TRUE);
97
98 /* turn on led3 */
99 at32_led_on(LED3);
100 }
101
102 /* toggle jtms/swdat pin */
103 gpio_pins_toggle(GPIOA, GPIO_PINS_13);
104 delay_us(200);
105
106 /* toggle jtck/swclk pin */
107 gpio_pins_toggle(GPIOA, GPIO_PINS_14);
108 delay_us(200);
109
110 /* toggle jtdi pin */
111 gpio_pins_toggle(GPIOA, GPIO_PINS_15);
112 delay_us(200);
113
114 /* toggle jtdo pin */
115 gpio_pins_toggle(GPIOB, GPIO_PINS_3);
116 delay_us(200);
117
118 /* toggle jtrst pin */
119 gpio_pins_toggle(GPIOB, GPIO_PINS_4);
120 delay_us(200);
121 }
122}
123
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
gpio_pins_toggle
void gpio_pins_toggle(gpio_type *gpio_x, uint16_t gpio_pin)
toggles the specified gpio pin
Definition project/at_start_f413/examples/gpio/swjtag_remap/src/main.c:69
main
int main(void)
main function.
Definition project/at_start_f413/examples/gpio/swjtag_remap/src/main.c:79
swj_dp_config
void swj_dp_config(void)
configure the gpio of swj-dp.
Definition project/at_start_f413/examples/gpio/swjtag_remap/src/main.c:46
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
LED3
@ LED3
Definition at32f413_board.h:63
USER_BUTTON
@ USER_BUTTON
Definition at32f413_board.h:93
at32_button_press
button_type at32_button_press()
returns which button have press down
Definition at32f413_board.c:218
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
delay_us
void delay_us(uint32_t nus)
inserts a delay time.
Definition at32f413_board.c:330
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_IOMUX_PERIPH_CLOCK
@ CRM_IOMUX_PERIPH_CLOCK
Definition at32f413_crm.h:108
CRM_GPIOB_PERIPH_CLOCK
@ CRM_GPIOB_PERIPH_CLOCK
Definition at32f413_crm.h:110
TRUE
@ TRUE
Definition at32f413.h:297
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_pin_remap_config
void gpio_pin_remap_config(uint32_t gpio_remap, confirm_state new_state)
iomux remap and debug i/o configuration.
Definition at32f413_gpio.c:549
GPIO_MODE_OUTPUT
@ GPIO_MODE_OUTPUT
Definition at32f413_gpio.h:214
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_13
#define GPIO_PINS_13
Definition at32f413_gpio.h:63
GPIO_PINS_3
#define GPIO_PINS_3
Definition at32f413_gpio.h:53
GPIO_PINS_14
#define GPIO_PINS_14
Definition at32f413_gpio.h:64
GPIO_PINS_4
#define GPIO_PINS_4
Definition at32f413_gpio.h:54
GPIO_PINS_15
#define GPIO_PINS_15
Definition at32f413_gpio.h:65
GPIOB
#define GPIOB
Definition at32f413_gpio.h:748
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
SWJTAG_CONF_100
#define SWJTAG_CONF_100
Definition at32f413_gpio.h:99
at32f413_clock.h
header file of clock program
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
gpio_type
type define gpio register all
Definition at32f413_gpio.h:299
gpio_type::odt
__IO uint32_t odt
Definition at32f413_gpio.h:387


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • i2c
  • communication_dma
  • inc
project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • i2c
  • communication_dma
  • inc
project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • i2c
  • communication_dma
  • inc
project/at_start_f413/examples/i2c/communication_dma/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • i2c
  • communication_dma
  • src
project/at_start_f413/examples/i2c/communication_dma/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/i2c/communication_dma/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • i2c
  • communication_dma
  • src
project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28#include "i2c_application.h"
29
30extern i2c_handle_type hi2cx;
31
32#define I2Cx_DMA_TX_IRQHandler DMA1_Channel6_IRQHandler
33#define I2Cx_DMA_RX_IRQHandler DMA1_Channel7_IRQHandler
34#define I2Cx_EVT_IRQHandler I2C1_EVT_IRQHandler
35#define I2Cx_ERR_IRQHandler I2C1_ERR_IRQHandler
36
50void NMI_Handler(void)
51{
52}
53
59void HardFault_Handler(void)
60{
61 /* go to infinite loop when hard fault exception occurs */
62 while(1)
63 {
64 }
65}
66
72void MemManage_Handler(void)
73{
74 /* go to infinite loop when memory manage exception occurs */
75 while(1)
76 {
77 }
78}
79
85void BusFault_Handler(void)
86{
87 /* go to infinite loop when bus fault exception occurs */
88 while(1)
89 {
90 }
91}
92
98void UsageFault_Handler(void)
99{
100 /* go to infinite loop when usage fault exception occurs */
101 while(1)
102 {
103 }
104}
105
111void SVC_Handler(void)
112{
113}
114
120void DebugMon_Handler(void)
121{
122}
123
129void PendSV_Handler(void)
130{
131}
132
138void SysTick_Handler(void)
139{
140}
141
147void I2Cx_DMA_RX_IRQHandler(void)
148{
149 i2c_dma_rx_irq_handler(&hi2cx);
150}
151
157void I2Cx_DMA_TX_IRQHandler(void)
158{
159 i2c_dma_tx_irq_handler(&hi2cx);
160}
161
167void I2Cx_EVT_IRQHandler(void)
168{
169 i2c_evt_irq_handler(&hi2cx);
170}
171
177void I2Cx_ERR_IRQHandler(void)
178{
179 i2c_err_irq_handler(&hi2cx);
180}
181
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c:98
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c:59
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c:72
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c:111
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c:129
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c:50
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c:85
hi2cx
i2c_handle_type hi2cx
Definition project/at_start_f413/examples/i2c/communication_dma/src/main.c:70
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c:138
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c:120
i2c_evt_irq_handler
void i2c_evt_irq_handler(i2c_handle_type *hi2c)
interrupt procession function.
Definition i2c_application.c:2223
i2c_err_irq_handler
void i2c_err_irq_handler(i2c_handle_type *hi2c)
i2c error interrupt function.
Definition i2c_application.c:2339
i2c_dma_rx_irq_handler
void i2c_dma_rx_irq_handler(i2c_handle_type *hi2c)
dma reveive complete interrupt function.
Definition i2c_application.c:2293
i2c_dma_tx_irq_handler
void i2c_dma_tx_irq_handler(i2c_handle_type *hi2c)
dma transmission complete interrupt function.
Definition i2c_application.c:2256
i2c_application.h
i2c application libray header file
I2Cx_EVT_IRQHandler
#define I2Cx_EVT_IRQHandler
Definition project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c:34
I2Cx_ERR_IRQHandler
#define I2Cx_ERR_IRQHandler
Definition project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c:35
I2Cx_DMA_TX_IRQHandler
#define I2Cx_DMA_TX_IRQHandler
Definition project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c:32
I2Cx_DMA_RX_IRQHandler
#define I2Cx_DMA_RX_IRQHandler
Definition project/at_start_f413/examples/i2c/communication_dma/src/at32f413_int.c:33
at32f413_int.h
header file of main interrupt service routines.
i2c_handle_type
Definition i2c_application.h:127


AT32F413 Firmwary Library: main.c Source File

  • i2c
  • communication_dma
  • src
project/at_start_f413/examples/i2c/communication_dma/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include "i2c_application.h"
29
38#define I2C_TIMEOUT 0xFFFFFFFF
39
40#define I2Cx_SPEED 100000
41#define I2Cx_ADDRESS 0xA0
42
43#define I2Cx_PORT I2C1
44#define I2Cx_CLK CRM_I2C1_PERIPH_CLOCK
45
46#define I2Cx_SCL_PIN GPIO_PINS_6
47#define I2Cx_SCL_GPIO_PORT GPIOB
48#define I2Cx_SCL_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
49
50#define I2Cx_SDA_PIN GPIO_PINS_7
51#define I2Cx_SDA_GPIO_PORT GPIOB
52#define I2Cx_SDA_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
53
54#define I2Cx_DMA_CLK CRM_DMA1_PERIPH_CLOCK
55#define I2Cx_DMA_TX_CHANNEL DMA1_CHANNEL6
56#define I2Cx_DMA_TX_IRQn DMA1_Channel6_IRQn
57
58#define I2Cx_DMA_RX_CHANNEL DMA1_CHANNEL7
59#define I2Cx_DMA_RX_IRQn DMA1_Channel7_IRQn
60
61#define I2Cx_EVT_IRQn I2C1_EVT_IRQn
62#define I2Cx_ERR_IRQn I2C1_ERR_IRQn
63
64#define BUF_SIZE 8
65#define MASTER_BOARD
66
67uint8_t tx_buf[BUF_SIZE] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08};
68uint8_t rx_buf[BUF_SIZE] = {0};
69
70 i2c_handle_type hi2cx;
71
72uint32_t buffer_compare(uint8_t* buffer1, uint8_t* buffer2, uint32_t len);
73void i2c_lowlevel_init(i2c_handle_type* hi2c);
74
80void error_handler(uint32_t error_code)
81{
82 while(1)
83 {
84 at32_led_toggle(LED2);
85 delay_ms(500);
86 }
87}
88
96uint32_t buffer_compare(uint8_t* buffer1, uint8_t* buffer2, uint32_t len)
97{
98 uint32_t i;
99
100 for(i = 0; i < len; i++)
101 {
102 if(buffer1[i] != buffer2[i])
103 {
104 return 1;
105 }
106 }
107
108 return 0;
109}
110
116void i2c_lowlevel_init(i2c_handle_type* hi2c)
117{
118 gpio_init_type gpio_initstructure;
119
120 if(hi2c->i2cx == I2Cx_PORT)
121 {
122 /* i2c periph clock enable */
123 crm_periph_clock_enable(I2Cx_CLK, TRUE);
124 crm_periph_clock_enable(I2Cx_SCL_GPIO_CLK, TRUE);
125 crm_periph_clock_enable(I2Cx_SDA_GPIO_CLK, TRUE);
126
127 /* gpio configuration */
128 gpio_initstructure.gpio_out_type = GPIO_OUTPUT_OPEN_DRAIN;
129 gpio_initstructure.gpio_pull = GPIO_PULL_NONE;
130 gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
131 gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_MODERATE;
132
133 /* configure i2c pins: scl */
134 gpio_initstructure.gpio_pins = I2Cx_SCL_PIN;
135 gpio_init(I2Cx_SCL_GPIO_PORT, &gpio_initstructure);
136
137 /* configure i2c pins: sda */
138 gpio_initstructure.gpio_pins = I2Cx_SDA_PIN;
139 gpio_init(I2Cx_SDA_GPIO_PORT, &gpio_initstructure);
140
141 /* configure and enable i2c dma channel interrupt */
142 nvic_irq_enable(I2Cx_DMA_TX_IRQn, 0, 0);
143 nvic_irq_enable(I2Cx_DMA_RX_IRQn, 0, 0);
144
145 /* configure and enable i2c interrupt */
146 nvic_irq_enable(I2Cx_EVT_IRQn, 0, 0);
147 nvic_irq_enable(I2Cx_ERR_IRQn, 0, 0);
148
149 /* i2c dma tx and rx channels configuration */
150 /* enable the dma clock */
151 crm_periph_clock_enable(I2Cx_DMA_CLK, TRUE);
152
153 /* i2c dma channel configuration */
154 hi2c->dma_tx_channel = I2Cx_DMA_TX_CHANNEL;
155 hi2c->dma_rx_channel = I2Cx_DMA_RX_CHANNEL;
156
157 dma_reset(hi2c->dma_tx_channel);
158 dma_reset(hi2c->dma_rx_channel);
159
160 dma_default_para_init(&hi2c->dma_init_struct);
161 hi2c->dma_init_struct.peripheral_inc_enable = FALSE;
162 hi2c->dma_init_struct.memory_inc_enable = TRUE;
163 hi2c->dma_init_struct.peripheral_data_width = DMA_PERIPHERAL_DATA_WIDTH_BYTE;
164 hi2c->dma_init_struct.memory_data_width = DMA_MEMORY_DATA_WIDTH_BYTE;
165 hi2c->dma_init_struct.loop_mode_enable = FALSE;
166 hi2c->dma_init_struct.priority = DMA_PRIORITY_LOW;
167 hi2c->dma_init_struct.direction = DMA_DIR_MEMORY_TO_PERIPHERAL;
168
169 dma_init(hi2c->dma_tx_channel, &hi2c->dma_init_struct);
170 dma_init(hi2c->dma_rx_channel, &hi2c->dma_init_struct);
171
172 i2c_init(hi2c->i2cx, I2C_FSMODE_DUTY_2_1, I2Cx_SPEED);
173
174 i2c_own_address1_set(hi2c->i2cx, I2C_ADDRESS_MODE_7BIT, I2Cx_ADDRESS);
175 }
176}
177
183int main(void)
184{
185 i2c_status_type i2c_status;
186
187 /* config nvic priority group */
188 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
189
190 system_clock_config();
191
192 at32_board_init();
193
194 hi2cx.i2cx = I2Cx_PORT;
195
196 i2c_config(&hi2cx);
197
198 while(1)
199 {
200
201#if defined (MASTER_BOARD)
202
203 /* wait for key USER_BUTTON press before starting the communication */
204 while(at32_button_press() != USER_BUTTON)
205 {
206 }
207
208 /* start the request reception process */
209 if((i2c_status = i2c_master_transmit_dma(&hi2cx, I2Cx_ADDRESS, tx_buf, BUF_SIZE, I2C_TIMEOUT)) != I2C_OK)
210 {
211 error_handler(i2c_status);
212 }
213
214 /* wait for the communication to end */
215 if(i2c_wait_end(&hi2cx, I2C_TIMEOUT) != I2C_OK)
216 {
217 error_handler(i2c_status);
218 }
219
220 delay_ms(10);
221
222 /* start the request reception process */
223 if((i2c_status = i2c_master_receive_dma(&hi2cx, I2Cx_ADDRESS, rx_buf, BUF_SIZE, I2C_TIMEOUT)) != I2C_OK)
224 {
225 error_handler(i2c_status);
226 }
227
228 /* wait for the communication to end */
229 if(i2c_wait_end(&hi2cx, I2C_TIMEOUT) != I2C_OK)
230 {
231 error_handler(i2c_status);
232 }
233
234 if(buffer_compare(tx_buf, rx_buf, BUF_SIZE) == 0)
235 {
236 at32_led_on(LED3);
237 }
238 else
239 {
240 error_handler(i2c_status);
241 }
242
243#else
244
245 /* wait for key USER_BUTTON press before starting the communication */
246 while(at32_button_press() != USER_BUTTON)
247 {
248 }
249
250 /* start the transmission process */
251 if((i2c_status = i2c_slave_receive_dma(&hi2cx, rx_buf, BUF_SIZE, I2C_TIMEOUT)) != I2C_OK)
252 {
253 error_handler(i2c_status);
254 }
255
256 /* wait for the communication to end */
257 if(i2c_wait_end(&hi2cx, I2C_TIMEOUT) != I2C_OK)
258 {
259 error_handler(i2c_status);
260 }
261
262 if((i2c_status = i2c_slave_transmit_dma(&hi2cx, tx_buf, BUF_SIZE, I2C_TIMEOUT)) != I2C_OK)
263 {
264 error_handler(i2c_status);
265 }
266
267 /* wait for the communication to end */
268 if(i2c_wait_end(&hi2cx, I2C_TIMEOUT) != I2C_OK)
269 {
270 error_handler(i2c_status);
271 }
272
273 if(buffer_compare(tx_buf, rx_buf, BUF_SIZE) == 0)
274 {
275 at32_led_on(LED3);
276 }
277 else
278 {
279 error_handler(i2c_status);
280 }
281
282#endif
283
284 }
285}
286
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
rx_buf
uint8_t rx_buf[8]
Definition project/at_start_f413/examples/i2c/communication_dma/src/main.c:68
tx_buf
uint8_t tx_buf[8]
Definition project/at_start_f413/examples/i2c/communication_dma/src/main.c:67
I2Cx_ADDRESS
#define I2Cx_ADDRESS
Definition project/at_start_f413/examples/i2c/communication_dma/src/main.c:41
I2Cx_DMA_RX_IRQn
#define I2Cx_DMA_RX_IRQn
Definition project/at_start_f413/examples/i2c/communication_dma/src/main.c:59
I2Cx_CLK
#define I2Cx_CLK
Definition project/at_start_f413/examples/i2c/communication_dma/src/main.c:44
I2Cx_DMA_TX_CHANNEL
#define I2Cx_DMA_TX_CHANNEL
Definition project/at_start_f413/examples/i2c/communication_dma/src/main.c:55
BUF_SIZE
#define BUF_SIZE
Definition project/at_start_f413/examples/i2c/communication_dma/src/main.c:64
I2Cx_SDA_PIN
#define I2Cx_SDA_PIN
Definition project/at_start_f413/examples/i2c/communication_dma/src/main.c:50
main
int main(void)
main function.
Definition project/at_start_f413/examples/i2c/communication_dma/src/main.c:183
I2Cx_SCL_PIN
#define I2Cx_SCL_PIN
Definition project/at_start_f413/examples/i2c/communication_dma/src/main.c:46
hi2cx
i2c_handle_type hi2cx
Definition project/at_start_f413/examples/i2c/communication_dma/src/main.c:70
I2Cx_SDA_GPIO_PORT
#define I2Cx_SDA_GPIO_PORT
Definition project/at_start_f413/examples/i2c/communication_dma/src/main.c:51
buffer_compare
uint32_t buffer_compare(uint8_t *buffer1, uint8_t *buffer2, uint32_t len)
compare whether the valus of buffer 1 and buffer 2 are equal.
Definition project/at_start_f413/examples/i2c/communication_dma/src/main.c:96
I2Cx_DMA_CLK
#define I2Cx_DMA_CLK
Definition project/at_start_f413/examples/i2c/communication_dma/src/main.c:54
I2Cx_SDA_GPIO_CLK
#define I2Cx_SDA_GPIO_CLK
Definition project/at_start_f413/examples/i2c/communication_dma/src/main.c:52
I2Cx_ERR_IRQn
#define I2Cx_ERR_IRQn
Definition project/at_start_f413/examples/i2c/communication_dma/src/main.c:62
error_handler
void error_handler(uint32_t error_code)
error handler program
Definition project/at_start_f413/examples/i2c/communication_dma/src/main.c:80
i2c_lowlevel_init
void i2c_lowlevel_init(i2c_handle_type *hi2c)
initializes peripherals used by the i2c.
Definition project/at_start_f413/examples/i2c/communication_dma/src/main.c:116
I2Cx_SPEED
#define I2Cx_SPEED
Definition project/at_start_f413/examples/i2c/communication_dma/src/main.c:40
I2Cx_PORT
#define I2Cx_PORT
Definition project/at_start_f413/examples/i2c/communication_dma/src/main.c:43
I2Cx_SCL_GPIO_CLK
#define I2Cx_SCL_GPIO_CLK
Definition project/at_start_f413/examples/i2c/communication_dma/src/main.c:48
I2Cx_DMA_RX_CHANNEL
#define I2Cx_DMA_RX_CHANNEL
Definition project/at_start_f413/examples/i2c/communication_dma/src/main.c:58
I2Cx_DMA_TX_IRQn
#define I2Cx_DMA_TX_IRQn
Definition project/at_start_f413/examples/i2c/communication_dma/src/main.c:56
I2Cx_EVT_IRQn
#define I2Cx_EVT_IRQn
Definition project/at_start_f413/examples/i2c/communication_dma/src/main.c:61
I2Cx_SCL_GPIO_PORT
#define I2Cx_SCL_GPIO_PORT
Definition project/at_start_f413/examples/i2c/communication_dma/src/main.c:47
I2C_TIMEOUT
#define I2C_TIMEOUT
Definition project/at_start_f413/examples/i2c/communication_dma/src/main.c:38
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
i2c_wait_end
i2c_status_type i2c_wait_end(i2c_handle_type *hi2c, uint32_t timeout)
wait for the transfer to end.
Definition i2c_application.c:129
i2c_slave_transmit_dma
i2c_status_type i2c_slave_transmit_dma(i2c_handle_type *hi2c, uint8_t *pdata, uint16_t size, uint32_t timeout)
the slave transmits data through dma mode.
Definition i2c_application.c:1202
i2c_master_transmit_dma
i2c_status_type i2c_master_transmit_dma(i2c_handle_type *hi2c, uint16_t address, uint8_t *pdata, uint16_t size, uint32_t timeout)
the master transmits data through dma mode.
Definition i2c_application.c:1025
i2c_config
void i2c_config(i2c_handle_type *hi2c)
i2c peripheral initialization.
Definition i2c_application.c:111
i2c_slave_receive_dma
i2c_status_type i2c_slave_receive_dma(i2c_handle_type *hi2c, uint8_t *pdata, uint16_t size, uint32_t timeout)
the slave receive data through dma mode.
Definition i2c_application.c:1078
i2c_master_receive_dma
i2c_status_type i2c_master_receive_dma(i2c_handle_type *hi2c, uint16_t address, uint8_t *pdata, uint16_t size, uint32_t timeout)
the master receive data through dma mode.
Definition i2c_application.c:1126
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
USER_BUTTON
@ USER_BUTTON
Definition at32f413_board.h:93
at32_button_press
button_type at32_button_press()
returns which button have press down
Definition at32f413_board.c:218
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
dma_default_para_init
void dma_default_para_init(dma_init_type *dma_init_struct)
dma init config with its default value.
Definition at32f413_dma.c:407
dma_reset
void dma_reset(dma_channel_type *dmax_channely)
reset the dmax channely registers.
Definition at32f413_dma.c:63
dma_init
void dma_init(dma_channel_type *dmax_channely, dma_init_type *dma_init_struct)
dma init
Definition at32f413_dma.c:442
DMA_PERIPHERAL_DATA_WIDTH_BYTE
@ DMA_PERIPHERAL_DATA_WIDTH_BYTE
Definition at32f413_dma.h:245
DMA_DIR_MEMORY_TO_PERIPHERAL
@ DMA_DIR_MEMORY_TO_PERIPHERAL
Definition at32f413_dma.h:217
DMA_MEMORY_DATA_WIDTH_BYTE
@ DMA_MEMORY_DATA_WIDTH_BYTE
Definition at32f413_dma.h:255
DMA_PRIORITY_LOW
@ DMA_PRIORITY_LOW
Definition at32f413_dma.h:265
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_DRIVE_STRENGTH_MODERATE
@ GPIO_DRIVE_STRENGTH_MODERATE
Definition at32f413_gpio.h:225
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_OUTPUT_OPEN_DRAIN
@ GPIO_OUTPUT_OPEN_DRAIN
Definition at32f413_gpio.h:235
i2c_own_address1_set
void i2c_own_address1_set(i2c_type *i2c_x, i2c_address_mode_type mode, uint16_t address)
config own address1.
Definition at32f413_i2c.c:191
i2c_init
void i2c_init(i2c_type *i2c_x, i2c_fsmode_duty_cycle_type duty, uint32_t speed)
init i2c speed and duty cycle.
Definition at32f413_i2c.c:89
I2C_FSMODE_DUTY_2_1
@ I2C_FSMODE_DUTY_2_1
Definition at32f413_i2c.h:147
I2C_ADDRESS_MODE_7BIT
@ I2C_ADDRESS_MODE_7BIT
Definition at32f413_i2c.h:156
i2c_status_type
i2c_status_type
Definition i2c_application.h:94
I2C_OK
@ I2C_OK
Definition i2c_application.h:95
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
i2c_application.h
i2c application libray header file
at32f413_clock.h
header file of clock program
dma_init_type::loop_mode_enable
confirm_state loop_mode_enable
Definition at32f413_dma.h:284
dma_init_type::memory_data_width
dma_memory_data_size_type memory_data_width
Definition at32f413_dma.h:283
dma_init_type::priority
dma_priority_level_type priority
Definition at32f413_dma.h:285
dma_init_type::peripheral_inc_enable
confirm_state peripheral_inc_enable
Definition at32f413_dma.h:280
dma_init_type::memory_inc_enable
confirm_state memory_inc_enable
Definition at32f413_dma.h:281
dma_init_type::direction
dma_dir_type direction
Definition at32f413_dma.h:278
dma_init_type::peripheral_data_width
dma_peripheral_data_size_type peripheral_data_width
Definition at32f413_dma.h:282
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
i2c_handle_type
Definition i2c_application.h:127
i2c_handle_type::dma_rx_channel
dma_channel_type * dma_rx_channel
Definition i2c_application.h:136
i2c_handle_type::i2cx
i2c_type * i2cx
Definition i2c_application.h:128
i2c_handle_type::dma_init_struct
dma_init_type dma_init_struct
Definition i2c_application.h:137
i2c_handle_type::dma_tx_channel
dma_channel_type * dma_tx_channel
Definition i2c_application.h:135


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • i2c
  • communication_int
  • inc
project/at_start_f413/examples/i2c/communication_int/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • i2c
  • communication_int
  • inc
project/at_start_f413/examples/i2c/communication_int/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • i2c
  • communication_int
  • inc
project/at_start_f413/examples/i2c/communication_int/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • i2c
  • communication_int
  • src
project/at_start_f413/examples/i2c/communication_int/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/i2c/communication_int/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • i2c
  • communication_int
  • src
project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28#include "i2c_application.h"
29
30extern i2c_handle_type hi2cx;
31
32#define I2Cx_EVT_IRQHandler I2C1_EVT_IRQHandler
33#define I2Cx_ERR_IRQHandler I2C1_ERR_IRQHandler
34
48void NMI_Handler(void)
49{
50}
51
57void HardFault_Handler(void)
58{
59 /* go to infinite loop when hard fault exception occurs */
60 while(1)
61 {
62 }
63}
64
70void MemManage_Handler(void)
71{
72 /* go to infinite loop when memory manage exception occurs */
73 while(1)
74 {
75 }
76}
77
83void BusFault_Handler(void)
84{
85 /* go to infinite loop when bus fault exception occurs */
86 while(1)
87 {
88 }
89}
90
96void UsageFault_Handler(void)
97{
98 /* go to infinite loop when usage fault exception occurs */
99 while(1)
100 {
101 }
102}
103
109void SVC_Handler(void)
110{
111}
112
118void DebugMon_Handler(void)
119{
120}
121
127void PendSV_Handler(void)
128{
129}
130
136void SysTick_Handler(void)
137{
138}
139
145void I2Cx_EVT_IRQHandler(void)
146{
147 i2c_evt_irq_handler(&hi2cx);
148}
149
155void I2Cx_ERR_IRQHandler(void)
156{
157 i2c_err_irq_handler(&hi2cx);
158}
159
hi2cx
i2c_handle_type hi2cx
Definition project/at_start_f413/examples/i2c/communication_dma/src/main.c:70
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c:96
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c:57
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c:70
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c:109
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c:127
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c:48
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c:83
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c:136
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c:118
i2c_evt_irq_handler
void i2c_evt_irq_handler(i2c_handle_type *hi2c)
interrupt procession function.
Definition i2c_application.c:2223
i2c_err_irq_handler
void i2c_err_irq_handler(i2c_handle_type *hi2c)
i2c error interrupt function.
Definition i2c_application.c:2339
i2c_application.h
i2c application libray header file
I2Cx_EVT_IRQHandler
#define I2Cx_EVT_IRQHandler
Definition project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c:32
I2Cx_ERR_IRQHandler
#define I2Cx_ERR_IRQHandler
Definition project/at_start_f413/examples/i2c/communication_int/src/at32f413_int.c:33
at32f413_int.h
header file of main interrupt service routines.
i2c_handle_type
Definition i2c_application.h:127


AT32F413 Firmwary Library: main.c Source File

  • i2c
  • communication_int
  • src
project/at_start_f413/examples/i2c/communication_int/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include "i2c_application.h"
29
38#define I2C_TIMEOUT 0xFFFFFFFF
39
40#define I2Cx_SPEED 100000
41#define I2Cx_ADDRESS 0xA0
42
43#define I2Cx_PORT I2C1
44#define I2Cx_CLK CRM_I2C1_PERIPH_CLOCK
45
46#define I2Cx_SCL_PIN GPIO_PINS_6
47#define I2Cx_SCL_GPIO_PORT GPIOB
48#define I2Cx_SCL_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
49
50#define I2Cx_SDA_PIN GPIO_PINS_7
51#define I2Cx_SDA_GPIO_PORT GPIOB
52#define I2Cx_SDA_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
53
54#define I2Cx_EVT_IRQn I2C1_EVT_IRQn
55#define I2Cx_ERR_IRQn I2C1_ERR_IRQn
56
57#define BUF_SIZE 8
58#define MASTER_BOARD
59
60uint8_t tx_buf[BUF_SIZE] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08};
61uint8_t rx_buf[BUF_SIZE] = {0};
62
63 i2c_handle_type hi2cx;
64
65uint32_t buffer_compare(uint8_t* buffer1, uint8_t* buffer2, uint32_t len);
66void error_handler(uint32_t error_code);
67void i2c_lowlevel_init(i2c_handle_type* hi2c);
68
74void error_handler(uint32_t error_code)
75{
76 while(1)
77 {
78 at32_led_toggle(LED2);
79 delay_ms(500);
80 }
81}
82
90uint32_t buffer_compare(uint8_t* buffer1, uint8_t* buffer2, uint32_t len)
91{
92 uint32_t i;
93
94 for(i = 0; i < len; i++)
95 {
96 if(buffer1[i] != buffer2[i])
97 {
98 return 1;
99 }
100 }
101
102 return 0;
103}
104
110void i2c_lowlevel_init(i2c_handle_type* hi2c)
111{
112 gpio_init_type gpio_initstructure;
113
114 if(hi2c->i2cx == I2Cx_PORT)
115 {
116 /* i2c periph clock enable */
117 crm_periph_clock_enable(I2Cx_CLK, TRUE);
118 crm_periph_clock_enable(I2Cx_SCL_GPIO_CLK, TRUE);
119 crm_periph_clock_enable(I2Cx_SDA_GPIO_CLK, TRUE);
120
121 /* gpio configuration */
122 gpio_initstructure.gpio_out_type = GPIO_OUTPUT_OPEN_DRAIN;
123 gpio_initstructure.gpio_pull = GPIO_PULL_NONE;
124 gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
125 gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_MODERATE;
126
127 /* configure i2c pins: scl */
128 gpio_initstructure.gpio_pins = I2Cx_SCL_PIN;
129 gpio_init(I2Cx_SCL_GPIO_PORT, &gpio_initstructure);
130
131 /* configure i2c pins: sda */
132 gpio_initstructure.gpio_pins = I2Cx_SDA_PIN;
133 gpio_init(I2Cx_SDA_GPIO_PORT, &gpio_initstructure);
134
135 /* configure and enable i2c interrupt */
136 nvic_irq_enable(I2Cx_EVT_IRQn, 0, 0);
137 nvic_irq_enable(I2Cx_ERR_IRQn, 0, 0);
138
139 i2c_init(hi2c->i2cx, I2C_FSMODE_DUTY_2_1, I2Cx_SPEED);
140
141 i2c_own_address1_set(hi2c->i2cx, I2C_ADDRESS_MODE_7BIT, I2Cx_ADDRESS);
142 }
143}
144
150int main(void)
151{
152 i2c_status_type i2c_status;
153
154 /* config nvic priority group */
155 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
156
157 system_clock_config();
158
159 at32_board_init();
160
161 hi2cx.i2cx = I2Cx_PORT;
162
163 i2c_config(&hi2cx);
164
165 while(1)
166 {
167
168#if defined (MASTER_BOARD)
169
170 /* wait for key USER_BUTTON press before starting the communication */
171 while(at32_button_press() != USER_BUTTON)
172 {
173 }
174
175 /* start the request reception process */
176 if((i2c_status = i2c_master_transmit_int(&hi2cx, I2Cx_ADDRESS, tx_buf, BUF_SIZE, I2C_TIMEOUT)) != I2C_OK)
177 {
178 error_handler(i2c_status);
179 }
180
181 /* wait for the communication to end */
182 if(i2c_wait_end(&hi2cx, I2C_TIMEOUT) != I2C_OK)
183 {
184 error_handler(i2c_status);
185 }
186
187 delay_ms(10);
188
189 /* start the request reception process */
190 if((i2c_status = i2c_master_receive_int(&hi2cx, I2Cx_ADDRESS, rx_buf, BUF_SIZE, I2C_TIMEOUT)) != I2C_OK)
191 {
192 error_handler(i2c_status);
193 }
194
195 /* wait for the communication to end */
196 if(i2c_wait_end(&hi2cx, I2C_TIMEOUT) != I2C_OK)
197 {
198 error_handler(i2c_status);
199 }
200
201 if(buffer_compare(tx_buf, rx_buf, BUF_SIZE) == 0)
202 {
203 at32_led_on(LED3);
204 }
205 else
206 {
207 error_handler(i2c_status);
208 }
209
210#else
211
212 /* wait for key USER_BUTTON press before starting the communication */
213 while(at32_button_press() != USER_BUTTON)
214 {
215 }
216
217 /* start the transmission process */
218 if((i2c_status = i2c_slave_receive_int(&hi2cx, rx_buf, BUF_SIZE, I2C_TIMEOUT)) != I2C_OK)
219 {
220 error_handler(i2c_status);
221 }
222
223 /* wait for the communication to end */
224 if(i2c_wait_end(&hi2cx, I2C_TIMEOUT) != I2C_OK)
225 {
226 error_handler(i2c_status);
227 }
228
229 if((i2c_status = i2c_slave_transmit_int(&hi2cx, tx_buf, BUF_SIZE, I2C_TIMEOUT)) != I2C_OK)
230 {
231 error_handler(i2c_status);
232 }
233
234 /* wait for the communication to end */
235 if(i2c_wait_end(&hi2cx, I2C_TIMEOUT) != I2C_OK)
236 {
237 error_handler(i2c_status);
238 }
239
240 if(buffer_compare(tx_buf, rx_buf, BUF_SIZE) == 0)
241 {
242 at32_led_on(LED3);
243 }
244 else
245 {
246 error_handler(i2c_status);
247 }
248#endif
249
250 }
251}
252
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
rx_buf
uint8_t rx_buf[8]
Definition project/at_start_f413/examples/i2c/communication_int/src/main.c:61
tx_buf
uint8_t tx_buf[8]
Definition project/at_start_f413/examples/i2c/communication_int/src/main.c:60
I2Cx_ADDRESS
#define I2Cx_ADDRESS
Definition project/at_start_f413/examples/i2c/communication_int/src/main.c:41
I2Cx_CLK
#define I2Cx_CLK
Definition project/at_start_f413/examples/i2c/communication_int/src/main.c:44
BUF_SIZE
#define BUF_SIZE
Definition project/at_start_f413/examples/i2c/communication_int/src/main.c:57
I2Cx_SDA_PIN
#define I2Cx_SDA_PIN
Definition project/at_start_f413/examples/i2c/communication_int/src/main.c:50
main
int main(void)
main function.
Definition project/at_start_f413/examples/i2c/communication_int/src/main.c:150
I2Cx_SCL_PIN
#define I2Cx_SCL_PIN
Definition project/at_start_f413/examples/i2c/communication_int/src/main.c:46
hi2cx
i2c_handle_type hi2cx
Definition project/at_start_f413/examples/i2c/communication_int/src/main.c:63
I2Cx_SDA_GPIO_PORT
#define I2Cx_SDA_GPIO_PORT
Definition project/at_start_f413/examples/i2c/communication_int/src/main.c:51
buffer_compare
uint32_t buffer_compare(uint8_t *buffer1, uint8_t *buffer2, uint32_t len)
compare whether the valus of buffer 1 and buffer 2 are equal.
Definition project/at_start_f413/examples/i2c/communication_int/src/main.c:90
I2Cx_SDA_GPIO_CLK
#define I2Cx_SDA_GPIO_CLK
Definition project/at_start_f413/examples/i2c/communication_int/src/main.c:52
I2Cx_ERR_IRQn
#define I2Cx_ERR_IRQn
Definition project/at_start_f413/examples/i2c/communication_int/src/main.c:55
error_handler
void error_handler(uint32_t error_code)
error handler program
Definition project/at_start_f413/examples/i2c/communication_int/src/main.c:74
i2c_lowlevel_init
void i2c_lowlevel_init(i2c_handle_type *hi2c)
initializes peripherals used by the i2c.
Definition project/at_start_f413/examples/i2c/communication_int/src/main.c:110
I2Cx_SPEED
#define I2Cx_SPEED
Definition project/at_start_f413/examples/i2c/communication_int/src/main.c:40
I2Cx_PORT
#define I2Cx_PORT
Definition project/at_start_f413/examples/i2c/communication_int/src/main.c:43
I2Cx_SCL_GPIO_CLK
#define I2Cx_SCL_GPIO_CLK
Definition project/at_start_f413/examples/i2c/communication_int/src/main.c:48
I2Cx_EVT_IRQn
#define I2Cx_EVT_IRQn
Definition project/at_start_f413/examples/i2c/communication_int/src/main.c:54
I2Cx_SCL_GPIO_PORT
#define I2Cx_SCL_GPIO_PORT
Definition project/at_start_f413/examples/i2c/communication_int/src/main.c:47
I2C_TIMEOUT
#define I2C_TIMEOUT
Definition project/at_start_f413/examples/i2c/communication_int/src/main.c:38
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
i2c_wait_end
i2c_status_type i2c_wait_end(i2c_handle_type *hi2c, uint32_t timeout)
wait for the transfer to end.
Definition i2c_application.c:129
i2c_slave_transmit_int
i2c_status_type i2c_slave_transmit_int(i2c_handle_type *hi2c, uint8_t *pdata, uint16_t size, uint32_t timeout)
the slave transmits data through interrupt mode.
Definition i2c_application.c:986
i2c_master_receive_int
i2c_status_type i2c_master_receive_int(i2c_handle_type *hi2c, uint16_t address, uint8_t *pdata, uint16_t size, uint32_t timeout)
the master receive data through interrupt mode.
Definition i2c_application.c:908
i2c_config
void i2c_config(i2c_handle_type *hi2c)
i2c peripheral initialization.
Definition i2c_application.c:111
i2c_master_transmit_int
i2c_status_type i2c_master_transmit_int(i2c_handle_type *hi2c, uint16_t address, uint8_t *pdata, uint16_t size, uint32_t timeout)
the master transmits data through interrupt mode.
Definition i2c_application.c:822
i2c_slave_receive_int
i2c_status_type i2c_slave_receive_int(i2c_handle_type *hi2c, uint8_t *pdata, uint16_t size, uint32_t timeout)
the slave receive data through interrupt mode.
Definition i2c_application.c:869
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
USER_BUTTON
@ USER_BUTTON
Definition at32f413_board.h:93
at32_button_press
button_type at32_button_press()
returns which button have press down
Definition at32f413_board.c:218
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
TRUE
@ TRUE
Definition at32f413.h:297
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_DRIVE_STRENGTH_MODERATE
@ GPIO_DRIVE_STRENGTH_MODERATE
Definition at32f413_gpio.h:225
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_OUTPUT_OPEN_DRAIN
@ GPIO_OUTPUT_OPEN_DRAIN
Definition at32f413_gpio.h:235
i2c_own_address1_set
void i2c_own_address1_set(i2c_type *i2c_x, i2c_address_mode_type mode, uint16_t address)
config own address1.
Definition at32f413_i2c.c:191
i2c_init
void i2c_init(i2c_type *i2c_x, i2c_fsmode_duty_cycle_type duty, uint32_t speed)
init i2c speed and duty cycle.
Definition at32f413_i2c.c:89
I2C_FSMODE_DUTY_2_1
@ I2C_FSMODE_DUTY_2_1
Definition at32f413_i2c.h:147
I2C_ADDRESS_MODE_7BIT
@ I2C_ADDRESS_MODE_7BIT
Definition at32f413_i2c.h:156
i2c_status_type
i2c_status_type
Definition i2c_application.h:94
I2C_OK
@ I2C_OK
Definition i2c_application.h:95
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
i2c_application.h
i2c application libray header file
at32f413_clock.h
header file of clock program
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
i2c_handle_type
Definition i2c_application.h:127
i2c_handle_type::i2cx
i2c_type * i2cx
Definition i2c_application.h:128


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • i2c
  • communication_poll
  • inc
project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • i2c
  • communication_poll
  • inc
project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • i2c
  • communication_poll
  • inc
project/at_start_f413/examples/i2c/communication_poll/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • i2c
  • communication_poll
  • src
project/at_start_f413/examples/i2c/communication_poll/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/i2c/communication_poll/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • i2c
  • communication_poll
  • src
project/at_start_f413/examples/i2c/communication_poll/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/i2c/communication_poll/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/i2c/communication_poll/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/i2c/communication_poll/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/i2c/communication_poll/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/i2c/communication_poll/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/i2c/communication_poll/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/i2c/communication_poll/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/i2c/communication_poll/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/i2c/communication_poll/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • i2c
  • communication_poll
  • src
project/at_start_f413/examples/i2c/communication_poll/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include "i2c_application.h"
29
38#define I2C_TIMEOUT 0xFFFFFFFF
39
40#define I2Cx_SPEED 100000
41#define I2Cx_ADDRESS 0xA0
42
43#define I2Cx_PORT I2C1
44#define I2Cx_CLK CRM_I2C1_PERIPH_CLOCK
45
46#define I2Cx_SCL_PIN GPIO_PINS_6
47#define I2Cx_SCL_GPIO_PORT GPIOB
48#define I2Cx_SCL_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
49
50#define I2Cx_SDA_PIN GPIO_PINS_7
51#define I2Cx_SDA_GPIO_PORT GPIOB
52#define I2Cx_SDA_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
53
54#define BUF_SIZE 8
55#define MASTER_BOARD
56
57uint8_t tx_buf[BUF_SIZE] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08};
58uint8_t rx_buf[BUF_SIZE] = {0};
59
60 i2c_handle_type hi2cx;
61
62void error_handler(uint32_t error_code);
63uint32_t buffer_compare(uint8_t* buffer1, uint8_t* buffer2, uint32_t len);
64void i2c_lowlevel_init(i2c_handle_type* hi2c);
65
71void error_handler(uint32_t error_code)
72{
73 while(1)
74 {
75 at32_led_toggle(LED2);
76 delay_ms(500);
77 }
78}
79
87uint32_t buffer_compare(uint8_t* buffer1, uint8_t* buffer2, uint32_t len)
88{
89 uint32_t i;
90
91 for(i = 0; i < len; i++)
92 {
93 if(buffer1[i] != buffer2[i])
94 {
95 return 1;
96 }
97 }
98
99 return 0;
100}
101
107void i2c_lowlevel_init(i2c_handle_type* hi2c)
108{
109 gpio_init_type gpio_initstructure;
110
111 if(hi2c->i2cx == I2Cx_PORT)
112 {
113 /* i2c periph clock enable */
114 crm_periph_clock_enable(I2Cx_CLK, TRUE);
115 crm_periph_clock_enable(I2Cx_SCL_GPIO_CLK, TRUE);
116 crm_periph_clock_enable(I2Cx_SDA_GPIO_CLK, TRUE);
117
118 /* gpio configuration */
119 gpio_initstructure.gpio_out_type = GPIO_OUTPUT_OPEN_DRAIN;
120 gpio_initstructure.gpio_pull = GPIO_PULL_NONE;
121 gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
122 gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_MODERATE;
123
124 /* configure i2c pins: scl */
125 gpio_initstructure.gpio_pins = I2Cx_SCL_PIN;
126 gpio_init(I2Cx_SCL_GPIO_PORT, &gpio_initstructure);
127
128 /* configure i2c pins: sda */
129 gpio_initstructure.gpio_pins = I2Cx_SDA_PIN;
130 gpio_init(I2Cx_SDA_GPIO_PORT, &gpio_initstructure);
131
132 i2c_init(hi2c->i2cx, I2C_FSMODE_DUTY_2_1, I2Cx_SPEED);
133
134 i2c_own_address1_set(hi2c->i2cx, I2C_ADDRESS_MODE_7BIT, I2Cx_ADDRESS);
135 }
136}
137
143int main(void)
144{
145 i2c_status_type i2c_status;
146
147 system_clock_config();
148
149 at32_board_init();
150
151 hi2cx.i2cx = I2Cx_PORT;
152
153 i2c_config(&hi2cx);
154
155 while(1)
156 {
157
158#if defined (MASTER_BOARD)
159
160 /* wait for key USER_BUTTON press before starting the communication */
161 while(at32_button_press() != USER_BUTTON)
162 {
163 }
164
165 /* start the request reception process */
166 if((i2c_status = i2c_master_transmit(&hi2cx, I2Cx_ADDRESS, tx_buf, BUF_SIZE, I2C_TIMEOUT)) != I2C_OK)
167 {
168 error_handler(i2c_status);
169 }
170
171 delay_ms(10);
172
173 /* start the request reception process */
174 if((i2c_status = i2c_master_receive(&hi2cx, I2Cx_ADDRESS, rx_buf, BUF_SIZE, I2C_TIMEOUT)) != I2C_OK)
175 {
176 error_handler(i2c_status);
177 }
178
179 if(buffer_compare(tx_buf, rx_buf, BUF_SIZE) == 0)
180 {
181 at32_led_on(LED3);
182 }
183 else
184 {
185 error_handler(i2c_status);
186 }
187#else
188
189 /* wait for key USER_BUTTON press before starting the communication */
190 while(at32_button_press() != USER_BUTTON)
191 {
192 }
193
194 /* start the transmission process */
195 if((i2c_status = i2c_slave_receive(&hi2cx, rx_buf, BUF_SIZE, I2C_TIMEOUT)) != I2C_OK)
196 {
197 error_handler(i2c_status);
198 }
199
200 if((i2c_status = i2c_slave_transmit(&hi2cx, tx_buf, BUF_SIZE, I2C_TIMEOUT)) != I2C_OK)
201 {
202 error_handler(i2c_status);
203 }
204
205 if(buffer_compare(tx_buf, rx_buf, BUF_SIZE) == 0)
206 {
207 at32_led_on(LED3);
208 }
209 else
210 {
211 error_handler(i2c_status);
212 }
213#endif
214
215 }
216}
217
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
rx_buf
uint8_t rx_buf[8]
Definition project/at_start_f413/examples/i2c/communication_poll/src/main.c:58
tx_buf
uint8_t tx_buf[8]
Definition project/at_start_f413/examples/i2c/communication_poll/src/main.c:57
I2Cx_ADDRESS
#define I2Cx_ADDRESS
Definition project/at_start_f413/examples/i2c/communication_poll/src/main.c:41
I2Cx_CLK
#define I2Cx_CLK
Definition project/at_start_f413/examples/i2c/communication_poll/src/main.c:44
BUF_SIZE
#define BUF_SIZE
Definition project/at_start_f413/examples/i2c/communication_poll/src/main.c:54
I2Cx_SDA_PIN
#define I2Cx_SDA_PIN
Definition project/at_start_f413/examples/i2c/communication_poll/src/main.c:50
main
int main(void)
main function.
Definition project/at_start_f413/examples/i2c/communication_poll/src/main.c:143
I2Cx_SCL_PIN
#define I2Cx_SCL_PIN
Definition project/at_start_f413/examples/i2c/communication_poll/src/main.c:46
hi2cx
i2c_handle_type hi2cx
Definition project/at_start_f413/examples/i2c/communication_poll/src/main.c:60
I2Cx_SDA_GPIO_PORT
#define I2Cx_SDA_GPIO_PORT
Definition project/at_start_f413/examples/i2c/communication_poll/src/main.c:51
buffer_compare
uint32_t buffer_compare(uint8_t *buffer1, uint8_t *buffer2, uint32_t len)
compare whether the valus of buffer 1 and buffer 2 are equal.
Definition project/at_start_f413/examples/i2c/communication_poll/src/main.c:87
I2Cx_SDA_GPIO_CLK
#define I2Cx_SDA_GPIO_CLK
Definition project/at_start_f413/examples/i2c/communication_poll/src/main.c:52
error_handler
void error_handler(uint32_t error_code)
error handler program
Definition project/at_start_f413/examples/i2c/communication_poll/src/main.c:71
i2c_lowlevel_init
void i2c_lowlevel_init(i2c_handle_type *hi2c)
initializes peripherals used by the i2c.
Definition project/at_start_f413/examples/i2c/communication_poll/src/main.c:107
I2Cx_SPEED
#define I2Cx_SPEED
Definition project/at_start_f413/examples/i2c/communication_poll/src/main.c:40
I2Cx_PORT
#define I2Cx_PORT
Definition project/at_start_f413/examples/i2c/communication_poll/src/main.c:43
I2Cx_SCL_GPIO_CLK
#define I2Cx_SCL_GPIO_CLK
Definition project/at_start_f413/examples/i2c/communication_poll/src/main.c:48
I2Cx_SCL_GPIO_PORT
#define I2Cx_SCL_GPIO_PORT
Definition project/at_start_f413/examples/i2c/communication_poll/src/main.c:47
I2C_TIMEOUT
#define I2C_TIMEOUT
Definition project/at_start_f413/examples/i2c/communication_poll/src/main.c:38
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
i2c_slave_receive
i2c_status_type i2c_slave_receive(i2c_handle_type *hi2c, uint8_t *pdata, uint16_t size, uint32_t timeout)
the slave receive data through polling mode.
Definition i2c_application.c:489
i2c_config
void i2c_config(i2c_handle_type *hi2c)
i2c peripheral initialization.
Definition i2c_application.c:111
i2c_master_receive
i2c_status_type i2c_master_receive(i2c_handle_type *hi2c, uint16_t address, uint8_t *pdata, uint16_t size, uint32_t timeout)
the master receive data through polling mode.
Definition i2c_application.c:564
i2c_master_transmit
i2c_status_type i2c_master_transmit(i2c_handle_type *hi2c, uint16_t address, uint8_t *pdata, uint16_t size, uint32_t timeout)
the master transmits data through polling mode.
Definition i2c_application.c:421
i2c_slave_transmit
i2c_status_type i2c_slave_transmit(i2c_handle_type *hi2c, uint8_t *pdata, uint16_t size, uint32_t timeout)
the slave transmits data through polling mode.
Definition i2c_application.c:735
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
USER_BUTTON
@ USER_BUTTON
Definition at32f413_board.h:93
at32_button_press
button_type at32_button_press()
returns which button have press down
Definition at32f413_board.c:218
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
TRUE
@ TRUE
Definition at32f413.h:297
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_DRIVE_STRENGTH_MODERATE
@ GPIO_DRIVE_STRENGTH_MODERATE
Definition at32f413_gpio.h:225
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_OUTPUT_OPEN_DRAIN
@ GPIO_OUTPUT_OPEN_DRAIN
Definition at32f413_gpio.h:235
i2c_own_address1_set
void i2c_own_address1_set(i2c_type *i2c_x, i2c_address_mode_type mode, uint16_t address)
config own address1.
Definition at32f413_i2c.c:191
i2c_init
void i2c_init(i2c_type *i2c_x, i2c_fsmode_duty_cycle_type duty, uint32_t speed)
init i2c speed and duty cycle.
Definition at32f413_i2c.c:89
I2C_FSMODE_DUTY_2_1
@ I2C_FSMODE_DUTY_2_1
Definition at32f413_i2c.h:147
I2C_ADDRESS_MODE_7BIT
@ I2C_ADDRESS_MODE_7BIT
Definition at32f413_i2c.h:156
i2c_status_type
i2c_status_type
Definition i2c_application.h:94
I2C_OK
@ I2C_OK
Definition i2c_application.h:95
i2c_application.h
i2c application libray header file
at32f413_clock.h
header file of clock program
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
i2c_handle_type
Definition i2c_application.h:127
i2c_handle_type::i2cx
i2c_type * i2cx
Definition i2c_application.h:128


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • i2c
  • eeprom
  • inc
project/at_start_f413/examples/i2c/eeprom/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • i2c
  • eeprom
  • inc
project/at_start_f413/examples/i2c/eeprom/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • i2c
  • eeprom
  • inc
project/at_start_f413/examples/i2c/eeprom/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • i2c
  • eeprom
  • src
project/at_start_f413/examples/i2c/eeprom/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/i2c/eeprom/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • i2c
  • eeprom
  • src
project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28#include "i2c_application.h"
29
30extern i2c_handle_type hi2cx;
31
32#define I2Cx_DMA_TX_IRQHandler DMA1_Channel4_IRQHandler
33#define I2Cx_DMA_RX_IRQHandler DMA1_Channel5_IRQHandler
34#define I2Cx_EVT_IRQHandler I2C2_EVT_IRQHandler
35#define I2Cx_ERR_IRQHandler I2C2_ERR_IRQHandler
36
50void NMI_Handler(void)
51{
52}
53
59void HardFault_Handler(void)
60{
61 /* go to infinite loop when hard fault exception occurs */
62 while(1)
63 {
64 }
65}
66
72void MemManage_Handler(void)
73{
74 /* go to infinite loop when memory manage exception occurs */
75 while(1)
76 {
77 }
78}
79
85void BusFault_Handler(void)
86{
87 /* go to infinite loop when bus fault exception occurs */
88 while(1)
89 {
90 }
91}
92
98void UsageFault_Handler(void)
99{
100 /* go to infinite loop when usage fault exception occurs */
101 while(1)
102 {
103 }
104}
105
111void SVC_Handler(void)
112{
113}
114
120void DebugMon_Handler(void)
121{
122}
123
129void PendSV_Handler(void)
130{
131}
132
138void SysTick_Handler(void)
139{
140}
141
147void I2Cx_DMA_RX_IRQHandler(void)
148{
149 i2c_dma_rx_irq_handler(&hi2cx);
150}
151
157void I2Cx_DMA_TX_IRQHandler(void)
158{
159 i2c_dma_tx_irq_handler(&hi2cx);
160}
161
167void I2Cx_EVT_IRQHandler(void)
168{
169 i2c_evt_irq_handler(&hi2cx);
170}
171
177void I2Cx_ERR_IRQHandler(void)
178{
179 i2c_err_irq_handler(&hi2cx);
180}
181
hi2cx
i2c_handle_type hi2cx
Definition project/at_start_f413/examples/i2c/communication_dma/src/main.c:70
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c:98
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c:59
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c:72
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c:111
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c:129
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c:50
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c:85
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c:138
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c:120
i2c_evt_irq_handler
void i2c_evt_irq_handler(i2c_handle_type *hi2c)
interrupt procession function.
Definition i2c_application.c:2223
i2c_err_irq_handler
void i2c_err_irq_handler(i2c_handle_type *hi2c)
i2c error interrupt function.
Definition i2c_application.c:2339
i2c_dma_rx_irq_handler
void i2c_dma_rx_irq_handler(i2c_handle_type *hi2c)
dma reveive complete interrupt function.
Definition i2c_application.c:2293
i2c_dma_tx_irq_handler
void i2c_dma_tx_irq_handler(i2c_handle_type *hi2c)
dma transmission complete interrupt function.
Definition i2c_application.c:2256
i2c_application.h
i2c application libray header file
I2Cx_EVT_IRQHandler
#define I2Cx_EVT_IRQHandler
Definition project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c:34
I2Cx_ERR_IRQHandler
#define I2Cx_ERR_IRQHandler
Definition project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c:35
I2Cx_DMA_TX_IRQHandler
#define I2Cx_DMA_TX_IRQHandler
Definition project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c:32
I2Cx_DMA_RX_IRQHandler
#define I2Cx_DMA_RX_IRQHandler
Definition project/at_start_f413/examples/i2c/eeprom/src/at32f413_int.c:33
at32f413_int.h
header file of main interrupt service routines.
i2c_handle_type
Definition i2c_application.h:127


AT32F413 Firmwary Library: main.c Source File

  • i2c
  • eeprom
  • src
project/at_start_f413/examples/i2c/eeprom/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include "eeprom.h"
29
38#define I2C_TIMEOUT 0xFFFFFFFF
39
40#define I2Cx_SPEED 100000
41#define I2Cx_ADDRESS 0xA0
42
43#define I2Cx_PORT I2C2
44#define I2Cx_CLK CRM_I2C2_PERIPH_CLOCK
45
46#define I2Cx_SCL_PIN GPIO_PINS_10
47#define I2Cx_SCL_GPIO_PORT GPIOB
48#define I2Cx_SCL_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
49
50#define I2Cx_SDA_PIN GPIO_PINS_11
51#define I2Cx_SDA_GPIO_PORT GPIOB
52#define I2Cx_SDA_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
53
54#define I2Cx_DMA_CLK CRM_DMA1_PERIPH_CLOCK
55#define I2Cx_DMA_TX_CHANNEL DMA1_CHANNEL4
56#define I2Cx_DMA_TX_IRQn DMA1_Channel4_IRQn
57
58#define I2Cx_DMA_RX_CHANNEL DMA1_CHANNEL5
59#define I2Cx_DMA_RX_IRQn DMA1_Channel5_IRQn
60
61#define I2Cx_EVT_IRQn I2C2_EVT_IRQn
62#define I2Cx_ERR_IRQn I2C2_ERR_IRQn
63
64#define BUF_SIZE 12
65
66uint8_t tx_buf1[BUF_SIZE] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C};
67uint8_t tx_buf2[BUF_SIZE] = {0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80, 0x90, 0xA0, 0xB0, 0xC0};
68uint8_t tx_buf3[BUF_SIZE] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC};
69uint8_t rx_buf1[BUF_SIZE] = {0};
70uint8_t rx_buf2[BUF_SIZE] = {0};
71uint8_t rx_buf3[BUF_SIZE] = {0};
72
73 i2c_handle_type hi2cx;
74
75void error_handler(uint32_t error_code);
76uint32_t buffer_compare(uint8_t* buffer1, uint8_t* buffer2, uint32_t len);
77void i2c_lowlevel_init(i2c_handle_type* hi2c);
78
84void error_handler(uint32_t error_code)
85{
86 while(1)
87 {
88 at32_led_toggle(LED2);
89 delay_ms(500);
90 }
91}
92
100uint32_t buffer_compare(uint8_t* buffer1, uint8_t* buffer2, uint32_t len)
101{
102 uint32_t i;
103
104 for(i = 0; i < len; i++)
105 {
106 if(buffer1[i] != buffer2[i])
107 {
108 return 1;
109 }
110 }
111
112 return 0;
113}
114
120void i2c_lowlevel_init(i2c_handle_type* hi2c)
121{
122 gpio_init_type gpio_initstructure;
123
124 if(hi2c->i2cx == I2Cx_PORT)
125 {
126 /* i2c periph clock enable */
127 crm_periph_clock_enable(I2Cx_CLK, TRUE);
128 crm_periph_clock_enable(I2Cx_SCL_GPIO_CLK, TRUE);
129 crm_periph_clock_enable(I2Cx_SDA_GPIO_CLK, TRUE);
130
131 /* gpio configuration */
132 gpio_initstructure.gpio_out_type = GPIO_OUTPUT_OPEN_DRAIN;
133 gpio_initstructure.gpio_pull = GPIO_PULL_NONE;
134 gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
135 gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_MODERATE;
136
137 /* configure i2c pins: scl */
138 gpio_initstructure.gpio_pins = I2Cx_SCL_PIN;
139 gpio_init(I2Cx_SCL_GPIO_PORT, &gpio_initstructure);
140
141 /* configure i2c pins: sda */
142 gpio_initstructure.gpio_pins = I2Cx_SDA_PIN;
143 gpio_init(I2Cx_SDA_GPIO_PORT, &gpio_initstructure);
144
145 /* configure and enable i2c dma channel interrupt */
146 nvic_irq_enable(I2Cx_DMA_TX_IRQn, 0, 0);
147 nvic_irq_enable(I2Cx_DMA_RX_IRQn, 0, 0);
148
149 /* configure and enable i2c interrupt */
150 nvic_irq_enable(I2Cx_EVT_IRQn, 0, 0);
151 nvic_irq_enable(I2Cx_ERR_IRQn, 0, 0);
152
153 /* i2c dma tx and rx channels configuration */
154 /* enable the dma clock */
155 crm_periph_clock_enable(I2Cx_DMA_CLK, TRUE);
156
157 /* i2c dma channel configuration */
158 hi2c->dma_tx_channel = I2Cx_DMA_TX_CHANNEL;
159 hi2c->dma_rx_channel = I2Cx_DMA_RX_CHANNEL;
160
161 dma_reset(hi2c->dma_tx_channel);
162 dma_reset(hi2c->dma_rx_channel);
163
164 dma_default_para_init(&hi2c->dma_init_struct);
165 hi2c->dma_init_struct.peripheral_inc_enable = FALSE;
166 hi2c->dma_init_struct.memory_inc_enable = TRUE;
167 hi2c->dma_init_struct.peripheral_data_width = DMA_PERIPHERAL_DATA_WIDTH_BYTE;
168 hi2c->dma_init_struct.memory_data_width = DMA_MEMORY_DATA_WIDTH_BYTE;
169 hi2c->dma_init_struct.loop_mode_enable = FALSE;
170 hi2c->dma_init_struct.priority = DMA_PRIORITY_LOW;
171 hi2c->dma_init_struct.direction = DMA_DIR_MEMORY_TO_PERIPHERAL;
172
173 dma_init(hi2c->dma_tx_channel, &hi2c->dma_init_struct);
174 dma_init(hi2c->dma_rx_channel, &hi2c->dma_init_struct);
175
176 i2c_init(hi2c->i2cx, I2C_FSMODE_DUTY_2_1, I2Cx_SPEED);
177
178 i2c_own_address1_set(hi2c->i2cx, I2C_ADDRESS_MODE_7BIT, I2Cx_ADDRESS);
179 }
180}
181
187int main(void)
188{
189 i2c_status_type i2c_status;
190
191 /* config nvic priority group */
192 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
193
194 system_clock_config();
195
196 at32_board_init();
197
198 hi2cx.i2cx = I2Cx_PORT;
199
200 i2c_config(&hi2cx);
201
202 while(1)
203 {
204 /* wait for key USER_BUTTON press before starting the communication */
205 while(at32_button_press() != USER_BUTTON)
206 {
207 }
208
209 /* write data to eeprom device */
210 if((i2c_status = eeprom_write_buffer(&hi2cx, EE_MODE_POLL, I2C_MEM_ADDR_WIDIH_8, I2Cx_ADDRESS, 0x00, tx_buf1, BUF_SIZE, I2C_TIMEOUT)) != I2C_OK)
211 {
212 error_handler(i2c_status);
213 }
214
215 delay_ms(1);
216
217 /* read data from eeprom device */
218 if((i2c_status = eeprom_read_buffer(&hi2cx, EE_MODE_POLL, I2C_MEM_ADDR_WIDIH_8, I2Cx_ADDRESS, 0x00, rx_buf1, BUF_SIZE, I2C_TIMEOUT)) != I2C_OK)
219 {
220 error_handler(i2c_status);
221 }
222
223 delay_ms(5);
224
225
226 /* write data to eeprom device */
227 if((i2c_status = eeprom_write_buffer(&hi2cx, EE_MODE_INT, I2C_MEM_ADDR_WIDIH_8, I2Cx_ADDRESS, 0x00, tx_buf2, BUF_SIZE, I2C_TIMEOUT)) != I2C_OK)
228 {
229 error_handler(i2c_status);
230 }
231
232 delay_ms(1);
233
234 /* read data from eeprom device */
235 if((i2c_status = eeprom_read_buffer(&hi2cx, EE_MODE_INT, I2C_MEM_ADDR_WIDIH_8, I2Cx_ADDRESS, 0x00, rx_buf2, BUF_SIZE, I2C_TIMEOUT)) != I2C_OK)
236 {
237 error_handler(i2c_status);
238 }
239
240 delay_ms(5);
241
242
243 /* write data to eeprom device */
244 if((i2c_status = eeprom_write_buffer(&hi2cx, EE_MODE_DMA, I2C_MEM_ADDR_WIDIH_8, I2Cx_ADDRESS, 0x00, tx_buf3, BUF_SIZE, I2C_TIMEOUT)) != I2C_OK)
245 {
246 error_handler(i2c_status);
247 }
248
249 delay_ms(1);
250
251 /* read data from eeprom device */
252 if((i2c_status = eeprom_read_buffer(&hi2cx, EE_MODE_DMA, I2C_MEM_ADDR_WIDIH_8, I2Cx_ADDRESS, 0x00, rx_buf3, BUF_SIZE, I2C_TIMEOUT)) != I2C_OK)
253 {
254 error_handler(i2c_status);
255 }
256
257
258 if((buffer_compare(tx_buf1, rx_buf1, BUF_SIZE) == 0) &&
259 (buffer_compare(tx_buf2, rx_buf2, BUF_SIZE) == 0) &&
260 (buffer_compare(tx_buf3, rx_buf3, BUF_SIZE) == 0))
261 {
262 at32_led_on(LED3);
263 }
264 else
265 {
266 error_handler(i2c_status);
267 }
268 }
269}
270
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
eeprom.h
i2c eeprom libray header file
eeprom_read_buffer
i2c_status_type eeprom_read_buffer(i2c_handle_type *hi2c, eeprom_mode_type mode, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
read data from eeprom.
Definition eeprom.c:177
EE_MODE_DMA
@ EE_MODE_DMA
Definition eeprom.h:39
EE_MODE_INT
@ EE_MODE_INT
Definition eeprom.h:38
EE_MODE_POLL
@ EE_MODE_POLL
Definition eeprom.h:37
eeprom_write_buffer
i2c_status_type eeprom_write_buffer(i2c_handle_type *hi2c, eeprom_mode_type mode, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
write data to the eeprom device.
Definition eeprom.c:231
I2Cx_ADDRESS
#define I2Cx_ADDRESS
Definition project/at_start_f413/examples/i2c/eeprom/src/main.c:41
I2Cx_DMA_RX_IRQn
#define I2Cx_DMA_RX_IRQn
Definition project/at_start_f413/examples/i2c/eeprom/src/main.c:59
I2Cx_CLK
#define I2Cx_CLK
Definition project/at_start_f413/examples/i2c/eeprom/src/main.c:44
I2Cx_DMA_TX_CHANNEL
#define I2Cx_DMA_TX_CHANNEL
Definition project/at_start_f413/examples/i2c/eeprom/src/main.c:55
tx_buf2
uint8_t tx_buf2[12]
Definition project/at_start_f413/examples/i2c/eeprom/src/main.c:67
BUF_SIZE
#define BUF_SIZE
Definition project/at_start_f413/examples/i2c/eeprom/src/main.c:64
tx_buf3
uint8_t tx_buf3[12]
Definition project/at_start_f413/examples/i2c/eeprom/src/main.c:68
rx_buf3
uint8_t rx_buf3[12]
Definition project/at_start_f413/examples/i2c/eeprom/src/main.c:71
I2Cx_SDA_PIN
#define I2Cx_SDA_PIN
Definition project/at_start_f413/examples/i2c/eeprom/src/main.c:50
main
int main(void)
main function.
Definition project/at_start_f413/examples/i2c/eeprom/src/main.c:187
I2Cx_SCL_PIN
#define I2Cx_SCL_PIN
Definition project/at_start_f413/examples/i2c/eeprom/src/main.c:46
hi2cx
i2c_handle_type hi2cx
Definition project/at_start_f413/examples/i2c/eeprom/src/main.c:73
rx_buf1
uint8_t rx_buf1[12]
Definition project/at_start_f413/examples/i2c/eeprom/src/main.c:69
I2Cx_SDA_GPIO_PORT
#define I2Cx_SDA_GPIO_PORT
Definition project/at_start_f413/examples/i2c/eeprom/src/main.c:51
buffer_compare
uint32_t buffer_compare(uint8_t *buffer1, uint8_t *buffer2, uint32_t len)
compare whether the valus of buffer 1 and buffer 2 are equal.
Definition project/at_start_f413/examples/i2c/eeprom/src/main.c:100
tx_buf1
uint8_t tx_buf1[12]
Definition project/at_start_f413/examples/i2c/eeprom/src/main.c:66
I2Cx_DMA_CLK
#define I2Cx_DMA_CLK
Definition project/at_start_f413/examples/i2c/eeprom/src/main.c:54
I2Cx_SDA_GPIO_CLK
#define I2Cx_SDA_GPIO_CLK
Definition project/at_start_f413/examples/i2c/eeprom/src/main.c:52
I2Cx_ERR_IRQn
#define I2Cx_ERR_IRQn
Definition project/at_start_f413/examples/i2c/eeprom/src/main.c:62
error_handler
void error_handler(uint32_t error_code)
error handler program
Definition project/at_start_f413/examples/i2c/eeprom/src/main.c:84
i2c_lowlevel_init
void i2c_lowlevel_init(i2c_handle_type *hi2c)
initializes peripherals used by the i2c.
Definition project/at_start_f413/examples/i2c/eeprom/src/main.c:120
I2Cx_SPEED
#define I2Cx_SPEED
Definition project/at_start_f413/examples/i2c/eeprom/src/main.c:40
I2Cx_PORT
#define I2Cx_PORT
Definition project/at_start_f413/examples/i2c/eeprom/src/main.c:43
I2Cx_SCL_GPIO_CLK
#define I2Cx_SCL_GPIO_CLK
Definition project/at_start_f413/examples/i2c/eeprom/src/main.c:48
I2Cx_DMA_RX_CHANNEL
#define I2Cx_DMA_RX_CHANNEL
Definition project/at_start_f413/examples/i2c/eeprom/src/main.c:58
I2Cx_DMA_TX_IRQn
#define I2Cx_DMA_TX_IRQn
Definition project/at_start_f413/examples/i2c/eeprom/src/main.c:56
rx_buf2
uint8_t rx_buf2[12]
Definition project/at_start_f413/examples/i2c/eeprom/src/main.c:70
I2Cx_EVT_IRQn
#define I2Cx_EVT_IRQn
Definition project/at_start_f413/examples/i2c/eeprom/src/main.c:61
I2Cx_SCL_GPIO_PORT
#define I2Cx_SCL_GPIO_PORT
Definition project/at_start_f413/examples/i2c/eeprom/src/main.c:47
I2C_TIMEOUT
#define I2C_TIMEOUT
Definition project/at_start_f413/examples/i2c/eeprom/src/main.c:38
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
i2c_config
void i2c_config(i2c_handle_type *hi2c)
i2c peripheral initialization.
Definition i2c_application.c:111
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
USER_BUTTON
@ USER_BUTTON
Definition at32f413_board.h:93
at32_button_press
button_type at32_button_press()
returns which button have press down
Definition at32f413_board.c:218
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
dma_default_para_init
void dma_default_para_init(dma_init_type *dma_init_struct)
dma init config with its default value.
Definition at32f413_dma.c:407
dma_reset
void dma_reset(dma_channel_type *dmax_channely)
reset the dmax channely registers.
Definition at32f413_dma.c:63
dma_init
void dma_init(dma_channel_type *dmax_channely, dma_init_type *dma_init_struct)
dma init
Definition at32f413_dma.c:442
DMA_PERIPHERAL_DATA_WIDTH_BYTE
@ DMA_PERIPHERAL_DATA_WIDTH_BYTE
Definition at32f413_dma.h:245
DMA_DIR_MEMORY_TO_PERIPHERAL
@ DMA_DIR_MEMORY_TO_PERIPHERAL
Definition at32f413_dma.h:217
DMA_MEMORY_DATA_WIDTH_BYTE
@ DMA_MEMORY_DATA_WIDTH_BYTE
Definition at32f413_dma.h:255
DMA_PRIORITY_LOW
@ DMA_PRIORITY_LOW
Definition at32f413_dma.h:265
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_DRIVE_STRENGTH_MODERATE
@ GPIO_DRIVE_STRENGTH_MODERATE
Definition at32f413_gpio.h:225
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_OUTPUT_OPEN_DRAIN
@ GPIO_OUTPUT_OPEN_DRAIN
Definition at32f413_gpio.h:235
i2c_own_address1_set
void i2c_own_address1_set(i2c_type *i2c_x, i2c_address_mode_type mode, uint16_t address)
config own address1.
Definition at32f413_i2c.c:191
i2c_init
void i2c_init(i2c_type *i2c_x, i2c_fsmode_duty_cycle_type duty, uint32_t speed)
init i2c speed and duty cycle.
Definition at32f413_i2c.c:89
I2C_FSMODE_DUTY_2_1
@ I2C_FSMODE_DUTY_2_1
Definition at32f413_i2c.h:147
I2C_ADDRESS_MODE_7BIT
@ I2C_ADDRESS_MODE_7BIT
Definition at32f413_i2c.h:156
I2C_MEM_ADDR_WIDIH_8
@ I2C_MEM_ADDR_WIDIH_8
Definition i2c_application.h:60
i2c_status_type
i2c_status_type
Definition i2c_application.h:94
I2C_OK
@ I2C_OK
Definition i2c_application.h:95
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
at32f413_clock.h
header file of clock program
dma_init_type::loop_mode_enable
confirm_state loop_mode_enable
Definition at32f413_dma.h:284
dma_init_type::memory_data_width
dma_memory_data_size_type memory_data_width
Definition at32f413_dma.h:283
dma_init_type::priority
dma_priority_level_type priority
Definition at32f413_dma.h:285
dma_init_type::peripheral_inc_enable
confirm_state peripheral_inc_enable
Definition at32f413_dma.h:280
dma_init_type::memory_inc_enable
confirm_state memory_inc_enable
Definition at32f413_dma.h:281
dma_init_type::direction
dma_dir_type direction
Definition at32f413_dma.h:278
dma_init_type::peripheral_data_width
dma_peripheral_data_size_type peripheral_data_width
Definition at32f413_dma.h:282
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
i2c_handle_type
Definition i2c_application.h:127
i2c_handle_type::dma_rx_channel
dma_channel_type * dma_rx_channel
Definition i2c_application.h:136
i2c_handle_type::i2cx
i2c_type * i2cx
Definition i2c_application.h:128
i2c_handle_type::dma_init_struct
dma_init_type dma_init_struct
Definition i2c_application.h:137
i2c_handle_type::dma_tx_channel
dma_channel_type * dma_tx_channel
Definition i2c_application.h:135


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • i2c
  • memory_write
  • inc
project/at_start_f413/examples/i2c/memory_write/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • i2c
  • memory_write
  • inc
project/at_start_f413/examples/i2c/memory_write/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • i2c
  • memory_write
  • inc
project/at_start_f413/examples/i2c/memory_write/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • i2c
  • memory_write
  • src
project/at_start_f413/examples/i2c/memory_write/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/i2c/memory_write/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • i2c
  • memory_write
  • src
project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28#include "i2c_application.h"
29
30extern i2c_handle_type hi2cx;
31
32#define I2Cx_DMA_TX_IRQHandler DMA1_Channel4_IRQHandler
33#define I2Cx_DMA_RX_IRQHandler DMA1_Channel5_IRQHandler
34#define I2Cx_EVT_IRQHandler I2C2_EVT_IRQHandler
35#define I2Cx_ERR_IRQHandler I2C2_ERR_IRQHandler
36
50void NMI_Handler(void)
51{
52}
53
59void HardFault_Handler(void)
60{
61 /* go to infinite loop when hard fault exception occurs */
62 while(1)
63 {
64 }
65}
66
72void MemManage_Handler(void)
73{
74 /* go to infinite loop when memory manage exception occurs */
75 while(1)
76 {
77 }
78}
79
85void BusFault_Handler(void)
86{
87 /* go to infinite loop when bus fault exception occurs */
88 while(1)
89 {
90 }
91}
92
98void UsageFault_Handler(void)
99{
100 /* go to infinite loop when usage fault exception occurs */
101 while(1)
102 {
103 }
104}
105
111void SVC_Handler(void)
112{
113}
114
120void DebugMon_Handler(void)
121{
122}
123
129void PendSV_Handler(void)
130{
131}
132
138void SysTick_Handler(void)
139{
140}
141
147void I2Cx_DMA_RX_IRQHandler(void)
148{
149 i2c_dma_rx_irq_handler(&hi2cx);
150}
151
157void I2Cx_DMA_TX_IRQHandler(void)
158{
159 i2c_dma_tx_irq_handler(&hi2cx);
160}
161
167void I2Cx_EVT_IRQHandler(void)
168{
169 i2c_evt_irq_handler(&hi2cx);
170}
171
177void I2Cx_ERR_IRQHandler(void)
178{
179 i2c_err_irq_handler(&hi2cx);
180}
181
hi2cx
i2c_handle_type hi2cx
Definition project/at_start_f413/examples/i2c/communication_dma/src/main.c:70
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c:98
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c:59
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c:72
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c:111
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c:129
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c:50
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c:85
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c:138
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c:120
i2c_evt_irq_handler
void i2c_evt_irq_handler(i2c_handle_type *hi2c)
interrupt procession function.
Definition i2c_application.c:2223
i2c_err_irq_handler
void i2c_err_irq_handler(i2c_handle_type *hi2c)
i2c error interrupt function.
Definition i2c_application.c:2339
i2c_dma_rx_irq_handler
void i2c_dma_rx_irq_handler(i2c_handle_type *hi2c)
dma reveive complete interrupt function.
Definition i2c_application.c:2293
i2c_dma_tx_irq_handler
void i2c_dma_tx_irq_handler(i2c_handle_type *hi2c)
dma transmission complete interrupt function.
Definition i2c_application.c:2256
i2c_application.h
i2c application libray header file
I2Cx_EVT_IRQHandler
#define I2Cx_EVT_IRQHandler
Definition project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c:34
I2Cx_ERR_IRQHandler
#define I2Cx_ERR_IRQHandler
Definition project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c:35
I2Cx_DMA_TX_IRQHandler
#define I2Cx_DMA_TX_IRQHandler
Definition project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c:32
I2Cx_DMA_RX_IRQHandler
#define I2Cx_DMA_RX_IRQHandler
Definition project/at_start_f413/examples/i2c/memory_write/src/at32f413_int.c:33
at32f413_int.h
header file of main interrupt service routines.
i2c_handle_type
Definition i2c_application.h:127


AT32F413 Firmwary Library: main.c Source File

  • i2c
  • memory_write
  • src
project/at_start_f413/examples/i2c/memory_write/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include "i2c_application.h"
29
38#define I2C_TIMEOUT 0xFFFFFFFF
39
40#define I2Cx_SPEED 100000
41#define I2Cx_ADDRESS 0xA0
42
43#define I2Cx_PORT I2C2
44#define I2Cx_CLK CRM_I2C2_PERIPH_CLOCK
45
46#define I2Cx_SCL_PIN GPIO_PINS_10
47#define I2Cx_SCL_GPIO_PORT GPIOB
48#define I2Cx_SCL_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
49
50#define I2Cx_SDA_PIN GPIO_PINS_11
51#define I2Cx_SDA_GPIO_PORT GPIOB
52#define I2Cx_SDA_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
53
54#define I2Cx_DMA_CLK CRM_DMA1_PERIPH_CLOCK
55#define I2Cx_DMA_TX_CHANNEL DMA1_CHANNEL4
56#define I2Cx_DMA_TX_IRQn DMA1_Channel4_IRQn
57
58#define I2Cx_DMA_RX_CHANNEL DMA1_CHANNEL5
59#define I2Cx_DMA_RX_IRQn DMA1_Channel5_IRQn
60
61#define I2Cx_EVT_IRQn I2C2_EVT_IRQn
62#define I2Cx_ERR_IRQn I2C2_ERR_IRQn
63
64#define BUF_SIZE 8
65
66uint8_t tx_buf1[BUF_SIZE] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08};
67uint8_t tx_buf2[BUF_SIZE] = {0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80};
68uint8_t tx_buf3[BUF_SIZE] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88};
69uint8_t rx_buf1[BUF_SIZE] = {0};
70uint8_t rx_buf2[BUF_SIZE] = {0};
71uint8_t rx_buf3[BUF_SIZE] = {0};
72
73 i2c_handle_type hi2cx;
74
75void error_handler(uint32_t error_code);
76uint32_t buffer_compare(uint8_t* buffer1, uint8_t* buffer2, uint32_t len);
77void i2c_lowlevel_init(i2c_handle_type* hi2c);
78
84void error_handler(uint32_t error_code)
85{
86 while(1)
87 {
88 at32_led_toggle(LED2);
89 delay_ms(500);
90 }
91}
92
100uint32_t buffer_compare(uint8_t* buffer1, uint8_t* buffer2, uint32_t len)
101{
102 uint32_t i;
103
104 for(i = 0; i < len; i++)
105 {
106 if(buffer1[i] != buffer2[i])
107 {
108 return 1;
109 }
110 }
111
112 return 0;
113}
114
120void i2c_lowlevel_init(i2c_handle_type* hi2c)
121{
122 gpio_init_type gpio_initstructure;
123
124 if(hi2c->i2cx == I2Cx_PORT)
125 {
126 /* i2c periph clock enable */
127 crm_periph_clock_enable(I2Cx_CLK, TRUE);
128 crm_periph_clock_enable(I2Cx_SCL_GPIO_CLK, TRUE);
129 crm_periph_clock_enable(I2Cx_SDA_GPIO_CLK, TRUE);
130
131 /* gpio configuration */
132 gpio_initstructure.gpio_out_type = GPIO_OUTPUT_OPEN_DRAIN;
133 gpio_initstructure.gpio_pull = GPIO_PULL_NONE;
134 gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
135 gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_MODERATE;
136
137 /* configure i2c pins: scl */
138 gpio_initstructure.gpio_pins = I2Cx_SCL_PIN;
139 gpio_init(I2Cx_SCL_GPIO_PORT, &gpio_initstructure);
140
141 /* configure i2c pins: sda */
142 gpio_initstructure.gpio_pins = I2Cx_SDA_PIN;
143 gpio_init(I2Cx_SDA_GPIO_PORT, &gpio_initstructure);
144
145 /* configure and enable i2c dma channel interrupt */
146 nvic_irq_enable(I2Cx_DMA_TX_IRQn, 0, 0);
147 nvic_irq_enable(I2Cx_DMA_RX_IRQn, 0, 0);
148
149 /* configure and enable i2c interrupt */
150 nvic_irq_enable(I2Cx_EVT_IRQn, 0, 0);
151 nvic_irq_enable(I2Cx_ERR_IRQn, 0, 0);
152
153 /* i2c dma tx and rx channels configuration */
154 /* enable the dma clock */
155 crm_periph_clock_enable(I2Cx_DMA_CLK, TRUE);
156
157 /* i2c dma channel configuration */
158 hi2c->dma_tx_channel = I2Cx_DMA_TX_CHANNEL;
159 hi2c->dma_rx_channel = I2Cx_DMA_RX_CHANNEL;
160
161 dma_reset(hi2c->dma_tx_channel);
162 dma_reset(hi2c->dma_rx_channel);
163
164 dma_default_para_init(&hi2c->dma_init_struct);
165 hi2c->dma_init_struct.peripheral_inc_enable = FALSE;
166 hi2c->dma_init_struct.memory_inc_enable = TRUE;
167 hi2c->dma_init_struct.peripheral_data_width = DMA_PERIPHERAL_DATA_WIDTH_BYTE;
168 hi2c->dma_init_struct.memory_data_width = DMA_MEMORY_DATA_WIDTH_BYTE;
169 hi2c->dma_init_struct.loop_mode_enable = FALSE;
170 hi2c->dma_init_struct.priority = DMA_PRIORITY_LOW;
171 hi2c->dma_init_struct.direction = DMA_DIR_MEMORY_TO_PERIPHERAL;
172
173 dma_init(hi2c->dma_tx_channel, &hi2c->dma_init_struct);
174 dma_init(hi2c->dma_rx_channel, &hi2c->dma_init_struct);
175
176 i2c_init(hi2c->i2cx, I2C_FSMODE_DUTY_2_1, I2Cx_SPEED);
177
178 i2c_own_address1_set(hi2c->i2cx, I2C_ADDRESS_MODE_7BIT, I2Cx_ADDRESS);
179 }
180}
181
187int main(void)
188{
189 i2c_status_type i2c_status;
190
191 /* config nvic priority group */
192 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
193
194 system_clock_config();
195
196 at32_board_init();
197
198 hi2cx.i2cx = I2Cx_PORT;
199
200 i2c_config(&hi2cx);
201
202 while(1)
203 {
204 /* wait for key USER_BUTTON press before starting the communication */
205 while(at32_button_press() != USER_BUTTON)
206 {
207 }
208
209 /* write data to memory device */
210 if((i2c_status = i2c_memory_write(&hi2cx, I2C_MEM_ADDR_WIDIH_8, I2Cx_ADDRESS, 0x00, tx_buf1, BUF_SIZE, I2C_TIMEOUT)) != I2C_OK)
211 {
212 error_handler(i2c_status);
213 }
214
215 delay_ms(5);
216
217 /* read data from memory device */
218 if((i2c_status = i2c_memory_read(&hi2cx, I2C_MEM_ADDR_WIDIH_8, I2Cx_ADDRESS, 0x00, rx_buf1, BUF_SIZE, I2C_TIMEOUT)) != I2C_OK)
219 {
220 error_handler(i2c_status);
221 }
222
223 /* write data to memory device */
224 if((i2c_status = i2c_memory_write_int(&hi2cx, I2C_MEM_ADDR_WIDIH_8, I2Cx_ADDRESS, 0x00, tx_buf2, BUF_SIZE, I2C_TIMEOUT)) != I2C_OK)
225 {
226 error_handler(i2c_status);
227 }
228
229 /* wait for the communication to end */
230 if(i2c_wait_end(&hi2cx, I2C_TIMEOUT) != I2C_OK)
231 {
232 error_handler(i2c_status);
233 }
234
235 delay_ms(5);
236
237 /* read data from memory device */
238 if((i2c_status = i2c_memory_read_int(&hi2cx, I2C_MEM_ADDR_WIDIH_8, I2Cx_ADDRESS, 0x00, rx_buf2, BUF_SIZE, I2C_TIMEOUT)) != I2C_OK)
239 {
240 error_handler(i2c_status);
241 }
242
243 /* wait for the communication to end */
244 if(i2c_wait_end(&hi2cx, I2C_TIMEOUT) != I2C_OK)
245 {
246 error_handler(i2c_status);
247 }
248
249 /* write data to memory device */
250 if((i2c_status = i2c_memory_write_dma(&hi2cx, I2C_MEM_ADDR_WIDIH_8, I2Cx_ADDRESS, 0x00, tx_buf3, BUF_SIZE, I2C_TIMEOUT)) != I2C_OK)
251 {
252 error_handler(i2c_status);
253 }
254
255 /* wait for the communication to end */
256 if(i2c_wait_end(&hi2cx, I2C_TIMEOUT) != I2C_OK)
257 {
258 error_handler(i2c_status);
259 }
260
261 delay_ms(5);
262
263 /* read data from memory device */
264 if((i2c_status = i2c_memory_read_dma(&hi2cx, I2C_MEM_ADDR_WIDIH_8, I2Cx_ADDRESS, 0x00, rx_buf3, BUF_SIZE, I2C_TIMEOUT)) != I2C_OK)
265 {
266 error_handler(i2c_status);
267 }
268
269 /* wait for the communication to end */
270 if(i2c_wait_end(&hi2cx, I2C_TIMEOUT) != I2C_OK)
271 {
272 error_handler(i2c_status);
273 }
274
275 if((buffer_compare(tx_buf1, rx_buf1, BUF_SIZE) == 0) &&
276 (buffer_compare(tx_buf2, rx_buf2, BUF_SIZE) == 0) &&
277 (buffer_compare(tx_buf3, rx_buf3, BUF_SIZE) == 0))
278 {
279 at32_led_on(LED3);
280 }
281 else
282 {
283 error_handler(i2c_status);
284 }
285
286 }
287}
288
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
I2Cx_ADDRESS
#define I2Cx_ADDRESS
Definition project/at_start_f413/examples/i2c/memory_write/src/main.c:41
I2Cx_DMA_RX_IRQn
#define I2Cx_DMA_RX_IRQn
Definition project/at_start_f413/examples/i2c/memory_write/src/main.c:59
I2Cx_CLK
#define I2Cx_CLK
Definition project/at_start_f413/examples/i2c/memory_write/src/main.c:44
tx_buf3
uint8_t tx_buf3[8]
Definition project/at_start_f413/examples/i2c/memory_write/src/main.c:68
I2Cx_DMA_TX_CHANNEL
#define I2Cx_DMA_TX_CHANNEL
Definition project/at_start_f413/examples/i2c/memory_write/src/main.c:55
BUF_SIZE
#define BUF_SIZE
Definition project/at_start_f413/examples/i2c/memory_write/src/main.c:64
rx_buf1
uint8_t rx_buf1[8]
Definition project/at_start_f413/examples/i2c/memory_write/src/main.c:69
I2Cx_SDA_PIN
#define I2Cx_SDA_PIN
Definition project/at_start_f413/examples/i2c/memory_write/src/main.c:50
main
int main(void)
main function.
Definition project/at_start_f413/examples/i2c/memory_write/src/main.c:187
I2Cx_SCL_PIN
#define I2Cx_SCL_PIN
Definition project/at_start_f413/examples/i2c/memory_write/src/main.c:46
hi2cx
i2c_handle_type hi2cx
Definition project/at_start_f413/examples/i2c/memory_write/src/main.c:73
I2Cx_SDA_GPIO_PORT
#define I2Cx_SDA_GPIO_PORT
Definition project/at_start_f413/examples/i2c/memory_write/src/main.c:51
buffer_compare
uint32_t buffer_compare(uint8_t *buffer1, uint8_t *buffer2, uint32_t len)
compare whether the valus of buffer 1 and buffer 2 are equal.
Definition project/at_start_f413/examples/i2c/memory_write/src/main.c:100
I2Cx_DMA_CLK
#define I2Cx_DMA_CLK
Definition project/at_start_f413/examples/i2c/memory_write/src/main.c:54
I2Cx_SDA_GPIO_CLK
#define I2Cx_SDA_GPIO_CLK
Definition project/at_start_f413/examples/i2c/memory_write/src/main.c:52
rx_buf2
uint8_t rx_buf2[8]
Definition project/at_start_f413/examples/i2c/memory_write/src/main.c:70
I2Cx_ERR_IRQn
#define I2Cx_ERR_IRQn
Definition project/at_start_f413/examples/i2c/memory_write/src/main.c:62
error_handler
void error_handler(uint32_t error_code)
error handler program
Definition project/at_start_f413/examples/i2c/memory_write/src/main.c:84
i2c_lowlevel_init
void i2c_lowlevel_init(i2c_handle_type *hi2c)
initializes peripherals used by the i2c.
Definition project/at_start_f413/examples/i2c/memory_write/src/main.c:120
I2Cx_SPEED
#define I2Cx_SPEED
Definition project/at_start_f413/examples/i2c/memory_write/src/main.c:40
I2Cx_PORT
#define I2Cx_PORT
Definition project/at_start_f413/examples/i2c/memory_write/src/main.c:43
rx_buf3
uint8_t rx_buf3[8]
Definition project/at_start_f413/examples/i2c/memory_write/src/main.c:71
tx_buf2
uint8_t tx_buf2[8]
Definition project/at_start_f413/examples/i2c/memory_write/src/main.c:67
I2Cx_SCL_GPIO_CLK
#define I2Cx_SCL_GPIO_CLK
Definition project/at_start_f413/examples/i2c/memory_write/src/main.c:48
I2Cx_DMA_RX_CHANNEL
#define I2Cx_DMA_RX_CHANNEL
Definition project/at_start_f413/examples/i2c/memory_write/src/main.c:58
I2Cx_DMA_TX_IRQn
#define I2Cx_DMA_TX_IRQn
Definition project/at_start_f413/examples/i2c/memory_write/src/main.c:56
tx_buf1
uint8_t tx_buf1[8]
Definition project/at_start_f413/examples/i2c/memory_write/src/main.c:66
I2Cx_EVT_IRQn
#define I2Cx_EVT_IRQn
Definition project/at_start_f413/examples/i2c/memory_write/src/main.c:61
I2Cx_SCL_GPIO_PORT
#define I2Cx_SCL_GPIO_PORT
Definition project/at_start_f413/examples/i2c/memory_write/src/main.c:47
I2C_TIMEOUT
#define I2C_TIMEOUT
Definition project/at_start_f413/examples/i2c/memory_write/src/main.c:38
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
i2c_memory_read_dma
i2c_status_type i2c_memory_read_dma(i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
read data from memory device through polling mode.
Definition i2c_application.c:1878
i2c_wait_end
i2c_status_type i2c_wait_end(i2c_handle_type *hi2c, uint32_t timeout)
wait for the transfer to end.
Definition i2c_application.c:129
i2c_memory_write_dma
i2c_status_type i2c_memory_write_dma(i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
write data to the memory device through dma mode.
Definition i2c_application.c:1795
i2c_memory_write_int
i2c_status_type i2c_memory_write_int(i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
write data to the memory device through interrupt mode.
Definition i2c_application.c:1601
i2c_memory_write
i2c_status_type i2c_memory_write(i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
write data to the memory device through polling mode.
Definition i2c_application.c:1299
i2c_config
void i2c_config(i2c_handle_type *hi2c)
i2c peripheral initialization.
Definition i2c_application.c:111
i2c_memory_read
i2c_status_type i2c_memory_read(i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
read data from memory device through polling mode.
Definition i2c_application.c:1388
i2c_memory_read_int
i2c_status_type i2c_memory_read_int(i2c_handle_type *hi2c, i2c_mem_address_width_type mem_address_width, uint16_t address, uint16_t mem_address, uint8_t *pdata, uint16_t size, uint32_t timeout)
read data from memory device through interrupt mode.
Definition i2c_application.c:1678
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
USER_BUTTON
@ USER_BUTTON
Definition at32f413_board.h:93
at32_button_press
button_type at32_button_press()
returns which button have press down
Definition at32f413_board.c:218
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
dma_default_para_init
void dma_default_para_init(dma_init_type *dma_init_struct)
dma init config with its default value.
Definition at32f413_dma.c:407
dma_reset
void dma_reset(dma_channel_type *dmax_channely)
reset the dmax channely registers.
Definition at32f413_dma.c:63
dma_init
void dma_init(dma_channel_type *dmax_channely, dma_init_type *dma_init_struct)
dma init
Definition at32f413_dma.c:442
DMA_PERIPHERAL_DATA_WIDTH_BYTE
@ DMA_PERIPHERAL_DATA_WIDTH_BYTE
Definition at32f413_dma.h:245
DMA_DIR_MEMORY_TO_PERIPHERAL
@ DMA_DIR_MEMORY_TO_PERIPHERAL
Definition at32f413_dma.h:217
DMA_MEMORY_DATA_WIDTH_BYTE
@ DMA_MEMORY_DATA_WIDTH_BYTE
Definition at32f413_dma.h:255
DMA_PRIORITY_LOW
@ DMA_PRIORITY_LOW
Definition at32f413_dma.h:265
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_DRIVE_STRENGTH_MODERATE
@ GPIO_DRIVE_STRENGTH_MODERATE
Definition at32f413_gpio.h:225
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_OUTPUT_OPEN_DRAIN
@ GPIO_OUTPUT_OPEN_DRAIN
Definition at32f413_gpio.h:235
i2c_own_address1_set
void i2c_own_address1_set(i2c_type *i2c_x, i2c_address_mode_type mode, uint16_t address)
config own address1.
Definition at32f413_i2c.c:191
i2c_init
void i2c_init(i2c_type *i2c_x, i2c_fsmode_duty_cycle_type duty, uint32_t speed)
init i2c speed and duty cycle.
Definition at32f413_i2c.c:89
I2C_FSMODE_DUTY_2_1
@ I2C_FSMODE_DUTY_2_1
Definition at32f413_i2c.h:147
I2C_ADDRESS_MODE_7BIT
@ I2C_ADDRESS_MODE_7BIT
Definition at32f413_i2c.h:156
I2C_MEM_ADDR_WIDIH_8
@ I2C_MEM_ADDR_WIDIH_8
Definition i2c_application.h:60
i2c_status_type
i2c_status_type
Definition i2c_application.h:94
I2C_OK
@ I2C_OK
Definition i2c_application.h:95
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
i2c_application.h
i2c application libray header file
at32f413_clock.h
header file of clock program
dma_init_type::loop_mode_enable
confirm_state loop_mode_enable
Definition at32f413_dma.h:284
dma_init_type::memory_data_width
dma_memory_data_size_type memory_data_width
Definition at32f413_dma.h:283
dma_init_type::priority
dma_priority_level_type priority
Definition at32f413_dma.h:285
dma_init_type::peripheral_inc_enable
confirm_state peripheral_inc_enable
Definition at32f413_dma.h:280
dma_init_type::memory_inc_enable
confirm_state memory_inc_enable
Definition at32f413_dma.h:281
dma_init_type::direction
dma_dir_type direction
Definition at32f413_dma.h:278
dma_init_type::peripheral_data_width
dma_peripheral_data_size_type peripheral_data_width
Definition at32f413_dma.h:282
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
i2c_handle_type
Definition i2c_application.h:127
i2c_handle_type::dma_rx_channel
dma_channel_type * dma_rx_channel
Definition i2c_application.h:136
i2c_handle_type::i2cx
i2c_type * i2cx
Definition i2c_application.h:128
i2c_handle_type::dma_init_struct
dma_init_type dma_init_struct
Definition i2c_application.h:137
i2c_handle_type::dma_tx_channel
dma_channel_type * dma_tx_channel
Definition i2c_application.h:135


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • i2s
  • halfduplex_dma
  • inc
project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • i2s
  • halfduplex_dma
  • inc
project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • i2s
  • halfduplex_dma
  • inc
project/at_start_f413/examples/i2s/halfduplex_dma/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • i2s
  • halfduplex_dma
  • src
project/at_start_f413/examples/i2s/halfduplex_dma/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/i2s/halfduplex_dma/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • i2s
  • halfduplex_dma
  • src
project/at_start_f413/examples/i2s/halfduplex_dma/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28#include "at32f413_board.h"
29
43void NMI_Handler(void)
44{
45}
46
52void HardFault_Handler(void)
53{
54 /* go to infinite loop when hard fault exception occurs */
55 while(1)
56 {
57 }
58}
59
65void MemManage_Handler(void)
66{
67 /* go to infinite loop when memory manage exception occurs */
68 while(1)
69 {
70 }
71}
72
78void BusFault_Handler(void)
79{
80 /* go to infinite loop when bus fault exception occurs */
81 while(1)
82 {
83 }
84}
85
91void UsageFault_Handler(void)
92{
93 /* go to infinite loop when usage fault exception occurs */
94 while(1)
95 {
96 }
97}
98
104void SVC_Handler(void)
105{
106}
107
113void DebugMon_Handler(void)
114{
115}
116
122void PendSV_Handler(void)
123{
124}
125
131void SysTick_Handler(void)
132{
133}
134
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/i2s/halfduplex_dma/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/i2s/halfduplex_dma/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/i2s/halfduplex_dma/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/i2s/halfduplex_dma/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/i2s/halfduplex_dma/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/i2s/halfduplex_dma/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/i2s/halfduplex_dma/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/i2s/halfduplex_dma/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/i2s/halfduplex_dma/src/at32f413_int.c:113
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • i2s
  • halfduplex_dma
  • src
project/at_start_f413/examples/i2s/halfduplex_dma/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include <stdio.h>
29
30
39uint16_t i2s1_buffer_tx[32] = {0x0102, 0x0304, 0x0506, 0x0708, 0x090A, 0x0B0C,
40 0x0D0E, 0x0F10, 0x1112, 0x1314, 0x1516, 0x1718,
41 0x191A, 0x1B1C, 0x1D1E, 0x1F20, 0x2122, 0x2324,
42 0x2526, 0x2728, 0x292A, 0x2B2C, 0x2D2E, 0x2F30,
43 0x3132, 0x3334, 0x3536, 0x3738, 0x393A, 0x3B3C,
44 0x3D3E, 0x3F40};
45uint16_t i2s2_buffer_rx[32];
46volatile error_status transfer_status = ERROR;
47
53 error_status buffer_compare(uint16_t* pbuffer1, uint16_t* pbuffer2, uint16_t buffer_length)
54{
55 while(buffer_length--)
56 {
57 if(*pbuffer1 != *pbuffer2)
58 {
59 return ERROR;
60 }
61
62 pbuffer1++;
63 pbuffer2++;
64 }
65 return SUCCESS;
66}
67
73static void dma_config(void)
74{
75 dma_init_type dma_init_struct;
76
77 crm_periph_clock_enable(CRM_DMA1_PERIPH_CLOCK, TRUE);
78 crm_periph_clock_enable(CRM_DMA2_PERIPH_CLOCK, TRUE);
79
80 /* use dma1_channel3 as spi1 transmit channel */
81 dma_reset(DMA1_CHANNEL3);
82 dma_default_para_init(&dma_init_struct);
83 dma_init_struct.buffer_size = 32;
84 dma_init_struct.direction = DMA_DIR_MEMORY_TO_PERIPHERAL;
85 dma_init_struct.memory_base_addr = (uint32_t)i2s1_buffer_tx;
86 dma_init_struct.memory_data_width = DMA_MEMORY_DATA_WIDTH_HALFWORD;
87 dma_init_struct.memory_inc_enable = TRUE;
88 dma_init_struct.peripheral_base_addr = (uint32_t)&(SPI1->dt);
89 dma_init_struct.peripheral_data_width = DMA_PERIPHERAL_DATA_WIDTH_HALFWORD;
90 dma_init_struct.peripheral_inc_enable = FALSE;
91 dma_init_struct.priority = DMA_PRIORITY_HIGH;
92 dma_init_struct.loop_mode_enable = FALSE;
93 dma_init(DMA1_CHANNEL3, &dma_init_struct);
94
95 /* use dma1_channel4 as spi2 receive channel */
96 dma_reset(DMA1_CHANNEL4);
97 dma_init_struct.buffer_size = 32;
98 dma_init_struct.direction = DMA_DIR_PERIPHERAL_TO_MEMORY;
99 dma_init_struct.memory_base_addr = (uint32_t)i2s2_buffer_rx;
100 dma_init_struct.memory_data_width = DMA_MEMORY_DATA_WIDTH_HALFWORD;
101 dma_init_struct.memory_inc_enable = TRUE;
102 dma_init_struct.peripheral_base_addr = (uint32_t)&(SPI2->dt);
103 dma_init_struct.peripheral_data_width = DMA_PERIPHERAL_DATA_WIDTH_HALFWORD;
104 dma_init_struct.peripheral_inc_enable = FALSE;
105 dma_init_struct.priority = DMA_PRIORITY_HIGH;
106 dma_init_struct.loop_mode_enable = FALSE;
107 dma_init(DMA1_CHANNEL4, &dma_init_struct);
108}
109
115static void i2s_config(void)
116{
117 i2s_init_type i2s_init_struct;
118
119 /* master i2s initialization */
120 crm_periph_clock_enable(CRM_SPI1_PERIPH_CLOCK, TRUE);
121 i2s_default_para_init(&i2s_init_struct);
122
123 /* master transmission mode */
124 i2s_init_struct.audio_protocol = I2S_AUDIO_PROTOCOL_PHILLIPS;
125 i2s_init_struct.data_channel_format = I2S_DATA_16BIT_CHANNEL_32BIT;
126 i2s_init_struct.mclk_output_enable = TRUE;
127 i2s_init_struct.audio_sampling_freq = I2S_AUDIO_FREQUENCY_48K;
128 i2s_init_struct.clock_polarity = I2S_CLOCK_POLARITY_LOW;
129 i2s_init_struct.operation_mode = I2S_MODE_MASTER_TX;
130 i2s_init(SPI1, &i2s_init_struct);
131
132 /* use dma transmit */
133 spi_i2s_dma_transmitter_enable(SPI1, TRUE);
134
135 i2s_enable(SPI1, TRUE);
136
137 /* slave i2s initialization */
138 crm_periph_clock_enable(CRM_SPI2_PERIPH_CLOCK, TRUE);
139
140 /* slave reception mode */
141 i2s_init_struct.audio_protocol = I2S_AUDIO_PROTOCOL_PHILLIPS;
142 i2s_init_struct.data_channel_format = I2S_DATA_16BIT_CHANNEL_32BIT;
143 i2s_init_struct.mclk_output_enable = TRUE;
144 i2s_init_struct.audio_sampling_freq = I2S_AUDIO_FREQUENCY_48K;
145 i2s_init_struct.clock_polarity = I2S_CLOCK_POLARITY_LOW;
146 i2s_init_struct.operation_mode = I2S_MODE_SLAVE_RX;
147 i2s_init(SPI2, &i2s_init_struct);
148
149 /* use dma receive */
150 spi_i2s_dma_receiver_enable(SPI2, TRUE);
151
152 i2s_enable(SPI2, TRUE);
153}
154
160static void gpio_config(void)
161{
162 gpio_init_type gpio_initstructure;
163 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
164 crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
165 crm_periph_clock_enable(CRM_IOMUX_PERIPH_CLOCK, TRUE);
166 gpio_pin_remap_config(SWJTAG_GMUX_010, TRUE);
167 gpio_pin_remap_config(SPI1_MUX_01, TRUE);
168
169 /* master i2s ws pin */
170 gpio_initstructure.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
171 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
172 gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
173 gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
174 gpio_initstructure.gpio_pins = GPIO_PINS_15;
175 gpio_init(GPIOA, &gpio_initstructure);
176
177 /* master i2s ck pin */
178 gpio_initstructure.gpio_pull = GPIO_PULL_DOWN;
179 gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
180 gpio_initstructure.gpio_pins = GPIO_PINS_3;
181 gpio_init(GPIOB, &gpio_initstructure);
182
183 /* master i2s sd pin */
184 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
185 gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
186 gpio_initstructure.gpio_pins = GPIO_PINS_5;
187 gpio_init(GPIOB, &gpio_initstructure);
188
189 /* master i2s mck pin */
190 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
191 gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
192 gpio_initstructure.gpio_pins = GPIO_PINS_6;
193 gpio_init(GPIOB, &gpio_initstructure);
194
195 /* slave i2s ws pin */
196 gpio_initstructure.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
197 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
198 gpio_initstructure.gpio_mode = GPIO_MODE_INPUT;
199 gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
200 gpio_initstructure.gpio_pins = GPIO_PINS_12;
201 gpio_init(GPIOB, &gpio_initstructure);
202
203 /* slave i2s ck pin */
204 gpio_initstructure.gpio_pull = GPIO_PULL_DOWN;
205 gpio_initstructure.gpio_mode = GPIO_MODE_INPUT;
206 gpio_initstructure.gpio_pins = GPIO_PINS_13;
207 gpio_init(GPIOB, &gpio_initstructure);
208
209 /* slave i2s sd pin */
210 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
211 gpio_initstructure.gpio_mode = GPIO_MODE_INPUT;
212 gpio_initstructure.gpio_pins = GPIO_PINS_15;
213 gpio_init(GPIOB, &gpio_initstructure);
214}
215
221int main(void)
222{
223 system_clock_config();
224 at32_board_init();
225 at32_led_on(LED4);
226 gpio_config();
227 dma_config();
228 i2s_config();
229
230 /* enable i2s slave dma to get data */
231 dma_channel_enable(DMA1_CHANNEL4, TRUE);
232
233 /* enable i2s master dma to fill data */
234 dma_channel_enable(DMA1_CHANNEL3, TRUE);
235
236 /* wait slave i2s data receive end */
237 while(dma_flag_get(DMA1_FDT4_FLAG) == RESET)
238 {
239 }
240
241 /* wait master and slave idle when communication end */
242 while(spi_i2s_flag_get(SPI1, SPI_I2S_BF_FLAG) != RESET);
243 while(spi_i2s_flag_get(SPI2, SPI_I2S_BF_FLAG) != RESET);
244
245 /* test result:the data check */
246 transfer_status = buffer_compare(i2s2_buffer_rx, i2s1_buffer_tx, 32);
247
248 /* test result indicate:if passed ,led2 lights */
249 if(transfer_status==SUCCESS)
250 {
251 at32_led_on(LED2);
252 }
253 else
254 {
255 at32_led_on(LED3);
256 }
257 while(1)
258 {
259 }
260}
261
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
dma_init_struct
dma_init_type dma_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:38
dma_config
static void dma_config(void)
dma configuration.
Definition project/at_start_f413/examples/i2s/halfduplex_dma/src/main.c:73
buffer_compare
error_status buffer_compare(uint16_t *pbuffer1, uint16_t *pbuffer2, uint16_t buffer_length)
buffer_compare function.
Definition project/at_start_f413/examples/i2s/halfduplex_dma/src/main.c:53
i2s_config
static void i2s_config(void)
i2s configuration.
Definition project/at_start_f413/examples/i2s/halfduplex_dma/src/main.c:115
i2s1_buffer_tx
uint16_t i2s1_buffer_tx[32]
Definition project/at_start_f413/examples/i2s/halfduplex_dma/src/main.c:39
main
int main(void)
main function.
Definition project/at_start_f413/examples/i2s/halfduplex_dma/src/main.c:221
gpio_config
static void gpio_config(void)
gpio configuration.
Definition project/at_start_f413/examples/i2s/halfduplex_dma/src/main.c:160
transfer_status
volatile error_status transfer_status
Definition project/at_start_f413/examples/i2s/halfduplex_dma/src/main.c:46
i2s2_buffer_rx
uint16_t i2s2_buffer_rx[32]
Definition project/at_start_f413/examples/i2s/halfduplex_dma/src/main.c:45
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_SPI2_PERIPH_CLOCK
@ CRM_SPI2_PERIPH_CLOCK
Definition at32f413_crm.h:130
CRM_IOMUX_PERIPH_CLOCK
@ CRM_IOMUX_PERIPH_CLOCK
Definition at32f413_crm.h:108
CRM_SPI1_PERIPH_CLOCK
@ CRM_SPI1_PERIPH_CLOCK
Definition at32f413_crm.h:117
CRM_GPIOB_PERIPH_CLOCK
@ CRM_GPIOB_PERIPH_CLOCK
Definition at32f413_crm.h:110
CRM_DMA1_PERIPH_CLOCK
@ CRM_DMA1_PERIPH_CLOCK
Definition at32f413_crm.h:103
CRM_DMA2_PERIPH_CLOCK
@ CRM_DMA2_PERIPH_CLOCK
Definition at32f413_crm.h:104
dma_channel_enable
void dma_channel_enable(dma_channel_type *dmax_channely, confirm_state new_state)
enable or disable dma channely
Definition at32f413_dma.c:197
dma_default_para_init
void dma_default_para_init(dma_init_type *dma_init_struct)
dma init config with its default value.
Definition at32f413_dma.c:407
dma_flag_get
flag_status dma_flag_get(uint32_t dmax_flag)
get dma flag
Definition at32f413_dma.c:343
dma_reset
void dma_reset(dma_channel_type *dmax_channely)
reset the dmax channely registers.
Definition at32f413_dma.c:63
dma_init
void dma_init(dma_channel_type *dmax_channely, dma_init_type *dma_init_struct)
dma init
Definition at32f413_dma.c:442
DMA_PERIPHERAL_DATA_WIDTH_HALFWORD
@ DMA_PERIPHERAL_DATA_WIDTH_HALFWORD
Definition at32f413_dma.h:246
DMA_DIR_MEMORY_TO_PERIPHERAL
@ DMA_DIR_MEMORY_TO_PERIPHERAL
Definition at32f413_dma.h:217
DMA_DIR_PERIPHERAL_TO_MEMORY
@ DMA_DIR_PERIPHERAL_TO_MEMORY
Definition at32f413_dma.h:216
DMA_MEMORY_DATA_WIDTH_HALFWORD
@ DMA_MEMORY_DATA_WIDTH_HALFWORD
Definition at32f413_dma.h:256
DMA_PRIORITY_HIGH
@ DMA_PRIORITY_HIGH
Definition at32f413_dma.h:267
DMA1_FDT4_FLAG
#define DMA1_FDT4_FLAG
Definition at32f413_dma.h:93
DMA1_CHANNEL3
#define DMA1_CHANNEL3
Definition at32f413_dma.h:482
DMA1_CHANNEL4
#define DMA1_CHANNEL4
Definition at32f413_dma.h:483
error_status
error_status
error status
Definition at32f413.h:302
ERROR
@ ERROR
Definition at32f413.h:302
SUCCESS
@ SUCCESS
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_pin_remap_config
void gpio_pin_remap_config(uint32_t gpio_remap, confirm_state new_state)
iomux remap and debug i/o configuration.
Definition at32f413_gpio.c:549
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_DOWN
@ GPIO_PULL_DOWN
Definition at32f413_gpio.h:245
GPIO_PULL_UP
@ GPIO_PULL_UP
Definition at32f413_gpio.h:244
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_6
#define GPIO_PINS_6
Definition at32f413_gpio.h:56
GPIO_PINS_13
#define GPIO_PINS_13
Definition at32f413_gpio.h:63
GPIO_PINS_3
#define GPIO_PINS_3
Definition at32f413_gpio.h:53
GPIO_PINS_12
#define GPIO_PINS_12
Definition at32f413_gpio.h:62
GPIO_PINS_15
#define GPIO_PINS_15
Definition at32f413_gpio.h:65
GPIO_PINS_5
#define GPIO_PINS_5
Definition at32f413_gpio.h:55
GPIOB
#define GPIOB
Definition at32f413_gpio.h:748
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
SWJTAG_GMUX_010
#define SWJTAG_GMUX_010
Definition at32f413_gpio.h:196
SPI1_MUX_01
#define SPI1_MUX_01
Definition at32f413_gpio.h:80
SPI_I2S_BF_FLAG
#define SPI_I2S_BF_FLAG
Definition at32f413_spi.h:59
i2s_init
void i2s_init(spi_type *spi_x, i2s_init_type *i2s_init_struct)
i2s init config with its setting value.
Definition at32f413_spi.c:315
spi_i2s_dma_receiver_enable
void spi_i2s_dma_receiver_enable(spi_type *spi_x, confirm_state new_state)
enable or disable the spi/i2s dma receiver mode.
Definition at32f413_spi.c:498
spi_i2s_flag_get
flag_status spi_i2s_flag_get(spi_type *spi_x, uint32_t spi_i2s_flag)
get flag of the specified spi/i2s peripheral.
Definition at32f413_spi.c:547
i2s_enable
void i2s_enable(spi_type *spi_x, confirm_state new_state)
enable or disable i2s.
Definition at32f413_spi.c:444
i2s_default_para_init
void i2s_default_para_init(i2s_init_type *i2s_init_struct)
i2s init config with its default value.
Definition at32f413_spi.c:297
spi_i2s_dma_transmitter_enable
void spi_i2s_dma_transmitter_enable(spi_type *spi_x, confirm_state new_state)
enable or disable the spi/i2s dma transmitter mode.
Definition at32f413_spi.c:484
I2S_CLOCK_POLARITY_LOW
@ I2S_CLOCK_POLARITY_LOW
Definition at32f413_spi.h:248
I2S_DATA_16BIT_CHANNEL_32BIT
@ I2S_DATA_16BIT_CHANNEL_32BIT
Definition at32f413_spi.h:227
I2S_AUDIO_FREQUENCY_48K
@ I2S_AUDIO_FREQUENCY_48K
Definition at32f413_spi.h:216
I2S_AUDIO_PROTOCOL_PHILLIPS
@ I2S_AUDIO_PROTOCOL_PHILLIPS
Definition at32f413_spi.h:197
I2S_MODE_MASTER_TX
@ I2S_MODE_MASTER_TX
Definition at32f413_spi.h:239
I2S_MODE_SLAVE_RX
@ I2S_MODE_SLAVE_RX
Definition at32f413_spi.h:238
SPI1
#define SPI1
Definition at32f413_spi.h:447
SPI2
#define SPI2
Definition at32f413_spi.h:448
at32f413_clock.h
header file of clock program
dma_init_type
dma init type
Definition at32f413_dma.h:275
dma_init_type::loop_mode_enable
confirm_state loop_mode_enable
Definition at32f413_dma.h:284
dma_init_type::buffer_size
uint16_t buffer_size
Definition at32f413_dma.h:279
dma_init_type::memory_data_width
dma_memory_data_size_type memory_data_width
Definition at32f413_dma.h:283
dma_init_type::priority
dma_priority_level_type priority
Definition at32f413_dma.h:285
dma_init_type::peripheral_inc_enable
confirm_state peripheral_inc_enable
Definition at32f413_dma.h:280
dma_init_type::memory_inc_enable
confirm_state memory_inc_enable
Definition at32f413_dma.h:281
dma_init_type::direction
dma_dir_type direction
Definition at32f413_dma.h:278
dma_init_type::peripheral_base_addr
uint32_t peripheral_base_addr
Definition at32f413_dma.h:276
dma_init_type::memory_base_addr
uint32_t memory_base_addr
Definition at32f413_dma.h:277
dma_init_type::peripheral_data_width
dma_peripheral_data_size_type peripheral_data_width
Definition at32f413_dma.h:282
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
i2s_init_type
i2s init type
Definition at32f413_spi.h:271
i2s_init_type::audio_sampling_freq
i2s_audio_sampling_freq_type audio_sampling_freq
Definition at32f413_spi.h:274
i2s_init_type::data_channel_format
i2s_data_channel_format_type data_channel_format
Definition at32f413_spi.h:275
i2s_init_type::mclk_output_enable
confirm_state mclk_output_enable
Definition at32f413_spi.h:277
i2s_init_type::audio_protocol
i2s_audio_protocol_type audio_protocol
Definition at32f413_spi.h:273
i2s_init_type::operation_mode
i2s_operation_mode_type operation_mode
Definition at32f413_spi.h:272
i2s_init_type::clock_polarity
i2s_clock_polarity_type clock_polarity
Definition at32f413_spi.h:276


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • i2s
  • halfduplex_interrupt
  • inc
project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • i2s
  • halfduplex_interrupt
  • inc
project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • i2s
  • halfduplex_interrupt
  • inc
project/at_start_f413/examples/i2s/halfduplex_interrupt/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • i2s
  • halfduplex_interrupt
  • src
project/at_start_f413/examples/i2s/halfduplex_interrupt/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/i2s/halfduplex_interrupt/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • i2s
  • halfduplex_interrupt
  • src
project/at_start_f413/examples/i2s/halfduplex_interrupt/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/i2s/halfduplex_interrupt/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/i2s/halfduplex_interrupt/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/i2s/halfduplex_interrupt/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/i2s/halfduplex_interrupt/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/i2s/halfduplex_interrupt/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/i2s/halfduplex_interrupt/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/i2s/halfduplex_interrupt/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/i2s/halfduplex_interrupt/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/i2s/halfduplex_interrupt/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • i2s
  • halfduplex_interrupt
  • src
project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include <stdio.h>
29
38uint16_t i2s1_buffer_tx[32] = {0x0102, 0x0304, 0x0506, 0x0708, 0x090A, 0x0B0C,
39 0x0D0E, 0x0F10, 0x1112, 0x1314, 0x1516, 0x1718,
40 0x191A, 0x1B1C, 0x1D1E, 0x1F20, 0x2122, 0x2324,
41 0x2526, 0x2728, 0x292A, 0x2B2C, 0x2D2E, 0x2F30,
42 0x3132, 0x3334, 0x3536, 0x3738, 0x393A, 0x3B3C,
43 0x3D3E, 0x3F40};
44uint16_t i2s2_buffer_rx[32];
45__IO uint32_t tx_index = 0, rx_index = 0;
46volatile error_status transfer_status1 = ERROR, transfer_status2 = ERROR;
47
53 error_status buffer_compare(uint16_t* pbuffer1, uint16_t* pbuffer2, uint16_t buffer_length)
54{
55 while(buffer_length--)
56 {
57 if(*pbuffer1 != *pbuffer2)
58 {
59 return ERROR;
60 }
61
62 pbuffer1++;
63 pbuffer2++;
64 }
65 return SUCCESS;
66}
67
73 error_status buffer_compare_24bits(uint16_t* pbuffer1, uint16_t* pbuffer2, uint16_t buffer_length)
74{
75 while(buffer_length--)
76 {
77 if(*pbuffer1 != *pbuffer2)
78 {
79 if(*pbuffer1 != (*pbuffer2 & 0xFF00))
80 {
81 return ERROR;
82 }
83 }
84
85 pbuffer1++;
86 pbuffer2++;
87 }
88 return SUCCESS;
89}
90
96static void i2s_config(i2s_data_channel_format_type format, i2s_audio_sampling_freq_type freq)
97{
98 i2s_init_type i2s_init_struct;
99
100 /* master i2s initialization */
101 crm_periph_clock_enable(CRM_SPI1_PERIPH_CLOCK, TRUE);
102 nvic_irq_enable(SPI1_IRQn, 0, 0);
103 spi_i2s_reset(SPI1);
104 i2s_default_para_init(&i2s_init_struct);
105
106 /* master transmission mode */
107 i2s_init_struct.audio_protocol = I2S_AUDIO_PROTOCOL_PHILLIPS;
108 i2s_init_struct.data_channel_format = format;
109 i2s_init_struct.mclk_output_enable = TRUE;
110 i2s_init_struct.audio_sampling_freq = freq;
111 i2s_init_struct.clock_polarity = I2S_CLOCK_POLARITY_LOW;
112 i2s_init_struct.operation_mode = I2S_MODE_MASTER_TX;
113 i2s_init(SPI1, &i2s_init_struct);
114
115 /* enable transmit data buffer empty interrupt */
116 spi_i2s_interrupt_enable(SPI1, SPI_I2S_TDBE_INT, TRUE);
117
118 /* slave i2s initialization */
119 crm_periph_clock_enable(CRM_SPI2_PERIPH_CLOCK, TRUE);
120 nvic_irq_enable(SPI2_IRQn, 0, 0);
121 spi_i2s_reset(SPI2);
122
123 /* slave reception mode */
124 i2s_init_struct.audio_protocol = I2S_AUDIO_PROTOCOL_PHILLIPS;
125 i2s_init_struct.data_channel_format = format;
126 i2s_init_struct.mclk_output_enable = TRUE;
127 i2s_init_struct.audio_sampling_freq = freq;
128 i2s_init_struct.clock_polarity = I2S_CLOCK_POLARITY_LOW;
129 i2s_init_struct.operation_mode =I2S_MODE_SLAVE_RX;
130 i2s_init(SPI2, &i2s_init_struct);
131
132 /* enable receive data buffer full interrupt */
133 spi_i2s_interrupt_enable(SPI2, SPI_I2S_RDBF_INT, TRUE);
134}
135
141static void gpio_config(void)
142{
143 gpio_init_type gpio_initstructure;
144 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
145 crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
146 crm_periph_clock_enable(CRM_IOMUX_PERIPH_CLOCK, TRUE);
147 gpio_pin_remap_config(SWJTAG_GMUX_010, TRUE);
148 gpio_pin_remap_config(SPI1_MUX_01, TRUE);
149
150 /* master i2s ws pin */
151 gpio_initstructure.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
152 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
153 gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
154 gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
155 gpio_initstructure.gpio_pins = GPIO_PINS_15;
156 gpio_init(GPIOA, &gpio_initstructure);
157
158 /* master i2s ck pin */
159 gpio_initstructure.gpio_pull = GPIO_PULL_DOWN;
160 gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
161 gpio_initstructure.gpio_pins = GPIO_PINS_3;
162 gpio_init(GPIOB, &gpio_initstructure);
163
164 /* master i2s sd pin */
165 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
166 gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
167 gpio_initstructure.gpio_pins = GPIO_PINS_5;
168 gpio_init(GPIOB, &gpio_initstructure);
169
170 /* master i2s mck pin */
171 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
172 gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
173 gpio_initstructure.gpio_pins = GPIO_PINS_6;
174 gpio_init(GPIOB, &gpio_initstructure);
175
176 /* slave i2s ws pin */
177 gpio_initstructure.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
178 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
179 gpio_initstructure.gpio_mode = GPIO_MODE_INPUT;
180 gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
181 gpio_initstructure.gpio_pins = GPIO_PINS_12;
182 gpio_init(GPIOB, &gpio_initstructure);
183
184 /* slave i2s ck pin */
185 gpio_initstructure.gpio_pull = GPIO_PULL_DOWN;
186 gpio_initstructure.gpio_mode = GPIO_MODE_INPUT;
187 gpio_initstructure.gpio_pins = GPIO_PINS_13;
188 gpio_init(GPIOB, &gpio_initstructure);
189
190 /* slave i2s sd pin */
191 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
192 gpio_initstructure.gpio_mode = GPIO_MODE_INPUT;
193 gpio_initstructure.gpio_pins = GPIO_PINS_15;
194 gpio_init(GPIOB, &gpio_initstructure);
195}
196
202 void SPI2_IRQHandler(void)
203{
204 if(spi_i2s_interrupt_flag_get(SPI2, SPI_I2S_RDBF_FLAG) != RESET)
205 {
206 i2s2_buffer_rx[rx_index++] = spi_i2s_data_receive(SPI2);
207 }
208}
209
215void SPI1_IRQHandler(void)
216{
217 if(spi_i2s_interrupt_flag_get(SPI1, SPI_I2S_TDBE_FLAG) != RESET)
218 {
219 spi_i2s_data_transmit(SPI1, i2s1_buffer_tx[tx_index++]);
220 if(tx_index == 32)
221 {
222 spi_i2s_interrupt_enable(SPI1, SPI_I2S_TDBE_INT, FALSE);
223 }
224 }
225}
226
232int main(void)
233{
234 __IO uint32_t index = 0;
235 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
236 system_clock_config();
237 at32_board_init();
238 at32_led_on(LED4);
239 gpio_config();
240 i2s_config(I2S_DATA_16BIT_CHANNEL_32BIT, I2S_AUDIO_FREQUENCY_48K);
241
242 /* enable slave and master i2s to start communication */
243 i2s_enable(SPI2, TRUE);
244 i2s_enable(SPI1, TRUE);
245
246 /* wait data receive end */
247 while(rx_index < 32);
248
249 /* wait master and slave idle when communication end */
250 while(spi_i2s_flag_get(SPI1, SPI_I2S_BF_FLAG) != RESET);
251 while(spi_i2s_flag_get(SPI2, SPI_I2S_BF_FLAG) != RESET);
252
253 /* test result:the data check */
254 transfer_status1 = buffer_compare(i2s2_buffer_rx, i2s1_buffer_tx, 32);
255
256 /* receive buffer clear */
257 tx_index = 0;
258 rx_index = 0;
259 for(index = 0; index < 32; index++)
260 {
261 i2s2_buffer_rx[index] = 0;
262 }
263
264 /* change frame format */
265 i2s_config(I2S_DATA_24BIT_CHANNEL_32BIT, I2S_AUDIO_FREQUENCY_16K);
266
267 /* enable slave and master i2s to start communication */
268 i2s_enable(SPI2, TRUE);
269 i2s_enable(SPI1, TRUE);
270
271 /* wait data receive end */
272 while(rx_index < 32);
273
274 /* wait master and slave idle when communication end */
275 while(spi_i2s_flag_get(SPI1, SPI_I2S_BF_FLAG) != RESET);
276 while(spi_i2s_flag_get(SPI2, SPI_I2S_BF_FLAG) != RESET);
277
278 /* test result:the data check */
279 transfer_status2 = buffer_compare_24bits(i2s2_buffer_rx, i2s1_buffer_tx, 32);
280
281 /* test result indicate:if passed ,led2 lights */
282 if((transfer_status1 == SUCCESS) && (transfer_status2 == SUCCESS))
283 {
284 at32_led_on(LED2);
285 }
286 else
287 {
288 at32_led_on(LED3);
289 }
290
291 while(1)
292 {
293 }
294}
295
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
i2s_config
static void i2s_config(void)
i2s configuration.
Definition project/at_start_f413/examples/i2s/halfduplex_dma/src/main.c:115
buffer_compare
error_status buffer_compare(uint16_t *pbuffer1, uint16_t *pbuffer2, uint16_t buffer_length)
buffer_compare function.
Definition project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c:53
tx_index
__IO uint32_t tx_index
Definition project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c:45
transfer_status1
volatile error_status transfer_status1
Definition project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c:46
i2s1_buffer_tx
uint16_t i2s1_buffer_tx[32]
Definition project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c:38
SPI2_IRQHandler
void SPI2_IRQHandler(void)
spi2 interrupt function
Definition project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c:202
transfer_status2
volatile error_status transfer_status2
Definition project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c:46
main
int main(void)
main function.
Definition project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c:232
SPI1_IRQHandler
void SPI1_IRQHandler(void)
spi1 interrupt function
Definition project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c:215
gpio_config
static void gpio_config(void)
gpio configuration.
Definition project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c:141
buffer_compare_24bits
error_status buffer_compare_24bits(uint16_t *pbuffer1, uint16_t *pbuffer2, uint16_t buffer_length)
buffer_compare_24bits function.
Definition project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c:73
rx_index
__IO uint32_t rx_index
Definition project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c:45
i2s2_buffer_rx
uint16_t i2s2_buffer_rx[32]
Definition project/at_start_f413/examples/i2s/halfduplex_interrupt/src/main.c:44
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_SPI2_PERIPH_CLOCK
@ CRM_SPI2_PERIPH_CLOCK
Definition at32f413_crm.h:130
CRM_IOMUX_PERIPH_CLOCK
@ CRM_IOMUX_PERIPH_CLOCK
Definition at32f413_crm.h:108
CRM_SPI1_PERIPH_CLOCK
@ CRM_SPI1_PERIPH_CLOCK
Definition at32f413_crm.h:117
CRM_GPIOB_PERIPH_CLOCK
@ CRM_GPIOB_PERIPH_CLOCK
Definition at32f413_crm.h:110
SPI2_IRQn
@ SPI2_IRQn
Definition at32f413.h:208
SPI1_IRQn
@ SPI1_IRQn
Definition at32f413.h:207
error_status
error_status
error status
Definition at32f413.h:302
ERROR
@ ERROR
Definition at32f413.h:302
SUCCESS
@ SUCCESS
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_pin_remap_config
void gpio_pin_remap_config(uint32_t gpio_remap, confirm_state new_state)
iomux remap and debug i/o configuration.
Definition at32f413_gpio.c:549
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_DOWN
@ GPIO_PULL_DOWN
Definition at32f413_gpio.h:245
GPIO_PULL_UP
@ GPIO_PULL_UP
Definition at32f413_gpio.h:244
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_6
#define GPIO_PINS_6
Definition at32f413_gpio.h:56
GPIO_PINS_13
#define GPIO_PINS_13
Definition at32f413_gpio.h:63
GPIO_PINS_3
#define GPIO_PINS_3
Definition at32f413_gpio.h:53
GPIO_PINS_12
#define GPIO_PINS_12
Definition at32f413_gpio.h:62
GPIO_PINS_15
#define GPIO_PINS_15
Definition at32f413_gpio.h:65
GPIO_PINS_5
#define GPIO_PINS_5
Definition at32f413_gpio.h:55
GPIOB
#define GPIOB
Definition at32f413_gpio.h:748
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
SWJTAG_GMUX_010
#define SWJTAG_GMUX_010
Definition at32f413_gpio.h:196
SPI1_MUX_01
#define SPI1_MUX_01
Definition at32f413_gpio.h:80
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
SPI_I2S_TDBE_FLAG
#define SPI_I2S_TDBE_FLAG
Definition at32f413_spi.h:53
SPI_I2S_RDBF_FLAG
#define SPI_I2S_RDBF_FLAG
Definition at32f413_spi.h:52
SPI_I2S_BF_FLAG
#define SPI_I2S_BF_FLAG
Definition at32f413_spi.h:59
SPI_I2S_TDBE_INT
#define SPI_I2S_TDBE_INT
Definition at32f413_spi.h:73
SPI_I2S_RDBF_INT
#define SPI_I2S_RDBF_INT
Definition at32f413_spi.h:72
spi_i2s_interrupt_enable
void spi_i2s_interrupt_enable(spi_type *spi_x, uint32_t spi_i2s_int, confirm_state new_state)
enable or disable the specified spi/i2s interrupts.
Definition at32f413_spi.c:463
i2s_init
void i2s_init(spi_type *spi_x, i2s_init_type *i2s_init_struct)
i2s init config with its setting value.
Definition at32f413_spi.c:315
spi_i2s_data_transmit
void spi_i2s_data_transmit(spi_type *spi_x, uint16_t tx_data)
spi/i2s data transmit
Definition at32f413_spi.c:513
spi_i2s_flag_get
flag_status spi_i2s_flag_get(spi_type *spi_x, uint32_t spi_i2s_flag)
get flag of the specified spi/i2s peripheral.
Definition at32f413_spi.c:547
i2s_enable
void i2s_enable(spi_type *spi_x, confirm_state new_state)
enable or disable i2s.
Definition at32f413_spi.c:444
spi_i2s_data_receive
uint16_t spi_i2s_data_receive(spi_type *spi_x)
spi/i2s data receive
Definition at32f413_spi.c:525
spi_i2s_reset
void spi_i2s_reset(spi_type *spi_x)
spi reset by crm reset register
Definition at32f413_spi.c:50
spi_i2s_interrupt_flag_get
flag_status spi_i2s_interrupt_flag_get(spi_type *spi_x, uint32_t spi_i2s_flag)
get interrupt flag of the specified spi/i2s peripheral.
Definition at32f413_spi.c:576
i2s_default_para_init
void i2s_default_para_init(i2s_init_type *i2s_init_struct)
i2s init config with its default value.
Definition at32f413_spi.c:297
i2s_data_channel_format_type
i2s_data_channel_format_type
i2s data bit num and channel bit num type
Definition at32f413_spi.h:225
i2s_audio_sampling_freq_type
i2s_audio_sampling_freq_type
i2s audio frequency type
Definition at32f413_spi.h:208
I2S_CLOCK_POLARITY_LOW
@ I2S_CLOCK_POLARITY_LOW
Definition at32f413_spi.h:248
I2S_DATA_24BIT_CHANNEL_32BIT
@ I2S_DATA_24BIT_CHANNEL_32BIT
Definition at32f413_spi.h:228
I2S_DATA_16BIT_CHANNEL_32BIT
@ I2S_DATA_16BIT_CHANNEL_32BIT
Definition at32f413_spi.h:227
I2S_AUDIO_FREQUENCY_48K
@ I2S_AUDIO_FREQUENCY_48K
Definition at32f413_spi.h:216
I2S_AUDIO_FREQUENCY_16K
@ I2S_AUDIO_FREQUENCY_16K
Definition at32f413_spi.h:212
I2S_AUDIO_PROTOCOL_PHILLIPS
@ I2S_AUDIO_PROTOCOL_PHILLIPS
Definition at32f413_spi.h:197
I2S_MODE_MASTER_TX
@ I2S_MODE_MASTER_TX
Definition at32f413_spi.h:239
I2S_MODE_SLAVE_RX
@ I2S_MODE_SLAVE_RX
Definition at32f413_spi.h:238
SPI1
#define SPI1
Definition at32f413_spi.h:447
SPI2
#define SPI2
Definition at32f413_spi.h:448
at32f413_clock.h
header file of clock program
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
i2s_init_type
i2s init type
Definition at32f413_spi.h:271
i2s_init_type::audio_sampling_freq
i2s_audio_sampling_freq_type audio_sampling_freq
Definition at32f413_spi.h:274
i2s_init_type::data_channel_format
i2s_data_channel_format_type data_channel_format
Definition at32f413_spi.h:275
i2s_init_type::mclk_output_enable
confirm_state mclk_output_enable
Definition at32f413_spi.h:277
i2s_init_type::audio_protocol
i2s_audio_protocol_type audio_protocol
Definition at32f413_spi.h:273
i2s_init_type::operation_mode
i2s_operation_mode_type operation_mode
Definition at32f413_spi.h:272
i2s_init_type::clock_polarity
i2s_clock_polarity_type clock_polarity
Definition at32f413_spi.h:276


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • i2s
  • spii2s_switch_halfduplex_polling
  • inc
project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • i2s
  • spii2s_switch_halfduplex_polling
  • inc
project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • i2s
  • spii2s_switch_halfduplex_polling
  • inc
project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • i2s
  • spii2s_switch_halfduplex_polling
  • src
project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • i2s
  • spii2s_switch_halfduplex_polling
  • src
project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28#include "at32f413_board.h"
29
43void NMI_Handler(void)
44{
45}
46
52void HardFault_Handler(void)
53{
54 /* go to infinite loop when hard fault exception occurs */
55 while(1)
56 {
57 }
58}
59
65void MemManage_Handler(void)
66{
67 /* go to infinite loop when memory manage exception occurs */
68 while(1)
69 {
70 }
71}
72
78void BusFault_Handler(void)
79{
80 /* go to infinite loop when bus fault exception occurs */
81 while(1)
82 {
83 }
84}
85
91void UsageFault_Handler(void)
92{
93 /* go to infinite loop when usage fault exception occurs */
94 while(1)
95 {
96 }
97}
98
104void SVC_Handler(void)
105{
106}
107
113void DebugMon_Handler(void)
114{
115}
116
122void PendSV_Handler(void)
123{
124}
125
131void SysTick_Handler(void)
132{
133}
134
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/at32f413_int.c:113
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • i2s
  • spii2s_switch_halfduplex_polling
  • src
project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include <stdio.h>
29
38#define SPI_MASTER_CS_HIGH gpio_bits_set(GPIOA, GPIO_PINS_15)
39#define SPI_MASTER_CS_LOW gpio_bits_reset(GPIOA, GPIO_PINS_15)
40
41uint16_t i2s1_buffer_tx[32] = {0x0102, 0x0304, 0x0506, 0x0708, 0x090A, 0x0B0C,
42 0x0D0E, 0x0F10, 0x1112, 0x1314, 0x1516, 0x1718,
43 0x191A, 0x1B1C, 0x1D1E, 0x1F20, 0x2122, 0x2324,
44 0x2526, 0x2728, 0x292A, 0x2B2C, 0x2D2E, 0x2F30,
45 0x3132, 0x3334, 0x3536, 0x3738, 0x393A, 0x3B3C,
46 0x3D3E, 0x3F40
47 };
48uint16_t spi1_buffer_tx[32] = {0x5152, 0x5354, 0x5556, 0x5758, 0x595A, 0x5B5C,
49 0x5D5E, 0x5F60, 0x6162, 0x6364, 0x6566, 0x6768,
50 0x696A, 0x6B6C, 0x6D6E, 0x6F70, 0x7172, 0x7374,
51 0x7576, 0x7778, 0x797A, 0x7B7C, 0x7D7E, 0x7F80,
52 0x8182, 0x8384, 0x8586, 0x8788, 0x898A, 0x8B8C,
53 0x8D8E, 0x8F90
54 };
55uint16_t i2s2_buffer_rx[32];
56uint16_t spi2_buffer_rx[32];
57__IO uint32_t tx_index = 0, rx_index = 0;
58volatile error_status transfer_status1 = ERROR, transfer_status2 = ERROR, transfer_status3 = ERROR;
59
65 error_status buffer_compare(uint16_t* pbuffer1, uint16_t* pbuffer2, uint16_t buffer_length)
66{
67 while(buffer_length--)
68 {
69 if(*pbuffer1 != *pbuffer2)
70 {
71 return ERROR;
72 }
73
74 pbuffer1++;
75 pbuffer2++;
76 }
77 return SUCCESS;
78}
79
85static void i2s_config(i2s_operation_mode_type i2s1_mode, i2s_operation_mode_type i2s2_mode)
86{
87 i2s_init_type i2s_init_struct;
88
89 /* i2s1 initialization */
90 crm_periph_clock_enable(CRM_SPI1_PERIPH_CLOCK, TRUE);
91 spi_i2s_reset(SPI1);
92 i2s_default_para_init(&i2s_init_struct);
93
94 i2s_init_struct.audio_protocol = I2S_AUDIO_PROTOCOL_PHILLIPS;
95 i2s_init_struct.data_channel_format = I2S_DATA_16BIT_CHANNEL_32BIT;
96 i2s_init_struct.mclk_output_enable = FALSE;
97 i2s_init_struct.audio_sampling_freq = I2S_AUDIO_FREQUENCY_48K;
98 i2s_init_struct.clock_polarity = I2S_CLOCK_POLARITY_LOW;
99 i2s_init_struct.operation_mode = i2s1_mode;
100 i2s_init(SPI1, &i2s_init_struct);
101
102 /* i2s2 initialization */
103 crm_periph_clock_enable(CRM_SPI2_PERIPH_CLOCK, TRUE);
104 spi_i2s_reset(SPI2);
105 i2s_init_struct.audio_protocol = I2S_AUDIO_PROTOCOL_PHILLIPS;
106 i2s_init_struct.data_channel_format = I2S_DATA_16BIT_CHANNEL_32BIT;
107 i2s_init_struct.mclk_output_enable = FALSE;
108 i2s_init_struct.audio_sampling_freq = I2S_AUDIO_FREQUENCY_48K;
109 i2s_init_struct.clock_polarity = I2S_CLOCK_POLARITY_LOW;
110 i2s_init_struct.operation_mode =i2s2_mode;
111 i2s_init(SPI2, &i2s_init_struct);
112}
113
119static void spi_config(void)
120{
121 spi_init_type spi_init_struct;
122
123 /* master spi initialization */
124 crm_periph_clock_enable(CRM_SPI1_PERIPH_CLOCK, TRUE);
125 spi_i2s_reset(SPI1);
126 spi_default_para_init(&spi_init_struct);
127
128 /* single line bidirectional half duplex mode-transmitting */
129 spi_init_struct.transmission_mode = SPI_TRANSMIT_HALF_DUPLEX_TX;
130 spi_init_struct.master_slave_mode =SPI_MODE_MASTER;
131 spi_init_struct.mclk_freq_division = SPI_MCLK_DIV_8;
132 spi_init_struct.first_bit_transmission = SPI_FIRST_BIT_MSB;
133 spi_init_struct.frame_bit_num = SPI_FRAME_16BIT;
134 spi_init_struct.clock_polarity = SPI_CLOCK_POLARITY_LOW;
135 spi_init_struct.clock_phase = SPI_CLOCK_PHASE_2EDGE;
136 spi_init_struct.cs_mode_selection = SPI_CS_SOFTWARE_MODE;
137 spi_init(SPI1, &spi_init_struct);
138
139 spi_enable(SPI1, TRUE);
140
141 /* slave spi initialization */
142 crm_periph_clock_enable(CRM_SPI2_PERIPH_CLOCK, TRUE);
143 spi_i2s_reset(SPI2);
144
145 /* dual line unidirectional simplex receive-only mode */
146 spi_init_struct.transmission_mode = SPI_TRANSMIT_SIMPLEX_RX;
147 spi_init_struct.master_slave_mode =SPI_MODE_SLAVE;
148 spi_init_struct.mclk_freq_division = SPI_MCLK_DIV_8;
149 spi_init_struct.first_bit_transmission = SPI_FIRST_BIT_MSB;
150 spi_init_struct.frame_bit_num = SPI_FRAME_16BIT;
151 spi_init_struct.clock_polarity = SPI_CLOCK_POLARITY_LOW;
152 spi_init_struct.clock_phase = SPI_CLOCK_PHASE_2EDGE;
153 spi_init_struct.cs_mode_selection = SPI_CS_HARDWARE_MODE;
154 spi_init(SPI2, &spi_init_struct);
155
156 spi_enable(SPI2, TRUE);
157}
158
166static void gpio_config(uint16_t spi_i2s_mode)
167{
168 gpio_init_type gpio_initstructure;
169 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
170 crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
171 crm_periph_clock_enable(CRM_IOMUX_PERIPH_CLOCK, TRUE);
172 gpio_pin_remap_config(SWJTAG_GMUX_010, TRUE);
173 gpio_pin_remap_config(SPI1_MUX_01, TRUE);
174
175 /* master ws/cs pin */
176 gpio_initstructure.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
177 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
178 gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
179 gpio_initstructure.gpio_pins = GPIO_PINS_15;
180 if(spi_i2s_mode == 0)
181 {
182 gpio_initstructure.gpio_mode = GPIO_MODE_OUTPUT;
183 }
184 else
185 {
186 gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
187 }
188 gpio_init(GPIOA, &gpio_initstructure);
189 if(spi_i2s_mode == 0)
190 {
191 /* non communication time: master pull up CS pin release slave */
192 SPI_MASTER_CS_HIGH;
193 }
194
195 /* master ck pin */
196 gpio_initstructure.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
197 gpio_initstructure.gpio_pull = GPIO_PULL_DOWN;
198 gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
199 gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
200 gpio_initstructure.gpio_pins = GPIO_PINS_3;
201 gpio_init(GPIOB, &gpio_initstructure);
202
203 /* master sd pin */
204 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
205 gpio_initstructure.gpio_pins = GPIO_PINS_5;
206 gpio_init(GPIOB, &gpio_initstructure);
207
208 /* slave ws pin */
209 gpio_initstructure.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
210 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
211 gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
212 gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
213 gpio_initstructure.gpio_pins = GPIO_PINS_12;
214 gpio_init(GPIOB, &gpio_initstructure);
215
216 /* slave ck pin */
217 gpio_initstructure.gpio_pull = GPIO_PULL_DOWN;
218 gpio_initstructure.gpio_pins = GPIO_PINS_13;
219 gpio_init(GPIOB, &gpio_initstructure);
220
221 /* slave sd pin */
222 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
223 gpio_initstructure.gpio_pins = GPIO_PINS_15;
224 gpio_init(GPIOB, &gpio_initstructure);
225}
226
232int main(void)
233{
234 __IO uint32_t index = 0;
235 system_clock_config();
236 at32_board_init();
237 at32_led_on(LED4);
238
239 /* first: i2s communication */
240 gpio_config(1);
241 i2s_config(I2S_MODE_MASTER_TX, I2S_MODE_SLAVE_RX);
242 i2s_enable(SPI2, TRUE);
243 i2s_enable(SPI1, TRUE);
244 while(rx_index < 32)
245 {
246 /* i2s transmit data fill */
247 while(spi_i2s_flag_get(SPI1, SPI_I2S_TDBE_FLAG) == RESET);
248 spi_i2s_data_transmit(SPI1, i2s1_buffer_tx[tx_index++]);
249
250 /* i2s receive data get */
251 while(spi_i2s_flag_get(SPI2, SPI_I2S_RDBF_FLAG) == RESET);
252 i2s2_buffer_rx[rx_index++] = spi_i2s_data_receive(SPI2);
253 }
254
255 /* wait master and slave idle when communication end */
256 while(spi_i2s_flag_get(SPI1, SPI_I2S_BF_FLAG) != RESET);
257 while(spi_i2s_flag_get(SPI2, SPI_I2S_BF_FLAG) != RESET);
258
259 /* test result:the data check */
260 transfer_status1 = buffer_compare(i2s2_buffer_rx, i2s1_buffer_tx, 32);
261
262 /* receive buffer clear */
263 tx_index = 0;
264 rx_index = 0;
265 for(index = 0; index < 32; index++)
266 {
267 i2s2_buffer_rx[index] = 0;
268 }
269
270 /* second: spi communication */
271 gpio_config(0);
272 spi_config();
273
274 /* start communication: master pull down CS pin select slave */
275 SPI_MASTER_CS_LOW;
276
277 while(rx_index < 32)
278 {
279 /* spi transmit data fill */
280 while(spi_i2s_flag_get(SPI1, SPI_I2S_TDBE_FLAG) == RESET);
281 spi_i2s_data_transmit(SPI1, spi1_buffer_tx[tx_index++]);
282
283 /* spi receive data get */
284 while(spi_i2s_flag_get(SPI2, SPI_I2S_RDBF_FLAG) == RESET);
285 spi2_buffer_rx[rx_index++] = spi_i2s_data_receive(SPI2);
286 }
287
288 /* wait master and slave idle when communication end */
289 while(spi_i2s_flag_get(SPI1, SPI_I2S_BF_FLAG) != RESET);
290 while(spi_i2s_flag_get(SPI2, SPI_I2S_BF_FLAG) != RESET);
291
292 /* end communication: master pull up CS pin release slave */
293 SPI_MASTER_CS_HIGH;
294
295 /* test result:the data check */
296 transfer_status2 = buffer_compare(spi2_buffer_rx, spi1_buffer_tx, 32);
297
298 /* receive buffer clear */
299 tx_index = 0;
300 rx_index = 0;
301 for(index = 0; index < 32; index++)
302 {
303 i2s2_buffer_rx[index] = 0;
304 }
305
306 /* third: i2s communication */
307 gpio_config(1);
308 i2s_config(I2S_MODE_SLAVE_TX, I2S_MODE_MASTER_RX);
309
310 /* when slave transmission mode,the slave trans data need fill in advance */
311 while(spi_i2s_flag_get(SPI1, SPI_I2S_TDBE_FLAG) == RESET);
312 spi_i2s_data_transmit(SPI1, i2s1_buffer_tx[tx_index++]);
313
314 i2s_enable(SPI1, TRUE);
315 i2s_enable(SPI2, TRUE);
316 while(rx_index < 32)
317 {
318 /* i2s receive data get */
319 while(spi_i2s_flag_get(SPI2, SPI_I2S_RDBF_FLAG) == RESET);
320 i2s2_buffer_rx[rx_index++] = spi_i2s_data_receive(SPI2);
321
322 /* i2s transmit data fill */
323 while(spi_i2s_flag_get(SPI1, SPI_I2S_TDBE_FLAG) == RESET);
324 spi_i2s_data_transmit(SPI1, i2s1_buffer_tx[tx_index++]);
325 }
326
327 /* master half duplex receiving mode,the busy flag isnot usefull */
328
329 /* test result:the data check */
330 transfer_status3 = buffer_compare(i2s2_buffer_rx, i2s1_buffer_tx, 32);
331
332 /* test result indicate:if passed ,led2 lights */
333 if((transfer_status1 == SUCCESS) && (transfer_status2 == SUCCESS) && (transfer_status3 == SUCCESS))
334 {
335 at32_led_on(LED2);
336 }
337 else
338 {
339 at32_led_on(LED3);
340 }
341 while(1)
342 {
343 }
344}
345
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
gpio_config
static void gpio_config(void)
gpio configuration.
Definition project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/main.c:46
i2s_config
static void i2s_config(void)
i2s configuration.
Definition project/at_start_f413/examples/i2s/halfduplex_dma/src/main.c:115
SPI_MASTER_CS_HIGH
#define SPI_MASTER_CS_HIGH
Definition project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c:38
SPI_MASTER_CS_LOW
#define SPI_MASTER_CS_LOW
Definition project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c:39
buffer_compare
error_status buffer_compare(uint16_t *pbuffer1, uint16_t *pbuffer2, uint16_t buffer_length)
buffer_compare function.
Definition project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c:65
tx_index
__IO uint32_t tx_index
Definition project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c:57
transfer_status3
volatile error_status transfer_status3
Definition project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c:58
spi_config
static void spi_config(void)
spi configuration.
Definition project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c:119
transfer_status1
volatile error_status transfer_status1
Definition project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c:58
i2s1_buffer_tx
uint16_t i2s1_buffer_tx[32]
Definition project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c:41
transfer_status2
volatile error_status transfer_status2
Definition project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c:58
main
int main(void)
main function.
Definition project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c:232
spi2_buffer_rx
uint16_t spi2_buffer_rx[32]
Definition project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c:56
spi1_buffer_tx
uint16_t spi1_buffer_tx[32]
Definition project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c:48
rx_index
__IO uint32_t rx_index
Definition project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c:57
i2s2_buffer_rx
uint16_t i2s2_buffer_rx[32]
Definition project/at_start_f413/examples/i2s/spii2s_switch_halfduplex_polling/src/main.c:55
spi_init_struct
spi_init_type spi_init_struct
Definition project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c:41
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_SPI2_PERIPH_CLOCK
@ CRM_SPI2_PERIPH_CLOCK
Definition at32f413_crm.h:130
CRM_IOMUX_PERIPH_CLOCK
@ CRM_IOMUX_PERIPH_CLOCK
Definition at32f413_crm.h:108
CRM_SPI1_PERIPH_CLOCK
@ CRM_SPI1_PERIPH_CLOCK
Definition at32f413_crm.h:117
CRM_GPIOB_PERIPH_CLOCK
@ CRM_GPIOB_PERIPH_CLOCK
Definition at32f413_crm.h:110
error_status
error_status
error status
Definition at32f413.h:302
ERROR
@ ERROR
Definition at32f413.h:302
SUCCESS
@ SUCCESS
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_pin_remap_config
void gpio_pin_remap_config(uint32_t gpio_remap, confirm_state new_state)
iomux remap and debug i/o configuration.
Definition at32f413_gpio.c:549
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_MODE_OUTPUT
@ GPIO_MODE_OUTPUT
Definition at32f413_gpio.h:214
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_DOWN
@ GPIO_PULL_DOWN
Definition at32f413_gpio.h:245
GPIO_PULL_UP
@ GPIO_PULL_UP
Definition at32f413_gpio.h:244
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_13
#define GPIO_PINS_13
Definition at32f413_gpio.h:63
GPIO_PINS_3
#define GPIO_PINS_3
Definition at32f413_gpio.h:53
GPIO_PINS_12
#define GPIO_PINS_12
Definition at32f413_gpio.h:62
GPIO_PINS_15
#define GPIO_PINS_15
Definition at32f413_gpio.h:65
GPIO_PINS_5
#define GPIO_PINS_5
Definition at32f413_gpio.h:55
GPIOB
#define GPIOB
Definition at32f413_gpio.h:748
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
SWJTAG_GMUX_010
#define SWJTAG_GMUX_010
Definition at32f413_gpio.h:196
SPI1_MUX_01
#define SPI1_MUX_01
Definition at32f413_gpio.h:80
SPI_I2S_TDBE_FLAG
#define SPI_I2S_TDBE_FLAG
Definition at32f413_spi.h:53
SPI_I2S_RDBF_FLAG
#define SPI_I2S_RDBF_FLAG
Definition at32f413_spi.h:52
SPI_I2S_BF_FLAG
#define SPI_I2S_BF_FLAG
Definition at32f413_spi.h:59
i2s_init
void i2s_init(spi_type *spi_x, i2s_init_type *i2s_init_struct)
i2s init config with its setting value.
Definition at32f413_spi.c:315
spi_i2s_data_transmit
void spi_i2s_data_transmit(spi_type *spi_x, uint16_t tx_data)
spi/i2s data transmit
Definition at32f413_spi.c:513
spi_i2s_flag_get
flag_status spi_i2s_flag_get(spi_type *spi_x, uint32_t spi_i2s_flag)
get flag of the specified spi/i2s peripheral.
Definition at32f413_spi.c:547
i2s_enable
void i2s_enable(spi_type *spi_x, confirm_state new_state)
enable or disable i2s.
Definition at32f413_spi.c:444
spi_init
void spi_init(spi_type *spi_x, spi_init_type *spi_init_struct)
spi init config with its setting value.
Definition at32f413_spi.c:90
spi_default_para_init
void spi_default_para_init(spi_init_type *spi_init_struct)
spi init config with its default value.
Definition at32f413_spi.c:70
spi_i2s_data_receive
uint16_t spi_i2s_data_receive(spi_type *spi_x)
spi/i2s data receive
Definition at32f413_spi.c:525
spi_i2s_reset
void spi_i2s_reset(spi_type *spi_x)
spi reset by crm reset register
Definition at32f413_spi.c:50
i2s_default_para_init
void i2s_default_para_init(i2s_init_type *i2s_init_struct)
i2s init config with its default value.
Definition at32f413_spi.c:297
spi_enable
void spi_enable(spi_type *spi_x, confirm_state new_state)
enable or disable spi.
Definition at32f413_spi.c:286
i2s_operation_mode_type
i2s_operation_mode_type
i2s operation mode type
Definition at32f413_spi.h:236
I2S_CLOCK_POLARITY_LOW
@ I2S_CLOCK_POLARITY_LOW
Definition at32f413_spi.h:248
SPI_MODE_SLAVE
@ SPI_MODE_SLAVE
Definition at32f413_spi.h:97
SPI_MODE_MASTER
@ SPI_MODE_MASTER
Definition at32f413_spi.h:98
I2S_DATA_16BIT_CHANNEL_32BIT
@ I2S_DATA_16BIT_CHANNEL_32BIT
Definition at32f413_spi.h:227
SPI_CLOCK_PHASE_2EDGE
@ SPI_CLOCK_PHASE_2EDGE
Definition at32f413_spi.h:116
I2S_AUDIO_FREQUENCY_48K
@ I2S_AUDIO_FREQUENCY_48K
Definition at32f413_spi.h:216
SPI_CS_SOFTWARE_MODE
@ SPI_CS_SOFTWARE_MODE
Definition at32f413_spi.h:125
SPI_CS_HARDWARE_MODE
@ SPI_CS_HARDWARE_MODE
Definition at32f413_spi.h:124
SPI_FIRST_BIT_MSB
@ SPI_FIRST_BIT_MSB
Definition at32f413_spi.h:150
SPI_CLOCK_POLARITY_LOW
@ SPI_CLOCK_POLARITY_LOW
Definition at32f413_spi.h:106
SPI_TRANSMIT_HALF_DUPLEX_TX
@ SPI_TRANSMIT_HALF_DUPLEX_TX
Definition at32f413_spi.h:162
SPI_TRANSMIT_SIMPLEX_RX
@ SPI_TRANSMIT_SIMPLEX_RX
Definition at32f413_spi.h:160
I2S_AUDIO_PROTOCOL_PHILLIPS
@ I2S_AUDIO_PROTOCOL_PHILLIPS
Definition at32f413_spi.h:197
SPI_MCLK_DIV_8
@ SPI_MCLK_DIV_8
Definition at32f413_spi.h:135
SPI_FRAME_16BIT
@ SPI_FRAME_16BIT
Definition at32f413_spi.h:89
I2S_MODE_MASTER_TX
@ I2S_MODE_MASTER_TX
Definition at32f413_spi.h:239
I2S_MODE_MASTER_RX
@ I2S_MODE_MASTER_RX
Definition at32f413_spi.h:240
I2S_MODE_SLAVE_RX
@ I2S_MODE_SLAVE_RX
Definition at32f413_spi.h:238
I2S_MODE_SLAVE_TX
@ I2S_MODE_SLAVE_TX
Definition at32f413_spi.h:237
SPI1
#define SPI1
Definition at32f413_spi.h:447
SPI2
#define SPI2
Definition at32f413_spi.h:448
at32f413_clock.h
header file of clock program
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
i2s_init_type
i2s init type
Definition at32f413_spi.h:271
i2s_init_type::audio_sampling_freq
i2s_audio_sampling_freq_type audio_sampling_freq
Definition at32f413_spi.h:274
i2s_init_type::data_channel_format
i2s_data_channel_format_type data_channel_format
Definition at32f413_spi.h:275
i2s_init_type::mclk_output_enable
confirm_state mclk_output_enable
Definition at32f413_spi.h:277
i2s_init_type::audio_protocol
i2s_audio_protocol_type audio_protocol
Definition at32f413_spi.h:273
i2s_init_type::operation_mode
i2s_operation_mode_type operation_mode
Definition at32f413_spi.h:272
i2s_init_type::clock_polarity
i2s_clock_polarity_type clock_polarity
Definition at32f413_spi.h:276
spi_init_type
spi init type
Definition at32f413_spi.h:256
spi_init_type::master_slave_mode
spi_master_slave_mode_type master_slave_mode
Definition at32f413_spi.h:258
spi_init_type::first_bit_transmission
spi_first_bit_type first_bit_transmission
Definition at32f413_spi.h:260
spi_init_type::frame_bit_num
spi_frame_bit_num_type frame_bit_num
Definition at32f413_spi.h:261
spi_init_type::clock_polarity
spi_clock_polarity_type clock_polarity
Definition at32f413_spi.h:262
spi_init_type::cs_mode_selection
spi_cs_mode_type cs_mode_selection
Definition at32f413_spi.h:264
spi_init_type::mclk_freq_division
spi_mclk_freq_div_type mclk_freq_division
Definition at32f413_spi.h:259
spi_init_type::transmission_mode
spi_transmission_mode_type transmission_mode
Definition at32f413_spi.h:257
spi_init_type::clock_phase
spi_clock_phase_type clock_phase
Definition at32f413_spi.h:263


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • pwc
  • deepsleep_rtc
  • inc
project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • pwc
  • deepsleep_rtc
  • inc
project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • pwc
  • deepsleep_rtc
  • inc
project/at_start_f413/examples/pwc/deepsleep_rtc/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • pwc
  • deepsleep_rtc
  • src
project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • pwc
  • deepsleep_rtc
  • src
project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28#include "at32f413_board.h"
29
30
45void NMI_Handler(void)
46{
47}
48
54void HardFault_Handler(void)
55{
56 /* go to infinite loop when hard fault exception occurs */
57 while(1)
58 {
59 }
60}
61
67void MemManage_Handler(void)
68{
69 /* go to infinite loop when memory manage exception occurs */
70 while(1)
71 {
72 }
73}
74
80void BusFault_Handler(void)
81{
82 /* go to infinite loop when bus fault exception occurs */
83 while(1)
84 {
85 }
86}
87
93void UsageFault_Handler(void)
94{
95 /* go to infinite loop when usage fault exception occurs */
96 while(1)
97 {
98 }
99}
100
106void SVC_Handler(void)
107{
108}
109
115void DebugMon_Handler(void)
116{
117}
118
124void PendSV_Handler(void)
125{
126}
127
133void SysTick_Handler(void)
134{
135}
136
142void RTCAlarm_IRQHandler(void)
143{
144 if(rtc_interrupt_flag_get(RTC_TA_FLAG) != RESET)
145 {
146 /* clear exint line flag */
147 exint_flag_clear(EXINT_LINE_17);
148
149 /* toggle led */
150 at32_led_toggle(LED4);
151
152 /* wait for the register write to complete */
153 rtc_wait_config_finish();
154
155 /* clear alarm flag */
156 rtc_flag_clear(RTC_TA_FLAG);
157
158 /* wait for the register write to complete */
159 rtc_wait_config_finish();
160 }
161}
162
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_int.c:93
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_int.c:54
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_int.c:67
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_int.c:106
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_int.c:124
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_int.c:45
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_int.c:80
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_int.c:133
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_int.c:115
RTCAlarm_IRQHandler
void RTCAlarm_IRQHandler(void)
this function handles the rtc alarm through exint line interrupt request.
Definition project/at_start_f413/examples/pwc/deepsleep_rtc/src/at32f413_int.c:142
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
exint_flag_clear
void exint_flag_clear(uint32_t exint_line)
clear exint flag
Definition at32f413_exint.c:125
EXINT_LINE_17
#define EXINT_LINE_17
Definition at32f413_exint.h:68
RESET
@ RESET
Definition at32f413.h:292
rtc_interrupt_flag_get
flag_status rtc_interrupt_flag_get(uint16_t flag)
rtc interrupt flag get
Definition at32f413_rtc.c:207
rtc_wait_config_finish
void rtc_wait_config_finish(void)
rtc wait configuration finish
Definition at32f413_rtc.c:243
rtc_flag_clear
void rtc_flag_clear(uint16_t flag)
rtc flag clear
Definition at32f413_rtc.c:233
RTC_TA_FLAG
#define RTC_TA_FLAG
Definition at32f413_rtc.h:65
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • pwc
  • deepsleep_rtc
  • src
project/at_start_f413/examples/pwc/deepsleep_rtc/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include <stdio.h>
29
30
44void rtc_config(void)
45{
46 exint_init_type exint_init_struct;
47
48 /* config the exint line of the rtc alarm */
49 exint_init_struct.line_select = EXINT_LINE_17;
50 exint_init_struct.line_enable = TRUE;
51 exint_init_struct.line_mode = EXINT_LINE_INTERRUPT;
52 exint_init_struct.line_polarity = EXINT_TRIGGER_RISING_EDGE;
53 exint_init(&exint_init_struct);
54
55 /* enable the battery-powered domain write operations */
56 pwc_battery_powered_domain_access(TRUE);
57
58 /* reset battery-powered domain register */
59 bpr_reset();
60
61 /* enable the lick */
62 crm_clock_source_enable(CRM_CLOCK_SOURCE_LICK, TRUE);
63
64 /* wait lick is ready */
65 while(crm_flag_get(CRM_LICK_STABLE_FLAG) == RESET);
66
67 /* select the rtc clock source */
68 crm_rtc_clock_select(CRM_RTC_CLOCK_LICK);
69
70 /* enable rtc clock */
71 crm_rtc_clock_enable(TRUE);
72
73 /* wait for rtc registers update */
74 rtc_wait_update_finish();
75
76 /* set rtc divider: set rtc period to 1sec */
77 rtc_divider_set(32767);
78
79 /* wait for the register write to complete */
80 rtc_wait_config_finish();
81
82 /* enable alarm interrupt */
83 rtc_interrupt_enable(RTC_TA_INT, TRUE);
84
85 /* wait for the register write to complete */
86 rtc_wait_config_finish();
87
88 /* configure and enable rtc alarm interrupt */
89 nvic_irq_enable(RTCAlarm_IRQn, 0, 0);
90}
91
97void system_clock_recover(void)
98{
99 /* enable external high-speed crystal oscillator - hext */
100 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
101
102 /* wait till hext is ready */
103 while(crm_hext_stable_wait() == ERROR);
104
105 /* enable pll */
106 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
107
108 /* wait till pll is ready */
109 while(crm_flag_get(CRM_PLL_STABLE_FLAG) == RESET);
110
111 /* enable auto step mode */
112 crm_auto_step_mode_enable(TRUE);
113
114 /* select pll as system clock source */
115 crm_sysclk_switch(CRM_SCLK_PLL);
116
117 /* wait till pll is used as system clock source */
118 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL);
119}
120
126int main(void)
127{
128 crm_clocks_freq_type crm_clocks_freq_struct = {0};
129 __IO uint32_t systick_index = 0;
130
131 /* congfig the system clock */
132 system_clock_config();
133
134 /* get system clock */
135 crm_clocks_freq_get(&crm_clocks_freq_struct);
136
137 /* init at start board */
138 at32_board_init();
139
140 /* config priority group */
141 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
142
143 /* turn on the led light */
144 at32_led_on(LED2);
145 at32_led_on(LED3);
146 at32_led_on(LED4);
147
148 /* enable pwc and bpr clock */
149 crm_periph_clock_enable(CRM_PWC_PERIPH_CLOCK, TRUE);
150 crm_periph_clock_enable(CRM_BPR_PERIPH_CLOCK, TRUE);
151
152 /* config rtc */
153 rtc_config();
154
155 while(1)
156 {
157 /* clear second flag */
158 rtc_flag_clear(RTC_TS_FLAG);
159
160 /* wait for the second flag to be set */
161 while(rtc_flag_get(RTC_TS_FLAG) == RESET);
162
163 /* set the wakeup time to 3 seconds */
164 rtc_alarm_set(rtc_counter_get() + 3);
165
166 /* wait for the register write to complete */
167 rtc_wait_config_finish();
168
169 at32_led_off(LED2);
170
171 /* save systick register configuration */
172 systick_index = SysTick->CTRL;
173 systick_index &= ~((uint32_t)0xFFFFFFFE);
174
175 /* disable systick */
176 SysTick->CTRL &= (uint32_t)0xFFFFFFFE;
177
178 /* enter deep sleep mode */
179 pwc_deep_sleep_mode_enter(PWC_DEEP_SLEEP_ENTER_WFI);
180
181 /* restore systick register configuration */
182 SysTick->CTRL |= systick_index;
183
184 at32_led_on(LED2);
185
186 /* wait 3 LICK(maximum 120us) cycles to ensure clock stable */
187 /* when wakeup from deepsleep,system clock source changes to HICK */
188 if((CRM->misc3_bit.hick_to_sclk == TRUE) && (CRM->misc1_bit.hickdiv == TRUE))
189 {
190 /* HICK is 48MHz */
191 delay_us(((120 * 6 * HICK_VALUE) /crm_clocks_freq_struct.sclk_freq) + 1);
192 }
193 else
194 {
195 /* HICK is 8MHz */
196 delay_us(((120 * HICK_VALUE) /crm_clocks_freq_struct.sclk_freq) + 1);
197 }
198
199 /* wake up from deep sleep mode, congfig the system clock */
200 system_clock_recover();
201
202 delay_ms(500);
203 }
204}
205
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
crm_clocks_freq_struct
crm_clocks_freq_type crm_clocks_freq_struct
Definition project/at_start_f413/examples/debug/tmr1/src/main.c:38
rtc_config
void rtc_config(void)
rtc configuration.
Definition project/at_start_f413/examples/pwc/deepsleep_rtc/src/main.c:44
main
int main(void)
main function.
Definition project/at_start_f413/examples/pwc/deepsleep_rtc/src/main.c:126
system_clock_recover
void system_clock_recover(void)
systemclock recover.
Definition project/at_start_f413/examples/pwc/deepsleep_rtc/src/main.c:97
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_led_off
void at32_led_off(led_type led)
turns selected led off.
Definition at32f413_board.c:287
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
delay_us
void delay_us(uint32_t nus)
inserts a delay time.
Definition at32f413_board.c:330
bpr_reset
void bpr_reset(void)
bpr reset by crm reset register
Definition at32f413_bpr.c:48
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_rtc_clock_select
void crm_rtc_clock_select(crm_rtc_clock_type value)
select rtc clock
Definition at32f413_crm.c:433
crm_rtc_clock_enable
void crm_rtc_clock_enable(confirm_state new_state)
enable or disable rtc
Definition at32f413_crm.c:443
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
crm_clocks_freq_get
void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
Definition at32f413_crm.c:660
CRM_PWC_PERIPH_CLOCK
@ CRM_PWC_PERIPH_CLOCK
Definition at32f413_crm.h:140
CRM_BPR_PERIPH_CLOCK
@ CRM_BPR_PERIPH_CLOCK
Definition at32f413_crm.h:139
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_LICK
@ CRM_CLOCK_SOURCE_LICK
Definition at32f413_crm.h:297
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_RTC_CLOCK_LICK
@ CRM_RTC_CLOCK_LICK
Definition at32f413_crm.h:374
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_LICK_STABLE_FLAG
#define CRM_LICK_STABLE_FLAG
Definition at32f413_crm.h:58
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
CRM
#define CRM
Definition at32f413_crm.h:843
RTCAlarm_IRQn
@ RTCAlarm_IRQn
Definition at32f413.h:213
exint_init
void exint_init(exint_init_type *exint_struct)
exint init
Definition at32f413_exint.c:77
EXINT_LINE_INTERRUPT
@ EXINT_LINE_INTERRUPT
Definition at32f413_exint.h:84
EXINT_TRIGGER_RISING_EDGE
@ EXINT_TRIGGER_RISING_EDGE
Definition at32f413_exint.h:93
EXINT_LINE_17
#define EXINT_LINE_17
Definition at32f413_exint.h:68
ERROR
@ ERROR
Definition at32f413.h:302
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
pwc_battery_powered_domain_access
void pwc_battery_powered_domain_access(confirm_state new_state)
enable or disable access to the battery powered domain.
Definition at32f413_pwc.c:60
pwc_deep_sleep_mode_enter
void pwc_deep_sleep_mode_enter(pwc_deep_sleep_enter_type pwc_deep_sleep_enter)
enter pwc deep-sleep mode
Definition at32f413_pwc.c:188
PWC_DEEP_SLEEP_ENTER_WFI
@ PWC_DEEP_SLEEP_ENTER_WFI
Definition at32f413_pwc.h:96
rtc_alarm_set
void rtc_alarm_set(uint32_t alarm_value)
rtc alarm value set
Definition at32f413_rtc.c:136
rtc_wait_config_finish
void rtc_wait_config_finish(void)
rtc wait configuration finish
Definition at32f413_rtc.c:243
rtc_flag_get
flag_status rtc_flag_get(uint16_t flag)
rtc flag get
Definition at32f413_rtc.c:182
rtc_counter_get
uint32_t rtc_counter_get(void)
rtc counter get
Definition at32f413_rtc.c:81
rtc_wait_update_finish
void rtc_wait_update_finish(void)
rtc wait update finish
Definition at32f413_rtc.c:253
rtc_interrupt_enable
void rtc_interrupt_enable(uint16_t source, confirm_state new_state)
rtc interrupt enable
Definition at32f413_rtc.c:159
rtc_flag_clear
void rtc_flag_clear(uint16_t flag)
rtc flag clear
Definition at32f413_rtc.c:233
rtc_divider_set
void rtc_divider_set(uint32_t div_value)
rtc divider set
Definition at32f413_rtc.c:103
RTC_TS_FLAG
#define RTC_TS_FLAG
Definition at32f413_rtc.h:64
RTC_TA_INT
#define RTC_TA_INT
Definition at32f413_rtc.h:52
HICK_VALUE
#define HICK_VALUE
Definition project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h:51
at32f413_clock.h
header file of clock program
crm_clocks_freq_type
crm clocks freqency structure
Definition at32f413_crm.h:470
crm_clocks_freq_type::sclk_freq
uint32_t sclk_freq
Definition at32f413_crm.h:471
exint_init_type
exint init type
Definition at32f413_exint.h:102
exint_init_type::line_select
uint32_t line_select
Definition at32f413_exint.h:104
exint_init_type::line_enable
confirm_state line_enable
Definition at32f413_exint.h:106
exint_init_type::line_mode
exint_line_mode_type line_mode
Definition at32f413_exint.h:103
exint_init_type::line_polarity
exint_polarity_config_type line_polarity
Definition at32f413_exint.h:105


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • pwc
  • power_voltage_monitor
  • inc
project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • pwc
  • power_voltage_monitor
  • inc
project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • pwc
  • power_voltage_monitor
  • inc
project/at_start_f413/examples/pwc/power_voltage_monitor/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • pwc
  • power_voltage_monitor
  • src
project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • pwc
  • power_voltage_monitor
  • src
project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28#include "at32f413_board.h"
29
30
45void NMI_Handler(void)
46{
47}
48
54void HardFault_Handler(void)
55{
56 /* go to infinite loop when hard fault exception occurs */
57 while(1)
58 {
59 }
60}
61
67void MemManage_Handler(void)
68{
69 /* go to infinite loop when memory manage exception occurs */
70 while(1)
71 {
72 }
73}
74
80void BusFault_Handler(void)
81{
82 /* go to infinite loop when bus fault exception occurs */
83 while(1)
84 {
85 }
86}
87
93void UsageFault_Handler(void)
94{
95 /* go to infinite loop when usage fault exception occurs */
96 while(1)
97 {
98 }
99}
100
106void SVC_Handler(void)
107{
108}
109
115void DebugMon_Handler(void)
116{
117}
118
124void PendSV_Handler(void)
125{
126}
127
133void SysTick_Handler(void)
134{
135}
136
142void PVM_IRQHandler(void)
143{
144 if(exint_interrupt_flag_get(EXINT_LINE_16) != RESET)
145 {
146 /* clear exint line flag */
147 exint_flag_clear(EXINT_LINE_16);
148
149 /* toggle led */
150 at32_led_toggle(LED2);
151 at32_led_toggle(LED3);
152 at32_led_toggle(LED4);
153 }
154}
155
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_int.c:93
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_int.c:54
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_int.c:67
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_int.c:106
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_int.c:124
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_int.c:45
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_int.c:80
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_int.c:133
PVM_IRQHandler
void PVM_IRQHandler(void)
this function handles the power voltage monitoring output interrupt request.
Definition project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_int.c:142
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/pwc/power_voltage_monitor/src/at32f413_int.c:115
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
exint_flag_clear
void exint_flag_clear(uint32_t exint_line)
clear exint flag
Definition at32f413_exint.c:125
exint_interrupt_flag_get
flag_status exint_interrupt_flag_get(uint32_t exint_line)
get exint interrupt flag
Definition at32f413_exint.c:168
EXINT_LINE_16
#define EXINT_LINE_16
Definition at32f413_exint.h:67
RESET
@ RESET
Definition at32f413.h:292
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • pwc
  • power_voltage_monitor
  • src
project/at_start_f413/examples/pwc/power_voltage_monitor/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
29
44void pvm_exint_config(void)
45{
46 exint_init_type exint_init_struct;
47
48 /* config the exint line of the power voltage monitor */
49 exint_init_struct.line_select = EXINT_LINE_16;
50 exint_init_struct.line_enable = TRUE;
51 exint_init_struct.line_mode = EXINT_LINE_INTERRUPT;
52 exint_init_struct.line_polarity = EXINT_TRIGGER_BOTH_EDGE;
53 exint_init(&exint_init_struct);
54}
55
61int main(void)
62{
63 __IO uint32_t index = 0;
64
65 /* congfig the system clock */
66 system_clock_config();
67
68 /* init at start board */
69 at32_board_init();
70
71 /* config priority group */
72 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
73
74 /* turn on the led light */
75 at32_led_on(LED2);
76 at32_led_on(LED3);
77 at32_led_on(LED4);
78
79 /* enable pwc clock */
80 crm_periph_clock_enable(CRM_PWC_PERIPH_CLOCK, TRUE);
81
82 /* set the threshold voltage to 2.9v */
83 pwc_pvm_level_select(PWC_PVM_VOLTAGE_2V9);
84
85 /* enable power voltage monitor */
86 pwc_power_voltage_monitor_enable(TRUE);
87
88 /* config the exint line of the power voltage monitor */
89 pvm_exint_config();
90
91 /* when power voltage monitor enable,exint line16 flag will be set */
92 while(exint_flag_get(EXINT_LINE_16) == RESET);
93
94 /* clear the unexpected exint line flag */
95 exint_flag_clear(EXINT_LINE_16);
96
97 /* clear the unexpected nvic pending flag */
98 NVIC_ClearPendingIRQ(PVM_IRQn);
99
100 /* enable power voltage monitor interrupt */
101 nvic_irq_enable(PVM_IRQn, 0, 0);
102
103 while(1)
104 {
105 }
106}
107
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
pvm_exint_config
void pvm_exint_config(void)
power voltage monitor exint configuration.
Definition project/at_start_f413/examples/pwc/power_voltage_monitor/src/main.c:44
main
int main(void)
main function.
Definition project/at_start_f413/examples/pwc/power_voltage_monitor/src/main.c:61
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_PWC_PERIPH_CLOCK
@ CRM_PWC_PERIPH_CLOCK
Definition at32f413_crm.h:140
PVM_IRQn
@ PVM_IRQn
Definition at32f413.h:172
exint_flag_get
flag_status exint_flag_get(uint32_t exint_line)
get exint flag
Definition at32f413_exint.c:141
exint_flag_clear
void exint_flag_clear(uint32_t exint_line)
clear exint flag
Definition at32f413_exint.c:125
exint_init
void exint_init(exint_init_type *exint_struct)
exint init
Definition at32f413_exint.c:77
EXINT_LINE_INTERRUPT
@ EXINT_LINE_INTERRUPT
Definition at32f413_exint.h:84
EXINT_TRIGGER_BOTH_EDGE
@ EXINT_TRIGGER_BOTH_EDGE
Definition at32f413_exint.h:95
EXINT_LINE_16
#define EXINT_LINE_16
Definition at32f413_exint.h:67
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
pwc_power_voltage_monitor_enable
void pwc_power_voltage_monitor_enable(confirm_state new_state)
enable or disable pwc power voltage monitor (pvm)
Definition at32f413_pwc.c:89
pwc_pvm_level_select
void pwc_pvm_level_select(pwc_pvm_voltage_type pvm_voltage)
select the voltage threshold detected by the power voltage detector.
Definition at32f413_pwc.c:78
PWC_PVM_VOLTAGE_2V9
@ PWC_PVM_VOLTAGE_2V9
Definition at32f413_pwc.h:79
at32f413_clock.h
header file of clock program
exint_init_type
exint init type
Definition at32f413_exint.h:102
exint_init_type::line_select
uint32_t line_select
Definition at32f413_exint.h:104
exint_init_type::line_enable
confirm_state line_enable
Definition at32f413_exint.h:106
exint_init_type::line_mode
exint_line_mode_type line_mode
Definition at32f413_exint.h:103
exint_init_type::line_polarity
exint_polarity_config_type line_polarity
Definition at32f413_exint.h:105


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • pwc
  • sleep_tmr2
  • inc
project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • pwc
  • sleep_tmr2
  • inc
project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • pwc
  • sleep_tmr2
  • inc
project/at_start_f413/examples/pwc/sleep_tmr2/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • pwc
  • sleep_tmr2
  • src
project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • pwc
  • sleep_tmr2
  • src
project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28#include "at32f413_board.h"
29
44void NMI_Handler(void)
45{
46}
47
53void HardFault_Handler(void)
54{
55 /* go to infinite loop when hard fault exception occurs */
56 while(1)
57 {
58 }
59}
60
66void MemManage_Handler(void)
67{
68 /* go to infinite loop when memory manage exception occurs */
69 while(1)
70 {
71 }
72}
73
79void BusFault_Handler(void)
80{
81 /* go to infinite loop when bus fault exception occurs */
82 while(1)
83 {
84 }
85}
86
92void UsageFault_Handler(void)
93{
94 /* go to infinite loop when usage fault exception occurs */
95 while(1)
96 {
97 }
98}
99
105void SVC_Handler(void)
106{
107}
108
114void DebugMon_Handler(void)
115{
116}
117
123void PendSV_Handler(void)
124{
125}
126
132void SysTick_Handler(void)
133{
134}
135
141void TMR2_GLOBAL_IRQHandler(void)
142{
143 if(tmr_interrupt_flag_get(TMR2, TMR_OVF_FLAG) != RESET)
144 {
145 /* clear timer 2 ovf flag */
146 tmr_flag_clear(TMR2, TMR_OVF_FLAG);
147
148 /* toggle led */
149 at32_led_toggle(LED4);
150 }
151}
152
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_int.c:92
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_int.c:53
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_int.c:66
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_int.c:105
TMR2_GLOBAL_IRQHandler
void TMR2_GLOBAL_IRQHandler(void)
this function handles the timer interrupt request.
Definition project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_int.c:141
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_int.c:123
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_int.c:44
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_int.c:79
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_int.c:132
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/pwc/sleep_tmr2/src/at32f413_int.c:114
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
RESET
@ RESET
Definition at32f413.h:292
tmr_flag_clear
void tmr_flag_clear(tmr_type *tmr_x, uint32_t tmr_flag)
clear tmr flag
Definition at32f413_tmr.c:1433
tmr_interrupt_flag_get
flag_status tmr_interrupt_flag_get(tmr_type *tmr_x, uint32_t tmr_flag)
get tmr interrupt flag
Definition at32f413_tmr.c:1357
TMR_OVF_FLAG
#define TMR_OVF_FLAG
Definition at32f413_tmr.h:51
TMR2
#define TMR2
Definition at32f413_tmr.h:832
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • pwc
  • sleep_tmr2
  • src
project/at_start_f413/examples/pwc/sleep_tmr2/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
29
44void tmr2_config(void)
45{
46 crm_clocks_freq_type crm_clocks_freq_struct = {0};
47
48 /* enable tmr 2 clock */
49 crm_periph_clock_enable(CRM_TMR2_PERIPH_CLOCK, TRUE);
50
51 /* get system clock */
52 crm_clocks_freq_get(&crm_clocks_freq_struct);
53
54 /* (systemclock/(systemclock/10000))/10000 = 1Hz(1s) */
55 tmr_base_init(TMR2, 9999, (crm_clocks_freq_struct.sclk_freq/10000 - 1));
56
57 /* config the counting direction */
58 tmr_cnt_dir_set(TMR2, TMR_COUNT_UP);
59
60 /* config the clock divider value */
61 tmr_clock_source_div_set(TMR2, TMR_CLOCK_DIV1);
62
63 /* enable tmr 2 interrupt */
64 tmr_interrupt_enable(TMR2, TMR_OVF_INT, TRUE);
65
66 /* config tmr 2 nvic */
67 nvic_irq_enable(TMR2_GLOBAL_IRQn, 0, 0);
68
69 /* enable tmr 2 */
70 tmr_counter_enable(TMR2, TRUE);
71}
72
78int main(void)
79{
80 __IO uint32_t index = 0;
81 __IO uint32_t systick_index = 0;
82
83 /* congfig the system clock */
84 system_clock_config();
85
86 /* init at start board */
87 at32_board_init();
88
89 /* config priority group */
90 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
91
92 /* turn on the led light */
93 at32_led_on(LED2);
94 at32_led_on(LED3);
95 at32_led_on(LED4);
96
97 /* enable pwc clock */
98 crm_periph_clock_enable(CRM_PWC_PERIPH_CLOCK, TRUE);
99
100 /* config tmr 2 */
101 tmr2_config();
102
103 while(1)
104 {
105 at32_led_off(LED2);
106
107 /* save systick register configuration */
108 systick_index = SysTick->CTRL;
109 systick_index &= ~((uint32_t)0xFFFFFFFE);
110
111 /* disable systick */
112 SysTick->CTRL &= (uint32_t)0xFFFFFFFE;
113
114 /* enter sleep mode */
115 pwc_sleep_mode_enter(PWC_SLEEP_ENTER_WFI);
116
117 /* restore systick register configuration */
118 SysTick->CTRL |= systick_index;
119
120 /* wake up from sleep mode */
121 at32_led_on(LED2);
122 delay_ms(500);
123 }
124}
125
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
crm_clocks_freq_struct
crm_clocks_freq_type crm_clocks_freq_struct
Definition project/at_start_f413/examples/debug/tmr1/src/main.c:38
tmr2_config
void tmr2_config(void)
tmr2 configuration.
Definition project/at_start_f413/examples/pwc/sleep_tmr2/src/main.c:44
main
int main(void)
main function.
Definition project/at_start_f413/examples/pwc/sleep_tmr2/src/main.c:78
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_led_off
void at32_led_off(led_type led)
turns selected led off.
Definition at32f413_board.c:287
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_clocks_freq_get
void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
Definition at32f413_crm.c:660
CRM_PWC_PERIPH_CLOCK
@ CRM_PWC_PERIPH_CLOCK
Definition at32f413_crm.h:140
CRM_TMR2_PERIPH_CLOCK
@ CRM_TMR2_PERIPH_CLOCK
Definition at32f413_crm.h:125
TMR2_GLOBAL_IRQn
@ TMR2_GLOBAL_IRQn
Definition at32f413.h:200
TRUE
@ TRUE
Definition at32f413.h:297
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
pwc_sleep_mode_enter
void pwc_sleep_mode_enter(pwc_sleep_enter_type pwc_sleep_enter)
enter pwc sleep mode
Definition at32f413_pwc.c:165
PWC_SLEEP_ENTER_WFI
@ PWC_SLEEP_ENTER_WFI
Definition at32f413_pwc.h:87
tmr_counter_enable
void tmr_counter_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr counter
Definition at32f413_tmr.c:114
tmr_clock_source_div_set
void tmr_clock_source_div_set(tmr_type *tmr_x, tmr_clock_division_type tmr_clock_div)
set tmr clock source division
Definition at32f413_tmr.c:204
tmr_base_init
void tmr_base_init(tmr_type *tmr_x, uint32_t tmr_pr, uint32_t tmr_div)
init tmr base
Definition at32f413_tmr.c:179
tmr_interrupt_enable
void tmr_interrupt_enable(tmr_type *tmr_x, uint32_t tmr_interrupt, confirm_state new_state)
enable or disable tmr interrupt
Definition at32f413_tmr.c:1327
tmr_cnt_dir_set
void tmr_cnt_dir_set(tmr_type *tmr_x, tmr_count_mode_type tmr_cnt_dir)
set tmr counter count direction
Definition at32f413_tmr.c:225
TMR_COUNT_UP
@ TMR_COUNT_UP
Definition at32f413_tmr.h:105
TMR_CLOCK_DIV1
@ TMR_CLOCK_DIV1
Definition at32f413_tmr.h:95
TMR_OVF_INT
#define TMR_OVF_INT
Definition at32f413_tmr.h:73
TMR2
#define TMR2
Definition at32f413_tmr.h:832
at32f413_clock.h
header file of clock program
crm_clocks_freq_type
crm clocks freqency structure
Definition at32f413_crm.h:470
crm_clocks_freq_type::sclk_freq
uint32_t sclk_freq
Definition at32f413_crm.h:471


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • pwc
  • sleep_usart1
  • inc
project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • pwc
  • sleep_usart1
  • inc
project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • pwc
  • sleep_usart1
  • inc
project/at_start_f413/examples/pwc/sleep_usart1/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • pwc
  • sleep_usart1
  • src
project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • pwc
  • sleep_usart1
  • src
project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28#include "at32f413_board.h"
29
30
40uint16_t usart1_index = 0;
46void NMI_Handler(void)
47{
48}
49
55void HardFault_Handler(void)
56{
57 /* go to infinite loop when hard fault exception occurs */
58 while(1)
59 {
60 }
61}
62
68void MemManage_Handler(void)
69{
70 /* go to infinite loop when memory manage exception occurs */
71 while(1)
72 {
73 }
74}
75
81void BusFault_Handler(void)
82{
83 /* go to infinite loop when bus fault exception occurs */
84 while(1)
85 {
86 }
87}
88
94void UsageFault_Handler(void)
95{
96 /* go to infinite loop when usage fault exception occurs */
97 while(1)
98 {
99 }
100}
101
107void SVC_Handler(void)
108{
109}
110
116void DebugMon_Handler(void)
117{
118}
119
125void PendSV_Handler(void)
126{
127}
128
134void SysTick_Handler(void)
135{
136}
137
143void USART1_IRQHandler(void)
144{
145 if(usart_interrupt_flag_get(USART1, USART_RDBF_FLAG) != RESET)
146 {
147 /* clear rdbf flag */
148 usart1_index = usart_data_receive(USART1);
149
150 /* toggle led */
151 at32_led_toggle(LED4);
152 }
153}
154
155
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c:94
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c:55
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c:68
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c:107
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c:125
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c:46
USART1_IRQHandler
void USART1_IRQHandler(void)
this function handles the usatt interrupt request.
Definition project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c:143
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c:81
usart1_index
uint16_t usart1_index
Definition project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c:40
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c:134
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/pwc/sleep_usart1/src/at32f413_int.c:116
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
RESET
@ RESET
Definition at32f413.h:292
usart_data_receive
uint16_t usart_data_receive(usart_type *usart_x)
return the most recent received data by the usart peripheral.
Definition at32f413_usart.c:392
usart_interrupt_flag_get
flag_status usart_interrupt_flag_get(usart_type *usart_x, uint32_t flag)
check whether the specified usart interrupt flag is set or not.
Definition at32f413_usart.c:596
USART_RDBF_FLAG
#define USART_RDBF_FLAG
Definition at32f413_usart.h:56
USART1
#define USART1
Definition at32f413_usart.h:318
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • pwc
  • sleep_usart1
  • src
project/at_start_f413/examples/pwc/sleep_usart1/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
42void usart1_config(uint32_t baudrate)
43{
44 gpio_init_type gpio_init_struct;
45
46 /* enable the uart1 and gpio clock */
47 crm_periph_clock_enable(CRM_USART1_PERIPH_CLOCK, TRUE);
48 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
49
50 gpio_default_para_init(&gpio_init_struct);
51
52 /* configure the uart1 tx pin */
53 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
54 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
55 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
56 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
57 gpio_init_struct.gpio_pins = GPIO_PINS_9;
58 gpio_init(GPIOA, &gpio_init_struct);
59
60 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
61 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
62 gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
63 gpio_init_struct.gpio_pull = GPIO_PULL_UP;
64 gpio_init_struct.gpio_pins = GPIO_PINS_10;
65 gpio_init(GPIOA, &gpio_init_struct);
66
67 /* configure uart param */
68 nvic_irq_enable(USART1_IRQn, 0, 0);
69
70 usart_init(USART1, baudrate, USART_DATA_8BITS, USART_STOP_1_BIT);
71 usart_parity_selection_config(USART1, USART_PARITY_NONE);
72 usart_transmitter_enable(USART1, TRUE);
73 usart_receiver_enable(USART1, TRUE);
74 usart_hardware_flow_control_set(USART1,USART_HARDWARE_FLOW_NONE);
75 usart_interrupt_enable(USART1, USART_RDBF_INT, TRUE);
76 usart_enable(USART1, TRUE);
77}
78
84int main(void)
85{
86 __IO uint32_t index = 0;
87 __IO uint32_t systick_index = 0;
88
89 /* congfig the system clock */
90 system_clock_config();
91
92 /* init at start board */
93 at32_board_init();
94
95 /* config priority group */
96 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
97
98 /* turn on the led light */
99 at32_led_on(LED2);
100 at32_led_on(LED3);
101 at32_led_on(LED4);
102
103 /* enable pwc clock */
104 crm_periph_clock_enable(CRM_PWC_PERIPH_CLOCK, TRUE);
105
106 /* config usart1 */
107 usart1_config(115200);
108
109 printf("exit sleep mode by usart1 rdbf interrupt \r\n");
110
111 while(1)
112 {
113 at32_led_off(LED2);
114 at32_led_off(LED3);
115 printf("now enter sleep mode \r\n");
116
117 /* save systick register configuration */
118 systick_index = SysTick->CTRL;
119 systick_index &= ~((uint32_t)0xFFFFFFFE);
120
121 /* disable systick */
122 SysTick->CTRL &= (uint32_t)0xFFFFFFFE;
123
124 /* enter sleep mode */
125 pwc_sleep_mode_enter(PWC_SLEEP_ENTER_WFI);
126
127 /* restore systick register configuration */
128 SysTick->CTRL |= systick_index;
129
130 /* wake up from sleep mode */
131 printf("now exit sleep mode by usart1 rdbf interrupt \r\n");
132
133 at32_led_on(LED2);
134 delay_ms(500);
135 }
136}
137
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
main
int main(void)
main function.
Definition project/at_start_f413/examples/pwc/sleep_usart1/src/main.c:84
usart1_config
void usart1_config(uint32_t baudrate)
usart1 configuration.
Definition project/at_start_f413/examples/pwc/sleep_usart1/src/main.c:42
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_led_off
void at32_led_off(led_type led)
turns selected led off.
Definition at32f413_board.c:287
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_PWC_PERIPH_CLOCK
@ CRM_PWC_PERIPH_CLOCK
Definition at32f413_crm.h:140
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_USART1_PERIPH_CLOCK
@ CRM_USART1_PERIPH_CLOCK
Definition at32f413_crm.h:119
USART1_IRQn
@ USART1_IRQn
Definition at32f413.h:209
TRUE
@ TRUE
Definition at32f413.h:297
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_PULL_UP
@ GPIO_PULL_UP
Definition at32f413_gpio.h:244
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_10
#define GPIO_PINS_10
Definition at32f413_gpio.h:60
GPIO_PINS_9
#define GPIO_PINS_9
Definition at32f413_gpio.h:59
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
pwc_sleep_mode_enter
void pwc_sleep_mode_enter(pwc_sleep_enter_type pwc_sleep_enter)
enter pwc sleep mode
Definition at32f413_pwc.c:165
PWC_SLEEP_ENTER_WFI
@ PWC_SLEEP_ENTER_WFI
Definition at32f413_pwc.h:87
usart_parity_selection_config
void usart_parity_selection_config(usart_type *usart_x, usart_parity_selection_type parity)
usart parity selection config.
Definition at32f413_usart.c:144
usart_transmitter_enable
void usart_transmitter_enable(usart_type *usart_x, confirm_state new_state)
usart transmitter enable.
Definition at32f413_usart.c:185
usart_init
void usart_init(usart_type *usart_x, uint32_t baud_rate, usart_data_bit_num_type data_bit, usart_stop_bit_num_type stop_bit)
initialize the usart peripheral according to the specified parameters.
Definition at32f413_usart.c:105
usart_enable
void usart_enable(usart_type *usart_x, confirm_state new_state)
enable or disable the specified usart peripheral.
Definition at32f413_usart.c:172
usart_receiver_enable
void usart_receiver_enable(usart_type *usart_x, confirm_state new_state)
usart receiver enable.
Definition at32f413_usart.c:198
usart_hardware_flow_control_set
void usart_hardware_flow_control_set(usart_type *usart_x, usart_hardware_flow_control_type flow_state)
configure the usart's hardware flow control.
Definition at32f413_usart.c:522
usart_interrupt_enable
void usart_interrupt_enable(usart_type *usart_x, uint32_t usart_int, confirm_state new_state)
enable or disable the specified usart interrupts.
Definition at32f413_usart.c:263
USART_HARDWARE_FLOW_NONE
@ USART_HARDWARE_FLOW_NONE
Definition at32f413_usart.h:168
USART_STOP_1_BIT
@ USART_STOP_1_BIT
Definition at32f413_usart.h:157
USART_DATA_8BITS
@ USART_DATA_8BITS
Definition at32f413_usart.h:112
USART_PARITY_NONE
@ USART_PARITY_NONE
Definition at32f413_usart.h:93
USART_RDBF_INT
#define USART_RDBF_INT
Definition at32f413_usart.h:72
USART1
#define USART1
Definition at32f413_usart.h:318
at32f413_clock.h
header file of clock program
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • pwc
  • standby_rtc
  • inc
project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • pwc
  • standby_rtc
  • inc
project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • pwc
  • standby_rtc
  • inc
project/at_start_f413/examples/pwc/standby_rtc/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • pwc
  • standby_rtc
  • src
project/at_start_f413/examples/pwc/standby_rtc/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/pwc/standby_rtc/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • pwc
  • standby_rtc
  • src
project/at_start_f413/examples/pwc/standby_rtc/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28#include "at32f413_board.h"
29
30
45void NMI_Handler(void)
46{
47}
48
54void HardFault_Handler(void)
55{
56 /* go to infinite loop when hard fault exception occurs */
57 while(1)
58 {
59 }
60}
61
67void MemManage_Handler(void)
68{
69 /* go to infinite loop when memory manage exception occurs */
70 while(1)
71 {
72 }
73}
74
80void BusFault_Handler(void)
81{
82 /* go to infinite loop when bus fault exception occurs */
83 while(1)
84 {
85 }
86}
87
93void UsageFault_Handler(void)
94{
95 /* go to infinite loop when usage fault exception occurs */
96 while(1)
97 {
98 }
99}
100
106void SVC_Handler(void)
107{
108}
109
115void DebugMon_Handler(void)
116{
117}
118
124void PendSV_Handler(void)
125{
126}
127
133void SysTick_Handler(void)
134{
135}
136
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/pwc/standby_rtc/src/at32f413_int.c:93
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/pwc/standby_rtc/src/at32f413_int.c:54
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/pwc/standby_rtc/src/at32f413_int.c:67
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/pwc/standby_rtc/src/at32f413_int.c:106
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/pwc/standby_rtc/src/at32f413_int.c:124
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/pwc/standby_rtc/src/at32f413_int.c:45
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/pwc/standby_rtc/src/at32f413_int.c:80
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/pwc/standby_rtc/src/at32f413_int.c:133
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/pwc/standby_rtc/src/at32f413_int.c:115
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • pwc
  • standby_rtc
  • src
project/at_start_f413/examples/pwc/standby_rtc/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include <stdio.h>
29
30
45void rtc_config(void)
46{
47 /* enable the battery-powered domain write operations */
48 pwc_battery_powered_domain_access(TRUE);
49
50 /* reset battery-powered domain register */
51 bpr_reset();
52
53 /* enable the lick */
54 crm_clock_source_enable(CRM_CLOCK_SOURCE_LICK, TRUE);
55
56 /* wait lick is ready */
57 while(crm_flag_get(CRM_LICK_STABLE_FLAG) == RESET);
58
59 /* select the rtc clock source */
60 crm_rtc_clock_select(CRM_RTC_CLOCK_LICK);
61
62 /* enable rtc clock */
63 crm_rtc_clock_enable(TRUE);
64
65 /* wait for rtc registers update */
66 rtc_wait_update_finish();
67
68 /* set rtc divider: set rtc period to 1sec */
69 rtc_divider_set(32767);
70
71 /* wait for the register write to complete */
72 rtc_wait_config_finish();
73}
74
80void rtc_alarm_config(uint8_t alarm_time)
81{
82 /* clear second flag */
83 rtc_flag_clear(RTC_TS_FLAG);
84
85 /* wait for the second flag to be set */
86 while(rtc_flag_get(RTC_TS_FLAG) == RESET);
87
88 /* config the wakeup time */
89 rtc_alarm_set(rtc_counter_get() + alarm_time);
90
91 /* wait for the register write to complete */
92 rtc_wait_config_finish();
93}
94
100int main(void)
101{
102 __IO uint32_t index = 0;
103
104 /* congfig the system clock */
105 system_clock_config();
106
107 /* init at start board */
108 at32_board_init();
109
110 /* config priority group */
111 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
112
113 /* turn on the led light */
114 at32_led_off(LED2);
115 at32_led_off(LED3);
116 at32_led_off(LED4);
117
118 /* enable pwc and bpr clock */
119 crm_periph_clock_enable(CRM_PWC_PERIPH_CLOCK, TRUE);
120 crm_periph_clock_enable(CRM_BPR_PERIPH_CLOCK, TRUE);
121
122 if(pwc_flag_get(PWC_STANDBY_FLAG) != RESET)
123 {
124 /* wakeup from standby */
125 pwc_flag_clear(PWC_STANDBY_FLAG);
126 at32_led_on(LED2);
127 }
128
129 if(pwc_flag_get(PWC_WAKEUP_FLAG) != RESET)
130 {
131 /* wakeup event occurs */
132 pwc_flag_clear(PWC_WAKEUP_FLAG);
133 at32_led_on(LED3);
134 }
135
136 /* config rtc */
137 rtc_config();
138
139 at32_led_on(LED4);
140
141 delay_ms(1000);
142
143 /* set the wakeup time to 10 seconds */
144 rtc_alarm_config(10);
145
146 /* enter standby mode */
147 pwc_standby_mode_enter();
148
149 while(1)
150 {
151 }
152}
153
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
rtc_config
void rtc_config(void)
rtc configuration.
Definition project/at_start_f413/examples/pwc/standby_rtc/src/main.c:45
main
int main(void)
main function.
Definition project/at_start_f413/examples/pwc/standby_rtc/src/main.c:100
rtc_alarm_config
void rtc_alarm_config(uint8_t alarm_time)
rtc alarm set.
Definition project/at_start_f413/examples/pwc/standby_rtc/src/main.c:80
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_led_off
void at32_led_off(led_type led)
turns selected led off.
Definition at32f413_board.c:287
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
bpr_reset
void bpr_reset(void)
bpr reset by crm reset register
Definition at32f413_bpr.c:48
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_rtc_clock_select
void crm_rtc_clock_select(crm_rtc_clock_type value)
select rtc clock
Definition at32f413_crm.c:433
crm_rtc_clock_enable
void crm_rtc_clock_enable(confirm_state new_state)
enable or disable rtc
Definition at32f413_crm.c:443
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_PWC_PERIPH_CLOCK
@ CRM_PWC_PERIPH_CLOCK
Definition at32f413_crm.h:140
CRM_BPR_PERIPH_CLOCK
@ CRM_BPR_PERIPH_CLOCK
Definition at32f413_crm.h:139
CRM_CLOCK_SOURCE_LICK
@ CRM_CLOCK_SOURCE_LICK
Definition at32f413_crm.h:297
CRM_RTC_CLOCK_LICK
@ CRM_RTC_CLOCK_LICK
Definition at32f413_crm.h:374
CRM_LICK_STABLE_FLAG
#define CRM_LICK_STABLE_FLAG
Definition at32f413_crm.h:58
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
pwc_battery_powered_domain_access
void pwc_battery_powered_domain_access(confirm_state new_state)
enable or disable access to the battery powered domain.
Definition at32f413_pwc.c:60
pwc_standby_mode_enter
void pwc_standby_mode_enter(void)
enter pwc standby mode
Definition at32f413_pwc.c:209
pwc_flag_get
flag_status pwc_flag_get(uint32_t pwc_flag)
get flag of pwc
Definition at32f413_pwc.c:143
pwc_flag_clear
void pwc_flag_clear(uint32_t pwc_flag)
clear flag of pwc
Definition at32f413_pwc.c:126
PWC_STANDBY_FLAG
#define PWC_STANDBY_FLAG
Definition at32f413_pwc.h:52
PWC_WAKEUP_FLAG
#define PWC_WAKEUP_FLAG
Definition at32f413_pwc.h:51
rtc_alarm_set
void rtc_alarm_set(uint32_t alarm_value)
rtc alarm value set
Definition at32f413_rtc.c:136
rtc_wait_config_finish
void rtc_wait_config_finish(void)
rtc wait configuration finish
Definition at32f413_rtc.c:243
rtc_flag_get
flag_status rtc_flag_get(uint16_t flag)
rtc flag get
Definition at32f413_rtc.c:182
rtc_counter_get
uint32_t rtc_counter_get(void)
rtc counter get
Definition at32f413_rtc.c:81
rtc_wait_update_finish
void rtc_wait_update_finish(void)
rtc wait update finish
Definition at32f413_rtc.c:253
rtc_flag_clear
void rtc_flag_clear(uint16_t flag)
rtc flag clear
Definition at32f413_rtc.c:233
rtc_divider_set
void rtc_divider_set(uint32_t div_value)
rtc divider set
Definition at32f413_rtc.c:103
RTC_TS_FLAG
#define RTC_TS_FLAG
Definition at32f413_rtc.h:64
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • pwc
  • standby_wakeup_pin
  • inc
project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • pwc
  • standby_wakeup_pin
  • inc
project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • pwc
  • standby_wakeup_pin
  • inc
project/at_start_f413/examples/pwc/standby_wakeup_pin/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • pwc
  • standby_wakeup_pin
  • src
project/at_start_f413/examples/pwc/standby_wakeup_pin/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/pwc/standby_wakeup_pin/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • pwc
  • standby_wakeup_pin
  • src
project/at_start_f413/examples/pwc/standby_wakeup_pin/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28#include "at32f413_board.h"
29
43void NMI_Handler(void)
44{
45}
46
52void HardFault_Handler(void)
53{
54 /* go to infinite loop when hard fault exception occurs */
55 while(1)
56 {
57 }
58}
59
65void MemManage_Handler(void)
66{
67 /* go to infinite loop when memory manage exception occurs */
68 while(1)
69 {
70 }
71}
72
78void BusFault_Handler(void)
79{
80 /* go to infinite loop when bus fault exception occurs */
81 while(1)
82 {
83 }
84}
85
91void UsageFault_Handler(void)
92{
93 /* go to infinite loop when usage fault exception occurs */
94 while(1)
95 {
96 }
97}
98
104void SVC_Handler(void)
105{
106}
107
113void DebugMon_Handler(void)
114{
115}
116
122void PendSV_Handler(void)
123{
124}
125
131void SysTick_Handler(void)
132{
133}
134
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/pwc/standby_wakeup_pin/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/pwc/standby_wakeup_pin/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/pwc/standby_wakeup_pin/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/pwc/standby_wakeup_pin/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/pwc/standby_wakeup_pin/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/pwc/standby_wakeup_pin/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/pwc/standby_wakeup_pin/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/pwc/standby_wakeup_pin/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/pwc/standby_wakeup_pin/src/at32f413_int.c:113
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • pwc
  • standby_wakeup_pin
  • src
project/at_start_f413/examples/pwc/standby_wakeup_pin/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include <stdio.h>
29
43int main(void)
44{
45 __IO uint32_t index = 0;
46
47 /* congfig the system clock */
48 system_clock_config();
49
50 /* init at start board */
51 at32_board_init();
52
53 /* config priority group */
54 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
55
56 /* turn on the led light */
57 at32_led_off(LED2);
58 at32_led_off(LED3);
59 at32_led_off(LED4);
60
61 /* enable pwc clock */
62 crm_periph_clock_enable(CRM_PWC_PERIPH_CLOCK, TRUE);
63
64 if(pwc_flag_get(PWC_STANDBY_FLAG) != RESET)
65 {
66 /* wakeup from standby */
67 pwc_flag_clear(PWC_STANDBY_FLAG);
68 at32_led_on(LED2);
69 }
70
71 if(pwc_flag_get(PWC_WAKEUP_FLAG) != RESET)
72 {
73 /* wakeup event occurs */
74 pwc_flag_clear(PWC_WAKEUP_FLAG);
75 at32_led_on(LED3);
76 }
77
78 at32_led_on(LED4);
79
80 /*delay to check led status*/
81 delay_ms(1000);
82
83 /* enable wakeup pin */
84 pwc_wakeup_pin_enable(PWC_WAKEUP_PIN_1, TRUE);
85
86 /* enter standby mode */
87 pwc_standby_mode_enter();
88 while(1)
89 {
90 }
91}
92
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
main
int main(void)
main function.
Definition project/at_start_f413/examples/pwc/standby_wakeup_pin/src/main.c:43
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_led_off
void at32_led_off(led_type led)
turns selected led off.
Definition at32f413_board.c:287
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_PWC_PERIPH_CLOCK
@ CRM_PWC_PERIPH_CLOCK
Definition at32f413_crm.h:140
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
pwc_standby_mode_enter
void pwc_standby_mode_enter(void)
enter pwc standby mode
Definition at32f413_pwc.c:209
pwc_flag_get
flag_status pwc_flag_get(uint32_t pwc_flag)
get flag of pwc
Definition at32f413_pwc.c:143
pwc_flag_clear
void pwc_flag_clear(uint32_t pwc_flag)
clear flag of pwc
Definition at32f413_pwc.c:126
pwc_wakeup_pin_enable
void pwc_wakeup_pin_enable(uint32_t pin_num, confirm_state new_state)
enable or disable pwc standby wakeup pin
Definition at32f413_pwc.c:105
PWC_STANDBY_FLAG
#define PWC_STANDBY_FLAG
Definition at32f413_pwc.h:52
PWC_WAKEUP_FLAG
#define PWC_WAKEUP_FLAG
Definition at32f413_pwc.h:51
PWC_WAKEUP_PIN_1
#define PWC_WAKEUP_PIN_1
pwc wakeup pin num definition
Definition at32f413_pwc.h:62
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • rtc
  • calendar
  • inc
project/at_start_f413/examples/rtc/calendar/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • rtc
  • calendar
  • inc
project/at_start_f413/examples/rtc/calendar/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • rtc
  • calendar
  • inc
project/at_start_f413/examples/rtc/calendar/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • rtc
  • calendar
  • src
project/at_start_f413/examples/rtc/calendar/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/rtc/calendar/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • rtc
  • calendar
  • src
project/at_start_f413/examples/rtc/calendar/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28#include "at32f413_board.h"
29
43void NMI_Handler(void)
44{
45}
46
52void HardFault_Handler(void)
53{
54 /* go to infinite loop when hard fault exception occurs */
55 while(1)
56 {
57 }
58}
59
65void MemManage_Handler(void)
66{
67 /* go to infinite loop when memory manage exception occurs */
68 while(1)
69 {
70 }
71}
72
78void BusFault_Handler(void)
79{
80 /* go to infinite loop when bus fault exception occurs */
81 while(1)
82 {
83 }
84}
85
91void UsageFault_Handler(void)
92{
93 /* go to infinite loop when usage fault exception occurs */
94 while(1)
95 {
96 }
97}
98
104void SVC_Handler(void)
105{
106}
107
113void DebugMon_Handler(void)
114{
115}
116
122void PendSV_Handler(void)
123{
124}
125
131void SysTick_Handler(void)
132{
133}
134
135
141void RTC_IRQHandler(void)
142{
143 if(rtc_interrupt_flag_get(RTC_TA_FLAG) != RESET)
144 {
145 at32_led_toggle(LED4);
146
147 /* clear the rtc second flag */
148 rtc_flag_clear(RTC_TA_FLAG);
149 }
150}
151
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/rtc/calendar/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/rtc/calendar/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/rtc/calendar/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/rtc/calendar/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/rtc/calendar/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/rtc/calendar/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/rtc/calendar/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/rtc/calendar/src/at32f413_int.c:131
RTC_IRQHandler
void RTC_IRQHandler(void)
this function handles rtc handler.
Definition project/at_start_f413/examples/rtc/calendar/src/at32f413_int.c:141
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/rtc/calendar/src/at32f413_int.c:113
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
RESET
@ RESET
Definition at32f413.h:292
rtc_interrupt_flag_get
flag_status rtc_interrupt_flag_get(uint16_t flag)
rtc interrupt flag get
Definition at32f413_rtc.c:207
rtc_flag_clear
void rtc_flag_clear(uint16_t flag)
rtc flag clear
Definition at32f413_rtc.c:233
RTC_TA_FLAG
#define RTC_TA_FLAG
Definition at32f413_rtc.h:65
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • rtc
  • calendar
  • src
project/at_start_f413/examples/rtc/calendar/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include "rtc.h"
29
38char const weekday_table[7][10] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
39
45void alarm_init(void)
46{
47 calendar_type alarm_struct;
48
49 /* clear alarm flag */
50 rtc_flag_clear(RTC_TA_FLAG);
51
52 /* wait for the register write to complete */
53 rtc_wait_config_finish();
54
55 /* configure and enable rtc interrupt */
56 nvic_irq_enable(RTC_IRQn, 0, 0);
57
58 /* enable alarm interrupt */
59 rtc_interrupt_enable(RTC_TA_INT, TRUE);
60
61 /* wait for the register write to complete */
62 rtc_wait_config_finish();
63
64 /* config alarm */
65
66 alarm_struct.year = 2021;
67 alarm_struct.month = 5;
68 alarm_struct.date = 1;
69 alarm_struct.hour = 12;
70 alarm_struct.min = 0;
71 alarm_struct.sec = 5;
72
73 rtc_alarm_clock_set(&alarm_struct);
74}
75
81int main(void)
82{
83 calendar_type time_struct;
84
85 /* config nvic priority group */
86 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
87
88 system_clock_config();
89
90 at32_board_init();
91
92 uart_print_init(115200);
93
94 /* config calendar */
95 time_struct.year = 2021;
96 time_struct.month = 5;
97 time_struct.date = 1;
98 time_struct.hour = 12;
99 time_struct.min = 0;
100 time_struct.sec = 0;
101 rtc_init(&time_struct);
102
103 /* config alarm */
104 alarm_init();
105
106 printf("initial ok\r\n");
107
108 while(1)
109 {
110 if(rtc_flag_get(RTC_TS_FLAG) != RESET)
111 {
112 at32_led_toggle(LED3);
113
114 /* get time */
115 rtc_time_get();
116
117 /* print time */
118 printf("%d/%d/%d ", calendar.year, calendar.month, calendar.date);
119 printf("%02d:%02d:%02d %s\r\n", calendar.hour, calendar.min, calendar.sec, weekday_table[calendar.week]);
120
121 /* wait for the register write to complete */
122 rtc_wait_config_finish();
123
124 /* clear the rtc second flag */
125 rtc_flag_clear(RTC_TS_FLAG);
126
127 /* wait for the register write to complete */
128 rtc_wait_config_finish();
129 }
130 }
131}
132
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
calendar
calendar_type calendar
Definition rtc.c:36
main
int main(void)
main function.
Definition project/at_start_f413/examples/rtc/calendar/src/main.c:81
weekday_table
char const weekday_table[7][10]
Definition project/at_start_f413/examples/rtc/calendar/src/main.c:38
alarm_init
void alarm_init(void)
init alarm.
Definition project/at_start_f413/examples/rtc/calendar/src/main.c:45
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
LED3
@ LED3
Definition at32f413_board.h:63
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
uart_print_init
void uart_print_init(uint32_t baudrate)
initialize uart
Definition at32f413_board.c:129
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
RTC_IRQn
@ RTC_IRQn
Definition at32f413.h:174
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
rtc_time_get
void rtc_time_get(void)
get current time.
Definition rtc.c:308
rtc_init
uint8_t rtc_init(calendar_type *calendar)
rtc peripheral initialization.
Definition rtc.c:50
rtc_alarm_clock_set
uint8_t rtc_alarm_clock_set(calendar_type *calendar)
set rtc alarm clock. the time basic : 1970.1.1 legitimate year: 1970 ~ 2099
Definition rtc.c:216
rtc_wait_config_finish
void rtc_wait_config_finish(void)
rtc wait configuration finish
Definition at32f413_rtc.c:243
rtc_flag_get
flag_status rtc_flag_get(uint16_t flag)
rtc flag get
Definition at32f413_rtc.c:182
rtc_interrupt_enable
void rtc_interrupt_enable(uint16_t source, confirm_state new_state)
rtc interrupt enable
Definition at32f413_rtc.c:159
rtc_flag_clear
void rtc_flag_clear(uint16_t flag)
rtc flag clear
Definition at32f413_rtc.c:233
RTC_TA_FLAG
#define RTC_TA_FLAG
Definition at32f413_rtc.h:65
RTC_TS_FLAG
#define RTC_TS_FLAG
Definition at32f413_rtc.h:64
RTC_TA_INT
#define RTC_TA_INT
Definition at32f413_rtc.h:52
at32f413_clock.h
header file of clock program
rtc.h
this file provides template for calendar api.
calendar_type
Definition rtc.h:48
calendar_type::hour
__IO uint8_t hour
Definition rtc.h:52
calendar_type::month
__IO uint8_t month
Definition rtc.h:50
calendar_type::sec
__IO uint8_t sec
Definition rtc.h:54
calendar_type::week
__IO uint8_t week
Definition rtc.h:55
calendar_type::year
__IO uint16_t year
Definition rtc.h:49
calendar_type::min
__IO uint8_t min
Definition rtc.h:53
calendar_type::date
__IO uint8_t date
Definition rtc.h:51


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • rtc
  • lick_calibration
  • inc
project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • rtc
  • lick_calibration
  • inc
project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • rtc
  • lick_calibration
  • inc
project/at_start_f413/examples/rtc/lick_calibration/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • rtc
  • lick_calibration
  • src
project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • rtc
  • lick_calibration
  • src
project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28#include "at32f413_board.h"
29#include "stdio.h"
30
31extern uint32_t incrementvar_operationcomplete(void);
32extern uint32_t getvar_operationcomplete(void);
33extern void setvar_periodvalue(uint32_t Value);
34
35extern __IO uint32_t periodvalue;
36extern __IO uint32_t operationcomplete;
37
46uint16_t tmpCC4[2] = {0, 0};
47
53void NMI_Handler(void)
54{
55}
56
62void HardFault_Handler(void)
63{
64 /* go to infinite loop when hard fault exception occurs */
65 while(1)
66 {
67 }
68}
69
75void MemManage_Handler(void)
76{
77 /* go to infinite loop when memory manage exception occurs */
78 while(1)
79 {
80 }
81}
82
88void BusFault_Handler(void)
89{
90 /* go to infinite loop when bus fault exception occurs */
91 while(1)
92 {
93 }
94}
95
101void UsageFault_Handler(void)
102{
103 /* go to infinite loop when usage fault exception occurs */
104 while(1)
105 {
106 }
107}
108
114void SVC_Handler(void)
115{
116}
117
123void DebugMon_Handler(void)
124{
125}
126
132void PendSV_Handler(void)
133{
134}
135
141void SysTick_Handler(void)
142{
143}
144
150void RTC_IRQHandler(void)
151{
152 if(rtc_interrupt_flag_get(RTC_TS_FLAG) != RESET)
153 {
154 /* toggle led3 */
155 at32_led_toggle(LED3);
156
157 /* clear interrupt pending bit */
158 rtc_flag_clear(RTC_TS_FLAG);
159
160 printf("%d\r\n", rtc_counter_get());
161 }
162}
163
169void TMR5_GLOBAL_IRQHandler(void)
170{
171 uint32_t tmp = 0;
172
173 if(tmr_interrupt_flag_get(TMR5, TMR_C4_FLAG) == SET)
174 {
175 tmpCC4[incrementvar_operationcomplete()] = (uint16_t)(TMR5->c4dt);
176
177 tmr_interrupt_flag_get(TMR5, TMR_C4_FLAG);
178
179 if(getvar_operationcomplete() >= 2)
180 {
181 /* compute the period length */
182 tmp = (uint16_t)(tmpCC4[1] - tmpCC4[0] + 1);
183 setvar_periodvalue(tmp);
184
185 /* disable the interrupt */
186 tmr_interrupt_enable(TMR5, TMR_C4_INT, FALSE);
187 tmr_counter_enable(TMR5, FALSE);
188 }
189 }
190}
191
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
operationcomplete
__IO uint32_t operationcomplete
Definition project/at_start_f413/examples/rtc/lick_calibration/src/main.c:40
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c:101
setvar_periodvalue
void setvar_periodvalue(uint32_t Value)
sets the periodvalue variable with input parameter.
Definition project/at_start_f413/examples/rtc/lick_calibration/src/main.c:139
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c:62
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c:75
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c:114
incrementvar_operationcomplete
uint32_t incrementvar_operationcomplete(void)
increments operationcomplete variable and return its value before increment operation.
Definition project/at_start_f413/examples/rtc/lick_calibration/src/main.c:117
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c:132
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c:53
periodvalue
__IO uint32_t periodvalue
Definition project/at_start_f413/examples/rtc/lick_calibration/src/main.c:38
tmpCC4
uint16_t tmpCC4[2]
Definition project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c:46
getvar_operationcomplete
uint32_t getvar_operationcomplete(void)
returns operationcomplete value.
Definition project/at_start_f413/examples/rtc/lick_calibration/src/main.c:129
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c:88
TMR5_GLOBAL_IRQHandler
void TMR5_GLOBAL_IRQHandler(void)
this function handles tmr5 global interrupt request.
Definition project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c:169
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c:141
RTC_IRQHandler
void RTC_IRQHandler(void)
this function handles rtc global interrupt request.
Definition project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c:150
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/rtc/lick_calibration/src/at32f413_int.c:123
LED3
@ LED3
Definition at32f413_board.h:63
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
FALSE
@ FALSE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
SET
@ SET
Definition at32f413.h:292
rtc_interrupt_flag_get
flag_status rtc_interrupt_flag_get(uint16_t flag)
rtc interrupt flag get
Definition at32f413_rtc.c:207
rtc_counter_get
uint32_t rtc_counter_get(void)
rtc counter get
Definition at32f413_rtc.c:81
rtc_flag_clear
void rtc_flag_clear(uint16_t flag)
rtc flag clear
Definition at32f413_rtc.c:233
RTC_TS_FLAG
#define RTC_TS_FLAG
Definition at32f413_rtc.h:64
tmr_counter_enable
void tmr_counter_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr counter
Definition at32f413_tmr.c:114
tmr_interrupt_flag_get
flag_status tmr_interrupt_flag_get(tmr_type *tmr_x, uint32_t tmr_flag)
get tmr interrupt flag
Definition at32f413_tmr.c:1357
tmr_interrupt_enable
void tmr_interrupt_enable(tmr_type *tmr_x, uint32_t tmr_interrupt, confirm_state new_state)
enable or disable tmr interrupt
Definition at32f413_tmr.c:1327
TMR_C4_FLAG
#define TMR_C4_FLAG
Definition at32f413_tmr.h:55
TMR_C4_INT
#define TMR_C4_INT
Definition at32f413_tmr.h:77
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • rtc
  • lick_calibration
  • src
project/at_start_f413/examples/rtc/lick_calibration/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37 crm_clocks_freq_type crm_clocks;
38__IO uint32_t periodvalue = 0;
39__IO uint32_t lickfreq = 0;
40__IO uint32_t operationcomplete = 0;
41
47void nvic_configuration(void)
48{
49 /* configure one bit for preemption priority */
50 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
51
52 /* enable the rtc interrupt */
53 nvic_irq_enable(RTC_IRQn, 0, 0);
54
55 /* enable the tmr5 interrupt */
56 nvic_irq_enable(TMR5_GLOBAL_IRQn, 0, 0);
57}
58
64void rtc_configuration(void)
65{
66 /* enable pwc and bpr clocks */
67 crm_periph_clock_enable(CRM_PWC_PERIPH_CLOCK, TRUE);
68 crm_periph_clock_enable(CRM_BPR_PERIPH_CLOCK, TRUE);
69
70 /* allow access to bpr domain */
71 pwc_battery_powered_domain_access(TRUE);
72
73 /* reset backup domain */
74 bpr_reset();
75
76 /* enable the lick osc */
77 crm_clock_source_enable(CRM_CLOCK_SOURCE_LICK, TRUE);
78 /* wait till lick is ready */
79 while(crm_flag_get(CRM_LICK_STABLE_FLAG) == RESET);
80 /* select the rtc clock source */
81 crm_rtc_clock_select(CRM_RTC_CLOCK_LICK);
82
83 /* enable rtc clock */
84 crm_rtc_clock_enable(TRUE);
85
86 /* wait for rtc registers update */
87 rtc_wait_update_finish();
88
89 /* wait for the register write to complete */
90 rtc_wait_config_finish();
91
92 /* enable the rtc second */
93 rtc_interrupt_enable(RTC_TS_INT, TRUE);
94
95 /* wait for the register write to complete */
96 rtc_wait_config_finish();
97
98 /* set rtc divider: set rtc period to 1sec */
99 rtc_divider_set(40000);
100
101 /* wait for the register write to complete */
102 rtc_wait_config_finish();
103
104 /* tamper pin disabled */
105 bpr_tamper_pin_enable(FALSE);
106
107 /* enable the rtc second output on tamper pin */
108 bpr_rtc_output_select(BPR_RTC_OUTPUT_SECOND);
109}
110
117uint32_t incrementvar_operationcomplete(void)
118{
119 operationcomplete++;
120
121 return (uint32_t)(operationcomplete - 1);
122}
123
129uint32_t getvar_operationcomplete(void)
130{
131 return (uint32_t)operationcomplete;
132}
133
139void setvar_periodvalue(uint32_t value)
140{
141 periodvalue = (uint32_t)(value);
142}
143
149int main(void)
150{
151 tmr_input_config_type tmr_ic_init_structure;
152
153 system_clock_config();
154
155 at32_board_init();
156
157 uart_print_init(115200);
158
159 /* rtc configuration */
160 rtc_configuration();
161
162 printf("\r\n\nstart calib\r\n\r\n");
163
164 /* get the frequency value */
165 crm_clocks_freq_get(&crm_clocks);
166
167 /* enable tmr5 apb1 clocks */
168 crm_periph_clock_enable(CRM_TMR5_PERIPH_CLOCK, TRUE);
169 crm_periph_clock_enable(CRM_IOMUX_PERIPH_CLOCK, TRUE);
170
171 /* connect internally the tm5_ch4 input capture to the lick clock output */
172 gpio_pin_remap_config(TMR5CH4_MUX, TRUE);
173
174 /* tmr5 time base configuration */
175 tmr_base_init(TMR5, 0xFFFF, 0);
176 tmr_cnt_dir_set(TMR5, TMR_COUNT_UP);
177 tmr_clock_source_div_set(TMR5, TMR_CLOCK_DIV1);
178
179 /* tmr5 channel4 input capture mode configuration */
180 tmr_input_default_para_init(&tmr_ic_init_structure);
181 tmr_ic_init_structure.input_channel_select = TMR_SELECT_CHANNEL_4;
182 tmr_ic_init_structure.input_polarity_select = TMR_INPUT_RISING_EDGE;
183 tmr_ic_init_structure.input_mapped_select = TMR_CC_CHANNEL_MAPPED_DIRECT;
184 tmr_ic_init_structure.input_filter_value = 0;
185 tmr_input_channel_init(TMR5, &tmr_ic_init_structure, TMR_CHANNEL_INPUT_DIV_1);
186
187 /* reinitialize the index for the interrupt */
188 operationcomplete = 0;
189
190 /* enable the tmr5 input capture counter */
191 tmr_counter_enable(TMR5, TRUE);
192
193 /* Reset all tmr5 flags */
194 tmr_flag_get(TMR5, TMR_C4_FLAG);
195
196 /* enable the tmr5 channel 4 */
197 tmr_interrupt_enable(TMR5, TMR_C4_INT, TRUE);
198
199 /* nvic configuration */
200 nvic_configuration();
201
202 /* wait the tmr5 measuring operation to be completed */
203 while(operationcomplete != 2);
204
205 /* compute the actual frequency of the lick. (tim5_clk = 1 * pclk1) */
206 if(periodvalue != 0)
207 {
208 lickfreq = (uint32_t)((uint32_t)(crm_clocks.apb1_freq * 2) / (uint32_t)periodvalue);
209 }
210
211 printf("apb1_freq = %d\r\n", crm_clocks.apb1_freq);
212 printf("period_value = %d\r\n", periodvalue);
213 printf("lick_freq = %d\r\n", lickfreq);
214
215 /* adjust the rtc prescaler value */
216 rtc_divider_set((lickfreq - 1));
217
218 /* wait for the register write to complete */
219 rtc_wait_config_finish();
220
221 /* turn on led2 */
222 at32_led_on(LED2);
223
224 while(1)
225 {
226 }
227}
228
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
operationcomplete
__IO uint32_t operationcomplete
Definition project/at_start_f413/examples/rtc/lick_calibration/src/main.c:40
setvar_periodvalue
void setvar_periodvalue(uint32_t value)
sets the periodvalue variable with input parameter.
Definition project/at_start_f413/examples/rtc/lick_calibration/src/main.c:139
incrementvar_operationcomplete
uint32_t incrementvar_operationcomplete(void)
increments operationcomplete variable and return its value before increment operation.
Definition project/at_start_f413/examples/rtc/lick_calibration/src/main.c:117
lickfreq
__IO uint32_t lickfreq
Definition project/at_start_f413/examples/rtc/lick_calibration/src/main.c:39
periodvalue
__IO uint32_t periodvalue
Definition project/at_start_f413/examples/rtc/lick_calibration/src/main.c:38
getvar_operationcomplete
uint32_t getvar_operationcomplete(void)
returns operationcomplete value.
Definition project/at_start_f413/examples/rtc/lick_calibration/src/main.c:129
main
int main(void)
main function.
Definition project/at_start_f413/examples/rtc/lick_calibration/src/main.c:149
crm_clocks
crm_clocks_freq_type crm_clocks
Definition project/at_start_f413/examples/rtc/lick_calibration/src/main.c:37
rtc_configuration
void rtc_configuration(void)
configures the rtc.
Definition project/at_start_f413/examples/rtc/lick_calibration/src/main.c:64
nvic_configuration
void nvic_configuration(void)
configures the nested vectored interrupt controller.
Definition project/at_start_f413/examples/rtc/lick_calibration/src/main.c:47
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
tmr_ic_init_structure
tmr_input_config_type tmr_ic_init_structure
Definition project/at_start_f413/examples/tmr/one_cycle/src/main.c:38
LED2
@ LED2
Definition at32f413_board.h:62
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
uart_print_init
void uart_print_init(uint32_t baudrate)
initialize uart
Definition at32f413_board.c:129
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
bpr_reset
void bpr_reset(void)
bpr reset by crm reset register
Definition at32f413_bpr.c:48
bpr_tamper_pin_enable
void bpr_tamper_pin_enable(confirm_state new_state)
enable or disable bpr tamper pin
Definition at32f413_bpr.c:193
bpr_rtc_output_select
void bpr_rtc_output_select(bpr_rtc_output_type output_source)
select bpr rtc output
Definition at32f413_bpr.c:168
BPR_RTC_OUTPUT_SECOND
@ BPR_RTC_OUTPUT_SECOND
Definition at32f413_bpr.h:119
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_rtc_clock_select
void crm_rtc_clock_select(crm_rtc_clock_type value)
select rtc clock
Definition at32f413_crm.c:433
crm_rtc_clock_enable
void crm_rtc_clock_enable(confirm_state new_state)
enable or disable rtc
Definition at32f413_crm.c:443
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_clocks_freq_get
void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
Definition at32f413_crm.c:660
CRM_PWC_PERIPH_CLOCK
@ CRM_PWC_PERIPH_CLOCK
Definition at32f413_crm.h:140
CRM_BPR_PERIPH_CLOCK
@ CRM_BPR_PERIPH_CLOCK
Definition at32f413_crm.h:139
CRM_IOMUX_PERIPH_CLOCK
@ CRM_IOMUX_PERIPH_CLOCK
Definition at32f413_crm.h:108
CRM_TMR5_PERIPH_CLOCK
@ CRM_TMR5_PERIPH_CLOCK
Definition at32f413_crm.h:128
CRM_CLOCK_SOURCE_LICK
@ CRM_CLOCK_SOURCE_LICK
Definition at32f413_crm.h:297
CRM_RTC_CLOCK_LICK
@ CRM_RTC_CLOCK_LICK
Definition at32f413_crm.h:374
CRM_LICK_STABLE_FLAG
#define CRM_LICK_STABLE_FLAG
Definition at32f413_crm.h:58
TMR5_GLOBAL_IRQn
@ TMR5_GLOBAL_IRQn
Definition at32f413.h:220
RTC_IRQn
@ RTC_IRQn
Definition at32f413.h:174
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
gpio_pin_remap_config
void gpio_pin_remap_config(uint32_t gpio_remap, confirm_state new_state)
iomux remap and debug i/o configuration.
Definition at32f413_gpio.c:549
TMR5CH4_MUX
#define TMR5CH4_MUX
Definition at32f413_gpio.h:92
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
pwc_battery_powered_domain_access
void pwc_battery_powered_domain_access(confirm_state new_state)
enable or disable access to the battery powered domain.
Definition at32f413_pwc.c:60
rtc_wait_config_finish
void rtc_wait_config_finish(void)
rtc wait configuration finish
Definition at32f413_rtc.c:243
rtc_wait_update_finish
void rtc_wait_update_finish(void)
rtc wait update finish
Definition at32f413_rtc.c:253
rtc_interrupt_enable
void rtc_interrupt_enable(uint16_t source, confirm_state new_state)
rtc interrupt enable
Definition at32f413_rtc.c:159
rtc_divider_set
void rtc_divider_set(uint32_t div_value)
rtc divider set
Definition at32f413_rtc.c:103
RTC_TS_INT
#define RTC_TS_INT
Definition at32f413_rtc.h:51
tmr_counter_enable
void tmr_counter_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr counter
Definition at32f413_tmr.c:114
tmr_input_channel_init
void tmr_input_channel_init(tmr_type *tmr_x, tmr_input_config_type *input_struct, tmr_channel_input_divider_type divider_factor)
init tmr input channel
Definition at32f413_tmr.c:816
tmr_clock_source_div_set
void tmr_clock_source_div_set(tmr_type *tmr_x, tmr_clock_division_type tmr_clock_div)
set tmr clock source division
Definition at32f413_tmr.c:204
tmr_flag_get
flag_status tmr_flag_get(tmr_type *tmr_x, uint32_t tmr_flag)
get tmr flag
Definition at32f413_tmr.c:1395
tmr_input_default_para_init
void tmr_input_default_para_init(tmr_input_config_type *tmr_input_struct)
init tmr input default para
Definition at32f413_tmr.c:143
tmr_base_init
void tmr_base_init(tmr_type *tmr_x, uint32_t tmr_pr, uint32_t tmr_div)
init tmr base
Definition at32f413_tmr.c:179
tmr_interrupt_enable
void tmr_interrupt_enable(tmr_type *tmr_x, uint32_t tmr_interrupt, confirm_state new_state)
enable or disable tmr interrupt
Definition at32f413_tmr.c:1327
tmr_cnt_dir_set
void tmr_cnt_dir_set(tmr_type *tmr_x, tmr_count_mode_type tmr_cnt_dir)
set tmr counter count direction
Definition at32f413_tmr.c:225
TMR_COUNT_UP
@ TMR_COUNT_UP
Definition at32f413_tmr.h:105
TMR_INPUT_RISING_EDGE
@ TMR_INPUT_RISING_EDGE
Definition at32f413_tmr.h:205
TMR_SELECT_CHANNEL_4
@ TMR_SELECT_CHANNEL_4
Definition at32f413_tmr.h:221
TMR_CC_CHANNEL_MAPPED_DIRECT
@ TMR_CC_CHANNEL_MAPPED_DIRECT
Definition at32f413_tmr.h:238
TMR_CLOCK_DIV1
@ TMR_CLOCK_DIV1
Definition at32f413_tmr.h:95
TMR_CHANNEL_INPUT_DIV_1
@ TMR_CHANNEL_INPUT_DIV_1
Definition at32f413_tmr.h:248
TMR_C4_FLAG
#define TMR_C4_FLAG
Definition at32f413_tmr.h:55
TMR_C4_INT
#define TMR_C4_INT
Definition at32f413_tmr.h:77
at32f413_clock.h
header file of clock program
crm_clocks_freq_type
crm clocks freqency structure
Definition at32f413_crm.h:470
crm_clocks_freq_type::apb1_freq
uint32_t apb1_freq
Definition at32f413_crm.h:474
tmr_input_config_type
tmr input capture config type
Definition at32f413_tmr.h:411
tmr_input_config_type::input_mapped_select
tmr_input_direction_mapped_type input_mapped_select
Definition at32f413_tmr.h:414
tmr_input_config_type::input_filter_value
uint8_t input_filter_value
Definition at32f413_tmr.h:415
tmr_input_config_type::input_polarity_select
tmr_input_polarity_type input_polarity_select
Definition at32f413_tmr.h:413
tmr_input_config_type::input_channel_select
tmr_channel_select_type input_channel_select
Definition at32f413_tmr.h:412


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • sdio
  • emmc_card
  • inc
project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • sdio
  • emmc_card
  • inc
project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • sdio
  • emmc_card
  • inc
project/at_start_f413/examples/sdio/emmc_card/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • sdio
  • emmc_card
  • src
project/at_start_f413/examples/sdio/emmc_card/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/sdio/emmc_card/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • sdio
  • emmc_card
  • src
project/at_start_f413/examples/sdio/emmc_card/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/sdio/emmc_card/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/sdio/emmc_card/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/sdio/emmc_card/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/sdio/emmc_card/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/sdio/emmc_card/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/sdio/emmc_card/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/sdio/emmc_card/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/sdio/emmc_card/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/sdio/emmc_card/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • sdio
  • emmc_card
  • src
project/at_start_f413/examples/sdio/emmc_card/src/main.c
Go to the documentation of this file.
1
26#include <stdbool.h>
27#include <string.h>
28#include "at32_sdio.h"
29#include "at32f413_board.h"
30#include "at32f413_clock.h"
31
40#define BLOCK_SIZE (512)
41#define BLOCKS_NUMBER (8)
42#define MULTI_BUFFER_SIZE (BLOCK_SIZE * BLOCKS_NUMBER)
43#define STREAM_BUFFER_SIZE (1024)
44
45static uint8_t sblock_tbuffer[BLOCK_SIZE], sblock_rbuffer[BLOCK_SIZE];
46static uint8_t mblock_tbuffer[MULTI_BUFFER_SIZE], mblock_rbuffer[MULTI_BUFFER_SIZE];
47static uint8_t stream_tbuffer[STREAM_BUFFER_SIZE], stream_rbuffer[STREAM_BUFFER_SIZE];
48
52typedef enum
53{
54 TEST_FAIL = 0,
55 TEST_SUCCESS,
56} test_result_type;
57
58static test_result_type sd_single_block_test(void);
59static test_result_type sd_multiple_blocks_test(void);
60uint8_t buffer_compare(uint8_t* pbuffer1, uint8_t* pbuffer2, uint16_t buffer_length);
61static void sd_test_error(void);
62static void nvic_configuration(void);
63
70static test_result_type sd_single_block_test(void)
71{
72 sd_error_status_type status = SD_OK;
73 uint8_t bus_width;
74
75 /* test 1-bit and 4-bit width */
76 for(bus_width = 0; bus_width < 2; bus_width++)
77 {
78 memset(sblock_tbuffer, bus_width + 0xAB, BLOCK_SIZE);
79 memset(sblock_rbuffer, 0, BLOCK_SIZE);
80
81 /* set data width */
82 status = sd_wide_bus_operation_config((sdio_bus_width_type)bus_width);
83 if(status != SD_OK)
84 {
85 return TEST_FAIL;
86 }
87
88 /* write block of 512 bytes on address 0 */
89 status = sd_block_write(sblock_tbuffer, 0x00, BLOCK_SIZE);
90 if(status != SD_OK)
91 {
92 return TEST_FAIL;
93 }
94
95 /* read block of 512 bytes from address 0 */
96 status = sd_block_read(sblock_rbuffer, 0x00, BLOCK_SIZE);
97 if(status != SD_OK)
98 {
99 return TEST_FAIL;
100 }
101
102 if(!buffer_compare(sblock_tbuffer, sblock_rbuffer, BLOCK_SIZE))
103 {
104 return TEST_FAIL;
105 }
106 }
107
108 return TEST_SUCCESS;
109}
110
117static test_result_type sd_multiple_blocks_test(void)
118{
119 sd_error_status_type status = SD_OK;
120 uint8_t bus_width;
121
122 /* test 1-bit and 4-bit width */
123 for(bus_width = 0; bus_width < 2; bus_width++)
124 {
125 memset(mblock_tbuffer, bus_width + 0x3C, MULTI_BUFFER_SIZE);
126 memset(mblock_rbuffer, 0, MULTI_BUFFER_SIZE);
127
128 /* set data width */
129 status = sd_wide_bus_operation_config((sdio_bus_width_type)bus_width);
130 if(status != SD_OK)
131 {
132 return TEST_FAIL;
133 }
134
135 /* write multiple block of many bytes on address 0 */
136 status = sd_mult_blocks_write(mblock_tbuffer, 0x00, BLOCK_SIZE, BLOCKS_NUMBER);
137 if(status != SD_OK)
138 {
139 return TEST_FAIL;
140 }
141
142 /* read block of many bytes from address 0 */
143 status = sd_mult_blocks_read(mblock_rbuffer, 0x00, BLOCK_SIZE, BLOCKS_NUMBER);
144 if(status != SD_OK)
145 {
146 return TEST_FAIL;
147 }
148
149 /* check the correctness of written data */
150 if(!buffer_compare(mblock_tbuffer, mblock_rbuffer, MULTI_BUFFER_SIZE))
151 {
152 return TEST_FAIL;
153 }
154 }
155
156 return TEST_SUCCESS;
157}
158
165static test_result_type mmc_stream_test(void)
166{
167 sd_error_status_type status = SD_OK;
168 uint8_t bus_width;
169
170 /* only test 1-bit width */
171 for(bus_width = 0; bus_width < 1; bus_width++)
172 {
173 memset(stream_tbuffer, bus_width+0x5A, STREAM_BUFFER_SIZE);
174 memset(stream_rbuffer, 0, STREAM_BUFFER_SIZE);
175
176 /* set data width */
177 status = sd_wide_bus_operation_config((sdio_bus_width_type)bus_width);
178 if(status != SD_OK)
179 {
180 return TEST_FAIL;
181 }
182
183 /* write stream of many bytes on address 0 */
184 status = mmc_stream_write(stream_tbuffer, 0x00, STREAM_BUFFER_SIZE);
185 if (status != SD_OK)
186 {
187 return TEST_FAIL;
188 }
189
190 /* read stream of many bytes from address 0 */
191 status = mmc_stream_read(stream_rbuffer, 0x00, STREAM_BUFFER_SIZE);
192 if (status != SD_OK)
193 {
194 return TEST_FAIL;
195 }
196
197 /* check the correctness of written data */
198 if(!buffer_compare(stream_tbuffer, stream_rbuffer, STREAM_BUFFER_SIZE))
199 {
200 return TEST_FAIL;
201 }
202 }
203
204 return TEST_SUCCESS;
205}
206
214uint8_t buffer_compare(uint8_t* pbuffer1, uint8_t* pbuffer2, uint16_t buffer_length)
215{
216 while(buffer_length--)
217 {
218 if(*pbuffer1 != *pbuffer2)
219 {
220 return 0;
221 }
222 pbuffer1++;
223 pbuffer2++;
224 }
225 return 1;
226}
227
233static void sd_test_error(void)
234{
235 at32_led_on(LED2);
236 delay_ms(300);
237 at32_led_off(LED2);
238 delay_ms(300);
239}
240
246static void nvic_configuration(void)
247{
248 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
249 nvic_irq_enable(SDIO1_IRQn, 1, 0);
250}
251
257void show_card_info(void)
258{
259 printf("---------------------\r\n");
260 switch(sd_card_info.card_type)
261 {
262 case SDIO_STD_CAPACITY_SD_CARD_V1_1: printf("card type: SDSC V1.1\r\n");break;
263 case SDIO_STD_CAPACITY_SD_CARD_V2_0: printf("card type: SDSC V2.0\r\n");break;
264 case SDIO_HIGH_CAPACITY_SD_CARD: printf("card type: SDHC V2.0\r\n");break;
265 case SDIO_MULTIMEDIA_CARD: printf("card type: MMC \r\n");break;
266 case SDIO_HIGH_SPEED_MULTIMEDIA_CARD: printf("card type: MMC V4.2\r\n");break;
267 case SDIO_HIGH_CAPACITY_MMC_CARD: printf("card type: eMMC \r\n");break;
268 }
269 printf("card manufacturer_id: %d\r\n", sd_card_info.sd_cid_reg.manufacturer_id);
270 printf("card rca: 0x%X\r\n", sd_card_info.rca);
271 printf("card c_size = %u\r\n", sd_card_info.sd_csd_reg.device_size);
272 printf("card capacity: %uMB %uKB\r\n", (uint32_t)(sd_card_info.card_capacity>>20), (uint32_t)(sd_card_info.card_capacity>>10));
273 printf("card block_size: %d\r\n", sd_card_info.card_blk_size);
274 printf("---------------------\r\n");
275}
276
277/* gloable functions ---------------------------------------------------------*/
283int main(void)
284{
285 system_clock_config();
286
287 at32_board_init();
288
289 nvic_configuration();
290
291 uart_print_init(115200);
292 printf("start test..\r\n");
293
294 /* sdio init */
295 if(SD_OK != sd_init())
296 {
297 printf("sdio init fail\r\n");
298 while(1)
299 {
300 sd_test_error();
301 }
302 }
303 printf("sdio init ok\r\n");
304 show_card_info();
305
306 /* sd card single block test */
307 if(TEST_SUCCESS != sd_single_block_test())
308 {
309 printf("sd card single block test fail\r\n");
310 /* single block test fail, led2 fresh */
311 while(1)
312 {
313 sd_test_error();
314 }
315 }
316 printf("sd card single block test ok\r\n");
317
318 /* sd card multiple blocks test */
319 if(TEST_SUCCESS != sd_multiple_blocks_test())
320 {
321 printf("sd card multiple blocks test fail\r\n");
322 /* multiple blocks test fail, led2 fresh */
323 while(1)
324 {
325 sd_test_error();
326 }
327 }
328 printf("sd card multiple blocks test ok\r\n");
329
330 /* mmc card stream data transfer test */
331 if((sd_card_info.card_type == SDIO_MULTIMEDIA_CARD)||(sd_card_info.card_type == SDIO_HIGH_SPEED_MULTIMEDIA_CARD))
332 {
333 if(TEST_SUCCESS != mmc_stream_test())
334 {
335 printf("mmc card stream data test fail\r\n");
336 /* mmc card stream data test fail, led2 fresh */
337 while(1)
338 {
339 sd_test_error();
340 }
341 }
342 printf("mmc card stream data test ok\r\n");
343 }
344
345 /* all tests pass, led3 and led4 fresh */
346 while(1)
347 {
348 at32_led_toggle(LED3);
349 at32_led_toggle(LED4);
350 delay_ms(300);
351 }
352}
353
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
STREAM_BUFFER_SIZE
#define STREAM_BUFFER_SIZE
Definition project/at_start_f413/examples/sdio/emmc_card/src/main.c:43
stream_tbuffer
static uint8_t stream_tbuffer[(1024)]
Definition project/at_start_f413/examples/sdio/emmc_card/src/main.c:47
sd_multiple_blocks_test
static test_result_type sd_multiple_blocks_test(void)
sd card multiple blocks read/write test.
Definition project/at_start_f413/examples/sdio/emmc_card/src/main.c:117
buffer_compare
uint8_t buffer_compare(uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t buffer_length)
compares two buffers.
Definition project/at_start_f413/examples/sdio/emmc_card/src/main.c:214
sd_test_error
static void sd_test_error(void)
LED2 on off every 300ms for sd test error.
Definition project/at_start_f413/examples/sdio/emmc_card/src/main.c:233
BLOCKS_NUMBER
#define BLOCKS_NUMBER
Definition project/at_start_f413/examples/sdio/emmc_card/src/main.c:41
stream_rbuffer
static uint8_t stream_rbuffer[(1024)]
Definition project/at_start_f413/examples/sdio/emmc_card/src/main.c:47
sblock_rbuffer
static uint8_t sblock_rbuffer[(512)]
Definition project/at_start_f413/examples/sdio/emmc_card/src/main.c:45
test_result_type
test_result_type
Definition project/at_start_f413/examples/sdio/emmc_card/src/main.c:53
show_card_info
void show_card_info(void)
show sd/mmc card info.
Definition project/at_start_f413/examples/sdio/emmc_card/src/main.c:257
mblock_tbuffer
static uint8_t mblock_tbuffer[((512) *(8))]
Definition project/at_start_f413/examples/sdio/emmc_card/src/main.c:46
sblock_tbuffer
static uint8_t sblock_tbuffer[(512)]
Definition project/at_start_f413/examples/sdio/emmc_card/src/main.c:45
MULTI_BUFFER_SIZE
#define MULTI_BUFFER_SIZE
Definition project/at_start_f413/examples/sdio/emmc_card/src/main.c:42
nvic_configuration
static void nvic_configuration(void)
configures sdio1 irq channel.
Definition project/at_start_f413/examples/sdio/emmc_card/src/main.c:246
main
int main(void)
main function.
Definition project/at_start_f413/examples/sdio/emmc_card/src/main.c:283
sd_single_block_test
static test_result_type sd_single_block_test(void)
sd card single block read/write test.
Definition project/at_start_f413/examples/sdio/emmc_card/src/main.c:70
BLOCK_SIZE
#define BLOCK_SIZE
Definition project/at_start_f413/examples/sdio/emmc_card/src/main.c:40
mblock_rbuffer
static uint8_t mblock_rbuffer[((512) *(8))]
Definition project/at_start_f413/examples/sdio/emmc_card/src/main.c:46
mmc_stream_test
static test_result_type mmc_stream_test(void)
mmc card data stream read/write test.
Definition project/at_start_f413/examples/sdio/emmc_card/src/main.c:165
TEST_FAIL
@ TEST_FAIL
Definition project/at_start_f413/examples/sdio/emmc_card/src/main.c:54
TEST_SUCCESS
@ TEST_SUCCESS
Definition project/at_start_f413/examples/sdio/emmc_card/src/main.c:55
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
at32_led_off
void at32_led_off(led_type led)
turns selected led off.
Definition at32f413_board.c:287
uart_print_init
void uart_print_init(uint32_t baudrate)
initialize uart
Definition at32f413_board.c:129
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
SDIO1_IRQn
@ SDIO1_IRQn
Definition at32f413.h:219
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
mmc_stream_write
sd_error_status_type mmc_stream_write(uint8_t *buf, long long addr, uint32_t len)
write mmc card data stream.
Definition emmc_card/src/at32_sdio.c:1722
sd_block_read
sd_error_status_type sd_block_read(uint8_t *buf, long long addr, uint16_t blk_size)
allows to read one block from a specified address in a card. the data transfer can be managed by dma ...
Definition emmc_card/src/at32_sdio.c:1210
sd_mult_blocks_write
sd_error_status_type sd_mult_blocks_write(const uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks)
allows to write blocks starting from a specified address in a card. the data transfer can be managed ...
Definition emmc_card/src/at32_sdio.c:1511
sd_block_write
sd_error_status_type sd_block_write(const uint8_t *buf, long long addr, uint16_t blk_size)
allows to write one block starting from a specified address in a card. the data transfer can be manag...
Definition emmc_card/src/at32_sdio.c:1389
sd_init
sd_error_status_type sd_init(void)
initializes the sd card and put it into standby state (ready for data transfer).
Definition emmc_card/src/at32_sdio.c:73
mmc_stream_read
sd_error_status_type mmc_stream_read(uint8_t *buf, long long addr, uint32_t len)
read mmc card data stream.
Definition emmc_card/src/at32_sdio.c:1675
sd_mult_blocks_read
sd_error_status_type sd_mult_blocks_read(uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks)
allows to read blocks from a specified address in a card. the data transfer can be managed by dma mod...
Definition emmc_card/src/at32_sdio.c:1299
sd_wide_bus_operation_config
sd_error_status_type sd_wide_bus_operation_config(sdio_bus_width_type mode)
enable wide bus opeartion for the requeseted card if supported by card.
Definition emmc_card/src/at32_sdio.c:765
sd_card_info
sd_card_info_struct_type sd_card_info
Definition emmc_card/src/at32_sdio.c:48
sd_error_status_type
sd_error_status_type
Definition emmc_card/inc/at32_sdio.h:73
sdio_bus_width_type
sdio_bus_width_type
sdio bus width
Definition at32f413_sdio.h:138
SD_OK
@ SD_OK
Definition emmc_card/inc/at32_sdio.h:118
SDIO_HIGH_CAPACITY_SD_CARD
@ SDIO_HIGH_CAPACITY_SD_CARD
Definition emmc_card/inc/at32_sdio.h:205
SDIO_HIGH_SPEED_MULTIMEDIA_CARD
@ SDIO_HIGH_SPEED_MULTIMEDIA_CARD
Definition emmc_card/inc/at32_sdio.h:208
SDIO_STD_CAPACITY_SD_CARD_V1_1
@ SDIO_STD_CAPACITY_SD_CARD_V1_1
Definition emmc_card/inc/at32_sdio.h:203
SDIO_STD_CAPACITY_SD_CARD_V2_0
@ SDIO_STD_CAPACITY_SD_CARD_V2_0
Definition emmc_card/inc/at32_sdio.h:204
SDIO_MULTIMEDIA_CARD
@ SDIO_MULTIMEDIA_CARD
Definition emmc_card/inc/at32_sdio.h:206
SDIO_HIGH_CAPACITY_MMC_CARD
@ SDIO_HIGH_CAPACITY_MMC_CARD
Definition emmc_card/inc/at32_sdio.h:210
at32f413_clock.h
header file of clock program
sd_card_info_struct_type::card_capacity
long long card_capacity
Definition emmc_card/inc/at32_sdio.h:240
sd_card_info_struct_type::sd_cid_reg
sd_cid_struct_type sd_cid_reg
Definition emmc_card/inc/at32_sdio.h:238
sd_card_info_struct_type::sd_csd_reg
sd_csd_struct_type sd_csd_reg
Definition emmc_card/inc/at32_sdio.h:237
sd_card_info_struct_type::card_blk_size
uint32_t card_blk_size
Definition emmc_card/inc/at32_sdio.h:241
sd_card_info_struct_type::rca
uint16_t rca
Definition emmc_card/inc/at32_sdio.h:242
sd_card_info_struct_type::card_type
uint8_t card_type
Definition emmc_card/inc/at32_sdio.h:243
sd_cid_struct_type::manufacturer_id
uint8_t manufacturer_id
Definition emmc_card/inc/at32_sdio.h:170
sd_csd_struct_type::device_size
uint32_t device_size
Definition emmc_card/inc/at32_sdio.h:139


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • sdio
  • sd_mmc_card
  • inc
project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • sdio
  • sd_mmc_card
  • inc
project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • sdio
  • sd_mmc_card
  • inc
project/at_start_f413/examples/sdio/sd_mmc_card/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • sdio
  • sd_mmc_card
  • src
project/at_start_f413/examples/sdio/sd_mmc_card/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/sdio/sd_mmc_card/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • sdio
  • sd_mmc_card
  • src
project/at_start_f413/examples/sdio/sd_mmc_card/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/sdio/sd_mmc_card/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/sdio/sd_mmc_card/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/sdio/sd_mmc_card/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/sdio/sd_mmc_card/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/sdio/sd_mmc_card/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/sdio/sd_mmc_card/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/sdio/sd_mmc_card/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/sdio/sd_mmc_card/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/sdio/sd_mmc_card/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • sdio
  • sd_mmc_card
  • src
project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c
Go to the documentation of this file.
1
26#include <stdbool.h>
27#include <string.h>
28#include "at32_sdio.h"
29#include "at32f413_board.h"
30#include "at32f413_clock.h"
31
40#define BLOCK_SIZE (512)
41#define BLOCKS_NUMBER (8)
42#define MULTI_BUFFER_SIZE (BLOCK_SIZE * BLOCKS_NUMBER)
43#define STREAM_BUFFER_SIZE (1024)
44
45static uint8_t sblock_tbuffer[BLOCK_SIZE], sblock_rbuffer[BLOCK_SIZE];
46static uint8_t mblock_tbuffer[MULTI_BUFFER_SIZE], mblock_rbuffer[MULTI_BUFFER_SIZE];
47static uint8_t stream_tbuffer[STREAM_BUFFER_SIZE], stream_rbuffer[STREAM_BUFFER_SIZE];
48
52typedef enum
53{
54 TEST_FAIL = 0,
55 TEST_SUCCESS,
56} test_result_type;
57
58static test_result_type sd_single_block_test(void);
59static test_result_type sd_multiple_blocks_test(void);
60uint8_t buffer_compare(uint8_t* pbuffer1, uint8_t* pbuffer2, uint16_t buffer_length);
61static void sd_test_error(void);
62static void nvic_configuration(void);
63
70static test_result_type sd_single_block_test(void)
71{
72 sd_error_status_type status = SD_OK;
73 uint8_t bus_width;
74
75 /* test 1-bit and 4-bit width */
76 for(bus_width = 0; bus_width < 2; bus_width++)
77 {
78 memset(sblock_tbuffer, bus_width + 0xAB, BLOCK_SIZE);
79 memset(sblock_rbuffer, 0, BLOCK_SIZE);
80
81 /* set data width */
82 status = sd_wide_bus_operation_config((sdio_bus_width_type)bus_width);
83 if(status != SD_OK)
84 {
85 return TEST_FAIL;
86 }
87
88 /* write block of 512 bytes on address 0 */
89 status = sd_block_write(sblock_tbuffer, 0x00, BLOCK_SIZE);
90 if(status != SD_OK)
91 {
92 return TEST_FAIL;
93 }
94
95 /* read block of 512 bytes from address 0 */
96 status = sd_block_read(sblock_rbuffer, 0x00, BLOCK_SIZE);
97 if(status != SD_OK)
98 {
99 return TEST_FAIL;
100 }
101
102 if(!buffer_compare(sblock_tbuffer, sblock_rbuffer, BLOCK_SIZE))
103 {
104 return TEST_FAIL;
105 }
106 }
107
108 return TEST_SUCCESS;
109}
110
117static test_result_type sd_multiple_blocks_test(void)
118{
119 sd_error_status_type status = SD_OK;
120 uint8_t bus_width;
121
122 /* test 1-bit and 4-bit width */
123 for(bus_width = 0; bus_width < 2; bus_width++)
124 {
125 memset(mblock_tbuffer, bus_width + 0x3C, MULTI_BUFFER_SIZE);
126 memset(mblock_rbuffer, 0, MULTI_BUFFER_SIZE);
127
128 /* set data width */
129 status = sd_wide_bus_operation_config((sdio_bus_width_type)bus_width);
130 if(status != SD_OK)
131 {
132 return TEST_FAIL;
133 }
134
135 /* write multiple block of many bytes on address 0 */
136 status = sd_mult_blocks_write(mblock_tbuffer, 0x00, BLOCK_SIZE, BLOCKS_NUMBER);
137 if(status != SD_OK)
138 {
139 return TEST_FAIL;
140 }
141
142 /* read block of many bytes from address 0 */
143 status = sd_mult_blocks_read(mblock_rbuffer, 0x00, BLOCK_SIZE, BLOCKS_NUMBER);
144 if(status != SD_OK)
145 {
146 return TEST_FAIL;
147 }
148
149 /* check the correctness of written data */
150 if(!buffer_compare(mblock_tbuffer, mblock_rbuffer, MULTI_BUFFER_SIZE))
151 {
152 return TEST_FAIL;
153 }
154 }
155
156 return TEST_SUCCESS;
157}
158
165static test_result_type mmc_stream_test(void)
166{
167 sd_error_status_type status = SD_OK;
168 uint8_t bus_width;
169
170 /* only test 1-bit width */
171 for(bus_width = 0; bus_width < 1; bus_width++)
172 {
173 memset(stream_tbuffer, bus_width+0x5A, STREAM_BUFFER_SIZE);
174 memset(stream_rbuffer, 0, STREAM_BUFFER_SIZE);
175
176 /* set data width */
177 status = sd_wide_bus_operation_config((sdio_bus_width_type)bus_width);
178 if(status != SD_OK)
179 {
180 return TEST_FAIL;
181 }
182
183 /* write stream of many bytes on address 0 */
184 status = mmc_stream_write(stream_tbuffer, 0x00, STREAM_BUFFER_SIZE);
185 if (status != SD_OK)
186 {
187 return TEST_FAIL;
188 }
189
190 /* read stream of many bytes from address 0 */
191 status = mmc_stream_read(stream_rbuffer, 0x00, STREAM_BUFFER_SIZE);
192 if (status != SD_OK)
193 {
194 return TEST_FAIL;
195 }
196
197 /* check the correctness of written data */
198 if(!buffer_compare(stream_tbuffer, stream_rbuffer, STREAM_BUFFER_SIZE))
199 {
200 return TEST_FAIL;
201 }
202 }
203
204 return TEST_SUCCESS;
205}
206
214uint8_t buffer_compare(uint8_t* pbuffer1, uint8_t* pbuffer2, uint16_t buffer_length)
215{
216 while(buffer_length--)
217 {
218 if(*pbuffer1 != *pbuffer2)
219 {
220 return 0;
221 }
222 pbuffer1++;
223 pbuffer2++;
224 }
225 return 1;
226}
227
233static void sd_test_error(void)
234{
235 at32_led_on(LED2);
236 delay_ms(300);
237 at32_led_off(LED2);
238 delay_ms(300);
239}
240
246static void nvic_configuration(void)
247{
248 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
249 nvic_irq_enable(SDIO1_IRQn, 1, 0);
250}
251
257void show_card_info(void)
258{
259 printf("---------------------\r\n");
260 switch(sd_card_info.card_type)
261 {
262 case SDIO_STD_CAPACITY_SD_CARD_V1_1: printf("card type: SDSC V1.1\r\n");break;
263 case SDIO_STD_CAPACITY_SD_CARD_V2_0: printf("card type: SDSC V2.0\r\n");break;
264 case SDIO_HIGH_CAPACITY_SD_CARD: printf("card type: SDHC V2.0\r\n");break;
265 case SDIO_MULTIMEDIA_CARD: printf("card type: MMC \r\n");break;
266 case SDIO_HIGH_SPEED_MULTIMEDIA_CARD: printf("card type: MMC V4.2\r\n");break;
267 case SDIO_HIGH_CAPACITY_MMC_CARD: printf("card type: eMMC \r\n");break;
268 }
269 printf("card manufacturer_id: %d\r\n", sd_card_info.sd_cid_reg.manufacturer_id);
270 printf("card rca: 0x%X\r\n", sd_card_info.rca);
271 printf("card c_size = %u\r\n", sd_card_info.sd_csd_reg.device_size);
272 printf("card capacity: %uMB %uKB\r\n", (uint32_t)(sd_card_info.card_capacity>>20), (uint32_t)(sd_card_info.card_capacity>>10));
273 printf("card block_size: %d\r\n", sd_card_info.card_blk_size);
274 printf("---------------------\r\n");
275}
276
277/* gloable functions ---------------------------------------------------------*/
283int main(void)
284{
285 system_clock_config();
286
287 at32_board_init();
288
289 nvic_configuration();
290
291 uart_print_init(115200);
292 printf("start test..\r\n");
293
294 /* sdio init */
295 if(SD_OK != sd_init())
296 {
297 printf("sdio init fail\r\n");
298 while(1)
299 {
300 sd_test_error();
301 }
302 }
303 printf("sdio init ok\r\n");
304 show_card_info();
305
306 /* sd card single block test */
307 if(TEST_SUCCESS != sd_single_block_test())
308 {
309 printf("sd card single block test fail\r\n");
310 /* single block test fail, led2 fresh */
311 while(1)
312 {
313 sd_test_error();
314 }
315 }
316 printf("sd card single block test ok\r\n");
317
318 /* sd card multiple blocks test */
319 if(TEST_SUCCESS != sd_multiple_blocks_test())
320 {
321 printf("sd card multiple blocks test fail\r\n");
322 /* multiple blocks test fail, led2 fresh */
323 while(1)
324 {
325 sd_test_error();
326 }
327 }
328 printf("sd card multiple blocks test ok\r\n");
329
330 /* mmc card stream data transfer test */
331 if((sd_card_info.card_type == SDIO_MULTIMEDIA_CARD)||(sd_card_info.card_type == SDIO_HIGH_SPEED_MULTIMEDIA_CARD))
332 {
333 if(TEST_SUCCESS != mmc_stream_test())
334 {
335 printf("mmc card stream data test fail\r\n");
336 /* mmc card stream data test fail, led2 fresh */
337 while(1)
338 {
339 sd_test_error();
340 }
341 }
342 printf("mmc card stream data test ok\r\n");
343 }
344
345 /* all tests pass, led3 and led4 fresh */
346 while(1)
347 {
348 at32_led_toggle(LED3);
349 at32_led_toggle(LED4);
350 delay_ms(300);
351 }
352}
353
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
test_result_type
test_result_type
Definition project/at_start_f413/examples/sdio/emmc_card/src/main.c:53
STREAM_BUFFER_SIZE
#define STREAM_BUFFER_SIZE
Definition project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c:43
stream_tbuffer
static uint8_t stream_tbuffer[(1024)]
Definition project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c:47
sd_multiple_blocks_test
static test_result_type sd_multiple_blocks_test(void)
sd card multiple blocks read/write test.
Definition project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c:117
buffer_compare
uint8_t buffer_compare(uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t buffer_length)
compares two buffers.
Definition project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c:214
sd_test_error
static void sd_test_error(void)
LED2 on off every 300ms for sd test error.
Definition project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c:233
BLOCKS_NUMBER
#define BLOCKS_NUMBER
Definition project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c:41
stream_rbuffer
static uint8_t stream_rbuffer[(1024)]
Definition project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c:47
sblock_rbuffer
static uint8_t sblock_rbuffer[(512)]
Definition project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c:45
test_result_type
test_result_type
Definition project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c:53
show_card_info
void show_card_info(void)
show sd/mmc card info.
Definition project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c:257
mblock_tbuffer
static uint8_t mblock_tbuffer[((512) *(8))]
Definition project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c:46
sblock_tbuffer
static uint8_t sblock_tbuffer[(512)]
Definition project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c:45
MULTI_BUFFER_SIZE
#define MULTI_BUFFER_SIZE
Definition project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c:42
nvic_configuration
static void nvic_configuration(void)
configures sdio1 irq channel.
Definition project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c:246
main
int main(void)
main function.
Definition project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c:283
sd_single_block_test
static test_result_type sd_single_block_test(void)
sd card single block read/write test.
Definition project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c:70
BLOCK_SIZE
#define BLOCK_SIZE
Definition project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c:40
mblock_rbuffer
static uint8_t mblock_rbuffer[((512) *(8))]
Definition project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c:46
mmc_stream_test
static test_result_type mmc_stream_test(void)
mmc card data stream read/write test.
Definition project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c:165
TEST_FAIL
@ TEST_FAIL
Definition project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c:54
TEST_SUCCESS
@ TEST_SUCCESS
Definition project/at_start_f413/examples/sdio/sd_mmc_card/src/main.c:55
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
at32_led_off
void at32_led_off(led_type led)
turns selected led off.
Definition at32f413_board.c:287
uart_print_init
void uart_print_init(uint32_t baudrate)
initialize uart
Definition at32f413_board.c:129
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
SDIO1_IRQn
@ SDIO1_IRQn
Definition at32f413.h:219
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
mmc_stream_write
sd_error_status_type mmc_stream_write(uint8_t *buf, long long addr, uint32_t len)
write mmc card data stream.
Definition emmc_card/src/at32_sdio.c:1722
sd_block_read
sd_error_status_type sd_block_read(uint8_t *buf, long long addr, uint16_t blk_size)
allows to read one block from a specified address in a card. the data transfer can be managed by dma ...
Definition emmc_card/src/at32_sdio.c:1210
sd_mult_blocks_write
sd_error_status_type sd_mult_blocks_write(const uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks)
allows to write blocks starting from a specified address in a card. the data transfer can be managed ...
Definition emmc_card/src/at32_sdio.c:1511
sd_block_write
sd_error_status_type sd_block_write(const uint8_t *buf, long long addr, uint16_t blk_size)
allows to write one block starting from a specified address in a card. the data transfer can be manag...
Definition emmc_card/src/at32_sdio.c:1389
sd_init
sd_error_status_type sd_init(void)
initializes the sd card and put it into standby state (ready for data transfer).
Definition emmc_card/src/at32_sdio.c:73
mmc_stream_read
sd_error_status_type mmc_stream_read(uint8_t *buf, long long addr, uint32_t len)
read mmc card data stream.
Definition emmc_card/src/at32_sdio.c:1675
sd_mult_blocks_read
sd_error_status_type sd_mult_blocks_read(uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks)
allows to read blocks from a specified address in a card. the data transfer can be managed by dma mod...
Definition emmc_card/src/at32_sdio.c:1299
sd_wide_bus_operation_config
sd_error_status_type sd_wide_bus_operation_config(sdio_bus_width_type mode)
enable wide bus opeartion for the requeseted card if supported by card.
Definition emmc_card/src/at32_sdio.c:765
sd_card_info
sd_card_info_struct_type sd_card_info
Definition emmc_card/src/at32_sdio.c:48
sd_error_status_type
sd_error_status_type
Definition emmc_card/inc/at32_sdio.h:73
sdio_bus_width_type
sdio_bus_width_type
sdio bus width
Definition at32f413_sdio.h:138
SD_OK
@ SD_OK
Definition emmc_card/inc/at32_sdio.h:118
SDIO_HIGH_CAPACITY_SD_CARD
@ SDIO_HIGH_CAPACITY_SD_CARD
Definition emmc_card/inc/at32_sdio.h:205
SDIO_HIGH_SPEED_MULTIMEDIA_CARD
@ SDIO_HIGH_SPEED_MULTIMEDIA_CARD
Definition emmc_card/inc/at32_sdio.h:208
SDIO_STD_CAPACITY_SD_CARD_V1_1
@ SDIO_STD_CAPACITY_SD_CARD_V1_1
Definition emmc_card/inc/at32_sdio.h:203
SDIO_STD_CAPACITY_SD_CARD_V2_0
@ SDIO_STD_CAPACITY_SD_CARD_V2_0
Definition emmc_card/inc/at32_sdio.h:204
SDIO_MULTIMEDIA_CARD
@ SDIO_MULTIMEDIA_CARD
Definition emmc_card/inc/at32_sdio.h:206
SDIO_HIGH_CAPACITY_MMC_CARD
@ SDIO_HIGH_CAPACITY_MMC_CARD
Definition emmc_card/inc/at32_sdio.h:210
at32f413_clock.h
header file of clock program
sd_card_info_struct_type::card_capacity
long long card_capacity
Definition emmc_card/inc/at32_sdio.h:240
sd_card_info_struct_type::sd_cid_reg
sd_cid_struct_type sd_cid_reg
Definition emmc_card/inc/at32_sdio.h:238
sd_card_info_struct_type::sd_csd_reg
sd_csd_struct_type sd_csd_reg
Definition emmc_card/inc/at32_sdio.h:237
sd_card_info_struct_type::card_blk_size
uint32_t card_blk_size
Definition emmc_card/inc/at32_sdio.h:241
sd_card_info_struct_type::rca
uint16_t rca
Definition emmc_card/inc/at32_sdio.h:242
sd_card_info_struct_type::card_type
uint8_t card_type
Definition emmc_card/inc/at32_sdio.h:243
sd_cid_struct_type::manufacturer_id
uint8_t manufacturer_id
Definition emmc_card/inc/at32_sdio.h:170
sd_csd_struct_type::device_size
uint32_t device_size
Definition emmc_card/inc/at32_sdio.h:139


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • sdio
  • sdio_fatfs
  • inc
project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • sdio
  • sdio_fatfs
  • inc
project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • sdio
  • sdio_fatfs
  • inc
project/at_start_f413/examples/sdio/sdio_fatfs/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • sdio
  • sdio_fatfs
  • src
project/at_start_f413/examples/sdio/sdio_fatfs/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/sdio/sdio_fatfs/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • sdio
  • sdio_fatfs
  • src
project/at_start_f413/examples/sdio/sdio_fatfs/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/sdio/sdio_fatfs/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/sdio/sdio_fatfs/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/sdio/sdio_fatfs/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/sdio/sdio_fatfs/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/sdio/sdio_fatfs/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/sdio/sdio_fatfs/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/sdio/sdio_fatfs/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/sdio/sdio_fatfs/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/sdio/sdio_fatfs/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • sdio
  • sdio_fatfs
  • src
project/at_start_f413/examples/sdio/sdio_fatfs/src/main.c
Go to the documentation of this file.
1
26#include <stdbool.h>
27#include <string.h>
28#include "at32_sdio.h"
29#include "at32f413_board.h"
30#include "at32f413_clock.h"
31#include "ff.h"
32
41FATFS fs;
42FIL file;
43BYTE work[FF_MAX_SS];
44
45uint8_t buffer_compare(uint8_t* pbuffer1, uint8_t* pbuffer2, uint16_t buffer_length);
46static void sd_test_error(void);
47static void nvic_configuration(void);
48
56uint8_t buffer_compare(uint8_t* pbuffer1, uint8_t* pbuffer2, uint16_t buffer_length)
57{
58 while(buffer_length--)
59 {
60 if(*pbuffer1 != *pbuffer2)
61 {
62 return 0;
63 }
64 pbuffer1++;
65 pbuffer2++;
66 }
67 return 1;
68}
69
75static void sd_test_error(void)
76{
77 at32_led_on(LED2);
78 delay_ms(300);
79 at32_led_off(LED2);
80 delay_ms(300);
81}
82
88static void nvic_configuration(void)
89{
90 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
91 nvic_irq_enable(SDIO1_IRQn, 0, 0);
92}
93
100static error_status fatfs_test(void)
101{
102 FRESULT ret;
103 char filename[] = "1:/test1.txt";
104 const char wbuf[] = "this is my file for test fatfs!\r\n";
105 char rbuf[50];
106 UINT bytes_written = 0;
107 UINT bytes_read = 0;
108 DWORD fre_clust, fre_sect, tot_sect;
109 FATFS* pt_fs;
110
111 ret = f_mount(&fs, "1:", 1);
112 if(ret){
113 printf("fs mount err:%d.\r\n", ret);
114 if(ret == FR_NO_FILESYSTEM){
115 printf("create fatfs..\r\n");
116 ret = f_mkfs("1:", 0, work, sizeof(work));
117 if(ret){
118 printf("creates fatfs err:%d.\r\n", ret);
119 return ERROR;
120 }
121 else{
122 printf("creates fatfs ok.\r\n");
123 }
124 ret = f_mount(NULL, "1:", 1);
125 ret = f_mount(&fs, "1:", 1);
126 if(ret){
127 printf("fs mount err:%d.\r\n", ret);
128 return ERROR;
129 }
130 else{
131 printf("fs mount ok.\r\n");
132 }
133 }
134 else{
135 return ERROR;
136 }
137 }
138 else{
139 printf("fs mount ok.\r\n");
140 }
141
142 ret = f_open(&file, filename, FA_READ | FA_WRITE | FA_CREATE_ALWAYS);
143 if(ret){
144 printf("open file err:%d.\r\n", ret);
145 }
146 else{
147 printf("open file ok.\r\n");
148 }
149 ret = f_write(&file, wbuf, sizeof(wbuf), &bytes_written);
150 if(ret){
151 printf("write file err:%d.\r\n", ret);
152 }
153 else{
154 printf("write file ok, byte:%u.\r\n", bytes_written);
155 }
156 f_lseek(&file, 0);
157 ret = f_read(&file, rbuf, sizeof(rbuf), &bytes_read);
158 if(ret){
159 printf("read file err:%d.\r\n", ret);
160 }
161 else{
162 printf("read file ok, byte:%u.\r\n", bytes_read);
163 }
164 ret = f_close(&file);
165 if(ret){
166 printf("close file err:%d.\r\n", ret);
167 }
168 else{
169 printf("close file ok.\r\n");
170 }
171
172 pt_fs = &fs;
173 /* get volume information and free clusters of drive 1 */
174 ret = f_getfree("1:", &fre_clust, &pt_fs);
175 if(ret == FR_OK)
176 {
177 /* get total sectors and free sectors */
178 tot_sect = (pt_fs->n_fatent - 2) * pt_fs->csize;
179 fre_sect = fre_clust * pt_fs->csize;
180
181 /* print the free space (assuming 512 bytes/sector) */
182 printf("%10u KiB total drive space.\r\n%10u KiB available.\r\n", tot_sect / 2, fre_sect / 2);
183 }
184
185 ret = f_mount(NULL, "1:", 1);
186
187 if(1 == buffer_compare((uint8_t*)rbuf, (uint8_t*)wbuf, sizeof(wbuf))){
188 printf("r/w file data test ok.\r\n");
189 }
190 else{
191 printf("r/w file data test fail.\r\n");
192 return ERROR;
193 }
194
195 return SUCCESS;
196}
197
198/* gloable functions ---------------------------------------------------------*/
204int main(void)
205{
206 system_clock_config();
207
208 at32_board_init();
209
210 nvic_configuration();
211
212 uart_print_init(115200);
213 printf("start test fatfs r0.14b..\r\n");
214
215 if(SUCCESS != fatfs_test())
216 {
217 while(1)
218 {
219 sd_test_error();
220 }
221 }
222
223 /* all tests pass, led3 and led4 fresh */
224 while(1)
225 {
226 at32_led_toggle(LED3);
227 at32_led_toggle(LED4);
228 delay_ms(300);
229 }
230}
231
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
FF_MAX_SS
#define FF_MAX_SS
Definition ffconf.h:197
buffer_compare
uint8_t buffer_compare(uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t buffer_length)
compares two buffers.
Definition project/at_start_f413/examples/sdio/sdio_fatfs/src/main.c:56
file
FIL file
Definition project/at_start_f413/examples/sdio/sdio_fatfs/src/main.c:42
sd_test_error
static void sd_test_error(void)
led2 on off every 300ms for sd test failed.
Definition project/at_start_f413/examples/sdio/sdio_fatfs/src/main.c:75
work
BYTE work[FF_MAX_SS]
Definition project/at_start_f413/examples/sdio/sdio_fatfs/src/main.c:43
nvic_configuration
static void nvic_configuration(void)
configures sdio1 irq channel.
Definition project/at_start_f413/examples/sdio/sdio_fatfs/src/main.c:88
main
int main(void)
main function.
Definition project/at_start_f413/examples/sdio/sdio_fatfs/src/main.c:204
fatfs_test
static error_status fatfs_test(void)
fatfs file read/write test.
Definition project/at_start_f413/examples/sdio/sdio_fatfs/src/main.c:100
fs
FATFS fs
Definition project/at_start_f413/examples/sdio/sdio_fatfs/src/main.c:41
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
at32_led_off
void at32_led_off(led_type led)
turns selected led off.
Definition at32f413_board.c:287
uart_print_init
void uart_print_init(uint32_t baudrate)
initialize uart
Definition at32f413_board.c:129
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
SDIO1_IRQn
@ SDIO1_IRQn
Definition at32f413.h:219
error_status
error_status
error status
Definition at32f413.h:302
ERROR
@ ERROR
Definition at32f413.h:302
SUCCESS
@ SUCCESS
Definition at32f413.h:302
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
NULL
#define NULL
Definition emmc_card/inc/at32_sdio.h:340
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • spi
  • crc_transfer_polling
  • inc
project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • spi
  • crc_transfer_polling
  • inc
project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • spi
  • crc_transfer_polling
  • inc
project/at_start_f413/examples/spi/crc_transfer_polling/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • spi
  • crc_transfer_polling
  • src
project/at_start_f413/examples/spi/crc_transfer_polling/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/spi/crc_transfer_polling/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • spi
  • crc_transfer_polling
  • src
project/at_start_f413/examples/spi/crc_transfer_polling/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28#include "at32f413_board.h"
29
43void NMI_Handler(void)
44{
45}
46
52void HardFault_Handler(void)
53{
54 /* go to infinite loop when hard fault exception occurs */
55 while(1)
56 {
57 }
58}
59
65void MemManage_Handler(void)
66{
67 /* go to infinite loop when memory manage exception occurs */
68 while(1)
69 {
70 }
71}
72
78void BusFault_Handler(void)
79{
80 /* go to infinite loop when bus fault exception occurs */
81 while(1)
82 {
83 }
84}
85
91void UsageFault_Handler(void)
92{
93 /* go to infinite loop when usage fault exception occurs */
94 while(1)
95 {
96 }
97}
98
104void SVC_Handler(void)
105{
106}
107
113void DebugMon_Handler(void)
114{
115}
116
122void PendSV_Handler(void)
123{
124}
125
131void SysTick_Handler(void)
132{
133}
134
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/spi/crc_transfer_polling/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/spi/crc_transfer_polling/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/spi/crc_transfer_polling/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/spi/crc_transfer_polling/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/spi/crc_transfer_polling/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/spi/crc_transfer_polling/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/spi/crc_transfer_polling/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/spi/crc_transfer_polling/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/spi/crc_transfer_polling/src/at32f413_int.c:113
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • spi
  • crc_transfer_polling
  • src
project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include <stdio.h>
29
38#define SPI_MASTER_CS_HIGH gpio_bits_set(GPIOA, GPIO_PINS_4)
39#define SPI_MASTER_CS_LOW gpio_bits_reset(GPIOA, GPIO_PINS_4)
40#define BUFFER_SIZE 32
41
42uint16_t spi1_tx_buffer[BUFFER_SIZE] = {0x0102, 0x0304, 0x0506, 0x0708, 0x090A, 0x0B0C, 0x0D0E, 0x0F10,
43 0x1112, 0x1314, 0x1516, 0x1718, 0x191A, 0x1B1C, 0x1D1E, 0x1F20,
44 0x2122, 0x2324, 0x2526, 0x2728, 0x292A, 0x2B2C, 0x2D2E, 0x2F30,
45 0x3132, 0x3334, 0x3536, 0x3738, 0x393A, 0x3B3C, 0x3D3E, 0x3F40};
46uint16_t spi2_tx_buffer[BUFFER_SIZE] = {0x5152, 0x5354, 0x5556, 0x5758, 0x595A, 0x5B5C, 0x5D5E, 0x5F60,
47 0x6162, 0x6364, 0x6566, 0x6768, 0x696A, 0x6B6C, 0x6D6E, 0x6F70,
48 0x7172, 0x7374, 0x7576, 0x7778, 0x797A, 0x7B7C, 0x7D7E, 0x7F80,
49 0x8182, 0x8384, 0x8586, 0x8788, 0x898A, 0x8B8C, 0x8D8E, 0x8F90};
50uint16_t spi1_rx_buffer[BUFFER_SIZE], spi2_rx_buffer[BUFFER_SIZE];
51uint32_t tx_index = 0, rx_index = 0;
52__IO uint16_t crc1_value = 0, crc2_value = 0;
53volatile error_status transfer_status1 = ERROR, transfer_status2 = ERROR;
54
61 error_status buffer_compare(uint16_t* pbuffer1, uint16_t* pbuffer2, uint16_t buffer_length)
62{
63 while(buffer_length--)
64 {
65 if(*pbuffer1 != *pbuffer2)
66 {
67 return ERROR;
68 }
69 pbuffer1++;
70 pbuffer2++;
71 }
72 return SUCCESS;
73}
74
80static void spi_config(void)
81{
82 spi_init_type spi_init_struct;
83
84 /* master spi initialization */
85 crm_periph_clock_enable(CRM_SPI1_PERIPH_CLOCK, TRUE);
86 spi_default_para_init(&spi_init_struct);
87
88 /* dual line unidirectional full-duplex mode */
89 spi_init_struct.transmission_mode = SPI_TRANSMIT_FULL_DUPLEX;
90 spi_init_struct.master_slave_mode = SPI_MODE_MASTER;
91 spi_init_struct.mclk_freq_division = SPI_MCLK_DIV_8;
92 spi_init_struct.first_bit_transmission = SPI_FIRST_BIT_MSB;
93 spi_init_struct.frame_bit_num = SPI_FRAME_16BIT;
94 spi_init_struct.clock_polarity = SPI_CLOCK_POLARITY_LOW;
95 spi_init_struct.clock_phase = SPI_CLOCK_PHASE_2EDGE;
96 spi_init_struct.cs_mode_selection = SPI_CS_SOFTWARE_MODE;
97 spi_init(SPI1, &spi_init_struct);
98
99 /* hardware crc calculation config */
100 spi_crc_polynomial_set(SPI1, 7);
101 spi_crc_enable(SPI1, TRUE);
102
103 spi_enable(SPI1, TRUE);
104
105 /* slave spi initialization */
106 crm_periph_clock_enable(CRM_SPI2_PERIPH_CLOCK, TRUE);
107
108 /* dual line unidirectional full-duplex mode */
109 spi_init_struct.transmission_mode = SPI_TRANSMIT_FULL_DUPLEX;
110 spi_init_struct.master_slave_mode = SPI_MODE_SLAVE;
111 spi_init_struct.mclk_freq_division = SPI_MCLK_DIV_8;
112 spi_init_struct.first_bit_transmission = SPI_FIRST_BIT_MSB;
113 spi_init_struct.frame_bit_num = SPI_FRAME_16BIT;
114 spi_init_struct.clock_polarity = SPI_CLOCK_POLARITY_LOW;
115 spi_init_struct.clock_phase = SPI_CLOCK_PHASE_2EDGE;
116 spi_init_struct.cs_mode_selection = SPI_CS_HARDWARE_MODE;
117 spi_init(SPI2, &spi_init_struct);
118
119 /* hardware crc calculation config */
120 spi_crc_polynomial_set(SPI2, 7);
121 spi_crc_enable(SPI2, TRUE);
122
123 spi_enable(SPI2, TRUE);
124}
125
131static void gpio_config(void)
132{
133 gpio_init_type gpio_initstructure;
134 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
135 crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
136
137 /* master spi cs pin */
138 gpio_initstructure.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
139 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
140 gpio_initstructure.gpio_mode = GPIO_MODE_OUTPUT;
141 gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
142 gpio_initstructure.gpio_pins = GPIO_PINS_4;
143 gpio_init(GPIOA, &gpio_initstructure);
144
145 /* non communication time: master pull up CS pin release slave */
146 SPI_MASTER_CS_HIGH;
147
148 /* master spi sck pin */
149 gpio_initstructure.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
150 gpio_initstructure.gpio_pull = GPIO_PULL_DOWN;
151 gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
152 gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
153 gpio_initstructure.gpio_pins = GPIO_PINS_5;
154 gpio_init(GPIOA, &gpio_initstructure);
155
156 /* master spi miso pin */
157 gpio_initstructure.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
158 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
159 gpio_initstructure.gpio_mode = GPIO_MODE_INPUT;
160 gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
161 gpio_initstructure.gpio_pins = GPIO_PINS_6;
162 gpio_init(GPIOA, &gpio_initstructure);
163
164 /* master spi mosi pin */
165 gpio_initstructure.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
166 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
167 gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
168 gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
169 gpio_initstructure.gpio_pins = GPIO_PINS_7;
170 gpio_init(GPIOA, &gpio_initstructure);
171
172 /* slave spi cs pin */
173 gpio_initstructure.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
174 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
175 gpio_initstructure.gpio_mode = GPIO_MODE_INPUT;
176 gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
177 gpio_initstructure.gpio_pins = GPIO_PINS_12;
178 gpio_init(GPIOB, &gpio_initstructure);
179
180 /* slave spi sck pin */
181 gpio_initstructure.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
182 gpio_initstructure.gpio_pull = GPIO_PULL_DOWN;
183 gpio_initstructure.gpio_mode = GPIO_MODE_INPUT;
184 gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
185 gpio_initstructure.gpio_pins = GPIO_PINS_13;
186 gpio_init(GPIOB, &gpio_initstructure);
187
188 /* slave spi miso pin */
189 gpio_initstructure.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
190 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
191 gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
192 gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
193 gpio_initstructure.gpio_pins = GPIO_PINS_14;
194 gpio_init(GPIOB, &gpio_initstructure);
195
196 /* slave spi mosi pin */
197 gpio_initstructure.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
198 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
199 gpio_initstructure.gpio_mode = GPIO_MODE_INPUT;
200 gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
201 gpio_initstructure.gpio_pins = GPIO_PINS_15;
202 gpio_init(GPIOB, &gpio_initstructure);
203}
204
210int main(void)
211{
212 system_clock_config();
213 at32_board_init();
214 at32_led_on(LED4);
215 gpio_config();
216 spi_config();
217
218 /* start communication: master pull down CS pin select slave */
219 SPI_MASTER_CS_LOW;
220
221 /* transfer procedure:the "BUFFER_SIZE-1" data transfer */
222 while(tx_index < BUFFER_SIZE - 1)
223 {
224 /* slave and master transmit data fill */
225 while(spi_i2s_flag_get(SPI2, SPI_I2S_TDBE_FLAG) == RESET);
226 spi_i2s_data_transmit(SPI2, spi2_tx_buffer[tx_index]);
227 while(spi_i2s_flag_get(SPI1, SPI_I2S_TDBE_FLAG) == RESET);
228 spi_i2s_data_transmit(SPI1, spi1_tx_buffer[tx_index++]);
229
230 /* slave and master receive data get */
231 while(spi_i2s_flag_get(SPI2, SPI_I2S_RDBF_FLAG) == RESET);
232 spi2_rx_buffer[rx_index] = spi_i2s_data_receive(SPI2);
233 while(spi_i2s_flag_get(SPI1, SPI_I2S_RDBF_FLAG) == RESET);
234 spi1_rx_buffer[rx_index++] = spi_i2s_data_receive(SPI1);
235 }
236
237 /* wait master and slave transmit data buffer empty */
238 while(spi_i2s_flag_get(SPI1, SPI_I2S_TDBE_FLAG) == RESET);
239 while(spi_i2s_flag_get(SPI2, SPI_I2S_TDBE_FLAG) == RESET);
240
241 /* transfer procedure:the last data and crc transfer */
242 /* slave the last transmit data fill and crc transfer setting */
243 spi_i2s_data_transmit(SPI2, spi2_tx_buffer[tx_index]);
244 spi_crc_next_transmit(SPI2);
245
246 /* master the last transmit data fill and crc transfer setting */
247 spi_i2s_data_transmit(SPI1, spi1_tx_buffer[tx_index]);
248 spi_crc_next_transmit(SPI1);
249
250 /* wait master and slave the last data transfer end */
251 while(spi_i2s_flag_get(SPI1, SPI_I2S_RDBF_FLAG) == RESET);
252 spi1_rx_buffer[rx_index] = spi_i2s_data_receive(SPI1);
253 while(spi_i2s_flag_get(SPI2, SPI_I2S_RDBF_FLAG) == RESET);
254 spi2_rx_buffer[rx_index] = spi_i2s_data_receive(SPI2);
255
256 /* wait master and slave the crc transfer end */
257 while(spi_i2s_flag_get(SPI1, SPI_I2S_RDBF_FLAG) == RESET);
258 while(spi_i2s_flag_get(SPI2, SPI_I2S_RDBF_FLAG) == RESET);
259
260 /* wait master and slave idle when communication end */
261 while(spi_i2s_flag_get(SPI1, SPI_I2S_BF_FLAG) != RESET);
262 while(spi_i2s_flag_get(SPI2, SPI_I2S_BF_FLAG) != RESET);
263
264 /* end communication: master pull up CS pin release slave */
265 SPI_MASTER_CS_HIGH;
266
267 /* test result:the data and crc check */
268 transfer_status1 = buffer_compare(spi2_rx_buffer, spi1_tx_buffer, BUFFER_SIZE);
269 transfer_status2 = buffer_compare(spi1_rx_buffer, spi2_tx_buffer, BUFFER_SIZE);
270 if((spi_i2s_flag_get(SPI1, SPI_CCERR_FLAG)) != RESET)
271 {
272 spi_i2s_flag_clear(SPI1, SPI_CCERR_FLAG);
273 transfer_status2 = ERROR;
274 }
275 if((spi_i2s_flag_get(SPI2, SPI_CCERR_FLAG)) != RESET)
276 {
277 spi_i2s_flag_clear(SPI2, SPI_CCERR_FLAG);
278 transfer_status1 = ERROR;
279 }
280 crc1_value = spi_i2s_data_receive(SPI1);
281 crc2_value = spi_i2s_data_receive(SPI2);
282
283 /* test result indicate:if SUCCESS ,led2 lights */
284 if((transfer_status1 == SUCCESS) && (transfer_status2 == SUCCESS))
285 {
286 at32_led_on(LED2);
287 }
288 else
289 {
290 at32_led_on(LED3);
291 }
292 while(1)
293 {
294 }
295}
296
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
spi1_tx_buffer
uint16_t spi1_tx_buffer[32]
Definition project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c:42
SPI_MASTER_CS_HIGH
#define SPI_MASTER_CS_HIGH
Definition project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c:38
SPI_MASTER_CS_LOW
#define SPI_MASTER_CS_LOW
Definition project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c:39
buffer_compare
error_status buffer_compare(uint16_t *pbuffer1, uint16_t *pbuffer2, uint16_t buffer_length)
buffer compare function.
Definition project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c:61
spi_config
static void spi_config(void)
spi configuration.
Definition project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c:80
transfer_status1
volatile error_status transfer_status1
Definition project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c:53
spi2_tx_buffer
uint16_t spi2_tx_buffer[32]
Definition project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c:46
spi1_rx_buffer
uint16_t spi1_rx_buffer[32]
Definition project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c:50
BUFFER_SIZE
#define BUFFER_SIZE
Definition project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c:40
crc2_value
__IO uint16_t crc2_value
Definition project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c:52
transfer_status2
volatile error_status transfer_status2
Definition project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c:53
main
int main(void)
main function.
Definition project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c:210
rx_index
uint32_t rx_index
Definition project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c:51
tx_index
uint32_t tx_index
Definition project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c:51
spi2_rx_buffer
uint16_t spi2_rx_buffer[32]
Definition project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c:50
crc1_value
__IO uint16_t crc1_value
Definition project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c:52
gpio_config
static void gpio_config(void)
gpio configuration.
Definition project/at_start_f413/examples/spi/crc_transfer_polling/src/main.c:131
spi_init_struct
spi_init_type spi_init_struct
Definition project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c:41
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_SPI2_PERIPH_CLOCK
@ CRM_SPI2_PERIPH_CLOCK
Definition at32f413_crm.h:130
CRM_SPI1_PERIPH_CLOCK
@ CRM_SPI1_PERIPH_CLOCK
Definition at32f413_crm.h:117
CRM_GPIOB_PERIPH_CLOCK
@ CRM_GPIOB_PERIPH_CLOCK
Definition at32f413_crm.h:110
error_status
error_status
error status
Definition at32f413.h:302
ERROR
@ ERROR
Definition at32f413.h:302
SUCCESS
@ SUCCESS
Definition at32f413.h:302
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_MODE_OUTPUT
@ GPIO_MODE_OUTPUT
Definition at32f413_gpio.h:214
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_DOWN
@ GPIO_PULL_DOWN
Definition at32f413_gpio.h:245
GPIO_PULL_UP
@ GPIO_PULL_UP
Definition at32f413_gpio.h:244
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_6
#define GPIO_PINS_6
Definition at32f413_gpio.h:56
GPIO_PINS_7
#define GPIO_PINS_7
Definition at32f413_gpio.h:57
GPIO_PINS_13
#define GPIO_PINS_13
Definition at32f413_gpio.h:63
GPIO_PINS_12
#define GPIO_PINS_12
Definition at32f413_gpio.h:62
GPIO_PINS_14
#define GPIO_PINS_14
Definition at32f413_gpio.h:64
GPIO_PINS_4
#define GPIO_PINS_4
Definition at32f413_gpio.h:54
GPIO_PINS_15
#define GPIO_PINS_15
Definition at32f413_gpio.h:65
GPIO_PINS_5
#define GPIO_PINS_5
Definition at32f413_gpio.h:55
GPIOB
#define GPIOB
Definition at32f413_gpio.h:748
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
SPI_CCERR_FLAG
#define SPI_CCERR_FLAG
Definition at32f413_spi.h:56
SPI_I2S_TDBE_FLAG
#define SPI_I2S_TDBE_FLAG
Definition at32f413_spi.h:53
SPI_I2S_RDBF_FLAG
#define SPI_I2S_RDBF_FLAG
Definition at32f413_spi.h:52
SPI_I2S_BF_FLAG
#define SPI_I2S_BF_FLAG
Definition at32f413_spi.h:59
spi_i2s_data_transmit
void spi_i2s_data_transmit(spi_type *spi_x, uint16_t tx_data)
spi/i2s data transmit
Definition at32f413_spi.c:513
spi_crc_enable
void spi_crc_enable(spi_type *spi_x, confirm_state new_state)
enable or disable the hardware crc calculation for the spi peripheral.
Definition at32f413_spi.c:190
spi_i2s_flag_get
flag_status spi_i2s_flag_get(spi_type *spi_x, uint32_t spi_i2s_flag)
get flag of the specified spi/i2s peripheral.
Definition at32f413_spi.c:547
spi_crc_next_transmit
void spi_crc_next_transmit(spi_type *spi_x)
spi next transmit crc for the spi peripheral.
Definition at32f413_spi.c:151
spi_init
void spi_init(spi_type *spi_x, spi_init_type *spi_init_struct)
spi init config with its setting value.
Definition at32f413_spi.c:90
spi_default_para_init
void spi_default_para_init(spi_init_type *spi_init_struct)
spi init config with its default value.
Definition at32f413_spi.c:70
spi_crc_polynomial_set
void spi_crc_polynomial_set(spi_type *spi_x, uint16_t crc_poly)
set the crc polynomial value for the spi peripheral.
Definition at32f413_spi.c:164
spi_i2s_data_receive
uint16_t spi_i2s_data_receive(spi_type *spi_x)
spi/i2s data receive
Definition at32f413_spi.c:525
spi_i2s_flag_clear
void spi_i2s_flag_clear(spi_type *spi_x, uint32_t spi_i2s_flag)
clear flag of the specified spi/i2s peripheral.
Definition at32f413_spi.c:642
spi_enable
void spi_enable(spi_type *spi_x, confirm_state new_state)
enable or disable spi.
Definition at32f413_spi.c:286
SPI_MODE_SLAVE
@ SPI_MODE_SLAVE
Definition at32f413_spi.h:97
SPI_MODE_MASTER
@ SPI_MODE_MASTER
Definition at32f413_spi.h:98
SPI_CLOCK_PHASE_2EDGE
@ SPI_CLOCK_PHASE_2EDGE
Definition at32f413_spi.h:116
SPI_CS_SOFTWARE_MODE
@ SPI_CS_SOFTWARE_MODE
Definition at32f413_spi.h:125
SPI_CS_HARDWARE_MODE
@ SPI_CS_HARDWARE_MODE
Definition at32f413_spi.h:124
SPI_FIRST_BIT_MSB
@ SPI_FIRST_BIT_MSB
Definition at32f413_spi.h:150
SPI_CLOCK_POLARITY_LOW
@ SPI_CLOCK_POLARITY_LOW
Definition at32f413_spi.h:106
SPI_TRANSMIT_FULL_DUPLEX
@ SPI_TRANSMIT_FULL_DUPLEX
Definition at32f413_spi.h:159
SPI_MCLK_DIV_8
@ SPI_MCLK_DIV_8
Definition at32f413_spi.h:135
SPI_FRAME_16BIT
@ SPI_FRAME_16BIT
Definition at32f413_spi.h:89
SPI1
#define SPI1
Definition at32f413_spi.h:447
SPI2
#define SPI2
Definition at32f413_spi.h:448
at32f413_clock.h
header file of clock program
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
spi_init_type
spi init type
Definition at32f413_spi.h:256
spi_init_type::master_slave_mode
spi_master_slave_mode_type master_slave_mode
Definition at32f413_spi.h:258
spi_init_type::first_bit_transmission
spi_first_bit_type first_bit_transmission
Definition at32f413_spi.h:260
spi_init_type::frame_bit_num
spi_frame_bit_num_type frame_bit_num
Definition at32f413_spi.h:261
spi_init_type::clock_polarity
spi_clock_polarity_type clock_polarity
Definition at32f413_spi.h:262
spi_init_type::cs_mode_selection
spi_cs_mode_type cs_mode_selection
Definition at32f413_spi.h:264
spi_init_type::mclk_freq_division
spi_mclk_freq_div_type mclk_freq_division
Definition at32f413_spi.h:259
spi_init_type::transmission_mode
spi_transmission_mode_type transmission_mode
Definition at32f413_spi.h:257
spi_init_type::clock_phase
spi_clock_phase_type clock_phase
Definition at32f413_spi.h:263


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • spi
  • fullduplex_dma_jtagpin
  • inc
project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • spi
  • fullduplex_dma_jtagpin
  • inc
project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • spi
  • fullduplex_dma_jtagpin
  • inc
project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • spi
  • fullduplex_dma_jtagpin
  • src
project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • spi
  • fullduplex_dma_jtagpin
  • src
project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28#include "at32f413_board.h"
29
43void NMI_Handler(void)
44{
45}
46
52void HardFault_Handler(void)
53{
54 /* go to infinite loop when hard fault exception occurs */
55 while(1)
56 {
57 }
58}
59
65void MemManage_Handler(void)
66{
67 /* go to infinite loop when memory manage exception occurs */
68 while(1)
69 {
70 }
71}
72
78void BusFault_Handler(void)
79{
80 /* go to infinite loop when bus fault exception occurs */
81 while(1)
82 {
83 }
84}
85
91void UsageFault_Handler(void)
92{
93 /* go to infinite loop when usage fault exception occurs */
94 while(1)
95 {
96 }
97}
98
104void SVC_Handler(void)
105{
106}
107
113void DebugMon_Handler(void)
114{
115}
116
122void PendSV_Handler(void)
123{
124}
125
131void SysTick_Handler(void)
132{
133}
134
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/at32f413_int.c:113
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • spi
  • fullduplex_dma_jtagpin
  • src
project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37#define SPI_MASTER_CS_HIGH gpio_bits_set(GPIOA, GPIO_PINS_15)
38#define SPI_MASTER_CS_LOW gpio_bits_reset(GPIOA, GPIO_PINS_15)
39#define BUFFER_SIZE 32
40
41 spi_init_type spi_init_struct;
42uint8_t spi1_tx_buffer[BUFFER_SIZE] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
43 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
44 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
45 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20};
46uint8_t spi2_tx_buffer[BUFFER_SIZE] = {0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
47 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60,
48 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
49 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70};
50uint8_t spi1_rx_buffer[BUFFER_SIZE], spi2_rx_buffer[BUFFER_SIZE];
51volatile error_status transfer_status1 = ERROR, transfer_status2 = ERROR;
52
59 error_status buffer_compare(uint8_t* pbuffer1, uint8_t* pbuffer2, uint16_t bufferlength)
60{
61 while(bufferlength--)
62 {
63 if(*pbuffer1 != *pbuffer2)
64 {
65 return ERROR;
66 }
67
68 pbuffer1++;
69 pbuffer2++;
70 }
71 return SUCCESS;
72}
73
79static void dma_config(void)
80{
81 dma_init_type dma_init_struct;
82 crm_periph_clock_enable(CRM_DMA1_PERIPH_CLOCK, TRUE);
83
84 /* use dma1_channel3 as spi1 transmit channel */
85 dma_reset(DMA1_CHANNEL3);
86 dma_default_para_init(&dma_init_struct);
87 dma_init_struct.buffer_size = BUFFER_SIZE;
88 dma_init_struct.direction = DMA_DIR_MEMORY_TO_PERIPHERAL;
89 dma_init_struct.memory_base_addr = (uint32_t)spi1_tx_buffer;
90 dma_init_struct.memory_data_width = DMA_MEMORY_DATA_WIDTH_BYTE;
91 dma_init_struct.memory_inc_enable = TRUE;
92 dma_init_struct.peripheral_base_addr = (uint32_t)&(SPI1->dt);
93 dma_init_struct.peripheral_data_width = DMA_PERIPHERAL_DATA_WIDTH_BYTE;
94 dma_init_struct.peripheral_inc_enable = FALSE;
95 dma_init_struct.priority = DMA_PRIORITY_MEDIUM;
96 dma_init_struct.loop_mode_enable = FALSE;
97 dma_init(DMA1_CHANNEL3, &dma_init_struct);
98
99 /* use dma1_channel2 as spi1 receive channel */
100 dma_reset(DMA1_CHANNEL2);
101 dma_init_struct.buffer_size = BUFFER_SIZE;
102 dma_init_struct.direction = DMA_DIR_PERIPHERAL_TO_MEMORY;
103 dma_init_struct.memory_base_addr = (uint32_t)spi1_rx_buffer;
104 dma_init_struct.memory_data_width = DMA_MEMORY_DATA_WIDTH_BYTE;
105 dma_init_struct.memory_inc_enable = TRUE;
106 dma_init_struct.peripheral_base_addr = (uint32_t)&(SPI1->dt);
107 dma_init_struct.peripheral_data_width = DMA_PERIPHERAL_DATA_WIDTH_BYTE;
108 dma_init_struct.peripheral_inc_enable = FALSE;
109 dma_init_struct.priority = DMA_PRIORITY_MEDIUM;
110 dma_init_struct.loop_mode_enable = FALSE;
111 dma_init(DMA1_CHANNEL2, &dma_init_struct);
112
113 /* use dma1_channel5 as spi2 transmit channel */
114 dma_reset(DMA1_CHANNEL5);
115 dma_default_para_init(&dma_init_struct);
116 dma_init_struct.buffer_size = BUFFER_SIZE;
117 dma_init_struct.direction = DMA_DIR_MEMORY_TO_PERIPHERAL;
118 dma_init_struct.memory_base_addr = (uint32_t)spi2_tx_buffer;
119 dma_init_struct.memory_data_width = DMA_MEMORY_DATA_WIDTH_BYTE;
120 dma_init_struct.memory_inc_enable = TRUE;
121 dma_init_struct.peripheral_base_addr = (uint32_t)&(SPI2->dt);
122 dma_init_struct.peripheral_data_width = DMA_PERIPHERAL_DATA_WIDTH_BYTE;
123 dma_init_struct.peripheral_inc_enable = FALSE;
124 dma_init_struct.priority = DMA_PRIORITY_MEDIUM;
125 dma_init_struct.loop_mode_enable = FALSE;
126 dma_init(DMA1_CHANNEL5, &dma_init_struct);
127
128 /* use dma1_channel4 as spi2 receive channel */
129 dma_reset(DMA1_CHANNEL4);
130 dma_init_struct.buffer_size = BUFFER_SIZE;
131 dma_init_struct.direction = DMA_DIR_PERIPHERAL_TO_MEMORY;
132 dma_init_struct.memory_base_addr = (uint32_t)spi2_rx_buffer;
133 dma_init_struct.memory_data_width = DMA_MEMORY_DATA_WIDTH_BYTE;
134 dma_init_struct.memory_inc_enable = TRUE;
135 dma_init_struct.peripheral_base_addr = (uint32_t)&(SPI2->dt);
136 dma_init_struct.peripheral_data_width = DMA_PERIPHERAL_DATA_WIDTH_BYTE;
137 dma_init_struct.peripheral_inc_enable = FALSE;
138 dma_init_struct.priority = DMA_PRIORITY_MEDIUM;
139 dma_init_struct.loop_mode_enable = FALSE;
140 dma_init(DMA1_CHANNEL4, &dma_init_struct);
141}
142
148static void spi_config(void)
149{
150 /* spi master initialization */
151 crm_periph_clock_enable(CRM_SPI1_PERIPH_CLOCK, TRUE);
152 spi_default_para_init(&spi_init_struct);
153
154 /* dual line unidirectional full-duplex mode */
155 spi_init_struct.transmission_mode = SPI_TRANSMIT_FULL_DUPLEX;
156 spi_init_struct.master_slave_mode = SPI_MODE_MASTER;
157 spi_init_struct.mclk_freq_division = SPI_MCLK_DIV_8;
158 spi_init_struct.first_bit_transmission = SPI_FIRST_BIT_LSB;
159 spi_init_struct.frame_bit_num = SPI_FRAME_8BIT;
160 spi_init_struct.clock_polarity = SPI_CLOCK_POLARITY_LOW;
161 spi_init_struct.clock_phase = SPI_CLOCK_PHASE_2EDGE;
162 spi_init_struct.cs_mode_selection = SPI_CS_SOFTWARE_MODE;
163 spi_init(SPI1, &spi_init_struct);
164
165 /* use dma transmit and receive */
166 spi_i2s_dma_transmitter_enable(SPI1, TRUE);
167 spi_i2s_dma_receiver_enable(SPI1, TRUE);
168
169 spi_enable(SPI1, TRUE);
170
171 /* spi slave initialization */
172 crm_periph_clock_enable(CRM_SPI2_PERIPH_CLOCK, TRUE);
173
174 /* dual line unidirectional full-duplex mode */
175 spi_init_struct.transmission_mode = SPI_TRANSMIT_FULL_DUPLEX;
176 spi_init_struct.master_slave_mode = SPI_MODE_SLAVE;
177 spi_init_struct.mclk_freq_division = SPI_MCLK_DIV_8;
178 spi_init_struct.first_bit_transmission = SPI_FIRST_BIT_LSB;
179 spi_init_struct.frame_bit_num = SPI_FRAME_8BIT;
180 spi_init_struct.clock_polarity = SPI_CLOCK_POLARITY_LOW;
181 spi_init_struct.clock_phase = SPI_CLOCK_PHASE_2EDGE;
182 spi_init_struct.cs_mode_selection = SPI_CS_HARDWARE_MODE;
183 spi_init(SPI2, &spi_init_struct);
184
185 /* use dma transmit and receive */
186 spi_i2s_dma_transmitter_enable(SPI2, TRUE);
187 spi_i2s_dma_receiver_enable(SPI2, TRUE);
188
189 spi_enable(SPI2, TRUE);
190}
191
197static void gpio_config(void)
198{
199 gpio_init_type gpio_initstructure;
200 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
201 crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
202 crm_periph_clock_enable(CRM_IOMUX_PERIPH_CLOCK, TRUE);
203 gpio_pin_remap_config(SWJTAG_GMUX_010, TRUE);
204 gpio_pin_remap_config(SPI1_MUX_01, TRUE);
205 gpio_default_para_init(&gpio_initstructure);
206
207 /* spi master gpio initialization */
208 /* spi1 cs pin */
209 gpio_initstructure.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
210 gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
211 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
212 gpio_initstructure.gpio_mode = GPIO_MODE_OUTPUT;
213 gpio_initstructure.gpio_pins = GPIO_PINS_15;
214 gpio_init(GPIOA, &gpio_initstructure);
215
216 /* non communication time: master pull up CS pin release slave */
217 SPI_MASTER_CS_HIGH;
218
219 /* spi1 sck pin */
220 gpio_initstructure.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
221 gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
222 gpio_initstructure.gpio_pull = GPIO_PULL_DOWN;
223 gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
224 gpio_initstructure.gpio_pins = GPIO_PINS_3;
225 gpio_init(GPIOB, &gpio_initstructure);
226
227 /* spi1 miso pin */
228 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
229 gpio_initstructure.gpio_mode = GPIO_MODE_INPUT;
230 gpio_initstructure.gpio_pins = GPIO_PINS_4;
231 gpio_init(GPIOB, &gpio_initstructure);
232
233 /* spi1 mosi pin */
234 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
235 gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
236 gpio_initstructure.gpio_pins = GPIO_PINS_5;
237 gpio_init(GPIOB, &gpio_initstructure);
238
239 /* spi2 gpio initialization */
240 /* spi2 cs pin */
241 gpio_initstructure.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
242 gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
243 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
244 gpio_initstructure.gpio_mode = GPIO_MODE_INPUT;
245 gpio_initstructure.gpio_pins = GPIO_PINS_12;
246 gpio_init(GPIOB, &gpio_initstructure);
247
248 /* spi2 sck pin */
249 gpio_initstructure.gpio_pull = GPIO_PULL_DOWN;
250 gpio_initstructure.gpio_mode = GPIO_MODE_INPUT;
251 gpio_initstructure.gpio_pins = GPIO_PINS_13;
252 gpio_init(GPIOB, &gpio_initstructure);
253
254 /* spi2 miso pin */
255 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
256 gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
257 gpio_initstructure.gpio_pins = GPIO_PINS_14;
258 gpio_init(GPIOB, &gpio_initstructure);
259
260 /* spi2 mosi pin */
261 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
262 gpio_initstructure.gpio_mode = GPIO_MODE_INPUT;
263 gpio_initstructure.gpio_pins = GPIO_PINS_15;
264 gpio_init(GPIOB, &gpio_initstructure);
265}
266
272int main(void)
273{
274 __IO uint32_t index = 0;
275 system_clock_config();
276 at32_board_init();
277 at32_led_on(LED4);
278 dma_config();
279 gpio_config();
280 spi_config();
281
282 /* start communication: master pull down CS pin select slave */
283 SPI_MASTER_CS_LOW;
284
285 /* enable spi slave dma to fill and get data */
286 dma_channel_enable(DMA1_CHANNEL5, TRUE);
287 dma_channel_enable(DMA1_CHANNEL4, TRUE);
288
289 /* enable spi master dma to fill and get data */
290 dma_channel_enable(DMA1_CHANNEL2, TRUE);
291 dma_channel_enable(DMA1_CHANNEL3, TRUE);
292
293 /* wait master and slave spi data receive end */
294 while(dma_flag_get(DMA1_FDT2_FLAG) == RESET)
295 {
296 }
297 while(dma_flag_get(DMA1_FDT4_FLAG) == RESET)
298 {
299 }
300
301 /* wait master and slave idle when communication end */
302 while(spi_i2s_flag_get(SPI1, SPI_I2S_BF_FLAG) != RESET);
303 while(spi_i2s_flag_get(SPI2, SPI_I2S_BF_FLAG) != RESET);
304
305 /* end communication: master pull up CS pin release slave */
306 SPI_MASTER_CS_HIGH;
307
308 /* test result:the data check */
309 transfer_status1 = buffer_compare(spi2_rx_buffer, spi1_tx_buffer, BUFFER_SIZE);
310 transfer_status2 = buffer_compare(spi1_rx_buffer, spi2_tx_buffer, BUFFER_SIZE);
311
312 /* test result indicate:if SUCCESS ,led2 lights */
313 if((transfer_status1 == SUCCESS) && (transfer_status2 == SUCCESS))
314 {
315 at32_led_on(LED2);
316 }
317 else
318 {
319 at32_led_on(LED3);
320 }
321 while(1)
322 {
323 }
324}
325
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
dma_init_struct
dma_init_type dma_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:38
SPI_MASTER_CS_HIGH
#define SPI_MASTER_CS_HIGH
Definition project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c:37
SPI_MASTER_CS_LOW
#define SPI_MASTER_CS_LOW
Definition project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c:38
dma_config
static void dma_config(void)
dma configuration.
Definition project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c:79
buffer_compare
error_status buffer_compare(uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t bufferlength)
buffer compare function.
Definition project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c:59
spi_config
static void spi_config(void)
spi configuration.
Definition project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c:148
transfer_status1
volatile error_status transfer_status1
Definition project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c:51
BUFFER_SIZE
#define BUFFER_SIZE
Definition project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c:39
transfer_status2
volatile error_status transfer_status2
Definition project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c:51
main
int main(void)
main function.
Definition project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c:272
spi2_rx_buffer
uint8_t spi2_rx_buffer[32]
Definition project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c:50
spi_init_struct
spi_init_type spi_init_struct
Definition project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c:41
spi1_rx_buffer
uint8_t spi1_rx_buffer[32]
Definition project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c:50
spi2_tx_buffer
uint8_t spi2_tx_buffer[32]
Definition project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c:46
gpio_config
static void gpio_config(void)
gpio configuration.
Definition project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c:197
spi1_tx_buffer
uint8_t spi1_tx_buffer[32]
Definition project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c:42
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_SPI2_PERIPH_CLOCK
@ CRM_SPI2_PERIPH_CLOCK
Definition at32f413_crm.h:130
CRM_IOMUX_PERIPH_CLOCK
@ CRM_IOMUX_PERIPH_CLOCK
Definition at32f413_crm.h:108
CRM_SPI1_PERIPH_CLOCK
@ CRM_SPI1_PERIPH_CLOCK
Definition at32f413_crm.h:117
CRM_GPIOB_PERIPH_CLOCK
@ CRM_GPIOB_PERIPH_CLOCK
Definition at32f413_crm.h:110
CRM_DMA1_PERIPH_CLOCK
@ CRM_DMA1_PERIPH_CLOCK
Definition at32f413_crm.h:103
dma_channel_enable
void dma_channel_enable(dma_channel_type *dmax_channely, confirm_state new_state)
enable or disable dma channely
Definition at32f413_dma.c:197
dma_default_para_init
void dma_default_para_init(dma_init_type *dma_init_struct)
dma init config with its default value.
Definition at32f413_dma.c:407
dma_flag_get
flag_status dma_flag_get(uint32_t dmax_flag)
get dma flag
Definition at32f413_dma.c:343
dma_reset
void dma_reset(dma_channel_type *dmax_channely)
reset the dmax channely registers.
Definition at32f413_dma.c:63
dma_init
void dma_init(dma_channel_type *dmax_channely, dma_init_type *dma_init_struct)
dma init
Definition at32f413_dma.c:442
DMA_PERIPHERAL_DATA_WIDTH_BYTE
@ DMA_PERIPHERAL_DATA_WIDTH_BYTE
Definition at32f413_dma.h:245
DMA_DIR_MEMORY_TO_PERIPHERAL
@ DMA_DIR_MEMORY_TO_PERIPHERAL
Definition at32f413_dma.h:217
DMA_DIR_PERIPHERAL_TO_MEMORY
@ DMA_DIR_PERIPHERAL_TO_MEMORY
Definition at32f413_dma.h:216
DMA_MEMORY_DATA_WIDTH_BYTE
@ DMA_MEMORY_DATA_WIDTH_BYTE
Definition at32f413_dma.h:255
DMA_PRIORITY_MEDIUM
@ DMA_PRIORITY_MEDIUM
Definition at32f413_dma.h:266
DMA1_FDT4_FLAG
#define DMA1_FDT4_FLAG
Definition at32f413_dma.h:93
DMA1_FDT2_FLAG
#define DMA1_FDT2_FLAG
Definition at32f413_dma.h:85
DMA1_CHANNEL3
#define DMA1_CHANNEL3
Definition at32f413_dma.h:482
DMA1_CHANNEL5
#define DMA1_CHANNEL5
Definition at32f413_dma.h:484
DMA1_CHANNEL4
#define DMA1_CHANNEL4
Definition at32f413_dma.h:483
DMA1_CHANNEL2
#define DMA1_CHANNEL2
Definition at32f413_dma.h:481
error_status
error_status
error status
Definition at32f413.h:302
ERROR
@ ERROR
Definition at32f413.h:302
SUCCESS
@ SUCCESS
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_pin_remap_config
void gpio_pin_remap_config(uint32_t gpio_remap, confirm_state new_state)
iomux remap and debug i/o configuration.
Definition at32f413_gpio.c:549
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_MODE_OUTPUT
@ GPIO_MODE_OUTPUT
Definition at32f413_gpio.h:214
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_DOWN
@ GPIO_PULL_DOWN
Definition at32f413_gpio.h:245
GPIO_PULL_UP
@ GPIO_PULL_UP
Definition at32f413_gpio.h:244
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_13
#define GPIO_PINS_13
Definition at32f413_gpio.h:63
GPIO_PINS_3
#define GPIO_PINS_3
Definition at32f413_gpio.h:53
GPIO_PINS_12
#define GPIO_PINS_12
Definition at32f413_gpio.h:62
GPIO_PINS_14
#define GPIO_PINS_14
Definition at32f413_gpio.h:64
GPIO_PINS_4
#define GPIO_PINS_4
Definition at32f413_gpio.h:54
GPIO_PINS_15
#define GPIO_PINS_15
Definition at32f413_gpio.h:65
GPIO_PINS_5
#define GPIO_PINS_5
Definition at32f413_gpio.h:55
GPIOB
#define GPIOB
Definition at32f413_gpio.h:748
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
SWJTAG_GMUX_010
#define SWJTAG_GMUX_010
Definition at32f413_gpio.h:196
SPI1_MUX_01
#define SPI1_MUX_01
Definition at32f413_gpio.h:80
SPI_I2S_BF_FLAG
#define SPI_I2S_BF_FLAG
Definition at32f413_spi.h:59
spi_i2s_dma_receiver_enable
void spi_i2s_dma_receiver_enable(spi_type *spi_x, confirm_state new_state)
enable or disable the spi/i2s dma receiver mode.
Definition at32f413_spi.c:498
spi_i2s_flag_get
flag_status spi_i2s_flag_get(spi_type *spi_x, uint32_t spi_i2s_flag)
get flag of the specified spi/i2s peripheral.
Definition at32f413_spi.c:547
spi_init
void spi_init(spi_type *spi_x, spi_init_type *spi_init_struct)
spi init config with its setting value.
Definition at32f413_spi.c:90
spi_default_para_init
void spi_default_para_init(spi_init_type *spi_init_struct)
spi init config with its default value.
Definition at32f413_spi.c:70
spi_enable
void spi_enable(spi_type *spi_x, confirm_state new_state)
enable or disable spi.
Definition at32f413_spi.c:286
spi_i2s_dma_transmitter_enable
void spi_i2s_dma_transmitter_enable(spi_type *spi_x, confirm_state new_state)
enable or disable the spi/i2s dma transmitter mode.
Definition at32f413_spi.c:484
SPI_MODE_SLAVE
@ SPI_MODE_SLAVE
Definition at32f413_spi.h:97
SPI_MODE_MASTER
@ SPI_MODE_MASTER
Definition at32f413_spi.h:98
SPI_CLOCK_PHASE_2EDGE
@ SPI_CLOCK_PHASE_2EDGE
Definition at32f413_spi.h:116
SPI_CS_SOFTWARE_MODE
@ SPI_CS_SOFTWARE_MODE
Definition at32f413_spi.h:125
SPI_CS_HARDWARE_MODE
@ SPI_CS_HARDWARE_MODE
Definition at32f413_spi.h:124
SPI_FIRST_BIT_LSB
@ SPI_FIRST_BIT_LSB
Definition at32f413_spi.h:151
SPI_CLOCK_POLARITY_LOW
@ SPI_CLOCK_POLARITY_LOW
Definition at32f413_spi.h:106
SPI_TRANSMIT_FULL_DUPLEX
@ SPI_TRANSMIT_FULL_DUPLEX
Definition at32f413_spi.h:159
SPI_MCLK_DIV_8
@ SPI_MCLK_DIV_8
Definition at32f413_spi.h:135
SPI_FRAME_8BIT
@ SPI_FRAME_8BIT
Definition at32f413_spi.h:88
SPI1
#define SPI1
Definition at32f413_spi.h:447
SPI2
#define SPI2
Definition at32f413_spi.h:448
at32f413_clock.h
header file of clock program
dma_init_type
dma init type
Definition at32f413_dma.h:275
dma_init_type::loop_mode_enable
confirm_state loop_mode_enable
Definition at32f413_dma.h:284
dma_init_type::buffer_size
uint16_t buffer_size
Definition at32f413_dma.h:279
dma_init_type::memory_data_width
dma_memory_data_size_type memory_data_width
Definition at32f413_dma.h:283
dma_init_type::priority
dma_priority_level_type priority
Definition at32f413_dma.h:285
dma_init_type::peripheral_inc_enable
confirm_state peripheral_inc_enable
Definition at32f413_dma.h:280
dma_init_type::memory_inc_enable
confirm_state memory_inc_enable
Definition at32f413_dma.h:281
dma_init_type::direction
dma_dir_type direction
Definition at32f413_dma.h:278
dma_init_type::peripheral_base_addr
uint32_t peripheral_base_addr
Definition at32f413_dma.h:276
dma_init_type::memory_base_addr
uint32_t memory_base_addr
Definition at32f413_dma.h:277
dma_init_type::peripheral_data_width
dma_peripheral_data_size_type peripheral_data_width
Definition at32f413_dma.h:282
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
spi_init_type
spi init type
Definition at32f413_spi.h:256
spi_init_type::master_slave_mode
spi_master_slave_mode_type master_slave_mode
Definition at32f413_spi.h:258
spi_init_type::first_bit_transmission
spi_first_bit_type first_bit_transmission
Definition at32f413_spi.h:260
spi_init_type::frame_bit_num
spi_frame_bit_num_type frame_bit_num
Definition at32f413_spi.h:261
spi_init_type::clock_polarity
spi_clock_polarity_type clock_polarity
Definition at32f413_spi.h:262
spi_init_type::cs_mode_selection
spi_cs_mode_type cs_mode_selection
Definition at32f413_spi.h:264
spi_init_type::mclk_freq_division
spi_mclk_freq_div_type mclk_freq_division
Definition at32f413_spi.h:259
spi_init_type::transmission_mode
spi_transmission_mode_type transmission_mode
Definition at32f413_spi.h:257
spi_init_type::clock_phase
spi_clock_phase_type clock_phase
Definition at32f413_spi.h:263


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • spi
  • fullduplex_polling
  • inc
project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • spi
  • fullduplex_polling
  • inc
project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • spi
  • fullduplex_polling
  • inc
project/at_start_f413/examples/spi/fullduplex_polling/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • spi
  • fullduplex_polling
  • src
project/at_start_f413/examples/spi/fullduplex_polling/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/spi/fullduplex_polling/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • spi
  • fullduplex_polling
  • src
project/at_start_f413/examples/spi/fullduplex_polling/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28#include "at32f413_board.h"
29
43void NMI_Handler(void)
44{
45}
46
52void HardFault_Handler(void)
53{
54 /* go to infinite loop when hard fault exception occurs */
55 while(1)
56 {
57 }
58}
59
65void MemManage_Handler(void)
66{
67 /* go to infinite loop when memory manage exception occurs */
68 while(1)
69 {
70 }
71}
72
78void BusFault_Handler(void)
79{
80 /* go to infinite loop when bus fault exception occurs */
81 while(1)
82 {
83 }
84}
85
91void UsageFault_Handler(void)
92{
93 /* go to infinite loop when usage fault exception occurs */
94 while(1)
95 {
96 }
97}
98
104void SVC_Handler(void)
105{
106}
107
113void DebugMon_Handler(void)
114{
115}
116
122void PendSV_Handler(void)
123{
124}
125
131void SysTick_Handler(void)
132{
133}
134
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/spi/fullduplex_polling/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/spi/fullduplex_polling/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/spi/fullduplex_polling/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/spi/fullduplex_polling/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/spi/fullduplex_polling/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/spi/fullduplex_polling/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/spi/fullduplex_polling/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/spi/fullduplex_polling/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/spi/fullduplex_polling/src/at32f413_int.c:113
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • spi
  • fullduplex_polling
  • src
project/at_start_f413/examples/spi/fullduplex_polling/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include <stdio.h>
29
38#define SPI1_AS_MASTER_CS_HIGH gpio_bits_set(GPIOA, GPIO_PINS_4)
39#define SPI1_AS_MASTER_CS_LOW gpio_bits_reset(GPIOA, GPIO_PINS_4)
40
41#define SPI2_AS_MASTER_CS_HIGH gpio_bits_set(GPIOB, GPIO_PINS_12)
42#define SPI2_AS_MASTER_CS_LOW gpio_bits_reset(GPIOB, GPIO_PINS_12)
43#define BUFFER_SIZE 32
44
45 spi_init_type spi_init_struct;
46uint8_t spi1_tx_buffer[BUFFER_SIZE] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
47 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
48 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
49 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20};
50uint8_t spi2_tx_buffer[BUFFER_SIZE] = {0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
51 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60,
52 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
53 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70};
54uint8_t spi1_rx_buffer[BUFFER_SIZE], spi2_rx_buffer[BUFFER_SIZE];
55uint32_t tx_index = 0, rx_index = 0;
56volatile error_status transfer_status1 = ERROR, transfer_status2 = ERROR;
57volatile error_status transfer_status3 = ERROR, transfer_status4 = ERROR;
58
65 error_status buffer_compare(uint8_t* pbuffer1, uint8_t* pbuffer2, uint16_t bufferlength)
66{
67 while(bufferlength--)
68 {
69 if(*pbuffer1 != *pbuffer2)
70 {
71 return ERROR;
72 }
73
74 pbuffer1++;
75 pbuffer2++;
76 }
77 return SUCCESS;
78}
79
85static void spi_config(void)
86{
87 /* master spi initialization */
88 crm_periph_clock_enable(CRM_SPI1_PERIPH_CLOCK, TRUE);
89 spi_default_para_init(&spi_init_struct);
90
91 /* dual line unidirectional full-duplex mode */
92 spi_init_struct.transmission_mode = SPI_TRANSMIT_FULL_DUPLEX;
93 spi_init_struct.master_slave_mode = SPI_MODE_MASTER;
94 spi_init_struct.mclk_freq_division = SPI_MCLK_DIV_8;
95 spi_init_struct.first_bit_transmission = SPI_FIRST_BIT_LSB;
96 spi_init_struct.frame_bit_num = SPI_FRAME_8BIT;
97 spi_init_struct.clock_polarity = SPI_CLOCK_POLARITY_LOW;
98 spi_init_struct.clock_phase = SPI_CLOCK_PHASE_2EDGE;
99 spi_init_struct.cs_mode_selection = SPI_CS_SOFTWARE_MODE;
100 spi_init(SPI1, &spi_init_struct);
101
102 spi_enable(SPI1, TRUE);
103
104 /* slave spi initialization */
105 crm_periph_clock_enable(CRM_SPI2_PERIPH_CLOCK, TRUE);
106
107 /* dual line unidirectional full-duplex mode */
108 spi_init_struct.transmission_mode = SPI_TRANSMIT_FULL_DUPLEX;
109 spi_init_struct.master_slave_mode = SPI_MODE_SLAVE;
110 spi_init_struct.mclk_freq_division = SPI_MCLK_DIV_8;
111 spi_init_struct.first_bit_transmission = SPI_FIRST_BIT_LSB;
112 spi_init_struct.frame_bit_num = SPI_FRAME_8BIT;
113 spi_init_struct.clock_polarity = SPI_CLOCK_POLARITY_LOW;
114 spi_init_struct.clock_phase = SPI_CLOCK_PHASE_2EDGE;
115 spi_init_struct.cs_mode_selection = SPI_CS_HARDWARE_MODE;
116 spi_init(SPI2, &spi_init_struct);
117
118 spi_enable(SPI2, TRUE);
119}
120
126static void gpio_config(uint16_t spi1_mode, uint16_t spi2_mode)
127{
128 gpio_init_type gpio_initstructure;
129 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
130 crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
131 gpio_default_para_init(&gpio_initstructure);
132
133 /* spi1 cs pin */
134 gpio_initstructure.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
135 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
136 gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
137 if(spi1_mode == SPI_MODE_MASTER)
138 {
139 gpio_initstructure.gpio_mode = GPIO_MODE_OUTPUT;
140 }
141 else
142 {
143 gpio_initstructure.gpio_mode = GPIO_MODE_INPUT;
144 }
145 gpio_initstructure.gpio_pins = GPIO_PINS_4;
146 gpio_init(GPIOA, &gpio_initstructure);
147
148 /* spi1 sck pin */
149 gpio_initstructure.gpio_pull = GPIO_PULL_DOWN;
150 if(spi1_mode == SPI_MODE_MASTER)
151 {
152 gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
153 }
154 else
155 {
156 gpio_initstructure.gpio_mode = GPIO_MODE_INPUT;
157 }
158 gpio_initstructure.gpio_pins = GPIO_PINS_5;
159 gpio_init(GPIOA, &gpio_initstructure);
160
161 /* spi1 miso pin */
162 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
163 if(spi1_mode == SPI_MODE_MASTER)
164 {
165 gpio_initstructure.gpio_mode = GPIO_MODE_INPUT;
166 }
167 else
168 {
169 gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
170 }
171 gpio_initstructure.gpio_pins = GPIO_PINS_6;
172 gpio_init(GPIOA, &gpio_initstructure);
173
174 /* spi1 mosi pin */
175 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
176 if(spi1_mode == SPI_MODE_MASTER)
177 {
178 gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
179 }
180 else
181 {
182 gpio_initstructure.gpio_mode = GPIO_MODE_INPUT;
183 }
184 gpio_initstructure.gpio_pins = GPIO_PINS_7;
185 gpio_init(GPIOA, &gpio_initstructure);
186
187 /* spi2 cs pin */
188 gpio_initstructure.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
189 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
190 gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
191 if(spi2_mode == SPI_MODE_SLAVE)
192 {
193 gpio_initstructure.gpio_mode = GPIO_MODE_INPUT;
194 }
195 else
196 {
197 gpio_initstructure.gpio_mode = GPIO_MODE_OUTPUT;
198 }
199 gpio_initstructure.gpio_pins = GPIO_PINS_12;
200 gpio_init(GPIOB, &gpio_initstructure);
201
202 /* spi2 sck pin */
203 gpio_initstructure.gpio_pull = GPIO_PULL_DOWN;
204 if(spi2_mode == SPI_MODE_SLAVE)
205 {
206 gpio_initstructure.gpio_mode = GPIO_MODE_INPUT;
207 }
208 else
209 {
210 gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
211 }
212 gpio_initstructure.gpio_pins = GPIO_PINS_13;
213 gpio_init(GPIOB, &gpio_initstructure);
214
215 /* spi2 miso pin */
216 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
217 if(spi2_mode == SPI_MODE_SLAVE)
218 {
219 gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
220 }
221 else
222 {
223 gpio_initstructure.gpio_mode = GPIO_MODE_INPUT;
224 }
225 gpio_initstructure.gpio_pins = GPIO_PINS_14;
226 gpio_init(GPIOB, &gpio_initstructure);
227
228 /* spi2 mosi pin */
229 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
230 if(spi2_mode == SPI_MODE_SLAVE)
231 {
232 gpio_initstructure.gpio_mode = GPIO_MODE_INPUT;
233 }
234 else
235 {
236 gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
237 }
238 gpio_initstructure.gpio_pins = GPIO_PINS_15;
239 gpio_init(GPIOB, &gpio_initstructure);
240
241 /* non communication time: master pull up CS pin release slave */
242 if(spi1_mode == SPI_MODE_MASTER)
243 {
244 SPI1_AS_MASTER_CS_HIGH;
245 }
246 if(spi2_mode == SPI_MODE_MASTER)
247 {
248 SPI2_AS_MASTER_CS_HIGH;
249 }
250}
251
257int main(void)
258{
259 __IO uint32_t index = 0;
260 system_clock_config();
261 at32_board_init();
262 at32_led_on(LED4);
263 gpio_config(SPI_MODE_MASTER, SPI_MODE_SLAVE);
264 spi_config();
265
266 /* start communication: master pull down CS pin select slave */
267 SPI1_AS_MASTER_CS_LOW;
268
269 /* transfer procedure:the "BUFFER_SIZE" data transfer */
270 while(tx_index < BUFFER_SIZE)
271 {
272 /* slave and master transmit data fill */
273 while(spi_i2s_flag_get(SPI2, SPI_I2S_TDBE_FLAG) == RESET);
274 spi_i2s_data_transmit(SPI2, spi2_tx_buffer[tx_index]);
275 while(spi_i2s_flag_get(SPI1, SPI_I2S_TDBE_FLAG) == RESET);
276 spi_i2s_data_transmit(SPI1, spi1_tx_buffer[tx_index++]);
277
278 /* slave and master receive data get */
279 while(spi_i2s_flag_get(SPI2, SPI_I2S_RDBF_FLAG) == RESET);
280 spi2_rx_buffer[rx_index] = spi_i2s_data_receive(SPI2);
281 while(spi_i2s_flag_get(SPI1, SPI_I2S_RDBF_FLAG) == RESET);
282 spi1_rx_buffer[rx_index++] = spi_i2s_data_receive(SPI1);
283 }
284
285 /* wait master and slave idle when communication end */
286 while(spi_i2s_flag_get(SPI1, SPI_I2S_BF_FLAG) != RESET);
287 while(spi_i2s_flag_get(SPI2, SPI_I2S_BF_FLAG) != RESET);
288
289 /* end communication: master pull up CS pin release slave */
290 SPI1_AS_MASTER_CS_HIGH;
291
292 /* test result:the data check */
293 transfer_status1 = buffer_compare(spi2_rx_buffer, spi1_tx_buffer, BUFFER_SIZE);
294 transfer_status2 = buffer_compare(spi1_rx_buffer, spi2_tx_buffer, BUFFER_SIZE);
295
296 spi_enable(SPI1, FALSE);
297 spi_enable(SPI2, FALSE);
298
299 /* master & slave mode switch */
300 gpio_config(SPI_MODE_SLAVE, SPI_MODE_MASTER);
301 spi_init_struct.master_slave_mode =SPI_MODE_SLAVE;
302 spi_init_struct.cs_mode_selection = SPI_CS_HARDWARE_MODE;
303 spi_init(SPI1, &spi_init_struct);
304
305 spi_init_struct.master_slave_mode =SPI_MODE_MASTER;
306 spi_init_struct.cs_mode_selection = SPI_CS_SOFTWARE_MODE;
307 spi_init(SPI2, &spi_init_struct);
308
309 /* receive buffer clear */
310 tx_index = 0;
311 rx_index = 0;
312 for(index = 0; index < BUFFER_SIZE; index++)
313 {
314 spi1_rx_buffer[index] = 0;
315 spi2_rx_buffer[index] = 0;
316 }
317
318 spi_enable(SPI2, TRUE);
319 spi_enable(SPI1, TRUE);
320
321 /* start communication: master pull down CS pin select slave */
322 SPI2_AS_MASTER_CS_LOW;
323
324 /* transfer procedure:the "BUFFER_SIZE" data transfer */
325 while(tx_index < BUFFER_SIZE)
326 {
327 /* slave and master transmit data fill */
328 while(spi_i2s_flag_get(SPI1, SPI_I2S_TDBE_FLAG) == RESET);
329 spi_i2s_data_transmit(SPI1, spi1_tx_buffer[tx_index]);
330 while(spi_i2s_flag_get(SPI2, SPI_I2S_TDBE_FLAG) == RESET);
331 spi_i2s_data_transmit(SPI2, spi2_tx_buffer[tx_index++]);
332
333 /* slave and master receive data get */
334 while(spi_i2s_flag_get(SPI1, SPI_I2S_RDBF_FLAG) == RESET);
335 spi1_rx_buffer[rx_index] = spi_i2s_data_receive(SPI1);
336 while(spi_i2s_flag_get(SPI2, SPI_I2S_RDBF_FLAG) == RESET);
337 spi2_rx_buffer[rx_index++] = spi_i2s_data_receive(SPI2);
338 }
339
340 /* wait master and slave idle when communication end */
341 while(spi_i2s_flag_get(SPI2, SPI_I2S_BF_FLAG) != RESET);
342 while(spi_i2s_flag_get(SPI1, SPI_I2S_BF_FLAG) != RESET);
343
344 /* end communication: master pull up CS pin release slave */
345 SPI2_AS_MASTER_CS_HIGH;
346
347 /* test result:the data check */
348 transfer_status3 = buffer_compare(spi2_rx_buffer, spi1_tx_buffer, BUFFER_SIZE);
349 transfer_status4 = buffer_compare(spi1_rx_buffer, spi2_tx_buffer, BUFFER_SIZE);
350
351 /* test result indicate:if SUCCESS ,led2 lights */
352 if((transfer_status1 == SUCCESS) && (transfer_status2 == SUCCESS) && \
353 (transfer_status3 == SUCCESS) && (transfer_status4 == SUCCESS))
354 {
355 at32_led_on(LED2);
356 }
357 else
358 {
359 at32_led_on(LED3);
360 }
361 while(1)
362 {
363 }
364}
365
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
gpio_config
static void gpio_config(void)
gpio configuration.
Definition project/at_start_f413/examples/adc/combine_mode_ordinary_simult/src/main.c:46
SPI1_AS_MASTER_CS_HIGH
#define SPI1_AS_MASTER_CS_HIGH
Definition project/at_start_f413/examples/spi/fullduplex_polling/src/main.c:38
buffer_compare
error_status buffer_compare(uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t bufferlength)
buffer compare function.
Definition project/at_start_f413/examples/spi/fullduplex_polling/src/main.c:65
transfer_status3
volatile error_status transfer_status3
Definition project/at_start_f413/examples/spi/fullduplex_polling/src/main.c:57
spi_config
static void spi_config(void)
spi configuration.
Definition project/at_start_f413/examples/spi/fullduplex_polling/src/main.c:85
transfer_status1
volatile error_status transfer_status1
Definition project/at_start_f413/examples/spi/fullduplex_polling/src/main.c:56
SPI2_AS_MASTER_CS_HIGH
#define SPI2_AS_MASTER_CS_HIGH
Definition project/at_start_f413/examples/spi/fullduplex_polling/src/main.c:41
transfer_status4
volatile error_status transfer_status4
Definition project/at_start_f413/examples/spi/fullduplex_polling/src/main.c:57
BUFFER_SIZE
#define BUFFER_SIZE
Definition project/at_start_f413/examples/spi/fullduplex_polling/src/main.c:43
transfer_status2
volatile error_status transfer_status2
Definition project/at_start_f413/examples/spi/fullduplex_polling/src/main.c:56
SPI1_AS_MASTER_CS_LOW
#define SPI1_AS_MASTER_CS_LOW
Definition project/at_start_f413/examples/spi/fullduplex_polling/src/main.c:39
main
int main(void)
main function.
Definition project/at_start_f413/examples/spi/fullduplex_polling/src/main.c:257
spi2_rx_buffer
uint8_t spi2_rx_buffer[32]
Definition project/at_start_f413/examples/spi/fullduplex_polling/src/main.c:54
spi_init_struct
spi_init_type spi_init_struct
Definition project/at_start_f413/examples/spi/fullduplex_polling/src/main.c:45
spi1_rx_buffer
uint8_t spi1_rx_buffer[32]
Definition project/at_start_f413/examples/spi/fullduplex_polling/src/main.c:54
spi2_tx_buffer
uint8_t spi2_tx_buffer[32]
Definition project/at_start_f413/examples/spi/fullduplex_polling/src/main.c:50
rx_index
uint32_t rx_index
Definition project/at_start_f413/examples/spi/fullduplex_polling/src/main.c:55
tx_index
uint32_t tx_index
Definition project/at_start_f413/examples/spi/fullduplex_polling/src/main.c:55
SPI2_AS_MASTER_CS_LOW
#define SPI2_AS_MASTER_CS_LOW
Definition project/at_start_f413/examples/spi/fullduplex_polling/src/main.c:42
spi1_tx_buffer
uint8_t spi1_tx_buffer[32]
Definition project/at_start_f413/examples/spi/fullduplex_polling/src/main.c:46
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_SPI2_PERIPH_CLOCK
@ CRM_SPI2_PERIPH_CLOCK
Definition at32f413_crm.h:130
CRM_SPI1_PERIPH_CLOCK
@ CRM_SPI1_PERIPH_CLOCK
Definition at32f413_crm.h:117
CRM_GPIOB_PERIPH_CLOCK
@ CRM_GPIOB_PERIPH_CLOCK
Definition at32f413_crm.h:110
error_status
error_status
error status
Definition at32f413.h:302
ERROR
@ ERROR
Definition at32f413.h:302
SUCCESS
@ SUCCESS
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_MODE_OUTPUT
@ GPIO_MODE_OUTPUT
Definition at32f413_gpio.h:214
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_DOWN
@ GPIO_PULL_DOWN
Definition at32f413_gpio.h:245
GPIO_PULL_UP
@ GPIO_PULL_UP
Definition at32f413_gpio.h:244
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_6
#define GPIO_PINS_6
Definition at32f413_gpio.h:56
GPIO_PINS_7
#define GPIO_PINS_7
Definition at32f413_gpio.h:57
GPIO_PINS_13
#define GPIO_PINS_13
Definition at32f413_gpio.h:63
GPIO_PINS_12
#define GPIO_PINS_12
Definition at32f413_gpio.h:62
GPIO_PINS_14
#define GPIO_PINS_14
Definition at32f413_gpio.h:64
GPIO_PINS_4
#define GPIO_PINS_4
Definition at32f413_gpio.h:54
GPIO_PINS_15
#define GPIO_PINS_15
Definition at32f413_gpio.h:65
GPIO_PINS_5
#define GPIO_PINS_5
Definition at32f413_gpio.h:55
GPIOB
#define GPIOB
Definition at32f413_gpio.h:748
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
SPI_I2S_TDBE_FLAG
#define SPI_I2S_TDBE_FLAG
Definition at32f413_spi.h:53
SPI_I2S_RDBF_FLAG
#define SPI_I2S_RDBF_FLAG
Definition at32f413_spi.h:52
SPI_I2S_BF_FLAG
#define SPI_I2S_BF_FLAG
Definition at32f413_spi.h:59
spi_i2s_data_transmit
void spi_i2s_data_transmit(spi_type *spi_x, uint16_t tx_data)
spi/i2s data transmit
Definition at32f413_spi.c:513
spi_i2s_flag_get
flag_status spi_i2s_flag_get(spi_type *spi_x, uint32_t spi_i2s_flag)
get flag of the specified spi/i2s peripheral.
Definition at32f413_spi.c:547
spi_init
void spi_init(spi_type *spi_x, spi_init_type *spi_init_struct)
spi init config with its setting value.
Definition at32f413_spi.c:90
spi_default_para_init
void spi_default_para_init(spi_init_type *spi_init_struct)
spi init config with its default value.
Definition at32f413_spi.c:70
spi_i2s_data_receive
uint16_t spi_i2s_data_receive(spi_type *spi_x)
spi/i2s data receive
Definition at32f413_spi.c:525
spi_enable
void spi_enable(spi_type *spi_x, confirm_state new_state)
enable or disable spi.
Definition at32f413_spi.c:286
SPI_MODE_SLAVE
@ SPI_MODE_SLAVE
Definition at32f413_spi.h:97
SPI_MODE_MASTER
@ SPI_MODE_MASTER
Definition at32f413_spi.h:98
SPI_CLOCK_PHASE_2EDGE
@ SPI_CLOCK_PHASE_2EDGE
Definition at32f413_spi.h:116
SPI_CS_SOFTWARE_MODE
@ SPI_CS_SOFTWARE_MODE
Definition at32f413_spi.h:125
SPI_CS_HARDWARE_MODE
@ SPI_CS_HARDWARE_MODE
Definition at32f413_spi.h:124
SPI_FIRST_BIT_LSB
@ SPI_FIRST_BIT_LSB
Definition at32f413_spi.h:151
SPI_CLOCK_POLARITY_LOW
@ SPI_CLOCK_POLARITY_LOW
Definition at32f413_spi.h:106
SPI_TRANSMIT_FULL_DUPLEX
@ SPI_TRANSMIT_FULL_DUPLEX
Definition at32f413_spi.h:159
SPI_MCLK_DIV_8
@ SPI_MCLK_DIV_8
Definition at32f413_spi.h:135
SPI_FRAME_8BIT
@ SPI_FRAME_8BIT
Definition at32f413_spi.h:88
SPI1
#define SPI1
Definition at32f413_spi.h:447
SPI2
#define SPI2
Definition at32f413_spi.h:448
at32f413_clock.h
header file of clock program
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
spi_init_type
spi init type
Definition at32f413_spi.h:256
spi_init_type::master_slave_mode
spi_master_slave_mode_type master_slave_mode
Definition at32f413_spi.h:258
spi_init_type::first_bit_transmission
spi_first_bit_type first_bit_transmission
Definition at32f413_spi.h:260
spi_init_type::frame_bit_num
spi_frame_bit_num_type frame_bit_num
Definition at32f413_spi.h:261
spi_init_type::clock_polarity
spi_clock_polarity_type clock_polarity
Definition at32f413_spi.h:262
spi_init_type::cs_mode_selection
spi_cs_mode_type cs_mode_selection
Definition at32f413_spi.h:264
spi_init_type::mclk_freq_division
spi_mclk_freq_div_type mclk_freq_division
Definition at32f413_spi.h:259
spi_init_type::transmission_mode
spi_transmission_mode_type transmission_mode
Definition at32f413_spi.h:257
spi_init_type::clock_phase
spi_clock_phase_type clock_phase
Definition at32f413_spi.h:263


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • spi
  • halfduplex_dma_jtagpin
  • inc
project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • spi
  • halfduplex_dma_jtagpin
  • inc
project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • spi
  • halfduplex_dma_jtagpin
  • inc
project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • spi
  • halfduplex_dma_jtagpin
  • src
project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • spi
  • halfduplex_dma_jtagpin
  • src
project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28#include "at32f413_board.h"
29
43void NMI_Handler(void)
44{
45}
46
52void HardFault_Handler(void)
53{
54 /* go to infinite loop when hard fault exception occurs */
55 while(1)
56 {
57 }
58}
59
65void MemManage_Handler(void)
66{
67 /* go to infinite loop when memory manage exception occurs */
68 while(1)
69 {
70 }
71}
72
78void BusFault_Handler(void)
79{
80 /* go to infinite loop when bus fault exception occurs */
81 while(1)
82 {
83 }
84}
85
91void UsageFault_Handler(void)
92{
93 /* go to infinite loop when usage fault exception occurs */
94 while(1)
95 {
96 }
97}
98
104void SVC_Handler(void)
105{
106}
107
113void DebugMon_Handler(void)
114{
115}
116
122void PendSV_Handler(void)
123{
124}
125
131void SysTick_Handler(void)
132{
133}
134
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/at32f413_int.c:113
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • spi
  • halfduplex_dma_jtagpin
  • src
project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37#define SPI_MASTER_CS_HIGH gpio_bits_set(GPIOA, GPIO_PINS_15)
38#define SPI_MASTER_CS_LOW gpio_bits_reset(GPIOA, GPIO_PINS_15)
39#define BUFFER_SIZE 32
40
41 spi_init_type spi_init_struct;
42uint8_t spi1_tx_buffer[BUFFER_SIZE] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
43 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
44 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
45 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20};
46uint8_t spi2_rx_buffer[BUFFER_SIZE];
47volatile error_status transfer_status = ERROR;
48
55 error_status buffer_compare(uint8_t* pbuffer1, uint8_t* pbuffer2, uint16_t bufferlength)
56{
57 while(bufferlength--)
58 {
59 if(*pbuffer1 != *pbuffer2)
60 {
61 return ERROR;
62 }
63
64 pbuffer1++;
65 pbuffer2++;
66 }
67 return SUCCESS;
68}
69
75static void dma_config(void)
76{
77 dma_init_type dma_init_struct;
78 crm_periph_clock_enable(CRM_DMA1_PERIPH_CLOCK, TRUE);
79
80 /* use dma1_channel3 as spi1 transmit channel */
81 dma_reset(DMA1_CHANNEL3);
82 dma_default_para_init(&dma_init_struct);
83 dma_init_struct.buffer_size = BUFFER_SIZE;
84 dma_init_struct.direction = DMA_DIR_MEMORY_TO_PERIPHERAL;
85 dma_init_struct.memory_base_addr = (uint32_t)spi1_tx_buffer;
86 dma_init_struct.memory_data_width = DMA_MEMORY_DATA_WIDTH_BYTE;
87 dma_init_struct.memory_inc_enable = TRUE;
88 dma_init_struct.peripheral_base_addr = (uint32_t)&(SPI1->dt);
89 dma_init_struct.peripheral_data_width = DMA_PERIPHERAL_DATA_WIDTH_BYTE;
90 dma_init_struct.peripheral_inc_enable = FALSE;
91 dma_init_struct.priority = DMA_PRIORITY_MEDIUM;
92 dma_init_struct.loop_mode_enable = FALSE;
93 dma_init(DMA1_CHANNEL3, &dma_init_struct);
94
95 /* use dma1_channel4 as spi2 receive channel */
96 dma_reset(DMA1_CHANNEL4);
97 dma_init_struct.buffer_size = BUFFER_SIZE;
98 dma_init_struct.direction = DMA_DIR_PERIPHERAL_TO_MEMORY;
99 dma_init_struct.memory_base_addr = (uint32_t)spi2_rx_buffer;
100 dma_init_struct.memory_data_width = DMA_MEMORY_DATA_WIDTH_BYTE;
101 dma_init_struct.memory_inc_enable = TRUE;
102 dma_init_struct.peripheral_base_addr = (uint32_t)&(SPI2->dt);
103 dma_init_struct.peripheral_data_width = DMA_PERIPHERAL_DATA_WIDTH_BYTE;
104 dma_init_struct.peripheral_inc_enable = FALSE;
105 dma_init_struct.priority = DMA_PRIORITY_MEDIUM;
106 dma_init_struct.loop_mode_enable = FALSE;
107 dma_init(DMA1_CHANNEL4, &dma_init_struct);
108}
109
115static void spi_config(void)
116{
117 spi_init_type spi_init_struct;
118
119 /* spi master initialization */
120 crm_periph_clock_enable(CRM_SPI1_PERIPH_CLOCK, TRUE);
121 spi_default_para_init(&spi_init_struct);
122
123 /* single line bidirectional half duplex mode-transmitting */
124 spi_init_struct.transmission_mode = SPI_TRANSMIT_HALF_DUPLEX_TX;
125 spi_init_struct.master_slave_mode = SPI_MODE_MASTER;
126 spi_init_struct.mclk_freq_division = SPI_MCLK_DIV_8;
127 spi_init_struct.first_bit_transmission = SPI_FIRST_BIT_MSB;
128 spi_init_struct.frame_bit_num = SPI_FRAME_8BIT;
129 spi_init_struct.clock_polarity = SPI_CLOCK_POLARITY_LOW;
130 spi_init_struct.clock_phase = SPI_CLOCK_PHASE_2EDGE;
131 spi_init_struct.cs_mode_selection = SPI_CS_SOFTWARE_MODE;
132 spi_init(SPI1, &spi_init_struct);
133
134 /* use dma transmit */
135 spi_i2s_dma_transmitter_enable(SPI1, TRUE);
136
137 spi_enable(SPI1, TRUE);
138
139 /* spi slave initialization */
140 crm_periph_clock_enable(CRM_SPI2_PERIPH_CLOCK, TRUE);
141
142 /* single line bidirectional half duplex mode-receiving */
143 spi_init_struct.transmission_mode = SPI_TRANSMIT_HALF_DUPLEX_RX;
144 spi_init_struct.master_slave_mode = SPI_MODE_SLAVE;
145 spi_init_struct.mclk_freq_division = SPI_MCLK_DIV_8;
146 spi_init_struct.first_bit_transmission = SPI_FIRST_BIT_MSB;
147 spi_init_struct.frame_bit_num = SPI_FRAME_8BIT;
148 spi_init_struct.clock_polarity = SPI_CLOCK_POLARITY_LOW;
149 spi_init_struct.clock_phase = SPI_CLOCK_PHASE_2EDGE;
150 spi_init_struct.cs_mode_selection = SPI_CS_HARDWARE_MODE;
151 spi_init(SPI2, &spi_init_struct);
152
153 /* use dma receive */
154 spi_i2s_dma_receiver_enable(SPI2, TRUE);
155
156 spi_enable(SPI2, TRUE);
157}
158
164static void gpio_config(void)
165{
166 gpio_init_type gpio_initstructure;
167 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
168 crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
169 crm_periph_clock_enable(CRM_IOMUX_PERIPH_CLOCK, TRUE);
170 gpio_pin_remap_config(SWJTAG_GMUX_010, TRUE);
171 gpio_pin_remap_config(SPI1_MUX_01, TRUE);
172 gpio_default_para_init(&gpio_initstructure);
173
174 /* spi master gpio initialization */
175 /* spi1 cs pin */
176 gpio_initstructure.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
177 gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
178 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
179 gpio_initstructure.gpio_mode = GPIO_MODE_OUTPUT;
180 gpio_initstructure.gpio_pins = GPIO_PINS_15;
181 gpio_init(GPIOA, &gpio_initstructure);
182
183 /* non communication time: master pull up CS pin release slave */
184 SPI_MASTER_CS_HIGH;
185
186 /* spi1 sck pin */
187 gpio_initstructure.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
188 gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
189 gpio_initstructure.gpio_pull = GPIO_PULL_DOWN;
190 gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
191 gpio_initstructure.gpio_pins = GPIO_PINS_3;
192 gpio_init(GPIOB, &gpio_initstructure);
193
194 /* spi1 mosi pin */
195 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
196 gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
197 gpio_initstructure.gpio_pins = GPIO_PINS_5;
198 gpio_init(GPIOB, &gpio_initstructure);
199
200 /* spi2 gpio initialization */
201 /* spi2 cs pin */
202 gpio_initstructure.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
203 gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
204 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
205 gpio_initstructure.gpio_mode = GPIO_MODE_INPUT;
206 gpio_initstructure.gpio_pins = GPIO_PINS_12;
207 gpio_init(GPIOB, &gpio_initstructure);
208
209 /* spi2 sck pin */
210 gpio_initstructure.gpio_pull = GPIO_PULL_DOWN;
211 gpio_initstructure.gpio_mode = GPIO_MODE_INPUT;
212 gpio_initstructure.gpio_pins = GPIO_PINS_13;
213 gpio_init(GPIOB, &gpio_initstructure);
214
215 /* spi2 miso pin */
216 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
217 gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
218 gpio_initstructure.gpio_pins = GPIO_PINS_14;
219 gpio_init(GPIOB, &gpio_initstructure);
220}
221
227int main(void)
228{
229 __IO uint32_t index = 0;
230 system_clock_config();
231 at32_board_init();
232 at32_led_on(LED4);
233 dma_config();
234 gpio_config();
235 spi_config();
236
237 /* start communication: master pull down CS pin select slave */
238 SPI_MASTER_CS_LOW;
239
240 /* enable spi slave dma to get data */
241 dma_channel_enable(DMA1_CHANNEL4, TRUE);
242
243 /* enable spi master dma to fill data */
244 dma_channel_enable(DMA1_CHANNEL3, TRUE);
245
246 /* wait master spi data fill end */
247 while(dma_flag_get(DMA1_FDT3_FLAG) == RESET)
248 {
249 }
250
251 /* wait slave spi data get end */
252 while(dma_flag_get(DMA1_FDT4_FLAG) == RESET)
253 {
254 }
255
256 /* wait master and slave idle when communication end */
257 while(spi_i2s_flag_get(SPI1, SPI_I2S_BF_FLAG) != RESET);
258 while(spi_i2s_flag_get(SPI2, SPI_I2S_BF_FLAG) != RESET);
259
260 /* end communication: master pull up CS pin release slave */
261 SPI_MASTER_CS_HIGH;
262
263 /* test result:the data check */
264 transfer_status = buffer_compare(spi2_rx_buffer, spi1_tx_buffer, BUFFER_SIZE);
265
266 /* test result indicate:if SUCCESS ,led2 lights */
267 if(transfer_status == SUCCESS)
268 {
269 at32_led_on(LED2);
270 }
271 else
272 {
273 at32_led_on(LED3);
274 }
275 while(1)
276 {
277 }
278}
279
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
dma_init_struct
dma_init_type dma_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:38
SPI_MASTER_CS_HIGH
#define SPI_MASTER_CS_HIGH
Definition project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c:37
SPI_MASTER_CS_LOW
#define SPI_MASTER_CS_LOW
Definition project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c:38
dma_config
static void dma_config(void)
dma configuration.
Definition project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c:75
buffer_compare
error_status buffer_compare(uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t bufferlength)
buffer compare function.
Definition project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c:55
spi_config
static void spi_config(void)
spi configuration.
Definition project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c:115
BUFFER_SIZE
#define BUFFER_SIZE
Definition project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c:39
main
int main(void)
main function.
Definition project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c:227
spi2_rx_buffer
uint8_t spi2_rx_buffer[32]
Definition project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c:46
spi_init_struct
spi_init_type spi_init_struct
Definition project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c:41
gpio_config
static void gpio_config(void)
gpio configuration.
Definition project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c:164
transfer_status
volatile error_status transfer_status
Definition project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c:47
spi1_tx_buffer
uint8_t spi1_tx_buffer[32]
Definition project/at_start_f413/examples/spi/halfduplex_dma_jtagpin/src/main.c:42
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_SPI2_PERIPH_CLOCK
@ CRM_SPI2_PERIPH_CLOCK
Definition at32f413_crm.h:130
CRM_IOMUX_PERIPH_CLOCK
@ CRM_IOMUX_PERIPH_CLOCK
Definition at32f413_crm.h:108
CRM_SPI1_PERIPH_CLOCK
@ CRM_SPI1_PERIPH_CLOCK
Definition at32f413_crm.h:117
CRM_GPIOB_PERIPH_CLOCK
@ CRM_GPIOB_PERIPH_CLOCK
Definition at32f413_crm.h:110
CRM_DMA1_PERIPH_CLOCK
@ CRM_DMA1_PERIPH_CLOCK
Definition at32f413_crm.h:103
dma_channel_enable
void dma_channel_enable(dma_channel_type *dmax_channely, confirm_state new_state)
enable or disable dma channely
Definition at32f413_dma.c:197
dma_default_para_init
void dma_default_para_init(dma_init_type *dma_init_struct)
dma init config with its default value.
Definition at32f413_dma.c:407
dma_flag_get
flag_status dma_flag_get(uint32_t dmax_flag)
get dma flag
Definition at32f413_dma.c:343
dma_reset
void dma_reset(dma_channel_type *dmax_channely)
reset the dmax channely registers.
Definition at32f413_dma.c:63
dma_init
void dma_init(dma_channel_type *dmax_channely, dma_init_type *dma_init_struct)
dma init
Definition at32f413_dma.c:442
DMA_PERIPHERAL_DATA_WIDTH_BYTE
@ DMA_PERIPHERAL_DATA_WIDTH_BYTE
Definition at32f413_dma.h:245
DMA_DIR_MEMORY_TO_PERIPHERAL
@ DMA_DIR_MEMORY_TO_PERIPHERAL
Definition at32f413_dma.h:217
DMA_DIR_PERIPHERAL_TO_MEMORY
@ DMA_DIR_PERIPHERAL_TO_MEMORY
Definition at32f413_dma.h:216
DMA_MEMORY_DATA_WIDTH_BYTE
@ DMA_MEMORY_DATA_WIDTH_BYTE
Definition at32f413_dma.h:255
DMA_PRIORITY_MEDIUM
@ DMA_PRIORITY_MEDIUM
Definition at32f413_dma.h:266
DMA1_FDT4_FLAG
#define DMA1_FDT4_FLAG
Definition at32f413_dma.h:93
DMA1_FDT3_FLAG
#define DMA1_FDT3_FLAG
Definition at32f413_dma.h:89
DMA1_CHANNEL3
#define DMA1_CHANNEL3
Definition at32f413_dma.h:482
DMA1_CHANNEL4
#define DMA1_CHANNEL4
Definition at32f413_dma.h:483
error_status
error_status
error status
Definition at32f413.h:302
ERROR
@ ERROR
Definition at32f413.h:302
SUCCESS
@ SUCCESS
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_pin_remap_config
void gpio_pin_remap_config(uint32_t gpio_remap, confirm_state new_state)
iomux remap and debug i/o configuration.
Definition at32f413_gpio.c:549
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_MODE_OUTPUT
@ GPIO_MODE_OUTPUT
Definition at32f413_gpio.h:214
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_DOWN
@ GPIO_PULL_DOWN
Definition at32f413_gpio.h:245
GPIO_PULL_UP
@ GPIO_PULL_UP
Definition at32f413_gpio.h:244
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_13
#define GPIO_PINS_13
Definition at32f413_gpio.h:63
GPIO_PINS_3
#define GPIO_PINS_3
Definition at32f413_gpio.h:53
GPIO_PINS_12
#define GPIO_PINS_12
Definition at32f413_gpio.h:62
GPIO_PINS_14
#define GPIO_PINS_14
Definition at32f413_gpio.h:64
GPIO_PINS_15
#define GPIO_PINS_15
Definition at32f413_gpio.h:65
GPIO_PINS_5
#define GPIO_PINS_5
Definition at32f413_gpio.h:55
GPIOB
#define GPIOB
Definition at32f413_gpio.h:748
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
SWJTAG_GMUX_010
#define SWJTAG_GMUX_010
Definition at32f413_gpio.h:196
SPI1_MUX_01
#define SPI1_MUX_01
Definition at32f413_gpio.h:80
SPI_I2S_BF_FLAG
#define SPI_I2S_BF_FLAG
Definition at32f413_spi.h:59
spi_i2s_dma_receiver_enable
void spi_i2s_dma_receiver_enable(spi_type *spi_x, confirm_state new_state)
enable or disable the spi/i2s dma receiver mode.
Definition at32f413_spi.c:498
spi_i2s_flag_get
flag_status spi_i2s_flag_get(spi_type *spi_x, uint32_t spi_i2s_flag)
get flag of the specified spi/i2s peripheral.
Definition at32f413_spi.c:547
spi_init
void spi_init(spi_type *spi_x, spi_init_type *spi_init_struct)
spi init config with its setting value.
Definition at32f413_spi.c:90
spi_default_para_init
void spi_default_para_init(spi_init_type *spi_init_struct)
spi init config with its default value.
Definition at32f413_spi.c:70
spi_enable
void spi_enable(spi_type *spi_x, confirm_state new_state)
enable or disable spi.
Definition at32f413_spi.c:286
spi_i2s_dma_transmitter_enable
void spi_i2s_dma_transmitter_enable(spi_type *spi_x, confirm_state new_state)
enable or disable the spi/i2s dma transmitter mode.
Definition at32f413_spi.c:484
SPI_MODE_SLAVE
@ SPI_MODE_SLAVE
Definition at32f413_spi.h:97
SPI_MODE_MASTER
@ SPI_MODE_MASTER
Definition at32f413_spi.h:98
SPI_CLOCK_PHASE_2EDGE
@ SPI_CLOCK_PHASE_2EDGE
Definition at32f413_spi.h:116
SPI_CS_SOFTWARE_MODE
@ SPI_CS_SOFTWARE_MODE
Definition at32f413_spi.h:125
SPI_CS_HARDWARE_MODE
@ SPI_CS_HARDWARE_MODE
Definition at32f413_spi.h:124
SPI_FIRST_BIT_MSB
@ SPI_FIRST_BIT_MSB
Definition at32f413_spi.h:150
SPI_CLOCK_POLARITY_LOW
@ SPI_CLOCK_POLARITY_LOW
Definition at32f413_spi.h:106
SPI_TRANSMIT_HALF_DUPLEX_RX
@ SPI_TRANSMIT_HALF_DUPLEX_RX
Definition at32f413_spi.h:161
SPI_TRANSMIT_HALF_DUPLEX_TX
@ SPI_TRANSMIT_HALF_DUPLEX_TX
Definition at32f413_spi.h:162
SPI_MCLK_DIV_8
@ SPI_MCLK_DIV_8
Definition at32f413_spi.h:135
SPI_FRAME_8BIT
@ SPI_FRAME_8BIT
Definition at32f413_spi.h:88
SPI1
#define SPI1
Definition at32f413_spi.h:447
SPI2
#define SPI2
Definition at32f413_spi.h:448
at32f413_clock.h
header file of clock program
dma_init_type
dma init type
Definition at32f413_dma.h:275
dma_init_type::loop_mode_enable
confirm_state loop_mode_enable
Definition at32f413_dma.h:284
dma_init_type::buffer_size
uint16_t buffer_size
Definition at32f413_dma.h:279
dma_init_type::memory_data_width
dma_memory_data_size_type memory_data_width
Definition at32f413_dma.h:283
dma_init_type::priority
dma_priority_level_type priority
Definition at32f413_dma.h:285
dma_init_type::peripheral_inc_enable
confirm_state peripheral_inc_enable
Definition at32f413_dma.h:280
dma_init_type::memory_inc_enable
confirm_state memory_inc_enable
Definition at32f413_dma.h:281
dma_init_type::direction
dma_dir_type direction
Definition at32f413_dma.h:278
dma_init_type::peripheral_base_addr
uint32_t peripheral_base_addr
Definition at32f413_dma.h:276
dma_init_type::memory_base_addr
uint32_t memory_base_addr
Definition at32f413_dma.h:277
dma_init_type::peripheral_data_width
dma_peripheral_data_size_type peripheral_data_width
Definition at32f413_dma.h:282
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
spi_init_type
spi init type
Definition at32f413_spi.h:256
spi_init_type::master_slave_mode
spi_master_slave_mode_type master_slave_mode
Definition at32f413_spi.h:258
spi_init_type::first_bit_transmission
spi_first_bit_type first_bit_transmission
Definition at32f413_spi.h:260
spi_init_type::frame_bit_num
spi_frame_bit_num_type frame_bit_num
Definition at32f413_spi.h:261
spi_init_type::clock_polarity
spi_clock_polarity_type clock_polarity
Definition at32f413_spi.h:262
spi_init_type::cs_mode_selection
spi_cs_mode_type cs_mode_selection
Definition at32f413_spi.h:264
spi_init_type::mclk_freq_division
spi_mclk_freq_div_type mclk_freq_division
Definition at32f413_spi.h:259
spi_init_type::transmission_mode
spi_transmission_mode_type transmission_mode
Definition at32f413_spi.h:257
spi_init_type::clock_phase
spi_clock_phase_type clock_phase
Definition at32f413_spi.h:263


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • spi
  • halfduplex_interrupt
  • inc
project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • spi
  • halfduplex_interrupt
  • inc
project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • spi
  • halfduplex_interrupt
  • inc
project/at_start_f413/examples/spi/halfduplex_interrupt/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • spi
  • halfduplex_interrupt
  • src
project/at_start_f413/examples/spi/halfduplex_interrupt/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/spi/halfduplex_interrupt/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • spi
  • halfduplex_interrupt
  • src
project/at_start_f413/examples/spi/halfduplex_interrupt/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
134
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/spi/halfduplex_interrupt/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/spi/halfduplex_interrupt/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/spi/halfduplex_interrupt/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/spi/halfduplex_interrupt/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/spi/halfduplex_interrupt/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/spi/halfduplex_interrupt/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/spi/halfduplex_interrupt/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/spi/halfduplex_interrupt/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/spi/halfduplex_interrupt/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • spi
  • halfduplex_interrupt
  • src
project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37#define SPI_MASTER_CS_HIGH gpio_bits_set(GPIOA, GPIO_PINS_4)
38#define SPI_MASTER_CS_LOW gpio_bits_reset(GPIOA, GPIO_PINS_4)
39#define BUFFER_SIZE 32
40
41uint8_t spi1_tx_buffer[BUFFER_SIZE] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
42 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
43 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
44 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20};
45uint8_t spi2_rx_buffer[BUFFER_SIZE];
46volatile uint32_t tx_index = 0, rx_index = 0;
47volatile error_status transfer_status = ERROR;
48
55 error_status buffer_compare(uint8_t* pbuffer1, uint8_t* pbuffer2, uint16_t buffer_length)
56{
57 while(buffer_length--)
58 {
59 if(*pbuffer1 != *pbuffer2)
60 {
61 return ERROR;
62 }
63
64 pbuffer1++;
65 pbuffer2++;
66 }
67 return SUCCESS;
68}
69
75static void spi_config(void)
76{
77 spi_init_type spi_init_struct;
78
79 /* master spi initialization */
80 crm_periph_clock_enable(CRM_SPI1_PERIPH_CLOCK, TRUE);
81 nvic_irq_enable(SPI1_IRQn, 0, 0);
82 spi_default_para_init(&spi_init_struct);
83
84 /* single line bidirectional half duplex mode - transmitting */
85 spi_init_struct.transmission_mode = SPI_TRANSMIT_HALF_DUPLEX_TX;
86 spi_init_struct.master_slave_mode =SPI_MODE_MASTER;
87 spi_init_struct.mclk_freq_division = SPI_MCLK_DIV_8;
88 spi_init_struct.first_bit_transmission = SPI_FIRST_BIT_MSB;
89 spi_init_struct.frame_bit_num = SPI_FRAME_8BIT;
90 spi_init_struct.clock_polarity = SPI_CLOCK_POLARITY_LOW;
91 spi_init_struct.clock_phase = SPI_CLOCK_PHASE_2EDGE;
92 spi_init_struct.cs_mode_selection = SPI_CS_SOFTWARE_MODE;
93 spi_init(SPI1, &spi_init_struct);
94
95 /* enable transmit data buffer empty interrupt */
96 spi_i2s_interrupt_enable(SPI1, SPI_I2S_TDBE_INT, TRUE);
97
98 /* slave spi initialization */
99 crm_periph_clock_enable(CRM_SPI2_PERIPH_CLOCK, TRUE);
100 nvic_irq_enable(SPI2_IRQn, 0, 0);
101
102 /* single line bidirectional half duplex mode - receiving */
103 spi_init_struct.transmission_mode = SPI_TRANSMIT_HALF_DUPLEX_RX;
104 spi_init_struct.master_slave_mode =SPI_MODE_SLAVE;
105 spi_init_struct.mclk_freq_division = SPI_MCLK_DIV_8;
106 spi_init_struct.first_bit_transmission = SPI_FIRST_BIT_MSB;
107 spi_init_struct.frame_bit_num = SPI_FRAME_8BIT;
108 spi_init_struct.clock_polarity = SPI_CLOCK_POLARITY_LOW;
109 spi_init_struct.clock_phase = SPI_CLOCK_PHASE_2EDGE;
110 spi_init_struct.cs_mode_selection = SPI_CS_HARDWARE_MODE;
111 spi_init(SPI2, &spi_init_struct);
112
113 /* enable receive data buffer full interrupt */
114 spi_i2s_interrupt_enable(SPI2, SPI_I2S_RDBF_INT, TRUE);
115}
116
122static void gpio_config(void)
123{
124 gpio_init_type gpio_initstructure;
125 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
126 crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
127
128 gpio_default_para_init(&gpio_initstructure);
129
130 /* master spi cs pin */
131 gpio_initstructure.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
132 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
133 gpio_initstructure.gpio_mode = GPIO_MODE_OUTPUT;
134 gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
135 gpio_initstructure.gpio_pins = GPIO_PINS_4;
136 gpio_init(GPIOA, &gpio_initstructure);
137
138 /* non communication time: master pull up CS pin release slave */
139 SPI_MASTER_CS_HIGH;
140
141 /* master spi sck pin */
142 gpio_initstructure.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
143 gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
144 gpio_initstructure.gpio_pull = GPIO_PULL_DOWN;
145 gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
146 gpio_initstructure.gpio_pins = GPIO_PINS_5;
147 gpio_init(GPIOA, &gpio_initstructure);
148
149 /* master spi mosi pin */
150 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
151 gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
152 gpio_initstructure.gpio_pins = GPIO_PINS_7;
153 gpio_init(GPIOA, &gpio_initstructure);
154
155 /* slave spi cs pin */
156 gpio_initstructure.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
157 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
158 gpio_initstructure.gpio_mode = GPIO_MODE_INPUT;
159 gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
160 gpio_initstructure.gpio_pins = GPIO_PINS_12;
161 gpio_init(GPIOB, &gpio_initstructure);
162
163 /* slave spi sck pin */
164 gpio_initstructure.gpio_pull = GPIO_PULL_DOWN;
165 gpio_initstructure.gpio_mode = GPIO_MODE_INPUT;
166 gpio_initstructure.gpio_pins = GPIO_PINS_13;
167 gpio_init(GPIOB, &gpio_initstructure);
168
169 /* slave spi miso pin */
170 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
171 gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
172 gpio_initstructure.gpio_pins = GPIO_PINS_14;
173 gpio_init(GPIOB, &gpio_initstructure);
174}
175
181 void SPI1_IRQHandler(void)
182{
183 if(spi_i2s_interrupt_flag_get(SPI1, SPI_I2S_TDBE_FLAG) != RESET)
184 {
185 spi_i2s_data_transmit(SPI1, spi1_tx_buffer[tx_index++]);
186 if(tx_index == BUFFER_SIZE)
187 {
188 spi_i2s_interrupt_enable(SPI1, SPI_I2S_TDBE_INT, FALSE);
189 }
190 }
191}
192
198 void SPI2_IRQHandler(void)
199{
200 if(spi_i2s_interrupt_flag_get(SPI2, SPI_I2S_RDBF_FLAG) != RESET)
201 {
202 spi2_rx_buffer[rx_index++] = spi_i2s_data_receive(SPI2);
203 }
204}
205
211int main(void)
212{
213 system_clock_config();
214 at32_board_init();
215 at32_led_on(LED4);
216 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
217 gpio_config();
218 /* config spi1 send spi2 receive */
219 spi_config();
220
221 /* start communication: master pull down CS pin select slave */
222 SPI_MASTER_CS_LOW;
223
224 spi_enable(SPI2, TRUE);
225 spi_enable(SPI1, TRUE);
226
227 /* wait slave data receive end */
228 while(rx_index < BUFFER_SIZE);
229
230 /* wait master and slave idle when communication end */
231 while(spi_i2s_flag_get(SPI1, SPI_I2S_BF_FLAG) != RESET);
232 while(spi_i2s_flag_get(SPI2, SPI_I2S_BF_FLAG) != RESET);
233
234 /* end communication: master pull up CS pin release slave */
235 SPI_MASTER_CS_HIGH;
236
237 /* test result:the data check */
238 transfer_status = buffer_compare(spi2_rx_buffer, spi1_tx_buffer, BUFFER_SIZE);
239
240 /* test result indicate:if SUCCESS ,led2 lights */
241 if(transfer_status==SUCCESS)
242 {
243 at32_led_on(LED2);
244 }
245 else
246 {
247 at32_led_on(LED3);
248 }
249 while(1)
250 {
251 }
252}
253
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
spi_init_struct
spi_init_type spi_init_struct
Definition project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c:41
SPI_MASTER_CS_HIGH
#define SPI_MASTER_CS_HIGH
Definition project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c:37
buffer_compare
error_status buffer_compare(uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t buffer_length)
buffer compare function.
Definition project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c:55
SPI_MASTER_CS_LOW
#define SPI_MASTER_CS_LOW
Definition project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c:38
tx_index
volatile uint32_t tx_index
Definition project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c:46
spi_config
static void spi_config(void)
spi configuration.
Definition project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c:75
SPI2_IRQHandler
void SPI2_IRQHandler(void)
spi2 interrupt function
Definition project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c:198
BUFFER_SIZE
#define BUFFER_SIZE
Definition project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c:39
main
int main(void)
main function.
Definition project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c:211
spi2_rx_buffer
uint8_t spi2_rx_buffer[32]
Definition project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c:45
SPI1_IRQHandler
void SPI1_IRQHandler(void)
spi1 interrupt function
Definition project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c:181
rx_index
volatile uint32_t rx_index
Definition project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c:46
gpio_config
static void gpio_config(void)
gpio configuration.
Definition project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c:122
transfer_status
volatile error_status transfer_status
Definition project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c:47
spi1_tx_buffer
uint8_t spi1_tx_buffer[32]
Definition project/at_start_f413/examples/spi/halfduplex_interrupt/src/main.c:41
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_SPI2_PERIPH_CLOCK
@ CRM_SPI2_PERIPH_CLOCK
Definition at32f413_crm.h:130
CRM_SPI1_PERIPH_CLOCK
@ CRM_SPI1_PERIPH_CLOCK
Definition at32f413_crm.h:117
CRM_GPIOB_PERIPH_CLOCK
@ CRM_GPIOB_PERIPH_CLOCK
Definition at32f413_crm.h:110
SPI2_IRQn
@ SPI2_IRQn
Definition at32f413.h:208
SPI1_IRQn
@ SPI1_IRQn
Definition at32f413.h:207
error_status
error_status
error status
Definition at32f413.h:302
ERROR
@ ERROR
Definition at32f413.h:302
SUCCESS
@ SUCCESS
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_MODE_OUTPUT
@ GPIO_MODE_OUTPUT
Definition at32f413_gpio.h:214
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_DOWN
@ GPIO_PULL_DOWN
Definition at32f413_gpio.h:245
GPIO_PULL_UP
@ GPIO_PULL_UP
Definition at32f413_gpio.h:244
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_7
#define GPIO_PINS_7
Definition at32f413_gpio.h:57
GPIO_PINS_13
#define GPIO_PINS_13
Definition at32f413_gpio.h:63
GPIO_PINS_12
#define GPIO_PINS_12
Definition at32f413_gpio.h:62
GPIO_PINS_14
#define GPIO_PINS_14
Definition at32f413_gpio.h:64
GPIO_PINS_4
#define GPIO_PINS_4
Definition at32f413_gpio.h:54
GPIO_PINS_5
#define GPIO_PINS_5
Definition at32f413_gpio.h:55
GPIOB
#define GPIOB
Definition at32f413_gpio.h:748
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
SPI_I2S_TDBE_FLAG
#define SPI_I2S_TDBE_FLAG
Definition at32f413_spi.h:53
SPI_I2S_RDBF_FLAG
#define SPI_I2S_RDBF_FLAG
Definition at32f413_spi.h:52
SPI_I2S_BF_FLAG
#define SPI_I2S_BF_FLAG
Definition at32f413_spi.h:59
SPI_I2S_TDBE_INT
#define SPI_I2S_TDBE_INT
Definition at32f413_spi.h:73
SPI_I2S_RDBF_INT
#define SPI_I2S_RDBF_INT
Definition at32f413_spi.h:72
spi_i2s_interrupt_enable
void spi_i2s_interrupt_enable(spi_type *spi_x, uint32_t spi_i2s_int, confirm_state new_state)
enable or disable the specified spi/i2s interrupts.
Definition at32f413_spi.c:463
spi_i2s_data_transmit
void spi_i2s_data_transmit(spi_type *spi_x, uint16_t tx_data)
spi/i2s data transmit
Definition at32f413_spi.c:513
spi_i2s_flag_get
flag_status spi_i2s_flag_get(spi_type *spi_x, uint32_t spi_i2s_flag)
get flag of the specified spi/i2s peripheral.
Definition at32f413_spi.c:547
spi_init
void spi_init(spi_type *spi_x, spi_init_type *spi_init_struct)
spi init config with its setting value.
Definition at32f413_spi.c:90
spi_default_para_init
void spi_default_para_init(spi_init_type *spi_init_struct)
spi init config with its default value.
Definition at32f413_spi.c:70
spi_i2s_data_receive
uint16_t spi_i2s_data_receive(spi_type *spi_x)
spi/i2s data receive
Definition at32f413_spi.c:525
spi_i2s_interrupt_flag_get
flag_status spi_i2s_interrupt_flag_get(spi_type *spi_x, uint32_t spi_i2s_flag)
get interrupt flag of the specified spi/i2s peripheral.
Definition at32f413_spi.c:576
spi_enable
void spi_enable(spi_type *spi_x, confirm_state new_state)
enable or disable spi.
Definition at32f413_spi.c:286
SPI_MODE_SLAVE
@ SPI_MODE_SLAVE
Definition at32f413_spi.h:97
SPI_MODE_MASTER
@ SPI_MODE_MASTER
Definition at32f413_spi.h:98
SPI_CLOCK_PHASE_2EDGE
@ SPI_CLOCK_PHASE_2EDGE
Definition at32f413_spi.h:116
SPI_CS_SOFTWARE_MODE
@ SPI_CS_SOFTWARE_MODE
Definition at32f413_spi.h:125
SPI_CS_HARDWARE_MODE
@ SPI_CS_HARDWARE_MODE
Definition at32f413_spi.h:124
SPI_FIRST_BIT_MSB
@ SPI_FIRST_BIT_MSB
Definition at32f413_spi.h:150
SPI_CLOCK_POLARITY_LOW
@ SPI_CLOCK_POLARITY_LOW
Definition at32f413_spi.h:106
SPI_TRANSMIT_HALF_DUPLEX_RX
@ SPI_TRANSMIT_HALF_DUPLEX_RX
Definition at32f413_spi.h:161
SPI_TRANSMIT_HALF_DUPLEX_TX
@ SPI_TRANSMIT_HALF_DUPLEX_TX
Definition at32f413_spi.h:162
SPI_MCLK_DIV_8
@ SPI_MCLK_DIV_8
Definition at32f413_spi.h:135
SPI_FRAME_8BIT
@ SPI_FRAME_8BIT
Definition at32f413_spi.h:88
SPI1
#define SPI1
Definition at32f413_spi.h:447
SPI2
#define SPI2
Definition at32f413_spi.h:448
at32f413_clock.h
header file of clock program
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
spi_init_type
spi init type
Definition at32f413_spi.h:256
spi_init_type::master_slave_mode
spi_master_slave_mode_type master_slave_mode
Definition at32f413_spi.h:258
spi_init_type::first_bit_transmission
spi_first_bit_type first_bit_transmission
Definition at32f413_spi.h:260
spi_init_type::frame_bit_num
spi_frame_bit_num_type frame_bit_num
Definition at32f413_spi.h:261
spi_init_type::clock_polarity
spi_clock_polarity_type clock_polarity
Definition at32f413_spi.h:262
spi_init_type::cs_mode_selection
spi_cs_mode_type cs_mode_selection
Definition at32f413_spi.h:264
spi_init_type::mclk_freq_division
spi_mclk_freq_div_type mclk_freq_division
Definition at32f413_spi.h:259
spi_init_type::transmission_mode
spi_transmission_mode_type transmission_mode
Definition at32f413_spi.h:257
spi_init_type::clock_phase
spi_clock_phase_type clock_phase
Definition at32f413_spi.h:263


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • spi
  • halfduplex_transceiver_switch
  • inc
project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • spi
  • halfduplex_transceiver_switch
  • inc
project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • spi
  • halfduplex_transceiver_switch
  • inc
project/at_start_f413/examples/spi/halfduplex_transceiver_switch/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • spi
  • halfduplex_transceiver_switch
  • src
project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • spi
  • halfduplex_transceiver_switch
  • src
project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • spi
  • halfduplex_transceiver_switch
  • src
project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37#define SPI_MASTER_CS_HIGH gpio_bits_set(GPIOA, GPIO_PINS_4)
38#define SPI_MASTER_CS_LOW gpio_bits_reset(GPIOA, GPIO_PINS_4)
39#define BUFFER_SIZE 32
40
41 spi_init_type spi_init_struct;
42uint8_t spi1_tx_buffer[BUFFER_SIZE] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
43 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
44 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
45 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20};
46uint8_t spi2_tx_buffer[BUFFER_SIZE] = {0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
47 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60,
48 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
49 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70};
50uint8_t spi1_rx_buffer[BUFFER_SIZE], spi2_rx_buffer[BUFFER_SIZE];
51volatile uint32_t tx_index = 0, rx_index = 0;
52volatile error_status transfer_status1 = ERROR, transfer_status2 = ERROR;
53
60 error_status buffer_compare(uint8_t* pbuffer1, uint8_t* pbuffer2, uint16_t buffer_length)
61{
62 while(buffer_length--)
63 {
64 if(*pbuffer1 != *pbuffer2)
65 {
66 return ERROR;
67 }
68
69 pbuffer1++;
70 pbuffer2++;
71 }
72 return SUCCESS;
73}
74
80static void spi_config(void)
81{
82 /* master spi initialization */
83 crm_periph_clock_enable(CRM_SPI1_PERIPH_CLOCK, TRUE);
84 nvic_irq_enable(SPI1_IRQn, 0, 0);
85 spi_default_para_init(&spi_init_struct);
86
87 /* single line bidirectional half duplex mode - transmitting */
88 spi_init_struct.transmission_mode = SPI_TRANSMIT_HALF_DUPLEX_TX;
89 spi_init_struct.master_slave_mode = SPI_MODE_MASTER;
90 spi_init_struct.mclk_freq_division = SPI_MCLK_DIV_256;
91 spi_init_struct.first_bit_transmission = SPI_FIRST_BIT_MSB;
92 spi_init_struct.frame_bit_num = SPI_FRAME_8BIT;
93 spi_init_struct.clock_polarity = SPI_CLOCK_POLARITY_LOW;
94 spi_init_struct.clock_phase = SPI_CLOCK_PHASE_2EDGE;
95 spi_init_struct.cs_mode_selection = SPI_CS_SOFTWARE_MODE;
96 spi_init(SPI1, &spi_init_struct);
97
98 /* enable transmit data buffer empty interrupt */
99 spi_i2s_interrupt_enable(SPI1, SPI_I2S_TDBE_INT, TRUE);
100
101 /* slave spi initialization */
102 crm_periph_clock_enable(CRM_SPI2_PERIPH_CLOCK, TRUE);
103 nvic_irq_enable(SPI2_IRQn, 0, 0);
104
105 /* single line bidirectional half duplex mode - receiving */
106 spi_init_struct.transmission_mode = SPI_TRANSMIT_HALF_DUPLEX_RX;
107 spi_init_struct.master_slave_mode = SPI_MODE_SLAVE;
108 spi_init_struct.mclk_freq_division = SPI_MCLK_DIV_256;
109 spi_init_struct.first_bit_transmission = SPI_FIRST_BIT_MSB;
110 spi_init_struct.frame_bit_num = SPI_FRAME_8BIT;
111 spi_init_struct.clock_polarity = SPI_CLOCK_POLARITY_LOW;
112 spi_init_struct.clock_phase = SPI_CLOCK_PHASE_2EDGE;
113 spi_init_struct.cs_mode_selection = SPI_CS_HARDWARE_MODE;
114 spi_init(SPI2, &spi_init_struct);
115
116 /* enable receive data buffer full interrupt */
117 spi_i2s_interrupt_enable(SPI2, SPI_I2S_RDBF_INT, TRUE);
118}
119
125static void gpio_config(void)
126{
127 gpio_init_type gpio_initstructure;
128 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
129 crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
130 gpio_default_para_init(&gpio_initstructure);
131
132 /* master spi cs pin */
133 gpio_initstructure.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
134 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
135 gpio_initstructure.gpio_mode = GPIO_MODE_OUTPUT;
136 gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
137 gpio_initstructure.gpio_pins = GPIO_PINS_4;
138 gpio_init(GPIOA, &gpio_initstructure);
139
140 /* non communication time: master pull up CS pin release slave */
141 SPI_MASTER_CS_HIGH;
142
143 /* master spi sck pin */
144 gpio_initstructure.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
145 gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
146 gpio_initstructure.gpio_pull = GPIO_PULL_DOWN;
147 gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
148 gpio_initstructure.gpio_pins = GPIO_PINS_5;
149 gpio_init(GPIOA, &gpio_initstructure);
150
151 /* master spi mosi pin */
152 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
153 gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
154 gpio_initstructure.gpio_pins = GPIO_PINS_7;
155 gpio_init(GPIOA, &gpio_initstructure);
156
157 /* slave spi cs pin */
158 gpio_initstructure.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
159 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
160 gpio_initstructure.gpio_mode = GPIO_MODE_INPUT;
161 gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
162 gpio_initstructure.gpio_pins = GPIO_PINS_12;
163 gpio_init(GPIOB, &gpio_initstructure);
164
165 /* slave spi sck pin */
166 gpio_initstructure.gpio_pull = GPIO_PULL_DOWN;
167 gpio_initstructure.gpio_mode = GPIO_MODE_INPUT;
168 gpio_initstructure.gpio_pins = GPIO_PINS_13;
169 gpio_init(GPIOB, &gpio_initstructure);
170
171 /* slave spi miso pin */
172 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
173 gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
174 gpio_initstructure.gpio_pins = GPIO_PINS_14;
175 gpio_init(GPIOB, &gpio_initstructure);
176}
177
183 void SPI1_IRQHandler(void)
184{
185 if(spi_i2s_interrupt_flag_get(SPI1, SPI_I2S_TDBE_FLAG) != RESET)
186 {
187 spi_i2s_data_transmit(SPI1, spi1_tx_buffer[tx_index++]);
188 if(tx_index == BUFFER_SIZE)
189 {
190 spi_i2s_interrupt_enable(SPI1, SPI_I2S_TDBE_INT, FALSE);
191 }
192 }
193 if(spi_i2s_interrupt_flag_get(SPI1, SPI_I2S_RDBF_FLAG) != RESET)
194 {
195 spi_enable(SPI1, FALSE);
196 spi1_rx_buffer[rx_index++] = spi_i2s_data_receive(SPI1);
197 spi_enable(SPI1, TRUE);
198 if(rx_index == BUFFER_SIZE)
199 {
200 spi_i2s_interrupt_enable(SPI1, SPI_I2S_RDBF_INT, FALSE);
201 spi_enable(SPI1, FALSE);
202 }
203 }
204}
205
211 void SPI2_IRQHandler(void)
212{
213 if(spi_i2s_interrupt_flag_get(SPI2, SPI_I2S_TDBE_FLAG) != RESET)
214 {
215 spi_i2s_data_transmit(SPI2, spi2_tx_buffer[tx_index++]);
216 if(tx_index == BUFFER_SIZE)
217 {
218 spi_i2s_interrupt_enable(SPI2, SPI_I2S_TDBE_INT, FALSE);
219 }
220 }
221 if(spi_i2s_interrupt_flag_get(SPI2, SPI_I2S_RDBF_FLAG) != RESET)
222 {
223 spi2_rx_buffer[rx_index++] = spi_i2s_data_receive(SPI2);
224 }
225}
226
227
233int main(void)
234{
235 system_clock_config();
236 at32_board_init();
237 at32_led_on(LED4);
238 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
239 gpio_config();
240
241 /* config spi1 send spi2 receive */
242 spi_config();
243
244 /* start communication: master pull down CS pin select slave */
245 SPI_MASTER_CS_LOW;
246
247 spi_enable(SPI2, TRUE);
248 spi_enable(SPI1, TRUE);
249
250 /* wait data receive end */
251 while(rx_index < BUFFER_SIZE);
252
253 /* wait master and slave idle when communication end */
254 while(spi_i2s_flag_get(SPI1, SPI_I2S_BF_FLAG) != RESET);
255 while(spi_i2s_flag_get(SPI2, SPI_I2S_BF_FLAG) != RESET);
256
257 /* end communication: master pull up CS pin release slave */
258 SPI_MASTER_CS_HIGH;
259
260 /* test result:the data check */
261 transfer_status1 = buffer_compare(spi2_rx_buffer, spi1_tx_buffer, BUFFER_SIZE);
262
263 /* config spi2 send spi1 receive */
264 spi_enable(SPI1, FALSE);
265 spi_enable(SPI2, FALSE);
266
267 rx_index = 0;
268 tx_index = 0;
269 spi_i2s_interrupt_enable(SPI1, SPI_I2S_TDBE_INT, FALSE);
270 spi_i2s_interrupt_enable(SPI2, SPI_I2S_RDBF_INT, FALSE);
271
272 /* single line bidirectional half duplex mode - receiving */
273 spi_init_struct.transmission_mode = SPI_TRANSMIT_HALF_DUPLEX_RX;
274 spi_init_struct.master_slave_mode = SPI_MODE_MASTER;
275 spi_init_struct.cs_mode_selection = SPI_CS_SOFTWARE_MODE;
276 spi_init(SPI1, &spi_init_struct);
277
278 /* single line bidirectional half duplex mode - transmitting */
279 spi_init_struct.transmission_mode = SPI_TRANSMIT_HALF_DUPLEX_TX;
280 spi_init_struct.master_slave_mode = SPI_MODE_SLAVE;
281 spi_init_struct.cs_mode_selection = SPI_CS_HARDWARE_MODE;
282 spi_init(SPI2, &spi_init_struct);
283
284 spi_i2s_interrupt_enable(SPI1, SPI_I2S_RDBF_INT, TRUE);
285 spi_i2s_interrupt_enable(SPI2, SPI_I2S_TDBE_INT, TRUE);
286
287 /* start communication: master pull down CS pin select slave */
288 SPI_MASTER_CS_LOW;
289
290 spi_enable(SPI2, TRUE);
291 spi_enable(SPI1, TRUE);
292
293 /* wait slave data receive end */
294 while(rx_index < BUFFER_SIZE);
295
296 /* master half duplex receiving mode£¬the busy flag isnot usefull */
297
298 /* end communication: master pull up CS pin release slave */
299 SPI_MASTER_CS_HIGH;
300
301 /* test result:the data check */
302 transfer_status2 = buffer_compare(spi1_rx_buffer, spi2_tx_buffer, BUFFER_SIZE);
303
304 /* test result indicate:if passed ,led2 lights */
305 if((transfer_status1 == SUCCESS) && (transfer_status2 == SUCCESS))
306 {
307 at32_led_on(LED2);
308 }
309 else
310 {
311 at32_led_on(LED3);
312 }
313 while(1)
314 {
315 }
316}
317
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
SPI_MASTER_CS_HIGH
#define SPI_MASTER_CS_HIGH
Definition project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c:37
buffer_compare
error_status buffer_compare(uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t buffer_length)
buffer compare function.
Definition project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c:60
SPI_MASTER_CS_LOW
#define SPI_MASTER_CS_LOW
Definition project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c:38
tx_index
volatile uint32_t tx_index
Definition project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c:51
spi_config
static void spi_config(void)
spi configuration.
Definition project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c:80
transfer_status1
volatile error_status transfer_status1
Definition project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c:52
SPI2_IRQHandler
void SPI2_IRQHandler(void)
spi2 interrupt function
Definition project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c:211
BUFFER_SIZE
#define BUFFER_SIZE
Definition project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c:39
transfer_status2
volatile error_status transfer_status2
Definition project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c:52
main
int main(void)
main function.
Definition project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c:233
spi2_rx_buffer
uint8_t spi2_rx_buffer[32]
Definition project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c:50
spi_init_struct
spi_init_type spi_init_struct
Definition project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c:41
spi1_rx_buffer
uint8_t spi1_rx_buffer[32]
Definition project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c:50
spi2_tx_buffer
uint8_t spi2_tx_buffer[32]
Definition project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c:46
SPI1_IRQHandler
void SPI1_IRQHandler(void)
spi1 interrupt function
Definition project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c:183
rx_index
volatile uint32_t rx_index
Definition project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c:51
gpio_config
static void gpio_config(void)
gpio configuration.
Definition project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c:125
spi1_tx_buffer
uint8_t spi1_tx_buffer[32]
Definition project/at_start_f413/examples/spi/halfduplex_transceiver_switch/src/main.c:42
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_SPI2_PERIPH_CLOCK
@ CRM_SPI2_PERIPH_CLOCK
Definition at32f413_crm.h:130
CRM_SPI1_PERIPH_CLOCK
@ CRM_SPI1_PERIPH_CLOCK
Definition at32f413_crm.h:117
CRM_GPIOB_PERIPH_CLOCK
@ CRM_GPIOB_PERIPH_CLOCK
Definition at32f413_crm.h:110
SPI2_IRQn
@ SPI2_IRQn
Definition at32f413.h:208
SPI1_IRQn
@ SPI1_IRQn
Definition at32f413.h:207
error_status
error_status
error status
Definition at32f413.h:302
ERROR
@ ERROR
Definition at32f413.h:302
SUCCESS
@ SUCCESS
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_MODE_OUTPUT
@ GPIO_MODE_OUTPUT
Definition at32f413_gpio.h:214
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_DOWN
@ GPIO_PULL_DOWN
Definition at32f413_gpio.h:245
GPIO_PULL_UP
@ GPIO_PULL_UP
Definition at32f413_gpio.h:244
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_7
#define GPIO_PINS_7
Definition at32f413_gpio.h:57
GPIO_PINS_13
#define GPIO_PINS_13
Definition at32f413_gpio.h:63
GPIO_PINS_12
#define GPIO_PINS_12
Definition at32f413_gpio.h:62
GPIO_PINS_14
#define GPIO_PINS_14
Definition at32f413_gpio.h:64
GPIO_PINS_4
#define GPIO_PINS_4
Definition at32f413_gpio.h:54
GPIO_PINS_5
#define GPIO_PINS_5
Definition at32f413_gpio.h:55
GPIOB
#define GPIOB
Definition at32f413_gpio.h:748
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
SPI_I2S_TDBE_FLAG
#define SPI_I2S_TDBE_FLAG
Definition at32f413_spi.h:53
SPI_I2S_RDBF_FLAG
#define SPI_I2S_RDBF_FLAG
Definition at32f413_spi.h:52
SPI_I2S_BF_FLAG
#define SPI_I2S_BF_FLAG
Definition at32f413_spi.h:59
SPI_I2S_TDBE_INT
#define SPI_I2S_TDBE_INT
Definition at32f413_spi.h:73
SPI_I2S_RDBF_INT
#define SPI_I2S_RDBF_INT
Definition at32f413_spi.h:72
spi_i2s_interrupt_enable
void spi_i2s_interrupt_enable(spi_type *spi_x, uint32_t spi_i2s_int, confirm_state new_state)
enable or disable the specified spi/i2s interrupts.
Definition at32f413_spi.c:463
spi_i2s_data_transmit
void spi_i2s_data_transmit(spi_type *spi_x, uint16_t tx_data)
spi/i2s data transmit
Definition at32f413_spi.c:513
spi_i2s_flag_get
flag_status spi_i2s_flag_get(spi_type *spi_x, uint32_t spi_i2s_flag)
get flag of the specified spi/i2s peripheral.
Definition at32f413_spi.c:547
spi_init
void spi_init(spi_type *spi_x, spi_init_type *spi_init_struct)
spi init config with its setting value.
Definition at32f413_spi.c:90
spi_default_para_init
void spi_default_para_init(spi_init_type *spi_init_struct)
spi init config with its default value.
Definition at32f413_spi.c:70
spi_i2s_data_receive
uint16_t spi_i2s_data_receive(spi_type *spi_x)
spi/i2s data receive
Definition at32f413_spi.c:525
spi_i2s_interrupt_flag_get
flag_status spi_i2s_interrupt_flag_get(spi_type *spi_x, uint32_t spi_i2s_flag)
get interrupt flag of the specified spi/i2s peripheral.
Definition at32f413_spi.c:576
spi_enable
void spi_enable(spi_type *spi_x, confirm_state new_state)
enable or disable spi.
Definition at32f413_spi.c:286
SPI_MODE_SLAVE
@ SPI_MODE_SLAVE
Definition at32f413_spi.h:97
SPI_MODE_MASTER
@ SPI_MODE_MASTER
Definition at32f413_spi.h:98
SPI_CLOCK_PHASE_2EDGE
@ SPI_CLOCK_PHASE_2EDGE
Definition at32f413_spi.h:116
SPI_CS_SOFTWARE_MODE
@ SPI_CS_SOFTWARE_MODE
Definition at32f413_spi.h:125
SPI_CS_HARDWARE_MODE
@ SPI_CS_HARDWARE_MODE
Definition at32f413_spi.h:124
SPI_FIRST_BIT_MSB
@ SPI_FIRST_BIT_MSB
Definition at32f413_spi.h:150
SPI_CLOCK_POLARITY_LOW
@ SPI_CLOCK_POLARITY_LOW
Definition at32f413_spi.h:106
SPI_TRANSMIT_HALF_DUPLEX_RX
@ SPI_TRANSMIT_HALF_DUPLEX_RX
Definition at32f413_spi.h:161
SPI_TRANSMIT_HALF_DUPLEX_TX
@ SPI_TRANSMIT_HALF_DUPLEX_TX
Definition at32f413_spi.h:162
SPI_MCLK_DIV_256
@ SPI_MCLK_DIV_256
Definition at32f413_spi.h:140
SPI_FRAME_8BIT
@ SPI_FRAME_8BIT
Definition at32f413_spi.h:88
SPI1
#define SPI1
Definition at32f413_spi.h:447
SPI2
#define SPI2
Definition at32f413_spi.h:448
at32f413_clock.h
header file of clock program
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
spi_init_type
spi init type
Definition at32f413_spi.h:256
spi_init_type::master_slave_mode
spi_master_slave_mode_type master_slave_mode
Definition at32f413_spi.h:258
spi_init_type::first_bit_transmission
spi_first_bit_type first_bit_transmission
Definition at32f413_spi.h:260
spi_init_type::frame_bit_num
spi_frame_bit_num_type frame_bit_num
Definition at32f413_spi.h:261
spi_init_type::clock_polarity
spi_clock_polarity_type clock_polarity
Definition at32f413_spi.h:262
spi_init_type::cs_mode_selection
spi_cs_mode_type cs_mode_selection
Definition at32f413_spi.h:264
spi_init_type::mclk_freq_division
spi_mclk_freq_div_type mclk_freq_division
Definition at32f413_spi.h:259
spi_init_type::transmission_mode
spi_transmission_mode_type transmission_mode
Definition at32f413_spi.h:257
spi_init_type::clock_phase
spi_clock_phase_type clock_phase
Definition at32f413_spi.h:263


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • spi
  • only_receive_mode_polling
  • inc
project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • spi
  • only_receive_mode_polling
  • inc
project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • spi
  • only_receive_mode_polling
  • inc
project/at_start_f413/examples/spi/only_receive_mode_polling/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • spi
  • only_receive_mode_polling
  • src
project/at_start_f413/examples/spi/only_receive_mode_polling/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/spi/only_receive_mode_polling/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • spi
  • only_receive_mode_polling
  • src
project/at_start_f413/examples/spi/only_receive_mode_polling/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28#include "at32f413_board.h"
29
43void NMI_Handler(void)
44{
45}
46
52void HardFault_Handler(void)
53{
54 /* go to infinite loop when hard fault exception occurs */
55 while(1)
56 {
57 }
58}
59
65void MemManage_Handler(void)
66{
67 /* go to infinite loop when memory manage exception occurs */
68 while(1)
69 {
70 }
71}
72
78void BusFault_Handler(void)
79{
80 /* go to infinite loop when bus fault exception occurs */
81 while(1)
82 {
83 }
84}
85
91void UsageFault_Handler(void)
92{
93 /* go to infinite loop when usage fault exception occurs */
94 while(1)
95 {
96 }
97}
98
104void SVC_Handler(void)
105{
106}
107
113void DebugMon_Handler(void)
114{
115}
116
122void PendSV_Handler(void)
123{
124}
125
131void SysTick_Handler(void)
132{
133}
134
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/spi/only_receive_mode_polling/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/spi/only_receive_mode_polling/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/spi/only_receive_mode_polling/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/spi/only_receive_mode_polling/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/spi/only_receive_mode_polling/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/spi/only_receive_mode_polling/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/spi/only_receive_mode_polling/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/spi/only_receive_mode_polling/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/spi/only_receive_mode_polling/src/at32f413_int.c:113
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • spi
  • only_receive_mode_polling
  • src
project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37#define SPI_MASTER_CS_HIGH gpio_bits_set(GPIOA, GPIO_PINS_4)
38#define SPI_MASTER_CS_LOW gpio_bits_reset(GPIOA, GPIO_PINS_4)
39#define BUFFER_SIZE 32
40
41uint8_t spi1_tx_buffer[BUFFER_SIZE] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
42 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
43 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
44 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20};
45uint8_t spi2_rx_buffer[BUFFER_SIZE];
46uint32_t tx_index = 0, rx_index = 0;
47volatile error_status transfer_status = ERROR;
48
55 error_status buffer_compare(uint8_t* pbuffer1, uint8_t* pbuffer2, uint16_t buffer_length)
56{
57 while(buffer_length--)
58 {
59 if(*pbuffer1 != *pbuffer2)
60 {
61 return ERROR;
62 }
63
64 pbuffer1++;
65 pbuffer2++;
66 }
67 return SUCCESS;
68}
69
75static void spi_config(void)
76{
77 spi_init_type spi_init_struct;
78
79 /* master spi initialization */
80 crm_periph_clock_enable(CRM_SPI1_PERIPH_CLOCK, TRUE);
81 spi_default_para_init(&spi_init_struct);
82
83 /* dual line unidirectional full-duplex mode */
84 spi_init_struct.transmission_mode = SPI_TRANSMIT_FULL_DUPLEX;
85 spi_init_struct.master_slave_mode = SPI_MODE_MASTER;
86 spi_init_struct.mclk_freq_division = SPI_MCLK_DIV_8;
87 spi_init_struct.first_bit_transmission = SPI_FIRST_BIT_LSB;
88 spi_init_struct.frame_bit_num = SPI_FRAME_8BIT;
89 spi_init_struct.clock_polarity = SPI_CLOCK_POLARITY_LOW;
90 spi_init_struct.clock_phase = SPI_CLOCK_PHASE_2EDGE;
91 spi_init_struct.cs_mode_selection = SPI_CS_SOFTWARE_MODE;
92 spi_init(SPI1, &spi_init_struct);
93
94 spi_enable(SPI1, TRUE);
95
96 /* slave spi initialization */
97 crm_periph_clock_enable(CRM_SPI2_PERIPH_CLOCK, TRUE);
98
99 /* dual line unidirectional simplex receive-only mode */
100 spi_init_struct.transmission_mode = SPI_TRANSMIT_SIMPLEX_RX;
101 spi_init_struct.master_slave_mode = SPI_MODE_SLAVE;
102 spi_init_struct.mclk_freq_division = SPI_MCLK_DIV_8;
103 spi_init_struct.first_bit_transmission = SPI_FIRST_BIT_LSB;
104 spi_init_struct.frame_bit_num = SPI_FRAME_8BIT;
105 spi_init_struct.clock_polarity = SPI_CLOCK_POLARITY_LOW;
106 spi_init_struct.clock_phase = SPI_CLOCK_PHASE_2EDGE;
107 spi_init_struct.cs_mode_selection = SPI_CS_HARDWARE_MODE;
108 spi_init(SPI2, &spi_init_struct);
109
110 spi_enable(SPI2, TRUE);
111}
112
118static void gpio_config(void)
119{
120 gpio_init_type gpio_initstructure;
121 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
122 crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
123 gpio_default_para_init(&gpio_initstructure);
124
125 /* master spi cs pin */
126 gpio_initstructure.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
127 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
128 gpio_initstructure.gpio_mode = GPIO_MODE_OUTPUT;
129 gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
130 gpio_initstructure.gpio_pins = GPIO_PINS_4;
131 gpio_init(GPIOA, &gpio_initstructure);
132
133 /* non communication time: master pull up CS pin release slave */
134 SPI_MASTER_CS_HIGH;
135
136 /* master spi sck pin */
137 gpio_initstructure.gpio_pull = GPIO_PULL_DOWN;
138 gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
139 gpio_initstructure.gpio_pins = GPIO_PINS_5;
140 gpio_init(GPIOA, &gpio_initstructure);
141
142 /* master spi mosi pin */
143 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
144 gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
145 gpio_initstructure.gpio_pins = GPIO_PINS_7;
146 gpio_init(GPIOA, &gpio_initstructure);
147
148 /* slave spi cs pin */
149 gpio_initstructure.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
150 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
151 gpio_initstructure.gpio_mode = GPIO_MODE_INPUT;
152 gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
153 gpio_initstructure.gpio_pins = GPIO_PINS_12;
154 gpio_init(GPIOB, &gpio_initstructure);
155
156 /* slave spi sck pin */
157 gpio_initstructure.gpio_pull = GPIO_PULL_DOWN;
158 gpio_initstructure.gpio_mode = GPIO_MODE_INPUT;
159 gpio_initstructure.gpio_pins = GPIO_PINS_13;
160 gpio_init(GPIOB, &gpio_initstructure);
161
162 /* slave spi mosi pin */
163 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
164 gpio_initstructure.gpio_mode = GPIO_MODE_INPUT;
165 gpio_initstructure.gpio_pins = GPIO_PINS_15;
166 gpio_init(GPIOB, &gpio_initstructure);
167}
168
174int main(void)
175{
176 system_clock_config();
177 at32_board_init();
178 at32_led_on(LED4);
179 gpio_config();
180 spi_config();
181
182 /* start communication: master pull down CS pin select slave */
183 SPI_MASTER_CS_LOW;
184
185 /* transfer procedure:the "BUFFER_SIZE" data transfer */
186 while(tx_index < BUFFER_SIZE)
187 {
188 /* master transmit data fill */
189 while(spi_i2s_flag_get(SPI1, SPI_I2S_TDBE_FLAG) == RESET);
190 spi_i2s_data_transmit(SPI1, spi1_tx_buffer[tx_index++]);
191
192 /* slave receive data get */
193 while(spi_i2s_flag_get(SPI2, SPI_I2S_RDBF_FLAG) == RESET);
194 spi2_rx_buffer[rx_index++] = spi_i2s_data_receive(SPI2);
195 }
196
197 /* wait master and slave idle when communication end */
198 while(spi_i2s_flag_get(SPI1, SPI_I2S_BF_FLAG) != RESET);
199 while(spi_i2s_flag_get(SPI2, SPI_I2S_BF_FLAG) != RESET);
200
201 /* end communication: master pull up CS pin release slave */
202 SPI_MASTER_CS_HIGH;
203
204 /* test result:the data check */
205 transfer_status = buffer_compare(spi2_rx_buffer, spi1_tx_buffer, BUFFER_SIZE);
206
207 /* test result indicate:if SUCCESS ,led2 lights */
208 if(transfer_status == SUCCESS)
209 {
210 at32_led_on(LED2);
211 }
212 else
213 {
214 at32_led_on(LED3);
215 }
216 while(1)
217 {
218 }
219}
220
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
spi_init_struct
spi_init_type spi_init_struct
Definition project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c:41
SPI_MASTER_CS_HIGH
#define SPI_MASTER_CS_HIGH
Definition project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c:37
buffer_compare
error_status buffer_compare(uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t buffer_length)
buffer compare function.
Definition project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c:55
SPI_MASTER_CS_LOW
#define SPI_MASTER_CS_LOW
Definition project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c:38
spi_config
static void spi_config(void)
spi configuration.
Definition project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c:75
BUFFER_SIZE
#define BUFFER_SIZE
Definition project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c:39
main
int main(void)
main function.
Definition project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c:174
spi2_rx_buffer
uint8_t spi2_rx_buffer[32]
Definition project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c:45
rx_index
uint32_t rx_index
Definition project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c:46
tx_index
uint32_t tx_index
Definition project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c:46
gpio_config
static void gpio_config(void)
gpio configuration.
Definition project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c:118
transfer_status
volatile error_status transfer_status
Definition project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c:47
spi1_tx_buffer
uint8_t spi1_tx_buffer[32]
Definition project/at_start_f413/examples/spi/only_receive_mode_polling/src/main.c:41
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_SPI2_PERIPH_CLOCK
@ CRM_SPI2_PERIPH_CLOCK
Definition at32f413_crm.h:130
CRM_SPI1_PERIPH_CLOCK
@ CRM_SPI1_PERIPH_CLOCK
Definition at32f413_crm.h:117
CRM_GPIOB_PERIPH_CLOCK
@ CRM_GPIOB_PERIPH_CLOCK
Definition at32f413_crm.h:110
error_status
error_status
error status
Definition at32f413.h:302
ERROR
@ ERROR
Definition at32f413.h:302
SUCCESS
@ SUCCESS
Definition at32f413.h:302
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_MODE_OUTPUT
@ GPIO_MODE_OUTPUT
Definition at32f413_gpio.h:214
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_DOWN
@ GPIO_PULL_DOWN
Definition at32f413_gpio.h:245
GPIO_PULL_UP
@ GPIO_PULL_UP
Definition at32f413_gpio.h:244
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_7
#define GPIO_PINS_7
Definition at32f413_gpio.h:57
GPIO_PINS_13
#define GPIO_PINS_13
Definition at32f413_gpio.h:63
GPIO_PINS_12
#define GPIO_PINS_12
Definition at32f413_gpio.h:62
GPIO_PINS_4
#define GPIO_PINS_4
Definition at32f413_gpio.h:54
GPIO_PINS_15
#define GPIO_PINS_15
Definition at32f413_gpio.h:65
GPIO_PINS_5
#define GPIO_PINS_5
Definition at32f413_gpio.h:55
GPIOB
#define GPIOB
Definition at32f413_gpio.h:748
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
SPI_I2S_TDBE_FLAG
#define SPI_I2S_TDBE_FLAG
Definition at32f413_spi.h:53
SPI_I2S_RDBF_FLAG
#define SPI_I2S_RDBF_FLAG
Definition at32f413_spi.h:52
SPI_I2S_BF_FLAG
#define SPI_I2S_BF_FLAG
Definition at32f413_spi.h:59
spi_i2s_data_transmit
void spi_i2s_data_transmit(spi_type *spi_x, uint16_t tx_data)
spi/i2s data transmit
Definition at32f413_spi.c:513
spi_i2s_flag_get
flag_status spi_i2s_flag_get(spi_type *spi_x, uint32_t spi_i2s_flag)
get flag of the specified spi/i2s peripheral.
Definition at32f413_spi.c:547
spi_init
void spi_init(spi_type *spi_x, spi_init_type *spi_init_struct)
spi init config with its setting value.
Definition at32f413_spi.c:90
spi_default_para_init
void spi_default_para_init(spi_init_type *spi_init_struct)
spi init config with its default value.
Definition at32f413_spi.c:70
spi_i2s_data_receive
uint16_t spi_i2s_data_receive(spi_type *spi_x)
spi/i2s data receive
Definition at32f413_spi.c:525
spi_enable
void spi_enable(spi_type *spi_x, confirm_state new_state)
enable or disable spi.
Definition at32f413_spi.c:286
SPI_MODE_SLAVE
@ SPI_MODE_SLAVE
Definition at32f413_spi.h:97
SPI_MODE_MASTER
@ SPI_MODE_MASTER
Definition at32f413_spi.h:98
SPI_CLOCK_PHASE_2EDGE
@ SPI_CLOCK_PHASE_2EDGE
Definition at32f413_spi.h:116
SPI_CS_SOFTWARE_MODE
@ SPI_CS_SOFTWARE_MODE
Definition at32f413_spi.h:125
SPI_CS_HARDWARE_MODE
@ SPI_CS_HARDWARE_MODE
Definition at32f413_spi.h:124
SPI_FIRST_BIT_LSB
@ SPI_FIRST_BIT_LSB
Definition at32f413_spi.h:151
SPI_CLOCK_POLARITY_LOW
@ SPI_CLOCK_POLARITY_LOW
Definition at32f413_spi.h:106
SPI_TRANSMIT_FULL_DUPLEX
@ SPI_TRANSMIT_FULL_DUPLEX
Definition at32f413_spi.h:159
SPI_TRANSMIT_SIMPLEX_RX
@ SPI_TRANSMIT_SIMPLEX_RX
Definition at32f413_spi.h:160
SPI_MCLK_DIV_8
@ SPI_MCLK_DIV_8
Definition at32f413_spi.h:135
SPI_FRAME_8BIT
@ SPI_FRAME_8BIT
Definition at32f413_spi.h:88
SPI1
#define SPI1
Definition at32f413_spi.h:447
SPI2
#define SPI2
Definition at32f413_spi.h:448
at32f413_clock.h
header file of clock program
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
spi_init_type
spi init type
Definition at32f413_spi.h:256
spi_init_type::master_slave_mode
spi_master_slave_mode_type master_slave_mode
Definition at32f413_spi.h:258
spi_init_type::first_bit_transmission
spi_first_bit_type first_bit_transmission
Definition at32f413_spi.h:260
spi_init_type::frame_bit_num
spi_frame_bit_num_type frame_bit_num
Definition at32f413_spi.h:261
spi_init_type::clock_polarity
spi_clock_polarity_type clock_polarity
Definition at32f413_spi.h:262
spi_init_type::cs_mode_selection
spi_cs_mode_type cs_mode_selection
Definition at32f413_spi.h:264
spi_init_type::mclk_freq_division
spi_mclk_freq_div_type mclk_freq_division
Definition at32f413_spi.h:259
spi_init_type::transmission_mode
spi_transmission_mode_type transmission_mode
Definition at32f413_spi.h:257
spi_init_type::clock_phase
spi_clock_phase_type clock_phase
Definition at32f413_spi.h:263


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • spi
  • w25q_flash
  • inc
project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • spi
  • w25q_flash
  • inc
project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • spi
  • w25q_flash
  • inc
project/at_start_f413/examples/spi/w25q_flash/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • spi
  • w25q_flash
  • src
project/at_start_f413/examples/spi/w25q_flash/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/spi/w25q_flash/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • spi
  • w25q_flash
  • src
project/at_start_f413/examples/spi/w25q_flash/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28#include "at32f413_board.h"
29
43void NMI_Handler(void)
44{
45}
46
52void HardFault_Handler(void)
53{
54 /* go to infinite loop when hard fault exception occurs */
55 while(1)
56 {
57 }
58}
59
65void MemManage_Handler(void)
66{
67 /* go to infinite loop when memory manage exception occurs */
68 while(1)
69 {
70 }
71}
72
78void BusFault_Handler(void)
79{
80 /* go to infinite loop when bus fault exception occurs */
81 while(1)
82 {
83 }
84}
85
91void UsageFault_Handler(void)
92{
93 /* go to infinite loop when usage fault exception occurs */
94 while(1)
95 {
96 }
97}
98
104void SVC_Handler(void)
105{
106}
107
113void DebugMon_Handler(void)
114{
115}
116
122void PendSV_Handler(void)
123{
124}
125
131void SysTick_Handler(void)
132{
133}
134
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/spi/w25q_flash/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/spi/w25q_flash/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/spi/w25q_flash/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/spi/w25q_flash/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/spi/w25q_flash/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/spi/w25q_flash/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/spi/w25q_flash/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/spi/w25q_flash/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/spi/w25q_flash/src/at32f413_int.c:113
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • spi
  • w25q_flash
  • src
project/at_start_f413/examples/spi/w25q_flash/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include "spi_flash.h"
29
38#define FLASH_TEST_ADDR 0x1000
39#define BUF_SIZE 0x256
40
41uint8_t tx_buffer[BUF_SIZE];
42uint8_t rx_buffer[BUF_SIZE];
43volatile error_status transfer_status = ERROR;
44
45void tx_data_fill(void);
46 error_status buffer_compare(uint8_t* pbuffer1, uint8_t* pbuffer2, uint16_t buffer_length);
47
53void tx_data_fill(void)
54{
55 uint32_t data_index = 0;
56 for(data_index = 0; data_index < BUF_SIZE; data_index++)
57 {
58 tx_buffer[data_index] = data_index;
59 }
60}
61
68 error_status buffer_compare(uint8_t* pbuffer1, uint8_t* pbuffer2, uint16_t buffer_length)
69{
70 while(buffer_length--)
71 {
72 if(*pbuffer1 != *pbuffer2)
73 {
74 return ERROR;
75 }
76
77 pbuffer1++;
78 pbuffer2++;
79 }
80 return SUCCESS;
81}
82
88int main(void)
89{
90 __IO uint32_t index = 0;
91 __IO uint32_t flash_id_index = 0;
92 system_clock_config();
93 at32_board_init();
94 tx_data_fill();
95 uart_print_init(115200);
96 spiflash_init();
97 flash_id_index = spiflash_read_id();
98if((flash_id_index != W25Q128)&&(flash_id_index != W25Q80)&&(flash_id_index != W25Q16)&&(flash_id_index != W25Q32)&&(flash_id_index != W25Q64)) {
99 printf("flash id check error!\r\n");
100 for(index = 0; index < 50; index++)
101 {
102 at32_led_toggle(LED2);
103 at32_led_toggle(LED3);
104 delay_ms(200);
105 }
106 return 1;
107 }
108 else
109 {
110 printf("flash id check success! id: %x\r\n", flash_id_index);
111 }
112
113 /* erase sector */
114 spiflash_sector_erase(FLASH_TEST_ADDR / SPIF_SECTOR_SIZE);
115
116 /* write data */
117 spiflash_write(tx_buffer, FLASH_TEST_ADDR, BUF_SIZE);
118
119 /* read data */
120 spiflash_read(rx_buffer, FLASH_TEST_ADDR, BUF_SIZE);
121
122 /* printf read data */
123 printf("Read Data: ");
124 for(index = 0; index < BUF_SIZE; index++)
125 {
126 printf("%x ", rx_buffer[index]);
127 }
128
129 /* test result:the data check */
130 transfer_status = buffer_compare(rx_buffer, tx_buffer, BUF_SIZE);
131
132 /* test result indicate:if SUCCESS ,led2 lights */
133 if(transfer_status == SUCCESS)
134 {
135 printf("\r\nflash data read write success!\r\n");
136 at32_led_on(LED2);
137 }
138 else
139 {
140 printf("\r\nflash data read write ERROR!\r\n");
141 at32_led_off(LED2);
142 }
143
144 while(1)
145 {
146 }
147}
148
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
buffer_compare
error_status buffer_compare(uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t buffer_length)
buffer compare function.
Definition project/at_start_f413/examples/spi/w25q_flash/src/main.c:68
FLASH_TEST_ADDR
#define FLASH_TEST_ADDR
Definition project/at_start_f413/examples/spi/w25q_flash/src/main.c:38
BUF_SIZE
#define BUF_SIZE
Definition project/at_start_f413/examples/spi/w25q_flash/src/main.c:39
main
int main(void)
main function.
Definition project/at_start_f413/examples/spi/w25q_flash/src/main.c:88
rx_buffer
uint8_t rx_buffer[0x256]
Definition project/at_start_f413/examples/spi/w25q_flash/src/main.c:42
tx_data_fill
void tx_data_fill(void)
transfer data fill.
Definition project/at_start_f413/examples/spi/w25q_flash/src/main.c:53
tx_buffer
uint8_t tx_buffer[0x256]
Definition project/at_start_f413/examples/spi/w25q_flash/src/main.c:41
transfer_status
volatile error_status transfer_status
Definition project/at_start_f413/examples/spi/w25q_flash/src/main.c:43
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
at32_led_off
void at32_led_off(led_type led)
turns selected led off.
Definition at32f413_board.c:287
uart_print_init
void uart_print_init(uint32_t baudrate)
initialize uart
Definition at32f413_board.c:129
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
error_status
error_status
error status
Definition at32f413.h:302
ERROR
@ ERROR
Definition at32f413.h:302
SUCCESS
@ SUCCESS
Definition at32f413.h:302
spiflash_init
void spiflash_init(void)
spi configuration.
Definition spi_flash.c:43
spiflash_write
void spiflash_write(uint8_t *pbuffer, uint32_t write_addr, uint32_t length)
write data to flash
Definition spi_flash.c:98
spiflash_sector_erase
void spiflash_sector_erase(uint32_t erase_addr)
erase a sector data
Definition spi_flash.c:202
spiflash_read
void spiflash_read(uint8_t *pbuffer, uint32_t read_addr, uint32_t length)
read data from flash
Definition spi_flash.c:186
spiflash_read_id
uint16_t spiflash_read_id(void)
read device id
Definition spi_flash.c:479
W25Q128
#define W25Q128
Definition spi_flash.h:70
W25Q16
#define W25Q16
Definition spi_flash.h:66
W25Q32
#define W25Q32
Definition spi_flash.h:67
W25Q80
#define W25Q80
Definition spi_flash.h:65
W25Q64
#define W25Q64
Definition spi_flash.h:68
SPIF_SECTOR_SIZE
#define SPIF_SECTOR_SIZE
Definition spi_flash.h:81
at32f413_clock.h
header file of clock program
spi_flash.h
header file of spi_flash


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • tmr
  • cascade_synchro
  • inc
project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • tmr
  • cascade_synchro
  • inc
project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • tmr
  • cascade_synchro
  • inc
project/at_start_f413/examples/tmr/cascade_synchro/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • tmr
  • cascade_synchro
  • src
project/at_start_f413/examples/tmr/cascade_synchro/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/tmr/cascade_synchro/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • tmr
  • cascade_synchro
  • src
project/at_start_f413/examples/tmr/cascade_synchro/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/tmr/cascade_synchro/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/tmr/cascade_synchro/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/tmr/cascade_synchro/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/tmr/cascade_synchro/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/tmr/cascade_synchro/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/tmr/cascade_synchro/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/tmr/cascade_synchro/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/tmr/cascade_synchro/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/tmr/cascade_synchro/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • tmr
  • cascade_synchro
  • src
project/at_start_f413/examples/tmr/cascade_synchro/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37 gpio_init_type gpio_init_struct = {0};
38 tmr_output_config_type tmr_output_struct;
39
45int main(void)
46{
47 system_clock_config();
48
49 at32_board_init();
50
51 /* turn led2/led3/led4 on */
52 at32_led_on(LED2);
53 at32_led_on(LED3);
54 at32_led_on(LED4);
55
56 /* enable tmr2/tmr3/tmr4/gpioa/gpiob clock */
57 crm_periph_clock_enable(CRM_TMR2_PERIPH_CLOCK, TRUE);
58 crm_periph_clock_enable(CRM_TMR3_PERIPH_CLOCK, TRUE);
59 crm_periph_clock_enable(CRM_TMR4_PERIPH_CLOCK, TRUE);
60 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
61 crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
62
63 /* timer1 output pin Configuration */
64 gpio_init_struct.gpio_pins = GPIO_PINS_6 | GPIO_PINS_0;
65 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
66 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
67 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
68 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
69 gpio_init(GPIOA, &gpio_init_struct);
70
71 gpio_init_struct.gpio_pins = GPIO_PINS_6;
72 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
73 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
74 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
75 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
76 gpio_init(GPIOB, &gpio_init_struct);
77
78
79 /* timers synchronisation in cascade mode
80 1/tmr2 is configured as primary timer:
81 - pwm mode is used
82 - the tmr2 update event is used as trigger output
83
84 2/tmr3 is sub for tmr2 and primary for tmr4,
85 - pwm mode is used
86 - the itr1(tmr2) is used as input trigger
87 - gated mode is used, so start and stop of sub counter
88 are controlled by the master trigger output signal(tmr2 update event).
89 - the tmr3 update event is used as trigger output.
90
91 3/tmr4 is slave for tmr3,
92 - pwm mode is used
93 - the itr2(tmr3) is used as input trigger
94 - gated mode is used, so start and stop of sub counter
95 are controlled by the master trigger output signal(tmr3 overflow event).
96
97 the primary timer tmr2 is running at tmr2 frequency :
98 tim2 frequency = (tmr2 counter clock)/ (tmr2 period + 1) = 1 mhz
99 and the duty cycle = tmr2_c1dt/(tmr2_pr + 1) = 50%.
100
101 the tmr3 is running at:
102 (tmr2 frequency)/ (tmr3 period + 1) = 100 khz and a duty cycle equal
103 to tmr3_c1dt/(tmr3_pr + 1) = 50%
104
105 the tmr4 is running at:
106 (tmr3 frequency)/ (tmr4 period + 1) = 100 khz and a duty cycle equal
107 to tmr4_c1dt/(tmr4_pr + 1) = 50%
108
109 tmr2 pwm frequency = 1mhz, tmr3 pwm frequency = 100 khz,
110 and tmr4 pwm frequency = 10 khz */
111
112 tmr_base_init(TMR2, 191, 0);
113 tmr_cnt_dir_set(TMR2, TMR_COUNT_UP);
114
115 tmr_base_init(TMR3, 9, 0);
116 tmr_cnt_dir_set(TMR3, TMR_COUNT_UP);
117
118 tmr_base_init(TMR4, 9, 0);
119 tmr_cnt_dir_set(TMR4, TMR_COUNT_UP);
120
121 /* channelx Configuration in output mode */
122 tmr_output_default_para_init(&tmr_output_struct);
123 tmr_output_struct.oc_mode = TMR_OUTPUT_CONTROL_PWM_MODE_A;
124 tmr_output_struct.oc_output_state = TRUE;
125 tmr_output_struct.oc_polarity = TMR_OUTPUT_ACTIVE_LOW;
126 tmr_output_struct.oc_idle_state = TRUE;
127 tmr_output_struct.occ_output_state = FALSE;
128 tmr_output_struct.occ_polarity = TMR_OUTPUT_ACTIVE_HIGH;
129 tmr_output_struct.occ_idle_state = FALSE;
130
131 /* timer2 channel 1 */
132 tmr_output_channel_config(TMR2, TMR_SELECT_CHANNEL_1, &tmr_output_struct);
133 tmr_channel_value_set(TMR2, TMR_SELECT_CHANNEL_1, 96);
134
135 /* timer2 select enable signal to sub timer */
136 tmr_primary_mode_select(TMR2, TMR_PRIMARY_SEL_OVERFLOW);
137 tmr_sub_sync_mode_set(TMR2, TRUE);
138
139 /* timer3 channel 1 */
140 tmr_output_channel_config(TMR3, TMR_SELECT_CHANNEL_1, &tmr_output_struct);
141 tmr_channel_value_set(TMR3, TMR_SELECT_CHANNEL_1, 5);
142
143 /* sub mode selection: tmr3 */
144 tmr_sub_mode_select(TMR3, TMR_SUB_HANG_MODE);
145 tmr_trigger_input_select(TMR3, TMR_SUB_INPUT_SEL_IS1);
146
147 /* timer3 select enable signal to sub timer */
148 tmr_primary_mode_select(TMR3, TMR_PRIMARY_SEL_OVERFLOW);
149 tmr_sub_sync_mode_set(TMR3, TRUE);
150
151 /* timer4 channel 1 */
152 tmr_output_channel_config(TMR4, TMR_SELECT_CHANNEL_1, &tmr_output_struct);
153 tmr_channel_value_set(TMR4, TMR_SELECT_CHANNEL_1, 5);
154
155 /* sub mode selection: tmr4 */
156 tmr_sub_mode_select(TMR4, TMR_SUB_HANG_MODE);
157 tmr_trigger_input_select(TMR4, TMR_SUB_INPUT_SEL_IS2);
158
159 /* enable tmr2/tmr3/tmr4 */
160 tmr_counter_enable(TMR2, TRUE);
161 tmr_counter_enable(TMR3, TRUE);
162 tmr_counter_enable(TMR4, TRUE);
163
164 while(1)
165 {
166 }
167}
168
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/tmr/cascade_synchro/src/main.c:37
tmr_output_struct
tmr_output_config_type tmr_output_struct
Definition project/at_start_f413/examples/tmr/cascade_synchro/src/main.c:38
main
int main(void)
main function.
Definition project/at_start_f413/examples/tmr/cascade_synchro/src/main.c:45
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_TMR2_PERIPH_CLOCK
@ CRM_TMR2_PERIPH_CLOCK
Definition at32f413_crm.h:125
CRM_TMR4_PERIPH_CLOCK
@ CRM_TMR4_PERIPH_CLOCK
Definition at32f413_crm.h:127
CRM_TMR3_PERIPH_CLOCK
@ CRM_TMR3_PERIPH_CLOCK
Definition at32f413_crm.h:126
CRM_GPIOB_PERIPH_CLOCK
@ CRM_GPIOB_PERIPH_CLOCK
Definition at32f413_crm.h:110
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_6
#define GPIO_PINS_6
Definition at32f413_gpio.h:56
GPIO_PINS_0
#define GPIO_PINS_0
Definition at32f413_gpio.h:50
GPIOB
#define GPIOB
Definition at32f413_gpio.h:748
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
tmr_counter_enable
void tmr_counter_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr counter
Definition at32f413_tmr.c:114
tmr_output_channel_config
void tmr_output_channel_config(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_output_config_type *tmr_output_struct)
config tmr output channel
Definition at32f413_tmr.c:318
tmr_sub_mode_select
void tmr_sub_mode_select(tmr_type *tmr_x, tmr_sub_mode_select_type sub_mode)
select tmr subordinate mode
Definition at32f413_tmr.c:1196
tmr_output_default_para_init
void tmr_output_default_para_init(tmr_output_config_type *tmr_output_struct)
init tmr output default para
Definition at32f413_tmr.c:126
tmr_sub_sync_mode_set
void tmr_sub_sync_mode_set(tmr_type *tmr_x, confirm_state new_state)
set tmr subordinate synchronization mode
Definition at32f413_tmr.c:1273
tmr_base_init
void tmr_base_init(tmr_type *tmr_x, uint32_t tmr_pr, uint32_t tmr_div)
init tmr base
Definition at32f413_tmr.c:179
tmr_trigger_input_select
void tmr_trigger_input_select(tmr_type *tmr_x, sub_tmr_input_sel_type trigger_select)
select tmr sub-trigger
Definition at32f413_tmr.c:1260
tmr_primary_mode_select
void tmr_primary_mode_select(tmr_type *tmr_x, tmr_primary_select_type primary_mode)
select tmr primary mode
Definition at32f413_tmr.c:1174
tmr_cnt_dir_set
void tmr_cnt_dir_set(tmr_type *tmr_x, tmr_count_mode_type tmr_cnt_dir)
set tmr counter count direction
Definition at32f413_tmr.c:225
tmr_channel_value_set
void tmr_channel_value_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, uint32_t tmr_channel_value)
set tmr channel value
Definition at32f413_tmr.c:506
TMR_COUNT_UP
@ TMR_COUNT_UP
Definition at32f413_tmr.h:105
TMR_SELECT_CHANNEL_1
@ TMR_SELECT_CHANNEL_1
Definition at32f413_tmr.h:215
TMR_OUTPUT_CONTROL_PWM_MODE_A
@ TMR_OUTPUT_CONTROL_PWM_MODE_A
Definition at32f413_tmr.h:178
TMR_OUTPUT_ACTIVE_HIGH
@ TMR_OUTPUT_ACTIVE_HIGH
Definition at32f413_tmr.h:196
TMR_OUTPUT_ACTIVE_LOW
@ TMR_OUTPUT_ACTIVE_LOW
Definition at32f413_tmr.h:197
TMR_SUB_INPUT_SEL_IS2
@ TMR_SUB_INPUT_SEL_IS2
Definition at32f413_tmr.h:134
TMR_SUB_INPUT_SEL_IS1
@ TMR_SUB_INPUT_SEL_IS1
Definition at32f413_tmr.h:133
TMR_SUB_HANG_MODE
@ TMR_SUB_HANG_MODE
Definition at32f413_tmr.h:152
TMR_PRIMARY_SEL_OVERFLOW
@ TMR_PRIMARY_SEL_OVERFLOW
Definition at32f413_tmr.h:119
TMR3
#define TMR3
Definition at32f413_tmr.h:833
TMR2
#define TMR2
Definition at32f413_tmr.h:832
TMR4
#define TMR4
Definition at32f413_tmr.h:834
at32f413_clock.h
header file of clock program
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
tmr_output_config_type
tmr output config type
Definition at32f413_tmr.h:397
tmr_output_config_type::occ_output_state
confirm_state occ_output_state
Definition at32f413_tmr.h:404
tmr_output_config_type::oc_idle_state
confirm_state oc_idle_state
Definition at32f413_tmr.h:399
tmr_output_config_type::oc_output_state
confirm_state oc_output_state
Definition at32f413_tmr.h:403
tmr_output_config_type::oc_mode
tmr_output_control_mode_type oc_mode
Definition at32f413_tmr.h:398
tmr_output_config_type::occ_polarity
tmr_output_polarity_type occ_polarity
Definition at32f413_tmr.h:402
tmr_output_config_type::occ_idle_state
confirm_state occ_idle_state
Definition at32f413_tmr.h:400
tmr_output_config_type::oc_polarity
tmr_output_polarity_type oc_polarity
Definition at32f413_tmr.h:401


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • tmr
  • complementary_signals
  • inc
project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • tmr
  • complementary_signals
  • inc
project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • tmr
  • complementary_signals
  • inc
project/at_start_f413/examples/tmr/complementary_signals/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • tmr
  • complementary_signals
  • src
project/at_start_f413/examples/tmr/complementary_signals/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/tmr/complementary_signals/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • tmr
  • complementary_signals
  • src
project/at_start_f413/examples/tmr/complementary_signals/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/tmr/complementary_signals/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/tmr/complementary_signals/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/tmr/complementary_signals/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/tmr/complementary_signals/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/tmr/complementary_signals/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/tmr/complementary_signals/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/tmr/complementary_signals/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/tmr/complementary_signals/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/tmr/complementary_signals/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • tmr
  • complementary_signals
  • src
project/at_start_f413/examples/tmr/complementary_signals/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37 gpio_init_type gpio_init_struct = {0};
38 tmr_output_config_type tmr_output_struct;
39 crm_clocks_freq_type crm_clocks_freq_struct = {0};
40 tmr_brkdt_config_type tmr_brkdt_config_struct = {0};
41
42uint16_t timer_period = 0;
43uint16_t channel1_pulse = 0, channel2_pulse = 0, channel3_pulse = 0;
44
50int main(void)
51{
52 system_clock_config();
53
54 at32_board_init();
55
56 /* get system clock */
57 crm_clocks_freq_get(&crm_clocks_freq_struct);
58
59 /* turn led2/led3/led4 on */
60 at32_led_on(LED2);
61 at32_led_on(LED3);
62 at32_led_on(LED4);
63
64 /* enable tmr1/gpioa/gpiob clock */
65 crm_periph_clock_enable(CRM_TMR1_PERIPH_CLOCK, TRUE);
66 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
67 crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
68
69 /* timer1 output pin configuration */
70 gpio_init_struct.gpio_pins = GPIO_PINS_8 | GPIO_PINS_9 | GPIO_PINS_10;
71 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
72 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
73 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
74 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
75 gpio_init(GPIOA, &gpio_init_struct);
76
77 gpio_init_struct.gpio_pins = GPIO_PINS_13 | GPIO_PINS_14 | GPIO_PINS_15;
78 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
79 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
80 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
81 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
82 gpio_init(GPIOB, &gpio_init_struct);
83
84 gpio_init_struct.gpio_pins = GPIO_PINS_12;
85 gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
86 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
87 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
88 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
89 gpio_init(GPIOB, &gpio_init_struct);
90
91 /* tmr1 configuration to:
92
93 1/ generate 3 complementary pwm signals with 3 different duty cycles:
94 tmr1clk is fixed to system_core_clock, the tmr1 prescaler is equal to 0 so the
95 tmr1 counter clock used is system_core_clock.
96
97 the objective is to generate pwm signal at 17.57 khz:
98 - tmr1_period = (system_core_clock / 17570) - 1
99
100 the three duty cycles are computed as the following description:
101
102 the channel 1 duty cycle is set to 50% so channel 1c is set to 50%.
103 the channel 2 duty cycle is set to 25% so channel 2c is set to 75%.
104 the channel 3 duty cycle is set to 12.5% so channel 3c is set to 87.5%.
105 the timer pulse is calculated as follows:
106 - channelxpulse = duty_cycle * (tmr1_period - 1) / 100
107
108 2/ insert a dead time equal to 11/system_core_clock ns
109 3/ configure the brake feature, active at high level, and using the automatic
110 output enable feature
111 4/ use the locking parameters level1. */
112
113 /* compute the value to be set in arr regiter to generate signal frequency at 17.57 khz */
114 timer_period = (crm_clocks_freq_struct.sclk_freq / 17570 ) - 1;
115
116 /* compute c1dt value to generate a duty cycle at 50% for channel 1 and 1c */
117 channel1_pulse = (uint16_t) (((uint32_t) 5 * (timer_period - 1)) / 10);
118
119 /* compute c2dt value to generate a duty cycle at 25% for channel 2 and 2c */
120 channel2_pulse = (uint16_t) (((uint32_t) 25 * (timer_period - 1)) / 100);
121
122 /* compute c3dt value to generate a duty cycle at 12.5% for channel 3 and 3c */
123 channel3_pulse = (uint16_t) (((uint32_t) 125 * (timer_period - 1)) / 1000);
124
125 tmr_base_init(TMR1, timer_period, 0);
126 tmr_cnt_dir_set(TMR1, TMR_COUNT_UP);
127
128 /* channel 1, 2, 3 and 4 Configuration in output mode */
129 tmr_output_default_para_init(&tmr_output_struct);
130 tmr_output_struct.oc_mode = TMR_OUTPUT_CONTROL_PWM_MODE_B;
131 tmr_output_struct.oc_output_state = TRUE;
132 tmr_output_struct.oc_polarity = TMR_OUTPUT_ACTIVE_LOW;
133 tmr_output_struct.oc_idle_state = TRUE;
134 tmr_output_struct.occ_output_state = TRUE;
135 tmr_output_struct.occ_polarity = TMR_OUTPUT_ACTIVE_LOW;
136 tmr_output_struct.occ_idle_state = FALSE;
137
138 /* channel 1 */
139 tmr_output_channel_config(TMR1, TMR_SELECT_CHANNEL_1, &tmr_output_struct);
140 tmr_channel_value_set(TMR1, TMR_SELECT_CHANNEL_1, channel1_pulse);
141
142 /* channel 2 */
143 tmr_output_channel_config(TMR1, TMR_SELECT_CHANNEL_2, &tmr_output_struct);
144 tmr_channel_value_set(TMR1, TMR_SELECT_CHANNEL_2, channel2_pulse);
145
146 /* channel 3 */
147 tmr_output_channel_config(TMR1, TMR_SELECT_CHANNEL_3, &tmr_output_struct);
148 tmr_channel_value_set(TMR1, TMR_SELECT_CHANNEL_3, channel3_pulse);
149
150 /* automatic output enable, stop, dead time and lock configuration */
151 tmr_brkdt_default_para_init(&tmr_brkdt_config_struct);
152 tmr_brkdt_config_struct.brk_enable = TRUE;
153 tmr_brkdt_config_struct.auto_output_enable = TRUE;
154 tmr_brkdt_config_struct.deadtime = 11;
155 tmr_brkdt_config_struct.fcsodis_state = TRUE;
156 tmr_brkdt_config_struct.fcsoen_state = TRUE;
157 tmr_brkdt_config_struct.brk_polarity = TMR_BRK_INPUT_ACTIVE_HIGH;
158 tmr_brkdt_config_struct.wp_level = TMR_WP_LEVEL_3;
159 tmr_brkdt_config(TMR1, &tmr_brkdt_config_struct);
160
161 /* output enable */
162 tmr_output_enable(TMR1, TRUE);
163
164 /* enable tmr1 */
165 tmr_counter_enable(TMR1, TRUE);
166
167 while(1)
168 {
169 }
170}
171
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/tmr/complementary_signals/src/main.c:37
channel1_pulse
uint16_t channel1_pulse
Definition project/at_start_f413/examples/tmr/complementary_signals/src/main.c:43
tmr_output_struct
tmr_output_config_type tmr_output_struct
Definition project/at_start_f413/examples/tmr/complementary_signals/src/main.c:38
timer_period
uint16_t timer_period
Definition project/at_start_f413/examples/tmr/complementary_signals/src/main.c:42
channel2_pulse
uint16_t channel2_pulse
Definition project/at_start_f413/examples/tmr/complementary_signals/src/main.c:43
channel3_pulse
uint16_t channel3_pulse
Definition project/at_start_f413/examples/tmr/complementary_signals/src/main.c:43
main
int main(void)
main function.
Definition project/at_start_f413/examples/tmr/complementary_signals/src/main.c:50
crm_clocks_freq_struct
crm_clocks_freq_type crm_clocks_freq_struct
Definition project/at_start_f413/examples/tmr/complementary_signals/src/main.c:39
tmr_brkdt_config_struct
tmr_brkdt_config_type tmr_brkdt_config_struct
Definition project/at_start_f413/examples/tmr/complementary_signals/src/main.c:40
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_clocks_freq_get
void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
Definition at32f413_crm.c:660
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_GPIOB_PERIPH_CLOCK
@ CRM_GPIOB_PERIPH_CLOCK
Definition at32f413_crm.h:110
CRM_TMR1_PERIPH_CLOCK
@ CRM_TMR1_PERIPH_CLOCK
Definition at32f413_crm.h:116
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_10
#define GPIO_PINS_10
Definition at32f413_gpio.h:60
GPIO_PINS_13
#define GPIO_PINS_13
Definition at32f413_gpio.h:63
GPIO_PINS_12
#define GPIO_PINS_12
Definition at32f413_gpio.h:62
GPIO_PINS_14
#define GPIO_PINS_14
Definition at32f413_gpio.h:64
GPIO_PINS_9
#define GPIO_PINS_9
Definition at32f413_gpio.h:59
GPIO_PINS_8
#define GPIO_PINS_8
Definition at32f413_gpio.h:58
GPIO_PINS_15
#define GPIO_PINS_15
Definition at32f413_gpio.h:65
GPIOB
#define GPIOB
Definition at32f413_gpio.h:748
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
tmr_counter_enable
void tmr_counter_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr counter
Definition at32f413_tmr.c:114
tmr_output_channel_config
void tmr_output_channel_config(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_output_config_type *tmr_output_struct)
config tmr output channel
Definition at32f413_tmr.c:318
tmr_brkdt_default_para_init
void tmr_brkdt_default_para_init(tmr_brkdt_config_type *tmr_brkdt_struct)
init tmr brkdt default para
Definition at32f413_tmr.c:157
tmr_brkdt_config
void tmr_brkdt_config(tmr_type *tmr_x, tmr_brkdt_config_type *brkdt_struct)
config tmr brake mode and dead-time
Definition at32f413_tmr.c:1769
tmr_output_default_para_init
void tmr_output_default_para_init(tmr_output_config_type *tmr_output_struct)
init tmr output default para
Definition at32f413_tmr.c:126
tmr_output_enable
void tmr_output_enable(tmr_type *tmr_x, confirm_state new_state)
tmr output enable(oen),this function is important for advtm output enable
Definition at32f413_tmr.c:1469
tmr_base_init
void tmr_base_init(tmr_type *tmr_x, uint32_t tmr_pr, uint32_t tmr_div)
init tmr base
Definition at32f413_tmr.c:179
tmr_cnt_dir_set
void tmr_cnt_dir_set(tmr_type *tmr_x, tmr_count_mode_type tmr_cnt_dir)
set tmr counter count direction
Definition at32f413_tmr.c:225
tmr_channel_value_set
void tmr_channel_value_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, uint32_t tmr_channel_value)
set tmr channel value
Definition at32f413_tmr.c:506
TMR_COUNT_UP
@ TMR_COUNT_UP
Definition at32f413_tmr.h:105
TMR_SELECT_CHANNEL_3
@ TMR_SELECT_CHANNEL_3
Definition at32f413_tmr.h:219
TMR_SELECT_CHANNEL_1
@ TMR_SELECT_CHANNEL_1
Definition at32f413_tmr.h:215
TMR_SELECT_CHANNEL_2
@ TMR_SELECT_CHANNEL_2
Definition at32f413_tmr.h:217
TMR_WP_LEVEL_3
@ TMR_WP_LEVEL_3
Definition at32f413_tmr.h:388
TMR_BRK_INPUT_ACTIVE_HIGH
@ TMR_BRK_INPUT_ACTIVE_HIGH
Definition at32f413_tmr.h:379
TMR_OUTPUT_CONTROL_PWM_MODE_B
@ TMR_OUTPUT_CONTROL_PWM_MODE_B
Definition at32f413_tmr.h:179
TMR_OUTPUT_ACTIVE_LOW
@ TMR_OUTPUT_ACTIVE_LOW
Definition at32f413_tmr.h:197
TMR1
#define TMR1
Definition at32f413_tmr.h:831
at32f413_clock.h
header file of clock program
crm_clocks_freq_type
crm clocks freqency structure
Definition at32f413_crm.h:470
crm_clocks_freq_type::sclk_freq
uint32_t sclk_freq
Definition at32f413_crm.h:471
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
tmr_brkdt_config_type
tmr brkdt config type
Definition at32f413_tmr.h:422
tmr_brkdt_config_type::brk_enable
confirm_state brk_enable
Definition at32f413_tmr.h:429
tmr_brkdt_config_type::deadtime
uint8_t deadtime
Definition at32f413_tmr.h:423
tmr_brkdt_config_type::auto_output_enable
confirm_state auto_output_enable
Definition at32f413_tmr.h:426
tmr_brkdt_config_type::wp_level
tmr_wp_level_type wp_level
Definition at32f413_tmr.h:425
tmr_brkdt_config_type::fcsoen_state
confirm_state fcsoen_state
Definition at32f413_tmr.h:427
tmr_brkdt_config_type::fcsodis_state
confirm_state fcsodis_state
Definition at32f413_tmr.h:428
tmr_brkdt_config_type::brk_polarity
tmr_brk_polarity_type brk_polarity
Definition at32f413_tmr.h:424
tmr_output_config_type
tmr output config type
Definition at32f413_tmr.h:397
tmr_output_config_type::occ_output_state
confirm_state occ_output_state
Definition at32f413_tmr.h:404
tmr_output_config_type::oc_idle_state
confirm_state oc_idle_state
Definition at32f413_tmr.h:399
tmr_output_config_type::oc_output_state
confirm_state oc_output_state
Definition at32f413_tmr.h:403
tmr_output_config_type::oc_mode
tmr_output_control_mode_type oc_mode
Definition at32f413_tmr.h:398
tmr_output_config_type::occ_polarity
tmr_output_polarity_type occ_polarity
Definition at32f413_tmr.h:402
tmr_output_config_type::occ_idle_state
confirm_state occ_idle_state
Definition at32f413_tmr.h:400
tmr_output_config_type::oc_polarity
tmr_output_polarity_type oc_polarity
Definition at32f413_tmr.h:401


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • tmr
  • dma
  • inc
project/at_start_f413/examples/tmr/dma/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • tmr
  • dma
  • inc
project/at_start_f413/examples/tmr/dma/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • tmr
  • dma
  • inc
project/at_start_f413/examples/tmr/dma/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • tmr
  • dma
  • src
project/at_start_f413/examples/tmr/dma/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/tmr/dma/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • tmr
  • dma
  • src
project/at_start_f413/examples/tmr/dma/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/tmr/dma/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/tmr/dma/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/tmr/dma/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/tmr/dma/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/tmr/dma/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/tmr/dma/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/tmr/dma/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/tmr/dma/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/tmr/dma/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • tmr
  • dma
  • src
project/at_start_f413/examples/tmr/dma/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37 gpio_init_type gpio_init_struct = {0};
38 tmr_output_config_type tmr_output_struct;
39 dma_init_type dma_init_struct = {0};
40 crm_clocks_freq_type crm_clocks_freq_struct = {0};
41
42uint16_t timer_period = 0;
43uint16_t src_buffer[3] = {0, 0, 0};
44
50int main(void)
51{
52 system_clock_config();
53
54 at32_board_init();
55
56 /* get system clock */
57 crm_clocks_freq_get(&crm_clocks_freq_struct);
58
59 /* turn led2/led3/led4 on */
60 at32_led_on(LED2);
61 at32_led_on(LED3);
62 at32_led_on(LED4);
63
64 /* enable tmr1/gpioa/gpiob/dma clock */
65 crm_periph_clock_enable(CRM_TMR1_PERIPH_CLOCK, TRUE);
66 crm_periph_clock_enable(CRM_DMA1_PERIPH_CLOCK, TRUE);
67 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
68 crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
69
70 /* timer1 output pin Configuration */
71 gpio_init_struct.gpio_pins = GPIO_PINS_10;
72 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
73 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
74 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
75 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
76 gpio_init(GPIOA, &gpio_init_struct);
77
78 gpio_init_struct.gpio_pins = GPIO_PINS_15;
79 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
80 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
81 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
82 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
83 gpio_init(GPIOB, &gpio_init_struct);
84
85 /* tmr1 dma transfer example
86 tmr1clk = system_core_clock, prescaler = 0, tmr1 counter clock = system_core_clock
87
88 the objective is to configure tmr1 channel 3 to generate complementary pwm
89 signal with a frequency equal to 17.57 khz:
90 - tmr1_period = (system_core_clock / 17570) - 1
91 and a variable duty cycle that is changed by the dma after a specific number of
92 update dma request.
93
94 the number of this repetitive requests is defined by the tmr1 repetition counter,
95 each 3 update requests, the tmr1 channel 3 duty cycle changes to the next new
96 value defined by the src_buffer. */
97 /* compute the value to be set in arr regiter to generate signal frequency at 17.57 khz */
98 timer_period = (crm_clocks_freq_struct.sclk_freq / 17570 ) - 1;
99 /* compute c1dt value to generate a duty cycle at 50% */
100 src_buffer[0] = (uint16_t) (((uint32_t) 5 * (timer_period - 1)) / 10);
101 /* compute c1dt value to generate a duty cycle at 37.5% */
102 src_buffer[1] = (uint16_t) (((uint32_t) 375 * (timer_period - 1)) / 1000);
103 /* compute c1dt value to generate a duty cycle at 25% */
104 src_buffer[2] = (uint16_t) (((uint32_t) 25 * (timer_period - 1)) / 100);
105
106 tmr_base_init(TMR1, timer_period, 0);
107 tmr_cnt_dir_set(TMR1, TMR_COUNT_UP);
108
109 /* channel 3 configuration in output mode */
110 tmr_output_default_para_init(&tmr_output_struct);
111 tmr_output_struct.oc_mode = TMR_OUTPUT_CONTROL_PWM_MODE_B;
112 tmr_output_struct.oc_output_state = TRUE;
113 tmr_output_struct.oc_polarity = TMR_OUTPUT_ACTIVE_LOW;
114 tmr_output_struct.oc_idle_state = TRUE;
115 tmr_output_struct.occ_output_state = TRUE;
116 tmr_output_struct.occ_polarity = TMR_OUTPUT_ACTIVE_LOW;
117 tmr_output_struct.occ_idle_state = FALSE;
118 /* channel 3 */
119 tmr_output_channel_config(TMR1, TMR_SELECT_CHANNEL_3, &tmr_output_struct);
120 tmr_channel_value_set(TMR1, TMR_SELECT_CHANNEL_3, src_buffer[0]);
121
122 /* enable tmr1 overflow dma request */
123 tmr_dma_request_enable(TMR1, TMR_OVERFLOW_DMA_REQUEST, TRUE);
124
125 /* dma config for tmr1 overflow dma request */
126 /* dma1 channel5 configuration */
127 dma_reset(DMA1_CHANNEL5);
128 dma_init_struct.buffer_size = 3;
129 dma_init_struct.direction = DMA_DIR_MEMORY_TO_PERIPHERAL;
130 dma_init_struct.memory_base_addr = (uint32_t)src_buffer;
131 dma_init_struct.memory_data_width = DMA_MEMORY_DATA_WIDTH_HALFWORD;
132 dma_init_struct.memory_inc_enable = TRUE;
133 dma_init_struct.peripheral_base_addr = (uint32_t)&TMR1->c3dt;
134 dma_init_struct.peripheral_data_width = DMA_PERIPHERAL_DATA_WIDTH_HALFWORD;
135 dma_init_struct.peripheral_inc_enable = FALSE;
136 dma_init_struct.priority = DMA_PRIORITY_MEDIUM;
137 dma_init_struct.loop_mode_enable = TRUE;
138 dma_init(DMA1_CHANNEL5, &dma_init_struct);
139
140 dma_channel_enable(DMA1_CHANNEL5, TRUE);
141
142 /* output enable */
143 tmr_output_enable(TMR1, TRUE);
144 /* enable tmr1 */
145 tmr_counter_enable(TMR1, TRUE);
146
147 while(1)
148 {
149 }
150}
151
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/tmr/dma/src/main.c:37
dma_init_struct
dma_init_type dma_init_struct
Definition project/at_start_f413/examples/tmr/dma/src/main.c:39
tmr_output_struct
tmr_output_config_type tmr_output_struct
Definition project/at_start_f413/examples/tmr/dma/src/main.c:38
src_buffer
uint16_t src_buffer[3]
Definition project/at_start_f413/examples/tmr/dma/src/main.c:43
timer_period
uint16_t timer_period
Definition project/at_start_f413/examples/tmr/dma/src/main.c:42
main
int main(void)
main function.
Definition project/at_start_f413/examples/tmr/dma/src/main.c:50
crm_clocks_freq_struct
crm_clocks_freq_type crm_clocks_freq_struct
Definition project/at_start_f413/examples/tmr/dma/src/main.c:40
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_clocks_freq_get
void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
Definition at32f413_crm.c:660
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_GPIOB_PERIPH_CLOCK
@ CRM_GPIOB_PERIPH_CLOCK
Definition at32f413_crm.h:110
CRM_DMA1_PERIPH_CLOCK
@ CRM_DMA1_PERIPH_CLOCK
Definition at32f413_crm.h:103
CRM_TMR1_PERIPH_CLOCK
@ CRM_TMR1_PERIPH_CLOCK
Definition at32f413_crm.h:116
dma_channel_enable
void dma_channel_enable(dma_channel_type *dmax_channely, confirm_state new_state)
enable or disable dma channely
Definition at32f413_dma.c:197
dma_reset
void dma_reset(dma_channel_type *dmax_channely)
reset the dmax channely registers.
Definition at32f413_dma.c:63
dma_init
void dma_init(dma_channel_type *dmax_channely, dma_init_type *dma_init_struct)
dma init
Definition at32f413_dma.c:442
DMA_PERIPHERAL_DATA_WIDTH_HALFWORD
@ DMA_PERIPHERAL_DATA_WIDTH_HALFWORD
Definition at32f413_dma.h:246
DMA_DIR_MEMORY_TO_PERIPHERAL
@ DMA_DIR_MEMORY_TO_PERIPHERAL
Definition at32f413_dma.h:217
DMA_MEMORY_DATA_WIDTH_HALFWORD
@ DMA_MEMORY_DATA_WIDTH_HALFWORD
Definition at32f413_dma.h:256
DMA_PRIORITY_MEDIUM
@ DMA_PRIORITY_MEDIUM
Definition at32f413_dma.h:266
DMA1_CHANNEL5
#define DMA1_CHANNEL5
Definition at32f413_dma.h:484
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_10
#define GPIO_PINS_10
Definition at32f413_gpio.h:60
GPIO_PINS_15
#define GPIO_PINS_15
Definition at32f413_gpio.h:65
GPIOB
#define GPIOB
Definition at32f413_gpio.h:748
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
tmr_dma_request_enable
void tmr_dma_request_enable(tmr_type *tmr_x, tmr_dma_request_type dma_request, confirm_state new_state)
enable or disable tmr dma request
Definition at32f413_tmr.c:1296
tmr_counter_enable
void tmr_counter_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr counter
Definition at32f413_tmr.c:114
tmr_output_channel_config
void tmr_output_channel_config(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_output_config_type *tmr_output_struct)
config tmr output channel
Definition at32f413_tmr.c:318
tmr_output_default_para_init
void tmr_output_default_para_init(tmr_output_config_type *tmr_output_struct)
init tmr output default para
Definition at32f413_tmr.c:126
tmr_output_enable
void tmr_output_enable(tmr_type *tmr_x, confirm_state new_state)
tmr output enable(oen),this function is important for advtm output enable
Definition at32f413_tmr.c:1469
tmr_base_init
void tmr_base_init(tmr_type *tmr_x, uint32_t tmr_pr, uint32_t tmr_div)
init tmr base
Definition at32f413_tmr.c:179
tmr_cnt_dir_set
void tmr_cnt_dir_set(tmr_type *tmr_x, tmr_count_mode_type tmr_cnt_dir)
set tmr counter count direction
Definition at32f413_tmr.c:225
tmr_channel_value_set
void tmr_channel_value_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, uint32_t tmr_channel_value)
set tmr channel value
Definition at32f413_tmr.c:506
TMR_OVERFLOW_DMA_REQUEST
@ TMR_OVERFLOW_DMA_REQUEST
Definition at32f413_tmr.h:268
TMR_COUNT_UP
@ TMR_COUNT_UP
Definition at32f413_tmr.h:105
TMR_SELECT_CHANNEL_3
@ TMR_SELECT_CHANNEL_3
Definition at32f413_tmr.h:219
TMR_OUTPUT_CONTROL_PWM_MODE_B
@ TMR_OUTPUT_CONTROL_PWM_MODE_B
Definition at32f413_tmr.h:179
TMR_OUTPUT_ACTIVE_LOW
@ TMR_OUTPUT_ACTIVE_LOW
Definition at32f413_tmr.h:197
TMR1
#define TMR1
Definition at32f413_tmr.h:831
at32f413_clock.h
header file of clock program
crm_clocks_freq_type
crm clocks freqency structure
Definition at32f413_crm.h:470
crm_clocks_freq_type::sclk_freq
uint32_t sclk_freq
Definition at32f413_crm.h:471
dma_init_type
dma init type
Definition at32f413_dma.h:275
dma_init_type::loop_mode_enable
confirm_state loop_mode_enable
Definition at32f413_dma.h:284
dma_init_type::buffer_size
uint16_t buffer_size
Definition at32f413_dma.h:279
dma_init_type::memory_data_width
dma_memory_data_size_type memory_data_width
Definition at32f413_dma.h:283
dma_init_type::priority
dma_priority_level_type priority
Definition at32f413_dma.h:285
dma_init_type::peripheral_inc_enable
confirm_state peripheral_inc_enable
Definition at32f413_dma.h:280
dma_init_type::memory_inc_enable
confirm_state memory_inc_enable
Definition at32f413_dma.h:281
dma_init_type::direction
dma_dir_type direction
Definition at32f413_dma.h:278
dma_init_type::peripheral_base_addr
uint32_t peripheral_base_addr
Definition at32f413_dma.h:276
dma_init_type::memory_base_addr
uint32_t memory_base_addr
Definition at32f413_dma.h:277
dma_init_type::peripheral_data_width
dma_peripheral_data_size_type peripheral_data_width
Definition at32f413_dma.h:282
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
tmr_output_config_type
tmr output config type
Definition at32f413_tmr.h:397
tmr_output_config_type::occ_output_state
confirm_state occ_output_state
Definition at32f413_tmr.h:404
tmr_output_config_type::oc_idle_state
confirm_state oc_idle_state
Definition at32f413_tmr.h:399
tmr_output_config_type::oc_output_state
confirm_state oc_output_state
Definition at32f413_tmr.h:403
tmr_output_config_type::oc_mode
tmr_output_control_mode_type oc_mode
Definition at32f413_tmr.h:398
tmr_output_config_type::occ_polarity
tmr_output_polarity_type occ_polarity
Definition at32f413_tmr.h:402
tmr_output_config_type::occ_idle_state
confirm_state occ_idle_state
Definition at32f413_tmr.h:400
tmr_output_config_type::oc_polarity
tmr_output_polarity_type oc_polarity
Definition at32f413_tmr.h:401


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • tmr
  • dma_burst
  • inc
project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • tmr
  • dma_burst
  • inc
project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • tmr
  • dma_burst
  • inc
project/at_start_f413/examples/tmr/dma_burst/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • tmr
  • dma_burst
  • src
project/at_start_f413/examples/tmr/dma_burst/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/tmr/dma_burst/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • tmr
  • dma_burst
  • src
project/at_start_f413/examples/tmr/dma_burst/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/tmr/dma_burst/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/tmr/dma_burst/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/tmr/dma_burst/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/tmr/dma_burst/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/tmr/dma_burst/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/tmr/dma_burst/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/tmr/dma_burst/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/tmr/dma_burst/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/tmr/dma_burst/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • tmr
  • dma_burst
  • src
project/at_start_f413/examples/tmr/dma_burst/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37 gpio_init_type gpio_init_struct = {0};
38 tmr_output_config_type tmr_output_struct;
39 dma_init_type dma_init_struct = {0};
40 crm_clocks_freq_type crm_clocks_freq_struct = {0};
41
42uint16_t timer_period = 0;
43uint16_t src_buffer[3] = {0x0FFF, 0x0000, 0x0555};
44
50int main(void)
51{
52 system_clock_config();
53
54 at32_board_init();
55
56 /* get system clock */
57 crm_clocks_freq_get(&crm_clocks_freq_struct);
58
59 /* turn led2/led3/led4 on */
60 at32_led_on(LED2);
61 at32_led_on(LED3);
62 at32_led_on(LED4);
63
64 /* enable tmr1/gpioa/gpiob/dma clock */
65 crm_periph_clock_enable(CRM_TMR1_PERIPH_CLOCK, TRUE);
66 crm_periph_clock_enable(CRM_DMA1_PERIPH_CLOCK, TRUE);
67 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
68 crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
69
70 /* timer1 output pin Configuration */
71 gpio_init_struct.gpio_pins = GPIO_PINS_8;
72 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
73 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
74 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
75 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
76 gpio_init(GPIOA, &gpio_init_struct);
77
78 /* tmr1 configuration: generate 1 pwm signal using the dma burst mode:
79 the tmr1clk frequency is set to system_core_clock (hz), to get tmr1 counter
80 clock at 24 mhz the prescaler is computed as following:
81 - div = (tim1clk / tmr1 counter clock) - 1
82 the tmr1 period is 5.86 khz: tmr1 frequency = tmr1 counter clock/(pr + 1)
83 = 24 mhz / 4096 = 5.86khz
84 tmr1 channel1 duty cycle = (tim1_c1dt/ tmr1_pr)* 100 = 33.33% */
85
86 tmr_base_init(TMR1, 0xFFFF, (crm_clocks_freq_struct.sclk_freq/24000000)-1);
87 tmr_cnt_dir_set(TMR1, TMR_COUNT_UP);
88
89 /* channel 3 configuration in output mode */
90 tmr_output_default_para_init(&tmr_output_struct);
91 tmr_output_struct.oc_mode = TMR_OUTPUT_CONTROL_PWM_MODE_B;
92 tmr_output_struct.oc_output_state = TRUE;
93 tmr_output_struct.oc_polarity = TMR_OUTPUT_ACTIVE_LOW;
94 tmr_output_struct.oc_idle_state = TRUE;
95 tmr_output_struct.occ_output_state = FALSE;
96 tmr_output_struct.occ_polarity = TMR_OUTPUT_ACTIVE_LOW;
97 tmr_output_struct.occ_idle_state = FALSE;
98 /* channel 3 */
99 tmr_output_channel_config(TMR1, TMR_SELECT_CHANNEL_1, &tmr_output_struct);
100 tmr_channel_value_set(TMR1, TMR_SELECT_CHANNEL_1, 0xFFF);
101
102 /* enable tmr1 overflow dma request */
103 tmr_dma_request_enable(TMR1, TMR_OVERFLOW_DMA_REQUEST, TRUE);
104 tmr_dma_control_config(TMR1, TMR_DMA_TRANSFER_3BYTES, TMR_PR_ADDRESS);
105
106 /* dma config for tmr1 overflow dma request */
107 /* dma1 channel5 configuration */
108 dma_reset(DMA1_CHANNEL5);
109 dma_init_struct.buffer_size = 3;
110 dma_init_struct.direction = DMA_DIR_MEMORY_TO_PERIPHERAL;
111 dma_init_struct.memory_base_addr = (uint32_t)src_buffer;
112 dma_init_struct.memory_data_width = DMA_MEMORY_DATA_WIDTH_HALFWORD;
113 dma_init_struct.memory_inc_enable = TRUE;
114 dma_init_struct.peripheral_base_addr = (uint32_t)&TMR1->dmadt;
115 dma_init_struct.peripheral_data_width = DMA_PERIPHERAL_DATA_WIDTH_HALFWORD;
116 dma_init_struct.peripheral_inc_enable = FALSE;
117 dma_init_struct.priority = DMA_PRIORITY_MEDIUM;
118 dma_init_struct.loop_mode_enable = TRUE;
119 dma_init(DMA1_CHANNEL5, &dma_init_struct);
120
121 dma_channel_enable(DMA1_CHANNEL5, TRUE);
122
123 /* output enable */
124 tmr_output_enable(TMR1, TRUE);
125 /* enable tmr1 */
126 tmr_counter_enable(TMR1, TRUE);
127
128 while(1)
129 {
130 }
131}
132
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/tmr/dma_burst/src/main.c:37
dma_init_struct
dma_init_type dma_init_struct
Definition project/at_start_f413/examples/tmr/dma_burst/src/main.c:39
tmr_output_struct
tmr_output_config_type tmr_output_struct
Definition project/at_start_f413/examples/tmr/dma_burst/src/main.c:38
src_buffer
uint16_t src_buffer[3]
Definition project/at_start_f413/examples/tmr/dma_burst/src/main.c:43
timer_period
uint16_t timer_period
Definition project/at_start_f413/examples/tmr/dma_burst/src/main.c:42
main
int main(void)
main function.
Definition project/at_start_f413/examples/tmr/dma_burst/src/main.c:50
crm_clocks_freq_struct
crm_clocks_freq_type crm_clocks_freq_struct
Definition project/at_start_f413/examples/tmr/dma_burst/src/main.c:40
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_clocks_freq_get
void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
Definition at32f413_crm.c:660
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_GPIOB_PERIPH_CLOCK
@ CRM_GPIOB_PERIPH_CLOCK
Definition at32f413_crm.h:110
CRM_DMA1_PERIPH_CLOCK
@ CRM_DMA1_PERIPH_CLOCK
Definition at32f413_crm.h:103
CRM_TMR1_PERIPH_CLOCK
@ CRM_TMR1_PERIPH_CLOCK
Definition at32f413_crm.h:116
dma_channel_enable
void dma_channel_enable(dma_channel_type *dmax_channely, confirm_state new_state)
enable or disable dma channely
Definition at32f413_dma.c:197
dma_reset
void dma_reset(dma_channel_type *dmax_channely)
reset the dmax channely registers.
Definition at32f413_dma.c:63
dma_init
void dma_init(dma_channel_type *dmax_channely, dma_init_type *dma_init_struct)
dma init
Definition at32f413_dma.c:442
DMA_PERIPHERAL_DATA_WIDTH_HALFWORD
@ DMA_PERIPHERAL_DATA_WIDTH_HALFWORD
Definition at32f413_dma.h:246
DMA_DIR_MEMORY_TO_PERIPHERAL
@ DMA_DIR_MEMORY_TO_PERIPHERAL
Definition at32f413_dma.h:217
DMA_MEMORY_DATA_WIDTH_HALFWORD
@ DMA_MEMORY_DATA_WIDTH_HALFWORD
Definition at32f413_dma.h:256
DMA_PRIORITY_MEDIUM
@ DMA_PRIORITY_MEDIUM
Definition at32f413_dma.h:266
DMA1_CHANNEL5
#define DMA1_CHANNEL5
Definition at32f413_dma.h:484
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_8
#define GPIO_PINS_8
Definition at32f413_gpio.h:58
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
tmr_dma_control_config
void tmr_dma_control_config(tmr_type *tmr_x, tmr_dma_transfer_length_type dma_length, tmr_dma_address_type dma_base_address)
config tmr dma control
Definition at32f413_tmr.c:1753
tmr_dma_request_enable
void tmr_dma_request_enable(tmr_type *tmr_x, tmr_dma_request_type dma_request, confirm_state new_state)
enable or disable tmr dma request
Definition at32f413_tmr.c:1296
tmr_counter_enable
void tmr_counter_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr counter
Definition at32f413_tmr.c:114
tmr_output_channel_config
void tmr_output_channel_config(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_output_config_type *tmr_output_struct)
config tmr output channel
Definition at32f413_tmr.c:318
tmr_output_default_para_init
void tmr_output_default_para_init(tmr_output_config_type *tmr_output_struct)
init tmr output default para
Definition at32f413_tmr.c:126
tmr_output_enable
void tmr_output_enable(tmr_type *tmr_x, confirm_state new_state)
tmr output enable(oen),this function is important for advtm output enable
Definition at32f413_tmr.c:1469
tmr_base_init
void tmr_base_init(tmr_type *tmr_x, uint32_t tmr_pr, uint32_t tmr_div)
init tmr base
Definition at32f413_tmr.c:179
tmr_cnt_dir_set
void tmr_cnt_dir_set(tmr_type *tmr_x, tmr_count_mode_type tmr_cnt_dir)
set tmr counter count direction
Definition at32f413_tmr.c:225
tmr_channel_value_set
void tmr_channel_value_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, uint32_t tmr_channel_value)
set tmr channel value
Definition at32f413_tmr.c:506
TMR_OVERFLOW_DMA_REQUEST
@ TMR_OVERFLOW_DMA_REQUEST
Definition at32f413_tmr.h:268
TMR_COUNT_UP
@ TMR_COUNT_UP
Definition at32f413_tmr.h:105
TMR_SELECT_CHANNEL_1
@ TMR_SELECT_CHANNEL_1
Definition at32f413_tmr.h:215
TMR_PR_ADDRESS
@ TMR_PR_ADDRESS
Definition at32f413_tmr.h:363
TMR_OUTPUT_CONTROL_PWM_MODE_B
@ TMR_OUTPUT_CONTROL_PWM_MODE_B
Definition at32f413_tmr.h:179
TMR_OUTPUT_ACTIVE_LOW
@ TMR_OUTPUT_ACTIVE_LOW
Definition at32f413_tmr.h:197
TMR_DMA_TRANSFER_3BYTES
@ TMR_DMA_TRANSFER_3BYTES
Definition at32f413_tmr.h:329
TMR1
#define TMR1
Definition at32f413_tmr.h:831
at32f413_clock.h
header file of clock program
crm_clocks_freq_type
crm clocks freqency structure
Definition at32f413_crm.h:470
crm_clocks_freq_type::sclk_freq
uint32_t sclk_freq
Definition at32f413_crm.h:471
dma_init_type
dma init type
Definition at32f413_dma.h:275
dma_init_type::loop_mode_enable
confirm_state loop_mode_enable
Definition at32f413_dma.h:284
dma_init_type::buffer_size
uint16_t buffer_size
Definition at32f413_dma.h:279
dma_init_type::memory_data_width
dma_memory_data_size_type memory_data_width
Definition at32f413_dma.h:283
dma_init_type::priority
dma_priority_level_type priority
Definition at32f413_dma.h:285
dma_init_type::peripheral_inc_enable
confirm_state peripheral_inc_enable
Definition at32f413_dma.h:280
dma_init_type::memory_inc_enable
confirm_state memory_inc_enable
Definition at32f413_dma.h:281
dma_init_type::direction
dma_dir_type direction
Definition at32f413_dma.h:278
dma_init_type::peripheral_base_addr
uint32_t peripheral_base_addr
Definition at32f413_dma.h:276
dma_init_type::memory_base_addr
uint32_t memory_base_addr
Definition at32f413_dma.h:277
dma_init_type::peripheral_data_width
dma_peripheral_data_size_type peripheral_data_width
Definition at32f413_dma.h:282
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
tmr_output_config_type
tmr output config type
Definition at32f413_tmr.h:397
tmr_output_config_type::occ_output_state
confirm_state occ_output_state
Definition at32f413_tmr.h:404
tmr_output_config_type::oc_idle_state
confirm_state oc_idle_state
Definition at32f413_tmr.h:399
tmr_output_config_type::oc_output_state
confirm_state oc_output_state
Definition at32f413_tmr.h:403
tmr_output_config_type::oc_mode
tmr_output_control_mode_type oc_mode
Definition at32f413_tmr.h:398
tmr_output_config_type::occ_polarity
tmr_output_polarity_type occ_polarity
Definition at32f413_tmr.h:402
tmr_output_config_type::occ_idle_state
confirm_state occ_idle_state
Definition at32f413_tmr.h:400
tmr_output_config_type::oc_polarity
tmr_output_polarity_type oc_polarity
Definition at32f413_tmr.h:401


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • tmr
  • encoder_tmr2
  • inc
project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • tmr
  • encoder_tmr2
  • inc
project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • tmr
  • encoder_tmr2
  • inc
project/at_start_f413/examples/tmr/encoder_tmr2/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • tmr
  • encoder_tmr2
  • src
project/at_start_f413/examples/tmr/encoder_tmr2/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/tmr/encoder_tmr2/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • tmr
  • encoder_tmr2
  • src
project/at_start_f413/examples/tmr/encoder_tmr2/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/tmr/encoder_tmr2/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/tmr/encoder_tmr2/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/tmr/encoder_tmr2/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/tmr/encoder_tmr2/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/tmr/encoder_tmr2/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/tmr/encoder_tmr2/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/tmr/encoder_tmr2/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/tmr/encoder_tmr2/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/tmr/encoder_tmr2/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • tmr
  • encoder_tmr2
  • src
project/at_start_f413/examples/tmr/encoder_tmr2/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37 gpio_init_type gpio_init_struct = {0};
38 crm_clocks_freq_type crm_clocks_freq_struct = {0};
39
40void delay(uint32_t time);
41uint32_t counter;
42
48int main(void)
49{
50 system_clock_config();
51
52 at32_board_init();
53
54 /* get system clock */
55 crm_clocks_freq_get(&crm_clocks_freq_struct);
56
57 /* turn led2/led3/led4 on */
58 at32_led_on(LED2);
59 at32_led_on(LED3);
60 at32_led_on(LED4);
61
62 /* enable tmr2/gpioa clock */
63 crm_periph_clock_enable(CRM_TMR2_PERIPH_CLOCK, TRUE);
64 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
65
66 /* timer1 output pin Configuration */
67 gpio_init_struct.gpio_pins = GPIO_PINS_0 | GPIO_PINS_1;
68 gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
69 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
70 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
71 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
72 gpio_init(GPIOA, &gpio_init_struct);
73
74 gpio_init_struct.gpio_pins = GPIO_PINS_2 | GPIO_PINS_3;
75 gpio_init_struct.gpio_mode = GPIO_MODE_OUTPUT;
76 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
77 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
78 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
79 gpio_init(GPIOA, &gpio_init_struct);
80
81 /* tmr2 encoder mode configuration
82 tmr2 c1ifp1 ,c2ifp2 as encoder input pin, tmr2 counter
83 changed each signal edge. */
84
85 /* enable tmr2 32bit function */
86 tmr_32_bit_function_enable(TMR2, TRUE);
87
88 tmr_base_init(TMR2, 0xFFFFFFFF, 0);
89 tmr_cnt_dir_set(TMR2, TMR_COUNT_UP);
90
91 /* config encoder mode */
92 tmr_encoder_mode_config(TMR2, TMR_ENCODER_MODE_C, TMR_INPUT_RISING_EDGE, TMR_INPUT_RISING_EDGE);
93
94 /* enable tmr2 */
95 tmr_counter_enable(TMR2, TRUE);
96
97 while(1)
98 {
99 /* generate encoder signal */
100 gpio_bits_set(GPIOA, GPIO_PINS_2);
101 delay(150);
102 gpio_bits_set(GPIOA, GPIO_PINS_3);
103 delay(150);
104 gpio_bits_reset(GPIOA, GPIO_PINS_2);
105 delay(150);
106 gpio_bits_reset(GPIOA, GPIO_PINS_3);
107 delay(150);
108
109 /* get current counter value */
110 counter = tmr_counter_value_get(TMR2);
111 }
112}
113
119void delay(uint32_t time)
120{
121 uint32_t i;
122
123 for(i = 0; i < time; i++);
124}
125
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/tmr/encoder_tmr2/src/main.c:37
delay
void delay(uint32_t time)
delay function
Definition project/at_start_f413/examples/tmr/encoder_tmr2/src/main.c:119
counter
uint32_t counter
Definition project/at_start_f413/examples/tmr/encoder_tmr2/src/main.c:41
main
int main(void)
main function.
Definition project/at_start_f413/examples/tmr/encoder_tmr2/src/main.c:48
crm_clocks_freq_struct
crm_clocks_freq_type crm_clocks_freq_struct
Definition project/at_start_f413/examples/tmr/encoder_tmr2/src/main.c:38
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_clocks_freq_get
void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
Definition at32f413_crm.c:660
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_TMR2_PERIPH_CLOCK
@ CRM_TMR2_PERIPH_CLOCK
Definition at32f413_crm.h:125
TRUE
@ TRUE
Definition at32f413.h:297
gpio_bits_reset
void gpio_bits_reset(gpio_type *gpio_x, uint16_t pins)
clear the selected data port bits.
Definition at32f413_gpio.c:340
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_bits_set
void gpio_bits_set(gpio_type *gpio_x, uint16_t pins)
set the selected data port bits.
Definition at32f413_gpio.c:309
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_MODE_OUTPUT
@ GPIO_MODE_OUTPUT
Definition at32f413_gpio.h:214
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_0
#define GPIO_PINS_0
Definition at32f413_gpio.h:50
GPIO_PINS_2
#define GPIO_PINS_2
Definition at32f413_gpio.h:52
GPIO_PINS_3
#define GPIO_PINS_3
Definition at32f413_gpio.h:53
GPIO_PINS_1
#define GPIO_PINS_1
Definition at32f413_gpio.h:51
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
tmr_counter_enable
void tmr_counter_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr counter
Definition at32f413_tmr.c:114
tmr_counter_value_get
uint32_t tmr_counter_value_get(tmr_type *tmr_x)
get tmr counter value
Definition at32f413_tmr.c:269
tmr_base_init
void tmr_base_init(tmr_type *tmr_x, uint32_t tmr_pr, uint32_t tmr_div)
init tmr base
Definition at32f413_tmr.c:179
tmr_32_bit_function_enable
void tmr_32_bit_function_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr 32 bit function(plus mode)
Definition at32f413_tmr.c:758
tmr_cnt_dir_set
void tmr_cnt_dir_set(tmr_type *tmr_x, tmr_count_mode_type tmr_cnt_dir)
set tmr counter count direction
Definition at32f413_tmr.c:225
tmr_encoder_mode_config
void tmr_encoder_mode_config(tmr_type *tmr_x, tmr_encoder_mode_type encoder_mode, tmr_input_polarity_type ic1_polarity, tmr_input_polarity_type ic2_polarity)
config tmr encoder mode
Definition at32f413_tmr.c:1648
TMR_COUNT_UP
@ TMR_COUNT_UP
Definition at32f413_tmr.h:105
TMR_INPUT_RISING_EDGE
@ TMR_INPUT_RISING_EDGE
Definition at32f413_tmr.h:205
TMR_ENCODER_MODE_C
@ TMR_ENCODER_MODE_C
Definition at32f413_tmr.h:164
TMR2
#define TMR2
Definition at32f413_tmr.h:832
at32f413_clock.h
header file of clock program
crm_clocks_freq_type
crm clocks freqency structure
Definition at32f413_crm.h:470
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • tmr
  • external_clock
  • inc
project/at_start_f413/examples/tmr/external_clock/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • tmr
  • external_clock
  • inc
project/at_start_f413/examples/tmr/external_clock/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • tmr
  • external_clock
  • inc
project/at_start_f413/examples/tmr/external_clock/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • tmr
  • external_clock
  • src
project/at_start_f413/examples/tmr/external_clock/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/tmr/external_clock/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • tmr
  • external_clock
  • src
project/at_start_f413/examples/tmr/external_clock/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/tmr/external_clock/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/tmr/external_clock/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/tmr/external_clock/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/tmr/external_clock/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/tmr/external_clock/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/tmr/external_clock/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/tmr/external_clock/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/tmr/external_clock/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/tmr/external_clock/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • tmr
  • external_clock
  • src
project/at_start_f413/examples/tmr/external_clock/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37 gpio_init_type gpio_init_struct = {0};
38 crm_clocks_freq_type crm_clocks_freq_struct = {0};
39 tmr_output_config_type tmr_output_struct;
40 tmr_input_config_type tmr_input_config_struct;
41
47int main(void)
48{
49 system_clock_config();
50
51 at32_board_init();
52
53 /* get system clock */
54 crm_clocks_freq_get(&crm_clocks_freq_struct);
55
56 /* turn led2/led3/led4 on */
57 at32_led_on(LED2);
58 at32_led_on(LED3);
59 at32_led_on(LED4);
60
61 /* enable tmr2/tmr3/gpioa/gpiob clock */
62 crm_periph_clock_enable(CRM_TMR2_PERIPH_CLOCK, TRUE);
63 crm_periph_clock_enable(CRM_TMR3_PERIPH_CLOCK, TRUE);
64 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
65 crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
66
67 /* timer2 and timer3 output pin Configuration */
68 gpio_init_struct.gpio_pins = GPIO_PINS_0;
69 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
70 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
71 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
72 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
73 gpio_init(GPIOA, &gpio_init_struct);
74 gpio_init(GPIOB, &gpio_init_struct);
75
76 gpio_init_struct.gpio_pins = GPIO_PINS_7;
77 gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
78 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
79 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
80 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
81 gpio_init(GPIOA, &gpio_init_struct);
82
83 /* use tmr2 generate clock to drive tmr3
84 tmr2 pwm frequency = 192000000(systemclock)/192(period+1)/1000(div+1) = 1 khz
85 tmr3 pwm frequency = 1000(tmr2 pwm frequency)/10(period+1)/1(div+1) = 100 hz */
86
87 /* tmr2 and tmr3 counter mode configuration */
88 tmr_base_init(TMR2, 191, 999);
89 tmr_cnt_dir_set(TMR2, TMR_COUNT_UP);
90
91 tmr_base_init(TMR3, 9, 0);
92 tmr_cnt_dir_set(TMR3, TMR_COUNT_UP);
93
94 /* tmr2 and tmr3 output mode configuration */
95 tmr_output_default_para_init(&tmr_output_struct);
96 tmr_output_struct.oc_mode = TMR_OUTPUT_CONTROL_PWM_MODE_A;
97 tmr_output_struct.oc_output_state = TRUE;
98 tmr_output_struct.oc_polarity = TMR_OUTPUT_ACTIVE_HIGH;
99 tmr_output_struct.oc_idle_state = TRUE;
100 tmr_output_struct.occ_output_state = FALSE;
101 tmr_output_struct.occ_polarity = TMR_OUTPUT_ACTIVE_HIGH;
102 tmr_output_struct.occ_idle_state = FALSE;
103 /* tmr2 channel 1 */
104 tmr_output_channel_config(TMR2, TMR_SELECT_CHANNEL_1, &tmr_output_struct);
105 tmr_channel_value_set(TMR2, TMR_SELECT_CHANNEL_1, 96);
106 /* tmr3 channel 3 */
107 tmr_output_channel_config(TMR3, TMR_SELECT_CHANNEL_3, &tmr_output_struct);
108 tmr_channel_value_set(TMR3, TMR_SELECT_CHANNEL_3, 5);
109
110 /* configure tmr3 channel2 to get clock signal */
111 tmr_input_config_struct.input_channel_select = TMR_SELECT_CHANNEL_2;
112 tmr_input_config_struct.input_mapped_select = TMR_CC_CHANNEL_MAPPED_DIRECT;
113 tmr_input_config_struct.input_polarity_select = TMR_INPUT_RISING_EDGE;
114 tmr_input_channel_init(TMR3, &tmr_input_config_struct, TMR_CHANNEL_INPUT_DIV_1);
115
116 /* select the tmr3 input trigger: C2IF2 */
117 tmr_trigger_input_select(TMR3, TMR_SUB_INPUT_SEL_C2DF2);
118
119 /* select the slave mode: external mode a */
120 tmr_sub_mode_select(TMR3, TMR_SUB_EXTERNAL_CLOCK_MODE_A);
121
122 /* enable tmr2 */
123 tmr_counter_enable(TMR2, TRUE);
124
125 /* enable tmr3 */
126 tmr_counter_enable(TMR3, TRUE);
127
128 while(1)
129 {
130 }
131}
132
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/tmr/external_clock/src/main.c:37
tmr_output_struct
tmr_output_config_type tmr_output_struct
Definition project/at_start_f413/examples/tmr/external_clock/src/main.c:39
main
int main(void)
main function.
Definition project/at_start_f413/examples/tmr/external_clock/src/main.c:47
tmr_input_config_struct
tmr_input_config_type tmr_input_config_struct
Definition project/at_start_f413/examples/tmr/external_clock/src/main.c:40
crm_clocks_freq_struct
crm_clocks_freq_type crm_clocks_freq_struct
Definition project/at_start_f413/examples/tmr/external_clock/src/main.c:38
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_clocks_freq_get
void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
Definition at32f413_crm.c:660
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_TMR2_PERIPH_CLOCK
@ CRM_TMR2_PERIPH_CLOCK
Definition at32f413_crm.h:125
CRM_TMR3_PERIPH_CLOCK
@ CRM_TMR3_PERIPH_CLOCK
Definition at32f413_crm.h:126
CRM_GPIOB_PERIPH_CLOCK
@ CRM_GPIOB_PERIPH_CLOCK
Definition at32f413_crm.h:110
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_0
#define GPIO_PINS_0
Definition at32f413_gpio.h:50
GPIO_PINS_7
#define GPIO_PINS_7
Definition at32f413_gpio.h:57
GPIOB
#define GPIOB
Definition at32f413_gpio.h:748
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
tmr_counter_enable
void tmr_counter_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr counter
Definition at32f413_tmr.c:114
tmr_output_channel_config
void tmr_output_channel_config(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_output_config_type *tmr_output_struct)
config tmr output channel
Definition at32f413_tmr.c:318
tmr_input_channel_init
void tmr_input_channel_init(tmr_type *tmr_x, tmr_input_config_type *input_struct, tmr_channel_input_divider_type divider_factor)
init tmr input channel
Definition at32f413_tmr.c:816
tmr_sub_mode_select
void tmr_sub_mode_select(tmr_type *tmr_x, tmr_sub_mode_select_type sub_mode)
select tmr subordinate mode
Definition at32f413_tmr.c:1196
tmr_output_default_para_init
void tmr_output_default_para_init(tmr_output_config_type *tmr_output_struct)
init tmr output default para
Definition at32f413_tmr.c:126
tmr_base_init
void tmr_base_init(tmr_type *tmr_x, uint32_t tmr_pr, uint32_t tmr_div)
init tmr base
Definition at32f413_tmr.c:179
tmr_trigger_input_select
void tmr_trigger_input_select(tmr_type *tmr_x, sub_tmr_input_sel_type trigger_select)
select tmr sub-trigger
Definition at32f413_tmr.c:1260
tmr_cnt_dir_set
void tmr_cnt_dir_set(tmr_type *tmr_x, tmr_count_mode_type tmr_cnt_dir)
set tmr counter count direction
Definition at32f413_tmr.c:225
tmr_channel_value_set
void tmr_channel_value_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, uint32_t tmr_channel_value)
set tmr channel value
Definition at32f413_tmr.c:506
TMR_COUNT_UP
@ TMR_COUNT_UP
Definition at32f413_tmr.h:105
TMR_INPUT_RISING_EDGE
@ TMR_INPUT_RISING_EDGE
Definition at32f413_tmr.h:205
TMR_SELECT_CHANNEL_3
@ TMR_SELECT_CHANNEL_3
Definition at32f413_tmr.h:219
TMR_SELECT_CHANNEL_1
@ TMR_SELECT_CHANNEL_1
Definition at32f413_tmr.h:215
TMR_SELECT_CHANNEL_2
@ TMR_SELECT_CHANNEL_2
Definition at32f413_tmr.h:217
TMR_CC_CHANNEL_MAPPED_DIRECT
@ TMR_CC_CHANNEL_MAPPED_DIRECT
Definition at32f413_tmr.h:238
TMR_OUTPUT_CONTROL_PWM_MODE_A
@ TMR_OUTPUT_CONTROL_PWM_MODE_A
Definition at32f413_tmr.h:178
TMR_OUTPUT_ACTIVE_HIGH
@ TMR_OUTPUT_ACTIVE_HIGH
Definition at32f413_tmr.h:196
TMR_SUB_INPUT_SEL_C2DF2
@ TMR_SUB_INPUT_SEL_C2DF2
Definition at32f413_tmr.h:138
TMR_SUB_EXTERNAL_CLOCK_MODE_A
@ TMR_SUB_EXTERNAL_CLOCK_MODE_A
Definition at32f413_tmr.h:154
TMR_CHANNEL_INPUT_DIV_1
@ TMR_CHANNEL_INPUT_DIV_1
Definition at32f413_tmr.h:248
TMR3
#define TMR3
Definition at32f413_tmr.h:833
TMR2
#define TMR2
Definition at32f413_tmr.h:832
at32f413_clock.h
header file of clock program
crm_clocks_freq_type
crm clocks freqency structure
Definition at32f413_crm.h:470
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
tmr_input_config_type
tmr input capture config type
Definition at32f413_tmr.h:411
tmr_input_config_type::input_mapped_select
tmr_input_direction_mapped_type input_mapped_select
Definition at32f413_tmr.h:414
tmr_input_config_type::input_polarity_select
tmr_input_polarity_type input_polarity_select
Definition at32f413_tmr.h:413
tmr_input_config_type::input_channel_select
tmr_channel_select_type input_channel_select
Definition at32f413_tmr.h:412
tmr_output_config_type
tmr output config type
Definition at32f413_tmr.h:397
tmr_output_config_type::occ_output_state
confirm_state occ_output_state
Definition at32f413_tmr.h:404
tmr_output_config_type::oc_idle_state
confirm_state oc_idle_state
Definition at32f413_tmr.h:399
tmr_output_config_type::oc_output_state
confirm_state oc_output_state
Definition at32f413_tmr.h:403
tmr_output_config_type::oc_mode
tmr_output_control_mode_type oc_mode
Definition at32f413_tmr.h:398
tmr_output_config_type::occ_polarity
tmr_output_polarity_type occ_polarity
Definition at32f413_tmr.h:402
tmr_output_config_type::occ_idle_state
confirm_state occ_idle_state
Definition at32f413_tmr.h:400
tmr_output_config_type::oc_polarity
tmr_output_polarity_type oc_polarity
Definition at32f413_tmr.h:401


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • tmr
  • hall_xor_tmr2
  • inc
project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • tmr
  • hall_xor_tmr2
  • inc
project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • tmr
  • hall_xor_tmr2
  • inc
project/at_start_f413/examples/tmr/hall_xor_tmr2/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • tmr
  • hall_xor_tmr2
  • src
project/at_start_f413/examples/tmr/hall_xor_tmr2/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/tmr/hall_xor_tmr2/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • tmr
  • hall_xor_tmr2
  • src
project/at_start_f413/examples/tmr/hall_xor_tmr2/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/tmr/hall_xor_tmr2/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/tmr/hall_xor_tmr2/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/tmr/hall_xor_tmr2/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/tmr/hall_xor_tmr2/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/tmr/hall_xor_tmr2/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/tmr/hall_xor_tmr2/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/tmr/hall_xor_tmr2/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/tmr/hall_xor_tmr2/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/tmr/hall_xor_tmr2/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • tmr
  • hall_xor_tmr2
  • src
project/at_start_f413/examples/tmr/hall_xor_tmr2/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37 gpio_init_type gpio_init_struct = {0};
38 crm_clocks_freq_type crm_clocks_freq_struct = {0};
39 tmr_output_config_type tmr_output_struct;
40 tmr_input_config_type tmr_input_config_struct;
41
47int main(void)
48{
49 system_clock_config();
50
51 at32_board_init();
52
53 /* get system clock */
54 crm_clocks_freq_get(&crm_clocks_freq_struct);
55
56 /* turn led2/led3/led4 on */
57 at32_led_on(LED2);
58 at32_led_on(LED3);
59 at32_led_on(LED4);
60
61 /* enable tmr2/tmr3/gpioa/gpiob clock */
62 crm_periph_clock_enable(CRM_TMR2_PERIPH_CLOCK, TRUE);
63 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
64
65 /* tmr2 channel1 ,channel2 and channel3 configuration */
66 gpio_init_struct.gpio_pins = GPIO_PINS_0 | GPIO_PINS_1 | GPIO_PINS_2;
67 gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
68 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
69 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
70 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
71 gpio_init(GPIOA, &gpio_init_struct);
72
73 /* hall signal (pa3 ,pa6 ,pa7) and trigger flag signal(pa8) configuration */
74 gpio_init_struct.gpio_pins = GPIO_PINS_3 | GPIO_PINS_6 | GPIO_PINS_7 | GPIO_PINS_8;
75 gpio_init_struct.gpio_mode = GPIO_MODE_OUTPUT;
76 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
77 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
78 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
79 gpio_init(GPIOA, &gpio_init_struct);
80
81 /* tmr2 xor mode configuration
82 tmr2 channel1 ,channel2 and channel3 as hall signal input channel, trigger
83 generated each signal edge. */
84
85 /* tmr2 and tmr3 counter mode configuration */
86 tmr_32_bit_function_enable(TMR2, TRUE);
87
88 tmr_base_init(TMR2, 0xFFFFFFFF, 0);
89 tmr_cnt_dir_set(TMR2, TMR_COUNT_UP);
90
91 /* config ti1 trc as input source */
92 tmr_input_config_struct.input_channel_select = TMR_SELECT_CHANNEL_1;
93 tmr_input_config_struct.input_mapped_select = TMR_CC_CHANNEL_MAPPED_STI;
94 tmr_input_config_struct.input_polarity_select = TMR_INPUT_RISING_EDGE;
95 tmr_input_channel_init(TMR2, &tmr_input_config_struct, TMR_CHANNEL_INPUT_DIV_1);
96
97 /* xor funtion enable */
98 tmr_channel1_input_select(TMR2, TMR_CHANEL1_2_3_CONNECTED_C1IRAW_XOR);
99
100 /* select the tmr2 input trigger: C1INC */
101 tmr_trigger_input_select(TMR2, TMR_SUB_INPUT_SEL_C1INC);
102
103 /* select the slave mode: reset mode */
104 tmr_sub_mode_select(TMR2, TMR_SUB_RESET_MODE);
105
106 tmr_interrupt_enable(TMR2, TMR_TRIGGER_INT, TRUE);
107
108 /* tmr2 trigger interrupt nvic init */
109 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
110 nvic_irq_enable(TMR2_GLOBAL_IRQn, 0, 0);
111
112 /* enable tmr2 */
113 tmr_counter_enable(TMR2, TRUE);
114
115 while(1)
116 {
117 /* generate hall signal */
118 gpio_bits_set(GPIOA, GPIO_PINS_3);
119 delay_us(10);
120 gpio_bits_set(GPIOA, GPIO_PINS_6);
121 delay_us(10);
122 gpio_bits_set(GPIOA, GPIO_PINS_7);
123 delay_us(10);
124 gpio_bits_reset(GPIOA, GPIO_PINS_3);
125 delay_us(10);
126 gpio_bits_reset(GPIOA, GPIO_PINS_6);
127 delay_us(10);
128 gpio_bits_reset(GPIOA, GPIO_PINS_7);
129 delay_us(10);
130 }
131}
132
138void TMR2_GLOBAL_IRQHandler(void)
139{
140 if(tmr_interrupt_flag_get(TMR2, TMR_TRIGGER_FLAG) != RESET)
141 {
142 GPIOA->odt ^= GPIO_PINS_8;
143 tmr_flag_clear(TMR2, TMR_TRIGGER_FLAG);
144 }
145}
146
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/tmr/hall_xor_tmr2/src/main.c:37
tmr_output_struct
tmr_output_config_type tmr_output_struct
Definition project/at_start_f413/examples/tmr/hall_xor_tmr2/src/main.c:39
TMR2_GLOBAL_IRQHandler
void TMR2_GLOBAL_IRQHandler(void)
this function handles TMR2 trigger exception.
Definition project/at_start_f413/examples/tmr/hall_xor_tmr2/src/main.c:138
main
int main(void)
main function.
Definition project/at_start_f413/examples/tmr/hall_xor_tmr2/src/main.c:47
tmr_input_config_struct
tmr_input_config_type tmr_input_config_struct
Definition project/at_start_f413/examples/tmr/hall_xor_tmr2/src/main.c:40
crm_clocks_freq_struct
crm_clocks_freq_type crm_clocks_freq_struct
Definition project/at_start_f413/examples/tmr/hall_xor_tmr2/src/main.c:38
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
delay_us
void delay_us(uint32_t nus)
inserts a delay time.
Definition at32f413_board.c:330
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_clocks_freq_get
void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
Definition at32f413_crm.c:660
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_TMR2_PERIPH_CLOCK
@ CRM_TMR2_PERIPH_CLOCK
Definition at32f413_crm.h:125
TMR2_GLOBAL_IRQn
@ TMR2_GLOBAL_IRQn
Definition at32f413.h:200
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
gpio_bits_reset
void gpio_bits_reset(gpio_type *gpio_x, uint16_t pins)
clear the selected data port bits.
Definition at32f413_gpio.c:340
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_bits_set
void gpio_bits_set(gpio_type *gpio_x, uint16_t pins)
set the selected data port bits.
Definition at32f413_gpio.c:309
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_MODE_OUTPUT
@ GPIO_MODE_OUTPUT
Definition at32f413_gpio.h:214
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_6
#define GPIO_PINS_6
Definition at32f413_gpio.h:56
GPIO_PINS_0
#define GPIO_PINS_0
Definition at32f413_gpio.h:50
GPIO_PINS_2
#define GPIO_PINS_2
Definition at32f413_gpio.h:52
GPIO_PINS_7
#define GPIO_PINS_7
Definition at32f413_gpio.h:57
GPIO_PINS_3
#define GPIO_PINS_3
Definition at32f413_gpio.h:53
GPIO_PINS_8
#define GPIO_PINS_8
Definition at32f413_gpio.h:58
GPIO_PINS_1
#define GPIO_PINS_1
Definition at32f413_gpio.h:51
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
tmr_flag_clear
void tmr_flag_clear(tmr_type *tmr_x, uint32_t tmr_flag)
clear tmr flag
Definition at32f413_tmr.c:1433
tmr_counter_enable
void tmr_counter_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr counter
Definition at32f413_tmr.c:114
tmr_interrupt_flag_get
flag_status tmr_interrupt_flag_get(tmr_type *tmr_x, uint32_t tmr_flag)
get tmr interrupt flag
Definition at32f413_tmr.c:1357
tmr_input_channel_init
void tmr_input_channel_init(tmr_type *tmr_x, tmr_input_config_type *input_struct, tmr_channel_input_divider_type divider_factor)
init tmr input channel
Definition at32f413_tmr.c:816
tmr_sub_mode_select
void tmr_sub_mode_select(tmr_type *tmr_x, tmr_sub_mode_select_type sub_mode)
select tmr subordinate mode
Definition at32f413_tmr.c:1196
tmr_base_init
void tmr_base_init(tmr_type *tmr_x, uint32_t tmr_pr, uint32_t tmr_div)
init tmr base
Definition at32f413_tmr.c:179
tmr_channel1_input_select
void tmr_channel1_input_select(tmr_type *tmr_x, tmr_channel1_input_connected_type ch1_connect)
select tmr channel1 input
Definition at32f413_tmr.c:1102
tmr_32_bit_function_enable
void tmr_32_bit_function_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr 32 bit function(plus mode)
Definition at32f413_tmr.c:758
tmr_trigger_input_select
void tmr_trigger_input_select(tmr_type *tmr_x, sub_tmr_input_sel_type trigger_select)
select tmr sub-trigger
Definition at32f413_tmr.c:1260
tmr_interrupt_enable
void tmr_interrupt_enable(tmr_type *tmr_x, uint32_t tmr_interrupt, confirm_state new_state)
enable or disable tmr interrupt
Definition at32f413_tmr.c:1327
tmr_cnt_dir_set
void tmr_cnt_dir_set(tmr_type *tmr_x, tmr_count_mode_type tmr_cnt_dir)
set tmr counter count direction
Definition at32f413_tmr.c:225
TMR_COUNT_UP
@ TMR_COUNT_UP
Definition at32f413_tmr.h:105
TMR_INPUT_RISING_EDGE
@ TMR_INPUT_RISING_EDGE
Definition at32f413_tmr.h:205
TMR_SELECT_CHANNEL_1
@ TMR_SELECT_CHANNEL_1
Definition at32f413_tmr.h:215
TMR_CHANEL1_2_3_CONNECTED_C1IRAW_XOR
@ TMR_CHANEL1_2_3_CONNECTED_C1IRAW_XOR
Definition at32f413_tmr.h:230
TMR_CC_CHANNEL_MAPPED_STI
@ TMR_CC_CHANNEL_MAPPED_STI
Definition at32f413_tmr.h:240
TMR_SUB_INPUT_SEL_C1INC
@ TMR_SUB_INPUT_SEL_C1INC
Definition at32f413_tmr.h:136
TMR_SUB_RESET_MODE
@ TMR_SUB_RESET_MODE
Definition at32f413_tmr.h:151
TMR_CHANNEL_INPUT_DIV_1
@ TMR_CHANNEL_INPUT_DIV_1
Definition at32f413_tmr.h:248
TMR_TRIGGER_FLAG
#define TMR_TRIGGER_FLAG
Definition at32f413_tmr.h:57
TMR_TRIGGER_INT
#define TMR_TRIGGER_INT
Definition at32f413_tmr.h:79
TMR2
#define TMR2
Definition at32f413_tmr.h:832
at32f413_clock.h
header file of clock program
crm_clocks_freq_type
crm clocks freqency structure
Definition at32f413_crm.h:470
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
tmr_input_config_type
tmr input capture config type
Definition at32f413_tmr.h:411
tmr_input_config_type::input_mapped_select
tmr_input_direction_mapped_type input_mapped_select
Definition at32f413_tmr.h:414
tmr_input_config_type::input_polarity_select
tmr_input_polarity_type input_polarity_select
Definition at32f413_tmr.h:413
tmr_input_config_type::input_channel_select
tmr_channel_select_type input_channel_select
Definition at32f413_tmr.h:412
tmr_output_config_type
tmr output config type
Definition at32f413_tmr.h:397


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • tmr
  • hang_mode
  • inc
project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • tmr
  • hang_mode
  • inc
project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • tmr
  • hang_mode
  • inc
project/at_start_f413/examples/tmr/hang_mode/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • tmr
  • hang_mode
  • src
project/at_start_f413/examples/tmr/hang_mode/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/tmr/hang_mode/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • tmr
  • hang_mode
  • src
project/at_start_f413/examples/tmr/hang_mode/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/tmr/hang_mode/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/tmr/hang_mode/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/tmr/hang_mode/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/tmr/hang_mode/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/tmr/hang_mode/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/tmr/hang_mode/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/tmr/hang_mode/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/tmr/hang_mode/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/tmr/hang_mode/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • tmr
  • hang_mode
  • src
project/at_start_f413/examples/tmr/hang_mode/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37 gpio_init_type gpio_init_struct = {0};
38 crm_clocks_freq_type crm_clocks_freq_struct = {0};
39 tmr_output_config_type tmr_output_struct;
40 tmr_input_config_type tmr_input_config_struct;
41
47int main(void)
48{
49 system_clock_config();
50
51 at32_board_init();
52
53 /* get system clock */
54 crm_clocks_freq_get(&crm_clocks_freq_struct);
55
56 /* turn led2/led3/led4 on */
57 at32_led_on(LED2);
58 at32_led_on(LED3);
59 at32_led_on(LED4);
60
61 /* enable tmr1/gpioa clock */
62 crm_periph_clock_enable(CRM_TMR1_PERIPH_CLOCK, TRUE);
63 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
64
65 /* timer1 output pin configuration */
66 gpio_init_struct.gpio_pins = GPIO_PINS_8;
67 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
68 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
69 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
70 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
71 gpio_init(GPIOA, &gpio_init_struct);
72
73 gpio_init_struct.gpio_pins = GPIO_PINS_9;
74 gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
75 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
76 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
77 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
78 gpio_init(GPIOA, &gpio_init_struct);
79
80 /* hang mode test
81 1/tmr1 is configured as master timer:
82 - toggle mode is used
83
84 2/tmr1 is configured as slave timer for an external trigger connected
85 to tmr1 ti2 pin (tmr1 ch2 configured as input pin):
86 - the tmr1 ti2fp2 is used as trigger input
87 - rising edge is used to start and stop the tmr1: hang mode.
88
89 the tmr1 are running at:
90 tmrx frequency = tmrx clock counter/ 2*(timx_period + 1) = 500 khz.
91 */
92
93 tmr_base_init(TMR1, 191, 0);
94 tmr_cnt_dir_set(TMR1, TMR_COUNT_UP);
95
96 /* tmr1 output mode configuration */
97 tmr_output_default_para_init(&tmr_output_struct);
98 tmr_output_struct.oc_mode = TMR_OUTPUT_CONTROL_SWITCH;
99 tmr_output_struct.oc_output_state = TRUE;
100 tmr_output_struct.oc_polarity = TMR_OUTPUT_ACTIVE_HIGH;
101 tmr_output_struct.oc_idle_state = TRUE;
102 tmr_output_struct.occ_output_state = FALSE;
103 tmr_output_struct.occ_polarity = TMR_OUTPUT_ACTIVE_HIGH;
104 tmr_output_struct.occ_idle_state = FALSE;
105 /* tmr1 channel 1 */
106 tmr_output_channel_config(TMR1, TMR_SELECT_CHANNEL_1, &tmr_output_struct);
107 tmr_channel_value_set(TMR1, TMR_SELECT_CHANNEL_1, 50);
108
109 /* configure tmr1 channel2 to get hang signal */
110 tmr_input_default_para_init(&tmr_input_config_struct);
111 tmr_input_config_struct.input_channel_select = TMR_SELECT_CHANNEL_2;
112 tmr_input_config_struct.input_mapped_select = TMR_CC_CHANNEL_MAPPED_DIRECT;
113 tmr_input_config_struct.input_polarity_select = TMR_INPUT_RISING_EDGE;
114 tmr_input_channel_init(TMR1, &tmr_input_config_struct, TMR_CHANNEL_INPUT_DIV_1);
115
116 /* select the tmr1 input trigger: c2df2 */
117 tmr_trigger_input_select(TMR1, TMR_SUB_INPUT_SEL_C2DF2);
118
119 /* select the slave mode: hang mode */
120 tmr_sub_mode_select(TMR1, TMR_SUB_HANG_MODE);
121
122 /* output enable */
123 tmr_output_enable(TMR1, TRUE);
124
125 /* enable tmr1 */
126 tmr_counter_enable(TMR1, TRUE);
127
128 while(1)
129 {
130 }
131}
132
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/tmr/hang_mode/src/main.c:37
tmr_output_struct
tmr_output_config_type tmr_output_struct
Definition project/at_start_f413/examples/tmr/hang_mode/src/main.c:39
main
int main(void)
main function.
Definition project/at_start_f413/examples/tmr/hang_mode/src/main.c:47
tmr_input_config_struct
tmr_input_config_type tmr_input_config_struct
Definition project/at_start_f413/examples/tmr/hang_mode/src/main.c:40
crm_clocks_freq_struct
crm_clocks_freq_type crm_clocks_freq_struct
Definition project/at_start_f413/examples/tmr/hang_mode/src/main.c:38
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_clocks_freq_get
void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
Definition at32f413_crm.c:660
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_TMR1_PERIPH_CLOCK
@ CRM_TMR1_PERIPH_CLOCK
Definition at32f413_crm.h:116
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_9
#define GPIO_PINS_9
Definition at32f413_gpio.h:59
GPIO_PINS_8
#define GPIO_PINS_8
Definition at32f413_gpio.h:58
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
tmr_counter_enable
void tmr_counter_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr counter
Definition at32f413_tmr.c:114
tmr_output_channel_config
void tmr_output_channel_config(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_output_config_type *tmr_output_struct)
config tmr output channel
Definition at32f413_tmr.c:318
tmr_input_channel_init
void tmr_input_channel_init(tmr_type *tmr_x, tmr_input_config_type *input_struct, tmr_channel_input_divider_type divider_factor)
init tmr input channel
Definition at32f413_tmr.c:816
tmr_sub_mode_select
void tmr_sub_mode_select(tmr_type *tmr_x, tmr_sub_mode_select_type sub_mode)
select tmr subordinate mode
Definition at32f413_tmr.c:1196
tmr_input_default_para_init
void tmr_input_default_para_init(tmr_input_config_type *tmr_input_struct)
init tmr input default para
Definition at32f413_tmr.c:143
tmr_output_default_para_init
void tmr_output_default_para_init(tmr_output_config_type *tmr_output_struct)
init tmr output default para
Definition at32f413_tmr.c:126
tmr_output_enable
void tmr_output_enable(tmr_type *tmr_x, confirm_state new_state)
tmr output enable(oen),this function is important for advtm output enable
Definition at32f413_tmr.c:1469
tmr_base_init
void tmr_base_init(tmr_type *tmr_x, uint32_t tmr_pr, uint32_t tmr_div)
init tmr base
Definition at32f413_tmr.c:179
tmr_trigger_input_select
void tmr_trigger_input_select(tmr_type *tmr_x, sub_tmr_input_sel_type trigger_select)
select tmr sub-trigger
Definition at32f413_tmr.c:1260
tmr_cnt_dir_set
void tmr_cnt_dir_set(tmr_type *tmr_x, tmr_count_mode_type tmr_cnt_dir)
set tmr counter count direction
Definition at32f413_tmr.c:225
tmr_channel_value_set
void tmr_channel_value_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, uint32_t tmr_channel_value)
set tmr channel value
Definition at32f413_tmr.c:506
TMR_COUNT_UP
@ TMR_COUNT_UP
Definition at32f413_tmr.h:105
TMR_INPUT_RISING_EDGE
@ TMR_INPUT_RISING_EDGE
Definition at32f413_tmr.h:205
TMR_SELECT_CHANNEL_1
@ TMR_SELECT_CHANNEL_1
Definition at32f413_tmr.h:215
TMR_SELECT_CHANNEL_2
@ TMR_SELECT_CHANNEL_2
Definition at32f413_tmr.h:217
TMR_CC_CHANNEL_MAPPED_DIRECT
@ TMR_CC_CHANNEL_MAPPED_DIRECT
Definition at32f413_tmr.h:238
TMR_OUTPUT_CONTROL_SWITCH
@ TMR_OUTPUT_CONTROL_SWITCH
Definition at32f413_tmr.h:175
TMR_OUTPUT_ACTIVE_HIGH
@ TMR_OUTPUT_ACTIVE_HIGH
Definition at32f413_tmr.h:196
TMR_SUB_INPUT_SEL_C2DF2
@ TMR_SUB_INPUT_SEL_C2DF2
Definition at32f413_tmr.h:138
TMR_SUB_HANG_MODE
@ TMR_SUB_HANG_MODE
Definition at32f413_tmr.h:152
TMR_CHANNEL_INPUT_DIV_1
@ TMR_CHANNEL_INPUT_DIV_1
Definition at32f413_tmr.h:248
TMR1
#define TMR1
Definition at32f413_tmr.h:831
at32f413_clock.h
header file of clock program
crm_clocks_freq_type
crm clocks freqency structure
Definition at32f413_crm.h:470
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
tmr_input_config_type
tmr input capture config type
Definition at32f413_tmr.h:411
tmr_input_config_type::input_mapped_select
tmr_input_direction_mapped_type input_mapped_select
Definition at32f413_tmr.h:414
tmr_input_config_type::input_polarity_select
tmr_input_polarity_type input_polarity_select
Definition at32f413_tmr.h:413
tmr_input_config_type::input_channel_select
tmr_channel_select_type input_channel_select
Definition at32f413_tmr.h:412
tmr_output_config_type
tmr output config type
Definition at32f413_tmr.h:397
tmr_output_config_type::occ_output_state
confirm_state occ_output_state
Definition at32f413_tmr.h:404
tmr_output_config_type::oc_idle_state
confirm_state oc_idle_state
Definition at32f413_tmr.h:399
tmr_output_config_type::oc_output_state
confirm_state oc_output_state
Definition at32f413_tmr.h:403
tmr_output_config_type::oc_mode
tmr_output_control_mode_type oc_mode
Definition at32f413_tmr.h:398
tmr_output_config_type::occ_polarity
tmr_output_polarity_type occ_polarity
Definition at32f413_tmr.h:402
tmr_output_config_type::occ_idle_state
confirm_state occ_idle_state
Definition at32f413_tmr.h:400
tmr_output_config_type::oc_polarity
tmr_output_polarity_type oc_polarity
Definition at32f413_tmr.h:401


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • tmr
  • input_capture
  • inc
project/at_start_f413/examples/tmr/input_capture/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • tmr
  • input_capture
  • inc
project/at_start_f413/examples/tmr/input_capture/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • tmr
  • input_capture
  • inc
project/at_start_f413/examples/tmr/input_capture/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • tmr
  • input_capture
  • src
project/at_start_f413/examples/tmr/input_capture/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/tmr/input_capture/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • tmr
  • input_capture
  • src
project/at_start_f413/examples/tmr/input_capture/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/tmr/input_capture/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/tmr/input_capture/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/tmr/input_capture/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/tmr/input_capture/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/tmr/input_capture/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/tmr/input_capture/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/tmr/input_capture/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/tmr/input_capture/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/tmr/input_capture/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • tmr
  • input_capture
  • src
project/at_start_f413/examples/tmr/input_capture/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37 gpio_init_type gpio_init_struct = {0};
38 crm_clocks_freq_type crm_clocks_freq_struct = {0};
39 tmr_input_config_type tmr_input_config_struct;
40void uart_init(uint32_t baudrate);
41__IO uint32_t tmr3freq = 0;
42__IO uint32_t sys_counter = 0;
43__IO uint16_t capturenumber = 0;
44__IO uint16_t ch3readvalue1 = 0, ch3readvalue2 = 0;
45__IO uint32_t capture = 0;
46
52void TMR3_GLOBAL_IRQHandler(void)
53{
54 if(tmr_interrupt_flag_get(TMR3, TMR_C2_FLAG) != RESET)
55 {
56 tmr_flag_clear(TMR3, TMR_C2_FLAG);
57 if(capturenumber == 0)
58 {
59 /* get the Input Capture value */
60 ch3readvalue1 = tmr_channel_value_get(TMR3, TMR_SELECT_CHANNEL_2);
61 capturenumber = 1;
62 }
63 else if(capturenumber == 1)
64 {
65 /* get the Input Capture value */
66 ch3readvalue2 = tmr_channel_value_get(TMR3, TMR_SELECT_CHANNEL_2);
67
68 /* capture computation */
69 if(ch3readvalue2 > ch3readvalue1)
70 {
71 capture = (ch3readvalue2 - ch3readvalue1);
72 }
73 else
74 {
75 capture = ((0x10000 - ch3readvalue1) + ch3readvalue2);
76 }
77
78 /* frequency computation */
79 tmr3freq = (uint32_t) crm_clocks_freq_struct.sclk_freq / capture;
80 capturenumber = 0;
81 }
82 }
83}
84
90int main(void)
91{
92 system_clock_config();
93
94 at32_board_init();
95
96 uart_print_init(115200);
97
98 /* get system clock */
99 crm_clocks_freq_get(&crm_clocks_freq_struct);
100
101 /* turn led2/led3/led4 on */
102 at32_led_on(LED2);
103 at32_led_on(LED3);
104 at32_led_on(LED4);
105
106 /* enable tmr3/gpioa clock */
107 crm_periph_clock_enable(CRM_TMR3_PERIPH_CLOCK, TRUE);
108 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
109
110 /* timer3 input pin Configuration */
111 gpio_init_struct.gpio_pins = GPIO_PINS_7;
112 gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
113 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
114 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
115 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
116 gpio_init(GPIOA, &gpio_init_struct);
117
118 /* tmr3 configuration: input capture mode
119 the external signal is connected to tmr3 ch2 pin (pa.07)
120 the rising edge is used as active edge,
121 the tmr3 c2dt is used to compute the frequency value */
122
123 /* tmr3 counter mode configuration */
124 tmr_base_init(TMR3, 0xFFFF, 0);
125 tmr_cnt_dir_set(TMR3, TMR_COUNT_UP);
126
127 /* configure tmr3 channel2 to get clock signal */
128 tmr_input_config_struct.input_channel_select = TMR_SELECT_CHANNEL_2;
129 tmr_input_config_struct.input_mapped_select = TMR_CC_CHANNEL_MAPPED_DIRECT;
130 tmr_input_config_struct.input_polarity_select = TMR_INPUT_RISING_EDGE;
131 tmr_input_channel_init(TMR3, &tmr_input_config_struct, TMR_CHANNEL_INPUT_DIV_1);
132
133 tmr_interrupt_enable(TMR3, TMR_C2_INT, TRUE);
134
135 /* tmr2 trigger interrupt nvic init */
136 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
137 nvic_irq_enable(TMR3_GLOBAL_IRQn, 0, 0);
138
139 /* enable tmr3 */
140 tmr_counter_enable(TMR3, TRUE);
141
142 while(1)
143 {
144 delay_ms(100);
145 printf("The external signal frequece is : %d\r\n",tmr3freq);
146 tmr3freq = 0;
147 }
148}
149
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/tmr/input_capture/src/main.c:37
ch3readvalue2
__IO uint16_t ch3readvalue2
Definition project/at_start_f413/examples/tmr/input_capture/src/main.c:44
ch3readvalue1
__IO uint16_t ch3readvalue1
Definition project/at_start_f413/examples/tmr/input_capture/src/main.c:44
tmr3freq
__IO uint32_t tmr3freq
Definition project/at_start_f413/examples/tmr/input_capture/src/main.c:41
capturenumber
__IO uint16_t capturenumber
Definition project/at_start_f413/examples/tmr/input_capture/src/main.c:43
TMR3_GLOBAL_IRQHandler
void TMR3_GLOBAL_IRQHandler(void)
this function handles tmr3 trigger exception.
Definition project/at_start_f413/examples/tmr/input_capture/src/main.c:52
main
int main(void)
main function.
Definition project/at_start_f413/examples/tmr/input_capture/src/main.c:90
uart_init
void uart_init(uint32_t baudrate)
init usart.
Definition app_led3_toggle/src/usart.c:44
tmr_input_config_struct
tmr_input_config_type tmr_input_config_struct
Definition project/at_start_f413/examples/tmr/input_capture/src/main.c:39
crm_clocks_freq_struct
crm_clocks_freq_type crm_clocks_freq_struct
Definition project/at_start_f413/examples/tmr/input_capture/src/main.c:38
sys_counter
__IO uint32_t sys_counter
Definition project/at_start_f413/examples/tmr/input_capture/src/main.c:42
capture
__IO uint32_t capture
Definition project/at_start_f413/examples/tmr/input_capture/src/main.c:45
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
uart_print_init
void uart_print_init(uint32_t baudrate)
initialize uart
Definition at32f413_board.c:129
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_clocks_freq_get
void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
Definition at32f413_crm.c:660
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_TMR3_PERIPH_CLOCK
@ CRM_TMR3_PERIPH_CLOCK
Definition at32f413_crm.h:126
TMR3_GLOBAL_IRQn
@ TMR3_GLOBAL_IRQn
Definition at32f413.h:201
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_7
#define GPIO_PINS_7
Definition at32f413_gpio.h:57
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
tmr_channel_value_get
uint32_t tmr_channel_value_get(tmr_type *tmr_x, tmr_channel_select_type tmr_channel)
get tmr channel value
Definition at32f413_tmr.c:551
tmr_flag_clear
void tmr_flag_clear(tmr_type *tmr_x, uint32_t tmr_flag)
clear tmr flag
Definition at32f413_tmr.c:1433
tmr_counter_enable
void tmr_counter_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr counter
Definition at32f413_tmr.c:114
tmr_interrupt_flag_get
flag_status tmr_interrupt_flag_get(tmr_type *tmr_x, uint32_t tmr_flag)
get tmr interrupt flag
Definition at32f413_tmr.c:1357
tmr_input_channel_init
void tmr_input_channel_init(tmr_type *tmr_x, tmr_input_config_type *input_struct, tmr_channel_input_divider_type divider_factor)
init tmr input channel
Definition at32f413_tmr.c:816
tmr_base_init
void tmr_base_init(tmr_type *tmr_x, uint32_t tmr_pr, uint32_t tmr_div)
init tmr base
Definition at32f413_tmr.c:179
tmr_interrupt_enable
void tmr_interrupt_enable(tmr_type *tmr_x, uint32_t tmr_interrupt, confirm_state new_state)
enable or disable tmr interrupt
Definition at32f413_tmr.c:1327
tmr_cnt_dir_set
void tmr_cnt_dir_set(tmr_type *tmr_x, tmr_count_mode_type tmr_cnt_dir)
set tmr counter count direction
Definition at32f413_tmr.c:225
TMR_COUNT_UP
@ TMR_COUNT_UP
Definition at32f413_tmr.h:105
TMR_INPUT_RISING_EDGE
@ TMR_INPUT_RISING_EDGE
Definition at32f413_tmr.h:205
TMR_SELECT_CHANNEL_2
@ TMR_SELECT_CHANNEL_2
Definition at32f413_tmr.h:217
TMR_CC_CHANNEL_MAPPED_DIRECT
@ TMR_CC_CHANNEL_MAPPED_DIRECT
Definition at32f413_tmr.h:238
TMR_CHANNEL_INPUT_DIV_1
@ TMR_CHANNEL_INPUT_DIV_1
Definition at32f413_tmr.h:248
TMR_C2_FLAG
#define TMR_C2_FLAG
Definition at32f413_tmr.h:53
TMR_C2_INT
#define TMR_C2_INT
Definition at32f413_tmr.h:75
TMR3
#define TMR3
Definition at32f413_tmr.h:833
at32f413_clock.h
header file of clock program
crm_clocks_freq_type
crm clocks freqency structure
Definition at32f413_crm.h:470
crm_clocks_freq_type::sclk_freq
uint32_t sclk_freq
Definition at32f413_crm.h:471
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
tmr_input_config_type
tmr input capture config type
Definition at32f413_tmr.h:411
tmr_input_config_type::input_mapped_select
tmr_input_direction_mapped_type input_mapped_select
Definition at32f413_tmr.h:414
tmr_input_config_type::input_polarity_select
tmr_input_polarity_type input_polarity_select
Definition at32f413_tmr.h:413
tmr_input_config_type::input_channel_select
tmr_channel_select_type input_channel_select
Definition at32f413_tmr.h:412


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • tmr
  • oc_high
  • inc
project/at_start_f413/examples/tmr/oc_high/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • tmr
  • oc_high
  • inc
project/at_start_f413/examples/tmr/oc_high/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • tmr
  • oc_high
  • inc
project/at_start_f413/examples/tmr/oc_high/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • tmr
  • oc_high
  • src
project/at_start_f413/examples/tmr/oc_high/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/tmr/oc_high/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • tmr
  • oc_high
  • src
project/at_start_f413/examples/tmr/oc_high/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
139void TMR2_GLOBAL_IRQHandler(void)
140{
141 if(tmr_interrupt_flag_get(TMR2, TMR_C1_FLAG) != RESET)
142 {
143 /* clear tmr2 channel1 interrupt pending bit */
144 tmr_flag_clear(TMR2, TMR_C1_FLAG);
145
146 /* pc.06 turnoff after 1000 ms */
147 gpio_bits_reset(GPIOC, GPIO_PINS_6);
148 }
149 else if(tmr_interrupt_flag_get(TMR2, TMR_C2_FLAG) != RESET)
150 {
151 /* clear tmr2 channel2 interrupt pending bit */
152 tmr_flag_clear(TMR2, TMR_C2_FLAG);
153
154 /* pc.07 turnoff after 500 ms */
155 gpio_bits_reset(GPIOC, GPIO_PINS_7);
156 }
157 else if(tmr_interrupt_flag_get(TMR2, TMR_C3_FLAG) != RESET)
158 {
159 /* clear tmr2 channel3 interrupt pending bit */
160 tmr_flag_clear(TMR2, TMR_C3_FLAG);
161
162 /* pc.08 turnoff after 250 ms */
163 gpio_bits_reset(GPIOC, GPIO_PINS_8);
164 }
165 else
166 {
167 /* clear tmr2 channel4 interrupt pending bit */
168 tmr_flag_clear(TMR2, TMR_C4_FLAG);
169
170 /* pc.09 turnoff after 125 ms */
171 gpio_bits_reset(GPIOC, GPIO_PINS_9);
172 }
173}
174
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/tmr/oc_high/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/tmr/oc_high/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/tmr/oc_high/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/tmr/oc_high/src/at32f413_int.c:103
TMR2_GLOBAL_IRQHandler
void TMR2_GLOBAL_IRQHandler(void)
this function handles tmr2 global interrupt request.
Definition project/at_start_f413/examples/tmr/oc_high/src/at32f413_int.c:139
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/tmr/oc_high/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/tmr/oc_high/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/tmr/oc_high/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/tmr/oc_high/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/tmr/oc_high/src/at32f413_int.c:112
RESET
@ RESET
Definition at32f413.h:292
gpio_bits_reset
void gpio_bits_reset(gpio_type *gpio_x, uint16_t pins)
clear the selected data port bits.
Definition at32f413_gpio.c:340
GPIO_PINS_6
#define GPIO_PINS_6
Definition at32f413_gpio.h:56
GPIO_PINS_7
#define GPIO_PINS_7
Definition at32f413_gpio.h:57
GPIO_PINS_9
#define GPIO_PINS_9
Definition at32f413_gpio.h:59
GPIO_PINS_8
#define GPIO_PINS_8
Definition at32f413_gpio.h:58
GPIOC
#define GPIOC
Definition at32f413_gpio.h:749
tmr_flag_clear
void tmr_flag_clear(tmr_type *tmr_x, uint32_t tmr_flag)
clear tmr flag
Definition at32f413_tmr.c:1433
tmr_interrupt_flag_get
flag_status tmr_interrupt_flag_get(tmr_type *tmr_x, uint32_t tmr_flag)
get tmr interrupt flag
Definition at32f413_tmr.c:1357
TMR_C1_FLAG
#define TMR_C1_FLAG
Definition at32f413_tmr.h:52
TMR_C2_FLAG
#define TMR_C2_FLAG
Definition at32f413_tmr.h:53
TMR_C3_FLAG
#define TMR_C3_FLAG
Definition at32f413_tmr.h:54
TMR_C4_FLAG
#define TMR_C4_FLAG
Definition at32f413_tmr.h:55
TMR2
#define TMR2
Definition at32f413_tmr.h:832
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • tmr
  • oc_high
  • src
project/at_start_f413/examples/tmr/oc_high/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37 tmr_output_config_type tmr_oc_init_structure;
38 crm_clocks_freq_type crm_clocks_freq_struct = {0};
39uint16_t ch1_val = 1000;
40uint16_t ch2_val = 500;
41uint16_t ch3_val = 250;
42uint16_t ch4_val = 125;
43uint16_t div_value = 0;
44
45void gpio_configuration(void);
46
52void gpio_configuration(void)
53{
54 gpio_init_type gpio_init_struct;
55
56 gpio_default_para_init(&gpio_init_struct);
57
58 /* gpioc configuration: pin6, 7, 8 and 9 as output push-pull */
59 gpio_init_struct.gpio_pins = GPIO_PINS_6 | GPIO_PINS_7 | GPIO_PINS_8 | GPIO_PINS_9;
60 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
61 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
62 gpio_init_struct.gpio_mode = GPIO_MODE_OUTPUT;
63 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
64
65 gpio_init(GPIOC, &gpio_init_struct);
66}
67
73int main(void)
74{
75 /* config nvic priority group */
76 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
77
78 system_clock_config();
79
80 at32_board_init();
81
82 /* get system clock */
83 crm_clocks_freq_get(&crm_clocks_freq_struct);
84
85 crm_apb1_div_set(CRM_APB1_DIV_8);
86 crm_periph_clock_enable(CRM_TMR2_PERIPH_CLOCK, TRUE);
87 crm_periph_clock_enable(CRM_GPIOC_PERIPH_CLOCK, TRUE);
88
89 nvic_irq_enable(TMR2_GLOBAL_IRQn, 0, 0);
90
91 gpio_configuration();
92
93 /* compute the div value */
94 div_value = (uint16_t)(crm_clocks_freq_struct.sclk_freq / 4000) - 1;
95
96 /* tmr2 time base configuration */
97 tmr_base_init(TMR2, 0xFFFF, div_value);
98 tmr_cnt_dir_set(TMR2, TMR_COUNT_UP);
99 tmr_clock_source_div_set(TMR2, TMR_CLOCK_DIV1);
100
101 tmr_output_default_para_init(&tmr_oc_init_structure);
102 tmr_oc_init_structure.oc_mode = TMR_OUTPUT_CONTROL_HIGH;
103 tmr_oc_init_structure.oc_idle_state = FALSE;
104 tmr_oc_init_structure.oc_polarity = TMR_OUTPUT_ACTIVE_HIGH;
105 tmr_oc_init_structure.oc_output_state = TRUE;
106 tmr_output_channel_config(TMR2, TMR_SELECT_CHANNEL_1, &tmr_oc_init_structure);
107 tmr_channel_value_set(TMR2, TMR_SELECT_CHANNEL_1, ch1_val);
108
109 tmr_output_channel_config(TMR2, TMR_SELECT_CHANNEL_2, &tmr_oc_init_structure);
110 tmr_channel_value_set(TMR2, TMR_SELECT_CHANNEL_2, ch2_val);
111
112 tmr_output_channel_config(TMR2, TMR_SELECT_CHANNEL_3, &tmr_oc_init_structure);
113 tmr_channel_value_set(TMR2, TMR_SELECT_CHANNEL_3, ch3_val);
114
115 tmr_output_channel_config(TMR2, TMR_SELECT_CHANNEL_4, &tmr_oc_init_structure);
116 tmr_channel_value_set(TMR2, TMR_SELECT_CHANNEL_4, ch4_val);
117
118 tmr_period_buffer_enable(TMR2, TRUE);
119
120 /* tmr2 int enable */
121 tmr_interrupt_enable(TMR2, TMR_C1_INT | TMR_C2_INT | TMR_C3_INT | TMR_C4_INT, TRUE);
122
123 /* set pc.06, pc.07, pc.08 and pc.09 pins */
124 gpio_bits_set(GPIOC, GPIO_PINS_6 | GPIO_PINS_7 | GPIO_PINS_8 | GPIO_PINS_9);
125
126 /* tmr2 enable counter */
127 tmr_counter_enable(TMR2, TRUE);
128
129 while(1)
130 {
131 }
132}
133
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
ch4_val
uint16_t ch4_val
Definition project/at_start_f413/examples/tmr/oc_high/src/main.c:42
ch3_val
uint16_t ch3_val
Definition project/at_start_f413/examples/tmr/oc_high/src/main.c:41
ch1_val
uint16_t ch1_val
Definition project/at_start_f413/examples/tmr/oc_high/src/main.c:39
main
int main(void)
main function.
Definition project/at_start_f413/examples/tmr/oc_high/src/main.c:73
ch2_val
uint16_t ch2_val
Definition project/at_start_f413/examples/tmr/oc_high/src/main.c:40
gpio_configuration
void gpio_configuration(void)
configure the gpioc pins.
Definition project/at_start_f413/examples/tmr/oc_high/src/main.c:52
tmr_oc_init_structure
tmr_output_config_type tmr_oc_init_structure
Definition project/at_start_f413/examples/tmr/oc_high/src/main.c:37
crm_clocks_freq_struct
crm_clocks_freq_type crm_clocks_freq_struct
Definition project/at_start_f413/examples/tmr/oc_high/src/main.c:38
div_value
uint16_t div_value
Definition project/at_start_f413/examples/tmr/oc_high/src/main.c:43
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_clocks_freq_get
void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
Definition at32f413_crm.c:660
CRM_GPIOC_PERIPH_CLOCK
@ CRM_GPIOC_PERIPH_CLOCK
Definition at32f413_crm.h:111
CRM_TMR2_PERIPH_CLOCK
@ CRM_TMR2_PERIPH_CLOCK
Definition at32f413_crm.h:125
CRM_APB1_DIV_8
@ CRM_APB1_DIV_8
Definition at32f413_crm.h:324
TMR2_GLOBAL_IRQn
@ TMR2_GLOBAL_IRQn
Definition at32f413.h:200
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_bits_set
void gpio_bits_set(gpio_type *gpio_x, uint16_t pins)
set the selected data port bits.
Definition at32f413_gpio.c:309
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_OUTPUT
@ GPIO_MODE_OUTPUT
Definition at32f413_gpio.h:214
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_6
#define GPIO_PINS_6
Definition at32f413_gpio.h:56
GPIO_PINS_7
#define GPIO_PINS_7
Definition at32f413_gpio.h:57
GPIO_PINS_9
#define GPIO_PINS_9
Definition at32f413_gpio.h:59
GPIO_PINS_8
#define GPIO_PINS_8
Definition at32f413_gpio.h:58
GPIOC
#define GPIOC
Definition at32f413_gpio.h:749
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
tmr_period_buffer_enable
void tmr_period_buffer_enable(tmr_type *tmr_x, confirm_state new_state)
enable tmr period buffer
Definition at32f413_tmr.c:592
tmr_counter_enable
void tmr_counter_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr counter
Definition at32f413_tmr.c:114
tmr_output_channel_config
void tmr_output_channel_config(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_output_config_type *tmr_output_struct)
config tmr output channel
Definition at32f413_tmr.c:318
tmr_clock_source_div_set
void tmr_clock_source_div_set(tmr_type *tmr_x, tmr_clock_division_type tmr_clock_div)
set tmr clock source division
Definition at32f413_tmr.c:204
tmr_output_default_para_init
void tmr_output_default_para_init(tmr_output_config_type *tmr_output_struct)
init tmr output default para
Definition at32f413_tmr.c:126
tmr_base_init
void tmr_base_init(tmr_type *tmr_x, uint32_t tmr_pr, uint32_t tmr_div)
init tmr base
Definition at32f413_tmr.c:179
tmr_interrupt_enable
void tmr_interrupt_enable(tmr_type *tmr_x, uint32_t tmr_interrupt, confirm_state new_state)
enable or disable tmr interrupt
Definition at32f413_tmr.c:1327
tmr_cnt_dir_set
void tmr_cnt_dir_set(tmr_type *tmr_x, tmr_count_mode_type tmr_cnt_dir)
set tmr counter count direction
Definition at32f413_tmr.c:225
tmr_channel_value_set
void tmr_channel_value_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, uint32_t tmr_channel_value)
set tmr channel value
Definition at32f413_tmr.c:506
TMR_COUNT_UP
@ TMR_COUNT_UP
Definition at32f413_tmr.h:105
TMR_SELECT_CHANNEL_3
@ TMR_SELECT_CHANNEL_3
Definition at32f413_tmr.h:219
TMR_SELECT_CHANNEL_1
@ TMR_SELECT_CHANNEL_1
Definition at32f413_tmr.h:215
TMR_SELECT_CHANNEL_4
@ TMR_SELECT_CHANNEL_4
Definition at32f413_tmr.h:221
TMR_SELECT_CHANNEL_2
@ TMR_SELECT_CHANNEL_2
Definition at32f413_tmr.h:217
TMR_CLOCK_DIV1
@ TMR_CLOCK_DIV1
Definition at32f413_tmr.h:95
TMR_OUTPUT_CONTROL_HIGH
@ TMR_OUTPUT_CONTROL_HIGH
Definition at32f413_tmr.h:173
TMR_OUTPUT_ACTIVE_HIGH
@ TMR_OUTPUT_ACTIVE_HIGH
Definition at32f413_tmr.h:196
TMR_C3_INT
#define TMR_C3_INT
Definition at32f413_tmr.h:76
TMR_C4_INT
#define TMR_C4_INT
Definition at32f413_tmr.h:77
TMR_C1_INT
#define TMR_C1_INT
Definition at32f413_tmr.h:74
TMR_C2_INT
#define TMR_C2_INT
Definition at32f413_tmr.h:75
TMR2
#define TMR2
Definition at32f413_tmr.h:832
at32f413_clock.h
header file of clock program
crm_clocks_freq_type
crm clocks freqency structure
Definition at32f413_crm.h:470
crm_clocks_freq_type::sclk_freq
uint32_t sclk_freq
Definition at32f413_crm.h:471
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
tmr_output_config_type
tmr output config type
Definition at32f413_tmr.h:397
tmr_output_config_type::oc_idle_state
confirm_state oc_idle_state
Definition at32f413_tmr.h:399
tmr_output_config_type::oc_output_state
confirm_state oc_output_state
Definition at32f413_tmr.h:403
tmr_output_config_type::oc_mode
tmr_output_control_mode_type oc_mode
Definition at32f413_tmr.h:398
tmr_output_config_type::oc_polarity
tmr_output_polarity_type oc_polarity
Definition at32f413_tmr.h:401


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • tmr
  • oc_low
  • inc
project/at_start_f413/examples/tmr/oc_low/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • tmr
  • oc_low
  • inc
project/at_start_f413/examples/tmr/oc_low/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • tmr
  • oc_low
  • inc
project/at_start_f413/examples/tmr/oc_low/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • tmr
  • oc_low
  • src
project/at_start_f413/examples/tmr/oc_low/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/tmr/oc_low/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • tmr
  • oc_low
  • src
project/at_start_f413/examples/tmr/oc_low/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
139void TMR2_GLOBAL_IRQHandler(void)
140{
141 if(tmr_interrupt_flag_get(TMR2, TMR_C1_FLAG) != RESET)
142 {
143 /* clear tmr2 channel1 interrupt pending bit */
144 tmr_flag_clear(TMR2, TMR_C1_FLAG);
145
146 /* pc.06 turnoff after 1000 ms */
147 gpio_bits_reset(GPIOC, GPIO_PINS_6);
148 }
149 else if(tmr_interrupt_flag_get(TMR2, TMR_C2_FLAG) != RESET)
150 {
151 /* clear tmr2 channel2 interrupt pending bit */
152 tmr_flag_clear(TMR2, TMR_C2_FLAG);
153
154 /* pc.07 turnoff after 500 ms */
155 gpio_bits_reset(GPIOC, GPIO_PINS_7);
156 }
157 else if(tmr_interrupt_flag_get(TMR2, TMR_C3_FLAG) != RESET)
158 {
159 /* clear tmr2 channel3 interrupt pending bit */
160 tmr_flag_clear(TMR2, TMR_C3_FLAG);
161
162 /* pc.08 turnoff after 250 ms */
163 gpio_bits_reset(GPIOC, GPIO_PINS_8);
164 }
165 else
166 {
167 /* clear tmr2 channel4 interrupt pending bit */
168 tmr_flag_clear(TMR2, TMR_C4_FLAG);
169
170 /* pc.09 turnoff after 125 ms */
171 gpio_bits_reset(GPIOC, GPIO_PINS_9);
172 }
173}
174
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/tmr/oc_low/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/tmr/oc_low/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/tmr/oc_low/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/tmr/oc_low/src/at32f413_int.c:103
TMR2_GLOBAL_IRQHandler
void TMR2_GLOBAL_IRQHandler(void)
this function handles tmr2 global interrupt request.
Definition project/at_start_f413/examples/tmr/oc_low/src/at32f413_int.c:139
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/tmr/oc_low/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/tmr/oc_low/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/tmr/oc_low/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/tmr/oc_low/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/tmr/oc_low/src/at32f413_int.c:112
RESET
@ RESET
Definition at32f413.h:292
gpio_bits_reset
void gpio_bits_reset(gpio_type *gpio_x, uint16_t pins)
clear the selected data port bits.
Definition at32f413_gpio.c:340
GPIO_PINS_6
#define GPIO_PINS_6
Definition at32f413_gpio.h:56
GPIO_PINS_7
#define GPIO_PINS_7
Definition at32f413_gpio.h:57
GPIO_PINS_9
#define GPIO_PINS_9
Definition at32f413_gpio.h:59
GPIO_PINS_8
#define GPIO_PINS_8
Definition at32f413_gpio.h:58
GPIOC
#define GPIOC
Definition at32f413_gpio.h:749
tmr_flag_clear
void tmr_flag_clear(tmr_type *tmr_x, uint32_t tmr_flag)
clear tmr flag
Definition at32f413_tmr.c:1433
tmr_interrupt_flag_get
flag_status tmr_interrupt_flag_get(tmr_type *tmr_x, uint32_t tmr_flag)
get tmr interrupt flag
Definition at32f413_tmr.c:1357
TMR_C1_FLAG
#define TMR_C1_FLAG
Definition at32f413_tmr.h:52
TMR_C2_FLAG
#define TMR_C2_FLAG
Definition at32f413_tmr.h:53
TMR_C3_FLAG
#define TMR_C3_FLAG
Definition at32f413_tmr.h:54
TMR_C4_FLAG
#define TMR_C4_FLAG
Definition at32f413_tmr.h:55
TMR2
#define TMR2
Definition at32f413_tmr.h:832
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • tmr
  • oc_low
  • src
project/at_start_f413/examples/tmr/oc_low/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37 tmr_output_config_type tmr_oc_init_structure;
38uint16_t ch1_val = 1000;
39uint16_t ch2_val = 500;
40uint16_t ch3_val = 250;
41uint16_t ch4_val = 125;
42uint16_t div_value = 0;
43
44void gpio_configuration(void);
45
51void gpio_configuration(void)
52{
53 gpio_init_type gpio_init_struct;
54
55 /* gpioc configuration: pin6, 7, 8 and 9 as output push-pull */
56 gpio_default_para_init(&gpio_init_struct);
57 gpio_init_struct.gpio_pins = GPIO_PINS_6 | GPIO_PINS_7 | GPIO_PINS_8 | GPIO_PINS_9;
58 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
59 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
60 gpio_init_struct.gpio_mode = GPIO_MODE_OUTPUT;
61 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
62
63 gpio_init(GPIOC, &gpio_init_struct);
64}
65
71int main(void)
72{
73 /* config nvic priority group */
74 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
75
76 system_clock_config();
77
78 at32_board_init();
79
80 crm_apb1_div_set(CRM_APB1_DIV_8);
81 crm_periph_clock_enable(CRM_TMR2_PERIPH_CLOCK, TRUE);
82 crm_periph_clock_enable(CRM_GPIOC_PERIPH_CLOCK, TRUE);
83
84 nvic_irq_enable(TMR2_GLOBAL_IRQn, 0, 0);
85
86 gpio_configuration();
87
88 /* compute the div value */
89 div_value = (uint16_t)(system_core_clock / 4000) - 1;
90
91 /* tmr2 time base configuration */
92 tmr_base_init(TMR2, 65535, div_value);
93 tmr_cnt_dir_set(TMR2, TMR_COUNT_UP);
94 tmr_clock_source_div_set(TMR2, TMR_CLOCK_DIV1);
95
96 tmr_output_default_para_init(&tmr_oc_init_structure);
97 tmr_oc_init_structure.oc_mode = TMR_OUTPUT_CONTROL_LOW;
98 tmr_oc_init_structure.oc_idle_state = FALSE;
99 tmr_oc_init_structure.oc_polarity = TMR_OUTPUT_ACTIVE_HIGH;
100 tmr_oc_init_structure.oc_output_state = TRUE;
101 tmr_output_channel_config(TMR2, TMR_SELECT_CHANNEL_1, &tmr_oc_init_structure);
102 tmr_channel_value_set(TMR2, TMR_SELECT_CHANNEL_1, ch1_val);
103
104 tmr_output_channel_config(TMR2, TMR_SELECT_CHANNEL_2, &tmr_oc_init_structure);
105 tmr_channel_value_set(TMR2, TMR_SELECT_CHANNEL_2, ch2_val);
106
107 tmr_output_channel_config(TMR2, TMR_SELECT_CHANNEL_3, &tmr_oc_init_structure);
108 tmr_channel_value_set(TMR2, TMR_SELECT_CHANNEL_3, ch3_val);
109
110 tmr_output_channel_config(TMR2, TMR_SELECT_CHANNEL_4, &tmr_oc_init_structure);
111 tmr_channel_value_set(TMR2, TMR_SELECT_CHANNEL_4, ch4_val);
112
113 tmr_period_buffer_enable(TMR2, TRUE);
114
115 /* tmr2 int enable */
116 tmr_interrupt_enable(TMR2, TMR_C1_INT | TMR_C2_INT | TMR_C3_INT | TMR_C4_INT, TRUE);
117
118 /* set pc.06, pc.07, pc.08 and pc.09 pins */
119 gpio_bits_set(GPIOC, GPIO_PINS_6 | GPIO_PINS_7 | GPIO_PINS_8 | GPIO_PINS_9);
120
121 /* tmr2 enable counter */
122 tmr_counter_enable(TMR2, TRUE);
123
124 while(1)
125 {
126 }
127}
128
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
ch4_val
uint16_t ch4_val
Definition project/at_start_f413/examples/tmr/oc_low/src/main.c:41
ch3_val
uint16_t ch3_val
Definition project/at_start_f413/examples/tmr/oc_low/src/main.c:40
ch1_val
uint16_t ch1_val
Definition project/at_start_f413/examples/tmr/oc_low/src/main.c:38
main
int main(void)
main function.
Definition project/at_start_f413/examples/tmr/oc_low/src/main.c:71
ch2_val
uint16_t ch2_val
Definition project/at_start_f413/examples/tmr/oc_low/src/main.c:39
gpio_configuration
void gpio_configuration(void)
configure the gpioc pins.
Definition project/at_start_f413/examples/tmr/oc_low/src/main.c:51
tmr_oc_init_structure
tmr_output_config_type tmr_oc_init_structure
Definition project/at_start_f413/examples/tmr/oc_low/src/main.c:37
div_value
uint16_t div_value
Definition project/at_start_f413/examples/tmr/oc_low/src/main.c:42
system_core_clock
unsigned int system_core_clock
Definition system_at32f413.c:47
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOC_PERIPH_CLOCK
@ CRM_GPIOC_PERIPH_CLOCK
Definition at32f413_crm.h:111
CRM_TMR2_PERIPH_CLOCK
@ CRM_TMR2_PERIPH_CLOCK
Definition at32f413_crm.h:125
CRM_APB1_DIV_8
@ CRM_APB1_DIV_8
Definition at32f413_crm.h:324
TMR2_GLOBAL_IRQn
@ TMR2_GLOBAL_IRQn
Definition at32f413.h:200
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_bits_set
void gpio_bits_set(gpio_type *gpio_x, uint16_t pins)
set the selected data port bits.
Definition at32f413_gpio.c:309
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_OUTPUT
@ GPIO_MODE_OUTPUT
Definition at32f413_gpio.h:214
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_6
#define GPIO_PINS_6
Definition at32f413_gpio.h:56
GPIO_PINS_7
#define GPIO_PINS_7
Definition at32f413_gpio.h:57
GPIO_PINS_9
#define GPIO_PINS_9
Definition at32f413_gpio.h:59
GPIO_PINS_8
#define GPIO_PINS_8
Definition at32f413_gpio.h:58
GPIOC
#define GPIOC
Definition at32f413_gpio.h:749
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
tmr_period_buffer_enable
void tmr_period_buffer_enable(tmr_type *tmr_x, confirm_state new_state)
enable tmr period buffer
Definition at32f413_tmr.c:592
tmr_counter_enable
void tmr_counter_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr counter
Definition at32f413_tmr.c:114
tmr_output_channel_config
void tmr_output_channel_config(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_output_config_type *tmr_output_struct)
config tmr output channel
Definition at32f413_tmr.c:318
tmr_clock_source_div_set
void tmr_clock_source_div_set(tmr_type *tmr_x, tmr_clock_division_type tmr_clock_div)
set tmr clock source division
Definition at32f413_tmr.c:204
tmr_output_default_para_init
void tmr_output_default_para_init(tmr_output_config_type *tmr_output_struct)
init tmr output default para
Definition at32f413_tmr.c:126
tmr_base_init
void tmr_base_init(tmr_type *tmr_x, uint32_t tmr_pr, uint32_t tmr_div)
init tmr base
Definition at32f413_tmr.c:179
tmr_interrupt_enable
void tmr_interrupt_enable(tmr_type *tmr_x, uint32_t tmr_interrupt, confirm_state new_state)
enable or disable tmr interrupt
Definition at32f413_tmr.c:1327
tmr_cnt_dir_set
void tmr_cnt_dir_set(tmr_type *tmr_x, tmr_count_mode_type tmr_cnt_dir)
set tmr counter count direction
Definition at32f413_tmr.c:225
tmr_channel_value_set
void tmr_channel_value_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, uint32_t tmr_channel_value)
set tmr channel value
Definition at32f413_tmr.c:506
TMR_COUNT_UP
@ TMR_COUNT_UP
Definition at32f413_tmr.h:105
TMR_SELECT_CHANNEL_3
@ TMR_SELECT_CHANNEL_3
Definition at32f413_tmr.h:219
TMR_SELECT_CHANNEL_1
@ TMR_SELECT_CHANNEL_1
Definition at32f413_tmr.h:215
TMR_SELECT_CHANNEL_4
@ TMR_SELECT_CHANNEL_4
Definition at32f413_tmr.h:221
TMR_SELECT_CHANNEL_2
@ TMR_SELECT_CHANNEL_2
Definition at32f413_tmr.h:217
TMR_CLOCK_DIV1
@ TMR_CLOCK_DIV1
Definition at32f413_tmr.h:95
TMR_OUTPUT_CONTROL_LOW
@ TMR_OUTPUT_CONTROL_LOW
Definition at32f413_tmr.h:174
TMR_OUTPUT_ACTIVE_HIGH
@ TMR_OUTPUT_ACTIVE_HIGH
Definition at32f413_tmr.h:196
TMR_C3_INT
#define TMR_C3_INT
Definition at32f413_tmr.h:76
TMR_C4_INT
#define TMR_C4_INT
Definition at32f413_tmr.h:77
TMR_C1_INT
#define TMR_C1_INT
Definition at32f413_tmr.h:74
TMR_C2_INT
#define TMR_C2_INT
Definition at32f413_tmr.h:75
TMR2
#define TMR2
Definition at32f413_tmr.h:832
at32f413_clock.h
header file of clock program
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
tmr_output_config_type
tmr output config type
Definition at32f413_tmr.h:397
tmr_output_config_type::oc_idle_state
confirm_state oc_idle_state
Definition at32f413_tmr.h:399
tmr_output_config_type::oc_output_state
confirm_state oc_output_state
Definition at32f413_tmr.h:403
tmr_output_config_type::oc_mode
tmr_output_control_mode_type oc_mode
Definition at32f413_tmr.h:398
tmr_output_config_type::oc_polarity
tmr_output_polarity_type oc_polarity
Definition at32f413_tmr.h:401


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • tmr
  • oc_toggle_tmr3
  • inc
project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • tmr
  • oc_toggle_tmr3
  • inc
project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • tmr
  • oc_toggle_tmr3
  • inc
project/at_start_f413/examples/tmr/oc_toggle_tmr3/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • tmr
  • oc_toggle_tmr3
  • src
project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • tmr
  • oc_toggle_tmr3
  • src
project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
29extern __IO uint16_t ch1_val;
30extern __IO uint16_t ch2_val;
31extern __IO uint16_t ch3_val;
32extern __IO uint16_t ch4_val;
33
42uint32_t capture = 0;
43
49void NMI_Handler(void)
50{
51}
52
58void HardFault_Handler(void)
59{
60 /* go to infinite loop when hard fault exception occurs */
61 while(1)
62 {
63 }
64}
65
71void MemManage_Handler(void)
72{
73 /* go to infinite loop when memory manage exception occurs */
74 while(1)
75 {
76 }
77}
78
84void BusFault_Handler(void)
85{
86 /* go to infinite loop when bus fault exception occurs */
87 while(1)
88 {
89 }
90}
91
97void UsageFault_Handler(void)
98{
99 /* go to infinite loop when usage fault exception occurs */
100 while(1)
101 {
102 }
103}
104
110void SVC_Handler(void)
111{
112}
113
119void DebugMon_Handler(void)
120{
121}
122
128void PendSV_Handler(void)
129{
130}
131
137void SysTick_Handler(void)
138{
139}
140
146void TMR3_GLOBAL_IRQHandler(void)
147{
148 /* TMR3_CH1 toggling with frequency = 183.1 Hz */
149 if(tmr_interrupt_flag_get(TMR3, TMR_C1_FLAG) != RESET)
150 {
151 tmr_flag_clear(TMR3, TMR_C1_FLAG );
152 capture = tmr_channel_value_get(TMR3, TMR_SELECT_CHANNEL_1);
153 tmr_channel_value_set(TMR3, TMR_SELECT_CHANNEL_1, capture + ch1_val);
154 }
155
156 /* TMR3_CH2 toggling with frequency = 366.2 Hz */
157 if(tmr_interrupt_flag_get(TMR3, TMR_C2_FLAG) != RESET)
158 {
159 tmr_flag_clear(TMR3, TMR_C2_FLAG);
160 capture = tmr_channel_value_get(TMR3, TMR_SELECT_CHANNEL_2);
161 tmr_channel_value_set(TMR3, TMR_SELECT_CHANNEL_2, capture + ch2_val);
162 }
163
164 /* TMR3_CH3 toggling with frequency = 732.4 Hz */
165 if(tmr_interrupt_flag_get(TMR3, TMR_C3_FLAG) != RESET)
166 {
167 tmr_flag_clear(TMR3, TMR_C3_FLAG);
168 capture = tmr_channel_value_get(TMR3, TMR_SELECT_CHANNEL_3);
169 tmr_channel_value_set(TMR3, TMR_SELECT_CHANNEL_3, capture + ch3_val);
170 }
171
172 /* TMR3_CH4 toggling with frequency = 1464.8 Hz */
173 if(tmr_interrupt_flag_get(TMR3, TMR_C4_FLAG) != RESET)
174 {
175 tmr_flag_clear(TMR3, TMR_C4_FLAG);
176 capture = tmr_channel_value_get(TMR3, TMR_SELECT_CHANNEL_4);
177 tmr_channel_value_set(TMR3, TMR_SELECT_CHANNEL_4, capture + ch4_val);
178 }
179}
180
ch4_val
__IO uint16_t ch4_val
Definition project/at_start_f413/examples/tmr/oc_high/src/main.c:42
ch3_val
__IO uint16_t ch3_val
Definition project/at_start_f413/examples/tmr/oc_high/src/main.c:41
ch1_val
__IO uint16_t ch1_val
Definition project/at_start_f413/examples/tmr/oc_high/src/main.c:39
ch2_val
__IO uint16_t ch2_val
Definition project/at_start_f413/examples/tmr/oc_high/src/main.c:40
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c:97
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c:58
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c:71
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c:110
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c:128
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c:49
TMR3_GLOBAL_IRQHandler
void TMR3_GLOBAL_IRQHandler(void)
this function handles tmr3 global interrupt request.
Definition project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c:146
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c:84
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c:137
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c:119
capture
uint32_t capture
Definition project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/at32f413_int.c:42
RESET
@ RESET
Definition at32f413.h:292
tmr_channel_value_get
uint32_t tmr_channel_value_get(tmr_type *tmr_x, tmr_channel_select_type tmr_channel)
get tmr channel value
Definition at32f413_tmr.c:551
tmr_flag_clear
void tmr_flag_clear(tmr_type *tmr_x, uint32_t tmr_flag)
clear tmr flag
Definition at32f413_tmr.c:1433
tmr_interrupt_flag_get
flag_status tmr_interrupt_flag_get(tmr_type *tmr_x, uint32_t tmr_flag)
get tmr interrupt flag
Definition at32f413_tmr.c:1357
tmr_channel_value_set
void tmr_channel_value_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, uint32_t tmr_channel_value)
set tmr channel value
Definition at32f413_tmr.c:506
TMR_SELECT_CHANNEL_3
@ TMR_SELECT_CHANNEL_3
Definition at32f413_tmr.h:219
TMR_SELECT_CHANNEL_1
@ TMR_SELECT_CHANNEL_1
Definition at32f413_tmr.h:215
TMR_SELECT_CHANNEL_4
@ TMR_SELECT_CHANNEL_4
Definition at32f413_tmr.h:221
TMR_SELECT_CHANNEL_2
@ TMR_SELECT_CHANNEL_2
Definition at32f413_tmr.h:217
TMR_C1_FLAG
#define TMR_C1_FLAG
Definition at32f413_tmr.h:52
TMR_C2_FLAG
#define TMR_C2_FLAG
Definition at32f413_tmr.h:53
TMR_C3_FLAG
#define TMR_C3_FLAG
Definition at32f413_tmr.h:54
TMR_C4_FLAG
#define TMR_C4_FLAG
Definition at32f413_tmr.h:55
TMR3
#define TMR3
Definition at32f413_tmr.h:833
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • tmr
  • oc_toggle_tmr3
  • src
project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37 tmr_output_config_type tmr_oc_init_structure;
38__IO uint16_t ch1_val = 32768;
39__IO uint16_t ch2_val = 16384;
40__IO uint16_t ch3_val = 8192;
41__IO uint16_t ch4_val = 4096;
42uint16_t div_value = 0;
43
44void crm_configuration(void);
45void gpio_configuration(void);
46void nvic_configuration(void);
47
53void gpio_configuration(void)
54{
55 gpio_init_type gpio_init_struct;
56
57 /* gpioa configuration:tmr3 channel1, 2, 3 and 4 as alternate function push-pull */
58 gpio_default_para_init(&gpio_init_struct);
59 gpio_init_struct.gpio_pins = GPIO_PINS_6 | GPIO_PINS_7;
60 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
61 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
62 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
63 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
64
65 gpio_init(GPIOA, &gpio_init_struct);
66
67 gpio_init_struct.gpio_pins = GPIO_PINS_0 | GPIO_PINS_1;
68 gpio_init(GPIOB, &gpio_init_struct);
69
70}
71
77void crm_configuration(void)
78{
79 /* tmr3 clock enable */
80 crm_periph_clock_enable(CRM_TMR3_PERIPH_CLOCK, TRUE);
81
82 /* gpioa clock enable */
83 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
84 crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
85}
86
92int main(void)
93{
94 system_clock_config();
95
96 /* peripheral clocks configuration */
97 crm_configuration();
98
99 /* nvic configuration */
100 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
101 nvic_irq_enable(TMR3_GLOBAL_IRQn, 0, 0);
102
103 /* gpio configuration */
104 gpio_configuration();
105
106 /* tmr3 configuration: output compare toggle mode:
107 tmr3clk = system_core_clock,
108 the objective is to get tmr3 counter clock at 24 mhz:
109 - div = (tmr3clk / tmr3 counter clock) - 1
110 cc1 update rate = tmr3 counter clock / ch1_val / 2 = 366.2 hz
111 cc2 update rate = tmr3 counter clock / ch2_val / 2 = 732.4 hz
112 cc3 update rate = tmr3 counter clock / ch3_val / 2 = 1464.8 hz
113 cc4 update rate = tmr3 counter clock / ch4_val / 2 = 2929.6 hz */
114
115 /* compute the div value */
116 div_value = (uint16_t)(system_core_clock / 24000000) - 1;
117
118 /* tmre base configuration */
119 tmr_base_init(TMR3, 65535, div_value);
120 tmr_cnt_dir_set(TMR3, TMR_COUNT_UP);
121 tmr_clock_source_div_set(TMR3, TMR_CLOCK_DIV1);
122
123 /* output compare toggle mode configuration: channel1 */
124 tmr_output_default_para_init(&tmr_oc_init_structure);
125 tmr_oc_init_structure.oc_mode = TMR_OUTPUT_CONTROL_SWITCH;
126 tmr_oc_init_structure.oc_idle_state = FALSE;
127 tmr_oc_init_structure.oc_polarity = TMR_OUTPUT_ACTIVE_LOW;
128 tmr_oc_init_structure.oc_output_state = TRUE;
129 tmr_output_channel_config(TMR3, TMR_SELECT_CHANNEL_1, &tmr_oc_init_structure);
130 tmr_channel_value_set(TMR3, TMR_SELECT_CHANNEL_1, ch1_val);
131
132 /* output compare toggle mode configuration: channel2 */
133 tmr_output_channel_config(TMR3, TMR_SELECT_CHANNEL_2, &tmr_oc_init_structure);
134 tmr_channel_value_set(TMR3, TMR_SELECT_CHANNEL_2, ch2_val);
135
136 /* output compare toggle mode configuration: channel3 */
137 tmr_output_channel_config(TMR3, TMR_SELECT_CHANNEL_3, &tmr_oc_init_structure);
138 tmr_channel_value_set(TMR3, TMR_SELECT_CHANNEL_3, ch3_val);
139
140 /* output compare toggle mode configuration: channel4 */
141 tmr_output_channel_config(TMR3, TMR_SELECT_CHANNEL_4, &tmr_oc_init_structure);
142 tmr_channel_value_set(TMR3, TMR_SELECT_CHANNEL_4, ch4_val);
143
144 /* tmr enable counter */
145 tmr_counter_enable(TMR3, TRUE);
146
147 /* tmr it enable */
148 tmr_interrupt_enable(TMR3, TMR_C1_INT | TMR_C2_INT | TMR_C3_INT | TMR_C4_INT, TRUE);
149
150 while(1)
151 {
152 }
153}
154
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
ch1_val
__IO uint16_t ch1_val
Definition project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/main.c:38
main
int main(void)
main function.
Definition project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/main.c:92
gpio_configuration
void gpio_configuration(void)
configure the tmr3 pins.
Definition project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/main.c:53
tmr_oc_init_structure
tmr_output_config_type tmr_oc_init_structure
Definition project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/main.c:37
ch3_val
__IO uint16_t ch3_val
Definition project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/main.c:40
crm_configuration
void crm_configuration(void)
configures the different peripheral clocks.
Definition project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/main.c:77
ch4_val
__IO uint16_t ch4_val
Definition project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/main.c:41
div_value
uint16_t div_value
Definition project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/main.c:42
ch2_val
__IO uint16_t ch2_val
Definition project/at_start_f413/examples/tmr/oc_toggle_tmr3/src/main.c:39
nvic_configuration
void nvic_configuration(void)
configures the nested vectored interrupt controller.
Definition project/at_start_f413/examples/rtc/lick_calibration/src/main.c:47
system_core_clock
unsigned int system_core_clock
Definition system_at32f413.c:47
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_TMR3_PERIPH_CLOCK
@ CRM_TMR3_PERIPH_CLOCK
Definition at32f413_crm.h:126
CRM_GPIOB_PERIPH_CLOCK
@ CRM_GPIOB_PERIPH_CLOCK
Definition at32f413_crm.h:110
TMR3_GLOBAL_IRQn
@ TMR3_GLOBAL_IRQn
Definition at32f413.h:201
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_6
#define GPIO_PINS_6
Definition at32f413_gpio.h:56
GPIO_PINS_0
#define GPIO_PINS_0
Definition at32f413_gpio.h:50
GPIO_PINS_7
#define GPIO_PINS_7
Definition at32f413_gpio.h:57
GPIO_PINS_1
#define GPIO_PINS_1
Definition at32f413_gpio.h:51
GPIOB
#define GPIOB
Definition at32f413_gpio.h:748
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
tmr_counter_enable
void tmr_counter_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr counter
Definition at32f413_tmr.c:114
tmr_output_channel_config
void tmr_output_channel_config(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_output_config_type *tmr_output_struct)
config tmr output channel
Definition at32f413_tmr.c:318
tmr_clock_source_div_set
void tmr_clock_source_div_set(tmr_type *tmr_x, tmr_clock_division_type tmr_clock_div)
set tmr clock source division
Definition at32f413_tmr.c:204
tmr_output_default_para_init
void tmr_output_default_para_init(tmr_output_config_type *tmr_output_struct)
init tmr output default para
Definition at32f413_tmr.c:126
tmr_base_init
void tmr_base_init(tmr_type *tmr_x, uint32_t tmr_pr, uint32_t tmr_div)
init tmr base
Definition at32f413_tmr.c:179
tmr_interrupt_enable
void tmr_interrupt_enable(tmr_type *tmr_x, uint32_t tmr_interrupt, confirm_state new_state)
enable or disable tmr interrupt
Definition at32f413_tmr.c:1327
tmr_cnt_dir_set
void tmr_cnt_dir_set(tmr_type *tmr_x, tmr_count_mode_type tmr_cnt_dir)
set tmr counter count direction
Definition at32f413_tmr.c:225
tmr_channel_value_set
void tmr_channel_value_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, uint32_t tmr_channel_value)
set tmr channel value
Definition at32f413_tmr.c:506
TMR_COUNT_UP
@ TMR_COUNT_UP
Definition at32f413_tmr.h:105
TMR_SELECT_CHANNEL_3
@ TMR_SELECT_CHANNEL_3
Definition at32f413_tmr.h:219
TMR_SELECT_CHANNEL_1
@ TMR_SELECT_CHANNEL_1
Definition at32f413_tmr.h:215
TMR_SELECT_CHANNEL_4
@ TMR_SELECT_CHANNEL_4
Definition at32f413_tmr.h:221
TMR_SELECT_CHANNEL_2
@ TMR_SELECT_CHANNEL_2
Definition at32f413_tmr.h:217
TMR_CLOCK_DIV1
@ TMR_CLOCK_DIV1
Definition at32f413_tmr.h:95
TMR_OUTPUT_CONTROL_SWITCH
@ TMR_OUTPUT_CONTROL_SWITCH
Definition at32f413_tmr.h:175
TMR_OUTPUT_ACTIVE_LOW
@ TMR_OUTPUT_ACTIVE_LOW
Definition at32f413_tmr.h:197
TMR_C3_INT
#define TMR_C3_INT
Definition at32f413_tmr.h:76
TMR_C4_INT
#define TMR_C4_INT
Definition at32f413_tmr.h:77
TMR_C1_INT
#define TMR_C1_INT
Definition at32f413_tmr.h:74
TMR_C2_INT
#define TMR_C2_INT
Definition at32f413_tmr.h:75
TMR3
#define TMR3
Definition at32f413_tmr.h:833
at32f413_clock.h
header file of clock program
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
tmr_output_config_type
tmr output config type
Definition at32f413_tmr.h:397
tmr_output_config_type::oc_idle_state
confirm_state oc_idle_state
Definition at32f413_tmr.h:399
tmr_output_config_type::oc_output_state
confirm_state oc_output_state
Definition at32f413_tmr.h:403
tmr_output_config_type::oc_mode
tmr_output_control_mode_type oc_mode
Definition at32f413_tmr.h:398
tmr_output_config_type::oc_polarity
tmr_output_polarity_type oc_polarity
Definition at32f413_tmr.h:401


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • tmr
  • oc_toggle_tmr9
  • inc
project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • tmr
  • oc_toggle_tmr9
  • inc
project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • tmr
  • oc_toggle_tmr9
  • inc
project/at_start_f413/examples/tmr/oc_toggle_tmr9/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • tmr
  • oc_toggle_tmr9
  • src
project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • tmr
  • oc_toggle_tmr9
  • src
project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
29extern __IO uint16_t ch1_val;
30extern __IO uint16_t ch2_val;
31
40uint16_t capture = 0;
41
47void NMI_Handler(void)
48{
49}
50
56void HardFault_Handler(void)
57{
58 /* go to infinite loop when hard fault exception occurs */
59 while(1)
60 {
61 }
62}
63
69void MemManage_Handler(void)
70{
71 /* go to infinite loop when memory manage exception occurs */
72 while(1)
73 {
74 }
75}
76
82void BusFault_Handler(void)
83{
84 /* go to infinite loop when bus fault exception occurs */
85 while(1)
86 {
87 }
88}
89
95void UsageFault_Handler(void)
96{
97 /* go to infinite loop when usage fault exception occurs */
98 while(1)
99 {
100 }
101}
102
108void SVC_Handler(void)
109{
110}
111
117void DebugMon_Handler(void)
118{
119}
120
126void PendSV_Handler(void)
127{
128}
129
135void SysTick_Handler(void)
136{
137}
138
144void TMR1_BRK_TMR9_IRQHandler(void)
145{
146 /* TMR9_CH1 toggling with frequency = 366.2 Hz */
147 if(tmr_interrupt_flag_get(TMR9, TMR_C1_FLAG) != RESET)
148 {
149 tmr_flag_clear(TMR9, TMR_C1_FLAG );
150 capture = tmr_channel_value_get(TMR9, TMR_SELECT_CHANNEL_1);
151 tmr_channel_value_set(TMR9, TMR_SELECT_CHANNEL_1, capture + ch1_val);
152 }
153
154 /* TMR9_CH2 toggling with frequency = 732.4 Hz */
155 if(tmr_interrupt_flag_get(TMR9, TMR_C2_FLAG) != RESET)
156 {
157 tmr_flag_clear(TMR9, TMR_C2_FLAG);
158 capture = tmr_channel_value_get(TMR9, TMR_SELECT_CHANNEL_2);
159 tmr_channel_value_set(TMR9, TMR_SELECT_CHANNEL_2, capture + ch2_val);
160 }
161}
162
ch1_val
__IO uint16_t ch1_val
Definition project/at_start_f413/examples/tmr/oc_high/src/main.c:39
ch2_val
__IO uint16_t ch2_val
Definition project/at_start_f413/examples/tmr/oc_high/src/main.c:40
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c:95
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c:56
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c:69
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c:108
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c:126
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c:47
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c:82
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c:135
TMR1_BRK_TMR9_IRQHandler
void TMR1_BRK_TMR9_IRQHandler(void)
this function handles TMR9 global interrupt request.
Definition project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c:144
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c:117
capture
uint16_t capture
Definition project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/at32f413_int.c:40
RESET
@ RESET
Definition at32f413.h:292
tmr_channel_value_get
uint32_t tmr_channel_value_get(tmr_type *tmr_x, tmr_channel_select_type tmr_channel)
get tmr channel value
Definition at32f413_tmr.c:551
tmr_flag_clear
void tmr_flag_clear(tmr_type *tmr_x, uint32_t tmr_flag)
clear tmr flag
Definition at32f413_tmr.c:1433
tmr_interrupt_flag_get
flag_status tmr_interrupt_flag_get(tmr_type *tmr_x, uint32_t tmr_flag)
get tmr interrupt flag
Definition at32f413_tmr.c:1357
tmr_channel_value_set
void tmr_channel_value_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, uint32_t tmr_channel_value)
set tmr channel value
Definition at32f413_tmr.c:506
TMR_SELECT_CHANNEL_1
@ TMR_SELECT_CHANNEL_1
Definition at32f413_tmr.h:215
TMR_SELECT_CHANNEL_2
@ TMR_SELECT_CHANNEL_2
Definition at32f413_tmr.h:217
TMR_C1_FLAG
#define TMR_C1_FLAG
Definition at32f413_tmr.h:52
TMR_C2_FLAG
#define TMR_C2_FLAG
Definition at32f413_tmr.h:53
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • tmr
  • oc_toggle_tmr9
  • src
project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37 tmr_output_config_type tmr_oc_init_structure;
38__IO uint16_t ch1_val = 32768;
39__IO uint16_t ch2_val = 16384;
40uint16_t div_value = 0;
41
42void crm_configuration(void);
43void gpio_configuration(void);
44void nvic_configuration(void);
45
51void gpio_configuration(void)
52{
53 gpio_init_type gpio_init_struct;
54
55 /* gpioa configuration:tmr9 channel1 and 2 as alternate function push-pull */
56 gpio_default_para_init(&gpio_init_struct);
57 gpio_init_struct.gpio_pins = GPIO_PINS_2 | GPIO_PINS_3;
58 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
59 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
60 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
61 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
62
63 gpio_init(GPIOA, &gpio_init_struct);
64}
65
71void crm_configuration(void)
72{
73 /* tmr9 clock enable */
74 crm_periph_clock_enable(CRM_TMR9_PERIPH_CLOCK, TRUE);
75
76 /* gpioa clock enable */
77 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
78}
79
85int main(void)
86{
87 system_clock_config();
88
89 /* peripheral clocks configuration */
90 crm_configuration();
91
92 /* nvic configuration */
93 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
94 nvic_irq_enable(TMR1_BRK_TMR9_IRQn, 0, 0);
95
96 /* gpio configuration */
97 gpio_configuration();
98
99 /* tmr9 configuration: output compare toggle mode:
100 tmr9clk = system_core_clock,
101 the objective is to get tmr9 counter clock at 24 mhz:
102 - div_value = (tmr9clk / tmr9 counter clock) - 1
103 cc1 update rate = tmr9 counter clock / ch1val / 2 = 366.2 hz
104 cc2 update rate = tmr9 counter clock / ch2val / 2 = 732.4 hz */
105
106 /* compute the div value */
107 div_value = (uint16_t) (system_core_clock / 24000000) - 1;
108
109 /* tmr base configuration */
110 tmr_base_init(TMR9, 65535, div_value);
111 tmr_cnt_dir_set(TMR9, TMR_COUNT_UP);
112 tmr_clock_source_div_set(TMR9, TMR_CLOCK_DIV1);
113
114 /* output compare toggle mode configuration: channel1 */
115 tmr_output_default_para_init(&tmr_oc_init_structure);
116 tmr_oc_init_structure.oc_mode = TMR_OUTPUT_CONTROL_SWITCH;
117 tmr_oc_init_structure.oc_idle_state = FALSE;
118 tmr_oc_init_structure.oc_polarity = TMR_OUTPUT_ACTIVE_LOW;
119 tmr_oc_init_structure.oc_output_state = TRUE;
120 tmr_output_channel_config(TMR9, TMR_SELECT_CHANNEL_1, &tmr_oc_init_structure);
121 tmr_channel_value_set(TMR9, TMR_SELECT_CHANNEL_1, ch1_val);
122
123 /* output toggle mode configuration: channel2 */
124 tmr_output_channel_config(TMR9, TMR_SELECT_CHANNEL_2, &tmr_oc_init_structure);
125 tmr_channel_value_set(TMR9, TMR_SELECT_CHANNEL_2, ch2_val);
126
127 /* tmr enable counter */
128 tmr_counter_enable(TMR9, TRUE);
129
130 /* tmr interrupt enable */
131 tmr_interrupt_enable(TMR9, TMR_C1_INT | TMR_C2_INT, TRUE);
132
133 while(1)
134 {
135 }
136}
137
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
ch1_val
__IO uint16_t ch1_val
Definition project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/main.c:38
main
int main(void)
main function.
Definition project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/main.c:85
gpio_configuration
void gpio_configuration(void)
configure the tmr9 pins.
Definition project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/main.c:51
tmr_oc_init_structure
tmr_output_config_type tmr_oc_init_structure
Definition project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/main.c:37
crm_configuration
void crm_configuration(void)
configures the different peripheral clocks.
Definition project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/main.c:71
div_value
uint16_t div_value
Definition project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/main.c:40
ch2_val
__IO uint16_t ch2_val
Definition project/at_start_f413/examples/tmr/oc_toggle_tmr9/src/main.c:39
nvic_configuration
void nvic_configuration(void)
configures the nested vectored interrupt controller.
Definition project/at_start_f413/examples/rtc/lick_calibration/src/main.c:47
system_core_clock
unsigned int system_core_clock
Definition system_at32f413.c:47
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_TMR9_PERIPH_CLOCK
@ CRM_TMR9_PERIPH_CLOCK
Definition at32f413_crm.h:120
TMR1_BRK_TMR9_IRQn
@ TMR1_BRK_TMR9_IRQn
Definition at32f413.h:196
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_2
#define GPIO_PINS_2
Definition at32f413_gpio.h:52
GPIO_PINS_3
#define GPIO_PINS_3
Definition at32f413_gpio.h:53
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
tmr_counter_enable
void tmr_counter_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr counter
Definition at32f413_tmr.c:114
tmr_output_channel_config
void tmr_output_channel_config(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_output_config_type *tmr_output_struct)
config tmr output channel
Definition at32f413_tmr.c:318
tmr_clock_source_div_set
void tmr_clock_source_div_set(tmr_type *tmr_x, tmr_clock_division_type tmr_clock_div)
set tmr clock source division
Definition at32f413_tmr.c:204
tmr_output_default_para_init
void tmr_output_default_para_init(tmr_output_config_type *tmr_output_struct)
init tmr output default para
Definition at32f413_tmr.c:126
tmr_base_init
void tmr_base_init(tmr_type *tmr_x, uint32_t tmr_pr, uint32_t tmr_div)
init tmr base
Definition at32f413_tmr.c:179
tmr_interrupt_enable
void tmr_interrupt_enable(tmr_type *tmr_x, uint32_t tmr_interrupt, confirm_state new_state)
enable or disable tmr interrupt
Definition at32f413_tmr.c:1327
tmr_cnt_dir_set
void tmr_cnt_dir_set(tmr_type *tmr_x, tmr_count_mode_type tmr_cnt_dir)
set tmr counter count direction
Definition at32f413_tmr.c:225
tmr_channel_value_set
void tmr_channel_value_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, uint32_t tmr_channel_value)
set tmr channel value
Definition at32f413_tmr.c:506
TMR_COUNT_UP
@ TMR_COUNT_UP
Definition at32f413_tmr.h:105
TMR_SELECT_CHANNEL_1
@ TMR_SELECT_CHANNEL_1
Definition at32f413_tmr.h:215
TMR_SELECT_CHANNEL_2
@ TMR_SELECT_CHANNEL_2
Definition at32f413_tmr.h:217
TMR_CLOCK_DIV1
@ TMR_CLOCK_DIV1
Definition at32f413_tmr.h:95
TMR_OUTPUT_CONTROL_SWITCH
@ TMR_OUTPUT_CONTROL_SWITCH
Definition at32f413_tmr.h:175
TMR_OUTPUT_ACTIVE_LOW
@ TMR_OUTPUT_ACTIVE_LOW
Definition at32f413_tmr.h:197
TMR_C1_INT
#define TMR_C1_INT
Definition at32f413_tmr.h:74
TMR_C2_INT
#define TMR_C2_INT
Definition at32f413_tmr.h:75
at32f413_clock.h
header file of clock program
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
tmr_output_config_type
tmr output config type
Definition at32f413_tmr.h:397
tmr_output_config_type::oc_idle_state
confirm_state oc_idle_state
Definition at32f413_tmr.h:399
tmr_output_config_type::oc_output_state
confirm_state oc_output_state
Definition at32f413_tmr.h:403
tmr_output_config_type::oc_mode
tmr_output_control_mode_type oc_mode
Definition at32f413_tmr.h:398
tmr_output_config_type::oc_polarity
tmr_output_polarity_type oc_polarity
Definition at32f413_tmr.h:401


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • tmr
  • one_cycle
  • inc
project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • tmr
  • one_cycle
  • inc
project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • tmr
  • one_cycle
  • inc
project/at_start_f413/examples/tmr/one_cycle/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • tmr
  • one_cycle
  • src
project/at_start_f413/examples/tmr/one_cycle/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/tmr/one_cycle/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • tmr
  • one_cycle
  • src
project/at_start_f413/examples/tmr/one_cycle/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/tmr/one_cycle/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/tmr/one_cycle/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/tmr/one_cycle/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/tmr/one_cycle/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/tmr/one_cycle/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/tmr/one_cycle/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/tmr/one_cycle/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/tmr/one_cycle/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/tmr/one_cycle/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • tmr
  • one_cycle
  • src
project/at_start_f413/examples/tmr/one_cycle/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37 tmr_output_config_type tmr_oc_init_structure;
38 tmr_input_config_type tmr_ic_init_structure;
39uint16_t div_value = 0;
40
41void crm_configuration(void);
42void gpio_configuration(void);
43
49void gpio_configuration(void)
50{
51 gpio_init_type gpio_init_struct;
52
53 gpio_default_para_init(&gpio_init_struct);
54
55 /* tmr4_ch2 pin (pb.07) configuration */
56 gpio_init_struct.gpio_pins = GPIO_PINS_7;
57 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
58 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
59 gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
60 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
61 gpio_init(GPIOB, &gpio_init_struct);
62
63 /* tmr4_ch1 pin (pb.06) configuration */
64 gpio_init_struct.gpio_pins = GPIO_PINS_6;
65 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
66 gpio_init(GPIOB, &gpio_init_struct);
67}
68
74void crm_configuration(void)
75{
76 /* tmr3 clock enable */
77 crm_periph_clock_enable(CRM_TMR4_PERIPH_CLOCK, TRUE);
78
79 /* gpioa clock enable */
80 crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
81}
82
88int main(void)
89{
90 system_clock_config();
91
92 /* peripheral clocks configuration */
93 crm_configuration();
94
95 /* gpio configuration */
96 gpio_configuration();
97
98 /* compute the div value */
99 div_value = (uint16_t)(system_core_clock / 24000000) - 1;
100
101 /* tmr base configuration */
102 tmr_base_init(TMR4, 65535, div_value);
103 tmr_cnt_dir_set(TMR4, TMR_COUNT_UP);
104 tmr_clock_source_div_set(TMR4, TMR_CLOCK_DIV1);
105
106 /* output compare toggle mode configuration: channel1 */
107 tmr_output_default_para_init(&tmr_oc_init_structure);
108 tmr_oc_init_structure.oc_mode = TMR_OUTPUT_CONTROL_PWM_MODE_B;
109 tmr_oc_init_structure.oc_idle_state = FALSE;
110 tmr_oc_init_structure.oc_polarity = TMR_OUTPUT_ACTIVE_HIGH;
111 tmr_oc_init_structure.oc_output_state = TRUE;
112 tmr_output_channel_config(TMR4, TMR_SELECT_CHANNEL_1, &tmr_oc_init_structure);
113 tmr_channel_value_set(TMR4, TMR_SELECT_CHANNEL_1, 16383);
114
115 tmr_input_default_para_init(&tmr_ic_init_structure);
116 tmr_ic_init_structure.input_filter_value = 0;
117 tmr_ic_init_structure.input_channel_select = TMR_SELECT_CHANNEL_2;
118 tmr_ic_init_structure.input_mapped_select = TMR_CC_CHANNEL_MAPPED_DIRECT;
119 tmr_ic_init_structure.input_polarity_select = TMR_INPUT_RISING_EDGE;
120 tmr_input_channel_init(TMR4, &tmr_ic_init_structure, TMR_CHANNEL_INPUT_DIV_1);
121
122 /* one cycle mode selection */
123 tmr_one_cycle_mode_enable(TMR4, TRUE);
124
125 /* input trigger selection */
126 tmr_trigger_input_select(TMR4, TMR_SUB_INPUT_SEL_C2DF2);
127
128 /* slave mode selection: trigger mode */
129 tmr_sub_mode_select(TMR4, TMR_SUB_TRIGGER_MODE);
130
131 while(1)
132 {
133 }
134}
135
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
main
int main(void)
main function.
Definition project/at_start_f413/examples/tmr/one_cycle/src/main.c:88
gpio_configuration
void gpio_configuration(void)
configure the tmr3 pins.
Definition project/at_start_f413/examples/tmr/one_cycle/src/main.c:49
tmr_ic_init_structure
tmr_input_config_type tmr_ic_init_structure
Definition project/at_start_f413/examples/tmr/one_cycle/src/main.c:38
tmr_oc_init_structure
tmr_output_config_type tmr_oc_init_structure
Definition project/at_start_f413/examples/tmr/one_cycle/src/main.c:37
crm_configuration
void crm_configuration(void)
configures the different peripheral clocks.
Definition project/at_start_f413/examples/tmr/one_cycle/src/main.c:74
div_value
uint16_t div_value
Definition project/at_start_f413/examples/tmr/one_cycle/src/main.c:39
system_core_clock
unsigned int system_core_clock
Definition system_at32f413.c:47
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_TMR4_PERIPH_CLOCK
@ CRM_TMR4_PERIPH_CLOCK
Definition at32f413_crm.h:127
CRM_GPIOB_PERIPH_CLOCK
@ CRM_GPIOB_PERIPH_CLOCK
Definition at32f413_crm.h:110
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_6
#define GPIO_PINS_6
Definition at32f413_gpio.h:56
GPIO_PINS_7
#define GPIO_PINS_7
Definition at32f413_gpio.h:57
GPIOB
#define GPIOB
Definition at32f413_gpio.h:748
tmr_output_channel_config
void tmr_output_channel_config(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_output_config_type *tmr_output_struct)
config tmr output channel
Definition at32f413_tmr.c:318
tmr_input_channel_init
void tmr_input_channel_init(tmr_type *tmr_x, tmr_input_config_type *input_struct, tmr_channel_input_divider_type divider_factor)
init tmr input channel
Definition at32f413_tmr.c:816
tmr_clock_source_div_set
void tmr_clock_source_div_set(tmr_type *tmr_x, tmr_clock_division_type tmr_clock_div)
set tmr clock source division
Definition at32f413_tmr.c:204
tmr_sub_mode_select
void tmr_sub_mode_select(tmr_type *tmr_x, tmr_sub_mode_select_type sub_mode)
select tmr subordinate mode
Definition at32f413_tmr.c:1196
tmr_input_default_para_init
void tmr_input_default_para_init(tmr_input_config_type *tmr_input_struct)
init tmr input default para
Definition at32f413_tmr.c:143
tmr_output_default_para_init
void tmr_output_default_para_init(tmr_output_config_type *tmr_output_struct)
init tmr output default para
Definition at32f413_tmr.c:126
tmr_base_init
void tmr_base_init(tmr_type *tmr_x, uint32_t tmr_pr, uint32_t tmr_div)
init tmr base
Definition at32f413_tmr.c:179
tmr_trigger_input_select
void tmr_trigger_input_select(tmr_type *tmr_x, sub_tmr_input_sel_type trigger_select)
select tmr sub-trigger
Definition at32f413_tmr.c:1260
tmr_cnt_dir_set
void tmr_cnt_dir_set(tmr_type *tmr_x, tmr_count_mode_type tmr_cnt_dir)
set tmr counter count direction
Definition at32f413_tmr.c:225
tmr_one_cycle_mode_enable
void tmr_one_cycle_mode_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr one cycle mode
Definition at32f413_tmr.c:744
tmr_channel_value_set
void tmr_channel_value_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, uint32_t tmr_channel_value)
set tmr channel value
Definition at32f413_tmr.c:506
TMR_COUNT_UP
@ TMR_COUNT_UP
Definition at32f413_tmr.h:105
TMR_INPUT_RISING_EDGE
@ TMR_INPUT_RISING_EDGE
Definition at32f413_tmr.h:205
TMR_SELECT_CHANNEL_1
@ TMR_SELECT_CHANNEL_1
Definition at32f413_tmr.h:215
TMR_SELECT_CHANNEL_2
@ TMR_SELECT_CHANNEL_2
Definition at32f413_tmr.h:217
TMR_CC_CHANNEL_MAPPED_DIRECT
@ TMR_CC_CHANNEL_MAPPED_DIRECT
Definition at32f413_tmr.h:238
TMR_CLOCK_DIV1
@ TMR_CLOCK_DIV1
Definition at32f413_tmr.h:95
TMR_OUTPUT_CONTROL_PWM_MODE_B
@ TMR_OUTPUT_CONTROL_PWM_MODE_B
Definition at32f413_tmr.h:179
TMR_OUTPUT_ACTIVE_HIGH
@ TMR_OUTPUT_ACTIVE_HIGH
Definition at32f413_tmr.h:196
TMR_SUB_INPUT_SEL_C2DF2
@ TMR_SUB_INPUT_SEL_C2DF2
Definition at32f413_tmr.h:138
TMR_SUB_TRIGGER_MODE
@ TMR_SUB_TRIGGER_MODE
Definition at32f413_tmr.h:153
TMR_CHANNEL_INPUT_DIV_1
@ TMR_CHANNEL_INPUT_DIV_1
Definition at32f413_tmr.h:248
TMR4
#define TMR4
Definition at32f413_tmr.h:834
at32f413_clock.h
header file of clock program
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
tmr_input_config_type
tmr input capture config type
Definition at32f413_tmr.h:411
tmr_input_config_type::input_mapped_select
tmr_input_direction_mapped_type input_mapped_select
Definition at32f413_tmr.h:414
tmr_input_config_type::input_filter_value
uint8_t input_filter_value
Definition at32f413_tmr.h:415
tmr_input_config_type::input_polarity_select
tmr_input_polarity_type input_polarity_select
Definition at32f413_tmr.h:413
tmr_input_config_type::input_channel_select
tmr_channel_select_type input_channel_select
Definition at32f413_tmr.h:412
tmr_output_config_type
tmr output config type
Definition at32f413_tmr.h:397
tmr_output_config_type::oc_idle_state
confirm_state oc_idle_state
Definition at32f413_tmr.h:399
tmr_output_config_type::oc_output_state
confirm_state oc_output_state
Definition at32f413_tmr.h:403
tmr_output_config_type::oc_mode
tmr_output_control_mode_type oc_mode
Definition at32f413_tmr.h:398
tmr_output_config_type::oc_polarity
tmr_output_polarity_type oc_polarity
Definition at32f413_tmr.h:401


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • tmr
  • parallel_synchro
  • inc
project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • tmr
  • parallel_synchro
  • inc
project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • tmr
  • parallel_synchro
  • inc
project/at_start_f413/examples/tmr/parallel_synchro/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • tmr
  • parallel_synchro
  • src
project/at_start_f413/examples/tmr/parallel_synchro/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/tmr/parallel_synchro/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • tmr
  • parallel_synchro
  • src
project/at_start_f413/examples/tmr/parallel_synchro/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/tmr/parallel_synchro/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/tmr/parallel_synchro/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/tmr/parallel_synchro/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/tmr/parallel_synchro/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/tmr/parallel_synchro/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/tmr/parallel_synchro/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/tmr/parallel_synchro/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/tmr/parallel_synchro/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/tmr/parallel_synchro/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • tmr
  • parallel_synchro
  • src
project/at_start_f413/examples/tmr/parallel_synchro/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37 tmr_output_config_type tmr_oc_init_structure;
38
39void crm_configuration(void);
40void gpio_configuration(void);
41
47void gpio_configuration(void)
48{
49 gpio_init_type gpio_init_struct;
50
51 gpio_default_para_init(&gpio_init_struct);
52
53 gpio_init_struct.gpio_pins = GPIO_PINS_6 | GPIO_PINS_0;
54 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
55 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
56 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
57 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
58 gpio_init(GPIOA, &gpio_init_struct);
59
60 gpio_init_struct.gpio_pins = GPIO_PINS_6;
61 gpio_init(GPIOB, &gpio_init_struct);
62
63}
64
70void crm_configuration(void)
71{
72 /* tmr3 clock enable */
73 crm_periph_clock_enable(CRM_TMR2_PERIPH_CLOCK, TRUE);
74 crm_periph_clock_enable(CRM_TMR3_PERIPH_CLOCK, TRUE);
75 crm_periph_clock_enable(CRM_TMR4_PERIPH_CLOCK, TRUE);
76
77 /* gpios clock enable */
78 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
79 crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
80 crm_periph_clock_enable(CRM_GPIOC_PERIPH_CLOCK, TRUE);
81 crm_periph_clock_enable(CRM_IOMUX_PERIPH_CLOCK, TRUE);
82}
83
89int main(void)
90{
91 system_clock_config();
92
93 /* peripheral clocks configuration */
94 crm_configuration();
95
96 /* gpio configuration */
97 gpio_configuration();
98
99 /* tmr base configuration */
100 tmr_base_init(TMR2, 191, 0);
101 tmr_cnt_dir_set(TMR2, TMR_COUNT_UP);
102 tmr_clock_source_div_set(TMR2, TMR_CLOCK_DIV1);
103 tmr_base_init(TMR3, 9, 0);
104 tmr_cnt_dir_set(TMR3, TMR_COUNT_UP);
105 tmr_clock_source_div_set(TMR3, TMR_CLOCK_DIV1);
106 tmr_base_init(TMR4, 4, 0);
107 tmr_cnt_dir_set(TMR4, TMR_COUNT_UP);
108 tmr_clock_source_div_set(TMR4, TMR_CLOCK_DIV1);
109
110 /* output compare toggle mode configuration: channel1 */
111 tmr_output_default_para_init(&tmr_oc_init_structure);
112 tmr_oc_init_structure.oc_mode = TMR_OUTPUT_CONTROL_PWM_MODE_A;
113 tmr_oc_init_structure.oc_idle_state = FALSE;
114 tmr_oc_init_structure.oc_polarity = TMR_OUTPUT_ACTIVE_HIGH;
115 tmr_oc_init_structure.oc_output_state = TRUE;
116 tmr_output_channel_config(TMR2, TMR_SELECT_CHANNEL_1, &tmr_oc_init_structure);
117 tmr_channel_value_set(TMR2, TMR_SELECT_CHANNEL_1, 96);
118
119 tmr_output_channel_config(TMR3, TMR_SELECT_CHANNEL_1, &tmr_oc_init_structure);
120 tmr_channel_value_set(TMR3, TMR_SELECT_CHANNEL_1, 3);
121
122 tmr_output_channel_config(TMR4, TMR_SELECT_CHANNEL_1, &tmr_oc_init_structure);
123 tmr_channel_value_set(TMR4, TMR_SELECT_CHANNEL_1, 3);
124
125 /* primary mode selection: TMR2 */
126 tmr_sub_sync_mode_set(TMR2, TRUE);
127 tmr_primary_mode_select(TMR2, TMR_PRIMARY_SEL_OVERFLOW);
128
129 /* subordinate mode selection: TMR3 */
130 tmr_sub_mode_select(TMR3, TMR_SUB_HANG_MODE);
131 tmr_trigger_input_select(TMR3, TMR_SUB_INPUT_SEL_IS1);
132
133 /* subordinate mode selection: TMR4 */
134 tmr_sub_mode_select(TMR4, TMR_SUB_HANG_MODE);
135 tmr_trigger_input_select(TMR4, TMR_SUB_INPUT_SEL_IS1);
136
137 /* tmr enable counter */
138 tmr_counter_enable(TMR2, TRUE);
139 tmr_counter_enable(TMR3, TRUE);
140 tmr_counter_enable(TMR4, TRUE);
141
142 while(1)
143 {
144 }
145}
146
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
main
int main(void)
main function.
Definition project/at_start_f413/examples/tmr/parallel_synchro/src/main.c:89
gpio_configuration
void gpio_configuration(void)
configure the tmr3 pins.
Definition project/at_start_f413/examples/tmr/parallel_synchro/src/main.c:47
tmr_oc_init_structure
tmr_output_config_type tmr_oc_init_structure
Definition project/at_start_f413/examples/tmr/parallel_synchro/src/main.c:37
crm_configuration
void crm_configuration(void)
configures the different peripheral clocks.
Definition project/at_start_f413/examples/tmr/parallel_synchro/src/main.c:70
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOC_PERIPH_CLOCK
@ CRM_GPIOC_PERIPH_CLOCK
Definition at32f413_crm.h:111
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_TMR2_PERIPH_CLOCK
@ CRM_TMR2_PERIPH_CLOCK
Definition at32f413_crm.h:125
CRM_TMR4_PERIPH_CLOCK
@ CRM_TMR4_PERIPH_CLOCK
Definition at32f413_crm.h:127
CRM_TMR3_PERIPH_CLOCK
@ CRM_TMR3_PERIPH_CLOCK
Definition at32f413_crm.h:126
CRM_IOMUX_PERIPH_CLOCK
@ CRM_IOMUX_PERIPH_CLOCK
Definition at32f413_crm.h:108
CRM_GPIOB_PERIPH_CLOCK
@ CRM_GPIOB_PERIPH_CLOCK
Definition at32f413_crm.h:110
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_6
#define GPIO_PINS_6
Definition at32f413_gpio.h:56
GPIO_PINS_0
#define GPIO_PINS_0
Definition at32f413_gpio.h:50
GPIOB
#define GPIOB
Definition at32f413_gpio.h:748
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
tmr_counter_enable
void tmr_counter_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr counter
Definition at32f413_tmr.c:114
tmr_output_channel_config
void tmr_output_channel_config(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_output_config_type *tmr_output_struct)
config tmr output channel
Definition at32f413_tmr.c:318
tmr_clock_source_div_set
void tmr_clock_source_div_set(tmr_type *tmr_x, tmr_clock_division_type tmr_clock_div)
set tmr clock source division
Definition at32f413_tmr.c:204
tmr_sub_mode_select
void tmr_sub_mode_select(tmr_type *tmr_x, tmr_sub_mode_select_type sub_mode)
select tmr subordinate mode
Definition at32f413_tmr.c:1196
tmr_output_default_para_init
void tmr_output_default_para_init(tmr_output_config_type *tmr_output_struct)
init tmr output default para
Definition at32f413_tmr.c:126
tmr_sub_sync_mode_set
void tmr_sub_sync_mode_set(tmr_type *tmr_x, confirm_state new_state)
set tmr subordinate synchronization mode
Definition at32f413_tmr.c:1273
tmr_base_init
void tmr_base_init(tmr_type *tmr_x, uint32_t tmr_pr, uint32_t tmr_div)
init tmr base
Definition at32f413_tmr.c:179
tmr_trigger_input_select
void tmr_trigger_input_select(tmr_type *tmr_x, sub_tmr_input_sel_type trigger_select)
select tmr sub-trigger
Definition at32f413_tmr.c:1260
tmr_primary_mode_select
void tmr_primary_mode_select(tmr_type *tmr_x, tmr_primary_select_type primary_mode)
select tmr primary mode
Definition at32f413_tmr.c:1174
tmr_cnt_dir_set
void tmr_cnt_dir_set(tmr_type *tmr_x, tmr_count_mode_type tmr_cnt_dir)
set tmr counter count direction
Definition at32f413_tmr.c:225
tmr_channel_value_set
void tmr_channel_value_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, uint32_t tmr_channel_value)
set tmr channel value
Definition at32f413_tmr.c:506
TMR_COUNT_UP
@ TMR_COUNT_UP
Definition at32f413_tmr.h:105
TMR_SELECT_CHANNEL_1
@ TMR_SELECT_CHANNEL_1
Definition at32f413_tmr.h:215
TMR_CLOCK_DIV1
@ TMR_CLOCK_DIV1
Definition at32f413_tmr.h:95
TMR_OUTPUT_CONTROL_PWM_MODE_A
@ TMR_OUTPUT_CONTROL_PWM_MODE_A
Definition at32f413_tmr.h:178
TMR_OUTPUT_ACTIVE_HIGH
@ TMR_OUTPUT_ACTIVE_HIGH
Definition at32f413_tmr.h:196
TMR_SUB_INPUT_SEL_IS1
@ TMR_SUB_INPUT_SEL_IS1
Definition at32f413_tmr.h:133
TMR_SUB_HANG_MODE
@ TMR_SUB_HANG_MODE
Definition at32f413_tmr.h:152
TMR_PRIMARY_SEL_OVERFLOW
@ TMR_PRIMARY_SEL_OVERFLOW
Definition at32f413_tmr.h:119
TMR3
#define TMR3
Definition at32f413_tmr.h:833
TMR2
#define TMR2
Definition at32f413_tmr.h:832
TMR4
#define TMR4
Definition at32f413_tmr.h:834
at32f413_clock.h
header file of clock program
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
tmr_output_config_type
tmr output config type
Definition at32f413_tmr.h:397
tmr_output_config_type::oc_idle_state
confirm_state oc_idle_state
Definition at32f413_tmr.h:399
tmr_output_config_type::oc_output_state
confirm_state oc_output_state
Definition at32f413_tmr.h:403
tmr_output_config_type::oc_mode
tmr_output_control_mode_type oc_mode
Definition at32f413_tmr.h:398
tmr_output_config_type::oc_polarity
tmr_output_polarity_type oc_polarity
Definition at32f413_tmr.h:401


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • tmr
  • pwm_input
  • inc
project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • tmr
  • pwm_input
  • inc
project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • tmr
  • pwm_input
  • inc
project/at_start_f413/examples/tmr/pwm_input/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • tmr
  • pwm_input
  • src
project/at_start_f413/examples/tmr/pwm_input/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/tmr/pwm_input/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • tmr
  • pwm_input
  • src
project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
29extern uint16_t duty_cycle;
30extern uint32_t frequency;
31
40__IO uint16_t ic2value = 0;
41
47void NMI_Handler(void)
48{
49}
50
56void HardFault_Handler(void)
57{
58 /* go to infinite loop when hard fault exception occurs */
59 while(1)
60 {
61 }
62}
63
69void MemManage_Handler(void)
70{
71 /* go to infinite loop when memory manage exception occurs */
72 while(1)
73 {
74 }
75}
76
82void BusFault_Handler(void)
83{
84 /* go to infinite loop when bus fault exception occurs */
85 while(1)
86 {
87 }
88}
89
95void UsageFault_Handler(void)
96{
97 /* go to infinite loop when usage fault exception occurs */
98 while(1)
99 {
100 }
101}
102
108void SVC_Handler(void)
109{
110}
111
117void DebugMon_Handler(void)
118{
119}
120
126void PendSV_Handler(void)
127{
128}
129
135void SysTick_Handler(void)
136{
137}
138
144void TMR3_GLOBAL_IRQHandler(void)
145{
146 /* clear tmr3 channel interrupt pending bit */
147 tmr_flag_clear(TMR3, TMR_C2_FLAG);
148
149 /* get the input channel data value */
150 ic2value = tmr_channel_value_get(TMR3, TMR_SELECT_CHANNEL_2);
151
152 if(ic2value != 0)
153 {
154 /* duty cycle computation */
155 duty_cycle = (tmr_channel_value_get(TMR3, TMR_SELECT_CHANNEL_1) * 100) / ic2value;
156
157 /* frequency computation */
158 frequency = system_core_clock / ic2value;
159 }
160 else
161 {
162 duty_cycle = 0;
163 frequency = 0;
164 }
165}
166
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c:95
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c:56
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c:69
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c:108
ic2value
__IO uint16_t ic2value
Definition project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c:40
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c:126
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c:47
TMR3_GLOBAL_IRQHandler
void TMR3_GLOBAL_IRQHandler(void)
this function handles tmr3 global interrupt request.
Definition project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c:144
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c:82
frequency
uint32_t frequency
Definition project/at_start_f413/examples/tmr/pwm_input/src/main.c:40
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c:135
duty_cycle
uint16_t duty_cycle
Definition project/at_start_f413/examples/tmr/pwm_input/src/main.c:39
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/tmr/pwm_input/src/at32f413_int.c:117
system_core_clock
unsigned int system_core_clock
Definition system_at32f413.c:47
tmr_channel_value_get
uint32_t tmr_channel_value_get(tmr_type *tmr_x, tmr_channel_select_type tmr_channel)
get tmr channel value
Definition at32f413_tmr.c:551
tmr_flag_clear
void tmr_flag_clear(tmr_type *tmr_x, uint32_t tmr_flag)
clear tmr flag
Definition at32f413_tmr.c:1433
TMR_SELECT_CHANNEL_1
@ TMR_SELECT_CHANNEL_1
Definition at32f413_tmr.h:215
TMR_SELECT_CHANNEL_2
@ TMR_SELECT_CHANNEL_2
Definition at32f413_tmr.h:217
TMR_C2_FLAG
#define TMR_C2_FLAG
Definition at32f413_tmr.h:53
TMR3
#define TMR3
Definition at32f413_tmr.h:833
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • tmr
  • pwm_input
  • src
project/at_start_f413/examples/tmr/pwm_input/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37 tmr_input_config_type tmr_ic_init_structure;
38
39__IO uint16_t duty_cycle = 0;
40__IO uint32_t frequency = 0;
41
42void crm_configuration(void);
43void gpio_configuration(void);
44
50void gpio_configuration(void)
51{
52 gpio_init_type gpio_init_struct;
53
54 gpio_default_para_init(&gpio_init_struct);
55
56 gpio_init_struct.gpio_pins = GPIO_PINS_7;
57 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
58 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
59 gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
60 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
61 gpio_init(GPIOA, &gpio_init_struct);
62}
63
69void crm_configuration(void)
70{
71 /* tmr3 clock enable */
72 crm_periph_clock_enable(CRM_TMR3_PERIPH_CLOCK, TRUE);
73
74 /* gpioa clock enable */
75 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
76}
77
83int main(void)
84{
85 system_clock_config();
86
87 /* peripheral clocks configuration */
88 crm_configuration();
89
90 /* nvic configuration */
91 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
92 nvic_irq_enable(TMR3_GLOBAL_IRQn, 0, 0);
93
94 /* gpio configuration */
95 gpio_configuration();
96
97 uart_print_init(115200);
98
99 tmr_input_default_para_init(&tmr_ic_init_structure);
100 tmr_ic_init_structure.input_filter_value = 0;
101 tmr_ic_init_structure.input_channel_select = TMR_SELECT_CHANNEL_2;
102 tmr_ic_init_structure.input_mapped_select = TMR_CC_CHANNEL_MAPPED_DIRECT;
103 tmr_ic_init_structure.input_polarity_select = TMR_INPUT_RISING_EDGE;
104
105 tmr_pwm_input_config(TMR3, &tmr_ic_init_structure, TMR_CHANNEL_INPUT_DIV_1);
106
107 /* select the tmr3 input trigger: c2df2 */
108 tmr_trigger_input_select(TMR3, TMR_SUB_INPUT_SEL_C2DF2);
109
110 /* select the sub mode: reset mode */
111 tmr_sub_mode_select(TMR3, TMR_SUB_RESET_MODE);
112
113 /* enable the sub sync mode */
114 tmr_sub_sync_mode_set(TMR3, TRUE);
115
116 /* tmr enable counter */
117 tmr_counter_enable(TMR3, TRUE);
118
119 /* enable the c2 interrupt request */
120 tmr_interrupt_enable(TMR3, TMR_C2_INT, TRUE);
121
122 while(1)
123 {
124 printf("Frequency = %dHZ,Dutycycle = %d%%\r\n", frequency, duty_cycle);
125 }
126}
127
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
main
int main(void)
main function.
Definition project/at_start_f413/examples/tmr/pwm_input/src/main.c:83
gpio_configuration
void gpio_configuration(void)
configure the tmr3 pins.
Definition project/at_start_f413/examples/tmr/pwm_input/src/main.c:50
tmr_ic_init_structure
tmr_input_config_type tmr_ic_init_structure
Definition project/at_start_f413/examples/tmr/pwm_input/src/main.c:37
crm_configuration
void crm_configuration(void)
configures the different peripheral clocks.
Definition project/at_start_f413/examples/tmr/pwm_input/src/main.c:69
frequency
__IO uint32_t frequency
Definition project/at_start_f413/examples/tmr/pwm_input/src/main.c:40
duty_cycle
__IO uint16_t duty_cycle
Definition project/at_start_f413/examples/tmr/pwm_input/src/main.c:39
uart_print_init
void uart_print_init(uint32_t baudrate)
initialize uart
Definition at32f413_board.c:129
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_TMR3_PERIPH_CLOCK
@ CRM_TMR3_PERIPH_CLOCK
Definition at32f413_crm.h:126
TMR3_GLOBAL_IRQn
@ TMR3_GLOBAL_IRQn
Definition at32f413.h:201
TRUE
@ TRUE
Definition at32f413.h:297
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_7
#define GPIO_PINS_7
Definition at32f413_gpio.h:57
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
tmr_counter_enable
void tmr_counter_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr counter
Definition at32f413_tmr.c:114
tmr_sub_mode_select
void tmr_sub_mode_select(tmr_type *tmr_x, tmr_sub_mode_select_type sub_mode)
select tmr subordinate mode
Definition at32f413_tmr.c:1196
tmr_input_default_para_init
void tmr_input_default_para_init(tmr_input_config_type *tmr_input_struct)
init tmr input default para
Definition at32f413_tmr.c:143
tmr_sub_sync_mode_set
void tmr_sub_sync_mode_set(tmr_type *tmr_x, confirm_state new_state)
set tmr subordinate synchronization mode
Definition at32f413_tmr.c:1273
tmr_pwm_input_config
void tmr_pwm_input_config(tmr_type *tmr_x, tmr_input_config_type *input_struct, tmr_channel_input_divider_type divider_factor)
config tmr pwm input
Definition at32f413_tmr.c:990
tmr_trigger_input_select
void tmr_trigger_input_select(tmr_type *tmr_x, sub_tmr_input_sel_type trigger_select)
select tmr sub-trigger
Definition at32f413_tmr.c:1260
tmr_interrupt_enable
void tmr_interrupt_enable(tmr_type *tmr_x, uint32_t tmr_interrupt, confirm_state new_state)
enable or disable tmr interrupt
Definition at32f413_tmr.c:1327
TMR_INPUT_RISING_EDGE
@ TMR_INPUT_RISING_EDGE
Definition at32f413_tmr.h:205
TMR_SELECT_CHANNEL_2
@ TMR_SELECT_CHANNEL_2
Definition at32f413_tmr.h:217
TMR_CC_CHANNEL_MAPPED_DIRECT
@ TMR_CC_CHANNEL_MAPPED_DIRECT
Definition at32f413_tmr.h:238
TMR_SUB_INPUT_SEL_C2DF2
@ TMR_SUB_INPUT_SEL_C2DF2
Definition at32f413_tmr.h:138
TMR_SUB_RESET_MODE
@ TMR_SUB_RESET_MODE
Definition at32f413_tmr.h:151
TMR_CHANNEL_INPUT_DIV_1
@ TMR_CHANNEL_INPUT_DIV_1
Definition at32f413_tmr.h:248
TMR_C2_INT
#define TMR_C2_INT
Definition at32f413_tmr.h:75
TMR3
#define TMR3
Definition at32f413_tmr.h:833
at32f413_clock.h
header file of clock program
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
tmr_input_config_type
tmr input capture config type
Definition at32f413_tmr.h:411
tmr_input_config_type::input_mapped_select
tmr_input_direction_mapped_type input_mapped_select
Definition at32f413_tmr.h:414
tmr_input_config_type::input_filter_value
uint8_t input_filter_value
Definition at32f413_tmr.h:415
tmr_input_config_type::input_polarity_select
tmr_input_polarity_type input_polarity_select
Definition at32f413_tmr.h:413
tmr_input_config_type::input_channel_select
tmr_channel_select_type input_channel_select
Definition at32f413_tmr.h:412


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • tmr
  • pwm_input_dma
  • inc
project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • tmr
  • pwm_input_dma
  • inc
project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • tmr
  • pwm_input_dma
  • inc
project/at_start_f413/examples/tmr/pwm_input_dma/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • tmr
  • pwm_input_dma
  • src
project/at_start_f413/examples/tmr/pwm_input_dma/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/tmr/pwm_input_dma/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • tmr
  • pwm_input_dma
  • src
project/at_start_f413/examples/tmr/pwm_input_dma/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/tmr/pwm_input_dma/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/tmr/pwm_input_dma/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/tmr/pwm_input_dma/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/tmr/pwm_input_dma/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/tmr/pwm_input_dma/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/tmr/pwm_input_dma/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/tmr/pwm_input_dma/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/tmr/pwm_input_dma/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/tmr/pwm_input_dma/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • tmr
  • pwm_input_dma
  • src
project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include "stdio.h"
29
38#define SAMPLING_NUM 1000
39
40 tmr_input_config_type tmr_ic_init_structure;
41 dma_init_type dma_init_structure;
42
43__IO uint16_t buffer_ch1[1000];
44__IO uint16_t buffer_ch2[1000];
45
46__IO uint32_t frequency = 0;
47__IO float duty_cycle = 0;
48
49uint32_t freq_result;
50float duty_result;
51
52void crm_configuration(void);
53void gpio_configuration(void);
54
55void DMA1_Channel2_IRQHandler(void)
56{
57 uint16_t i;
58
59 dma_flag_clear(DMA1_FDT2_FLAG);
60
61 duty_result = 0;
62 freq_result = 0.0;
63
64 for(i = 0; i < SAMPLING_NUM; i++)
65 {
66 duty_result += ((buffer_ch2[i] * 100.0) / buffer_ch1[i]);
67 freq_result += (system_core_clock / buffer_ch1[i]);
68 }
69
70 duty_cycle = duty_result / SAMPLING_NUM;
71 frequency = freq_result / SAMPLING_NUM;
72 printf("\r\nFreq=%dHZ, Duty=%.2f%%\r\n", frequency, duty_cycle);
73}
74
80void gpio_configuration(void)
81{
82 gpio_init_type gpio_init_struct;
83
84 gpio_default_para_init(&gpio_init_struct);
85
86 gpio_init_struct.gpio_pins = GPIO_PINS_8;
87 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
88 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
89 gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
90 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
91 gpio_init(GPIOA, &gpio_init_struct);
92}
93
99void crm_configuration(void)
100{
101 /* tmr1 clock enable */
102 crm_periph_clock_enable(CRM_TMR1_PERIPH_CLOCK, TRUE);
103
104 /* gpioa clock enable */
105 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
106
107 /* dma clock enable */
108 crm_periph_clock_enable(CRM_DMA1_PERIPH_CLOCK, TRUE);
109}
110
116int main(void)
117{
118 system_clock_config();
119
120 /* peripheral clocks configuration */
121 crm_configuration();
122
123 /* nvic configuration */
124 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
125 nvic_irq_enable(DMA1_Channel2_IRQn, 0, 0);
126
127 /* gpio configuration */
128 gpio_configuration();
129
130 uart_print_init(115200);
131
132 dma_reset(DMA1_CHANNEL2);
133 dma_default_para_init(&dma_init_structure);
134 dma_init_structure.peripheral_base_addr = (uint32_t)&TMR1->c1dt;
135 dma_init_structure.memory_base_addr = (uint32_t)buffer_ch1;
136 dma_init_structure.direction = DMA_DIR_PERIPHERAL_TO_MEMORY;
137 dma_init_structure.buffer_size = SAMPLING_NUM;
138 dma_init_structure.peripheral_inc_enable = FALSE;
139 dma_init_structure.memory_inc_enable = TRUE;
140 dma_init_structure.peripheral_data_width = DMA_PERIPHERAL_DATA_WIDTH_HALFWORD;
141 dma_init_structure.memory_data_width = DMA_MEMORY_DATA_WIDTH_HALFWORD;
142 dma_init_structure.loop_mode_enable = TRUE;
143 dma_init_structure.priority = DMA_PRIORITY_HIGH;
144 dma_init(DMA1_CHANNEL2, &dma_init_structure);
145
146 dma_reset(DMA1_CHANNEL3);
147 dma_init_structure.peripheral_base_addr = (uint32_t)&TMR1->c2dt;
148 dma_init_structure.memory_base_addr = (uint32_t)buffer_ch2;
149 dma_init(DMA1_CHANNEL3, &dma_init_structure);
150
151 dma_interrupt_enable(DMA1_CHANNEL2, DMA_FDT_INT, TRUE);
152
153 dma_channel_enable(DMA1_CHANNEL2, TRUE);
154 dma_channel_enable(DMA1_CHANNEL3, TRUE);
155
156 tmr_input_default_para_init(&tmr_ic_init_structure);
157 tmr_ic_init_structure.input_filter_value = 0;
158 tmr_ic_init_structure.input_channel_select = TMR_SELECT_CHANNEL_1;
159 tmr_ic_init_structure.input_mapped_select = TMR_CC_CHANNEL_MAPPED_DIRECT;
160 tmr_ic_init_structure.input_polarity_select = TMR_INPUT_RISING_EDGE;
161
162 tmr_pwm_input_config(TMR1, &tmr_ic_init_structure, TMR_CHANNEL_INPUT_DIV_1);
163
164 /* select the TMR1 input trigger: C2IF2 */
165 tmr_trigger_input_select(TMR1, TMR_SUB_INPUT_SEL_C1DF1);
166
167 /* select the sub mode: reset mode */
168 tmr_sub_mode_select(TMR1, TMR_SUB_RESET_MODE);
169
170 /* enable the sub sync mode */
171 tmr_sub_sync_mode_set(TMR1, TRUE);
172
173 /* enable the c1/c2 dma */
174 tmr_dma_request_enable(TMR1, TMR_C1_DMA_REQUEST, TRUE);
175 tmr_dma_request_enable(TMR1, TMR_C2_DMA_REQUEST, TRUE);
176
177 /* tmr enable counter */
178 tmr_counter_enable(TMR1, TRUE);
179
180 while(1)
181 {
182 }
183}
184
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
duty_cycle
__IO float duty_cycle
Definition project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c:47
DMA1_Channel2_IRQHandler
void DMA1_Channel2_IRQHandler(void)
Definition project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c:55
dma_init_structure
dma_init_type dma_init_structure
Definition project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c:41
freq_result
uint32_t freq_result
Definition project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c:49
duty_result
float duty_result
Definition project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c:50
buffer_ch2
__IO uint16_t buffer_ch2[1000]
Definition project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c:44
main
int main(void)
main function.
Definition project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c:116
gpio_configuration
void gpio_configuration(void)
configure the tmr1 pins.
Definition project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c:80
SAMPLING_NUM
#define SAMPLING_NUM
Definition project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c:38
tmr_ic_init_structure
tmr_input_config_type tmr_ic_init_structure
Definition project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c:40
crm_configuration
void crm_configuration(void)
configures the different peripheral clocks.
Definition project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c:99
frequency
__IO uint32_t frequency
Definition project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c:46
buffer_ch1
__IO uint16_t buffer_ch1[1000]
Definition project/at_start_f413/examples/tmr/pwm_input_dma/src/main.c:43
system_core_clock
unsigned int system_core_clock
Definition system_at32f413.c:47
uart_print_init
void uart_print_init(uint32_t baudrate)
initialize uart
Definition at32f413_board.c:129
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_DMA1_PERIPH_CLOCK
@ CRM_DMA1_PERIPH_CLOCK
Definition at32f413_crm.h:103
CRM_TMR1_PERIPH_CLOCK
@ CRM_TMR1_PERIPH_CLOCK
Definition at32f413_crm.h:116
DMA1_Channel2_IRQn
@ DMA1_Channel2_IRQn
Definition at32f413.h:183
dma_channel_enable
void dma_channel_enable(dma_channel_type *dmax_channely, confirm_state new_state)
enable or disable dma channely
Definition at32f413_dma.c:197
dma_default_para_init
void dma_default_para_init(dma_init_type *dma_init_struct)
dma init config with its default value.
Definition at32f413_dma.c:407
dma_interrupt_enable
void dma_interrupt_enable(dma_channel_type *dmax_channely, uint32_t dma_int, confirm_state new_state)
enable or disable dma interrupt
Definition at32f413_dma.c:164
dma_flag_clear
void dma_flag_clear(uint32_t dmax_flag)
clear dma flag
Definition at32f413_dma.c:389
dma_reset
void dma_reset(dma_channel_type *dmax_channely)
reset the dmax channely registers.
Definition at32f413_dma.c:63
dma_init
void dma_init(dma_channel_type *dmax_channely, dma_init_type *dma_init_struct)
dma init
Definition at32f413_dma.c:442
DMA_PERIPHERAL_DATA_WIDTH_HALFWORD
@ DMA_PERIPHERAL_DATA_WIDTH_HALFWORD
Definition at32f413_dma.h:246
DMA_DIR_PERIPHERAL_TO_MEMORY
@ DMA_DIR_PERIPHERAL_TO_MEMORY
Definition at32f413_dma.h:216
DMA_MEMORY_DATA_WIDTH_HALFWORD
@ DMA_MEMORY_DATA_WIDTH_HALFWORD
Definition at32f413_dma.h:256
DMA_PRIORITY_HIGH
@ DMA_PRIORITY_HIGH
Definition at32f413_dma.h:267
DMA1_FDT2_FLAG
#define DMA1_FDT2_FLAG
Definition at32f413_dma.h:85
DMA_FDT_INT
#define DMA_FDT_INT
Definition at32f413_dma.h:51
DMA1_CHANNEL3
#define DMA1_CHANNEL3
Definition at32f413_dma.h:482
DMA1_CHANNEL2
#define DMA1_CHANNEL2
Definition at32f413_dma.h:481
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_8
#define GPIO_PINS_8
Definition at32f413_gpio.h:58
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
tmr_dma_request_enable
void tmr_dma_request_enable(tmr_type *tmr_x, tmr_dma_request_type dma_request, confirm_state new_state)
enable or disable tmr dma request
Definition at32f413_tmr.c:1296
tmr_counter_enable
void tmr_counter_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr counter
Definition at32f413_tmr.c:114
tmr_sub_mode_select
void tmr_sub_mode_select(tmr_type *tmr_x, tmr_sub_mode_select_type sub_mode)
select tmr subordinate mode
Definition at32f413_tmr.c:1196
tmr_input_default_para_init
void tmr_input_default_para_init(tmr_input_config_type *tmr_input_struct)
init tmr input default para
Definition at32f413_tmr.c:143
tmr_sub_sync_mode_set
void tmr_sub_sync_mode_set(tmr_type *tmr_x, confirm_state new_state)
set tmr subordinate synchronization mode
Definition at32f413_tmr.c:1273
tmr_pwm_input_config
void tmr_pwm_input_config(tmr_type *tmr_x, tmr_input_config_type *input_struct, tmr_channel_input_divider_type divider_factor)
config tmr pwm input
Definition at32f413_tmr.c:990
tmr_trigger_input_select
void tmr_trigger_input_select(tmr_type *tmr_x, sub_tmr_input_sel_type trigger_select)
select tmr sub-trigger
Definition at32f413_tmr.c:1260
TMR_C1_DMA_REQUEST
@ TMR_C1_DMA_REQUEST
Definition at32f413_tmr.h:269
TMR_C2_DMA_REQUEST
@ TMR_C2_DMA_REQUEST
Definition at32f413_tmr.h:270
TMR_INPUT_RISING_EDGE
@ TMR_INPUT_RISING_EDGE
Definition at32f413_tmr.h:205
TMR_SELECT_CHANNEL_1
@ TMR_SELECT_CHANNEL_1
Definition at32f413_tmr.h:215
TMR_CC_CHANNEL_MAPPED_DIRECT
@ TMR_CC_CHANNEL_MAPPED_DIRECT
Definition at32f413_tmr.h:238
TMR_SUB_INPUT_SEL_C1DF1
@ TMR_SUB_INPUT_SEL_C1DF1
Definition at32f413_tmr.h:137
TMR_SUB_RESET_MODE
@ TMR_SUB_RESET_MODE
Definition at32f413_tmr.h:151
TMR_CHANNEL_INPUT_DIV_1
@ TMR_CHANNEL_INPUT_DIV_1
Definition at32f413_tmr.h:248
TMR1
#define TMR1
Definition at32f413_tmr.h:831
at32f413_clock.h
header file of clock program
dma_init_type
dma init type
Definition at32f413_dma.h:275
dma_init_type::loop_mode_enable
confirm_state loop_mode_enable
Definition at32f413_dma.h:284
dma_init_type::buffer_size
uint16_t buffer_size
Definition at32f413_dma.h:279
dma_init_type::memory_data_width
dma_memory_data_size_type memory_data_width
Definition at32f413_dma.h:283
dma_init_type::priority
dma_priority_level_type priority
Definition at32f413_dma.h:285
dma_init_type::peripheral_inc_enable
confirm_state peripheral_inc_enable
Definition at32f413_dma.h:280
dma_init_type::memory_inc_enable
confirm_state memory_inc_enable
Definition at32f413_dma.h:281
dma_init_type::direction
dma_dir_type direction
Definition at32f413_dma.h:278
dma_init_type::peripheral_base_addr
uint32_t peripheral_base_addr
Definition at32f413_dma.h:276
dma_init_type::memory_base_addr
uint32_t memory_base_addr
Definition at32f413_dma.h:277
dma_init_type::peripheral_data_width
dma_peripheral_data_size_type peripheral_data_width
Definition at32f413_dma.h:282
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
tmr_input_config_type
tmr input capture config type
Definition at32f413_tmr.h:411
tmr_input_config_type::input_mapped_select
tmr_input_direction_mapped_type input_mapped_select
Definition at32f413_tmr.h:414
tmr_input_config_type::input_filter_value
uint8_t input_filter_value
Definition at32f413_tmr.h:415
tmr_input_config_type::input_polarity_select
tmr_input_polarity_type input_polarity_select
Definition at32f413_tmr.h:413
tmr_input_config_type::input_channel_select
tmr_channel_select_type input_channel_select
Definition at32f413_tmr.h:412


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • tmr
  • pwm_output_simulate
  • inc
project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • tmr
  • pwm_output_simulate
  • inc
project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • tmr
  • pwm_output_simulate
  • inc
project/at_start_f413/examples/tmr/pwm_output_simulate/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • tmr
  • pwm_output_simulate
  • src
project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • tmr
  • pwm_output_simulate
  • src
project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
29extern __IO uint16_t ch1_val;
30extern __IO uint16_t ch2_val;
31extern __IO uint16_t ch3_val;
32extern __IO uint16_t ch4_val;
33
42uint16_t capture = 0;
43
49void NMI_Handler(void)
50{
51}
52
58void HardFault_Handler(void)
59{
60 /* go to infinite loop when hard fault exception occurs */
61 while(1)
62 {
63 }
64}
65
71void MemManage_Handler(void)
72{
73 /* go to infinite loop when memory manage exception occurs */
74 while(1)
75 {
76 }
77}
78
84void BusFault_Handler(void)
85{
86 /* go to infinite loop when bus fault exception occurs */
87 while(1)
88 {
89 }
90}
91
97void UsageFault_Handler(void)
98{
99 /* go to infinite loop when usage fault exception occurs */
100 while(1)
101 {
102 }
103}
104
110void SVC_Handler(void)
111{
112}
113
119void DebugMon_Handler(void)
120{
121}
122
128void PendSV_Handler(void)
129{
130}
131
137void SysTick_Handler(void)
138{
139}
140
141void TMR2_GLOBAL_IRQHandler(void)
142{
143 if(tmr_interrupt_flag_get(TMR2, TMR_C1_FLAG) != RESET)
144 {
145 tmr_flag_clear(TMR2, TMR_C1_FLAG );
146
147 /* Pin PC.06 toggling with frequency = 73.24 Hz */
148 gpio_bits_write(GPIOC, GPIO_PINS_6, (confirm_state)(1 - gpio_output_data_bit_read(GPIOC, GPIO_PINS_6)));
149 capture = tmr_channel_value_get(TMR2, TMR_SELECT_CHANNEL_1);
150 tmr_channel_value_set(TMR2, TMR_SELECT_CHANNEL_1, capture + ch1_val);
151 }
152 else if(tmr_interrupt_flag_get(TMR2, TMR_C2_FLAG) != RESET)
153 {
154 tmr_flag_clear(TMR2, TMR_C2_FLAG);
155
156 /* Pin PC.06 toggling with frequency = 73.24 Hz */
157 gpio_bits_write(GPIOC, GPIO_PINS_7, (confirm_state)(1 - gpio_output_data_bit_read(GPIOC, GPIO_PINS_7)));
158 capture = tmr_channel_value_get(TMR2, TMR_SELECT_CHANNEL_2);
159 tmr_channel_value_set(TMR2, TMR_SELECT_CHANNEL_2, capture + ch2_val);
160 }
161 else if(tmr_interrupt_flag_get(TMR2, TMR_C3_FLAG) != RESET)
162 {
163 tmr_flag_clear(TMR2, TMR_C3_FLAG);
164
165 /* Pin PC.06 toggling with frequency = 73.24 Hz */
166 gpio_bits_write(GPIOC, GPIO_PINS_8, (confirm_state)(1 - gpio_output_data_bit_read(GPIOC, GPIO_PINS_8)));
167 capture = tmr_channel_value_get(TMR2, TMR_SELECT_CHANNEL_3);
168 tmr_channel_value_set(TMR2, TMR_SELECT_CHANNEL_3, capture + ch3_val);
169 }
170 else
171 {
172 tmr_flag_clear(TMR2, TMR_C4_FLAG);
173
174 /* Pin PC.06 toggling with frequency = 73.24 Hz */
175 gpio_bits_write(GPIOC, GPIO_PINS_9, (confirm_state)(1 - gpio_output_data_bit_read(GPIOC, GPIO_PINS_9)));
176 capture = tmr_channel_value_get(TMR2, TMR_SELECT_CHANNEL_4);
177 tmr_channel_value_set(TMR2, TMR_SELECT_CHANNEL_4, capture + ch4_val);
178 }
179}
180
ch4_val
__IO uint16_t ch4_val
Definition project/at_start_f413/examples/tmr/oc_high/src/main.c:42
ch3_val
__IO uint16_t ch3_val
Definition project/at_start_f413/examples/tmr/oc_high/src/main.c:41
ch1_val
__IO uint16_t ch1_val
Definition project/at_start_f413/examples/tmr/oc_high/src/main.c:39
ch2_val
__IO uint16_t ch2_val
Definition project/at_start_f413/examples/tmr/oc_high/src/main.c:40
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c:97
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c:58
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c:71
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c:110
TMR2_GLOBAL_IRQHandler
void TMR2_GLOBAL_IRQHandler(void)
Definition project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c:141
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c:128
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c:49
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c:84
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c:137
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c:119
capture
uint16_t capture
Definition project/at_start_f413/examples/tmr/pwm_output_simulate/src/at32f413_int.c:42
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
gpio_output_data_bit_read
flag_status gpio_output_data_bit_read(gpio_type *gpio_x, uint16_t pins)
read the specified output port pin.
Definition at32f413_gpio.c:255
gpio_bits_write
void gpio_bits_write(gpio_type *gpio_x, uint16_t pins, confirm_state bit_state)
set or clear the selected data port bit.
Definition at32f413_gpio.c:405
GPIO_PINS_6
#define GPIO_PINS_6
Definition at32f413_gpio.h:56
GPIO_PINS_7
#define GPIO_PINS_7
Definition at32f413_gpio.h:57
GPIO_PINS_9
#define GPIO_PINS_9
Definition at32f413_gpio.h:59
GPIO_PINS_8
#define GPIO_PINS_8
Definition at32f413_gpio.h:58
GPIOC
#define GPIOC
Definition at32f413_gpio.h:749
tmr_channel_value_get
uint32_t tmr_channel_value_get(tmr_type *tmr_x, tmr_channel_select_type tmr_channel)
get tmr channel value
Definition at32f413_tmr.c:551
tmr_flag_clear
void tmr_flag_clear(tmr_type *tmr_x, uint32_t tmr_flag)
clear tmr flag
Definition at32f413_tmr.c:1433
tmr_interrupt_flag_get
flag_status tmr_interrupt_flag_get(tmr_type *tmr_x, uint32_t tmr_flag)
get tmr interrupt flag
Definition at32f413_tmr.c:1357
tmr_channel_value_set
void tmr_channel_value_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, uint32_t tmr_channel_value)
set tmr channel value
Definition at32f413_tmr.c:506
TMR_SELECT_CHANNEL_3
@ TMR_SELECT_CHANNEL_3
Definition at32f413_tmr.h:219
TMR_SELECT_CHANNEL_1
@ TMR_SELECT_CHANNEL_1
Definition at32f413_tmr.h:215
TMR_SELECT_CHANNEL_4
@ TMR_SELECT_CHANNEL_4
Definition at32f413_tmr.h:221
TMR_SELECT_CHANNEL_2
@ TMR_SELECT_CHANNEL_2
Definition at32f413_tmr.h:217
TMR_C1_FLAG
#define TMR_C1_FLAG
Definition at32f413_tmr.h:52
TMR_C2_FLAG
#define TMR_C2_FLAG
Definition at32f413_tmr.h:53
TMR_C3_FLAG
#define TMR_C3_FLAG
Definition at32f413_tmr.h:54
TMR_C4_FLAG
#define TMR_C4_FLAG
Definition at32f413_tmr.h:55
TMR2
#define TMR2
Definition at32f413_tmr.h:832
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • tmr
  • pwm_output_simulate
  • src
project/at_start_f413/examples/tmr/pwm_output_simulate/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37 tmr_output_config_type tmr_oc_init_structure;
38
39uint16_t ch1_val = 40961;
40uint16_t ch2_val = 27309;
41uint16_t ch3_val = 13654;
42uint16_t ch4_val = 6826;
43uint16_t div_value = 0;
44
45void crm_configuration(void);
46void gpio_configuration(void);
47
53void gpio_configuration(void)
54{
55 gpio_init_type gpio_init_struct;
56
57 gpio_default_para_init(&gpio_init_struct);
58
59 gpio_init_struct.gpio_pins = GPIO_PINS_6 | GPIO_PINS_7 | GPIO_PINS_8 | GPIO_PINS_9;
60 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
61 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
62 gpio_init_struct.gpio_mode = GPIO_MODE_OUTPUT;
63 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
64 gpio_init(GPIOC, &gpio_init_struct);
65}
66
72void crm_configuration(void)
73{
74 /* tmr2 clock enable */
75 crm_periph_clock_enable(CRM_TMR2_PERIPH_CLOCK, TRUE);
76
77 /* gpioa gpiob clock enable */
78 crm_periph_clock_enable(CRM_GPIOC_PERIPH_CLOCK, TRUE);
79}
80
86int main(void)
87{
88 /* config nvic priority group */
89 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
90
91 system_clock_config();
92
93 /* peripheral clocks configuration */
94 crm_configuration();
95
96 /* nvic Configuration */
97 nvic_irq_enable(TMR2_GLOBAL_IRQn, 0, 0);
98
99 /* gpio configuration */
100 gpio_configuration();
101
102 /* compute the div value */
103 div_value = (uint16_t)(system_core_clock / 12000000) - 1;
104
105 /* tmr2 time base configuration */
106 tmr_base_init(TMR2, 65535, div_value);
107 tmr_cnt_dir_set(TMR2, TMR_COUNT_UP);
108 tmr_clock_source_div_set(TMR2, TMR_CLOCK_DIV1);
109
110 tmr_output_default_para_init(&tmr_oc_init_structure);
111 tmr_oc_init_structure.oc_mode = TMR_OUTPUT_CONTROL_OFF;
112 tmr_oc_init_structure.oc_idle_state = FALSE;
113 tmr_oc_init_structure.oc_polarity = TMR_OUTPUT_ACTIVE_HIGH;
114 tmr_oc_init_structure.oc_output_state = TRUE;
115 tmr_output_channel_config(TMR2, TMR_SELECT_CHANNEL_1, &tmr_oc_init_structure);
116 tmr_channel_value_set(TMR2, TMR_SELECT_CHANNEL_1, ch1_val);
117
118 tmr_output_channel_config(TMR2, TMR_SELECT_CHANNEL_2, &tmr_oc_init_structure);
119 tmr_channel_value_set(TMR2, TMR_SELECT_CHANNEL_2, ch2_val);
120
121 tmr_output_channel_config(TMR2, TMR_SELECT_CHANNEL_3, &tmr_oc_init_structure);
122 tmr_channel_value_set(TMR2, TMR_SELECT_CHANNEL_3, ch3_val);
123
124 tmr_output_channel_config(TMR2, TMR_SELECT_CHANNEL_4, &tmr_oc_init_structure);
125 tmr_channel_value_set(TMR2, TMR_SELECT_CHANNEL_4, ch4_val);
126
127 /* tmr2 int enable */
128 tmr_interrupt_enable(TMR2, TMR_C1_INT | TMR_C2_INT | TMR_C3_INT | TMR_C4_INT, TRUE);
129
130 /* tmr enable counter */
131 tmr_counter_enable(TMR2, TRUE);
132
133 while(1)
134 {
135 }
136}
137
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
ch4_val
uint16_t ch4_val
Definition project/at_start_f413/examples/tmr/pwm_output_simulate/src/main.c:42
ch3_val
uint16_t ch3_val
Definition project/at_start_f413/examples/tmr/pwm_output_simulate/src/main.c:41
ch1_val
uint16_t ch1_val
Definition project/at_start_f413/examples/tmr/pwm_output_simulate/src/main.c:39
main
int main(void)
main function.
Definition project/at_start_f413/examples/tmr/pwm_output_simulate/src/main.c:86
ch2_val
uint16_t ch2_val
Definition project/at_start_f413/examples/tmr/pwm_output_simulate/src/main.c:40
gpio_configuration
void gpio_configuration(void)
configure the tmr1 pins.
Definition project/at_start_f413/examples/tmr/pwm_output_simulate/src/main.c:53
tmr_oc_init_structure
tmr_output_config_type tmr_oc_init_structure
Definition project/at_start_f413/examples/tmr/pwm_output_simulate/src/main.c:37
crm_configuration
void crm_configuration(void)
configures the different peripheral clocks.
Definition project/at_start_f413/examples/tmr/pwm_output_simulate/src/main.c:72
div_value
uint16_t div_value
Definition project/at_start_f413/examples/tmr/pwm_output_simulate/src/main.c:43
system_core_clock
unsigned int system_core_clock
Definition system_at32f413.c:47
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOC_PERIPH_CLOCK
@ CRM_GPIOC_PERIPH_CLOCK
Definition at32f413_crm.h:111
CRM_TMR2_PERIPH_CLOCK
@ CRM_TMR2_PERIPH_CLOCK
Definition at32f413_crm.h:125
TMR2_GLOBAL_IRQn
@ TMR2_GLOBAL_IRQn
Definition at32f413.h:200
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_OUTPUT
@ GPIO_MODE_OUTPUT
Definition at32f413_gpio.h:214
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_6
#define GPIO_PINS_6
Definition at32f413_gpio.h:56
GPIO_PINS_7
#define GPIO_PINS_7
Definition at32f413_gpio.h:57
GPIO_PINS_9
#define GPIO_PINS_9
Definition at32f413_gpio.h:59
GPIO_PINS_8
#define GPIO_PINS_8
Definition at32f413_gpio.h:58
GPIOC
#define GPIOC
Definition at32f413_gpio.h:749
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
tmr_counter_enable
void tmr_counter_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr counter
Definition at32f413_tmr.c:114
tmr_output_channel_config
void tmr_output_channel_config(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_output_config_type *tmr_output_struct)
config tmr output channel
Definition at32f413_tmr.c:318
tmr_clock_source_div_set
void tmr_clock_source_div_set(tmr_type *tmr_x, tmr_clock_division_type tmr_clock_div)
set tmr clock source division
Definition at32f413_tmr.c:204
tmr_output_default_para_init
void tmr_output_default_para_init(tmr_output_config_type *tmr_output_struct)
init tmr output default para
Definition at32f413_tmr.c:126
tmr_base_init
void tmr_base_init(tmr_type *tmr_x, uint32_t tmr_pr, uint32_t tmr_div)
init tmr base
Definition at32f413_tmr.c:179
tmr_interrupt_enable
void tmr_interrupt_enable(tmr_type *tmr_x, uint32_t tmr_interrupt, confirm_state new_state)
enable or disable tmr interrupt
Definition at32f413_tmr.c:1327
tmr_cnt_dir_set
void tmr_cnt_dir_set(tmr_type *tmr_x, tmr_count_mode_type tmr_cnt_dir)
set tmr counter count direction
Definition at32f413_tmr.c:225
tmr_channel_value_set
void tmr_channel_value_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, uint32_t tmr_channel_value)
set tmr channel value
Definition at32f413_tmr.c:506
TMR_COUNT_UP
@ TMR_COUNT_UP
Definition at32f413_tmr.h:105
TMR_SELECT_CHANNEL_3
@ TMR_SELECT_CHANNEL_3
Definition at32f413_tmr.h:219
TMR_SELECT_CHANNEL_1
@ TMR_SELECT_CHANNEL_1
Definition at32f413_tmr.h:215
TMR_SELECT_CHANNEL_4
@ TMR_SELECT_CHANNEL_4
Definition at32f413_tmr.h:221
TMR_SELECT_CHANNEL_2
@ TMR_SELECT_CHANNEL_2
Definition at32f413_tmr.h:217
TMR_CLOCK_DIV1
@ TMR_CLOCK_DIV1
Definition at32f413_tmr.h:95
TMR_OUTPUT_CONTROL_OFF
@ TMR_OUTPUT_CONTROL_OFF
Definition at32f413_tmr.h:172
TMR_OUTPUT_ACTIVE_HIGH
@ TMR_OUTPUT_ACTIVE_HIGH
Definition at32f413_tmr.h:196
TMR_C3_INT
#define TMR_C3_INT
Definition at32f413_tmr.h:76
TMR_C4_INT
#define TMR_C4_INT
Definition at32f413_tmr.h:77
TMR_C1_INT
#define TMR_C1_INT
Definition at32f413_tmr.h:74
TMR_C2_INT
#define TMR_C2_INT
Definition at32f413_tmr.h:75
TMR2
#define TMR2
Definition at32f413_tmr.h:832
at32f413_clock.h
header file of clock program
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
tmr_output_config_type
tmr output config type
Definition at32f413_tmr.h:397
tmr_output_config_type::oc_idle_state
confirm_state oc_idle_state
Definition at32f413_tmr.h:399
tmr_output_config_type::oc_output_state
confirm_state oc_output_state
Definition at32f413_tmr.h:403
tmr_output_config_type::oc_mode
tmr_output_control_mode_type oc_mode
Definition at32f413_tmr.h:398
tmr_output_config_type::oc_polarity
tmr_output_polarity_type oc_polarity
Definition at32f413_tmr.h:401


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • tmr
  • pwm_output_tmr3
  • inc
project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • tmr
  • pwm_output_tmr3
  • inc
project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • tmr
  • pwm_output_tmr3
  • inc
project/at_start_f413/examples/tmr/pwm_output_tmr3/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • tmr
  • pwm_output_tmr3
  • src
project/at_start_f413/examples/tmr/pwm_output_tmr3/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/tmr/pwm_output_tmr3/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • tmr
  • pwm_output_tmr3
  • src
project/at_start_f413/examples/tmr/pwm_output_tmr3/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/tmr/pwm_output_tmr3/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/tmr/pwm_output_tmr3/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/tmr/pwm_output_tmr3/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/tmr/pwm_output_tmr3/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/tmr/pwm_output_tmr3/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/tmr/pwm_output_tmr3/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/tmr/pwm_output_tmr3/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/tmr/pwm_output_tmr3/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/tmr/pwm_output_tmr3/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • tmr
  • pwm_output_tmr3
  • src
project/at_start_f413/examples/tmr/pwm_output_tmr3/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37 tmr_output_config_type tmr_oc_init_structure;
38
39uint16_t ch1_val = 333;
40uint16_t ch2_val = 249;
41uint16_t ch3_val = 166;
42uint16_t ch4_val = 83;
43uint16_t div_value = 0;
44
45void crm_configuration(void);
46void gpio_configuration(void);
47
53void gpio_configuration(void)
54{
55 gpio_init_type gpio_init_struct;
56
57 gpio_default_para_init(&gpio_init_struct);
58
59 gpio_init_struct.gpio_pins = GPIO_PINS_6 | GPIO_PINS_7;
60 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
61 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
62 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
63 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
64 gpio_init(GPIOA, &gpio_init_struct);
65
66 gpio_init_struct.gpio_pins = GPIO_PINS_0 | GPIO_PINS_1;
67 gpio_init(GPIOB, &gpio_init_struct);
68}
69
75void crm_configuration(void)
76{
77 /* tmr3 clock enable */
78 crm_periph_clock_enable(CRM_TMR3_PERIPH_CLOCK, TRUE);
79
80 /* gpioa gpiob clock enable */
81 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
82 crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
83}
84
90int main(void)
91{
92 system_clock_config();
93
94 /* peripheral clocks configuration */
95 crm_configuration();
96
97 /* gpio configuration */
98 gpio_configuration();
99
100 /* compute the div value */
101 div_value = (uint16_t)(system_core_clock / 24000000) - 1;
102
103 /* tmr3 time base configuration */
104 tmr_base_init(TMR3, 665, div_value);
105 tmr_cnt_dir_set(TMR3, TMR_COUNT_UP);
106 tmr_clock_source_div_set(TMR3, TMR_CLOCK_DIV1);
107
108 tmr_output_default_para_init(&tmr_oc_init_structure);
109 tmr_oc_init_structure.oc_mode = TMR_OUTPUT_CONTROL_PWM_MODE_A;
110 tmr_oc_init_structure.oc_idle_state = FALSE;
111 tmr_oc_init_structure.oc_polarity = TMR_OUTPUT_ACTIVE_HIGH;
112 tmr_oc_init_structure.oc_output_state = TRUE;
113 tmr_output_channel_config(TMR3, TMR_SELECT_CHANNEL_1, &tmr_oc_init_structure);
114 tmr_channel_value_set(TMR3, TMR_SELECT_CHANNEL_1, ch1_val);
115 tmr_output_channel_buffer_enable(TMR3, TMR_SELECT_CHANNEL_1, TRUE);
116
117 tmr_output_channel_config(TMR3, TMR_SELECT_CHANNEL_2, &tmr_oc_init_structure);
118 tmr_channel_value_set(TMR3, TMR_SELECT_CHANNEL_2, ch2_val);
119 tmr_output_channel_buffer_enable(TMR3, TMR_SELECT_CHANNEL_2, TRUE);
120
121 tmr_output_channel_config(TMR3, TMR_SELECT_CHANNEL_3, &tmr_oc_init_structure);
122 tmr_channel_value_set(TMR3, TMR_SELECT_CHANNEL_3, ch3_val);
123 tmr_output_channel_buffer_enable(TMR3, TMR_SELECT_CHANNEL_3, TRUE);
124
125 tmr_output_channel_config(TMR3, TMR_SELECT_CHANNEL_4, &tmr_oc_init_structure);
126 tmr_channel_value_set(TMR3, TMR_SELECT_CHANNEL_4, ch4_val);
127 tmr_output_channel_buffer_enable(TMR3, TMR_SELECT_CHANNEL_4, TRUE);
128
129 tmr_period_buffer_enable(TMR3, TRUE);
130
131 /* tmr enable counter */
132 tmr_counter_enable(TMR3, TRUE);
133
134 while(1)
135 {
136 }
137}
138
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
ch4_val
uint16_t ch4_val
Definition project/at_start_f413/examples/tmr/pwm_output_tmr3/src/main.c:42
ch3_val
uint16_t ch3_val
Definition project/at_start_f413/examples/tmr/pwm_output_tmr3/src/main.c:41
ch1_val
uint16_t ch1_val
Definition project/at_start_f413/examples/tmr/pwm_output_tmr3/src/main.c:39
main
int main(void)
main function.
Definition project/at_start_f413/examples/tmr/pwm_output_tmr3/src/main.c:90
ch2_val
uint16_t ch2_val
Definition project/at_start_f413/examples/tmr/pwm_output_tmr3/src/main.c:40
gpio_configuration
void gpio_configuration(void)
configure the tmr3 pins.
Definition project/at_start_f413/examples/tmr/pwm_output_tmr3/src/main.c:53
tmr_oc_init_structure
tmr_output_config_type tmr_oc_init_structure
Definition project/at_start_f413/examples/tmr/pwm_output_tmr3/src/main.c:37
crm_configuration
void crm_configuration(void)
configures the different peripheral clocks.
Definition project/at_start_f413/examples/tmr/pwm_output_tmr3/src/main.c:75
div_value
uint16_t div_value
Definition project/at_start_f413/examples/tmr/pwm_output_tmr3/src/main.c:43
system_core_clock
unsigned int system_core_clock
Definition system_at32f413.c:47
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_TMR3_PERIPH_CLOCK
@ CRM_TMR3_PERIPH_CLOCK
Definition at32f413_crm.h:126
CRM_GPIOB_PERIPH_CLOCK
@ CRM_GPIOB_PERIPH_CLOCK
Definition at32f413_crm.h:110
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_6
#define GPIO_PINS_6
Definition at32f413_gpio.h:56
GPIO_PINS_0
#define GPIO_PINS_0
Definition at32f413_gpio.h:50
GPIO_PINS_7
#define GPIO_PINS_7
Definition at32f413_gpio.h:57
GPIO_PINS_1
#define GPIO_PINS_1
Definition at32f413_gpio.h:51
GPIOB
#define GPIOB
Definition at32f413_gpio.h:748
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
tmr_period_buffer_enable
void tmr_period_buffer_enable(tmr_type *tmr_x, confirm_state new_state)
enable tmr period buffer
Definition at32f413_tmr.c:592
tmr_counter_enable
void tmr_counter_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr counter
Definition at32f413_tmr.c:114
tmr_output_channel_config
void tmr_output_channel_config(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_output_config_type *tmr_output_struct)
config tmr output channel
Definition at32f413_tmr.c:318
tmr_clock_source_div_set
void tmr_clock_source_div_set(tmr_type *tmr_x, tmr_clock_division_type tmr_clock_div)
set tmr clock source division
Definition at32f413_tmr.c:204
tmr_output_default_para_init
void tmr_output_default_para_init(tmr_output_config_type *tmr_output_struct)
init tmr output default para
Definition at32f413_tmr.c:126
tmr_base_init
void tmr_base_init(tmr_type *tmr_x, uint32_t tmr_pr, uint32_t tmr_div)
init tmr base
Definition at32f413_tmr.c:179
tmr_output_channel_buffer_enable
void tmr_output_channel_buffer_enable(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, confirm_state new_state)
enable tmr output channel buffer
Definition at32f413_tmr.c:613
tmr_cnt_dir_set
void tmr_cnt_dir_set(tmr_type *tmr_x, tmr_count_mode_type tmr_cnt_dir)
set tmr counter count direction
Definition at32f413_tmr.c:225
tmr_channel_value_set
void tmr_channel_value_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, uint32_t tmr_channel_value)
set tmr channel value
Definition at32f413_tmr.c:506
TMR_COUNT_UP
@ TMR_COUNT_UP
Definition at32f413_tmr.h:105
TMR_SELECT_CHANNEL_3
@ TMR_SELECT_CHANNEL_3
Definition at32f413_tmr.h:219
TMR_SELECT_CHANNEL_1
@ TMR_SELECT_CHANNEL_1
Definition at32f413_tmr.h:215
TMR_SELECT_CHANNEL_4
@ TMR_SELECT_CHANNEL_4
Definition at32f413_tmr.h:221
TMR_SELECT_CHANNEL_2
@ TMR_SELECT_CHANNEL_2
Definition at32f413_tmr.h:217
TMR_CLOCK_DIV1
@ TMR_CLOCK_DIV1
Definition at32f413_tmr.h:95
TMR_OUTPUT_CONTROL_PWM_MODE_A
@ TMR_OUTPUT_CONTROL_PWM_MODE_A
Definition at32f413_tmr.h:178
TMR_OUTPUT_ACTIVE_HIGH
@ TMR_OUTPUT_ACTIVE_HIGH
Definition at32f413_tmr.h:196
TMR3
#define TMR3
Definition at32f413_tmr.h:833
at32f413_clock.h
header file of clock program
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
tmr_output_config_type
tmr output config type
Definition at32f413_tmr.h:397
tmr_output_config_type::oc_idle_state
confirm_state oc_idle_state
Definition at32f413_tmr.h:399
tmr_output_config_type::oc_output_state
confirm_state oc_output_state
Definition at32f413_tmr.h:403
tmr_output_config_type::oc_mode
tmr_output_control_mode_type oc_mode
Definition at32f413_tmr.h:398
tmr_output_config_type::oc_polarity
tmr_output_polarity_type oc_polarity
Definition at32f413_tmr.h:401


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • tmr
  • pwm_output_tmr10
  • inc
project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • tmr
  • pwm_output_tmr10
  • inc
project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • tmr
  • pwm_output_tmr10
  • inc
project/at_start_f413/examples/tmr/pwm_output_tmr10/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • tmr
  • pwm_output_tmr10
  • src
project/at_start_f413/examples/tmr/pwm_output_tmr10/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/tmr/pwm_output_tmr10/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • tmr
  • pwm_output_tmr10
  • src
project/at_start_f413/examples/tmr/pwm_output_tmr10/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/tmr/pwm_output_tmr10/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/tmr/pwm_output_tmr10/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/tmr/pwm_output_tmr10/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/tmr/pwm_output_tmr10/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/tmr/pwm_output_tmr10/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/tmr/pwm_output_tmr10/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/tmr/pwm_output_tmr10/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/tmr/pwm_output_tmr10/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/tmr/pwm_output_tmr10/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • tmr
  • pwm_output_tmr10
  • src
project/at_start_f413/examples/tmr/pwm_output_tmr10/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37 tmr_output_config_type tmr_oc_init_structure;
38
39uint16_t ch1_val = 250;
40uint16_t div_value = 0;
41
42void crm_configuration(void);
43void gpio_configuration(void);
44
50void gpio_configuration(void)
51{
52 gpio_init_type gpio_init_struct;
53
54 gpio_default_para_init(&gpio_init_struct);
55
56 gpio_init_struct.gpio_pins = GPIO_PINS_8;
57 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
58 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
59 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
60 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
61 gpio_init(GPIOB, &gpio_init_struct);
62}
63
69void crm_configuration(void)
70{
71 /* tmr10 clock enable */
72 crm_periph_clock_enable(CRM_TMR10_PERIPH_CLOCK, TRUE);
73
74 /* gpioa gpiob clock enable */
75 crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
76}
77
83int main(void)
84{
85 system_clock_config();
86
87 /* peripheral clocks configuration */
88 crm_configuration();
89
90 /* gpio configuration */
91 gpio_configuration();
92
93 /* compute the div value */
94 div_value = (uint16_t)(system_core_clock / 10000000) - 1;
95
96 /* tmr10 time base configuration */
97 tmr_base_init(TMR10, 499, div_value);
98 tmr_cnt_dir_set(TMR10, TMR_COUNT_UP);
99 tmr_clock_source_div_set(TMR10, TMR_CLOCK_DIV1);
100
101 tmr_output_default_para_init(&tmr_oc_init_structure);
102 tmr_oc_init_structure.oc_mode = TMR_OUTPUT_CONTROL_PWM_MODE_A;
103 tmr_oc_init_structure.oc_idle_state = FALSE;
104 tmr_oc_init_structure.oc_polarity = TMR_OUTPUT_ACTIVE_HIGH;
105 tmr_oc_init_structure.oc_output_state = TRUE;
106 tmr_output_channel_config(TMR10, TMR_SELECT_CHANNEL_1, &tmr_oc_init_structure);
107 tmr_channel_value_set(TMR10, TMR_SELECT_CHANNEL_1, ch1_val);
108 tmr_output_channel_buffer_enable(TMR10, TMR_SELECT_CHANNEL_1, TRUE);
109
110 tmr_period_buffer_enable(TMR10, TRUE);
111
112 /* tmr enable counter */
113 tmr_counter_enable(TMR10, TRUE);
114
115 while(1)
116 {
117 }
118}
119
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
ch1_val
uint16_t ch1_val
Definition project/at_start_f413/examples/tmr/pwm_output_tmr10/src/main.c:39
main
int main(void)
main function.
Definition project/at_start_f413/examples/tmr/pwm_output_tmr10/src/main.c:83
gpio_configuration
void gpio_configuration(void)
configure the tmr1 pins.
Definition project/at_start_f413/examples/tmr/pwm_output_tmr10/src/main.c:50
tmr_oc_init_structure
tmr_output_config_type tmr_oc_init_structure
Definition project/at_start_f413/examples/tmr/pwm_output_tmr10/src/main.c:37
crm_configuration
void crm_configuration(void)
configures the different peripheral clocks.
Definition project/at_start_f413/examples/tmr/pwm_output_tmr10/src/main.c:69
div_value
uint16_t div_value
Definition project/at_start_f413/examples/tmr/pwm_output_tmr10/src/main.c:40
system_core_clock
unsigned int system_core_clock
Definition system_at32f413.c:47
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_TMR10_PERIPH_CLOCK
@ CRM_TMR10_PERIPH_CLOCK
Definition at32f413_crm.h:121
CRM_GPIOB_PERIPH_CLOCK
@ CRM_GPIOB_PERIPH_CLOCK
Definition at32f413_crm.h:110
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_8
#define GPIO_PINS_8
Definition at32f413_gpio.h:58
GPIOB
#define GPIOB
Definition at32f413_gpio.h:748
tmr_period_buffer_enable
void tmr_period_buffer_enable(tmr_type *tmr_x, confirm_state new_state)
enable tmr period buffer
Definition at32f413_tmr.c:592
tmr_counter_enable
void tmr_counter_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr counter
Definition at32f413_tmr.c:114
tmr_output_channel_config
void tmr_output_channel_config(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_output_config_type *tmr_output_struct)
config tmr output channel
Definition at32f413_tmr.c:318
tmr_clock_source_div_set
void tmr_clock_source_div_set(tmr_type *tmr_x, tmr_clock_division_type tmr_clock_div)
set tmr clock source division
Definition at32f413_tmr.c:204
tmr_output_default_para_init
void tmr_output_default_para_init(tmr_output_config_type *tmr_output_struct)
init tmr output default para
Definition at32f413_tmr.c:126
tmr_base_init
void tmr_base_init(tmr_type *tmr_x, uint32_t tmr_pr, uint32_t tmr_div)
init tmr base
Definition at32f413_tmr.c:179
tmr_output_channel_buffer_enable
void tmr_output_channel_buffer_enable(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, confirm_state new_state)
enable tmr output channel buffer
Definition at32f413_tmr.c:613
tmr_cnt_dir_set
void tmr_cnt_dir_set(tmr_type *tmr_x, tmr_count_mode_type tmr_cnt_dir)
set tmr counter count direction
Definition at32f413_tmr.c:225
tmr_channel_value_set
void tmr_channel_value_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, uint32_t tmr_channel_value)
set tmr channel value
Definition at32f413_tmr.c:506
TMR_COUNT_UP
@ TMR_COUNT_UP
Definition at32f413_tmr.h:105
TMR_SELECT_CHANNEL_1
@ TMR_SELECT_CHANNEL_1
Definition at32f413_tmr.h:215
TMR_CLOCK_DIV1
@ TMR_CLOCK_DIV1
Definition at32f413_tmr.h:95
TMR_OUTPUT_CONTROL_PWM_MODE_A
@ TMR_OUTPUT_CONTROL_PWM_MODE_A
Definition at32f413_tmr.h:178
TMR_OUTPUT_ACTIVE_HIGH
@ TMR_OUTPUT_ACTIVE_HIGH
Definition at32f413_tmr.h:196
at32f413_clock.h
header file of clock program
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
tmr_output_config_type
tmr output config type
Definition at32f413_tmr.h:397
tmr_output_config_type::oc_idle_state
confirm_state oc_idle_state
Definition at32f413_tmr.h:399
tmr_output_config_type::oc_output_state
confirm_state oc_output_state
Definition at32f413_tmr.h:403
tmr_output_config_type::oc_mode
tmr_output_control_mode_type oc_mode
Definition at32f413_tmr.h:398
tmr_output_config_type::oc_polarity
tmr_output_polarity_type oc_polarity
Definition at32f413_tmr.h:401


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • tmr
  • timer_base
  • inc
project/at_start_f413/examples/tmr/timer_base/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • tmr
  • timer_base
  • inc
project/at_start_f413/examples/tmr/timer_base/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • tmr
  • timer_base
  • inc
project/at_start_f413/examples/tmr/timer_base/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • tmr
  • timer_base
  • src
project/at_start_f413/examples/tmr/timer_base/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/tmr/timer_base/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • tmr
  • timer_base
  • src
project/at_start_f413/examples/tmr/timer_base/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/tmr/timer_base/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/tmr/timer_base/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/tmr/timer_base/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/tmr/timer_base/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/tmr/timer_base/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/tmr/timer_base/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/tmr/timer_base/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/tmr/timer_base/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/tmr/timer_base/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • tmr
  • timer_base
  • src
project/at_start_f413/examples/tmr/timer_base/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37 crm_clocks_freq_type crm_clocks_freq_struct = {0};
38
39void clkout_config(void)
40{
41 gpio_init_type gpio_init_struct;
42
43 /* enable gpio port clock */
44 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
45
46 /* set default parameter */
47 gpio_default_para_init(&gpio_init_struct);
48
49 /* clkout gpio init */
50 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
51 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
52 gpio_init_struct.gpio_pins = GPIO_PINS_8;
53 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
54 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
55 gpio_init(GPIOA, &gpio_init_struct);
56
57 /* config clkout division */
58 crm_clkout_div_set(CRM_CLKOUT_DIV_1);
59
60 /* config clkout clock */
61 crm_clock_out_set(CRM_CLKOUT_PLL_DIV_4);
62}
63
69void TMR1_OVF_TMR10_IRQHandler(void)
70{
71 if(tmr_interrupt_flag_get(TMR1, TMR_OVF_FLAG) != RESET)
72 {
73 /* add user code... */
74 at32_led_toggle(LED3);
75 tmr_flag_clear(TMR1, TMR_OVF_FLAG);
76 }
77}
78
84int main(void)
85{
86 system_clock_config();
87
88 at32_board_init();
89
90 /* get system clock */
91 crm_clocks_freq_get(&crm_clocks_freq_struct);
92
93 /* turn led2/led3/led4 on */
94 at32_led_on(LED2);
95 at32_led_on(LED3);
96 at32_led_on(LED4);
97
98 /* enable tmr1 clock */
99 crm_periph_clock_enable(CRM_TMR1_PERIPH_CLOCK, TRUE);
100
101 /* tmr1 configuration */
102 /* time base configuration */
103 /* systemclock/19200/10000 = 1hz */
104 tmr_base_init(TMR1, 9999, (crm_clocks_freq_struct.ahb_freq / 10000) - 1);
105 tmr_cnt_dir_set(TMR1, TMR_COUNT_UP);
106
107 /* overflow interrupt enable */
108 tmr_interrupt_enable(TMR1, TMR_OVF_INT, TRUE);
109
110 /* tmr1 overflow interrupt nvic init */
111 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
112 nvic_irq_enable(TMR1_OVF_TMR10_IRQn, 0, 0);
113
114 /* enable tmr1 */
115 tmr_counter_enable(TMR1, TRUE);
116 clkout_config();
117
118 while(1)
119 {
120 }
121}
122
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
clkout_config
void clkout_config(void)
Definition project/at_start_f413/examples/tmr/timer_base/src/main.c:39
main
int main(void)
main function.
Definition project/at_start_f413/examples/tmr/timer_base/src/main.c:84
crm_clocks_freq_struct
crm_clocks_freq_type crm_clocks_freq_struct
Definition project/at_start_f413/examples/tmr/timer_base/src/main.c:37
TMR1_OVF_TMR10_IRQHandler
void TMR1_OVF_TMR10_IRQHandler(void)
this function handles timer1 overflow handler.
Definition project/at_start_f413/examples/tmr/timer_base/src/main.c:69
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_clkout_div_set
void crm_clkout_div_set(crm_clkout_div_type clkout_div)
set crm clkout division
Definition at32f413_crm.c:888
crm_clock_out_set
void crm_clock_out_set(crm_clkout_select_type clkout)
set crm clkout
Definition at32f413_crm.c:767
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_clocks_freq_get
void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
Definition at32f413_crm.c:660
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_TMR1_PERIPH_CLOCK
@ CRM_TMR1_PERIPH_CLOCK
Definition at32f413_crm.h:116
CRM_CLKOUT_DIV_1
@ CRM_CLKOUT_DIV_1
Definition at32f413_crm.h:419
CRM_CLKOUT_PLL_DIV_4
@ CRM_CLKOUT_PLL_DIV_4
Definition at32f413_crm.h:409
TMR1_OVF_TMR10_IRQn
@ TMR1_OVF_TMR10_IRQn
Definition at32f413.h:197
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_8
#define GPIO_PINS_8
Definition at32f413_gpio.h:58
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
tmr_flag_clear
void tmr_flag_clear(tmr_type *tmr_x, uint32_t tmr_flag)
clear tmr flag
Definition at32f413_tmr.c:1433
tmr_counter_enable
void tmr_counter_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr counter
Definition at32f413_tmr.c:114
tmr_interrupt_flag_get
flag_status tmr_interrupt_flag_get(tmr_type *tmr_x, uint32_t tmr_flag)
get tmr interrupt flag
Definition at32f413_tmr.c:1357
tmr_base_init
void tmr_base_init(tmr_type *tmr_x, uint32_t tmr_pr, uint32_t tmr_div)
init tmr base
Definition at32f413_tmr.c:179
tmr_interrupt_enable
void tmr_interrupt_enable(tmr_type *tmr_x, uint32_t tmr_interrupt, confirm_state new_state)
enable or disable tmr interrupt
Definition at32f413_tmr.c:1327
tmr_cnt_dir_set
void tmr_cnt_dir_set(tmr_type *tmr_x, tmr_count_mode_type tmr_cnt_dir)
set tmr counter count direction
Definition at32f413_tmr.c:225
TMR_COUNT_UP
@ TMR_COUNT_UP
Definition at32f413_tmr.h:105
TMR_OVF_FLAG
#define TMR_OVF_FLAG
Definition at32f413_tmr.h:51
TMR_OVF_INT
#define TMR_OVF_INT
Definition at32f413_tmr.h:73
TMR1
#define TMR1
Definition at32f413_tmr.h:831
at32f413_clock.h
header file of clock program
crm_clocks_freq_type
crm clocks freqency structure
Definition at32f413_crm.h:470
crm_clocks_freq_type::ahb_freq
uint32_t ahb_freq
Definition at32f413_crm.h:472
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • tmr
  • tmr1_synchro
  • inc
project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • tmr
  • tmr1_synchro
  • inc
project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • tmr
  • tmr1_synchro
  • inc
project/at_start_f413/examples/tmr/tmr1_synchro/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • tmr
  • tmr1_synchro
  • src
project/at_start_f413/examples/tmr/tmr1_synchro/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/tmr/tmr1_synchro/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • tmr
  • tmr1_synchro
  • src
project/at_start_f413/examples/tmr/tmr1_synchro/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/tmr/tmr1_synchro/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/tmr/tmr1_synchro/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/tmr/tmr1_synchro/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/tmr/tmr1_synchro/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/tmr/tmr1_synchro/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/tmr/tmr1_synchro/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/tmr/tmr1_synchro/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/tmr/tmr1_synchro/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/tmr/tmr1_synchro/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • tmr
  • tmr1_synchro
  • src
project/at_start_f413/examples/tmr/tmr1_synchro/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37 tmr_output_config_type tmr_oc_init_structure;
38
39void crm_configuration(void);
40void gpio_configuration(void);
41
47void gpio_configuration(void)
48{
49 gpio_init_type gpio_init_struct;
50
51 gpio_default_para_init(&gpio_init_struct);
52
53 gpio_init_struct.gpio_pins = GPIO_PINS_6 | GPIO_PINS_8;
54 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
55 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
56 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
57 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
58 gpio_init(GPIOA, &gpio_init_struct);
59
60 gpio_init_struct.gpio_pins = GPIO_PINS_6;
61 gpio_init(GPIOB, &gpio_init_struct);
62}
63
69void crm_configuration(void)
70{
71 /* tmr clock enable */
72 crm_periph_clock_enable(CRM_TMR1_PERIPH_CLOCK, TRUE);
73 crm_periph_clock_enable(CRM_TMR3_PERIPH_CLOCK, TRUE);
74 crm_periph_clock_enable(CRM_TMR4_PERIPH_CLOCK, TRUE);
75
76 /* gpio clock enable */
77 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
78 crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
79}
80
86int main(void)
87{
88 system_clock_config();
89
90 /* peripheral clocks configuration */
91 crm_configuration();
92
93 /* gpio configuration */
94 gpio_configuration();
95
96 /* tmr3 time base configuration */
97 tmr_base_init(TMR3, 2, 0);
98 tmr_cnt_dir_set(TMR3, TMR_COUNT_UP);
99 tmr_clock_source_div_set(TMR3, TMR_CLOCK_DIV1);
100
101 tmr_output_default_para_init(&tmr_oc_init_structure);
102 tmr_oc_init_structure.oc_mode = TMR_OUTPUT_CONTROL_PWM_MODE_A;
103 tmr_oc_init_structure.oc_idle_state = FALSE;
104 tmr_oc_init_structure.oc_polarity = TMR_OUTPUT_ACTIVE_HIGH;
105 tmr_oc_init_structure.oc_output_state = TRUE;
106 tmr_output_channel_config(TMR3, TMR_SELECT_CHANNEL_1, &tmr_oc_init_structure);
107 tmr_channel_value_set(TMR3, TMR_SELECT_CHANNEL_1, 1);
108
109 /* input trigger selection */
110 tmr_trigger_input_select(TMR3, TMR_SUB_INPUT_SEL_IS0);
111
112 /* slave mode selection: hang mode */
113 tmr_sub_mode_select(TMR3, TMR_SUB_HANG_MODE);
114
115 /* tmr4 time base configuration */
116 tmr_base_init(TMR4, 1, 0);
117 tmr_cnt_dir_set(TMR4, TMR_COUNT_UP);
118 tmr_clock_source_div_set(TMR4, TMR_CLOCK_DIV1);
119
120 tmr_output_default_para_init(&tmr_oc_init_structure);
121 tmr_oc_init_structure.oc_mode = TMR_OUTPUT_CONTROL_PWM_MODE_A;
122 tmr_oc_init_structure.oc_idle_state = FALSE;
123 tmr_oc_init_structure.oc_polarity = TMR_OUTPUT_ACTIVE_HIGH;
124 tmr_oc_init_structure.oc_output_state = TRUE;
125 tmr_output_channel_config(TMR4, TMR_SELECT_CHANNEL_1, &tmr_oc_init_structure);
126 tmr_channel_value_set(TMR4, TMR_SELECT_CHANNEL_1, 1);
127
128 /* input trigger selection */
129 tmr_trigger_input_select(TMR4, TMR_SUB_INPUT_SEL_IS0);
130
131 /* slave mode selection: hang mode */
132 tmr_sub_mode_select(TMR4, TMR_SUB_HANG_MODE);
133
134 /* tmr1 time base configuration */
135 tmr_repetition_counter_set(TMR1, 4);
136 tmr_base_init(TMR1, 191, 0);
137 tmr_cnt_dir_set(TMR1, TMR_COUNT_UP);
138 tmr_clock_source_div_set(TMR1, TMR_CLOCK_DIV1);
139
140 tmr_output_default_para_init(&tmr_oc_init_structure);
141 tmr_oc_init_structure.oc_mode = TMR_OUTPUT_CONTROL_PWM_MODE_B;
142 tmr_oc_init_structure.oc_idle_state = TRUE;
143 tmr_oc_init_structure.occ_idle_state = FALSE;
144 tmr_oc_init_structure.oc_polarity = TMR_OUTPUT_ACTIVE_LOW;
145 tmr_oc_init_structure.occ_polarity = TMR_OUTPUT_ACTIVE_LOW;
146 tmr_oc_init_structure.oc_output_state = TRUE;
147 tmr_oc_init_structure.occ_output_state = TRUE;
148 tmr_output_channel_config(TMR1, TMR_SELECT_CHANNEL_1, &tmr_oc_init_structure);
149 tmr_channel_value_set(TMR1, TMR_SELECT_CHANNEL_1, 96);
150
151 tmr_primary_mode_select(TMR1, TMR_PRIMARY_SEL_OVERFLOW);
152 tmr_sub_sync_mode_set(TMR1, TRUE);
153
154 tmr_output_enable(TMR1, TRUE);
155
156 /* tmr enable counter */
157 tmr_counter_enable(TMR1, TRUE);
158 tmr_counter_enable(TMR3, TRUE);
159 tmr_counter_enable(TMR4, TRUE);
160
161 while(1)
162 {
163 }
164}
165
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
main
int main(void)
main function.
Definition project/at_start_f413/examples/tmr/tmr1_synchro/src/main.c:86
gpio_configuration
void gpio_configuration(void)
configure the tmr1 pins.
Definition project/at_start_f413/examples/tmr/tmr1_synchro/src/main.c:47
tmr_oc_init_structure
tmr_output_config_type tmr_oc_init_structure
Definition project/at_start_f413/examples/tmr/tmr1_synchro/src/main.c:37
crm_configuration
void crm_configuration(void)
configures the different peripheral clocks.
Definition project/at_start_f413/examples/tmr/tmr1_synchro/src/main.c:69
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_TMR4_PERIPH_CLOCK
@ CRM_TMR4_PERIPH_CLOCK
Definition at32f413_crm.h:127
CRM_TMR3_PERIPH_CLOCK
@ CRM_TMR3_PERIPH_CLOCK
Definition at32f413_crm.h:126
CRM_GPIOB_PERIPH_CLOCK
@ CRM_GPIOB_PERIPH_CLOCK
Definition at32f413_crm.h:110
CRM_TMR1_PERIPH_CLOCK
@ CRM_TMR1_PERIPH_CLOCK
Definition at32f413_crm.h:116
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_6
#define GPIO_PINS_6
Definition at32f413_gpio.h:56
GPIO_PINS_8
#define GPIO_PINS_8
Definition at32f413_gpio.h:58
GPIOB
#define GPIOB
Definition at32f413_gpio.h:748
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
tmr_repetition_counter_set
void tmr_repetition_counter_set(tmr_type *tmr_x, uint8_t tmr_rpr_value)
set the repetition counter register(rpr) value
Definition at32f413_tmr.c:239
tmr_counter_enable
void tmr_counter_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr counter
Definition at32f413_tmr.c:114
tmr_output_channel_config
void tmr_output_channel_config(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_output_config_type *tmr_output_struct)
config tmr output channel
Definition at32f413_tmr.c:318
tmr_clock_source_div_set
void tmr_clock_source_div_set(tmr_type *tmr_x, tmr_clock_division_type tmr_clock_div)
set tmr clock source division
Definition at32f413_tmr.c:204
tmr_sub_mode_select
void tmr_sub_mode_select(tmr_type *tmr_x, tmr_sub_mode_select_type sub_mode)
select tmr subordinate mode
Definition at32f413_tmr.c:1196
tmr_output_default_para_init
void tmr_output_default_para_init(tmr_output_config_type *tmr_output_struct)
init tmr output default para
Definition at32f413_tmr.c:126
tmr_output_enable
void tmr_output_enable(tmr_type *tmr_x, confirm_state new_state)
tmr output enable(oen),this function is important for advtm output enable
Definition at32f413_tmr.c:1469
tmr_sub_sync_mode_set
void tmr_sub_sync_mode_set(tmr_type *tmr_x, confirm_state new_state)
set tmr subordinate synchronization mode
Definition at32f413_tmr.c:1273
tmr_base_init
void tmr_base_init(tmr_type *tmr_x, uint32_t tmr_pr, uint32_t tmr_div)
init tmr base
Definition at32f413_tmr.c:179
tmr_trigger_input_select
void tmr_trigger_input_select(tmr_type *tmr_x, sub_tmr_input_sel_type trigger_select)
select tmr sub-trigger
Definition at32f413_tmr.c:1260
tmr_primary_mode_select
void tmr_primary_mode_select(tmr_type *tmr_x, tmr_primary_select_type primary_mode)
select tmr primary mode
Definition at32f413_tmr.c:1174
tmr_cnt_dir_set
void tmr_cnt_dir_set(tmr_type *tmr_x, tmr_count_mode_type tmr_cnt_dir)
set tmr counter count direction
Definition at32f413_tmr.c:225
tmr_channel_value_set
void tmr_channel_value_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, uint32_t tmr_channel_value)
set tmr channel value
Definition at32f413_tmr.c:506
TMR_COUNT_UP
@ TMR_COUNT_UP
Definition at32f413_tmr.h:105
TMR_SELECT_CHANNEL_1
@ TMR_SELECT_CHANNEL_1
Definition at32f413_tmr.h:215
TMR_CLOCK_DIV1
@ TMR_CLOCK_DIV1
Definition at32f413_tmr.h:95
TMR_OUTPUT_CONTROL_PWM_MODE_B
@ TMR_OUTPUT_CONTROL_PWM_MODE_B
Definition at32f413_tmr.h:179
TMR_OUTPUT_CONTROL_PWM_MODE_A
@ TMR_OUTPUT_CONTROL_PWM_MODE_A
Definition at32f413_tmr.h:178
TMR_OUTPUT_ACTIVE_HIGH
@ TMR_OUTPUT_ACTIVE_HIGH
Definition at32f413_tmr.h:196
TMR_OUTPUT_ACTIVE_LOW
@ TMR_OUTPUT_ACTIVE_LOW
Definition at32f413_tmr.h:197
TMR_SUB_INPUT_SEL_IS0
@ TMR_SUB_INPUT_SEL_IS0
Definition at32f413_tmr.h:132
TMR_SUB_HANG_MODE
@ TMR_SUB_HANG_MODE
Definition at32f413_tmr.h:152
TMR_PRIMARY_SEL_OVERFLOW
@ TMR_PRIMARY_SEL_OVERFLOW
Definition at32f413_tmr.h:119
TMR3
#define TMR3
Definition at32f413_tmr.h:833
TMR1
#define TMR1
Definition at32f413_tmr.h:831
TMR4
#define TMR4
Definition at32f413_tmr.h:834
at32f413_clock.h
header file of clock program
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
tmr_output_config_type
tmr output config type
Definition at32f413_tmr.h:397
tmr_output_config_type::occ_output_state
confirm_state occ_output_state
Definition at32f413_tmr.h:404
tmr_output_config_type::oc_idle_state
confirm_state oc_idle_state
Definition at32f413_tmr.h:399
tmr_output_config_type::oc_output_state
confirm_state oc_output_state
Definition at32f413_tmr.h:403
tmr_output_config_type::oc_mode
tmr_output_control_mode_type oc_mode
Definition at32f413_tmr.h:398
tmr_output_config_type::occ_polarity
tmr_output_polarity_type occ_polarity
Definition at32f413_tmr.h:402
tmr_output_config_type::occ_idle_state
confirm_state occ_idle_state
Definition at32f413_tmr.h:400
tmr_output_config_type::oc_polarity
tmr_output_polarity_type oc_polarity
Definition at32f413_tmr.h:401


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • tmr
  • tmr2_32bit
  • inc
project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • tmr
  • tmr2_32bit
  • inc
project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • tmr
  • tmr2_32bit
  • inc
project/at_start_f413/examples/tmr/tmr2_32bit/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • tmr
  • tmr2_32bit
  • src
project/at_start_f413/examples/tmr/tmr2_32bit/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/tmr/tmr2_32bit/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • tmr
  • tmr2_32bit
  • src
project/at_start_f413/examples/tmr/tmr2_32bit/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/tmr/tmr2_32bit/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/tmr/tmr2_32bit/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/tmr/tmr2_32bit/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/tmr/tmr2_32bit/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/tmr/tmr2_32bit/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/tmr/tmr2_32bit/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/tmr/tmr2_32bit/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/tmr/tmr2_32bit/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/tmr/tmr2_32bit/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • tmr
  • tmr2_32bit
  • src
project/at_start_f413/examples/tmr/tmr2_32bit/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37 tmr_output_config_type tmr_oc_init_structure;
38
39uint32_t ch1_val = 0x7FFFF;
40uint32_t ch2_val = 0x3FFFF;
41uint32_t ch3_val = 0x1FFFF;
42uint32_t ch4_val = 0xFFFF;
43
44void crm_configuration(void);
45void gpio_configuration(void);
46
52void gpio_configuration(void)
53{
54 gpio_init_type gpio_init_struct;
55
56 gpio_default_para_init(&gpio_init_struct);
57
58 gpio_init_struct.gpio_pins = GPIO_PINS_0 | GPIO_PINS_1 | GPIO_PINS_2 | GPIO_PINS_3;
59 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
60 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
61 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
62 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
63 gpio_init(GPIOA, &gpio_init_struct);
64}
65
71void crm_configuration(void)
72{
73 /* tmr clock enable */
74 crm_periph_clock_enable(CRM_TMR2_PERIPH_CLOCK, TRUE);
75
76 /* gpio clock enable */
77 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
78}
79
85int main(void)
86{
87 system_clock_config();
88
89 /* peripheral clocks configuration */
90 crm_configuration();
91
92 /* gpio configuration */
93 gpio_configuration();
94
95 tmr_32_bit_function_enable(TMR2, TRUE);
96
97 /* tmr2 time base configuration */
98 tmr_base_init(TMR2, 0xFFFFF, 0);
99 tmr_cnt_dir_set(TMR2, TMR_COUNT_UP);
100 tmr_clock_source_div_set(TMR2, TMR_CLOCK_DIV1);
101
102 tmr_output_default_para_init(&tmr_oc_init_structure);
103 tmr_oc_init_structure.oc_mode = TMR_OUTPUT_CONTROL_PWM_MODE_A;
104 tmr_oc_init_structure.oc_idle_state = FALSE;
105 tmr_oc_init_structure.oc_polarity = TMR_OUTPUT_ACTIVE_HIGH;
106 tmr_oc_init_structure.oc_output_state = TRUE;
107 tmr_output_channel_config(TMR2, TMR_SELECT_CHANNEL_1, &tmr_oc_init_structure);
108 tmr_channel_value_set(TMR2, TMR_SELECT_CHANNEL_1, ch1_val);
109 tmr_output_channel_buffer_enable(TMR2, TMR_SELECT_CHANNEL_1, TRUE);
110
111 tmr_output_channel_config(TMR2, TMR_SELECT_CHANNEL_2, &tmr_oc_init_structure);
112 tmr_channel_value_set(TMR2, TMR_SELECT_CHANNEL_2, ch2_val);
113 tmr_output_channel_buffer_enable(TMR2, TMR_SELECT_CHANNEL_2, TRUE);
114
115 tmr_output_channel_config(TMR2, TMR_SELECT_CHANNEL_3, &tmr_oc_init_structure);
116 tmr_channel_value_set(TMR2, TMR_SELECT_CHANNEL_3, ch3_val);
117 tmr_output_channel_buffer_enable(TMR2, TMR_SELECT_CHANNEL_3, TRUE);
118
119 tmr_output_channel_config(TMR2, TMR_SELECT_CHANNEL_4, &tmr_oc_init_structure);
120 tmr_channel_value_set(TMR2, TMR_SELECT_CHANNEL_4, ch4_val);
121 tmr_output_channel_buffer_enable(TMR2, TMR_SELECT_CHANNEL_4, TRUE);
122
123 tmr_period_buffer_enable(TMR2, TRUE);
124
125 /* tmr2 enable counter */
126 tmr_counter_enable(TMR2, TRUE);
127
128 while(1)
129 {
130 }
131}
132
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
ch1_val
uint32_t ch1_val
Definition project/at_start_f413/examples/tmr/tmr2_32bit/src/main.c:39
ch2_val
uint32_t ch2_val
Definition project/at_start_f413/examples/tmr/tmr2_32bit/src/main.c:40
ch4_val
uint32_t ch4_val
Definition project/at_start_f413/examples/tmr/tmr2_32bit/src/main.c:42
main
int main(void)
main function.
Definition project/at_start_f413/examples/tmr/tmr2_32bit/src/main.c:85
gpio_configuration
void gpio_configuration(void)
configure the tmr1 pins.
Definition project/at_start_f413/examples/tmr/tmr2_32bit/src/main.c:52
tmr_oc_init_structure
tmr_output_config_type tmr_oc_init_structure
Definition project/at_start_f413/examples/tmr/tmr2_32bit/src/main.c:37
crm_configuration
void crm_configuration(void)
configures the different peripheral clocks.
Definition project/at_start_f413/examples/tmr/tmr2_32bit/src/main.c:71
ch3_val
uint32_t ch3_val
Definition project/at_start_f413/examples/tmr/tmr2_32bit/src/main.c:41
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_TMR2_PERIPH_CLOCK
@ CRM_TMR2_PERIPH_CLOCK
Definition at32f413_crm.h:125
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_0
#define GPIO_PINS_0
Definition at32f413_gpio.h:50
GPIO_PINS_2
#define GPIO_PINS_2
Definition at32f413_gpio.h:52
GPIO_PINS_3
#define GPIO_PINS_3
Definition at32f413_gpio.h:53
GPIO_PINS_1
#define GPIO_PINS_1
Definition at32f413_gpio.h:51
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
tmr_period_buffer_enable
void tmr_period_buffer_enable(tmr_type *tmr_x, confirm_state new_state)
enable tmr period buffer
Definition at32f413_tmr.c:592
tmr_counter_enable
void tmr_counter_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr counter
Definition at32f413_tmr.c:114
tmr_output_channel_config
void tmr_output_channel_config(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_output_config_type *tmr_output_struct)
config tmr output channel
Definition at32f413_tmr.c:318
tmr_clock_source_div_set
void tmr_clock_source_div_set(tmr_type *tmr_x, tmr_clock_division_type tmr_clock_div)
set tmr clock source division
Definition at32f413_tmr.c:204
tmr_output_default_para_init
void tmr_output_default_para_init(tmr_output_config_type *tmr_output_struct)
init tmr output default para
Definition at32f413_tmr.c:126
tmr_base_init
void tmr_base_init(tmr_type *tmr_x, uint32_t tmr_pr, uint32_t tmr_div)
init tmr base
Definition at32f413_tmr.c:179
tmr_32_bit_function_enable
void tmr_32_bit_function_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr 32 bit function(plus mode)
Definition at32f413_tmr.c:758
tmr_output_channel_buffer_enable
void tmr_output_channel_buffer_enable(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, confirm_state new_state)
enable tmr output channel buffer
Definition at32f413_tmr.c:613
tmr_cnt_dir_set
void tmr_cnt_dir_set(tmr_type *tmr_x, tmr_count_mode_type tmr_cnt_dir)
set tmr counter count direction
Definition at32f413_tmr.c:225
tmr_channel_value_set
void tmr_channel_value_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, uint32_t tmr_channel_value)
set tmr channel value
Definition at32f413_tmr.c:506
TMR_COUNT_UP
@ TMR_COUNT_UP
Definition at32f413_tmr.h:105
TMR_SELECT_CHANNEL_3
@ TMR_SELECT_CHANNEL_3
Definition at32f413_tmr.h:219
TMR_SELECT_CHANNEL_1
@ TMR_SELECT_CHANNEL_1
Definition at32f413_tmr.h:215
TMR_SELECT_CHANNEL_4
@ TMR_SELECT_CHANNEL_4
Definition at32f413_tmr.h:221
TMR_SELECT_CHANNEL_2
@ TMR_SELECT_CHANNEL_2
Definition at32f413_tmr.h:217
TMR_CLOCK_DIV1
@ TMR_CLOCK_DIV1
Definition at32f413_tmr.h:95
TMR_OUTPUT_CONTROL_PWM_MODE_A
@ TMR_OUTPUT_CONTROL_PWM_MODE_A
Definition at32f413_tmr.h:178
TMR_OUTPUT_ACTIVE_HIGH
@ TMR_OUTPUT_ACTIVE_HIGH
Definition at32f413_tmr.h:196
TMR2
#define TMR2
Definition at32f413_tmr.h:832
at32f413_clock.h
header file of clock program
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
tmr_output_config_type
tmr output config type
Definition at32f413_tmr.h:397
tmr_output_config_type::oc_idle_state
confirm_state oc_idle_state
Definition at32f413_tmr.h:399
tmr_output_config_type::oc_output_state
confirm_state oc_output_state
Definition at32f413_tmr.h:403
tmr_output_config_type::oc_mode
tmr_output_control_mode_type oc_mode
Definition at32f413_tmr.h:398
tmr_output_config_type::oc_polarity
tmr_output_polarity_type oc_polarity
Definition at32f413_tmr.h:401


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • tmr
  • 6_steps
  • inc
project/at_start_f413/examples/tmr/6_steps/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • tmr
  • 6_steps
  • inc
project/at_start_f413/examples/tmr/6_steps/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • tmr
  • 6_steps
  • inc
project/at_start_f413/examples/tmr/6_steps/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • tmr
  • 6_steps
  • src
project/at_start_f413/examples/tmr/6_steps/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/tmr/6_steps/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • tmr
  • 6_steps
  • src
project/at_start_f413/examples/tmr/6_steps/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132 /* trigger TMR1 hall event */
133 tmr_event_sw_trigger(TMR1, TMR_HALL_SWTRIG);
134}
135
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/tmr/6_steps/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/tmr/6_steps/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/tmr/6_steps/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/tmr/6_steps/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/tmr/6_steps/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/tmr/6_steps/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/tmr/6_steps/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/tmr/6_steps/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/tmr/6_steps/src/at32f413_int.c:112
tmr_event_sw_trigger
void tmr_event_sw_trigger(tmr_type *tmr_x, tmr_event_trigger_type tmr_event)
generate tmr event
Definition at32f413_tmr.c:1456
TMR_HALL_SWTRIG
@ TMR_HALL_SWTRIG
Definition at32f413_tmr.h:287
TMR1
#define TMR1
Definition at32f413_tmr.h:831
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • tmr
  • 6_steps
  • src
project/at_start_f413/examples/tmr/6_steps/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37 gpio_init_type gpio_init_struct = {0};
38 tmr_output_config_type tmr_output_struct;
39 tmr_brkdt_config_type tmr_brkdt_config_struct = {0};
40 crm_clocks_freq_type crm_clocks_freq_struct = {0};
41
42__IO uint32_t step = 1;
43
44/* systick configuration */
45void systick_configuration(void);
46
52int main(void)
53{
54 system_clock_config();
55
56 at32_board_init();
57
58 /* get system clock */
59 crm_clocks_freq_get(&crm_clocks_freq_struct);
60
61 systick_configuration();
62
63 /* turn led2/led3/led4 on */
64 at32_led_on(LED2);
65 at32_led_on(LED3);
66 at32_led_on(LED4);
67
68 /* enable tmr1/gpioa/gpiob clock */
69 crm_periph_clock_enable(CRM_TMR1_PERIPH_CLOCK, TRUE);
70 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
71 crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
72
73 /* timer2 output pin Configuration */
74 gpio_init_struct.gpio_pins = GPIO_PINS_8 | GPIO_PINS_9 | GPIO_PINS_10;
75 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
76 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
77 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
78 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
79 gpio_init(GPIOA, &gpio_init_struct);
80
81 gpio_init_struct.gpio_pins = GPIO_PINS_13 | GPIO_PINS_14 | GPIO_PINS_15;
82 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
83 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
84 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
85 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
86 gpio_init(GPIOB, &gpio_init_struct);
87
88 gpio_init_struct.gpio_pins = GPIO_PINS_12;
89 gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
90 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
91 gpio_init_struct.gpio_pull = GPIO_PULL_DOWN;
92 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
93 gpio_init(GPIOB, &gpio_init_struct);
94
95 /*
96 the tmr1 peripheral offers the possibility to program in advance the
97 configuration for the next tmr1 outputs behaviour (step) and change the configuration
98 of all the channels at the same time. this operation is possible when the hall
99 event is used.
100 the hall event can be generated by software by setting the hall bit in the tmr1_swevt
101 register or by hardware (on trc rising edge).
102 in this example, a software hall event is generated each 100 ms: using the systick
103 interrupt.
104 the tmr1 is configured in timing mode, each time a hall event occurs,
105 a new tmr1 configuration will be set in advance.
106 the following table describes the tmr1 channels states:
107 -----------------------------------------------
108 | step1 | step2 | step3 | step4 | step5 | step6 |
109 ----------------------------------------------------------
110 |channel1 | 1 | 0 | 0 | 0 | 0 | 1 |
111 ----------------------------------------------------------
112 |channel1n | 0 | 0 | 1 | 1 | 0 | 0 |
113 ----------------------------------------------------------
114 |channel2 | 0 | 0 | 0 | 1 | 1 | 0 |
115 ----------------------------------------------------------
116 |channel2n | 1 | 1 | 0 | 0 | 0 | 0 |
117 ----------------------------------------------------------
118 |channel3 | 0 | 1 | 1 | 0 | 0 | 0 |
119 ----------------------------------------------------------
120 |channel3n | 0 | 0 | 0 | 0 | 1 | 1 |
121 ----------------------------------------------------------
122 */
123 /* tmr1 configuration */
124 /* time base configuration */
125 tmr_base_init(TMR1, 4095, 0);
126 tmr_cnt_dir_set(TMR1, TMR_COUNT_UP);
127
128 /* channel 1, 2 and 3 configuration in output mode */
129 tmr_output_default_para_init(&tmr_output_struct);
130 tmr_output_struct.oc_mode = TMR_OUTPUT_CONTROL_OFF;
131 tmr_output_struct.oc_output_state = TRUE;
132 tmr_output_struct.oc_polarity = TMR_OUTPUT_ACTIVE_HIGH;
133 tmr_output_struct.oc_idle_state = TRUE;
134 tmr_output_struct.occ_output_state = TRUE;
135 tmr_output_struct.occ_polarity = TMR_OUTPUT_ACTIVE_HIGH;
136 tmr_output_struct.occ_idle_state = TRUE;
137
138 /* channel 1 */
139 tmr_output_channel_config(TMR1, TMR_SELECT_CHANNEL_1, &tmr_output_struct);
140 tmr_channel_value_set(TMR1, TMR_SELECT_CHANNEL_1, 2047);
141
142 /* channel 2 */
143 tmr_output_channel_config(TMR1, TMR_SELECT_CHANNEL_2, &tmr_output_struct);
144 tmr_channel_value_set(TMR1, TMR_SELECT_CHANNEL_2, 1023);
145
146 /* channel 3 */
147 tmr_output_channel_config(TMR1, TMR_SELECT_CHANNEL_3, &tmr_output_struct);
148 tmr_channel_value_set(TMR1, TMR_SELECT_CHANNEL_3, 511);
149
150 /* automatic output enable, brake, dead time and lock configuration */
151 tmr_brkdt_default_para_init(&tmr_brkdt_config_struct);
152 tmr_brkdt_config_struct.brk_enable = TRUE;
153 tmr_brkdt_config_struct.auto_output_enable = TRUE;
154 tmr_brkdt_config_struct.deadtime = 0;
155 tmr_brkdt_config_struct.fcsodis_state = TRUE;
156 tmr_brkdt_config_struct.fcsoen_state = TRUE;
157 tmr_brkdt_config_struct.brk_polarity = TMR_BRK_INPUT_ACTIVE_HIGH;
158 tmr_brkdt_config_struct.wp_level = TMR_WP_OFF;
159 tmr_brkdt_config(TMR1, &tmr_brkdt_config_struct);
160 tmr_channel_buffer_enable(TMR1, TRUE);
161
162 /* hall interrupt enable */
163 tmr_interrupt_enable(TMR1, TMR_HALL_INT, TRUE);
164
165 /* tmr1 hall interrupt nvic init */
166 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
167 nvic_irq_enable(TMR1_TRG_HALL_TMR11_IRQn, 0, 0);
168
169 /* tmr1 output enable */
170 tmr_output_enable(TMR1, TRUE);
171
172 /* enable tmr1 */
173 tmr_counter_enable(TMR1, TRUE);
174
175 while(1)
176 {
177 }
178}
184void systick_configuration(void)
185{
186 /* setup systick timer for 20 msec interrupts */
187 if(SysTick_Config((crm_clocks_freq_struct.sclk_freq) / 50))
188 {
189 /* capture error */
190 while(1);
191 }
192 NVIC_SetPriority(SysTick_IRQn, 0x0);
193}
194
201void TMR1_TRG_HALL_TMR11_IRQHandler(void)
202{
203 /* clear tmr1 com pending bit */
204 tmr_flag_clear(TMR1, TMR_HALL_FLAG);
205 if(step == 1)
206 {
207 /* next step: step 2 configuration ---------------------------- */
208 /* channel3 configuration */
209 tmr_channel_enable(TMR1, TMR_SELECT_CHANNEL_3, FALSE);
210 tmr_channel_enable(TMR1, TMR_SELECT_CHANNEL_3C, FALSE);
211
212 /* channel1 configuration */
213 tmr_output_channel_mode_select(TMR1, TMR_SELECT_CHANNEL_1, TMR_OUTPUT_CONTROL_PWM_MODE_A);
214 tmr_channel_enable(TMR1, TMR_SELECT_CHANNEL_1, TRUE);
215 tmr_channel_enable(TMR1, TMR_SELECT_CHANNEL_1C, FALSE);
216
217 /* channel2 configuration */
218 tmr_output_channel_mode_select(TMR1, TMR_SELECT_CHANNEL_2, TMR_OUTPUT_CONTROL_PWM_MODE_A);
219 tmr_channel_enable(TMR1, TMR_SELECT_CHANNEL_2, FALSE);
220 tmr_channel_enable(TMR1, TMR_SELECT_CHANNEL_2C, TRUE);
221 step++;
222 }
223 else if(step == 2)
224 {
225 /* next step: step 3 configuration ---------------------------- */
226 /* channel2 configuration */
227 tmr_output_channel_mode_select(TMR1, TMR_SELECT_CHANNEL_2, TMR_OUTPUT_CONTROL_PWM_MODE_A);
228 tmr_channel_enable(TMR1, TMR_SELECT_CHANNEL_2, FALSE);
229 tmr_channel_enable(TMR1, TMR_SELECT_CHANNEL_2C, TRUE);
230
231 /* channel3 configuration */
232 tmr_output_channel_mode_select(TMR1, TMR_SELECT_CHANNEL_3, TMR_OUTPUT_CONTROL_PWM_MODE_A);
233 tmr_channel_enable(TMR1, TMR_SELECT_CHANNEL_3, TRUE);
234 tmr_channel_enable(TMR1, TMR_SELECT_CHANNEL_3C, FALSE);
235
236 /* channel1 configuration */
237 tmr_channel_enable(TMR1, TMR_SELECT_CHANNEL_1, FALSE);
238 tmr_channel_enable(TMR1, TMR_SELECT_CHANNEL_1C, FALSE);
239 step++;
240 }
241 else if(step == 3)
242 {
243 /* next step: step 4 configuration ---------------------------- */
244 /* channel3 configuration */
245 tmr_output_channel_mode_select(TMR1, TMR_SELECT_CHANNEL_3, TMR_OUTPUT_CONTROL_PWM_MODE_A);
246 tmr_channel_enable(TMR1, TMR_SELECT_CHANNEL_3, TRUE);
247 tmr_channel_enable(TMR1, TMR_SELECT_CHANNEL_3C, FALSE);
248
249 /* channel2 configuration */
250 tmr_channel_enable(TMR1, TMR_SELECT_CHANNEL_2, FALSE);
251 tmr_channel_enable(TMR1, TMR_SELECT_CHANNEL_2C, FALSE);
252
253 /* channel1 configuration */
254 tmr_output_channel_mode_select(TMR1, TMR_SELECT_CHANNEL_1, TMR_OUTPUT_CONTROL_PWM_MODE_A);
255 tmr_channel_enable(TMR1, TMR_SELECT_CHANNEL_1, FALSE);
256 tmr_channel_enable(TMR1, TMR_SELECT_CHANNEL_1C, TRUE);
257 step++;
258 }
259 else if(step == 4)
260 {
261 /* next step: step 5 configuration ---------------------------- */
262 /* channel3 configuration */
263 tmr_channel_enable(TMR1, TMR_SELECT_CHANNEL_3, FALSE);
264 tmr_channel_enable(TMR1, TMR_SELECT_CHANNEL_3C, FALSE);
265
266 /* channel1 configuration */
267 tmr_output_channel_mode_select(TMR1, TMR_SELECT_CHANNEL_1, TMR_OUTPUT_CONTROL_PWM_MODE_A);
268 tmr_channel_enable(TMR1, TMR_SELECT_CHANNEL_1, FALSE);
269 tmr_channel_enable(TMR1, TMR_SELECT_CHANNEL_1C, TRUE);
270
271 /* channel2 configuration */
272 tmr_output_channel_mode_select(TMR1, TMR_SELECT_CHANNEL_2, TMR_OUTPUT_CONTROL_PWM_MODE_A);
273 tmr_channel_enable(TMR1, TMR_SELECT_CHANNEL_2, TRUE);
274 tmr_channel_enable(TMR1, TMR_SELECT_CHANNEL_2C, FALSE);
275 step++;
276 }
277 else if(step == 5)
278 {
279 /* next step: step 6 configuration ---------------------------- */
280 /* channel3 configuration */
281 tmr_output_channel_mode_select(TMR1, TMR_SELECT_CHANNEL_3, TMR_OUTPUT_CONTROL_PWM_MODE_A);
282 tmr_channel_enable(TMR1, TMR_SELECT_CHANNEL_3, FALSE);
283 tmr_channel_enable(TMR1, TMR_SELECT_CHANNEL_3C, TRUE);
284
285 /* channel1 configuration */
286 tmr_channel_enable(TMR1, TMR_SELECT_CHANNEL_1, FALSE);
287 tmr_channel_enable(TMR1, TMR_SELECT_CHANNEL_1C, FALSE);
288
289 /* channel2 configuration */
290 tmr_output_channel_mode_select(TMR1, TMR_SELECT_CHANNEL_2, TMR_OUTPUT_CONTROL_PWM_MODE_A);
291 tmr_channel_enable(TMR1, TMR_SELECT_CHANNEL_2, TRUE);
292 tmr_channel_enable(TMR1, TMR_SELECT_CHANNEL_2C, FALSE);
293 step++;
294 }
295 else
296 {
297 /* next step: step 1 configuration ---------------------------- */
298 /* channel1 configuration */
299 tmr_output_channel_mode_select(TMR1, TMR_SELECT_CHANNEL_1, TMR_OUTPUT_CONTROL_PWM_MODE_A);
300 tmr_channel_enable(TMR1, TMR_SELECT_CHANNEL_1, TRUE);
301 tmr_channel_enable(TMR1, TMR_SELECT_CHANNEL_1C, FALSE);
302
303 /* channel3 configuration */
304 tmr_output_channel_mode_select(TMR1, TMR_SELECT_CHANNEL_3, TMR_OUTPUT_CONTROL_PWM_MODE_A);
305 tmr_channel_enable(TMR1, TMR_SELECT_CHANNEL_3, FALSE);
306 tmr_channel_enable(TMR1, TMR_SELECT_CHANNEL_3C, TRUE);
307
308 /* channel2 configuration */
309 tmr_channel_enable(TMR1, TMR_SELECT_CHANNEL_2, FALSE);
310 tmr_channel_enable(TMR1, TMR_SELECT_CHANNEL_2C, FALSE);
311 step = 1;
312 }
313}
314
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/tmr/6_steps/src/main.c:37
tmr_output_struct
tmr_output_config_type tmr_output_struct
Definition project/at_start_f413/examples/tmr/6_steps/src/main.c:38
systick_configuration
void systick_configuration(void)
configures the systick.
Definition project/at_start_f413/examples/tmr/6_steps/src/main.c:184
main
int main(void)
main function.
Definition project/at_start_f413/examples/tmr/6_steps/src/main.c:52
crm_clocks_freq_struct
crm_clocks_freq_type crm_clocks_freq_struct
Definition project/at_start_f413/examples/tmr/6_steps/src/main.c:40
step
__IO uint32_t step
Definition project/at_start_f413/examples/tmr/6_steps/src/main.c:42
TMR1_TRG_HALL_TMR11_IRQHandler
void TMR1_TRG_HALL_TMR11_IRQHandler(void)
this function handles tmr1 trigger and hall interrupts requests.
Definition project/at_start_f413/examples/tmr/6_steps/src/main.c:201
tmr_brkdt_config_struct
tmr_brkdt_config_type tmr_brkdt_config_struct
Definition project/at_start_f413/examples/tmr/6_steps/src/main.c:39
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_clocks_freq_get
void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
Definition at32f413_crm.c:660
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_GPIOB_PERIPH_CLOCK
@ CRM_GPIOB_PERIPH_CLOCK
Definition at32f413_crm.h:110
CRM_TMR1_PERIPH_CLOCK
@ CRM_TMR1_PERIPH_CLOCK
Definition at32f413_crm.h:116
SysTick_IRQn
@ SysTick_IRQn
Definition at32f413.h:168
TMR1_TRG_HALL_TMR11_IRQn
@ TMR1_TRG_HALL_TMR11_IRQn
Definition at32f413.h:198
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_PULL_DOWN
@ GPIO_PULL_DOWN
Definition at32f413_gpio.h:245
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_10
#define GPIO_PINS_10
Definition at32f413_gpio.h:60
GPIO_PINS_13
#define GPIO_PINS_13
Definition at32f413_gpio.h:63
GPIO_PINS_12
#define GPIO_PINS_12
Definition at32f413_gpio.h:62
GPIO_PINS_14
#define GPIO_PINS_14
Definition at32f413_gpio.h:64
GPIO_PINS_9
#define GPIO_PINS_9
Definition at32f413_gpio.h:59
GPIO_PINS_8
#define GPIO_PINS_8
Definition at32f413_gpio.h:58
GPIO_PINS_15
#define GPIO_PINS_15
Definition at32f413_gpio.h:65
GPIOB
#define GPIOB
Definition at32f413_gpio.h:748
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
tmr_flag_clear
void tmr_flag_clear(tmr_type *tmr_x, uint32_t tmr_flag)
clear tmr flag
Definition at32f413_tmr.c:1433
tmr_channel_buffer_enable
void tmr_channel_buffer_enable(tmr_type *tmr_x, confirm_state new_state)
enable tmr channel buffer
Definition at32f413_tmr.c:1238
tmr_output_channel_mode_select
void tmr_output_channel_mode_select(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_output_control_mode_type oc_mode)
select tmr output channel mode
Definition at32f413_tmr.c:429
tmr_counter_enable
void tmr_counter_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr counter
Definition at32f413_tmr.c:114
tmr_output_channel_config
void tmr_output_channel_config(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_output_config_type *tmr_output_struct)
config tmr output channel
Definition at32f413_tmr.c:318
tmr_brkdt_default_para_init
void tmr_brkdt_default_para_init(tmr_brkdt_config_type *tmr_brkdt_struct)
init tmr brkdt default para
Definition at32f413_tmr.c:157
tmr_brkdt_config
void tmr_brkdt_config(tmr_type *tmr_x, tmr_brkdt_config_type *brkdt_struct)
config tmr brake mode and dead-time
Definition at32f413_tmr.c:1769
tmr_output_default_para_init
void tmr_output_default_para_init(tmr_output_config_type *tmr_output_struct)
init tmr output default para
Definition at32f413_tmr.c:126
tmr_output_enable
void tmr_output_enable(tmr_type *tmr_x, confirm_state new_state)
tmr output enable(oen),this function is important for advtm output enable
Definition at32f413_tmr.c:1469
tmr_base_init
void tmr_base_init(tmr_type *tmr_x, uint32_t tmr_pr, uint32_t tmr_div)
init tmr base
Definition at32f413_tmr.c:179
tmr_interrupt_enable
void tmr_interrupt_enable(tmr_type *tmr_x, uint32_t tmr_interrupt, confirm_state new_state)
enable or disable tmr interrupt
Definition at32f413_tmr.c:1327
tmr_cnt_dir_set
void tmr_cnt_dir_set(tmr_type *tmr_x, tmr_count_mode_type tmr_cnt_dir)
set tmr counter count direction
Definition at32f413_tmr.c:225
tmr_channel_enable
void tmr_channel_enable(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, confirm_state new_state)
tmr channel enable
Definition at32f413_tmr.c:888
tmr_channel_value_set
void tmr_channel_value_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, uint32_t tmr_channel_value)
set tmr channel value
Definition at32f413_tmr.c:506
TMR_COUNT_UP
@ TMR_COUNT_UP
Definition at32f413_tmr.h:105
TMR_SELECT_CHANNEL_1C
@ TMR_SELECT_CHANNEL_1C
Definition at32f413_tmr.h:216
TMR_SELECT_CHANNEL_3
@ TMR_SELECT_CHANNEL_3
Definition at32f413_tmr.h:219
TMR_SELECT_CHANNEL_1
@ TMR_SELECT_CHANNEL_1
Definition at32f413_tmr.h:215
TMR_SELECT_CHANNEL_2C
@ TMR_SELECT_CHANNEL_2C
Definition at32f413_tmr.h:218
TMR_SELECT_CHANNEL_2
@ TMR_SELECT_CHANNEL_2
Definition at32f413_tmr.h:217
TMR_SELECT_CHANNEL_3C
@ TMR_SELECT_CHANNEL_3C
Definition at32f413_tmr.h:220
TMR_WP_OFF
@ TMR_WP_OFF
Definition at32f413_tmr.h:387
TMR_BRK_INPUT_ACTIVE_HIGH
@ TMR_BRK_INPUT_ACTIVE_HIGH
Definition at32f413_tmr.h:379
TMR_OUTPUT_CONTROL_OFF
@ TMR_OUTPUT_CONTROL_OFF
Definition at32f413_tmr.h:172
TMR_OUTPUT_CONTROL_PWM_MODE_A
@ TMR_OUTPUT_CONTROL_PWM_MODE_A
Definition at32f413_tmr.h:178
TMR_OUTPUT_ACTIVE_HIGH
@ TMR_OUTPUT_ACTIVE_HIGH
Definition at32f413_tmr.h:196
TMR_HALL_FLAG
#define TMR_HALL_FLAG
Definition at32f413_tmr.h:56
TMR_HALL_INT
#define TMR_HALL_INT
Definition at32f413_tmr.h:78
TMR1
#define TMR1
Definition at32f413_tmr.h:831
at32f413_clock.h
header file of clock program
crm_clocks_freq_type
crm clocks freqency structure
Definition at32f413_crm.h:470
crm_clocks_freq_type::sclk_freq
uint32_t sclk_freq
Definition at32f413_crm.h:471
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
tmr_brkdt_config_type
tmr brkdt config type
Definition at32f413_tmr.h:422
tmr_brkdt_config_type::brk_enable
confirm_state brk_enable
Definition at32f413_tmr.h:429
tmr_brkdt_config_type::deadtime
uint8_t deadtime
Definition at32f413_tmr.h:423
tmr_brkdt_config_type::auto_output_enable
confirm_state auto_output_enable
Definition at32f413_tmr.h:426
tmr_brkdt_config_type::wp_level
tmr_wp_level_type wp_level
Definition at32f413_tmr.h:425
tmr_brkdt_config_type::fcsoen_state
confirm_state fcsoen_state
Definition at32f413_tmr.h:427
tmr_brkdt_config_type::fcsodis_state
confirm_state fcsodis_state
Definition at32f413_tmr.h:428
tmr_brkdt_config_type::brk_polarity
tmr_brk_polarity_type brk_polarity
Definition at32f413_tmr.h:424
tmr_output_config_type
tmr output config type
Definition at32f413_tmr.h:397
tmr_output_config_type::occ_output_state
confirm_state occ_output_state
Definition at32f413_tmr.h:404
tmr_output_config_type::oc_idle_state
confirm_state oc_idle_state
Definition at32f413_tmr.h:399
tmr_output_config_type::oc_output_state
confirm_state oc_output_state
Definition at32f413_tmr.h:403
tmr_output_config_type::oc_mode
tmr_output_control_mode_type oc_mode
Definition at32f413_tmr.h:398
tmr_output_config_type::occ_polarity
tmr_output_polarity_type occ_polarity
Definition at32f413_tmr.h:402
tmr_output_config_type::occ_idle_state
confirm_state occ_idle_state
Definition at32f413_tmr.h:400
tmr_output_config_type::oc_polarity
tmr_output_polarity_type oc_polarity
Definition at32f413_tmr.h:401


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • tmr
  • 7_pwm_output
  • inc
project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • tmr
  • 7_pwm_output
  • inc
project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • tmr
  • 7_pwm_output
  • inc
project/at_start_f413/examples/tmr/7_pwm_output/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • tmr
  • 7_pwm_output
  • src
project/at_start_f413/examples/tmr/7_pwm_output/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/tmr/7_pwm_output/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • tmr
  • 7_pwm_output
  • src
project/at_start_f413/examples/tmr/7_pwm_output/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/tmr/7_pwm_output/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/tmr/7_pwm_output/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/tmr/7_pwm_output/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/tmr/7_pwm_output/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/tmr/7_pwm_output/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/tmr/7_pwm_output/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/tmr/7_pwm_output/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/tmr/7_pwm_output/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/tmr/7_pwm_output/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • tmr
  • 7_pwm_output
  • src
project/at_start_f413/examples/tmr/7_pwm_output/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37 gpio_init_type gpio_init_struct = {0};
38 tmr_output_config_type tmr_output_struct;
39 crm_clocks_freq_type crm_clocks_freq_struct = {0};
40
41uint16_t timer_period = 0;
42uint16_t channel1_pulse = 0, channel2_pulse = 0, channel3_pulse = 0, channel4_pulse = 0;
43
49int main(void)
50{
51 system_clock_config();
52
53 at32_board_init();
54
55 /* get system clock */
56 crm_clocks_freq_get(&crm_clocks_freq_struct);
57
58 /* turn led2/led3/led4 on */
59 at32_led_on(LED2);
60 at32_led_on(LED3);
61 at32_led_on(LED4);
62
63 /* enable tmr1/gpioa/gpiob clock */
64 crm_periph_clock_enable(CRM_TMR1_PERIPH_CLOCK, TRUE);
65 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
66 crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
67
68 /* timer1 output pin Configuration */
69 gpio_init_struct.gpio_pins = GPIO_PINS_8 | GPIO_PINS_9 | GPIO_PINS_10 | GPIO_PINS_11;
70 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
71 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
72 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
73 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
74 gpio_init(GPIOA, &gpio_init_struct);
75
76 gpio_init_struct.gpio_pins = GPIO_PINS_13 | GPIO_PINS_14 | GPIO_PINS_15;
77 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
78 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
79 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
80 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
81 gpio_init(GPIOB, &gpio_init_struct);
82
83 gpio_init_struct.gpio_pins = GPIO_PINS_12;
84 gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
85 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
86 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
87 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
88 gpio_init(GPIOB, &gpio_init_struct);
89
90
91 /* tmr1 configuration generate 7 pwm signals with 4 different duty cycles:
92 prescaler = 0, tmr1 counter clock = system_core_clock
93
94 the objective is to generate 7 pwm signal at 17.57 khz:
95 - tim1_period = (system_core_clock / 17570) - 1
96 the channel 1 and channel 1n duty cycle is set to 50%
97 the channel 2 and channel 2n duty cycle is set to 37.5%
98 the channel 3 and channel 3n duty cycle is set to 25%
99 the channel 4 duty cycle is set to 12.5%
100 the timer pulse is calculated as follows:
101 - channelxpulse = duty_cycle * (tim1_period - 1) / 100 */
102
103 /* compute the value to be set in arr regiter to generate signal frequency at 17.57 khz */
104 timer_period = (crm_clocks_freq_struct.sclk_freq / 17570 ) - 1;
105
106 /* compute ccr1 value to generate a duty cycle at 50% for channel 1 and 1n */
107 channel1_pulse = (uint16_t)(((uint32_t) 5 * (timer_period - 1)) / 10);
108
109 /* compute ccr2 value to generate a duty cycle at 37.5% for channel 2 and 2n */
110 channel2_pulse = (uint16_t)(((uint32_t) 375 * (timer_period - 1)) / 1000);
111
112 /* compute ccr3 value to generate a duty cycle at 25% for channel 3 and 3n */
113 channel3_pulse = (uint16_t)(((uint32_t) 25 * (timer_period - 1)) / 100);
114
115 /* compute ccr4 value to generate a duty cycle at 12.5% for channel 4 */
116 channel4_pulse = (uint16_t)(((uint32_t) 125 * (timer_period- 1)) / 1000);
117
118 tmr_base_init(TMR1, timer_period, 0);
119 tmr_cnt_dir_set(TMR1, TMR_COUNT_UP);
120
121 /* channel 1, 2, 3 and 4 configuration in output mode */
122 tmr_output_default_para_init(&tmr_output_struct);
123 tmr_output_struct.oc_mode = TMR_OUTPUT_CONTROL_PWM_MODE_B;
124 tmr_output_struct.oc_output_state = TRUE;
125 tmr_output_struct.oc_polarity = TMR_OUTPUT_ACTIVE_LOW;
126 tmr_output_struct.oc_idle_state = TRUE;
127 tmr_output_struct.occ_output_state = TRUE;
128 tmr_output_struct.occ_polarity = TMR_OUTPUT_ACTIVE_HIGH;
129 tmr_output_struct.occ_idle_state = FALSE;
130
131 /* channel 1 */
132 tmr_output_channel_config(TMR1, TMR_SELECT_CHANNEL_1, &tmr_output_struct);
133 tmr_channel_value_set(TMR1, TMR_SELECT_CHANNEL_1, channel1_pulse);
134
135 /* channel 2 */
136 tmr_output_channel_config(TMR1, TMR_SELECT_CHANNEL_2, &tmr_output_struct);
137 tmr_channel_value_set(TMR1, TMR_SELECT_CHANNEL_2, channel2_pulse);
138
139 /* channel 3 */
140 tmr_output_channel_config(TMR1, TMR_SELECT_CHANNEL_3, &tmr_output_struct);
141 tmr_channel_value_set(TMR1, TMR_SELECT_CHANNEL_3, channel3_pulse);
142
143 /* channel 4 */
144 tmr_output_channel_config(TMR1, TMR_SELECT_CHANNEL_4, &tmr_output_struct);
145 tmr_channel_value_set(TMR1, TMR_SELECT_CHANNEL_4, channel4_pulse);
146
147 /* output enable */
148 tmr_output_enable(TMR1, TRUE);
149
150 /* enable tmr1 */
151 tmr_counter_enable(TMR1, TRUE);
152
153 while(1)
154 {
155 }
156}
157
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/tmr/7_pwm_output/src/main.c:37
channel1_pulse
uint16_t channel1_pulse
Definition project/at_start_f413/examples/tmr/7_pwm_output/src/main.c:42
tmr_output_struct
tmr_output_config_type tmr_output_struct
Definition project/at_start_f413/examples/tmr/7_pwm_output/src/main.c:38
timer_period
uint16_t timer_period
Definition project/at_start_f413/examples/tmr/7_pwm_output/src/main.c:41
channel2_pulse
uint16_t channel2_pulse
Definition project/at_start_f413/examples/tmr/7_pwm_output/src/main.c:42
channel3_pulse
uint16_t channel3_pulse
Definition project/at_start_f413/examples/tmr/7_pwm_output/src/main.c:42
main
int main(void)
main function.
Definition project/at_start_f413/examples/tmr/7_pwm_output/src/main.c:49
crm_clocks_freq_struct
crm_clocks_freq_type crm_clocks_freq_struct
Definition project/at_start_f413/examples/tmr/7_pwm_output/src/main.c:39
channel4_pulse
uint16_t channel4_pulse
Definition project/at_start_f413/examples/tmr/7_pwm_output/src/main.c:42
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_clocks_freq_get
void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
Definition at32f413_crm.c:660
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_GPIOB_PERIPH_CLOCK
@ CRM_GPIOB_PERIPH_CLOCK
Definition at32f413_crm.h:110
CRM_TMR1_PERIPH_CLOCK
@ CRM_TMR1_PERIPH_CLOCK
Definition at32f413_crm.h:116
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_10
#define GPIO_PINS_10
Definition at32f413_gpio.h:60
GPIO_PINS_11
#define GPIO_PINS_11
Definition at32f413_gpio.h:61
GPIO_PINS_13
#define GPIO_PINS_13
Definition at32f413_gpio.h:63
GPIO_PINS_12
#define GPIO_PINS_12
Definition at32f413_gpio.h:62
GPIO_PINS_14
#define GPIO_PINS_14
Definition at32f413_gpio.h:64
GPIO_PINS_9
#define GPIO_PINS_9
Definition at32f413_gpio.h:59
GPIO_PINS_8
#define GPIO_PINS_8
Definition at32f413_gpio.h:58
GPIO_PINS_15
#define GPIO_PINS_15
Definition at32f413_gpio.h:65
GPIOB
#define GPIOB
Definition at32f413_gpio.h:748
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
tmr_counter_enable
void tmr_counter_enable(tmr_type *tmr_x, confirm_state new_state)
enable or disable tmr counter
Definition at32f413_tmr.c:114
tmr_output_channel_config
void tmr_output_channel_config(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, tmr_output_config_type *tmr_output_struct)
config tmr output channel
Definition at32f413_tmr.c:318
tmr_output_default_para_init
void tmr_output_default_para_init(tmr_output_config_type *tmr_output_struct)
init tmr output default para
Definition at32f413_tmr.c:126
tmr_output_enable
void tmr_output_enable(tmr_type *tmr_x, confirm_state new_state)
tmr output enable(oen),this function is important for advtm output enable
Definition at32f413_tmr.c:1469
tmr_base_init
void tmr_base_init(tmr_type *tmr_x, uint32_t tmr_pr, uint32_t tmr_div)
init tmr base
Definition at32f413_tmr.c:179
tmr_cnt_dir_set
void tmr_cnt_dir_set(tmr_type *tmr_x, tmr_count_mode_type tmr_cnt_dir)
set tmr counter count direction
Definition at32f413_tmr.c:225
tmr_channel_value_set
void tmr_channel_value_set(tmr_type *tmr_x, tmr_channel_select_type tmr_channel, uint32_t tmr_channel_value)
set tmr channel value
Definition at32f413_tmr.c:506
TMR_COUNT_UP
@ TMR_COUNT_UP
Definition at32f413_tmr.h:105
TMR_SELECT_CHANNEL_3
@ TMR_SELECT_CHANNEL_3
Definition at32f413_tmr.h:219
TMR_SELECT_CHANNEL_1
@ TMR_SELECT_CHANNEL_1
Definition at32f413_tmr.h:215
TMR_SELECT_CHANNEL_4
@ TMR_SELECT_CHANNEL_4
Definition at32f413_tmr.h:221
TMR_SELECT_CHANNEL_2
@ TMR_SELECT_CHANNEL_2
Definition at32f413_tmr.h:217
TMR_OUTPUT_CONTROL_PWM_MODE_B
@ TMR_OUTPUT_CONTROL_PWM_MODE_B
Definition at32f413_tmr.h:179
TMR_OUTPUT_ACTIVE_HIGH
@ TMR_OUTPUT_ACTIVE_HIGH
Definition at32f413_tmr.h:196
TMR_OUTPUT_ACTIVE_LOW
@ TMR_OUTPUT_ACTIVE_LOW
Definition at32f413_tmr.h:197
TMR1
#define TMR1
Definition at32f413_tmr.h:831
at32f413_clock.h
header file of clock program
crm_clocks_freq_type
crm clocks freqency structure
Definition at32f413_crm.h:470
crm_clocks_freq_type::sclk_freq
uint32_t sclk_freq
Definition at32f413_crm.h:471
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
tmr_output_config_type
tmr output config type
Definition at32f413_tmr.h:397
tmr_output_config_type::occ_output_state
confirm_state occ_output_state
Definition at32f413_tmr.h:404
tmr_output_config_type::oc_idle_state
confirm_state oc_idle_state
Definition at32f413_tmr.h:399
tmr_output_config_type::oc_output_state
confirm_state oc_output_state
Definition at32f413_tmr.h:403
tmr_output_config_type::oc_mode
tmr_output_control_mode_type oc_mode
Definition at32f413_tmr.h:398
tmr_output_config_type::occ_polarity
tmr_output_polarity_type occ_polarity
Definition at32f413_tmr.h:402
tmr_output_config_type::occ_idle_state
confirm_state occ_idle_state
Definition at32f413_tmr.h:400
tmr_output_config_type::oc_polarity
tmr_output_polarity_type oc_polarity
Definition at32f413_tmr.h:401


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • usart
  • half_duplex
  • inc
project/at_start_f413/examples/usart/half_duplex/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • usart
  • half_duplex
  • inc
project/at_start_f413/examples/usart/half_duplex/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • usart
  • half_duplex
  • inc
project/at_start_f413/examples/usart/half_duplex/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • usart
  • half_duplex
  • src
project/at_start_f413/examples/usart/half_duplex/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/usart/half_duplex/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • usart
  • half_duplex
  • src
project/at_start_f413/examples/usart/half_duplex/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/usart/half_duplex/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/usart/half_duplex/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/usart/half_duplex/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/usart/half_duplex/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/usart/half_duplex/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/usart/half_duplex/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/usart/half_duplex/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/usart/half_duplex/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/usart/half_duplex/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • usart
  • half_duplex
  • src
project/at_start_f413/examples/usart/half_duplex/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37#define COUNTOF(a) (sizeof(a) / sizeof(*(a)))
38#define USART2_TX_BUFFER_SIZE (COUNTOF(usart2_tx_buffer) - 1)
39#define USART3_TX_BUFFER_SIZE (COUNTOF(usart3_tx_buffer) - 1)
40
41uint8_t usart2_tx_buffer[] = "usart half-duplex transfer: usart2 -> usart3";
42uint8_t usart3_tx_buffer[] = "usart half-duplex transfer: usart3 -> usart2";
43uint8_t usart2_rx_buffer[USART3_TX_BUFFER_SIZE];
44uint8_t usart3_rx_buffer[USART2_TX_BUFFER_SIZE];
45uint8_t data_count;
46
52void usart_configuration(void)
53{
54 gpio_init_type gpio_init_struct;
55
56 /* enable the usart2 and gpio clock */
57 crm_periph_clock_enable(CRM_USART2_PERIPH_CLOCK, TRUE);
58 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
59
60 /* enable the usart3 and gpio clock */
61 crm_periph_clock_enable(CRM_USART3_PERIPH_CLOCK, TRUE);
62 crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
63
64 gpio_default_para_init(&gpio_init_struct);
65
66 /* configure the usart2 tx pin */
67 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
68 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_OPEN_DRAIN;
69 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
70 gpio_init_struct.gpio_pins = GPIO_PINS_2;
71 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
72 gpio_init(GPIOA, &gpio_init_struct);
73
74 /* configure the usart3 tx pin */
75 gpio_init_struct.gpio_pins = GPIO_PINS_10;
76 gpio_init(GPIOB, &gpio_init_struct);
77
78 /* configure usart2 param */
79 usart_init(USART2, 115200, USART_DATA_8BITS, USART_STOP_1_BIT);
80 usart_transmitter_enable(USART2, TRUE);
81 usart_receiver_enable(USART2, TRUE);
82 usart_single_line_halfduplex_select(USART2, TRUE);
83 usart_enable(USART2, TRUE);
84
85 /* configure usart3 param */
86 usart_init(USART3, 115200, USART_DATA_8BITS, USART_STOP_1_BIT);
87 usart_transmitter_enable(USART3, TRUE);
88 usart_receiver_enable(USART3, TRUE);
89 usart_single_line_halfduplex_select(USART3, TRUE);
90 usart_enable(USART3, TRUE);
91}
92
100uint8_t buffer_compare(uint8_t* pbuffer1, uint8_t* pbuffer2, uint16_t buffer_length)
101{
102 while(buffer_length--)
103 {
104 if(*pbuffer1 != *pbuffer2)
105 {
106 return 0;
107 }
108 pbuffer1++;
109 pbuffer2++;
110 }
111 return 1;
112}
113
119int main(void)
120{
121 system_clock_config();
122 at32_board_init();
123 usart_configuration();
124
125 /* usart2 transmit and usart3 receive */
126 data_count = USART2_TX_BUFFER_SIZE;
127 while(data_count)
128 {
129 while(usart_flag_get(USART2, USART_TDBE_FLAG) == RESET);
130 usart_data_transmit(USART2, usart2_tx_buffer[USART2_TX_BUFFER_SIZE-data_count]);
131 while(usart_flag_get(USART3, USART_RDBF_FLAG) == RESET);
132 usart3_rx_buffer[USART2_TX_BUFFER_SIZE-data_count] = usart_data_receive(USART3);
133 data_count--;
134 }
135
136 /* usart3 transmit and usart2 receive */
137 data_count = USART3_TX_BUFFER_SIZE;
138 while(data_count)
139 {
140 while(usart_flag_get(USART3, USART_TDBE_FLAG) == RESET);
141 usart_data_transmit(USART3, usart3_tx_buffer[USART3_TX_BUFFER_SIZE-data_count]);
142 while(usart_flag_get(USART2, USART_RDBF_FLAG) == RESET);
143 usart2_rx_buffer[USART3_TX_BUFFER_SIZE-data_count] = usart_data_receive(USART2);
144 data_count--;
145 }
146
147 while(1)
148 {
149 /* compare data buffer */
150 if(buffer_compare(usart2_tx_buffer, usart3_rx_buffer, USART2_TX_BUFFER_SIZE) && \
151 buffer_compare(usart3_tx_buffer, usart2_rx_buffer, USART3_TX_BUFFER_SIZE))
152 {
153 at32_led_toggle(LED2);
154 at32_led_toggle(LED3);
155 at32_led_toggle(LED4);
156 delay_sec(1);
157 }
158 }
159}
160
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
usart_configuration
void usart_configuration(void)
config usart
Definition project/at_start_f413/examples/usart/half_duplex/src/main.c:52
buffer_compare
uint8_t buffer_compare(uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t buffer_length)
compares two buffers.
Definition project/at_start_f413/examples/usart/half_duplex/src/main.c:100
usart3_rx_buffer
uint8_t usart3_rx_buffer[((sizeof(usart2_tx_buffer)/sizeof(*(usart2_tx_buffer))) - 1)]
Definition project/at_start_f413/examples/usart/half_duplex/src/main.c:44
USART2_TX_BUFFER_SIZE
#define USART2_TX_BUFFER_SIZE
Definition project/at_start_f413/examples/usart/half_duplex/src/main.c:38
main
int main(void)
main function.
Definition project/at_start_f413/examples/usart/half_duplex/src/main.c:119
usart2_tx_buffer
uint8_t usart2_tx_buffer[]
Definition project/at_start_f413/examples/usart/half_duplex/src/main.c:41
USART3_TX_BUFFER_SIZE
#define USART3_TX_BUFFER_SIZE
Definition project/at_start_f413/examples/usart/half_duplex/src/main.c:39
data_count
uint8_t data_count
Definition project/at_start_f413/examples/usart/half_duplex/src/main.c:45
usart3_tx_buffer
uint8_t usart3_tx_buffer[]
Definition project/at_start_f413/examples/usart/half_duplex/src/main.c:42
usart2_rx_buffer
uint8_t usart2_rx_buffer[((sizeof(usart3_tx_buffer)/sizeof(*(usart3_tx_buffer))) - 1)]
Definition project/at_start_f413/examples/usart/half_duplex/src/main.c:43
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
delay_sec
void delay_sec(uint16_t sec)
inserts a delay time.
Definition at32f413_board.c:382
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_USART3_PERIPH_CLOCK
@ CRM_USART3_PERIPH_CLOCK
Definition at32f413_crm.h:132
CRM_GPIOB_PERIPH_CLOCK
@ CRM_GPIOB_PERIPH_CLOCK
Definition at32f413_crm.h:110
CRM_USART2_PERIPH_CLOCK
@ CRM_USART2_PERIPH_CLOCK
Definition at32f413_crm.h:131
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_OUTPUT_OPEN_DRAIN
@ GPIO_OUTPUT_OPEN_DRAIN
Definition at32f413_gpio.h:235
GPIO_PINS_10
#define GPIO_PINS_10
Definition at32f413_gpio.h:60
GPIO_PINS_2
#define GPIO_PINS_2
Definition at32f413_gpio.h:52
GPIOB
#define GPIOB
Definition at32f413_gpio.h:748
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
usart_data_transmit
void usart_data_transmit(usart_type *usart_x, uint16_t data)
transmit single data through the usart peripheral.
Definition at32f413_usart.c:380
usart_flag_get
flag_status usart_flag_get(usart_type *usart_x, uint32_t flag)
check whether the specified usart flag is set or not.
Definition at32f413_usart.c:565
usart_transmitter_enable
void usart_transmitter_enable(usart_type *usart_x, confirm_state new_state)
usart transmitter enable.
Definition at32f413_usart.c:185
usart_init
void usart_init(usart_type *usart_x, uint32_t baud_rate, usart_data_bit_num_type data_bit, usart_stop_bit_num_type stop_bit)
initialize the usart peripheral according to the specified parameters.
Definition at32f413_usart.c:105
usart_enable
void usart_enable(usart_type *usart_x, confirm_state new_state)
enable or disable the specified usart peripheral.
Definition at32f413_usart.c:172
usart_receiver_enable
void usart_receiver_enable(usart_type *usart_x, confirm_state new_state)
usart receiver enable.
Definition at32f413_usart.c:198
usart_data_receive
uint16_t usart_data_receive(usart_type *usart_x)
return the most recent received data by the usart peripheral.
Definition at32f413_usart.c:392
usart_single_line_halfduplex_select
void usart_single_line_halfduplex_select(usart_type *usart_x, confirm_state new_state)
enable or disable the usart single line bidirectional half-duplex communication.
Definition at32f413_usart.c:476
USART_STOP_1_BIT
@ USART_STOP_1_BIT
Definition at32f413_usart.h:157
USART_DATA_8BITS
@ USART_DATA_8BITS
Definition at32f413_usart.h:112
USART_TDBE_FLAG
#define USART_TDBE_FLAG
Definition at32f413_usart.h:58
USART_RDBF_FLAG
#define USART_RDBF_FLAG
Definition at32f413_usart.h:56
USART2
#define USART2
Definition at32f413_usart.h:319
at32f413_clock.h
header file of clock program
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • usart
  • hw_flow_control
  • inc
project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • usart
  • hw_flow_control
  • inc
project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • usart
  • hw_flow_control
  • inc
project/at_start_f413/examples/usart/hw_flow_control/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • usart
  • hw_flow_control
  • src
project/at_start_f413/examples/usart/hw_flow_control/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/usart/hw_flow_control/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • usart
  • hw_flow_control
  • src
project/at_start_f413/examples/usart/hw_flow_control/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/usart/hw_flow_control/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/usart/hw_flow_control/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/usart/hw_flow_control/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/usart/hw_flow_control/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/usart/hw_flow_control/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/usart/hw_flow_control/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/usart/hw_flow_control/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/usart/hw_flow_control/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/usart/hw_flow_control/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • usart
  • hw_flow_control
  • src
project/at_start_f413/examples/usart/hw_flow_control/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37#define BUFFER_SIZE 16
38
39uint8_t rx_buffer[BUFFER_SIZE];
40uint8_t data_count;
41
47void usart_configuration(void)
48{
49 gpio_init_type gpio_init_struct;
50
51 /* enable the usart2 and gpio clock */
52 crm_periph_clock_enable(CRM_USART2_PERIPH_CLOCK, TRUE);
53 crm_periph_clock_enable(CRM_GPIOD_PERIPH_CLOCK, TRUE);
54
55 gpio_default_para_init(&gpio_init_struct);
56
57 /* configure the usart2 tx and rts pin */
58 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
59 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
60 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
61 gpio_init_struct.gpio_pins = GPIO_PINS_2 | GPIO_PINS_1;
62 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
63 gpio_init(GPIOA, &gpio_init_struct);
64
65 /* configure the usart2 rx and cts pin */
66 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
67 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
68 gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
69 gpio_init_struct.gpio_pins = GPIO_PINS_3 | GPIO_PINS_0;
70 gpio_init_struct.gpio_pull = GPIO_PULL_UP;
71 gpio_init(GPIOA, &gpio_init_struct);
72
73 /* configure usart2 param */
74 usart_init(USART2, 115200, USART_DATA_8BITS, USART_STOP_1_BIT);
75 usart_hardware_flow_control_set(USART2, USART_HARDWARE_FLOW_RTS_CTS);
76 usart_transmitter_enable(USART2, TRUE);
77 usart_receiver_enable(USART2, TRUE);
78 usart_enable(USART2, TRUE);
79}
80
86int main(void)
87{
88 system_clock_config();
89 at32_board_init();
90 usart_configuration();
91
92 /* receive a string (BUFFER_SIZE bytes) from the hyperterminal */
93 data_count = BUFFER_SIZE;
94 while(data_count)
95 {
96 while(usart_flag_get(USART2, USART_RDBF_FLAG) == RESET);
97 rx_buffer[BUFFER_SIZE-data_count] = usart_data_receive(USART2);
98 data_count--;
99 }
100
101 /* send a buffer from usart to hyperterminal */
102 data_count = BUFFER_SIZE;
103 while(data_count)
104 {
105 while(usart_flag_get(USART2, USART_TDBE_FLAG) == RESET);
106 usart_data_transmit(USART2, rx_buffer[BUFFER_SIZE-data_count]);
107 data_count--;
108 }
109
110 while(1)
111 {
112 at32_led_toggle(LED2);
113 at32_led_toggle(LED3);
114 at32_led_toggle(LED4);
115 delay_sec(1);
116 }
117}
118
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
rx_buffer
uint8_t rx_buffer[16]
Definition project/at_start_f413/examples/usart/hw_flow_control/src/main.c:39
usart_configuration
void usart_configuration(void)
config usart
Definition project/at_start_f413/examples/usart/hw_flow_control/src/main.c:47
BUFFER_SIZE
#define BUFFER_SIZE
Definition project/at_start_f413/examples/usart/hw_flow_control/src/main.c:37
main
int main(void)
main function.
Definition project/at_start_f413/examples/usart/hw_flow_control/src/main.c:86
data_count
uint8_t data_count
Definition project/at_start_f413/examples/usart/hw_flow_control/src/main.c:40
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
delay_sec
void delay_sec(uint16_t sec)
inserts a delay time.
Definition at32f413_board.c:382
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOD_PERIPH_CLOCK
@ CRM_GPIOD_PERIPH_CLOCK
Definition at32f413_crm.h:112
CRM_USART2_PERIPH_CLOCK
@ CRM_USART2_PERIPH_CLOCK
Definition at32f413_crm.h:131
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_PULL_UP
@ GPIO_PULL_UP
Definition at32f413_gpio.h:244
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_0
#define GPIO_PINS_0
Definition at32f413_gpio.h:50
GPIO_PINS_2
#define GPIO_PINS_2
Definition at32f413_gpio.h:52
GPIO_PINS_3
#define GPIO_PINS_3
Definition at32f413_gpio.h:53
GPIO_PINS_1
#define GPIO_PINS_1
Definition at32f413_gpio.h:51
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
usart_data_transmit
void usart_data_transmit(usart_type *usart_x, uint16_t data)
transmit single data through the usart peripheral.
Definition at32f413_usart.c:380
usart_flag_get
flag_status usart_flag_get(usart_type *usart_x, uint32_t flag)
check whether the specified usart flag is set or not.
Definition at32f413_usart.c:565
usart_transmitter_enable
void usart_transmitter_enable(usart_type *usart_x, confirm_state new_state)
usart transmitter enable.
Definition at32f413_usart.c:185
usart_init
void usart_init(usart_type *usart_x, uint32_t baud_rate, usart_data_bit_num_type data_bit, usart_stop_bit_num_type stop_bit)
initialize the usart peripheral according to the specified parameters.
Definition at32f413_usart.c:105
usart_enable
void usart_enable(usart_type *usart_x, confirm_state new_state)
enable or disable the specified usart peripheral.
Definition at32f413_usart.c:172
usart_receiver_enable
void usart_receiver_enable(usart_type *usart_x, confirm_state new_state)
usart receiver enable.
Definition at32f413_usart.c:198
usart_hardware_flow_control_set
void usart_hardware_flow_control_set(usart_type *usart_x, usart_hardware_flow_control_type flow_state)
configure the usart's hardware flow control.
Definition at32f413_usart.c:522
usart_data_receive
uint16_t usart_data_receive(usart_type *usart_x)
return the most recent received data by the usart peripheral.
Definition at32f413_usart.c:392
USART_HARDWARE_FLOW_RTS_CTS
@ USART_HARDWARE_FLOW_RTS_CTS
Definition at32f413_usart.h:171
USART_STOP_1_BIT
@ USART_STOP_1_BIT
Definition at32f413_usart.h:157
USART_DATA_8BITS
@ USART_DATA_8BITS
Definition at32f413_usart.h:112
USART_TDBE_FLAG
#define USART_TDBE_FLAG
Definition at32f413_usart.h:58
USART_RDBF_FLAG
#define USART_RDBF_FLAG
Definition at32f413_usart.h:56
USART2
#define USART2
Definition at32f413_usart.h:319
at32f413_clock.h
header file of clock program
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • usart
  • idle_detection
  • inc
project/at_start_f413/examples/usart/idle_detection/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • usart
  • idle_detection
  • inc
project/at_start_f413/examples/usart/idle_detection/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • usart
  • idle_detection
  • inc
project/at_start_f413/examples/usart/idle_detection/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • usart
  • idle_detection
  • src
project/at_start_f413/examples/usart/idle_detection/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/usart/idle_detection/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • usart
  • idle_detection
  • src
project/at_start_f413/examples/usart/idle_detection/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28#include "at32f413_board.h"
29
43void NMI_Handler(void)
44{
45}
46
52void HardFault_Handler(void)
53{
54 /* go to infinite loop when hard fault exception occurs */
55 while(1)
56 {
57 }
58}
59
65void MemManage_Handler(void)
66{
67 /* go to infinite loop when memory manage exception occurs */
68 while(1)
69 {
70 }
71}
72
78void BusFault_Handler(void)
79{
80 /* go to infinite loop when bus fault exception occurs */
81 while(1)
82 {
83 }
84}
85
91void UsageFault_Handler(void)
92{
93 /* go to infinite loop when usage fault exception occurs */
94 while(1)
95 {
96 }
97}
98
104void SVC_Handler(void)
105{
106}
107
113void DebugMon_Handler(void)
114{
115}
116
122void PendSV_Handler(void)
123{
124}
125
131void SysTick_Handler(void)
132{
133}
134
140void USART2_IRQHandler(void)
141{
142 if(usart_interrupt_flag_get(USART2, USART_IDLEF_FLAG))
143 {
144 usart_data_receive(USART2);
145 at32_led_on(LED2);
146 at32_led_on(LED3);
147 at32_led_on(LED4);
148 }
149}
150
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
USART2_IRQHandler
void USART2_IRQHandler(void)
this function handles usart2 handler.
Definition project/at_start_f413/examples/usart/idle_detection/src/at32f413_int.c:140
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/usart/idle_detection/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/usart/idle_detection/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/usart/idle_detection/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/usart/idle_detection/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/usart/idle_detection/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/usart/idle_detection/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/usart/idle_detection/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/usart/idle_detection/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/usart/idle_detection/src/at32f413_int.c:113
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
usart_data_receive
uint16_t usart_data_receive(usart_type *usart_x)
return the most recent received data by the usart peripheral.
Definition at32f413_usart.c:392
usart_interrupt_flag_get
flag_status usart_interrupt_flag_get(usart_type *usart_x, uint32_t flag)
check whether the specified usart interrupt flag is set or not.
Definition at32f413_usart.c:596
USART_IDLEF_FLAG
#define USART_IDLEF_FLAG
Definition at32f413_usart.h:55
USART2
#define USART2
Definition at32f413_usart.h:319
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • usart
  • idle_detection
  • src
project/at_start_f413/examples/usart/idle_detection/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
42void usart_configuration(void)
43{
44 gpio_init_type gpio_init_struct;
45
46 /* enable the usart2 and gpio clock */
47 crm_periph_clock_enable(CRM_USART2_PERIPH_CLOCK, TRUE);
48 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
49
50 gpio_default_para_init(&gpio_init_struct);
51
52 /* configure the usart2 tx pin */
53 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
54 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
55 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
56 gpio_init_struct.gpio_pins = GPIO_PINS_2;
57 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
58 gpio_init(GPIOA, &gpio_init_struct);
59
60 /* configure the usart2 rx pin */
61 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
62 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
63 gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
64 gpio_init_struct.gpio_pins = GPIO_PINS_3;
65 gpio_init_struct.gpio_pull = GPIO_PULL_UP;
66 gpio_init(GPIOA, &gpio_init_struct);
67
68 /* config usart nvic interrupt */
69 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
70 nvic_irq_enable(USART2_IRQn, 0, 0);
71
72 /* configure usart2 param */
73 usart_init(USART2, 115200, USART_DATA_8BITS, USART_STOP_1_BIT);
74 usart_transmitter_enable(USART2, TRUE);
75 usart_receiver_enable(USART2, TRUE);
76 usart_interrupt_enable(USART2, USART_IDLE_INT, TRUE);
77 usart_enable(USART2, TRUE);
78}
79
85int main(void)
86{
87 system_clock_config();
88 at32_board_init();
89 at32_led_off(LED2);
90 at32_led_off(LED3);
91 at32_led_off(LED4);
92 usart_configuration();
93
94 /* transmit a data */
95 while(usart_flag_get(USART2, USART_TDBE_FLAG) == RESET);
96 usart_data_transmit(USART2, 0x55);
97
98 /* receive a data from the tx pin */
99 while(usart_flag_get(USART2, USART_RDBF_FLAG) == RESET);
100 usart_data_receive(USART2);
101
102 while(1)
103 {
104 }
105}
106
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
usart_configuration
void usart_configuration(void)
config usart
Definition project/at_start_f413/examples/usart/idle_detection/src/main.c:42
main
int main(void)
main function.
Definition project/at_start_f413/examples/usart/idle_detection/src/main.c:85
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_off
void at32_led_off(led_type led)
turns selected led off.
Definition at32f413_board.c:287
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_USART2_PERIPH_CLOCK
@ CRM_USART2_PERIPH_CLOCK
Definition at32f413_crm.h:131
USART2_IRQn
@ USART2_IRQn
Definition at32f413.h:210
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_PULL_UP
@ GPIO_PULL_UP
Definition at32f413_gpio.h:244
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_2
#define GPIO_PINS_2
Definition at32f413_gpio.h:52
GPIO_PINS_3
#define GPIO_PINS_3
Definition at32f413_gpio.h:53
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
usart_data_transmit
void usart_data_transmit(usart_type *usart_x, uint16_t data)
transmit single data through the usart peripheral.
Definition at32f413_usart.c:380
usart_flag_get
flag_status usart_flag_get(usart_type *usart_x, uint32_t flag)
check whether the specified usart flag is set or not.
Definition at32f413_usart.c:565
usart_transmitter_enable
void usart_transmitter_enable(usart_type *usart_x, confirm_state new_state)
usart transmitter enable.
Definition at32f413_usart.c:185
usart_init
void usart_init(usart_type *usart_x, uint32_t baud_rate, usart_data_bit_num_type data_bit, usart_stop_bit_num_type stop_bit)
initialize the usart peripheral according to the specified parameters.
Definition at32f413_usart.c:105
usart_enable
void usart_enable(usart_type *usart_x, confirm_state new_state)
enable or disable the specified usart peripheral.
Definition at32f413_usart.c:172
usart_receiver_enable
void usart_receiver_enable(usart_type *usart_x, confirm_state new_state)
usart receiver enable.
Definition at32f413_usart.c:198
usart_interrupt_enable
void usart_interrupt_enable(usart_type *usart_x, uint32_t usart_int, confirm_state new_state)
enable or disable the specified usart interrupts.
Definition at32f413_usart.c:263
usart_data_receive
uint16_t usart_data_receive(usart_type *usart_x)
return the most recent received data by the usart peripheral.
Definition at32f413_usart.c:392
USART_STOP_1_BIT
@ USART_STOP_1_BIT
Definition at32f413_usart.h:157
USART_DATA_8BITS
@ USART_DATA_8BITS
Definition at32f413_usart.h:112
USART_TDBE_FLAG
#define USART_TDBE_FLAG
Definition at32f413_usart.h:58
USART_RDBF_FLAG
#define USART_RDBF_FLAG
Definition at32f413_usart.h:56
USART_IDLE_INT
#define USART_IDLE_INT
Definition at32f413_usart.h:71
USART2
#define USART2
Definition at32f413_usart.h:319
at32f413_clock.h
header file of clock program
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • usart
  • interrupt
  • inc
project/at_start_f413/examples/usart/interrupt/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • usart
  • interrupt
  • inc
project/at_start_f413/examples/usart/interrupt/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • usart
  • interrupt
  • inc
project/at_start_f413/examples/usart/interrupt/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • usart
  • interrupt
  • src
project/at_start_f413/examples/usart/interrupt/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/usart/interrupt/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • usart
  • interrupt
  • src
project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
29extern uint8_t usart2_tx_buffer[];
30extern uint8_t usart3_tx_buffer[];
31extern uint8_t usart2_rx_buffer[];
32extern uint8_t usart3_rx_buffer[];
33extern uint8_t usart2_tx_counter;
34extern uint8_t usart3_tx_counter;
35extern uint8_t usart2_rx_counter;
36extern uint8_t usart3_rx_counter;
37extern uint8_t usart2_tx_buffer_size;
38extern uint8_t usart3_tx_buffer_size;
39
53void NMI_Handler(void)
54{
55}
56
62void HardFault_Handler(void)
63{
64 /* go to infinite loop when hard fault exception occurs */
65 while(1)
66 {
67 }
68}
69
75void MemManage_Handler(void)
76{
77 /* go to infinite loop when memory manage exception occurs */
78 while(1)
79 {
80 }
81}
82
88void BusFault_Handler(void)
89{
90 /* go to infinite loop when bus fault exception occurs */
91 while(1)
92 {
93 }
94}
95
101void UsageFault_Handler(void)
102{
103 /* go to infinite loop when usage fault exception occurs */
104 while(1)
105 {
106 }
107}
108
114void SVC_Handler(void)
115{
116}
117
123void DebugMon_Handler(void)
124{
125}
126
132void PendSV_Handler(void)
133{
134}
135
141void SysTick_Handler(void)
142{
143}
144
150void USART2_IRQHandler(void)
151{
152 if(usart_interrupt_flag_get(USART2, USART_RDBF_FLAG) != RESET)
153 {
154 /* read one byte from the receive data register */
155 usart2_rx_buffer[usart2_rx_counter++] = usart_data_receive(USART2);
156
157 if(usart2_rx_counter == usart3_tx_buffer_size)
158 {
159 /* disable the usart2 receive interrupt */
160 usart_interrupt_enable(USART2, USART_RDBF_INT, FALSE);
161 }
162 }
163
164 if(usart_interrupt_flag_get(USART2, USART_TDBE_FLAG) != RESET)
165 {
166 /* write one byte to the transmit data register */
167 usart_data_transmit(USART2, usart2_tx_buffer[usart2_tx_counter++]);
168
169 if(usart2_tx_counter == usart2_tx_buffer_size)
170 {
171 /* disable the usart2 transmit interrupt */
172 usart_interrupt_enable(USART2, USART_TDBE_INT, FALSE);
173 }
174 }
175}
176
182void USART3_IRQHandler(void)
183{
184 if(usart_interrupt_flag_get(USART3, USART_RDBF_FLAG) != RESET)
185 {
186 /* read one byte from the receive data register */
187 usart3_rx_buffer[usart3_rx_counter++] = usart_data_receive(USART3);
188
189 if(usart3_rx_counter == usart2_tx_buffer_size)
190 {
191 /* disable the usart3 receive interrupt */
192 usart_interrupt_enable(USART3, USART_RDBF_INT, FALSE);
193 }
194 }
195
196 if(usart_interrupt_flag_get(USART3, USART_TDBE_FLAG) != RESET)
197 {
198 /* write one byte to the transmit data register */
199 usart_data_transmit(USART3, usart3_tx_buffer[usart3_tx_counter++]);
200
201 if(usart3_tx_counter == usart3_tx_buffer_size)
202 {
203 /* disable the usart3 transmit interrupt */
204 usart_interrupt_enable(USART3, USART_TDBE_INT, FALSE);
205 }
206 }
207}
208
usart3_rx_buffer
uint8_t usart3_rx_buffer[]
Definition project/at_start_f413/examples/usart/half_duplex/src/main.c:44
usart2_tx_buffer
uint8_t usart2_tx_buffer[]
Definition project/at_start_f413/examples/usart/half_duplex/src/main.c:41
usart3_tx_buffer
uint8_t usart3_tx_buffer[]
Definition project/at_start_f413/examples/usart/half_duplex/src/main.c:42
usart2_rx_buffer
uint8_t usart2_rx_buffer[]
Definition project/at_start_f413/examples/usart/half_duplex/src/main.c:43
USART2_IRQHandler
void USART2_IRQHandler(void)
this function handles usart2 handler.
Definition project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c:150
USART3_IRQHandler
void USART3_IRQHandler(void)
this function handles usart3 handler.
Definition project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c:182
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c:101
usart3_rx_counter
uint8_t usart3_rx_counter
Definition project/at_start_f413/examples/usart/interrupt/src/main.c:48
usart2_rx_counter
uint8_t usart2_rx_counter
Definition project/at_start_f413/examples/usart/interrupt/src/main.c:47
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c:62
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c:75
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c:114
usart2_tx_counter
uint8_t usart2_tx_counter
Definition project/at_start_f413/examples/usart/interrupt/src/main.c:45
usart3_tx_counter
uint8_t usart3_tx_counter
Definition project/at_start_f413/examples/usart/interrupt/src/main.c:46
usart2_tx_buffer_size
uint8_t usart2_tx_buffer_size
Definition project/at_start_f413/examples/usart/interrupt/src/main.c:49
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c:132
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c:53
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c:88
usart3_tx_buffer_size
uint8_t usart3_tx_buffer_size
Definition project/at_start_f413/examples/usart/interrupt/src/main.c:50
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c:141
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/usart/interrupt/src/at32f413_int.c:123
FALSE
@ FALSE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
usart_data_transmit
void usart_data_transmit(usart_type *usart_x, uint16_t data)
transmit single data through the usart peripheral.
Definition at32f413_usart.c:380
usart_interrupt_enable
void usart_interrupt_enable(usart_type *usart_x, uint32_t usart_int, confirm_state new_state)
enable or disable the specified usart interrupts.
Definition at32f413_usart.c:263
usart_data_receive
uint16_t usart_data_receive(usart_type *usart_x)
return the most recent received data by the usart peripheral.
Definition at32f413_usart.c:392
usart_interrupt_flag_get
flag_status usart_interrupt_flag_get(usart_type *usart_x, uint32_t flag)
check whether the specified usart interrupt flag is set or not.
Definition at32f413_usart.c:596
USART_TDBE_FLAG
#define USART_TDBE_FLAG
Definition at32f413_usart.h:58
USART_RDBF_FLAG
#define USART_RDBF_FLAG
Definition at32f413_usart.h:56
USART_RDBF_INT
#define USART_RDBF_INT
Definition at32f413_usart.h:72
USART_TDBE_INT
#define USART_TDBE_INT
Definition at32f413_usart.h:74
USART2
#define USART2
Definition at32f413_usart.h:319
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • usart
  • interrupt
  • src
project/at_start_f413/examples/usart/interrupt/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37#define COUNTOF(a) (sizeof(a) / sizeof(*(a)))
38#define USART2_TX_BUFFER_SIZE (COUNTOF(usart2_tx_buffer) - 1)
39#define USART3_TX_BUFFER_SIZE (COUNTOF(usart3_tx_buffer) - 1)
40
41uint8_t usart2_tx_buffer[] = "usart transfer by interrupt: usart2 -> usart3 using interrupt";
42uint8_t usart3_tx_buffer[] = "usart transfer by interrupt: usart3 -> usart2 using interrupt";
43uint8_t usart2_rx_buffer[USART3_TX_BUFFER_SIZE];
44uint8_t usart3_rx_buffer[USART2_TX_BUFFER_SIZE];
45volatile uint8_t usart2_tx_counter = 0x00;
46volatile uint8_t usart3_tx_counter = 0x00;
47volatile uint8_t usart2_rx_counter = 0x00;
48volatile uint8_t usart3_rx_counter = 0x00;
49uint8_t usart2_tx_buffer_size = USART2_TX_BUFFER_SIZE;
50uint8_t usart3_tx_buffer_size = USART3_TX_BUFFER_SIZE;
51
57void usart_configuration(void)
58{
59 gpio_init_type gpio_init_struct;
60
61 /* enable the usart2 and gpio clock */
62 crm_periph_clock_enable(CRM_USART2_PERIPH_CLOCK, TRUE);
63 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
64
65 /* enable the usart3 and gpio clock */
66 crm_periph_clock_enable(CRM_USART3_PERIPH_CLOCK, TRUE);
67 crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
68
69 gpio_default_para_init(&gpio_init_struct);
70
71 /* configure the usart2 tx pin */
72 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
73 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
74 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
75 gpio_init_struct.gpio_pins = GPIO_PINS_2;
76 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
77 gpio_init(GPIOA, &gpio_init_struct);
78
79 /* configure the usart3 tx pin */
80 gpio_init_struct.gpio_pins = GPIO_PINS_10;
81 gpio_init(GPIOB, &gpio_init_struct);
82
83 /* configure the usart2 rx pin */
84 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
85 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
86 gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
87 gpio_init_struct.gpio_pins = GPIO_PINS_3;
88 gpio_init_struct.gpio_pull = GPIO_PULL_UP;
89 gpio_init(GPIOA, &gpio_init_struct);
90
91 /* configure the usart3 rx pin */
92 gpio_init_struct.gpio_pins = GPIO_PINS_11;
93 gpio_init(GPIOB, &gpio_init_struct);
94
95 /* config usart nvic interrupt */
96 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
97 nvic_irq_enable(USART2_IRQn, 0, 0);
98 nvic_irq_enable(USART3_IRQn, 0, 0);
99
100 /* configure usart2 param */
101 usart_init(USART2, 115200, USART_DATA_8BITS, USART_STOP_1_BIT);
102 usart_transmitter_enable(USART2, TRUE);
103 usart_receiver_enable(USART2, TRUE);
104
105 /* configure usart3 param */
106 usart_init(USART3, 115200, USART_DATA_8BITS, USART_STOP_1_BIT);
107 usart_transmitter_enable(USART3, TRUE);
108 usart_receiver_enable(USART3, TRUE);
109
110 /* enable usart2 and usart3 interrupt */
111 usart_interrupt_enable(USART2, USART_RDBF_INT, TRUE);
112 usart_enable(USART2, TRUE);
113
114 usart_interrupt_enable(USART3, USART_RDBF_INT, TRUE);
115 usart_enable(USART3, TRUE);
116
117 usart_interrupt_enable(USART2, USART_TDBE_INT, TRUE);
118 usart_interrupt_enable(USART3, USART_TDBE_INT, TRUE);
119}
120
128uint8_t buffer_compare(uint8_t* pbuffer1, uint8_t* pbuffer2, uint16_t buffer_length)
129{
130 while(buffer_length--)
131 {
132 if(*pbuffer1 != *pbuffer2)
133 {
134 return 0;
135 }
136 pbuffer1++;
137 pbuffer2++;
138 }
139 return 1;
140}
141
147int main(void)
148{
149 system_clock_config();
150 at32_board_init();
151 usart_configuration();
152
153 /* wait until end of transmission from usart2 to usart3 */
154 while(usart3_rx_counter < usart2_tx_buffer_size);
155
156 /* wait until end of transmission from usart3 to usart2 */
157 while(usart2_rx_counter < usart3_tx_buffer_size);
158
159 while(1)
160 {
161 /* compare data buffer */
162 if(buffer_compare(usart2_tx_buffer, usart3_rx_buffer, USART2_TX_BUFFER_SIZE) && \
163 buffer_compare(usart3_tx_buffer, usart2_rx_buffer, USART3_TX_BUFFER_SIZE))
164 {
165 at32_led_toggle(LED2);
166 at32_led_toggle(LED3);
167 at32_led_toggle(LED4);
168 delay_sec(1);
169 }
170 }
171}
172
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
usart_configuration
void usart_configuration(void)
config usart
Definition project/at_start_f413/examples/usart/interrupt/src/main.c:57
buffer_compare
uint8_t buffer_compare(uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t buffer_length)
compares two buffers.
Definition project/at_start_f413/examples/usart/interrupt/src/main.c:128
usart3_rx_counter
volatile uint8_t usart3_rx_counter
Definition project/at_start_f413/examples/usart/interrupt/src/main.c:48
usart2_rx_counter
volatile uint8_t usart2_rx_counter
Definition project/at_start_f413/examples/usart/interrupt/src/main.c:47
usart2_tx_counter
volatile uint8_t usart2_tx_counter
Definition project/at_start_f413/examples/usart/interrupt/src/main.c:45
usart3_tx_counter
volatile uint8_t usart3_tx_counter
Definition project/at_start_f413/examples/usart/interrupt/src/main.c:46
usart2_tx_buffer_size
uint8_t usart2_tx_buffer_size
Definition project/at_start_f413/examples/usart/interrupt/src/main.c:49
usart3_rx_buffer
uint8_t usart3_rx_buffer[((sizeof(usart2_tx_buffer)/sizeof(*(usart2_tx_buffer))) - 1)]
Definition project/at_start_f413/examples/usart/interrupt/src/main.c:44
USART2_TX_BUFFER_SIZE
#define USART2_TX_BUFFER_SIZE
Definition project/at_start_f413/examples/usart/interrupt/src/main.c:38
main
int main(void)
main function.
Definition project/at_start_f413/examples/usart/interrupt/src/main.c:147
usart3_tx_buffer_size
uint8_t usart3_tx_buffer_size
Definition project/at_start_f413/examples/usart/interrupt/src/main.c:50
usart2_tx_buffer
uint8_t usart2_tx_buffer[]
Definition project/at_start_f413/examples/usart/interrupt/src/main.c:41
USART3_TX_BUFFER_SIZE
#define USART3_TX_BUFFER_SIZE
Definition project/at_start_f413/examples/usart/interrupt/src/main.c:39
usart3_tx_buffer
uint8_t usart3_tx_buffer[]
Definition project/at_start_f413/examples/usart/interrupt/src/main.c:42
usart2_rx_buffer
uint8_t usart2_rx_buffer[((sizeof(usart3_tx_buffer)/sizeof(*(usart3_tx_buffer))) - 1)]
Definition project/at_start_f413/examples/usart/interrupt/src/main.c:43
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
delay_sec
void delay_sec(uint16_t sec)
inserts a delay time.
Definition at32f413_board.c:382
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_USART3_PERIPH_CLOCK
@ CRM_USART3_PERIPH_CLOCK
Definition at32f413_crm.h:132
CRM_GPIOB_PERIPH_CLOCK
@ CRM_GPIOB_PERIPH_CLOCK
Definition at32f413_crm.h:110
CRM_USART2_PERIPH_CLOCK
@ CRM_USART2_PERIPH_CLOCK
Definition at32f413_crm.h:131
USART2_IRQn
@ USART2_IRQn
Definition at32f413.h:210
USART3_IRQn
@ USART3_IRQn
Definition at32f413.h:211
TRUE
@ TRUE
Definition at32f413.h:297
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_PULL_UP
@ GPIO_PULL_UP
Definition at32f413_gpio.h:244
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_10
#define GPIO_PINS_10
Definition at32f413_gpio.h:60
GPIO_PINS_11
#define GPIO_PINS_11
Definition at32f413_gpio.h:61
GPIO_PINS_2
#define GPIO_PINS_2
Definition at32f413_gpio.h:52
GPIO_PINS_3
#define GPIO_PINS_3
Definition at32f413_gpio.h:53
GPIOB
#define GPIOB
Definition at32f413_gpio.h:748
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
usart_transmitter_enable
void usart_transmitter_enable(usart_type *usart_x, confirm_state new_state)
usart transmitter enable.
Definition at32f413_usart.c:185
usart_init
void usart_init(usart_type *usart_x, uint32_t baud_rate, usart_data_bit_num_type data_bit, usart_stop_bit_num_type stop_bit)
initialize the usart peripheral according to the specified parameters.
Definition at32f413_usart.c:105
usart_enable
void usart_enable(usart_type *usart_x, confirm_state new_state)
enable or disable the specified usart peripheral.
Definition at32f413_usart.c:172
usart_receiver_enable
void usart_receiver_enable(usart_type *usart_x, confirm_state new_state)
usart receiver enable.
Definition at32f413_usart.c:198
usart_interrupt_enable
void usart_interrupt_enable(usart_type *usart_x, uint32_t usart_int, confirm_state new_state)
enable or disable the specified usart interrupts.
Definition at32f413_usart.c:263
USART_STOP_1_BIT
@ USART_STOP_1_BIT
Definition at32f413_usart.h:157
USART_DATA_8BITS
@ USART_DATA_8BITS
Definition at32f413_usart.h:112
USART_RDBF_INT
#define USART_RDBF_INT
Definition at32f413_usart.h:72
USART_TDBE_INT
#define USART_TDBE_INT
Definition at32f413_usart.h:74
USART2
#define USART2
Definition at32f413_usart.h:319
at32f413_clock.h
header file of clock program
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • usart
  • irda
  • inc
project/at_start_f413/examples/usart/irda/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • usart
  • irda
  • inc
project/at_start_f413/examples/usart/irda/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • usart
  • irda
  • inc
project/at_start_f413/examples/usart/irda/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • usart
  • irda
  • src
project/at_start_f413/examples/usart/irda/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/usart/irda/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • usart
  • irda
  • src
project/at_start_f413/examples/usart/irda/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/usart/irda/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/usart/irda/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/usart/irda/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/usart/irda/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/usart/irda/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/usart/irda/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/usart/irda/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/usart/irda/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/usart/irda/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • usart
  • irda
  • src
project/at_start_f413/examples/usart/irda/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
42void usart_configuration(void)
43{
44 gpio_init_type gpio_init_struct;
45
46 /* enable the usart2 and gpio clock */
47 crm_periph_clock_enable(CRM_USART2_PERIPH_CLOCK, TRUE);
48 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
49
50 gpio_default_para_init(&gpio_init_struct);
51
52 /* configure the usart2 tx pin */
53 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
54 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
55 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
56 gpio_init_struct.gpio_pins = GPIO_PINS_2;
57 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
58 gpio_init(GPIOA, &gpio_init_struct);
59
60 /* configure the usart2 rx pin */
61 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
62 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
63 gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
64 gpio_init_struct.gpio_pins = GPIO_PINS_3;
65 gpio_init_struct.gpio_pull = GPIO_PULL_UP;
66 gpio_init(GPIOA, &gpio_init_struct);
67
68 /* configure usart2 param */
69 usart_init(USART2, 115200, USART_DATA_8BITS, USART_STOP_1_BIT);
70 usart_transmitter_enable(USART2, TRUE);
71 usart_receiver_enable(USART2, TRUE);
72 usart_irda_smartcard_division_set(USART2, 0x01);
73 usart_irda_mode_enable(USART2, TRUE);
74 usart_enable(USART2, TRUE);
75}
76
82int main(void)
83{
84 system_clock_config();
85 at32_board_init();
86 at32_led_off(LED2);
87 at32_led_off(LED3);
88 at32_led_off(LED4);
89 usart_configuration();
90
91#if defined(TRANSMIT)
92 while(usart_flag_get(USART2, USART_TDBE_FLAG) == RESET);
93 usart_data_transmit(USART2, 0x55);
94 at32_led_on(LED4);
95#endif
96
97#if defined(RECEIVE)
98 while(usart_flag_get(USART2, USART_RDBF_FLAG) == RESET);
99 if(usart_data_receive(USART2) == 0x55)
100 {
101 at32_led_on(LED4);
102 }
103#endif
104
105 while(1)
106 {
107 }
108}
109
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
usart_configuration
void usart_configuration(void)
config usart
Definition project/at_start_f413/examples/usart/irda/src/main.c:42
main
int main(void)
main function.
Definition project/at_start_f413/examples/usart/irda/src/main.c:82
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
at32_led_off
void at32_led_off(led_type led)
turns selected led off.
Definition at32f413_board.c:287
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_USART2_PERIPH_CLOCK
@ CRM_USART2_PERIPH_CLOCK
Definition at32f413_crm.h:131
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_PULL_UP
@ GPIO_PULL_UP
Definition at32f413_gpio.h:244
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_2
#define GPIO_PINS_2
Definition at32f413_gpio.h:52
GPIO_PINS_3
#define GPIO_PINS_3
Definition at32f413_gpio.h:53
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
usart_data_transmit
void usart_data_transmit(usart_type *usart_x, uint16_t data)
transmit single data through the usart peripheral.
Definition at32f413_usart.c:380
usart_flag_get
flag_status usart_flag_get(usart_type *usart_x, uint32_t flag)
check whether the specified usart flag is set or not.
Definition at32f413_usart.c:565
usart_transmitter_enable
void usart_transmitter_enable(usart_type *usart_x, confirm_state new_state)
usart transmitter enable.
Definition at32f413_usart.c:185
usart_init
void usart_init(usart_type *usart_x, uint32_t baud_rate, usart_data_bit_num_type data_bit, usart_stop_bit_num_type stop_bit)
initialize the usart peripheral according to the specified parameters.
Definition at32f413_usart.c:105
usart_irda_smartcard_division_set
void usart_irda_smartcard_division_set(usart_type *usart_x, uint8_t div_val)
config the irda/smartcard division.
Definition at32f413_usart.c:432
usart_enable
void usart_enable(usart_type *usart_x, confirm_state new_state)
enable or disable the specified usart peripheral.
Definition at32f413_usart.c:172
usart_receiver_enable
void usart_receiver_enable(usart_type *usart_x, confirm_state new_state)
usart receiver enable.
Definition at32f413_usart.c:198
usart_irda_mode_enable
void usart_irda_mode_enable(usart_type *usart_x, confirm_state new_state)
enable or disable the usart's irda interface.
Definition at32f413_usart.c:490
usart_data_receive
uint16_t usart_data_receive(usart_type *usart_x)
return the most recent received data by the usart peripheral.
Definition at32f413_usart.c:392
USART_STOP_1_BIT
@ USART_STOP_1_BIT
Definition at32f413_usart.h:157
USART_DATA_8BITS
@ USART_DATA_8BITS
Definition at32f413_usart.h:112
USART_TDBE_FLAG
#define USART_TDBE_FLAG
Definition at32f413_usart.h:58
USART_RDBF_FLAG
#define USART_RDBF_FLAG
Definition at32f413_usart.h:56
USART2
#define USART2
Definition at32f413_usart.h:319
at32f413_clock.h
header file of clock program
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • usart
  • polling
  • inc
project/at_start_f413/examples/usart/polling/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • usart
  • polling
  • inc
project/at_start_f413/examples/usart/polling/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • usart
  • polling
  • inc
project/at_start_f413/examples/usart/polling/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • usart
  • polling
  • src
project/at_start_f413/examples/usart/polling/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/usart/polling/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • usart
  • polling
  • src
project/at_start_f413/examples/usart/polling/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/usart/polling/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/usart/polling/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/usart/polling/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/usart/polling/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/usart/polling/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/usart/polling/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/usart/polling/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/usart/polling/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/usart/polling/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • usart
  • polling
  • src
project/at_start_f413/examples/usart/polling/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37#define COUNTOF(a) (sizeof(a) / sizeof(*(a)))
38#define USART2_TX_BUFFER_SIZE (COUNTOF(usart2_tx_buffer) - 1)
39#define USART3_TX_BUFFER_SIZE (COUNTOF(usart3_tx_buffer) - 1)
40
41uint8_t usart2_tx_buffer[] = "usart transfer by interrupt: usart2 -> usart3 using interrupt";
42uint8_t usart3_tx_buffer[] = "usart transfer by interrupt: usart3 -> usart2 using interrupt";
43uint8_t usart2_rx_buffer[USART3_TX_BUFFER_SIZE];
44uint8_t usart3_rx_buffer[USART2_TX_BUFFER_SIZE];
45uint8_t usart2_tx_counter = 0x00;
46uint8_t usart3_tx_counter = 0x00;
47uint8_t usart2_rx_counter = 0x00;
48uint8_t usart3_rx_counter = 0x00;
49uint8_t usart2_tx_buffer_size = USART2_TX_BUFFER_SIZE;
50uint8_t usart3_tx_buffer_size = USART3_TX_BUFFER_SIZE;
51
57void usart_configuration(void)
58{
59 gpio_init_type gpio_init_struct;
60
61 /* enable the usart2 and gpio clock */
62 crm_periph_clock_enable(CRM_USART2_PERIPH_CLOCK, TRUE);
63 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
64
65 /* enable the usart3 and gpio clock */
66 crm_periph_clock_enable(CRM_USART3_PERIPH_CLOCK, TRUE);
67 crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
68
69 gpio_default_para_init(&gpio_init_struct);
70
71 /* configure the usart2 tx pin */
72 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
73 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
74 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
75 gpio_init_struct.gpio_pins = GPIO_PINS_2;
76 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
77 gpio_init(GPIOA, &gpio_init_struct);
78
79 /* configure the usart3 tx pin */
80 gpio_init_struct.gpio_pins = GPIO_PINS_10;
81 gpio_init(GPIOB, &gpio_init_struct);
82
83 /* configure the usart2 rx pin */
84 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
85 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
86 gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
87 gpio_init_struct.gpio_pins = GPIO_PINS_3;
88 gpio_init_struct.gpio_pull = GPIO_PULL_UP;
89 gpio_init(GPIOA, &gpio_init_struct);
90
91 /* configure the usart3 rx pin */
92 gpio_init_struct.gpio_pins = GPIO_PINS_11;
93 gpio_init(GPIOB, &gpio_init_struct);
94
95 /* configure usart2 param */
96 usart_init(USART2, 115200, USART_DATA_8BITS, USART_STOP_1_BIT);
97 usart_parity_selection_config(USART2, USART_PARITY_NONE);
98 usart_transmitter_enable(USART2, TRUE);
99 usart_receiver_enable(USART2, TRUE);
100 usart_enable(USART2, TRUE);
101
102 /* configure usart3 param */
103 usart_init(USART3, 115200, USART_DATA_8BITS, USART_STOP_1_BIT);
104 usart_parity_selection_config(USART3, USART_PARITY_NONE);
105 usart_transmitter_enable(USART3, TRUE);
106 usart_receiver_enable(USART3, TRUE);
107 usart_enable(USART3, TRUE);
108}
109
117uint8_t buffer_compare(uint8_t* pbuffer1, uint8_t* pbuffer2, uint16_t buffer_length)
118{
119 while(buffer_length--)
120 {
121 if(*pbuffer1 != *pbuffer2)
122 {
123 return 0;
124 }
125 pbuffer1++;
126 pbuffer2++;
127 }
128 return 1;
129}
130
136int main(void)
137{
138 system_clock_config();
139 at32_board_init();
140 usart_configuration();
141
142 /* wait until end of transmission from usart2 to usart3 */
143 while(usart3_rx_counter < usart2_tx_buffer_size)
144 {
145 while(usart_flag_get(USART2, USART_TDBE_FLAG) == RESET);
146 usart_data_transmit(USART2, usart2_tx_buffer[usart2_tx_counter++]);
147
148 while(usart_flag_get(USART3, USART_RDBF_FLAG) == RESET);
149 usart3_rx_buffer[usart3_rx_counter++] = usart_data_receive(USART3);
150 }
151
152 /* wait until end of transmission from usart3 to usart2 */
153 while(usart2_rx_counter < usart3_tx_buffer_size)
154 {
155 while(usart_flag_get(USART3, USART_TDBE_FLAG) == RESET);
156 usart_data_transmit(USART3, usart3_tx_buffer[usart3_tx_counter++]);
157
158 while(usart_flag_get(USART2, USART_RDBF_FLAG) == RESET);
159 usart2_rx_buffer[usart2_rx_counter++] = usart_data_receive(USART2);
160 }
161
162 while(1)
163 {
164 /* compare data buffer */
165 if(buffer_compare(usart2_tx_buffer, usart3_rx_buffer, USART2_TX_BUFFER_SIZE) && \
166 buffer_compare(usart3_tx_buffer, usart2_rx_buffer, USART3_TX_BUFFER_SIZE))
167 {
168 at32_led_toggle(LED2);
169 at32_led_toggle(LED3);
170 at32_led_toggle(LED4);
171 delay_sec(1);
172 }
173 }
174}
175
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
usart_configuration
void usart_configuration(void)
config usart
Definition project/at_start_f413/examples/usart/polling/src/main.c:57
buffer_compare
uint8_t buffer_compare(uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t buffer_length)
compares two buffers.
Definition project/at_start_f413/examples/usart/polling/src/main.c:117
usart3_tx_counter
uint8_t usart3_tx_counter
Definition project/at_start_f413/examples/usart/polling/src/main.c:46
usart2_tx_counter
uint8_t usart2_tx_counter
Definition project/at_start_f413/examples/usart/polling/src/main.c:45
usart2_tx_buffer_size
uint8_t usart2_tx_buffer_size
Definition project/at_start_f413/examples/usart/polling/src/main.c:49
usart3_rx_buffer
uint8_t usart3_rx_buffer[((sizeof(usart2_tx_buffer)/sizeof(*(usart2_tx_buffer))) - 1)]
Definition project/at_start_f413/examples/usart/polling/src/main.c:44
usart2_rx_counter
uint8_t usart2_rx_counter
Definition project/at_start_f413/examples/usart/polling/src/main.c:47
USART2_TX_BUFFER_SIZE
#define USART2_TX_BUFFER_SIZE
Definition project/at_start_f413/examples/usart/polling/src/main.c:38
main
int main(void)
main function.
Definition project/at_start_f413/examples/usart/polling/src/main.c:136
usart3_tx_buffer_size
uint8_t usart3_tx_buffer_size
Definition project/at_start_f413/examples/usart/polling/src/main.c:50
usart2_tx_buffer
uint8_t usart2_tx_buffer[]
Definition project/at_start_f413/examples/usart/polling/src/main.c:41
USART3_TX_BUFFER_SIZE
#define USART3_TX_BUFFER_SIZE
Definition project/at_start_f413/examples/usart/polling/src/main.c:39
usart3_tx_buffer
uint8_t usart3_tx_buffer[]
Definition project/at_start_f413/examples/usart/polling/src/main.c:42
usart3_rx_counter
uint8_t usart3_rx_counter
Definition project/at_start_f413/examples/usart/polling/src/main.c:48
usart2_rx_buffer
uint8_t usart2_rx_buffer[((sizeof(usart3_tx_buffer)/sizeof(*(usart3_tx_buffer))) - 1)]
Definition project/at_start_f413/examples/usart/polling/src/main.c:43
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
delay_sec
void delay_sec(uint16_t sec)
inserts a delay time.
Definition at32f413_board.c:382
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_USART3_PERIPH_CLOCK
@ CRM_USART3_PERIPH_CLOCK
Definition at32f413_crm.h:132
CRM_GPIOB_PERIPH_CLOCK
@ CRM_GPIOB_PERIPH_CLOCK
Definition at32f413_crm.h:110
CRM_USART2_PERIPH_CLOCK
@ CRM_USART2_PERIPH_CLOCK
Definition at32f413_crm.h:131
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_PULL_UP
@ GPIO_PULL_UP
Definition at32f413_gpio.h:244
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_10
#define GPIO_PINS_10
Definition at32f413_gpio.h:60
GPIO_PINS_11
#define GPIO_PINS_11
Definition at32f413_gpio.h:61
GPIO_PINS_2
#define GPIO_PINS_2
Definition at32f413_gpio.h:52
GPIO_PINS_3
#define GPIO_PINS_3
Definition at32f413_gpio.h:53
GPIOB
#define GPIOB
Definition at32f413_gpio.h:748
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
usart_data_transmit
void usart_data_transmit(usart_type *usart_x, uint16_t data)
transmit single data through the usart peripheral.
Definition at32f413_usart.c:380
usart_parity_selection_config
void usart_parity_selection_config(usart_type *usart_x, usart_parity_selection_type parity)
usart parity selection config.
Definition at32f413_usart.c:144
usart_flag_get
flag_status usart_flag_get(usart_type *usart_x, uint32_t flag)
check whether the specified usart flag is set or not.
Definition at32f413_usart.c:565
usart_transmitter_enable
void usart_transmitter_enable(usart_type *usart_x, confirm_state new_state)
usart transmitter enable.
Definition at32f413_usart.c:185
usart_init
void usart_init(usart_type *usart_x, uint32_t baud_rate, usart_data_bit_num_type data_bit, usart_stop_bit_num_type stop_bit)
initialize the usart peripheral according to the specified parameters.
Definition at32f413_usart.c:105
usart_enable
void usart_enable(usart_type *usart_x, confirm_state new_state)
enable or disable the specified usart peripheral.
Definition at32f413_usart.c:172
usart_receiver_enable
void usart_receiver_enable(usart_type *usart_x, confirm_state new_state)
usart receiver enable.
Definition at32f413_usart.c:198
usart_data_receive
uint16_t usart_data_receive(usart_type *usart_x)
return the most recent received data by the usart peripheral.
Definition at32f413_usart.c:392
USART_STOP_1_BIT
@ USART_STOP_1_BIT
Definition at32f413_usart.h:157
USART_DATA_8BITS
@ USART_DATA_8BITS
Definition at32f413_usart.h:112
USART_PARITY_NONE
@ USART_PARITY_NONE
Definition at32f413_usart.h:93
USART_TDBE_FLAG
#define USART_TDBE_FLAG
Definition at32f413_usart.h:58
USART_RDBF_FLAG
#define USART_RDBF_FLAG
Definition at32f413_usart.h:56
USART2
#define USART2
Definition at32f413_usart.h:319
at32f413_clock.h
header file of clock program
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • usart
  • printf
  • inc
project/at_start_f413/examples/usart/printf/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • usart
  • printf
  • inc
project/at_start_f413/examples/usart/printf/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • usart
  • printf
  • inc
project/at_start_f413/examples/usart/printf/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • usart
  • printf
  • src
project/at_start_f413/examples/usart/printf/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/usart/printf/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • usart
  • printf
  • src
project/at_start_f413/examples/usart/printf/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/usart/printf/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/usart/printf/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/usart/printf/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/usart/printf/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/usart/printf/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/usart/printf/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/usart/printf/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/usart/printf/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/usart/printf/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • usart
  • printf
  • src
project/at_start_f413/examples/usart/printf/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37__IO uint32_t time_cnt = 0;
38
44int main(void)
45{
46 system_clock_config();
47 at32_board_init();
48 uart_print_init(115200);
49
50 /* output a message on hyperterminal using printf function */
51 printf("usart printf example: retarget the c library printf function to the usart\r\n");
52
53 while(1)
54 {
55 printf("usart printf counter: %u\r\n",time_cnt++);
56 delay_sec(1);
57 }
58}
59
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
main
int main(void)
main function.
Definition project/at_start_f413/examples/usart/printf/src/main.c:44
time_cnt
__IO uint32_t time_cnt
Definition project/at_start_f413/examples/usart/printf/src/main.c:37
uart_print_init
void uart_print_init(uint32_t baudrate)
initialize uart
Definition at32f413_board.c:129
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
delay_sec
void delay_sec(uint16_t sec)
inserts a delay time.
Definition at32f413_board.c:382
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • usart
  • receiver_mute
  • inc
project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • usart
  • receiver_mute
  • inc
project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • usart
  • receiver_mute
  • inc
project/at_start_f413/examples/usart/receiver_mute/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • usart
  • receiver_mute
  • src
project/at_start_f413/examples/usart/receiver_mute/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/usart/receiver_mute/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • usart
  • receiver_mute
  • src
project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
29extern uint8_t usart3_rx_buffer[];
30extern uint8_t rx_counter;
31
45void NMI_Handler(void)
46{
47}
48
54void HardFault_Handler(void)
55{
56 /* go to infinite loop when hard fault exception occurs */
57 while(1)
58 {
59 }
60}
61
67void MemManage_Handler(void)
68{
69 /* go to infinite loop when memory manage exception occurs */
70 while(1)
71 {
72 }
73}
74
80void BusFault_Handler(void)
81{
82 /* go to infinite loop when bus fault exception occurs */
83 while(1)
84 {
85 }
86}
87
93void UsageFault_Handler(void)
94{
95 /* go to infinite loop when usage fault exception occurs */
96 while(1)
97 {
98 }
99}
100
106void SVC_Handler(void)
107{
108}
109
115void DebugMon_Handler(void)
116{
117}
118
124void PendSV_Handler(void)
125{
126}
127
133void SysTick_Handler(void)
134{
135}
136
142void USART3_IRQHandler(void)
143{
144 if(usart_interrupt_flag_get(USART3, USART_RDBF_FLAG) != RESET)
145 {
146 usart3_rx_buffer[rx_counter++] = usart_data_receive(USART3);
147 }
148}
149
usart3_rx_buffer
uint8_t usart3_rx_buffer[]
Definition project/at_start_f413/examples/usart/half_duplex/src/main.c:44
USART3_IRQHandler
void USART3_IRQHandler(void)
this function handles usart3 handler.
Definition project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c:142
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c:93
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c:54
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c:67
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c:106
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c:124
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c:45
rx_counter
uint8_t rx_counter
Definition project/at_start_f413/examples/usart/receiver_mute/src/main.c:48
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c:80
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c:133
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/usart/receiver_mute/src/at32f413_int.c:115
RESET
@ RESET
Definition at32f413.h:292
usart_data_receive
uint16_t usart_data_receive(usart_type *usart_x)
return the most recent received data by the usart peripheral.
Definition at32f413_usart.c:392
usart_interrupt_flag_get
flag_status usart_interrupt_flag_get(usart_type *usart_x, uint32_t flag)
check whether the specified usart interrupt flag is set or not.
Definition at32f413_usart.c:596
USART_RDBF_FLAG
#define USART_RDBF_FLAG
Definition at32f413_usart.h:56
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • usart
  • receiver_mute
  • src
project/at_start_f413/examples/usart/receiver_mute/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37#define BUFFER_SIZE 7
38#define MATCH_ID_VAL 0x81
39#define ERROR_ID_VAL 0x82
40#define DATA1_VAL 0x7F
41#define DATA2_VAL 0x7A
42#define DATA3_VAL 0x7B
43#define DATA4_VAL 0x7C
44
45uint8_t usart2_tx_buffer[BUFFER_SIZE] = {DATA1_VAL, MATCH_ID_VAL, DATA2_VAL, ERROR_ID_VAL, DATA3_VAL, MATCH_ID_VAL, DATA4_VAL};
46uint8_t usart3_rx_buffer[BUFFER_SIZE];
47uint8_t tx_counter = 0;
48uint8_t rx_counter = 0;
49
55void usart_configuration(void)
56{
57 gpio_init_type gpio_init_struct;
58
59 /* enable the usart2 and gpio clock */
60 crm_periph_clock_enable(CRM_USART2_PERIPH_CLOCK, TRUE);
61 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
62
63 /* enable the usart3 and gpio clock */
64 crm_periph_clock_enable(CRM_USART3_PERIPH_CLOCK, TRUE);
65 crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
66
67 gpio_default_para_init(&gpio_init_struct);
68
69 /* configure the usart2 tx pin */
70 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
71 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
72 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
73 gpio_init_struct.gpio_pins = GPIO_PINS_2;
74 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
75 gpio_init(GPIOA, &gpio_init_struct);
76
77 /* configure the usart3 rx pin */
78 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
79 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
80 gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
81 gpio_init_struct.gpio_pins = GPIO_PINS_11;
82 gpio_init_struct.gpio_pull = GPIO_PULL_UP;
83 gpio_init(GPIOB, &gpio_init_struct);
84
85 /* configure usart2 param */
86 usart_init(USART2, 115200, USART_DATA_8BITS, USART_STOP_1_BIT);
87 usart_transmitter_enable(USART2, TRUE);
88 usart_enable(USART2, TRUE);
89
90 /* config usart3 nvic interrupt */
91 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
92 nvic_irq_enable(USART3_IRQn, 0 ,0);
93
94 /* configure usart3 param */
95 usart_init(USART3, 115200, USART_DATA_8BITS, USART_STOP_1_BIT);
96 usart_receiver_enable(USART3, TRUE);
97 usart_interrupt_enable(USART3, USART_RDBF_INT, TRUE);
98 usart_wakeup_id_set(USART3, 0x01);
99 usart_wakeup_mode_set(USART3, USART_WAKEUP_BY_MATCHING_ID);
100 usart_receiver_mute_enable(USART3, TRUE);
101 usart_enable(USART3, TRUE);
102}
103
109int main(void)
110{
111 system_clock_config();
112 at32_board_init();
113 usart_configuration();
114
115 /* usart2 transmit data */
116 while(tx_counter < BUFFER_SIZE)
117 {
118 while(usart_flag_get(USART2, USART_TDBE_FLAG) == RESET);
119 usart_data_transmit(USART2, usart2_tx_buffer[tx_counter++]);
120 }
121
122 /* wait usart2 data transmission complete */
123 while(usart_flag_get(USART2, USART_TDC_FLAG) == RESET);
124
125 while(1)
126 {
127 if((usart3_rx_buffer[0] == MATCH_ID_VAL) && (usart3_rx_buffer[1] == DATA2_VAL) && \
128 (usart3_rx_buffer[2] == MATCH_ID_VAL) && (usart3_rx_buffer[3] == DATA4_VAL))
129 {
130 at32_led_toggle(LED2);
131 at32_led_toggle(LED3);
132 at32_led_toggle(LED4);
133 delay_sec(1);
134 }
135 }
136}
137
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
DATA4_VAL
#define DATA4_VAL
Definition project/at_start_f413/examples/usart/receiver_mute/src/main.c:43
usart_configuration
void usart_configuration(void)
config usart
Definition project/at_start_f413/examples/usart/receiver_mute/src/main.c:55
usart2_tx_buffer
uint8_t usart2_tx_buffer[7]
Definition project/at_start_f413/examples/usart/receiver_mute/src/main.c:45
ERROR_ID_VAL
#define ERROR_ID_VAL
Definition project/at_start_f413/examples/usart/receiver_mute/src/main.c:39
tx_counter
uint8_t tx_counter
Definition project/at_start_f413/examples/usart/receiver_mute/src/main.c:47
BUFFER_SIZE
#define BUFFER_SIZE
Definition project/at_start_f413/examples/usart/receiver_mute/src/main.c:37
rx_counter
uint8_t rx_counter
Definition project/at_start_f413/examples/usart/receiver_mute/src/main.c:48
main
int main(void)
main function.
Definition project/at_start_f413/examples/usart/receiver_mute/src/main.c:109
DATA2_VAL
#define DATA2_VAL
Definition project/at_start_f413/examples/usart/receiver_mute/src/main.c:41
DATA3_VAL
#define DATA3_VAL
Definition project/at_start_f413/examples/usart/receiver_mute/src/main.c:42
MATCH_ID_VAL
#define MATCH_ID_VAL
Definition project/at_start_f413/examples/usart/receiver_mute/src/main.c:38
usart3_rx_buffer
uint8_t usart3_rx_buffer[7]
Definition project/at_start_f413/examples/usart/receiver_mute/src/main.c:46
DATA1_VAL
#define DATA1_VAL
Definition project/at_start_f413/examples/usart/receiver_mute/src/main.c:40
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
delay_sec
void delay_sec(uint16_t sec)
inserts a delay time.
Definition at32f413_board.c:382
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_USART3_PERIPH_CLOCK
@ CRM_USART3_PERIPH_CLOCK
Definition at32f413_crm.h:132
CRM_GPIOB_PERIPH_CLOCK
@ CRM_GPIOB_PERIPH_CLOCK
Definition at32f413_crm.h:110
CRM_USART2_PERIPH_CLOCK
@ CRM_USART2_PERIPH_CLOCK
Definition at32f413_crm.h:131
USART3_IRQn
@ USART3_IRQn
Definition at32f413.h:211
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_PULL_UP
@ GPIO_PULL_UP
Definition at32f413_gpio.h:244
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_11
#define GPIO_PINS_11
Definition at32f413_gpio.h:61
GPIO_PINS_2
#define GPIO_PINS_2
Definition at32f413_gpio.h:52
GPIOB
#define GPIOB
Definition at32f413_gpio.h:748
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
usart_data_transmit
void usart_data_transmit(usart_type *usart_x, uint16_t data)
transmit single data through the usart peripheral.
Definition at32f413_usart.c:380
usart_flag_get
flag_status usart_flag_get(usart_type *usart_x, uint32_t flag)
check whether the specified usart flag is set or not.
Definition at32f413_usart.c:565
usart_wakeup_id_set
void usart_wakeup_id_set(usart_type *usart_x, uint8_t usart_id)
set the wakeup id of the usart.
Definition at32f413_usart.c:307
usart_transmitter_enable
void usart_transmitter_enable(usart_type *usart_x, confirm_state new_state)
usart transmitter enable.
Definition at32f413_usart.c:185
usart_init
void usart_init(usart_type *usart_x, uint32_t baud_rate, usart_data_bit_num_type data_bit, usart_stop_bit_num_type stop_bit)
initialize the usart peripheral according to the specified parameters.
Definition at32f413_usart.c:105
usart_enable
void usart_enable(usart_type *usart_x, confirm_state new_state)
enable or disable the specified usart peripheral.
Definition at32f413_usart.c:172
usart_receiver_enable
void usart_receiver_enable(usart_type *usart_x, confirm_state new_state)
usart receiver enable.
Definition at32f413_usart.c:198
usart_wakeup_mode_set
void usart_wakeup_mode_set(usart_type *usart_x, usart_wakeup_mode_type wakeup_mode)
select the usart wakeup method in multi-processor communication.
Definition at32f413_usart.c:323
usart_interrupt_enable
void usart_interrupt_enable(usart_type *usart_x, uint32_t usart_int, confirm_state new_state)
enable or disable the specified usart interrupts.
Definition at32f413_usart.c:263
usart_receiver_mute_enable
void usart_receiver_mute_enable(usart_type *usart_x, confirm_state new_state)
config the usart in mute mode in multi-processor communication.
Definition at32f413_usart.c:337
USART_STOP_1_BIT
@ USART_STOP_1_BIT
Definition at32f413_usart.h:157
USART_DATA_8BITS
@ USART_DATA_8BITS
Definition at32f413_usart.h:112
USART_WAKEUP_BY_MATCHING_ID
@ USART_WAKEUP_BY_MATCHING_ID
Definition at32f413_usart.h:104
USART_TDBE_FLAG
#define USART_TDBE_FLAG
Definition at32f413_usart.h:58
USART_TDC_FLAG
#define USART_TDC_FLAG
Definition at32f413_usart.h:57
USART_RDBF_INT
#define USART_RDBF_INT
Definition at32f413_usart.h:72
USART2
#define USART2
Definition at32f413_usart.h:319
at32f413_clock.h
header file of clock program
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • usart
  • rs485
  • inc
project/at_start_f413/examples/usart/rs485/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • usart
  • rs485
  • inc
project/at_start_f413/examples/usart/rs485/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • usart
  • rs485
  • inc
project/at_start_f413/examples/usart/rs485/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • usart
  • rs485
  • src
project/at_start_f413/examples/usart/rs485/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/usart/rs485/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • usart
  • rs485
  • src
project/at_start_f413/examples/usart/rs485/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/usart/rs485/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/usart/rs485/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/usart/rs485/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/usart/rs485/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/usart/rs485/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/usart/rs485/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/usart/rs485/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/usart/rs485/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/usart/rs485/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • usart
  • rs485
  • src
project/at_start_f413/examples/usart/rs485/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37#define RS485_BAUDRATE 9600
38#define RS485_BUFFER_SIZE 128
39
40uint8_t rs485_buffer_rx[RS485_BUFFER_SIZE];
41uint8_t rs485_buffer_rx_cnt = 0;
42
48static void rs485_config(void)
49{
50 gpio_init_type gpio_init_struct;
51
52 /* enable the uart2 and gpio clock */
53 crm_periph_clock_enable(CRM_USART2_PERIPH_CLOCK, TRUE);
54 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
55
56 gpio_default_para_init(&gpio_init_struct);
57
58 /* configure the uart2 tx,rx,de pin */
59 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
60 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
61 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
62 gpio_init_struct.gpio_pins = GPIO_PINS_2;
63 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
64 gpio_init(GPIOA, &gpio_init_struct);
65
66 gpio_init_struct.gpio_pins = GPIO_PINS_3;
67 gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
68 gpio_init_struct.gpio_pull = GPIO_PULL_UP;
69 gpio_init(GPIOA, &gpio_init_struct);
70
71 gpio_init_struct.gpio_pins = GPIO_PINS_1;
72 gpio_init_struct.gpio_mode = GPIO_MODE_OUTPUT;
73 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
74 gpio_init(GPIOA, &gpio_init_struct);
75
76 gpio_bits_reset(GPIOA, GPIO_PINS_1);
77
78 /* configure uart2 param */
79 usart_init(USART2, RS485_BAUDRATE, USART_DATA_8BITS, USART_STOP_1_BIT);
80
81 usart_flag_clear(USART2, USART_RDBF_FLAG);
82 usart_interrupt_enable(USART2, USART_RDBF_INT, TRUE);
83
84 usart_receiver_enable(USART2, TRUE);
85 usart_transmitter_enable(USART2, TRUE);
86 usart_enable(USART2, TRUE);
87
88 nvic_irq_enable(USART2_IRQn, 1, 0);
89}
90
97static void rs485_send_data(u8* buf, u8 cnt)
98{
99 gpio_bits_set(GPIOA, GPIO_PINS_1);
100 while(cnt--){
101 while(usart_flag_get(USART2, USART_TDBE_FLAG) == RESET);
102 usart_data_transmit(USART2, *buf++);
103 }
104 while(usart_flag_get(USART2, USART_TDC_FLAG) == RESET);
105 gpio_bits_reset(GPIOA, GPIO_PINS_1);
106}
107
113int main(void)
114{
115 char str[]="start test..\r\n";
116 u8 len = 0;
117
118 system_clock_config();
119 at32_board_init();
120 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
121
122 rs485_config();
123
124 len = sizeof(str);
125 rs485_send_data((u8*)str, len);
126 while(1)
127 {
128 if(usart_flag_get(USART2, USART_IDLEF_FLAG) != RESET)
129 {
130 usart_data_receive(USART2);
131 usart_interrupt_enable(USART2, USART_RDBF_INT, FALSE);
132 rs485_send_data(rs485_buffer_rx, rs485_buffer_rx_cnt);
133 rs485_buffer_rx_cnt = 0;
134 usart_interrupt_enable(USART2, USART_RDBF_INT, TRUE);
135 }
136 }
137}
138
144void USART2_IRQHandler(void)
145{
146 uint16_t tmp;
147
148 if(usart_interrupt_flag_get(USART2, USART_RDBF_FLAG) != RESET)
149 {
150 tmp = usart_data_receive(USART2);
151 if(rs485_buffer_rx_cnt < RS485_BUFFER_SIZE)
152 {
153 rs485_buffer_rx[rs485_buffer_rx_cnt++] = tmp;
154 }
155 }
156}
157
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_USART2_PERIPH_CLOCK
@ CRM_USART2_PERIPH_CLOCK
Definition at32f413_crm.h:131
USART2_IRQn
@ USART2_IRQn
Definition at32f413.h:210
u8
uint8_t u8
Definition at32f413.h:275
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
USART2_IRQHandler
void USART2_IRQHandler(void)
usart2 interrupt handler
Definition project/at_start_f413/examples/usart/rs485/src/main.c:144
rs485_send_data
static void rs485_send_data(u8 *buf, u8 cnt)
rs485 send data
Definition project/at_start_f413/examples/usart/rs485/src/main.c:97
RS485_BAUDRATE
#define RS485_BAUDRATE
Definition project/at_start_f413/examples/usart/rs485/src/main.c:37
rs485_config
static void rs485_config(void)
rs485 configiguration.
Definition project/at_start_f413/examples/usart/rs485/src/main.c:48
main
int main(void)
main function.
Definition project/at_start_f413/examples/usart/rs485/src/main.c:113
rs485_buffer_rx
uint8_t rs485_buffer_rx[128]
Definition project/at_start_f413/examples/usart/rs485/src/main.c:40
RS485_BUFFER_SIZE
#define RS485_BUFFER_SIZE
Definition project/at_start_f413/examples/usart/rs485/src/main.c:38
rs485_buffer_rx_cnt
uint8_t rs485_buffer_rx_cnt
Definition project/at_start_f413/examples/usart/rs485/src/main.c:41
gpio_bits_reset
void gpio_bits_reset(gpio_type *gpio_x, uint16_t pins)
clear the selected data port bits.
Definition at32f413_gpio.c:340
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_bits_set
void gpio_bits_set(gpio_type *gpio_x, uint16_t pins)
set the selected data port bits.
Definition at32f413_gpio.c:309
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_MODE_OUTPUT
@ GPIO_MODE_OUTPUT
Definition at32f413_gpio.h:214
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_PULL_UP
@ GPIO_PULL_UP
Definition at32f413_gpio.h:244
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_2
#define GPIO_PINS_2
Definition at32f413_gpio.h:52
GPIO_PINS_3
#define GPIO_PINS_3
Definition at32f413_gpio.h:53
GPIO_PINS_1
#define GPIO_PINS_1
Definition at32f413_gpio.h:51
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
usart_data_transmit
void usart_data_transmit(usart_type *usart_x, uint16_t data)
transmit single data through the usart peripheral.
Definition at32f413_usart.c:380
usart_flag_get
flag_status usart_flag_get(usart_type *usart_x, uint32_t flag)
check whether the specified usart flag is set or not.
Definition at32f413_usart.c:565
usart_transmitter_enable
void usart_transmitter_enable(usart_type *usart_x, confirm_state new_state)
usart transmitter enable.
Definition at32f413_usart.c:185
usart_init
void usart_init(usart_type *usart_x, uint32_t baud_rate, usart_data_bit_num_type data_bit, usart_stop_bit_num_type stop_bit)
initialize the usart peripheral according to the specified parameters.
Definition at32f413_usart.c:105
usart_enable
void usart_enable(usart_type *usart_x, confirm_state new_state)
enable or disable the specified usart peripheral.
Definition at32f413_usart.c:172
usart_receiver_enable
void usart_receiver_enable(usart_type *usart_x, confirm_state new_state)
usart receiver enable.
Definition at32f413_usart.c:198
usart_flag_clear
void usart_flag_clear(usart_type *usart_x, uint32_t flag)
clear the usart's pending flags.
Definition at32f413_usart.c:675
usart_interrupt_enable
void usart_interrupt_enable(usart_type *usart_x, uint32_t usart_int, confirm_state new_state)
enable or disable the specified usart interrupts.
Definition at32f413_usart.c:263
usart_data_receive
uint16_t usart_data_receive(usart_type *usart_x)
return the most recent received data by the usart peripheral.
Definition at32f413_usart.c:392
usart_interrupt_flag_get
flag_status usart_interrupt_flag_get(usart_type *usart_x, uint32_t flag)
check whether the specified usart interrupt flag is set or not.
Definition at32f413_usart.c:596
USART_STOP_1_BIT
@ USART_STOP_1_BIT
Definition at32f413_usart.h:157
USART_DATA_8BITS
@ USART_DATA_8BITS
Definition at32f413_usart.h:112
USART_IDLEF_FLAG
#define USART_IDLEF_FLAG
Definition at32f413_usart.h:55
USART_TDBE_FLAG
#define USART_TDBE_FLAG
Definition at32f413_usart.h:58
USART_TDC_FLAG
#define USART_TDC_FLAG
Definition at32f413_usart.h:57
USART_RDBF_FLAG
#define USART_RDBF_FLAG
Definition at32f413_usart.h:56
USART_RDBF_INT
#define USART_RDBF_INT
Definition at32f413_usart.h:72
USART2
#define USART2
Definition at32f413_usart.h:319
at32f413_clock.h
header file of clock program
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • usart
  • smartcard
  • inc
project/at_start_f413/examples/usart/smartcard/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • usart
  • smartcard
  • inc
project/at_start_f413/examples/usart/smartcard/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • usart
  • smartcard
  • inc
project/at_start_f413/examples/usart/smartcard/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • usart
  • smartcard
  • src
project/at_start_f413/examples/usart/smartcard/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/usart/smartcard/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • usart
  • smartcard
  • src
project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28#include "smartcard_config.h"
29
30extern uint32_t card_inserted;
31
45void NMI_Handler(void)
46{
47}
48
54void HardFault_Handler(void)
55{
56 /* go to infinite loop when hard fault exception occurs */
57 while(1)
58 {
59 }
60}
61
67void MemManage_Handler(void)
68{
69 /* go to infinite loop when memory manage exception occurs */
70 while(1)
71 {
72 }
73}
74
80void BusFault_Handler(void)
81{
82 /* go to infinite loop when bus fault exception occurs */
83 while(1)
84 {
85 }
86}
87
93void UsageFault_Handler(void)
94{
95 /* go to infinite loop when usage fault exception occurs */
96 while(1)
97 {
98 }
99}
100
106void SVC_Handler(void)
107{
108}
109
115void DebugMon_Handler(void)
116{
117}
118
124void PendSV_Handler(void)
125{
126}
127
133void SysTick_Handler(void)
134{
135}
136
142void EXINT9_5_IRQHandler(void)
143{
144 /* reset smart card cmdvcc */
145 gpio_bits_reset(SC_CMDVCC_PORT, SC_CMDVCC_PIN);
146
147 /* rst low */
148 gpio_bits_reset(SC_RESET_PORT, SC_RESET_PIN);
149
150 /* rst high */
151 gpio_bits_set(SC_RESET_PORT, SC_RESET_PIN);
152
153 /* clear sc exint line pending bit */
154 exint_flag_clear(SC_OFF_EXINT);
155
156 /* smart card detected */
157 card_inserted = 1;
158}
159
165void SC_USART_IRQHandler(void)
166{
167 /* if the sc_usart detects a parity error */
168 if(usart_interrupt_flag_get(SC_USART, USART_PERR_FLAG) != RESET)
169 {
170 /* enable sc_usart rdbf interrupt (until receiving the corrupted byte) */
171 usart_interrupt_enable(SC_USART, USART_RDBF_INT, TRUE);
172 /* flush the sc_usart dr register */
173 usart_data_receive(SC_USART);
174 }
175
176 if(usart_interrupt_flag_get(SC_USART, USART_RDBF_FLAG) != RESET)
177 {
178 /* disable sc_usart rdbf interrupt */
179 usart_interrupt_enable(SC_USART, USART_RDBF_INT, FALSE);
180 usart_data_receive(SC_USART);
181 }
182}
183
EXINT9_5_IRQHandler
void EXINT9_5_IRQHandler(void)
this function handles external lines 9 to 5 interrupt request.
Definition project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c:142
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c:93
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c:54
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c:67
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c:106
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c:124
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c:45
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c:80
card_inserted
uint32_t card_inserted
Definition project/at_start_f413/examples/usart/smartcard/src/main.c:62
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c:133
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/usart/smartcard/src/at32f413_int.c:115
exint_flag_clear
void exint_flag_clear(uint32_t exint_line)
clear exint flag
Definition at32f413_exint.c:125
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
gpio_bits_reset
void gpio_bits_reset(gpio_type *gpio_x, uint16_t pins)
clear the selected data port bits.
Definition at32f413_gpio.c:340
gpio_bits_set
void gpio_bits_set(gpio_type *gpio_x, uint16_t pins)
set the selected data port bits.
Definition at32f413_gpio.c:309
usart_interrupt_enable
void usart_interrupt_enable(usart_type *usart_x, uint32_t usart_int, confirm_state new_state)
enable or disable the specified usart interrupts.
Definition at32f413_usart.c:263
usart_data_receive
uint16_t usart_data_receive(usart_type *usart_x)
return the most recent received data by the usart peripheral.
Definition at32f413_usart.c:392
usart_interrupt_flag_get
flag_status usart_interrupt_flag_get(usart_type *usart_x, uint32_t flag)
check whether the specified usart interrupt flag is set or not.
Definition at32f413_usart.c:596
USART_PERR_FLAG
#define USART_PERR_FLAG
Definition at32f413_usart.h:51
USART_RDBF_FLAG
#define USART_RDBF_FLAG
Definition at32f413_usart.h:56
USART_RDBF_INT
#define USART_RDBF_INT
Definition at32f413_usart.h:72
at32f413_int.h
header file of main interrupt service routines.
smartcard_config.h
header file of clock program
SC_RESET_PIN
#define SC_RESET_PIN
Definition smartcard_config.h:47
SC_RESET_PORT
#define SC_RESET_PORT
Definition smartcard_config.h:51
SC_OFF_EXINT
#define SC_OFF_EXINT
Definition smartcard_config.h:58
SC_USART
#define SC_USART
Definition smartcard_config.h:35
SC_CMDVCC_PORT
#define SC_CMDVCC_PORT
Definition smartcard_config.h:52
SC_USART_IRQHandler
#define SC_USART_IRQHandler
Definition smartcard_config.h:43
SC_CMDVCC_PIN
#define SC_CMDVCC_PIN
Definition smartcard_config.h:48


AT32F413 Firmwary Library: main.c Source File

  • usart
  • smartcard
  • src
project/at_start_f413/examples/usart/smartcard/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include "smartcard_config.h"
29
38#define T0_PROTOCOL 0x00 /* t0 protocol */
39#define SETUP_LENGTH 20
40#define HIST_LENGTH 20
41#define SC_RECEIVE_TIMEOUT 0xA000 /* direction to reader */
42
43#define SC_USART_DIV_VAL 20 /* ISO 7816-3 protocol: SC_CLOCK_FREQ(PCLK/(2*USART_DIV_VAL)) is between 1 and 5 MHz */
44#define SC_F_DIV_D 372 /* ISO 7816-3 protocol: F/D = 372 */
45
46/* atr structure - answer to reset */
47typedef struct
48{
49 uint8_t ts; /* bit convention */
50 uint8_t t0; /* high nibble = n. of setup byte; low nibble = n. of historical byte */
51 uint8_t t[SETUP_LENGTH]; /* setup array */
52 uint8_t h[HIST_LENGTH]; /* historical array */
53 uint8_t tlength; /* setup array dimension */
54 uint8_t hlength; /* historical array dimension */
55} sc_atr_type;
56
57 sc_atr_type sc_a2r_struct;
58uint32_t sc_baud_rate = 0;
59uint32_t sc_clock_freq = 0;
60uint32_t counter = 0;
61 error_status atr_decode_status = ERROR;
62uint32_t card_inserted = 0, card_protocol = 1;
63uint8_t dst_buffer[50]= {
64 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
65 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
66 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
67 };
68
74void usart_configuration(void)
75{
76 gpio_init_type gpio_init_struct;
77 exint_init_type exint_init_struct;
78 crm_clocks_freq_type crm_clocks_struct;
79
80 /* enable gpio_3_5v, sc_usart_gpio_clk, gpio_reset, gpio_cmdvcc, gpio_off and iomux clocks */
81 crm_periph_clock_enable(SC_3_5V_CLK, TRUE);
82 crm_periph_clock_enable(SC_USART_GPIO_CLK, TRUE);
83 crm_periph_clock_enable(SC_RESET_CLK, TRUE);
84 crm_periph_clock_enable(SC_CMDVCC_CLK, TRUE);
85 crm_periph_clock_enable(SC_OFF_CLK, TRUE);
86 crm_periph_clock_enable(CRM_IOMUX_PERIPH_CLOCK, TRUE);
87
88 /* enable sc_usart clocks */
89 crm_periph_clock_enable(SC_USART_CLK, TRUE);
90
91 gpio_default_para_init(&gpio_init_struct);
92 /* configure sc_usart ck pin */
93 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
94 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
95 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
96 gpio_init_struct.gpio_pins = SC_USART_CLK_PIN;
97 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
98 gpio_init(SC_USART_CLK_PORT, &gpio_init_struct);
99
100 /* configure sc_usart tx pin */
101 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
102 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_OPEN_DRAIN;
103 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
104 gpio_init_struct.gpio_pins = SC_USART_TX_PIN;
105 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
106 gpio_init(SC_USART_TX_PORT, &gpio_init_struct);
107
108 /* configure smartcard reset pin */
109 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
110 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
111 gpio_init_struct.gpio_mode = GPIO_MODE_OUTPUT;
112 gpio_init_struct.gpio_pins = SC_RESET_PIN;
113 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
114 gpio_init(SC_RESET_PORT, &gpio_init_struct);
115
116 /* set reset pin high */
117 gpio_bits_set(SC_RESET_PORT, SC_RESET_PIN);
118
119 /* configure smartcard 3/5v pin */
120 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
121 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
122 gpio_init_struct.gpio_mode = GPIO_MODE_OUTPUT;
123 gpio_init_struct.gpio_pins = SC_3_5V_PIN;
124 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
125 gpio_init(SC_3_5V_PORT, &gpio_init_struct);
126
127 /* select 5 v */
128 gpio_bits_set(SC_3_5V_PORT, SC_3_5V_PIN);
129
130 /* configure smartcard cmdvcc pin */
131 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
132 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
133 gpio_init_struct.gpio_mode = GPIO_MODE_OUTPUT;
134 gpio_init_struct.gpio_pins = SC_CMDVCC_PIN;
135 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
136 gpio_init(SC_CMDVCC_PORT, &gpio_init_struct);
137
138 /* set smartcard cmdvcc */
139 gpio_bits_set(SC_CMDVCC_PORT, SC_CMDVCC_PIN);
140
141 /* configure smartcard off pin */
142 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
143 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
144 gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
145 gpio_init_struct.gpio_pins = SC_OFF_PIN;
146 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
147 gpio_init(SC_OFF_PORT, &gpio_init_struct);
148
149 /* nvic interrupt init */
150 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
151 NVIC_ClearPendingIRQ(SC_OFF_EXINT_IRQ);
152 nvic_irq_enable(SC_OFF_EXINT_IRQ, 0, 0);
153 nvic_irq_enable(SC_USART_IRQn, 1, 0);
154
155 /* configure smartcard off exint */
156 gpio_exint_line_config(SC_OFF_PORTSOURCE, SC_OFF_PINSOURCE);
157
158 exint_default_para_init(&exint_init_struct);
159 exint_init_struct.line_mode = EXINT_LINE_INTERRUPT;
160 exint_init_struct.line_polarity = EXINT_TRIGGER_RISING_EDGE;
161 exint_init_struct.line_select = SC_OFF_EXINT;
162 exint_init_struct.line_enable = TRUE;
163 exint_init(&exint_init_struct);
164
165 /* clear sc exint line pending bit */
166 exint_flag_clear(SC_OFF_EXINT);
167
168 /* sc_usart clock set to (apbclk / (2 * SC_USART_DIV_VAL)) */
169 usart_irda_smartcard_division_set(SC_USART, SC_USART_DIV_VAL);
170 /* sc_usart guard time set to 2 bit */
171 usart_smartcard_guard_time_set(SC_USART, 0x2);
172
173 /* configure sc usart clk */
174 usart_clock_enable(SC_USART, TRUE);
175
176 crm_clocks_freq_get(&crm_clocks_struct);
177 sc_clock_freq = crm_clocks_struct.apb1_freq / (2 * SC_USART_DIV_VAL); /* ISO 7816-3 protocol: the CLK frequency is between 1 and 5 MHz */
178 sc_baud_rate = sc_clock_freq / SC_F_DIV_D;
179 /* configure sc usart param */
180 usart_init(SC_USART, sc_baud_rate, USART_DATA_9BITS, USART_STOP_1_5_BIT);
181 usart_parity_selection_config(SC_USART, USART_PARITY_EVEN);
182 usart_transmitter_enable(SC_USART, TRUE);
183 usart_receiver_enable(SC_USART, TRUE);
184
185 /* enable the sc_usart parity error interrupt */
186 usart_interrupt_enable(SC_USART, USART_PERR_INT, TRUE);
187 usart_enable(SC_USART, TRUE);
188
189 /* enable the nack transmission */
190 usart_smartcard_nack_set(SC_USART, TRUE);
191
192 /* enable the smartcard mode */
193 usart_smartcard_mode_enable(SC_USART, TRUE);
194}
195
201uint8_t sc_response_decode(__IO uint8_t *card)
202{
203 uint32_t i = 0, flag = 0, buf = 0, protocol = 0;
204
205 sc_a2r_struct.ts = 0;
206 sc_a2r_struct.t0 = 0;
207 for(i = 0; i < SETUP_LENGTH; i++)
208 {
209 sc_a2r_struct.t[i] = 0;
210 }
211 for(i = 0;i < HIST_LENGTH; i++)
212 {
213 sc_a2r_struct.h[i] = 0;
214 }
215 sc_a2r_struct.tlength = 0;
216 sc_a2r_struct.hlength = 0;
217
218 /* initial character */
219 sc_a2r_struct.ts = card[0];
220
221 /* format character */
222 sc_a2r_struct.t0 = card[1];
223
224 sc_a2r_struct.hlength = sc_a2r_struct.t0 & 0x0F;
225
226 if((sc_a2r_struct.t0 & 0x80) == 0x80) flag = 1;
227
228 for(i = 0; i < 4; i++)
229 {
230 sc_a2r_struct.tlength = sc_a2r_struct.tlength + (((sc_a2r_struct.t0 & 0xF0) >> (4 + i)) & 0x1);
231 }
232
233 for(i = 0; i < sc_a2r_struct.tlength; i++)
234 {
235 sc_a2r_struct.t[i] = card[i + 2];
236 }
237
238 protocol = sc_a2r_struct.t[sc_a2r_struct.tlength - 1] & 0x0F;
239
240 while(flag)
241 {
242 if((sc_a2r_struct.t[sc_a2r_struct.tlength - 1] & 0x80)== 0x80)
243 {
244 flag = 1;
245 }
246 else
247 {
248 flag = 0;
249 }
250 buf = sc_a2r_struct.tlength;
251 sc_a2r_struct.tlength = 0;
252
253 for(i = 0; i < 4; i++)
254 {
255 sc_a2r_struct.tlength = sc_a2r_struct.tlength + (((sc_a2r_struct.t[buf - 1] & 0xF0) >> (4 + i)) & 0x1);
256 }
257 for(i = 0; i < sc_a2r_struct.tlength; i++)
258 {
259 sc_a2r_struct.t[buf + i] = card[i + 2 + buf];
260 }
261 sc_a2r_struct.tlength += buf;
262 }
263
264 for(i = 0;i < sc_a2r_struct.hlength; i++)
265 {
266 sc_a2r_struct.h[i] = card[i + 2 + sc_a2r_struct.tlength];
267 }
268
269 return ((uint8_t)protocol);
270}
271
277int main(void)
278{
279 uint32_t index = 0;
280 system_clock_config();
281 at32_board_init();
282 usart_configuration();
283
284 /* loop while no smartcard is detected */
285 while(card_inserted == 0)
286 {
287 }
288
289 /* read smartcard atr response */
290 for(index = 0; index < 40; index++, counter = 0)
291 {
292 while((usart_flag_get(SC_USART, USART_RDBF_FLAG) == RESET) && (counter != SC_RECEIVE_TIMEOUT))
293 {
294 counter++;
295 }
296
297 if(counter != SC_RECEIVE_TIMEOUT)
298 {
299 dst_buffer[index] = usart_data_receive(SC_USART);
300 }
301 }
302
303 /* decode atr */
304 card_protocol = sc_response_decode(dst_buffer);
305
306 /* test if the inserted card is iso7816-3 t=0 compatible */
307 if(card_protocol == 0)
308 {
309 /* inserted card is iso7816-3 t=0 compatible */
310 atr_decode_status = SUCCESS;
311 }
312 else
313 {
314 /* inserted smartcard is not iso7816-3 t=0 compatible */
315 atr_decode_status = ERROR;
316 }
317
318 /* judge whether the result is correct */
319 if(atr_decode_status == SUCCESS)
320 {
321 /* trun on the led */
322 at32_led_on(LED2);
323 at32_led_on(LED3);
324 at32_led_on(LED4);
325 }
326
327 while(1)
328 {
329 }
330}
331
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
sc_baud_rate
uint32_t sc_baud_rate
Definition project/at_start_f413/examples/usart/smartcard/src/main.c:58
usart_configuration
void usart_configuration(void)
config usart
Definition project/at_start_f413/examples/usart/smartcard/src/main.c:74
sc_response_decode
uint8_t sc_response_decode(__IO uint8_t *card)
decode the card atr response.
Definition project/at_start_f413/examples/usart/smartcard/src/main.c:201
card_protocol
uint32_t card_protocol
Definition project/at_start_f413/examples/usart/smartcard/src/main.c:62
counter
uint32_t counter
Definition project/at_start_f413/examples/usart/smartcard/src/main.c:60
SETUP_LENGTH
#define SETUP_LENGTH
Definition project/at_start_f413/examples/usart/smartcard/src/main.c:39
SC_USART_DIV_VAL
#define SC_USART_DIV_VAL
Definition project/at_start_f413/examples/usart/smartcard/src/main.c:43
sc_a2r_struct
sc_atr_type sc_a2r_struct
Definition project/at_start_f413/examples/usart/smartcard/src/main.c:57
SC_F_DIV_D
#define SC_F_DIV_D
Definition project/at_start_f413/examples/usart/smartcard/src/main.c:44
atr_decode_status
error_status atr_decode_status
Definition project/at_start_f413/examples/usart/smartcard/src/main.c:61
main
int main(void)
main function.
Definition project/at_start_f413/examples/usart/smartcard/src/main.c:277
card_inserted
uint32_t card_inserted
Definition project/at_start_f413/examples/usart/smartcard/src/main.c:62
dst_buffer
uint8_t dst_buffer[50]
Definition project/at_start_f413/examples/usart/smartcard/src/main.c:63
SC_RECEIVE_TIMEOUT
#define SC_RECEIVE_TIMEOUT
Definition project/at_start_f413/examples/usart/smartcard/src/main.c:41
sc_clock_freq
uint32_t sc_clock_freq
Definition project/at_start_f413/examples/usart/smartcard/src/main.c:59
HIST_LENGTH
#define HIST_LENGTH
Definition project/at_start_f413/examples/usart/smartcard/src/main.c:40
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_clocks_freq_get
void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
Definition at32f413_crm.c:660
CRM_IOMUX_PERIPH_CLOCK
@ CRM_IOMUX_PERIPH_CLOCK
Definition at32f413_crm.h:108
exint_flag_clear
void exint_flag_clear(uint32_t exint_line)
clear exint flag
Definition at32f413_exint.c:125
exint_default_para_init
void exint_default_para_init(exint_init_type *exint_struct)
exint default para init
Definition at32f413_exint.c:63
exint_init
void exint_init(exint_init_type *exint_struct)
exint init
Definition at32f413_exint.c:77
EXINT_LINE_INTERRUPT
@ EXINT_LINE_INTERRUPT
Definition at32f413_exint.h:84
EXINT_TRIGGER_RISING_EDGE
@ EXINT_TRIGGER_RISING_EDGE
Definition at32f413_exint.h:93
error_status
error_status
error status
Definition at32f413.h:302
ERROR
@ ERROR
Definition at32f413.h:302
SUCCESS
@ SUCCESS
Definition at32f413.h:302
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_bits_set
void gpio_bits_set(gpio_type *gpio_x, uint16_t pins)
set the selected data port bits.
Definition at32f413_gpio.c:309
gpio_exint_line_config
void gpio_exint_line_config(gpio_port_source_type gpio_port_source, gpio_pins_source_type gpio_pin_source)
select the gpio pin used as exint line.
Definition at32f413_gpio.c:605
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_MODE_OUTPUT
@ GPIO_MODE_OUTPUT
Definition at32f413_gpio.h:214
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_OUTPUT_OPEN_DRAIN
@ GPIO_OUTPUT_OPEN_DRAIN
Definition at32f413_gpio.h:235
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
usart_clock_enable
void usart_clock_enable(usart_type *usart_x, confirm_state new_state)
usart enable the ck pin.
Definition at32f413_usart.c:239
usart_smartcard_nack_set
void usart_smartcard_nack_set(usart_type *usart_x, confirm_state new_state)
enable or disable nack transmission in smartcard mode.
Definition at32f413_usart.c:462
usart_parity_selection_config
void usart_parity_selection_config(usart_type *usart_x, usart_parity_selection_type parity)
usart parity selection config.
Definition at32f413_usart.c:144
usart_flag_get
flag_status usart_flag_get(usart_type *usart_x, uint32_t flag)
check whether the specified usart flag is set or not.
Definition at32f413_usart.c:565
usart_transmitter_enable
void usart_transmitter_enable(usart_type *usart_x, confirm_state new_state)
usart transmitter enable.
Definition at32f413_usart.c:185
usart_init
void usart_init(usart_type *usart_x, uint32_t baud_rate, usart_data_bit_num_type data_bit, usart_stop_bit_num_type stop_bit)
initialize the usart peripheral according to the specified parameters.
Definition at32f413_usart.c:105
usart_irda_smartcard_division_set
void usart_irda_smartcard_division_set(usart_type *usart_x, uint8_t div_val)
config the irda/smartcard division.
Definition at32f413_usart.c:432
usart_enable
void usart_enable(usart_type *usart_x, confirm_state new_state)
enable or disable the specified usart peripheral.
Definition at32f413_usart.c:172
usart_receiver_enable
void usart_receiver_enable(usart_type *usart_x, confirm_state new_state)
usart receiver enable.
Definition at32f413_usart.c:198
usart_smartcard_guard_time_set
void usart_smartcard_guard_time_set(usart_type *usart_x, uint8_t guard_time_val)
config the specified usart smartcard guard time.
Definition at32f413_usart.c:418
usart_interrupt_enable
void usart_interrupt_enable(usart_type *usart_x, uint32_t usart_int, confirm_state new_state)
enable or disable the specified usart interrupts.
Definition at32f413_usart.c:263
usart_data_receive
uint16_t usart_data_receive(usart_type *usart_x)
return the most recent received data by the usart peripheral.
Definition at32f413_usart.c:392
usart_smartcard_mode_enable
void usart_smartcard_mode_enable(usart_type *usart_x, confirm_state new_state)
enable or disable the usart smart card mode.
Definition at32f413_usart.c:447
USART_STOP_1_5_BIT
@ USART_STOP_1_5_BIT
Definition at32f413_usart.h:160
USART_DATA_9BITS
@ USART_DATA_9BITS
Definition at32f413_usart.h:113
USART_PARITY_EVEN
@ USART_PARITY_EVEN
Definition at32f413_usart.h:94
USART_RDBF_FLAG
#define USART_RDBF_FLAG
Definition at32f413_usart.h:56
USART_PERR_INT
#define USART_PERR_INT
Definition at32f413_usart.h:75
at32f413_clock.h
header file of clock program
smartcard_config.h
header file of clock program
SC_RESET_PIN
#define SC_RESET_PIN
Definition smartcard_config.h:47
SC_USART_TX_PIN
#define SC_USART_TX_PIN
Definition smartcard_config.h:38
SC_RESET_PORT
#define SC_RESET_PORT
Definition smartcard_config.h:51
SC_3_5V_PORT
#define SC_3_5V_PORT
Definition smartcard_config.h:50
SC_RESET_CLK
#define SC_RESET_CLK
Definition smartcard_config.h:55
SC_USART_CLK_PIN
#define SC_USART_CLK_PIN
Definition smartcard_config.h:40
SC_OFF_EXINT
#define SC_OFF_EXINT
Definition smartcard_config.h:58
SC_USART
#define SC_USART
Definition smartcard_config.h:35
SC_OFF_CLK
#define SC_OFF_CLK
Definition smartcard_config.h:57
SC_CMDVCC_CLK
#define SC_CMDVCC_CLK
Definition smartcard_config.h:56
SC_USART_GPIO_CLK
#define SC_USART_GPIO_CLK
Definition smartcard_config.h:37
SC_3_5V_PIN
#define SC_3_5V_PIN
Definition smartcard_config.h:46
SC_OFF_PIN
#define SC_OFF_PIN
Definition smartcard_config.h:49
SC_CMDVCC_PORT
#define SC_CMDVCC_PORT
Definition smartcard_config.h:52
SC_USART_IRQn
#define SC_USART_IRQn
Definition smartcard_config.h:42
SC_USART_CLK_PORT
#define SC_USART_CLK_PORT
Definition smartcard_config.h:41
SC_3_5V_CLK
#define SC_3_5V_CLK
Definition smartcard_config.h:54
SC_USART_TX_PORT
#define SC_USART_TX_PORT
Definition smartcard_config.h:39
SC_OFF_PORTSOURCE
#define SC_OFF_PORTSOURCE
Definition smartcard_config.h:59
SC_OFF_EXINT_IRQ
#define SC_OFF_EXINT_IRQ
Definition smartcard_config.h:61
SC_USART_CLK
#define SC_USART_CLK
Definition smartcard_config.h:36
SC_CMDVCC_PIN
#define SC_CMDVCC_PIN
Definition smartcard_config.h:48
SC_OFF_PORT
#define SC_OFF_PORT
Definition smartcard_config.h:53
SC_OFF_PINSOURCE
#define SC_OFF_PINSOURCE
Definition smartcard_config.h:60
crm_clocks_freq_type
crm clocks freqency structure
Definition at32f413_crm.h:470
crm_clocks_freq_type::apb1_freq
uint32_t apb1_freq
Definition at32f413_crm.h:474
exint_init_type
exint init type
Definition at32f413_exint.h:102
exint_init_type::line_select
uint32_t line_select
Definition at32f413_exint.h:104
exint_init_type::line_enable
confirm_state line_enable
Definition at32f413_exint.h:106
exint_init_type::line_mode
exint_line_mode_type line_mode
Definition at32f413_exint.h:103
exint_init_type::line_polarity
exint_polarity_config_type line_polarity
Definition at32f413_exint.h:105
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
sc_atr_type
Definition project/at_start_f413/examples/usart/smartcard/src/main.c:48
sc_atr_type::t
uint8_t t[20]
Definition project/at_start_f413/examples/usart/smartcard/src/main.c:51
sc_atr_type::h
uint8_t h[20]
Definition project/at_start_f413/examples/usart/smartcard/src/main.c:52
sc_atr_type::ts
uint8_t ts
Definition project/at_start_f413/examples/usart/smartcard/src/main.c:49
sc_atr_type::tlength
uint8_t tlength
Definition project/at_start_f413/examples/usart/smartcard/src/main.c:53
sc_atr_type::hlength
uint8_t hlength
Definition project/at_start_f413/examples/usart/smartcard/src/main.c:54
sc_atr_type::t0
uint8_t t0
Definition project/at_start_f413/examples/usart/smartcard/src/main.c:50


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • usart
  • synchronous
  • inc
project/at_start_f413/examples/usart/synchronous/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • usart
  • synchronous
  • inc
project/at_start_f413/examples/usart/synchronous/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • usart
  • synchronous
  • inc
project/at_start_f413/examples/usart/synchronous/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • usart
  • synchronous
  • src
project/at_start_f413/examples/usart/synchronous/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/usart/synchronous/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • usart
  • synchronous
  • src
project/at_start_f413/examples/usart/synchronous/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/usart/synchronous/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/usart/synchronous/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/usart/synchronous/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/usart/synchronous/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/usart/synchronous/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/usart/synchronous/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/usart/synchronous/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/usart/synchronous/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/usart/synchronous/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • usart
  • synchronous
  • src
project/at_start_f413/examples/usart/synchronous/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37#define COUNTOF(a) (sizeof(a) / sizeof(*(a)))
38#define USART2_TX_BUFFER_SIZE (COUNTOF(usart2_tx_buffer) - 1)
39#define SPI2_TX_BUFFER_SIZE (COUNTOF(spi2_tx_buffer) - 1)
40#define DYMMY_BYTE 0x00
41
42uint8_t usart2_tx_buffer[] = "usart synchronous example: usart2 -> spi2";
43uint8_t spi2_tx_buffer[] = "usart synchronous example: spi2 -> usart2";
44uint8_t usart2_rx_buffer[SPI2_TX_BUFFER_SIZE];
45uint8_t spi2_rx_buffer[USART2_TX_BUFFER_SIZE];
46uint8_t usart2_tx_counter = 0x00;
47uint8_t spi2_tx_counter = 0x00;
48uint8_t usart2_rx_counter = 0x00;
49uint8_t spi2_rx_counter = 0x00;
50uint8_t usart2_tx_buffer_size = USART2_TX_BUFFER_SIZE;
51uint8_t spi2_tx_buffer_size = SPI2_TX_BUFFER_SIZE;
52
58void usart_spi_configuration(void)
59{
60 gpio_init_type gpio_init_struct;
61 spi_init_type spi_init_struct;
62
63 /* enable the usart2 and gpio clock */
64 crm_periph_clock_enable(CRM_USART2_PERIPH_CLOCK, TRUE);
65 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
66
67 /* enable the spi2 and gpio clock */
68 crm_periph_clock_enable(CRM_SPI2_PERIPH_CLOCK, TRUE);
69 crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
70
71 gpio_default_para_init(&gpio_init_struct);
72
73 /* configure the usart2 tx and ck pin */
74 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
75 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
76 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
77 gpio_init_struct.gpio_pins = GPIO_PINS_2 | GPIO_PINS_4;
78 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
79 gpio_init(GPIOA, &gpio_init_struct);
80
81 /* configure the usart2 rx pin */
82 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
83 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
84 gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
85 gpio_init_struct.gpio_pins = GPIO_PINS_3;
86 gpio_init_struct.gpio_pull = GPIO_PULL_UP;
87 gpio_init(GPIOA, &gpio_init_struct);
88
89 /* configure the spi2 mosi and ck pin */
90 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
91 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
92 gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
93 gpio_init_struct.gpio_pins = GPIO_PINS_15 | GPIO_PINS_13;
94 gpio_init_struct.gpio_pull = GPIO_PULL_UP;
95 gpio_init(GPIOB, &gpio_init_struct);
96
97 /* configure the spi2 miso pin */
98 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
99 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
100 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
101 gpio_init_struct.gpio_pins = GPIO_PINS_14;
102 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
103 gpio_init(GPIOB, &gpio_init_struct);
104
105 /* configure usart2 param */
106 usart_init(USART2, 115200, USART_DATA_8BITS, USART_STOP_1_BIT);
107 usart_clock_config(USART2, USART_CLOCK_POLARITY_HIGH, USART_CLOCK_PHASE_2EDGE, USART_CLOCK_LAST_BIT_OUTPUT);
108 usart_clock_enable(USART2, TRUE);
109 usart_transmitter_enable(USART2, TRUE);
110 usart_receiver_enable(USART2, TRUE);
111 usart_enable(USART2, TRUE);
112
113 /* configure spi2 param */
114 spi_default_para_init(&spi_init_struct);
115 spi_init_struct.transmission_mode = SPI_TRANSMIT_FULL_DUPLEX;
116 spi_init_struct.master_slave_mode =SPI_MODE_SLAVE;
117 spi_init_struct.first_bit_transmission = SPI_FIRST_BIT_LSB;
118 spi_init_struct.frame_bit_num = SPI_FRAME_8BIT;
119 spi_init_struct.clock_polarity = SPI_CLOCK_POLARITY_HIGH;
120 spi_init_struct.clock_phase = SPI_CLOCK_PHASE_2EDGE;
121 spi_init_struct.cs_mode_selection = SPI_CS_SOFTWARE_MODE;
122 spi_init(SPI2, &spi_init_struct);
123 spi_enable(SPI2, TRUE);
124}
125
133uint8_t buffer_compare(uint8_t* pbuffer1, uint8_t* pbuffer2, uint16_t buffer_length)
134{
135 while(buffer_length--)
136 {
137 if(*pbuffer1 != *pbuffer2)
138 {
139 return 0;
140 }
141 pbuffer1++;
142 pbuffer2++;
143 }
144 return 1;
145}
146
152int main(void)
153{
154 system_clock_config();
155 at32_board_init();
156 usart_spi_configuration();
157
158 /* wait until end of transmission from usart2 to spi2 */
159 while(spi2_rx_counter < usart2_tx_buffer_size)
160 {
161 /* usart transmit data */
162 while(usart_flag_get(USART2, USART_TDBE_FLAG) == RESET);
163 usart_data_transmit(USART2, usart2_tx_buffer[usart2_tx_counter++]);
164
165 /* wait until spi receive data */
166 while(spi_i2s_flag_get(SPI2, SPI_I2S_RDBF_FLAG) == RESET);
167 spi2_rx_buffer[spi2_rx_counter++] = spi_i2s_data_receive(SPI2);
168
169 /* wait until usart receive data, and clear dummy byte in data register */
170 while(usart_flag_get(USART2, USART_RDBF_FLAG) == RESET);
171 usart_data_receive(USART2);
172 }
173
174 /* wait until end of transmission from spi2 to usart2 */
175 while(usart2_rx_counter < spi2_tx_buffer_size)
176 {
177 /* spi put transmit data in data register */
178 while(spi_i2s_flag_get(SPI2, SPI_I2S_TDBE_FLAG) == RESET);
179 spi_i2s_data_transmit(SPI2, spi2_tx_buffer[spi2_tx_counter++]);
180
181 /* usart transmit a dummy byte to generate clock to slave */
182 while(usart_flag_get(USART2, USART_TDBE_FLAG) == RESET);
183 usart_data_transmit(USART2, DYMMY_BYTE);
184
185 /* wait until usart receive data */
186 while(usart_flag_get(USART2, USART_RDBF_FLAG) == RESET);
187 usart2_rx_buffer[usart2_rx_counter++] = usart_data_receive(USART2);
188 }
189
190 while(1)
191 {
192 /* compare data buffer */
193 if(buffer_compare(usart2_tx_buffer, spi2_rx_buffer, USART2_TX_BUFFER_SIZE) && \
194 buffer_compare(spi2_tx_buffer, usart2_rx_buffer, SPI2_TX_BUFFER_SIZE))
195 {
196 at32_led_toggle(LED2);
197 at32_led_toggle(LED3);
198 at32_led_toggle(LED4);
199 delay_sec(1);
200 }
201 }
202}
203
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
spi_init_struct
spi_init_type spi_init_struct
Definition project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c:41
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
spi2_tx_buffer
uint8_t spi2_tx_buffer[]
Definition project/at_start_f413/examples/usart/synchronous/src/main.c:43
buffer_compare
uint8_t buffer_compare(uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t buffer_length)
compares two buffers.
Definition project/at_start_f413/examples/usart/synchronous/src/main.c:133
usart2_tx_counter
uint8_t usart2_tx_counter
Definition project/at_start_f413/examples/usart/synchronous/src/main.c:46
usart_spi_configuration
void usart_spi_configuration(void)
config usart and spi
Definition project/at_start_f413/examples/usart/synchronous/src/main.c:58
usart2_rx_buffer
uint8_t usart2_rx_buffer[((sizeof(spi2_tx_buffer)/sizeof(*(spi2_tx_buffer))) - 1)]
Definition project/at_start_f413/examples/usart/synchronous/src/main.c:44
spi2_rx_counter
uint8_t spi2_rx_counter
Definition project/at_start_f413/examples/usart/synchronous/src/main.c:49
SPI2_TX_BUFFER_SIZE
#define SPI2_TX_BUFFER_SIZE
Definition project/at_start_f413/examples/usart/synchronous/src/main.c:39
DYMMY_BYTE
#define DYMMY_BYTE
Definition project/at_start_f413/examples/usart/synchronous/src/main.c:40
usart2_tx_buffer_size
uint8_t usart2_tx_buffer_size
Definition project/at_start_f413/examples/usart/synchronous/src/main.c:50
usart2_rx_counter
uint8_t usart2_rx_counter
Definition project/at_start_f413/examples/usart/synchronous/src/main.c:48
USART2_TX_BUFFER_SIZE
#define USART2_TX_BUFFER_SIZE
Definition project/at_start_f413/examples/usart/synchronous/src/main.c:38
main
int main(void)
main function.
Definition project/at_start_f413/examples/usart/synchronous/src/main.c:152
spi2_tx_buffer_size
uint8_t spi2_tx_buffer_size
Definition project/at_start_f413/examples/usart/synchronous/src/main.c:51
spi2_rx_buffer
uint8_t spi2_rx_buffer[((sizeof(usart2_tx_buffer)/sizeof(*(usart2_tx_buffer))) - 1)]
Definition project/at_start_f413/examples/usart/synchronous/src/main.c:45
spi2_tx_counter
uint8_t spi2_tx_counter
Definition project/at_start_f413/examples/usart/synchronous/src/main.c:47
usart2_tx_buffer
uint8_t usart2_tx_buffer[]
Definition project/at_start_f413/examples/usart/synchronous/src/main.c:42
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
delay_sec
void delay_sec(uint16_t sec)
inserts a delay time.
Definition at32f413_board.c:382
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_SPI2_PERIPH_CLOCK
@ CRM_SPI2_PERIPH_CLOCK
Definition at32f413_crm.h:130
CRM_GPIOB_PERIPH_CLOCK
@ CRM_GPIOB_PERIPH_CLOCK
Definition at32f413_crm.h:110
CRM_USART2_PERIPH_CLOCK
@ CRM_USART2_PERIPH_CLOCK
Definition at32f413_crm.h:131
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_PULL_UP
@ GPIO_PULL_UP
Definition at32f413_gpio.h:244
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_2
#define GPIO_PINS_2
Definition at32f413_gpio.h:52
GPIO_PINS_13
#define GPIO_PINS_13
Definition at32f413_gpio.h:63
GPIO_PINS_3
#define GPIO_PINS_3
Definition at32f413_gpio.h:53
GPIO_PINS_14
#define GPIO_PINS_14
Definition at32f413_gpio.h:64
GPIO_PINS_4
#define GPIO_PINS_4
Definition at32f413_gpio.h:54
GPIO_PINS_15
#define GPIO_PINS_15
Definition at32f413_gpio.h:65
GPIOB
#define GPIOB
Definition at32f413_gpio.h:748
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
SPI_I2S_TDBE_FLAG
#define SPI_I2S_TDBE_FLAG
Definition at32f413_spi.h:53
SPI_I2S_RDBF_FLAG
#define SPI_I2S_RDBF_FLAG
Definition at32f413_spi.h:52
spi_i2s_data_transmit
void spi_i2s_data_transmit(spi_type *spi_x, uint16_t tx_data)
spi/i2s data transmit
Definition at32f413_spi.c:513
spi_i2s_flag_get
flag_status spi_i2s_flag_get(spi_type *spi_x, uint32_t spi_i2s_flag)
get flag of the specified spi/i2s peripheral.
Definition at32f413_spi.c:547
spi_init
void spi_init(spi_type *spi_x, spi_init_type *spi_init_struct)
spi init config with its setting value.
Definition at32f413_spi.c:90
spi_default_para_init
void spi_default_para_init(spi_init_type *spi_init_struct)
spi init config with its default value.
Definition at32f413_spi.c:70
spi_i2s_data_receive
uint16_t spi_i2s_data_receive(spi_type *spi_x)
spi/i2s data receive
Definition at32f413_spi.c:525
spi_enable
void spi_enable(spi_type *spi_x, confirm_state new_state)
enable or disable spi.
Definition at32f413_spi.c:286
SPI_MODE_SLAVE
@ SPI_MODE_SLAVE
Definition at32f413_spi.h:97
SPI_CLOCK_PHASE_2EDGE
@ SPI_CLOCK_PHASE_2EDGE
Definition at32f413_spi.h:116
SPI_CS_SOFTWARE_MODE
@ SPI_CS_SOFTWARE_MODE
Definition at32f413_spi.h:125
SPI_FIRST_BIT_LSB
@ SPI_FIRST_BIT_LSB
Definition at32f413_spi.h:151
SPI_CLOCK_POLARITY_HIGH
@ SPI_CLOCK_POLARITY_HIGH
Definition at32f413_spi.h:107
SPI_TRANSMIT_FULL_DUPLEX
@ SPI_TRANSMIT_FULL_DUPLEX
Definition at32f413_spi.h:159
SPI_FRAME_8BIT
@ SPI_FRAME_8BIT
Definition at32f413_spi.h:88
SPI2
#define SPI2
Definition at32f413_spi.h:448
usart_clock_enable
void usart_clock_enable(usart_type *usart_x, confirm_state new_state)
usart enable the ck pin.
Definition at32f413_usart.c:239
usart_clock_config
void usart_clock_config(usart_type *usart_x, usart_clock_polarity_type clk_pol, usart_clock_phase_type clk_pha, usart_lbcp_type clk_lb)
usart clock config.
Definition at32f413_usart.c:223
usart_data_transmit
void usart_data_transmit(usart_type *usart_x, uint16_t data)
transmit single data through the usart peripheral.
Definition at32f413_usart.c:380
usart_flag_get
flag_status usart_flag_get(usart_type *usart_x, uint32_t flag)
check whether the specified usart flag is set or not.
Definition at32f413_usart.c:565
usart_transmitter_enable
void usart_transmitter_enable(usart_type *usart_x, confirm_state new_state)
usart transmitter enable.
Definition at32f413_usart.c:185
usart_init
void usart_init(usart_type *usart_x, uint32_t baud_rate, usart_data_bit_num_type data_bit, usart_stop_bit_num_type stop_bit)
initialize the usart peripheral according to the specified parameters.
Definition at32f413_usart.c:105
usart_enable
void usart_enable(usart_type *usart_x, confirm_state new_state)
enable or disable the specified usart peripheral.
Definition at32f413_usart.c:172
usart_receiver_enable
void usart_receiver_enable(usart_type *usart_x, confirm_state new_state)
usart receiver enable.
Definition at32f413_usart.c:198
usart_data_receive
uint16_t usart_data_receive(usart_type *usart_x)
return the most recent received data by the usart peripheral.
Definition at32f413_usart.c:392
USART_CLOCK_POLARITY_HIGH
@ USART_CLOCK_POLARITY_HIGH
Definition at32f413_usart.h:140
USART_STOP_1_BIT
@ USART_STOP_1_BIT
Definition at32f413_usart.h:157
USART_DATA_8BITS
@ USART_DATA_8BITS
Definition at32f413_usart.h:112
USART_CLOCK_LAST_BIT_OUTPUT
@ USART_CLOCK_LAST_BIT_OUTPUT
Definition at32f413_usart.h:149
USART_CLOCK_PHASE_2EDGE
@ USART_CLOCK_PHASE_2EDGE
Definition at32f413_usart.h:131
USART_TDBE_FLAG
#define USART_TDBE_FLAG
Definition at32f413_usart.h:58
USART_RDBF_FLAG
#define USART_RDBF_FLAG
Definition at32f413_usart.h:56
USART2
#define USART2
Definition at32f413_usart.h:319
at32f413_clock.h
header file of clock program
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
spi_init_type
spi init type
Definition at32f413_spi.h:256
spi_init_type::master_slave_mode
spi_master_slave_mode_type master_slave_mode
Definition at32f413_spi.h:258
spi_init_type::first_bit_transmission
spi_first_bit_type first_bit_transmission
Definition at32f413_spi.h:260
spi_init_type::frame_bit_num
spi_frame_bit_num_type frame_bit_num
Definition at32f413_spi.h:261
spi_init_type::clock_polarity
spi_clock_polarity_type clock_polarity
Definition at32f413_spi.h:262
spi_init_type::cs_mode_selection
spi_cs_mode_type cs_mode_selection
Definition at32f413_spi.h:264
spi_init_type::transmission_mode
spi_transmission_mode_type transmission_mode
Definition at32f413_spi.h:257
spi_init_type::clock_phase
spi_clock_phase_type clock_phase
Definition at32f413_spi.h:263


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • usart
  • transfer_by_dma_interrupt
  • inc
project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • usart
  • transfer_by_dma_interrupt
  • inc
project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • usart
  • transfer_by_dma_interrupt
  • inc
project/at_start_f413/examples/usart/transfer_by_dma_interrupt/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • usart
  • transfer_by_dma_interrupt
  • src
project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • usart
  • transfer_by_dma_interrupt
  • src
project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
29extern uint8_t usart2_tx_dma_status;
30extern uint8_t usart2_rx_dma_status;
31extern uint8_t usart3_tx_dma_status;
32extern uint8_t usart3_rx_dma_status;
33
47void NMI_Handler(void)
48{
49}
50
56void HardFault_Handler(void)
57{
58 /* go to infinite loop when hard fault exception occurs */
59 while(1)
60 {
61 }
62}
63
69void MemManage_Handler(void)
70{
71 /* go to infinite loop when memory manage exception occurs */
72 while(1)
73 {
74 }
75}
76
82void BusFault_Handler(void)
83{
84 /* go to infinite loop when bus fault exception occurs */
85 while(1)
86 {
87 }
88}
89
95void UsageFault_Handler(void)
96{
97 /* go to infinite loop when usage fault exception occurs */
98 while(1)
99 {
100 }
101}
102
108void SVC_Handler(void)
109{
110}
111
117void DebugMon_Handler(void)
118{
119}
120
126void PendSV_Handler(void)
127{
128}
129
135void SysTick_Handler(void)
136{
137}
138
144void DMA1_Channel1_IRQHandler(void)
145{
146 if(dma_interrupt_flag_get(DMA1_FDT1_FLAG))
147 {
148 usart2_tx_dma_status = 1;
149 dma_flag_clear(DMA1_FDT1_FLAG);
150 dma_channel_enable(DMA1_CHANNEL1, FALSE);
151 }
152}
153
159void DMA1_Channel2_IRQHandler(void)
160{
161 if(dma_interrupt_flag_get(DMA1_FDT2_FLAG))
162 {
163 usart2_rx_dma_status = 1;
164 dma_flag_clear(DMA1_FDT2_FLAG);
165 dma_channel_enable(DMA1_CHANNEL2, FALSE);
166 }
167}
168
174void DMA1_Channel3_IRQHandler(void)
175{
176 if(dma_interrupt_flag_get(DMA1_FDT3_FLAG))
177 {
178 usart3_tx_dma_status = 1;
179 dma_flag_clear(DMA1_FDT3_FLAG);
180 dma_channel_enable(DMA1_CHANNEL3, FALSE);
181 }
182}
183
189void DMA1_Channel4_IRQHandler(void)
190{
191 if(dma_interrupt_flag_get(DMA1_FDT4_FLAG))
192 {
193 usart3_rx_dma_status = 1;
194 dma_flag_clear(DMA1_FDT4_FLAG);
195 dma_channel_enable(DMA1_CHANNEL4, FALSE);
196 }
197}
198
DMA1_Channel2_IRQHandler
void DMA1_Channel2_IRQHandler(void)
this function handles dma1 channel2 handler.
Definition project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c:159
usart3_tx_dma_status
uint8_t usart3_tx_dma_status
Definition project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c:47
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c:95
usart2_tx_dma_status
uint8_t usart2_tx_dma_status
Definition project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c:45
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c:56
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c:69
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c:108
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c:126
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c:47
DMA1_Channel1_IRQHandler
void DMA1_Channel1_IRQHandler(void)
this function handles dma1 channel1 handler.
Definition project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c:144
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c:82
usart2_rx_dma_status
uint8_t usart2_rx_dma_status
Definition project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c:46
DMA1_Channel4_IRQHandler
void DMA1_Channel4_IRQHandler(void)
this function handles dma1 channel4 handler.
Definition project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c:189
usart3_rx_dma_status
uint8_t usart3_rx_dma_status
Definition project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c:48
DMA1_Channel3_IRQHandler
void DMA1_Channel3_IRQHandler(void)
this function handles dma1 channel3 handler.
Definition project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c:174
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c:135
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/at32f413_int.c:117
dma_channel_enable
void dma_channel_enable(dma_channel_type *dmax_channely, confirm_state new_state)
enable or disable dma channely
Definition at32f413_dma.c:197
dma_interrupt_flag_get
flag_status dma_interrupt_flag_get(uint32_t dmax_flag)
get dma interrupt flag
Definition at32f413_dma.c:297
dma_flag_clear
void dma_flag_clear(uint32_t dmax_flag)
clear dma flag
Definition at32f413_dma.c:389
DMA1_FDT4_FLAG
#define DMA1_FDT4_FLAG
Definition at32f413_dma.h:93
DMA1_FDT1_FLAG
#define DMA1_FDT1_FLAG
Definition at32f413_dma.h:81
DMA1_FDT2_FLAG
#define DMA1_FDT2_FLAG
Definition at32f413_dma.h:85
DMA1_FDT3_FLAG
#define DMA1_FDT3_FLAG
Definition at32f413_dma.h:89
DMA1_CHANNEL3
#define DMA1_CHANNEL3
Definition at32f413_dma.h:482
DMA1_CHANNEL4
#define DMA1_CHANNEL4
Definition at32f413_dma.h:483
DMA1_CHANNEL1
#define DMA1_CHANNEL1
Definition at32f413_dma.h:480
DMA1_CHANNEL2
#define DMA1_CHANNEL2
Definition at32f413_dma.h:481
FALSE
@ FALSE
Definition at32f413.h:297
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • usart
  • transfer_by_dma_interrupt
  • src
project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37#define COUNTOF(a) (sizeof(a) / sizeof(*(a)))
38#define USART2_TX_BUFFER_SIZE (COUNTOF(usart2_tx_buffer) - 1)
39#define USART3_TX_BUFFER_SIZE (COUNTOF(usart3_tx_buffer) - 1)
40
41uint8_t usart2_tx_buffer[] = "usart transfer by dma interrupt: usart2 -> usart3 using dma";
42uint8_t usart3_tx_buffer[] = "usart transfer by dma interrupt: usart3 -> usart2 using dma";
43uint8_t usart2_rx_buffer[USART3_TX_BUFFER_SIZE];
44uint8_t usart3_rx_buffer[USART2_TX_BUFFER_SIZE];
45volatile uint8_t usart2_tx_dma_status = 0;
46volatile uint8_t usart2_rx_dma_status = 0;
47volatile uint8_t usart3_tx_dma_status = 0;
48volatile uint8_t usart3_rx_dma_status = 0;
49
55void usart_configuration(void)
56{
57 gpio_init_type gpio_init_struct;
58
59 /* enable the usart2 and gpio clock */
60 crm_periph_clock_enable(CRM_USART2_PERIPH_CLOCK, TRUE);
61 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
62
63 /* enable the usart3 and gpio clock */
64 crm_periph_clock_enable(CRM_USART3_PERIPH_CLOCK, TRUE);
65 crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
66
67 gpio_default_para_init(&gpio_init_struct);
68 /* configure the usart2 tx pin */
69 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
70 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
71 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
72 gpio_init_struct.gpio_pins = GPIO_PINS_2;
73 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
74 gpio_init(GPIOA, &gpio_init_struct);
75
76 /* configure the usart3 tx pin */
77 gpio_init_struct.gpio_pins = GPIO_PINS_10;
78 gpio_init(GPIOB, &gpio_init_struct);
79
80 /* configure the usart2 rx pin */
81 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
82 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
83 gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
84 gpio_init_struct.gpio_pins = GPIO_PINS_3;
85 gpio_init_struct.gpio_pull = GPIO_PULL_UP;
86 gpio_init(GPIOA, &gpio_init_struct);
87
88 /* configure the usart3 rx pin */
89 gpio_init_struct.gpio_pins = GPIO_PINS_11;
90 gpio_init(GPIOB, &gpio_init_struct);
91
92 /* configure usart2 param */
93 usart_init(USART2, 115200, USART_DATA_8BITS, USART_STOP_1_BIT);
94 usart_transmitter_enable(USART2, TRUE);
95 usart_receiver_enable(USART2, TRUE);
96 usart_dma_transmitter_enable(USART2, TRUE);
97 usart_dma_receiver_enable(USART2, TRUE);
98 usart_enable(USART2, TRUE);
99
100 /* configure usart3 param */
101 usart_init(USART3, 115200, USART_DATA_8BITS, USART_STOP_1_BIT);
102 usart_transmitter_enable(USART3, TRUE);
103 usart_receiver_enable(USART3, TRUE);
104 usart_dma_transmitter_enable(USART3, TRUE);
105 usart_dma_receiver_enable(USART3, TRUE);
106 usart_enable(USART3, TRUE);
107}
108
114void dma_configuration(void)
115{
116 dma_init_type dma_init_struct;
117
118 /* enable dma1 clock */
119 crm_periph_clock_enable(CRM_DMA1_PERIPH_CLOCK, TRUE);
120
121 /* dma1 channel1 for usart2 tx configuration */
122 dma_reset(DMA1_CHANNEL1);
123 dma_default_para_init(&dma_init_struct);
124 dma_init_struct.buffer_size = USART2_TX_BUFFER_SIZE;
125 dma_init_struct.direction = DMA_DIR_MEMORY_TO_PERIPHERAL;
126 dma_init_struct.memory_base_addr = (uint32_t)usart2_tx_buffer;
127 dma_init_struct.memory_data_width = DMA_MEMORY_DATA_WIDTH_BYTE;
128 dma_init_struct.memory_inc_enable = TRUE;
129 dma_init_struct.peripheral_base_addr = (uint32_t)&USART2->dt;
130 dma_init_struct.peripheral_data_width = DMA_PERIPHERAL_DATA_WIDTH_BYTE;
131 dma_init_struct.peripheral_inc_enable = FALSE;
132 dma_init_struct.priority = DMA_PRIORITY_MEDIUM;
133 dma_init_struct.loop_mode_enable = FALSE;
134 dma_init(DMA1_CHANNEL1, &dma_init_struct);
135
136 /* enable transfer full data interrupt */
137 dma_interrupt_enable(DMA1_CHANNEL1, DMA_FDT_INT, TRUE);
138
139 /* dma1 channel1 interrupt nvic init */
140 nvic_irq_enable(DMA1_Channel1_IRQn, 0, 0);
141
142 /* config flexible dma for usart2 tx */
143 dma_flexible_config(DMA1, FLEX_CHANNEL1, DMA_FLEXIBLE_UART2_TX);
144
145 /* dma1 channel2 for usart2 rx configuration */
146 dma_reset(DMA1_CHANNEL2);
147 dma_default_para_init(&dma_init_struct);
148 dma_init_struct.buffer_size = USART3_TX_BUFFER_SIZE;
149 dma_init_struct.direction = DMA_DIR_PERIPHERAL_TO_MEMORY;
150 dma_init_struct.memory_base_addr = (uint32_t)usart2_rx_buffer;
151 dma_init_struct.memory_data_width = DMA_MEMORY_DATA_WIDTH_BYTE;
152 dma_init_struct.memory_inc_enable = TRUE;
153 dma_init_struct.peripheral_base_addr = (uint32_t)&USART2->dt;
154 dma_init_struct.peripheral_data_width = DMA_PERIPHERAL_DATA_WIDTH_BYTE;
155 dma_init_struct.peripheral_inc_enable = FALSE;
156 dma_init_struct.priority = DMA_PRIORITY_MEDIUM;
157 dma_init_struct.loop_mode_enable = FALSE;
158 dma_init(DMA1_CHANNEL2, &dma_init_struct);
159
160 /* enable transfer full data interrupt */
161 dma_interrupt_enable(DMA1_CHANNEL2, DMA_FDT_INT, TRUE);
162
163 /* dma1 channel2 interrupt nvic init */
164 nvic_irq_enable(DMA1_Channel2_IRQn, 0, 0);
165
166 /* config flexible dma for usart2 rx */
167 dma_flexible_config(DMA1, FLEX_CHANNEL2, DMA_FLEXIBLE_UART2_RX);
168
169 /* dma1 channel3 for usart3 tx configuration */
170 dma_reset(DMA1_CHANNEL3);
171 dma_default_para_init(&dma_init_struct);
172 dma_init_struct.buffer_size = USART3_TX_BUFFER_SIZE;
173 dma_init_struct.direction = DMA_DIR_MEMORY_TO_PERIPHERAL;
174 dma_init_struct.memory_base_addr = (uint32_t)usart3_tx_buffer;
175 dma_init_struct.memory_data_width = DMA_MEMORY_DATA_WIDTH_BYTE;
176 dma_init_struct.memory_inc_enable = TRUE;
177 dma_init_struct.peripheral_base_addr = (uint32_t)&USART3->dt;
178 dma_init_struct.peripheral_data_width = DMA_PERIPHERAL_DATA_WIDTH_BYTE;
179 dma_init_struct.peripheral_inc_enable = FALSE;
180 dma_init_struct.priority = DMA_PRIORITY_MEDIUM;
181 dma_init_struct.loop_mode_enable = FALSE;
182 dma_init(DMA1_CHANNEL3, &dma_init_struct);
183
184 /* enable transfer full data interrupt */
185 dma_interrupt_enable(DMA1_CHANNEL3, DMA_FDT_INT, TRUE);
186
187 /* dma1 channel3 interrupt nvic init */
188 nvic_irq_enable(DMA1_Channel3_IRQn, 0, 0);
189
190 /* config flexible dma for usart3 tx */
191 dma_flexible_config(DMA1, FLEX_CHANNEL3, DMA_FLEXIBLE_UART3_TX);
192
193 /* dma1 channel4 for usart3 rx configuration */
194 dma_reset(DMA1_CHANNEL4);
195 dma_default_para_init(&dma_init_struct);
196 dma_init_struct.buffer_size = USART2_TX_BUFFER_SIZE;
197 dma_init_struct.direction = DMA_DIR_PERIPHERAL_TO_MEMORY;
198 dma_init_struct.memory_base_addr = (uint32_t)usart3_rx_buffer;
199 dma_init_struct.memory_data_width = DMA_MEMORY_DATA_WIDTH_BYTE;
200 dma_init_struct.memory_inc_enable = TRUE;
201 dma_init_struct.peripheral_base_addr = (uint32_t)&USART3->dt;
202 dma_init_struct.peripheral_data_width = DMA_PERIPHERAL_DATA_WIDTH_BYTE;
203 dma_init_struct.peripheral_inc_enable = FALSE;
204 dma_init_struct.priority = DMA_PRIORITY_MEDIUM;
205 dma_init_struct.loop_mode_enable = FALSE;
206 dma_init(DMA1_CHANNEL4, &dma_init_struct);
207
208 /* enable transfer full data interrupt */
209 dma_interrupt_enable(DMA1_CHANNEL4, DMA_FDT_INT, TRUE);
210
211 /* dma1 channel4 interrupt nvic init */
212 nvic_irq_enable(DMA1_Channel4_IRQn, 0, 0);
213
214 /* config flexible dma for usart3 rx */
215 dma_flexible_config(DMA1, FLEX_CHANNEL4, DMA_FLEXIBLE_UART3_RX);
216
217 dma_channel_enable(DMA1_CHANNEL2, TRUE); /* usart2 rx begin dma receiving */
218 dma_channel_enable(DMA1_CHANNEL4, TRUE); /* usart3 rx begin dma receiving */
219 dma_channel_enable(DMA1_CHANNEL1, TRUE); /* usart2 tx begin dma transmitting */
220 dma_channel_enable(DMA1_CHANNEL3, TRUE); /* usart3 tx begin dma transmitting */
221}
222
230uint8_t buffer_compare(uint8_t* pbuffer1, uint8_t* pbuffer2, uint16_t buffer_length)
231{
232 while(buffer_length--)
233 {
234 if(*pbuffer1 != *pbuffer2)
235 {
236 return 0;
237 }
238 pbuffer1++;
239 pbuffer2++;
240 }
241 return 1;
242}
243
249int main(void)
250{
251 system_clock_config();
252 at32_board_init();
253 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
254 usart_configuration();
255 dma_configuration();
256
257 /* wait dma transmission complete */
258 while((usart2_tx_dma_status == 0) || (usart2_rx_dma_status == 0) || (usart3_tx_dma_status == 0) || (usart3_rx_dma_status == 0));
259
260 while(1)
261 {
262 /* compare data buffer */
263 if(buffer_compare(usart2_tx_buffer, usart3_rx_buffer, USART2_TX_BUFFER_SIZE) && \
264 buffer_compare(usart3_tx_buffer, usart2_rx_buffer, USART3_TX_BUFFER_SIZE))
265 {
266 at32_led_toggle(LED2);
267 at32_led_toggle(LED3);
268 at32_led_toggle(LED4);
269 delay_sec(1);
270 }
271 }
272}
273
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
dma_init_struct
dma_init_type dma_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:38
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
usart_configuration
void usart_configuration(void)
config usart
Definition project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c:55
usart3_tx_dma_status
volatile uint8_t usart3_tx_dma_status
Definition project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c:47
usart2_tx_dma_status
volatile uint8_t usart2_tx_dma_status
Definition project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c:45
buffer_compare
uint8_t buffer_compare(uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t buffer_length)
compares two buffers.
Definition project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c:230
usart3_rx_buffer
uint8_t usart3_rx_buffer[((sizeof(usart2_tx_buffer)/sizeof(*(usart2_tx_buffer))) - 1)]
Definition project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c:44
dma_configuration
void dma_configuration(void)
config dma for usart2 and usart3
Definition project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c:114
USART2_TX_BUFFER_SIZE
#define USART2_TX_BUFFER_SIZE
Definition project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c:38
main
int main(void)
main function.
Definition project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c:249
usart2_rx_dma_status
volatile uint8_t usart2_rx_dma_status
Definition project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c:46
usart3_rx_dma_status
volatile uint8_t usart3_rx_dma_status
Definition project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c:48
usart2_tx_buffer
uint8_t usart2_tx_buffer[]
Definition project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c:41
USART3_TX_BUFFER_SIZE
#define USART3_TX_BUFFER_SIZE
Definition project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c:39
usart3_tx_buffer
uint8_t usart3_tx_buffer[]
Definition project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c:42
usart2_rx_buffer
uint8_t usart2_rx_buffer[((sizeof(usart3_tx_buffer)/sizeof(*(usart3_tx_buffer))) - 1)]
Definition project/at_start_f413/examples/usart/transfer_by_dma_interrupt/src/main.c:43
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
delay_sec
void delay_sec(uint16_t sec)
inserts a delay time.
Definition at32f413_board.c:382
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_USART3_PERIPH_CLOCK
@ CRM_USART3_PERIPH_CLOCK
Definition at32f413_crm.h:132
CRM_GPIOB_PERIPH_CLOCK
@ CRM_GPIOB_PERIPH_CLOCK
Definition at32f413_crm.h:110
CRM_DMA1_PERIPH_CLOCK
@ CRM_DMA1_PERIPH_CLOCK
Definition at32f413_crm.h:103
CRM_USART2_PERIPH_CLOCK
@ CRM_USART2_PERIPH_CLOCK
Definition at32f413_crm.h:131
DMA1_Channel2_IRQn
@ DMA1_Channel2_IRQn
Definition at32f413.h:183
DMA1_Channel1_IRQn
@ DMA1_Channel1_IRQn
Definition at32f413.h:182
DMA1_Channel3_IRQn
@ DMA1_Channel3_IRQn
Definition at32f413.h:184
DMA1_Channel4_IRQn
@ DMA1_Channel4_IRQn
Definition at32f413.h:185
dma_channel_enable
void dma_channel_enable(dma_channel_type *dmax_channely, confirm_state new_state)
enable or disable dma channely
Definition at32f413_dma.c:197
dma_default_para_init
void dma_default_para_init(dma_init_type *dma_init_struct)
dma init config with its default value.
Definition at32f413_dma.c:407
dma_flexible_config
void dma_flexible_config(dma_type *dma_x, uint8_t flex_channelx, dma_flexible_request_type flexible_request)
initialize the dma_x flexible function according to the specified parameters.
Definition at32f413_dma.c:237
dma_interrupt_enable
void dma_interrupt_enable(dma_channel_type *dmax_channely, uint32_t dma_int, confirm_state new_state)
enable or disable dma interrupt
Definition at32f413_dma.c:164
dma_reset
void dma_reset(dma_channel_type *dmax_channely)
reset the dmax channely registers.
Definition at32f413_dma.c:63
dma_init
void dma_init(dma_channel_type *dmax_channely, dma_init_type *dma_init_struct)
dma init
Definition at32f413_dma.c:442
DMA_PERIPHERAL_DATA_WIDTH_BYTE
@ DMA_PERIPHERAL_DATA_WIDTH_BYTE
Definition at32f413_dma.h:245
DMA_FLEXIBLE_UART3_TX
@ DMA_FLEXIBLE_UART3_TX
Definition at32f413_dma.h:161
DMA_FLEXIBLE_UART2_RX
@ DMA_FLEXIBLE_UART2_RX
Definition at32f413_dma.h:158
DMA_FLEXIBLE_UART2_TX
@ DMA_FLEXIBLE_UART2_TX
Definition at32f413_dma.h:159
DMA_FLEXIBLE_UART3_RX
@ DMA_FLEXIBLE_UART3_RX
Definition at32f413_dma.h:160
DMA_DIR_MEMORY_TO_PERIPHERAL
@ DMA_DIR_MEMORY_TO_PERIPHERAL
Definition at32f413_dma.h:217
DMA_DIR_PERIPHERAL_TO_MEMORY
@ DMA_DIR_PERIPHERAL_TO_MEMORY
Definition at32f413_dma.h:216
DMA_MEMORY_DATA_WIDTH_BYTE
@ DMA_MEMORY_DATA_WIDTH_BYTE
Definition at32f413_dma.h:255
DMA_PRIORITY_MEDIUM
@ DMA_PRIORITY_MEDIUM
Definition at32f413_dma.h:266
FLEX_CHANNEL3
#define FLEX_CHANNEL3
Definition at32f413_dma.h:65
FLEX_CHANNEL1
#define FLEX_CHANNEL1
Definition at32f413_dma.h:63
FLEX_CHANNEL4
#define FLEX_CHANNEL4
Definition at32f413_dma.h:66
FLEX_CHANNEL2
#define FLEX_CHANNEL2
Definition at32f413_dma.h:64
DMA_FDT_INT
#define DMA_FDT_INT
Definition at32f413_dma.h:51
DMA1_CHANNEL3
#define DMA1_CHANNEL3
Definition at32f413_dma.h:482
DMA1_CHANNEL4
#define DMA1_CHANNEL4
Definition at32f413_dma.h:483
DMA1_CHANNEL1
#define DMA1_CHANNEL1
Definition at32f413_dma.h:480
DMA1_CHANNEL2
#define DMA1_CHANNEL2
Definition at32f413_dma.h:481
DMA1
#define DMA1
Definition at32f413_dma.h:479
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_PULL_UP
@ GPIO_PULL_UP
Definition at32f413_gpio.h:244
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_10
#define GPIO_PINS_10
Definition at32f413_gpio.h:60
GPIO_PINS_11
#define GPIO_PINS_11
Definition at32f413_gpio.h:61
GPIO_PINS_2
#define GPIO_PINS_2
Definition at32f413_gpio.h:52
GPIO_PINS_3
#define GPIO_PINS_3
Definition at32f413_gpio.h:53
GPIOB
#define GPIOB
Definition at32f413_gpio.h:748
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
usart_transmitter_enable
void usart_transmitter_enable(usart_type *usart_x, confirm_state new_state)
usart transmitter enable.
Definition at32f413_usart.c:185
usart_dma_receiver_enable
void usart_dma_receiver_enable(usart_type *usart_x, confirm_state new_state)
enable or disable the usart's dma receiver interface.
Definition at32f413_usart.c:294
usart_init
void usart_init(usart_type *usart_x, uint32_t baud_rate, usart_data_bit_num_type data_bit, usart_stop_bit_num_type stop_bit)
initialize the usart peripheral according to the specified parameters.
Definition at32f413_usart.c:105
usart_enable
void usart_enable(usart_type *usart_x, confirm_state new_state)
enable or disable the specified usart peripheral.
Definition at32f413_usart.c:172
usart_receiver_enable
void usart_receiver_enable(usart_type *usart_x, confirm_state new_state)
usart receiver enable.
Definition at32f413_usart.c:198
usart_dma_transmitter_enable
void usart_dma_transmitter_enable(usart_type *usart_x, confirm_state new_state)
enable or disable the usart's dma transmitter interface.
Definition at32f413_usart.c:280
USART_STOP_1_BIT
@ USART_STOP_1_BIT
Definition at32f413_usart.h:157
USART_DATA_8BITS
@ USART_DATA_8BITS
Definition at32f413_usart.h:112
USART2
#define USART2
Definition at32f413_usart.h:319
at32f413_clock.h
header file of clock program
dma_init_type
dma init type
Definition at32f413_dma.h:275
dma_init_type::loop_mode_enable
confirm_state loop_mode_enable
Definition at32f413_dma.h:284
dma_init_type::buffer_size
uint16_t buffer_size
Definition at32f413_dma.h:279
dma_init_type::memory_data_width
dma_memory_data_size_type memory_data_width
Definition at32f413_dma.h:283
dma_init_type::priority
dma_priority_level_type priority
Definition at32f413_dma.h:285
dma_init_type::peripheral_inc_enable
confirm_state peripheral_inc_enable
Definition at32f413_dma.h:280
dma_init_type::memory_inc_enable
confirm_state memory_inc_enable
Definition at32f413_dma.h:281
dma_init_type::direction
dma_dir_type direction
Definition at32f413_dma.h:278
dma_init_type::peripheral_base_addr
uint32_t peripheral_base_addr
Definition at32f413_dma.h:276
dma_init_type::memory_base_addr
uint32_t memory_base_addr
Definition at32f413_dma.h:277
dma_init_type::peripheral_data_width
dma_peripheral_data_size_type peripheral_data_width
Definition at32f413_dma.h:282
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • usart
  • transfer_by_dma_polling
  • inc
project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • usart
  • transfer_by_dma_polling
  • inc
project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • usart
  • transfer_by_dma_polling
  • inc
project/at_start_f413/examples/usart/transfer_by_dma_polling/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • usart
  • transfer_by_dma_polling
  • src
project/at_start_f413/examples/usart/transfer_by_dma_polling/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/usart/transfer_by_dma_polling/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • usart
  • transfer_by_dma_polling
  • src
project/at_start_f413/examples/usart/transfer_by_dma_polling/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/usart/transfer_by_dma_polling/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/usart/transfer_by_dma_polling/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/usart/transfer_by_dma_polling/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/usart/transfer_by_dma_polling/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/usart/transfer_by_dma_polling/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/usart/transfer_by_dma_polling/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/usart/transfer_by_dma_polling/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/usart/transfer_by_dma_polling/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/usart/transfer_by_dma_polling/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • usart
  • transfer_by_dma_polling
  • src
project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37#define COUNTOF(a) (sizeof(a) / sizeof(*(a)))
38#define USART2_TX_BUFFER_SIZE (COUNTOF(usart2_tx_buffer) - 1)
39#define USART3_TX_BUFFER_SIZE (COUNTOF(usart3_tx_buffer) - 1)
40
41uint8_t usart2_tx_buffer[] = "usart transfer by dma interrupt: usart2 -> usart3 using dma";
42uint8_t usart3_tx_buffer[] = "usart transfer by dma interrupt: usart3 -> usart2 using dma";
43uint8_t usart2_rx_buffer[USART3_TX_BUFFER_SIZE];
44uint8_t usart3_rx_buffer[USART2_TX_BUFFER_SIZE];
45
51void usart_configuration(void)
52{
53 gpio_init_type gpio_init_struct;
54
55 /* enable the usart2 and gpio clock */
56 crm_periph_clock_enable(CRM_USART2_PERIPH_CLOCK, TRUE);
57 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
58
59 /* enable the usart3 and gpio clock */
60 crm_periph_clock_enable(CRM_USART3_PERIPH_CLOCK, TRUE);
61 crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
62
63 gpio_default_para_init(&gpio_init_struct);
64 /* configure the usart2 tx pin */
65 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
66 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
67 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
68 gpio_init_struct.gpio_pins = GPIO_PINS_2;
69 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
70 gpio_init(GPIOA, &gpio_init_struct);
71
72 /* configure the usart3 tx pin */
73 gpio_init_struct.gpio_pins = GPIO_PINS_10;
74 gpio_init(GPIOB, &gpio_init_struct);
75
76 /* configure the usart2 rx pin */
77 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
78 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
79 gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
80 gpio_init_struct.gpio_pins = GPIO_PINS_3;
81 gpio_init_struct.gpio_pull = GPIO_PULL_UP;
82 gpio_init(GPIOA, &gpio_init_struct);
83
84 /* configure the usart3 rx pin */
85 gpio_init_struct.gpio_pins = GPIO_PINS_11;
86 gpio_init(GPIOB, &gpio_init_struct);
87
88 /* configure usart2 param */
89 usart_init(USART2, 115200, USART_DATA_8BITS, USART_STOP_1_BIT);
90 usart_transmitter_enable(USART2, TRUE);
91 usart_receiver_enable(USART2, TRUE);
92 usart_dma_transmitter_enable(USART2, TRUE);
93 usart_dma_receiver_enable(USART2, TRUE);
94 usart_enable(USART2, TRUE);
95
96 /* configure usart3 param */
97 usart_init(USART3, 115200, USART_DATA_8BITS, USART_STOP_1_BIT);
98 usart_transmitter_enable(USART3, TRUE);
99 usart_receiver_enable(USART3, TRUE);
100 usart_dma_transmitter_enable(USART3, TRUE);
101 usart_dma_receiver_enable(USART3, TRUE);
102 usart_enable(USART3, TRUE);
103}
104
110void dma_configuration(void)
111{
112 dma_init_type dma_init_struct;
113
114 /* enable dma1 clock */
115 crm_periph_clock_enable(CRM_DMA1_PERIPH_CLOCK, TRUE);
116
117 /* dma1 channel1 for usart2 tx configuration */
118 dma_reset(DMA1_CHANNEL1);
119 dma_default_para_init(&dma_init_struct);
120 dma_init_struct.buffer_size = USART2_TX_BUFFER_SIZE;
121 dma_init_struct.direction = DMA_DIR_MEMORY_TO_PERIPHERAL;
122 dma_init_struct.memory_base_addr = (uint32_t)usart2_tx_buffer;
123 dma_init_struct.memory_data_width = DMA_MEMORY_DATA_WIDTH_BYTE;
124 dma_init_struct.memory_inc_enable = TRUE;
125 dma_init_struct.peripheral_base_addr = (uint32_t)&USART2->dt;
126 dma_init_struct.peripheral_data_width = DMA_PERIPHERAL_DATA_WIDTH_BYTE;
127 dma_init_struct.peripheral_inc_enable = FALSE;
128 dma_init_struct.priority = DMA_PRIORITY_MEDIUM;
129 dma_init_struct.loop_mode_enable = FALSE;
130 dma_init(DMA1_CHANNEL1, &dma_init_struct);
131
132 /* config flexible dma for usart2 tx */
133 dma_flexible_config(DMA1, FLEX_CHANNEL1, DMA_FLEXIBLE_UART2_TX);
134
135 /* dma1 channel2 for usart2 rx configuration */
136 dma_reset(DMA1_CHANNEL2);
137 dma_default_para_init(&dma_init_struct);
138 dma_init_struct.buffer_size = USART3_TX_BUFFER_SIZE;
139 dma_init_struct.direction = DMA_DIR_PERIPHERAL_TO_MEMORY;
140 dma_init_struct.memory_base_addr = (uint32_t)usart2_rx_buffer;
141 dma_init_struct.memory_data_width = DMA_MEMORY_DATA_WIDTH_BYTE;
142 dma_init_struct.memory_inc_enable = TRUE;
143 dma_init_struct.peripheral_base_addr = (uint32_t)&USART2->dt;
144 dma_init_struct.peripheral_data_width = DMA_PERIPHERAL_DATA_WIDTH_BYTE;
145 dma_init_struct.peripheral_inc_enable = FALSE;
146 dma_init_struct.priority = DMA_PRIORITY_MEDIUM;
147 dma_init_struct.loop_mode_enable = FALSE;
148 dma_init(DMA1_CHANNEL2, &dma_init_struct);
149
150 /* config flexible dma for usart2 rx */
151 dma_flexible_config(DMA1, FLEX_CHANNEL2, DMA_FLEXIBLE_UART2_RX);
152
153 /* dma1 channel3 for usart3 tx configuration */
154 dma_reset(DMA1_CHANNEL3);
155 dma_default_para_init(&dma_init_struct);
156 dma_init_struct.buffer_size = USART3_TX_BUFFER_SIZE;
157 dma_init_struct.direction = DMA_DIR_MEMORY_TO_PERIPHERAL;
158 dma_init_struct.memory_base_addr = (uint32_t)usart3_tx_buffer;
159 dma_init_struct.memory_data_width = DMA_MEMORY_DATA_WIDTH_BYTE;
160 dma_init_struct.memory_inc_enable = TRUE;
161 dma_init_struct.peripheral_base_addr = (uint32_t)&USART3->dt;
162 dma_init_struct.peripheral_data_width = DMA_PERIPHERAL_DATA_WIDTH_BYTE;
163 dma_init_struct.peripheral_inc_enable = FALSE;
164 dma_init_struct.priority = DMA_PRIORITY_MEDIUM;
165 dma_init_struct.loop_mode_enable = FALSE;
166 dma_init(DMA1_CHANNEL3, &dma_init_struct);
167
168 /* config flexible dma for usart3 tx */
169 dma_flexible_config(DMA1, FLEX_CHANNEL3, DMA_FLEXIBLE_UART3_TX);
170
171 /* dma1 channel4 for usart3 rx configuration */
172 dma_reset(DMA1_CHANNEL4);
173 dma_default_para_init(&dma_init_struct);
174 dma_init_struct.buffer_size = USART2_TX_BUFFER_SIZE;
175 dma_init_struct.direction = DMA_DIR_PERIPHERAL_TO_MEMORY;
176 dma_init_struct.memory_base_addr = (uint32_t)usart3_rx_buffer;
177 dma_init_struct.memory_data_width = DMA_MEMORY_DATA_WIDTH_BYTE;
178 dma_init_struct.memory_inc_enable = TRUE;
179 dma_init_struct.peripheral_base_addr = (uint32_t)&USART3->dt;
180 dma_init_struct.peripheral_data_width = DMA_PERIPHERAL_DATA_WIDTH_BYTE;
181 dma_init_struct.peripheral_inc_enable = FALSE;
182 dma_init_struct.priority = DMA_PRIORITY_MEDIUM;
183 dma_init_struct.loop_mode_enable = FALSE;
184 dma_init(DMA1_CHANNEL4, &dma_init_struct);
185
186 /* config flexible dma for usart3 rx */
187 dma_flexible_config(DMA1, FLEX_CHANNEL4, DMA_FLEXIBLE_UART3_RX);
188
189 dma_channel_enable(DMA1_CHANNEL2, TRUE); /* usart2 rx begin dma receiving */
190 dma_channel_enable(DMA1_CHANNEL4, TRUE); /* usart3 rx begin dma receiving */
191 dma_channel_enable(DMA1_CHANNEL1, TRUE); /* usart2 tx begin dma transmitting */
192 dma_channel_enable(DMA1_CHANNEL3, TRUE); /* usart3 tx begin dma transmitting */
193}
194
202uint8_t buffer_compare(uint8_t* pbuffer1, uint8_t* pbuffer2, uint16_t buffer_length)
203{
204 while(buffer_length--)
205 {
206 if(*pbuffer1 != *pbuffer2)
207 {
208 return 0;
209 }
210 pbuffer1++;
211 pbuffer2++;
212 }
213 return 1;
214}
215
221int main(void)
222{
223 system_clock_config();
224 at32_board_init();
225 usart_configuration();
226 dma_configuration();
227
228 /* wait dma transmission complete */
229 while((dma_flag_get(DMA1_FDT1_FLAG) == RESET) || (dma_flag_get(DMA1_FDT2_FLAG) == RESET) || \
230 (dma_flag_get(DMA1_FDT3_FLAG) == RESET) || (dma_flag_get(DMA1_FDT4_FLAG) == RESET));
231
232 while(1)
233 {
234 /* compare data buffer */
235 if(buffer_compare(usart2_tx_buffer, usart3_rx_buffer, USART2_TX_BUFFER_SIZE) && \
236 buffer_compare(usart3_tx_buffer, usart2_rx_buffer, USART3_TX_BUFFER_SIZE))
237 {
238 at32_led_toggle(LED2);
239 at32_led_toggle(LED3);
240 at32_led_toggle(LED4);
241 delay_sec(1);
242 }
243 }
244}
245
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
dma_init_struct
dma_init_type dma_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:38
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
usart_configuration
void usart_configuration(void)
config usart
Definition project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c:51
buffer_compare
uint8_t buffer_compare(uint8_t *pbuffer1, uint8_t *pbuffer2, uint16_t buffer_length)
compares two buffers.
Definition project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c:202
usart3_rx_buffer
uint8_t usart3_rx_buffer[((sizeof(usart2_tx_buffer)/sizeof(*(usart2_tx_buffer))) - 1)]
Definition project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c:44
dma_configuration
void dma_configuration(void)
config dma for usart2 and usart3
Definition project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c:110
USART2_TX_BUFFER_SIZE
#define USART2_TX_BUFFER_SIZE
Definition project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c:38
main
int main(void)
main function.
Definition project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c:221
usart2_tx_buffer
uint8_t usart2_tx_buffer[]
Definition project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c:41
USART3_TX_BUFFER_SIZE
#define USART3_TX_BUFFER_SIZE
Definition project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c:39
usart3_tx_buffer
uint8_t usart3_tx_buffer[]
Definition project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c:42
usart2_rx_buffer
uint8_t usart2_rx_buffer[((sizeof(usart3_tx_buffer)/sizeof(*(usart3_tx_buffer))) - 1)]
Definition project/at_start_f413/examples/usart/transfer_by_dma_polling/src/main.c:43
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
delay_sec
void delay_sec(uint16_t sec)
inserts a delay time.
Definition at32f413_board.c:382
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_USART3_PERIPH_CLOCK
@ CRM_USART3_PERIPH_CLOCK
Definition at32f413_crm.h:132
CRM_GPIOB_PERIPH_CLOCK
@ CRM_GPIOB_PERIPH_CLOCK
Definition at32f413_crm.h:110
CRM_DMA1_PERIPH_CLOCK
@ CRM_DMA1_PERIPH_CLOCK
Definition at32f413_crm.h:103
CRM_USART2_PERIPH_CLOCK
@ CRM_USART2_PERIPH_CLOCK
Definition at32f413_crm.h:131
dma_channel_enable
void dma_channel_enable(dma_channel_type *dmax_channely, confirm_state new_state)
enable or disable dma channely
Definition at32f413_dma.c:197
dma_default_para_init
void dma_default_para_init(dma_init_type *dma_init_struct)
dma init config with its default value.
Definition at32f413_dma.c:407
dma_flexible_config
void dma_flexible_config(dma_type *dma_x, uint8_t flex_channelx, dma_flexible_request_type flexible_request)
initialize the dma_x flexible function according to the specified parameters.
Definition at32f413_dma.c:237
dma_flag_get
flag_status dma_flag_get(uint32_t dmax_flag)
get dma flag
Definition at32f413_dma.c:343
dma_reset
void dma_reset(dma_channel_type *dmax_channely)
reset the dmax channely registers.
Definition at32f413_dma.c:63
dma_init
void dma_init(dma_channel_type *dmax_channely, dma_init_type *dma_init_struct)
dma init
Definition at32f413_dma.c:442
DMA_PERIPHERAL_DATA_WIDTH_BYTE
@ DMA_PERIPHERAL_DATA_WIDTH_BYTE
Definition at32f413_dma.h:245
DMA_FLEXIBLE_UART3_TX
@ DMA_FLEXIBLE_UART3_TX
Definition at32f413_dma.h:161
DMA_FLEXIBLE_UART2_RX
@ DMA_FLEXIBLE_UART2_RX
Definition at32f413_dma.h:158
DMA_FLEXIBLE_UART2_TX
@ DMA_FLEXIBLE_UART2_TX
Definition at32f413_dma.h:159
DMA_FLEXIBLE_UART3_RX
@ DMA_FLEXIBLE_UART3_RX
Definition at32f413_dma.h:160
DMA_DIR_MEMORY_TO_PERIPHERAL
@ DMA_DIR_MEMORY_TO_PERIPHERAL
Definition at32f413_dma.h:217
DMA_DIR_PERIPHERAL_TO_MEMORY
@ DMA_DIR_PERIPHERAL_TO_MEMORY
Definition at32f413_dma.h:216
DMA_MEMORY_DATA_WIDTH_BYTE
@ DMA_MEMORY_DATA_WIDTH_BYTE
Definition at32f413_dma.h:255
DMA_PRIORITY_MEDIUM
@ DMA_PRIORITY_MEDIUM
Definition at32f413_dma.h:266
DMA1_FDT4_FLAG
#define DMA1_FDT4_FLAG
Definition at32f413_dma.h:93
DMA1_FDT1_FLAG
#define DMA1_FDT1_FLAG
Definition at32f413_dma.h:81
DMA1_FDT2_FLAG
#define DMA1_FDT2_FLAG
Definition at32f413_dma.h:85
DMA1_FDT3_FLAG
#define DMA1_FDT3_FLAG
Definition at32f413_dma.h:89
FLEX_CHANNEL3
#define FLEX_CHANNEL3
Definition at32f413_dma.h:65
FLEX_CHANNEL1
#define FLEX_CHANNEL1
Definition at32f413_dma.h:63
FLEX_CHANNEL4
#define FLEX_CHANNEL4
Definition at32f413_dma.h:66
FLEX_CHANNEL2
#define FLEX_CHANNEL2
Definition at32f413_dma.h:64
DMA1_CHANNEL3
#define DMA1_CHANNEL3
Definition at32f413_dma.h:482
DMA1_CHANNEL4
#define DMA1_CHANNEL4
Definition at32f413_dma.h:483
DMA1_CHANNEL1
#define DMA1_CHANNEL1
Definition at32f413_dma.h:480
DMA1_CHANNEL2
#define DMA1_CHANNEL2
Definition at32f413_dma.h:481
DMA1
#define DMA1
Definition at32f413_dma.h:479
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
gpio_default_para_init
void gpio_default_para_init(gpio_init_type *gpio_init_struct)
fill each gpio_init_type member with its default value.
Definition at32f413_gpio.c:167
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_PULL_UP
@ GPIO_PULL_UP
Definition at32f413_gpio.h:244
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_10
#define GPIO_PINS_10
Definition at32f413_gpio.h:60
GPIO_PINS_11
#define GPIO_PINS_11
Definition at32f413_gpio.h:61
GPIO_PINS_2
#define GPIO_PINS_2
Definition at32f413_gpio.h:52
GPIO_PINS_3
#define GPIO_PINS_3
Definition at32f413_gpio.h:53
GPIOB
#define GPIOB
Definition at32f413_gpio.h:748
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
usart_transmitter_enable
void usart_transmitter_enable(usart_type *usart_x, confirm_state new_state)
usart transmitter enable.
Definition at32f413_usart.c:185
usart_dma_receiver_enable
void usart_dma_receiver_enable(usart_type *usart_x, confirm_state new_state)
enable or disable the usart's dma receiver interface.
Definition at32f413_usart.c:294
usart_init
void usart_init(usart_type *usart_x, uint32_t baud_rate, usart_data_bit_num_type data_bit, usart_stop_bit_num_type stop_bit)
initialize the usart peripheral according to the specified parameters.
Definition at32f413_usart.c:105
usart_enable
void usart_enable(usart_type *usart_x, confirm_state new_state)
enable or disable the specified usart peripheral.
Definition at32f413_usart.c:172
usart_receiver_enable
void usart_receiver_enable(usart_type *usart_x, confirm_state new_state)
usart receiver enable.
Definition at32f413_usart.c:198
usart_dma_transmitter_enable
void usart_dma_transmitter_enable(usart_type *usart_x, confirm_state new_state)
enable or disable the usart's dma transmitter interface.
Definition at32f413_usart.c:280
USART_STOP_1_BIT
@ USART_STOP_1_BIT
Definition at32f413_usart.h:157
USART_DATA_8BITS
@ USART_DATA_8BITS
Definition at32f413_usart.h:112
USART2
#define USART2
Definition at32f413_usart.h:319
at32f413_clock.h
header file of clock program
dma_init_type
dma init type
Definition at32f413_dma.h:275
dma_init_type::loop_mode_enable
confirm_state loop_mode_enable
Definition at32f413_dma.h:284
dma_init_type::buffer_size
uint16_t buffer_size
Definition at32f413_dma.h:279
dma_init_type::memory_data_width
dma_memory_data_size_type memory_data_width
Definition at32f413_dma.h:283
dma_init_type::priority
dma_priority_level_type priority
Definition at32f413_dma.h:285
dma_init_type::peripheral_inc_enable
confirm_state peripheral_inc_enable
Definition at32f413_dma.h:280
dma_init_type::memory_inc_enable
confirm_state memory_inc_enable
Definition at32f413_dma.h:281
dma_init_type::direction
dma_dir_type direction
Definition at32f413_dma.h:278
dma_init_type::peripheral_base_addr
uint32_t peripheral_base_addr
Definition at32f413_dma.h:276
dma_init_type::memory_base_addr
uint32_t memory_base_addr
Definition at32f413_dma.h:277
dma_init_type::peripheral_data_width
dma_peripheral_data_size_type peripheral_data_width
Definition at32f413_dma.h:282
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • usb_device
  • audio
  • inc
project/at_start_f413/examples/usb_device/audio/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • usb_device
  • audio
  • inc
project/at_start_f413/examples/usb_device/audio/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • usb_device
  • audio
  • inc
project/at_start_f413/examples/usb_device/audio/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: usb_conf.h Source File

  • usb_device
  • audio
  • inc
project/at_start_f413/examples/usb_device/audio/inc/usb_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __USB_CONF_H
28#define __USB_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "at32f413.h"
35#include "at32f413_board.h"
36#include "stdio.h"
37
49#ifndef USB_EPT_MAX_NUM
50#define USB_EPT_MAX_NUM 8
51#endif
52
56#define USB_BUFFER_SIZE_EX
62#define USB_EPT_AUTO_MALLOC_BUFFER
65#ifndef USB_EPT_AUTO_MALLOC_BUFFER
71/* ept0 tx start address 0x40, size 0x40,
72 so rx start address is 0x40 + 0x40 = 0x80 */
73#define EPT0_TX_ADDR 0x40
74#define EPT0_RX_ADDR 0x80
76#define EPT1_TX_ADDR 0xC0
77#define EPT1_RX_ADDR 0x100
79#define EPT2_TX_ADDR 0x140
80#define EPT2_RX_ADDR 0x180
82#define EPT3_TX_ADDR 0x00
83#define EPT3_RX_ADDR 0x00
85#define EPT4_TX_ADDR 0x00
86#define EPT4_RX_ADDR 0x00
88#define EPT5_TX_ADDR 0x00
89#define EPT5_RX_ADDR 0x00
91#define EPT6_TX_ADDR 0x00
92#define EPT6_RX_ADDR 0x00
94#define EPT7_TX_ADDR 0x00
95#define EPT7_RX_ADDR 0x00
97#endif
98
99void usb_delay_ms(uint32_t ms);
100void usb_delay_us(uint32_t us);
101
110#ifdef __cplusplus
111}
112#endif
113
114#endif
115
at32f413.h
at32f413 header file
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
usb_delay_ms
void usb_delay_ms(uint32_t ms)
usb delay millisecond function.
Definition project/at_start_f413/examples/usb_device/audio/src/main.c:171
usb_delay_us
void usb_delay_us(uint32_t us)
usb delay microsecond function.
Definition project/at_start_f413/examples/usb_device/audio/src/main.c:182


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • usb_device
  • audio
  • src
project/at_start_f413/examples/usb_device/audio/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/usb_device/audio/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • usb_device
  • audio
  • src
project/at_start_f413/examples/usb_device/audio/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/usb_device/audio/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/usb_device/audio/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/usb_device/audio/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/usb_device/audio/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/usb_device/audio/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/usb_device/audio/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/usb_device/audio/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/usb_device/audio/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/usb_device/audio/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • usb_device
  • audio
  • src
project/at_start_f413/examples/usb_device/audio/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include "usbd_core.h"
29#include "audio_class.h"
30#include "audio_desc.h"
31#include "usbd_int.h"
32#include "audio_codec.h"
33
42 usbd_core_type usb_core_dev;
43
49void usb_clock48m_select(usb_clk48_s clk_s)
50{
51 crm_clocks_freq_type clocks_struct;
52
53 if(clk_s == USB_CLK_HICK)
54 {
55 crm_usb_clock_source_select(CRM_USB_CLOCK_SOURCE_HICK);
56
57 /* enable the acc calibration ready interrupt */
58 crm_periph_clock_enable(CRM_ACC_PERIPH_CLOCK, TRUE);
59
60 /* update the c1\c2\c3 value */
61 acc_write_c1(7980);
62 acc_write_c2(8000);
63 acc_write_c3(8020);
64
65 /* open acc calibration */
66 acc_calibration_mode_enable(ACC_CAL_HICKTRIM, TRUE);
67 }
68 else
69 {
70 crm_clocks_freq_get(&clocks_struct);
71 switch(clocks_struct.sclk_freq)
72 {
73 /* 48MHz */
74 case 48000000:
75 crm_usb_clock_div_set(CRM_USB_DIV_1);
76 break;
77
78 /* 72MHz */
79 case 72000000:
80 crm_usb_clock_div_set(CRM_USB_DIV_1_5);
81 break;
82
83 /* 96MHz */
84 case 96000000:
85 crm_usb_clock_div_set(CRM_USB_DIV_2);
86 break;
87
88 /* 120MHz */
89 case 120000000:
90 crm_usb_clock_div_set(CRM_USB_DIV_2_5);
91 break;
92
93 /* 144MHz */
94 case 144000000:
95 crm_usb_clock_div_set(CRM_USB_DIV_3);
96 break;
97
98 /* 168MHz */
99 case 168000000:
100 crm_usb_clock_div_set(CRM_USB_DIV_3_5);
101 break;
102
103 /* 192MHz */
104 case 192000000:
105 crm_usb_clock_div_set(CRM_USB_DIV_4);
106 break;
107
108 default:
109 break;
110
111 }
112 }
113}
114
120int main(void)
121{
122 /* config nvic priority group */
123 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
124
125 /* system clock config */
126 system_clock_config();
127
128 /* audio codec init */
129 audio_codec_init();
130
131 /* at32 board init */
132 at32_board_init();
133
134 /* select usb 48m clcok source */
135 usb_clock48m_select(USB_CLK_HEXT);
136
137 /* enable usb clock */
138 crm_periph_clock_enable(CRM_USB_PERIPH_CLOCK, TRUE);
139
140 /* enable usb interrupt */
141 nvic_irq_enable(USBFS_L_CAN1_RX0_IRQn, 0, 0);
142
143 /* usb core init */
144 usbd_core_init(&usb_core_dev, USB, &audio_class_handler, &audio_desc_handler, 0);
145
146 /* enable usb pull-up */
147 usbd_connect(&usb_core_dev);
148
149 while(1)
150 {
151 audio_codec_loop();
152 delay_ms(100);
153 }
154}
155
161void USBFS_L_CAN1_RX0_IRQHandler(void)
162{
163 usbd_irq_handler(&usb_core_dev);
164}
165
171void usb_delay_ms(uint32_t ms)
172{
173 /* user can define self delay function */
174 delay_ms(ms);
175}
176
182void usb_delay_us(uint32_t us)
183{
184 delay_us(us);
185}
186
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
audio_class.h
usb audio class file
audio_desc.h
usb audio descriptor header file
usb_delay_ms
void usb_delay_ms(uint32_t ms)
usb delay millisecond function.
Definition project/at_start_f413/examples/acc/calibration/src/main.c:244
usb_delay_us
void usb_delay_us(uint32_t us)
usb delay microsecond function.
Definition project/at_start_f413/examples/acc/calibration/src/main.c:255
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
usb_clock48m_select
void usb_clock48m_select(usb_clk48_s clk_s)
usb 48M clock select
Definition project/at_start_f413/examples/usb_device/audio/src/main.c:49
main
int main(void)
main function.
Definition project/at_start_f413/examples/usb_device/audio/src/main.c:120
USBFS_L_CAN1_RX0_IRQHandler
void USBFS_L_CAN1_RX0_IRQHandler(void)
this function handles usb interrupt.
Definition project/at_start_f413/examples/usb_device/audio/src/main.c:161
usb_core_dev
usbd_core_type usb_core_dev
Definition project/at_start_f413/examples/usb_device/audio/src/main.c:42
ACC_CAL_HICKTRIM
#define ACC_CAL_HICKTRIM
Definition at32f413_acc.h:52
acc_write_c2
void acc_write_c2(uint16_t acc_c2_value)
wtire the value to acc c2 register.
Definition at32f413_acc.c:131
acc_write_c3
void acc_write_c3(uint16_t acc_c3_value)
wtire the value to acc c3 register.
Definition at32f413_acc.c:141
acc_write_c1
void acc_write_c1(uint16_t acc_c1_value)
wtire the value to acc c1 register.
Definition at32f413_acc.c:121
acc_calibration_mode_enable
void acc_calibration_mode_enable(uint16_t acc_trim, confirm_state new_state)
enable or disable the acc calibration mode.
Definition at32f413_acc.c:52
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
delay_us
void delay_us(uint32_t nus)
inserts a delay time.
Definition at32f413_board.c:330
crm_usb_clock_div_set
void crm_usb_clock_div_set(crm_usb_div_type div_value)
set crm usb division
Definition at32f413_crm.c:533
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_usb_clock_source_select
void crm_usb_clock_source_select(crm_usb_clock_source_type value)
usb 48 mhz clock source select
Definition at32f413_crm.c:854
crm_clocks_freq_get
void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
Definition at32f413_crm.c:660
CRM_USB_PERIPH_CLOCK
@ CRM_USB_PERIPH_CLOCK
Definition at32f413_crm.h:137
CRM_ACC_PERIPH_CLOCK
@ CRM_ACC_PERIPH_CLOCK
Definition at32f413_crm.h:123
CRM_USB_DIV_3
@ CRM_USB_DIV_3
Definition at32f413_crm.h:363
CRM_USB_DIV_1_5
@ CRM_USB_DIV_1_5
Definition at32f413_crm.h:358
CRM_USB_DIV_4
@ CRM_USB_DIV_4
Definition at32f413_crm.h:364
CRM_USB_DIV_3_5
@ CRM_USB_DIV_3_5
Definition at32f413_crm.h:362
CRM_USB_DIV_2
@ CRM_USB_DIV_2
Definition at32f413_crm.h:361
CRM_USB_DIV_1
@ CRM_USB_DIV_1
Definition at32f413_crm.h:359
CRM_USB_DIV_2_5
@ CRM_USB_DIV_2_5
Definition at32f413_crm.h:360
CRM_USB_CLOCK_SOURCE_HICK
@ CRM_USB_CLOCK_SOURCE_HICK
Definition at32f413_crm.h:454
USBFS_L_CAN1_RX0_IRQn
@ USBFS_L_CAN1_RX0_IRQn
Definition at32f413.h:192
TRUE
@ TRUE
Definition at32f413.h:297
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
audio_class_handler
usbd_class_handler audio_class_handler
Definition audio_class.c:64
audio_desc_handler
usbd_desc_handler audio_desc_handler
device descriptor handler structure
Definition audio_desc.c:64
audio_codec_loop
error_status audio_codec_loop(void)
audio codec loop
Definition audio/src/audio_codec.c:856
audio_codec_init
error_status audio_codec_init(void)
audio codec init
Definition audio/src/audio_codec.c:797
usb_clk48_s
usb_clk48_s
usb clock select
Definition at32f413_usb.h:230
USB_CLK_HEXT
@ USB_CLK_HEXT
Definition at32f413_usb.h:232
USB_CLK_HICK
@ USB_CLK_HICK
Definition at32f413_usb.h:231
usbd_core_init
void usbd_core_init(usbd_core_type *udev, usb_reg_type *usb_reg, usbd_class_handler *dev_handler, usbd_desc_handler *desc_handler, uint8_t core_id)
initializes the usb core
Definition usbd_core.c:675
usbd_connect
void usbd_connect(usbd_core_type *udev)
usb device connect to host
Definition usbd_core.c:564
usbd_irq_handler
void usbd_irq_handler(usbd_core_type *udev)
usb device interrput request handler.
Definition usbd_int.c:45
USB
#define USB
Definition at32f413_usb.h:665
at32f413_clock.h
header file of clock program
crm_clocks_freq_type
crm clocks freqency structure
Definition at32f413_crm.h:470
crm_clocks_freq_type::sclk_freq
uint32_t sclk_freq
Definition at32f413_crm.h:471
usbd_core_type
usb device core struct type
Definition usbd_core.h:114
usbd_core.h
usb device core header file
usbd_int.h


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • usb_device
  • composite_audio_hid
  • inc
project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • usb_device
  • composite_audio_hid
  • inc
project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • usb_device
  • composite_audio_hid
  • inc
project/at_start_f413/examples/usb_device/composite_audio_hid/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: usb_conf.h Source File

  • usb_device
  • composite_audio_hid
  • inc
project/at_start_f413/examples/usb_device/composite_audio_hid/inc/usb_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __USB_CONF_H
28#define __USB_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "at32f413.h"
35#include "at32f413_board.h"
36#include "stdio.h"
37
49#ifndef USB_EPT_MAX_NUM
50#define USB_EPT_MAX_NUM 8
51#endif
52
56#define USB_BUFFER_SIZE_EX
62#define USB_EPT_AUTO_MALLOC_BUFFER
65#ifndef USB_EPT_AUTO_MALLOC_BUFFER
71/* ept0 tx start address 0x40, size 0x40,
72 so rx start address is 0x40 + 0x40 = 0x80 */
73#define EPT0_TX_ADDR 0x40
74#define EPT0_RX_ADDR 0x80
76#define EPT1_TX_ADDR 0xC0
77#define EPT1_RX_ADDR 0x100
79#define EPT2_TX_ADDR 0x140
80#define EPT2_RX_ADDR 0x180
82#define EPT3_TX_ADDR 0x00
83#define EPT3_RX_ADDR 0x00
85#define EPT4_TX_ADDR 0x00
86#define EPT4_RX_ADDR 0x00
88#define EPT5_TX_ADDR 0x00
89#define EPT5_RX_ADDR 0x00
91#define EPT6_TX_ADDR 0x00
92#define EPT6_RX_ADDR 0x00
94#define EPT7_TX_ADDR 0x00
95#define EPT7_RX_ADDR 0x00
97#endif
98
99void usb_delay_ms(uint32_t ms);
100void usb_delay_us(uint32_t us);
101
109#ifdef __cplusplus
110}
111#endif
112
113#endif
114
at32f413.h
at32f413 header file
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
usb_delay_ms
void usb_delay_ms(uint32_t ms)
usb delay millisecond function.
Definition project/at_start_f413/examples/usb_device/composite_audio_hid/src/main.c:180
usb_delay_us
void usb_delay_us(uint32_t us)
usb delay microsecond function.
Definition project/at_start_f413/examples/usb_device/composite_audio_hid/src/main.c:191


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • usb_device
  • composite_audio_hid
  • src
project/at_start_f413/examples/usb_device/composite_audio_hid/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/usb_device/composite_audio_hid/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • usb_device
  • composite_audio_hid
  • src
project/at_start_f413/examples/usb_device/composite_audio_hid/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/usb_device/composite_audio_hid/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/usb_device/composite_audio_hid/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/usb_device/composite_audio_hid/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/usb_device/composite_audio_hid/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/usb_device/composite_audio_hid/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/usb_device/composite_audio_hid/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/usb_device/composite_audio_hid/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/usb_device/composite_audio_hid/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/usb_device/composite_audio_hid/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • usb_device
  • composite_audio_hid
  • src
project/at_start_f413/examples/usb_device/composite_audio_hid/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include "usbd_core.h"
29#include "usbd_int.h"
30#include "audio_hid_class.h"
31#include "audio_hid_desc.h"
32#include "audio_codec.h"
33
42/* usb global struct define */
43 usbd_core_type usb_core_dev;
44
45uint8_t report_buf[USBD_AUHID_IN_MAXPACKET_SIZE];
46
52void usb_clock48m_select(usb_clk48_s clk_s)
53{
54 crm_clocks_freq_type clocks_struct;
55
56 if(clk_s == USB_CLK_HICK)
57 {
58 crm_usb_clock_source_select(CRM_USB_CLOCK_SOURCE_HICK);
59
60 /* enable the acc calibration ready interrupt */
61 crm_periph_clock_enable(CRM_ACC_PERIPH_CLOCK, TRUE);
62
63 /* update the c1\c2\c3 value */
64 acc_write_c1(7980);
65 acc_write_c2(8000);
66 acc_write_c3(8020);
67
68 /* open acc calibration */
69 acc_calibration_mode_enable(ACC_CAL_HICKTRIM, TRUE);
70 }
71 else
72 {
73 crm_clocks_freq_get(&clocks_struct);
74 switch(clocks_struct.sclk_freq)
75 {
76 /* 48MHz */
77 case 48000000:
78 crm_usb_clock_div_set(CRM_USB_DIV_1);
79 break;
80
81 /* 72MHz */
82 case 72000000:
83 crm_usb_clock_div_set(CRM_USB_DIV_1_5);
84 break;
85
86 /* 96MHz */
87 case 96000000:
88 crm_usb_clock_div_set(CRM_USB_DIV_2);
89 break;
90
91 /* 120MHz */
92 case 120000000:
93 crm_usb_clock_div_set(CRM_USB_DIV_2_5);
94 break;
95
96 /* 144MHz */
97 case 144000000:
98 crm_usb_clock_div_set(CRM_USB_DIV_3);
99 break;
100
101 /* 168MHz */
102 case 168000000:
103 crm_usb_clock_div_set(CRM_USB_DIV_3_5);
104 break;
105
106 /* 192MHz */
107 case 192000000:
108 crm_usb_clock_div_set(CRM_USB_DIV_4);
109 break;
110
111 default:
112 break;
113
114 }
115 }
116}
117
123int main(void)
124{
125 /* config nvic priority group */
126 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
127
128 /* system clock config */
129 system_clock_config();
130
131 /* audio codec init */
132 audio_codec_init();
133
134 /* at32 board init */
135 at32_board_init();
136
137 /* select usb 48m clcok source */
138 usb_clock48m_select(USB_CLK_HEXT);
139
140 /* enable usb clock */
141 crm_periph_clock_enable(CRM_USB_PERIPH_CLOCK, TRUE);
142
143 /* enable usb interrupt */
144 nvic_irq_enable(USBFS_L_CAN1_RX0_IRQn, 0, 0);
145
146 /* usb core init */
147 usbd_core_init(&usb_core_dev, USB, &audio_hid_class_handler, &audio_hid_desc_handler, 0);
148
149 /* enable usb pull-up */
150 usbd_connect(&usb_core_dev);
151
152 while(1)
153 {
154 audio_codec_loop();
155 if(at32_button_press() == USER_BUTTON)
156 {
157 report_buf[0] = HID_REPORT_ID_5;
158 report_buf[1] = (~report_buf[1]) & 0x1;
159 audio_hid_class_send_report(&usb_core_dev, report_buf, USBD_AUHID_IN_MAXPACKET_SIZE);
160 }
161 delay_ms(100);
162 }
163}
164
170void USBFS_L_CAN1_RX0_IRQHandler(void)
171{
172 usbd_irq_handler(&usb_core_dev);
173}
174
180void usb_delay_ms(uint32_t ms)
181{
182 /* user can define self delay function */
183 delay_ms(ms);
184}
185
191void usb_delay_us(uint32_t us)
192{
193 delay_us(us);
194}
195
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
audio_hid_class.h
audio_hid_desc.h
usb_delay_ms
void usb_delay_ms(uint32_t ms)
usb delay millisecond function.
Definition project/at_start_f413/examples/acc/calibration/src/main.c:244
usb_delay_us
void usb_delay_us(uint32_t us)
usb delay microsecond function.
Definition project/at_start_f413/examples/acc/calibration/src/main.c:255
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
report_buf
uint8_t report_buf[0x40]
Definition project/at_start_f413/examples/usb_device/composite_audio_hid/src/main.c:45
usb_clock48m_select
void usb_clock48m_select(usb_clk48_s clk_s)
usb 48M clock select
Definition project/at_start_f413/examples/usb_device/composite_audio_hid/src/main.c:52
main
int main(void)
main function.
Definition project/at_start_f413/examples/usb_device/composite_audio_hid/src/main.c:123
USBFS_L_CAN1_RX0_IRQHandler
void USBFS_L_CAN1_RX0_IRQHandler(void)
this function handles usb interrupt.
Definition project/at_start_f413/examples/usb_device/composite_audio_hid/src/main.c:170
usb_core_dev
usbd_core_type usb_core_dev
Definition project/at_start_f413/examples/usb_device/composite_audio_hid/src/main.c:43
ACC_CAL_HICKTRIM
#define ACC_CAL_HICKTRIM
Definition at32f413_acc.h:52
acc_write_c2
void acc_write_c2(uint16_t acc_c2_value)
wtire the value to acc c2 register.
Definition at32f413_acc.c:131
acc_write_c3
void acc_write_c3(uint16_t acc_c3_value)
wtire the value to acc c3 register.
Definition at32f413_acc.c:141
acc_write_c1
void acc_write_c1(uint16_t acc_c1_value)
wtire the value to acc c1 register.
Definition at32f413_acc.c:121
acc_calibration_mode_enable
void acc_calibration_mode_enable(uint16_t acc_trim, confirm_state new_state)
enable or disable the acc calibration mode.
Definition at32f413_acc.c:52
USER_BUTTON
@ USER_BUTTON
Definition at32f413_board.h:93
at32_button_press
button_type at32_button_press()
returns which button have press down
Definition at32f413_board.c:218
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
delay_us
void delay_us(uint32_t nus)
inserts a delay time.
Definition at32f413_board.c:330
crm_usb_clock_div_set
void crm_usb_clock_div_set(crm_usb_div_type div_value)
set crm usb division
Definition at32f413_crm.c:533
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_usb_clock_source_select
void crm_usb_clock_source_select(crm_usb_clock_source_type value)
usb 48 mhz clock source select
Definition at32f413_crm.c:854
crm_clocks_freq_get
void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
Definition at32f413_crm.c:660
CRM_USB_PERIPH_CLOCK
@ CRM_USB_PERIPH_CLOCK
Definition at32f413_crm.h:137
CRM_ACC_PERIPH_CLOCK
@ CRM_ACC_PERIPH_CLOCK
Definition at32f413_crm.h:123
CRM_USB_DIV_3
@ CRM_USB_DIV_3
Definition at32f413_crm.h:363
CRM_USB_DIV_1_5
@ CRM_USB_DIV_1_5
Definition at32f413_crm.h:358
CRM_USB_DIV_4
@ CRM_USB_DIV_4
Definition at32f413_crm.h:364
CRM_USB_DIV_3_5
@ CRM_USB_DIV_3_5
Definition at32f413_crm.h:362
CRM_USB_DIV_2
@ CRM_USB_DIV_2
Definition at32f413_crm.h:361
CRM_USB_DIV_1
@ CRM_USB_DIV_1
Definition at32f413_crm.h:359
CRM_USB_DIV_2_5
@ CRM_USB_DIV_2_5
Definition at32f413_crm.h:360
CRM_USB_CLOCK_SOURCE_HICK
@ CRM_USB_CLOCK_SOURCE_HICK
Definition at32f413_crm.h:454
USBFS_L_CAN1_RX0_IRQn
@ USBFS_L_CAN1_RX0_IRQn
Definition at32f413.h:192
TRUE
@ TRUE
Definition at32f413.h:297
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
USBD_AUHID_IN_MAXPACKET_SIZE
#define USBD_AUHID_IN_MAXPACKET_SIZE
usb custom hid in and out max packet size define
Definition audio_hid_class.h:66
audio_hid_class_send_report
usb_sts_type audio_hid_class_send_report(void *udev, uint8_t *report, uint16_t len)
usb device class send report
Definition audio_hid_class.c:895
audio_hid_class_handler
usbd_class_handler audio_hid_class_handler
Definition audio_hid_class.c:63
HID_REPORT_ID_5
#define HID_REPORT_ID_5
Definition audio_hid_desc.h:225
audio_hid_desc_handler
usbd_desc_handler audio_hid_desc_handler
device descriptor handler structure
Definition audio_hid_desc.c:66
audio_codec_loop
error_status audio_codec_loop(void)
audio codec loop
Definition audio/src/audio_codec.c:856
audio_codec_init
error_status audio_codec_init(void)
audio codec init
Definition audio/src/audio_codec.c:797
usb_clk48_s
usb_clk48_s
usb clock select
Definition at32f413_usb.h:230
USB_CLK_HEXT
@ USB_CLK_HEXT
Definition at32f413_usb.h:232
USB_CLK_HICK
@ USB_CLK_HICK
Definition at32f413_usb.h:231
usbd_core_init
void usbd_core_init(usbd_core_type *udev, usb_reg_type *usb_reg, usbd_class_handler *dev_handler, usbd_desc_handler *desc_handler, uint8_t core_id)
initializes the usb core
Definition usbd_core.c:675
usbd_connect
void usbd_connect(usbd_core_type *udev)
usb device connect to host
Definition usbd_core.c:564
usbd_irq_handler
void usbd_irq_handler(usbd_core_type *udev)
usb device interrput request handler.
Definition usbd_int.c:45
USB
#define USB
Definition at32f413_usb.h:665
at32f413_clock.h
header file of clock program
crm_clocks_freq_type
crm clocks freqency structure
Definition at32f413_crm.h:470
crm_clocks_freq_type::sclk_freq
uint32_t sclk_freq
Definition at32f413_crm.h:471
usbd_core_type
usb device core struct type
Definition usbd_core.h:114
usbd_core.h
usb device core header file
usbd_int.h


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • usb_device
  • composite_vcp_keyboard
  • inc
project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • usb_device
  • composite_vcp_keyboard
  • inc
project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • usb_device
  • composite_vcp_keyboard
  • inc
project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: usb_conf.h Source File

  • usb_device
  • composite_vcp_keyboard
  • inc
project/at_start_f413/examples/usb_device/composite_vcp_keyboard/inc/usb_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __USB_CONF_H
28#define __USB_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "at32f413.h"
35#include "at32f413_board.h"
36#include "stdio.h"
37
49#ifndef USB_EPT_MAX_NUM
50#define USB_EPT_MAX_NUM 8
51#endif
52
56//#define USB_BUFFER_SIZE_EX /*!< usb enable extend buffer */
57
58
62#define USB_EPT_AUTO_MALLOC_BUFFER
65#ifndef USB_EPT_AUTO_MALLOC_BUFFER
71/* ept0 tx start address 0x40, size 0x40,
72 so rx start address is 0x40 + 0x40 = 0x80 */
73#define EPT0_TX_ADDR 0x40
74#define EPT0_RX_ADDR 0x80
76#define EPT1_TX_ADDR 0xC0
77#define EPT1_RX_ADDR 0x100
79#define EPT2_TX_ADDR 0x140
80#define EPT2_RX_ADDR 0x180
82#define EPT3_TX_ADDR 0x00
83#define EPT3_RX_ADDR 0x00
85#define EPT4_TX_ADDR 0x00
86#define EPT4_RX_ADDR 0x00
88#define EPT5_TX_ADDR 0x00
89#define EPT5_RX_ADDR 0x00
91#define EPT6_TX_ADDR 0x00
92#define EPT6_RX_ADDR 0x00
94#define EPT7_TX_ADDR 0x00
95#define EPT7_RX_ADDR 0x00
97#endif
98void usb_delay_ms(uint32_t ms);
99void usb_delay_us(uint32_t us);
100
109#ifdef __cplusplus
110}
111#endif
112
113#endif
114
at32f413.h
at32f413 header file
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
usb_delay_ms
void usb_delay_ms(uint32_t ms)
usb delay millisecond function.
Definition project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/main.c:237
usb_delay_us
void usb_delay_us(uint32_t us)
usb delay microsecond function.
Definition project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/main.c:248


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • usb_device
  • composite_vcp_keyboard
  • src
project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • usb_device
  • composite_vcp_keyboard
  • src
project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • usb_device
  • composite_vcp_keyboard
  • src
project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include "usbd_core.h"
29#include "cdc_keyboard_class.h"
30#include "cdc_keyboard_desc.h"
31#include "usbd_int.h"
32
41 usbd_core_type usb_core_dev;
42uint8_t usb_buffer[256];
43void keyboard_send_string(void *udev, uint8_t *string, uint8_t len);
44
50void usb_clock48m_select(usb_clk48_s clk_s)
51{
52 crm_clocks_freq_type clocks_struct;
53
54 if(clk_s == USB_CLK_HICK)
55 {
56 crm_usb_clock_source_select(CRM_USB_CLOCK_SOURCE_HICK);
57
58 /* enable the acc calibration ready interrupt */
59 crm_periph_clock_enable(CRM_ACC_PERIPH_CLOCK, TRUE);
60
61 /* update the c1\c2\c3 value */
62 acc_write_c1(7980);
63 acc_write_c2(8000);
64 acc_write_c3(8020);
65
66 /* open acc calibration */
67 acc_calibration_mode_enable(ACC_CAL_HICKTRIM, TRUE);
68 }
69 else
70 {
71 crm_clocks_freq_get(&clocks_struct);
72 switch(clocks_struct.sclk_freq)
73 {
74 /* 48MHz */
75 case 48000000:
76 crm_usb_clock_div_set(CRM_USB_DIV_1);
77 break;
78
79 /* 72MHz */
80 case 72000000:
81 crm_usb_clock_div_set(CRM_USB_DIV_1_5);
82 break;
83
84 /* 96MHz */
85 case 96000000:
86 crm_usb_clock_div_set(CRM_USB_DIV_2);
87 break;
88
89 /* 120MHz */
90 case 120000000:
91 crm_usb_clock_div_set(CRM_USB_DIV_2_5);
92 break;
93
94 /* 144MHz */
95 case 144000000:
96 crm_usb_clock_div_set(CRM_USB_DIV_3);
97 break;
98
99 /* 168MHz */
100 case 168000000:
101 crm_usb_clock_div_set(CRM_USB_DIV_3_5);
102 break;
103
104 /* 192MHz */
105 case 192000000:
106 crm_usb_clock_div_set(CRM_USB_DIV_4);
107 break;
108
109 default:
110 break;
111
112 }
113 }
114}
115
122void keyboard_send_string(void *udev, uint8_t *string, uint8_t len)
123{
124 uint8_t index = 0;
125 usbd_core_type *pudev = (usbd_core_type *)udev;
126 vcp_keyboard_type *vcpkybrd = (vcp_keyboard_type *)pudev->class_handler->pdata;
127 for(index = 0; index < len; index ++)
128 {
129 while(1)
130 {
131 if(vcpkybrd->g_keyboard_tx_completed == 1)
132 {
133 vcpkybrd->g_keyboard_tx_completed = 0;
134 usb_vcpkybrd_keyboard_send_char(&usb_core_dev, string[index]);
135 break;
136 }
137 }
138 /* send 0x00 */
139 while(1)
140 {
141 if(vcpkybrd->g_keyboard_tx_completed == 1)
142 {
143 vcpkybrd->g_keyboard_tx_completed = 0;
144 usb_vcpkybrd_keyboard_send_char(&usb_core_dev, 0x00);
145 break;
146 }
147 }
148 }
149
150}
151
157int main(void)
158{
159 uint16_t data_len;
160
161 uint32_t timeout;
162
163 uint8_t send_zero_packet = 0;
164
165 /* config nvic priority group */
166 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
167
168 system_clock_config();
169
170 at32_board_init();
171
172 /* select usb 48m clcok source */
173 usb_clock48m_select(USB_CLK_HEXT);
174
175 /* enable usb clock */
176 crm_periph_clock_enable(CRM_USB_PERIPH_CLOCK, TRUE);
177
178 /* enable usb interrupt */
179 nvic_irq_enable(USBFS_L_CAN1_RX0_IRQn, 0, 0);
180
181 /* usb core init */
182 usbd_core_init(&usb_core_dev, USB, &cdc_keyboard_class_handler, &cdc_keyboard_desc_handler, 0);
183
184 /* enable usb pull-up */
185 usbd_connect(&usb_core_dev);
186
187 while(1)
188 {
189 /* get usb vcp receive data */
190 data_len = usb_vcpkybrd_vcp_get_rxdata(&usb_core_dev, usb_buffer);
191
192 if(data_len > 0 || send_zero_packet == 1)
193 {
194 /* bulk transfer is complete when the endpoint does one of the following
195 1 has transferred exactly the amount of data expected
196 2 transfers a packet with a payload size less than wMaxPacketSize or transfers a zero-length packet
197 */
198 if(data_len > 0)
199 send_zero_packet = 1;
200
201 if(data_len == 0)
202 send_zero_packet = 0;
203
204 timeout = 5000000;
205 do
206 {
207 /* send data to host */
208 if(usb_vcpkybrd_vcp_send_data(&usb_core_dev, usb_buffer, data_len) == SUCCESS)
209 {
210 break;
211 }
212 }while(timeout --);
213 }
214
215 if(at32_button_press() == USER_BUTTON)
216 {
217 keyboard_send_string(&usb_core_dev, (uint8_t *)" Keyboard Demo\r\n", 16);
218 }
219 }
220}
221
227void USBFS_L_CAN1_RX0_IRQHandler(void)
228{
229 usbd_irq_handler(&usb_core_dev);
230}
231
237void usb_delay_ms(uint32_t ms)
238{
239 /* user can define self delay function */
240 delay_ms(ms);
241}
242
248void usb_delay_us(uint32_t us)
249{
250 delay_us(us);
251}
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
cdc_keyboard_class.h
usb cdc and keyboard class file
cdc_keyboard_desc.h
usb cdc and keyboard descriptor header file
usb_delay_ms
void usb_delay_ms(uint32_t ms)
usb delay millisecond function.
Definition project/at_start_f413/examples/acc/calibration/src/main.c:244
usb_delay_us
void usb_delay_us(uint32_t us)
usb delay microsecond function.
Definition project/at_start_f413/examples/acc/calibration/src/main.c:255
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
usb_clock48m_select
void usb_clock48m_select(usb_clk48_s clk_s)
usb 48M clock select
Definition project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/main.c:50
main
int main(void)
main function.
Definition project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/main.c:157
keyboard_send_string
void keyboard_send_string(void *udev, uint8_t *string, uint8_t len)
keyboard send string
Definition project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/main.c:122
USBFS_L_CAN1_RX0_IRQHandler
void USBFS_L_CAN1_RX0_IRQHandler(void)
this function handles usb interrupt.
Definition project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/main.c:227
usb_buffer
uint8_t usb_buffer[256]
Definition project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/main.c:42
usb_core_dev
usbd_core_type usb_core_dev
Definition project/at_start_f413/examples/usb_device/composite_vcp_keyboard/src/main.c:41
ACC_CAL_HICKTRIM
#define ACC_CAL_HICKTRIM
Definition at32f413_acc.h:52
acc_write_c2
void acc_write_c2(uint16_t acc_c2_value)
wtire the value to acc c2 register.
Definition at32f413_acc.c:131
acc_write_c3
void acc_write_c3(uint16_t acc_c3_value)
wtire the value to acc c3 register.
Definition at32f413_acc.c:141
acc_write_c1
void acc_write_c1(uint16_t acc_c1_value)
wtire the value to acc c1 register.
Definition at32f413_acc.c:121
acc_calibration_mode_enable
void acc_calibration_mode_enable(uint16_t acc_trim, confirm_state new_state)
enable or disable the acc calibration mode.
Definition at32f413_acc.c:52
USER_BUTTON
@ USER_BUTTON
Definition at32f413_board.h:93
at32_button_press
button_type at32_button_press()
returns which button have press down
Definition at32f413_board.c:218
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
delay_us
void delay_us(uint32_t nus)
inserts a delay time.
Definition at32f413_board.c:330
crm_usb_clock_div_set
void crm_usb_clock_div_set(crm_usb_div_type div_value)
set crm usb division
Definition at32f413_crm.c:533
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_usb_clock_source_select
void crm_usb_clock_source_select(crm_usb_clock_source_type value)
usb 48 mhz clock source select
Definition at32f413_crm.c:854
crm_clocks_freq_get
void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
Definition at32f413_crm.c:660
CRM_USB_PERIPH_CLOCK
@ CRM_USB_PERIPH_CLOCK
Definition at32f413_crm.h:137
CRM_ACC_PERIPH_CLOCK
@ CRM_ACC_PERIPH_CLOCK
Definition at32f413_crm.h:123
CRM_USB_DIV_3
@ CRM_USB_DIV_3
Definition at32f413_crm.h:363
CRM_USB_DIV_1_5
@ CRM_USB_DIV_1_5
Definition at32f413_crm.h:358
CRM_USB_DIV_4
@ CRM_USB_DIV_4
Definition at32f413_crm.h:364
CRM_USB_DIV_3_5
@ CRM_USB_DIV_3_5
Definition at32f413_crm.h:362
CRM_USB_DIV_2
@ CRM_USB_DIV_2
Definition at32f413_crm.h:361
CRM_USB_DIV_1
@ CRM_USB_DIV_1
Definition at32f413_crm.h:359
CRM_USB_DIV_2_5
@ CRM_USB_DIV_2_5
Definition at32f413_crm.h:360
CRM_USB_CLOCK_SOURCE_HICK
@ CRM_USB_CLOCK_SOURCE_HICK
Definition at32f413_crm.h:454
USBFS_L_CAN1_RX0_IRQn
@ USBFS_L_CAN1_RX0_IRQn
Definition at32f413.h:192
SUCCESS
@ SUCCESS
Definition at32f413.h:302
TRUE
@ TRUE
Definition at32f413.h:297
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
usb_vcpkybrd_vcp_send_data
error_status usb_vcpkybrd_vcp_send_data(void *udev, uint8_t *send_data, uint16_t len)
usb device class send data
Definition cdc_keyboard_class.c:632
usb_vcpkybrd_keyboard_send_char
void usb_vcpkybrd_keyboard_send_char(void *udev, uint8_t ascii_code)
usb keyoard send char
Definition cdc_keyboard_class.c:711
cdc_keyboard_class_handler
usbd_class_handler cdc_keyboard_class_handler
Definition cdc_keyboard_class.c:204
usb_vcpkybrd_vcp_get_rxdata
uint16_t usb_vcpkybrd_vcp_get_rxdata(void *udev, uint8_t *recv_data)
usb device class rx data process
Definition cdc_keyboard_class.c:601
cdc_keyboard_desc_handler
usbd_desc_handler cdc_keyboard_desc_handler
device descriptor handler structure
Definition cdc_keyboard_desc.c:64
usb_clk48_s
usb_clk48_s
usb clock select
Definition at32f413_usb.h:230
USB_CLK_HEXT
@ USB_CLK_HEXT
Definition at32f413_usb.h:232
USB_CLK_HICK
@ USB_CLK_HICK
Definition at32f413_usb.h:231
usbd_core_init
void usbd_core_init(usbd_core_type *udev, usb_reg_type *usb_reg, usbd_class_handler *dev_handler, usbd_desc_handler *desc_handler, uint8_t core_id)
initializes the usb core
Definition usbd_core.c:675
usbd_connect
void usbd_connect(usbd_core_type *udev)
usb device connect to host
Definition usbd_core.c:564
usbd_irq_handler
void usbd_irq_handler(usbd_core_type *udev)
usb device interrput request handler.
Definition usbd_int.c:45
USB
#define USB
Definition at32f413_usb.h:665
at32f413_clock.h
header file of clock program
crm_clocks_freq_type
crm clocks freqency structure
Definition at32f413_crm.h:470
crm_clocks_freq_type::sclk_freq
uint32_t sclk_freq
Definition at32f413_crm.h:471
usbd_class_handler::pdata
void * pdata
Definition usbd_core.h:107
usbd_core_type
usb device core struct type
Definition usbd_core.h:114
usbd_core_type::class_handler
usbd_class_handler * class_handler
Definition usbd_core.h:117
vcp_keyboard_type
Definition cdc_keyboard_class.h:74
vcp_keyboard_type::g_keyboard_tx_completed
__IO uint8_t g_keyboard_tx_completed
Definition cdc_keyboard_class.h:87
usbd_core.h
usb device core header file
usbd_int.h


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • usb_device
  • composite_vcp_msc
  • inc
project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • usb_device
  • composite_vcp_msc
  • inc
project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • usb_device
  • composite_vcp_msc
  • inc
project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: usb_conf.h Source File

  • usb_device
  • composite_vcp_msc
  • inc
project/at_start_f413/examples/usb_device/composite_vcp_msc/inc/usb_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __USB_CONF_H
28#define __USB_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "at32f413.h"
35#include "at32f413_board.h"
36#include "stdio.h"
37
49#ifndef USB_EPT_MAX_NUM
50#define USB_EPT_MAX_NUM 8
51#endif
52
56//#define USB_BUFFER_SIZE_EX /*!< usb enable extend buffer */
57
58
62#define USB_EPT_AUTO_MALLOC_BUFFER
65#ifndef USB_EPT_AUTO_MALLOC_BUFFER
71/* ept0 tx start address 0x40, size 0x40,
72 so rx start address is 0x40 + 0x40 = 0x80 */
73#define EPT0_TX_ADDR 0x40
74#define EPT0_RX_ADDR 0x80
76#define EPT1_TX_ADDR 0xC0
77#define EPT1_RX_ADDR 0x100
79#define EPT2_TX_ADDR 0x140
80#define EPT2_RX_ADDR 0x180
82#define EPT3_TX_ADDR 0x00
83#define EPT3_RX_ADDR 0x00
85#define EPT4_TX_ADDR 0x00
86#define EPT4_RX_ADDR 0x00
88#define EPT5_TX_ADDR 0x00
89#define EPT5_RX_ADDR 0x00
91#define EPT6_TX_ADDR 0x00
92#define EPT6_RX_ADDR 0x00
94#define EPT7_TX_ADDR 0x00
95#define EPT7_RX_ADDR 0x00
97#endif
98void usb_delay_ms(uint32_t ms);
99void usb_delay_us(uint32_t us);
100
109#ifdef __cplusplus
110}
111#endif
112
113#endif
114
at32f413.h
at32f413 header file
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
usb_delay_ms
void usb_delay_ms(uint32_t ms)
usb delay millisecond function.
Definition project/at_start_f413/examples/acc/calibration/src/main.c:244
usb_delay_us
void usb_delay_us(uint32_t us)
usb delay microsecond function.
Definition project/at_start_f413/examples/acc/calibration/src/main.c:255


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • usb_device
  • composite_vcp_msc
  • src
project/at_start_f413/examples/usb_device/composite_vcp_msc/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/usb_device/composite_vcp_msc/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • usb_device
  • composite_vcp_msc
  • src
project/at_start_f413/examples/usb_device/composite_vcp_msc/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/usb_device/composite_vcp_msc/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/usb_device/composite_vcp_msc/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/usb_device/composite_vcp_msc/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/usb_device/composite_vcp_msc/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/usb_device/composite_vcp_msc/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/usb_device/composite_vcp_msc/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/usb_device/composite_vcp_msc/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/usb_device/composite_vcp_msc/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/usb_device/composite_vcp_msc/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • usb_device
  • composite_vcp_msc
  • src
project/at_start_f413/examples/usb_device/composite_vcp_msc/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include "usbd_core.h"
29#include "cdc_msc_class.h"
30#include "cdc_msc_desc.h"
31#include "usbd_int.h"
32
41 usbd_core_type usb_core_dev;
42uint8_t usb_buffer[256];
43
49void usb_clock48m_select(usb_clk48_s clk_s)
50{
51 crm_clocks_freq_type clocks_struct;
52
53 if(clk_s == USB_CLK_HICK)
54 {
55 crm_usb_clock_source_select(CRM_USB_CLOCK_SOURCE_HICK);
56
57 /* enable the acc calibration ready interrupt */
58 crm_periph_clock_enable(CRM_ACC_PERIPH_CLOCK, TRUE);
59
60 /* update the c1\c2\c3 value */
61 acc_write_c1(7980);
62 acc_write_c2(8000);
63 acc_write_c3(8020);
64
65 /* open acc calibration */
66 acc_calibration_mode_enable(ACC_CAL_HICKTRIM, TRUE);
67 }
68 else
69 {
70 crm_clocks_freq_get(&clocks_struct);
71 switch(clocks_struct.sclk_freq)
72 {
73 /* 48MHz */
74 case 48000000:
75 crm_usb_clock_div_set(CRM_USB_DIV_1);
76 break;
77
78 /* 72MHz */
79 case 72000000:
80 crm_usb_clock_div_set(CRM_USB_DIV_1_5);
81 break;
82
83 /* 96MHz */
84 case 96000000:
85 crm_usb_clock_div_set(CRM_USB_DIV_2);
86 break;
87
88 /* 120MHz */
89 case 120000000:
90 crm_usb_clock_div_set(CRM_USB_DIV_2_5);
91 break;
92
93 /* 144MHz */
94 case 144000000:
95 crm_usb_clock_div_set(CRM_USB_DIV_3);
96 break;
97
98 /* 168MHz */
99 case 168000000:
100 crm_usb_clock_div_set(CRM_USB_DIV_3_5);
101 break;
102
103 /* 192MHz */
104 case 192000000:
105 crm_usb_clock_div_set(CRM_USB_DIV_4);
106 break;
107
108 default:
109 break;
110
111 }
112 }
113}
114
120int main(void)
121{
122 uint16_t data_len;
123
124 uint32_t timeout;
125
126 uint8_t send_zero_packet = 0;
127
128 /* config nvic priority group */
129 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
130
131 system_clock_config();
132
133 at32_board_init();
134
135 /* select usb 48m clcok source */
136 usb_clock48m_select(USB_CLK_HEXT);
137
138 /* enable usb clock */
139 crm_periph_clock_enable(CRM_USB_PERIPH_CLOCK, TRUE);
140
141 /* enable usb interrupt */
142 nvic_irq_enable(USBFS_L_CAN1_RX0_IRQn, 0, 0);
143
144 /* usb core init */
145 usbd_core_init(&usb_core_dev, USB, &cdc_msc_class_handler, &cdc_msc_desc_handler, 0);
146
147 /* enable usb pull-up */
148 usbd_connect(&usb_core_dev);
149
150 while(1)
151 {
152 /* get usb vcp receive data */
153 data_len = usb_vcp_get_rxdata(&usb_core_dev, usb_buffer);
154
155 if(data_len > 0 || send_zero_packet == 1)
156 {
157 /* bulk transfer is complete when the endpoint does one of the following
158 1 has transferred exactly the amount of data expected
159 2 transfers a packet with a payload size less than wMaxPacketSize or transfers a zero-length packet
160 */
161 if(data_len > 0)
162 send_zero_packet = 1;
163
164 if(data_len == 0)
165 send_zero_packet = 0;
166
167 timeout = 5000000;
168 do
169 {
170 /* send data to host */
171 if(usb_vcp_send_data(&usb_core_dev, usb_buffer, data_len) == SUCCESS)
172 {
173 break;
174 }
175 }while(timeout --);
176 }
177 }
178}
179
185void USBFS_L_CAN1_RX0_IRQHandler(void)
186{
187 usbd_irq_handler(&usb_core_dev);
188}
189
195void usb_delay_ms(uint32_t ms)
196{
197 /* user can define self delay function */
198 delay_ms(ms);
199}
200
206void usb_delay_us(uint32_t us)
207{
208 delay_us(us);
209}
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
cdc_msc_class.h
usb cdc class file
cdc_msc_desc.h
usb cdc descriptor header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
usb_clock48m_select
void usb_clock48m_select(usb_clk48_s clk_s)
usb 48M clock select
Definition project/at_start_f413/examples/usb_device/composite_vcp_msc/src/main.c:49
main
int main(void)
main function.
Definition project/at_start_f413/examples/usb_device/composite_vcp_msc/src/main.c:120
USBFS_L_CAN1_RX0_IRQHandler
void USBFS_L_CAN1_RX0_IRQHandler(void)
this function handles usb interrupt.
Definition project/at_start_f413/examples/usb_device/composite_vcp_msc/src/main.c:185
usb_delay_ms
void usb_delay_ms(uint32_t ms)
usb delay millisecond function.
Definition project/at_start_f413/examples/usb_device/composite_vcp_msc/src/main.c:195
usb_delay_us
void usb_delay_us(uint32_t us)
usb delay microsecond function.
Definition project/at_start_f413/examples/usb_device/composite_vcp_msc/src/main.c:206
usb_buffer
uint8_t usb_buffer[256]
Definition project/at_start_f413/examples/usb_device/composite_vcp_msc/src/main.c:42
usb_core_dev
usbd_core_type usb_core_dev
Definition project/at_start_f413/examples/usb_device/composite_vcp_msc/src/main.c:41
ACC_CAL_HICKTRIM
#define ACC_CAL_HICKTRIM
Definition at32f413_acc.h:52
acc_write_c2
void acc_write_c2(uint16_t acc_c2_value)
wtire the value to acc c2 register.
Definition at32f413_acc.c:131
acc_write_c3
void acc_write_c3(uint16_t acc_c3_value)
wtire the value to acc c3 register.
Definition at32f413_acc.c:141
acc_write_c1
void acc_write_c1(uint16_t acc_c1_value)
wtire the value to acc c1 register.
Definition at32f413_acc.c:121
acc_calibration_mode_enable
void acc_calibration_mode_enable(uint16_t acc_trim, confirm_state new_state)
enable or disable the acc calibration mode.
Definition at32f413_acc.c:52
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
delay_us
void delay_us(uint32_t nus)
inserts a delay time.
Definition at32f413_board.c:330
crm_usb_clock_div_set
void crm_usb_clock_div_set(crm_usb_div_type div_value)
set crm usb division
Definition at32f413_crm.c:533
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_usb_clock_source_select
void crm_usb_clock_source_select(crm_usb_clock_source_type value)
usb 48 mhz clock source select
Definition at32f413_crm.c:854
crm_clocks_freq_get
void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
Definition at32f413_crm.c:660
CRM_USB_PERIPH_CLOCK
@ CRM_USB_PERIPH_CLOCK
Definition at32f413_crm.h:137
CRM_ACC_PERIPH_CLOCK
@ CRM_ACC_PERIPH_CLOCK
Definition at32f413_crm.h:123
CRM_USB_DIV_3
@ CRM_USB_DIV_3
Definition at32f413_crm.h:363
CRM_USB_DIV_1_5
@ CRM_USB_DIV_1_5
Definition at32f413_crm.h:358
CRM_USB_DIV_4
@ CRM_USB_DIV_4
Definition at32f413_crm.h:364
CRM_USB_DIV_3_5
@ CRM_USB_DIV_3_5
Definition at32f413_crm.h:362
CRM_USB_DIV_2
@ CRM_USB_DIV_2
Definition at32f413_crm.h:361
CRM_USB_DIV_1
@ CRM_USB_DIV_1
Definition at32f413_crm.h:359
CRM_USB_DIV_2_5
@ CRM_USB_DIV_2_5
Definition at32f413_crm.h:360
CRM_USB_CLOCK_SOURCE_HICK
@ CRM_USB_CLOCK_SOURCE_HICK
Definition at32f413_crm.h:454
USBFS_L_CAN1_RX0_IRQn
@ USBFS_L_CAN1_RX0_IRQn
Definition at32f413.h:192
SUCCESS
@ SUCCESS
Definition at32f413.h:302
TRUE
@ TRUE
Definition at32f413.h:297
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
usb_vcp_get_rxdata
uint16_t usb_vcp_get_rxdata(void *udev, uint8_t *recv_data)
usb device class rx data process
Definition cdc_class.c:344
usb_vcp_send_data
error_status usb_vcp_send_data(void *udev, uint8_t *send_data, uint16_t len)
usb device class send data
Definition cdc_class.c:374
cdc_msc_class_handler
usbd_class_handler cdc_msc_class_handler
Definition cdc_msc_class.c:71
cdc_msc_desc_handler
usbd_desc_handler cdc_msc_desc_handler
device descriptor handler structure
Definition cdc_msc_desc.c:68
usb_clk48_s
usb_clk48_s
usb clock select
Definition at32f413_usb.h:230
USB_CLK_HEXT
@ USB_CLK_HEXT
Definition at32f413_usb.h:232
USB_CLK_HICK
@ USB_CLK_HICK
Definition at32f413_usb.h:231
usbd_core_init
void usbd_core_init(usbd_core_type *udev, usb_reg_type *usb_reg, usbd_class_handler *dev_handler, usbd_desc_handler *desc_handler, uint8_t core_id)
initializes the usb core
Definition usbd_core.c:675
usbd_connect
void usbd_connect(usbd_core_type *udev)
usb device connect to host
Definition usbd_core.c:564
usbd_irq_handler
void usbd_irq_handler(usbd_core_type *udev)
usb device interrput request handler.
Definition usbd_int.c:45
USB
#define USB
Definition at32f413_usb.h:665
at32f413_clock.h
header file of clock program
crm_clocks_freq_type
crm clocks freqency structure
Definition at32f413_crm.h:470
crm_clocks_freq_type::sclk_freq
uint32_t sclk_freq
Definition at32f413_crm.h:471
usbd_core_type
usb device core struct type
Definition usbd_core.h:114
usbd_core.h
usb device core header file
usbd_int.h


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • usb_device
  • custom_hid
  • inc
project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • usb_device
  • custom_hid
  • inc
project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • usb_device
  • custom_hid
  • inc
project/at_start_f413/examples/usb_device/custom_hid/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: usb_conf.h Source File

  • usb_device
  • custom_hid
  • inc
project/at_start_f413/examples/usb_device/custom_hid/inc/usb_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __USB_CONF_H
28#define __USB_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "at32f413.h"
35#include "at32f413_board.h"
36#include "stdio.h"
37
49#ifndef USB_EPT_MAX_NUM
50#define USB_EPT_MAX_NUM 8
51#endif
52
56//#define USB_BUFFER_SIZE_EX /*!< usb enable extend buffer */
57
58
62#define USB_EPT_AUTO_MALLOC_BUFFER
65#ifndef USB_EPT_AUTO_MALLOC_BUFFER
71/* ept0 tx start address 0x40, size 0x40,
72 so rx start address is 0x40 + 0x40 = 0x80 */
73#define EPT0_TX_ADDR 0x40
74#define EPT0_RX_ADDR 0x80
76#define EPT1_TX_ADDR 0xC0
77#define EPT1_RX_ADDR 0x100
79#define EPT2_TX_ADDR 0x140
80#define EPT2_RX_ADDR 0x180
82#define EPT3_TX_ADDR 0x00
83#define EPT3_RX_ADDR 0x00
85#define EPT4_TX_ADDR 0x00
86#define EPT4_RX_ADDR 0x00
88#define EPT5_TX_ADDR 0x00
89#define EPT5_RX_ADDR 0x00
91#define EPT6_TX_ADDR 0x00
92#define EPT6_RX_ADDR 0x00
94#define EPT7_TX_ADDR 0x00
95#define EPT7_RX_ADDR 0x00
97#endif
98
99void usb_delay_ms(uint32_t ms);
100void usb_delay_us(uint32_t us);
101
110#ifdef __cplusplus
111}
112#endif
113
114#endif
115
at32f413.h
at32f413 header file
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
usb_delay_ms
void usb_delay_ms(uint32_t ms)
usb delay millisecond function.
Definition project/at_start_f413/examples/usb_device/custom_hid/src/main.c:172
usb_delay_us
void usb_delay_us(uint32_t us)
usb delay microsecond function.
Definition project/at_start_f413/examples/usb_device/custom_hid/src/main.c:183


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • usb_device
  • custom_hid
  • src
project/at_start_f413/examples/usb_device/custom_hid/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/usb_device/custom_hid/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • usb_device
  • custom_hid
  • src
project/at_start_f413/examples/usb_device/custom_hid/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/usb_device/custom_hid/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/usb_device/custom_hid/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/usb_device/custom_hid/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/usb_device/custom_hid/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/usb_device/custom_hid/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/usb_device/custom_hid/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/usb_device/custom_hid/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/usb_device/custom_hid/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/usb_device/custom_hid/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • usb_device
  • custom_hid
  • src
project/at_start_f413/examples/usb_device/custom_hid/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include "usbd_core.h"
29#include "custom_hid_class.h"
30#include "custom_hid_desc.h"
31#include "usbd_int.h"
32
41 usbd_core_type usb_core_dev;
42uint8_t report_buf[USBD_CUSTOM_IN_MAXPACKET_SIZE];
43
49void usb_clock48m_select(usb_clk48_s clk_s)
50{
51 crm_clocks_freq_type clocks_struct;
52
53 if(clk_s == USB_CLK_HICK)
54 {
55 crm_usb_clock_source_select(CRM_USB_CLOCK_SOURCE_HICK);
56
57 /* enable the acc calibration ready interrupt */
58 crm_periph_clock_enable(CRM_ACC_PERIPH_CLOCK, TRUE);
59
60 /* update the c1\c2\c3 value */
61 acc_write_c1(7980);
62 acc_write_c2(8000);
63 acc_write_c3(8020);
64
65 /* open acc calibration */
66 acc_calibration_mode_enable(ACC_CAL_HICKTRIM, TRUE);
67 }
68 else
69 {
70 crm_clocks_freq_get(&clocks_struct);
71 switch(clocks_struct.sclk_freq)
72 {
73 /* 48MHz */
74 case 48000000:
75 crm_usb_clock_div_set(CRM_USB_DIV_1);
76 break;
77
78 /* 72MHz */
79 case 72000000:
80 crm_usb_clock_div_set(CRM_USB_DIV_1_5);
81 break;
82
83 /* 96MHz */
84 case 96000000:
85 crm_usb_clock_div_set(CRM_USB_DIV_2);
86 break;
87
88 /* 120MHz */
89 case 120000000:
90 crm_usb_clock_div_set(CRM_USB_DIV_2_5);
91 break;
92
93 /* 144MHz */
94 case 144000000:
95 crm_usb_clock_div_set(CRM_USB_DIV_3);
96 break;
97
98 /* 168MHz */
99 case 168000000:
100 crm_usb_clock_div_set(CRM_USB_DIV_3_5);
101 break;
102
103 /* 192MHz */
104 case 192000000:
105 crm_usb_clock_div_set(CRM_USB_DIV_4);
106 break;
107
108 default:
109 break;
110
111 }
112 }
113}
114
120int main(void)
121{
122 /* config nvic priority group */
123 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
124
125 system_clock_config();
126
127 at32_board_init();
128
129 /* select usb 48m clcok source */
130 usb_clock48m_select(USB_CLK_HEXT);
131
132 /* enable usb clock */
133 crm_periph_clock_enable(CRM_USB_PERIPH_CLOCK, TRUE);
134
135 /* enable usb interrupt */
136 nvic_irq_enable(USBFS_L_CAN1_RX0_IRQn, 0, 0);
137
138 /* usb core init */
139 usbd_core_init(&usb_core_dev, USB, &custom_hid_class_handler, &custom_hid_desc_handler, 0);
140
141 /* enable usb pull-up */
142 usbd_connect(&usb_core_dev);
143
144 while(1)
145 {
146 if(at32_button_press() == USER_BUTTON)
147 {
148 report_buf[1] = (~report_buf[1]) & 0x1;
149 report_buf[0] = HID_REPORT_ID_5;
150 custom_hid_class_send_report(&usb_core_dev, report_buf, USBD_CUSTOM_IN_MAXPACKET_SIZE);
151
152 }
153 }
154}
155
156
162void USBFS_L_CAN1_RX0_IRQHandler(void)
163{
164 usbd_irq_handler(&usb_core_dev);
165}
166
172void usb_delay_ms(uint32_t ms)
173{
174 /* user can define self delay function */
175 delay_ms(ms);
176}
177
183void usb_delay_us(uint32_t us)
184{
185 delay_us(us);
186}
187
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
custom_hid_class.h
usb custom hid header file
custom_hid_desc.h
usb custom hid descriptor header file
usb_delay_ms
void usb_delay_ms(uint32_t ms)
usb delay millisecond function.
Definition project/at_start_f413/examples/acc/calibration/src/main.c:244
usb_delay_us
void usb_delay_us(uint32_t us)
usb delay microsecond function.
Definition project/at_start_f413/examples/acc/calibration/src/main.c:255
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
report_buf
uint8_t report_buf[0x40]
Definition project/at_start_f413/examples/usb_device/custom_hid/src/main.c:42
usb_clock48m_select
void usb_clock48m_select(usb_clk48_s clk_s)
usb 48M clock select
Definition project/at_start_f413/examples/usb_device/custom_hid/src/main.c:49
main
int main(void)
main function.
Definition project/at_start_f413/examples/usb_device/custom_hid/src/main.c:120
USBFS_L_CAN1_RX0_IRQHandler
void USBFS_L_CAN1_RX0_IRQHandler(void)
this function handles usb interrupt.
Definition project/at_start_f413/examples/usb_device/custom_hid/src/main.c:162
usb_core_dev
usbd_core_type usb_core_dev
Definition project/at_start_f413/examples/usb_device/custom_hid/src/main.c:41
ACC_CAL_HICKTRIM
#define ACC_CAL_HICKTRIM
Definition at32f413_acc.h:52
acc_write_c2
void acc_write_c2(uint16_t acc_c2_value)
wtire the value to acc c2 register.
Definition at32f413_acc.c:131
acc_write_c3
void acc_write_c3(uint16_t acc_c3_value)
wtire the value to acc c3 register.
Definition at32f413_acc.c:141
acc_write_c1
void acc_write_c1(uint16_t acc_c1_value)
wtire the value to acc c1 register.
Definition at32f413_acc.c:121
acc_calibration_mode_enable
void acc_calibration_mode_enable(uint16_t acc_trim, confirm_state new_state)
enable or disable the acc calibration mode.
Definition at32f413_acc.c:52
USER_BUTTON
@ USER_BUTTON
Definition at32f413_board.h:93
at32_button_press
button_type at32_button_press()
returns which button have press down
Definition at32f413_board.c:218
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
delay_us
void delay_us(uint32_t nus)
inserts a delay time.
Definition at32f413_board.c:330
crm_usb_clock_div_set
void crm_usb_clock_div_set(crm_usb_div_type div_value)
set crm usb division
Definition at32f413_crm.c:533
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_usb_clock_source_select
void crm_usb_clock_source_select(crm_usb_clock_source_type value)
usb 48 mhz clock source select
Definition at32f413_crm.c:854
crm_clocks_freq_get
void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
Definition at32f413_crm.c:660
CRM_USB_PERIPH_CLOCK
@ CRM_USB_PERIPH_CLOCK
Definition at32f413_crm.h:137
CRM_ACC_PERIPH_CLOCK
@ CRM_ACC_PERIPH_CLOCK
Definition at32f413_crm.h:123
CRM_USB_DIV_3
@ CRM_USB_DIV_3
Definition at32f413_crm.h:363
CRM_USB_DIV_1_5
@ CRM_USB_DIV_1_5
Definition at32f413_crm.h:358
CRM_USB_DIV_4
@ CRM_USB_DIV_4
Definition at32f413_crm.h:364
CRM_USB_DIV_3_5
@ CRM_USB_DIV_3_5
Definition at32f413_crm.h:362
CRM_USB_DIV_2
@ CRM_USB_DIV_2
Definition at32f413_crm.h:361
CRM_USB_DIV_1
@ CRM_USB_DIV_1
Definition at32f413_crm.h:359
CRM_USB_DIV_2_5
@ CRM_USB_DIV_2_5
Definition at32f413_crm.h:360
CRM_USB_CLOCK_SOURCE_HICK
@ CRM_USB_CLOCK_SOURCE_HICK
Definition at32f413_crm.h:454
USBFS_L_CAN1_RX0_IRQn
@ USBFS_L_CAN1_RX0_IRQn
Definition at32f413.h:192
TRUE
@ TRUE
Definition at32f413.h:297
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
HID_REPORT_ID_5
#define HID_REPORT_ID_5
Definition audio_hid_desc.h:225
USBD_CUSTOM_IN_MAXPACKET_SIZE
#define USBD_CUSTOM_IN_MAXPACKET_SIZE
usb custom hid in and out max packet size define
Definition custom_hid_class.h:58
custom_hid_class_send_report
usb_sts_type custom_hid_class_send_report(void *udev, uint8_t *report, uint16_t len)
usb device class send report
Definition custom_hid_class.c:339
custom_hid_class_handler
usbd_class_handler custom_hid_class_handler
Definition custom_hid_class.c:56
custom_hid_desc_handler
usbd_desc_handler custom_hid_desc_handler
custom hid device descriptor handler structure
Definition custom_hid_desc.c:64
usb_clk48_s
usb_clk48_s
usb clock select
Definition at32f413_usb.h:230
USB_CLK_HEXT
@ USB_CLK_HEXT
Definition at32f413_usb.h:232
USB_CLK_HICK
@ USB_CLK_HICK
Definition at32f413_usb.h:231
usbd_core_init
void usbd_core_init(usbd_core_type *udev, usb_reg_type *usb_reg, usbd_class_handler *dev_handler, usbd_desc_handler *desc_handler, uint8_t core_id)
initializes the usb core
Definition usbd_core.c:675
usbd_connect
void usbd_connect(usbd_core_type *udev)
usb device connect to host
Definition usbd_core.c:564
usbd_irq_handler
void usbd_irq_handler(usbd_core_type *udev)
usb device interrput request handler.
Definition usbd_int.c:45
USB
#define USB
Definition at32f413_usb.h:665
at32f413_clock.h
header file of clock program
crm_clocks_freq_type
crm clocks freqency structure
Definition at32f413_crm.h:470
crm_clocks_freq_type::sclk_freq
uint32_t sclk_freq
Definition at32f413_crm.h:471
usbd_core_type
usb device core struct type
Definition usbd_core.h:114
usbd_core.h
usb device core header file
usbd_int.h


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • usb_device
  • keyboard
  • inc
project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • usb_device
  • keyboard
  • inc
project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • usb_device
  • keyboard
  • inc
project/at_start_f413/examples/usb_device/keyboard/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: usb_conf.h Source File

  • usb_device
  • keyboard
  • inc
project/at_start_f413/examples/usb_device/keyboard/inc/usb_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __USB_CONF_H
28#define __USB_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "at32f413.h"
35#include "at32f413_board.h"
36#include "stdio.h"
37
49#ifndef USB_EPT_MAX_NUM
50#define USB_EPT_MAX_NUM 8
51#endif
52
56//#define USB_BUFFER_SIZE_EX /*!< usb enable extend buffer */
57
58
62#define USB_EPT_AUTO_MALLOC_BUFFER
65#ifndef USB_EPT_AUTO_MALLOC_BUFFER
71/* ept0 tx start address 0x40, size 0x40,
72 so rx start address is 0x40 + 0x40 = 0x80 */
73#define EPT0_TX_ADDR 0x40
74#define EPT0_RX_ADDR 0x80
76#define EPT1_TX_ADDR 0xC0
77#define EPT1_RX_ADDR 0x100
79#define EPT2_TX_ADDR 0x140
80#define EPT2_RX_ADDR 0x180
82#define EPT3_TX_ADDR 0x00
83#define EPT3_RX_ADDR 0x00
85#define EPT4_TX_ADDR 0x00
86#define EPT4_RX_ADDR 0x00
88#define EPT5_TX_ADDR 0x00
89#define EPT5_RX_ADDR 0x00
91#define EPT6_TX_ADDR 0x00
92#define EPT6_RX_ADDR 0x00
94#define EPT7_TX_ADDR 0x00
95#define EPT7_RX_ADDR 0x00
97#endif
98
102#define USB_LOW_POWER_WAKUP
103
104void usb_delay_ms(uint32_t ms);
105void usb_delay_us(uint32_t us);
106
115#ifdef __cplusplus
116}
117#endif
118
119#endif
120
at32f413.h
at32f413 header file
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
usb_delay_ms
void usb_delay_ms(uint32_t ms)
usb delay millisecond function.
Definition project/at_start_f413/examples/usb_device/keyboard/src/main.c:356
usb_delay_us
void usb_delay_us(uint32_t us)
usb delay microsecond function.
Definition project/at_start_f413/examples/usb_device/keyboard/src/main.c:367


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • usb_device
  • keyboard
  • src
project/at_start_f413/examples/usb_device/keyboard/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/usb_device/keyboard/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • usb_device
  • keyboard
  • src
project/at_start_f413/examples/usb_device/keyboard/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/usb_device/keyboard/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/usb_device/keyboard/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/usb_device/keyboard/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/usb_device/keyboard/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/usb_device/keyboard/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/usb_device/keyboard/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/usb_device/keyboard/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/usb_device/keyboard/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/usb_device/keyboard/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • usb_device
  • keyboard
  • src
project/at_start_f413/examples/usb_device/keyboard/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include "usbd_core.h"
29#include "keyboard_class.h"
30#include "keyboard_desc.h"
31#include "usbd_int.h"
32
41 usbd_core_type usb_core_dev;
42extern __IO uint8_t hid_suspend_flag;
43void keyboard_send_string(void *udev, uint8_t *string, uint8_t len);
44void system_clock_recover(void);
45void button_exint_init(void);
46void usb_low_power_wakeup_config(void);
47
54void keyboard_send_string(void *udev, uint8_t *string, uint8_t len)
55{
56 uint8_t index = 0;
57 usbd_core_type *pudev = (usbd_core_type *)udev;
58 keyboard_type *pkeyboard = (keyboard_type *)pudev->class_handler->pdata;
59 for(index = 0; index < len; index ++)
60 {
61 while(1)
62 {
63 if(pkeyboard->g_u8tx_completed == 1)
64 {
65 pkeyboard->g_u8tx_completed = 0;
66 usb_hid_keyboard_send_char(udev, string[index]);
67 break;
68 }
69 }
70 /* send 0x00 */
71 while(1)
72 {
73 if(pkeyboard->g_u8tx_completed == 1)
74 {
75 pkeyboard->g_u8tx_completed = 0;
76 usb_hid_keyboard_send_char(udev, 0x00);
77 break;
78 }
79 }
80 }
81}
82
88void usb_clock48m_select(usb_clk48_s clk_s)
89{
90 crm_clocks_freq_type clocks_struct;
91
92 if(clk_s == USB_CLK_HICK)
93 {
94 crm_usb_clock_source_select(CRM_USB_CLOCK_SOURCE_HICK);
95
96 /* enable the acc calibration ready interrupt */
97 crm_periph_clock_enable(CRM_ACC_PERIPH_CLOCK, TRUE);
98
99 /* update the c1\c2\c3 value */
100 acc_write_c1(7980);
101 acc_write_c2(8000);
102 acc_write_c3(8020);
103
104 /* open acc calibration */
105 acc_calibration_mode_enable(ACC_CAL_HICKTRIM, TRUE);
106 }
107 else
108 {
109 crm_clocks_freq_get(&clocks_struct);
110 switch(clocks_struct.sclk_freq)
111 {
112 /* 48MHz */
113 case 48000000:
114 crm_usb_clock_div_set(CRM_USB_DIV_1);
115 break;
116
117 /* 72MHz */
118 case 72000000:
119 crm_usb_clock_div_set(CRM_USB_DIV_1_5);
120 break;
121
122 /* 96MHz */
123 case 96000000:
124 crm_usb_clock_div_set(CRM_USB_DIV_2);
125 break;
126
127 /* 120MHz */
128 case 120000000:
129 crm_usb_clock_div_set(CRM_USB_DIV_2_5);
130 break;
131
132 /* 144MHz */
133 case 144000000:
134 crm_usb_clock_div_set(CRM_USB_DIV_3);
135 break;
136
137 /* 168MHz */
138 case 168000000:
139 crm_usb_clock_div_set(CRM_USB_DIV_3_5);
140 break;
141
142 /* 192MHz */
143 case 192000000:
144 crm_usb_clock_div_set(CRM_USB_DIV_4);
145 break;
146
147 default:
148 break;
149
150 }
151 }
152}
153
159int main(void)
160{
161 __IO uint32_t delay_index = 0;
162 /* config nvic priority group */
163 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
164
165 system_clock_config();
166
167 at32_board_init();
168
169 /* select usb 48m clcok source */
170 usb_clock48m_select(USB_CLK_HEXT);
171
172#ifdef USB_LOW_POWER_WAKUP
173 /* enable pwc and bpr clock */
174 crm_periph_clock_enable(CRM_PWC_PERIPH_CLOCK, TRUE);
175 button_exint_init();
176 usb_low_power_wakeup_config();
177#endif
178
179 /* enable usb clock */
180 crm_periph_clock_enable(CRM_USB_PERIPH_CLOCK, TRUE);
181
182 /* enable usb interrupt */
183 nvic_irq_enable(USBFS_L_CAN1_RX0_IRQn, 0, 0);
184
185 /* usb core init */
186 usbd_core_init(&usb_core_dev, USB, &keyboard_class_handler, &keyboard_desc_handler, 0);
187
188 /* enable usb pull-up */
189 usbd_connect(&usb_core_dev);
190
191 while(1)
192 {
193 if(at32_button_press() == USER_BUTTON)
194 {
195 if(usbd_connect_state_get(&usb_core_dev) == USB_CONN_STATE_CONFIGURED)
196 {
197 keyboard_send_string(&usb_core_dev, (uint8_t *)" Keyboard Demo\r\n", 16);
198 }
199 /* remote wakeup */
200 if(usbd_connect_state_get(&usb_core_dev) == USB_CONN_STATE_SUSPENDED
201 &&(usb_core_dev.remote_wakup == 1))
202 {
203 usbd_remote_wakeup(&usb_core_dev);
204 }
205 }
206#ifdef USB_LOW_POWER_WAKUP
207 /* enter deep sleep */
208 if(((keyboard_type *)(usb_core_dev.class_handler->pdata))->hid_suspend_flag == 1)
209 {
210 at32_led_off(LED2);
211 at32_led_off(LED3);
212 at32_led_off(LED4);
213
214 /* enter deep sleep mode */
215 pwc_deep_sleep_mode_enter(PWC_DEEP_SLEEP_ENTER_WFI);
216
217 /* wait 3 LICK(maximum 120us) cycles to ensure clock stable, delay 120us*/
218 /* when wakeup from deepsleep,system clock source changes to HICK */
219 if((CRM->misc3_bit.hick_to_sclk == TRUE) && (CRM->misc1_bit.hickdiv == TRUE))
220 {
221 /* HICK is 48MHz */
222 for(delay_index = 0; delay_index < 750; delay_index++)
223 {
224 __NOP();
225 }
226 }
227 else
228 {
229 /* HICK is 8MHz */
230 for(delay_index = 0; delay_index < 125; delay_index++)
231 {
232 __NOP();
233 }
234 }
235 system_clock_recover();
236
237 ((keyboard_type *)(usb_core_dev.class_handler->pdata))->hid_suspend_flag = 0;
238 at32_led_on(LED2);
239 at32_led_on(LED3);
240 at32_led_on(LED4);
241 }
242#endif
243 }
244}
245
246#ifdef USB_LOW_POWER_WAKUP
252void button_exint_init(void)
253{
254 exint_init_type exint_init_struct;
255
256 crm_periph_clock_enable(CRM_IOMUX_PERIPH_CLOCK, TRUE);
257 gpio_exint_line_config(GPIO_PORT_SOURCE_GPIOA, GPIO_PINS_SOURCE0);
258
259 exint_default_para_init(&exint_init_struct);
260 exint_init_struct.line_enable = TRUE;
261 exint_init_struct.line_mode = EXINT_LINE_INTERRUPT;
262 exint_init_struct.line_select = EXINT_LINE_0;
263 exint_init_struct.line_polarity = EXINT_TRIGGER_RISING_EDGE;
264 exint_init(&exint_init_struct);
265
266 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
267 nvic_irq_enable(EXINT0_IRQn, 0, 0);
268}
269
275void EXINT0_IRQHandler(void)
276{
277 /* clear interrupt pending bit */
278 exint_flag_clear(EXINT_LINE_0);
279}
280
286void usb_low_power_wakeup_config(void)
287{
288 exint_init_type exint_init_struct;
289
290 exint_default_para_init(&exint_init_struct);
291
292 exint_init_struct.line_enable = TRUE;
293 exint_init_struct.line_mode = EXINT_LINE_INTERRUPT;
294 exint_init_struct.line_select = EXINT_LINE_18;
295 exint_init_struct.line_polarity = EXINT_TRIGGER_RISING_EDGE;
296 exint_init(&exint_init_struct);
297
298 nvic_irq_enable(USBFSWakeUp_IRQn, 0, 0);
299}
300
306void USBFSWakeUp_IRQHandler(void)
307{
308 exint_flag_clear(EXINT_LINE_18);
309}
310
316void system_clock_recover(void)
317{
318 /* enable external high-speed crystal oscillator - hext */
319 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
320
321 /* wait till hext is ready */
322 while(crm_hext_stable_wait() == ERROR);
323
324 /* enable pll */
325 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
326
327 /* wait till pll is ready */
328 while(crm_flag_get(CRM_PLL_STABLE_FLAG) == RESET);
329
330 /* enable auto step mode */
331 crm_auto_step_mode_enable(TRUE);
332
333 /* select pll as system clock source */
334 crm_sysclk_switch(CRM_SCLK_PLL);
335
336 /* wait till pll is used as system clock source */
337 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL);
338}
339
340#endif
346void USBFS_L_CAN1_RX0_IRQHandler(void)
347{
348 usbd_irq_handler(&usb_core_dev);
349}
350
356void usb_delay_ms(uint32_t ms)
357{
358 /* user can define self delay function */
359 delay_ms(ms);
360}
361
367void usb_delay_us(uint32_t us)
368{
369 delay_us(us);
370}
371
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
usb_delay_ms
void usb_delay_ms(uint32_t ms)
usb delay millisecond function.
Definition project/at_start_f413/examples/acc/calibration/src/main.c:244
usb_delay_us
void usb_delay_us(uint32_t us)
usb delay microsecond function.
Definition project/at_start_f413/examples/acc/calibration/src/main.c:255
EXINT0_IRQHandler
void EXINT0_IRQHandler(void)
exint0 interrupt handler
Definition project/at_start_f413/examples/exint/exint_config/src/main.c:95
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
hid_suspend_flag
__IO uint8_t hid_suspend_flag
button_exint_init
void button_exint_init(void)
configure button exint
Definition project/at_start_f413/templates/src/main.c:51
usb_clock48m_select
void usb_clock48m_select(usb_clk48_s clk_s)
usb 48M clock select
Definition project/at_start_f413/examples/usb_device/keyboard/src/main.c:88
main
int main(void)
main function.
Definition project/at_start_f413/examples/usb_device/keyboard/src/main.c:159
usb_low_power_wakeup_config
void usb_low_power_wakeup_config(void)
keyboard_send_string
void keyboard_send_string(void *udev, uint8_t *string, uint8_t len)
keyboard send string
Definition project/at_start_f413/examples/usb_device/keyboard/src/main.c:54
USBFS_L_CAN1_RX0_IRQHandler
void USBFS_L_CAN1_RX0_IRQHandler(void)
this function handles usb interrupt.
Definition project/at_start_f413/examples/usb_device/keyboard/src/main.c:346
usb_core_dev
usbd_core_type usb_core_dev
Definition project/at_start_f413/examples/usb_device/keyboard/src/main.c:41
system_clock_recover
void system_clock_recover(void)
systemclock recover.
Definition project/at_start_f413/examples/pwc/deepsleep_rtc/src/main.c:97
ACC_CAL_HICKTRIM
#define ACC_CAL_HICKTRIM
Definition at32f413_acc.h:52
acc_write_c2
void acc_write_c2(uint16_t acc_c2_value)
wtire the value to acc c2 register.
Definition at32f413_acc.c:131
acc_write_c3
void acc_write_c3(uint16_t acc_c3_value)
wtire the value to acc c3 register.
Definition at32f413_acc.c:141
acc_write_c1
void acc_write_c1(uint16_t acc_c1_value)
wtire the value to acc c1 register.
Definition at32f413_acc.c:121
acc_calibration_mode_enable
void acc_calibration_mode_enable(uint16_t acc_trim, confirm_state new_state)
enable or disable the acc calibration mode.
Definition at32f413_acc.c:52
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
USER_BUTTON
@ USER_BUTTON
Definition at32f413_board.h:93
at32_button_press
button_type at32_button_press()
returns which button have press down
Definition at32f413_board.c:218
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_led_off
void at32_led_off(led_type led)
turns selected led off.
Definition at32f413_board.c:287
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
delay_us
void delay_us(uint32_t nus)
inserts a delay time.
Definition at32f413_board.c:330
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_usb_clock_div_set
void crm_usb_clock_div_set(crm_usb_div_type div_value)
set crm usb division
Definition at32f413_crm.c:533
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
crm_usb_clock_source_select
void crm_usb_clock_source_select(crm_usb_clock_source_type value)
usb 48 mhz clock source select
Definition at32f413_crm.c:854
crm_clocks_freq_get
void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
Definition at32f413_crm.c:660
CRM_USB_PERIPH_CLOCK
@ CRM_USB_PERIPH_CLOCK
Definition at32f413_crm.h:137
CRM_PWC_PERIPH_CLOCK
@ CRM_PWC_PERIPH_CLOCK
Definition at32f413_crm.h:140
CRM_ACC_PERIPH_CLOCK
@ CRM_ACC_PERIPH_CLOCK
Definition at32f413_crm.h:123
CRM_IOMUX_PERIPH_CLOCK
@ CRM_IOMUX_PERIPH_CLOCK
Definition at32f413_crm.h:108
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_USB_DIV_3
@ CRM_USB_DIV_3
Definition at32f413_crm.h:363
CRM_USB_DIV_1_5
@ CRM_USB_DIV_1_5
Definition at32f413_crm.h:358
CRM_USB_DIV_4
@ CRM_USB_DIV_4
Definition at32f413_crm.h:364
CRM_USB_DIV_3_5
@ CRM_USB_DIV_3_5
Definition at32f413_crm.h:362
CRM_USB_DIV_2
@ CRM_USB_DIV_2
Definition at32f413_crm.h:361
CRM_USB_DIV_1
@ CRM_USB_DIV_1
Definition at32f413_crm.h:359
CRM_USB_DIV_2_5
@ CRM_USB_DIV_2_5
Definition at32f413_crm.h:360
CRM_USB_CLOCK_SOURCE_HICK
@ CRM_USB_CLOCK_SOURCE_HICK
Definition at32f413_crm.h:454
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
CRM
#define CRM
Definition at32f413_crm.h:843
USBFSWakeUp_IRQn
@ USBFSWakeUp_IRQn
Definition at32f413.h:214
EXINT0_IRQn
@ EXINT0_IRQn
Definition at32f413.h:177
USBFS_L_CAN1_RX0_IRQn
@ USBFS_L_CAN1_RX0_IRQn
Definition at32f413.h:192
exint_flag_clear
void exint_flag_clear(uint32_t exint_line)
clear exint flag
Definition at32f413_exint.c:125
exint_default_para_init
void exint_default_para_init(exint_init_type *exint_struct)
exint default para init
Definition at32f413_exint.c:63
exint_init
void exint_init(exint_init_type *exint_struct)
exint init
Definition at32f413_exint.c:77
EXINT_LINE_INTERRUPT
@ EXINT_LINE_INTERRUPT
Definition at32f413_exint.h:84
EXINT_TRIGGER_RISING_EDGE
@ EXINT_TRIGGER_RISING_EDGE
Definition at32f413_exint.h:93
EXINT_LINE_18
#define EXINT_LINE_18
Definition at32f413_exint.h:69
EXINT_LINE_0
#define EXINT_LINE_0
Definition at32f413_exint.h:51
ERROR
@ ERROR
Definition at32f413.h:302
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
gpio_exint_line_config
void gpio_exint_line_config(gpio_port_source_type gpio_port_source, gpio_pins_source_type gpio_pin_source)
select the gpio pin used as exint line.
Definition at32f413_gpio.c:605
GPIO_PINS_SOURCE0
@ GPIO_PINS_SOURCE0
Definition at32f413_gpio.h:253
GPIO_PORT_SOURCE_GPIOA
@ GPIO_PORT_SOURCE_GPIOA
Definition at32f413_gpio.h:276
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
pwc_deep_sleep_mode_enter
void pwc_deep_sleep_mode_enter(pwc_deep_sleep_enter_type pwc_deep_sleep_enter)
enter pwc deep-sleep mode
Definition at32f413_pwc.c:188
PWC_DEEP_SLEEP_ENTER_WFI
@ PWC_DEEP_SLEEP_ENTER_WFI
Definition at32f413_pwc.h:96
usb_clk48_s
usb_clk48_s
usb clock select
Definition at32f413_usb.h:230
USB_CLK_HEXT
@ USB_CLK_HEXT
Definition at32f413_usb.h:232
USB_CLK_HICK
@ USB_CLK_HICK
Definition at32f413_usb.h:231
usb_hid_keyboard_send_char
void usb_hid_keyboard_send_char(void *udev, uint8_t ascii_code)
usb device class report function
Definition keyboard_class.c:473
keyboard_class_handler
usbd_class_handler keyboard_class_handler
Definition keyboard_class.c:188
keyboard_desc_handler
usbd_desc_handler keyboard_desc_handler
keyboard device descriptor handler structure
Definition keyboard_desc.c:65
USB_CONN_STATE_SUSPENDED
@ USB_CONN_STATE_SUSPENDED
Definition usb_std.h:138
USB_CONN_STATE_CONFIGURED
@ USB_CONN_STATE_CONFIGURED
Definition usb_std.h:137
usbd_connect_state_get
usbd_conn_state usbd_connect_state_get(usbd_core_type *udev)
get usb connect state
Definition usbd_core.c:595
usbd_core_init
void usbd_core_init(usbd_core_type *udev, usb_reg_type *usb_reg, usbd_class_handler *dev_handler, usbd_desc_handler *desc_handler, uint8_t core_id)
initializes the usb core
Definition usbd_core.c:675
usbd_remote_wakeup
void usbd_remote_wakeup(usbd_core_type *udev)
usb device remote wakeup
Definition usbd_core.c:605
usbd_connect
void usbd_connect(usbd_core_type *udev)
usb device connect to host
Definition usbd_core.c:564
usbd_irq_handler
void usbd_irq_handler(usbd_core_type *udev)
usb device interrput request handler.
Definition usbd_int.c:45
USB
#define USB
Definition at32f413_usb.h:665
keyboard_class.h
usb hid keyboard header file
keyboard_desc.h
usb keyboard descriptor header file
at32f413_clock.h
header file of clock program
crm_clocks_freq_type
crm clocks freqency structure
Definition at32f413_crm.h:470
crm_clocks_freq_type::sclk_freq
uint32_t sclk_freq
Definition at32f413_crm.h:471
exint_init_type
exint init type
Definition at32f413_exint.h:102
exint_init_type::line_select
uint32_t line_select
Definition at32f413_exint.h:104
exint_init_type::line_enable
confirm_state line_enable
Definition at32f413_exint.h:106
exint_init_type::line_mode
exint_line_mode_type line_mode
Definition at32f413_exint.h:103
exint_init_type::line_polarity
exint_polarity_config_type line_polarity
Definition at32f413_exint.h:105
keyboard_type
Definition keyboard_class.h:66
keyboard_type::g_u8tx_completed
__IO uint8_t g_u8tx_completed
Definition keyboard_class.h:74
usbd_class_handler::pdata
void * pdata
Definition usbd_core.h:107
usbd_core_type
usb device core struct type
Definition usbd_core.h:114
usbd_core_type::remote_wakup
uint8_t remote_wakup
Definition usbd_core.h:134
usbd_core_type::class_handler
usbd_class_handler * class_handler
Definition usbd_core.h:117
usbd_core.h
usb device core header file
usbd_int.h


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • usb_device
  • mouse
  • inc
project/at_start_f413/examples/usb_device/mouse/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • usb_device
  • mouse
  • inc
project/at_start_f413/examples/usb_device/mouse/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • usb_device
  • mouse
  • inc
project/at_start_f413/examples/usb_device/mouse/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: usb_conf.h Source File

  • usb_device
  • mouse
  • inc
project/at_start_f413/examples/usb_device/mouse/inc/usb_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __USB_CONF_H
28#define __USB_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "at32f413.h"
35#include "at32f413_board.h"
36#include "stdio.h"
37
49#ifndef USB_EPT_MAX_NUM
50#define USB_EPT_MAX_NUM 8
51#endif
52
56//#define USB_BUFFER_SIZE_EX /*!< usb enable extend buffer */
57
58
62#define USB_EPT_AUTO_MALLOC_BUFFER
65#ifndef USB_EPT_AUTO_MALLOC_BUFFER
71/* ept0 tx start address 0x40, size 0x40,
72 so rx start address is 0x40 + 0x40 = 0x80 */
73#define EPT0_TX_ADDR 0x40
74#define EPT0_RX_ADDR 0x80
76#define EPT1_TX_ADDR 0xC0
77#define EPT1_RX_ADDR 0x100
79#define EPT2_TX_ADDR 0x140
80#define EPT2_RX_ADDR 0x180
82#define EPT3_TX_ADDR 0x00
83#define EPT3_RX_ADDR 0x00
85#define EPT4_TX_ADDR 0x00
86#define EPT4_RX_ADDR 0x00
88#define EPT5_TX_ADDR 0x00
89#define EPT5_RX_ADDR 0x00
91#define EPT6_TX_ADDR 0x00
92#define EPT6_RX_ADDR 0x00
94#define EPT7_TX_ADDR 0x00
95#define EPT7_RX_ADDR 0x00
97#endif
98
102#define USB_LOW_POWER_WAKUP
103
104void usb_delay_ms(uint32_t ms);
105void usb_delay_us(uint32_t us);
114#ifdef __cplusplus
115}
116#endif
117
118#endif
119
at32f413.h
at32f413 header file
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
usb_delay_ms
void usb_delay_ms(uint32_t ms)
usb delay millisecond function.
Definition project/at_start_f413/examples/usb_device/mouse/src/main.c:332
usb_delay_us
void usb_delay_us(uint32_t us)
usb delay microsecond function.
Definition project/at_start_f413/examples/usb_device/mouse/src/main.c:343


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • usb_device
  • mouse
  • src
project/at_start_f413/examples/usb_device/mouse/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/usb_device/mouse/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • usb_device
  • mouse
  • src
project/at_start_f413/examples/usb_device/mouse/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/usb_device/mouse/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/usb_device/mouse/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/usb_device/mouse/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/usb_device/mouse/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/usb_device/mouse/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/usb_device/mouse/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/usb_device/mouse/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/usb_device/mouse/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/usb_device/mouse/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • usb_device
  • mouse
  • src
project/at_start_f413/examples/usb_device/mouse/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include "usbd_core.h"
29#include "mouse_class.h"
30#include "mouse_desc.h"
31#include "usbd_int.h"
32
41 usbd_core_type usb_core_dev;
42__IO uint8_t press_mouse = 0;
43extern __IO uint8_t hid_suspend_flag;
44uint8_t report_buf[USBD_MOUSE_IN_MAXPACKET_SIZE];
45void system_clock_recover(void);
46void button_exint_init(void);
47void usb_low_power_wakeup_config(void);
53void usb_clock48m_select(usb_clk48_s clk_s)
54{
55 crm_clocks_freq_type clocks_struct;
56
57 if(clk_s == USB_CLK_HICK)
58 {
59 crm_usb_clock_source_select(CRM_USB_CLOCK_SOURCE_HICK);
60
61 /* enable the acc calibration ready interrupt */
62 crm_periph_clock_enable(CRM_ACC_PERIPH_CLOCK, TRUE);
63
64 /* update the c1\c2\c3 value */
65 acc_write_c1(7980);
66 acc_write_c2(8000);
67 acc_write_c3(8020);
68
69 /* open acc calibration */
70 acc_calibration_mode_enable(ACC_CAL_HICKTRIM, TRUE);
71 }
72 else
73 {
74 crm_clocks_freq_get(&clocks_struct);
75 switch(clocks_struct.sclk_freq)
76 {
77 /* 48MHz */
78 case 48000000:
79 crm_usb_clock_div_set(CRM_USB_DIV_1);
80 break;
81
82 /* 72MHz */
83 case 72000000:
84 crm_usb_clock_div_set(CRM_USB_DIV_1_5);
85 break;
86
87 /* 96MHz */
88 case 96000000:
89 crm_usb_clock_div_set(CRM_USB_DIV_2);
90 break;
91
92 /* 120MHz */
93 case 120000000:
94 crm_usb_clock_div_set(CRM_USB_DIV_2_5);
95 break;
96
97 /* 144MHz */
98 case 144000000:
99 crm_usb_clock_div_set(CRM_USB_DIV_3);
100 break;
101
102 /* 168MHz */
103 case 168000000:
104 crm_usb_clock_div_set(CRM_USB_DIV_3_5);
105 break;
106
107 /* 192MHz */
108 case 192000000:
109 crm_usb_clock_div_set(CRM_USB_DIV_4);
110 break;
111
112 default:
113 break;
114
115 }
116 }
117}
118
124int main(void)
125{
126 __IO uint32_t delay_index = 0;
127 /* config nvic priority group */
128 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
129
130 system_clock_config();
131
132 at32_board_init();
133
134 /* select usb 48m clcok source */
135 usb_clock48m_select(USB_CLK_HEXT);
136
137#ifdef USB_LOW_POWER_WAKUP
138 /* enable pwc and bpr clock */
139 crm_periph_clock_enable(CRM_PWC_PERIPH_CLOCK, TRUE);
140 button_exint_init();
141 usb_low_power_wakeup_config();
142#endif
143
144 /* enable usb clock */
145 crm_periph_clock_enable(CRM_USB_PERIPH_CLOCK, TRUE);
146
147 /* enable usb interrupt */
148 nvic_irq_enable(USBFS_L_CAN1_RX0_IRQn, 0, 0);
149
150 /* usb core init */
151 usbd_core_init(&usb_core_dev, USB, &mouse_class_handler, &mouse_desc_handler, 0);
152
153 /* enable usb pull-up */
154 usbd_connect(&usb_core_dev);
155
156 while(1)
157 {
158 if(at32_button_press() == USER_BUTTON)
159 {
160 if(usbd_connect_state_get(&usb_core_dev) == USB_CONN_STATE_CONFIGURED)
161 {
162 usb_hid_mouse_send(&usb_core_dev, RIGHT_BUTTON);
163 press_mouse = 1;
164 }
165 /* remote wakeup */
166 if(usbd_connect_state_get(&usb_core_dev) == USB_CONN_STATE_SUSPENDED
167 &&(usb_core_dev.remote_wakup == 1))
168 {
169 usbd_remote_wakeup(&usb_core_dev);
170 }
171 }
172 else if(press_mouse == 1)
173 {
174 delay_ms(10);
175 usb_hid_mouse_send(&usb_core_dev, BUTTON_RELEASE);
176 press_mouse = 0;
177 }
178 #ifdef USB_LOW_POWER_WAKUP
179 /* enter deep sleep */
180 if(((mouse_type *)(usb_core_dev.class_handler->pdata))->hid_suspend_flag == 1)
181 {
182 at32_led_off(LED2);
183 at32_led_off(LED3);
184 at32_led_off(LED4);
185
186 /* enter deep sleep mode */
187 pwc_deep_sleep_mode_enter(PWC_DEEP_SLEEP_ENTER_WFI);
188
189 /* wait 3 LICK(maximum 120us) cycles to ensure clock stable, delay 120us*/
190 /* when wakeup from deepsleep,system clock source changes to HICK */
191 if((CRM->misc3_bit.hick_to_sclk == TRUE) && (CRM->misc1_bit.hickdiv == TRUE))
192 {
193 /* HICK is 48MHz */
194 for(delay_index = 0; delay_index < 750; delay_index++)
195 {
196 __NOP();
197 }
198 }
199 else
200 {
201 /* HICK is 8MHz */
202 for(delay_index = 0; delay_index < 125; delay_index++)
203 {
204 __NOP();
205 }
206 }
207
208 system_clock_recover();
209
210 ((mouse_type *)(usb_core_dev.class_handler->pdata))->hid_suspend_flag = 0;
211 at32_led_on(LED2);
212 at32_led_on(LED3);
213 at32_led_on(LED4);
214 }
215#endif
216
217 }
218}
219
220#ifdef USB_LOW_POWER_WAKUP
226void button_exint_init(void)
227{
228 exint_init_type exint_init_struct;
229
230 crm_periph_clock_enable(CRM_IOMUX_PERIPH_CLOCK, TRUE);
231 gpio_exint_line_config(GPIO_PORT_SOURCE_GPIOA, GPIO_PINS_SOURCE0);
232
233 exint_default_para_init(&exint_init_struct);
234 exint_init_struct.line_enable = TRUE;
235 exint_init_struct.line_mode = EXINT_LINE_INTERRUPT;
236 exint_init_struct.line_select = EXINT_LINE_0;
237 exint_init_struct.line_polarity = EXINT_TRIGGER_RISING_EDGE;
238 exint_init(&exint_init_struct);
239
240 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
241 nvic_irq_enable(EXINT0_IRQn, 0, 0);
242}
243
249void EXINT0_IRQHandler(void)
250{
251 /* clear interrupt pending bit */
252 exint_flag_clear(EXINT_LINE_0);
253}
254
260void usb_low_power_wakeup_config(void)
261{
262 exint_init_type exint_init_struct;
263
264 exint_default_para_init(&exint_init_struct);
265
266 exint_init_struct.line_enable = TRUE;
267 exint_init_struct.line_mode = EXINT_LINE_INTERRUPT;
268 exint_init_struct.line_select = EXINT_LINE_18;
269 exint_init_struct.line_polarity = EXINT_TRIGGER_RISING_EDGE;
270 exint_init(&exint_init_struct);
271
272 nvic_irq_enable(USBFSWakeUp_IRQn, 0, 0);
273}
274
280void USBFSWakeUp_IRQHandler(void)
281{
282 exint_flag_clear(EXINT_LINE_18);
283}
284
290void system_clock_recover(void)
291{
292 /* enable external high-speed crystal oscillator - hext */
293 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
294
295 /* wait till hext is ready */
296 while(crm_hext_stable_wait() == ERROR);
297
298 /* enable pll */
299 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
300
301 /* wait till pll is ready */
302 while(crm_flag_get(CRM_PLL_STABLE_FLAG) == RESET);
303
304 /* enable auto step mode */
305 crm_auto_step_mode_enable(TRUE);
306
307 /* select pll as system clock source */
308 crm_sysclk_switch(CRM_SCLK_PLL);
309
310 /* wait till pll is used as system clock source */
311 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL);
312}
313
314#endif
315
321void USBFS_L_CAN1_RX0_IRQHandler(void)
322{
323 usbd_irq_handler(&usb_core_dev);
324}
325
326
332void usb_delay_ms(uint32_t ms)
333{
334 /* user can define self delay function */
335 delay_ms(ms);
336}
337
343void usb_delay_us(uint32_t us)
344{
345 delay_us(us);
346}
347
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
usb_delay_ms
void usb_delay_ms(uint32_t ms)
usb delay millisecond function.
Definition project/at_start_f413/examples/acc/calibration/src/main.c:244
usb_delay_us
void usb_delay_us(uint32_t us)
usb delay microsecond function.
Definition project/at_start_f413/examples/acc/calibration/src/main.c:255
EXINT0_IRQHandler
void EXINT0_IRQHandler(void)
exint0 interrupt handler
Definition project/at_start_f413/examples/exint/exint_config/src/main.c:95
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
hid_suspend_flag
__IO uint8_t hid_suspend_flag
report_buf
uint8_t report_buf[0x40]
Definition project/at_start_f413/examples/usb_device/mouse/src/main.c:44
button_exint_init
void button_exint_init(void)
configure button exint
Definition project/at_start_f413/templates/src/main.c:51
usb_clock48m_select
void usb_clock48m_select(usb_clk48_s clk_s)
usb 48M clock select
Definition project/at_start_f413/examples/usb_device/mouse/src/main.c:53
main
int main(void)
main function.
Definition project/at_start_f413/examples/usb_device/mouse/src/main.c:124
usb_low_power_wakeup_config
void usb_low_power_wakeup_config(void)
USBFS_L_CAN1_RX0_IRQHandler
void USBFS_L_CAN1_RX0_IRQHandler(void)
this function handles usb interrupt.
Definition project/at_start_f413/examples/usb_device/mouse/src/main.c:321
press_mouse
__IO uint8_t press_mouse
Definition project/at_start_f413/examples/usb_device/mouse/src/main.c:42
usb_core_dev
usbd_core_type usb_core_dev
Definition project/at_start_f413/examples/usb_device/mouse/src/main.c:41
system_clock_recover
void system_clock_recover(void)
systemclock recover.
Definition project/at_start_f413/examples/pwc/deepsleep_rtc/src/main.c:97
ACC_CAL_HICKTRIM
#define ACC_CAL_HICKTRIM
Definition at32f413_acc.h:52
acc_write_c2
void acc_write_c2(uint16_t acc_c2_value)
wtire the value to acc c2 register.
Definition at32f413_acc.c:131
acc_write_c3
void acc_write_c3(uint16_t acc_c3_value)
wtire the value to acc c3 register.
Definition at32f413_acc.c:141
acc_write_c1
void acc_write_c1(uint16_t acc_c1_value)
wtire the value to acc c1 register.
Definition at32f413_acc.c:121
acc_calibration_mode_enable
void acc_calibration_mode_enable(uint16_t acc_trim, confirm_state new_state)
enable or disable the acc calibration mode.
Definition at32f413_acc.c:52
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
USER_BUTTON
@ USER_BUTTON
Definition at32f413_board.h:93
at32_button_press
button_type at32_button_press()
returns which button have press down
Definition at32f413_board.c:218
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_led_off
void at32_led_off(led_type led)
turns selected led off.
Definition at32f413_board.c:287
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
delay_us
void delay_us(uint32_t nus)
inserts a delay time.
Definition at32f413_board.c:330
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_usb_clock_div_set
void crm_usb_clock_div_set(crm_usb_div_type div_value)
set crm usb division
Definition at32f413_crm.c:533
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
crm_usb_clock_source_select
void crm_usb_clock_source_select(crm_usb_clock_source_type value)
usb 48 mhz clock source select
Definition at32f413_crm.c:854
crm_clocks_freq_get
void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
Definition at32f413_crm.c:660
CRM_USB_PERIPH_CLOCK
@ CRM_USB_PERIPH_CLOCK
Definition at32f413_crm.h:137
CRM_PWC_PERIPH_CLOCK
@ CRM_PWC_PERIPH_CLOCK
Definition at32f413_crm.h:140
CRM_ACC_PERIPH_CLOCK
@ CRM_ACC_PERIPH_CLOCK
Definition at32f413_crm.h:123
CRM_IOMUX_PERIPH_CLOCK
@ CRM_IOMUX_PERIPH_CLOCK
Definition at32f413_crm.h:108
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_USB_DIV_3
@ CRM_USB_DIV_3
Definition at32f413_crm.h:363
CRM_USB_DIV_1_5
@ CRM_USB_DIV_1_5
Definition at32f413_crm.h:358
CRM_USB_DIV_4
@ CRM_USB_DIV_4
Definition at32f413_crm.h:364
CRM_USB_DIV_3_5
@ CRM_USB_DIV_3_5
Definition at32f413_crm.h:362
CRM_USB_DIV_2
@ CRM_USB_DIV_2
Definition at32f413_crm.h:361
CRM_USB_DIV_1
@ CRM_USB_DIV_1
Definition at32f413_crm.h:359
CRM_USB_DIV_2_5
@ CRM_USB_DIV_2_5
Definition at32f413_crm.h:360
CRM_USB_CLOCK_SOURCE_HICK
@ CRM_USB_CLOCK_SOURCE_HICK
Definition at32f413_crm.h:454
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
CRM
#define CRM
Definition at32f413_crm.h:843
USBFSWakeUp_IRQn
@ USBFSWakeUp_IRQn
Definition at32f413.h:214
EXINT0_IRQn
@ EXINT0_IRQn
Definition at32f413.h:177
USBFS_L_CAN1_RX0_IRQn
@ USBFS_L_CAN1_RX0_IRQn
Definition at32f413.h:192
exint_flag_clear
void exint_flag_clear(uint32_t exint_line)
clear exint flag
Definition at32f413_exint.c:125
exint_default_para_init
void exint_default_para_init(exint_init_type *exint_struct)
exint default para init
Definition at32f413_exint.c:63
exint_init
void exint_init(exint_init_type *exint_struct)
exint init
Definition at32f413_exint.c:77
EXINT_LINE_INTERRUPT
@ EXINT_LINE_INTERRUPT
Definition at32f413_exint.h:84
EXINT_TRIGGER_RISING_EDGE
@ EXINT_TRIGGER_RISING_EDGE
Definition at32f413_exint.h:93
EXINT_LINE_18
#define EXINT_LINE_18
Definition at32f413_exint.h:69
EXINT_LINE_0
#define EXINT_LINE_0
Definition at32f413_exint.h:51
ERROR
@ ERROR
Definition at32f413.h:302
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
gpio_exint_line_config
void gpio_exint_line_config(gpio_port_source_type gpio_port_source, gpio_pins_source_type gpio_pin_source)
select the gpio pin used as exint line.
Definition at32f413_gpio.c:605
GPIO_PINS_SOURCE0
@ GPIO_PINS_SOURCE0
Definition at32f413_gpio.h:253
GPIO_PORT_SOURCE_GPIOA
@ GPIO_PORT_SOURCE_GPIOA
Definition at32f413_gpio.h:276
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
pwc_deep_sleep_mode_enter
void pwc_deep_sleep_mode_enter(pwc_deep_sleep_enter_type pwc_deep_sleep_enter)
enter pwc deep-sleep mode
Definition at32f413_pwc.c:188
PWC_DEEP_SLEEP_ENTER_WFI
@ PWC_DEEP_SLEEP_ENTER_WFI
Definition at32f413_pwc.h:96
usb_clk48_s
usb_clk48_s
usb clock select
Definition at32f413_usb.h:230
USB_CLK_HEXT
@ USB_CLK_HEXT
Definition at32f413_usb.h:232
USB_CLK_HICK
@ USB_CLK_HICK
Definition at32f413_usb.h:231
USBD_MOUSE_IN_MAXPACKET_SIZE
#define USBD_MOUSE_IN_MAXPACKET_SIZE
usb hid in and out max packet size define
Definition mouse_class.h:57
mouse_class_handler
usbd_class_handler mouse_class_handler
Definition mouse_class.c:55
usb_hid_mouse_send
void usb_hid_mouse_send(void *udev, uint8_t op)
usb device class report function
Definition mouse_class.c:337
BUTTON_RELEASE
#define BUTTON_RELEASE
Definition mouse_class.h:73
RIGHT_BUTTON
#define RIGHT_BUTTON
Definition mouse_class.h:75
mouse_desc_handler
usbd_desc_handler mouse_desc_handler
mouse device descriptor handler structure
Definition mouse_desc.c:65
USB_CONN_STATE_SUSPENDED
@ USB_CONN_STATE_SUSPENDED
Definition usb_std.h:138
USB_CONN_STATE_CONFIGURED
@ USB_CONN_STATE_CONFIGURED
Definition usb_std.h:137
usbd_connect_state_get
usbd_conn_state usbd_connect_state_get(usbd_core_type *udev)
get usb connect state
Definition usbd_core.c:595
usbd_core_init
void usbd_core_init(usbd_core_type *udev, usb_reg_type *usb_reg, usbd_class_handler *dev_handler, usbd_desc_handler *desc_handler, uint8_t core_id)
initializes the usb core
Definition usbd_core.c:675
usbd_remote_wakeup
void usbd_remote_wakeup(usbd_core_type *udev)
usb device remote wakeup
Definition usbd_core.c:605
usbd_connect
void usbd_connect(usbd_core_type *udev)
usb device connect to host
Definition usbd_core.c:564
usbd_irq_handler
void usbd_irq_handler(usbd_core_type *udev)
usb device interrput request handler.
Definition usbd_int.c:45
USB
#define USB
Definition at32f413_usb.h:665
mouse_class.h
usb hid mouse header file
mouse_desc.h
usb mouse descriptor header file
at32f413_clock.h
header file of clock program
crm_clocks_freq_type
crm clocks freqency structure
Definition at32f413_crm.h:470
crm_clocks_freq_type::sclk_freq
uint32_t sclk_freq
Definition at32f413_crm.h:471
exint_init_type
exint init type
Definition at32f413_exint.h:102
exint_init_type::line_select
uint32_t line_select
Definition at32f413_exint.h:104
exint_init_type::line_enable
confirm_state line_enable
Definition at32f413_exint.h:106
exint_init_type::line_mode
exint_line_mode_type line_mode
Definition at32f413_exint.h:103
exint_init_type::line_polarity
exint_polarity_config_type line_polarity
Definition at32f413_exint.h:105
mouse_type
Definition mouse_class.h:82
usbd_class_handler::pdata
void * pdata
Definition usbd_core.h:107
usbd_core_type
usb device core struct type
Definition usbd_core.h:114
usbd_core_type::remote_wakup
uint8_t remote_wakup
Definition usbd_core.h:134
usbd_core_type::class_handler
usbd_class_handler * class_handler
Definition usbd_core.h:117
usbd_core.h
usb device core header file
usbd_int.h


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • usb_device
  • msc
  • inc
project/at_start_f413/examples/usb_device/msc/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • usb_device
  • msc
  • inc
project/at_start_f413/examples/usb_device/msc/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • usb_device
  • msc
  • inc
project/at_start_f413/examples/usb_device/msc/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: usb_conf.h Source File

  • usb_device
  • msc
  • inc
project/at_start_f413/examples/usb_device/msc/inc/usb_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __USB_CONF_H
28#define __USB_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "at32f413.h"
35#include "at32f413_board.h"
36#include "stdio.h"
37
49#ifndef USB_EPT_MAX_NUM
50#define USB_EPT_MAX_NUM 8
51#endif
52
56//#define USB_BUFFER_SIZE_EX /*!< usb enable extend buffer */
57
58
62#define USB_EPT_AUTO_MALLOC_BUFFER
65#ifndef USB_EPT_AUTO_MALLOC_BUFFER
71/* ept0 tx start address 0x40, size 0x40,
72 so rx start address is 0x40 + 0x40 = 0x80 */
73#define EPT0_TX_ADDR 0x40
74#define EPT0_RX_ADDR 0x80
76#define EPT1_TX_ADDR 0xC0
77#define EPT1_RX_ADDR 0x100
79#define EPT2_TX_ADDR 0x140
80#define EPT2_RX_ADDR 0x180
82#define EPT3_TX_ADDR 0x00
83#define EPT3_RX_ADDR 0x00
85#define EPT4_TX_ADDR 0x00
86#define EPT4_RX_ADDR 0x00
88#define EPT5_TX_ADDR 0x00
89#define EPT5_RX_ADDR 0x00
91#define EPT6_TX_ADDR 0x00
92#define EPT6_RX_ADDR 0x00
94#define EPT7_TX_ADDR 0x00
95#define EPT7_RX_ADDR 0x00
97#endif
98
99void usb_delay_ms(uint32_t ms);
100void usb_delay_us(uint32_t us);
101
110#ifdef __cplusplus
111}
112#endif
113
114#endif
115
at32f413.h
at32f413 header file
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
usb_delay_ms
void usb_delay_ms(uint32_t ms)
usb delay millisecond function.
Definition project/at_start_f413/examples/usb_device/msc/src/main.c:165
usb_delay_us
void usb_delay_us(uint32_t us)
usb delay microsecond function.
Definition project/at_start_f413/examples/usb_device/msc/src/main.c:176


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • usb_device
  • msc
  • src
project/at_start_f413/examples/usb_device/msc/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/usb_device/msc/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • usb_device
  • msc
  • src
project/at_start_f413/examples/usb_device/msc/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/usb_device/msc/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/usb_device/msc/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/usb_device/msc/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/usb_device/msc/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/usb_device/msc/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/usb_device/msc/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/usb_device/msc/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/usb_device/msc/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/usb_device/msc/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • usb_device
  • msc
  • src
project/at_start_f413/examples/usb_device/msc/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include "usbd_core.h"
29#include "msc_class.h"
30#include "msc_desc.h"
31#include "usbd_int.h"
32
33
42 usbd_core_type usb_core_dev;
43
44
50void usb_clock48m_select(usb_clk48_s clk_s)
51{
52 crm_clocks_freq_type clocks_struct;
53
54 if(clk_s == USB_CLK_HICK)
55 {
56 crm_usb_clock_source_select(CRM_USB_CLOCK_SOURCE_HICK);
57
58 /* enable the acc calibration ready interrupt */
59 crm_periph_clock_enable(CRM_ACC_PERIPH_CLOCK, TRUE);
60
61 /* update the c1\c2\c3 value */
62 acc_write_c1(7980);
63 acc_write_c2(8000);
64 acc_write_c3(8020);
65
66 /* open acc calibration */
67 acc_calibration_mode_enable(ACC_CAL_HICKTRIM, TRUE);
68 }
69 else
70 {
71 crm_clocks_freq_get(&clocks_struct);
72 switch(clocks_struct.sclk_freq)
73 {
74 /* 48MHz */
75 case 48000000:
76 crm_usb_clock_div_set(CRM_USB_DIV_1);
77 break;
78
79 /* 72MHz */
80 case 72000000:
81 crm_usb_clock_div_set(CRM_USB_DIV_1_5);
82 break;
83
84 /* 96MHz */
85 case 96000000:
86 crm_usb_clock_div_set(CRM_USB_DIV_2);
87 break;
88
89 /* 120MHz */
90 case 120000000:
91 crm_usb_clock_div_set(CRM_USB_DIV_2_5);
92 break;
93
94 /* 144MHz */
95 case 144000000:
96 crm_usb_clock_div_set(CRM_USB_DIV_3);
97 break;
98
99 /* 168MHz */
100 case 168000000:
101 crm_usb_clock_div_set(CRM_USB_DIV_3_5);
102 break;
103
104 /* 192MHz */
105 case 192000000:
106 crm_usb_clock_div_set(CRM_USB_DIV_4);
107 break;
108
109 default:
110 break;
111
112 }
113 }
114}
115
121int main(void)
122{
123 /* config nvic priority group */
124 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
125
126 system_clock_config();
127
128 at32_board_init();
129
130 /* select usb 48m clcok source */
131 usb_clock48m_select(USB_CLK_HEXT);
132
133 /* enable usb clock */
134 crm_periph_clock_enable(CRM_USB_PERIPH_CLOCK, TRUE);
135
136 /* enable usb interrupt */
137 nvic_irq_enable(USBFS_L_CAN1_RX0_IRQn, 0, 0);
138
139 /* usb core init */
140 usbd_core_init(&usb_core_dev, USB, &msc_class_handler, &msc_desc_handler, 0);
141
142 /* enable usb pull-up */
143 usbd_connect(&usb_core_dev);
144
145 while(1)
146 {
147 }
148}
149
155void USBFS_L_CAN1_RX0_IRQHandler(void)
156{
157 usbd_irq_handler(&usb_core_dev);
158}
159
165void usb_delay_ms(uint32_t ms)
166{
167 /* user can define self delay function */
168 delay_ms(ms);
169}
170
176void usb_delay_us(uint32_t us)
177{
178 delay_us(us);
179}
180
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
usb_delay_ms
void usb_delay_ms(uint32_t ms)
usb delay millisecond function.
Definition project/at_start_f413/examples/acc/calibration/src/main.c:244
usb_delay_us
void usb_delay_us(uint32_t us)
usb delay microsecond function.
Definition project/at_start_f413/examples/acc/calibration/src/main.c:255
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
usb_clock48m_select
void usb_clock48m_select(usb_clk48_s clk_s)
usb 48M clock select
Definition project/at_start_f413/examples/usb_device/msc/src/main.c:50
main
int main(void)
main function.
Definition project/at_start_f413/examples/usb_device/msc/src/main.c:121
USBFS_L_CAN1_RX0_IRQHandler
void USBFS_L_CAN1_RX0_IRQHandler(void)
this function handles usb interrupt.
Definition project/at_start_f413/examples/usb_device/msc/src/main.c:155
usb_core_dev
usbd_core_type usb_core_dev
Definition project/at_start_f413/examples/usb_device/msc/src/main.c:42
ACC_CAL_HICKTRIM
#define ACC_CAL_HICKTRIM
Definition at32f413_acc.h:52
acc_write_c2
void acc_write_c2(uint16_t acc_c2_value)
wtire the value to acc c2 register.
Definition at32f413_acc.c:131
acc_write_c3
void acc_write_c3(uint16_t acc_c3_value)
wtire the value to acc c3 register.
Definition at32f413_acc.c:141
acc_write_c1
void acc_write_c1(uint16_t acc_c1_value)
wtire the value to acc c1 register.
Definition at32f413_acc.c:121
acc_calibration_mode_enable
void acc_calibration_mode_enable(uint16_t acc_trim, confirm_state new_state)
enable or disable the acc calibration mode.
Definition at32f413_acc.c:52
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
delay_us
void delay_us(uint32_t nus)
inserts a delay time.
Definition at32f413_board.c:330
crm_usb_clock_div_set
void crm_usb_clock_div_set(crm_usb_div_type div_value)
set crm usb division
Definition at32f413_crm.c:533
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_usb_clock_source_select
void crm_usb_clock_source_select(crm_usb_clock_source_type value)
usb 48 mhz clock source select
Definition at32f413_crm.c:854
crm_clocks_freq_get
void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
Definition at32f413_crm.c:660
CRM_USB_PERIPH_CLOCK
@ CRM_USB_PERIPH_CLOCK
Definition at32f413_crm.h:137
CRM_ACC_PERIPH_CLOCK
@ CRM_ACC_PERIPH_CLOCK
Definition at32f413_crm.h:123
CRM_USB_DIV_3
@ CRM_USB_DIV_3
Definition at32f413_crm.h:363
CRM_USB_DIV_1_5
@ CRM_USB_DIV_1_5
Definition at32f413_crm.h:358
CRM_USB_DIV_4
@ CRM_USB_DIV_4
Definition at32f413_crm.h:364
CRM_USB_DIV_3_5
@ CRM_USB_DIV_3_5
Definition at32f413_crm.h:362
CRM_USB_DIV_2
@ CRM_USB_DIV_2
Definition at32f413_crm.h:361
CRM_USB_DIV_1
@ CRM_USB_DIV_1
Definition at32f413_crm.h:359
CRM_USB_DIV_2_5
@ CRM_USB_DIV_2_5
Definition at32f413_crm.h:360
CRM_USB_CLOCK_SOURCE_HICK
@ CRM_USB_CLOCK_SOURCE_HICK
Definition at32f413_crm.h:454
USBFS_L_CAN1_RX0_IRQn
@ USBFS_L_CAN1_RX0_IRQn
Definition at32f413.h:192
TRUE
@ TRUE
Definition at32f413.h:297
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
usb_clk48_s
usb_clk48_s
usb clock select
Definition at32f413_usb.h:230
USB_CLK_HEXT
@ USB_CLK_HEXT
Definition at32f413_usb.h:232
USB_CLK_HICK
@ USB_CLK_HICK
Definition at32f413_usb.h:231
msc_class_handler
usbd_class_handler msc_class_handler
Definition msc_class.c:56
msc_desc_handler
usbd_desc_handler msc_desc_handler
device descriptor handler structure
Definition msc_desc.c:66
usbd_core_init
void usbd_core_init(usbd_core_type *udev, usb_reg_type *usb_reg, usbd_class_handler *dev_handler, usbd_desc_handler *desc_handler, uint8_t core_id)
initializes the usb core
Definition usbd_core.c:675
usbd_connect
void usbd_connect(usbd_core_type *udev)
usb device connect to host
Definition usbd_core.c:564
usbd_irq_handler
void usbd_irq_handler(usbd_core_type *udev)
usb device interrput request handler.
Definition usbd_int.c:45
USB
#define USB
Definition at32f413_usb.h:665
msc_class.h
usb msc class file
msc_desc.h
usb msc descriptor header file
at32f413_clock.h
header file of clock program
crm_clocks_freq_type
crm clocks freqency structure
Definition at32f413_crm.h:470
crm_clocks_freq_type::sclk_freq
uint32_t sclk_freq
Definition at32f413_crm.h:471
usbd_core_type
usb device core struct type
Definition usbd_core.h:114
usbd_core.h
usb device core header file
usbd_int.h


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • usb_device
  • printer
  • inc
project/at_start_f413/examples/usb_device/printer/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • usb_device
  • printer
  • inc
project/at_start_f413/examples/usb_device/printer/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • usb_device
  • printer
  • inc
project/at_start_f413/examples/usb_device/printer/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: usb_conf.h Source File

  • usb_device
  • printer
  • inc
project/at_start_f413/examples/usb_device/printer/inc/usb_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __USB_CONF_H
28#define __USB_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "at32f413.h"
35#include "at32f413_board.h"
36#include "stdio.h"
37
49#ifndef USB_EPT_MAX_NUM
50#define USB_EPT_MAX_NUM 8
51#endif
52
56//#define USB_BUFFER_SIZE_EX /*!< usb enable extend buffer */
57
58
62#define USB_EPT_AUTO_MALLOC_BUFFER
65#ifndef USB_EPT_AUTO_MALLOC_BUFFER
71/* ept0 tx start address 0x40, size 0x40,
72 so rx start address is 0x40 + 0x40 = 0x80 */
73#define EPT0_TX_ADDR 0x40
74#define EPT0_RX_ADDR 0x80
76#define EPT1_TX_ADDR 0xC0
77#define EPT1_RX_ADDR 0x100
79#define EPT2_TX_ADDR 0x140
80#define EPT2_RX_ADDR 0x180
82#define EPT3_TX_ADDR 0x00
83#define EPT3_RX_ADDR 0x00
85#define EPT4_TX_ADDR 0x00
86#define EPT4_RX_ADDR 0x00
88#define EPT5_TX_ADDR 0x00
89#define EPT5_RX_ADDR 0x00
91#define EPT6_TX_ADDR 0x00
92#define EPT6_RX_ADDR 0x00
94#define EPT7_TX_ADDR 0x00
95#define EPT7_RX_ADDR 0x00
97#endif
98
99void usb_delay_ms(uint32_t ms);
100void usb_delay_us(uint32_t us);
101
110#ifdef __cplusplus
111}
112#endif
113
114#endif
115
at32f413.h
at32f413 header file
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
usb_delay_ms
void usb_delay_ms(uint32_t ms)
usb delay millisecond function.
Definition project/at_start_f413/examples/usb_device/printer/src/main.c:171
usb_delay_us
void usb_delay_us(uint32_t us)
usb delay microsecond function.
Definition project/at_start_f413/examples/usb_device/printer/src/main.c:182


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • usb_device
  • printer
  • src
project/at_start_f413/examples/usb_device/printer/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/usb_device/printer/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • usb_device
  • printer
  • src
project/at_start_f413/examples/usb_device/printer/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/usb_device/printer/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/usb_device/printer/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/usb_device/printer/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/usb_device/printer/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/usb_device/printer/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/usb_device/printer/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/usb_device/printer/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/usb_device/printer/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/usb_device/printer/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • usb_device
  • printer
  • src
project/at_start_f413/examples/usb_device/printer/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include "usbd_core.h"
29#include "printer_class.h"
30#include "printer_desc.h"
31#include "usbd_int.h"
32
41uint8_t usb_buffer[256];
42 usbd_core_type usb_core_dev;
43
49void usb_clock48m_select(usb_clk48_s clk_s)
50{
51 crm_clocks_freq_type clocks_struct;
52
53 if(clk_s == USB_CLK_HICK)
54 {
55 crm_usb_clock_source_select(CRM_USB_CLOCK_SOURCE_HICK);
56
57 /* enable the acc calibration ready interrupt */
58 crm_periph_clock_enable(CRM_ACC_PERIPH_CLOCK, TRUE);
59
60 /* update the c1\c2\c3 value */
61 acc_write_c1(7980);
62 acc_write_c2(8000);
63 acc_write_c3(8020);
64
65 /* open acc calibration */
66 acc_calibration_mode_enable(ACC_CAL_HICKTRIM, TRUE);
67 }
68 else
69 {
70 crm_clocks_freq_get(&clocks_struct);
71 switch(clocks_struct.sclk_freq)
72 {
73 /* 48MHz */
74 case 48000000:
75 crm_usb_clock_div_set(CRM_USB_DIV_1);
76 break;
77
78 /* 72MHz */
79 case 72000000:
80 crm_usb_clock_div_set(CRM_USB_DIV_1_5);
81 break;
82
83 /* 96MHz */
84 case 96000000:
85 crm_usb_clock_div_set(CRM_USB_DIV_2);
86 break;
87
88 /* 120MHz */
89 case 120000000:
90 crm_usb_clock_div_set(CRM_USB_DIV_2_5);
91 break;
92
93 /* 144MHz */
94 case 144000000:
95 crm_usb_clock_div_set(CRM_USB_DIV_3);
96 break;
97
98 /* 168MHz */
99 case 168000000:
100 crm_usb_clock_div_set(CRM_USB_DIV_3_5);
101 break;
102
103 /* 192MHz */
104 case 192000000:
105 crm_usb_clock_div_set(CRM_USB_DIV_4);
106 break;
107
108 default:
109 break;
110
111 }
112 }
113}
114
120int main(void)
121{
122 uint32_t rx_len = 0;
123
124 /* config nvic priority group */
125 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
126
127 system_clock_config();
128
129 at32_board_init();
130
131 /* select usb 48m clcok source */
132 usb_clock48m_select(USB_CLK_HEXT);
133
134 /* enable usb clock */
135 crm_periph_clock_enable(CRM_USB_PERIPH_CLOCK, TRUE);
136
137 /* enable usb interrupt */
138 nvic_irq_enable(USBFS_L_CAN1_RX0_IRQn, 0, 0);
139
140 /* usb core init */
141 usbd_core_init(&usb_core_dev, USB, &printer_class_handler, &printer_desc_handler, 0);
142
143 /* enable usb pull-up */
144 usbd_connect(&usb_core_dev);
145
146 while(1)
147 {
148 /* get usb printer receive data */
149 rx_len = usb_printer_get_rxdata(&usb_core_dev, usb_buffer);
150 UNUSED(rx_len);
151
152 /* user code ...*/
153 }
154}
155
161void USBFS_L_CAN1_RX0_IRQHandler(void)
162{
163 usbd_irq_handler(&usb_core_dev);
164}
165
171void usb_delay_ms(uint32_t ms)
172{
173 /* user can define self delay function */
174 delay_ms(ms);
175}
176
182void usb_delay_us(uint32_t us)
183{
184 delay_us(us);
185}
186
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
UNUSED
#define UNUSED(x)
Definition at32f413_def.h:64
usb_delay_ms
void usb_delay_ms(uint32_t ms)
usb delay millisecond function.
Definition project/at_start_f413/examples/acc/calibration/src/main.c:244
usb_delay_us
void usb_delay_us(uint32_t us)
usb delay microsecond function.
Definition project/at_start_f413/examples/acc/calibration/src/main.c:255
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
usb_clock48m_select
void usb_clock48m_select(usb_clk48_s clk_s)
usb 48M clock select
Definition project/at_start_f413/examples/usb_device/printer/src/main.c:49
main
int main(void)
main function.
Definition project/at_start_f413/examples/usb_device/printer/src/main.c:120
USBFS_L_CAN1_RX0_IRQHandler
void USBFS_L_CAN1_RX0_IRQHandler(void)
this function handles usb interrupt.
Definition project/at_start_f413/examples/usb_device/printer/src/main.c:161
usb_buffer
uint8_t usb_buffer[256]
Definition project/at_start_f413/examples/usb_device/printer/src/main.c:41
usb_core_dev
usbd_core_type usb_core_dev
Definition project/at_start_f413/examples/usb_device/printer/src/main.c:42
ACC_CAL_HICKTRIM
#define ACC_CAL_HICKTRIM
Definition at32f413_acc.h:52
acc_write_c2
void acc_write_c2(uint16_t acc_c2_value)
wtire the value to acc c2 register.
Definition at32f413_acc.c:131
acc_write_c3
void acc_write_c3(uint16_t acc_c3_value)
wtire the value to acc c3 register.
Definition at32f413_acc.c:141
acc_write_c1
void acc_write_c1(uint16_t acc_c1_value)
wtire the value to acc c1 register.
Definition at32f413_acc.c:121
acc_calibration_mode_enable
void acc_calibration_mode_enable(uint16_t acc_trim, confirm_state new_state)
enable or disable the acc calibration mode.
Definition at32f413_acc.c:52
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
delay_us
void delay_us(uint32_t nus)
inserts a delay time.
Definition at32f413_board.c:330
crm_usb_clock_div_set
void crm_usb_clock_div_set(crm_usb_div_type div_value)
set crm usb division
Definition at32f413_crm.c:533
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_usb_clock_source_select
void crm_usb_clock_source_select(crm_usb_clock_source_type value)
usb 48 mhz clock source select
Definition at32f413_crm.c:854
crm_clocks_freq_get
void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
Definition at32f413_crm.c:660
CRM_USB_PERIPH_CLOCK
@ CRM_USB_PERIPH_CLOCK
Definition at32f413_crm.h:137
CRM_ACC_PERIPH_CLOCK
@ CRM_ACC_PERIPH_CLOCK
Definition at32f413_crm.h:123
CRM_USB_DIV_3
@ CRM_USB_DIV_3
Definition at32f413_crm.h:363
CRM_USB_DIV_1_5
@ CRM_USB_DIV_1_5
Definition at32f413_crm.h:358
CRM_USB_DIV_4
@ CRM_USB_DIV_4
Definition at32f413_crm.h:364
CRM_USB_DIV_3_5
@ CRM_USB_DIV_3_5
Definition at32f413_crm.h:362
CRM_USB_DIV_2
@ CRM_USB_DIV_2
Definition at32f413_crm.h:361
CRM_USB_DIV_1
@ CRM_USB_DIV_1
Definition at32f413_crm.h:359
CRM_USB_DIV_2_5
@ CRM_USB_DIV_2_5
Definition at32f413_crm.h:360
CRM_USB_CLOCK_SOURCE_HICK
@ CRM_USB_CLOCK_SOURCE_HICK
Definition at32f413_crm.h:454
USBFS_L_CAN1_RX0_IRQn
@ USBFS_L_CAN1_RX0_IRQn
Definition at32f413.h:192
TRUE
@ TRUE
Definition at32f413.h:297
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
usb_clk48_s
usb_clk48_s
usb clock select
Definition at32f413_usb.h:230
USB_CLK_HEXT
@ USB_CLK_HEXT
Definition at32f413_usb.h:232
USB_CLK_HICK
@ USB_CLK_HICK
Definition at32f413_usb.h:231
usb_printer_get_rxdata
uint16_t usb_printer_get_rxdata(void *udev, uint8_t *recv_data)
usb device class rx data process
Definition printer_class.c:303
printer_class_handler
usbd_class_handler printer_class_handler
Definition printer_class.c:63
printer_desc_handler
usbd_desc_handler printer_desc_handler
device descriptor handler structure
Definition printer_desc.c:66
usbd_core_init
void usbd_core_init(usbd_core_type *udev, usb_reg_type *usb_reg, usbd_class_handler *dev_handler, usbd_desc_handler *desc_handler, uint8_t core_id)
initializes the usb core
Definition usbd_core.c:675
usbd_connect
void usbd_connect(usbd_core_type *udev)
usb device connect to host
Definition usbd_core.c:564
usbd_irq_handler
void usbd_irq_handler(usbd_core_type *udev)
usb device interrput request handler.
Definition usbd_int.c:45
USB
#define USB
Definition at32f413_usb.h:665
printer_class.h
usb printer class file
printer_desc.h
usb printer descriptor header file
at32f413_clock.h
header file of clock program
crm_clocks_freq_type
crm clocks freqency structure
Definition at32f413_crm.h:470
crm_clocks_freq_type::sclk_freq
uint32_t sclk_freq
Definition at32f413_crm.h:471
usbd_core_type
usb device core struct type
Definition usbd_core.h:114
usbd_core.h
usb device core header file
usbd_int.h


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • usb_device
  • vcp_loopback
  • inc
project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • usb_device
  • vcp_loopback
  • inc
project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • usb_device
  • vcp_loopback
  • inc
project/at_start_f413/examples/usb_device/vcp_loopback/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: usb_conf.h Source File

  • usb_device
  • vcp_loopback
  • inc
project/at_start_f413/examples/usb_device/vcp_loopback/inc/usb_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __USB_CONF_H
28#define __USB_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "at32f413.h"
35#include "at32f413_board.h"
36#include "stdio.h"
37
49#ifndef USB_EPT_MAX_NUM
50#define USB_EPT_MAX_NUM 8
51#endif
52
56//#define USB_BUFFER_SIZE_EX /*!< usb enable extend buffer */
57
58
62//#define USB_EPT_AUTO_MALLOC_BUFFER /*!< usb auto malloc endpoint tx and rx buffer */
63
64
65#ifndef USB_EPT_AUTO_MALLOC_BUFFER
71/* ept0 tx start address 0x40, size 0x40,
72 so rx start address is 0x40 + 0x40 = 0x80 */
73#define EPT0_TX_ADDR 0x40
74#define EPT0_RX_ADDR 0x80
76#define EPT1_TX_ADDR 0xC0
77#define EPT1_RX_ADDR 0x100
79#define EPT2_TX_ADDR 0x140
80#define EPT2_RX_ADDR 0x180
82#define EPT3_TX_ADDR 0x00
83#define EPT3_RX_ADDR 0x00
85#define EPT4_TX_ADDR 0x00
86#define EPT4_RX_ADDR 0x00
88#define EPT5_TX_ADDR 0x00
89#define EPT5_RX_ADDR 0x00
91#define EPT6_TX_ADDR 0x00
92#define EPT6_RX_ADDR 0x00
94#define EPT7_TX_ADDR 0x00
95#define EPT7_RX_ADDR 0x00
97#endif
98
99void usb_delay_ms(uint32_t ms);
100void usb_delay_us(uint32_t us);
101
110#ifdef __cplusplus
111}
112#endif
113
114#endif
115
at32f413.h
at32f413 header file
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
usb_delay_ms
void usb_delay_ms(uint32_t ms)
usb delay millisecond function.
Definition project/at_start_f413/examples/usb_device/vcp_loopback/src/main.c:197
usb_delay_us
void usb_delay_us(uint32_t us)
usb delay microsecond function.
Definition project/at_start_f413/examples/usb_device/vcp_loopback/src/main.c:208


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • usb_device
  • vcp_loopback
  • src
project/at_start_f413/examples/usb_device/vcp_loopback/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/usb_device/vcp_loopback/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • usb_device
  • vcp_loopback
  • src
project/at_start_f413/examples/usb_device/vcp_loopback/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/usb_device/vcp_loopback/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/usb_device/vcp_loopback/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/usb_device/vcp_loopback/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/usb_device/vcp_loopback/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/usb_device/vcp_loopback/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/usb_device/vcp_loopback/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/usb_device/vcp_loopback/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/usb_device/vcp_loopback/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/usb_device/vcp_loopback/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • usb_device
  • vcp_loopback
  • src
project/at_start_f413/examples/usb_device/vcp_loopback/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include "usbd_core.h"
29#include "cdc_class.h"
30#include "cdc_desc.h"
31#include "usbd_int.h"
32
41 usbd_core_type usb_core_dev;
42uint8_t usb_buffer[256];
43
49void usb_clock48m_select(usb_clk48_s clk_s)
50{
51 crm_clocks_freq_type clocks_struct;
52
53 if(clk_s == USB_CLK_HICK)
54 {
55 crm_usb_clock_source_select(CRM_USB_CLOCK_SOURCE_HICK);
56
57 /* enable the acc calibration ready interrupt */
58 crm_periph_clock_enable(CRM_ACC_PERIPH_CLOCK, TRUE);
59
60 /* update the c1\c2\c3 value */
61 acc_write_c1(7980);
62 acc_write_c2(8000);
63 acc_write_c3(8020);
64
65 /* open acc calibration */
66 acc_calibration_mode_enable(ACC_CAL_HICKTRIM, TRUE);
67 }
68 else
69 {
70 crm_clocks_freq_get(&clocks_struct);
71 switch(clocks_struct.sclk_freq)
72 {
73 /* 48MHz */
74 case 48000000:
75 crm_usb_clock_div_set(CRM_USB_DIV_1);
76 break;
77
78 /* 72MHz */
79 case 72000000:
80 crm_usb_clock_div_set(CRM_USB_DIV_1_5);
81 break;
82
83 /* 96MHz */
84 case 96000000:
85 crm_usb_clock_div_set(CRM_USB_DIV_2);
86 break;
87
88 /* 120MHz */
89 case 120000000:
90 crm_usb_clock_div_set(CRM_USB_DIV_2_5);
91 break;
92
93 /* 144MHz */
94 case 144000000:
95 crm_usb_clock_div_set(CRM_USB_DIV_3);
96 break;
97
98 /* 168MHz */
99 case 168000000:
100 crm_usb_clock_div_set(CRM_USB_DIV_3_5);
101 break;
102
103 /* 192MHz */
104 case 192000000:
105 crm_usb_clock_div_set(CRM_USB_DIV_4);
106 break;
107
108 default:
109 break;
110
111 }
112 }
113}
114
120int main(void)
121{
122 uint16_t data_len;
123
124 uint32_t timeout;
125
126 uint8_t send_zero_packet = 0;
127
128 /* config nvic priority group */
129 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
130
131 system_clock_config();
132
133 at32_board_init();
134
135 /* select usb 48m clcok source */
136 usb_clock48m_select(USB_CLK_HEXT);
137
138 /* enable usb clock */
139 crm_periph_clock_enable(CRM_USB_PERIPH_CLOCK, TRUE);
140
141 /* enable usb interrupt */
142 nvic_irq_enable(USBFS_L_CAN1_RX0_IRQn, 0, 0);
143
144 /* usb core init */
145 usbd_core_init(&usb_core_dev, USB, &cdc_class_handler, &cdc_desc_handler, 0);
146
147 /* enable usb pull-up */
148 usbd_connect(&usb_core_dev);
149
150 while(1)
151 {
152 /* get usb vcp receive data */
153 data_len = usb_vcp_get_rxdata(&usb_core_dev, usb_buffer);
154
155 if(data_len > 0 || send_zero_packet == 1)
156 {
157
158 /* bulk transfer is complete when the endpoint does one of the following
159 1 has transferred exactly the amount of data expected
160 2 transfers a packet with a payload size less than wMaxPacketSize or transfers a zero-length packet
161 */
162 if(data_len > 0)
163 send_zero_packet = 1;
164
165 if(data_len == 0)
166 send_zero_packet = 0;
167
168 timeout = 5000000;
169 do
170 {
171 /* send data to host */
172 if(usb_vcp_send_data(&usb_core_dev, usb_buffer, data_len) == SUCCESS)
173 {
174 break;
175 }
176 }while(timeout --);
177 }
178 }
179}
180
181
187void USBFS_L_CAN1_RX0_IRQHandler(void)
188{
189 usbd_irq_handler(&usb_core_dev);
190}
191
197void usb_delay_ms(uint32_t ms)
198{
199 /* user can define self delay function */
200 delay_ms(ms);
201}
202
208void usb_delay_us(uint32_t us)
209{
210 delay_us(us);
211}
212
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
cdc_class.h
usb cdc class file
cdc_desc.h
usb cdc descriptor header file
usb_delay_ms
void usb_delay_ms(uint32_t ms)
usb delay millisecond function.
Definition project/at_start_f413/examples/acc/calibration/src/main.c:244
usb_delay_us
void usb_delay_us(uint32_t us)
usb delay microsecond function.
Definition project/at_start_f413/examples/acc/calibration/src/main.c:255
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
usb_clock48m_select
void usb_clock48m_select(usb_clk48_s clk_s)
usb 48M clock select
Definition project/at_start_f413/examples/usb_device/vcp_loopback/src/main.c:49
main
int main(void)
main function.
Definition project/at_start_f413/examples/usb_device/vcp_loopback/src/main.c:120
USBFS_L_CAN1_RX0_IRQHandler
void USBFS_L_CAN1_RX0_IRQHandler(void)
this function handles usb interrupt.
Definition project/at_start_f413/examples/usb_device/vcp_loopback/src/main.c:187
usb_buffer
uint8_t usb_buffer[256]
Definition project/at_start_f413/examples/usb_device/vcp_loopback/src/main.c:42
usb_core_dev
usbd_core_type usb_core_dev
Definition project/at_start_f413/examples/usb_device/vcp_loopback/src/main.c:41
ACC_CAL_HICKTRIM
#define ACC_CAL_HICKTRIM
Definition at32f413_acc.h:52
acc_write_c2
void acc_write_c2(uint16_t acc_c2_value)
wtire the value to acc c2 register.
Definition at32f413_acc.c:131
acc_write_c3
void acc_write_c3(uint16_t acc_c3_value)
wtire the value to acc c3 register.
Definition at32f413_acc.c:141
acc_write_c1
void acc_write_c1(uint16_t acc_c1_value)
wtire the value to acc c1 register.
Definition at32f413_acc.c:121
acc_calibration_mode_enable
void acc_calibration_mode_enable(uint16_t acc_trim, confirm_state new_state)
enable or disable the acc calibration mode.
Definition at32f413_acc.c:52
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
delay_us
void delay_us(uint32_t nus)
inserts a delay time.
Definition at32f413_board.c:330
crm_usb_clock_div_set
void crm_usb_clock_div_set(crm_usb_div_type div_value)
set crm usb division
Definition at32f413_crm.c:533
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_usb_clock_source_select
void crm_usb_clock_source_select(crm_usb_clock_source_type value)
usb 48 mhz clock source select
Definition at32f413_crm.c:854
crm_clocks_freq_get
void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
Definition at32f413_crm.c:660
CRM_USB_PERIPH_CLOCK
@ CRM_USB_PERIPH_CLOCK
Definition at32f413_crm.h:137
CRM_ACC_PERIPH_CLOCK
@ CRM_ACC_PERIPH_CLOCK
Definition at32f413_crm.h:123
CRM_USB_DIV_3
@ CRM_USB_DIV_3
Definition at32f413_crm.h:363
CRM_USB_DIV_1_5
@ CRM_USB_DIV_1_5
Definition at32f413_crm.h:358
CRM_USB_DIV_4
@ CRM_USB_DIV_4
Definition at32f413_crm.h:364
CRM_USB_DIV_3_5
@ CRM_USB_DIV_3_5
Definition at32f413_crm.h:362
CRM_USB_DIV_2
@ CRM_USB_DIV_2
Definition at32f413_crm.h:361
CRM_USB_DIV_1
@ CRM_USB_DIV_1
Definition at32f413_crm.h:359
CRM_USB_DIV_2_5
@ CRM_USB_DIV_2_5
Definition at32f413_crm.h:360
CRM_USB_CLOCK_SOURCE_HICK
@ CRM_USB_CLOCK_SOURCE_HICK
Definition at32f413_crm.h:454
USBFS_L_CAN1_RX0_IRQn
@ USBFS_L_CAN1_RX0_IRQn
Definition at32f413.h:192
SUCCESS
@ SUCCESS
Definition at32f413.h:302
TRUE
@ TRUE
Definition at32f413.h:297
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
usb_vcp_get_rxdata
uint16_t usb_vcp_get_rxdata(void *udev, uint8_t *recv_data)
usb device class rx data process
Definition cdc_class.c:344
usb_vcp_send_data
error_status usb_vcp_send_data(void *udev, uint8_t *send_data, uint16_t len)
usb device class send data
Definition cdc_class.c:374
cdc_class_handler
usbd_class_handler cdc_class_handler
Definition cdc_class.c:68
cdc_desc_handler
usbd_desc_handler cdc_desc_handler
device descriptor handler structure
Definition cdc_desc.c:65
usb_clk48_s
usb_clk48_s
usb clock select
Definition at32f413_usb.h:230
USB_CLK_HEXT
@ USB_CLK_HEXT
Definition at32f413_usb.h:232
USB_CLK_HICK
@ USB_CLK_HICK
Definition at32f413_usb.h:231
usbd_core_init
void usbd_core_init(usbd_core_type *udev, usb_reg_type *usb_reg, usbd_class_handler *dev_handler, usbd_desc_handler *desc_handler, uint8_t core_id)
initializes the usb core
Definition usbd_core.c:675
usbd_connect
void usbd_connect(usbd_core_type *udev)
usb device connect to host
Definition usbd_core.c:564
usbd_irq_handler
void usbd_irq_handler(usbd_core_type *udev)
usb device interrput request handler.
Definition usbd_int.c:45
USB
#define USB
Definition at32f413_usb.h:665
at32f413_clock.h
header file of clock program
crm_clocks_freq_type
crm clocks freqency structure
Definition at32f413_crm.h:470
crm_clocks_freq_type::sclk_freq
uint32_t sclk_freq
Definition at32f413_crm.h:471
usbd_core_type
usb device core struct type
Definition usbd_core.h:114
usbd_core.h
usb device core header file
usbd_int.h


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • usb_device
  • virtual_comport
  • inc
project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • usb_device
  • virtual_comport
  • inc
project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • usb_device
  • virtual_comport
  • inc
project/at_start_f413/examples/usb_device/virtual_comport/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: usb_conf.h Source File

  • usb_device
  • virtual_comport
  • inc
project/at_start_f413/examples/usb_device/virtual_comport/inc/usb_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __USB_CONF_H
28#define __USB_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "at32f413.h"
35#include "at32f413_board.h"
36#include "stdio.h"
37
49#ifndef USB_EPT_MAX_NUM
50#define USB_EPT_MAX_NUM 8
51#endif
52
56//#define USB_BUFFER_SIZE_EX /*!< usb enable extend buffer */
57
58
62//#define USB_EPT_AUTO_MALLOC_BUFFER /*!< usb auto malloc endpoint tx and rx buffer */
63
67#define USB_VIRTUAL_COMPORT
68
69#ifndef USB_EPT_AUTO_MALLOC_BUFFER
75/* ept0 tx start address 0x40, size 0x40,
76 so rx start address is 0x40 + 0x40 = 0x80 */
77#define EPT0_TX_ADDR 0x40
78#define EPT0_RX_ADDR 0x80
80#define EPT1_TX_ADDR 0xC0
81#define EPT1_RX_ADDR 0x100
83#define EPT2_TX_ADDR 0x140
84#define EPT2_RX_ADDR 0x180
86#define EPT3_TX_ADDR 0x00
87#define EPT3_RX_ADDR 0x00
89#define EPT4_TX_ADDR 0x00
90#define EPT4_RX_ADDR 0x00
92#define EPT5_TX_ADDR 0x00
93#define EPT5_RX_ADDR 0x00
95#define EPT6_TX_ADDR 0x00
96#define EPT6_RX_ADDR 0x00
98#define EPT7_TX_ADDR 0x00
99#define EPT7_RX_ADDR 0x00
101#endif
102
103void usb_delay_ms(uint32_t ms);
104void usb_delay_us(uint32_t us);
105
114#ifdef __cplusplus
115}
116#endif
117
118#endif
119
at32f413.h
at32f413 header file
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
usb_delay_ms
void usb_delay_ms(uint32_t ms)
usb delay millisecond function.
Definition project/at_start_f413/examples/acc/calibration/src/main.c:244
usb_delay_us
void usb_delay_us(uint32_t us)
usb delay microsecond function.
Definition project/at_start_f413/examples/acc/calibration/src/main.c:255


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • usb_device
  • virtual_comport
  • src
project/at_start_f413/examples/usb_device/virtual_comport/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/usb_device/virtual_comport/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • usb_device
  • virtual_comport
  • src
project/at_start_f413/examples/usb_device/virtual_comport/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/usb_device/virtual_comport/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/usb_device/virtual_comport/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/usb_device/virtual_comport/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/usb_device/virtual_comport/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/usb_device/virtual_comport/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/usb_device/virtual_comport/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/usb_device/virtual_comport/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/usb_device/virtual_comport/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/usb_device/virtual_comport/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • usb_device
  • virtual_comport
  • src
project/at_start_f413/examples/usb_device/virtual_comport/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include "usbd_core.h"
29#include "cdc_class.h"
30#include "cdc_desc.h"
31#include "usbd_int.h"
32
41 usbd_core_type usb_core_dev;
42uint8_t usb_buffer[256];
43
44/* usart global struct define */
45extern linecoding_type linecoding;
46void usb_usart_config(linecoding_type linecoding);
47void usart_gpio_config(void);
48#define usart_buffer_size 2048
49uint8_t usart_rx_buffer[usart_buffer_size];
50uint16_t hw_usart_rx_index = 0;
51uint16_t hw_usart_read_index = 0;
52uint16_t usart_rx_data_len = 0;
53uint16_t ov_cnt = 0;
54void usart_send_data(uint8_t *send_data, uint16_t len);
55uint16_t usart_receive_data(void);
56
62void usb_clock48m_select(usb_clk48_s clk_s)
63{
64 crm_clocks_freq_type clocks_struct;
65
66 if(clk_s == USB_CLK_HICK)
67 {
68 crm_usb_clock_source_select(CRM_USB_CLOCK_SOURCE_HICK);
69
70 /* enable the acc calibration ready interrupt */
71 crm_periph_clock_enable(CRM_ACC_PERIPH_CLOCK, TRUE);
72
73 /* update the c1\c2\c3 value */
74 acc_write_c1(7980);
75 acc_write_c2(8000);
76 acc_write_c3(8020);
77
78 /* open acc calibration */
79 acc_calibration_mode_enable(ACC_CAL_HICKTRIM, TRUE);
80 }
81 else
82 {
83 crm_clocks_freq_get(&clocks_struct);
84 switch(clocks_struct.sclk_freq)
85 {
86 /* 48MHz */
87 case 48000000:
88 crm_usb_clock_div_set(CRM_USB_DIV_1);
89 break;
90
91 /* 72MHz */
92 case 72000000:
93 crm_usb_clock_div_set(CRM_USB_DIV_1_5);
94 break;
95
96 /* 96MHz */
97 case 96000000:
98 crm_usb_clock_div_set(CRM_USB_DIV_2);
99 break;
100
101 /* 120MHz */
102 case 120000000:
103 crm_usb_clock_div_set(CRM_USB_DIV_2_5);
104 break;
105
106 /* 144MHz */
107 case 144000000:
108 crm_usb_clock_div_set(CRM_USB_DIV_3);
109 break;
110
111 /* 168MHz */
112 case 168000000:
113 crm_usb_clock_div_set(CRM_USB_DIV_3_5);
114 break;
115
116 /* 192MHz */
117 case 192000000:
118 crm_usb_clock_div_set(CRM_USB_DIV_4);
119 break;
120
121 default:
122 break;
123
124 }
125 }
126}
127
133int main(void)
134{
135 uint16_t data_len;
136
137 uint32_t timeout;
138
139 uint8_t send_zero_packet = 0;
140
141 /* config nvic priority group */
142 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
143
144 system_clock_config();
145
146 at32_board_init();
147
148 /* usart gpio config */
149 usart_gpio_config();
150
151 /* hardware usart config: usart2 */
152 usb_usart_config(linecoding);
153
154 /* select usb 48m clcok source */
155 usb_clock48m_select(USB_CLK_HEXT);
156
157 /* enable usb clock */
158 crm_periph_clock_enable(CRM_USB_PERIPH_CLOCK, TRUE);
159
160 /* enable usb interrupt */
161 nvic_irq_enable(USBFS_L_CAN1_RX0_IRQn, 0, 0);
162
163 /* usb core init */
164 usbd_core_init(&usb_core_dev, USB, &cdc_class_handler, &cdc_desc_handler, 0);
165
166 /* enable usb pull-up */
167 usbd_connect(&usb_core_dev);
168
169 while(1)
170 {
171 /* get usb vcp receive data */
172 data_len = usb_vcp_get_rxdata(&usb_core_dev, usb_buffer);
173
174 /* send data to hardware usart */
175 if(data_len > 0)
176 {
177 usart_send_data(usb_buffer, data_len);
178 }
179
180 /* if hardware usart received data,usb send data to host */
181 usart_rx_data_len = usart_receive_data();
182 if(usart_rx_data_len || send_zero_packet == 1)
183 {
184 if(usart_rx_data_len > 0)
185 send_zero_packet = 1;
186
187 if(usart_rx_data_len == 0)
188 send_zero_packet = 0;
189
190 timeout = 50000;
191
192 if((hw_usart_read_index + usart_rx_data_len) < usart_buffer_size)
193 {
194 do
195 {
196 /* send data to host */
197 if(usb_vcp_send_data(&usb_core_dev, &usart_rx_buffer[hw_usart_read_index], usart_rx_data_len) == SUCCESS)
198 {
199 hw_usart_read_index = hw_usart_read_index + usart_rx_data_len;
200
201 break;
202 }
203 }while(timeout --);
204
205 }
206 /* process the fifo overflow */
207 else
208 {
209 do
210 {
211 /* send data to host */
212 if(usb_vcp_send_data(&usb_core_dev, &usart_rx_buffer[hw_usart_read_index], usart_buffer_size - hw_usart_read_index) == SUCCESS)
213 {
214 /* get fifo overflow data count */
215 ov_cnt = usart_rx_data_len - (usart_buffer_size - hw_usart_read_index);
216 hw_usart_read_index = 0;
217 break;
218 }
219 }while(timeout --);
220 timeout = 50000;
221 do
222 {
223 /* send data to host */
224 if(usb_vcp_send_data(&usb_core_dev, &usart_rx_buffer[hw_usart_read_index], ov_cnt) == SUCCESS)
225 {
226 hw_usart_read_index = ov_cnt;
227 break;
228 }
229 }while(timeout --);
230 }
231 }
232 }
233}
234
241void usart_send_data(uint8_t *send_data, uint16_t len)
242{
243 uint16_t index = 0;
244 for(index = 0; index < len; index++ )
245 {
246 do
247 {
248 ;
249 }while(usart_flag_get(USART2, USART_TDBE_FLAG) == RESET);
250
251 usart_data_transmit(USART2, send_data[index]);
252 }
253}
254
260uint16_t usart_receive_data(void)
261{
262 uint16_t usart_data_len;
263 if(hw_usart_read_index == hw_usart_rx_index)
264 {
265 usart_data_len = 0;
266 }
267 else
268 {
269 /* whether to process the fifo overflow or not */
270 if(hw_usart_rx_index > hw_usart_read_index)
271 usart_data_len = hw_usart_rx_index - hw_usart_read_index;
272 else if(hw_usart_rx_index == 0 && hw_usart_rx_index != hw_usart_read_index)
273 usart_data_len = usart_buffer_size - hw_usart_read_index;
274 else
275 usart_data_len = (usart_buffer_size-1) + hw_usart_rx_index - hw_usart_read_index;
276 }
277
278 return usart_data_len;
279}
280
286void USART2_IRQHandler(void)
287{
288 if(usart_flag_get(USART2, USART_RDBF_FLAG) != RESET)
289 {
290 /* read one byte from the receive data register */
291 usart_rx_buffer[hw_usart_rx_index] = usart_data_receive(USART2);
292 hw_usart_rx_index = ( (hw_usart_rx_index+1) & (usart_buffer_size-1) );
293 }
294}
295
301void usb_usart_config( linecoding_type linecoding)
302{
303 usart_stop_bit_num_type usart_stop_bit;
304 usart_data_bit_num_type usart_data_bit;
305 usart_parity_selection_type usart_parity_select;
306
307 /* enable the usart2 and gpio clock */
308 crm_periph_clock_enable(CRM_USART2_PERIPH_CLOCK, FALSE);
309 crm_periph_clock_enable(CRM_USART2_PERIPH_CLOCK, TRUE);
310
311 /* stop bit */
312 switch(linecoding.format)
313 {
314 case 0x0:
315 usart_stop_bit = USART_STOP_1_BIT;
316 break;
317 /* to be used when transmitting and receiving data in smartcard mode */
318 case 0x1:
319 usart_stop_bit = USART_STOP_1_5_BIT;
320 break;
321 case 0x2:
322 usart_stop_bit = USART_STOP_2_BIT;
323 break;
324 default :
325 break;
326 }
327
328 /* parity */
329 switch(linecoding.parity)
330 {
331 case 0x0:
332 usart_parity_select = USART_PARITY_NONE;
333 break;
334 case 0x1:
335 usart_parity_select = USART_PARITY_ODD;
336 break;
337 case 0x2:
338 usart_parity_select = USART_PARITY_EVEN;
339 break;
340 /* hardware usart not support parity for mark and space */
341 case 0x3:
342 case 0x4:
343 break;
344 default :
345 break;
346 }
347
348 if(USART_PARITY_NONE == usart_parity_select)
349 {
350 /* data bits */
351 switch(linecoding.data)
352 {
353 /* hardware usart not support data bits for 5/6 */
354 case 0x5:
355 case 0x6:
356 case 0x7:
357 break;
358 case 0x8:
359 usart_data_bit = USART_DATA_8BITS;
360 break;
361 /* hardware usart not support data bits for 16 */
362 case 0x10:
363 break;
364 default :
365 break;
366 }
367 }
368 else
369 {
370 /* data bits */
371 switch(linecoding.data)
372 {
373 /* hardware usart not support data bits for 5/6 */
374 case 0x5:
375 case 0x6:
376 break;
377 case 0x7:
378 usart_data_bit = USART_DATA_8BITS;
379 break;
380 case 0x8:
381 usart_data_bit = USART_DATA_9BITS;
382 break;
383 /* hardware usart not support data bits for 16 */
384 case 0x10:
385 break;
386 default :
387 break;
388 }
389 }
390
391 nvic_irq_enable(USART2_IRQn, 0, 0);
392
393 /* configure usart2 param */
394 usart_init(USART2, linecoding.bitrate, usart_data_bit, usart_stop_bit);
395 usart_parity_selection_config(USART2, usart_parity_select);
396 usart_transmitter_enable(USART2, TRUE);
397 usart_receiver_enable(USART2, TRUE);
398
399 /* enable usart2 interrupt */
400 usart_interrupt_enable(USART2, USART_RDBF_INT, TRUE);
401 usart_enable(USART2, TRUE);
402}
403
409void usart_gpio_config(void)
410{
411 gpio_init_type gpio_init_struct;
412 crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
413
414 /* configure the usart2 tx pin */
415 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
416 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
417 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
418 gpio_init_struct.gpio_pins = GPIO_PINS_2;
419 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
420 gpio_init(GPIOA, &gpio_init_struct);
421
422 /* configure the usart2 rx pin */
423 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
424 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
425 gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
426 gpio_init_struct.gpio_pins = GPIO_PINS_3;
427 gpio_init_struct.gpio_pull = GPIO_PULL_UP;
428 gpio_init(GPIOA, &gpio_init_struct);
429}
430
436void USBFS_L_CAN1_RX0_IRQHandler(void)
437{
438 usbd_irq_handler(&usb_core_dev);
439}
440
446void usb_delay_ms(uint32_t ms)
447{
448 /* user can define self delay function */
449 delay_ms(ms);
450}
451
457void usb_delay_us(uint32_t us)
458{
459 delay_us(us);
460}
461
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
cdc_class.h
usb cdc class file
cdc_desc.h
usb cdc descriptor header file
usb_clock48m_select
void usb_clock48m_select(usb_clk48_s clk_s)
usb 48M clock select
Definition project/at_start_f413/examples/acc/calibration/src/main.c:67
main
int main(void)
main function.
Definition project/at_start_f413/examples/acc/calibration/src/main.c:265
USBFS_L_CAN1_RX0_IRQHandler
void USBFS_L_CAN1_RX0_IRQHandler(void)
usbfs_l_can1_rx0 interrupt handler
Definition project/at_start_f413/examples/acc/calibration/src/main.c:124
usb_delay_ms
void usb_delay_ms(uint32_t ms)
usb delay millisecond function.
Definition project/at_start_f413/examples/acc/calibration/src/main.c:244
usb_delay_us
void usb_delay_us(uint32_t us)
usb delay microsecond function.
Definition project/at_start_f413/examples/acc/calibration/src/main.c:255
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
usart_buffer_size
#define usart_buffer_size
Definition project/at_start_f413/examples/usb_device/virtual_comport/src/main.c:48
USART2_IRQHandler
void USART2_IRQHandler(void)
this function handles usart2 handler.
Definition project/at_start_f413/examples/usb_device/virtual_comport/src/main.c:286
hw_usart_read_index
uint16_t hw_usart_read_index
Definition project/at_start_f413/examples/usb_device/virtual_comport/src/main.c:51
usb_usart_config
void usb_usart_config(linecoding_type linecoding)
this function handles usart2 and linecoding config.
Definition project/at_start_f413/examples/usb_device/virtual_comport/src/main.c:301
usart_rx_data_len
uint16_t usart_rx_data_len
Definition project/at_start_f413/examples/usb_device/virtual_comport/src/main.c:52
linecoding
linecoding_type linecoding
Definition cdc_class.c:56
ov_cnt
uint16_t ov_cnt
Definition project/at_start_f413/examples/usb_device/virtual_comport/src/main.c:53
usart_gpio_config
void usart_gpio_config(void)
this function handles usart2 gpio config.
Definition project/at_start_f413/examples/usb_device/virtual_comport/src/main.c:409
usart_rx_buffer
uint8_t usart_rx_buffer[2048]
Definition project/at_start_f413/examples/usb_device/virtual_comport/src/main.c:49
usart_send_data
void usart_send_data(uint8_t *send_data, uint16_t len)
this function handles usart2 send data.
Definition project/at_start_f413/examples/usb_device/virtual_comport/src/main.c:241
usb_buffer
uint8_t usb_buffer[256]
Definition project/at_start_f413/examples/usb_device/virtual_comport/src/main.c:42
usart_receive_data
uint16_t usart_receive_data(void)
this function handles usart2 receive data.
Definition project/at_start_f413/examples/usb_device/virtual_comport/src/main.c:260
usb_core_dev
usbd_core_type usb_core_dev
Definition project/at_start_f413/examples/usb_device/virtual_comport/src/main.c:41
hw_usart_rx_index
uint16_t hw_usart_rx_index
Definition project/at_start_f413/examples/usb_device/virtual_comport/src/main.c:50
ACC_CAL_HICKTRIM
#define ACC_CAL_HICKTRIM
Definition at32f413_acc.h:52
acc_write_c2
void acc_write_c2(uint16_t acc_c2_value)
wtire the value to acc c2 register.
Definition at32f413_acc.c:131
acc_write_c3
void acc_write_c3(uint16_t acc_c3_value)
wtire the value to acc c3 register.
Definition at32f413_acc.c:141
acc_write_c1
void acc_write_c1(uint16_t acc_c1_value)
wtire the value to acc c1 register.
Definition at32f413_acc.c:121
acc_calibration_mode_enable
void acc_calibration_mode_enable(uint16_t acc_trim, confirm_state new_state)
enable or disable the acc calibration mode.
Definition at32f413_acc.c:52
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
delay_us
void delay_us(uint32_t nus)
inserts a delay time.
Definition at32f413_board.c:330
crm_usb_clock_div_set
void crm_usb_clock_div_set(crm_usb_div_type div_value)
set crm usb division
Definition at32f413_crm.c:533
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_usb_clock_source_select
void crm_usb_clock_source_select(crm_usb_clock_source_type value)
usb 48 mhz clock source select
Definition at32f413_crm.c:854
crm_clocks_freq_get
void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
Definition at32f413_crm.c:660
CRM_USB_PERIPH_CLOCK
@ CRM_USB_PERIPH_CLOCK
Definition at32f413_crm.h:137
CRM_GPIOA_PERIPH_CLOCK
@ CRM_GPIOA_PERIPH_CLOCK
Definition at32f413_crm.h:109
CRM_ACC_PERIPH_CLOCK
@ CRM_ACC_PERIPH_CLOCK
Definition at32f413_crm.h:123
CRM_USART2_PERIPH_CLOCK
@ CRM_USART2_PERIPH_CLOCK
Definition at32f413_crm.h:131
CRM_USB_DIV_3
@ CRM_USB_DIV_3
Definition at32f413_crm.h:363
CRM_USB_DIV_1_5
@ CRM_USB_DIV_1_5
Definition at32f413_crm.h:358
CRM_USB_DIV_4
@ CRM_USB_DIV_4
Definition at32f413_crm.h:364
CRM_USB_DIV_3_5
@ CRM_USB_DIV_3_5
Definition at32f413_crm.h:362
CRM_USB_DIV_2
@ CRM_USB_DIV_2
Definition at32f413_crm.h:361
CRM_USB_DIV_1
@ CRM_USB_DIV_1
Definition at32f413_crm.h:359
CRM_USB_DIV_2_5
@ CRM_USB_DIV_2_5
Definition at32f413_crm.h:360
CRM_USB_CLOCK_SOURCE_HICK
@ CRM_USB_CLOCK_SOURCE_HICK
Definition at32f413_crm.h:454
USART2_IRQn
@ USART2_IRQn
Definition at32f413.h:210
USBFS_L_CAN1_RX0_IRQn
@ USBFS_L_CAN1_RX0_IRQn
Definition at32f413.h:192
SUCCESS
@ SUCCESS
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_PULL_UP
@ GPIO_PULL_UP
Definition at32f413_gpio.h:244
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_2
#define GPIO_PINS_2
Definition at32f413_gpio.h:52
GPIO_PINS_3
#define GPIO_PINS_3
Definition at32f413_gpio.h:53
GPIOA
#define GPIOA
Definition at32f413_gpio.h:747
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
usart_data_transmit
void usart_data_transmit(usart_type *usart_x, uint16_t data)
transmit single data through the usart peripheral.
Definition at32f413_usart.c:380
usart_parity_selection_config
void usart_parity_selection_config(usart_type *usart_x, usart_parity_selection_type parity)
usart parity selection config.
Definition at32f413_usart.c:144
usart_flag_get
flag_status usart_flag_get(usart_type *usart_x, uint32_t flag)
check whether the specified usart flag is set or not.
Definition at32f413_usart.c:565
usart_transmitter_enable
void usart_transmitter_enable(usart_type *usart_x, confirm_state new_state)
usart transmitter enable.
Definition at32f413_usart.c:185
usart_init
void usart_init(usart_type *usart_x, uint32_t baud_rate, usart_data_bit_num_type data_bit, usart_stop_bit_num_type stop_bit)
initialize the usart peripheral according to the specified parameters.
Definition at32f413_usart.c:105
usart_enable
void usart_enable(usart_type *usart_x, confirm_state new_state)
enable or disable the specified usart peripheral.
Definition at32f413_usart.c:172
usart_receiver_enable
void usart_receiver_enable(usart_type *usart_x, confirm_state new_state)
usart receiver enable.
Definition at32f413_usart.c:198
usart_interrupt_enable
void usart_interrupt_enable(usart_type *usart_x, uint32_t usart_int, confirm_state new_state)
enable or disable the specified usart interrupts.
Definition at32f413_usart.c:263
usart_data_receive
uint16_t usart_data_receive(usart_type *usart_x)
return the most recent received data by the usart peripheral.
Definition at32f413_usart.c:392
usart_stop_bit_num_type
usart_stop_bit_num_type
usart stop bit num type
Definition at32f413_usart.h:156
usart_data_bit_num_type
usart_data_bit_num_type
usart data bit num type
Definition at32f413_usart.h:111
usart_parity_selection_type
usart_parity_selection_type
usart parity selection type
Definition at32f413_usart.h:92
USART_STOP_1_5_BIT
@ USART_STOP_1_5_BIT
Definition at32f413_usart.h:160
USART_STOP_1_BIT
@ USART_STOP_1_BIT
Definition at32f413_usart.h:157
USART_STOP_2_BIT
@ USART_STOP_2_BIT
Definition at32f413_usart.h:159
USART_DATA_9BITS
@ USART_DATA_9BITS
Definition at32f413_usart.h:113
USART_DATA_8BITS
@ USART_DATA_8BITS
Definition at32f413_usart.h:112
USART_PARITY_ODD
@ USART_PARITY_ODD
Definition at32f413_usart.h:95
USART_PARITY_EVEN
@ USART_PARITY_EVEN
Definition at32f413_usart.h:94
USART_PARITY_NONE
@ USART_PARITY_NONE
Definition at32f413_usart.h:93
USART_TDBE_FLAG
#define USART_TDBE_FLAG
Definition at32f413_usart.h:58
USART_RDBF_FLAG
#define USART_RDBF_FLAG
Definition at32f413_usart.h:56
USART_RDBF_INT
#define USART_RDBF_INT
Definition at32f413_usart.h:72
USART2
#define USART2
Definition at32f413_usart.h:319
usb_vcp_get_rxdata
uint16_t usb_vcp_get_rxdata(void *udev, uint8_t *recv_data)
usb device class rx data process
Definition cdc_class.c:344
usb_vcp_send_data
error_status usb_vcp_send_data(void *udev, uint8_t *send_data, uint16_t len)
usb device class send data
Definition cdc_class.c:374
cdc_class_handler
usbd_class_handler cdc_class_handler
Definition cdc_class.c:68
cdc_desc_handler
usbd_desc_handler cdc_desc_handler
device descriptor handler structure
Definition cdc_desc.c:65
usb_clk48_s
usb_clk48_s
usb clock select
Definition at32f413_usb.h:230
USB_CLK_HEXT
@ USB_CLK_HEXT
Definition at32f413_usb.h:232
USB_CLK_HICK
@ USB_CLK_HICK
Definition at32f413_usb.h:231
usbd_core_init
void usbd_core_init(usbd_core_type *udev, usb_reg_type *usb_reg, usbd_class_handler *dev_handler, usbd_desc_handler *desc_handler, uint8_t core_id)
initializes the usb core
Definition usbd_core.c:675
usbd_connect
void usbd_connect(usbd_core_type *udev)
usb device connect to host
Definition usbd_core.c:564
usbd_irq_handler
void usbd_irq_handler(usbd_core_type *udev)
usb device interrput request handler.
Definition usbd_int.c:45
USB
#define USB
Definition at32f413_usb.h:665
at32f413_clock.h
header file of clock program
crm_clocks_freq_type
crm clocks freqency structure
Definition at32f413_crm.h:470
crm_clocks_freq_type::sclk_freq
uint32_t sclk_freq
Definition at32f413_crm.h:471
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
linecoding_type
usb cdc class set line coding struct
Definition usb_std.h:219
linecoding_type::bitrate
uint32_t bitrate
Definition usb_std.h:220
linecoding_type::data
uint8_t data
Definition usb_std.h:223
linecoding_type::parity
uint8_t parity
Definition usb_std.h:222
linecoding_type::format
uint8_t format
Definition usb_std.h:221
usbd_core_type
usb device core struct type
Definition usbd_core.h:114
usbd_core.h
usb device core header file
usbd_int.h


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • usb_device
  • virtual_msc_iap
  • inc
project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • usb_device
  • virtual_msc_iap
  • inc
project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • usb_device
  • virtual_msc_iap
  • inc
project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: usb_conf.h Source File

  • usb_device
  • virtual_msc_iap
  • inc
project/at_start_f413/examples/usb_device/virtual_msc_iap/inc/usb_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __USB_CONF_H
28#define __USB_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "at32f413.h"
35#include "at32f413_board.h"
36#include "stdio.h"
37
49#ifndef USB_EPT_MAX_NUM
50#define USB_EPT_MAX_NUM 8
51#endif
52
56//#define USB_BUFFER_SIZE_EX /*!< usb enable extend buffer */
57
58
62#define USB_EPT_AUTO_MALLOC_BUFFER
65#ifndef USB_EPT_AUTO_MALLOC_BUFFER
71/* ept0 tx start address 0x40, size 0x40,
72 so rx start address is 0x40 + 0x40 = 0x80 */
73#define EPT0_TX_ADDR 0x40
74#define EPT0_RX_ADDR 0x80
76#define EPT1_TX_ADDR 0xC0
77#define EPT1_RX_ADDR 0x100
79#define EPT2_TX_ADDR 0x140
80#define EPT2_RX_ADDR 0x180
82#define EPT3_TX_ADDR 0x00
83#define EPT3_RX_ADDR 0x00
85#define EPT4_TX_ADDR 0x00
86#define EPT4_RX_ADDR 0x00
88#define EPT5_TX_ADDR 0x00
89#define EPT5_RX_ADDR 0x00
91#define EPT6_TX_ADDR 0x00
92#define EPT6_RX_ADDR 0x00
94#define EPT7_TX_ADDR 0x00
95#define EPT7_RX_ADDR 0x00
97#endif
98
99void usb_delay_ms(uint32_t ms);
100void usb_delay_us(uint32_t us);
101
110#ifdef __cplusplus
111}
112#endif
113
114#endif
115
at32f413.h
at32f413 header file
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
usb_delay_ms
void usb_delay_ms(uint32_t ms)
usb delay millisecond function.
Definition project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c:281
usb_delay_us
void usb_delay_us(uint32_t us)
usb delay microsecond function.
Definition project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c:292


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • usb_device
  • virtual_msc_iap
  • src
project/at_start_f413/examples/usb_device/virtual_msc_iap/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/usb_device/virtual_msc_iap/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • usb_device
  • virtual_msc_iap
  • src
project/at_start_f413/examples/usb_device/virtual_msc_iap/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/usb_device/virtual_msc_iap/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/usb_device/virtual_msc_iap/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/usb_device/virtual_msc_iap/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/usb_device/virtual_msc_iap/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/usb_device/virtual_msc_iap/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/usb_device/virtual_msc_iap/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/usb_device/virtual_msc_iap/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/usb_device/virtual_msc_iap/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/usb_device/virtual_msc_iap/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • usb_device
  • virtual_msc_iap
  • src
project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include "usbd_core.h"
29#include "msc_class.h"
30#include "msc_desc.h"
31#include "usbd_int.h"
32#include "flash_fat16.h"
33
42 usbd_core_type usb_core_dev;
43
44void (*pftarget)(void);
45
46void jump_to_app(uint32_t address);
47uint32_t stkptr, jumpaddr;
48
49
55void usb_clock48m_select(usb_clk48_s clk_s)
56{
57 crm_clocks_freq_type clocks_struct;
58
59 if(clk_s == USB_CLK_HICK)
60 {
61 crm_usb_clock_source_select(CRM_USB_CLOCK_SOURCE_HICK);
62
63 /* enable the acc calibration ready interrupt */
64 crm_periph_clock_enable(CRM_ACC_PERIPH_CLOCK, TRUE);
65
66 /* update the c1\c2\c3 value */
67 acc_write_c1(7980);
68 acc_write_c2(8000);
69 acc_write_c3(8020);
70
71 /* open acc calibration */
72 acc_calibration_mode_enable(ACC_CAL_HICKTRIM, TRUE);
73 }
74 else
75 {
76 crm_clocks_freq_get(&clocks_struct);
77 switch(clocks_struct.sclk_freq)
78 {
79 /* 48MHz */
80 case 48000000:
81 crm_usb_clock_div_set(CRM_USB_DIV_1);
82 break;
83
84 /* 72MHz */
85 case 72000000:
86 crm_usb_clock_div_set(CRM_USB_DIV_1_5);
87 break;
88
89 /* 96MHz */
90 case 96000000:
91 crm_usb_clock_div_set(CRM_USB_DIV_2);
92 break;
93
94 /* 120MHz */
95 case 120000000:
96 crm_usb_clock_div_set(CRM_USB_DIV_2_5);
97 break;
98
99 /* 144MHz */
100 case 144000000:
101 crm_usb_clock_div_set(CRM_USB_DIV_3);
102 break;
103
104 /* 168MHz */
105 case 168000000:
106 crm_usb_clock_div_set(CRM_USB_DIV_3_5);
107 break;
108
109 /* 192MHz */
110 case 192000000:
111 crm_usb_clock_div_set(CRM_USB_DIV_4);
112 break;
113
114 default:
115 break;
116
117 }
118 }
119}
120
126int main(void)
127{
128 /* config nvic priority group */
129 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
130
131 system_clock_config();
132
133 flash_fat16_init();
134
135 at32_board_init();
136
137 if(flash_fat16_get_upgrade_flag() == IAP_SUCCESS &&
138 (at32_button_press() == NO_BUTTON))
139 {
140 jump_to_app(flash_iap.flash_app_addr);
141 }
142
143 /* select usb 48m clcok source */
144 usb_clock48m_select(USB_CLK_HEXT);
145
146 /* enable usb clock */
147 crm_periph_clock_enable(CRM_USB_PERIPH_CLOCK, TRUE);
148
149 /* enable usb interrupt */
150 nvic_irq_enable(USBFS_L_CAN1_RX0_IRQn, 0, 0);
151
152 /* usb core init */
153 usbd_core_init(&usb_core_dev, USB, &msc_class_handler, &msc_desc_handler, 0);
154
155 /* enable usb pull-up */
156 usbd_connect(&usb_core_dev);
157
158 while(1)
159 {
160 flash_fat16_loop_status();
161 }
162}
163
169void usb_reset()
170{
171 delay_ms(1000);
172 usbd_disconnect(&usb_core_dev);
173 delay_ms(1000);
174 usbd_connect(&usb_core_dev);
175}
176
182void flash_fat16_loop_status(void)
183{
184 static uint8_t status = UPGRADE_READY;
185 if(status == flash_iap.msc_up_status)
186 {
187 return;
188 }
189 else
190 {
191 status = flash_iap.msc_up_status;
192 }
193
194 switch(flash_iap.msc_up_status)
195 {
196 case UPGRADE_READY:
197 flash_fat16_set_name((const uint8_t *)"Ready", 5);
198 break;
199 case UPGRAGE_ONGOING:
200 break;
201 case UPGRADE_SUCCESS:
202 flash_fat16_set_name((const uint8_t *)"Success", 7);
203 flash_iap.msc_up_status = UPGRADE_DONE;
204 usb_reset();
205 break;
206 case UPGRADE_FAILED:
207 flash_fat16_set_name((const uint8_t *)"Failed", 6);
208 flash_iap.msc_up_status = UPGRADE_DONE;
209 usb_reset();
210 break;
211 case UPGRADE_LARGE:
212 flash_fat16_set_name((const uint8_t *)"Large", 5);
213 flash_iap.msc_up_status = UPGRADE_DONE;
214 usb_reset();
215 break;
216 case UPGRADE_UNKNOWN:
217 flash_fat16_set_name((const uint8_t *)"Unkown", 6);
218 break;
219 case UPGRADE_DONE:
220 break;
221 case UPGRADE_JUMP:
222 flash_fat16_set_name((const uint8_t *)"Jump", 6);
223 delay_ms(1000);
224 jump_to_app(flash_iap.write_addr);
225 break;
226 default:
227 break;
228 }
229
230}
231
232/* app_load don't optimize */
233#if defined (__ARMCC_VERSION)
234 #if (__ARMCC_VERSION >= 6010050)
235 __attribute__((optnone))
236 #else
237 #pragma O0
238 #endif
239#elif defined (__ICCARM__)
240 #pragma optimize=s none
241#elif defined (__GNUC__)
242 __attribute__((optimize("O0")))
243#endif
249void jump_to_app(uint32_t address)
250{
251 stkptr = *(uint32_t *)address;
252 jumpaddr = *(uint32_t *)(address + sizeof(uint32_t));
253
254 /* clear usb crm */
255 crm_periph_clock_enable(CRM_USB_PERIPH_CLOCK, FALSE);
256 crm_periph_clock_enable(CRM_USB_PERIPH_CLOCK, FALSE);
257
258 crm_periph_reset(CRM_USB_PERIPH_RESET, TRUE);
259 crm_periph_reset(CRM_USB_PERIPH_RESET, FALSE);
260
261 __set_MSP(stkptr);
262 pftarget = (void (*) (void))jumpaddr;
263 pftarget();
264}
265
271void USBFS_L_CAN1_RX0_IRQHandler(void)
272{
273 usbd_irq_handler(&usb_core_dev);
274}
275
281void usb_delay_ms(uint32_t ms)
282{
283 /* user can define self delay function */
284 delay_ms(ms);
285}
286
292void usb_delay_us(uint32_t us)
293{
294 delay_us(us);
295}
296
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
flash_fat16.h
fat16 file system header file
usb_delay_ms
void usb_delay_ms(uint32_t ms)
usb delay millisecond function.
Definition project/at_start_f413/examples/acc/calibration/src/main.c:244
usb_delay_us
void usb_delay_us(uint32_t us)
usb delay microsecond function.
Definition project/at_start_f413/examples/acc/calibration/src/main.c:255
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
stkptr
uint32_t stkptr
Definition project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c:47
usb_reset
void usb_reset()
usb re-connect
Definition project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c:169
usb_clock48m_select
void usb_clock48m_select(usb_clk48_s clk_s)
usb 48M clock select
Definition project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c:55
main
int main(void)
main function.
Definition project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c:126
flash_fat16_loop_status
void flash_fat16_loop_status(void)
loop status
Definition project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c:182
USBFS_L_CAN1_RX0_IRQHandler
void USBFS_L_CAN1_RX0_IRQHandler(void)
this function handles usb interrupt.
Definition project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c:271
pftarget
void(* pftarget)(void)
Definition project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c:44
usb_core_dev
usbd_core_type usb_core_dev
Definition project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c:42
jumpaddr
uint32_t jumpaddr
Definition project/at_start_f413/examples/usb_device/virtual_msc_iap/src/main.c:47
ACC_CAL_HICKTRIM
#define ACC_CAL_HICKTRIM
Definition at32f413_acc.h:52
acc_write_c2
void acc_write_c2(uint16_t acc_c2_value)
wtire the value to acc c2 register.
Definition at32f413_acc.c:131
acc_write_c3
void acc_write_c3(uint16_t acc_c3_value)
wtire the value to acc c3 register.
Definition at32f413_acc.c:141
acc_write_c1
void acc_write_c1(uint16_t acc_c1_value)
wtire the value to acc c1 register.
Definition at32f413_acc.c:121
acc_calibration_mode_enable
void acc_calibration_mode_enable(uint16_t acc_trim, confirm_state new_state)
enable or disable the acc calibration mode.
Definition at32f413_acc.c:52
NO_BUTTON
@ NO_BUTTON
Definition at32f413_board.h:94
at32_button_press
button_type at32_button_press()
returns which button have press down
Definition at32f413_board.c:218
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
delay_us
void delay_us(uint32_t nus)
inserts a delay time.
Definition at32f413_board.c:330
crm_periph_reset
void crm_periph_reset(crm_periph_reset_type value, confirm_state new_state)
enable or disable the peripheral reset
Definition at32f413_crm.c:293
crm_usb_clock_div_set
void crm_usb_clock_div_set(crm_usb_div_type div_value)
set crm usb division
Definition at32f413_crm.c:533
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_usb_clock_source_select
void crm_usb_clock_source_select(crm_usb_clock_source_type value)
usb 48 mhz clock source select
Definition at32f413_crm.c:854
crm_clocks_freq_get
void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
Definition at32f413_crm.c:660
CRM_USB_PERIPH_CLOCK
@ CRM_USB_PERIPH_CLOCK
Definition at32f413_crm.h:137
CRM_ACC_PERIPH_CLOCK
@ CRM_ACC_PERIPH_CLOCK
Definition at32f413_crm.h:123
CRM_USB_DIV_3
@ CRM_USB_DIV_3
Definition at32f413_crm.h:363
CRM_USB_DIV_1_5
@ CRM_USB_DIV_1_5
Definition at32f413_crm.h:358
CRM_USB_DIV_4
@ CRM_USB_DIV_4
Definition at32f413_crm.h:364
CRM_USB_DIV_3_5
@ CRM_USB_DIV_3_5
Definition at32f413_crm.h:362
CRM_USB_DIV_2
@ CRM_USB_DIV_2
Definition at32f413_crm.h:361
CRM_USB_DIV_1
@ CRM_USB_DIV_1
Definition at32f413_crm.h:359
CRM_USB_DIV_2_5
@ CRM_USB_DIV_2_5
Definition at32f413_crm.h:360
CRM_USB_CLOCK_SOURCE_HICK
@ CRM_USB_CLOCK_SOURCE_HICK
Definition at32f413_crm.h:454
CRM_USB_PERIPH_RESET
@ CRM_USB_PERIPH_RESET
Definition at32f413_crm.h:181
USBFS_L_CAN1_RX0_IRQn
@ USBFS_L_CAN1_RX0_IRQn
Definition at32f413.h:192
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
jump_to_app
iapfun jump_to_app
Definition bootloader/src/iap.c:45
flash_fat16_set_name
uint32_t flash_fat16_set_name(const uint8_t *file_name, uint8_t len)
set file name
Definition flash_fat16.c:360
flash_fat16_get_upgrade_flag
uint8_t flash_fat16_get_upgrade_flag(void)
get iap upgrade complete flag
Definition flash_fat16.c:271
IAP_SUCCESS
#define IAP_SUCCESS
Definition flash_fat16.h:76
flash_iap
flash_iap_type flash_iap
Definition flash_fat16.c:174
flash_fat16_init
void flash_fat16_init(void)
flash fat16 iap init
Definition flash_fat16.c:736
UPGRADE_LARGE
@ UPGRADE_LARGE
Definition flash_fat16.h:85
UPGRADE_UNKNOWN
@ UPGRADE_UNKNOWN
Definition flash_fat16.h:86
UPGRADE_JUMP
@ UPGRADE_JUMP
Definition flash_fat16.h:88
UPGRADE_FAILED
@ UPGRADE_FAILED
Definition flash_fat16.h:84
UPGRADE_SUCCESS
@ UPGRADE_SUCCESS
Definition flash_fat16.h:83
UPGRADE_READY
@ UPGRADE_READY
Definition flash_fat16.h:81
UPGRAGE_ONGOING
@ UPGRAGE_ONGOING
Definition flash_fat16.h:82
UPGRADE_DONE
@ UPGRADE_DONE
Definition flash_fat16.h:87
usb_clk48_s
usb_clk48_s
usb clock select
Definition at32f413_usb.h:230
USB_CLK_HEXT
@ USB_CLK_HEXT
Definition at32f413_usb.h:232
USB_CLK_HICK
@ USB_CLK_HICK
Definition at32f413_usb.h:231
msc_class_handler
usbd_class_handler msc_class_handler
Definition msc_class.c:56
msc_desc_handler
usbd_desc_handler msc_desc_handler
device descriptor handler structure
Definition msc_desc.c:66
usbd_core_init
void usbd_core_init(usbd_core_type *udev, usb_reg_type *usb_reg, usbd_class_handler *dev_handler, usbd_desc_handler *desc_handler, uint8_t core_id)
initializes the usb core
Definition usbd_core.c:675
usbd_connect
void usbd_connect(usbd_core_type *udev)
usb device connect to host
Definition usbd_core.c:564
usbd_disconnect
void usbd_disconnect(usbd_core_type *udev)
usb device disconnect to host
Definition usbd_core.c:574
usbd_irq_handler
void usbd_irq_handler(usbd_core_type *udev)
usb device interrput request handler.
Definition usbd_int.c:45
USB
#define USB
Definition at32f413_usb.h:665
msc_class.h
usb msc class file
msc_desc.h
usb msc descriptor header file
at32f413_clock.h
header file of clock program
crm_clocks_freq_type
crm clocks freqency structure
Definition at32f413_crm.h:470
crm_clocks_freq_type::sclk_freq
uint32_t sclk_freq
Definition at32f413_crm.h:471
flash_iap_type::msc_up_status
upgrade_status_type msc_up_status
Definition flash_fat16.h:121
flash_iap_type::write_addr
uint32_t write_addr
Definition flash_fat16.h:119
flash_iap_type::flash_app_addr
uint32_t flash_app_addr
Definition flash_fat16.h:110
usbd_core_type
usb device core struct type
Definition usbd_core.h:114
usbd_core.h
usb device core header file
usbd_int.h


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • usb_device
  • winusb
  • inc
project/at_start_f413/examples/usb_device/winusb/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • usb_device
  • winusb
  • inc
project/at_start_f413/examples/usb_device/winusb/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • usb_device
  • winusb
  • inc
project/at_start_f413/examples/usb_device/winusb/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: usb_conf.h Source File

  • usb_device
  • winusb
  • inc
project/at_start_f413/examples/usb_device/winusb/inc/usb_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __USB_CONF_H
28#define __USB_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "at32f413.h"
35#include "at32f413_board.h"
36#include "stdio.h"
37
49#ifndef USB_EPT_MAX_NUM
50#define USB_EPT_MAX_NUM 8
51#endif
52
56//#define USB_BUFFER_SIZE_EX /*!< usb enable extend buffer */
57
58
62//#define USB_EPT_AUTO_MALLOC_BUFFER /*!< usb auto malloc endpoint tx and rx buffer */
63
64
65#ifndef USB_EPT_AUTO_MALLOC_BUFFER
71/* ept0 tx start address 0x40, size 0x40,
72 so rx start address is 0x40 + 0x40 = 0x80 */
73#define EPT0_TX_ADDR 0x40
74#define EPT0_RX_ADDR 0x80
76#define EPT1_TX_ADDR 0xC0
77#define EPT1_RX_ADDR 0x100
79#define EPT2_TX_ADDR 0x140
80#define EPT2_RX_ADDR 0x180
82#define EPT3_TX_ADDR 0x00
83#define EPT3_RX_ADDR 0x00
85#define EPT4_TX_ADDR 0x00
86#define EPT4_RX_ADDR 0x00
88#define EPT5_TX_ADDR 0x00
89#define EPT5_RX_ADDR 0x00
91#define EPT6_TX_ADDR 0x00
92#define EPT6_RX_ADDR 0x00
94#define EPT7_TX_ADDR 0x00
95#define EPT7_RX_ADDR 0x00
97#endif
98
102#define USBD_SUPPORT_WINUSB 1
103
104void usb_delay_ms(uint32_t ms);
105void usb_delay_us(uint32_t us);
106
115#ifdef __cplusplus
116}
117#endif
118
119#endif
120
at32f413.h
at32f413 header file
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
usb_delay_ms
void usb_delay_ms(uint32_t ms)
usb delay millisecond function.
Definition project/at_start_f413/examples/usb_device/winusb/src/main.c:190
usb_delay_us
void usb_delay_us(uint32_t us)
usb delay microsecond function.
Definition project/at_start_f413/examples/usb_device/winusb/src/main.c:201


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • usb_device
  • winusb
  • src
project/at_start_f413/examples/usb_device/winusb/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/usb_device/winusb/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • usb_device
  • winusb
  • src
project/at_start_f413/examples/usb_device/winusb/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/usb_device/winusb/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/usb_device/winusb/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/usb_device/winusb/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/usb_device/winusb/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/usb_device/winusb/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/usb_device/winusb/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/usb_device/winusb/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/usb_device/winusb/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/usb_device/winusb/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • usb_device
  • winusb
  • src
project/at_start_f413/examples/usb_device/winusb/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include "usbd_core.h"
29#include "winusb_class.h"
30#include "winusb_desc.h"
31#include "usbd_int.h"
32
41 usbd_core_type usb_core_dev;
42uint8_t usb_buffer[256];
43
49void usb_clock48m_select(usb_clk48_s clk_s)
50{
51 crm_clocks_freq_type clocks_struct;
52
53 if(clk_s == USB_CLK_HICK)
54 {
55 crm_usb_clock_source_select(CRM_USB_CLOCK_SOURCE_HICK);
56
57 /* enable the acc calibration ready interrupt */
58 crm_periph_clock_enable(CRM_ACC_PERIPH_CLOCK, TRUE);
59
60 /* update the c1\c2\c3 value */
61 acc_write_c1(7980);
62 acc_write_c2(8000);
63 acc_write_c3(8020);
64
65 /* open acc calibration */
66 acc_calibration_mode_enable(ACC_CAL_HICKTRIM, TRUE);
67 }
68 else
69 {
70 crm_clocks_freq_get(&clocks_struct);
71 switch(clocks_struct.sclk_freq)
72 {
73 /* 48MHz */
74 case 48000000:
75 crm_usb_clock_div_set(CRM_USB_DIV_1);
76 break;
77
78 /* 72MHz */
79 case 72000000:
80 crm_usb_clock_div_set(CRM_USB_DIV_1_5);
81 break;
82
83 /* 96MHz */
84 case 96000000:
85 crm_usb_clock_div_set(CRM_USB_DIV_2);
86 break;
87
88 /* 120MHz */
89 case 120000000:
90 crm_usb_clock_div_set(CRM_USB_DIV_2_5);
91 break;
92
93 /* 144MHz */
94 case 144000000:
95 crm_usb_clock_div_set(CRM_USB_DIV_3);
96 break;
97
98 /* 168MHz */
99 case 168000000:
100 crm_usb_clock_div_set(CRM_USB_DIV_3_5);
101 break;
102
103 /* 192MHz */
104 case 192000000:
105 crm_usb_clock_div_set(CRM_USB_DIV_4);
106 break;
107
108 default:
109 break;
110
111 }
112 }
113}
114
120int main(void)
121{
122 uint16_t data_len;
123
124 uint32_t timeout;
125
126 /* config nvic priority group */
127 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
128
129 system_clock_config();
130
131 at32_board_init();
132
133 /* select usb 48m clcok source */
134 usb_clock48m_select(USB_CLK_HEXT);
135
136 /* enable usb clock */
137 crm_periph_clock_enable(CRM_USB_PERIPH_CLOCK, TRUE);
138
139 /* enable usb interrupt */
140 nvic_irq_enable(USBFS_L_CAN1_RX0_IRQn, 0, 0);
141
142 /* usb core init */
143 usbd_core_init(&usb_core_dev, USB, &winusb_class_handler, &winusb_desc_handler, 0);
144
145 /* enable usb pull-up */
146 usbd_connect(&usb_core_dev);
147
148 while(1)
149 {
150 /* get usb winusb receive data */
151 data_len = usb_winusb_get_rxdata(&usb_core_dev, usb_buffer);
152
153 if(data_len > 0)
154 {
155
156 /* bulk transfer is complete when the endpoint does one of the following
157 1 has transferred exactly the amount of data expected
158 2 transfers a packet with a payload size less than wMaxPacketSize or transfers a zero-length packet
159 */
160
161 timeout = 5000000;
162 do
163 {
164 /* send data to host */
165 if(usb_winusb_send_data(&usb_core_dev, usb_buffer, data_len) == SUCCESS)
166 {
167 break;
168 }
169 }while(timeout --);
170 }
171 }
172}
173
174
180void USBFS_L_CAN1_RX0_IRQHandler(void)
181{
182 usbd_irq_handler(&usb_core_dev);
183}
184
190void usb_delay_ms(uint32_t ms)
191{
192 /* user can define self delay function */
193 delay_ms(ms);
194}
195
201void usb_delay_us(uint32_t us)
202{
203 delay_us(us);
204}
205
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
usb_delay_ms
void usb_delay_ms(uint32_t ms)
usb delay millisecond function.
Definition project/at_start_f413/examples/acc/calibration/src/main.c:244
usb_delay_us
void usb_delay_us(uint32_t us)
usb delay microsecond function.
Definition project/at_start_f413/examples/acc/calibration/src/main.c:255
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
usb_clock48m_select
void usb_clock48m_select(usb_clk48_s clk_s)
usb 48M clock select
Definition project/at_start_f413/examples/usb_device/winusb/src/main.c:49
main
int main(void)
main function.
Definition project/at_start_f413/examples/usb_device/winusb/src/main.c:120
USBFS_L_CAN1_RX0_IRQHandler
void USBFS_L_CAN1_RX0_IRQHandler(void)
this function handles usb interrupt.
Definition project/at_start_f413/examples/usb_device/winusb/src/main.c:180
usb_buffer
uint8_t usb_buffer[256]
Definition project/at_start_f413/examples/usb_device/winusb/src/main.c:42
usb_core_dev
usbd_core_type usb_core_dev
Definition project/at_start_f413/examples/usb_device/winusb/src/main.c:41
ACC_CAL_HICKTRIM
#define ACC_CAL_HICKTRIM
Definition at32f413_acc.h:52
acc_write_c2
void acc_write_c2(uint16_t acc_c2_value)
wtire the value to acc c2 register.
Definition at32f413_acc.c:131
acc_write_c3
void acc_write_c3(uint16_t acc_c3_value)
wtire the value to acc c3 register.
Definition at32f413_acc.c:141
acc_write_c1
void acc_write_c1(uint16_t acc_c1_value)
wtire the value to acc c1 register.
Definition at32f413_acc.c:121
acc_calibration_mode_enable
void acc_calibration_mode_enable(uint16_t acc_trim, confirm_state new_state)
enable or disable the acc calibration mode.
Definition at32f413_acc.c:52
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
delay_us
void delay_us(uint32_t nus)
inserts a delay time.
Definition at32f413_board.c:330
crm_usb_clock_div_set
void crm_usb_clock_div_set(crm_usb_div_type div_value)
set crm usb division
Definition at32f413_crm.c:533
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_usb_clock_source_select
void crm_usb_clock_source_select(crm_usb_clock_source_type value)
usb 48 mhz clock source select
Definition at32f413_crm.c:854
crm_clocks_freq_get
void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
Definition at32f413_crm.c:660
CRM_USB_PERIPH_CLOCK
@ CRM_USB_PERIPH_CLOCK
Definition at32f413_crm.h:137
CRM_ACC_PERIPH_CLOCK
@ CRM_ACC_PERIPH_CLOCK
Definition at32f413_crm.h:123
CRM_USB_DIV_3
@ CRM_USB_DIV_3
Definition at32f413_crm.h:363
CRM_USB_DIV_1_5
@ CRM_USB_DIV_1_5
Definition at32f413_crm.h:358
CRM_USB_DIV_4
@ CRM_USB_DIV_4
Definition at32f413_crm.h:364
CRM_USB_DIV_3_5
@ CRM_USB_DIV_3_5
Definition at32f413_crm.h:362
CRM_USB_DIV_2
@ CRM_USB_DIV_2
Definition at32f413_crm.h:361
CRM_USB_DIV_1
@ CRM_USB_DIV_1
Definition at32f413_crm.h:359
CRM_USB_DIV_2_5
@ CRM_USB_DIV_2_5
Definition at32f413_crm.h:360
CRM_USB_CLOCK_SOURCE_HICK
@ CRM_USB_CLOCK_SOURCE_HICK
Definition at32f413_crm.h:454
USBFS_L_CAN1_RX0_IRQn
@ USBFS_L_CAN1_RX0_IRQn
Definition at32f413.h:192
SUCCESS
@ SUCCESS
Definition at32f413.h:302
TRUE
@ TRUE
Definition at32f413.h:297
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
usb_clk48_s
usb_clk48_s
usb clock select
Definition at32f413_usb.h:230
USB_CLK_HEXT
@ USB_CLK_HEXT
Definition at32f413_usb.h:232
USB_CLK_HICK
@ USB_CLK_HICK
Definition at32f413_usb.h:231
usb_winusb_get_rxdata
uint16_t usb_winusb_get_rxdata(void *udev, uint8_t *recv_data)
usb device class rx data process
Definition winusb_class.c:356
winusb_class_handler
usbd_class_handler winusb_class_handler
Definition winusb_class.c:66
usb_winusb_send_data
error_status usb_winusb_send_data(void *udev, uint8_t *send_data, uint16_t len)
usb device class send data
Definition winusb_class.c:386
winusb_desc_handler
usbd_desc_handler winusb_desc_handler
device descriptor handler structure
Definition winusb_desc.c:73
usbd_core_init
void usbd_core_init(usbd_core_type *udev, usb_reg_type *usb_reg, usbd_class_handler *dev_handler, usbd_desc_handler *desc_handler, uint8_t core_id)
initializes the usb core
Definition usbd_core.c:675
usbd_connect
void usbd_connect(usbd_core_type *udev)
usb device connect to host
Definition usbd_core.c:564
usbd_irq_handler
void usbd_irq_handler(usbd_core_type *udev)
usb device interrput request handler.
Definition usbd_int.c:45
USB
#define USB
Definition at32f413_usb.h:665
at32f413_clock.h
header file of clock program
crm_clocks_freq_type
crm clocks freqency structure
Definition at32f413_crm.h:470
crm_clocks_freq_type::sclk_freq
uint32_t sclk_freq
Definition at32f413_crm.h:471
usbd_core_type
usb device core struct type
Definition usbd_core.h:114
usbd_core.h
usb device core header file
usbd_int.h
winusb_class.h
usb winusb class file
winusb_desc.h
usb winusb descriptor header file


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • wdt
  • wdt_reset
  • inc
project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • wdt
  • wdt_reset
  • inc
project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • wdt
  • wdt_reset
  • inc
project/at_start_f413/examples/wdt/wdt_reset/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • wdt
  • wdt_reset
  • src
project/at_start_f413/examples/wdt/wdt_reset/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/wdt/wdt_reset/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • wdt
  • wdt_reset
  • src
project/at_start_f413/examples/wdt/wdt_reset/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
134
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/wdt/wdt_reset/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/wdt/wdt_reset/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/wdt/wdt_reset/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/wdt/wdt_reset/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/wdt/wdt_reset/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/wdt/wdt_reset/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/wdt/wdt_reset/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/wdt/wdt_reset/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/wdt/wdt_reset/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • wdt
  • wdt_reset
  • src
project/at_start_f413/examples/wdt/wdt_reset/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
43int main(void)
44{
45 system_clock_config();
46
47 at32_board_init();
48
49 if(crm_flag_get(CRM_WDT_RESET_FLAG) != RESET)
50 {
51 /* reset from wdt */
52 crm_flag_clear(CRM_WDT_RESET_FLAG);
53
54 at32_led_on(LED4);
55 }
56 else
57 {
58 /* reset from other mode */
59 at32_led_off(LED4);
60 }
61
62 /* disable register write protection */
63 wdt_register_write_enable(TRUE);
64
65 /* set the wdt divider value */
66 wdt_divider_set(WDT_CLK_DIV_4);
67
68 /* set reload value
69
70 timeout = reload_value * (divider / lick_freq ) (s)
71
72 lick_freq = 40000 Hz
73 divider = 4
74 reload_value = 3000
75
76 timeout = 3000 * (4 / 40000 ) = 0.3s = 300ms
77 */
78 wdt_reload_value_set(3000 - 1);
79
80 /* reload wdt counter */
81 wdt_counter_reload();
82
83 /* enable wdt */
84 wdt_enable();
85
86 while(1)
87 {
88 /* reload wdt counter */
89 wdt_counter_reload();
90
91 at32_led_toggle(LED3);
92
93 delay_ms(200);
94
95 if(at32_button_press() == USER_BUTTON)
96 {
97 while(1);
98 }
99 }
100}
101
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
main
int main(void)
main function.
Definition project/at_start_f413/examples/wdt/wdt_reset/src/main.c:43
LED3
@ LED3
Definition at32f413_board.h:63
LED4
@ LED4
Definition at32f413_board.h:64
USER_BUTTON
@ USER_BUTTON
Definition at32f413_board.h:93
at32_button_press
button_type at32_button_press()
returns which button have press down
Definition at32f413_board.c:218
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
at32_led_off
void at32_led_off(led_type led)
turns selected led off.
Definition at32f413_board.c:287
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_flag_clear
void crm_flag_clear(uint32_t flag)
clear the crm reset flags
Definition at32f413_crm.c:387
CRM_WDT_RESET_FLAG
#define CRM_WDT_RESET_FLAG
Definition at32f413_crm.h:63
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
wdt_register_write_enable
void wdt_register_write_enable(confirm_state new_state)
enable or disable wdt cmd register write
Definition at32f413_wdt.c:96
wdt_enable
void wdt_enable(void)
wdt enable ,the reload value will be sent to the counter
Definition at32f413_wdt.c:48
wdt_counter_reload
void wdt_counter_reload(void)
reload wdt counter
Definition at32f413_wdt.c:58
wdt_reload_value_set
void wdt_reload_value_set(uint16_t reload_value)
set wdt counter reload value
Definition at32f413_wdt.c:68
wdt_divider_set
void wdt_divider_set(wdt_division_type division)
set wdt division divider
Definition at32f413_wdt.c:86
WDT_CLK_DIV_4
@ WDT_CLK_DIV_4
Definition at32f413_wdt.h:68
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • wdt
  • wdt_standby
  • inc
project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • wdt
  • wdt_standby
  • inc
project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • wdt
  • wdt_standby
  • inc
project/at_start_f413/examples/wdt/wdt_standby/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • wdt
  • wdt_standby
  • src
project/at_start_f413/examples/wdt/wdt_standby/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/wdt/wdt_standby/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • wdt
  • wdt_standby
  • src
project/at_start_f413/examples/wdt/wdt_standby/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
134
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/wdt/wdt_standby/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/wdt/wdt_standby/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/wdt/wdt_standby/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/wdt/wdt_standby/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/wdt/wdt_standby/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/wdt/wdt_standby/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/wdt/wdt_standby/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/wdt/wdt_standby/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/wdt/wdt_standby/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • wdt
  • wdt_standby
  • src
project/at_start_f413/examples/wdt/wdt_standby/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
43int main(void)
44{
45 system_clock_config();
46
47 at32_board_init();
48
49 /* enable the pwc clock */
50 crm_periph_clock_enable(CRM_PWC_PERIPH_CLOCK, TRUE);
51
52 if(crm_flag_get(CRM_WDT_RESET_FLAG) != RESET)
53 {
54 /* reset from wdt */
55 crm_flag_clear(CRM_WDT_RESET_FLAG);
56
57 at32_led_on(LED4);
58 }
59 else
60 {
61 /* reset from other mode */
62 at32_led_off(LED4);
63 }
64
65 delay_ms(100);
66
67 /* disable register write protection */
68 wdt_register_write_enable(TRUE);
69
70 /* set the wdt divider value */
71 wdt_divider_set(WDT_CLK_DIV_4);
72
73 /* set reload value
74
75 timeout = reload_value * (divider / lick_freq ) (s)
76
77 lick_freq = 40000 Hz
78 divider = 4
79 reload_value = 3000
80
81 timeout = 3000 * (4 / 40000 ) = 0.3s = 300ms
82 */
83 wdt_reload_value_set(3000 - 1);
84
85 /* reload wdt counter */
86 wdt_counter_reload();
87
88 /* enable wdt */
89 wdt_enable();
90
91 /* delay 100us wait for iwdg enable successfully */
92 delay_us(100);
93
94 /* enter standby mode */
95 pwc_standby_mode_enter();
96
97 while(1)
98 {
99
100 }
101}
102
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
main
int main(void)
main function.
Definition project/at_start_f413/examples/wdt/wdt_standby/src/main.c:43
LED4
@ LED4
Definition at32f413_board.h:64
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_led_off
void at32_led_off(led_type led)
turns selected led off.
Definition at32f413_board.c:287
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
delay_us
void delay_us(uint32_t nus)
inserts a delay time.
Definition at32f413_board.c:330
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_flag_clear
void crm_flag_clear(uint32_t flag)
clear the crm reset flags
Definition at32f413_crm.c:387
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_PWC_PERIPH_CLOCK
@ CRM_PWC_PERIPH_CLOCK
Definition at32f413_crm.h:140
CRM_WDT_RESET_FLAG
#define CRM_WDT_RESET_FLAG
Definition at32f413_crm.h:63
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
pwc_standby_mode_enter
void pwc_standby_mode_enter(void)
enter pwc standby mode
Definition at32f413_pwc.c:209
wdt_register_write_enable
void wdt_register_write_enable(confirm_state new_state)
enable or disable wdt cmd register write
Definition at32f413_wdt.c:96
wdt_enable
void wdt_enable(void)
wdt enable ,the reload value will be sent to the counter
Definition at32f413_wdt.c:48
wdt_counter_reload
void wdt_counter_reload(void)
reload wdt counter
Definition at32f413_wdt.c:58
wdt_reload_value_set
void wdt_reload_value_set(uint16_t reload_value)
set wdt counter reload value
Definition at32f413_wdt.c:68
wdt_divider_set
void wdt_divider_set(wdt_division_type division)
set wdt division divider
Definition at32f413_wdt.c:86
WDT_CLK_DIV_4
@ WDT_CLK_DIV_4
Definition at32f413_wdt.h:68
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • wwdt
  • wwdt_reset
  • inc
project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • wwdt
  • wwdt_reset
  • inc
project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • wwdt
  • wwdt_reset
  • inc
project/at_start_f413/examples/wwdt/wwdt_reset/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • wwdt
  • wwdt_reset
  • src
project/at_start_f413/examples/wwdt/wwdt_reset/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/wwdt/wwdt_reset/src/at32f413_clock.c:47
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • wwdt
  • wwdt_reset
  • src
project/at_start_f413/examples/wwdt/wwdt_reset/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
29
43void NMI_Handler(void)
44{
45}
46
52void HardFault_Handler(void)
53{
54 /* go to infinite loop when hard fault exception occurs */
55 while(1)
56 {
57 }
58}
59
65void MemManage_Handler(void)
66{
67 /* go to infinite loop when memory manage exception occurs */
68 while(1)
69 {
70 }
71}
72
78void BusFault_Handler(void)
79{
80 /* go to infinite loop when bus fault exception occurs */
81 while(1)
82 {
83 }
84}
85
91void UsageFault_Handler(void)
92{
93 /* go to infinite loop when usage fault exception occurs */
94 while(1)
95 {
96 }
97}
98
104void SVC_Handler(void)
105{
106}
107
113void DebugMon_Handler(void)
114{
115}
116
122void PendSV_Handler(void)
123{
124}
125
131void SysTick_Handler(void)
132{
133}
134
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/wwdt/wwdt_reset/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/wwdt/wwdt_reset/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/wwdt/wwdt_reset/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/wwdt/wwdt_reset/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/wwdt/wwdt_reset/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/wwdt/wwdt_reset/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/wwdt/wwdt_reset/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/wwdt/wwdt_reset/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/wwdt/wwdt_reset/src/at32f413_int.c:113
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • wwdt
  • wwdt_reset
  • src
project/at_start_f413/examples/wwdt/wwdt_reset/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
42int main(void)
43{
44 system_clock_config();
45
46 at32_board_init();
47
48 if(crm_flag_get(CRM_WWDT_RESET_FLAG) != RESET)
49 {
50 /* reset from wwdt */
51 crm_flag_clear(CRM_WWDT_RESET_FLAG);
52
53 at32_led_on(LED4);
54 }
55 else
56 {
57 /* reset from other mode */
58 at32_led_off(LED4);
59 }
60
61 /* enable the wwdt clock */
62 crm_periph_clock_enable(CRM_WWDT_PERIPH_CLOCK, TRUE);
63
64 /* set the wwdt divider value */
65 wwdt_divider_set(WWDT_PCLK1_DIV_32768);
66
67 /* set the wwdt window counter value */
68 wwdt_window_counter_set(0x6F);
69
70 /* enable wwdt
71
72 window_value: (0x7F - 0x6F)
73 timeout_value: (0x7F - 0x40) + 1
74
75 timeout = timeout_value * (divider / pclk1_freq ) (s)
76 window = window_value * (divider / pclk1_freq ) (s)
77
78 pclk1_freq = 120 MHz
79 divider = 32768
80 reload_value = 0x40 = 64
81 window_value = 0x10 = 16
82
83 timeout = 64 * (32768 / 96000000 ) = 0.0218s = 21.8ms
84 window = 16 * (32768 / 96000000 ) = 0.0055s = 5.5ms
85
86 */
87 wwdt_enable(0x7F);
88
89 while(1)
90 {
91 at32_led_toggle(LED3);
92
93 /* the reload time must within the window (8ms > 5.5ms) */
94 delay_ms(8);
95
96 /* update the wwdt window counter */
97 wwdt_counter_set(0x7F);
98
99 if(at32_button_press() == USER_BUTTON)
100 {
101 while(1);
102 }
103 }
104}
105
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
main
int main(void)
main function.
Definition project/at_start_f413/examples/wwdt/wwdt_reset/src/main.c:42
LED3
@ LED3
Definition at32f413_board.h:63
LED4
@ LED4
Definition at32f413_board.h:64
USER_BUTTON
@ USER_BUTTON
Definition at32f413_board.h:93
at32_button_press
button_type at32_button_press()
returns which button have press down
Definition at32f413_board.c:218
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
at32_led_off
void at32_led_off(led_type led)
turns selected led off.
Definition at32f413_board.c:287
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_flag_clear
void crm_flag_clear(uint32_t flag)
clear the crm reset flags
Definition at32f413_crm.c:387
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_WWDT_PERIPH_CLOCK
@ CRM_WWDT_PERIPH_CLOCK
Definition at32f413_crm.h:129
CRM_WWDT_RESET_FLAG
#define CRM_WWDT_RESET_FLAG
Definition at32f413_crm.h:64
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
wwdt_counter_set
void wwdt_counter_set(uint8_t wwdt_cnt)
wwdt counter value set
Definition at32f413_wwdt.c:123
wwdt_divider_set
void wwdt_divider_set(wwdt_division_type division)
wwdt division set
Definition at32f413_wwdt.c:63
wwdt_window_counter_set
void wwdt_window_counter_set(uint8_t window_cnt)
wwdt window counter value set
Definition at32f413_wwdt.c:133
wwdt_enable
void wwdt_enable(uint8_t wwdt_cnt)
wwdt enable and the counter value load
Definition at32f413_wwdt.c:83
WWDT_PCLK1_DIV_32768
@ WWDT_PCLK1_DIV_32768
Definition at32f413_wwdt.h:69
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • templates
  • inc
project/at_start_f413/templates/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • templates
  • inc
project/at_start_f413/templates/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34
51#if !defined HEXT_VALUE
52#define HEXT_VALUE ((uint32_t)8000000)
53#endif
54
59#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
60#define HICK_VALUE ((uint32_t)8000000)
61#define LEXT_VALUE ((uint32_t)32768)
63/* module define -------------------------------------------------------------*/
64#define CRM_MODULE_ENABLED
65#define TMR_MODULE_ENABLED
66#define RTC_MODULE_ENABLED
67#define BPR_MODULE_ENABLED
68#define GPIO_MODULE_ENABLED
69#define I2C_MODULE_ENABLED
70#define USART_MODULE_ENABLED
71#define PWC_MODULE_ENABLED
72#define CAN_MODULE_ENABLED
73#define ADC_MODULE_ENABLED
74#define SPI_MODULE_ENABLED
75#define DMA_MODULE_ENABLED
76#define DEBUG_MODULE_ENABLED
77#define FLASH_MODULE_ENABLED
78#define CRC_MODULE_ENABLED
79#define WWDT_MODULE_ENABLED
80#define WDT_MODULE_ENABLED
81#define EXINT_MODULE_ENABLED
82#define SDIO_MODULE_ENABLED
83#define USB_MODULE_ENABLED
84#define ACC_MODULE_ENABLED
85#define MISC_MODULE_ENABLED
86
87/* includes ------------------------------------------------------------------*/
88#ifdef CRM_MODULE_ENABLED
89#include "at32f413_crm.h"
90#endif
91#ifdef TMR_MODULE_ENABLED
92#include "at32f413_tmr.h"
93#endif
94#ifdef RTC_MODULE_ENABLED
95#include "at32f413_rtc.h"
96#endif
97#ifdef BPR_MODULE_ENABLED
98#include "at32f413_bpr.h"
99#endif
100#ifdef GPIO_MODULE_ENABLED
101#include "at32f413_gpio.h"
102#endif
103#ifdef I2C_MODULE_ENABLED
104#include "at32f413_i2c.h"
105#endif
106#ifdef USART_MODULE_ENABLED
107#include "at32f413_usart.h"
108#endif
109#ifdef PWC_MODULE_ENABLED
110#include "at32f413_pwc.h"
111#endif
112#ifdef CAN_MODULE_ENABLED
113#include "at32f413_can.h"
114#endif
115#ifdef ADC_MODULE_ENABLED
116#include "at32f413_adc.h"
117#endif
118#ifdef SPI_MODULE_ENABLED
119#include "at32f413_spi.h"
120#endif
121#ifdef DMA_MODULE_ENABLED
122#include "at32f413_dma.h"
123#endif
124#ifdef DEBUG_MODULE_ENABLED
125#include "at32f413_debug.h"
126#endif
127#ifdef FLASH_MODULE_ENABLED
128#include "at32f413_flash.h"
129#endif
130#ifdef CRC_MODULE_ENABLED
131#include "at32f413_crc.h"
132#endif
133#ifdef WWDT_MODULE_ENABLED
134#include "at32f413_wwdt.h"
135#endif
136#ifdef WDT_MODULE_ENABLED
137#include "at32f413_wdt.h"
138#endif
139#ifdef EXINT_MODULE_ENABLED
140#include "at32f413_exint.h"
141#endif
142#ifdef SDIO_MODULE_ENABLED
143#include "at32f413_sdio.h"
144#endif
145#ifdef ACC_MODULE_ENABLED
146#include "at32f413_acc.h"
147#endif
148#ifdef MISC_MODULE_ENABLED
149#include "at32f413_misc.h"
150#endif
151#ifdef USB_MODULE_ENABLED
152#include "at32f413_usb.h"
153#endif
154
163#ifdef __cplusplus
164}
165#endif
166
167#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • templates
  • inc
project/at_start_f413/templates/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • templates
  • src
project/at_start_f413/templates/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
55void system_clock_config(void)
56{
57 /* reset crm */
58 crm_reset();
59
60 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
61
62 /* wait till hext is ready */
63 while(crm_hext_stable_wait() == ERROR)
64 {
65 }
66
67 /* config pll clock resource */
68 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
69
70 /* enable pll */
71 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
72
73 /* wait till pll is ready */
74 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
75 {
76 }
77
78 /* config ahbclk */
79 crm_ahb_div_set(CRM_AHB_DIV_1);
80
81 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
82 crm_apb2_div_set(CRM_APB2_DIV_2);
83
84 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
85 crm_apb1_div_set(CRM_APB1_DIV_2);
86
87 /* enable auto step mode */
88 crm_auto_step_mode_enable(TRUE);
89
90 /* select pll as system clock source */
91 crm_sysclk_switch(CRM_SCLK_PLL);
92
93 /* wait till pll is used as system clock source */
94 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
95 {
96 }
97
98 /* disable auto step mode */
99 crm_auto_step_mode_enable(FALSE);
100
101 /* update system_core_clock global variable */
102 system_core_clock_update();
103}
104
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/templates/src/at32f413_clock.c:55
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • templates
  • src
project/at_start_f413/templates/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/templates/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/templates/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/templates/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/templates/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/templates/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/templates/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/templates/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/templates/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/templates/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • templates
  • src
project/at_start_f413/templates/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28
37#define DELAY 100
38#define FAST 1
39#define SLOW 4
40
41uint8_t g_speed = FAST;
42
43void button_exint_init(void);
44void button_isr(void);
45
51void button_exint_init(void)
52{
53 exint_init_type exint_init_struct;
54
55 crm_periph_clock_enable(CRM_IOMUX_PERIPH_CLOCK, TRUE);
56 gpio_exint_line_config(GPIO_PORT_SOURCE_GPIOA, GPIO_PINS_SOURCE0);
57
58 exint_default_para_init(&exint_init_struct);
59 exint_init_struct.line_enable = TRUE;
60 exint_init_struct.line_mode = EXINT_LINE_INTERRUPT;
61 exint_init_struct.line_select = EXINT_LINE_0;
62 exint_init_struct.line_polarity = EXINT_TRIGGER_RISING_EDGE;
63 exint_init(&exint_init_struct);
64
65 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
66 nvic_irq_enable(EXINT0_IRQn, 0, 0);
67}
68
74void button_isr(void)
75{
76 /* delay 5ms */
77 delay_ms(5);
78
79 /* clear interrupt pending bit */
80 exint_flag_clear(EXINT_LINE_0);
81
82 /* check input pin state */
83 if(SET == gpio_input_data_bit_read(USER_BUTTON_PORT, USER_BUTTON_PIN))
84 {
85 if(g_speed == SLOW)
86 g_speed = FAST;
87 else
88 g_speed = SLOW;
89 }
90}
91
97void EXINT0_IRQHandler(void)
98{
99 button_isr();
100}
101
107int main(void)
108{
109 system_clock_config();
110
111 at32_board_init();
112
113 button_exint_init();
114
115 uart_print_init(115200);
116 printf("at32 mcu initialize ok.\r\n");
117 while(1)
118 {
119 at32_led_toggle(LED2);
120 delay_ms(g_speed * DELAY);
121 at32_led_toggle(LED3);
122 delay_ms(g_speed * DELAY);
123 at32_led_toggle(LED4);
124 delay_ms(g_speed * DELAY);
125 }
126}
127
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
SLOW
#define SLOW
Definition project/at_start_f413/templates/src/main.c:39
button_exint_init
void button_exint_init(void)
configure button exint
Definition project/at_start_f413/templates/src/main.c:51
DELAY
#define DELAY
Definition project/at_start_f413/templates/src/main.c:37
FAST
#define FAST
Definition project/at_start_f413/templates/src/main.c:38
main
int main(void)
main function.
Definition project/at_start_f413/templates/src/main.c:107
EXINT0_IRQHandler
void EXINT0_IRQHandler(void)
exint0 interrupt handler
Definition project/at_start_f413/templates/src/main.c:97
g_speed
uint8_t g_speed
Definition project/at_start_f413/templates/src/main.c:41
button_isr
void button_isr(void)
button handler function
Definition project/at_start_f413/templates/src/main.c:74
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
USER_BUTTON_PORT
#define USER_BUTTON_PORT
Definition at32f413_board.h:98
USER_BUTTON_PIN
#define USER_BUTTON_PIN
Definition at32f413_board.h:97
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
uart_print_init
void uart_print_init(uint32_t baudrate)
initialize uart
Definition at32f413_board.c:129
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_IOMUX_PERIPH_CLOCK
@ CRM_IOMUX_PERIPH_CLOCK
Definition at32f413_crm.h:108
EXINT0_IRQn
@ EXINT0_IRQn
Definition at32f413.h:177
exint_flag_clear
void exint_flag_clear(uint32_t exint_line)
clear exint flag
Definition at32f413_exint.c:125
exint_default_para_init
void exint_default_para_init(exint_init_type *exint_struct)
exint default para init
Definition at32f413_exint.c:63
exint_init
void exint_init(exint_init_type *exint_struct)
exint init
Definition at32f413_exint.c:77
EXINT_LINE_INTERRUPT
@ EXINT_LINE_INTERRUPT
Definition at32f413_exint.h:84
EXINT_TRIGGER_RISING_EDGE
@ EXINT_TRIGGER_RISING_EDGE
Definition at32f413_exint.h:93
EXINT_LINE_0
#define EXINT_LINE_0
Definition at32f413_exint.h:51
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
gpio_input_data_bit_read
flag_status gpio_input_data_bit_read(gpio_type *gpio_x, uint16_t pins)
read the specified input port pin.
Definition at32f413_gpio.c:202
gpio_exint_line_config
void gpio_exint_line_config(gpio_port_source_type gpio_port_source, gpio_pins_source_type gpio_pin_source)
select the gpio pin used as exint line.
Definition at32f413_gpio.c:605
GPIO_PINS_SOURCE0
@ GPIO_PINS_SOURCE0
Definition at32f413_gpio.h:253
GPIO_PORT_SOURCE_GPIOA
@ GPIO_PORT_SOURCE_GPIOA
Definition at32f413_gpio.h:276
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
at32f413_clock.h
header file of clock program
exint_init_type
exint init type
Definition at32f413_exint.h:102
exint_init_type::line_select
uint32_t line_select
Definition at32f413_exint.h:104
exint_init_type::line_enable
confirm_state line_enable
Definition at32f413_exint.h:106
exint_init_type::line_mode
exint_line_mode_type line_mode
Definition at32f413_exint.h:103
exint_init_type::line_polarity
exint_polarity_config_type line_polarity
Definition at32f413_exint.h:105


AT32F413 Firmwary Library: fir_filter.h Source File

  • utilities
  • at32f413_slib_demo
  • project_l0
  • inc
project_l0/inc/fir_filter.h
Go to the documentation of this file.
1
30/* Define to prevent recursive inclusion -------------------------------------*/
31#ifndef __FIR_FILTER_H
32#define __FIR_FILTER_H
33
34
35
36/* Includes ------------------------------------------------------------------*/
37#include "arm_math.h"
38
39/* Exported types ------------------------------------------------------------*/
40/* Exported constants --------------------------------------------------------*/
41/* Exported macro ------------------------------------------------------------*/
42/* Exported functions ------------------------------------------------------- */
43void arm_fir_init_f32(
44 arm_fir_instance_f32 * S,
45 uint16_t numTaps,
46 const float32_t * pCoeffs,
47 float32_t * pState,
48 uint32_t blockSize);
49
50void arm_fir_f32(
51const arm_fir_instance_f32 * S,
52const float32_t * pSrc,
53float32_t * pDst,
54uint32_t blockSize);
55
56void FIR_lowpass_filter(float32_t * pSrc, float32_t * pDst, uint32_t testlengthsamples);
57
58#endif /* __FIR_FILTER_H */
59
arm_fir_f32
void arm_fir_f32(const arm_fir_instance_f32 *S, const float32_t *pSrc, float32_t *pDst, uint32_t blockSize)
arm_fir_init_f32
void arm_fir_init_f32(arm_fir_instance_f32 *S, uint16_t numTaps, const float32_t *pCoeffs, float32_t *pState, uint32_t blockSize)
Initialization function for the floating-point FIR filter.
Definition arm_fir_init_f32.c:59
FIR_lowpass_filter
void FIR_lowpass_filter(float32_t *pSrc, float32_t *pDst, uint32_t testlengthsamples)
Definition fir_filter.c:76


AT32F413 Firmwary Library: math_helper.h Source File

  • utilities
  • at32f413_slib_demo
  • project_l0
  • inc
project_l0/inc/math_helper.h
Go to the documentation of this file.
1/* ----------------------------------------------------------------------
2* Copyright (C) 2010-2013 ARM Limited. All rights reserved.
3*
4* $Date: 17. January 2013
5* $Revision: V1.4.0
6*
7* Project: CMSIS DSP Library
8*
9* Title: math_helper.h
10*
11* Description: Prototypes of all helper functions required.
12*
13* Target Processor: Cortex-M4/Cortex-M3
14*
15* Redistribution and use in source and binary forms, with or without
16* modification, are permitted provided that the following conditions
17* are met:
18* - Redistributions of source code must retain the above copyright
19* notice, this list of conditions and the following disclaimer.
20* - Redistributions in binary form must reproduce the above copyright
21* notice, this list of conditions and the following disclaimer in
22* the documentation and/or other materials provided with the
23* distribution.
24* - Neither the name of ARM LIMITED nor the names of its contributors
25* may be used to endorse or promote products derived from this
26* software without specific prior written permission.
27*
28* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39* POSSIBILITY OF SUCH DAMAGE.
40* -------------------------------------------------------------------- */
41
42
43#include "arm_math.h"
44
45#ifndef MATH_HELPER_H
46#define MATH_HELPER_H
47
48float arm_snr_f32(float *pRef, float *pTest, uint32_t buffSize);
49void arm_float_to_q12_20(float *pIn, q31_t * pOut, uint32_t numSamples);
50void arm_provide_guard_bits_q15(q15_t *input_buf, uint32_t blockSize, uint32_t guard_bits);
51void arm_provide_guard_bits_q31(q31_t *input_buf, uint32_t blockSize, uint32_t guard_bits);
52void arm_float_to_q14(float *pIn, q15_t *pOut, uint32_t numSamples);
53void arm_float_to_q29(float *pIn, q31_t *pOut, uint32_t numSamples);
54void arm_float_to_q28(float *pIn, q31_t *pOut, uint32_t numSamples);
55void arm_float_to_q30(float *pIn, q31_t *pOut, uint32_t numSamples);
56uint32_t arm_calc_guard_bits(uint32_t num_adds);
57void arm_apply_guard_bits (float32_t * pIn, uint32_t numSamples, uint32_t guard_bits);
58uint32_t arm_compare_fixed_q15(q15_t *pIn, q15_t * pOut, uint32_t numSamples);
59uint32_t arm_compare_fixed_q31(q31_t *pIn, q31_t *pOut, uint32_t numSamples);
60uint32_t arm_calc_2pow(uint32_t guard_bits);
61#endif
62
arm_float_to_q29
void arm_float_to_q29(float *pIn, q31_t *pOut, uint32_t numSamples)
Converts float to fixed q30 format.
Definition project_l0/src/math_helper.c:392
arm_apply_guard_bits
void arm_apply_guard_bits(float32_t *pIn, uint32_t numSamples, uint32_t guard_bits)
Apply guard bits to buffer.
Definition project_l0/src/math_helper.c:294
arm_float_to_q30
void arm_float_to_q30(float *pIn, q31_t *pOut, uint32_t numSamples)
Converts float to fixed q30 format.
Definition project_l0/src/math_helper.c:365
arm_float_to_q14
void arm_float_to_q14(float *pIn, q15_t *pOut, uint32_t numSamples)
Converts float to fixed q14.
Definition project_l0/src/math_helper.c:335
arm_float_to_q12_20
void arm_float_to_q12_20(float *pIn, q31_t *pOut, uint32_t numSamples)
Converts float to fixed in q12.20 format.
Definition project_l0/src/math_helper.c:140
arm_compare_fixed_q31
uint32_t arm_compare_fixed_q31(q31_t *pIn, q31_t *pOut, uint32_t numSamples)
Compare MATLAB Reference Output and ARM Test output.
Definition project_l0/src/math_helper.c:194
arm_calc_guard_bits
uint32_t arm_calc_guard_bits(uint32_t num_adds)
Caluclates number of guard bits.
Definition project_l0/src/math_helper.c:268
arm_compare_fixed_q15
uint32_t arm_compare_fixed_q15(q15_t *pIn, q15_t *pOut, uint32_t numSamples)
Compare MATLAB Reference Output and ARM Test output.
Definition project_l0/src/math_helper.c:166
arm_calc_2pow
uint32_t arm_calc_2pow(uint32_t guard_bits)
Calculates pow(2, numShifts)
Definition project_l0/src/math_helper.c:311
arm_float_to_q28
void arm_float_to_q28(float *pIn, q31_t *pOut, uint32_t numSamples)
Converts float to fixed q28 format.
Definition project_l0/src/math_helper.c:420
arm_provide_guard_bits_q15
void arm_provide_guard_bits_q15(q15_t *input_buf, uint32_t blockSize, uint32_t guard_bits)
Provide guard bits for Input buffer.
Definition project_l0/src/math_helper.c:120
arm_provide_guard_bits_q31
void arm_provide_guard_bits_q31(q31_t *input_buf, uint32_t blockSize, uint32_t guard_bits)
Provide guard bits for Input buffer.
Definition project_l0/src/math_helper.c:224
arm_snr_f32
float arm_snr_f32(float *pRef, float *pTest, uint32_t buffSize)
Caluclation of SNR.
Definition project_l0/src/math_helper.c:62


AT32F413 Firmwary Library: arm_fir_data.c Source File

  • utilities
  • at32f413_slib_demo
  • project_l0
  • src
project_l0/src/arm_fir_data.c
Go to the documentation of this file.
1/* ----------------------------------------------------------------------
2* Copyright (C) 2010-2012 ARM Limited. All rights reserved.
3*
4* $Date: 17. January 2013
5* $Revision: V1.4.0
6*
7* Project: CMSIS DSP Library
8* Title: arm_fir_data.c
9*
10* Description: Data file used for example code
11*
12* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
13*
14* Redistribution and use in source and binary forms, with or without
15* modification, are permitted provided that the following conditions
16* are met:
17* - Redistributions of source code must retain the above copyright
18* notice, this list of conditions and the following disclaimer.
19* - Redistributions in binary form must reproduce the above copyright
20* notice, this list of conditions and the following disclaimer in
21* the documentation and/or other materials provided with the
22* distribution.
23* - Neither the name of ARM LIMITED nor the names of its contributors
24* may be used to endorse or promote products derived from this
25* software without specific prior written permission.
26*
27* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
30* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
31* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
32* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
33* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
34* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
35* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
37* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38* POSSIBILITY OF SUCH DAMAGE.
39* -------------------------------------------------------------------- */
40
41#include "at32f413.h"
42#include "arm_math.h"
43
44/* ----------------------------------------------------------------------
45** Test input signal contains 1000Hz + 15000 Hz
46** ------------------------------------------------------------------- */
47
48float32_t testInput_f32_1kHz_15kHz[320] =
49{
50+0.0000000000f, +0.5924659585f, -0.0947343455f, +0.1913417162f, +1.0000000000f, +0.4174197128f, +0.3535533906f, +1.2552931065f,
51+0.8660254038f, +0.4619397663f, +1.3194792169f, +1.1827865776f, +0.5000000000f, +1.1827865776f, +1.3194792169f, +0.4619397663f,
52+0.8660254038f, +1.2552931065f, +0.3535533906f, +0.4174197128f, +1.0000000000f, +0.1913417162f, -0.0947343455f, +0.5924659585f,
53-0.0000000000f, -0.5924659585f, +0.0947343455f, -0.1913417162f, -1.0000000000f, -0.4174197128f, -0.3535533906f, -1.2552931065f,
54-0.8660254038f, -0.4619397663f, -1.3194792169f, -1.1827865776f, -0.5000000000f, -1.1827865776f, -1.3194792169f, -0.4619397663f,
55-0.8660254038f, -1.2552931065f, -0.3535533906f, -0.4174197128f, -1.0000000000f, -0.1913417162f, +0.0947343455f, -0.5924659585f,
56+0.0000000000f, +0.5924659585f, -0.0947343455f, +0.1913417162f, +1.0000000000f, +0.4174197128f, +0.3535533906f, +1.2552931065f,
57+0.8660254038f, +0.4619397663f, +1.3194792169f, +1.1827865776f, +0.5000000000f, +1.1827865776f, +1.3194792169f, +0.4619397663f,
58+0.8660254038f, +1.2552931065f, +0.3535533906f, +0.4174197128f, +1.0000000000f, +0.1913417162f, -0.0947343455f, +0.5924659585f,
59+0.0000000000f, -0.5924659585f, +0.0947343455f, -0.1913417162f, -1.0000000000f, -0.4174197128f, -0.3535533906f, -1.2552931065f,
60-0.8660254038f, -0.4619397663f, -1.3194792169f, -1.1827865776f, -0.5000000000f, -1.1827865776f, -1.3194792169f, -0.4619397663f,
61-0.8660254038f, -1.2552931065f, -0.3535533906f, -0.4174197128f, -1.0000000000f, -0.1913417162f, +0.0947343455f, -0.5924659585f,
62+0.0000000000f, +0.5924659585f, -0.0947343455f, +0.1913417162f, +1.0000000000f, +0.4174197128f, +0.3535533906f, +1.2552931065f,
63+0.8660254038f, +0.4619397663f, +1.3194792169f, +1.1827865776f, +0.5000000000f, +1.1827865776f, +1.3194792169f, +0.4619397663f,
64+0.8660254038f, +1.2552931065f, +0.3535533906f, +0.4174197128f, +1.0000000000f, +0.1913417162f, -0.0947343455f, +0.5924659585f,
65+0.0000000000f, -0.5924659585f, +0.0947343455f, -0.1913417162f, -1.0000000000f, -0.4174197128f, -0.3535533906f, -1.2552931065f,
66-0.8660254038f, -0.4619397663f, -1.3194792169f, -1.1827865776f, -0.5000000000f, -1.1827865776f, -1.3194792169f, -0.4619397663f,
67-0.8660254038f, -1.2552931065f, -0.3535533906f, -0.4174197128f, -1.0000000000f, -0.1913417162f, +0.0947343455f, -0.5924659585f,
68-0.0000000000f, +0.5924659585f, -0.0947343455f, +0.1913417162f, +1.0000000000f, +0.4174197128f, +0.3535533906f, +1.2552931065f,
69+0.8660254038f, +0.4619397663f, +1.3194792169f, +1.1827865776f, +0.5000000000f, +1.1827865776f, +1.3194792169f, +0.4619397663f,
70+0.8660254038f, +1.2552931065f, +0.3535533906f, +0.4174197128f, +1.0000000000f, +0.1913417162f, -0.0947343455f, +0.5924659585f,
71-0.0000000000f, -0.5924659585f, +0.0947343455f, -0.1913417162f, -1.0000000000f, -0.4174197128f, -0.3535533906f, -1.2552931065f,
72-0.8660254038f, -0.4619397663f, -1.3194792169f, -1.1827865776f, -0.5000000000f, -1.1827865776f, -1.3194792169f, -0.4619397663f,
73-0.8660254038f, -1.2552931065f, -0.3535533906f, -0.4174197128f, -1.0000000000f, -0.1913417162f, +0.0947343455f, -0.5924659585f,
74+0.0000000000f, +0.5924659585f, -0.0947343455f, +0.1913417162f, +1.0000000000f, +0.4174197128f, +0.3535533906f, +1.2552931065f,
75+0.8660254038f, +0.4619397663f, +1.3194792169f, +1.1827865776f, +0.5000000000f, +1.1827865776f, +1.3194792169f, +0.4619397663f,
76+0.8660254038f, +1.2552931065f, +0.3535533906f, +0.4174197128f, +1.0000000000f, +0.1913417162f, -0.0947343455f, +0.5924659585f,
77+0.0000000000f, -0.5924659585f, +0.0947343455f, -0.1913417162f, -1.0000000000f, -0.4174197128f, -0.3535533906f, -1.2552931065f,
78-0.8660254038f, -0.4619397663f, -1.3194792169f, -1.1827865776f, -0.5000000000f, -1.1827865776f, -1.3194792169f, -0.4619397663f,
79-0.8660254038f, -1.2552931065f, -0.3535533906f, -0.4174197128f, -1.0000000000f, -0.1913417162f, +0.0947343455f, -0.5924659585f,
80-0.0000000000f, +0.5924659585f, -0.0947343455f, +0.1913417162f, +1.0000000000f, +0.4174197128f, +0.3535533906f, +1.2552931065f,
81+0.8660254038f, +0.4619397663f, +1.3194792169f, +1.1827865776f, +0.5000000000f, +1.1827865776f, +1.3194792169f, +0.4619397663f,
82+0.8660254038f, +1.2552931065f, +0.3535533906f, +0.4174197128f, +1.0000000000f, +0.1913417162f, -0.0947343455f, +0.5924659585f,
83+0.0000000000f, -0.5924659585f, +0.0947343455f, -0.1913417162f, -1.0000000000f, -0.4174197128f, -0.3535533906f, -1.2552931065f,
84-0.8660254038f, -0.4619397663f, -1.3194792169f, -1.1827865776f, -0.5000000000f, -1.1827865776f, -1.3194792169f, -0.4619397663f,
85-0.8660254038f, -1.2552931065f, -0.3535533906f, -0.4174197128f, -1.0000000000f, -0.1913417162f, +0.0947343455f, -0.5924659585f,
86-0.0000000000f, +0.5924659585f, -0.0947343455f, +0.1913417162f, +1.0000000000f, +0.4174197128f, +0.3535533906f, +1.2552931065f,
87+0.8660254038f, +0.4619397663f, +1.3194792169f, +1.1827865776f, +0.5000000000f, +1.1827865776f, +1.3194792169f, +0.4619397663f,
88+0.8660254038f, +1.2552931065f, +0.3535533906f, +0.4174197128f, +1.0000000000f, +0.1913417162f, -0.0947343455f, +0.5924659585f,
89+0.0000000000f, -0.5924659585f, +0.0947343455f, -0.1913417162f, -1.0000000000f, -0.4174197128f, -0.3535533906f, -1.2552931065f,
90};
91
92/* ----------------------------------------------------------------------
93** Reference output signal computed with MATLAB
94** ------------------------------------------------------------------- */
95
96float32_t refOutput[320] =
97{
98+0.0000000000f, -0.0010797829f, -0.0007681386f, -0.0001982932f, +0.0000644313f, +0.0020854271f, +0.0036891871f, +0.0015855941f,
99-0.0026280805f, -0.0075907658f, -0.0119390538f, -0.0086665968f, +0.0088981202f, +0.0430539279f, +0.0974468742f, +0.1740405600f,
100+0.2681416601f, +0.3747720089f, +0.4893362230f, +0.6024154672f, +0.7058740791f, +0.7968348987f, +0.8715901940f, +0.9277881093f,
101+0.9682182661f, +0.9934674267f, +1.0012052245f, +0.9925859371f, +0.9681538347f, +0.9257026822f, +0.8679010068f, +0.7952493046f,
102+0.7085021596f, +0.6100062330f, +0.5012752767f, +0.3834386057f, +0.2592435399f, +0.1309866321f, -0.0000000000f, -0.1309866321f,
103-0.2592435399f, -0.3834386057f, -0.5012752767f, -0.6100062330f, -0.7085021596f, -0.7952493046f, -0.8679010068f, -0.9257026822f,
104-0.9681538347f, -0.9936657199f, -1.0019733630f, -0.9936657199f, -0.9681538347f, -0.9257026822f, -0.8679010068f, -0.7952493046f,
105-0.7085021596f, -0.6100062330f, -0.5012752767f, -0.3834386057f, -0.2592435399f, -0.1309866321f, +0.0000000000f, +0.1309866321f,
106+0.2592435399f, +0.3834386057f, +0.5012752767f, +0.6100062330f, +0.7085021596f, +0.7952493046f, +0.8679010068f, +0.9257026822f,
107+0.9681538347f, +0.9936657199f, +1.0019733630f, +0.9936657199f, +0.9681538347f, +0.9257026822f, +0.8679010068f, +0.7952493046f,
108+0.7085021596f, +0.6100062330f, +0.5012752767f, +0.3834386057f, +0.2592435399f, +0.1309866321f, -0.0000000000f, -0.1309866321f,
109-0.2592435399f, -0.3834386057f, -0.5012752767f, -0.6100062330f, -0.7085021596f, -0.7952493046f, -0.8679010068f, -0.9257026822f,
110-0.9681538347f, -0.9936657199f, -1.0019733630f, -0.9936657199f, -0.9681538347f, -0.9257026822f, -0.8679010068f, -0.7952493046f,
111-0.7085021596f, -0.6100062330f, -0.5012752767f, -0.3834386057f, -0.2592435399f, -0.1309866321f, +0.0000000000f, +0.1309866321f,
112+0.2592435399f, +0.3834386057f, +0.5012752767f, +0.6100062330f, +0.7085021596f, +0.7952493046f, +0.8679010068f, +0.9257026822f,
113+0.9681538347f, +0.9936657199f, +1.0019733630f, +0.9936657199f, +0.9681538347f, +0.9257026822f, +0.8679010068f, +0.7952493046f,
114+0.7085021596f, +0.6100062330f, +0.5012752767f, +0.3834386057f, +0.2592435399f, +0.1309866321f, -0.0000000000f, -0.1309866321f,
115-0.2592435399f, -0.3834386057f, -0.5012752767f, -0.6100062330f, -0.7085021596f, -0.7952493046f, -0.8679010068f, -0.9257026822f,
116-0.9681538347f, -0.9936657199f, -1.0019733630f, -0.9936657199f, -0.9681538347f, -0.9257026822f, -0.8679010068f, -0.7952493046f,
117-0.7085021596f, -0.6100062330f, -0.5012752767f, -0.3834386057f, -0.2592435399f, -0.1309866321f, +0.0000000000f, +0.1309866321f,
118+0.2592435399f, +0.3834386057f, +0.5012752767f, +0.6100062330f, +0.7085021596f, +0.7952493046f, +0.8679010068f, +0.9257026822f,
119+0.9681538347f, +0.9936657199f, +1.0019733630f, +0.9936657199f, +0.9681538347f, +0.9257026822f, +0.8679010068f, +0.7952493046f,
120+0.7085021596f, +0.6100062330f, +0.5012752767f, +0.3834386057f, +0.2592435399f, +0.1309866321f, +0.0000000000f, -0.1309866321f,
121-0.2592435399f, -0.3834386057f, -0.5012752767f, -0.6100062330f, -0.7085021596f, -0.7952493046f, -0.8679010068f, -0.9257026822f,
122-0.9681538347f, -0.9936657199f, -1.0019733630f, -0.9936657199f, -0.9681538347f, -0.9257026822f, -0.8679010068f, -0.7952493046f,
123-0.7085021596f, -0.6100062330f, -0.5012752767f, -0.3834386057f, -0.2592435399f, -0.1309866321f, +0.0000000000f, +0.1309866321f,
124+0.2592435399f, +0.3834386057f, +0.5012752767f, +0.6100062330f, +0.7085021596f, +0.7952493046f, +0.8679010068f, +0.9257026822f,
125+0.9681538347f, +0.9936657199f, +1.0019733630f, +0.9936657199f, +0.9681538347f, +0.9257026822f, +0.8679010068f, +0.7952493046f,
126+0.7085021596f, +0.6100062330f, +0.5012752767f, +0.3834386057f, +0.2592435399f, +0.1309866321f, +0.0000000000f, -0.1309866321f,
127-0.2592435399f, -0.3834386057f, -0.5012752767f, -0.6100062330f, -0.7085021596f, -0.7952493046f, -0.8679010068f, -0.9257026822f,
128-0.9681538347f, -0.9936657199f, -1.0019733630f, -0.9936657199f, -0.9681538347f, -0.9257026822f, -0.8679010068f, -0.7952493046f,
129-0.7085021596f, -0.6100062330f, -0.5012752767f, -0.3834386057f, -0.2592435399f, -0.1309866321f, -0.0000000000f, +0.1309866321f,
130+0.2592435399f, +0.3834386057f, +0.5012752767f, +0.6100062330f, +0.7085021596f, +0.7952493046f, +0.8679010068f, +0.9257026822f,
131+0.9681538347f, +0.9936657199f, +1.0019733630f, +0.9936657199f, +0.9681538347f, +0.9257026822f, +0.8679010068f, +0.7952493046f,
132+0.7085021596f, +0.6100062330f, +0.5012752767f, +0.3834386057f, +0.2592435399f, +0.1309866321f, +0.0000000000f, -0.1309866321f,
133-0.2592435399f, -0.3834386057f, -0.5012752767f, -0.6100062330f, -0.7085021596f, -0.7952493046f, -0.8679010068f, -0.9257026822f,
134-0.9681538347f, -0.9936657199f, -1.0019733630f, -0.9936657199f, -0.9681538347f, -0.9257026822f, -0.8679010068f, -0.7952493046f,
135-0.7085021596f, -0.6100062330f, -0.5012752767f, -0.3834386057f, -0.2592435399f, -0.1309866321f, +0.0000000000f, +0.1309866321f,
136+0.2592435399f, +0.3834386057f, +0.5012752767f, +0.6100062330f, +0.7085021596f, +0.7952493046f, +0.8679010068f, +0.9257026822f,
137+0.9681538347f, +0.9936657199f, +1.0019733630f, +0.9936657199f, +0.9681538347f, +0.9257026822f, +0.8679010068f, +0.7952493046f
138};
139
at32f413.h
at32f413 header file
testInput_f32_1kHz_15kHz
float32_t testInput_f32_1kHz_15kHz[320]
Definition project_l0/src/arm_fir_data.c:48
refOutput
float32_t refOutput[320]
Definition project_l0/src/arm_fir_data.c:96


AT32F413 Firmwary Library: math_helper.c Source File

  • utilities
  • at32f413_slib_demo
  • project_l0
  • src
project_l0/src/math_helper.c
Go to the documentation of this file.
1/* ----------------------------------------------------------------------
2* Copyright (C) 2010-2012 ARM Limited. All rights reserved.
3*
4* $Date: 17. January 2013
5* $Revision: V1.4.0 b
6*
7* Project: CMSIS DSP Library
8*
9* Title: math_helper.c
10*
11* Description: Definition of all helper functions required.
12*
13* Target Processor: Cortex-M4/Cortex-M3
14*
15* Redistribution and use in source and binary forms, with or without
16* modification, are permitted provided that the following conditions
17* are met:
18* - Redistributions of source code must retain the above copyright
19* notice, this list of conditions and the following disclaimer.
20* - Redistributions in binary form must reproduce the above copyright
21* notice, this list of conditions and the following disclaimer in
22* the documentation and/or other materials provided with the
23* distribution.
24* - Neither the name of ARM LIMITED nor the names of its contributors
25* may be used to endorse or promote products derived from this
26* software without specific prior written permission.
27*
28* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39* POSSIBILITY OF SUCH DAMAGE.
40* -------------------------------------------------------------------- */
41
42/* ----------------------------------------------------------------------
43* Include standard header files
44* -------------------------------------------------------------------- */
45#include<math.h>
46
47/* ----------------------------------------------------------------------
48* Include project header files
49* -------------------------------------------------------------------- */
50#include "math_helper.h"
51
62float arm_snr_f32(float *pRef, float *pTest, uint32_t buffSize)
63{
64 float EnergySignal = 0.0, EnergyError = 0.0;
65 uint32_t i;
66 float SNR;
67 int temp;
68 int *test;
69
70 for (i = 0; i < buffSize; i++)
71 {
72 /* Checking for a NAN value in pRef array */
73 test = (int *)(&pRef[i]);
74 temp = *test;
75
76 if (temp == 0x7FC00000)
77 {
78 return(0);
79 }
80
81 /* Checking for a NAN value in pTest array */
82 test = (int *)(&pTest[i]);
83 temp = *test;
84
85 if (temp == 0x7FC00000)
86 {
87 return(0);
88 }
89 EnergySignal += pRef[i] * pRef[i];
90 EnergyError += (pRef[i] - pTest[i]) * (pRef[i] - pTest[i]);
91 }
92
93 /* Checking for a NAN value in EnergyError */
94 test = (int *)(&EnergyError);
95 temp = *test;
96
97 if (temp == 0x7FC00000)
98 {
99 return(0);
100 }
101
102
103 SNR = 10 * log10 (EnergySignal / EnergyError);
104
105 return (SNR);
106
107}
108
109
120void arm_provide_guard_bits_q15 (q15_t * input_buf, uint32_t blockSize,
121 uint32_t guard_bits)
122{
123 uint32_t i;
124
125 for (i = 0; i < blockSize; i++)
126 {
127 input_buf[i] = input_buf[i] >> guard_bits;
128 }
129}
130
140void arm_float_to_q12_20(float *pIn, q31_t * pOut, uint32_t numSamples)
141{
142 uint32_t i;
143
144 for (i = 0; i < numSamples; i++)
145 {
146 /* 1048576.0f corresponds to pow(2, 20) */
147 pOut[i] = (q31_t) (pIn[i] * 1048576.0f);
148
149 pOut[i] += pIn[i] > 0 ? 0.5 : -0.5;
150
151 if (pIn[i] == (float) 1.0)
152 {
153 pOut[i] = 0x000FFFFF;
154 }
155 }
156}
157
166uint32_t arm_compare_fixed_q15(q15_t *pIn, q15_t *pOut, uint32_t numSamples)
167{
168 uint32_t i;
169 int32_t diff, diffCrnt = 0;
170 uint32_t maxDiff = 0;
171
172 for (i = 0; i < numSamples; i++)
173 {
174 diff = pIn[i] - pOut[i];
175 diffCrnt = (diff > 0) ? diff : -diff;
176
177 if (diffCrnt > maxDiff)
178 {
179 maxDiff = diffCrnt;
180 }
181 }
182
183 return(maxDiff);
184}
185
194uint32_t arm_compare_fixed_q31(q31_t *pIn, q31_t * pOut, uint32_t numSamples)
195{
196 uint32_t i;
197 int32_t diff, diffCrnt = 0;
198 uint32_t maxDiff = 0;
199
200 for (i = 0; i < numSamples; i++)
201 {
202 diff = pIn[i] - pOut[i];
203 diffCrnt = (diff > 0) ? diff : -diff;
204
205 if (diffCrnt > maxDiff)
206 {
207 maxDiff = diffCrnt;
208 }
209 }
210
211 return(maxDiff);
212}
213
224void arm_provide_guard_bits_q31 (q31_t * input_buf,
225 uint32_t blockSize,
226 uint32_t guard_bits)
227{
228 uint32_t i;
229
230 for (i = 0; i < blockSize; i++)
231 {
232 input_buf[i] = input_buf[i] >> guard_bits;
233 }
234}
235
246void arm_provide_guard_bits_q7 (q7_t * input_buf,
247 uint32_t blockSize,
248 uint32_t guard_bits)
249{
250 uint32_t i;
251
252 for (i = 0; i < blockSize; i++)
253 {
254 input_buf[i] = input_buf[i] >> guard_bits;
255 }
256}
257
258
259
268uint32_t arm_calc_guard_bits (uint32_t num_adds)
269{
270 uint32_t i = 1, j = 0;
271
272 if (num_adds == 1)
273 {
274 return (0);
275 }
276
277 while (i < num_adds)
278 {
279 i = i * 2;
280 j++;
281 }
282
283 return (j);
284}
285
294void arm_apply_guard_bits (float32_t *pIn,
295 uint32_t numSamples,
296 uint32_t guard_bits)
297{
298 uint32_t i;
299
300 for (i = 0; i < numSamples; i++)
301 {
302 pIn[i] = pIn[i] * arm_calc_2pow(guard_bits);
303 }
304}
305
311uint32_t arm_calc_2pow(uint32_t numShifts)
312{
313
314 uint32_t i, val = 1;
315
316 for (i = 0; i < numShifts; i++)
317 {
318 val = val * 2;
319 }
320
321 return(val);
322}
323
324
325
335void arm_float_to_q14 (float *pIn, q15_t *pOut, uint32_t numSamples)
336{
337 uint32_t i;
338
339 for (i = 0; i < numSamples; i++)
340 {
341 /* 16384.0f corresponds to pow(2, 14) */
342 pOut[i] = (q15_t) (pIn[i] * 16384.0f);
343
344 pOut[i] += pIn[i] > 0 ? 0.5 : -0.5;
345
346 if (pIn[i] == (float) 2.0)
347 {
348 pOut[i] = 0x7FFF;
349 }
350
351 }
352
353}
354
355
365void arm_float_to_q30 (float *pIn, q31_t * pOut, uint32_t numSamples)
366{
367 uint32_t i;
368
369 for (i = 0; i < numSamples; i++)
370 {
371 /* 1073741824.0f corresponds to pow(2, 30) */
372 pOut[i] = (q31_t) (pIn[i] * 1073741824.0f);
373
374 pOut[i] += pIn[i] > 0 ? 0.5 : -0.5;
375
376 if (pIn[i] == (float) 2.0)
377 {
378 pOut[i] = 0x7FFFFFFF;
379 }
380 }
381}
382
392void arm_float_to_q29 (float *pIn, q31_t *pOut, uint32_t numSamples)
393{
394 uint32_t i;
395
396 for (i = 0; i < numSamples; i++)
397 {
398 /* 1073741824.0f corresponds to pow(2, 30) */
399 pOut[i] = (q31_t) (pIn[i] * 536870912.0f);
400
401 pOut[i] += pIn[i] > 0 ? 0.5 : -0.5;
402
403 if (pIn[i] == (float) 4.0)
404 {
405 pOut[i] = 0x7FFFFFFF;
406 }
407 }
408}
409
410
420void arm_float_to_q28 (float *pIn, q31_t *pOut, uint32_t numSamples)
421{
422 uint32_t i;
423
424 for (i = 0; i < numSamples; i++)
425 {
426 /* 268435456.0f corresponds to pow(2, 28) */
427 pOut[i] = (q31_t) (pIn[i] * 268435456.0f);
428
429 pOut[i] += pIn[i] > 0 ? 0.5 : -0.5;
430
431 if (pIn[i] == (float) 8.0)
432 {
433 pOut[i] = 0x7FFFFFFF;
434 }
435 }
436}
437
438
439/*
440
441Conflicting with the new clip functions in CMSIS-DSP and not used
442in the examples.
443
444*/
445#if 0
454void arm_clip_f32 (float *pIn, uint32_t numSamples)
455{
456 uint32_t i;
457
458 for (i = 0; i < numSamples; i++)
459 {
460 if (pIn[i] > 1.0f)
461 {
462 pIn[i] = 1.0;
463 }
464 else if ( pIn[i] < -1.0f)
465 {
466 pIn[i] = -1.0;
467 }
468
469 }
470}
471
472#endif
473
474
arm_float_to_q29
void arm_float_to_q29(float *pIn, q31_t *pOut, uint32_t numSamples)
Converts float to fixed q30 format.
Definition project_l0/src/math_helper.c:392
arm_apply_guard_bits
void arm_apply_guard_bits(float32_t *pIn, uint32_t numSamples, uint32_t guard_bits)
Apply guard bits to buffer.
Definition project_l0/src/math_helper.c:294
arm_float_to_q30
void arm_float_to_q30(float *pIn, q31_t *pOut, uint32_t numSamples)
Converts float to fixed q30 format.
Definition project_l0/src/math_helper.c:365
arm_float_to_q14
void arm_float_to_q14(float *pIn, q15_t *pOut, uint32_t numSamples)
Converts float to fixed q14.
Definition project_l0/src/math_helper.c:335
arm_float_to_q12_20
void arm_float_to_q12_20(float *pIn, q31_t *pOut, uint32_t numSamples)
Converts float to fixed in q12.20 format.
Definition project_l0/src/math_helper.c:140
arm_compare_fixed_q31
uint32_t arm_compare_fixed_q31(q31_t *pIn, q31_t *pOut, uint32_t numSamples)
Compare MATLAB Reference Output and ARM Test output.
Definition project_l0/src/math_helper.c:194
arm_provide_guard_bits_q7
void arm_provide_guard_bits_q7(q7_t *input_buf, uint32_t blockSize, uint32_t guard_bits)
Provide guard bits for Input buffer.
Definition project_l0/src/math_helper.c:246
arm_calc_guard_bits
uint32_t arm_calc_guard_bits(uint32_t num_adds)
Caluclates number of guard bits.
Definition project_l0/src/math_helper.c:268
arm_compare_fixed_q15
uint32_t arm_compare_fixed_q15(q15_t *pIn, q15_t *pOut, uint32_t numSamples)
Compare MATLAB Reference Output and ARM Test output.
Definition project_l0/src/math_helper.c:166
arm_float_to_q28
void arm_float_to_q28(float *pIn, q31_t *pOut, uint32_t numSamples)
Converts float to fixed q28 format.
Definition project_l0/src/math_helper.c:420
arm_provide_guard_bits_q15
void arm_provide_guard_bits_q15(q15_t *input_buf, uint32_t blockSize, uint32_t guard_bits)
Provide guard bits for Input buffer.
Definition project_l0/src/math_helper.c:120
arm_calc_2pow
uint32_t arm_calc_2pow(uint32_t numShifts)
Calculates pow(2, numShifts)
Definition project_l0/src/math_helper.c:311
arm_provide_guard_bits_q31
void arm_provide_guard_bits_q31(q31_t *input_buf, uint32_t blockSize, uint32_t guard_bits)
Provide guard bits for Input buffer.
Definition project_l0/src/math_helper.c:224
arm_snr_f32
float arm_snr_f32(float *pRef, float *pTest, uint32_t buffSize)
Caluclation of SNR.
Definition project_l0/src/math_helper.c:62


AT32F413 Firmwary Library: fir_filter.h Source File

  • utilities
  • at32f413_slib_demo
  • project_l1
  • inc
project_l1/inc/fir_filter.h
Go to the documentation of this file.
1
30/* Define to prevent recursive inclusion -------------------------------------*/
31#ifndef __FIR_FILTER_H
32#define __FIR_FILTER_H
33
34
35
36/* Includes ------------------------------------------------------------------*/
37#include "arm_math.h"
38
39/* Exported types ------------------------------------------------------------*/
40/* Exported constants --------------------------------------------------------*/
41/* Exported macro ------------------------------------------------------------*/
42/* Exported functions ------------------------------------------------------- */
43void arm_fir_init_f32(
44 arm_fir_instance_f32 * S,
45 uint16_t numTaps,
46 const float32_t * pCoeffs,
47 float32_t * pState,
48 uint32_t blockSize);
49
50void arm_fir_f32(
51const arm_fir_instance_f32 * S,
52const float32_t * pSrc,
53float32_t * pDst,
54uint32_t blockSize);
55
56void FIR_lowpass_filter(float32_t * pSrc, float32_t * pDst, uint32_t testlengthsamples);
57
58#endif /* __FIR_FILTER_H */
59
arm_fir_f32
void arm_fir_f32(const arm_fir_instance_f32 *S, const float32_t *pSrc, float32_t *pDst, uint32_t blockSize)
arm_fir_init_f32
void arm_fir_init_f32(arm_fir_instance_f32 *S, uint16_t numTaps, const float32_t *pCoeffs, float32_t *pState, uint32_t blockSize)
Initialization function for the floating-point FIR filter.
Definition arm_fir_init_f32.c:59
FIR_lowpass_filter
void FIR_lowpass_filter(float32_t *pSrc, float32_t *pDst, uint32_t testlengthsamples)
Definition fir_filter.c:76


AT32F413 Firmwary Library: math_helper.h Source File

  • utilities
  • at32f413_slib_demo
  • project_l1
  • inc
project_l1/inc/math_helper.h
Go to the documentation of this file.
1/* ----------------------------------------------------------------------
2* Copyright (C) 2010-2013 ARM Limited. All rights reserved.
3*
4* $Date: 17. January 2013
5* $Revision: V1.4.0
6*
7* Project: CMSIS DSP Library
8*
9* Title: math_helper.h
10*
11* Description: Prototypes of all helper functions required.
12*
13* Target Processor: Cortex-M4/Cortex-M3
14*
15* Redistribution and use in source and binary forms, with or without
16* modification, are permitted provided that the following conditions
17* are met:
18* - Redistributions of source code must retain the above copyright
19* notice, this list of conditions and the following disclaimer.
20* - Redistributions in binary form must reproduce the above copyright
21* notice, this list of conditions and the following disclaimer in
22* the documentation and/or other materials provided with the
23* distribution.
24* - Neither the name of ARM LIMITED nor the names of its contributors
25* may be used to endorse or promote products derived from this
26* software without specific prior written permission.
27*
28* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39* POSSIBILITY OF SUCH DAMAGE.
40* -------------------------------------------------------------------- */
41
42
43#include "arm_math.h"
44
45#ifndef MATH_HELPER_H
46#define MATH_HELPER_H
47
48float arm_snr_f32(float *pRef, float *pTest, uint32_t buffSize);
49void arm_float_to_q12_20(float *pIn, q31_t * pOut, uint32_t numSamples);
50void arm_provide_guard_bits_q15(q15_t *input_buf, uint32_t blockSize, uint32_t guard_bits);
51void arm_provide_guard_bits_q31(q31_t *input_buf, uint32_t blockSize, uint32_t guard_bits);
52void arm_float_to_q14(float *pIn, q15_t *pOut, uint32_t numSamples);
53void arm_float_to_q29(float *pIn, q31_t *pOut, uint32_t numSamples);
54void arm_float_to_q28(float *pIn, q31_t *pOut, uint32_t numSamples);
55void arm_float_to_q30(float *pIn, q31_t *pOut, uint32_t numSamples);
56uint32_t arm_calc_guard_bits(uint32_t num_adds);
57void arm_apply_guard_bits (float32_t * pIn, uint32_t numSamples, uint32_t guard_bits);
58uint32_t arm_compare_fixed_q15(q15_t *pIn, q15_t * pOut, uint32_t numSamples);
59uint32_t arm_compare_fixed_q31(q31_t *pIn, q31_t *pOut, uint32_t numSamples);
60uint32_t arm_calc_2pow(uint32_t guard_bits);
61#endif
62
arm_float_to_q29
void arm_float_to_q29(float *pIn, q31_t *pOut, uint32_t numSamples)
Converts float to fixed q30 format.
Definition project_l0/src/math_helper.c:392
arm_apply_guard_bits
void arm_apply_guard_bits(float32_t *pIn, uint32_t numSamples, uint32_t guard_bits)
Apply guard bits to buffer.
Definition project_l0/src/math_helper.c:294
arm_float_to_q30
void arm_float_to_q30(float *pIn, q31_t *pOut, uint32_t numSamples)
Converts float to fixed q30 format.
Definition project_l0/src/math_helper.c:365
arm_float_to_q14
void arm_float_to_q14(float *pIn, q15_t *pOut, uint32_t numSamples)
Converts float to fixed q14.
Definition project_l0/src/math_helper.c:335
arm_float_to_q12_20
void arm_float_to_q12_20(float *pIn, q31_t *pOut, uint32_t numSamples)
Converts float to fixed in q12.20 format.
Definition project_l0/src/math_helper.c:140
arm_compare_fixed_q31
uint32_t arm_compare_fixed_q31(q31_t *pIn, q31_t *pOut, uint32_t numSamples)
Compare MATLAB Reference Output and ARM Test output.
Definition project_l0/src/math_helper.c:194
arm_calc_guard_bits
uint32_t arm_calc_guard_bits(uint32_t num_adds)
Caluclates number of guard bits.
Definition project_l0/src/math_helper.c:268
arm_compare_fixed_q15
uint32_t arm_compare_fixed_q15(q15_t *pIn, q15_t *pOut, uint32_t numSamples)
Compare MATLAB Reference Output and ARM Test output.
Definition project_l0/src/math_helper.c:166
arm_calc_2pow
uint32_t arm_calc_2pow(uint32_t guard_bits)
Calculates pow(2, numShifts)
Definition project_l0/src/math_helper.c:311
arm_float_to_q28
void arm_float_to_q28(float *pIn, q31_t *pOut, uint32_t numSamples)
Converts float to fixed q28 format.
Definition project_l0/src/math_helper.c:420
arm_provide_guard_bits_q15
void arm_provide_guard_bits_q15(q15_t *input_buf, uint32_t blockSize, uint32_t guard_bits)
Provide guard bits for Input buffer.
Definition project_l0/src/math_helper.c:120
arm_provide_guard_bits_q31
void arm_provide_guard_bits_q31(q31_t *input_buf, uint32_t blockSize, uint32_t guard_bits)
Provide guard bits for Input buffer.
Definition project_l0/src/math_helper.c:224
arm_snr_f32
float arm_snr_f32(float *pRef, float *pTest, uint32_t buffSize)
Caluclation of SNR.
Definition project_l0/src/math_helper.c:62


AT32F413 Firmwary Library: arm_fir_data.c Source File

  • utilities
  • at32f413_slib_demo
  • project_l1
  • src
project_l1/src/arm_fir_data.c
Go to the documentation of this file.
1/* ----------------------------------------------------------------------
2* Copyright (C) 2010-2012 ARM Limited. All rights reserved.
3*
4* $Date: 17. January 2013
5* $Revision: V1.4.0
6*
7* Project: CMSIS DSP Library
8* Title: arm_fir_data.c
9*
10* Description: Data file used for example code
11*
12* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
13*
14* Redistribution and use in source and binary forms, with or without
15* modification, are permitted provided that the following conditions
16* are met:
17* - Redistributions of source code must retain the above copyright
18* notice, this list of conditions and the following disclaimer.
19* - Redistributions in binary form must reproduce the above copyright
20* notice, this list of conditions and the following disclaimer in
21* the documentation and/or other materials provided with the
22* distribution.
23* - Neither the name of ARM LIMITED nor the names of its contributors
24* may be used to endorse or promote products derived from this
25* software without specific prior written permission.
26*
27* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
30* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
31* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
32* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
33* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
34* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
35* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
37* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38* POSSIBILITY OF SUCH DAMAGE.
39* -------------------------------------------------------------------- */
40
41#include "at32f413.h"
42#include "arm_math.h"
43
44/* ----------------------------------------------------------------------
45** Test input signal contains 1000Hz + 15000 Hz
46** ------------------------------------------------------------------- */
47
48float32_t testInput_f32_1kHz_15kHz[320] =
49{
50+0.0000000000f, +0.5924659585f, -0.0947343455f, +0.1913417162f, +1.0000000000f, +0.4174197128f, +0.3535533906f, +1.2552931065f,
51+0.8660254038f, +0.4619397663f, +1.3194792169f, +1.1827865776f, +0.5000000000f, +1.1827865776f, +1.3194792169f, +0.4619397663f,
52+0.8660254038f, +1.2552931065f, +0.3535533906f, +0.4174197128f, +1.0000000000f, +0.1913417162f, -0.0947343455f, +0.5924659585f,
53-0.0000000000f, -0.5924659585f, +0.0947343455f, -0.1913417162f, -1.0000000000f, -0.4174197128f, -0.3535533906f, -1.2552931065f,
54-0.8660254038f, -0.4619397663f, -1.3194792169f, -1.1827865776f, -0.5000000000f, -1.1827865776f, -1.3194792169f, -0.4619397663f,
55-0.8660254038f, -1.2552931065f, -0.3535533906f, -0.4174197128f, -1.0000000000f, -0.1913417162f, +0.0947343455f, -0.5924659585f,
56+0.0000000000f, +0.5924659585f, -0.0947343455f, +0.1913417162f, +1.0000000000f, +0.4174197128f, +0.3535533906f, +1.2552931065f,
57+0.8660254038f, +0.4619397663f, +1.3194792169f, +1.1827865776f, +0.5000000000f, +1.1827865776f, +1.3194792169f, +0.4619397663f,
58+0.8660254038f, +1.2552931065f, +0.3535533906f, +0.4174197128f, +1.0000000000f, +0.1913417162f, -0.0947343455f, +0.5924659585f,
59+0.0000000000f, -0.5924659585f, +0.0947343455f, -0.1913417162f, -1.0000000000f, -0.4174197128f, -0.3535533906f, -1.2552931065f,
60-0.8660254038f, -0.4619397663f, -1.3194792169f, -1.1827865776f, -0.5000000000f, -1.1827865776f, -1.3194792169f, -0.4619397663f,
61-0.8660254038f, -1.2552931065f, -0.3535533906f, -0.4174197128f, -1.0000000000f, -0.1913417162f, +0.0947343455f, -0.5924659585f,
62+0.0000000000f, +0.5924659585f, -0.0947343455f, +0.1913417162f, +1.0000000000f, +0.4174197128f, +0.3535533906f, +1.2552931065f,
63+0.8660254038f, +0.4619397663f, +1.3194792169f, +1.1827865776f, +0.5000000000f, +1.1827865776f, +1.3194792169f, +0.4619397663f,
64+0.8660254038f, +1.2552931065f, +0.3535533906f, +0.4174197128f, +1.0000000000f, +0.1913417162f, -0.0947343455f, +0.5924659585f,
65+0.0000000000f, -0.5924659585f, +0.0947343455f, -0.1913417162f, -1.0000000000f, -0.4174197128f, -0.3535533906f, -1.2552931065f,
66-0.8660254038f, -0.4619397663f, -1.3194792169f, -1.1827865776f, -0.5000000000f, -1.1827865776f, -1.3194792169f, -0.4619397663f,
67-0.8660254038f, -1.2552931065f, -0.3535533906f, -0.4174197128f, -1.0000000000f, -0.1913417162f, +0.0947343455f, -0.5924659585f,
68-0.0000000000f, +0.5924659585f, -0.0947343455f, +0.1913417162f, +1.0000000000f, +0.4174197128f, +0.3535533906f, +1.2552931065f,
69+0.8660254038f, +0.4619397663f, +1.3194792169f, +1.1827865776f, +0.5000000000f, +1.1827865776f, +1.3194792169f, +0.4619397663f,
70+0.8660254038f, +1.2552931065f, +0.3535533906f, +0.4174197128f, +1.0000000000f, +0.1913417162f, -0.0947343455f, +0.5924659585f,
71-0.0000000000f, -0.5924659585f, +0.0947343455f, -0.1913417162f, -1.0000000000f, -0.4174197128f, -0.3535533906f, -1.2552931065f,
72-0.8660254038f, -0.4619397663f, -1.3194792169f, -1.1827865776f, -0.5000000000f, -1.1827865776f, -1.3194792169f, -0.4619397663f,
73-0.8660254038f, -1.2552931065f, -0.3535533906f, -0.4174197128f, -1.0000000000f, -0.1913417162f, +0.0947343455f, -0.5924659585f,
74+0.0000000000f, +0.5924659585f, -0.0947343455f, +0.1913417162f, +1.0000000000f, +0.4174197128f, +0.3535533906f, +1.2552931065f,
75+0.8660254038f, +0.4619397663f, +1.3194792169f, +1.1827865776f, +0.5000000000f, +1.1827865776f, +1.3194792169f, +0.4619397663f,
76+0.8660254038f, +1.2552931065f, +0.3535533906f, +0.4174197128f, +1.0000000000f, +0.1913417162f, -0.0947343455f, +0.5924659585f,
77+0.0000000000f, -0.5924659585f, +0.0947343455f, -0.1913417162f, -1.0000000000f, -0.4174197128f, -0.3535533906f, -1.2552931065f,
78-0.8660254038f, -0.4619397663f, -1.3194792169f, -1.1827865776f, -0.5000000000f, -1.1827865776f, -1.3194792169f, -0.4619397663f,
79-0.8660254038f, -1.2552931065f, -0.3535533906f, -0.4174197128f, -1.0000000000f, -0.1913417162f, +0.0947343455f, -0.5924659585f,
80-0.0000000000f, +0.5924659585f, -0.0947343455f, +0.1913417162f, +1.0000000000f, +0.4174197128f, +0.3535533906f, +1.2552931065f,
81+0.8660254038f, +0.4619397663f, +1.3194792169f, +1.1827865776f, +0.5000000000f, +1.1827865776f, +1.3194792169f, +0.4619397663f,
82+0.8660254038f, +1.2552931065f, +0.3535533906f, +0.4174197128f, +1.0000000000f, +0.1913417162f, -0.0947343455f, +0.5924659585f,
83+0.0000000000f, -0.5924659585f, +0.0947343455f, -0.1913417162f, -1.0000000000f, -0.4174197128f, -0.3535533906f, -1.2552931065f,
84-0.8660254038f, -0.4619397663f, -1.3194792169f, -1.1827865776f, -0.5000000000f, -1.1827865776f, -1.3194792169f, -0.4619397663f,
85-0.8660254038f, -1.2552931065f, -0.3535533906f, -0.4174197128f, -1.0000000000f, -0.1913417162f, +0.0947343455f, -0.5924659585f,
86-0.0000000000f, +0.5924659585f, -0.0947343455f, +0.1913417162f, +1.0000000000f, +0.4174197128f, +0.3535533906f, +1.2552931065f,
87+0.8660254038f, +0.4619397663f, +1.3194792169f, +1.1827865776f, +0.5000000000f, +1.1827865776f, +1.3194792169f, +0.4619397663f,
88+0.8660254038f, +1.2552931065f, +0.3535533906f, +0.4174197128f, +1.0000000000f, +0.1913417162f, -0.0947343455f, +0.5924659585f,
89+0.0000000000f, -0.5924659585f, +0.0947343455f, -0.1913417162f, -1.0000000000f, -0.4174197128f, -0.3535533906f, -1.2552931065f,
90};
91
92/* ----------------------------------------------------------------------
93** Reference output signal computed with MATLAB
94** ------------------------------------------------------------------- */
95
96float32_t refOutput[320] =
97{
98+0.0000000000f, -0.0010797829f, -0.0007681386f, -0.0001982932f, +0.0000644313f, +0.0020854271f, +0.0036891871f, +0.0015855941f,
99-0.0026280805f, -0.0075907658f, -0.0119390538f, -0.0086665968f, +0.0088981202f, +0.0430539279f, +0.0974468742f, +0.1740405600f,
100+0.2681416601f, +0.3747720089f, +0.4893362230f, +0.6024154672f, +0.7058740791f, +0.7968348987f, +0.8715901940f, +0.9277881093f,
101+0.9682182661f, +0.9934674267f, +1.0012052245f, +0.9925859371f, +0.9681538347f, +0.9257026822f, +0.8679010068f, +0.7952493046f,
102+0.7085021596f, +0.6100062330f, +0.5012752767f, +0.3834386057f, +0.2592435399f, +0.1309866321f, -0.0000000000f, -0.1309866321f,
103-0.2592435399f, -0.3834386057f, -0.5012752767f, -0.6100062330f, -0.7085021596f, -0.7952493046f, -0.8679010068f, -0.9257026822f,
104-0.9681538347f, -0.9936657199f, -1.0019733630f, -0.9936657199f, -0.9681538347f, -0.9257026822f, -0.8679010068f, -0.7952493046f,
105-0.7085021596f, -0.6100062330f, -0.5012752767f, -0.3834386057f, -0.2592435399f, -0.1309866321f, +0.0000000000f, +0.1309866321f,
106+0.2592435399f, +0.3834386057f, +0.5012752767f, +0.6100062330f, +0.7085021596f, +0.7952493046f, +0.8679010068f, +0.9257026822f,
107+0.9681538347f, +0.9936657199f, +1.0019733630f, +0.9936657199f, +0.9681538347f, +0.9257026822f, +0.8679010068f, +0.7952493046f,
108+0.7085021596f, +0.6100062330f, +0.5012752767f, +0.3834386057f, +0.2592435399f, +0.1309866321f, -0.0000000000f, -0.1309866321f,
109-0.2592435399f, -0.3834386057f, -0.5012752767f, -0.6100062330f, -0.7085021596f, -0.7952493046f, -0.8679010068f, -0.9257026822f,
110-0.9681538347f, -0.9936657199f, -1.0019733630f, -0.9936657199f, -0.9681538347f, -0.9257026822f, -0.8679010068f, -0.7952493046f,
111-0.7085021596f, -0.6100062330f, -0.5012752767f, -0.3834386057f, -0.2592435399f, -0.1309866321f, +0.0000000000f, +0.1309866321f,
112+0.2592435399f, +0.3834386057f, +0.5012752767f, +0.6100062330f, +0.7085021596f, +0.7952493046f, +0.8679010068f, +0.9257026822f,
113+0.9681538347f, +0.9936657199f, +1.0019733630f, +0.9936657199f, +0.9681538347f, +0.9257026822f, +0.8679010068f, +0.7952493046f,
114+0.7085021596f, +0.6100062330f, +0.5012752767f, +0.3834386057f, +0.2592435399f, +0.1309866321f, -0.0000000000f, -0.1309866321f,
115-0.2592435399f, -0.3834386057f, -0.5012752767f, -0.6100062330f, -0.7085021596f, -0.7952493046f, -0.8679010068f, -0.9257026822f,
116-0.9681538347f, -0.9936657199f, -1.0019733630f, -0.9936657199f, -0.9681538347f, -0.9257026822f, -0.8679010068f, -0.7952493046f,
117-0.7085021596f, -0.6100062330f, -0.5012752767f, -0.3834386057f, -0.2592435399f, -0.1309866321f, +0.0000000000f, +0.1309866321f,
118+0.2592435399f, +0.3834386057f, +0.5012752767f, +0.6100062330f, +0.7085021596f, +0.7952493046f, +0.8679010068f, +0.9257026822f,
119+0.9681538347f, +0.9936657199f, +1.0019733630f, +0.9936657199f, +0.9681538347f, +0.9257026822f, +0.8679010068f, +0.7952493046f,
120+0.7085021596f, +0.6100062330f, +0.5012752767f, +0.3834386057f, +0.2592435399f, +0.1309866321f, +0.0000000000f, -0.1309866321f,
121-0.2592435399f, -0.3834386057f, -0.5012752767f, -0.6100062330f, -0.7085021596f, -0.7952493046f, -0.8679010068f, -0.9257026822f,
122-0.9681538347f, -0.9936657199f, -1.0019733630f, -0.9936657199f, -0.9681538347f, -0.9257026822f, -0.8679010068f, -0.7952493046f,
123-0.7085021596f, -0.6100062330f, -0.5012752767f, -0.3834386057f, -0.2592435399f, -0.1309866321f, +0.0000000000f, +0.1309866321f,
124+0.2592435399f, +0.3834386057f, +0.5012752767f, +0.6100062330f, +0.7085021596f, +0.7952493046f, +0.8679010068f, +0.9257026822f,
125+0.9681538347f, +0.9936657199f, +1.0019733630f, +0.9936657199f, +0.9681538347f, +0.9257026822f, +0.8679010068f, +0.7952493046f,
126+0.7085021596f, +0.6100062330f, +0.5012752767f, +0.3834386057f, +0.2592435399f, +0.1309866321f, +0.0000000000f, -0.1309866321f,
127-0.2592435399f, -0.3834386057f, -0.5012752767f, -0.6100062330f, -0.7085021596f, -0.7952493046f, -0.8679010068f, -0.9257026822f,
128-0.9681538347f, -0.9936657199f, -1.0019733630f, -0.9936657199f, -0.9681538347f, -0.9257026822f, -0.8679010068f, -0.7952493046f,
129-0.7085021596f, -0.6100062330f, -0.5012752767f, -0.3834386057f, -0.2592435399f, -0.1309866321f, -0.0000000000f, +0.1309866321f,
130+0.2592435399f, +0.3834386057f, +0.5012752767f, +0.6100062330f, +0.7085021596f, +0.7952493046f, +0.8679010068f, +0.9257026822f,
131+0.9681538347f, +0.9936657199f, +1.0019733630f, +0.9936657199f, +0.9681538347f, +0.9257026822f, +0.8679010068f, +0.7952493046f,
132+0.7085021596f, +0.6100062330f, +0.5012752767f, +0.3834386057f, +0.2592435399f, +0.1309866321f, +0.0000000000f, -0.1309866321f,
133-0.2592435399f, -0.3834386057f, -0.5012752767f, -0.6100062330f, -0.7085021596f, -0.7952493046f, -0.8679010068f, -0.9257026822f,
134-0.9681538347f, -0.9936657199f, -1.0019733630f, -0.9936657199f, -0.9681538347f, -0.9257026822f, -0.8679010068f, -0.7952493046f,
135-0.7085021596f, -0.6100062330f, -0.5012752767f, -0.3834386057f, -0.2592435399f, -0.1309866321f, +0.0000000000f, +0.1309866321f,
136+0.2592435399f, +0.3834386057f, +0.5012752767f, +0.6100062330f, +0.7085021596f, +0.7952493046f, +0.8679010068f, +0.9257026822f,
137+0.9681538347f, +0.9936657199f, +1.0019733630f, +0.9936657199f, +0.9681538347f, +0.9257026822f, +0.8679010068f, +0.7952493046f
138};
139
at32f413.h
at32f413 header file
testInput_f32_1kHz_15kHz
float32_t testInput_f32_1kHz_15kHz[320]
Definition project_l1/src/arm_fir_data.c:48
refOutput
float32_t refOutput[320]
Definition project_l1/src/arm_fir_data.c:96


AT32F413 Firmwary Library: math_helper.c Source File

  • utilities
  • at32f413_slib_demo
  • project_l1
  • src
project_l1/src/math_helper.c
Go to the documentation of this file.
1/* ----------------------------------------------------------------------
2* Copyright (C) 2010-2012 ARM Limited. All rights reserved.
3*
4* $Date: 17. January 2013
5* $Revision: V1.4.0 b
6*
7* Project: CMSIS DSP Library
8*
9* Title: math_helper.c
10*
11* Description: Definition of all helper functions required.
12*
13* Target Processor: Cortex-M4/Cortex-M3
14*
15* Redistribution and use in source and binary forms, with or without
16* modification, are permitted provided that the following conditions
17* are met:
18* - Redistributions of source code must retain the above copyright
19* notice, this list of conditions and the following disclaimer.
20* - Redistributions in binary form must reproduce the above copyright
21* notice, this list of conditions and the following disclaimer in
22* the documentation and/or other materials provided with the
23* distribution.
24* - Neither the name of ARM LIMITED nor the names of its contributors
25* may be used to endorse or promote products derived from this
26* software without specific prior written permission.
27*
28* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39* POSSIBILITY OF SUCH DAMAGE.
40* -------------------------------------------------------------------- */
41
42/* ----------------------------------------------------------------------
43* Include standard header files
44* -------------------------------------------------------------------- */
45#include<math.h>
46
47/* ----------------------------------------------------------------------
48* Include project header files
49* -------------------------------------------------------------------- */
50#include "math_helper.h"
51
62float arm_snr_f32(float *pRef, float *pTest, uint32_t buffSize)
63{
64 float EnergySignal = 0.0, EnergyError = 0.0;
65 uint32_t i;
66 float SNR;
67 int temp;
68 int *test;
69
70 for (i = 0; i < buffSize; i++)
71 {
72 /* Checking for a NAN value in pRef array */
73 test = (int *)(&pRef[i]);
74 temp = *test;
75
76 if (temp == 0x7FC00000)
77 {
78 return(0);
79 }
80
81 /* Checking for a NAN value in pTest array */
82 test = (int *)(&pTest[i]);
83 temp = *test;
84
85 if (temp == 0x7FC00000)
86 {
87 return(0);
88 }
89 EnergySignal += pRef[i] * pRef[i];
90 EnergyError += (pRef[i] - pTest[i]) * (pRef[i] - pTest[i]);
91 }
92
93 /* Checking for a NAN value in EnergyError */
94 test = (int *)(&EnergyError);
95 temp = *test;
96
97 if (temp == 0x7FC00000)
98 {
99 return(0);
100 }
101
102
103 SNR = 10 * log10 (EnergySignal / EnergyError);
104
105 return (SNR);
106
107}
108
109
120void arm_provide_guard_bits_q15 (q15_t * input_buf, uint32_t blockSize,
121 uint32_t guard_bits)
122{
123 uint32_t i;
124
125 for (i = 0; i < blockSize; i++)
126 {
127 input_buf[i] = input_buf[i] >> guard_bits;
128 }
129}
130
140void arm_float_to_q12_20(float *pIn, q31_t * pOut, uint32_t numSamples)
141{
142 uint32_t i;
143
144 for (i = 0; i < numSamples; i++)
145 {
146 /* 1048576.0f corresponds to pow(2, 20) */
147 pOut[i] = (q31_t) (pIn[i] * 1048576.0f);
148
149 pOut[i] += pIn[i] > 0 ? 0.5 : -0.5;
150
151 if (pIn[i] == (float) 1.0)
152 {
153 pOut[i] = 0x000FFFFF;
154 }
155 }
156}
157
166uint32_t arm_compare_fixed_q15(q15_t *pIn, q15_t *pOut, uint32_t numSamples)
167{
168 uint32_t i;
169 int32_t diff, diffCrnt = 0;
170 uint32_t maxDiff = 0;
171
172 for (i = 0; i < numSamples; i++)
173 {
174 diff = pIn[i] - pOut[i];
175 diffCrnt = (diff > 0) ? diff : -diff;
176
177 if (diffCrnt > maxDiff)
178 {
179 maxDiff = diffCrnt;
180 }
181 }
182
183 return(maxDiff);
184}
185
194uint32_t arm_compare_fixed_q31(q31_t *pIn, q31_t * pOut, uint32_t numSamples)
195{
196 uint32_t i;
197 int32_t diff, diffCrnt = 0;
198 uint32_t maxDiff = 0;
199
200 for (i = 0; i < numSamples; i++)
201 {
202 diff = pIn[i] - pOut[i];
203 diffCrnt = (diff > 0) ? diff : -diff;
204
205 if (diffCrnt > maxDiff)
206 {
207 maxDiff = diffCrnt;
208 }
209 }
210
211 return(maxDiff);
212}
213
224void arm_provide_guard_bits_q31 (q31_t * input_buf,
225 uint32_t blockSize,
226 uint32_t guard_bits)
227{
228 uint32_t i;
229
230 for (i = 0; i < blockSize; i++)
231 {
232 input_buf[i] = input_buf[i] >> guard_bits;
233 }
234}
235
246void arm_provide_guard_bits_q7 (q7_t * input_buf,
247 uint32_t blockSize,
248 uint32_t guard_bits)
249{
250 uint32_t i;
251
252 for (i = 0; i < blockSize; i++)
253 {
254 input_buf[i] = input_buf[i] >> guard_bits;
255 }
256}
257
258
259
268uint32_t arm_calc_guard_bits (uint32_t num_adds)
269{
270 uint32_t i = 1, j = 0;
271
272 if (num_adds == 1)
273 {
274 return (0);
275 }
276
277 while (i < num_adds)
278 {
279 i = i * 2;
280 j++;
281 }
282
283 return (j);
284}
285
294void arm_apply_guard_bits (float32_t *pIn,
295 uint32_t numSamples,
296 uint32_t guard_bits)
297{
298 uint32_t i;
299
300 for (i = 0; i < numSamples; i++)
301 {
302 pIn[i] = pIn[i] * arm_calc_2pow(guard_bits);
303 }
304}
305
311uint32_t arm_calc_2pow(uint32_t numShifts)
312{
313
314 uint32_t i, val = 1;
315
316 for (i = 0; i < numShifts; i++)
317 {
318 val = val * 2;
319 }
320
321 return(val);
322}
323
324
325
335void arm_float_to_q14 (float *pIn, q15_t *pOut, uint32_t numSamples)
336{
337 uint32_t i;
338
339 for (i = 0; i < numSamples; i++)
340 {
341 /* 16384.0f corresponds to pow(2, 14) */
342 pOut[i] = (q15_t) (pIn[i] * 16384.0f);
343
344 pOut[i] += pIn[i] > 0 ? 0.5 : -0.5;
345
346 if (pIn[i] == (float) 2.0)
347 {
348 pOut[i] = 0x7FFF;
349 }
350
351 }
352
353}
354
355
365void arm_float_to_q30 (float *pIn, q31_t * pOut, uint32_t numSamples)
366{
367 uint32_t i;
368
369 for (i = 0; i < numSamples; i++)
370 {
371 /* 1073741824.0f corresponds to pow(2, 30) */
372 pOut[i] = (q31_t) (pIn[i] * 1073741824.0f);
373
374 pOut[i] += pIn[i] > 0 ? 0.5 : -0.5;
375
376 if (pIn[i] == (float) 2.0)
377 {
378 pOut[i] = 0x7FFFFFFF;
379 }
380 }
381}
382
392void arm_float_to_q29 (float *pIn, q31_t *pOut, uint32_t numSamples)
393{
394 uint32_t i;
395
396 for (i = 0; i < numSamples; i++)
397 {
398 /* 1073741824.0f corresponds to pow(2, 30) */
399 pOut[i] = (q31_t) (pIn[i] * 536870912.0f);
400
401 pOut[i] += pIn[i] > 0 ? 0.5 : -0.5;
402
403 if (pIn[i] == (float) 4.0)
404 {
405 pOut[i] = 0x7FFFFFFF;
406 }
407 }
408}
409
410
420void arm_float_to_q28 (float *pIn, q31_t *pOut, uint32_t numSamples)
421{
422 uint32_t i;
423
424 for (i = 0; i < numSamples; i++)
425 {
426 /* 268435456.0f corresponds to pow(2, 28) */
427 pOut[i] = (q31_t) (pIn[i] * 268435456.0f);
428
429 pOut[i] += pIn[i] > 0 ? 0.5 : -0.5;
430
431 if (pIn[i] == (float) 8.0)
432 {
433 pOut[i] = 0x7FFFFFFF;
434 }
435 }
436}
437
438
439/*
440
441Conflicting with the new clip functions in CMSIS-DSP and not used
442in the examples.
443
444*/
445#if 0
454void arm_clip_f32 (float *pIn, uint32_t numSamples)
455{
456 uint32_t i;
457
458 for (i = 0; i < numSamples; i++)
459 {
460 if (pIn[i] > 1.0f)
461 {
462 pIn[i] = 1.0;
463 }
464 else if ( pIn[i] < -1.0f)
465 {
466 pIn[i] = -1.0;
467 }
468
469 }
470}
471
472#endif
473
474
arm_float_to_q29
void arm_float_to_q29(float *pIn, q31_t *pOut, uint32_t numSamples)
Converts float to fixed q30 format.
Definition project_l1/src/math_helper.c:392
arm_apply_guard_bits
void arm_apply_guard_bits(float32_t *pIn, uint32_t numSamples, uint32_t guard_bits)
Apply guard bits to buffer.
Definition project_l1/src/math_helper.c:294
arm_float_to_q30
void arm_float_to_q30(float *pIn, q31_t *pOut, uint32_t numSamples)
Converts float to fixed q30 format.
Definition project_l1/src/math_helper.c:365
arm_float_to_q14
void arm_float_to_q14(float *pIn, q15_t *pOut, uint32_t numSamples)
Converts float to fixed q14.
Definition project_l1/src/math_helper.c:335
arm_float_to_q12_20
void arm_float_to_q12_20(float *pIn, q31_t *pOut, uint32_t numSamples)
Converts float to fixed in q12.20 format.
Definition project_l1/src/math_helper.c:140
arm_compare_fixed_q31
uint32_t arm_compare_fixed_q31(q31_t *pIn, q31_t *pOut, uint32_t numSamples)
Compare MATLAB Reference Output and ARM Test output.
Definition project_l1/src/math_helper.c:194
arm_provide_guard_bits_q7
void arm_provide_guard_bits_q7(q7_t *input_buf, uint32_t blockSize, uint32_t guard_bits)
Provide guard bits for Input buffer.
Definition project_l1/src/math_helper.c:246
arm_calc_guard_bits
uint32_t arm_calc_guard_bits(uint32_t num_adds)
Caluclates number of guard bits.
Definition project_l1/src/math_helper.c:268
arm_compare_fixed_q15
uint32_t arm_compare_fixed_q15(q15_t *pIn, q15_t *pOut, uint32_t numSamples)
Compare MATLAB Reference Output and ARM Test output.
Definition project_l1/src/math_helper.c:166
arm_float_to_q28
void arm_float_to_q28(float *pIn, q31_t *pOut, uint32_t numSamples)
Converts float to fixed q28 format.
Definition project_l1/src/math_helper.c:420
arm_provide_guard_bits_q15
void arm_provide_guard_bits_q15(q15_t *input_buf, uint32_t blockSize, uint32_t guard_bits)
Provide guard bits for Input buffer.
Definition project_l1/src/math_helper.c:120
arm_calc_2pow
uint32_t arm_calc_2pow(uint32_t numShifts)
Calculates pow(2, numShifts)
Definition project_l1/src/math_helper.c:311
arm_provide_guard_bits_q31
void arm_provide_guard_bits_q31(q31_t *input_buf, uint32_t blockSize, uint32_t guard_bits)
Provide guard bits for Input buffer.
Definition project_l1/src/math_helper.c:224
arm_snr_f32
float arm_snr_f32(float *pRef, float *pTest, uint32_t buffSize)
Caluclation of SNR.
Definition project_l1/src/math_helper.c:62


AT32F413 Firmwary Library: random.c Source File

  • utilities
  • at32f413_gen_random_number_demo
  • src
random.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "random.h"
28#include "stdio.h"
29#include <stdlib.h>
30
39/* define at32 mcu uid address */
40#define DEVICE_ID_ADDR1 0x1FFFF7E8
41
47int get_uid_for_seed (void)
48{
49 uint32_t id[3] = {0};
50 uint32_t uid_one_word;
51
52 /* get uid */
53 id[0] = *(int*)DEVICE_ID_ADDR1;
54 id[2] = *(int*)(DEVICE_ID_ADDR1+8);
55 uid_one_word=id[0]&0x7fffffff+((id[2]&(~0x7fffffff))<<16);
56 return uid_one_word;
57}
58
64#if ENABLE_RTC_ASSEED
65void rtc_init_for_seed (void)
66{
67 /* enable pwc and bpr clocks */
68 crm_periph_clock_enable(CRM_PWC_PERIPH_CLOCK, TRUE);
69 crm_periph_clock_enable(CRM_BPR_PERIPH_CLOCK, TRUE);
70
71 /* allow access to bpr domain */
72 pwc_battery_powered_domain_access(TRUE);
73
74 if (bpr_data_read(BPR_DATA1) != 0x5051)
75 {
76 /* reset bpr domain */
77 bpr_reset();
78
79 /* enable the lext osc */
80 crm_clock_source_enable(CRM_CLOCK_SOURCE_LEXT, TRUE);
81 /* wait lext is ready */
82 while(crm_flag_get(CRM_LEXT_STABLE_FLAG) == RESET);
83 /* select the rtc clock source */
84 crm_rtc_clock_select(CRM_RTC_CLOCK_LEXT);
85
86 /* enable rtc clock */
87 crm_rtc_clock_enable(TRUE);
88
89 /* wait for rtc registers update */
90 rtc_wait_update_finish();
91
92 /* wait for the register write to complete */
93 rtc_wait_config_finish();
94
95 /* set rtc divider: set rtc period to 1sec */
96 rtc_divider_set(32767);
97
98 /* wait for the register write to complete */
99 rtc_wait_config_finish();
100
101 /* writes data to bpr register */
102 bpr_data_write(BPR_DATA1, 0x5051);
103 }
104 else
105 {
106 /* wait for rtc registers update */
107 rtc_wait_update_finish();
108
109 /* wait for the register write to complete */
110 rtc_wait_config_finish();
111 }
112}
113
114#endif
115
121void randnum_test( void)
122{
123#if ENABLE_RTC_ASSEED
124 rtc_init_for_seed();
125
126 /* set uid and rtc as seed for random */
127 srand(rtc_counter_get()+get_uid_for_seed());
128#else
129 /* set only uid as seed for random */
130 srand(get_uid_for_seed());
131#endif
132
133 while(1)
134 {
135 delay_ms(500);
136 printf("%d\r\n",rand());
137 }
138}
139
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
bpr_reset
void bpr_reset(void)
bpr reset by crm reset register
Definition at32f413_bpr.c:48
bpr_data_read
uint16_t bpr_data_read(bpr_data_type bpr_data)
read bpr bpr data
Definition at32f413_bpr.c:135
bpr_data_write
void bpr_data_write(bpr_data_type bpr_data, uint16_t data_value)
write bpr data
Definition at32f413_bpr.c:152
BPR_DATA1
@ BPR_DATA1
Definition at32f413_bpr.h:67
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_rtc_clock_select
void crm_rtc_clock_select(crm_rtc_clock_type value)
select rtc clock
Definition at32f413_crm.c:433
crm_rtc_clock_enable
void crm_rtc_clock_enable(confirm_state new_state)
enable or disable rtc
Definition at32f413_crm.c:443
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_PWC_PERIPH_CLOCK
@ CRM_PWC_PERIPH_CLOCK
Definition at32f413_crm.h:140
CRM_BPR_PERIPH_CLOCK
@ CRM_BPR_PERIPH_CLOCK
Definition at32f413_crm.h:139
CRM_CLOCK_SOURCE_LEXT
@ CRM_CLOCK_SOURCE_LEXT
Definition at32f413_crm.h:296
CRM_RTC_CLOCK_LEXT
@ CRM_RTC_CLOCK_LEXT
Definition at32f413_crm.h:373
CRM_LEXT_STABLE_FLAG
#define CRM_LEXT_STABLE_FLAG
Definition at32f413_crm.h:57
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
get_uid_for_seed
int get_uid_for_seed(void)
get uid value as seed
Definition random.c:47
DEVICE_ID_ADDR1
#define DEVICE_ID_ADDR1
Definition random.c:40
randnum_test
void randnum_test(void)
enable rtc as seed
Definition random.c:121
pwc_battery_powered_domain_access
void pwc_battery_powered_domain_access(confirm_state new_state)
enable or disable access to the battery powered domain.
Definition at32f413_pwc.c:60
rtc_wait_config_finish
void rtc_wait_config_finish(void)
rtc wait configuration finish
Definition at32f413_rtc.c:243
rtc_counter_get
uint32_t rtc_counter_get(void)
rtc counter get
Definition at32f413_rtc.c:81
rtc_wait_update_finish
void rtc_wait_update_finish(void)
rtc wait update finish
Definition at32f413_rtc.c:253
rtc_divider_set
void rtc_divider_set(uint32_t div_value)
rtc divider set
Definition at32f413_rtc.c:103
random.h
at32f413 random header file


AT32F413 Firmwary Library: random.h Source File

  • utilities
  • at32f413_gen_random_number_demo
  • inc
random.h
Go to the documentation of this file.
1
26#ifndef __RANDOM_H
27#define __RANDOM_H
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33#include "at32f413.h"
34
47/* this define rtc seed for random number gen,*/
48#define ENABLE_RTC_ASSEED (1)
49
58void randnum_test( void);
59
72#ifdef __cplusplus
73}
74#endif
75
76#endif
at32f413.h
at32f413 header file
randnum_test
void randnum_test(void)
enable rtc as seed
Definition random.c:121


AT32F413 Firmwary Library: rtc.c Source File

  • rtc
  • calendar
  • src
rtc.c
Go to the documentation of this file.
1
26#include "rtc.h"
27
36 calendar_type calendar;
37
38/* monthly correction data sheet */
39const uint8_t table_week[12] = {0, 3, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5};
40
41/* monmonth data table of common year */
42const uint8_t mon_table[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
43
50uint8_t rtc_init(calendar_type *calendar)
51{
52 /* enable pwc and bpr clocks */
53 crm_periph_clock_enable(CRM_PWC_PERIPH_CLOCK, TRUE);
54 crm_periph_clock_enable(CRM_BPR_PERIPH_CLOCK, TRUE);
55
56 /* enable the battery-powered domain write operations */
57 pwc_battery_powered_domain_access(TRUE);
58
59 /* check if rtc is initialized */
60 if(bpr_data_read(BPR_DATA1) != 0x1234)
61 {
62 /* reset battery-powered domain register */
63 bpr_reset();
64
65 /* enable the lext osc */
66 crm_clock_source_enable(CRM_CLOCK_SOURCE_LEXT, TRUE);
67 /* wait lext is ready */
68 while(crm_flag_get(CRM_LEXT_STABLE_FLAG) == RESET);
69 /* select the rtc clock source */
70 crm_rtc_clock_select(CRM_RTC_CLOCK_LEXT);
71
72 /* enable rtc clock */
73 crm_rtc_clock_enable(TRUE);
74
75 /* wait for rtc registers update */
76 rtc_wait_update_finish();
77
78 /* wait for the register write to complete */
79 rtc_wait_config_finish();
80
81 /* set rtc divider: set rtc period to 1sec */
82 rtc_divider_set(32767);
83
84 /* wait for the register write to complete */
85 rtc_wait_config_finish();
86
87 /* set time */
88 rtc_time_set(calendar);
89
90 /* writes data to bpr register */
91 bpr_data_write(BPR_DATA1, 0x1234);
92
93 return 1;
94 }
95 else
96 {
97 /* wait for rtc registers update */
98 rtc_wait_update_finish();
99
100 /* wait for the register write to complete */
101 rtc_wait_config_finish();
102
103 return 0;
104 }
105}
106
116uint8_t is_leap_year(uint16_t year)
117{
118 if(year % 4 == 0)
119 {
120 if(year % 100 == 0)
121 {
122 if(year % 400 == 0)
123 {
124 return 1;
125 }
126 else
127 {
128 return 0;
129 }
130 }
131 else
132 {
133 return 1;
134 }
135 }
136 else
137 {
138 return 0;
139 }
140}
141
150uint8_t rtc_time_set(calendar_type *calendar)
151{
152 uint32_t t;
153 uint32_t seccount = 0;
154
155 if(calendar->year < 1970 || calendar->year > 2099)
156 {
157 return 1;
158 }
159
160 for(t = 1970; t < calendar->year; t++)
161 {
162 if(is_leap_year(t))
163 {
164 seccount += 31622400;
165 }
166 else
167 {
168 seccount += 31536000;
169 }
170 }
171
172 calendar->month -= 1;
173
174 for(t = 0; t < calendar->month; t++)
175 {
176 seccount += (uint8_t)mon_table[t] * 86400;
177
178 if(is_leap_year(calendar->year) && t == 1)
179 {
180 seccount += 86400;
181 }
182 }
183
184 seccount += (uint8_t)(calendar->date - 1) * 86400;
185
186 seccount += (uint8_t)calendar->hour * 3600;
187
188 seccount += (uint8_t)calendar->min * 60;
189
190 seccount += calendar->sec;
191
192 /* enable pwc and bpr clocks */
193 crm_periph_clock_enable(CRM_PWC_PERIPH_CLOCK, TRUE);
194 crm_periph_clock_enable(CRM_BPR_PERIPH_CLOCK, TRUE);
195
196 /* enable write access to bpr domain */
197 pwc_battery_powered_domain_access(TRUE);
198
199 /* set the rtc counter value */
200 rtc_counter_set(seccount);
201
202 /* wait for the register write to complete */
203 rtc_wait_config_finish();
204
205 return 0;
206}
207
216uint8_t rtc_alarm_clock_set(calendar_type *calendar)
217{
218 uint16_t t;
219 uint32_t seccount = 0;
220
221 if(calendar->year < 1970 || calendar->year > 2099)
222 {
223 return 1;
224 }
225
226 for(t = 1970; t < calendar->year; t++)
227 {
228 if(is_leap_year(t))
229 {
230 seccount += 31622400;
231 }
232 else
233 {
234 seccount += 31536000;
235 }
236 }
237
238 calendar->month -= 1;
239
240 for(t = 0; t < calendar->month; t++)
241 {
242 seccount += (uint8_t)mon_table[t] * 86400;
243
244 if(is_leap_year(calendar->year) && t == 1)
245 {
246 seccount += 86400;
247 }
248 }
249
250 seccount += (uint8_t)(calendar->date - 1) * 86400;
251 seccount += (uint8_t)calendar->hour * 3600;
252 seccount += (uint8_t)calendar->min * 60;
253 seccount += calendar->sec;
254
255 /* enable pwc and bpr clocks */
256 crm_periph_clock_enable(CRM_PWC_PERIPH_CLOCK, TRUE);
257 crm_periph_clock_enable(CRM_BPR_PERIPH_CLOCK, TRUE);
258
259 /* enable write access to bpr domain */
260 pwc_battery_powered_domain_access(TRUE);
261
262 /* set the rtc counter value */
263 rtc_alarm_set(seccount);
264
265 /* wait for the register write to complete */
266 rtc_wait_config_finish();
267
268 return 0;
269}
270
278uint8_t rtc_week_get(uint16_t year, uint8_t month, uint8_t day)
279{
280 uint16_t temp2;
281 uint8_t yearh, yearl;
282
283 yearh = year / 100;
284 yearl = year % 100;
285
286 if(yearh > 19)
287 {
288 yearl += 100;
289 }
290
291 temp2 = yearl + yearl / 4;
292 temp2 = temp2 % 7;
293 temp2 = temp2 + day + table_week[month - 1];
294
295 if(yearl % 4 == 0 && month < 3)
296 {
297 temp2--;
298 }
299
300 return(temp2 % 7);
301}
302
308void rtc_time_get(void)
309{
310 static uint16_t daycnt = 0;
311 uint32_t timecount = 0;
312 uint32_t temp = 0;
313 uint32_t temp1 = 0;
314
315 timecount = rtc_counter_get();
316 temp = timecount / 86400;
317
318 if(daycnt != temp)
319 {
320 daycnt = temp;
321 temp1 = 1970;
322
323 while(temp >= 365)
324 {
325 if(is_leap_year(temp1))
326 {
327 if(temp >= 366)
328 {
329 temp -= 366;
330 }
331 else
332 {
333 break;
334 }
335 }
336 else
337 {
338 temp -= 365;
339 }
340
341 temp1++;
342 }
343
344 calendar.year = temp1;
345 temp1 = 0;
346
347 while(temp >= 28)
348 {
349 if(is_leap_year(calendar.year) && temp1 == 1)
350 {
351 if(temp >= 29)
352 {
353 temp -= 29;
354 }
355 else
356 {
357 break;
358 }
359 }
360 else
361 {
362 if(temp >= mon_table[temp1])
363 {
364 temp -= mon_table[temp1];
365 }
366 else
367 {
368 break;
369 }
370 }
371
372 temp1++;
373 }
374
375 calendar.month = temp1 + 1;
376 calendar.date = temp + 1;
377 }
378
379 temp = timecount % 86400;
380 calendar.hour = temp / 3600;
381 calendar.min = (temp % 3600) / 60;
382 calendar.sec = (temp % 3600) % 60;
383 calendar.week = rtc_week_get(calendar.year, calendar.month, calendar.date);
384}
385
rtc_time_get
void rtc_time_get(void)
get current time.
Definition rtc.c:308
rtc_init
uint8_t rtc_init(calendar_type *calendar)
rtc peripheral initialization.
Definition rtc.c:50
calendar
calendar_type calendar
Definition rtc.c:36
mon_table
const uint8_t mon_table[12]
Definition rtc.c:42
rtc_week_get
uint8_t rtc_week_get(uint16_t year, uint8_t month, uint8_t day)
get current week by input leap year\mouth\day.
Definition rtc.c:278
rtc_time_set
uint8_t rtc_time_set(calendar_type *calendar)
set time. convert the input clock to a second. the time basic : 1970.1.1 legitimate year: 1970 ~ 2099
Definition rtc.c:150
rtc_alarm_clock_set
uint8_t rtc_alarm_clock_set(calendar_type *calendar)
set rtc alarm clock. the time basic : 1970.1.1 legitimate year: 1970 ~ 2099
Definition rtc.c:216
table_week
const uint8_t table_week[12]
Definition rtc.c:39
is_leap_year
uint8_t is_leap_year(uint16_t year)
judeg the leap year or common year.
Definition rtc.c:116
bpr_reset
void bpr_reset(void)
bpr reset by crm reset register
Definition at32f413_bpr.c:48
bpr_data_read
uint16_t bpr_data_read(bpr_data_type bpr_data)
read bpr bpr data
Definition at32f413_bpr.c:135
bpr_data_write
void bpr_data_write(bpr_data_type bpr_data, uint16_t data_value)
write bpr data
Definition at32f413_bpr.c:152
BPR_DATA1
@ BPR_DATA1
Definition at32f413_bpr.h:67
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_rtc_clock_select
void crm_rtc_clock_select(crm_rtc_clock_type value)
select rtc clock
Definition at32f413_crm.c:433
crm_rtc_clock_enable
void crm_rtc_clock_enable(confirm_state new_state)
enable or disable rtc
Definition at32f413_crm.c:443
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_PWC_PERIPH_CLOCK
@ CRM_PWC_PERIPH_CLOCK
Definition at32f413_crm.h:140
CRM_BPR_PERIPH_CLOCK
@ CRM_BPR_PERIPH_CLOCK
Definition at32f413_crm.h:139
CRM_CLOCK_SOURCE_LEXT
@ CRM_CLOCK_SOURCE_LEXT
Definition at32f413_crm.h:296
CRM_RTC_CLOCK_LEXT
@ CRM_RTC_CLOCK_LEXT
Definition at32f413_crm.h:373
CRM_LEXT_STABLE_FLAG
#define CRM_LEXT_STABLE_FLAG
Definition at32f413_crm.h:57
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
pwc_battery_powered_domain_access
void pwc_battery_powered_domain_access(confirm_state new_state)
enable or disable access to the battery powered domain.
Definition at32f413_pwc.c:60
rtc_alarm_set
void rtc_alarm_set(uint32_t alarm_value)
rtc alarm value set
Definition at32f413_rtc.c:136
rtc_wait_config_finish
void rtc_wait_config_finish(void)
rtc wait configuration finish
Definition at32f413_rtc.c:243
rtc_counter_get
uint32_t rtc_counter_get(void)
rtc counter get
Definition at32f413_rtc.c:81
rtc_wait_update_finish
void rtc_wait_update_finish(void)
rtc wait update finish
Definition at32f413_rtc.c:253
rtc_counter_set
void rtc_counter_set(uint32_t counter_value)
rtc counter set
Definition at32f413_rtc.c:48
rtc_divider_set
void rtc_divider_set(uint32_t div_value)
rtc divider set
Definition at32f413_rtc.c:103
rtc.h
this file provides template for calendar api.
calendar_type
Definition rtc.h:48
calendar_type::hour
__IO uint8_t hour
Definition rtc.h:52
calendar_type::month
__IO uint8_t month
Definition rtc.h:50
calendar_type::sec
__IO uint8_t sec
Definition rtc.h:54
calendar_type::week
__IO uint8_t week
Definition rtc.h:55
calendar_type::year
__IO uint16_t year
Definition rtc.h:49
calendar_type::min
__IO uint8_t min
Definition rtc.h:53
calendar_type::date
__IO uint8_t date
Definition rtc.h:51


AT32F413 Firmwary Library: rtc.h Source File

  • rtc
  • calendar
  • inc
rtc.h
Go to the documentation of this file.
1
26#ifndef __RTC_H
27#define __RTC_H
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33#include "at32f413.h"
34
47typedef struct
48{
49 __IO uint16_t year;
50 __IO uint8_t month;
51 __IO uint8_t date;
52 __IO uint8_t hour;
53 __IO uint8_t min;
54 __IO uint8_t sec;
55 __IO uint8_t week;
56} calendar_type;
57
62extern calendar_type calendar;
63
68uint8_t rtc_init (calendar_type *calendar);
69uint8_t rtc_time_set (calendar_type *calendar);
70uint8_t rtc_alarm_clock_set (calendar_type *calendar);
71void rtc_time_get (void);
72
85#ifdef __cplusplus
86}
87#endif
88
89#endif
at32f413.h
at32f413 header file
calendar
calendar_type calendar
Definition rtc.c:36
rtc_time_get
void rtc_time_get(void)
get current time.
Definition rtc.c:308
rtc_init
uint8_t rtc_init(calendar_type *calendar)
rtc peripheral initialization.
Definition rtc.c:50
rtc_time_set
uint8_t rtc_time_set(calendar_type *calendar)
set time. convert the input clock to a second. the time basic : 1970.1.1 legitimate year: 1970 ~ 2099
Definition rtc.c:150
rtc_alarm_clock_set
uint8_t rtc_alarm_clock_set(calendar_type *calendar)
set rtc alarm clock. the time basic : 1970.1.1 legitimate year: 1970 ~ 2099
Definition rtc.c:216
calendar_type
Definition rtc.h:48
calendar_type::hour
__IO uint8_t hour
Definition rtc.h:52
calendar_type::month
__IO uint8_t month
Definition rtc.h:50
calendar_type::sec
__IO uint8_t sec
Definition rtc.h:54
calendar_type::week
__IO uint8_t week
Definition rtc.h:55
calendar_type::year
__IO uint16_t year
Definition rtc.h:49
calendar_type::min
__IO uint8_t min
Definition rtc.h:53
calendar_type::date
__IO uint8_t date
Definition rtc.h:51


AT32F413 Firmwary Library: run_in_spim.c Source File

  • flash
  • run_in_spim
  • src
run_in_spim.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "run_in_spim.h"
28
29
44void spim_run(void)
45{
46 while(1)
47 {
48 /* toggle led */
49 at32_led_toggle(LED2);
50 delay_ms(100);
51 at32_led_toggle(LED3);
52 delay_ms(100);
53 at32_led_toggle(LED4);
54 delay_ms(100);
55 }
56}
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
spim_run
void spim_run(void)
check the led toggle in spim
Definition run_in_spim.c:44
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
run_in_spim.h
run_in_spim header file


AT32F413 Firmwary Library: run_in_spim.h Source File

  • flash
  • run_in_spim
  • inc
run_in_spim.h
Go to the documentation of this file.
1
26/* Define to prevent recursive inclusion -------------------------------------*/
27#ifndef __RUN_IN_SPIM_H
28#define __RUN_IN_SPIM_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
43void spim_run(void);
44
57#ifdef __cplusplus
58}
59#endif
60
61#endif /* __RUN_IN_SPIM_H */
62
spim_run
void spim_run(void)
check the led toggle in spim
Definition run_in_spim.c:44


AT32F413 Firmwary Library: at32_sdio.h Source File

  • sdio
  • sd_mmc_card
  • inc
sd_mmc_card/inc/at32_sdio.h
Go to the documentation of this file.
1
27/* define to prevent recursive inclusion -------------------------------------*/
28#ifndef __AT32_SDIO_H
29#define __AT32_SDIO_H
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
35/* includes ------------------------------------------------------------------*/
36#include "at32f413.h"
37
50#define SDIOx SDIO1
51
63typedef enum
64{
65 SD_TRANSFER_POLLING_MODE = 0,
66 SD_TRANSFER_DMA_MODE = 1
67} sd_data_transfer_mode_type;
68
72typedef enum
73{
74 /* sdio specific error defines ------------------------------------------*/
75 SD_CMD_FAIL = 1,
76 SD_DATA_FAIL = 2,
77 SD_CMD_RSP_TIMEOUT = 3,
78 SD_DATA_TIMEOUT = 4,
79 SD_TX_UNDERRUN = 5,
80 SD_RX_OVERRUN = 6,
81 SD_START_BIT_ERR = 7,
82 SD_CMD_OUT_OF_RANGE = 8,
83 SD_ADDR_MISALIGNED = 9,
84 SD_BLK_LEN_ERR = 10,
85 SD_ERASE_SEQ_ERR = 11,
86 SD_INVALID_ERASE_PARAM = 12,
87 SD_WR_PROTECT_VIOLATION = 13,
88 SD_LOCK_UNLOCK_ERROR = 14,
89 SD_CMD_CRC_ERROR = 15,
90 SD_ILLEGAL_CMD = 16,
91 SD_CARD_ECC_ERROR = 17,
92 SD_CARD_CONTROLLER_ERR = 18,
93 SD_GENERAL_UNKNOWN_ERROR = 19,
94 SD_STREAM_RD_UNDERRUN = 20,
95 SD_STREAM_WR_OVERRUN = 21,
96 SD_CID_CSD_OVERWRITE = 22,
97 SD_WP_ERASE_SKIP = 23,
98 SD_CARD_ECC_DISABLED = 24,
99 SD_ERASE_RESET = 25,
100 SD_AKE_SEQ_ERROR = 26,
101 SD_INVALID_VOLTRANGE = 27,
102 SD_ADDR_OUT_OF_RANGE = 28,
103 SD_SWITCH_ERROR = 29,
104 SD_SDIO_DISABLED = 30,
105 SD_SDIO_FUNC_BUSY = 31,
106 SD_SDIO_FUNC_ERROR = 32,
107 SD_SDIO_UNKNOWN_FUNC = 33,
109 /* standard error defines --------------------------------------------*/
110 SD_INTERNAL_ERROR,
111 SD_NOT_CONFIGURED,
112 SD_REQ_PENDING,
113 SD_REQ_NOT_APPLICABLE,
114 SD_INVALID_PARAMETER,
115 SD_UNSUPPORTED_FEATURE,
116 SD_UNSUPPORTED_HW,
117 SD_ERROR,
118 SD_OK = 0
119} sd_error_status_type;
120
124typedef struct
125{
126 uint8_t csd_struct;
127 uint8_t spec_version;
128 uint8_t reserved1;
129 uint8_t taac;
130 uint8_t nsac;
131 uint8_t max_bus_clk_freq;
132 uint16_t card_cmd_classes;
133 uint8_t max_read_blk_length;
134 uint8_t part_blk_read;
135 uint8_t write_blk_misalign;
136 uint8_t read_blk_misalign;
137 uint8_t dsr_implemented;
138 uint8_t reserved2;
139 uint32_t device_size;
140 uint8_t max_read_current_vdd_min;
141 uint8_t max_read_current_vdd_max;
142 uint8_t max_write_current_vdd_min;
143 uint8_t max_write_current_vdd_max;
144 uint8_t device_size_mult;
145 uint8_t erase_group_size;
146 uint8_t erase_group_size_mult;
147 uint8_t write_protect_group_size;
148 uint8_t write_protect_group_enable;
149 uint8_t manufacturer_default_ecc;
150 uint8_t write_speed_factor;
151 uint8_t max_write_blk_length;
152 uint8_t part_blk_write;
153 uint8_t reserved3;
154 uint8_t content_protect_app;
155 uint8_t file_format_group;
156 uint8_t copy_flag;
157 uint8_t permanent_write_protect;
158 uint8_t temp_write_protect;
159 uint8_t file_formart;
160 uint8_t ecc_code;
161 uint8_t csd_crc;
162 uint8_t reserved4;
163} sd_csd_struct_type;
164
168typedef struct
169{
170 uint8_t manufacturer_id;
171 uint16_t oem_app_id;
172 uint32_t product_name1;
173 uint8_t product_name2;
174 uint8_t product_reversion;
175 uint32_t product_sn;
176 uint8_t reserved1;
177 uint16_t manufact_date;
178 uint8_t cid_crc;
179 uint8_t reserved2;
180} sd_cid_struct_type;
181
185typedef enum
186{
187 SD_CARD_READY = ((uint32_t)0x00000001),
188 SD_CARD_IDENTIFICATION = ((uint32_t)0x00000002),
189 SD_CARD_STANDBY = ((uint32_t)0x00000003),
190 SD_CARD_TRANSFER = ((uint32_t)0x00000004),
191 SD_CARD_SENDING = ((uint32_t)0x00000005),
192 SD_CARD_RECEIVING = ((uint32_t)0x00000006),
193 SD_CARD_PROGRAMMING = ((uint32_t)0x00000007),
194 SD_CARD_DISCONNECTED = ((uint32_t)0x00000008),
195 SD_CARD_ERROR = ((uint32_t)0x000000FF)
196} sd_card_state_type;
197
201typedef enum
202{
203 SDIO_STD_CAPACITY_SD_CARD_V1_1 = 0,
204 SDIO_STD_CAPACITY_SD_CARD_V2_0 = 1,
205 SDIO_HIGH_CAPACITY_SD_CARD = 2,
206 SDIO_MULTIMEDIA_CARD = 3,
207 SDIO_SECURE_DIGITAL_IO_CARD = 4,
208 SDIO_HIGH_SPEED_MULTIMEDIA_CARD = 5,
209 SDIO_SECURE_DIGITAL_IO_COMBO_CARD = 6,
210 SDIO_HIGH_CAPACITY_MMC_CARD = 7,
211 SDIO_SDIO_CARD = 8
212} sd_memory_card_type;
213
217typedef struct
218{
219 uint32_t sd_spec :4; /* [59:56] */
220 uint32_t scr_structure :4; /* [60:63] */
221 uint32_t sd_bus_width :4; /* [51:48] */
222 uint32_t sd_security :3; /* [52:54] */
223 uint32_t data_stat_after_erase :1; /* [55:55] */
224 uint32_t reserved1 :7; /* [46:40] */
225 uint32_t sd_spec3 :1; /* [47:47] */
226 uint32_t cmd20_support :1; /* [32:32] */
227 uint32_t cmd23_support :1; /* [33:33] */
228 uint32_t reserverd2 :6; /* [34:39] */
229 uint32_t reserverd3; /* [31:0] */
230} sd_scr_struct_type;
231
235typedef struct
236{
237 sd_csd_struct_type sd_csd_reg;
238 sd_cid_struct_type sd_cid_reg;
239 sd_scr_struct_type sd_scr_reg;
240 long long card_capacity;
241 uint32_t card_blk_size;
242 uint16_t rca;
243 uint8_t card_type;
244} sd_card_info_struct_type;
245
246extern sd_card_info_struct_type sd_card_info;
247
259#define SD_CMD_GO_IDLE_STATE ((uint8_t)0)
260#define SD_CMD_SEND_OP_COND ((uint8_t)1)
261#define SD_CMD_ALL_SEND_CID ((uint8_t)2)
262#define SD_CMD_SET_REL_ADDR ((uint8_t)3)
263#define SD_CMD_SET_DSR ((uint8_t)4)
264#define SD_CMD_SDIO_SEN_OP_COND ((uint8_t)5)
265#define SD_CMD_HS_SWITCH ((uint8_t)6)
266#define SD_CMD_SEL_DESEL_CARD ((uint8_t)7)
267#define SD_CMD_HS_SEND_EXT_CSD ((uint8_t)8)
268#define SD_CMD_SEND_CSD ((uint8_t)9)
269#define SD_CMD_SEND_CID ((uint8_t)10)
270#define SD_CMD_READ_DAT_UNTIL_STOP ((uint8_t)11)
271#define SD_CMD_STOP_TRANSMISSION ((uint8_t)12)
272#define SD_CMD_SEND_STATUS ((uint8_t)13)
273#define SD_CMD_HS_BUSTEST_READ ((uint8_t)14)
274#define SD_CMD_GO_INACTIVE_STATE ((uint8_t)15)
275#define SD_CMD_SET_BLOCKLEN ((uint8_t)16)
276#define SD_CMD_READ_SINGLE_BLOCK ((uint8_t)17)
277#define SD_CMD_READ_MULT_BLOCK ((uint8_t)18)
278#define SD_CMD_HS_BUSTEST_WRITE ((uint8_t)19)
279#define SD_CMD_WRITE_DAT_UNTIL_STOP ((uint8_t)20)
280#define SD_CMD_SET_BLOCK_COUNT ((uint8_t)23)
281#define SD_CMD_WRITE_SINGLE_BLOCK ((uint8_t)24)
282#define SD_CMD_WRITE_MULT_BLOCK ((uint8_t)25)
283#define SD_CMD_PROG_CID ((uint8_t)26)
284#define SD_CMD_PROG_CSD ((uint8_t)27)
285#define SD_CMD_SET_WRITE_PROT ((uint8_t)28)
286#define SD_CMD_CLR_WRITE_PROT ((uint8_t)29)
287#define SD_CMD_SEND_WRITE_PROT ((uint8_t)30)
288#define SD_CMD_SD_ERASE_GRP_START ((uint8_t)32)
289#define SD_CMD_SD_ERASE_GRP_END ((uint8_t)33)
290#define SD_CMD_ERASE_GRP_START ((uint8_t)35)
291#define SD_CMD_ERASE_GRP_END ((uint8_t)36)
292#define SD_CMD_ERASE ((uint8_t)38)
293#define SD_CMD_FAST_IO ((uint8_t)39)
294#define SD_CMD_GO_IRQ_STATE ((uint8_t)40)
295#define SD_CMD_LOCK_UNLOCK ((uint8_t)42)
296#define SD_CMD_APP_CMD ((uint8_t)55)
297#define SD_CMD_GEN_CMD ((uint8_t)56)
298#define SD_CMD_NO_CMD ((uint8_t)64)
299
304#define SD_CMD_APP_SD_SET_BUSWIDTH ((uint8_t)6)
305#define SD_CMD_SD_APP_STAUS ((uint8_t)13)
306#define SD_CMD_SD_APP_SEND_NUM_WRITE_BLOCKS ((uint8_t)22)
307#define SD_CMD_SD_APP_OP_COND ((uint8_t)41)
308#define SD_CMD_SD_APP_SET_CLR_CARD_DETECT ((uint8_t)42)
309#define SD_CMD_SD_APP_SEND_SCR ((uint8_t)51)
310#define SD_CMD_SDIO_RW_DIRECT ((uint8_t)52)
311#define SD_CMD_SDIO_RW_EXTENDED ((uint8_t)53)
312
317#define SD_CMD_SD_APP_GET_MKB ((uint8_t)43)
318#define SD_CMD_SD_APP_GET_MID ((uint8_t)44)
319#define SD_CMD_SD_APP_SET_CER_RN1 ((uint8_t)45)
320#define SD_CMD_SD_APP_GET_CER_RN2 ((uint8_t)46)
321#define SD_CMD_SD_APP_SET_CER_RES2 ((uint8_t)47)
322#define SD_CMD_SD_APP_GET_CER_RES1 ((uint8_t)48)
323#define SD_CMD_SD_APP_SECURE_READ_MULTIPLE_BLOCK ((uint8_t)18)
324#define SD_CMD_SD_APP_SECURE_WRITE_MULTIPLE_BLOCK ((uint8_t)25)
325#define SD_CMD_SD_APP_SECURE_ERASE ((uint8_t)38)
326#define SD_CMD_SD_APP_CHANGE_SECURE_AREA ((uint8_t)49)
327#define SD_CMD_SD_APP_SECURE_WRITE_MKB ((uint8_t)48)
328
340#define NULL 0
341#define SDIO_STATIC_FLAGS ((uint32_t)0x000005FF)
342#define SDIO_CMD0TIMEOUT ((uint32_t)0x00010000)
343#define SDIO_DATATIMEOUT ((uint32_t)0xFFFFFFFF)
344
356#define SD_OCR_ADDR_OUT_OF_RANGE ((uint32_t)0x80000000)
357#define SD_OCR_ADDR_MISALIGNED ((uint32_t)0x40000000)
358#define SD_OCR_BLK_LEN_ERR ((uint32_t)0x20000000)
359#define SD_OCR_ERASE_SEQ_ERR ((uint32_t)0x10000000)
360#define SD_OCR_INVALID_ERASE_PARAM ((uint32_t)0x08000000)
361#define SD_OCR_WR_PROTECT_VIOLATION ((uint32_t)0x04000000)
362#define SD_OCR_LOCK_UNLOCK_ERROR ((uint32_t)0x01000000)
363#define SD_OCR_CMD_CRC_ERROR ((uint32_t)0x00800000)
364#define SD_OCR_ILLEGAL_CMD ((uint32_t)0x00400000)
365#define SD_OCR_CARD_ECC_ERROR ((uint32_t)0x00200000)
366#define SD_OCR_CARD_CONTROLLER_ERR ((uint32_t)0x00100000)
367#define SD_OCR_GENERAL_UNKNOWN_ERROR ((uint32_t)0x00080000)
368#define SD_OCR_STREAM_RD_UNDERRUN ((uint32_t)0x00040000)
369#define SD_OCR_STREAM_WR_OVERRUN ((uint32_t)0x00020000)
370#define SD_OCR_CID_CSD_OVERWRIETE ((uint32_t)0x00010000)
371#define SD_OCR_WP_ERASE_SKIP ((uint32_t)0x00008000)
372#define SD_OCR_CARD_ECC_DISABLED ((uint32_t)0x00004000)
373#define SD_OCR_ERASE_RESET ((uint32_t)0x00002000)
374#define MMC_SWITCH_ERROR ((uint32_t)0x00000080)
375#define SD_OCR_AKE_SEQ_ERROR ((uint32_t)0x00000008)
376#define SD_OCR_ERRORBITS ((uint32_t)0xFDFFE008)
377
381#define SD_R5_OUT_OF_RANGE ((uint32_t)0x00000100)
382#define SD_R5_FUNCTION_NUMBER ((uint32_t)0x00000200)
383#define SD_R5_ERROR ((uint32_t)0x00000800)
384
388#define SD_R6_GENERAL_UNKNOWN_ERROR ((uint32_t)0x00002000)
389#define SD_R6_ILLEGAL_CMD ((uint32_t)0x00004000)
390#define SD_R6_CMD_CRC_ERROR ((uint32_t)0x00008000)
391#define SD_VOLTAGE_WINDOW_SD ((uint32_t)0x80100000)
392#define SD_HIGH_CAPACITY ((uint32_t)0x40000000)
393#define SD_STD_CAPACITY ((uint32_t)0x00000000)
394#define SD_CHECK_PATTERN ((uint32_t)0x000001AA)
395#define SD_VOLTAGE_WINDOW_MMC ((uint32_t)0x40FF8000)
396#define SD_MAX_VOLT_TRIAL ((uint32_t)0x000000FF)
397#define SD_ALLZERO ((uint32_t)0x00000000)
398#define SD_WIDE_BUS_SUPPORT ((uint32_t)0x00040000)
399#define SD_SINGLE_BUS_SUPPORT ((uint32_t)0x00010000)
400#define SD_CARD_LOCKED ((uint32_t)0x02000000)
401#define SD_CARD_PROGRAMMING ((uint32_t)0x00000007)
402#define SD_CARD_RECEIVING ((uint32_t)0x00000006)
403#define SD_DATATIMEOUT ((uint32_t)0xFFFFFFFF)
404#define SD_0TO7BITS ((uint32_t)0x000000FF)
405#define SD_8TO15BITS ((uint32_t)0x0000FF00)
406#define SD_16TO23BITS ((uint32_t)0x00FF0000)
407#define SD_24TO31BITS ((uint32_t)0xFF000000)
408#define SD_MAX_DATA_LENGTH ((uint32_t)0x01FFFFFF)
409#define SD_HALFFIFO ((uint32_t)0x00000008)
410#define SD_HALFFIFOBYTES ((uint32_t)0x00000020)
411
423#define SD_CCCC_LOCK_UNLOCK ((uint32_t)0x00000080)
424#define SD_CCCC_WRITE_PROT ((uint32_t)0x00000040)
425#define SD_CCCC_ERASE ((uint32_t)0x00000020)
426
438#define SDIO_SEND_IF_COND ((uint32_t)0x00000008)
439
451#define EXT_CSD_Command_set 0x0
452#define EXT_CSD_Set_bit 0x1
453#define EXT_CSD_Clear_byte 0x2
454#define EXT_CSD_Write_byte 0x3
455
456#define EXT_CSD_CMD_SET_NORMAL (1<<0)
457#define EXT_CSD_CMD_SET_SECURE (1<<1)
458#define EXT_CSD_CMD_SET_CPSECURE (1<<2)
459
463#define EXT_CSD_BUS_WIDTH 183
464#define EXT_CSD_HS_TIMING 185
465
474#define SDIO_INTR_STS_WRITE_MASK (SDIO_DTFAIL_FLAG | SDIO_DTTIMEOUT_FLAG | SDIO_TXERRU_FLAG | \
475 SDIO_DTCMPL_FLAG | SDIO_SBITERR_FLAG)
476#define SDIO_INTR_STS_READ_MASK (SDIO_DTFAIL_FLAG | SDIO_DTTIMEOUT_FLAG | SDIO_RXERRO_FLAG | \
477 SDIO_DTCMPL_FLAG | SDIO_SBITERR_FLAG)
486/* sd exported functions ----------------------------------------*/
487 sd_error_status_type sd_init(void);
488void sdio_clock_set(uint32_t clkdiv);
489 sd_error_status_type sd_power_on(void);
490 sd_error_status_type sd_power_off(void);
491 sd_error_status_type sd_card_init(void);
492 sd_error_status_type sd_card_info_get(sd_card_info_struct_type *card_info);
493 sd_error_status_type sd_wide_bus_operation_config(sdio_bus_width_type mode);
494 sd_error_status_type sd_device_mode_set(uint32_t mode);
495 sd_error_status_type sd_deselect_select(uint32_t addr);
496 sd_error_status_type sd_status_send(uint32_t *p_card_status);
497 sd_card_state_type sd_state_get(void);
498 sd_error_status_type sd_blocks_erase(long long addr, uint32_t nblks);
499 sd_error_status_type sd_block_read(uint8_t *buf, long long addr, uint16_t blk_size);
500 sd_error_status_type sd_mult_blocks_read(uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks);
501 sd_error_status_type sd_block_write(const uint8_t *buf, long long addr, uint16_t blk_size);
502 sd_error_status_type sd_mult_blocks_write(const uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks);
503 sd_error_status_type mmc_stream_read(uint8_t *buf, long long addr, uint32_t len);
504 sd_error_status_type mmc_stream_write(uint8_t *buf, long long addr, uint32_t len);
505 sd_error_status_type sd_irq_service(void);
506void sd_dma_config(uint32_t *mbuf, uint32_t buf_size, dma_dir_type dir);
507
520#ifdef __cplusplus
521}
522#endif
523
524#endif /* __AT32_SDIO_H */
at32f413.h
at32f413 header file
card_type
static sd_memory_card_type card_type
Definition emmc_card/src/at32_sdio.c:41
rca
static uint32_t rca
Definition emmc_card/src/at32_sdio.c:42
dma_dir_type
dma_dir_type
dma direction type
Definition at32f413_dma.h:215
sd_power_off
sd_error_status_type sd_power_off(void)
turns the sdio output signals off.
Definition emmc_card/src/at32_sdio.c:425
sd_irq_service
sd_error_status_type sd_irq_service(void)
allows to process all the interrupts that are high.
Definition emmc_card/src/at32_sdio.c:1811
sd_device_mode_set
sd_error_status_type sd_device_mode_set(uint32_t mode)
set sdio work mode.
Definition emmc_card/src/at32_sdio.c:808
sd_card_info_get
sd_error_status_type sd_card_info_get(sd_card_info_struct_type *card_info)
returns information about specific card.
Definition emmc_card/src/at32_sdio.c:554
mmc_stream_write
sd_error_status_type mmc_stream_write(uint8_t *buf, long long addr, uint32_t len)
write mmc card data stream.
Definition emmc_card/src/at32_sdio.c:1722
sd_card_init
sd_error_status_type sd_card_init(void)
intialises all cards or single card as the case may be card(s) come into standby state.
Definition emmc_card/src/at32_sdio.c:439
sd_block_read
sd_error_status_type sd_block_read(uint8_t *buf, long long addr, uint16_t blk_size)
allows to read one block from a specified address in a card. the data transfer can be managed by dma ...
Definition emmc_card/src/at32_sdio.c:1210
sd_deselect_select
sd_error_status_type sd_deselect_select(uint32_t addr)
selects od deselects the corresponding card.
Definition emmc_card/src/at32_sdio.c:829
sdio_clock_set
void sdio_clock_set(uint32_t clkdiv)
set sdio clock devision factor.
Definition emmc_card/src/at32_sdio.c:209
sd_blocks_erase
sd_error_status_type sd_blocks_erase(long long addr, uint32_t nblks)
erase continuous data block
Definition emmc_card/src/at32_sdio.c:1052
sd_mult_blocks_write
sd_error_status_type sd_mult_blocks_write(const uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks)
allows to write blocks starting from a specified address in a card. the data transfer can be managed ...
Definition emmc_card/src/at32_sdio.c:1511
sd_state_get
sd_card_state_type sd_state_get(void)
returns information about sd card.
Definition emmc_card/src/at32_sdio.c:2511
sd_dma_config
void sd_dma_config(uint32_t *mbuf, uint32_t buf_size, dma_dir_type dir)
set dma configuation for sdio
Definition emmc_card/src/at32_sdio.c:2799
sd_block_write
sd_error_status_type sd_block_write(const uint8_t *buf, long long addr, uint16_t blk_size)
allows to write one block starting from a specified address in a card. the data transfer can be manag...
Definition emmc_card/src/at32_sdio.c:1389
sd_status_send
sd_error_status_type sd_status_send(uint32_t *p_card_status)
read current card status.
Definition emmc_card/src/at32_sdio.c:2474
sd_init
sd_error_status_type sd_init(void)
initializes the sd card and put it into standby state (ready for data transfer).
Definition emmc_card/src/at32_sdio.c:73
mmc_stream_read
sd_error_status_type mmc_stream_read(uint8_t *buf, long long addr, uint32_t len)
read mmc card data stream.
Definition emmc_card/src/at32_sdio.c:1675
sd_power_on
sd_error_status_type sd_power_on(void)
enquires cards about their operating voltage and configures clock controls.
Definition emmc_card/src/at32_sdio.c:224
sd_mult_blocks_read
sd_error_status_type sd_mult_blocks_read(uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks)
allows to read blocks from a specified address in a card. the data transfer can be managed by dma mod...
Definition emmc_card/src/at32_sdio.c:1299
sd_wide_bus_operation_config
sd_error_status_type sd_wide_bus_operation_config(sdio_bus_width_type mode)
enable wide bus opeartion for the requeseted card if supported by card.
Definition emmc_card/src/at32_sdio.c:765
sd_card_info
sd_card_info_struct_type sd_card_info
Definition emmc_card/src/at32_sdio.c:48
sd_data_transfer_mode_type
sd_data_transfer_mode_type
Definition sd_mmc_card/inc/at32_sdio.h:64
sd_error_status_type
sd_error_status_type
Definition sd_mmc_card/inc/at32_sdio.h:73
sd_card_state_type
sd_card_state_type
Definition sd_mmc_card/inc/at32_sdio.h:186
sdio_bus_width_type
sdio_bus_width_type
sdio bus width
Definition at32f413_sdio.h:138
sd_memory_card_type
sd_memory_card_type
Definition sd_mmc_card/inc/at32_sdio.h:202
SD_TRANSFER_DMA_MODE
@ SD_TRANSFER_DMA_MODE
Definition sd_mmc_card/inc/at32_sdio.h:66
SD_TRANSFER_POLLING_MODE
@ SD_TRANSFER_POLLING_MODE
Definition sd_mmc_card/inc/at32_sdio.h:65
SD_ERROR
@ SD_ERROR
Definition sd_mmc_card/inc/at32_sdio.h:117
SD_WP_ERASE_SKIP
@ SD_WP_ERASE_SKIP
Definition sd_mmc_card/inc/at32_sdio.h:97
SD_SDIO_UNKNOWN_FUNC
@ SD_SDIO_UNKNOWN_FUNC
Definition sd_mmc_card/inc/at32_sdio.h:107
SD_DATA_FAIL
@ SD_DATA_FAIL
Definition sd_mmc_card/inc/at32_sdio.h:76
SD_STREAM_WR_OVERRUN
@ SD_STREAM_WR_OVERRUN
Definition sd_mmc_card/inc/at32_sdio.h:95
SD_INVALID_PARAMETER
@ SD_INVALID_PARAMETER
Definition sd_mmc_card/inc/at32_sdio.h:114
SD_CMD_FAIL
@ SD_CMD_FAIL
Definition sd_mmc_card/inc/at32_sdio.h:75
SD_CMD_OUT_OF_RANGE
@ SD_CMD_OUT_OF_RANGE
Definition sd_mmc_card/inc/at32_sdio.h:82
SD_UNSUPPORTED_HW
@ SD_UNSUPPORTED_HW
Definition sd_mmc_card/inc/at32_sdio.h:116
SD_SDIO_FUNC_ERROR
@ SD_SDIO_FUNC_ERROR
Definition sd_mmc_card/inc/at32_sdio.h:106
SD_INTERNAL_ERROR
@ SD_INTERNAL_ERROR
Definition sd_mmc_card/inc/at32_sdio.h:110
SD_INVALID_ERASE_PARAM
@ SD_INVALID_ERASE_PARAM
Definition sd_mmc_card/inc/at32_sdio.h:86
SD_GENERAL_UNKNOWN_ERROR
@ SD_GENERAL_UNKNOWN_ERROR
Definition sd_mmc_card/inc/at32_sdio.h:93
SD_CARD_ECC_DISABLED
@ SD_CARD_ECC_DISABLED
Definition sd_mmc_card/inc/at32_sdio.h:98
SD_CARD_CONTROLLER_ERR
@ SD_CARD_CONTROLLER_ERR
Definition sd_mmc_card/inc/at32_sdio.h:92
SD_ERASE_RESET
@ SD_ERASE_RESET
Definition sd_mmc_card/inc/at32_sdio.h:99
SD_CARD_ECC_ERROR
@ SD_CARD_ECC_ERROR
Definition sd_mmc_card/inc/at32_sdio.h:91
SD_STREAM_RD_UNDERRUN
@ SD_STREAM_RD_UNDERRUN
Definition sd_mmc_card/inc/at32_sdio.h:94
SD_UNSUPPORTED_FEATURE
@ SD_UNSUPPORTED_FEATURE
Definition sd_mmc_card/inc/at32_sdio.h:115
SD_TX_UNDERRUN
@ SD_TX_UNDERRUN
Definition sd_mmc_card/inc/at32_sdio.h:79
SD_ILLEGAL_CMD
@ SD_ILLEGAL_CMD
Definition sd_mmc_card/inc/at32_sdio.h:90
SD_SDIO_FUNC_BUSY
@ SD_SDIO_FUNC_BUSY
Definition sd_mmc_card/inc/at32_sdio.h:105
SD_CMD_CRC_ERROR
@ SD_CMD_CRC_ERROR
Definition sd_mmc_card/inc/at32_sdio.h:89
SD_ADDR_OUT_OF_RANGE
@ SD_ADDR_OUT_OF_RANGE
Definition sd_mmc_card/inc/at32_sdio.h:102
SD_RX_OVERRUN
@ SD_RX_OVERRUN
Definition sd_mmc_card/inc/at32_sdio.h:80
SD_REQ_PENDING
@ SD_REQ_PENDING
Definition sd_mmc_card/inc/at32_sdio.h:112
SD_REQ_NOT_APPLICABLE
@ SD_REQ_NOT_APPLICABLE
Definition sd_mmc_card/inc/at32_sdio.h:113
SD_SWITCH_ERROR
@ SD_SWITCH_ERROR
Definition sd_mmc_card/inc/at32_sdio.h:103
SD_INVALID_VOLTRANGE
@ SD_INVALID_VOLTRANGE
Definition sd_mmc_card/inc/at32_sdio.h:101
SD_SDIO_DISABLED
@ SD_SDIO_DISABLED
Definition sd_mmc_card/inc/at32_sdio.h:104
SD_DATA_TIMEOUT
@ SD_DATA_TIMEOUT
Definition sd_mmc_card/inc/at32_sdio.h:78
SD_ADDR_MISALIGNED
@ SD_ADDR_MISALIGNED
Definition sd_mmc_card/inc/at32_sdio.h:83
SD_START_BIT_ERR
@ SD_START_BIT_ERR
Definition sd_mmc_card/inc/at32_sdio.h:81
SD_LOCK_UNLOCK_ERROR
@ SD_LOCK_UNLOCK_ERROR
Definition sd_mmc_card/inc/at32_sdio.h:88
SD_NOT_CONFIGURED
@ SD_NOT_CONFIGURED
Definition sd_mmc_card/inc/at32_sdio.h:111
SD_CID_CSD_OVERWRITE
@ SD_CID_CSD_OVERWRITE
Definition sd_mmc_card/inc/at32_sdio.h:96
SD_WR_PROTECT_VIOLATION
@ SD_WR_PROTECT_VIOLATION
Definition sd_mmc_card/inc/at32_sdio.h:87
SD_CMD_RSP_TIMEOUT
@ SD_CMD_RSP_TIMEOUT
Definition sd_mmc_card/inc/at32_sdio.h:77
SD_BLK_LEN_ERR
@ SD_BLK_LEN_ERR
Definition sd_mmc_card/inc/at32_sdio.h:84
SD_OK
@ SD_OK
Definition sd_mmc_card/inc/at32_sdio.h:118
SD_ERASE_SEQ_ERR
@ SD_ERASE_SEQ_ERR
Definition sd_mmc_card/inc/at32_sdio.h:85
SD_AKE_SEQ_ERROR
@ SD_AKE_SEQ_ERROR
Definition sd_mmc_card/inc/at32_sdio.h:100
SD_CARD_TRANSFER
@ SD_CARD_TRANSFER
Definition sd_mmc_card/inc/at32_sdio.h:190
SD_CARD_IDENTIFICATION
@ SD_CARD_IDENTIFICATION
Definition sd_mmc_card/inc/at32_sdio.h:188
SD_CARD_SENDING
@ SD_CARD_SENDING
Definition sd_mmc_card/inc/at32_sdio.h:191
SD_CARD_STANDBY
@ SD_CARD_STANDBY
Definition sd_mmc_card/inc/at32_sdio.h:189
SD_CARD_READY
@ SD_CARD_READY
Definition sd_mmc_card/inc/at32_sdio.h:187
SD_CARD_DISCONNECTED
@ SD_CARD_DISCONNECTED
Definition sd_mmc_card/inc/at32_sdio.h:194
SD_CARD_ERROR
@ SD_CARD_ERROR
Definition sd_mmc_card/inc/at32_sdio.h:195
SDIO_SDIO_CARD
@ SDIO_SDIO_CARD
Definition sd_mmc_card/inc/at32_sdio.h:211
SDIO_HIGH_CAPACITY_SD_CARD
@ SDIO_HIGH_CAPACITY_SD_CARD
Definition sd_mmc_card/inc/at32_sdio.h:205
SDIO_SECURE_DIGITAL_IO_COMBO_CARD
@ SDIO_SECURE_DIGITAL_IO_COMBO_CARD
Definition sd_mmc_card/inc/at32_sdio.h:209
SDIO_HIGH_SPEED_MULTIMEDIA_CARD
@ SDIO_HIGH_SPEED_MULTIMEDIA_CARD
Definition sd_mmc_card/inc/at32_sdio.h:208
SDIO_STD_CAPACITY_SD_CARD_V1_1
@ SDIO_STD_CAPACITY_SD_CARD_V1_1
Definition sd_mmc_card/inc/at32_sdio.h:203
SDIO_SECURE_DIGITAL_IO_CARD
@ SDIO_SECURE_DIGITAL_IO_CARD
Definition sd_mmc_card/inc/at32_sdio.h:207
SDIO_STD_CAPACITY_SD_CARD_V2_0
@ SDIO_STD_CAPACITY_SD_CARD_V2_0
Definition sd_mmc_card/inc/at32_sdio.h:204
SDIO_MULTIMEDIA_CARD
@ SDIO_MULTIMEDIA_CARD
Definition sd_mmc_card/inc/at32_sdio.h:206
SDIO_HIGH_CAPACITY_MMC_CARD
@ SDIO_HIGH_CAPACITY_MMC_CARD
Definition sd_mmc_card/inc/at32_sdio.h:210
SD_CARD_RECEIVING
#define SD_CARD_RECEIVING
Definition sd_mmc_card/inc/at32_sdio.h:402
SD_CARD_PROGRAMMING
#define SD_CARD_PROGRAMMING
Definition sd_mmc_card/inc/at32_sdio.h:401
sd_card_info_struct_type
Definition emmc_card/inc/at32_sdio.h:236
sd_cid_struct_type
Definition emmc_card/inc/at32_sdio.h:169
sd_csd_struct_type
Definition emmc_card/inc/at32_sdio.h:125
sd_scr_struct_type
Definition emmc_card/inc/at32_sdio.h:218


AT32F413 Firmwary Library: at32_sdio.c Source File

  • sdio
  • sd_mmc_card
  • src
sd_mmc_card/src/at32_sdio.c
Go to the documentation of this file.
1
27#include "at32_sdio.h"
28#include "at32f413_board.h"
29
38 sdio_command_struct_type sdio_command_init_struct;
39 sdio_data_struct_type sdio_data_init_struct;
40
41static sd_memory_card_type card_type = SDIO_STD_CAPACITY_SD_CARD_V1_1; /* sd card type */
42static uint32_t csd_table[4], cid_table[4], rca = 0; /* csd, sid, rca */
43static uint32_t ext_csd_table[128];
44static sd_data_transfer_mode_type device_mode = SD_TRANSFER_POLLING_MODE; /* working mode */
45static uint8_t stop_flag = 0; /* transmit stop flag */
46volatile sd_error_status_type transfer_error = SD_OK; /* transmit error flag */
47volatile uint8_t transfer_end = 0; /* transmit end flag */
48 sd_card_info_struct_type sd_card_info; /* sd card information */
49
50 sd_error_status_type command_error(void);
51 sd_error_status_type command_rsp1_error(uint8_t cmd);
52 sd_error_status_type command_rsp2_error(void);
53 sd_error_status_type command_rsp3_error(void);
54 sd_error_status_type command_rsp4_error(uint8_t cmd);
55 sd_error_status_type command_rsp5_error(uint8_t cmd);
56 sd_error_status_type command_rsp6_error(uint8_t cmd, uint16_t *p_rca);
57 sd_error_status_type command_rsp7_error(void);
58 sd_error_status_type sd_bus_wide_enable(confirm_state new_state);
59 sd_error_status_type mmc_switch(uint8_t set, uint8_t index, uint8_t value);
60 sd_error_status_type sd_switch(uint32_t mode, uint32_t group, uint8_t value, uint8_t *rsp);
61 sd_error_status_type check_card_programming(uint8_t *p_status);
62 sd_error_status_type speed_change(uint8_t speed);
63 sd_error_status_type get_ext_csd(void);
64 sd_error_status_type scr_find(void);
65uint8_t convert_from_bytes_to_power_of_two(uint16_t number_of_bytes);
66
73 sd_error_status_type sd_init(void)
74{
75 uint16_t clkdiv = 0;
76 sd_error_status_type status = SD_OK;
77 gpio_init_type gpio_init_struct = {0};
78 uint8_t retry = 0;
79
80 /* gpioc and gpiod periph clock enable */
81 crm_periph_clock_enable(CRM_GPIOC_PERIPH_CLOCK, TRUE);
82 crm_periph_clock_enable(CRM_GPIOD_PERIPH_CLOCK, TRUE);
83
84 /* sdio periph clock enable */
85 crm_periph_clock_enable(CRM_SDIO1_PERIPH_CLOCK, TRUE);
86
87 /* configure pc.08, pc.09, pc.10, pc.11, pc.12 pin: d0, d1, d2, d3, clk pin */
88 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
89 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
90 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
91 gpio_init_struct.gpio_pins = GPIO_PINS_8 | GPIO_PINS_9 | GPIO_PINS_10 | GPIO_PINS_11 | GPIO_PINS_12;
92 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
93 gpio_init(GPIOC, &gpio_init_struct);
94
95 /* configure pd.02 cmd line */
96 gpio_init_struct.gpio_pins = GPIO_PINS_2;
97 gpio_init(GPIOD, &gpio_init_struct);
98
99 retry = 3;
100 while(retry--){
101 /* reset sdio */
102 sdio_reset(SDIOx);
103 /* power on */
104 status = sd_power_on();
105
106 if(status == SD_OK)
107 break;
108 }
109
110 if(status == SD_OK)
111 {
112 /* sdio card initialize */
113 status = sd_card_init();
114 }
115
116 if(status == SD_OK)
117 {
118 /* get card information*/
119 status = sd_card_info_get(&sd_card_info);
120 }
121
122 if((SDIO_MULTIMEDIA_CARD == card_type) && (sd_card_info.sd_csd_reg.spec_version >= 4))
123 {
124 card_type = SDIO_HIGH_SPEED_MULTIMEDIA_CARD;
125 sd_card_info.card_type = (uint8_t)card_type;
126 }
127
128 if(status == SD_OK)
129 {
130 /* select card */
131 status = sd_deselect_select((uint32_t)(sd_card_info.rca << 16));
132 }
133
134 if(status == SD_OK)
135 {
136 if(SDIO_HIGH_SPEED_MULTIMEDIA_CARD == card_type)
137 {
138 if(sd_card_info.sd_csd_reg.device_size == 0xFFF)
139 {
140 uint32_t sec_count;
141 /* get ext_csd function for support emmc card. */
142 status = get_ext_csd();
143 if(status == SD_OK)
144 {
145 card_type = SDIO_HIGH_CAPACITY_MMC_CARD;
146 sd_card_info.card_type = (uint8_t)card_type;
147 sec_count = ext_csd_table[212/4];
148 sd_card_info.card_capacity = (uint64_t)sec_count*512;
149 }
150 }
151 }
152 }
153
154 if(status == SD_OK && ((SDIO_STD_CAPACITY_SD_CARD_V1_1 == card_type) || (SDIO_STD_CAPACITY_SD_CARD_V2_0 == card_type) || \
155 (SDIO_SECURE_DIGITAL_IO_COMBO_CARD == card_type) || (SDIO_HIGH_CAPACITY_SD_CARD == card_type)))
156 {
157 status = scr_find();
158 }
159
160 if(status == SD_OK)
161 {
162 /* set normal speed */
163 status = speed_change(0);
164 }
165
166 if((status == SD_OK) || (card_type == SDIO_MULTIMEDIA_CARD))
167 {
168 if(sd_card_info.card_type == SDIO_STD_CAPACITY_SD_CARD_V1_1 || sd_card_info.card_type == SDIO_STD_CAPACITY_SD_CARD_V2_0)
169 {
170 /* set sdio_ck to 12mhz */
171 clkdiv = system_core_clock / 12000000;
172
173 if(clkdiv >= 2)
174 {
175 clkdiv -= 2;
176 }
177 }
178 else
179 {
180 /* set sdio_ck to 25mhz */
181 clkdiv = system_core_clock / 25000000;
182
183 if(clkdiv >= 2)
184 {
185 clkdiv -= 2;
186 }
187 }
188 /* set sdio clock divider */
189 sdio_clock_set(clkdiv);
190
191 /* set transfer mode */
192 status = sd_device_mode_set(SD_TRANSFER_DMA_MODE);
193 }
194
195 if(status == SD_OK)
196 {
197 /* Set data width */
198 status = sd_wide_bus_operation_config(SDIO_BUS_WIDTH_D4);
199 }
200
201 return status;
202}
203
209void sdio_clock_set(uint32_t clk_div)
210{
211 /* config clock divide [7:0] */
212 SDIOx->clkctrl_bit.clkdiv_l = (clk_div & 0xFF);
213
214 /* config clock divide [9:8] */
215 SDIOx->clkctrl_bit.clkdiv_h = ((clk_div & 0x300) >> 8);
216}
217
224 sd_error_status_type sd_power_on(void)
225{
226 uint8_t retry = 0;
227 sd_error_status_type status = SD_OK;
228 uint32_t response = 0, count = 0, valid_voltage = 0, clk_psc;
229 uint32_t sd_type = SD_STD_CAPACITY;
230
231 /* sdio_ck is less than 400KHz in initialization stage, set to 200KHz */
232 clk_psc = (system_core_clock / 200000) - 2;
233
234 if(clk_psc > 0x3FF)
235 {
236 clk_psc = 0x3FF;
237 }
238
239 /* config sdio clock divide and edge phase */
240 sdio_clock_config(SDIOx, clk_psc, SDIO_CLOCK_EDGE_FALLING);
241 /* config sdio bus width */
242 sdio_bus_width_config(SDIOx, SDIO_BUS_WIDTH_D1);
243 /* disable flow control */
244 sdio_flow_control_enable(SDIOx, FALSE);
245 /* disable clock bypass */
246 sdio_clock_bypass(SDIOx, FALSE);
247 /* disable power saving mode */
248 sdio_power_saving_mode_enable(SDIOx, FALSE);
249
250 /* sdio power on */
251 sdio_power_set(SDIOx, SDIO_POWER_ON);
252 /* enable to output sdio_ck */
253 sdio_clock_enable(SDIOx, TRUE);
254 delay_ms(10);
255
256 for(retry = 0; retry < 5; retry++)
257 {
258 /* send cmd0, get in idle stage */
259 sdio_command_init_struct.argument = 0x0;
260 sdio_command_init_struct.cmd_index = SD_CMD_GO_IDLE_STATE;
261 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_NO;
262 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
263
264 /* sdio command config */
265 sdio_command_config(SDIOx, &sdio_command_init_struct);
266 /* enable ccsm */
267 sdio_command_state_machine_enable(SDIOx, TRUE);
268
269 /* get command status */
270 status = command_error();
271 }
272
273 /* send cmd8, check card interface feature */
274 sdio_command_init_struct.argument = SD_CHECK_PATTERN;
275 sdio_command_init_struct.cmd_index = SDIO_SEND_IF_COND;
276 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
277 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
278
279 /* sdio command config */
280 sdio_command_config(SDIOx, &sdio_command_init_struct);
281 /* enable ccsm */
282 sdio_command_state_machine_enable(SDIOx, TRUE);
283
284 /* waiting R7 */
285 status = command_rsp7_error();
286
287 if(status == SD_OK)
288 {
289 /* set card type and sd type */
290 card_type = SDIO_STD_CAPACITY_SD_CARD_V2_0;
291 sd_type = SD_HIGH_CAPACITY;
292 }
293
294 /* send cmd55, check sd version */
295 sdio_command_init_struct.argument = 0x00;
296 sdio_command_init_struct.cmd_index = SD_CMD_APP_CMD;
297 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
298 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
299
300 /* sdio command config */
301 sdio_command_config(SDIOx, &sdio_command_init_struct);
302 /* enable ccsm */
303 sdio_command_state_machine_enable(SDIOx, TRUE);
304
305 /* waiting R1 */
306 status = command_rsp1_error(SD_CMD_APP_CMD);
307
308 /* check sd card or mmc card */
309 if(SD_OK == status)
310 {
311 /* send acmd41, check voltage operation range */
312 while((!valid_voltage) && (count < SD_MAX_VOLT_TRIAL))
313 {
314 delay_ms(10);
315
316 /* send cmd55 before acmd41 */
317 sdio_command_init_struct.argument = 0x00;
318 sdio_command_init_struct.cmd_index = SD_CMD_APP_CMD;
319 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
320 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
321
322 /* sdio command config */
323 sdio_command_config(SDIOx, &sdio_command_init_struct);
324 /* enable ccsm */
325 sdio_command_state_machine_enable(SDIOx, TRUE);
326
327 /* waiting R1 */
328 status = command_rsp1_error(SD_CMD_APP_CMD);
329
330 /* if any errors occured, return status */
331 if(status != SD_OK)
332 {
333 return status;
334 }
335
336 /* send acmd41 */
337 sdio_command_init_struct.argument = SD_VOLTAGE_WINDOW_SD | sd_type;
338 sdio_command_init_struct.cmd_index = SD_CMD_SD_APP_OP_COND;
339 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
340 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
341
342 /* sdio command config */
343 sdio_command_config(SDIOx, &sdio_command_init_struct);
344 /* enable ccsm */
345 sdio_command_state_machine_enable(SDIOx, TRUE);
346
347 /* waiting R3 */
348 status = command_rsp3_error();
349
350 /* if any errors occured, return status */
351 if(status != SD_OK)
352 {
353 return status;
354 }
355
356 /* get response1 */
357 response = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
358
359 /* check sd card power on stage is success or not */
360 valid_voltage = (((response >> 31) == 1) ? 1 : 0);
361 count++;
362 }
363
364 if(count >= SD_MAX_VOLT_TRIAL)
365 {
366 status = SD_INVALID_VOLTRANGE;
367 return status;
368 }
369
370 if(response &= SD_HIGH_CAPACITY)
371 {
372 card_type = SDIO_HIGH_CAPACITY_SD_CARD;
373 }
374 }
375 /* mmc card */
376 else
377 {
378 /* send cmd1 */
379 while((!valid_voltage) && (count < SD_MAX_VOLT_TRIAL))
380 {
381 delay_ms(10);
382
383 sdio_command_init_struct.argument = SD_VOLTAGE_WINDOW_MMC;
384 sdio_command_init_struct.cmd_index = SD_CMD_SEND_OP_COND;
385 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
386 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
387
388 /* sdio command config */
389 sdio_command_config(SDIOx, &sdio_command_init_struct);
390 /* enable ccsm */
391 sdio_command_state_machine_enable(SDIOx, TRUE);
392
393 /* waiting R3 */
394 status = command_rsp3_error();
395
396 if(status != SD_OK)
397 {
398 return status;
399 }
400
401 /* get response1 */
402 response = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
403
404 valid_voltage = (((response >> 31) == 1) ? 1 : 0);
405 count++;
406 }
407
408 if(count >= SD_MAX_VOLT_TRIAL)
409 {
410 status = SD_INVALID_VOLTRANGE;
411 return status;
412 }
413
414 card_type = SDIO_MULTIMEDIA_CARD;
415 }
416
417 return(status);
418}
419
425 sd_error_status_type sd_power_off(void)
426{
427 /* sdio power off */
428 sdio_power_set(SDIOx, SDIO_POWER_OFF);
429
430 return SD_OK;
431}
432
439 sd_error_status_type sd_card_init(void)
440{
441 sd_error_status_type status = SD_OK;
442 uint16_t rca_temp = 0x01;
443
444 /* check power status */
445 if(SDIO_POWER_OFF == sdio_power_status_get(SDIOx))
446 {
447 return SD_REQ_NOT_APPLICABLE;
448 }
449
450 /* check is secure_digital_io_card or not */
451 if(SDIO_SECURE_DIGITAL_IO_CARD != card_type)
452 {
453 /* send cmd2, get cid register */
454 sdio_command_init_struct.argument = 0x0;
455 sdio_command_init_struct.cmd_index = SD_CMD_ALL_SEND_CID;
456 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_LONG;
457 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
458
459 /* sdio command config */
460 sdio_command_config(SDIOx, &sdio_command_init_struct);
461 /* enable ccsm */
462 sdio_command_state_machine_enable(SDIOx, TRUE);
463
464 status = command_rsp2_error();
465 if(status != SD_OK)
466 {
467 return status;
468 }
469
470 cid_table[0] = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
471 cid_table[1] = sdio_response_get(SDIOx, SDIO_RSP2_INDEX);
472 cid_table[2] = sdio_response_get(SDIOx, SDIO_RSP3_INDEX);
473 cid_table[3] = sdio_response_get(SDIOx, SDIO_RSP4_INDEX);
474 }
475
476 /* check card type */
477 if((card_type == SDIO_STD_CAPACITY_SD_CARD_V1_1) || (card_type == SDIO_STD_CAPACITY_SD_CARD_V2_0) || \
478 (card_type == SDIO_SECURE_DIGITAL_IO_COMBO_CARD) || (card_type == SDIO_HIGH_CAPACITY_SD_CARD))
479 {
480 /* send cmd3, get rca */
481 sdio_command_init_struct.argument = 0x00;
482 sdio_command_init_struct.cmd_index = SD_CMD_SET_REL_ADDR;
483 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
484 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
485
486 /* sdio command config */
487 sdio_command_config(SDIOx, &sdio_command_init_struct);
488 /* enable ccsm */
489 sdio_command_state_machine_enable(SDIOx, TRUE);
490
491 status = command_rsp6_error(SD_CMD_SET_REL_ADDR, &rca_temp);
492 if(status != SD_OK)
493 {
494 return status;
495 }
496 }
497
498 /* mmc card */
499 if(card_type == SDIO_MULTIMEDIA_CARD)
500 {
501 /* send cmd3 */
502 sdio_command_init_struct.argument = (uint32_t)(rca_temp << 16);
503 sdio_command_init_struct.cmd_index = SD_CMD_SET_REL_ADDR;
504 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
505 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
506
507 /* sdio command config */
508 sdio_command_config(SDIOx, &sdio_command_init_struct);
509 /* enable ccsm */
510 sdio_command_state_machine_enable(SDIOx, TRUE);
511
512 status = command_rsp2_error();
513 if(status != SD_OK)
514 {
515 return status;
516 }
517 }
518
519 /* check is secure_digital_io_card or not */
520 if(card_type != SDIO_SECURE_DIGITAL_IO_CARD)
521 {
522 rca = rca_temp;
523 sdio_command_init_struct.argument = (uint32_t)(rca << 16);
524 sdio_command_init_struct.cmd_index = SD_CMD_SEND_CSD;
525 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_LONG;
526 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
527
528 /* sdio command config */
529 sdio_command_config(SDIOx, &sdio_command_init_struct);
530 /* enable ccsm */
531 sdio_command_state_machine_enable(SDIOx, TRUE);
532
533 status = command_rsp2_error();
534 if(status != SD_OK)
535 {
536 return status;
537 }
538
539 csd_table[0] = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
540 csd_table[1] = sdio_response_get(SDIOx, SDIO_RSP2_INDEX);
541 csd_table[2] = sdio_response_get(SDIOx, SDIO_RSP3_INDEX);
542 csd_table[3] = sdio_response_get(SDIOx, SDIO_RSP4_INDEX);
543 }
544
545 return SD_OK;
546}
547
554 sd_error_status_type sd_card_info_get(sd_card_info_struct_type *card_info)
555{
556 sd_error_status_type status = SD_OK;
557 uint8_t tmp = 0;
558
559 card_info->card_type = (uint8_t)card_type;
560 card_info->rca = (uint16_t)rca;
561
562 /* byte 0 */
563 tmp = (uint8_t)((csd_table[0] & 0xFF000000) >> 24);
564 card_info->sd_csd_reg.csd_struct = (tmp & 0xC0) >> 6;
565 card_info->sd_csd_reg.spec_version = (tmp & 0x3C) >> 2;
566 card_info->sd_csd_reg.reserved1 = tmp & 0x03;
567
568 /* byte 1 */
569 tmp = (uint8_t)((csd_table[0] & 0x00FF0000) >> 16);
570 card_info->sd_csd_reg.taac = tmp;
571
572 /* byte 2 */
573 tmp = (uint8_t)((csd_table[0] & 0x0000FF00) >> 8);
574 card_info->sd_csd_reg.nsac = tmp;
575
576 /* byte 3 */
577 tmp = (uint8_t)(csd_table[0] & 0x000000FF);
578 card_info->sd_csd_reg.max_bus_clk_freq = tmp;
579
580 /* byte 4 */
581 tmp = (uint8_t)((csd_table[1] & 0xFF000000) >> 24);
582 card_info->sd_csd_reg.card_cmd_classes = tmp << 4;
583
584 /* byte 5 */
585 tmp = (uint8_t)((csd_table[1] & 0x00FF0000) >> 16);
586 card_info->sd_csd_reg.card_cmd_classes |= (tmp & 0xF0) >> 4;
587 card_info->sd_csd_reg.max_read_blk_length = tmp & 0x0F;
588
589 /* byte 6 */
590 tmp = (uint8_t)((csd_table[1] & 0x0000FF00) >> 8);
591 card_info->sd_csd_reg.part_blk_read = (tmp & 0x80) >> 7;
592 card_info->sd_csd_reg.write_blk_misalign = (tmp & 0x40) >> 6;
593 card_info->sd_csd_reg.read_blk_misalign = (tmp & 0x20) >> 5;
594 card_info->sd_csd_reg.dsr_implemented = (tmp & 0x10) >> 4;
595 card_info->sd_csd_reg.reserved2 = 0; /* reserved */
596
597 if((card_type == SDIO_STD_CAPACITY_SD_CARD_V1_1) || (card_type == SDIO_STD_CAPACITY_SD_CARD_V2_0) || (card_type == SDIO_MULTIMEDIA_CARD))
598 {
599 card_info->sd_csd_reg.device_size = (tmp & 0x03) << 10;
600
601 /* byte 7 */
602 tmp = (uint8_t)(csd_table[1] & 0x000000FF);
603 card_info->sd_csd_reg.device_size |= (tmp) << 2;
604
605 /* byte 8 */
606 tmp = (uint8_t)((csd_table[2] & 0xFF000000) >> 24);
607 card_info->sd_csd_reg.device_size |= (tmp & 0xC0) >> 6;
608
609 card_info->sd_csd_reg.max_read_current_vdd_min = (tmp & 0x38) >> 3;
610 card_info->sd_csd_reg.max_read_current_vdd_max = (tmp & 0x07);
611
612 /* byte 9 */
613 tmp = (uint8_t)((csd_table[2] & 0x00FF0000) >> 16);
614 card_info->sd_csd_reg.max_write_current_vdd_min = (tmp & 0xE0) >> 5;
615 card_info->sd_csd_reg.max_write_current_vdd_max = (tmp & 0x1C) >> 2;
616 card_info->sd_csd_reg.device_size_mult = (tmp & 0x03) << 1;
617 /* byte 10 */
618 tmp = (uint8_t)((csd_table[2] & 0x0000FF00) >> 8);
619 card_info->sd_csd_reg.device_size_mult |= (tmp & 0x80) >> 7;
620
621 card_info->card_capacity = (card_info->sd_csd_reg.device_size + 1) ;
622 card_info->card_capacity *= (1 << (card_info->sd_csd_reg.device_size_mult + 2));
623 card_info->card_blk_size = 1 << (card_info->sd_csd_reg.max_read_blk_length);
624 card_info->card_capacity *= card_info->card_blk_size;
625 }
626 else if(card_type == SDIO_HIGH_CAPACITY_SD_CARD)
627 {
628 /* byte 7 */
629 tmp = (uint8_t)(csd_table[1] & 0x000000FF);
630 card_info->sd_csd_reg.device_size = (tmp & 0x3F) << 16;
631
632 /* byte 8 */
633 tmp = (uint8_t)((csd_table[2] & 0xFF000000) >> 24);
634
635 card_info->sd_csd_reg.device_size |= (tmp << 8);
636
637 /* byte 9 */
638 tmp = (uint8_t)((csd_table[2] & 0x00FF0000) >> 16);
639
640 card_info->sd_csd_reg.device_size |= (tmp);
641
642 /* byte 10 */
643 tmp = (uint8_t)((csd_table[2] & 0x0000FF00) >> 8);
644
645 card_info->card_capacity = (uint64_t)(card_info->sd_csd_reg.device_size + 1) * 512 * 1024;
646 card_info->card_blk_size = 512;
647 }
648
649
650 card_info->sd_csd_reg.erase_group_size = (tmp & 0x40) >> 6;
651 card_info->sd_csd_reg.erase_group_size_mult = (tmp & 0x3F) << 1;
652
653 /* byte 11 */
654 tmp = (uint8_t)(csd_table[2] & 0x000000FF);
655 card_info->sd_csd_reg.erase_group_size_mult |= (tmp & 0x80) >> 7;
656 card_info->sd_csd_reg.write_protect_group_size = (tmp & 0x7F);
657
658 /* byte 12 */
659 tmp = (uint8_t)((csd_table[3] & 0xFF000000) >> 24);
660 card_info->sd_csd_reg.write_protect_group_enable = (tmp & 0x80) >> 7;
661 card_info->sd_csd_reg.manufacturer_default_ecc = (tmp & 0x60) >> 5;
662 card_info->sd_csd_reg.write_speed_factor = (tmp & 0x1C) >> 2;
663 card_info->sd_csd_reg.max_write_blk_length = (tmp & 0x03) << 2;
664
665 /* byte 13 */
666 tmp = (uint8_t)((csd_table[3] & 0x00FF0000) >> 16);
667 card_info->sd_csd_reg.max_write_blk_length |= (tmp & 0xC0) >> 6;
668 card_info->sd_csd_reg.part_blk_write = (tmp & 0x20) >> 5;
669 card_info->sd_csd_reg.reserved3 = 0;
670 card_info->sd_csd_reg.content_protect_app = (tmp & 0x01);
671
672 /* byte 14 */
673 tmp = (uint8_t)((csd_table[3] & 0x0000FF00) >> 8);
674 card_info->sd_csd_reg.file_format_group = (tmp & 0x80) >> 7;
675 card_info->sd_csd_reg.copy_flag = (tmp & 0x40) >> 6;
676 card_info->sd_csd_reg.permanent_write_protect = (tmp & 0x20) >> 5;
677 card_info->sd_csd_reg.temp_write_protect = (tmp & 0x10) >> 4;
678 card_info->sd_csd_reg.file_formart = (tmp & 0x0C) >> 2;
679 card_info->sd_csd_reg.ecc_code = (tmp & 0x03);
680
681 /* byte 15 */
682 tmp = (uint8_t)(csd_table[3] & 0x000000FF);
683 card_info->sd_csd_reg.csd_crc = (tmp & 0xFE) >> 1;
684 card_info->sd_csd_reg.reserved4 = 1;
685
686 /* byte 0 */
687 tmp = (uint8_t)((cid_table[0] & 0xFF000000) >> 24);
688 card_info->sd_cid_reg.manufacturer_id = tmp;
689
690 /* byte 1 */
691 tmp = (uint8_t)((cid_table[0] & 0x00FF0000) >> 16);
692 card_info->sd_cid_reg.oem_app_id = tmp << 8;
693
694 /* byte 2 */
695 tmp = (uint8_t)((cid_table[0] & 0x000000FF00) >> 8);
696 card_info->sd_cid_reg.oem_app_id |= tmp;
697
698 /* byte 3 */
699 tmp = (uint8_t)(cid_table[0] & 0x000000FF);
700 card_info->sd_cid_reg.product_name1 = tmp << 24;
701
702 /* byte 4 */
703 tmp = (uint8_t)((cid_table[1] & 0xFF000000) >> 24);
704 card_info->sd_cid_reg.product_name1 |= tmp << 16;
705
706 /* byte 5 */
707 tmp = (uint8_t)((cid_table[1] & 0x00FF0000) >> 16);
708 card_info->sd_cid_reg.product_name1 |= tmp << 8;
709
710 /* byte 6 */
711 tmp = (uint8_t)((cid_table[1] & 0x0000FF00) >> 8);
712 card_info->sd_cid_reg.product_name1 |= tmp;
713
714 /* byte 7 */
715 tmp = (uint8_t)(cid_table[1] & 0x000000FF);
716 card_info->sd_cid_reg.product_name2 = tmp;
717
718 /* byte 8 */
719 tmp = (uint8_t)((cid_table[2] & 0xFF000000) >> 24);
720 card_info->sd_cid_reg.product_reversion = tmp;
721
722 /* byte 9 */
723 tmp = (uint8_t)((cid_table[2] & 0x00FF0000) >> 16);
724 card_info->sd_cid_reg.product_sn = tmp << 24;
725
726 /* byte 10 */
727 tmp = (uint8_t)((cid_table[2] & 0x0000FF00) >> 8);
728 card_info->sd_cid_reg.product_sn |= tmp << 16;
729
730 /* byte 11 */
731 tmp = (uint8_t)(cid_table[2] & 0x000000FF);
732 card_info->sd_cid_reg.product_sn |= tmp << 8;
733
734 /* byte 12 */
735 tmp = (uint8_t)((cid_table[3] & 0xFF000000) >> 24);
736 card_info->sd_cid_reg.product_sn |= tmp;
737
738 /* byte 13 */
739 tmp = (uint8_t)((cid_table[3] & 0x00FF0000) >> 16);
740 card_info->sd_cid_reg.reserved1 |= (tmp & 0xF0) >> 4;
741 card_info->sd_cid_reg.manufact_date = (tmp & 0x0F) << 8;
742
743 /* byte 14 */
744 tmp = (uint8_t)((cid_table[3] & 0x0000FF00) >> 8);
745 card_info->sd_cid_reg.manufact_date |= tmp;
746
747 /* byte 15 */
748 tmp = (uint8_t)(cid_table[3] & 0x000000FF);
749 card_info->sd_cid_reg.cid_crc = (tmp & 0xFE) >> 1;
750 card_info->sd_cid_reg.reserved2 = 1;
751
752 return(status);
753}
754
765 sd_error_status_type sd_wide_bus_operation_config(sdio_bus_width_type mode)
766{
767 sd_error_status_type status = SD_OK;
768
769 if(card_type == SDIO_MULTIMEDIA_CARD || card_type == SDIO_HIGH_SPEED_MULTIMEDIA_CARD || card_type == SDIO_HIGH_CAPACITY_MMC_CARD)
770 {
771 status = mmc_switch(EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BUS_WIDTH, (uint8_t)mode);
772 }
773 else if((card_type == SDIO_STD_CAPACITY_SD_CARD_V1_1) || (card_type == SDIO_STD_CAPACITY_SD_CARD_V2_0) || \
774 (card_type == SDIO_HIGH_CAPACITY_SD_CARD))
775 {
776 if(mode >= 2)
777 {
778 /* not support D8 mode */
779 return SD_UNSUPPORTED_FEATURE;
780 }
781
782 if(SDIO_BUS_WIDTH_D4 == mode)
783 {
784 status = sd_bus_wide_enable(TRUE);
785 }
786 else
787 {
788 status = sd_bus_wide_enable(FALSE);
789 }
790 }
791
792 if(status == SD_OK)
793 {
794 sdio_bus_width_config(SDIOx, mode);
795 }
796
797 return status;
798}
799
808 sd_error_status_type sd_device_mode_set(uint32_t mode)
809{
810 sd_error_status_type status = SD_OK;
811
812 if((mode == SD_TRANSFER_DMA_MODE) || (mode == SD_TRANSFER_POLLING_MODE))
813 {
814 device_mode = (sd_data_transfer_mode_type)mode;
815 }
816 else
817 {
818 status = SD_INVALID_PARAMETER;
819 }
820
821 return status;
822}
823
829 sd_error_status_type sd_deselect_select(uint32_t addr)
830{
831 /* send cmd7, select card */
832 sdio_command_init_struct.argument = addr;
833 sdio_command_init_struct.cmd_index = SD_CMD_SEL_DESEL_CARD;
834 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
835 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
836
837 /* sdio command config */
838 sdio_command_config(SDIOx, &sdio_command_init_struct);
839 /* enable ccsm */
840 sdio_command_state_machine_enable(SDIOx, TRUE);
841
842 return command_rsp1_error(SD_CMD_SEL_DESEL_CARD);
843}
844
852 sd_error_status_type sdio_command_data_send(sdio_command_struct_type *sdio_cmd_init_t, \
853 sdio_data_struct_type* sdio_data_init_t, uint32_t *buf)
854{
855 sd_error_status_type status = SD_OK;
856 uint32_t count = 0;
857 uint32_t timeout = SDIO_DATATIMEOUT;
858 uint32_t length = 0;
859
860 if(buf == NULL)
861 {
862 return SD_INVALID_PARAMETER;
863 }
864 /* clear dtctrl register */
865 SDIOx->dtcnt = 0x0;
866
867 /* sdio command config */
868 sdio_data_config(SDIOx, sdio_data_init_t);
869 /* enable dcsm */
870 sdio_data_state_machine_enable(SDIOx, TRUE);
871
872 length = sdio_data_init_t->data_length;
873
874 if(device_mode == SD_TRANSFER_DMA_MODE)
875 {
876 if(sdio_data_init_t->transfer_direction == SDIO_DATA_TRANSFER_TO_CONTROLLER)
877 {
878 transfer_error = SD_OK;
879 transfer_end = 0;
880 sd_dma_config(buf, length, DMA_DIR_PERIPHERAL_TO_MEMORY);
881 SDIOx->inten |= SDIO_INTR_STS_READ_MASK;
882 sdio_dma_enable(SDIOx, TRUE);
883 }
884 }
885
886 /* sdio command config */
887 sdio_command_config(SDIOx, sdio_cmd_init_t);
888 /* enable ccsm */
889 sdio_command_state_machine_enable(SDIOx, TRUE);
890
891 status = command_rsp1_error(sdio_cmd_init_t->cmd_index);
892 if(status != SD_OK)
893 {
894 return status;
895 }
896
897 /* polling mode */
898 if(device_mode == SD_TRANSFER_POLLING_MODE)
899 {
900 if(SDIO_DATA_TRANSFER_TO_CONTROLLER == sdio_data_init_t->transfer_direction)
901 {
902 while(!(SDIOx->sts & (SDIO_INTR_STS_READ_MASK)))
903 {
904 if(sdio_flag_get(SDIOx, SDIO_RXBUFH_FLAG) != RESET)
905 {
906 for(count = 0; count < 8; count++, buf++)
907 {
908 *buf = sdio_data_read(SDIOx);
909 }
910
911 timeout = 0x7FFFFF;
912 }
913 else
914 {
915 if(0 == timeout)
916 {
917 sd_init();
918 return SD_DATA_TIMEOUT;
919 }
920
921 timeout--;
922 }
923 }
924
925 while(sdio_flag_get(SDIOx, SDIO_RXBUF_FLAG) != RESET)
926 {
927 *buf = sdio_data_read(SDIOx);
928 buf++;
929 }
930 }
931 else
932 {
933 while(!(SDIOx->sts & SDIO_INTR_STS_WRITE_MASK))
934 {
935 if(sdio_flag_get(SDIOx, SDIO_TXBUFH_FLAG) != RESET)
936 {
937 for(count = 0; count < 8 && length > 0; count++, buf++, length -= 4)
938 {
939 sdio_data_write(SDIOx, *buf);
940 }
941
942 timeout = 0x3FFFFFFF;
943 }
944 else
945 {
946 if(timeout == 0)
947 {
948 sd_init();
949 return SD_DATA_TIMEOUT;
950 }
951
952 timeout--;
953 }
954 }
955 }
956 /* data timeout */
957 if(sdio_flag_get(SDIOx, SDIO_DTTIMEOUT_FLAG) != RESET)
958 {
959 sdio_flag_clear(SDIOx, SDIO_DTTIMEOUT_FLAG);
960 return SD_DATA_TIMEOUT;
961 }
962 /* crc error */
963 else if(sdio_flag_get(SDIOx, SDIO_DTFAIL_FLAG) != RESET)
964 {
965 sdio_flag_clear(SDIOx, SDIO_DTFAIL_FLAG);
966 return SD_DATA_FAIL;
967 }
968 /* over run error */
969 else if(sdio_flag_get(SDIOx, SDIO_RXERRO_FLAG) != RESET)
970 {
971 sdio_flag_clear(SDIOx, SDIO_RXERRO_FLAG);
972 return SD_RX_OVERRUN;
973 }
974 /* under run error */
975 else if(sdio_flag_get(SDIOx, SDIO_TXERRU_FLAG) != RESET)
976 {
977 sdio_flag_clear(SDIOx, SDIO_TXERRU_FLAG);
978 return SD_TX_UNDERRUN;
979 }
980 /* start bit error */
981 else if(sdio_flag_get(SDIOx, SDIO_SBITERR_FLAG) != RESET)
982 {
983 sdio_flag_clear(SDIOx, SDIO_SBITERR_FLAG);
984 return SD_START_BIT_ERR;
985 }
986 /* data transfer complete */
987 if((stop_flag == 1) && (sdio_flag_get(SDIOx, SDIO_DTCMPL_FLAG) != RESET))
988 {
989 /* send cmd12, stop transmission */
990 sdio_cmd_init_t->argument = 0;
991 sdio_cmd_init_t->cmd_index = SD_CMD_STOP_TRANSMISSION;
992 sdio_cmd_init_t->rsp_type = SDIO_RESPONSE_SHORT;
993 sdio_cmd_init_t->wait_type = SDIO_WAIT_FOR_NO;
994
995 /* sdio command config */
996 sdio_command_config(SDIOx, sdio_cmd_init_t);
997 /* enable ccsm */
998 sdio_command_state_machine_enable(SDIOx, TRUE);
999
1000 status = command_rsp1_error(SD_CMD_STOP_TRANSMISSION);
1001
1002 if(status != SD_OK)
1003 {
1004 return status;
1005 }
1006 }
1007
1008 sdio_flag_clear(SDIOx, SDIO_STATIC_FLAGS);
1009 }
1010 else if(device_mode == SD_TRANSFER_DMA_MODE)
1011 {
1012 if(sdio_data_init_t->transfer_direction == SDIO_DATA_TRANSFER_TO_CARD)
1013 {
1014 transfer_error = SD_OK;
1015 transfer_end = 0;
1016 sd_dma_config(buf, length, DMA_DIR_MEMORY_TO_PERIPHERAL);
1017 SDIOx->inten |= SDIO_INTR_STS_WRITE_MASK;
1018 sdio_dma_enable(SDIOx, TRUE);
1019 }
1020
1021 while(!(SDIOx->sts & SDIOx->inten) && timeout)
1022 {
1023 timeout--;
1024
1025 if(transfer_end)
1026 {
1027 break;
1028 }
1029 }
1030
1031 if(timeout == 0)
1032 {
1033 sd_init();
1034 return SD_DATA_TIMEOUT;
1035 }
1036
1037 if(transfer_error != SD_OK)
1038 {
1039 status = transfer_error;
1040 }
1041 }
1042
1043 return status;
1044}
1045
1052 sd_error_status_type sd_blocks_erase(long long addr, uint32_t nblks)
1053{
1054 sd_error_status_type status = SD_OK;
1055 uint32_t start_addr = 0, end_addr = 0, response = 0;
1056 uint8_t card_state;
1057
1058 /* high capacity sd card */
1059 if(card_type == SDIO_HIGH_CAPACITY_SD_CARD)
1060 {
1061 start_addr = addr >> 9;
1062 end_addr = start_addr + nblks - 1;
1063 }
1064 else
1065 {
1066 start_addr = addr;
1067 end_addr = start_addr + (nblks - 1) * 512;
1068 }
1069
1070 /* clear dcsm configuration */
1071 sdio_data_init_struct.block_size = SDIO_DATA_BLOCK_SIZE_1B;
1072 sdio_data_init_struct.data_length = 0 ;
1073 sdio_data_init_struct.timeout = SD_DATATIMEOUT ;
1074 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CARD;
1075 sdio_data_init_struct.transfer_mode = SDIO_DATA_BLOCK_TRANSFER;
1076
1077 sdio_data_config(SDIOx, &sdio_data_init_struct);
1078 sdio_data_state_machine_enable(SDIOx, FALSE);
1079
1080 response = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
1081
1082 /* check card locked */
1083 if(response & SD_CARD_LOCKED)
1084 {
1085 return SD_LOCK_UNLOCK_ERROR;
1086 }
1087
1088 if(card_type == SDIO_MULTIMEDIA_CARD || card_type == SDIO_HIGH_SPEED_MULTIMEDIA_CARD || card_type == SDIO_HIGH_CAPACITY_MMC_CARD)
1089 {
1090 /* send cmd35, set erase group start */
1091 sdio_command_init_struct.argument = start_addr;
1092 sdio_command_init_struct.cmd_index = SD_CMD_ERASE_GRP_START;
1093 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1094 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1095
1096 /* sdio command config */
1097 sdio_command_config(SDIOx, &sdio_command_init_struct);
1098 /* enable ccsm */
1099 sdio_command_state_machine_enable(SDIOx, TRUE);
1100
1101 status = command_rsp1_error(SD_CMD_ERASE_GRP_START);
1102
1103 if(status != SD_OK)
1104 {
1105 return status;
1106 }
1107
1108 /* send cmd36, set erase group end */
1109 sdio_command_init_struct.argument = end_addr;
1110 sdio_command_init_struct.cmd_index = SD_CMD_ERASE_GRP_END;
1111
1112 /* sdio command config */
1113 sdio_command_config(SDIOx, &sdio_command_init_struct);
1114 /* enable ccsm */
1115 sdio_command_state_machine_enable(SDIOx, TRUE);
1116
1117 status = command_rsp1_error(SD_CMD_ERASE_GRP_END);
1118
1119 if(status != SD_OK)
1120 {
1121 return status;
1122 }
1123
1124 /* send cmd38, start erase gourp */
1125 sdio_command_init_struct.argument = 0;
1126 sdio_command_init_struct.cmd_index = SD_CMD_ERASE;
1127
1128 /* sdio command config */
1129 sdio_command_config(SDIOx, &sdio_command_init_struct);
1130 /* enable ccsm */
1131 sdio_command_state_machine_enable(SDIOx, TRUE);
1132
1133 status = command_rsp1_error(SD_CMD_ERASE);
1134
1135 if(status != SD_OK)
1136 {
1137 return status;
1138 }
1139 }
1140 else
1141 {
1142 /* send cmd32, set erase block start */
1143 sdio_command_init_struct.argument = start_addr;
1144 sdio_command_init_struct.cmd_index = SD_CMD_SD_ERASE_GRP_START;
1145 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1146 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1147
1148 /* sdio command config */
1149 sdio_command_config(SDIOx, &sdio_command_init_struct);
1150 /* enable ccsm */
1151 sdio_command_state_machine_enable(SDIOx, TRUE);
1152
1153 status = command_rsp1_error(SD_CMD_SD_ERASE_GRP_START);
1154
1155 if(status != SD_OK)
1156 {
1157 return status;
1158 }
1159
1160 /* send cmd33, set erase block end */
1161 sdio_command_init_struct.argument = end_addr;
1162 sdio_command_init_struct.cmd_index = SD_CMD_SD_ERASE_GRP_END;
1163
1164 /* sdio command config */
1165 sdio_command_config(SDIOx, &sdio_command_init_struct);
1166 /* enable ccsm */
1167 sdio_command_state_machine_enable(SDIOx, TRUE);
1168
1169 if(status != SD_OK)
1170 {
1171 return status;
1172 }
1173
1174 /* send cmd38, start erase block */
1175 sdio_command_init_struct.argument = 0;
1176 sdio_command_init_struct.cmd_index = SD_CMD_ERASE;
1177
1178 /* sdio command config */
1179 sdio_command_config(SDIOx, &sdio_command_init_struct);
1180 /* enable ccsm */
1181 sdio_command_state_machine_enable(SDIOx, TRUE);
1182
1183 status = command_rsp1_error(SD_CMD_ERASE);
1184
1185 if(status != SD_OK)
1186 {
1187 return status;
1188 }
1189 }
1190
1191 status = check_card_programming(&card_state);
1192
1193 while((status == SD_OK) && ((card_state == SD_CARD_PROGRAMMING) || \
1194 (card_state == SD_CARD_RECEIVING)))
1195 {
1196 status = check_card_programming(&card_state);
1197 }
1198
1199 return status;
1200}
1201
1210 sd_error_status_type sd_block_read(uint8_t *buf, long long addr, uint16_t blk_size)
1211{
1212 sd_error_status_type status = SD_OK;
1213 uint32_t response = 0;
1214 uint8_t power;
1215
1216 if(NULL == buf)
1217 {
1218 return SD_INVALID_PARAMETER;
1219 }
1220
1221 SDIOx->dtctrl = 0x0;
1222
1223 if((card_type == SDIO_HIGH_CAPACITY_SD_CARD) || (card_type == SDIO_HIGH_CAPACITY_MMC_CARD))
1224 {
1225 blk_size = 512;
1226 addr >>= 9;
1227 }
1228
1229 /* clear dcsm configuration */
1230 sdio_data_init_struct.block_size = SDIO_DATA_BLOCK_SIZE_1B;
1231 sdio_data_init_struct.data_length = 0;
1232 sdio_data_init_struct.timeout = SD_DATATIMEOUT;
1233 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CARD;
1234 sdio_data_init_struct.transfer_mode = SDIO_DATA_BLOCK_TRANSFER;
1235
1236 sdio_data_config(SDIOx, &sdio_data_init_struct);
1237 sdio_data_state_machine_enable(SDIOx, FALSE);
1238
1239 response = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
1240
1241 /* check card locked */
1242 if(response & SD_CARD_LOCKED)
1243 {
1244 return SD_LOCK_UNLOCK_ERROR;
1245 }
1246
1247 if((blk_size > 0) && (blk_size <= 2048) && ((blk_size & (blk_size - 1)) == 0))
1248 {
1249 power = convert_from_bytes_to_power_of_two(blk_size);
1250
1251 /* send cmd16, set block size */
1252 sdio_command_init_struct.argument = blk_size;
1253 sdio_command_init_struct.cmd_index = SD_CMD_SET_BLOCKLEN;
1254 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1255 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1256
1257 /* sdio command config */
1258 sdio_command_config(SDIOx, &sdio_command_init_struct);
1259 /* enable ccsm */
1260 sdio_command_state_machine_enable(SDIOx, TRUE);
1261
1262 status = command_rsp1_error(SD_CMD_SET_BLOCKLEN);
1263
1264 if(status != SD_OK)
1265 {
1266 return status;
1267 }
1268 }
1269 else
1270 {
1271 return SD_INVALID_PARAMETER;
1272 }
1273
1274 sdio_data_init_struct.block_size = (sdio_block_size_type)(power);
1275 sdio_data_init_struct.data_length = blk_size ;
1276 sdio_data_init_struct.timeout = SD_DATATIMEOUT ;
1277 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CONTROLLER;
1278 sdio_data_init_struct.transfer_mode = SDIO_DATA_BLOCK_TRANSFER;
1279
1280 sdio_command_init_struct.argument = addr;
1281 sdio_command_init_struct.cmd_index = SD_CMD_READ_SINGLE_BLOCK;
1282 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1283 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1284
1285 stop_flag = 0;
1286
1287 return sdio_command_data_send(&sdio_command_init_struct, &sdio_data_init_struct, (uint32_t *)buf);
1288}
1289
1299 sd_error_status_type sd_mult_blocks_read(uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks)
1300{
1301 sd_error_status_type status = SD_OK;
1302 uint32_t response = 0;
1303 uint8_t power;
1304
1305 SDIOx->dtctrl = 0x0;
1306
1307 if((card_type == SDIO_HIGH_CAPACITY_SD_CARD) || (card_type == SDIO_HIGH_CAPACITY_MMC_CARD))
1308 {
1309 blk_size = 512;
1310 addr >>= 9;
1311 }
1312
1313 /* clear dcsm configuration */
1314 sdio_data_init_struct.block_size = (sdio_block_size_type)0;
1315 sdio_data_init_struct.data_length = 0;
1316 sdio_data_init_struct.timeout = SD_DATATIMEOUT;
1317 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CARD;
1318 sdio_data_init_struct.transfer_mode = SDIO_DATA_BLOCK_TRANSFER;
1319
1320 sdio_data_config(SDIOx, &sdio_data_init_struct);
1321 sdio_data_state_machine_enable(SDIOx, FALSE);
1322
1323 response = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
1324
1325 /* check card locked */
1326 if(response & SD_CARD_LOCKED)
1327 {
1328 return SD_LOCK_UNLOCK_ERROR;
1329 }
1330
1331 if((blk_size > 0) && (blk_size <= 2048) && ((blk_size & (blk_size - 1)) == 0))
1332 {
1333 power = convert_from_bytes_to_power_of_two(blk_size);
1334
1335 /* send cmd16, set block size */
1336 sdio_command_init_struct.argument = blk_size;
1337 sdio_command_init_struct.cmd_index = SD_CMD_SET_BLOCKLEN;
1338 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1339 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1340
1341 /* sdio command config */
1342 sdio_command_config(SDIOx, &sdio_command_init_struct);
1343 /* enable ccsm */
1344 sdio_command_state_machine_enable(SDIOx, TRUE);
1345
1346 status = command_rsp1_error(SD_CMD_SET_BLOCKLEN);
1347
1348 if(status != SD_OK)
1349 {
1350 return status;
1351 }
1352 }
1353 else
1354 {
1355 return SD_INVALID_PARAMETER;
1356 }
1357
1358 /* check max receive length */
1359 if(nblks * blk_size > SD_MAX_DATA_LENGTH)
1360 {
1361 return SD_INVALID_PARAMETER;
1362 }
1363
1364 sdio_data_init_struct.block_size = (sdio_block_size_type)(power);
1365 sdio_data_init_struct.data_length = nblks * blk_size ;
1366 sdio_data_init_struct.timeout = SD_DATATIMEOUT ;
1367 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CONTROLLER;
1368 sdio_data_init_struct.transfer_mode = SDIO_DATA_BLOCK_TRANSFER;
1369
1370 /* send cmd18, read block data */
1371 sdio_command_init_struct.argument = addr;
1372 sdio_command_init_struct.cmd_index = SD_CMD_READ_MULT_BLOCK;
1373 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1374 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1375
1376 stop_flag = 1;
1377
1378 return sdio_command_data_send(&sdio_command_init_struct, &sdio_data_init_struct, (uint32_t *)buf);
1379}
1380
1389 sd_error_status_type sd_block_write(const uint8_t *buf, long long addr, uint16_t blk_size)
1390{
1391 sd_error_status_type status = SD_OK;
1392 uint8_t power = 0, card_state = 0;
1393 uint32_t timeout = 0, card_status = 0, response = 0;
1394
1395 if(buf == NULL)
1396 {
1397 return SD_INVALID_PARAMETER;
1398 }
1399
1400 SDIOx->dtctrl = 0x0;
1401
1402 /* clear dcsm configuration */
1403 sdio_data_init_struct.block_size = (sdio_block_size_type)0;
1404 sdio_data_init_struct.data_length = 0;
1405 sdio_data_init_struct.timeout = SD_DATATIMEOUT;
1406 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CARD;
1407 sdio_data_init_struct.transfer_mode = SDIO_DATA_BLOCK_TRANSFER;
1408
1409 sdio_data_config(SDIOx, &sdio_data_init_struct);
1410 sdio_data_state_machine_enable(SDIOx, FALSE);
1411
1412 response = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
1413
1414 /* check card locked */
1415 if(response & SD_CARD_LOCKED)
1416 {
1417 return SD_LOCK_UNLOCK_ERROR;
1418 }
1419
1420 if((card_type == SDIO_HIGH_CAPACITY_SD_CARD) || (card_type == SDIO_HIGH_CAPACITY_MMC_CARD))
1421 {
1422 blk_size = 512;
1423 addr >>= 9;
1424 }
1425
1426 if((blk_size > 0) && (blk_size <= 2048) && ((blk_size & (blk_size - 1)) == 0))
1427 {
1428 power = convert_from_bytes_to_power_of_two(blk_size);
1429
1430 /* send cmd16, set block size */
1431 sdio_command_init_struct.argument = blk_size;
1432 sdio_command_init_struct.cmd_index = SD_CMD_SET_BLOCKLEN;
1433 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1434 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1435
1436 /* sdio command config */
1437 sdio_command_config(SDIOx, &sdio_command_init_struct);
1438 /* enable ccsm */
1439 sdio_command_state_machine_enable(SDIOx, TRUE);
1440
1441 status = command_rsp1_error(SD_CMD_SET_BLOCKLEN);
1442
1443 if(status != SD_OK)
1444 {
1445 return status;
1446 }
1447 }
1448 else
1449 {
1450 return SD_INVALID_PARAMETER;
1451 }
1452
1453 timeout = SD_DATATIMEOUT;
1454
1455 do
1456 {
1457 timeout--;
1458 status = sd_status_send(&card_status);
1459 }
1460 /* check ready_for_data flag */
1461 while(((card_status & 0x00000100) == 0) && (timeout > 0));
1462
1463 if(timeout == 0)
1464 {
1465 return SD_ERROR;
1466 }
1467
1468 /* send cmd24, write single block */
1469 sdio_command_init_struct.argument = addr;
1470 sdio_command_init_struct.cmd_index = SD_CMD_WRITE_SINGLE_BLOCK;
1471 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1472 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1473
1474 sdio_data_init_struct.block_size = (sdio_block_size_type)(power);
1475 sdio_data_init_struct.data_length = blk_size;
1476 sdio_data_init_struct.timeout = SD_DATATIMEOUT;
1477 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CARD;
1478 sdio_data_init_struct.transfer_mode = SDIO_DATA_BLOCK_TRANSFER;
1479
1480 stop_flag = 0;
1481
1482 /* single block, stop command is unnecessary */
1483 status = sdio_command_data_send(&sdio_command_init_struct, &sdio_data_init_struct, (uint32_t *)buf);
1484
1485 if(status != SD_OK)
1486 {
1487 return status;
1488 }
1489
1490 sdio_flag_clear(SDIOx, SDIO_STATIC_FLAGS);
1491
1492 status = check_card_programming(&card_state);
1493
1494 while((status == SD_OK) && ((card_state == SD_CARD_PROGRAMMING) || (card_state == SD_CARD_RECEIVING)))
1495 {
1496 status = check_card_programming(&card_state);
1497 }
1498
1499 return status;
1500}
1501
1511 sd_error_status_type sd_mult_blocks_write(const uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks)
1512{
1513 sd_error_status_type status = SD_OK;
1514 uint8_t power = 0, card_state = 0;
1515 uint32_t timeout = 0, card_status = 0, response = 0;;
1516
1517 if(buf == NULL)
1518 {
1519 return SD_INVALID_PARAMETER;
1520 }
1521
1522 SDIOx->dtctrl = 0x0;
1523
1524 /* clear dcsm configuration */
1525 sdio_data_init_struct.block_size = (sdio_block_size_type)0;
1526 sdio_data_init_struct.data_length = 0;
1527 sdio_data_init_struct.timeout = SD_DATATIMEOUT;
1528 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CARD;
1529 sdio_data_init_struct.transfer_mode = SDIO_DATA_BLOCK_TRANSFER;
1530
1531 sdio_data_config(SDIOx, &sdio_data_init_struct);
1532 sdio_data_state_machine_enable(SDIOx, FALSE);
1533
1534 response = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
1535
1536 /* check card locked */
1537 if(response & SD_CARD_LOCKED)
1538 {
1539 return SD_LOCK_UNLOCK_ERROR;
1540 }
1541
1542 if((card_type == SDIO_HIGH_CAPACITY_SD_CARD) || (card_type == SDIO_HIGH_CAPACITY_MMC_CARD))
1543 {
1544 blk_size = 512;
1545 addr >>= 9;
1546 }
1547
1548 if((blk_size > 0) && (blk_size <= 2048) && ((blk_size & (blk_size - 1)) == 0))
1549 {
1550 power = convert_from_bytes_to_power_of_two(blk_size);
1551
1552 /* send cmd16, set block size */
1553 sdio_command_init_struct.argument = blk_size;
1554 sdio_command_init_struct.cmd_index = SD_CMD_SET_BLOCKLEN;
1555 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1556 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1557
1558 /* sdio command config */
1559 sdio_command_config(SDIOx, &sdio_command_init_struct);
1560 /* enable ccsm */
1561 sdio_command_state_machine_enable(SDIOx, TRUE);
1562
1563 status = command_rsp1_error(SD_CMD_SET_BLOCKLEN);
1564
1565 if(status != SD_OK)
1566 {
1567 return status;
1568 }
1569 }
1570 else
1571 {
1572 return SD_INVALID_PARAMETER;
1573 }
1574
1575 if((nblks * blk_size) > SD_MAX_DATA_LENGTH)
1576 {
1577 return SD_INVALID_PARAMETER;
1578 }
1579
1580 timeout = SD_DATATIMEOUT;
1581
1582 do
1583 {
1584 timeout--;
1585 status = sd_status_send(&card_status);
1586 }
1587 /* check ready_for_data flag */
1588 while(((card_status & 0x00000100) == 0) && (timeout > 0));
1589
1590 if(timeout == 0)
1591 {
1592 return SD_ERROR;
1593 }
1594
1595 if((card_type == SDIO_STD_CAPACITY_SD_CARD_V1_1) || (card_type == SDIO_STD_CAPACITY_SD_CARD_V2_0) || \
1596 (card_type == SDIO_HIGH_CAPACITY_SD_CARD))
1597 {
1598 /* send cmd55 */
1599 sdio_command_init_struct.argument = (uint32_t)rca << 16;
1600 sdio_command_init_struct.cmd_index = SD_CMD_APP_CMD;
1601 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1602 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1603
1604 /* sdio command config */
1605 sdio_command_config(SDIOx, &sdio_command_init_struct);
1606 /* enable ccsm */
1607 sdio_command_state_machine_enable(SDIOx, TRUE);
1608
1609 status = command_rsp1_error(SD_CMD_APP_CMD);
1610
1611 if(status != SD_OK)
1612 {
1613 return status;
1614 }
1615
1616 /* send cmd23, set block count */
1617 sdio_command_init_struct.argument = blk_size;
1618 sdio_command_init_struct.cmd_index = SD_CMD_SET_BLOCK_COUNT;
1619 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1620 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1621
1622 /* sdio command config */
1623 sdio_command_config(SDIOx, &sdio_command_init_struct);
1624 /* enable ccsm */
1625 sdio_command_state_machine_enable(SDIOx, TRUE);
1626
1627 status = command_rsp1_error(SD_CMD_SET_BLOCK_COUNT);
1628
1629 if(status != SD_OK)
1630 {
1631 return status;
1632 }
1633 }
1634
1635 /* send cmd25, write mult blocks */
1636 sdio_command_init_struct.argument = addr;
1637 sdio_command_init_struct.cmd_index = SD_CMD_WRITE_MULT_BLOCK;
1638 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1639 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1640
1641 sdio_data_init_struct.block_size = (sdio_block_size_type)(power);
1642 sdio_data_init_struct.data_length = nblks * blk_size ;
1643 sdio_data_init_struct.timeout = SD_DATATIMEOUT ;
1644 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CARD;
1645 sdio_data_init_struct.transfer_mode = SDIO_DATA_BLOCK_TRANSFER;
1646
1647 stop_flag = 1;
1648 /* cmd12 is needed */
1649 status = sdio_command_data_send(&sdio_command_init_struct, &sdio_data_init_struct, (uint32_t *)buf);
1650
1651 if(status != SD_OK)
1652 {
1653 return status;
1654 }
1655
1656 sdio_flag_clear(SDIOx, SDIO_STATIC_FLAGS);
1657
1658 status = check_card_programming(&card_state);
1659
1660 while((status == SD_OK) && ((card_state == SD_CARD_PROGRAMMING) || (card_state == SD_CARD_RECEIVING)))
1661 {
1662 status = check_card_programming(&card_state);
1663 }
1664
1665 return status;
1666}
1667
1675 sd_error_status_type mmc_stream_read(uint8_t *buf, long long addr, uint32_t len)
1676{
1677 uint32_t response = 0;
1678
1679 SDIOx->dtctrl = 0x0;
1680
1681 /* clear dcsm configuration */
1682 sdio_data_init_struct.block_size = SDIO_DATA_BLOCK_SIZE_1B;
1683 sdio_data_init_struct.data_length = 0;
1684 sdio_data_init_struct.timeout = SD_DATATIMEOUT ;
1685 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CARD;
1686 sdio_data_init_struct.transfer_mode = SDIO_DATA_STREAM_TRANSFER;
1687
1688 sdio_data_config(SDIOx, &sdio_data_init_struct);
1689 sdio_data_state_machine_enable(SDIOx, FALSE);
1690
1691 response = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
1692
1693 /* check card locked */
1694 if(response & SD_CARD_LOCKED)
1695 {
1696 return SD_LOCK_UNLOCK_ERROR;
1697 }
1698 /* send cmd11, read data */
1699 sdio_command_init_struct.argument = addr;
1700 sdio_command_init_struct.cmd_index = SD_CMD_READ_DAT_UNTIL_STOP;
1701 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1702 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1703
1704 sdio_data_init_struct.block_size = SDIO_DATA_BLOCK_SIZE_1B;
1705 sdio_data_init_struct.data_length = len;
1706 sdio_data_init_struct.timeout = SD_DATATIMEOUT ;
1707 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CONTROLLER;
1708 sdio_data_init_struct.transfer_mode = SDIO_DATA_STREAM_TRANSFER;
1709
1710 stop_flag = 1;
1711 /* cmd12 is needed */
1712 return sdio_command_data_send(&sdio_command_init_struct, &sdio_data_init_struct, (uint32_t *)buf);
1713}
1714
1722 sd_error_status_type mmc_stream_write(uint8_t *buf, long long addr, uint32_t len)
1723{
1724 sd_error_status_type status = SD_OK;
1725 uint32_t response = 0;
1726 uint8_t card_state = 0;
1727
1728 if(buf == NULL)
1729 {
1730 return SD_INVALID_PARAMETER;
1731 }
1732
1733 SDIOx->dtctrl = 0x0;
1734
1735 /* clear dcsm configuration */
1736 sdio_data_init_struct.block_size = SDIO_DATA_BLOCK_SIZE_1B;
1737 sdio_data_init_struct.data_length = 0;
1738 sdio_data_init_struct.timeout = SD_DATATIMEOUT;
1739 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CARD;
1740 sdio_data_init_struct.transfer_mode = SDIO_DATA_STREAM_TRANSFER;
1741
1742 sdio_data_config(SDIOx, &sdio_data_init_struct);
1743 sdio_data_state_machine_enable(SDIOx, FALSE);
1744
1745 response = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
1746
1747 /* check card locked */
1748 if(response & SD_CARD_LOCKED)
1749 {
1750 return SD_LOCK_UNLOCK_ERROR;
1751 }
1752 /* send cmd20, write data */
1753 sdio_command_init_struct.argument = addr;
1754 sdio_command_init_struct.cmd_index = SD_CMD_WRITE_DAT_UNTIL_STOP;
1755 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1756 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1757
1758
1759 sdio_data_init_struct.block_size = SDIO_DATA_BLOCK_SIZE_1B;
1760 sdio_data_init_struct.data_length = len;
1761 sdio_data_init_struct.timeout = SD_DATATIMEOUT ;
1762 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CARD;
1763 sdio_data_init_struct.transfer_mode = SDIO_DATA_STREAM_TRANSFER;
1764
1765 stop_flag = 1;
1766 /* cmd12 is needed */
1767 status = sdio_command_data_send(&sdio_command_init_struct, &sdio_data_init_struct, (uint32_t *)buf);
1768
1769 if(status != SD_OK)
1770 {
1771 return status;
1772 }
1773
1774 sdio_flag_clear(SDIOx, SDIO_STATIC_FLAGS);
1775
1776 status = check_card_programming(&card_state);
1777
1778 while((status == SD_OK) && ((card_state == SD_CARD_PROGRAMMING) || (card_state == SD_CARD_RECEIVING)))
1779 {
1780 status = check_card_programming(&card_state);
1781 }
1782
1783 return status;
1784}
1785
1791void SDIO1_IRQHandler(void)
1792{
1793 sd_irq_service();
1794}
1795
1801void SDIO2_IRQHandler(void)
1802{
1803 sd_irq_service();
1804}
1805
1811 sd_error_status_type sd_irq_service(void)
1812{
1813 if(sdio_interrupt_flag_get(SDIOx, SDIO_DTCMPL_FLAG) != RESET)
1814 {
1815 if(stop_flag == 1)
1816 {
1817 /* send cmd12, stop transmission */
1818 sdio_command_init_struct.argument = 0;
1819 sdio_command_init_struct.cmd_index = SD_CMD_STOP_TRANSMISSION;
1820 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1821 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1822 /* sdio command config */
1823 sdio_command_config(SDIOx, &sdio_command_init_struct);
1824 /* enable ccsm */
1825 sdio_command_state_machine_enable(SDIOx, TRUE);
1826 transfer_error = command_rsp1_error(SD_CMD_STOP_TRANSMISSION);
1827 }
1828 else
1829 {
1830 transfer_error = SD_OK;
1831 }
1832 /* clear flag */
1833 sdio_flag_clear(SDIOx, SDIO_DTCMPL_FLAG);
1834 transfer_end = 1;
1835 return transfer_error;
1836 }
1837
1838 if(sdio_interrupt_flag_get(SDIOx, SDIO_DTFAIL_FLAG) != RESET)
1839 {
1840 /* clear flag */
1841 sdio_flag_clear(SDIOx, SDIO_DTFAIL_FLAG);
1842 transfer_error = SD_DATA_FAIL;
1843 transfer_end = 1;
1844 return transfer_error;
1845 }
1846
1847 if(sdio_interrupt_flag_get(SDIOx, SDIO_DTTIMEOUT_FLAG) != RESET)
1848 {
1849 /* clear flag */
1850 sdio_flag_clear(SDIOx, SDIO_DTTIMEOUT_FLAG);
1851 transfer_error = SD_DATA_TIMEOUT;
1852 transfer_end = 1;
1853 return transfer_error;
1854 }
1855
1856 if(sdio_interrupt_flag_get(SDIOx, SDIO_RXERRO_FLAG) != RESET)
1857 {
1858 /* clear flag */
1859 sdio_flag_clear(SDIOx, SDIO_RXERRO_FLAG);
1860 transfer_error = SD_RX_OVERRUN;
1861 transfer_end = 1;
1862 return(SD_RX_OVERRUN);
1863 }
1864
1865 if(sdio_interrupt_flag_get(SDIOx, SDIO_TXERRU_FLAG) != RESET)
1866 {
1867 /* clear flag */
1868 sdio_flag_clear(SDIOx, SDIO_TXERRU_FLAG);
1869 transfer_error = SD_TX_UNDERRUN;
1870 transfer_end = 1;
1871 return(SD_TX_UNDERRUN);
1872 }
1873
1874 if(sdio_interrupt_flag_get(SDIOx, SDIO_SBITERR_FLAG) != RESET)
1875 {
1876 /* clear flag */
1877 sdio_flag_clear(SDIOx, SDIO_SBITERR_FLAG);
1878 transfer_error = SD_START_BIT_ERR;
1879 transfer_end = 1;
1880 return(SD_START_BIT_ERR);
1881 }
1882
1883 /* disable interrupt */
1884 sdio_interrupt_enable(SDIOx, (SDIO_DTFAIL_INT | SDIO_DTTIMEOUT_INT | \
1885 SDIO_DTCMP_INT | SDIO_TXBUFH_INT | SDIO_RXBUFH_INT | \
1886 SDIO_TXERRU_INT| SDIO_RXERRO_INT | SDIO_SBITERR_INT), FALSE);
1887 return(SD_OK);
1888}
1889
1895 sd_error_status_type command_error(void)
1896{
1897 sd_error_status_type status = SD_OK;
1898 uint32_t timeout = SDIO_CMD0TIMEOUT;
1899
1900 while(timeout--)
1901 {
1902 if(sdio_flag_get(SDIOx, SDIO_CMDCMPL_FLAG) != RESET)
1903 {
1904 break;
1905 }
1906 }
1907
1908 if(timeout == 0)
1909 {
1910 return SD_CMD_RSP_TIMEOUT;
1911 }
1912
1913 sdio_flag_clear(SDIOx, SDIO_STATIC_FLAGS);
1914 return status;
1915}
1916
1922 sd_error_status_type command_rsp7_error(void)
1923{
1924 sd_error_status_type status = SD_OK;
1925 uint32_t sts_reg = 0;
1926 uint32_t timeout = SDIO_CMD0TIMEOUT;
1927
1928 while(timeout--)
1929 {
1930 sts_reg = SDIOx->sts;
1931
1932 if(sts_reg & (SDIO_CMDFAIL_FLAG | SDIO_CMDTIMEOUT_FLAG | SDIO_CMDRSPCMPL_FLAG))
1933 {
1934 break;
1935 }
1936 }
1937
1938 if((timeout == 0) || (sts_reg & SDIO_CMDTIMEOUT_FLAG))
1939 {
1940 status = SD_CMD_RSP_TIMEOUT;
1941 sdio_flag_clear(SDIOx, SDIO_CMDTIMEOUT_FLAG);
1942 return status;
1943 }
1944
1945 if(sts_reg & SDIO_CMDRSPCMPL_FLAG)
1946 {
1947 status = SD_OK;
1948 sdio_flag_clear(SDIOx, SDIO_CMDRSPCMPL_FLAG);
1949 }
1950
1951 return status;
1952}
1953
1959 sd_error_status_type command_rsp1_error(uint8_t cmd)
1960{
1961 uint32_t sts_reg = 0;
1962 uint32_t rsp_cmd = 0;
1963
1964 while(1)
1965 {
1966 sts_reg = SDIOx->sts;
1967
1968 if(sts_reg & (SDIO_CMDFAIL_FLAG | SDIO_CMDTIMEOUT_FLAG | SDIO_CMDRSPCMPL_FLAG))
1969 {
1970 break;
1971 }
1972 }
1973
1974 if(sdio_flag_get(SDIOx, SDIO_CMDTIMEOUT_FLAG) != RESET)
1975 {
1976 sdio_flag_clear(SDIOx, SDIO_CMDTIMEOUT_FLAG);
1977 return SD_CMD_RSP_TIMEOUT;
1978 }
1979
1980 if(sdio_flag_get(SDIOx, SDIO_CMDFAIL_FLAG) != RESET)
1981 {
1982 sdio_flag_clear(SDIOx, SDIO_CMDFAIL_FLAG);
1983 return SD_CMD_FAIL;
1984 }
1985
1986 rsp_cmd = sdio_command_response_get(SDIOx);
1987 if(rsp_cmd != cmd)
1988 {
1989 return SD_ILLEGAL_CMD;
1990 }
1991
1992 sdio_flag_clear(SDIOx, SDIO_STATIC_FLAGS);
1993
1994 return (sd_error_status_type)(sdio_response_get(SDIOx, SDIO_RSP1_INDEX) & SD_OCR_ERRORBITS);
1995}
1996
2002 sd_error_status_type command_rsp3_error(void)
2003{
2004 uint32_t sts_reg = 0;;
2005
2006 while(1)
2007 {
2008 sts_reg = SDIOx->sts;
2009
2010 if(sts_reg & (SDIO_CMDFAIL_FLAG | SDIO_CMDTIMEOUT_FLAG | SDIO_CMDRSPCMPL_FLAG))
2011 {
2012 break;
2013 }
2014 }
2015
2016 if(sdio_flag_get(SDIOx, SDIO_CMDTIMEOUT_FLAG) != RESET)
2017 {
2018 sdio_flag_clear(SDIOx, SDIO_CMDTIMEOUT_FLAG);
2019 return SD_CMD_RSP_TIMEOUT;
2020 }
2021
2022 sdio_flag_clear(SDIOx, SDIO_STATIC_FLAGS);
2023
2024 return SD_OK;
2025}
2026
2032 sd_error_status_type command_rsp2_error(void)
2033{
2034 sd_error_status_type status = SD_OK;
2035 uint32_t sts_reg;
2036 uint32_t timeout = SDIO_CMD0TIMEOUT;
2037
2038 while(timeout--)
2039 {
2040 sts_reg = SDIOx->sts;
2041
2042 if(sts_reg & (SDIO_CMDFAIL_FLAG | SDIO_CMDTIMEOUT_FLAG | SDIO_CMDRSPCMPL_FLAG))
2043 {
2044 break;
2045 }
2046 }
2047
2048 if((timeout == 0) || sdio_flag_get(SDIOx, SDIO_CMDTIMEOUT_FLAG) != RESET)
2049 {
2050 status = SD_CMD_RSP_TIMEOUT;
2051 sdio_flag_clear(SDIOx, SDIO_CMDTIMEOUT_FLAG);
2052
2053 return status;
2054 }
2055
2056 if(sdio_flag_get(SDIOx, SDIO_CMDFAIL_FLAG) != RESET)
2057 {
2058 status = SD_CMD_FAIL;
2059 sdio_flag_clear(SDIOx, SDIO_CMDFAIL_FLAG);
2060 }
2061
2062 sdio_flag_clear(SDIOx, SDIO_STATIC_FLAGS);
2063
2064 return status;
2065}
2066
2072 sd_error_status_type command_rsp4_error(uint8_t cmd)
2073{
2074 uint32_t sts_reg = 0, rsp_cmd = 0;
2075
2076 while(1)
2077 {
2078 sts_reg = SDIOx->sts;
2079
2080 if(sts_reg & (SDIO_CMDFAIL_FLAG | SDIO_CMDTIMEOUT_FLAG | SDIO_CMDRSPCMPL_FLAG))
2081 {
2082 break;
2083 }
2084 }
2085
2086 if(sdio_flag_get(SDIOx, SDIO_CMDTIMEOUT_FLAG) != RESET)
2087 {
2088 sdio_flag_clear(SDIOx, SDIO_CMDTIMEOUT_FLAG);
2089 return SD_CMD_RSP_TIMEOUT;
2090 }
2091
2092 if(sdio_flag_get(SDIOx, SDIO_CMDFAIL_FLAG) != RESET)
2093 {
2094 sdio_flag_clear(SDIOx, SDIO_CMDFAIL_FLAG);
2095
2096 return SD_CMD_FAIL;
2097 }
2098
2099 rsp_cmd = sdio_command_response_get(SDIOx);
2100 if(rsp_cmd != cmd)
2101 {
2102 return SD_ILLEGAL_CMD;
2103 }
2104
2105 sdio_flag_clear(SDIOx, SDIO_STATIC_FLAGS);
2106
2107 return SD_OK;
2108}
2109
2115 sd_error_status_type command_rsp5_error(uint8_t cmd)
2116{
2117 uint32_t sts_reg = 0, rsp_cmd = 0, response = 0;
2118
2119 while(1)
2120 {
2121 sts_reg = SDIOx->sts;
2122
2123 if(sts_reg & (SDIO_CMDFAIL_FLAG | SDIO_CMDTIMEOUT_FLAG | SDIO_CMDRSPCMPL_FLAG))
2124 {
2125 break;
2126 }
2127 }
2128
2129 if(sdio_flag_get(SDIOx, SDIO_CMDTIMEOUT_FLAG) != RESET)
2130 {
2131 sdio_flag_clear(SDIOx, SDIO_CMDTIMEOUT_FLAG);
2132
2133 return SD_CMD_RSP_TIMEOUT;
2134 }
2135
2136 if(sdio_flag_get(SDIOx, SDIO_CMDFAIL_FLAG) != RESET)
2137 {
2138 sdio_flag_clear(SDIOx, SDIO_CMDFAIL_FLAG);
2139
2140 return SD_CMD_FAIL;
2141 }
2142
2143 rsp_cmd = sdio_command_response_get(SDIOx);
2144 if(rsp_cmd != cmd)
2145 {
2146 return SD_ILLEGAL_CMD;
2147 }
2148
2149 sdio_flag_clear(SDIOx, SDIO_STATIC_FLAGS);
2150
2151 response = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
2152
2153 if(response & SD_R5_OUT_OF_RANGE)
2154 {
2155 return SD_CMD_OUT_OF_RANGE;
2156 }
2157
2158 if(response & SD_R5_FUNCTION_NUMBER)
2159 {
2160 return SD_SDIO_UNKNOWN_FUNC;
2161 }
2162
2163 if(response & SD_R5_ERROR)
2164 {
2165 return SD_GENERAL_UNKNOWN_ERROR;
2166 }
2167
2168 return SD_OK;
2169}
2170
2178 sd_error_status_type command_rsp6_error(uint8_t cmd, uint16_t *prca)
2179{
2180 sd_error_status_type status = SD_OK;
2181 uint32_t sts_reg, rsp_cmd = 0, response = 0;
2182
2183 while(1)
2184 {
2185 sts_reg = SDIOx->sts;
2186
2187 if(sts_reg & (SDIO_CMDFAIL_FLAG | SDIO_CMDTIMEOUT_FLAG | SDIO_CMDRSPCMPL_FLAG))
2188 {
2189 break;
2190 }
2191 }
2192
2193 if(sdio_flag_get(SDIOx, SDIO_CMDTIMEOUT_FLAG) != RESET)
2194 {
2195 sdio_flag_clear(SDIOx, SDIO_CMDTIMEOUT_FLAG);
2196 return SD_CMD_RSP_TIMEOUT;
2197 }
2198
2199 if(sdio_flag_get(SDIOx, SDIO_CMDFAIL_FLAG) != RESET)
2200 {
2201 sdio_flag_clear(SDIOx, SDIO_CMDFAIL_FLAG);
2202 return SD_CMD_FAIL;
2203 }
2204
2205 rsp_cmd = sdio_command_response_get(SDIOx);
2206 if(rsp_cmd != cmd)
2207 {
2208 return SD_ILLEGAL_CMD;
2209 }
2210
2211 sdio_flag_clear(SDIOx, SDIO_STATIC_FLAGS);
2212
2213 response = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
2214
2215 if(SD_ALLZERO == (response & (SD_R6_GENERAL_UNKNOWN_ERROR | SD_R6_ILLEGAL_CMD | SD_R6_CMD_CRC_ERROR)))
2216 {
2217 *prca = (uint16_t)(response >> 16);
2218 return status;
2219 }
2220
2221 if(response & SD_R6_GENERAL_UNKNOWN_ERROR)
2222 {
2223 return SD_GENERAL_UNKNOWN_ERROR;
2224 }
2225
2226 if(response & SD_R6_ILLEGAL_CMD)
2227 {
2228 return SD_ILLEGAL_CMD;
2229 }
2230
2231 if(response & SD_R6_CMD_CRC_ERROR)
2232 {
2233 return SD_CMD_CRC_ERROR;
2234 }
2235
2236 return status;
2237}
2238
2244 sd_error_status_type sd_bus_wide_enable(confirm_state new_state)
2245{
2246 sd_error_status_type status = SD_OK;
2247 uint32_t response = 0;
2248 uint8_t arg = 0x00;
2249
2250 if(new_state == TRUE)
2251 {
2252 arg = 0x02;
2253 }
2254 else
2255 {
2256 arg = 0x00;
2257 }
2258
2259 /* get response1 */
2260 response = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
2261
2262 /* check card locked or not */
2263 if(response & SD_CARD_LOCKED)
2264 {
2265 return SD_LOCK_UNLOCK_ERROR;
2266 }
2267
2268 if(sd_card_info.sd_scr_reg.sd_bus_width)
2269 {
2270 sdio_command_init_struct.argument = (uint32_t)(sd_card_info.rca << 16);
2271 sdio_command_init_struct.cmd_index = SD_CMD_APP_CMD;
2272 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
2273 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
2274
2275 /* sdio command config */
2276 sdio_command_config(SDIOx, &sdio_command_init_struct);
2277 /* enable ccsm */
2278 sdio_command_state_machine_enable(SDIOx, TRUE);
2279
2280 status = command_rsp1_error(SD_CMD_APP_CMD);
2281
2282 if(status != SD_OK)
2283 {
2284 return status;
2285 }
2286
2287 sdio_command_init_struct.argument = arg;
2288 sdio_command_init_struct.cmd_index = SD_CMD_APP_SD_SET_BUSWIDTH;
2289 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
2290 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
2291
2292 /* sdio command config */
2293 sdio_command_config(SDIOx, &sdio_command_init_struct);
2294 /* enable ccsm */
2295 sdio_command_state_machine_enable(SDIOx, TRUE);
2296
2297 status = command_rsp1_error(SD_CMD_APP_SD_SET_BUSWIDTH);
2298 return status;
2299 }
2300 else
2301 {
2302 return SD_REQ_NOT_APPLICABLE;
2303 }
2304}
2305
2313 sd_error_status_type mmc_switch(uint8_t set, uint8_t index, uint8_t value)
2314{
2315 sd_error_status_type status = SD_OK;
2316 uint32_t card_status = 0, timeout = 0;
2317
2318 sdio_command_init_struct.argument = (EXT_CSD_Write_byte << 24) | (index << 16) | (value << 8) | set;
2319 sdio_command_init_struct.cmd_index = SD_CMD_HS_SWITCH;
2320 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
2321 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
2322
2323 /* sdio command config */
2324 sdio_command_config(SDIOx, &sdio_command_init_struct);
2325 /* enable ccsm */
2326 sdio_command_state_machine_enable(SDIOx, TRUE);
2327
2328 status = command_rsp1_error(SD_CMD_HS_SWITCH);
2329 if(status != SD_OK)
2330 {
2331 return status;
2332 }
2333
2334 card_status = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
2335 if(card_status & MMC_SWITCH_ERROR)
2336 {
2337 return SD_SWITCH_ERROR;
2338 }
2339
2340 timeout = SD_DATATIMEOUT;
2341 do
2342 {
2343 timeout--;
2344 status = sd_status_send(&card_status);
2345 } /* check ready_for_data flag */
2346 while(((card_status & 0x00000100) == 0) && (timeout > 0));
2347
2348 if(timeout == 0)
2349 {
2350 return SD_ERROR;
2351 }
2352
2353 return status;
2354}
2355
2364 sd_error_status_type sd_switch(uint32_t mode, uint32_t group, uint8_t value, uint8_t *rsp)
2365{
2366 sd_error_status_type status = SD_OK;
2367 uint8_t power;
2368 uint16_t blk_size;
2369
2370 if(rsp == NULL)
2371 {
2372 return SD_INVALID_PARAMETER;
2373 }
2374
2375 SDIOx->dtctrl = 0x0;
2376
2377 blk_size = 64;
2378 power = convert_from_bytes_to_power_of_two(blk_size);
2379
2380 sdio_command_init_struct.argument = blk_size;
2381 sdio_command_init_struct.cmd_index = SD_CMD_SET_BLOCKLEN;
2382 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
2383 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
2384
2385 /* sdio command config */
2386 sdio_command_config(SDIOx, &sdio_command_init_struct);
2387 /* enable ccsm */
2388 sdio_command_state_machine_enable(SDIOx, TRUE);
2389
2390 status = command_rsp1_error(SD_CMD_SET_BLOCKLEN);
2391
2392 if(status != SD_OK)
2393 {
2394 return status;
2395 }
2396
2397 sdio_data_init_struct.block_size = (sdio_block_size_type)(power);
2398 sdio_data_init_struct.data_length = blk_size ;
2399 sdio_data_init_struct.timeout = SD_DATATIMEOUT ;
2400 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CONTROLLER;
2401 sdio_data_init_struct.transfer_mode = SDIO_DATA_BLOCK_TRANSFER;
2402
2403 sdio_command_init_struct.argument = (mode << 31) | 0x00FFFFFF;
2404 sdio_command_init_struct.argument &= ~(0xF << (group * 4));
2405 sdio_command_init_struct.argument |= value << (group * 4);
2406 sdio_command_init_struct.cmd_index = SD_CMD_HS_SWITCH;
2407 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
2408 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
2409
2410 stop_flag = 0;
2411
2412 return sdio_command_data_send(&sdio_command_init_struct, &sdio_data_init_struct, (uint32_t *)rsp);
2413}
2414
2420 sd_error_status_type check_card_programming(uint8_t *p_status)
2421{
2422 volatile uint32_t response = 0, sts_reg = 0, rsp_cmd = 0;
2423
2424 /* send cmd13 */
2425 sdio_command_init_struct.argument = (uint32_t)(rca << 16);
2426 sdio_command_init_struct.cmd_index = SD_CMD_SEND_STATUS;
2427 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
2428 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
2429
2430 /* sdio command config */
2431 sdio_command_config(SDIOx, &sdio_command_init_struct);
2432 /* enable ccsm */
2433 sdio_command_state_machine_enable(SDIOx, TRUE);
2434
2435 sts_reg = SDIOx->sts;
2436
2437 while(!(sts_reg & (SDIO_CMDFAIL_FLAG | SDIO_CMDTIMEOUT_FLAG | SDIO_CMDRSPCMPL_FLAG)))
2438 {
2439 sts_reg = SDIOx->sts;
2440 }
2441
2442 if(sdio_flag_get(SDIOx, SDIO_CMDFAIL_FLAG) != RESET)
2443 {
2444 sdio_flag_clear(SDIOx, SDIO_CMDFAIL_FLAG);
2445 return SD_CMD_FAIL;
2446 }
2447
2448 if(sdio_flag_get(SDIOx, SDIO_CMDTIMEOUT_FLAG) != RESET)
2449 {
2450 sdio_flag_clear(SDIOx, SDIO_CMDTIMEOUT_FLAG);
2451 return SD_CMD_RSP_TIMEOUT;
2452 }
2453
2454 rsp_cmd = sdio_command_response_get(SDIOx);
2455 if(rsp_cmd!= SD_CMD_SEND_STATUS)
2456 {
2457 return SD_ILLEGAL_CMD;
2458 }
2459
2460 sdio_flag_clear(SDIOx, SDIO_STATIC_FLAGS);
2461
2462 response = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
2463
2464 *p_status = (uint8_t)((response >> 9) & 0x0000000F);
2465
2466 return SD_OK;
2467}
2468
2474 sd_error_status_type sd_status_send(uint32_t *p_card_status)
2475{
2476 sd_error_status_type status = SD_OK;
2477
2478 if(p_card_status == NULL)
2479 {
2480 status = SD_INVALID_PARAMETER;
2481 return status;
2482 }
2483
2484 sdio_command_init_struct.argument = (uint32_t)(rca << 16);
2485 sdio_command_init_struct.cmd_index = SD_CMD_SEND_STATUS;
2486 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
2487 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
2488
2489 /* sdio command config */
2490 sdio_command_config(SDIOx, &sdio_command_init_struct);
2491 /* enable ccsm */
2492 sdio_command_state_machine_enable(SDIOx, TRUE);
2493
2494 status = command_rsp1_error(SD_CMD_SEND_STATUS);
2495
2496 if(status != SD_OK)
2497 {
2498 return status;
2499 }
2500
2501 *p_card_status = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
2502
2503 return status;
2504}
2505
2511 sd_card_state_type sd_state_get(void)
2512{
2513 uint32_t response = 0;
2514
2515 if(sd_status_send(&response) != SD_OK)
2516 {
2517 return SD_CARD_ERROR;
2518 }
2519 else
2520 {
2521 return (sd_card_state_type)((response >> 9) & 0x0F);
2522 }
2523}
2524
2529 sd_error_status_type get_ext_csd(void)
2530{
2531 uint32_t index = 0, sts_reg = 0;
2532 sd_error_status_type status = SD_OK;
2533 uint32_t *tmp_ext_csd = ext_csd_table;
2534
2535 sdio_data_init_struct.block_size = SDIO_DATA_BLOCK_SIZE_512B;
2536 sdio_data_init_struct.data_length = 512;
2537 sdio_data_init_struct.timeout = SD_DATATIMEOUT;
2538 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CONTROLLER;
2539 sdio_data_init_struct.transfer_mode = SDIO_DATA_BLOCK_TRANSFER;
2540
2541 sdio_data_config(SDIOx, &sdio_data_init_struct);
2542 sdio_data_state_machine_enable(SDIOx, TRUE);
2543
2544 /* send cmd8 */
2545 sdio_command_init_struct.argument = 0x0;
2546 sdio_command_init_struct.cmd_index = SD_CMD_HS_SEND_EXT_CSD;
2547 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
2548 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
2549 /* sdio command config */
2550 sdio_command_config(SDIOx, &sdio_command_init_struct);
2551 /* enable ccsm */
2552 sdio_command_state_machine_enable(SDIOx, TRUE);
2553 status = command_rsp1_error(SD_CMD_HS_SEND_EXT_CSD);
2554 if(status != SD_OK)
2555 {
2556 return status;
2557 }
2558
2559 sts_reg = SDIOx->sts;
2560
2561 while(!(sts_reg & (SDIO_RXERRO_FLAG | SDIO_DTFAIL_FLAG | SDIO_DTTIMEOUT_FLAG | SDIO_DTBLKCMPL_FLAG | SDIO_SBITERR_FLAG)))
2562 {
2563 if(sdio_flag_get(SDIOx, SDIO_RXBUF_FLAG) != RESET)
2564 {
2565 *(tmp_ext_csd + index) = sdio_data_read(SDIOx);
2566 index++;
2567 }
2568 sts_reg = SDIOx->sts;
2569 }
2570 if(sdio_flag_get(SDIOx, SDIO_DTTIMEOUT_FLAG) != RESET)
2571 {
2572 sdio_flag_clear(SDIOx, SDIO_DTTIMEOUT_FLAG);
2573 return SD_DATA_TIMEOUT;
2574 }
2575 else if(sdio_flag_get(SDIOx, SDIO_DTFAIL_FLAG) != RESET)
2576 {
2577 sdio_flag_clear(SDIOx, SDIO_DTFAIL_FLAG);
2578 return SD_DATA_FAIL;
2579 }
2580 else if(sdio_flag_get(SDIOx, SDIO_RXERRO_FLAG) != RESET)
2581 {
2582 sdio_flag_clear(SDIOx, SDIO_RXERRO_FLAG);
2583 return SD_RX_OVERRUN;
2584 }
2585 else if(sdio_flag_get(SDIOx, SDIO_SBITERR_FLAG) != RESET)
2586 {
2587 sdio_flag_clear(SDIOx, SDIO_SBITERR_FLAG);
2588 return SD_START_BIT_ERR;
2589 }
2590
2591 sdio_flag_clear(SDIOx, SDIO_STATIC_FLAGS);
2592
2593 return status;
2594}
2595
2600 sd_error_status_type scr_find(void)
2601{
2602 uint32_t index = 0, sts_reg = 0;
2603 sd_error_status_type status = SD_OK;
2604 uint32_t *tempscr;
2605
2606 tempscr = (uint32_t *) &(sd_card_info.sd_scr_reg);
2607
2608 /* send cmd16, set block length */
2609 sdio_command_init_struct.argument = (uint32_t)8;
2610 sdio_command_init_struct.cmd_index = SD_CMD_SET_BLOCKLEN;
2611 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
2612 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
2613
2614 /* sdio command config */
2615 sdio_command_config(SDIOx, &sdio_command_init_struct);
2616 /* enable ccsm */
2617 sdio_command_state_machine_enable(SDIOx, TRUE);
2618
2619 status = command_rsp1_error(SD_CMD_SET_BLOCKLEN);
2620
2621 if(status != SD_OK)
2622 {
2623 return status;
2624 }
2625
2626 /* send cmd55 */
2627 sdio_command_init_struct.argument = (uint32_t)(sd_card_info.rca << 16);
2628 sdio_command_init_struct.cmd_index = SD_CMD_APP_CMD;
2629 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
2630 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
2631
2632 /* sdio command config */
2633 sdio_command_config(SDIOx, &sdio_command_init_struct);
2634 /* enable ccsm */
2635 sdio_command_state_machine_enable(SDIOx, TRUE);
2636
2637 status = command_rsp1_error(SD_CMD_APP_CMD);
2638
2639 if(status != SD_OK)
2640 {
2641 return status;
2642 }
2643
2644 sdio_data_init_struct.block_size = SDIO_DATA_BLOCK_SIZE_8B;
2645 sdio_data_init_struct.data_length = 8;
2646 sdio_data_init_struct.timeout = SD_DATATIMEOUT;
2647 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CONTROLLER;
2648 sdio_data_init_struct.transfer_mode = SDIO_DATA_BLOCK_TRANSFER;
2649
2650 sdio_data_config(SDIOx, &sdio_data_init_struct);
2651 sdio_data_state_machine_enable(SDIOx, TRUE);
2652
2653 /* send cmd51 */
2654 sdio_command_init_struct.argument = 0x0;
2655 sdio_command_init_struct.cmd_index = SD_CMD_SD_APP_SEND_SCR;
2656 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
2657 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
2658
2659 /* sdio command config */
2660 sdio_command_config(SDIOx, &sdio_command_init_struct);
2661 /* enable ccsm */
2662 sdio_command_state_machine_enable(SDIOx, TRUE);
2663
2664 status = command_rsp1_error(SD_CMD_SD_APP_SEND_SCR);
2665
2666 if(status != SD_OK)
2667 {
2668 return status;
2669 }
2670
2671 sts_reg = SDIOx->sts;
2672
2673 while(!(sts_reg & (SDIO_RXERRO_FLAG | SDIO_DTFAIL_FLAG | SDIO_DTTIMEOUT_FLAG | SDIO_DTBLKCMPL_FLAG | SDIO_SBITERR_FLAG)))
2674 {
2675 if(sdio_flag_get(SDIOx, SDIO_RXBUF_FLAG) != RESET)
2676 {
2677 *(tempscr + index) = sdio_data_read(SDIOx);
2678 index++;
2679 }
2680 sts_reg = SDIOx->sts;
2681 }
2682
2683 if(sdio_flag_get(SDIOx, SDIO_DTTIMEOUT_FLAG) != RESET)
2684 {
2685 sdio_flag_clear(SDIOx, SDIO_DTTIMEOUT_FLAG);
2686 return SD_DATA_TIMEOUT;
2687 }
2688 else if(sdio_flag_get(SDIOx, SDIO_DTFAIL_FLAG) != RESET)
2689 {
2690 sdio_flag_clear(SDIOx, SDIO_DTFAIL_FLAG);
2691 return SD_DATA_FAIL;
2692 }
2693 else if(sdio_flag_get(SDIOx, SDIO_RXERRO_FLAG) != RESET)
2694 {
2695 sdio_flag_clear(SDIOx, SDIO_RXERRO_FLAG);
2696 return SD_RX_OVERRUN;
2697 }
2698 else if(sdio_flag_get(SDIOx, SDIO_SBITERR_FLAG) != RESET)
2699 {
2700 sdio_flag_clear(SDIOx, SDIO_SBITERR_FLAG);
2701 return SD_START_BIT_ERR;
2702 }
2703
2704 sdio_flag_clear(SDIOx, SDIO_STATIC_FLAGS);
2705
2706 return status;
2707}
2708
2714 sd_error_status_type speed_change(uint8_t speed)
2715{
2716 sd_error_status_type status = SD_OK;
2717 uint8_t switch_sts[64];
2718
2719 if(speed > 1)
2720 {
2721 return SD_ERROR;
2722 }
2723
2724 /* check card type */
2725 if((SDIO_STD_CAPACITY_SD_CARD_V1_1 == card_type) || (SDIO_STD_CAPACITY_SD_CARD_V2_0 == card_type) || \
2726 (SDIO_HIGH_CAPACITY_SD_CARD == card_type))
2727 {
2728 /* version 1.01 card does not support cmd6 */
2729 if(sd_card_info.sd_scr_reg.sd_spec == 0)
2730 {
2731 return SD_ERROR;
2732 }
2733
2734 /* check group 1 function support speed */
2735 status = sd_switch(0, 0, speed, switch_sts);
2736
2737 if(status != 0)
2738 {
2739 return status;
2740 }
2741
2742 if((switch_sts[13] & (1 << speed)) == 0)
2743 {
2744 return SD_ERROR;
2745 }
2746
2747 status = sd_switch(1, 0, speed, switch_sts);
2748
2749 if(status != 0)
2750 {
2751 return status;
2752 }
2753
2754 /* read it back for confirmation */
2755 if((switch_sts[16] & 0xF) != speed)
2756 {
2757 return SD_ERROR;
2758 }
2759 }
2760 else if(card_type == SDIO_HIGH_SPEED_MULTIMEDIA_CARD || card_type == SDIO_HIGH_CAPACITY_MMC_CARD)
2761 {
2762 status = mmc_switch(EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BUS_WIDTH, (uint8_t)speed);
2763
2764 if(status != 0)
2765 {
2766 return status;
2767 }
2768 }
2769
2770 return status;
2771}
2772
2778uint8_t convert_from_bytes_to_power_of_two(uint16_t number_of_bytes)
2779{
2780 uint8_t count = 0;
2781
2782 while(number_of_bytes != 1)
2783 {
2784 number_of_bytes >>= 1;
2785 count++;
2786 }
2787
2788 return count;
2789}
2790
2799void sd_dma_config(uint32_t *mbuf, uint32_t buf_size, dma_dir_type dir)
2800{
2801 dma_init_type dma_init_struct;
2802 dma_default_para_init(&dma_init_struct);
2803
2804 crm_periph_clock_enable(CRM_DMA2_PERIPH_CLOCK, TRUE);
2805
2806 dma_reset(DMA2_CHANNEL4);
2807 dma_channel_enable(DMA2_CHANNEL4, FALSE);
2808
2809 dma_init_struct.peripheral_base_addr = (uint32_t)&SDIOx->buf;
2810 dma_init_struct.memory_base_addr = (uint32_t)mbuf;
2811 dma_init_struct.direction = dir;
2812 dma_init_struct.buffer_size = buf_size / 4;
2813 dma_init_struct.peripheral_inc_enable = FALSE;
2814 dma_init_struct.memory_inc_enable = TRUE;
2815 dma_init_struct.peripheral_data_width = DMA_PERIPHERAL_DATA_WIDTH_WORD;
2816 dma_init_struct.memory_data_width = DMA_MEMORY_DATA_WIDTH_WORD;
2817 dma_init_struct.loop_mode_enable = FALSE;
2818 dma_init_struct.priority = DMA_PRIORITY_HIGH;
2819 dma_init(DMA2_CHANNEL4, &dma_init_struct);
2820
2821 dma_channel_enable(DMA2_CHANNEL4, TRUE);
2822}
2823
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
dma_init_struct
dma_init_type dma_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:38
sd_card_info
sd_card_info_struct_type sd_card_info
Definition sd_mmc_card/src/at32_sdio.c:48
sd_switch
sd_error_status_type sd_switch(uint32_t mode, uint32_t group, uint8_t value, uint8_t *rsp)
switch sd card speed to high speed
Definition sd_mmc_card/src/at32_sdio.c:2364
command_rsp5_error
sd_error_status_type command_rsp5_error(uint8_t cmd)
checks for error conditions for r5 response.
Definition sd_mmc_card/src/at32_sdio.c:2115
speed_change
sd_error_status_type speed_change(uint8_t speed)
set bus speed
Definition sd_mmc_card/src/at32_sdio.c:2714
sd_power_off
sd_error_status_type sd_power_off(void)
turns the sdio output signals off.
Definition sd_mmc_card/src/at32_sdio.c:425
sdio_data_init_struct
sdio_data_struct_type sdio_data_init_struct
Definition sd_mmc_card/src/at32_sdio.c:39
sd_irq_service
sd_error_status_type sd_irq_service(void)
allows to process all the interrupts that are high.
Definition sd_mmc_card/src/at32_sdio.c:1811
transfer_end
volatile uint8_t transfer_end
Definition sd_mmc_card/src/at32_sdio.c:47
command_rsp7_error
sd_error_status_type command_rsp7_error(void)
checks for error conditions for R7 response.
Definition sd_mmc_card/src/at32_sdio.c:1922
sd_device_mode_set
sd_error_status_type sd_device_mode_set(uint32_t mode)
set sdio work mode.
Definition sd_mmc_card/src/at32_sdio.c:808
card_type
static sd_memory_card_type card_type
Definition sd_mmc_card/src/at32_sdio.c:41
convert_from_bytes_to_power_of_two
uint8_t convert_from_bytes_to_power_of_two(uint16_t number_of_bytes)
converts the number of bytes in power of two and returns the power.
Definition sd_mmc_card/src/at32_sdio.c:2778
sd_card_info_get
sd_error_status_type sd_card_info_get(sd_card_info_struct_type *card_info)
returns information about specific card.
Definition sd_mmc_card/src/at32_sdio.c:554
sdio_command_init_struct
sdio_command_struct_type sdio_command_init_struct
Definition sd_mmc_card/src/at32_sdio.c:38
mmc_stream_write
sd_error_status_type mmc_stream_write(uint8_t *buf, long long addr, uint32_t len)
write mmc card data stream.
Definition sd_mmc_card/src/at32_sdio.c:1722
sd_card_init
sd_error_status_type sd_card_init(void)
intialises all cards or single card as the case may be card(s) come into standby state.
Definition sd_mmc_card/src/at32_sdio.c:439
sd_block_read
sd_error_status_type sd_block_read(uint8_t *buf, long long addr, uint16_t blk_size)
allows to read one block from a specified address in a card. the data transfer can be managed by dma ...
Definition sd_mmc_card/src/at32_sdio.c:1210
sd_deselect_select
sd_error_status_type sd_deselect_select(uint32_t addr)
selects od deselects the corresponding card.
Definition sd_mmc_card/src/at32_sdio.c:829
command_rsp6_error
sd_error_status_type command_rsp6_error(uint8_t cmd, uint16_t *p_rca)
checks for error conditions for r6 (rca) response.
Definition sd_mmc_card/src/at32_sdio.c:2178
SDIO1_IRQHandler
void SDIO1_IRQHandler(void)
sdio1 isr.
Definition sd_mmc_card/src/at32_sdio.c:1791
stop_flag
static uint8_t stop_flag
Definition sd_mmc_card/src/at32_sdio.c:45
mmc_switch
sd_error_status_type mmc_switch(uint8_t set, uint8_t index, uint8_t value)
switch mmc card speed to high speed
Definition sd_mmc_card/src/at32_sdio.c:2313
sd_blocks_erase
sd_error_status_type sd_blocks_erase(long long addr, uint32_t nblks)
erase continuous data block
Definition sd_mmc_card/src/at32_sdio.c:1052
get_ext_csd
sd_error_status_type get_ext_csd(void)
find the sd card ext csd register value.
Definition sd_mmc_card/src/at32_sdio.c:2529
check_card_programming
sd_error_status_type check_card_programming(uint8_t *p_status)
checks if the sd card is in programming state.
Definition sd_mmc_card/src/at32_sdio.c:2420
transfer_error
volatile sd_error_status_type transfer_error
Definition sd_mmc_card/src/at32_sdio.c:46
sd_bus_wide_enable
sd_error_status_type sd_bus_wide_enable(confirm_state new_state)
enable or disable the sdio wide bus mode.
Definition sd_mmc_card/src/at32_sdio.c:2244
ext_csd_table
static uint32_t ext_csd_table[128]
Definition sd_mmc_card/src/at32_sdio.c:43
command_rsp1_error
sd_error_status_type command_rsp1_error(uint8_t cmd)
checks for error conditions for R1 response.
Definition sd_mmc_card/src/at32_sdio.c:1959
SDIO2_IRQHandler
void SDIO2_IRQHandler(void)
sdio2 isr.
Definition sd_mmc_card/src/at32_sdio.c:1801
sd_mult_blocks_write
sd_error_status_type sd_mult_blocks_write(const uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks)
allows to write blocks starting from a specified address in a card. the data transfer can be managed ...
Definition sd_mmc_card/src/at32_sdio.c:1511
csd_table
static uint32_t csd_table[4]
Definition sd_mmc_card/src/at32_sdio.c:42
sdio_clock_set
void sdio_clock_set(uint32_t clk_div)
set sdio clock devision factor.
Definition sd_mmc_card/src/at32_sdio.c:209
sd_state_get
sd_card_state_type sd_state_get(void)
returns information about sd card.
Definition sd_mmc_card/src/at32_sdio.c:2511
cid_table
static uint32_t cid_table[4]
Definition sd_mmc_card/src/at32_sdio.c:42
sd_dma_config
void sd_dma_config(uint32_t *mbuf, uint32_t buf_size, dma_dir_type dir)
set dma configuation for sdio
Definition sd_mmc_card/src/at32_sdio.c:2799
sd_block_write
sd_error_status_type sd_block_write(const uint8_t *buf, long long addr, uint16_t blk_size)
allows to write one block starting from a specified address in a card. the data transfer can be manag...
Definition sd_mmc_card/src/at32_sdio.c:1389
device_mode
static sd_data_transfer_mode_type device_mode
Definition sd_mmc_card/src/at32_sdio.c:44
sd_status_send
sd_error_status_type sd_status_send(uint32_t *p_card_status)
read current card status.
Definition sd_mmc_card/src/at32_sdio.c:2474
sdio_command_data_send
sd_error_status_type sdio_command_data_send(sdio_command_struct_type *sdio_cmd_init_t, sdio_data_struct_type *sdio_data_init_t, uint32_t *buf)
read data from or write data to sd card.
Definition sd_mmc_card/src/at32_sdio.c:852
command_rsp2_error
sd_error_status_type command_rsp2_error(void)
checks for error conditions for R2 (cid or csd) response.
Definition sd_mmc_card/src/at32_sdio.c:2032
sd_init
sd_error_status_type sd_init(void)
initializes the sd card and put it into standby state (ready for data transfer).
Definition sd_mmc_card/src/at32_sdio.c:73
mmc_stream_read
sd_error_status_type mmc_stream_read(uint8_t *buf, long long addr, uint32_t len)
read mmc card data stream.
Definition sd_mmc_card/src/at32_sdio.c:1675
scr_find
sd_error_status_type scr_find(void)
find the sd card scr register value.
Definition sd_mmc_card/src/at32_sdio.c:2600
sd_power_on
sd_error_status_type sd_power_on(void)
enquires cards about their operating voltage and configures clock controls.
Definition sd_mmc_card/src/at32_sdio.c:224
command_rsp4_error
sd_error_status_type command_rsp4_error(uint8_t cmd)
checks for error conditions for r4 response.
Definition sd_mmc_card/src/at32_sdio.c:2072
sd_mult_blocks_read
sd_error_status_type sd_mult_blocks_read(uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks)
allows to read blocks from a specified address in a card. the data transfer can be managed by dma mod...
Definition sd_mmc_card/src/at32_sdio.c:1299
sd_wide_bus_operation_config
sd_error_status_type sd_wide_bus_operation_config(sdio_bus_width_type mode)
enable wide bus opeartion for the requeseted card if supported by card.
Definition sd_mmc_card/src/at32_sdio.c:765
rca
static uint32_t rca
Definition sd_mmc_card/src/at32_sdio.c:42
command_rsp3_error
sd_error_status_type command_rsp3_error(void)
checks for error conditions for R3 (ocr) response.
Definition sd_mmc_card/src/at32_sdio.c:2002
command_error
sd_error_status_type command_error(void)
checks for error conditions for cmd0.
Definition sd_mmc_card/src/at32_sdio.c:1895
system_core_clock
unsigned int system_core_clock
Definition system_at32f413.c:47
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_SDIO1_PERIPH_CLOCK
@ CRM_SDIO1_PERIPH_CLOCK
Definition at32f413_crm.h:106
CRM_GPIOC_PERIPH_CLOCK
@ CRM_GPIOC_PERIPH_CLOCK
Definition at32f413_crm.h:111
CRM_GPIOD_PERIPH_CLOCK
@ CRM_GPIOD_PERIPH_CLOCK
Definition at32f413_crm.h:112
CRM_DMA2_PERIPH_CLOCK
@ CRM_DMA2_PERIPH_CLOCK
Definition at32f413_crm.h:104
dma_channel_enable
void dma_channel_enable(dma_channel_type *dmax_channely, confirm_state new_state)
enable or disable dma channely
Definition at32f413_dma.c:197
dma_default_para_init
void dma_default_para_init(dma_init_type *dma_init_struct)
dma init config with its default value.
Definition at32f413_dma.c:407
dma_reset
void dma_reset(dma_channel_type *dmax_channely)
reset the dmax channely registers.
Definition at32f413_dma.c:63
dma_init
void dma_init(dma_channel_type *dmax_channely, dma_init_type *dma_init_struct)
dma init
Definition at32f413_dma.c:442
dma_dir_type
dma_dir_type
dma direction type
Definition at32f413_dma.h:215
DMA_PERIPHERAL_DATA_WIDTH_WORD
@ DMA_PERIPHERAL_DATA_WIDTH_WORD
Definition at32f413_dma.h:247
DMA_DIR_MEMORY_TO_PERIPHERAL
@ DMA_DIR_MEMORY_TO_PERIPHERAL
Definition at32f413_dma.h:217
DMA_DIR_PERIPHERAL_TO_MEMORY
@ DMA_DIR_PERIPHERAL_TO_MEMORY
Definition at32f413_dma.h:216
DMA_MEMORY_DATA_WIDTH_WORD
@ DMA_MEMORY_DATA_WIDTH_WORD
Definition at32f413_dma.h:257
DMA_PRIORITY_HIGH
@ DMA_PRIORITY_HIGH
Definition at32f413_dma.h:267
DMA2_CHANNEL4
#define DMA2_CHANNEL4
Definition at32f413_dma.h:492
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_10
#define GPIO_PINS_10
Definition at32f413_gpio.h:60
GPIO_PINS_11
#define GPIO_PINS_11
Definition at32f413_gpio.h:61
GPIO_PINS_2
#define GPIO_PINS_2
Definition at32f413_gpio.h:52
GPIO_PINS_12
#define GPIO_PINS_12
Definition at32f413_gpio.h:62
GPIO_PINS_9
#define GPIO_PINS_9
Definition at32f413_gpio.h:59
GPIO_PINS_8
#define GPIO_PINS_8
Definition at32f413_gpio.h:58
GPIOC
#define GPIOC
Definition at32f413_gpio.h:749
GPIOD
#define GPIOD
Definition at32f413_gpio.h:750
SDIO_SEND_IF_COND
#define SDIO_SEND_IF_COND
Definition emmc_card/inc/at32_sdio.h:438
SD_CMD_SD_APP_SEND_SCR
#define SD_CMD_SD_APP_SEND_SCR
Definition emmc_card/inc/at32_sdio.h:309
SD_CMD_ERASE
#define SD_CMD_ERASE
Definition emmc_card/inc/at32_sdio.h:292
SD_CMD_APP_SD_SET_BUSWIDTH
#define SD_CMD_APP_SD_SET_BUSWIDTH
Definition emmc_card/inc/at32_sdio.h:304
SD_CMD_WRITE_SINGLE_BLOCK
#define SD_CMD_WRITE_SINGLE_BLOCK
Definition emmc_card/inc/at32_sdio.h:281
SD_CMD_SD_ERASE_GRP_START
#define SD_CMD_SD_ERASE_GRP_START
Definition emmc_card/inc/at32_sdio.h:288
SD_CMD_APP_CMD
#define SD_CMD_APP_CMD
Definition emmc_card/inc/at32_sdio.h:296
SD_CMD_ALL_SEND_CID
#define SD_CMD_ALL_SEND_CID
Definition emmc_card/inc/at32_sdio.h:261
SD_CMD_STOP_TRANSMISSION
#define SD_CMD_STOP_TRANSMISSION
Definition emmc_card/inc/at32_sdio.h:271
SD_CMD_SEND_STATUS
#define SD_CMD_SEND_STATUS
Definition emmc_card/inc/at32_sdio.h:272
SD_CMD_SET_BLOCK_COUNT
#define SD_CMD_SET_BLOCK_COUNT
Definition emmc_card/inc/at32_sdio.h:280
SD_CMD_WRITE_DAT_UNTIL_STOP
#define SD_CMD_WRITE_DAT_UNTIL_STOP
Definition emmc_card/inc/at32_sdio.h:279
SD_CMD_SEND_OP_COND
#define SD_CMD_SEND_OP_COND
Definition emmc_card/inc/at32_sdio.h:260
SD_CMD_SET_BLOCKLEN
#define SD_CMD_SET_BLOCKLEN
Definition emmc_card/inc/at32_sdio.h:275
SD_CMD_HS_SWITCH
#define SD_CMD_HS_SWITCH
Definition emmc_card/inc/at32_sdio.h:265
SD_CMD_READ_SINGLE_BLOCK
#define SD_CMD_READ_SINGLE_BLOCK
Definition emmc_card/inc/at32_sdio.h:276
SD_CMD_SD_APP_OP_COND
#define SD_CMD_SD_APP_OP_COND
Definition emmc_card/inc/at32_sdio.h:307
SD_CMD_GO_IDLE_STATE
#define SD_CMD_GO_IDLE_STATE
Definition emmc_card/inc/at32_sdio.h:259
SD_CMD_SET_REL_ADDR
#define SD_CMD_SET_REL_ADDR
Definition emmc_card/inc/at32_sdio.h:262
SD_CMD_ERASE_GRP_END
#define SD_CMD_ERASE_GRP_END
Definition emmc_card/inc/at32_sdio.h:291
SD_CMD_READ_DAT_UNTIL_STOP
#define SD_CMD_READ_DAT_UNTIL_STOP
Definition emmc_card/inc/at32_sdio.h:270
SD_CMD_SD_ERASE_GRP_END
#define SD_CMD_SD_ERASE_GRP_END
Definition emmc_card/inc/at32_sdio.h:289
SD_CMD_ERASE_GRP_START
#define SD_CMD_ERASE_GRP_START
Definition emmc_card/inc/at32_sdio.h:290
SD_CMD_HS_SEND_EXT_CSD
#define SD_CMD_HS_SEND_EXT_CSD
Definition emmc_card/inc/at32_sdio.h:267
SD_CMD_SEL_DESEL_CARD
#define SD_CMD_SEL_DESEL_CARD
Definition emmc_card/inc/at32_sdio.h:266
SD_CMD_WRITE_MULT_BLOCK
#define SD_CMD_WRITE_MULT_BLOCK
Definition emmc_card/inc/at32_sdio.h:282
SD_CMD_READ_MULT_BLOCK
#define SD_CMD_READ_MULT_BLOCK
Definition emmc_card/inc/at32_sdio.h:277
SD_CMD_SEND_CSD
#define SD_CMD_SEND_CSD
Definition emmc_card/inc/at32_sdio.h:268
sdio_command_config
void sdio_command_config(sdio_type *sdio_x, sdio_command_struct_type *command_struct)
config sdio command.
Definition at32f413_sdio.c:372
sdio_data_write
void sdio_data_write(sdio_type *sdio_x, uint32_t data)
write one word data to fifo.
Definition at32f413_sdio.c:533
sdio_data_config
void sdio_data_config(sdio_type *sdio_x, sdio_data_struct_type *data_struct)
config sdio data.
Definition at32f413_sdio.c:459
sdio_data_read
uint32_t sdio_data_read(sdio_type *sdio_x)
read a word data from sdio fifo.
Definition at32f413_sdio.c:508
sdio_command_state_machine_enable
void sdio_command_state_machine_enable(sdio_type *sdio_x, confirm_state new_state)
enable or disable command path state machine(CPSM).
Definition at32f413_sdio.c:395
sdio_clock_bypass
void sdio_clock_bypass(sdio_type *sdio_x, confirm_state new_state)
enable or disable clock divider bypss
Definition at32f413_sdio.c:140
sdio_flow_control_enable
void sdio_flow_control_enable(sdio_type *sdio_x, confirm_state new_state)
enable or disable hardware flow control.
Definition at32f413_sdio.c:167
sdio_power_set
void sdio_power_set(sdio_type *sdio_x, sdio_power_state_type power_state)
set the power status of the controller
Definition at32f413_sdio.c:74
sdio_clock_config
void sdio_clock_config(sdio_type *sdio_x, uint16_t clk_div, sdio_edge_phase_type clk_edg)
config sdio clock
Definition at32f413_sdio.c:103
sdio_bus_width_config
void sdio_bus_width_config(sdio_type *sdio_x, sdio_bus_width_type width)
config sdio bus width
Definition at32f413_sdio.c:127
sdio_interrupt_enable
void sdio_interrupt_enable(sdio_type *sdio_x, uint32_t int_opt, confirm_state new_state)
config corresponding interrupt.
Definition at32f413_sdio.c:231
sdio_flag_clear
void sdio_flag_clear(sdio_type *sdio_x, uint32_t flag)
clear sdio flag.
Definition at32f413_sdio.c:358
sdio_power_status_get
sdio_power_state_type sdio_power_status_get(sdio_type *sdio_x)
get power status.
Definition at32f413_sdio.c:86
sdio_response_get
uint32_t sdio_response_get(sdio_type *sdio_x, sdio_rsp_index_type reg_index)
get response received from the card for the last command.
Definition at32f413_sdio.c:426
sdio_data_state_machine_enable
void sdio_data_state_machine_enable(sdio_type *sdio_x, confirm_state new_state)
enable or disable data path state machine(DPSM).
Definition at32f413_sdio.c:484
sdio_power_saving_mode_enable
void sdio_power_saving_mode_enable(sdio_type *sdio_x, confirm_state new_state)
enable or disable power saving mode, config sdio_ck clock output when the bus is idle.
Definition at32f413_sdio.c:154
sdio_flag_get
flag_status sdio_flag_get(sdio_type *sdio_x, uint32_t flag)
get sdio flag.
Definition at32f413_sdio.c:321
sdio_dma_enable
void sdio_dma_enable(sdio_type *sdio_x, confirm_state new_state)
enable or disable dma.
Definition at32f413_sdio.c:193
sdio_reset
void sdio_reset(sdio_type *sdio_x)
reset the sdio register
Definition at32f413_sdio.c:50
sdio_interrupt_flag_get
flag_status sdio_interrupt_flag_get(sdio_type *sdio_x, uint32_t flag)
get sdio interrupt flag.
Definition at32f413_sdio.c:277
sdio_clock_enable
void sdio_clock_enable(sdio_type *sdio_x, confirm_state new_state)
enable or disable sdio_ck output.
Definition at32f413_sdio.c:180
sdio_command_response_get
uint8_t sdio_command_response_get(sdio_type *sdio_x)
get command index of last command for which response received.
Definition at32f413_sdio.c:408
sd_data_transfer_mode_type
sd_data_transfer_mode_type
Definition emmc_card/inc/at32_sdio.h:64
sd_error_status_type
sd_error_status_type
Definition emmc_card/inc/at32_sdio.h:73
sd_card_state_type
sd_card_state_type
Definition emmc_card/inc/at32_sdio.h:186
sdio_bus_width_type
sdio_bus_width_type
sdio bus width
Definition at32f413_sdio.h:138
sd_memory_card_type
sd_memory_card_type
Definition emmc_card/inc/at32_sdio.h:202
sdio_block_size_type
sdio_block_size_type
sdio data block size
Definition at32f413_sdio.h:179
SDIO_WAIT_FOR_NO
@ SDIO_WAIT_FOR_NO
Definition at32f413_sdio.h:159
SDIO_RESPONSE_LONG
@ SDIO_RESPONSE_LONG
Definition at32f413_sdio.h:151
SDIO_RESPONSE_SHORT
@ SDIO_RESPONSE_SHORT
Definition at32f413_sdio.h:150
SDIO_RESPONSE_NO
@ SDIO_RESPONSE_NO
Definition at32f413_sdio.h:149
SD_TRANSFER_DMA_MODE
@ SD_TRANSFER_DMA_MODE
Definition emmc_card/inc/at32_sdio.h:66
SD_TRANSFER_POLLING_MODE
@ SD_TRANSFER_POLLING_MODE
Definition emmc_card/inc/at32_sdio.h:65
SD_ERROR
@ SD_ERROR
Definition emmc_card/inc/at32_sdio.h:117
SD_SDIO_UNKNOWN_FUNC
@ SD_SDIO_UNKNOWN_FUNC
Definition emmc_card/inc/at32_sdio.h:107
SD_DATA_FAIL
@ SD_DATA_FAIL
Definition emmc_card/inc/at32_sdio.h:76
SD_INVALID_PARAMETER
@ SD_INVALID_PARAMETER
Definition emmc_card/inc/at32_sdio.h:114
SD_CMD_FAIL
@ SD_CMD_FAIL
Definition emmc_card/inc/at32_sdio.h:75
SD_CMD_OUT_OF_RANGE
@ SD_CMD_OUT_OF_RANGE
Definition emmc_card/inc/at32_sdio.h:82
SD_GENERAL_UNKNOWN_ERROR
@ SD_GENERAL_UNKNOWN_ERROR
Definition emmc_card/inc/at32_sdio.h:93
SD_UNSUPPORTED_FEATURE
@ SD_UNSUPPORTED_FEATURE
Definition emmc_card/inc/at32_sdio.h:115
SD_TX_UNDERRUN
@ SD_TX_UNDERRUN
Definition emmc_card/inc/at32_sdio.h:79
SD_ILLEGAL_CMD
@ SD_ILLEGAL_CMD
Definition emmc_card/inc/at32_sdio.h:90
SD_CMD_CRC_ERROR
@ SD_CMD_CRC_ERROR
Definition emmc_card/inc/at32_sdio.h:89
SD_RX_OVERRUN
@ SD_RX_OVERRUN
Definition emmc_card/inc/at32_sdio.h:80
SD_REQ_NOT_APPLICABLE
@ SD_REQ_NOT_APPLICABLE
Definition emmc_card/inc/at32_sdio.h:113
SD_SWITCH_ERROR
@ SD_SWITCH_ERROR
Definition emmc_card/inc/at32_sdio.h:103
SD_INVALID_VOLTRANGE
@ SD_INVALID_VOLTRANGE
Definition emmc_card/inc/at32_sdio.h:101
SD_DATA_TIMEOUT
@ SD_DATA_TIMEOUT
Definition emmc_card/inc/at32_sdio.h:78
SD_START_BIT_ERR
@ SD_START_BIT_ERR
Definition emmc_card/inc/at32_sdio.h:81
SD_LOCK_UNLOCK_ERROR
@ SD_LOCK_UNLOCK_ERROR
Definition emmc_card/inc/at32_sdio.h:88
SD_CMD_RSP_TIMEOUT
@ SD_CMD_RSP_TIMEOUT
Definition emmc_card/inc/at32_sdio.h:77
SD_OK
@ SD_OK
Definition emmc_card/inc/at32_sdio.h:118
SDIO_CLOCK_EDGE_FALLING
@ SDIO_CLOCK_EDGE_FALLING
Definition at32f413_sdio.h:131
SDIO_DATA_TRANSFER_TO_CARD
@ SDIO_DATA_TRANSFER_TO_CARD
Definition at32f413_sdio.h:211
SDIO_DATA_TRANSFER_TO_CONTROLLER
@ SDIO_DATA_TRANSFER_TO_CONTROLLER
Definition at32f413_sdio.h:212
SDIO_POWER_OFF
@ SDIO_POWER_OFF
Definition at32f413_sdio.h:121
SDIO_POWER_ON
@ SDIO_POWER_ON
Definition at32f413_sdio.h:122
SD_CARD_ERROR
@ SD_CARD_ERROR
Definition emmc_card/inc/at32_sdio.h:195
SDIO_DATA_BLOCK_TRANSFER
@ SDIO_DATA_BLOCK_TRANSFER
Definition at32f413_sdio.h:202
SDIO_DATA_STREAM_TRANSFER
@ SDIO_DATA_STREAM_TRANSFER
Definition at32f413_sdio.h:203
SDIO_BUS_WIDTH_D1
@ SDIO_BUS_WIDTH_D1
Definition at32f413_sdio.h:139
SDIO_BUS_WIDTH_D4
@ SDIO_BUS_WIDTH_D4
Definition at32f413_sdio.h:140
SDIO_RSP3_INDEX
@ SDIO_RSP3_INDEX
Definition at32f413_sdio.h:171
SDIO_RSP2_INDEX
@ SDIO_RSP2_INDEX
Definition at32f413_sdio.h:170
SDIO_RSP4_INDEX
@ SDIO_RSP4_INDEX
Definition at32f413_sdio.h:172
SDIO_RSP1_INDEX
@ SDIO_RSP1_INDEX
Definition at32f413_sdio.h:169
SDIO_HIGH_CAPACITY_SD_CARD
@ SDIO_HIGH_CAPACITY_SD_CARD
Definition emmc_card/inc/at32_sdio.h:205
SDIO_SECURE_DIGITAL_IO_COMBO_CARD
@ SDIO_SECURE_DIGITAL_IO_COMBO_CARD
Definition emmc_card/inc/at32_sdio.h:209
SDIO_HIGH_SPEED_MULTIMEDIA_CARD
@ SDIO_HIGH_SPEED_MULTIMEDIA_CARD
Definition emmc_card/inc/at32_sdio.h:208
SDIO_STD_CAPACITY_SD_CARD_V1_1
@ SDIO_STD_CAPACITY_SD_CARD_V1_1
Definition emmc_card/inc/at32_sdio.h:203
SDIO_SECURE_DIGITAL_IO_CARD
@ SDIO_SECURE_DIGITAL_IO_CARD
Definition emmc_card/inc/at32_sdio.h:207
SDIO_STD_CAPACITY_SD_CARD_V2_0
@ SDIO_STD_CAPACITY_SD_CARD_V2_0
Definition emmc_card/inc/at32_sdio.h:204
SDIO_MULTIMEDIA_CARD
@ SDIO_MULTIMEDIA_CARD
Definition emmc_card/inc/at32_sdio.h:206
SDIO_HIGH_CAPACITY_MMC_CARD
@ SDIO_HIGH_CAPACITY_MMC_CARD
Definition emmc_card/inc/at32_sdio.h:210
SDIO_DATA_BLOCK_SIZE_8B
@ SDIO_DATA_BLOCK_SIZE_8B
Definition at32f413_sdio.h:183
SDIO_DATA_BLOCK_SIZE_1B
@ SDIO_DATA_BLOCK_SIZE_1B
Definition at32f413_sdio.h:180
SDIO_DATA_BLOCK_SIZE_512B
@ SDIO_DATA_BLOCK_SIZE_512B
Definition at32f413_sdio.h:189
SDIO_CMDTIMEOUT_FLAG
#define SDIO_CMDTIMEOUT_FLAG
Definition at32f413_sdio.h:86
SDIO_TXBUFH_FLAG
#define SDIO_TXBUFH_FLAG
Definition at32f413_sdio.h:98
SDIO_CMDCMPL_FLAG
#define SDIO_CMDCMPL_FLAG
Definition at32f413_sdio.h:91
SDIO_DTFAIL_FLAG
#define SDIO_DTFAIL_FLAG
Definition at32f413_sdio.h:85
SDIO_RXERRO_FLAG
#define SDIO_RXERRO_FLAG
Definition at32f413_sdio.h:89
SDIO_RXBUFH_FLAG
#define SDIO_RXBUFH_FLAG
Definition at32f413_sdio.h:99
SDIO_RXBUF_FLAG
#define SDIO_RXBUF_FLAG
Definition at32f413_sdio.h:105
SDIO_CMDFAIL_FLAG
#define SDIO_CMDFAIL_FLAG
Definition at32f413_sdio.h:84
SDIO_CMDRSPCMPL_FLAG
#define SDIO_CMDRSPCMPL_FLAG
Definition at32f413_sdio.h:90
SDIO_DTBLKCMPL_FLAG
#define SDIO_DTBLKCMPL_FLAG
Definition at32f413_sdio.h:94
SDIO_DTTIMEOUT_FLAG
#define SDIO_DTTIMEOUT_FLAG
Definition at32f413_sdio.h:87
SDIO_SBITERR_FLAG
#define SDIO_SBITERR_FLAG
Definition at32f413_sdio.h:93
SDIO_DTCMPL_FLAG
#define SDIO_DTCMPL_FLAG
Definition at32f413_sdio.h:92
SDIO_TXERRU_FLAG
#define SDIO_TXERRU_FLAG
Definition at32f413_sdio.h:88
SDIOx
#define SDIOx
Definition emmc_card/inc/at32_sdio.h:50
SDIO_INTR_STS_WRITE_MASK
#define SDIO_INTR_STS_WRITE_MASK
Definition emmc_card/inc/at32_sdio.h:474
SDIO_INTR_STS_READ_MASK
#define SDIO_INTR_STS_READ_MASK
Definition emmc_card/inc/at32_sdio.h:476
SDIO_SBITERR_INT
#define SDIO_SBITERR_INT
Definition at32f413_sdio.h:60
SDIO_RXBUFH_INT
#define SDIO_RXBUFH_INT
Definition at32f413_sdio.h:66
SDIO_DTTIMEOUT_INT
#define SDIO_DTTIMEOUT_INT
Definition at32f413_sdio.h:54
SDIO_TXERRU_INT
#define SDIO_TXERRU_INT
Definition at32f413_sdio.h:55
SDIO_RXERRO_INT
#define SDIO_RXERRO_INT
Definition at32f413_sdio.h:56
SDIO_DTFAIL_INT
#define SDIO_DTFAIL_INT
Definition at32f413_sdio.h:52
SDIO_TXBUFH_INT
#define SDIO_TXBUFH_INT
Definition at32f413_sdio.h:65
SDIO_DTCMP_INT
#define SDIO_DTCMP_INT
Definition at32f413_sdio.h:59
EXT_CSD_BUS_WIDTH
#define EXT_CSD_BUS_WIDTH
Definition emmc_card/inc/at32_sdio.h:463
EXT_CSD_CMD_SET_NORMAL
#define EXT_CSD_CMD_SET_NORMAL
Definition emmc_card/inc/at32_sdio.h:456
EXT_CSD_Write_byte
#define EXT_CSD_Write_byte
Definition emmc_card/inc/at32_sdio.h:454
NULL
#define NULL
Definition emmc_card/inc/at32_sdio.h:340
SDIO_DATATIMEOUT
#define SDIO_DATATIMEOUT
Definition emmc_card/inc/at32_sdio.h:343
SDIO_CMD0TIMEOUT
#define SDIO_CMD0TIMEOUT
Definition emmc_card/inc/at32_sdio.h:342
SDIO_STATIC_FLAGS
#define SDIO_STATIC_FLAGS
Definition emmc_card/inc/at32_sdio.h:341
SD_CARD_LOCKED
#define SD_CARD_LOCKED
Definition emmc_card/inc/at32_sdio.h:400
SD_VOLTAGE_WINDOW_SD
#define SD_VOLTAGE_WINDOW_SD
Definition emmc_card/inc/at32_sdio.h:391
SD_R5_ERROR
#define SD_R5_ERROR
Definition emmc_card/inc/at32_sdio.h:383
SD_CARD_RECEIVING
#define SD_CARD_RECEIVING
Definition emmc_card/inc/at32_sdio.h:402
SD_R5_OUT_OF_RANGE
#define SD_R5_OUT_OF_RANGE
Definition emmc_card/inc/at32_sdio.h:381
SD_MAX_DATA_LENGTH
#define SD_MAX_DATA_LENGTH
Definition emmc_card/inc/at32_sdio.h:408
SD_STD_CAPACITY
#define SD_STD_CAPACITY
Definition emmc_card/inc/at32_sdio.h:393
SD_R5_FUNCTION_NUMBER
#define SD_R5_FUNCTION_NUMBER
Definition emmc_card/inc/at32_sdio.h:382
SD_R6_ILLEGAL_CMD
#define SD_R6_ILLEGAL_CMD
Definition emmc_card/inc/at32_sdio.h:389
SD_R6_GENERAL_UNKNOWN_ERROR
#define SD_R6_GENERAL_UNKNOWN_ERROR
Definition emmc_card/inc/at32_sdio.h:388
SD_MAX_VOLT_TRIAL
#define SD_MAX_VOLT_TRIAL
Definition emmc_card/inc/at32_sdio.h:396
SD_DATATIMEOUT
#define SD_DATATIMEOUT
Definition emmc_card/inc/at32_sdio.h:403
SD_ALLZERO
#define SD_ALLZERO
Definition emmc_card/inc/at32_sdio.h:397
SD_R6_CMD_CRC_ERROR
#define SD_R6_CMD_CRC_ERROR
Definition emmc_card/inc/at32_sdio.h:390
MMC_SWITCH_ERROR
#define MMC_SWITCH_ERROR
Definition emmc_card/inc/at32_sdio.h:374
SD_VOLTAGE_WINDOW_MMC
#define SD_VOLTAGE_WINDOW_MMC
Definition emmc_card/inc/at32_sdio.h:395
SD_CHECK_PATTERN
#define SD_CHECK_PATTERN
Definition emmc_card/inc/at32_sdio.h:394
SD_OCR_ERRORBITS
#define SD_OCR_ERRORBITS
Definition emmc_card/inc/at32_sdio.h:376
SD_CARD_PROGRAMMING
#define SD_CARD_PROGRAMMING
Definition emmc_card/inc/at32_sdio.h:401
SD_HIGH_CAPACITY
#define SD_HIGH_CAPACITY
Definition emmc_card/inc/at32_sdio.h:392
dma_init_type
dma init type
Definition at32f413_dma.h:275
dma_init_type::loop_mode_enable
confirm_state loop_mode_enable
Definition at32f413_dma.h:284
dma_init_type::buffer_size
uint16_t buffer_size
Definition at32f413_dma.h:279
dma_init_type::memory_data_width
dma_memory_data_size_type memory_data_width
Definition at32f413_dma.h:283
dma_init_type::priority
dma_priority_level_type priority
Definition at32f413_dma.h:285
dma_init_type::peripheral_inc_enable
confirm_state peripheral_inc_enable
Definition at32f413_dma.h:280
dma_init_type::memory_inc_enable
confirm_state memory_inc_enable
Definition at32f413_dma.h:281
dma_init_type::direction
dma_dir_type direction
Definition at32f413_dma.h:278
dma_init_type::peripheral_base_addr
uint32_t peripheral_base_addr
Definition at32f413_dma.h:276
dma_init_type::memory_base_addr
uint32_t memory_base_addr
Definition at32f413_dma.h:277
dma_init_type::peripheral_data_width
dma_peripheral_data_size_type peripheral_data_width
Definition at32f413_dma.h:282
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
sd_card_info_struct_type
Definition emmc_card/inc/at32_sdio.h:236
sd_card_info_struct_type::sd_scr_reg
sd_scr_struct_type sd_scr_reg
Definition emmc_card/inc/at32_sdio.h:239
sd_card_info_struct_type::card_capacity
long long card_capacity
Definition emmc_card/inc/at32_sdio.h:240
sd_card_info_struct_type::sd_cid_reg
sd_cid_struct_type sd_cid_reg
Definition emmc_card/inc/at32_sdio.h:238
sd_card_info_struct_type::sd_csd_reg
sd_csd_struct_type sd_csd_reg
Definition emmc_card/inc/at32_sdio.h:237
sd_card_info_struct_type::card_blk_size
uint32_t card_blk_size
Definition emmc_card/inc/at32_sdio.h:241
sd_card_info_struct_type::rca
uint16_t rca
Definition emmc_card/inc/at32_sdio.h:242
sd_card_info_struct_type::card_type
uint8_t card_type
Definition emmc_card/inc/at32_sdio.h:243
sd_cid_struct_type::reserved1
uint8_t reserved1
Definition emmc_card/inc/at32_sdio.h:176
sd_cid_struct_type::product_name2
uint8_t product_name2
Definition emmc_card/inc/at32_sdio.h:173
sd_cid_struct_type::manufact_date
uint16_t manufact_date
Definition emmc_card/inc/at32_sdio.h:177
sd_cid_struct_type::cid_crc
uint8_t cid_crc
Definition emmc_card/inc/at32_sdio.h:178
sd_cid_struct_type::product_reversion
uint8_t product_reversion
Definition emmc_card/inc/at32_sdio.h:174
sd_cid_struct_type::manufacturer_id
uint8_t manufacturer_id
Definition emmc_card/inc/at32_sdio.h:170
sd_cid_struct_type::product_sn
uint32_t product_sn
Definition emmc_card/inc/at32_sdio.h:175
sd_cid_struct_type::product_name1
uint32_t product_name1
Definition emmc_card/inc/at32_sdio.h:172
sd_cid_struct_type::reserved2
uint8_t reserved2
Definition emmc_card/inc/at32_sdio.h:179
sd_cid_struct_type::oem_app_id
uint16_t oem_app_id
Definition emmc_card/inc/at32_sdio.h:171
sd_csd_struct_type::spec_version
uint8_t spec_version
Definition emmc_card/inc/at32_sdio.h:127
sd_csd_struct_type::max_write_current_vdd_max
uint8_t max_write_current_vdd_max
Definition emmc_card/inc/at32_sdio.h:143
sd_csd_struct_type::nsac
uint8_t nsac
Definition emmc_card/inc/at32_sdio.h:130
sd_csd_struct_type::card_cmd_classes
uint16_t card_cmd_classes
Definition emmc_card/inc/at32_sdio.h:132
sd_csd_struct_type::part_blk_read
uint8_t part_blk_read
Definition emmc_card/inc/at32_sdio.h:134
sd_csd_struct_type::read_blk_misalign
uint8_t read_blk_misalign
Definition emmc_card/inc/at32_sdio.h:136
sd_csd_struct_type::content_protect_app
uint8_t content_protect_app
Definition emmc_card/inc/at32_sdio.h:154
sd_csd_struct_type::write_speed_factor
uint8_t write_speed_factor
Definition emmc_card/inc/at32_sdio.h:150
sd_csd_struct_type::max_read_blk_length
uint8_t max_read_blk_length
Definition emmc_card/inc/at32_sdio.h:133
sd_csd_struct_type::max_bus_clk_freq
uint8_t max_bus_clk_freq
Definition emmc_card/inc/at32_sdio.h:131
sd_csd_struct_type::ecc_code
uint8_t ecc_code
Definition emmc_card/inc/at32_sdio.h:160
sd_csd_struct_type::reserved4
uint8_t reserved4
Definition emmc_card/inc/at32_sdio.h:162
sd_csd_struct_type::dsr_implemented
uint8_t dsr_implemented
Definition emmc_card/inc/at32_sdio.h:137
sd_csd_struct_type::max_read_current_vdd_min
uint8_t max_read_current_vdd_min
Definition emmc_card/inc/at32_sdio.h:140
sd_csd_struct_type::reserved2
uint8_t reserved2
Definition emmc_card/inc/at32_sdio.h:138
sd_csd_struct_type::erase_group_size_mult
uint8_t erase_group_size_mult
Definition emmc_card/inc/at32_sdio.h:146
sd_csd_struct_type::file_formart
uint8_t file_formart
Definition emmc_card/inc/at32_sdio.h:159
sd_csd_struct_type::temp_write_protect
uint8_t temp_write_protect
Definition emmc_card/inc/at32_sdio.h:158
sd_csd_struct_type::permanent_write_protect
uint8_t permanent_write_protect
Definition emmc_card/inc/at32_sdio.h:157
sd_csd_struct_type::max_read_current_vdd_max
uint8_t max_read_current_vdd_max
Definition emmc_card/inc/at32_sdio.h:141
sd_csd_struct_type::file_format_group
uint8_t file_format_group
Definition emmc_card/inc/at32_sdio.h:155
sd_csd_struct_type::device_size
uint32_t device_size
Definition emmc_card/inc/at32_sdio.h:139
sd_csd_struct_type::write_blk_misalign
uint8_t write_blk_misalign
Definition emmc_card/inc/at32_sdio.h:135
sd_csd_struct_type::csd_struct
uint8_t csd_struct
Definition emmc_card/inc/at32_sdio.h:126
sd_csd_struct_type::write_protect_group_enable
uint8_t write_protect_group_enable
Definition emmc_card/inc/at32_sdio.h:148
sd_csd_struct_type::max_write_current_vdd_min
uint8_t max_write_current_vdd_min
Definition emmc_card/inc/at32_sdio.h:142
sd_csd_struct_type::reserved1
uint8_t reserved1
Definition emmc_card/inc/at32_sdio.h:128
sd_csd_struct_type::max_write_blk_length
uint8_t max_write_blk_length
Definition emmc_card/inc/at32_sdio.h:151
sd_csd_struct_type::csd_crc
uint8_t csd_crc
Definition emmc_card/inc/at32_sdio.h:161
sd_csd_struct_type::write_protect_group_size
uint8_t write_protect_group_size
Definition emmc_card/inc/at32_sdio.h:147
sd_csd_struct_type::reserved3
uint8_t reserved3
Definition emmc_card/inc/at32_sdio.h:153
sd_csd_struct_type::taac
uint8_t taac
Definition emmc_card/inc/at32_sdio.h:129
sd_csd_struct_type::manufacturer_default_ecc
uint8_t manufacturer_default_ecc
Definition emmc_card/inc/at32_sdio.h:149
sd_csd_struct_type::part_blk_write
uint8_t part_blk_write
Definition emmc_card/inc/at32_sdio.h:152
sd_csd_struct_type::copy_flag
uint8_t copy_flag
Definition emmc_card/inc/at32_sdio.h:156
sd_csd_struct_type::erase_group_size
uint8_t erase_group_size
Definition emmc_card/inc/at32_sdio.h:145
sd_csd_struct_type::device_size_mult
uint8_t device_size_mult
Definition emmc_card/inc/at32_sdio.h:144
sd_scr_struct_type::sd_bus_width
uint32_t sd_bus_width
Definition emmc_card/inc/at32_sdio.h:221
sd_scr_struct_type::sd_spec
uint32_t sd_spec
Definition emmc_card/inc/at32_sdio.h:219
sdio_command_struct_type
sdio command structure
Definition at32f413_sdio.h:228
sdio_command_struct_type::cmd_index
uint8_t cmd_index
Definition at32f413_sdio.h:230
sdio_command_struct_type::argument
uint32_t argument
Definition at32f413_sdio.h:229
sdio_command_struct_type::wait_type
sdio_wait_type wait_type
Definition at32f413_sdio.h:232
sdio_command_struct_type::rsp_type
sdio_reponse_type rsp_type
Definition at32f413_sdio.h:231
sdio_data_struct_type
sdio data structure
Definition at32f413_sdio.h:239
sdio_data_struct_type::block_size
sdio_block_size_type block_size
Definition at32f413_sdio.h:242
sdio_data_struct_type::transfer_direction
sdio_transfer_direction_type transfer_direction
Definition at32f413_sdio.h:244
sdio_data_struct_type::timeout
uint32_t timeout
Definition at32f413_sdio.h:240
sdio_data_struct_type::transfer_mode
sdio_transfer_mode_type transfer_mode
Definition at32f413_sdio.h:243
sdio_data_struct_type::data_length
uint32_t data_length
Definition at32f413_sdio.h:241


AT32F413 Firmwary Library: at32_sdio.h Source File

  • sdio
  • sdio_fatfs
  • inc
sdio_fatfs/inc/at32_sdio.h
Go to the documentation of this file.
1
27/* define to prevent recursive inclusion -------------------------------------*/
28#ifndef __AT32_SDIO_H
29#define __AT32_SDIO_H
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
35/* includes ------------------------------------------------------------------*/
36#include "at32f413.h"
37
50#define SDIOx SDIO1
51
63typedef enum
64{
65 SD_TRANSFER_POLLING_MODE = 0,
66 SD_TRANSFER_DMA_MODE = 1
67} sd_data_transfer_mode_type;
68
72typedef enum
73{
74 /* sdio specific error defines ------------------------------------------*/
75 SD_CMD_FAIL = 1,
76 SD_DATA_FAIL = 2,
77 SD_CMD_RSP_TIMEOUT = 3,
78 SD_DATA_TIMEOUT = 4,
79 SD_TX_UNDERRUN = 5,
80 SD_RX_OVERRUN = 6,
81 SD_START_BIT_ERR = 7,
82 SD_CMD_OUT_OF_RANGE = 8,
83 SD_ADDR_MISALIGNED = 9,
84 SD_BLK_LEN_ERR = 10,
85 SD_ERASE_SEQ_ERR = 11,
86 SD_INVALID_ERASE_PARAM = 12,
87 SD_WR_PROTECT_VIOLATION = 13,
88 SD_LOCK_UNLOCK_ERROR = 14,
89 SD_CMD_CRC_ERROR = 15,
90 SD_ILLEGAL_CMD = 16,
91 SD_CARD_ECC_ERROR = 17,
92 SD_CARD_CONTROLLER_ERR = 18,
93 SD_GENERAL_UNKNOWN_ERROR = 19,
94 SD_STREAM_RD_UNDERRUN = 20,
95 SD_STREAM_WR_OVERRUN = 21,
96 SD_CID_CSD_OVERWRITE = 22,
97 SD_WP_ERASE_SKIP = 23,
98 SD_CARD_ECC_DISABLED = 24,
99 SD_ERASE_RESET = 25,
100 SD_AKE_SEQ_ERROR = 26,
101 SD_INVALID_VOLTRANGE = 27,
102 SD_ADDR_OUT_OF_RANGE = 28,
103 SD_SWITCH_ERROR = 29,
104 SD_SDIO_DISABLED = 30,
105 SD_SDIO_FUNC_BUSY = 31,
106 SD_SDIO_FUNC_ERROR = 32,
107 SD_SDIO_UNKNOWN_FUNC = 33,
109 /* standard error defines --------------------------------------------*/
110 SD_INTERNAL_ERROR,
111 SD_NOT_CONFIGURED,
112 SD_REQ_PENDING,
113 SD_REQ_NOT_APPLICABLE,
114 SD_INVALID_PARAMETER,
115 SD_UNSUPPORTED_FEATURE,
116 SD_UNSUPPORTED_HW,
117 SD_ERROR,
118 SD_OK = 0
119} sd_error_status_type;
120
124typedef struct
125{
126 uint8_t csd_struct;
127 uint8_t spec_version;
128 uint8_t reserved1;
129 uint8_t taac;
130 uint8_t nsac;
131 uint8_t max_bus_clk_freq;
132 uint16_t card_cmd_classes;
133 uint8_t max_read_blk_length;
134 uint8_t part_blk_read;
135 uint8_t write_blk_misalign;
136 uint8_t read_blk_misalign;
137 uint8_t dsr_implemented;
138 uint8_t reserved2;
139 uint32_t device_size;
140 uint8_t max_read_current_vdd_min;
141 uint8_t max_read_current_vdd_max;
142 uint8_t max_write_current_vdd_min;
143 uint8_t max_write_current_vdd_max;
144 uint8_t device_size_mult;
145 uint8_t erase_group_size;
146 uint8_t erase_group_size_mult;
147 uint8_t write_protect_group_size;
148 uint8_t write_protect_group_enable;
149 uint8_t manufacturer_default_ecc;
150 uint8_t write_speed_factor;
151 uint8_t max_write_blk_length;
152 uint8_t part_blk_write;
153 uint8_t reserved3;
154 uint8_t content_protect_app;
155 uint8_t file_format_group;
156 uint8_t copy_flag;
157 uint8_t permanent_write_protect;
158 uint8_t temp_write_protect;
159 uint8_t file_formart;
160 uint8_t ecc_code;
161 uint8_t csd_crc;
162 uint8_t reserved4;
163} sd_csd_struct_type;
164
168typedef struct
169{
170 uint8_t manufacturer_id;
171 uint16_t oem_app_id;
172 uint32_t product_name1;
173 uint8_t product_name2;
174 uint8_t product_reversion;
175 uint32_t product_sn;
176 uint8_t reserved1;
177 uint16_t manufact_date;
178 uint8_t cid_crc;
179 uint8_t reserved2;
180} sd_cid_struct_type;
181
185typedef enum
186{
187 SD_CARD_READY = ((uint32_t)0x00000001),
188 SD_CARD_IDENTIFICATION = ((uint32_t)0x00000002),
189 SD_CARD_STANDBY = ((uint32_t)0x00000003),
190 SD_CARD_TRANSFER = ((uint32_t)0x00000004),
191 SD_CARD_SENDING = ((uint32_t)0x00000005),
192 SD_CARD_RECEIVING = ((uint32_t)0x00000006),
193 SD_CARD_PROGRAMMING = ((uint32_t)0x00000007),
194 SD_CARD_DISCONNECTED = ((uint32_t)0x00000008),
195 SD_CARD_ERROR = ((uint32_t)0x000000FF)
196} sd_card_state_type;
197
201typedef enum
202{
203 SDIO_STD_CAPACITY_SD_CARD_V1_1 = 0,
204 SDIO_STD_CAPACITY_SD_CARD_V2_0 = 1,
205 SDIO_HIGH_CAPACITY_SD_CARD = 2,
206 SDIO_MULTIMEDIA_CARD = 3,
207 SDIO_SECURE_DIGITAL_IO_CARD = 4,
208 SDIO_HIGH_SPEED_MULTIMEDIA_CARD = 5,
209 SDIO_SECURE_DIGITAL_IO_COMBO_CARD = 6,
210 SDIO_HIGH_CAPACITY_MMC_CARD = 7,
211 SDIO_SDIO_CARD = 8
212} sd_memory_card_type;
213
217typedef struct
218{
219 uint32_t sd_spec :4; /* [59:56] */
220 uint32_t scr_structure :4; /* [60:63] */
221 uint32_t sd_bus_width :4; /* [51:48] */
222 uint32_t sd_security :3; /* [52:54] */
223 uint32_t data_stat_after_erase :1; /* [55:55] */
224 uint32_t reserved1 :7; /* [46:40] */
225 uint32_t sd_spec3 :1; /* [47:47] */
226 uint32_t cmd20_support :1; /* [32:32] */
227 uint32_t cmd23_support :1; /* [33:33] */
228 uint32_t reserverd2 :6; /* [34:39] */
229 uint32_t reserverd3; /* [31:0] */
230} sd_scr_struct_type;
231
235typedef struct
236{
237 sd_csd_struct_type sd_csd_reg;
238 sd_cid_struct_type sd_cid_reg;
239 sd_scr_struct_type sd_scr_reg;
240 long long card_capacity;
241 uint32_t card_blk_size;
242 uint16_t rca;
243 uint8_t card_type;
244} sd_card_info_struct_type;
245
246extern sd_card_info_struct_type sd_card_info;
247
259#define SD_CMD_GO_IDLE_STATE ((uint8_t)0)
260#define SD_CMD_SEND_OP_COND ((uint8_t)1)
261#define SD_CMD_ALL_SEND_CID ((uint8_t)2)
262#define SD_CMD_SET_REL_ADDR ((uint8_t)3)
263#define SD_CMD_SET_DSR ((uint8_t)4)
264#define SD_CMD_SDIO_SEN_OP_COND ((uint8_t)5)
265#define SD_CMD_HS_SWITCH ((uint8_t)6)
266#define SD_CMD_SEL_DESEL_CARD ((uint8_t)7)
267#define SD_CMD_HS_SEND_EXT_CSD ((uint8_t)8)
268#define SD_CMD_SEND_CSD ((uint8_t)9)
269#define SD_CMD_SEND_CID ((uint8_t)10)
270#define SD_CMD_READ_DAT_UNTIL_STOP ((uint8_t)11)
271#define SD_CMD_STOP_TRANSMISSION ((uint8_t)12)
272#define SD_CMD_SEND_STATUS ((uint8_t)13)
273#define SD_CMD_HS_BUSTEST_READ ((uint8_t)14)
274#define SD_CMD_GO_INACTIVE_STATE ((uint8_t)15)
275#define SD_CMD_SET_BLOCKLEN ((uint8_t)16)
276#define SD_CMD_READ_SINGLE_BLOCK ((uint8_t)17)
277#define SD_CMD_READ_MULT_BLOCK ((uint8_t)18)
278#define SD_CMD_HS_BUSTEST_WRITE ((uint8_t)19)
279#define SD_CMD_WRITE_DAT_UNTIL_STOP ((uint8_t)20)
280#define SD_CMD_SET_BLOCK_COUNT ((uint8_t)23)
281#define SD_CMD_WRITE_SINGLE_BLOCK ((uint8_t)24)
282#define SD_CMD_WRITE_MULT_BLOCK ((uint8_t)25)
283#define SD_CMD_PROG_CID ((uint8_t)26)
284#define SD_CMD_PROG_CSD ((uint8_t)27)
285#define SD_CMD_SET_WRITE_PROT ((uint8_t)28)
286#define SD_CMD_CLR_WRITE_PROT ((uint8_t)29)
287#define SD_CMD_SEND_WRITE_PROT ((uint8_t)30)
288#define SD_CMD_SD_ERASE_GRP_START ((uint8_t)32)
289#define SD_CMD_SD_ERASE_GRP_END ((uint8_t)33)
290#define SD_CMD_ERASE_GRP_START ((uint8_t)35)
291#define SD_CMD_ERASE_GRP_END ((uint8_t)36)
292#define SD_CMD_ERASE ((uint8_t)38)
293#define SD_CMD_FAST_IO ((uint8_t)39)
294#define SD_CMD_GO_IRQ_STATE ((uint8_t)40)
295#define SD_CMD_LOCK_UNLOCK ((uint8_t)42)
296#define SD_CMD_APP_CMD ((uint8_t)55)
297#define SD_CMD_GEN_CMD ((uint8_t)56)
298#define SD_CMD_NO_CMD ((uint8_t)64)
299
304#define SD_CMD_APP_SD_SET_BUSWIDTH ((uint8_t)6)
305#define SD_CMD_SD_APP_STAUS ((uint8_t)13)
306#define SD_CMD_SD_APP_SEND_NUM_WRITE_BLOCKS ((uint8_t)22)
307#define SD_CMD_SD_APP_OP_COND ((uint8_t)41)
308#define SD_CMD_SD_APP_SET_CLR_CARD_DETECT ((uint8_t)42)
309#define SD_CMD_SD_APP_SEND_SCR ((uint8_t)51)
310#define SD_CMD_SDIO_RW_DIRECT ((uint8_t)52)
311#define SD_CMD_SDIO_RW_EXTENDED ((uint8_t)53)
312
317#define SD_CMD_SD_APP_GET_MKB ((uint8_t)43)
318#define SD_CMD_SD_APP_GET_MID ((uint8_t)44)
319#define SD_CMD_SD_APP_SET_CER_RN1 ((uint8_t)45)
320#define SD_CMD_SD_APP_GET_CER_RN2 ((uint8_t)46)
321#define SD_CMD_SD_APP_SET_CER_RES2 ((uint8_t)47)
322#define SD_CMD_SD_APP_GET_CER_RES1 ((uint8_t)48)
323#define SD_CMD_SD_APP_SECURE_READ_MULTIPLE_BLOCK ((uint8_t)18)
324#define SD_CMD_SD_APP_SECURE_WRITE_MULTIPLE_BLOCK ((uint8_t)25)
325#define SD_CMD_SD_APP_SECURE_ERASE ((uint8_t)38)
326#define SD_CMD_SD_APP_CHANGE_SECURE_AREA ((uint8_t)49)
327#define SD_CMD_SD_APP_SECURE_WRITE_MKB ((uint8_t)48)
328
340#define NULL 0
341#define SDIO_STATIC_FLAGS ((uint32_t)0x000005FF)
342#define SDIO_CMD0TIMEOUT ((uint32_t)0x00010000)
343#define SDIO_DATATIMEOUT ((uint32_t)0xFFFFFFFF)
344
356#define SD_OCR_ADDR_OUT_OF_RANGE ((uint32_t)0x80000000)
357#define SD_OCR_ADDR_MISALIGNED ((uint32_t)0x40000000)
358#define SD_OCR_BLK_LEN_ERR ((uint32_t)0x20000000)
359#define SD_OCR_ERASE_SEQ_ERR ((uint32_t)0x10000000)
360#define SD_OCR_INVALID_ERASE_PARAM ((uint32_t)0x08000000)
361#define SD_OCR_WR_PROTECT_VIOLATION ((uint32_t)0x04000000)
362#define SD_OCR_LOCK_UNLOCK_ERROR ((uint32_t)0x01000000)
363#define SD_OCR_CMD_CRC_ERROR ((uint32_t)0x00800000)
364#define SD_OCR_ILLEGAL_CMD ((uint32_t)0x00400000)
365#define SD_OCR_CARD_ECC_ERROR ((uint32_t)0x00200000)
366#define SD_OCR_CARD_CONTROLLER_ERR ((uint32_t)0x00100000)
367#define SD_OCR_GENERAL_UNKNOWN_ERROR ((uint32_t)0x00080000)
368#define SD_OCR_STREAM_RD_UNDERRUN ((uint32_t)0x00040000)
369#define SD_OCR_STREAM_WR_OVERRUN ((uint32_t)0x00020000)
370#define SD_OCR_CID_CSD_OVERWRIETE ((uint32_t)0x00010000)
371#define SD_OCR_WP_ERASE_SKIP ((uint32_t)0x00008000)
372#define SD_OCR_CARD_ECC_DISABLED ((uint32_t)0x00004000)
373#define SD_OCR_ERASE_RESET ((uint32_t)0x00002000)
374#define MMC_SWITCH_ERROR ((uint32_t)0x00000080)
375#define SD_OCR_AKE_SEQ_ERROR ((uint32_t)0x00000008)
376#define SD_OCR_ERRORBITS ((uint32_t)0xFDFFE008)
377
381#define SD_R5_OUT_OF_RANGE ((uint32_t)0x00000100)
382#define SD_R5_FUNCTION_NUMBER ((uint32_t)0x00000200)
383#define SD_R5_ERROR ((uint32_t)0x00000800)
384
388#define SD_R6_GENERAL_UNKNOWN_ERROR ((uint32_t)0x00002000)
389#define SD_R6_ILLEGAL_CMD ((uint32_t)0x00004000)
390#define SD_R6_CMD_CRC_ERROR ((uint32_t)0x00008000)
391#define SD_VOLTAGE_WINDOW_SD ((uint32_t)0x80100000)
392#define SD_HIGH_CAPACITY ((uint32_t)0x40000000)
393#define SD_STD_CAPACITY ((uint32_t)0x00000000)
394#define SD_CHECK_PATTERN ((uint32_t)0x000001AA)
395#define SD_VOLTAGE_WINDOW_MMC ((uint32_t)0x40FF8000)
396#define SD_MAX_VOLT_TRIAL ((uint32_t)0x000000FF)
397#define SD_ALLZERO ((uint32_t)0x00000000)
398#define SD_WIDE_BUS_SUPPORT ((uint32_t)0x00040000)
399#define SD_SINGLE_BUS_SUPPORT ((uint32_t)0x00010000)
400#define SD_CARD_LOCKED ((uint32_t)0x02000000)
401#define SD_CARD_PROGRAMMING ((uint32_t)0x00000007)
402#define SD_CARD_RECEIVING ((uint32_t)0x00000006)
403#define SD_DATATIMEOUT ((uint32_t)0xFFFFFFFF)
404#define SD_0TO7BITS ((uint32_t)0x000000FF)
405#define SD_8TO15BITS ((uint32_t)0x0000FF00)
406#define SD_16TO23BITS ((uint32_t)0x00FF0000)
407#define SD_24TO31BITS ((uint32_t)0xFF000000)
408#define SD_MAX_DATA_LENGTH ((uint32_t)0x01FFFFFF)
409#define SD_HALFFIFO ((uint32_t)0x00000008)
410#define SD_HALFFIFOBYTES ((uint32_t)0x00000020)
411
423#define SD_CCCC_LOCK_UNLOCK ((uint32_t)0x00000080)
424#define SD_CCCC_WRITE_PROT ((uint32_t)0x00000040)
425#define SD_CCCC_ERASE ((uint32_t)0x00000020)
426
438#define SDIO_SEND_IF_COND ((uint32_t)0x00000008)
439
451#define EXT_CSD_Command_set 0x0
452#define EXT_CSD_Set_bit 0x1
453#define EXT_CSD_Clear_byte 0x2
454#define EXT_CSD_Write_byte 0x3
455
456#define EXT_CSD_CMD_SET_NORMAL (1<<0)
457#define EXT_CSD_CMD_SET_SECURE (1<<1)
458#define EXT_CSD_CMD_SET_CPSECURE (1<<2)
459
463#define EXT_CSD_BUS_WIDTH 183
464#define EXT_CSD_HS_TIMING 185
465
474#define SDIO_INTR_STS_WRITE_MASK (SDIO_DTFAIL_FLAG | SDIO_DTTIMEOUT_FLAG | SDIO_TXERRU_FLAG | \
475 SDIO_DTCMPL_FLAG | SDIO_SBITERR_FLAG)
476#define SDIO_INTR_STS_READ_MASK (SDIO_DTFAIL_FLAG | SDIO_DTTIMEOUT_FLAG | SDIO_RXERRO_FLAG | \
477 SDIO_DTCMPL_FLAG | SDIO_SBITERR_FLAG)
486/* sd exported functions ----------------------------------------*/
487 sd_error_status_type sd_init(void);
488void sdio_clock_set(uint32_t clkdiv);
489 sd_error_status_type sd_power_on(void);
490 sd_error_status_type sd_power_off(void);
491 sd_error_status_type sd_card_init(void);
492 sd_error_status_type sd_card_info_get(sd_card_info_struct_type *card_info);
493 sd_error_status_type sd_wide_bus_operation_config(sdio_bus_width_type mode);
494 sd_error_status_type sd_device_mode_set(uint32_t mode);
495 sd_error_status_type sd_deselect_select(uint32_t addr);
496 sd_error_status_type sd_status_send(uint32_t *p_card_status);
497 sd_card_state_type sd_state_get(void);
498 sd_error_status_type sd_blocks_erase(long long addr, uint32_t nblks);
499 sd_error_status_type sd_block_read(uint8_t *buf, long long addr, uint16_t blk_size);
500 sd_error_status_type sd_mult_blocks_read(uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks);
501 sd_error_status_type sd_block_write(const uint8_t *buf, long long addr, uint16_t blk_size);
502 sd_error_status_type sd_mult_blocks_write(const uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks);
503 sd_error_status_type mmc_stream_read(uint8_t *buf, long long addr, uint32_t len);
504 sd_error_status_type mmc_stream_write(uint8_t *buf, long long addr, uint32_t len);
505 sd_error_status_type sd_irq_service(void);
506void sd_dma_config(uint32_t *mbuf, uint32_t buf_size, dma_dir_type dir);
507
520#ifdef __cplusplus
521}
522#endif
523
524#endif /* __AT32_SDIO_H */
at32f413.h
at32f413 header file
card_type
static sd_memory_card_type card_type
Definition emmc_card/src/at32_sdio.c:41
rca
static uint32_t rca
Definition emmc_card/src/at32_sdio.c:42
dma_dir_type
dma_dir_type
dma direction type
Definition at32f413_dma.h:215
sd_power_off
sd_error_status_type sd_power_off(void)
turns the sdio output signals off.
Definition emmc_card/src/at32_sdio.c:425
sd_irq_service
sd_error_status_type sd_irq_service(void)
allows to process all the interrupts that are high.
Definition emmc_card/src/at32_sdio.c:1811
sd_device_mode_set
sd_error_status_type sd_device_mode_set(uint32_t mode)
set sdio work mode.
Definition emmc_card/src/at32_sdio.c:808
sd_card_info_get
sd_error_status_type sd_card_info_get(sd_card_info_struct_type *card_info)
returns information about specific card.
Definition emmc_card/src/at32_sdio.c:554
mmc_stream_write
sd_error_status_type mmc_stream_write(uint8_t *buf, long long addr, uint32_t len)
write mmc card data stream.
Definition emmc_card/src/at32_sdio.c:1722
sd_card_init
sd_error_status_type sd_card_init(void)
intialises all cards or single card as the case may be card(s) come into standby state.
Definition emmc_card/src/at32_sdio.c:439
sd_block_read
sd_error_status_type sd_block_read(uint8_t *buf, long long addr, uint16_t blk_size)
allows to read one block from a specified address in a card. the data transfer can be managed by dma ...
Definition emmc_card/src/at32_sdio.c:1210
sd_deselect_select
sd_error_status_type sd_deselect_select(uint32_t addr)
selects od deselects the corresponding card.
Definition emmc_card/src/at32_sdio.c:829
sdio_clock_set
void sdio_clock_set(uint32_t clkdiv)
set sdio clock devision factor.
Definition emmc_card/src/at32_sdio.c:209
sd_blocks_erase
sd_error_status_type sd_blocks_erase(long long addr, uint32_t nblks)
erase continuous data block
Definition emmc_card/src/at32_sdio.c:1052
sd_mult_blocks_write
sd_error_status_type sd_mult_blocks_write(const uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks)
allows to write blocks starting from a specified address in a card. the data transfer can be managed ...
Definition emmc_card/src/at32_sdio.c:1511
sd_state_get
sd_card_state_type sd_state_get(void)
returns information about sd card.
Definition emmc_card/src/at32_sdio.c:2511
sd_dma_config
void sd_dma_config(uint32_t *mbuf, uint32_t buf_size, dma_dir_type dir)
set dma configuation for sdio
Definition emmc_card/src/at32_sdio.c:2799
sd_block_write
sd_error_status_type sd_block_write(const uint8_t *buf, long long addr, uint16_t blk_size)
allows to write one block starting from a specified address in a card. the data transfer can be manag...
Definition emmc_card/src/at32_sdio.c:1389
sd_status_send
sd_error_status_type sd_status_send(uint32_t *p_card_status)
read current card status.
Definition emmc_card/src/at32_sdio.c:2474
sd_init
sd_error_status_type sd_init(void)
initializes the sd card and put it into standby state (ready for data transfer).
Definition emmc_card/src/at32_sdio.c:73
mmc_stream_read
sd_error_status_type mmc_stream_read(uint8_t *buf, long long addr, uint32_t len)
read mmc card data stream.
Definition emmc_card/src/at32_sdio.c:1675
sd_power_on
sd_error_status_type sd_power_on(void)
enquires cards about their operating voltage and configures clock controls.
Definition emmc_card/src/at32_sdio.c:224
sd_mult_blocks_read
sd_error_status_type sd_mult_blocks_read(uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks)
allows to read blocks from a specified address in a card. the data transfer can be managed by dma mod...
Definition emmc_card/src/at32_sdio.c:1299
sd_wide_bus_operation_config
sd_error_status_type sd_wide_bus_operation_config(sdio_bus_width_type mode)
enable wide bus opeartion for the requeseted card if supported by card.
Definition emmc_card/src/at32_sdio.c:765
sd_card_info
sd_card_info_struct_type sd_card_info
Definition emmc_card/src/at32_sdio.c:48
sd_data_transfer_mode_type
sd_data_transfer_mode_type
Definition sdio_fatfs/inc/at32_sdio.h:64
sd_error_status_type
sd_error_status_type
Definition sdio_fatfs/inc/at32_sdio.h:73
sd_card_state_type
sd_card_state_type
Definition sdio_fatfs/inc/at32_sdio.h:186
sdio_bus_width_type
sdio_bus_width_type
sdio bus width
Definition at32f413_sdio.h:138
sd_memory_card_type
sd_memory_card_type
Definition sdio_fatfs/inc/at32_sdio.h:202
SD_TRANSFER_DMA_MODE
@ SD_TRANSFER_DMA_MODE
Definition sdio_fatfs/inc/at32_sdio.h:66
SD_TRANSFER_POLLING_MODE
@ SD_TRANSFER_POLLING_MODE
Definition sdio_fatfs/inc/at32_sdio.h:65
SD_ERROR
@ SD_ERROR
Definition sdio_fatfs/inc/at32_sdio.h:117
SD_WP_ERASE_SKIP
@ SD_WP_ERASE_SKIP
Definition sdio_fatfs/inc/at32_sdio.h:97
SD_SDIO_UNKNOWN_FUNC
@ SD_SDIO_UNKNOWN_FUNC
Definition sdio_fatfs/inc/at32_sdio.h:107
SD_DATA_FAIL
@ SD_DATA_FAIL
Definition sdio_fatfs/inc/at32_sdio.h:76
SD_STREAM_WR_OVERRUN
@ SD_STREAM_WR_OVERRUN
Definition sdio_fatfs/inc/at32_sdio.h:95
SD_INVALID_PARAMETER
@ SD_INVALID_PARAMETER
Definition sdio_fatfs/inc/at32_sdio.h:114
SD_CMD_FAIL
@ SD_CMD_FAIL
Definition sdio_fatfs/inc/at32_sdio.h:75
SD_CMD_OUT_OF_RANGE
@ SD_CMD_OUT_OF_RANGE
Definition sdio_fatfs/inc/at32_sdio.h:82
SD_UNSUPPORTED_HW
@ SD_UNSUPPORTED_HW
Definition sdio_fatfs/inc/at32_sdio.h:116
SD_SDIO_FUNC_ERROR
@ SD_SDIO_FUNC_ERROR
Definition sdio_fatfs/inc/at32_sdio.h:106
SD_INTERNAL_ERROR
@ SD_INTERNAL_ERROR
Definition sdio_fatfs/inc/at32_sdio.h:110
SD_INVALID_ERASE_PARAM
@ SD_INVALID_ERASE_PARAM
Definition sdio_fatfs/inc/at32_sdio.h:86
SD_GENERAL_UNKNOWN_ERROR
@ SD_GENERAL_UNKNOWN_ERROR
Definition sdio_fatfs/inc/at32_sdio.h:93
SD_CARD_ECC_DISABLED
@ SD_CARD_ECC_DISABLED
Definition sdio_fatfs/inc/at32_sdio.h:98
SD_CARD_CONTROLLER_ERR
@ SD_CARD_CONTROLLER_ERR
Definition sdio_fatfs/inc/at32_sdio.h:92
SD_ERASE_RESET
@ SD_ERASE_RESET
Definition sdio_fatfs/inc/at32_sdio.h:99
SD_CARD_ECC_ERROR
@ SD_CARD_ECC_ERROR
Definition sdio_fatfs/inc/at32_sdio.h:91
SD_STREAM_RD_UNDERRUN
@ SD_STREAM_RD_UNDERRUN
Definition sdio_fatfs/inc/at32_sdio.h:94
SD_UNSUPPORTED_FEATURE
@ SD_UNSUPPORTED_FEATURE
Definition sdio_fatfs/inc/at32_sdio.h:115
SD_TX_UNDERRUN
@ SD_TX_UNDERRUN
Definition sdio_fatfs/inc/at32_sdio.h:79
SD_ILLEGAL_CMD
@ SD_ILLEGAL_CMD
Definition sdio_fatfs/inc/at32_sdio.h:90
SD_SDIO_FUNC_BUSY
@ SD_SDIO_FUNC_BUSY
Definition sdio_fatfs/inc/at32_sdio.h:105
SD_CMD_CRC_ERROR
@ SD_CMD_CRC_ERROR
Definition sdio_fatfs/inc/at32_sdio.h:89
SD_ADDR_OUT_OF_RANGE
@ SD_ADDR_OUT_OF_RANGE
Definition sdio_fatfs/inc/at32_sdio.h:102
SD_RX_OVERRUN
@ SD_RX_OVERRUN
Definition sdio_fatfs/inc/at32_sdio.h:80
SD_REQ_PENDING
@ SD_REQ_PENDING
Definition sdio_fatfs/inc/at32_sdio.h:112
SD_REQ_NOT_APPLICABLE
@ SD_REQ_NOT_APPLICABLE
Definition sdio_fatfs/inc/at32_sdio.h:113
SD_SWITCH_ERROR
@ SD_SWITCH_ERROR
Definition sdio_fatfs/inc/at32_sdio.h:103
SD_INVALID_VOLTRANGE
@ SD_INVALID_VOLTRANGE
Definition sdio_fatfs/inc/at32_sdio.h:101
SD_SDIO_DISABLED
@ SD_SDIO_DISABLED
Definition sdio_fatfs/inc/at32_sdio.h:104
SD_DATA_TIMEOUT
@ SD_DATA_TIMEOUT
Definition sdio_fatfs/inc/at32_sdio.h:78
SD_ADDR_MISALIGNED
@ SD_ADDR_MISALIGNED
Definition sdio_fatfs/inc/at32_sdio.h:83
SD_START_BIT_ERR
@ SD_START_BIT_ERR
Definition sdio_fatfs/inc/at32_sdio.h:81
SD_LOCK_UNLOCK_ERROR
@ SD_LOCK_UNLOCK_ERROR
Definition sdio_fatfs/inc/at32_sdio.h:88
SD_NOT_CONFIGURED
@ SD_NOT_CONFIGURED
Definition sdio_fatfs/inc/at32_sdio.h:111
SD_CID_CSD_OVERWRITE
@ SD_CID_CSD_OVERWRITE
Definition sdio_fatfs/inc/at32_sdio.h:96
SD_WR_PROTECT_VIOLATION
@ SD_WR_PROTECT_VIOLATION
Definition sdio_fatfs/inc/at32_sdio.h:87
SD_CMD_RSP_TIMEOUT
@ SD_CMD_RSP_TIMEOUT
Definition sdio_fatfs/inc/at32_sdio.h:77
SD_BLK_LEN_ERR
@ SD_BLK_LEN_ERR
Definition sdio_fatfs/inc/at32_sdio.h:84
SD_OK
@ SD_OK
Definition sdio_fatfs/inc/at32_sdio.h:118
SD_ERASE_SEQ_ERR
@ SD_ERASE_SEQ_ERR
Definition sdio_fatfs/inc/at32_sdio.h:85
SD_AKE_SEQ_ERROR
@ SD_AKE_SEQ_ERROR
Definition sdio_fatfs/inc/at32_sdio.h:100
SD_CARD_TRANSFER
@ SD_CARD_TRANSFER
Definition sdio_fatfs/inc/at32_sdio.h:190
SD_CARD_IDENTIFICATION
@ SD_CARD_IDENTIFICATION
Definition sdio_fatfs/inc/at32_sdio.h:188
SD_CARD_SENDING
@ SD_CARD_SENDING
Definition sdio_fatfs/inc/at32_sdio.h:191
SD_CARD_STANDBY
@ SD_CARD_STANDBY
Definition sdio_fatfs/inc/at32_sdio.h:189
SD_CARD_READY
@ SD_CARD_READY
Definition sdio_fatfs/inc/at32_sdio.h:187
SD_CARD_DISCONNECTED
@ SD_CARD_DISCONNECTED
Definition sdio_fatfs/inc/at32_sdio.h:194
SD_CARD_ERROR
@ SD_CARD_ERROR
Definition sdio_fatfs/inc/at32_sdio.h:195
SDIO_SDIO_CARD
@ SDIO_SDIO_CARD
Definition sdio_fatfs/inc/at32_sdio.h:211
SDIO_HIGH_CAPACITY_SD_CARD
@ SDIO_HIGH_CAPACITY_SD_CARD
Definition sdio_fatfs/inc/at32_sdio.h:205
SDIO_SECURE_DIGITAL_IO_COMBO_CARD
@ SDIO_SECURE_DIGITAL_IO_COMBO_CARD
Definition sdio_fatfs/inc/at32_sdio.h:209
SDIO_HIGH_SPEED_MULTIMEDIA_CARD
@ SDIO_HIGH_SPEED_MULTIMEDIA_CARD
Definition sdio_fatfs/inc/at32_sdio.h:208
SDIO_STD_CAPACITY_SD_CARD_V1_1
@ SDIO_STD_CAPACITY_SD_CARD_V1_1
Definition sdio_fatfs/inc/at32_sdio.h:203
SDIO_SECURE_DIGITAL_IO_CARD
@ SDIO_SECURE_DIGITAL_IO_CARD
Definition sdio_fatfs/inc/at32_sdio.h:207
SDIO_STD_CAPACITY_SD_CARD_V2_0
@ SDIO_STD_CAPACITY_SD_CARD_V2_0
Definition sdio_fatfs/inc/at32_sdio.h:204
SDIO_MULTIMEDIA_CARD
@ SDIO_MULTIMEDIA_CARD
Definition sdio_fatfs/inc/at32_sdio.h:206
SDIO_HIGH_CAPACITY_MMC_CARD
@ SDIO_HIGH_CAPACITY_MMC_CARD
Definition sdio_fatfs/inc/at32_sdio.h:210
SD_CARD_RECEIVING
#define SD_CARD_RECEIVING
Definition sdio_fatfs/inc/at32_sdio.h:402
SD_CARD_PROGRAMMING
#define SD_CARD_PROGRAMMING
Definition sdio_fatfs/inc/at32_sdio.h:401
sd_card_info_struct_type
Definition emmc_card/inc/at32_sdio.h:236
sd_cid_struct_type
Definition emmc_card/inc/at32_sdio.h:169
sd_csd_struct_type
Definition emmc_card/inc/at32_sdio.h:125
sd_scr_struct_type
Definition emmc_card/inc/at32_sdio.h:218


AT32F413 Firmwary Library: at32_sdio.c Source File

  • sdio
  • sdio_fatfs
  • src
sdio_fatfs/src/at32_sdio.c
Go to the documentation of this file.
1
27#include <string.h>
28#include "at32_sdio.h"
29#include "at32f413_board.h"
30
39 sdio_command_struct_type sdio_command_init_struct;
40 sdio_data_struct_type sdio_data_init_struct;
41
42static sd_memory_card_type card_type = SDIO_STD_CAPACITY_SD_CARD_V1_1; /* sd card type */
43static uint32_t csd_table[4], cid_table[4], rca = 0; /* csd, sid, rca */
44static uint32_t ext_csd_table[128];
45static sd_data_transfer_mode_type device_mode = SD_TRANSFER_POLLING_MODE; /* working mode */
46static uint8_t stop_flag = 0; /* transmit stop flag */
47volatile sd_error_status_type transfer_error = SD_OK; /* transmit error flag */
48volatile uint8_t transfer_end = 0; /* transmit end flag */
49 sd_card_info_struct_type sd_card_info; /* sd card information */
50
51 sd_error_status_type command_error(void);
52 sd_error_status_type command_rsp1_error(uint8_t cmd);
53 sd_error_status_type command_rsp2_error(void);
54 sd_error_status_type command_rsp3_error(void);
55 sd_error_status_type command_rsp4_error(uint8_t cmd);
56 sd_error_status_type command_rsp5_error(uint8_t cmd);
57 sd_error_status_type command_rsp6_error(uint8_t cmd, uint16_t *p_rca);
58 sd_error_status_type command_rsp7_error(void);
59 sd_error_status_type sd_bus_wide_enable(confirm_state new_state);
60 sd_error_status_type mmc_switch(uint8_t set, uint8_t index, uint8_t value);
61 sd_error_status_type sd_switch(uint32_t mode, uint32_t group, uint8_t value, uint8_t *rsp);
62 sd_error_status_type check_card_programming(uint8_t *p_status);
63 sd_error_status_type speed_change(uint8_t speed);
64 sd_error_status_type get_ext_csd(void);
65 sd_error_status_type scr_find(void);
66uint8_t convert_from_bytes_to_power_of_two(uint16_t number_of_bytes);
67
74 sd_error_status_type sd_init(void)
75{
76 uint16_t clkdiv = 0;
77 sd_error_status_type status = SD_OK;
78 gpio_init_type gpio_init_struct = {0};
79 uint8_t retry = 0;
80
81 /* gpioc and gpiod periph clock enable */
82 crm_periph_clock_enable(CRM_GPIOC_PERIPH_CLOCK, TRUE);
83 crm_periph_clock_enable(CRM_GPIOD_PERIPH_CLOCK, TRUE);
84
85 /* sdio periph clock enable */
86 crm_periph_clock_enable(CRM_SDIO1_PERIPH_CLOCK, TRUE);
87
88 /* configure pc.08, pc.09, pc.10, pc.11, pc.12 pin: d0, d1, d2, d3, clk pin */
89 gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
90 gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
91 gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
92 gpio_init_struct.gpio_pins = GPIO_PINS_8 | GPIO_PINS_9 | GPIO_PINS_10 | GPIO_PINS_11 | GPIO_PINS_12;
93 gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
94 gpio_init(GPIOC, &gpio_init_struct);
95
96 /* configure pd.02 cmd line */
97 gpio_init_struct.gpio_pins = GPIO_PINS_2;
98 gpio_init(GPIOD, &gpio_init_struct);
99
100 retry = 3;
101 while(retry--){
102 /* reset sdio */
103 sdio_reset(SDIOx);
104 /* power on */
105 status = sd_power_on();
106
107 if(status == SD_OK)
108 break;
109 }
110
111 if(status == SD_OK)
112 {
113 /* sdio card initialize */
114 status = sd_card_init();
115 }
116
117 if(status == SD_OK)
118 {
119 /* get card information*/
120 status = sd_card_info_get(&sd_card_info);
121 }
122
123 if((SDIO_MULTIMEDIA_CARD == card_type) && (sd_card_info.sd_csd_reg.spec_version >= 4))
124 {
125 card_type = SDIO_HIGH_SPEED_MULTIMEDIA_CARD;
126 sd_card_info.card_type = (uint8_t)card_type;
127 }
128
129 if(status == SD_OK)
130 {
131 /* select card */
132 status = sd_deselect_select((uint32_t)(sd_card_info.rca << 16));
133 }
134
135 if(status == SD_OK)
136 {
137 if(SDIO_HIGH_SPEED_MULTIMEDIA_CARD == card_type)
138 {
139 if(sd_card_info.sd_csd_reg.device_size == 0xFFF)
140 {
141 uint32_t sec_count;
142 /* get ext_csd function for support emmc card. */
143 status = get_ext_csd();
144 if(status == SD_OK)
145 {
146 card_type = SDIO_HIGH_CAPACITY_MMC_CARD;
147 sd_card_info.card_type = (uint8_t)card_type;
148 sec_count = ext_csd_table[212/4];
149 sd_card_info.card_capacity = (uint64_t)sec_count*512;
150 }
151 }
152 }
153 }
154
155 if(status == SD_OK && ((SDIO_STD_CAPACITY_SD_CARD_V1_1 == card_type) || (SDIO_STD_CAPACITY_SD_CARD_V2_0 == card_type) || \
156 (SDIO_SECURE_DIGITAL_IO_COMBO_CARD == card_type) || (SDIO_HIGH_CAPACITY_SD_CARD == card_type)))
157 {
158 status = scr_find();
159 }
160
161 if(status == SD_OK)
162 {
163 /* set normal speed */
164 status = speed_change(0);
165 }
166
167 if((status == SD_OK) || (card_type == SDIO_MULTIMEDIA_CARD))
168 {
169 if(sd_card_info.card_type == SDIO_STD_CAPACITY_SD_CARD_V1_1 || sd_card_info.card_type == SDIO_STD_CAPACITY_SD_CARD_V2_0)
170 {
171 /* set sdio_ck to 12mhz */
172 clkdiv = system_core_clock / 12000000;
173
174 if(clkdiv >= 2)
175 {
176 clkdiv -= 2;
177 }
178 }
179 else
180 {
181 /* set sdio_ck to 25mhz */
182 clkdiv = system_core_clock / 25000000;
183
184 if(clkdiv >= 2)
185 {
186 clkdiv -= 2;
187 }
188 }
189 /* set sdio clock divider */
190 sdio_clock_set(clkdiv);
191
192 /* set transfer mode */
193 status = sd_device_mode_set(SD_TRANSFER_DMA_MODE);
194 }
195
196 if(status == SD_OK)
197 {
198 /* Set data width */
199 status = sd_wide_bus_operation_config(SDIO_BUS_WIDTH_D4);
200 }
201
202 return status;
203}
204
210void sdio_clock_set(uint32_t clk_div)
211{
212 /* config clock divide [7:0] */
213 SDIOx->clkctrl_bit.clkdiv_l = (clk_div & 0xFF);
214
215 /* config clock divide [9:8] */
216 SDIOx->clkctrl_bit.clkdiv_h = ((clk_div & 0x300) >> 8);
217}
218
225 sd_error_status_type sd_power_on(void)
226{
227 uint8_t retry = 0;
228 sd_error_status_type status = SD_OK;
229 uint32_t response = 0, count = 0, valid_voltage = 0, clk_psc;
230 uint32_t sd_type = SD_STD_CAPACITY;
231
232 /* sdio_ck is less than 400KHz in initialization stage, set to 200KHz */
233 clk_psc = (system_core_clock / 200000) - 2;
234
235 if(clk_psc > 0x3FF)
236 {
237 clk_psc = 0x3FF;
238 }
239
240 /* config sdio clock divide and edge phase */
241 sdio_clock_config(SDIOx, clk_psc, SDIO_CLOCK_EDGE_FALLING);
242 /* config sdio bus width */
243 sdio_bus_width_config(SDIOx, SDIO_BUS_WIDTH_D1);
244 /* disable flow control */
245 sdio_flow_control_enable(SDIOx, FALSE);
246 /* disable clock bypass */
247 sdio_clock_bypass(SDIOx, FALSE);
248 /* disable power saving mode */
249 sdio_power_saving_mode_enable(SDIOx, FALSE);
250
251 /* sdio power on */
252 sdio_power_set(SDIOx, SDIO_POWER_ON);
253 /* enable to output sdio_ck */
254 sdio_clock_enable(SDIOx, TRUE);
255 delay_ms(10);
256
257 for(retry = 0; retry < 5; retry++)
258 {
259 /* send cmd0, get in idle stage */
260 sdio_command_init_struct.argument = 0x0;
261 sdio_command_init_struct.cmd_index = SD_CMD_GO_IDLE_STATE;
262 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_NO;
263 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
264
265 /* sdio command config */
266 sdio_command_config(SDIOx, &sdio_command_init_struct);
267 /* enable ccsm */
268 sdio_command_state_machine_enable(SDIOx, TRUE);
269
270 /* get command status */
271 status = command_error();
272 }
273
274 /* send cmd8, check card interface feature */
275 sdio_command_init_struct.argument = SD_CHECK_PATTERN;
276 sdio_command_init_struct.cmd_index = SDIO_SEND_IF_COND;
277 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
278 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
279
280 /* sdio command config */
281 sdio_command_config(SDIOx, &sdio_command_init_struct);
282 /* enable ccsm */
283 sdio_command_state_machine_enable(SDIOx, TRUE);
284
285 /* waiting R7 */
286 status = command_rsp7_error();
287
288 if(status == SD_OK)
289 {
290 /* set card type and sd type */
291 card_type = SDIO_STD_CAPACITY_SD_CARD_V2_0;
292 sd_type = SD_HIGH_CAPACITY;
293 }
294
295 /* send cmd55, check sd version */
296 sdio_command_init_struct.argument = 0x00;
297 sdio_command_init_struct.cmd_index = SD_CMD_APP_CMD;
298 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
299 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
300
301 /* sdio command config */
302 sdio_command_config(SDIOx, &sdio_command_init_struct);
303 /* enable ccsm */
304 sdio_command_state_machine_enable(SDIOx, TRUE);
305
306 /* waiting R1 */
307 status = command_rsp1_error(SD_CMD_APP_CMD);
308
309 /* check sd card or mmc card */
310 if(SD_OK == status)
311 {
312 /* send acmd41, check voltage operation range */
313 while((!valid_voltage) && (count < SD_MAX_VOLT_TRIAL))
314 {
315 delay_ms(10);
316
317 /* send cmd55 before acmd41 */
318 sdio_command_init_struct.argument = 0x00;
319 sdio_command_init_struct.cmd_index = SD_CMD_APP_CMD;
320 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
321 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
322
323 /* sdio command config */
324 sdio_command_config(SDIOx, &sdio_command_init_struct);
325 /* enable ccsm */
326 sdio_command_state_machine_enable(SDIOx, TRUE);
327
328 /* waiting R1 */
329 status = command_rsp1_error(SD_CMD_APP_CMD);
330
331 /* if any errors occured, return status */
332 if(status != SD_OK)
333 {
334 return status;
335 }
336
337 /* send acmd41 */
338 sdio_command_init_struct.argument = SD_VOLTAGE_WINDOW_SD | sd_type;
339 sdio_command_init_struct.cmd_index = SD_CMD_SD_APP_OP_COND;
340 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
341 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
342
343 /* sdio command config */
344 sdio_command_config(SDIOx, &sdio_command_init_struct);
345 /* enable ccsm */
346 sdio_command_state_machine_enable(SDIOx, TRUE);
347
348 /* waiting R3 */
349 status = command_rsp3_error();
350
351 /* if any errors occured, return status */
352 if(status != SD_OK)
353 {
354 return status;
355 }
356
357 /* get response1 */
358 response = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
359
360 /* check sd card power on stage is success or not */
361 valid_voltage = (((response >> 31) == 1) ? 1 : 0);
362 count++;
363 }
364
365 if(count >= SD_MAX_VOLT_TRIAL)
366 {
367 status = SD_INVALID_VOLTRANGE;
368 return status;
369 }
370
371 if(response &= SD_HIGH_CAPACITY)
372 {
373 card_type = SDIO_HIGH_CAPACITY_SD_CARD;
374 }
375 }
376 /* mmc card */
377 else
378 {
379 /* send cmd1 */
380 while((!valid_voltage) && (count < SD_MAX_VOLT_TRIAL))
381 {
382 delay_ms(10);
383
384 sdio_command_init_struct.argument = SD_VOLTAGE_WINDOW_MMC;
385 sdio_command_init_struct.cmd_index = SD_CMD_SEND_OP_COND;
386 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
387 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
388
389 /* sdio command config */
390 sdio_command_config(SDIOx, &sdio_command_init_struct);
391 /* enable ccsm */
392 sdio_command_state_machine_enable(SDIOx, TRUE);
393
394 /* waiting R3 */
395 status = command_rsp3_error();
396
397 if(status != SD_OK)
398 {
399 return status;
400 }
401
402 /* get response1 */
403 response = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
404
405 valid_voltage = (((response >> 31) == 1) ? 1 : 0);
406 count++;
407 }
408
409 if(count >= SD_MAX_VOLT_TRIAL)
410 {
411 status = SD_INVALID_VOLTRANGE;
412 return status;
413 }
414
415 card_type = SDIO_MULTIMEDIA_CARD;
416 }
417
418 return(status);
419}
420
426 sd_error_status_type sd_power_off(void)
427{
428 /* sdio power off */
429 sdio_power_set(SDIOx, SDIO_POWER_OFF);
430
431 return SD_OK;
432}
433
440 sd_error_status_type sd_card_init(void)
441{
442 sd_error_status_type status = SD_OK;
443 uint16_t rca_temp = 0x01;
444
445 /* check power status */
446 if(SDIO_POWER_OFF == sdio_power_status_get(SDIOx))
447 {
448 return SD_REQ_NOT_APPLICABLE;
449 }
450
451 /* check is secure_digital_io_card or not */
452 if(SDIO_SECURE_DIGITAL_IO_CARD != card_type)
453 {
454 /* send cmd2, get cid register */
455 sdio_command_init_struct.argument = 0x0;
456 sdio_command_init_struct.cmd_index = SD_CMD_ALL_SEND_CID;
457 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_LONG;
458 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
459
460 /* sdio command config */
461 sdio_command_config(SDIOx, &sdio_command_init_struct);
462 /* enable ccsm */
463 sdio_command_state_machine_enable(SDIOx, TRUE);
464
465 status = command_rsp2_error();
466 if(status != SD_OK)
467 {
468 return status;
469 }
470
471 cid_table[0] = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
472 cid_table[1] = sdio_response_get(SDIOx, SDIO_RSP2_INDEX);
473 cid_table[2] = sdio_response_get(SDIOx, SDIO_RSP3_INDEX);
474 cid_table[3] = sdio_response_get(SDIOx, SDIO_RSP4_INDEX);
475 }
476
477 /* check card type */
478 if((card_type == SDIO_STD_CAPACITY_SD_CARD_V1_1) || (card_type == SDIO_STD_CAPACITY_SD_CARD_V2_0) || \
479 (card_type == SDIO_SECURE_DIGITAL_IO_COMBO_CARD) || (card_type == SDIO_HIGH_CAPACITY_SD_CARD))
480 {
481 /* send cmd3, get rca */
482 sdio_command_init_struct.argument = 0x00;
483 sdio_command_init_struct.cmd_index = SD_CMD_SET_REL_ADDR;
484 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
485 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
486
487 /* sdio command config */
488 sdio_command_config(SDIOx, &sdio_command_init_struct);
489 /* enable ccsm */
490 sdio_command_state_machine_enable(SDIOx, TRUE);
491
492 status = command_rsp6_error(SD_CMD_SET_REL_ADDR, &rca_temp);
493 if(status != SD_OK)
494 {
495 return status;
496 }
497 }
498
499 /* mmc card */
500 if(card_type == SDIO_MULTIMEDIA_CARD)
501 {
502 /* send cmd3 */
503 sdio_command_init_struct.argument = (uint32_t)(rca_temp << 16);
504 sdio_command_init_struct.cmd_index = SD_CMD_SET_REL_ADDR;
505 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
506 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
507
508 /* sdio command config */
509 sdio_command_config(SDIOx, &sdio_command_init_struct);
510 /* enable ccsm */
511 sdio_command_state_machine_enable(SDIOx, TRUE);
512
513 status = command_rsp2_error();
514 if(status != SD_OK)
515 {
516 return status;
517 }
518 }
519
520 /* check is secure_digital_io_card or not */
521 if(card_type != SDIO_SECURE_DIGITAL_IO_CARD)
522 {
523 rca = rca_temp;
524 sdio_command_init_struct.argument = (uint32_t)(rca << 16);
525 sdio_command_init_struct.cmd_index = SD_CMD_SEND_CSD;
526 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_LONG;
527 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
528
529 /* sdio command config */
530 sdio_command_config(SDIOx, &sdio_command_init_struct);
531 /* enable ccsm */
532 sdio_command_state_machine_enable(SDIOx, TRUE);
533
534 status = command_rsp2_error();
535 if(status != SD_OK)
536 {
537 return status;
538 }
539
540 csd_table[0] = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
541 csd_table[1] = sdio_response_get(SDIOx, SDIO_RSP2_INDEX);
542 csd_table[2] = sdio_response_get(SDIOx, SDIO_RSP3_INDEX);
543 csd_table[3] = sdio_response_get(SDIOx, SDIO_RSP4_INDEX);
544 }
545
546 return SD_OK;
547}
548
555 sd_error_status_type sd_card_info_get(sd_card_info_struct_type *card_info)
556{
557 sd_error_status_type status = SD_OK;
558 uint8_t tmp = 0;
559
560 card_info->card_type = (uint8_t)card_type;
561 card_info->rca = (uint16_t)rca;
562
563 /* byte 0 */
564 tmp = (uint8_t)((csd_table[0] & 0xFF000000) >> 24);
565 card_info->sd_csd_reg.csd_struct = (tmp & 0xC0) >> 6;
566 card_info->sd_csd_reg.spec_version = (tmp & 0x3C) >> 2;
567 card_info->sd_csd_reg.reserved1 = tmp & 0x03;
568
569 /* byte 1 */
570 tmp = (uint8_t)((csd_table[0] & 0x00FF0000) >> 16);
571 card_info->sd_csd_reg.taac = tmp;
572
573 /* byte 2 */
574 tmp = (uint8_t)((csd_table[0] & 0x0000FF00) >> 8);
575 card_info->sd_csd_reg.nsac = tmp;
576
577 /* byte 3 */
578 tmp = (uint8_t)(csd_table[0] & 0x000000FF);
579 card_info->sd_csd_reg.max_bus_clk_freq = tmp;
580
581 /* byte 4 */
582 tmp = (uint8_t)((csd_table[1] & 0xFF000000) >> 24);
583 card_info->sd_csd_reg.card_cmd_classes = tmp << 4;
584
585 /* byte 5 */
586 tmp = (uint8_t)((csd_table[1] & 0x00FF0000) >> 16);
587 card_info->sd_csd_reg.card_cmd_classes |= (tmp & 0xF0) >> 4;
588 card_info->sd_csd_reg.max_read_blk_length = tmp & 0x0F;
589
590 /* byte 6 */
591 tmp = (uint8_t)((csd_table[1] & 0x0000FF00) >> 8);
592 card_info->sd_csd_reg.part_blk_read = (tmp & 0x80) >> 7;
593 card_info->sd_csd_reg.write_blk_misalign = (tmp & 0x40) >> 6;
594 card_info->sd_csd_reg.read_blk_misalign = (tmp & 0x20) >> 5;
595 card_info->sd_csd_reg.dsr_implemented = (tmp & 0x10) >> 4;
596 card_info->sd_csd_reg.reserved2 = 0; /* reserved */
597
598 if((card_type == SDIO_STD_CAPACITY_SD_CARD_V1_1) || (card_type == SDIO_STD_CAPACITY_SD_CARD_V2_0) || (card_type == SDIO_MULTIMEDIA_CARD))
599 {
600 card_info->sd_csd_reg.device_size = (tmp & 0x03) << 10;
601
602 /* byte 7 */
603 tmp = (uint8_t)(csd_table[1] & 0x000000FF);
604 card_info->sd_csd_reg.device_size |= (tmp) << 2;
605
606 /* byte 8 */
607 tmp = (uint8_t)((csd_table[2] & 0xFF000000) >> 24);
608 card_info->sd_csd_reg.device_size |= (tmp & 0xC0) >> 6;
609
610 card_info->sd_csd_reg.max_read_current_vdd_min = (tmp & 0x38) >> 3;
611 card_info->sd_csd_reg.max_read_current_vdd_max = (tmp & 0x07);
612
613 /* byte 9 */
614 tmp = (uint8_t)((csd_table[2] & 0x00FF0000) >> 16);
615 card_info->sd_csd_reg.max_write_current_vdd_min = (tmp & 0xE0) >> 5;
616 card_info->sd_csd_reg.max_write_current_vdd_max = (tmp & 0x1C) >> 2;
617 card_info->sd_csd_reg.device_size_mult = (tmp & 0x03) << 1;
618 /* byte 10 */
619 tmp = (uint8_t)((csd_table[2] & 0x0000FF00) >> 8);
620 card_info->sd_csd_reg.device_size_mult |= (tmp & 0x80) >> 7;
621
622 card_info->card_capacity = (card_info->sd_csd_reg.device_size + 1) ;
623 card_info->card_capacity *= (1 << (card_info->sd_csd_reg.device_size_mult + 2));
624 card_info->card_blk_size = 1 << (card_info->sd_csd_reg.max_read_blk_length);
625 card_info->card_capacity *= card_info->card_blk_size;
626 }
627 else if(card_type == SDIO_HIGH_CAPACITY_SD_CARD)
628 {
629 /* byte 7 */
630 tmp = (uint8_t)(csd_table[1] & 0x000000FF);
631 card_info->sd_csd_reg.device_size = (tmp & 0x3F) << 16;
632
633 /* byte 8 */
634 tmp = (uint8_t)((csd_table[2] & 0xFF000000) >> 24);
635
636 card_info->sd_csd_reg.device_size |= (tmp << 8);
637
638 /* byte 9 */
639 tmp = (uint8_t)((csd_table[2] & 0x00FF0000) >> 16);
640
641 card_info->sd_csd_reg.device_size |= (tmp);
642
643 /* byte 10 */
644 tmp = (uint8_t)((csd_table[2] & 0x0000FF00) >> 8);
645
646 card_info->card_capacity = (uint64_t)(card_info->sd_csd_reg.device_size + 1) * 512 * 1024;
647 card_info->card_blk_size = 512;
648 }
649
650
651 card_info->sd_csd_reg.erase_group_size = (tmp & 0x40) >> 6;
652 card_info->sd_csd_reg.erase_group_size_mult = (tmp & 0x3F) << 1;
653
654 /* byte 11 */
655 tmp = (uint8_t)(csd_table[2] & 0x000000FF);
656 card_info->sd_csd_reg.erase_group_size_mult |= (tmp & 0x80) >> 7;
657 card_info->sd_csd_reg.write_protect_group_size = (tmp & 0x7F);
658
659 /* byte 12 */
660 tmp = (uint8_t)((csd_table[3] & 0xFF000000) >> 24);
661 card_info->sd_csd_reg.write_protect_group_enable = (tmp & 0x80) >> 7;
662 card_info->sd_csd_reg.manufacturer_default_ecc = (tmp & 0x60) >> 5;
663 card_info->sd_csd_reg.write_speed_factor = (tmp & 0x1C) >> 2;
664 card_info->sd_csd_reg.max_write_blk_length = (tmp & 0x03) << 2;
665
666 /* byte 13 */
667 tmp = (uint8_t)((csd_table[3] & 0x00FF0000) >> 16);
668 card_info->sd_csd_reg.max_write_blk_length |= (tmp & 0xC0) >> 6;
669 card_info->sd_csd_reg.part_blk_write = (tmp & 0x20) >> 5;
670 card_info->sd_csd_reg.reserved3 = 0;
671 card_info->sd_csd_reg.content_protect_app = (tmp & 0x01);
672
673 /* byte 14 */
674 tmp = (uint8_t)((csd_table[3] & 0x0000FF00) >> 8);
675 card_info->sd_csd_reg.file_format_group = (tmp & 0x80) >> 7;
676 card_info->sd_csd_reg.copy_flag = (tmp & 0x40) >> 6;
677 card_info->sd_csd_reg.permanent_write_protect = (tmp & 0x20) >> 5;
678 card_info->sd_csd_reg.temp_write_protect = (tmp & 0x10) >> 4;
679 card_info->sd_csd_reg.file_formart = (tmp & 0x0C) >> 2;
680 card_info->sd_csd_reg.ecc_code = (tmp & 0x03);
681
682 /* byte 15 */
683 tmp = (uint8_t)(csd_table[3] & 0x000000FF);
684 card_info->sd_csd_reg.csd_crc = (tmp & 0xFE) >> 1;
685 card_info->sd_csd_reg.reserved4 = 1;
686
687 /* byte 0 */
688 tmp = (uint8_t)((cid_table[0] & 0xFF000000) >> 24);
689 card_info->sd_cid_reg.manufacturer_id = tmp;
690
691 /* byte 1 */
692 tmp = (uint8_t)((cid_table[0] & 0x00FF0000) >> 16);
693 card_info->sd_cid_reg.oem_app_id = tmp << 8;
694
695 /* byte 2 */
696 tmp = (uint8_t)((cid_table[0] & 0x000000FF00) >> 8);
697 card_info->sd_cid_reg.oem_app_id |= tmp;
698
699 /* byte 3 */
700 tmp = (uint8_t)(cid_table[0] & 0x000000FF);
701 card_info->sd_cid_reg.product_name1 = tmp << 24;
702
703 /* byte 4 */
704 tmp = (uint8_t)((cid_table[1] & 0xFF000000) >> 24);
705 card_info->sd_cid_reg.product_name1 |= tmp << 16;
706
707 /* byte 5 */
708 tmp = (uint8_t)((cid_table[1] & 0x00FF0000) >> 16);
709 card_info->sd_cid_reg.product_name1 |= tmp << 8;
710
711 /* byte 6 */
712 tmp = (uint8_t)((cid_table[1] & 0x0000FF00) >> 8);
713 card_info->sd_cid_reg.product_name1 |= tmp;
714
715 /* byte 7 */
716 tmp = (uint8_t)(cid_table[1] & 0x000000FF);
717 card_info->sd_cid_reg.product_name2 = tmp;
718
719 /* byte 8 */
720 tmp = (uint8_t)((cid_table[2] & 0xFF000000) >> 24);
721 card_info->sd_cid_reg.product_reversion = tmp;
722
723 /* byte 9 */
724 tmp = (uint8_t)((cid_table[2] & 0x00FF0000) >> 16);
725 card_info->sd_cid_reg.product_sn = tmp << 24;
726
727 /* byte 10 */
728 tmp = (uint8_t)((cid_table[2] & 0x0000FF00) >> 8);
729 card_info->sd_cid_reg.product_sn |= tmp << 16;
730
731 /* byte 11 */
732 tmp = (uint8_t)(cid_table[2] & 0x000000FF);
733 card_info->sd_cid_reg.product_sn |= tmp << 8;
734
735 /* byte 12 */
736 tmp = (uint8_t)((cid_table[3] & 0xFF000000) >> 24);
737 card_info->sd_cid_reg.product_sn |= tmp;
738
739 /* byte 13 */
740 tmp = (uint8_t)((cid_table[3] & 0x00FF0000) >> 16);
741 card_info->sd_cid_reg.reserved1 |= (tmp & 0xF0) >> 4;
742 card_info->sd_cid_reg.manufact_date = (tmp & 0x0F) << 8;
743
744 /* byte 14 */
745 tmp = (uint8_t)((cid_table[3] & 0x0000FF00) >> 8);
746 card_info->sd_cid_reg.manufact_date |= tmp;
747
748 /* byte 15 */
749 tmp = (uint8_t)(cid_table[3] & 0x000000FF);
750 card_info->sd_cid_reg.cid_crc = (tmp & 0xFE) >> 1;
751 card_info->sd_cid_reg.reserved2 = 1;
752
753 return(status);
754}
755
766 sd_error_status_type sd_wide_bus_operation_config(sdio_bus_width_type mode)
767{
768 sd_error_status_type status = SD_OK;
769
770 if(card_type == SDIO_MULTIMEDIA_CARD || card_type == SDIO_HIGH_SPEED_MULTIMEDIA_CARD || card_type == SDIO_HIGH_CAPACITY_MMC_CARD)
771 {
772 status = mmc_switch(EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BUS_WIDTH, (uint8_t)mode);
773 }
774 else if((card_type == SDIO_STD_CAPACITY_SD_CARD_V1_1) || (card_type == SDIO_STD_CAPACITY_SD_CARD_V2_0) || \
775 (card_type == SDIO_HIGH_CAPACITY_SD_CARD))
776 {
777 if(mode >= 2)
778 {
779 /* not support D8 mode */
780 return SD_UNSUPPORTED_FEATURE;
781 }
782
783 if(SDIO_BUS_WIDTH_D4 == mode)
784 {
785 status = sd_bus_wide_enable(TRUE);
786 }
787 else
788 {
789 status = sd_bus_wide_enable(FALSE);
790 }
791 }
792
793 if(status == SD_OK)
794 {
795 sdio_bus_width_config(SDIOx, mode);
796 }
797
798 return status;
799}
800
809 sd_error_status_type sd_device_mode_set(uint32_t mode)
810{
811 sd_error_status_type status = SD_OK;
812
813 if((mode == SD_TRANSFER_DMA_MODE) || (mode == SD_TRANSFER_POLLING_MODE))
814 {
815 device_mode = (sd_data_transfer_mode_type)mode;
816 }
817 else
818 {
819 status = SD_INVALID_PARAMETER;
820 }
821
822 return status;
823}
824
830 sd_error_status_type sd_deselect_select(uint32_t addr)
831{
832 /* send cmd7, select card */
833 sdio_command_init_struct.argument = addr;
834 sdio_command_init_struct.cmd_index = SD_CMD_SEL_DESEL_CARD;
835 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
836 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
837
838 /* sdio command config */
839 sdio_command_config(SDIOx, &sdio_command_init_struct);
840 /* enable ccsm */
841 sdio_command_state_machine_enable(SDIOx, TRUE);
842
843 return command_rsp1_error(SD_CMD_SEL_DESEL_CARD);
844}
845
853 sd_error_status_type sdio_command_data_send(sdio_command_struct_type *sdio_cmd_init_t, \
854 sdio_data_struct_type* sdio_data_init_t, uint32_t *buf)
855{
856 sd_error_status_type status = SD_OK;
857 uint32_t count = 0;
858 uint32_t timeout = SDIO_DATATIMEOUT;
859 uint32_t length = 0;
860
861 if(buf == NULL)
862 {
863 return SD_INVALID_PARAMETER;
864 }
865 /* clear dtctrl register */
866 SDIOx->dtcnt = 0x0;
867
868 /* sdio command config */
869 sdio_data_config(SDIOx, sdio_data_init_t);
870 /* enable dcsm */
871 sdio_data_state_machine_enable(SDIOx, TRUE);
872
873 length = sdio_data_init_t->data_length;
874
875 if(device_mode == SD_TRANSFER_DMA_MODE)
876 {
877 if(sdio_data_init_t->transfer_direction == SDIO_DATA_TRANSFER_TO_CONTROLLER)
878 {
879 transfer_error = SD_OK;
880 transfer_end = 0;
881 sd_dma_config(buf, length, DMA_DIR_PERIPHERAL_TO_MEMORY);
882 SDIOx->inten |= SDIO_INTR_STS_READ_MASK;
883 sdio_dma_enable(SDIOx, TRUE);
884 }
885 }
886
887 /* sdio command config */
888 sdio_command_config(SDIOx, sdio_cmd_init_t);
889 /* enable ccsm */
890 sdio_command_state_machine_enable(SDIOx, TRUE);
891
892 status = command_rsp1_error(sdio_cmd_init_t->cmd_index);
893 if(status != SD_OK)
894 {
895 return status;
896 }
897
898 /* polling mode */
899 if(device_mode == SD_TRANSFER_POLLING_MODE)
900 {
901 if(SDIO_DATA_TRANSFER_TO_CONTROLLER == sdio_data_init_t->transfer_direction)
902 {
903 while(!(SDIOx->sts & (SDIO_INTR_STS_READ_MASK)))
904 {
905 if(sdio_flag_get(SDIOx, SDIO_RXBUFH_FLAG) != RESET)
906 {
907 for(count = 0; count < 8; count++, buf++)
908 {
909 *buf = sdio_data_read(SDIOx);
910 }
911
912 timeout = 0x7FFFFF;
913 }
914 else
915 {
916 if(0 == timeout)
917 {
918 sd_init();
919 return SD_DATA_TIMEOUT;
920 }
921
922 timeout--;
923 }
924 }
925
926 while(sdio_flag_get(SDIOx, SDIO_RXBUF_FLAG) != RESET)
927 {
928 *buf = sdio_data_read(SDIOx);
929 buf++;
930 }
931 }
932 else
933 {
934 while(!(SDIOx->sts & SDIO_INTR_STS_WRITE_MASK))
935 {
936 if(sdio_flag_get(SDIOx, SDIO_TXBUFH_FLAG) != RESET)
937 {
938 for(count = 0; count < 8 && length > 0; count++, buf++, length -= 4)
939 {
940 sdio_data_write(SDIOx, *buf);
941 }
942
943 timeout = 0x3FFFFFFF;
944 }
945 else
946 {
947 if(timeout == 0)
948 {
949 sd_init();
950 return SD_DATA_TIMEOUT;
951 }
952
953 timeout--;
954 }
955 }
956 }
957 /* data timeout */
958 if(sdio_flag_get(SDIOx, SDIO_DTTIMEOUT_FLAG) != RESET)
959 {
960 sdio_flag_clear(SDIOx, SDIO_DTTIMEOUT_FLAG);
961 return SD_DATA_TIMEOUT;
962 }
963 /* crc error */
964 else if(sdio_flag_get(SDIOx, SDIO_DTFAIL_FLAG) != RESET)
965 {
966 sdio_flag_clear(SDIOx, SDIO_DTFAIL_FLAG);
967 return SD_DATA_FAIL;
968 }
969 /* over run error */
970 else if(sdio_flag_get(SDIOx, SDIO_RXERRO_FLAG) != RESET)
971 {
972 sdio_flag_clear(SDIOx, SDIO_RXERRO_FLAG);
973 return SD_RX_OVERRUN;
974 }
975 /* under run error */
976 else if(sdio_flag_get(SDIOx, SDIO_TXERRU_FLAG) != RESET)
977 {
978 sdio_flag_clear(SDIOx, SDIO_TXERRU_FLAG);
979 return SD_TX_UNDERRUN;
980 }
981 /* start bit error */
982 else if(sdio_flag_get(SDIOx, SDIO_SBITERR_FLAG) != RESET)
983 {
984 sdio_flag_clear(SDIOx, SDIO_SBITERR_FLAG);
985 return SD_START_BIT_ERR;
986 }
987 /* data transfer complete */
988 if((stop_flag == 1) && (sdio_flag_get(SDIOx, SDIO_DTCMPL_FLAG) != RESET))
989 {
990 /* send cmd12, stop transmission */
991 sdio_cmd_init_t->argument = 0;
992 sdio_cmd_init_t->cmd_index = SD_CMD_STOP_TRANSMISSION;
993 sdio_cmd_init_t->rsp_type = SDIO_RESPONSE_SHORT;
994 sdio_cmd_init_t->wait_type = SDIO_WAIT_FOR_NO;
995
996 /* sdio command config */
997 sdio_command_config(SDIOx, sdio_cmd_init_t);
998 /* enable ccsm */
999 sdio_command_state_machine_enable(SDIOx, TRUE);
1000
1001 status = command_rsp1_error(SD_CMD_STOP_TRANSMISSION);
1002
1003 if(status != SD_OK)
1004 {
1005 return status;
1006 }
1007 }
1008
1009 sdio_flag_clear(SDIOx, SDIO_STATIC_FLAGS);
1010 }
1011 else if(device_mode == SD_TRANSFER_DMA_MODE)
1012 {
1013 if(sdio_data_init_t->transfer_direction == SDIO_DATA_TRANSFER_TO_CARD)
1014 {
1015 transfer_error = SD_OK;
1016 transfer_end = 0;
1017 sd_dma_config(buf, length, DMA_DIR_MEMORY_TO_PERIPHERAL);
1018 SDIOx->inten |= SDIO_INTR_STS_WRITE_MASK;
1019 sdio_dma_enable(SDIOx, TRUE);
1020 }
1021
1022 while(!(SDIOx->sts & SDIOx->inten) && timeout)
1023 {
1024 timeout--;
1025
1026 if(transfer_end)
1027 {
1028 break;
1029 }
1030 }
1031
1032 if(timeout == 0)
1033 {
1034 sd_init();
1035 return SD_DATA_TIMEOUT;
1036 }
1037
1038 if(transfer_error != SD_OK)
1039 {
1040 status = transfer_error;
1041 }
1042 }
1043
1044 return status;
1045}
1046
1053 sd_error_status_type sd_blocks_erase(long long addr, uint32_t nblks)
1054{
1055 sd_error_status_type status = SD_OK;
1056 uint32_t start_addr = 0, end_addr = 0, response = 0;
1057 uint8_t card_state;
1058
1059 /* high capacity sd card */
1060 if(card_type == SDIO_HIGH_CAPACITY_SD_CARD)
1061 {
1062 start_addr = addr >> 9;
1063 end_addr = start_addr + nblks - 1;
1064 }
1065 else
1066 {
1067 start_addr = addr;
1068 end_addr = start_addr + (nblks - 1) * 512;
1069 }
1070
1071 /* clear dcsm configuration */
1072 sdio_data_init_struct.block_size = SDIO_DATA_BLOCK_SIZE_1B;
1073 sdio_data_init_struct.data_length = 0 ;
1074 sdio_data_init_struct.timeout = SD_DATATIMEOUT ;
1075 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CARD;
1076 sdio_data_init_struct.transfer_mode = SDIO_DATA_BLOCK_TRANSFER;
1077
1078 sdio_data_config(SDIOx, &sdio_data_init_struct);
1079 sdio_data_state_machine_enable(SDIOx, FALSE);
1080
1081 response = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
1082
1083 /* check card locked */
1084 if(response & SD_CARD_LOCKED)
1085 {
1086 return SD_LOCK_UNLOCK_ERROR;
1087 }
1088
1089 if(card_type == SDIO_MULTIMEDIA_CARD || card_type == SDIO_HIGH_SPEED_MULTIMEDIA_CARD || card_type == SDIO_HIGH_CAPACITY_MMC_CARD)
1090 {
1091 /* send cmd35, set erase group start */
1092 sdio_command_init_struct.argument = start_addr;
1093 sdio_command_init_struct.cmd_index = SD_CMD_ERASE_GRP_START;
1094 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1095 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1096
1097 /* sdio command config */
1098 sdio_command_config(SDIOx, &sdio_command_init_struct);
1099 /* enable ccsm */
1100 sdio_command_state_machine_enable(SDIOx, TRUE);
1101
1102 status = command_rsp1_error(SD_CMD_ERASE_GRP_START);
1103
1104 if(status != SD_OK)
1105 {
1106 return status;
1107 }
1108
1109 /* send cmd36, set erase group end */
1110 sdio_command_init_struct.argument = end_addr;
1111 sdio_command_init_struct.cmd_index = SD_CMD_ERASE_GRP_END;
1112
1113 /* sdio command config */
1114 sdio_command_config(SDIOx, &sdio_command_init_struct);
1115 /* enable ccsm */
1116 sdio_command_state_machine_enable(SDIOx, TRUE);
1117
1118 status = command_rsp1_error(SD_CMD_ERASE_GRP_END);
1119
1120 if(status != SD_OK)
1121 {
1122 return status;
1123 }
1124
1125 /* send cmd38, start erase gourp */
1126 sdio_command_init_struct.argument = 0;
1127 sdio_command_init_struct.cmd_index = SD_CMD_ERASE;
1128
1129 /* sdio command config */
1130 sdio_command_config(SDIOx, &sdio_command_init_struct);
1131 /* enable ccsm */
1132 sdio_command_state_machine_enable(SDIOx, TRUE);
1133
1134 status = command_rsp1_error(SD_CMD_ERASE);
1135
1136 if(status != SD_OK)
1137 {
1138 return status;
1139 }
1140 }
1141 else
1142 {
1143 /* send cmd32, set erase block start */
1144 sdio_command_init_struct.argument = start_addr;
1145 sdio_command_init_struct.cmd_index = SD_CMD_SD_ERASE_GRP_START;
1146 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1147 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1148
1149 /* sdio command config */
1150 sdio_command_config(SDIOx, &sdio_command_init_struct);
1151 /* enable ccsm */
1152 sdio_command_state_machine_enable(SDIOx, TRUE);
1153
1154 status = command_rsp1_error(SD_CMD_SD_ERASE_GRP_START);
1155
1156 if(status != SD_OK)
1157 {
1158 return status;
1159 }
1160
1161 /* send cmd33, set erase block end */
1162 sdio_command_init_struct.argument = end_addr;
1163 sdio_command_init_struct.cmd_index = SD_CMD_SD_ERASE_GRP_END;
1164
1165 /* sdio command config */
1166 sdio_command_config(SDIOx, &sdio_command_init_struct);
1167 /* enable ccsm */
1168 sdio_command_state_machine_enable(SDIOx, TRUE);
1169
1170 if(status != SD_OK)
1171 {
1172 return status;
1173 }
1174
1175 /* send cmd38, start erase block */
1176 sdio_command_init_struct.argument = 0;
1177 sdio_command_init_struct.cmd_index = SD_CMD_ERASE;
1178
1179 /* sdio command config */
1180 sdio_command_config(SDIOx, &sdio_command_init_struct);
1181 /* enable ccsm */
1182 sdio_command_state_machine_enable(SDIOx, TRUE);
1183
1184 status = command_rsp1_error(SD_CMD_ERASE);
1185
1186 if(status != SD_OK)
1187 {
1188 return status;
1189 }
1190 }
1191
1192 status = check_card_programming(&card_state);
1193
1194 while((status == SD_OK) && ((card_state == SD_CARD_PROGRAMMING) || \
1195 (card_state == SD_CARD_RECEIVING)))
1196 {
1197 status = check_card_programming(&card_state);
1198 }
1199
1200 return status;
1201}
1202
1211 sd_error_status_type sd_block_read(uint8_t *buf, long long addr, uint16_t blk_size)
1212{
1213 sd_error_status_type status = SD_OK;
1214 uint32_t response = 0;
1215 uint8_t power;
1216
1217 if(NULL == buf)
1218 {
1219 return SD_INVALID_PARAMETER;
1220 }
1221
1222 SDIOx->dtctrl = 0x0;
1223
1224 if((card_type == SDIO_HIGH_CAPACITY_SD_CARD) || (card_type == SDIO_HIGH_CAPACITY_MMC_CARD))
1225 {
1226 blk_size = 512;
1227 addr >>= 9;
1228 }
1229
1230 /* clear dcsm configuration */
1231 sdio_data_init_struct.block_size = SDIO_DATA_BLOCK_SIZE_1B;
1232 sdio_data_init_struct.data_length = 0;
1233 sdio_data_init_struct.timeout = SD_DATATIMEOUT;
1234 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CARD;
1235 sdio_data_init_struct.transfer_mode = SDIO_DATA_BLOCK_TRANSFER;
1236
1237 sdio_data_config(SDIOx, &sdio_data_init_struct);
1238 sdio_data_state_machine_enable(SDIOx, FALSE);
1239
1240 response = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
1241
1242 /* check card locked */
1243 if(response & SD_CARD_LOCKED)
1244 {
1245 return SD_LOCK_UNLOCK_ERROR;
1246 }
1247
1248 if((blk_size > 0) && (blk_size <= 2048) && ((blk_size & (blk_size - 1)) == 0))
1249 {
1250 power = convert_from_bytes_to_power_of_two(blk_size);
1251
1252 /* send cmd16, set block size */
1253 sdio_command_init_struct.argument = blk_size;
1254 sdio_command_init_struct.cmd_index = SD_CMD_SET_BLOCKLEN;
1255 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1256 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1257
1258 /* sdio command config */
1259 sdio_command_config(SDIOx, &sdio_command_init_struct);
1260 /* enable ccsm */
1261 sdio_command_state_machine_enable(SDIOx, TRUE);
1262
1263 status = command_rsp1_error(SD_CMD_SET_BLOCKLEN);
1264
1265 if(status != SD_OK)
1266 {
1267 return status;
1268 }
1269 }
1270 else
1271 {
1272 return SD_INVALID_PARAMETER;
1273 }
1274
1275 sdio_data_init_struct.block_size = (sdio_block_size_type)(power);
1276 sdio_data_init_struct.data_length = blk_size ;
1277 sdio_data_init_struct.timeout = SD_DATATIMEOUT ;
1278 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CONTROLLER;
1279 sdio_data_init_struct.transfer_mode = SDIO_DATA_BLOCK_TRANSFER;
1280
1281 sdio_command_init_struct.argument = addr;
1282 sdio_command_init_struct.cmd_index = SD_CMD_READ_SINGLE_BLOCK;
1283 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1284 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1285
1286 stop_flag = 0;
1287
1288 return sdio_command_data_send(&sdio_command_init_struct, &sdio_data_init_struct, (uint32_t *)buf);
1289}
1290
1300 sd_error_status_type sd_mult_blocks_read(uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks)
1301{
1302 sd_error_status_type status = SD_OK;
1303 uint32_t response = 0;
1304 uint8_t power;
1305
1306 SDIOx->dtctrl = 0x0;
1307
1308 if((card_type == SDIO_HIGH_CAPACITY_SD_CARD) || (card_type == SDIO_HIGH_CAPACITY_MMC_CARD))
1309 {
1310 blk_size = 512;
1311 addr >>= 9;
1312 }
1313
1314 /* clear dcsm configuration */
1315 sdio_data_init_struct.block_size = (sdio_block_size_type)0;
1316 sdio_data_init_struct.data_length = 0;
1317 sdio_data_init_struct.timeout = SD_DATATIMEOUT;
1318 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CARD;
1319 sdio_data_init_struct.transfer_mode = SDIO_DATA_BLOCK_TRANSFER;
1320
1321 sdio_data_config(SDIOx, &sdio_data_init_struct);
1322 sdio_data_state_machine_enable(SDIOx, FALSE);
1323
1324 response = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
1325
1326 /* check card locked */
1327 if(response & SD_CARD_LOCKED)
1328 {
1329 return SD_LOCK_UNLOCK_ERROR;
1330 }
1331
1332 if((blk_size > 0) && (blk_size <= 2048) && ((blk_size & (blk_size - 1)) == 0))
1333 {
1334 power = convert_from_bytes_to_power_of_two(blk_size);
1335
1336 /* send cmd16, set block size */
1337 sdio_command_init_struct.argument = blk_size;
1338 sdio_command_init_struct.cmd_index = SD_CMD_SET_BLOCKLEN;
1339 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1340 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1341
1342 /* sdio command config */
1343 sdio_command_config(SDIOx, &sdio_command_init_struct);
1344 /* enable ccsm */
1345 sdio_command_state_machine_enable(SDIOx, TRUE);
1346
1347 status = command_rsp1_error(SD_CMD_SET_BLOCKLEN);
1348
1349 if(status != SD_OK)
1350 {
1351 return status;
1352 }
1353 }
1354 else
1355 {
1356 return SD_INVALID_PARAMETER;
1357 }
1358
1359 /* check max receive length */
1360 if(nblks * blk_size > SD_MAX_DATA_LENGTH)
1361 {
1362 return SD_INVALID_PARAMETER;
1363 }
1364
1365 sdio_data_init_struct.block_size = (sdio_block_size_type)(power);
1366 sdio_data_init_struct.data_length = nblks * blk_size ;
1367 sdio_data_init_struct.timeout = SD_DATATIMEOUT ;
1368 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CONTROLLER;
1369 sdio_data_init_struct.transfer_mode = SDIO_DATA_BLOCK_TRANSFER;
1370
1371 /* send cmd18, read block data */
1372 sdio_command_init_struct.argument = addr;
1373 sdio_command_init_struct.cmd_index = SD_CMD_READ_MULT_BLOCK;
1374 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1375 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1376
1377 stop_flag = 1;
1378
1379 return sdio_command_data_send(&sdio_command_init_struct, &sdio_data_init_struct, (uint32_t *)buf);
1380}
1381
1390 sd_error_status_type sd_block_write(const uint8_t *buf, long long addr, uint16_t blk_size)
1391{
1392 sd_error_status_type status = SD_OK;
1393 uint8_t power = 0, card_state = 0;
1394 uint32_t timeout = 0, card_status = 0, response = 0;
1395
1396 if(buf == NULL)
1397 {
1398 return SD_INVALID_PARAMETER;
1399 }
1400
1401 SDIOx->dtctrl = 0x0;
1402
1403 /* clear dcsm configuration */
1404 sdio_data_init_struct.block_size = (sdio_block_size_type)0;
1405 sdio_data_init_struct.data_length = 0;
1406 sdio_data_init_struct.timeout = SD_DATATIMEOUT;
1407 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CARD;
1408 sdio_data_init_struct.transfer_mode = SDIO_DATA_BLOCK_TRANSFER;
1409
1410 sdio_data_config(SDIOx, &sdio_data_init_struct);
1411 sdio_data_state_machine_enable(SDIOx, FALSE);
1412
1413 response = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
1414
1415 /* check card locked */
1416 if(response & SD_CARD_LOCKED)
1417 {
1418 return SD_LOCK_UNLOCK_ERROR;
1419 }
1420
1421 if((card_type == SDIO_HIGH_CAPACITY_SD_CARD) || (card_type == SDIO_HIGH_CAPACITY_MMC_CARD))
1422 {
1423 blk_size = 512;
1424 addr >>= 9;
1425 }
1426
1427 if((blk_size > 0) && (blk_size <= 2048) && ((blk_size & (blk_size - 1)) == 0))
1428 {
1429 power = convert_from_bytes_to_power_of_two(blk_size);
1430
1431 /* send cmd16, set block size */
1432 sdio_command_init_struct.argument = blk_size;
1433 sdio_command_init_struct.cmd_index = SD_CMD_SET_BLOCKLEN;
1434 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1435 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1436
1437 /* sdio command config */
1438 sdio_command_config(SDIOx, &sdio_command_init_struct);
1439 /* enable ccsm */
1440 sdio_command_state_machine_enable(SDIOx, TRUE);
1441
1442 status = command_rsp1_error(SD_CMD_SET_BLOCKLEN);
1443
1444 if(status != SD_OK)
1445 {
1446 return status;
1447 }
1448 }
1449 else
1450 {
1451 return SD_INVALID_PARAMETER;
1452 }
1453
1454 timeout = SD_DATATIMEOUT;
1455
1456 do
1457 {
1458 timeout--;
1459 status = sd_status_send(&card_status);
1460 }
1461 /* check ready_for_data flag */
1462 while(((card_status & 0x00000100) == 0) && (timeout > 0));
1463
1464 if(timeout == 0)
1465 {
1466 return SD_ERROR;
1467 }
1468
1469 /* send cmd24, write single block */
1470 sdio_command_init_struct.argument = addr;
1471 sdio_command_init_struct.cmd_index = SD_CMD_WRITE_SINGLE_BLOCK;
1472 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1473 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1474
1475 sdio_data_init_struct.block_size = (sdio_block_size_type)(power);
1476 sdio_data_init_struct.data_length = blk_size;
1477 sdio_data_init_struct.timeout = SD_DATATIMEOUT;
1478 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CARD;
1479 sdio_data_init_struct.transfer_mode = SDIO_DATA_BLOCK_TRANSFER;
1480
1481 stop_flag = 0;
1482
1483 /* single block, stop command is unnecessary */
1484 status = sdio_command_data_send(&sdio_command_init_struct, &sdio_data_init_struct, (uint32_t *)buf);
1485
1486 if(status != SD_OK)
1487 {
1488 return status;
1489 }
1490
1491 sdio_flag_clear(SDIOx, SDIO_STATIC_FLAGS);
1492
1493 status = check_card_programming(&card_state);
1494
1495 while((status == SD_OK) && ((card_state == SD_CARD_PROGRAMMING) || (card_state == SD_CARD_RECEIVING)))
1496 {
1497 status = check_card_programming(&card_state);
1498 }
1499
1500 return status;
1501}
1502
1512 sd_error_status_type sd_mult_blocks_write(const uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks)
1513{
1514 sd_error_status_type status = SD_OK;
1515 uint8_t power = 0, card_state = 0;
1516 uint32_t timeout = 0, card_status = 0, response = 0;;
1517
1518 if(buf == NULL)
1519 {
1520 return SD_INVALID_PARAMETER;
1521 }
1522
1523 SDIOx->dtctrl = 0x0;
1524
1525 /* clear dcsm configuration */
1526 sdio_data_init_struct.block_size = (sdio_block_size_type)0;
1527 sdio_data_init_struct.data_length = 0;
1528 sdio_data_init_struct.timeout = SD_DATATIMEOUT;
1529 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CARD;
1530 sdio_data_init_struct.transfer_mode = SDIO_DATA_BLOCK_TRANSFER;
1531
1532 sdio_data_config(SDIOx, &sdio_data_init_struct);
1533 sdio_data_state_machine_enable(SDIOx, FALSE);
1534
1535 response = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
1536
1537 /* check card locked */
1538 if(response & SD_CARD_LOCKED)
1539 {
1540 return SD_LOCK_UNLOCK_ERROR;
1541 }
1542
1543 if((card_type == SDIO_HIGH_CAPACITY_SD_CARD) || (card_type == SDIO_HIGH_CAPACITY_MMC_CARD))
1544 {
1545 blk_size = 512;
1546 addr >>= 9;
1547 }
1548
1549 if((blk_size > 0) && (blk_size <= 2048) && ((blk_size & (blk_size - 1)) == 0))
1550 {
1551 power = convert_from_bytes_to_power_of_two(blk_size);
1552
1553 /* send cmd16, set block size */
1554 sdio_command_init_struct.argument = blk_size;
1555 sdio_command_init_struct.cmd_index = SD_CMD_SET_BLOCKLEN;
1556 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1557 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1558
1559 /* sdio command config */
1560 sdio_command_config(SDIOx, &sdio_command_init_struct);
1561 /* enable ccsm */
1562 sdio_command_state_machine_enable(SDIOx, TRUE);
1563
1564 status = command_rsp1_error(SD_CMD_SET_BLOCKLEN);
1565
1566 if(status != SD_OK)
1567 {
1568 return status;
1569 }
1570 }
1571 else
1572 {
1573 return SD_INVALID_PARAMETER;
1574 }
1575
1576 if((nblks * blk_size) > SD_MAX_DATA_LENGTH)
1577 {
1578 return SD_INVALID_PARAMETER;
1579 }
1580
1581 timeout = SD_DATATIMEOUT;
1582
1583 do
1584 {
1585 timeout--;
1586 status = sd_status_send(&card_status);
1587 }
1588 /* check ready_for_data flag */
1589 while(((card_status & 0x00000100) == 0) && (timeout > 0));
1590
1591 if(timeout == 0)
1592 {
1593 return SD_ERROR;
1594 }
1595
1596 if((card_type == SDIO_STD_CAPACITY_SD_CARD_V1_1) || (card_type == SDIO_STD_CAPACITY_SD_CARD_V2_0) || \
1597 (card_type == SDIO_HIGH_CAPACITY_SD_CARD))
1598 {
1599 /* send cmd55 */
1600 sdio_command_init_struct.argument = (uint32_t)rca << 16;
1601 sdio_command_init_struct.cmd_index = SD_CMD_APP_CMD;
1602 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1603 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1604
1605 /* sdio command config */
1606 sdio_command_config(SDIOx, &sdio_command_init_struct);
1607 /* enable ccsm */
1608 sdio_command_state_machine_enable(SDIOx, TRUE);
1609
1610 status = command_rsp1_error(SD_CMD_APP_CMD);
1611
1612 if(status != SD_OK)
1613 {
1614 return status;
1615 }
1616
1617 /* send cmd23, set block count */
1618 sdio_command_init_struct.argument = blk_size;
1619 sdio_command_init_struct.cmd_index = SD_CMD_SET_BLOCK_COUNT;
1620 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1621 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1622
1623 /* sdio command config */
1624 sdio_command_config(SDIOx, &sdio_command_init_struct);
1625 /* enable ccsm */
1626 sdio_command_state_machine_enable(SDIOx, TRUE);
1627
1628 status = command_rsp1_error(SD_CMD_SET_BLOCK_COUNT);
1629
1630 if(status != SD_OK)
1631 {
1632 return status;
1633 }
1634 }
1635
1636 /* send cmd25, write mult blocks */
1637 sdio_command_init_struct.argument = addr;
1638 sdio_command_init_struct.cmd_index = SD_CMD_WRITE_MULT_BLOCK;
1639 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1640 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1641
1642 sdio_data_init_struct.block_size = (sdio_block_size_type)(power);
1643 sdio_data_init_struct.data_length = nblks * blk_size ;
1644 sdio_data_init_struct.timeout = SD_DATATIMEOUT ;
1645 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CARD;
1646 sdio_data_init_struct.transfer_mode = SDIO_DATA_BLOCK_TRANSFER;
1647
1648 stop_flag = 1;
1649 /* cmd12 is needed */
1650 status = sdio_command_data_send(&sdio_command_init_struct, &sdio_data_init_struct, (uint32_t *)buf);
1651
1652 if(status != SD_OK)
1653 {
1654 return status;
1655 }
1656
1657 sdio_flag_clear(SDIOx, SDIO_STATIC_FLAGS);
1658
1659 status = check_card_programming(&card_state);
1660
1661 while((status == SD_OK) && ((card_state == SD_CARD_PROGRAMMING) || (card_state == SD_CARD_RECEIVING)))
1662 {
1663 status = check_card_programming(&card_state);
1664 }
1665
1666 return status;
1667}
1668
1676 sd_error_status_type mmc_stream_read(uint8_t *buf, long long addr, uint32_t len)
1677{
1678 uint32_t response = 0;
1679
1680 SDIOx->dtctrl = 0x0;
1681
1682 /* clear dcsm configuration */
1683 sdio_data_init_struct.block_size = SDIO_DATA_BLOCK_SIZE_1B;
1684 sdio_data_init_struct.data_length = 0;
1685 sdio_data_init_struct.timeout = SD_DATATIMEOUT ;
1686 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CARD;
1687 sdio_data_init_struct.transfer_mode = SDIO_DATA_STREAM_TRANSFER;
1688
1689 sdio_data_config(SDIOx, &sdio_data_init_struct);
1690 sdio_data_state_machine_enable(SDIOx, FALSE);
1691
1692 response = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
1693
1694 /* check card locked */
1695 if(response & SD_CARD_LOCKED)
1696 {
1697 return SD_LOCK_UNLOCK_ERROR;
1698 }
1699 /* send cmd11, read data */
1700 sdio_command_init_struct.argument = addr;
1701 sdio_command_init_struct.cmd_index = SD_CMD_READ_DAT_UNTIL_STOP;
1702 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1703 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1704
1705 sdio_data_init_struct.block_size = SDIO_DATA_BLOCK_SIZE_1B;
1706 sdio_data_init_struct.data_length = len;
1707 sdio_data_init_struct.timeout = SD_DATATIMEOUT ;
1708 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CONTROLLER;
1709 sdio_data_init_struct.transfer_mode = SDIO_DATA_STREAM_TRANSFER;
1710
1711 stop_flag = 1;
1712 /* cmd12 is needed */
1713 return sdio_command_data_send(&sdio_command_init_struct, &sdio_data_init_struct, (uint32_t *)buf);
1714}
1715
1723 sd_error_status_type mmc_stream_write(uint8_t *buf, long long addr, uint32_t len)
1724{
1725 sd_error_status_type status = SD_OK;
1726 uint32_t response = 0;
1727 uint8_t card_state = 0;
1728
1729 if(buf == NULL)
1730 {
1731 return SD_INVALID_PARAMETER;
1732 }
1733
1734 SDIOx->dtctrl = 0x0;
1735
1736 /* clear dcsm configuration */
1737 sdio_data_init_struct.block_size = SDIO_DATA_BLOCK_SIZE_1B;
1738 sdio_data_init_struct.data_length = 0;
1739 sdio_data_init_struct.timeout = SD_DATATIMEOUT;
1740 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CARD;
1741 sdio_data_init_struct.transfer_mode = SDIO_DATA_STREAM_TRANSFER;
1742
1743 sdio_data_config(SDIOx, &sdio_data_init_struct);
1744 sdio_data_state_machine_enable(SDIOx, FALSE);
1745
1746 response = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
1747
1748 /* check card locked */
1749 if(response & SD_CARD_LOCKED)
1750 {
1751 return SD_LOCK_UNLOCK_ERROR;
1752 }
1753 /* send cmd20, write data */
1754 sdio_command_init_struct.argument = addr;
1755 sdio_command_init_struct.cmd_index = SD_CMD_WRITE_DAT_UNTIL_STOP;
1756 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1757 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1758
1759
1760 sdio_data_init_struct.block_size = SDIO_DATA_BLOCK_SIZE_1B;
1761 sdio_data_init_struct.data_length = len;
1762 sdio_data_init_struct.timeout = SD_DATATIMEOUT ;
1763 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CARD;
1764 sdio_data_init_struct.transfer_mode = SDIO_DATA_STREAM_TRANSFER;
1765
1766 stop_flag = 1;
1767 /* cmd12 is needed */
1768 status = sdio_command_data_send(&sdio_command_init_struct, &sdio_data_init_struct, (uint32_t *)buf);
1769
1770 if(status != SD_OK)
1771 {
1772 return status;
1773 }
1774
1775 sdio_flag_clear(SDIOx, SDIO_STATIC_FLAGS);
1776
1777 status = check_card_programming(&card_state);
1778
1779 while((status == SD_OK) && ((card_state == SD_CARD_PROGRAMMING) || (card_state == SD_CARD_RECEIVING)))
1780 {
1781 status = check_card_programming(&card_state);
1782 }
1783
1784 return status;
1785}
1786
1792void SDIO1_IRQHandler(void)
1793{
1794 sd_irq_service();
1795}
1796
1802void SDIO2_IRQHandler(void)
1803{
1804 sd_irq_service();
1805}
1806
1812 sd_error_status_type sd_irq_service(void)
1813{
1814 if(sdio_interrupt_flag_get(SDIOx, SDIO_DTCMPL_FLAG) != RESET)
1815 {
1816 if(stop_flag == 1)
1817 {
1818 /* send cmd12, stop transmission */
1819 sdio_command_init_struct.argument = 0;
1820 sdio_command_init_struct.cmd_index = SD_CMD_STOP_TRANSMISSION;
1821 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
1822 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
1823 /* sdio command config */
1824 sdio_command_config(SDIOx, &sdio_command_init_struct);
1825 /* enable ccsm */
1826 sdio_command_state_machine_enable(SDIOx, TRUE);
1827 transfer_error = command_rsp1_error(SD_CMD_STOP_TRANSMISSION);
1828 }
1829 else
1830 {
1831 transfer_error = SD_OK;
1832 }
1833 /* clear flag */
1834 sdio_flag_clear(SDIOx, SDIO_DTCMPL_FLAG);
1835 transfer_end = 1;
1836 return transfer_error;
1837 }
1838
1839 if(sdio_interrupt_flag_get(SDIOx, SDIO_DTFAIL_FLAG) != RESET)
1840 {
1841 /* clear flag */
1842 sdio_flag_clear(SDIOx, SDIO_DTFAIL_FLAG);
1843 transfer_error = SD_DATA_FAIL;
1844 transfer_end = 1;
1845 return transfer_error;
1846 }
1847
1848 if(sdio_interrupt_flag_get(SDIOx, SDIO_DTTIMEOUT_FLAG) != RESET)
1849 {
1850 /* clear flag */
1851 sdio_flag_clear(SDIOx, SDIO_DTTIMEOUT_FLAG);
1852 transfer_error = SD_DATA_TIMEOUT;
1853 transfer_end = 1;
1854 return transfer_error;
1855 }
1856
1857 if(sdio_interrupt_flag_get(SDIOx, SDIO_RXERRO_FLAG) != RESET)
1858 {
1859 /* clear flag */
1860 sdio_flag_clear(SDIOx, SDIO_RXERRO_FLAG);
1861 transfer_error = SD_RX_OVERRUN;
1862 transfer_end = 1;
1863 return(SD_RX_OVERRUN);
1864 }
1865
1866 if(sdio_interrupt_flag_get(SDIOx, SDIO_TXERRU_FLAG) != RESET)
1867 {
1868 /* clear flag */
1869 sdio_flag_clear(SDIOx, SDIO_TXERRU_FLAG);
1870 transfer_error = SD_TX_UNDERRUN;
1871 transfer_end = 1;
1872 return(SD_TX_UNDERRUN);
1873 }
1874
1875 if(sdio_interrupt_flag_get(SDIOx, SDIO_SBITERR_FLAG) != RESET)
1876 {
1877 /* clear flag */
1878 sdio_flag_clear(SDIOx, SDIO_SBITERR_FLAG);
1879 transfer_error = SD_START_BIT_ERR;
1880 transfer_end = 1;
1881 return(SD_START_BIT_ERR);
1882 }
1883
1884 /* disable interrupt */
1885 sdio_interrupt_enable(SDIOx, (SDIO_DTFAIL_INT | SDIO_DTTIMEOUT_INT | \
1886 SDIO_DTCMP_INT | SDIO_TXBUFH_INT | SDIO_RXBUFH_INT | \
1887 SDIO_TXERRU_INT| SDIO_RXERRO_INT | SDIO_SBITERR_INT), FALSE);
1888 return(SD_OK);
1889}
1890
1896 sd_error_status_type command_error(void)
1897{
1898 sd_error_status_type status = SD_OK;
1899 uint32_t timeout = SDIO_CMD0TIMEOUT;
1900
1901 while(timeout--)
1902 {
1903 if(sdio_flag_get(SDIOx, SDIO_CMDCMPL_FLAG) != RESET)
1904 {
1905 break;
1906 }
1907 }
1908
1909 if(timeout == 0)
1910 {
1911 return SD_CMD_RSP_TIMEOUT;
1912 }
1913
1914 sdio_flag_clear(SDIOx, SDIO_STATIC_FLAGS);
1915 return status;
1916}
1917
1923 sd_error_status_type command_rsp7_error(void)
1924{
1925 sd_error_status_type status = SD_OK;
1926 uint32_t sts_reg = 0;
1927 uint32_t timeout = SDIO_CMD0TIMEOUT;
1928
1929 while(timeout--)
1930 {
1931 sts_reg = SDIOx->sts;
1932
1933 if(sts_reg & (SDIO_CMDFAIL_FLAG | SDIO_CMDTIMEOUT_FLAG | SDIO_CMDRSPCMPL_FLAG))
1934 {
1935 break;
1936 }
1937 }
1938
1939 if((timeout == 0) || (sts_reg & SDIO_CMDTIMEOUT_FLAG))
1940 {
1941 status = SD_CMD_RSP_TIMEOUT;
1942 sdio_flag_clear(SDIOx, SDIO_CMDTIMEOUT_FLAG);
1943 return status;
1944 }
1945
1946 if(sts_reg & SDIO_CMDRSPCMPL_FLAG)
1947 {
1948 status = SD_OK;
1949 sdio_flag_clear(SDIOx, SDIO_CMDRSPCMPL_FLAG);
1950 }
1951
1952 return status;
1953}
1954
1960 sd_error_status_type command_rsp1_error(uint8_t cmd)
1961{
1962 uint32_t sts_reg = 0;
1963 uint32_t rsp_cmd = 0;
1964
1965 while(1)
1966 {
1967 sts_reg = SDIOx->sts;
1968
1969 if(sts_reg & (SDIO_CMDFAIL_FLAG | SDIO_CMDTIMEOUT_FLAG | SDIO_CMDRSPCMPL_FLAG))
1970 {
1971 break;
1972 }
1973 }
1974
1975 if(sdio_flag_get(SDIOx, SDIO_CMDTIMEOUT_FLAG) != RESET)
1976 {
1977 sdio_flag_clear(SDIOx, SDIO_CMDTIMEOUT_FLAG);
1978 return SD_CMD_RSP_TIMEOUT;
1979 }
1980
1981 if(sdio_flag_get(SDIOx, SDIO_CMDFAIL_FLAG) != RESET)
1982 {
1983 sdio_flag_clear(SDIOx, SDIO_CMDFAIL_FLAG);
1984 return SD_CMD_FAIL;
1985 }
1986
1987 rsp_cmd = sdio_command_response_get(SDIOx);
1988 if(rsp_cmd != cmd)
1989 {
1990 return SD_ILLEGAL_CMD;
1991 }
1992
1993 sdio_flag_clear(SDIOx, SDIO_STATIC_FLAGS);
1994
1995 return (sd_error_status_type)(sdio_response_get(SDIOx, SDIO_RSP1_INDEX) & SD_OCR_ERRORBITS);
1996}
1997
2003 sd_error_status_type command_rsp3_error(void)
2004{
2005 uint32_t sts_reg = 0;;
2006
2007 while(1)
2008 {
2009 sts_reg = SDIOx->sts;
2010
2011 if(sts_reg & (SDIO_CMDFAIL_FLAG | SDIO_CMDTIMEOUT_FLAG | SDIO_CMDRSPCMPL_FLAG))
2012 {
2013 break;
2014 }
2015 }
2016
2017 if(sdio_flag_get(SDIOx, SDIO_CMDTIMEOUT_FLAG) != RESET)
2018 {
2019 sdio_flag_clear(SDIOx, SDIO_CMDTIMEOUT_FLAG);
2020 return SD_CMD_RSP_TIMEOUT;
2021 }
2022
2023 sdio_flag_clear(SDIOx, SDIO_STATIC_FLAGS);
2024
2025 return SD_OK;
2026}
2027
2033 sd_error_status_type command_rsp2_error(void)
2034{
2035 sd_error_status_type status = SD_OK;
2036 uint32_t sts_reg;
2037 uint32_t timeout = SDIO_CMD0TIMEOUT;
2038
2039 while(timeout--)
2040 {
2041 sts_reg = SDIOx->sts;
2042
2043 if(sts_reg & (SDIO_CMDFAIL_FLAG | SDIO_CMDTIMEOUT_FLAG | SDIO_CMDRSPCMPL_FLAG))
2044 {
2045 break;
2046 }
2047 }
2048
2049 if((timeout == 0) || sdio_flag_get(SDIOx, SDIO_CMDTIMEOUT_FLAG) != RESET)
2050 {
2051 status = SD_CMD_RSP_TIMEOUT;
2052 sdio_flag_clear(SDIOx, SDIO_CMDTIMEOUT_FLAG);
2053
2054 return status;
2055 }
2056
2057 if(sdio_flag_get(SDIOx, SDIO_CMDFAIL_FLAG) != RESET)
2058 {
2059 status = SD_CMD_FAIL;
2060 sdio_flag_clear(SDIOx, SDIO_CMDFAIL_FLAG);
2061 }
2062
2063 sdio_flag_clear(SDIOx, SDIO_STATIC_FLAGS);
2064
2065 return status;
2066}
2067
2073 sd_error_status_type command_rsp4_error(uint8_t cmd)
2074{
2075 uint32_t sts_reg = 0, rsp_cmd = 0;
2076
2077 while(1)
2078 {
2079 sts_reg = SDIOx->sts;
2080
2081 if(sts_reg & (SDIO_CMDFAIL_FLAG | SDIO_CMDTIMEOUT_FLAG | SDIO_CMDRSPCMPL_FLAG))
2082 {
2083 break;
2084 }
2085 }
2086
2087 if(sdio_flag_get(SDIOx, SDIO_CMDTIMEOUT_FLAG) != RESET)
2088 {
2089 sdio_flag_clear(SDIOx, SDIO_CMDTIMEOUT_FLAG);
2090 return SD_CMD_RSP_TIMEOUT;
2091 }
2092
2093 if(sdio_flag_get(SDIOx, SDIO_CMDFAIL_FLAG) != RESET)
2094 {
2095 sdio_flag_clear(SDIOx, SDIO_CMDFAIL_FLAG);
2096
2097 return SD_CMD_FAIL;
2098 }
2099
2100 rsp_cmd = sdio_command_response_get(SDIOx);
2101 if(rsp_cmd != cmd)
2102 {
2103 return SD_ILLEGAL_CMD;
2104 }
2105
2106 sdio_flag_clear(SDIOx, SDIO_STATIC_FLAGS);
2107
2108 return SD_OK;
2109}
2110
2116 sd_error_status_type command_rsp5_error(uint8_t cmd)
2117{
2118 uint32_t sts_reg = 0, rsp_cmd = 0, response = 0;
2119
2120 while(1)
2121 {
2122 sts_reg = SDIOx->sts;
2123
2124 if(sts_reg & (SDIO_CMDFAIL_FLAG | SDIO_CMDTIMEOUT_FLAG | SDIO_CMDRSPCMPL_FLAG))
2125 {
2126 break;
2127 }
2128 }
2129
2130 if(sdio_flag_get(SDIOx, SDIO_CMDTIMEOUT_FLAG) != RESET)
2131 {
2132 sdio_flag_clear(SDIOx, SDIO_CMDTIMEOUT_FLAG);
2133
2134 return SD_CMD_RSP_TIMEOUT;
2135 }
2136
2137 if(sdio_flag_get(SDIOx, SDIO_CMDFAIL_FLAG) != RESET)
2138 {
2139 sdio_flag_clear(SDIOx, SDIO_CMDFAIL_FLAG);
2140
2141 return SD_CMD_FAIL;
2142 }
2143
2144 rsp_cmd = sdio_command_response_get(SDIOx);
2145 if(rsp_cmd != cmd)
2146 {
2147 return SD_ILLEGAL_CMD;
2148 }
2149
2150 sdio_flag_clear(SDIOx, SDIO_STATIC_FLAGS);
2151
2152 response = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
2153
2154 if(response & SD_R5_OUT_OF_RANGE)
2155 {
2156 return SD_CMD_OUT_OF_RANGE;
2157 }
2158
2159 if(response & SD_R5_FUNCTION_NUMBER)
2160 {
2161 return SD_SDIO_UNKNOWN_FUNC;
2162 }
2163
2164 if(response & SD_R5_ERROR)
2165 {
2166 return SD_GENERAL_UNKNOWN_ERROR;
2167 }
2168
2169 return SD_OK;
2170}
2171
2179 sd_error_status_type command_rsp6_error(uint8_t cmd, uint16_t *prca)
2180{
2181 sd_error_status_type status = SD_OK;
2182 uint32_t sts_reg, rsp_cmd = 0, response = 0;
2183
2184 while(1)
2185 {
2186 sts_reg = SDIOx->sts;
2187
2188 if(sts_reg & (SDIO_CMDFAIL_FLAG | SDIO_CMDTIMEOUT_FLAG | SDIO_CMDRSPCMPL_FLAG))
2189 {
2190 break;
2191 }
2192 }
2193
2194 if(sdio_flag_get(SDIOx, SDIO_CMDTIMEOUT_FLAG) != RESET)
2195 {
2196 sdio_flag_clear(SDIOx, SDIO_CMDTIMEOUT_FLAG);
2197 return SD_CMD_RSP_TIMEOUT;
2198 }
2199
2200 if(sdio_flag_get(SDIOx, SDIO_CMDFAIL_FLAG) != RESET)
2201 {
2202 sdio_flag_clear(SDIOx, SDIO_CMDFAIL_FLAG);
2203 return SD_CMD_FAIL;
2204 }
2205
2206 rsp_cmd = sdio_command_response_get(SDIOx);
2207 if(rsp_cmd != cmd)
2208 {
2209 return SD_ILLEGAL_CMD;
2210 }
2211
2212 sdio_flag_clear(SDIOx, SDIO_STATIC_FLAGS);
2213
2214 response = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
2215
2216 if(SD_ALLZERO == (response & (SD_R6_GENERAL_UNKNOWN_ERROR | SD_R6_ILLEGAL_CMD | SD_R6_CMD_CRC_ERROR)))
2217 {
2218 *prca = (uint16_t)(response >> 16);
2219 return status;
2220 }
2221
2222 if(response & SD_R6_GENERAL_UNKNOWN_ERROR)
2223 {
2224 return SD_GENERAL_UNKNOWN_ERROR;
2225 }
2226
2227 if(response & SD_R6_ILLEGAL_CMD)
2228 {
2229 return SD_ILLEGAL_CMD;
2230 }
2231
2232 if(response & SD_R6_CMD_CRC_ERROR)
2233 {
2234 return SD_CMD_CRC_ERROR;
2235 }
2236
2237 return status;
2238}
2239
2245 sd_error_status_type sd_bus_wide_enable(confirm_state new_state)
2246{
2247 sd_error_status_type status = SD_OK;
2248 uint32_t response = 0;
2249 uint8_t arg = 0x00;
2250
2251 if(new_state == TRUE)
2252 {
2253 arg = 0x02;
2254 }
2255 else
2256 {
2257 arg = 0x00;
2258 }
2259
2260 /* get response1 */
2261 response = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
2262
2263 /* check card locked or not */
2264 if(response & SD_CARD_LOCKED)
2265 {
2266 return SD_LOCK_UNLOCK_ERROR;
2267 }
2268
2269 if(sd_card_info.sd_scr_reg.sd_bus_width)
2270 {
2271 sdio_command_init_struct.argument = (uint32_t)(sd_card_info.rca << 16);
2272 sdio_command_init_struct.cmd_index = SD_CMD_APP_CMD;
2273 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
2274 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
2275
2276 /* sdio command config */
2277 sdio_command_config(SDIOx, &sdio_command_init_struct);
2278 /* enable ccsm */
2279 sdio_command_state_machine_enable(SDIOx, TRUE);
2280
2281 status = command_rsp1_error(SD_CMD_APP_CMD);
2282
2283 if(status != SD_OK)
2284 {
2285 return status;
2286 }
2287
2288 sdio_command_init_struct.argument = arg;
2289 sdio_command_init_struct.cmd_index = SD_CMD_APP_SD_SET_BUSWIDTH;
2290 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
2291 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
2292
2293 /* sdio command config */
2294 sdio_command_config(SDIOx, &sdio_command_init_struct);
2295 /* enable ccsm */
2296 sdio_command_state_machine_enable(SDIOx, TRUE);
2297
2298 status = command_rsp1_error(SD_CMD_APP_SD_SET_BUSWIDTH);
2299 return status;
2300 }
2301 else
2302 {
2303 return SD_REQ_NOT_APPLICABLE;
2304 }
2305}
2306
2314 sd_error_status_type mmc_switch(uint8_t set, uint8_t index, uint8_t value)
2315{
2316 sd_error_status_type status = SD_OK;
2317 uint32_t card_status = 0, timeout = 0;
2318
2319 sdio_command_init_struct.argument = (EXT_CSD_Write_byte << 24) | (index << 16) | (value << 8) | set;
2320 sdio_command_init_struct.cmd_index = SD_CMD_HS_SWITCH;
2321 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
2322 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
2323
2324 /* sdio command config */
2325 sdio_command_config(SDIOx, &sdio_command_init_struct);
2326 /* enable ccsm */
2327 sdio_command_state_machine_enable(SDIOx, TRUE);
2328
2329 status = command_rsp1_error(SD_CMD_HS_SWITCH);
2330 if(status != SD_OK)
2331 {
2332 return status;
2333 }
2334
2335 card_status = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
2336 if(card_status & MMC_SWITCH_ERROR)
2337 {
2338 return SD_SWITCH_ERROR;
2339 }
2340
2341 timeout = SD_DATATIMEOUT;
2342 do
2343 {
2344 timeout--;
2345 status = sd_status_send(&card_status);
2346 } /* check ready_for_data flag */
2347 while(((card_status & 0x00000100) == 0) && (timeout > 0));
2348
2349 if(timeout == 0)
2350 {
2351 return SD_ERROR;
2352 }
2353
2354 return status;
2355}
2356
2365 sd_error_status_type sd_switch(uint32_t mode, uint32_t group, uint8_t value, uint8_t *rsp)
2366{
2367 sd_error_status_type status = SD_OK;
2368 uint8_t power;
2369 uint16_t blk_size;
2370
2371 if(rsp == NULL)
2372 {
2373 return SD_INVALID_PARAMETER;
2374 }
2375
2376 SDIOx->dtctrl = 0x0;
2377
2378 blk_size = 64;
2379 power = convert_from_bytes_to_power_of_two(blk_size);
2380
2381 sdio_command_init_struct.argument = blk_size;
2382 sdio_command_init_struct.cmd_index = SD_CMD_SET_BLOCKLEN;
2383 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
2384 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
2385
2386 /* sdio command config */
2387 sdio_command_config(SDIOx, &sdio_command_init_struct);
2388 /* enable ccsm */
2389 sdio_command_state_machine_enable(SDIOx, TRUE);
2390
2391 status = command_rsp1_error(SD_CMD_SET_BLOCKLEN);
2392
2393 if(status != SD_OK)
2394 {
2395 return status;
2396 }
2397
2398 sdio_data_init_struct.block_size = (sdio_block_size_type)(power);
2399 sdio_data_init_struct.data_length = blk_size ;
2400 sdio_data_init_struct.timeout = SD_DATATIMEOUT ;
2401 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CONTROLLER;
2402 sdio_data_init_struct.transfer_mode = SDIO_DATA_BLOCK_TRANSFER;
2403
2404 sdio_command_init_struct.argument = (mode << 31) | 0x00FFFFFF;
2405 sdio_command_init_struct.argument &= ~(0xF << (group * 4));
2406 sdio_command_init_struct.argument |= value << (group * 4);
2407 sdio_command_init_struct.cmd_index = SD_CMD_HS_SWITCH;
2408 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
2409 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
2410
2411 stop_flag = 0;
2412
2413 return sdio_command_data_send(&sdio_command_init_struct, &sdio_data_init_struct, (uint32_t *)rsp);
2414}
2415
2421 sd_error_status_type check_card_programming(uint8_t *p_status)
2422{
2423 volatile uint32_t response = 0, sts_reg = 0, rsp_cmd = 0;
2424
2425 /* send cmd13 */
2426 sdio_command_init_struct.argument = (uint32_t)(rca << 16);
2427 sdio_command_init_struct.cmd_index = SD_CMD_SEND_STATUS;
2428 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
2429 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
2430
2431 /* sdio command config */
2432 sdio_command_config(SDIOx, &sdio_command_init_struct);
2433 /* enable ccsm */
2434 sdio_command_state_machine_enable(SDIOx, TRUE);
2435
2436 sts_reg = SDIOx->sts;
2437
2438 while(!(sts_reg & (SDIO_CMDFAIL_FLAG | SDIO_CMDTIMEOUT_FLAG | SDIO_CMDRSPCMPL_FLAG)))
2439 {
2440 sts_reg = SDIOx->sts;
2441 }
2442
2443 if(sdio_flag_get(SDIOx, SDIO_CMDFAIL_FLAG) != RESET)
2444 {
2445 sdio_flag_clear(SDIOx, SDIO_CMDFAIL_FLAG);
2446 return SD_CMD_FAIL;
2447 }
2448
2449 if(sdio_flag_get(SDIOx, SDIO_CMDTIMEOUT_FLAG) != RESET)
2450 {
2451 sdio_flag_clear(SDIOx, SDIO_CMDTIMEOUT_FLAG);
2452 return SD_CMD_RSP_TIMEOUT;
2453 }
2454
2455 rsp_cmd = sdio_command_response_get(SDIOx);
2456 if(rsp_cmd!= SD_CMD_SEND_STATUS)
2457 {
2458 return SD_ILLEGAL_CMD;
2459 }
2460
2461 sdio_flag_clear(SDIOx, SDIO_STATIC_FLAGS);
2462
2463 response = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
2464
2465 *p_status = (uint8_t)((response >> 9) & 0x0000000F);
2466
2467 return SD_OK;
2468}
2469
2475 sd_error_status_type sd_status_send(uint32_t *p_card_status)
2476{
2477 sd_error_status_type status = SD_OK;
2478
2479 if(p_card_status == NULL)
2480 {
2481 status = SD_INVALID_PARAMETER;
2482 return status;
2483 }
2484
2485 sdio_command_init_struct.argument = (uint32_t)(rca << 16);
2486 sdio_command_init_struct.cmd_index = SD_CMD_SEND_STATUS;
2487 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
2488 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
2489
2490 /* sdio command config */
2491 sdio_command_config(SDIOx, &sdio_command_init_struct);
2492 /* enable ccsm */
2493 sdio_command_state_machine_enable(SDIOx, TRUE);
2494
2495 status = command_rsp1_error(SD_CMD_SEND_STATUS);
2496
2497 if(status != SD_OK)
2498 {
2499 return status;
2500 }
2501
2502 *p_card_status = sdio_response_get(SDIOx, SDIO_RSP1_INDEX);
2503
2504 return status;
2505}
2506
2512 sd_card_state_type sd_state_get(void)
2513{
2514 uint32_t response = 0;
2515
2516 if(sd_status_send(&response) != SD_OK)
2517 {
2518 return SD_CARD_ERROR;
2519 }
2520 else
2521 {
2522 return (sd_card_state_type)((response >> 9) & 0x0F);
2523 }
2524}
2525
2530 sd_error_status_type get_ext_csd(void)
2531{
2532 uint32_t index = 0, sts_reg = 0;
2533 sd_error_status_type status = SD_OK;
2534 uint32_t *tmp_ext_csd = ext_csd_table;
2535
2536 sdio_data_init_struct.block_size = SDIO_DATA_BLOCK_SIZE_512B;
2537 sdio_data_init_struct.data_length = 512;
2538 sdio_data_init_struct.timeout = SD_DATATIMEOUT;
2539 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CONTROLLER;
2540 sdio_data_init_struct.transfer_mode = SDIO_DATA_BLOCK_TRANSFER;
2541
2542 sdio_data_config(SDIOx, &sdio_data_init_struct);
2543 sdio_data_state_machine_enable(SDIOx, TRUE);
2544
2545 /* send cmd8 */
2546 sdio_command_init_struct.argument = 0x0;
2547 sdio_command_init_struct.cmd_index = SD_CMD_HS_SEND_EXT_CSD;
2548 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
2549 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
2550 /* sdio command config */
2551 sdio_command_config(SDIOx, &sdio_command_init_struct);
2552 /* enable ccsm */
2553 sdio_command_state_machine_enable(SDIOx, TRUE);
2554 status = command_rsp1_error(SD_CMD_HS_SEND_EXT_CSD);
2555 if(status != SD_OK)
2556 {
2557 return status;
2558 }
2559
2560 sts_reg = SDIOx->sts;
2561
2562 while(!(sts_reg & (SDIO_RXERRO_FLAG | SDIO_DTFAIL_FLAG | SDIO_DTTIMEOUT_FLAG | SDIO_DTBLKCMPL_FLAG | SDIO_SBITERR_FLAG)))
2563 {
2564 if(sdio_flag_get(SDIOx, SDIO_RXBUF_FLAG) != RESET)
2565 {
2566 *(tmp_ext_csd + index) = sdio_data_read(SDIOx);
2567 index++;
2568 }
2569 sts_reg = SDIOx->sts;
2570 }
2571 if(sdio_flag_get(SDIOx, SDIO_DTTIMEOUT_FLAG) != RESET)
2572 {
2573 sdio_flag_clear(SDIOx, SDIO_DTTIMEOUT_FLAG);
2574 return SD_DATA_TIMEOUT;
2575 }
2576 else if(sdio_flag_get(SDIOx, SDIO_DTFAIL_FLAG) != RESET)
2577 {
2578 sdio_flag_clear(SDIOx, SDIO_DTFAIL_FLAG);
2579 return SD_DATA_FAIL;
2580 }
2581 else if(sdio_flag_get(SDIOx, SDIO_RXERRO_FLAG) != RESET)
2582 {
2583 sdio_flag_clear(SDIOx, SDIO_RXERRO_FLAG);
2584 return SD_RX_OVERRUN;
2585 }
2586 else if(sdio_flag_get(SDIOx, SDIO_SBITERR_FLAG) != RESET)
2587 {
2588 sdio_flag_clear(SDIOx, SDIO_SBITERR_FLAG);
2589 return SD_START_BIT_ERR;
2590 }
2591
2592 sdio_flag_clear(SDIOx, SDIO_STATIC_FLAGS);
2593
2594 return status;
2595}
2596
2601 sd_error_status_type scr_find(void)
2602{
2603 uint32_t index = 0, sts_reg = 0;
2604 sd_error_status_type status = SD_OK;
2605 uint32_t *tempscr;
2606
2607 tempscr = (uint32_t *) &(sd_card_info.sd_scr_reg);
2608
2609 /* send cmd16, set block length */
2610 sdio_command_init_struct.argument = (uint32_t)8;
2611 sdio_command_init_struct.cmd_index = SD_CMD_SET_BLOCKLEN;
2612 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
2613 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
2614
2615 /* sdio command config */
2616 sdio_command_config(SDIOx, &sdio_command_init_struct);
2617 /* enable ccsm */
2618 sdio_command_state_machine_enable(SDIOx, TRUE);
2619
2620 status = command_rsp1_error(SD_CMD_SET_BLOCKLEN);
2621
2622 if(status != SD_OK)
2623 {
2624 return status;
2625 }
2626
2627 /* send cmd55 */
2628 sdio_command_init_struct.argument = (uint32_t)(sd_card_info.rca << 16);
2629 sdio_command_init_struct.cmd_index = SD_CMD_APP_CMD;
2630 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
2631 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
2632
2633 /* sdio command config */
2634 sdio_command_config(SDIOx, &sdio_command_init_struct);
2635 /* enable ccsm */
2636 sdio_command_state_machine_enable(SDIOx, TRUE);
2637
2638 status = command_rsp1_error(SD_CMD_APP_CMD);
2639
2640 if(status != SD_OK)
2641 {
2642 return status;
2643 }
2644
2645 sdio_data_init_struct.block_size = SDIO_DATA_BLOCK_SIZE_8B;
2646 sdio_data_init_struct.data_length = 8;
2647 sdio_data_init_struct.timeout = SD_DATATIMEOUT;
2648 sdio_data_init_struct.transfer_direction = SDIO_DATA_TRANSFER_TO_CONTROLLER;
2649 sdio_data_init_struct.transfer_mode = SDIO_DATA_BLOCK_TRANSFER;
2650
2651 sdio_data_config(SDIOx, &sdio_data_init_struct);
2652 sdio_data_state_machine_enable(SDIOx, TRUE);
2653
2654 /* send cmd51 */
2655 sdio_command_init_struct.argument = 0x0;
2656 sdio_command_init_struct.cmd_index = SD_CMD_SD_APP_SEND_SCR;
2657 sdio_command_init_struct.rsp_type = SDIO_RESPONSE_SHORT;
2658 sdio_command_init_struct.wait_type = SDIO_WAIT_FOR_NO;
2659
2660 /* sdio command config */
2661 sdio_command_config(SDIOx, &sdio_command_init_struct);
2662 /* enable ccsm */
2663 sdio_command_state_machine_enable(SDIOx, TRUE);
2664
2665 status = command_rsp1_error(SD_CMD_SD_APP_SEND_SCR);
2666
2667 if(status != SD_OK)
2668 {
2669 return status;
2670 }
2671
2672 sts_reg = SDIOx->sts;
2673
2674 while(!(sts_reg & (SDIO_RXERRO_FLAG | SDIO_DTFAIL_FLAG | SDIO_DTTIMEOUT_FLAG | SDIO_DTBLKCMPL_FLAG | SDIO_SBITERR_FLAG)))
2675 {
2676 if(sdio_flag_get(SDIOx, SDIO_RXBUF_FLAG) != RESET)
2677 {
2678 *(tempscr + index) = sdio_data_read(SDIOx);
2679 index++;
2680 }
2681 sts_reg = SDIOx->sts;
2682 }
2683
2684 if(sdio_flag_get(SDIOx, SDIO_DTTIMEOUT_FLAG) != RESET)
2685 {
2686 sdio_flag_clear(SDIOx, SDIO_DTTIMEOUT_FLAG);
2687 return SD_DATA_TIMEOUT;
2688 }
2689 else if(sdio_flag_get(SDIOx, SDIO_DTFAIL_FLAG) != RESET)
2690 {
2691 sdio_flag_clear(SDIOx, SDIO_DTFAIL_FLAG);
2692 return SD_DATA_FAIL;
2693 }
2694 else if(sdio_flag_get(SDIOx, SDIO_RXERRO_FLAG) != RESET)
2695 {
2696 sdio_flag_clear(SDIOx, SDIO_RXERRO_FLAG);
2697 return SD_RX_OVERRUN;
2698 }
2699 else if(sdio_flag_get(SDIOx, SDIO_SBITERR_FLAG) != RESET)
2700 {
2701 sdio_flag_clear(SDIOx, SDIO_SBITERR_FLAG);
2702 return SD_START_BIT_ERR;
2703 }
2704
2705 sdio_flag_clear(SDIOx, SDIO_STATIC_FLAGS);
2706
2707 return status;
2708}
2709
2715 sd_error_status_type speed_change(uint8_t speed)
2716{
2717 sd_error_status_type status = SD_OK;
2718 uint8_t switch_sts[64];
2719
2720 if(speed > 1)
2721 {
2722 return SD_ERROR;
2723 }
2724
2725 /* check card type */
2726 if((SDIO_STD_CAPACITY_SD_CARD_V1_1 == card_type) || (SDIO_STD_CAPACITY_SD_CARD_V2_0 == card_type) || \
2727 (SDIO_HIGH_CAPACITY_SD_CARD == card_type))
2728 {
2729 /* version 1.01 card does not support cmd6 */
2730 if(sd_card_info.sd_scr_reg.sd_spec == 0)
2731 {
2732 return SD_ERROR;
2733 }
2734
2735 /* check group 1 function support speed */
2736 status = sd_switch(0, 0, speed, switch_sts);
2737
2738 if(status != 0)
2739 {
2740 return status;
2741 }
2742
2743 if((switch_sts[13] & (1 << speed)) == 0)
2744 {
2745 return SD_ERROR;
2746 }
2747
2748 status = sd_switch(1, 0, speed, switch_sts);
2749
2750 if(status != 0)
2751 {
2752 return status;
2753 }
2754
2755 /* read it back for confirmation */
2756 if((switch_sts[16] & 0xF) != speed)
2757 {
2758 return SD_ERROR;
2759 }
2760 }
2761 else if(card_type == SDIO_HIGH_SPEED_MULTIMEDIA_CARD || card_type == SDIO_HIGH_CAPACITY_MMC_CARD)
2762 {
2763 status = mmc_switch(EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BUS_WIDTH, (uint8_t)speed);
2764
2765 if(status != 0)
2766 {
2767 return status;
2768 }
2769 }
2770
2771 return status;
2772}
2773
2779uint8_t convert_from_bytes_to_power_of_two(uint16_t number_of_bytes)
2780{
2781 uint8_t count = 0;
2782
2783 while(number_of_bytes != 1)
2784 {
2785 number_of_bytes >>= 1;
2786 count++;
2787 }
2788
2789 return count;
2790}
2791
2800void sd_dma_config(uint32_t *mbuf, uint32_t buf_size, dma_dir_type dir)
2801{
2802 dma_init_type dma_init_struct;
2803 dma_default_para_init(&dma_init_struct);
2804
2805 crm_periph_clock_enable(CRM_DMA2_PERIPH_CLOCK, TRUE);
2806
2807 dma_reset(DMA2_CHANNEL4);
2808 dma_channel_enable(DMA2_CHANNEL4, FALSE);
2809
2810 dma_init_struct.peripheral_base_addr = (uint32_t)&SDIOx->buf;
2811 dma_init_struct.memory_base_addr = (uint32_t)mbuf;
2812 dma_init_struct.direction = dir;
2813 dma_init_struct.buffer_size = buf_size / 4;
2814 dma_init_struct.peripheral_inc_enable = FALSE;
2815 dma_init_struct.memory_inc_enable = TRUE;
2816 dma_init_struct.peripheral_data_width = DMA_PERIPHERAL_DATA_WIDTH_WORD;
2817 dma_init_struct.memory_data_width = DMA_MEMORY_DATA_WIDTH_WORD;
2818 dma_init_struct.loop_mode_enable = FALSE;
2819 dma_init_struct.priority = DMA_PRIORITY_HIGH;
2820 dma_init(DMA2_CHANNEL4, &dma_init_struct);
2821
2822 dma_channel_enable(DMA2_CHANNEL4, TRUE);
2823}
2824
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
gpio_init_struct
gpio_init_type gpio_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:37
dma_init_struct
dma_init_type dma_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:38
sd_card_info
sd_card_info_struct_type sd_card_info
Definition sdio_fatfs/src/at32_sdio.c:49
sd_switch
sd_error_status_type sd_switch(uint32_t mode, uint32_t group, uint8_t value, uint8_t *rsp)
switch sd card speed to high speed
Definition sdio_fatfs/src/at32_sdio.c:2365
command_rsp5_error
sd_error_status_type command_rsp5_error(uint8_t cmd)
checks for error conditions for r5 response.
Definition sdio_fatfs/src/at32_sdio.c:2116
speed_change
sd_error_status_type speed_change(uint8_t speed)
set bus speed
Definition sdio_fatfs/src/at32_sdio.c:2715
sd_power_off
sd_error_status_type sd_power_off(void)
turns the sdio output signals off.
Definition sdio_fatfs/src/at32_sdio.c:426
sdio_data_init_struct
sdio_data_struct_type sdio_data_init_struct
Definition sdio_fatfs/src/at32_sdio.c:40
sd_irq_service
sd_error_status_type sd_irq_service(void)
allows to process all the interrupts that are high.
Definition sdio_fatfs/src/at32_sdio.c:1812
transfer_end
volatile uint8_t transfer_end
Definition sdio_fatfs/src/at32_sdio.c:48
command_rsp7_error
sd_error_status_type command_rsp7_error(void)
checks for error conditions for R7 response.
Definition sdio_fatfs/src/at32_sdio.c:1923
sd_device_mode_set
sd_error_status_type sd_device_mode_set(uint32_t mode)
set sdio work mode.
Definition sdio_fatfs/src/at32_sdio.c:809
card_type
static sd_memory_card_type card_type
Definition sdio_fatfs/src/at32_sdio.c:42
convert_from_bytes_to_power_of_two
uint8_t convert_from_bytes_to_power_of_two(uint16_t number_of_bytes)
converts the number of bytes in power of two and returns the power.
Definition sdio_fatfs/src/at32_sdio.c:2779
sd_card_info_get
sd_error_status_type sd_card_info_get(sd_card_info_struct_type *card_info)
returns information about specific card.
Definition sdio_fatfs/src/at32_sdio.c:555
sdio_command_init_struct
sdio_command_struct_type sdio_command_init_struct
Definition sdio_fatfs/src/at32_sdio.c:39
mmc_stream_write
sd_error_status_type mmc_stream_write(uint8_t *buf, long long addr, uint32_t len)
write mmc card data stream.
Definition sdio_fatfs/src/at32_sdio.c:1723
sd_card_init
sd_error_status_type sd_card_init(void)
intialises all cards or single card as the case may be card(s) come into standby state.
Definition sdio_fatfs/src/at32_sdio.c:440
sd_block_read
sd_error_status_type sd_block_read(uint8_t *buf, long long addr, uint16_t blk_size)
allows to read one block from a specified address in a card. the data transfer can be managed by dma ...
Definition sdio_fatfs/src/at32_sdio.c:1211
sd_deselect_select
sd_error_status_type sd_deselect_select(uint32_t addr)
selects od deselects the corresponding card.
Definition sdio_fatfs/src/at32_sdio.c:830
command_rsp6_error
sd_error_status_type command_rsp6_error(uint8_t cmd, uint16_t *p_rca)
checks for error conditions for r6 (rca) response.
Definition sdio_fatfs/src/at32_sdio.c:2179
SDIO1_IRQHandler
void SDIO1_IRQHandler(void)
sdio1 isr.
Definition sdio_fatfs/src/at32_sdio.c:1792
stop_flag
static uint8_t stop_flag
Definition sdio_fatfs/src/at32_sdio.c:46
mmc_switch
sd_error_status_type mmc_switch(uint8_t set, uint8_t index, uint8_t value)
switch mmc card speed to high speed
Definition sdio_fatfs/src/at32_sdio.c:2314
sd_blocks_erase
sd_error_status_type sd_blocks_erase(long long addr, uint32_t nblks)
erase continuous data block
Definition sdio_fatfs/src/at32_sdio.c:1053
get_ext_csd
sd_error_status_type get_ext_csd(void)
find the sd card ext csd register value.
Definition sdio_fatfs/src/at32_sdio.c:2530
check_card_programming
sd_error_status_type check_card_programming(uint8_t *p_status)
checks if the sd card is in programming state.
Definition sdio_fatfs/src/at32_sdio.c:2421
transfer_error
volatile sd_error_status_type transfer_error
Definition sdio_fatfs/src/at32_sdio.c:47
sd_bus_wide_enable
sd_error_status_type sd_bus_wide_enable(confirm_state new_state)
enable or disable the sdio wide bus mode.
Definition sdio_fatfs/src/at32_sdio.c:2245
ext_csd_table
static uint32_t ext_csd_table[128]
Definition sdio_fatfs/src/at32_sdio.c:44
command_rsp1_error
sd_error_status_type command_rsp1_error(uint8_t cmd)
checks for error conditions for R1 response.
Definition sdio_fatfs/src/at32_sdio.c:1960
SDIO2_IRQHandler
void SDIO2_IRQHandler(void)
sdio2 isr.
Definition sdio_fatfs/src/at32_sdio.c:1802
sd_mult_blocks_write
sd_error_status_type sd_mult_blocks_write(const uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks)
allows to write blocks starting from a specified address in a card. the data transfer can be managed ...
Definition sdio_fatfs/src/at32_sdio.c:1512
csd_table
static uint32_t csd_table[4]
Definition sdio_fatfs/src/at32_sdio.c:43
sdio_clock_set
void sdio_clock_set(uint32_t clk_div)
set sdio clock devision factor.
Definition sdio_fatfs/src/at32_sdio.c:210
sd_state_get
sd_card_state_type sd_state_get(void)
returns information about sd card.
Definition sdio_fatfs/src/at32_sdio.c:2512
cid_table
static uint32_t cid_table[4]
Definition sdio_fatfs/src/at32_sdio.c:43
sd_dma_config
void sd_dma_config(uint32_t *mbuf, uint32_t buf_size, dma_dir_type dir)
set dma configuation for sdio
Definition sdio_fatfs/src/at32_sdio.c:2800
sd_block_write
sd_error_status_type sd_block_write(const uint8_t *buf, long long addr, uint16_t blk_size)
allows to write one block starting from a specified address in a card. the data transfer can be manag...
Definition sdio_fatfs/src/at32_sdio.c:1390
device_mode
static sd_data_transfer_mode_type device_mode
Definition sdio_fatfs/src/at32_sdio.c:45
sd_status_send
sd_error_status_type sd_status_send(uint32_t *p_card_status)
read current card status.
Definition sdio_fatfs/src/at32_sdio.c:2475
sdio_command_data_send
sd_error_status_type sdio_command_data_send(sdio_command_struct_type *sdio_cmd_init_t, sdio_data_struct_type *sdio_data_init_t, uint32_t *buf)
read data from or write data to sd card.
Definition sdio_fatfs/src/at32_sdio.c:853
command_rsp2_error
sd_error_status_type command_rsp2_error(void)
checks for error conditions for R2 (cid or csd) response.
Definition sdio_fatfs/src/at32_sdio.c:2033
sd_init
sd_error_status_type sd_init(void)
initializes the sd card and put it into standby state (ready for data transfer).
Definition sdio_fatfs/src/at32_sdio.c:74
mmc_stream_read
sd_error_status_type mmc_stream_read(uint8_t *buf, long long addr, uint32_t len)
read mmc card data stream.
Definition sdio_fatfs/src/at32_sdio.c:1676
scr_find
sd_error_status_type scr_find(void)
find the sd card scr register value.
Definition sdio_fatfs/src/at32_sdio.c:2601
sd_power_on
sd_error_status_type sd_power_on(void)
enquires cards about their operating voltage and configures clock controls.
Definition sdio_fatfs/src/at32_sdio.c:225
command_rsp4_error
sd_error_status_type command_rsp4_error(uint8_t cmd)
checks for error conditions for r4 response.
Definition sdio_fatfs/src/at32_sdio.c:2073
sd_mult_blocks_read
sd_error_status_type sd_mult_blocks_read(uint8_t *buf, long long addr, uint16_t blk_size, uint32_t nblks)
allows to read blocks from a specified address in a card. the data transfer can be managed by dma mod...
Definition sdio_fatfs/src/at32_sdio.c:1300
sd_wide_bus_operation_config
sd_error_status_type sd_wide_bus_operation_config(sdio_bus_width_type mode)
enable wide bus opeartion for the requeseted card if supported by card.
Definition sdio_fatfs/src/at32_sdio.c:766
rca
static uint32_t rca
Definition sdio_fatfs/src/at32_sdio.c:43
command_rsp3_error
sd_error_status_type command_rsp3_error(void)
checks for error conditions for R3 (ocr) response.
Definition sdio_fatfs/src/at32_sdio.c:2003
command_error
sd_error_status_type command_error(void)
checks for error conditions for cmd0.
Definition sdio_fatfs/src/at32_sdio.c:1896
system_core_clock
unsigned int system_core_clock
Definition system_at32f413.c:47
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_SDIO1_PERIPH_CLOCK
@ CRM_SDIO1_PERIPH_CLOCK
Definition at32f413_crm.h:106
CRM_GPIOC_PERIPH_CLOCK
@ CRM_GPIOC_PERIPH_CLOCK
Definition at32f413_crm.h:111
CRM_GPIOD_PERIPH_CLOCK
@ CRM_GPIOD_PERIPH_CLOCK
Definition at32f413_crm.h:112
CRM_DMA2_PERIPH_CLOCK
@ CRM_DMA2_PERIPH_CLOCK
Definition at32f413_crm.h:104
dma_channel_enable
void dma_channel_enable(dma_channel_type *dmax_channely, confirm_state new_state)
enable or disable dma channely
Definition at32f413_dma.c:197
dma_default_para_init
void dma_default_para_init(dma_init_type *dma_init_struct)
dma init config with its default value.
Definition at32f413_dma.c:407
dma_reset
void dma_reset(dma_channel_type *dmax_channely)
reset the dmax channely registers.
Definition at32f413_dma.c:63
dma_init
void dma_init(dma_channel_type *dmax_channely, dma_init_type *dma_init_struct)
dma init
Definition at32f413_dma.c:442
dma_dir_type
dma_dir_type
dma direction type
Definition at32f413_dma.h:215
DMA_PERIPHERAL_DATA_WIDTH_WORD
@ DMA_PERIPHERAL_DATA_WIDTH_WORD
Definition at32f413_dma.h:247
DMA_DIR_MEMORY_TO_PERIPHERAL
@ DMA_DIR_MEMORY_TO_PERIPHERAL
Definition at32f413_dma.h:217
DMA_DIR_PERIPHERAL_TO_MEMORY
@ DMA_DIR_PERIPHERAL_TO_MEMORY
Definition at32f413_dma.h:216
DMA_MEMORY_DATA_WIDTH_WORD
@ DMA_MEMORY_DATA_WIDTH_WORD
Definition at32f413_dma.h:257
DMA_PRIORITY_HIGH
@ DMA_PRIORITY_HIGH
Definition at32f413_dma.h:267
DMA2_CHANNEL4
#define DMA2_CHANNEL4
Definition at32f413_dma.h:492
confirm_state
confirm_state
confirm state
Definition at32f413.h:297
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_NONE
@ GPIO_PULL_NONE
Definition at32f413_gpio.h:243
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_10
#define GPIO_PINS_10
Definition at32f413_gpio.h:60
GPIO_PINS_11
#define GPIO_PINS_11
Definition at32f413_gpio.h:61
GPIO_PINS_2
#define GPIO_PINS_2
Definition at32f413_gpio.h:52
GPIO_PINS_12
#define GPIO_PINS_12
Definition at32f413_gpio.h:62
GPIO_PINS_9
#define GPIO_PINS_9
Definition at32f413_gpio.h:59
GPIO_PINS_8
#define GPIO_PINS_8
Definition at32f413_gpio.h:58
GPIOC
#define GPIOC
Definition at32f413_gpio.h:749
GPIOD
#define GPIOD
Definition at32f413_gpio.h:750
SDIO_SEND_IF_COND
#define SDIO_SEND_IF_COND
Definition emmc_card/inc/at32_sdio.h:438
SD_CMD_SD_APP_SEND_SCR
#define SD_CMD_SD_APP_SEND_SCR
Definition emmc_card/inc/at32_sdio.h:309
SD_CMD_ERASE
#define SD_CMD_ERASE
Definition emmc_card/inc/at32_sdio.h:292
SD_CMD_APP_SD_SET_BUSWIDTH
#define SD_CMD_APP_SD_SET_BUSWIDTH
Definition emmc_card/inc/at32_sdio.h:304
SD_CMD_WRITE_SINGLE_BLOCK
#define SD_CMD_WRITE_SINGLE_BLOCK
Definition emmc_card/inc/at32_sdio.h:281
SD_CMD_SD_ERASE_GRP_START
#define SD_CMD_SD_ERASE_GRP_START
Definition emmc_card/inc/at32_sdio.h:288
SD_CMD_APP_CMD
#define SD_CMD_APP_CMD
Definition emmc_card/inc/at32_sdio.h:296
SD_CMD_ALL_SEND_CID
#define SD_CMD_ALL_SEND_CID
Definition emmc_card/inc/at32_sdio.h:261
SD_CMD_STOP_TRANSMISSION
#define SD_CMD_STOP_TRANSMISSION
Definition emmc_card/inc/at32_sdio.h:271
SD_CMD_SEND_STATUS
#define SD_CMD_SEND_STATUS
Definition emmc_card/inc/at32_sdio.h:272
SD_CMD_SET_BLOCK_COUNT
#define SD_CMD_SET_BLOCK_COUNT
Definition emmc_card/inc/at32_sdio.h:280
SD_CMD_WRITE_DAT_UNTIL_STOP
#define SD_CMD_WRITE_DAT_UNTIL_STOP
Definition emmc_card/inc/at32_sdio.h:279
SD_CMD_SEND_OP_COND
#define SD_CMD_SEND_OP_COND
Definition emmc_card/inc/at32_sdio.h:260
SD_CMD_SET_BLOCKLEN
#define SD_CMD_SET_BLOCKLEN
Definition emmc_card/inc/at32_sdio.h:275
SD_CMD_HS_SWITCH
#define SD_CMD_HS_SWITCH
Definition emmc_card/inc/at32_sdio.h:265
SD_CMD_READ_SINGLE_BLOCK
#define SD_CMD_READ_SINGLE_BLOCK
Definition emmc_card/inc/at32_sdio.h:276
SD_CMD_SD_APP_OP_COND
#define SD_CMD_SD_APP_OP_COND
Definition emmc_card/inc/at32_sdio.h:307
SD_CMD_GO_IDLE_STATE
#define SD_CMD_GO_IDLE_STATE
Definition emmc_card/inc/at32_sdio.h:259
SD_CMD_SET_REL_ADDR
#define SD_CMD_SET_REL_ADDR
Definition emmc_card/inc/at32_sdio.h:262
SD_CMD_ERASE_GRP_END
#define SD_CMD_ERASE_GRP_END
Definition emmc_card/inc/at32_sdio.h:291
SD_CMD_READ_DAT_UNTIL_STOP
#define SD_CMD_READ_DAT_UNTIL_STOP
Definition emmc_card/inc/at32_sdio.h:270
SD_CMD_SD_ERASE_GRP_END
#define SD_CMD_SD_ERASE_GRP_END
Definition emmc_card/inc/at32_sdio.h:289
SD_CMD_ERASE_GRP_START
#define SD_CMD_ERASE_GRP_START
Definition emmc_card/inc/at32_sdio.h:290
SD_CMD_HS_SEND_EXT_CSD
#define SD_CMD_HS_SEND_EXT_CSD
Definition emmc_card/inc/at32_sdio.h:267
SD_CMD_SEL_DESEL_CARD
#define SD_CMD_SEL_DESEL_CARD
Definition emmc_card/inc/at32_sdio.h:266
SD_CMD_WRITE_MULT_BLOCK
#define SD_CMD_WRITE_MULT_BLOCK
Definition emmc_card/inc/at32_sdio.h:282
SD_CMD_READ_MULT_BLOCK
#define SD_CMD_READ_MULT_BLOCK
Definition emmc_card/inc/at32_sdio.h:277
SD_CMD_SEND_CSD
#define SD_CMD_SEND_CSD
Definition emmc_card/inc/at32_sdio.h:268
sdio_command_config
void sdio_command_config(sdio_type *sdio_x, sdio_command_struct_type *command_struct)
config sdio command.
Definition at32f413_sdio.c:372
sdio_data_write
void sdio_data_write(sdio_type *sdio_x, uint32_t data)
write one word data to fifo.
Definition at32f413_sdio.c:533
sdio_data_config
void sdio_data_config(sdio_type *sdio_x, sdio_data_struct_type *data_struct)
config sdio data.
Definition at32f413_sdio.c:459
sdio_data_read
uint32_t sdio_data_read(sdio_type *sdio_x)
read a word data from sdio fifo.
Definition at32f413_sdio.c:508
sdio_command_state_machine_enable
void sdio_command_state_machine_enable(sdio_type *sdio_x, confirm_state new_state)
enable or disable command path state machine(CPSM).
Definition at32f413_sdio.c:395
sdio_clock_bypass
void sdio_clock_bypass(sdio_type *sdio_x, confirm_state new_state)
enable or disable clock divider bypss
Definition at32f413_sdio.c:140
sdio_flow_control_enable
void sdio_flow_control_enable(sdio_type *sdio_x, confirm_state new_state)
enable or disable hardware flow control.
Definition at32f413_sdio.c:167
sdio_power_set
void sdio_power_set(sdio_type *sdio_x, sdio_power_state_type power_state)
set the power status of the controller
Definition at32f413_sdio.c:74
sdio_clock_config
void sdio_clock_config(sdio_type *sdio_x, uint16_t clk_div, sdio_edge_phase_type clk_edg)
config sdio clock
Definition at32f413_sdio.c:103
sdio_bus_width_config
void sdio_bus_width_config(sdio_type *sdio_x, sdio_bus_width_type width)
config sdio bus width
Definition at32f413_sdio.c:127
sdio_interrupt_enable
void sdio_interrupt_enable(sdio_type *sdio_x, uint32_t int_opt, confirm_state new_state)
config corresponding interrupt.
Definition at32f413_sdio.c:231
sdio_flag_clear
void sdio_flag_clear(sdio_type *sdio_x, uint32_t flag)
clear sdio flag.
Definition at32f413_sdio.c:358
sdio_power_status_get
sdio_power_state_type sdio_power_status_get(sdio_type *sdio_x)
get power status.
Definition at32f413_sdio.c:86
sdio_response_get
uint32_t sdio_response_get(sdio_type *sdio_x, sdio_rsp_index_type reg_index)
get response received from the card for the last command.
Definition at32f413_sdio.c:426
sdio_data_state_machine_enable
void sdio_data_state_machine_enable(sdio_type *sdio_x, confirm_state new_state)
enable or disable data path state machine(DPSM).
Definition at32f413_sdio.c:484
sdio_power_saving_mode_enable
void sdio_power_saving_mode_enable(sdio_type *sdio_x, confirm_state new_state)
enable or disable power saving mode, config sdio_ck clock output when the bus is idle.
Definition at32f413_sdio.c:154
sdio_flag_get
flag_status sdio_flag_get(sdio_type *sdio_x, uint32_t flag)
get sdio flag.
Definition at32f413_sdio.c:321
sdio_dma_enable
void sdio_dma_enable(sdio_type *sdio_x, confirm_state new_state)
enable or disable dma.
Definition at32f413_sdio.c:193
sdio_reset
void sdio_reset(sdio_type *sdio_x)
reset the sdio register
Definition at32f413_sdio.c:50
sdio_interrupt_flag_get
flag_status sdio_interrupt_flag_get(sdio_type *sdio_x, uint32_t flag)
get sdio interrupt flag.
Definition at32f413_sdio.c:277
sdio_clock_enable
void sdio_clock_enable(sdio_type *sdio_x, confirm_state new_state)
enable or disable sdio_ck output.
Definition at32f413_sdio.c:180
sdio_command_response_get
uint8_t sdio_command_response_get(sdio_type *sdio_x)
get command index of last command for which response received.
Definition at32f413_sdio.c:408
sd_data_transfer_mode_type
sd_data_transfer_mode_type
Definition emmc_card/inc/at32_sdio.h:64
sd_error_status_type
sd_error_status_type
Definition emmc_card/inc/at32_sdio.h:73
sd_card_state_type
sd_card_state_type
Definition emmc_card/inc/at32_sdio.h:186
sdio_bus_width_type
sdio_bus_width_type
sdio bus width
Definition at32f413_sdio.h:138
sd_memory_card_type
sd_memory_card_type
Definition emmc_card/inc/at32_sdio.h:202
sdio_block_size_type
sdio_block_size_type
sdio data block size
Definition at32f413_sdio.h:179
SDIO_WAIT_FOR_NO
@ SDIO_WAIT_FOR_NO
Definition at32f413_sdio.h:159
SDIO_RESPONSE_LONG
@ SDIO_RESPONSE_LONG
Definition at32f413_sdio.h:151
SDIO_RESPONSE_SHORT
@ SDIO_RESPONSE_SHORT
Definition at32f413_sdio.h:150
SDIO_RESPONSE_NO
@ SDIO_RESPONSE_NO
Definition at32f413_sdio.h:149
SD_TRANSFER_DMA_MODE
@ SD_TRANSFER_DMA_MODE
Definition emmc_card/inc/at32_sdio.h:66
SD_TRANSFER_POLLING_MODE
@ SD_TRANSFER_POLLING_MODE
Definition emmc_card/inc/at32_sdio.h:65
SD_ERROR
@ SD_ERROR
Definition emmc_card/inc/at32_sdio.h:117
SD_SDIO_UNKNOWN_FUNC
@ SD_SDIO_UNKNOWN_FUNC
Definition emmc_card/inc/at32_sdio.h:107
SD_DATA_FAIL
@ SD_DATA_FAIL
Definition emmc_card/inc/at32_sdio.h:76
SD_INVALID_PARAMETER
@ SD_INVALID_PARAMETER
Definition emmc_card/inc/at32_sdio.h:114
SD_CMD_FAIL
@ SD_CMD_FAIL
Definition emmc_card/inc/at32_sdio.h:75
SD_CMD_OUT_OF_RANGE
@ SD_CMD_OUT_OF_RANGE
Definition emmc_card/inc/at32_sdio.h:82
SD_GENERAL_UNKNOWN_ERROR
@ SD_GENERAL_UNKNOWN_ERROR
Definition emmc_card/inc/at32_sdio.h:93
SD_UNSUPPORTED_FEATURE
@ SD_UNSUPPORTED_FEATURE
Definition emmc_card/inc/at32_sdio.h:115
SD_TX_UNDERRUN
@ SD_TX_UNDERRUN
Definition emmc_card/inc/at32_sdio.h:79
SD_ILLEGAL_CMD
@ SD_ILLEGAL_CMD
Definition emmc_card/inc/at32_sdio.h:90
SD_CMD_CRC_ERROR
@ SD_CMD_CRC_ERROR
Definition emmc_card/inc/at32_sdio.h:89
SD_RX_OVERRUN
@ SD_RX_OVERRUN
Definition emmc_card/inc/at32_sdio.h:80
SD_REQ_NOT_APPLICABLE
@ SD_REQ_NOT_APPLICABLE
Definition emmc_card/inc/at32_sdio.h:113
SD_SWITCH_ERROR
@ SD_SWITCH_ERROR
Definition emmc_card/inc/at32_sdio.h:103
SD_INVALID_VOLTRANGE
@ SD_INVALID_VOLTRANGE
Definition emmc_card/inc/at32_sdio.h:101
SD_DATA_TIMEOUT
@ SD_DATA_TIMEOUT
Definition emmc_card/inc/at32_sdio.h:78
SD_START_BIT_ERR
@ SD_START_BIT_ERR
Definition emmc_card/inc/at32_sdio.h:81
SD_LOCK_UNLOCK_ERROR
@ SD_LOCK_UNLOCK_ERROR
Definition emmc_card/inc/at32_sdio.h:88
SD_CMD_RSP_TIMEOUT
@ SD_CMD_RSP_TIMEOUT
Definition emmc_card/inc/at32_sdio.h:77
SD_OK
@ SD_OK
Definition emmc_card/inc/at32_sdio.h:118
SDIO_CLOCK_EDGE_FALLING
@ SDIO_CLOCK_EDGE_FALLING
Definition at32f413_sdio.h:131
SDIO_DATA_TRANSFER_TO_CARD
@ SDIO_DATA_TRANSFER_TO_CARD
Definition at32f413_sdio.h:211
SDIO_DATA_TRANSFER_TO_CONTROLLER
@ SDIO_DATA_TRANSFER_TO_CONTROLLER
Definition at32f413_sdio.h:212
SDIO_POWER_OFF
@ SDIO_POWER_OFF
Definition at32f413_sdio.h:121
SDIO_POWER_ON
@ SDIO_POWER_ON
Definition at32f413_sdio.h:122
SD_CARD_ERROR
@ SD_CARD_ERROR
Definition emmc_card/inc/at32_sdio.h:195
SDIO_DATA_BLOCK_TRANSFER
@ SDIO_DATA_BLOCK_TRANSFER
Definition at32f413_sdio.h:202
SDIO_DATA_STREAM_TRANSFER
@ SDIO_DATA_STREAM_TRANSFER
Definition at32f413_sdio.h:203
SDIO_BUS_WIDTH_D1
@ SDIO_BUS_WIDTH_D1
Definition at32f413_sdio.h:139
SDIO_BUS_WIDTH_D4
@ SDIO_BUS_WIDTH_D4
Definition at32f413_sdio.h:140
SDIO_RSP3_INDEX
@ SDIO_RSP3_INDEX
Definition at32f413_sdio.h:171
SDIO_RSP2_INDEX
@ SDIO_RSP2_INDEX
Definition at32f413_sdio.h:170
SDIO_RSP4_INDEX
@ SDIO_RSP4_INDEX
Definition at32f413_sdio.h:172
SDIO_RSP1_INDEX
@ SDIO_RSP1_INDEX
Definition at32f413_sdio.h:169
SDIO_HIGH_CAPACITY_SD_CARD
@ SDIO_HIGH_CAPACITY_SD_CARD
Definition emmc_card/inc/at32_sdio.h:205
SDIO_SECURE_DIGITAL_IO_COMBO_CARD
@ SDIO_SECURE_DIGITAL_IO_COMBO_CARD
Definition emmc_card/inc/at32_sdio.h:209
SDIO_HIGH_SPEED_MULTIMEDIA_CARD
@ SDIO_HIGH_SPEED_MULTIMEDIA_CARD
Definition emmc_card/inc/at32_sdio.h:208
SDIO_STD_CAPACITY_SD_CARD_V1_1
@ SDIO_STD_CAPACITY_SD_CARD_V1_1
Definition emmc_card/inc/at32_sdio.h:203
SDIO_SECURE_DIGITAL_IO_CARD
@ SDIO_SECURE_DIGITAL_IO_CARD
Definition emmc_card/inc/at32_sdio.h:207
SDIO_STD_CAPACITY_SD_CARD_V2_0
@ SDIO_STD_CAPACITY_SD_CARD_V2_0
Definition emmc_card/inc/at32_sdio.h:204
SDIO_MULTIMEDIA_CARD
@ SDIO_MULTIMEDIA_CARD
Definition emmc_card/inc/at32_sdio.h:206
SDIO_HIGH_CAPACITY_MMC_CARD
@ SDIO_HIGH_CAPACITY_MMC_CARD
Definition emmc_card/inc/at32_sdio.h:210
SDIO_DATA_BLOCK_SIZE_8B
@ SDIO_DATA_BLOCK_SIZE_8B
Definition at32f413_sdio.h:183
SDIO_DATA_BLOCK_SIZE_1B
@ SDIO_DATA_BLOCK_SIZE_1B
Definition at32f413_sdio.h:180
SDIO_DATA_BLOCK_SIZE_512B
@ SDIO_DATA_BLOCK_SIZE_512B
Definition at32f413_sdio.h:189
SDIO_CMDTIMEOUT_FLAG
#define SDIO_CMDTIMEOUT_FLAG
Definition at32f413_sdio.h:86
SDIO_TXBUFH_FLAG
#define SDIO_TXBUFH_FLAG
Definition at32f413_sdio.h:98
SDIO_CMDCMPL_FLAG
#define SDIO_CMDCMPL_FLAG
Definition at32f413_sdio.h:91
SDIO_DTFAIL_FLAG
#define SDIO_DTFAIL_FLAG
Definition at32f413_sdio.h:85
SDIO_RXERRO_FLAG
#define SDIO_RXERRO_FLAG
Definition at32f413_sdio.h:89
SDIO_RXBUFH_FLAG
#define SDIO_RXBUFH_FLAG
Definition at32f413_sdio.h:99
SDIO_RXBUF_FLAG
#define SDIO_RXBUF_FLAG
Definition at32f413_sdio.h:105
SDIO_CMDFAIL_FLAG
#define SDIO_CMDFAIL_FLAG
Definition at32f413_sdio.h:84
SDIO_CMDRSPCMPL_FLAG
#define SDIO_CMDRSPCMPL_FLAG
Definition at32f413_sdio.h:90
SDIO_DTBLKCMPL_FLAG
#define SDIO_DTBLKCMPL_FLAG
Definition at32f413_sdio.h:94
SDIO_DTTIMEOUT_FLAG
#define SDIO_DTTIMEOUT_FLAG
Definition at32f413_sdio.h:87
SDIO_SBITERR_FLAG
#define SDIO_SBITERR_FLAG
Definition at32f413_sdio.h:93
SDIO_DTCMPL_FLAG
#define SDIO_DTCMPL_FLAG
Definition at32f413_sdio.h:92
SDIO_TXERRU_FLAG
#define SDIO_TXERRU_FLAG
Definition at32f413_sdio.h:88
SDIOx
#define SDIOx
Definition emmc_card/inc/at32_sdio.h:50
SDIO_INTR_STS_WRITE_MASK
#define SDIO_INTR_STS_WRITE_MASK
Definition emmc_card/inc/at32_sdio.h:474
SDIO_INTR_STS_READ_MASK
#define SDIO_INTR_STS_READ_MASK
Definition emmc_card/inc/at32_sdio.h:476
SDIO_SBITERR_INT
#define SDIO_SBITERR_INT
Definition at32f413_sdio.h:60
SDIO_RXBUFH_INT
#define SDIO_RXBUFH_INT
Definition at32f413_sdio.h:66
SDIO_DTTIMEOUT_INT
#define SDIO_DTTIMEOUT_INT
Definition at32f413_sdio.h:54
SDIO_TXERRU_INT
#define SDIO_TXERRU_INT
Definition at32f413_sdio.h:55
SDIO_RXERRO_INT
#define SDIO_RXERRO_INT
Definition at32f413_sdio.h:56
SDIO_DTFAIL_INT
#define SDIO_DTFAIL_INT
Definition at32f413_sdio.h:52
SDIO_TXBUFH_INT
#define SDIO_TXBUFH_INT
Definition at32f413_sdio.h:65
SDIO_DTCMP_INT
#define SDIO_DTCMP_INT
Definition at32f413_sdio.h:59
EXT_CSD_BUS_WIDTH
#define EXT_CSD_BUS_WIDTH
Definition emmc_card/inc/at32_sdio.h:463
EXT_CSD_CMD_SET_NORMAL
#define EXT_CSD_CMD_SET_NORMAL
Definition emmc_card/inc/at32_sdio.h:456
EXT_CSD_Write_byte
#define EXT_CSD_Write_byte
Definition emmc_card/inc/at32_sdio.h:454
NULL
#define NULL
Definition emmc_card/inc/at32_sdio.h:340
SDIO_DATATIMEOUT
#define SDIO_DATATIMEOUT
Definition emmc_card/inc/at32_sdio.h:343
SDIO_CMD0TIMEOUT
#define SDIO_CMD0TIMEOUT
Definition emmc_card/inc/at32_sdio.h:342
SDIO_STATIC_FLAGS
#define SDIO_STATIC_FLAGS
Definition emmc_card/inc/at32_sdio.h:341
SD_CARD_LOCKED
#define SD_CARD_LOCKED
Definition emmc_card/inc/at32_sdio.h:400
SD_VOLTAGE_WINDOW_SD
#define SD_VOLTAGE_WINDOW_SD
Definition emmc_card/inc/at32_sdio.h:391
SD_R5_ERROR
#define SD_R5_ERROR
Definition emmc_card/inc/at32_sdio.h:383
SD_CARD_RECEIVING
#define SD_CARD_RECEIVING
Definition emmc_card/inc/at32_sdio.h:402
SD_R5_OUT_OF_RANGE
#define SD_R5_OUT_OF_RANGE
Definition emmc_card/inc/at32_sdio.h:381
SD_MAX_DATA_LENGTH
#define SD_MAX_DATA_LENGTH
Definition emmc_card/inc/at32_sdio.h:408
SD_STD_CAPACITY
#define SD_STD_CAPACITY
Definition emmc_card/inc/at32_sdio.h:393
SD_R5_FUNCTION_NUMBER
#define SD_R5_FUNCTION_NUMBER
Definition emmc_card/inc/at32_sdio.h:382
SD_R6_ILLEGAL_CMD
#define SD_R6_ILLEGAL_CMD
Definition emmc_card/inc/at32_sdio.h:389
SD_R6_GENERAL_UNKNOWN_ERROR
#define SD_R6_GENERAL_UNKNOWN_ERROR
Definition emmc_card/inc/at32_sdio.h:388
SD_MAX_VOLT_TRIAL
#define SD_MAX_VOLT_TRIAL
Definition emmc_card/inc/at32_sdio.h:396
SD_DATATIMEOUT
#define SD_DATATIMEOUT
Definition emmc_card/inc/at32_sdio.h:403
SD_ALLZERO
#define SD_ALLZERO
Definition emmc_card/inc/at32_sdio.h:397
SD_R6_CMD_CRC_ERROR
#define SD_R6_CMD_CRC_ERROR
Definition emmc_card/inc/at32_sdio.h:390
MMC_SWITCH_ERROR
#define MMC_SWITCH_ERROR
Definition emmc_card/inc/at32_sdio.h:374
SD_VOLTAGE_WINDOW_MMC
#define SD_VOLTAGE_WINDOW_MMC
Definition emmc_card/inc/at32_sdio.h:395
SD_CHECK_PATTERN
#define SD_CHECK_PATTERN
Definition emmc_card/inc/at32_sdio.h:394
SD_OCR_ERRORBITS
#define SD_OCR_ERRORBITS
Definition emmc_card/inc/at32_sdio.h:376
SD_CARD_PROGRAMMING
#define SD_CARD_PROGRAMMING
Definition emmc_card/inc/at32_sdio.h:401
SD_HIGH_CAPACITY
#define SD_HIGH_CAPACITY
Definition emmc_card/inc/at32_sdio.h:392
dma_init_type
dma init type
Definition at32f413_dma.h:275
dma_init_type::loop_mode_enable
confirm_state loop_mode_enable
Definition at32f413_dma.h:284
dma_init_type::buffer_size
uint16_t buffer_size
Definition at32f413_dma.h:279
dma_init_type::memory_data_width
dma_memory_data_size_type memory_data_width
Definition at32f413_dma.h:283
dma_init_type::priority
dma_priority_level_type priority
Definition at32f413_dma.h:285
dma_init_type::peripheral_inc_enable
confirm_state peripheral_inc_enable
Definition at32f413_dma.h:280
dma_init_type::memory_inc_enable
confirm_state memory_inc_enable
Definition at32f413_dma.h:281
dma_init_type::direction
dma_dir_type direction
Definition at32f413_dma.h:278
dma_init_type::peripheral_base_addr
uint32_t peripheral_base_addr
Definition at32f413_dma.h:276
dma_init_type::memory_base_addr
uint32_t memory_base_addr
Definition at32f413_dma.h:277
dma_init_type::peripheral_data_width
dma_peripheral_data_size_type peripheral_data_width
Definition at32f413_dma.h:282
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
sd_card_info_struct_type
Definition emmc_card/inc/at32_sdio.h:236
sd_card_info_struct_type::sd_scr_reg
sd_scr_struct_type sd_scr_reg
Definition emmc_card/inc/at32_sdio.h:239
sd_card_info_struct_type::card_capacity
long long card_capacity
Definition emmc_card/inc/at32_sdio.h:240
sd_card_info_struct_type::sd_cid_reg
sd_cid_struct_type sd_cid_reg
Definition emmc_card/inc/at32_sdio.h:238
sd_card_info_struct_type::sd_csd_reg
sd_csd_struct_type sd_csd_reg
Definition emmc_card/inc/at32_sdio.h:237
sd_card_info_struct_type::card_blk_size
uint32_t card_blk_size
Definition emmc_card/inc/at32_sdio.h:241
sd_card_info_struct_type::rca
uint16_t rca
Definition emmc_card/inc/at32_sdio.h:242
sd_card_info_struct_type::card_type
uint8_t card_type
Definition emmc_card/inc/at32_sdio.h:243
sd_cid_struct_type::reserved1
uint8_t reserved1
Definition emmc_card/inc/at32_sdio.h:176
sd_cid_struct_type::product_name2
uint8_t product_name2
Definition emmc_card/inc/at32_sdio.h:173
sd_cid_struct_type::manufact_date
uint16_t manufact_date
Definition emmc_card/inc/at32_sdio.h:177
sd_cid_struct_type::cid_crc
uint8_t cid_crc
Definition emmc_card/inc/at32_sdio.h:178
sd_cid_struct_type::product_reversion
uint8_t product_reversion
Definition emmc_card/inc/at32_sdio.h:174
sd_cid_struct_type::manufacturer_id
uint8_t manufacturer_id
Definition emmc_card/inc/at32_sdio.h:170
sd_cid_struct_type::product_sn
uint32_t product_sn
Definition emmc_card/inc/at32_sdio.h:175
sd_cid_struct_type::product_name1
uint32_t product_name1
Definition emmc_card/inc/at32_sdio.h:172
sd_cid_struct_type::reserved2
uint8_t reserved2
Definition emmc_card/inc/at32_sdio.h:179
sd_cid_struct_type::oem_app_id
uint16_t oem_app_id
Definition emmc_card/inc/at32_sdio.h:171
sd_csd_struct_type::spec_version
uint8_t spec_version
Definition emmc_card/inc/at32_sdio.h:127
sd_csd_struct_type::max_write_current_vdd_max
uint8_t max_write_current_vdd_max
Definition emmc_card/inc/at32_sdio.h:143
sd_csd_struct_type::nsac
uint8_t nsac
Definition emmc_card/inc/at32_sdio.h:130
sd_csd_struct_type::card_cmd_classes
uint16_t card_cmd_classes
Definition emmc_card/inc/at32_sdio.h:132
sd_csd_struct_type::part_blk_read
uint8_t part_blk_read
Definition emmc_card/inc/at32_sdio.h:134
sd_csd_struct_type::read_blk_misalign
uint8_t read_blk_misalign
Definition emmc_card/inc/at32_sdio.h:136
sd_csd_struct_type::content_protect_app
uint8_t content_protect_app
Definition emmc_card/inc/at32_sdio.h:154
sd_csd_struct_type::write_speed_factor
uint8_t write_speed_factor
Definition emmc_card/inc/at32_sdio.h:150
sd_csd_struct_type::max_read_blk_length
uint8_t max_read_blk_length
Definition emmc_card/inc/at32_sdio.h:133
sd_csd_struct_type::max_bus_clk_freq
uint8_t max_bus_clk_freq
Definition emmc_card/inc/at32_sdio.h:131
sd_csd_struct_type::ecc_code
uint8_t ecc_code
Definition emmc_card/inc/at32_sdio.h:160
sd_csd_struct_type::reserved4
uint8_t reserved4
Definition emmc_card/inc/at32_sdio.h:162
sd_csd_struct_type::dsr_implemented
uint8_t dsr_implemented
Definition emmc_card/inc/at32_sdio.h:137
sd_csd_struct_type::max_read_current_vdd_min
uint8_t max_read_current_vdd_min
Definition emmc_card/inc/at32_sdio.h:140
sd_csd_struct_type::reserved2
uint8_t reserved2
Definition emmc_card/inc/at32_sdio.h:138
sd_csd_struct_type::erase_group_size_mult
uint8_t erase_group_size_mult
Definition emmc_card/inc/at32_sdio.h:146
sd_csd_struct_type::file_formart
uint8_t file_formart
Definition emmc_card/inc/at32_sdio.h:159
sd_csd_struct_type::temp_write_protect
uint8_t temp_write_protect
Definition emmc_card/inc/at32_sdio.h:158
sd_csd_struct_type::permanent_write_protect
uint8_t permanent_write_protect
Definition emmc_card/inc/at32_sdio.h:157
sd_csd_struct_type::max_read_current_vdd_max
uint8_t max_read_current_vdd_max
Definition emmc_card/inc/at32_sdio.h:141
sd_csd_struct_type::file_format_group
uint8_t file_format_group
Definition emmc_card/inc/at32_sdio.h:155
sd_csd_struct_type::device_size
uint32_t device_size
Definition emmc_card/inc/at32_sdio.h:139
sd_csd_struct_type::write_blk_misalign
uint8_t write_blk_misalign
Definition emmc_card/inc/at32_sdio.h:135
sd_csd_struct_type::csd_struct
uint8_t csd_struct
Definition emmc_card/inc/at32_sdio.h:126
sd_csd_struct_type::write_protect_group_enable
uint8_t write_protect_group_enable
Definition emmc_card/inc/at32_sdio.h:148
sd_csd_struct_type::max_write_current_vdd_min
uint8_t max_write_current_vdd_min
Definition emmc_card/inc/at32_sdio.h:142
sd_csd_struct_type::reserved1
uint8_t reserved1
Definition emmc_card/inc/at32_sdio.h:128
sd_csd_struct_type::max_write_blk_length
uint8_t max_write_blk_length
Definition emmc_card/inc/at32_sdio.h:151
sd_csd_struct_type::csd_crc
uint8_t csd_crc
Definition emmc_card/inc/at32_sdio.h:161
sd_csd_struct_type::write_protect_group_size
uint8_t write_protect_group_size
Definition emmc_card/inc/at32_sdio.h:147
sd_csd_struct_type::reserved3
uint8_t reserved3
Definition emmc_card/inc/at32_sdio.h:153
sd_csd_struct_type::taac
uint8_t taac
Definition emmc_card/inc/at32_sdio.h:129
sd_csd_struct_type::manufacturer_default_ecc
uint8_t manufacturer_default_ecc
Definition emmc_card/inc/at32_sdio.h:149
sd_csd_struct_type::part_blk_write
uint8_t part_blk_write
Definition emmc_card/inc/at32_sdio.h:152
sd_csd_struct_type::copy_flag
uint8_t copy_flag
Definition emmc_card/inc/at32_sdio.h:156
sd_csd_struct_type::erase_group_size
uint8_t erase_group_size
Definition emmc_card/inc/at32_sdio.h:145
sd_csd_struct_type::device_size_mult
uint8_t device_size_mult
Definition emmc_card/inc/at32_sdio.h:144
sd_scr_struct_type::sd_bus_width
uint32_t sd_bus_width
Definition emmc_card/inc/at32_sdio.h:221
sd_scr_struct_type::sd_spec
uint32_t sd_spec
Definition emmc_card/inc/at32_sdio.h:219
sdio_command_struct_type
sdio command structure
Definition at32f413_sdio.h:228
sdio_command_struct_type::cmd_index
uint8_t cmd_index
Definition at32f413_sdio.h:230
sdio_command_struct_type::argument
uint32_t argument
Definition at32f413_sdio.h:229
sdio_command_struct_type::wait_type
sdio_wait_type wait_type
Definition at32f413_sdio.h:232
sdio_command_struct_type::rsp_type
sdio_reponse_type rsp_type
Definition at32f413_sdio.h:231
sdio_data_struct_type
sdio data structure
Definition at32f413_sdio.h:239
sdio_data_struct_type::block_size
sdio_block_size_type block_size
Definition at32f413_sdio.h:242
sdio_data_struct_type::transfer_direction
sdio_transfer_direction_type transfer_direction
Definition at32f413_sdio.h:244
sdio_data_struct_type::timeout
uint32_t timeout
Definition at32f413_sdio.h:240
sdio_data_struct_type::transfer_mode
sdio_transfer_mode_type transfer_mode
Definition at32f413_sdio.h:243
sdio_data_struct_type::data_length
uint32_t data_length
Definition at32f413_sdio.h:241


AT32F413 Firmwary Library: smartcard_config.h Source File

  • usart
  • smartcard
  • inc
smartcard_config.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __SMARTCARD_CONFIG_H
28#define __SMARTCARD_CONFIG_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* smartcard inteface usart pins */
35#define SC_USART USART2
36#define SC_USART_CLK CRM_USART2_PERIPH_CLOCK
37#define SC_USART_GPIO_CLK CRM_GPIOA_PERIPH_CLOCK
38#define SC_USART_TX_PIN GPIO_PINS_2
39#define SC_USART_TX_PORT GPIOA
40#define SC_USART_CLK_PIN GPIO_PINS_4
41#define SC_USART_CLK_PORT GPIOA
42#define SC_USART_IRQn USART2_IRQn
43#define SC_USART_IRQHandler USART2_IRQHandler
44
45/* smartcard inteface gpio pins */
46#define SC_3_5V_PIN GPIO_PINS_5
47#define SC_RESET_PIN GPIO_PINS_6
48#define SC_CMDVCC_PIN GPIO_PINS_7
49#define SC_OFF_PIN GPIO_PINS_8
50#define SC_3_5V_PORT GPIOA
51#define SC_RESET_PORT GPIOA
52#define SC_CMDVCC_PORT GPIOA
53#define SC_OFF_PORT GPIOA
54#define SC_3_5V_CLK CRM_GPIOA_PERIPH_CLOCK
55#define SC_RESET_CLK CRM_GPIOA_PERIPH_CLOCK
56#define SC_CMDVCC_CLK CRM_GPIOA_PERIPH_CLOCK
57#define SC_OFF_CLK CRM_GPIOA_PERIPH_CLOCK
58#define SC_OFF_EXINT EXINT_LINE_8
59#define SC_OFF_PORTSOURCE GPIO_PORT_SOURCE_GPIOA
60#define SC_OFF_PINSOURCE GPIO_PINS_SOURCE8
61#define SC_OFF_EXINT_IRQ EXINT9_5_IRQn
62
63#ifdef __cplusplus
64}
65#endif
66
67#endif /* __SMARTCARD_CONFIG_H */
68


AT32F413 Firmwary Library: spi_flash.c Source File

  • spi
  • w25q_flash
  • src
spi_flash.c
Go to the documentation of this file.
1
26#include "spi_flash.h"
27
36uint8_t spiflash_sector_buf[SPIF_SECTOR_SIZE];
37
43void spiflash_init(void)
44{
45 gpio_init_type gpio_initstructure;
46 spi_init_type spi_init_struct;
47
48 crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
49 crm_periph_clock_enable(CRM_DMA1_PERIPH_CLOCK, TRUE);
50 /* software cs, pb12 as a general io to control flash cs */
51 gpio_initstructure.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
52 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
53 gpio_initstructure.gpio_mode = GPIO_MODE_OUTPUT;
54 gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
55 gpio_initstructure.gpio_pins = GPIO_PINS_12;
56 gpio_init(GPIOB, &gpio_initstructure);
57
58 /* sck */
59 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
60 gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
61 gpio_initstructure.gpio_pins = GPIO_PINS_13;
62 gpio_init(GPIOB, &gpio_initstructure);
63
64 /* miso */
65 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
66 gpio_initstructure.gpio_mode = GPIO_MODE_INPUT;
67 gpio_initstructure.gpio_pins = GPIO_PINS_14;
68 gpio_init(GPIOB, &gpio_initstructure);
69
70 /* mosi */
71 gpio_initstructure.gpio_pull = GPIO_PULL_UP;
72 gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
73 gpio_initstructure.gpio_pins = GPIO_PINS_15;
74 gpio_init(GPIOB, &gpio_initstructure);
75
76 FLASH_CS_HIGH();
77 crm_periph_clock_enable(CRM_SPI2_PERIPH_CLOCK, TRUE);
78 spi_default_para_init(&spi_init_struct);
79 spi_init_struct.transmission_mode = SPI_TRANSMIT_FULL_DUPLEX;
80 spi_init_struct.master_slave_mode = SPI_MODE_MASTER;
81 spi_init_struct.mclk_freq_division = SPI_MCLK_DIV_8;
82 spi_init_struct.first_bit_transmission = SPI_FIRST_BIT_MSB;
83 spi_init_struct.frame_bit_num = SPI_FRAME_8BIT;
84 spi_init_struct.clock_polarity = SPI_CLOCK_POLARITY_HIGH;
85 spi_init_struct.clock_phase = SPI_CLOCK_PHASE_2EDGE;
86 spi_init_struct.cs_mode_selection = SPI_CS_SOFTWARE_MODE;
87 spi_init(SPI2, &spi_init_struct);
88 spi_enable(SPI2, TRUE);
89}
90
98void spiflash_write(uint8_t *pbuffer, uint32_t write_addr, uint32_t length)
99{
100 uint32_t sector_pos;
101 uint16_t sector_offset;
102 uint16_t sector_remain;
103 uint16_t index;
104 uint8_t *spiflash_buf;
105 spiflash_buf = spiflash_sector_buf;
106
107 /* sector address */
108 sector_pos = write_addr / SPIF_SECTOR_SIZE;
109
110 /* address offset in a sector */
111 sector_offset = write_addr % SPIF_SECTOR_SIZE;
112
113 /* the remain in a sector */
114 sector_remain = SPIF_SECTOR_SIZE - sector_offset;
115 if(length <= sector_remain)
116 {
117 /* smaller than a sector size */
118 sector_remain = length;
119 }
120 while(1)
121 {
122 /* read a sector */
123 spiflash_read(spiflash_buf, sector_pos * SPIF_SECTOR_SIZE, SPIF_SECTOR_SIZE);
124
125 /* validate the read erea */
126 for(index = 0; index < sector_remain; index++)
127 {
128 if(spiflash_buf[sector_offset + index] != 0xFF)
129 {
130 /* there are some data not equal 0xff, so this secotr needs erased */
131 break;
132 }
133 }
134 if(index < sector_remain)
135 {
136 /* erase the sector */
137 spiflash_sector_erase(sector_pos);
138
139 /* copy the write data */
140 for(index = 0; index < sector_remain; index++)
141 {
142 spiflash_buf[index + sector_offset] = pbuffer[index];
143 }
144 spiflash_write_nocheck(spiflash_buf, sector_pos * SPIF_SECTOR_SIZE, SPIF_SECTOR_SIZE); /* program the sector */
145 }
146 else
147 {
148 /* write directly in the erased area */
149 spiflash_write_nocheck(pbuffer, write_addr, sector_remain);
150 }
151 if(length == sector_remain)
152 {
153 /* write end */
154 break;
155 }
156 else
157 {
158 /* go on writing */
159 sector_pos++;
160 sector_offset = 0;
161
162 pbuffer += sector_remain;
163 write_addr += sector_remain;
164 length -= sector_remain;
165 if(length > SPIF_SECTOR_SIZE)
166 {
167 /* could not write the remain data in the next sector */
168 sector_remain = SPIF_SECTOR_SIZE;
169 }
170 else
171 {
172 /* could write the remain data in the next sector */
173 sector_remain = length;
174 }
175 }
176 }
177}
178
186void spiflash_read(uint8_t *pbuffer, uint32_t read_addr, uint32_t length)
187{
188 FLASH_CS_LOW();
189 spi_byte_write(SPIF_READDATA); /* send instruction */
190 spi_byte_write((uint8_t)((read_addr) >> 16)); /* send 24-bit address */
191 spi_byte_write((uint8_t)((read_addr) >> 8));
192 spi_byte_write((uint8_t)read_addr);
193 spi_bytes_read(pbuffer, length);
194 FLASH_CS_HIGH();
195}
196
202void spiflash_sector_erase(uint32_t erase_addr)
203{
204 erase_addr *= SPIF_SECTOR_SIZE; /* translate sector address to byte address */
205 spiflash_write_enable();
206 spiflash_wait_busy();
207 FLASH_CS_LOW();
208 spi_byte_write(SPIF_SECTORERASE);
209 spi_byte_write((uint8_t)((erase_addr) >> 16));
210 spi_byte_write((uint8_t)((erase_addr) >> 8));
211 spi_byte_write((uint8_t)erase_addr);
212 FLASH_CS_HIGH();
213 spiflash_wait_busy();
214}
215
223void spiflash_write_nocheck(uint8_t *pbuffer, uint32_t write_addr, uint32_t length)
224{
225 uint16_t page_remain;
226
227 /* remain bytes in a page */
228 page_remain = SPIF_PAGE_SIZE - write_addr % SPIF_PAGE_SIZE;
229 if(length <= page_remain)
230 {
231 /* smaller than a page size */
232 page_remain = length;
233 }
234 while(1)
235 {
236 spiflash_page_write(pbuffer, write_addr, page_remain);
237 if(length == page_remain)
238 {
239 /* all data are programmed */
240 break;
241 }
242 else
243 {
244 /* length > page_remain */
245 pbuffer += page_remain;
246 write_addr += page_remain;
247
248 /* the remain bytes to be prorammed */
249 length -= page_remain;
250 if(length > SPIF_PAGE_SIZE)
251 {
252 /* can be progrmmed a page at a time */
253 page_remain = SPIF_PAGE_SIZE;
254 }
255 else
256 {
257 /* smaller than a page size */
258 page_remain = length;
259 }
260 }
261 }
262}
263
271void spiflash_page_write(uint8_t *pbuffer, uint32_t write_addr, uint32_t length)
272{
273 if((0 < length) && (length <= SPIF_PAGE_SIZE))
274 {
275 /* set write enable */
276 spiflash_write_enable();
277
278 FLASH_CS_LOW();
279
280 /* send instruction */
281 spi_byte_write(SPIF_PAGEPROGRAM);
282
283 /* send 24-bit address */
284 spi_byte_write((uint8_t)((write_addr) >> 16));
285 spi_byte_write((uint8_t)((write_addr) >> 8));
286 spi_byte_write((uint8_t)write_addr);
287 spi_bytes_write(pbuffer,length);
288
289 FLASH_CS_HIGH();
290
291 /* wait for program end */
292 spiflash_wait_busy();
293 }
294}
295
302void spi_bytes_write(uint8_t *pbuffer, uint32_t length)
303{
304 volatile uint8_t dummy_data;
305
306#if defined(SPI_TRANS_DMA)
307 dma_init_type dma_init_struct;
308 dma_reset(DMA1_CHANNEL4);
309 dma_reset(DMA1_CHANNEL5);
310 dma_default_para_init(&dma_init_struct);
311 dma_init_struct.buffer_size = length;
312 dma_init_struct.direction = DMA_DIR_PERIPHERAL_TO_MEMORY;
313 dma_init_struct.memory_base_addr = (uint32_t)&dummy_data;
314 dma_init_struct.memory_data_width = DMA_MEMORY_DATA_WIDTH_BYTE;
315 dma_init_struct.memory_inc_enable = FALSE;
316 dma_init_struct.peripheral_base_addr = (uint32_t)(&SPI2->dt);
317 dma_init_struct.peripheral_data_width = DMA_PERIPHERAL_DATA_WIDTH_BYTE;
318 dma_init_struct.peripheral_inc_enable = FALSE;
319 dma_init_struct.priority = DMA_PRIORITY_VERY_HIGH;
320 dma_init_struct.loop_mode_enable = FALSE;
321 dma_init(DMA1_CHANNEL4, &dma_init_struct);
322
323 dma_init_struct.buffer_size = length;
324 dma_init_struct.direction = DMA_DIR_MEMORY_TO_PERIPHERAL;
325 dma_init_struct.memory_base_addr = (uint32_t)pbuffer;
326 dma_init_struct.memory_data_width = DMA_MEMORY_DATA_WIDTH_BYTE;
327 dma_init_struct.memory_inc_enable = TRUE;
328 dma_init_struct.peripheral_base_addr = (uint32_t)(&SPI2->dt);
329 dma_init_struct.peripheral_data_width = DMA_PERIPHERAL_DATA_WIDTH_BYTE;
330 dma_init_struct.peripheral_inc_enable = FALSE;
331 dma_init_struct.priority = DMA_PRIORITY_VERY_HIGH;
332 dma_init_struct.loop_mode_enable = FALSE;
333 dma_init(DMA1_CHANNEL5, &dma_init_struct);
334
335 spi_i2s_dma_transmitter_enable(SPI2, TRUE);
336 spi_i2s_dma_receiver_enable(SPI2, TRUE);
337
338 dma_channel_enable(DMA1_CHANNEL4, TRUE);
339 dma_channel_enable(DMA1_CHANNEL5, TRUE);
340
341 while(dma_flag_get(DMA1_FDT4_FLAG) == RESET);
342 dma_flag_clear(DMA1_FDT4_FLAG);
343
344 /* wait spi idle when communication end */
345 while(spi_i2s_flag_get(SPI2, SPI_I2S_BF_FLAG) != RESET);
346
347 dma_channel_enable(DMA1_CHANNEL4, FALSE);
348 dma_channel_enable(DMA1_CHANNEL5, FALSE);
349
350 spi_i2s_dma_transmitter_enable(SPI2, FALSE);
351 spi_i2s_dma_receiver_enable(SPI2, FALSE);
352#else
353 while(length--)
354 {
355 while(spi_i2s_flag_get(SPI2, SPI_I2S_TDBE_FLAG) == RESET);
356 spi_i2s_data_transmit(SPI2, *pbuffer);
357 while(spi_i2s_flag_get(SPI2, SPI_I2S_RDBF_FLAG) == RESET);
358 dummy_data = spi_i2s_data_receive(SPI2);
359 pbuffer++;
360 }
361
362 /* wait spi idle when communication end */
363 while(spi_i2s_flag_get(SPI2, SPI_I2S_BF_FLAG) != RESET);
364#endif
365}
366
373void spi_bytes_read(uint8_t *pbuffer, uint32_t length)
374{
375 uint8_t write_value = FLASH_SPI_DUMMY_BYTE;
376
377#if defined(SPI_TRANS_DMA)
378 dma_init_type dma_init_struct;
379 dma_reset(DMA1_CHANNEL4);
380 dma_reset(DMA1_CHANNEL5);
381 dma_default_para_init(&dma_init_struct);
382 dma_init_struct.buffer_size = length;
383 dma_init_struct.direction = DMA_DIR_MEMORY_TO_PERIPHERAL;
384 dma_init_struct.memory_base_addr = (uint32_t)&write_value;
385 dma_init_struct.memory_data_width = DMA_MEMORY_DATA_WIDTH_BYTE;
386 dma_init_struct.memory_inc_enable = FALSE;
387 dma_init_struct.peripheral_base_addr = (uint32_t)(&SPI2->dt);
388 dma_init_struct.peripheral_data_width = DMA_PERIPHERAL_DATA_WIDTH_BYTE;
389 dma_init_struct.peripheral_inc_enable = FALSE;
390 dma_init_struct.priority = DMA_PRIORITY_VERY_HIGH;
391 dma_init_struct.loop_mode_enable = FALSE;
392 dma_init(DMA1_CHANNEL5, &dma_init_struct);
393
394 dma_init_struct.buffer_size = length;
395 dma_init_struct.direction = DMA_DIR_PERIPHERAL_TO_MEMORY;
396 dma_init_struct.memory_base_addr = (uint32_t)pbuffer;
397 dma_init_struct.memory_data_width = DMA_MEMORY_DATA_WIDTH_BYTE;
398 dma_init_struct.memory_inc_enable = TRUE;
399 dma_init_struct.peripheral_base_addr = (uint32_t)(&SPI2->dt);
400 dma_init_struct.peripheral_data_width = DMA_PERIPHERAL_DATA_WIDTH_BYTE;
401 dma_init_struct.peripheral_inc_enable = FALSE;
402 dma_init_struct.priority = DMA_PRIORITY_VERY_HIGH;
403 dma_init_struct.loop_mode_enable = FALSE;
404 dma_init(DMA1_CHANNEL4, &dma_init_struct);
405
406 spi_i2s_dma_transmitter_enable(SPI2, TRUE);
407 spi_i2s_dma_receiver_enable(SPI2, TRUE);
408 dma_channel_enable(DMA1_CHANNEL4, TRUE);
409 dma_channel_enable(DMA1_CHANNEL5, TRUE);
410
411 while(dma_flag_get(DMA1_FDT4_FLAG) == RESET);
412 dma_flag_clear(DMA1_FDT4_FLAG);
413
414 /* wait spi idle when communication end */
415 while(spi_i2s_flag_get(SPI2, SPI_I2S_BF_FLAG) != RESET);
416
417 dma_channel_enable(DMA1_CHANNEL4, FALSE);
418 dma_channel_enable(DMA1_CHANNEL5, FALSE);
419
420 spi_i2s_dma_transmitter_enable(SPI2, FALSE);
421 spi_i2s_dma_receiver_enable(SPI2, FALSE);
422#else
423 while(length--)
424 {
425 while(spi_i2s_flag_get(SPI2, SPI_I2S_TDBE_FLAG) == RESET);
426 spi_i2s_data_transmit(SPI2, write_value);
427 while(spi_i2s_flag_get(SPI2, SPI_I2S_RDBF_FLAG) == RESET);
428 *pbuffer = spi_i2s_data_receive(SPI2);
429 pbuffer++;
430 }
431
432 /* wait spi idle when communication end */
433 while(spi_i2s_flag_get(SPI2, SPI_I2S_BF_FLAG) != RESET);
434#endif
435}
436
442void spiflash_wait_busy(void)
443{
444 while((spiflash_read_sr1() & 0x01) == 0x01);
445}
446
452uint8_t spiflash_read_sr1(void)
453{
454 uint8_t breadbyte = 0;
455 FLASH_CS_LOW();
456 spi_byte_write(SPIF_READSTATUSREG1);
457 breadbyte = (uint8_t)spi_byte_read();
458 FLASH_CS_HIGH();
459 return (breadbyte);
460}
461
467void spiflash_write_enable(void)
468{
469 FLASH_CS_LOW();
470 spi_byte_write(SPIF_WRITEENABLE);
471 FLASH_CS_HIGH();
472}
473
479uint16_t spiflash_read_id(void)
480{
481 uint16_t wreceivedata = 0;
482 FLASH_CS_LOW();
483 spi_byte_write(SPIF_MANUFACTDEVICEID);
484 spi_byte_write(0x00);
485 spi_byte_write(0x00);
486 spi_byte_write(0x00);
487 wreceivedata |= spi_byte_read() << 8;
488 wreceivedata |= spi_byte_read();
489 FLASH_CS_HIGH();
490 return wreceivedata;
491}
492
498uint8_t spi_byte_write(uint8_t data)
499{
500 uint8_t brxbuff;
501 spi_i2s_dma_transmitter_enable(SPI2, FALSE);
502 spi_i2s_dma_receiver_enable(SPI2, FALSE);
503 spi_i2s_data_transmit(SPI2, data);
504 while(spi_i2s_flag_get(SPI2, SPI_I2S_RDBF_FLAG) == RESET);
505 brxbuff = spi_i2s_data_receive(SPI2);
506
507 /* wait spi idle when communication end */
508 while(spi_i2s_flag_get(SPI2, SPI_I2S_BF_FLAG) != RESET);
509
510 return brxbuff;
511}
512
518uint8_t spi_byte_read(void)
519{
520 return (spi_byte_write(FLASH_SPI_DUMMY_BYTE));
521}
522
dma_init_struct
dma_init_type dma_init_struct
Definition project/at_start_f413/examples/dma/data_to_gpio_flexible/src/main.c:38
spi_init_struct
spi_init_type spi_init_struct
Definition project/at_start_f413/examples/spi/fullduplex_dma_jtagpin/src/main.c:41
spiflash_init
void spiflash_init(void)
spi configuration.
Definition spi_flash.c:43
spiflash_write
void spiflash_write(uint8_t *pbuffer, uint32_t write_addr, uint32_t length)
write data to flash
Definition spi_flash.c:98
spiflash_wait_busy
void spiflash_wait_busy(void)
wait program done
Definition spi_flash.c:442
spiflash_write_enable
void spiflash_write_enable(void)
enable write operation
Definition spi_flash.c:467
spiflash_read_sr1
uint8_t spiflash_read_sr1(void)
read sr1 register
Definition spi_flash.c:452
spiflash_write_nocheck
void spiflash_write_nocheck(uint8_t *pbuffer, uint32_t write_addr, uint32_t length)
write data without check
Definition spi_flash.c:223
spiflash_sector_erase
void spiflash_sector_erase(uint32_t erase_addr)
erase a sector data
Definition spi_flash.c:202
spi_byte_write
uint8_t spi_byte_write(uint8_t data)
write a byte to flash
Definition spi_flash.c:498
spiflash_read
void spiflash_read(uint8_t *pbuffer, uint32_t read_addr, uint32_t length)
read data from flash
Definition spi_flash.c:186
spiflash_read_id
uint16_t spiflash_read_id(void)
read device id
Definition spi_flash.c:479
spi_bytes_read
void spi_bytes_read(uint8_t *pbuffer, uint32_t length)
read data continuously
Definition spi_flash.c:373
spi_bytes_write
void spi_bytes_write(uint8_t *pbuffer, uint32_t length)
write data continuously
Definition spi_flash.c:302
spiflash_sector_buf
uint8_t spiflash_sector_buf[SPIF_SECTOR_SIZE]
Definition spi_flash.c:36
spiflash_page_write
void spiflash_page_write(uint8_t *pbuffer, uint32_t write_addr, uint32_t length)
write a page data
Definition spi_flash.c:271
spi_byte_read
uint8_t spi_byte_read(void)
read a byte to flash
Definition spi_flash.c:518
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
CRM_SPI2_PERIPH_CLOCK
@ CRM_SPI2_PERIPH_CLOCK
Definition at32f413_crm.h:130
CRM_GPIOB_PERIPH_CLOCK
@ CRM_GPIOB_PERIPH_CLOCK
Definition at32f413_crm.h:110
CRM_DMA1_PERIPH_CLOCK
@ CRM_DMA1_PERIPH_CLOCK
Definition at32f413_crm.h:103
dma_channel_enable
void dma_channel_enable(dma_channel_type *dmax_channely, confirm_state new_state)
enable or disable dma channely
Definition at32f413_dma.c:197
dma_default_para_init
void dma_default_para_init(dma_init_type *dma_init_struct)
dma init config with its default value.
Definition at32f413_dma.c:407
dma_flag_get
flag_status dma_flag_get(uint32_t dmax_flag)
get dma flag
Definition at32f413_dma.c:343
dma_flag_clear
void dma_flag_clear(uint32_t dmax_flag)
clear dma flag
Definition at32f413_dma.c:389
dma_reset
void dma_reset(dma_channel_type *dmax_channely)
reset the dmax channely registers.
Definition at32f413_dma.c:63
dma_init
void dma_init(dma_channel_type *dmax_channely, dma_init_type *dma_init_struct)
dma init
Definition at32f413_dma.c:442
DMA_PERIPHERAL_DATA_WIDTH_BYTE
@ DMA_PERIPHERAL_DATA_WIDTH_BYTE
Definition at32f413_dma.h:245
DMA_DIR_MEMORY_TO_PERIPHERAL
@ DMA_DIR_MEMORY_TO_PERIPHERAL
Definition at32f413_dma.h:217
DMA_DIR_PERIPHERAL_TO_MEMORY
@ DMA_DIR_PERIPHERAL_TO_MEMORY
Definition at32f413_dma.h:216
DMA_MEMORY_DATA_WIDTH_BYTE
@ DMA_MEMORY_DATA_WIDTH_BYTE
Definition at32f413_dma.h:255
DMA_PRIORITY_VERY_HIGH
@ DMA_PRIORITY_VERY_HIGH
Definition at32f413_dma.h:268
DMA1_FDT4_FLAG
#define DMA1_FDT4_FLAG
Definition at32f413_dma.h:93
DMA1_CHANNEL5
#define DMA1_CHANNEL5
Definition at32f413_dma.h:484
DMA1_CHANNEL4
#define DMA1_CHANNEL4
Definition at32f413_dma.h:483
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
gpio_init
void gpio_init(gpio_type *gpio_x, gpio_init_type *gpio_init_struct)
initialize the gpio peripheral.
Definition at32f413_gpio.c:99
GPIO_MODE_MUX
@ GPIO_MODE_MUX
Definition at32f413_gpio.h:215
GPIO_MODE_INPUT
@ GPIO_MODE_INPUT
Definition at32f413_gpio.h:213
GPIO_MODE_OUTPUT
@ GPIO_MODE_OUTPUT
Definition at32f413_gpio.h:214
GPIO_DRIVE_STRENGTH_STRONGER
@ GPIO_DRIVE_STRENGTH_STRONGER
Definition at32f413_gpio.h:224
GPIO_PULL_UP
@ GPIO_PULL_UP
Definition at32f413_gpio.h:244
GPIO_OUTPUT_PUSH_PULL
@ GPIO_OUTPUT_PUSH_PULL
Definition at32f413_gpio.h:234
GPIO_PINS_13
#define GPIO_PINS_13
Definition at32f413_gpio.h:63
GPIO_PINS_12
#define GPIO_PINS_12
Definition at32f413_gpio.h:62
GPIO_PINS_14
#define GPIO_PINS_14
Definition at32f413_gpio.h:64
GPIO_PINS_15
#define GPIO_PINS_15
Definition at32f413_gpio.h:65
GPIOB
#define GPIOB
Definition at32f413_gpio.h:748
SPI_I2S_TDBE_FLAG
#define SPI_I2S_TDBE_FLAG
Definition at32f413_spi.h:53
SPI_I2S_RDBF_FLAG
#define SPI_I2S_RDBF_FLAG
Definition at32f413_spi.h:52
SPI_I2S_BF_FLAG
#define SPI_I2S_BF_FLAG
Definition at32f413_spi.h:59
spi_i2s_data_transmit
void spi_i2s_data_transmit(spi_type *spi_x, uint16_t tx_data)
spi/i2s data transmit
Definition at32f413_spi.c:513
spi_i2s_dma_receiver_enable
void spi_i2s_dma_receiver_enable(spi_type *spi_x, confirm_state new_state)
enable or disable the spi/i2s dma receiver mode.
Definition at32f413_spi.c:498
spi_i2s_flag_get
flag_status spi_i2s_flag_get(spi_type *spi_x, uint32_t spi_i2s_flag)
get flag of the specified spi/i2s peripheral.
Definition at32f413_spi.c:547
spi_init
void spi_init(spi_type *spi_x, spi_init_type *spi_init_struct)
spi init config with its setting value.
Definition at32f413_spi.c:90
spi_default_para_init
void spi_default_para_init(spi_init_type *spi_init_struct)
spi init config with its default value.
Definition at32f413_spi.c:70
spi_i2s_data_receive
uint16_t spi_i2s_data_receive(spi_type *spi_x)
spi/i2s data receive
Definition at32f413_spi.c:525
spi_enable
void spi_enable(spi_type *spi_x, confirm_state new_state)
enable or disable spi.
Definition at32f413_spi.c:286
spi_i2s_dma_transmitter_enable
void spi_i2s_dma_transmitter_enable(spi_type *spi_x, confirm_state new_state)
enable or disable the spi/i2s dma transmitter mode.
Definition at32f413_spi.c:484
SPI_MODE_MASTER
@ SPI_MODE_MASTER
Definition at32f413_spi.h:98
SPI_CLOCK_PHASE_2EDGE
@ SPI_CLOCK_PHASE_2EDGE
Definition at32f413_spi.h:116
SPI_CS_SOFTWARE_MODE
@ SPI_CS_SOFTWARE_MODE
Definition at32f413_spi.h:125
SPI_FIRST_BIT_MSB
@ SPI_FIRST_BIT_MSB
Definition at32f413_spi.h:150
SPI_CLOCK_POLARITY_HIGH
@ SPI_CLOCK_POLARITY_HIGH
Definition at32f413_spi.h:107
SPI_TRANSMIT_FULL_DUPLEX
@ SPI_TRANSMIT_FULL_DUPLEX
Definition at32f413_spi.h:159
SPI_MCLK_DIV_8
@ SPI_MCLK_DIV_8
Definition at32f413_spi.h:135
SPI_FRAME_8BIT
@ SPI_FRAME_8BIT
Definition at32f413_spi.h:88
FLASH_CS_LOW
#define FLASH_CS_LOW()
Definition spi_flash.h:52
FLASH_CS_HIGH
#define FLASH_CS_HIGH()
Definition spi_flash.h:51
SPIF_READDATA
#define SPIF_READDATA
Definition spi_flash.h:95
SPIF_PAGE_SIZE
#define SPIF_PAGE_SIZE
Definition spi_flash.h:82
SPIF_SECTORERASE
#define SPIF_SECTORERASE
Definition spi_flash.h:101
SPIF_MANUFACTDEVICEID
#define SPIF_MANUFACTDEVICEID
Definition spi_flash.h:106
FLASH_SPI_DUMMY_BYTE
#define FLASH_SPI_DUMMY_BYTE
Definition spi_flash.h:108
SPIF_SECTOR_SIZE
#define SPIF_SECTOR_SIZE
Definition spi_flash.h:81
SPIF_READSTATUSREG1
#define SPIF_READSTATUSREG1
Definition spi_flash.h:87
SPIF_PAGEPROGRAM
#define SPIF_PAGEPROGRAM
Definition spi_flash.h:98
SPIF_WRITEENABLE
#define SPIF_WRITEENABLE
Definition spi_flash.h:84
SPI2
#define SPI2
Definition at32f413_spi.h:448
spi_flash.h
header file of spi_flash
dma_init_type
dma init type
Definition at32f413_dma.h:275
dma_init_type::loop_mode_enable
confirm_state loop_mode_enable
Definition at32f413_dma.h:284
dma_init_type::buffer_size
uint16_t buffer_size
Definition at32f413_dma.h:279
dma_init_type::memory_data_width
dma_memory_data_size_type memory_data_width
Definition at32f413_dma.h:283
dma_init_type::priority
dma_priority_level_type priority
Definition at32f413_dma.h:285
dma_init_type::peripheral_inc_enable
confirm_state peripheral_inc_enable
Definition at32f413_dma.h:280
dma_init_type::memory_inc_enable
confirm_state memory_inc_enable
Definition at32f413_dma.h:281
dma_init_type::direction
dma_dir_type direction
Definition at32f413_dma.h:278
dma_init_type::peripheral_base_addr
uint32_t peripheral_base_addr
Definition at32f413_dma.h:276
dma_init_type::memory_base_addr
uint32_t memory_base_addr
Definition at32f413_dma.h:277
dma_init_type::peripheral_data_width
dma_peripheral_data_size_type peripheral_data_width
Definition at32f413_dma.h:282
gpio_init_type
gpio init type
Definition at32f413_gpio.h:287
gpio_init_type::gpio_out_type
gpio_output_type gpio_out_type
Definition at32f413_gpio.h:289
gpio_init_type::gpio_pull
gpio_pull_type gpio_pull
Definition at32f413_gpio.h:290
gpio_init_type::gpio_drive_strength
gpio_drive_type gpio_drive_strength
Definition at32f413_gpio.h:292
gpio_init_type::gpio_mode
gpio_mode_type gpio_mode
Definition at32f413_gpio.h:291
gpio_init_type::gpio_pins
uint32_t gpio_pins
Definition at32f413_gpio.h:288
spi_init_type
spi init type
Definition at32f413_spi.h:256
spi_init_type::master_slave_mode
spi_master_slave_mode_type master_slave_mode
Definition at32f413_spi.h:258
spi_init_type::first_bit_transmission
spi_first_bit_type first_bit_transmission
Definition at32f413_spi.h:260
spi_init_type::frame_bit_num
spi_frame_bit_num_type frame_bit_num
Definition at32f413_spi.h:261
spi_init_type::clock_polarity
spi_clock_polarity_type clock_polarity
Definition at32f413_spi.h:262
spi_init_type::cs_mode_selection
spi_cs_mode_type cs_mode_selection
Definition at32f413_spi.h:264
spi_init_type::mclk_freq_division
spi_mclk_freq_div_type mclk_freq_division
Definition at32f413_spi.h:259
spi_init_type::transmission_mode
spi_transmission_mode_type transmission_mode
Definition at32f413_spi.h:257
spi_init_type::clock_phase
spi_clock_phase_type clock_phase
Definition at32f413_spi.h:263


AT32F413 Firmwary Library: spi_flash.h Source File

  • spi
  • w25q_flash
  • inc
spi_flash.h
Go to the documentation of this file.
1
26#ifndef __SPI_FLASH_H
27#define __SPI_FLASH_H
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33#include "at32f413.h"
34
44 /* use dma transfer spi data */
45#define SPI_TRANS_DMA
46
51#define FLASH_CS_HIGH() gpio_bits_set(GPIOB, GPIO_PINS_12)
52#define FLASH_CS_LOW() gpio_bits_reset(GPIOB, GPIO_PINS_12)
53
62/*
63 * flash define
64 */
65#define W25Q80 0xEF13
66#define W25Q16 0xEF14
67#define W25Q32 0xEF15
68#define W25Q64 0xEF16
69/* 16mb, the range of address:0~0xFFFFFF */
70#define W25Q128 0xEF17
71
80#define SPIF_CHIP_SIZE 0x1000000
81#define SPIF_SECTOR_SIZE 4096
82#define SPIF_PAGE_SIZE 256
83
84#define SPIF_WRITEENABLE 0x06
85#define SPIF_WRITEDISABLE 0x04
86/* s7-s0 */
87#define SPIF_READSTATUSREG1 0x05
88#define SPIF_WRITESTATUSREG1 0x01
89/* s15-s8 */
90#define SPIF_READSTATUSREG2 0x35
91#define SPIF_WRITESTATUSREG2 0x31
92/* s23-s16 */
93#define SPIF_READSTATUSREG3 0x15
94#define SPIF_WRITESTATUSREG3 0x11
95#define SPIF_READDATA 0x03
96#define SPIF_FASTREADDATA 0x0B
97#define SPIF_FASTREADDUAL 0x3B
98#define SPIF_PAGEPROGRAM 0x02
99/* block size:64kb */
100#define SPIF_BLOCKERASE 0xD8
101#define SPIF_SECTORERASE 0x20
102#define SPIF_CHIPERASE 0xC7
103#define SPIF_POWERDOWN 0xB9
104#define SPIF_RELEASEPOWERDOWN 0xAB
105#define SPIF_DEVICEID 0xAB
106#define SPIF_MANUFACTDEVICEID 0x90
107#define SPIF_JEDECDEVICEID 0x9F
108#define FLASH_SPI_DUMMY_BYTE 0xA5
109
118void spiflash_init(void);
119void spiflash_write(uint8_t *pbuffer, uint32_t write_addr, uint32_t length);
120void spiflash_read(uint8_t *pbuffer, uint32_t read_addr, uint32_t length);
121void spiflash_sector_erase(uint32_t erase_addr);
122void spiflash_write_nocheck(uint8_t *pbuffer, uint32_t write_addr, uint32_t length);
123void spiflash_page_write(uint8_t *pbuffer, uint32_t write_addr, uint32_t length);
124void spi_bytes_write(uint8_t *pbuffer, uint32_t length);
125void spi_bytes_read(uint8_t *pbuffer, uint32_t length);
126void spiflash_wait_busy(void);
127uint8_t spiflash_read_sr1(void);
128void spiflash_write_enable(void);
129uint16_t spiflash_read_id(void);
130uint8_t spi_byte_write(uint8_t data);
131uint8_t spi_byte_read(void);
132
145#ifdef __cplusplus
146}
147#endif
148
149#endif
150
at32f413.h
at32f413 header file
spiflash_init
void spiflash_init(void)
spi configuration.
Definition spi_flash.c:43
spiflash_write
void spiflash_write(uint8_t *pbuffer, uint32_t write_addr, uint32_t length)
write data to flash
Definition spi_flash.c:98
spiflash_wait_busy
void spiflash_wait_busy(void)
wait program done
Definition spi_flash.c:442
spiflash_write_enable
void spiflash_write_enable(void)
enable write operation
Definition spi_flash.c:467
spiflash_read_sr1
uint8_t spiflash_read_sr1(void)
read sr1 register
Definition spi_flash.c:452
spiflash_write_nocheck
void spiflash_write_nocheck(uint8_t *pbuffer, uint32_t write_addr, uint32_t length)
write data without check
Definition spi_flash.c:223
spiflash_sector_erase
void spiflash_sector_erase(uint32_t erase_addr)
erase a sector data
Definition spi_flash.c:202
spi_byte_write
uint8_t spi_byte_write(uint8_t data)
write a byte to flash
Definition spi_flash.c:498
spiflash_read
void spiflash_read(uint8_t *pbuffer, uint32_t read_addr, uint32_t length)
read data from flash
Definition spi_flash.c:186
spiflash_read_id
uint16_t spiflash_read_id(void)
read device id
Definition spi_flash.c:479
spi_bytes_read
void spi_bytes_read(uint8_t *pbuffer, uint32_t length)
read data continuously
Definition spi_flash.c:373
spi_bytes_write
void spi_bytes_write(uint8_t *pbuffer, uint32_t length)
write data continuously
Definition spi_flash.c:302
spiflash_page_write
void spiflash_page_write(uint8_t *pbuffer, uint32_t write_addr, uint32_t length)
write a page data
Definition spi_flash.c:271
spi_byte_read
uint8_t spi_byte_read(void)
read a byte to flash
Definition spi_flash.c:518


AT32F413 Firmwary Library: system_at32f413.c Source File

  • libraries
  • cmsis
  • cm4
  • device_support
system_at32f413.c
Go to the documentation of this file.
1
34#include "at32f413.h"
35
39#define VECT_TAB_OFFSET 0x0
47unsigned int system_core_clock = HICK_VALUE;
63void SystemInit (void)
64{
65#if defined (__FPU_USED) && (__FPU_USED == 1U)
66 SCB->CPACR |= ((3U << 10U * 2U) | /* set cp10 full access */
67 (3U << 11U * 2U) ); /* set cp11 full access */
68#endif
69
70 /* reset the crm clock configuration to the default reset state(for debug purpose) */
71 /* set hicken bit */
72 CRM->ctrl_bit.hicken = TRUE;
73
74 /* wait hick stable */
75 while(CRM->ctrl_bit.hickstbl != SET);
76
77 /* hick used as system clock */
78 CRM->cfg_bit.sclksel = CRM_SCLK_HICK;
79
80 /* wait sclk switch status */
81 while(CRM->cfg_bit.sclksts != CRM_SCLK_HICK);
82
83 /* reset hexten, hextbyps, cfden and pllen bits */
84 CRM->ctrl &= ~(0x010D0000U);
85
86 /* reset cfg register, include sclk switch, ahbdiv, apb1div, apb2div, adcdiv,
87 clkout pllrcs, pllhextdiv, pllmult, usbdiv and pllrange bits */
88 CRM->cfg = 0;
89
90 /* reset clkout[3], usbbufs, hickdiv, clkoutdiv */
91 CRM->misc1 = 0;
92
93 /* disable all interrupts enable and clear pending bits */
94 CRM->clkint = 0x009F0000;
95
96#ifdef VECT_TAB_SRAM
97 SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* vector table relocation in internal sram. */
98#else
99 SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* vector table relocation in internal flash. */
100#endif
101}
102
111void system_core_clock_update(void)
112{
113 uint32_t pll_mult = 0, pll_mult_h = 0, pll_clock_source = 0, temp = 0, div_value = 0;
114 crm_sclk_type sclk_source;
115
116 static const uint8_t sys_ahb_div_table[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};
117
118 /* get sclk source */
119 sclk_source = crm_sysclk_switch_status_get();
120
121 switch(sclk_source)
122 {
123 case CRM_SCLK_HICK:
124 if(((CRM->misc3_bit.hick_to_sclk) != RESET) && ((CRM->misc1_bit.hickdiv) != RESET))
125 system_core_clock = HICK_VALUE * 6;
126 else
127 system_core_clock = HICK_VALUE;
128 break;
129 case CRM_SCLK_HEXT:
130 system_core_clock = HEXT_VALUE;
131 break;
132 case CRM_SCLK_PLL:
133 pll_clock_source = CRM->cfg_bit.pllrcs;
134 {
135 /* get multiplication factor */
136 pll_mult = CRM->cfg_bit.pllmult_l;
137 pll_mult_h = CRM->cfg_bit.pllmult_h;
138 /* process high bits */
139 if((pll_mult_h != 0U) || (pll_mult == 15U)){
140 pll_mult += ((16U * pll_mult_h) + 1U);
141 }
142 else
143 {
144 pll_mult += 2U;
145 }
146
147 if(pll_clock_source == 0x00)
148 {
149 /* hick divided by 2 selected as pll clock entry */
150 system_core_clock = (HICK_VALUE >> 1) * pll_mult;
151 }
152 else
153 {
154 /* hext selected as pll clock entry */
155 if(CRM->cfg_bit.pllhextdiv != RESET)
156 {
157 /* hext clock divided by 2 */
158 system_core_clock = (HEXT_VALUE / 2) * pll_mult;
159 }
160 else
161 {
162 system_core_clock = HEXT_VALUE * pll_mult;
163 }
164 }
165 }
166 break;
167 default:
168 system_core_clock = HICK_VALUE;
169 break;
170 }
171
172 /* compute sclk, ahbclk frequency */
173 /* get ahb division */
174 temp = CRM->cfg_bit.ahbdiv;
175 div_value = sys_ahb_div_table[temp];
176 /* ahbclk frequency */
177 system_core_clock = system_core_clock >> div_value;
178}
at32f413.h
at32f413 header file
div_value
uint16_t div_value
Definition project/at_start_f413/examples/tmr/oc_high/src/main.c:43
VECT_TAB_OFFSET
#define VECT_TAB_OFFSET
Definition system_at32f413.c:39
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
SystemInit
void SystemInit(void)
setup the microcontroller system initialize the flash interface.
Definition system_at32f413.c:63
system_core_clock
unsigned int system_core_clock
Definition system_at32f413.c:47
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_sclk_type
crm_sclk_type
crm sclk select
Definition at32f413_crm.h:391
CRM_SCLK_HICK
@ CRM_SCLK_HICK
Definition at32f413_crm.h:392
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_SCLK_HEXT
@ CRM_SCLK_HEXT
Definition at32f413_crm.h:393
CRM
#define CRM
Definition at32f413_crm.h:843
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
SET
@ SET
Definition at32f413.h:292
SRAM_BASE
#define SRAM_BASE
Definition at32f413.h:332
FLASH_BASE
#define FLASH_BASE
Definition at32f413.h:329
HEXT_VALUE
#define HEXT_VALUE
in the following line adjust the value of high speed external crystal (hext) used in your application
Definition project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h:43
HICK_VALUE
#define HICK_VALUE
Definition project/at_start_f413/examples/acc/calibration/inc/at32f413_conf.h:51


AT32F413 Firmwary Library: system_at32f413.h Source File

  • libraries
  • cmsis
  • cm4
  • device_support
system_at32f413.h
Go to the documentation of this file.
1
26#ifndef __SYSTEM_AT32F413_H
27#define __SYSTEM_AT32F413_H
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
45#define HEXT_STABLE_DELAY (5000u)
46#define PLL_STABLE_DELAY (500u)
47#define SystemCoreClock system_core_clock
48#define DUMMY_NOP() {__NOP();__NOP();__NOP();__NOP();__NOP(); \
49 __NOP();__NOP();__NOP();__NOP();__NOP(); \
50 __NOP();__NOP();__NOP();__NOP();__NOP(); \
51 __NOP();__NOP();__NOP();__NOP();__NOP();}
52
61extern unsigned int system_core_clock;
71extern void SystemInit(void);
72extern void system_core_clock_update(void);
73
86#ifdef __cplusplus
87}
88#endif
89
90#endif
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
SystemInit
void SystemInit(void)
setup the microcontroller system initialize the flash interface.
Definition system_at32f413.c:63
system_core_clock
unsigned int system_core_clock
Definition system_at32f413.c:47


AT32F413 Firmwary Library: usb_std.h Source File

  • middlewares
  • usbd_drivers
  • inc
usb_std.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __USB_STD_H
28#define __USB_STD_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34
35/* includes ------------------------------------------------------------------*/
36#include "usb_conf.h"
37
53#define USB_REQ_RECIPIENT_DEVICE 0x00
54#define USB_REQ_RECIPIENT_INTERFACE 0x01
55#define USB_REQ_RECIPIENT_ENDPOINT 0x02
56#define USB_REQ_RECIPIENT_OTHER 0x03
57#define USB_REQ_RECIPIENT_MASK 0x1F
62#define USB_REQ_TYPE_STANDARD 0x00
63#define USB_REQ_TYPE_CLASS 0x20
64#define USB_REQ_TYPE_VENDOR 0x40
65#define USB_REQ_TYPE_RESERVED 0x60
70#define USB_REQ_DIR_HTD 0x00
71#define USB_REQ_DIR_DTH 0x80
76#define USB_STD_REQ_GET_STATUS 0
77#define USB_STD_REQ_CLEAR_FEATURE 1
78#define USB_STD_REQ_SET_FEATURE 3
79#define USB_STD_REQ_SET_ADDRESS 5
80#define USB_STD_REQ_GET_DESCRIPTOR 6
81#define USB_STD_REQ_SET_DESCRIPTOR 7
82#define USB_STD_REQ_GET_CONFIGURATION 8
83#define USB_STD_REQ_SET_CONFIGURATION 9
84#define USB_STD_REQ_GET_INTERFACE 10
85#define USB_STD_REQ_SET_INTERFACE 11
86#define USB_STD_REQ_SYNCH_FRAME 12
91#define USB_DESCIPTOR_TYPE_DEVICE 1
92#define USB_DESCIPTOR_TYPE_CONFIGURATION 2
93#define USB_DESCIPTOR_TYPE_STRING 3
94#define USB_DESCIPTOR_TYPE_INTERFACE 4
95#define USB_DESCIPTOR_TYPE_ENDPOINT 5
96#define USB_DESCIPTOR_TYPE_DEVICE_QUALIFIER 6
97#define USB_DESCIPTOR_TYPE_OTHER_SPEED 7
98#define USB_DESCIPTOR_TYPE_INTERFACE_POWER 8
103#define USB_LANGID_STRING 0
104#define USB_MFC_STRING 1
105#define USB_PRODUCT_STRING 2
106#define USB_SERIAL_STRING 3
107#define USB_CONFIG_STRING 4
108#define USB_INTERFACE_STRING 5
109#define USB_WINUSB_OS_STRING 0xEE
114#define USB_CONF_REMOTE_WAKEUP 2
115#define USB_CONF_SELF_POWERED 1
120#define USB_FEATURE_EPT_HALT 0
121#define USB_FEATURE_REMOTE_WAKEUP 1
122#define USB_FEATURE_TEST_MODE 2
127#define USB_WINUSB_COMPAT_ID 0x04
128#define USB_WINUSB_PROPERTIES_ID 0x05
133typedef enum
134{
135 USB_CONN_STATE_DEFAULT =1,
136 USB_CONN_STATE_ADDRESSED,
137 USB_CONN_STATE_CONFIGURED,
138 USB_CONN_STATE_SUSPENDED
139}usbd_conn_state;
140
144#define USB_EPT0_IDLE 0
145#define USB_EPT0_SETUP 1
146#define USB_EPT0_DATA_IN 2
147#define USB_EPT0_DATA_OUT 3
148#define USB_EPT0_STATUS_IN 4
149#define USB_EPT0_STATUS_OUT 5
150#define USB_EPT0_STALL 6
155#define USB_DEVICE_QUALIFIER_DESC_LEN 0x0A
156#define USB_DEVICE_DESC_LEN 0x12
157#define USB_DEVICE_CFG_DESC_LEN 0x09
158#define USB_DEVICE_IF_DESC_LEN 0x09
159#define USB_DEVICE_EPT_LEN 0x07
160#define USB_DEVICE_OTG_DESC_LEN 0x03
161#define USB_DEVICE_LANGID_STR_DESC_LEN 0x04
162#define USB_DEVICE_OTHER_SPEED_DESC_SIZ_LEN 0x09
167#define USB_CLASS_CODE_AUDIO 0x01
168#define USB_CLASS_CODE_CDC 0x02
169#define USB_CLASS_CODE_HID 0x03
170#define USB_CLASS_CODE_PRINTER 0x07
171#define USB_CLASS_CODE_MSC 0x08
172#define USB_CLASS_CODE_HUB 0x09
173#define USB_CLASS_CODE_CDCDATA 0x0A
174#define USB_CLASS_CODE_CCID 0x0B
175#define USB_CLASS_CODE_VIDEO 0x0E
176#define USB_CLASS_CODE_VENDOR 0xFF
181#define USB_EPT_DESC_CONTROL 0x00
182#define USB_EPT_DESC_ISO 0x01
183#define USB_EPT_DESC_BULK 0x02
184#define USB_EPT_DESC_INTERRUPT 0x03
186#define USB_EPT_DESC_NSYNC 0x00
187#define USB_ETP_DESC_ASYNC 0x04
188#define USB_ETP_DESC_ADAPTIVE 0x08
189#define USB_ETP_DESC_SYNC 0x0C
191#define USB_EPT_DESC_DATA_EPT 0x00
192#define USB_EPT_DESC_FD_EPT 0x10
193#define USB_EPT_DESC_FDDATA_EPT 0x20
198#define USBD_CDC_CS_INTERFACE 0x24
199#define USBD_CDC_CS_ENDPOINT 0x25
200
204#define USBD_CDC_SUBTYPE_HEADER 0x00
205#define USBD_CDC_SUBTYPE_CMF 0x01
206#define USBD_CDC_SUBTYPE_ACM 0x02
207#define USBD_CDC_SUBTYPE_UFD 0x06
208
212#define SET_LINE_CODING 0x20
213#define GET_LINE_CODING 0x21
214
218typedef struct
219{
220 uint32_t bitrate; /* line coding baud rate */
221 uint8_t format; /* line coding foramt */
222 uint8_t parity; /* line coding parity */
223 uint8_t data; /* line coding data bit */
224}linecoding_type;
225
229#define HID_CLASS_DESC_HID 0x21
230#define HID_CLASS_DESC_REPORT 0x22
231#define HID_CLASS_DESC_PHYSICAL 0x23
232
236#define HID_REQ_SET_PROTOCOL 0x0B
237#define HID_REQ_GET_PROTOCOL 0x03
238#define HID_REQ_SET_IDLE 0x0A
239#define HID_REQ_GET_IDLE 0x02
240#define HID_REQ_SET_REPORT 0x09
241#define HID_REQ_GET_REPORT 0x01
242#define HID_DESCRIPTOR_TYPE 0x21
243#define HID_REPORT_DESC 0x22
244
248#define USB_MAX_EP0_SIZE 64
253#define SWAPBYTE(addr) (uint16_t)(((uint16_t)(*((uint8_t *)(addr)))) + \
254 (((uint16_t)(*(((uint8_t *)(addr)) + 1))) << 8))
259#ifndef MIN
260#define MIN(a, b) (uint16_t)(((a) < (b)) ? (a) : (b))
261#endif
262
263#ifndef MAX
264#define MAX(a, b) (uint16_t)(((a) > (b)) ? (a) : (b))
265#endif
266
270#define LBYTE(x) ((uint8_t)(x & 0x00FF))
271#define HBYTE(x) ((uint8_t)((x & 0xFF00) >>8))
284typedef enum
285{
286 USB_OK,
287 USB_FAIL,
288 USB_WAIT,
289 USB_NOT_SUPPORT,
290 USB_ERROR,
291}usb_sts_type;
292
296typedef struct
297{
298 uint8_t bmRequestType;
299 uint8_t bRequest;
300 uint16_t wValue;
301 uint16_t wIndex;
303 uint16_t wLength;
304}usb_setup_type;
305
309typedef struct
310{
311 uint8_t bLength;
312 uint8_t bDescriptorType;
313 uint16_t bcdUSB;
314 uint8_t bDeviceClass;
315 uint8_t bDeviceSubClass;
316 uint8_t bDeviceProtocol;
317 uint8_t bMaxPacketSize0;
318 uint16_t idVendor;
319 uint16_t idProduct;
320 uint16_t bcdDevice;
321 uint8_t iManufacturer;
322 uint8_t iProduct;
323 uint8_t iSerialNumber;
324 uint8_t bNumConfigurations;
325}usb_device_desc_type;
326
330typedef struct
331{
332 uint8_t bLength;
333 uint8_t bDescriptorType;
334 uint16_t wTotalLength;
335 uint8_t bNumInterfaces;
336 uint8_t bConfigurationValue;
337 uint8_t iConfiguration;
338 uint8_t bmAttributes;
343 uint8_t bMaxPower;
346}usb_configuration_desc_type;
347
351typedef struct
352{
353 uint8_t bLength;
354 uint8_t bDescriptorType;
355 uint8_t bInterfaceNumber;
356 uint8_t bAlternateSetting;
357 uint8_t bNumEndpoints;
358 uint8_t bInterfaceClass;
359 uint8_t bInterfaceSubClass;
360 uint8_t bInterfaceProtocol;
361 uint8_t iInterface;
362}usb_interface_desc_type;
363
367typedef struct
368{
369 uint8_t bLength;
370 uint8_t bDescriptorType;
371 uint8_t bEndpointAddress;
372 uint8_t bmAttributes;
373 uint16_t wMaxPacketSize;
374 uint8_t bInterval;
375}usb_endpoint_desc_type;
376
380typedef struct
381{
382 uint8_t bLength;
383 uint8_t bDescriptorType;
384}usb_header_desc_type;
385
386
398#ifdef __cplusplus
399}
400#endif
401
402#endif
403
usbd_conn_state
usbd_conn_state
usb device connect state
Definition usb_std.h:134
USB_CONN_STATE_SUSPENDED
@ USB_CONN_STATE_SUSPENDED
Definition usb_std.h:138
USB_CONN_STATE_DEFAULT
@ USB_CONN_STATE_DEFAULT
Definition usb_std.h:135
USB_CONN_STATE_CONFIGURED
@ USB_CONN_STATE_CONFIGURED
Definition usb_std.h:137
USB_CONN_STATE_ADDRESSED
@ USB_CONN_STATE_ADDRESSED
Definition usb_std.h:136
usb_sts_type
usb_sts_type
usb return status
Definition usb_std.h:285
USB_OK
@ USB_OK
Definition usb_std.h:286
USB_WAIT
@ USB_WAIT
Definition usb_std.h:288
USB_ERROR
@ USB_ERROR
Definition usb_std.h:290
USB_NOT_SUPPORT
@ USB_NOT_SUPPORT
Definition usb_std.h:289
USB_FAIL
@ USB_FAIL
Definition usb_std.h:287
linecoding_type
usb cdc class set line coding struct
Definition usb_std.h:219
linecoding_type::bitrate
uint32_t bitrate
Definition usb_std.h:220
linecoding_type::data
uint8_t data
Definition usb_std.h:223
linecoding_type::parity
uint8_t parity
Definition usb_std.h:222
linecoding_type::format
uint8_t format
Definition usb_std.h:221
usb_configuration_desc_type
format of standard configuration descriptor
Definition usb_std.h:331
usb_configuration_desc_type::bMaxPower
uint8_t bMaxPower
Definition usb_std.h:343
usb_configuration_desc_type::bConfigurationValue
uint8_t bConfigurationValue
Definition usb_std.h:336
usb_configuration_desc_type::bNumInterfaces
uint8_t bNumInterfaces
Definition usb_std.h:335
usb_configuration_desc_type::bLength
uint8_t bLength
Definition usb_std.h:332
usb_configuration_desc_type::iConfiguration
uint8_t iConfiguration
Definition usb_std.h:337
usb_configuration_desc_type::wTotalLength
uint16_t wTotalLength
Definition usb_std.h:334
usb_configuration_desc_type::bDescriptorType
uint8_t bDescriptorType
Definition usb_std.h:333
usb_configuration_desc_type::bmAttributes
uint8_t bmAttributes
Definition usb_std.h:338
usb_device_desc_type
format of standard device descriptor
Definition usb_std.h:310
usb_device_desc_type::bDeviceProtocol
uint8_t bDeviceProtocol
Definition usb_std.h:316
usb_device_desc_type::bMaxPacketSize0
uint8_t bMaxPacketSize0
Definition usb_std.h:317
usb_device_desc_type::idProduct
uint16_t idProduct
Definition usb_std.h:319
usb_device_desc_type::iManufacturer
uint8_t iManufacturer
Definition usb_std.h:321
usb_device_desc_type::idVendor
uint16_t idVendor
Definition usb_std.h:318
usb_device_desc_type::iProduct
uint8_t iProduct
Definition usb_std.h:322
usb_device_desc_type::bcdUSB
uint16_t bcdUSB
Definition usb_std.h:313
usb_device_desc_type::bNumConfigurations
uint8_t bNumConfigurations
Definition usb_std.h:324
usb_device_desc_type::bLength
uint8_t bLength
Definition usb_std.h:311
usb_device_desc_type::iSerialNumber
uint8_t iSerialNumber
Definition usb_std.h:323
usb_device_desc_type::bDeviceSubClass
uint8_t bDeviceSubClass
Definition usb_std.h:315
usb_device_desc_type::bcdDevice
uint16_t bcdDevice
Definition usb_std.h:320
usb_device_desc_type::bDeviceClass
uint8_t bDeviceClass
Definition usb_std.h:314
usb_device_desc_type::bDescriptorType
uint8_t bDescriptorType
Definition usb_std.h:312
usb_endpoint_desc_type
format of standard endpoint descriptor
Definition usb_std.h:368
usb_endpoint_desc_type::bDescriptorType
uint8_t bDescriptorType
Definition usb_std.h:370
usb_endpoint_desc_type::bInterval
uint8_t bInterval
Definition usb_std.h:374
usb_endpoint_desc_type::bEndpointAddress
uint8_t bEndpointAddress
Definition usb_std.h:371
usb_endpoint_desc_type::bmAttributes
uint8_t bmAttributes
Definition usb_std.h:372
usb_endpoint_desc_type::wMaxPacketSize
uint16_t wMaxPacketSize
Definition usb_std.h:373
usb_endpoint_desc_type::bLength
uint8_t bLength
Definition usb_std.h:369
usb_header_desc_type
format of header
Definition usb_std.h:381
usb_header_desc_type::bDescriptorType
uint8_t bDescriptorType
Definition usb_std.h:383
usb_header_desc_type::bLength
uint8_t bLength
Definition usb_std.h:382
usb_interface_desc_type
format of standard interface descriptor
Definition usb_std.h:352
usb_interface_desc_type::bInterfaceNumber
uint8_t bInterfaceNumber
Definition usb_std.h:355
usb_interface_desc_type::bAlternateSetting
uint8_t bAlternateSetting
Definition usb_std.h:356
usb_interface_desc_type::bNumEndpoints
uint8_t bNumEndpoints
Definition usb_std.h:357
usb_interface_desc_type::bInterfaceProtocol
uint8_t bInterfaceProtocol
Definition usb_std.h:360
usb_interface_desc_type::bInterfaceClass
uint8_t bInterfaceClass
Definition usb_std.h:358
usb_interface_desc_type::bInterfaceSubClass
uint8_t bInterfaceSubClass
Definition usb_std.h:359
usb_interface_desc_type::bLength
uint8_t bLength
Definition usb_std.h:353
usb_interface_desc_type::iInterface
uint8_t iInterface
Definition usb_std.h:361
usb_interface_desc_type::bDescriptorType
uint8_t bDescriptorType
Definition usb_std.h:354
usb_setup_type
format of usb setup data
Definition usb_std.h:297
usb_setup_type::wValue
uint16_t wValue
Definition usb_std.h:300
usb_setup_type::wLength
uint16_t wLength
Definition usb_std.h:303
usb_setup_type::bmRequestType
uint8_t bmRequestType
Definition usb_std.h:298
usb_setup_type::wIndex
uint16_t wIndex
Definition usb_std.h:301
usb_setup_type::bRequest
uint8_t bRequest
Definition usb_std.h:299


AT32F413 Firmwary Library: usbd_core.c Source File

  • middlewares
  • usbd_drivers
  • src
usbd_core.c
Go to the documentation of this file.
1
25#include "usbd_core.h"
26#include "usbd_sdr.h"
27
47void usbd_core_in_handler(usbd_core_type *udev, uint8_t ept_addr)
48{
49 /* get endpoint info*/
50 usb_ept_info *ept_info = &udev->ept_in[ept_addr & 0x7F];
51
52 if(ept_addr == 0)
53 {
54 /* endpoint 0 */
55 if(udev->ept0_sts == USB_EPT0_DATA_IN)
56 {
57 if(ept_info->rem0_len > ept_info->maxpacket)
58 {
59 ept_info->rem0_len -= ept_info->maxpacket;
60 usbd_ept_send(udev, 0, ept_info->trans_buf,
61 MIN(ept_info->rem0_len, ept_info->maxpacket));
62 }
63 /* endpoint 0 */
64 else if(ept_info->last_len == ept_info->maxpacket
65 && ept_info->ept0_slen >= ept_info->maxpacket
66 && ept_info->ept0_slen < udev->ept0_wlength)
67 {
68 ept_info->last_len = 0;
69 usbd_ept_send(udev, 0, 0, 0);
70 usbd_ept_recv(udev, ept_addr, 0, 0);
71 }
72 else
73 {
74
75 if(udev->class_handler->ept0_tx_handler != 0 &&
76 udev->conn_state == USB_CONN_STATE_CONFIGURED)
77 {
78 udev->class_handler->ept0_tx_handler(udev);
79 }
80 usbd_ctrl_recv_status(udev);
81
82 }
83 }
84 }
85 else if(udev->class_handler->in_handler != 0 &&
86 udev->conn_state == USB_CONN_STATE_CONFIGURED)
87 {
88 /* other user define endpoint */
89 udev->class_handler->in_handler(udev, ept_addr);
90 }
91}
92
99void usbd_core_out_handler(usbd_core_type *udev, uint8_t ept_addr)
100{
101 /* get endpoint info*/
102 usb_ept_info *ept_info = &udev->ept_out[ept_addr & 0x7F];
103
104 if(ept_addr == 0)
105 {
106 /* endpoint 0 */
107 if(udev->ept0_sts == USB_EPT0_DATA_OUT)
108 {
109 if(ept_info->rem0_len > ept_info->maxpacket)
110 {
111 ept_info->rem0_len -= ept_info->maxpacket;
112 usbd_ept_recv(udev, ept_addr, ept_info->trans_buf,
113 MIN(ept_info->rem0_len, ept_info->maxpacket));
114 }
115 else
116 {
117 if(udev->class_handler->ept0_rx_handler != 0)
118 {
119 udev->class_handler->ept0_rx_handler(udev);
120 }
121 usbd_ctrl_send_status(udev);
122 }
123 }
124 }
125 else if(udev->class_handler->out_handler != 0 &&
126 udev->conn_state == USB_CONN_STATE_CONFIGURED)
127 {
128 /* other user define endpoint */
129 udev->class_handler->out_handler(udev, ept_addr);
130 }
131}
132
139void usbd_core_setup_handler(usbd_core_type *udev, uint8_t ept_num)
140{
141 /* setup parse */
142 usbd_setup_request_parse(&udev->setup, udev->setup_buffer);
143
144 /* set ept0 status */
145 udev->ept0_sts = USB_EPT0_SETUP;
146 udev->ept0_wlength = udev->setup.wLength;
147
148 switch(udev->setup.bmRequestType & USB_REQ_RECIPIENT_MASK)
149 {
150 case USB_REQ_RECIPIENT_DEVICE:
151 /* recipient device request */
152 usbd_device_request(udev);
153 break;
154 case USB_REQ_RECIPIENT_INTERFACE:
155 /* recipient interface request */
156 usbd_interface_request(udev);
157 break;
158 case USB_REQ_RECIPIENT_ENDPOINT:
159 /* recipient endpoint request */
160 usbd_endpoint_request(udev);
161 break;
162 default:
163 break;
164 }
165}
166
175void usbd_ctrl_send(usbd_core_type *udev, uint8_t *buffer, uint16_t len)
176{
177 usb_ept_info *ept_info = &udev->ept_in[0];
178
179 ept_info->ept0_slen = len;
180 ept_info->rem0_len = len;
181 udev->ept0_sts = USB_EPT0_DATA_IN;
182
183 usbd_ept_send(udev, 0, buffer, len);
184}
185
194void usbd_ctrl_recv(usbd_core_type *udev, uint8_t *buffer, uint16_t len)
195{
196 usb_ept_info *ept_info = &udev->ept_out[0];
197
198 ept_info->ept0_slen = len;
199 ept_info->rem0_len = len;
200 udev->ept0_sts = USB_EPT0_DATA_OUT;
201
202 usbd_ept_recv(udev, 0, buffer, len);
203}
204
210void usbd_ctrl_send_status(usbd_core_type *udev)
211{
212 udev->ept0_sts = USB_EPT0_STATUS_IN;
213
214 usbd_ept_send(udev, 0, 0, 0);
215}
216
222void usbd_ctrl_recv_status(usbd_core_type *udev)
223{
224 udev->ept0_sts = USB_EPT0_STATUS_OUT;
225
226 usbd_ept_recv(udev, 0, 0, 0);
227}
228
235void usbd_clear_stall(usbd_core_type *udev, uint8_t ept_addr)
236{
237 usb_ept_info *ept_info;
238
239 if(ept_addr & 0x80)
240 {
241 /* in endpoint */
242 ept_info = &udev->ept_in[ept_addr & 0x7F];
243 USB_CLEAR_TXDTS(ept_info->eptn);
244 if(USB->ept_bit[ept_info->eptn].txsts == USB_TX_STALL)
245 USB_SET_TXSTS(ept_info->eptn, USB_TX_NAK);
246 }
247 else
248 {
249 /* out endpoint */
250 ept_info = &udev->ept_out[ept_addr & 0x7F];
251 USB_CLEAR_RXDTS(ept_info->eptn);
252 if(USB->ept_bit[ept_info->eptn].rxsts == USB_RX_STALL)
253 USB_SET_RXSTS(ept_info->eptn, USB_RX_VALID);
254 }
255 ept_info->stall = 0;
256}
257
264void usbd_set_stall(usbd_core_type *udev, uint8_t ept_addr)
265{
266 usb_ept_info *ept_info;
267
268 if(ept_addr & 0x80)
269 {
270 /* in endpoint */
271 ept_info = &udev->ept_in[ept_addr & 0x7F];
272 USB_SET_TXSTS(ept_info->eptn, USB_TX_STALL);
273 }
274 else
275 {
276 /* out endpoint */
277 ept_info = &udev->ept_out[ept_addr & 0x7F];
278 USB_SET_RXSTS(ept_info->eptn, USB_RX_STALL)
279 }
280
281 ept_info->stall = 1;
282}
283
289void usbd_ctrl_unsupport(usbd_core_type *udev)
290{
291 /* return stall status */
292 usbd_set_stall(udev, 0x00);
293 usbd_set_stall(udev, 0x80);
294}
295
304void usbd_ept_send(usbd_core_type *udev, uint8_t ept_addr, uint8_t *buffer, uint16_t len)
305{
306 /* get endpoint info struct and register */
307 usb_ept_info *ept_info = &udev->ept_in[ept_addr & 0x7F];
308 uint16_t trs_len = 0;
309 usbd_type *usbx = udev->usb_reg;
310
311 /* set send data buffer and length */
312 ept_info->trans_buf = buffer;
313 ept_info->total_len = len;
314 ept_info->trans_len = 0;
315
316 if(ept_info->total_len > ept_info->maxpacket)
317 {
318 trs_len = ept_info->maxpacket;
319 ept_info->total_len -= trs_len;
320 }
321 else
322 {
323 trs_len = len;
324 ept_info->total_len = 0;
325 }
326
327 ept_info->last_len = trs_len;
328
329 if(ept_info->is_double_buffer == 0)
330 {
331 /* write data to endpoint buffer */
332 usb_write_packet(ept_info->trans_buf, ept_info->tx_addr, trs_len);
333
334 /* set send data length */
335 USB_SET_TXLEN((ept_addr & 0x7F), trs_len);
336 }
337 else
338 {
339 if(usbx->ept_bit[ept_addr & 0x7F].txdts)
340 {
341 USB_SET_EPT_DOUBLE_BUF1_LEN((ept_addr & 0x7F), trs_len, DATA_TRANS_IN);
342 usb_write_packet(ept_info->trans_buf, ept_info->rx_addr, trs_len);
343 }
344 else
345 {
346 USB_SET_EPT_DOUBLE_BUF0_LEN((ept_addr & 0x7F), trs_len, DATA_TRANS_IN);
347 usb_write_packet(ept_info->trans_buf, ept_info->tx_addr, trs_len);
348 }
349 USB_FREE_DB_USER_BUFFER((ept_addr & 0x7F), DATA_TRANS_IN);
350 }
351
352 /* set tx status valid */
353 USB_SET_TXSTS((ept_addr & 0x7F), USB_TX_VALID);
354}
355
364void usbd_ept_recv(usbd_core_type *udev, uint8_t ept_addr, uint8_t *buffer, uint16_t len)
365{
366 /* get endpoint info struct and register */
367 usb_ept_info *ept_info = &udev->ept_out[ept_addr & 0x7F];
368 uint32_t trs_len = 0;
369
370 /* set receive data buffer and length */
371 ept_info->trans_buf = buffer;
372 ept_info->total_len = len;
373 ept_info->trans_len = 0;
374
375 if(ept_info->total_len > ept_info->maxpacket)
376 {
377 trs_len = ept_info->maxpacket;
378 ept_info->total_len -= trs_len;
379 }
380 else
381 {
382 trs_len = len;
383 ept_info->total_len = 0;
384 }
385
386 /* set rx status valid */
387 USB_SET_RXSTS((ept_addr & 0x7F), USB_RX_VALID);
388}
389
390
397uint32_t usbd_get_recv_len(usbd_core_type *udev, uint8_t ept_addr)
398{
399 usb_ept_info *ept = &udev->ept_out[ept_addr & 0x7F];
400 return ept->trans_len;
401}
402
409void usbd_ept_dbuffer_enable(usbd_core_type *udev, uint8_t ept_addr)
410{
411 usb_ept_info *ept_info;
412 if((ept_addr & 0x80) == 0)
413 {
414 /* out endpoint info */
415 ept_info = &udev->ept_out[ept_addr & 0x7F];
416 }
417 else
418 {
419 /* in endpoint info */
420 ept_info = &udev->ept_in[ept_addr & 0x7F];
421 }
422 ept_info->is_double_buffer = TRUE;
423}
424
430void usbd_ept_buf_auto_define(usb_ept_info *ept_info)
431{
432 if(ept_info->is_double_buffer == 0)
433 {
434 if( ept_info->inout == DATA_TRANS_IN )
435 {
436 if(ept_info->tx_addr == 0)
437 ept_info->tx_addr = usb_buffer_malloc(ept_info->maxpacket);
438 }
439 else
440 {
441 if(ept_info->rx_addr == 0)
442 ept_info->rx_addr = usb_buffer_malloc(ept_info->maxpacket);
443 }
444 }
445 else
446 {
447 /* double buffer auto define */
448 if(ept_info->tx_addr == 0)
449 ept_info->tx_addr = usb_buffer_malloc(ept_info->maxpacket);
450 if(ept_info->rx_addr == 0)
451 ept_info->rx_addr = usb_buffer_malloc(ept_info->maxpacket);
452 }
453}
454
455
456
464void usbd_ept_buf_custom_define(usbd_core_type *udev, uint8_t ept_addr,
465 uint32_t addr)
466{
467 usb_ept_info *ept_info;
468 if((ept_addr & 0x80) == 0)
469 {
470 /* out endpoint info */
471 ept_info = &udev->ept_out[ept_addr & 0x7F];
472 }
473 else
474 {
475 /* in endpoint info */
476 ept_info = &udev->ept_in[ept_addr & 0x7F];
477 }
478
479 if(ept_info->is_double_buffer == 0)
480 {
481 if( ept_info->inout == DATA_TRANS_IN )
482 {
483 ept_info->tx_addr = addr;
484 }
485 else
486 {
487 ept_info->rx_addr = addr;
488 }
489 }
490 else
491 {
492 /* double buffer malloc */
493 ept_info->tx_addr = addr & 0xFFFF;
494 ept_info->rx_addr = (addr >> 16) & 0xFFFF;
495 }
496}
497
506void usbd_ept_open(usbd_core_type *udev, uint8_t ept_addr, uint8_t ept_type, uint16_t maxpacket)
507{
508 usbd_type *usbx = udev->usb_reg;
509 usb_ept_info *ept_info;
510
511 if((ept_addr & 0x80) == 0)
512 {
513 /* out endpoint info */
514 ept_info = &udev->ept_out[ept_addr & 0x7F];
515 ept_info->inout = DATA_TRANS_OUT;
516 }
517 else
518 {
519 /* in endpoint info */
520 ept_info = &udev->ept_in[ept_addr & 0x7F];
521 ept_info->inout = DATA_TRANS_IN;
522 }
523
524 /* set endpoint maxpacket and type */
525 ept_info->maxpacket = (maxpacket + 1) & 0xFFFE;
526 ept_info->trans_type = ept_type;
527
528#ifdef USB_EPT_AUTO_MALLOC_BUFFER
529 usbd_ept_buf_auto_define(ept_info);
530#endif
531 /* open endpoint */
532 usb_ept_open(usbx, ept_info);
533}
534
541void usbd_ept_close(usbd_core_type *udev, uint8_t ept_addr)
542{
543 usb_ept_info *ept_info;
544 if(ept_addr & 0x80)
545 {
546 /* in endpoint */
547 ept_info = &udev->ept_in[ept_addr & 0x7F];
548 }
549 else
550 {
551 /* out endpoint */
552 ept_info = &udev->ept_out[ept_addr & 0x7F];
553 }
554
555 /* close endpoint */
556 usb_ept_close(udev->usb_reg, ept_info);
557}
558
564void usbd_connect(usbd_core_type *udev)
565{
566 usb_connect(udev->usb_reg);
567}
568
574void usbd_disconnect(usbd_core_type *udev)
575{
576 usb_disconnect(udev->usb_reg);
577}
578
585void usbd_set_device_addr(usbd_core_type *udev, uint8_t address)
586{
587 usb_set_address(udev->usb_reg, address);
588}
589
595 usbd_conn_state usbd_connect_state_get(usbd_core_type *udev)
596{
597 return udev->conn_state;
598}
599
605void usbd_remote_wakeup(usbd_core_type *udev)
606{
607 /* set connect state */
608 udev->conn_state = udev->old_conn_state;
609
610 usb_exit_suspend(udev->usb_reg);
611
612 usb_remote_wkup_set(udev->usb_reg);
613
614 usb_delay_ms(10);
615
616 usb_remote_wkup_clear(udev->usb_reg);
617
618}
619
625void usbd_enter_suspend(usbd_core_type *udev)
626{
627 usb_enter_suspend(udev->usb_reg);
628}
629
635void usbd_ept_defaut_init(usbd_core_type *udev)
636{
637 uint8_t i_index = 0;
638 /* init in endpoint info structure */
639 for(i_index = 0; i_index < USB_EPT_MAX_NUM; i_index ++)
640 {
641 udev->ept_in[i_index].eptn = i_index;
642 udev->ept_in[i_index].ept_address = i_index;
643 udev->ept_in[i_index].inout = DATA_TRANS_IN;
644 udev->ept_in[i_index].maxpacket = 0;
645 udev->ept_in[i_index].trans_buf = 0;
646 udev->ept_in[i_index].total_len = 0;
647 udev->ept_in[i_index].tx_addr = 0;
648 udev->ept_in[i_index].rx_addr = 0;
649 }
650
651 /* init out endpoint info structure */
652 for(i_index = 0; i_index < USB_EPT_MAX_NUM; i_index ++)
653 {
654 udev->ept_out[i_index].eptn = i_index;
655 udev->ept_out[i_index].ept_address = i_index;
656 udev->ept_out[i_index].inout = DATA_TRANS_OUT;
657 udev->ept_out[i_index].maxpacket = 0;
658 udev->ept_out[i_index].trans_buf = 0;
659 udev->ept_out[i_index].total_len = 0;
660 udev->ept_out[i_index].rx_addr = 0;
661 udev->ept_out[i_index].tx_addr = 0;
662 }
663 return;
664}
665
675void usbd_core_init(usbd_core_type *udev,
676 usb_reg_type *usb_reg,
677 usbd_class_handler *class_handler,
678 usbd_desc_handler *desc_handler,
679 uint8_t core_id)
680{
681 /* usb class handler */
682 udev->class_handler = class_handler;
683
684 /* usb description handler */
685 udev->desc_handler = desc_handler;
686
687 /* set usb register type */
688 udev->usb_reg = usb_reg;
689
690 /* set usb connect state to default */
691 udev->conn_state = USB_CONN_STATE_DEFAULT;
692
693 /* init in endpoint info structure */
694 usbd_ept_defaut_init(udev);
695
696#ifdef USB_BUFFER_SIZE_EX
697 /* usb buffer size extend 768-1280 byte */
698 usb_usbbufs_enable(usb_reg, TRUE);
699#endif
700
701 /*usb register config */
702 usb_dev_init(udev->usb_reg);
703}
704
usb_delay_ms
void usb_delay_ms(uint32_t ms)
usb delay millisecond function.
Definition project/at_start_f413/examples/acc/calibration/src/main.c:244
buffer
uint8_t buffer[((uint16_t) 160) *((uint16_t) 120)]
Definition project/at_start_f413/examples/cortex_m4/fpu/src/main.c:42
TRUE
@ TRUE
Definition at32f413.h:297
USB_RX_STALL
#define USB_RX_STALL
Definition at32f413_usb.h:124
USB_TX_VALID
#define USB_TX_VALID
Definition at32f413_usb.h:118
USB_TX_NAK
#define USB_TX_NAK
Definition at32f413_usb.h:117
USB_TX_STALL
#define USB_TX_STALL
Definition at32f413_usb.h:116
USB_RX_VALID
#define USB_RX_VALID
Definition at32f413_usb.h:126
DATA_TRANS_OUT
@ DATA_TRANS_OUT
Definition at32f413_usb.h:222
DATA_TRANS_IN
@ DATA_TRANS_IN
Definition at32f413_usb.h:223
usb_exit_suspend
void usb_exit_suspend(usbd_type *usbx)
usb device exit suspend mode
Definition at32f413_usb.c:452
usb_write_packet
void usb_write_packet(uint8_t *pusr_buf, uint16_t offset_addr, uint16_t nbytes)
write data from user memory to usb buffer
Definition at32f413_usb.c:326
usb_disconnect
void usb_disconnect(usbd_type *usbx)
disconnect usb device
Definition at32f413_usb.c:92
usb_enter_suspend
void usb_enter_suspend(usbd_type *usbx)
usb device enter suspend mode
Definition at32f413_usb.c:440
usb_remote_wkup_clear
void usb_remote_wkup_clear(usbd_type *usbx)
usb remote wakeup clear
Definition at32f413_usb.c:475
usb_usbbufs_enable
void usb_usbbufs_enable(usbd_type *usbx, confirm_state state)
mapping usb packet buffer area two mapping intervals are available for packet buffer area,...
Definition at32f413_usb.c:115
usb_set_address
void usb_set_address(usbd_type *usbx, uint8_t address)
set the host assignment address
Definition at32f413_usb.c:408
usb_buffer_malloc
uint16_t usb_buffer_malloc(uint16_t maxpacket)
usb auto malloc endpoint buffer
Definition at32f413_usb.c:485
usb_remote_wkup_set
void usb_remote_wkup_set(usbd_type *usbx)
usb remote wakeup set
Definition at32f413_usb.c:464
usb_connect
void usb_connect(usbd_type *usbx)
connect usb device
Definition at32f413_usb.c:80
usb_ept_open
void usb_ept_open(usbd_type *usbx, usb_ept_info *ept_info)
open usb endpoint
Definition at32f413_usb.c:139
usb_dev_init
void usb_dev_init(usbd_type *usbx)
initialize usb peripheral controller register
Definition at32f413_usb.c:57
usb_ept_close
void usb_ept_close(usbd_type *usbx, usb_ept_info *ept_info)
close usb endpoint
Definition at32f413_usb.c:267
USB_CLEAR_TXDTS
#define USB_CLEAR_TXDTS(eptn)
clear usb tx/rx toggle
Definition at32f413_usb.h:418
USB_SET_EPT_DOUBLE_BUF1_LEN
#define USB_SET_EPT_DOUBLE_BUF1_LEN(eptn, len, dir)
double buffer mode set endpoint buf1 length
Definition at32f413_usb.h:376
USB_SET_RXSTS
#define USB_SET_RXSTS(ept_num, new_sts)
set usb endpoint rx status
Definition at32f413_usb.h:263
USB_CLEAR_RXDTS
#define USB_CLEAR_RXDTS(eptn)
Definition at32f413_usb.h:422
USB_FREE_DB_USER_BUFFER
#define USB_FREE_DB_USER_BUFFER(eptn, inout)
free buffer used by application
Definition at32f413_usb.h:461
USB_SET_TXLEN
#define USB_SET_TXLEN(eptn, len)
set endpoint tx/rx transfer length
Definition at32f413_usb.h:334
USB_SET_TXSTS
#define USB_SET_TXSTS(ept_num, new_sts)
set usb endpoint tx status
Definition at32f413_usb.h:248
USB_SET_EPT_DOUBLE_BUF0_LEN
#define USB_SET_EPT_DOUBLE_BUF0_LEN(eptn, len, dir)
double buffer mode set endpoint buf0 length
Definition at32f413_usb.h:358
USB_EPT0_STATUS_OUT
#define USB_EPT0_STATUS_OUT
Definition usb_std.h:149
usbd_conn_state
usbd_conn_state
usb device connect state
Definition usb_std.h:134
MIN
#define MIN(a, b)
min and max define
Definition usb_std.h:260
USB_EPT0_DATA_IN
#define USB_EPT0_DATA_IN
Definition usb_std.h:146
USB_REQ_RECIPIENT_DEVICE
#define USB_REQ_RECIPIENT_DEVICE
usb request recipient
Definition usb_std.h:53
USB_REQ_RECIPIENT_MASK
#define USB_REQ_RECIPIENT_MASK
Definition usb_std.h:57
USB_EPT0_DATA_OUT
#define USB_EPT0_DATA_OUT
Definition usb_std.h:147
USB_EPT0_SETUP
#define USB_EPT0_SETUP
Definition usb_std.h:145
USB_REQ_RECIPIENT_ENDPOINT
#define USB_REQ_RECIPIENT_ENDPOINT
Definition usb_std.h:55
USB_EPT0_STATUS_IN
#define USB_EPT0_STATUS_IN
Definition usb_std.h:148
USB_REQ_RECIPIENT_INTERFACE
#define USB_REQ_RECIPIENT_INTERFACE
Definition usb_std.h:54
USB_CONN_STATE_DEFAULT
@ USB_CONN_STATE_DEFAULT
Definition usb_std.h:135
USB_CONN_STATE_CONFIGURED
@ USB_CONN_STATE_CONFIGURED
Definition usb_std.h:137
usbd_connect_state_get
usbd_conn_state usbd_connect_state_get(usbd_core_type *udev)
get usb connect state
Definition usbd_core.c:595
usbd_set_stall
void usbd_set_stall(usbd_core_type *udev, uint8_t ept_addr)
usb set endpoint to stall.
Definition usbd_core.c:264
usbd_ept_dbuffer_enable
void usbd_ept_dbuffer_enable(usbd_core_type *udev, uint8_t ept_addr)
enable endpoint double buffer.
Definition usbd_core.c:409
usbd_ept_close
void usbd_ept_close(usbd_core_type *udev, uint8_t ept_addr)
usb close endpoint
Definition usbd_core.c:541
usbd_ctrl_send_status
void usbd_ctrl_send_status(usbd_core_type *udev)
usb control endpoint send in status
Definition usbd_core.c:210
usbd_set_device_addr
void usbd_set_device_addr(usbd_core_type *udev, uint8_t address)
usb device set device address.
Definition usbd_core.c:585
usbd_ept_recv
void usbd_ept_recv(usbd_core_type *udev, uint8_t ept_addr, uint8_t *buffer, uint16_t len)
usb endpoint receive data
Definition usbd_core.c:364
usbd_core_out_handler
void usbd_core_out_handler(usbd_core_type *udev, uint8_t ept_addr)
usb core out transfer complete handler
Definition usbd_core.c:99
usbd_ept_buf_custom_define
void usbd_ept_buf_custom_define(usbd_core_type *udev, uint8_t ept_addr, uint32_t addr)
usb custom define endpoint buffer
Definition usbd_core.c:464
usbd_ept_open
void usbd_ept_open(usbd_core_type *udev, uint8_t ept_addr, uint8_t ept_type, uint16_t maxpacket)
usb open endpoint
Definition usbd_core.c:506
usbd_ctrl_recv_status
void usbd_ctrl_recv_status(usbd_core_type *udev)
usb control endpoint send out status
Definition usbd_core.c:222
usbd_ctrl_send
void usbd_ctrl_send(usbd_core_type *udev, uint8_t *buffer, uint16_t len)
usb control endpoint send data
Definition usbd_core.c:175
usbd_core_in_handler
void usbd_core_in_handler(usbd_core_type *udev, uint8_t ept_addr)
usb core in transfer complete handler
Definition usbd_core.c:47
usbd_ept_send
void usbd_ept_send(usbd_core_type *udev, uint8_t ept_addr, uint8_t *buffer, uint16_t len)
usb endpoint send data
Definition usbd_core.c:304
usbd_clear_stall
void usbd_clear_stall(usbd_core_type *udev, uint8_t ept_addr)
clear endpoint stall
Definition usbd_core.c:235
usbd_get_recv_len
uint32_t usbd_get_recv_len(usbd_core_type *udev, uint8_t ept_addr)
usb endpoint get receive data length
Definition usbd_core.c:397
usbd_remote_wakeup
void usbd_remote_wakeup(usbd_core_type *udev)
usb device remote wakeup
Definition usbd_core.c:605
usbd_connect
void usbd_connect(usbd_core_type *udev)
usb device connect to host
Definition usbd_core.c:564
usbd_ept_defaut_init
void usbd_ept_defaut_init(usbd_core_type *udev)
usb endpoint structure initialization
Definition usbd_core.c:635
usbd_ept_buf_auto_define
void usbd_ept_buf_auto_define(usb_ept_info *ept_info)
usb auto define endpoint buffer
Definition usbd_core.c:430
usbd_ctrl_recv
void usbd_ctrl_recv(usbd_core_type *udev, uint8_t *buffer, uint16_t len)
usb control endpoint receive data
Definition usbd_core.c:194
usbd_ctrl_unsupport
void usbd_ctrl_unsupport(usbd_core_type *udev)
un-support device request
Definition usbd_core.c:289
usbd_core_init
void usbd_core_init(usbd_core_type *udev, usb_reg_type *usb_reg, usbd_class_handler *class_handler, usbd_desc_handler *desc_handler, uint8_t core_id)
initializes the usb core
Definition usbd_core.c:675
usbd_enter_suspend
void usbd_enter_suspend(usbd_core_type *udev)
usb device enter suspend mode
Definition usbd_core.c:625
usbd_disconnect
void usbd_disconnect(usbd_core_type *udev)
usb device disconnect to host
Definition usbd_core.c:574
usbd_core_setup_handler
void usbd_core_setup_handler(usbd_core_type *udev, uint8_t ept_num)
usb core setup transfer complete handler
Definition usbd_core.c:139
usbd_endpoint_request
usb_sts_type usbd_endpoint_request(usbd_core_type *udev)
standard usb endpoint requests
Definition usbd_sdr.c:438
usbd_setup_request_parse
void usbd_setup_request_parse(usb_setup_type *setup, uint8_t *buf)
usb parse standard setup request
Definition usbd_sdr.c:54
usbd_device_request
usb_sts_type usbd_device_request(usbd_core_type *udev)
standard usb device requests
Definition usbd_sdr.c:367
usbd_interface_request
usb_sts_type usbd_interface_request(usbd_core_type *udev)
standard usb interface requests
Definition usbd_sdr.c:411
USB
#define USB
Definition at32f413_usb.h:665
usb_ept_info
usb endpoint infomation structure definition
Definition at32f413_usb.h:500
usb_ept_info::total_len
uint16_t total_len
Definition at32f413_usb.h:514
usb_ept_info::ept_address
uint8_t ept_address
Definition at32f413_usb.h:502
usb_ept_info::trans_len
uint16_t trans_len
Definition at32f413_usb.h:515
usb_ept_info::inout
uint8_t inout
Definition at32f413_usb.h:503
usb_ept_info::maxpacket
uint16_t maxpacket
Definition at32f413_usb.h:508
usb_ept_info::ept0_slen
uint16_t ept0_slen
Definition at32f413_usb.h:520
usb_ept_info::rx_addr
uint16_t rx_addr
Definition at32f413_usb.h:507
usb_ept_info::trans_buf
uint8_t * trans_buf
Definition at32f413_usb.h:516
usb_ept_info::stall
uint8_t stall
Definition at32f413_usb.h:510
usb_ept_info::is_double_buffer
uint8_t is_double_buffer
Definition at32f413_usb.h:509
usb_ept_info::last_len
uint16_t last_len
Definition at32f413_usb.h:518
usb_ept_info::rem0_len
uint16_t rem0_len
Definition at32f413_usb.h:519
usb_ept_info::tx_addr
uint16_t tx_addr
Definition at32f413_usb.h:506
usb_ept_info::eptn
uint8_t eptn
Definition at32f413_usb.h:501
usb_ept_info::trans_type
uint8_t trans_type
Definition at32f413_usb.h:504
usb_setup_type::wLength
uint16_t wLength
Definition usb_std.h:303
usb_setup_type::bmRequestType
uint8_t bmRequestType
Definition usb_std.h:298
usbd_class_handler
usb device class handler
Definition usbd_core.h:97
usbd_class_handler::out_handler
usb_sts_type(* out_handler)(void *udev, uint8_t ept_num)
Definition usbd_core.h:104
usbd_class_handler::ept0_tx_handler
usb_sts_type(* ept0_tx_handler)(void *udev)
Definition usbd_core.h:101
usbd_class_handler::ept0_rx_handler
usb_sts_type(* ept0_rx_handler)(void *udev)
Definition usbd_core.h:102
usbd_class_handler::in_handler
usb_sts_type(* in_handler)(void *udev, uint8_t ept_num)
Definition usbd_core.h:103
usbd_core_type
usb device core struct type
Definition usbd_core.h:114
usbd_core_type::conn_state
usbd_conn_state conn_state
Definition usbd_core.h:130
usbd_core_type::setup_buffer
uint8_t setup_buffer[12]
Definition usbd_core.h:124
usbd_core_type::ept0_wlength
uint16_t ept0_wlength
Definition usbd_core.h:128
usbd_core_type::ept0_sts
uint8_t ept0_sts
Definition usbd_core.h:126
usbd_core_type::old_conn_state
usbd_conn_state old_conn_state
Definition usbd_core.h:131
usbd_core_type::class_handler
usbd_class_handler * class_handler
Definition usbd_core.h:117
usbd_core_type::ept_in
usb_ept_info ept_in[USB_EPT_MAX_NUM]
Definition usbd_core.h:120
usbd_core_type::ept_out
usb_ept_info ept_out[USB_EPT_MAX_NUM]
Definition usbd_core.h:121
usbd_core_type::setup
usb_setup_type setup
Definition usbd_core.h:123
usbd_core_type::usb_reg
usb_reg_type * usb_reg
Definition usbd_core.h:115
usbd_core_type::desc_handler
usbd_desc_handler * desc_handler
Definition usbd_core.h:118
usbd_desc_handler
usb device descriptor handler
Definition usbd_core.h:75
usbd_type
type define usb register all
Definition at32f413_usb.h:527
usbd_type::ept_bit
struct usbd_type::@734::@748 ept_bit[8]
usbd_type::txdts
__IO uint32_t txdts
Definition at32f413_usb.h:538
usbd_core.h
usb device core header file
usbd_sdr.h
usb standard request header file


AT32F413 Firmwary Library: usbd_core.h Source File

  • middlewares
  • usbd_drivers
  • inc
usbd_core.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __USBD_CORE_H
28#define __USBD_CORE_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34
35#include "usb_conf.h"
36#include "usb_std.h"
37
53typedef enum
54{
55 USBD_NOP_EVENT,
56 USBD_RESET_EVENT,
57 USBD_SUSPEND_EVENT,
58 USBD_WAKEUP_EVENT,
59 USBD_ERR_EVENT
60}usbd_event_type;
61
65typedef struct
66{
67 uint16_t length;
68 uint8_t *descriptor;
69}usbd_desc_t;
70
74typedef struct
75{
76 usbd_desc_t *(*get_device_descriptor)(void);
77 usbd_desc_t *(*get_device_qualifier)(void);
78 usbd_desc_t *(*get_device_configuration)(void);
79 usbd_desc_t *(*get_device_other_speed)(void);
80 usbd_desc_t *(*get_device_lang_id)(void);
81 usbd_desc_t *(*get_device_manufacturer_string)(void);
82 usbd_desc_t *(*get_device_product_string)(void);
83 usbd_desc_t *(*get_device_serial_string)(void);
84 usbd_desc_t *(*get_device_interface_string)(void);
85 usbd_desc_t *(*get_device_config_string)(void);
86#if (USBD_SUPPORT_WINUSB == 1)
87 usbd_desc_t *(*get_device_winusb_os_string)(void);
88 usbd_desc_t *(*get_device_winusb_os_feature)(void);
89 usbd_desc_t *(*get_device_winusb_os_property)(void);
90#endif
91}usbd_desc_handler;
92
96typedef struct
97{
98 usb_sts_type (*init_handler)(void *udev);
99 usb_sts_type (*clear_handler)(void *udev);
100 usb_sts_type (*setup_handler)(void *udev, usb_setup_type *setup);
101 usb_sts_type (*ept0_tx_handler)(void *udev);
102 usb_sts_type (*ept0_rx_handler)(void *udev);
103 usb_sts_type (*in_handler)(void *udev, uint8_t ept_num);
104 usb_sts_type (*out_handler)(void *udev, uint8_t ept_num);
105 usb_sts_type (*sof_handler)(void *udev);
106 usb_sts_type (*event_handler)(void *udev, usbd_event_type event);
107 void *pdata;
108}usbd_class_handler;
109
113typedef struct
114{
115 usb_reg_type *usb_reg;
117 usbd_class_handler *class_handler;
118 usbd_desc_handler *desc_handler;
120 usb_ept_info ept_in[USB_EPT_MAX_NUM];
121 usb_ept_info ept_out[USB_EPT_MAX_NUM];
123 usb_setup_type setup;
124 uint8_t setup_buffer[12];
126 uint8_t ept0_sts;
127 uint8_t speed;
128 uint16_t ept0_wlength;
130 usbd_conn_state conn_state;
131 usbd_conn_state old_conn_state;
133 uint8_t device_addr;
134 uint8_t remote_wakup;
135 uint8_t default_config;
136 uint8_t dev_config;
137 uint16_t config_status;
138}usbd_core_type;
139
147void usbd_core_in_handler(usbd_core_type *udev, uint8_t ept_num);
148void usbd_core_out_handler(usbd_core_type *udev, uint8_t ept_num);
149void usbd_core_setup_handler(usbd_core_type *udev, uint8_t ept_num);
150void usbd_ctrl_unsupport(usbd_core_type *udev);
151void usbd_ctrl_send(usbd_core_type *udev, uint8_t *buffer, uint16_t len);
152void usbd_ctrl_recv(usbd_core_type *udev, uint8_t *buffer, uint16_t len);
153void usbd_ctrl_send_status(usbd_core_type *udev);
154void usbd_ctrl_recv_status(usbd_core_type *udev);
155void usbd_set_stall(usbd_core_type *udev, uint8_t ept_addr);
156void usbd_clear_stall(usbd_core_type *udev, uint8_t ept_addr);
157void usbd_ept_open(usbd_core_type *udev, uint8_t ept_addr, uint8_t ept_type, uint16_t maxpacket);
158void usbd_ept_close(usbd_core_type *udev, uint8_t ept_addr);
159void usbd_ept_send(usbd_core_type *udev, uint8_t ept_num, uint8_t *buffer, uint16_t len);
160void usbd_ept_recv(usbd_core_type *udev, uint8_t ept_num, uint8_t *buffer, uint16_t len);
161void usbd_connect(usbd_core_type *udev);
162void usbd_disconnect(usbd_core_type *udev);
163void usbd_set_device_addr(usbd_core_type *udev, uint8_t address);
164uint32_t usbd_get_recv_len(usbd_core_type *udev, uint8_t ept_addr);
165 usbd_conn_state usbd_connect_state_get(usbd_core_type *udev);
166void usbd_ept_dbuffer_enable(usbd_core_type *udev, uint8_t ept_addr);
167void usbd_ept_buf_auto_define(usb_ept_info *ept_info);
168void usbd_ept_buf_custom_define( usbd_core_type *udev, uint8_t ept_addr,
169 uint32_t addr);
170void usbd_ept_defaut_init(usbd_core_type *udev);
171void usbd_remote_wakeup(usbd_core_type *udev);
172void usbd_enter_suspend(usbd_core_type *udev);
173void usbd_core_init(usbd_core_type *udev,
174 usb_reg_type *usb_reg,
175 usbd_class_handler *dev_handler,
176 usbd_desc_handler *desc_handler,
177 uint8_t core_id);
178
179
192#ifdef __cplusplus
193}
194#endif
195
196#endif
197
buffer
uint8_t buffer[((uint16_t) 160) *((uint16_t) 120)]
Definition project/at_start_f413/examples/cortex_m4/fpu/src/main.c:42
usbd_conn_state
usbd_conn_state
usb device connect state
Definition usb_std.h:134
usb_sts_type
usb_sts_type
usb return status
Definition usb_std.h:285
usbd_connect_state_get
usbd_conn_state usbd_connect_state_get(usbd_core_type *udev)
get usb connect state
Definition usbd_core.c:595
usbd_set_stall
void usbd_set_stall(usbd_core_type *udev, uint8_t ept_addr)
usb set endpoint to stall.
Definition usbd_core.c:264
usbd_ept_dbuffer_enable
void usbd_ept_dbuffer_enable(usbd_core_type *udev, uint8_t ept_addr)
enable endpoint double buffer.
Definition usbd_core.c:409
usbd_ept_close
void usbd_ept_close(usbd_core_type *udev, uint8_t ept_addr)
usb close endpoint
Definition usbd_core.c:541
usbd_ept_recv
void usbd_ept_recv(usbd_core_type *udev, uint8_t ept_num, uint8_t *buffer, uint16_t len)
usb endpoint receive data
Definition usbd_core.c:364
usbd_ctrl_send_status
void usbd_ctrl_send_status(usbd_core_type *udev)
usb control endpoint send in status
Definition usbd_core.c:210
usbd_set_device_addr
void usbd_set_device_addr(usbd_core_type *udev, uint8_t address)
usb device set device address.
Definition usbd_core.c:585
usbd_core_in_handler
void usbd_core_in_handler(usbd_core_type *udev, uint8_t ept_num)
usb core in transfer complete handler
Definition usbd_core.c:47
usbd_ept_buf_custom_define
void usbd_ept_buf_custom_define(usbd_core_type *udev, uint8_t ept_addr, uint32_t addr)
usb custom define endpoint buffer
Definition usbd_core.c:464
usbd_ept_open
void usbd_ept_open(usbd_core_type *udev, uint8_t ept_addr, uint8_t ept_type, uint16_t maxpacket)
usb open endpoint
Definition usbd_core.c:506
usbd_core_init
void usbd_core_init(usbd_core_type *udev, usb_reg_type *usb_reg, usbd_class_handler *dev_handler, usbd_desc_handler *desc_handler, uint8_t core_id)
initializes the usb core
Definition usbd_core.c:675
usbd_ctrl_recv_status
void usbd_ctrl_recv_status(usbd_core_type *udev)
usb control endpoint send out status
Definition usbd_core.c:222
usbd_ctrl_send
void usbd_ctrl_send(usbd_core_type *udev, uint8_t *buffer, uint16_t len)
usb control endpoint send data
Definition usbd_core.c:175
usbd_core_out_handler
void usbd_core_out_handler(usbd_core_type *udev, uint8_t ept_num)
usb core out transfer complete handler
Definition usbd_core.c:99
usbd_clear_stall
void usbd_clear_stall(usbd_core_type *udev, uint8_t ept_addr)
clear endpoint stall
Definition usbd_core.c:235
usbd_get_recv_len
uint32_t usbd_get_recv_len(usbd_core_type *udev, uint8_t ept_addr)
usb endpoint get receive data length
Definition usbd_core.c:397
usbd_remote_wakeup
void usbd_remote_wakeup(usbd_core_type *udev)
usb device remote wakeup
Definition usbd_core.c:605
usbd_connect
void usbd_connect(usbd_core_type *udev)
usb device connect to host
Definition usbd_core.c:564
usbd_ept_defaut_init
void usbd_ept_defaut_init(usbd_core_type *udev)
usb endpoint structure initialization
Definition usbd_core.c:635
usbd_ept_buf_auto_define
void usbd_ept_buf_auto_define(usb_ept_info *ept_info)
usb auto define endpoint buffer
Definition usbd_core.c:430
usbd_ctrl_recv
void usbd_ctrl_recv(usbd_core_type *udev, uint8_t *buffer, uint16_t len)
usb control endpoint receive data
Definition usbd_core.c:194
usbd_ctrl_unsupport
void usbd_ctrl_unsupport(usbd_core_type *udev)
un-support device request
Definition usbd_core.c:289
usbd_enter_suspend
void usbd_enter_suspend(usbd_core_type *udev)
usb device enter suspend mode
Definition usbd_core.c:625
usbd_ept_send
void usbd_ept_send(usbd_core_type *udev, uint8_t ept_num, uint8_t *buffer, uint16_t len)
usb endpoint send data
Definition usbd_core.c:304
usbd_disconnect
void usbd_disconnect(usbd_core_type *udev)
usb device disconnect to host
Definition usbd_core.c:574
usbd_core_setup_handler
void usbd_core_setup_handler(usbd_core_type *udev, uint8_t ept_num)
usb core setup transfer complete handler
Definition usbd_core.c:139
usbd_event_type
usbd_event_type
usb device event
Definition usbd_core.h:54
USBD_ERR_EVENT
@ USBD_ERR_EVENT
Definition usbd_core.h:59
USBD_SUSPEND_EVENT
@ USBD_SUSPEND_EVENT
Definition usbd_core.h:57
USBD_RESET_EVENT
@ USBD_RESET_EVENT
Definition usbd_core.h:56
USBD_WAKEUP_EVENT
@ USBD_WAKEUP_EVENT
Definition usbd_core.h:58
USBD_NOP_EVENT
@ USBD_NOP_EVENT
Definition usbd_core.h:55
usb_ept_info
usb endpoint infomation structure definition
Definition at32f413_usb.h:500
usb_setup_type
format of usb setup data
Definition usb_std.h:297
usbd_class_handler
usb device class handler
Definition usbd_core.h:97
usbd_class_handler::pdata
void * pdata
Definition usbd_core.h:107
usbd_core_type
usb device core struct type
Definition usbd_core.h:114
usbd_core_type::conn_state
usbd_conn_state conn_state
Definition usbd_core.h:130
usbd_core_type::default_config
uint8_t default_config
Definition usbd_core.h:135
usbd_core_type::remote_wakup
uint8_t remote_wakup
Definition usbd_core.h:134
usbd_core_type::ept0_wlength
uint16_t ept0_wlength
Definition usbd_core.h:128
usbd_core_type::ept0_sts
uint8_t ept0_sts
Definition usbd_core.h:126
usbd_core_type::old_conn_state
usbd_conn_state old_conn_state
Definition usbd_core.h:131
usbd_core_type::class_handler
usbd_class_handler * class_handler
Definition usbd_core.h:117
usbd_core_type::config_status
uint16_t config_status
Definition usbd_core.h:137
usbd_core_type::speed
uint8_t speed
Definition usbd_core.h:127
usbd_core_type::dev_config
uint8_t dev_config
Definition usbd_core.h:136
usbd_core_type::device_addr
uint8_t device_addr
Definition usbd_core.h:133
usbd_core_type::setup
usb_setup_type setup
Definition usbd_core.h:123
usbd_core_type::usb_reg
usb_reg_type * usb_reg
Definition usbd_core.h:115
usbd_core_type::desc_handler
usbd_desc_handler * desc_handler
Definition usbd_core.h:118
usbd_desc_handler
usb device descriptor handler
Definition usbd_core.h:75
usbd_desc_t
usb device descriptor struct
Definition usbd_core.h:66
usbd_desc_t::length
uint16_t length
Definition usbd_core.h:67
usbd_desc_t::descriptor
uint8_t * descriptor
Definition usbd_core.h:68
usbd_type
type define usb register all
Definition at32f413_usb.h:527
usb_std.h
usb standard header file


AT32F413 Firmwary Library: usbd_int.c Source File

  • middlewares
  • usbd_drivers
  • src
usbd_int.c
Go to the documentation of this file.
1
25#include "usbd_int.h"
26
45void usbd_irq_handler(usbd_core_type *udev)
46{
47 usbd_type *usbx = udev->usb_reg;
48 uint32_t sts_val = usbx->intsts;
49 uint32_t sts_ien = usbx->ctrl;
50
51 if(sts_val & USB_TC_FLAG)
52 {
53 /* endpoint tc interrupt handler */
54 usbd_ept_loop_handler(udev);
55 }
56
57 if(sts_val & USB_RST_FLAG)
58 {
59 /* clear reset flag */
60 usb_flag_clear(usbx, USB_RST_FLAG);
61
62 /* reset interrupt handler */
63 usbd_reset_handler(udev);
64 }
65
66 if((sts_val & USB_SOF_FLAG) &&
67 (sts_ien & USB_SOF_INT))
68 {
69 /* clear sof flag */
70 usb_flag_clear(usbx, USB_SOF_FLAG);
71
72 /* sof interrupt handler */
73 usbd_sof_handler(udev);
74 }
75
76 if((sts_val & USB_LSOF_FLAG) &&
77 (sts_ien & USB_LSOF_INT))
78 {
79 /* clear lsof flag */
80 usb_flag_clear(usbx, USB_LSOF_FLAG);
81 }
82
83 if((sts_val & USB_SP_FLAG) &&
84 (sts_ien & USB_SP_INT))
85 {
86 /* clear suspend flag */
87 usb_flag_clear(usbx, USB_SP_FLAG);
88
89 /* usb suspend interrupt handler */
90 usbd_suspend_handler(udev);
91 }
92
93 if((sts_val & USB_WK_FLAG) &&
94 (sts_ien & USB_WK_INT))
95 {
96 /* usb wakeup interrupt handler */
97 usbd_wakeup_handler(udev);
98
99 /* clear wakeup flag */
100 usb_flag_clear(usbx, USB_WK_FLAG);
101 }
102}
103
110void usbd_eptn_handler(usbd_core_type *udev, usb_ept_number_type ept_num)
111{
112 usbd_type *usbx = udev->usb_reg;
113 usb_ept_info *ept_info;
114 uint32_t ept_val = usbx->ept[ept_num];
115 uint16_t length;
116
117 /* in interrupt request */
118 if(ept_val & USB_TXTC)
119 {
120 /* get endpoint register and in transfer info struct */
121 ept_info = &udev->ept_in[ept_num];
122
123 /* clear endpoint tc flag */
124 USB_CLEAR_TXTC(ept_num);
125
126 /* get endpoint tx length */
127 ept_info->trans_len = USB_GET_TX_LEN(ept_num);
128
129 /* offset the trans buffer */
130 ept_info->trans_buf += ept_info->trans_len;
131
132 if(ept_info->total_len == 0 || ept_num == USB_EPT0)
133 {
134 /* in transfer complete */
135 usbd_core_in_handler(udev, ept_num);
136 }
137 else
138 {
139 /* endpoint continue send data */
140 usbd_ept_send(udev, ept_num, ept_info->trans_buf, ept_info->total_len);
141 }
142 /* set the host assignment address */
143 if(udev->conn_state == USB_CONN_STATE_ADDRESSED && udev->device_addr > 0)
144 {
145 usb_set_address(udev->usb_reg, udev->device_addr);
146 udev->device_addr = 0;
147 }
148 }
149 else
150 {
151 /* setup and out interrupt request */
152
153 /* get endpoint register and out transfer info struct */
154 ept_info = &udev->ept_out[ept_num];
155
156 if((ept_val & USB_SETUPTC) != 0)
157 {
158 /* endpoint setup interrupt request */
159
160 /* get endpoint received data length */
161 ept_info->trans_len = USB_GET_RX_LEN(ept_num);
162
163 /* read endpoint received data */
164 usb_read_packet(udev->setup_buffer, ept_info->rx_addr, ept_info->trans_len);
165
166 /* clear endpoint rx tc flag */
167 USB_CLEAR_RXTC(USB_EPT0);
168
169 /* endpoint setup complete handler */
170 usbd_core_setup_handler(udev, ept_num);
171 }
172 else if(ept_val & USB_RXTC )
173 {
174 /* endpoint out interrupt request */
175 USB_CLEAR_RXTC(ept_num);
176
177 if(ept_info->is_double_buffer == 0)
178 {
179 /* get endpoint received data length */
180 length = USB_GET_RX_LEN(ept_num);
181
182 /* read endpoint received data */
183 usb_read_packet(ept_info->trans_buf, ept_info->rx_addr, length);
184 }
185 else
186 {
187 if( ept_val & USB_RXDTS)
188 {
189 length = USB_DBUF0_GET_LEN(ept_num);
190 usb_read_packet(ept_info->trans_buf, ept_info->tx_addr, length);
191 }
192 else
193 {
194 length = USB_DBUF1_GET_LEN(ept_num);
195 usb_read_packet(ept_info->trans_buf, ept_info->rx_addr, length);
196 }
197 USB_FREE_DB_USER_BUFFER(ept_num, DATA_TRANS_OUT);
198 }
199
200 /* set received data length */
201 ept_info->trans_len += length;
202 ept_info->trans_buf += length;
203
204 if(ept_info->total_len == 0 || length < ept_info->maxpacket || ept_num == USB_EPT0)
205 {
206 /* out transfer complete */
207 usbd_core_out_handler(udev, ept_num);
208 }
209 else
210 {
211 /* endpoint continue receive data */
212 usbd_ept_recv(udev, ept_num, ept_info->trans_buf, ept_info->total_len);
213 }
214 }
215 }
216}
217
223void usbd_ept_loop_handler(usbd_core_type *udev)
224{
225 usbd_type *usbx = udev->usb_reg;
226 usb_ept_number_type ept_num = USB_EPT0;
227 uint32_t sts_val;
228
229 while((sts_val = usbx->intsts) & USB_TC_FLAG)
230 {
231 /* get the interrupt endpoint number */
232 ept_num = (usb_ept_number_type)(sts_val & USB_EPT_NUM_FLAG);
233
234 usbd_eptn_handler(udev, ept_num);
235 }
236}
237
243void usbd_reset_handler(usbd_core_type *udev)
244{
245 /* free usb buffer */
246 usb_buffer_free();
247
248 usbd_ept_defaut_init(udev);
249#ifndef USB_EPT_AUTO_MALLOC_BUFFER
250 usbd_ept_buf_custom_define(udev, 0x80, EPT0_TX_ADDR);
251 usbd_ept_buf_custom_define(udev, 0x00, EPT0_RX_ADDR);
252#endif
253
254 /* open endpoint 0 out */
255 usbd_ept_open(udev, 0x00, EPT_CONTROL_TYPE, 0x40);
256
257 /* open endpoint 0 in */
258 usbd_ept_open(udev, 0x80, EPT_CONTROL_TYPE, 0x40);
259
260 /* set device address to 0 */
261 usb_set_address(udev->usb_reg, 0);
262
263 /* usb connect state set to default */
264 udev->conn_state = USB_CONN_STATE_DEFAULT;
265
266 /* user define reset event */
267 if(udev->class_handler->event_handler)
268 udev->class_handler->event_handler(udev, USBD_RESET_EVENT);
269}
270
276void usbd_sof_handler(usbd_core_type *udev)
277{
278 /* user sof handler in class define*/
279 if(udev->class_handler->sof_handler)
280 udev->class_handler->sof_handler(udev);
281}
282
288void usbd_suspend_handler(usbd_core_type *udev)
289{
290 /* save connect state */
291 udev->old_conn_state = udev->conn_state;
292
293 /* set current state to suspend */
294 udev->conn_state = USB_CONN_STATE_SUSPENDED;
295
296 /* enter suspend mode */
297 usbd_enter_suspend(udev);
298
299 /* user define suspend event */
300 if(udev->class_handler->event_handler)
301 udev->class_handler->event_handler(udev, USBD_SUSPEND_EVENT);
302}
303
309void usbd_wakeup_handler(usbd_core_type *udev)
310{
311 /* exit suspend mode */
312 usb_exit_suspend(udev->usb_reg);
313
314 /* restore connect state */
315 udev->conn_state = udev->old_conn_state;
316
317 /* user define wakeup event */
318 if(udev->class_handler->event_handler)
319 udev->class_handler->event_handler(udev, USBD_WAKEUP_EVENT);
320}
321
EPT0_TX_ADDR
#define EPT0_TX_ADDR
usb endpoint max num define
Definition project/at_start_f413/examples/acc/calibration/inc/usb_conf.h:73
EPT0_RX_ADDR
#define EPT0_RX_ADDR
Definition project/at_start_f413/examples/acc/calibration/inc/usb_conf.h:74
USB_RXTC
#define USB_RXTC
Definition at32f413_usb.h:100
USB_SETUPTC
#define USB_SETUPTC
Definition at32f413_usb.h:97
USB_RXDTS
#define USB_RXDTS
Definition at32f413_usb.h:99
USB_TXTC
#define USB_TXTC
Definition at32f413_usb.h:94
usb_ept_number_type
usb_ept_number_type
usb endpoint number define
Definition at32f413_usb.h:180
DATA_TRANS_OUT
@ DATA_TRANS_OUT
Definition at32f413_usb.h:222
USB_EPT0
@ USB_EPT0
Definition at32f413_usb.h:181
EPT_CONTROL_TYPE
@ EPT_CONTROL_TYPE
Definition at32f413_usb.h:202
usb_exit_suspend
void usb_exit_suspend(usbd_type *usbx)
usb device exit suspend mode
Definition at32f413_usb.c:452
usb_buffer_free
void usb_buffer_free(void)
free usb endpoint buffer
Definition at32f413_usb.c:497
usb_flag_clear
void usb_flag_clear(usbd_type *usbx, uint16_t flag)
clear flag of usb.
Definition at32f413_usb.c:583
usb_read_packet
void usb_read_packet(uint8_t *pusr_buf, uint16_t offset_addr, uint16_t nbytes)
read data from usb buffer to user buffer
Definition at32f413_usb.c:353
usb_set_address
void usb_set_address(usbd_type *usbx, uint8_t address)
set the host assignment address
Definition at32f413_usb.c:408
USB_EPT_NUM_FLAG
#define USB_EPT_NUM_FLAG
Definition at32f413_usb.h:71
USB_SOF_FLAG
#define USB_SOF_FLAG
Definition at32f413_usb.h:74
USB_WK_FLAG
#define USB_WK_FLAG
Definition at32f413_usb.h:77
USB_TC_FLAG
#define USB_TC_FLAG
Definition at32f413_usb.h:80
USB_SP_FLAG
#define USB_SP_FLAG
Definition at32f413_usb.h:76
USB_RST_FLAG
#define USB_RST_FLAG
Definition at32f413_usb.h:75
USB_LSOF_FLAG
#define USB_LSOF_FLAG
Definition at32f413_usb.h:73
USB_SP_INT
#define USB_SP_INT
Definition at32f413_usb.h:56
USB_WK_INT
#define USB_WK_INT
Definition at32f413_usb.h:57
USB_LSOF_INT
#define USB_LSOF_INT
Definition at32f413_usb.h:53
USB_SOF_INT
#define USB_SOF_INT
Definition at32f413_usb.h:54
USB_GET_TX_LEN
#define USB_GET_TX_LEN(eptn)
get usb endpoint tx/rx data length
Definition at32f413_usb.h:285
USB_FREE_DB_USER_BUFFER
#define USB_FREE_DB_USER_BUFFER(eptn, inout)
free buffer used by application
Definition at32f413_usb.h:461
USB_DBUF0_GET_LEN
#define USB_DBUF0_GET_LEN(eptn)
double buffer mode get endpoint buf0/buf1 data length
Definition at32f413_usb.h:293
USB_CLEAR_TXTC
#define USB_CLEAR_TXTC(eptn)
clear tx/rx transfer completed flag
Definition at32f413_usb.h:477
USB_DBUF1_GET_LEN
#define USB_DBUF1_GET_LEN(eptn)
Definition at32f413_usb.h:294
USB_CLEAR_RXTC
#define USB_CLEAR_RXTC(eptn)
Definition at32f413_usb.h:478
USB_GET_RX_LEN
#define USB_GET_RX_LEN(eptn)
Definition at32f413_usb.h:286
USB_CONN_STATE_SUSPENDED
@ USB_CONN_STATE_SUSPENDED
Definition usb_std.h:138
USB_CONN_STATE_DEFAULT
@ USB_CONN_STATE_DEFAULT
Definition usb_std.h:135
USB_CONN_STATE_ADDRESSED
@ USB_CONN_STATE_ADDRESSED
Definition usb_std.h:136
usbd_ept_recv
void usbd_ept_recv(usbd_core_type *udev, uint8_t ept_num, uint8_t *buffer, uint16_t len)
usb endpoint receive data
Definition usbd_core.c:364
usbd_core_in_handler
void usbd_core_in_handler(usbd_core_type *udev, uint8_t ept_num)
usb core in transfer complete handler
Definition usbd_core.c:47
usbd_ept_buf_custom_define
void usbd_ept_buf_custom_define(usbd_core_type *udev, uint8_t ept_addr, uint32_t addr)
usb custom define endpoint buffer
Definition usbd_core.c:464
usbd_ept_open
void usbd_ept_open(usbd_core_type *udev, uint8_t ept_addr, uint8_t ept_type, uint16_t maxpacket)
usb open endpoint
Definition usbd_core.c:506
usbd_core_out_handler
void usbd_core_out_handler(usbd_core_type *udev, uint8_t ept_num)
usb core out transfer complete handler
Definition usbd_core.c:99
usbd_ept_defaut_init
void usbd_ept_defaut_init(usbd_core_type *udev)
usb endpoint structure initialization
Definition usbd_core.c:635
usbd_enter_suspend
void usbd_enter_suspend(usbd_core_type *udev)
usb device enter suspend mode
Definition usbd_core.c:625
usbd_ept_send
void usbd_ept_send(usbd_core_type *udev, uint8_t ept_num, uint8_t *buffer, uint16_t len)
usb endpoint send data
Definition usbd_core.c:304
usbd_core_setup_handler
void usbd_core_setup_handler(usbd_core_type *udev, uint8_t ept_num)
usb core setup transfer complete handler
Definition usbd_core.c:139
USBD_SUSPEND_EVENT
@ USBD_SUSPEND_EVENT
Definition usbd_core.h:57
USBD_RESET_EVENT
@ USBD_RESET_EVENT
Definition usbd_core.h:56
USBD_WAKEUP_EVENT
@ USBD_WAKEUP_EVENT
Definition usbd_core.h:58
usbd_sof_handler
void usbd_sof_handler(usbd_core_type *udev)
usb device sof interrupt request handler.
Definition usbd_int.c:276
usbd_irq_handler
void usbd_irq_handler(usbd_core_type *udev)
usb device interrput request handler.
Definition usbd_int.c:45
usbd_eptn_handler
void usbd_eptn_handler(usbd_core_type *udev, usb_ept_number_type ept_num)
usb device endpoint request handler.
Definition usbd_int.c:110
usbd_reset_handler
void usbd_reset_handler(usbd_core_type *udev)
usb device reset interrupt request handler.
Definition usbd_int.c:243
usbd_wakeup_handler
void usbd_wakeup_handler(usbd_core_type *udev)
usb device wakup interrupt request handler.
Definition usbd_int.c:309
usbd_ept_loop_handler
void usbd_ept_loop_handler(usbd_core_type *udev)
usb device endpoint loop handler.
Definition usbd_int.c:223
usbd_suspend_handler
void usbd_suspend_handler(usbd_core_type *udev)
usb device suspend interrupt request handler.
Definition usbd_int.c:288
usb_ept_info
usb endpoint infomation structure definition
Definition at32f413_usb.h:500
usb_ept_info::total_len
uint16_t total_len
Definition at32f413_usb.h:514
usb_ept_info::trans_len
uint16_t trans_len
Definition at32f413_usb.h:515
usb_ept_info::rx_addr
uint16_t rx_addr
Definition at32f413_usb.h:507
usb_ept_info::trans_buf
uint8_t * trans_buf
Definition at32f413_usb.h:516
usb_ept_info::is_double_buffer
uint8_t is_double_buffer
Definition at32f413_usb.h:509
usb_ept_info::tx_addr
uint16_t tx_addr
Definition at32f413_usb.h:506
usbd_class_handler::event_handler
usb_sts_type(* event_handler)(void *udev, usbd_event_type event)
Definition usbd_core.h:106
usbd_class_handler::sof_handler
usb_sts_type(* sof_handler)(void *udev)
Definition usbd_core.h:105
usbd_core_type
usb device core struct type
Definition usbd_core.h:114
usbd_core_type::conn_state
usbd_conn_state conn_state
Definition usbd_core.h:130
usbd_core_type::setup_buffer
uint8_t setup_buffer[12]
Definition usbd_core.h:124
usbd_core_type::old_conn_state
usbd_conn_state old_conn_state
Definition usbd_core.h:131
usbd_core_type::class_handler
usbd_class_handler * class_handler
Definition usbd_core.h:117
usbd_core_type::ept_in
usb_ept_info ept_in[USB_EPT_MAX_NUM]
Definition usbd_core.h:120
usbd_core_type::device_addr
uint8_t device_addr
Definition usbd_core.h:133
usbd_core_type::ept_out
usb_ept_info ept_out[USB_EPT_MAX_NUM]
Definition usbd_core.h:121
usbd_core_type::usb_reg
usb_reg_type * usb_reg
Definition usbd_core.h:115
usbd_type
type define usb register all
Definition at32f413_usb.h:527
usbd_type::intsts
__IO uint32_t intsts
Definition at32f413_usb.h:583
usbd_type::ept
__IO uint32_t ept[8]
Definition at32f413_usb.h:533
usbd_type::ctrl
__IO uint32_t ctrl
Definition at32f413_usb.h:557
usbd_int.h


AT32F413 Firmwary Library: usbd_int.h Source File

  • middlewares
  • usbd_drivers
  • inc
usbd_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __USB_INT_H
28#define __USB_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34
35/* includes ------------------------------------------------------------------*/
36#include "usbd_core.h"
37
49void usbd_irq_handler(usbd_core_type *udev);
50void usbd_ept_loop_handler(usbd_core_type *udev);
51void usbd_eptn_handler(usbd_core_type *udev, usb_ept_number_type ept_num);
52void usbd_reset_handler(usbd_core_type *udev);
53void usbd_sof_handler(usbd_core_type *udev);
54void usbd_suspend_handler(usbd_core_type *udev);
55void usbd_wakeup_handler(usbd_core_type *udev);
56
69#ifdef __cplusplus
70}
71#endif
72#endif
73
usb_ept_number_type
usb_ept_number_type
usb endpoint number define
Definition at32f413_usb.h:180
usbd_sof_handler
void usbd_sof_handler(usbd_core_type *udev)
usb device sof interrupt request handler.
Definition usbd_int.c:276
usbd_irq_handler
void usbd_irq_handler(usbd_core_type *udev)
usb device interrput request handler.
Definition usbd_int.c:45
usbd_eptn_handler
void usbd_eptn_handler(usbd_core_type *udev, usb_ept_number_type ept_num)
usb device endpoint request handler.
Definition usbd_int.c:110
usbd_reset_handler
void usbd_reset_handler(usbd_core_type *udev)
usb device reset interrupt request handler.
Definition usbd_int.c:243
usbd_wakeup_handler
void usbd_wakeup_handler(usbd_core_type *udev)
usb device wakup interrupt request handler.
Definition usbd_int.c:309
usbd_ept_loop_handler
void usbd_ept_loop_handler(usbd_core_type *udev)
usb device endpoint loop handler.
Definition usbd_int.c:223
usbd_suspend_handler
void usbd_suspend_handler(usbd_core_type *udev)
usb device suspend interrupt request handler.
Definition usbd_int.c:288
usbd_core_type
usb device core struct type
Definition usbd_core.h:114
usbd_core.h
usb device core header file


AT32F413 Firmwary Library: usbd_sdr.c Source File

  • middlewares
  • usbd_drivers
  • src
usbd_sdr.c
Go to the documentation of this file.
1
25#include "usbd_sdr.h"
26
40static usb_sts_type usbd_get_descriptor(usbd_core_type *udev);
41static usb_sts_type usbd_set_address(usbd_core_type *udev);
42static usb_sts_type usbd_get_status(usbd_core_type *udev);
43static usb_sts_type usbd_clear_feature(usbd_core_type *udev);
44static usb_sts_type usbd_set_feature(usbd_core_type *udev);
45static usb_sts_type usbd_get_configuration(usbd_core_type *udev);
46static usb_sts_type usbd_set_configuration(usbd_core_type *udev);
47
54void usbd_setup_request_parse(usb_setup_type *setup, uint8_t *buf)
55{
56 setup->bmRequestType = *(uint8_t *) buf;
57 setup->bRequest = *(uint8_t *) (buf + 1);
58 setup->wValue = SWAPBYTE(buf + 2);
59 setup->wIndex = SWAPBYTE(buf + 4);
60 setup->wLength = SWAPBYTE(buf + 6);
61}
62
68static usb_sts_type usbd_get_descriptor(usbd_core_type *udev)
69{
70 usb_sts_type ret = USB_OK;
71 uint16_t len = 0;
72 usbd_desc_t *desc = NULL;
73 uint8_t desc_type = udev->setup.wValue >> 8;
74 switch(desc_type)
75 {
76 case USB_DESCIPTOR_TYPE_DEVICE:
77 desc = udev->desc_handler->get_device_descriptor();
78 break;
79 case USB_DESCIPTOR_TYPE_CONFIGURATION:
80 desc = udev->desc_handler->get_device_configuration();
81 break;
82 case USB_DESCIPTOR_TYPE_STRING:
83 {
84 uint8_t str_desc = (uint8_t)udev->setup.wValue;
85 switch(str_desc)
86 {
87 case USB_LANGID_STRING:
88 desc = udev->desc_handler->get_device_lang_id();
89 break;
90 case USB_MFC_STRING:
91 desc = udev->desc_handler->get_device_manufacturer_string();
92 break;
93 case USB_PRODUCT_STRING:
94 desc = udev->desc_handler->get_device_product_string();
95 break;
96 case USB_SERIAL_STRING:
97 desc = udev->desc_handler->get_device_serial_string();
98 break;
99 case USB_CONFIG_STRING:
100 desc = udev->desc_handler->get_device_config_string();
101 break;
102 case USB_INTERFACE_STRING:
103 desc = udev->desc_handler->get_device_interface_string();
104 break;
105 case USB_WINUSB_OS_STRING:
106#if (USBD_SUPPORT_WINUSB == 1)
107 if(udev->desc_handler->get_device_winusb_os_string != NULL)
108 {
109 desc = udev->desc_handler->get_device_winusb_os_string();
110 }
111 else
112 {
113 usbd_ctrl_unsupport(udev);
114 }
115#else
116 usbd_ctrl_unsupport(udev);
117#endif
118 break;
119 default:
120 udev->class_handler->setup_handler(udev, &udev->setup);
121 return ret;
122 }
123 break;
124 }
125 case USB_DESCIPTOR_TYPE_DEVICE_QUALIFIER:
126 usbd_ctrl_unsupport(udev);
127 break;
128 case USB_DESCIPTOR_TYPE_OTHER_SPEED:
129 usbd_ctrl_unsupport(udev);
130 return ret;
131 default:
132 usbd_ctrl_unsupport(udev);
133 return ret;
134 }
135
136 if(desc != NULL)
137 {
138 if((desc->length != 0) && (udev->setup.wLength != 0))
139 {
140 len = MIN(desc->length , udev->setup.wLength);
141 usbd_ctrl_send(udev, desc->descriptor, len);
142 }
143 }
144 return ret;
145}
146
152static usb_sts_type usbd_set_address(usbd_core_type *udev)
153{
154 usb_sts_type ret = USB_OK;
155 usb_setup_type *setup = &udev->setup;
156 uint8_t dev_addr;
157
158 /* if wIndex or wLength are non-zero, then the behavior of
159 the device is not specified
160 */
161 if(setup->wIndex == 0 && setup->wLength == 0)
162 {
163 dev_addr = (uint8_t)(setup->wValue) & 0x7f;
164
165 /* device behavior when this request is received
166 while the device is in the configured state is not specified.*/
167 if(udev->conn_state == USB_CONN_STATE_CONFIGURED )
168 {
169 usbd_ctrl_unsupport(udev);
170 }
171 else
172 {
173 udev->device_addr = dev_addr;
174
175 if(dev_addr != 0)
176 {
177 udev->conn_state = USB_CONN_STATE_ADDRESSED;
178 }
179 else
180 {
181 udev->conn_state = USB_CONN_STATE_DEFAULT;
182 }
183 usbd_ctrl_send_status(udev);
184 }
185 }
186 else
187 {
188 usbd_ctrl_unsupport(udev);
189 }
190 return ret;
191}
192
198static usb_sts_type usbd_get_status(usbd_core_type *udev)
199{
200 usb_sts_type ret = USB_OK;
201 switch(udev->conn_state)
202 {
203 case USB_CONN_STATE_ADDRESSED:
204 case USB_CONN_STATE_CONFIGURED:
205 if(udev->remote_wakup)
206 {
207 udev->config_status |= USB_CONF_REMOTE_WAKEUP;
208 }
209 usbd_ctrl_send(udev, (uint8_t *)(&udev->config_status), 2);
210 break;
211 default:
212 usbd_ctrl_unsupport(udev);
213 break;
214 }
215 return ret;
216}
217
223static usb_sts_type usbd_clear_feature(usbd_core_type *udev)
224{
225 usb_sts_type ret = USB_OK;
226 usb_setup_type *setup = &udev->setup;
227 switch(udev->conn_state)
228 {
229 case USB_CONN_STATE_ADDRESSED:
230 case USB_CONN_STATE_CONFIGURED:
231 if(setup->wValue == USB_FEATURE_REMOTE_WAKEUP)
232 {
233 udev->remote_wakup = 0;
234 udev->config_status &= ~USB_CONF_REMOTE_WAKEUP;
235 udev->class_handler->setup_handler(udev, &udev->setup);
236 usbd_ctrl_send_status(udev);
237 }
238 break;
239 default:
240 usbd_ctrl_unsupport(udev);
241 break;
242 }
243 return ret;
244}
245
251static usb_sts_type usbd_set_feature(usbd_core_type *udev)
252{
253 usb_sts_type ret = USB_OK;
254 usb_setup_type *setup = &udev->setup;
255 if(setup->wValue == USB_FEATURE_REMOTE_WAKEUP)
256 {
257 udev->remote_wakup = 1;
258 udev->class_handler->setup_handler(udev, &udev->setup);
259 usbd_ctrl_send_status(udev);
260 }
261 else
262 {
263 usbd_ctrl_unsupport(udev);
264 }
265 return ret;
266}
267
273static usb_sts_type usbd_get_configuration(usbd_core_type *udev)
274{
275 usb_sts_type ret = USB_OK;
276 usb_setup_type *setup = &udev->setup;
277 if(setup->wLength != 1)
278 {
279 usbd_ctrl_unsupport(udev);
280 }
281 else
282 {
283 switch(udev->conn_state)
284 {
285 case USB_CONN_STATE_ADDRESSED:
286 udev->default_config = 0;
287 usbd_ctrl_send(udev, (uint8_t *)(&udev->default_config), 1);
288 break;
289 case USB_CONN_STATE_CONFIGURED:
290 usbd_ctrl_send(udev, (uint8_t *)(&udev->dev_config), 1);
291 break;
292 default:
293 usbd_ctrl_unsupport(udev);
294 break;
295 }
296 }
297 return ret;
298}
299
305static usb_sts_type usbd_set_configuration(usbd_core_type *udev)
306{
307 usb_sts_type ret = USB_OK;
308 static uint8_t config_value;
309 usb_setup_type *setup = &udev->setup;
310 config_value = (uint8_t)setup->wValue;
311
312 if(setup->wIndex == 0 && setup->wLength == 0)
313 {
314 switch(udev->conn_state)
315 {
316 case USB_CONN_STATE_ADDRESSED:
317 if(config_value)
318 {
319 udev->dev_config = config_value;
320 udev->conn_state = USB_CONN_STATE_CONFIGURED;
321 udev->class_handler->init_handler(udev);
322 usbd_ctrl_send_status(udev);
323 }
324 else
325 {
326 usbd_ctrl_send_status(udev);
327 }
328
329 break;
330 case USB_CONN_STATE_CONFIGURED:
331 if(config_value == 0)
332 {
333 udev->conn_state = USB_CONN_STATE_ADDRESSED;
334 udev->dev_config = config_value;
335 udev->class_handler->clear_handler(udev);
336 usbd_ctrl_send_status(udev);
337 }
338 else if(config_value != udev->dev_config)
339 {
340 udev->class_handler->clear_handler(udev);
341 udev->dev_config = config_value;
342 udev->class_handler->init_handler(udev);
343 usbd_ctrl_send_status(udev);
344 }
345 else
346 {
347 usbd_ctrl_send_status(udev);
348 }
349 break;
350 default:
351 usbd_ctrl_unsupport(udev);
352 break;
353 }
354 }
355 else
356 {
357 usbd_ctrl_unsupport(udev);
358 }
359 return ret;
360}
361
367 usb_sts_type usbd_device_request(usbd_core_type *udev)
368{
369 usb_sts_type ret = USB_OK;
370 usb_setup_type *setup = &udev->setup;
371 if((setup->bmRequestType & USB_REQ_TYPE_RESERVED) != USB_REQ_TYPE_STANDARD)
372 {
373 udev->class_handler->setup_handler(udev, &udev->setup);
374 return ret;
375 }
376 switch(udev->setup.bRequest)
377 {
378 case USB_STD_REQ_GET_STATUS:
379 usbd_get_status(udev);
380 break;
381 case USB_STD_REQ_CLEAR_FEATURE:
382 usbd_clear_feature(udev);
383 break;
384 case USB_STD_REQ_SET_FEATURE:
385 usbd_set_feature(udev);
386 break;
387 case USB_STD_REQ_SET_ADDRESS:
388 usbd_set_address(udev);
389 break;
390 case USB_STD_REQ_GET_DESCRIPTOR:
391 usbd_get_descriptor(udev);
392 break;
393 case USB_STD_REQ_GET_CONFIGURATION:
394 usbd_get_configuration(udev);
395 break;
396 case USB_STD_REQ_SET_CONFIGURATION:
397 usbd_set_configuration(udev);
398 break;
399 default:
400 usbd_ctrl_unsupport(udev);
401 break;
402 }
403 return ret;
404}
405
411 usb_sts_type usbd_interface_request(usbd_core_type *udev)
412{
413 usb_sts_type ret = USB_OK;
414 usb_setup_type *setup = &udev->setup;
415 switch(udev->conn_state)
416 {
417 case USB_CONN_STATE_DEFAULT:
418 case USB_CONN_STATE_ADDRESSED:
419 case USB_CONN_STATE_CONFIGURED:
420 ret = udev->class_handler->setup_handler(udev, &udev->setup);
421 if(setup->wLength == 0 && ret == USB_OK)
422 {
423 usbd_ctrl_send_status(udev);
424 }
425 break;
426 default:
427 usbd_ctrl_unsupport(udev);
428 break;
429 }
430 return ret;
431}
432
438 usb_sts_type usbd_endpoint_request(usbd_core_type *udev)
439{
440 usb_sts_type ret = USB_OK;
441 usb_setup_type *setup = &udev->setup;
442 uint8_t ept_addr = LBYTE(setup->wIndex);
443 usb_ept_info *ept_info;
444
445 if((setup->bmRequestType & USB_REQ_TYPE_RESERVED) != USB_REQ_TYPE_STANDARD)
446 {
447 udev->class_handler->setup_handler(udev, &udev->setup);
448 return ret;
449 }
450 switch(setup->bRequest)
451 {
452 case USB_STD_REQ_GET_STATUS:
453 switch(udev->conn_state)
454 {
455 case USB_CONN_STATE_ADDRESSED:
456 if((ept_addr & 0x7F) != 0)
457 {
458 usbd_set_stall(udev, ept_addr);
459 }
460 if((ept_addr & 0x80) != 0)
461 {
462 ept_info = &udev->ept_in[ept_addr & 0x7F];
463 }
464 else
465 {
466 ept_info = &udev->ept_out[ept_addr & 0x7F];
467 }
468 ept_info->status = 0x0000;
469 usbd_ctrl_send(udev, (uint8_t *)(&ept_info->status), 2);
470
471 break;
472 case USB_CONN_STATE_CONFIGURED:
473 {
474 if((ept_addr & 0x80) != 0)
475 {
476 ept_info = &udev->ept_in[ept_addr & 0x7F];
477 }
478 else
479 {
480 ept_info = &udev->ept_out[ept_addr & 0x7F];
481 }
482 if(ept_info->stall == 1)
483 {
484 ept_info->status = 0x0001;
485 }
486 else
487 {
488 ept_info->status = 0x0000;
489 }
490 usbd_ctrl_send(udev, (uint8_t *)(&ept_info->status), 2);
491 }
492 break;
493 default:
494 usbd_ctrl_unsupport(udev);
495 break;
496 }
497 break;
498 case USB_STD_REQ_CLEAR_FEATURE:
499 switch(udev->conn_state)
500 {
501 case USB_CONN_STATE_ADDRESSED:
502 if((ept_addr != 0x00) && (ept_addr != 0x80))
503 {
504 usbd_set_stall(udev, ept_addr);
505 }
506 break;
507 case USB_CONN_STATE_CONFIGURED:
508 if(setup->wValue == USB_FEATURE_EPT_HALT)
509 {
510 if((ept_addr & 0x7F) != 0x00 )
511 {
512 usbd_clear_stall(udev, ept_addr);
513 udev->class_handler->setup_handler(udev, &udev->setup);
514 }
515 usbd_ctrl_send_status(udev);
516 }
517 break;
518 default:
519 usbd_ctrl_unsupport(udev);
520 break;
521 }
522 break;
523 case USB_STD_REQ_SET_FEATURE:
524 switch(udev->conn_state)
525 {
526 case USB_CONN_STATE_ADDRESSED:
527 if((ept_addr != 0x00) && (ept_addr != 0x80))
528 {
529 usbd_set_stall(udev, ept_addr);
530 }
531 break;
532 case USB_CONN_STATE_CONFIGURED:
533 if(setup->wValue == USB_FEATURE_EPT_HALT)
534 {
535 if((ept_addr != 0x00) && (ept_addr != 0x80))
536 {
537 usbd_set_stall(udev, ept_addr);
538 }
539 }
540 udev->class_handler->setup_handler(udev, &udev->setup);
541 usbd_ctrl_send_status(udev);
542 break;
543 default:
544 usbd_ctrl_unsupport(udev);
545 break;
546 }
547 break;
548 default:
549 usbd_ctrl_unsupport(udev);
550 break;
551 }
552 return ret;
553}
554
NULL
#define NULL
Definition emmc_card/inc/at32_sdio.h:340
USB_STD_REQ_CLEAR_FEATURE
#define USB_STD_REQ_CLEAR_FEATURE
Definition usb_std.h:77
USB_DESCIPTOR_TYPE_OTHER_SPEED
#define USB_DESCIPTOR_TYPE_OTHER_SPEED
Definition usb_std.h:97
USB_INTERFACE_STRING
#define USB_INTERFACE_STRING
Definition usb_std.h:108
USB_STD_REQ_SET_CONFIGURATION
#define USB_STD_REQ_SET_CONFIGURATION
Definition usb_std.h:83
USB_FEATURE_REMOTE_WAKEUP
#define USB_FEATURE_REMOTE_WAKEUP
Definition usb_std.h:121
USB_PRODUCT_STRING
#define USB_PRODUCT_STRING
Definition usb_std.h:105
MIN
#define MIN(a, b)
min and max define
Definition usb_std.h:260
USB_REQ_TYPE_STANDARD
#define USB_REQ_TYPE_STANDARD
usb request type
Definition usb_std.h:62
USB_DESCIPTOR_TYPE_CONFIGURATION
#define USB_DESCIPTOR_TYPE_CONFIGURATION
Definition usb_std.h:92
USB_STD_REQ_GET_DESCRIPTOR
#define USB_STD_REQ_GET_DESCRIPTOR
Definition usb_std.h:80
USB_STD_REQ_SET_ADDRESS
#define USB_STD_REQ_SET_ADDRESS
Definition usb_std.h:79
LBYTE
#define LBYTE(x)
low byte and high byte define
Definition usb_std.h:270
USB_STD_REQ_SET_FEATURE
#define USB_STD_REQ_SET_FEATURE
Definition usb_std.h:78
USB_CONF_REMOTE_WAKEUP
#define USB_CONF_REMOTE_WAKEUP
usb configuration attributes
Definition usb_std.h:114
SWAPBYTE
#define SWAPBYTE(addr)
usb swap address
Definition usb_std.h:253
USB_MFC_STRING
#define USB_MFC_STRING
Definition usb_std.h:104
USB_WINUSB_OS_STRING
#define USB_WINUSB_OS_STRING
Definition usb_std.h:109
USB_STD_REQ_GET_STATUS
#define USB_STD_REQ_GET_STATUS
usb standard device requests codes
Definition usb_std.h:76
USB_SERIAL_STRING
#define USB_SERIAL_STRING
Definition usb_std.h:106
USB_DESCIPTOR_TYPE_DEVICE
#define USB_DESCIPTOR_TYPE_DEVICE
usb standard device type
Definition usb_std.h:91
USB_FEATURE_EPT_HALT
#define USB_FEATURE_EPT_HALT
usb standard feature selectors
Definition usb_std.h:120
USB_STD_REQ_GET_CONFIGURATION
#define USB_STD_REQ_GET_CONFIGURATION
Definition usb_std.h:82
USB_DESCIPTOR_TYPE_STRING
#define USB_DESCIPTOR_TYPE_STRING
Definition usb_std.h:93
USB_REQ_TYPE_RESERVED
#define USB_REQ_TYPE_RESERVED
Definition usb_std.h:65
USB_LANGID_STRING
#define USB_LANGID_STRING
usb standard string type
Definition usb_std.h:103
USB_DESCIPTOR_TYPE_DEVICE_QUALIFIER
#define USB_DESCIPTOR_TYPE_DEVICE_QUALIFIER
Definition usb_std.h:96
USB_CONFIG_STRING
#define USB_CONFIG_STRING
Definition usb_std.h:107
USB_CONN_STATE_DEFAULT
@ USB_CONN_STATE_DEFAULT
Definition usb_std.h:135
USB_CONN_STATE_CONFIGURED
@ USB_CONN_STATE_CONFIGURED
Definition usb_std.h:137
USB_CONN_STATE_ADDRESSED
@ USB_CONN_STATE_ADDRESSED
Definition usb_std.h:136
usb_sts_type
usb_sts_type
usb return status
Definition usb_std.h:285
USB_OK
@ USB_OK
Definition usb_std.h:286
usbd_set_stall
void usbd_set_stall(usbd_core_type *udev, uint8_t ept_addr)
usb set endpoint to stall.
Definition usbd_core.c:264
usbd_ctrl_send_status
void usbd_ctrl_send_status(usbd_core_type *udev)
usb control endpoint send in status
Definition usbd_core.c:210
usbd_ctrl_send
void usbd_ctrl_send(usbd_core_type *udev, uint8_t *buffer, uint16_t len)
usb control endpoint send data
Definition usbd_core.c:175
usbd_clear_stall
void usbd_clear_stall(usbd_core_type *udev, uint8_t ept_addr)
clear endpoint stall
Definition usbd_core.c:235
usbd_ctrl_unsupport
void usbd_ctrl_unsupport(usbd_core_type *udev)
un-support device request
Definition usbd_core.c:289
usbd_set_feature
static usb_sts_type usbd_set_feature(usbd_core_type *udev)
set usb feature request
Definition usbd_sdr.c:251
usbd_endpoint_request
usb_sts_type usbd_endpoint_request(usbd_core_type *udev)
standard usb endpoint requests
Definition usbd_sdr.c:438
usbd_get_status
static usb_sts_type usbd_get_status(usbd_core_type *udev)
get usb status request
Definition usbd_sdr.c:198
usbd_get_configuration
static usb_sts_type usbd_get_configuration(usbd_core_type *udev)
get usb configuration request
Definition usbd_sdr.c:273
usbd_get_descriptor
static usb_sts_type usbd_get_descriptor(usbd_core_type *udev)
get usb standard device description request
Definition usbd_sdr.c:68
usbd_setup_request_parse
void usbd_setup_request_parse(usb_setup_type *setup, uint8_t *buf)
usb parse standard setup request
Definition usbd_sdr.c:54
usbd_device_request
usb_sts_type usbd_device_request(usbd_core_type *udev)
standard usb device requests
Definition usbd_sdr.c:367
usbd_set_address
static usb_sts_type usbd_set_address(usbd_core_type *udev)
this request sets the device address
Definition usbd_sdr.c:152
usbd_interface_request
usb_sts_type usbd_interface_request(usbd_core_type *udev)
standard usb interface requests
Definition usbd_sdr.c:411
usbd_set_configuration
static usb_sts_type usbd_set_configuration(usbd_core_type *udev)
sets the usb device configuration request
Definition usbd_sdr.c:305
usbd_clear_feature
static usb_sts_type usbd_clear_feature(usbd_core_type *udev)
clear usb feature request
Definition usbd_sdr.c:223
usb_ept_info
usb endpoint infomation structure definition
Definition at32f413_usb.h:500
usb_ept_info::stall
uint8_t stall
Definition at32f413_usb.h:510
usb_ept_info::status
uint16_t status
Definition at32f413_usb.h:511
usb_setup_type
format of usb setup data
Definition usb_std.h:297
usb_setup_type::wValue
uint16_t wValue
Definition usb_std.h:300
usb_setup_type::wLength
uint16_t wLength
Definition usb_std.h:303
usb_setup_type::bmRequestType
uint8_t bmRequestType
Definition usb_std.h:298
usb_setup_type::wIndex
uint16_t wIndex
Definition usb_std.h:301
usb_setup_type::bRequest
uint8_t bRequest
Definition usb_std.h:299
usbd_class_handler::init_handler
usb_sts_type(* init_handler)(void *udev)
Definition usbd_core.h:98
usbd_class_handler::clear_handler
usb_sts_type(* clear_handler)(void *udev)
Definition usbd_core.h:99
usbd_class_handler::setup_handler
usb_sts_type(* setup_handler)(void *udev, usb_setup_type *setup)
Definition usbd_core.h:100
usbd_core_type
usb device core struct type
Definition usbd_core.h:114
usbd_core_type::conn_state
usbd_conn_state conn_state
Definition usbd_core.h:130
usbd_core_type::default_config
uint8_t default_config
Definition usbd_core.h:135
usbd_core_type::remote_wakup
uint8_t remote_wakup
Definition usbd_core.h:134
usbd_core_type::class_handler
usbd_class_handler * class_handler
Definition usbd_core.h:117
usbd_core_type::ept_in
usb_ept_info ept_in[USB_EPT_MAX_NUM]
Definition usbd_core.h:120
usbd_core_type::config_status
uint16_t config_status
Definition usbd_core.h:137
usbd_core_type::dev_config
uint8_t dev_config
Definition usbd_core.h:136
usbd_core_type::device_addr
uint8_t device_addr
Definition usbd_core.h:133
usbd_core_type::ept_out
usb_ept_info ept_out[USB_EPT_MAX_NUM]
Definition usbd_core.h:121
usbd_core_type::setup
usb_setup_type setup
Definition usbd_core.h:123
usbd_core_type::desc_handler
usbd_desc_handler * desc_handler
Definition usbd_core.h:118
usbd_desc_handler::get_device_config_string
usbd_desc_t *(* get_device_config_string)(void)
Definition usbd_core.h:85
usbd_desc_handler::get_device_descriptor
usbd_desc_t *(* get_device_descriptor)(void)
Definition usbd_core.h:76
usbd_desc_handler::get_device_configuration
usbd_desc_t *(* get_device_configuration)(void)
Definition usbd_core.h:78
usbd_desc_handler::get_device_interface_string
usbd_desc_t *(* get_device_interface_string)(void)
Definition usbd_core.h:84
usbd_desc_handler::get_device_lang_id
usbd_desc_t *(* get_device_lang_id)(void)
Definition usbd_core.h:80
usbd_desc_handler::get_device_manufacturer_string
usbd_desc_t *(* get_device_manufacturer_string)(void)
Definition usbd_core.h:81
usbd_desc_handler::get_device_product_string
usbd_desc_t *(* get_device_product_string)(void)
Definition usbd_core.h:82
usbd_desc_handler::get_device_serial_string
usbd_desc_t *(* get_device_serial_string)(void)
Definition usbd_core.h:83
usbd_desc_t
usb device descriptor struct
Definition usbd_core.h:66
usbd_desc_t::length
uint16_t length
Definition usbd_core.h:67
usbd_desc_t::descriptor
uint8_t * descriptor
Definition usbd_core.h:68
usbd_sdr.h
usb standard request header file


AT32F413 Firmwary Library: usbd_sdr.h Source File

  • middlewares
  • usbd_drivers
  • inc
usbd_sdr.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __USBD_SDR_H
28#define __USBD_SDR_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34
35/* includes ------------------------------------------------------------------*/
36#include "usbd_core.h"
37
50void usbd_setup_request_parse(usb_setup_type *setup, uint8_t *buf);
51 usb_sts_type usbd_device_request(usbd_core_type *udev);
52 usb_sts_type usbd_interface_request(usbd_core_type *udev);
53 usb_sts_type usbd_endpoint_request(usbd_core_type *udev);
54
55
68#ifdef __cplusplus
69}
70#endif
71
72#endif
73
usb_sts_type
usb_sts_type
usb return status
Definition usb_std.h:285
usbd_endpoint_request
usb_sts_type usbd_endpoint_request(usbd_core_type *udev)
standard usb endpoint requests
Definition usbd_sdr.c:438
usbd_setup_request_parse
void usbd_setup_request_parse(usb_setup_type *setup, uint8_t *buf)
usb parse standard setup request
Definition usbd_sdr.c:54
usbd_device_request
usb_sts_type usbd_device_request(usbd_core_type *udev)
standard usb device requests
Definition usbd_sdr.c:367
usbd_interface_request
usb_sts_type usbd_interface_request(usbd_core_type *udev)
standard usb interface requests
Definition usbd_sdr.c:411
usb_setup_type
format of usb setup data
Definition usb_std.h:297
usbd_core_type
usb device core struct type
Definition usbd_core.h:114
usbd_core.h
usb device core header file


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • utilities
  • at32f413_freertos_demo
  • inc
utilities/at32f413_freertos_demo/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • utilities
  • at32f413_freertos_demo
  • inc
utilities/at32f413_freertos_demo/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • utilities
  • at32f413_freertos_demo
  • inc
utilities/at32f413_freertos_demo/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • utilities
  • at32f413_freertos_demo
  • src
utilities/at32f413_freertos_demo/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_clock_config
void system_clock_config(void)
system clock config program
Definition utilities/at32f413_freertos_demo/src/at32f413_clock.c:47
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • utilities
  • at32f413_freertos_demo
  • src
utilities/at32f413_freertos_demo/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103//void SVC_Handler(void)
104//{
105//}
106
112void DebugMon_Handler(void)
113{
114}
115
121//void PendSV_Handler(void)
122//{
123//}
124
130//void SysTick_Handler(void)
131//{
132//}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition utilities/at32f413_freertos_demo/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition utilities/at32f413_freertos_demo/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition utilities/at32f413_freertos_demo/src/at32f413_int.c:64
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition utilities/at32f413_freertos_demo/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition utilities/at32f413_freertos_demo/src/at32f413_int.c:77
DebugMon_Handler
void DebugMon_Handler(void)
this function handles svcall exception.
Definition utilities/at32f413_freertos_demo/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • utilities
  • at32f413_freertos_demo
  • src
utilities/at32f413_freertos_demo/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include "FreeRTOS.h"
29#include "task.h"
30
38TaskHandle_t led2_handler;
39TaskHandle_t led3_handler;
40
41/* led2 task */
42void led2_task_function(void *pvParameters);
43/* led3 task */
44void led3_task_function(void *pvParameters);
45
51int main(void)
52{
53 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
54
55 system_clock_config();
56
57 /* init led2 and led3 */
58 at32_led_init(LED2);
59 at32_led_init(LED3);
60
61 /* init usart1 */
62 uart_print_init(115200);
63
64 /* enter critical */
65 taskENTER_CRITICAL();
66
67 /* create led2 task */
68 if(xTaskCreate((TaskFunction_t )led2_task_function,
69 (const char* )"LED2_task",
70 (uint16_t )512,
71 (void* )NULL,
72 (UBaseType_t )2,
73 (TaskHandle_t* )&led2_handler) != pdPASS)
74 {
75 printf("LED2 task could not be created as there was insufficient heap memory remaining.\r\n");
76 }
77 else
78 {
79 printf("LED2 task was created successfully.\r\n");
80 }
81 /* create led3 task */
82 if(xTaskCreate((TaskFunction_t )led3_task_function,
83 (const char* )"LED3_task",
84 (uint16_t )512,
85 (void* )NULL,
86 (UBaseType_t )2,
87 (TaskHandle_t* )&led3_handler) != pdPASS)
88 {
89 printf("LED3 task could not be created as there was insufficient heap memory remaining.\r\n");
90 }
91 else
92 {
93 printf("LED3 task was created successfully.\r\n");
94 }
95
96 /* exit critical */
97 taskEXIT_CRITICAL();
98
99 /* start scheduler */
100 vTaskStartScheduler();
101}
102
103/* led2 task function */
104void led2_task_function(void *pvParameters)
105{
106 while(1)
107 {
108 at32_led_toggle(LED2);
109 vTaskDelay(1000);
110 }
111}
112
113/* led3 task function */
114void led3_task_function(void *pvParameters)
115{
116 while(1)
117 {
118 at32_led_toggle(LED3);
119 vTaskDelay(500);
120 }
121}
122
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
at32_led_init
void at32_led_init(led_type led)
configure led gpio
Definition at32f413_board.c:242
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
uart_print_init
void uart_print_init(uint32_t baudrate)
initialize uart
Definition at32f413_board.c:129
led2_task_function
void led2_task_function(void *pvParameters)
Definition utilities/at32f413_freertos_demo/src/main.c:104
main
int main(void)
main function.
Definition utilities/at32f413_freertos_demo/src/main.c:51
led3_task_function
void led3_task_function(void *pvParameters)
Definition utilities/at32f413_freertos_demo/src/main.c:114
led3_handler
TaskHandle_t led3_handler
Definition utilities/at32f413_freertos_demo/src/main.c:39
led2_handler
TaskHandle_t led2_handler
Definition utilities/at32f413_freertos_demo/src/main.c:38
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
NULL
#define NULL
Definition emmc_card/inc/at32_sdio.h:340
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • utilities
  • at32f413_gen_random_number_demo
  • inc
utilities/at32f413_gen_random_number_demo/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • utilities
  • at32f413_gen_random_number_demo
  • inc
utilities/at32f413_gen_random_number_demo/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • utilities
  • at32f413_gen_random_number_demo
  • inc
utilities/at32f413_gen_random_number_demo/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • utilities
  • at32f413_gen_random_number_demo
  • src
utilities/at32f413_gen_random_number_demo/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_clock_config
void system_clock_config(void)
system clock config program
Definition utilities/at32f413_gen_random_number_demo/src/at32f413_clock.c:47
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • utilities
  • at32f413_gen_random_number_demo
  • src
utilities/at32f413_gen_random_number_demo/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while (1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while (1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while (1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while (1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition utilities/at32f413_gen_random_number_demo/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition utilities/at32f413_gen_random_number_demo/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition utilities/at32f413_gen_random_number_demo/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition utilities/at32f413_gen_random_number_demo/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition utilities/at32f413_gen_random_number_demo/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition utilities/at32f413_gen_random_number_demo/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition utilities/at32f413_gen_random_number_demo/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition utilities/at32f413_gen_random_number_demo/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition utilities/at32f413_gen_random_number_demo/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • utilities
  • at32f413_gen_random_number_demo
  • src
utilities/at32f413_gen_random_number_demo/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include "stdio.h"
29#include "random.h"
30
44int main(void)
45{
46 system_clock_config();
47
48 at32_board_init();
49 uart_print_init(115200);
50 printf("gen random number test\r\n");
51 randnum_test();
52 while(1)
53 {
54 }
55}
56
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
uart_print_init
void uart_print_init(uint32_t baudrate)
initialize uart
Definition at32f413_board.c:129
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
randnum_test
void randnum_test(void)
enable rtc as seed
Definition random.c:121
main
int main(void)
main function.
Definition utilities/at32f413_gen_random_number_demo/src/main.c:44
at32f413_clock.h
header file of clock program
random.h
at32f413 random header file


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • utilities
  • at32f413_slib_demo
  • project_l0
  • inc
utilities/at32f413_slib_demo/project_l0/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • utilities
  • at32f413_slib_demo
  • project_l0
  • inc
utilities/at32f413_slib_demo/project_l0/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • utilities
  • at32f413_slib_demo
  • project_l0
  • inc
utilities/at32f413_slib_demo/project_l0/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • utilities
  • at32f413_slib_demo
  • project_l0
  • src
utilities/at32f413_slib_demo/project_l0/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_clock_config
void system_clock_config(void)
system clock config program
Definition utilities/at32f413_slib_demo/project_l0/src/at32f413_clock.c:47
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • utilities
  • at32f413_slib_demo
  • project_l0
  • src
utilities/at32f413_slib_demo/project_l0/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28#include "at32f413_board.h"
29
43void NMI_Handler(void)
44{
45}
46
52void HardFault_Handler(void)
53{
54 /* go to infinite loop when hard fault exception occurs */
55 while (1)
56 {
57 }
58}
59
65void MemManage_Handler(void)
66{
67 /* go to infinite loop when memory manage exception occurs */
68 while (1)
69 {
70 }
71}
72
78void BusFault_Handler(void)
79{
80 /* go to infinite loop when bus fault exception occurs */
81 while (1)
82 {
83 }
84}
85
91void UsageFault_Handler(void)
92{
93 /* go to infinite loop when usage fault exception occurs */
94 while (1)
95 {
96 }
97}
98
104void SVC_Handler(void)
105{
106}
107
113void DebugMon_Handler(void)
114{
115}
116
122void PendSV_Handler(void)
123{
124}
125
131void SysTick_Handler(void)
132{
133}
134
140void FLASH_IRQHandler(void)
141{
142 if(flash_flag_get(FLASH_EPPERR_FLAG))
143 {
144 flash_flag_clear(FLASH_EPPERR_FLAG);
145 delay_ms(500);
146 }
147}
148
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
flash_flag_get
flag_status flash_flag_get(uint32_t flash_flag)
check whether the specified flash flag is set or not.
Definition at32f413_flash.c:58
flash_flag_clear
void flash_flag_clear(uint32_t flash_flag)
clear the flash flag.
Definition at32f413_flash.c:97
FLASH_EPPERR_FLAG
#define FLASH_EPPERR_FLAG
Definition at32f413_flash.h:79
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition utilities/at32f413_slib_demo/project_l0/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition utilities/at32f413_slib_demo/project_l0/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition utilities/at32f413_slib_demo/project_l0/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition utilities/at32f413_slib_demo/project_l0/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition utilities/at32f413_slib_demo/project_l0/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition utilities/at32f413_slib_demo/project_l0/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition utilities/at32f413_slib_demo/project_l0/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition utilities/at32f413_slib_demo/project_l0/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition utilities/at32f413_slib_demo/project_l0/src/at32f413_int.c:113
FLASH_IRQHandler
void FLASH_IRQHandler(void)
flash handler.
Definition utilities/at32f413_slib_demo/project_l0/src/at32f413_int.c:140
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • utilities
  • at32f413_slib_demo
  • project_l0
  • src
utilities/at32f413_slib_demo/project_l0/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include <stdio.h>
29#include "math_helper.h"
30#include "fir_filter.h"
31
32extern float32_t testInput_f32_1kHz_15kHz[];
33extern float32_t refOutput[];
34
43#define USE_SLIB_FUNCTION /* define it when user want to activate slib in this project */
44
45#if defined (USE_SLIB_FUNCTION)
46#define FLASH_START_ADDR 0x08000000
47#define TEST_SLIB_PSW 0x55665566
48#define SLIB_START_ADDR 0x0800D800
49#define SLIB_DATA_ADDR 0x0800E800
50#define SLIB_END_ADDR 0x0800F000
51#define FLASH_SECTOR_SIZE 0x800
52#define SECTOR_NUM(dwAddr) ((dwAddr & (FLASH_START_ADDR - 1)) / FLASH_SECTOR_SIZE)
53#define SECTOR_WORD_CNT (FLASH_SECTOR_SIZE >> 2) /* words per sector */
54#endif
55#define SNR_THRESHOLD_F32 140.0f
56#define TEST_LENGTH_SAMPLES 320
57
58#if defined (USE_SLIB_FUNCTION)
59uint32_t dw_start_sector, dw_data_start_sector, dw_end_sector;
60uint32_t temp_buf[512]; /* 2kb buffer */
61#endif
62
63static float32_t testOutput[TEST_LENGTH_SAMPLES];
64
65#if defined (USE_SLIB_FUNCTION)
66 flash_status_type slib_enable(void);
67#endif
68void config_flash_interrupt(void);
69
75void config_flash_interrupt(void)
76{
77 flash_unlock();
78 flash_interrupt_enable(FLASH_ERR_INT, TRUE);
79 flash_lock();
80 /* config nvic priority group */
81 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
82
83 nvic_irq_enable(FLASH_IRQn, 0, 0);
84}
85
86#if defined (USE_SLIB_FUNCTION)
92 flash_status_type slib_enable(void)
93{
94 uint32_t *ptr;
95 uint32_t i, j;
96 flash_status_type status = FLASH_OPERATE_DONE;
97 ptr = (uint32_t *)SLIB_START_ADDR;
98 dw_start_sector = SECTOR_NUM(SLIB_START_ADDR); /* slib start sector */
99 dw_data_start_sector = SECTOR_NUM(SLIB_DATA_ADDR); /* slib data sector */
100 dw_end_sector = SECTOR_NUM(SLIB_END_ADDR); /* slib end sector */
101 flash_unlock();
102 status = flash_slib_enable(TEST_SLIB_PSW, dw_start_sector, dw_data_start_sector, dw_end_sector);
103 if(status != FLASH_OPERATE_DONE)
104 return status;
105 for(i = 0; i <= (dw_end_sector - dw_start_sector); i++)
106 {
107 memcpy(temp_buf, ptr, FLASH_SECTOR_SIZE);
108 status = flash_sector_erase(SLIB_START_ADDR + i * FLASH_SECTOR_SIZE);
109 if(status != FLASH_OPERATE_DONE)
110 return status;
111 for(j = 0; j < (FLASH_SECTOR_SIZE >> 2); j++)
112 {
113 status = flash_word_program(SLIB_START_ADDR + i * FLASH_SECTOR_SIZE + (j << 2), temp_buf[j]);
114 if(status != FLASH_OPERATE_DONE)
115 return status;
116 }
117 ptr += SECTOR_WORD_CNT;
118 }
119 return status;
120}
121#endif
122
128int main(void)
129{
130 arm_status status;
131 float32_t *inputf32, *outputf32, snr;
132
133 system_clock_config();
134 at32_board_init();
135
136 /* initialize input and output buffer pointers */
137 inputf32 = &testInput_f32_1kHz_15kHz[0];
138 outputf32 = &testOutput[0];
139
140 /* configure flash to generate an interrupt when a write protect error occur */
141 config_flash_interrupt();
142
143 /* wait for key button to be pushed, then turn off led3 */
144 while(at32_button_press() == NO_BUTTON)
145 {
146 at32_led_toggle(LED3);
147 delay_ms(100);
148 }
149 at32_led_off(LED3);
150
151 /* call the fir low pass filter function */
152 FIR_lowpass_filter(inputf32, outputf32, TEST_LENGTH_SAMPLES);
153
154 /* compare the generated output against the reference output computed in matlab. */
155 snr = arm_snr_f32(&refOutput[0], &testOutput[0], TEST_LENGTH_SAMPLES);
156 if(snr < SNR_THRESHOLD_F32)
157 {
158 status = ARM_MATH_TEST_FAILURE;
159 }
160 else
161 {
162 status = ARM_MATH_SUCCESS;
163#if defined (USE_SLIB_FUNCTION)
164 /* enable slib protection from sector 2 to sector 5 when fir filter ip-code is tested ok */
165 if(flash_slib_state_get() == RESET)
166 {
167 /* if slib has not been enabled, set slib configuration */
168 if(slib_enable() == FLASH_OPERATE_DONE)
169 {
170 /* if slib configuration is correctly set, tuen on green led4 */
171 at32_led_on(LED4);
172 delay_sec(3);
173
174 /* execute system reset to activate slib protection */
175 nvic_system_reset();
176 }
177 else
178 {
179 /* turn on red led2 if slib activation failed */
180 at32_led_on(LED2);
181 while(1);
182 }
183 }
184#endif
185 }
186
187 /* infinite loop */
188 while(1)
189 {
190 if(status == ARM_MATH_TEST_FAILURE)
191 {
192 /* toggle red led2 if fir function failed */
193 at32_led_toggle(LED2);
194 delay_ms(500);
195 }
196 else
197 {
198 /* toggle green led4 if fir function success */
199 at32_led_toggle(LED4);
200 delay_ms(500);
201 }
202 }
203}
204
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
NO_BUTTON
@ NO_BUTTON
Definition at32f413_board.h:94
at32_button_press
button_type at32_button_press()
returns which button have press down
Definition at32f413_board.c:218
at32_led_on
void at32_led_on(led_type led)
turns selected led on.
Definition at32f413_board.c:270
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
at32_led_off
void at32_led_off(led_type led)
turns selected led off.
Definition at32f413_board.c:287
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
delay_sec
void delay_sec(uint16_t sec)
inserts a delay time.
Definition at32f413_board.c:382
FLASH_IRQn
@ FLASH_IRQn
Definition at32f413.h:175
TRUE
@ TRUE
Definition at32f413.h:297
RESET
@ RESET
Definition at32f413.h:292
flash_slib_state_get
flag_status flash_slib_state_get(void)
get the slib state.
Definition at32f413_flash.c:898
flash_slib_enable
flash_status_type flash_slib_enable(uint32_t pwd, uint16_t start_sector, uint16_t data_start_sector, uint16_t end_sector)
enable security library function.
Definition at32f413_flash.c:831
flash_sector_erase
flash_status_type flash_sector_erase(uint32_t sector_address)
erase a specified flash sector.
Definition at32f413_flash.c:272
flash_unlock
void flash_unlock(void)
unlock the flash controller.
Definition at32f413_flash.c:228
flash_interrupt_enable
void flash_interrupt_enable(uint32_t flash_int, confirm_state new_state)
enable or disable the specified flash interrupts.
Definition at32f413_flash.c:729
flash_word_program
flash_status_type flash_word_program(uint32_t address, uint32_t data)
program a word at a specified address.
Definition at32f413_flash.c:414
flash_lock
void flash_lock(void)
lock the flash controller.
Definition at32f413_flash.c:251
flash_status_type
flash_status_type
flash status type
Definition at32f413_flash.h:158
FLASH_OPERATE_DONE
@ FLASH_OPERATE_DONE
Definition at32f413_flash.h:162
FLASH_ERR_INT
#define FLASH_ERR_INT
Definition at32f413_flash.h:95
nvic_system_reset
void nvic_system_reset(void)
system reset
Definition at32f413_misc.c:51
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
SECTOR_NUM
#define SECTOR_NUM(dwAddr)
Definition utilities/at32f413_slib_demo/project_l0/src/main.c:52
testOutput
static float32_t testOutput[320]
Definition utilities/at32f413_slib_demo/project_l0/src/main.c:63
SECTOR_WORD_CNT
#define SECTOR_WORD_CNT
Definition utilities/at32f413_slib_demo/project_l0/src/main.c:53
config_flash_interrupt
void config_flash_interrupt(void)
config flash error interrupt.
Definition utilities/at32f413_slib_demo/project_l0/src/main.c:75
SLIB_DATA_ADDR
#define SLIB_DATA_ADDR
Definition utilities/at32f413_slib_demo/project_l0/src/main.c:49
dw_end_sector
uint32_t dw_end_sector
Definition utilities/at32f413_slib_demo/project_l0/src/main.c:59
SLIB_END_ADDR
#define SLIB_END_ADDR
Definition utilities/at32f413_slib_demo/project_l0/src/main.c:50
dw_start_sector
uint32_t dw_start_sector
Definition utilities/at32f413_slib_demo/project_l0/src/main.c:59
main
int main(void)
main function.
Definition utilities/at32f413_slib_demo/project_l0/src/main.c:128
TEST_LENGTH_SAMPLES
#define TEST_LENGTH_SAMPLES
Definition utilities/at32f413_slib_demo/project_l0/src/main.c:56
temp_buf
uint32_t temp_buf[512]
Definition utilities/at32f413_slib_demo/project_l0/src/main.c:60
SLIB_START_ADDR
#define SLIB_START_ADDR
Definition utilities/at32f413_slib_demo/project_l0/src/main.c:48
dw_data_start_sector
uint32_t dw_data_start_sector
Definition utilities/at32f413_slib_demo/project_l0/src/main.c:59
slib_enable
flash_status_type slib_enable(void)
config slib enable and program slib area.
Definition utilities/at32f413_slib_demo/project_l0/src/main.c:92
FLASH_SECTOR_SIZE
#define FLASH_SECTOR_SIZE
Definition utilities/at32f413_slib_demo/project_l0/src/main.c:51
TEST_SLIB_PSW
#define TEST_SLIB_PSW
Definition utilities/at32f413_slib_demo/project_l0/src/main.c:47
SNR_THRESHOLD_F32
#define SNR_THRESHOLD_F32
Definition utilities/at32f413_slib_demo/project_l0/src/main.c:55
at32f413_clock.h
header file of clock program
FIR_lowpass_filter
void FIR_lowpass_filter(float32_t *pSrc, float32_t *pDst, uint32_t testlengthsamples)
Definition fir_filter.c:76
arm_snr_f32
float arm_snr_f32(float *pRef, float *pTest, uint32_t buffSize)
Caluclation of SNR.
Definition project_l0/src/math_helper.c:62
testInput_f32_1kHz_15kHz
float32_t testInput_f32_1kHz_15kHz[]
Definition project_l0/src/arm_fir_data.c:48
refOutput
float32_t refOutput[]
Definition project_l0/src/arm_fir_data.c:96


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • utilities
  • at32f413_slib_demo
  • project_l1
  • inc
utilities/at32f413_slib_demo/project_l1/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • utilities
  • at32f413_slib_demo
  • project_l1
  • inc
utilities/at32f413_slib_demo/project_l1/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • utilities
  • at32f413_slib_demo
  • project_l1
  • inc
utilities/at32f413_slib_demo/project_l1/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • utilities
  • at32f413_slib_demo
  • project_l1
  • src
utilities/at32f413_slib_demo/project_l1/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_clock_config
void system_clock_config(void)
system clock config program
Definition utilities/at32f413_slib_demo/project_l1/src/at32f413_clock.c:47
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • utilities
  • at32f413_slib_demo
  • project_l1
  • src
utilities/at32f413_slib_demo/project_l1/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28#include "at32f413_board.h"
29
43void NMI_Handler(void)
44{
45}
46
52void HardFault_Handler(void)
53{
54 /* go to infinite loop when hard fault exception occurs */
55 while (1)
56 {
57 }
58}
59
65void MemManage_Handler(void)
66{
67 /* go to infinite loop when memory manage exception occurs */
68 while (1)
69 {
70 }
71}
72
78void BusFault_Handler(void)
79{
80 /* go to infinite loop when bus fault exception occurs */
81 while (1)
82 {
83 }
84}
85
91void UsageFault_Handler(void)
92{
93 /* go to infinite loop when usage fault exception occurs */
94 while (1)
95 {
96 }
97}
98
104void SVC_Handler(void)
105{
106}
107
113void DebugMon_Handler(void)
114{
115}
116
122void PendSV_Handler(void)
123{
124}
125
131void SysTick_Handler(void)
132{
133}
134
140void FLASH_IRQHandler(void)
141{
142 if(flash_flag_get(FLASH_EPPERR_FLAG))
143 {
144 flash_flag_clear(FLASH_EPPERR_FLAG);
145 delay_ms(500);
146 }
147}
148
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
flash_flag_get
flag_status flash_flag_get(uint32_t flash_flag)
check whether the specified flash flag is set or not.
Definition at32f413_flash.c:58
flash_flag_clear
void flash_flag_clear(uint32_t flash_flag)
clear the flash flag.
Definition at32f413_flash.c:97
FLASH_EPPERR_FLAG
#define FLASH_EPPERR_FLAG
Definition at32f413_flash.h:79
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition utilities/at32f413_slib_demo/project_l1/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition utilities/at32f413_slib_demo/project_l1/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition utilities/at32f413_slib_demo/project_l1/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition utilities/at32f413_slib_demo/project_l1/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition utilities/at32f413_slib_demo/project_l1/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition utilities/at32f413_slib_demo/project_l1/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition utilities/at32f413_slib_demo/project_l1/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition utilities/at32f413_slib_demo/project_l1/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition utilities/at32f413_slib_demo/project_l1/src/at32f413_int.c:113
FLASH_IRQHandler
void FLASH_IRQHandler(void)
flash handler.
Definition utilities/at32f413_slib_demo/project_l1/src/at32f413_int.c:140
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • utilities
  • at32f413_slib_demo
  • project_l1
  • src
utilities/at32f413_slib_demo/project_l1/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include <stdio.h>
29#include "math_helper.h"
30#include "fir_filter.h"
31
32extern float32_t testInput_f32_1kHz_15kHz[];
33extern float32_t refOutput[];
34
43#define SNR_THRESHOLD_F32 140.0f
44#define TEST_LENGTH_SAMPLES 320
45
46static float32_t testOutput[TEST_LENGTH_SAMPLES];
47
48void config_flash_interrupt(void);
49
55void config_flash_interrupt(void)
56{
57 flash_unlock();
58 flash_interrupt_enable(FLASH_ERR_INT, TRUE);
59 flash_lock();
60 /* config nvic priority group */
61 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
62
63 nvic_irq_enable(FLASH_IRQn, 0, 0);
64}
65
71int main(void)
72{
73 arm_status status;
74 float32_t *inputf32, *outputf32, snr;
75
76 system_clock_config();
77 at32_board_init();
78
79 /* initialize input and output buffer pointers */
80 inputf32 = &testInput_f32_1kHz_15kHz[0];
81 outputf32 = &testOutput[0];
82
83 /* configure flash to generate an interrupt when a write protect error occur */
84 config_flash_interrupt();
85
86 /* wait for key button to be pushed, then turn off led3 */
87 while(at32_button_press() == NO_BUTTON)
88 {
89 at32_led_toggle(LED3);
90 delay_ms(100);
91 }
92 at32_led_off(LED3);
93
94 /* call the fir low pass filter function */
95 FIR_lowpass_filter(inputf32, outputf32, TEST_LENGTH_SAMPLES);
96
97 /* compare the generated output against the reference output computed in matlab. */
98 snr = arm_snr_f32(&refOutput[0], &testOutput[0], TEST_LENGTH_SAMPLES);
99 if(snr < SNR_THRESHOLD_F32)
100 {
101 status = ARM_MATH_TEST_FAILURE;
102 }
103 else
104 {
105 status = ARM_MATH_SUCCESS;
106 }
107
108 /* infinite loop */
109 while(1)
110 {
111 if(status == ARM_MATH_TEST_FAILURE)
112 {
113 /* toggle red led2 if fir function failed */
114 at32_led_toggle(LED2);
115 delay_ms(500);
116 }
117 else
118 {
119 /* toggle green led4 if fir function success */
120 at32_led_toggle(LED4);
121 delay_ms(500);
122 }
123 }
124}
125
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
LED3
@ LED3
Definition at32f413_board.h:63
LED2
@ LED2
Definition at32f413_board.h:62
LED4
@ LED4
Definition at32f413_board.h:64
NO_BUTTON
@ NO_BUTTON
Definition at32f413_board.h:94
at32_button_press
button_type at32_button_press()
returns which button have press down
Definition at32f413_board.c:218
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
at32_led_off
void at32_led_off(led_type led)
turns selected led off.
Definition at32f413_board.c:287
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
FLASH_IRQn
@ FLASH_IRQn
Definition at32f413.h:175
TRUE
@ TRUE
Definition at32f413.h:297
flash_unlock
void flash_unlock(void)
unlock the flash controller.
Definition at32f413_flash.c:228
flash_interrupt_enable
void flash_interrupt_enable(uint32_t flash_int, confirm_state new_state)
enable or disable the specified flash interrupts.
Definition at32f413_flash.c:729
flash_lock
void flash_lock(void)
lock the flash controller.
Definition at32f413_flash.c:251
FLASH_ERR_INT
#define FLASH_ERR_INT
Definition at32f413_flash.h:95
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
testOutput
static float32_t testOutput[320]
Definition utilities/at32f413_slib_demo/project_l1/src/main.c:46
config_flash_interrupt
void config_flash_interrupt(void)
config flash error interrupt.
Definition utilities/at32f413_slib_demo/project_l1/src/main.c:55
main
int main(void)
main function.
Definition utilities/at32f413_slib_demo/project_l1/src/main.c:71
TEST_LENGTH_SAMPLES
#define TEST_LENGTH_SAMPLES
Definition utilities/at32f413_slib_demo/project_l1/src/main.c:44
SNR_THRESHOLD_F32
#define SNR_THRESHOLD_F32
Definition utilities/at32f413_slib_demo/project_l1/src/main.c:43
at32f413_clock.h
header file of clock program
FIR_lowpass_filter
void FIR_lowpass_filter(float32_t *pSrc, float32_t *pDst, uint32_t testlengthsamples)
Definition fir_filter.c:76
arm_snr_f32
float arm_snr_f32(float *pRef, float *pTest, uint32_t buffSize)
Caluclation of SNR.
Definition project_l0/src/math_helper.c:62
testInput_f32_1kHz_15kHz
float32_t testInput_f32_1kHz_15kHz[]
Definition project_l0/src/arm_fir_data.c:48
refOutput
float32_t refOutput[]
Definition project_l0/src/arm_fir_data.c:96


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led3_toggle
  • inc
utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led3_toggle
  • inc
utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led3_toggle
  • inc
utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led3_toggle
  • src
utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_clock_config
void system_clock_config(void)
system clock config program
Definition utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/at32f413_clock.c:47
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led3_toggle
  • src
utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while (1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while (1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while (1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while (1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led3_toggle
  • src
utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include "tmr.h"
29#include "usart.h"
30#include "iap.h"
31
45int main(void)
46{
47 /* config vector table offset */
48 nvic_vector_table_set(NVIC_VECTTAB_FLASH, 0x4000);
49
50 /* config nvic priority group */
51 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
52
53 system_clock_config();
54 at32_board_init();
55
56 /* check and clear iap_upgrade_flag flag */
57 iap_init();
58
59 /* init usart used for app update */
60 uart_init(115200);
61
62 /* init tmr used for show code running state(led cycle toggle) */
63 tmr_init();
64
65 while(1)
66 {
67 iap_command_handle();
68 }
69}
70
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
uart_init
void uart_init(uint32_t baudrate)
init usart.
Definition app_led3_toggle/src/usart.c:44
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
nvic_vector_table_set
void nvic_vector_table_set(uint32_t base, uint32_t offset)
set the vector table location and offset.
Definition at32f413_misc.c:111
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
NVIC_VECTTAB_FLASH
#define NVIC_VECTTAB_FLASH
Definition at32f413_misc.h:51
main
int main(void)
main function.
Definition utilities/at32f413_usart_iap_demo/source_code/app_led3_toggle/src/main.c:45
iap_init
void iap_init(void)
iap init.
Definition app_led3_toggle/src/iap.c:60
iap_command_handle
void iap_command_handle(void)
iap command handle handle.
Definition app_led3_toggle/src/iap.c:43
tmr_init
void tmr_init(void)
init tmr.
Definition app_led3_toggle/src/tmr.c:43
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led4_toggle
  • inc
utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led4_toggle
  • inc
utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led4_toggle
  • inc
utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led4_toggle
  • src
utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_clock_config
void system_clock_config(void)
system clock config program
Definition utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/at32f413_clock.c:47
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led4_toggle
  • src
utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while (1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while (1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while (1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while (1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • app_led4_toggle
  • src
utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include "tmr.h"
29#include "usart.h"
30#include "iap.h"
31
45int main(void)
46{
47 /* config vector table offset */
48 nvic_vector_table_set(NVIC_VECTTAB_FLASH, 0x4000);
49
50 /* config nvic priority group */
51 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
52
53 system_clock_config();
54 at32_board_init();
55
56 /* check and clear iap_upgrade_flag flag */
57 iap_init();
58
59 /* init usart used for app update */
60 uart_init(115200);
61
62 /* init tmr used for show code running state(led cycle toggle) */
63 tmr_init();
64
65 while(1)
66 {
67 iap_command_handle();
68 }
69}
70
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
uart_init
void uart_init(uint32_t baudrate)
init usart.
Definition app_led3_toggle/src/usart.c:44
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
nvic_vector_table_set
void nvic_vector_table_set(uint32_t base, uint32_t offset)
set the vector table location and offset.
Definition at32f413_misc.c:111
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
NVIC_VECTTAB_FLASH
#define NVIC_VECTTAB_FLASH
Definition at32f413_misc.h:51
main
int main(void)
main function.
Definition utilities/at32f413_usart_iap_demo/source_code/app_led4_toggle/src/main.c:45
iap_init
void iap_init(void)
iap init.
Definition app_led3_toggle/src/iap.c:60
iap_command_handle
void iap_command_handle(void)
iap command handle handle.
Definition app_led3_toggle/src/iap.c:43
tmr_init
void tmr_init(void)
init tmr.
Definition app_led3_toggle/src/tmr.c:43
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • bootloader
  • inc
utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • bootloader
  • inc
utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • bootloader
  • inc
utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: flash.h Source File

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • bootloader
  • inc
utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/flash.h
Go to the documentation of this file.
1
26#ifndef __FLASH_H__
27#define __FLASH_H__
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33#include "at32f413_board.h"
34
47#define FLASH_SIZE (*((uint32_t*)0x1FFFF7E0)) /* read from at32 flash capacity register(unit:kbyte) */
48#define SRAM_SIZE 64 /* sram size, unit:kbyte */
49
58void flash_2kb_write(uint32_t write_addr, uint8_t *pbuffer);
59 flag_status flash_upgrade_flag_read(void);
60
73#ifdef __cplusplus
74}
75#endif
76
77#endif
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
flag_status
flag_status
flag status
Definition at32f413.h:292
flash_2kb_write
void flash_2kb_write(uint32_t write_addr, uint8_t *pbuffer)
flash erase/program operation.
Definition utilities/at32f413_usart_iap_demo/source_code/bootloader/src/flash.c:44
flash_upgrade_flag_read
flag_status flash_upgrade_flag_read(void)
check flash upgrade flag.
Definition utilities/at32f413_usart_iap_demo/source_code/bootloader/src/flash.c:65


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • bootloader
  • src
utilities/at32f413_usart_iap_demo/source_code/bootloader/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_clock_config
void system_clock_config(void)
system clock config program
Definition utilities/at32f413_usart_iap_demo/source_code/bootloader/src/at32f413_clock.c:47
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • bootloader
  • src
utilities/at32f413_usart_iap_demo/source_code/bootloader/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while (1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while (1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while (1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while (1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition utilities/at32f413_usart_iap_demo/source_code/bootloader/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition utilities/at32f413_usart_iap_demo/source_code/bootloader/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition utilities/at32f413_usart_iap_demo/source_code/bootloader/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition utilities/at32f413_usart_iap_demo/source_code/bootloader/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition utilities/at32f413_usart_iap_demo/source_code/bootloader/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition utilities/at32f413_usart_iap_demo/source_code/bootloader/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition utilities/at32f413_usart_iap_demo/source_code/bootloader/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition utilities/at32f413_usart_iap_demo/source_code/bootloader/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition utilities/at32f413_usart_iap_demo/source_code/bootloader/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: flash.c Source File

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • bootloader
  • src
utilities/at32f413_usart_iap_demo/source_code/bootloader/src/flash.c
Go to the documentation of this file.
1
26#include "flash.h"
27#include "usart.h"
28#include "iap.h"
29
44void flash_2kb_write(uint32_t write_addr, uint8_t *pbuffer)
45{
46 uint16_t index, write_data;
47 flash_unlock();
48 flash_sector_erase(write_addr);
49 if(FLASH_SIZE < 0x100) /* less than 256kb, 1kb/sector */
50 flash_sector_erase(write_addr + 0x400);
51 for(index = 0; index < 2048; index += 2)
52 {
53 write_data = (pbuffer[index+1] << 8) + pbuffer[index];
54 flash_halfword_program(write_addr, write_data);
55 write_addr += sizeof(uint16_t);
56 }
57 flash_lock();
58}
59
65 flag_status flash_upgrade_flag_read(void)
66{
67 if((*(uint32_t*)IAP_UPGRADE_FLAG_ADDR) == IAP_UPGRADE_FLAG)
68 return SET;
69 else
70 return RESET;
71}
72
flag_status
flag_status
flag status
Definition at32f413.h:292
RESET
@ RESET
Definition at32f413.h:292
SET
@ SET
Definition at32f413.h:292
flash_sector_erase
flash_status_type flash_sector_erase(uint32_t sector_address)
erase a specified flash sector.
Definition at32f413_flash.c:272
flash_halfword_program
flash_status_type flash_halfword_program(uint32_t address, uint16_t data)
program a halfword at a specified address.
Definition at32f413_flash.c:452
flash_unlock
void flash_unlock(void)
unlock the flash controller.
Definition at32f413_flash.c:228
flash_lock
void flash_lock(void)
lock the flash controller.
Definition at32f413_flash.c:251
flash_2kb_write
void flash_2kb_write(uint32_t write_addr, uint8_t *pbuffer)
flash erase/program operation.
Definition utilities/at32f413_usart_iap_demo/source_code/bootloader/src/flash.c:44
flash_upgrade_flag_read
flag_status flash_upgrade_flag_read(void)
check flash upgrade flag.
Definition utilities/at32f413_usart_iap_demo/source_code/bootloader/src/flash.c:65
IAP_UPGRADE_FLAG_ADDR
#define IAP_UPGRADE_FLAG_ADDR
Definition app_led3_toggle/inc/iap.h:51
IAP_UPGRADE_FLAG
#define IAP_UPGRADE_FLAG
Definition app_led3_toggle/inc/iap.h:55
FLASH_SIZE
#define FLASH_SIZE
Definition utilities/at32f413_usart_iap_demo/source_code/bootloader/inc/flash.h:47


AT32F413 Firmwary Library: main.c Source File

  • utilities
  • at32f413_usart_iap_demo
  • source_code
  • bootloader
  • src
utilities/at32f413_usart_iap_demo/source_code/bootloader/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include "tmr.h"
29#include "usart.h"
30#include "flash.h"
31#include "iap.h"
32
46int main(void)
47{
48 system_clock_config();
49 at32_board_init();
50
51 /* config nvic priority group */
52 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
53
54 /* check iap_upgrade_flag flag */
55 if(flash_upgrade_flag_read() == RESET)
56 {
57 /* check app starting address whether 0x08xxxxxx */
58 if(((*(uint32_t*)(APP_START_ADDR + 4)) & 0xFF000000) == 0x08000000)
59 app_load(APP_START_ADDR);
60 }
61
62 /* init usart used for app update */
63 uart_init(115200);
64
65 /* check whether need to upgrade, if yes, response ok to pc-tool */
66 if(flash_upgrade_flag_read() != RESET)
67 back_ok();
68
69 /* init tmr used for show code running state(led cycle toggle) */
70 tmr_init();
71
72 while(1)
73 {
74 /* upgrade handle */
75 iap_upgrade_app_handle();
76 }
77}
78
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
uart_init
void uart_init(uint32_t baudrate)
init usart.
Definition app_led3_toggle/src/usart.c:44
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
RESET
@ RESET
Definition at32f413.h:292
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
main
int main(void)
main function.
Definition utilities/at32f413_usart_iap_demo/source_code/bootloader/src/main.c:46
APP_START_ADDR
#define APP_START_ADDR
Definition app_led3_toggle/inc/iap.h:48
tmr_init
void tmr_init(void)
init tmr.
Definition app_led3_toggle/src/tmr.c:43
back_ok
void back_ok(void)
command response ok.
Definition app_led3_toggle/src/usart.c:106
iap_upgrade_app_handle
void iap_upgrade_app_handle(void)
iap upgrade app handle.
Definition bootloader/src/iap.c:350
app_load
void app_load(uint32_t appxaddr)
app load.
Definition bootloader/src/iap.c:66
flash_upgrade_flag_read
flag_status flash_upgrade_flag_read(void)
check flash upgrade flag.
Definition utilities/at32f413_usart_iap_demo/source_code/bootloader/src/flash.c:65
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • app_led3_toggle
  • inc
utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • app_led3_toggle
  • inc
utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • app_led3_toggle
  • inc
utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: usb_conf.h Source File

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • app_led3_toggle
  • inc
utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/inc/usb_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __USB_CONF_H
28#define __USB_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "at32f413.h"
35#include "at32f413_board.h"
36#include "stdio.h"
37
49#ifndef USB_EPT_MAX_NUM
50#define USB_EPT_MAX_NUM 8
51#endif
52
56//#define USB_BUFFER_SIZE_EX /*!< usb enable extend buffer */
57
58
62#define USB_EPT_AUTO_MALLOC_BUFFER
65#ifndef USB_EPT_AUTO_MALLOC_BUFFER
71/* ept0 tx start address 0x40, size 0x40,
72 so rx start address is 0x40 + 0x40 = 0x80 */
73#define EPT0_TX_ADDR 0x40
74#define EPT0_RX_ADDR 0x80
76#define EPT1_TX_ADDR 0xC0
77#define EPT1_RX_ADDR 0x100
79#define EPT2_TX_ADDR 0x140
80#define EPT2_RX_ADDR 0x180
82#define EPT3_TX_ADDR 0x00
83#define EPT3_RX_ADDR 0x00
85#define EPT4_TX_ADDR 0x00
86#define EPT4_RX_ADDR 0x00
88#define EPT5_TX_ADDR 0x00
89#define EPT5_RX_ADDR 0x00
91#define EPT6_TX_ADDR 0x00
92#define EPT6_RX_ADDR 0x00
94#define EPT7_TX_ADDR 0x00
95#define EPT7_RX_ADDR 0x00
97#endif
98void usb_delay_ms(uint32_t ms);
99void usb_delay_us(uint32_t us);
100
109#ifdef __cplusplus
110}
111#endif
112
113#endif
at32f413.h
at32f413 header file
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
usb_delay_ms
void usb_delay_ms(uint32_t ms)
usb delay millisecond function.
Definition utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/main.c:132
usb_delay_us
void usb_delay_us(uint32_t us)
usb delay microsecond function.
Definition utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/main.c:143


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • app_led3_toggle
  • src
utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_clock_config
void system_clock_config(void)
system clock config program
Definition utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/at32f413_clock.c:47
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • app_led3_toggle
  • src
utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • app_led3_toggle
  • src
utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include "usbd_core.h"
29#include "hid_iap_class.h"
30#include "hid_iap_desc.h"
31#include "hid_iap_user.h"
32#include "usbd_int.h"
33
42 usbd_core_type usb_core_dev;
43
44void usb_clock48m_select(usb_clk48_s clk_s);
45
51void usb_clock48m_select(usb_clk48_s clk_s)
52{
53 crm_clocks_freq_type clocks_struct;
54
55 if(clk_s == USB_CLK_HICK)
56 {
57 crm_usb_clock_source_select(CRM_USB_CLOCK_SOURCE_HICK);
58
59 /* enable the acc calibration ready interrupt */
60 crm_periph_clock_enable(CRM_ACC_PERIPH_CLOCK, TRUE);
61
62 /* update the c1\c2\c3 value */
63 acc_write_c1(7980);
64 acc_write_c2(8000);
65 acc_write_c3(8020);
66
67 /* open acc calibration */
68 acc_calibration_mode_enable(ACC_CAL_HICKTRIM, TRUE);
69 }
70 else
71 {
72 crm_clocks_freq_get(&clocks_struct);
73 switch(clocks_struct.sclk_freq)
74 {
75 /* 48MHz */
76 case 48000000:
77 crm_usb_clock_div_set(CRM_USB_DIV_1);
78 break;
79
80 /* 72MHz */
81 case 72000000:
82 crm_usb_clock_div_set(CRM_USB_DIV_1_5);
83 break;
84
85 /* 96MHz */
86 case 96000000:
87 crm_usb_clock_div_set(CRM_USB_DIV_2);
88 break;
89
90 /* 120MHz */
91 case 120000000:
92 crm_usb_clock_div_set(CRM_USB_DIV_2_5);
93 break;
94
95 /* 144MHz */
96 case 144000000:
97 crm_usb_clock_div_set(CRM_USB_DIV_3);
98 break;
99
100 /* 168MHz */
101 case 168000000:
102 crm_usb_clock_div_set(CRM_USB_DIV_3_5);
103 break;
104
105 /* 192MHz */
106 case 192000000:
107 crm_usb_clock_div_set(CRM_USB_DIV_4);
108 break;
109
110 default:
111 break;
112
113 }
114 }
115}
116
122void USBFS_L_CAN1_RX0_IRQHandler(void)
123{
124 usbd_irq_handler(&usb_core_dev);
125}
126
132void usb_delay_ms(uint32_t ms)
133{
134 /* user can define self delay function */
135 delay_ms(ms);
136}
137
143void usb_delay_us(uint32_t us)
144{
145 delay_us(us);
146}
147
153int main(void)
154{
155 /* config vector table offset */
156 nvic_vector_table_set(NVIC_VECTTAB_FLASH, 0x6000);
157
158 system_clock_config();
159
160 /* config nvic priority group */
161 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
162
163 /* iap init */
164 iap_init();
165
166 at32_board_init();
167
168 /* select usb 48m clcok source */
169 usb_clock48m_select(USB_CLK_HEXT);
170
171 /* enable usb clock */
172 crm_periph_clock_enable(CRM_USB_PERIPH_CLOCK, TRUE);
173
174 /* enable usb interrupt */
175 nvic_irq_enable(USBFS_L_CAN1_RX0_IRQn, 0, 0);
176
177 /* usb core init */
178 usbd_core_init(&usb_core_dev, USB, &hid_iap_class_handler, &hid_iap_desc_handler, 0);
179
180 /* enable usb pull-up */
181 usbd_connect(&usb_core_dev);
182
183 while(1)
184 {
185 app_loop();
186 at32_led_toggle(LED3);
187 delay_ms(200);
188 }
189}
190
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
usb_delay_ms
void usb_delay_ms(uint32_t ms)
usb delay millisecond function.
Definition project/at_start_f413/examples/acc/calibration/src/main.c:244
usb_delay_us
void usb_delay_us(uint32_t us)
usb delay microsecond function.
Definition project/at_start_f413/examples/acc/calibration/src/main.c:255
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
ACC_CAL_HICKTRIM
#define ACC_CAL_HICKTRIM
Definition at32f413_acc.h:52
acc_write_c2
void acc_write_c2(uint16_t acc_c2_value)
wtire the value to acc c2 register.
Definition at32f413_acc.c:131
acc_write_c3
void acc_write_c3(uint16_t acc_c3_value)
wtire the value to acc c3 register.
Definition at32f413_acc.c:141
acc_write_c1
void acc_write_c1(uint16_t acc_c1_value)
wtire the value to acc c1 register.
Definition at32f413_acc.c:121
acc_calibration_mode_enable
void acc_calibration_mode_enable(uint16_t acc_trim, confirm_state new_state)
enable or disable the acc calibration mode.
Definition at32f413_acc.c:52
LED3
@ LED3
Definition at32f413_board.h:63
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
delay_us
void delay_us(uint32_t nus)
inserts a delay time.
Definition at32f413_board.c:330
crm_usb_clock_div_set
void crm_usb_clock_div_set(crm_usb_div_type div_value)
set crm usb division
Definition at32f413_crm.c:533
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_usb_clock_source_select
void crm_usb_clock_source_select(crm_usb_clock_source_type value)
usb 48 mhz clock source select
Definition at32f413_crm.c:854
crm_clocks_freq_get
void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
Definition at32f413_crm.c:660
CRM_USB_PERIPH_CLOCK
@ CRM_USB_PERIPH_CLOCK
Definition at32f413_crm.h:137
CRM_ACC_PERIPH_CLOCK
@ CRM_ACC_PERIPH_CLOCK
Definition at32f413_crm.h:123
CRM_USB_DIV_3
@ CRM_USB_DIV_3
Definition at32f413_crm.h:363
CRM_USB_DIV_1_5
@ CRM_USB_DIV_1_5
Definition at32f413_crm.h:358
CRM_USB_DIV_4
@ CRM_USB_DIV_4
Definition at32f413_crm.h:364
CRM_USB_DIV_3_5
@ CRM_USB_DIV_3_5
Definition at32f413_crm.h:362
CRM_USB_DIV_2
@ CRM_USB_DIV_2
Definition at32f413_crm.h:361
CRM_USB_DIV_1
@ CRM_USB_DIV_1
Definition at32f413_crm.h:359
CRM_USB_DIV_2_5
@ CRM_USB_DIV_2_5
Definition at32f413_crm.h:360
CRM_USB_CLOCK_SOURCE_HICK
@ CRM_USB_CLOCK_SOURCE_HICK
Definition at32f413_crm.h:454
USBFS_L_CAN1_RX0_IRQn
@ USBFS_L_CAN1_RX0_IRQn
Definition at32f413.h:192
TRUE
@ TRUE
Definition at32f413.h:297
nvic_vector_table_set
void nvic_vector_table_set(uint32_t base, uint32_t offset)
set the vector table location and offset.
Definition at32f413_misc.c:111
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
NVIC_VECTTAB_FLASH
#define NVIC_VECTTAB_FLASH
Definition at32f413_misc.h:51
usb_clk48_s
usb_clk48_s
usb clock select
Definition at32f413_usb.h:230
USB_CLK_HEXT
@ USB_CLK_HEXT
Definition at32f413_usb.h:232
USB_CLK_HICK
@ USB_CLK_HICK
Definition at32f413_usb.h:231
hid_iap_class_handler
usbd_class_handler hid_iap_class_handler
Definition hid_iap_class.c:56
hid_iap_desc_handler
usbd_desc_handler hid_iap_desc_handler
hid device descriptor handler structure
Definition hid_iap_desc.c:67
usb_clock48m_select
void usb_clock48m_select(usb_clk48_s clk_s)
usb 48M clock select
Definition utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/main.c:51
main
int main(void)
main function.
Definition utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/main.c:153
USBFS_L_CAN1_RX0_IRQHandler
void USBFS_L_CAN1_RX0_IRQHandler(void)
this function handles usb interrupt.
Definition utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/main.c:122
usb_core_dev
usbd_core_type usb_core_dev
Definition utilities/at32f413_usb_iap_demo/source_code/app_led3_toggle/src/main.c:42
usbd_core_init
void usbd_core_init(usbd_core_type *udev, usb_reg_type *usb_reg, usbd_class_handler *dev_handler, usbd_desc_handler *desc_handler, uint8_t core_id)
initializes the usb core
Definition usbd_core.c:675
usbd_connect
void usbd_connect(usbd_core_type *udev)
usb device connect to host
Definition usbd_core.c:564
usbd_irq_handler
void usbd_irq_handler(usbd_core_type *udev)
usb device interrput request handler.
Definition usbd_int.c:45
USB
#define USB
Definition at32f413_usb.h:665
iap_init
void iap_init(void)
iap init.
Definition app_led3_toggle/src/iap.c:60
app_loop
void app_loop(void)
iap loop
Definition app_led3_toggle/src/hid_iap_user.c:252
hid_iap_class.h
usb hid iap header file
hid_iap_desc.h
usb hid descriptor header file
at32f413_clock.h
header file of clock program
crm_clocks_freq_type
crm clocks freqency structure
Definition at32f413_crm.h:470
crm_clocks_freq_type::sclk_freq
uint32_t sclk_freq
Definition at32f413_crm.h:471
usbd_core_type
usb device core struct type
Definition usbd_core.h:114
usbd_core.h
usb device core header file
usbd_int.h


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • app_led4_toggle
  • inc
utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • app_led4_toggle
  • inc
utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • app_led4_toggle
  • inc
utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: usb_conf.h Source File

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • app_led4_toggle
  • inc
utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/inc/usb_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __USB_CONF_H
28#define __USB_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "at32f413.h"
35#include "at32f413_board.h"
36#include "stdio.h"
37
49#ifndef USB_EPT_MAX_NUM
50#define USB_EPT_MAX_NUM 8
51#endif
52
56//#define USB_BUFFER_SIZE_EX /*!< usb enable extend buffer */
57
58
62#define USB_EPT_AUTO_MALLOC_BUFFER
65#ifndef USB_EPT_AUTO_MALLOC_BUFFER
71/* ept0 tx start address 0x40, size 0x40,
72 so rx start address is 0x40 + 0x40 = 0x80 */
73#define EPT0_TX_ADDR 0x40
74#define EPT0_RX_ADDR 0x80
76#define EPT1_TX_ADDR 0xC0
77#define EPT1_RX_ADDR 0x100
79#define EPT2_TX_ADDR 0x140
80#define EPT2_RX_ADDR 0x180
82#define EPT3_TX_ADDR 0x00
83#define EPT3_RX_ADDR 0x00
85#define EPT4_TX_ADDR 0x00
86#define EPT4_RX_ADDR 0x00
88#define EPT5_TX_ADDR 0x00
89#define EPT5_RX_ADDR 0x00
91#define EPT6_TX_ADDR 0x00
92#define EPT6_RX_ADDR 0x00
94#define EPT7_TX_ADDR 0x00
95#define EPT7_RX_ADDR 0x00
97#endif
98void usb_delay_ms(uint32_t ms);
99void usb_delay_us(uint32_t us);
100
109#ifdef __cplusplus
110}
111#endif
112
113#endif
at32f413.h
at32f413 header file
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
usb_delay_ms
void usb_delay_ms(uint32_t ms)
usb delay millisecond function.
Definition utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/main.c:132
usb_delay_us
void usb_delay_us(uint32_t us)
usb delay microsecond function.
Definition utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/main.c:143


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • app_led4_toggle
  • src
utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_clock_config
void system_clock_config(void)
system clock config program
Definition utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/at32f413_clock.c:47
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • app_led4_toggle
  • src
utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • app_led4_toggle
  • src
utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include "usbd_core.h"
29#include "hid_iap_class.h"
30#include "hid_iap_desc.h"
31#include "hid_iap_user.h"
32#include "usbd_int.h"
33
42 usbd_core_type usb_core_dev;
43
44void usb_clock48m_select(usb_clk48_s clk_s);
45
51void usb_clock48m_select(usb_clk48_s clk_s)
52{
53 crm_clocks_freq_type clocks_struct;
54
55 if(clk_s == USB_CLK_HICK)
56 {
57 crm_usb_clock_source_select(CRM_USB_CLOCK_SOURCE_HICK);
58
59 /* enable the acc calibration ready interrupt */
60 crm_periph_clock_enable(CRM_ACC_PERIPH_CLOCK, TRUE);
61
62 /* update the c1\c2\c3 value */
63 acc_write_c1(7980);
64 acc_write_c2(8000);
65 acc_write_c3(8020);
66
67 /* open acc calibration */
68 acc_calibration_mode_enable(ACC_CAL_HICKTRIM, TRUE);
69 }
70 else
71 {
72 crm_clocks_freq_get(&clocks_struct);
73 switch(clocks_struct.sclk_freq)
74 {
75 /* 48MHz */
76 case 48000000:
77 crm_usb_clock_div_set(CRM_USB_DIV_1);
78 break;
79
80 /* 72MHz */
81 case 72000000:
82 crm_usb_clock_div_set(CRM_USB_DIV_1_5);
83 break;
84
85 /* 96MHz */
86 case 96000000:
87 crm_usb_clock_div_set(CRM_USB_DIV_2);
88 break;
89
90 /* 120MHz */
91 case 120000000:
92 crm_usb_clock_div_set(CRM_USB_DIV_2_5);
93 break;
94
95 /* 144MHz */
96 case 144000000:
97 crm_usb_clock_div_set(CRM_USB_DIV_3);
98 break;
99
100 /* 168MHz */
101 case 168000000:
102 crm_usb_clock_div_set(CRM_USB_DIV_3_5);
103 break;
104
105 /* 192MHz */
106 case 192000000:
107 crm_usb_clock_div_set(CRM_USB_DIV_4);
108 break;
109
110 default:
111 break;
112
113 }
114 }
115}
116
122void USBFS_L_CAN1_RX0_IRQHandler(void)
123{
124 usbd_irq_handler(&usb_core_dev);
125}
126
132void usb_delay_ms(uint32_t ms)
133{
134 /* user can define self delay function */
135 delay_ms(ms);
136}
137
143void usb_delay_us(uint32_t us)
144{
145 delay_us(us);
146}
147
153int main(void)
154{
155 /* config vector table offset */
156 nvic_vector_table_set(NVIC_VECTTAB_FLASH, 0x6000);
157
158 system_clock_config();
159
160 /* config nvic priority group */
161 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
162
163 /* iap init */
164 iap_init();
165
166 at32_board_init();
167
168 /* select usb 48m clcok source */
169 usb_clock48m_select(USB_CLK_HEXT);
170
171 /* enable usb clock */
172 crm_periph_clock_enable(CRM_USB_PERIPH_CLOCK, TRUE);
173
174 /* enable usb interrupt */
175 nvic_irq_enable(USBFS_L_CAN1_RX0_IRQn, 0, 0);
176
177 /* usb core init */
178 usbd_core_init(&usb_core_dev, USB, &hid_iap_class_handler, &hid_iap_desc_handler, 0);
179
180 /* enable usb pull-up */
181 usbd_connect(&usb_core_dev);
182
183 while(1)
184 {
185 app_loop();
186 at32_led_toggle(LED4);
187 delay_ms(200);
188 }
189}
190
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
usb_delay_ms
void usb_delay_ms(uint32_t ms)
usb delay millisecond function.
Definition project/at_start_f413/examples/acc/calibration/src/main.c:244
usb_delay_us
void usb_delay_us(uint32_t us)
usb delay microsecond function.
Definition project/at_start_f413/examples/acc/calibration/src/main.c:255
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
ACC_CAL_HICKTRIM
#define ACC_CAL_HICKTRIM
Definition at32f413_acc.h:52
acc_write_c2
void acc_write_c2(uint16_t acc_c2_value)
wtire the value to acc c2 register.
Definition at32f413_acc.c:131
acc_write_c3
void acc_write_c3(uint16_t acc_c3_value)
wtire the value to acc c3 register.
Definition at32f413_acc.c:141
acc_write_c1
void acc_write_c1(uint16_t acc_c1_value)
wtire the value to acc c1 register.
Definition at32f413_acc.c:121
acc_calibration_mode_enable
void acc_calibration_mode_enable(uint16_t acc_trim, confirm_state new_state)
enable or disable the acc calibration mode.
Definition at32f413_acc.c:52
LED4
@ LED4
Definition at32f413_board.h:64
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
delay_us
void delay_us(uint32_t nus)
inserts a delay time.
Definition at32f413_board.c:330
crm_usb_clock_div_set
void crm_usb_clock_div_set(crm_usb_div_type div_value)
set crm usb division
Definition at32f413_crm.c:533
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_usb_clock_source_select
void crm_usb_clock_source_select(crm_usb_clock_source_type value)
usb 48 mhz clock source select
Definition at32f413_crm.c:854
crm_clocks_freq_get
void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
Definition at32f413_crm.c:660
CRM_USB_PERIPH_CLOCK
@ CRM_USB_PERIPH_CLOCK
Definition at32f413_crm.h:137
CRM_ACC_PERIPH_CLOCK
@ CRM_ACC_PERIPH_CLOCK
Definition at32f413_crm.h:123
CRM_USB_DIV_3
@ CRM_USB_DIV_3
Definition at32f413_crm.h:363
CRM_USB_DIV_1_5
@ CRM_USB_DIV_1_5
Definition at32f413_crm.h:358
CRM_USB_DIV_4
@ CRM_USB_DIV_4
Definition at32f413_crm.h:364
CRM_USB_DIV_3_5
@ CRM_USB_DIV_3_5
Definition at32f413_crm.h:362
CRM_USB_DIV_2
@ CRM_USB_DIV_2
Definition at32f413_crm.h:361
CRM_USB_DIV_1
@ CRM_USB_DIV_1
Definition at32f413_crm.h:359
CRM_USB_DIV_2_5
@ CRM_USB_DIV_2_5
Definition at32f413_crm.h:360
CRM_USB_CLOCK_SOURCE_HICK
@ CRM_USB_CLOCK_SOURCE_HICK
Definition at32f413_crm.h:454
USBFS_L_CAN1_RX0_IRQn
@ USBFS_L_CAN1_RX0_IRQn
Definition at32f413.h:192
TRUE
@ TRUE
Definition at32f413.h:297
nvic_vector_table_set
void nvic_vector_table_set(uint32_t base, uint32_t offset)
set the vector table location and offset.
Definition at32f413_misc.c:111
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
NVIC_VECTTAB_FLASH
#define NVIC_VECTTAB_FLASH
Definition at32f413_misc.h:51
usb_clk48_s
usb_clk48_s
usb clock select
Definition at32f413_usb.h:230
USB_CLK_HEXT
@ USB_CLK_HEXT
Definition at32f413_usb.h:232
USB_CLK_HICK
@ USB_CLK_HICK
Definition at32f413_usb.h:231
hid_iap_class_handler
usbd_class_handler hid_iap_class_handler
Definition hid_iap_class.c:56
hid_iap_desc_handler
usbd_desc_handler hid_iap_desc_handler
hid device descriptor handler structure
Definition hid_iap_desc.c:67
usb_clock48m_select
void usb_clock48m_select(usb_clk48_s clk_s)
usb 48M clock select
Definition utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/main.c:51
main
int main(void)
main function.
Definition utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/main.c:153
USBFS_L_CAN1_RX0_IRQHandler
void USBFS_L_CAN1_RX0_IRQHandler(void)
this function handles usb interrupt.
Definition utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/main.c:122
usb_core_dev
usbd_core_type usb_core_dev
Definition utilities/at32f413_usb_iap_demo/source_code/app_led4_toggle/src/main.c:42
usbd_core_init
void usbd_core_init(usbd_core_type *udev, usb_reg_type *usb_reg, usbd_class_handler *dev_handler, usbd_desc_handler *desc_handler, uint8_t core_id)
initializes the usb core
Definition usbd_core.c:675
usbd_connect
void usbd_connect(usbd_core_type *udev)
usb device connect to host
Definition usbd_core.c:564
usbd_irq_handler
void usbd_irq_handler(usbd_core_type *udev)
usb device interrput request handler.
Definition usbd_int.c:45
USB
#define USB
Definition at32f413_usb.h:665
iap_init
void iap_init(void)
iap init.
Definition app_led3_toggle/src/iap.c:60
app_loop
void app_loop(void)
iap loop
Definition app_led3_toggle/src/hid_iap_user.c:252
hid_iap_class.h
usb hid iap header file
hid_iap_desc.h
usb hid descriptor header file
at32f413_clock.h
header file of clock program
crm_clocks_freq_type
crm clocks freqency structure
Definition at32f413_crm.h:470
crm_clocks_freq_type::sclk_freq
uint32_t sclk_freq
Definition at32f413_crm.h:471
usbd_core_type
usb device core struct type
Definition usbd_core.h:114
usbd_core.h
usb device core header file
usbd_int.h


AT32F413 Firmwary Library: at32f413_clock.h Source File

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • bootloader
  • inc
utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_clock.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CLOCK_H
28#define __AT32F413_CLOCK_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported functions ------------------------------------------------------- */
38void system_clock_config(void);
39
40#ifdef __cplusplus
41}
42#endif
43
44#endif /* __AT32F413_CLOCK_H */
45
at32f413.h
at32f413 header file
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47


AT32F413 Firmwary Library: at32f413_conf.h Source File

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • bootloader
  • inc
utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_CONF_H
28#define __AT32F413_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
42#if !defined HEXT_VALUE
43#define HEXT_VALUE ((uint32_t)8000000)
44#endif
45
50#define HEXT_STARTUP_TIMEOUT ((uint16_t)0x3000)
51#define HICK_VALUE ((uint32_t)8000000)
52#define LEXT_VALUE ((uint32_t)32768)
54/* module define -------------------------------------------------------------*/
55#define CRM_MODULE_ENABLED
56#define TMR_MODULE_ENABLED
57#define RTC_MODULE_ENABLED
58#define BPR_MODULE_ENABLED
59#define GPIO_MODULE_ENABLED
60#define I2C_MODULE_ENABLED
61#define USART_MODULE_ENABLED
62#define PWC_MODULE_ENABLED
63#define CAN_MODULE_ENABLED
64#define ADC_MODULE_ENABLED
65#define SPI_MODULE_ENABLED
66#define DMA_MODULE_ENABLED
67#define DEBUG_MODULE_ENABLED
68#define FLASH_MODULE_ENABLED
69#define CRC_MODULE_ENABLED
70#define WWDT_MODULE_ENABLED
71#define WDT_MODULE_ENABLED
72#define EXINT_MODULE_ENABLED
73#define SDIO_MODULE_ENABLED
74#define USB_MODULE_ENABLED
75#define ACC_MODULE_ENABLED
76#define MISC_MODULE_ENABLED
77
78/* includes ------------------------------------------------------------------*/
79#ifdef CRM_MODULE_ENABLED
80#include "at32f413_crm.h"
81#endif
82#ifdef TMR_MODULE_ENABLED
83#include "at32f413_tmr.h"
84#endif
85#ifdef RTC_MODULE_ENABLED
86#include "at32f413_rtc.h"
87#endif
88#ifdef BPR_MODULE_ENABLED
89#include "at32f413_bpr.h"
90#endif
91#ifdef GPIO_MODULE_ENABLED
92#include "at32f413_gpio.h"
93#endif
94#ifdef I2C_MODULE_ENABLED
95#include "at32f413_i2c.h"
96#endif
97#ifdef USART_MODULE_ENABLED
98#include "at32f413_usart.h"
99#endif
100#ifdef PWC_MODULE_ENABLED
101#include "at32f413_pwc.h"
102#endif
103#ifdef CAN_MODULE_ENABLED
104#include "at32f413_can.h"
105#endif
106#ifdef ADC_MODULE_ENABLED
107#include "at32f413_adc.h"
108#endif
109#ifdef SPI_MODULE_ENABLED
110#include "at32f413_spi.h"
111#endif
112#ifdef DMA_MODULE_ENABLED
113#include "at32f413_dma.h"
114#endif
115#ifdef DEBUG_MODULE_ENABLED
116#include "at32f413_debug.h"
117#endif
118#ifdef FLASH_MODULE_ENABLED
119#include "at32f413_flash.h"
120#endif
121#ifdef CRC_MODULE_ENABLED
122#include "at32f413_crc.h"
123#endif
124#ifdef WWDT_MODULE_ENABLED
125#include "at32f413_wwdt.h"
126#endif
127#ifdef WDT_MODULE_ENABLED
128#include "at32f413_wdt.h"
129#endif
130#ifdef EXINT_MODULE_ENABLED
131#include "at32f413_exint.h"
132#endif
133#ifdef SDIO_MODULE_ENABLED
134#include "at32f413_sdio.h"
135#endif
136#ifdef ACC_MODULE_ENABLED
137#include "at32f413_acc.h"
138#endif
139#ifdef MISC_MODULE_ENABLED
140#include "at32f413_misc.h"
141#endif
142#ifdef USB_MODULE_ENABLED
143#include "at32f413_usb.h"
144#endif
145
154#ifdef __cplusplus
155}
156#endif
157
158#endif
at32f413_acc.h
at32f413 acc header file
at32f413_adc.h
at32f413 adc header file
at32f413_bpr.h
at32f413 bpr header file
at32f413_can.h
at32f413 can header file
at32f413_crc.h
at32f413 crc header file
at32f413_crm.h
at32f413 crm header file
at32f413_debug.h
at32f413 debug header file
at32f413_dma.h
at32f413 dma header file
at32f413_exint.h
at32f413 exint header file
at32f413_flash.h
at32f413 flash header file
at32f413_gpio.h
at32f413 gpio header file
at32f413_i2c.h
at32f413 i2c header file
at32f413_misc.h
at32f413 misc header file
at32f413_pwc.h
at32f413 pwc header file
at32f413_rtc.h
at32f413 rtc header file
at32f413_sdio.h
at32f413 sdio header file
at32f413_spi.h
at32f413 spi header file
at32f413_tmr.h
at32f413 tmr header file
at32f413_usart.h
at32f413 usart header file
at32f413_usb.h
at32f413 usb header file
at32f413_wdt.h
at32f413 wdt header file
at32f413_wwdt.h
at32f413 wwdt header file


AT32F413 Firmwary Library: at32f413_int.h Source File

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • bootloader
  • inc
utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/at32f413_int.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __AT32F413_INT_H
28#define __AT32F413_INT_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* includes ------------------------------------------------------------------*/
35#include "at32f413.h"
36
37/* exported types ------------------------------------------------------------*/
38/* exported constants --------------------------------------------------------*/
39/* exported macro ------------------------------------------------------------*/
40/* exported functions ------------------------------------------------------- */
41
42void NMI_Handler(void);
43void HardFault_Handler(void);
44void MemManage_Handler(void);
45void BusFault_Handler(void);
46void UsageFault_Handler(void);
47void SVC_Handler(void);
48void DebugMon_Handler(void);
49void PendSV_Handler(void);
50void SysTick_Handler(void);
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif
57
at32f413.h
at32f413 header file
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:91
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:52
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:65
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:104
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:122
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:43
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:78
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:131
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_int.c:113


AT32F413 Firmwary Library: usb_conf.h Source File

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • bootloader
  • inc
utilities/at32f413_usb_iap_demo/source_code/bootloader/inc/usb_conf.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __USB_CONF_H
28#define __USB_CONF_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "at32f413.h"
35#include "at32f413_board.h"
36#include "stdio.h"
37
49#ifndef USB_EPT_MAX_NUM
50#define USB_EPT_MAX_NUM 8
51#endif
52
56//#define USB_BUFFER_SIZE_EX /*!< usb enable extend buffer */
57
58
62#define USB_EPT_AUTO_MALLOC_BUFFER
65#ifndef USB_EPT_AUTO_MALLOC_BUFFER
71/* ept0 tx start address 0x40, size 0x40,
72 so rx start address is 0x40 + 0x40 = 0x80 */
73#define EPT0_TX_ADDR 0x40
74#define EPT0_RX_ADDR 0x80
76#define EPT1_TX_ADDR 0xC0
77#define EPT1_RX_ADDR 0x100
79#define EPT2_TX_ADDR 0x140
80#define EPT2_RX_ADDR 0x180
82#define EPT3_TX_ADDR 0x00
83#define EPT3_RX_ADDR 0x00
85#define EPT4_TX_ADDR 0x00
86#define EPT4_RX_ADDR 0x00
88#define EPT5_TX_ADDR 0x00
89#define EPT5_RX_ADDR 0x00
91#define EPT6_TX_ADDR 0x00
92#define EPT6_RX_ADDR 0x00
94#define EPT7_TX_ADDR 0x00
95#define EPT7_RX_ADDR 0x00
97#endif
98void usb_delay_ms(uint32_t ms);
99void usb_delay_us(uint32_t us);
100
109#ifdef __cplusplus
110}
111#endif
112
113#endif
at32f413.h
at32f413 header file
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
usb_delay_ms
void usb_delay_ms(uint32_t ms)
usb delay millisecond function.
Definition utilities/at32f413_usb_iap_demo/source_code/bootloader/src/main.c:133
usb_delay_us
void usb_delay_us(uint32_t us)
usb delay microsecond function.
Definition utilities/at32f413_usb_iap_demo/source_code/bootloader/src/main.c:144


AT32F413 Firmwary Library: at32f413_clock.c Source File

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • bootloader
  • src
utilities/at32f413_usb_iap_demo/source_code/bootloader/src/at32f413_clock.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_clock.h"
28
47void system_clock_config(void)
48{
49 /* reset crm */
50 crm_reset();
51
52 crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE);
53
54 /* wait till hext is ready */
55 while(crm_hext_stable_wait() == ERROR)
56 {
57 }
58
59 /* config pll clock resource */
60 crm_pll_config(CRM_PLL_SOURCE_HEXT_DIV, CRM_PLL_MULT_48, CRM_PLL_OUTPUT_RANGE_GT72MHZ);
61
62 /* enable pll */
63 crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE);
64
65 /* wait till pll is ready */
66 while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET)
67 {
68 }
69
70 /* config ahbclk */
71 crm_ahb_div_set(CRM_AHB_DIV_1);
72
73 /* config apb2clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
74 crm_apb2_div_set(CRM_APB2_DIV_2);
75
76 /* config apb1clk, the maximum frequency of APB1/APB2 clock is 100 MHz */
77 crm_apb1_div_set(CRM_APB1_DIV_2);
78
79 /* enable auto step mode */
80 crm_auto_step_mode_enable(TRUE);
81
82 /* select pll as system clock source */
83 crm_sysclk_switch(CRM_SCLK_PLL);
84
85 /* wait till pll is used as system clock source */
86 while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL)
87 {
88 }
89
90 /* disable auto step mode */
91 crm_auto_step_mode_enable(FALSE);
92
93 /* update system_core_clock global variable */
94 system_core_clock_update();
95}
system_clock_config
void system_clock_config(void)
system clock config program
Definition utilities/at32f413_usb_iap_demo/source_code/bootloader/src/at32f413_clock.c:47
system_core_clock_update
void system_core_clock_update(void)
update system_core_clock variable according to clock register values. the system_core_clock variable ...
Definition system_at32f413.c:111
crm_flag_get
flag_status crm_flag_get(uint32_t flag)
get crm flag status
Definition at32f413_crm.c:121
crm_hext_stable_wait
error_status crm_hext_stable_wait(void)
wait for hext stable
Definition at32f413_crm.c:198
crm_ahb_div_set
void crm_ahb_div_set(crm_ahb_div_type value)
set crm ahb division
Definition at32f413_crm.c:463
crm_sysclk_switch_status_get
crm_sclk_type crm_sysclk_switch_status_get(void)
indicate which clock source is used as system clock
Definition at32f413_crm.c:649
crm_clock_source_enable
void crm_clock_source_enable(crm_clock_source_type source, confirm_state new_state)
enable or disable the crm clock source
Definition at32f413_crm.c:342
crm_apb2_div_set
void crm_apb2_div_set(crm_apb2_div_type value)
set crm apb2 division
Definition at32f413_crm.c:497
crm_apb1_div_set
void crm_apb1_div_set(crm_apb1_div_type value)
set crm apb1 division
Definition at32f413_crm.c:480
crm_pll_config
void crm_pll_config(crm_pll_clock_source_type clock_source, crm_pll_mult_type mult_value, crm_pll_output_range_type pll_range)
config crm pll
Definition at32f413_crm.c:573
crm_auto_step_mode_enable
void crm_auto_step_mode_enable(confirm_state new_state)
auto step clock switch enable
Definition at32f413_crm.c:798
crm_reset
void crm_reset(void)
reset the crm register
Definition at32f413_crm.c:48
crm_sysclk_switch
void crm_sysclk_switch(crm_sclk_type value)
select system clock source
Definition at32f413_crm.c:611
CRM_APB1_DIV_2
@ CRM_APB1_DIV_2
Definition at32f413_crm.h:322
CRM_CLOCK_SOURCE_PLL
@ CRM_CLOCK_SOURCE_PLL
Definition at32f413_crm.h:295
CRM_CLOCK_SOURCE_HEXT
@ CRM_CLOCK_SOURCE_HEXT
Definition at32f413_crm.h:294
CRM_PLL_SOURCE_HEXT_DIV
@ CRM_PLL_SOURCE_HEXT_DIV
Definition at32f413_crm.h:276
CRM_PLL_MULT_48
@ CRM_PLL_MULT_48
Definition at32f413_crm.h:250
CRM_AHB_DIV_1
@ CRM_AHB_DIV_1
Definition at32f413_crm.h:305
CRM_SCLK_PLL
@ CRM_SCLK_PLL
Definition at32f413_crm.h:394
CRM_APB2_DIV_2
@ CRM_APB2_DIV_2
Definition at32f413_crm.h:334
CRM_PLL_OUTPUT_RANGE_GT72MHZ
@ CRM_PLL_OUTPUT_RANGE_GT72MHZ
Definition at32f413_crm.h:285
CRM_PLL_STABLE_FLAG
#define CRM_PLL_STABLE_FLAG
Definition at32f413_crm.h:56
ERROR
@ ERROR
Definition at32f413.h:302
FALSE
@ FALSE
Definition at32f413.h:297
TRUE
@ TRUE
Definition at32f413.h:297
SET
@ SET
Definition at32f413.h:292
at32f413_clock.h
header file of clock program


AT32F413 Firmwary Library: at32f413_int.c Source File

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • bootloader
  • src
utilities/at32f413_usb_iap_demo/source_code/bootloader/src/at32f413_int.c
Go to the documentation of this file.
1
26/* includes ------------------------------------------------------------------*/
27#include "at32f413_int.h"
28
42void NMI_Handler(void)
43{
44}
45
51void HardFault_Handler(void)
52{
53 /* go to infinite loop when hard fault exception occurs */
54 while(1)
55 {
56 }
57}
58
64void MemManage_Handler(void)
65{
66 /* go to infinite loop when memory manage exception occurs */
67 while(1)
68 {
69 }
70}
71
77void BusFault_Handler(void)
78{
79 /* go to infinite loop when bus fault exception occurs */
80 while(1)
81 {
82 }
83}
84
90void UsageFault_Handler(void)
91{
92 /* go to infinite loop when usage fault exception occurs */
93 while(1)
94 {
95 }
96}
97
103void SVC_Handler(void)
104{
105}
106
112void DebugMon_Handler(void)
113{
114}
115
121void PendSV_Handler(void)
122{
123}
124
130void SysTick_Handler(void)
131{
132}
133
UsageFault_Handler
void UsageFault_Handler(void)
this function handles usage fault exception.
Definition utilities/at32f413_usb_iap_demo/source_code/bootloader/src/at32f413_int.c:90
HardFault_Handler
void HardFault_Handler(void)
this function handles hard fault exception.
Definition utilities/at32f413_usb_iap_demo/source_code/bootloader/src/at32f413_int.c:51
MemManage_Handler
void MemManage_Handler(void)
this function handles memory manage exception.
Definition utilities/at32f413_usb_iap_demo/source_code/bootloader/src/at32f413_int.c:64
SVC_Handler
void SVC_Handler(void)
this function handles svcall exception.
Definition utilities/at32f413_usb_iap_demo/source_code/bootloader/src/at32f413_int.c:103
PendSV_Handler
void PendSV_Handler(void)
this function handles pendsv_handler exception.
Definition utilities/at32f413_usb_iap_demo/source_code/bootloader/src/at32f413_int.c:121
NMI_Handler
void NMI_Handler(void)
this function handles nmi exception.
Definition utilities/at32f413_usb_iap_demo/source_code/bootloader/src/at32f413_int.c:42
BusFault_Handler
void BusFault_Handler(void)
this function handles bus fault exception.
Definition utilities/at32f413_usb_iap_demo/source_code/bootloader/src/at32f413_int.c:77
SysTick_Handler
void SysTick_Handler(void)
this function handles systick handler.
Definition utilities/at32f413_usb_iap_demo/source_code/bootloader/src/at32f413_int.c:130
DebugMon_Handler
void DebugMon_Handler(void)
this function handles debug monitor exception.
Definition utilities/at32f413_usb_iap_demo/source_code/bootloader/src/at32f413_int.c:112
at32f413_int.h
header file of main interrupt service routines.


AT32F413 Firmwary Library: main.c Source File

  • utilities
  • at32f413_usb_iap_demo
  • source_code
  • bootloader
  • src
utilities/at32f413_usb_iap_demo/source_code/bootloader/src/main.c
Go to the documentation of this file.
1
26#include "at32f413_board.h"
27#include "at32f413_clock.h"
28#include "usbd_core.h"
29#include "hid_iap_class.h"
30#include "hid_iap_desc.h"
31#include "hid_iap_user.h"
32#include "usbd_int.h"
33
42 usbd_core_type usb_core_dev;
43
44void usb_clock48m_select(usb_clk48_s clk_s);
45
51void usb_clock48m_select(usb_clk48_s clk_s)
52{
53 crm_clocks_freq_type clocks_struct;
54
55 if(clk_s == USB_CLK_HICK)
56 {
57 crm_usb_clock_source_select(CRM_USB_CLOCK_SOURCE_HICK);
58
59 /* enable the acc calibration ready interrupt */
60 crm_periph_clock_enable(CRM_ACC_PERIPH_CLOCK, TRUE);
61
62 /* update the c1\c2\c3 value */
63 acc_write_c1(7980);
64 acc_write_c2(8000);
65 acc_write_c3(8020);
66
67 /* open acc calibration */
68 acc_calibration_mode_enable(ACC_CAL_HICKTRIM, TRUE);
69 }
70 else
71 {
72 crm_clocks_freq_get(&clocks_struct);
73 switch(clocks_struct.sclk_freq)
74 {
75 /* 48MHz */
76 case 48000000:
77 crm_usb_clock_div_set(CRM_USB_DIV_1);
78 break;
79
80 /* 72MHz */
81 case 72000000:
82 crm_usb_clock_div_set(CRM_USB_DIV_1_5);
83 break;
84
85 /* 96MHz */
86 case 96000000:
87 crm_usb_clock_div_set(CRM_USB_DIV_2);
88 break;
89
90 /* 120MHz */
91 case 120000000:
92 crm_usb_clock_div_set(CRM_USB_DIV_2_5);
93 break;
94
95 /* 144MHz */
96 case 144000000:
97 crm_usb_clock_div_set(CRM_USB_DIV_3);
98 break;
99
100 /* 168MHz */
101 case 168000000:
102 crm_usb_clock_div_set(CRM_USB_DIV_3_5);
103 break;
104
105 /* 192MHz */
106 case 192000000:
107 crm_usb_clock_div_set(CRM_USB_DIV_4);
108 break;
109
110 default:
111 break;
112
113 }
114 }
115}
116
117
123void USBFS_L_CAN1_RX0_IRQHandler(void)
124{
125 usbd_irq_handler(&usb_core_dev);
126}
127
133void usb_delay_ms(uint32_t ms)
134{
135 /* user can define self delay function */
136 delay_ms(ms);
137}
138
144void usb_delay_us(uint32_t us)
145{
146 delay_us(us);
147}
148
154int main(void)
155{
156 system_clock_config();
157
158 /* config nvic priority group */
159 nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
160
161 /* iap init */
162 iap_init();
163
164 if(iap_get_upgrade_flag() == IAP_SUCCESS)
165 {
166 jump_to_app(FLASH_APP_ADDRESS);
167 }
168
169 at32_board_init();
170
171 /* select usb 48m clcok source */
172 usb_clock48m_select(USB_CLK_HEXT);
173
174 /* enable usb clock */
175 crm_periph_clock_enable(CRM_USB_PERIPH_CLOCK, TRUE);
176
177 /* enable usb interrupt */
178 nvic_irq_enable(USBFS_L_CAN1_RX0_IRQn, 0, 0);
179
180 /* usb core init */
181 usbd_core_init(&usb_core_dev, USB, &hid_iap_class_handler, &hid_iap_desc_handler, 0);
182
183 /* enable usb pull-up */
184 usbd_connect(&usb_core_dev);
185
186 while(1)
187 {
188 iap_loop();
189 at32_led_toggle(LED2);
190 delay_ms(200);
191 }
192}
193
at32f413_board.h
header file for at-start board. set of firmware functions to manage leds and push-button....
usb_delay_ms
void usb_delay_ms(uint32_t ms)
usb delay millisecond function.
Definition project/at_start_f413/examples/acc/calibration/src/main.c:244
usb_delay_us
void usb_delay_us(uint32_t us)
usb delay microsecond function.
Definition project/at_start_f413/examples/acc/calibration/src/main.c:255
system_clock_config
void system_clock_config(void)
system clock config program
Definition project/at_start_f413/examples/acc/calibration/src/at32f413_clock.c:47
ACC_CAL_HICKTRIM
#define ACC_CAL_HICKTRIM
Definition at32f413_acc.h:52
acc_write_c2
void acc_write_c2(uint16_t acc_c2_value)
wtire the value to acc c2 register.
Definition at32f413_acc.c:131
acc_write_c3
void acc_write_c3(uint16_t acc_c3_value)
wtire the value to acc c3 register.
Definition at32f413_acc.c:141
acc_write_c1
void acc_write_c1(uint16_t acc_c1_value)
wtire the value to acc c1 register.
Definition at32f413_acc.c:121
acc_calibration_mode_enable
void acc_calibration_mode_enable(uint16_t acc_trim, confirm_state new_state)
enable or disable the acc calibration mode.
Definition at32f413_acc.c:52
LED2
@ LED2
Definition at32f413_board.h:62
delay_ms
void delay_ms(uint16_t nms)
inserts a delay time.
Definition at32f413_board.c:350
at32_led_toggle
void at32_led_toggle(led_type led)
turns selected led toggle.
Definition at32f413_board.c:304
at32_board_init
void at32_board_init()
board initialize interface init led and button
Definition at32f413_board.c:162
delay_us
void delay_us(uint32_t nus)
inserts a delay time.
Definition at32f413_board.c:330
crm_usb_clock_div_set
void crm_usb_clock_div_set(crm_usb_div_type div_value)
set crm usb division
Definition at32f413_crm.c:533
crm_periph_clock_enable
void crm_periph_clock_enable(crm_periph_clock_type value, confirm_state new_state)
enable or disable the peripheral clock
Definition at32f413_crm.c:263
crm_usb_clock_source_select
void crm_usb_clock_source_select(crm_usb_clock_source_type value)
usb 48 mhz clock source select
Definition at32f413_crm.c:854
crm_clocks_freq_get
void crm_clocks_freq_get(crm_clocks_freq_type *clocks_struct)
get crm clocks freqency
Definition at32f413_crm.c:660
CRM_USB_PERIPH_CLOCK
@ CRM_USB_PERIPH_CLOCK
Definition at32f413_crm.h:137
CRM_ACC_PERIPH_CLOCK
@ CRM_ACC_PERIPH_CLOCK
Definition at32f413_crm.h:123
CRM_USB_DIV_3
@ CRM_USB_DIV_3
Definition at32f413_crm.h:363
CRM_USB_DIV_1_5
@ CRM_USB_DIV_1_5
Definition at32f413_crm.h:358
CRM_USB_DIV_4
@ CRM_USB_DIV_4
Definition at32f413_crm.h:364
CRM_USB_DIV_3_5
@ CRM_USB_DIV_3_5
Definition at32f413_crm.h:362
CRM_USB_DIV_2
@ CRM_USB_DIV_2
Definition at32f413_crm.h:361
CRM_USB_DIV_1
@ CRM_USB_DIV_1
Definition at32f413_crm.h:359
CRM_USB_DIV_2_5
@ CRM_USB_DIV_2_5
Definition at32f413_crm.h:360
CRM_USB_CLOCK_SOURCE_HICK
@ CRM_USB_CLOCK_SOURCE_HICK
Definition at32f413_crm.h:454
USBFS_L_CAN1_RX0_IRQn
@ USBFS_L_CAN1_RX0_IRQn
Definition at32f413.h:192
TRUE
@ TRUE
Definition at32f413.h:297
nvic_irq_enable
void nvic_irq_enable(IRQn_Type irqn, uint32_t preempt_priority, uint32_t sub_priority)
enable nvic irq
Definition at32f413_misc.c:63
nvic_priority_group_config
void nvic_priority_group_config(nvic_priority_group_type priority_group)
config nvic priority group
Definition at32f413_misc.c:96
NVIC_PRIORITY_GROUP_4
@ NVIC_PRIORITY_GROUP_4
Definition at32f413_misc.h:70
jump_to_app
iapfun jump_to_app
Definition bootloader/src/iap.c:45
IAP_SUCCESS
#define IAP_SUCCESS
Definition flash_fat16.h:76
usb_clk48_s
usb_clk48_s
usb clock select
Definition at32f413_usb.h:230
USB_CLK_HEXT
@ USB_CLK_HEXT
Definition at32f413_usb.h:232
USB_CLK_HICK
@ USB_CLK_HICK
Definition at32f413_usb.h:231
hid_iap_class_handler
usbd_class_handler hid_iap_class_handler
Definition hid_iap_class.c:56
hid_iap_desc_handler
usbd_desc_handler hid_iap_desc_handler
hid device descriptor handler structure
Definition hid_iap_desc.c:67
usb_clock48m_select
void usb_clock48m_select(usb_clk48_s clk_s)
usb 48M clock select
Definition utilities/at32f413_usb_iap_demo/source_code/bootloader/src/main.c:51
main
int main(void)
main function.
Definition utilities/at32f413_usb_iap_demo/source_code/bootloader/src/main.c:154
USBFS_L_CAN1_RX0_IRQHandler
void USBFS_L_CAN1_RX0_IRQHandler(void)
this function handles usb interrupt.
Definition utilities/at32f413_usb_iap_demo/source_code/bootloader/src/main.c:123
usb_core_dev
usbd_core_type usb_core_dev
Definition utilities/at32f413_usb_iap_demo/source_code/bootloader/src/main.c:42
usbd_core_init
void usbd_core_init(usbd_core_type *udev, usb_reg_type *usb_reg, usbd_class_handler *dev_handler, usbd_desc_handler *desc_handler, uint8_t core_id)
initializes the usb core
Definition usbd_core.c:675
usbd_connect
void usbd_connect(usbd_core_type *udev)
usb device connect to host
Definition usbd_core.c:564
usbd_irq_handler
void usbd_irq_handler(usbd_core_type *udev)
usb device interrput request handler.
Definition usbd_int.c:45
USB
#define USB
Definition at32f413_usb.h:665
iap_init
void iap_init(void)
iap init.
Definition app_led3_toggle/src/iap.c:60
FLASH_APP_ADDRESS
#define FLASH_APP_ADDRESS
Definition app_led3_toggle/inc/hid_iap_user.h:48
iap_get_upgrade_flag
iap_result_type iap_get_upgrade_flag(void)
get iap upgrade complete flag
Definition app_led3_toggle/src/hid_iap_user.c:78
iap_loop
void iap_loop(void)
iap loop
Definition bootloader/src/hid_iap_user.c:485
hid_iap_class.h
usb hid iap header file
hid_iap_desc.h
usb hid descriptor header file
at32f413_clock.h
header file of clock program
crm_clocks_freq_type
crm clocks freqency structure
Definition at32f413_crm.h:470
crm_clocks_freq_type::sclk_freq
uint32_t sclk_freq
Definition at32f413_crm.h:471
usbd_core_type
usb device core struct type
Definition usbd_core.h:114
usbd_core.h
usb device core header file
usbd_int.h


AT32F413 Firmwary Library: msc_diskio.h Source File

  • usb_device
  • virtual_msc_iap
  • inc
virtual_msc_iap/inc/msc_diskio.h
Go to the documentation of this file.
1
25/* Define to prevent recursive inclusion -------------------------------------*/
26#ifndef __MSC_DISKIO_H
27#define __MSC_DISKIO_H
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33
34#include "usb_conf.h"
35#include "usb_std.h"
36
44#define INTERNAL_FLASH_LUN 0
45#define SPI_FLASH_LUN 1
46#define SD_LUN 2
47
48#define USB_FLASH_ADDR_OFFSET 0x08004000
49
50uint8_t *get_inquiry(uint8_t lun);
51 usb_sts_type msc_disk_read(uint8_t lun, uint64_t addr, uint8_t *read_buf, uint32_t len);
52 usb_sts_type msc_disk_write(uint8_t lun, uint64_t addr, uint8_t *buf, uint32_t len);
53 usb_sts_type msc_disk_capacity(uint8_t lun, uint32_t *blk_nbr, uint32_t *blk_size);
54
63#ifdef __cplusplus
64}
65#endif
66
67#endif
68
69
msc_disk_capacity
usb_sts_type msc_disk_capacity(uint8_t lun, uint32_t *blk_nbr, uint32_t *blk_size)
disk capacity
Definition virtual_msc_iap/src/msc_diskio.c:116
get_inquiry
uint8_t * get_inquiry(uint8_t lun)
get disk inquiry
Definition virtual_msc_iap/src/msc_diskio.c:58
msc_disk_read
usb_sts_type msc_disk_read(uint8_t lun, uint64_t addr, uint8_t *read_buf, uint32_t len)
disk read
Definition virtual_msc_iap/src/msc_diskio.c:74
msc_disk_write
usb_sts_type msc_disk_write(uint8_t lun, uint64_t addr, uint8_t *buf, uint32_t len)
disk write
Definition virtual_msc_iap/src/msc_diskio.c:96
usb_sts_type
usb_sts_type
usb return status
Definition usb_std.h:285
usb_conf.h
usb config header file
usb_std.h
usb standard header file


AT32F413 Firmwary Library: msc_diskio.c Source File

  • usb_device
  • virtual_msc_iap
  • src
virtual_msc_iap/src/msc_diskio.c
Go to the documentation of this file.
1
25#include "msc_diskio.h"
26#include "msc_bot_scsi.h"
27#include "flash_fat16.h"
28
37uint8_t scsi_inquiry[MSC_SUPPORT_MAX_LUN][SCSI_INQUIRY_DATA_LENGTH] =
38{
39 /* lun = 0 */
40 {
41 0x00, /* peripheral device type (direct-access device) */
42 0x80, /* removable media bit */
43 0x00, /* ansi version, ecma version, iso version */
44 0x01, /* respond data format */
45 SCSI_INQUIRY_DATA_LENGTH - 5, /* additional length */
46 0x00, 0x00, 0x00, /* reserved */
47 'A', 'T', '3', '2', ' ', ' ', ' ', ' ', /* vendor information "AT32" */
48 'M', 's', 'c', ' ', 'i', 'a', 'p', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', /* Product identification "Disk" */
49 '2', '.', '0', '0' /* product revision level */
50 },
51};
52
58uint8_t *get_inquiry(uint8_t lun)
59{
60 if(lun < MSC_SUPPORT_MAX_LUN)
61 return (uint8_t *)scsi_inquiry[lun];
62 else
63 return NULL;
64}
65
74 usb_sts_type msc_disk_read(uint8_t lun, uint64_t addr, uint8_t *read_buf, uint32_t len)
75{
76
77 switch(lun)
78 {
79 case 0:
80 flash_fat16_read((uint32_t)addr, read_buf, len);
81 break;
82 case 1:
83 break;
84 }
85 return USB_OK;
86}
87
96 usb_sts_type msc_disk_write(uint8_t lun, uint64_t addr, uint8_t *buf, uint32_t len)
97{
98 switch(lun)
99 {
100 case 0:
101 flash_fat16_write((uint32_t)addr, buf, len);
102 break;
103 case 1:
104 break;
105 }
106 return USB_OK;
107}
108
116 usb_sts_type msc_disk_capacity(uint8_t lun, uint32_t *blk_nbr, uint32_t *blk_size)
117{
118 switch(lun)
119 {
120 case INTERNAL_FLASH_LUN:
121 *blk_nbr = 0x0FFF;
122 *blk_size = FLASH_SECTOR_2K_SIZE;
123 break;
124 case SPI_FLASH_LUN:
125 break;
126 case SD_LUN:
127 break;
128 default:
129 break;
130 }
131 return USB_OK;
132}
133
flash_fat16.h
fat16 file system header file
INTERNAL_FLASH_LUN
#define INTERNAL_FLASH_LUN
Definition composite_vcp_msc/inc/msc_diskio.h:44
msc_disk_capacity
usb_sts_type msc_disk_capacity(uint8_t lun, uint32_t *blk_nbr, uint32_t *blk_size)
disk capacity
Definition composite_vcp_msc/src/msc_diskio.c:135
SD_LUN
#define SD_LUN
Definition composite_vcp_msc/inc/msc_diskio.h:46
SPI_FLASH_LUN
#define SPI_FLASH_LUN
Definition composite_vcp_msc/inc/msc_diskio.h:45
get_inquiry
uint8_t * get_inquiry(uint8_t lun)
get disk inquiry
Definition composite_vcp_msc/src/msc_diskio.c:58
msc_disk_read
usb_sts_type msc_disk_read(uint8_t lun, uint64_t addr, uint8_t *read_buf, uint32_t len)
disk read
Definition composite_vcp_msc/src/msc_diskio.c:74
msc_disk_write
usb_sts_type msc_disk_write(uint8_t lun, uint64_t addr, uint8_t *buf, uint32_t len)
disk write
Definition composite_vcp_msc/src/msc_diskio.c:101
scsi_inquiry
uint8_t scsi_inquiry[MSC_SUPPORT_MAX_LUN][SCSI_INQUIRY_DATA_LENGTH]
Definition virtual_msc_iap/src/msc_diskio.c:37
NULL
#define NULL
Definition emmc_card/inc/at32_sdio.h:340
FLASH_SECTOR_2K_SIZE
#define FLASH_SECTOR_2K_SIZE
Definition flash_fat16.h:62
flash_fat16_write
uint32_t flash_fat16_write(uint32_t fat_lbk, uint8_t *data, uint32_t len)
write a logical block address
Definition flash_fat16.c:332
flash_fat16_read
uint32_t flash_fat16_read(uint32_t fat_lbk, uint8_t *data, uint32_t len)
read a logical block address
Definition flash_fat16.c:291
SCSI_INQUIRY_DATA_LENGTH
#define SCSI_INQUIRY_DATA_LENGTH
Definition cdc_msc_class.h:156
MSC_SUPPORT_MAX_LUN
#define MSC_SUPPORT_MAX_LUN
Definition cdc_msc_class.h:82
usb_sts_type
usb_sts_type
usb return status
Definition usb_std.h:285
USB_OK
@ USB_OK
Definition usb_std.h:286
msc_bot_scsi.h
usb mass storage bulk-only transport and scsi command header file


AT32F413 Firmwary Library: winusb_class.c Source File

  • middlewares
  • usbd_class
  • winusb
winusb_class.c
Go to the documentation of this file.
1
25#include "usbd_core.h"
26#include "winusb_class.h"
27#include "winusb_desc.h"
28#include "string.h"
29#include "stdio.h"
30#include "stdlib.h"
31
45static usb_sts_type class_init_handler(void *udev);
46static usb_sts_type class_clear_handler(void *udev);
47static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup);
48static usb_sts_type class_ept0_tx_handler(void *udev);
49static usb_sts_type class_ept0_rx_handler(void *udev);
50static usb_sts_type class_in_handler(void *udev, uint8_t ept_num);
51static usb_sts_type class_out_handler(void *udev, uint8_t ept_num);
52static usb_sts_type class_sof_handler(void *udev);
53static usb_sts_type class_event_handler(void *udev, usbd_event_type event);
54#if (USBD_SUPPORT_WINUSB == 1)
55static usb_sts_type usbd_get_winusb_descriptor(usbd_core_type *udev);
56#endif
57static usb_sts_type winusb_struct_init(winusb_struct_type *p_winusb);
58
59/* winusb data struct */
60 winusb_struct_type winusb_struct;
61
62/*winusb receive buffer define*/
63static uint32_t g_winusb_rx_buffer[16];
64
65/* usb device class handler */
66 usbd_class_handler winusb_class_handler =
67{
68 class_init_handler,
69 class_clear_handler,
70 class_setup_handler,
71 class_ept0_tx_handler,
72 class_ept0_rx_handler,
73 class_in_handler,
74 class_out_handler,
75 class_sof_handler,
76 class_event_handler,
77 &winusb_struct
78};
84static usb_sts_type class_init_handler(void *udev)
85{
86 usb_sts_type status = USB_OK;
87 usbd_core_type *pudev = (usbd_core_type *)udev;
88 winusb_struct_type *p_winusb = (winusb_struct_type *)pudev->class_handler->pdata;
89
90 /* init winusb struct */
91 winusb_struct_init(p_winusb);
92
93 p_winusb->maxpacket = USBD_FS_WINUSB_MAXPACKET_SIZE;
94
95#ifndef USB_EPT_AUTO_MALLOC_BUFFER
96 /* use user define buffer address */
97 usbd_ept_buf_custom_define(pudev, USBD_WINUSB_BULK_IN_EPT, EPT1_TX_ADDR);
98 usbd_ept_buf_custom_define(pudev, USBD_WINUSB_BULK_OUT_EPT, EPT1_RX_ADDR);
99#endif
100
101 /* open out endpoint */
102 usbd_ept_open(pudev, USBD_WINUSB_BULK_OUT_EPT, EPT_BULK_TYPE, USBD_WINUSB_OUT_MAXPACKET_SIZE);
103
104 /* open in endpoint */
105 usbd_ept_open(pudev, USBD_WINUSB_BULK_IN_EPT, EPT_BULK_TYPE, USBD_WINUSB_IN_MAXPACKET_SIZE);
106
107 /* set out endpoint to receive status */
108 usbd_ept_recv(pudev, USBD_WINUSB_BULK_OUT_EPT, p_winusb->g_rx_buff, USBD_WINUSB_OUT_MAXPACKET_SIZE);
109
110 return status;
111}
112
118static usb_sts_type class_clear_handler(void *udev)
119{
120 usb_sts_type status = USB_OK;
121 usbd_core_type *pudev = (usbd_core_type *)udev;
122
123 /* close in endpoint */
124 usbd_ept_close(pudev, USBD_WINUSB_BULK_IN_EPT);
125
126 /* close out endpoint */
127 usbd_ept_close(pudev, USBD_WINUSB_BULK_OUT_EPT);
128
129 return status;
130}
131
138static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
139{
140 usb_sts_type status = USB_OK;
141 usbd_core_type *pudev = (usbd_core_type *)udev;
142 winusb_struct_type *p_winusb = (winusb_struct_type *)pudev->class_handler->pdata;
143
144 switch(setup->bmRequestType & USB_REQ_TYPE_RESERVED)
145 {
146 /* class request */
147 case USB_REQ_TYPE_CLASS:
148 usbd_ctrl_unsupport(pudev);
149 break;
150 /* standard request */
151 case USB_REQ_TYPE_STANDARD:
152 switch(setup->bRequest)
153 {
154 case USB_STD_REQ_GET_DESCRIPTOR:
155 usbd_ctrl_unsupport(pudev);
156 break;
157 case USB_STD_REQ_GET_INTERFACE:
158 usbd_ctrl_send(pudev, (uint8_t *)&p_winusb->alt_setting, 1);
159 break;
160 case USB_STD_REQ_SET_INTERFACE:
161 p_winusb->alt_setting = setup->wValue;
162 break;
163 case USB_STD_REQ_CLEAR_FEATURE:
164 break;
165 case USB_STD_REQ_SET_FEATURE:
166 break;
167 default:
168 usbd_ctrl_unsupport(pudev);
169 break;
170 }
171 break;
172#if (USBD_SUPPORT_WINUSB == 1)
173 case USB_REQ_TYPE_VENDOR:
174 if(setup->bRequest == WINUSB_BMS_VENDOR_CODE)
175 {
176 usbd_get_winusb_descriptor(pudev);
177 }
178 else
179 {
180 usbd_ctrl_unsupport(pudev);
181 }
182 break;
183#endif
184 default:
185 usbd_ctrl_unsupport(pudev);
186 break;
187 }
188 return status;
189}
190
191#if (USBD_SUPPORT_WINUSB == 1)
192static usb_sts_type usbd_get_winusb_descriptor(usbd_core_type *udev)
193{
194 usb_sts_type ret = USB_OK;
195 uint16_t len = 0;
196 usbd_desc_t *desc = NULL;
197 uint8_t desc_type = udev->setup.wIndex;
198
199 switch(desc_type)
200 {
201 case USB_WINUSB_COMPAT_ID:
202 desc = udev->desc_handler->get_device_winusb_os_feature();
203 break;
204 case USB_WINUSB_PROPERTIES_ID:
205 desc = udev->desc_handler->get_device_winusb_os_property();
206 break;
207 default:
208 usbd_ctrl_unsupport(udev);
209 return ret;
210 }
211 if(desc != NULL)
212 {
213 if((desc->length != 0) && (udev->setup.wLength != 0))
214 {
215 len = MIN(desc->length , udev->setup.wLength);
216 usbd_ctrl_send(udev, desc->descriptor, len);
217 }
218 }
219
220 return ret;
221}
222#endif
223
229static usb_sts_type class_ept0_tx_handler(void *udev)
230{
231 usb_sts_type status = USB_OK;
232
233 /* ...user code... */
234
235 return status;
236}
237
243static usb_sts_type class_ept0_rx_handler(void *udev)
244{
245 usb_sts_type status = USB_OK;
246 return status;
247}
248
255static usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
256{
257 usbd_core_type *pudev = (usbd_core_type *)udev;
258 winusb_struct_type *p_winusb = (winusb_struct_type *)pudev->class_handler->pdata;
259 usb_sts_type status = USB_OK;
260
261 /* ...user code...
262 trans next packet data
263 */
264 p_winusb->g_tx_completed = 1;
265
266 return status;
267}
268
275static usb_sts_type class_out_handler(void *udev, uint8_t ept_num)
276{
277 usb_sts_type status = USB_OK;
278 usbd_core_type *pudev = (usbd_core_type *)udev;
279 winusb_struct_type *p_winusb = (winusb_struct_type *)pudev->class_handler->pdata;
280
281 /* get endpoint receive data length */
282 p_winusb->g_rxlen = usbd_get_recv_len(pudev, ept_num);
283
284 /*set recv flag*/
285 p_winusb->g_rx_completed = 1;
286
287 return status;
288}
289
295static usb_sts_type class_sof_handler(void *udev)
296{
297 usb_sts_type status = USB_OK;
298
299 /* ...user code... */
300
301 return status;
302}
303
310static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
311{
312 usb_sts_type status = USB_OK;
313 switch(event)
314 {
315 case USBD_RESET_EVENT:
316
317 /* ...user code... */
318
319 break;
320 case USBD_SUSPEND_EVENT:
321
322 /* ...user code... */
323
324 break;
325 case USBD_WAKEUP_EVENT:
326 /* ...user code... */
327
328 break;
329
330 default:
331 break;
332 }
333 return status;
334}
335
341static usb_sts_type winusb_struct_init(winusb_struct_type *p_winusb)
342{
343 p_winusb->g_tx_completed = 1;
344 p_winusb->g_rx_completed = 0;
345 p_winusb->alt_setting = 0;
346 p_winusb->g_rx_buff = (uint8_t *)g_winusb_rx_buffer;
347 return USB_OK;
348}
349
356uint16_t usb_winusb_get_rxdata(void *udev, uint8_t *recv_data)
357{
358 uint16_t i_index = 0;
359 uint16_t tmp_len = 0;
360 usbd_core_type *pudev = (usbd_core_type *)udev;
361 winusb_struct_type *p_winusb = (winusb_struct_type *)pudev->class_handler->pdata;
362
363 if(p_winusb->g_rx_completed == 0)
364 {
365 return 0;
366 }
367 p_winusb->g_rx_completed = 0;
368 tmp_len = p_winusb->g_rxlen;
369 for(i_index = 0; i_index < p_winusb->g_rxlen; i_index ++)
370 {
371 recv_data[i_index] = p_winusb->g_rx_buff[i_index];
372 }
373
374 usbd_ept_recv(pudev, USBD_WINUSB_BULK_OUT_EPT, p_winusb->g_rx_buff, p_winusb->maxpacket);
375
376 return tmp_len;
377}
378
386 error_status usb_winusb_send_data(void *udev, uint8_t *send_data, uint16_t len)
387{
388 error_status status = SUCCESS;
389 usbd_core_type *pudev = (usbd_core_type *)udev;
390 winusb_struct_type *p_winusb = (winusb_struct_type *)pudev->class_handler->pdata;
391 if(p_winusb->g_tx_completed)
392 {
393 p_winusb->g_tx_completed = 0;
394 usbd_ept_send(pudev, USBD_WINUSB_BULK_IN_EPT, send_data, len);
395 }
396 else
397 {
398 status = ERROR;
399 }
400 return status;
401}
402
EPT1_RX_ADDR
#define EPT1_RX_ADDR
Definition project/at_start_f413/examples/acc/calibration/inc/usb_conf.h:77
EPT1_TX_ADDR
#define EPT1_TX_ADDR
Definition project/at_start_f413/examples/acc/calibration/inc/usb_conf.h:76
error_status
error_status
error status
Definition at32f413.h:302
ERROR
@ ERROR
Definition at32f413.h:302
SUCCESS
@ SUCCESS
Definition at32f413.h:302
NULL
#define NULL
Definition emmc_card/inc/at32_sdio.h:340
EPT_BULK_TYPE
@ EPT_BULK_TYPE
Definition at32f413_usb.h:204
USB_STD_REQ_CLEAR_FEATURE
#define USB_STD_REQ_CLEAR_FEATURE
Definition usb_std.h:77
MIN
#define MIN(a, b)
min and max define
Definition usb_std.h:260
USB_REQ_TYPE_STANDARD
#define USB_REQ_TYPE_STANDARD
usb request type
Definition usb_std.h:62
USB_STD_REQ_GET_DESCRIPTOR
#define USB_STD_REQ_GET_DESCRIPTOR
Definition usb_std.h:80
USB_STD_REQ_SET_FEATURE
#define USB_STD_REQ_SET_FEATURE
Definition usb_std.h:78
USB_REQ_TYPE_VENDOR
#define USB_REQ_TYPE_VENDOR
Definition usb_std.h:64
USB_WINUSB_COMPAT_ID
#define USB_WINUSB_COMPAT_ID
usb winusb feature id
Definition usb_std.h:127
USB_WINUSB_PROPERTIES_ID
#define USB_WINUSB_PROPERTIES_ID
Definition usb_std.h:128
USB_STD_REQ_SET_INTERFACE
#define USB_STD_REQ_SET_INTERFACE
Definition usb_std.h:85
USB_REQ_TYPE_RESERVED
#define USB_REQ_TYPE_RESERVED
Definition usb_std.h:65
USB_STD_REQ_GET_INTERFACE
#define USB_STD_REQ_GET_INTERFACE
Definition usb_std.h:84
USB_REQ_TYPE_CLASS
#define USB_REQ_TYPE_CLASS
Definition usb_std.h:63
usb_sts_type
usb_sts_type
usb return status
Definition usb_std.h:285
USB_OK
@ USB_OK
Definition usb_std.h:286
USBD_WINUSB_OUT_MAXPACKET_SIZE
#define USBD_WINUSB_OUT_MAXPACKET_SIZE
Definition winusb_class.h:61
USBD_WINUSB_BULK_OUT_EPT
#define USBD_WINUSB_BULK_OUT_EPT
Definition winusb_class.h:53
USBD_WINUSB_IN_MAXPACKET_SIZE
#define USBD_WINUSB_IN_MAXPACKET_SIZE
Definition winusb_class.h:60
USBD_WINUSB_BULK_IN_EPT
#define USBD_WINUSB_BULK_IN_EPT
usb use endpoint define
Definition winusb_class.h:52
WINUSB_BMS_VENDOR_CODE
#define WINUSB_BMS_VENDOR_CODE
Definition winusb_class.h:63
USBD_FS_WINUSB_MAXPACKET_SIZE
#define USBD_FS_WINUSB_MAXPACKET_SIZE
usb in and out max packet size define
Definition winusb_class.h:59
class_sof_handler
static usb_sts_type class_sof_handler(void *udev)
usb device sof handler
Definition winusb_class.c:295
class_in_handler
static usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
usb device transmision complete handler
Definition winusb_class.c:255
class_clear_handler
static usb_sts_type class_clear_handler(void *udev)
clear endpoint or other state
Definition winusb_class.c:118
class_setup_handler
static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
usb device class setup request handler
Definition winusb_class.c:138
class_ept0_tx_handler
static usb_sts_type class_ept0_tx_handler(void *udev)
usb device endpoint 0 in status stage complete
Definition winusb_class.c:229
g_winusb_rx_buffer
static uint32_t g_winusb_rx_buffer[16]
Definition winusb_class.c:63
class_ept0_rx_handler
static usb_sts_type class_ept0_rx_handler(void *udev)
usb device endpoint 0 out status stage complete
Definition winusb_class.c:243
usb_winusb_get_rxdata
uint16_t usb_winusb_get_rxdata(void *udev, uint8_t *recv_data)
usb device class rx data process
Definition winusb_class.c:356
class_event_handler
static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
usb device event handler
Definition winusb_class.c:310
winusb_struct_init
static usb_sts_type winusb_struct_init(winusb_struct_type *p_winusb)
usb device winusb init
Definition winusb_class.c:341
winusb_class_handler
usbd_class_handler winusb_class_handler
Definition winusb_class.c:66
class_init_handler
static usb_sts_type class_init_handler(void *udev)
initialize usb endpoint
Definition winusb_class.c:84
winusb_struct
winusb_struct_type winusb_struct
Definition winusb_class.c:60
class_out_handler
static usb_sts_type class_out_handler(void *udev, uint8_t ept_num)
usb device endpoint receive data
Definition winusb_class.c:275
usb_winusb_send_data
error_status usb_winusb_send_data(void *udev, uint8_t *send_data, uint16_t len)
usb device class send data
Definition winusb_class.c:386
usbd_ept_close
void usbd_ept_close(usbd_core_type *udev, uint8_t ept_addr)
usb close endpoint
Definition usbd_core.c:541
usbd_ept_recv
void usbd_ept_recv(usbd_core_type *udev, uint8_t ept_num, uint8_t *buffer, uint16_t len)
usb endpoint receive data
Definition usbd_core.c:364
usbd_ept_buf_custom_define
void usbd_ept_buf_custom_define(usbd_core_type *udev, uint8_t ept_addr, uint32_t addr)
usb custom define endpoint buffer
Definition usbd_core.c:464
usbd_ept_open
void usbd_ept_open(usbd_core_type *udev, uint8_t ept_addr, uint8_t ept_type, uint16_t maxpacket)
usb open endpoint
Definition usbd_core.c:506
usbd_ctrl_send
void usbd_ctrl_send(usbd_core_type *udev, uint8_t *buffer, uint16_t len)
usb control endpoint send data
Definition usbd_core.c:175
usbd_get_recv_len
uint32_t usbd_get_recv_len(usbd_core_type *udev, uint8_t ept_addr)
usb endpoint get receive data length
Definition usbd_core.c:397
usbd_ctrl_unsupport
void usbd_ctrl_unsupport(usbd_core_type *udev)
un-support device request
Definition usbd_core.c:289
usbd_ept_send
void usbd_ept_send(usbd_core_type *udev, uint8_t ept_num, uint8_t *buffer, uint16_t len)
usb endpoint send data
Definition usbd_core.c:304
usbd_event_type
usbd_event_type
usb device event
Definition usbd_core.h:54
USBD_SUSPEND_EVENT
@ USBD_SUSPEND_EVENT
Definition usbd_core.h:57
USBD_RESET_EVENT
@ USBD_RESET_EVENT
Definition usbd_core.h:56
USBD_WAKEUP_EVENT
@ USBD_WAKEUP_EVENT
Definition usbd_core.h:58
usb_setup_type
format of usb setup data
Definition usb_std.h:297
usb_setup_type::wValue
uint16_t wValue
Definition usb_std.h:300
usb_setup_type::wLength
uint16_t wLength
Definition usb_std.h:303
usb_setup_type::bmRequestType
uint8_t bmRequestType
Definition usb_std.h:298
usb_setup_type::wIndex
uint16_t wIndex
Definition usb_std.h:301
usb_setup_type::bRequest
uint8_t bRequest
Definition usb_std.h:299
usbd_class_handler
usb device class handler
Definition usbd_core.h:97
usbd_class_handler::pdata
void * pdata
Definition usbd_core.h:107
usbd_core_type
usb device core struct type
Definition usbd_core.h:114
usbd_core_type::class_handler
usbd_class_handler * class_handler
Definition usbd_core.h:117
usbd_core_type::setup
usb_setup_type setup
Definition usbd_core.h:123
usbd_core_type::desc_handler
usbd_desc_handler * desc_handler
Definition usbd_core.h:118
usbd_desc_t
usb device descriptor struct
Definition usbd_core.h:66
usbd_desc_t::length
uint16_t length
Definition usbd_core.h:67
usbd_desc_t::descriptor
uint8_t * descriptor
Definition usbd_core.h:68
winusb_struct_type
usb winusb class struct
Definition winusb_class.h:77
winusb_struct_type::g_rxlen
uint16_t g_rxlen
Definition winusb_class.h:80
winusb_struct_type::alt_setting
uint32_t alt_setting
Definition winusb_class.h:78
winusb_struct_type::g_tx_completed
__IO uint8_t g_tx_completed
Definition winusb_class.h:81
winusb_struct_type::g_rx_buff
uint8_t * g_rx_buff
Definition winusb_class.h:79
winusb_struct_type::maxpacket
uint32_t maxpacket
Definition winusb_class.h:82
winusb_struct_type::g_rx_completed
__IO uint8_t g_rx_completed
Definition winusb_class.h:81
usbd_core.h
usb device core header file
winusb_class.h
usb winusb class file
winusb_desc.h
usb winusb descriptor header file


AT32F413 Firmwary Library: winusb_class.h Source File

  • middlewares
  • usbd_class
  • winusb
winusb_class.h
Go to the documentation of this file.
1
26 /* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __WINUSB_CLASS_H
28#define __WINUSB_CLASS_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "usb_std.h"
35#include "usbd_core.h"
36
52#define USBD_WINUSB_BULK_IN_EPT 0x81
53#define USBD_WINUSB_BULK_OUT_EPT 0x01
54
59#define USBD_FS_WINUSB_MAXPACKET_SIZE 0x40
60#define USBD_WINUSB_IN_MAXPACKET_SIZE USBD_FS_WINUSB_MAXPACKET_SIZE
61#define USBD_WINUSB_OUT_MAXPACKET_SIZE USBD_FS_WINUSB_MAXPACKET_SIZE
62
63#define WINUSB_BMS_VENDOR_CODE 0xA0
64
76typedef struct
77{
78 uint32_t alt_setting;
79 uint8_t *g_rx_buff;
80 uint16_t g_len, g_rxlen;
81 __IO uint8_t g_tx_completed, g_rx_completed;
82 uint32_t maxpacket;
83}winusb_struct_type;
84
85
93extern usbd_class_handler winusb_class_handler;
94uint16_t usb_winusb_get_rxdata(void *udev, uint8_t *recv_data);
95 error_status usb_winusb_send_data(void *udev, uint8_t *send_data, uint16_t len);
96
108#ifdef __cplusplus
109}
110#endif
111
112#endif
113
114
115
116
error_status
error_status
error status
Definition at32f413.h:302
usb_winusb_get_rxdata
uint16_t usb_winusb_get_rxdata(void *udev, uint8_t *recv_data)
usb device class rx data process
Definition winusb_class.c:356
winusb_class_handler
usbd_class_handler winusb_class_handler
Definition winusb_class.c:66
usb_winusb_send_data
error_status usb_winusb_send_data(void *udev, uint8_t *send_data, uint16_t len)
usb device class send data
Definition winusb_class.c:386
usbd_class_handler
usb device class handler
Definition usbd_core.h:97
winusb_struct_type
usb winusb class struct
Definition winusb_class.h:77
winusb_struct_type::alt_setting
uint32_t alt_setting
Definition winusb_class.h:78
winusb_struct_type::g_len
uint16_t g_len
Definition winusb_class.h:80
winusb_struct_type::g_rx_buff
uint8_t * g_rx_buff
Definition winusb_class.h:79
winusb_struct_type::maxpacket
uint32_t maxpacket
Definition winusb_class.h:82
winusb_struct_type::g_rx_completed
__IO uint8_t g_rx_completed
Definition winusb_class.h:81
usb_std.h
usb standard header file
usbd_core.h
usb device core header file


AT32F413 Firmwary Library: winusb_desc.c Source File

  • middlewares
  • usbd_class
  • winusb
winusb_desc.c
Go to the documentation of this file.
1
25#include "stdio.h"
26#include "usb_std.h"
27#include "usbd_sdr.h"
28#include "usbd_core.h"
29#include "winusb_desc.h"
30
44static usbd_desc_t *get_device_descriptor(void);
45static usbd_desc_t *get_device_qualifier(void);
46static usbd_desc_t *get_device_configuration(void);
47static usbd_desc_t *get_device_other_speed(void);
48static usbd_desc_t *get_device_lang_id(void);
49static usbd_desc_t *get_device_manufacturer_string(void);
50static usbd_desc_t *get_device_product_string(void);
51static usbd_desc_t *get_device_serial_string(void);
52static usbd_desc_t *get_device_interface_string(void);
53static usbd_desc_t *get_device_config_string(void);
54
55static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf);
56static void usbd_int_to_unicode (uint32_t value , uint8_t *pbuf , uint8_t len);
57static void get_serial_num(void);
58
59#if (USBD_SUPPORT_WINUSB == 1)
60static usbd_desc_t *get_device_winusb_os_string(void);
61static usbd_desc_t *get_device_winusb_os_feature(void);
62static usbd_desc_t *get_device_winusb_os_property(void);
63#endif
64
65#if defined ( __ICCARM__ ) /* iar compiler */
66 #pragma data_alignment=4
67#endif
68ALIGNED_HEAD static uint8_t g_usbd_desc_buffer[256] ALIGNED_TAIL;
69
73 usbd_desc_handler winusb_desc_handler =
74{
75 get_device_descriptor,
76 get_device_qualifier,
77 get_device_configuration,
78 get_device_other_speed,
79 get_device_lang_id,
80 get_device_manufacturer_string,
81 get_device_product_string,
82 get_device_serial_string,
83 get_device_interface_string,
84 get_device_config_string,
85#if (USBD_SUPPORT_WINUSB == 1)
86 get_device_winusb_os_string,
87 get_device_winusb_os_feature,
88 get_device_winusb_os_property
89#endif
90};
91
95#if defined ( __ICCARM__ ) /* iar compiler */
96 #pragma data_alignment=4
97#endif
98ALIGNED_HEAD static uint8_t g_usbd_descriptor[USB_DEVICE_DESC_LEN] ALIGNED_TAIL =
99{
100 USB_DEVICE_DESC_LEN, /* bLength */
101 USB_DESCIPTOR_TYPE_DEVICE, /* bDescriptorType */
102 0x00, /* bcdUSB */
103 0x02,
104 0x00, /* bDeviceClass */
105 0x00, /* bDeviceSubClass */
106 0x00, /* bDeviceProtocol */
107 USB_MAX_EP0_SIZE, /* bMaxPacketSize */
108 LBYTE(USBD_WINUSB_VENDOR_ID), /* idVendor */
109 HBYTE(USBD_WINUSB_VENDOR_ID), /* idVendor */
110 LBYTE(USBD_WINUSB_PRODUCT_ID), /* idProduct */
111 HBYTE(USBD_WINUSB_PRODUCT_ID), /* idProduct */
112 0x00, /* bcdDevice rel. 2.00 */
113 0x02,
114 USB_MFC_STRING, /* Index of manufacturer string */
115 USB_PRODUCT_STRING, /* Index of product string */
116 USB_SERIAL_STRING, /* Index of serial number string */
117 1 /* bNumConfigurations */
118};
119
123#if defined ( __ICCARM__ ) /* iar compiler */
124 #pragma data_alignment=4
125#endif
126ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_WINUSB_CONFIG_DESC_SIZE] ALIGNED_TAIL =
127{
128 USB_DEVICE_CFG_DESC_LEN, /* bLength: configuration descriptor size */
129 USB_DESCIPTOR_TYPE_CONFIGURATION, /* bDescriptorType: configuration */
130 LBYTE(USBD_WINUSB_CONFIG_DESC_SIZE), /* wTotalLength: bytes returned */
131 HBYTE(USBD_WINUSB_CONFIG_DESC_SIZE), /* wTotalLength: bytes returned */
132 0x01, /* bNumInterfaces: 1 interface */
133 0x01, /* bConfigurationValue: configuration value */
134 0x00, /* iConfiguration: index of string descriptor describing
135 the configuration */
136 0xC0, /* bmAttributes: self powered */
137 0x32, /* MaxPower 100 mA: this current is used for detecting vbus */
138
139 USB_DEVICE_IF_DESC_LEN, /* bLength: interface descriptor size */
140 USB_DESCIPTOR_TYPE_INTERFACE, /* bDescriptorType: interface descriptor type */
141 0x00, /* bInterfaceNumber: number of interface */
142 0x00, /* bAlternateSetting: alternate set */
143 0x02, /* bNumEndpoints: number of endpoints */
144 0xff, /* bInterfaceClass: Vendor specific*/
145 0x00, /* bInterfaceSubClass: subclass code */
146 0x00, /* bInterfaceProtocol: protocol code */
147 0x00, /* iInterface: index of string descriptor */
148
149 USB_DEVICE_EPT_LEN, /* bLength: size of endpoint descriptor in bytes */
150 USB_DESCIPTOR_TYPE_ENDPOINT, /* bDescriptorType: endpoint descriptor type */
151 USBD_WINUSB_BULK_OUT_EPT, /* bEndpointAddress: the address of endpoint on usb device described by this descriptor */
152 USB_EPT_DESC_BULK, /* bmAttributes: endpoint attributes */
153 LBYTE(USBD_WINUSB_OUT_MAXPACKET_SIZE),
154 HBYTE(USBD_WINUSB_OUT_MAXPACKET_SIZE), /* wMaxPacketSize: maximum packe size this endpoint */
155 0x00, /* bInterval: interval for polling endpoint for data transfers */
156
157 USB_DEVICE_EPT_LEN, /* bLength: size of endpoint descriptor in bytes */
158 USB_DESCIPTOR_TYPE_ENDPOINT, /* bDescriptorType: endpoint descriptor type */
159 USBD_WINUSB_BULK_IN_EPT, /* bEndpointAddress: the address of endpoint on usb device described by this descriptor */
160 USB_EPT_DESC_BULK, /* bmAttributes: endpoint attributes */
161 LBYTE(USBD_WINUSB_IN_MAXPACKET_SIZE),
162 HBYTE(USBD_WINUSB_IN_MAXPACKET_SIZE), /* wMaxPacketSize: maximum packe size this endpoint */
163 0x00, /* bInterval: interval for polling endpoint for data transfers */
164};
165
169#if defined ( __ICCARM__ ) /* iar compiler */
170 #pragma data_alignment=4
171#endif
172ALIGNED_HEAD static uint8_t g_string_lang_id[USBD_WINUSB_SIZ_STRING_LANGID] ALIGNED_TAIL =
173{
174 USBD_WINUSB_SIZ_STRING_LANGID,
175 USB_DESCIPTOR_TYPE_STRING,
176 0x09,
177 0x04,
178};
179
183#if defined ( __ICCARM__ ) /* iar compiler */
184 #pragma data_alignment=4
185#endif
186ALIGNED_HEAD static uint8_t g_string_serial[USBD_WINUSB_SIZ_STRING_SERIAL] ALIGNED_TAIL =
187{
188 USBD_WINUSB_SIZ_STRING_SERIAL,
189 USB_DESCIPTOR_TYPE_STRING,
190};
191
192
193/* device descriptor */
194static usbd_desc_t device_descriptor =
195{
196 USB_DEVICE_DESC_LEN,
197 g_usbd_descriptor
198};
199
200/* config descriptor */
201static usbd_desc_t config_descriptor =
202{
203 USBD_WINUSB_CONFIG_DESC_SIZE,
204 g_usbd_configuration
205};
206
207/* langid descriptor */
208static usbd_desc_t langid_descriptor =
209{
210 USBD_WINUSB_SIZ_STRING_LANGID,
211 g_string_lang_id
212};
213
214/* serial descriptor */
215static usbd_desc_t serial_descriptor =
216{
217 USBD_WINUSB_SIZ_STRING_SERIAL,
218 g_string_serial
219};
220
221static usbd_desc_t vp_desc;
222
229static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf)
230{
231 uint16_t str_len = 0, id_pos = 2;
232 uint8_t *tmp_str = string;
233
234 while(*tmp_str != '\0')
235 {
236 str_len ++;
237 unicode_buf[id_pos ++] = *tmp_str ++;
238 unicode_buf[id_pos ++] = 0x00;
239 }
240
241 str_len = str_len * 2 + 2;
242 unicode_buf[0] = (uint8_t)str_len;
243 unicode_buf[1] = USB_DESCIPTOR_TYPE_STRING;
244
245 return str_len;
246}
247
255static void usbd_int_to_unicode (uint32_t value , uint8_t *pbuf , uint8_t len)
256{
257 uint8_t idx = 0;
258
259 for( idx = 0 ; idx < len ; idx ++)
260 {
261 if( ((value >> 28)) < 0xA )
262 {
263 pbuf[ 2 * idx] = (value >> 28) + '0';
264 }
265 else
266 {
267 pbuf[2 * idx] = (value >> 28) + 'A' - 10;
268 }
269
270 value = value << 4;
271
272 pbuf[2 * idx + 1] = 0;
273 }
274}
275
281static void get_serial_num(void)
282{
283 uint32_t serial0, serial1, serial2;
284
285 serial0 = *(uint32_t*)MCU_ID1;
286 serial1 = *(uint32_t*)MCU_ID2;
287 serial2 = *(uint32_t*)MCU_ID3;
288
289 serial0 += serial2;
290
291 if (serial0 != 0)
292 {
293 usbd_int_to_unicode (serial0, &g_string_serial[2] ,8);
294 usbd_int_to_unicode (serial1, &g_string_serial[18] ,4);
295 }
296}
297
303static usbd_desc_t *get_device_descriptor(void)
304{
305 return &device_descriptor;
306}
307
313static usbd_desc_t * get_device_qualifier(void)
314{
315 return NULL;
316}
317
323static usbd_desc_t *get_device_configuration(void)
324{
325 return &config_descriptor;
326}
327
328
334static usbd_desc_t *get_device_other_speed(void)
335{
336 return NULL;
337}
338
344static usbd_desc_t *get_device_lang_id(void)
345{
346 return &langid_descriptor;
347}
348
349
355static usbd_desc_t *get_device_manufacturer_string(void)
356{
357 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_WINUSB_DESC_MANUFACTURER_STRING, g_usbd_desc_buffer);
358 vp_desc.descriptor = g_usbd_desc_buffer;
359 return &vp_desc;
360}
361
367static usbd_desc_t *get_device_product_string(void)
368{
369 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_WINUSB_DESC_PRODUCT_STRING, g_usbd_desc_buffer);
370 vp_desc.descriptor = g_usbd_desc_buffer;
371 return &vp_desc;
372}
373
379static usbd_desc_t *get_device_serial_string(void)
380{
381 get_serial_num();
382 return &serial_descriptor;
383}
384
390static usbd_desc_t *get_device_interface_string(void)
391{
392 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_WINUSB_DESC_INTERFACE_STRING, g_usbd_desc_buffer);
393 vp_desc.descriptor = g_usbd_desc_buffer;
394 return &vp_desc;
395}
396
402static usbd_desc_t *get_device_config_string(void)
403{
404 vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_WINUSB_DESC_CONFIGURATION_STRING, g_usbd_desc_buffer);
405 vp_desc.descriptor = g_usbd_desc_buffer;
406 return &vp_desc;
407}
408
409#if (USBD_SUPPORT_WINUSB == 1)
410
411#define USB_LEN_OS_FEATURE_DESC 0x28
412#define USB_LEN_OS_PROPERTY_DESC 0x8E
413
414/* os string descriptor fields */
415const uint8_t winusb_os_string[8] = {
416 'M','S','F','T','1','0','0',
417 WINUSB_BMS_VENDOR_CODE,
418};
419
420#define U32TO8C(v) ((v & 0xFF), ((v >> 8) & 0xFF), ((v >> 16) & 0xFF), ((v >> 24) & 0xFF))
421
422#if defined ( __ICCARM__ ) /* iar compiler */
423 #pragma data_alignment=4
424#endif
425ALIGNED_HEAD static uint8_t g_usbd_winusb_os_feature[USB_LEN_OS_FEATURE_DESC] ALIGNED_TAIL =
426{
427 USB_LEN_OS_FEATURE_DESC, 0x00, 0x00, 0x00, /*dwlength: 4 byte*/
428 0x00, 0x01, /* bcd version 1.0 */
429 0x04, 0x00, /* windex: extended compat ID descritor*/
430 0x01, /* bcount the number of custom property sections */
431 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* reserved */
432 /* function section */
433 0x00, /* first interface number */
434 0x00, /* reserved */
435 'W', 'I', 'N', 'U', 'S', 'B', 0x00, 0x00, /* 8 byte: the function compatible id */
436 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,/* 8 byte: the function subcompatible id */
437 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /* reserved 6 bytes */
438};
439
440#if defined ( __ICCARM__ ) /* iar compiler */
441 #pragma data_alignment=4
442#endif
443ALIGNED_HEAD static uint8_t g_usbd_winusb_os_property[USB_LEN_OS_PROPERTY_DESC] ALIGNED_TAIL =
444{
445 USB_LEN_OS_PROPERTY_DESC, 0x00, 0x00, 0x00,/* dwlength: 4 byte*/
446 0x00, 0x01, /* bcd version 1.0 */
447 0x05, 0x00, /* property descriptor index(5) */
448 0x01, 0x00, /* wcount: number of section (1) */
449
450 /* custom property section */
451 0x84, 0x00, 0x00, 0x00, /* dwsize: size of property section */
452 0x01, 0x00, 0x00, 0x00, /* property data type */
453 0x28, 0x00, /* property name length */
454 /* property name: DeviceinterfaceGUID */
455 'D', 0x00, 'e', 0x00, 'v', 0x00, 'i', 0x00, 'c', 0x00, 'e', 0x00,
456 'I', 0x00, 'n', 0x00, 't', 0x00, 'e', 0x00, 'r', 0x00, 'f', 0x00,
457 'a', 0x00, 'c', 0x00, 'e', 0x00, 'G', 0x00, 'U', 0x00, 'I', 0x00,
458 'D', 0x00, 0x00, 0x00,
459
460 0x4E, 0x00, 0x00, 0x00, /* property data length */
461 /*property data: {13eb360b-bc1e-46cb-ac8b-ef3da47b4062} */
462 '{', 0x00, '1', 0x00, '3', 0x00, 'E', 0x00, 'B', 0x00, '3', 0x00,
463 '6', 0x00, '0', 0x00, 'B', 0x00, '-', 0x00, 'B', 0x00, 'C', 0x00,
464 '1', 0x00, 'E', 0x00, '-', 0x00, '4', 0x00, '6', 0x00, 'C', 0x00,
465 'B', 0x00, '-', 0x00, 'A', 0x00, 'C', 0x00, '8', 0x00, 'B', 0x00,
466 '-', 0x00, 'E', 0x00, 'F', 0x00, '3', 0x00, 'D', 0x00, 'A', 0x00,
467 '4', 0x00, '7', 0x00, 'B', 0x00, '4', 0x00, '0', 0x00, '6', 0x00,
468 '2', 0x00, '}', 0x00, 0x00, 0x00
469};
470
471static usbd_desc_t winusb_os_feature_descriptor =
472{
473 USB_LEN_OS_FEATURE_DESC,
474 g_usbd_winusb_os_feature
475};
476
477static usbd_desc_t winusb_os_property_descriptor =
478{
479 USB_LEN_OS_PROPERTY_DESC,
480 g_usbd_winusb_os_property
481};
482
488static usbd_desc_t *get_device_winusb_os_string(void)
489{
490 vp_desc.length = usbd_unicode_convert((uint8_t *)winusb_os_string, g_usbd_desc_buffer);
491 vp_desc.descriptor = g_usbd_desc_buffer;
492 return &vp_desc;
493}
494
500static usbd_desc_t *get_device_winusb_os_feature(void)
501{
502 return &winusb_os_feature_descriptor;
503}
504
510static usbd_desc_t *get_device_winusb_os_property(void)
511{
512 return &winusb_os_property_descriptor;
513}
514
515
516#endif
517
NULL
#define NULL
Definition emmc_card/inc/at32_sdio.h:340
MCU_ID1
#define MCU_ID1
Definition audio_desc.h:214
MCU_ID2
#define MCU_ID2
Definition audio_desc.h:215
MCU_ID3
#define MCU_ID3
Definition audio_desc.h:216
HBYTE
#define HBYTE(x)
Definition usb_std.h:271
USB_DEVICE_EPT_LEN
#define USB_DEVICE_EPT_LEN
Definition usb_std.h:159
USB_MAX_EP0_SIZE
#define USB_MAX_EP0_SIZE
endpoint 0 max size
Definition usb_std.h:248
USB_PRODUCT_STRING
#define USB_PRODUCT_STRING
Definition usb_std.h:105
USB_DESCIPTOR_TYPE_CONFIGURATION
#define USB_DESCIPTOR_TYPE_CONFIGURATION
Definition usb_std.h:92
LBYTE
#define LBYTE(x)
low byte and high byte define
Definition usb_std.h:270
USB_DESCIPTOR_TYPE_ENDPOINT
#define USB_DESCIPTOR_TYPE_ENDPOINT
Definition usb_std.h:95
USB_DEVICE_DESC_LEN
#define USB_DEVICE_DESC_LEN
Definition usb_std.h:156
USB_MFC_STRING
#define USB_MFC_STRING
Definition usb_std.h:104
USB_EPT_DESC_BULK
#define USB_EPT_DESC_BULK
Definition usb_std.h:183
USB_DEVICE_IF_DESC_LEN
#define USB_DEVICE_IF_DESC_LEN
Definition usb_std.h:158
USB_DEVICE_CFG_DESC_LEN
#define USB_DEVICE_CFG_DESC_LEN
Definition usb_std.h:157
USB_SERIAL_STRING
#define USB_SERIAL_STRING
Definition usb_std.h:106
USB_DESCIPTOR_TYPE_DEVICE
#define USB_DESCIPTOR_TYPE_DEVICE
usb standard device type
Definition usb_std.h:91
USB_DESCIPTOR_TYPE_STRING
#define USB_DESCIPTOR_TYPE_STRING
Definition usb_std.h:93
USB_DESCIPTOR_TYPE_INTERFACE
#define USB_DESCIPTOR_TYPE_INTERFACE
Definition usb_std.h:94
USBD_WINUSB_OUT_MAXPACKET_SIZE
#define USBD_WINUSB_OUT_MAXPACKET_SIZE
Definition winusb_class.h:61
USBD_WINUSB_BULK_OUT_EPT
#define USBD_WINUSB_BULK_OUT_EPT
Definition winusb_class.h:53
USBD_WINUSB_IN_MAXPACKET_SIZE
#define USBD_WINUSB_IN_MAXPACKET_SIZE
Definition winusb_class.h:60
USBD_WINUSB_BULK_IN_EPT
#define USBD_WINUSB_BULK_IN_EPT
usb use endpoint define
Definition winusb_class.h:52
WINUSB_BMS_VENDOR_CODE
#define WINUSB_BMS_VENDOR_CODE
Definition winusb_class.h:63
USBD_WINUSB_SIZ_STRING_SERIAL
#define USBD_WINUSB_SIZ_STRING_SERIAL
Definition winusb_desc.h:59
USBD_WINUSB_DESC_MANUFACTURER_STRING
#define USBD_WINUSB_DESC_MANUFACTURER_STRING
usb string define(vendor, product configuration, interface)
Definition winusb_desc.h:64
USBD_WINUSB_VENDOR_ID
#define USBD_WINUSB_VENDOR_ID
usb vendor id and product id define
Definition winusb_desc.h:51
USBD_WINUSB_SIZ_STRING_LANGID
#define USBD_WINUSB_SIZ_STRING_LANGID
Definition winusb_desc.h:58
USBD_WINUSB_DESC_INTERFACE_STRING
#define USBD_WINUSB_DESC_INTERFACE_STRING
Definition winusb_desc.h:67
USBD_WINUSB_CONFIG_DESC_SIZE
#define USBD_WINUSB_CONFIG_DESC_SIZE
usb descriptor size define
Definition winusb_desc.h:57
USBD_WINUSB_PRODUCT_ID
#define USBD_WINUSB_PRODUCT_ID
Definition winusb_desc.h:52
USBD_WINUSB_DESC_CONFIGURATION_STRING
#define USBD_WINUSB_DESC_CONFIGURATION_STRING
Definition winusb_desc.h:66
USBD_WINUSB_DESC_PRODUCT_STRING
#define USBD_WINUSB_DESC_PRODUCT_STRING
Definition winusb_desc.h:65
serial_descriptor
static usbd_desc_t serial_descriptor
Definition winusb_desc.c:215
device_descriptor
static usbd_desc_t device_descriptor
Definition winusb_desc.c:194
get_device_configuration
static usbd_desc_t * get_device_configuration(void)
get config descriptor
Definition winusb_desc.c:323
winusb_desc_handler
usbd_desc_handler winusb_desc_handler
device descriptor handler structure
Definition winusb_desc.c:73
langid_descriptor
static usbd_desc_t langid_descriptor
Definition winusb_desc.c:208
get_device_descriptor
static usbd_desc_t * get_device_descriptor(void)
get device descriptor
Definition winusb_desc.c:303
get_device_manufacturer_string
static usbd_desc_t * get_device_manufacturer_string(void)
get manufacturer descriptor
Definition winusb_desc.c:355
get_device_qualifier
static usbd_desc_t * get_device_qualifier(void)
get device qualifier
Definition winusb_desc.c:313
get_device_interface_string
static usbd_desc_t * get_device_interface_string(void)
get interface descriptor
Definition winusb_desc.c:390
vp_desc
static usbd_desc_t vp_desc
Definition winusb_desc.c:221
get_device_other_speed
static usbd_desc_t * get_device_other_speed(void)
get other speed descriptor
Definition winusb_desc.c:334
ALIGNED_TAIL
static ALIGNED_HEAD uint8_t g_usbd_desc_buffer[256] ALIGNED_TAIL
usb device standard descriptor
Definition winusb_desc.c:68
get_device_product_string
static usbd_desc_t * get_device_product_string(void)
get product descriptor
Definition winusb_desc.c:367
get_device_config_string
static usbd_desc_t * get_device_config_string(void)
get device config descriptor
Definition winusb_desc.c:402
usbd_unicode_convert
static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf)
standard usb unicode convert
Definition winusb_desc.c:229
get_device_lang_id
static usbd_desc_t * get_device_lang_id(void)
get lang id descriptor
Definition winusb_desc.c:344
get_serial_num
static void get_serial_num(void)
usb get serial number
Definition winusb_desc.c:281
config_descriptor
static usbd_desc_t config_descriptor
Definition winusb_desc.c:201
get_device_serial_string
static usbd_desc_t * get_device_serial_string(void)
get serial descriptor
Definition winusb_desc.c:379
usbd_int_to_unicode
static void usbd_int_to_unicode(uint32_t value, uint8_t *pbuf, uint8_t len)
usb int convert to unicode
Definition winusb_desc.c:255
usbd_desc_handler
usb device descriptor handler
Definition usbd_core.h:75
usbd_desc_t
usb device descriptor struct
Definition usbd_core.h:66
usbd_desc_t::length
uint16_t length
Definition usbd_core.h:67
usbd_desc_t::descriptor
uint8_t * descriptor
Definition usbd_core.h:68
usb_std.h
usb standard header file
usbd_core.h
usb device core header file
usbd_sdr.h
usb standard request header file
winusb_desc.h
usb winusb descriptor header file


AT32F413 Firmwary Library: winusb_desc.h Source File

  • middlewares
  • usbd_class
  • winusb
winusb_desc.h
Go to the documentation of this file.
1
26/* define to prevent recursive inclusion -------------------------------------*/
27#ifndef __WINUSB_DESC_H
28#define __WINUSB_DESC_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "winusb_class.h"
35#include "usbd_core.h"
36
51#define USBD_WINUSB_VENDOR_ID 0x2E3C
52#define USBD_WINUSB_PRODUCT_ID 0x5780
53
57#define USBD_WINUSB_CONFIG_DESC_SIZE 32
58#define USBD_WINUSB_SIZ_STRING_LANGID 4
59#define USBD_WINUSB_SIZ_STRING_SERIAL 0x1A
60
64#define USBD_WINUSB_DESC_MANUFACTURER_STRING "Artery"
65#define USBD_WINUSB_DESC_PRODUCT_STRING "AT32 WinUSB"
66#define USBD_WINUSB_DESC_CONFIGURATION_STRING "WinUSB Config"
67#define USBD_WINUSB_DESC_INTERFACE_STRING "WinUSB Interface"
68
72#define MCU_ID1 (0x1FFFF7E8)
73#define MCU_ID2 (0x1FFFF7EC)
74#define MCU_ID3 (0x1FFFF7F0)
79extern usbd_desc_handler winusb_desc_handler;
80
81
89#ifdef __cplusplus
90}
91#endif
92
93#endif
winusb_desc_handler
usbd_desc_handler winusb_desc_handler
device descriptor handler structure
Definition winusb_desc.c:73
usbd_desc_handler
usb device descriptor handler
Definition usbd_core.h:75
usbd_core.h
usb device core header file
winusb_class.h
usb winusb class file